langflower 0.2.2 → 0.3.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.
- package/README.md +9 -5
- package/dist/index.js +2812 -736
- package/docs/public/product.md +7 -2
- package/package.json +1 -1
- package/ui-dist/assets/langflower-mark.svg +33 -0
- package/ui-dist/chunk-2F7UKSIL.js +4 -0
- package/ui-dist/{chunk-IASSR2ON.js → chunk-B3D35SQ5.js} +1 -1
- package/ui-dist/index.html +2 -2
- package/ui-dist/main-TL5G57BL.js +323 -0
- package/ui-dist/styles-O74ATCGZ.css +1 -0
- package/vendor/node-sdk/dist/node-factory/define-llm-node/define-llm-node.d.ts +2 -0
- package/vendor/node-sdk/dist/node-factory/define-llm-node/define-llm-node.js +1 -0
- package/vendor/node-sdk/dist/node-factory/define-reactive-node/define-reactive-node.d.ts +1 -0
- package/vendor/node-sdk/dist/node-factory/define-reactive-node/define-reactive-node.js +3 -1
- package/vendor/node-sdk/dist/node-factory/define-reactive-node/io-helpers.d.ts +6 -0
- package/vendor/node-sdk/dist/node-factory/define-reactive-node/port-meta.d.ts +5 -0
- package/vendor/node-sdk/dist/node-factory/define-reactive-node/types.d.ts +8 -0
- package/vendor/node-sdk/dist/node-state.d.ts +28 -0
- package/vendor/node-sdk/dist/node-state.js +1 -0
- package/vendor/runtime/dist/feed-log-fold.d.ts +26 -0
- package/vendor/runtime/dist/feed-log-fold.js +113 -0
- package/vendor/runtime/dist/runtime-editor.d.ts +6 -0
- package/vendor/runtime/dist/runtime-editor.js +86 -0
- package/vendor/runtime/dist/runtime-runner.d.ts +28 -3
- package/vendor/runtime/dist/runtime-runner.js +99 -8
- package/vendor/runtime/dist/runtime.d.ts +3 -1
- package/vendor/runtime/dist/runtime.js +1 -0
- package/vendor/runtime/dist/types.d.ts +84 -4
- package/vendor/server/skeleton/instructions.md +3 -1
- package/vendor/server/skeleton/nodes/my-nodes/README.md +12 -0
- package/vendor/server/skeleton/nodes/my-nodes/review-gate.ts +5 -0
- package/vendor/server/skeleton/skills/langflower-helper/SKILL.md +121 -21
- package/vendor/server/skeleton/skills/langflower-helper/architecture.md +37 -5
- package/vendor/server/skeleton/skills/langflower-helper/layout.md +25 -13
- package/vendor/server/skeleton/skills/langflower-node-writer/SKILL.md +22 -4
- package/vendor/server/skeleton/skills/langflower-workflow-writer/SKILL.md +20 -1
- package/vendor/server/skeleton/workflows/starter.json +3 -3
- package/ui-dist/chunk-HEF6F5HN.js +0 -4
- package/ui-dist/main-66PVIOBC.js +0 -323
- package/ui-dist/styles-Y56BLXVS.css +0 -1
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import{$ as ag,$a as En,$b as T,A as ee,Aa as hg,Ab as rt,B as se,Ba as ms,Bb as st,C as ig,Ca as tn,Cb as Le,D as Il,Da as kt,Db as Ze,E as kl,Ea as Vo,Eb as G,F as fs,Fa as fg,Fb as xg,G as Wt,Ga as gg,Gb as tt,H as $n,Ha as Al,Hb as w,I as rg,Ia as Gt,Ib as ue,J as Bn,Ja as u,Jb as H,K as Dl,Ka as ys,Kb as Wo,L as ve,La as Ll,Lb as Hn,M as te,Ma as Gi,Mb as Bl,N as Vi,Na as vs,Nb as Hl,O as de,Oa as Fl,Ob as Ul,P as Me,Pa as qi,Pb as Sg,Q as Ho,Qa as ws,Qb as Go,R as Jt,Ra as mg,Rb as In,S as Re,Sa as yg,Sb as Un,T as Tl,Ta as vg,Tb as on,U as j,Ua as wg,Ub as rn,V as Ml,Va as zl,Vb as Cs,W as sg,Wa as B,Wb as Pg,X as Be,Xa as $l,Xb as b,Y as Ie,Ya as _e,Yb as ye,Z as f,Za as bg,Zb as Vl,_ as gs,_a as Pn,_b as Ct,a as p,aa as Sn,ab as jo,ac as Eg,b as C,ba as It,bb as Cg,bc as Xe,c as gn,ca as x,cb as _g,cc as _s,d as dC,da as S,db as bs,dc as Ig,e as lC,ea as ce,eb as K,ec as kg,f as A,fa as dg,fb as P,fc as Dg,g as Xf,ga as wt,gb as E,gc as Tg,h as Qf,ha as pt,hb as nn,i as cs,ia as je,ib as ao,j as ot,ja as lg,jb as X,k as vt,ka as ke,kb as Q,l as Jf,la as en,lb as M,m as Ne,ma as Rl,mb as y,n as jt,na as ji,nb as m,o as pe,oa as U,ob as F,p as eg,pa as Nl,pb as O,q as El,qa as cg,qb as N,r as tg,ra as Uo,rb as bt,s as us,sa as ug,sb as $t,t as I,ta as Ol,tb as z,u as Te,ua as pg,ub as he,v as zn,va as xe,vb as R,w as ps,wa as Wi,wb as ge,x as hs,xa as Nt,xb as c,y as ng,ya as Ot,yb as it,z as og,za as He,zb as Je}from"./chunk-2F7UKSIL.js";var jm=dC((Lz,Vm)=>{"use strict";Vm.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var Mg=null;function kn(){return Mg}function jl(n){Mg??=n}var Ki=class{},xs=(()=>{class n{historyGo(t){throw new Error("")}static \u0275fac=function(o){return new(o||n)};static \u0275prov=j({token:n,factory:()=>f(Rg),providedIn:"platform"})}return n})();var Rg=(()=>{class n extends xs{_location;_history;_doc=f(pt);constructor(){super(),this._location=window.location,this._history=window.history}getBaseHrefFromDOM(){return kn().getBaseHref(this._doc)}onPopState(t){let o=kn().getGlobalEventTarget(this._doc,"window");return o.addEventListener("popstate",t,!1),()=>o.removeEventListener("popstate",t)}onHashChange(t){let o=kn().getGlobalEventTarget(this._doc,"window");return o.addEventListener("hashchange",t,!1),()=>o.removeEventListener("hashchange",t)}get href(){return this._location.href}get protocol(){return this._location.protocol}get hostname(){return this._location.hostname}get port(){return this._location.port}get pathname(){return this._location.pathname}get search(){return this._location.search}get hash(){return this._location.hash}set pathname(t){this._location.pathname=t}pushState(t,o,i){this._history.pushState(t,o,i)}replaceState(t,o,i){this._history.replaceState(t,o,i)}forward(){this._history.forward()}back(){this._history.back()}historyGo(t=0){this._history.go(t)}getState(){return this._history.state}static \u0275fac=function(o){return new(o||n)};static \u0275prov=j({token:n,factory:()=>new n,providedIn:"platform"})}return n})();function Ag(n,e){return n?e?n.endsWith("/")?e.startsWith("/")?n+e.slice(1):n+e:e.startsWith("/")?n+e:`${n}/${e}`:n:e}function Ng(n){let e=n.search(/#|\?|$/);return n[e-1]==="/"?n.slice(0,e-1)+n.slice(e):n}function Vn(n){return n&&n[0]!=="?"?`?${n}`:n}var Ss=(()=>{class n{historyGo(t){throw new Error("")}static \u0275fac=function(o){return new(o||n)};static \u0275prov=j({token:n,factory:()=>f(uC),providedIn:"root"})}return n})(),cC=new Be(""),uC=(()=>{class n extends Ss{_platformLocation;_baseHref;_removeListenerFns=[];constructor(t,o){super(),this._platformLocation=t,this._baseHref=o??this._platformLocation.getBaseHrefFromDOM()??f(pt).location?.origin??""}ngOnDestroy(){for(;this._removeListenerFns.length;)this._removeListenerFns.pop()()}onPopState(t){this._removeListenerFns.push(this._platformLocation.onPopState(t),this._platformLocation.onHashChange(t))}getBaseHref(){return this._baseHref}prepareExternalUrl(t){return Ag(this._baseHref,t)}path(t=!1){let o=this._platformLocation.pathname+Vn(this._platformLocation.search),i=this._platformLocation.hash;return i&&t?`${o}${i}`:o}pushState(t,o,i,r){let s=this.prepareExternalUrl(i+Vn(r));this._platformLocation.pushState(t,o,s)}replaceState(t,o,i,r){let s=this.prepareExternalUrl(i+Vn(r));this._platformLocation.replaceState(t,o,s)}forward(){this._platformLocation.forward()}back(){this._platformLocation.back()}getState(){return this._platformLocation.getState()}historyGo(t=0){this._platformLocation.historyGo?.(t)}static \u0275fac=function(o){return new(o||n)(Ie(xs),Ie(cC,8))};static \u0275prov=j({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var qo=(()=>{class n{_subject=new ot;_basePath;_locationStrategy;_urlChangeListeners=[];_urlChangeSubscription=null;constructor(t){this._locationStrategy=t;let o=this._locationStrategy.getBaseHref();this._basePath=fC(Ng(Og(o))),this._locationStrategy.onPopState(i=>{this._subject.next({url:this.path(!0),pop:!0,state:i.state,type:i.type})})}ngOnDestroy(){this._urlChangeSubscription?.unsubscribe(),this._urlChangeListeners=[]}path(t=!1){return this.normalize(this._locationStrategy.path(t))}getState(){return this._locationStrategy.getState()}isCurrentPathEqualTo(t,o=""){return this.path()==this.normalize(t+Vn(o))}normalize(t){return n.stripTrailingSlash(hC(this._basePath,Og(t)))}prepareExternalUrl(t){return t&&t[0]!=="/"&&(t="/"+t),this._locationStrategy.prepareExternalUrl(t)}go(t,o="",i=null){this._locationStrategy.pushState(i,"",t,o),this._notifyUrlChangeListeners(this.prepareExternalUrl(t+Vn(o)),i)}replaceState(t,o="",i=null){this._locationStrategy.replaceState(i,"",t,o),this._notifyUrlChangeListeners(this.prepareExternalUrl(t+Vn(o)),i)}forward(){this._locationStrategy.forward()}back(){this._locationStrategy.back()}historyGo(t=0){this._locationStrategy.historyGo?.(t)}onUrlChange(t){return this._urlChangeListeners.push(t),this._urlChangeSubscription??=this.subscribe(o=>{this._notifyUrlChangeListeners(o.url,o.state)}),()=>{let o=this._urlChangeListeners.indexOf(t);this._urlChangeListeners.splice(o,1),this._urlChangeListeners.length===0&&(this._urlChangeSubscription?.unsubscribe(),this._urlChangeSubscription=null)}}_notifyUrlChangeListeners(t="",o){this._urlChangeListeners.forEach(i=>i(t,o))}subscribe(t,o,i){return this._subject.subscribe({next:t,error:o??void 0,complete:i??void 0})}static normalizeQueryParams=Vn;static joinWithSlash=Ag;static stripTrailingSlash=Ng;static \u0275fac=function(o){return new(o||n)(Ie(Ss))};static \u0275prov=j({token:n,factory:()=>pC(),providedIn:"root"})}return n})();function pC(){return new qo(Ie(Ss))}function hC(n,e){if(!n||!e.startsWith(n))return e;let t=e.substring(n.length);return t===""||["/",";","?","#"].includes(t[0])?t:e}function Og(n){return n.replace(/\/index\.html$/,"")}function fC(n){if(new RegExp("^(https?:)?//").test(n)){let[,t]=n.split(/\/\/[^\/]+/);return t}return n}var Ps=(()=>{class n{_viewContainerRef;ngComponentOutlet=null;ngComponentOutletInputs;ngComponentOutletInjector;ngComponentOutletEnvironmentInjector;ngComponentOutletContent;ngComponentOutletNgModule;_componentRef;_moduleRef;_inputsUsed=new Map;get componentInstance(){return this._componentRef?.instance??null}constructor(t){this._viewContainerRef=t}_needToReCreateNgModuleInstance(t){return t.ngComponentOutletNgModule!==void 0}_needToReCreateComponentInstance(t){return t.ngComponentOutlet!==void 0||t.ngComponentOutletContent!==void 0||t.ngComponentOutletInjector!==void 0||t.ngComponentOutletEnvironmentInjector!==void 0||this._needToReCreateNgModuleInstance(t)}ngOnChanges(t){if(this._needToReCreateComponentInstance(t)&&(this._viewContainerRef.clear(),this._inputsUsed.clear(),this._componentRef=void 0,this.ngComponentOutlet)){let o=this.ngComponentOutletInjector||this._viewContainerRef.parentInjector;this._needToReCreateNgModuleInstance(t)&&(this._moduleRef?.destroy(),this.ngComponentOutletNgModule?this._moduleRef=wg(this.ngComponentOutletNgModule,gC(o)):this._moduleRef=void 0),this._componentRef=this._viewContainerRef.createComponent(this.ngComponentOutlet,{injector:o,ngModuleRef:this._moduleRef,projectableNodes:this.ngComponentOutletContent,environmentInjector:this.ngComponentOutletEnvironmentInjector})}}ngDoCheck(){if(this._componentRef){if(this.ngComponentOutletInputs)for(let t of Object.keys(this.ngComponentOutletInputs))this._inputsUsed.set(t,!0);this._applyInputStateDiff(this._componentRef)}}ngOnDestroy(){this._moduleRef?.destroy()}_applyInputStateDiff(t){for(let[o,i]of this._inputsUsed)i?(t.setInput(o,this.ngComponentOutletInputs[o]),this._inputsUsed.set(o,!1)):(t.setInput(o,void 0),this._inputsUsed.delete(o))}static \u0275fac=function(o){return new(o||n)(vs(qi))};static \u0275dir=_e({type:n,selectors:[["","ngComponentOutlet",""]],inputs:{ngComponentOutlet:"ngComponentOutlet",ngComponentOutletInputs:"ngComponentOutletInputs",ngComponentOutletInjector:"ngComponentOutletInjector",ngComponentOutletEnvironmentInjector:"ngComponentOutletEnvironmentInjector",ngComponentOutletContent:"ngComponentOutletContent",ngComponentOutletNgModule:"ngComponentOutletNgModule"},exportAs:["ngComponentOutlet"],features:[Wi]})}return n})();function gC(n){return n.get(yg).injector}var ql=(()=>{class n{_viewContainerRef;_viewRef=null;ngTemplateOutletContext=null;ngTemplateOutlet=null;ngTemplateOutletInjector=null;injector=f(wt);constructor(t){this._viewContainerRef=t}ngOnChanges(t){if(this._shouldRecreateView(t)){let o=this._viewContainerRef;if(this._viewRef&&o.remove(o.indexOf(this._viewRef)),!this.ngTemplateOutlet){this._viewRef=null;return}let i=this._createContextForwardProxy();this._viewRef=o.createEmbeddedView(this.ngTemplateOutlet,i,{injector:this._getInjector()})}}_getInjector(){return this.ngTemplateOutletInjector==="outlet"?this.injector:this.ngTemplateOutletInjector??void 0}_shouldRecreateView(t){return!!t.ngTemplateOutlet||!!t.ngTemplateOutletInjector}_createContextForwardProxy(){return new Proxy({},{set:(t,o,i)=>this.ngTemplateOutletContext?Reflect.set(this.ngTemplateOutletContext,o,i):!1,get:(t,o,i)=>{if(this.ngTemplateOutletContext)return Reflect.get(this.ngTemplateOutletContext,o,i)}})}static \u0275fac=function(o){return new(o||n)(vs(qi))};static \u0275dir=_e({type:n,selectors:[["","ngTemplateOutlet",""]],inputs:{ngTemplateOutletContext:"ngTemplateOutletContext",ngTemplateOutlet:"ngTemplateOutlet",ngTemplateOutletInjector:"ngTemplateOutletInjector"},features:[Wi]})}return n})();function mC(n,e){return new Re(2100,!1)}var Wl=class{createSubscription(e,t,o){return ye(()=>e.subscribe({next:t,error:o}))}dispose(e){ye(()=>e.unsubscribe())}},Gl=class{createSubscription(e,t,o){return e.then(i=>t?.(i),i=>o?.(i)),{unsubscribe:()=>{t=null,o=null}}}dispose(e){e.unsubscribe()}},yC=new Gl,vC=new Wl,sn=(()=>{class n{_ref;_latestValue=null;markForCheckOnValueUpdate=!0;_subscription=null;_obj=null;_strategy=null;applicationErrorHandler=f(ji);constructor(t){this._ref=t}ngOnDestroy(){this._subscription&&this._dispose(),this._ref=null}transform(t){if(!this._obj){if(t)try{this.markForCheckOnValueUpdate=!1,this._subscribe(t)}finally{this.markForCheckOnValueUpdate=!0}return this._latestValue}return t!==this._obj?(this._dispose(),this.transform(t)):this._latestValue}_subscribe(t){this._obj=t,this._strategy=this._selectStrategy(t),this._subscription=this._strategy.createSubscription(t,o=>this._updateLatestValue(t,o),o=>this.applicationErrorHandler(o))}_selectStrategy(t){if(ws(t))return yC;if(mg(t))return vC;throw mC(n,t)}_dispose(){this._strategy.dispose(this._subscription),this._latestValue=null,this._subscription=null,this._obj=null}_updateLatestValue(t,o){t===this._obj&&(this._latestValue=o,this.markForCheckOnValueUpdate&&this._ref?.markForCheck())}static \u0275fac=function(o){return new(o||n)(vs(_s,16))};static \u0275pipe=bg({name:"async",type:n,pure:!1})}return n})();var Yi=(()=>{class n{static \u0275fac=function(o){return new(o||n)};static \u0275mod=$l({type:n});static \u0275inj=Ml({})}return n})();function Kl(n,e){e=encodeURIComponent(e);for(let t of n.split(";")){let o=t.indexOf("="),[i,r]=o==-1?[t,""]:[t.slice(0,o),t.slice(o+1)];if(i.trim()===e)return decodeURIComponent(r)}return null}var Yl="browser";function Lg(n){return n===Yl}var Zi=class{_doc;constructor(e){this._doc=e}manager},Es=(()=>{class n extends Zi{constructor(t){super(t)}supports(t){return!0}addEventListener(t,o,i,r){return t.addEventListener(o,i,r),()=>this.removeEventListener(t,o,i,r)}removeEventListener(t,o,i,r){return t.removeEventListener(o,i,r)}static \u0275fac=function(o){return new(o||n)(Ie(pt))};static \u0275prov=j({token:n,factory:n.\u0275fac})}return n})(),Ds=new Be(""),Jl=(()=>{class n{_zone;_plugins;_eventNameToPlugin=new Map;constructor(t,o){this._zone=o,t.forEach(s=>{s.manager=this});let i=t.filter(s=>!(s instanceof Es));this._plugins=i.slice().reverse();let r=t.find(s=>s instanceof Es);r&&this._plugins.push(r)}addEventListener(t,o,i,r){return this._findPluginFor(o).addEventListener(t,o,i,r)}getZone(){return this._zone}_findPluginFor(t){let o=this._eventNameToPlugin.get(t);if(o)return o;if(o=this._plugins.find(r=>r.supports(t)),!o)throw new Re(-5101,!1);return this._eventNameToPlugin.set(t,o),o}static \u0275fac=function(o){return new(o||n)(Ie(Ds),Ie(en))};static \u0275prov=j({token:n,factory:n.\u0275fac})}return n})(),Zl="ng-app-id";function Fg(n){for(let e of n)e.remove()}function zg(n,e){let t=e.createElement("style");return t.textContent=n,t}function CC(n,e,t,o){let i=n.head?.querySelectorAll(`style[${Zl}="${e}"],link[${Zl}="${e}"]`);if(!i||i.length===0)return!1;for(let r of i)r.removeAttribute(Zl),r instanceof HTMLLinkElement?o.set(r.href.slice(r.href.lastIndexOf("/")+1),{usage:0,elements:[r]}):r.textContent&&t.set(r.textContent,{usage:0,elements:[r]});return!0}function Ql(n,e){let t=e.createElement("link");return t.setAttribute("rel","stylesheet"),t.setAttribute("href",n),t}var ec=(()=>{class n{doc;appId;nonce;inline=new Map;external=new Map;hosts=new Set;constructor(t,o,i,r={}){this.doc=t,this.appId=o,this.nonce=i,CC(t,o,this.inline,this.external)&&this.hosts.add(t.head)}addStyles(t,o){for(let i of t)this.addUsage(i,this.inline,zg);o?.forEach(i=>this.addUsage(i,this.external,Ql))}removeStyles(t,o){for(let i of t)this.removeUsage(i,this.inline);o?.forEach(i=>this.removeUsage(i,this.external))}addUsage(t,o,i){let r=o.get(t);r?r.usage++:o.set(t,{usage:1,elements:[...this.hosts].map(s=>this.addElement(s,i(t,this.doc)))})}removeUsage(t,o){let i=o.get(t);i&&(i.usage--,i.usage<=0&&(Fg(i.elements),o.delete(t)))}ngOnDestroy(){for(let[,{elements:t}]of[...this.inline,...this.external])Fg(t);this.hosts.clear()}addHost(t){if(!this.hosts.has(t)){this.hosts.add(t);for(let[o,{elements:i}]of this.inline)i.push(this.addElement(t,zg(o,this.doc)));for(let[o,{elements:i}]of this.external)i.push(this.addElement(t,Ql(o,this.doc)))}}removeHost(t){this.hosts.delete(t);for(let o of[...this.inline.values(),...this.external.values()]){let i=[];for(let r of o.elements)r.parentNode===t?r.remove():i.push(r);o.elements=i}}addElement(t,o){return this.nonce&&o.setAttribute("nonce",this.nonce),t.appendChild(o)}static \u0275fac=function(o){return new(o||n)(Ie(pt),Ie(Nl),Ie(Ol,8),Ie(Uo))};static \u0275prov=j({token:n,factory:n.\u0275fac})}return n})(),Xl={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/",math:"http://www.w3.org/1998/Math/MathML"},tc=/%COMP%/g;var Bg="%COMP%",_C=`_nghost-${Bg}`,xC=`_ngcontent-${Bg}`,SC=!0,PC=new Be("",{factory:()=>SC});function EC(n){return xC.replace(tc,n)}function IC(n){return _C.replace(tc,n)}function Hg(n,e){return e.map(t=>t.replace(tc,n))}var Ji=(()=>{class n{eventManager;sharedStylesHost;appId;removeStylesOnCompDestroy;doc;ngZone;nonce;tracingService;rendererByCompId=new Map;defaultRenderer;constructor(t,o,i,r,s,a,d=null,l=null){this.eventManager=t,this.sharedStylesHost=o,this.appId=i,this.removeStylesOnCompDestroy=r,this.doc=s,this.ngZone=a,this.nonce=d,this.tracingService=l,this.defaultRenderer=new Xi(t,s,a,this.tracingService)}createRenderer(t,o){if(!t||!o)return this.defaultRenderer;let i=this.getOrCreateRenderer(t,o);return i instanceof ks?i.applyToHost(t):i instanceof Qi&&i.applyStyles(),i}getOrCreateRenderer(t,o){let i=this.rendererByCompId,r=i.get(o.id);if(!r){let s=this.doc,a=this.ngZone,d=this.eventManager,l=this.sharedStylesHost,h=this.removeStylesOnCompDestroy,g=this.tracingService;switch(o.encapsulation){case ms.Emulated:r=new ks(d,l,o,this.appId,h,s,a,g);break;case ms.ShadowDom:return new Is(d,t,o,s,a,this.nonce,g,l);case ms.ExperimentalIsolatedShadowDom:return new Is(d,t,o,s,a,this.nonce,g);default:r=new Qi(d,l,o,h,s,a,g);break}i.set(o.id,r)}return r}ngOnDestroy(){this.rendererByCompId.clear()}componentReplaced(t){this.rendererByCompId.delete(t)}static \u0275fac=function(o){return new(o||n)(Ie(Jl),Ie(Gi),Ie(Nl),Ie(PC),Ie(pt),Ie(en),Ie(Ol),Ie(gg,8))};static \u0275prov=j({token:n,factory:n.\u0275fac})}return n})(),Xi=class{eventManager;doc;ngZone;tracingService;data=Object.create(null);throwOnSyntheticProps=!0;constructor(e,t,o,i){this.eventManager=e,this.doc=t,this.ngZone=o,this.tracingService=i}destroy(){}destroyNode=null;createElement(e,t){return t?this.doc.createElementNS(Xl[t]||t,e):this.doc.createElement(e)}createComment(e){return this.doc.createComment(e)}createText(e){return this.doc.createTextNode(e)}appendChild(e,t){($g(e)?e.content:e).appendChild(t)}insertBefore(e,t,o){e&&($g(e)?e.content:e).insertBefore(t,o)}removeChild(e,t){t.remove()}selectRootElement(e,t){let o=typeof e=="string"?this.doc.querySelector(e):e;if(!o)throw new Re(-5104,!1);return t||(o.textContent=""),o}parentNode(e){return e.parentNode}nextSibling(e){return e.nextSibling}setAttribute(e,t,o,i){if(i){t=i+":"+t;let r=Xl[i];r?e.setAttributeNS(r,t,o):e.setAttribute(t,o)}else e.setAttribute(t,o)}removeAttribute(e,t,o){if(o){let i=Xl[o];i?e.removeAttributeNS(i,t):e.removeAttribute(`${o}:${t}`)}else e.removeAttribute(t)}addClass(e,t){e.classList.add(t)}removeClass(e,t){e.classList.remove(t)}setStyle(e,t,o,i){i&(Vo.DashCase|Vo.Important)?e.style.setProperty(t,o,i&Vo.Important?"important":""):e.style[t]=o}removeStyle(e,t,o){o&Vo.DashCase?e.style.removeProperty(t):e.style[t]=""}setProperty(e,t,o){e!=null&&(e[t]=o)}setValue(e,t){e.nodeValue=t}listen(e,t,o,i){if(typeof e=="string"&&(e=kn().getGlobalEventTarget(this.doc,e),!e))throw new Re(-5102,!1);let r=this.decoratePreventDefault(o);return this.tracingService?.wrapEventListener&&(r=this.tracingService.wrapEventListener(e,t,r)),this.eventManager.addEventListener(e,t,r,i)}decoratePreventDefault(e){return t=>{if(t==="__ngUnwrap__")return e;e(t)===!1&&t.preventDefault()}}};function $g(n){return n.tagName==="TEMPLATE"&&n.content!==void 0}var Is=class extends Xi{hostEl;sharedStylesHost;shadowRoot;constructor(e,t,o,i,r,s,a,d){super(e,i,r,a),this.hostEl=t,this.sharedStylesHost=d,this.shadowRoot=t.attachShadow({mode:"open"}),this.sharedStylesHost&&this.sharedStylesHost.addHost(this.shadowRoot);let l=o.styles;l=Hg(o.id,l);for(let g of l){let _=document.createElement("style");s&&_.setAttribute("nonce",s),_.textContent=g,this.shadowRoot.appendChild(_)}let h=o.getExternalStyles?.();if(h)for(let g of h){let _=Ql(g,i);s&&_.setAttribute("nonce",s),this.shadowRoot.appendChild(_)}}nodeOrShadowRoot(e){return e===this.hostEl?this.shadowRoot:e}appendChild(e,t){return super.appendChild(this.nodeOrShadowRoot(e),t)}insertBefore(e,t,o){return super.insertBefore(this.nodeOrShadowRoot(e),t,o)}removeChild(e,t){return super.removeChild(null,t)}parentNode(e){return this.nodeOrShadowRoot(super.parentNode(this.nodeOrShadowRoot(e)))}destroy(){this.sharedStylesHost&&this.sharedStylesHost.removeHost(this.shadowRoot)}},Qi=class extends Xi{sharedStylesHost;removeStylesOnCompDestroy;styles;styleUrls;constructor(e,t,o,i,r,s,a,d){super(e,r,s,a),this.sharedStylesHost=t,this.removeStylesOnCompDestroy=i;let l=o.styles;this.styles=d?Hg(d,l):l,this.styleUrls=o.getExternalStyles?.(d)}applyStyles(){this.sharedStylesHost.addStyles(this.styles,this.styleUrls)}destroy(){this.removeStylesOnCompDestroy&&fg.size===0&&this.sharedStylesHost.removeStyles(this.styles,this.styleUrls)}},ks=class extends Qi{contentAttr;hostAttr;constructor(e,t,o,i,r,s,a,d){let l=i+"-"+o.id;super(e,t,o,r,s,a,d,l),this.contentAttr=EC(l),this.hostAttr=IC(l)}applyToHost(e){this.applyStyles(),this.setAttribute(e,this.hostAttr,"")}createElement(e,t){let o=super.createElement(e,t);return super.setAttribute(o,this.contentAttr,""),o}};var Ts=class n extends Ki{supportsDOMEvents=!0;static makeCurrent(){jl(new n)}onAndCancel(e,t,o,i){return e.addEventListener(t,o,i),()=>{e.removeEventListener(t,o,i)}}dispatchEvent(e,t){e.dispatchEvent(t)}remove(e){e.remove()}createElement(e,t){return t=t||this.getDefaultDocument(),t.createElement(e)}createHtmlDocument(){return document.implementation.createHTMLDocument("fakeTitle")}getDefaultDocument(){return document}isElementNode(e){return e.nodeType===Node.ELEMENT_NODE}isShadowRoot(e){return e instanceof DocumentFragment}getGlobalEventTarget(e,t){return t==="window"?window:t==="document"?e:t==="body"?e.body:null}getBaseHref(e){let t=kC();return t==null?null:DC(t)}resetBaseElement(){er=null}getUserAgent(){return window.navigator.userAgent}getCookie(e){return Kl(document.cookie,e)}},er=null;function kC(){return er=er||document.head.querySelector("base"),er?er.getAttribute("href"):null}function DC(n){return new URL(n,document.baseURI).pathname}var Ug=["alt","control","meta","shift"],TC={"\b":"Backspace"," ":"Tab","\x7F":"Delete","\x1B":"Escape",Del:"Delete",Esc:"Escape",Left:"ArrowLeft",Right:"ArrowRight",Up:"ArrowUp",Down:"ArrowDown",Menu:"ContextMenu",Scroll:"ScrollLock",Win:"OS"},MC={alt:n=>n.altKey,control:n=>n.ctrlKey,meta:n=>n.metaKey,shift:n=>n.shiftKey},Vg=(()=>{class n extends Zi{constructor(t){super(t)}supports(t){return n.parseEventName(t)!=null}addEventListener(t,o,i,r){let s=n.parseEventName(o),a=n.eventCallback(s.fullKey,i,this.manager.getZone());return this.manager.getZone().runOutsideAngular(()=>kn().onAndCancel(t,s.domEventName,a,r))}static parseEventName(t){let o=t.toLowerCase().split("."),i=o.shift();if(o.length===0||!(i==="keydown"||i==="keyup"))return null;let r=n._normalizeKey(o.pop()),s="",a=o.indexOf("code");if(a>-1&&(o.splice(a,1),s="code."),Ug.forEach(l=>{let h=o.indexOf(l);h>-1&&(o.splice(h,1),s+=l+".")}),s+=r,o.length!=0||r.length===0)return null;let d={};return d.domEventName=i,d.fullKey=s,d}static matchEventFullKeyCode(t,o){let i=TC[t.key]||t.key,r="";return o.indexOf("code.")>-1&&(i=t.code,r="code."),i==null||!i?!1:(i=i.toLowerCase(),i===" "?i="space":i==="."&&(i="dot"),Ug.forEach(s=>{if(s!==i){let a=MC[s];a(t)&&(r+=s+".")}}),r+=i,r===o)}static eventCallback(t,o,i){return r=>{n.matchEventFullKeyCode(r,t)&&i.runGuarded(()=>o(r))}}static _normalizeKey(t){return t==="esc"?"escape":t}static \u0275fac=function(o){return new(o||n)(Ie(pt))};static \u0275prov=j({token:n,factory:n.\u0275fac})}return n})();function nc(n,e,t){return A(this,null,function*(){let o=p({rootComponent:n},RC(e,t));return kg(o)})}function RC(n,e){return{platformRef:e?.platformRef,appProviders:[...FC,...n?.providers??[]],platformProviders:LC}}function NC(){Ts.makeCurrent()}function OC(){return new Rl}function AC(){return hg(document),document}var LC=[{provide:Uo,useValue:Yl},{provide:cg,useValue:NC,multi:!0},{provide:pt,useFactory:AC}];var FC=[{provide:ag,useValue:"root"},{provide:Rl,useFactory:OC},{provide:Ds,useClass:Es,multi:!0},{provide:Ds,useClass:Vg,multi:!0},Ji,{provide:Gi,useClass:ec},{provide:ec,useExisting:Gi},Jl,{provide:ys,useExisting:Ji},[]];var jg=(()=>{class n{_doc;constructor(t){this._doc=t}getTitle(){return this._doc.title}setTitle(t){this._doc.title=t||""}static \u0275fac=function(o){return new(o||n)(Ie(pt))};static \u0275prov=j({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var $C="@",BC=(()=>{class n{doc;delegate;zone;animationType;moduleImpl;_rendererFactoryPromise=null;scheduler=null;injector=f(wt);loadingSchedulerFn=f(HC,{optional:!0});_engine;constructor(t,o,i,r,s){this.doc=t,this.delegate=o,this.zone=i,this.animationType=r,this.moduleImpl=s}ngOnDestroy(){this._engine?.flush()}loadImpl(){let t=()=>this.moduleImpl??import("./chunk-B3D35SQ5.js").then(i=>i),o;return this.loadingSchedulerFn?o=this.loadingSchedulerFn(t):o=t(),o.catch(i=>{throw new Re(5300,!1)}).then(({\u0275createEngine:i,\u0275AnimationRendererFactory:r})=>{this._engine=i(this.animationType,this.doc);let s=new r(this.delegate,this._engine,this.zone);return this.delegate=s,s})}createRenderer(t,o){let i=this.delegate.createRenderer(t,o);if(i.\u0275type===0)return i;typeof i.throwOnSyntheticProps=="boolean"&&(i.throwOnSyntheticProps=!1);let r=new oc(i);return o?.data?.animation&&!this._rendererFactoryPromise&&(this._rendererFactoryPromise=this.loadImpl()),this._rendererFactoryPromise?.then(s=>{let a=s.createRenderer(t,o);r.use(a),this.scheduler??=this.injector.get(pg,null,{optional:!0}),this.scheduler?.notify(10)}).catch(s=>{r.use(i)}),r}begin(){this.delegate.begin?.()}end(){this.delegate.end?.()}whenRenderingDone(){return this.delegate.whenRenderingDone?.()??Promise.resolve()}componentReplaced(t){this._engine?.flush(),this.delegate.componentReplaced?.(t)}static \u0275fac=function(o){Fl()};static \u0275prov=j({token:n,factory:n.\u0275fac})}return n})(),oc=class{delegate;replay=[];\u0275type=1;constructor(e){this.delegate=e}use(e){if(this.delegate=e,this.replay!==null){for(let t of this.replay)t(e);this.replay=null}}get data(){return this.delegate.data}destroy(){this.replay=null,this.delegate.destroy()}createElement(e,t){return this.delegate.createElement(e,t)}createComment(e){return this.delegate.createComment(e)}createText(e){return this.delegate.createText(e)}get destroyNode(){return this.delegate.destroyNode}appendChild(e,t){this.delegate.appendChild(e,t)}insertBefore(e,t,o,i){this.delegate.insertBefore(e,t,o,i)}removeChild(e,t,o,i){this.delegate.removeChild(e,t,o,i)}selectRootElement(e,t){return this.delegate.selectRootElement(e,t)}parentNode(e){return this.delegate.parentNode(e)}nextSibling(e){return this.delegate.nextSibling(e)}setAttribute(e,t,o,i){this.delegate.setAttribute(e,t,o,i)}removeAttribute(e,t,o){this.delegate.removeAttribute(e,t,o)}addClass(e,t){this.delegate.addClass(e,t)}removeClass(e,t){this.delegate.removeClass(e,t)}setStyle(e,t,o,i){this.delegate.setStyle(e,t,o,i)}removeStyle(e,t,o){this.delegate.removeStyle(e,t,o)}setProperty(e,t,o){this.shouldReplay(t)&&this.replay.push(i=>i.setProperty(e,t,o)),this.delegate.setProperty(e,t,o)}setValue(e,t){this.delegate.setValue(e,t)}listen(e,t,o,i){return this.shouldReplay(t)&&this.replay.push(r=>r.listen(e,t,o,i)),this.delegate.listen(e,t,o,i)}shouldReplay(e){return this.replay!==null&&e.startsWith($C)}},HC=new Be("");function Wg(n="animations"){return Al("NgAsyncAnimations"),gs([{provide:ys,useFactory:()=>new BC(f(pt),f(Ji),f(en),n)},{provide:ug,useValue:n==="noop"?"NoopAnimations":"BrowserAnimations"}])}var le="primary",fr=Symbol("RouteTitle"),dc=class{params;constructor(e){this.params=e||{}}has(e){return Object.prototype.hasOwnProperty.call(this.params,e)}get(e){if(this.has(e)){let t=this.params[e];return Array.isArray(t)?t[0]:t}return null}getAll(e){if(this.has(e)){let t=this.params[e];return Array.isArray(t)?t:[t]}return[]}get keys(){return Object.keys(this.params)}};function co(n){return new dc(n)}function ic(n,e,t){for(let o=0;o<n.length;o++){let i=n[o],r=e[o];if(i[0]===":")t[i.substring(1)]=r;else if(i!==r.path)return!1}return!0}function em(n,e,t){let o=t.path.split("/"),i=o.indexOf("**");if(i===-1){if(o.length>n.length||t.pathMatch==="full"&&(e.hasChildren()||o.length<n.length))return null;let d={},l=n.slice(0,o.length);return ic(o,l,d)?{consumed:l,posParams:d}:null}if(i!==o.lastIndexOf("**"))return null;let r=o.slice(0,i),s=o.slice(i+1);if(r.length+s.length>n.length||t.pathMatch==="full"&&e.hasChildren()&&t.path!=="**")return null;let a={};return!ic(r,n.slice(0,r.length),a)||!ic(s,n.slice(n.length-s.length),a)?null:{consumed:n,posParams:a}}function Ls(n){return new Promise((e,t)=>{n.pipe(Bn()).subscribe({next:o=>e(o),error:o=>t(o)})})}function UC(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;++t)if(!mn(n[t],e[t]))return!1;return!0}function mn(n,e){let t=n?lc(n):void 0,o=e?lc(e):void 0;if(!t||!o||t.length!=o.length)return!1;let i;for(let r=0;r<t.length;r++)if(i=t[r],!tm(n[i],e[i]))return!1;return!0}function lc(n){return[...Object.keys(n),...Object.getOwnPropertySymbols(n)]}function tm(n,e){if(Array.isArray(n)&&Array.isArray(e)){if(n.length!==e.length)return!1;let t=[...n].sort(),o=[...e].sort();return t.every((i,r)=>o[r]===i)}else return n===e}function VC(n){return n.length>0?n[n.length-1]:null}function ho(n){return El(n)?n:ws(n)?jt(Promise.resolve(n)):pe(n)}function nm(n){return El(n)?Ls(n):Promise.resolve(n)}var jC={exact:rm,subset:sm},om={exact:WC,subset:GC,ignored:()=>!0},im={paths:"exact",fragment:"ignored",matrixParams:"ignored",queryParams:"exact"},cc={paths:"subset",fragment:"ignored",matrixParams:"ignored",queryParams:"subset"};function Gg(n,e,t){return jC[t.paths](n.root,e.root,t.matrixParams)&&om[t.queryParams](n.queryParams,e.queryParams)&&!(t.fragment==="exact"&&n.fragment!==e.fragment)}function WC(n,e){return mn(n,e)}function rm(n,e,t){if(!lo(n.segments,e.segments)||!Ns(n.segments,e.segments,t)||n.numberOfChildren!==e.numberOfChildren)return!1;for(let o in e.children)if(!n.children[o]||!rm(n.children[o],e.children[o],t))return!1;return!0}function GC(n,e){return Object.keys(e).length<=Object.keys(n).length&&Object.keys(e).every(t=>tm(n[t],e[t]))}function sm(n,e,t){return am(n,e,e.segments,t)}function am(n,e,t,o){if(n.segments.length>t.length){let i=n.segments.slice(0,t.length);return!(!lo(i,t)||e.hasChildren()||!Ns(i,t,o))}else if(n.segments.length===t.length){if(!lo(n.segments,t)||!Ns(n.segments,t,o))return!1;for(let i in e.children)if(!n.children[i]||!sm(n.children[i],e.children[i],o))return!1;return!0}else{let i=t.slice(0,n.segments.length),r=t.slice(n.segments.length);return!lo(n.segments,i)||!Ns(n.segments,i,o)||!n.children[le]?!1:am(n.children[le],e,r,o)}}function Ns(n,e,t){return e.every((o,i)=>om[t](n[i].parameters,o.parameters))}var Kt=class{root;queryParams;fragment;_queryParamMap;constructor(e=new Se([],{}),t={},o=null){this.root=e,this.queryParams=t,this.fragment=o}get queryParamMap(){return this._queryParamMap??=co(this.queryParams),this._queryParamMap}toString(){return YC.serialize(this)}},Se=class{segments;children;parent=null;constructor(e,t){this.segments=e,this.children=t,Object.values(t).forEach(o=>o.parent=this)}hasChildren(){return this.numberOfChildren>0}get numberOfChildren(){return Object.keys(this.children).length}toString(){return Os(this)}},jn=class{path;parameters;_parameterMap;constructor(e,t){this.path=e,this.parameters=t}get parameterMap(){return this._parameterMap??=co(this.parameters),this._parameterMap}toString(){return lm(this)}};function qC(n,e){return lo(n,e)&&n.every((t,o)=>mn(t.parameters,e[o].parameters))}function lo(n,e){return n.length!==e.length?!1:n.every((t,o)=>t.path===e[o].path)}function KC(n,e){let t=[];return Object.entries(n.children).forEach(([o,i])=>{o===le&&(t=t.concat(e(i,o)))}),Object.entries(n.children).forEach(([o,i])=>{o!==le&&(t=t.concat(e(i,o)))}),t}var gr=(()=>{class n{static \u0275fac=function(o){return new(o||n)};static \u0275prov=Ot({token:n,factory:()=>new Wn})}return n})(),Wn=class{parse(e){let t=new pc(e);return new Kt(t.parseRootSegment(),t.parseQueryParams(),t.parseFragment())}serialize(e){let t=`/${tr(e.root,!0)}`,o=QC(e.queryParams),i=typeof e.fragment=="string"?`#${ZC(e.fragment)}`:"";return`${t}${o}${i}`}},YC=new Wn;function Os(n){return n.segments.map(e=>lm(e)).join("/")}function tr(n,e){if(!n.hasChildren())return Os(n);if(e){let t=n.children[le]?tr(n.children[le],!1):"",o=[];return Object.entries(n.children).forEach(([i,r])=>{i!==le&&o.push(`${i}:${tr(r,!1)}`)}),o.length>0?`${t}(${o.join("//")})`:t}else{let t=KC(n,(o,i)=>i===le?[tr(n.children[le],!1)]:[`${i}:${tr(o,!1)}`]);return Object.keys(n.children).length===1&&n.children[le]!=null?`${Os(n)}/${t[0]}`:`${Os(n)}/(${t.join("//")})`}}function dm(n){return encodeURIComponent(n).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",")}function Ms(n){return dm(n).replace(/%3B/gi,";")}function ZC(n){return encodeURI(n)}function uc(n){return dm(n).replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/%26/gi,"&")}function As(n){return decodeURIComponent(n)}function qg(n){return As(n.replace(/\+/g,"%20"))}function lm(n){return`${uc(n.path)}${XC(n.parameters)}`}function XC(n){return Object.entries(n).map(([e,t])=>`;${uc(e)}=${uc(t)}`).join("")}function QC(n){let e=Object.entries(n).map(([t,o])=>Array.isArray(o)?o.map(i=>`${Ms(t)}=${Ms(i)}`).join("&"):`${Ms(t)}=${Ms(o)}`).filter(t=>t);return e.length?`?${e.join("&")}`:""}var JC=/^[^\/()?;#]+/;function rc(n){let e=n.match(JC);return e?e[0]:""}var e_=/^[^\/()?;=#]+/;function t_(n){let e=n.match(e_);return e?e[0]:""}var n_=/^[^=?&#]+/;function o_(n){let e=n.match(n_);return e?e[0]:""}var i_=/^[^&#]+/;function r_(n){let e=n.match(i_);return e?e[0]:""}var pc=class{url;remaining;constructor(e){this.url=e,this.remaining=e}parseRootSegment(){for(;this.consumeOptional("/"););return this.remaining===""||this.peekStartsWith("?")||this.peekStartsWith("#")?new Se([],{}):new Se([],this.parseChildren())}parseQueryParams(){let e={};if(this.consumeOptional("?"))do this.parseQueryParam(e);while(this.consumeOptional("&"));return e}parseFragment(){return this.consumeOptional("#")?decodeURIComponent(this.remaining):null}parseChildren(e=0){if(e>50)throw new Re(4010,!1);if(this.remaining==="")return{};this.consumeOptional("/");let t=[];for(this.peekStartsWith("(")||t.push(this.parseSegment());this.peekStartsWith("/")&&!this.peekStartsWith("//")&&!this.peekStartsWith("/(");)this.capture("/"),t.push(this.parseSegment());let o={};this.peekStartsWith("/(")&&(this.capture("/"),o=this.parseParens(!0,e));let i={};return this.peekStartsWith("(")&&(i=this.parseParens(!1,e)),(t.length>0||Object.keys(o).length>0)&&(i[le]=new Se(t,o)),i}parseSegment(){let e=rc(this.remaining);if(e===""&&this.peekStartsWith(";"))throw new Re(4009,!1);return this.capture(e),new jn(As(e),this.parseMatrixParams())}parseMatrixParams(){let e={};for(;this.consumeOptional(";");)this.parseParam(e);return e}parseParam(e){let t=t_(this.remaining);if(!t)return;this.capture(t);let o="";if(this.consumeOptional("=")){let i=rc(this.remaining);i&&(o=i,this.capture(o))}e[As(t)]=As(o)}parseQueryParam(e){let t=o_(this.remaining);if(!t)return;this.capture(t);let o="";if(this.consumeOptional("=")){let s=r_(this.remaining);s&&(o=s,this.capture(o))}let i=qg(t),r=qg(o);if(Object.hasOwn(e,i)){let s=e[i];Array.isArray(s)||(s=[s],e[i]=s),s.push(r)}else e[i]=r}parseParens(e,t){let o=Object.create(null);for(this.capture("(");!this.consumeOptional(")")&&this.remaining.length>0;){let i=rc(this.remaining),r=this.remaining[i.length];if(r!=="/"&&r!==")"&&r!==";")throw new Re(4010,!1);let s;i.indexOf(":")>-1?(s=i.slice(0,i.indexOf(":")),this.capture(s),this.capture(":")):e&&(s=le);let a=this.parseChildren(t+1);o[s??le]=Object.keys(a).length===1&&a[le]?a[le]:new Se([],a),this.consumeOptional("//")}return o}peekStartsWith(e){return this.remaining.startsWith(e)}consumeOptional(e){return this.peekStartsWith(e)?(this.remaining=this.remaining.substring(e.length),!0):!1}capture(e){if(!this.consumeOptional(e))throw new Re(4011,!1)}};function cm(n){return n.segments.length>0?new Se([],{[le]:n}):n}function um(n){let e=Object.create(null);for(let[o,i]of Object.entries(n.children)){let r=um(i);if(o===le&&r.segments.length===0&&r.hasChildren())for(let[s,a]of Object.entries(r.children))e[s]=a;else(r.segments.length>0||r.hasChildren())&&(e[o]=r)}let t=new Se(n.segments,e);return s_(t)}function s_(n){if(n.numberOfChildren===1&&n.children[le]){let e=n.children[le];return new Se(n.segments.concat(e.segments),e.children)}return n}function Xo(n){return n instanceof Kt}function pm(n,e,t=null,o=null,i=new Wn){let r=hm(n);return fm(r,e,t,o,i)}function hm(n){let e;function t(r){let s={};for(let d of r.children){let l=t(d);s[d.outlet]=l}let a=new Se(r.url,s);return r===n&&(e=a),a}let o=t(n.root),i=cm(o);return e??i}function fm(n,e,t,o,i){let r=n;for(;r.parent;)r=r.parent;if(e.length===0)return sc(r,r,r,t,o,i);let s=a_(e);if(s.toRoot())return sc(r,r,new Se([],{}),t,o,i);let a=d_(s,r,n),d=a.processChildren?or(a.segmentGroup,a.index,s.commands):mm(a.segmentGroup,a.index,s.commands);return sc(r,a.segmentGroup,d,t,o,i)}function Fs(n){return typeof n=="object"&&n!=null&&!n.outlets&&!n.segmentPath}function sr(n){return typeof n=="object"&&n!=null&&n.outlets}function Kg(n,e,t){n||="\u0275";let o=new Kt;return o.queryParams={[n]:e},t.parse(t.serialize(o)).queryParams[n]}function sc(n,e,t,o,i,r){let s={};for(let[l,h]of Object.entries(o??{}))s[l]=Array.isArray(h)?h.map(g=>Kg(l,g,r)):Kg(l,h,r);let a;n===e?a=t:a=gm(n,e,t);let d=cm(um(a));return new Kt(d,s,i)}function gm(n,e,t){let o=Object.create(null);return Object.entries(n.children).forEach(([i,r])=>{r===e?o[i]=t:o[i]=gm(r,e,t)}),new Se(n.segments,o)}var zs=class{isAbsolute;numberOfDoubleDots;commands;constructor(e,t,o){if(this.isAbsolute=e,this.numberOfDoubleDots=t,this.commands=o,e&&o.length>0&&Fs(o[0]))throw new Re(4003,!1);let i=o.find(sr);if(i&&i!==VC(o))throw new Re(4004,!1)}toRoot(){return this.isAbsolute&&this.commands.length===1&&this.commands[0]=="/"}};function a_(n){if(typeof n[0]=="string"&&n.length===1&&n[0]==="/")return new zs(!0,0,n);let e=0,t=!1,o=n.reduce((i,r,s)=>{if(typeof r=="object"&&r!=null){if(r.outlets){let a={};return Object.entries(r.outlets).forEach(([d,l])=>{a[d]=typeof l=="string"?l.split("/"):l}),[...i,{outlets:a}]}if(r.segmentPath)return[...i,r.segmentPath]}return typeof r!="string"?[...i,r]:s===0?(r.split("/").forEach((a,d)=>{d==0&&a==="."||(d==0&&a===""?t=!0:a===".."?e++:a!=""&&i.push(a))}),i):[...i,r]},[]);return new zs(t,e,o)}var Yo=class{segmentGroup;processChildren;index;constructor(e,t,o){this.segmentGroup=e,this.processChildren=t,this.index=o}};function d_(n,e,t){if(n.isAbsolute)return new Yo(e,!0,0);if(!t)return new Yo(e,!1,NaN);if(t.parent===null)return new Yo(t,!0,0);let o=Fs(n.commands[0])?0:1,i=t.segments.length-1+o;return l_(t,i,n.numberOfDoubleDots)}function l_(n,e,t){let o=n,i=e,r=t;for(;r>i;){if(r-=i,o=o.parent,!o)throw new Re(4005,!1);i=o.segments.length}return new Yo(o,!1,i-r)}function c_(n){return sr(n[0])?n[0].outlets:{[le]:n}}function mm(n,e,t){if(n??=new Se([],{}),n.segments.length===0&&n.hasChildren())return or(n,e,t);let o=u_(n,e,t),i=t.slice(o.commandIndex);if(o.match&&o.pathIndex<n.segments.length){let r=new Se(n.segments.slice(0,o.pathIndex),{});return r.children[le]=new Se(n.segments.slice(o.pathIndex),n.children),or(r,0,i)}else return o.match&&i.length===0?new Se(n.segments,{}):o.match&&!n.hasChildren()?hc(n,e,t):o.match?or(n,0,i):hc(n,e,t)}function or(n,e,t){if(t.length===0)return new Se(n.segments,{});{let o=c_(t),i=Object.create(null);if(Object.keys(o).some(r=>r!==le)&&n.children[le]&&n.numberOfChildren===1&&n.children[le].segments.length===0){let r=or(n.children[le],e,t);return new Se(n.segments,r.children)}return Object.entries(o).forEach(([r,s])=>{typeof s=="string"&&(s=[s]),s!==null&&(i[r]=mm(n.children[r],e,s))}),Object.entries(n.children).forEach(([r,s])=>{o[r]===void 0&&(i[r]=s)}),new Se(n.segments,i)}}function u_(n,e,t){let o=0,i=e,r={match:!1,pathIndex:0,commandIndex:0};for(;i<n.segments.length;){if(o>=t.length)return r;let s=n.segments[i],a=t[o];if(sr(a))break;let d=`${a}`,l=o<t.length-1?t[o+1]:null;if(i>0&&d===void 0)break;if(d&&l&&typeof l=="object"&&l.outlets===void 0){if(!Zg(d,l,s))return r;o+=2}else{if(!Zg(d,{},s))return r;o++}i++}return{match:!0,pathIndex:i,commandIndex:o}}function hc(n,e,t){let o=n.segments.slice(0,e),i=0;for(;i<t.length;){let r=t[i];if(sr(r)){let d=p_(r.outlets);return new Se(o,d)}if(i===0&&Fs(t[0])){let d=n.segments[e];o.push(new jn(d.path,Yg(t[0]))),i++;continue}let s=sr(r)?r.outlets[le]:`${r}`,a=i<t.length-1?t[i+1]:null;s&&a&&Fs(a)?(o.push(new jn(s,Yg(a))),i+=2):(o.push(new jn(s,{})),i++)}return new Se(o,{})}function p_(n){let e={};return Object.entries(n).forEach(([t,o])=>{typeof o=="string"&&(o=[o]),o!==null&&(e[t]=hc(new Se([],{}),0,o))}),e}function Yg(n){let e={};return Object.entries(n).forEach(([t,o])=>e[t]=`${o}`),e}function Zg(n,e,t){return n==t.path&&mn(e,t.parameters)}var ir="imperative",at=(function(n){return n[n.NavigationStart=0]="NavigationStart",n[n.NavigationEnd=1]="NavigationEnd",n[n.NavigationCancel=2]="NavigationCancel",n[n.NavigationError=3]="NavigationError",n[n.RoutesRecognized=4]="RoutesRecognized",n[n.ResolveStart=5]="ResolveStart",n[n.ResolveEnd=6]="ResolveEnd",n[n.GuardsCheckStart=7]="GuardsCheckStart",n[n.GuardsCheckEnd=8]="GuardsCheckEnd",n[n.RouteConfigLoadStart=9]="RouteConfigLoadStart",n[n.RouteConfigLoadEnd=10]="RouteConfigLoadEnd",n[n.ChildActivationStart=11]="ChildActivationStart",n[n.ChildActivationEnd=12]="ChildActivationEnd",n[n.ActivationStart=13]="ActivationStart",n[n.ActivationEnd=14]="ActivationEnd",n[n.Scroll=15]="Scroll",n[n.NavigationSkipped=16]="NavigationSkipped",n})(at||{}),Ht=class{id;url;constructor(e,t){this.id=e,this.url=t}},uo=class extends Ht{type=at.NavigationStart;navigationTrigger;restoredState;constructor(e,t,o="imperative",i=null){super(e,t),this.navigationTrigger=o,this.restoredState=i}toString(){return`NavigationStart(id: ${this.id}, url: '${this.url}')`}},Tn=class extends Ht{urlAfterRedirects;type=at.NavigationEnd;constructor(e,t,o){super(e,t),this.urlAfterRedirects=o}toString(){return`NavigationEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}')`}},_t=(function(n){return n[n.Redirect=0]="Redirect",n[n.SupersededByNewNavigation=1]="SupersededByNewNavigation",n[n.NoDataFromResolver=2]="NoDataFromResolver",n[n.GuardRejected=3]="GuardRejected",n[n.Aborted=4]="Aborted",n})(_t||{}),ar=(function(n){return n[n.IgnoredSameUrlNavigation=0]="IgnoredSameUrlNavigation",n[n.IgnoredByUrlHandlingStrategy=1]="IgnoredByUrlHandlingStrategy",n})(ar||{}),qt=class extends Ht{reason;code;type=at.NavigationCancel;constructor(e,t,o,i){super(e,t),this.reason=o,this.code=i}toString(){return`NavigationCancel(id: ${this.id}, url: '${this.url}')`}};function ym(n){return n instanceof qt&&(n.code===_t.Redirect||n.code===_t.SupersededByNewNavigation)}var Mn=class extends Ht{reason;code;type=at.NavigationSkipped;constructor(e,t,o,i){super(e,t),this.reason=o,this.code=i}},po=class extends Ht{error;target;type=at.NavigationError;constructor(e,t,o,i){super(e,t),this.error=o,this.target=i}toString(){return`NavigationError(id: ${this.id}, url: '${this.url}', error: ${this.error})`}},dr=class extends Ht{urlAfterRedirects;state;type=at.RoutesRecognized;constructor(e,t,o,i){super(e,t),this.urlAfterRedirects=o,this.state=i}toString(){return`RoutesRecognized(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}},$s=class extends Ht{urlAfterRedirects;state;type=at.GuardsCheckStart;constructor(e,t,o,i){super(e,t),this.urlAfterRedirects=o,this.state=i}toString(){return`GuardsCheckStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}},Bs=class extends Ht{urlAfterRedirects;state;shouldActivate;type=at.GuardsCheckEnd;constructor(e,t,o,i,r){super(e,t),this.urlAfterRedirects=o,this.state=i,this.shouldActivate=r}toString(){return`GuardsCheckEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state}, shouldActivate: ${this.shouldActivate})`}},Hs=class extends Ht{urlAfterRedirects;state;type=at.ResolveStart;constructor(e,t,o,i){super(e,t),this.urlAfterRedirects=o,this.state=i}toString(){return`ResolveStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}},Us=class extends Ht{urlAfterRedirects;state;type=at.ResolveEnd;constructor(e,t,o,i){super(e,t),this.urlAfterRedirects=o,this.state=i}toString(){return`ResolveEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}},Vs=class{route;type=at.RouteConfigLoadStart;constructor(e){this.route=e}toString(){return`RouteConfigLoadStart(path: ${this.route.path})`}},js=class{route;type=at.RouteConfigLoadEnd;constructor(e){this.route=e}toString(){return`RouteConfigLoadEnd(path: ${this.route.path})`}},Ws=class{snapshot;type=at.ChildActivationStart;constructor(e){this.snapshot=e}toString(){return`ChildActivationStart(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}},Gs=class{snapshot;type=at.ChildActivationEnd;constructor(e){this.snapshot=e}toString(){return`ChildActivationEnd(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}},qs=class{snapshot;type=at.ActivationStart;constructor(e){this.snapshot=e}toString(){return`ActivationStart(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}},Ks=class{snapshot;type=at.ActivationEnd;constructor(e){this.snapshot=e}toString(){return`ActivationEnd(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}};var Qo=class{},lr=class{},Jo=class{url;navigationBehaviorOptions;constructor(e,t){this.url=e,this.navigationBehaviorOptions=t}};function h_(n){return!(n instanceof Qo)&&!(n instanceof Jo)&&!(n instanceof lr)}var Ys=class{rootInjector;outlet=null;route=null;children;attachRef=null;get injector(){return this.route?.snapshot._environmentInjector??this.rootInjector}constructor(e){this.rootInjector=e,this.children=new oi(this.rootInjector)}},oi=(()=>{class n{rootInjector;contexts=new Map;constructor(t){this.rootInjector=t}onChildOutletCreated(t,o){let i=this.getOrCreateContext(t);i.outlet=o,this.contexts.set(t,i)}onChildOutletDestroyed(t){let o=this.getContext(t);o&&(o.outlet=null,o.attachRef=null)}onOutletDeactivated(){let t=this.contexts;return this.contexts=new Map,t}onOutletReAttached(t){this.contexts=t}getOrCreateContext(t){let o=this.getContext(t);return o||(o=new Ys(this.rootInjector),this.contexts.set(t,o)),o}getContext(t){return this.contexts.get(t)||null}static \u0275fac=function(o){return new(o||n)(Ie(Sn))};static \u0275prov=j({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})(),Zs=class{_root;constructor(e){this._root=e}get root(){return this._root.value}parent(e){let t=this.pathFromRoot(e);return t.length>1?t[t.length-2]:null}children(e){let t=fc(e,this._root);return t?t.children.map(o=>o.value):[]}firstChild(e){let t=fc(e,this._root);return t&&t.children.length>0?t.children[0].value:null}siblings(e){let t=gc(e,this._root);return t.length<2?[]:t[t.length-2].children.map(i=>i.value).filter(i=>i!==e)}pathFromRoot(e){return gc(e,this._root).map(t=>t.value)}};function fc(n,e){if(n===e.value)return e;for(let t of e.children){let o=fc(n,t);if(o)return o}return null}function gc(n,e){if(n===e.value)return[e];for(let t of e.children){let o=gc(n,t);if(o.length)return o.unshift(e),o}return[]}var Bt=class{value;children;constructor(e,t){this.value=e,this.children=t}toString(){return`TreeNode(${this.value})`}};function Ko(n){let e={};return n&&n.children.forEach(t=>e[t.value.outlet]=t),e}var cr=class extends Zs{snapshot;constructor(e,t){super(e),this.snapshot=t,Sc(this,e)}toString(){return this.snapshot.toString()}};function vm(n,e){let t=f_(n,e),o=new vt([new jn("",{})]),i=new vt({}),r=new vt({}),s=new vt({}),a=new vt(""),d=new Gn(o,i,s,a,r,le,n,t.root);return d.snapshot=t.root,new cr(new Bt(d,[]),t)}function f_(n,e){let t={},o={},i={},s=new ei([],t,i,"",o,le,n,null,{},e);return new ur("",new Bt(s,[]))}var Gn=class{urlSubject;paramsSubject;queryParamsSubject;fragmentSubject;dataSubject;outlet;component;snapshot;_futureSnapshot;_routerState;_paramMap;_queryParamMap;title;url;params;queryParams;fragment;data;_localInjector;constructor(e,t,o,i,r,s,a,d){this.urlSubject=e,this.paramsSubject=t,this.queryParamsSubject=o,this.fragmentSubject=i,this.dataSubject=r,this.outlet=s,this.component=a,this._futureSnapshot=d,this.title=this.dataSubject?.pipe(I(l=>l[fr]))??pe(void 0),this.url=e,this.params=t,this.queryParams=o,this.fragment=i,this.data=r}get routeConfig(){return this._futureSnapshot.routeConfig}get root(){return this._routerState.root}get parent(){return this._routerState.parent(this)}get firstChild(){return this._routerState.firstChild(this)}get children(){return this._routerState.children(this)}get pathFromRoot(){return this._routerState.pathFromRoot(this)}get paramMap(){return this._paramMap??=this.params.pipe(I(e=>co(e))),this._paramMap}get queryParamMap(){return this._queryParamMap??=this.queryParams.pipe(I(e=>co(e))),this._queryParamMap}toString(){return this.snapshot?this.snapshot.toString():`Future(${this._futureSnapshot})`}},g_="always";function xc(n,e,t){let o,{routeConfig:i}=n;return e!==null&&(t==="always"||i?.path===""||!e.component&&!e.routeConfig?.loadComponent)?o={params:p(p({},e.params),n.params),data:p(p({},e.data),n.data),resolve:p(p(p(p({},n.data),e.data),i?.data),n._resolvedData)}:o={params:p({},n.params),data:p({},n.data),resolve:p(p({},n.data),n._resolvedData??{})},i&&bm(i)&&(o.resolve[fr]=i.title),o}var ei=class{url;params;queryParams;fragment;data;outlet;component;routeConfig;_resolve;_resolvedData;_routerState;_paramMap;_queryParamMap;_environmentInjector;get title(){return this.data?.[fr]}constructor(e,t,o,i,r,s,a,d,l,h){this.url=e,this.params=t,this.queryParams=o,this.fragment=i,this.data=r,this.outlet=s,this.component=a,this.routeConfig=d,this._resolve=l,this._environmentInjector=h}get root(){return this._routerState.root}get parent(){return this._routerState.parent(this)}get firstChild(){return this._routerState.firstChild(this)}get children(){return this._routerState.children(this)}get pathFromRoot(){return this._routerState.pathFromRoot(this)}get paramMap(){return this._paramMap??=co(this.params),this._paramMap}get queryParamMap(){return this._queryParamMap??=co(this.queryParams),this._queryParamMap}toString(){let e=this.url.map(o=>o.toString()).join("/"),t=this.routeConfig?this.routeConfig.path:"";return`Route(url:'${e}', path:'${t}')`}},ur=class extends Zs{url;constructor(e,t){super(t),this.url=e,Sc(this,t)}toString(){return wm(this._root)}};function Sc(n,e){e.value._routerState=n,e.children.forEach(t=>Sc(n,t))}function wm(n){let e=n.children.length>0?` { ${n.children.map(wm).join(", ")} } `:"";return`${n.value}${e}`}function ac(n){if(n.snapshot){let e=n.snapshot,t=n._futureSnapshot;n.snapshot=t,mn(e.queryParams,t.queryParams)||n.queryParamsSubject.next(t.queryParams),e.fragment!==t.fragment&&n.fragmentSubject.next(t.fragment),mn(e.params,t.params)||n.paramsSubject.next(t.params),UC(e.url,t.url)||n.urlSubject.next(t.url),mn(e.data,t.data)||n.dataSubject.next(t.data)}else n.snapshot=n._futureSnapshot,n.dataSubject.next(n._futureSnapshot.data)}function mc(n,e){let t=mn(n.params,e.params)&&qC(n.url,e.url),o=!n.parent!=!e.parent;return t&&!o&&(!n.parent||mc(n.parent,e.parent))}function bm(n){return typeof n.title=="string"||n.title===null}var Cm=new Be(""),mr=(()=>{class n{activated=null;get activatedComponentRef(){return this.activated}_activatedRoute=null;name=le;activateEvents=new ke;deactivateEvents=new ke;attachEvents=new ke;detachEvents=new ke;routerOutletData=T();parentContexts=f(oi);location=f(qi);changeDetector=f(_s);inputBinder=f(ea,{optional:!0});supportsBindingToComponentInputs=!0;ngOnChanges(t){if(t.name){let{firstChange:o,previousValue:i}=t.name;if(o)return;this.isTrackedInParentContexts(i)&&(this.deactivate(),this.parentContexts.onChildOutletDestroyed(i)),this.initializeOutletWithName()}}ngOnDestroy(){this.isTrackedInParentContexts(this.name)&&this.parentContexts.onChildOutletDestroyed(this.name),this.inputBinder?.unsubscribeFromRouteData(this)}isTrackedInParentContexts(t){return this.parentContexts.getContext(t)?.outlet===this}ngOnInit(){this.initializeOutletWithName()}initializeOutletWithName(){if(this.parentContexts.onChildOutletCreated(this.name,this),this.activated)return;let t=this.parentContexts.getContext(this.name);t?.route&&(t.attachRef?this.attach(t.attachRef,t.route):this.activateWith(t.route,t.injector))}get isActivated(){return!!this.activated}get component(){if(!this.activated)throw new Re(4012,!1);return this.activated.instance}get activatedRoute(){if(!this.activated)throw new Re(4012,!1);return this._activatedRoute}get activatedRouteData(){return this._activatedRoute?this._activatedRoute.snapshot.data:{}}detach(){if(!this.activated)throw new Re(4012,!1);this.location.detach();let t=this.activated;return this.activated=null,this._activatedRoute=null,this.detachEvents.emit(t.instance),t}attach(t,o){this.activated=t,this._activatedRoute=o,this.location.insert(t.hostView),this.inputBinder?.bindActivatedRouteToOutletComponent(this),this.attachEvents.emit(t.instance)}deactivate(){if(this.activated){let t=this.component;this.activated.destroy(),this.activated=null,this._activatedRoute=null,this.deactivateEvents.emit(t)}}activateWith(t,o){if(this.isActivated)throw new Re(4013,!1);this._activatedRoute=t;let i=this.location,s=t.snapshot.component,a=this.parentContexts.getOrCreateContext(this.name).children,d=new yc(t,a,i.injector,this.routerOutletData);this.activated=i.createComponent(s,{index:i.length,injector:d,environmentInjector:o}),this.changeDetector.markForCheck(),this.inputBinder?.bindActivatedRouteToOutletComponent(this),this.activateEvents.emit(this.activated.instance)}static \u0275fac=function(o){return new(o||n)};static \u0275dir=_e({type:n,selectors:[["router-outlet"]],inputs:{name:"name",routerOutletData:[1,"routerOutletData"]},outputs:{activateEvents:"activate",deactivateEvents:"deactivate",attachEvents:"attach",detachEvents:"detach"},exportAs:["outlet"],features:[Wi]})}return n})(),yc=class{route;childContexts;parent;outletData;constructor(e,t,o,i){this.route=e,this.childContexts=t,this.parent=o,this.outletData=i}get(e,t){return e===Gn?this.route:e===oi?this.childContexts:e===Cm?this.outletData:this.parent.get(e,t)}},ea=new Be("");var Pc=(()=>{class n{static \u0275fac=function(o){return new(o||n)};static \u0275cmp=B({type:n,selectors:[["ng-component"]],exportAs:["emptyRouterOutlet"],decls:1,vars:0,template:function(o,i){o&1&&F(0,"router-outlet")},dependencies:[mr],encapsulation:2,changeDetection:1})}return n})();function Ec(n){let e=n.children&&n.children.map(Ec),t=e?C(p({},n),{children:e}):p({},n);return!t.component&&!t.loadComponent&&(e||t.loadChildren)&&t.outlet&&t.outlet!==le&&(t.component=Pc),t}function m_(n,e,t){let o=new Set,i=pr(n,e._root,t?t._root:void 0,o);return{newlyCreatedRoutes:o,state:new cr(i,e)}}function pr(n,e,t,o){if(t&&n.shouldReuseRoute(e.value,t.value.snapshot)){let i=t.value;i._futureSnapshot=e.value;let r=y_(n,e,t,o);return new Bt(i,r)}else{if(n.shouldAttach(e.value)){let s=n.retrieve(e.value);if(s!==null){let a=s.route;return a.value._futureSnapshot=e.value,a.children=e.children.map(d=>pr(n,d,void 0,o)),a}}let i=v_(e.value);o.add(i);let r=e.children.map(s=>pr(n,s,void 0,o));return new Bt(i,r)}}function y_(n,e,t,o){return e.children.map(i=>{for(let r of t.children)if(n.shouldReuseRoute(i.value,r.value.snapshot))return pr(n,i,r,o);return pr(n,i,void 0,o)})}function v_(n){return new Gn(new vt(n.url),new vt(n.params),new vt(n.queryParams),new vt(n.fragment),new vt(n.data),n.outlet,n.component,n)}var ti=class{redirectTo;navigationBehaviorOptions;constructor(e,t){this.redirectTo=e,this.navigationBehaviorOptions=t}},_m="ngNavigationCancelingError";function Xs(n,e){let{redirectTo:t,navigationBehaviorOptions:o}=Xo(e)?{redirectTo:e,navigationBehaviorOptions:void 0}:e,i=xm(!1,_t.Redirect);return i.url=t,i.navigationBehaviorOptions=o,i}function xm(n,e){let t=new Error(`NavigationCancelingError: ${n||""}`);return t[_m]=!0,t.cancellationCode=e,t}function w_(n){return Sm(n)&&Xo(n.url)}function Sm(n){return!!n&&n[_m]}var vc=class{routeReuseStrategy;futureState;currState;forwardEvent;inputBindingEnabled;constructor(e,t,o,i,r){this.routeReuseStrategy=e,this.futureState=t,this.currState=o,this.forwardEvent=i,this.inputBindingEnabled=r}activate(e){let t=this.futureState._root,o=this.currState?this.currState._root:null;this.deactivateChildRoutes(t,o,e),ac(this.futureState.root),this.activateChildRoutes(t,o,e)}deactivateChildRoutes(e,t,o){let i=Ko(t);e.children.forEach(r=>{let s=r.value.outlet;this.deactivateRoutes(r,i[s],o),delete i[s]}),Object.values(i).forEach(r=>{this.deactivateRouteAndItsChildren(r,o)})}deactivateRoutes(e,t,o){let i=e.value,r=t?t.value:null;if(i===r)if(i.component){let s=o.getContext(i.outlet);s&&this.deactivateChildRoutes(e,t,s.children)}else this.deactivateChildRoutes(e,t,o);else r&&this.deactivateRouteAndItsChildren(t,o)}deactivateRouteAndItsChildren(e,t){e.value.component&&this.routeReuseStrategy.shouldDetach(e.value.snapshot)?this.detachAndStoreRouteSubtree(e,t):this.deactivateRouteAndOutlet(e,t)}detachAndStoreRouteSubtree(e,t){let o=t.getContext(e.value.outlet),i=o&&e.value.component?o.children:t,r=Ko(e);for(let s of Object.values(r))this.deactivateRouteAndItsChildren(s,i);if(o&&o.outlet){let s=o.outlet.detach(),a=o.children.onOutletDeactivated();this.routeReuseStrategy.store(e.value.snapshot,{componentRef:s,route:e,contexts:a})}}deactivateRouteAndOutlet(e,t){let o=t.getContext(e.value.outlet),i=o&&e.value.component?o.children:t,r=Ko(e);for(let s of Object.values(r))this.deactivateRouteAndItsChildren(s,i);o&&(o.outlet&&(o.outlet.deactivate(),o.children.onOutletDeactivated()),o.attachRef=null,o.route=null),e.value._localInjector?.destroy()}activateChildRoutes(e,t,o){let i=Ko(t);e.children.forEach(r=>{this.activateRoutes(r,i[r.value.outlet],o),this.forwardEvent(new Ks(r.value.snapshot))}),e.children.length&&this.forwardEvent(new Gs(e.value.snapshot))}activateRoutes(e,t,o){let i=e.value,r=t?t.value:null;if(ac(i),i===r)if(i.component){let s=o.getOrCreateContext(i.outlet);this.activateChildRoutes(e,t,s.children)}else this.activateChildRoutes(e,t,o);else if(i.component){let s=o.getOrCreateContext(i.outlet);if(this.routeReuseStrategy.shouldAttach(i.snapshot)){let a=this.routeReuseStrategy.retrieve(i.snapshot);this.routeReuseStrategy.store(i.snapshot,null),s.children.onOutletReAttached(a.contexts),s.attachRef=a.componentRef,s.route=a.route.value,s.outlet&&s.outlet.attach(a.componentRef,a.route.value),ac(a.route.value),this.activateChildRoutes(e,null,s.children)}else s.attachRef=null,s.route=i,s.outlet&&s.outlet.activateWith(i,s.injector),this.activateChildRoutes(e,null,s.children)}else this.activateChildRoutes(e,null,o)}},Qs=class{path;route;constructor(e){this.path=e,this.route=this.path[this.path.length-1]}},Zo=class{component;route;constructor(e,t){this.component=e,this.route=t}};function b_(n,e,t){let o=n._root,i=e?e._root:null;return nr(o,i,t,[o.value])}function C_(n){let e=n.routeConfig?n.routeConfig.canActivateChild:null;return!e||e.length===0?null:{node:n,guards:e}}function ii(n,e){let t=Symbol(),o=e.get(n,t);return o===t?typeof n=="function"&&!sg(n)?n:e.get(n):o}function nr(n,e,t,o,i={canDeactivateChecks:[],canActivateChecks:[]}){let r=Ko(e);return n.children.forEach(s=>{__(s,r[s.value.outlet],t,o.concat([s.value]),i),delete r[s.value.outlet]}),Object.entries(r).forEach(([s,a])=>rr(a,t.getContext(s),i)),i}function __(n,e,t,o,i={canDeactivateChecks:[],canActivateChecks:[]}){let r=n.value,s=e?e.value:null,a=t?t.getContext(n.value.outlet):null;if(s&&r.routeConfig===s.routeConfig){let d=x_(s,r,r.routeConfig.runGuardsAndResolvers);d?i.canActivateChecks.push(new Qs(o)):(r.data=s.data,r._resolvedData=s._resolvedData),r.component?nr(n,e,a?a.children:null,o,i):nr(n,e,t,o,i),d&&a&&a.outlet&&a.outlet.isActivated&&i.canDeactivateChecks.push(new Zo(a.outlet.component,s))}else s&&rr(e,a,i),i.canActivateChecks.push(new Qs(o)),r.component?nr(n,null,a?a.children:null,o,i):nr(n,null,t,o,i);return i}function x_(n,e,t){if(typeof t=="function")return It(e._environmentInjector,()=>t(n,e));switch(t){case"pathParamsChange":return!lo(n.url,e.url);case"pathParamsOrQueryParamsChange":return!lo(n.url,e.url)||!mn(n.queryParams,e.queryParams);case"always":return!0;case"paramsOrQueryParamsChange":return!mc(n,e)||!mn(n.queryParams,e.queryParams);default:return!mc(n,e)}}function rr(n,e,t){let o=Ko(n),i=n.value;Object.entries(o).forEach(([r,s])=>{i.component?e?rr(s,e.children.getContext(r),t):rr(s,null,t):rr(s,e,t)}),i.component?e&&e.outlet&&e.outlet.isActivated?t.canDeactivateChecks.push(new Zo(e.outlet.component,i)):t.canDeactivateChecks.push(new Zo(null,i)):t.canDeactivateChecks.push(new Zo(null,i))}function yr(n){return typeof n=="function"}function S_(n){return typeof n=="boolean"}function P_(n){return n&&yr(n.canLoad)}function E_(n){return n&&yr(n.canActivate)}function I_(n){return n&&yr(n.canActivateChild)}function k_(n){return n&&yr(n.canDeactivate)}function D_(n){return n&&yr(n.canMatch)}function Pm(n){return n instanceof tg||n?.name==="EmptyError"}var Rs=Symbol("INITIAL_VALUE");function ni(){return Me(n=>Te(n.map(e=>e.pipe(Wt(1),de(Rs)))).pipe(I(e=>{for(let t of e)if(t!==!0){if(t===Rs)return Rs;if(t===!1||T_(t))return t}return!0}),se(e=>e!==Rs),Wt(1)))}function T_(n){return Xo(n)||n instanceof ti}function Em(n){return n.aborted?pe(void 0).pipe(Wt(1)):new cs(e=>{let t=()=>{e.next(),e.complete()};return n.addEventListener("abort",t),()=>n.removeEventListener("abort",t)})}function Im(n){return Ho(Em(n))}function M_(n){return zn(e=>{let{targetSnapshot:t,currentSnapshot:o,guards:{canActivateChecks:i,canDeactivateChecks:r}}=e;return r.length===0&&i.length===0?pe(C(p({},e),{guardsResult:!0})):R_(r,t,o).pipe(zn(s=>s&&S_(s)?N_(t,i,n):pe(s)),I(s=>C(p({},e),{guardsResult:s})))})}function R_(n,e,t){return jt(n).pipe(zn(o=>z_(o.component,o.route,t,e)),Bn(o=>o!==!0,!0))}function N_(n,e,t){return jt(e).pipe(kl(o=>ps(A_(o.route.parent,t),O_(o.route,t),F_(n,o.path),L_(n,o.route))),Bn(o=>o!==!0,!0))}function O_(n,e){return n!==null&&e&&e(new qs(n)),pe(!0)}function A_(n,e){return n!==null&&e&&e(new Ws(n)),pe(!0)}function L_(n,e){let t=e.routeConfig?e.routeConfig.canActivate:null;if(!t||t.length===0)return pe(!0);let o=t.map(i=>hs(()=>{let r=e._environmentInjector,s=ii(i,r),a=E_(s)?s.canActivate(e,n):It(r,()=>s(e,n));return ho(a).pipe(Bn())}));return pe(o).pipe(ni())}function F_(n,e){let t=e[e.length-1],i=e.slice(0,e.length-1).reverse().map(r=>C_(r)).filter(r=>r!==null).map(r=>hs(()=>{let s=r.guards.map(a=>{let d=r.node._environmentInjector,l=ii(a,d),h=I_(l)?l.canActivateChild(t,n):It(d,()=>l(t,n));return ho(h).pipe(Bn())});return pe(s).pipe(ni())}));return pe(i).pipe(ni())}function z_(n,e,t,o){let i=e&&e.routeConfig?e.routeConfig.canDeactivate:null;if(!i||i.length===0)return pe(!0);let r=i.map(s=>{let a=e._environmentInjector,d=ii(s,a),l=k_(d)?d.canDeactivate(n,e,t,o):It(a,()=>d(n,e,t,o));return ho(l).pipe(Bn())});return pe(r).pipe(ni())}function $_(n,e,t,o,i){let r=e.canLoad;if(r===void 0||r.length===0)return pe(!0);let s=r.map(a=>{let d=ii(a,n),l=P_(d)?d.canLoad(e,t):It(n,()=>d(e,t)),h=ho(l);return i?h.pipe(Im(i)):h});return pe(s).pipe(ni(),km(o))}function km(n){return Qf(Jt(e=>{if(typeof e!="boolean")throw Xs(n,e)}),I(e=>e===!0))}function B_(n,e,t,o,i,r){let s=e.canMatch;if(!s||s.length===0)return pe(!0);let a=s.map(d=>{let l=ii(d,n),h=D_(l)?l.canMatch(e,t,i):It(n,()=>l(e,t,i));return ho(h).pipe(Im(r))});return pe(a).pipe(ni(),km(o))}var Dn=class n extends Error{segmentGroup;constructor(e){super(),this.segmentGroup=e||null,Object.setPrototypeOf(this,n.prototype)}},hr=class n extends Error{urlTree;constructor(e){super(),this.urlTree=e,Object.setPrototypeOf(this,n.prototype)}};function H_(n){throw new Re(4e3,!1)}function U_(n){throw xm(!1,_t.GuardRejected)}var wc=class{urlSerializer;urlTree;constructor(e,t){this.urlSerializer=e,this.urlTree=t}lineralizeSegments(e,t){return A(this,null,function*(){let o=[],i=t.root;for(;;){if(o=o.concat(i.segments),i.numberOfChildren===0)return o;if(i.numberOfChildren>1||!i.children[le])throw H_(`${e.redirectTo}`);i=i.children[le]}})}applyRedirectCommands(e,t,o,i,r){return A(this,null,function*(){let s=yield V_(t,i,r);if(s instanceof Kt)throw new hr(s);let a=this.applyRedirectCreateUrlTree(s,this.urlSerializer.parse(s),e,o);if(s[0]==="/")throw new hr(a);return a})}applyRedirectCreateUrlTree(e,t,o,i){let r=this.createSegmentGroup(e,t.root,o,i);return new Kt(r,this.createQueryParams(t.queryParams,this.urlTree.queryParams),t.fragment)}createQueryParams(e,t){let o={};return Object.entries(e).forEach(([i,r])=>{if(typeof r=="string"&&r[0]===":"){let a=r.substring(1);o[i]=t[a]}else o[i]=r}),o}createSegmentGroup(e,t,o,i){let r=this.createSegments(e,t.segments,o,i),s=Object.create(null);return Object.entries(t.children).forEach(([a,d])=>{s[a]=this.createSegmentGroup(e,d,o,i)}),new Se(r,s)}createSegments(e,t,o,i){return t.map(r=>r.path[0]===":"?this.findPosParam(e,r,i):this.findOrReturn(r,o))}findPosParam(e,t,o){let i=o[t.path.substring(1)];if(!i)throw new Re(4001,!1);return i}findOrReturn(e,t){let o=0;for(let i of t){if(i.path===e.path)return t.splice(o),i;o++}return e}};function V_(n,e,t){if(typeof n=="string")return Promise.resolve(n);let o=n;return Ls(ho(It(t,()=>o(e))))}function j_(n,e){return n.providers&&!n._injector&&(n._injector=zl(n.providers,e,`Route: ${n.path}`)),n._injector??e}function an(n){return n.outlet||le}function W_(n,e){let t=n.filter(o=>an(o)===e);return t.push(...n.filter(o=>an(o)!==e)),t}var bc={matched:!1,consumedSegments:[],remainingSegments:[],parameters:{},positionalParamSegments:{}};function Dm(n){return{routeConfig:n.routeConfig,url:n.url,params:n.params,queryParams:n.queryParams,fragment:n.fragment,data:n.data,outlet:n.outlet,title:n.title,paramMap:n.paramMap,queryParamMap:n.queryParamMap}}function G_(n,e,t,o,i,r,s){let a=Tm(n,e,t);if(!a.matched)return pe(a);let d=Dm(r(a));return o=j_(e,o),B_(o,e,t,i,d,s).pipe(I(l=>l===!0?a:p({},bc)))}function Tm(n,e,t){if(e.path==="")return e.pathMatch==="full"&&(n.hasChildren()||t.length>0)?p({},bc):{matched:!0,consumedSegments:[],remainingSegments:t,parameters:{},positionalParamSegments:{}};let i=(e.matcher||em)(t,n,e);if(!i)return p({},bc);let r={};Object.entries(i.posParams??{}).forEach(([a,d])=>{r[a]=d.path});let s=i.consumed.length>0?p(p({},r),i.consumed[i.consumed.length-1].parameters):r;return{matched:!0,consumedSegments:i.consumed,remainingSegments:t.slice(i.consumed.length),parameters:s,positionalParamSegments:i.posParams??{}}}function Xg(n,e,t,o,i){return t.length>0&&Y_(n,t,o,i)?{segmentGroup:new Se(e,K_(o,new Se(t,n.children))),slicedSegments:[]}:t.length===0&&Z_(n,t,o)?{segmentGroup:new Se(n.segments,q_(n,t,o,n.children)),slicedSegments:t}:{segmentGroup:new Se(n.segments,n.children),slicedSegments:t}}function q_(n,e,t,o){let i={};for(let r of t)if(ta(n,e,r)&&!o[an(r)]){let s=new Se([],{});i[an(r)]=s}return p(p({},o),i)}function K_(n,e){let t={};t[le]=e;for(let o of n)if(o.path===""&&an(o)!==le){let i=new Se([],{});t[an(o)]=i}return t}function Y_(n,e,t,o){return t.some(i=>!ta(n,e,i)||!(an(i)!==le)?!1:!(o!==void 0&&an(i)===o))}function Z_(n,e,t){return t.some(o=>ta(n,e,o))}function ta(n,e,t){return(n.hasChildren()||e.length>0)&&t.pathMatch==="full"?!1:t.path===""}function X_(n,e,t){return e.length===0&&!n.children[t]}var Cc=class{};function Q_(n,e,t,o,i,r,s,a){return A(this,null,function*(){return new _c(n,e,t,o,i,s,r,a).recognize()})}var J_=31,_c=class{injector;configLoader;rootComponentType;config;urlTree;paramsInheritanceStrategy;urlSerializer;abortSignal;applyRedirects;absoluteRedirectCount=0;allowRedirects=!0;constructor(e,t,o,i,r,s,a,d){this.injector=e,this.configLoader=t,this.rootComponentType=o,this.config=i,this.urlTree=r,this.paramsInheritanceStrategy=s,this.urlSerializer=a,this.abortSignal=d,this.applyRedirects=new wc(this.urlSerializer,this.urlTree)}noMatchError(e){return new Re(4002,`'${e.segmentGroup}'`)}recognize(){return A(this,null,function*(){let e=Xg(this.urlTree.root,[],[],this.config).segmentGroup,{children:t,rootSnapshot:o}=yield this.match(e),i=new Bt(o,t),r=new ur("",i),s=pm(o,[],this.urlTree.queryParams,this.urlTree.fragment);return s.queryParams=this.urlTree.queryParams,r.url=this.urlSerializer.serialize(s),{state:r,tree:s}})}match(e){return A(this,null,function*(){let t=new ei([],Object.freeze({}),Object.freeze(p({},this.urlTree.queryParams)),this.urlTree.fragment,Object.freeze({}),le,this.rootComponentType,null,{},this.injector);try{return{children:yield this.processSegmentGroup(this.injector,this.config,e,le,t),rootSnapshot:t}}catch(o){if(o instanceof hr)return this.urlTree=o.urlTree,this.match(o.urlTree.root);throw o instanceof Dn?this.noMatchError(o):o}})}processSegmentGroup(e,t,o,i,r){return A(this,null,function*(){if(o.segments.length===0&&o.hasChildren())return this.processChildren(e,t,o,r);let s=yield this.processSegment(e,t,o,o.segments,i,!0,r);return s instanceof Bt?[s]:[]})}processChildren(e,t,o,i){return A(this,null,function*(){let r=[];for(let d of Object.keys(o.children))d==="primary"?r.unshift(d):r.push(d);let s=[];for(let d of r){let l=o.children[d],h=W_(t,d),g=yield this.processSegmentGroup(e,h,l,d,i);s.push(...g)}let a=Mm(s);return ex(a),a})}processSegment(e,t,o,i,r,s,a){return A(this,null,function*(){for(let d of t)try{return yield this.processSegmentAgainstRoute(d._injector??e,t,d,o,i,r,s,a)}catch(l){if(l instanceof Dn||Pm(l))continue;throw l}if(X_(o,i,r))return new Cc;throw new Dn(o)})}processSegmentAgainstRoute(e,t,o,i,r,s,a,d){return A(this,null,function*(){if(an(o)!==s&&(s===le||!ta(i,r,o)))throw new Dn(i);if(o.redirectTo===void 0)return this.matchSegmentAgainstRoute(e,i,o,r,s,d);if(this.allowRedirects&&a)return this.expandSegmentAgainstRouteUsingRedirect(e,i,t,o,r,s,d);throw new Dn(i)})}expandSegmentAgainstRouteUsingRedirect(e,t,o,i,r,s,a){return A(this,null,function*(){let{matched:d,parameters:l,consumedSegments:h,positionalParamSegments:g,remainingSegments:_}=Tm(t,i,r);if(!d)throw new Dn(t);typeof i.redirectTo=="string"&&i.redirectTo[0]==="/"&&(this.absoluteRedirectCount++,this.absoluteRedirectCount>J_&&(this.allowRedirects=!1));let D=this.createSnapshot(e,i,r,l,a);if(this.abortSignal.aborted)throw new Error(this.abortSignal.reason);let L=yield this.applyRedirects.applyRedirectCommands(h,i.redirectTo,g,Dm(D),e),q=yield this.applyRedirects.lineralizeSegments(i,L);return this.processSegment(e,o,t,q.concat(_),s,!1,a)})}createSnapshot(e,t,o,i,r){let s=new ei(o,i,Object.freeze(p({},this.urlTree.queryParams)),this.urlTree.fragment,nx(t),an(t),t.component??t._loadedComponent??null,t,ox(t),e),a=xc(s,r,this.paramsInheritanceStrategy);return s.params=Object.freeze(a.params),s.data=Object.freeze(a.data),s}matchSegmentAgainstRoute(e,t,o,i,r,s){return A(this,null,function*(){if(this.abortSignal.aborted)throw new Error(this.abortSignal.reason);let a=Ae=>this.createSnapshot(e,o,Ae.consumedSegments,Ae.parameters,s),d=yield Ls(G_(t,o,i,e,this.urlSerializer,a,this.abortSignal));if(o.path==="**"&&(t.children={}),!d?.matched)throw new Dn(t);e=o._injector??e;let{routes:l}=yield this.getChildConfig(e,o,i),h=o._loadedInjector??e,{parameters:g,consumedSegments:_,remainingSegments:D}=d,L=this.createSnapshot(e,o,_,g,s),{segmentGroup:q,slicedSegments:Y}=Xg(t,_,D,l,r);if(Y.length===0&&q.hasChildren()){let Ae=yield this.processChildren(h,l,q,L);return new Bt(L,Ae)}if(l.length===0&&Y.length===0)return new Bt(L,[]);let J=an(o)===r,fe=yield this.processSegment(h,l,q,Y,J?le:r,!0,L);return new Bt(L,fe instanceof Bt?[fe]:[])})}getChildConfig(e,t,o){return A(this,null,function*(){if(t.children)return{routes:t.children,injector:e};if(t.loadChildren){if(t._loadedRoutes!==void 0){let r=t._loadedNgModuleFactory;return r&&!t._loadedInjector&&(t._loadedInjector=r.create(e).injector),{routes:t._loadedRoutes,injector:t._loadedInjector}}if(this.abortSignal.aborted)throw new Error(this.abortSignal.reason);if(yield Ls($_(e,t,o,this.urlSerializer,this.abortSignal))){let r=yield this.configLoader.loadChildren(e,t);return t._loadedRoutes=r.routes,t._loadedInjector=r.injector,t._loadedNgModuleFactory=r.factory,r}throw U_(t)}return{routes:[],injector:e}})}};function ex(n){n.sort((e,t)=>e.value.outlet===le?-1:t.value.outlet===le?1:e.value.outlet.localeCompare(t.value.outlet))}function tx(n){let e=n.value.routeConfig;return e&&e.path===""}function Mm(n){let e=[],t=new Set;for(let o of n){if(!tx(o)){e.push(o);continue}let i=e.find(r=>o.value.routeConfig===r.value.routeConfig);i!==void 0?(i.children.push(...o.children),t.add(i)):e.push(o)}for(let o of t){let i=Mm(o.children);e.push(new Bt(o.value,i))}return e.filter(o=>!t.has(o))}function nx(n){return n.data||{}}function ox(n){return n.resolve||{}}function ix(n,e,t,o,i,r,s){return zn(a=>A(null,null,function*(){let{state:d,tree:l}=yield Q_(n,e,t,o,a.extractedUrl,i,r,s);return C(p({},a),{targetSnapshot:d,urlAfterRedirects:l})}))}function rx(n){return zn(e=>{let{targetSnapshot:t,guards:{canActivateChecks:o}}=e;if(!o.length)return pe(e);let i=new Set(o.map(a=>a.route)),r=new Set;for(let a of i)if(!r.has(a))for(let d of Rm(a))r.add(d);let s=0;return jt(r).pipe(kl(a=>i.has(a)?sx(a,t,n):(a.data=xc(a,a.parent,n).resolve,pe(void 0))),Jt(()=>s++),Dl(1),zn(a=>s===r.size?pe(e):Ne))})}function Rm(n){let e=n.children.map(t=>Rm(t)).flat();return[n,...e]}function sx(n,e,t){let o=n.routeConfig,i=n._resolve;return o?.title!==void 0&&!bm(o)&&(i[fr]=o.title),hs(()=>(n.data=xc(n,n.parent,t).resolve,ax(i,n,e).pipe(I(r=>(n._resolvedData=r,n.data=p(p({},n.data),r),null)))))}function ax(n,e,t){let o=lc(n);if(o.length===0)return pe({});let i={};return jt(o).pipe(zn(r=>dx(n[r],e,t).pipe(Bn(),Jt(s=>{if(s instanceof ti)throw Xs(new Wn,s);i[r]=s}))),Dl(1),I(()=>i),Il(r=>Pm(r)?Ne:eg(r)))}function dx(n,e,t){let o=e._environmentInjector,i=ii(n,o),r=i.resolve?i.resolve(e,t):It(o,()=>i(e,t));return ho(r)}function Qg(n){return Me(e=>{let t=n(e);return t?jt(t).pipe(I(()=>e)):pe(e)})}var Ic=(()=>{class n{buildTitle(t){let o,i=t.root;for(;i!==void 0;)o=this.getResolvedTitleForRoute(i)??o,i=i.children.find(r=>r.outlet===le);return o}getResolvedTitleForRoute(t){return t.data[fr]}static \u0275fac=function(o){return new(o||n)};static \u0275prov=Ot({token:n,factory:()=>f(Nm)})}return n})(),Nm=(()=>{class n extends Ic{title;constructor(t){super(),this.title=t}updateTitle(t){let o=this.buildTitle(t);o!==void 0&&this.title.setTitle(o)}static \u0275fac=function(o){return new(o||n)(Ie(jg))};static \u0275prov=j({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})(),vr=new Be("",{factory:()=>({})}),wr=new Be(""),Om=(()=>{class n{componentLoaders=new WeakMap;childrenLoaders=new WeakMap;onLoadStartListener;onLoadEndListener;compiler=f(Pg);loadComponent(t,o){return A(this,null,function*(){if(this.componentLoaders.get(o))return this.componentLoaders.get(o);if(o._loadedComponent)return Promise.resolve(o._loadedComponent);this.onLoadStartListener&&this.onLoadStartListener(o);let i=A(this,null,function*(){try{let r=yield nm(It(t,()=>o.loadComponent())),s=yield Lm(Vl(r));return this.onLoadEndListener&&this.onLoadEndListener(o),o._loadedComponent=s,s}finally{this.componentLoaders.delete(o)}});return this.componentLoaders.set(o,i),i})}loadChildren(t,o){if(this.childrenLoaders.get(o))return this.childrenLoaders.get(o);if(o._loadedRoutes)return Promise.resolve({routes:o._loadedRoutes,injector:o._loadedInjector});this.onLoadStartListener&&this.onLoadStartListener(o);let i=A(this,null,function*(){try{let r=yield Am(o,this.compiler,t,this.onLoadEndListener);return o._loadedRoutes=r.routes,o._loadedInjector=r.injector,o._loadedNgModuleFactory=r.factory,r}finally{this.childrenLoaders.delete(o)}});return this.childrenLoaders.set(o,i),i}static \u0275fac=function(o){return new(o||n)};static \u0275prov=Ot({token:n,factory:n.\u0275fac})}return n})();function Am(n,e,t,o){return A(this,null,function*(){let i=yield nm(It(t,()=>n.loadChildren())),r=yield Lm(Vl(i)),s;r instanceof vg||Array.isArray(r)?s=r:s=yield e.compileModuleAsync(r),o&&o(n);let a,d,l=!1,h;return Array.isArray(s)?(d=s,l=!0):(a=s.create(t).injector,h=s,d=a.get(wr,[],{optional:!0,self:!0}).flat()),{routes:d.map(Ec),injector:a,factory:h}})}function Lm(n){return A(this,null,function*(){return n})}var na=(()=>{class n{static \u0275fac=function(o){return new(o||n)};static \u0275prov=Ot({token:n,factory:()=>f(lx)})}return n})(),lx=(()=>{class n{shouldProcessUrl(t){return!0}extract(t){return t}merge(t,o){return t}static \u0275fac=function(o){return new(o||n)};static \u0275prov=Ot({token:n,factory:n.\u0275fac})}return n})(),Fm=new Be("");var zm=new Be(""),cx=()=>{},$m=new Be(""),Bm=(()=>{class n{currentNavigation=U(null,{equal:()=>!1});currentTransition=null;lastSuccessfulNavigation=U(null);events=new ot;transitionAbortWithErrorSubject=new ot;configLoader=f(Om);environmentInjector=f(Sn);destroyRef=f(je);urlSerializer=f(gr);rootContexts=f(oi);location=f(qo);inputBindingEnabled=f(ea,{optional:!0})!==null;titleStrategy=f(Ic);options=f(vr,{optional:!0})||{};paramsInheritanceStrategy=this.options.paramsInheritanceStrategy||g_;urlHandlingStrategy=f(na);createViewTransition=f(Fm,{optional:!0});navigationErrorHandler=f($m,{optional:!0});activatedRouteInjectorFeature=f(zm,{optional:!0});navigationId=0;get hasRequestedNavigation(){return this.navigationId!==0}transitions;afterPreactivation=()=>pe(void 0);rootComponentType=null;destroyed=!1;constructor(){let t=i=>this.events.next(new Vs(i)),o=i=>this.events.next(new js(i));this.configLoader.onLoadEndListener=o,this.configLoader.onLoadStartListener=t,this.destroyRef.onDestroy(()=>{this.destroyed=!0})}complete(){this.transitions?.complete()}handleNavigationRequest(t){let o=++this.navigationId;ye(()=>{this.transitions?.next(C(p({},t),{extractedUrl:this.urlHandlingStrategy.extract(t.rawUrl),targetSnapshot:null,targetRouterState:null,guards:{canActivateChecks:[],canDeactivateChecks:[]},guardsResult:null,id:o,routesRecognizeHandler:{},beforeActivateHandler:{}}))})}setupNavigations(t){return this.transitions=new vt(null),this.transitions.pipe(se(o=>o!==null),Me(o=>{let i=!0,r=!1,s=new AbortController,a=()=>!r&&this.currentTransition?.id===o.id;return pe(o).pipe(Me(d=>{if(this.navigationId>o.id)return this.cancelNavigationTransition(o,"",_t.SupersededByNewNavigation),Ne;this.currentTransition=o;let l=this.lastSuccessfulNavigation();this.currentNavigation.set({id:d.id,initialUrl:d.rawUrl,extractedUrl:d.extractedUrl,targetBrowserUrl:typeof d.extras.browserUrl=="string"?this.urlSerializer.parse(d.extras.browserUrl):d.extras.browserUrl,trigger:d.source,extras:d.extras,previousNavigation:l?C(p({},l),{previousNavigation:null}):null,abort:()=>s.abort(),routesRecognizeHandler:d.routesRecognizeHandler,beforeActivateHandler:d.beforeActivateHandler});let h=!t.navigated||this.isUpdatingInternalState()||this.isUpdatedBrowserUrl(),g=d.extras.onSameUrlNavigation??t.onSameUrlNavigation;if(!h&&g!=="reload")return this.events.next(new Mn(d.id,this.urlSerializer.serialize(d.rawUrl),"",ar.IgnoredSameUrlNavigation)),d.resolve(!1),Ne;if(this.urlHandlingStrategy.shouldProcessUrl(d.rawUrl))return pe(d).pipe(Me(_=>(this.events.next(new uo(_.id,this.urlSerializer.serialize(_.extractedUrl),_.source,_.restoredState)),_.id!==this.navigationId?Ne:Promise.resolve(_))),ix(this.environmentInjector,this.configLoader,this.rootComponentType,t.config,this.urlSerializer,this.paramsInheritanceStrategy,s.signal),Jt(_=>{o.targetSnapshot=_.targetSnapshot,o.urlAfterRedirects=_.urlAfterRedirects,this.currentNavigation.update(D=>(D.finalUrl=_.urlAfterRedirects,D)),this.events.next(new lr)}),Me(_=>jt(o.routesRecognizeHandler.deferredHandle??pe(void 0)).pipe(I(()=>_))),Jt(()=>{let _=new dr(d.id,this.urlSerializer.serialize(d.extractedUrl),this.urlSerializer.serialize(d.urlAfterRedirects),d.targetSnapshot);this.events.next(_)}));if(h&&this.urlHandlingStrategy.shouldProcessUrl(d.currentRawUrl)){let{id:_,extractedUrl:D,source:L,restoredState:q,extras:Y}=d,J=new uo(_,this.urlSerializer.serialize(D),L,q);this.events.next(J);let fe=vm(this.rootComponentType,this.environmentInjector).snapshot;return this.currentTransition=o=C(p({},d),{targetSnapshot:fe,urlAfterRedirects:D,extras:C(p({},Y),{skipLocationChange:!1,replaceUrl:!1})}),this.currentNavigation.update(Ae=>(Ae.finalUrl=D,Ae)),pe(o)}else return this.events.next(new Mn(d.id,this.urlSerializer.serialize(d.extractedUrl),"",ar.IgnoredByUrlHandlingStrategy)),d.resolve(!1),Ne}),I(d=>{let l=new $s(d.id,this.urlSerializer.serialize(d.extractedUrl),this.urlSerializer.serialize(d.urlAfterRedirects),d.targetSnapshot);return this.events.next(l),this.currentTransition=o=C(p({},d),{guards:b_(d.targetSnapshot,d.currentSnapshot,this.rootContexts)}),o}),M_(d=>this.events.next(d)),Me(d=>{if(o.guardsResult=d.guardsResult,d.guardsResult&&typeof d.guardsResult!="boolean")throw Xs(this.urlSerializer,d.guardsResult);let l=new Bs(d.id,this.urlSerializer.serialize(d.extractedUrl),this.urlSerializer.serialize(d.urlAfterRedirects),d.targetSnapshot,!!d.guardsResult);if(this.events.next(l),!a())return Ne;if(!d.guardsResult)return this.cancelNavigationTransition(d,"",_t.GuardRejected),Ne;if(d.guards.canActivateChecks.length===0)return pe(d);let h=new Hs(d.id,this.urlSerializer.serialize(d.extractedUrl),this.urlSerializer.serialize(d.urlAfterRedirects),d.targetSnapshot);if(this.events.next(h),!a())return Ne;let g=!1;return pe(d).pipe(rx(this.paramsInheritanceStrategy),Jt({next:()=>{g=!0;let _=new Us(d.id,this.urlSerializer.serialize(d.extractedUrl),this.urlSerializer.serialize(d.urlAfterRedirects),d.targetSnapshot);this.events.next(_)},complete:()=>{g||this.cancelNavigationTransition(d,"",_t.NoDataFromResolver)}}))}),Qg(d=>{let l=g=>{let _=[];if(g.routeConfig?._loadedComponent)g.component=g.routeConfig?._loadedComponent;else if(g.routeConfig?.loadComponent){let D=g._environmentInjector;_.push(this.configLoader.loadComponent(D,g.routeConfig).then(L=>{g.component=L}))}for(let D of g.children)_.push(...l(D));return _},h=l(d.targetSnapshot.root);return h.length===0?pe(d):jt(Promise.all(h).then(()=>d))}),Me(d=>{let{newlyCreatedRoutes:l,state:h}=m_(t.routeReuseStrategy,d.targetSnapshot,d.currentRouterState);return this.currentTransition=o=d=C(p({},d),{targetRouterState:h,newlyCreatedRoutes:l}),this.currentNavigation.update(g=>(g.targetRouterState=h,g)),pe(d)}),this.activatedRouteInjectorFeature?.operator()??(d=>d),Qg(()=>this.afterPreactivation()),Me(()=>{let{currentSnapshot:d,targetSnapshot:l}=o,h=this.createViewTransition?.(this.environmentInjector,d.root,l.root);return h?jt(h).pipe(I(()=>o)):pe(o)}),Wt(1),Me(d=>{i=!1,this.events.next(new Qo);let l=o.beforeActivateHandler.deferredHandle;return l?jt(l.then(()=>d)):pe(d)}),Jt(d=>{new vc(t.routeReuseStrategy,o.targetRouterState,o.currentRouterState,l=>this.events.next(l),this.inputBindingEnabled).activate(this.rootContexts),d.newlyCreatedRoutes?.clear(),a()&&(r=!0,this.currentNavigation.update(l=>(l.abort=cx,l)),this.lastSuccessfulNavigation.set(ye(this.currentNavigation)),this.events.next(new Tn(d.id,this.urlSerializer.serialize(d.extractedUrl),this.urlSerializer.serialize(d.urlAfterRedirects))),this.titleStrategy?.updateTitle(d.targetRouterState.snapshot),d.resolve(!0))}),Ho(Em(s.signal).pipe(se(()=>!r&&i),Jt(()=>{this.cancelNavigationTransition(o,s.signal.reason+"",_t.Aborted)}))),Jt({complete:()=>{r=!0}}),Ho(this.transitionAbortWithErrorSubject.pipe(Jt(d=>{throw d}))),rg(()=>{s.abort(),r||this.cancelNavigationTransition(o,"",_t.SupersededByNewNavigation),this.currentTransition?.id===o.id&&(this.currentNavigation.set(null),this.currentTransition=null)}),Il(d=>{if(r=!0,Jg(o),this.destroyed)return o.resolve(!1),Ne;if(Sm(d))this.events.next(new qt(o.id,this.urlSerializer.serialize(o.extractedUrl),d.message,d.cancellationCode)),w_(d)?this.events.next(new Jo(d.url,d.navigationBehaviorOptions)):o.resolve(!1);else{let l=new po(o.id,this.urlSerializer.serialize(o.extractedUrl),d,o.targetSnapshot??void 0);try{let h=It(this.environmentInjector,()=>this.navigationErrorHandler?.(l));if(h instanceof ti){let{message:g,cancellationCode:_}=Xs(this.urlSerializer,h);this.events.next(new qt(o.id,this.urlSerializer.serialize(o.extractedUrl),g,_)),this.events.next(new Jo(h.redirectTo,h.navigationBehaviorOptions))}else throw this.events.next(l),d}catch(h){this.options.resolveNavigationPromiseOnError?o.resolve(!1):o.reject(h)}}return Ne}))}))}cancelNavigationTransition(t,o,i){Jg(t);let r=new qt(t.id,this.urlSerializer.serialize(t.extractedUrl),o,i);this.events.next(r),t.resolve(!1)}isUpdatingInternalState(){return this.currentTransition?.extractedUrl.toString()!==this.currentTransition?.currentUrlTree.toString()}isUpdatedBrowserUrl(){let t=this.urlHandlingStrategy.extract(this.urlSerializer.parse(this.location.path(!0))),o=ye(this.currentNavigation),i=o?.targetBrowserUrl??o?.extractedUrl;return t.toString()!==i?.toString()&&!o?.extras.skipLocationChange}static \u0275fac=function(o){return new(o||n)};static \u0275prov=Ot({token:n,factory:n.\u0275fac})}return n})();function ux(n){return n!==ir}function Jg(n){if(n.newlyCreatedRoutes)for(let e of n.newlyCreatedRoutes)e._localInjector?.destroy()}var Hm=new Be("");var Um=(()=>{class n{static \u0275fac=function(o){return new(o||n)};static \u0275prov=Ot({token:n,factory:()=>f(px)})}return n})(),Js=class{shouldDetach(e){return!1}store(e,t){}shouldAttach(e){return!1}retrieve(e){return null}shouldReuseRoute(e,t){return e.routeConfig===t.routeConfig}shouldDestroyInjector(e){return!0}},px=(()=>{class n extends Js{static \u0275fac=function(o){return new(o||n)};static \u0275prov=Ot({token:n,factory:n.\u0275fac})}return n})(),kc=(()=>{class n{urlSerializer=f(gr);options=f(vr,{optional:!0})||{};canceledNavigationResolution=this.options.canceledNavigationResolution||"replace";location=f(qo);urlHandlingStrategy=f(na);urlUpdateStrategy=this.options.urlUpdateStrategy||"deferred";currentUrlTree=new Kt;getCurrentUrlTree(){return this.currentUrlTree}rawUrlTree=this.currentUrlTree;getRawUrlTree(){return this.rawUrlTree}createBrowserPath({finalUrl:t,initialUrl:o,targetBrowserUrl:i}){let r=t!==void 0?this.urlHandlingStrategy.merge(t,o):o,s=i??r;return s instanceof Kt?this.urlSerializer.serialize(s):s}routerUrlState(t){return t?.targetBrowserUrl===void 0||t?.finalUrl===void 0?{}:{\u0275routerUrl:this.urlSerializer.serialize(t.finalUrl)}}commitTransition({targetRouterState:t,finalUrl:o,initialUrl:i}){o&&t?(this.currentUrlTree=o,this.rawUrlTree=this.urlHandlingStrategy.merge(o,i),this.routerState=t):this.rawUrlTree=i}routerState=vm(null,f(Sn));getRouterState(){return this.routerState}_stateMemento=this.createStateMemento();get stateMemento(){return this._stateMemento}updateStateMemento(){this._stateMemento=this.createStateMemento()}createStateMemento(){return{rawUrlTree:this.rawUrlTree,currentUrlTree:this.currentUrlTree,routerState:this.routerState}}restoredState(){return this.location.getState()}static \u0275fac=function(o){return new(o||n)};static \u0275prov=Ot({token:n,factory:()=>f(hx)})}return n})(),hx=(()=>{class n extends kc{currentPageId=0;lastSuccessfulId=-1;get browserPageId(){return this.canceledNavigationResolution!=="computed"?this.currentPageId:this.restoredState()?.\u0275routerPageId??this.currentPageId}registerNonRouterCurrentEntryChangeListener(t){return this.location.subscribe(o=>{o.type==="popstate"&&setTimeout(()=>{t(o.url,o.state,"popstate",{replaceUrl:!0})})})}handleRouterEvent(t,o){t instanceof uo?this.updateStateMemento():t instanceof Mn?this.commitTransition(o):t instanceof dr?this.urlUpdateStrategy==="eager"&&(o.extras.skipLocationChange||this.setBrowserUrl(this.createBrowserPath(o),o)):t instanceof Qo?(this.commitTransition(o),this.urlUpdateStrategy==="deferred"&&!o.extras.skipLocationChange&&this.setBrowserUrl(this.createBrowserPath(o),o)):t instanceof qt&&!ym(t)?this.restoreHistory(o):t instanceof po?this.restoreHistory(o,!0):t instanceof Tn&&(this.lastSuccessfulId=t.id,this.currentPageId=this.browserPageId)}setBrowserUrl(t,o){let{extras:i,id:r}=o,{replaceUrl:s,state:a}=i;if(this.location.isCurrentPathEqualTo(t)||s){let d=this.browserPageId,l=p(p({},a),this.generateNgRouterState(r,d,o));this.location.replaceState(t,"",l)}else{let d=p(p({},a),this.generateNgRouterState(r,this.browserPageId+1,o));this.location.go(t,"",d)}}restoreHistory(t,o=!1){if(this.canceledNavigationResolution==="computed"){let i=this.browserPageId,r=this.currentPageId-i;r!==0?this.location.historyGo(r):this.getCurrentUrlTree()===t.finalUrl&&r===0&&(this.resetInternalState(t),this.resetUrlToCurrentUrlTree())}else this.canceledNavigationResolution==="replace"&&(o&&this.resetInternalState(t),this.resetUrlToCurrentUrlTree())}resetInternalState({finalUrl:t}){this.routerState=this.stateMemento.routerState,this.currentUrlTree=this.stateMemento.currentUrlTree,this.rawUrlTree=this.urlHandlingStrategy.merge(this.currentUrlTree,t??this.rawUrlTree)}resetUrlToCurrentUrlTree(){this.location.replaceState(this.urlSerializer.serialize(this.getRawUrlTree()),"",this.generateNgRouterState(this.lastSuccessfulId,this.currentPageId))}generateNgRouterState(t,o,i){return this.canceledNavigationResolution==="computed"?p({navigationId:t,\u0275routerPageId:o},this.routerUrlState(i)):p({navigationId:t},this.routerUrlState(i))}static \u0275fac=function(o){return new(o||n)};static \u0275prov=Ot({token:n,factory:n.\u0275fac})}return n})();function Dc(n,e){n.events.pipe(se(t=>t instanceof Tn||t instanceof qt||t instanceof po||t instanceof Mn),I(t=>t instanceof Tn||t instanceof Mn?0:(t instanceof qt?t.code===_t.Redirect||t.code===_t.SupersededByNewNavigation:!1)?2:1),se(t=>t!==2),Wt(1)).subscribe(()=>{e()})}var oa=(()=>{class n{get currentUrlTree(){return this.stateManager.getCurrentUrlTree()}get rawUrlTree(){return this.stateManager.getRawUrlTree()}disposed=!1;nonRouterCurrentEntryChangeSubscription;console=f(Cg);stateManager=f(kc);options=f(vr,{optional:!0})||{};pendingTasks=f(lg);urlUpdateStrategy=this.options.urlUpdateStrategy||"deferred";navigationTransitions=f(Bm);urlSerializer=f(gr);location=f(qo);urlHandlingStrategy=f(na);injector=f(Sn);_events=new ot;get events(){return this._events}get routerState(){return this.stateManager.getRouterState()}navigated=!1;routeReuseStrategy=f(Um);injectorCleanup=f(Hm,{optional:!0});onSameUrlNavigation=this.options.onSameUrlNavigation||"ignore";config=f(wr,{optional:!0})?.flat()??[];componentInputBindingEnabled=!!f(ea,{optional:!0});currentNavigation=this.navigationTransitions.currentNavigation.asReadonly();constructor(){this.resetConfig(this.config),this.navigationTransitions.setupNavigations(this).subscribe({error:t=>{}}),this.subscribeToNavigationEvents()}eventsSubscription=new Xf;subscribeToNavigationEvents(){let t=this.navigationTransitions.events.subscribe(o=>{try{let i=this.navigationTransitions.currentTransition,r=ye(this.navigationTransitions.currentNavigation);if(i!==null&&r!==null){if(this.stateManager.handleRouterEvent(o,r),o instanceof qt&&o.code!==_t.Redirect&&o.code!==_t.SupersededByNewNavigation)this.navigated=!0;else if(o instanceof Tn)this.navigated=!0,this.injectorCleanup?.(this.routeReuseStrategy,this.routerState,this.config);else if(o instanceof Jo){let s=o.navigationBehaviorOptions,a=this.urlHandlingStrategy.merge(o.url,i.currentRawUrl),d=p({scroll:i.extras.scroll,browserUrl:i.extras.browserUrl,info:i.extras.info,skipLocationChange:i.extras.skipLocationChange,replaceUrl:i.extras.replaceUrl||this.urlUpdateStrategy==="eager"||ux(i.source)},s);this.scheduleNavigation(a,ir,null,d,{resolve:i.resolve,reject:i.reject,promise:i.promise})}}h_(o)&&this._events.next(o)}catch(i){this.navigationTransitions.transitionAbortWithErrorSubject.next(i)}});this.eventsSubscription.add(t)}resetRootComponentType(t){this.routerState.root.component=t,this.navigationTransitions.rootComponentType=t}initialNavigation(){this.setUpLocationChangeListener(),this.navigationTransitions.hasRequestedNavigation||this.navigateToSyncWithBrowser(this.location.path(!0),ir,this.stateManager.restoredState(),{replaceUrl:!0})}setUpLocationChangeListener(){this.nonRouterCurrentEntryChangeSubscription??=this.stateManager.registerNonRouterCurrentEntryChangeListener((t,o,i,r)=>{this.navigateToSyncWithBrowser(t,i,o,r)})}navigateToSyncWithBrowser(t,o,i,r){let s=i?.navigationId?i:null,a=i?.\u0275routerUrl??t;if(i?.\u0275routerUrl&&(r=C(p({},r),{browserUrl:t})),i){let l=p({},i);delete l.navigationId,delete l.\u0275routerPageId,delete l.\u0275routerUrl,Object.keys(l).length!==0&&(r.state=l)}let d=this.parseUrl(a);this.scheduleNavigation(d,o,s,r).catch(l=>{this.disposed||this.injector.get(ji)(l)})}get url(){return this.serializeUrl(this.currentUrlTree)}getCurrentNavigation(){return ye(this.navigationTransitions.currentNavigation)}get lastSuccessfulNavigation(){return this.navigationTransitions.lastSuccessfulNavigation}resetConfig(t){this.config=t.map(Ec),this.navigated=!1}ngOnDestroy(){this.dispose()}dispose(){this._events.unsubscribe(),this.navigationTransitions.complete(),this.nonRouterCurrentEntryChangeSubscription?.unsubscribe(),this.nonRouterCurrentEntryChangeSubscription=void 0,this.disposed=!0,this.eventsSubscription.unsubscribe()}createUrlTree(t,o={}){let{relativeTo:i,queryParams:r,fragment:s,queryParamsHandling:a,preserveFragment:d}=o,l=d?this.currentUrlTree.fragment:s,h=null;switch(a??this.options.defaultQueryParamsHandling){case"merge":h=p(p({},this.currentUrlTree.queryParams),r);break;case"preserve":h=this.currentUrlTree.queryParams;break;default:h=r||null}h!==null&&(h=this.removeEmptyProps(h));let g;try{let _=i?i.snapshot:this.routerState.snapshot.root;g=hm(_)}catch(_){(typeof t[0]!="string"||t[0][0]!=="/")&&(t=[]),g=this.currentUrlTree.root}return fm(g,t,h,l??null,this.urlSerializer)}navigateByUrl(t,o={skipLocationChange:!1}){let i=Xo(t)?t:this.parseUrl(t),r=this.urlHandlingStrategy.merge(i,this.rawUrlTree);return this.scheduleNavigation(r,ir,null,o)}navigate(t,o={skipLocationChange:!1}){return fx(t),this.navigateByUrl(this.createUrlTree(t,o),o)}serializeUrl(t){return this.urlSerializer.serialize(t)}parseUrl(t){try{return this.urlSerializer.parse(t)}catch(o){return this.console.warn(Tl(4018,!1)),this.urlSerializer.parse("/")}}isActive(t,o){let i;if(o===!0?i=p({},im):o===!1?i=p({},cc):i=p(p({},cc),o),Xo(t))return Gg(this.currentUrlTree,t,i);let r=this.parseUrl(t);return Gg(this.currentUrlTree,r,i)}removeEmptyProps(t){return Object.entries(t).reduce((o,[i,r])=>(r!=null&&(o[i]=r),o),{})}scheduleNavigation(t,o,i,r,s){if(this.disposed)return Promise.resolve(!1);let a,d,l;s?(a=s.resolve,d=s.reject,l=s.promise):l=new Promise((g,_)=>{a=g,d=_});let h=this.pendingTasks.add();return Dc(this,()=>{queueMicrotask(()=>this.pendingTasks.remove(h))}),this.navigationTransitions.handleNavigationRequest({source:o,restoredState:i,currentUrlTree:this.currentUrlTree,currentRawUrl:this.currentUrlTree,rawUrl:t,extras:r,resolve:a,reject:d,promise:l,currentSnapshot:this.routerState.snapshot,currentRouterState:this.routerState}),l.catch(Promise.reject.bind(Promise))}static \u0275fac=function(o){return new(o||n)};static \u0275prov=Ot({token:n,factory:n.\u0275fac})}return n})();function fx(n){for(let e=0;e<n.length;e++)if(n[e]==null)throw new Re(4008,!1)}var vx=new Be("");function Tc(n,...e){return gs([{provide:wr,multi:!0,useValue:n},{provide:Gn,useFactory:wx},{provide:_g,multi:!0,useFactory:bx},e.map(t=>t.\u0275providers)])}function wx(){return f(oa).routerState.root}function bx(){let n=f(wt);return e=>{let t=n.get(bs);if(e!==t.components[0])return;let o=n.get(oa),i=n.get(Cx);n.get(_x)===1&&o.initialNavigation(),n.get(xx,null,{optional:!0})?.setUpPreloading(),n.get(vx,null,{optional:!0})?.init(),o.resetRootComponentType(t.componentTypes[0]),i.closed||(i.next(),i.complete(),i.unsubscribe())}}var Cx=new Be("",{factory:()=>new ot}),_x=new Be("",{factory:()=>1});var xx=new Be("");function ht(n){n||(n=f(je));let e=new cs(t=>{if(n.destroyed){t.next();return}return n.onDestroy(t.next.bind(t))});return t=>t.pipe(Ho(e))}function et(n,e){let t=e?.injector??f(wt),o=new Jf(1),i=xe(()=>{let r;try{r=n()}catch(s){ye(()=>o.error(s));return}ye(()=>o.next(r))},{injector:t,manualCleanup:!0});return t.get(je).onDestroy(()=>{i.destroy(),o.complete()}),o.asObservable()}function oe(n,e){let o=!e?.manualCleanup?e?.injector?.get(je)??f(je):null,i=Px(e?.equal),r;e?.requireSync?r=U({kind:0},{equal:i}):r=U({kind:1,value:e?.initialValue},{equal:i});let s,a=n.subscribe({next:d=>r.set({kind:1,value:d}),error:d=>{r.set({kind:2,error:d}),s?.()},complete:()=>{s?.()}});if(e?.requireSync&&r().kind===0)throw new Re(601,!1);return s=o?.onDestroy(a.unsubscribe.bind(a)),b(()=>{let d=r();switch(d.kind){case 1:return d.value;case 2:throw d.error;case 0:throw new Re(601,!1)}},{equal:e?.equal})}function Px(n=Object.is){return(e,t)=>e.kind===1&&t.kind===1&&n(e.value,t.value)}var Ex=["*"];function Ix(n,e){if(n&1&&(O(0,"span",1),w(1),N()),n&2){let t=c();xg(t.tipStyle()),u(),H(" ",t.tip()," ")}}var Ue=class n{constructor(){this.host=f(He);this.tip=T.required();this.align=T("end");this.side=T("top");this.tipStyle=U("")}placeTip(){this.tipStyle.set(kx(this.host.nativeElement.getBoundingClientRect(),this.side(),this.align(),{width:window.innerWidth,height:window.innerHeight}))}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-hover-tip"]],hostAttrs:[1,"group","relative","inline-flex","max-w-full"],hostBindings:function(t,o){t&1&&R("pointerenter",function(){return o.placeTip()})("focusin",function(){return o.placeTip()})},inputs:{tip:[1,"tip"],align:[1,"align"],side:[1,"side"]},ngContentSelectors:Ex,decls:2,vars:1,consts:[["role","tooltip",1,"pointer-events-none","fixed","z-40","hidden","whitespace-nowrap","rounded-md","border","border-zinc-200","bg-white","px-2","py-1","text-xs","font-medium","text-zinc-700","shadow-sm","group-hover:block","group-focus-within:block","dark:border-zinc-600","dark:bg-zinc-800","dark:text-zinc-100",3,"style"],["role","tooltip",1,"pointer-events-none","fixed","z-40","hidden","whitespace-nowrap","rounded-md","border","border-zinc-200","bg-white","px-2","py-1","text-xs","font-medium","text-zinc-700","shadow-sm","group-hover:block","group-focus-within:block","dark:border-zinc-600","dark:bg-zinc-800","dark:text-zinc-100"]],template:function(t,o){t&1&&(it(),Je(0),P(1,Ix,2,3,"span",0)),t&2&&(u(),E(o.tip().trim().length>0?1:-1))},encapsulation:2})}},ia=8,kx=(n,e,t,o)=>{let i=[];return e==="bottom"?i.push(`top:${n.bottom+ia}px`):e==="top"?i.push(`bottom:${o.height-n.top+ia}px`):e==="left"?i.push(`right:${o.width-n.left+ia}px`):i.push(`left:${n.right+ia}px`),e==="top"||e==="bottom"?t==="start"?i.push(`left:${n.left}px`):t==="end"?i.push(`right:${o.width-n.right}px`):(i.push(`left:${n.left+n.width/2}px`),i.push("transform:translateX(-50%)")):t==="start"?i.push(`top:${n.top}px`):t==="end"?i.push(`bottom:${o.height-n.bottom}px`):(i.push(`top:${n.top+n.height/2}px`),i.push("transform:translateY(-50%)")),i.join(";")};var Xm=lC(jm(),1);var Dx=n=>Array.isArray(n)&&n.length===4&&typeof n[0]=="string"&&(n[1]==="in"||n[1]==="out")&&typeof n[2]=="string",Tx=(n,e,t,o=new Date().toISOString())=>JSON.stringify([o,n,e,t]),Wm={encode(n,e){return Tx(e,n.type,n.payload)},decode(n){try{let e=JSON.parse(n);return Dx(e)?{type:e[2],payload:e[3]}:null}catch(e){return null}}};var Mx=n=>typeof n=="object"&&n!==null&&!Array.isArray(n),Mc=n=>Mx(n)?typeof n.type=="string"&&"payload"in n:!1,Rx=(n,e,t)=>e in n[t],Gm=(n,e,t)=>!Mc(e)||!Rx(n,e.type,t)?null:e;function Rc(n,e,t){return t===void 0?{code:n,message:e}:{code:n,message:e,cause:t}}function qm(n,e,t,o){let i=e.decode(t);if(i===null)return{error:Rc("INVALID_FRAME","Frame is not valid bridge JSON envelope")};let r=Gm(n,i,o);return r!==null?{event:r}:Mc(i)?{error:Rc("UNKNOWN_EVENT_TYPE",`Unknown or disallowed event type: ${i.type}`)}:{error:Rc("INVALID_ENVELOPE","Frame must be a bridge tuple [ts, transportDir, busType, payload]")}}function Nc(n,e){return Object.keys(n[e])}function Oc(n){let e={};for(let t of n)e[t]=new ot;return e}function Km(n){let e={};for(let[t,o]of Object.entries(n))e[t]=o.asObservable();return e}function Ym(n,e,t){return Object.entries(n).map(([o,i])=>i.subscribe(r=>{e({type:o,payload:r},t)}))}function Zm(n,e,t){let o=e[n.type];return o===void 0?!1:(o.next(t===void 0?n.payload:{clientId:t,payload:n.payload}),!0)}function Ac(n){for(let e of Object.values(n))e.complete()}var Nx=1;function Ox(n){if(typeof globalThis.WebSocket<"u"){let t=new globalThis.WebSocket(n);return{get readyState(){return t.readyState},send:o=>{t.send(o)},close:()=>{t.close()},onOpen:o=>{t.onopen=()=>{o()}},onMessage:o=>{t.onmessage=i=>{o(String(i.data))}},onClose:o=>{t.onclose=()=>{o()}},onError:o=>{t.onerror=i=>{o(i)}}}}let e=new Xm.default(n);return{get readyState(){return e.readyState},send:t=>{e.send(t)},close:()=>{e.close()},onOpen:t=>{e.on("open",t)},onMessage:t=>{e.on("message",o=>{t(String(o))})},onClose:t=>{e.on("close",t)},onError:t=>{e.on("error",t)}}}var Ax=(n,e)=>{if(e.url!==void 0)return e.url;let t=n.transport?.path;if(typeof globalThis.window<"u"){if(t===void 0)throw new Error("createClient: omit options.url only when config.transport.path is set (browser uses window.location.host).");return`${globalThis.window.location.protocol==="https:"?"wss:":"ws:"}//${globalThis.window.location.host}${t}`}let o=n.transport?.port;if(o===void 0||t===void 0)throw new Error("createClient: Node requires options.url, or both config.transport.port and config.transport.path. The kernel does not default to a product port or /ws.");return`ws://127.0.0.1:${String(o)}${t}`},Qm=(n,e={})=>{let t=n.codec??Wm,o=Ax(n,e),i=Nc(n,"fromClientToServer"),r=Nc(n,"fromServerToClient"),s=Oc(i),a=Oc(r),d=Km(a),l=new ot,h=new vt("connecting"),g=Ox(o),D=Ym(s,(J,fe)=>{if(g.readyState!==Nx){l.next({code:"TRANSPORT_NOT_OPEN",message:"Cannot send while WebSocket is not open"});return}g.send(t.encode(J,fe))},"in");g.onOpen(()=>{h.next("connected")}),g.onMessage(J=>{let fe=qm(n,t,J,"fromServerToClient");if("error"in fe){l.next(fe.error);return}Zm(fe.event,a)});let L=!1,q=J=>{if(!L){L=!0,h.next("disconnected");for(let fe of D)fe.unsubscribe();Ac(s),Ac(a),l.complete(),h.complete(),J&&g.close()}};g.onClose(()=>{q(!1)}),g.onError(J=>{l.next({code:"TRANSPORT_ERROR",message:"WebSocket client error",cause:J})});let Y={errors$:l.asObservable(),status$:h.asObservable(),close(){q(!0)}};return Object.assign(Y,s,d)};var W=()=>({});var Jm={fromClientToServer:{"editor.addNode.requested":W(),"editor.updateNode.requested":W(),"editor.addEdge.requested":W(),"editor.paste.requested":W(),"editor.removeEdge.requested":W(),"editor.removeNode.requested":W(),"editor.viewport.requested":W(),"editor.dividers.requested":W(),"editor.paletteVisible.requested":W(),"editor.selectNode.requested":W(),"editor.settings.requested":W()},fromServerToClient:{"editor.addNodes":W(),"editor.updateNodes":W(),"editor.addEdges":W(),"editor.deleteNodes":W(),"editor.deleteEdges":W(),"editor.viewport.delta":W(),"editor.dividers.snapshot":W(),"editor.paletteVisible.snapshot":W(),"editor.nodeSelected":W(),"editor.settings.snapshot":W()}},e0={fromClientToServer:{"runner.start.requested":W(),"runner.startNode.requested":W(),"runner.interrupt.requested":W(),"runner.hitl.event":W(),"runner.permission.reply":W(),"runner.askUser.reply":W(),"runner.executionFeed.clear.requested":W(),"runner.resume.requested":W()},fromServerToClient:{"runner.started":W(),"runner.startNode.started":W(),"runner.resume.started":W(),"runner.resume.failed":W(),"runner.interrupted":W(),"runner.port":W(),"runner.done":W(),"runner.permission.ask":W(),"runner.permission.accepted":W(),"runner.askUser.ask":W(),"runner.askUser.accepted":W()}},t0={fromClientToServer:{},fromServerToClient:{"session.state.snapshot":W(),"session.ready":W(),"runner.snapshot":W(),"executionFeed.snapshot":W(),"toolConfig.snapshot":W()}},n0={fromClientToServer:{"langflower.config.save.requested":W(),"langflower.secrets.save.requested":W(),"langflower.config.draft.patch.requested":W(),"langflower.config.draft.discard.requested":W(),"project.bootstrap.requested":W()},fromServerToClient:{"langflower.config.snapshot":W(),"langflower.config.draft.snapshot":W(),"langflower.models.catalog.snapshot":W(),"project.bootstrap.result":W()}},o0={fromClientToServer:{"palette.reload.requested":W()},fromServerToClient:{"palette.snapshot":W()}},i0={fromClientToServer:{"customPalette.update.requested":W()},fromServerToClient:{"customPalette.snapshot":W()}},r0={fromClientToServer:{"workflow.saveCurrent.requested":W(),"workflow.renameCurrent.requested":W(),"workflow.create.requested":W(),"workflow.copy.requested":W(),"workflow.load.requested":W(),"workflow.list.requested":W(),"workflow.delete.requested":W()},fromServerToClient:{"workflow.current.snapshot":W(),"workflow.load.failed":W(),"workflow.load.repaired":W(),"workflow.currentStatus.snapshot":W(),"workflow.list.snapshot":W()}},s0={fromClientToServer:{"workflowSession.create.requested":W(),"workflowSession.select.requested":W(),"workflowSession.delete.requested":W(),"workflowSession.replaceSnapshotFromWorkflow.requested":W(),"workflowSession.writeSnapshotToWorkflow.requested":W(),"workflowSession.discardPoint.requested":W(),"workflowSession.resetConversation.requested":W()},fromServerToClient:{"workflowSession.list.snapshot":W(),"workflowSession.current.snapshot":W(),"workflowSession.action.failed":W()}},a0={transport:{path:"/ws",port:4010},fromClientToServer:p(p(p(p(p(p(p(p({},Jm.fromClientToServer),e0.fromClientToServer),t0.fromClientToServer),n0.fromClientToServer),o0.fromClientToServer),i0.fromClientToServer),r0.fromClientToServer),s0.fromClientToServer),fromServerToClient:p(p(p(p(p(p(p(p({},Jm.fromServerToClient),e0.fromServerToClient),t0.fromServerToClient),n0.fromServerToClient),o0.fromServerToClient),i0.fromServerToClient),r0.fromServerToClient),s0.fromServerToClient)};var Lx=["langflower.models.catalog.snapshot","langflower.config.snapshot","langflower.config.draft.snapshot","session.state.snapshot","palette.snapshot","customPalette.snapshot","workflow.current.snapshot","workflow.list.snapshot","workflow.currentStatus.snapshot","executionFeed.snapshot","toolConfig.snapshot","editor.dividers.snapshot","editor.paletteVisible.snapshot","workflowSession.list.snapshot","workflowSession.current.snapshot"],Fx=(n,e,t)=>{let o=n[e].pipe(ht(t),te(1));return o.subscribe(),o},ie=class n{constructor(){this.destroyRef=f(je);let t=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;this.raw=Qm(a0,{url:t}),this.cached=Object.fromEntries(Lx.map(o=>[o,Fx(this.raw,o,this.destroyRef)]))}ngOnDestroy(){this.raw.close()}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275prov=j({token:n,factory:n.\u0275fac,providedIn:"root"})}};var d0={open:!1,scope:"project"},ri=class n{constructor(){this.bridge=f(ie);this.settings$=ee(this.bridge.cached["session.state.snapshot"].pipe(I(e=>e.settings)),this.bridge.raw["editor.settings.snapshot"]).pipe(de(d0),te({bufferSize:1,refCount:!1}));this.settings=oe(this.settings$,{initialValue:d0});this.open=b(()=>this.settings().open);this.scope=b(()=>this.settings().scope)}requestOpen(e){this.bridge.raw["editor.settings.requested"].next({open:!0,scope:e})}requestClose(){this.bridge.raw["editor.settings.requested"].next({open:!1})}requestScope(e){this.bridge.raw["editor.settings.requested"].next({open:!0,scope:e})}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275prov=j({token:n,factory:n.\u0275fac,providedIn:"root"})}};var ra={config:{},projectConfig:{},globalConfig:{},globalPath:"",secretIds:[],secretsPath:""},qn=class n{constructor(){this.bridge=f(ie);this.layers$=ee(this.bridge.cached["session.state.snapshot"].pipe(I(e=>({kind:"session",config:e.langflowerConfig}))),this.bridge.cached["langflower.config.snapshot"].pipe(I(e=>({kind:"snapshot",payload:e})))).pipe(ve((e,t)=>t.kind==="session"?C(p({},e),{config:t.config}):{config:t.payload.config,projectConfig:t.payload.projectConfig,globalConfig:t.payload.globalConfig,globalPath:t.payload.globalPath,secretIds:t.payload.secretIds,secretsPath:t.payload.secretsPath},ra),de(ra),te({bufferSize:1,refCount:!1}));this.config$=this.layers$.pipe(I(e=>e.config));this.config=oe(this.config$,{initialValue:ra.config});this.layers=oe(this.layers$,{initialValue:ra})}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275prov=j({token:n,factory:n.\u0275fac,providedIn:"root"})}};var Kn=class n{constructor(){this.bridge=f(ie);this.catalogs$=this.bridge.cached["langflower.models.catalog.snapshot"].pipe(I(e=>e.catalogs),te({bufferSize:1,refCount:!1}));this.catalogs$.subscribe()}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275prov=j({token:n,factory:n.\u0275fac,providedIn:"root"})}};var Yn=class n{constructor(){this.bridge=f(ie);this.selectedNode$=ee(this.bridge.cached["session.state.snapshot"].pipe(I(e=>e.selectedNode)),this.bridge.raw["editor.nodeSelected"].pipe(I(e=>e.node))).pipe(de(null),te({bufferSize:1,refCount:!1}));this.selectedNode=oe(this.selectedNode$,{initialValue:null});this.selectedNodeId=b(()=>this.selectedNode()?.id??null);this.hasSelectedNode=b(()=>this.selectedNodeId()!==null)}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275prov=j({token:n,factory:n.\u0275fac,providedIn:"root"})}};var l0="lf-theme",si=class n{constructor(){this.themeSubject=new vt(this.readStoredTheme());this.theme$=this.themeSubject.asObservable();this.applyTheme(this.themeSubject.value)}get snapshot(){return this.themeSubject.value}setTheme(e){this.themeSubject.next(e),this.applyTheme(e),this.persistTheme(e)}toggleTheme(){this.setTheme(this.snapshot==="dark"?"light":"dark")}readStoredTheme(){return typeof localStorage>"u"?"dark":localStorage.getItem(l0)==="light"?"light":"dark"}persistTheme(e){typeof localStorage>"u"||localStorage.setItem(l0,e)}applyTheme(e){typeof document>"u"||(document.documentElement.dataset.theme=e)}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275prov=j({token:n,factory:n.\u0275fac,providedIn:"root"})}};var br=100,Cr=n=>n==="text-multiline"||n==="markdown"?{flex:1,minHeightPx:br}:typeof n=="object"&&(n.type==="text-multiline"||n.type==="markdown")?{flex:n.flex??1,minHeightPx:n.minHeightPx??br}:null;var zx="[A-Za-z_][A-Za-z0-9_]*",$x=new RegExp(`^${zx}$`),Bx=n=>$x.test(n),Hx=()=>globalThis.process?.env??{},Ux=n=>{let e=n.trim(),t=e.indexOf(":");if(t<=0)return{ok:!1,message:"Secret ref is invalid"};let o=e.slice(0,t).trim(),i=e.slice(t+1).trim(),r=o==="lf_secret"||o==="lf_secrets"?"lf_secret":o==="env"?"env":void 0;return r===void 0?{ok:!1,message:"Secret ref is invalid"}:Bx(i)?{ok:!0,kind:r,id:i}:{ok:!1,message:i.length===0?"Secret id is invalid":`Secret id ${i} is invalid`}},c0=n=>{let e=n.secrets,t=n.env;return o=>{let i=Ux(o);if(!i.ok)return i;if(i.kind==="lf_secret"){let a=e[i.id];return typeof a=="string"&&a!==""?{ok:!0,value:a}:{ok:!1,message:`Secret ${i.id} is not set`}}let s=(t??Hx())[i.id];return typeof s=="string"&&s!==""?{ok:!0,value:s}:{ok:!1,message:`Environment variable ${i.id} is not set`}}},Vx=c0({secrets:{},env:{}});var dt="steerControl",_r=n=>{if(typeof n!="object"||n===null||Array.isArray(n))return!1;let e=n.kind;return e==="pause"||e==="resume"?!0:e==="steer"?typeof n.text=="string":!1},xr=n=>_r(n)&&n.kind==="pause",Sr=n=>_r(n)&&(n.kind==="steer"||n.kind==="resume");var fo="recovery",sa=n=>{if(typeof n!="object"||n===null)return!1;let e=n;return(e.code==="retry"||e.code==="suspended")&&typeof e.text=="string"},ai=n=>sa(n)&&n.code==="suspended";var Dt=n=>new Map(n.map(e=>[e.type,e]));var go=(n,e)=>({nodes:[...n.nodes.map(t=>C(p({},t),{source:"system"})),...e.nodes.map(t=>C(p({},t),{source:"custom"}))]}),aa=(n,e)=>Te([n,e]).pipe(I(([t,o])=>go(t,o))),di=n=>{let e=new Map;for(let t of n.activeWorkflow?.graph.nodes??[])e.set(t.id,t.type);return e},Lc=(n,e)=>{let t=new Map;for(let o of n.activeWorkflow?.graph.nodes??[]){let i=o.ui.label?.trim()||e.get(o.type)?.displayName||o.type;t.set(o.id,i)}return t},da=(n,e)=>{let t=Dt(e.nodes),o=di(n);return{labels:Lc(n,t),paletteByType:t,nodeTypeById:o,workflowId:n.activeWorkflow?.workflowId??null}},h0=n=>[...n.keys()].sort().join("\0"),f0=(n,e)=>{if(n===null)return!1;let t=n.workflowId??null,o=e.workflowId??null;return t===null||o===null||t===o?!1:n.nodeIdsKey!==e.nodeIdsKey},dn=(n,e,t)=>{let o=e.get(t);return o===void 0?void 0:n.get(o)},g0=(n,e,t)=>{if(xr(t))return"";if(Sr(t))return t.kind==="steer"?t.text.trim():"";let i=n.inputsConfigs.find(r=>r.portId===e)?.hitl;return i===void 0?typeof t=="string"?t.trim():"":i.kind==="button"?i.label.trim():typeof t=="string"?t.trim():t==null?"":String(t)};var N0=["backgroundPattern"];function Xx(n,e){if(n&1&&(ce(),bt(0,"line")),n&2){let t=e.$implicit;K("x1",t.x1)("y1",t.y1)("x2",t.x2)("y2",t.y2)("stroke",t.major?"var(--ngd-background-line-major-color)":"var(--ngd-background-line-minor-color)")("stroke-width",t.major?"var(--ngd-background-line-major-width)":"var(--ngd-background-line-minor-width)")("opacity",t.major?"var(--ngd-background-line-major-opacity)":"var(--ngd-background-line-minor-opacity)")}}var th=["contentProjection"],Lt=["*"];function Qx(n,e){n&1&&F(0,"ng-diagram-dotted-background")}function Jx(n,e){n&1&&F(0,"ng-diagram-grid-background")}function e1(n,e){if(n&1&&(y(0,"div"),P(1,Qx,1,0,"ng-diagram-dotted-background")(2,Jx,1,0,"ng-diagram-grid-background"),m()),n&2){let t=c();u(),E(t.isDottedBackground()?1:2)}}function t1(n,e){if(n&1&&bt(0,"div"),n&2){c();let t=Hl(0);Ze("left",t.x,"px")("top",t.y,"px")("width",t.width,"px")("height",t.height,"px")}}var n1=[[["ng-diagram-edge"]],[["ng-diagram-marker-arrow"]],[["ng-diagram-node"]]],o1=["ng-diagram-edge","ng-diagram-marker-arrow","ng-diagram-node"];function i1(n,e){if(n&1&&(ce(),F(0,"defs",0)),n&2){let t=c();M("sourceMarkerId",t.sourceMarkerId())("targetMarkerId",t.targetMarkerId())("edgeId",t.edge().id)}}function r1(n,e){if(n&1&&(y(0,"ng-diagram-base-edge-label",1)(1,"ng-diagram-default-edge-label"),w(2),m()()),n&2){let t=c(),o=Hl(1);M("id","edge-label")("positionOnEdge",t.positionOnEdge()),u(2),ue(o)}}function s1(n,e){if(n&1&&F(0,"ng-diagram-resize-line",0),n&2){let t=e.$implicit,o=c(2);M("position",t)("targetData",o.nodeData())}}function a1(n,e){if(n&1&&F(0,"ng-diagram-resize-handle",0),n&2){let t=e.$implicit,o=c(2);M("position",t)("targetData",o.nodeData())}}function d1(n,e){if(n&1&&(X(0,s1,1,2,"ng-diagram-resize-line",0,ao),X(2,a1,1,2,"ng-diagram-resize-handle",0,ao)),n&2){let t=c();Q(t.linePositions),u(2),Q(t.handlePositions)}}function l1(n,e){n&1&&(ce(),O(0,"svg",2),bt(1,"path",3),N())}function c1(n,e){if(n&1&&(y(0,"ng-diagram-rotate-handle",0),Je(1),m()),n&2){let t=c();M("data",t.nodeData())}}var u1=[[["ng-diagram-background"]]],p1=["ng-diagram-background"],h1=n=>({edge:n}),f1=n=>({node:n});function g1(n,e){n&1&&$t(0)}function m1(n,e){if(n&1&&jo(0,g1,1,0,"ng-container",5),n&2){let t=c().$implicit,o=c();M("ngComponentOutlet",o.getEdgeTemplate(t.type))("ngComponentOutletInputs",In(2,h1,t))}}function y1(n,e){if(n&1&&F(0,"ng-diagram-default-edge",4),n&2){let t=c().$implicit;M("edge",t)}}function v1(n,e){if(n&1&&(y(0,"ng-diagram-edge"),P(1,m1,1,4,"ng-container")(2,y1,1,1,"ng-diagram-default-edge",4),m()),n&2){let t=e.$implicit,o=c();K("data-edge-id",t.id),u(),E(o.getEdgeTemplate(t.type)?1:2)}}function w1(n,e){n&1&&$t(0)}function b1(n,e){if(n&1&&jo(0,w1,1,0,"ng-container",5),n&2){let t=c().$implicit,o=c();M("ngComponentOutlet",o.getNodeTemplate(t.type))("ngComponentOutletInputs",In(2,f1,t))}}function C1(n,e){if(n&1&&F(0,"ng-diagram-default-group-template",6),n&2){let t=c().$implicit,o=c();M("node",o.castToGroupNode(t))}}function _1(n,e){if(n&1&&F(0,"ng-diagram-default-node-template",6),n&2){let t=c().$implicit;M("node",t)}}function x1(n,e){if(n&1&&(y(0,"ng-diagram-node",2),P(1,b1,1,4,"ng-container")(2,C1,1,1,"ng-diagram-default-group-template",6)(3,_1,1,1,"ng-diagram-default-node-template",6),m()),n&2){let t=e.$implicit,o=c();M("node",t),K("data-node-id",t.id),u(),E(o.getNodeTemplate(t.type)?1:o.isGroup(t)?2:3)}}function S1(n,e){if(n&1&&F(0,"ng-diagram-watermark",3),n&2){let t,o=c();M("preferredPosition",(t=o.config())==null?null:t.watermarkPosition)}}function P1(n,e){if(n&1&&(ce(),bt(0,"circle")),n&2){let t=c();K("cx",t.cx())("cy",t.cy())("r",t.radius())}}function E1(n,e){if(n&1&&(ce(),bt(0,"ellipse")),n&2){let t=c();K("cx",t.cx())("cy",t.cy())("rx",t.rx())("ry",t.ry())}}function I1(n,e){if(n&1&&(ce(),bt(0,"rect")),n&2){let t=c();K("x",t.bounds().x)("y",t.bounds().y)("width",t.bounds().width)("height",t.bounds().height)}}var k1=(n,e)=>({node:n,nodeStyle:e}),D1=(n,e)=>e.bounds.id;function T1(n,e){n&1&&$t(0)}function M1(n,e){if(n&1&&(ce(),y(0,"foreignObject"),jo(1,T1,1,0,"ng-container",6),m()),n&2){let t=c().$implicit;K("x",t.bounds.x)("y",t.bounds.y)("width",t.bounds.width)("height",t.bounds.height)("transform",t.bounds.transform),u(),M("ngComponentOutlet",t.template)("ngComponentOutletInputs",Un(7,k1,t.diagramNode,t.nodeStyle))}}function R1(n,e){if(n&1&&(ce(),F(0,"g",5)),n&2){let t=c().$implicit;M("bounds",t.bounds)("nodeStyle",t.nodeStyle)}}function N1(n,e){if(n&1&&P(0,M1,2,10,":svg:foreignObject")(1,R1,1,2,":svg:g",5),n&2){let t=e.$implicit;E(t.template?0:1)}}function O1(n,e){if(n&1&&(ce(),F(0,"rect",3)),n&2){let t=c(2);M("diagramBounds",t.diagramBounds())("minimapTransform",t.transform())}}function A1(n,e){if(n&1&&(ce(),F(0,"rect",4)),n&2){let t=c(2);K("x",t.viewportRect().x)("y",t.viewportRect().y)("width",t.viewportRect().width)("height",t.viewportRect().height)}}function L1(n,e){if(n&1&&(ce(),y(0,"g"),X(1,N1,2,1,null,null,D1),m(),P(3,O1,1,2,":svg:rect",3),P(4,A1,1,4,":svg:rect",4)),n&2){let t=c();K("transform",t.nodesGroupTransform()),u(),Q(t.minimapNodes()),u(2),E(t.showDiagramBounds()?3:-1),u(),E(t.hasValidViewport()?4:-1)}}function F1(n,e){n&1&&F(0,"ng-diagram-zoom-controls")}var Er=class n{boundingBox=U(null);static \u0275fac=function(t){return new(t||n)};static \u0275prov=j({token:n,factory:n.\u0275fac,providedIn:"root"})};Set.prototype.difference||(Set.prototype.difference=function(n){let e=new Set;for(let t of this)n.has(t)||e.add(t);return e}),Set.prototype.intersection||(Set.prototype.intersection=function(n){let e=new Set;for(let t of this)n.has(t)&&e.add(t);return e});var $c=class{eventManager;state;constructor(e){this.eventManager=e,this.state=new Proxy({},{set:(t,o,i)=>(t[o]=i,this.emitStateChanged(),!0)})}getState(){return this.state}emitStateChanged(){this.eventManager.emit("actionStateChanged",{actionState:p({},this.state)})}get resize(){return this.state.resize}set resize(e){this.state.resize=e}get linking(){return this.state.linking}set linking(e){this.state.linking=e}get copyPaste(){return this.state.copyPaste}set copyPaste(e){this.state.copyPaste=e}get highlightGroup(){return this.state.highlightGroup}set highlightGroup(e){this.state.highlightGroup=e}get rotation(){return this.state.rotation}set rotation(e){this.state.rotation=e}get dragging(){return this.state.dragging}set dragging(e){this.state.dragging=e}get panning(){return this.state.panning}set panning(e){this.state.panning=e}clearResize(){this.state.resize=void 0}clearLinking(){this.state.linking=void 0}clearCopyPaste(){this.state.copyPaste=void 0}clearHighlightGroup(){this.state.highlightGroup=void 0}clearRotation(){this.state.rotation=void 0}clearDragging(){this.state.dragging=void 0}isResizing(){return!!this.state.resize}isLinking(){return!!this.state.linking}isRotating(){return!!this.state.rotation}isDragging(){return!!this.state.dragging}clearPanning(){this.state.panning=void 0}isPanning(){return!!this.state.panning?.active}get selection(){return this.state.selection}set selection(e){this.state.selection=e}clearSelection(){this.state.selection=void 0}},z1=n=>{if(!n||n.length===0)return"";if(n.length===1)return`M ${n[0].x},${n[0].y}`;if(n.length===2)return`M ${n[0].x},${n[0].y} L ${n[1].x},${n[1].y}`;if(n.length===3)return`M ${n[0].x},${n[0].y} Q ${n[1].x},${n[1].y} ${n[2].x},${n[2].y}`;if(n.length===4)return`M ${n[0].x},${n[0].y} C ${n[1].x},${n[1].y} ${n[2].x},${n[2].y} ${n[3].x},${n[3].y}`;let e=[`M ${n[0].x},${n[0].y}`];for(let t=1;t<n.length;t++)e.push(`L ${n[t].x},${n[t].y}`);return e.join(" ")},Ua=(n,e)=>{let t=n>=0&&!Object.is(n,-0)?n:e+n;return Math.max(0,Math.min(t,e))};function $1(n,e){return Math.atan2(e.y-n.y,e.x-n.x)*(180/Math.PI)}var nh=n=>(n%360+360)%360,B1=(n,e=!1)=>{let t=nh(n),o;return o=t>=315||t<45?"right":t>=45&&t<135?"bottom":t>=135&&t<225?"left":"top",e?{right:"left",left:"right",top:"bottom",bottom:"top"}[o]:o},li=({min:n,value:e,max:t})=>Math.min(Math.max(e,n),t),H1=(n,e,t,o)=>{let{x:i,y:r,width:s,height:a}=n,{x:d,y:l}=e,h=0,g=0,_=d-i,D=i+s-d,L=l-r,q=r+a-l;if(_<t?h=li({min:0,max:t,value:-(_-t)}):D<t&&(h=-li({min:0,max:t,value:-(D-t)})),L<t?g=li({min:0,max:t,value:-(L-t)}):q<t&&(g=-li({min:0,max:t,value:-(q-t)})),h===0&&g===0)return null;let Y=h/t,J=g/t;return Y=isFinite(Y)?Y:1,J=isFinite(J)?J:1,{x:Y*o,y:J*o}},U1=(n,e)=>Math.sqrt((n.x-e.x)**2+(n.y-e.y)**2);function m0(n){return Math.abs(n-Math.trunc(n))}function V1(n,e){let t=Math.round(n/e);if(t===0&&e>1)return 0;let o=Math.abs(t)===1&&Math.abs(n)<e,i=li({min:1,max:e/2-1,value:Math.floor(e/2-1)});if(o&&e-Math.abs(n)>i)return 0;let r=t*e;if(e===1){let s=(r-1)%90==0;(r+1)%90==0?1-m0(n)<.9001&&(r+=1):s&&m0(n)<.9001&&(r-=1)}return nh(r)}var Bc=(n,e)=>e?e*Math.round(n/e):n,j1=(n,e)=>({x:Bc(n.x,e.width),y:Bc(n.y,e.height)}),lt={angleBetweenPoints:$1,angleToSide:B1,clamp:li,distanceBetweenPoints:U1,normalizeAngle:nh,snapAngle:V1,snapNumber:Bc,snapPoint:j1,calculateEdgePanningForce:H1},pa=(n,e)=>{if(n.length<2)return n[0]||{x:0,y:0};let t=lt.clamp({min:0,value:e,max:1});if(n.length===2){let[_,D]=n;return{x:_.x+(D.x-_.x)*t,y:_.y+(D.y-_.y)*t}}if(n.length===3){let[_,D,L]=n,q=1-t,Y=q*q,J=t*t;return{x:Y*_.x+2*q*t*D.x+J*L.x,y:Y*_.y+2*q*t*D.y+J*L.y}}let[o,i,r,s]=n,a=1-t,d=a*a,l=d*a,h=t*t,g=h*t;return{x:l*o.x+3*d*t*i.x+3*a*h*r.x+g*s.x,y:l*o.y+3*d*t*i.y+3*a*h*r.y+g*s.y}};var W1=(n,e)=>{if(n.length<2)return n[0]||{x:0,y:0};let t=[{t:0,length:0}],o=pa(n,0),i=0;for(let g=1;g<=100;g++){let _=g/100,D=pa(n,_);i+=Math.hypot(D.x-o.x,D.y-o.y),t.push({t:_,length:i}),o=D}let r=Ua(e,i),s=0,a=100;for(;s<a;){let g=s+a>>1;t[g].length<r?s=g+1:a=g}let d=t[Math.max(0,s-1)],l=t[s],h=l.length-d.length;return pa(n,d.t+(l.t-d.t)*(h>0?(r-d.length)/h:0))},y0=(n,e)=>{switch(n.side){case"right":default:return{x:n.x+e,y:n.y};case"left":return{x:n.x-e,y:n.y};case"bottom":return{x:n.x,y:n.y+e};case"top":return{x:n.x,y:n.y-e}}},G1=(n,e,t=100)=>{if(!n||!e)return[];let o=y0(n,Math.abs(t)),i=y0(e,Math.abs(t));return[{x:n.x,y:n.y},o,i,{x:e.x,y:e.y}]};var Hc=class{name="bezier";computePoints(e,t){let{sourcePoint:o,targetPoint:i}=e;return G1(o,i,t?.bezier?.bezierControlOffset??100)}computeSvgPath(e){return z1(e)}computePointOnPath(e,t){return pa(e,t)}computePointAtDistance(e,t){return W1(e,t)}},q1=(n=[],e=16)=>{if(n.length===0)return"";if(n.length===1)return`M ${n[0].x},${n[0].y}`;if(n.length===2)return`M ${n[0].x},${n[0].y} L ${n[1].x},${n[1].y}`;let t=n[0],o=n.slice(1,-1),i=n[n.length-1],r=o.map((s,a)=>{let d=n[a],l=n[a+2],h=l.y-d.y,g=Math.min(Math.abs(l.x-d.x)/2,Math.abs(h)/2,e),_=d.x<s.x,D=d.x>s.x,L=d.y>s.y,q=d.y<s.y,Y=l.x<s.x,J=l.x>s.x,fe=l.y>s.y,Ae=l.y<s.y,me=Math.abs(d.x-s.x)<=1,ze=Math.abs(d.y-s.y)<=1,Ee=Math.abs(l.x-s.x)<=1,$e=Math.abs(l.y-s.y)<=1;if(o.length<=2&&(me&&ze||Ee&&$e))return"";if(d.y===s.y&&s.y===l.y)return`L${s.x+(D?g:-g)},${s.y}`;if(d.x===s.x&&s.x===l.x)return`L${s.x},${s.y+(q?-g:g)}`;let zt=_&&fe||D&&Ae||q&&Y||L&&J;return d.x===s.x?`L${s.x},${s.y+(q?-g:g)} A${g},${g},0,0,${zt?1:0},${s.x+(J?g:-g)},${s.y}`:`L${s.x+(D?g:-g)},${s.y} A${g},${g},0,0,${zt?1:0},${s.x},${s.y+(Ae?-g:g)}`});return`M ${t.x},${t.y} ${r.join(" ")} L ${i.x},${i.y}`},oh=n=>{let e=[],t=0;for(let o=0;o<n.length-1;o++){let i=Math.hypot(n[o+1].x-n[o].x,n[o+1].y-n[o].y);e.push(i),t+=i}return{lengths:e,totalLength:t}},ih=(n,e,t)=>{let o=0;for(let i=0;i<e.length;i++){if(o+e[i]>=t){let r=e[i]>0?(t-o)/e[i]:0;return{x:n[i].x+(n[i+1].x-n[i].x)*r,y:n[i].y+(n[i+1].y-n[i].y)*r}}o+=e[i]}return n[n.length-1]},K1=(n,e)=>{if(n.length<2)return n[0]||{x:0,y:0};let{lengths:t,totalLength:o}=oh(n),i=Ua(e,o);return ih(n,t,i)},Y1=(n,e)=>{if(n.length<2)return{x:0,y:0};let t=lt.clamp({min:0,value:e,max:1}),o=[],i=0;for(let a=0;a<n.length-1;a++){let d=Math.hypot(n[a+1].x-n[a].x,n[a+1].y-n[a].y);o.push(d),i+=d}let r=i*t,s=0;for(let a=0;a<o.length;a++){let d=o[a];if(s+d>=r){let l=n[a],h=n[a+1],g=(r-s)/d;return{x:l.x+(h.x-l.x)*g,y:l.y+(h.y-l.y)*g}}s+=d}return n[n.length-1]},Zn=(n,e,t=20)=>{let o={left:{x:-t,y:0},right:{x:t,y:0},top:{x:0,y:-t},bottom:{x:0,y:t}}[e]||{x:0,y:0};return{x:n.x+o.x,y:n.y+o.y}},Z1=(n,e,t,o,i=20)=>{let r=Zn({x:e.x,y:e.y},"bottom",i),s=Zn({x:t.x,y:t.y},n,i);return n==="bottom"?r.y>s.y?[{x:r.x,y:r.y},{x:s.x,y:r.y}]:[{x:r.x,y:s.y},{x:s.x,y:s.y}]:n==="left"?r.y>s.y?r.x>s.x?[{x:r.x,y:r.y},{x:s.x,y:r.y},{x:s.x,y:s.y}]:[{x:r.x,y:r.y},{x:o.x,y:r.y},{x:o.x,y:s.y}]:r.x>s.x?[{x:r.x,y:o.y},{x:s.x,y:o.y},{x:s.x,y:s.y}]:[{x:r.x,y:s.y}]:n==="top"?r.y>s.y?[{x:r.x,y:r.y},{x:o.x,y:r.y},{x:o.x,y:s.y},{x:s.x,y:s.y}]:[{x:r.x,y:o.y},{x:s.x,y:o.y}]:n==="right"?r.y>s.y?r.x>s.x?[{x:r.x,y:r.y},{x:o.x,y:r.y},{x:o.x,y:s.y},{x:s.x,y:s.y}]:[{x:r.x,y:r.y},{x:s.x,y:r.y},{x:s.x,y:s.y}]:r.x>s.x?[{x:r.x,y:s.y}]:[{x:r.x,y:o.y},{x:s.x,y:o.y},{x:s.x,y:s.y}]:void 0},O0=(n,e,t,o,i=20)=>{let r=Zn({x:e.x,y:e.y},"left",i),s=Zn({x:t.x,y:t.y},n,i);return n==="left"?r.x>s.x?[{x:s.x,y:r.y},{x:s.x,y:s.y}]:[{x:r.x,y:r.y},{x:r.x,y:s.y}]:n==="top"?r.x>s.x?r.y>s.y?[{x:o.x,y:r.y},{x:o.x,y:s.y},{x:s.x,y:s.y}]:[{x:s.x,y:r.y}]:r.y>s.y?[{x:r.x,y:r.y},{x:r.x,y:s.y},{x:s.x,y:s.y}]:[{x:r.x,y:r.y},{x:r.x,y:o.y},{x:s.x,y:o.y}]:n==="bottom"?r.x>s.x?r.y>s.y?[{x:r.x,y:r.y},{x:s.x,y:r.y}]:[{x:o.x,y:r.y},{x:o.x,y:s.y},{x:s.x,y:s.y}]:r.y>s.y?[{x:r.x,y:r.y},{x:r.x,y:o.y},{x:s.x,y:o.y}]:[{x:r.x,y:r.y},{x:r.x,y:s.y},{x:s.x,y:s.y}]:n==="right"?r.x>s.x?[{x:o.x,y:r.y},{x:o.x,y:s.y}]:[{x:r.x,y:r.y},{x:r.x,y:o.y},{x:s.x,y:o.y},{x:s.x,y:s.y}]:void 0},X1=(n,e,t,o,i=20)=>{let r=Zn({x:e.x,y:e.y},"right",i),s=Zn({x:t.x,y:t.y},n,i);return n==="right"?r.x>s.x?[{x:r.x,y:r.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:s.x,y:s.y}]:n==="top"?r.x<s.x?r.y<s.y?[{x:s.x,y:r.y}]:[{x:o.x,y:r.y},{x:o.x,y:s.y},{x:s.x,y:s.y}]:r.y<s.y?[{x:r.x,y:r.y},{x:r.x,y:o.y},{x:s.x,y:o.y}]:[{x:r.x,y:r.y},{x:r.x,y:s.y},{x:s.x,y:s.y}]:n==="bottom"?r.x<s.x?r.y<s.y?[{x:o.x,y:r.y},{x:o.x,y:s.y},{x:s.x,y:s.y}]:[{x:s.x,y:r.y}]:r.y<s.y?[{x:r.x,y:r.y},{x:r.x,y:s.y},{x:s.x,y:s.y}]:[{x:r.x,y:r.y},{x:r.x,y:o.y},{x:s.x,y:o.y}]:n==="left"?r.x<s.x?[{x:o.x,y:r.y},{x:o.x,y:s.y}]:[{x:r.x,y:r.y},{x:r.x,y:o.y},{x:s.x,y:o.y},{x:s.x,y:s.y}]:void 0},Q1=(n,e,t,o,i=20)=>{let r=Zn(e,"top",i),s=Zn(t,n,i);return n==="left"?r.y>s.y?r.x>s.x?[{x:r.x,y:o.y},{x:s.x,y:o.y},{x:s.x,y:s.y}]:[{x:r.x,y:s.y}]:r.x>s.x?[{x:r.x,y:r.y},{x:s.x,y:r.y},{x:s.x,y:s.y}]:[{x:r.x,y:r.y},{x:o.x,y:r.y},{x:o.x,y:s.y}]:n==="right"?r.y>s.y?r.x>s.x?[{x:r.x,y:s.y}]:[{x:r.x,y:o.y},{x:s.x,y:o.y},{x:s.x,y:s.y}]:r.x>s.x?[{x:r.x,y:r.y},{x:o.x,y:r.y},{x:o.x,y:s.y}]:[{x:r.x,y:r.y},{x:s.x,y:r.y},{x:s.x,y:s.y}]:n==="bottom"?r.y>s.y?[{x:r.x,y:o.y},{x:s.x,y:o.y},{x:s.x,y:s.y}]:[{x:r.x,y:r.y},{x:o.x,y:r.y},{x:o.x,y:s.y},{x:s.x,y:s.y}]:n==="top"?r.y>s.y?[{x:r.x,y:s.y},{x:s.x,y:s.y}]:[{x:r.x,y:r.y},{x:s.x,y:r.y}]:void 0},J1={top:Q1,right:X1,bottom:Z1,left:O0},eS=(n,e,t,o=20)=>(J1[n.side]||O0)(e.side,{x:n.x,y:n.y},{x:e.x,y:e.y},t,o),tS=(n,e,t=20)=>{let o=eS(n,e,{x:(n?.x+e?.x)/2,y:(n.y+e.y)/2},t)||[];return[{x:n.x,y:n.y},...o,{x:e.x,y:e.y}]},Uc=class{name="orthogonal";computePoints(e,t){let{sourcePoint:o,targetPoint:i}=e,r=t?.orthogonal?.firstLastSegmentLength;return tS(o,i,r!=null&&r>=0?r:20)}computeSvgPath(e,t){let o=t?.orthogonal?.maxCornerRadius;return q1(e,o!=null&&o>=0?o:16)}computePointOnPath(e,t){return Y1(e,t)}computePointAtDistance(e,t){return K1(e,t)}},nS=(n,e)=>{if(n.length<2)return n[0]||{x:0,y:0};let{lengths:t,totalLength:o}=oh(n),i=Ua(e,o);return ih(n,t,i)},oS=(n,e)=>{if(n.length<2)return n[0]||{x:0,y:0};let t=lt.clamp({min:0,value:e,max:1});if(n.length===2){let a=n[0],d=n[1];return{x:a.x+(d.x-a.x)*t,y:a.y+(d.y-a.y)*t}}let o=0,i=[];for(let a=0;a<n.length-1;a++){let d=n[a+1].x-n[a].x,l=n[a+1].y-n[a].y,h=Math.sqrt(d*d+l*l);i.push(h),o+=h}let r=o*t,s=0;for(let a=0;a<i.length;a++){let d=i[a];if(s+d>=r){let l=(r-s)/d,h=n[a],g=n[a+1];return{x:h.x+(g.x-h.x)*l,y:h.y+(g.y-h.y)*l}}s+=d}return n[n.length-1]},Vc=class{name="polyline";computePoints(e){let{sourcePoint:t,targetPoint:o,edge:i}=e;return i.routingMode==="manual"&&i.points&&i.points.length>2?i.points:[{x:t.x,y:t.y},{x:o.x,y:o.y}]}computeSvgPath(e){return e.length===0?"":e.length===1?`M ${e[0].x},${e[0].y}`:e.map((t,o)=>o===0?`M ${t.x},${t.y}`:`L ${t.x},${t.y}`).join(" ")}computePointOnPath(e,t){return oS(e,t)}computePointAtDistance(e,t){return nS(e,t)}},iS=`[ngDiagram] Routing must have a non-empty name property. Registration skipped.
|
|
2
|
+
|
|
3
|
+
To fix this:
|
|
4
|
+
\u2022 Ensure your EdgeRouting implementation has a 'name' property
|
|
5
|
+
\u2022 The name should be a non-empty string
|
|
6
|
+
|
|
7
|
+
Documentation: https://www.ngdiagram.dev/docs/guides/edges/routing/
|
|
8
|
+
`,la=(n,e,t)=>`[ngDiagram] Routing '${n}' is not registered. Falling back to '${t}' routing.
|
|
9
|
+
|
|
10
|
+
Available routings: ${e.join(", ")}
|
|
11
|
+
|
|
12
|
+
To fix this:
|
|
13
|
+
\u2022 Register the routing using NgDiagramService.registerRouting()
|
|
14
|
+
\u2022 Or use one of the available routings listed above
|
|
15
|
+
|
|
16
|
+
Documentation: https://www.ngdiagram.dev/docs/guides/edges/routing/
|
|
17
|
+
`,rS=(n,e)=>`[ngDiagram] Cannot set default routing to '${n}': routing not registered. Default routing unchanged.
|
|
18
|
+
|
|
19
|
+
Available routings: ${e.join(", ")}
|
|
20
|
+
|
|
21
|
+
To fix this:
|
|
22
|
+
\u2022 First register the routing using NgDiagramService.registerRouting()
|
|
23
|
+
\u2022 Then set it as default
|
|
24
|
+
|
|
25
|
+
Documentation: https://www.ngdiagram.dev/docs/guides/edges/routing/
|
|
26
|
+
`;var jc=class{routings=new Map;defaultRouting;getRoutingConfig;constructor(e,t){this.defaultRouting=e||"orthogonal",this.getRoutingConfig=t||(()=>({})),this.registerRouting(new Uc),this.registerRouting(new Hc),this.registerRouting(new Vc)}registerRouting(e){e.name?this.routings.set(e.name,e):console.warn(iS)}unregisterRouting(e){this.routings.delete(e)}getRouting(e){return this.routings.get(e)}getRegisteredRoutings(){return Array.from(this.routings.keys())}hasRouting(e){return this.routings.has(e)}computePoints(e,t){let o=e||this.defaultRouting,i=this.routings.get(o);if(!i){let r=this.defaultRouting;if(console.warn(la(o,this.getRegisteredRoutings(),r)),i=this.routings.get(r),!i)return[t.sourcePoint,t.targetPoint].filter(s=>!!s)}return i.computePoints(t,this.getRoutingConfig())}computePath(e,t){let o=e||this.defaultRouting,i=this.routings.get(o);if(!i){let r=this.defaultRouting;if(console.warn(la(o,this.getRegisteredRoutings(),r)),i=this.routings.get(r),!i)return t.length===0?"":`M ${t[0].x},${t[0].y}`}return i.computeSvgPath(t,this.getRoutingConfig())}computePointOnPath(e,t,o){let i=e||this.defaultRouting,r=this.routings.get(i);if(!r){let d=this.defaultRouting;console.warn(la(i,this.getRegisteredRoutings(),d)),r=this.routings.get(d)}if(r?.computePointOnPath)return r.computePointOnPath(t,o);if(t.length<2)return t[0]||{x:0,y:0};let s=t[0],a=t[t.length-1];return{x:s.x+(a.x-s.x)*o,y:s.y+(a.y-s.y)*o}}computePointAtDistance(e,t,o){let i=e||this.defaultRouting,r=this.routings.get(i);if(!r){let s=this.defaultRouting;console.warn(la(i,this.getRegisteredRoutings(),s)),r=this.routings.get(s)}return r?.computePointAtDistance?r.computePointAtDistance(t,o):sS(t,o)}setDefaultRouting(e){this.routings.has(e)?this.defaultRouting=e:console.warn(rS(e,this.getRegisteredRoutings()))}getDefaultRouting(){return this.defaultRouting}},sS=(n,e)=>{if(n.length<2)return n[0]||{x:0,y:0};let{lengths:t,totalLength:o}=oh(n),i=Ua(e,o);return ih(n,t,i)},A0=(n,e,t,o)=>{if(typeof n=="string"){let i=n.trim();if(i.endsWith("px")){let r=parseFloat(i);return o.computePointAtDistance(e,t,r)}return o.computePointOnPath(e,t,parseFloat(i))}return o.computePointOnPath(e,t,n)},aS=(n,e,t)=>`[ngDiagram] Event listener error: Listener for "${n}" event threw an error.
|
|
27
|
+
|
|
28
|
+
Event: ${n}
|
|
29
|
+
Listener type: ${e}
|
|
30
|
+
Error: ${t instanceof Error?t.message:String(t)}
|
|
31
|
+
|
|
32
|
+
This indicates an error in your event listener callback.
|
|
33
|
+
Check your event listener implementation for the "${n}" event.
|
|
34
|
+
The diagram will continue to function, but this listener failed to execute.`,Wc=class{listeners=new Map;enabled=!0;deferredEmits=[];on(e,t){this.listeners.has(e)||this.listeners.set(e,new Set);let o={callback:t,once:!1};return this.listeners.get(e).add(o),()=>this.removeListener(e,o)}once(e,t){this.listeners.has(e)||this.listeners.set(e,new Set);let o={callback:t,once:!0};return this.listeners.get(e).add(o),()=>this.removeListener(e,o)}emit(e,t){if(!this.enabled)return;let o=this.listeners.get(e);if(!o||o.size===0)return;let i=[];for(let r of o)try{r.callback(t),r.once&&i.push(r)}catch(s){console.error(aS(String(e),r.once?"once":"on",s))}i.forEach(r=>{o.delete(r)})}deferredEmit(e,t){this.enabled&&this.deferredEmits.push({event:e,payload:t})}off(e,t){if(!t)return void this.listeners.delete(e);let o=this.listeners.get(e);if(!o)return;let i=Array.from(o).find(r=>r.callback===t);i&&o.delete(i)}offAll(){this.listeners.clear()}setEnabled(e){this.enabled=e}isEnabled(){return this.enabled}hasListeners(e){return this.listeners.has(e)&&this.listeners.get(e).size>0}flushDeferredEmits(){let e=[...this.deferredEmits];this.deferredEmits=[];for(let{event:t,payload:o}of e)this.emit(t,o)}clearDeferredEmits(){this.deferredEmits=[]}removeListener(e,t){let o=this.listeners.get(e);o&&(o.delete(t),o.size===0&&this.listeners.delete(e))}},dS=(o,i)=>A(null,[o,i],function*(n,{groupId:e,nodeIds:t}){let r=t.map(d=>n.flowCore.modelLookup.getNodeById(d)).filter(Boolean),s=n.flowCore.modelLookup.getNodeById(e);if(!s)return;let a=[];for(let d of r)n.flowCore.modelLookup.wouldCreateCircularDependency(d.id,e)||d.groupId!==e&&n.flowCore.config.grouping.canGroup(d,s)&&a.push({id:d.id,groupId:e});a.length>0&&(yield n.flowCore.commandHandler.emit("updateNodes",{nodes:a})),a.some(d=>!!d.groupId)&&n.flowCore.commandHandler.emit("highlightGroupClear")}),v0=(n,e,t)=>{if(!n)return"left";let o;if(e&&n.measuredPorts){let r=n.measuredPorts.find(s=>s.id===e);o=r?.position?{x:n.position.x+r.position.x+(r.size?.width??0)/2,y:n.position.y+r.position.y+(r.size?.height??0)/2}:{x:n.position.x+(n.size?.width??100)/2,y:n.position.y+(n.size?.height??50)/2}}else o={x:n.position.x+(n.size?.width??100)/2,y:n.position.y+(n.size?.height??50)/2};let i=lt.angleBetweenPoints(o,t);return lt.angleToSide(i,!0)};var L0=1e3/60;function rh(n,e){let t=p({},n);for(let o in e)if(Object.hasOwn(e,o)){let i=e[o],r=n[o];i!==void 0&&(t[o]=typeof i!="object"||i===null||Array.isArray(i)||typeof i=="function"||typeof r!="object"||r===null||Array.isArray(r)||typeof r=="function"?i:rh(r,i))}return t}var fa=(n,e)=>({x:n.x-e,y:n.y-e,width:2*e,height:2*e}),Gc=(n,e)=>n?.x===e?.x&&n?.y===e?.y&&n?.width===e?.width&&n?.height===e?.height,Tt=({position:n={x:0,y:0},size:e={width:1,height:1}})=>({x:n?.x||0,y:n?.y||0,width:e?.width||1,height:e?.height||1}),F0=(n,e)=>!(n.x+n.width<=e.x||e.x+e.width<=n.x||n.y+n.height<=e.y||e.y+e.height<=n.y),lS=(n,e)=>n.x<=e.x&&n.x+n.width>=e.x+e.width&&n.y<=e.y&&n.y+n.height>=e.y+e.height,qc=(n,e)=>{if(F0(n,e))return 0;let t=n.x+n.width,o=n.y+n.height,i=e.x+e.width,r=e.y+e.height;return t<=e.x?o<=e.y?Math.sqrt((t-e.x)**2+(o-e.y)**2):n.y>=r?Math.sqrt((t-e.x)**2+(n.y-r)**2):e.x-t:n.x>=i?o<=e.y?Math.sqrt((n.x-i)**2+(o-e.y)**2):n.y>=r?Math.sqrt((n.x-i)**2+(n.y-r)**2):n.x-i:o<=e.y?e.y-o:n.y>=r?n.y-r:1/0},yn=(n,e)=>n?.x===e?.x&&n?.y===e?.y,sh=(n,e)=>n?.width===e?.width&&n?.height===e?.height;var w0=n=>({left:n.x,top:n.y,right:n.x+n.width,bottom:n.y+n.height}),cS=(n,e)=>{if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(!yn(n[t],e[t]))return!1;return!0},_o=n=>{if(n.length===0)return{x:0,y:0,width:0,height:0};let e=n[0].x,t=n[0].y,o=n[0].x+n[0].width,i=n[0].y+n[0].height;return n.forEach(r=>{e=Math.min(e,r.x),t=Math.min(t,r.y),o=Math.max(o,r.x+r.width),i=Math.max(i,r.y+r.height)}),{x:e,y:t,width:o-e,height:i-t}},z0=n=>{if(n.length===0)return{x:0,y:0,width:0,height:0};let e=n[0].x,t=n[0].y,o=n[0].x,i=n[0].y;return n.forEach(r=>{e=Math.min(e,r.x),t=Math.min(t,r.y),o=Math.max(o,r.x),i=Math.max(i,r.y)}),{x:e,y:t,width:o-e,height:i-t}},Kc=(n,e=0)=>{let{x:t,y:o,width:i,height:r}=n,s=t+i/2,a=o+r/2,d=e*Math.PI/180,l=Math.cos(d),h=Math.sin(d);return[{x:t,y:o},{x:t+i,y:o},{x:t+i,y:o+r},{x:t,y:o+r}].map(({x:g,y:_})=>{let D=g-s,L=_-a;return{x:s+D*l-L*h,y:a+D*h+L*l}})},ah=(n,e=0)=>e===0?n:z0(Kc(n,e)),Fc=(n,e,t)=>{let o=Math.cos(t),i=Math.sin(t),r=n.x-e.x,s=n.y-e.y;return{x:e.x+r*o-s*i,y:e.y+r*i+s*o}},uS=(n,e,t,o)=>{let i=(n.x-e.x)*(t.y-o.y)-(n.y-e.y)*(t.x-o.x);if(Math.abs(i)<1e-10)return null;let r=((n.x-t.x)*(t.y-o.y)-(n.y-t.y)*(t.x-o.x))/i,s=-((n.x-e.x)*(n.y-t.y)-(n.y-e.y)*(n.x-t.x))/i;return r>=0&&r<=1&&s>=0&&s<=1?{x:n.x+r*(e.x-n.x),y:n.y+r*(e.y-n.y)}:null},pS=(n,e)=>{let t=e.y-n.y,o=-(e.x-n.x),i=Math.hypot(t,o);return i===0?{x:1,y:0}:{x:t/i,y:o/i}},b0=n=>Math.abs(n.x)>=Math.abs(n.y)?n.x>=0?"right":"left":n.y>=0?"bottom":"top",hS=(n,e)=>{let t=Tt({position:n.position,size:n.size}),o=(n.angle||0)*Math.PI/180,i={x:t.x+t.width/2,y:t.y+t.height/2};if(e.x===i.x&&e.y===i.y){let D=o!==0?Fc({x:t.x+t.width,y:i.y},i,o):{x:t.x+t.width,y:i.y},L=o!==0?Fc({x:1,y:0},{x:0,y:0},o):{x:1,y:0};return{x:D.x,y:D.y,side:b0(L)}}let r=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}],s=o!==0?r.map(D=>Fc(D,i,o)):r,a=1/0,d=null,l=null;for(let D=0;D<4;D++){let L=s[D],q=s[(D+1)%4],Y=uS(e,i,L,q);if(Y){let J=Math.hypot(Y.x-e.x,Y.y-e.y);J<a&&(a=J,d=L,l=q)}}if(!d||!l)return{x:i.x,y:i.y,side:"right"};let h=pS(d,l),g=b0(h),_={x:(d.x+l.x)/2,y:(d.y+l.y)/2};return{x:_.x,y:_.y,side:g}},$0=(n,e)=>{let t=Math.round(e/90)%4;return{top:["top","right","bottom","left"],right:["right","bottom","left","top"],bottom:["bottom","left","top","right"],left:["left","top","right","bottom"]}[n][t]},B0=(n,e)=>{let{x:t,y:o,width:i,height:r}=Tt(n),s=t+e.position.x,a=o+e.position.y,d=n.side;return e.angle&&e.angle!==0&&(d=$0(n.side,e.angle)),d==="left"?{x:s,y:a+r/2}:d==="top"?{x:s+i/2,y:a}:d==="bottom"?{x:s+i/2,y:a+r}:d==="right"?{x:s+i,y:a+r/2}:{x:s,y:a}},H0=(n,e)=>{let t=n.measuredPorts?.find(o=>o.id===e);return t?B0(t,n):null},U0=(n,e)=>{let t=n.measuredPorts?.find(r=>r.id===e);if(!t)return null;let o=B0(t,n),i=t.side;return n.angle&&n.angle!==0&&(i=$0(t.side,n.angle)),C(p({},o),{side:i})},fS=n=>_o(n.map(e=>e.measuredBounds).filter(e=>e!==void 0)),gS=n=>_o(n.map(mS)),dh=(n,e)=>{let t=fS(n),o=gS(e);return _o([t,o])},mS=n=>{let e=z0(n.points||[]),t=n.measuredLabels||[];if(t.length===0)return e;let o=t.filter(i=>i.position&&i.size).map(i=>({x:i.position.x-i.size.width/2,y:i.position.y-i.size.height/2,width:i.size.width,height:i.size.height}));return _o([e,...o])},mo=n=>{let e=n.measuredPorts||[],{x:t,y:o,width:i,height:r}=Tt(n),s=[ah({x:0,y:0,width:i,height:r},n.angle||0)];for(let d of e){let{x:l,y:h,width:g,height:_}=Tt(d);s.push({x:l,y:h,width:g,height:_})}let a=_o(s);return{x:t+a.x,y:o+a.y,width:a.width,height:a.height}},yS=(n,e,{useGroupRect:t=!0,allowResizeBelowChildrenBounds:o=!0}={})=>{if(!e.size?.width||!e.size?.height)throw new Error("Group must have both width and height defined");if(o)return{left:1/0,top:1/0,right:-1/0,bottom:-1/0};let i=w0(Tt(e));return n.length?n.reduce((r,s)=>{if(s.size&&(!s.size.width||!s.size.height))throw new Error(`calculateGroupBounds: child node ${s.id} does not have both width and height defined`);let a=w0(s.measuredBounds?s.measuredBounds:mo(s));return r.left=Math.min(r.left,a.left),r.top=Math.min(r.top,a.top),r.right=Math.max(r.right,a.right),r.bottom=Math.max(r.bottom,a.bottom),r},t?i:{left:1/0,top:1/0,right:-1/0,bottom:-1/0}):i};function yo(n){return n.isGroup===!0}var St=n=>(n?.width??0)>0&&(n?.height??0)>0,Ut=n=>n?.x!=null&&n?.y!=null&&!isNaN(n.x)&&!isNaN(n.y),Yc=class{permits;waiting=[];constructor(e){this.permits=e}acquire(){return A(this,null,function*(){return this.permits>0?(this.permits--,Promise.resolve()):new Promise(e=>{this.waiting.push(e)})})}release(){this.waiting.length>0?this.waiting.shift()():this.permits++}availablePermits(){return this.permits}getQueueLength(){return this.waiting.length}},Va=(n,e,t)=>{if(!n.snapping.shouldSnapDragForNode(e))return t;let o=n.snapping.computeSnapForNodeDrag(e)??n.snapping.defaultDragSnap;return lt.snapPoint(t,o)};function vS(n,e){let t=wS(e);return[...n].sort(t)}function wS(n){let e=new Map;return n.forEach((t,o)=>{e.set(t.id,o)}),(t,o)=>{let i=t.computedZIndex??0,r=o.computedZIndex??0;if(i!==r)return r-i;let s=e.get(t.id)??0;return(e.get(o.id)??0)-s}}var bS=(n,e)=>{let t=new Set(e.map(o=>o.id));return[...(n.measuredPorts??[]).filter(o=>!t.has(o.id)),...e]},CS=(n,e)=>{let t=new Map(e.map(({portId:o,portChanges:i})=>[o,i]));return n.map(o=>{let i=t.get(o.id);return i?p(p({},o),i):o})},_S=(n,e)=>{let t=new Set(e);return(n??[]).filter(o=>!t.has(o.id))},xS=(n,e)=>A(null,null,function*(){let{nodes:t}=e;yield n.flowCore.applyUpdate({nodesToAdd:t},"addNodes")}),SS=(n,e)=>A(null,null,function*(){let{node:t}=e,o=Va(n.flowCore.config,t,t.position);yield n.flowCore.applyUpdate({nodesToAdd:[C(p({},t),{position:o})]},"paletteDropNode")}),PS=(n,e)=>A(null,null,function*(){let{id:t,nodeChanges:o}=e;yield n.flowCore.applyUpdate({nodesToUpdate:[p({id:t},o)]},"updateNode")}),ES=(n,e)=>A(null,null,function*(){let{nodes:t}=e;yield n.flowCore.applyUpdate({nodesToUpdate:t},"updateNodes")}),IS=(n,e)=>A(null,null,function*(){let{edges:t}=n.flowCore.getState(),{ids:o}=e,i=new Set,r=new Set(o);t.forEach(s=>{(r.has(s.source)||r.has(s.target))&&i.add(s.id)}),yield n.flowCore.applyUpdate({nodesToRemove:Array.from(r),edgesToRemove:i.size>0?Array.from(i):[]},"deleteNodes")}),kS=n=>A(null,null,function*(){let{edges:e,nodes:t}=n.flowCore.getState();yield n.flowCore.applyUpdate({nodesToRemove:t.map(o=>o.id),edgesToRemove:e.map(o=>o.id)},"clearModel")}),DS=(n,e)=>A(null,null,function*(){let{edges:t}=e;yield n.flowCore.applyUpdate({edgesToAdd:t},"addEdges")}),TS=(n,e)=>A(null,null,function*(){let{id:t,edgeChanges:o}=e;yield n.flowCore.applyUpdate({edgesToUpdate:[p({id:t},o)]},"updateEdge")}),MS=(n,e)=>A(null,null,function*(){let{edges:t}=e;yield n.flowCore.applyUpdate({edgesToUpdate:t},"updateEdges")}),RS=(n,e)=>A(null,null,function*(){let{ids:t}=e;yield n.flowCore.applyUpdate({edgesToRemove:t},"deleteEdges")}),NS=(n,e)=>A(null,null,function*(){let{additions:t}=e,o=[];t.forEach((i,r)=>{let s=n.flowCore.getNodeById(r);s&&o.push({id:r,measuredPorts:bS(s,i)})}),o.length!==0&&(yield n.flowCore.applyUpdate({nodesToUpdate:o},"addPortsBulk"))}),OS=(n,e)=>A(null,null,function*(){let{updates:t}=e,o=[];t.forEach((i,r)=>{let s=n.flowCore.getNodeById(r);s&&s.measuredPorts&&o.push({id:r,measuredPorts:CS(s.measuredPorts,i)})}),o.length!==0&&(yield n.flowCore.applyUpdate({nodesToUpdate:o},"updatePortsBulk"))}),AS=(n,e)=>A(null,null,function*(){let{deletions:t}=e,o=[];t.forEach((i,r)=>{let s=n.flowCore.getNodeById(r);s&&o.push({id:r,measuredPorts:_S(s.measuredPorts,i)})}),o.length!==0&&(yield n.flowCore.applyUpdate({nodesToUpdate:o},"deletePortsBulk"))}),LS=(n,e)=>A(null,null,function*(){let{additions:t}=e,o=[];t.forEach((i,r)=>{let s=n.flowCore.getEdgeById(r);if(!s)return;let a=[...s.measuredLabels??[],...i];o.push({id:r,measuredLabels:a})}),o.length!==0&&(yield n.flowCore.applyUpdate({edgesToUpdate:o},"addEdgeLabelsBulk"))}),FS=(n,e)=>A(null,null,function*(){let{updates:t}=e,o=[],i=n.flowCore.edgeRoutingManager;t.forEach((r,s)=>{let a=n.flowCore.getEdgeById(s);if(!a)return;let d=a.points||[],l=new Map;r.forEach(({labelId:D,labelChanges:L})=>{l.set(D,L)});let h=d.length>=2,g=(D,L)=>h?A0(D,a.routing,d,i):L,_=a.measuredLabels?.map(D=>{let L=l.get(D.id);if(!L)return h?C(p({},D),{position:g(D.positionOnEdge,D.position)}):D;let q=L.positionOnEdge??D.positionOnEdge;return C(p(p({},D),L),{position:g(q,D.position)})});_&&o.push({id:s,measuredLabels:_})}),o.length!==0&&(yield n.flowCore.applyUpdate({edgesToUpdate:o},"updateEdgeLabelsBulk"))}),zS=(n,e)=>A(null,null,function*(){let{deletions:t}=e,o=[];t.forEach((i,r)=>{let s=n.flowCore.getEdgeById(r);if(!s)return;let a=new Set(i),d=s.measuredLabels?.filter(l=>!a.has(l.id));o.push({id:r,measuredLabels:d})}),o.length!==0&&(yield n.flowCore.applyUpdate({edgesToUpdate:o},"deleteEdgeLabelsBulk"))}),V0=({x:n,y:e,width:t,height:o},i)=>!t||!o||t<0||o<0?null:i.width&&i.height?{x:i.width/2-(n+t/2)*i.scale,y:i.height/2-(e+o/2)*i.scale}:null,$S=(t,o)=>A(null,[t,o],function*(n,{rect:e}){let{viewport:i}=n.flowCore.getState().metadata,r=V0(e,i);if(r){if(yn(i,{x:r.x,y:r.y}))return;yield n.flowCore.applyUpdate({metadataUpdate:{viewport:C(p({},i),{x:r.x,y:r.y})}},"centerOnRect")}}),BS=(t,o)=>A(null,[t,o],function*(n,{nodeOrId:e}){let i=typeof e=="string"?n.flowCore.getNodeById(e):e,{viewport:r}=n.flowCore.getState().metadata;if(!i||!i.size?.width||!i.size?.height)return;let s=V0({x:i.position.x,y:i.position.y,width:i.size.width,height:i.size.height},r);if(s){if(yn(r,{x:s.x,y:s.y}))return;yield n.flowCore.applyUpdate({metadataUpdate:{viewport:C(p({},r),{x:s.x,y:s.y})}},"centerOnNode")}});var HS=n=>n.length===0?{x:0,y:0}:{x:n.reduce((e,t)=>e+t.position.x,0)/n.length,y:n.reduce((e,t)=>e+t.position.y,0)/n.length},US=(n,e)=>{let t=HS(n);if(!e.position)return{x:20,y:20};if(n.length===1){let o=n[0];return{x:e.position.x-(o.size?.width??0)/2-o.position.x,y:e.position.y-(o.size?.height??0)/2-o.position.y}}return{x:e.position.x-t.x,y:e.position.y-t.y}},VS=n=>{if(!n.measuredPorts||n.measuredPorts.length===0)return n;let e=n.measuredPorts.map(t=>C(p({},t),{nodeId:n.id}));return C(p({},n),{measuredPorts:e})},jS=(n,e,t,o)=>(e.forEach(i=>{let r=n.computeNodeId();o.set(i.id,r)}),e.map(i=>{let r=o.get(i.id),s=i.groupId?o.get(i.groupId):void 0,a=C(p({},i),{id:r,groupId:s,position:{x:i.position.x+t.x,y:i.position.y+t.y},selected:!0});return a=VS(a),a})),WS=(n,e,t)=>e.map(o=>{let i=n.computeEdgeId();return C(p({},o),{id:i,source:t.get(o.source)||o.source,target:t.get(o.target)||o.target,selected:!0})}),GS=(n,e)=>{let t=[],o=[];return n.forEach(i=>{i.selected&&t.push({id:i.id,selected:!1})}),e.forEach(i=>{i.selected&&o.push({id:i.id,selected:!1})}),{nodesToUpdate:t,edgesToUpdate:o}},j0=n=>A(null,null,function*(){let{nodes:e,edges:t}=n.flowCore.getState(),o=e.filter(r=>r.selected),i=t.filter(r=>r.selected);n.flowCore.actionStateManager.copyPaste={copiedNodes:o,copiedEdges:i}}),qS=(n,e)=>{for(let t of n)t.position=Va(e,t,t.position)},KS=(n,e)=>A(null,null,function*(){let t=n.flowCore.actionStateManager.copyPaste;if(!t||t.copiedNodes.length===0&&t.copiedEdges.length===0)return;let{nodes:o,edges:i}=n.flowCore.getState(),r=new Map,s=US(t.copiedNodes,e),a=jS(n.flowCore.config,t.copiedNodes,s,r);qS(a,n.flowCore.config);let d=WS(n.flowCore.config,t.copiedEdges,r),{nodesToUpdate:l,edgesToUpdate:h}=GS(o,i);n.flowCore.actionStateManager.selection={selectionChanged:!0},yield n.flowCore.applyUpdate({nodesToAdd:a,edgesToAdd:d,nodesToUpdate:l,edgesToUpdate:h},"paste"),yield n.flowCore.applyUpdate({},"selectEnd")}),YS=({edges:n,nodesToDeleteIds:e})=>{let t=new Set(e);return n.filter(o=>o.selected||t.has(o.source)||t.has(o.target)).map(o=>o.id)},W0=n=>A(null,null,function*(){let{nodes:e,edges:t}=n.flowCore.getState(),o=e.some(a=>a.selected),i=t.some(a=>a.selected);if(!o&&!i)return;let r=o?n.flowCore.modelLookup.getSelectedNodesWithChildren({directOnly:!1}).map(a=>a.id):[],s=YS({edges:t,nodesToDeleteIds:r});r.length===0&&s.length===0||(yield n.flowCore.applyUpdate({nodesToRemove:r,edgesToRemove:s},"deleteSelection"))}),ZS=n=>A(null,null,function*(){yield j0(n),yield W0(n)}),XS=(o,i)=>A(null,[o,i],function*(n,{groupId:e,nodes:t}){let r=n.flowCore.actionStateManager.highlightGroup,s=r?.highlightedGroupId;if(s===e)return;let a=n.flowCore.modelLookup.getNodeById(e);if(!a||!t.some(l=>n.flowCore.config.grouping.canGroup(l,a)))return;let d=[{id:e,highlighted:!0}];s&&d.push({id:s,highlighted:!1}),n.flowCore.actionStateManager.highlightGroup={highlightedGroupId:e},yield n.flowCore.applyUpdate({nodesToUpdate:d},"highlightGroup")}),QS=n=>A(null,null,function*(){let e=n.flowCore.actionStateManager.highlightGroup,t=e?.highlightedGroupId;t&&(yield n.flowCore.applyUpdate({nodesToUpdate:[{id:t,highlighted:!1}]},"highlightGroupClear"),n.flowCore.actionStateManager.clearHighlightGroup())}),JS=(n,e)=>A(null,null,function*(){yield n.flowCore.applyUpdate({renderedNodeIds:e.renderedNodeIds,renderedEdgeIds:e.renderedEdgeIds},"init")}),G0=(n,e,t)=>{let o=C(p(p({},e),t),{temporary:!1});return n.linking.finalEdgeDataBuilder(C(p({},o),{id:n.computeEdgeId()}))},eP=(n,e,t)=>!!(n.type!=="source"&&(e&&n.nodeId!==e||t&&n.id!==t)),q0=(n,e,t,o,i,r)=>{let s=e?n.getNodeById(e):null,a=o?n.getNodeById(o):null,d=t?s?.measuredPorts?.find(h=>h.id===t)??null:null,l=i?a?.measuredPorts?.find(h=>h.id===i)??null:null;return!(r||!d||l)||n.config.linking.validateConnection(s,d,a,l)},Pr=(n,e)=>n.linking.temporaryEdgeDataBuilder(C(p({id:"TEMPORARY_EDGE",data:{},temporary:!0},e),{source:e.source||"",target:e.target||"",targetArrowhead:e.targetArrowhead||"ng-diagram-arrow"})),ca=n=>A(null,null,function*(){yield n.flowCore.applyUpdate({},"finishLinking"),n.flowCore.actionStateManager.clearLinking()}),tP=(n,e,t)=>{let o=e&&n.flowCore.getNodeById(e);if(!o)return{isValid:!1,targetNode:null,targetPosition:null};if(t&&o.measuredPorts?.find(r=>r.id===t)?.type==="source")return{isValid:!1,targetNode:o,targetPosition:null};let i=e&&t?H0(o,t):o.position;return i?{isValid:!0,targetNode:o,targetPosition:i}:{isValid:!1,targetNode:o,targetPosition:null}},nP=(n,e)=>A(null,null,function*(){let t=n.flowCore.actionStateManager.linking,o=t?.temporaryEdge;if(!t)return;if(!o)return void(yield ca(n));t.dropPosition=e.position??{x:0,y:0};let{source:i,sourcePort:r,target:s,targetPort:a}=o,d=s||void 0,l=a||void 0;if(!d)return t.cancelReason="noTarget",void(yield ca(n));if(!q0(n.flowCore,i,r,d,l,!0))return t.cancelReason="invalidConnection",void(yield ca(n));let{isValid:h,targetPosition:g}=tP(n,d,l);if(!h)return t.cancelReason="invalidTarget",void(yield ca(n));yield n.flowCore.applyUpdate({edgesToAdd:[G0(n.flowCore.config,o,{target:d,targetPort:l,targetPosition:g||void 0})]},"finishLinking"),n.flowCore.actionStateManager.clearLinking()}),oP=(n,e)=>A(null,null,function*(){let t=n.flowCore.actionStateManager.linking,o=t?.temporaryEdge,{position:i}=e;t&&(o&&(t.dropPosition=i,yield n.flowCore.applyUpdate({edgesToAdd:[G0(n.flowCore.config,o,{target:"",targetPort:"",targetPosition:i})]},"finishLinking")),n.flowCore.actionStateManager.clearLinking())}),iP=(n,e,t)=>{let o=n.flowCore.getNearestPortInRange(e,n.flowCore.config.linking.portSnapDistance),i=o&&eP(o,t.source,t.sourcePort);return{targetNodeId:i?o.nodeId:"",targetPortId:i?o.id:"",isValid:!!i}},rP=(n,e,t,o)=>{let{targetNodeId:i,targetPortId:r}=t,s=e.source||"",a=e.sourcePort||"",d=()=>Pr(n.flowCore.config,{source:s,sourcePort:a,target:"",targetPort:"",targetPosition:o});if(!i)return d();let l=n.flowCore.getNodeById(i);return l&&q0(n.flowCore,e.source,e.sourcePort,i,r)?r&&l.measuredPorts?.find(h=>h.id===r)?Pr(n.flowCore.config,{source:s,sourcePort:a,target:i,targetPort:r,targetPosition:o}):Pr(n.flowCore.config,{source:s,sourcePort:a,target:i,targetPort:"",targetPosition:o}):d()},sP=(n,e,t)=>e===n.target&&t===n.targetPort,aP=(n,e)=>A(null,null,function*(){let{position:t}=e,o=n.flowCore.actionStateManager.linking?.temporaryEdge;if(!n.flowCore.actionStateManager.linking||!o)return;let i=iP(n,t,o);if(i.targetNodeId&&sP(o,i.targetNodeId,i.targetPortId))return;let r=rP(n,o,i,t);n.flowCore.actionStateManager.linking=C(p({},n.flowCore.actionStateManager.linking),{temporaryEdge:r}),yield n.flowCore.applyUpdate({},"moveTemporaryEdge")}),dP=(n,e)=>A(null,null,function*(){let{source:t,sourcePort:o}=e,i=n.flowCore.getNodeById(t);if(!i||o&&i.measuredPorts?.find(a=>a.id===o)?.type==="target")return;let r=o?H0(i,o):i.position;if(!r)return;let s=Pr(n.flowCore.config,{source:t,sourcePort:o,sourcePosition:r,target:"",targetPosition:r});n.flowCore.actionStateManager.linking={temporaryEdge:s,sourceNodeId:t,sourcePortId:o??""},yield n.flowCore.applyUpdate({},"startLinking")}),lP=(n,e)=>A(null,null,function*(){let{position:t}=e,o=Pr(n.flowCore.config,{source:"",sourcePosition:t,target:"",targetPosition:t});n.flowCore.actionStateManager.linking={sourceNodeId:"",sourcePortId:"",temporaryEdge:o},yield n.flowCore.applyUpdate({},"startLinkingFromPosition")}),cP=(o,i)=>A(null,[o,i],function*(n,{delta:e,nodes:t}){let r=new Set(t.map(l=>l.id)),s=t.filter(l=>!l.groupId||!r.has(l.groupId)),a=n.flowCore.actionStateManager?.dragging?.accumulatedDeltas,d=uP(n,s,r,e,a);d.length!==0&&(yield n.flowCore.applyUpdate({nodesToUpdate:d},"moveNodesBy"))}),uP=(n,e,t,o,i)=>{let r=[],s=new Set;return e.forEach(a=>{let{snappedPosition:d,actualDelta:l}=pP(n,a,o,i);yn(a.position,d)||r.push({id:a.id,position:d}),s.add(a.id),hP(n,a.id,l,t,s,r)}),r},pP=(n,e,t,o)=>{let{snappedPosition:i,newAccumulated:r}=fP(n,e,t,o);return o&&o.set(e.id,r),{snappedPosition:i,actualDelta:{x:i.x-e.position.x,y:i.y-e.position.y}}},hP=(n,e,t,o,i,r)=>{n.flowCore.modelLookup.getAllDescendants(e).forEach(s=>{if(o.has(s.id)&&!i.has(s.id)){let a={x:s.position.x+t.x,y:s.position.y+t.y};yn(s.position,a)||r.push({id:s.id,position:a}),i.add(s.id)}})},fP=(n,e,t,o)=>{let i=o?.get(e.id)??{x:0,y:0},r=i.x+t.x,s=i.y+t.y,a=Va(n.flowCore.config,e,{x:e.position.x+r,y:e.position.y+s});return{snappedPosition:a,newAccumulated:{x:r-(a.x-e.position.x),y:s-(a.y-e.position.y)}}},gP=n=>A(null,null,function*(){yield n.flowCore.applyUpdate({},"moveNodesStart")}),mP=n=>A(null,null,function*(){yield n.flowCore.applyUpdate({},"moveNodesStop")}),yP=(o,i)=>A(null,[o,i],function*(n,{x:e,y:t}){let{metadata:r}=n.flowCore.getState();(e||t)&&(n.flowCore.actionStateManager.isPanning()?n.flowCore.applyViewportOnlyUpdate({x:r.viewport.x+e,y:r.viewport.y+t}):yield n.flowCore.applyUpdate({metadataUpdate:{viewport:C(p({},r.viewport),{x:r.viewport.x+e,y:r.viewport.y+t})}},"moveViewport"))}),vP=(n,e)=>A(null,null,function*(){let{x:t,y:o}=e,{metadata:i}=n.flowCore.getState();yn(i.viewport,{x:t,y:o})||(yield n.flowCore.applyUpdate({metadataUpdate:{viewport:C(p({},i.viewport),{x:t,y:o})}},"moveViewport"))}),wP=(o,i)=>A(null,[o,i],function*(n,{groupId:e,nodeIds:t}){let r=t.map(a=>n.flowCore.modelLookup.getNodeById(a)).filter(Boolean);if(!n.flowCore.modelLookup.getNodeById(e))return;let s=[];for(let a of r)a.groupId===e&&s.push({id:a.id,groupId:void 0});s.length>0&&(yield n.flowCore.commandHandler.emit("updateNodes",{nodes:s}))}),bP=n=>`[ngDiagram] Resize node failed: Node not found.
|
|
35
|
+
|
|
36
|
+
Node ID: ${n}
|
|
37
|
+
|
|
38
|
+
This may occur if the node was deleted before the resize command executed.
|
|
39
|
+
|
|
40
|
+
Documentation: https://www.ngdiagram.dev/docs/guides/nodes/nodes/`,K0=(n,e,t,o,i)=>{let r=n.resize.getMinNodeSize(e),s=Math.max(t.width,r.width),a=Math.max(t.height,r.height);if(!o)return{size:{width:s,height:a},position:o};let d=o.x,l=o.y;return s!==t.width&&o.x>i.x&&(d=o.x-(s-t.width)),a!==t.height&&o.y>i.y&&(l=o.y-(a-t.height)),{size:{width:s,height:a},position:{x:d,y:l}}},CP=(n,e,t,o)=>{let i={left:e?.x??t.x,top:e?.y??t.y,right:(e?.x??t.x)+n.width,bottom:(e?.y??t.y)+n.height},r={left:Math.min(i.left,o.left),top:Math.min(i.top,o.top),right:Math.max(i.right,o.right),bottom:Math.max(i.bottom,o.bottom)};return{size:{width:r.right-r.left,height:r.bottom-r.top},position:{x:r.left,y:r.top}}},_P=(n,e)=>A(null,null,function*(){let t=n.flowCore.getNodeById(e.id);t?t.size||!e.size?e.size&&(sh(t.size,e.size)||yo(t)&&!t.selected||(yo(t)?yield xP(n,e,t):yield Y0(n,e))):yield SP(n,e):console.error(bP(e.id))}),xP=(n,e,t)=>A(null,null,function*(){let o=n.flowCore.modelLookup.getNodeChildren(e.id,{directOnly:!1});if(o.length===0)return void(yield Y0(n,e));let i=yS(o,t,{useGroupRect:!1,allowResizeBelowChildrenBounds:n.flowCore.config.resize.allowResizeBelowChildrenBounds}),{size:r,position:s}=K0(n.flowCore.config,t,e.size,e.position,t.position),{size:a,position:d}=CP(r,s,t.position,i);yield Z0(n,t,d,a,!0)}),Y0=(n,e)=>A(null,null,function*(){let t=n.flowCore.getNodeById(e.id);if(!t)return;let{size:o,position:i}=K0(n.flowCore.config,t,e.size,e.position,t.position);yield Z0(n,t,i,o,e.disableAutoSize)}),SP=(n,e)=>A(null,null,function*(){n.flowCore.getNodeById(e.id)&&(yield n.emit("updateNode",{id:e.id,nodeChanges:{size:e.size}}))}),Z0=(n,e,t,o,i)=>A(null,null,function*(){if(!n.flowCore.config.snapping.shouldSnapResizeForNode(e)){let r=p({id:e.id,size:o},i!==void 0&&{autoSize:!i});return t&&(r.position=t),yield n.flowCore.applyUpdate({nodesToUpdate:[r]},"resizeNode")}return yield EP(n,e,t,o,i)}),PP=(n,e,t,o,i)=>{let r=n.size?.width??0,s=n.size?.height??0,a=t?.width??r,d=t?.height??s,l=e&&n.position.y!==e.y,h=a,g=d;return r!==a&&(h=o&&e&&n.position.x!==e.x?Math.round(n.position.x+r)-o.x:lt.snapNumber(a,i.width)),s!==d&&(g=o&&l?Math.max(Math.round(n.position.y+s)-o.y,0):lt.snapNumber(d,i.height)),{width:h,height:g}},EP=(n,e,t,o,i)=>A(null,null,function*(){let{computeSnapForNodeSize:r,defaultResizeSnap:s}=n.flowCore.config.snapping,a=r(e)??s,d=t&<.snapPoint(t,a),{width:l,height:h}=PP(e,t,o,d,a),g=p({id:e.id,size:{width:l,height:h}},i!==void 0&&{autoSize:!i});d&&(g.position=d),yield n.flowCore.applyUpdate({nodesToUpdate:[g]},"resizeNode")}),IP=n=>A(null,null,function*(){yield n.flowCore.applyUpdate({},"resizeNodeStart")}),kP=n=>A(null,null,function*(){yield n.flowCore.applyUpdate({},"resizeNodeStop")}),DP=[0,90,180,270];var TP=n=>{let e=lt.normalizeAngle(n);for(let t of DP){let o=Math.abs(e-t);if(Math.min(o,360-o)<=2)return t}return e},MP=(o,i)=>A(null,[o,i],function*(n,{nodeId:e,angle:t}){let r=n.flowCore.getNodeById(e);if(!r)return;let s=r.angle??0;if(s===t)return;let{shouldSnapForNode:a,computeSnapAngleForNode:d,defaultSnapAngle:l}=n.flowCore.config.nodeRotation,h=lt.normalizeAngle(t),g=h;if(a(r)){let _=d(r)??l;if(g=lt.snapAngle(h,_),g===s)return}else if(g=TP(g),g===s)return;yield n.flowCore.applyUpdate({nodesToUpdate:[{id:e,angle:g}]},"rotateNodeTo")}),RP=n=>A(null,null,function*(){yield n.flowCore.applyUpdate({},"rotateNodeStart")}),NP=n=>A(null,null,function*(){yield n.flowCore.applyUpdate({},"rotateNodeStop")}),ja=(n,e,t,o=!1)=>{let i=[],r=[],s=new Set(e),a=new Set(t);for(let d of n.nodesMap.values()){let l=s.has(d.id);!!d.selected===l||o&&d.selected||i.push({id:d.id,selected:l})}for(let d of n.edgesMap.values()){let l=a.has(d.id);!!d.selected===l||o&&d.selected||r.push({id:d.id,selected:l})}return{nodesToUpdate:i,edgesToUpdate:r}},Wa=(o,i)=>A(null,[o,i],function*(n,{nodesToUpdate:e,edgesToUpdate:t}){e?.length===0&&t?.length===0||(n.flowCore.actionStateManager.selection={selectionChanged:!0},yield n.flowCore.applyUpdate({nodesToUpdate:e,edgesToUpdate:t},"changeSelection"))}),OP=(i,r)=>A(null,[i,r],function*(n,{nodeIds:e,edgeIds:t,multiSelection:o=!1}){let{modelLookup:s}=n.flowCore,a=ja(s,e??[],t??[],o);yield Wa(n,a)}),AP=(o,i)=>A(null,[o,i],function*(n,{nodeIds:e,edgeIds:t}){let{modelLookup:r}=n.flowCore,s=new Set(e),a=new Set(t),d=[];for(let g of r.nodesMap.values())!s.has(g.id)&&g.selected&&d.push(g.id);let l=[];for(let g of r.edgesMap.values())!a.has(g.id)&&g.selected&&l.push(g.id);let h=ja(r,d,l);yield Wa(n,h)}),LP=n=>A(null,null,function*(){let{modelLookup:e}=n.flowCore,t=ja(e,[],[]);yield Wa(n,t)}),FP=n=>A(null,null,function*(){yield n.flowCore.applyUpdate({},"selectEnd")}),zP=n=>A(null,null,function*(){let{modelLookup:e}=n.flowCore,t=Array.from(e.nodesMap.keys()),o=Array.from(e.edgesMap.keys()),i=ja(e,t,o);yield Wa(n,i)});function Ga(n){let e=new Map;for(let t of n.values())t.groupId!=null&&(e.has(t.groupId)||e.set(t.groupId,[]),e.get(t.groupId).push(t));return e}function X0(n,e=!1){return[...n].sort((t,o)=>{if(!e){let i=t.selected?1:0,r=o.selected?1:0;if(i!==r)return i-r}return(t.zOrder??0)-(o.zOrder??0)})}function $P(n,e,t,o=!1){let i=[],r=new Set;function s(a){if(r.has(a)||(r.add(a),!e.get(a)))return;i.push(a);let d=t.get(a);if(d)for(let l of X0(d,o))s(l.id)}for(let a of n)s(a);return i}function Q0(n,e,t,o,i){let r=[],s=new Map,a=i?.skipRoot?n.id:void 0;return J0(n,e,t,o,(d,l,h)=>{d.id!==a&&(r.push(C(p({},d),{computedZIndex:l})),s.set(d.id,h))},!1,i?.initialCumulativeElevation??0),{nodes:r,elevations:s}}function BP(n,e,t,o){let i=new Map;return J0(n,e,t,o,(r,s)=>{i.set(r.id,s)},!0),i}function J0(n,e,t,o,i,r=!1,s=0){let a=!r&&o?.elevateOnSelection?o.selectedZIndex:0,d=new Set;(function l(h,g,_){if(d.has(h.id))return;d.add(h.id);let D=h.groupId!=null?Math.max(h.zOrder??g,g):h.zOrder??g;if(h.selected&&a>0&&(_+=a),i(h,D+_,_),yo(h)){let L=D;for(let q of X0(e.get(h.id)||[],r))L+=1,l(q,L,_)}})(n,t,s)}function HP(n,e,t){let o=Array.from(n.values()).filter(a=>a.groupId==null),i=t??Ga(n),r=[],s=new Map;for(let a of o){let d=Q0(a,i,0,e);r.push(...d.nodes);for(let[l,h]of d.elevations)s.set(l,h)}return{nodes:r,elevations:s}}function UP(n,e,t){let o=Array.from(n.values()).filter(s=>s.groupId==null),i=e??Ga(n),r=new Map;for(let s of o)for(let[a,d]of BP(s,i,0,t))r.set(a,d);return r}function VP(n,e){let t=new Set(n),o=[...n];for(;o.length>0;)for(let i of e.get(o.pop())??[])t.has(i.id)||(t.add(i.id),o.push(i.id));return t}function jP(n,e){let t=new Set(n);return n.filter(o=>{let i=new Set,r=e.get(o)?.groupId;for(;r!=null&&!i.has(r);){if(t.has(r))return!1;i.add(r),r=e.get(r)?.groupId}return!0})}function WP(n,e){let t=[],o=new Set,i=e.get(n);for(;i?.groupId!=null&&!o.has(i.groupId);)o.add(i.groupId),t.push(i.groupId),i=e.get(i.groupId);return t}function GP(n,e,t,o,i){let r=0;for(let[s,a]of n)o.has(s)||(r=t?Math.max(r,a):Math.min(r,a));for(let s of e){if(i.has(s.id))continue;let a=s.zOrder??0;r=t?Math.max(r,a):Math.min(r,a)}return t?r+1:r-1}function qP(n,e,t){return t.nodeIds||t.edgeIds?{nodeIds:t.nodeIds??[],edgeIds:t.edgeIds??[]}:{nodeIds:n.filter(o=>o.selected).map(o=>o.id),edgeIds:e.filter(o=>o.selected).map(o=>o.id)}}var ey=(n,e)=>A(null,null,function*(){let{nodes:t,edges:o}=n.flowCore.getState(),{nodeIds:i,edgeIds:r}=qP(t,o,e);if(i.length===0&&r.length===0)return;let s=new Map(t.map(q=>[q.id,q])),a=Ga(s),d=UP(s,a,n.flowCore.config.zIndex),l=jP(i,s),h=VP(l,a),g=new Set(r),_=e.name==="bringToFront",D=GP(d,o,_,h,g),L=[];if(_)for(let q of l){let Y=$P([q],s,a,!0),J=D;for(let fe of Y)L.push({id:fe,zOrder:J}),J+=1}else{let q=new Map;for(let Y of i){L.push({id:Y,zOrder:D});let J=WP(Y,s),fe=D;for(let Ae of J){fe-=1;let me=q.get(Ae);(me==null||fe<me)&&q.set(Ae,fe)}}for(let[Y,J]of q)L.push({id:Y,zOrder:J})}yield n.flowCore.applyUpdate({nodesToUpdate:L,edgesToUpdate:r.map(q=>({id:q,zOrder:D}))},"changeZOrder")}),KP=(n,e)=>A(null,null,function*(){yield ey(n,e)}),YP=(n,e)=>A(null,null,function*(){yield ey(n,e)}),ZP=n=>`[ngDiagram] Invalid zoom scale: ${n}
|
|
41
|
+
|
|
42
|
+
Scale must be a positive finite number.
|
|
43
|
+
|
|
44
|
+
Documentation: https://www.ngdiagram.dev/docs/intro/coordinate-system/#viewport-and-scaling`,XP=(i,r)=>A(null,[i,r],function*(n,{x:e,y:t,scale:o}){let{metadata:s}=n.flowCore.getState();if(o<=0||!isFinite(o)||isNaN(o))return void console.error(ZP(o));let{min:a,max:d}=n.flowCore.config.zoom;o<a||o>d?console.warn(`Zoom scale ${o} is out of bounds [${a}, ${d}]`):e===s.viewport.x&&t===s.viewport.y&&o===s.viewport.scale||(yield n.flowCore.applyUpdate({metadataUpdate:{viewport:C(p({},s.viewport),{x:e,y:t,scale:o})}},"zoom"))}),QP=n=>`[ngDiagram] Invalid scale calculated in zoom-to-fit: ${n}
|
|
45
|
+
|
|
46
|
+
Scale must be a positive finite number.
|
|
47
|
+
|
|
48
|
+
Documentation: https://www.ngdiagram.dev/docs/intro/coordinate-system/#viewport-and-scaling`,JP=`[ngDiagram] zoomToFit is disabled when virtualization is enabled.
|
|
49
|
+
|
|
50
|
+
When virtualization is active, only visible nodes and edges are rendered for performance reasons.
|
|
51
|
+
Zoom to fit requires all elements to be available for calculating bounds, which conflicts with virtualization.
|
|
52
|
+
|
|
53
|
+
To use zoomToFit, disable virtualization in your config:
|
|
54
|
+
virtualization: { enabled: false }`,eE=(n,e)=>{if(typeof n=="number")return{top:n,right:n,bottom:n,left:n};switch(n.length){case 2:return{top:n[0],right:n[1],bottom:n[0],left:n[1]};case 3:return{top:n[0],right:n[1],bottom:n[2],left:n[1]};case 4:return{top:n[0],right:n[1],bottom:n[2],left:n[3]};default:return{top:e,right:e,bottom:e,left:e}}},tE=(n,e,t,o)=>({targetNodes:t?.length?n.filter(i=>t.includes(i.id)):n,targetEdges:o?.length?e.filter(i=>o.includes(i.id)):e}),nE=(n,e,t,o,i,r)=>{let s=Math.min(t/n,o/e);return Math.max(i,Math.min(r,s))},oE=(n,e,t,o)=>({x:e.width/2-(n.x+n.width/2)*o+(t.left-t.right)/2,y:e.height/2-(n.y+n.height/2)*o+(t.top-t.bottom)/2}),iE=n=>!!n.width&&!!n.height&&n.width>0&&n.height>0,rE=(i,r)=>A(null,[i,r],function*(n,{nodeIds:e,edgeIds:t,padding:o}){if(n.flowCore.isVirtualizationActive)return void console.warn(JP);let{nodes:s,edges:a,metadata:d}=n.flowCore.getState(),{viewport:l}=d;if(!iE(l))return;let h=l.width,g=l.height,_=n.flowCore.config.zoom.zoomToFit.padding,D=o??_,{targetNodes:L,targetEdges:q}=tE(s,a,e,t),Y=dh(L,q);if(!Y)return;let J=Array.isArray(_)?_[0]:_,fe=eE(D,J),Ae=h-fe.left-fe.right,me=g-fe.top-fe.bottom;if(Ae<=0||me<=0)return;let{min:ze,max:Ee}=n.flowCore.config.zoom,$e=nE(Y.width,Y.height,Ae,me,ze,Ee);if($e<=0||!isFinite($e)||isNaN($e))return void console.error(QP($e));let{x:zt,y:zi}=oE(Y,{width:h,height:g},fe,$e);l.x===zt&&l.y===zi&&l.scale===$e||(yield n.flowCore.applyUpdate({metadataUpdate:{viewport:C(p({},l),{x:zt,y:zi,scale:$e})}},"zoomToFit"))}),sE={init:JS,select:OP,selectAll:zP,selectEnd:FP,deselect:AP,deselectAll:LP,moveNodesBy:cP,moveNodesStart:gP,moveNodesStop:mP,deleteSelection:W0,addNodes:xS,updateNode:PS,updateNodes:ES,deleteNodes:IS,clearModel:kS,addEdges:DS,updateEdge:TS,updateEdges:MS,deleteEdges:RS,copy:j0,cut:ZS,paste:KS,moveViewport:vP,moveViewportBy:yP,startLinking:dP,moveTemporaryEdge:aP,finishLinking:nP,finishLinkingToPosition:oP,startLinkingFromPosition:lP,resizeNode:_P,resizeNodeStart:IP,resizeNodeStop:kP,zoom:XP,addPortsBulk:NS,updatePortsBulk:OS,deletePortsBulk:AS,bringToFront:KP,sendToBack:YP,addEdgeLabelsBulk:LS,updateEdgeLabelsBulk:FS,deleteEdgeLabelsBulk:zS,rotateNodeTo:MP,rotateNodeStart:RP,rotateNodeStop:NP,highlightGroup:XS,highlightGroupClear:QS,addToGroup:dS,removeFromGroup:wP,paletteDropNode:SS,centerOnNode:BS,centerOnRect:$S,zoomToFit:rE},Zc=class{callbacks={};flowCore;constructor(e){this.flowCore=e,Object.entries(sE).forEach(([t,o])=>{this.register(t,i=>{o(this,i)})})}emit(e,...t){return A(this,null,function*(){return yield this.emitInternal(e,!1,...t)})}emitInternal(e,t,...o){return A(this,null,function*(){if(!t&&this.flowCore.transactionManager.isActive()){let r=this.flowCore.transactionManager.getCurrentTransaction();if(r&&!r.isAborted())return r.context.emit(e,...o)}let i=this.callbacks[e];if(i){let r=p({name:e},o[0]);yield Promise.all(i.map(s=>s(r)))}})}register(e,t){return this.getCommandCallbacks(e).push(t),()=>{let o=this.getCommandCallbacks(e).filter(i=>i!==t);this.callbacks[e]=o}}getCommandCallbacks(e){return this.callbacks[e]||=[]}},aE=[{actionName:"copy",bindings:[{key:"c",modifiers:{primary:!0}}]},{actionName:"cut",bindings:[{key:"x",modifiers:{primary:!0}}]},{actionName:"paste",bindings:[{key:"v",modifiers:{primary:!0}}]},{actionName:"deleteSelection",bindings:[{key:"Delete"},{key:"Backspace"}]},{actionName:"keyboardMoveSelectionUp",bindings:[{key:"ArrowUp"}]},{actionName:"keyboardMoveSelectionDown",bindings:[{key:"ArrowDown"}]},{actionName:"keyboardMoveSelectionLeft",bindings:[{key:"ArrowLeft"}]},{actionName:"keyboardMoveSelectionRight",bindings:[{key:"ArrowRight"}]},{actionName:"keyboardPanUp",bindings:[{key:"ArrowUp"}]},{actionName:"keyboardPanDown",bindings:[{key:"ArrowDown"}]},{actionName:"keyboardPanLeft",bindings:[{key:"ArrowLeft"}]},{actionName:"keyboardPanRight",bindings:[{key:"ArrowRight"}]},{actionName:"boxSelection",bindings:[{modifiers:{shift:!0}}]},{actionName:"multiSelection",bindings:[{modifiers:{primary:!0}}]},{actionName:"selectAll",bindings:[{key:"a",modifiers:{primary:!0}}]},{actionName:"undo",bindings:[{key:"z",modifiers:{primary:!0}}]},{actionName:"redo",bindings:[{key:"y",modifiers:{primary:!0}}]},{actionName:"zoom",bindings:[{modifiers:{primary:!0}}]},{actionName:"keyboardZoomIn",bindings:[{key:"="}]},{actionName:"keyboardZoomOut",bindings:[{key:"-"}]}];var Xc=class{flowCore;constructor(e){this.flowCore=e}match(e){let{shortcuts:t}=this.flowCore.config,o=[];for(let i of t)for(let r of i.bindings)if(this.matchBinding(e,r)){o.push(i);break}return o}matchesAction(e,t){let{shortcuts:o}=this.flowCore.config,i=o.find(r=>r.actionName===e);return!!i&&i.bindings.some(r=>this.matchBinding(t,r))}matchBinding(e,t){return!(t.key!==void 0&&!this.keysMatch(e.key,t.key))&&(t.key!==void 0||e.key===void 0)&&this.matchModifiers(e.modifiers,t)}matchModifiers(e,t){return e.primary===(t.modifiers?.primary??!1)&&e.shift===(t.modifiers?.shift??!1)&&e.secondary===(t.modifiers?.secondary??!1)&&(t.modifiers?.meta===void 0||e.meta===t.modifiers.meta)}keysMatch(e,t){return e!==void 0&&(e.length===1&&t.length===1?e.toLowerCase()===t.toLowerCase():e===t)}},Qc={width:20,height:20},dE={getMinNodeSize:()=>p({},Qc),allowResizeBelowChildrenBounds:!0,defaultResizable:!0},lE={portSnapDistance:10,edgePanningEnabled:!0,edgePanningForce:10,edgePanningThreshold:30,selectNodeOnPortPress:!0,validateConnection:()=>!0,temporaryEdgeDataBuilder:n=>p({},n),finalEdgeDataBuilder:n=>p({},n)},cE={canGroup:()=>!0},uE={padding:50,onInit:!1},pE={min:.01,max:10,step:.03,zoomToFit:uE},hE={dotSpacing:30,cellSize:{width:10,height:10},majorLinesFrequency:{x:5,y:5}},fE={shouldSnapForNode:()=>!1,computeSnapAngleForNode:()=>null,defaultSnapAngle:30,defaultRotatable:!0},gE={shouldSnapDragForNode:()=>!1,shouldSnapResizeForNode:()=>!1,computeSnapForNodeDrag:()=>null,computeSnapForNodeSize:()=>null,defaultDragSnap:{width:10,height:10},defaultResizeSnap:{width:10,height:10}},mE={edgePanningForce:10,edgePanningThreshold:30,edgePanningEnabled:!0},yE={enabled:!0,selectedZIndex:1e4,temporaryEdgeZIndex:2147483647,edgesAboveConnectedNodes:!1,elevateOnSelection:!0},vE={defaultRouting:"orthogonal",bezier:{bezierControlOffset:100},orthogonal:{maxCornerRadius:15,firstLastSegmentLength:20}},wE={partialInclusion:!0,realtime:!0},bE={enabled:!1,padding:.5,idleDelay:100},CE=(n,e)=>rh({computeNodeId:()=>e.environment.generateId(),computeEdgeId:()=>e.environment.generateId(),resize:dE,linking:lE,grouping:cE,zoom:pE,background:hE,nodeRotation:fE,snapping:gE,selectionMoving:mE,edgeRouting:vE,zIndex:yE,boxSelection:wE,virtualization:bE,shortcuts:aE,debugMode:!1,viewportPanningEnabled:!0,nodeDraggingEnabled:!0},n),ga=class{getMeasuredIds;pendingAdds=new Map;pendingUpdates=new Map;pendingDeletes=new Map;flushScheduled=!1;constructor(e){this.getMeasuredIds=e}processAdd(e,t,o){this.getOrCreate(this.pendingAdds,e,o).items.push(t),this.scheduleFlush()}processUpdate(e,t,o){this.getOrCreate(this.pendingUpdates,e,o).items.push(t),this.scheduleFlush()}processDelete(e,t,o){this.getOrCreate(this.pendingDeletes,e,o).items.push(t),this.scheduleFlush()}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>{this.flush()}))}flush(){return A(this,null,function*(){this.cancelMatchingIntents(),this.filterAlreadyMeasuredAdds();let e=this.takeAll(this.pendingAdds),t=this.takeAll(this.pendingUpdates),o=this.takeAll(this.pendingDeletes);this.flushScheduled=!1,yield this.invokeCallbacks(e),yield this.invokeCallbacks(t),yield this.invokeCallbacks(o)})}invokeCallbacks(e){return A(this,null,function*(){if(e.size===0)return;let t=new Map;for(let[o,{items:i,onFlush:r}]of e){let s=t.get(r);s||(s=new Map,t.set(r,s)),s.set(o,i)}for(let[o,i]of t)yield o(i)})}cancelMatchingIntents(){for(let[e,t]of this.pendingDeletes){let o=this.pendingAdds.get(e);if(!o)continue;let i=new Set(t.items),r=o.items.filter(s=>!i.has(s.id)||(i.delete(s.id),!1));r.length!==o.items.length&&(r.length===0?this.pendingAdds.delete(e):o.items=r,i.size===0?this.pendingDeletes.delete(e):t.items=[...i])}}filterAlreadyMeasuredAdds(){if(this.getMeasuredIds)for(let[e,t]of this.pendingAdds){let o=this.getMeasuredIds(e);if(o.size===0)continue;let i=t.items.filter(r=>!o.has(r.id));i.length!==t.items.length&&(i.length===0?this.pendingAdds.delete(e):t.items=i)}}getOrCreate(e,t,o){let i=e.get(t);return i||(i={items:[],onFlush:o},e.set(t,i)),i}takeAll(e){let t=new Map(e);return e.clear(),t}},Jc=class extends ga{constructor(e){super(t=>{let o=e(t)?.measuredLabels??[],i=new Set;for(let r of o)St(r.size)&&i.add(r.id);return i})}};var eu=class{phase="idle";participantIds=new Set;pendingConfig=null;discoveryWindow={timeoutId:null,expiresAt:0,durationMs:70};debounce={timeoutId:null,expiresAt:0,durationMs:50};settlementPromise=null;settlementResolve=null;requestTracking(e){this.pendingConfig=e??{}}isTrackingRequested(){return this.pendingConfig!==null}registerParticipants(e){let t=this.pendingConfig;if(this.pendingConfig=null,e.length!==0){t&&(this.discoveryWindow.durationMs=t.discoveryWindowMs??70,this.debounce.durationMs=t.debounceMs??50);for(let o of e)this.participantIds.add(o);this.phase="discoveryWindow",this.startTimer(this.discoveryWindow)}}signalObserverActivity(e){if(this.phase==="idle"||!this.participantIds.has(e))return;let t=this.activeTimer();this.remainingTime(t)<40&&this.startTimer(t)}signalMeasurement(e){this.phase!=="idle"&&this.participantIds.has(e)&&(this.phase==="discoveryWindow"&&this.clearTimer(this.discoveryWindow),this.phase="debounce",this.startTimer(this.debounce))}waitForMeasurements(){return this.hasPendingMeasurements()?(this.settlementPromise||(this.settlementPromise=new Promise(e=>{this.settlementResolve=e})),this.settlementPromise):Promise.resolve()}hasPendingMeasurements(){return this.phase!=="idle"}activeTimer(){return this.phase==="discoveryWindow"?this.discoveryWindow:this.debounce}remainingTime(e){return e.expiresAt-Date.now()}startTimer(e){this.clearTimer(e),e.expiresAt=Date.now()+e.durationMs,e.timeoutId=setTimeout(()=>{this.resolve()},e.durationMs)}clearTimer(e){e.timeoutId&&(clearTimeout(e.timeoutId),e.timeoutId=null)}resolve(){this.phase="idle",this.participantIds.clear(),this.clearTimer(this.discoveryWindow),this.clearTimer(this.debounce),this.settlementResolve&&(this.settlementResolve(),this.settlementResolve=null,this.settlementPromise=null)}},tu=class{flowCore;middlewareChain;history=[];initialState;initialStateUpdate;modelActionTypes;metadata;edgesMap=new Map;nodesMap=new Map;initialNodesMap=new Map;initialEdgesMap=new Map;initialConnectedEdgesMap=new Map;addedNodesIds=new Set;removedNodesIds=new Set;addedEdgesIds=new Set;removedEdgesIds=new Set;updatedPropsToNodeIds=new Map;updatedPropsToEdgeIds=new Map;updatedNodeIdsToProps=new Map;updatedEdgeIdsToProps=new Map;constructor(e,t){this.flowCore=e,this.middlewareChain=t}run(e,t,o){return A(this,null,function*(){return this.initialState=e,this.modelActionTypes=o,this.metadata=e.metadata,this.isMetadataOnlyUpdate(t)?(this.nodesMap=this.flowCore.modelLookup.nodesMap,this.edgesMap=this.flowCore.modelLookup.edgesMap,this.initialNodesMap=this.nodesMap,this.initialEdgesMap=this.edgesMap):(this.nodesMap=new Map(this.flowCore.modelLookup.nodesMap),this.edgesMap=new Map(this.flowCore.modelLookup.edgesMap),this.initialNodesMap=new Map(this.flowCore.modelLookup.nodesMap),this.initialEdgesMap=new Map(this.flowCore.modelLookup.edgesMap)),this.initialConnectedEdgesMap=this.flowCore.modelLookup.connectedEdgesMap,this.initialStateUpdate=t,this.applyStateUpdate(t),yield this.resolveMiddlewares()})}isMetadataOnlyUpdate(e){return!(e.nodesToAdd?.length||e.nodesToUpdate?.length||e.nodesToRemove?.length||e.edgesToAdd?.length||e.edgesToUpdate?.length||e.edgesToRemove?.length||!e.metadataUpdate)}helpers=()=>({checkIfNodeChanged:e=>this.updatedNodeIdsToProps.has(e),checkIfEdgeChanged:e=>this.updatedEdgeIdsToProps.has(e),checkIfNodeAdded:e=>this.addedNodesIds.has(e),checkIfNodeRemoved:e=>this.removedNodesIds.has(e),checkIfEdgeAdded:e=>this.addedEdgesIds.has(e),checkIfEdgeRemoved:e=>this.removedEdgesIds.has(e),checkIfAnyNodePropsChanged:e=>e.some(t=>this.updatedPropsToNodeIds.has(t)),checkIfAnyEdgePropsChanged:e=>e.some(t=>this.updatedPropsToEdgeIds.has(t)),anyNodesAdded:()=>this.addedNodesIds.size>0,anyEdgesAdded:()=>this.addedEdgesIds.size>0,anyNodesRemoved:()=>this.removedNodesIds.size>0,anyEdgesRemoved:()=>this.removedEdgesIds.size>0,getAffectedNodeIds:e=>e.flatMap(t=>[...this.updatedPropsToNodeIds.get(t)??[]]),getAffectedEdgeIds:e=>e.flatMap(t=>[...this.updatedPropsToEdgeIds.get(t)??[]]),getChangedNodeIds:()=>[...this.updatedNodeIdsToProps.keys()],getChangedEdgeIds:()=>[...this.updatedEdgeIdsToProps.keys()],getAddedNodes:()=>Array.from(this.addedNodesIds).map(e=>this.nodesMap.get(e)).filter(e=>e!==void 0),getAddedEdges:()=>Array.from(this.addedEdgesIds).map(e=>this.edgesMap.get(e)).filter(e=>e!==void 0),getRemovedNodes:()=>Array.from(this.removedNodesIds).map(e=>this.initialNodesMap.get(e)).filter(e=>e!==void 0),getRemovedEdges:()=>Array.from(this.removedEdgesIds).map(e=>this.initialEdgesMap.get(e)).filter(e=>e!==void 0)});getState=()=>({nodes:Array.from(this.nodesMap.values()),edges:Array.from(this.edgesMap.values()),metadata:this.metadata});getContext=()=>({state:this.getState(),nodesMap:this.nodesMap,edgesMap:this.edgesMap,initialNodesMap:this.initialNodesMap,initialEdgesMap:this.initialEdgesMap,initialConnectedEdgesMap:this.initialConnectedEdgesMap,initialState:this.initialState,modelActionType:this.modelActionTypes[0],modelActionTypes:this.modelActionTypes,actionStateManager:this.flowCore.actionStateManager,edgeRoutingManager:this.flowCore.edgeRoutingManager,helpers:this.helpers(),history:this.history,initialUpdate:this.initialStateUpdate,config:this.flowCore.config,environment:this.flowCore.environment});resolveMiddlewares=()=>new Promise(e=>{let t=[],o=new Set,i=r=>new Promise(s=>{let a=this.middlewareChain[r];if(!a){let h=this.getState();for(e(h);t.length>0;)t.pop()?.(h);return}let d=a.name;if(o.has(r))throw new Error(`Middleware ${d} executed next() multiple times`);o.add(r),t.push(s);let l=this.getContext();a.execute(l,h=>A(this,null,function*(){return h&&Object.keys(h).length>0&&this.applyStateUpdate(h,d),yield i(r+1)}),()=>{for(;t.length>0;)t.pop()?.(this.initialState);e(void 0)})});i(0)});applyStateUpdate=(e,t)=>{t&&this.history.push({name:t,stateUpdate:e}),e.nodesToAdd?.forEach(o=>this.addNode(o)),e.edgesToAdd?.forEach(o=>this.addEdge(o)),e.edgesToRemove?.forEach(o=>this.removeEdge(o)),e.nodesToRemove?.forEach(o=>this.removeNode(o)),e.nodesToUpdate?.forEach(o=>this.updateNode(o)),e.edgesToUpdate?.forEach(o=>this.updateEdge(o)),e.metadataUpdate&&(this.metadata=p(p({},this.metadata),e.metadataUpdate))};removeNode=e=>{this.nodesMap.delete(e),this.removedNodesIds.add(e),this.addedNodesIds.delete(e)};removeEdge=e=>{this.edgesMap.delete(e),this.removedEdgesIds.add(e),this.addedEdgesIds.delete(e)};addEdge=e=>{this.edgesMap.set(e.id,e),this.addedEdgesIds.add(e.id),this.removedEdgesIds.delete(e.id)};addNode=e=>{this.nodesMap.set(e.id,e),this.addedNodesIds.add(e.id),this.removedNodesIds.delete(e.id)};updateNode=o=>{var i=o,{id:e}=i,t=gn(i,["id"]);let r={},s=this.nodesMap.get(e);s&&(Object.entries(t).forEach(([a,d])=>{a==="position"?yn(s.position,d)||(r.position=d,this.updateNodeProp(e,"position")):a==="size"?sh(s.size,d)||(r.size=d,this.updateNodeProp(e,"size")):s[a]!==d&&(r[a]=d,this.updateNodeProp(e,a))}),Object.keys(r).length>0&&this.nodesMap.set(e,p(p({},s),r)))};updateNodeProp=(e,t)=>{this.updatedPropsToNodeIds.has(t)||this.updatedPropsToNodeIds.set(t,new Set([])),this.updatedPropsToNodeIds.get(t).add(e),this.updatedNodeIdsToProps.has(e)||this.updatedNodeIdsToProps.set(e,new Set([])),this.updatedNodeIdsToProps.get(e).add(t)};updateEdge=o=>{var i=o,{id:e}=i,t=gn(i,["id"]);let r={},s=this.edgesMap.get(e);s&&(Object.entries(t).forEach(([a,d])=>{a==="targetPosition"?yn(s.targetPosition,d)||(r.targetPosition=d,this.updateEdgeProp(e,"targetPosition")):a==="sourcePosition"?yn(s.sourcePosition,d)||(r.sourcePosition=d,this.updateEdgeProp(e,"sourcePosition")):s[a]!==d&&(r[a]=d,this.updateEdgeProp(e,a))}),Object.keys(r).length>0&&this.edgesMap.set(e,p(p({},s),r)))};updateEdgeProp=(e,t)=>{this.updatedPropsToEdgeIds.has(t)||this.updatedPropsToEdgeIds.set(t,new Set([])),this.updatedPropsToEdgeIds.get(t).add(e),this.updatedEdgeIdsToProps.has(e)||this.updatedEdgeIdsToProps.set(e,new Set([])),this.updatedEdgeIdsToProps.get(e).add(t)}},_E=(n,e)=>{if(!n.target&&n.targetPosition){let t=e.get(n.source);return{targetSide:v0(t,n.sourcePort,n.targetPosition)}}if(!n.source&&n.sourcePosition&&n.targetPosition){let t=e.get(n.target);return{sourceSide:v0(t,n.targetPort,n.sourcePosition)}}return{}},xE=(n,e)=>{let t=n.temporary?_E(n,e):{},o=t.sourceSide??"right",i=t.targetSide??"left",r=e.get(n.source),s=e.get(n.target),a=_0(r,n.sourcePort,n.sourcePosition),d=_0(s,n.targetPort,n.targetPosition),l=x0(e,n.source,o,n.sourcePort,n.sourcePosition,d),h=x0(e,n.target,i,n.targetPort,n.targetPosition,a);return{source:C0(l)?l:void 0,target:C0(h)?h:void 0}},C0=n=>!!n&&n.x!==void 0&&n.y!==void 0&&!!n.side,_0=(n,e,t)=>{if(!n)return t||{x:0,y:0};if(e){let o=U0(n,e);if(o)return{x:o.x,y:o.y}}return{x:n.position.x+(n.size?.width||0)/2,y:n.position.y+(n.size?.height||0)/2}},SE=(n,e,t,o,i)=>n?t?U0(n,t)||C(p({},o),{side:e}):hS(n,i||o||{x:0,y:0}):C(p({},o),{side:e}),x0=(n,e,t,o,i,r)=>{let s=n.get(e);return s?SE(s,t,o,i,r):C(p({},i),{side:t})},PE=(n,e,t,o,i)=>`[ngDiagram] Invalid edge coordinates detected for edge '${n}'.
|
|
55
|
+
|
|
56
|
+
Edge details:
|
|
57
|
+
\u2022 source: ${e} (port: ${t||"not specified"})
|
|
58
|
+
\u2022 target: ${o} (port: ${i||"not specified"})
|
|
59
|
+
|
|
60
|
+
Documentation: https://www.ngdiagram.dev/docs/guides/edges/edges/
|
|
61
|
+
`,EE=n=>`[ngDiagram] Edge routing '${n}' is not registered. Falling back to default routing.
|
|
62
|
+
|
|
63
|
+
Documentation: https://www.ngdiagram.dev/docs/guides/edges/routing/
|
|
64
|
+
`,IE=(n,e,t)=>{if(n.sourcePort){let o=e?.measuredPorts;if(!o)return!1;let i=o.find(r=>r.id===n.sourcePort);if(!i||!i.position||!i.size)return!1}if(n.targetPort){let o=t?.measuredPorts;if(!o)return!1;let i=o.find(r=>r.id===n.targetPort);if(!i||!i.position||!i.size)return!1}return!0},kE=n=>n.routingMode==="manual"&&!!n.points&&n.points.length>0,ma=n=>n?.x!==void 0&&n?.y!==void 0?{x:n.x,y:n.y}:void 0,S0=(n,e)=>n&&e?n.measuredPorts?.find(t=>t.id===e):void 0,DE=(n,e,t,o,i,r)=>{let s={sourcePoint:e,targetPoint:t,edge:n,sourceNode:o,targetNode:i,sourcePort:S0(o,n.sourcePort),targetPort:S0(i,n.targetPort)};if(n.routing&&r.hasRouting(n.routing))return r.computePoints(n.routing,s);n.routing&&!r.hasRouting(n.routing)&&console.warn(EE(n.routing));let a=r.getDefaultRouting();return r.hasRouting(a)?r.computePoints(a,s):[ma(e),ma(t)].filter(d=>!!d)},ty=(n,e,t)=>{let o=e.get(n.source),i=e.get(n.target);if(!kE(n)&&!IE(n,o,i))return{sourcePoint:void 0,targetPoint:void 0,points:[]};let{source:r,target:s}=xE(n,e),a=ma(r),d=ma(s);return r&&s&&Ut(a)&&Ut(d)?{sourcePoint:a,targetPoint:d,points:n.routingMode==="manual"&&n.points&&n.points.length>0?n.points:DE(n,r,s,o,i,t)}:(console.error(PE(n.id,n.source,n.sourcePort,n.target,n.targetPort)),{sourcePoint:void 0,targetPoint:void 0,points:[]})},TE=({helpers:n,modelActionTypes:e,actionStateManager:t})=>!e.includes("zoom")&&(!e.includes("resizeNode")||!t.isResizing())&&(e.includes("init")||n.anyEdgesAdded()||n.checkIfAnyNodePropsChanged(["position","size","angle","measuredPorts"])||n.checkIfAnyEdgePropsChanged(["targetPosition","sourcePosition","points","sourcePort","targetPort","source","target","routing","routingMode","measuredLabels"])),ME=(n,e,t)=>e.checkIfEdgeAdded(n.id)||e.checkIfEdgeChanged(n.id)||e.checkIfNodeChanged(n.source)||e.checkIfNodeChanged(n.target)||t.includes("init"),RE=(n,e)=>!n||n.length!==e.length||!n.every((t,o)=>yn(t,e[o])),ny=(n,e,t)=>e.length<2?n.measuredLabels:n.measuredLabels?.map(o=>C(p({},o),{position:A0(o.positionOnEdge,n.routing,e,t)})),NE=(n,e,t,o,i)=>{let r=ny(n,o,i);return r?.length||e||t?{id:n.id,sourcePosition:e,targetPosition:t,measuredLabels:r}:null},OE=(n,e,t,o,i)=>{let r=RE(n.points,o),s=n.measuredLabels?.some(d=>!Ut(d.position));if(!r&&!s)return null;let a=ny(n,o,i);return C(p({id:n.id},r?{points:o}:{}),{sourcePosition:e,targetPosition:t,measuredLabels:a})},AE=(n,e,t,o,i)=>{let r=[];return n.forEach(s=>{if(!ME(s,o,i))return;let{sourcePoint:a,targetPoint:d,points:l}=ty(s,e,t);if(!l||l.length===0)return;let h=s.routingMode==="manual"?NE(s,a,d,l,t):OE(s,a,d,l,t);h&&r.push(h)}),r},LE=(n,e,t,o)=>{let{sourcePoint:i,targetPoint:r,points:s}=ty(n,e,t);return C(p({},n),{points:s,sourcePosition:i,targetPosition:r,computedZIndex:o})},FE={name:"edges-routing",execute:(n,e)=>{let{state:{edges:t},nodesMap:o,edgeRoutingManager:i,actionStateManager:r,helpers:s,modelActionTypes:a,config:{zIndex:d}}=n,l=d.temporaryEdgeZIndex||d.selectedZIndex,h=TE(n),g=r.linking?.temporaryEdge;if(!h&&!g)return void e();let _=h?AE(t,o,i,s,a):[],D=g?LE(g,o,i,l):void 0;D&&r.linking&&(r.linking=C(p({},r.linking),{temporaryEdge:D})),e(p({},_.length>0?{edgesToUpdate:_}:{}))}},nu=class{name="ClipboardPastedEmitter";emit(e,t){if(!e.modelActionTypes.includes("paste")||!e.actionStateManager.getState().copyPaste)return;let{initialNodesMap:o,initialEdgesMap:i,nodesMap:r,edgesMap:s}=e,a=[];for(let[l,h]of r)o.has(l)||a.push(h);let d=[];for(let[l,h]of s)i.has(l)||d.push(h);(a.length>0||d.length>0)&&t.deferredEmit("clipboardPasted",{nodes:a,edges:d})}},ou=class{name="DiagramInitEmitter";unmeasuredNodes=new Set;unmeasuredNodePorts=new Set;unmeasuredEdgeLabels=new Set;initialized=!1;initEventEmitted=!1;safetyHatchTimeoutId=null;SAFETY_HATCH_TIMEOUT_MS=2e3;emit(e,t){let{modelActionTypes:o}=e;o.includes("init")?this.handleInit(e,t):(o.includes("updateNode")||o.includes("updateEdge"))&&this.handleUpdate(e,t)}handleInit(e,t){this.initialized=!0;let{nodesMap:o,edgesMap:i,initialUpdate:r}=e;this.collectUnmeasuredItems(o,i,r.renderedNodeIds??Array.from(o.keys()),r.renderedEdgeIds??Array.from(i.keys())),this.areAllMeasured()?this.emitInitEvent(e,t):this.restartSafetyHatchTimeout(e,t)}handleUpdate(e,t){if(!this.initialized||this.initEventEmitted)return;let{modelActionTypes:o,initialUpdate:i,nodesMap:r,edgesMap:s}=e,a=this.countUnmeasuredItems();o.includes("updateNode")&&this.processNodeUpdates(i,r),o.includes("updateEdge")&&this.processEdgeUpdates(i,s),this.countUnmeasuredItems()<a&&this.restartSafetyHatchTimeout(e,t),this.areAllMeasured()&&this.emitInitEvent(e,t)}collectUnmeasuredItems(e,t,o,i){this.unmeasuredNodes.clear(),this.unmeasuredNodePorts.clear(),this.unmeasuredEdgeLabels.clear();for(let r of o){let s=e.get(r);if(s){St(s.size)||this.unmeasuredNodes.add(r);for(let a of s.measuredPorts??[])St(a.size)&&Ut(a.position)||this.unmeasuredNodePorts.add(`${r}:${a.id}`)}}for(let r of i){let s=t.get(r);if(s)for(let a of s.measuredLabels??[])St(a.size)&&Ut(a.position)||this.unmeasuredEdgeLabels.add(`${r}:${a.id}`)}}processNodeUpdates(e,t){if(e?.nodesToUpdate?.length){for(let o of e.nodesToUpdate)if(t.has(o.id)&&(this.unmeasuredNodes.has(o.id)&&St(o.size)&&this.unmeasuredNodes.delete(o.id),o.measuredPorts))for(let i of o.measuredPorts){let r=`${o.id}:${i.id}`;this.unmeasuredNodePorts.has(r)&&St(i.size)&&Ut(i.position)&&this.unmeasuredNodePorts.delete(r)}}}processEdgeUpdates(e,t){if(e?.edgesToUpdate?.length){for(let o of e.edgesToUpdate)if(t.has(o.id)&&o.measuredLabels)for(let i of o.measuredLabels){let r=`${o.id}:${i.id}`;this.unmeasuredEdgeLabels.has(r)&&St(i.size)&&Ut(i.position)&&this.unmeasuredEdgeLabels.delete(r)}}}areAllMeasured(){return this.unmeasuredNodes.size===0&&this.unmeasuredNodePorts.size===0&&this.unmeasuredEdgeLabels.size===0}emitInitEvent(e,t,o=!0){this.clearSafetyHatchTimeout();let{nodesMap:i,edgesMap:r,initialUpdate:s}=e,a=new Set(s.renderedNodeIds??i.keys()),d=new Set(s.renderedEdgeIds??r.keys()),l={nodes:Array.from(i.values()).filter(h=>a.has(h.id)),edges:Array.from(r.values()).filter(h=>d.has(h.id)),viewport:e.state.metadata.viewport};o?t.deferredEmit("diagramInit",l):t.emit("diagramInit",l),this.initEventEmitted=!0}restartSafetyHatchTimeout(e,t){this.clearSafetyHatchTimeout(),this.safetyHatchTimeoutId=setTimeout(()=>{this.initEventEmitted||this.emitInitEventWithWarning(e,t)},this.SAFETY_HATCH_TIMEOUT_MS)}clearSafetyHatchTimeout(){this.safetyHatchTimeoutId!==null&&(clearTimeout(this.safetyHatchTimeoutId),this.safetyHatchTimeoutId=null)}emitInitEventWithWarning(e,t){let o={nodes:Array.from(this.unmeasuredNodes),nodePorts:Array.from(this.unmeasuredNodePorts),edgeLabels:Array.from(this.unmeasuredEdgeLabels)},i=this.countUnmeasuredItems();console.warn("[DiagramInitEmitter] Measurement timeout reached from last measurement. Emitting diagramInit event anyway. Ensure the model provided to ng-diagram was created with initializeModel() or initializeModelAdapter() (for custom ModelAdapter)."),console.warn(`Total unmeasured elements: ${i}`),o.nodes.length>0&&console.warn(`Unmeasured nodes (${o.nodes.length}):`,o.nodes),o.nodePorts.length>0&&console.warn(`Unmeasured node ports (${o.nodePorts.length}):`,o.nodePorts),o.edgeLabels.length>0&&console.warn(`Unmeasured edge labels (${o.edgeLabels.length}):`,o.edgeLabels),this.emitInitEvent(e,t,!1)}countUnmeasuredItems(){return this.unmeasuredNodes.size+this.unmeasuredEdgeLabels.size+this.unmeasuredNodePorts.size}},iu=class{name="EdgeDrawEndedEmitter";emit(e,t){if(!e.modelActionTypes.includes("finishLinking"))return;let o=e.actionStateManager.linking;if(!o)return;let i=e.nodesMap.get(o.sourceNodeId);if(!i)return;let r=o.dropPosition??{x:0,y:0};if(e.helpers.anyEdgesAdded()){for(let[s,a]of e.edgesMap)if(!e.initialEdgesMap.has(s)){let d=a.target?e.nodesMap.get(a.target):void 0;t.deferredEmit("edgeDrawEnded",{source:i,sourcePort:a.sourcePort,dropPosition:r,success:!0,edge:a,target:d,targetPort:a.targetPort});break}}else t.deferredEmit("edgeDrawEnded",{source:i,sourcePort:o.sourcePortId||void 0,dropPosition:r,success:!1,reason:o.cancelReason})}},ru=class{name="EdgeDrawnEmitter";emit(e,t){if(!e.modelActionTypes.includes("finishLinking")||!e.helpers.anyEdgesAdded())return;let{initialEdgesMap:o,edgesMap:i,nodesMap:r}=e;this.emitNewEdges(o,i,r,t)}emitNewEdges(e,t,o,i){for(let[r,s]of t)if(!e.has(r)){let a=o.get(s.source),d=o.get(s.target);a&&d&&i.deferredEmit("edgeDrawn",{edge:s,source:a,target:d,sourcePort:s.sourcePort,targetPort:s.targetPort})}}};function oy(n,e){let t=[];for(let o of n){let i=e.get(o);i&&t.push(i)}return t}var su=class{name="NodeDragStartedEmitter";emit(e,t){if(!e.modelActionTypes.includes("moveNodesStart"))return;let o=e.actionStateManager.dragging?.nodeIds;if(!o||o.length===0)return;let i=oy(o,e.nodesMap);i.length!==0&&t.deferredEmit("nodeDragStarted",{nodes:i})}},au=class{name="NodeDragEndedEmitter";emit(e,t){if(!e.modelActionTypes.includes("moveNodesStop"))return;let o=e.actionStateManager.dragging?.nodeIds;if(!o||o.length===0)return;let i=oy(o,e.nodesMap);i.length!==0&&t.deferredEmit("nodeDragEnded",{nodes:i})}},du=class{name="NodeResizeStartedEmitter";emit(e,t){if(!e.modelActionTypes.includes("resizeNodeStart"))return;let o=e.actionStateManager.resize?.resizingNode;if(!o)return;let i=e.nodesMap.get(o.id);i&&t.deferredEmit("nodeResizeStarted",{node:i})}},lu=class{name="NodeResizeEndedEmitter";emit(e,t){if(!e.modelActionTypes.includes("resizeNodeStop"))return;let o=e.actionStateManager.resize?.resizingNode;if(!o)return;let i=e.nodesMap.get(o.id);i&&t.deferredEmit("nodeResizeEnded",{node:i})}},cu=class{name="NodeRotateStartedEmitter";emit(e,t){if(!e.modelActionTypes.includes("rotateNodeStart"))return;let o=e.actionStateManager.rotation?.nodeId;if(!o)return;let i=e.nodesMap.get(o);i&&t.deferredEmit("nodeRotateStarted",{node:i})}},uu=class{name="NodeRotateEndedEmitter";emit(e,t){if(!e.modelActionTypes.includes("rotateNodeStop"))return;let o=e.actionStateManager.rotation?.nodeId;if(!o)return;let i=e.nodesMap.get(o);i&&t.deferredEmit("nodeRotateEnded",{node:i})}},pu=class{name="PaletteItemDroppedEmitter";emit(e,t){if(!e.modelActionTypes.includes("paletteDropNode"))return;let o=e.initialUpdate.nodesToAdd?.[0];if(!o)return;let i=o.id,r=e.initialNodesMap.get(i),s=e.nodesMap.get(i);!r&&s&&t.deferredEmit("paletteItemDropped",{node:s,dropPosition:s.position})}},hu=class{name="SelectionChangedEmitter";emit(e,t){if(!(e.modelActionTypes.includes("changeSelection")||e.helpers.checkIfAnyNodePropsChanged(["selected"])||e.helpers.checkIfAnyEdgePropsChanged(["selected"])||e.helpers.anyNodesAdded()||e.helpers.anyEdgesAdded()||e.helpers.anyNodesRemoved()||e.helpers.anyEdgesRemoved()))return;let{initialNodesMap:o,initialEdgesMap:i,nodesMap:r,edgesMap:s}=e,a=this.collectSelectedNodes(o),d=this.collectSelectedNodes(r),l=this.collectSelectedEdges(i),h=this.collectSelectedEdges(s),g=!this.areSelectionsEqual(a.map(D=>D.id),d.map(D=>D.id)),_=!this.areSelectionsEqual(l.map(D=>D.id),h.map(D=>D.id));(g||_)&&t.deferredEmit("selectionChanged",{selectedNodes:d,selectedEdges:h,previousNodes:a,previousEdges:l})}collectSelectedNodes(e){let t=[];for(let[,o]of e)o.selected&&t.push(o);return t}collectSelectedEdges(e){let t=[];for(let[,o]of e)o.selected&&t.push(o);return t}areSelectionsEqual(e,t){if(e.length!==t.length)return!1;let o=new Set(e),i=new Set(t);return o.size===i.size&&[...o].every(r=>i.has(r))}},fu=class{name="SelectionGestureEndedEmitter";emit(e,t){if(!e.modelActionTypes.includes("selectEnd")||!e.actionStateManager.selection?.selectionChanged)return;e.actionStateManager.clearSelection();let o=[];for(let r of e.nodesMap.values())r.selected&&o.push(r);let i=[];for(let r of e.edgesMap.values())r.selected&&i.push(r);t.deferredEmit("selectionGestureEnded",{nodes:o,edges:i})}},gu=class{name="GroupMembershipChangedEmitter";emit(e,t){if(!e.modelActionTypes.includes("updateNodes")||!e.helpers.checkIfAnyNodePropsChanged(["groupId"]))return;let{initialNodesMap:o,nodesMap:i}=e,r=e.helpers.getAffectedNodeIds(["groupId"]),s=new Map,a=[];for(let l of r){let h=o.get(l),g=i.get(l);if(!h||!g)continue;let _=h.groupId,D=g.groupId;D!=null?(s.has(D)||s.set(D,[]),s.get(D).push(g)):_!=null&&a.push(g)}let d=[];for(let[l,h]of s){let g=i.get(l);g&&g.isGroup&&d.push({nodes:h,targetGroup:g})}(d.length>0||a.length>0)&&t.deferredEmit("groupMembershipChanged",{grouped:d,ungrouped:a})}},mu=class{name="SelectionMovedEmitter";moveActions=["moveNodes","moveNodesBy"];emit(e,t){if(!this.moveActions.some(l=>e.modelActionTypes.includes(l)))return;let{initialNodesMap:o,nodesMap:i,initialUpdate:r,history:s}=e,a=this.collectUpdatedNodeIds(r,s);if(a.size===0)return;let d=this.getMovedNodes(a,o,i);d&&d.length!==0&&t.deferredEmit("selectionMoved",{nodes:d})}collectUpdatedNodeIds(e,t){let o=new Set;if(e?.nodesToUpdate)for(let i of e.nodesToUpdate)o.add(i.id);for(let i of t)if(i.stateUpdate?.nodesToUpdate)for(let r of i.stateUpdate.nodesToUpdate)o.add(r.id);return o}getMovedNodes(e,t,o){let i=[];for(let r of e){let s=o.get(r);if(!s)continue;let a=t.get(r);s.position&&a?.position&&(s.position.x===a.position.x&&s.position.y===a.position.y||i.push(s))}return i.length>0?i:null}},yu=class{name="SelectionRemovedEmitter";emit(e,t){if(!e.modelActionTypes.includes("deleteSelection"))return;let{initialNodesMap:o,initialEdgesMap:i,nodesMap:r,edgesMap:s}=e,a=[];for(let[l,h]of o)r.has(l)||a.push(h);let d=[];for(let[l,h]of i)s.has(l)||d.push(h);(a.length>0||d.length>0)&&t.deferredEmit("selectionRemoved",{deletedNodes:a,deletedEdges:d})}},vu=class{name="SelectionRotatedEmitter";emit(e,t){if(!e.modelActionTypes.includes("rotateNodeTo"))return;let{initialNodesMap:o,nodesMap:i}=e,r=e.initialUpdate.nodesToUpdate?.[0];if(!r)return;let s=r.id,a=o.get(s),d=i.get(s);if(!a||!d)return;let l=a.angle??0,h=d.angle??0;l!==h&&t.deferredEmit("selectionRotated",{node:d,angle:h,previousAngle:l})}},wu=class{name="NodeResizedEmitter";emit(e,t){if(!e.modelActionTypes.includes("resizeNode"))return;let o=e.initialUpdate.nodesToUpdate?.[0];if(!o)return;let i=o.id,r=e.initialNodesMap.get(i),s=e.nodesMap.get(i);if(!r||!s)return;let a=r.size,d=s.size;a&&d&&(d.width!==a.width||d.height!==a.height)&&t.deferredEmit("nodeResized",{node:s,previousSize:{width:a.width,height:a.height}})}},bu=class{name="ViewportChangedEmitter";emit({initialState:e,state:t},o){let i=e.metadata.viewport,r=t.metadata.viewport;i.x===r.x&&i.y===r.y&&i.scale===r.scale&&i.width===r.width&&i.height===r.height||o.deferredEmit("viewportChanged",{viewport:r,previousViewport:i})}},zE=(n,e,t)=>`[ngDiagram] Event emitter error: ${n} failed.
|
|
65
|
+
|
|
66
|
+
Action types: ${e.join(", ")}
|
|
67
|
+
Error: ${t instanceof Error?t.message:String(t)}
|
|
68
|
+
|
|
69
|
+
This may indicate an issue with event handling logic.
|
|
70
|
+
The diagram will continue to function, but some events may not be emitted.
|
|
71
|
+
`,$E=n=>{let e=[new ou,new hu,new fu,new mu,new yu,new gu,new vu,new bu,new ru,new iu,new nu,new wu,new pu,new du,new lu,new cu,new uu,new su,new au];return{name:"__internal_event_emitter",execute:(t,o)=>{if(o(),n.isEnabled())for(let i of e)try{i.emit(t,n)}catch(r){console.error(zE(i.name,t.modelActionTypes,r))}}}};function ya(n,e){return C(p({},n),{_internalId:`${n.id}-${e()}`})}var BE={name:"internal-id-assignment",execute:(n,e)=>A(null,null,function*(){let{helpers:t,initialUpdate:o,environment:i}=n;if(!t.anyNodesAdded()&&!t.anyEdgesAdded())return void e();let r=o.nodesToAdd?.map(a=>ya(a,()=>i.generateId())),s=o.edgesToAdd?.map(a=>ya(a,()=>i.generateId()));e(p(p(p({},o),r?{nodesToAdd:r}:{}),s?{edgesToAdd:s}:{}))})},ha={name:"logger",execute:(n,e)=>{n.config.debugMode&&console.log(`[ngDiagram] ${n.modelActionTypes.join(", ")}`,{initialState:n.initialState,finalState:n.state,history:n.history,initialUpdate:n.initialUpdate}),e()}},zc=n=>{if(!St(n.size)||!Ut(n.position))return!1;if(n.measuredPorts){for(let e of n.measuredPorts)if(!St(e.size)||!Ut(e.position))return!1}return!0},HE={name:"measured-bounds",execute:(n,e)=>{let{nodesMap:t,modelActionTypes:o,helpers:i}=n;if(o.includes("init")){let a=[];return t.forEach(d=>{zc(d)&&a.push({id:d.id,measuredBounds:mo(d)})}),void e(p({},a.length?{nodesToUpdate:a}:{}))}if(!i.anyNodesAdded()&&!i.checkIfAnyNodePropsChanged(["position","size","angle","measuredPorts"]))return void e();let r=[],s=[];if(i.anyNodesAdded()){let a=i.getAddedNodes();for(let d of a)zc(d)&&r.push(C(p({},d),{measuredBounds:mo(d)}))}if(i.checkIfAnyNodePropsChanged(["position","size","angle","measuredPorts"])){let a=i.getAffectedNodeIds(["position","size","angle","measuredPorts"]);for(let d of a){let l=t.get(d);l&&zc(l)&&s.push({id:l.id,measuredBounds:mo(l)})}}e(p(p({},r.length?{nodesToAdd:r}:{}),s.length?{nodesToUpdate:s}:{}))}},UE=n=>({name:"measurement-tracking",execute:(e,t)=>{let o=n.isTrackingRequested(),i=n.hasPendingMeasurements();if(!o&&!i)return void t();let{helpers:r}=e;if(o){let s=[];if(r.anyNodesAdded())for(let a of r.getAddedNodes())s.push(`node:${a.id}`);if(r.anyEdgesAdded())for(let a of r.getAddedEdges())s.push(`edge:${a.id}`);for(let a of r.getChangedNodeIds())s.push(`node:${a}`);for(let a of r.getChangedEdgeIds())s.push(`edge:${a}`);n.registerParticipants(s)}else{if(r.checkIfAnyNodePropsChanged(["size","position","measuredPorts","angle"]))for(let s of r.getAffectedNodeIds(["size","position","measuredPorts","angle"]))n.signalMeasurement(`node:${s}`);if(r.checkIfAnyEdgePropsChanged(["points","measuredLabels"]))for(let s of r.getAffectedEdgeIds(["points","measuredLabels"]))n.signalMeasurement(`edge:${s}`)}t()}});function VE(n,e,t,o=!1){let i=e.get(n.source)??t.get(n.source)?.computedZIndex??0,r=e.get(n.target)??t.get(n.target)?.computedZIndex??0,s=Math.max(i,r),a=n.zOrder??(o?s+1:s);return C(p({},n),{computedZIndex:a})}var jE=n=>n.includes("init"),WE=n=>n.includes("finishLinking")||n.includes("addEdges");function GE(n,e){let t=new Set;if(n.anyNodesAdded())for(let o of n.getAddedNodes())e.has(o.id)&&t.add(o.id);for(let o of["selected","groupId","zOrder"])if(n.checkIfAnyNodePropsChanged([o]))for(let i of n.getAffectedNodeIds([o]))e.has(i)&&t.add(i);return t}function qE(n,e,t,o,i,r){let s=new Set;if(o)for(let a of n.getAddedEdges())s.add(a.id);if(i)for(let a of n.getAffectedEdgeIds(["selected"]))s.add(a);if(r)for(let a of n.getAffectedEdgeIds(["zOrder"]))s.add(a);if(e.size>0)for(let a of e.keys())for(let d of t.get(a)??[])s.add(d);return s}function KE(n,e){let t=new Set;for(let i of n){let r=e.get(i);r&&(r.groupId!=null?n.has(r.groupId)||t.add(e.has(r.groupId)?r.groupId:i):t.add(i))}let o=[];for(let i of t){let r=new Set,s=e.get(i)?.groupId,a=!1;for(;s!=null&&!r.has(s);){if(t.has(s)){a=!0;break}r.add(s),s=e.get(s)?.groupId}if(!a){let d=e.get(i);d&&o.push(d)}}return o}function YE(n,e,t){if(!t.elevateOnSelection)return 0;let o=new Set,i=0,r=n;for(;r!=null&&!o.has(r.id);)o.add(r.id),r.selected&&(i+=t.selectedZIndex),r=r.groupId!=null?e.get(r.groupId):void 0;return i}function ZE(n,e,t,o,i){let r=new Map,s=new Map;for(let a of n){let d,l;if(e.has(a.id)||a.computedZIndex==null)d=0;else{let _=YE(a,t,i);d=a.computedZIndex-_,l={initialCumulativeElevation:_-(a.selected?i.selectedZIndex:0),skipRoot:!0},s.set(a.id,_)}let{nodes:h,elevations:g}=Q0(a,o,d,i,l);for(let _ of h)r.set(_.id,_);for(let[_,D]of g)s.set(_,D)}return{nodesWithZIndexMap:r,nodeElevationMap:s}}function XE(n,e){let t=[];for(let o of n.values()){let i=e.get(o.id);i&&o.computedZIndex!==i.computedZIndex&&t.push({id:o.id,computedZIndex:o.computedZIndex})}return t}function QE(n,e,t,o,i,r){let s=[],a=new Map;for(let[d,l]of t)a.set(d,l.computedZIndex??0);for(let d of n){let l=e.get(d);if(!l)continue;let h=VE(l,a,o,i.edgesAboveConnectedNodes).computedZIndex??0;if(i.elevateOnSelection){if(l.zOrder!=null){let g=r.get(l.source)??0,_=r.get(l.target)??0;h+=Math.max(g,_)}l.selected&&(h+=i.selectedZIndex)}h!==l.computedZIndex&&s.push({id:l.id,computedZIndex:h})}return s}var JE={name:"z-index",execute:(n,e)=>{let{state:{edges:t},nodesMap:o,edgesMap:i,initialConnectedEdgesMap:r,helpers:s,modelActionTypes:a,config:d}=n,l=d.zIndex;if(!l.enabled)return void e();let h=jE(a),g=WE(a),_=s.checkIfAnyEdgePropsChanged(["selected"]),D=s.checkIfAnyEdgePropsChanged(["zOrder"]),L,q=()=>(L??=Ga(o),L),Y,J;if(h){let{nodes:me,elevations:ze}=HP(o,l,q());Y=new Map(me.map(Ee=>[Ee.id,Ee])),J=ze}else{let me=GE(s,o);if(me.size===0&&!g&&!_&&!D)return void e();if(me.size>0){let ze=KE(me,o);({nodesWithZIndexMap:Y,nodeElevationMap:J}=ZE(ze,me,o,q(),l))}else Y=new Map,J=new Map}let fe=XE(Y,o),Ae=QE(h?new Set(t.map(me=>me.id)):qE(s,Y,r,g,_,D),i,Y,o,l,J);e(p(p({},fe.length>0?{nodesToUpdate:fe}:{}),Ae.length>0?{edgesToUpdate:Ae}:{}))}},Cu=class{middlewareChain=[];eventEmitterMiddleware=null;measurementTrackingMiddleware=null;flowCore;constructor(e,t){this.flowCore=e,t&&t.forEach(o=>this.register(o))}isRegistered(e){return!!this.middlewareChain.find(t=>t.name===e)}register(e){if(this.isRegistered(e.name))throw new Error(`Middleware ${e.name} already registered`);return this.middlewareChain.push(e),()=>this.unregister(e.name)}unregister(e){let t=this.middlewareChain.findIndex(o=>o.name===e);t!==-1&&this.middlewareChain.splice(t,1)}execute(e,t,o){return A(this,null,function*(){!this.eventEmitterMiddleware&&this.flowCore.eventManager&&(this.eventEmitterMiddleware=$E(this.flowCore.eventManager)),!this.measurementTrackingMiddleware&&this.flowCore.measurementTracker&&(this.measurementTrackingMiddleware=UE(this.flowCore.measurementTracker));let i=[...this.middlewareChain,HE,ha,...this.measurementTrackingMiddleware?[this.measurementTrackingMiddleware]:[],...this.eventEmitterMiddleware?[this.eventEmitterMiddleware]:[]];return yield new tu(this.flowCore,i).run(e,t,o)})}},eI=(n,e)=>`[ngDiagram] Model integrity error: Node references non-existent parent.
|
|
72
|
+
|
|
73
|
+
Node ID: ${n}
|
|
74
|
+
Parent ID: ${e}
|
|
75
|
+
|
|
76
|
+
This indicates corrupted model data. The group hierarchy will be incomplete.
|
|
77
|
+
|
|
78
|
+
Documentation: https://www.ngdiagram.dev/docs/guides/nodes/groups/`,tI=(n,e,t)=>`[ngDiagram] Model integrity error: Node's parent is not a group.
|
|
79
|
+
|
|
80
|
+
Node ID: ${n}
|
|
81
|
+
Parent ID: ${e}
|
|
82
|
+
Parent type: ${t}
|
|
83
|
+
|
|
84
|
+
This indicates incorrect model structure. The group hierarchy will be incomplete.
|
|
85
|
+
|
|
86
|
+
Documentation: https://www.ngdiagram.dev/docs/guides/nodes/groups/`,_u=class{flowCore;_nodesMap={map:new Map,synchronized:!1};_edgesMap={map:new Map,synchronized:!1};_directChildrenMap={map:new Map,synchronized:!1};_descendantsCache={map:new Map,synchronized:!1};_connectedEdgesMap={map:new Map,synchronized:!1};constructor(e){this.flowCore=e}desynchronize(){this._nodesMap.synchronized=!1,this._edgesMap.synchronized=!1,this._directChildrenMap.synchronized=!1,this._descendantsCache.synchronized=!1,this._connectedEdgesMap.synchronized=!1}get nodesMap(){return this._nodesMap.synchronized||(this._nodesMap={map:new Map(this.flowCore.getState().nodes.map(e=>[e.id,e])),synchronized:!0}),this._nodesMap.map}get edgesMap(){return this._edgesMap.synchronized||(this._edgesMap={map:new Map(this.flowCore.getState().edges.map(e=>[e.id,e])),synchronized:!0}),this._edgesMap.map}get directChildrenMap(){return this._directChildrenMap.synchronized||(this._directChildrenMap={map:this.buildDirectChildrenMap(this.flowCore.getState().nodes),synchronized:!0}),this._directChildrenMap.map}get connectedEdgesMap(){return this._connectedEdgesMap.synchronized||(this._connectedEdgesMap={map:this.buildConnectedEdgesMap(this.flowCore.getState().edges),synchronized:!0}),this._connectedEdgesMap.map}get descendantsCache(){return this._descendantsCache.synchronized||(this._descendantsCache={map:new Map,synchronized:!0}),this._descendantsCache.map}buildDirectChildrenMap(e){let t=new Map;for(let o of e)if(o.groupId){let i=t.get(o.groupId)||[];i.push(o.id),t.set(o.groupId,i)}return t}buildConnectedEdgesMap(e){let t=new Map;for(let o of e){let i=t.get(o.source)||[];i.push(o.id),t.set(o.source,i);let r=t.get(o.target)||[];r.push(o.id),t.set(o.target,r)}return t}getNodeById(e){return this.nodesMap.get(e)??null}getEdgeById(e){return this.edgesMap.get(e)??null}getConnectedEdges(e){return(this.connectedEdgesMap.get(e)??[]).map(t=>this.getEdgeById(t)).filter(t=>t!==null)}getConnectedNodes(e){let t=this.connectedEdgesMap.get(e)??[],o=new Set;for(let i of t){let r=this.getEdgeById(i);r&&o.add(r.source===e?r.target:r.source)}return Array.from(o).map(i=>this.getNodeById(i)).filter(i=>i!==null)}getNodeEnds(e){let t=this.getEdgeById(e);if(!t)return null;let o=this.getNodeById(t.source),i=this.getNodeById(t.target);return o&&i?{source:o,target:i}:null}getChildrenIds(e){return this.directChildrenMap.get(e)??[]}getChildren(e){let t=this.getChildrenIds(e);return t?t.map(o=>this.getNodeById(o)).filter(o=>o!==null):[]}getAllDescendantIds(e){if(this.descendantsCache.has(e))return this.descendantsCache.get(e);let t=this.computeAllDescendants(e);return this.descendantsCache.set(e,t),t}computeAllDescendants(e){let t=this.getChildrenIds(e);if(!t||t.length===0)return[];let o=[...t];for(let i of t){let r=this.computeAllDescendants(i);o.push(...r)}return o}getAllDescendants(e){return this.getAllDescendantIds(e).map(t=>this.getNodeById(t)).filter(t=>t!==null)}hasChildren(e){return this.directChildrenMap.has(e)&&this.directChildrenMap.get(e).length>0}hasDescendants(e){return this.getAllDescendantIds(e).length>0}getChildrenMap(){return this.directChildrenMap}getSelectedNodes(){return this.flowCore.getState().nodes.filter(e=>e.selected)}getNodeChildren(e,{directOnly:t=!0}={}){return t?this.getChildren(e):this.getAllDescendants(e)}getNodeChildrenIds(e,{directOnly:t=!0}={}){return t?this.getChildrenIds(e):this.getAllDescendantIds(e)}getSelectedNodesWithChildren({directOnly:e=!0}={}){let t=this.getSelectedNodes(),o=new Set,i=[];for(let r of t){if(o.has(r.id))continue;o.add(r.id),i.push(r);let s=this.getNodeChildren(r.id,{directOnly:e});for(let a of s)o.has(a.id)||(o.add(a.id),i.push(a))}return i}getSelectedEdges(){return this.flowCore.getState().edges.filter(e=>e.selected)}isNodeDescendantOfGroup(e,t){return this.getAllDescendantIds(t).includes(e)}wouldCreateCircularDependency(e,t){return e===t||this.isNodeDescendantOfGroup(t,e)}getParentChain(e){let t=[],o=this.getNodeById(e);for(;o&&o.groupId;){let i=this.getNodeById(o.groupId);if(!i)return console.error(eI(o.id,o.groupId)),t;if(!yo(i))return console.error(tI(o.id,i.id,i.type||"unknown")),t;t.push(i),o=i}return t}},va=n=>n.map(({id:e,size:t,position:o})=>({portId:e,portChanges:{size:t,position:o}})),xu=class extends ga{constructor(e){super(t=>{let o=e(t)?.measuredPorts??[],i=new Set;for(let r of o)St(r.size)&&Ut(r.position)&&i.add(r.id);return i})}},Su=class{lastVisibleNodeIds=null;withPerformanceLogging(e,t,o){if(!o)return void e();let{added:i,removed:r,total:s}=this.calculateNodeDiff(t),a=i>0||r>0,d=performance.now();e(),a&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{console.log(`[ngDiagram] Render: +${i} -${r} nodes (total: ${s}): ${(performance.now()-d).toFixed(2)}ms`)})})}calculateNodeDiff(e){let t=new Set(e.map(s=>s.id)),o=this.lastVisibleNodeIds??new Set,i=0,r=0;for(let s of t)o.has(s)||i++;for(let s of o)t.has(s)||r++;return this.lastVisibleNodeIds=t,{added:i,removed:r,total:t.size}}},wa=class{flowCore;performanceLogger;constructor(e){this.flowCore=e,this.performanceLogger=new Su}render(){let{nodes:e,edges:t,metadata:o}=this.flowCore.getState(),i=this.flowCore.actionStateManager.linking?.temporaryEdge,{nodes:r,edges:s}=this.process(e,t,o.viewport),a=i?.temporary?[...s,i]:s;this.performanceLogger.withPerformanceLogging(()=>this.flowCore.renderer.draw(r,a,o.viewport),r,this.flowCore.config.debugMode)}},P0=new Set,Pu=class extends wa{constructor(e){super(e)}init(){this.render(),this.flowCore.model.onChange(o=>{this.flowCore.spatialHash.process(o.nodes),this.flowCore.modelLookup.desynchronize(),this.render()});let e=this.flowCore.model.getNodes(),t=this.flowCore.model.getEdges();this.flowCore.initUpdater.start(e,t,()=>A(this,null,function*(){yield this.flowCore.commandHandler.emit("init",{renderedNodeIds:e.map(o=>o.id),renderedEdgeIds:t.map(o=>o.id)})}))}process(e,t){return{nodes:e,edges:t,nodeIds:P0,edgeIds:P0}}isNodeRendered(e){return!0}},Eu=class{flowCore;onIdle;wasPanning=!1;idleTimeout=null;unsubscribeActionState=null;constructor(e,t){this.flowCore=e,this.onIdle=t}init(){this.unsubscribeActionState=this.flowCore.eventManager.on("actionStateChanged",({actionState:e})=>{let t=!!e.panning?.active;this.wasPanning&&!t?this.scheduleIdleRender():t&&this.idleTimeout&&(clearTimeout(this.idleTimeout),this.idleTimeout=null),this.wasPanning=t})}scheduleIdleRender(){this.idleTimeout&&clearTimeout(this.idleTimeout),this.idleTimeout=setTimeout(()=>{this.onIdle(),this.idleTimeout=null},this.flowCore.config.virtualization.idleDelay??100)}destroy(){this.idleTimeout&&(clearTimeout(this.idleTimeout),this.idleTimeout=null),this.unsubscribeActionState&&(this.unsubscribeActionState(),this.unsubscribeActionState=null)}};function E0(n){return!!n}function nI(n,e){let{x:t,y:o,scale:i,width:r,height:s}=n,a=r||1920,d=s||1080,l=-t/i,h=-o/i,g=a/i,_=d/i,D=e*Math.min(1,i),L=Math.max(a,d)*D/i;return{x:l-L,y:h-L,width:g+2*L,height:_+2*L}}function oI(n,e){let t=.25*n.width,o=.25*n.height,i=.1*n.width,r=.1*n.height;return Math.abs(n.x-e.x)<t&&Math.abs(n.y-e.y)<o&&Math.abs(n.width-e.width)<i&&Math.abs(n.height-e.height)<r}function iI(n,e){let t=.4*e.width,o=.4*e.height;return Math.abs(n.x-e.x)>t||Math.abs(n.y-e.y)>o}var Iu=class{cachedResult=null;lastViewportRect=null;lastNodesLength=0;lastEdgesLength=0;hasCache(){return this.cachedResult!==null}isNodeInCache(e){return this.cachedResult?.nodeIds.has(e)??!1}get(e,t){let o=this.cachedResult;return{nodes:e.filter(i=>o.nodeIds.has(i.id)),edges:t.filter(i=>o.edgeIds.has(i.id)),nodeIds:o.nodeIds,edgeIds:o.edgeIds}}set(e,t,o,i){this.cachedResult=e,this.lastViewportRect=i,this.lastNodesLength=t.length,this.lastEdgesLength=o.length}canUse(e,t,o){return!(!this.cachedResult||!this.lastViewportRect)&&e===this.lastNodesLength&&t===this.lastEdgesLength&&oI(this.lastViewportRect,o)}hasMovedTooFar(e){return!this.lastViewportRect||iI(e,this.lastViewportRect)}invalidateViewport(){this.lastViewportRect=null}invalidate(){this.cachedResult=null,this.lastViewportRect=null,this.lastNodesLength=0,this.lastEdgesLength=0}},ku=class{flowCore;constructor(e){this.flowCore=e}resolve(e){let t=this.getPrimaryVisibleIds(e),{edges:o,edgeIds:i,externalNodeIds:r}=this.collectVisibleEdges(t),{nodes:s,nodeIds:a}=this.buildNodeList(t,r);return{nodes:s,edges:o,nodeIds:a,edgeIds:i}}getPrimaryVisibleIds(e){let t=new Set(this.flowCore.spatialHash.queryIds(e));return this.addGroupDescendants(t),t}addGroupDescendants(e){let t=this.flowCore.modelLookup.nodesMap,o=Array.from(e);for(let i of o){let r=t.get(i);if(r&&yo(r))for(let s of this.flowCore.modelLookup.getAllDescendantIds(i))e.add(s)}}collectVisibleEdges(e){let t=[],o=new Set,i=new Set;for(let r of e)for(let s of this.flowCore.modelLookup.getConnectedEdges(r))o.has(s.id)||(t.push(s),o.add(s.id),e.has(s.source)||i.add(s.source),e.has(s.target)||i.add(s.target));return{edges:t,edgeIds:o,externalNodeIds:i}}buildNodeList(e,t){let o=this.flowCore.modelLookup.nodesMap,i=new Set(e);for(let s of t)i.add(s);let r=[];for(let s of i){let a=o.get(s);a&&r.push(a)}return{nodes:r,nodeIds:i}}};var Du=class{onZoomEnd;lastScale=null;isZooming=!1;zoomIdleTimeout=null;constructor(e){this.onZoomEnd=e}handleScaleChange(e){this.lastScale!==null&&this.lastScale!==e&&(this.isZooming=!0,this.scheduleZoomIdle()),this.lastScale=e}getIsZooming(){return this.isZooming}destroy(){this.zoomIdleTimeout&&(clearTimeout(this.zoomIdleTimeout),this.zoomIdleTimeout=null)}scheduleZoomIdle(){this.zoomIdleTimeout&&clearTimeout(this.zoomIdleTimeout),this.zoomIdleTimeout=setTimeout(()=>{this.isZooming=!1,this.zoomIdleTimeout=null,this.onZoomEnd()},300)}},I0=new Set,Tu=class extends wa{cache=new Iu;visibleElementsResolver;zoomTracker;idleRenderScheduler;lastNodesRef=null;constructor(e){super(e),this.visibleElementsResolver=new ku(e),this.zoomTracker=new Du(()=>this.invalidateAndRender()),this.idleRenderScheduler=new Eu(e,()=>this.invalidateAndRender())}init(){this.flowCore.spatialHash.process(this.flowCore.model.getNodes()),this.flowCore.model.onChange(r=>{r.nodes!==this.lastNodesRef&&(this.flowCore.spatialHash.process(r.nodes),this.flowCore.modelLookup.desynchronize(),this.lastNodesRef=r.nodes),this.render()}),this.idleRenderScheduler.init(),this.render();let{nodes:e,edges:t,metadata:o}=this.flowCore.getState(),i=this.process(e,t,o.viewport);this.flowCore.initUpdater.start(i.nodes,i.edges,()=>A(this,null,function*(){yield this.flowCore.commandHandler.emit("init",{renderedNodeIds:i.nodes.map(r=>r.id),renderedEdgeIds:i.edges.map(r=>r.id)})}))}process(e,t,o){let i=this.flowCore.config.virtualization;if(!E0(o))return{nodes:e,edges:t,nodeIds:I0,edgeIds:I0};this.zoomTracker.handleScaleChange(o.scale);let r=nI(o,i.padding),s=this.cache.hasCache();if(this.zoomTracker.getIsZooming()&&s)return this.cache.get(e,t);if(this.flowCore.actionStateManager.isPanning()&&s)return this.cache.get(e,t);if(this.cache.canUse(e.length,t.length,r))return this.cache.get(e,t);let a=this.visibleElementsResolver.resolve(r);return this.cache.set(a,e,t,r),a}destroy(){this.zoomTracker.destroy(),this.idleRenderScheduler.destroy()}isNodeRendered(e){return!E0(this.flowCore.model.getMetadata().viewport)||this.cache.isNodeInCache(e)}invalidateAndRender(){this.cache.invalidateViewport(),this.render()}},rI=(n,e)=>`[ngDiagram] Spatial hash error: Attempted to remove from non-existent cell "${n}".
|
|
87
|
+
|
|
88
|
+
Node ID: ${e}
|
|
89
|
+
|
|
90
|
+
This may indicate a state synchronization issue.`,sI=(n,e)=>`[ngDiagram] Spatial hash error: Attempted to update non-existent cell "${n}".
|
|
91
|
+
|
|
92
|
+
Node ID: ${e}
|
|
93
|
+
|
|
94
|
+
This may indicate a state synchronization issue.`,Mu=class{cellSize=100;grid=new Map;idToCells=new Map;idToRect=new Map;process(e){let t=new Set(this.idToRect.keys()),o=new Set;for(let i of e){o.add(i.id);let r=this.idToRect.get(i.id);if(r){let s=this.nodeToRect(i);Gc(r,s)||this.updateInGrid(s)}else this.addToGrid(this.nodeToRect(i))}for(let i of t.difference(o))this.removeFromGrid(i)}query(e){let t=[];return this._query(e,o=>t.push(o)),t}queryIds(e){let t=[];return this._query(e,o=>t.push(o.id)),t}_query(e,t){let o=this.getCells(e),i=new Set;for(let r of o){let s=this.grid.get(r);if(s)for(let a of s)i.has(a.id)||(i.add(a.id),F0(a,e)&&t(a))}}nodeToRect(e){let t=e.measuredBounds??mo(e);return p({id:e.id},t)}addToCell(e,t){this.grid.has(e)||this.grid.set(e,[]),this.grid.get(e).push(t)}removeFromCell(e,t){let o=this.grid.get(e);if(!o)return void console.error(rI(e,t));let i=o.filter(r=>r.id!==t);this.grid.set(e,i)}updateInCell(e,t){let o=this.grid.get(e);if(!o)return void console.error(sI(e,t.id));let i=o.filter(({id:r})=>r!==t.id);this.grid.set(e,[...i,t])}addToGrid(e){let t=this.getCells(e);for(let o of t)this.addToCell(o,e);this.idToCells.set(e.id,t),this.idToRect.set(e.id,e)}updateInGrid(e){let t=this.getCells(e),o=new Set(t),i=new Set(this.idToCells.get(e.id)||[]),r=i.difference(o),s=o.difference(i),a=o.intersection(i);for(let d of r)this.removeFromCell(d,e.id);for(let d of s)this.addToCell(d,e);for(let d of a)this.updateInCell(d,e);this.idToRect.set(e.id,e),this.idToCells.set(e.id,t)}removeFromGrid(e){let t=this.idToCells.get(e);if(t){for(let o of t){this.removeFromCell(o,e);let i=this.grid.get(o);i&&i.length===0&&this.grid.delete(o)}this.idToCells.delete(e),this.idToRect.delete(e)}}getCellsRange(e,t){return[Math.floor(e/this.cellSize),Math.floor((e+t)/this.cellSize)]}getCells(e){let[t,o]=this.getCellsRange(e.x,e.width),[i,r]=this.getCellsRange(e.y,e.height),s=[];for(let a=t;a<=o;a++)for(let d=i;d<=r;d++)s.push(`${a}-${d}`);return s}},lh=(n,e)=>{if(Ru(n)&&!n.size||Ru(e)&&!e.size)return!1;let t=k0(n),o=k0(e);if(t.length===0||o.length===0)return!1;let i=[...T0(t),...T0(o)];for(let r of i){let s=D0(t,r),a=D0(o,r);if(!aI(s,a))return!1}return!0},Ru=n=>"position"in n,k0=n=>Ru(n)?n.size?Kc(Tt(n),n.angle??0):[]:Kc(n,n.angle??0),D0=(n,e)=>{let t=n[0].x*e.x+n[0].y*e.y,o=t;for(let i=1;i<n.length;i++){let r=n[i].x*e.x+n[i].y*e.y;r<t&&(t=r),r>o&&(o=r)}return{min:t,max:o}},aI=(n,e)=>!(n.max<e.min||e.max<n.min),T0=n=>{let e=[];for(let t=0;t<n.length;t++){let o=n[t],i=n[(t+1)%n.length],r={x:i.x-o.x,y:i.y-o.y},s=Math.sqrt(r.x*r.x+r.y*r.y);s>0&&e.push({x:-r.y/s,y:r.x/s})}return e},ch=(n,e,t)=>{let o=fa(e,t),i=n.spatialHash.queryIds(o),r=[];for(let s of i){let a=n.modelLookup.getNodeById(s);a&&lh(o,a)&&r.push(a)}return r},dI=(n,e,t)=>ch(n,e,t).sort((o,i)=>qc(Tt(o),fa(e,1))-qc(Tt(i),fa(e,1)))[0]||null,lI=(n,e,t)=>{let o=new Map;ch(n,e,t).forEach(s=>{o.set(s,s.measuredPorts||[])});let i=1/0,r=null;for(let[s,a]of o.entries())for(let d of a){let{x:l,y:h}=Tt(d),g=qc(Tt({size:d.size,position:{x:l+s.position.x,y:h+s.position.y}}),fa(e,1));g<=t&&g<i&&(i=g,r=d)}return r},cI=(n,e,t=!0)=>{let o=n.spatialHash.queryIds(e),i=[];for(let r of o){let s=n.modelLookup.getNodeById(r);s&&lh(e,s)&&i.push(s)}return t?i:i.filter(r=>{let s=Tt(r);return lS(e,s)})};function uI(n,e){let t=typeof e=="string",o=t?n.modelLookup.getNodeById(e):e;if(!o)return[];let i=t?o.measuredBounds??mo(o):mo(o),r=n.spatialHash.queryIds(i),s=[];for(let a of r){if(a===o.id)continue;let d=n.modelLookup.getNodeById(a);d&&lh(o,d)&&s.push(d)}return s}function pI(n,e){return{emit:(t,...o)=>A(null,null,function*(){if(n.isAborted())throw new Error("Cannot emit on rolled back transaction");yield e.commandHandler.emitInternal(t,!0,...o)}),abort:()=>{n.abort()},savepoint:t=>{if(n.isAborted())throw new Error("Cannot create savepoint on rolled back transaction");n.addSavepoint(t)},rollbackTo:t=>{if(n.isAborted())throw new Error("Cannot rollback to savepoint on already rolled back transaction");n.rollback(t)},transaction:(t,o)=>e.transactionManager.transaction(t,o),hasChanges:()=>n.hasChanges(),isDirty:()=>!n.isAborted()&&n.hasChanges(),getQueuedUpdates:()=>n.getQueue()}}var Nu=class{name;parent;flowCore;queue=[];savepoints=new Map;_isAborted=!1;children=[];_context=null;constructor(e,t,o){this.name=e,this.parent=t,this.flowCore=o,t&&t.children.push(this)}get context(){return this._context||(this._context=pI(this,this.flowCore)),this._context}isAborted(){return this._isAborted}abort(){this._isAborted||(this._isAborted=!0,this.queue=[],this.savepoints.clear(),this.children.forEach(e=>e.abort()))}addSavepoint(e){this.ensureNotAborted(),this.savepoints.set(e,this.queue.length)}rollback(e){if(this.ensureNotAborted(),e===void 0)return this.queue=[],this.savepoints.clear(),void this.children.forEach(i=>i.rollback());let t=this.savepoints.get(e);if(t===void 0)throw new Error(`Savepoint '${e}' not found`);this.queue=this.queue.slice(0,t);let o=[];this.savepoints.forEach((i,r)=>{i>t&&o.push(r)}),o.forEach(i=>this.savepoints.delete(i)),this.children.forEach(i=>i.rollback())}commit(){this.ensureNotAborted(),this.parent&&this.mergeToParent()}canCommit(){return!this._isAborted&&this.hasChanges()}ensureNotAborted(){if(this._isAborted)throw new Error("Cannot perform operation on aborted transaction")}hasChanges(){return this.queue.length>0||this.children.some(e=>e.hasChanges())}getQueue(){return[...this.queue]}queueUpdate(e,t){this.ensureNotAborted(),this.queue.push({update:e,actionTypes:t})}getState(){return{name:this.name,queue:[...this.queue],savepoints:new Map(this.savepoints),isAborted:this._isAborted,parent:this.parent}}mergeToParent(){this.ensureNotAborted(),this.parent&&this.queue.forEach(e=>{this.parent.queueUpdate(e.update,e.actionTypes)})}getMergedUpdates(){if(this._isAborted)return{mergedUpdate:{},commandsCount:0,actionTypes:[]};let e=this.queue.length,t=new Set([this.name]),o=[],i=[],r=[],s=[],a=[],d=[],l=[];for(let{update:g,actionTypes:_}of this.queue)_.forEach(D=>t.add(D)),g.nodesToAdd?.length&&o.push(g.nodesToAdd),g.nodesToRemove?.length&&i.push(g.nodesToRemove),g.nodesToUpdate?.length&&r.push(g.nodesToUpdate),g.edgesToAdd?.length&&s.push(g.edgesToAdd),g.edgesToRemove?.length&&a.push(g.edgesToRemove),g.edgesToUpdate?.length&&d.push(g.edgesToUpdate),g.metadataUpdate&&l.push(g.metadataUpdate);let h={};return o.length>0&&(h.nodesToAdd=o.flat()),i.length>0&&(h.nodesToRemove=i.flat()),r.length>0&&(h.nodesToUpdate=r.flat()),s.length>0&&(h.edgesToAdd=s.flat()),a.length>0&&(h.edgesToRemove=a.flat()),d.length>0&&(h.edgesToUpdate=d.flat()),l.length>0&&(h.metadataUpdate=Object.assign({},...l)),{mergedUpdate:h,commandsCount:e,actionTypes:[...t]}}},Ou=class{flowCore;transactionStack=[];pendingOptions=null;constructor(e){this.flowCore=e}transaction(e,t,o){return A(this,null,function*(){let[i,r,s]=this.parseArgs(e,t,o),a=this.getCurrentTransaction(),d=new Nu(i,a,this.flowCore);!a&&s&&(this.pendingOptions=s),this.transactionStack.push(d);try{if(yield r(d.context),!d.isAborted()){if(!a){let{mergedUpdate:l,commandsCount:h,actionTypes:g}=d.getMergedUpdates();return{results:l,commandsCount:h,actionTypes:g}}d.mergeToParent()}return{results:{},commandsCount:0,actionTypes:[]}}catch(l){throw d.rollback(),l}finally{this.transactionStack.pop(),a||(this.pendingOptions=null)}})}getCurrentOptions(){return this.pendingOptions}queueUpdate(e,t){let o=this.getCurrentTransaction();if(!o)throw new Error("No active transaction. Cannot queue update.");o.queueUpdate(e,t)}isActive(){return this.transactionStack.length>0}getTransactionName(){let e=this.getCurrentTransaction();return e?e.getState().name:null}getCurrentTransaction(){return this.transactionStack[this.transactionStack.length-1]||null}parseArgs(e,t,o){if(typeof e=="function")return["transaction",e,t];if(typeof t!="function")throw new Error("Callback is required when transaction name is provided");return[e,t,o]}};var Au=class{initializedPorts=new Map;initializedLabels=new Map;nodeSizes=new Map;portRects=new Map;edgeLabelSizes=new Map;portsToMeasure=new Set;labelsToMeasure=new Set;nodesToMeasure=new Set;measuredNodes=new Set;measuredPorts=new Set;measuredLabels=new Set;trackNodeMeasurement(e,t){this.nodeSizes.set(e,t),St(t)&&this.measuredNodes.add(e)}trackPortMeasurement(e,t,o,i){let r=this.getCompoundId(e,t);this.portRects.set(r,{size:o,position:i}),St(o)&&Ut(i)&&this.measuredPorts.add(r)}trackLabelMeasurement(e,t,o){let i=this.getCompoundId(e,t);this.edgeLabelSizes.set(i,o),St(o)&&this.measuredLabels.add(i)}addPort(e,t){let o=this.getCompoundId(e,t.id);this.initializedPorts.set(o,t),this.portsToMeasure.add(o)}addLabel(e,t){let o=this.getCompoundId(e,t.id);this.initializedLabels.set(o,t),this.labelsToMeasure.add(o)}collectAlreadyMeasuredItems(e,t){for(let o of e){this.nodesToMeasure.add(o.id),St(o.size)&&this.measuredNodes.add(o.id);for(let i of o.measuredPorts??[])if(this.trackPreExistingPort(o.id,i.id),St(i.size)&&Ut(i.position)){let r=this.getCompoundId(o.id,i.id);this.measuredPorts.add(r)}}for(let o of t)for(let i of o.measuredLabels??[])if(this.trackPreExistingLabel(o.id,i.id),St(i.size)){let r=this.getCompoundId(o.id,i.id);this.measuredLabels.add(r)}}allEntitiesHaveMeasurements(){return[...this.nodesToMeasure].every(e=>this.measuredNodes.has(e))&&this.measuredPorts.size===this.portsToMeasure.size&&this.measuredLabels.size===this.labelsToMeasure.size}applyToDiagramState(e){let l=e.getState(),{nodes:t,edges:o}=l,i=gn(l,["nodes","edges"]),r=this.groupPortsByNode(),s=this.groupLabelsByEdge(),a=this.updateNodes(t,r),d=this.updateEdges(o,s);e.setState(C(p({},i),{nodes:a,edges:d}))}getCompoundId(e,t){return`${e}->${t}`}splitCompoundId(e){let[t,o]=e.split("->");return{entityId:t,itemId:o}}trackPreExistingPort(e,t){let o=this.getCompoundId(e,t);this.portsToMeasure.add(o)}trackPreExistingLabel(e,t){let o=this.getCompoundId(e,t);this.labelsToMeasure.add(o)}groupPortsByNode(){let e=new Map;for(let[t,o]of this.initializedPorts.entries()){let{entityId:i}=this.splitCompoundId(t),r=e.get(i)||[];r.push(o),e.set(i,r)}return e}groupLabelsByEdge(){let e=new Map;for(let[t,o]of this.initializedLabels.entries()){let{entityId:i}=this.splitCompoundId(t),r=e.get(i)||[];r.push(o),e.set(i,r)}return e}updateNodes(e,t){return e.map(o=>{let i=this.nodeSizes.get(o.id)||o.size,r=t.get(o.id),s=new Map;if(o.measuredPorts)for(let d of o.measuredPorts)s.set(d.id,d);if(r)for(let d of r)s.set(d.id,d);let a=s.size>0?Array.from(s.values()):void 0;return a&&(a=a.map(d=>{let l=this.getCompoundId(o.id,d.id),h=this.portRects.get(l);return h?C(p({},d),{size:h.size,position:h.position}):d})),C(p({},o),{size:i,measuredPorts:a})})}updateEdges(e,t){return e.map(o=>{let i=t.get(o.id),r=new Map;if(o.measuredLabels)for(let a of o.measuredLabels)r.set(a.id,a);if(i)for(let a of i)r.set(a.id,a);let s=r.size>0?Array.from(r.values()):void 0;return s&&(s=s.map(a=>{let d=this.getCompoundId(o.id,a.id),l=this.edgeLabelSizes.get(d);return l?C(p({},a),{size:l}):a})),C(p({},o),{measuredLabels:s})})}},Lu=class{queue=[];isProcessing=!1;get isFinishing(){return this.isProcessing}get length(){return this.queue.length}startFinishing(){this.isProcessing=!0}enqueue(e){this.queue.push(e)}processAll(e){if(this.queue.length!==0){for(let t of this.queue)switch(t.method){case"addPort":e.addPort(...t.args);break;case"addEdgeLabel":e.addEdgeLabel(...t.args);break;case"applyNodeSize":e.applyNodeSize(...t.args);break;case"applyPortChanges":e.applyPortChanges(...t.args);break;case"applyEdgeLabelChanges":e.applyEdgeLabelChanges(...t.args);break;case"deleteEdgeLabel":e.deleteEdgeLabel(...t.args)}this.queue=[]}}},ba=class{shouldWait;stabilityDelay;stabilityTimeout=null;stabilityPromise;resolveStability=()=>null;eventCount=0;constructor(e,t){this.shouldWait=e,this.stabilityDelay=t,this.stabilityPromise=new Promise(o=>{this.resolveStability=o})}notify(){this.eventCount++,this.resetStabilityTimer()}waitForStability(){return this.shouldWait?this.eventCount===0&&this.resetStabilityTimer():this.resolveStability(),this.stabilityPromise}resetStabilityTimer(){this.stabilityTimeout&&clearTimeout(this.stabilityTimeout),this.stabilityTimeout=setTimeout(()=>{this.resolveStability(),this.stabilityTimeout=null},this.stabilityDelay)}};var hI=n=>`[ngDiagram] Initialization stabilization failed.
|
|
95
|
+
|
|
96
|
+
Error: ${n instanceof Error?n.message:String(n)}
|
|
97
|
+
|
|
98
|
+
The diagram will force-finish initialization without waiting for all measurements.
|
|
99
|
+
This may result in:
|
|
100
|
+
\u2022 Ports without measured positions/sizes
|
|
101
|
+
\u2022 Edge labels without measured sizes
|
|
102
|
+
\u2022 Incorrect initial edge routing
|
|
103
|
+
|
|
104
|
+
This usually indicates:
|
|
105
|
+
\u2022 Model provided to ng-diagram was not created with initializeModel() or initializeModelAdapter() (for custom ModelAdapter)
|
|
106
|
+
\u2022 Resize observers not functioning properly
|
|
107
|
+
\u2022 Port/label elements not rendering
|
|
108
|
+
\u2022 Very slow initial render (> 50ms between additions)
|
|
109
|
+
|
|
110
|
+
The diagram will still be functional, but initial layout may be incomplete.
|
|
111
|
+
|
|
112
|
+
Documentation: https://www.ngdiagram.dev/docs/guides/model-initialization/
|
|
113
|
+
`,Fu=class{flowCore;isInitialized=!1;entitiesStabilized=!1;portStabilityDetector;labelStabilityDetector;initState;lateArrivalQueue;onCompleteCallback;measurementTimeout=null;constructor(e){this.flowCore=e,this.initState=new Au,this.lateArrivalQueue=new Lu}start(e,t,o){this.onCompleteCallback=o;let i=t.length>0;this.portStabilityDetector=new ba(e.length>0,50),this.labelStabilityDetector=new ba(i,50),this.initState.collectAlreadyMeasuredItems(e,t),Promise.all([this.portStabilityDetector.waitForStability(),this.labelStabilityDetector.waitForStability()]).then(()=>{this.entitiesStabilized=!0,this.startMeasurementTimeout(),this.tryFinish()}).catch(r=>{console.error(hI(r)),this.forceFinish()})}applyNodeSize(e,t){this.lateArrivalQueue.isFinishing?this.lateArrivalQueue.enqueue({method:"applyNodeSize",args:[e,t]}):(this.initState.trackNodeMeasurement(e,t),this.tryFinish())}applyNodeSizes(e){for(let{id:t,size:o}of e)this.applyNodeSize(t,o)}addPort(e,t){this.lateArrivalQueue.isFinishing?this.lateArrivalQueue.enqueue({method:"addPort",args:[e,t]}):(this.initState.addPort(e,t),this.portStabilityDetector.notify())}applyPortChanges(e,t){if(this.lateArrivalQueue.isFinishing)this.lateArrivalQueue.enqueue({method:"applyPortChanges",args:[e,t]});else{for(let{portId:o,portChanges:i}of t)i.size&&i.position&&this.initState.trackPortMeasurement(e,o,i.size,i.position);this.tryFinish()}}addEdgeLabel(e,t){this.lateArrivalQueue.isFinishing?this.lateArrivalQueue.enqueue({method:"addEdgeLabel",args:[e,t]}):(this.initState.addLabel(e,t),this.labelStabilityDetector.notify())}deleteEdgeLabel(e,t){this.lateArrivalQueue.enqueue({method:"deleteEdgeLabel",args:[e,t]})}applyEdgeLabelChanges(e,t){if(this.lateArrivalQueue.isFinishing)this.lateArrivalQueue.enqueue({method:"applyEdgeLabelChanges",args:[e,t]});else{for(let{labelId:o,labelChanges:i}of t)i.size&&this.initState.trackLabelMeasurement(e,o,i.size);this.tryFinish()}}tryFinish(){this.lateArrivalQueue.isFinishing||this.isInitialized||this.entitiesStabilized&&this.initState.allEntitiesHaveMeasurements()&&this.finish()}finish(){return A(this,null,function*(){this.clearMeasurementTimeout(),this.lateArrivalQueue.startFinishing(),this.initState.applyToDiagramState(this.flowCore),this.onCompleteCallback&&(yield this.onCompleteCallback()),this.isInitialized=!0,this.lateArrivalQueue.processAll(this.flowCore.internalUpdater)})}forceFinish(){this.finish()}startMeasurementTimeout(){this.measurementTimeout=setTimeout(()=>{this.isInitialized||(console.warn("[InitUpdater] Measurement timeout reached. Some entities may not be measurable (e.g., display: none). Ensure the model provided to ng-diagram was created with initializeModel() or initializeModelAdapter() (for custom ModelAdapter).",{nodes:{expected:this.initState.nodesToMeasure.size,measured:this.initState.measuredNodes.size},ports:{expected:this.initState.portsToMeasure.size,measured:this.initState.measuredPorts.size},labels:{expected:this.initState.labelsToMeasure.size,measured:this.initState.measuredLabels.size}}),this.forceFinish())},2e3)}clearMeasurementTimeout(){this.measurementTimeout!==null&&(clearTimeout(this.measurementTimeout),this.measurementTimeout=null)}},zu=class{flowCore;onPortAddsFlush=e=>this.flowCore.commandHandler.emit("addPortsBulk",{additions:e});onPortUpdatesFlush=e=>this.flowCore.commandHandler.emit("updatePortsBulk",{updates:e});onPortDeletesFlush=e=>this.flowCore.commandHandler.emit("deletePortsBulk",{deletions:e});onLabelAddsFlush=e=>this.flowCore.commandHandler.emit("addEdgeLabelsBulk",{additions:e});onLabelUpdatesFlush=e=>this.flowCore.commandHandler.emit("updateEdgeLabelsBulk",{updates:e});onLabelDeletesFlush=e=>this.flowCore.commandHandler.emit("deleteEdgeLabelsBulk",{deletions:e});constructor(e){this.flowCore=e}applyNodeSize(e,t){this.applyNodeSizes([{id:e,size:t}])}applyNodeSizes(e){let t=this.flowCore.actionStateManager.isResizing(),o=e.filter(({id:i,size:r})=>{let s=this.flowCore.getNodeById(i);return!(!s||s.size&&t||Gc(Tt(s),Tt({size:r})))});o.length>0&&this.flowCore.commandHandler.emit("updateNodes",{nodes:o})}addPort(e,t){this.flowCore.portBatchProcessor.processAdd(e,t,this.onPortAddsFlush)}deletePort(e,t){this.flowCore.portBatchProcessor.processDelete(e,t,this.onPortDeletesFlush)}applyPortChanges(e,t){let o=this.flowCore.getNodeById(e);if(!o)return;let i=this.filterUnchangedPortUpdates(o,t);if(i.length!==0)for(let r of i)this.flowCore.portBatchProcessor.processUpdate(e,r,this.onPortUpdatesFlush)}addEdgeLabel(e,t){this.flowCore.labelBatchProcessor.processAdd(e,t,this.onLabelAddsFlush)}deleteEdgeLabel(e,t){this.flowCore.labelBatchProcessor.processDelete(e,t,this.onLabelDeletesFlush)}applyEdgeLabelChanges(e,t){let o=this.filterUnchangedLabelUpdates(e,t);if(o.length!==0)for(let i of o)this.flowCore.labelBatchProcessor.processUpdate(e,i,this.onLabelUpdatesFlush)}filterUnchangedPortUpdates(e,t){let o=new Map((e.measuredPorts??[]).map(i=>[i.id,i]));return t.filter(({portId:i,portChanges:r})=>{let s=o.get(i);if(!s)return!1;if(r.side!==void 0&&r.side!==s.side||r.type!==void 0&&r.type!==s.type)return!0;if("size"in r||"position"in r){let a=r.size??s.size,d=r.position??s.position;if(!Gc(Tt(s),Tt({size:a,position:d})))return!0}return!1})}filterUnchangedLabelUpdates(e,t){let o=this.flowCore.getEdgeById(e);if(!o)return[];let i=new Map((o.measuredLabels??[]).map(r=>[r.id,r]));return t.filter(({labelId:r,labelChanges:s})=>{let a=i.get(r);return a?s.positionOnEdge!==void 0&&s.positionOnEdge!==a.positionOnEdge||s.size!==void 0&&(!a.size||!sh(a.size,s.size)):!1})}},$u=class{renderer;inputEventsRouter;environment;_model;_config;initUpdater;internalUpdater;updateSemaphore=new Yc(1);commandHandler;middlewareManager;spatialHash;modelLookup;transactionManager;portBatchProcessor;labelBatchProcessor;actionStateManager;edgeRoutingManager;eventManager;shortcutManager;measurementTracker;directRenderStrategy;virtualizedRenderStrategy;getFlowOffset;getViewportSize;constructor(e,t,o,i,r,s,a,d={}){this.renderer=t,this.inputEventsRouter=o,this.environment=i,this._model=e,this._config=CE(d,this),this.environment=i,this.commandHandler=new Zc(this),this.spatialHash=new Mu,this.initUpdater=new Fu(this),this.internalUpdater=new zu(this),this.modelLookup=new _u(this),this.eventManager=new Wc,this.actionStateManager=new $c(this.eventManager),this.directRenderStrategy=new Pu(this),this.virtualizedRenderStrategy=new Tu(this),this.middlewareManager=new Cu(this,r),this.transactionManager=new Ou(this),this.portBatchProcessor=new xu(this.getNodeById.bind(this)),this.labelBatchProcessor=new Jc(this.getEdgeById.bind(this)),this.measurementTracker=new eu,this.edgeRoutingManager=new jc(this.config.edgeRouting.defaultRouting,()=>this.config.edgeRouting||{}),this.getFlowOffset=s||(()=>({x:0,y:0})),this.getViewportSize=a||(()=>({width:0,height:0})),this.shortcutManager=new Xc(this),this.inputEventsRouter.registerDefaultCallbacks(this),this.init()}destroy(){this.virtualizedRenderStrategy.destroy(),this.eventManager.offAll(),this.model.destroy()}init(){this.initializeViewportSize(),this.renderStrategy.init()}initializeViewportSize(){let{width:e,height:t}=this.getViewportSize();if(e>0&&t>0){let o=this.model.getMetadata();this.model.updateMetadata(C(p({},o),{viewport:C(p({},o.viewport),{width:e,height:t})}))}}get model(){return this._model}getEnvironment(){return this.environment}get config(){return this._config}updateConfig(e){this._config=rh(this._config,e)}registerMiddleware(e){return this.middlewareManager.register(e)}unregisterMiddleware(e){this.middlewareManager.unregister(e)}getState(){return{nodes:this.model.getNodes(),edges:this.model.getEdges(),metadata:this.model.getMetadata()}}get renderStrategy(){return this.isVirtualizationActive?this.virtualizedRenderStrategy:this.directRenderStrategy}setState(e){this.model.updateNodes(e.nodes),this.model.updateEdges(e.edges),this.model.updateMetadata(e.metadata),this.modelLookup.desynchronize()}transaction(e,t,o){return A(this,null,function*(){let i,r;if(typeof e=="function")r=t,i=yield this.transactionManager.transaction(e,r??{});else{let s=t;if(!s)throw new Error("Callback is required when transaction name is provided");r=o,i=yield this.transactionManager.transaction(e,s,r??{})}return i.commandsCount>0&&(r?.waitForMeasurements&&this.measurementTracker.requestTracking({discoveryWindowMs:r._measurementDiscoveryWindowTimeout,debounceMs:r._measurementDebounceTimeout}),yield this.applyUpdate(i.results,i.actionTypes)),r?.waitForMeasurements&&(yield this.measurementTracker.waitForMeasurements()),i})}applyUpdate(e,t){return A(this,null,function*(){let o=Array.isArray(t)?t:[t];if(this.transactionManager.isActive())this.transactionManager.queueUpdate(e,o);else{yield this.updateSemaphore.acquire();try{let i=this.getState(),r=yield this.middlewareManager.execute(i,e,o);r?(this.setState(r),this.eventManager.flushDeferredEmits()):this.eventManager.clearDeferredEmits()}finally{this.updateSemaphore.release()}}})}applyViewportOnlyUpdate(e){let t=this.model.getMetadata(),o=t.viewport,i=p(p({},o),e);i.x===o.x&&i.y===o.y&&i.scale===o.scale||(this.model.updateMetadata(C(p({},t),{viewport:i})),this.eventManager.emit("viewportChanged",{viewport:i,previousViewport:o}))}clientToFlowPosition(e){let{x:t,y:o,scale:i}=this.model.getMetadata().viewport,{x:r,y:s}=this.getFlowOffset();return{x:(e.x-t-r)/i,y:(e.y-o-s)/i}}flowToClientPosition(e){let{x:t,y:o,scale:i}=this.model.getMetadata().viewport,{x:r,y:s}=this.getFlowOffset();return{x:e.x*i+t+r,y:e.y*i+o+s}}clientToFlowViewportPosition(e){let{x:t,y:o}=this.getFlowOffset();return{x:e.x-t,y:e.y-o}}getNodeById(e){return this.modelLookup.getNodeById(e)}getEdgeById(e){return this.modelLookup.getEdgeById(e)}getNodesInRange(e,t){return ch(this,e,t)}getNearestNodeInRange(e,t){return dI(this,e,t)}getNearestPortInRange(e,t){return lI(this,e,t)}getConnectedEdges(e){return this.modelLookup.getConnectedEdges(e)}getConnectedNodes(e){return this.modelLookup.getConnectedNodes(e)}getNodeEnds(e){return this.modelLookup.getNodeEnds(e)}getChildren(e){return this.modelLookup.getChildren(e)}getChildrenNested(e){return this.modelLookup.getAllDescendants(e)}isNestedChild(e,t){return this.modelLookup.isNodeDescendantOfGroup(e,t)}getParentHierarchy(e){return this.modelLookup.getParentChain(e)}getOverlappingNodes(e){return uI(this,e)}isNodeCurrentlyRendered(e){return this.renderStrategy.isNodeRendered(e)}getScale(){return this.model.getMetadata().viewport.scale}getViewport(){return this.model.getMetadata().viewport}get updater(){return this.initUpdater.isInitialized?this.internalUpdater:this.initUpdater}get isInitialized(){return this.initUpdater.isInitialized}get isVirtualizationActive(){return this.config.virtualization.enabled}setDebugMode(e){e?(window.flowCore=this,this.middlewareManager.isRegistered(ha.name)||this.registerMiddleware(ha)):(delete window.flowCore,this.unregisterMiddleware(ha.name))}},Qe=class{flow;constructor(e){this.flow=e}},Bu=class extends Qe{startPoint;isBoxSelecting=!1;handle(e){switch(e.phase){case"start":this.startPoint=e.lastInputPoint,this.isBoxSelecting=!0;break;case"continue":if(!this.isBoxSelecting||!this.flow.config.boxSelection.realtime)break;this.boxSelect(e);break;case"end":if(!this.isBoxSelecting)break;this.boxSelect(e),this.flow.commandHandler.emit("selectEnd"),this.startPoint=void 0,this.isBoxSelecting=!1}}boxSelect(e){if(!this.startPoint)return;let t=e.lastInputPoint,{x:o,y:i}=this.flow.clientToFlowPosition(this.startPoint),{x:r,y:s}=this.flow.clientToFlowPosition(t),a={x:Math.min(o,r),y:Math.min(i,s),width:Math.abs(r-o),height:Math.abs(s-i)},d=this.flow.model.getEdges(),l=new Set(cI(this.flow,a,this.flow.config.boxSelection.partialInclusion).map(g=>g.id)),h=d.filter(g=>l.has(g.source)&&l.has(g.target)).map(g=>g.id);this.flow.commandHandler.emit("select",{nodeIds:[...l],edgeIds:h,multiSelection:!1})}},Hu=class extends Qe{handle(){this.flow.commandHandler.emit("copy")}},Uu=class extends Qe{handle(){this.flow.commandHandler.emit("cut")}},Vu=class extends Qe{handle(){this.flow.commandHandler.emit("deleteSelection")}},fI=["top","bottom","left","right"],gI=n=>`[ngDiagram] Unknown keyboard move direction: "${n}"
|
|
114
|
+
|
|
115
|
+
Valid directions are: ${fI.map(e=>`'${e}'`).join(", ")}
|
|
116
|
+
|
|
117
|
+
This indicates a programming error. Check keyboard shortcut configuration.
|
|
118
|
+
|
|
119
|
+
Documentation: https://www.ngdiagram.dev/docs/guides/shortcut-manager/
|
|
120
|
+
`,M0={top:{x:0,y:-1},bottom:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0}},ju=class extends Qe{handle(e){let t=this.flow.modelLookup.getSelectedNodesWithChildren({directOnly:!1}).filter(r=>r.draggable??!0);if(t.length===0)return;let o=this.getRootNodes(t),i=this.getDelta(e.direction,o);this.flow.commandHandler.emit("moveNodesBy",{nodes:t,delta:i}),this.flow.config.viewportPanningEnabled&&this.panViewportIfNeeded(e.direction,t,i)}getRootNodes(e){let t=new Set(e.map(o=>o.id));return e.filter(o=>o.groupId==null||!t.has(o.groupId))}getDelta(e,t){let{computeSnapForNodeDrag:o,defaultDragSnap:i}=this.flow.config.snapping,r=t.reduce((a,d)=>{let{width:l,height:h}=o(d)??i;return{width:Math.max(a.width,l),height:Math.max(a.height,h)}},{width:0,height:0}),s=M0[e];if(!s)throw new Error(gI(e));return{x:s.x*r.width,y:s.y*r.height}}panViewportIfNeeded(e,t,o){let i=this.calculatePanAmount(e,t,o);i>0&&this.emitViewportPan(e,i)}calculatePanAmount(e,t,o){let{viewport:i}=this.flow.model.getMetadata();if(!i.width||!i.height)return 0;let r=this.getViewportBounds(i.x,i.y,i.width,i.height,i.scale);return t.reduce((s,a)=>{let d=this.calculateNodeOverflow(a,o,e,r);return Math.max(s,d)},0)}getViewportBounds(e,t,o,i,r){let{edgePanningThreshold:s}=this.flow.config.selectionMoving,a=s/r;return{left:-e/r+a,top:-t/r+a,right:(-e+o)/r-a,bottom:(-t+i)/r-a}}calculateNodeOverflow(e,t,o,i){let r=this.getSnappedPosition(e,t),s=this.getNodeBounds(e,r);switch(o){case"left":return i.left-s.left;case"right":return s.right-i.right;case"top":return i.top-s.top;case"bottom":return s.bottom-i.bottom}}getNodeBounds(e,t){let o=ah({x:t.x,y:t.y,width:e.size?.width??100,height:e.size?.height??50},e.angle??0);return{left:o.x,top:o.y,right:o.x+o.width,bottom:o.y+o.height}}getSnappedPosition(e,t){return Va(this.flow.config,e,{x:e.position.x+t.x,y:e.position.y+t.y})}emitViewportPan(e,t){let{viewport:o}=this.flow.model.getMetadata(),i=t*o.scale,r=M0[e];this.flow.commandHandler.emit("moveViewportBy",{x:r.x===0?0:-r.x*i,y:r.y===0?0:-r.y*i})}},Wu=class extends Qe{handle(e){let t=0,o=0;switch(e.direction){case"top":o=-10;break;case"bottom":o=10;break;case"left":t=-10;break;case"right":t=10;break;default:return}this.flow.commandHandler.emit("moveViewportBy",{x:t,y:o})}},mI=n=>`[ngDiagram] Linking event missing target node.
|
|
121
|
+
|
|
122
|
+
Event details:
|
|
123
|
+
\u2022 Phase: ${n.phase}
|
|
124
|
+
\u2022 Port ID: ${n.portId}
|
|
125
|
+
\u2022 Target type: ${n.targetType}
|
|
126
|
+
\u2022 Pointer position: (${n.lastInputPoint.x}, ${n.lastInputPoint.y})
|
|
127
|
+
|
|
128
|
+
This indicates a programming error. Linking start events must have a target node.
|
|
129
|
+
|
|
130
|
+
Documentation: https://www.ngdiagram.dev/docs/guides/edges/edges/
|
|
131
|
+
`,Gu=class extends Qe{handle(e){switch(e.phase){case"start":{let t=e.target?.id;if(!t)throw new Error(mI(e));this.flow.actionStateManager.linking={sourceNodeId:t,sourcePortId:e.portId,temporaryEdge:null},this.flow.commandHandler.emit("startLinking",{source:t,sourcePort:e.portId});break}case"continue":{if(!this.flow.actionStateManager.isLinking())break;let t=this.flow.clientToFlowPosition(e.lastInputPoint);this.flow.config.viewportPanningEnabled&&e.panningForce&&this.flow.commandHandler.emit("moveViewportBy",{x:e.panningForce.x,y:e.panningForce.y}),this.flow.commandHandler.emit("moveTemporaryEdge",{position:t});break}case"end":{if(!this.flow.actionStateManager.isLinking())break;let t=this.flow.clientToFlowPosition(e.lastInputPoint);this.flow.commandHandler.emit("finishLinking",{position:t});break}}}},qu=class extends Qe{handle(e){let{data:t,lastInputPoint:o}=e;this.flow.commandHandler.emit("paletteDropNode",{node:C(p({},t),{id:this.flow.config.computeNodeId(),position:this.flow.clientToFlowPosition({x:o.x,y:o.y})})})}},Ku=class extends Qe{lastPoint;handle(e){switch(e.phase){case"start":this.lastPoint=e.lastInputPoint,this.flow.actionStateManager.panning={active:!0};break;case"continue":if(!this.flow.actionStateManager.isPanning()||!this.lastPoint)break;this.flow.commandHandler.emit("moveViewportBy",{x:e.lastInputPoint.x-this.lastPoint.x,y:e.lastInputPoint.y-this.lastPoint.y}),this.lastPoint=e.lastInputPoint;break;case"end":this.lastPoint=void 0,this.flow.actionStateManager.clearPanning()}}},Yu=class extends Qe{lastPoint;accumulatedDelta={x:0,y:0};rafScheduled=!1;handle(e){switch(e.phase){case"start":this.lastPoint=e.lastInputPoint,this.accumulatedDelta={x:0,y:0},this.flow.actionStateManager.panning={active:!0};break;case"continue":{if(!this.flow.actionStateManager.isPanning()||!this.lastPoint)break;let t=e.lastInputPoint.y-this.lastPoint.y;this.accumulatedDelta.x+=e.lastInputPoint.x-this.lastPoint.x,this.accumulatedDelta.y+=t,this.lastPoint=e.lastInputPoint,this.scheduleFlush();break}case"end":this.flushDelta(),this.lastPoint=void 0,this.rafScheduled=!1,this.flow.actionStateManager.clearPanning()}}scheduleFlush(){this.rafScheduled||(this.rafScheduled=!0,requestAnimationFrame(()=>{this.flushDelta(),this.rafScheduled=!1}))}flushDelta(){let{x:e,y:t}=this.accumulatedDelta;e===0&&t===0||(this.flow.commandHandler.emit("moveViewportBy",{x:e,y:t}),this.accumulatedDelta={x:0,y:0})}};function yI(n){return n.isVirtualizationActive?new Yu(n):new Ku(n)}var Zu=class extends Qe{handle(e){this.flow.commandHandler.emit("paste",this.getPasteParameters(e))}getPasteParameters(e){return e.lastInputPoint?{position:this.flow.clientToFlowPosition(e.lastInputPoint)}:{}}};var Xu=class extends Qe{lastPointerPosition;startPoint;isMoving=!1;hasMoved=!1;handle(e){return A(this,null,function*(){switch(e.phase){case"start":{let t=this.flow.clientToFlowPosition(e.lastInputPoint);this.lastPointerPosition=t,this.startPoint=t,this.isMoving=!0,this.flow.actionStateManager.dragging={nodeIds:[],modifiers:p({},e.modifiers),accumulatedDeltas:new Map,movementStarted:!1};break}case"continue":{let t=this.flow.modelLookup.getSelectedNodesWithChildren({directOnly:!1}).filter(a=>a.draggable??!0),o=this.flow.modelLookup.getSelectedNodes();if(t.length===0||!this.isMoving||!this.lastPointerPosition||!this.startPoint)return;let i=this.flow.clientToFlowPosition(e.lastInputPoint);if(!this.hasMoved){let a=i.x-this.startPoint.x,d=i.y-this.startPoint.y;Math.sqrt(a*a+d*d)>=5&&(this.hasMoved=!0,this.flow.actionStateManager.dragging={nodeIds:t.map(l=>l.id),modifiers:p({},e.modifiers),movementStarted:!0,accumulatedDeltas:new Map},yield this.flow.commandHandler.emit("moveNodesStart"))}let r=i.x-this.lastPointerPosition.x,s=i.y-this.lastPointerPosition.y;this.flow.actionStateManager.dragging&&(this.flow.actionStateManager.dragging.modifiers=p({},e.modifiers)),this.hasMoved&&(this.flow.transaction("moveNodes",a=>A(this,null,function*(){yield a.emit("moveNodesBy",{delta:{x:r,y:s},nodes:t}),this.updateGroupHighlightOnDrag(a,i,o)})),this.panDiagramOnScreenEdge(e.panningForce)),this.lastPointerPosition=i;break}case"end":{let t=this.flow.clientToFlowPosition(e.lastInputPoint);this.hasMoved&&(yield this.handleDrop(t),yield this.flow.commandHandler.emit("moveNodesStop")),this.flow.actionStateManager.clearDragging(),this.lastPointerPosition=void 0,this.startPoint=void 0,this.isMoving=!1,this.hasMoved=!1}}})}updateGroupHighlightOnDrag(e,t,o){let i=this.getTopGroupAtPoint(t),r=this.flow.actionStateManager.highlightGroup?.highlightedGroupId;i&&o.some(s=>s.groupId!==i.id)?r!==i.id&&e.emit("highlightGroup",{groupId:i.id,nodes:o}):r&&e.emit("highlightGroupClear")}getTopGroupAtPoint(e){return vS(this.flow.getNodesInRange(e,1).filter(t=>yo(t)&&!t.selected),this.flow.getState().nodes)[0]}handleDrop(e){return A(this,null,function*(){let t=this.getTopGroupAtPoint(e),o=this.flow.modelLookup.getSelectedNodes();if(t)yield this.flow.commandHandler.emit("addToGroup",{groupId:t.id,nodeIds:o.map(i=>i.id)});else for(let i of o)i.groupId===void 0||o.find(r=>r.id===i.groupId)||(yield this.flow.commandHandler.emit("removeFromGroup",{groupId:i.groupId,nodeIds:[i.id]}))})}panDiagramOnScreenEdge(e){e&&this.flow.commandHandler.emit("moveViewportBy",{x:e.x,y:e.y})}},Qu=class extends Qe{handle(){this.flow.model.redo()}},vI=n=>`[ngDiagram] Resize event missing target node.
|
|
132
|
+
|
|
133
|
+
Event details:
|
|
134
|
+
\u2022 Phase: ${n.phase}
|
|
135
|
+
\u2022 Direction: ${n.direction}
|
|
136
|
+
\u2022 Target type: ${n.targetType}
|
|
137
|
+
\u2022 Pointer position: (${n.lastInputPoint.x}, ${n.lastInputPoint.y})
|
|
138
|
+
|
|
139
|
+
This indicates a programming error. Resize events must have a target node.
|
|
140
|
+
|
|
141
|
+
Documentation: https://www.ngdiagram.dev/docs/guides/nodes/resizing/`,Ju=class extends Qe{handle(e){return A(this,null,function*(){if(!e.target)throw new Error(vI(e));let{x:t,y:o}=this.flow.clientToFlowPosition(e.lastInputPoint);switch(e.phase){case"start":{let i=this.flow.getNodeById(e.target.id);i&&i.size&&(this.flow.actionStateManager.resize={startX:t,startY:o,startWidth:i.size.width,startHeight:i.size.height,startNodePositionX:i.position.x,startNodePositionY:i.position.y,resizingNode:i},yield this.flow.commandHandler.emit("resizeNodeStart"));break}case"continue":{let i=this.flow.actionStateManager.resize;if(!i)break;let{startHeight:r,startNodePositionX:s,startNodePositionY:a,startWidth:d,startX:l,startY:h}=i,g=Math.round(t-l),_=Math.round(o-h),D=d,L=r,q=s,Y=a;switch(e.direction){case"top-left":D=d-g,q=s+(d-D),L=r-_,Y=a+(r-L);break;case"top":L=r-_,Y=a+(r-L);break;case"top-right":D=d+g,L=r-_,Y=a+(r-L);break;case"right":D=d+g;break;case"bottom-right":D=d+g,L=r+_;break;case"bottom":L=r+_;break;case"bottom-left":D=d-g,q=s+(d-D),L=r+_;break;case"left":D=d-g,q=s+(d-D)}let J={id:e.target.id,disableAutoSize:!0,size:{width:Math.round(D),height:Math.round(L)}};q===s&&Y===a||(J.position={x:Math.round(q),y:Math.round(Y)}),this.flow.commandHandler.emit("resizeNode",J);break}case"end":yield this.flow.commandHandler.emit("resizeNodeStop"),this.flow.actionStateManager.clearResize()}})}};var wI=n=>`[ngDiagram] Rotate event missing target node.
|
|
142
|
+
|
|
143
|
+
Event details:
|
|
144
|
+
\u2022 Phase: ${n.phase}
|
|
145
|
+
\u2022 Target type: ${n.targetType}
|
|
146
|
+
\u2022 Pointer position: (${n.lastInputPoint.x}, ${n.lastInputPoint.y})
|
|
147
|
+
\u2022 Center: (${n.center.x}, ${n.center.y})
|
|
148
|
+
|
|
149
|
+
This indicates a programming error. Rotation events must have a target node.
|
|
150
|
+
|
|
151
|
+
Documentation: https://www.ngdiagram.dev/docs/guides/nodes/rotation/`,ep=class extends Qe{handle(e){return A(this,null,function*(){let{center:t,lastInputPoint:o,target:i,phase:r}=e;if(!i)throw new Error(wI(e));let s=i?.id,a=this.flow.clientToFlowPosition(o);switch(r){case"start":{let d=this.flow.getNodeById(s);if(!d)return;let l=lt.angleBetweenPoints(t,a);this.flow.actionStateManager.rotation={startAngle:l,initialNodeAngle:d.angle??0,nodeId:s},yield this.flow.commandHandler.emit("rotateNodeStart");break}case"continue":{let d=this.flow.actionStateManager.rotation;if(!d||d.nodeId!==s||lt.distanceBetweenPoints(a,t)<30)return;let l=lt.angleBetweenPoints(t,a);this.flow.commandHandler.emit("rotateNodeTo",{nodeId:s,angle:d.initialNodeAngle+(l-d.startAngle)});break}case"end":yield this.flow.commandHandler.emit("rotateNodeStop"),this.flow.actionStateManager.clearRotation()}})}},tp=class extends Qe{handle(){this.flow.commandHandler.emit("selectAll"),this.flow.commandHandler.emit("selectEnd")}},np=class extends Qe{handle(e){if(e.phase==="end")return void this.flow.commandHandler.emit("selectEnd");let t=this.getTargetElements(e),o=this.flow.shortcutManager.matchesAction("multiSelection",{modifiers:e.modifiers});if(!t&&!o)return void this.flow.commandHandler.emit("deselectAll");if(!t)return;let{target:i}=e,r=i?.selected;r&&o?this.flow.commandHandler.emit("deselect",t):this.flow.commandHandler.emit("select",C(p({},t),{multiSelection:r||o}))}getTargetElements(e){return e.targetType!=="diagram"&&e.target?e.targetType==="node"?{nodeIds:[e.target.id],edgeIds:void 0}:e.targetType==="edge"?{nodeIds:void 0,edgeIds:[e.target.id]}:void 0:null}},op=class extends Qe{handle(){this.flow.model.undo()}};var ip=class extends Qe{idleTimeout;handle(e){let{deltaX:t,deltaY:o}=e;t===0&&o===0||(this.activatePanning(),this.flow.commandHandler.emit("moveViewportBy",{x:-t||0,y:-o||0}))}activatePanning(){this.flow.actionStateManager.panning={active:!0},this.idleTimeout!==void 0&&clearTimeout(this.idleTimeout),this.idleTimeout=setTimeout(()=>{this.flow.actionStateManager.clearPanning(),this.idleTimeout=void 0},100)}},rp=class extends Qe{handle(e){let{centerPoint:{x:t,y:o},zoomFactor:i}=e,{x:r,y:s,scale:a}=this.flow.getState().metadata.viewport,{x:d,y:l}=this.flow.getFlowOffset(),h=(t-r-d)/a,g=(o-s-l)/a;a*=i,a=lt.clamp({min:this.flow.config.zoom.min,value:a,max:this.flow.config.zoom.max}),r+=((t-r-d)/a-h)*a,s+=((o-s-l)/a-g)*a,this.flow.commandHandler.emit("zoom",{x:r,y:s,scale:a})}},sp=class{handlers={};emit(e){let t=this.handlers[e.name];if(t)return t.handle(e);console.warn(`No handler registered for event: ${e.name}`)}register(e,t){this.handlers[e]=t}registerDefaultCallbacks(e){this.register("copy",new Hu(e)),this.register("select",new np(e)),this.register("selectAll",new tp(e)),this.register("panning",yI(e)),this.register("keyboardPanning",new Wu(e)),this.register("wheelPanning",new ip(e)),this.register("pointerMoveSelection",new Xu(e)),this.register("keyboardMoveSelection",new ju(e)),this.register("resize",new Ju(e)),this.register("paste",new Zu(e)),this.register("deleteSelection",new Vu(e)),this.register("zoom",new rp(e)),this.register("linking",new Gu(e)),this.register("rotate",new ep(e)),this.register("paletteDrop",new qu(e)),this.register("cut",new Uu(e)),this.register("boxSelection",new Bu(e)),this.register("undo",new op(e)),this.register("redo",new Qu(e))}hasHandler(e){return!!this.handlers[e]}},Ir=class n{get os(){return this.detectOS()}get browser(){return this.detectBrowser()}get runtime(){return this.isClient?"web":"node"}get isClient(){return this.checkIfClient()}detectOS(){if(!this.isClient)return null;let e=window.navigator.userAgent;return/iPhone|iPad|iPod/.test(e)?"iOS":/Mac/.test(e)?"MacOS":/Win/.test(e)?"Windows":/Android/.test(e)?"Android":/Linux/.test(e)?"Linux":"Other"}detectBrowser(){if(!this.isClient)return null;let e=window.navigator.userAgent;return/OPR/.test(e)?"Opera":/Edge|Edg/.test(e)?"Edge":/Chrome/.test(e)?"Chrome":/Firefox/.test(e)?"Firefox":/Safari/.test(e)?"Safari":/Trident/.test(e)?"IE":"Unknown"}checkIfClient(){return typeof window<"u"&&typeof document<"u"}now(){return this.isClient?performance.now():Date.now()}generateId(){return this.isClient&&typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).substring(2,15)}`}static \u0275fac=function(t){return new(t||n)};static \u0275prov=j({token:n,factory:n.\u0275fac,providedIn:"root"})},ft=class n extends sp{environment=f(Ir);getBaseEvent(e){return{modifiers:this.getModifiers(e),id:this.environment.generateId(),timestamp:this.environment.now()}}eventGuards={isPointerEvent:this.isPointerEvent.bind(this),isKeyboardEvent:this.isKeyboardEvent.bind(this),isWheelEvent:this.isWheelEvent.bind(this),isDomEvent:this.isDomEvent.bind(this),withPrimaryModifier:this.withPrimaryModifier.bind(this),withSecondaryModifier:this.withSecondaryModifier.bind(this),withShiftModifier:this.withShiftModifier.bind(this),withMetaModifier:this.withMetaModifier.bind(this),withoutModifiers:this.withoutModifiers.bind(this),withPrimaryButton:this.withPrimaryButton.bind(this),isArrowKeyPressed:this.isArrowKeyPressed.bind(this),isKeyPressed:this.isKeyPressed.bind(this),isKeyComboPressed:this.isKeyComboPressed.bind(this)};keysMap={arrows:{up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight"},keys:{delete:"Delete",backspace:"Backspace"}};getPrimaryModifierKey(){return this.environment.isClient&&this.environment.os==="MacOS"?"metaKey":"ctrlKey"}isPointerEvent(e){return this.environment.isClient&&e instanceof PointerEvent}isKeyboardEvent(e){return this.environment.isClient&&e instanceof KeyboardEvent}isWheelEvent(e){return this.environment.isClient&&e instanceof WheelEvent}isDomEvent(e){return this.isPointerEvent(e)||this.isKeyboardEvent(e)||this.isWheelEvent(e)}getModifiers(e){return this.isDomEvent(e)?{primary:e[this.getPrimaryModifierKey()],secondary:e.altKey,shift:e.shiftKey,meta:e.metaKey}:{primary:!1,secondary:!1,shift:!1,meta:!1}}withPrimaryModifier(e){return this.getModifiers(e).primary}withSecondaryModifier(e){return this.getModifiers(e).secondary}withShiftModifier(e){return this.getModifiers(e).shift}withMetaModifier(e){return this.getModifiers(e).meta}withoutModifiers(e){let t=this.getModifiers(e);return Object.values(t).every(o=>o===!1)}withPrimaryButton(e){return this.isPointerEvent(e)&&(e.button===void 0||e.button===0)}isArrowKeyPressed(e){return this.isKeyboardEvent(e)&&Object.values(this.keysMap.arrows).includes(e.key)}isKeyPressed(e){return t=>this.isKeyboardEvent(t)&&t.key===e}isKeyComboPressed(e,...t){return o=>{if(!this.isKeyboardEvent(o))return!1;let i=this.getModifiers(o);return!!t.every(r=>i[r])&&this.isKeyPressed(e)(o)}}static \u0275fac=(()=>{let e;return function(o){return(e||(e=Nt(n)))(o||n)}})();static \u0275prov=j({token:n,factory:n.\u0275fac})},vn=class n{clear(){throw new Error("Method not implemented.")}isInitialized=U(!1);viewportPannable=U(!0);nodes=U([]);edges=U([]);viewport=U({x:0,y:0,scale:1});draw(e,t,o){this.nodes.set(e),this.edges.set(t),this.viewport.set(o)}static \u0275fac=function(t){return new(t||n)};static \u0275prov=j({token:n,factory:n.\u0275fac})},Oe=class n{renderer=f(vn);inputEventsRouter=f(ft);environment=f(Ir);flowCore=null;_isInitialized=U(!1);isInitialized=this._isInitialized.asReadonly();init(e,t,o,i,r){this.flowCore=new $u(e,this.renderer,this.inputEventsRouter,this.environment,t,o,i,r),this._isInitialized.set(!0)}destroy(){this.flowCore&&(this.flowCore.destroy(),this.flowCore=null,this._isInitialized.set(!1))}provide(){if(!this.flowCore)throw new Error(`[ngDiagram] Library engine not initialized yet.
|
|
152
|
+
|
|
153
|
+
To fix this, wait for initialization to complete using one of these methods:
|
|
154
|
+
\u2022 Use "isInitialized" signal from NgDiagramService
|
|
155
|
+
\u2022 Use "diagramInit" event handler passed to NgDiagramComponent
|
|
156
|
+
|
|
157
|
+
Documentation: https://www.ngdiagram.dev/docs/guides/model-initialization/#waiting-for-initialization
|
|
158
|
+
`);return this.flowCore}static \u0275fac=function(t){return new(t||n)};static \u0275prov=j({token:n,factory:n.\u0275fac})},Ca=class n{flowCoreProvider=f(Oe);element;cachedOffset=null;isInteractionActive=!1;getFlowOffset=()=>{if(this.isInteractionActive&&this.cachedOffset)return this.cachedOffset;let e=this.element.getBoundingClientRect(),t={x:e.left,y:e.top};return this.isInteractionActive&&(this.cachedOffset=t),t};initialize(e){this.element=e,this.flowCoreProvider.provide().eventManager.on("actionStateChanged",t=>{let{actionState:o}=t,i=!!(o.dragging||o.linking||o.resize||o.rotation||o.panning||o.selection);i&&!this.isInteractionActive?this.isInteractionActive=!0:!i&&this.isInteractionActive&&(this.isInteractionActive=!1,this.cachedOffset=null)})}invalidateCache(){this.cachedOffset=null}reset(){this.cachedOffset=null,this.isInteractionActive=!1}static \u0275fac=function(t){return new(t||n)};static \u0275prov=j({token:n,factory:n.\u0275fac})},Xn=class n{ngZone=f(en);observer=null;observedElements=new WeakMap;entityIndex=new Map;config=null;rafId=null;pendingEntries=[];constructor(){this.ngZone.runOutsideAngular(()=>{this.observer=new ResizeObserver(e=>{if(this.pendingEntries.push(...e),this.config?.onObserverActivity){let t=[];for(let o of e){let i=this.observedElements.get(o.target);i&&t.push(i)}t.length>0&&this.config.onObserverActivity(t)}this.rafId||(this.rafId=requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.processBatch()})}))})})}configure(e){this.config=e}observe(e,t){this.observedElements.set(e,t),this.addToEntityIndex(e,t),this.observer?.observe(e)}unobserve(e){let t=this.observedElements.get(e);t&&(this.removeFromEntityIndex(e,t),this.observedElements.delete(e)),this.observer?.unobserve(e)}invalidate(e){this.observedElements.get(e)&&(this.observer?.unobserve(e),this.observer?.observe(e))}getMetadata(e){return this.observedElements.get(e)}invalidateNode(e){this.invalidateByKey(`node:${e}`)}invalidateEdgeLabels(e){this.invalidateByKey(`edge:${e}`)}invalidateAll(){let e=new Set;for(let t of this.entityIndex.values())for(let o of t)e.has(o)||(e.add(o),this.invalidate(o))}invalidateByKey(e){let t=this.entityIndex.get(e);if(t)for(let o of t)this.invalidate(o)}getEntityKeys(e){switch(e.type){case"node":case"port":return[`node:${e.nodeId}`];case"edge-label":return[`edge:${e.edgeId}`]}}addToEntityIndex(e,t){for(let o of this.getEntityKeys(t)){let i=this.entityIndex.get(o);i||(i=new Set,this.entityIndex.set(o,i)),i.add(e)}}removeFromEntityIndex(e,t){for(let o of this.getEntityKeys(t)){let i=this.entityIndex.get(o);i&&(i.delete(e),i.size===0&&this.entityIndex.delete(o))}}processBatch(){let e=[...this.pendingEntries];this.pendingEntries=[],this.rafId=null,e.length!==0&&this.config&&this.ngZone.run(()=>{this.config.processBatch(e)})}ngOnDestroy(){this.rafId&&cancelAnimationFrame(this.rafId),this.observer?.disconnect(),this.entityIndex.clear()}static \u0275fac=function(t){return new(t||n)};static \u0275prov=j({token:n,factory:n.\u0275fac})},bI=(n,e)=>{let t=n.parentElement;for(;t;){if(t.classList.contains(e))return t;t=t.parentElement}return null},CI=n=>`[ngDiagram] Port measurement failed: Parent node not found.
|
|
159
|
+
|
|
160
|
+
Port ID: ${n}
|
|
161
|
+
|
|
162
|
+
This may occur during DOM updates or node removal.
|
|
163
|
+
|
|
164
|
+
Documentation: https://www.ngdiagram.dev/docs/guides/nodes/ports/
|
|
165
|
+
`,_I=n=>`[ngDiagram] Node measurement failed: Node element not found.
|
|
166
|
+
|
|
167
|
+
Node ID: ${n}
|
|
168
|
+
|
|
169
|
+
This may occur during DOM updates or node removal.
|
|
170
|
+
|
|
171
|
+
Documentation: https://www.ngdiagram.dev/docs/guides/nodes/nodes/
|
|
172
|
+
`,xI=(n,e)=>`[ngDiagram] Port measurement failed: Missing data-port-id attribute.
|
|
173
|
+
|
|
174
|
+
Port element ID: ${n}
|
|
175
|
+
Node ID: ${e}
|
|
176
|
+
|
|
177
|
+
To fix this:
|
|
178
|
+
\u2022 Add [id]="port.id" to port components
|
|
179
|
+
\u2022 Ensure all ports have unique IDs
|
|
180
|
+
|
|
181
|
+
Skipping this port.
|
|
182
|
+
|
|
183
|
+
Documentation: https://www.ngdiagram.dev/docs/guides/nodes/ports/
|
|
184
|
+
`,kr=class n{flowCoreProvider=f(Oe);diagramElement=f(He);getPortData(e){let t=bI(e,"ng-diagram-node");return t?this.measurePort(e,t.getBoundingClientRect(),this.getScale()):(console.error(CI(e.id)),null)}getNodePortsData(e){let t=this.diagramElement.nativeElement.querySelector(`.ng-diagram-node[data-node-id="${e}"]`);if(!t)return console.error(_I(e)),[];let o=t.querySelectorAll("[data-port-id]"),i=[],r=t.getBoundingClientRect(),s=this.getScale();return o.forEach(a=>{let d=a.getAttribute("data-port-id");if(!d)return void console.error(xI(a.id,e));let l=this.measurePort(a,r,s);i.push({id:d,size:l.size,position:l.position})}),i}measurePort(e,t,o){let i=e.getBoundingClientRect();return{position:{x:(i.left-t.left)/o,y:(i.top-t.top)/o},size:{width:i.width/o,height:i.height/o}}}getScale(){return this.flowCoreProvider.provide().getState().metadata.viewport.scale}static \u0275fac=function(t){return new(t||n)};static \u0275prov=j({token:n,factory:n.\u0275fac})},SI=n=>`[ngDiagram] Unknown element type: "${n}"
|
|
185
|
+
|
|
186
|
+
Expected types: 'port', 'edge-label', 'node'
|
|
187
|
+
|
|
188
|
+
This indicates a programming error in the resize observer metadata configuration.
|
|
189
|
+
Check that elements are registered with the correct type.`,_a=class n{flowCoreProvider=f(Oe);updatePortsService=f(kr);batchResizeObserver=f(Xn);isInitialized=!1;initialize(){this.isInitialized||(this.batchResizeObserver.configure({processBatch:e=>this.processAllResizes(e),onObserverActivity:e=>{let t=this.flowCoreProvider.provide().measurementTracker;for(let o of e)o.type==="port"||o.type==="node"?t.signalObserverActivity(`node:${o.nodeId}`):o.type==="edge-label"&&t.signalObserverActivity(`edge:${o.edgeId}`)}}),this.isInitialized=!0)}processAllResizes(e){if(!this.isInitialized)return void console.warn("FlowResizeBatchProcessorService not initialized yet, skipping resize processing");let t=[],o=[],i=[];for(let r of e){let s=this.batchResizeObserver.getMetadata(r.target);if(s)switch(s.type){case"port":t.push({metadata:s,entry:r});break;case"edge-label":o.push({metadata:s,entry:r});break;case"node":i.push({metadata:s,entry:r});break;default:throw new Error(SI(s.type))}}t.length>0&&this.processPortBatch(t),o.length>0&&this.processEdgeLabelBatch(o),i.length>0&&this.processNodeBatch(i)}processPortBatch(e){let t=this.flowCoreProvider.provide(),o=new Map,i=new Map;for(let{entry:r,metadata:s}of e){if(s?.type!=="port")continue;let a=this.getBorderBoxSize(r);if(!a)continue;let d=this.updatePortsService.getPortData(r.target);if(!d)continue;let l=t.getNodeById(s.nodeId);if(!l)continue;o.has(s.nodeId)||o.set(s.nodeId,new Map((l.measuredPorts??[]).map(g=>[g.id,g])));let h=o.get(s.nodeId).get(s.portId);h?.size&&!this.isSizeChanged(h.size,a)&&h?.position&&!this.isPositionChanged(h.position,d.position)||(i.has(s.nodeId)||i.set(s.nodeId,[]),i.get(s.nodeId).push({id:s.portId,size:a,position:d.position}))}i.forEach((r,s)=>{t.updater.applyPortChanges(s,va(r))})}processNodeBatch(e){let t=this.flowCoreProvider.provide(),o=t.actionStateManager.isResizing(),i=[];for(let{entry:r,metadata:s}of e){if(s?.type!=="node")continue;let a=this.getBorderBoxSize(r);if(!a)continue;let d=t.getNodeById(s.nodeId);if(d&&(!d.size||this.isSizeChanged(d.size,a))&&(i.push({id:s.nodeId,size:a}),!o)){let l=this.updatePortsService.getNodePortsData(s.nodeId);t.updater.applyPortChanges(s.nodeId,va(l))}}i.length>0&&t.updater.applyNodeSizes(i)}processEdgeLabelBatch(e){let t=this.flowCoreProvider.provide(),o=new Map,i=new Map;for(let{entry:r,metadata:s}of e){if(s?.type!=="edge-label")continue;let a=this.getBorderBoxSize(r);if(!a)continue;let d=t.getEdgeById(s.edgeId);if(!d)continue;o.has(s.edgeId)||o.set(s.edgeId,new Map((d.measuredLabels??[]).map(h=>[h.id,h.size])));let l=o.get(s.edgeId).get(s.labelId);l&&!this.isSizeChanged(l,a)||(i.has(s.edgeId)||i.set(s.edgeId,[]),i.get(s.edgeId).push({labelId:s.labelId,size:a}))}i.forEach((r,s)=>{t.updater.applyEdgeLabelChanges(s,r.map(({labelId:a,size:d})=>({labelId:a,labelChanges:{size:d}})))})}getBorderBoxSize(e){let[t]=e.borderBoxSize;return t?{width:t.inlineSize,height:t.blockSize}:null}isSizeChanged(e,t){return Math.abs(e.width-t.width)>1||Math.abs(e.height-t.height)>1}isPositionChanged(e,t){return Math.abs(e.x-t.x)>1||Math.abs(e.y-t.y)>1}static \u0275fac=function(t){return new(t||n)};static \u0275prov=j({token:n,factory:n.\u0275fac})},xa=class n{draggedNode=U(null);previewId=U(null);onMouseDown(e,t){this.draggedNode.set(e),this.previewId.set(t)}onDragStartFromPalette(e,t){e.dataTransfer&&e.dataTransfer?.setData("text/plain",JSON.stringify(t))}static \u0275fac=function(t){return new(t||n)};static \u0275prov=j({token:n,factory:n.\u0275fac})},Rn=class{flowCoreProvider=f(Oe);get flowCore(){return this.flowCoreProvider.provide()}},wn=class extends Rn{renderer=f(vn);viewport=b(()=>this.renderer.viewport()||{x:0,y:0,scale:1});scale=b(()=>this.renderer.viewport().scale||1);get minZoom(){return this.flowCore.config.zoom.min}get maxZoom(){return this.flowCore.config.zoom.max}canZoomIn=b(()=>this.scale()<this.maxZoom);canZoomOut=b(()=>this.scale()>this.minZoom);clientToFlowPosition(e){return this.flowCore.clientToFlowPosition(e)}clientToFlowViewportPosition(e){return this.flowCore.clientToFlowViewportPosition(e)}flowToClientPosition(e){return this.flowCore.flowToClientPosition(e)}moveViewport(e,t){this.flowCore.commandHandler.emit("moveViewport",{x:e,y:t})}moveViewportBy(e,t){this.flowCore.commandHandler.emit("moveViewportBy",{x:e,y:t})}setViewport(e,t,o){let{min:i,max:r}=this.flowCore.config.zoom;(o<i||o>r)&&console.warn(`[ngDiagram] setViewport: scale ${o} is outside configured bounds [${i}, ${r}] and will be clamped.`);let s=Math.max(i,Math.min(r,o));this.flowCore.commandHandler.emit("zoom",{scale:s,x:e,y:t})}zoom(e,t){let o=this.scale()*e,i=t?.x??this.viewport().x,r=t?.y??this.viewport().y;this.flowCore.commandHandler.emit("zoom",{scale:o,x:i,y:r})}zoomToFit(e){this.flowCore.commandHandler.emit("zoomToFit",e??{})}centerOnNode(e){this.flowCore.commandHandler.emit("centerOnNode",{nodeOrId:e})}centerOnRect(e){this.flowCore.commandHandler.emit("centerOnRect",{rect:e})}},Sa=class{viewportService=f(wn);viewport=this.viewportService.viewport;randomHash=Math.random().toString(36).substring(2,10);size=b(()=>{let e=this.backgroundPattern(),t=e?.nativeElement.getAttribute("staticWidth");return Number(t)*this.viewport().scale});fill=b(()=>this.viewport().scale>.3?"var(--ngd-background-dot-color)":"none");fillOpacity=b(()=>this.viewport().scale-.2);patternTransform=b(()=>{let e=this.size(),t=this.viewport();return`translate(${e?t.x%e:0},${e?t.y%e:0})`})},ap=class n extends Sa{flowCoreService=f(Oe);diagramService=f(At);backgroundPattern=Xe("backgroundPattern");dotSpacing=b(()=>{let e=this.diagramService.config().background;return this.flowCoreService.isInitialized()&&e?e.dotSpacing:0});static \u0275fac=(()=>{let e;return function(o){return(e||(e=Nt(n)))(o||n)}})();static \u0275cmp=B({type:n,selectors:[["ng-diagram-dotted-background"]],viewQuery:function(t,o){t&1&&rt(o.backgroundPattern,N0,5),t&2&&st()},features:[En],decls:5,vars:9,consts:[["backgroundPattern",""],[1,"dotted-background"],["x","0","y","0","patternUnits","userSpaceOnUse",3,"id"],["r","1","cx","1","cy","1"],["width","100%","height","100%","x","0","y","0"]],template:function(t,o){t&1&&(ce(),O(0,"svg",1)(1,"pattern",2,0),bt(3,"circle",3),N(),bt(4,"rect",4),N()),t&2&&(u(),he("id",Ul("ng-diagram-background",o.randomHash)),K("fill",o.fill())("staticWidth",o.dotSpacing())("width",o.size()||o.dotSpacing())("height",o.size()||o.dotSpacing())("patternTransform",o.patternTransform())("fill-opacity",o.fillOpacity()),u(3),K("fill","url(#ng-diagram-background"+o.randomHash+")"))},styles:["[_nghost-%COMP%] .dotted-background[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;top:0;left:0;pointer-events:none}"],changeDetection:1})},dp=class n extends Sa{flowCore=f(Oe);diagramService=f(At);backgroundPattern=Xe("backgroundPattern");cellSize=b(()=>{let e={width:10,height:10};return this.flowCore.isInitialized()?this.diagramService.config().background?.cellSize??e:e});majorLinesFrequency=b(()=>{let e={x:5,y:5};return this.flowCore.isInitialized()?this.diagramService.config().background?.majorLinesFrequency??e:e});patternSize=b(()=>{let e=this.cellSize(),t=this.majorLinesFrequency();return{width:e.width*t.x,height:e.height*t.y}});patternTransform=b(()=>{let e=this.viewport(),t=e.scale??1,o=this.patternSize();return`translate(${o.width?e.x%(o.width*t):0}, ${o.height?e.y%(o.height*t):0}) scale(${t})`});gridLines(){let e=this.cellSize(),t=this.patternSize(),o=[];for(let i=0;i<=t.width;i+=e.width)o.push({x1:i,y1:0,x2:i,y2:t.height,major:i%t.width===0});for(let i=0;i<=t.height;i+=e.height)o.push({x1:0,y1:i,x2:t.width,y2:i,major:i%t.height===0});return o}static \u0275fac=(()=>{let e;return function(o){return(e||(e=Nt(n)))(o||n)}})();static \u0275cmp=B({type:n,selectors:[["ng-diagram-grid-background"]],viewQuery:function(t,o){t&1&&rt(o.backgroundPattern,N0,5),t&2&&st()},features:[En],decls:6,vars:7,consts:[["backgroundPattern",""],[1,"grid-background"],["patternUnits","userSpaceOnUse",3,"id"],["width","100%","height","100%","x","0","y","0"]],template:function(t,o){t&1&&(ce(),O(0,"svg",1)(1,"pattern",2,0),X(3,Xx,1,7,":svg:line",null,nn),N(),bt(5,"rect",3),N()),t&2&&(u(),he("id",Ul("ng-diagram-background",o.randomHash)),K("staticWidth",o.patternSize().width)("width",o.patternSize().width)("height",o.patternSize().height)("patternTransform",o.patternTransform()),u(2),Q(o.gridLines()),u(2),K("fill","url(#ng-diagram-background"+o.randomHash+")"))},styles:[".grid-background[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;top:0;left:0;pointer-events:none}.grid-background[_ngcontent-%COMP%] [stroke][_ngcontent-%COMP%]{vector-effect:non-scaling-stroke}"],changeDetection:1})},Pa=class n{custom=Xe("contentProjection");type=T("dots");hasContent=!1;isDottedBackground=b(()=>this.type()==="dots");ngAfterContentInit(){this.hasContent=(this.custom()?.nativeElement?.childNodes?.length??0)>0}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=B({type:n,selectors:[["ng-diagram-background"]],viewQuery:function(t,o){t&1&&rt(o.custom,th,5),t&2&&st()},inputs:{type:[1,"type"]},ngContentSelectors:Lt,decls:4,vars:1,consts:[["contentProjection",""],[1,"content-projection"]],template:function(t,o){t&1&&(it(),y(0,"div",1,0),Je(2),m(),P(3,e1,3,1,"div")),t&2&&(u(3),E(o.hasContent?-1:3))},dependencies:[ap,dp],styles:[".content-projection[_ngcontent-%COMP%]:not(:empty){width:100%;height:100%}"],changeDetection:1})},ci=class n{_lastPosition={x:0,y:0,timestamp:0};updatePosition(e,t){this._lastPosition={x:e,y:t,timestamp:Date.now()}}getLastPosition(){return p({},this._lastPosition)}hasRecentPosition(){return Date.now()-this._lastPosition.timestamp<5e3}static \u0275fac=function(t){return new(t||n)};static \u0275prov=j({token:n,factory:n.\u0275fac})},lp=class n{cursorPositionService=f(ci);onMouseMove(e){this.cursorPositionService.updatePosition(e.clientX,e.clientY)}static \u0275fac=function(t){return new(t||n)};static \u0275dir=_e({type:n,selectors:[["","ngDiagramCursorPositionTracker",""]],hostBindings:function(t,o){t&1&&R("mousemove",function(r){return o.onMouseMove(r)},kt)}})},cp=class n{node=T.required();highlighted=b(()=>this.node().highlighted??!1);static \u0275fac=function(t){return new(t||n)};static \u0275dir=_e({type:n,selectors:[["","ngDiagramGroupHighlighted",""]],hostVars:4,hostBindings:function(t,o){t&2&&G("ng-diagram-group-highlight",o.highlighted())("ng-diagram-node-wrapper",!0)},inputs:{node:[1,"node"]}})};function PI(n){return!Lg(n)||typeof CSS>"u"||!CSS.supports||CSS.supports("stroke","context-stroke")}var ui=class n{platformId=f(Uo);markers=U(new Map);useInlineMarkers=!PI(this.platformId);registerMarker(e,t){this.markers.update(o=>{let i=new Map(o);return i.set(e,t),i})}unregisterMarker(e){this.markers.update(t=>{let o=new Map(t);return o.delete(e),o})}getMarkerUrl(e,t,o){return`url(#${this.useInlineMarkers?`${e}-${t}-${o}`:e})`}cloneMarkerElement(e,t){let o=this.markers().get(e);if(!o)return null;let i=o.cloneNode(!0);return i.id=t,this.replaceContextColors(i),i}replaceContextColors(e){e.getAttribute("stroke")==="context-stroke"&&e.setAttribute("stroke","currentColor");let t=e.getAttribute("fill");t!=="context-fill"&&t!=="context-stroke"||e.setAttribute("fill","currentColor");for(let o of Array.from(e.children))this.replaceContextColors(o)}static \u0275fac=function(t){return new(t||n)};static \u0275prov=j({token:n,factory:n.\u0275fac})},up=class n{el=f(He);markerRegistry=f(ui);destroyRef=f(je);sourceMarkerId=T();targetMarkerId=T();edgeId=T.required();sourceMarkerRef=null;targetMarkerRef=null;constructor(){xe(()=>{this.cleanup(),this.appendMarkers()}),this.destroyRef.onDestroy(()=>this.cleanup())}appendMarkers(){let e=this.sourceMarkerId();if(e){let o=`${e}-${this.edgeId()}-source`;this.sourceMarkerRef=this.markerRegistry.cloneMarkerElement(e,o),this.sourceMarkerRef&&this.el.nativeElement.appendChild(this.sourceMarkerRef)}let t=this.targetMarkerId();if(t){let o=`${t}-${this.edgeId()}-target`;this.targetMarkerRef=this.markerRegistry.cloneMarkerElement(t,o),this.targetMarkerRef&&this.el.nativeElement.appendChild(this.targetMarkerRef)}}cleanup(){this.sourceMarkerRef?.remove(),this.targetMarkerRef?.remove(),this.sourceMarkerRef=null,this.targetMarkerRef=null}static \u0275fac=function(t){return new(t||n)};static \u0275dir=_e({type:n,selectors:[["","ngDiagramInlineMarkers",""]],inputs:{sourceMarkerId:[1,"sourceMarkerId"],targetMarkerId:[1,"targetMarkerId"],edgeId:[1,"edgeId"]}})},Ea=class n{canHandle(e,t){return t.config.nodeDraggingEnabled&&e.actionName.startsWith("keyboardMoveSelection")&&t.modelLookup.getSelectedNodes().length>0}createEvent(e,t){let o=this.extractDirection(e.actionName);return o?C(p({},t),{name:"keyboardMoveSelection",direction:o}):null}extractDirection(e){return e.endsWith("Up")?"top":e.endsWith("Down")?"bottom":e.endsWith("Left")?"left":e.endsWith("Right")?"right":null}static \u0275fac=function(t){return new(t||n)};static \u0275prov=j({token:n,factory:n.\u0275fac})},Ia=class n{canHandle(e,t){return t.config.viewportPanningEnabled&&e.actionName.startsWith("keyboardPan")&&t.modelLookup.getSelectedNodes().length===0}createEvent(e,t){let o=this.extractDirection(e.actionName);return o?C(p({},t),{name:"keyboardPanning",direction:o}):null}extractDirection(e){return e.endsWith("Up")?"bottom":e.endsWith("Down")?"top":e.endsWith("Left")?"right":e.endsWith("Right")?"left":null}static \u0275fac=function(t){return new(t||n)};static \u0275prov=j({token:n,factory:n.\u0275fac})},ka=class n{cursorPositionTracker=f(ci);canHandle(e){return e.actionName==="paste"}createEvent(e,t){let o=C(p({},t),{name:e.actionName});return this.cursorPositionTracker.hasRecentPosition()&&(o.lastInputPoint=this.cursorPositionTracker.getLastPosition()),o}static \u0275fac=function(t){return new(t||n)};static \u0275prov=j({token:n,factory:n.\u0275fac})},Da=class n{canHandle(e){return e.actionName==="keyboardZoomIn"||e.actionName==="keyboardZoomOut"}createEvent(e,t,o){let i=o.config.zoom.step,r=this.getCenterPoint(o.getViewport()),s=this.extractDirection(e.actionName);return s&&r?C(p({},t),{name:"zoom",centerPoint:r,zoomFactor:s>0?1+i:1-i}):null}extractDirection(e){return e.endsWith("In")?1:e.endsWith("Out")?-1:null}getCenterPoint(e){if(e.width&&e.height)return{x:e.width/2,y:e.height/2}}static \u0275fac=function(t){return new(t||n)};static \u0275prov=j({token:n,factory:n.\u0275fac})},pp=class n{flowCoreProvider=f(Oe);inputEventsRouter=f(ft);keyboardActions=[f(Ia),f(Ea),f(ka),f(Da)];elementRef=f(He);onPointerDown(){this.elementRef.nativeElement.contains(document.activeElement)||this.elementRef.nativeElement.focus()}onKeyDown(e){if(!this.elementRef.nativeElement.contains(document.activeElement))return;let t=this.flowCoreProvider.provide(),o=this.inputEventsRouter.getBaseEvent(e),i=t.shortcutManager.match({key:e.key,modifiers:o.modifiers});if(i.length!==0&&!this.isInputFieldFocused(e)){e.preventDefault();for(let r of i){let s=this.keyboardActions.find(d=>d.canHandle(r,t)),a=s&&s.createEvent(r,o,t);a?this.inputEventsRouter.emit(a):this.inputEventsRouter.hasHandler(r.actionName)&&this.inputEventsRouter.emit(C(p({},o),{name:r.actionName}))}}}isInputFieldFocused(e){let t=e.composedPath()[0]||e.target;return t.hasAttribute("contenteditable")||["INPUT","TEXTAREA","SELECT"].includes(t.tagName)}static \u0275fac=function(t){return new(t||n)};static \u0275dir=_e({type:n,selectors:[["","ngDiagramKeyboardInputs",""]],hostAttrs:["tabindex","0"],hostBindings:function(t,o){t&1&&R("keydown",function(r){return o.onKeyDown(r)},kt)("pointerdown",function(){return o.onPointerDown()})},features:[Go([Ia,Ea,ka,Da])]})},pi=class n{inputEventsRouter=f(ft);emitStart(e,t,o){let i=this.inputEventsRouter.getBaseEvent(e);this.inputEventsRouter.emit(C(p({},i),{name:"linking",phase:"start",target:t,targetType:"node",portId:o,lastInputPoint:{x:e.clientX,y:e.clientY}}))}emitContinue(e,t,o,i=null){let r=this.inputEventsRouter.getBaseEvent(e);this.inputEventsRouter.emit(C(p({},r),{name:"linking",phase:"continue",target:t,targetType:"node",portId:o,lastInputPoint:{x:e.clientX,y:e.clientY},panningForce:i}))}emitEnd(e,t,o){let i=this.inputEventsRouter.getBaseEvent(e);this.inputEventsRouter.emit(C(p({},i),{name:"linking",phase:"end",target:t,targetType:"node",portId:o,lastInputPoint:{x:e.clientX,y:e.clientY}}))}static \u0275fac=function(t){return new(t||n)};static \u0275prov=j({token:n,factory:n.\u0275fac})},hi=class extends Map{},fi=class extends Map{},xt;(function(n){n.Rotate="rotate",n.Resize="resize",n.Move="move",n.BoxSelection="box-selection",n.Linking="linking",n.Panning="panning",n.Zooming="zooming"})(xt||(xt={}));var Nn=class n{currentEvent=U(null);clearCurrentEvent(){this.currentEvent.set(null)}rotateHandled(){return this.currentEvent()===xt.Rotate}resizeHandled(){return this.currentEvent()===xt.Resize}moveHandled(){return this.currentEvent()===xt.Move}boxSelectionHandled(){return this.currentEvent()===xt.BoxSelection}linkingHandled(){return this.currentEvent()===xt.Linking}panningHandled(){return this.currentEvent()===xt.Panning}zoomingHandled(){return this.currentEvent()===xt.Zooming}static \u0275fac=function(t){return new(t||n)};static \u0275prov=j({token:n,factory:n.\u0275fac,providedIn:"root"})},Ta=class n{linkingEventService=f(pi);flowCoreProviderService=f(Oe);touchEventsStateService=f(Nn);target=U(void 0);edgePanningInterval=null;portId=T.required();ngOnDestroy(){this.cleanup()}setTargetNode(e){this.target.set(e)}onPointerDown(e){this.shouldHandle(e)&&(e.linkingHandled=!0,this.touchEventsStateService.currentEvent.set(xt.Linking),document.addEventListener("pointermove",this.onPointerMove),document.addEventListener("pointerup",this.onPointerUp),this.linkingEventService.emitStart(e,this.target(),this.portId()))}onPointerMove=e=>{if(this.touchEventsStateService.panningHandled()||this.touchEventsStateService.zoomingHandled())return void this.onPointerUp(e);let{edgePanningThreshold:t,edgePanningEnabled:o,edgePanningForce:i}=this.flowCoreProviderService.provide().config.linking,r=this.flowCoreProviderService.provide(),s=null;if(o){let{width:a,height:d}=r.getViewport(),{x:l,y:h}=r.getFlowOffset();s=lt.calculateEdgePanningForce({x:l,y:h,width:a??0,height:d??0},{x:e.clientX,y:e.clientY},t,i),s?this.startEdgePanning(e,s):this.stopEdgePanning()}this.linkingEventService.emitContinue(e,this.target(),this.portId(),s)};onPointerUp=e=>{this.linkingEventService.emitEnd(e,this.target(),this.portId()),this.cleanup()};shouldHandle(e){return this.flowCoreProviderService.provide().actionStateManager.isLinking()?(this.target.set(void 0),!1):!(e.boxSelectionHandled||this.touchEventsStateService.panningHandled()||this.touchEventsStateService.zoomingHandled())}cleanup(){this.touchEventsStateService.clearCurrentEvent(),document.removeEventListener("pointermove",this.onPointerMove),document.removeEventListener("pointerup",this.onPointerUp),this.stopEdgePanning()}startEdgePanning(e,t){this.stopEdgePanning(),this.edgePanningInterval=window.setInterval(()=>{this.linkingEventService.emitContinue(e,this.target(),this.portId(),t)},L0)}stopEdgePanning(){this.edgePanningInterval!=null&&(window.clearInterval(this.edgePanningInterval),this.edgePanningInterval=null)}static \u0275fac=function(t){return new(t||n)};static \u0275dir=_e({type:n,selectors:[["","ngDiagramLinkingInput",""]],hostBindings:function(t,o){t&1&&R("pointerdown",function(r){return o.onPointerDown(r)})},inputs:{portId:[1,"portId"]},features:[Go([pi])]})},Dr=class n{inputEventsRouter=f(ft);flowCoreProvider=f(Oe);targetData=T.required();ngOnDestroy(){document.removeEventListener("pointerup",this.onPointerUp)}onPointerDown(e){if(!this.shouldHandle(e))return;e.selectHandled=!0;let t=this.inputEventsRouter.getBaseEvent(e);this.inputEventsRouter.emit(C(p({},t),{name:"select",phase:"start",target:this.targetData(),targetType:this.targetType,lastInputPoint:{x:e.clientX,y:e.clientY}})),document.addEventListener("pointerup",this.onPointerUp)}onPointerUp=e=>{document.removeEventListener("pointerup",this.onPointerUp);let t=this.inputEventsRouter.getBaseEvent(e);this.inputEventsRouter.emit(C(p({},t),{name:"select",phase:"end",target:this.targetData(),targetType:this.targetType,lastInputPoint:{x:e.clientX,y:e.clientY}}))};shouldHandle(e){return!(!this.inputEventsRouter.eventGuards.withPrimaryButton(e)||e.boxSelectionHandled||e.selectHandled||e.linkingHandled&&!this.flowCoreProvider.provide().config.linking.selectNodeOnPortPress)}static \u0275fac=function(t){return new(t||n)};static \u0275dir=_e({type:n,hostBindings:function(t,o){t&1&&R("pointerdown",function(r){return o.onPointerDown(r)})},inputs:{targetData:[1,"targetData"]}})},hp=class n extends Dr{targetType="diagram";targetData=T();static \u0275fac=(()=>{let e;return function(o){return(e||(e=Nt(n)))(o||n)}})();static \u0275dir=_e({type:n,inputs:{targetData:[1,"targetData"]},features:[En]})},fp=class n extends Dr{targetType="edge";targetData=T.required();static \u0275fac=(()=>{let e;return function(o){return(e||(e=Nt(n)))(o||n)}})();static \u0275dir=_e({type:n,inputs:{targetData:[1,"targetData"]},features:[En]})},gp=class n extends Dr{targetType="node";targetData=T.required();static \u0275fac=(()=>{let e;return function(o){return(e||(e=Nt(n)))(o||n)}})();static \u0275dir=_e({type:n,inputs:{targetData:[1,"targetData"]},features:[En]})},EI=(n,e)=>`[ngDiagram] Failed to parse palette drop data as JSON.
|
|
190
|
+
|
|
191
|
+
Received data: "${n}"
|
|
192
|
+
Error: ${e instanceof Error?e.message:String(e)}
|
|
193
|
+
|
|
194
|
+
Note: This error typically occurs when implementing custom drag-and-drop functionality.
|
|
195
|
+
The built-in palette component handles data serialization correctly.
|
|
196
|
+
|
|
197
|
+
To fix custom implementations:
|
|
198
|
+
\u2022 Ensure the dragged data is valid JSON format
|
|
199
|
+
\u2022 Use JSON.stringify() when setting the drag data
|
|
200
|
+
\u2022 Example: event.dataTransfer.setData('text/plain', JSON.stringify({ type: 'node', data: {...} }))
|
|
201
|
+
|
|
202
|
+
The palette drop event will continue with empty data object.
|
|
203
|
+
|
|
204
|
+
Documentation: https://www.ngdiagram.dev/docs/guides/palette/
|
|
205
|
+
`,II=()=>`[ngDiagram] Invalid drop data: expected type "NgDiagramPaletteItem".
|
|
206
|
+
|
|
207
|
+
Received data: "UNKNOWN"
|
|
208
|
+
|
|
209
|
+
To fix this error:
|
|
210
|
+
\u2022 Ensure the dragged data is of type "NgDiagramPaletteItem" and is dragged from a valid palette item.
|
|
211
|
+
|
|
212
|
+
The palette drop event will continue with empty data object.
|
|
213
|
+
|
|
214
|
+
Documentation: https://www.ngdiagram.dev/docs/guides/palette/
|
|
215
|
+
`,mp=class n{inputEventsRouterService=f(ft);paletteService=f(xa);el=f(He);touchMoveListener=e=>this.onGlobalTouchMove(e);touchEndListener=e=>this.onGlobalTouchEnd(e);ngOnInit(){document.addEventListener("touchmove",this.touchMoveListener,{passive:!1}),document.addEventListener("touchend",this.touchEndListener,{passive:!1})}ngOnDestroy(){document.removeEventListener("touchmove",this.touchMoveListener),document.removeEventListener("touchend",this.touchEndListener)}onDrop(e){e.preventDefault();let t=e.dataTransfer?.getData("text/plain"),o=this.inputEventsRouterService.getBaseEvent(e),i={};if(t)try{i=JSON.parse(t)}catch(r){return this.paletteService.draggedNode()?console.error(EI(t,r)):console.warn(II())}this.inputEventsRouterService.emit(C(p({},o),{name:"paletteDrop",data:i,lastInputPoint:{x:e.clientX,y:e.clientY}})),this.paletteService.draggedNode.set(null),this.paletteService.previewId.set(null)}onDragOver(e){e.preventDefault()}onGlobalTouchMove(e){this.paletteService.draggedNode()&&e.preventDefault()}onGlobalTouchEnd(e){let t=this.paletteService.draggedNode();if(!t)return;let o=e.changedTouches[0];if(!o)return;let i=this.el.nativeElement,r=document.elementFromPoint(o.clientX,o.clientY);if(!r||!i.contains(r))return this.paletteService.draggedNode.set(null),void this.paletteService.previewId.set(null);let s=this.inputEventsRouterService.getBaseEvent(e);this.inputEventsRouterService.emit(C(p({},s),{name:"paletteDrop",data:t,lastInputPoint:{x:o.clientX,y:o.clientY}})),this.paletteService.draggedNode.set(null),this.paletteService.previewId.set(null),e.preventDefault(),e.stopPropagation()}static \u0275fac=function(t){return new(t||n)};static \u0275dir=_e({type:n,selectors:[["","ngDiagramPaletteDrop",""]],hostBindings:function(t,o){t&1&&R("drop",function(r){return o.onDrop(r)})("dragover",function(r){return o.onDragOver(r)})}})},Ma=class n{linkingEventService=f(pi);cursorPositionTrackerService=f(ci);node;portId;startLinking(e,t){this.node=e,this.portId=t;let o=this.cursorPositionTrackerService.getLastPosition();this.linkingEventService.emitStart({clientX:o.x,clientY:o.y},e,t),document.addEventListener("pointermove",this.onPointerMove),document.addEventListener("click",this.onDocumentClick,!0),document.addEventListener("touchmove",this.onTouchMove,{passive:!1}),document.addEventListener("touchend",this.onTouchEnd,{passive:!1})}onPointerMove=e=>{e.pointerType!=="touch"&&this.linkingEventService.emitContinue(e)};onTouchMove=e=>{if(e.touches.length!==1)return;e.preventDefault();let t=e.touches[0];this.linkingEventService.emitContinue({clientX:t.clientX,clientY:t.clientY})};onTouchEnd=e=>{e.preventDefault();let t=e.changedTouches[0],o={clientX:t.clientX,clientY:t.clientY};this.cleanup(),this.linkingEventService.emitEnd(o,this.node,this.portId)};onDocumentClick=e=>{this.cleanup(),this.linkingEventService.emitEnd(e,this.node,this.portId)};cleanup(){document.removeEventListener("pointermove",this.onPointerMove),document.removeEventListener("click",this.onDocumentClick,!0),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd)}static \u0275fac=function(t){return new(t||n)};static \u0275prov=j({token:n,factory:n.\u0275fac})},At=class n extends Rn{manualLinkingService=f(Ma);batchResizeObserver=f(Xn);renderer=f(vn);isInitialized=this.renderer.isInitialized.asReadonly();config$=U({});config=this.config$.asReadonly();actionState$=U({});actionState=this.actionState$.asReadonly();constructor(){super(),xe(()=>{this.isInitialized()&&ye(()=>{this.config$.set(this.flowCore.config)})}),xe(e=>{if(!this.isInitialized())return;let t=this.flowCore.eventManager.on("actionStateChanged",o=>{ye(()=>{this.actionState$.set(o.actionState)})});e(()=>t())})}updateConfig(e){this.flowCore.updateConfig(e),this.config$.set(this.flowCore.config)}getEnvironment(){return this.flowCore.getEnvironment()}registerMiddleware(e){return this.flowCore.registerMiddleware(e)}unregisterMiddleware(e){this.flowCore.unregisterMiddleware(e)}registerRouting(e){this.flowCore.edgeRoutingManager.registerRouting(e)}unregisterRouting(e){this.flowCore.edgeRoutingManager.unregisterRouting(e)}getRegisteredRoutings(){return this.flowCore.edgeRoutingManager.getRegisteredRoutings()}setDefaultRouting(e){this.flowCore.edgeRoutingManager.setDefaultRouting(e)}getDefaultRouting(){return this.flowCore.edgeRoutingManager.getDefaultRouting()}startLinking(e,t){this.manualLinkingService.startLinking(e,t)}addEventListener(e,t){return this.flowCore.eventManager.on(e,t)}addEventListenerOnce(e,t){return this.flowCore.eventManager.once(e,t)}removeEventListener(e,t){this.flowCore.eventManager.off(e,t)}removeAllEventListeners(){this.flowCore.eventManager.offAll()}setEventsEnabled(e){this.flowCore.eventManager.setEnabled(e)}areEventsEnabled(){return this.flowCore.eventManager.isEnabled()}hasEventListeners(e){return this.flowCore.eventManager.hasListeners(e)}transaction(e,t){let o=!1,i=this.flowCore.transaction(()=>{let r=e();return r instanceof Promise&&(o=!0),r},t??{});if(t||o)return i}invalidateMeasurements(e){if(e){if(e.nodes)for(let{nodeId:t}of e.nodes)this.batchResizeObserver.invalidateNode(t);if(e.edges)for(let{edgeId:t}of e.edges)this.batchResizeObserver.invalidateEdgeLabels(t)}else this.batchResizeObserver.invalidateAll()}static \u0275fac=function(t){return new(t||n)};static \u0275prov=j({token:n,factory:n.\u0275fac})};function Ra(n,e){let t=kI(e);return!!(n.target&&n.target instanceof HTMLElement)&&n.target.closest(t)}function kI(n){return`[data-no-${n}="true"]`}var yp=class n{inputEventsRouter=f(ft);elementRef=f(He);diagramService=f(At);flowCoreProvider=f(Oe);ngOnDestroy(){document.removeEventListener("pointermove",this.onMouseMove),document.removeEventListener("pointerup",this.onPointerUp)}onPointerDown(e){if(e.pointerType==="touch"||!this.inputEventsRouter.eventGuards.withPrimaryButton(e)||!this.shouldHandle(e))return;this.toggleGrabbingCursor(!0),e.preventDefault(),e.stopPropagation();let t=this.inputEventsRouter.getBaseEvent(e);this.inputEventsRouter.emit(C(p({},t),{name:"panning",phase:"start",target:void 0,targetType:"diagram",lastInputPoint:{x:e.clientX,y:e.clientY}})),document.addEventListener("pointermove",this.onMouseMove),document.addEventListener("pointerup",this.onPointerUp)}onPointerUp=e=>{this.inputEventsRouter.eventGuards.withPrimaryButton(e)&&(this.toggleGrabbingCursor(!1),e.preventDefault(),e.stopPropagation(),this.finishPanning(e))};onWheel(e){if(!this.shouldHandleWheel(e))return;e.preventDefault(),e.stopPropagation();let{deltaX:t,deltaY:o}=e;e.shiftKey&&t===0&&o!==0&&(t=o,o=0);let i=this.inputEventsRouter.getBaseEvent(e);this.inputEventsRouter.emit(C(p({},i),{name:"wheelPanning",deltaX:t,deltaY:o}))}onMouseMove=e=>{if(e.zoomingHandled)return void this.finishPanning(e);e.preventDefault(),e.stopPropagation();let t=this.inputEventsRouter.getBaseEvent(e);this.inputEventsRouter.emit(C(p({},t),{name:"panning",phase:"continue",target:void 0,targetType:"diagram",lastInputPoint:{x:e.clientX,y:e.clientY}}))};finishPanning(e){document.removeEventListener("pointermove",this.onMouseMove),document.removeEventListener("pointerup",this.onPointerUp);let t=this.inputEventsRouter.getBaseEvent(e);this.inputEventsRouter.emit(C(p({},t),{name:"panning",phase:"end",target:void 0,targetType:"diagram",lastInputPoint:{x:e.clientX,y:e.clientY}}))}shouldHandle(e){let{viewportPanningEnabled:t}=this.diagramService.config();return!(!t||Ra(e,"pan")||e.moveSelectionHandled||e.zoomingHandled||e.linkingHandled||e.rotateHandled||e.boxSelectionHandled)}shouldHandleWheel(e){let{viewportPanningEnabled:t}=this.diagramService.config();return!(!t||e.zoomingHandled||Ra(e,"pan")||!this.flowCoreProvider.provide().actionStateManager.isPanning()&&(this.inputEventsRouter.eventGuards.withPrimaryModifier(e)||e.ctrlKey))}toggleGrabbingCursor(e){this.elementRef.nativeElement.classList.toggle("panning",e)}static \u0275fac=function(t){return new(t||n)};static \u0275dir=_e({type:n,selectors:[["","ngDiagramPanning",""]],hostBindings:function(t,o){t&1&&R("pointerdown",function(r){return o.onPointerDown(r)})("wheel",function(r){return o.onWheel(r)})}})},vp=class n{elementRef=f(He);flowCoreProvider=f(Oe);inputEventsRouterService=f(ft);touchEventsStateService=f(Nn);touchCache=[];lastDistance;initialDistance;isZoomingActive=!1;ZOOM_TRIGGER_DELTA=40;onTouchStart(e){for(let t of e.changedTouches)this.touchCache.push(t);this.touchCache.length===2&&(this.lastDistance=this.computeDistance(),this.initialDistance=this.lastDistance,this.isZoomingActive=!1)}onTouchEnd(e){for(let t of e.changedTouches)this.removeTouchFromCache(t);this.touchCache.length<2&&(this.lastDistance=void 0,this.initialDistance=void 0,this.isZoomingActive=!1,this.touchCache=[],this.touchEventsStateService.clearCurrentEvent())}onTouchMove(e){for(let l of e.changedTouches)this.updateTouchInCache(l);if(this.touchCache.length!==2||this.lastDistance===void 0||this.initialDistance===void 0)return;let t=this.computeDistance(),o=Math.abs(t-this.initialDistance);if(!this.isZoomingActive){if(!(o>this.ZOOM_TRIGGER_DELTA))return;this.isZoomingActive=!0,this.touchEventsStateService.currentEvent.set(xt.Zooming)}let i=this.flowCoreProvider.provide(),r=(this.touchCache[0].clientX+this.touchCache[1].clientX)/2,s=(this.touchCache[0].clientY+this.touchCache[1].clientY)/2,a=Math.min(Math.max(1-i.config.zoom.step,t/this.lastDistance),1+i.config.zoom.step);this.lastDistance=t;let d=this.inputEventsRouterService.getBaseEvent(e);this.inputEventsRouterService.emit(C(p({},d),{name:"zoom",centerPoint:{x:r,y:s},zoomFactor:a}))}removeTouchFromCache(e){let t=this.touchCache.findIndex(o=>o.identifier===e.identifier);t!==-1&&this.touchCache.splice(t,1)}computeDistance(){return Math.hypot(this.touchCache[0].clientX-this.touchCache[1].clientX,this.touchCache[0].clientY-this.touchCache[1].clientY)}updateTouchInCache(e){let t=this.touchCache.findIndex(o=>o.identifier===e.identifier);t!==-1&&(this.touchCache[t]=e)}static \u0275fac=function(t){return new(t||n)};static \u0275dir=_e({type:n,selectors:[["","ngDiagramZoomingPointer",""]],hostBindings:function(t,o){t&1&&R("touchstart",function(r){return o.onTouchStart(r)})("touchend",function(r){return o.onTouchEnd(r)})("touchmove",function(r){return o.onTouchMove(r)})("touchcancel",function(r){return o.onTouchEnd(r)})}})};var wp=class n{flowCoreProvider=f(Oe);inputEventsRouterService=f(ft);onWheel(e){if(!this.shouldHandle(e))return;e.stopPropagation(),e.preventDefault(),e.zoomingHandled=!0;let t=this.flowCoreProvider.provide(),o=this.getZoomFactor(e,t.config.zoom.step),i=this.inputEventsRouterService.getBaseEvent(e);this.inputEventsRouterService.emit(C(p({},i),{name:"zoom",centerPoint:{x:e.clientX,y:e.clientY},zoomFactor:o}))}shouldHandle(e){if(e.zoomingHandled)return!1;let t=this.flowCoreProvider.provide();if(t.actionStateManager.isPanning())return!1;if(e.ctrlKey)return!0;let o=this.inputEventsRouterService.getBaseEvent(e).modifiers;return t.shortcutManager.matchesAction("zoom",{modifiers:o})}isPinchGesture(e){return e.ctrlKey&&Math.abs(e.deltaY)<50}getZoomFactor(e,t){return this.isPinchGesture(e)?Math.exp(.01*-e.deltaY):e.deltaY>0?1-t:1+t}static \u0275fac=function(t){return new(t||n)};static \u0275dir=_e({type:n,selectors:[["","ngDiagramZoomingWheel",""]],hostBindings:function(t,o){t&1&&R("wheel",function(r){return o.onWheel(r)})}})},bp=class n{node=T.required();position=b(()=>this.node().position);get transform(){let e=this.position();return`translate(${e.x}px, ${e.y}px)`}static \u0275fac=function(t){return new(t||n)};static \u0275dir=_e({type:n,selectors:[["","ngDiagramNodePosition",""]],hostVars:4,hostBindings:function(t,o){t&2&&Ze("transform",o.transform)("transform-origin","0 0")},inputs:{node:[1,"node"]}})},Na=class n{node=T.required();selected=b(()=>this.node().selected??!1);static \u0275fac=function(t){return new(t||n)};static \u0275dir=_e({type:n,selectors:[["","ngDiagramNodeSelected",""]],hostVars:4,hostBindings:function(t,o){t&2&&G("ng-diagram-node-selected",o.selected())("ng-diagram-node-wrapper",!0)},inputs:{node:[1,"node"]}})},R0={width:"11.25rem",height:"2rem"},ua={width:"9.0625rem",height:"9.0625rem"},Cp=class n{hostElement=f(He);renderer=f(Ll);batchResizeObserver=f(Xn);flowCoreProvider=f(Oe);node=T.required();size=b(()=>this.node().size);autoSize=b(()=>this.node().autoSize??!0);id=b(()=>this.node().id);sizeState=b(()=>({size:this.size(),autoSize:this.autoSize()}));constructor(){xe(()=>{let{size:e,autoSize:t}=this.sizeState();if(!t&&e){let{width:o,height:i}=this.size();this.setSize(o,i)}else this.setSize()})}ngOnInit(){this.connectResizeObserver()}ngOnDestroy(){this.disconnectResizeObserver()}setSize(e,t){let o=this.node();e!==void 0&&t!==void 0?this.applyExplicitSize(e,t,o):this.applyAutoSize(o)}applyExplicitSize(e,t,o){let i=this.hostElement.nativeElement,r=this.flowCoreProvider.provide().config.resize.getMinNodeSize(o),s=!o.type;if(this.renderer.setStyle(i,"width",`${e}px`),this.renderer.setStyle(i,"height",`${t}px`),r||s){let a=r?.width??Qc.width,d=r?.height??Qc.height;this.renderer.setStyle(i,"min-width",`${a}px`),this.renderer.setStyle(i,"min-height",`${d}px`)}}applyAutoSize(e){e.type?this.resetExplicitSizes():yo(e)?this.applyDefaultGroupSize():this.applyDefaultNodeSize()}applyDefaultGroupSize(){let e=this.hostElement.nativeElement;this.renderer.setStyle(e,"width",ua.width),this.renderer.setStyle(e,"height",ua.height),this.renderer.setStyle(e,"min-width",ua.width),this.renderer.setStyle(e,"min-height",ua.height)}applyDefaultNodeSize(){let e=this.hostElement.nativeElement;this.renderer.setStyle(e,"width","unset"),this.renderer.setStyle(e,"height","unset"),this.renderer.setStyle(e,"min-width",R0.width),this.renderer.setStyle(e,"min-height",R0.height)}resetExplicitSizes(){let e=this.hostElement.nativeElement;this.renderer.setStyle(e,"width","unset"),this.renderer.setStyle(e,"height","unset"),this.renderer.setStyle(e,"min-width","unset"),this.renderer.setStyle(e,"min-height","unset")}connectResizeObserver(){this.batchResizeObserver.observe(this.hostElement.nativeElement,{type:"node",nodeId:this.id()})}disconnectResizeObserver(){this.batchResizeObserver.unobserve(this.hostElement.nativeElement)}static \u0275fac=function(t){return new(t||n)};static \u0275dir=_e({type:n,selectors:[["","ngDiagramNodeSize",""]],inputs:{node:[1,"node"]}})},_p=class n{viewport=T({x:0,y:0,scale:1});get transform(){let e=this.viewport();return`translate(${e.x}px, ${e.y}px) scale(${e.scale})`}static \u0275fac=function(t){return new(t||n)};static \u0275dir=_e({type:n,selectors:[["","ngDiagramViewport",""]],hostVars:2,hostBindings:function(t,o){t&2&&Ze("transform",o.transform)},inputs:{viewport:[1,"viewport"]}})},Oa=class n{data=T.required();zIndex=b(()=>this.data().computedZIndex??0);static \u0275fac=function(t){return new(t||n)};static \u0275dir=_e({type:n,selectors:[["","ngDiagramZIndex",""]],hostVars:2,hostBindings:function(t,o){t&2&&Ze("z-index",o.zIndex())},inputs:{data:[1,"data"]}})},xp=class n{inputEventsRouter=f(ft);boxSelectionProvider=f(Er);flowCoreProvider=f(Oe);elementRef=f(He);startPoint=null;ngOnInit(){this.elementRef.nativeElement.addEventListener("pointerdown",this.onPointerDownCapture,{capture:!0})}ngOnDestroy(){this.elementRef.nativeElement.removeEventListener("pointerdown",this.onPointerDownCapture,{capture:!0}),document.removeEventListener("pointermove",this.onMouseMove),document.removeEventListener("pointerup",this.onPointerUp)}onPointerDownCapture=e=>{this.shouldHandle(e)&&(e.boxSelectionHandled=!0)};onPointerDown(e){if(!e.boxSelectionHandled)return;e.preventDefault(),e.stopPropagation();let t=this.inputEventsRouter.getBaseEvent(e);this.inputEventsRouter.emit(C(p({},t),{name:"boxSelection",phase:"start",target:void 0,targetType:"diagram",lastInputPoint:{x:e.clientX,y:e.clientY}})),this.startPoint={x:e.clientX,y:e.clientY},document.addEventListener("pointermove",this.onMouseMove),document.addEventListener("pointerup",this.onPointerUp)}onPointerUp=e=>{if(!this.inputEventsRouter.eventGuards.withPrimaryButton(e))return;e.preventDefault(),e.stopPropagation(),document.removeEventListener("pointermove",this.onMouseMove),document.removeEventListener("pointerup",this.onPointerUp);let t=this.inputEventsRouter.getBaseEvent(e);this.inputEventsRouter.emit(C(p({},t),{name:"boxSelection",phase:"end",target:void 0,targetType:"diagram",lastInputPoint:{x:e.clientX,y:e.clientY}})),this.startPoint=null,this.boxSelectionProvider.boundingBox.set(null)};onMouseMove=e=>{e.preventDefault(),e.stopPropagation();let t=this.inputEventsRouter.getBaseEvent(e);if(this.inputEventsRouter.emit(C(p({},t),{name:"boxSelection",phase:"continue",target:void 0,targetType:"diagram",lastInputPoint:{x:e.clientX,y:e.clientY}})),this.startPoint){let o=this.flowCoreProvider.provide(),{x:i,y:r}=o.clientToFlowViewportPosition(this.startPoint),{x:s,y:a}=o.clientToFlowViewportPosition({x:e.clientX,y:e.clientY}),d=Math.min(i,s),l=Math.min(r,a),h=Math.abs(s-i),g=Math.abs(a-r);this.boxSelectionProvider.boundingBox.set({x:d,y:l,width:h,height:g})}};shouldHandle(e){let t=this.flowCoreProvider.provide(),o=this.inputEventsRouter.getBaseEvent(e).modifiers;return t.shortcutManager.matchesAction("boxSelection",{modifiers:o})}static \u0275fac=function(t){return new(t||n)};static \u0275dir=_e({type:n,selectors:[["","ngDiagramBoxSelection",""]],hostBindings:function(t,o){t&1&&R("pointerdown",function(r){return o.onPointerDown(r)})}})},Sp=class n{inputEventsRouter=f(ft);diagramService=f(At);touchEventsStateService=f(Nn);isPanning=!1;lastTouch=null;onTouchStart(e){if(!this.isTwoFingerTouch(e)||!this.shouldHandle(e)||this.touchEventsStateService.zoomingHandled())return void(this.isPanning=!1);this.isPanning=!0,this.touchEventsStateService.currentEvent.set(xt.Panning);let t=this.getMidpoint(e.touches);this.lastTouch=t,this.emitPanningEvent("start",e,t),this.preventDefaultAndStop(e)}onTouchMove(e){if(this.touchEventsStateService.zoomingHandled()&&this.isPanning)return this.isPanning=!1,this.lastTouch=null,void this.touchEventsStateService.clearCurrentEvent();if(!this.shouldContinuePanning(e))return;let t=this.getMidpoint(e.touches);this.lastTouch=t,this.emitPanningEvent("continue",e,t),this.preventDefaultAndStop(e)}onTouchEnd(e){if(!this.isPanning)return;this.isPanning=!1;let t=this.lastTouch||this.getMidpoint(e.touches);this.emitPanningEvent("end",e,t),this.lastTouch=null,this.touchEventsStateService.clearCurrentEvent(),this.preventDefaultAndStop(e)}getMidpoint(e){return e.length<2?{x:0,y:0}:{x:(e[0].clientX+e[1].clientX)/2,y:(e[0].clientY+e[1].clientY)/2}}shouldHandle(e){let{viewportPanningEnabled:t}=this.diagramService.config();return!(!t||Ra(e,"pan")||this.touchEventsStateService.zoomingHandled())}isTwoFingerTouch(e){return e.touches.length===2}shouldContinuePanning(e){return this.isPanning&&this.isTwoFingerTouch(e)&&!this.touchEventsStateService.zoomingHandled()}emitPanningEvent(e,t,o){let i=this.inputEventsRouter.getBaseEvent(t);this.inputEventsRouter.emit(C(p({},i),{name:"panning",phase:e,target:void 0,targetType:"diagram",lastInputPoint:o}))}preventDefaultAndStop(e){e.preventDefault(),e.stopPropagation()}static \u0275fac=function(t){return new(t||n)};static \u0275dir=_e({type:n,selectors:[["","ngDiagramPanning",""]],hostBindings:function(t,o){t&1&&R("touchstart",function(r){return o.onTouchStart(r)})("touchmove",function(r){return o.onTouchMove(r)})("touchend",function(r){return o.onTouchEnd(r)})("touchcancel",function(r){return o.onTouchEnd(r)})}})},Pp=class n{service=f(Oe,{optional:!0,skipSelf:!0});constructor(){if(!this.service)throw new Error(`NgDiagram services are not available. Please register all required services using \`provideNgDiagram()\` in your component's providers array.
|
|
216
|
+
|
|
217
|
+
Example usage:
|
|
218
|
+
|
|
219
|
+
import { provideNgDiagram } from 'ng-diagram';
|
|
220
|
+
|
|
221
|
+
@Component({
|
|
222
|
+
selector: 'app-root',
|
|
223
|
+
providers: [provideNgDiagram()], // Add this to register all ng-diagram services
|
|
224
|
+
template: \`<ng-diagram ...></ng-diagram>\`
|
|
225
|
+
})
|
|
226
|
+
export class AppComponent {...}`)}static \u0275fac=function(t){return new(t||n)};static \u0275dir=_e({type:n,selectors:[["","ngDiagramServicesAvailabilityChecker",""]]})},DI=n=>`[ngDiagram] Node template '${n}' is not registered. Falling back to default node template.
|
|
227
|
+
|
|
228
|
+
Documentation: https://www.ngdiagram.dev/docs/guides/nodes/custom-nodes/
|
|
229
|
+
`,TI=n=>`[ngDiagram] Edge template '${n}' is not registered. Falling back to default edge template.
|
|
230
|
+
|
|
231
|
+
Documentation: https://www.ngdiagram.dev/docs/guides/edges/custom-edges/
|
|
232
|
+
`,Aa=class n{flowConfig=f(Oe);nodeTemplateMap=new fi;edgeTemplateMap=new hi;accessedNodeTypes=new Set;accessedEdgeTypes=new Set;setNodeTemplateMap(e){this.accessedNodeTypes.clear(),this.nodeTemplateMap=e}setEdgeTemplateMap(e){this.accessedEdgeTypes.clear(),this.edgeTemplateMap=e}getNodeTemplate(e){if(e===void 0)return null;let t=this.nodeTemplateMap.get(e||"");return t||this.accessedNodeTypes.has(e)||(console.warn(DI(e)),this.accessedNodeTypes.add(e)),t??null}getEdgeTemplate(e){if(e===void 0)return null;let t=this.edgeTemplateMap.get(e||"");return t||this.accessedEdgeTypes.has(e)||(console.warn(TI(e)),this.accessedEdgeTypes.add(e)),t??null}static \u0275fac=function(t){return new(t||n)};static \u0275prov=j({token:n,factory:n.\u0275fac})},MI=[BE,JE,FE];var Ep=class n{boxSelectionProvider=f(Er);static \u0275fac=function(t){return new(t||n)};static \u0275cmp=B({type:n,selectors:[["ng-diagram-box-selection"]],decls:2,vars:2,consts:[[3,"left","top","width","height"]],template:function(t,o){if(t&1&&(Hn(0),P(1,t1,1,8,"div",0)),t&2){let i=Bl(o.boxSelectionProvider.boundingBox());u(),E(i?1:-1)}},styles:["div[_ngcontent-%COMP%]{position:absolute;pointer-events:none;background-color:var(--ngd-box-selection-background);border:var(--ngd-box-selection-border-size) solid var(--ngd-box-selection-border-color)}"]})},Ip=class n{renderer=f(vn);isVisible=this.renderer.isInitialized;static \u0275fac=function(t){return new(t||n)};static \u0275cmp=B({type:n,selectors:[["ng-diagram-canvas"]],hostVars:2,hostBindings:function(t,o){t&2&&Ze("visibility",o.isVisible()?null:"hidden")},features:[Pn([{directive:_p,inputs:["viewport","viewport"]}])],ngContentSelectors:o1,decls:5,vars:0,consts:[[1,"edges-container"],[1,"nodes-container"]],template:function(t,o){t&1&&(it(n1),O(0,"div",0),Je(1),Je(2,1),N(),O(3,"div",1),Je(4,2),N())},styles:["[_nghost-%COMP%]{position:absolute;width:100%;height:100%;display:flex;overflow:visible;transform-origin:0 0}.nodes-container[_ngcontent-%COMP%], .edges-container[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;top:0;left:0;pointer-events:none}"]})},RI=(n,e,t,o,i)=>`[ngDiagram] Invalid edge coordinates detected for edge '${n}'.
|
|
233
|
+
|
|
234
|
+
Edge details:
|
|
235
|
+
\u2022 source: ${e} (port: ${t||"not specified"})
|
|
236
|
+
\u2022 target: ${o} (port: ${i||"not specified"})
|
|
237
|
+
|
|
238
|
+
Documentation: https://www.ngdiagram.dev/docs/guides/edges/edges/
|
|
239
|
+
`,vo=class n{flowCoreProvider=f(Oe);markerRegistry=f(ui);useInlineMarkers=this.markerRegistry.useInlineMarkers;edge=T.required();routing=T();stroke=T();sourceArrowhead=T();targetArrowhead=T();strokeOpacity=T();strokeWidth=T();strokeDasharray=T();points=b(()=>this.edge().points??[]);path=b(()=>{let e=this.edge(),t=this.routing()??e.routing,o=this.flowCoreProvider.provide(),i=this.points();if(i.length===0)return"";if(i.some(s=>!Ut(s)))return console.error(RI(e.id,e.source,e.sourcePort,e.target,e.targetPort)),"";if(t&&o.edgeRoutingManager.hasRouting(t))return o.edgeRoutingManager.computePath(t,i);let r=o.edgeRoutingManager.getDefaultRouting();return o.edgeRoutingManager.hasRouting(r)?o.edgeRoutingManager.computePath(r,i):`M ${i[0].x},${i[0].y}`});sourceMarkerId=b(()=>this.edge()?.sourceArrowhead??this.sourceArrowhead());targetMarkerId=b(()=>this.edge()?.targetArrowhead??this.targetArrowhead());markerStart=b(()=>{let e=this.sourceMarkerId();return e?this.markerRegistry.getMarkerUrl(e,this.edge().id,"source"):null});markerEnd=b(()=>{let e=this.targetMarkerId();return e?this.markerRegistry.getMarkerUrl(e,this.edge().id,"target"):null});selected=b(()=>this.edge().selected);temporary=b(()=>this.edge().temporary);labels=b(()=>this.edge().measuredLabels??[]);class=b(()=>{let e=["ng-diagram-edge__path"];return this.selected()&&e.push("selected"),this.temporary()&&e.push("temporary"),e.join(" ")});prevRouting;prevRoutingMode;prevPoints;constructor(){xe(()=>this.syncEdgePropertiesToModel())}syncEdgePropertiesToModel(){let e=this.edge(),t={};(this.checkRoutingChanges(e,t)||this.checkRoutingModeChanges(e,t)||this.checkPointsChanges(e,t))&&this.flowCoreProvider.provide().commandHandler.emit("updateEdge",{id:e.id,edgeChanges:t})}checkRoutingChanges(e,t){let o=this.routing()??e.routing;return!(!o||this.prevRouting===o||(t.routing=o,this.prevRouting=o,0))}checkRoutingModeChanges(e,t){return!(!e.routingMode||this.prevRoutingMode===e.routingMode||(t.routingMode=e.routingMode,this.prevRoutingMode=e.routingMode,0))}checkPointsChanges(e,t){return!(!(e.routingMode==="manual"&&e.points&&e.points.length>0)||this.prevPoints&&cS(this.prevPoints,e.points)||(t.points=e.points,this.prevPoints=e.points,0))}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=B({type:n,selectors:[["ng-diagram-base-edge"]],hostVars:4,hostBindings:function(t,o){t&2&&G("selected",o.selected())("temporary",o.temporary())},inputs:{edge:[1,"edge"],routing:[1,"routing"],stroke:[1,"stroke"],sourceArrowhead:[1,"sourceArrowhead"],targetArrowhead:[1,"targetArrowhead"],strokeOpacity:[1,"strokeOpacity"],strokeWidth:[1,"strokeWidth"],strokeDasharray:[1,"strokeDasharray"]},features:[Pn([{directive:Oa,inputs:["data","edge"]},{directive:fp,inputs:["targetData","edge"]}])],ngContentSelectors:Lt,decls:5,vars:14,consts:[["ngDiagramInlineMarkers","",3,"sourceMarkerId","targetMarkerId","edgeId"],["fill","none","stroke","none","stroke-width","20","stroke-opacity","0"]],template:function(t,o){t&1&&(it(),ce(),y(0,"svg"),P(1,i1,1,3,":svg:defs",0),F(2,"path")(3,"path",1),m(),Je(4)),t&2&&(Ze("color",o.stroke()||"var(--edge-stroke, var(--ngd-default-edge-stroke))"),u(),E(o.useInlineMarkers?1:-1),u(),tt(o.class()),K("d",o.path())("stroke",o.stroke()||"var(--edge-stroke, var(--ngd-default-edge-stroke))")("fill","none")("stroke-width",o.strokeWidth()||"var(--edge-stroke-width, 2)")("stroke-dasharray",o.strokeDasharray()||"var(--edge-stroke-dasharray, none)")("marker-start",o.markerStart())("marker-end",o.markerEnd())("stroke-opacity",o.strokeOpacity()||"var(--edge-stroke-opacity, 1)"),u(),K("d",o.path()))},dependencies:[up],styles:["[_nghost-%COMP%]{position:relative}svg[_ngcontent-%COMP%]{overflow:visible;position:absolute;cursor:pointer}svg[_ngcontent-%COMP%] path[_ngcontent-%COMP%]{pointer-events:visibleStroke;cursor:pointer;transition:var(--edge-stroke-transition, none)}"]})},kp=class n{flowCoreProvider=f(Oe);hostElement=f(He);edgeComponent=f(vo);batchResizeObserver=f(Xn);id=T.required();positionOnEdge=T.required();edgeData=b(()=>this.edgeComponent.edge());points=b(()=>this.edgeData()?.points);edgeId=b(()=>this.edgeData()?.id);ownerInternalId;position=b(()=>this.edgeData()?.measuredLabels?.find(o=>o.id===this.id())?.position||{x:0,y:0});isVisible=b(()=>{let e=this.edgeData();if(!e)return!1;let t=e.measuredLabels?.find(o=>o.id===this.id());return!(!t?.position||t?.position.x==null||t?.position.y==null||!(e.points&&e.points.length>=2))});lastPositionOnEdge=U(void 0);get transform(){let e=this.position();return`translate(${e.x}px, ${e.y}px) translate(-50%, -50%)`}constructor(){xe(()=>{let e=this.positionOnEdge(),t=this.lastPositionOnEdge();e!==t&&(ye(()=>{this.lastPositionOnEdge.set(e)}),this.flowCoreProvider.provide().updater.applyEdgeLabelChanges(this.edgeId(),[{labelId:this.id(),labelChanges:{positionOnEdge:e}}]))})}ngOnInit(){this.lastPositionOnEdge.set(this.positionOnEdge()),this.ownerInternalId=this.edgeData()?._internalId,this.flowCoreProvider.provide().updater.addEdgeLabel(this.edgeId(),{id:this.id(),positionOnEdge:this.positionOnEdge()}),this.batchResizeObserver.observe(this.hostElement.nativeElement,{type:"edge-label",edgeId:this.edgeId(),labelId:this.id()})}ngOnDestroy(){this.batchResizeObserver.unobserve(this.hostElement.nativeElement);let e=this.flowCoreProvider.provide();if(!e.isInitialized)return;let t=this.edgeId(),o=t?e.getEdgeById(t):null;o&&(this.ownerInternalId&&o._internalId!==this.ownerInternalId||e.updater.deleteEdgeLabel(t,this.id()))}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=B({type:n,selectors:[["ng-diagram-base-edge-label"]],hostVars:4,hostBindings:function(t,o){t&2&&Ze("transform",o.transform)("visibility",o.isVisible()?null:"hidden")},inputs:{id:[1,"id"],positionOnEdge:[1,"positionOnEdge"]},ngContentSelectors:Lt,decls:1,vars:0,template:function(t,o){t&1&&(it(),Je(0))},styles:["[_nghost-%COMP%]{position:absolute;pointer-events:all}"]})};var Dp=class n{edgeComponent=f(vo);selected=b(()=>this.edgeComponent.selected());static \u0275fac=function(t){return new(t||n)};static \u0275cmp=B({type:n,selectors:[["ng-diagram-default-edge-label"]],ngContentSelectors:Lt,decls:2,vars:3,consts:[[3,"className"]],template:function(t,o){t&1&&(it(),O(0,"div",0),Je(1),N()),t&2&&(G("selected",o.selected()),he("className","ng-diagram-default-edge-label"))},styles:[".ng-diagram-default-edge-label[_ngcontent-%COMP%]{display:flex;padding:var(--edge-label-padding, 4px 8px);border-radius:var(--edge-label-border-radius, 4px);font-size:var(--edge-label-font-size, 12px);background:var(--edge-label-background-color, var(--ngd-default-edge-label-background-color));color:var(--edge-label-text-color, var(--ngd-default-edge-label-color));border:var(--edge-label-border-width, 1px) solid var(--edge-label-border-color, var(--ngd-default-edge-label-border-color));transition:var(--edge-label-border-transition, border-color .1s ease-in-out)}"]})},Tp=class n{edge=T.required();label=b(()=>this.edge().data?.label);positionOnEdge=b(()=>this.edge().data?.positionOnEdge??.5);static \u0275fac=function(t){return new(t||n)};static \u0275cmp=B({type:n,selectors:[["ng-diagram-default-edge"]],inputs:{edge:[1,"edge"]},decls:3,vars:3,consts:[[1,"default-edge",3,"edge"],[1,"ng-diagram-default-label",3,"id","positionOnEdge"]],template:function(t,o){if(t&1&&(y(0,"ng-diagram-base-edge",0),Hn(1),P(2,r1,3,3,"ng-diagram-base-edge-label",1),m()),t&2){M("edge",o.edge()),u();let i=Bl(o.label());u(),E(i?2:-1)}},dependencies:[vo,kp,Dp],styles:["ng-diagram-base-edge.default-edge[_ngcontent-%COMP%]{--edge-stroke: var(--ngd-default-edge-stroke);--edge-stroke-transition: stroke .1s ease-in-out}ng-diagram-base-edge.default-edge[_ngcontent-%COMP%]:hover:not(.selected):not(.temporary){--edge-stroke: var(--ngd-default-edge-stroke-hover);--edge-label-border-color: var(--ngd-default-edge-stroke-hover)}ng-diagram-base-edge.default-edge.selected[_ngcontent-%COMP%]{--edge-stroke: var(--ngd-default-edge-stroke-selected);--edge-label-border-color: var(--ngd-default-edge-stroke-selected)}ng-diagram-base-edge.default-edge.temporary[_ngcontent-%COMP%]{--edge-stroke-opacity: .5}"]})},Mp=class n{elementRef=f(He);markerRegistry=f(ui);destroyRef=f(je);markerId=null;ngAfterViewInit(){let e=this.elementRef.nativeElement.querySelector("marker");if(!e)return void console.warn("[ngDiagram] Marker element not found in projected content");let t=e.getAttribute("id");t?(this.markerId=t,this.markerRegistry.registerMarker(t,e),this.destroyRef.onDestroy(()=>{this.markerId&&this.markerRegistry.unregisterMarker(this.markerId)})):console.warn("[ngDiagram] Marker element must have an id attribute")}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=B({type:n,selectors:[["ng-diagram-marker"]],ngContentSelectors:Lt,decls:1,vars:0,template:function(t,o){t&1&&(it(),Je(0))},styles:["[_nghost-%COMP%]{display:contents}[_nghost-%COMP%] svg{position:absolute;pointer-events:none;fill:currentColor}"]})},Rp=class n{static \u0275fac=function(t){return new(t||n)};static \u0275cmp=B({type:n,selectors:[["ng-diagram-marker-arrow"]],decls:5,vars:0,consts:[["id","ng-diagram-arrow","viewBox","0 9 8 14","refX","6","refY","16","markerWidth","4","markerHeight","7","orient","auto-start-reverse"],["d","M1 21L6 16L1 11","stroke","context-stroke","fill","none","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,o){t&1&&(y(0,"ng-diagram-marker"),ce(),y(1,"svg")(2,"defs")(3,"marker",0),F(4,"path",1),m()()()())},dependencies:[Mp],encapsulation:2,changeDetection:1})},Np=class n{static \u0275fac=function(t){return new(t||n)};static \u0275cmp=B({type:n,selectors:[["ng-diagram-edge"]],ngContentSelectors:Lt,decls:1,vars:0,template:function(t,o){t&1&&(it(),Je(0))},styles:["[_nghost-%COMP%]{position:absolute;-webkit-user-select:none;user-select:none}"]})},Op=class n{inputEventsRouter=f(ft);diagramComponent=f(Rr);flowCoreProvider=f(Oe);touchEventsStateService=f(Nn);targetData=T();edgePanningInterval=null;cachedDiagramRect=null;ngOnDestroy(){document.removeEventListener("pointermove",this.onPointerMove),document.removeEventListener("pointerup",this.onPointerUp),this.stopEdgePanning()}onPointerDown(e){if(!this.shouldHandle(e)||!this.inputEventsRouter.eventGuards.withPrimaryButton(e))return;let t=this.targetData();if(!t)return;this.touchEventsStateService.currentEvent.set(xt.Move),this.cachedDiagramRect=this.diagramComponent.getBoundingClientRect(),e.moveSelectionHandled=!0;let o=this.inputEventsRouter.getBaseEvent(e);this.inputEventsRouter.emit(C(p({},o),{name:"pointerMoveSelection",phase:"start",target:t,targetType:"node",lastInputPoint:{x:e.clientX,y:e.clientY},currentDiagramEdge:null})),document.addEventListener("pointermove",this.onPointerMove),document.addEventListener("pointerup",this.onPointerUp)}onPointerUp=e=>{this.inputEventsRouter.eventGuards.withPrimaryButton(e)&&this.finishDragging(e)};onPointerMove=e=>{if(e.zoomingHandled||this.touchEventsStateService.boxSelectionHandled()||this.touchEventsStateService.panningHandled()||this.touchEventsStateService.zoomingHandled())return void this.finishDragging(e);let t=this.targetData();if(!t)return;let o=this.inputEventsRouter.getBaseEvent(e),{selectionMoving:{edgePanningThreshold:i,edgePanningEnabled:r,edgePanningForce:s},viewportPanningEnabled:a}=this.flowCoreProvider.provide().config,d=null;a&&r&&(d=lt.calculateEdgePanningForce(this.cachedDiagramRect||this.diagramComponent.getBoundingClientRect(),{x:e.clientX,y:e.clientY},i,s),d?this.startEdgePanning(e.clientX,e.clientY,d):this.stopEdgePanning()),this.inputEventsRouter.emit(C(p({},o),{name:"pointerMoveSelection",phase:"continue",target:t,targetType:"node",lastInputPoint:{x:e.clientX,y:e.clientY},panningForce:d}))};finishDragging(e){let t=this.targetData();if(!t)return;document.removeEventListener("pointermove",this.onPointerMove),document.removeEventListener("pointerup",this.onPointerUp),this.stopEdgePanning(),this.cachedDiagramRect=null;let o=this.inputEventsRouter.getBaseEvent(e);this.inputEventsRouter.emit(C(p({},o),{name:"pointerMoveSelection",phase:"end",target:t,targetType:"node",lastInputPoint:{x:e.clientX,y:e.clientY},currentDiagramEdge:null})),this.touchEventsStateService.clearCurrentEvent()}shouldHandle(e){return!(!this.flowCoreProvider.provide().config.nodeDraggingEnabled||!(this.targetData()?.draggable??1)||Ra(e,"drag")||e.zoomingHandled||e.linkingHandled||e.rotateHandled||e.boxSelectionHandled||this.touchEventsStateService.panningHandled()||this.touchEventsStateService.zoomingHandled())}startEdgePanning(e,t,o){this.stopEdgePanning(),this.edgePanningInterval=window.setInterval(()=>{let i=this.targetData();if(!i)return;let r=this.inputEventsRouter.getBaseEvent({});this.inputEventsRouter.emit(C(p({},r),{name:"pointerMoveSelection",phase:"continue",target:i,targetType:"node",lastInputPoint:{x:e,y:t},panningForce:o}))},L0)}stopEdgePanning(){this.edgePanningInterval!=null&&(window.clearInterval(this.edgePanningInterval),this.edgePanningInterval=null)}static \u0275fac=function(t){return new(t||n)};static \u0275dir=_e({type:n,selectors:[["","ngDiagramPointerMoveSelection",""]],hostBindings:function(t,o){t&1&&R("pointerdown",function(r){return o.onPointerDown(r)})},inputs:{targetData:[1,"targetData"]}})},La=class n{portsService=f(kr);flowCore=f(Oe);node=T.required();rotate=b(()=>this.node().angle?`rotate(${this.node().angle}deg)`:"");id=b(()=>this.node().id);size=b(()=>this.node().size);constructor(){this.setupPortSyncEffect()}syncPorts(){let e=this.id(),t=this.flowCore.provide();if(t.actionStateManager.isResizing()){let o=this.portsService.getNodePortsData(e);t.updater.applyPortChanges(e,va(o))}else queueMicrotask(()=>{let o=this.portsService.getNodePortsData(e);t.updater.applyPortChanges(e,va(o))})}setupPortSyncEffect(){let e,t,o=!0;xe(()=>{let i=this.size(),r=this.rotate();if(o)return o=!1,e=i,void(t=r);(i?.width!==e?.width||i?.height!==e?.height||r!==t)&&(e=i,t=r,this.syncPorts())})}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=B({type:n,selectors:[["ng-diagram-node"]],inputs:{node:[1,"node"]},features:[Pn([{directive:Cp,inputs:["node","node"]},{directive:bp,inputs:["node","node"]},{directive:gp,inputs:["targetData","node"]},{directive:Op,inputs:["targetData","node"]},{directive:Oa,inputs:["data","node"]}])],ngContentSelectors:Lt,decls:2,vars:2,consts:[[1,"node-content"]],template:function(t,o){t&1&&(it(),O(0,"div",0),Je(1),N()),t&2&&Ze("transform",o.rotate())},styles:["[_nghost-%COMP%]{position:absolute;top:0;left:0;transform-origin:0 0;pointer-events:none;-webkit-user-select:none;user-select:none;cursor:pointer}.node-content[_ngcontent-%COMP%]{position:relative;width:100%;height:100%;transform-origin:center center;pointer-events:all}"]})},Tr=class{nodeComponent=f(La,{optional:!0});isRenderedOnCanvas=b(()=>!!this.nodeComponent)},Fa=class n{inputEventsRouter=f(ft);touchEventsStateService=f(Nn);direction=T.required();targetData=T.required();ngOnDestroy(){document.removeEventListener("pointermove",this.onPointerMove),document.removeEventListener("pointerup",this.onPointerUp)}onPointerDown(e){if(!this.shouldHandle(e))return;this.touchEventsStateService.currentEvent.set(xt.Resize),e.preventDefault(),e.stopPropagation(),document.addEventListener("pointermove",this.onPointerMove),document.addEventListener("pointerup",this.onPointerUp);let t=this.inputEventsRouter.getBaseEvent(e);this.inputEventsRouter.emit(C(p({},t),{name:"resize",phase:"start",target:this.targetData(),direction:this.direction(),targetType:"node",lastInputPoint:{x:e.clientX,y:e.clientY}}))}onPointerUp=e=>{document.removeEventListener("pointermove",this.onPointerMove),document.removeEventListener("pointerup",this.onPointerUp),this.touchEventsStateService.clearCurrentEvent();let t=this.inputEventsRouter.getBaseEvent(e);this.inputEventsRouter.emit(C(p({},t),{name:"resize",phase:"end",target:this.targetData(),direction:this.direction(),targetType:"node",lastInputPoint:{x:e.clientX,y:e.clientY}}))};onPointerMove=e=>{if(this.touchEventsStateService.panningHandled()||this.touchEventsStateService.zoomingHandled())return void this.onPointerUp(e);let t=this.inputEventsRouter.getBaseEvent(e);this.inputEventsRouter.emit(C(p({},t),{name:"resize",phase:"continue",target:this.targetData(),direction:this.direction(),targetType:"node",lastInputPoint:{x:e.clientX,y:e.clientY}}))};shouldHandle(e){return!(e.boxSelectionHandled||this.touchEventsStateService.panningHandled()||this.touchEventsStateService.zoomingHandled())}static \u0275fac=function(t){return new(t||n)};static \u0275dir=_e({type:n,selectors:[["","ngDiagramResize",""]],hostBindings:function(t,o){t&1&&R("pointerdown",function(r){return o.onPointerDown(r)})},inputs:{direction:[1,"direction"],targetData:[1,"targetData"]}})},Ap=class n{position=T.required();classes=b(()=>`resize-handle resize-handle--${this.position()}`);static \u0275fac=function(t){return new(t||n)};static \u0275cmp=B({type:n,selectors:[["ng-diagram-resize-handle"]],hostVars:2,hostBindings:function(t,o){t&2&&tt(o.classes())},inputs:{position:[1,"position"]},features:[Pn([{directive:Fa,inputs:["direction","position","targetData","targetData"]}])],decls:0,vars:0,template:function(t,o){},styles:['[_nghost-%COMP%]:before{content:"";position:absolute;width:16px;height:16px;top:50%;left:50%;transform:translate(-50%,-50%);border-radius:50%}.resize-handle[_nghost-%COMP%]{position:absolute;width:var(--ngd-resize-handle-size);height:var(--ngd-resize-handle-size);background-color:var(--ngd-resize-handle-background-color);border:var(--ngd-resize-handle-border-size) var(--ngd-resize-handle-border-style) var(--ngd-resize-handle-border-color);border-radius:var(--ngd-resize-handle-border-radius)}.resize-handle--top-left[_nghost-%COMP%]{top:0;left:0;transform:translate(-50%,-50%);cursor:nwse-resize}.resize-handle--top-right[_nghost-%COMP%]{top:0;right:0;transform:translate(50%,-50%);cursor:nesw-resize}.resize-handle--bottom-left[_nghost-%COMP%]{bottom:0;left:0;transform:translate(-50%,50%);cursor:nesw-resize}.resize-handle--bottom-right[_nghost-%COMP%]{bottom:0;right:0;transform:translate(50%,50%);cursor:nwse-resize}']})},Lp=class n{position=T.required();classes=b(()=>`resize-line resize-line--${this.position()}`);static \u0275fac=function(t){return new(t||n)};static \u0275cmp=B({type:n,selectors:[["ng-diagram-resize-line"]],hostVars:2,hostBindings:function(t,o){t&2&&tt(o.classes())},inputs:{position:[1,"position"]},features:[Pn([{directive:Fa,inputs:["direction","position","targetData","targetData"]}])],decls:0,vars:0,template:function(t,o){},styles:['[_nghost-%COMP%]:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.resize-line[_nghost-%COMP%]{position:absolute}.resize-line--top[_nghost-%COMP%]:before, .resize-line--bottom[_nghost-%COMP%]:before{width:100%;height:8px}.resize-line--right[_nghost-%COMP%]:before, .resize-line--left[_nghost-%COMP%]:before{width:8px;height:100%}.resize-line--top[_nghost-%COMP%]{top:0;left:0;width:100%;border-top:var(--ngd-resize-line-border-width) var(--ngd-resize-line-border-style) var(--ngd-resize-line-border-color);cursor:ns-resize;transform:translateY(-50%)}.resize-line--right[_nghost-%COMP%]{top:0;right:0;height:100%;border-right:var(--ngd-resize-line-border-width) var(--ngd-resize-line-border-style) var(--ngd-resize-line-border-color);cursor:ew-resize;transform:translate(50%)}.resize-line--bottom[_nghost-%COMP%]{bottom:0;left:0;width:100%;border-bottom:var(--ngd-resize-line-border-width) var(--ngd-resize-line-border-style) var(--ngd-resize-line-border-color);cursor:ns-resize;transform:translateY(50%)}.resize-line--left[_nghost-%COMP%]{top:0;left:0;height:100%;border-left:var(--ngd-resize-line-border-width) var(--ngd-resize-line-border-style) var(--ngd-resize-line-border-color);cursor:ew-resize;transform:translate(-50%)}']})},gi=class n extends Tr{diagramService=f(At);defaultResizable=T(void 0);nodeData=b(()=>this.nodeComponent?.node());dataResizable=b(()=>this.nodeData()?.resizable);isResizable=b(()=>this.dataResizable()??this.defaultResizable()??this.diagramService.config().resize?.defaultResizable);showAdornment=b(()=>!!this.isResizable()&&this.nodeData()?.selected&&this.isRenderedOnCanvas()&&!this.nodeData()?.angle);linePositions=["top","right","bottom","left"];handlePositions=["top-left","top-right","bottom-left","bottom-right"];static \u0275fac=(()=>{let e;return function(o){return(e||(e=Nt(n)))(o||n)}})();static \u0275cmp=B({type:n,selectors:[["ng-diagram-node-resize-adornment"]],inputs:{defaultResizable:[1,"defaultResizable"]},features:[En],ngContentSelectors:Lt,decls:2,vars:1,consts:[[3,"position","targetData"]],template:function(t,o){t&1&&(it(),Je(0),P(1,d1,4,0)),t&2&&(u(),E(o.showAdornment()?1:-1))},dependencies:[Lp,Ap],styles:["[_nghost-%COMP%]{display:flex;position:relative;width:100%;height:100%}"]})},Fp=class n{node=T.required();isSelected=b(()=>this.node().selected??!1);highlighted=b(()=>this.node().highlighted??!1);classes=b(()=>"ng-diagram-group "+(this.highlighted()?"highlight":""));static \u0275fac=function(t){return new(t||n)};static \u0275cmp=B({type:n,selectors:[["ng-diagram-default-group-template"]],inputs:{node:[1,"node"]},ngContentSelectors:Lt,decls:3,vars:3,consts:[["ngDiagramNodeSelected","","ngDiagramGroupHighlighted","",3,"node"]],template:function(t,o){t&1&&(it(),y(0,"ng-diagram-node-resize-adornment")(1,"div",0),Je(2),m()()),t&2&&(u(),tt(o.classes()),M("node",o.node()))},dependencies:[gi,Na,cp],styles:["[_nghost-%COMP%]:hover .ng-diagram-group[_ngcontent-%COMP%]{border-color:var(--ngd-group-border-color-hover)}.ng-diagram-group[_ngcontent-%COMP%]{display:flex;border-radius:var(--ngd-group-border-radius);padding:.625rem;background-color:var(--ngd-node-bg-primary-default);border:.0625rem solid var(--ngd-group-border-color);width:100%;height:100%;box-sizing:border-box}"]})},NI={topLeft:"top-left",topCenter:"top-center",topRight:"top-right",centerLeft:"center-left",center:"center",centerRight:"center-right",bottomLeft:"bottom-left",bottomCenter:"bottom-center",bottomRight:"bottom-right"},wo=class n extends Tr{hostElement=f(He);flowCoreProvider=f(Oe);batchResizeObserver=f(Xn);linkingInputDirective=f(Ta);isInitialized=U(!1);lastSide=U(void 0);lastType=U(void 0);lastOriginPoint;ownerInternalId;nodeData=b(()=>this.nodeComponent?.node());id=T.required();type=T.required();side=T.required();originPoint=T("center");get portClass(){let e=NI[this.originPoint()]||"center";return`ng-diagram-port ${this.hasContent?"custom-content":""} ${this.side()} origin-${e}`}constructor(){super(),xe(()=>{let e=this.nodeData(),t=this.isInitialized(),o=this.side(),i=this.type(),r=this.originPoint();if(!t||!e)return;let s={};this.lastSide()!==o&&(this.lastSide.set(o),s.side=o),this.lastType()!==i&&(this.lastType.set(i),s.type=i);let a=this.lastOriginPoint!==r;a&&(this.lastOriginPoint=r),Object.keys(s).length>0&&this.flowCoreProvider.provide().updater.applyPortChanges(e.id,[{portId:this.id(),portChanges:s}]),(s.side||a)&&this.batchResizeObserver.invalidate(this.hostElement.nativeElement)}),xe(()=>{let e=this.nodeData();this.isInitialized()&&e&&ye(()=>{this.linkingInputDirective.setTargetNode(e)})})}ngOnInit(){this.lastSide.set(this.side()),this.lastType.set(this.type()),this.lastOriginPoint=this.originPoint();let e=this.nodeData();e&&(this.ownerInternalId=e._internalId,this.flowCoreProvider.provide().updater.addPort(e.id,{id:this.id(),type:this.type(),nodeId:e.id,side:this.side()}),this.batchResizeObserver.observe(this.hostElement.nativeElement,{type:"port",nodeId:e.id,portId:this.id()}),this.isInitialized.set(!0))}ngOnDestroy(){this.batchResizeObserver.unobserve(this.hostElement.nativeElement);let e=this.id(),t=this.nodeData();if(!t)return;let o=this.flowCoreProvider.provide();if(!o.isInitialized)return;let i=o.getNodeById(t.id);i&&(this.ownerInternalId&&i._internalId!==this.ownerInternalId||o.isVirtualizationActive&&!o.isNodeCurrentlyRendered(t.id)||o.internalUpdater.deletePort(t.id,e))}custom=Xe("contentProjection");hasContent=!1;ngAfterContentInit(){this.hasContent=(this.custom()?.nativeElement?.childNodes?.length??0)>0}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=B({type:n,selectors:[["ng-diagram-port"]],viewQuery:function(t,o){t&1&&rt(o.custom,th,5),t&2&&st()},hostVars:5,hostBindings:function(t,o){t&2&&(K("data-port-id",o.id()),tt(o.portClass),Ze("display",o.isRenderedOnCanvas()?"block":"none"))},inputs:{id:[1,"id"],type:[1,"type"],side:[1,"side"],originPoint:[1,"originPoint"]},features:[Pn([{directive:Ta,inputs:["portId","id"]}]),En],ngContentSelectors:Lt,decls:3,vars:0,consts:[["contentProjection",""],[1,"content-projection"]],template:function(t,o){t&1&&(it(),O(0,"div",1,0),Je(2),N())},styles:['[_nghost-%COMP%]{position:absolute;width:fit-content;height:fit-content;inset:0;box-sizing:content-box;z-index:2;border-radius:var(--ngd-port-border-radius);cursor:crosshair}[_nghost-%COMP%]:has(.content-projection:not(:empty)){--ngd-port-border-radius: 0%}[_nghost-%COMP%]:has(.content-projection:empty), [_nghost-%COMP%] .content-projection[_ngcontent-%COMP%]:not(:empty){display:flex;background:var(--ngd-port-background-color);border:var(--ngd-port-border-size) solid var(--ngd-port-border-color);border-radius:var(--ngd-port-border-radius);transition-property:background-color,border-color,outline,box-shadow;transition-timing-function:ease-in-out;transition-duration:.1s;transform-origin:center}[_nghost-%COMP%]:has(.content-projection:empty){width:var(--ngd-port-size);height:var(--ngd-port-size)}[_nghost-%COMP%]:has(.content-projection:empty):before{content:"";position:absolute;width:18px;height:18px;top:50%;left:50%;translate:-50% -50%;border-radius:var(--ngd-port-border-radius)}.left[_nghost-%COMP%]{top:50%;left:0}.right[_nghost-%COMP%]{top:50%;left:100%}.top[_nghost-%COMP%]{top:0;left:50%}.bottom[_nghost-%COMP%]{top:100%;left:50%}.origin-top-left[_nghost-%COMP%]{transform:translate(0)}.origin-top-center[_nghost-%COMP%]{transform:translate(-50%)}.origin-top-right[_nghost-%COMP%]{transform:translate(-100%)}.origin-center-left[_nghost-%COMP%]{transform:translateY(-50%)}.origin-center[_nghost-%COMP%]{transform:translate(-50%,-50%)}.origin-center-right[_nghost-%COMP%]{transform:translate(-100%,-50%)}.origin-bottom-left[_nghost-%COMP%]{transform:translateY(-100%)}.origin-bottom-center[_nghost-%COMP%]{transform:translate(-50%,-100%)}.origin-bottom-right[_nghost-%COMP%]{transform:translate(-100%,-100%)}']})},zp=class n{inputEventsRouter=f(ft);touchEventsStateService=f(Nn);targetData=T();ngOnDestroy(){this.cleanup()}onPointerDown(e){if(!this.shouldHandle(e))return;e.rotateHandled=!0,this.touchEventsStateService.currentEvent.set(xt.Rotate);let t=this.targetData();if(!t)return;let o=this.inputEventsRouter.getBaseEvent(e);this.inputEventsRouter.emit(C(p({},o),{name:"rotate",phase:"start",target:t,lastInputPoint:{x:e.clientX,y:e.clientY},center:this.getNodeCenter(t)})),document.addEventListener("pointermove",this.onPointerMove),document.addEventListener("pointerup",this.onPointerUp),document.addEventListener("pointercancel",this.onPointerCancel)}onPointerMove=e=>{if(this.touchEventsStateService.panningHandled()||this.touchEventsStateService.zoomingHandled())return void this.onPointerUp(e);e.rotateHandled=!0;let t=this.targetData();if(!t)return;let o=this.inputEventsRouter.getBaseEvent(e);this.inputEventsRouter.emit(C(p({},o),{name:"rotate",phase:"continue",target:t,lastInputPoint:{x:e.clientX,y:e.clientY},center:this.getNodeCenter(t)}))};onPointerUp=e=>{let t=this.targetData();if(!t)return;let o=this.inputEventsRouter.getBaseEvent(e);this.inputEventsRouter.emit(C(p({},o),{name:"rotate",phase:"end",target:t,lastInputPoint:{x:e.clientX,y:e.clientY},center:this.getNodeCenter(t)})),this.cleanup()};onPointerCancel=e=>{let t=this.targetData();if(!t)return;let o=this.inputEventsRouter.getBaseEvent(e);this.inputEventsRouter.emit(C(p({},o),{name:"rotate",phase:"end",target:t,lastInputPoint:{x:e.clientX,y:e.clientY},center:this.getNodeCenter(t)})),this.cleanup()};shouldHandle(e){return!(e.boxSelectionHandled||this.touchEventsStateService.panningHandled()||this.touchEventsStateService.zoomingHandled())}cleanup(){this.touchEventsStateService.clearCurrentEvent(),document.removeEventListener("pointermove",this.onPointerMove),document.removeEventListener("pointerup",this.onPointerUp),document.removeEventListener("pointercancel",this.onPointerCancel)}getNodeCenter(e){let{x:t,y:o}=e.position,{width:i,height:r}=e.size||{width:0,height:0};return{x:t+i/2,y:o+r/2}}static \u0275fac=function(t){return new(t||n)};static \u0275dir=_e({type:n,selectors:[["","ngDiagramRotateHandle",""]],hostBindings:function(t,o){t&1&&R("pointerdown",function(r){return o.onPointerDown(r)})},inputs:{targetData:[1,"targetData"]}})},$p=class n{custom=Xe("contentProjection");data=T.required();isRotating=U(!1);hasCustomHandle=!1;ngAfterContentInit(){this.hasCustomHandle=(this.custom()?.nativeElement?.childNodes?.length??0)>0}get pointerDownAttr(){return this.isRotating()?"true":null}pointerDown(){this.isRotating.set(!0)}pointerUp(){this.isRotating.set(!1)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=B({type:n,selectors:[["ng-diagram-rotate-handle"]],viewQuery:function(t,o){t&1&&rt(o.custom,th,5),t&2&&st()},hostVars:5,hostBindings:function(t,o){t&1&&R("pointerdown",function(){return o.pointerDown()})("pointerup",function(){return o.pointerUp()},kt),t&2&&(K("data-rotating",o.pointerDownAttr),G("rotate-handle",!o.hasCustomHandle)("ng-diagram-rotate-handle",!0))},inputs:{data:[1,"data"]},features:[Pn([{directive:zp,inputs:["targetData","data"]}])],ngContentSelectors:Lt,decls:4,vars:1,consts:[["contentProjection",""],[1,"content-projection"],["xmlns","http://www.w3.org/2000/svg","width","18","height","19","viewBox","0 0 18 19","fill","none"],["d","M15.75 9.5637C15.7502 11.3383 15.0515 13.0416 13.8051 14.3049C12.5588 15.5682 10.8651 16.2899 9.0907 16.3137H9C7.27611 16.318 5.61676 15.6583 4.36641 14.4715C4.31271 14.4207 4.26955 14.3599 4.23938 14.2924C4.20921 14.2249 4.19262 14.1522 4.19056 14.0783C4.1885 14.0044 4.20102 13.9309 4.22739 13.8618C4.25376 13.7928 4.29347 13.7296 4.34426 13.6759C4.39504 13.6222 4.45591 13.5791 4.52337 13.5489C4.59084 13.5187 4.66359 13.5021 4.73746 13.5001C4.81134 13.498 4.8849 13.5105 4.95394 13.5369C5.02298 13.5633 5.08615 13.603 5.13984 13.6538C5.94408 14.4122 6.95396 14.9169 8.04335 15.1047C9.13273 15.2926 10.2533 15.1553 11.2651 14.7099C12.2769 14.2646 13.1351 13.531 13.7324 12.6008C14.3297 11.6706 14.6396 10.585 14.6235 9.4797C14.6075 8.37436 14.266 7.29826 13.6419 6.38583C13.0178 5.4734 12.1387 4.76509 11.1144 4.34939C10.09 3.9337 8.96594 3.82904 7.88249 4.04849C6.79903 4.26794 5.80425 4.80178 5.02242 5.58331C5.01668 5.58952 5.01057 5.59539 5.00414 5.60089L3.13523 7.3137H5.0625C5.21168 7.3137 5.35476 7.37296 5.46025 7.47845C5.56574 7.58394 5.625 7.72701 5.625 7.8762C5.625 8.02538 5.56574 8.16846 5.46025 8.27395C5.35476 8.37944 5.21168 8.4387 5.0625 8.4387H1.6875C1.53832 8.4387 1.39524 8.37944 1.28975 8.27395C1.18426 8.16846 1.125 8.02538 1.125 7.8762V4.5012C1.125 4.35201 1.18426 4.20894 1.28975 4.10345C1.39524 3.99796 1.53832 3.9387 1.6875 3.9387C1.83668 3.9387 1.97976 3.99796 2.08525 4.10345C2.19074 4.20894 2.25 4.35201 2.25 4.5012V6.59651L4.23633 4.78245C5.18131 3.84113 6.384 3.20089 7.69256 2.94253C9.00112 2.68418 10.3569 2.8193 11.5887 3.33084C12.8205 3.84238 13.8732 4.7074 14.6138 5.81671C15.3544 6.92602 15.7498 8.22988 15.75 9.5637Z","fill","white"]],template:function(t,o){t&1&&(it(),O(0,"div",1,0),Je(2),N(),P(3,l1,2,0,":svg:svg",2)),t&2&&(u(3),E(o.hasCustomHandle?-1:3))},styles:[".content-projection[_ngcontent-%COMP%]:not(:empty){width:100%;height:100%}.rotate-handle[_nghost-%COMP%]{background-color:var(--ngd-rotate-handle-background-color);border-radius:50%;transition:background-color .1s ease-in-out}.rotate-handle[_nghost-%COMP%]:hover, .rotate-handle[_nghost-%COMP%]:focus-visible{background-color:var(--ngd-rotate-handle-background-color-hover)}.rotate-handle[data-rotating][_nghost-%COMP%], .rotate-handle.active[_nghost-%COMP%]{background-color:var(--ngd-rotate-handle-background-color-active)}[_nghost-%COMP%]{display:flex;justify-content:center;align-items:center;width:var(--ngd-rotate-handle-size);height:var(--ngd-rotate-handle-size);position:absolute;transform:translate(50%,-50%);z-index:10;box-sizing:border-box;pointer-events:auto;cursor:grab;top:var(--ngd-rotate-handle-top);right:var(--ngd-rotate-handle-right);bottom:var(--ngd-rotate-handle-bottom);left:var(--ngd-rotate-handle-left)}[data-rotating][_nghost-%COMP%], .active[_nghost-%COMP%], .active[_nghost-%COMP%], .active [_nghost-%COMP%]{cursor:grabbing}"]})},Bp=class n extends Tr{diagramService=f(At);defaultRotatable=T(void 0);dataRotatable=b(()=>this.nodeData()?.rotatable);isRotating=U(!1);nodeData=b(()=>this.nodeComponent?.node());isRotatable=b(()=>this.dataRotatable()??this.defaultRotatable()??this.diagramService.config().nodeRotation?.defaultRotatable);eventTarget=b(()=>({type:"rotate-handle",element:this.nodeData()}));showAdornment=b(()=>!!this.nodeData()?.selected&&this.isRenderedOnCanvas()&&!!this.isRotatable());static \u0275fac=(()=>{let e;return function(o){return(e||(e=Nt(n)))(o||n)}})();static \u0275cmp=B({type:n,selectors:[["ng-diagram-node-rotate-adornment"]],hostAttrs:[1,"node-rotate-adornment"],inputs:{defaultRotatable:[1,"defaultRotatable"]},features:[En],ngContentSelectors:Lt,decls:1,vars:1,consts:[[3,"data"]],template:function(t,o){t&1&&(it(),P(0,c1,2,1,"ng-diagram-rotate-handle",0)),t&2&&E(o.showAdornment()?0:-1)},dependencies:[$p],styles:["[_nghost-%COMP%]{position:absolute;inset:0;pointer-events:none}"]})},Hp=class n{diagramService=f(At);node=T.required();isSelected=b(()=>this.node().selected??!1);classes=b(()=>"node "+(this.isSelected()?"isSelected":""));enablePortHover=b(()=>!this.diagramService.actionState().resize);static \u0275fac=function(t){return new(t||n)};static \u0275cmp=B({type:n,selectors:[["ng-diagram-base-node-template"]],hostVars:4,hostBindings:function(t,o){t&2&&G("isSelected",o.isSelected())("ng-diagram-port-hoverable-over-node",o.enablePortHover())},inputs:{node:[1,"node"]},ngContentSelectors:Lt,decls:6,vars:3,consts:[["ngDiagramNodeSelected","",3,"node"],["id","port-left","type","both","side","left"],["id","port-right","type","both","side","right"]],template:function(t,o){t&1&&(it(),F(0,"ng-diagram-node-rotate-adornment"),y(1,"ng-diagram-node-resize-adornment")(2,"div",0),Je(3),m(),F(4,"ng-diagram-port",1)(5,"ng-diagram-port",2),m()),t&2&&(u(2),tt(o.classes()),M("node",o.node()))},dependencies:[wo,Na,gi,Bp],styles:["[_nghost-%COMP%]:hover .node[_ngcontent-%COMP%]{border-color:var(--ngd-node-border-color-hover)}.node[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center;padding:.5rem;width:100%;background-color:var(--ngd-node-bg-primary-default);border:var(--ngd-node-border-size) solid var(--ngd-node-border-color);color:var(--ngd-txt-primary-default);border-radius:var(--ngd-node-border-radius)}.node.isSelected[_ngcontent-%COMP%]{border-color:var(--ngd-node-border-color-hover)}"]})},Up=class n{node=T.required();label=b(()=>{let e=this.node().data;return"label"in e?e.label:this.node().id});static \u0275fac=function(t){return new(t||n)};static \u0275cmp=B({type:n,selectors:[["ng-diagram-default-node-template"]],inputs:{node:[1,"node"]},decls:3,vars:2,consts:[[3,"node"]],template:function(t,o){t&1&&(y(0,"ng-diagram-base-node-template",0)(1,"span"),w(2),m()()),t&2&&(M("node",o.node()),u(2),ue(o.label()))},dependencies:[Hp],encapsulation:2})},Mr=class n{panel=U(null);position=b(()=>this.panel()?.position());register(e){this.panel.set(e)}unregister(){this.panel.set(null)}static \u0275fac=function(t){return new(t||n)};static \u0275prov=j({token:n,factory:n.\u0275fac})},OI={"bottom-right":["top-right","bottom-left","top-left"],"top-right":["bottom-right","top-left","bottom-left"],"bottom-left":["top-left","bottom-right","top-right"],"top-left":["bottom-left","top-right","bottom-right"]},Vp=class n{preferredPosition=T(void 0);panelRegistry=f(Mr);position=b(()=>{let e=this.preferredPosition()??"bottom-right",t=this.panelRegistry.position();return t!==e?e:OI[e].find(o=>o!==t)??e});static \u0275fac=function(t){return new(t||n)};static \u0275cmp=B({type:n,selectors:[["ng-diagram-watermark"]],hostVars:2,hostBindings:function(t,o){t&2&&tt(o.position())},inputs:{preferredPosition:[1,"preferredPosition"]},decls:5,vars:0,consts:[["href","https://www.ngdiagram.dev/","target","_blank"],[1,"sr-only"],["width","479","height","90","viewBox","0 0 479 90","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M78.1895 20.5088C82.5953 20.5088 85.9324 21.2858 88.2002 22.8408C90.468 24.3959 92.1205 26.0165 93.1572 27.7012H94.9062V21.8691H106.958V78.6289C106.958 81.9333 105.986 84.5572 104.042 86.501C102.098 88.5096 99.5063 89.5146 96.2666 89.5146H64V78.8232H91.9902C93.8044 78.8232 94.7119 77.8511 94.7119 75.9072V63.3701H92.9629C92.315 64.4068 91.4075 65.4757 90.2412 66.5771C89.075 67.6138 87.5199 68.4884 85.5762 69.2012C83.6324 69.9139 81.1699 70.2705 78.1895 70.2705C74.2371 70.2705 70.5762 69.3312 67.207 67.4521C63.9026 65.5083 61.2459 62.7541 59.2373 59.1904C57.2288 55.562 56.2246 51.2208 56.2246 46.167V44.6123C56.2246 39.5584 57.2287 35.2492 59.2373 31.6855C61.2458 28.0572 63.9027 25.3038 67.207 23.4248C70.5763 21.481 74.2371 20.5088 78.1895 20.5088ZM278.176 20.5088C282.582 20.5088 285.919 21.2858 288.187 22.8408C290.454 24.3959 292.107 26.0165 293.144 27.7012H294.893V21.8691H306.944V78.6289C306.944 81.9333 305.972 84.5572 304.028 86.501C302.085 88.5096 299.493 89.5146 296.253 89.5146H263.986V78.8232H291.977C293.791 78.8232 294.698 77.8511 294.698 75.9072V63.3701H292.949C292.301 64.4068 291.394 65.4757 290.228 66.5771C289.061 67.6138 287.506 68.4885 285.562 69.2012C283.619 69.9139 281.156 70.2705 278.176 70.2705C274.223 70.2705 270.563 69.3311 267.193 67.4521C263.889 65.5083 261.232 62.7541 259.224 59.1904C257.215 55.562 256.211 51.2208 256.211 46.167V44.6123C256.211 39.5584 257.215 35.2492 259.224 31.6855C261.232 28.0572 263.889 25.3038 267.193 23.4248C270.563 21.481 274.223 20.5088 278.176 20.5088ZM225.268 20.5088C231.617 20.5088 236.639 22.0958 240.332 25.2705C244.025 28.4454 245.872 33.0464 245.872 39.0723V57.0527C245.872 58.9964 246.78 59.9678 248.594 59.9678H252.481V70.0762H244.317C241.92 70.0762 239.944 69.4933 238.389 68.3271C236.834 67.1609 236.056 65.605 236.056 63.6611V63.5645H234.209C233.95 64.342 233.367 65.3791 232.46 66.6748C231.553 67.9058 230.127 69.0067 228.184 69.9785C226.24 70.9504 223.583 71.4365 220.214 71.4365C216.78 71.4365 213.703 70.8537 210.981 69.6875C208.26 68.4565 206.09 66.707 204.47 64.4395C202.915 62.1069 202.137 59.2879 202.137 55.9834C202.137 52.6789 202.915 49.9247 204.47 47.7217C206.09 45.4541 208.292 43.7694 211.078 42.668C213.929 41.5017 217.169 40.919 220.797 40.9189H234.015V38.1973C234.015 35.9295 233.302 34.0827 231.877 32.6572C230.451 31.167 228.183 30.4219 225.073 30.4219C222.028 30.4219 219.761 31.1351 218.271 32.5605C216.78 33.9212 215.808 35.7032 215.354 37.9062L204.08 34.1152C204.858 31.6531 206.089 29.4178 207.773 27.4092C209.523 25.3358 211.823 23.6832 214.674 22.4521C217.589 21.1563 221.121 20.5088 225.268 20.5088ZM374.047 20.5088C380.396 20.5088 385.418 22.0959 389.111 25.2705C392.805 28.4454 394.651 33.0464 394.651 39.0723V57.0527C394.651 58.9964 395.559 59.9678 397.373 59.9678H401.261V70.0762H393.097C390.699 70.0762 388.723 69.4933 387.168 68.3271C385.613 67.1609 384.835 65.605 384.835 63.6611V63.5645H382.988C382.729 64.342 382.146 65.3791 381.239 66.6748C380.332 67.9058 378.906 69.0067 376.963 69.9785C375.019 70.9504 372.362 71.4365 368.993 71.4365C365.559 71.4365 362.482 70.8537 359.761 69.6875C357.04 68.4565 354.869 66.707 353.249 64.4395C351.694 62.1069 350.916 59.2879 350.916 55.9834C350.916 52.6789 351.694 49.9247 353.249 47.7217C354.869 45.4541 357.072 43.7694 359.857 42.668C362.708 41.5017 365.948 40.919 369.576 40.9189H382.794V38.1973C382.794 35.9295 382.082 34.0827 380.656 32.6572C379.231 31.167 376.963 30.4219 373.853 30.4219C370.807 30.4219 368.54 31.1351 367.05 32.5605C365.56 33.9212 364.587 35.7032 364.134 37.9062L352.859 34.1152C353.637 31.6531 354.868 29.4178 356.553 27.4092C358.302 25.3358 360.602 23.6832 363.453 22.4521C366.369 21.1563 369.9 20.5088 374.047 20.5088ZM28.5029 21.0918C32.2609 21.0918 35.5332 21.9664 38.3193 23.7158C41.1701 25.4004 43.3727 27.7654 44.9277 30.8105C46.4828 33.7911 47.2607 37.2904 47.2607 41.3076V70.0762H35.0146V42.2793C35.0146 38.6509 34.1072 35.9294 32.293 34.1152C30.5436 32.3012 28.017 31.3936 24.7129 31.3936C20.9549 31.3936 18.0392 32.6577 15.9658 35.1846C13.8924 37.6468 12.8555 41.1132 12.8555 45.584V70.0762H0.609375V21.8691H12.6611V28.1865H14.4102C15.1877 26.5019 16.6461 24.915 18.7842 23.4248C20.9224 21.8697 24.1618 21.0918 28.5029 21.0918ZM144.251 2.04199C153.387 2.04207 160.319 4.37504 165.049 9.04004C169.844 13.6404 172.241 20.5086 172.241 29.6445V42.4736C172.241 51.6096 169.844 58.5106 165.049 63.1758C160.319 67.7759 153.386 70.0761 144.251 70.0762H116.26V58.8018H125.201V13.3164H116.26V2.04199H144.251ZM193.622 70.0762H181.376V21.8691H193.622V70.0762ZM347.539 32.5605H341.513C338.403 32.5606 335.843 33.4024 333.835 35.0869C331.826 36.7067 330.822 39.234 330.822 42.668V70.0762H318.576V21.8691H330.628V27.3115H332.377C333.09 25.3679 334.256 23.9422 335.876 23.0352C337.56 22.1281 339.504 21.6749 341.707 21.6748H347.539V32.5605ZM461.921 21.0918C464.901 21.0919 467.59 21.7394 469.987 23.0352C472.449 24.2662 474.393 26.1779 475.818 28.7695C477.309 31.2965 478.054 34.504 478.054 38.3916V70.0762H465.808V39.2666C465.808 36.61 465.127 34.6338 463.767 33.3379C462.406 31.9774 460.495 31.2969 458.033 31.2969C455.247 31.2969 453.077 32.2043 451.521 34.0186C450.031 35.7679 449.286 38.2944 449.286 41.5986V70.0762H437.04V39.2666C437.04 36.6101 436.36 34.6338 434.999 33.3379C433.638 31.9772 431.727 31.2969 429.265 31.2969C426.479 31.2969 424.308 32.2043 422.753 34.0186C421.263 35.7679 420.518 38.2945 420.518 41.5986V70.0762H408.271V21.8691H420.323V27.1172H422.072C422.915 25.4974 424.308 24.1047 426.252 22.9385C428.196 21.7075 430.755 21.0918 433.93 21.0918C437.364 21.0918 440.117 21.7723 442.19 23.1328C444.264 24.4287 445.852 26.146 446.953 28.2842H448.702C449.804 26.2108 451.36 24.4935 453.368 23.1328C455.377 21.7723 458.228 21.0918 461.921 21.0918ZM221.672 50.0547C219.404 50.0547 217.622 50.5408 216.326 51.5127C215.03 52.4846 214.383 53.8454 214.383 55.5947C214.383 57.3441 215.063 58.7696 216.424 59.8711C217.784 60.9725 219.761 61.5234 222.353 61.5234C225.786 61.5234 228.573 60.5841 230.711 58.7051C232.914 56.7613 234.015 54.2013 234.015 51.0264V50.0547H221.672ZM370.451 50.0547C368.183 50.0547 366.401 50.5408 365.105 51.5127C363.81 52.4846 363.162 53.8454 363.162 55.5947C363.162 57.3441 363.842 58.7696 365.203 59.8711C366.564 60.9725 368.54 61.5234 371.132 61.5234C374.566 61.5234 377.352 60.5841 379.49 58.7051C381.693 56.7613 382.794 54.2013 382.794 51.0264V50.0547H370.451ZM81.6885 31.1992C77.9305 31.1992 74.7877 32.3985 72.2607 34.7959C69.734 37.1284 68.4708 40.4976 68.4707 44.9033V45.876C68.4708 50.2169 69.734 53.5861 72.2607 55.9834C74.7877 58.3808 77.9305 59.5791 81.6885 59.5791C85.4465 59.5791 88.5893 58.3808 91.1162 55.9834C93.6429 53.5861 94.9062 50.2169 94.9062 45.876V44.9033C94.9062 40.4976 93.6429 37.1284 91.1162 34.7959C88.6541 32.3985 85.5113 31.1992 81.6885 31.1992ZM281.675 31.1992C277.917 31.1992 274.774 32.3985 272.247 34.7959C269.72 37.1284 268.457 40.4976 268.457 44.9033V45.876C268.457 50.2169 269.72 53.5861 272.247 55.9834C274.774 58.3808 277.917 59.5791 281.675 59.5791C285.433 59.5791 288.576 58.3808 291.103 55.9834C293.629 53.5861 294.892 50.2169 294.893 45.876V44.9033C294.893 40.4976 293.629 37.1284 291.103 34.7959C288.64 32.3985 285.498 31.1992 281.675 31.1992ZM138.03 58.4131H144.445C149.629 58.413 153.419 57.0523 155.816 54.3311C158.214 51.6097 159.412 47.7866 159.412 42.8623V29.2559C159.412 24.2668 158.214 20.4437 155.816 17.7871C153.419 15.0658 149.629 13.7052 144.445 13.7051H138.03V58.4131ZM187.499 0.681641C189.767 0.681641 191.646 1.3939 193.137 2.81934C194.627 4.24481 195.372 6.12444 195.372 8.45703C195.372 10.7894 194.627 12.6683 193.137 14.0938C191.646 15.5192 189.767 16.2324 187.499 16.2324C185.296 16.2324 183.417 15.5192 181.862 14.0938C180.372 12.6683 179.627 10.7895 179.627 8.45703C179.627 6.12444 180.372 4.24481 181.862 2.81934C183.417 1.39408 185.296 0.681711 187.499 0.681641Z"]],template:function(t,o){t&1&&(O(0,"a",0)(1,"span",1),w(2,"ngDiagram"),N(),ce(),O(3,"svg",2),bt(4,"path",3),N()())},styles:["[_nghost-%COMP%]{position:absolute;width:var(--watermark-size)}.bottom-right[_nghost-%COMP%]{bottom:1rem;right:1rem}.top-right[_nghost-%COMP%]{top:1rem;right:1rem}.bottom-left[_nghost-%COMP%]{bottom:1rem;left:1rem}.top-left[_nghost-%COMP%]{top:1rem;left:1rem}[_nghost-%COMP%] svg[_ngcontent-%COMP%]{opacity:.7;height:100%;width:100%;display:block}[_nghost-%COMP%] svg[_ngcontent-%COMP%] path[_ngcontent-%COMP%]{fill:var(--watermark-fill)}[_nghost-%COMP%] [_ngcontent-%COMP%]:hover svg[_ngcontent-%COMP%]{opacity:1}[_nghost-%COMP%]{--watermark-size: min(4rem, 10%);--watermark-fill: #b3b3b3}[_nghost-%COMP%] .sr-only[_ngcontent-%COMP%]{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}"],changeDetection:1})},jp=class n{inputEventsRouter=f(ft);boxSelectionProvider=f(Er);flowCoreProvider=f(Oe);touchEventsStateService=f(Nn);touchStartPoint=null;isBoxSelectionActive=!1;longPressTimer=null;LONG_PRESS_DELAY=400;MOVE_THRESHOLD=10;onTouchStart(e){!this.isSingleTouch(e)||this.touchEventsStateService.rotateHandled()||this.touchEventsStateService.resizeHandled()||this.touchEventsStateService.linkingHandled()?this.cancelBoxSelection():(this.touchStartPoint={x:e.touches[0].clientX,y:e.touches[0].clientY},this.longPressTimer=setTimeout(()=>{this.isBoxSelectionActive=!0,this.touchEventsStateService.currentEvent.set(xt.BoxSelection);let t=e.touches[0]||this.touchStartPoint;t&&this.emitBoxSelectionEvent("start",e,t)},this.LONG_PRESS_DELAY))}onTouchMove(e){if(!this.isSingleTouch(e)||this.shouldCancelDuringLongPress(e))return void this.cancelBoxSelection();if(!this.isBoxSelectionActive||!this.touchStartPoint)return;let t=e.touches[0];this.emitBoxSelectionEvent("continue",e,t),this.updateBoundingBox(t),e.preventDefault(),e.stopPropagation()}onTouchEnd(e){if(this.clearLongPressTimer(),!this.isBoxSelectionActive)return void(this.touchStartPoint=null);let t=e.changedTouches[0]||e.touches[0]||this.touchStartPoint;t&&this.emitBoxSelectionEvent("end",e,t),this.touchEventsStateService.clearCurrentEvent(),this.cancelBoxSelection(),e.preventDefault(),e.stopPropagation()}cancelBoxSelection(){this.isBoxSelectionActive=!1,this.touchStartPoint=null,this.boxSelectionProvider.boundingBox.set(null),this.clearLongPressTimer()}clearLongPressTimer(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressTimer=null)}isSingleTouch(e){return e.touches.length===1}shouldCancelDuringLongPress(e){if(!this.longPressTimer||!this.touchStartPoint||this.isBoxSelectionActive)return!1;let t=e.touches[0];return Math.max(Math.abs(t.clientX-this.touchStartPoint.x),Math.abs(t.clientY-this.touchStartPoint.y))>this.MOVE_THRESHOLD}emitBoxSelectionEvent(e,t,o){if(!o)return;let i=this.inputEventsRouter.getBaseEvent(t);this.inputEventsRouter.emit(C(p({},i),{name:"boxSelection",phase:e,target:void 0,targetType:"diagram",lastInputPoint:{x:"clientX"in o?o.clientX:o.x,y:"clientY"in o?o.clientY:o.y}}))}updateBoundingBox(e){let t=this.flowCoreProvider.provide(),{x:o,y:i}=t.clientToFlowViewportPosition(this.touchStartPoint),{x:r,y:s}=t.clientToFlowViewportPosition({x:e.clientX,y:e.clientY}),a=Math.min(o,r),d=Math.min(i,s),l=Math.abs(r-o),h=Math.abs(s-i);this.boxSelectionProvider.boundingBox.set({x:a,y:d,width:l,height:h})}static \u0275fac=function(t){return new(t||n)};static \u0275dir=_e({type:n,selectors:[["","ngDiagramMobileBoxSelection",""]],hostBindings:function(t,o){t&1&&R("touchstart",function(r){return o.onTouchStart(r)})("touchmove",function(r){return o.onTouchMove(r)})("touchend",function(r){return o.onTouchEnd(r)})("touchcancel",function(r){return o.onTouchEnd(r)})}})},Rr=class n{elementRef=f(He);flowCoreProvider=f(Oe);renderer=f(vn);flowResizeBatchProcessor=f(_a);flowOffsetService=f(Ca);templateProviderService=f(Aa);initializedModel=null;resizeObserver=null;config=T();model=T.required();middlewares=T(MI);nodeTemplateMap=T(new fi);edgeTemplateMap=T(new hi);nodes=this.renderer.nodes;edges=this.renderer.edges;viewport=this.renderer.viewport;viewportPannable=this.renderer.viewportPannable;diagramInit=new ke;edgeDrawn=new ke;edgeDrawEnded=new ke;selectionMoved=new ke;selectionChanged=new ke;selectionGestureEnded=new ke;selectionRemoved=new ke;groupMembershipChanged=new ke;selectionRotated=new ke;nodeRotateStarted=new ke;nodeRotateEnded=new ke;viewportChanged=new ke;clipboardPasted=new ke;nodeResized=new ke;nodeResizeStarted=new ke;nodeResizeEnded=new ke;paletteItemDropped=new ke;nodeDragStarted=new ke;nodeDragEnded=new ke;constructor(){xe(()=>{let e=this.model();this.initializedModel!=e&&(ye(()=>{this.renderer.isInitialized.set(!1),this.renderer.viewportPannable.set(this.config()?.viewportPanningEnabled??!0),this.flowCoreProvider.destroy(),this.flowOffsetService.reset(),this.flowCoreProvider.init(e,this.middlewares(),this.flowOffsetService.getFlowOffset,this.getViewportSize,this.config())}),this.initializedModel=e,this.flowOffsetService.initialize(this.elementRef.nativeElement),this.setupEventBridge())}),xe(()=>{let e=this.nodeTemplateMap();this.templateProviderService.setNodeTemplateMap(e)}),xe(()=>{let e=this.edgeTemplateMap();this.templateProviderService.setEdgeTemplateMap(e)})}ngOnInit(){this.flowResizeBatchProcessor.initialize(),this.setupViewportSizeTracking()}ngOnDestroy(){this.flowCoreProvider.destroy(),this.cleanupViewportSizeTracking()}getNodeTemplate(e){return this.templateProviderService.getNodeTemplate(e)}getEdgeTemplate(e){return this.templateProviderService.getEdgeTemplate(e)}trackNode=(e,t)=>t._internalId||t.id;trackEdge=(e,t)=>t._internalId||t.id;isGroup(e){return"isGroup"in e}castToGroupNode(e){return e}getBoundingClientRect(){return this.elementRef.nativeElement.getBoundingClientRect()}getViewportSize=()=>{let{width:e,height:t}=this.elementRef.nativeElement.getBoundingClientRect();return{width:e,height:t}};setupViewportSizeTracking(){if(typeof ResizeObserver>"u")return;this.resizeObserver=new ResizeObserver(t=>{let o=t[0];if(o){this.flowOffsetService.invalidateCache();let{width:i,height:r}=o.contentRect;this.updateViewportSize(i,r)}}),this.resizeObserver.observe(this.elementRef.nativeElement);let e=this.elementRef.nativeElement.getBoundingClientRect();this.updateViewportSize(e.width,e.height)}cleanupViewportSizeTracking(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}updateViewportSize(e,t){if(!this.flowCoreProvider.isInitialized())return;let o=this.flowCoreProvider.provide(),i=o.getState().metadata.viewport;i.width===e&&i.height===t||o.applyUpdate({metadataUpdate:{viewport:C(p({},i),{width:e,height:t})}},"updateViewportSize")}setupEventBridge(){let e=this.flowCoreProvider.provide(),t=e.eventManager;t.on("diagramInit",o=>{setTimeout(()=>{this.renderer.isInitialized.set(!0),this.diagramInit.emit(o),e.config.zoom.zoomToFit.onInit&&e.commandHandler.emit("zoomToFit",{})})}),t.on("edgeDrawn",o=>this.edgeDrawn.emit(o)),t.on("edgeDrawEnded",o=>this.edgeDrawEnded.emit(o)),t.on("selectionMoved",o=>this.selectionMoved.emit(o)),t.on("selectionChanged",o=>this.selectionChanged.emit(o)),t.on("selectionGestureEnded",o=>this.selectionGestureEnded.emit(o)),t.on("selectionRemoved",o=>this.selectionRemoved.emit(o)),t.on("groupMembershipChanged",o=>this.groupMembershipChanged.emit(o)),t.on("selectionRotated",o=>this.selectionRotated.emit(o)),t.on("nodeRotateStarted",o=>this.nodeRotateStarted.emit(o)),t.on("nodeRotateEnded",o=>this.nodeRotateEnded.emit(o)),t.on("viewportChanged",o=>this.viewportChanged.emit(o)),t.on("clipboardPasted",o=>this.clipboardPasted.emit(o)),t.on("nodeResized",o=>this.nodeResized.emit(o)),t.on("nodeResizeStarted",o=>this.nodeResizeStarted.emit(o)),t.on("nodeResizeEnded",o=>this.nodeResizeEnded.emit(o)),t.on("paletteItemDropped",o=>this.paletteItemDropped.emit(o)),t.on("nodeDragStarted",o=>this.nodeDragStarted.emit(o)),t.on("nodeDragEnded",o=>this.nodeDragEnded.emit(o))}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=B({type:n,selectors:[["ng-diagram"]],hostVars:2,hostBindings:function(t,o){t&2&&G("pannable",o.viewportPannable())},inputs:{config:[1,"config"],model:[1,"model"],middlewares:[1,"middlewares"],nodeTemplateMap:[1,"nodeTemplateMap"],edgeTemplateMap:[1,"edgeTemplateMap"]},outputs:{diagramInit:"diagramInit",edgeDrawn:"edgeDrawn",edgeDrawEnded:"edgeDrawEnded",selectionMoved:"selectionMoved",selectionChanged:"selectionChanged",selectionGestureEnded:"selectionGestureEnded",selectionRemoved:"selectionRemoved",groupMembershipChanged:"groupMembershipChanged",selectionRotated:"selectionRotated",nodeRotateStarted:"nodeRotateStarted",nodeRotateEnded:"nodeRotateEnded",viewportChanged:"viewportChanged",clipboardPasted:"clipboardPasted",nodeResized:"nodeResized",nodeResizeStarted:"nodeResizeStarted",nodeResizeEnded:"nodeResizeEnded",paletteItemDropped:"paletteItemDropped",nodeDragStarted:"nodeDragStarted",nodeDragEnded:"nodeDragEnded"},features:[Pn([Pp,xp,jp,lp,wp,yp,Sp,vp,pp,mp,hp])],ngContentSelectors:p1,decls:10,vars:2,consts:[[1,"diagram-background-container"],[3,"viewport"],[1,"ng-diagram-node",3,"node"],[3,"preferredPosition"],[3,"edge"],[4,"ngComponentOutlet","ngComponentOutletInputs"],[3,"node"]],template:function(t,o){if(t&1&&(it(u1),y(0,"div",0),Je(1),m(),y(2,"ng-diagram-canvas",1),X(3,v1,3,2,"ng-diagram-edge",null,o.trackEdge,!0),F(5,"ng-diagram-marker-arrow"),X(6,x1,4,3,"ng-diagram-node",2,o.trackNode,!0),m(),P(8,S1,1,1,"ng-diagram-watermark",3),F(9,"ng-diagram-box-selection")),t&2){let i;u(2),M("viewport",o.viewport()),u(),Q(o.edges()),u(3),Q(o.nodes()),u(2),E((i=o.config())!=null&&i.hideWatermark?-1:8)}},dependencies:[Yi,Ps,Ip,La,Rp,Tp,Up,Fp,Np,Vp,Ep],styles:["[_nghost-%COMP%]{width:100%;height:100%;display:flex;position:relative;overflow:hidden;background-color:var(--ngd-diagram-background-color);touch-action:none;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;transform:translateZ(0);-webkit-font-smoothing:antialiased;outline:none}.pannable[_nghost-%COMP%]{cursor:grab}.pannable.panning[_nghost-%COMP%]{cursor:grabbing}[_nghost-%COMP%] .diagram-background-container[_ngcontent-%COMP%]{width:100%;height:100%}"]})},Wp=class n{panelRegistry=f(Mr);position=T("bottom-right");ngAfterViewInit(){this.panelRegistry?.register(this)}ngOnDestroy(){this.panelRegistry?.unregister()}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=B({type:n,selectors:[["ng-diagram-panel"]],hostVars:2,hostBindings:function(t,o){t&2&&tt(o.position())},inputs:{position:[1,"position"]},ngContentSelectors:Lt,decls:1,vars:0,template:function(t,o){t&1&&(it(),Je(0))},styles:["[_nghost-%COMP%]{overflow:hidden;border-radius:var(--ngd-minimap-border-radius);padding:var(--ngd-minimap-padding);background-color:var(--ngd-minimap-background);box-shadow:0 8px 16px -4px var(--ngd-minimap-shadow-color);border:1px solid var(--ngd-minimap-border-color);display:flex;flex-direction:column;gap:var(--ngd-minimap-padding)}"]})},Gp=class n{viewportService=f(wn);step=T(.1);zoomPercentage=b(()=>Math.round(100*this.viewportService.scale()));canZoomIn=b(()=>this.viewportService.scale()+this.step()<=this.viewportService.maxZoom);canZoomOut=b(()=>this.viewportService.scale()-this.step()>=this.viewportService.minZoom);zoomIn(){let e=this.viewportService.scale(),t=(e+this.step())/e;this.viewportService.zoom(t)}zoomOut(){let e=this.viewportService.scale(),t=(e-this.step())/e;this.viewportService.zoom(t)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=B({type:n,selectors:[["ng-diagram-zoom-controls"]],inputs:{step:[1,"step"]},decls:7,vars:3,consts:[[1,"zoom-controls-container"],["aria-label","Zoom out",1,"nav-button",3,"click","disabled"],[1,"label"],["aria-label","Zoom in",1,"nav-button",3,"click","disabled"]],template:function(t,o){t&1&&(O(0,"div",0)(1,"button",1),ge("click",function(){return o.zoomOut()}),w(2,"\u2212"),N(),O(3,"span",2),w(4),N(),O(5,"button",3),ge("click",function(){return o.zoomIn()}),w(6,"+"),N()()),t&2&&(u(),he("disabled",!o.canZoomOut()),u(3),H("",o.zoomPercentage(),"%"),u(),he("disabled",!o.canZoomIn()))},styles:[".zoom-controls-container[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between}.zoom-controls-container[_ngcontent-%COMP%] .label[_ngcontent-%COMP%]{text-align:center;font-size:var(--ngd-zoom-controls-font-size);font-weight:var(--ngd-zoom-controls-font-weight);color:var(--ngd-zoom-controls-color);-webkit-user-select:none;user-select:none}.nav-button[_ngcontent-%COMP%]{width:var(--ngd-nav-button-size);height:var(--ngd-nav-button-size);color:var(--ngd-nav-button-color);border-radius:var(--ngd-nav-button-border-radius);padding:var(--ngd-nav-button-padding);border:none;background:none;box-sizing:content-box;cursor:pointer;font-size:var(--ngd-nav-button-size);line-height:var(--ngd-nav-button-size)}.nav-button[_ngcontent-%COMP%]:hover:not(:disabled){background-color:var(--ngd-nav-button-background-color-hover)}.nav-button[_ngcontent-%COMP%]:active{color:var(--ngd-nav-button-color-active)}.nav-button[_ngcontent-%COMP%]:disabled{color:var(--ngd-nav-button-color-disabled);cursor:default}"]})},qp=class n{bounds=T.required();nodeStyle=T();computedStyle=b(()=>this.nodeStyle()??{});shape=b(()=>this.computedStyle().shape??"rect");hostClass=b(()=>{let e=this.computedStyle().cssClass;return e?`minimap-node ${e}`:"minimap-node"});cx=b(()=>this.bounds().x+this.bounds().width/2);cy=b(()=>this.bounds().y+this.bounds().height/2);radius=b(()=>Math.min(this.bounds().width,this.bounds().height)/2);rx=b(()=>this.bounds().width/2);ry=b(()=>this.bounds().height/2);static \u0275fac=function(t){return new(t||n)};static \u0275cmp=B({type:n,selectors:[["g","ng-diagram-default-minimap-node",""]],hostVars:11,hostBindings:function(t,o){t&2&&(K("transform",o.bounds().transform),tt(o.hostClass()),Ze("fill",o.computedStyle().fill)("stroke",o.computedStyle().stroke)("stroke-width",o.computedStyle().strokeWidth,"px")("opacity",o.computedStyle().opacity))},inputs:{bounds:[1,"bounds"],nodeStyle:[1,"nodeStyle"]},decls:3,vars:1,template:function(t,o){if(t&1&&P(0,P1,1,3,":svg:circle")(1,E1,1,4,":svg:ellipse")(2,I1,1,4,":svg:rect"),t&2){let i;E((i=o.shape())==="circle"?0:i==="ellipse"?1:2)}},styles:["[_nghost-%COMP%]{fill:var(--ngd-minimap-node-color);opacity:var(--ngd-minimap-node-opacity)}"]})},Kp=class n{diagramBounds=T.required();minimapTransform=T.required();rect=b(()=>{let e=this.diagramBounds(),t=this.minimapTransform();return{x:e.x*t.scale+t.offsetX,y:e.y*t.scale+t.offsetY,width:e.width*t.scale,height:e.height*t.scale}});static \u0275fac=function(t){return new(t||n)};static \u0275cmp=B({type:n,selectors:[["rect","ng-diagram-minimap-diagram-bounds",""]],hostVars:4,hostBindings:function(t,o){t&2&&K("x",o.rect().x)("y",o.rect().y)("width",o.rect().width)("height",o.rect().height)},inputs:{diagramBounds:[1,"diagramBounds"],minimapTransform:[1,"minimapTransform"]},decls:0,vars:0,template:function(t,o){},styles:["[_nghost-%COMP%]{fill:var(--ngd-minimap-diagram-bounds-color);opacity:var(--ngd-minimap-diagram-bounds-opacity);stroke:none;pointer-events:none}"]})},za=class n{diagramService=f(At);isInteracting=b(()=>{let e=this.diagramService.actionState();return!!e.dragging?.movementStarted||!!e.resize||!!e.rotation});static \u0275fac=function(t){return new(t||n)};static \u0275prov=j({token:n,factory:n.\u0275fac})},Yp=class n{viewportService=f(wn);flowCoreProvider=f(Oe);transform=T.required();viewport=T.required();dragState={isDragging:!1,lastPosition:{x:0,y:0},pointerId:null};ngOnDestroy(){this.removeDocumentListeners()}onPointerDown(e){e.button===0&&(e.preventDefault(),this.capturePointer(e),this.dragState.isDragging=!0,this.dragState.lastPosition={x:e.clientX,y:e.clientY},this.setPanningState(!0),this.attachDocumentListeners())}onPointerMove=e=>{if(!this.dragState.isDragging)return;let t=this.calculateClientDelta(e);this.dragState.lastPosition={x:e.clientX,y:e.clientY};let o=this.calculateViewportDelta(t);this.viewportService.moveViewportBy(o.x,o.y)};onPointerUp=e=>{this.dragState.isDragging=!1,this.setPanningState(!1),this.releasePointer(e),this.removeDocumentListeners()};capturePointer(e){e.target.setPointerCapture(e.pointerId),this.dragState.pointerId=e.pointerId}releasePointer(e){if(this.dragState.pointerId===null)return;let t=e.target;t.hasPointerCapture(this.dragState.pointerId)&&t.releasePointerCapture(this.dragState.pointerId),this.dragState.pointerId=null}attachDocumentListeners(){document.addEventListener("pointermove",this.onPointerMove),document.addEventListener("pointerup",this.onPointerUp),document.addEventListener("pointercancel",this.onPointerUp)}removeDocumentListeners(){document.removeEventListener("pointermove",this.onPointerMove),document.removeEventListener("pointerup",this.onPointerUp),document.removeEventListener("pointercancel",this.onPointerUp)}setPanningState(e){let t=this.flowCoreProvider.provide().actionStateManager;e?t.panning={active:!0}:t.clearPanning()}calculateClientDelta(e){return{x:e.clientX-this.dragState.lastPosition.x,y:e.clientY-this.dragState.lastPosition.y}}calculateViewportDelta(e){let{scale:t}=this.transform(),{scale:o}=this.viewport();return{x:-e.x/t*o,y:-e.y/t*o}}static \u0275fac=function(t){return new(t||n)};static \u0275dir=_e({type:n,selectors:[["","ngDiagramMinimapNavigation",""]],hostBindings:function(t,o){t&1&&R("pointerdown",function(r){return o.onPointerDown(r)})},inputs:{transform:[1,"transform"],viewport:[1,"viewport"]}})},AI=n=>({x:-n.x/n.scale,y:-n.y/n.scale,width:(n.width??0)/n.scale,height:(n.height??0)/n.scale}),LI=(n,e)=>e.width===0||e.height===0?n:_o([n,e]),FI=(n,e,t,o)=>n.width===0||n.height===0?1:Math.min((e-2*o)/n.width,(t-2*o)/n.height),zI=(n,e,t,o)=>({offsetX:(e-n.width*o)/2-n.x*o,offsetY:(t-n.height*o)/2-n.y*o}),$I=(n,e,t,o)=>{let i=FI(n,e,t,o),{offsetX:r,offsetY:s}=zI(n,e,t,i);return{scale:i,offsetX:r,offsetY:s}},iy={width:100,height:50},BI=(n,e=iy)=>{let t=n.size??e,o=n.angle??0;return{id:n.id,x:n.position.x,y:n.position.y,width:t.width,height:t.height,angle:o,transform:`rotate(${o} ${n.position.x+t.width/2} ${n.position.y+t.height/2})`}},HI=(n,e=iy)=>{if(n.length===0)return{x:0,y:0,width:0,height:0};let t=n.map(o=>{let i=o.size??e;return ah({x:o.position.x,y:o.position.y,width:i.width,height:i.height},o.angle??0)});return _o(t)},UI=(n,e)=>({x:-n.x/n.scale*e.scale+e.offsetX,y:-n.y/n.scale*e.scale+e.offsetY,width:(n.width??0)/n.scale*e.scale,height:(n.height??0)/n.scale*e.scale}),Zp=class extends Map{},Xp=class{cache=new WeakMap;clear(){this.cache=new WeakMap}getOrCompute(e,t){let o=this.cache.get(e);if(o)return o;let i=t();return this.cache.set(e,i),i}},$a=class n{renderer=f(vn);cache=new Xp;lastStyleFn;lastTemplateMap;computeMinimapNodes(e,t){return this.invalidateCacheIfNeeded(e,t),this.renderer.nodes().map(o=>this.cache.getOrCompute(o,()=>({bounds:BI(o),diagramNode:o,nodeStyle:e?.(o)??{},template:o.type?t.get(o.type)??null:null})))}computeDiagramBounds(){return dh(this.renderer.nodes(),[])}invalidateCacheIfNeeded(e,t){e===this.lastStyleFn&&t===this.lastTemplateMap||(this.cache.clear(),this.lastStyleFn=e,this.lastTemplateMap=t)}static \u0275fac=function(t){return new(t||n)};static \u0275prov=j({token:n,factory:n.\u0275fac})},ln=class n extends Rn{diagramService=f(At);_nodes=U([]);_edges=U([]);_metadata=U({viewport:{x:0,y:0,scale:1}});nodes=this._nodes.asReadonly();edges=this._edges.asReadonly();metadata=this._metadata.asReadonly();constructor(){super(),xe(()=>{this.diagramService.isInitialized()&&(this.flowCore.model.onChange(this.modelListener),ye(()=>this.modelListener({nodes:this.flowCore.model.getNodes(),edges:this.flowCore.model.getEdges(),metadata:this.flowCore.model.getMetadata()})))})}ngOnDestroy(){this.flowCoreProvider.isInitialized()&&this.flowCore.model.unregisterOnChange(this.modelListener)}getModel(){return this.flowCore.model}toJSON(){return this.flowCore.model.toJSON()}addEdges(e){this.flowCore.commandHandler.emit("addEdges",{edges:e})}addNodes(e){this.flowCore.commandHandler.emit("addNodes",{nodes:e})}getEdgeById(e){return this.flowCore.getEdgeById(e)||null}getNearestNodeInRange(e,t){return this.flowCore.getNearestNodeInRange(e,t)||null}getNearestPortInRange(e,t){return this.flowCore.getNearestPortInRange(e,t)||null}getNodeById(e){return this.flowCore.getNodeById(e)}getNodesInRange(e,t){return this.flowCore.getNodesInRange(e,t)}getConnectedEdges(e){return this.flowCore.getConnectedEdges(e)}getConnectedNodes(e){return this.flowCore.getConnectedNodes(e)}getNodeEnds(e){return this.flowCore.getNodeEnds(e)}getChildren(e){return this.flowCore.getChildren(e)}getChildrenNested(e){return this.flowCore.getChildrenNested(e)}isNestedChild(e,t){return this.flowCore.isNestedChild(e,t)}getParentHierarchy(e){return this.flowCore.getParentHierarchy(e)}getOverlappingNodes(e){return this.flowCore.getOverlappingNodes(e)}computePartsBounds(e,t){return dh(e,t)}updateEdge(e,t){this.flowCore.commandHandler.emit("updateEdge",{id:e,edgeChanges:p({},t)})}updateEdgeData(e,t){this.flowCore.commandHandler.emit("updateEdge",{id:e,edgeChanges:{data:t}})}updateNode(e,t){this.flowCore.commandHandler.emit("updateNode",{id:e,nodeChanges:p({},t)})}updateNodeData(e,t){this.flowCore.commandHandler.emit("updateNode",{id:e,nodeChanges:{data:t}})}updateNodes(e){this.flowCore.commandHandler.emit("updateNodes",{nodes:e})}updateEdges(e){this.flowCore.commandHandler.emit("updateEdges",{edges:e})}deleteEdges(e){this.flowCore.commandHandler.emit("deleteEdges",{ids:e})}deleteNodes(e){this.flowCore.commandHandler.emit("deleteNodes",{ids:e})}modelListener=e=>{this._nodes.set(e.nodes),this._edges.set(e.edges),this._metadata.set(e.metadata)};static \u0275fac=function(t){return new(t||n)};static \u0275prov=j({token:n,factory:n.\u0275fac})},Ba=class n{modelService=f(ln);computeMinimapNodes(){return[]}computeDiagramBounds(){return HI(this.modelService.nodes())}static \u0275fac=function(t){return new(t||n)};static \u0275prov=j({token:n,factory:n.\u0275fac})},Ha=class n{VIEWPORT_STROKE_WIDTH_CSS_VAR="--ngd-minimap-viewport-stroke-width";renderer=f(vn);flowCoreProvider=f(Oe);interactionTracker=f(za);elementRef=f(He);directStrategy=f($a);virtualizedStrategy=f(Ba);strokePadding=U(1);position=T("bottom-right");width=T(200);height=T(150);showZoomControls=T(!0);nodeStyle=T();minimapNodeTemplateMap=T(new Zp);deferNodeUpdates=T(!1);ngAfterViewInit(){this.strokePadding.set(this.getStrokePaddingFromCss())}isDiagramInitialized=this.renderer.isInitialized;viewport=this.renderer.viewport;hasValidViewport=b(()=>{let e=this.viewport();return!!e.width&&!!e.height&&e.width>0&&e.height>0});viewportRect=b(()=>UI(this.viewport(),this.transform()));strategy=b(()=>this.isDiagramInitialized()&&this.flowCoreProvider.provide().isVirtualizationActive?this.virtualizedStrategy:this.directStrategy);transform=b(()=>$I(this.combinedBounds(),this.width(),this.height(),this.strokePadding()));nodesGroupTransform=b(()=>{let e=this.transform();return`translate(${e.offsetX}, ${e.offsetY}) scale(${e.scale})`});isDeferringUpdates=b(()=>this.deferNodeUpdates()&&this.interactionTracker.isInteracting());cachedMinimapNodes=[];cachedDiagramBounds={x:0,y:0,width:0,height:0};minimapNodes=b(()=>{if(this.isDeferringUpdates())return this.cachedMinimapNodes;let e=this.strategy().computeMinimapNodes(this.nodeStyle(),this.minimapNodeTemplateMap());return this.cachedMinimapNodes=e,e});showDiagramBounds=b(()=>this.isDiagramInitialized()&&this.flowCoreProvider.provide().isVirtualizationActive);diagramBounds=b(()=>{if(this.isDeferringUpdates())return this.cachedDiagramBounds;let e=this.strategy().computeDiagramBounds();return this.cachedDiagramBounds=e,e});viewportBoundsInDiagramSpace=b(()=>AI(this.viewport()));combinedBounds=b(()=>LI(this.diagramBounds(),this.viewportBoundsInDiagramSpace()));getStrokePaddingFromCss(){let e=getComputedStyle(this.elementRef.nativeElement).getPropertyValue(this.VIEWPORT_STROKE_WIDTH_CSS_VAR).trim();return parseFloat(e)||1}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=B({type:n,selectors:[["ng-diagram-minimap"]],hostVars:2,hostBindings:function(t,o){t&2&&tt(o.position())},inputs:{position:[1,"position"],width:[1,"width"],height:[1,"height"],showZoomControls:[1,"showZoomControls"],nodeStyle:[1,"nodeStyle"],minimapNodeTemplateMap:[1,"minimapNodeTemplateMap"],deferNodeUpdates:[1,"deferNodeUpdates"]},features:[Go([$a,Ba,za])],decls:5,vars:10,consts:[[3,"position"],["ngDiagramMinimapNavigation","",1,"minimap-svg",3,"transform","viewport"],["x","0","y","0",1,"minimap-background"],["ng-diagram-minimap-diagram-bounds","",3,"diagramBounds","minimapTransform"],[1,"minimap-viewport"],["ng-diagram-default-minimap-node","",3,"bounds","nodeStyle"],[4,"ngComponentOutlet","ngComponentOutletInputs"]],template:function(t,o){t&1&&(y(0,"ng-diagram-panel",0),ce(),y(1,"svg",1),F(2,"rect",2),P(3,L1,5,3),m(),P(4,F1,1,0,"ng-diagram-zoom-controls"),m()),t&2&&(M("position",o.position()),u(),M("transform",o.transform())("viewport",o.viewport()),K("viewBox","0 0 "+o.width()+" "+o.height())("width",o.width())("height",o.height()),u(),K("width",o.width())("height",o.height()),u(),E(o.isDiagramInitialized()?3:-1),u(),E(o.showZoomControls()&&o.isDiagramInitialized()?4:-1))},dependencies:[Yp,Yi,Ps,qp,Kp,Gp,Wp],styles:["[_nghost-%COMP%]{display:block;position:absolute;pointer-events:auto;z-index:10}.bottom-right[_nghost-%COMP%]{bottom:var(--ngd-minimap-margin);right:var(--ngd-minimap-margin)}.bottom-left[_nghost-%COMP%]{bottom:var(--ngd-minimap-margin);left:var(--ngd-minimap-margin)}.top-right[_nghost-%COMP%]{top:var(--ngd-minimap-margin);right:var(--ngd-minimap-margin)}.top-left[_nghost-%COMP%]{top:var(--ngd-minimap-margin);left:var(--ngd-minimap-margin)}.minimap-svg[_ngcontent-%COMP%]{display:block;cursor:pointer;touch-action:none}.minimap-background[_ngcontent-%COMP%]{fill:transparent}.minimap-viewport[_ngcontent-%COMP%]{stroke:var(--ngd-minimap-viewport-stroke-color);stroke-width:var(--ngd-minimap-viewport-stroke-width);fill:transparent;pointer-events:none}.minimap-footer[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center}"]})};var Qp=class n extends Rn{copy(){this.flowCore.commandHandler.emit("copy")}cut(){this.flowCore.commandHandler.emit("cut")}paste(e){this.flowCore.commandHandler.emit("paste",{position:e})}static \u0275fac=(()=>{let e;return function(o){return(e||(e=Nt(n)))(o||n)}})();static \u0275prov=j({token:n,factory:n.\u0275fac})},Jp=class n extends Rn{addToGroup(e,t){this.flowCore.commandHandler.emit("addToGroup",{groupId:e,nodeIds:t})}highlightGroup(e,t){this.flowCore.commandHandler.emit("highlightGroup",{groupId:e,nodes:t})}highlightGroupClear(){this.flowCore.commandHandler.emit("highlightGroupClear")}removeFromGroup(e,t){this.flowCore.commandHandler.emit("removeFromGroup",{groupId:e,nodeIds:t})}static \u0275fac=(()=>{let e;return function(o){return(e||(e=Nt(n)))(o||n)}})();static \u0275prov=j({token:n,factory:n.\u0275fac})},bo=class n extends Rn{moveNodesBy(e,t){this.flowCore.commandHandler.emit("moveNodesBy",{nodes:e,delta:t})}resizeNode(e,t,o,i){this.flowCore.commandHandler.emit("resizeNode",{id:e,size:t,position:o,disableAutoSize:i})}rotateNodeTo(e,t){this.flowCore.commandHandler.emit("rotateNodeTo",{nodeId:e,angle:t})}bringToFront(e,t){this.flowCore.commandHandler.emit("bringToFront",{nodeIds:e,edgeIds:t})}sendToBack(e,t){this.flowCore.commandHandler.emit("sendToBack",{nodeIds:e,edgeIds:t})}static \u0275fac=(()=>{let e;return function(o){return(e||(e=Nt(n)))(o||n)}})();static \u0275prov=j({token:n,factory:n.\u0275fac})},Co=class n extends Rn{modelService=f(ln);selection=b(()=>({nodes:this.modelService.nodes().filter(e=>e.selected),edges:this.modelService.edges().filter(e=>e.selected)}));select(e=[],t=[]){this.flowCore.commandHandler.emit("select",{nodeIds:e,edgeIds:t})}deselect(e=[],t=[]){this.flowCore.commandHandler.emit("deselect",{nodeIds:e,edgeIds:t})}deselectAll(){this.flowCore.commandHandler.emit("deselectAll")}deleteSelection(){this.flowCore.commandHandler.emit("deleteSelection")}static \u0275fac=(()=>{let e;return function(o){return(e||(e=Nt(n)))(o||n)}})();static \u0275prov=j({token:n,factory:n.\u0275fac})};function ry(n){let a=n,{selected:e,measuredPorts:t,measuredBounds:o,computedZIndex:i,_internalId:r}=a;return gn(a,["selected","measuredPorts","measuredBounds","computedZIndex","_internalId"])}function sy(n){let a=n,{sourcePosition:e,targetPosition:t,measuredLabels:o,computedZIndex:i,_internalId:r}=a;return gn(a,["sourcePosition","targetPosition","measuredLabels","computedZIndex","_internalId"])}var eh=class n{effectRef=null;nodes=U([]);edges=U([]);metadata=U({viewport:{x:0,y:0,scale:1}});callbacks=[];constructor(){this.effectRef=xe(()=>{let e=this.nodes(),t=this.edges(),o=this.metadata();ye(()=>{for(let i of this.callbacks)i({nodes:e,edges:t,metadata:o})})})}destroy(){this.effectRef?.destroy(),this.callbacks=[],this.nodes.set([]),this.edges.set([]),this.metadata.set({viewport:{x:0,y:0,scale:1}})}getNodes(){return this.nodes()}getEdges(){return this.edges()}updateNodes(e){this.nodes.update(t=>typeof e=="function"?e(t):e)}updateEdges(e){this.edges.update(t=>typeof e=="function"?e(t):e)}getMetadata(){return this.metadata()}updateMetadata(e){this.metadata.update(t=>typeof e=="function"?e(t):e)}onChange(e){this.callbacks.push(e)}unregisterOnChange(e){this.callbacks=this.callbacks.filter(t=>t!==e)}undo(){console.warn("Undo is not implemented in the current model. Please implement a custom ModelAdapter to support undo functionality.")}redo(){console.warn("Redo is not implemented in the current model. Please implement a custom ModelAdapter to support redo functionality.")}toJSON(){let e=this.metadata();return JSON.stringify({nodes:this.nodes().map(ry),edges:this.edges().map(sy),metadata:e})}static \u0275fac=function(t){return new(t||n)};static \u0275prov=j({token:n,factory:n.\u0275fac})};function ay(n={},e){return ye(()=>{let t=()=>VI(new eh,n);return e?It(e,t):t()})}function VI(n,e,t){let o=()=>{let i=f(Ir),r=()=>i.generateId();return e&&(n.updateNodes(e.nodes||[]),n.updateEdges(e.edges||[]),n.updateMetadata(s=>p(p({},s),e.metadata))),n.updateNodes(n.getNodes().map(s=>ya(ry(s),r))),n.updateEdges(n.getEdges().map(s=>ya(sy(s),r))),n};return t?It(t,o):o()}function dy(){return[xa,Oe,Ca,kr,vn,ft,_a,At,ci,Xn,wn,ln,Co,Qp,bo,Jp,pi,Ma,Aa,ui,Mr]}var uh=.01;function qa(n,e){return Math.abs(n.x-e.x)<uh&&Math.abs(n.y-e.y)<uh&&Math.abs(n.scale-e.scale)<uh}function ly(n){return qa(n,{x:0,y:0,scale:1})}function cy(n,e,t){return t?{publish:!0,hydrateConsumed:!0}:qa(n,e)?{publish:!1,hydrateConsumed:!0}:ly(n)&&!ly(e)?{publish:!1,hydrateConsumed:!1}:{publish:!1,hydrateConsumed:!1}}var uy=(n,e)=>({basePortId:n,slotIndex:e}),hh=(n,e)=>e===0?n:`${n}@${e}`,fh=n=>{let e=n.lastIndexOf("@");if(e>0){let t=Number(n.slice(e+1));if(Number.isInteger(t)&&t>=0)return uy(n.slice(0,e),t)}return uy(n,0)};var Fe=n=>Array.isArray(n)&&(n[0]==="in"||n[0]==="out"),Yt=n=>Fe(n)&&"value"in n[3];var xo=n=>`in:${n}`,Nr=n=>`out:${n}`,mi=n=>n.startsWith("in:")?n.slice(3):n,So=n=>n.startsWith("out:")?n.slice(4):n,yi=hh,Qn=fh;var gh=(n,e)=>e.get(n)?.defaultCanvasSize,py=(n,e,t)=>{let o=gh(n,t);return o===void 0?{x:e.x,y:e.y}:p({x:e.x,y:e.y},o)};var YI={inputsConfigs:[],outputsConfigs:[],bypassPorts:{}},mh=(n,e)=>{let t=e.get(n);return t!==void 0?t:YI},ZI=(n,e)=>{let t=n.ui.position.width;return t===void 0?gh(n.type,e):{width:t,height:n.ui.position.height??72}},Ka=(n,e)=>{let t=ZI(n,e),o=mh(n.type,e),i=t!==void 0;return C(p({id:n.id,type:"lf-node",position:{x:n.ui.position.x,y:n.ui.position.y}},t!==void 0?{size:t}:{}),{autoSize:!i,resizable:!0,data:C(p({},n),{portsConfig:o})})},yh=n=>({id:n.edgeId,type:"lf-edge",source:n.fromNodeId,target:n.toNodeId,sourcePort:Nr(yi(...n.fromPort)),targetPort:xo(yi(...n.toPort)),data:{}});var Ya=new Map,hy={map:Ya,runId:null},XI=n=>{if(n===null)return[];let e=new Set;for(let t of n.events)Fe(t)&&t[0]==="out"&&e.add(String(t[1]));return[...e]},QI=(n,e,t)=>{if(e.length===0)return n;let o=new Map(n);for(let i of e)o.has(i)||o.set(i,t);return o},JI=(n,e)=>{if(e.type==="snapshot")return e.snap===null?hy:{map:QI(Ya,XI(e.snap),e.atMs),runId:e.snap.runId??null};if(e.type==="output"){let t=new Map(n.map);return t.set(e.nodeId,e.atMs),{map:t,runId:n.runId}}return e.runId===n.runId?n:n.runId===null?{map:n.map,runId:e.runId}:{map:Ya,runId:e.runId}},fy=n=>{let e=n.now??(()=>Date.now()),t=ee(n.runnerStarted$,n.runnerStartNodeStarted$).pipe(I(r=>({type:"reset",runId:r}))),o=n.executionFeedSnapshot$.pipe(I(r=>({type:"snapshot",snap:r,atMs:e()}))),i=n.outputEmitted$.pipe(se(r=>typeof r[2]=="string"),I(r=>({type:"output",nodeId:String(r[1]),atMs:e()})));return ee(t,o,i).pipe(ve(JI,hy),I(r=>r.map),de(Ya),te(1))};var gy=n=>{let e=new Map,t=r=>{let s=e.get(r);if(s===void 0)return e.set(r,r),r;if(s===r)return r;let a=t(s);return e.set(r,a),a},o=(r,s)=>{let a=t(r),d=t(s);a!==d&&e.set(a,d)};for(let r of n.nodes)t(r.id);for(let r of n.edges)o(r.fromNodeId,r.toNodeId);let i=new Map;for(let r of n.nodes){let s=t(r.id),a=i.get(s);a===void 0?i.set(s,[r.id]):a.push(r.id)}return[...i.values()]},Za=(n,e)=>n.nodes.filter(t=>e.get(t.type)?.chatEntry===!0).map(t=>t.id),my=(n,e)=>{let t=new Set(Za(n,e));return t.size===0?n.nodes.length>0:gy(n).some(o=>o.every(i=>!t.has(i)))},yy=(n,e,t)=>{let o=new Set(Za(n,e));if(o.size===0)return!1;let i=gy(n).find(r=>r.includes(t));return i===void 0?!1:i.some(r=>o.has(r))};var ek=(n,e,t)=>{if(e.type==="snapshot")return{map:t.replay(e.snap),runId:e.snap?.runId??null};if(e.type==="output"){let o=e.event,[,,i,r]=o;if(typeof i=="symbol")return n;let s=t.keysFromOutput(o),a=new Map(n.map);for(let d of s)a.set(d,r);return{map:a,runId:n.runId}}return e.type==="reset"?e.runId===n.runId?n:n.runId===null?{map:n.map,runId:e.runId}:{map:new Map,runId:e.runId}:n},tk=n=>{let e=new Map;if(n===null)return e;for(let t of n.events){if(!Fe(t)||t[0]!=="out")continue;let[,,o,i,,r]=t;if(typeof o=="string")for(let s of r)e.set(s,i)}return e},nk={replay:tk,keysFromOutput:n=>n[5]},ok=(n,e)=>{let t=n.executionFeedSnapshot$.pipe(I(r=>({type:"snapshot",snap:r}))),o=n.outputEmitted$.pipe(I(r=>({type:"output",event:r}))),i=ee(n.runnerStarted$,n.runnerStartNodeStarted$).pipe(I(r=>({type:"reset",runId:r})));return ee(t,o,i).pipe(ve((r,s)=>ek(r,s,e),{map:new Map,runId:null}),I(r=>r.map),de(new Map),te(1))},vy=n=>ok(n,nk);var ik=(n,e)=>{let t=new Map(e.map(r=>[r.id,r])),o=new Set,i=n.map(r=>{let s=t.get(r.id);return s===void 0?r:(o.add(r.id),s)});for(let r of e)o.has(r.id)||i.push(r);return i},rk=(n,e)=>{if(e.type==="snapshot")return e.graph;if(n===null)return n;if(e.type==="upsertNodes")return e.nodes.length===0?n:C(p({},n),{nodes:ik(n.nodes,e.nodes)});if(e.type==="deleteNodes"){if(e.nodeIds.length===0)return n;let o=new Set(e.nodeIds);return C(p({},n),{nodes:n.nodes.filter(i=>!o.has(i.id))})}if(e.type==="addEdges"){if(e.edges.length===0)return n;let o=new Set(n.edges.map(r=>r.edgeId)),i=e.edges.filter(r=>!o.has(r.edgeId));return i.length===0?n:C(p({},n),{edges:[...n.edges,...i]})}if(e.edgeIds.length===0)return n;let t=new Set(e.edgeIds);return C(p({},n),{edges:n.edges.filter(o=>!t.has(o.edgeId))})},wy=n=>{let e=n.workflowSnapshot$.pipe(I(s=>({type:"snapshot",graph:s.activeWorkflow?.graph??null}))),t=ee(n.addNodes$,n.updateNodes$).pipe(se(s=>s.length>0),I(s=>({type:"upsertNodes",nodes:s}))),o=n.deleteNodes$.pipe(se(s=>s.length>0),I(s=>({type:"deleteNodes",nodeIds:s.map(a=>a.id)}))),i=n.addEdges$.pipe(se(s=>s.length>0),I(s=>({type:"addEdges",edges:s}))),r=n.deleteEdges$.pipe(se(s=>s.length>0),I(s=>({type:"deleteEdges",edgeIds:s.map(a=>a.edgeId)})));return ee(e,t,o,i,r).pipe(ve(rk,null),de(null),te({bufferSize:1,refCount:!1}))};var sk=(n,e)=>{if(e.type==="snapshot"){let s=new Map;for(let a of e.events)Yt(a)&&a[0]==="out"&&typeof a[2]=="string"&&s.set(`${a[1]}:${a[2]}`,a[3].value);return s}let[,t,o,i]=e.event;if(typeof o!="string"||!("value"in i))return n;let r=new Map(n);return r.set(`${t}:${o}`,i.value),r},by=n=>ee(n.executionFeedSnapshot$.pipe(I(e=>({type:"snapshot",events:e?.events??[]}))),n.outputEmitted$.pipe(I(e=>({type:"event",event:e})))).pipe(ve(sk,new Map),de(new Map),te(1));var ak=(n,e)=>e.type==="snapshot"?{running:e.running,currentRunId:e.runId}:e.type==="start"?e.runId===n.currentRunId?n.running?n:{running:!0,currentRunId:e.runId}:{running:!0,currentRunId:e.runId}:{running:!1,currentRunId:null},Cy=n=>{let e=n.executionFeedSnapshot$.pipe(I(i=>({type:"snapshot",running:i!==null&&i.status==="running",runId:i!==null&&i.status==="running"?i.runId:null}))),t=ee(n.runnerStarted$,n.runnerStartNodeStarted$).pipe(I(i=>({type:"start",runId:i}))),o=ee(n.runnerDone$,n.runnerInterrupted$).pipe(I(()=>({type:"stop"})));return ee(e,t,o).pipe(ve(ak,{running:!1,currentRunId:null}),I(i=>i.running),$n(),de(!1),te(1))};var we=class n{constructor(){this.bridge=f(ie);this.paletteSnapshot$=aa(this.bridge.cached["palette.snapshot"],this.bridge.cached["customPalette.snapshot"]).pipe(te(1));this.workflowSnapshot$=this.bridge.cached["workflow.current.snapshot"];this.executionFeedSnapshot$=this.bridge.cached["executionFeed.snapshot"];this.runnerPort$=this.bridge.raw["runner.port"].pipe(se(e=>Fe(e)));this.outputEmitted$=this.runnerPort$.pipe(se(e=>e[0]==="out"));this.runnerStarted$=this.bridge.raw["runner.started"].pipe(se(e=>typeof e=="string"));this.runnerStartNodeStarted$=this.bridge.raw["runner.startNode.started"].pipe(se(e=>typeof e=="string"));this.runnerDone$=this.bridge.raw["runner.done"];this.runnerInterrupted$=this.bridge.raw["runner.interrupted"];this.paletteByType$=this.paletteSnapshot$.pipe(I(e=>Dt(e.nodes)),te(1));this.activeGraph$=wy({workflowSnapshot$:this.workflowSnapshot$,addNodes$:this.bridge.raw["editor.addNodes"]??Ne,updateNodes$:this.bridge.raw["editor.updateNodes"]??Ne,deleteNodes$:this.bridge.raw["editor.deleteNodes"]??Ne,addEdges$:this.bridge.raw["editor.addEdges"]??Ne,deleteEdges$:this.bridge.raw["editor.deleteEdges"]??Ne});this.nodeLabels$=ee(pe(new Map),Te([this.workflowSnapshot$,this.paletteSnapshot$]).pipe(I(([e,t])=>Lc(e,Dt(t.nodes))))).pipe(te(1));this.paletteByType=oe(this.paletteByType$,{initialValue:new Map});this.nodeLabels=oe(this.nodeLabels$,{initialValue:new Map});this.activeGraph=oe(this.activeGraph$,{initialValue:null});this.hasRunnableGraph=b(()=>(this.activeGraph()?.nodes.length??0)>0);this.hasPaletteCatalog=b(()=>this.paletteByType().size>0);this.hasPlainStartTargets=b(()=>{let e=this.activeGraph(),t=this.paletteByType();return e===null||t.size===0?!1:my(e,t)});this.latestOutputValues=oe(by({executionFeedSnapshot$:this.executionFeedSnapshot$,outputEmitted$:this.outputEmitted$}),{initialValue:new Map});this.lastActivityByNode$=fy({outputEmitted$:this.outputEmitted$,runnerStarted$:this.runnerStarted$,runnerStartNodeStarted$:this.runnerStartNodeStarted$,executionFeedSnapshot$:this.executionFeedSnapshot$});this.lastActivityByNode=oe(this.lastActivityByNode$,{initialValue:new Map});this.livenessNowMs=oe(og(1e3).pipe(I(()=>Date.now())),{initialValue:Date.now()});this.isRunning$=Cy({executionFeedSnapshot$:this.executionFeedSnapshot$,runnerStarted$:this.runnerStarted$,runnerStartNodeStarted$:this.runnerStartNodeStarted$,runnerDone$:this.runnerDone$,runnerInterrupted$:this.runnerInterrupted$});this.isRunning=oe(this.isRunning$,{initialValue:!1});this.edgeStates$=vy({executionFeedSnapshot$:this.executionFeedSnapshot$,outputEmitted$:this.outputEmitted$,runnerStarted$:this.runnerStarted$,runnerStartNodeStarted$:this.runnerStartNodeStarted$});this.edgeStates=oe(this.edgeStates$,{initialValue:new Map})}latestOutputValue(e,t){return this.latestOutputValues().get(`${e}:${t}`)}nodeClusterRequiresChatEntry(e){let t=this.activeGraph(),o=this.paletteByType();return t===null||o.size===0?!1:yy(t,o,e)}nodeLabel(e){return this.nodeLabels().get(e)??e}lastActivityMs(e){return this.lastActivityByNode().get(e)}wireStatus(e){return this.edgeStates().get(e)??{inactive:!0}}getEventsForEdge(e){return this.outputEmitted$.pipe(se(t=>t[5].some(o=>o===e)))}getEventsForPort(e,t){return this.runnerPort$.pipe(se(o=>o[0]==="out"&&o[1]===e&&o[2]===t))}getInputEventsForPort(e,t){return this.runnerPort$.pipe(se(o=>o[0]==="in"&&o[1]===e&&o[2]===t))}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275prov=j({token:n,factory:n.\u0275fac,providedIn:"root"})}};var Or="application/x-langflower-node-type";var dk={width:160,height:72},vi=class n{constructor(){this.byId=new Map}set(e,t){this.byId.set(e,t)}clear(e){this.byId.delete(e)}minFor(e){return this.byId.get(e)??dk}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275prov=j({token:n,factory:n.\u0275fac,providedIn:"root"})}};var _y=(n,e,t,o,i=24,r=24)=>{let s=t.top+t.height,a=o.top+o.height,d=Math.max(s,a)+r,l=n.x+i,h=e.x-i;return[{x:n.x,y:n.y},{x:l,y:n.y},{x:l,y:d},{x:h,y:d},{x:h,y:e.y},{x:e.x,y:e.y}]},wi=n=>{if(n===null)return null;let e=n.size;if(e!==void 0&&Number.isFinite(e.width)&&Number.isFinite(e.height)&&e.width>0&&e.height>0)return{left:n.position.x,top:n.position.y,width:e.width,height:e.height};let t=n.measuredBounds;return t!==void 0&&Number.isFinite(t.width)&&Number.isFinite(t.height)&&t.width>0&&t.height>0?{left:t.x,top:t.y,width:t.width,height:t.height}:null};var Xa=n=>n.left+n.width/2,xy=n=>n.top+n.height/2,Sy=(n,e,t)=>n.some(o=>o.source===t&&o.target===e),Ar=n=>{if(!n.hasReverseEdge)return!1;let{sourceBounds:e,targetBounds:t,sourcePort:o,targetPort:i}=n;if(e!=null&&t!=null){let d=xy(e),l=xy(t),h=d>l,g=l>d;if(!h&&!g)return Xa(t)<Xa(e);let _=h?e:t;return Xa(h?t:e)>Xa(_)+40?g:h}if(o===void 0||i===void 0)return!1;let r=o.y>i.y,s=i.y>o.y;return!r&&!s?i.x<o.x:(s?o.x>i.x+40:i.x>o.x+40)?s&&i.x<o.x:r};var Py=(n,e,t,o={hasReverseEdge:!1})=>{let{sourcePoint:i,targetPoint:r,sourceNode:s,targetNode:a}=n,d=wi(s??null),l=wi(a??null);return!Ar({sourceBounds:d,targetBounds:l,sourcePort:i,targetPort:r,hasReverseEdge:o.hasReverseEdge})||d===null||l===null?e(n,t):[..._y(i,r,d,l)]};var Ey=(n,e)=>({name:"orthogonal",computePoints(t,o){let i=t.sourceNode?.id??t.edge.source,r=t.targetNode?.id??t.edge.target;return Py(t,(s,a)=>n.computePoints(s,a),o,{hasReverseEdge:e(i,r)})},computeSvgPath(t,o){return n.computeSvgPath(t,o)},computePointOnPath(t,o){return n.computePointOnPath?.(t,o)??t[0]??{x:0,y:0}},computePointAtDistance(t,o){return n.computePointAtDistance?.(t,o)??t[0]??{x:0,y:0}}});var Iy=n=>{let e=n.flowCore.edgeRoutingManager.getRouting("orthogonal");if(e===void 0)throw new Error("ng-diagram orthogonal routing is not registered");return e};var Dy=300,ky=n=>n!==null&&typeof n=="object"&&"value"in n,lk=n=>{if(Array.isArray(n))return ky(n[3]);if(typeof n!="object"||n===null)return!1;if("state"in n){let e=n.state;return e==="value"||ky(e)}return"value"in n},ck=(n,e=Dy)=>n.pipe(se(t=>lk(t)),Me(()=>ps(pe("pulseOn"),ng(e).pipe(I(()=>"pulseOff"))))),bn=(n,e=Dy)=>ck(n,e).pipe(I(t=>t==="pulseOn"),de(!1));var uk="6 4",Qa=class n{constructor(){this.edge=T.required();this.execution=f(we);this.diagramModel=f(ln);this.status=b(()=>this.execution.wireStatus(this.edge().id));this.selected=b(()=>this.edge().selected===!0);this.backEdgeInput=b(()=>{let e=this.edge(),t=this.diagramModel.nodes(),o=t.find(r=>r.id===e.source)??null,i=t.find(r=>r.id===e.target)??null;return{sourceBounds:wi(o),targetBounds:wi(i),sourcePort:e.sourcePosition,targetPort:e.targetPosition,hasReverseEdge:Sy(this.diagramModel.edges(),e.source,e.target)}});this.isBack=b(()=>Ar(this.backEdgeInput()));this.dash=b(()=>{let e=this.backEdgeInput();if(Ar(e)&&!(e.sourceBounds!==null&&e.targetBounds!==null))return uk});this.pulse=oe(et(this.edge).pipe(I(e=>e.id),Me(e=>bn(this.execution.getEventsForEdge(e)))),{initialValue:!1})}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-edge"]],hostVars:14,hostBindings:function(t,o){t&2&&G("lf-edge--inactive","inactive"in o.status())("lf-edge--pending","pending"in o.status())("lf-edge--value","value"in o.status())("lf-edge--error","error"in o.status())("lf-edge--pulse",o.pulse())("lf-edge--selected",o.selected())("lf-edge--back",o.isBack())},inputs:{edge:[1,"edge"]},decls:1,vars:2,consts:[[3,"edge","strokeDasharray"]],template:function(t,o){t&1&&F(0,"ng-diagram-base-edge",0),t&2&&M("edge",o.edge())("strokeDasharray",o.dash())},dependencies:[vo],styles:['[_nghost-%COMP%]{pointer-events:all;--edge-stroke-transition: stroke .1s ease-in-out}[_nghost-%COMP%]:hover:not(.lf-edge--selected){--edge-stroke: rgb(74 108 182)}[data-theme="dark"][_nghost-%COMP%]:hover:not(.lf-edge--selected){--edge-stroke: rgb(120 160 220)}.lf-edge--pending[_nghost-%COMP%]{--ngd-default-edge-stroke: rgb(202 138 4);--edge-stroke: rgb(202 138 4);--ngd-default-edge-width: 3px}[data-theme="dark"].lf-edge--pending[_nghost-%COMP%]{--ngd-default-edge-stroke: rgb(250 204 21);--edge-stroke: rgb(250 204 21)}.lf-edge--value[_nghost-%COMP%]{--ngd-default-edge-stroke: rgb(16 185 129);--edge-stroke: rgb(16 185 129);--ngd-default-edge-width: 3px}[data-theme="dark"].lf-edge--value[_nghost-%COMP%]{--ngd-default-edge-stroke: rgb(52 211 153);--edge-stroke: rgb(52 211 153)}.lf-edge--error[_nghost-%COMP%]{--ngd-default-edge-stroke: rgb(244 63 94);--edge-stroke: rgb(244 63 94);--ngd-default-edge-width: 3px}[data-theme="dark"].lf-edge--error[_nghost-%COMP%]{--ngd-default-edge-stroke: rgb(251 113 133);--edge-stroke: rgb(251 113 133)}.lf-edge--selected[_nghost-%COMP%]{--ngd-default-edge-stroke: rgb(37 99 235);--ngd-default-edge-stroke-selected: rgb(37 99 235);--edge-stroke: rgb(37 99 235);--ngd-default-edge-width: 2.5px}[data-theme="dark"].lf-edge--selected[_nghost-%COMP%]{--ngd-default-edge-stroke: rgb(96 165 250);--ngd-default-edge-stroke-selected: rgb(96 165 250);--edge-stroke: rgb(96 165 250)}']})}};var vh=n=>n?.hidden===!0,wh=n=>{if(n==null)return!1;if(typeof n=="string")return!n.startsWith("preview");if(typeof n!="object"||!("type"in n))return!0;let e=n.type;return typeof e=="string"&&!e.startsWith("preview")};function pk(n){return typeof n.portId!="symbol"&&!vh(n)}function hk(n){return typeof n.portId=="symbol"?!1:vh(n)?wh(n.inline):!0}function fk(n){return n.dynamic===!0?"dynamic":String(n.wireType??"any")}function gk(n,e,t){let o=-1;for(let i of n){if(i.target!==e||i.targetPort===void 0)continue;let{basePortId:r,slotIndex:s}=Qn(mi(i.targetPort));r===t&&s>o&&(o=s)}return o}function Ty(n,e,t){let o=xo(t);return n.some(i=>i.target===e&&i.targetPort===o)}function mk(n,e,t,o){if(n===void 0)return[];let i=[];for(let r of n.inputsConfigs){if(!hk(r))continue;let s=String(r.portId??r.name??"unknown"),a=r.name??s,d=fk(r),l=vh(r),h=o[s]!==void 0?o[s]:r.defaultValue;if(r.multi!==void 0){let g=gk(t,e,s);for(let _=0;_<=g+1;_++){let D=yi(s,_);i.push({handle:D,portId:xo(D),label:a,wireType:d,basePortId:s,slotIndex:_,inline:_===0?r.inline??null:null,value:_===0?h:void 0,connected:Ty(t,e,D),hidden:l})}continue}i.push({handle:s,portId:xo(s),label:a,wireType:d,basePortId:s,slotIndex:0,inline:r.inline??null,value:h,connected:Ty(t,e,s),hidden:l})}return i}function yk(n){if(n===void 0)return[];let e=[];for(let t of n.outputsConfigs){if(t===void 0||!pk(t))continue;let o=String(t.portId??"unknown"),i=t.name,r;t.fromInput!==void 0?r=`from(${t.fromInput})`:r=String(t.wireType),e.push({portId:Nr(o),label:i??o,wireType:r})}return e}function vk(n,e,t){if(n===void 0)return[];let o=[];for(let[i,r]of Object.entries(n.bypassPorts)){let s=String(r),a=My(t,e,i,"target"),d=My(t,e,i,"source"),l=Math.max(a,d);for(let h=0;h<=l+1;h++){let g=yi(i,h);o.push({handle:g,inputPortId:xo(g),outputPortId:Nr(g),label:g,wireType:s})}}return o}function My(n,e,t,o){let i=-1;for(let r of n){let s=o==="source"?r.source:r.target,a=o==="source"?r.sourcePort:r.targetPort;if(s!==e||a===void 0)continue;let{basePortId:d,slotIndex:l}=Qn(o==="source"?So(a):mi(a));d===t&&l>i&&(i=l)}return i}function bi(n,e,t=[],o={}){let i=vk(n,e,t);return{inputPorts:mk(n,e,t,o),outputPorts:yk(n),bypassPorts:i}}var Cn=class n{constructor(){this.hovered=U(null);this.hoveredNodeId=this.hovered.asReadonly()}set(e){this.hovered.set(e)}clear(){this.hovered.set(null)}isHovered(e){return this.hovered()===e}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275prov=j({token:n,factory:n.\u0275fac,providedIn:"root"})}};var Ja=n=>Te([n.workflowSnapshot$,Te([n.paletteSnapshot$,n.customPaletteSnapshot$]).pipe(I(([e,t])=>go(e,t)))]).pipe(I(([e,t])=>da(e,t)),te({bufferSize:1,refCount:!0}));var Po=()=>({seen:!1,hasError:!1,hasNonStreamingValue:!1,runId:null}),Ry=n=>n.seen?n.hasError?"error":n.hasNonStreamingValue?"value":"pending":"inactive",wk=(n,e)=>{if(!Fe(n))return!1;let[,t,o,,,,i]=n;if(i?.streaming===!0)return!0;if(e===null||typeof o!="string")return!1;let r=dn(e.paletteByType,e.nodeTypeById,t);return(n[0]==="out"?r?.outputsConfigs:r?.inputsConfigs)?.find(d=>d.portId===o)?.feed?.streaming===!0},ed=(n,e,t,o)=>{if(!Fe(e))return n;let[i,,r,s]=e;return typeof r=="symbol"||!("value"in s)&&!("pending"in s)&&!("error"in s)?n:"error"in s&&i==="out"?{seen:!0,hasError:!0,hasNonStreamingValue:n.hasNonStreamingValue,runId:o??n.runId}:i==="out"&&"pending"in s?{seen:!0,hasError:n.hasError,hasNonStreamingValue:!1,runId:o??n.runId}:i==="out"&&"value"in s&&!wk(e,t)?{seen:!0,hasError:n.hasError,hasNonStreamingValue:!0,runId:o??n.runId}:i==="in"?{seen:!0,hasError:n.hasError,hasNonStreamingValue:!1,runId:o??n.runId}:{seen:!0,hasError:n.hasError,hasNonStreamingValue:n.hasNonStreamingValue,runId:o??n.runId}},Eo=(n,e)=>n.filter(t=>Fe(t)&&t[1]===e),Ny=(n,e,t)=>{if(n===null)return Po();let o=C(p({},Po()),{runId:n.runId});for(let i of Eo(n.events,e))o=ed(o,i,t,n.runId);return o},Oy=(n,e)=>n===e.runId?e:e.runId===null?C(p({},e),{runId:n}):C(p({},Po()),{runId:n}),Ay=(n,e,t)=>{let o=C(p({},Po()),{runId:e});for(let i of n)o=ed(o,i,t,e);return o};var bk=new Set(["none","reasoning","progress","draft","tool","shell","result","recovery"]),Io=n=>{let e=n[6]?.role;return typeof e=="string"&&bk.has(e)?e:void 0},bh=n=>n[6]?.streaming===!0,Ly=n=>n[6]?.closesPreviousVisit===!0;var Ch=(n,e)=>e.inputsConfigs.filter(t=>typeof t.portId=="string"&&t.hitl!==void 0).map(t=>({nodeId:n,portId:t.portId,config:t.hitl})),Ck=(n,e)=>Ch(n,e).filter(t=>t.portId!==dt),Lr=(n,e,t)=>{let o=n.inputsConfigs.find(i=>i.portId===t);return o===void 0||o.hitl!==void 0?!1:Ck(e,n).length>0},ko=(n,e)=>{let t=n.inputsConfigs.find(o=>o.portId===e);return t!==void 0&&t.hitl!==void 0},Fr=(n,e)=>n!==dt?"ignore":xr(e)?"open":Sr(e)?"close":"ignore";var zr=()=>({awaiting:!1,runId:null}),_k=(n,e)=>e==="open",td=(n,e,t,o,i)=>{if(t===null||!Fe(e))return n;let[r,,s,a]=e,d=i??n.runId,l=dn(t.paletteByType,t.nodeTypeById,o);if(l===void 0)return n;if(r==="out"&&typeof s=="string"&&"value"in a)return(Io(e)==="recovery"||s===fo)&&ai(a.value)?{awaiting:!0,runId:d}:n;if(r!=="in"||typeof s!="string"||!("value"in a))return n;let h=Fr(s,a.value);return h==="open"||h==="close"?{awaiting:_k(n.awaiting,h),runId:d}:s===dt?n:ko(l,s)?{awaiting:!1,runId:d}:Lr(l,o,s)?{awaiting:!0,runId:d}:n},Fy=(n,e,t)=>{if(n===null||t===null)return zr();let o=zr();for(let i of Eo(n.events,e))o=td(o,i,t,e,n.runId);return C(p({},o),{runId:n.runId})},zy=(n,e)=>n===e.runId?e:e.runId===null?C(p({},e),{runId:n}):{awaiting:!1,runId:n},$y=(n,e,t,o)=>{let i={awaiting:!1,runId:e};for(let r of n)i=td(i,r,t,o,e);return i};var By=()=>({events:[],catalog:null,state:zr(),runId:null}),xk=(n,e,t)=>{if(t.type==="catalog"){let i=e.events.length===0?e.state:$y(e.events,e.runId,t.catalog,n);return C(p({},e),{catalog:t.catalog,state:i})}if(t.type==="snapshot")return t.snap===null?{events:[],catalog:e.catalog,state:zr(),runId:null}:{events:Eo(t.snap.events,n),catalog:e.catalog,runId:t.snap.runId,state:Fy(t.snap,n,e.catalog)};if(t.type==="reset"){if(t.runId===e.runId)return e;let i=zy(t.runId,e.state);return e.runId===null?C(p({},e),{state:i,runId:t.runId}):{events:[],catalog:e.catalog,state:i,runId:t.runId}}return{events:[...e.events,t.event],catalog:e.catalog,runId:e.runId,state:td(e.state,t.event,e.catalog,n,e.runId)}},Hy=(n,e)=>{let t=Ja(e),o=i=>i[1]===n;return ee(e.executionFeedSnapshot$.pipe(I(i=>({type:"snapshot",snap:i}))),e.runnerPort$.pipe(se(o),I(i=>({type:"port",event:i}))),ee(e.runnerStarted$,e.runnerStartNodeStarted$).pipe(I(i=>({type:"reset",runId:i}))),t.pipe(I(i=>({type:"catalog",catalog:i})))).pipe(ve((i,r)=>xk(n,i,r),By()),de(By()),I(i=>i.state.awaiting),te({bufferSize:1,refCount:!0}))};var Uy=()=>({events:[],catalog:null,state:Po(),runId:null}),Sk=(n,e,t)=>{if(t.type==="catalog"){let i=e.events.length===0?e.state:Ay(e.events,e.runId,t.catalog);return C(p({},e),{catalog:t.catalog,state:i})}if(t.type==="snapshot")return t.snap===null?{events:[],catalog:e.catalog,state:Po(),runId:null}:{events:Eo(t.snap.events,n),catalog:e.catalog,runId:t.snap.runId,state:Ny(t.snap,n,e.catalog)};if(t.type==="reset"){if(t.runId===e.runId)return e;let i=Oy(t.runId,e.state);return e.runId===null?C(p({},e),{state:i,runId:t.runId}):{events:[],catalog:e.catalog,state:i,runId:t.runId}}return{events:[...e.events,t.event],catalog:e.catalog,runId:e.runId,state:ed(e.state,t.event,e.catalog,e.runId)}},Vy=(n,e)=>{let t=Ja(e),o=i=>i[1]===n;return ee(e.executionFeedSnapshot$.pipe(I(i=>({type:"snapshot",snap:i}))),e.runnerPort$.pipe(se(o),I(i=>({type:"port",event:i}))),ee(e.runnerStarted$,e.runnerStartNodeStarted$).pipe(I(i=>({type:"reset",runId:i}))),t.pipe(I(i=>({type:"catalog",catalog:i})))).pipe(ve((i,r)=>Sk(n,i,r),Uy()),de(Uy()),I(i=>Ry(i.state)),te({bufferSize:1,refCount:!0}))};var nd=class n{constructor(){this.bridge=f(ie);this.runnerPort$=this.bridge.raw["runner.port"].pipe(se(e=>Fe(e)));this.sources={executionFeedSnapshot$:this.bridge.cached["executionFeed.snapshot"],runnerPort$:this.runnerPort$,runnerStarted$:this.bridge.raw["runner.started"].pipe(se(e=>typeof e=="string")),runnerStartNodeStarted$:this.bridge.raw["runner.startNode.started"].pipe(se(e=>typeof e=="string")),workflowSnapshot$:this.bridge.cached["workflow.current.snapshot"],paletteSnapshot$:this.bridge.cached["palette.snapshot"],customPaletteSnapshot$:this.bridge.cached["customPalette.snapshot"],runnerDone$:this.bridge.raw["runner.done"],runnerInterrupted$:this.bridge.raw["runner.interrupted"]};this.cache=new Map}getNodeStatusEvents(e){let t=this.cache.get(e);if(t!==void 0)return t;let o=Vy(e,this.sources),i=Hy(e,this.sources),r=Te([o,i]).pipe(I(([d,l])=>l?"hitl":d),te({bufferSize:1,refCount:!1})),s=bn(this.runnerPort$.pipe(se(d=>d[1]===e&&d[0]==="out"&&Yt(d)))).pipe(te({bufferSize:1,refCount:!1})),a={status$:r,pulse$:s};return this.cache.set(e,a),a}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275prov=j({token:n,factory:n.\u0275fac,providedIn:"root"})}};var _h={map:new Map,runId:null},od=class n{constructor(){this.bridge=f(ie);this.values=oe(ee(this.bridge.cached["executionFeed.snapshot"].pipe(I(e=>({type:"snapshot",snap:e}))),this.bridge.raw["runner.port"].pipe(se(e=>Yt(e)&&e[0]==="in"&&typeof e[2]=="string"),I(e=>({type:"input",nodeId:String(e[1]),portId:e[2],value:e[3].value}))),ee(this.bridge.raw["runner.started"],this.bridge.raw["runner.startNode.started"]).pipe(se(e=>typeof e=="string"),I(e=>({type:"reset",runId:e}))),this.bridge.cached["workflow.current.snapshot"].pipe(I(e=>e.activeWorkflow?.workflowId??null),$n(),Vi(1),I(()=>({type:"clear"})))).pipe(ve((e,t)=>{if(t.type==="snapshot")return{map:Ek(t.snap),runId:t.snap?.runId??null};if(t.type==="clear")return _h;if(t.type==="reset")return Pk(t.runId,e);let o=new Map(e.map);return o.set(xh(t.nodeId,t.portId),t.value),{map:o,runId:e.runId}},_h),I(e=>e.map)),{initialValue:_h.map})}valueFor(e,t){return this.values().get(xh(e,t))}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275prov=j({token:n,factory:n.\u0275fac,providedIn:"root"})}},xh=(n,e)=>`${n}:${e}`,Pk=(n,e)=>n===e.runId?e:e.runId===null?C(p({},e),{runId:n}):{map:new Map,runId:n},Ek=n=>{let e=new Map;if(n===null)return e;for(let t of n.events)!Yt(t)||t[0]!=="in"||typeof t[2]=="symbol"||e.set(xh(String(t[1]),t[2]),t[3].value);return e};var Ik="lf-port-row-host--grow",kk="lf-node-title",Dk=20,jy=(n,e,t)=>{let i=Array.from(n.children).reduce((r,s)=>{if(s.classList.contains(kk))return r+Math.max(s.offsetHeight,Dk);if(!s.classList.contains(Ik))return r+s.offsetHeight;let a=s.querySelector(".lf-port-row"),d=a instanceof HTMLElement?a.offsetHeight:0,l=s.querySelector(".lf-port-row__inline"),h=l instanceof HTMLElement&&Number.parseFloat(getComputedStyle(l).paddingBottom)||0,g=getComputedStyle(s).getPropertyValue("--lf-multiline-min").trim(),_=Number.parseFloat(g)||br;return r+d+_+h},0);return Math.max(t,Math.ceil(i)+e)};var Sh=(n,e,t,o)=>({width:Math.max(o.width,n.width+(t.x-e.x)),height:Math.max(o.height,n.height+(t.y-e.y))});var id=class n{constructor(){this.execution=f(we);this.nodeId=T.required();this.runtimePortId=T.required();this.inputPortId=T.required();this.outputPortId=T.required();this.label=T.required();this.wireType=T.required();this.nodeSelected=T(!1);this.inputEndpointHighlighted=T(!1);this.outputEndpointHighlighted=T(!1);this.inputPulse=oe(Te([et(this.nodeId),et(this.runtimePortId)]).pipe(Me(([e,t])=>bn(this.execution.getInputEventsForPort(e,t)))),{initialValue:!1});this.outputPulse=oe(Te([et(this.nodeId),et(this.runtimePortId)]).pipe(Me(([e,t])=>bn(this.execution.getEventsForPort(e,t)))),{initialValue:!1})}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-node-bypass-port-row"]],hostAttrs:[1,"lf-port-row-host"],inputs:{nodeId:[1,"nodeId"],runtimePortId:[1,"runtimePortId"],inputPortId:[1,"inputPortId"],outputPortId:[1,"outputPortId"],label:[1,"label"],wireType:[1,"wireType"],nodeSelected:[1,"nodeSelected"],inputEndpointHighlighted:[1,"inputEndpointHighlighted"],outputEndpointHighlighted:[1,"outputEndpointHighlighted"]},decls:10,vars:18,consts:[[1,"lf-port-row","lf-port-row--bypass"],[1,"lf-port-anchor","lf-port-anchor--in"],["type","target","side","left","originPoint","centerLeft",3,"id"],[1,"lf-port-row__content"],[1,"text-zinc-400","dark:text-zinc-500"],[1,"lf-port-anchor","lf-port-anchor--out"],["type","source","side","right",3,"id"]],template:function(t,o){t&1&&(y(0,"div",0)(1,"div",1),F(2,"ng-diagram-port",2),m(),y(3,"div",3)(4,"span"),w(5),m(),y(6,"span",4),w(7),m()(),y(8,"div",5),F(9,"ng-diagram-port",6),m()()),t&2&&(G("lf-port-row--node-selected",o.nodeSelected()),u(),G("lf-port-anchor--endpoint",o.inputEndpointHighlighted())("lf-port-anchor--node-selected",o.nodeSelected())("lf-port-anchor--pulse",o.inputPulse()),u(),M("id",o.inputPortId()),u(3),ue(o.label()),u(2),H(" \xB7 ",o.wireType()," "),u(),G("lf-port-anchor--endpoint",o.outputEndpointHighlighted())("lf-port-anchor--node-selected",o.nodeSelected())("lf-port-anchor--pulse",o.outputPulse()),u(),M("id",o.outputPortId()))},dependencies:[wo],styles:['[_nghost-%COMP%]{display:block;box-sizing:border-box;width:100%}.lf-diagram-node[_nghost-%COMP%]{height:100%}.lf-diagram-node[_nghost-%COMP%] ng-diagram-node-resize-adornment{display:block;box-sizing:border-box;width:100%;height:100%}.lf-node-chrome[_ngcontent-%COMP%]{--lf-node-chrome-padding-x: 20px;position:relative;box-sizing:border-box;display:flex;width:100%;height:100%;min-width:0;min-height:0;flex-direction:column;padding-left:var(--lf-node-chrome-padding-x);padding-right:var(--lf-node-chrome-padding-x);border-color:#d4d4d8}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome[_ngcontent-%COMP%]{border-color:#3f3f46}.lf-node-content[_ngcontent-%COMP%]{display:flex;width:100%;min-width:0;min-height:0;flex:1 1 auto;flex-direction:column}.lf-node-title[_ngcontent-%COMP%]{flex:0 0 auto;min-height:1.25rem;line-height:1.25rem}.lf-port-row-host[_nghost-%COMP%]{display:flex;flex:0 0 auto;flex-direction:column}.lf-port-row-host--grow[_nghost-%COMP%]{flex:var(--lf-inline-flex, 1) 1 0;min-height:min-content;overflow:visible}.lf-port-row-host--grow[_nghost-%COMP%] .lf-port-row-wrapper[_ngcontent-%COMP%]{display:flex;flex:1 1 auto;flex-direction:column;min-height:min-content;overflow:visible}.lf-port-row-host--grow[_nghost-%COMP%] .lf-port-row__inline[_ngcontent-%COMP%]{display:flex;flex:1 1 0;flex-direction:column;min-height:min-content;overflow:hidden}.lf-port-row-host--grow[_nghost-%COMP%] .lf-port-row__inline[_ngcontent-%COMP%] lf-inline-field[_ngcontent-%COMP%]{flex:1 1 0;min-height:min-content;overflow:hidden}.lf-port-row-host--grow.lf-port-row-host--preview[_nghost-%COMP%], .lf-port-row-host--grow.lf-port-row-host--preview[_nghost-%COMP%] .lf-port-row-wrapper[_ngcontent-%COMP%], .lf-port-row-host--grow.lf-port-row-host--preview[_nghost-%COMP%] .lf-port-row__inline[_ngcontent-%COMP%], .lf-port-row-host--grow.lf-port-row-host--preview[_nghost-%COMP%] .lf-port-row__inline[_ngcontent-%COMP%] lf-inline-field[_ngcontent-%COMP%]{min-height:0}.lf-node-chrome--pending[_ngcontent-%COMP%]{border-color:#d97706}.lf-node-chrome--value[_ngcontent-%COMP%]{border-color:#10b981}.lf-node-chrome--error[_ngcontent-%COMP%]{border-color:#f43f5e;box-shadow:0 0 0 2px rgba(244 63 94,.25)}.lf-node-chrome--hitl[_ngcontent-%COMP%]{border-color:#0ea5e9;box-shadow:0 0 0 2px rgba(14 165 233,.4)}.lf-node-chrome--pulse[_ngcontent-%COMP%]{box-shadow:0 0 0 2px #10b98180;transition:box-shadow .15s ease-out}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome--pending[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome--pending[_ngcontent-%COMP%]{border-color:#ca8a04}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome--value[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome--value[_ngcontent-%COMP%]{border-color:#34d399}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome--error[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome--error[_ngcontent-%COMP%]{border-color:#fb7185;box-shadow:0 0 0 2px rgba(251 113 133,.25)}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome--hitl[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome--hitl[_ngcontent-%COMP%]{border-color:#38bdf8;box-shadow:0 0 0 2px rgba(56 189 248,.4)}.lf-node-chrome--selected[_ngcontent-%COMP%]{border-color:#3b82f6;box-shadow:0 0 0 2px #3b82f659}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome--selected[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome--selected[_ngcontent-%COMP%]{border-color:#60a5fa;box-shadow:0 0 0 2px #60a5fa59}.lf-node-chrome--hovered[_ngcontent-%COMP%]{border-color:#8b5cf6;box-shadow:0 0 0 2px #8b5cf64d}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome--hovered[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome--hovered[_ngcontent-%COMP%]{border-color:#a78bfa;box-shadow:0 0 0 2px #a78bfa4d}.lf-port-row[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center;min-height:1.5rem;padding-top:.125rem;padding-bottom:.125rem}.lf-port-row__inline[_ngcontent-%COMP%]{padding-bottom:.25rem;padding-left:.25rem}.lf-port-row__content[_ngcontent-%COMP%]{min-width:0;flex:1 1 auto;font-size:10px;line-height:1.2;color:#64748b}.lf-port-row--in[_ngcontent-%COMP%] .lf-port-row__content[_ngcontent-%COMP%]{padding-left:.25rem}.lf-port-row--out[_ngcontent-%COMP%] .lf-port-row__content[_ngcontent-%COMP%]{padding-right:.25rem;text-align:right}.lf-port-anchor[_ngcontent-%COMP%]{position:absolute;top:50%;transform:translateY(-50%)}.lf-port-anchor--in[_ngcontent-%COMP%]{left:calc(-1 * var(--lf-node-chrome-padding-x))}.lf-port-anchor--out[_ngcontent-%COMP%]{right:calc(-1 * var(--lf-node-chrome-padding-x))}[data-theme="dark"][_nghost-%COMP%] .lf-port-row__content[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-port-row__content[_ngcontent-%COMP%]{color:#94a3b8}.lf-port-dot[_ngcontent-%COMP%]{display:block;box-sizing:border-box;width:10px;height:10px;border:2px solid rgb(148 163 184);border-radius:9999px;background:#fff}[data-theme="dark"][_nghost-%COMP%] .lf-port-dot[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-port-dot[_ngcontent-%COMP%]{border-color:#64748b;background:#0f172a}.lf-node-label-input[_ngcontent-%COMP%]{width:calc(100% - .5rem);border-radius:.25rem;border:1px solid rgb(59 130 246);background:#fafafa;padding:.125rem .25rem;color:#18181b;outline:none}[data-theme="dark"][_nghost-%COMP%] .lf-node-label-input[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-label-input[_ngcontent-%COMP%]{border-color:#60a5fa;background:#09090b;color:#f4f4f5}[_nghost-%COMP%] .resize-handle, [_nghost-%COMP%] .resize-line{opacity:0;pointer-events:none}.lf-node-se-handle[_ngcontent-%COMP%]{position:absolute;right:0;bottom:0;z-index:2;box-sizing:border-box;width:1rem;height:1rem;overflow:hidden;border-bottom-right-radius:.75rem;cursor:nwse-resize;pointer-events:auto}.lf-node-se-handle__lines[_ngcontent-%COMP%]{display:block;position:absolute;right:0;bottom:0;width:.875rem;height:.875rem;background-image:repeating-linear-gradient(-45deg,transparent 0,transparent 2px,rgb(161 161 170) 2px,rgb(161 161 170) 3.25px);clip-path:polygon(100% 0,100% 100%,0 100%)}[data-theme="dark"][_nghost-%COMP%] .lf-node-se-handle__lines[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-se-handle__lines[_ngcontent-%COMP%]{background-image:repeating-linear-gradient(-45deg,transparent 0,transparent 2px,rgb(113 113 122) 2px,rgb(113 113 122) 3.25px)}.lf-port-anchor--node-selected[_ngcontent-%COMP%]{--ngd-port-border-color: rgb(147 197 253);--ngd-port-background-color: rgb(239 246 255)}.lf-port-anchor--endpoint[_ngcontent-%COMP%]{--ngd-port-border-color: rgb(37 99 235);--ngd-port-background-color: rgb(191 219 254)}[data-theme="dark"][_nghost-%COMP%] .lf-port-anchor--node-selected[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-port-anchor--node-selected[_ngcontent-%COMP%]{--ngd-port-border-color: rgb(96 165 250);--ngd-port-background-color: rgb(30 58 138)}[data-theme="dark"][_nghost-%COMP%] .lf-port-anchor--endpoint[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-port-anchor--endpoint[_ngcontent-%COMP%]{--ngd-port-border-color: rgb(147 197 253);--ngd-port-background-color: rgb(30 64 175)}']})}};function Wy(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,o=Array(e);t<e;t++)o[t]=n[t];return o}function Tk(n){if(Array.isArray(n))return n}function Mk(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var o,i,r,s,a=[],d=!0,l=!1;try{if(r=(t=t.call(n)).next,e!==0)for(;!(d=(o=r.call(t)).done)&&(a.push(o.value),a.length!==e);d=!0);}catch(h){l=!0,i=h}finally{try{if(!d&&t.return!=null&&(s=t.return(),Object(s)!==s))return}finally{if(l)throw i}}return a}}function Rk(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
240
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Nk(n,e){return Tk(n)||Mk(n,e)||Ok(n,e)||Rk()}function Ok(n,e){if(n){if(typeof n=="string")return Wy(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Wy(n,e):void 0}}var sv=Object.entries,Gy=Object.setPrototypeOf,Ak=Object.isFrozen,Lk=Object.getPrototypeOf,Fk=Object.getOwnPropertyDescriptor,gt=Object.freeze,mt=Object.seal,xi=Object.create,av=typeof Reflect<"u"&&Reflect,Th=av.apply,Mh=av.construct;gt||(gt=function(e){return e});mt||(mt=function(e){return e});Th||(Th=function(e,t){for(var o=arguments.length,i=new Array(o>2?o-2:0),r=2;r<o;r++)i[r-2]=arguments[r];return e.apply(t,i)});Mh||(Mh=function(e){for(var t=arguments.length,o=new Array(t>1?t-1:0),i=1;i<t;i++)o[i-1]=arguments[i];return new e(...o)});var Ci=nt(Array.prototype.forEach),zk=nt(Array.prototype.lastIndexOf),qy=nt(Array.prototype.pop),_i=nt(Array.prototype.push),$k=nt(Array.prototype.splice),eo=Array.isArray,Hr=nt(String.prototype.toLowerCase),Ph=nt(String.prototype.toString),Ky=nt(String.prototype.match),$r=nt(String.prototype.replace),Yy=nt(String.prototype.indexOf),Bk=nt(String.prototype.trim),Hk=nt(Number.prototype.toString),Uk=nt(Boolean.prototype.toString),Zy=typeof BigInt>"u"?null:nt(BigInt.prototype.toString),Xy=typeof Symbol>"u"?null:nt(Symbol.prototype.toString),ut=nt(Object.prototype.hasOwnProperty),Br=nt(Object.prototype.toString),ct=nt(RegExp.prototype.test),Do=Vk(TypeError);function nt(n){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,o=new Array(t>1?t-1:0),i=1;i<t;i++)o[i-1]=arguments[i];return Th(n,e,o)}}function Vk(n){return function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return Mh(n,t)}}function be(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Hr;if(Gy&&Gy(n,null),!eo(e))return n;let o=e.length;for(;o--;){let i=e[o];if(typeof i=="string"){let r=t(i);r!==i&&(Ak(e)||(e[o]=r),i=r)}n[i]=!0}return n}function jk(n){for(let e=0;e<n.length;e++)ut(n,e)||(n[e]=null);return n}function Mt(n){let e=xi(null);for(let o of sv(n)){var t=Nk(o,2);let i=t[0],r=t[1];ut(n,i)&&(eo(r)?e[i]=jk(r):r&&typeof r=="object"&&r.constructor===Object?e[i]=Mt(r):e[i]=r)}return e}function Wk(n){switch(typeof n){case"string":return n;case"number":return Hk(n);case"boolean":return Uk(n);case"bigint":return Zy?Zy(n):"0";case"symbol":return Xy?Xy(n):"Symbol()";case"undefined":return Br(n);case"function":case"object":{if(n===null)return Br(n);let e=n,t=_n(e,"toString");if(typeof t=="function"){let o=t(e);return typeof o=="string"?o:Br(o)}return Br(n)}default:return Br(n)}}function _n(n,e){for(;n!==null;){let o=Fk(n,e);if(o){if(o.get)return nt(o.get);if(typeof o.value=="function")return nt(o.value)}n=Lk(n)}function t(){return null}return t}function Gk(n){try{return ct(n,""),!0}catch(e){return!1}}var Qy=gt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Eh=gt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ih=gt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),qk=gt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),kh=gt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Kk=gt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Jy=gt(["#text"]),ev=gt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Dh=gt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),tv=gt(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),rd=gt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Yk=mt(/{{[\w\W]*|^[\w\W]*}}/g),Zk=mt(/<%[\w\W]*|^[\w\W]*%>/g),Xk=mt(/\${[\w\W]*/g),Qk=mt(/^data-[\-\w.\u00B7-\uFFFF]+$/),Jk=mt(/^aria-[\-\w]+$/),nv=mt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),eD=mt(/^(?:\w+script|data):/i),tD=mt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),nD=mt(/^html$/i),oD=mt(/^[a-z][.\w]*(-[.\w]+)+$/i),ov=mt(/<[/\w!]/g),iv=mt(/<[/\w]/g),iD=mt(/<\/no(script|embed|frames)/i),rD=mt(/\/>/i),Vt={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},sD=function(){return typeof window>"u"?null:window},aD=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let o=null,i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(o=t.getAttribute(i));let r="dompurify"+(o?"#"+o:"");try{return e.createPolicy(r,{createHTML(s){return s},createScriptURL(s){return s}})}catch(s){return console.warn("TrustedTypes policy "+r+" could not be created."),null}},rv=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Jn=function(e,t,o,i){return ut(e,t)&&eo(e[t])?be(i.base?Mt(i.base):{},e[t],i.transform):o};function dv(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:sD(),e=V=>dv(V);if(e.version="3.4.12",e.removed=[],!n||!n.document||n.document.nodeType!==Vt.document||!n.Element)return e.isSupported=!1,e;let t=n.document,o=t,i=o.currentScript;n.DocumentFragment;let r=n.HTMLTemplateElement,s=n.Node,a=n.Element,d=n.NodeFilter,l=n.NamedNodeMap;l===void 0&&(n.NamedNodeMap||n.MozNamedAttrMap),n.HTMLFormElement;let h=n.DOMParser,g=n.trustedTypes,_=a.prototype,D=_n(_,"cloneNode"),L=_n(_,"remove"),q=_n(_,"nextSibling"),Y=_n(_,"childNodes"),J=_n(_,"parentNode"),fe=_n(_,"shadowRoot"),Ae=_n(_,"attributes"),me=s&&s.prototype?_n(s.prototype,"nodeType"):null,ze=s&&s.prototype?_n(s.prototype,"nodeName"):null;if(typeof r=="function"){let V=t.createElement("template");V.content&&V.content.ownerDocument&&(t=V.content.ownerDocument)}let Ee,$e="",zt,zi=!1,$i=0,Sf=function(){if($i>0)throw Do('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},Ao=function(v){Sf(),$i++;try{return Ee.createHTML(v)}finally{$i--}},Ob=function(v){Sf(),$i++;try{return Ee.createScriptURL(v)}finally{$i--}},Ab=function(){return zi||(zt=aD(g,i),zi=!0),zt},ts=t,dl=ts.implementation,Pf=ts.createNodeIterator,Lb=ts.createDocumentFragment,Fb=ts.getElementsByTagName,zb=o.importNode,We=rv();e.isSupported=typeof sv=="function"&&typeof J=="function"&&dl&&dl.createHTMLDocument!==void 0;let $b=Yk,Bb=Zk,Hb=Xk,Ub=Qk,Vb=Jk,jb=eD,Ef=tD,Wb=oD,If=nv,Ge=null,kf=be({},[...Qy,...Eh,...Ih,...kh,...Jy]),qe=null,Df=be({},[...ev,...Dh,...tv,...rd]),Ke=Object.seal(xi(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Bi=null,Tf=null,On=Object.seal(xi(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Mf=!0,ll=!0,Rf=!1,Nf=!0,An=!1,Ln=!0,ro=!1,cl=!1,ul=null,pl=null,hl=!1,Lo=!1,ns=!1,os=!1,Of=!0,Af=!1,Lf="user-content-",fl=!0,gl=!1,Fo={},pn=null,ml=be({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]),Ff=null,zf=be({},["audio","video","img","source","image","track"]),yl=null,$f=be({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),is="http://www.w3.org/1998/Math/MathML",rs="http://www.w3.org/2000/svg",hn="http://www.w3.org/1999/xhtml",zo=hn,vl=!1,wl=null,Gb=be({},[is,rs,hn],Ph),Bf=gt(["mi","mo","mn","ms","mtext"]),bl=be({},Bf),Hf=gt(["annotation-xml"]),Cl=be({},Hf),qb=be({},["title","style","font","a","script"]),Hi=null,Kb=["application/xhtml+xml","text/html"],Yb="text/html",Ve=null,$o=null,Zb=t.createElement("form"),Uf=function(v){return v instanceof RegExp||v instanceof Function},_l=function(){let v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if($o&&$o===v)return;(!v||typeof v!="object")&&(v={}),v=Mt(v),Hi=Kb.indexOf(v.PARSER_MEDIA_TYPE)===-1?Yb:v.PARSER_MEDIA_TYPE,Ve=Hi==="application/xhtml+xml"?Ph:Hr,Ge=Jn(v,"ALLOWED_TAGS",kf,{transform:Ve}),qe=Jn(v,"ALLOWED_ATTR",Df,{transform:Ve}),wl=Jn(v,"ALLOWED_NAMESPACES",Gb,{transform:Ph}),yl=Jn(v,"ADD_URI_SAFE_ATTR",$f,{transform:Ve,base:$f}),Ff=Jn(v,"ADD_DATA_URI_TAGS",zf,{transform:Ve,base:zf}),pn=Jn(v,"FORBID_CONTENTS",ml,{transform:Ve}),Bi=Jn(v,"FORBID_TAGS",Mt({}),{transform:Ve}),Tf=Jn(v,"FORBID_ATTR",Mt({}),{transform:Ve}),Fo=ut(v,"USE_PROFILES")?v.USE_PROFILES&&typeof v.USE_PROFILES=="object"?Mt(v.USE_PROFILES):v.USE_PROFILES:!1,Mf=v.ALLOW_ARIA_ATTR!==!1,ll=v.ALLOW_DATA_ATTR!==!1,Rf=v.ALLOW_UNKNOWN_PROTOCOLS||!1,Nf=v.ALLOW_SELF_CLOSE_IN_ATTR!==!1,An=v.SAFE_FOR_TEMPLATES||!1,Ln=v.SAFE_FOR_XML!==!1,ro=v.WHOLE_DOCUMENT||!1,Lo=v.RETURN_DOM||!1,ns=v.RETURN_DOM_FRAGMENT||!1,os=v.RETURN_TRUSTED_TYPE||!1,hl=v.FORCE_BODY||!1,Of=v.SANITIZE_DOM!==!1,Af=v.SANITIZE_NAMED_PROPS||!1,fl=v.KEEP_CONTENT!==!1,gl=v.IN_PLACE||!1,If=Gk(v.ALLOWED_URI_REGEXP)?v.ALLOWED_URI_REGEXP:nv,zo=typeof v.NAMESPACE=="string"?v.NAMESPACE:hn,bl=ut(v,"MATHML_TEXT_INTEGRATION_POINTS")&&v.MATHML_TEXT_INTEGRATION_POINTS&&typeof v.MATHML_TEXT_INTEGRATION_POINTS=="object"?Mt(v.MATHML_TEXT_INTEGRATION_POINTS):be({},Bf),Cl=ut(v,"HTML_INTEGRATION_POINTS")&&v.HTML_INTEGRATION_POINTS&&typeof v.HTML_INTEGRATION_POINTS=="object"?Mt(v.HTML_INTEGRATION_POINTS):be({},Hf);let k=ut(v,"CUSTOM_ELEMENT_HANDLING")&&v.CUSTOM_ELEMENT_HANDLING&&typeof v.CUSTOM_ELEMENT_HANDLING=="object"?Mt(v.CUSTOM_ELEMENT_HANDLING):xi(null);if(Ke=xi(null),ut(k,"tagNameCheck")&&Uf(k.tagNameCheck)&&(Ke.tagNameCheck=k.tagNameCheck),ut(k,"attributeNameCheck")&&Uf(k.attributeNameCheck)&&(Ke.attributeNameCheck=k.attributeNameCheck),ut(k,"allowCustomizedBuiltInElements")&&typeof k.allowCustomizedBuiltInElements=="boolean"&&(Ke.allowCustomizedBuiltInElements=k.allowCustomizedBuiltInElements),mt(Ke),An&&(ll=!1),ns&&(Lo=!0),Fo&&(Ge=be({},Jy),qe=xi(null),Fo.html===!0&&(be(Ge,Qy),be(qe,ev)),Fo.svg===!0&&(be(Ge,Eh),be(qe,Dh),be(qe,rd)),Fo.svgFilters===!0&&(be(Ge,Ih),be(qe,Dh),be(qe,rd)),Fo.mathMl===!0&&(be(Ge,kh),be(qe,tv),be(qe,rd))),On.tagCheck=null,On.attributeCheck=null,ut(v,"ADD_TAGS")&&(typeof v.ADD_TAGS=="function"?On.tagCheck=v.ADD_TAGS:eo(v.ADD_TAGS)&&(Ge===kf&&(Ge=Mt(Ge)),be(Ge,v.ADD_TAGS,Ve))),ut(v,"ADD_ATTR")&&(typeof v.ADD_ATTR=="function"?On.attributeCheck=v.ADD_ATTR:eo(v.ADD_ATTR)&&(qe===Df&&(qe=Mt(qe)),be(qe,v.ADD_ATTR,Ve))),ut(v,"ADD_URI_SAFE_ATTR")&&eo(v.ADD_URI_SAFE_ATTR)&&be(yl,v.ADD_URI_SAFE_ATTR,Ve),ut(v,"FORBID_CONTENTS")&&eo(v.FORBID_CONTENTS)&&(pn===ml&&(pn=Mt(pn)),be(pn,v.FORBID_CONTENTS,Ve)),ut(v,"ADD_FORBID_CONTENTS")&&eo(v.ADD_FORBID_CONTENTS)&&(pn===ml&&(pn=Mt(pn)),be(pn,v.ADD_FORBID_CONTENTS,Ve)),fl&&(Ge["#text"]=!0),ro&&be(Ge,["html","head","body"]),Ge.table&&(be(Ge,["tbody"]),delete Bi.tbody),v.TRUSTED_TYPES_POLICY){if(typeof v.TRUSTED_TYPES_POLICY.createHTML!="function")throw Do('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof v.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Do('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let $=Ee;Ee=v.TRUSTED_TYPES_POLICY;try{$e=Ao("")}catch(Z){throw Ee=$,Z}}else v.TRUSTED_TYPES_POLICY===null?(Ee=void 0,$e=""):(Ee===void 0&&(Ee=Ab()),Ee&&typeof $e=="string"&&($e=Ao("")));gt&>(v),$o=v},Vf=be({},[...Eh,...Ih,...qk]),jf=be({},[...kh,...Kk]),Xb=function(v,k,$){return k.namespaceURI===hn?v==="svg":k.namespaceURI===is?v==="svg"&&($==="annotation-xml"||bl[$]):!!Vf[v]},Qb=function(v,k,$){return k.namespaceURI===hn?v==="math":k.namespaceURI===rs?v==="math"&&Cl[$]:!!jf[v]},Jb=function(v,k,$){return k.namespaceURI===rs&&!Cl[$]||k.namespaceURI===is&&!bl[$]?!1:!jf[v]&&(qb[v]||!Vf[v])},eC=function(v){let k=J(v);(!k||!k.tagName)&&(k={namespaceURI:zo,tagName:"template"});let $=Hr(v.tagName),Z=Hr(k.tagName);return wl[v.namespaceURI]?v.namespaceURI===rs?Xb($,k,Z):v.namespaceURI===is?Qb($,k,Z):v.namespaceURI===hn?Jb($,k,Z):!!(Hi==="application/xhtml+xml"&&wl[v.namespaceURI]):!1},Fn=function(v){_i(e.removed,{element:v});try{J(v).removeChild(v)}catch(k){if(L(v),!J(v))throw Do("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},ss=function(v){xl(v);let k=Y(v);if(k){let Z=[];Ci(k,re=>{_i(Z,re)}),Ci(Z,re=>{try{L(re)}catch(ae){}})}let $=Ae(v);if($)for(let Z=$.length-1;Z>=0;--Z){let re=$[Z],ae=re&&re.name;if(typeof ae=="string")try{v.removeAttribute(ae)}catch(Ye){}}},so=function(v,k){try{_i(e.removed,{attribute:k.getAttributeNode(v),from:k})}catch($){_i(e.removed,{attribute:null,from:k})}if(k.removeAttribute(v),v==="is")if(Lo||ns)try{Fn(k)}catch($){}else try{k.setAttribute(v,"")}catch($){}},tC=function(v){let k=Ae(v);if(k)for(let $=k.length-1;$>=0;--$){let Z=k[$],re=Z&&Z.name;if(!(typeof re!="string"||qe[Ve(re)]))try{v.removeAttribute(re)}catch(ae){}}},xl=function(v){let k=[v];for(;k.length>0;){let $=k.pop();(me?me($):$.nodeType)===Vt.element&&tC($);let re=Y($);if(re)for(let ae=re.length-1;ae>=0;--ae)k.push(re[ae])}},nC=function(v){if(!Ln)return;let k=[v];for(;k.length>0;){let $=k.pop(),Z=me?me($):$.nodeType;if(Z===Vt.processingInstruction||Z===Vt.comment&&ct(iv,$.data)){try{L($)}catch(ae){}continue}if(Z===Vt.element){let ae=$,Ye=Ve(ze?ze($):$.nodeName);try{ae.hasAttribute&&ae.hasAttribute("patchsrc")&&ae.removeAttribute("patchsrc"),ae.hasAttribute&&ae.hasAttribute("for")&&Ye!=="label"&&Ye!=="output"&&ae.removeAttribute("for")}catch(yt){}}let re=Y($);if(re)for(let ae=re.length-1;ae>=0;--ae)k.push(re[ae])}},Wf=function(v){let k=null,$=null;if(hl)v="<remove></remove>"+v;else{let ae=Ky(v,/^[\r\n\t ]+/);$=ae&&ae[0]}Hi==="application/xhtml+xml"&&zo===hn&&(v='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+v+"</body></html>");let Z=Ee?Ao(v):v;if(zo===hn)try{k=new h().parseFromString(Z,Hi)}catch(ae){}if(!k||!k.documentElement){k=dl.createDocument(zo,"template",null);try{k.documentElement.innerHTML=vl?$e:Z}catch(ae){}}let re=k.body||k.documentElement;return v&&$&&re.insertBefore(t.createTextNode($),re.childNodes[0]||null),zo===hn?Fb.call(k,ro?"html":"body")[0]:ro?k.documentElement:re},Gf=function(v){return Pf.call(v.ownerDocument||v,v,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},as=function(v){return v=$r(v,$b," "),v=$r(v,Bb," "),v=$r(v,Hb," "),v},Sl=function(v){var k;v.normalize();let $=Pf.call(v.ownerDocument||v,v,d.SHOW_TEXT|d.SHOW_COMMENT|d.SHOW_CDATA_SECTION|d.SHOW_PROCESSING_INSTRUCTION,null),Z=$.nextNode();for(;Z;)Z.data=as(Z.data),Z=$.nextNode();let re=(k=v.querySelectorAll)===null||k===void 0?void 0:k.call(v,"template");re&&Ci(re,ae=>{Bo(ae.content)&&Sl(ae.content)})},ds=function(v){let k=ze?ze(v):null;return typeof k!="string"||Ve(k)!=="form"?!1:typeof v.nodeName!="string"||typeof v.textContent!="string"||typeof v.removeChild!="function"||v.attributes!==Ae(v)||typeof v.removeAttribute!="function"||typeof v.setAttribute!="function"||typeof v.namespaceURI!="string"||typeof v.insertBefore!="function"||typeof v.hasChildNodes!="function"||v.nodeType!==me(v)||v.childNodes!==Y(v)},Bo=function(v){if(!me||typeof v!="object"||v===null)return!1;try{return me(v)===Vt.documentFragment}catch(k){return!1}},Ui=function(v){if(!me||typeof v!="object"||v===null)return!1;try{return typeof me(v)=="number"}catch(k){return!1}};function fn(V,v,k){V.length!==0&&Ci(V,$=>{$.call(e,v,k,$o)})}let oC=function(v,k){return!!(Ln&&v.hasChildNodes()&&!Ui(v.firstElementChild)&&ct(ov,v.textContent)&&ct(ov,v.innerHTML)||Ln&&v.namespaceURI===hn&&k==="style"&&Ui(v.firstElementChild)||v.nodeType===Vt.processingInstruction||Ln&&v.nodeType===Vt.comment&&ct(iv,v.data))},iC=function(v,k){if(!Bi[k]&&Yf(k)&&(Ke.tagNameCheck instanceof RegExp&&ct(Ke.tagNameCheck,k)||Ke.tagNameCheck instanceof Function&&Ke.tagNameCheck(k)))return!1;if(fl&&!pn[k]){let $=J(v),Z=Y(v);if(Z&&$){let re=Z.length;for(let ae=re-1;ae>=0;--ae){let Ye=gl?Z[ae]:D(Z[ae],!0);$.insertBefore(Ye,q(v))}}}return Fn(v),!0},qf=function(v,k){if(fn(We.beforeSanitizeElements,v,null),v!==k&&J(v)===null)return!0;if(ds(v))return Fn(v),!0;let $=Ve(ze?ze(v):v.nodeName);if(fn(We.uponSanitizeElement,v,{tagName:$,allowedTags:Ge}),v!==k&&J(v)===null)return!0;if(oC(v,$))return Fn(v),!0;if(Bi[$]||!(On.tagCheck instanceof Function&&On.tagCheck($))&&!Ge[$]){let re=iC(v,$);return re===!1&&fn(We.afterSanitizeElements,v,null),re}if((me?me(v):v.nodeType)===Vt.element&&!eC(v)||($==="noscript"||$==="noembed"||$==="noframes")&&ct(iD,v.innerHTML))return Fn(v),!0;if(An&&v.nodeType===Vt.text){let re=as(v.textContent);v.textContent!==re&&(_i(e.removed,{element:v.cloneNode()}),v.textContent=re)}return fn(We.afterSanitizeElements,v,null),!1},Kf=function(v,k,$){if(Tf[k]||Ln&&k==="patchsrc"||Ln&&k==="for"&&v!=="label"&&v!=="output"||Of&&(k==="id"||k==="name")&&($ in t||$ in Zb))return!1;let Z=qe[k]||On.attributeCheck instanceof Function&&On.attributeCheck(k,v);if(!(ll&&ct(Ub,k))){if(!(Mf&&ct(Vb,k))){if(Z){if(!yl[k]){if(!ct(If,$r($,Ef,""))){if(!((k==="src"||k==="xlink:href"||k==="href")&&v!=="script"&&Yy($,"data:")===0&&Ff[v])){if(!(Rf&&!ct(jb,$r($,Ef,"")))){if($)return!1}}}}}else if(!(Yf(v)&&(Ke.tagNameCheck instanceof RegExp&&ct(Ke.tagNameCheck,v)||Ke.tagNameCheck instanceof Function&&Ke.tagNameCheck(v))&&(Ke.attributeNameCheck instanceof RegExp&&ct(Ke.attributeNameCheck,k)||Ke.attributeNameCheck instanceof Function&&Ke.attributeNameCheck(k,v))||k==="is"&&Ke.allowCustomizedBuiltInElements&&(Ke.tagNameCheck instanceof RegExp&&ct(Ke.tagNameCheck,$)||Ke.tagNameCheck instanceof Function&&Ke.tagNameCheck($))))return!1}}return!0},rC=be({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Yf=function(v){return!rC[Hr(v)]&&ct(Wb,v)},sC=function(v,k,$,Z){if(Ee&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!$)switch(g.getAttributeType(v,k)){case"TrustedHTML":return Ao(Z);case"TrustedScriptURL":return Ob(Z)}return Z},aC=function(v,k,$,Z){try{$?v.setAttributeNS($,k,Z):v.setAttribute(k,Z),ds(v)?Fn(v):qy(e.removed)}catch(re){so(k,v)}},Zf=function(v){fn(We.beforeSanitizeAttributes,v,null);let k=v.attributes;if(!k||ds(v))return;let $={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:qe,forceKeepAttr:void 0},Z=k.length,re=Ve(v.nodeName);for(;Z--;){let ae=k[Z],Ye=ae.name,yt=ae.namespaceURI,Xt=ae.value,Rt=Ve(Ye),Qt=Xt,Et=Ye==="value"?Qt:Bk(Qt);if($.attrName=Rt,$.attrValue=Et,$.keepAttr=!0,$.forceKeepAttr=void 0,fn(We.uponSanitizeAttribute,v,$),Et=$.attrValue,Af&&(Rt==="id"||Rt==="name")&&Yy(Et,Lf)!==0&&(so(Ye,v),Et=Lf+Et),Ln&&ct(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Et)){so(Ye,v);continue}if(Rt==="attributename"&&Ky(Et,"href")){so(Ye,v);continue}if(!$.forceKeepAttr){if(!$.keepAttr){so(Ye,v);continue}if(!Nf&&ct(rD,Et)){so(Ye,v);continue}if(An&&(Et=as(Et)),!Kf(re,Rt,Et)){so(Ye,v);continue}Et=sC(re,Rt,yt,Et),Et!==Qt&&aC(v,Ye,yt,Et)}}fn(We.afterSanitizeAttributes,v,null)},ls=function(v){let k=null,$=Gf(v);for(fn(We.beforeSanitizeShadowDOM,v,null);k=$.nextNode();)if(fn(We.uponSanitizeShadowNode,k,null),qf(k,v),Zf(k),Bo(k.content)&&ls(k.content),(me?me(k):k.nodeType)===Vt.element){let re=fe(k);Bo(re)&&(Pl(re),ls(re))}fn(We.afterSanitizeShadowDOM,v,null)},Pl=function(v){let k=[{node:v,shadow:null}];for(;k.length>0;){let $=k.pop();if($.shadow){ls($.shadow);continue}let Z=$.node,ae=(me?me(Z):Z.nodeType)===Vt.element,Ye=Y(Z);if(Ye)for(let yt=Ye.length-1;yt>=0;--yt)k.push({node:Ye[yt],shadow:null});if(ae){let yt=ze?ze(Z):null;if(typeof yt=="string"&&Ve(yt)==="template"){let Xt=Z.content;Bo(Xt)&&k.push({node:Xt,shadow:null})}}if(ae){let yt=fe(Z);Bo(yt)&&k.push({node:null,shadow:yt},{node:yt,shadow:null})}}};return e.sanitize=function(V){let v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},k=null,$=null,Z=null,re=null;if(vl=!V,vl&&(V="<!-->"),typeof V!="string"&&!Ui(V)&&(V=Wk(V),typeof V!="string"))throw Do("dirty is not a string, aborting");if(!e.isSupported)return V;cl?(Ge=ul,qe=pl):_l(v),(We.uponSanitizeElement.length>0||We.uponSanitizeAttribute.length>0)&&(Ge=Mt(Ge)),We.uponSanitizeAttribute.length>0&&(qe=Mt(qe)),e.removed=[];let ae=gl&&typeof V!="string"&&Ui(V);if(ae){nC(V);let Rt=ze?ze(V):V.nodeName;if(typeof Rt=="string"){let Qt=Ve(Rt);if(!Ge[Qt]||Bi[Qt])throw ss(V),Do("root node is forbidden and cannot be sanitized in-place")}if(ds(V))throw ss(V),Do("root node is clobbered and cannot be sanitized in-place");try{Pl(V)}catch(Qt){throw ss(V),Qt}}else if(Ui(V))k=Wf("<!---->"),$=k.ownerDocument.importNode(V,!0),$.nodeType===Vt.element&&$.nodeName==="BODY"||$.nodeName==="HTML"?k=$:k.appendChild($),Pl($);else{if(!Lo&&!An&&!ro&&V.indexOf("<")===-1)return Ee&&os?Ao(V):V;if(k=Wf(V),!k)return Lo?null:os?$e:""}k&&hl&&Fn(k.firstChild);let Ye=ae?V:k,yt=Gf(Ye);try{for(;Z=yt.nextNode();)qf(Z,Ye),Zf(Z),Bo(Z.content)&&ls(Z.content)}catch(Rt){throw ae&&(ss(V),Ci(e.removed,Qt=>{Qt.element&&xl(Qt.element)})),Rt}if(ae)return Ci(e.removed,Rt=>{Rt.element&&xl(Rt.element)}),An&&Sl(V),V;if(Lo){if(An&&Sl(k),ns)for(re=Lb.call(k.ownerDocument);k.firstChild;)re.appendChild(k.firstChild);else re=k;return(qe.shadowroot||qe.shadowrootmode)&&(re=zb.call(o,re,!0)),re}let Xt=ro?k.outerHTML:k.innerHTML;return ro&&Ge["!doctype"]&&k.ownerDocument&&k.ownerDocument.doctype&&k.ownerDocument.doctype.name&&ct(nD,k.ownerDocument.doctype.name)&&(Xt="<!DOCTYPE "+k.ownerDocument.doctype.name+`>
|
|
241
|
+
`+Xt),An&&(Xt=as(Xt)),Ee&&os?Ao(Xt):Xt},e.setConfig=function(){let V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};_l(V),cl=!0,ul=Ge,pl=qe},e.clearConfig=function(){$o=null,cl=!1,ul=null,pl=null,Ee=zt,$e=""},e.isValidAttribute=function(V,v,k){$o||_l({});let $=Ve(V),Z=Ve(v);return Kf($,Z,k)},e.addHook=function(V,v){typeof v=="function"&&ut(We,V)&&_i(We[V],v)},e.removeHook=function(V,v){if(ut(We,V)){if(v!==void 0){let k=zk(We[V],v);return k===-1?void 0:$k(We[V],k,1)[0]}return qy(We[V])}},e.removeHooks=function(V){ut(We,V)&&(We[V]=[])},e.removeAllHooks=function(){We=rv()},e}var lv=dv();function Ah(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ro=Ah();function yv(n){Ro=n}var To={exec:()=>null};function Si(n){let e=[];return t=>{let o=Math.max(0,Math.min(3,t-1)),i=e[o];return i||(i=n(o),e[o]=i),i}}function Ce(n,e=""){let t=typeof n=="string"?n:n.source,o={replace:(i,r)=>{let s=typeof r=="string"?r:r.source;return s=s.replace(Pt.caret,"$1"),t=t.replace(i,s),o},getRegex:()=>new RegExp(t,e)};return o}var dD=((n="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+n)}catch(e){return!1}})(),Pt={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Si(n=>new RegExp(`^ {0,${n}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Si(n=>new RegExp(`^ {0,${n}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Si(n=>new RegExp(`^ {0,${n}}(?:\`\`\`|~~~)`)),headingBeginRegex:Si(n=>new RegExp(`^ {0,${n}}#`)),htmlBeginRegex:Si(n=>new RegExp(`^ {0,${n}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Si(n=>new RegExp(`^ {0,${n}}>`))},lD=/^(?:[ \t]*(?:\n|$))+/,cD=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,uD=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,jr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,pD=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Lh=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,vv=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,wv=Ce(vv).replace(/bull/g,Lh).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),hD=Ce(vv).replace(/bull/g,Lh).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Fh=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,fD=/^[^\n]+/,zh=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,gD=Ce(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",zh).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),mD=Ce(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Lh).getRegex(),cd="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",$h=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,yD=Ce("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n+|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n+|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n+|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",$h).replace("tag",cd).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),bv=n=>Ce(Fh).replace("hr",jr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list",n).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",cd).getRegex(),vD=bv(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),wD=bv(/ {0,3}(?:[*+-]|\d{1,9}[.)])[ \t]+[^ \t\n]/),bD=Ce(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",wD).getRegex(),Bh={blockquote:bD,code:cD,def:gD,fences:uD,heading:pD,hr:jr,html:yD,lheading:wv,list:mD,newline:lD,paragraph:vD,table:To,text:fD},cv=Ce("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",jr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",cd).getRegex(),CD=C(p({},Bh),{lheading:hD,table:cv,paragraph:Ce(Fh).replace("hr",jr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",cv).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",cd).getRegex()}),_D=C(p({},Bh),{html:Ce(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",$h).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:To,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Ce(Fh).replace("hr",jr).replace("heading",` *#{1,6} *[^
|
|
242
|
+
]`).replace("lheading",wv).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),xD=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,SD=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Cv=/^( {2,}|\\)\n(?!\s*$)/,PD=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Pi=/[\p{P}\p{S}]/u,ud=/[\s\p{P}\p{S}]/u,Hh=/[^\s\p{P}\p{S}]/u,ED=Ce(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ud).getRegex(),_v=/(?!~)[\p{P}\p{S}]/u,ID=/(?!~)[\s\p{P}\p{S}]/u,kD=/(?:[^\s\p{P}\p{S}]|~)/u,DD=Ce(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",dD?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),xv=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,TD=Ce(xv,"u").replace(/punct/g,Pi).getRegex(),MD=Ce(xv,"u").replace(/punct/g,_v).getRegex(),Sv="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",RD=Ce(Sv,"gu").replace(/notPunctSpace/g,Hh).replace(/punctSpace/g,ud).replace(/punct/g,Pi).getRegex(),ND=Ce(Sv,"gu").replace(/notPunctSpace/g,kD).replace(/punctSpace/g,ID).replace(/punct/g,_v).getRegex(),OD=Ce("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Hh).replace(/punctSpace/g,ud).replace(/punct/g,Pi).getRegex(),AD=Ce(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Pi).getRegex(),LD="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",FD=Ce(LD,"gu").replace(/notPunctSpace/g,Hh).replace(/punctSpace/g,ud).replace(/punct/g,Pi).getRegex(),zD=Ce(/\\(punct)/,"gu").replace(/punct/g,Pi).getRegex(),$D=Ce(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),BD=Ce($h).replace("(?:-->|$)","-->").getRegex(),HD=Ce("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",BD).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ad=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,UD=Ce(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",ad).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Pv=Ce(/^!?\[(label)\]\[(ref)\]/).replace("label",ad).replace("ref",zh).getRegex(),Ev=Ce(/^!?\[(ref)\](?:\[\])?/).replace("ref",zh).getRegex(),VD=Ce("reflink|nolink(?!\\()","g").replace("reflink",Pv).replace("nolink",Ev).getRegex(),uv=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Uh={_backpedal:To,anyPunctuation:zD,autolink:$D,blockSkip:DD,br:Cv,code:SD,del:To,delLDelim:To,delRDelim:To,emStrongLDelim:TD,emStrongRDelimAst:RD,emStrongRDelimUnd:OD,escape:xD,link:UD,nolink:Ev,punctuation:ED,reflink:Pv,reflinkSearch:VD,tag:HD,text:PD,url:To},jD=C(p({},Uh),{link:Ce(/^!?\[(label)\]\((.*?)\)/).replace("label",ad).getRegex(),reflink:Ce(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ad).getRegex()}),Rh=C(p({},Uh),{emStrongRDelimAst:ND,emStrongLDelim:MD,delLDelim:AD,delRDelim:FD,url:Ce(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",uv).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Ce(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",uv).getRegex()}),WD=C(p({},Rh),{br:Ce(Cv).replace("{2,}","*").getRegex(),text:Ce(Rh.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()}),sd={normal:Bh,gfm:CD,pedantic:_D},Ur={normal:Uh,gfm:Rh,breaks:WD,pedantic:jD},GD={"&":"&","<":"<",">":">",'"':""","'":"'"},pv=n=>GD[n];function xn(n,e){if(e){if(Pt.escapeTest.test(n))return n.replace(Pt.escapeReplace,pv)}else if(Pt.escapeTestNoEncode.test(n))return n.replace(Pt.escapeReplaceNoEncode,pv);return n}function hv(n){try{n=encodeURI(n).replace(Pt.percentDecode,"%")}catch(e){return null}return n}function fv(n,e){let t=n.replace(Pt.findPipe,(r,s,a)=>{let d=!1,l=s;for(;--l>=0&&a[l]==="\\";)d=!d;return d?"|":" |"}),o=t.split(Pt.splitPipe),i=0;if(o[0].trim()||o.shift(),o.length>0&&!o.at(-1)?.trim()&&o.pop(),e)if(o.length>e)o.splice(e);else for(;o.length<e;)o.push("");for(;i<o.length;i++)o[i]=o[i].trim().replace(Pt.slashPipe,"|");return o}function to(n,e,t){let o=n.length;if(o===0)return"";let i=0;for(;i<o;){let r=n.charAt(o-i-1);if(r===e&&!t)i++;else if(r!==e&&t)i++;else break}return n.slice(0,o-i)}function gv(n){let e=n.split(`
|
|
243
|
+
`),t=e.length-1;for(;t>=0&&Pt.blankLine.test(e[t]);)t--;return e.length-t<=2?n:e.slice(0,t+1).join(`
|
|
244
|
+
`)}function qD(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let o=0;o<n.length;o++)if(n[o]==="\\")o++;else if(n[o]===e[0])t++;else if(n[o]===e[1]&&(t--,t<0))return o;return t>0?-2:-1}function KD(n,e=0){let t=e,o="";for(let i of n)if(i===" "){let r=4-t%4;o+=" ".repeat(r),t+=r}else o+=i,t++;return o}function mv(n,e,t,o,i){let r=e.href,s=e.title||null,a=n[1].replace(i.other.outputLinkReplace,"$1");o.state.inLink=!0;let d={type:n[0].charAt(0)==="!"?"image":"link",raw:t,href:r,title:s,text:a,tokens:o.inlineTokens(a)};return o.state.inLink=!1,d}function YD(n,e,t){let o=n.match(t.other.indentCodeCompensation);if(o===null)return e;let i=o[1];return e.split(`
|
|
245
|
+
`).map(r=>{let s=r.match(t.other.beginningSpace);if(s===null)return r;let[a]=s;return a.length>=i.length?r.slice(i.length):r}).join(`
|
|
246
|
+
`)}var dd=class{options;rules;lexer;constructor(n){this.options=n||Ro}space(n){let e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){let e=this.rules.block.code.exec(n);if(e){let t=this.options.pedantic?e[0]:gv(e[0]),o=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:o}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],o=YD(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:o}}}heading(n){let e=this.rules.block.heading.exec(n);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let o=to(t,"#");(this.options.pedantic||!o||this.rules.other.endingSpaceChar.test(o))&&(t=o.trim())}return{type:"heading",raw:to(e[0],`
|
|
247
|
+
`),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(n){let e=this.rules.block.hr.exec(n);if(e)return{type:"hr",raw:to(e[0],`
|
|
248
|
+
`)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let t=to(e[0],`
|
|
249
|
+
`).split(`
|
|
250
|
+
`),o="",i="",r=[];for(;t.length>0;){let s=!1,a=[],d;for(d=0;d<t.length;d++)if(this.rules.other.blockquoteStart.test(t[d]))a.push(t[d]),s=!0;else if(!s)a.push(t[d]);else break;t=t.slice(d);let l=a.join(`
|
|
251
|
+
`),h=l.replace(this.rules.other.blockquoteSetextReplace,`
|
|
252
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");o=o?`${o}
|
|
253
|
+
${l}`:l,i=i?`${i}
|
|
254
|
+
${h}`:h;let g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,r,!0),this.lexer.state.top=g,t.length===0)break;let _=r.at(-1);if(_?.type==="code")break;if(_?.type==="blockquote"){let D=_,L=D.raw+`
|
|
255
|
+
`+t.join(`
|
|
256
|
+
`),q=this.blockquote(L);r[r.length-1]=q,o=o.substring(0,o.length-D.raw.length)+q.raw,i=i.substring(0,i.length-D.text.length)+q.text;break}else if(_?.type==="list"){let D=_,L=D.raw+`
|
|
257
|
+
`+t.join(`
|
|
258
|
+
`),q=this.list(L);r[r.length-1]=q,o=o.substring(0,o.length-_.raw.length)+q.raw,i=i.substring(0,i.length-D.raw.length)+q.raw,t=L.substring(r.at(-1).raw.length).split(`
|
|
259
|
+
`);continue}}return{type:"blockquote",raw:o,tokens:r,text:i}}}list(n){let e=this.rules.block.list.exec(n);if(e){let t=e[1].trim(),o=t.length>1,i={type:"list",raw:"",ordered:o,start:o?+t.slice(0,-1):"",loose:!1,items:[]};t=o?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=o?t:"[*+-]");let r=this.rules.other.listItemRegex(t),s=!1;for(;n;){let d=!1,l="",h="";if(!(e=r.exec(n))||this.rules.block.hr.test(n))break;l=e[0],n=n.substring(l.length);let g=KD(e[2].split(`
|
|
260
|
+
`,1)[0],e[1].length),_=n.split(`
|
|
261
|
+
`,1)[0],D=!g.trim(),L=0;if(this.options.pedantic?(L=2,h=g.trimStart()):D?L=e[1].length+1:(L=g.search(this.rules.other.nonSpaceChar),L=L>4?1:L,h=g.slice(L),L+=e[1].length),D&&this.rules.other.blankLine.test(_)&&(l+=_+`
|
|
262
|
+
`,n=n.substring(_.length+1),d=!0),!d){let q=this.rules.other.nextBulletRegex(L),Y=this.rules.other.hrRegex(L),J=this.rules.other.fencesBeginRegex(L),fe=this.rules.other.headingBeginRegex(L),Ae=this.rules.other.htmlBeginRegex(L),me=this.rules.other.blockquoteBeginRegex(L);for(;n;){let ze=n.split(`
|
|
263
|
+
`,1)[0],Ee;if(_=ze,this.options.pedantic?(_=_.replace(this.rules.other.listReplaceNesting," "),Ee=_):Ee=_.replace(this.rules.other.tabCharGlobal," "),J.test(_)||fe.test(_)||Ae.test(_)||me.test(_)||q.test(_)||Y.test(_))break;if(Ee.search(this.rules.other.nonSpaceChar)>=L||!_.trim())h+=`
|
|
264
|
+
`+Ee.slice(L);else{if(D||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||J.test(g)||fe.test(g)||Y.test(g))break;h+=`
|
|
265
|
+
`+_}D=!_.trim(),l+=ze+`
|
|
266
|
+
`,n=n.substring(ze.length+1),g=Ee.slice(L)}}i.loose||(s?i.loose=!0:this.rules.other.doubleBlankLine.test(l)&&(s=!0)),i.items.push({type:"list_item",raw:l,task:!!this.options.gfm&&this.rules.other.listIsTask.test(h),loose:!1,text:h,tokens:[]}),i.raw+=l}let a=i.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let d of i.items){this.lexer.state.top=!1,d.tokens=this.lexer.blockTokens(d.text,[]);let l=d.tokens[0];if(d.task&&(l?.type==="text"||l?.type==="paragraph")){d.text=d.text.replace(this.rules.other.listReplaceTask,""),l.raw=l.raw.replace(this.rules.other.listReplaceTask,""),l.text=l.text.replace(this.rules.other.listReplaceTask,"");for(let g=this.lexer.inlineQueue.length-1;g>=0;g--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[g].src)){this.lexer.inlineQueue[g].src=this.lexer.inlineQueue[g].src.replace(this.rules.other.listReplaceTask,"");break}let h=this.rules.other.listTaskCheckbox.exec(d.raw);if(h){let g={type:"checkbox",raw:h[0]+" ",checked:h[0]!=="[ ]"};d.checked=g.checked,i.loose?d.tokens[0]&&["paragraph","text"].includes(d.tokens[0].type)&&"tokens"in d.tokens[0]&&d.tokens[0].tokens?(d.tokens[0].raw=g.raw+d.tokens[0].raw,d.tokens[0].text=g.raw+d.tokens[0].text,d.tokens[0].tokens.unshift(g)):d.tokens.unshift({type:"paragraph",raw:g.raw,text:g.raw,tokens:[g]}):d.tokens.unshift(g)}}else d.task&&(d.task=!1);if(!i.loose){let h=d.tokens.filter(_=>_.type==="space"),g=h.length>0&&h.some(_=>this.rules.other.anyLine.test(_.raw));i.loose=g}}if(i.loose)for(let d of i.items){d.loose=!0;for(let l of d.tokens)l.type==="text"&&(l.type="paragraph")}return i}}html(n){let e=this.rules.block.html.exec(n);if(e){let t=gv(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(n){let e=this.rules.block.def.exec(n);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),o=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:to(e[0],`
|
|
267
|
+
`),href:o,title:i}}}table(n){let e=this.rules.block.table.exec(n);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=fv(e[1]),o=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
268
|
+
`):[],r={type:"table",raw:to(e[0],`
|
|
269
|
+
`),header:[],align:[],rows:[]};if(t.length===o.length){for(let s of o)this.rules.other.tableAlignRight.test(s)?r.align.push("right"):this.rules.other.tableAlignCenter.test(s)?r.align.push("center"):this.rules.other.tableAlignLeft.test(s)?r.align.push("left"):r.align.push(null);for(let s=0;s<t.length;s++)r.header.push({text:t[s],tokens:this.lexer.inline(t[s]),header:!0,align:r.align[s]});for(let s of i)r.rows.push(fv(s,r.header.length).map((a,d)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:r.align[d]})));return r}}lheading(n){let e=this.rules.block.lheading.exec(n);if(e){let t=e[1].trim();return{type:"heading",raw:to(e[0],`
|
|
270
|
+
`),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(n){let e=this.rules.block.paragraph.exec(n);if(e){let t=e[1].charAt(e[1].length-1)===`
|
|
271
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){let e=this.rules.inline.link.exec(n);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let r=to(t.slice(0,-1),"\\");if((t.length-r.length)%2===0)return}else{let r=qD(e[2],"()");if(r===-2)return;if(r>-1){let s=(e[0].indexOf("!")===0?5:4)+e[1].length+r;e[2]=e[2].substring(0,r),e[0]=e[0].substring(0,s).trim(),e[3]=""}}let o=e[2],i="";if(this.options.pedantic){let r=this.rules.other.pedanticHrefTitle.exec(o);r&&(o=r[1],i=r[3])}else i=e[3]?e[3].slice(1,-1):"";return o=o.trim(),this.rules.other.startAngleBracket.test(o)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?o=o.slice(1):o=o.slice(1,-1)),mv(e,{href:o&&o.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){let o=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[o.toLowerCase()];if(!i){let r=t[0].charAt(0);return{type:"text",raw:r,text:r}}return mv(t,i,t[0],this.lexer,this.rules)}}emStrong(n,e,t=""){let o=this.rules.inline.emStrongLDelim.exec(n);if(!(!o||!o[1]&&!o[2]&&!o[3]&&!o[4]||o[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(o[1]||o[3])||!t||this.rules.inline.punctuation.exec(t))){let i=[...o[0]].length-1,r,s,a=i,d=0,l=o[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,e=e.slice(-1*n.length+i);(o=l.exec(e))!==null;){if(r=o[1]||o[2]||o[3]||o[4]||o[5]||o[6],!r)continue;if(s=[...r].length,o[3]||o[4]){a+=s;continue}else if((o[5]||o[6])&&i%3&&!((i+s)%3)){d+=s;continue}if(a-=s,a>0)continue;s=Math.min(s,s+a+d);let h=[...o[0]][0].length,g=n.slice(0,i+o.index+h+s);if(Math.min(i,s)%2){let D=g.slice(1,-1);return{type:"em",raw:g,text:D,tokens:this.lexer.inlineTokens(D)}}let _=g.slice(2,-2);return{type:"strong",raw:g,text:_,tokens:this.lexer.inlineTokens(_)}}}}codespan(n){let e=this.rules.inline.code.exec(n);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),o=this.rules.other.nonSpaceChar.test(t),i=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return o&&i&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(n){let e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n,e,t=""){let o=this.rules.inline.delLDelim.exec(n);if(o&&(!o[1]||!t||this.rules.inline.punctuation.exec(t))){let i=[...o[0]].length-1,r,s,a=i,d=this.rules.inline.delRDelim;for(d.lastIndex=0,e=e.slice(-1*n.length+i);(o=d.exec(e))!==null;){if(r=o[1]||o[2]||o[3]||o[4]||o[5]||o[6],!r||(s=[...r].length,s!==i))continue;if(o[3]||o[4]){a+=s;continue}if(a-=s,a>0)continue;s=Math.min(s,s+a);let l=[...o[0]][0].length,h=n.slice(0,i+o.index+l+s),g=h.slice(i,-i);return{type:"del",raw:h,text:g,tokens:this.lexer.inlineTokens(g)}}}}autolink(n){let e=this.rules.inline.autolink.exec(n);if(e){let t,o;return e[2]==="@"?(t=e[1],o="mailto:"+t):(t=e[1],o=t),{type:"link",raw:e[0],text:t,href:o,tokens:[{type:"text",raw:t,text:t}]}}}url(n){let e;if(e=this.rules.inline.url.exec(n)){let t,o;if(e[2]==="@")t=e[0],o="mailto:"+t;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);t=e[0],e[1]==="www."?o="http://"+e[0]:o=e[0]}return{type:"link",raw:e[0],text:t,href:o,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(n){let e=this.rules.inline.text.exec(n);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},cn=class Nh{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Ro,this.options.tokenizer=this.options.tokenizer||new dd,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:Pt,block:sd.normal,inline:Ur.normal};this.options.pedantic?(t.block=sd.pedantic,t.inline=Ur.pedantic):this.options.gfm&&(t.block=sd.gfm,this.options.breaks?t.inline=Ur.breaks:t.inline=Ur.gfm),this.tokenizer.rules=t}static get rules(){return{block:sd,inline:Ur}}static lex(e,t){return new Nh(t).lex(e)}static lexInline(e,t){return new Nh(t).inlineTokens(e)}lex(e){e=e.replace(Pt.carriageReturn,`
|
|
272
|
+
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let o=this.inlineQueue[t];this.inlineTokens(o.src,o.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],o=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(Pt.tabCharGlobal," ").replace(Pt.spaceLine,""));let i=1/0;for(;e;){if(e.length<i)i=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let r;if(this.options.extensions?.block?.some(a=>(r=a.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let a=t.at(-1);r.raw.length===1&&a!==void 0?a.raw+=`
|
|
273
|
+
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let a=t.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
274
|
+
`)?"":`
|
|
275
|
+
`)+r.raw,a.text+=`
|
|
276
|
+
`+r.text,this.inlineQueue.at(-1).src=a.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let a=t.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
277
|
+
`)?"":`
|
|
278
|
+
`)+r.raw,a.text+=`
|
|
279
|
+
`+r.raw,this.inlineQueue.at(-1).src=a.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let s=e;if(this.options.extensions?.startBlock){let a=1/0,d=e.slice(1),l;this.options.extensions.startBlock.forEach(h=>{l=h.call({lexer:this},d),typeof l=="number"&&l>=0&&(a=Math.min(a,l))}),a<1/0&&a>=0&&(s=e.substring(0,a+1))}if(this.state.top&&(r=this.tokenizer.paragraph(s))){let a=t.at(-1);o&&a?.type==="paragraph"?(a.raw+=(a.raw.endsWith(`
|
|
280
|
+
`)?"":`
|
|
281
|
+
`)+r.raw,a.text+=`
|
|
282
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),o=s.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let a=t.at(-1);a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
283
|
+
`)?"":`
|
|
284
|
+
`)+r.raw,a.text+=`
|
|
285
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let o=e,i=null;if(this.tokens.links){let l=Object.keys(this.tokens.links);if(l.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(o))!==null;)l.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(o=o.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(o))!==null;)o=o.slice(0,i.index)+"++"+o.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let r;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(o))!==null;)r=i[2]?i[2].length:0,o=o.slice(0,i.index+r)+"["+"a".repeat(i[0].length-r-2)+"]"+o.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);o=this.options.hooks?.emStrongMask?.call({lexer:this},o)??o;let s=!1,a="",d=1/0;for(;e;){if(e.length<d)d=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}s||(a=""),s=!1;let l;if(this.options.extensions?.inline?.some(g=>(l=g.call({lexer:this},e,t))?(e=e.substring(l.raw.length),t.push(l),!0):!1))continue;if(l=this.tokenizer.escape(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.tag(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.link(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(l.raw.length);let g=t.at(-1);l.type==="text"&&g?.type==="text"?(g.raw+=l.raw,g.text+=l.text):t.push(l);continue}if(l=this.tokenizer.emStrong(e,o,a)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.codespan(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.br(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.del(e,o,a)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.autolink(e)){e=e.substring(l.raw.length),t.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(e))){e=e.substring(l.raw.length),t.push(l);continue}let h=e;if(this.options.extensions?.startInline){let g=1/0,_=e.slice(1),D;this.options.extensions.startInline.forEach(L=>{D=L.call({lexer:this},_),typeof D=="number"&&D>=0&&(g=Math.min(g,D))}),g<1/0&&g>=0&&(h=e.substring(0,g+1))}if(l=this.tokenizer.inlineText(h)){e=e.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(a=l.raw.slice(-1)),s=!0;let g=t.at(-1);g?.type==="text"?(g.raw+=l.raw,g.text+=l.text):t.push(l);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t="Infinite loop on byte: "+e;if(this.options.silent)console.error(t);else throw new Error(t)}},ld=class{options;parser;constructor(n){this.options=n||Ro}space(n){return""}code({text:n,lang:e,escaped:t}){let o=(e||"").match(Pt.notSpaceStart)?.[0],i=n.replace(Pt.endingNewline,"")+`
|
|
286
|
+
`;return o?'<pre><code class="language-'+xn(o)+'">'+(t?i:xn(i,!0))+`</code></pre>
|
|
287
|
+
`:"<pre><code>"+(t?i:xn(i,!0))+`</code></pre>
|
|
288
|
+
`}blockquote({tokens:n}){return`<blockquote>
|
|
289
|
+
${this.parser.parse(n)}</blockquote>
|
|
290
|
+
`}html({text:n}){return n}def(n){return""}heading({tokens:n,depth:e}){return`<h${e}>${this.parser.parseInline(n)}</h${e}>
|
|
291
|
+
`}hr(n){return`<hr>
|
|
292
|
+
`}list(n){let e=n.ordered,t=n.start,o="";for(let s=0;s<n.items.length;s++){let a=n.items[s];o+=this.listitem(a)}let i=e?"ol":"ul",r=e&&t!==1?' start="'+t+'"':"";return"<"+i+r+`>
|
|
293
|
+
`+o+"</"+i+`>
|
|
294
|
+
`}listitem(n){return`<li>${this.parser.parse(n.tokens)}</li>
|
|
295
|
+
`}checkbox({checked:n}){return"<input "+(n?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:n}){return`<p>${this.parser.parseInline(n)}</p>
|
|
296
|
+
`}table(n){let e="",t="";for(let i=0;i<n.header.length;i++)t+=this.tablecell(n.header[i]);e+=this.tablerow({text:t});let o="";for(let i=0;i<n.rows.length;i++){let r=n.rows[i];t="";for(let s=0;s<r.length;s++)t+=this.tablecell(r[s]);o+=this.tablerow({text:t})}return o&&(o=`<tbody>${o}</tbody>`),`<table>
|
|
297
|
+
<thead>
|
|
298
|
+
`+e+`</thead>
|
|
299
|
+
`+o+`</table>
|
|
300
|
+
`}tablerow({text:n}){return`<tr>
|
|
301
|
+
${n}</tr>
|
|
302
|
+
`}tablecell(n){let e=this.parser.parseInline(n.tokens),t=n.header?"th":"td";return(n.align?`<${t} align="${n.align}">`:`<${t}>`)+e+`</${t}>
|
|
303
|
+
`}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${xn(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:e,tokens:t}){let o=this.parser.parseInline(t),i=hv(n);if(i===null)return o;n=i;let r='<a href="'+n+'"';return e&&(r+=' title="'+xn(e)+'"'),r+=">"+o+"</a>",r}image({href:n,title:e,text:t,tokens:o}){o&&(t=this.parser.parseInline(o,this.parser.textRenderer));let i=hv(n);if(i===null)return xn(t);n=i;let r=`<img src="${n}" alt="${xn(t)}"`;return e&&(r+=` title="${xn(e)}"`),r+=">",r}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:xn(n.text)}},Vh=class{strong({text:n}){return n}em({text:n}){return n}codespan({text:n}){return n}del({text:n}){return n}html({text:n}){return n}text({text:n}){return n}link({text:n}){return""+n}image({text:n}){return""+n}br(){return""}checkbox({raw:n}){return n}},un=class Oh{options;renderer;textRenderer;constructor(e){this.options=e||Ro,this.options.renderer=this.options.renderer||new ld,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Vh}static parse(e,t){return new Oh(t).parse(e)}static parseInline(e,t){return new Oh(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let o=0;o<e.length;o++){let i=e[o];if(this.options.extensions?.renderers?.[i.type]){let s=i,a=this.options.extensions.renderers[s.type].call({parser:this},s);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(s.type)){t+=a||"";continue}}let r=i;switch(r.type){case"space":{t+=this.renderer.space(r);break}case"hr":{t+=this.renderer.hr(r);break}case"heading":{t+=this.renderer.heading(r);break}case"code":{t+=this.renderer.code(r);break}case"table":{t+=this.renderer.table(r);break}case"blockquote":{t+=this.renderer.blockquote(r);break}case"list":{t+=this.renderer.list(r);break}case"checkbox":{t+=this.renderer.checkbox(r);break}case"html":{t+=this.renderer.html(r);break}case"def":{t+=this.renderer.def(r);break}case"paragraph":{t+=this.renderer.paragraph(r);break}case"text":{t+=this.renderer.text(r);break}default:{let s='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let o="";for(let i=0;i<e.length;i++){let r=e[i];if(this.options.extensions?.renderers?.[r.type]){let a=this.options.extensions.renderers[r.type].call({parser:this},r);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(r.type)){o+=a||"";continue}}let s=r;switch(s.type){case"escape":{o+=t.text(s);break}case"html":{o+=t.html(s);break}case"link":{o+=t.link(s);break}case"image":{o+=t.image(s);break}case"checkbox":{o+=t.checkbox(s);break}case"strong":{o+=t.strong(s);break}case"em":{o+=t.em(s);break}case"codespan":{o+=t.codespan(s);break}case"br":{o+=t.br(s);break}case"del":{o+=t.del(s);break}case"text":{o+=t.text(s);break}default:{let a='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return o}},Vr=class{options;block;constructor(n){this.options=n||Ro}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(n=this.block){return n?cn.lex:cn.lexInline}provideParser(n=this.block){return n?un.parse:un.parseInline}},ZD=class{defaults=Ah();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=un;Renderer=ld;TextRenderer=Vh;Lexer=cn;Tokenizer=dd;Hooks=Vr;constructor(...n){this.use(...n)}walkTokens(n,e){let t=[];for(let o of n)switch(t=t.concat(e.call(this,o)),o.type){case"table":{let i=o;for(let r of i.header)t=t.concat(this.walkTokens(r.tokens,e));for(let r of i.rows)for(let s of r)t=t.concat(this.walkTokens(s.tokens,e));break}case"list":{let i=o;t=t.concat(this.walkTokens(i.items,e));break}default:{let i=o;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(r=>{let s=i[r].flat(1/0);t=t.concat(this.walkTokens(s,e))}):i.tokens&&(t=t.concat(this.walkTokens(i.tokens,e)))}}return t}use(...n){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(t=>{let o=p({},t);if(o.async=this.defaults.async||o.async||!1,t.extensions&&(t.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let r=e.renderers[i.name];r?e.renderers[i.name]=function(...s){let a=i.renderer.apply(this,s);return a===!1&&(a=r.apply(this,s)),a}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let r=e[i.level];r?r.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),o.extensions=e),t.renderer){let i=this.defaults.renderer||new ld(this.defaults);for(let r in t.renderer){if(!(r in i))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;let s=r,a=t.renderer[s],d=i[s];i[s]=(...l)=>{let h=a.apply(i,l);return h===!1&&(h=d.apply(i,l)),h||""}}o.renderer=i}if(t.tokenizer){let i=this.defaults.tokenizer||new dd(this.defaults);for(let r in t.tokenizer){if(!(r in i))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;let s=r,a=t.tokenizer[s],d=i[s];i[s]=(...l)=>{let h=a.apply(i,l);return h===!1&&(h=d.apply(i,l)),h}}o.tokenizer=i}if(t.hooks){let i=this.defaults.hooks||new Vr;for(let r in t.hooks){if(!(r in i))throw new Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;let s=r,a=t.hooks[s],d=i[s];Vr.passThroughHooks.has(r)?i[s]=l=>{if(this.defaults.async&&Vr.passThroughHooksRespectAsync.has(r))return A(this,null,function*(){let g=yield a.call(i,l);return d.call(i,g)});let h=a.call(i,l);return d.call(i,h)}:i[s]=(...l)=>{if(this.defaults.async)return A(this,null,function*(){let g=yield a.apply(i,l);return g===!1&&(g=yield d.apply(i,l)),g});let h=a.apply(i,l);return h===!1&&(h=d.apply(i,l)),h}}o.hooks=i}if(t.walkTokens){let i=this.defaults.walkTokens,r=t.walkTokens;o.walkTokens=function(s){let a=[];return a.push(r.call(this,s)),i&&(a=a.concat(i.call(this,s))),a}}this.defaults=p(p({},this.defaults),o)}),this}setOptions(n){return this.defaults=p(p({},this.defaults),n),this}lexer(n,e){return cn.lex(n,e??this.defaults)}parser(n,e){return un.parse(n,e??this.defaults)}parseMarkdown(n){return(e,t)=>{let o=p({},t),i=p(p({},this.defaults),o),r=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&o.async===!1)return r(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return r(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return r(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=n),i.async)return A(this,null,function*(){let s=i.hooks?yield i.hooks.preprocess(e):e,a=yield(i.hooks?yield i.hooks.provideLexer(n):n?cn.lex:cn.lexInline)(s,i),d=i.hooks?yield i.hooks.processAllTokens(a):a;i.walkTokens&&(yield Promise.all(this.walkTokens(d,i.walkTokens)));let l=yield(i.hooks?yield i.hooks.provideParser(n):n?un.parse:un.parseInline)(d,i);return i.hooks?yield i.hooks.postprocess(l):l}).catch(r);try{i.hooks&&(e=i.hooks.preprocess(e));let s=(i.hooks?i.hooks.provideLexer(n):n?cn.lex:cn.lexInline)(e,i);i.hooks&&(s=i.hooks.processAllTokens(s)),i.walkTokens&&this.walkTokens(s,i.walkTokens);let a=(i.hooks?i.hooks.provideParser(n):n?un.parse:un.parseInline)(s,i);return i.hooks&&(a=i.hooks.postprocess(a)),a}catch(s){return r(s)}}}onError(n,e){return t=>{if(t.message+=`
|
|
304
|
+
Please report this to https://github.com/markedjs/marked.`,n){let o="<p>An error occurred:</p><pre>"+xn(t.message+"",!0)+"</pre>";return e?Promise.resolve(o):o}if(e)return Promise.reject(t);throw t}}},Mo=new ZD;function De(n,e){return Mo.parse(n,e)}De.options=De.setOptions=function(n){return Mo.setOptions(n),De.defaults=Mo.defaults,yv(De.defaults),De};De.getDefaults=Ah;De.defaults=Ro;De.use=function(...n){return Mo.use(...n),De.defaults=Mo.defaults,yv(De.defaults),De};De.walkTokens=function(n,e){return Mo.walkTokens(n,e)};De.parseInline=Mo.parseInline;De.Parser=un;De.parser=un.parse;De.Renderer=ld;De.TextRenderer=Vh;De.Lexer=cn;De.lexer=cn.lex;De.Tokenizer=dd;De.Hooks=Vr;De.parse=De;var p8=De.options,h8=De.setOptions,f8=De.use,g8=De.walkTokens,m8=De.parseInline;var y8=un.parse,v8=cn.lex;var XD=(n,e)=>{let t=0;for(;t<n.length&&t<e.length&&n[t]===e[t];)t+=1;return n.slice(0,t)},QD=n=>{let e=n.split(`
|
|
305
|
+
`),t=e.filter(i=>i.trim().length>0).map(i=>/^[ \t]*/.exec(i)?.[0]??"");if(t.length===0)return n;let o=t.reduce(XD);return o.length===0?n:e.map(i=>i.startsWith(o)?i.slice(o.length):i).join(`
|
|
306
|
+
`)},Ei=n=>{if(n.trim().length===0)return"";let e=De.parse(n,{async:!1});return typeof e=="string"?lv.sanitize(e):""},pd=n=>{if(n===void 0||n.trim().length===0)return null;let e=Ei(QD(n).trim());return e.length>0?e:null};var JD=["editor"],eT=0,hd=class n{constructor(){this.host=f(He);this.injector=f(wt);this.editor=Xe("editor");this.value=T("");this.disabled=T(!1);this.label=T("Edit text");this.valueChange=Ct();this.dismiss=Ct();this.labelId=`lf-text-expand-label-${eT+=1}`;this.placeholder=null;this.destroyed=!1;this.onDocumentKeydown=e=>{e.key==="Escape"&&(e.preventDefault(),e.stopImmediatePropagation(),this.dismiss.emit())};Gt(()=>{this.attachToBody(),this.focusEditor()},{injector:this.injector}),document.addEventListener("keydown",this.onDocumentKeydown,!0)}emitValue(e){this.disabled()||this.valueChange.emit(e)}attachToBody(){if(this.destroyed)return;let e=this.host.nativeElement,t=e.parentNode;t!==null&&t!==document.body&&(this.placeholder=document.createComment("lf-text-expand-dialog"),t.insertBefore(this.placeholder,e),document.body.appendChild(e))}focusEditor(){let e=this.editor()?.nativeElement;if(e===void 0||e.disabled)return;e.focus();let t=e.value.length;e.setSelectionRange(t,t)}ngOnDestroy(){this.destroyed=!0,document.removeEventListener("keydown",this.onDocumentKeydown,!0),this.host.nativeElement.remove(),this.placeholder?.remove(),this.placeholder=null}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-text-expand-dialog"]],viewQuery:function(t,o){t&1&&rt(o.editor,JD,5),t&2&&st()},hostAttrs:[1,"fixed","inset-0","z-40","flex","items-center","justify-center","bg-zinc-950/40"],hostBindings:function(t,o){t&1&&R("click",function(){return o.dismiss.emit()})},inputs:{value:[1,"value"],disabled:[1,"disabled"],label:[1,"label"]},outputs:{valueChange:"valueChange",dismiss:"dismiss"},decls:8,vars:5,consts:[["editor",""],["role","dialog","aria-modal","true",1,"flex","h-[calc(100vh-2rem)]","w-[min(700px,calc(100vw-2rem))]","max-w-[700px]","flex-col","overflow-hidden","rounded-lg","border","border-zinc-200","bg-white","shadow-lg","dark:border-zinc-700","dark:bg-zinc-900",3,"click"],[1,"flex","shrink-0","items-center","justify-between","gap-3","border-b","border-zinc-200","px-3","py-2","dark:border-zinc-700"],[1,"min-w-0","truncate","text-sm","font-medium","text-zinc-950","dark:text-zinc-100",3,"id"],["type","button",1,"shrink-0","rounded-md","border","border-zinc-200","px-2","py-1","text-xs","font-medium","text-zinc-700","transition","hover:bg-zinc-100","dark:border-zinc-700","dark:text-zinc-200","dark:hover:bg-zinc-800",3,"click"],[1,"lf-scroll","min-h-0","w-full","flex-1","resize-none","overflow-y-scroll","border-0","bg-transparent","p-3","text-sm","leading-5","text-zinc-800","outline-none","dark:text-zinc-100",3,"change","keyup","value","disabled"]],template:function(t,o){if(t&1){let i=z();O(0,"div",1),ge("click",function(s){return s.stopPropagation()}),O(1,"div",2)(2,"h2",3),w(3),N(),O(4,"button",4),ge("click",function(){return o.dismiss.emit()}),w(5," Close "),N()(),O(6,"textarea",5,0),ge("change",function(){x(i);let s=Le(7);return S(o.emitValue(s.value))})("keyup",function(){x(i);let s=Le(7);return S(o.emitValue(s.value))}),N()()}t&2&&(K("aria-labelledby",o.labelId),u(2),he("id",o.labelId),u(),H(" ",o.label()," "),u(3),he("value",o.value())("disabled",o.disabled()))},encapsulation:2})}};function tT(n,e){if(n&1){let t=z();y(0,"input",10,0),R("change",function(){x(t);let i=Le(1),r=c();return S(r.valueChange.emit(i.value))})("keyup",function(){x(t);let i=Le(1),r=c();return S(r.valueChange.emit(i.value))}),m()}if(n&2){let t=c();M("value",t.textValue())("disabled",t.disabled())}}function nT(n,e){if(n&1){let t=z();y(0,"input",11,0),R("change",function(){x(t);let i=Le(1),r=c();return S(r.onNumberChange(i.value))})("keyup",function(){x(t);let i=Le(1),r=c();return S(r.onNumberChange(i.value))}),m()}if(n&2){let t=c();M("value",t.textValue())("min",t.numberConfig()?.min??null)("max",t.numberConfig()?.max??null)("step",t.numberConfig()?.step??"any")("disabled",t.disabled())}}function oT(n,e){if(n&1){let t=z();y(0,"span",13)(1,"lf-hover-tip",14)(2,"button",15),R("mousedown",function(i){x(t);let r=c(2);return S(r.onExpandMouseDown(i))})("click",function(i){x(t);let r=c(2);return S(r.openExpand(i))}),ce(),y(3,"svg",16),F(4,"path",17),m()()()()}}function iT(n,e){if(n&1){let t=z();y(0,"div",3)(1,"textarea",12,0),R("change",function(){x(t);let i=Le(2),r=c();return S(r.valueChange.emit(i.value))})("keyup",function(){x(t);let i=Le(2),r=c();return S(r.valueChange.emit(i.value))}),m(),P(3,oT,5,0,"span",13),m()}if(n&2){let t=c();u(),G("lf-inline-multiline--expand",t.showExpand()),M("value",t.textValue())("disabled",t.disabled()),u(2),E(t.showExpand()?3:-1)}}function rT(n,e){if(n&1){let t=z();y(0,"textarea",20,0),R("change",function(){x(t);let i=Le(1),r=c(2);return S(r.valueChange.emit(i.value))})("keyup",function(){x(t);let i=Le(1),r=c(2);return S(r.valueChange.emit(i.value))})("blur",function(){x(t);let i=c(2);return S(i.stopMarkdownEdit())}),m()}if(n&2){let t=c(2);G("lf-inline-multiline--expand",t.showExpand()),M("value",t.textValue())}}function sT(n,e){if(n&1&&F(0,"div",22),n&2){let t=c(3);M("innerHTML",t.authorMarkdownHtml(),tn)}}function aT(n,e){n&1&&(y(0,"span",23),w(1,"Write a hint\u2026"),m())}function dT(n,e){if(n&1){let t=z();y(0,"div",21),R("click",function(){x(t);let i=c(2);return S(i.startMarkdownEdit())})("focus",function(){x(t);let i=c(2);return S(i.startMarkdownEdit())}),P(1,sT,1,1,"div",22)(2,aT,2,0,"span",23),m()}if(n&2){let t=c(2);G("lf-inline-preview--expand",t.showExpand()),u(),E(t.textValue()?1:2)}}function lT(n,e){if(n&1){let t=z();y(0,"span",13)(1,"lf-hover-tip",14)(2,"button",15),R("mousedown",function(i){x(t);let r=c(2);return S(r.onExpandMouseDown(i))})("click",function(i){x(t);let r=c(2);return S(r.openExpand(i))}),ce(),y(3,"svg",16),F(4,"path",17),m()()()()}}function cT(n,e){if(n&1&&(y(0,"div",3),P(1,rT,2,3,"textarea",18)(2,dT,3,3,"div",19),P(3,lT,5,0,"span",13),m()),n&2){let t=c();u(),E(t.markdownEditingActive()?1:2),u(2),E(t.showExpand()?3:-1)}}function uT(n,e){if(n&1){let t=z();y(0,"label",4)(1,"input",24,0),R("change",function(){x(t);let i=Le(2),r=c();return S(r.valueChange.emit(i.checked))}),m(),w(3),m()}if(n&2){let t=c();u(),M("checked",t.booleanValue())("disabled",t.disabled()),u(2),H(" ",t.booleanValue()?"true":"false"," ")}}function pT(n,e){if(n&1&&(y(0,"option",26),w(1),m()),n&2){let t=e.$implicit,o=e.$index,i=c(2);M("value",o)("selected",i.sameValue(t.value,i.value()))("title",t.description??""),u(),H(" ",t.title," ")}}function hT(n,e){n&1&&(y(0,"p",27),w(1),m()),n&2&&(u(),H(" ",e," "))}function fT(n,e){if(n&1){let t=z();y(0,"div",5)(1,"select",25,0),R("change",function(){x(t);let i=Le(2),r=c();return S(r.onSelectChange(i.value))}),X(3,pT,2,4,"option",26,nn),m(),P(5,hT,2,1,"p",27),m()}if(n&2){let t,o=c();u(),M("disabled",o.disabled()),u(2),Q(o.options()),u(2),E((t=o.selectedDescription())?5:-1,t)}}function gT(n,e){if(n&1){let t=z();y(0,"label",4)(1,"input",28),R("change",function(){let i=x(t).$implicit,r=c(2);return S(r.valueChange.emit(i.value))}),m(),w(2),m()}if(n&2){let t=e.$implicit,o=c(2);u(),M("name",o.radioGroupName)("checked",o.sameValue(t.value,o.value()))("disabled",o.disabled()),u(),H(" ",t.title," ")}}function mT(n,e){if(n&1&&(y(0,"div",5),X(1,gT,3,4,"label",4,nn),m()),n&2){let t=c();u(),Q(t.options())}}function yT(n,e){n&1&&(y(0,"span",27),w(1),m()),n&2&&(u(),ue(e))}function vT(n,e){if(n&1){let t=z();y(0,"label",29)(1,"input",30),R("change",function(){let i=x(t).$implicit,r=c(2);return S(r.onMultiselectToggle(i.value))}),m(),y(2,"span",31)(3,"span"),w(4),m(),P(5,yT,2,1,"span",27),m()()}if(n&2){let t,o=e.$implicit,i=c(2);u(),M("checked",i.isSelected(o.value))("disabled",i.disabled()),u(3),ue(o.title),u(),E((t=o.description)?5:-1,t)}}function wT(n,e){if(n&1&&(y(0,"div",5),X(1,vT,6,4,"label",29,nn),m()),n&2){let t=c();u(),Q(t.options())}}function bT(n,e){if(n&1&&(y(0,"pre",6)(1,"code"),w(2),m()()),n&2){let t=c();u(2),ue(t.previewText())}}function CT(n,e){if(n&1&&F(0,"div",7),n&2){let t=c();M("innerHTML",t.previewHtml(),tn)}}function _T(n,e){if(n&1&&(y(0,"div",8),w(1),m()),n&2){let t=c();u(),H(" ",t.previewText()," ")}}function xT(n,e){if(n&1){let t=z();y(0,"lf-text-expand-dialog",32),R("valueChange",function(i){x(t);let r=c();return S(r.valueChange.emit(i))})("dismiss",function(){x(t);let i=c();return S(i.expanded.set(!1))}),m()}if(n&2){let t=c();M("value",t.textValue())("disabled",t.disabled())("label",t.expandLabel())}}function ST(n){if(n==null)return"";if(typeof n=="object")try{return JSON.stringify(n,null,2)}catch(e){return String(n)}return String(n)}var PT=n=>{if(n==null||n==="[object Object]")return"";if(typeof n=="string")return n;if(typeof n=="object")try{return JSON.stringify(n,null,2)}catch(e){return""}return String(n)};function ET(n){return typeof n=="string"?n:n.type}var IT=0,kT=(n,e)=>n.find(o=>Ii(o.value,e))?.description,DT=(n,e)=>{let t=Array.isArray(e)?e.filter(o=>o!=null&&o!==""&&!n.some(i=>Ii(i.value,o))):e!=null&&e!==""&&!n.some(o=>Ii(o.value,e))?[e]:[];return t.length===0?n:[...t.map(o=>({value:o,title:`${String(o)} (missing)`,description:"No longer available \u2014 choose another option to clear this"})),...n]};function Ii(n,e){if(n===e)return!0;try{return JSON.stringify(n)===JSON.stringify(e)}catch(t){return!1}}var no=class n{constructor(){this.config=T.required();this.value=T(void 0);this.previewValue=T(void 0);this.disabled=T(!1);this.fill=T(!1);this.expandable=T(!0);this.expandLabel=T("Edit text");this.valueChange=Ct();this.sameValue=Ii;this.kind=b(()=>ET(this.config()));this.options=b(()=>{let e=this.config(),t=typeof e=="string"||!("options"in e)?[]:e.options;return DT(t,this.value())});this.numberConfig=b(()=>{let e=this.config();return typeof e=="string"||e.type!=="number"?void 0:e});this.multilineMinHeightPx=b(()=>Cr(this.config())?.minHeightPx);this.textValue=b(()=>PT(this.value()));this.booleanValue=b(()=>this.value()===!0);this.previewText=b(()=>ST(this.previewValue()));this.previewHtml=b(()=>Ei(this.previewText()));this.authorMarkdownHtml=b(()=>Ei(this.textValue()));this.markdownEditing=U(!1);this.expanded=U(!1);this.showExpand=b(()=>this.expandable()&&(this.kind()==="text-multiline"||this.kind()==="markdown"));this.markdownEditingActive=b(()=>this.markdownEditing()&&!this.disabled());this.selectedDescription=b(()=>kT(this.options(),this.value()));this.radioGroupName=`lf-inline-radio-${IT+=1}`}onExpandMouseDown(e){e.preventDefault(),e.stopPropagation()}openExpand(e){e.preventDefault(),e.stopPropagation(),this.expanded.set(!0)}startMarkdownEdit(){this.disabled()||this.markdownEditing.set(!0)}stopMarkdownEdit(){this.markdownEditing.set(!1)}onNumberChange(e){let t=Number(e);e.trim().length>0&&!Number.isNaN(t)&&this.valueChange.emit(t)}onSelectChange(e){let t=this.options()[Number(e)];t!==void 0&&this.valueChange.emit(t.value)}isSelected(e){let t=this.value();return Array.isArray(t)?t.some(o=>Ii(o,e)):!1}onMultiselectToggle(e){let t=this.value(),o=Array.isArray(t)?t:[],i=this.isSelected(e)?o.filter(r=>!Ii(r,e)):[...o,e];this.valueChange.emit(i)}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-inline-field"]],hostVars:4,hostBindings:function(t,o){t&2&&(Ze("--lf-multiline-min",o.multilineMinHeightPx(),"px"),G("lf-inline-field--fill",o.fill()))},inputs:{config:[1,"config"],value:[1,"value"],previewValue:[1,"previewValue"],disabled:[1,"disabled"],fill:[1,"fill"],expandable:[1,"expandable"],expandLabel:[1,"expandLabel"]},outputs:{valueChange:"valueChange"},decls:12,vars:2,consts:[["control",""],["type","text",1,"lf-inline-control",3,"value","disabled"],["type","number",1,"lf-inline-control","lf-inline-control--number",3,"value","min","max","step","disabled"],[1,"lf-inline-expand-host"],[1,"flex","items-center","gap-1.5","text-[10px]","text-zinc-600","dark:text-zinc-300"],[1,"flex","flex-col","gap-0.5"],[1,"lf-inline-preview","lf-inline-preview--code","lf-scroll"],[1,"lf-inline-preview","lf-scroll","prose","prose-xs","max-w-full","dark:prose-invert",3,"innerHTML"],[1,"lf-inline-preview","lf-scroll"],[3,"value","disabled","label"],["type","text",1,"lf-inline-control",3,"change","keyup","value","disabled"],["type","number",1,"lf-inline-control","lf-inline-control--number",3,"change","keyup","value","min","max","step","disabled"],["rows","2","data-no-drag","true","data-no-pan","true",1,"lf-inline-control","lf-inline-multiline","lf-scroll",3,"change","keyup","value","disabled"],[1,"lf-inline-expand-button"],["tip","Expand","side","bottom","align","end"],["type","button","aria-label","Expand","data-no-drag","true","data-no-pan","true",1,"rounded","p-0.5","text-zinc-500","hover:bg-zinc-200","hover:text-zinc-800","dark:text-zinc-400","dark:hover:bg-zinc-800","dark:hover:text-zinc-100",3,"mousedown","click"],["viewBox","0 0 24 24","fill","none","stroke","currentColor","stroke-width","2","aria-hidden","true",1,"h-3","w-3"],["stroke-linecap","round","stroke-linejoin","round","d","M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"],["rows","2","autofocus","","data-no-drag","true","data-no-pan","true",1,"lf-inline-control","lf-inline-multiline","lf-scroll",3,"value","lf-inline-multiline--expand"],["tabindex","0","data-no-drag","true","data-no-pan","true",1,"lf-inline-preview","lf-scroll","prose","prose-xs","max-w-full","dark:prose-invert",3,"lf-inline-preview--expand"],["rows","2","autofocus","","data-no-drag","true","data-no-pan","true",1,"lf-inline-control","lf-inline-multiline","lf-scroll",3,"change","keyup","blur","value"],["tabindex","0","data-no-drag","true","data-no-pan","true",1,"lf-inline-preview","lf-scroll","prose","prose-xs","max-w-full","dark:prose-invert",3,"click","focus"],[3,"innerHTML"],[1,"lf-inline-preview-placeholder"],["type","checkbox",3,"change","checked","disabled"],[1,"lf-inline-control",3,"change","disabled"],[3,"value","selected","title"],[1,"lf-inline-select-caption"],["type","radio",3,"change","name","checked","disabled"],[1,"flex","items-start","gap-1.5","text-[10px]","text-zinc-600","dark:text-zinc-300"],["type","checkbox",1,"mt-0.5",3,"change","checked","disabled"],[1,"flex","min-w-0","flex-col","gap-0.5"],[3,"valueChange","dismiss","value","disabled","label"]],template:function(t,o){if(t&1&&(P(0,tT,2,2,"input",1)(1,nT,2,5,"input",2)(2,iT,4,5,"div",3)(3,cT,4,2,"div",3)(4,uT,4,3,"label",4)(5,fT,6,2,"div",5)(6,mT,3,0,"div",5)(7,wT,3,0,"div",5)(8,bT,3,1,"pre",6)(9,CT,1,1,"div",7)(10,_T,2,1,"div",8),P(11,xT,1,3,"lf-text-expand-dialog",9)),t&2){let i;E((i=o.kind())==="text"?0:i==="number"?1:i==="text-multiline"?2:i==="markdown"?3:i==="boolean"?4:i==="select"?5:i==="radio"?6:i==="multiselect"?7:i==="preview-code"?8:i==="preview-markdown"?9:10),u(11),E(o.expanded()&&o.showExpand()?11:-1)}},dependencies:[Ue,hd],styles:['.lf-inline-control[_ngcontent-%COMP%]{width:100%;border-radius:.25rem;border:1px solid rgb(228 228 231);background:#fafafa;padding:.125rem .5rem;font-size:10px;color:#3f3f46}.lf-inline-control[_ngcontent-%COMP%]:disabled, input[_ngcontent-%COMP%]:disabled{cursor:not-allowed}[data-theme="dark"][_nghost-%COMP%] .lf-inline-control[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-inline-control[_ngcontent-%COMP%]{border-color:#3f3f46;background:#09090b;color:#e4e4e7}.lf-inline-control--number[_ngcontent-%COMP%]{padding-right:.125rem;-moz-appearance:textfield}.lf-inline-control--number[_ngcontent-%COMP%]::-webkit-inner-spin-button, .lf-inline-control--number[_ngcontent-%COMP%]::-webkit-outer-spin-button{margin:0;height:1.25rem;opacity:1;cursor:pointer;filter:grayscale(1) brightness(.85)}[data-theme="dark"][_nghost-%COMP%] .lf-inline-control--number[_ngcontent-%COMP%]::-webkit-inner-spin-button, [data-theme="dark"] [_nghost-%COMP%] .lf-inline-control--number[_ngcontent-%COMP%]::-webkit-inner-spin-button, [data-theme="dark"][_nghost-%COMP%] .lf-inline-control--number[_ngcontent-%COMP%]::-webkit-outer-spin-button, [data-theme="dark"] [_nghost-%COMP%] .lf-inline-control--number[_ngcontent-%COMP%]::-webkit-outer-spin-button{filter:grayscale(1) invert(1) brightness(.75)}.lf-inline-control--number[_ngcontent-%COMP%]:hover, .lf-inline-control--number[_ngcontent-%COMP%]:focus{-moz-appearance:number-input}.lf-inline-control--number[_ngcontent-%COMP%]::-moz-number-spin-box{padding-inline:.125rem}.lf-inline-control--number[_ngcontent-%COMP%]::-moz-number-spin-up, .lf-inline-control--number[_ngcontent-%COMP%]::-moz-number-spin-down{border:none;background:transparent;opacity:.55}.lf-inline-control--number[_ngcontent-%COMP%]:hover::-moz-number-spin-up, .lf-inline-control--number[_ngcontent-%COMP%]:hover::-moz-number-spin-down, .lf-inline-control--number[_ngcontent-%COMP%]:focus::-moz-number-spin-up, .lf-inline-control--number[_ngcontent-%COMP%]:focus::-moz-number-spin-down{opacity:.85}.lf-inline-field--fill[_nghost-%COMP%]{display:flex;flex:1 1 auto;flex-direction:column;min-height:0;height:100%}.lf-inline-expand-host[_ngcontent-%COMP%]{position:relative;width:100%}.lf-inline-field--fill[_nghost-%COMP%] .lf-inline-expand-host[_ngcontent-%COMP%]{display:flex;flex:1 1 auto;flex-direction:column;min-height:0;height:100%}.lf-inline-multiline[_ngcontent-%COMP%]{resize:none;min-height:var(--lf-multiline-min, 100px);max-height:12rem;overflow-y:auto}.lf-inline-expand-button[_ngcontent-%COMP%]{position:absolute;top:.125rem;right:1.5rem;z-index:10}lf-inspector-panel[_nghost-%COMP%] .lf-inline-multiline[_ngcontent-%COMP%], lf-inspector-panel [_nghost-%COMP%] .lf-inline-multiline[_ngcontent-%COMP%]{resize:vertical;max-height:none}.lf-inline-field--fill[_nghost-%COMP%] .lf-inline-multiline[_ngcontent-%COMP%]{flex:1 1 auto;height:100%;max-height:none;min-height:var(--lf-multiline-min, 100px)}.lf-inline-preview[_ngcontent-%COMP%]{width:100%;max-width:100%;min-height:1rem;max-height:10rem;overflow-x:hidden;overflow-y:auto;overflow-wrap:anywhere;border-radius:.25rem;padding:.125rem .5rem;font-size:10px;color:#18181b;white-space:pre-wrap;word-break:break-word;box-sizing:border-box;--tw-prose-body: rgb(24 24 27);--tw-prose-headings: rgb(24 24 27);--tw-prose-bold: rgb(24 24 27);--tw-prose-links: rgb(24 24 27);--tw-prose-counters: rgb(24 24 27);--tw-prose-bullets: rgb(24 24 27);--tw-prose-quotes: rgb(24 24 27);--tw-prose-captions: rgb(63 63 70);--tw-prose-code: rgb(24 24 27);--tw-prose-pre-code: rgb(24 24 27);--tw-prose-th-borders: rgb(212 212 216);--tw-prose-td-borders: rgb(228 228 231)}[data-theme="dark"][_nghost-%COMP%] .lf-inline-preview[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-inline-preview[_ngcontent-%COMP%]{color:#f4f4f5;--tw-prose-body: rgb(244 244 245);--tw-prose-headings: rgb(244 244 245);--tw-prose-bold: rgb(244 244 245);--tw-prose-links: rgb(244 244 245);--tw-prose-counters: rgb(244 244 245);--tw-prose-bullets: rgb(244 244 245);--tw-prose-quotes: rgb(244 244 245);--tw-prose-captions: rgb(212 212 216);--tw-prose-code: rgb(244 244 245);--tw-prose-pre-code: rgb(244 244 245);--tw-prose-th-borders: rgb(63 63 70);--tw-prose-td-borders: rgb(63 63 70)}.lf-inline-field--fill[_nghost-%COMP%] .lf-inline-preview[_ngcontent-%COMP%]{flex:1 1 auto;height:100%;min-height:1rem;max-height:none;min-width:0;max-width:100%;overflow-x:hidden;overflow-y:auto}.lf-inline-multiline.lf-inline-multiline--expand[_ngcontent-%COMP%], .lf-inline-preview.lf-inline-preview--expand[_ngcontent-%COMP%], .lf-inline-field--fill[_nghost-%COMP%] .lf-inline-preview.lf-inline-preview--expand[_ngcontent-%COMP%]{padding-right:3rem;overflow-y:scroll}[_nghost-%COMP%] .lf-inline-preview img, [_nghost-%COMP%] .lf-inline-preview pre, [_nghost-%COMP%] .lf-inline-preview table, [_nghost-%COMP%] .lf-inline-preview code{max-width:100%}.lf-inline-preview--code[_ngcontent-%COMP%]{font-family:monospace;background:#fafafa}[data-theme="dark"][_nghost-%COMP%] .lf-inline-preview--code[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-inline-preview--code[_ngcontent-%COMP%]{background:#09090b}.lf-inline-preview-placeholder[_ngcontent-%COMP%]{color:#a1a1aa}[data-theme="dark"][_nghost-%COMP%] .lf-inline-preview-placeholder[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-inline-preview-placeholder[_ngcontent-%COMP%]{color:#71717a}.lf-inline-select-caption[_ngcontent-%COMP%]{margin:0;font-size:10px;line-height:1.25;color:#64748b}[data-theme="dark"][_nghost-%COMP%] .lf-inline-select-caption[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-inline-select-caption[_ngcontent-%COMP%]{color:#71717a}']})}};function TT(n,e){if(n&1&&(y(0,"div",7),F(1,"ng-diagram-port",8),m()),n&2){let t=c();G("lf-port-anchor--endpoint",t.endpointHighlighted())("lf-port-anchor--node-selected",t.nodeSelected())("lf-port-anchor--pulse",t.pulse()),u(),M("id",t.portId())}}function MT(n,e){if(n&1&&(y(0,"div",9),F(1,"ng-diagram-port",10),m()),n&2){let t=c();G("lf-port-anchor--endpoint",t.endpointHighlighted())("lf-port-anchor--node-selected",t.nodeSelected())("lf-port-anchor--pulse",t.pulse()),u(),M("id",t.portId())}}function RT(n,e){if(n&1){let t=z();y(0,"div",6)(1,"lf-inline-field",11),R("valueChange",function(i){x(t);let r=c();return S(r.valueChange.emit(i))}),m()()}if(n&2){let t=c();u(),M("config",t.inline())("value",t.value())("previewValue",t.previewValue())("disabled",t.disabled())("fill",t.growFlex()>0)("expandable",t.expandable())("expandLabel",t.label())}}var NT=16,OT=n=>{if(n===null)return!1;let e=typeof n=="string"?n:n.type;return e==="preview"||e==="preview-markdown"||e==="preview-code"},fd=class n{constructor(){this.execution=f(we);this.side=T.required();this.nodeId=T.required();this.portId=T.required();this.runtimePortId=T.required();this.label=T.required();this.wireType=T.required();this.inline=T(null);this.value=T(void 0);this.previewValue=T(void 0);this.disabled=T(!1);this.expandable=T(!0);this.hidden=T(!1);this.nodeSelected=T(!1);this.endpointHighlighted=T(!1);this.valueChange=Ct();this.pulse=oe(Te([et(this.nodeId),et(this.runtimePortId),et(this.side)]).pipe(Me(([e,t,o])=>o==="out"?bn(this.execution.getEventsForPort(e,t)):bn(this.execution.getInputEventsForPort(e,t)))),{initialValue:!1});this.multilineLayout=b(()=>{let e=this.inline();return e===null?null:Cr(e)});this.previewInline=b(()=>OT(this.inline()));this.growFlex=b(()=>{let e=this.multilineLayout()?.flex??0;return e>0?e:this.previewInline()?1:0});this.multilineMinHeightPx=b(()=>this.previewInline()?NT:this.multilineLayout()?.minHeightPx)}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-node-port-row"]],hostAttrs:[1,"lf-port-row-host"],hostVars:8,hostBindings:function(t,o){t&2&&(Ze("--lf-inline-flex",o.growFlex())("--lf-multiline-min",o.multilineMinHeightPx(),"px"),G("lf-port-row-host--grow",o.growFlex()>0)("lf-port-row-host--preview",o.previewInline()))},inputs:{side:[1,"side"],nodeId:[1,"nodeId"],portId:[1,"portId"],runtimePortId:[1,"runtimePortId"],label:[1,"label"],wireType:[1,"wireType"],inline:[1,"inline"],value:[1,"value"],previewValue:[1,"previewValue"],disabled:[1,"disabled"],expandable:[1,"expandable"],hidden:[1,"hidden"],nodeSelected:[1,"nodeSelected"],endpointHighlighted:[1,"endpointHighlighted"]},outputs:{valueChange:"valueChange"},decls:10,vars:11,consts:[[1,"lf-port-row-wrapper"],[1,"lf-port-row"],[1,"lf-port-anchor","lf-port-anchor--in",3,"lf-port-anchor--endpoint","lf-port-anchor--node-selected","lf-port-anchor--pulse"],[1,"lf-port-row__content"],[1,"text-zinc-400","dark:text-zinc-500"],[1,"lf-port-anchor","lf-port-anchor--out",3,"lf-port-anchor--endpoint","lf-port-anchor--node-selected","lf-port-anchor--pulse"],[1,"lf-port-row__inline"],[1,"lf-port-anchor","lf-port-anchor--in"],["type","target","side","left","originPoint","centerLeft",3,"id"],[1,"lf-port-anchor","lf-port-anchor--out"],["type","source","side","right",3,"id"],[3,"valueChange","config","value","previewValue","disabled","fill","expandable","expandLabel"]],template:function(t,o){t&1&&(y(0,"div",0)(1,"div",1),P(2,TT,2,7,"div",2),y(3,"div",3)(4,"span"),w(5),m(),y(6,"span",4),w(7),m()(),P(8,MT,2,7,"div",5),m(),P(9,RT,2,7,"div",6),m()),t&2&&(G("lf-port-row-wrapper--node-selected",o.nodeSelected()),u(),G("lf-port-row--in",o.side()==="in")("lf-port-row--out",o.side()==="out"),u(),E(o.side()==="in"&&!o.hidden()?2:-1),u(3),ue(o.label()),u(2),H(" \xB7 ",o.wireType()," "),u(),E(o.side()==="out"?8:-1),u(),E(o.side()==="in"&&o.inline()!==null?9:-1))},dependencies:[wo,no],styles:['[_nghost-%COMP%]{display:block;box-sizing:border-box;width:100%}.lf-diagram-node[_nghost-%COMP%]{height:100%}.lf-diagram-node[_nghost-%COMP%] ng-diagram-node-resize-adornment{display:block;box-sizing:border-box;width:100%;height:100%}.lf-node-chrome[_ngcontent-%COMP%]{--lf-node-chrome-padding-x: 20px;position:relative;box-sizing:border-box;display:flex;width:100%;height:100%;min-width:0;min-height:0;flex-direction:column;padding-left:var(--lf-node-chrome-padding-x);padding-right:var(--lf-node-chrome-padding-x);border-color:#d4d4d8}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome[_ngcontent-%COMP%]{border-color:#3f3f46}.lf-node-content[_ngcontent-%COMP%]{display:flex;width:100%;min-width:0;min-height:0;flex:1 1 auto;flex-direction:column}.lf-node-title[_ngcontent-%COMP%]{flex:0 0 auto;min-height:1.25rem;line-height:1.25rem}.lf-port-row-host[_nghost-%COMP%]{display:flex;flex:0 0 auto;flex-direction:column}.lf-port-row-host--grow[_nghost-%COMP%]{flex:var(--lf-inline-flex, 1) 1 0;min-height:min-content;overflow:visible}.lf-port-row-host--grow[_nghost-%COMP%] .lf-port-row-wrapper[_ngcontent-%COMP%]{display:flex;flex:1 1 auto;flex-direction:column;min-height:min-content;overflow:visible}.lf-port-row-host--grow[_nghost-%COMP%] .lf-port-row__inline[_ngcontent-%COMP%]{display:flex;flex:1 1 0;flex-direction:column;min-height:min-content;overflow:hidden}.lf-port-row-host--grow[_nghost-%COMP%] .lf-port-row__inline[_ngcontent-%COMP%] lf-inline-field[_ngcontent-%COMP%]{flex:1 1 0;min-height:min-content;overflow:hidden}.lf-port-row-host--grow.lf-port-row-host--preview[_nghost-%COMP%], .lf-port-row-host--grow.lf-port-row-host--preview[_nghost-%COMP%] .lf-port-row-wrapper[_ngcontent-%COMP%], .lf-port-row-host--grow.lf-port-row-host--preview[_nghost-%COMP%] .lf-port-row__inline[_ngcontent-%COMP%], .lf-port-row-host--grow.lf-port-row-host--preview[_nghost-%COMP%] .lf-port-row__inline[_ngcontent-%COMP%] lf-inline-field[_ngcontent-%COMP%]{min-height:0}.lf-node-chrome--pending[_ngcontent-%COMP%]{border-color:#d97706}.lf-node-chrome--value[_ngcontent-%COMP%]{border-color:#10b981}.lf-node-chrome--error[_ngcontent-%COMP%]{border-color:#f43f5e;box-shadow:0 0 0 2px rgba(244 63 94,.25)}.lf-node-chrome--hitl[_ngcontent-%COMP%]{border-color:#0ea5e9;box-shadow:0 0 0 2px rgba(14 165 233,.4)}.lf-node-chrome--pulse[_ngcontent-%COMP%]{box-shadow:0 0 0 2px #10b98180;transition:box-shadow .15s ease-out}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome--pending[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome--pending[_ngcontent-%COMP%]{border-color:#ca8a04}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome--value[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome--value[_ngcontent-%COMP%]{border-color:#34d399}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome--error[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome--error[_ngcontent-%COMP%]{border-color:#fb7185;box-shadow:0 0 0 2px rgba(251 113 133,.25)}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome--hitl[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome--hitl[_ngcontent-%COMP%]{border-color:#38bdf8;box-shadow:0 0 0 2px rgba(56 189 248,.4)}.lf-node-chrome--selected[_ngcontent-%COMP%]{border-color:#3b82f6;box-shadow:0 0 0 2px #3b82f659}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome--selected[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome--selected[_ngcontent-%COMP%]{border-color:#60a5fa;box-shadow:0 0 0 2px #60a5fa59}.lf-node-chrome--hovered[_ngcontent-%COMP%]{border-color:#8b5cf6;box-shadow:0 0 0 2px #8b5cf64d}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome--hovered[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome--hovered[_ngcontent-%COMP%]{border-color:#a78bfa;box-shadow:0 0 0 2px #a78bfa4d}.lf-port-row[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center;min-height:1.5rem;padding-top:.125rem;padding-bottom:.125rem}.lf-port-row__inline[_ngcontent-%COMP%]{padding-bottom:.25rem;padding-left:.25rem}.lf-port-row__content[_ngcontent-%COMP%]{min-width:0;flex:1 1 auto;font-size:10px;line-height:1.2;color:#64748b}.lf-port-row--in[_ngcontent-%COMP%] .lf-port-row__content[_ngcontent-%COMP%]{padding-left:.25rem}.lf-port-row--out[_ngcontent-%COMP%] .lf-port-row__content[_ngcontent-%COMP%]{padding-right:.25rem;text-align:right}.lf-port-anchor[_ngcontent-%COMP%]{position:absolute;top:50%;transform:translateY(-50%)}.lf-port-anchor--in[_ngcontent-%COMP%]{left:calc(-1 * var(--lf-node-chrome-padding-x))}.lf-port-anchor--out[_ngcontent-%COMP%]{right:calc(-1 * var(--lf-node-chrome-padding-x))}[data-theme="dark"][_nghost-%COMP%] .lf-port-row__content[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-port-row__content[_ngcontent-%COMP%]{color:#94a3b8}.lf-port-dot[_ngcontent-%COMP%]{display:block;box-sizing:border-box;width:10px;height:10px;border:2px solid rgb(148 163 184);border-radius:9999px;background:#fff}[data-theme="dark"][_nghost-%COMP%] .lf-port-dot[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-port-dot[_ngcontent-%COMP%]{border-color:#64748b;background:#0f172a}.lf-node-label-input[_ngcontent-%COMP%]{width:calc(100% - .5rem);border-radius:.25rem;border:1px solid rgb(59 130 246);background:#fafafa;padding:.125rem .25rem;color:#18181b;outline:none}[data-theme="dark"][_nghost-%COMP%] .lf-node-label-input[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-label-input[_ngcontent-%COMP%]{border-color:#60a5fa;background:#09090b;color:#f4f4f5}[_nghost-%COMP%] .resize-handle, [_nghost-%COMP%] .resize-line{opacity:0;pointer-events:none}.lf-node-se-handle[_ngcontent-%COMP%]{position:absolute;right:0;bottom:0;z-index:2;box-sizing:border-box;width:1rem;height:1rem;overflow:hidden;border-bottom-right-radius:.75rem;cursor:nwse-resize;pointer-events:auto}.lf-node-se-handle__lines[_ngcontent-%COMP%]{display:block;position:absolute;right:0;bottom:0;width:.875rem;height:.875rem;background-image:repeating-linear-gradient(-45deg,transparent 0,transparent 2px,rgb(161 161 170) 2px,rgb(161 161 170) 3.25px);clip-path:polygon(100% 0,100% 100%,0 100%)}[data-theme="dark"][_nghost-%COMP%] .lf-node-se-handle__lines[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-se-handle__lines[_ngcontent-%COMP%]{background-image:repeating-linear-gradient(-45deg,transparent 0,transparent 2px,rgb(113 113 122) 2px,rgb(113 113 122) 3.25px)}.lf-port-anchor--node-selected[_ngcontent-%COMP%]{--ngd-port-border-color: rgb(147 197 253);--ngd-port-background-color: rgb(239 246 255)}.lf-port-anchor--endpoint[_ngcontent-%COMP%]{--ngd-port-border-color: rgb(37 99 235);--ngd-port-background-color: rgb(191 219 254)}[data-theme="dark"][_nghost-%COMP%] .lf-port-anchor--node-selected[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-port-anchor--node-selected[_ngcontent-%COMP%]{--ngd-port-border-color: rgb(96 165 250);--ngd-port-background-color: rgb(30 58 138)}[data-theme="dark"][_nghost-%COMP%] .lf-port-anchor--endpoint[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-port-anchor--endpoint[_ngcontent-%COMP%]{--ngd-port-border-color: rgb(147 197 253);--ngd-port-background-color: rgb(30 64 175)}']})}};var AT=["content"],Iv=(n,e)=>e.portId,LT=(n,e)=>e.handle;function FT(n,e){if(n&1){let t=z();y(0,"input",11,1),R("input",function(){x(t);let i=Le(1),r=c();return S(r.labelDraft.set(i.value))})("keydown",function(i){x(t);let r=c();return S(r.onLabelKeydown(i))})("blur",function(){x(t);let i=c();return S(i.onLabelBlur())}),m()}if(n&2){let t=c();M("value",t.labelDraft())}}function zT(n,e){if(n&1){let t=z();y(0,"span",12),R("dblclick",function(){x(t);let i=c();return S(i.startLabelEdit())}),w(1),m()}if(n&2){let t=c();u(),H(" ",t.label()," ")}}function $T(n,e){if(n&1){let t=z();y(0,"lf-node-port-row",13),R("valueChange",function(i){let r=x(t).$implicit,s=c();return S(s.onPortInlineChange(r.basePortId,i))}),m()}if(n&2){let t=e.$implicit,o=c();M("nodeId",o.node().id)("portId",t.portId)("runtimePortId",t.basePortId)("label",t.label)("wireType",t.wireType)("inline",t.inline)("value",t.value)("disabled",t.connected||o.isRunning())("expandable",!t.connected)("hidden",t.hidden)("previewValue",o.previewValueFor(t.basePortId))("nodeSelected",o.node().selected??!1)("endpointHighlighted",o.isEndpointHighlighted(t.portId))}}function BT(n,e){if(n&1&&F(0,"lf-node-bypass-port-row",7),n&2){let t=e.$implicit,o=c();M("nodeId",o.node().id)("runtimePortId",t.handle)("inputPortId",t.inputPortId)("outputPortId",t.outputPortId)("label",t.label)("wireType",t.wireType)("nodeSelected",o.node().selected??!1)("inputEndpointHighlighted",o.isEndpointHighlighted(t.inputPortId))("outputEndpointHighlighted",o.isEndpointHighlighted(t.outputPortId))}}function HT(n,e){if(n&1&&F(0,"lf-node-port-row",8),n&2){let t=e.$implicit,o=c();M("nodeId",o.node().id)("portId",t.portId)("runtimePortId",o.fromOutputPortId(t.portId))("label",t.label)("wireType",t.wireType)("nodeSelected",o.node().selected??!1)("endpointHighlighted",o.isEndpointHighlighted(t.portId))}}var kv=1,jh=160,Dv=72,UT=24,VT=n=>{let e=n.ui.label?.trim();return e!==void 0&&e.length>0?e:n.type},gd=class n{constructor(){this.bridge=f(ie);this.diagramModel=f(ln);this.nodeService=f(bo);this.selection=f(Co);this.viewport=f(wn);this.previewValues=f(od);this.contentMinSize=f(vi);this.injector=f(wt);this.destroyRef=f(je);this.hover=f(Cn);this.execution=f(we);this.canvasNodeStatus=f(nd);this.isRunning=this.execution.isRunning;this.node=T.required();this.content=Xe("content");this.nodeId$=et(this.node).pipe(I(e=>e.id));this.nodeStatusEvents$=this.nodeId$.pipe(I(e=>this.canvasNodeStatus.getNodeStatusEvents(e)),te(1));this.status$=this.nodeStatusEvents$.pipe(Me(e=>e.status$));this.pulse$=this.nodeStatusEvents$.pipe(Me(e=>e.pulse$));this.editingLabel=U(!1);this.labelDraft=U("");this.lastSyncedRowCount=void 0;this.heightSyncScheduled=!1;this.minSizePublishScheduled=!1;this.fromOutputPortId=So;this.label=b(()=>VT(this.node().data));this.connectedEdges=b(()=>{let e=this.node().id;return this.diagramModel.edges().filter(t=>t.source===e||t.target===e)});this.ports=b(()=>bi(this.node().data.portsConfig,this.node().id,this.connectedEdges(),this.node().data.inputs));this.inputPortRows=b(()=>this.ports().inputPorts);this.outputPortRows=b(()=>this.ports().outputPorts);this.bypassPortRows=b(()=>this.ports().bypassPorts);this.portRowCount=b(()=>this.inputPortRows().length+this.bypassPortRows().length+this.outputPortRows().length);this.selectedEndpointPortIds=b(()=>{let e=this.node().id,t=new Set;for(let o of this.selection.selection().edges)o.source===e&&o.sourcePort!==void 0&&t.add(o.sourcePort),o.target===e&&o.targetPort!==void 0&&t.add(o.targetPort);return t});this.destroyRef.onDestroy(()=>{this.seResizeCleanup?.(),this.contentMinSize.clear(this.node().id)}),xe(()=>{let e=this.node().data.ui.position.width,t=this.portRowCount();ye(()=>{if(this.scheduleMinSizePublish(),e===void 0){this.lastSyncedRowCount=void 0;return}if(this.lastSyncedRowCount===void 0){this.lastSyncedRowCount=t;return}this.lastSyncedRowCount!==t&&(this.lastSyncedRowCount=t,this.scheduleHeightSync())})})}onDocumentKeydown(e){e.key==="F2"&&(this.node().selected??!1)&&!this.editingLabel()&&(e.preventDefault(),this.startLabelEdit())}isEndpointHighlighted(e){return this.selectedEndpointPortIds().has(e)}previewValueFor(e){return this.previewValues.valueFor(this.node().id,e)}onPortInlineChange(e,t){this.execution.isRunning()||this.bridge.raw["editor.updateNode.requested"].next({nodeId:this.node().id,inputs:C(p({},this.node().data.inputs),{[e]:t})})}startLabelEdit(){this.execution.isRunning()||(this.labelDraft.set(this.node().data.ui.label??""),this.editingLabel.set(!0),Gt(()=>{let e=document.querySelector(`[data-node-id="${this.node().id}"] .lf-node-label-input`);e instanceof HTMLInputElement&&(e.focus(),e.select())},{injector:this.injector}))}onLabelKeydown(e){if(e.key==="Enter"){e.preventDefault(),this.commitLabelEdit();return}e.key==="Escape"&&(e.preventDefault(),this.cancelLabelEdit())}onLabelBlur(){this.editingLabel()&&this.cancelLabelEdit()}cancelLabelEdit(){this.editingLabel.set(!1)}commitLabelEdit(){if(!this.editingLabel()||this.execution.isRunning()){this.editingLabel.set(!1);return}let e=this.labelDraft().trim(),t=this.node().data.ui.label?.trim()??"";this.editingLabel.set(!1),e!==t&&this.bridge.raw["editor.updateNode.requested"].next({nodeId:this.node().id,ui:{label:e}})}onSeHandlePointerDown(e){if(e.button!==0)return;e.preventDefault(),e.stopPropagation();let t=this.node(),o=t.size??this.contentMinSize.minFor(t.id),i=this.contentMinSize.minFor(t.id),r=this.viewport.clientToFlowPosition({x:e.clientX,y:e.clientY}),s=e.currentTarget;if(!(s instanceof HTMLElement))return;s.setPointerCapture(e.pointerId),this.seResizeCleanup?.();let a=l=>{let h=this.viewport.clientToFlowPosition({x:l.clientX,y:l.clientY}),g=Sh(o,r,h,i);this.nodeService.resizeNode(t.id,g,void 0,!0)},d=l=>{this.seResizeCleanup?.(),this.seResizeCleanup=void 0,s.hasPointerCapture(l.pointerId)&&s.releasePointerCapture(l.pointerId);let h=this.viewport.clientToFlowPosition({x:l.clientX,y:l.clientY}),g=Sh(o,r,h,i);this.nodeService.resizeNode(t.id,g,void 0,!0),this.bridge.raw["editor.updateNode.requested"].next({nodeId:t.id,ui:{width:g.width,height:g.height}})};document.addEventListener("pointermove",a),document.addEventListener("pointerup",d),document.addEventListener("pointercancel",d),this.seResizeCleanup=()=>{document.removeEventListener("pointermove",a),document.removeEventListener("pointerup",d),document.removeEventListener("pointercancel",d)}}scheduleMinSizePublish(){this.minSizePublishScheduled||(this.minSizePublishScheduled=!0,Gt(()=>{requestAnimationFrame(()=>{this.minSizePublishScheduled=!1,this.publishContentMinSize()})},{injector:this.injector}))}publishContentMinSize(){let e=this.measureContentMinSize();this.contentMinSize.set(this.node().id,e),this.clampHeightToContentMin(e.height)}measureContentMinSize(){let e=this.content()?.nativeElement;return e===void 0?{width:jh,height:Dv}:{width:jh,height:jy(e,UT,Dv)}}clampHeightToContentMin(e){let t=this.node().data.ui.position.width;if(t===void 0)return;let o=this.node().size?.height;o===void 0||o+kv>=e||(this.nodeService.resizeNode(this.node().id,{width:t,height:e},void 0,!0),this.bridge.raw["editor.updateNode.requested"].next({nodeId:this.node().id,ui:{height:e}}))}scheduleHeightSync(){this.heightSyncScheduled||(this.heightSyncScheduled=!0,Gt(()=>{requestAnimationFrame(()=>{this.heightSyncScheduled=!1,this.syncHeightToContent()})},{injector:this.injector}))}syncHeightToContent(){let e=this.node().data.ui.position.width;if(e===void 0)return;let{height:t}=this.measureContentMinSize();this.contentMinSize.set(this.node().id,{width:jh,height:t});let o=this.node().size?.height;o!==void 0&&Math.abs(o-t)<kv||(this.nodeService.resizeNode(this.node().id,{width:e,height:t},void 0,!0),this.bridge.raw["editor.updateNode.requested"].next({nodeId:this.node().id,ui:{height:t}}))}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-node"]],viewQuery:function(t,o){t&1&&rt(o.content,AT,5),t&2&&st()},hostAttrs:[1,"lf-diagram-node"],hostBindings:function(t,o){t&1&&R("keydown",function(r){return o.onDocumentKeydown(r)},kt)},inputs:{node:[1,"node"]},decls:18,vars:20,consts:[["content",""],["labelInput",""],[1,"lf-node-chrome","rounded-xl","border","bg-white","py-3","shadow-sm","dark:bg-zinc-900",3,"mouseenter","mouseleave"],[1,"lf-node-content"],["data-no-drag","true","data-no-pan","true",1,"lf-node-title","lf-node-label-input","mx-1","text-xs","font-semibold",3,"value"],[1,"lf-node-title","truncate","px-1","text-xs","font-semibold","text-zinc-900","dark:text-zinc-100"],["side","in",3,"nodeId","portId","runtimePortId","label","wireType","inline","value","disabled","expandable","hidden","previewValue","nodeSelected","endpointHighlighted"],[3,"nodeId","runtimePortId","inputPortId","outputPortId","label","wireType","nodeSelected","inputEndpointHighlighted","outputEndpointHighlighted"],["side","out",3,"nodeId","portId","runtimePortId","label","wireType","nodeSelected","endpointHighlighted"],["data-no-drag","true","data-no-pan","true",1,"lf-node-se-handle",3,"pointerdown"],["aria-hidden","true",1,"lf-node-se-handle__lines"],["data-no-drag","true","data-no-pan","true",1,"lf-node-title","lf-node-label-input","mx-1","text-xs","font-semibold",3,"input","keydown","blur","value"],[1,"lf-node-title","truncate","px-1","text-xs","font-semibold","text-zinc-900","dark:text-zinc-100",3,"dblclick"],["side","in",3,"valueChange","nodeId","portId","runtimePortId","label","wireType","inline","value","disabled","expandable","hidden","previewValue","nodeSelected","endpointHighlighted"]],template:function(t,o){if(t&1&&(y(0,"ng-diagram-node-resize-adornment"),Hn(1),on(2,"async"),Hn(3),on(4,"async"),y(5,"div",2),R("mouseenter",function(){return o.hover.set(o.node().id)})("mouseleave",function(){return o.hover.clear()}),y(6,"div",3,0),P(8,FT,2,1,"input",4)(9,zT,2,1,"span",5),X(10,$T,1,13,"lf-node-port-row",6,Iv),X(12,BT,1,9,"lf-node-bypass-port-row",7,LT),X(14,HT,1,7,"lf-node-port-row",8,Iv),m(),y(16,"div",9),R("pointerdown",function(r){return o.onSeHandlePointerDown(r)}),F(17,"span",10),m()()()),t&2){let i=rn(2,16,o.status$),r=rn(4,18,o.pulse$);u(5),G("lf-node-chrome--selected",o.node().selected??!1)("lf-node-chrome--hovered",o.hover.isHovered(o.node().id))("lf-node-chrome--pending",i==="pending")("lf-node-chrome--value",i==="value")("lf-node-chrome--error",i==="error")("lf-node-chrome--hitl",i==="hitl")("lf-node-chrome--pulse",r===!0),K("data-node-id",o.node().id),u(3),E(o.editingLabel()?8:9),u(2),Q(o.inputPortRows()),u(2),Q(o.bypassPortRows()),u(2),Q(o.outputPortRows())}},dependencies:[fd,id,gi,sn],styles:['[_nghost-%COMP%]{display:block;box-sizing:border-box;width:100%}.lf-diagram-node[_nghost-%COMP%]{height:100%}.lf-diagram-node[_nghost-%COMP%] ng-diagram-node-resize-adornment{display:block;box-sizing:border-box;width:100%;height:100%}.lf-node-chrome[_ngcontent-%COMP%]{--lf-node-chrome-padding-x: 20px;position:relative;box-sizing:border-box;display:flex;width:100%;height:100%;min-width:0;min-height:0;flex-direction:column;padding-left:var(--lf-node-chrome-padding-x);padding-right:var(--lf-node-chrome-padding-x);border-color:#d4d4d8}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome[_ngcontent-%COMP%]{border-color:#3f3f46}.lf-node-content[_ngcontent-%COMP%]{display:flex;width:100%;min-width:0;min-height:0;flex:1 1 auto;flex-direction:column}.lf-node-title[_ngcontent-%COMP%]{flex:0 0 auto;min-height:1.25rem;line-height:1.25rem}.lf-port-row-host[_nghost-%COMP%]{display:flex;flex:0 0 auto;flex-direction:column}.lf-port-row-host--grow[_nghost-%COMP%]{flex:var(--lf-inline-flex, 1) 1 0;min-height:min-content;overflow:visible}.lf-port-row-host--grow[_nghost-%COMP%] .lf-port-row-wrapper[_ngcontent-%COMP%]{display:flex;flex:1 1 auto;flex-direction:column;min-height:min-content;overflow:visible}.lf-port-row-host--grow[_nghost-%COMP%] .lf-port-row__inline[_ngcontent-%COMP%]{display:flex;flex:1 1 0;flex-direction:column;min-height:min-content;overflow:hidden}.lf-port-row-host--grow[_nghost-%COMP%] .lf-port-row__inline[_ngcontent-%COMP%] lf-inline-field[_ngcontent-%COMP%]{flex:1 1 0;min-height:min-content;overflow:hidden}.lf-port-row-host--grow.lf-port-row-host--preview[_nghost-%COMP%], .lf-port-row-host--grow.lf-port-row-host--preview[_nghost-%COMP%] .lf-port-row-wrapper[_ngcontent-%COMP%], .lf-port-row-host--grow.lf-port-row-host--preview[_nghost-%COMP%] .lf-port-row__inline[_ngcontent-%COMP%], .lf-port-row-host--grow.lf-port-row-host--preview[_nghost-%COMP%] .lf-port-row__inline[_ngcontent-%COMP%] lf-inline-field[_ngcontent-%COMP%]{min-height:0}.lf-node-chrome--pending[_ngcontent-%COMP%]{border-color:#d97706}.lf-node-chrome--value[_ngcontent-%COMP%]{border-color:#10b981}.lf-node-chrome--error[_ngcontent-%COMP%]{border-color:#f43f5e;box-shadow:0 0 0 2px rgba(244 63 94,.25)}.lf-node-chrome--hitl[_ngcontent-%COMP%]{border-color:#0ea5e9;box-shadow:0 0 0 2px rgba(14 165 233,.4)}.lf-node-chrome--pulse[_ngcontent-%COMP%]{box-shadow:0 0 0 2px #10b98180;transition:box-shadow .15s ease-out}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome--pending[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome--pending[_ngcontent-%COMP%]{border-color:#ca8a04}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome--value[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome--value[_ngcontent-%COMP%]{border-color:#34d399}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome--error[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome--error[_ngcontent-%COMP%]{border-color:#fb7185;box-shadow:0 0 0 2px rgba(251 113 133,.25)}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome--hitl[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome--hitl[_ngcontent-%COMP%]{border-color:#38bdf8;box-shadow:0 0 0 2px rgba(56 189 248,.4)}.lf-node-chrome--selected[_ngcontent-%COMP%]{border-color:#3b82f6;box-shadow:0 0 0 2px #3b82f659}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome--selected[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome--selected[_ngcontent-%COMP%]{border-color:#60a5fa;box-shadow:0 0 0 2px #60a5fa59}.lf-node-chrome--hovered[_ngcontent-%COMP%]{border-color:#8b5cf6;box-shadow:0 0 0 2px #8b5cf64d}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome--hovered[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome--hovered[_ngcontent-%COMP%]{border-color:#a78bfa;box-shadow:0 0 0 2px #a78bfa4d}.lf-port-row[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center;min-height:1.5rem;padding-top:.125rem;padding-bottom:.125rem}.lf-port-row__inline[_ngcontent-%COMP%]{padding-bottom:.25rem;padding-left:.25rem}.lf-port-row__content[_ngcontent-%COMP%]{min-width:0;flex:1 1 auto;font-size:10px;line-height:1.2;color:#64748b}.lf-port-row--in[_ngcontent-%COMP%] .lf-port-row__content[_ngcontent-%COMP%]{padding-left:.25rem}.lf-port-row--out[_ngcontent-%COMP%] .lf-port-row__content[_ngcontent-%COMP%]{padding-right:.25rem;text-align:right}.lf-port-anchor[_ngcontent-%COMP%]{position:absolute;top:50%;transform:translateY(-50%)}.lf-port-anchor--in[_ngcontent-%COMP%]{left:calc(-1 * var(--lf-node-chrome-padding-x))}.lf-port-anchor--out[_ngcontent-%COMP%]{right:calc(-1 * var(--lf-node-chrome-padding-x))}[data-theme="dark"][_nghost-%COMP%] .lf-port-row__content[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-port-row__content[_ngcontent-%COMP%]{color:#94a3b8}.lf-port-dot[_ngcontent-%COMP%]{display:block;box-sizing:border-box;width:10px;height:10px;border:2px solid rgb(148 163 184);border-radius:9999px;background:#fff}[data-theme="dark"][_nghost-%COMP%] .lf-port-dot[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-port-dot[_ngcontent-%COMP%]{border-color:#64748b;background:#0f172a}.lf-node-label-input[_ngcontent-%COMP%]{width:calc(100% - .5rem);border-radius:.25rem;border:1px solid rgb(59 130 246);background:#fafafa;padding:.125rem .25rem;color:#18181b;outline:none}[data-theme="dark"][_nghost-%COMP%] .lf-node-label-input[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-label-input[_ngcontent-%COMP%]{border-color:#60a5fa;background:#09090b;color:#f4f4f5}[_nghost-%COMP%] .resize-handle, [_nghost-%COMP%] .resize-line{opacity:0;pointer-events:none}.lf-node-se-handle[_ngcontent-%COMP%]{position:absolute;right:0;bottom:0;z-index:2;box-sizing:border-box;width:1rem;height:1rem;overflow:hidden;border-bottom-right-radius:.75rem;cursor:nwse-resize;pointer-events:auto}.lf-node-se-handle__lines[_ngcontent-%COMP%]{display:block;position:absolute;right:0;bottom:0;width:.875rem;height:.875rem;background-image:repeating-linear-gradient(-45deg,transparent 0,transparent 2px,rgb(161 161 170) 2px,rgb(161 161 170) 3.25px);clip-path:polygon(100% 0,100% 100%,0 100%)}[data-theme="dark"][_nghost-%COMP%] .lf-node-se-handle__lines[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-se-handle__lines[_ngcontent-%COMP%]{background-image:repeating-linear-gradient(-45deg,transparent 0,transparent 2px,rgb(113 113 122) 2px,rgb(113 113 122) 3.25px)}.lf-port-anchor--node-selected[_ngcontent-%COMP%]{--ngd-port-border-color: rgb(147 197 253);--ngd-port-background-color: rgb(239 246 255)}.lf-port-anchor--endpoint[_ngcontent-%COMP%]{--ngd-port-border-color: rgb(37 99 235);--ngd-port-background-color: rgb(191 219 254)}[data-theme="dark"][_nghost-%COMP%] .lf-port-anchor--node-selected[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-port-anchor--node-selected[_ngcontent-%COMP%]{--ngd-port-border-color: rgb(96 165 250);--ngd-port-background-color: rgb(30 58 138)}[data-theme="dark"][_nghost-%COMP%] .lf-port-anchor--endpoint[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-port-anchor--endpoint[_ngcontent-%COMP%]{--ngd-port-border-color: rgb(147 197 253);--ngd-port-background-color: rgb(30 64 175)}']})}};function jT(n,e){if(n&1){let t=z();y(0,"ng-diagram",3),R("diagramInit",function(){x(t);let i=c();return S(i.handlers.handleDiagramInit())})("nodeDragEnded",function(i){x(t);let r=c();return S(r.handlers.handleNodeDragEnded(i))})("nodeResizeEnded",function(i){x(t);let r=c();return S(r.handlers.handleNodeResizeEnded(i))})("edgeDrawEnded",function(i){x(t);let r=c();return S(r.handlers.handleEdgeDrawEnded(i))})("clipboardPasted",function(i){x(t);let r=c();return S(r.handlers.handleClipboardPasted(i))})("selectionRemoved",function(i){x(t);let r=c();return S(r.handlers.handleSelectionRemoved(i))})("selectionChanged",function(i){x(t);let r=c();return S(r.handlers.handleSelectionChanged(i))}),F(1,"ng-diagram-background",4)(2,"ng-diagram-minimap"),m()}if(n&2){let t=c();M("model",e)("config",t.config)("nodeTemplateMap",t.nodeTemplateMap)("edgeTemplateMap",t.edgeTemplateMap)}}function WT(n,e){n&1&&(y(0,"div",2),w(1," Waiting for workflow\u2026 "),m())}var GT=n=>{if(n.edge===void 0)return null;let e=n.sourcePort??n.edge.sourcePort,t=n.targetPort??n.edge.targetPort;if(e===void 0||t===void 0)return null;let o=Qn(So(e)),i=Qn(mi(t));return{fromNodeId:n.edge.source,fromPort:[o.basePortId,o.slotIndex],toNodeId:n.edge.target,toPort:[i.basePortId,i.slotIndex]}},qT=n=>{let e=n.nodes.map(i=>{let r=i.data,s=i.size?.width??r.ui.position.width,a=i.size?.height??r.ui.position.height;return p({clientId:i.id,type:r.type,position:p(p({x:i.position.x,y:i.position.y},s!==void 0?{width:s}:{}),a!==void 0?{height:a}:{}),params:r.params,inputs:r.inputs},r.ui.label!==void 0?{label:r.ui.label}:{})}),t=new Set(e.map(i=>i.clientId)),o=n.edges.flatMap(i=>{if(!t.has(i.source)||!t.has(i.target)||i.sourcePort===void 0||i.targetPort===void 0)return[];let r=Qn(So(i.sourcePort)),s=Qn(mi(i.targetPort));return[{fromClientId:i.source,fromPort:[r.basePortId,r.slotIndex],toClientId:i.target,toPort:[s.basePortId,s.slotIndex]}]});return{nodes:e,edges:o}},md=class n{constructor(){this.graphInput=T.required();this.palette=T.required();this.destroyRef=f(je);this.elementRef=f(He);this.injector=f(wt);this.bridge=f(ie);this.execution=f(we);this.viewportService=f(wn);this.viewport$=et(this.viewportService.viewport);this.diagramModel=f(ln);this.diagramService=f(At);this.nodeService=f(bo);this.selectionService=f(Co);this.contentMinSize=f(vi);this.lastConfirmedSelectedNodeId=void 0;this.config={zoom:{max:2,zoomToFit:{padding:100}},snapping:{shouldSnapDragForNode:()=>!0,computeSnapForNodeDrag:()=>({width:20,height:20}),defaultDragSnap:{width:20,height:20}},resize:{getMinNodeSize:e=>this.contentMinSize.minFor(e.id)}};this.nodeTemplateMap=new fi([["lf-node",gd]]);this.edgeTemplateMap=new hi([["lf-edge",Qa]]);this.modelAdapter=b(()=>{let e=this.graphInput(),t=ye(()=>this.palette());return this.seedModel!==void 0?this.seedModel:(this.seedModel=ay({nodes:e.nodes.map(o=>Ka(o,Dt(t.nodes))),edges:e.edges.map(yh),metadata:{viewport:e.viewport}},this.injector),this.seedModel)});this.hostHandlers={handleDragOver:e=>{if(!this.isPaletteDrag(e))return;let t=e.dataTransfer;t!==null&&(e.preventDefault(),t.dropEffect=this.execution.isRunning()?"none":"copy")},handleDrop:e=>{if(this.execution.isRunning()){e.preventDefault();return}let t=e.dataTransfer?.getData(Or);if(t===void 0||t.length===0)return;e.preventDefault(),e.stopPropagation();let o=this.viewportService.clientToFlowPosition({x:e.clientX-12,y:e.clientY-12});this.bridge.raw["editor.addNode.requested"].next({type:t,position:py(t,o,Dt(this.palette().nodes))})}};this.handlers={handleDiagramInit:()=>{let e=Iy(this.diagramService);this.diagramService.registerRouting(Ey(e,(o,i)=>this.diagramModel.edges().some(r=>r.source===i&&r.target===o)));let t=this.diagramModel.edges().filter(o=>o.routingMode==="manual").map(o=>({id:o.id,routingMode:"auto"}));t.length>0&&this.diagramModel.updateEdges(t)},handleNodeDragEnded:e=>{for(let t of e.nodes)this.bridge.raw["editor.updateNode.requested"].next({nodeId:t.id,position:{x:t.position.x,y:t.position.y}})},handleNodeResizeEnded:e=>{let t=e.node.size;if(t===void 0)return;let o=this.contentMinSize.minFor(e.node.id),i=Math.max(t.width,o.width),r=Math.max(t.height,o.height);(i!==t.width||r!==t.height)&&this.nodeService.resizeNode(e.node.id,{width:i,height:r},void 0,!0),this.bridge.raw["editor.updateNode.requested"].next({nodeId:e.node.id,ui:{width:i,height:r}})},handleEdgeDrawEnded:e=>{if(!e.success||e.edge===void 0)return;this.diagramModel.deleteEdges([e.edge.id]);let t=GT(e);t!==null&&this.bridge.raw["editor.addEdge.requested"].next(t)},handleClipboardPasted:e=>{if(e.nodes.length===0)return;let t=e.edges.map(i=>i.id),o=e.nodes.map(i=>i.id);t.length>0&&this.diagramModel.deleteEdges(t),this.diagramModel.deleteNodes(o),this.bridge.raw["editor.paste.requested"].next(qT(e))},handleSelectionRemoved:e=>{let t=new Set(e.deletedNodes.map(o=>o.id));for(let o of e.deletedEdges)t.has(o.source)||t.has(o.target)||this.bridge.raw["editor.removeEdge.requested"].next(o.id);for(let o of e.deletedNodes)this.bridge.raw["editor.removeNode.requested"].next(o.id)},handleSelectionChanged:e=>{let t=e.selectedNodes[0]?.id??null;t!==this.lastConfirmedSelectedNodeId&&this.bridge.raw["editor.selectNode.requested"].next({nodeId:t})}};let e=!1,t;this.viewport$.pipe(ht(this.destroyRef),fs(300),$n(qa),se(i=>{let r=this.graphInput();t===void 0&&(t=r);let s=cy(i,t.viewport,e);return e=s.hydrateConsumed,s.publish})).subscribe(i=>{this.bridge.raw["editor.viewport.requested"].next(i)}),et(this.palette).pipe(Vi(1),ht(this.destroyRef)).subscribe(i=>{this.applyPalettePortsToLiveNodes(i)});let o=(i,r)=>this.bridge.raw[i].pipe(ht()).subscribe(r);o("editor.addEdges",i=>{this.diagramModel.addEdges(i.map(yh))}),o("editor.viewport.delta",i=>{if(!i)return;let{x:r,y:s,scale:a}=i,d=this.viewportService.viewport();r===d.x&&s===d.y&&a===d.scale||this.viewportService.setViewport(r,s,a)}),o("editor.deleteEdges",i=>{this.diagramModel.deleteEdges(i.map(r=>r.edgeId))}),o("editor.deleteNodes",i=>{this.diagramModel.deleteNodes(i.map(r=>r.id))}),o("editor.addNodes",i=>{let r=i.map(s=>Ka(s,Dt(this.palette().nodes)));this.diagramModel.addNodes(r)}),o("editor.updateNodes",i=>{let r=i.map(s=>Ka(s,Dt(this.palette().nodes)));this.diagramModel.updateNodes(r)}),this.bridge.cached["session.state.snapshot"].pipe(ht()).subscribe(i=>{this.applyConfirmedSelection(i.selectedNode?.id??null)}),o("editor.nodeSelected",i=>{this.applyConfirmedSelection(i.node?.id??null)})}ngAfterViewInit(){let e=this.elementRef.nativeElement,t={capture:!0},o=r=>{this.isPaletteDrag(r)&&(r.stopImmediatePropagation(),this.hostHandlers.handleDragOver(r))},i=r=>{this.isPaletteDrag(r)&&(r.stopImmediatePropagation(),this.hostHandlers.handleDrop(r))};e.addEventListener("dragover",o,t),e.addEventListener("drop",i,t),this.destroyRef.onDestroy(()=>{e.removeEventListener("dragover",o,t),e.removeEventListener("drop",i,t)}),et(this.graphInput,{injector:this.injector}).pipe(Vi(1),ht(this.destroyRef)).subscribe(()=>{let r=this.lastConfirmedSelectedNodeId;r!==void 0&&Gt(()=>{this.applyConfirmedSelection(r)},{injector:this.injector})})}applyPalettePortsToLiveNodes(e){let t=Dt(e.nodes),o=this.diagramModel.nodes().map(i=>{let r=i,s=mh(r.data.type,t);return r.data.portsConfig===s?null:C(p({},r),{data:C(p({},r.data),{portsConfig:s})})}).filter(i=>i!==null);o.length>0&&this.diagramModel.updateNodes(o)}applyConfirmedSelection(e){if(this.lastConfirmedSelectedNodeId=e,(this.selectionService.selection().nodes[0]?.id??null)!==e){if(e===null){this.selectionService.deselectAll();return}this.selectionService.select([e])}}isPaletteDrag(e){return e.dataTransfer?.types.includes(Or)===!0}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-flow-canvas"]],inputs:{graphInput:[1,"graphInput"],palette:[1,"palette"]},features:[Go([dy()])],decls:3,vars:1,consts:[[1,"relative","h-full","w-full",3,"dragover","drop"],[1,"block","h-full","w-full",2,"background","transparent",3,"model","config","nodeTemplateMap","edgeTemplateMap"],[1,"flex","h-full","items-center","justify-center","text-sm","text-zinc-500","dark:text-zinc-400"],[1,"block","h-full","w-full",2,"background","transparent",3,"diagramInit","nodeDragEnded","nodeResizeEnded","edgeDrawEnded","clipboardPasted","selectionRemoved","selectionChanged","model","config","nodeTemplateMap","edgeTemplateMap"],["type","dots"]],template:function(t,o){if(t&1&&(y(0,"div",0),R("dragover",function(r){return o.hostHandlers.handleDragOver(r)})("drop",function(r){return o.hostHandlers.handleDrop(r)}),P(1,jT,3,4,"ng-diagram",1)(2,WT,2,0,"div",2),m()),t&2){let i;u(),E((i=o.modelAdapter())?1:2,i)}},dependencies:[Rr,Pa,Ha],encapsulation:2})}};var KT=n=>[n];function YT(n,e){if(n&1&&F(0,"lf-flow-canvas",0),n&2){let t=c(),o=c();M("graphInput",t.graph)("palette",o.palette)}}function ZT(n,e){n&1&&X(0,YT,1,2,"lf-flow-canvas",0,ao),n&2&&Q(In(0,KT,e.workflowId))}function XT(n,e){if(n&1&&P(0,ZT,2,2),n&2){let t;E((t=e.workflow.activeWorkflow)?0:-1,t)}}var yd=class n{constructor(){this.bridge=f(ie);this.snapshot$=this.bridge.cached["workflow.current.snapshot"];this.palette$=Te([this.bridge.cached["palette.snapshot"],this.bridge.cached["customPalette.snapshot"]]).pipe(I(([e,t])=>go(e,t)));this.workflowAndPalette$=Te({workflow:this.snapshot$,palette:this.palette$})}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-canvas-container"]],decls:2,vars:3,consts:[[3,"graphInput","palette"]],template:function(t,o){if(t&1&&(P(0,XT,1,1),on(1,"async")),t&2){let i;E((i=rn(1,1,o.workflowAndPalette$))?0:-1,i)}},dependencies:[md,sn],encapsulation:2})}};var Tv=(n,e)=>{if(n.trim().length>0)return!0;for(let t of e.values())if(t.length>0)return!0;return!1},Mv=(n,e,t)=>n.allowMultiple?e.includes(t)?e.filter(o=>o!==t):[...e,t]:e.length===1&&e[0]===t?[]:[t],Rv=n=>{let e=n.freeform.trim();if(n.questions.length===0)return e;let t=n.questions.map((o,i)=>{let r=[`Q${i+1}. ${o.prompt}`];if(o.options.length===0)return r.join(`
|
|
307
|
+
`);let a=(n.selections.get(o.id)??[]).flatMap(d=>{let l=o.options.find(h=>h.id===d);return l===void 0?[]:[l.label]});return r.push(`Selected: ${a.length>0?a.join("; "):"(none)"}`),r.join(`
|
|
308
|
+
`)});return e.length>0&&t.push(`Freeform:
|
|
309
|
+
${e}`),t.join(`
|
|
310
|
+
`)};var Nv=(n,e)=>e.id;function QT(n,e){if(n&1&&(O(0,"p",0),w(1),N()),n&2){let t=c();u(),H(" ",t.headline()," ")}}function JT(n,e){if(n&1){let t=z();O(0,"button",6),ge("click",function(){let i=x(t).$implicit,r=c(2).$implicit,s=c();return S(s.onToggle(r,i.id))}),w(1),N()}if(n&2){let t=e.$implicit,o=c(2).$implicit,i=c();G("border-zinc-900",i.isSelected(o.id,t.id))("bg-zinc-900",i.isSelected(o.id,t.id))("text-white",i.isSelected(o.id,t.id))("dark:border-zinc-100",i.isSelected(o.id,t.id))("dark:bg-zinc-100",i.isSelected(o.id,t.id))("dark:text-zinc-900",i.isSelected(o.id,t.id))("border-zinc-200",!i.isSelected(o.id,t.id))("text-zinc-700",!i.isSelected(o.id,t.id))("hover:bg-zinc-100",!i.isSelected(o.id,t.id))("dark:border-zinc-700",!i.isSelected(o.id,t.id))("dark:text-zinc-200",!i.isSelected(o.id,t.id))("dark:hover:bg-zinc-800",!i.isSelected(o.id,t.id)),K("aria-pressed",i.isSelected(o.id,t.id)),u(),H(" ",t.label," ")}}function eM(n,e){if(n&1&&(O(0,"div",4),X(1,JT,2,26,"button",5,Nv),N()),n&2){let t=c().$implicit;K("aria-label",t.prompt),u(),Q(t.options)}}function tM(n,e){if(n&1&&(O(0,"li",2)(1,"p",3),w(2),N(),P(3,eM,3,1,"div",4),N()),n&2){let t=e.$implicit,o=e.$index;u(2),Wo(" ",o+1,". ",t.prompt," "),u(),E(t.options.length>0?3:-1)}}var vd=class n{constructor(){this.askId=T.required();this.headline=T("");this.questions=T.required();this.selectionsChange=Ct();this.selectedByQuestion=U(new Map);xe(()=>{this.askId(),ye(()=>{let e=new Map;this.selectedByQuestion.set(e),this.selectionsChange.emit(e)})})}isSelected(e,t){return this.selectedByQuestion().get(e)?.includes(t)===!0}onToggle(e,t){let o=this.selectedByQuestion().get(e.id)??[],i=Mv(e,o,t),r=new Map(this.selectedByQuestion());i.length===0?r.delete(e.id):r.set(e.id,i),this.selectedByQuestion.set(r),this.selectionsChange.emit(r)}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-ask-user-questions"]],inputs:{askId:[1,"askId"],headline:[1,"headline"],questions:[1,"questions"]},outputs:{selectionsChange:"selectionsChange"},decls:4,vars:1,consts:[[1,"text-sm","leading-5","text-zinc-800","dark:text-zinc-100"],[1,"flex","flex-col","gap-3"],[1,"flex","min-w-0","flex-col","gap-1.5"],[1,"text-xs","font-medium","leading-4","text-zinc-700","dark:text-zinc-200"],["role","group",1,"flex","min-w-0","flex-wrap","gap-1.5"],["type","button",1,"lf-composer-pill","max-w-full","min-h-[var(--lf-control-h)]","h-auto","whitespace-normal","py-1","text-left",3,"border-zinc-900","bg-zinc-900","text-white","dark:border-zinc-100","dark:bg-zinc-100","dark:text-zinc-900","border-zinc-200","text-zinc-700","hover:bg-zinc-100","dark:border-zinc-700","dark:text-zinc-200","dark:hover:bg-zinc-800"],["type","button",1,"lf-composer-pill","max-w-full","min-h-[var(--lf-control-h)]","h-auto","whitespace-normal","py-1","text-left",3,"click"]],template:function(t,o){t&1&&(P(0,QT,2,1,"p",0),O(1,"ol",1),X(2,tM,4,3,"li",2,Nv),N()),t&2&&(E(o.headline().trim().length>0?0:-1),u(2),Q(o.questions()))},encapsulation:2})}};var Ov=(n,e,t=1e4)=>n!==void 0&&e-n>=t;var wd={drafts:new Map,chatStartPending:!1},Av=(n,e)=>{if(e.type==="runnerSettled")return{drafts:new Map,chatStartPending:!1};if(e.type==="runStarted")return n.chatStartPending?C(p({},n),{chatStartPending:!1}):n;if(e.type==="chatStartPending")return C(p({},n),{chatStartPending:!0});if(e.type==="setDraft"){let o=new Map(n.drafts);return o.set(e.key,e.value),C(p({},n),{drafts:o})}if(e.type==="clearPrefix"){let o=new Map;for(let[i,r]of n.drafts)i.startsWith(e.prefix)||o.set(i,r);return C(p({},n),{drafts:o})}let t=new Map(n.drafts);return t.delete(e.key),C(p({},n),{drafts:t})};var Lv=n=>{let e=n[n.length-1];return e?.meta.presentation==="recovery"?e:void 0};var Fv=n=>"visitBoundary"in n&&n.visitBoundary==="close",zv=n=>"closesPreviousVisit"in n&&n.closesPreviousVisit===!0;var Gh=n=>!Array.isArray(n)||n.length===0?!1:n.every(e=>e===!1||typeof e=="string"||e instanceof Error||Gh(e)||typeof e=="object"&&e!==null&&!Array.isArray(e)&&Object.keys(e).length===0),$v=n=>{if(!Array.isArray(n))return n;let e=n.filter(Boolean).map($v);return e.length===0?n:e.length===1?e[0]:e},Wh=n=>typeof n=="string"?n:n instanceof Error?n.message.length>0?n.message:String(n):typeof n=="object"&&n!==null&&!Array.isArray(n)&&Object.keys(n).length===0?"Error":String(n),Bv=n=>{let e=$v(n);return Array.isArray(e)?e.map(t=>Gh(t)?Bv(t):Wh(t)).filter(t=>t.length>0).join(`
|
|
311
|
+
`):Wh(e)},Zt=n=>{if(typeof n=="string")return n;if(n==null)return String(n);if(n instanceof Error)return Wh(n);if(Gh(n))return Bv(n);if(typeof n=="object")try{return JSON.stringify(n,null,2)}catch(e){return String(n)}return String(n)};var Hv=n=>{if(typeof n!="string"||!n.startsWith("\u2192 "))return;let e=n.slice(2),t=e.indexOf("(");if(t<=0)return;let o=e.slice(0,t).trim();if(o.length===0)return;let i=e.slice(t+1),r=i.endsWith(")")?i.slice(0,-1):i;return{name:o,args:r}},Uv=n=>{if(typeof n!="string"||!n.startsWith("\u2190 "))return;let e=n.slice(2),t=e.indexOf(": ");if(t<=0)return;let o=e.slice(0,t).trim();if(o.length!==0)return{name:o,result:e.slice(t+2)}},qh=n=>!(n===null||typeof n!="object"||Array.isArray(n)||!("name"in n)||!("args"in n)||typeof n.name!="string"||typeof n.args!="string"||"result"in n&&n.result!==void 0&&typeof n.result!="string"),bd=n=>qh(n)&&!("result"in n);var Kh=n=>{if("interactionId"in n&&(n.presentation==="tool-request"||n.presentation==="tool-response"))return n.interactionId},nM=n=>n==="reasoning"||n==="progress"||n==="draft"||n==="shell",Gr=n=>({source:n.source,runId:n.runId,state:n.state,value:n.value,meta:n.meta,seq:n.seq}),oM=(n,e)=>{if(typeof e=="string"){if(typeof n=="string")return n+e;let i=Zt(n);return i.length>0?i+e:e}let t=Zt(e);if(t.length===0)return n;let o=typeof n=="string"?n:Zt(n);return o.length>0?`${o}
|
|
312
|
+
${t}`:t},iM=(n,e)=>{let t=Zt(n),o=Zt(e);return t.length===0?o:o.length===0?t:`${t}
|
|
313
|
+
${o}`},rM=(n,e)=>{for(let t=n.length-1;t>=0;t-=1)if(Kh(n[t].meta)===e)return t;return-1},Vv=(n,e)=>{let t=Kh(e.meta);if(t!==void 0){let i=rM(n,t);if(i===-1)return[...n,Gr(e)];let r=n[i],s=C(p({},r),{state:e.state,meta:e.meta,value:iM(r.value,e.value)});return n.map((a,d)=>d===i?s:a)}let o=e.meta.presentation;if(o==="tool"){let i=Hv(e.value);if(i!==void 0)return[...n,C(p({},Gr(e)),{value:{name:i.name,args:i.args}})];let r=Uv(e.value);if(r!==void 0){let s=n[n.length-1];if(s!==void 0&&bd(s.value))return[...n.slice(0,-1),C(p({},s),{state:e.state,value:{name:s.value.name,args:s.value.args,result:r.result}})]}return[...n,Gr(e)]}if(nM(o)){let i=n[n.length-1];return i!==void 0&&i.meta.presentation===o&&Kh(i.meta)===void 0?[...n.slice(0,-1),C(p({},i),{state:e.state,meta:e.meta,value:oM(i.value,e.value)})]:[...n,Gr(e)]}return[...n,Gr(e)]};var Cd=()=>({visits:[],openVisits:new Map,portsByVisit:new Map,itemsByPort:new Map,nextSeq:0}),qr=n=>n,jv=(n,e)=>`${n}:${e}`,Yh=(n,e)=>{let t=n.nextSeq,o=C(p({},e),{seq:t}),i=jv(e.runId,e.nodeId),r=n.openVisits.get(i),s=n.visits[n.visits.length-1],a=Fv(e.meta),d=zv(e.meta)&&s!==void 0&&s.nodeId!==e.nodeId&&s.runId===e.runId&&!s.isClosed,l=d?n.visits.map(($e,zt)=>zt===n.visits.length-1?C(p({},$e),{isClosed:!0}):$e):n.visits,g=r!==void 0||s?.runId===e.runId&&s?.nodeId===e.nodeId?r??s:{runId:e.runId,nodeId:e.nodeId,visitId:`${e.runId}:${e.nodeId}:${t}`,isClosed:!1},_=C(p({},g),{isClosed:a}),D=new Map(n.openVisits);d&&s!==void 0&&D.delete(jv(s.runId,s.nodeId)),a?D.delete(i):D.set(i,_);let L=l.findIndex($e=>$e.visitId===_.visitId),q=L===-1?[...l,_]:l.map(($e,zt)=>zt===L?_:$e),Y=n.portsByVisit.get(_.visitId)??[],J=Y[Y.length-1],fe=J?.portId===e.portId?J:{segmentId:`${_.visitId}:${t}`,portId:e.portId},Ae=fe===J?n.portsByVisit:new Map(n.portsByVisit).set(_.visitId,[...Y,fe]),me=qr(fe.segmentId),ze=n.itemsByPort.get(me)??[],Ee=new Map(n.itemsByPort);return Ee.set(me,Vv(ze,o)),{visits:q,openVisits:D,portsByVisit:Ae,itemsByPort:Ee,nextSeq:t+1}},Wv=n=>n.reduce(Yh,Cd());var Zh=(n,e)=>{let t=n.portsByVisit.get(e)??[],o=!1,i,r=[];for(let s of t){let a=n.itemsByPort.get(qr(s.segmentId))??[];r.push(...a);for(let d of a)d.meta.presentation==="result"&&(o=!0),d.meta.presentation==="draft"&&(i=s.segmentId)}return{hasResult:o,lastDraftSegmentId:i,pinnedRecovery:Lv(r)}},Gv=n=>n.pipe(I(e=>e.visits.map(t=>{let{hasResult:o,lastDraftSegmentId:i}=Zh(e,t.visitId);return{runId:t.runId,nodeId:t.nodeId,visitId:t.visitId,isClosed:t.isClosed,hasResult:o,lastDraftSegmentId:i,pinnedRecovery:n.pipe(I(r=>Zh(r,t.visitId).pinnedRecovery),$n((r,s)=>r?.seq===s?.seq)),foldedEventsFromPorts:n.pipe(I(r=>(r.portsByVisit.get(t.visitId)??[]).map(s=>({segmentId:s.segmentId,portId:s.portId,stream:n.pipe(I(a=>a.itemsByPort.get(qr(s.segmentId))??[]))}))))}}))),sM=(n,e,t,o)=>n.meta.presentation==="draft"&&t&&e===o,aM=n=>`h:${n}`,dM=(n,e,t)=>`i:${n}:${e}:${t}`,lM=n=>{let e=[];for(let[t,o]of n.visits.entries()){let{hasResult:i,lastDraftSegmentId:r,pinnedRecovery:s}=Zh(n,o.visitId);e.push({kind:"header",rowId:aM(o.visitId),visitId:o.visitId,nodeId:o.nodeId,runId:o.runId,isClosed:o.isClosed,isFirstVisit:t===0,hasLiveRecovery:s!==void 0});let a=n.portsByVisit.get(o.visitId)??[],d=[];for(let h of a){let _=(n.itemsByPort.get(qr(h.segmentId))??[]).filter(D=>!sM(D,h.segmentId,i,r));_.length!==0&&d.push({segmentId:h.segmentId,portId:h.portId,items:_})}let l=d.length-1;for(let h=0;h<d.length;h+=1){let g=d[h],_=h===l,D=g.items.length-1;for(let L=0;L<g.items.length;L+=1){let q=g.items[L],Y=_&&L===D;e.push({kind:"item",rowId:dM(o.visitId,g.segmentId,q.seq),visitId:o.visitId,nodeId:o.nodeId,runId:o.runId,isClosed:o.isClosed,isLastSegment:_,isLastInVisit:Y,isLiveRecovery:s!==void 0&&q.seq===s.seq,segmentId:g.segmentId,portId:g.portId,item:q})}}}return e},qv=n=>n.pipe(I(lM));var Yr={asksById:new Map,askUserById:new Map,projection:Cd(),runId:null,workflowId:null,nodeIdsKey:"",pending:[]},Yv=n=>`permission:${n}`,cM=n=>({source:"permission",kind:"permission",runId:n.runId,nodeId:n.nodeId,portId:Yv(n.askId),state:"pending",value:n,meta:{presentation:"permission-ask",askId:n.askId,authority:"server"}}),uM=(n,e)=>n.runId!==e.runId?null:{source:"permission",kind:"permission",runId:n.runId,nodeId:e.nodeId,portId:Yv(n.askId),state:"value",value:n,meta:{presentation:n.decision==="allow"?"permission-grant":"permission-deny",askId:n.askId,authority:"server"}},Zv=n=>`askUser:${n}`,pM=n=>n.question.trim().length>0?n.question:(n.questions??[]).map(t=>t.prompt).join(`
|
|
314
|
+
`),hM=n=>({source:"ask-user",kind:"ask-user",runId:n.runId,nodeId:n.nodeId,portId:Zv(n.askId),state:"pending",value:pM(n),meta:{presentation:"ask-user-ask",askId:n.askId,authority:"server"}}),fM=(n,e)=>n.runId!==e.runId?null:{source:"ask-user",kind:"ask-user",runId:n.runId,nodeId:e.nodeId,portId:Zv(n.askId),state:"value",value:n.text,meta:{presentation:"ask-user-reply",askId:n.askId,authority:"server"}},gM=n=>n===void 0||n==="none"?"none":n,ki=(n,e)=>Ly(e)?C(p({},n),{closesPreviousVisit:!0}):n,Di=(n,e)=>e?n:C(p({},n),{visitBoundary:"close"}),mM=n=>{let[,,,e]=n;if("error"in e)return ki(Di({presentation:"error"},!1),n);let t=gM(Io(n));return t==="none"?"none":ki(Di({presentation:t},bh(n)),n)},yM=(n,e,t)=>{let[o,i,r,s]=n;if(typeof r!="string"||"pending"in s||"inactive"in s)return null;let a=o==="out"?"output-emitted":"input-received",d="error"in s?"error":"value",l="error"in s?s.error:s.value,h={source:"port",kind:a,runId:e,nodeId:i,portId:r,state:d,value:l};if(r===dt&&_r(l))return l.kind==="pause"?C(p({},h),{meta:ki(Di({presentation:"steering-pause",payload:l},!1),n)}):l.kind==="steer"?C(p({},h),{value:l.text.trim(),meta:ki(Di({presentation:"hitl-user",origin:"steer",payload:l},!1),n)}):C(p({},h),{meta:ki(Di({presentation:"steering-resume",payload:l},!1),n)});let g=dn(t.paletteByType,t.nodeTypeById,i);if(o==="in"&&g!==void 0&&ko(g,r)){let D=g0(g,r,l);return C(p({},h),{value:D,meta:ki(Di({presentation:"hitl-user",origin:"hitl-reply"},bh(n)),n)})}let _=mM(n);return _==="none"?null:C(p({},h),{meta:_})},Xv=(n,e,t)=>"source"in n?n:!Fe(n)||e===null?null:yM(n,e,t),Kv=(n,e,t)=>Wv(n.flatMap(o=>{let i=Xv(o,e,t);return i===null?[]:[i]})),Kr=(n,e,t={},o)=>{let i=t.asksById??n.asksById,r=t.askUserById??n.askUserById;if(n.runId===null)return C(p({},n),{asksById:i,askUserById:r,pending:[...n.pending,e]});let s=o===void 0&&!("source"in e)?null:Xv(e,n.runId,o??{labels:new Map,paletteByType:new Map,nodeTypeById:new Map});return s===null?C(p({},n),{asksById:i,askUserById:r}):C(p({},n),{asksById:i,askUserById:r,projection:Yh(n.projection,s)})},vM=n=>n.workflowId===null&&n.nodeIdsKey===""?null:{workflowId:n.workflowId,nodeIdsKey:n.nodeIdsKey},wM=(n,e)=>{if(e.type==="document")return f0(vM(n),{workflowId:e.workflowId,nodeIdsKey:e.nodeIdsKey})?C(p({},Yr),{workflowId:e.workflowId,nodeIdsKey:e.nodeIdsKey}):C(p({},n),{workflowId:e.workflowId,nodeIdsKey:e.nodeIdsKey});if(e.type==="clear")return C(p({},Yr),{workflowId:n.workflowId,nodeIdsKey:n.nodeIdsKey});if(e.type==="run-started")return e.runId===n.runId?n:n.runId===null?C(p({},n),{runId:e.runId,pending:[],projection:Kv(n.pending,e.runId,e.catalog)}):C(p({},Yr),{workflowId:n.workflowId,nodeIdsKey:n.nodeIdsKey,runId:e.runId});if(e.type==="snapshot")return{asksById:new Map,askUserById:new Map,workflowId:n.workflowId,nodeIdsKey:n.nodeIdsKey,pending:[],runId:e.runId,projection:e.runId===null?Cd():Kv(e.events,e.runId,e.catalog)};if(e.type==="port")return Kr(n,e.event,{},e.catalog);if(e.type==="permission-ask"){let r=new Map(n.asksById);return r.set(e.ask.askId,e.ask),Kr(n,cM(e.ask),{asksById:r})}if(e.type==="permission-accepted"){let r=n.asksById.get(e.accepted.askId),s=r===void 0?null:uM(e.accepted,r);if(s===null)return n;let a=new Map(n.asksById);return a.delete(e.accepted.askId),Kr(n,s,{asksById:a})}if(e.type==="ask-user-ask"){let r=new Map(n.askUserById);return r.set(e.ask.askId,e.ask),Kr(n,hM(e.ask),{askUserById:r})}let t=n.askUserById.get(e.accepted.askId),o=t===void 0?null:fM(e.accepted,t);if(o===null)return n;let i=new Map(n.askUserById);return i.delete(e.accepted.askId),Kr(n,o,{askUserById:i})},bM=n=>{let e=Te([n.workflowSnapshot$,Te([n.paletteSnapshot$,n.customPaletteSnapshot$]).pipe(I(([t,o])=>go(t,o)))]).pipe(I(([t,o])=>da(t,o)),te({bufferSize:1,refCount:!0}));return ee(n.executionFeedSnapshot$.pipe(Me(t=>e.pipe(Wt(1),I(o=>t===null?{type:"clear"}:{type:"snapshot",events:t.events,runId:t.runId,catalog:o})))),e.pipe(Me(t=>n.runnerPort$.pipe(I(o=>({type:"port",event:o,catalog:t}))))),e.pipe(Me(t=>n.runnerStarted$.pipe(I(o=>({type:"run-started",runId:o,catalog:t}))))),n.permissionAsk$.pipe(I(t=>({type:"permission-ask",ask:t}))),n.permissionAccepted$.pipe(I(t=>({type:"permission-accepted",accepted:t}))),n.askUserAsk$.pipe(I(t=>({type:"ask-user-ask",ask:t}))),n.askUserAccepted$.pipe(I(t=>({type:"ask-user-accepted",accepted:t}))),e.pipe(I(t=>({type:"document",workflowId:t.workflowId??null,nodeIdsKey:h0(t.nodeTypeById)})))).pipe(ve(wM,Yr),de(Yr),I(t=>t.projection),te({bufferSize:1,refCount:!0}))},Qv=n=>{let e=bM(n);return{nodeFeed$:Gv(e),feedRows$:qv(e)}};var Ti=class n{constructor(){this.bridge=f(ie);this.folded=Qv({executionFeedSnapshot$:this.bridge.cached["executionFeed.snapshot"],runnerPort$:this.bridge.raw["runner.port"].pipe(se(e=>Fe(e))),runnerStarted$:this.bridge.raw["runner.started"].pipe(se(e=>typeof e=="string")),permissionAsk$:this.bridge.raw["runner.permission.ask"]??Ne,permissionAccepted$:this.bridge.raw["runner.permission.accepted"]??Ne,askUserAsk$:this.bridge.raw["runner.askUser.ask"]??Ne,askUserAccepted$:this.bridge.raw["runner.askUser.accepted"]??Ne,workflowSnapshot$:this.bridge.cached["workflow.current.snapshot"],paletteSnapshot$:this.bridge.cached["palette.snapshot"],customPaletteSnapshot$:this.bridge.cached["customPalette.snapshot"]});this.nodeFeed$=this.folded.nodeFeed$;this.feedRows$=this.folded.feedRows$}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275prov=j({token:n,factory:n.\u0275fac,providedIn:"root"})}};var Mi=(n,e,t)=>{if(t==="open"){if(n.has(e))return n;let i=new Set(n);return i.add(e),i}if(!n.has(e))return n;let o=new Set(n);return o.delete(e),o},CM=(n,e,t)=>{let o=new Set;for(let i of n){if(Fe(i)&&i[0]==="out"){let[,h,g,_]=i;if(typeof g!="string"||!("value"in _))continue;(Io(i)==="recovery"||g===fo)&&ai(_.value)&&o.add(String(h));continue}if(!Yt(i)||i[0]!=="in"||typeof i[2]!="string")continue;let[,r,s]=i,a=i[3].value,d=dn(e,t,r);if(d===void 0)continue;let l=Fr(s,a);if(l==="open"){o.add(String(r));continue}if(l==="close"){o.delete(String(r));continue}s!==dt&&(ko(d,s)?o.delete(String(r)):Lr(d,String(r),s)&&o.add(String(r)))}return o},_M=(n,e)=>{if(e.type==="hardReset")return e.runId!==void 0&&e.runId===n.runId?n:{ids:new Set,runId:e.runId??null,live:!1,lastEvents:n.lastEvents,lastFeedRunId:n.lastFeedRunId};if(e.type==="hydrate")return n.live?C(p({},n),{lastEvents:e.events,lastFeedRunId:e.feedRunId}):n.lastEvents!==null&&e.events===n.lastEvents?n:!n.live&&n.ids.size===0&&n.lastEvents!==null&&e.feedRunId!==null&&e.feedRunId===n.lastFeedRunId?C(p({},n),{lastEvents:e.events}):{ids:CM(e.events,e.palette,e.nodeTypes),runId:n.runId,live:!1,lastEvents:e.events,lastFeedRunId:e.feedRunId};if(e.type==="open")return{ids:Mi(n.ids,e.nodeId,"open"),runId:n.runId,live:!0,lastEvents:n.lastEvents,lastFeedRunId:n.lastFeedRunId};if(e.type==="resolve")return{ids:Mi(n.ids,e.nodeId,"close"),runId:n.runId,live:!0,lastEvents:n.lastEvents,lastFeedRunId:n.lastFeedRunId};if(e.type==="output")return(e.feedRole==="recovery"||e.portId===fo)&&ai(e.value)?{ids:Mi(n.ids,e.nodeId,"open"),runId:n.runId,live:!0,lastEvents:n.lastEvents,lastFeedRunId:n.lastFeedRunId}:n;let t=dn(e.palette,e.nodeTypes,e.nodeId);if(t===void 0)return n;let o=Fr(e.portId,e.value);return o==="open"||o==="close"?{ids:Mi(n.ids,e.nodeId,o),runId:n.runId,live:!0,lastEvents:n.lastEvents,lastFeedRunId:n.lastFeedRunId}:e.portId===dt?n:ko(t,e.portId)?{ids:Mi(n.ids,e.nodeId,"close"),runId:n.runId,live:!0,lastEvents:n.lastEvents,lastFeedRunId:n.lastFeedRunId}:Lr(t,e.nodeId,e.portId)?{ids:Mi(n.ids,e.nodeId,"open"),runId:n.runId,live:!0,lastEvents:n.lastEvents,lastFeedRunId:n.lastFeedRunId}:n},Jv=n=>{let t=Te([n.workflowSnapshot$,n.paletteSnapshot$]).pipe(I(([l,h])=>({palette:Dt(h.nodes),nodeTypes:di(l)})),te(1)).pipe(Me(({palette:l,nodeTypes:h})=>n.inputReceived$.pipe(I(g=>({type:"input",nodeId:String(g[1]),portId:g[2],value:g[3].value,palette:l,nodeTypes:h}))))),o=n.outputEmitted$.pipe(I(l=>({type:"output",nodeId:String(l[1]),portId:l[2],value:"value"in l[3]?l[3].value:void 0,feedRole:Io(l)}))),i=n.hitlOpenLocal$.pipe(I(l=>({type:"open",nodeId:l}))),r=n.hitlResolveLocal$.pipe(I(l=>({type:"resolve",nodeId:l}))),s=Te([n.executionFeedSnapshot$,n.workflowSnapshot$,n.paletteSnapshot$]).pipe(I(([l,h,g])=>({type:"hydrate",events:l===null?[]:l.events,feedRunId:l===null?null:l.runId,palette:Dt(g.nodes),nodeTypes:di(h)}))),a=ee(n.runnerStarted$,n.runnerStartNodeStarted$).pipe(I(l=>({type:"hardReset",runId:l}))),d=ee(n.runnerInterrupted$,n.runnerDone$).pipe(I(()=>({type:"hardReset"})));return ee(t,o,i,r,s,a,d).pipe(ve(_M,{ids:new Set,runId:null,live:!1,lastEvents:null,lastFeedRunId:null}),I(l=>l.ids),de(new Set),te(1))};var xM=(n,e)=>e.type==="hardReset"?[]:e.type==="accepted"?n.filter(o=>o.askId!==e.askId):[...n.filter(o=>o.askId!==e.ask.askId),e.ask],ew=n=>{let e=n.askUserAsk$.pipe(I(i=>({type:"ask",ask:i}))),t=n.askUserAccepted$.pipe(I(i=>({type:"accepted",askId:i.askId}))),o=ee(n.runnerDone$,n.runnerInterrupted$,n.runnerStarted$,n.runnerStartNodeStarted$).pipe(I(()=>({type:"hardReset"})));return ee(e,t,o).pipe(ve(xM,[]),de([]),te(1))};var SM=(n,e)=>e.type==="hardReset"?[]:e.type==="accepted"?n.filter(o=>o.askId!==e.askId):[...n.filter(o=>o.askId!==e.ask.askId),e.ask],tw=n=>{let e=n.permissionAsk$.pipe(I(i=>({type:"ask",ask:i}))),t=n.permissionAccepted$.pipe(I(i=>({type:"accepted",askId:i.askId}))),o=ee(n.runnerDone$,n.runnerInterrupted$,n.runnerStarted$,n.runnerStartNodeStarted$).pipe(I(()=>({type:"hardReset"})));return ee(e,t,o).pipe(ve(SM,[]),de([]),te(1))};var nw=(n,e)=>n.size>0?[...n]:e,ow=(n,e)=>!n&&e>0;var Xh=n=>n.hasPermissionAsk?"permission":n.hasAskUser?"askUser":n.isRunning&&n.hitlTabCount===0?"working":n.hitlTabCount>0||n.isRunning?"hitl":"idleRun",iw=n=>Xh(n)==="working";var Qh=(n,e)=>{if(n.config.kind==="button")return{ok:!0,payload:n.config.payload};if(n.config.kind==="textarea"){let t=e.trim();return t.length===0?{ok:!1}:{ok:!0,payload:t}}return{ok:!1}},Jh=n=>n.portId===dt&&n.config.kind==="textarea",ef=()=>({kind:"resume"}),rw=(n,e)=>n===dt&&typeof e=="string"?{kind:"steer",text:e}:e,sw=(n,e)=>Jh(n)&&e.trim().length===0?{ok:!0,payload:ef()}:Qh(n,e);var aw=(n,e,t)=>{let o=n?.nodes.find(i=>i.id===e)?.inputs[t];return typeof o=="string"?o:""};var _d="ask_user",dw={title:"Ask user",kind:"textarea",submitLabel:"Send",placeholder:"Reply to the agent\u2026"},Ft=class n{constructor(){this.bridge=f(ie);this.execution=f(we);this.executionFeed=f(Ti);this.paletteSnapshot$=aa(this.bridge.cached["palette.snapshot"],this.bridge.cached["customPalette.snapshot"]).pipe(te(1));this.workflowSnapshot$=this.bridge.cached["workflow.current.snapshot"];this.executionFeedSnapshot$=this.bridge.cached["executionFeed.snapshot"];this.runnerPort$=this.bridge.raw["runner.port"].pipe(se(e=>Fe(e)));this.outputEmitted$=this.runnerPort$.pipe(se(e=>e[0]==="out"));this.inputReceived$=this.runnerPort$.pipe(se(e=>Yt(e)&&e[0]==="in"&&typeof e[2]=="string"));this.runnerStarted$=this.bridge.raw["runner.started"].pipe(se(e=>typeof e=="string"));this.runnerStartNodeStarted$=this.bridge.raw["runner.startNode.started"].pipe(se(e=>typeof e=="string"));this.runnerDone$=this.bridge.raw["runner.done"];this.runnerInterrupted$=this.bridge.raw["runner.interrupted"];this.permissionAsk$=this.bridge.raw["runner.permission.ask"]??Ne;this.permissionAccepted$=this.bridge.raw["runner.permission.accepted"]??Ne;this.askUserAsk$=this.bridge.raw["runner.askUser.ask"]??Ne;this.askUserAccepted$=this.bridge.raw["runner.askUser.accepted"]??Ne;this.paletteByType$=this.paletteSnapshot$.pipe(I(e=>Dt(e.nodes)),te(1));this.nodeTypeById$=this.workflowSnapshot$.pipe(I(e=>di(e)),de(new Map),te(1));this.paletteByType=oe(this.paletteByType$,{initialValue:new Map});this.nodeTypeById=oe(this.nodeTypeById$,{initialValue:new Map});this.draftActions$=new ot;this.draftState$=ee(ee(this.runnerDone$,this.runnerInterrupted$).pipe(I(()=>({type:"runnerSettled"}))),this.execution.isRunning$.pipe(se(e=>e),I(()=>({type:"runStarted"}))),this.draftActions$).pipe(ve(Av,wd),de(wd),te(1));this.draftState=oe(this.draftState$,{initialValue:wd});this.idleChatEntryNodeIds=b(()=>{if(this.execution.isRunning()||this.draftState().chatStartPending)return[];let e=this.execution.activeGraph();return e===null?[]:Za(e,this.paletteByType())});this.nodeFeed=oe(this.executionFeed.nodeFeed$,{initialValue:[]});this.hitlOpenLocal$=new ot;this.hitlResolveLocal$=new ot;this.hitlTriggeredNodes$=Jv({workflowSnapshot$:this.workflowSnapshot$,paletteSnapshot$:this.paletteSnapshot$,executionFeedSnapshot$:this.executionFeedSnapshot$,inputReceived$:this.inputReceived$,outputEmitted$:this.outputEmitted$,runnerStarted$:this.runnerStarted$,runnerStartNodeStarted$:this.runnerStartNodeStarted$,runnerDone$:this.runnerDone$,runnerInterrupted$:this.runnerInterrupted$,hitlOpenLocal$:this.hitlOpenLocal$,hitlResolveLocal$:this.hitlResolveLocal$});this.hitlTriggeredNodes=oe(this.hitlTriggeredNodes$,{initialValue:new Set});this.pendingPermissionAsks$=tw({permissionAsk$:this.permissionAsk$,permissionAccepted$:this.permissionAccepted$,runnerDone$:this.runnerDone$,runnerInterrupted$:this.runnerInterrupted$,runnerStarted$:this.runnerStarted$,runnerStartNodeStarted$:this.runnerStartNodeStarted$});this.pendingPermissionAsks=oe(this.pendingPermissionAsks$,{initialValue:[]});this.pendingAskUserAsks$=ew({askUserAsk$:this.askUserAsk$,askUserAccepted$:this.askUserAccepted$,runnerDone$:this.runnerDone$,runnerInterrupted$:this.runnerInterrupted$,runnerStarted$:this.runnerStarted$,runnerStartNodeStarted$:this.runnerStartNodeStarted$});this.pendingAskUserAsks=oe(this.pendingAskUserAsks$,{initialValue:[]});this.navigationLocked=b(()=>iw({hasPermissionAsk:this.pendingPermissionAsks().length>0,hasAskUser:this.pendingAskUserAsks().length>0,isRunning:this.execution.isRunning(),hitlTabCount:this.hitlTriggeredNodes().size}))}hasAwaitingHitl(){return this.hitlTriggeredNodes().size>0}hitlTriggered(e){return this.hitlTriggeredNodeIds().includes(e)}hitlTriggeredNodeIds(){return nw(this.hitlTriggeredNodes(),this.idleChatEntryNodeIds())}hitlControls(e){let t=dn(this.paletteByType(),this.nodeTypeById(),e);return t!==void 0?Ch(e,t):[]}pausableFeedIsQuiet(){let e=this.pausableFeedNodeId();return e===null?!1:Ov(this.execution.lastActivityMs(e),this.execution.livenessNowMs(),1e4)}composerText(e,t){return this.isChatEntryNode(e)?aw(this.execution.activeGraph(),e,t):this.draftState().drafts.get(`${e}:${t}`)??""}setComposerText(e,t,o){if(this.isChatEntryNode(e)){this.updateNodeInput(e,t,o);return}this.draftActions$.next({type:"setDraft",key:`${e}:${t}`,value:o})}isChatEntryNode(e){let t=this.nodeTypeById().get(e);return t===void 0?!1:this.paletteByType().get(t)?.chatEntry===!0}updateNodeInput(e,t,o){if(this.execution.isRunning())return;let r=this.execution.activeGraph()?.nodes.find(s=>s.id===e);r!==void 0&&this.bridge.raw["editor.updateNode.requested"].next({nodeId:e,inputs:C(p({},r.inputs),{[t]:o})})}requestSoftPause(){let e=this.pausableFeedNodeId();e!==null&&(this.hitlOpenLocal$.next(e),this.bridge.raw["runner.hitl.event"]?.next({nodeId:e,portId:dt,payload:{kind:"pause"}}))}latestFeedNodeId(){return this.nodeFeed().at(-1)?.nodeId??null}pausableFeedNodeId(){let e=this.latestFeedNodeId();return e===null||this.hitlTriggeredNodeIds().includes(e)?null:this.workingSteerNodeIds().includes(e)?e:null}workingSteerNodeIds(){let e=this.execution.activeGraph();if(e===null||!this.execution.isRunning())return[];let t=new Set(this.nodeFeed().filter(i=>!i.isClosed).map(i=>i.nodeId)),o=[];for(let i of e.nodes){if(!t.has(i.id)||this.hitlTriggered(i.id))continue;this.paletteByType().get(i.type)?.inputsConfigs.some(s=>s.portId===dt)&&o.push(i.id)}return o}submitHitl(e){let t=e[0],o=e[1],i=rw(o,e[2]),r=this.nodeTypeById().get(t),a=(r!==void 0?this.paletteByType().get(r):void 0)?.chatEntry===!0;if(a){let d=typeof i=="string"?i:this.composerText(t,o);this.updateNodeInput(t,o,d)}if(this.bridge.raw["runner.hitl.event"]?.next({nodeId:t,portId:o,payload:i}),this.hitlResolveLocal$.next(t),a){this.draftActions$.next({type:"chatStartPending"});return}this.draftActions$.next({type:"clearPrefix",prefix:`${t}:`})}submitPermissionReply(e,t){this.bridge.raw["runner.permission.reply"]?.next({runId:e.runId,askId:e.askId,decision:t})}submitAskUserReply(e,t){let o=t.trim();o.length!==0&&(this.bridge.raw["runner.askUser.reply"]?.next({runId:e.runId,askId:e.askId,text:o}),this.draftActions$.next({type:"deleteKey",key:`${e.nodeId}:${_d}`}))}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275prov=j({token:n,factory:n.\u0275fac,providedIn:"root"})}};var EM=(n,e)=>e.nodeId+":"+e.portId;function IM(n,e){if(n&1){let t=z();y(0,"lf-hover-tip",1)(1,"button",2),R("click",function(){x(t);let i=c(2).$implicit,r=c();return S(r.submitEntry(i))}),ce(),y(2,"svg",3),F(3,"path",4),m()()()}if(n&2){let t=c(2).$implicit,o=c();M("tip",o.canSubmitStart(t)?"Start the chat run":"Type a message to start"),u(),G("hover:bg-emerald-100",o.canSubmitStart(t))("dark:hover:bg-emerald-950/60",o.canSubmitStart(t))("opacity-50",!o.canSubmitStart(t)),K("aria-disabled",o.canSubmitStart(t)?null:"true")}}function kM(n,e){if(n&1){let t=z();y(0,"lf-hover-tip",5)(1,"button",7),R("click",function(){x(t);let i=c(3).$implicit,r=c();return S(r.submitResume(i))}),w(2," Continue "),m()()}}function DM(n,e){if(n&1){let t=z();P(0,kM,3,0,"lf-hover-tip",5),y(1,"lf-hover-tip",1)(2,"button",6),R("click",function(){x(t);let i=c(2).$implicit,r=c();return S(r.submitEntry(i))}),w(3),m()()}if(n&2){let t=c(2).$implicit,o=c();E(o.isSteerTextarea(t)?0:-1),u(),M("tip",o.draftOf(t).trim().length>0?"":"Type a message first"),u(),M("disabled",o.draftOf(t).trim().length===0),u(),H(" ",t.config.submitLabel??"Send"," ")}}function TM(n,e){if(n&1&&P(0,IM,4,8,"lf-hover-tip",1)(1,DM,4,4),n&2){let t=c().$implicit;E(t.config.role==="chat-start"?0:1)}}function MM(n,e){if(n&1){let t=z();y(0,"button",7),R("click",function(){x(t);let i=c().$implicit,r=c();return S(r.submitEntry(i))}),w(1),m()}if(n&2){let t=c().$implicit;u(),H(" ",t.config.label," ")}}function RM(n,e){if(n&1&&P(0,TM,2,1)(1,MM,2,1,"button",0),n&2){let t,o=e.$implicit;E((t=o.config.kind)==="textarea"?0:t==="button"?1:-1)}}var xd=class n{constructor(){this.entries=[];this.submitted=new ke;this.composer=f(Ft)}draftOf(e){return this.composer.composerText(e.nodeId,e.portId)}canSubmitStart(e){return this.draftOf(e).trim().length>0}isSteerTextarea(e){return Jh(e)}submitResume(e){this.submitted.emit([e.nodeId,e.portId,ef()])}submitEntry(e){let t=Qh(e,this.draftOf(e));t.ok&&this.submitted.emit([e.nodeId,e.portId,t.payload])}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-hitl-actions"]],inputs:{entries:"entries"},outputs:{submitted:"submitted"},decls:2,vars:0,consts:[["type","button",1,"lf-composer-pill","border","border-zinc-200","text-zinc-700","hover:bg-zinc-100","dark:border-zinc-700","dark:text-zinc-200","dark:hover:bg-zinc-800"],[3,"tip"],["type","button","aria-label","Start",1,"lf-composer-icon-btn","border","border-emerald-400","bg-emerald-50","text-emerald-700","dark:border-emerald-500","dark:bg-emerald-950/40","dark:text-emerald-300",3,"click"],["viewBox","0 0 20 20","fill","currentColor","aria-hidden","true",1,"h-4","w-4"],["d","M6.3 2.84A1.5 1.5 0 0 0 4 4.11v11.78a1.5 1.5 0 0 0 2.3 1.27l9.34-5.89a1.5 1.5 0 0 0 0-2.54L6.3 2.84Z"],["tip","Resume this turn without new text"],["type","button",1,"lf-composer-pill","border","border-zinc-200","text-zinc-700","hover:bg-zinc-100","disabled:opacity-50","dark:border-zinc-700","dark:text-zinc-200","dark:hover:bg-zinc-800",3,"click","disabled"],["type","button",1,"lf-composer-pill","border","border-zinc-200","text-zinc-700","hover:bg-zinc-100","dark:border-zinc-700","dark:text-zinc-200","dark:hover:bg-zinc-800",3,"click"]],template:function(t,o){t&1&&X(0,RM,2,1,null,null,EM),t&2&&Q(o.entries)},dependencies:[Ue],encapsulation:2})}};function NM(n,e){if(n&1){let t=z();O(0,"div",1),ge("mouseenter",function(){x(t);let i=c();return S(i.onPointerEnter())})("mouseleave",function(){x(t);let i=c();return S(i.onPointerLeave())}),O(1,"textarea",2),ge("input",function(i){x(t);let r=c();return S(r.onDraft(i))})("keydown",function(i){x(t);let r=c();return S(r.onKeydown(i))})("keyup",function(i){x(t);let r=c();return S(r.onKeyup(i))})("focus",function(){x(t);let i=c();return S(i.onFocus())})("blur",function(){x(t);let i=c();return S(i.onBlur())}),N()()}if(n&2){let t=c();u(),G("pt-11",t.padTopForTabs)("pt-3",!t.padTopForTabs),he("id",Sg("hitl-",t.nodeId,"-",t.portId))("placeholder",t.config.placeholder??"")("value",t.composer.composerText(t.nodeId,t.portId)),K("aria-label",t.config.title)}}var Sd=class n{constructor(){this.padTopForTabs=!1;this.enterActivate=new ke;this.composer=f(Ft);this.hover=f(Cn);this.pointerInside=!1;this.focused=!1}onDraft(e){this.composer.setComposerText(this.nodeId,this.portId,e.target.value)}onKeydown(e){e.key!=="Enter"||e.shiftKey||e.isComposing||e.altKey||e.ctrlKey||e.metaKey||e.preventDefault()}onKeyup(e){e.key!=="Enter"||e.shiftKey||e.isComposing||e.altKey||e.ctrlKey||e.metaKey||(e.preventDefault(),this.enterActivate.emit())}onPointerEnter(){this.pointerInside=!0,this.hover.set(this.nodeId)}onPointerLeave(){this.pointerInside=!1,this.focused||this.hover.clear()}onFocus(){this.focused=!0,this.hover.set(this.nodeId)}onBlur(){this.focused=!1,this.pointerInside||this.hover.clear()}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-hitl-textarea"]],hostAttrs:[1,"block","h-full","w-full"],inputs:{nodeId:"nodeId",portId:"portId",config:"config",padTopForTabs:"padTopForTabs"},outputs:{enterActivate:"enterActivate"},decls:1,vars:1,consts:[[1,"h-full","w-full"],[1,"h-full","w-full",3,"mouseenter","mouseleave"],[1,"lf-scroll","h-full","w-full","resize-none","border-0","bg-transparent","px-3","pb-14","text-xs","leading-5","text-zinc-900","focus:outline-none","dark:text-zinc-100",3,"input","keydown","keyup","focus","blur","id","placeholder","value"]],template:function(t,o){if(t&1&&P(0,NM,2,10,"div",0),t&2){let i;E((i=o.config.kind)==="textarea"?0:-1)}},encapsulation:2})}};var OM=(n,e)=>e.pointId;function AM(n,e){if(n&1){let t=z();y(0,"lf-hover-tip",4)(1,"button",5),R("click",function(){let i=x(t),r=c(),s=c(2);return S(s.discard(i,r))}),w(2," Discard "),m()()}}function LM(n,e){if(n&1&&P(0,AM,3,0,"lf-hover-tip",4),n&2){let t,o=c(2);E((t=o.sessionId())?0:-1,t)}}function FM(n,e){if(n&1&&(y(0,"div",2)(1,"p",3),w(2),m(),P(3,LM,1,1),m()),n&2){let t,o=e,i=c();G("w-full",!i.compact),u(2),Wo(" Resume failed (",o.code,"): ",o.message," "),u(),E((t=o.pointId)?3:-1,t)}}function zM(n,e){n&1&&w(0," \xB7 stale ")}function $M(n,e){n&1&&w(0," \xB7 unsupported ")}function BM(n,e){if(n&1){let t=z();y(0,"button",21),R("click",function(){x(t);let i=c().$implicit,r=c(3);return S(r.continueFrom(i.pointId))}),w(1," Continue "),m()}}function HM(n,e){if(n&1){let t=z();y(0,"button",22),R("click",function(){let i=x(t),r=c().$implicit,s=c(3);return S(s.discard(i,r.pointId))}),w(1," Discard "),m()}}function UM(n,e){if(n&1&&(y(0,"li",13)(1,"div",14)(2,"div",15)(3,"p",16),w(4),m(),y(5,"p",17),w(6),P(7,zM,1,0),P(8,$M,1,0),m()(),y(9,"div",18),P(10,BM,2,0,"button",19),P(11,HM,2,0,"button",20),m()()()),n&2){let t,o=e.$implicit,i=c(3);G("bg-rose-50",o.stale===!0||o.unsupported!==void 0)("dark:bg-rose-950/30",o.stale===!0||o.unsupported!==void 0),u(4),H(" ",i.titleFor(o)," "),u(2),H(" ",i.formatTime(o.createdAt)," "),u(),E(o.stale===!0?7:-1),u(),E(o.unsupported?8:-1),u(2),E(i.canResumeEntry(o)&&!i.isRunning()?10:-1),u(),E((t=i.sessionId())?11:-1,t)}}function VM(n,e){if(n&1&&(y(0,"ul",11),X(1,UM,12,10,"li",12,OM),m()),n&2){let t=c(2);u(),Q(t.points())}}function jM(n,e){if(n&1){let t=z();y(0,"div",6)(1,"button",7),R("click",function(){x(t);let i=c();return S(i.togglePicker())}),y(2,"span",8),w(3," Continue from\u2026 "),y(4,"span",9),w(5),m()(),y(6,"span",10),w(7),m()(),P(8,VM,3,0,"ul",11),m()}if(n&2){let t=c();G("w-full",!t.compact),u(),K("aria-expanded",t.pickerOpen()),u(4),H(" (",t.resumableCount(),") "),u(2),H(" ",t.pickerOpen()?"\u25B4":"\u25BE"," "),u(),E(t.pickerOpen()?8:-1)}}var WM=n=>{let e=new Date(n);return Number.isNaN(e.getTime())?n:e.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})},GM=n=>n.label!==void 0&&n.label.length>0?n.label:"Checkpoint",Pd=class n{constructor(){this.compact=!1;this.bridge=f(ie);this.execution=f(we);this.isRunning=this.execution.isRunning;this.pickerOpen=U(!1);this.uiState=oe(ee(this.bridge.cached["workflowSession.current.snapshot"].pipe(I(e=>({type:"snapshot",sessionId:e.sessionId,points:e.points}))),this.bridge.raw["runner.resume.failed"].pipe(I(e=>({type:"error",error:e}))),this.bridge.raw["runner.resume.started"].pipe(I(()=>({type:"clearError"}))),this.bridge.raw["runner.started"].pipe(I(()=>({type:"clearError"})))).pipe(ve((e,t)=>{switch(t.type){case"snapshot":return{sessionId:t.sessionId,points:t.points,resumeError:null};case"error":return{sessionId:e.sessionId,points:e.points,resumeError:t.error};case"clearError":return{sessionId:e.sessionId,points:e.points,resumeError:null}}},{sessionId:null,points:[],resumeError:null}),de({sessionId:null,points:[],resumeError:null})),{initialValue:{sessionId:null,points:[],resumeError:null}});this.resumeError=b(()=>this.uiState().resumeError);this.sessionId=b(()=>this.uiState().sessionId);this.points=b(()=>this.uiState().points);this.hasPoints=b(()=>this.points().length>0&&!this.isRunning());this.resumableCount=b(()=>this.points().length)}togglePicker(){this.pickerOpen.update(e=>!e)}titleFor(e){return GM(e)}formatTime(e){return WM(e)}canResumeEntry(e){return e.stale!==!0&&e.unsupported===void 0}continueFrom(e){this.pickerOpen.set(!1),this.bridge.raw["runner.resume.requested"].next({pointId:e})}discard(e,t){this.bridge.raw["workflowSession.discardPoint.requested"].next({sessionId:e,pointId:t})}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-continue-button"]],inputs:{compact:"compact"},decls:2,vars:1,consts:[[1,"flex","min-w-0","flex-col","gap-1",3,"w-full"],[1,"flex","min-w-0","flex-col","gap-1.5",3,"w-full"],[1,"flex","min-w-0","flex-col","gap-1"],[1,"lf-text-caption","text-rose-700","dark:text-rose-300"],["tip","Discard this point"],["type","button",1,"lf-btn","lf-btn--ghost","rounded-md","border","border-rose-300","px-2","py-1","text-rose-700","hover:bg-rose-50","dark:border-rose-700","dark:text-rose-300","dark:hover:bg-rose-950/40",3,"click"],[1,"flex","min-w-0","flex-col","gap-1.5"],["type","button",1,"lf-btn","lf-btn--ghost","flex","w-full","items-center","justify-between","gap-2","rounded-md","border","border-sky-400","bg-sky-50","px-3","py-1.5","text-sky-700","transition","hover:bg-sky-100","dark:border-sky-500","dark:bg-sky-950/40","dark:text-sky-300","dark:hover:bg-sky-950/60",3,"click"],[1,"lf-text-caption","font-medium"],[1,"opacity-70"],["aria-hidden","true",1,"lf-text-caption","opacity-60"],["role","listbox","aria-label","Session points",1,"lf-scroll","flex","max-h-48","flex-col","gap-1","overflow-y-auto","rounded-md","border","border-zinc-200","bg-white","p-1","dark:border-zinc-700","dark:bg-zinc-900"],[1,"flex","min-w-0","flex-col","gap-1","rounded","px-2","py-1.5",3,"bg-rose-50","dark:bg-rose-950/30"],[1,"flex","min-w-0","flex-col","gap-1","rounded","px-2","py-1.5"],[1,"flex","min-w-0","items-start","justify-between","gap-2"],[1,"min-w-0","flex-1"],[1,"lf-text-caption","truncate","font-medium","text-zinc-800","dark:text-zinc-100"],[1,"lf-text-caption","truncate","text-zinc-500","dark:text-zinc-400"],[1,"flex","shrink-0","gap-1"],["type","button",1,"lf-btn","lf-btn--ghost","rounded","border","border-sky-400","px-2","py-0.5","text-sky-700","dark:border-sky-500","dark:text-sky-300"],["type","button",1,"lf-btn","lf-btn--ghost","rounded","border","border-zinc-300","px-2","py-0.5","text-zinc-600","dark:border-zinc-600","dark:text-zinc-300"],["type","button",1,"lf-btn","lf-btn--ghost","rounded","border","border-sky-400","px-2","py-0.5","text-sky-700","dark:border-sky-500","dark:text-sky-300",3,"click"],["type","button",1,"lf-btn","lf-btn--ghost","rounded","border","border-zinc-300","px-2","py-0.5","text-zinc-600","dark:border-zinc-600","dark:text-zinc-300",3,"click"]],template:function(t,o){if(t&1&&P(0,FM,4,5,"div",0)(1,jM,9,6,"div",1),t&2){let i;E((i=o.resumeError())?0:o.hasPoints()?1:-1,i)}},dependencies:[Ue],encapsulation:2})}};function qM(n,e){if(n&1){let t=z();y(0,"lf-hover-tip",0)(1,"button",1),R("click",function(){x(t);let i=c();return S(i.onPause())}),ce(),y(2,"svg",2),F(3,"path",3),m()()()}if(n&2){let t=c();M("tip",t.pauseTip()),u(),M("disabled",!t.canPause())}}var Ed=class n{constructor(){this.execution=f(we);this.composer=f(Ft);this.visible=b(()=>this.execution.isRunning()&&this.composer.pausableFeedNodeId()!==null);this.canPause=b(()=>this.composer.pausableFeedNodeId()!==null);this.pauseTip=b(()=>(this.execution.livenessNowMs(),this.composer.pausableFeedIsQuiet()?"API quiet \u2014 Pause to nudge":"Pause \u2014 soft interrupt"))}onPause(){this.composer.requestSoftPause()}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-pause-button"]],decls:1,vars:1,consts:[["align","end",3,"tip"],["type","button","aria-label","Pause",1,"lf-composer-icon-btn","border","border-amber-400","bg-amber-50","text-amber-800","hover:bg-amber-100","disabled:opacity-50","dark:border-amber-500","dark:bg-amber-950/40","dark:text-amber-300","dark:hover:bg-amber-950/60",3,"click","disabled"],["viewBox","0 0 20 20","fill","currentColor","aria-hidden","true",1,"h-4","w-4"],["d","M5.75 3A1.75 1.75 0 0 0 4 4.75v10.5c0 .966.784 1.75 1.75 1.75h1.5A1.75 1.75 0 0 0 9 15.25V4.75A1.75 1.75 0 0 0 7.25 3h-1.5ZM12.75 3A1.75 1.75 0 0 0 11 4.75v10.5c0 .966.784 1.75 1.75 1.75h1.5A1.75 1.75 0 0 0 16 15.25V4.75A1.75 1.75 0 0 0 14.25 3h-1.5Z"]],template:function(t,o){t&1&&P(0,qM,4,2,"lf-hover-tip",0),t&2&&E(o.visible()?0:-1)},dependencies:[Ue],encapsulation:2})}};function KM(n,e){if(n&1){let t=z();y(0,"lf-hover-tip",0)(1,"button",2),R("click",function(){x(t);let i=c();return S(i.toggle())}),ce(),y(2,"svg",3),F(3,"path",4),m()()()}}function YM(n,e){if(n&1){let t=z();y(0,"lf-hover-tip",1)(1,"button",5),R("click",function(){x(t);let i=c();return S(i.toggle())}),w(2),m()()}if(n&2){let t=c();M("tip",t.disabledTip()),u(),G("w-full",!t.compact)("shrink-0",t.compact),M("disabled",t.isDisabled()),u(),H(" ",t.buttonLabel()," ")}}var Id=class n{constructor(){this.compact=!1;this.bridge=f(ie);this.execution=f(we);this.selection=f(Yn);this.selectedNodeId=this.selection.selectedNodeId;this.isRunning=this.execution.isRunning;this.isDisabled=b(()=>{if(this.isRunning())return!1;if(!this.execution.hasRunnableGraph()||!this.execution.hasPaletteCatalog())return!0;let e=this.selectedNodeId();return e!==null?this.execution.nodeClusterRequiresChatEntry(e):!this.execution.hasPlainStartTargets()});this.disabledTip=b(()=>{if(!this.isDisabled())return"";if(!this.execution.hasRunnableGraph())return"Load a workflow with nodes to run";if(!this.execution.hasPaletteCatalog())return"Waiting for node catalog";let e=this.selectedNodeId();return e!==null&&this.execution.nodeClusterRequiresChatEntry(e)?"Start this cluster from the Chat Input composer":this.execution.hasPlainStartTargets()?"Cannot run right now":"This graph starts from Chat Input \u2014 use Start in the composer"});this.buttonLabel=b(()=>this.isRunning()?"Stop":this.selectedNodeId()!==null?"Run from node":"Run")}toggle(){if(this.isRunning()){this.bridge.raw["runner.interrupt.requested"].next("cancel");return}if(!this.execution.hasPaletteCatalog())return;let e=this.selectedNodeId();if(e!==null){if(this.execution.nodeClusterRequiresChatEntry(e))return;this.bridge.raw["runner.startNode.requested"].next([e,void 0]);return}this.execution.hasPlainStartTargets()&&this.bridge.raw["runner.start.requested"].next([{},void 0])}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-run-button"]],inputs:{compact:"compact"},decls:2,vars:1,consts:[["tip","Stop \u2014 cancel run","align","start"],[3,"tip"],["type","button","aria-label","Stop",1,"lf-composer-icon-btn","border","border-rose-400","bg-rose-50","text-rose-800","hover:bg-rose-100","dark:border-rose-500","dark:bg-rose-950/40","dark:text-rose-300","dark:hover:bg-rose-950/60",3,"click"],["viewBox","0 0 20 20","fill","currentColor","aria-hidden","true",1,"h-4","w-4"],["d","M5.25 3A2.25 2.25 0 0 0 3 5.25v9.5A2.25 2.25 0 0 0 5.25 17h9.5A2.25 2.25 0 0 0 17 14.75v-9.5A2.25 2.25 0 0 0 14.75 3h-9.5Z"],["type","button",1,"lf-composer-pill","border","border-emerald-400","bg-emerald-50","text-emerald-700","hover:bg-emerald-100","disabled:opacity-50","dark:border-emerald-500","dark:bg-emerald-950/40","dark:text-emerald-300","dark:hover:bg-emerald-950/60",3,"click","disabled"]],template:function(t,o){t&1&&P(0,KM,4,0,"lf-hover-tip",0)(1,YM,3,7,"lf-hover-tip",1),t&2&&E(o.isRunning()?0:1)},dependencies:[Ue],encapsulation:2})}};var ZM=(n,e)=>e.nodeId;function XM(n,e){if(n&1&&(y(0,"div",1)(1,"p",9),w(2," permission.ask "),m(),y(3,"p",10),w(4),m(),y(5,"p",11),w(6),m()()),n&2){let t=e,o=c();u(4),H(" ",t.summary," "),u(2),H(" ",o.permissionAskMeta(t)," ")}}function QM(n,e){if(n&1){let t=z();y(0,"lf-ask-user-questions",14),R("selectionsChange",function(i){x(t);let r=c(2);return S(r.onAskUserSelections(i))}),m()}if(n&2){let t=c(),o=c();M("askId",t.askId)("headline",t.question)("questions",o.askUserQuestions(t))}}function JM(n,e){if(n&1){let t=z();y(0,"div",2),P(1,QM,1,3,"lf-ask-user-questions",12),y(2,"lf-hitl-textarea",13),R("enterActivate",function(){x(t);let i=c();return S(i.onEnterActivate())}),m()()}if(n&2){let t=e,o=c();u(),E(o.askUserQuestions(t).length>0?1:-1),u(),M("nodeId",t.nodeId)("portId",o.askUserPortId)("config",o.askUserTextareaConfig)}}function e2(n,e){n&1&&(y(0,"p",15),w(1," No pending human-in-the-loop steps. Chat Input and Review Gate replies appear here when the graph is waiting on you. "),m())}function t2(n,e){if(n&1&&P(0,e2,2,0,"p",15),n&2){let t=c();E(t.footerMode()!=="working"?0:-1)}}function n2(n,e){if(n&1){let t=z();y(0,"button",19),R("click",function(){let i=x(t).$implicit,r=c(3);return S(r.selectHitlTab(i.nodeId))})("mouseenter",function(){let i=x(t).$implicit,r=c(3);return S(r.hover.set(i.nodeId))})("mouseleave",function(){x(t);let i=c(3);return S(i.hover.clear())}),w(1),m()}if(n&2){let t=e.$implicit,o=c(3);G("bg-zinc-900",t.nodeId===o.resolvedActiveHitlTab())("text-white",t.nodeId===o.resolvedActiveHitlTab())("text-zinc-600",t.nodeId!==o.resolvedActiveHitlTab())("hover:bg-zinc-100",t.nodeId!==o.resolvedActiveHitlTab())("ring-2",o.hover.isHovered(t.nodeId))("ring-violet-400",o.hover.isHovered(t.nodeId))("dark:text-zinc-300",t.nodeId!==o.resolvedActiveHitlTab())("dark:hover:bg-zinc-800",t.nodeId!==o.resolvedActiveHitlTab()),u(),H(" ",t.label," ")}}function o2(n,e){if(n&1&&(y(0,"div",16),X(1,n2,2,17,"button",18,ZM),m()),n&2){let t=c(2);u(),Q(t.hitlTabs())}}function i2(n,e){if(n&1){let t=z();y(0,"lf-hitl-textarea",20),R("enterActivate",function(){x(t);let i=c(2);return S(i.onEnterActivate())}),m()}if(n&2){let t=e,o=c(2);M("nodeId",t.nodeId)("portId",t.portId)("config",t.config)("padTopForTabs",o.showTabs())}}function r2(n,e){if(n&1&&(P(0,o2,3,0,"div",16),P(1,i2,1,4,"lf-hitl-textarea",17)),n&2){let t,o=c();E(o.showTabs()?0:-1),u(),E((t=o.activeHitlTextarea())?1:-1,t)}}function s2(n,e){n&1&&(y(0,"p",3),w(1," working . . . "),m())}function a2(n,e){if(n&1){let t=z();y(0,"div",21)(1,"lf-hover-tip",22)(2,"button",23),R("click",function(){let i=x(t),r=c(2);return S(r.onPermissionReply(i,"deny"))}),w(3," Deny "),m()(),y(4,"lf-hover-tip",24)(5,"button",25),R("click",function(){let i=x(t),r=c(2);return S(r.onPermissionReply(i,"allow"))}),w(6," Allow "),m()()()}}function d2(n,e){if(n&1&&P(0,a2,7,0,"div",21),n&2){let t,o=c();E((t=o.activePermissionAsk())?0:-1,t)}}function l2(n,e){n&1&&F(0,"lf-run-button",26),n&2&&M("compact",!0)}function c2(n,e){if(n&1){let t=z();y(0,"div",5),P(1,l2,1,1,"lf-run-button",26),y(2,"lf-hover-tip",27)(3,"button",28),R("click",function(){let i=x(t),r=c(2);return S(r.onAskUserSubmit(i))}),w(4," Send "),m()()()}if(n&2){let t=e,o=c(2);u(),E(o.execution.isRunning()?1:-1),u(),M("tip",o.canSubmitAskUser(t)?"Send this answer to the agent":"Select an option or type a message"),u(),M("disabled",!o.canSubmitAskUser(t))}}function u2(n,e){if(n&1&&P(0,c2,5,3,"div",5),n&2){let t,o=c();E((t=o.activeAskUser())?0:-1,t)}}function p2(n,e){n&1&&(y(0,"div",5),F(1,"lf-run-button",26)(2,"lf-pause-button"),m()),n&2&&(u(),M("compact",!0))}function h2(n,e){n&1&&(y(0,"div",29),F(1,"lf-run-button",26)(2,"lf-pause-button"),m()),n&2&&(u(),M("compact",!0))}function f2(n,e){if(n&1){let t=z();y(0,"div",30)(1,"lf-hover-tip",34)(2,"button",35),R("click",function(){x(t);let i=c(2);return S(i.requestReset())}),ce(),y(3,"svg",36),F(4,"path",37)(5,"path",38)(6,"path",39)(7,"path",40),m()()()()}}function g2(n,e){if(n&1){let t=z();y(0,"lf-hitl-actions",41),R("submitted",function(i){x(t);let r=c(2);return S(r.onHitlSubmit(i))}),m()}if(n&2){let t=c(2);M("entries",t.hitlReplyActionsForActiveTab())}}function m2(n,e){if(n&1){let t=z();y(0,"lf-hitl-actions",42),R("submitted",function(i){x(t);let r=c(2);return S(r.onHitlSubmit(i))}),m()}if(n&2){let t=c(2);M("entries",t.hitlStartActionForActiveTab())}}function y2(n,e){if(n&1&&(y(0,"div",6),P(1,h2,3,1,"div",29)(2,f2,8,0,"div",30),y(3,"div",31),F(4,"lf-continue-button",26),P(5,g2,1,1,"lf-hitl-actions",32),P(6,m2,1,1,"lf-hitl-actions",33),m()()),n&2){let t=c();u(),E(t.execution.isRunning()?1:t.showConversationReset()?2:-1),u(3),M("compact",!0),u(),E(t.hitlReplyActionsForActiveTab().length>0?5:-1),u(),E(!t.execution.isRunning()&&t.hitlStartActionForActiveTab().length>0?6:-1)}}function v2(n,e){n&1&&(y(0,"div",7),F(1,"lf-continue-button")(2,"lf-run-button",43),m())}function w2(n,e){if(n&1){let t=z();y(0,"div",8)(1,"h2",44),w(2," Reset session? "),m(),y(3,"p",45),w(4," This clears the conversation, the work log, and points. The graph stays. "),m(),y(5,"div",46)(6,"button",47),R("click",function(){x(t);let i=c();return S(i.cancelReset())}),w(7," Cancel "),m(),y(8,"button",48),R("click",function(){x(t);let i=c();return S(i.confirmReset())}),w(9," Reset "),m()()()}}var kd=class n{constructor(){this.height=T.required();this.bridge=f(ie);this.execution=f(we);this.composer=f(Ft);this.hover=f(Cn);this.boundSessionId=oe(this.bridge.cached["workflowSession.current.snapshot"].pipe(I(e=>e.sessionId)),{initialValue:null});this.pendingReset=U(!1);this.showConversationReset=b(()=>ow(this.execution.isRunning(),this.composer.hasAwaitingHitl()?1:0));this.activePermissionAsk=b(()=>this.composer.pendingPermissionAsks()[0]??null);this.activeAskUser=b(()=>this.composer.pendingAskUserAsks()[0]??null);this.askUserPortId=_d;this.askUserTextareaConfig=dw;this.askUserSelections=U(new Map);this.hitlTabs=b(()=>this.composer.hitlTriggeredNodeIds().map(e=>{let t=this.composer.hitlControls(e);return{nodeId:e,label:this.execution.nodeLabel(e),textarea:t.find(o=>o.config.kind==="textarea")??null,actions:t}}));this.selectedHitlTab=U(null);this.resolvedActiveHitlTab=b(()=>{let e=this.hitlTabs();if(e.length===0)return null;let t=this.selectedHitlTab();return t!==null&&e.some(o=>o.nodeId===t)?t:e[0]?.nodeId??null});this.activeHitlTabEntry=b(()=>{let e=this.resolvedActiveHitlTab();return e===null?null:this.hitlTabs().find(t=>t.nodeId===e)??null});this.activeHitlTextarea=b(()=>this.activeHitlTabEntry()?.textarea??null);this.hitlReplyActionsForActiveTab=b(()=>(this.activeHitlTabEntry()?.actions??[]).filter(e=>!(e.config.kind==="textarea"&&e.config.role==="chat-start")));this.hitlStartActionForActiveTab=b(()=>(this.activeHitlTabEntry()?.actions??[]).filter(e=>e.config.kind==="textarea"&&e.config.role==="chat-start"));this.showTabs=b(()=>this.hitlTabs().length>1);this.footerMode=b(()=>Xh({hasPermissionAsk:this.activePermissionAsk()!==null,hasAskUser:this.activeAskUser()!==null,isRunning:this.execution.isRunning(),hitlTabCount:this.hitlTabs().length}))}selectHitlTab(e){this.selectedHitlTab.set(e)}requestReset(){this.showConversationReset()&&this.pendingReset.set(!0)}cancelReset(){this.pendingReset.set(!1)}confirmReset(){let e=this.boundSessionId();this.pendingReset.set(!1),e!==null&&this.bridge.raw["workflowSession.resetConversation.requested"].next({sessionId:e})}onHitlSubmit(e){this.composer.submitHitl(e)}onEnterActivate(){let e=this.activeAskUser();if(this.footerMode()==="askUser"&&e!==null){this.onAskUserSubmit(e);return}let o=[...this.hitlReplyActionsForActiveTab(),...this.execution.isRunning()?[]:this.hitlStartActionForActiveTab()].at(-1)??null;if(o===null)return;let i=this.composer.composerText(o.nodeId,o.portId),r=sw(o,i);r.ok&&this.onHitlSubmit([o.nodeId,o.portId,r.payload])}onPermissionReply(e,t){this.composer.submitPermissionReply(e,t)}askUserDraft(e){return this.composer.composerText(e.nodeId,_d)}askUserQuestions(e){return e.questions??[]}canSubmitAskUser(e){return Tv(this.askUserDraft(e),this.askUserSelections())}onAskUserSelections(e){this.askUserSelections.set(e)}onAskUserSubmit(e){let t=Rv({questions:this.askUserQuestions(e),selections:this.askUserSelections(),freeform:this.askUserDraft(e)});this.composer.submitAskUserReply(e,t),this.askUserSelections.set(new Map)}permissionAskMeta(e){let t=`${this.execution.nodeLabel(e.nodeId)} \xB7 ${e.toolId}`;return e.detail.length>0?`${t} \xB7 ${e.detail}`:t}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-composer-shell"]],hostAttrs:[1,"block","shrink-0"],inputs:{height:[1,"height"]},decls:13,vars:6,consts:[[1,"relative","overflow-hidden","border-t","border-zinc-200","bg-white","dark:border-zinc-800","dark:bg-zinc-900"],[1,"lf-scroll","absolute","inset-0","z-0","flex","flex-col","gap-2","overflow-y-auto","p-4","pb-14"],[1,"absolute","inset-0","z-0","flex","min-h-0","flex-col","pb-14"],[1,"pointer-events-none","absolute","inset-0","z-[1]","flex","items-center","justify-center","px-3","text-xs","font-medium","tracking-wide","text-zinc-500","dark:text-zinc-400"],[1,"absolute","inset-x-0","bottom-0","z-[3]","flex","min-h-[calc(var(--lf-control-h)+1.1rem)]","items-center","bg-gradient-to-t","from-white","from-45%","to-transparent","px-3","py-2","dark:from-zinc-900"],[1,"flex","w-full","items-center","justify-between","gap-3"],[1,"flex","w-full","items-center","gap-2"],[1,"flex","w-full","flex-col","items-stretch","gap-2"],["role","alertdialog","aria-labelledby","reset-session-title","aria-describedby","reset-session-desc",1,"absolute","bottom-16","left-3","z-20","w-72","rounded-lg","border","border-zinc-200","bg-white","p-4","shadow-lg","dark:border-zinc-700","dark:bg-zinc-900"],[1,"text-[11px]","font-medium","uppercase","tracking-wide","text-amber-700","dark:text-amber-300"],[1,"text-sm","leading-5","text-zinc-800","dark:text-zinc-100"],[1,"text-[11px]","leading-4","text-zinc-500","dark:text-zinc-400"],[1,"lf-scroll","min-h-0","max-h-[55%]","shrink-0","overflow-y-auto","border-b","border-zinc-200","px-3","py-2","dark:border-zinc-800",3,"askId","headline","questions"],[1,"min-h-0","flex-1",3,"enterActivate","nodeId","portId","config"],[1,"lf-scroll","min-h-0","max-h-[55%]","shrink-0","overflow-y-auto","border-b","border-zinc-200","px-3","py-2","dark:border-zinc-800",3,"selectionsChange","askId","headline","questions"],[1,"absolute","inset-0","z-0","p-4","pb-14","text-[11px]","leading-4","text-zinc-400","dark:text-zinc-500"],[1,"lf-scroll","absolute","inset-x-0","top-0","z-[3]","flex","items-center","gap-1","overflow-x-auto","bg-gradient-to-b","from-white","from-40%","to-transparent","px-2","py-1.5","dark:from-zinc-900"],[1,"absolute","inset-0","z-0",3,"nodeId","portId","config","padTopForTabs"],["type","button",1,"rounded-md","px-2.5","py-1","text-[11px]","font-medium","transition",3,"bg-zinc-900","text-white","text-zinc-600","hover:bg-zinc-100","ring-2","ring-violet-400","dark:text-zinc-300","dark:hover:bg-zinc-800"],["type","button",1,"rounded-md","px-2.5","py-1","text-[11px]","font-medium","transition",3,"click","mouseenter","mouseleave"],[1,"absolute","inset-0","z-0",3,"enterActivate","nodeId","portId","config","padTopForTabs"],[1,"flex","w-full","items-center","justify-end","gap-2"],["tip","Deny this tool permission ask"],["type","button",1,"lf-composer-pill","border","border-zinc-200","text-zinc-700","hover:bg-zinc-100","dark:border-zinc-700","dark:text-zinc-200","dark:hover:bg-zinc-800",3,"click"],["tip","Allow this tool permission ask"],["type","button",1,"lf-composer-pill","border","border-zinc-900","bg-zinc-900","text-white","hover:bg-zinc-800","dark:border-zinc-100","dark:bg-zinc-100","dark:text-zinc-900","dark:hover:bg-zinc-200",3,"click"],[3,"compact"],[3,"tip"],["type","button",1,"lf-composer-pill","ml-auto","border","border-zinc-900","bg-zinc-900","text-white","hover:bg-zinc-800","disabled:opacity-50","dark:border-zinc-100","dark:bg-zinc-100","dark:text-zinc-900","dark:hover:bg-zinc-200",3,"click","disabled"],[1,"mr-auto","flex","shrink-0","items-center","gap-2"],[1,"mr-auto","flex","shrink-0","items-center"],[1,"ml-auto","flex","min-w-0","flex-wrap","items-center","justify-end","gap-2"],[1,"flex","items-center","gap-2",3,"entries"],[1,"flex","items-center",3,"entries"],["align","start","side","top","tip","Clear this session's conversation. The graph stays."],["type","button","aria-label","Reset session",1,"lf-composer-icon-btn","border","border-zinc-300","text-zinc-500","hover:text-zinc-800","dark:border-zinc-600","dark:text-zinc-400","dark:hover:text-zinc-100",3,"click"],["viewBox","0 0 20 20","fill","none","stroke","currentColor","stroke-width","1.5","aria-hidden","true",1,"h-4","w-4"],["d","M4.5 10a5.5 5.5 0 0 1 9.4-3.9L16 8"],["d","M16 4.5V8h-3.5"],["d","M15.5 10a5.5 5.5 0 0 1-9.4 3.9L4 12"],["d","M4 15.5V12h3.5"],[1,"flex","items-center","gap-2",3,"submitted","entries"],[1,"flex","items-center",3,"submitted","entries"],[1,"w-full"],["id","reset-session-title",1,"text-sm","font-semibold","text-zinc-900","dark:text-zinc-100"],["id","reset-session-desc",1,"mt-2","text-xs","leading-5","text-zinc-500","dark:text-zinc-400"],[1,"mt-4","flex","justify-end","gap-2"],["type","button",1,"rounded-md","border","border-zinc-200","px-3","py-1","text-xs","font-medium","text-zinc-700","transition","hover:bg-zinc-100","dark:border-zinc-700","dark:text-zinc-200","dark:hover:bg-zinc-800",3,"click"],["type","button",1,"rounded-md","border","border-zinc-300","bg-zinc-50","px-3","py-1","text-xs","font-medium","text-zinc-800","transition","hover:bg-zinc-100","dark:border-zinc-600","dark:bg-zinc-800","dark:text-zinc-100","dark:hover:bg-zinc-700",3,"click"]],template:function(t,o){if(t&1&&(y(0,"section",0),P(1,XM,7,2,"div",1)(2,JM,3,4,"div",2)(3,t2,1,1)(4,r2,2,2),P(5,s2,2,0,"p",3),y(6,"div",4),P(7,d2,1,1)(8,u2,1,1)(9,p2,3,1,"div",5)(10,y2,7,4,"div",6)(11,v2,3,0,"div",7),m(),P(12,w2,10,0,"div",8),m()),t&2){let i,r;Ze("height",o.height(),"px"),u(),E((i=o.activePermissionAsk())?1:(i=o.activeAskUser())?2:o.hitlTabs().length===0?3:4,i),u(4),E(o.footerMode()==="working"?5:-1),u(2),E((r=o.footerMode())==="permission"?7:r==="askUser"?8:r==="working"?9:r==="hitl"?10:11),u(5),E(o.pendingReset()?12:-1)}},dependencies:[Id,Ed,Pd,Sd,xd,Ue,vd],encapsulation:2})}};var lw=n=>n<0?"unpin":n>0?"maybe-repin":"ignore",cw=n=>n>8?"unpin":n<-8?"maybe-repin":"ignore",uw=n=>n==="ArrowUp"||n==="PageUp"||n==="Home"?"unpin":n==="ArrowDown"||n==="PageDown"||n==="End"?"maybe-repin":"ignore";var pw=(n,e=24)=>n<=e,tf=(n,e,t,o=24)=>n-e-t<=o;var b2=10,C2=2,fw=400,_2=24,nf=48,Ri=()=>({start:0,end:0}),Dd=(n,e)=>n.start===e.start&&n.end===e.end;var x2=(n,e)=>e>0&&n.end===e,No=(n,e)=>{if(e<=0)return Ri();let t=Math.max(0,Math.min(n.start,e)),o=Math.max(t,Math.min(n.end,e));return{start:t,end:o}},Td=(n,e)=>No(n,e),of=(n,e,t)=>{if(e<=0)return"rendering 0 of 0 items";let o=No(n,e);return`rendering ${t==="start"?o.start+1:o.end} of ${e} items`},gw=(n,e)=>n.slice(e.start,e.end),rf=(n,e,t,o)=>{let i=Math.max(0,e),r=Math.min(n.length,t),s=0;for(let a=i;a<r;a++)s+=o.get(n[a]??"")??0;return s},mw=(n,e,t,o,i,r)=>x2(n,e)&&tf(t,o,i,r),yw=(n,e,t)=>{let o=No(n,e);return o.start===o.end?o:t==="start"?o.start<=0?o:{start:o.start-1,end:o.end-1}:o.end>=e?o:{start:o.start+1,end:o.end+1}},vw=(n,e,t,o,i)=>{if(e<=0)return;let r=No(n,e),s=pw(o)&&r.start>0,a=tf(t,o,i)&&r.end<e;if(s&&!a)return"start";if(a&&!s)return"end"},sf=(n,e,t,o,i)=>{let r=No(n,e.length);if(r.start===r.end)return r;let s=Math.max(0,o),a=s+Math.max(i,1),d=0,l,h=r.start;for(let g=r.start;g<r.end;g++){let _=Qr(e,t,g),D=d;if(d+_>s&&D<a)l===void 0&&(l=g),h=g+1;else if(l!==void 0&&D>=a)break;d+=_}return l===void 0?k2(r,e,t,s):{start:l,end:h}},Zr=(n,e,t,o,i)=>{let r=t.length;if(r<=0)return Ri();let s=I2(n,e,r),a=S2(i);return{start:bw(s.start,t,o,a),end:ww(s.end,t,o,a)}},af=(n,e,t,o,i)=>{let r=t.length,s=No(n,r),a=No(e,r);if(r<=0||a.start===a.end)return!1;let d=E2(i),l=hw(t,s.start,a.start,o),h=hw(t,a.end,s.end,o),g=s.start>0&&l<d,_=s.end<r&&h<d;return g||_},Xr=(n,e,t,o)=>{let i=n.length;if(i<=0)return Ri();let r=P2(t);return o==="head"?Zr(0,ww(0,n,e,r),n,e,t):Zr(bw(i,n,e,r),i,n,e,t)},S2=n=>n>0?n*b2:Number.POSITIVE_INFINITY,P2=n=>n>0?n:Number.POSITIVE_INFINITY,E2=n=>n>0?n*C2:0,Qr=(n,e,t)=>{let o=e.get(n[t]??"");return o!==void 0&&o>0?o:_2},hw=(n,e,t,o)=>{let i=Math.max(0,e),r=Math.min(n.length,t),s=0;for(let a=i;a<r;a++)s+=Qr(n,o,a);return s},I2=(n,e,t)=>{let o=Math.max(0,Math.min(n,t)),i=Math.max(o,Math.min(e,t));return i>o?{start:o,end:i}:o<t?{start:o,end:o+1}:{start:t-1,end:t}},k2=(n,e,t,o)=>{let i=0;for(let r=n.start;r<n.end;r++){let s=i+Qr(e,t,r);if(o<s||r===n.end-1)return{start:r,end:r+1};i=s}return{start:n.start,end:Math.min(n.start+1,n.end)}},ww=(n,e,t,o)=>{let i=e.length,r=Math.max(0,Math.min(n,i)),s=0,a=0;for(;r<i&&a<fw&&!(a>0&&s>=o);)s+=Qr(e,t,r),r+=1,a+=1;return r},bw=(n,e,t,o)=>{let i=e.length,r=Math.max(0,Math.min(n,i)),s=0,a=0;for(;r>0&&a<fw&&!(a>0&&s>=o);)r-=1,s+=Qr(e,t,r),a+=1;return r};var Cw=(n,e,t)=>t>0&&n>=e-t;var df=(n,e,t)=>`${n}:${e}:${t}`;var _w=n=>{let e=Math.max(0,Math.round(n/1e3)),t=Math.floor(e/60),o=e%60;return t===0?`${o}s`:`${t}m ${o}s`},D2=n=>{switch(n){case"dead-loop":return"dead loop";case"rate-limit":return"rate limit";case"provider-unavailable":return"provider error";case"network":return"network error";default:return"idle stream"}},lf=n=>`Retrying ${D2(n.reason)} \xB7 retry ${n.attempt??1}`,xw=(n,e)=>{let t=lf(n),o=n.lastAttemptAt===void 0?"first wait":`Last retry ${_w(e-n.lastAttemptAt)} ago`,i=n.nextAttemptAt===void 0?0:n.nextAttemptAt-e;return i<=0?`${t}
|
|
315
|
+
${o}`:`${t}
|
|
316
|
+
${o} \xB7 next in ${_w(i)}`};var cf=n=>n.length<=200?n:`${n.slice(0,200)}\u2026`,T2=n=>{for(let e of n.split(`
|
|
317
|
+
`)){let t=e.trim();if(t.length>0)return t}return""},M2=n=>{let e=n.split(`
|
|
318
|
+
`);for(let t=e.length-1;t>=0;t-=1){let o=e[t]?.trim()??"";if(o.length>0)return o}return""},Sw=n=>{if(n==null)return"(empty)";if(typeof n=="string"){let e=M2(n);return e.length===0?"(empty)":cf(e)}if(n instanceof Error){let e=n.message.length>0?n.message:String(n),t=T2(e);return cf(t.length>0?t:e)}return typeof n=="object"?"JSON":cf(String(n))};var Pw=(n,e)=>`${n} \u2014 ${Sw(e)}`,uf=n=>Zt(n.value),Ew=(n,e,t)=>sa(n.value)&&n.value.code==="retry"&&n.value.nextAttemptAt!==void 0?t?xw(n.value,e):lf(n.value):uf(n),Iw=n=>{switch(n.meta.presentation){case"reasoning":return"Reasoning";case"progress":return"PROGRESS";case"draft":return"Draft";case"tool":case"tool-request":case"tool-response":return"Tool";case"shell":return"Shell";case"result":return"Response";case"recovery":return"Recovery";case"error":return"Error";case"permission-ask":return"Permission";case"permission-grant":return"Permission allowed";case"permission-deny":return"Permission denied";case"ask-user-ask":return"Ask";case"ask-user-reply":return"User";case"hitl-user":return"User";case"steering-pause":return"Paused";case"steering-resume":return"Resumed";default:return"Data"}};var R2=n=>{let e=n.replace(/\s+/g," ").trim();return e.length<=80?e:`${e.slice(0,79)}\u2026`},kw=n=>`${n.name.length>0?n.name:"(tool)"}(${R2(n.args)})`,Dw=n=>!("result"in n)||n.result===void 0?n.args:n.args.length===0?n.result:n.result.length===0?n.args:`${n.args}
|
|
319
|
+
${n.result}`;function N2(n,e){if(n&1&&(O(0,"pre",2),w(1),N()),n&2){let t=c();tt(t.bodyClass()),u(),ue(t.formatPortValue(t.value()))}}var Md=class n{constructor(){this.open=Eg(!1);this.summary=T.required();this.value=T.required();this.detailsClass=T("");this.summaryClass=T("");this.bodyClass=T("mt-1");this.formatPortValue=Zt}onToggle(e){let t=e.target;t instanceof HTMLDetailsElement&&this.open.set(t.open)}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-feed-collapsible"]],inputs:{open:[1,"open"],summary:[1,"summary"],value:[1,"value"],detailsClass:[1,"detailsClass"],summaryClass:[1,"summaryClass"],bodyClass:[1,"bodyClass"]},outputs:{open:"openChange"},decls:4,vars:7,consts:[[3,"toggle","open"],[1,"max-w-full","min-w-0","whitespace-pre-wrap","break-words","font-sans","[overflow-wrap:anywhere]",3,"class"],[1,"max-w-full","min-w-0","whitespace-pre-wrap","break-words","font-sans","[overflow-wrap:anywhere]"]],template:function(t,o){t&1&&(O(0,"details",0),ge("toggle",function(r){return o.onToggle(r)}),O(1,"summary"),w(2),N(),P(3,N2,2,3,"pre",1),N()),t&2&&(tt("min-w-0 w-full max-w-full text-[11px] text-zinc-500 dark:text-zinc-400 "+o.detailsClass()),he("open",o.open()),u(),tt("cursor-pointer select-none list-none truncate [&::-webkit-details-marker]:hidden "+o.summaryClass()),u(),H(" ",o.summary()," "),u(),E(o.open()?3:-1))},encapsulation:2})}};var pf=n=>({$implicit:n}),Nd=(n,e)=>({$implicit:n,label:e,detailsClass:"border-0 bg-transparent",summaryClass:"text-zinc-400 dark:text-zinc-500",bodyClass:"mt-0.5"}),O2=(n,e)=>({$implicit:n,label:e,detailsClass:"",summaryClass:"",bodyClass:"mt-1"});function A2(n,e){n&1&&(y(0,"span",5),w(1,"working\u2026"),m())}function L2(n,e){if(n&1&&(y(0,"header",3),w(1),P(2,A2,2,0,"span",5),m()),n&2){let t=c(),o=c();u(),H(" ",o.execution.nodeLabel(t.nodeId)," "),u(),E(!t.isClosed&&!t.hasLiveRecovery&&o.execution.isRunning()?2:-1)}}function F2(n,e){if(n&1&&(y(0,"div",4),$t(1,6),m()),n&2){let t=c();c();let o=Le(2);u(),M("ngTemplateOutlet",o)("ngTemplateOutletContext",In(2,pf,t))}}function z2(n,e){if(n&1&&P(0,L2,3,2,"header",3)(1,F2,2,4,"div",4),n&2){let t;E((t=e.kind)==="header"?0:t==="item"?1:-1)}}function $2(n,e){if(n&1&&(y(0,"div",7)(1,"pre",12),w(2),m()()),n&2){let t=c().$implicit,o=c();u(2),ue(o.itemText(o.itemOf(t)))}}function B2(n,e){if(n&1&&(y(0,"div",7)(1,"pre",12),w(2),m()()),n&2){let t=c().$implicit,o=c();u(2),ue(o.itemText(o.itemOf(t)))}}function H2(n,e){if(n&1&&(y(0,"div",8),F(1,"div",13),m()),n&2){let t=c().$implicit,o=c();u(),M("innerHTML",o.markdownHtml(o.itemText(o.itemOf(t))),tn)}}function U2(n,e){if(n&1&&(y(0,"div",8),F(1,"div",13),m()),n&2){let t=c().$implicit,o=c();u(),M("innerHTML",o.markdownHtml(o.itemText(o.itemOf(t))),tn)}}function V2(n,e){if(n&1&&(y(0,"p",9),w(1),m()),n&2){let t=c().$implicit,o=c();u(),H(" Permission: ",o.itemText(o.itemOf(t))," ")}}function j2(n,e){if(n&1&&(y(0,"p",9),w(1),m()),n&2){let t=c().$implicit,o=c();u(),H(" Permission allowed: ",o.itemText(o.itemOf(t))," ")}}function W2(n,e){if(n&1&&(y(0,"p",9),w(1),m()),n&2){let t=c().$implicit,o=c();u(),H(" Permission denied: ",o.itemText(o.itemOf(t))," ")}}function G2(n,e){if(n&1&&(y(0,"pre",10),w(1),m()),n&2){let t=c().$implicit,o=c();u(),ue(o.recoveryBanner(o.itemOf(t),o.execution.livenessNowMs(),!t.isClosed&&t.isLiveRecovery))}}function q2(n,e){n&1&&(y(0,"span",18),w(1,"running\u2026"),m())}function K2(n,e){if(n&1&&(y(0,"pre",19),w(1),m()),n&2){let t=c(),o=c(3);u(),ue(o.formatToolCallBody(t))}}function Y2(n,e){if(n&1){let t=z();y(0,"details",15),R("toggle",function(i){x(t);let r=c(2).$implicit,s=c();return S(s.onDetailsToggle(r,i))}),y(1,"summary",16)(2,"span",17),w(3),m(),P(4,q2,2,0,"span",18),m(),P(5,K2,2,1,"pre",19),m()}if(n&2){let t=e,o=c(2).$implicit,i=c();M("open",i.isDetailsOpen(o)),u(3),ue(i.formatToolCallSummary(t)),u(),E(i.isUnmatchedToolCall(t)&&!o.isClosed?4:-1),u(),E(i.isDetailsOpen(o)?5:-1)}}function Z2(n,e){if(n&1&&$t(0,6),n&2){let t=c(2).$implicit,o=c(),i=Le(4);M("ngTemplateOutlet",i)("ngTemplateOutletContext",Un(2,Nd,t,o.presentationLabel(o.itemOf(t))))}}function X2(n,e){if(n&1&&P(0,Y2,6,4,"details",14)(1,Z2,1,5,"ng-container",6),n&2){let t,o=c().$implicit,i=c();E((t=i.toolCallOf(i.itemOf(o)))?0:1,t)}}function Q2(n,e){if(n&1&&$t(0,6),n&2){let t=c().$implicit,o=c(),i=Le(4);M("ngTemplateOutlet",i)("ngTemplateOutletContext",Un(2,Nd,t,o.presentationLabel(o.itemOf(t))))}}function J2(n,e){if(n&1&&$t(0,6),n&2){let t=c().$implicit,o=c(),i=Le(4);M("ngTemplateOutlet",i)("ngTemplateOutletContext",Un(2,Nd,t,o.presentationLabel(o.itemOf(t))))}}function eR(n,e){if(n&1&&$t(0,6),n&2){let t=c().$implicit,o=c(),i=Le(4);M("ngTemplateOutlet",i)("ngTemplateOutletContext",Un(2,Nd,t,o.presentationLabel(o.itemOf(t))))}}function tR(n,e){n&1&&(y(0,"span",21),w(1,"streaming\u2026"),m())}function nR(n,e){if(n&1&&(y(0,"div",11)(1,"div",20)(2,"span"),w(3,"draft"),m(),P(4,tR,2,0,"span",21),m(),y(5,"div",8),F(6,"div",13),m()()),n&2){let t=c().$implicit,o=c();u(4),E(!t.isClosed&&t.isLastSegment?4:-1),u(2),M("innerHTML",o.markdownHtml(o.itemText(o.itemOf(t))),tn)}}function oR(n,e){if(n&1&&$t(0,6),n&2){let t=c().$implicit;c();let o=Le(6);M("ngTemplateOutlet",o)("ngTemplateOutletContext",In(2,pf,t))}}function iR(n,e){if(n&1&&$t(0,6),n&2){let t=c().$implicit;c();let o=Le(6);M("ngTemplateOutlet",o)("ngTemplateOutletContext",In(2,pf,t))}}function rR(n,e){if(n&1&&$t(0,6),n&2){let t=c().$implicit,o=c(),i=Le(4);M("ngTemplateOutlet",i)("ngTemplateOutletContext",Un(2,O2,t,o.itemOf(t).meta.presentation==="data"?t.portId:o.presentationLabel(o.itemOf(t))))}}function sR(n,e){if(n&1&&P(0,$2,3,1,"div",7)(1,B2,3,1,"div",7)(2,H2,2,1,"div",8)(3,U2,2,1,"div",8)(4,V2,2,1,"p",9)(5,j2,2,1,"p",9)(6,W2,2,1,"p",9)(7,G2,2,1,"pre",10)(8,X2,2,1)(9,Q2,1,5,"ng-container",6)(10,J2,1,5,"ng-container",6)(11,eR,1,5,"ng-container",6)(12,nR,7,2,"div",11)(13,oR,1,4,"ng-container",6)(14,iR,1,4,"ng-container",6)(15,rR,1,5,"ng-container",6),n&2){let t,o=e.$implicit,i=c();E((t=i.itemOf(o).meta.presentation)==="hitl-user"?0:t==="ask-user-reply"?1:t==="result"?2:t==="ask-user-ask"?3:t==="permission-ask"?4:t==="permission-grant"?5:t==="permission-deny"?6:t==="recovery"?7:t==="tool"?8:t==="tool-request"?9:t==="tool-response"?10:t==="shell"?11:t==="draft"?12:t==="reasoning"?13:t==="progress"?14:15)}}function aR(n,e){if(n&1){let t=z();y(0,"lf-feed-collapsible",22),R("openChange",function(i){let r=x(t).$implicit,s=c();return S(s.onDetailsOpen(r,i))}),m()}if(n&2){let t=e.$implicit,o=e.label,i=e.detailsClass,r=e.summaryClass,s=e.bodyClass,a=c();M("summary",a.collapsedSummary(o,a.itemOf(t).value))("value",a.itemOf(t).value)("open",a.isDetailsOpen(t))("detailsClass",i)("summaryClass",r)("bodyClass",s)}}function dR(n,e){if(n&1&&(y(0,"div",23)(1,"div",20)(2,"span"),w(3),m(),y(4,"span",21),w(5,"streaming\u2026"),m()(),y(6,"div",25)(7,"div",26)(8,"pre",27),w(9),m()()()()),n&2){let t=c().$implicit,o=c();u(3),ue(o.presentationLabel(o.itemOf(t))),u(6),ue(o.itemText(o.itemOf(t)))}}function lR(n,e){if(n&1){let t=z();y(0,"lf-feed-collapsible",28),R("openChange",function(i){x(t);let r=c().$implicit,s=c();return S(s.onDetailsOpen(r,i))}),m()}if(n&2){let t=c().$implicit,o=c();M("summary",o.collapsedSummary(o.presentationLabel(o.itemOf(t)),o.itemOf(t).value))("value",o.itemOf(t).value)("open",o.isDetailsOpen(t))}}function cR(n,e){if(n&1&&P(0,dR,10,2,"div",23)(1,lR,1,3,"lf-feed-collapsible",24),n&2){let t=e.$implicit;E(!t.isClosed&&t.isLastSegment?0:1)}}var Rd=class n{constructor(){this.row=T.required();this.openKeys=T.required();this.detailsOpenChange=Ct();this.execution=f(we);this.hover=f(Cn);this.itemText=uf;this.collapsedSummary=Pw;this.presentationLabel=Iw;this.recoveryBanner=Ew;this.formatToolCallSummary=kw;this.formatToolCallBody=Dw;this.isUnmatchedToolCall=bd}isLaterVisitHeader(){let e=this.row();return e.kind==="header"&&!e.isFirstVisit}isLastInVisit(){let e=this.row();return e.kind==="item"&&e.isLastInVisit}isHovered(){return this.hover.isHovered(this.row().nodeId)}onRowEnter(){this.hover.set(this.row().nodeId)}onRowLeave(){this.hover.clear()}itemOf(e){return e.item}toolCallOf(e){return qh(e.value)?e.value:void 0}onDetailsToggle(e,t){let o=t.target;o instanceof HTMLDetailsElement&&this.onDetailsOpen(e,o.open)}markdownHtml(e){return Ei(e)}isDetailsOpen(e){return this.openKeys().has(df(e.visitId,e.segmentId,e.item.seq))}onDetailsOpen(e,t){this.detailsOpenChange.emit({key:df(e.visitId,e.segmentId,e.item.seq),open:t})}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-feed-row"]],hostAttrs:[1,"block","min-w-0","w-full","max-w-full"],hostVars:6,hostBindings:function(t,o){t&1&&R("mouseenter",function(){return o.onRowEnter()})("mouseleave",function(){return o.onRowLeave()}),t&2&&G("lf-feed-row--hovered",o.isHovered())("mt-2",o.isLaterVisitHeader())("pb-2",o.isLastInVisit())},inputs:{row:[1,"row"],openKeys:[1,"openKeys"]},outputs:{detailsOpenChange:"detailsOpenChange"},decls:7,vars:1,consts:[["itemTpl",""],["collapsibleTpl",""],["growingLogTpl",""],[1,"px-2","pt-1.5","text-[11px]","font-medium","text-zinc-600","dark:text-zinc-300"],[1,"min-w-0","w-full","max-w-full","px-2","pt-1"],[1,"ml-1","text-[9px]","text-amber-600","dark:text-amber-400"],[3,"ngTemplateOutlet","ngTemplateOutletContext"],[1,"flex","min-w-0","justify-end"],[1,"flex","min-w-0","justify-start"],[1,"text-[11px]","text-amber-700","dark:text-amber-300"],[1,"min-w-0","max-w-full","whitespace-pre-wrap","break-words","rounded-md","border","border-amber-300/80","bg-amber-50","px-2","py-1.5","font-sans","text-[11px]","text-amber-900","wrap-anywhere","dark:border-amber-700/60","dark:bg-amber-950/40","dark:text-amber-100"],[1,"flex","w-full","flex-col","gap-0.5"],[1,"max-w-[92%]","min-w-0","whitespace-pre-wrap","break-words","rounded-2xl","rounded-tr-md","border","border-zinc-300","bg-zinc-200","px-3","py-1.5","font-sans","text-[12px]","leading-5","text-zinc-900","wrap-anywhere","dark:border-zinc-600","dark:bg-zinc-800","dark:text-zinc-100"],[1,"lf-feed-md","max-w-[92%]","min-w-0","rounded-2xl","rounded-tl-md","border","border-zinc-200","bg-white","px-3","py-2","text-[12px]","leading-5","text-zinc-800","dark:border-zinc-600","dark:bg-zinc-950","dark:text-zinc-100",3,"innerHTML"],[1,"min-w-0","w-full","max-w-full","border-0","bg-transparent","text-[11px]","text-zinc-500","dark:text-zinc-400",3,"open"],[1,"min-w-0","w-full","max-w-full","border-0","bg-transparent","text-[11px]","text-zinc-500","dark:text-zinc-400",3,"toggle","open"],[1,"flex","min-w-0","cursor-pointer","select-none","list-none","items-baseline","gap-1","text-zinc-400","[&::-webkit-details-marker]:hidden","dark:text-zinc-500"],[1,"min-w-0","truncate"],[1,"shrink-0","text-[9px]","font-medium","normal-case","tracking-normal","text-amber-600","dark:text-amber-400"],[1,"mt-0.5","max-w-full","min-w-0","whitespace-pre-wrap","break-words","font-sans","[overflow-wrap:anywhere]"],[1,"flex","min-w-0","items-baseline","gap-1","text-[9px]","font-medium","uppercase","tracking-wide","text-zinc-400","dark:text-zinc-500"],[1,"normal-case","tracking-normal","text-amber-600","dark:text-amber-400"],[3,"openChange","summary","value","open","detailsClass","summaryClass","bodyClass"],[1,"flex","min-w-0","flex-col","gap-0.5"],["summaryClass","text-zinc-600 dark:text-zinc-300",3,"summary","value","open"],[1,"h-[2lh]","min-w-0","w-full","overflow-hidden","text-[11px]","leading-4","text-zinc-600","dark:text-zinc-300"],[1,"flex","h-full","min-h-0","flex-col","justify-end"],[1,"min-w-0","max-w-full","whitespace-pre-wrap","break-words","font-sans","wrap-anywhere"],["summaryClass","text-zinc-600 dark:text-zinc-300",3,"openChange","summary","value","open"]],template:function(t,o){if(t&1&&(P(0,z2,2,1),jo(1,sR,16,1,"ng-template",null,0,Cs)(3,aR,1,6,"ng-template",null,1,Cs)(5,cR,2,1,"ng-template",null,2,Cs)),t&2){let i;E((i=o.row())?0:-1,i)}},dependencies:[ql,Md],encapsulation:2})}};var uR=["feedViewport"],pR=["feedList"],hR=(n,e)=>e.rowId;function fR(n,e){if(n&1){let t=z();y(0,"lf-hover-tip",5)(1,"button",8),R("click",function(){x(t);let i=c();return S(i.clearFeed())}),w(2," Clear "),m()()}}function gR(n,e){n&1&&(y(0,"p",6),w(1," Run the workflow to see execution progress here. "),m())}function mR(n,e){if(n&1&&(y(0,"p",10),w(1),m()),n&2){let t=c(2);u(),H(" ",t.olderProgressLabel()," ")}}function yR(n,e){if(n&1){let t=z();y(0,"lf-feed-row",14),R("detailsOpenChange",function(i){x(t);let r=c(2);return S(r.onDetailsOpenChange(i))}),m()}if(n&2){let t=e.$implicit,o=c(2);M("row",t)("openKeys",o.openKeys())}}function vR(n,e){if(n&1&&(y(0,"p",10),w(1),m()),n&2){let t=c(2);u(),H(" ",t.newerProgressLabel()," ")}}function wR(n,e){if(n&1){let t=z();y(0,"div",13)(1,"lf-hover-tip",15)(2,"button",16),R("click",function(){x(t);let i=c(2);return S(i.scrollToBottom())}),w(3," \u2193 New events "),m()()()}}function bR(n,e){if(n&1){let t=z();y(0,"div",7)(1,"div",9,0),R("scroll",function(){x(t);let i=c();return S(i.onScroll())})("wheel",function(i){x(t);let r=c();return S(r.onWheel(i))})("keydown",function(i){x(t);let r=c();return S(r.onKeyDown(i))})("touchstart",function(i){x(t);let r=c();return S(r.onTouchStart(i))})("touchmove",function(i){x(t);let r=c();return S(r.onTouchMove(i))})("pointerdown",function(i){x(t);let r=c();return S(r.onPointerDown(i))})("pointerup",function(){x(t);let i=c();return S(i.onPointerUp())})("pointercancel",function(){x(t);let i=c();return S(i.onPointerUp())}),P(3,mR,2,1,"p",10),y(4,"div",11,1),X(6,yR,1,2,"lf-feed-row",12,hR),m(),P(8,vR,2,1,"p",10),m(),P(9,wR,4,0,"div",13),m()}if(n&2){let t=c();u(3),E(t.hasOlderRows()?3:-1),u(),G("min-h-full",t.alignTailToBottom())("flex",t.alignTailToBottom())("flex-col",t.alignTailToBottom())("justify-end",t.alignTailToBottom()),u(2),Q(t.visibleRows()),u(2),E(t.hasNewerRows()?8:-1),u(),E(t.pinnedToBottom()?-1:9)}}var Od=class n{constructor(){this.feed=f(Ti);this.execution=f(we);this.bridge=f(ie);this.destroyRef=f(je);this.ngZone=f(en);this.injector=f(wt);this.pinnedToBottom=U(!0);this.openKeys=U(new Set);this.rows=oe(this.feed.feedRows$,{initialValue:[]});this.visibleRows=b(()=>gw(this.rows(),this.feedWindow()));this.alignTailToBottom=b(()=>{if(!this.pinnedToBottom())return!1;let e=this.rows(),t=this.feedWindow();if(e.length===0||t.end!==e.length)return!1;let o=this.viewportPx();if(o<=0)return!1;let i=rf(this.rowIdList(e),t.start,t.end,this.rowHeights());return i>0&&i<=o});this.hasOlderRows=b(()=>this.feedWindow().start>0);this.hasNewerRows=b(()=>{let e=this.rows(),t=this.feedWindow();return e.length>0&&t.end<e.length});this.olderProgressLabel=b(()=>of(this.feedWindow(),this.rows().length,"start"));this.newerProgressLabel=b(()=>of(this.feedWindow(),this.rows().length,"end"));this.feedWindow=U(Ri());this.rowHeights=U(new Map);this.viewportRef=Xe("feedViewport");this.listRef=Xe("feedList");this.layout$=new ot;this.slide$=new ot;this.programmaticScroll=!1;this.programmaticScrollClear=0;this.scrollbarDrag=!1;this.windowPaintQueued=!1;this.dragSlideTimer=0;xe(()=>{let e=this.rows();ye(()=>{this.syncWindowFromRows(e)})}),this.layout$.pipe(fs(0),ht(this.destroyRef)).subscribe(()=>{this.ngZone.run(()=>{this.flushLayout()})}),this.slide$.pipe(ig(nf),ht(this.destroyRef)).subscribe(()=>{this.ngZone.run(()=>{this.flushRecenter()})}),this.destroyRef.onDestroy(()=>{this.layout$.complete(),this.slide$.complete(),this.stopDragSlide(),this.clearProgrammaticScroll(),this.resizeObserver?.disconnect()})}clearFeed(){this.bridge.raw["runner.executionFeed.clear.requested"].next({})}onWheel(e){this.applyPinGesture(lw(e.deltaY)),this.requestRecenter()}onKeyDown(e){if(e.key==="Home"){e.preventDefault(),this.jumpToHead();return}if(e.key==="End"){e.preventDefault(),this.scrollToBottom();return}this.applyPinGesture(uw(e.key)),this.requestRecenter()}onTouchStart(e){this.lastTouchY=e.touches[0]?.clientY}onTouchMove(e){let t=e.touches[0]?.clientY;if(this.lastTouchY===void 0||t===void 0)return;let o=t-this.lastTouchY;this.lastTouchY=t,this.applyPinGesture(cw(o)),this.requestRecenter()}onPointerDown(e){let t=this.viewportRef()?.nativeElement;if(t===void 0)return;let o=t.getBoundingClientRect(),i=t.offsetWidth-t.clientWidth;if(Cw(e.clientX,o.right,i)){this.scrollbarDrag=!0,t.setPointerCapture(e.pointerId);return}t.focus({preventScroll:!0})}onPointerUp(){this.scrollbarDrag&&(this.scrollbarDrag=!1,this.stopDragSlide(),this.applyPinFromGeometry(),this.flushRecenter())}onScroll(){if(this.programmaticScroll){this.clearProgrammaticScroll();return}if(this.scrollbarDrag){this.applyPinFromGeometry(),this.syncDragSlide();return}this.requestRecenter()}scrollToBottom(){this.pinnedToBottom.set(!0),this.setWindow(Xr(this.rowIdList(this.rows()),this.rowHeights(),this.viewportPx(),"tail")),this.scheduleLayout()}onDetailsOpenChange(e){this.openKeys.update(t=>{let o=new Set(t);return e.open?o.add(e.key):o.delete(e.key),o}),this.scheduleLayout()}jumpToHead(){this.pinnedToBottom.set(!1),this.setWindow(Xr(this.rowIdList(this.rows()),this.rowHeights(),this.viewportPx(),"head"));let e=this.viewportRef()?.nativeElement;e!==void 0&&(this.programmaticScroll=!0,e.scrollTop=0,this.queueClearProgrammaticScroll()),this.scheduleLayout()}syncWindowFromRows(e){if(e.length===0){this.resetWindow();return}let t=this.rowIdList(e),o=this.rowHeights(),i=this.viewportPx();this.scrollbarDrag?this.setWindow(Td(this.feedWindow(),e.length)):this.pinnedToBottom()?this.setWindow(Xr(t,o,i,"tail")):this.setWindow(Td(this.feedWindow(),e.length)),this.scheduleLayout()}resetWindow(){this.feedWindow.set(Ri()),this.rowHeights.set(new Map),this.pendingAnchorStart=void 0,this.pendingDragSlide=void 0,this.stopDragSlide(),this.pinnedToBottom.set(!0),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.observedViewportEl=void 0}requestRecenter(){this.scrollbarDrag||this.slide$.next()}syncDragSlide(){if(!this.scrollbarDrag){this.stopDragSlide();return}let e=this.viewportRef()?.nativeElement;if(e===void 0){this.stopDragSlide();return}let t=vw(this.feedWindow(),this.rows().length,e.scrollHeight,e.scrollTop,e.clientHeight);if(t===void 0){this.stopDragSlide();return}this.startDragSlide(t)}startDragSlide(e){this.dragSlideEdge===e&&this.dragSlideTimer!==0||(this.stopDragSlide(),this.dragSlideEdge=e,this.nibbleDragWindow(e),this.ngZone.runOutsideAngular(()=>{this.dragSlideTimer=window.setInterval(()=>{this.ngZone.run(()=>{let t=this.dragSlideEdge;t!==void 0&&this.nibbleDragWindow(t)})},nf)}))}stopDragSlide(){this.dragSlideTimer!==0&&(clearInterval(this.dragSlideTimer),this.dragSlideTimer=0),this.dragSlideEdge=void 0}nibbleDragWindow(e){let t=this.feedWindow(),o=yw(t,this.rows().length,e);if(Dd(t,o)){this.stopDragSlide();return}this.pendingDragSlide=e,this.setWindow(o)}flushRecenter(){if(this.scrollbarDrag)return;let e=this.viewportRef()?.nativeElement,t=this.rows();if(e===void 0||t.length===0||this.pinnedToBottom())return;let o=this.rowIdList(t),i=this.rowHeights(),r=this.feedWindow(),s=sf(r,o,i,e.scrollTop,e.clientHeight);if(!af(r,s,o,i,e.clientHeight))return;let a=Zr(s.start,s.end,o,i,e.clientHeight);Dd(r,a)||(this.setWindow(a),this.scheduleLayout())}flushLayout(){if(this.attachResizeObserver(),this.measureRowHeights(),this.scrollbarDrag)return;let e=this.rows();if(e.length===0)return;let t=this.rowIdList(e),o=this.rowHeights(),i=this.viewportPx(),r=this.pinnedToBottom()?Xr(t,o,i,"tail"):this.nextUnpinnedLayoutWindow(t,o,i);this.setWindow(r),this.queueAfterWindowPaint()}queueAfterWindowPaint(){this.windowPaintQueued||(this.windowPaintQueued=!0,Gt(()=>{this.windowPaintQueued=!1;let e=this.pendingDragSlide;this.pendingDragSlide=void 0;let t=this.viewportRef()?.nativeElement;if(e!==void 0&&t!==void 0){this.pendingAnchorStart=void 0,this.measureRowHeights(),this.programmaticScroll=!0,t.scrollTop=e==="start"?0:t.scrollHeight,this.queueClearProgrammaticScroll();return}let o=this.rows();this.measureRowHeights(),this.applyPrependCorrection(this.rowIdList(o)),this.stickToBottomIfPinned()},{injector:this.injector}))}nextUnpinnedLayoutWindow(e,t,o){let i=Td(this.feedWindow(),e.length),r=this.viewportRef()?.nativeElement,s=sf(i,e,t,r?.scrollTop??0,r?.clientHeight??o),a=Zr(s.start,s.end,e,t,o);return af(i,s,e,t,o)||a.start>=i.start&&a.end<=i.end?a:i}measureRowHeights(){let e=this.listRef()?.nativeElement,t=this.visibleRows();if(e===void 0||t.length===0)return;let o=new Map(this.rowHeights()),i=!1;for(let r=0;r<t.length;r++){let s=e.children[r];if(!(s instanceof HTMLElement))continue;let a=t[r]?.rowId;if(a===void 0)continue;let d=s.offsetHeight;o.get(a)!==d&&(o.set(a,d),i=!0)}i&&this.rowHeights.set(o)}applyPrependCorrection(e){let t=this.pendingAnchorStart,o=this.viewportRef()?.nativeElement;if(this.pendingAnchorStart=void 0,t===void 0||o===void 0)return;let i=this.feedWindow().start;if(i>=t)return;let r=rf(e,i,t,this.rowHeights());r<=0||(this.programmaticScroll=!0,o.scrollTop+=r,this.queueClearProgrammaticScroll())}setWindow(e){let t=this.feedWindow();Dd(t,e)||(e.start<t.start&&(this.pendingAnchorStart=t.start),this.feedWindow.set(e),this.queueAfterWindowPaint())}attachResizeObserver(){let e=this.viewportRef()?.nativeElement,t=this.listRef()?.nativeElement;e===void 0||t===void 0||this.observedViewportEl===e&&this.resizeObserver!==void 0||(this.resizeObserver?.disconnect(),this.observedViewportEl=e,this.resizeObserver=new ResizeObserver(()=>{this.scheduleLayout()}),this.resizeObserver.observe(e),this.resizeObserver.observe(t))}scheduleLayout(){this.layout$.next()}applyPinGesture(e){if(e==="unpin"){this.pinnedToBottom.set(!1);return}e==="maybe-repin"&&this.queueRepinIfAtBottom()}queueRepinIfAtBottom(){requestAnimationFrame(()=>{this.applyPinFromGeometry(),this.pinnedToBottom()&&this.stickToBottomIfPinned()})}applyPinFromGeometry(){let e=this.viewportRef()?.nativeElement;e!==void 0&&this.pinnedToBottom.set(mw(this.feedWindow(),this.rows().length,e.scrollHeight,e.scrollTop,e.clientHeight))}stickToBottomIfPinned(){if(!this.pinnedToBottom())return;let e=this.viewportRef()?.nativeElement,t=this.rows();e===void 0||this.feedWindow().end!==t.length||(this.programmaticScroll=!0,e.scrollTop=e.scrollHeight,this.queueClearProgrammaticScroll())}queueClearProgrammaticScroll(){this.programmaticScrollClear!==0&&cancelAnimationFrame(this.programmaticScrollClear),this.programmaticScrollClear=requestAnimationFrame(()=>{this.programmaticScrollClear=0,this.programmaticScroll=!1})}clearProgrammaticScroll(){this.programmaticScroll=!1,this.programmaticScrollClear!==0&&(cancelAnimationFrame(this.programmaticScrollClear),this.programmaticScrollClear=0)}viewportPx(){return this.viewportRef()?.nativeElement.clientHeight??0}rowIdList(e){return e.map(t=>t.rowId)}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-work-log-panel"]],viewQuery:function(t,o){t&1&&rt(o.viewportRef,uR,5)(o.listRef,pR,5),t&2&&st(2)},hostAttrs:[1,"block","h-full","min-h-0"],decls:7,vars:2,consts:[["feedViewport",""],["feedList",""],[1,"flex","h-full","min-h-0","flex-col"],[1,"mb-2","flex","shrink-0","items-center","justify-between","gap-2"],[1,"text-[11px]","font-semibold","text-zinc-700","dark:text-zinc-200"],["side","left","align","center","tip","Clear the work log"],[1,"text-xs","leading-5","text-zinc-500","dark:text-zinc-400"],[1,"relative","flex","min-h-0","flex-1","flex-col","overflow-hidden"],["type","button",1,"rounded-md","px-2","py-1","text-[11px]","font-medium","text-zinc-500","transition","hover:bg-zinc-100","hover:text-zinc-700","dark:text-zinc-400","dark:hover:bg-zinc-800","dark:hover:text-zinc-200",3,"click"],["tabindex","0",1,"lf-feed-viewport","lf-scroll","min-h-0","w-full","min-w-0","flex-1","overflow-x-hidden","overflow-y-auto",3,"scroll","wheel","keydown","touchstart","touchmove","pointerdown","pointerup","pointercancel"],[1,"px-1","py-2","text-center","text-[10px]","text-zinc-400","dark:text-zinc-500"],[1,"lf-feed-window","w-full","min-w-0","max-w-full"],[3,"row","openKeys"],[1,"absolute","bottom-1","z-10"],[3,"detailsOpenChange","row","openKeys"],["side","right","align","start","tip","Jump to the latest events"],["type","button",1,"rounded-full","border","border-zinc-200","bg-white","px-2.5","py-1","text-[10px]","font-medium","text-zinc-700","shadow-sm","transition","hover:bg-zinc-100","dark:border-zinc-700","dark:bg-zinc-900","dark:text-zinc-200","dark:hover:bg-zinc-800",3,"click"]],template:function(t,o){t&1&&(y(0,"div",2)(1,"div",3)(2,"span",4),w(3,"Work log"),m(),P(4,fR,3,0,"lf-hover-tip",5),m(),P(5,gR,2,0,"p",6)(6,bR,10,11,"div",7),m()),t&2&&(u(4),E(o.execution.isRunning()?-1:4),u(),E(o.rows().length===0?5:6))},dependencies:[Ue,Rd],encapsulation:2})}};var Ni=class n{constructor(){this.bridge=f(ie);this.paletteVisible$=ee(this.bridge.cached["session.state.snapshot"].pipe(I(e=>e.paletteVisible)),this.bridge.cached["editor.paletteVisible.snapshot"]).pipe(te({bufferSize:1,refCount:!1}))}requestVisible(e){this.bridge.raw["editor.paletteVisible.requested"].next(e)}requestHide(){this.requestVisible(!1)}requestShow(){this.requestVisible(!0)}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275prov=j({token:n,factory:n.\u0275fac,providedIn:"root"})}};var Nw={sections:[{source:"system",categories:[]},{source:"custom",categories:[]}],customStatus:"not_compiled",customErrors:[]},Oi="Advanced",CR=["system","custom"],Tw=["AI","Embeddings","Tools","Primitives","Logic","Flow","Text","Output","HITL","Harness","Memory","Crawl","Other",Oi];function Mw(n){let e=Tw.indexOf(n);return e===-1?Tw.length-1:e}function Ow(n,e){let t=Mw(n)-Mw(e);return t!==0?t:n.localeCompare(e)}function _R(n){return[...n].sort((e,t)=>e.displayName.localeCompare(t.displayName))}function Rw(n){let e=new Map;for(let t of n){let o=t.category??"Other",i=e.get(o);i===void 0?e.set(o,[t]):i.push(t)}return[...e.entries()].sort(([t],[o])=>Ow(t,o)).map(([t,o])=>({category:t,nodes:_R(o)}))}function xR(n){return n.paletteSecondary===!0}function SR(n){let e=[],t=[];for(let i of n)xR(i)?t.push(i):e.push(i);let o=[...Rw(e)];return t.length>0&&o.push({category:Oi,nodes:[],subcategories:Rw(t)}),o.sort((i,r)=>Ow(i.category,r.category))}function Aw(n,e){let t=new Map([["system",[]],["custom",[]]]);for(let o of n.nodes)t.get("system")?.push(C(p({},o),{source:"system"}));for(let o of e.nodes)t.get("custom")?.push(C(p({},o),{source:"custom"}));return{sections:CR.map(o=>({source:o,categories:SR(t.get(o)??[])})),customStatus:e.status,customErrors:e.errors}}function Ad(n,e){return`${n}:${e}`}function Ld(n,e){return`${n}:${Oi}:${e}`}function Lw(n){return n==="system"?"System":"Custom"}var PR=(n,e)=>n.displayName.toLowerCase().includes(e)||n.type.toLowerCase().includes(e),Fw=(n,e)=>{if(n.subcategories!==void 0){let o=n.subcategories.map(i=>Fw(i,e)).filter(i=>i!==null);return o.length===0?null:{category:n.category,nodes:[],subcategories:o}}let t=n.nodes.filter(o=>PR(o,e));return t.length===0?null:{category:n.category,nodes:t}},zw=(n,e)=>{let t=e.trim().toLowerCase();return t.length===0?n:n.map(o=>({source:o.source,categories:o.categories.map(i=>Fw(i,t)).filter(i=>i!==null)})).filter(o=>o.categories.length>0)};function ER(n,e){n&1&&(O(0,"div",1),bt(1,"span",5),N())}function IR(n,e){n&1&&(O(0,"div",4),bt(1,"span",5),N())}var Ai=class n{constructor(){this.side=T.required();this.label=T.required();this.wireType=T.required();this.hidden=T(!1)}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-node-port-row-static"]],hostAttrs:[1,"lf-port-row-host"],inputs:{side:[1,"side"],label:[1,"label"],wireType:[1,"wireType"],hidden:[1,"hidden"]},decls:8,vars:8,consts:[[1,"lf-port-row"],[1,"lf-port-anchor","lf-port-anchor--in"],[1,"lf-port-row__content"],[1,"text-zinc-400","dark:text-zinc-500"],[1,"lf-port-anchor","lf-port-anchor--out"],["aria-hidden","true",1,"lf-port-dot"]],template:function(t,o){t&1&&(O(0,"div",0),P(1,ER,2,0,"div",1),O(2,"div",2)(3,"span"),w(4),N(),O(5,"span",3),w(6),N()(),P(7,IR,2,0,"div",4),N()),t&2&&(G("lf-port-row--in",o.side()==="in")("lf-port-row--out",o.side()==="out"),u(),E(o.side()==="in"&&!o.hidden()?1:-1),u(3),ue(o.label()),u(2),H(" \xB7 ",o.wireType()," "),u(),E(o.side()==="out"?7:-1))},styles:['[_nghost-%COMP%]{display:block;box-sizing:border-box;width:100%}.lf-diagram-node[_nghost-%COMP%]{height:100%}.lf-diagram-node[_nghost-%COMP%] ng-diagram-node-resize-adornment{display:block;box-sizing:border-box;width:100%;height:100%}.lf-node-chrome[_ngcontent-%COMP%]{--lf-node-chrome-padding-x: 20px;position:relative;box-sizing:border-box;display:flex;width:100%;height:100%;min-width:0;min-height:0;flex-direction:column;padding-left:var(--lf-node-chrome-padding-x);padding-right:var(--lf-node-chrome-padding-x);border-color:#d4d4d8}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome[_ngcontent-%COMP%]{border-color:#3f3f46}.lf-node-content[_ngcontent-%COMP%]{display:flex;width:100%;min-width:0;min-height:0;flex:1 1 auto;flex-direction:column}.lf-node-title[_ngcontent-%COMP%]{flex:0 0 auto;min-height:1.25rem;line-height:1.25rem}.lf-port-row-host[_nghost-%COMP%]{display:flex;flex:0 0 auto;flex-direction:column}.lf-port-row-host--grow[_nghost-%COMP%]{flex:var(--lf-inline-flex, 1) 1 0;min-height:min-content;overflow:visible}.lf-port-row-host--grow[_nghost-%COMP%] .lf-port-row-wrapper[_ngcontent-%COMP%]{display:flex;flex:1 1 auto;flex-direction:column;min-height:min-content;overflow:visible}.lf-port-row-host--grow[_nghost-%COMP%] .lf-port-row__inline[_ngcontent-%COMP%]{display:flex;flex:1 1 0;flex-direction:column;min-height:min-content;overflow:hidden}.lf-port-row-host--grow[_nghost-%COMP%] .lf-port-row__inline[_ngcontent-%COMP%] lf-inline-field[_ngcontent-%COMP%]{flex:1 1 0;min-height:min-content;overflow:hidden}.lf-port-row-host--grow.lf-port-row-host--preview[_nghost-%COMP%], .lf-port-row-host--grow.lf-port-row-host--preview[_nghost-%COMP%] .lf-port-row-wrapper[_ngcontent-%COMP%], .lf-port-row-host--grow.lf-port-row-host--preview[_nghost-%COMP%] .lf-port-row__inline[_ngcontent-%COMP%], .lf-port-row-host--grow.lf-port-row-host--preview[_nghost-%COMP%] .lf-port-row__inline[_ngcontent-%COMP%] lf-inline-field[_ngcontent-%COMP%]{min-height:0}.lf-node-chrome--pending[_ngcontent-%COMP%]{border-color:#d97706}.lf-node-chrome--value[_ngcontent-%COMP%]{border-color:#10b981}.lf-node-chrome--error[_ngcontent-%COMP%]{border-color:#f43f5e;box-shadow:0 0 0 2px rgba(244 63 94,.25)}.lf-node-chrome--hitl[_ngcontent-%COMP%]{border-color:#0ea5e9;box-shadow:0 0 0 2px rgba(14 165 233,.4)}.lf-node-chrome--pulse[_ngcontent-%COMP%]{box-shadow:0 0 0 2px #10b98180;transition:box-shadow .15s ease-out}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome--pending[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome--pending[_ngcontent-%COMP%]{border-color:#ca8a04}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome--value[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome--value[_ngcontent-%COMP%]{border-color:#34d399}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome--error[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome--error[_ngcontent-%COMP%]{border-color:#fb7185;box-shadow:0 0 0 2px rgba(251 113 133,.25)}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome--hitl[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome--hitl[_ngcontent-%COMP%]{border-color:#38bdf8;box-shadow:0 0 0 2px rgba(56 189 248,.4)}.lf-node-chrome--selected[_ngcontent-%COMP%]{border-color:#3b82f6;box-shadow:0 0 0 2px #3b82f659}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome--selected[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome--selected[_ngcontent-%COMP%]{border-color:#60a5fa;box-shadow:0 0 0 2px #60a5fa59}.lf-node-chrome--hovered[_ngcontent-%COMP%]{border-color:#8b5cf6;box-shadow:0 0 0 2px #8b5cf64d}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome--hovered[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome--hovered[_ngcontent-%COMP%]{border-color:#a78bfa;box-shadow:0 0 0 2px #a78bfa4d}.lf-port-row[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center;min-height:1.5rem;padding-top:.125rem;padding-bottom:.125rem}.lf-port-row__inline[_ngcontent-%COMP%]{padding-bottom:.25rem;padding-left:.25rem}.lf-port-row__content[_ngcontent-%COMP%]{min-width:0;flex:1 1 auto;font-size:10px;line-height:1.2;color:#64748b}.lf-port-row--in[_ngcontent-%COMP%] .lf-port-row__content[_ngcontent-%COMP%]{padding-left:.25rem}.lf-port-row--out[_ngcontent-%COMP%] .lf-port-row__content[_ngcontent-%COMP%]{padding-right:.25rem;text-align:right}.lf-port-anchor[_ngcontent-%COMP%]{position:absolute;top:50%;transform:translateY(-50%)}.lf-port-anchor--in[_ngcontent-%COMP%]{left:calc(-1 * var(--lf-node-chrome-padding-x))}.lf-port-anchor--out[_ngcontent-%COMP%]{right:calc(-1 * var(--lf-node-chrome-padding-x))}[data-theme="dark"][_nghost-%COMP%] .lf-port-row__content[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-port-row__content[_ngcontent-%COMP%]{color:#94a3b8}.lf-port-dot[_ngcontent-%COMP%]{display:block;box-sizing:border-box;width:10px;height:10px;border:2px solid rgb(148 163 184);border-radius:9999px;background:#fff}[data-theme="dark"][_nghost-%COMP%] .lf-port-dot[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-port-dot[_ngcontent-%COMP%]{border-color:#64748b;background:#0f172a}.lf-node-label-input[_ngcontent-%COMP%]{width:calc(100% - .5rem);border-radius:.25rem;border:1px solid rgb(59 130 246);background:#fafafa;padding:.125rem .25rem;color:#18181b;outline:none}[data-theme="dark"][_nghost-%COMP%] .lf-node-label-input[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-label-input[_ngcontent-%COMP%]{border-color:#60a5fa;background:#09090b;color:#f4f4f5}[_nghost-%COMP%] .resize-handle, [_nghost-%COMP%] .resize-line{opacity:0;pointer-events:none}.lf-node-se-handle[_ngcontent-%COMP%]{position:absolute;right:0;bottom:0;z-index:2;box-sizing:border-box;width:1rem;height:1rem;overflow:hidden;border-bottom-right-radius:.75rem;cursor:nwse-resize;pointer-events:auto}.lf-node-se-handle__lines[_ngcontent-%COMP%]{display:block;position:absolute;right:0;bottom:0;width:.875rem;height:.875rem;background-image:repeating-linear-gradient(-45deg,transparent 0,transparent 2px,rgb(161 161 170) 2px,rgb(161 161 170) 3.25px);clip-path:polygon(100% 0,100% 100%,0 100%)}[data-theme="dark"][_nghost-%COMP%] .lf-node-se-handle__lines[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-se-handle__lines[_ngcontent-%COMP%]{background-image:repeating-linear-gradient(-45deg,transparent 0,transparent 2px,rgb(113 113 122) 2px,rgb(113 113 122) 3.25px)}.lf-port-anchor--node-selected[_ngcontent-%COMP%]{--ngd-port-border-color: rgb(147 197 253);--ngd-port-background-color: rgb(239 246 255)}.lf-port-anchor--endpoint[_ngcontent-%COMP%]{--ngd-port-border-color: rgb(37 99 235);--ngd-port-background-color: rgb(191 219 254)}[data-theme="dark"][_nghost-%COMP%] .lf-port-anchor--node-selected[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-port-anchor--node-selected[_ngcontent-%COMP%]{--ngd-port-border-color: rgb(96 165 250);--ngd-port-background-color: rgb(30 58 138)}[data-theme="dark"][_nghost-%COMP%] .lf-port-anchor--endpoint[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-port-anchor--endpoint[_ngcontent-%COMP%]{--ngd-port-border-color: rgb(147 197 253);--ngd-port-background-color: rgb(30 64 175)}']})}};var $w=(n,e)=>e.portId;function kR(n,e){if(n&1&&F(0,"lf-node-port-row-static",2),n&2){let t=e.$implicit;M("label",t.label)("wireType",t.wireType)("hidden",t.hidden)}}function DR(n,e){if(n&1&&F(0,"lf-node-port-row-static",3),n&2){let t=e.$implicit;M("label",t.label)("wireType",t.wireType)}}var Fd=class n{constructor(){this.node=T.required();this.ports=b(()=>bi(this.node(),"palette-drag-preview",[]));this.inputPortRows=b(()=>this.ports().inputPorts);this.outputPortRows=b(()=>this.ports().outputPorts)}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-palette-drag-preview"]],hostAttrs:[1,"inline-block","w-max"],inputs:{node:[1,"node"]},decls:7,vars:1,consts:[[1,"lf-node-chrome","flex","h-full","min-h-12","min-w-40","flex-col","rounded-xl","border","bg-white","py-3","dark:bg-zinc-900"],[1,"truncate","px-1","text-xs","font-semibold","text-zinc-900","dark:text-zinc-100"],["side","in",3,"label","wireType","hidden"],["side","out",3,"label","wireType"]],template:function(t,o){t&1&&(y(0,"div",0)(1,"span",1),w(2),m(),X(3,kR,1,3,"lf-node-port-row-static",2,$w),X(5,DR,1,2,"lf-node-port-row-static",3,$w),m()),t&2&&(u(2),H(" ",o.node().displayName," "),u(),Q(o.inputPortRows()),u(2),Q(o.outputPortRows()))},dependencies:[Ai],styles:['[_nghost-%COMP%]{display:block;box-sizing:border-box;width:100%}.lf-diagram-node[_nghost-%COMP%]{height:100%}.lf-diagram-node[_nghost-%COMP%] ng-diagram-node-resize-adornment{display:block;box-sizing:border-box;width:100%;height:100%}.lf-node-chrome[_ngcontent-%COMP%]{--lf-node-chrome-padding-x: 20px;position:relative;box-sizing:border-box;display:flex;width:100%;height:100%;min-width:0;min-height:0;flex-direction:column;padding-left:var(--lf-node-chrome-padding-x);padding-right:var(--lf-node-chrome-padding-x);border-color:#d4d4d8}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome[_ngcontent-%COMP%]{border-color:#3f3f46}.lf-node-content[_ngcontent-%COMP%]{display:flex;width:100%;min-width:0;min-height:0;flex:1 1 auto;flex-direction:column}.lf-node-title[_ngcontent-%COMP%]{flex:0 0 auto;min-height:1.25rem;line-height:1.25rem}.lf-port-row-host[_nghost-%COMP%]{display:flex;flex:0 0 auto;flex-direction:column}.lf-port-row-host--grow[_nghost-%COMP%]{flex:var(--lf-inline-flex, 1) 1 0;min-height:min-content;overflow:visible}.lf-port-row-host--grow[_nghost-%COMP%] .lf-port-row-wrapper[_ngcontent-%COMP%]{display:flex;flex:1 1 auto;flex-direction:column;min-height:min-content;overflow:visible}.lf-port-row-host--grow[_nghost-%COMP%] .lf-port-row__inline[_ngcontent-%COMP%]{display:flex;flex:1 1 0;flex-direction:column;min-height:min-content;overflow:hidden}.lf-port-row-host--grow[_nghost-%COMP%] .lf-port-row__inline[_ngcontent-%COMP%] lf-inline-field[_ngcontent-%COMP%]{flex:1 1 0;min-height:min-content;overflow:hidden}.lf-port-row-host--grow.lf-port-row-host--preview[_nghost-%COMP%], .lf-port-row-host--grow.lf-port-row-host--preview[_nghost-%COMP%] .lf-port-row-wrapper[_ngcontent-%COMP%], .lf-port-row-host--grow.lf-port-row-host--preview[_nghost-%COMP%] .lf-port-row__inline[_ngcontent-%COMP%], .lf-port-row-host--grow.lf-port-row-host--preview[_nghost-%COMP%] .lf-port-row__inline[_ngcontent-%COMP%] lf-inline-field[_ngcontent-%COMP%]{min-height:0}.lf-node-chrome--pending[_ngcontent-%COMP%]{border-color:#d97706}.lf-node-chrome--value[_ngcontent-%COMP%]{border-color:#10b981}.lf-node-chrome--error[_ngcontent-%COMP%]{border-color:#f43f5e;box-shadow:0 0 0 2px rgba(244 63 94,.25)}.lf-node-chrome--hitl[_ngcontent-%COMP%]{border-color:#0ea5e9;box-shadow:0 0 0 2px rgba(14 165 233,.4)}.lf-node-chrome--pulse[_ngcontent-%COMP%]{box-shadow:0 0 0 2px #10b98180;transition:box-shadow .15s ease-out}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome--pending[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome--pending[_ngcontent-%COMP%]{border-color:#ca8a04}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome--value[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome--value[_ngcontent-%COMP%]{border-color:#34d399}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome--error[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome--error[_ngcontent-%COMP%]{border-color:#fb7185;box-shadow:0 0 0 2px rgba(251 113 133,.25)}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome--hitl[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome--hitl[_ngcontent-%COMP%]{border-color:#38bdf8;box-shadow:0 0 0 2px rgba(56 189 248,.4)}.lf-node-chrome--selected[_ngcontent-%COMP%]{border-color:#3b82f6;box-shadow:0 0 0 2px #3b82f659}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome--selected[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome--selected[_ngcontent-%COMP%]{border-color:#60a5fa;box-shadow:0 0 0 2px #60a5fa59}.lf-node-chrome--hovered[_ngcontent-%COMP%]{border-color:#8b5cf6;box-shadow:0 0 0 2px #8b5cf64d}[data-theme="dark"][_nghost-%COMP%] .lf-node-chrome--hovered[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-chrome--hovered[_ngcontent-%COMP%]{border-color:#a78bfa;box-shadow:0 0 0 2px #a78bfa4d}.lf-port-row[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center;min-height:1.5rem;padding-top:.125rem;padding-bottom:.125rem}.lf-port-row__inline[_ngcontent-%COMP%]{padding-bottom:.25rem;padding-left:.25rem}.lf-port-row__content[_ngcontent-%COMP%]{min-width:0;flex:1 1 auto;font-size:10px;line-height:1.2;color:#64748b}.lf-port-row--in[_ngcontent-%COMP%] .lf-port-row__content[_ngcontent-%COMP%]{padding-left:.25rem}.lf-port-row--out[_ngcontent-%COMP%] .lf-port-row__content[_ngcontent-%COMP%]{padding-right:.25rem;text-align:right}.lf-port-anchor[_ngcontent-%COMP%]{position:absolute;top:50%;transform:translateY(-50%)}.lf-port-anchor--in[_ngcontent-%COMP%]{left:calc(-1 * var(--lf-node-chrome-padding-x))}.lf-port-anchor--out[_ngcontent-%COMP%]{right:calc(-1 * var(--lf-node-chrome-padding-x))}[data-theme="dark"][_nghost-%COMP%] .lf-port-row__content[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-port-row__content[_ngcontent-%COMP%]{color:#94a3b8}.lf-port-dot[_ngcontent-%COMP%]{display:block;box-sizing:border-box;width:10px;height:10px;border:2px solid rgb(148 163 184);border-radius:9999px;background:#fff}[data-theme="dark"][_nghost-%COMP%] .lf-port-dot[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-port-dot[_ngcontent-%COMP%]{border-color:#64748b;background:#0f172a}.lf-node-label-input[_ngcontent-%COMP%]{width:calc(100% - .5rem);border-radius:.25rem;border:1px solid rgb(59 130 246);background:#fafafa;padding:.125rem .25rem;color:#18181b;outline:none}[data-theme="dark"][_nghost-%COMP%] .lf-node-label-input[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-label-input[_ngcontent-%COMP%]{border-color:#60a5fa;background:#09090b;color:#f4f4f5}[_nghost-%COMP%] .resize-handle, [_nghost-%COMP%] .resize-line{opacity:0;pointer-events:none}.lf-node-se-handle[_ngcontent-%COMP%]{position:absolute;right:0;bottom:0;z-index:2;box-sizing:border-box;width:1rem;height:1rem;overflow:hidden;border-bottom-right-radius:.75rem;cursor:nwse-resize;pointer-events:auto}.lf-node-se-handle__lines[_ngcontent-%COMP%]{display:block;position:absolute;right:0;bottom:0;width:.875rem;height:.875rem;background-image:repeating-linear-gradient(-45deg,transparent 0,transparent 2px,rgb(161 161 170) 2px,rgb(161 161 170) 3.25px);clip-path:polygon(100% 0,100% 100%,0 100%)}[data-theme="dark"][_nghost-%COMP%] .lf-node-se-handle__lines[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-node-se-handle__lines[_ngcontent-%COMP%]{background-image:repeating-linear-gradient(-45deg,transparent 0,transparent 2px,rgb(113 113 122) 2px,rgb(113 113 122) 3.25px)}.lf-port-anchor--node-selected[_ngcontent-%COMP%]{--ngd-port-border-color: rgb(147 197 253);--ngd-port-background-color: rgb(239 246 255)}.lf-port-anchor--endpoint[_ngcontent-%COMP%]{--ngd-port-border-color: rgb(37 99 235);--ngd-port-background-color: rgb(191 219 254)}[data-theme="dark"][_nghost-%COMP%] .lf-port-anchor--node-selected[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-port-anchor--node-selected[_ngcontent-%COMP%]{--ngd-port-border-color: rgb(96 165 250);--ngd-port-background-color: rgb(30 58 138)}[data-theme="dark"][_nghost-%COMP%] .lf-port-anchor--endpoint[_ngcontent-%COMP%], [data-theme="dark"] [_nghost-%COMP%] .lf-port-anchor--endpoint[_ngcontent-%COMP%]{--ngd-port-border-color: rgb(147 197 253);--ngd-port-background-color: rgb(30 64 175)}']})}};function Bw(n,e,t,o){let i=o.dataTransfer;if(i===null)return null;let r=document.createElement("div");r.style.position="fixed",r.style.top="-2000px",r.style.left="-2000px",r.style.display="inline-block",r.style.width="max-content",r.style.pointerEvents="none",r.style.opacity="0.5",document.body.appendChild(r);let s=Tg(Fd,{hostElement:r,environmentInjector:n});return s.setInput("node",t),e.attachView(s.hostView),s.changeDetectorRef.detectChanges(),i.setDragImage(r,12,12),{destroy:()=>{e.detachView(s.hostView),s.destroy(),r.remove()}}}var Hw=(n,e,t,o=8)=>{if(t<=0||e<=0)return n;let i=o,r=Math.max(i,t-e-o);return Math.min(Math.max(n,i),r)};function TR(n,e){if(n&1&&F(0,"lf-node-port-row-static",5),n&2){let t=c().$implicit;M("label",t.input.label)("wireType",t.input.wireType)}}function MR(n,e){n&1&&(y(0,"p",6),w(1," Dynamic channels "),m())}function RR(n,e){if(n&1&&F(0,"lf-node-port-row-static",7),n&2){let t=c().$implicit;M("label",t.output.label)("wireType",t.output.wireType)}}function NR(n,e){if(n&1&&(y(0,"div",8),F(1,"lf-inline-field",10),m()),n&2){let t=c().$implicit;u(),M("config",t.inline)("value",t.inlineValue)("disabled",!0)("expandable",!1)}}function OR(n,e){n&1&&(y(0,"span",9),w(1," multi "),m())}function AR(n,e){if(n&1&&(y(0,"div",2)(1,"div",3)(2,"div",4),P(3,TR,1,2,"lf-node-port-row-static",5),m(),P(4,MR,2,0,"p",6),y(5,"div",4),P(6,RR,1,2,"lf-node-port-row-static",7),m()(),P(7,NR,2,4,"div",8),P(8,OR,2,0,"span",9),m()),n&2){let t=e.$implicit;u(3),E(t.input!==null?3:-1),u(),E(t.isBypassStub?4:-1),u(2),E(t.output!==null?6:-1),u(),E(t.inline!==null?7:-1),u(),E(t.showMultiBadge?8:-1)}}var LR=n=>n!=null&&wh(n)?n:null,FR=(n,e)=>n.inputsConfigs.some(t=>String(t.portId??t.name??"")===e&&t.multi!==void 0),zR=n=>{let e=bi(n,"palette-node-preview",[]),t=e.inputPorts.filter(s=>s.slotIndex===0),o=e.outputPorts,i=Math.max(t.length,o.length),r=[];for(let s=0;s<i;s+=1){let a=t[s],d=o[s];r.push({input:a!==void 0&&!a.hidden?a:null,output:d??null,inline:LR(a?.inline),inlineValue:a?.value,showMultiBadge:a!==void 0&&FR(n,a.basePortId),isBypassStub:!1})}return r.length===0&&e.bypassPorts.length>0&&r.push({input:null,output:null,inline:null,inlineValue:void 0,showMultiBadge:!1,isBypassStub:!0}),r},zd=class n{constructor(){this.node=T.required();this.bodyRows=b(()=>zR(this.node()))}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-palette-node-preview"]],inputs:{node:[1,"node"]},decls:5,vars:1,consts:[[1,"relative","min-w-48","px-5","[--lf-node-chrome-padding-x:1.25rem]"],[1,"mb-2","truncate","text-center","text-xs","font-semibold","text-zinc-900","dark:text-zinc-100"],[1,"py-1"],[1,"flex","items-start","gap-2"],[1,"min-w-0","flex-1"],["side","in",3,"label","wireType"],[1,"min-w-0","flex-1","text-center","text-[10px]","text-zinc-500","dark:text-zinc-400"],["side","out",3,"label","wireType"],[1,"mt-1"],[1,"mt-1","block","text-[10px]","text-zinc-400","dark:text-zinc-500"],[3,"config","value","disabled","expandable"]],template:function(t,o){t&1&&(y(0,"div",0)(1,"p",1),w(2),m(),X(3,AR,9,5,"div",2,nn),m()),t&2&&(u(2),H(" ",o.node().displayName," "),u(),Q(o.bodyRows()))},dependencies:[no,Ai],encapsulation:2})}};var BR=["popoverRoot"],HR=(n,e)=>e.field;function UR(n,e){if(n&1&&(y(0,"li",9)(1,"span",10),w(2),m(),y(3,"span",11),w(4),m()()),n&2){let t=e.$implicit;u(2),ue(t.label??t.field),u(2),H(" \xB7 ",t.type," ")}}function VR(n,e){if(n&1&&(y(0,"div",5)(1,"h3",7),w(2," Panel "),m(),y(3,"ul",8),X(4,UR,5,2,"li",9,HR),m()()),n&2){let t=c(2);u(4),Q(t.panelFields())}}function jR(n,e){if(n&1&&F(0,"div",6),n&2){let t=c(2);M("innerHTML",t.descriptionHtml(),tn)}}function WR(n,e){if(n&1){let t=z();y(0,"div",2,0)(2,"div",3),R("mouseenter",function(){x(t);let i=c();return S(i.panelEnter.emit())})("mouseleave",function(){x(t);let i=c();return S(i.panelLeave.emit())}),F(3,"lf-palette-node-preview",4),P(4,VR,6,0,"div",5),P(5,jR,1,1,"div",6),m()()}if(n&2){let t=c();Ze("top",t.popoverTop(),"px")("left",t.popoverLeft(),"px"),K("aria-label",t.node().displayName),u(3),M("node",t.node()),u(),E(t.panelFields().length>0?4:-1),u(),E(t.descriptionHtml()!==null?5:-1)}}var $d=class n{constructor(){this.node=T(null);this.anchor=T(null);this.panelEnter=Ct();this.panelLeave=Ct();this.popoverRoot=Xe("popoverRoot");this.popoverHeightPx=U(0);this.panelFields=b(()=>{let e=this.node();return e===null?[]:e.uiSchema});this.descriptionHtml=b(()=>{let e=this.node();return e===null?null:pd(e.description)});this.popoverLeft=b(()=>{let e=this.anchor();return e===null?0:e.left+e.width+8});this.popoverTop=b(()=>{let e=this.anchor();if(e===null)return 0;let t=typeof globalThis<"u"&&typeof globalThis.innerHeight=="number"?globalThis.innerHeight:0;return Hw(e.top,this.popoverHeightPx(),t,8)});Dg(()=>{this.node(),this.anchor();let e=this.popoverRoot()?.nativeElement;if(e===void 0){this.popoverHeightPx.set(0);return}this.popoverHeightPx.set(e.getBoundingClientRect().height)})}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-palette-node-detail-popover"]],viewQuery:function(t,o){t&1&&rt(o.popoverRoot,BR,5),t&2&&st()},inputs:{node:[1,"node"],anchor:[1,"anchor"]},outputs:{panelEnter:"panelEnter",panelLeave:"panelLeave"},decls:1,vars:1,consts:[["popoverRoot",""],["role","dialog",1,"pointer-events-none","fixed","z-50","w-72",3,"top","left"],["role","dialog",1,"pointer-events-none","fixed","z-50","w-72"],[1,"pointer-events-auto","rounded-lg","border","border-zinc-200","bg-white","p-3","shadow-xl","dark:border-zinc-700","dark:bg-zinc-900",3,"mouseenter","mouseleave"],[3,"node"],[1,"mt-3","pt-1"],[1,"prose","prose-xs","mt-3","max-w-none","pt-1","text-zinc-600","dark:prose-invert","dark:text-zinc-300",3,"innerHTML"],[1,"text-[10px]","font-semibold","uppercase","tracking-wide","text-zinc-500","dark:text-zinc-400"],[1,"mt-1","space-y-1"],[1,"text-[10px]","text-zinc-600","dark:text-zinc-300"],[1,"font-medium"],[1,"text-zinc-400","dark:text-zinc-500"]],template:function(t,o){t&1&&P(0,WR,6,8,"div",1),t&2&&E(o.node()!==null&&o.anchor()!==null?0:-1)},dependencies:[zd],encapsulation:2})}};var GR=(n,e)=>e.source,qR=(n,e)=>e.packageName+e.message,Uw=(n,e)=>e.category,Vw=(n,e)=>e.type;function KR(n,e){if(n&1&&(y(0,"li",15)(1,"strong"),w(2),m(),y(3,"pre",16),w(4),m()()),n&2){let t=e.$implicit;u(2),ue(t.packageName),u(2),ue(t.message)}}function YR(n,e){if(n&1&&(y(0,"ul",14),X(1,KR,5,2,"li",15,qR),m()),n&2){let t=c(4);u(),Q(t.customErrors())}}function ZR(n,e){if(n&1){let t=z();y(0,"div",11)(1,"span",12),w(2),m(),y(3,"button",13),R("click",function(){x(t);let i=c(3);return S(i.requestCustomPaletteUpdate())}),w(4," Update "),m()(),P(5,YR,3,0,"ul",14)}if(n&2){let t=c(3);u(2),H(" ",t.customStatusLabel()," "),u(),M("disabled",t.customStatus()==="compiling"),u(2),E(t.customErrors().length>0?5:-1)}}function XR(n,e){n&1&&(y(0,"p",17),w(1," No custom nodes yet "),m())}function QR(n,e){if(n&1&&P(0,XR,2,0,"p",17),n&2){let t=c(2).$implicit;E(t.source==="custom"?0:-1)}}function JR(n,e){if(n&1){let t=z();y(0,"li")(1,"button",23),R("dragstart",function(i){let r=x(t).$implicit,s=c(9);return S(s.startPaletteDrag(r,i))})("dragend",function(){x(t);let i=c(9);return S(i.endPaletteDrag())})("mouseenter",function(i){let r=x(t).$implicit,s=c(9);return S(s.showPopover(r,i))})("mouseleave",function(){x(t);let i=c(9);return S(i.hidePopover())})("click",function(i){let r=x(t).$implicit,s=c(9);return S(s.togglePinnedPopover(r,i))}),w(2),m()()}if(n&2){let t=e.$implicit,o=c(9);u(),tt(o.nodeRowClass()),K("draggable",!o.isRunning()),u(),H(" ",t.displayName," ")}}function eN(n,e){if(n&1&&(y(0,"ul",21),X(1,JR,3,4,"li",null,Vw),m()),n&2){let t=c().$implicit;u(),Q(t.nodes)}}function tN(n,e){if(n&1){let t=z();y(0,"div",22)(1,"button",19),R("click",function(){let i=x(t).$implicit,r=c(6).$implicit,s=c();return S(s.toggleAdvancedSubcategory(r.source,i.category))}),y(2,"span"),w(3),m(),ce(),y(4,"svg",20),F(5,"path"),m()(),P(6,eN,3,0,"ul",21),m()}if(n&2){let t=e.$implicit,o=c(6).$implicit,i=c();u(),tt(i.categoryHeaderClass),K("aria-expanded",i.isAdvancedSubcategoryExpanded(o.source,t.category)),u(2),ue(t.category),u(),G("rotate-180",i.isAdvancedSubcategoryExpanded(o.source,t.category)),u(),K("d",i.chevronPath),u(),E(i.isAdvancedSubcategoryExpanded(o.source,t.category)?6:-1)}}function nN(n,e){if(n&1&&X(0,tN,7,8,"div",22,Uw),n&2){let t=c(2).$implicit;Q(t.subcategories)}}function oN(n,e){if(n&1){let t=z();y(0,"li")(1,"button",23),R("dragstart",function(i){let r=x(t).$implicit,s=c(7);return S(s.startPaletteDrag(r,i))})("dragend",function(){x(t);let i=c(7);return S(i.endPaletteDrag())})("mouseenter",function(i){let r=x(t).$implicit,s=c(7);return S(s.showPopover(r,i))})("mouseleave",function(){x(t);let i=c(7);return S(i.hidePopover())})("click",function(i){let r=x(t).$implicit,s=c(7);return S(s.togglePinnedPopover(r,i))}),w(2),m()()}if(n&2){let t=e.$implicit,o=c(7);u(),tt(o.nodeRowClass()),K("draggable",!o.isRunning()),u(),H(" ",t.displayName," ")}}function iN(n,e){if(n&1&&(y(0,"ul",21),X(1,oN,3,4,"li",null,Vw),m()),n&2){let t=c(2).$implicit;u(),Q(t.nodes)}}function rN(n,e){if(n&1&&P(0,nN,2,0)(1,iN,3,0,"ul",21),n&2){let t=c().$implicit,o=c(4);E(o.isAdvancedGroup(t)?0:1)}}function sN(n,e){if(n&1){let t=z();y(0,"div",18)(1,"button",19),R("click",function(){let i=x(t).$implicit,r=c(3).$implicit,s=c();return S(s.toggleCategory(r.source,i.category))}),y(2,"span"),w(3),m(),ce(),y(4,"svg",20),F(5,"path"),m()(),P(6,rN,2,1),m()}if(n&2){let t=e.$implicit,o=c(3).$implicit,i=c();u(),tt(i.categoryHeaderClass),K("aria-expanded",i.isCategoryExpanded(o.source,t.category)),u(2),ue(t.category),u(),G("rotate-180",i.isCategoryExpanded(o.source,t.category)),u(),K("d",i.chevronPath),u(),E(i.isCategoryExpanded(o.source,t.category)?6:-1)}}function aN(n,e){if(n&1&&X(0,sN,7,8,"div",18,Uw),n&2){let t=c(2).$implicit;Q(t.categories)}}function dN(n,e){if(n&1&&(P(0,ZR,6,3),P(1,QR,1,1)(2,aN,2,0)),n&2){let t=c().$implicit;E(t.source==="custom"?0:-1),u(),E(t.categories.length===0?1:2)}}function lN(n,e){if(n&1){let t=z();y(0,"div",7)(1,"button",9),R("click",function(){let i=x(t).$implicit,r=c();return S(r.toggleSource(i.source))}),y(2,"span"),w(3),m(),ce(),y(4,"svg",10),F(5,"path"),m()(),P(6,dN,3,2),m()}if(n&2){let t=e.$implicit,o=c();u(),K("aria-expanded",o.isSourceExpanded(t.source)),u(2),ue(o.sourceSectionLabel(t.source)),u(),G("rotate-180",o.isSourceExpanded(t.source)),u(),K("d",o.chevronPath),u(),E(o.isSourceExpanded(t.source)?6:-1)}}var cN="flex w-full items-center justify-between gap-2 rounded px-1.5 py-0.5 text-left text-[10px] font-medium uppercase tracking-wide text-zinc-500 transition hover:bg-zinc-100 hover:text-zinc-700 dark:text-zinc-400 dark:hover:bg-zinc-800 dark:hover:text-zinc-200",uN="w-full cursor-grab rounded-lg border border-zinc-300 bg-white px-2 py-1.5 text-left text-[11px] text-zinc-800 shadow-sm transition hover:border-zinc-400 hover:bg-zinc-50 active:cursor-grabbing dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-100 dark:hover:border-zinc-500 dark:hover:bg-zinc-800",pN="w-full cursor-not-allowed rounded-lg border border-zinc-300 bg-white px-2 py-1.5 text-left text-[11px] text-zinc-800 shadow-sm dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-100",hN="M5.23 7.21a.75.75 0 0 1 1.06.02L10 10.94l3.71-3.71a.75.75 0 1 1 1.06 1.06l-4.24 4.24a.75.75 0 0 1-1.06 0L5.21 8.29a.75.75 0 0 1 .02-1.08Z",Bd=class n{constructor(){this.bridge=f(ie);this.execution=f(we);this.paletteChrome=f(Ni);this.appRef=f(bs);this.environmentInjector=f(Sn);this.seededCategoryExpansion=!1;this.dragImageSession=null;this.categoryHeaderClass=cN;this.chevronPath=hN;this.isRunning=this.execution.isRunning;this.nodeRowClass=b(()=>this.isRunning()?pN:uN);this.expandedSources=U(new Set(["system"]));this.expandedCategories=U(new Set);this.filterQuery=U("");this.hoverTarget=U(null);this.pinnedTarget=U(null);this.popoverHovered=U(!1);this.paletteState=oe(Te([this.bridge.cached["palette.snapshot"],this.bridge.cached["customPalette.snapshot"]]).pipe(I(([e,t])=>Aw(e,t))),{initialValue:Nw});this.sections=b(()=>this.paletteState().sections);this.customStatus=b(()=>this.paletteState().customStatus);this.customErrors=b(()=>this.paletteState().customErrors);this.customStatusLabel=b(()=>{switch(this.customStatus()){case"compiling":return"Compiling\u2026";case"ok":return"Compiled";case"partial":return"Partial (some errors)";case"error":return"Compile error";default:return"Not compiled"}});this.visibleSections=b(()=>zw(this.sections(),this.filterQuery()));this.isFiltering=b(()=>this.filterQuery().trim().length>0);this.popoverNode=b(()=>this.pinnedTarget()?.node??this.hoverTarget()?.node??null);this.popoverAnchor=b(()=>(this.pinnedTarget()??this.hoverTarget())?.anchor??null);this.sourceSectionLabel=Lw;xe(()=>{if(this.seededCategoryExpansion)return;let e=new Set;for(let t of this.sections())for(let o of t.categories){if(o.category===Oi){for(let i of o.subcategories??[])e.add(Ld(t.source,i.category));continue}e.add(Ad(t.source,o.category))}e.size!==0&&(this.expandedCategories.set(e),this.seededCategoryExpansion=!0)})}onFilterInput(e){let t=e.target;t instanceof HTMLInputElement&&this.filterQuery.set(t.value)}hidePalette(){this.paletteChrome.requestHide()}requestCustomPaletteUpdate(){this.bridge.raw["customPalette.update.requested"].next({force:!0})}isAdvancedGroup(e){return e.category===Oi}isSourceExpanded(e){return this.isFiltering()||this.expandedSources().has(e)}isCategoryExpanded(e,t){return this.isFiltering()||this.expandedCategories().has(Ad(e,t))}isAdvancedSubcategoryExpanded(e,t){return this.isFiltering()||this.expandedCategories().has(Ld(e,t))}toggleSource(e){this.expandedSources.update(t=>{let o=new Set(t);return o.has(e)?o.delete(e):o.add(e),o})}toggleCategory(e,t){this.toggleCollapseKey(Ad(e,t))}toggleAdvancedSubcategory(e,t){this.toggleCollapseKey(Ld(e,t))}toggleCollapseKey(e){this.expandedCategories.update(t=>{let o=new Set(t);return o.has(e)?o.delete(e):o.add(e),o})}startPaletteDrag(e,t){if(this.isRunning()){t.preventDefault();return}t.dataTransfer!==null&&(this.dismissPopover(),t.dataTransfer.setData(Or,e.type),t.dataTransfer.effectAllowed="copy",this.endPaletteDrag(),this.dragImageSession=Bw(this.environmentInjector,this.appRef,e,t))}endPaletteDrag(){this.dragImageSession?.destroy(),this.dragImageSession=null}dismissPopover(){this.hoverTarget.set(null),this.pinnedTarget.set(null),this.popoverHovered.set(!1)}showPopover(e,t){if(this.pinnedTarget()!==null)return;let o=t.currentTarget;if(!(o instanceof HTMLElement))return;let i=o.getBoundingClientRect();this.hoverTarget.set({node:e,anchor:{top:i.top,left:i.left,height:i.height,width:i.width}})}hidePopover(){this.pinnedTarget()!==null||this.popoverHovered()||this.hoverTarget.set(null)}onPopoverPanelLeave(){this.popoverHovered.set(!1),this.hidePopover()}togglePinnedPopover(e,t){let o=t.currentTarget;if(!(o instanceof HTMLElement))return;let i=o.getBoundingClientRect(),r={node:e,anchor:{top:i.top,left:i.left,height:i.height,width:i.width}};if(this.pinnedTarget()?.node.type===e.type){this.pinnedTarget.set(null),this.hoverTarget.set(null);return}this.pinnedTarget.set(r),this.hoverTarget.set(null)}handleEscape(){this.dismissPopover()}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-palette-sidebar"]],hostAttrs:[1,"block","h-full","min-h-0"],hostBindings:function(t,o){t&1&&R("keydown.escape",function(){return o.handleEscape()},kt)},decls:12,vars:3,consts:[[1,"relative","flex","h-full","min-h-0","flex-col"],[1,"flex","shrink-0","items-center","justify-between","gap-2"],[1,"text-sm","font-semibold","text-zinc-900","dark:text-zinc-100"],["tip","Hide palette","side","left","align","center"],["type","button","aria-label","Hide palette",1,"rounded-md","border","border-zinc-200","px-1.5","py-0.5","text-xs","font-medium","text-zinc-700","transition","hover:bg-zinc-100","dark:border-zinc-700","dark:text-zinc-200","dark:hover:bg-zinc-800",3,"click"],["type","search","placeholder","Filter nodes\u2026",1,"mt-3","w-full","shrink-0","rounded-md","border","border-zinc-200","bg-zinc-50","px-2","py-1.5","text-[11px]","text-zinc-800","outline-none","transition","placeholder:text-zinc-400","focus:border-zinc-400","dark:border-zinc-700","dark:bg-zinc-950","dark:text-zinc-100","dark:placeholder:text-zinc-500","dark:focus:border-zinc-500",3,"input","value"],[1,"lf-scroll","mt-3","min-h-0","flex-1","overflow-y-auto","pr-1"],[1,"mb-2"],[3,"panelEnter","panelLeave","node","anchor"],["type","button",1,"flex","w-full","items-center","justify-between","gap-2","rounded-md","px-2","py-1.5","text-left","text-xs","font-semibold","text-zinc-800","transition","hover:bg-zinc-100","dark:text-zinc-100","dark:hover:bg-zinc-800",3,"click"],["viewBox","0 0 20 20","fill","currentColor","aria-hidden","true",1,"h-3.5","w-3.5","shrink-0","transition"],[1,"flex","items-center","justify-between","gap-2","py-1","pl-4","pr-2"],[1,"text-[10px]","uppercase","tracking-wide","text-zinc-500","dark:text-zinc-400"],["type","button",1,"rounded","px-1.5","py-0.5","text-[10px]","font-medium","text-zinc-700","transition","hover:bg-zinc-100","dark:text-zinc-200","dark:hover:bg-zinc-800",3,"click","disabled"],[1,"mb-1","space-y-1","py-1","pl-4","pr-2","text-[11px]","text-red-700","dark:text-red-300"],[1,"whitespace-pre-wrap"],[1,"mt-0.5","font-sans","whitespace-pre-wrap"],[1,"py-1","pl-4","pr-2","text-[11px]","text-zinc-500","dark:text-zinc-400"],[1,"mt-1.5","pl-4"],["type","button",3,"click"],["viewBox","0 0 20 20","fill","currentColor","aria-hidden","true",1,"h-2.5","w-2.5","shrink-0","transition"],[1,"mt-1","space-y-1","pl-4"],[1,"mt-1","pl-4"],["type","button",3,"dragstart","dragend","mouseenter","mouseleave","click"]],template:function(t,o){t&1&&(y(0,"div",0)(1,"div",1)(2,"h2",2),w(3," Palette "),m(),y(4,"lf-hover-tip",3)(5,"button",4),R("click",function(){return o.hidePalette()}),w(6," << "),m()()(),y(7,"input",5),R("input",function(r){return o.onFilterInput(r)}),m(),y(8,"div",6),X(9,lN,7,6,"div",7,GR),m(),y(11,"lf-palette-node-detail-popover",8),R("panelEnter",function(){return o.popoverHovered.set(!0)})("panelLeave",function(){return o.onPopoverPanelLeave()}),m()()),t&2&&(u(7),M("value",o.filterQuery()),u(2),Q(o.visibleSections()),u(2),M("node",o.popoverNode())("anchor",o.popoverAnchor()))},dependencies:[$d,Ue],encapsulation:2})}};var fN=["read","glob","grep","edit","write","create","delete","move","sleep","bash","ask_user"],gN=["You are the Plan agent in a Langflower workflow.","","Understand the user's goal, explore the codebase read-only, and produce a clear","implementation plan. Do not modify source code or non-documentation files.","","Write plans in Markdown with sections: Goal, Context, Steps, Risks, Open questions.","","When memory tools are wired, call update_plan with that markdown so the operator","sees the current plan in the work log. There is no separate Plan mode.","","When requirements are ambiguous, use ask_user before finalizing the plan.","You may pass ordered questions with options; the operator can pick chips or type.","To wait without bash, call sleep with seconds from 1 to 300. Do not busy-loop. Stop aborts the wait."].join(`
|
|
320
|
+
`),mN=["You are the Coder agent in a Langflower workflow.","","Implement the requested changes in the project repository. Make minimal, correct","edits. Prefer precise file edits over large rewrites.","","When tests are available, run them to verify your work. Summarize what you changed","in your final response.","","If you are not sure, call ask_user instead of guessing.","You may pass ordered questions with options; the operator can pick chips or type.","To wait without bash, call sleep with seconds from 1 to 300. Do not busy-loop. Stop aborts the wait."].join(`
|
|
321
|
+
`),yN=["You are the Explorer agent in a Langflower workflow.","","Research the topic using web_fetch. Synthesize findings into clear Markdown notes.","Do not modify application source code\u2014only *.md research notes.","","Cite URLs. Separate facts from inference.","","If you are not sure, call ask_user instead of guessing.","You may pass ordered questions with options; the operator can pick chips or type.","To wait without bash, call sleep with seconds from 1 to 300. Do not busy-loop. Stop aborts the wait."].join(`
|
|
322
|
+
`),Hd=()=>Object.fromEntries(fN.map(n=>[n,"allow"])),vN=Hd(),wN=C(p({},Hd()),{bash:"ask",delete:"ask",move:"ask"}),bN=C(p({},Hd()),{write:"ask",create:"ask",edit:"deny",delete:"deny",move:"deny",bash:"deny"}),CN=C(p({},Hd()),{read:"allow",write:"ask",create:"ask",glob:"deny",grep:"deny",edit:"deny",delete:"deny",move:"deny",bash:"deny"}),Ww={custom:{systemPrompt:"",skillId:"",toolPermissions:vN},plan:{systemPrompt:gN,skillId:"spec-architect",toolPermissions:bN},coder:{systemPrompt:mN,skillId:"coder",toolPermissions:wN},explorer:{systemPrompt:yN,skillId:"explorer",toolPermissions:CN}},Ud=n=>n==="plan"||n==="coder"||n==="explorer"?n:"custom";var hf=n=>n==="allow"||n==="ask"||n==="deny",_N=n=>{if(n===null||typeof n!="object"||Array.isArray(n))return{};let e=Object.entries(n).filter(t=>hf(t[1]));return Object.fromEntries(e)},ff=(n,e)=>{let t=_N(e);return Object.keys(t).length>0?t:Ww[n].toolPermissions},Gw=(n,e)=>{let r=n,{toolPermissions:t}=r,o=gn(r,["toolPermissions"]),i=Ww[e];return C(p({},o),{rolePreset:e,toolPermissions:p({},i.toolPermissions)})},Jr={read:{"*":"allow"},glob:{"*":"allow"},grep:{"*":"allow"},edit:{"*":"allow"},write:{"*":"allow"},create:{"*":"allow"},delete:{"*":"allow"},move:{"*":"allow"},sleep:{"*":"allow"},bash:{"*":"allow"},ask_user:{"*":"allow"}},jw={deny:3,ask:2,allow:1},qw=(n,e)=>{let t=n[e]??Jr[e];if(t===void 0)return{"*":"allow"};if(hf(t))return{"*":t};let o=Object.entries(t).filter(i=>hf(i[1]));return o.length===0?{"*":"deny"}:Object.fromEntries(o)},Vd=(n,e)=>{let t=p(p({},Jr),n??{});if(t[e]===void 0&&Jr[e]===void 0)return"allow";let o=qw(t,e),i=o["*"];if(i!==void 0&&Object.keys(o).length===1)return i;let r=Object.values(o);return r.some(s=>s==="allow")?"allow":r.some(s=>s==="ask")?"ask":"deny"},Kw=n=>n==="deny"?[]:n==="ask"?["deny","ask"]:["deny","ask","allow"],jd=(n,e)=>jw[n]>=jw[e]?n:e,Yw=(n,e)=>{let t=p(p({},Jr),n??{});if(t[e]===void 0&&Jr[e]===void 0)return!1;let o=Object.values(qw(t,e));return o.length>0&&o.every(i=>i==="deny")};var Wd=n=>{if(typeof n!="string")return null;let e=n.trim(),t=e.indexOf("/");if(t<=0||t>=e.length-1)return null;let o=e.slice(0,t).trim(),i=e.slice(t+1).trim();return o.length===0||i.length===0?null:{providerId:o,model:i}},gf=(n,e)=>{let t=n.trim(),o=e.trim();if(!(t.length===0||o.length===0))return`${t}/${o}`},Zw=n=>{let e=Wd(n);return e===null?null:`Default (${e.providerId}/${e.model})`};var Oo=(n,e)=>{let t=new Map;for(let o of n??[])t.set(o,{value:o,title:o});for(let o of e??[])t.set(o.id,{value:o.id,title:o.name??o.id});return[...t.values()]};var xN="tools",SN=[{value:"read",title:"read"},{value:"glob",title:"glob"},{value:"grep",title:"grep"},{value:"edit",title:"edit"},{value:"write",title:"write"},{value:"create",title:"create"},{value:"delete",title:"delete"},{value:"move",title:"move"},{value:"sleep",title:"sleep"},{value:"bash",title:"bash"},{value:"ask_user",title:"ask_user"}],PN={"common-crawl-tools":[{value:"crawl_fetch",title:"crawl_fetch"},{value:"crawl_extract_links",title:"crawl_extract_links"},{value:"crawl_save_page",title:"crawl_save_page"},{value:"crawl_bfs",title:"crawl_bfs"}],"common-memory-tools":[{value:"get_memory_tree",title:"get_memory_tree"},{value:"read_memory_section",title:"read_memory_section"},{value:"search_memory_grep",title:"search_memory_grep"},{value:"append_memory_log",title:"append_memory_log"},{value:"update_memory_section",title:"update_memory_section"},{value:"create_memory_file",title:"create_memory_file"},{value:"update_plan",title:"update_plan"},{value:"read_plan",title:"read_plan"}],"common-langflower-tools":[{value:"compile_custom_nodes",title:"compile_custom_nodes"}]},EN=n=>{let e=String(n.inputs.toolId??"").trim();if(e.length===0)return null;let t=String(n.inputs.name??"").trim(),o=String(n.inputs.description??"").trim();return{toolId:e,name:t.length>0?t:e,description:o}},IN=n=>{let e=PN[n.type];if(e!==void 0)return e;let t=EN(n);return t===null?[]:[p({value:t.toolId,title:t.name},t.description.length>0?{description:t.description}:{})]},kN=(n,e)=>{let t=new Map(n.nodes.map(i=>[i.id,i])),o=new Map;for(let i of n.edges){if(i.toNodeId!==e||i.toPort[0]!==xN)continue;let r=t.get(i.fromNodeId);if(r===void 0)continue;let s=IN(r);for(let a of s)o.set(String(a.value),a)}return[...o.values()]},Xw=n=>Object.entries(n.mcp?.servers??{}).map(([e,t])=>({value:e,title:e,description:t.kind==="stdio"?`System MCP stdio \xAB${e}\xBB`:`System MCP http \xAB${e}\xBB`})),Qw=(n,e)=>{let t=kN(n,e),o=new Set(t.map(r=>String(r.value)));return[...SN.filter(r=>!o.has(String(r.value))),...t]};var Jw=(n,e,t)=>{if(e.options!==void 0)return e.options;let o=e.optionsSource;switch(o){case"langflower.providers":return Object.entries(n.provider??{}).map(([i,r])=>({value:i,title:r.name}));case"langflower.models":{let i=e.dependsOn!==void 0?t[e.dependsOn]:void 0;return((typeof i=="string"?n.provider?.[i]:void 0)?.models??[]).map(s=>({value:s,title:s}))}case"langflower.tools":return(n.tools??[]).map(i=>({value:i.id,title:i.name}));case"langflower.skills":return(n.skills??[]).map(i=>({value:i.id,title:i.name,description:i.description}));case"node.wiredTools":throw new Error("resolveUiSchemaOptions does not resolve node.wiredTools \u2014 use resolveEnabledToolOptions(graph, nodeId).");case"langflower.mcpServers":return Xw(n);case void 0:return[];default:return o}};var eb="No models available for this provider",tb=(n,e)=>e?.loading===!0?{disabled:!1,emptyHint:"Loading models\u2026"}:e?.error!==void 0?n===0?{disabled:!0,fieldError:e.error.trim().length>0?e.error:eb}:{disabled:!1,emptyHint:`Live catalog unavailable \u2014 using static models. ${e.error}`}:n===0?{disabled:!1,emptyHint:eb}:{disabled:!1};var nb=(n,e,t)=>e.some(o=>o.value==="")?e:n.optionsSource==="langflower.skills"?[{value:"",title:"None"},...e]:n.optionsSource==="langflower.providers"||n.optionsSource==="langflower.models"?[{value:"",title:typeof t=="string"&&t.trim().length>0?t:"Select\u2026"},...e]:e;var ob=n=>p(p(p({type:"number"},typeof n.min=="number"?{min:n.min}:{}),typeof n.max=="number"?{max:n.max}:{}),typeof n.step=="number"?{step:n.step}:{});var DN=(n,e)=>e.toolId;function TN(n,e){if(n&1){let t=z();O(0,"input",8),ge("change",function(){x(t);let i=c().$implicit,r=c().$implicit,s=c();return S(s.onPick(r.toolId,i))}),N()}if(n&2){let t=c().$implicit,o=c().$implicit,i=c();he("name","tool-perm-"+o.toolId)("checked",o.decision===t)("disabled",i.disabled())}}function MN(n,e){if(n&1&&(O(0,"td",6),P(1,TN,1,3,"input",7),N()),n&2){let t=e.$implicit,o=c().$implicit;u(),E(o.options.includes(t)?1:-1)}}function RN(n,e){if(n&1&&(O(0,"tr",4)(1,"td",5),w(2),N(),X(3,MN,2,1,"td",6,ao),N()),n&2){let t=e.$implicit,o=c();u(),he("title",t.toolId),u(),H(" ",t.title," "),u(),Q(o.allDecisions)}}var NN=["deny","ask","allow"],ib=(n,e,t)=>{let o=[];for(let i of n){let r=String(i.value);if(Yw(t,r))continue;let s=Vd(t,r),a=Kw(s);if(a.length===0)continue;let d=e[r]??"allow",l=jd(s,d);o.push({toolId:r,title:i.title??r,decision:l,options:a})}return o},Gd=class n{constructor(){this.rows=T.required();this.disabled=T(!1);this.decisionChange=Ct();this.allDecisions=NN}onPick(e,t){this.decisionChange.emit({toolId:e,decision:t})}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-tool-permission-table"]],inputs:{rows:[1,"rows"],disabled:[1,"disabled"]},outputs:{decisionChange:"decisionChange"},decls:14,vars:0,consts:[[1,"w-full","border-collapse","text-[10px]"],[1,"text-left","text-zinc-500","dark:text-zinc-400"],[1,"py-1","pr-2","font-medium"],[1,"px-1","py-1","text-center","font-medium"],[1,"border-t","border-zinc-200","dark:border-zinc-700"],[1,"py-1","pr-2","text-zinc-700","dark:text-zinc-200",3,"title"],[1,"px-1","py-1","text-center"],["type","radio",1,"align-middle",3,"name","checked","disabled"],["type","radio",1,"align-middle",3,"change","name","checked","disabled"]],template:function(t,o){t&1&&(O(0,"table",0)(1,"thead")(2,"tr",1)(3,"th",2),w(4,"tool"),N(),O(5,"th",3),w(6,"deny"),N(),O(7,"th",3),w(8,"ask"),N(),O(9,"th",3),w(10,"allow"),N()()(),O(11,"tbody"),X(12,RN,5,2,"tr",4,DN),N()()),t&2&&(u(12),Q(o.rows()))},encapsulation:2})}};var rb=(n,e)=>e.portId,ON=(n,e)=>e.field;function AN(n,e){if(n&1&&F(0,"div",6),n&2){let t=c(2);M("innerHTML",t.descriptionHtml(),tn)}}function LN(n,e){if(n&1){let t=z();y(0,"lf-tool-permission-table",17),R("decisionChange",function(i){x(t);let r=c(5);return S(r.onToolPermissionChange(i.toolId,i.decision))}),m()}if(n&2){let t=c().$implicit,o=c(4);M("rows",t.permissionRows)("disabled",t.disabled===!0||o.isRunning())}}function FN(n,e){if(n&1){let t=z();y(0,"lf-inline-field",18),R("valueChange",function(i){x(t);let r=c().$implicit,s=c(4);return S(s.onFieldChange(r.field,i))}),m()}if(n&2){let t=c().$implicit,o=c(4);M("config",t.config)("value",t.value)("disabled",t.disabled===!0||o.isRunning())("expandLabel",t.label)}}function zN(n,e){if(n&1&&(y(0,"p",15),w(1),m()),n&2){let t=c().$implicit;u(),H(" ",t.fieldError," ")}}function $N(n,e){if(n&1&&(y(0,"p",16),w(1),m()),n&2){let t=c().$implicit;u(),H(" ",t.emptyHint," ")}}function BN(n,e){if(n&1&&(y(0,"div",9)(1,"span",12),w(2),m(),P(3,LN,1,2,"lf-tool-permission-table",13)(4,FN,1,4,"lf-inline-field",14),P(5,zN,2,1,"p",15)(6,$N,2,1,"p",16),m()),n&2){let t=e.$implicit;u(2),H(" ",t.label," "),u(),E(t.kind==="tool-permission-table"&&t.permissionRows!==void 0?3:4),u(2),E(t.fieldError!==void 0?5:t.emptyHint!==void 0?6:-1)}}function HN(n,e){if(n&1&&(y(0,"div",11),X(1,BN,7,3,"div",9,ON),m()),n&2){let t=c();u(),Q(t)}}function UN(n,e){n&1&&P(0,HN,3,0,"div",11),n&2&&E(e.length>0?0:-1)}function VN(n,e){n&1&&(y(0,"span",20),w(1,"\xB7 hidden"),m())}function jN(n,e){if(n&1){let t=z();y(0,"lf-inline-field",23),R("valueChange",function(i){x(t);let r=c().$implicit,s=c(2);return S(s.onInputChange(r.portId,i))}),m()}if(n&2){let t=c().$implicit,o=c(2);M("config",t.inline)("value",t.value)("disabled",o.isRunning()||t.connected)("expandable",!t.connected)("expandLabel",t.label)}}function WN(n,e){if(n&1&&(y(0,"pre",22),w(1),m()),n&2){let t=c().$implicit,o=c(2);u(),ue(o.formatValue(t.value))}}function GN(n,e){if(n&1&&(y(0,"div",9)(1,"span",19),w(2),y(3,"span",20),w(4),m(),P(5,VN,2,0,"span",20),m(),P(6,jN,1,5,"lf-inline-field",21)(7,WN,2,1,"pre",22),m()),n&2){let t=e.$implicit;u(2),H(" ",t.label," "),u(2),H("\xB7 ",t.wireType),u(),E(t.hidden?5:-1),u(),E(t.inline!==null?6:7)}}function qN(n,e){n&1&&(y(0,"p",10),w(1," This node has no input ports. "),m())}function KN(n,e){n&1&&(y(0,"span",20),w(1,"\xB7 hidden"),m())}function YN(n,e){if(n&1&&(y(0,"div",9)(1,"span",19),w(2),y(3,"span",20),w(4),m(),P(5,KN,2,0,"span",20),m(),y(6,"pre",22),w(7),m()()),n&2){let t=e.$implicit,o=c(2);u(2),H(" ",t.label," "),u(2),H("\xB7 ",t.wireType),u(),E(t.hidden?5:-1),u(2),ue(t.cachedValue===void 0?"\u2014":o.formatValue(t.cachedValue))}}function ZN(n,e){n&1&&(y(0,"p",10),w(1," This node has no output ports. "),m())}function XN(n,e){if(n&1){let t=z();y(0,"div",0)(1,"div")(2,"div",2)(3,"h2",3),w(4),m(),y(5,"button",4),R("click",function(){x(t);let i=c();return S(i.onClose())}),w(6," Close "),m()(),y(7,"p",5),w(8),m(),P(9,AN,1,1,"div",6),m(),P(10,UN,1,1),on(11,"async"),y(12,"div",7)(13,"span",8),w(14," Inputs "),m(),X(15,GN,8,4,"div",9,rb,!1,qN,2,0,"p",10),m(),y(18,"div",7)(19,"span",8),w(20," Outputs (cached) "),m(),X(21,YN,8,4,"div",9,rb,!1,ZN,2,0,"p",10),m()()}if(n&2){let t,o=e,i=c();u(4),H(" ",o.ui.label??o.definition.displayName," "),u(4),Wo(" ",o.type," \xB7 ",o.id," "),u(),E(i.descriptionHtml()!==null?9:-1),u(),E((t=rn(11,7,i.panelRows$))?10:-1,t),u(5),Q(i.inputRows()),u(6),Q(i.outputRows())}}function QN(n,e){n&1&&(y(0,"p",1),w(1," Select a node on the canvas to inspect its details. "),m())}var sb="Wire tool-registration nodes to enable toggles",JN="Add skills under .langflower/skills/<id>/SKILL.md",eO="Configure providers in .langflower/langflower.jsonc",tO="Declare MCP servers under mcp.servers in .langflower/langflower.jsonc",nO="Select a provider",db=n=>typeof n=="string"&&n.trim().length>0?n:void 0,oO=n=>Object.fromEntries(Object.entries(n).map(([e,t])=>[e,t.models])),iO=(n,e)=>{let t=e[n];if(t!==void 0)return p({loading:!1},t.error!==void 0?{error:t.error}:{})},lb=(n,e,t,o,i,r)=>{if(n.optionsSource==="node.wiredTools")return o!==null&&i!==null?Qw(o,i):[];if(n.optionsSource==="langflower.models"){let s=db(n.dependsOn!==void 0?t[n.dependsOn]:void 0),a=s!==void 0?e.provider?.[s]?.models:void 0,d=s!==void 0?r[s]:void 0;return Oo(a,d)}return Jw(e,n,t)},rO=(n,e,t,o,i,r,s)=>{let a=lb(n,e,t,o,i,r);switch(n.type){case"string":case"url":case"file-path":case"phase":case"llm-message":return"text";case"number":return ob(n);case"boolean":return"boolean";case"select":return{type:"select",options:nb(n,a,s)};case"tool-id-list":return{type:"multiselect",options:a};default:return"text-multiline"}},ab=(n,e,t)=>n?.edges.some(o=>o.toNodeId===e&&o.toPort[0]===t)===!0,sO=n=>n.dynamic===!0?"dynamic":String(n.wireType??"any"),aO=n=>n.fromInput!==void 0?`from(${n.fromInput})`:String(n.wireType),dO=n=>n.uiSchema,lO=(n,e,t,o)=>{let i=oO(o);return dO(n.definition).map(r=>{let s=lb(r,e,n.params,t,n.id,i);if(r.type==="tool-permission-table"){let _=Ud(n.params.rolePreset),D=ff(_,n.params.toolPermissions),L=ib(s,D,e.permission);return p({field:r.field,label:r.label??r.field,config:"text",value:D,kind:"tool-permission-table",permissionRows:L},L.length===0?{emptyHint:s.length===0?sb:"All tools are denied by project floor"}:{})}let a=n.params[r.field]??r.default,d=r.optionsSource==="langflower.mcpServers"?Array.isArray(a)?a.map(String):[]:a,l=r.optionsSource==="langflower.models"?db(n.params.providerId):void 0,h=r.optionsSource==="langflower.models"?l===void 0?{disabled:!1,emptyHint:nO}:tb(s.length,iO(l,o)):void 0,g=s.length===0?r.optionsSource==="node.wiredTools"?sb:r.optionsSource==="langflower.mcpServers"?tO:r.optionsSource==="langflower.skills"?JN:r.optionsSource==="langflower.providers"?eO:void 0:void 0;return p({field:r.field,label:r.label??r.field,config:rO(r,e,n.params,t,n.id,i,Zw(e.model)),value:d},h!==void 0?p(p({disabled:h.disabled},h.fieldError!==void 0?{fieldError:h.fieldError}:{}),h.emptyHint!==void 0?{emptyHint:h.emptyHint}:{}):g!==void 0?{emptyHint:g}:{})})},qd=class n{constructor(){this.bridge=f(ie);this.execution=f(we);this.configProjection=f(qn);this.modelsCatalogProjection=f(Kn);this.selection=f(Yn);this.selectedNode=this.selection.selectedNode;this.descriptionHtml=b(()=>{let e=this.selectedNode();return e===null?null:pd(e.definition.description)});this.langflowerConfig=this.configProjection.config;this.activeGraph=this.execution.activeGraph;this.isRunning=this.execution.isRunning;this.panelRows$=Te({catalogs:this.modelsCatalogProjection.catalogs$,node:this.selection.selectedNode$,config:this.configProjection.config$,graph:et(this.activeGraph)}).pipe(I(({catalogs:e,node:t,config:o,graph:i})=>t===null?[]:lO(t,o,i,e)));this.inputRows=b(()=>{let e=this.selectedNode(),t=this.activeGraph();return e===null?[]:e.definition.inputsConfigs.filter(o=>typeof o.portId=="string").map(o=>{let i=o.portId,r=e.inputs[i]!==void 0?e.inputs[i]:o.defaultValue;return{portId:i,label:o.name??i,wireType:sO(o),hidden:o.hidden===!0,inline:o.multi===void 0?o.inline??null:null,value:r,connected:ab(t,e.id,i)}})});this.outputRows=b(()=>{let e=this.selectedNode();return e===null?[]:e.definition.outputsConfigs.filter(t=>t!==void 0&&typeof t.portId=="string").map(t=>{let o=t.portId;return{portId:o,label:t.name??o,wireType:aO(t),hidden:t.hidden===!0,cachedValue:this.execution.latestOutputValue(e.id,o)}})});this.formatValue=Zt}onToolPermissionChange(e,t){let o=this.selectedNode();if(o===null||this.execution.isRunning())return;let i=Ud(o.params.rolePreset),r=ff(i,o.params.toolPermissions),s=Vd(this.langflowerConfig().permission,e),a=jd(s,t);this.bridge.raw["editor.updateNode.requested"].next({nodeId:o.id,params:C(p({},o.params),{toolPermissions:C(p({},r),{[e]:a})})})}onClose(){this.bridge.raw["editor.selectNode.requested"].next({nodeId:null})}onFieldChange(e,t){let o=this.selectedNode();if(o===null||this.execution.isRunning())return;let i=e==="rolePreset"?Gw(o.params,Ud(t)):C(p({},o.params),{[e]:t});this.bridge.raw["editor.updateNode.requested"].next({nodeId:o.id,params:i})}onInputChange(e,t){let o=this.selectedNode();o===null||this.execution.isRunning()||ab(this.activeGraph(),o.id,e)||this.bridge.raw["editor.updateNode.requested"].next({nodeId:o.id,inputs:C(p({},o.inputs),{[e]:t})})}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-inspector-panel"]],decls:2,vars:1,consts:[[1,"flex","flex-col","gap-4"],[1,"mt-2","text-xs","leading-5","text-zinc-500","dark:text-zinc-400"],[1,"flex","items-start","justify-between","gap-2"],[1,"text-sm","font-semibold","text-zinc-900","dark:text-zinc-100"],["type","button","aria-label","Close inspector",1,"rounded-md","border","border-zinc-200","px-2","py-1","text-[11px]","font-medium","text-zinc-600","transition","hover:bg-zinc-100","dark:border-zinc-700","dark:text-zinc-300","dark:hover:bg-zinc-800",3,"click"],[1,"mt-0.5","text-[10px]","text-zinc-500","dark:text-zinc-400"],[1,"prose","prose-xs","mt-2","max-w-none","text-zinc-600","dark:prose-invert","dark:text-zinc-300",3,"innerHTML"],[1,"flex","flex-col","gap-1.5"],[1,"text-[10px]","font-semibold","uppercase","tracking-wide","text-zinc-500","dark:text-zinc-400"],[1,"flex","flex-col","gap-1"],[1,"text-[11px]","text-zinc-500","dark:text-zinc-400"],[1,"flex","flex-col","gap-2"],[1,"text-[10px]","font-medium","text-zinc-600","dark:text-zinc-300"],[3,"rows","disabled"],[3,"config","value","disabled","expandLabel"],[1,"text-[10px]","text-rose-600","dark:text-rose-400"],[1,"text-[10px]","text-zinc-500","dark:text-zinc-400"],[3,"decisionChange","rows","disabled"],[3,"valueChange","config","value","disabled","expandLabel"],[1,"text-[10px]","text-zinc-600","dark:text-zinc-300"],[1,"text-zinc-400","dark:text-zinc-500"],[3,"config","value","disabled","expandable","expandLabel"],[1,"lf-scroll","max-h-48","overflow-y-auto","whitespace-pre-wrap","break-words","rounded-md","border","border-zinc-200","bg-zinc-50","p-1.5","text-[11px]","leading-4","text-zinc-600","dark:border-zinc-800","dark:bg-zinc-950","dark:text-zinc-400"],[3,"valueChange","config","value","disabled","expandable","expandLabel"]],template:function(t,o){if(t&1&&P(0,XN,24,9,"div",0)(1,QN,2,0,"p",1),t&2){let i;E((i=o.selectedNode())?0:1,i)}},dependencies:[no,Gd,sn],encapsulation:2})}};var cO=n=>typeof n=="object"&&n!==null&&!Array.isArray(n),uO=n=>{let e=n.options;return cO(e)&&typeof e.baseURL=="string"?e.baseURL:""},pO=n=>n.hasApiKey===!0,Li=n=>{let e=Object.entries(n.provider??{}).map(([r,s])=>({id:r,name:s.name,baseURL:uO(s),modelsText:(s.models??[]).join(", "),apiKey:"",hasApiKey:pO(s)})),t=n.serverLogs===!0?"on":n.serverLogs===!1?"off":"default",o=Wd(n.model),i=Wd(n.embedding);return{defaultProviderId:o?.providerId??"",defaultModelId:o?.model??"",defaultEmbeddingProviderId:i?.providerId??"",defaultEmbeddingModelId:i?.model??"",providers:e,secrets:[],serverLogs:t}};var cb=n=>C(p({},n),{providers:n.providers.map(e=>C(p({},e),{apiKey:""})),secrets:(n.secrets??[]).map(e=>C(p({},e),{value:""}))}),ub=n=>n.split(",").map(e=>e.trim()).filter(e=>e.length>0),hO=n=>n==="on"?!0:n==="off"?!1:null,pb=(n,e)=>{let t=Object.fromEntries(e.providers.filter(s=>s.apiKey.trim().length>0).map(s=>[s.id.trim(),s.apiKey.trim()])),o=Object.fromEntries(e.providers.filter(s=>s.id.trim().length>0).map(s=>{let a=ub(s.modelsText),d=s.baseURL.trim();return[s.id.trim(),p(p({name:s.name.trim()||s.id.trim()},a.length>0?{models:a}:{}),d.length>0?{options:{baseURL:d}}:{})]})),i=gf(e.defaultProviderId,e.defaultModelId)??"",r=gf(e.defaultEmbeddingProviderId,e.defaultEmbeddingModelId)??"";return{scope:n,model:i,embedding:r,provider:o,providerApiKeys:t,serverLogs:hO(e.serverLogs)}},hb=n=>{let e=n.secrets.map(o=>o.id.trim()).filter(o=>o.length>0),t=Object.fromEntries(n.secrets.flatMap(o=>{let i=o.id.trim(),r=o.value.trim();return i.length>0&&r.length>0?[[i,r]]:[]}));return{secretIds:e,secretValues:t}},Kd=(n,e)=>JSON.stringify(n)===JSON.stringify(e),fb=(n,e)=>C(p({},e),{secrets:(e.secrets??n.secrets??[]).map(t=>{if(t.value.trim().length>0)return t;let i=t.id.trim(),r=i.length===0?void 0:n.secrets?.find(s=>s.id.trim()===i);return C(p({},t),{value:r?.value??""})}),providers:e.providers.map(t=>{if(t.apiKey.trim().length>0)return t;let i=t.id.trim(),r=i.length===0?void 0:n.providers.find(s=>s.id.trim()===i);return C(p({},t),{apiKey:r?.apiKey??""})})}),gb=(n,e,t)=>{if(Kd(n,e))return t;let o=C(p({},n),{providers:n.providers.map(i=>{let r=t.providers.find(s=>s.id===i.id);return C(p({},i),{apiKey:"",hasApiKey:r?.hasApiKey??!1})}),secrets:(n.secrets??[]).map(i=>{let r=t.secrets?.find(s=>s.id===i.id);return C(p({},i),{value:"",hasValue:r?.hasValue??!1})})});return Kd(o,t)?t:o},Yd=(n,e)=>{let t=e.trim();if(t.length===0)return[];let o=n.providers.find(i=>i.id===t);return o===void 0?[]:ub(o.modelsText)},mf=n=>Yd(n,n.defaultProviderId),mb=n=>n.id.trim();var fO=/^[A-Za-z_][A-Za-z0-9_]*$/,yb=n=>fO.test(n);var vb=Li({}),wb={scope:"project",draft:vb,baseline:vb,dirty:!1,connections:{}},Zd=class n{constructor(){this.bridge=f(ie);this.snapshot$=this.bridge.cached["langflower.config.draft.snapshot"].pipe(de(wb),te({bufferSize:1,refCount:!1}));this.snapshot=oe(this.snapshot$,{initialValue:wb});this.draft=b(()=>this.snapshot().draft);this.baseline=b(()=>this.snapshot().baseline);this.dirty=b(()=>this.snapshot().dirty);this.scope=b(()=>this.snapshot().scope);this.connections=b(()=>this.snapshot().connections);this.connections$=this.snapshot$.pipe(I(e=>e.connections),te({bufferSize:1,refCount:!1}))}connectionFor(e){let t=this.draft().providers[e];return t===void 0?{state:"idle"}:this.connections()[mb(t)]??{state:"idle"}}emitPatch(e,t){this.bridge.raw["langflower.config.draft.patch.requested"].next({scope:e,draft:cb(t)})}emitDiscard(e){this.bridge.raw["langflower.config.draft.discard.requested"].next({scope:e})}emitSave(e){this.bridge.raw["langflower.config.save.requested"].next({scope:e})}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275prov=j({token:n,factory:n.\u0275fac,providedIn:"root"})}};var bb=(n,e)=>e.id,yf=(n,e)=>e.value;function gO(n,e){if(n&1&&(O(0,"p",29),w(1," Global file: "),O(2,"span",30),w(3),N()(),O(4,"p",29),w(5," Secrets file: "),O(6,"span",30),w(7),N()()),n&2){let t=c();u(3),ue(t.globalPath()||"\u2026"),u(4),ue(t.secretsPath()||"\u2026")}}function mO(n,e){n&1&&(O(0,"p",6),w(1),N()),n&2&&(u(),H(" ",e," "))}function yO(n,e){if(n&1&&(O(0,"option",15),w(1),N()),n&2){let t=e.$implicit,o=c();he("value",t.id)("selected",o.draft().defaultProviderId===t.id),u(),H(" ",t.title," ")}}function vO(n,e){if(n&1&&(O(0,"option",15),w(1),N()),n&2){let t=e.$implicit,o=c();he("value",t.value)("selected",o.draft().defaultModelId===t.value),u(),H(" ",t.title," ")}}function wO(n,e){if(n&1&&(O(0,"option",15),w(1),N()),n&2){let t=e.$implicit,o=c();he("value",t.id)("selected",o.draft().defaultEmbeddingProviderId===t.id),u(),H(" ",t.title," ")}}function bO(n,e){if(n&1&&(O(0,"option",15),w(1),N()),n&2){let t=e.$implicit,o=c();he("value",t.value)("selected",o.draft().defaultEmbeddingModelId===t.value),u(),H(" ",t.title," ")}}function CO(n,e){if(n&1){let t=z();O(0,"label",21)(1,"input",31),ge("change",function(){let i=x(t).$implicit,r=c();return S(r.patchDraft({serverLogs:i.value}))}),N(),w(2),N()}if(n&2){let t=e.$implicit,o=c();u(),he("checked",o.draft().serverLogs===t.value),u(),H(" ",t.label," ")}}function _O(n,e){n&1&&w(0," Checking connection\u2026 ")}function xO(n,e){if(n&1&&w(0),n&2){let t=c();H(" Connected (",t.modelCount," models) ")}}function SO(n,e){if(n&1&&w(0),n&2){let t=c();H(" ",t.message," ")}}function PO(n,e){n&1&&w(0," Enter Base URL to test connection ")}function EO(n,e){if(n&1&&(O(0,"p",39),bt(1,"span",40),P(2,_O,1,0)(3,xO,1,1)(4,SO,1,1)(5,PO,1,0),N()),n&2){let t,o=e;G("text-zinc-500",o.state==="idle"||o.state==="checking")("dark:text-zinc-400",o.state==="idle"||o.state==="checking")("text-emerald-600",o.state==="ok")("dark:text-emerald-400",o.state==="ok")("text-rose-600",o.state==="error")("dark:text-rose-400",o.state==="error"),u(),G("bg-zinc-400",o.state==="idle"||o.state==="checking")("bg-emerald-500",o.state==="ok")("bg-rose-500",o.state==="error"),u(),E((t=o.state)==="checking"?2:t==="ok"?3:t==="error"?4:5)}}function IO(n,e){if(n&1){let t=z();O(0,"div",24)(1,"div",32)(2,"span",33),w(3),N(),O(4,"button",34),ge("click",function(){let i=x(t).$index,r=c();return S(r.removeProvider(i))}),w(5," Remove "),N()(),O(6,"label",11)(7,"span",12),w(8,"Id"),N(),O(9,"input",35),ge("input",function(i){let r=x(t).$index,s=c();return S(s.patchProviderDebounced(r,{id:s.readInput(i)}))})("blur",function(i){let r=x(t).$index,s=c();return S(s.patchProviderFlush(r,{id:s.readInput(i)}))}),N()(),O(10,"label",11)(11,"span",12),w(12,"Name"),N(),O(13,"input",35),ge("input",function(i){let r=x(t).$index,s=c();return S(s.patchProviderDebounced(r,{name:s.readInput(i)}))})("blur",function(i){let r=x(t).$index,s=c();return S(s.patchProviderFlush(r,{name:s.readInput(i)}))}),N()(),O(14,"label",11)(15,"span",12),w(16,"Base URL"),N(),O(17,"input",36),ge("input",function(i){let r=x(t).$index,s=c();return S(s.patchProviderDebounced(r,{baseURL:s.readInput(i)}))})("change",function(i){let r=x(t).$index,s=c();return S(s.patchProviderFlush(r,{baseURL:s.readInput(i)}))})("blur",function(i){let r=x(t).$index,s=c();return S(s.patchProviderFlush(r,{baseURL:s.readInput(i)}))}),N(),P(18,EO,6,19,"p",37),N(),O(19,"label",11)(20,"span",12),w(21,"API key"),N(),O(22,"input",38),ge("input",function(i){let r=x(t).$index,s=c();return S(s.patchProviderDebounced(r,{apiKey:s.readInput(i)}))})("change",function(i){let r=x(t).$index,s=c();return S(s.patchProviderFlush(r,{apiKey:s.readInput(i)}))})("blur",function(i){let r=x(t).$index,s=c();return S(s.patchProviderFlush(r,{apiKey:s.readInput(i)}))}),N()(),O(23,"label",11)(24,"span",12),w(25,"Models (comma-separated)"),N(),O(26,"input",35),ge("input",function(i){let r=x(t).$index,s=c();return S(s.patchProviderDebounced(r,{modelsText:s.readInput(i)}))})("blur",function(i){let r=x(t).$index,s=c();return S(s.patchProviderFlush(r,{modelsText:s.readInput(i)}))}),N()()()}if(n&2){let t,o=e.$implicit,i=e.$index,r=c();u(3),H(" Provider ",i+1," "),u(6),he("value",o.id),u(4),he("value",o.name),u(4),he("value",o.baseURL),u(),E((t=r.connectionStatus(i))?18:-1,t),u(4),he("placeholder",o.hasApiKey?"Saved \u2014 enter new value to replace":"Prefer {env:VAR_NAME}")("value",o.apiKey),u(4),he("value",o.modelsText)}}function kO(n,e){n&1&&(O(0,"div",41),w(1," Add an OpenAI-compatible provider (OpenAI, LM Studio, or similar) to unlock full functionality. You can still explore the canvas with simple nodes and Fake LLM without a provider; a real provider is required for live model runs, Sub-Agent workflows, and the seeded coding samples. "),N())}function DO(n,e){n&1&&(O(0,"p",42),w(1," No providers in this scope yet. "),N())}function TO(n,e){if(n&1&&P(0,kO,2,0,"div",41)(1,DO,2,0,"p",42),n&2){let t=c();E(t.showProviderOnboardingHint()?0:1)}}function MO(n,e){if(n&1){let t=z();O(0,"div",24)(1,"div",32)(2,"span",33),w(3),N(),O(4,"button",34),ge("click",function(){let i=x(t).$index,r=c(2);return S(r.removeSecret(i))}),w(5," Remove "),N()(),O(6,"label",11)(7,"span",12),w(8,"Id"),N(),O(9,"input",44),ge("input",function(i){let r=x(t).$index,s=c(2);return S(s.patchSecretDebounced(r,{id:s.readInput(i)}))})("change",function(i){let r=x(t).$index,s=c(2);return S(s.patchSecretFlush(r,{id:s.readInput(i)}))}),N()(),O(10,"label",11)(11,"span",12),w(12,"Value"),N(),O(13,"input",45),ge("input",function(i){let r=x(t).$index,s=c(2);return S(s.patchSecretDebounced(r,{value:s.readInput(i)}))})("change",function(i){let r=x(t).$index,s=c(2);return S(s.patchSecretFlush(r,{value:s.readInput(i)}))}),N()()()}if(n&2){let t=e.$implicit,o=e.$index;u(3),H(" Secret ",o+1," "),u(6),he("value",t.id),u(4),he("placeholder",t.hasValue?"Saved \u2014 enter new value to replace":"")("value",t.value)}}function RO(n,e){n&1&&(O(0,"p",18),w(1," No named secrets yet. Add an id and value to keep tokens out of the project folder. "),N())}function NO(n,e){if(n&1){let t=z();O(0,"div",9)(1,"div",22)(2,"span",10),w(3," Secrets "),N(),O(4,"button",23),ge("click",function(){x(t);let i=c();return S(i.addSecret())}),w(5," Add "),N()(),O(6,"p",43),w(7," Secrets are stored in Langflower user settings on this computer, not in the project. Those Langflower files can still be read \u2014 this is not encryption. The goal is to keep secrets out of the workspace so agents cannot retrieve them with file tools. "),N(),X(8,MO,14,4,"div",24,nn),P(10,RO,2,0,"p",18),N()}if(n&2){let t=c();u(8),Q(t.draft().secrets),u(2),E(t.draft().secrets.length===0?10:-1)}}function OO(n,e){n&1&&(O(0,"p",18),w(1," Secrets are stored in Global. "),N())}function AO(n,e){if(n&1&&(O(0,"p",48),w(1),N()),n&2){let t=c(2);G("text-rose-600",t.bootstrapMessageIsError())("dark:text-rose-400",t.bootstrapMessageIsError())("text-zinc-600",!t.bootstrapMessageIsError())("dark:text-zinc-300",!t.bootstrapMessageIsError()),u(),H(" ",e," ")}}function LO(n,e){if(n&1){let t=z();O(0,"div",25)(1,"span",10),w(2," Project seed "),N(),O(3,"p",18),w(4," Re-copy packaged skeleton templates (workflows, skills, my-nodes, instructions). Does not change langflower.jsonc providers or MCP. "),N(),O(5,"button",46),ge("click",function(){x(t);let i=c();return S(i.bootstrap())}),w(6),N(),P(7,AO,2,9,"p",47),N()}if(n&2){let t,o=c();u(5),he("disabled",o.bootstrapPending()),u(),H(" ",o.bootstrapPending()?"Bootstrapping\u2026":"Bootstrap"," "),u(),E((t=o.bootstrapMessage())?7:-1,t)}}var FO=250,Cb=(n,e)=>e.length>0&&!n.some(t=>t.id===e)?[{id:e,title:e},...n]:n,Xd=class n{constructor(){this.bridge=f(ie);this.configProjection=f(qn);this.draftProjection=f(Zd);this.editorSettings=f(ri);this.modelsCatalog=f(Kn);this.serverLogsOptions=[{value:"off",label:"Off"},{value:"default",label:"Default"},{value:"on",label:"On"}];this.scope=this.editorSettings.scope;this.draft=U(Li({}));this.syncedBaseline=U(Li({}));this.validationError=U(null);this.bootstrapPending=U(!1);this.bootstrapMessage=U(null);this.bootstrapMessageIsError=U(!1);this.catalogs=oe(this.modelsCatalog.catalogs$,{initialValue:{}});this.globalPath=b(()=>this.configProjection.layers().globalPath);this.secretsPath=b(()=>this.configProjection.layers().secretsPath);this.providerSelectRows=b(()=>this.draft().providers.filter(e=>e.id.trim().length>0).map(e=>({id:e.id,title:e.name.trim()||e.id})));this.defaultProviderOptions=b(()=>Cb(this.providerSelectRows(),this.draft().defaultProviderId.trim()));this.defaultEmbeddingProviderOptions=b(()=>Cb(this.providerSelectRows(),this.draft().defaultEmbeddingProviderId.trim()));this.defaultModelOptions=b(()=>{let e=this.draft(),t=e.defaultProviderId.trim();if(t.length===0)return[];let o=mf(e),i=this.catalogs()[t]?.models;return Oo(o,i)});this.defaultModelSelectOptions=b(()=>{let e=this.defaultModelOptions(),t=this.draft().defaultModelId.trim();return t.length>0&&!e.some(o=>o.value===t)?[{value:t,title:t},...e]:e});this.defaultEmbeddingModelOptions=b(()=>{let e=this.draft(),t=e.defaultEmbeddingProviderId.trim();if(t.length===0)return[];let o=Yd(e,t),i=this.catalogs()[t]?.models;return Oo(o,i)});this.defaultEmbeddingModelSelectOptions=b(()=>{let e=this.defaultEmbeddingModelOptions(),t=this.draft().defaultEmbeddingModelId.trim();return t.length>0&&!e.some(o=>o.value===t)?[{value:t,title:t},...e]:e});this.showProviderOnboardingHint=b(()=>{if(this.scope()!=="project")return!0;let e=this.configProjection.layers().globalConfig.provider??{};if(Object.keys(e).length>0)return!1;let t=this.configProjection.config().provider??{};return Object.keys(t).length===0});this.isDirty=b(()=>{let e=this.draftProjection.snapshot(),t=e.scope===this.scope()?e.dirty:!1,o=this.draft().secrets.some(i=>i.value.trim().length>0);return t||o});this.readInput=e=>{let t=e.target;return t instanceof HTMLInputElement?t.value:""};this.readSelect=e=>{let t=e.target;return t instanceof HTMLSelectElement?t.value:""};xe(()=>{let e=this.draftProjection.snapshot(),t=this.scope();e.scope===t&&ye(()=>{let o=this.draft(),i=this.syncedBaseline(),r=e.draft,s=e.baseline,a=Kd(i,s)?fb(o,r):gb(o,i,s);this.draft.set(a),this.syncedBaseline.set(s)})})}ngOnDestroy(){this.patchTimer!==void 0&&clearTimeout(this.patchTimer)}connectionStatus(e){return this.draftProjection.connectionFor(e)}flushPatch(){this.patchTimer!==void 0&&(clearTimeout(this.patchTimer),this.patchTimer=void 0),this.draftProjection.emitPatch(this.scope(),this.draft())}schedulePatch(){this.patchTimer!==void 0&&clearTimeout(this.patchTimer),this.patchTimer=setTimeout(()=>{this.patchTimer=void 0,this.draftProjection.emitPatch(this.scope(),this.draft())},FO)}onDefaultProviderChange(e){let t=e.trim(),o=this.draft(),i=C(p({},o),{defaultProviderId:t,defaultModelId:o.defaultModelId}),s=Oo(mf(i),this.catalogs()[t]?.models).some(a=>a.value===o.defaultModelId);this.patchDraftFlush({defaultProviderId:t,defaultModelId:s?o.defaultModelId:""})}onDefaultEmbeddingProviderChange(e){let t=e.trim(),o=this.draft(),i=C(p({},o),{defaultEmbeddingProviderId:t,defaultEmbeddingModelId:o.defaultEmbeddingModelId}),s=Oo(Yd(i,t),this.catalogs()[t]?.models).some(a=>a.value===o.defaultEmbeddingModelId);this.patchDraftFlush({defaultEmbeddingProviderId:t,defaultEmbeddingModelId:s?o.defaultEmbeddingModelId:""})}setScope(e){if(e!==this.scope()){if(this.isDirty()){if(!window.confirm("Discard unsaved settings changes for this scope?"))return;this.draftProjection.emitDiscard(this.scope())}this.validationError.set(null),this.syncedBaseline.set(Li({})),this.editorSettings.requestScope(e)}}patchDraft(e){this.patchDraftFlush(e)}patchDraftFlush(e){this.draft.update(t=>p(p({},t),e)),this.validationError.set(null),this.flushPatch()}patchProviderDebounced(e,t){this.applyProviderPatch(e,t),this.schedulePatch()}patchProviderFlush(e,t){this.applyProviderPatch(e,t),this.flushPatch()}applyProviderPatch(e,t){this.draft.update(o=>C(p({},o),{providers:o.providers.map((i,r)=>r===e?p(p({},i),t):i)})),this.validationError.set(null)}addProvider(){this.draft.update(e=>C(p({},e),{providers:[...e.providers,{id:"",name:"",baseURL:"",modelsText:"",apiKey:"",hasApiKey:!1}]})),this.flushPatch()}removeProvider(e){this.draft.update(t=>C(p({},t),{providers:t.providers.filter((o,i)=>i!==e)})),this.flushPatch()}addSecret(){this.draft.update(e=>C(p({},e),{secrets:[...e.secrets,{id:"",value:"",hasValue:!1}]})),this.flushPatch()}removeSecret(e){this.draft.update(t=>C(p({},t),{secrets:t.secrets.filter((o,i)=>i!==e)})),this.flushPatch()}patchSecretDebounced(e,t){this.applySecretPatch(e,t),this.schedulePatch()}patchSecretFlush(e,t){this.applySecretPatch(e,t),this.flushPatch()}applySecretPatch(e,t){this.draft.update(o=>C(p({},o),{secrets:o.secrets.map((i,r)=>r===e?p(p({},i),t):i)})),this.validationError.set(null)}discard(){this.validationError.set(null),this.draftProjection.emitDiscard(this.scope())}save(){this.flushPatch();let e=this.draft(),t=e.providers.map(o=>o.id.trim());if(t.some(o=>o.length===0)){this.validationError.set("Each provider needs a non-empty id.");return}if(new Set(t).size!==t.length){this.validationError.set("Provider ids must be unique.");return}if(this.scope()==="global"){let o=e.secrets.map(i=>i.id.trim());if(o.some(i=>i.length===0)){this.validationError.set("Each secret needs a non-empty id.");return}if(new Set(o).size!==o.length){this.validationError.set("Secret ids must be unique.");return}if(o.some(i=>!yb(i))){this.validationError.set("Secret ids must start with a letter or underscore and use only letters, digits, and underscores.");return}this.bridge.raw["langflower.secrets.save.requested"].next(hb(e))}this.bridge.raw["langflower.config.save.requested"].next(pb(this.scope(),e)),this.validationError.set(null)}bootstrap(){return A(this,null,function*(){if(this.scope()!=="project"||this.bootstrapPending()||!window.confirm(["Restore skeleton templates into this project?","","This overwrites packaged workflows, skills, my-nodes, and instructions.","langflower.jsonc (providers / MCP) is not changed.","Stop any active run first."].join(`
|
|
323
|
+
`)))return;this.bootstrapPending.set(!0),this.bootstrapMessage.set(null),this.bootstrapMessageIsError.set(!1);let t=us(this.bridge.raw["project.bootstrap.result"].pipe(Wt(1)));this.bridge.raw["project.bootstrap.requested"].next({});try{let o=yield t;o.ok?(this.bootstrapMessage.set("Skeleton templates restored."),this.bootstrapMessageIsError.set(!1)):(this.bootstrapMessage.set(o.message),this.bootstrapMessageIsError.set(!0))}catch(o){this.bootstrapMessage.set("Bootstrap failed \u2014 no response from server."),this.bootstrapMessageIsError.set(!0)}finally{this.bootstrapPending.set(!1)}})}onClose(){if(this.isDirty()){if(!window.confirm("Discard unsaved settings changes?"))return;this.draftProjection.emitDiscard(this.scope())}this.editorSettings.requestClose()}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-settings-panel"]],decls:81,vars:35,consts:[[1,"flex","h-full","min-h-0","flex-col","gap-3"],[1,"flex","shrink-0","items-center","justify-between","gap-2"],[1,"text-sm","font-semibold","tracking-tight","text-zinc-900","dark:text-zinc-100"],["type","button","aria-label","Close settings",1,"rounded-md","border","border-zinc-200","px-2","py-1","text-[11px]","font-medium","text-zinc-600","transition","hover:bg-zinc-100","dark:border-zinc-700","dark:text-zinc-300","dark:hover:bg-zinc-800",3,"click"],["role","tablist","aria-label","Settings scope",1,"flex","shrink-0","gap-1","rounded-md","border","border-zinc-200","p-0.5","dark:border-zinc-700"],["type","button","role","tab",1,"flex-1","rounded","px-2","py-1","text-[11px]","font-medium","transition",3,"click"],[1,"shrink-0","text-[11px]","leading-4","text-rose-600","dark:text-rose-400"],[1,"lf-scroll","min-h-0","flex-1","overflow-y-auto"],[1,"flex","flex-col","gap-4","pr-1"],[1,"flex","flex-col","gap-2"],[1,"text-[10px]","font-semibold","uppercase","tracking-wide","text-zinc-500","dark:text-zinc-400"],[1,"flex","flex-col","gap-1"],[1,"text-[10px]","text-zinc-500","dark:text-zinc-400"],[1,"rounded-md","border","border-zinc-200","bg-white","px-2","py-1.5","text-sm","text-zinc-900","outline-none","ring-zinc-400/20","focus:ring-2","dark:border-zinc-700","dark:bg-zinc-950","dark:text-zinc-100",3,"change"],["value","",3,"selected"],[3,"value","selected"],[1,"rounded-md","border","border-zinc-200","bg-white","px-2","py-1.5","text-sm","text-zinc-900","outline-none","ring-zinc-400/20","focus:ring-2","disabled:opacity-50","dark:border-zinc-700","dark:bg-zinc-950","dark:text-zinc-100",3,"change","disabled"],[1,"flex","flex-col","gap-1.5"],[1,"text-[11px]","leading-4","text-zinc-500","dark:text-zinc-400"],[1,"font-mono"],["role","radiogroup","aria-label","Server logs",1,"flex","flex-wrap","gap-3"],[1,"inline-flex","items-center","gap-1.5","text-[11px]","text-zinc-700","dark:text-zinc-300"],[1,"flex","items-center","justify-between","gap-2"],["type","button",1,"rounded-md","border","border-zinc-200","px-2","py-0.5","text-[11px]","font-medium","text-zinc-600","transition","hover:bg-zinc-100","dark:border-zinc-700","dark:text-zinc-300","dark:hover:bg-zinc-800",3,"click"],[1,"flex","flex-col","gap-2","rounded-md","border","border-zinc-200","p-2","dark:border-zinc-700"],[1,"flex","flex-col","gap-2","border-t","border-zinc-200","pt-3","dark:border-zinc-800"],[1,"flex","shrink-0","items-center","justify-end","gap-2","border-t","border-zinc-200","pt-3","dark:border-zinc-800"],["type","button",1,"rounded-md","border","border-zinc-200","px-3","py-1.5","text-xs","font-medium","text-zinc-700","transition","hover:bg-zinc-100","disabled:opacity-50","dark:border-zinc-700","dark:text-zinc-200","dark:hover:bg-zinc-800",3,"click","disabled"],["type","button",1,"rounded-md","bg-zinc-900","px-3","py-1.5","text-xs","font-medium","text-white","transition","hover:bg-zinc-800","disabled:opacity-50","dark:bg-zinc-100","dark:text-zinc-900","dark:hover:bg-white",3,"click","disabled"],[1,"shrink-0","break-all","text-[11px]","leading-4","text-zinc-500","dark:text-zinc-400"],[1,"font-mono","text-zinc-700","dark:text-zinc-300"],["type","radio","name","server-logs",1,"align-middle",3,"change","checked"],[1,"flex","items-start","justify-between","gap-2"],[1,"text-[11px]","font-medium","text-zinc-700","dark:text-zinc-300"],["type","button",1,"text-[11px]","text-rose-600","hover:underline","dark:text-rose-400",3,"click"],["type","text",1,"rounded-md","border","border-zinc-200","bg-white","px-2","py-1","text-sm","dark:border-zinc-700","dark:bg-zinc-950",3,"input","blur","value"],["type","url",1,"rounded-md","border","border-zinc-200","bg-white","px-2","py-1","text-sm","dark:border-zinc-700","dark:bg-zinc-950",3,"input","change","blur","value"],["role","status",1,"flex","items-start","gap-1.5","text-[10px]","leading-4",3,"text-zinc-500","dark:text-zinc-400","text-emerald-600","dark:text-emerald-400","text-rose-600","dark:text-rose-400"],["type","password","autocomplete","off",1,"rounded-md","border","border-zinc-200","bg-white","px-2","py-1","text-sm","dark:border-zinc-700","dark:bg-zinc-950",3,"input","change","blur","placeholder","value"],["role","status",1,"flex","items-start","gap-1.5","text-[10px]","leading-4"],["aria-hidden","true",1,"mt-1","h-1.5","w-1.5","shrink-0","rounded-full"],["role","status",1,"rounded-md","border","border-zinc-200","bg-zinc-50","px-2.5","py-2","text-[11px]","leading-4","text-zinc-600","dark:border-zinc-700","dark:bg-zinc-950/60","dark:text-zinc-300"],[1,"text-[11px]","text-zinc-500","dark:text-zinc-400"],[1,"rounded-md","border","border-zinc-200","bg-zinc-50","px-2","py-1.5","text-[11px]","leading-4","text-zinc-600","dark:border-zinc-700","dark:bg-zinc-900","dark:text-zinc-300"],["type","text","autocomplete","off","spellcheck","false",1,"rounded-md","border","border-zinc-200","bg-white","px-2","py-1","text-sm","dark:border-zinc-700","dark:bg-zinc-950",3,"input","change","value"],["type","password","autocomplete","off",1,"rounded-md","border","border-zinc-200","bg-white","px-2","py-1","text-sm","dark:border-zinc-700","dark:bg-zinc-950",3,"input","change","placeholder","value"],["type","button",1,"self-start","rounded-md","border","border-zinc-200","px-3","py-1.5","text-xs","font-medium","text-zinc-700","transition","hover:bg-zinc-100","disabled:opacity-50","dark:border-zinc-700","dark:text-zinc-200","dark:hover:bg-zinc-800",3,"click","disabled"],[1,"text-[11px]","leading-4",3,"text-rose-600","dark:text-rose-400","text-zinc-600","dark:text-zinc-300"],[1,"text-[11px]","leading-4"]],template:function(t,o){if(t&1&&(O(0,"div",0)(1,"div",1)(2,"h2",2),w(3," Settings "),N(),O(4,"button",3),ge("click",function(){return o.onClose()}),w(5," Close "),N()(),O(6,"div",4)(7,"button",5),ge("click",function(){return o.setScope("project")}),w(8," Project "),N(),O(9,"button",5),ge("click",function(){return o.setScope("global")}),w(10," Global "),N()(),P(11,gO,8,2),P(12,mO,2,1,"p",6),O(13,"div",7)(14,"div",8)(15,"div",9)(16,"span",10),w(17," Default chat model "),N(),O(18,"label",11)(19,"span",12),w(20,"Default provider"),N(),O(21,"select",13),ge("change",function(r){return o.onDefaultProviderChange(o.readSelect(r))}),O(22,"option",14),w(23," None "),N(),X(24,yO,2,3,"option",15,bb),N()(),O(26,"label",11)(27,"span",12),w(28,"Default model"),N(),O(29,"select",16),ge("change",function(r){return o.patchDraft({defaultModelId:o.readSelect(r)})}),O(30,"option",14),w(31," None "),N(),X(32,vO,2,3,"option",15,yf),N()()(),O(34,"div",9)(35,"span",10),w(36," Default embedding model "),N(),O(37,"label",11)(38,"span",12),w(39,"Default provider"),N(),O(40,"select",13),ge("change",function(r){return o.onDefaultEmbeddingProviderChange(o.readSelect(r))}),O(41,"option",14),w(42," None "),N(),X(43,wO,2,3,"option",15,bb),N()(),O(45,"label",11)(46,"span",12),w(47,"Default model"),N(),O(48,"select",16),ge("change",function(r){return o.patchDraft({defaultEmbeddingModelId:o.readSelect(r)})}),O(49,"option",14),w(50," None "),N(),X(51,bO,2,3,"option",15,yf),N()()(),O(53,"fieldset",17)(54,"legend",10),w(55," Server logs "),N(),O(56,"p",18),w(57," Bridge diagnostics under "),O(58,"span",19),w(59,".langflower/logs/"),N(),w(60,". Default leaves this scope unset (inherits the other scope; product default is on). "),N(),O(61,"div",20),X(62,CO,3,2,"label",21,yf),N()(),O(64,"div",9)(65,"div",22)(66,"span",10),w(67," Providers "),N(),O(68,"button",23),ge("click",function(){return o.addProvider()}),w(69," Add "),N()(),X(70,IO,27,8,"div",24,nn,!1,TO,2,1),N(),P(73,NO,11,1,"div",9)(74,OO,2,0,"p",18),P(75,LO,8,3,"div",25),N()(),O(76,"div",26)(77,"button",27),ge("click",function(){return o.discard()}),w(78," Discard "),N(),O(79,"button",28),ge("click",function(){return o.save()}),w(80," Save "),N()()()),t&2){let i;u(7),G("bg-zinc-900",o.scope()==="project")("text-white",o.scope()==="project")("text-zinc-600",o.scope()!=="project")("dark:bg-zinc-100",o.scope()==="project")("dark:text-zinc-900",o.scope()==="project"),K("aria-selected",o.scope()==="project"),u(2),G("bg-zinc-900",o.scope()==="global")("text-white",o.scope()==="global")("text-zinc-600",o.scope()!=="global")("dark:bg-zinc-100",o.scope()==="global")("dark:text-zinc-900",o.scope()==="global"),K("aria-selected",o.scope()==="global"),u(2),E(o.scope()==="global"?11:-1),u(),E((i=o.validationError())?12:-1,i),u(10),he("selected",o.draft().defaultProviderId.trim().length===0),u(2),Q(o.defaultProviderOptions()),u(5),he("disabled",o.draft().defaultProviderId.trim().length===0),u(),he("selected",o.draft().defaultModelId.trim().length===0),u(2),Q(o.defaultModelSelectOptions()),u(9),he("selected",o.draft().defaultEmbeddingProviderId.trim().length===0),u(2),Q(o.defaultEmbeddingProviderOptions()),u(5),he("disabled",o.draft().defaultEmbeddingProviderId.trim().length===0),u(),he("selected",o.draft().defaultEmbeddingModelId.trim().length===0),u(2),Q(o.defaultEmbeddingModelSelectOptions()),u(11),Q(o.serverLogsOptions),u(8),Q(o.draft().providers),u(3),E(o.scope()==="global"?73:74),u(2),E(o.scope()==="project"?75:-1),u(2),he("disabled",!o.isDirty()),u(2),he("disabled",!o.isDirty())}},encapsulation:2})}};var vf=n=>{let e=n.replace(/[/\\]+$/,"");if(e.length===0)return n;let t=e.split(/[/\\]/);return t[t.length-1]??e};var _b=n=>`${n} \u2014 Langflower`;function zO(n,e){if(n&1&&(O(0,"span",0),w(1),N()),n&2){let t=e;he("title",t.fullPath),K("aria-label","Project directory: "+t.fullPath),u(),H(" ",t.folderName," ")}}var Qd=class n{constructor(){this.bridge=f(ie);this.view$=this.bridge.cached["toolConfig.snapshot"].pipe(I(e=>({folderName:vf(e.config.projectDir),fullPath:e.config.projectDir})));this.bridge.cached["toolConfig.snapshot"].pipe(ht()).subscribe(e=>{document.title=_b(vf(e.config.projectDir))})}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-project-dir"]],hostAttrs:[1,"inline-flex","items-center"],decls:2,vars:3,consts:[[1,"inline-flex","max-w-64","truncate","text-sm","font-medium","text-zinc-700","dark:text-zinc-200",3,"title"]],template:function(t,o){if(t&1&&(P(0,zO,2,3,"span",0),on(1,"async")),t&2){let i;E((i=rn(1,1,o.view$))?0:-1,i)}},dependencies:[sn],encapsulation:2})}};var Jd=n=>A(null,null,function*(){if(n.running){let e=us(n.interrupted$.pipe(Wt(1)));n.requestInterrupt(),yield e}n.action()});var wf={list:null,current:null,navigationLocked:!1},xb=(n,e)=>{switch(e.type){case"list":return C(p({},n),{list:e.list});case"current":return C(p({},n),{current:e.current});case"navigation":return C(p({},n),{navigationLocked:e.navigationLocked})}},bf=n=>{let e=n.current?.sessionId??null;return{tabs:(n.list?.sessions??[]).map(o=>({sessionId:o.sessionId,label:o.label,active:o.sessionId===e,corrupt:o.corrupt===!0,differs:o.sessionId===e?n.current?.differsFromWorkflow===!0:o.differsFromWorkflow===!0})),sessionId:e,bound:e!==null,controlsDisabled:n.navigationLocked}};var $O=(n,e)=>e.sessionId;function BO(n,e){n&1&&F(0,"div",11)}function HO(n,e){n&1&&F(0,"span",15)}function UO(n,e){if(n&1){let t=z();y(0,"div",2)(1,"div",10),P(2,BO,1,0,"div",11),y(3,"div",12)(4,"lf-hover-tip",13)(5,"button",14),R("click",function(){let i=x(t).$implicit,r=c();return S(r.selectSession(i))}),P(6,HO,1,0,"span",15),w(7),m()(),y(8,"lf-hover-tip",13)(9,"button",16),R("click",function(i){let r=x(t).$implicit,s=c();return S(s.requestDeleteSession(r,i))}),ce(),y(10,"svg",17),F(11,"path",18),m()()()()()()}if(n&2){let t=e.$implicit,o=c();u(),G("h-full",t.active)("top-1",!t.active)("rounded-md",!t.active)("hover:bg-zinc-100",!t.active)("dark:hover:bg-zinc-800",!t.active),u(),E(t.active?2:-1),u(),G("relative",t.active)("top-1",t.active),u(),G("cursor-not-allowed",o.view().controlsDisabled||t.corrupt),M("tip",o.sessionTip(t)),u(),G("font-semibold",t.active),M("disabled",o.view().controlsDisabled||t.corrupt),K("aria-selected",t.active),u(),E(t.differs?6:-1),u(),H(" ",t.label," "),u(),G("cursor-not-allowed",o.view().controlsDisabled),M("tip",o.tip("Delete this session")),u(),M("disabled",o.view().controlsDisabled),K("aria-label","Delete session "+t.label)}}function VO(n,e){if(n&1){let t=z();y(0,"div",19),R("click",function(){x(t);let i=c();return S(i.cancelDeleteSession())}),y(1,"div",20),R("click",function(i){return i.stopPropagation()}),y(2,"h2",21),w(3," Delete session? "),m(),y(4,"p",22),w(5," This removes "),y(6,"strong"),w(7),m(),w(8,". "),m(),y(9,"div",23)(10,"button",24),R("click",function(){x(t);let i=c();return S(i.cancelDeleteSession())}),w(11," Cancel "),m(),y(12,"button",25),R("click",function(){x(t);let i=c();return S(i.confirmDeleteSession())}),w(13," Delete "),m()()()()}if(n&2){let t=c();u(7),ue(e.label),u(5),M("disabled",t.view().controlsDisabled)}}function jO(n,e){if(n&1){let t=z();y(0,"div",9)(1,"div",26)(2,"p",27),w(3),m(),y(4,"div",28)(5,"button",29),R("click",function(){x(t);let i=c();return S(i.dismissFailure())}),w(6," Dismiss "),m()()()()}n&2&&(u(3),H(" ",e.message," "))}var Sb="A run is in progress",el=class n{constructor(){this.bridge=f(ie);this.execution=f(we);this.composer=f(Ft);this.pendingDelete=U(null);this.dismissedFailure=U(null);this.actionFailure=oe(this.bridge.raw["workflowSession.action.failed"].pipe(I(e=>e),de(null)),{initialValue:null});this.view=oe(ee(this.bridge.cached["workflowSession.list.snapshot"].pipe(I(e=>({type:"list",list:e}))),this.bridge.cached["workflowSession.current.snapshot"].pipe(I(e=>({type:"current",current:e}))),et(this.composer.navigationLocked).pipe(I(e=>({type:"navigation",navigationLocked:e})))).pipe(ve(xb,wf),I(bf)),{initialValue:bf(wf)});this.visibleFailure=b(()=>{let e=this.actionFailure();return e===null||e===this.dismissedFailure()?null:e})}tip(e){return this.view().controlsDisabled?Sb:e}sessionTip(e){return this.view().controlsDisabled?Sb:e.corrupt?"This session file is corrupt":e.differs?"The workflow in this session differs from the current workflow.":"Open this session"}settleThen(e){Jd({running:this.execution.isRunning(),requestInterrupt:()=>{this.bridge.raw["runner.interrupt.requested"].next("cancel")},interrupted$:this.bridge.raw["runner.interrupted"],action:e})}selectSession(e){this.view().controlsDisabled||e.corrupt||(this.pendingDelete.set(null),this.settleThen(()=>{this.bridge.raw["workflowSession.select.requested"].next({sessionId:e.sessionId})}))}createSession(){this.view().controlsDisabled||(this.pendingDelete.set(null),this.settleThen(()=>{this.bridge.raw["workflowSession.create.requested"].next({})}))}requestDeleteSession(e,t){t.stopPropagation(),!this.view().controlsDisabled&&this.pendingDelete.set({sessionId:e.sessionId,label:e.label})}cancelDeleteSession(){this.pendingDelete.set(null)}confirmDeleteSession(){let e=this.pendingDelete();if(e===null||this.view().controlsDisabled){this.pendingDelete.set(null);return}this.settleThen(()=>{this.bridge.raw["workflowSession.delete.requested"].next({sessionId:e.sessionId})}),this.pendingDelete.set(null)}dismissFailure(){this.dismissedFailure.set(this.actionFailure())}handleEscape(){this.pendingDelete.set(null),this.dismissFailure()}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-workflow-session-tabs"]],hostAttrs:[1,"relative","flex","min-w-[14rem]","flex-1","flex-nowrap","items-center","gap-1","self-stretch"],hostBindings:function(t,o){t&1&&R("keydown.escape",function(){return o.handleEscape()},kt)},decls:11,vars:6,consts:[[1,"lf-scroll","flex","h-full","min-w-0","flex-1","flex-nowrap","items-stretch","gap-1","self-stretch","overflow-x-auto","overflow-y-hidden"],["role","tablist","aria-label","Workflow sessions",1,"flex","h-full","shrink-0","items-stretch","gap-1"],[1,"flex","h-full","shrink-0","items-center"],[1,"sticky","right-0","z-10","shrink-0","self-center","bg-white","pl-1","dark:bg-zinc-900"],["align","end","side","bottom",1,"top-1",3,"tip"],["type","button","aria-label","New session",1,"inline-flex","items-center","justify-center","rounded-md","border","border-zinc-200","p-1.5","text-zinc-600","transition","hover:bg-zinc-100","disabled:cursor-not-allowed","disabled:opacity-50","dark:border-zinc-700","dark:text-zinc-300","dark:hover:bg-zinc-800",3,"click","disabled"],["viewBox","0 0 20 20","fill","none","stroke","currentColor","stroke-width","1.5","aria-hidden","true",1,"h-4","w-4"],["d","M10 4v12M4 10h12"],[1,"fixed","inset-0","z-40","flex","items-center","justify-center","bg-zinc-950/40","px-4"],[1,"absolute","left-0","top-full","z-20","mt-2","w-[28rem]","max-w-[min(28rem,calc(100vw-2rem))]"],[1,"relative","grid","grid-rows-[1fr_auto_1fr]"],["aria-hidden","true",1,"pointer-events-none","z-0","col-start-1","row-span-2","row-start-2","mt-1","rounded-t-md","border","border-b-0","border-zinc-200","bg-zinc-100","dark:border-zinc-800","dark:bg-zinc-950"],[1,"z-10","col-start-1","row-start-2","inline-flex","items-center"],["align","center","side","bottom",3,"tip"],["type","button","role","tab",1,"inline-flex","items-center","whitespace-nowrap","bg-transparent","px-2","py-1","text-xs","font-medium","text-zinc-700","disabled:cursor-not-allowed","disabled:opacity-50","dark:text-zinc-200",3,"click","disabled"],["aria-hidden","true",1,"mr-1.5","h-1.5","w-1.5","shrink-0","translate-y-px","rounded-full","bg-rose-400/70"],["type","button",1,"mr-1","inline-flex","rounded","p-0.5","text-zinc-400","transition","hover:text-rose-600","disabled:cursor-not-allowed","disabled:opacity-50","dark:text-zinc-500","dark:hover:text-rose-400",3,"click","disabled"],["viewBox","0 0 20 20","fill","none","stroke","currentColor","stroke-width","1.5","aria-hidden","true",1,"h-3","w-3"],["d","M6 6l8 8M14 6l-8 8"],[1,"fixed","inset-0","z-40","flex","items-center","justify-center","bg-zinc-950/40","px-4",3,"click"],["role","alertdialog","aria-modal","true","aria-labelledby","delete-session-title","aria-describedby","delete-session-desc",1,"w-72","rounded-lg","border","border-zinc-200","bg-white","p-4","shadow-lg","dark:border-zinc-700","dark:bg-zinc-900",3,"click"],["id","delete-session-title",1,"text-sm","font-semibold","text-zinc-900","dark:text-zinc-100"],["id","delete-session-desc",1,"mt-2","text-xs","leading-5","text-zinc-500","dark:text-zinc-400"],[1,"mt-4","flex","justify-end","gap-2"],["type","button",1,"rounded-md","border","border-zinc-200","px-3","py-1","text-xs","font-medium","text-zinc-700","transition","hover:bg-zinc-100","dark:border-zinc-700","dark:text-zinc-200","dark:hover:bg-zinc-800",3,"click"],["type","button",1,"rounded-md","border","border-rose-300","bg-rose-50","px-3","py-1","text-xs","font-medium","text-rose-700","transition","hover:bg-rose-100","disabled:cursor-not-allowed","disabled:opacity-50","dark:border-rose-800","dark:bg-rose-950/40","dark:text-rose-300","dark:hover:bg-rose-950/60",3,"click","disabled"],["role","alert",1,"rounded-lg","border","border-rose-300","bg-white","p-3","shadow-lg","dark:border-rose-800","dark:bg-zinc-900"],[1,"text-xs","leading-5","text-rose-700","dark:text-rose-300"],[1,"mt-2","flex","justify-end"],["type","button",1,"rounded-md","border","border-rose-300","px-2","py-1","text-xs","font-medium","text-rose-700","transition","hover:bg-rose-50","dark:border-rose-700","dark:text-rose-300","dark:hover:bg-rose-950/40",3,"click"]],template:function(t,o){if(t&1&&(y(0,"div",0)(1,"div",1),X(2,UO,12,29,"div",2,$O),m(),y(4,"div",3)(5,"lf-hover-tip",4)(6,"button",5),R("click",function(){return o.createSession()}),ce(),y(7,"svg",6),F(8,"path",7),m()()()()(),P(9,VO,14,2,"div",8),P(10,jO,7,1,"div",9)),t&2){let i,r;u(2),Q(o.view().tabs),u(3),G("cursor-not-allowed",o.view().controlsDisabled),M("tip",o.tip("Create a session")),u(),M("disabled",o.view().controlsDisabled),u(3),E((i=o.pendingDelete())?9:-1,i),u(),E((r=o.visibleFailure())?10:-1,r)}},dependencies:[Ue],encapsulation:2})}};var tl={workflows:[],activeWorkflow:null,currentStatus:"pristine"};function Pb(n,e){return C(p({},n),{workflows:e})}function Eb(n,e){return C(p({},n),{activeWorkflow:e.activeWorkflow,currentStatus:e.currentStatus.status})}function Ib(n,e){return C(p({},n),{currentStatus:e})}var WO="Stop the run to change workflows",oo=(n,e)=>n?WO:e;var GO=["renameInput"],qO=(n,e)=>e.workflowId;function KO(n,e){if(n&1){let t=z();y(0,"div",18)(1,"lf-hover-tip",19)(2,"button",20),R("click",function(){x(t);let i=c(2);return S(i.startRename())}),w(3," Rename "),m()(),y(4,"lf-hover-tip",19)(5,"button",21),R("click",function(){x(t);let i=c(2);return S(i.requestDelete())}),w(6," Delete "),m()()()}if(n&2){let t=c(2);u(),G("cursor-not-allowed",!t.canRename()),M("tip",t.renameTip()),u(),M("disabled",!t.canRename()),u(2),G("cursor-not-allowed",!t.canDelete()),M("tip",t.deleteTip()),u(),M("disabled",!t.canDelete())}}function YO(n,e){if(n&1){let t=z();y(0,"div",6)(1,"lf-hover-tip",14)(2,"button",15),R("click",function(){x(t);let i=c();return S(i.toggleActions())}),ce(),y(3,"svg",16),F(4,"path",17),m()()(),P(5,KO,7,8,"div",18),m()}if(n&2){let t=c();u(2),K("aria-expanded",t.isActionsOpen()),u(3),E(t.isActionsOpen()?5:-1)}}function ZO(n,e){if(n&1){let t=z();y(0,"input",22,0),R("input",function(i){x(t);let r=c();return S(r.handleRenameInput(i))})("keydown.enter",function(){x(t);let i=c();return S(i.commitRename())})("keydown.escape",function(){x(t);let i=c();return S(i.cancelRename())})("blur",function(){x(t);let i=c();return S(i.commitRename())}),m()}if(n&2){let t=c();M("value",t.renameDraft())}}function XO(n,e){n&1&&F(0,"div",24)}function QO(n,e){n&1&&F(0,"span",27)}function JO(n,e){if(n&1){let t=z();y(0,"div",23),P(1,XO,1,0,"div",24),y(2,"lf-hover-tip",25)(3,"button",26),R("click",function(){x(t);let i=c();return S(i.onFileTabClick())})("dblclick",function(){x(t);let i=c();return S(i.startRename())}),P(4,QO,1,0,"span",27),y(5,"span",28),w(6),m()()()()}if(n&2){let t=c();G("h-full",!t.isSessionBound())("rounded-md",t.isSessionBound())("hover:bg-zinc-100",t.isSessionBound())("dark:hover:bg-zinc-800",t.isSessionBound()),u(),E(t.isSessionBound()?-1:1),u(),G("cursor-not-allowed",t.fileTabDisabled()),M("tip",t.fileTabTip()),u(),G("font-semibold",!t.isSessionBound()),M("disabled",t.fileTabDisabled()),K("aria-pressed",!t.isSessionBound()),u(),E(t.isDirty()?4:-1),u(2),H(" ",t.activeWorkflowName()??"No workflow loaded"," ")}}function eA(n,e){if(n&1){let t=z();y(0,"lf-hover-tip",10)(1,"button",29),R("click",function(){x(t);let i=c();return S(i.saveCurrent())}),w(2," Save "),m()()}}function tA(n,e){n&1&&F(0,"div",31)}function nA(n,e){if(n&1){let t=z();y(0,"div",34)(1,"lf-hover-tip",35)(2,"button",36),R("click",function(){let i=x(t).$implicit,r=c(2);return S(r.loadWorkflow(i.workflowId))}),y(3,"span",37),w(4),m(),y(5,"span",38),w(6),m()()(),y(7,"lf-hover-tip",39)(8,"button",40),R("click",function(i){let r=x(t).$implicit,s=c(2);return S(s.copyWorkflow(r.workflowId,i))}),w(9," Copy "),m()()()}if(n&2){let t=e.$implicit,o=c(2);G("bg-zinc-100",t.workflowId===o.activeWorkflowId())("dark:bg-zinc-800",t.workflowId===o.activeWorkflowId()),K("aria-selected",t.workflowId===o.activeWorkflowId()),u(),G("cursor-not-allowed",o.navigationLocked()),M("tip",o.loadTip()),u(),M("disabled",o.navigationLocked()),u(2),H(" ",t.name," "),u(2),H(" ",t.workflowId," "),u(),G("cursor-not-allowed",o.navigationLocked()),M("tip",o.copyTip()),u(),M("disabled",o.navigationLocked())}}function oA(n,e){n&1&&(y(0,"p",33),w(1," No workflows available "),m())}function iA(n,e){if(n&1){let t=z();y(0,"div",11)(1,"lf-hover-tip",19)(2,"button",30),R("click",function(){x(t);let i=c();return S(i.createWorkflow())}),w(3," New "),m()(),P(4,tA,1,0,"div",31),X(5,nA,10,15,"div",32,qO,!1,oA,2,0,"p",33),m()}if(n&2){let t=c();u(),G("cursor-not-allowed",t.navigationLocked()),M("tip",t.createTip()),u(),M("disabled",t.navigationLocked()),u(2),E(t.workflows().length>0?4:-1),u(),Q(t.workflows())}}function rA(n,e){if(n&1){let t=z();y(0,"div",12)(1,"h2",41),w(2," Delete workflow? "),m(),y(3,"p",42),w(4," This removes "),y(5,"strong"),w(6),m(),w(7," from disk. "),m(),y(8,"div",43)(9,"button",44),R("click",function(){x(t);let i=c();return S(i.cancelDelete())}),w(10," Cancel "),m(),y(11,"button",45),R("click",function(){x(t);let i=c();return S(i.confirmDelete())}),w(12," Delete "),m()()()}if(n&2){let t=c();u(6),ue(t.activeWorkflowName())}}function sA(n,e){if(n&1){let t=z();y(0,"div",13)(1,"p",46),w(2),m(),y(3,"div",47)(4,"button",48),R("click",function(){x(t);let i=c();return S(i.dismissRepairNotice())}),w(5," Dismiss "),m()()()}n&2&&(u(2),H(" ",e," "))}var nl=class n{constructor(){this.bridge=f(ie);this.execution=f(we);this.composer=f(Ft);this.navigationLocked=this.composer.navigationLocked;this.destroyRef=f(je);this.renameInput=Xe("renameInput");this.isDropdownOpen=U(!1);this.isActionsOpen=U(!1);this.isRenaming=U(!1);this.renameDraft=U("");this.showDeleteConfirm=U(!1);this.repairNotice=U(null);this.topbarState=oe(ee(this.bridge.cached["workflow.list.snapshot"].pipe(I(e=>({kind:"list",workflows:e.workflows}))),this.bridge.cached["workflow.current.snapshot"].pipe(I(e=>({kind:"current",snapshot:e}))),this.bridge.cached["workflow.currentStatus.snapshot"].pipe(I(e=>({kind:"status",status:e.status})))).pipe(ve((e,t)=>{switch(t.kind){case"list":return Pb(e,t.workflows);case"current":return Eb(e,t.snapshot);case"status":return Ib(e,t.status);default:return e}},tl),de(tl)),{initialValue:tl});this.workflows=b(()=>this.topbarState().workflows);this.activeWorkflowName=b(()=>this.topbarState().activeWorkflow?.metadata.name??null);this.activeWorkflowId=b(()=>this.topbarState().activeWorkflow?.workflowId??null);this.isDirty=b(()=>this.topbarState().currentStatus==="dirty");this.isSessionBound=oe(this.bridge.cached["workflowSession.current.snapshot"].pipe(I(e=>e.sessionId!==null),de(!1)),{initialValue:!1});this.canSave=b(()=>!this.isSessionBound()&&this.topbarState().activeWorkflow!==null&&this.topbarState().currentStatus==="dirty");this.canRename=b(()=>this.activeWorkflowName()!==null&&!this.navigationLocked()&&!this.isSessionBound());this.canDelete=b(()=>this.topbarState().activeWorkflow!==null&&!this.navigationLocked()&&!this.isSessionBound());this.renameTip=b(()=>this.isSessionBound()?"Return to the workflow first":oo(this.navigationLocked(),this.activeWorkflowName()===null?"Load or create a workflow first":"Rename workflow"));this.deleteTip=b(()=>this.isSessionBound()?"Return to the workflow first":oo(this.navigationLocked(),this.topbarState().activeWorkflow===null?"No workflow loaded":"Delete this workflow from disk"));this.copyTip=b(()=>oo(this.navigationLocked(),"Copy this workflow"));this.createTip=b(()=>oo(this.navigationLocked(),"Create a new workflow"));this.loadTip=b(()=>oo(this.navigationLocked(),"Load this workflow"));this.fileTabDisabled=b(()=>this.navigationLocked()||this.activeWorkflowName()===null);this.fileTabTip=b(()=>this.isSessionBound()?oo(this.navigationLocked(),"Show the saved workflow"):this.activeWorkflowName()===null?"Load or create a workflow first":oo(this.navigationLocked(),"Double-click to rename"));this.bridge.raw["workflow.load.repaired"].pipe(ht(this.destroyRef)).subscribe(e=>{this.repairNotice.set(e.message),this.showDeleteConfirm.set(!1),this.isDropdownOpen.set(!1)})}toggleDropdown(){this.isDropdownOpen.update(e=>!e),this.isActionsOpen.set(!1),this.showDeleteConfirm.set(!1)}toggleActions(){this.isActionsOpen.update(e=>!e),this.isDropdownOpen.set(!1),this.showDeleteConfirm.set(!1)}onFileTabClick(){this.isSessionBound()&&this.selectWorkflow()}selectWorkflow(){this.navigationLocked()||(this.isDropdownOpen.set(!1),this.isActionsOpen.set(!1),this.showDeleteConfirm.set(!1),this.settleThen(()=>{this.bridge.raw["workflowSession.select.requested"].next({sessionId:null})}))}settleThen(e){Jd({running:this.execution.isRunning(),requestInterrupt:()=>{this.bridge.raw["runner.interrupt.requested"].next("cancel")},interrupted$:this.bridge.raw["runner.interrupted"],action:e})}loadWorkflow(e){this.navigationLocked()||(this.isDropdownOpen.set(!1),this.settleThen(()=>{this.bridge.raw["workflow.load.requested"].next({workflowId:e})}))}createWorkflow(){this.navigationLocked()||(this.isDropdownOpen.set(!1),this.showDeleteConfirm.set(!1),this.settleThen(()=>{this.bridge.raw["workflow.create.requested"].next({})}))}copyWorkflow(e,t){t.stopPropagation(),!this.navigationLocked()&&(this.isDropdownOpen.set(!1),this.showDeleteConfirm.set(!1),this.settleThen(()=>{this.bridge.raw["workflow.copy.requested"].next({workflowId:e})}))}saveCurrent(){this.canSave()&&(this.bridge.raw["workflow.saveCurrent.requested"].next({}),this.showDeleteConfirm.set(!1))}handleRenameInput(e){let t=e.target;t instanceof HTMLInputElement&&this.renameDraft.set(t.value)}startRename(){if(!this.canRename())return;let e=this.activeWorkflowName();e!==null&&(this.renameDraft.set(e),this.isRenaming.set(!0),this.isDropdownOpen.set(!1),this.isActionsOpen.set(!1),this.showDeleteConfirm.set(!1),queueMicrotask(()=>{let t=this.renameInput()?.nativeElement;t!==void 0&&(t.focus(),t.select())}))}commitRename(){if(!this.isRenaming())return;let e=this.renameDraft().trim(),t=this.activeWorkflowName();this.isRenaming.set(!1),!this.navigationLocked()&&(e.length===0||t===null||e===t||this.settleThen(()=>{this.bridge.raw["workflow.renameCurrent.requested"].next({name:e})}))}cancelRename(){this.isRenaming.set(!1)}requestDelete(){this.canDelete()&&(this.showDeleteConfirm.set(!0),this.isDropdownOpen.set(!1),this.isActionsOpen.set(!1))}cancelDelete(){this.showDeleteConfirm.set(!1)}dismissRepairNotice(){this.repairNotice.set(null)}confirmDelete(){if(this.navigationLocked()||this.isSessionBound()){this.showDeleteConfirm.set(!1);return}let e=this.activeWorkflowId();e!==null&&(this.showDeleteConfirm.set(!1),this.settleThen(()=>{this.bridge.raw["workflow.delete.requested"].next({workflowId:e})}))}handleEscape(){this.isDropdownOpen.set(!1),this.isActionsOpen.set(!1),this.showDeleteConfirm.set(!1),this.repairNotice.set(null),this.cancelRename()}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-workflow-topbar"]],viewQuery:function(t,o){t&1&&rt(o.renameInput,GO,5),t&2&&st()},hostBindings:function(t,o){t&1&&R("keydown.escape",function(){return o.handleEscape()},kt)},decls:14,vars:7,consts:[["renameInput",""],[1,"relative","flex","h-full","w-full","min-w-0","flex-nowrap","items-center","gap-2"],["tip","Show workflows","align","center","side","bottom",1,"shrink-0"],["type","button","aria-label","Show workflows",1,"inline-flex","items-center","justify-center","rounded-md","border","border-zinc-200","p-1","text-zinc-600","transition","hover:bg-zinc-100","dark:border-zinc-700","dark:text-zinc-300","dark:hover:bg-zinc-800",3,"click"],["viewBox","0 0 20 20","fill","currentColor","aria-hidden","true",1,"h-4","w-4","translate-y-px"],["d","M5.23 7.21a.75.75 0 0 1 1.06.02L10 10.94l3.71-3.71a.75.75 0 1 1 1.06 1.06l-4.24 4.24a.75.75 0 0 1-1.06 0L5.21 8.29a.75.75 0 0 1 .02-1.08Z"],[1,"relative","shrink-0"],[1,"flex","h-full","min-w-0","shrink-0","items-center","self-stretch"],["type","text","aria-label","Rename workflow",1,"w-48","min-w-0","rounded-md","border","border-zinc-400","bg-white","px-2","py-1","text-sm","text-zinc-950","outline-none","ring-2","ring-zinc-400/20","dark:border-zinc-500","dark:bg-zinc-950","dark:text-zinc-100",3,"value"],[1,"relative","grid","min-w-0","grid-rows-[1fr_auto_1fr]",3,"h-full","rounded-md","hover:bg-zinc-100","dark:hover:bg-zinc-800"],["tip","Save the active workflow","align","center","side","bottom",1,"shrink-0"],["role","listbox","aria-label","Workflows",1,"lf-scroll","absolute","left-0","top-full","z-20","mt-2","max-h-72","w-80","overflow-auto","rounded-lg","border","border-zinc-200","bg-white","py-1","shadow-lg","dark:border-zinc-700","dark:bg-zinc-900"],["role","alertdialog","aria-labelledby","delete-workflow-title","aria-describedby","delete-workflow-desc",1,"absolute","right-0","top-full","z-20","mt-2","w-72","rounded-lg","border","border-zinc-200","bg-white","p-4","shadow-lg","dark:border-zinc-700","dark:bg-zinc-900"],["role","status","aria-live","polite",1,"absolute","left-0","top-full","z-20","mt-2","w-96","max-w-[min(24rem,calc(100vw-2rem))]","rounded-lg","border","border-amber-300","bg-amber-50","p-3","shadow-lg","dark:border-amber-800","dark:bg-amber-950/40"],["tip","Workflow actions","align","center","side","bottom"],["type","button","aria-label","Workflow actions",1,"inline-flex","items-center","justify-center","rounded-md","border","border-zinc-200","p-1.5","text-zinc-600","transition","hover:bg-zinc-100","dark:border-zinc-700","dark:text-zinc-300","dark:hover:bg-zinc-800",3,"click"],["viewBox","0 0 20 20","fill","currentColor","aria-hidden","true",1,"h-4","w-4"],["d","M6 10a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm5.5 0a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm5.5 0a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Z"],["role","menu","aria-label","Workflow actions",1,"absolute","left-0","top-full","z-20","mt-2","w-44","rounded-lg","border","border-zinc-200","bg-white","py-1","shadow-lg","dark:border-zinc-700","dark:bg-zinc-900"],["align","start","side","bottom",1,"w-full",3,"tip"],["type","button","role","menuitem",1,"flex","w-full","items-center","px-3","py-2","text-left","text-sm","text-zinc-900","transition","hover:bg-zinc-100","disabled:cursor-not-allowed","disabled:opacity-50","dark:text-zinc-100","dark:hover:bg-zinc-800",3,"click","disabled"],["type","button","role","menuitem",1,"flex","w-full","items-center","px-3","py-2","text-left","text-sm","text-rose-700","transition","hover:bg-rose-50","disabled:cursor-not-allowed","disabled:opacity-50","dark:text-rose-300","dark:hover:bg-rose-950/30",3,"click","disabled"],["type","text","aria-label","Rename workflow",1,"w-48","min-w-0","rounded-md","border","border-zinc-400","bg-white","px-2","py-1","text-sm","text-zinc-950","outline-none","ring-2","ring-zinc-400/20","dark:border-zinc-500","dark:bg-zinc-950","dark:text-zinc-100",3,"input","keydown.enter","keydown.escape","blur","value"],[1,"relative","grid","min-w-0","grid-rows-[1fr_auto_1fr]"],["aria-hidden","true",1,"pointer-events-none","col-start-1","row-span-2","row-start-2","-mb-px","rounded-t-md","border","border-b-0","border-zinc-200","bg-zinc-100","dark:border-zinc-800","dark:bg-zinc-950"],["align","center","side","bottom",1,"z-10","col-start-1","row-start-2","min-w-0",3,"tip"],["type","button",1,"inline-flex","min-w-0","max-w-48","items-center","gap-1.5","bg-transparent","px-2","py-1","text-sm","font-medium","text-zinc-900","disabled:cursor-not-allowed","disabled:opacity-50","dark:text-zinc-100",3,"click","dblclick","disabled"],["aria-hidden","true",1,"h-1.5","w-1.5","shrink-0","rounded-full","bg-amber-400"],[1,"truncate"],["type","button","aria-label","Save workflow",1,"rounded-md","border","border-zinc-400","bg-zinc-50","px-3","py-1","text-xs","font-medium","text-zinc-700","transition","dark:border-zinc-500","dark:bg-zinc-950/40","dark:text-zinc-300",3,"click"],["type","button","role","option",1,"flex","w-full","items-center","px-3","py-2","text-left","text-sm","font-medium","text-zinc-900","transition","hover:bg-zinc-100","disabled:cursor-not-allowed","disabled:opacity-50","dark:text-zinc-100","dark:hover:bg-zinc-800",3,"click","disabled"],["role","separator",1,"my-1","border-t","border-zinc-200","dark:border-zinc-700"],["role","option",1,"flex","items-stretch","gap-1","px-1","py-0.5",3,"bg-zinc-100","dark:bg-zinc-800"],[1,"px-3","py-2","text-xs","text-zinc-500","dark:text-zinc-400"],["role","option",1,"flex","items-stretch","gap-1","px-1","py-0.5"],["align","start","side","bottom",1,"min-w-0","flex-1",3,"tip"],["type","button",1,"flex","min-w-0","w-full","flex-col","items-start","rounded-md","px-2","py-2","text-left","text-sm","transition","hover:bg-zinc-100","disabled:cursor-not-allowed","disabled:opacity-50","dark:hover:bg-zinc-800",3,"click","disabled"],[1,"truncate","font-medium","text-zinc-900","dark:text-zinc-100"],[1,"truncate","text-xs","text-zinc-500","dark:text-zinc-400"],["align","center","side","bottom",3,"tip"],["type","button","aria-label","Copy workflow",1,"shrink-0","self-center","rounded-md","border","border-zinc-200","px-2","py-1","text-xs","font-medium","text-zinc-700","transition","hover:bg-zinc-50","disabled:cursor-not-allowed","disabled:opacity-50","dark:border-zinc-600","dark:text-zinc-200","dark:hover:bg-zinc-700",3,"click","disabled"],["id","delete-workflow-title",1,"text-sm","font-semibold","text-zinc-900","dark:text-zinc-100"],["id","delete-workflow-desc",1,"mt-2","text-xs","leading-5","text-zinc-500","dark:text-zinc-400"],[1,"mt-4","flex","justify-end","gap-2"],["type","button",1,"rounded-md","border","border-zinc-200","px-3","py-1","text-xs","font-medium","text-zinc-700","transition","hover:bg-zinc-100","dark:border-zinc-700","dark:text-zinc-200","dark:hover:bg-zinc-800",3,"click"],["type","button",1,"rounded-md","border","border-rose-300","bg-rose-50","px-3","py-1","text-xs","font-medium","text-rose-700","transition","hover:bg-rose-100","dark:border-rose-800","dark:bg-rose-950/40","dark:text-rose-300","dark:hover:bg-rose-950/60",3,"click"],[1,"text-xs","leading-5","text-amber-950","dark:text-amber-100"],[1,"mt-2","flex","justify-end"],["type","button",1,"rounded-md","border","border-amber-300","px-2","py-1","text-xs","font-medium","text-amber-900","transition","hover:bg-amber-100","dark:border-amber-700","dark:text-amber-100","dark:hover:bg-amber-900/50",3,"click"]],template:function(t,o){if(t&1&&(y(0,"div",1)(1,"lf-hover-tip",2)(2,"button",3),R("click",function(){return o.toggleDropdown()}),ce(),y(3,"svg",4),F(4,"path",5),m()()(),P(5,YO,6,2,"div",6),dg(),y(6,"div",7),P(7,ZO,2,1,"input",8)(8,JO,7,18,"div",9),m(),F(9,"lf-workflow-session-tabs"),P(10,eA,3,0,"lf-hover-tip",10),P(11,iA,8,6,"div",11),P(12,rA,13,1,"div",12),P(13,sA,6,1,"div",13),m()),t&2){let i;u(2),K("aria-expanded",o.isDropdownOpen()),u(3),E(o.isSessionBound()?-1:5),u(2),E(o.isRenaming()?7:8),u(3),E(o.canSave()?10:-1),u(),E(o.isDropdownOpen()?11:-1),u(),E(o.showDeleteConfirm()?12:-1),u(),E((i=o.repairNotice())?13:-1,i)}},dependencies:[Ue,el],encapsulation:2})}};var ol=120,il=120,es=120,Fi=1e4;var aA=4,Cf=aA*2,_f=64,kb=4,Db=80,io=(n,e,t)=>Math.min(Math.max(n,e),t),rl=(n,e,t,o)=>{if(n==="left"){let r=Math.max(ol,o.rowWidth-t.rightWidth-Cf-_f);return io(e,ol,r)}if(n==="right"){let r=Math.max(il,o.rowWidth-t.leftWidth-Cf-_f);return io(e,il,r)}let i=Math.max(es,o.rightAsideHeight-Db-kb);return io(e,es,i)},xf=(n,e)=>{let t=Math.max(0,e.rowWidth-Cf-_f),o=io(n.leftWidth,ol,Fi),i=io(n.rightWidth,il,Fi);if(o+i>t&&(i=io(t-o,0,Fi),o+i>t&&(o=io(t-i,0,Fi)),o+i>t&&o+i>0)){let a=t/(o+i);o=Math.floor(o*a),i=Math.max(0,t-o)}let r=Math.max(es,e.rightAsideHeight-Db-kb),s=io(n.composerHeight,es,Math.min(r,Fi));return{leftWidth:o,rightWidth:i,composerHeight:s}},Tb=(n,e)=>n.leftWidth===e.leftWidth&&n.rightWidth===e.rightWidth&&n.composerHeight===e.composerHeight;var Mb=n=>{let e=n.WebSocketImpl??globalThis.WebSocket,t=!1,o=!1,i=null,r,s=()=>{if(i===null)return;let l=i;i=null,l.onopen=null,l.onerror=null,l.onclose=null;try{l.close()}catch(h){}},a=()=>{t||o||(o=!0,t=!0,r!==void 0&&(clearInterval(r),r=void 0),s(),n.onReachable())},d=()=>{if(t||o||i!==null)return;let l;try{l=new e(n.url)}catch(h){return}i=l,l.onopen=()=>{a()},l.onerror=()=>{s()},l.onclose=()=>{i===l&&s()}};return d(),r=setInterval(d,n.intervalMs),{stop:()=>{t||(t=!0,r!==void 0&&(clearInterval(r),r=void 0),s())}}};var lA=["editorRow"],cA=["leftAside"],uA=["rightAside"],pA=["composerHost"];function hA(n,e){n&1&&(y(0,"div",5)(1,"div",24)(2,"h2",25),F(3,"span",26),w(4," Disconnected "),m(),y(5,"p",27),w(6," The server is unreachable. The editor is blocked while we retry the connection. The page will reload when the server returns. "),m()()())}function fA(n,e){if(n&1&&(y(0,"span"),w(1),m()),n&2){let t=c();u(),ue(t.connectionStatus())}}function gA(n,e){n&1&&(ce(),y(0,"svg",18),F(1,"circle",28)(2,"path",29),m())}function mA(n,e){n&1&&(ce(),y(0,"svg",19),F(1,"path",30),m())}function yA(n,e){if(n&1){let t=z();y(0,"aside",40,3)(2,"section",41),F(3,"lf-palette-sidebar"),m()(),y(4,"button",42),R("pointerdown",function(i){x(t);let r=c(2);return S(r.startResize(i,"left"))}),m()}if(n&2){let t=c(),o=c();Ze("width",o.leftWidth()??t.dividerPositions.leftWidth,"px")}}function vA(n,e){if(n&1){let t=z();y(0,"div",33)(1,"lf-hover-tip",43)(2,"button",44),R("click",function(){x(t);let i=c(2);return S(i.showPalette())}),w(3," >> "),m()()()}}function wA(n,e){n&1&&(y(0,"section",36),F(1,"lf-settings-panel"),m())}function bA(n,e){n&1&&(y(0,"section",36),F(1,"lf-inspector-panel"),m())}function CA(n,e){n&1&&(y(0,"section",37),F(1,"lf-work-log-panel"),m())}function _A(n,e){if(n&1){let t=z();Hn(0),on(1,"async"),y(2,"div",23,0),P(4,yA,5,2),y(5,"main",31)(6,"section",32),F(7,"lf-canvas-container"),m(),P(8,vA,4,0,"div",33),m(),y(9,"button",34),R("pointerdown",function(i){x(t);let r=c();return S(r.startResize(i,"right"))}),m(),y(10,"aside",35,1),P(12,wA,2,0,"section",36)(13,bA,2,0,"section",36)(14,CA,2,0,"section",37),y(15,"button",38),R("pointerdown",function(i){x(t);let r=c();return S(r.startResize(i,"composer"))}),m(),F(16,"lf-composer-shell",39,2),m()()}if(n&2){let t=e,o=c(),i=rn(1,6,o.paletteVisible$);u(4),E(i===!0?4:-1),u(4),E(i===!1?8:-1),u(2),Ze("width",o.rightWidth()??t.dividerPositions.rightWidth,"px"),u(2),E(o.settingsOpen()?12:o.hasSelectedNode()?13:14),u(4),M("height",o.composerHeight()??t.dividerPositions.composerHeight)}}var sl=class n{constructor(){this.bridge=f(ie);this.themeService=f(si);this.destroyRef=f(je);this.activeResize=U(null);this.editorRow=Xe("editorRow");this.leftAside=Xe("leftAside");this.rightAside=Xe("rightAside");this.composerHost=Xe("composerHost",{read:He});this.layoutObserver=null;this.persistTimer=null;this.serverPoke=null;this.lastSessionLeftWidth=280;this.sessionSnapshot=oe(this.bridge.cached["session.state.snapshot"]);this.connectionStatus=oe(this.bridge.raw.status$,{initialValue:"connecting"});this.theme=oe(this.themeService.theme$,{initialValue:this.themeService.snapshot});this.themeTip=b(()=>this.theme()==="dark"?"Switch to light theme":"Switch to dark theme");this.leftWidth=U(null);this.rightWidth=U(null);this.composerHeight=U(null);this.selection=f(Yn);this.editorSettings=f(ri);this.paletteChrome=f(Ni);this.hasSelectedNode=this.selection.hasSelectedNode;this.settingsOpen=this.editorSettings.open;this.paletteVisible$=this.paletteChrome.paletteVisible$;xe(()=>{let e=this.sessionSnapshot();e!==void 0&&ye(()=>{this.lastSessionLeftWidth=e.dividerPositions.leftWidth,this.activeResize()===null&&(this.leftWidth.set(null),this.rightWidth.set(null),this.composerHeight.set(null))})}),f(qn),f(Kn),this.bridge.cached["editor.dividers.snapshot"].pipe(ht(this.destroyRef)).subscribe(e=>{this.applyDividerPositions(e)}),xe(()=>{let e=this.editorRow(),t=this.rightAside();e===void 0||t===void 0||ye(()=>{this.attachLayoutObserver(),this.reclampToViewport(!1)})}),xe(()=>{let e=this.connectionStatus()==="disconnected";ye(()=>{if(e){this.startServerPoke();return}this.stopServerPoke()})}),this.destroyRef.onDestroy(()=>{this.stopServerPoke(),this.layoutObserver?.disconnect(),this.layoutObserver=null,this.persistTimer!==null&&(clearTimeout(this.persistTimer),this.persistTimer=null)})}reloadPage(){window.location.reload()}startServerPoke(){if(this.serverPoke!==null)return;let t=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;this.serverPoke=Mb({url:t,intervalMs:2e3,onReachable:()=>{this.reloadPage()}})}stopServerPoke(){this.serverPoke?.stop(),this.serverPoke=null}toggleSettings(){if(this.settingsOpen()){this.editorSettings.requestClose();return}this.editorSettings.requestOpen("project")}showPalette(){this.paletteChrome.requestShow()}toggleTheme(){this.themeService.toggleTheme()}startResize(e,t){e.preventDefault();let o=this.currentSize(t);o!==null&&this.activeResize.set({target:t,startX:e.clientX,startY:e.clientY,startSize:o})}handlePointerMove(e){let t=this.activeResize();if(t===null)return;let o=this.readLayout(),i=this.currentDividerPositions();if(!(o===null||i===null)){if(t.target==="left"){this.leftWidth.set(rl("left",t.startSize+e.clientX-t.startX,i,o));return}if(t.target==="right"){this.rightWidth.set(rl("right",t.startSize-e.clientX+t.startX,i,o));return}this.composerHeight.set(rl("composer",t.startSize-e.clientY+t.startY,i,o))}}handlePointerUp(){let e=this.activeResize();this.activeResize.set(null),e!==null&&this.persistDividers()}currentSize(e){if(e==="left"){let i=this.leftWidth();if(i!==null)return i;let r=this.leftAside()?.nativeElement;return r!==void 0?r.clientWidth:this.lastSessionLeftWidth}if(e==="right"){let i=this.rightWidth();return i!==null?i:this.rightAside()?.nativeElement.clientWidth??null}let t=this.composerHeight();return t!==null?t:this.composerHost()?.nativeElement?.clientHeight??null}currentDividerPositions(){let e=this.currentSize("left"),t=this.currentSize("right"),o=this.currentSize("composer");return e===null||t===null||o===null?null:{leftWidth:e,rightWidth:t,composerHeight:o}}readLayout(){let e=this.editorRow()?.nativeElement,t=this.rightAside()?.nativeElement;return e===void 0||t===void 0?null:{rowWidth:e.clientWidth,rightAsideHeight:t.clientHeight}}applyDividerPositions(e){if(this.activeResize()!==null)return;let t=this.readLayout();if(t===null){this.leftWidth.set(e.leftWidth),this.rightWidth.set(e.rightWidth),this.composerHeight.set(e.composerHeight);return}let o=xf(e,t);this.leftWidth.set(o.leftWidth),this.rightWidth.set(o.rightWidth),this.composerHeight.set(o.composerHeight)}reclampToViewport(e){if(this.activeResize()!==null)return;let t=this.readLayout(),o=this.currentDividerPositions();if(t===null||o===null||t.rowWidth<=0||t.rightAsideHeight<=0)return;let i=xf(o,t);Tb(o,i)||(this.leftWidth.set(i.leftWidth),this.rightWidth.set(i.rightWidth),this.composerHeight.set(i.composerHeight),e&&this.schedulePersistDividers())}attachLayoutObserver(){let e=this.editorRow()?.nativeElement,t=this.rightAside()?.nativeElement;e===void 0||t===void 0||(this.layoutObserver?.disconnect(),this.layoutObserver=new ResizeObserver(()=>{this.reclampToViewport(!0)}),this.layoutObserver.observe(e),this.layoutObserver.observe(t))}schedulePersistDividers(){this.persistTimer!==null&&clearTimeout(this.persistTimer),this.persistTimer=setTimeout(()=>{this.persistTimer=null,this.persistDividers()},100)}persistDividers(){let e=this.readLayout();if(e===null||e.rowWidth<=0||e.rightAsideHeight<=0)return;let t=this.currentDividerPositions();t!==null&&this.bridge.raw["editor.dividers.requested"].next(t)}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-editor-shell"]],viewQuery:function(t,o){t&1&&rt(o.editorRow,lA,5)(o.leftAside,cA,5)(o.rightAside,uA,5)(o.composerHost,pA,5,He),t&2&&st(4)},hostBindings:function(t,o){t&1&&R("pointermove",function(r){return o.handlePointerMove(r)},kt)("pointerup",function(){return o.handlePointerUp()},kt)},decls:23,vars:19,consts:[["editorRow",""],["rightAside",""],["composerHost",""],["leftAside",""],[1,"relative","flex","h-screen","flex-col","overflow-hidden","bg-zinc-50","text-zinc-950","dark:bg-zinc-950","dark:text-zinc-100"],["role","alertdialog","aria-modal","true","aria-labelledby","lf-disconnect-title","aria-describedby","lf-disconnect-body",1,"absolute","inset-0","z-50","flex","items-center","justify-center","bg-zinc-50/90","px-6","dark:bg-zinc-950/90"],[1,"flex","h-12","shrink-0","items-center","justify-between","bg-white","px-4","shadow-[inset_0_-1px_0_0_#e4e4e7]","dark:bg-zinc-900","dark:shadow-[inset_0_-1px_0_0_#27272a]"],[1,"flex","min-w-0","flex-1","items-center","gap-4","self-stretch"],["side","bottom","align","start","tip","Langflower"],["src","assets/langflower-mark.svg","alt","Langflower",1,"h-6","w-6"],[1,"shrink-0"],[1,"min-w-0","flex-1","self-stretch"],[1,"flex","items-center","gap-2","self-stretch","text-xs"],["side","bottom","align","end",3,"tip"],["role","status",1,"inline-flex","items-center","justify-center","gap-2","border","border-transparent","p-1.5","text-zinc-600","dark:text-zinc-300"],["aria-hidden","true",1,"inline-flex","h-4","w-4","items-center","justify-center"],[1,"h-2","w-2","rounded-full"],["type","button",1,"inline-flex","items-center","justify-center","rounded-md","border","border-zinc-200","p-1.5","text-zinc-600","transition","hover:bg-zinc-100","dark:border-zinc-700","dark:text-zinc-300","dark:hover:bg-zinc-800",3,"click"],["viewBox","0 0 20 20","fill","none","stroke","currentColor","stroke-width","1.5","aria-hidden","true",1,"h-4","w-4"],["viewBox","0 0 20 20","fill","currentColor","aria-hidden","true",1,"h-4","w-4"],["side","bottom","tip","Settings"],["type","button","aria-label","Settings",1,"inline-flex","items-center","justify-center","rounded-md","border","border-zinc-200","p-1.5","text-zinc-600","transition","hover:bg-zinc-100","dark:border-zinc-700","dark:text-zinc-300","dark:hover:bg-zinc-800",3,"click"],["fill-rule","evenodd","d","M7.84 1.804A1 1 0 0 1 8.82 1h2.36a1 1 0 0 1 .98.804l.331 1.652a6.993 6.993 0 0 1 1.929 1.115l1.598-.54a1 1 0 0 1 1.186.447l1.18 2.044a1 1 0 0 1-.34 1.353l-1.267.903a7.068 7.068 0 0 1 0 2.218l1.267.903a1 1 0 0 1 .34 1.353l-1.18 2.044a1 1 0 0 1-1.186.447l-1.598-.54a6.993 6.993 0 0 1-1.929 1.115l-.33 1.652a1 1 0 0 1-.98.804H8.82a1 1 0 0 1-.98-.804l-.331-1.652a6.993 6.993 0 0 1-1.929-1.115l-1.598.54a1 1 0 0 1-1.186-.447l-1.18-2.044a1 1 0 0 1 .34-1.353l1.267-.903a7.068 7.068 0 0 1 0-2.218l-1.267-.903a1 1 0 0 1-.34-1.353l1.18-2.044a1 1 0 0 1 1.186-.447l1.598.54a6.993 6.993 0 0 1 1.929-1.115l.33-1.652ZM10 13a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z","clip-rule","evenodd"],[1,"flex","min-h-0","flex-1"],[1,"w-full","max-w-md","rounded-lg","border","border-zinc-200","bg-white","p-6","text-center","shadow-lg","dark:border-zinc-700","dark:bg-zinc-900"],["id","lf-disconnect-title",1,"inline-flex","items-center","justify-center","gap-2","text-lg","font-semibold","tracking-tight","text-zinc-950","dark:text-zinc-100"],["aria-hidden","true",1,"h-2.5","w-2.5","shrink-0","rounded-full","bg-rose-400"],["id","lf-disconnect-body",1,"mt-2","text-sm","text-zinc-600","dark:text-zinc-400"],["cx","10","cy","10","r","3.25"],["stroke-linecap","round","d","M10 2.75v1.5M10 15.75v1.5M2.75 10h1.5M15.75 10h1.5M4.7 4.7l1.05 1.05M14.25 14.25l1.05 1.05M4.7 15.3l1.05-1.05M14.25 5.75l1.05-1.05"],["d","M14.2 11.4A4.8 4.8 0 0 1 8.6 5.8 5.6 5.6 0 1 0 14.2 11.4Z"],[1,"relative","min-w-0","flex-1","overflow-hidden","bg-zinc-100","dark:bg-zinc-950"],[1,"relative","z-0","h-full","min-h-0"],[1,"pointer-events-auto","absolute","left-2","top-2","z-20"],["type","button","aria-label","Resize right sidebar",1,"w-1","cursor-col-resize","bg-zinc-200","transition","hover:bg-zinc-400","dark:bg-zinc-800","dark:hover:bg-zinc-500",3,"pointerdown"],[1,"flex","min-w-[120px]","shrink-0","flex-col","border-l","border-zinc-200","bg-white","dark:border-zinc-800","dark:bg-zinc-900"],[1,"lf-scroll","min-h-0","flex-1","overflow-y-auto","p-4"],[1,"min-h-0","flex-1","overflow-hidden","px-2"],["type","button","aria-label","Resize composer panel",1,"h-1","cursor-row-resize","bg-zinc-200","transition","hover:bg-zinc-400","dark:bg-zinc-800","dark:hover:bg-zinc-500",3,"pointerdown"],[3,"height"],[1,"flex","min-h-0","min-w-[120px]","shrink-0","flex-col","overflow-hidden","border-r","border-zinc-200","bg-white","dark:border-zinc-800","dark:bg-zinc-900"],[1,"flex","h-full","min-h-0","flex-col","p-4"],["type","button","aria-label","Resize left sidebar",1,"w-1","cursor-col-resize","bg-zinc-200","transition","hover:bg-zinc-400","dark:bg-zinc-800","dark:hover:bg-zinc-500",3,"pointerdown"],["tip","Show palette","side","right","align","start"],["type","button","aria-label","Show palette",1,"rounded-md","border","border-zinc-200","bg-white","p-1.5","font-medium","text-zinc-700","shadow-sm","transition","hover:bg-zinc-100","dark:border-zinc-700","dark:bg-zinc-900","dark:text-zinc-200","dark:hover:bg-zinc-800",3,"click"]],template:function(t,o){if(t&1&&(y(0,"div",4),P(1,hA,7,0,"div",5),y(2,"header",6)(3,"div",7)(4,"lf-hover-tip",8),F(5,"img",9),m(),F(6,"lf-project-dir",10)(7,"lf-workflow-topbar",11),m(),y(8,"div",12)(9,"lf-hover-tip",13)(10,"div",14)(11,"span",15),F(12,"span",16),m(),P(13,fA,2,1,"span"),m()(),y(14,"lf-hover-tip",13)(15,"button",17),R("click",function(){return o.toggleTheme()}),P(16,gA,3,0,":svg:svg",18)(17,mA,2,0,":svg:svg",19),m()(),y(18,"lf-hover-tip",20)(19,"button",21),R("click",function(){return o.toggleSettings()}),ce(),y(20,"svg",19),F(21,"path",22),m()()()()(),P(22,_A,18,8,"div",23),m()),t&2){let i;u(),E(o.connectionStatus()==="disconnected"?1:-1),u(8),M("tip",o.connectionStatus()),u(),K("aria-label","Connection status: "+o.connectionStatus()),u(2),G("bg-amber-400",o.connectionStatus()==="connecting")("bg-emerald-400",o.connectionStatus()==="connected")("bg-rose-400",o.connectionStatus()==="disconnected"),u(),E(o.connectionStatus()!=="connected"?13:-1),u(),M("tip",o.themeTip()),u(),K("aria-label",o.themeTip()),u(),E(o.theme()==="dark"?16:17),u(3),G("bg-zinc-100",o.settingsOpen())("dark:bg-zinc-800",o.settingsOpen()),K("aria-pressed",o.settingsOpen()),u(3),E((i=o.sessionSnapshot())?22:-1,i)}},dependencies:[Qd,nl,Bd,yd,qd,Xd,Od,kd,Ue,sn],encapsulation:2})}};var Rb=[{path:"",component:sl}];var Nb={providers:[Ig({eventCoalescing:!0}),Tc(Rb),Wg()]};var al=class n{constructor(){f(si)}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275cmp=B({type:n,selectors:[["lf-root"]],decls:1,vars:0,template:function(t,o){t&1&&F(0,"router-outlet")},dependencies:[mr],encapsulation:2})}};nc(al,Nb).catch(n=>{console.error(n)});
|