@whoz-oss/coday-client 1.3.2 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/browser/{chunk-RbE7PtJh.js → chunk--Cv5Auvq.js} +1 -1
  2. package/browser/{chunk-ZTE9Vro-.js → chunk--wHR1I8D.js} +1 -1
  3. package/browser/{chunk-E8b2_4uB.js → chunk-5I4m0Psa.js} +1 -1
  4. package/browser/chunk-BFBXLzHo.js +1 -0
  5. package/browser/chunk-BGlC5myX.js +2 -0
  6. package/browser/{chunk-CZ6ILxDX.js → chunk-BMSbS6nO.js} +1 -1
  7. package/browser/{chunk-BXQCdGUa.js → chunk-BRf9jAIf.js} +1 -1
  8. package/browser/{chunk-BovznIFZ.js → chunk-BXWpkOo5.js} +1 -1
  9. package/browser/{chunk-CteHmI07.js → chunk-B_DNrrfb.js} +1 -1
  10. package/browser/{chunk-BptxX0h6.js → chunk-Bd0IiMsO.js} +1 -1
  11. package/browser/{chunk-eTAQJYle.js → chunk-BhfTutz7.js} +1 -1
  12. package/browser/{chunk-D0tFEYpV.js → chunk-BoBOhDYi.js} +1 -1
  13. package/browser/{chunk-CeRWUb5g.js → chunk-BuK7YbXS.js} +1 -1
  14. package/browser/{chunk-SiAnBXor.js → chunk-BvhdH1Xv.js} +1 -1
  15. package/browser/{chunk-B4iDNUj6.js → chunk-C0QR-AJM.js} +1 -1
  16. package/browser/{chunk-Bi1D1MPS.js → chunk-C26xMDFo.js} +1 -1
  17. package/browser/{chunk-BQ2Vio1f.js → chunk-C4iGhgYI.js} +1 -1
  18. package/browser/{chunk-_PndMs0h.js → chunk-C87Bh3Ov.js} +1 -1
  19. package/browser/{chunk-DzuMSf1O.js → chunk-CASGcP8y.js} +1 -1
  20. package/browser/chunk-CCN3DpLY.js +1 -0
  21. package/browser/{chunk-BWc0GaFw.js → chunk-CIOzO35E.js} +1 -1
  22. package/browser/{chunk-BGeY6TJl.js → chunk-CIQjlvza.js} +1 -1
  23. package/browser/{chunk-DUczAw5C.js → chunk-CNPdPW3v.js} +1 -1
  24. package/browser/chunk-COcavU_q.js +1 -0
  25. package/browser/{chunk-C7-Gy0Uz.js → chunk-CV4cx-V6.js} +1 -1
  26. package/browser/{chunk-Bh_9bCDZ.js → chunk-C_Vj6FE_.js} +1 -1
  27. package/browser/{chunk-CyEZHdnA.js → chunk-CjhnozeY.js} +1 -1
  28. package/browser/{chunk-BpA60NxS.js → chunk-CoQcKJau.js} +1 -1
  29. package/browser/{chunk-Cdu5JsaS.js → chunk-Cq8feM71.js} +1 -1
  30. package/browser/{chunk-CaxOrx5M.js → chunk-Cx9yTdUm.js} +1 -1
  31. package/browser/{chunk-n_Kgbuh3.js → chunk-D-K9FhYH.js} +1 -1
  32. package/browser/{chunk-x7Suyrio.js → chunk-D4D8VOP2.js} +1 -1
  33. package/browser/{chunk-C_7QzTv7.js → chunk-D9wQSJ4q.js} +1 -1
  34. package/browser/{chunk-CW742eC7.js → chunk-DHse9w28.js} +4 -4
  35. package/browser/{chunk-D5NtIZG6.js → chunk-DJSzQBCH.js} +1 -1
  36. package/browser/{chunk-BBJc_ez4.js → chunk-DL6rhSDN.js} +1 -1
  37. package/browser/{chunk-DJOhzAbC.js → chunk-DRAFMqKn.js} +1 -1
  38. package/browser/{chunk-DeVzkEKK.js → chunk-DW33OOxm.js} +1 -1
  39. package/browser/{chunk-DwB1vH9w.js → chunk-DWo8Yipj.js} +1 -1
  40. package/browser/{chunk-TBsNfd0k.js → chunk-DZuiUHX9.js} +1 -1
  41. package/browser/{chunk-20v-HoGw.js → chunk-DaJf2IFW.js} +1 -1
  42. package/browser/{chunk-nSxfGVc8.js → chunk-DaK9SdKA.js} +1 -1
  43. package/browser/{chunk-DvC7mEoN.js → chunk-DlKQ1Cys.js} +1 -1
  44. package/browser/{chunk-BemBoNs5.js → chunk-DmZR81FM.js} +1 -1
  45. package/browser/chunk-DmbSsVzR.js +1 -0
  46. package/browser/{chunk-BtYN6RGw.js → chunk-DtHFNV_5.js} +1 -1
  47. package/browser/{chunk-BXiOP6ZW.js → chunk-DxenqkEz.js} +1 -1
  48. package/browser/{chunk-B4CKPT8-.js → chunk-DyKPeAU4.js} +1 -1
  49. package/browser/{chunk-DlFFzFSe.js → chunk-GU0OGBZz.js} +1 -1
  50. package/browser/{chunk-BPJe1_uM.js → chunk-LNTSOB-k.js} +1 -1
  51. package/browser/{chunk-C2TRQfu4.js → chunk-PH-PuPg1.js} +1 -1
  52. package/browser/{chunk-CRuFXEnP.js → chunk-S33m0v63.js} +1 -1
  53. package/browser/chunk-SitBftU1.js +1 -0
  54. package/browser/{chunk-CiWRvj1N.js → chunk-TwL6unik.js} +1 -1
  55. package/browser/{chunk-BjDDtMsE.js → chunk-XynH5Ted.js} +1 -1
  56. package/browser/{chunk-G4MCwSm-.js → chunk-Y4Oxet3L.js} +1 -1
  57. package/browser/{chunk-Ckk6G7IP.js → chunk-drd9oaGN.js} +1 -1
  58. package/browser/{chunk-CNMTF87H.js → chunk-dwDdFGUB.js} +1 -1
  59. package/browser/{chunk-BmjhXCgH.js → chunk-fxaq06d7.js} +1 -1
  60. package/browser/{chunk-BdWvjltK.js → chunk-j7t2mSd6.js} +1 -1
  61. package/browser/{chunk-DEhf9VBD.js → chunk-jki7cP90.js} +1 -1
  62. package/browser/chunk-mHggS-i6.js +1 -0
  63. package/browser/{chunk-B9gLRfDm.js → chunk-okzlJmPZ.js} +1 -1
  64. package/browser/{chunk-DGa4-UJW.js → chunk-pySUFhL3.js} +1 -1
  65. package/browser/{chunk-Bh7gCjj4.js → chunk-vdkNDukI.js} +1 -1
  66. package/browser/{chunk-CcTN_TUb.js → chunk-z6x1ROGz.js} +1 -1
  67. package/browser/index.html +1 -1
  68. package/browser/{main-DXWHG4XK.js → main-XVJVH4GF.js} +2 -2
  69. package/package.json +1 -1
  70. package/browser/chunk-BIEjPnD4.js +0 -2
  71. package/browser/chunk-BUhtdVBd.js +0 -1
  72. package/browser/chunk-Balbg-lh.js +0 -1
  73. package/browser/chunk-CFvRU8Pw.js +0 -1
  74. package/browser/chunk-CmmK8635.js +0 -1
  75. package/browser/chunk-SlWicxh3.js +0 -1
  76. package/browser/chunk-spTKcuel.js +0 -1
@@ -1,4 +1,4 @@
1
- import {N as Ne,u as ui$1,a as me,f as fi$1,Y as Yt,V as Ve$1,n as ne}from'./chunk-Ckk6G7IP.js';import {g,az as Qt,aQ as As,aY as ks,al as yt$1,A as Aw,o as bg,v as vs,q as oC,k as fl,T as TC,r as Tg,X as XE,x as iC,D as Fg,I as IC,E as wC,j as Gn$1,l as Ag,W as WC,b_ as FC,C as Cg,a8 as Zg,O as Ot,w as we,cJ as yB,ca as mB,H as Hi$1,m as mT,b as U,bz as vC,bA as DC,ad as Vg,y as Hg,aw as pl,b5 as Sg,ax as hl,n as eC,t as tC,cb as gB,cq as vB,cc as Hf,cu as Lg,cv as CC,cd as Sb,af as Dg,an as ce,cK as Id,cL as Nd,bR as ma,S as ha,cI as Rg,b$ as Ng,cM as Rn$1,aK as Do$1,aL as qn$1,bq as sn,bC as ge,aN as wt$1,bD as vt,br as Cl,bK as pe,aR as K,cN as is,a as P,aS as Ut,cO as Bt,bQ as bd,bO as Yy,bt as Ve,c1 as ME,z as z$1,aZ as YT,bH as Eg,b4 as nT,aV as w,bu as kg,aU as U$1,bv as St,aW as D,bw as on,by as Oi$1,bE as X,cP as q,cQ as X$1,ac as mC,a9 as dC,aa as If,ab as wf,a5 as yl,cR as Yt$1,cS as Gp,bL as mr,aO as G,ae as Ot$1,aA as sn$1,bV as Y,cT as pi,cU as yg,aC as Cu,bx as am,cA as on$1,c7 as QT,ah as rT,a4 as rC,c8 as kf,bs as Qn$2,ap as Vy,bW as Pt,bY as X$2,bZ as xt,cV as YI,cC as Ce,a3 as HI,a6 as $I,bn as nC,c2 as kt,bI as dr,a_ as XC,b3 as oT,a$ as Yg,cg as Mg,cW as yr,cX as tt$1,aX as ft$1,cy as Xr,ag as fT}from'./main-DXWHG4XK.js';import {w as wt,j as Yn$1,k as _t$1,n as ni,l as Xn$1,E as En$1,z as ze,Q as Qn$1,e as ei,Y as Ye,f as fn,a as wt$2,A as At,Z as Zn$1,C as Cn}from'./chunk-BBJc_ez4.js';var ii=[[["mat-icon"],["","matMenuItemIcon",""]],"*"],oi=["mat-icon, [matMenuItemIcon]","*"];function ai(n,i){n&1&&(kf(),vs(0,"svg",2),bg(1,"polygon",3),fl());}var ri=["*"];function si(n,i){if(n&1){let e=dC();pl(0,"div",0),Rg("click",function(){If(e);let o=mC();return wf(o.closed.emit("click"))})("animationstart",function(o){If(e);let a=mC();return wf(a._onAnimationStart(o.animationName))})("animationend",function(o){If(e);let a=mC();return wf(a._onAnimationDone(o.animationName))})("animationcancel",function(o){If(e);let a=mC();return wf(a._onAnimationDone(o.animationName))}),pl(1,"div",1),DC(2),hl()();}if(n&2){let e=mC();FC(e._classList),Hg("mat-menu-panel-animations-disabled",e._animationsDisabled)("mat-menu-panel-exit-animation",e._panelAnimationState==="void")("mat-menu-panel-animating",e._isAnimating()),Ng("id",e.panelId),Cg("aria-label",e.ariaLabel||null)("aria-labelledby",e.ariaLabelledby||null)("aria-describedby",e.ariaDescribedby||null);}}var pt=new w("MAT_MENU_PANEL"),Be=(()=>{class n{_elementRef=g(Qt);_document=g(U$1);_focusMonitor=g(St);_parentMenu=g(pt,{optional:true});_changeDetectorRef=g(Cl);role="menuitem";disabled=false;disableRipple=false;_hovered=new ce;_focused=new ce;_highlighted=false;_triggersSubmenu=false;constructor(){g(D).load(on),this._parentMenu?.addItem?.(this);}focus(e,t){this._focusMonitor&&e?this._focusMonitor.focusVia(this._getHostElement(),e,t):this._getHostElement().focus(t),this._focused.next(this);}ngAfterViewInit(){this._focusMonitor&&this._focusMonitor.monitor(this._elementRef,false);}ngOnDestroy(){this._focusMonitor&&this._focusMonitor.stopMonitoring(this._elementRef),this._parentMenu&&this._parentMenu.removeItem&&this._parentMenu.removeItem(this),this._hovered.complete(),this._focused.complete();}_getTabIndex(){return this.disabled?"-1":"0"}_getHostElement(){return this._elementRef.nativeElement}_checkDisabled(e){this.disabled&&(e.preventDefault(),e.stopPropagation());}_handleMouseEnter(){this._hovered.next(this);}getLabel(){let e=this._elementRef.nativeElement.cloneNode(true),t=e.querySelectorAll("mat-icon, .material-icons");for(let o=0;o<t.length;o++)t[o].remove();return e.textContent?.trim()||""}_setHighlighted(e){this._highlighted=e,this._changeDetectorRef.markForCheck();}_setTriggersSubmenu(e){this._triggersSubmenu=e,this._changeDetectorRef.markForCheck();}_hasFocus(){return this._document&&this._document.activeElement===this._getHostElement()}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=Aw({type:n,selectors:[["","mat-menu-item",""]],hostAttrs:[1,"mat-mdc-menu-item","mat-focus-indicator"],hostVars:8,hostBindings:function(t,o){t&1&&Ag("click",function(m){return o._checkDisabled(m)})("mouseenter",function(){return o._handleMouseEnter()}),t&2&&(Cg("role",o.role)("tabindex",o._getTabIndex())("aria-disabled",o.disabled)("disabled",o.disabled||null),Hg("mat-mdc-menu-item-highlighted",o._highlighted)("mat-mdc-menu-item-submenu-trigger",o._triggersSubmenu));},inputs:{role:"role",disabled:[2,"disabled","disabled",YT],disableRipple:[2,"disableRipple","disableRipple",YT]},exportAs:["matMenuItem"],ngContentSelectors:oi,decls:5,vars:3,consts:[[1,"mat-mdc-menu-item-text"],["matRipple","",1,"mat-mdc-menu-ripple",3,"matRippleDisabled","matRippleTrigger"],["viewBox","0 0 5 10","focusable","false","aria-hidden","true",1,"mat-mdc-menu-submenu-icon"],["points","0,0 5,5 0,10"]],template:function(t,o){t&1&&(vC(ii),DC(0),vs(1,"span",0),DC(2,1),fl(),bg(3,"div",1),eC(4,ai,2,0,":svg:svg",2)),t&2&&(XE(3),Tg("matRippleDisabled",o.disableRipple||o.disabled)("matRippleTrigger",o._getHostElement()),XE(),tC(o._triggersSubmenu?4:-1));},dependencies:[Oi$1],encapsulation:2})}return n})();var Sn=new w("MatMenuContent"),ya=(()=>{class n{_template=g(dr);_appRef=g(yr);_injector=g(pe);_viewContainerRef=g(mr);_document=g(U$1);_changeDetectorRef=g(Cl);_portal;_outlet;_attached=new ce;attach(e={}){this._portal||(this._portal=new Y(this._template,this._viewContainerRef)),this.detach(),this._outlet||(this._outlet=new tt$1(this._document.createElement("div"),this._appRef,this._injector));let t=this._template.elementRef.nativeElement;t.parentNode.insertBefore(this._outlet.outletElement,t),this._changeDetectorRef.markForCheck(),this._portal.attach(this._outlet,e),this._attached.next();}detach(){this._portal?.isAttached&&this._portal.detach();}ngOnDestroy(){this.detach(),this._outlet?.dispose();}static \u0275fac=function(t){return new(t||n)};static \u0275dir=ks({type:n,selectors:[["ng-template","matMenuContent",""]],features:[nT([{provide:Sn,useExisting:n}])]})}return n})(),li=new w("mat-menu-default-options",{providedIn:"root",factory:()=>({overlapTrigger:false,xPosition:"after",yPosition:"below",backdropClass:"cdk-overlay-transparent-backdrop"})}),mt="_mat-menu-enter",et="_mat-menu-exit",De=(()=>{class n{_elementRef=g(Qt);_changeDetectorRef=g(Cl);_injector=g(pe);_keyManager;_xPosition;_yPosition;_firstItemFocusRef;_exitFallbackTimeout;_animationsDisabled=K();_allItems;_directDescendantItems=new is;_classList={};_panelAnimationState="void";_animationDone=new ce;_isAnimating=Hi$1(false);parentMenu;direction;overlayPanelClass;backdropClass;ariaLabel;ariaLabelledby;ariaDescribedby;get xPosition(){return this._xPosition}set xPosition(e){this._xPosition=e,this.setPositionClasses();}get yPosition(){return this._yPosition}set yPosition(e){this._yPosition=e,this.setPositionClasses();}templateRef;items;lazyContent;overlapTrigger=false;hasBackdrop;get panelClass(){return this._previousPanelClass}set panelClass(e){let t=this._previousPanelClass,o=P({},this._classList);t&&t.length&&t.split(" ").forEach(a=>{o[a]=false;}),this._previousPanelClass=e,e&&e.length&&(e.split(" ").forEach(a=>{o[a]=true;}),this._elementRef.nativeElement.className=""),this._classList=o;}_previousPanelClass="";get classList(){return this.panelClass}set classList(e){this.panelClass=e;}closed=new yt$1;close=this.closed;panelId=g(Ut).getId("mat-menu-panel-");constructor(){let e=g(li);this.overlayPanelClass=e.overlayPanelClass||"",this._xPosition=e.xPosition,this._yPosition=e.yPosition,this.backdropClass=e.backdropClass,this.overlapTrigger=e.overlapTrigger,this.hasBackdrop=e.hasBackdrop;}ngOnInit(){this.setPositionClasses();}ngAfterContentInit(){this._updateDirectDescendants(),this._keyManager=new Bt(this._directDescendantItems).withWrap().withTypeAhead().withHomeAndEnd(),this._keyManager.tabOut.subscribe(()=>this.closed.emit("tab")),this._directDescendantItems.changes.pipe(bd(this._directDescendantItems),ma(e=>Yy(...e.map(t=>t._focused)))).subscribe(e=>this._keyManager.updateActiveItem(e)),this._directDescendantItems.changes.subscribe(e=>{let t=this._keyManager;if(this._panelAnimationState==="enter"&&t.activeItem?._hasFocus()){let o=e.toArray(),a=Math.max(0,Math.min(o.length-1,t.activeItemIndex||0));o[a]&&!o[a].disabled?t.setActiveItem(a):t.setNextItemActive();}});}ngOnDestroy(){this._keyManager?.destroy(),this._directDescendantItems.destroy(),this.closed.complete(),this._firstItemFocusRef?.destroy(),clearTimeout(this._exitFallbackTimeout);}_hovered(){return this._directDescendantItems.changes.pipe(bd(this._directDescendantItems),ma(t=>Yy(...t.map(o=>o._hovered))))}addItem(e){}removeItem(e){}_handleKeydown(e){let t=e.keyCode,o=this._keyManager;switch(t){case 27:Ve(e)||(e.preventDefault(),this.closed.emit("keydown"));break;case 37:this.parentMenu&&this.direction==="ltr"&&this.closed.emit("keydown");break;case 39:this.parentMenu&&this.direction==="rtl"&&this.closed.emit("keydown");break;default:(t===38||t===40)&&o.setFocusOrigin("keyboard"),o.onKeydown(e);return}}focusFirstItem(e="program"){this._firstItemFocusRef?.destroy(),this._firstItemFocusRef=ME(()=>{let t=this._resolvePanel();if(!t||!t.contains(document.activeElement)){let o=this._keyManager;o.setFocusOrigin(e).setFirstItemActive(),!o.activeItem&&t&&t.focus();}},{injector:this._injector});}resetActiveItem(){this._keyManager.setActiveItem(-1);}setElevation(e){}setPositionClasses(e=this.xPosition,t=this.yPosition){this._classList=z$1(P({},this._classList),{"mat-menu-before":e==="before","mat-menu-after":e==="after","mat-menu-above":t==="above","mat-menu-below":t==="below"}),this._changeDetectorRef.markForCheck();}_onAnimationDone(e){let t=e===et;(t||e===mt)&&(t&&(clearTimeout(this._exitFallbackTimeout),this._exitFallbackTimeout=void 0),this._animationDone.next(t?"void":"enter"),this._isAnimating.set(false));}_onAnimationStart(e){(e===mt||e===et)&&this._isAnimating.set(true);}_setIsOpen(e){if(this._panelAnimationState=e?"enter":"void",e){if(this._keyManager.activeItemIndex===0){let t=this._resolvePanel();t&&(t.scrollTop=0);}}else this._animationsDisabled||(this._exitFallbackTimeout=setTimeout(()=>this._onAnimationDone(et),200));this._animationsDisabled&&setTimeout(()=>{this._onAnimationDone(e?mt:et);}),this._changeDetectorRef.markForCheck();}_updateDirectDescendants(){this._allItems.changes.pipe(bd(this._allItems)).subscribe(e=>{this._directDescendantItems.reset(e.filter(t=>t._parentMenu===this)),this._directDescendantItems.notifyOnChanges();});}_resolvePanel(){let e=null;return this._directDescendantItems.length&&(e=this._directDescendantItems.first._getHostElement().closest('[role="menu"]')),e}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=Aw({type:n,selectors:[["mat-menu"]],contentQueries:function(t,o,a){if(t&1&&kg(a,Sn,5)(a,Be,5)(a,Be,4),t&2){let m;IC(m=wC())&&(o.lazyContent=m.first),IC(m=wC())&&(o._allItems=m),IC(m=wC())&&(o.items=m);}},viewQuery:function(t,o){if(t&1&&Fg(dr,5),t&2){let a;IC(a=wC())&&(o.templateRef=a.first);}},hostVars:3,hostBindings:function(t,o){t&2&&Cg("aria-label",null)("aria-labelledby",null)("aria-describedby",null);},inputs:{backdropClass:"backdropClass",ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],ariaDescribedby:[0,"aria-describedby","ariaDescribedby"],xPosition:"xPosition",yPosition:"yPosition",overlapTrigger:[2,"overlapTrigger","overlapTrigger",YT],hasBackdrop:[2,"hasBackdrop","hasBackdrop",e=>e==null?null:YT(e)],panelClass:[0,"class","panelClass"],classList:"classList"},outputs:{closed:"closed",close:"close"},exportAs:["matMenu"],features:[nT([{provide:pt,useExisting:n}])],ngContentSelectors:ri,decls:1,vars:0,consts:[["tabindex","-1","role","menu",1,"mat-mdc-menu-panel",3,"click","animationstart","animationend","animationcancel","id"],[1,"mat-mdc-menu-content"]],template:function(t,o){t&1&&(vC(),Eg(0,si,3,12,"ng-template"));},styles:[`mat-menu {
1
+ import {N as Ne,u as ui$1,a as me,f as fi$1,Y as Yt,V as Ve$1,n as ne}from'./chunk-drd9oaGN.js';import {g,az as Qt,aQ as As,aY as ks,al as yt$1,A as Aw,o as bg,v as vs,q as oC,k as fl,T as TC,r as Tg,X as XE,x as iC,D as Fg,I as IC,E as wC,j as Gn$1,l as Ag,W as WC,b_ as FC,C as Cg,a8 as Zg,O as Ot,w as we,cJ as yB,ca as mB,H as Hi$1,m as mT,b as U,bz as vC,bA as DC,ad as Vg,y as Hg,aw as pl,b5 as Sg,ax as hl,n as eC,t as tC,cb as gB,cq as vB,cc as Hf,cu as Lg,cv as CC,cd as Sb,af as Dg,an as ce,cK as Id,cL as Nd,bR as ma,S as ha,cI as Rg,b$ as Ng,cM as Rn$1,aK as Do$1,aL as qn$1,bq as sn,bC as ge,aN as wt$1,bD as vt,br as Cl,bK as pe,aR as K,cN as is,a as P,aS as Ut,cO as Bt,bQ as bd,bO as Yy,bt as Ve,c1 as ME,z as z$1,aZ as YT,bH as Eg,b4 as nT,aV as w,bu as kg,aU as U$1,bv as St,aW as D,bw as on,by as Oi$1,bE as X,cP as q,cQ as X$1,ac as mC,a9 as dC,aa as If,ab as wf,a5 as yl,cR as Yt$1,cS as Gp,bL as mr,aO as G,ae as Ot$1,aA as sn$1,bV as Y,cT as pi,cU as yg,aC as Cu,bx as am,cA as on$1,c7 as QT,ah as rT,a4 as rC,c8 as kf,bs as Qn$2,ap as Vy,bW as Pt,bY as X$2,bZ as xt,cV as YI,cC as Ce,a3 as HI,a6 as $I,bn as nC,c2 as kt,bI as dr,a_ as XC,b3 as oT,a$ as Yg,cg as Mg,cW as yr,cX as tt$1,aX as ft$1,cy as Xr,ag as fT}from'./main-XVJVH4GF.js';import {w as wt,j as Yn$1,k as _t$1,n as ni,l as Xn$1,E as En$1,z as ze,Q as Qn$1,e as ei,Y as Ye,f as fn,a as wt$2,A as At,Z as Zn$1,C as Cn}from'./chunk-DL6rhSDN.js';var ii=[[["mat-icon"],["","matMenuItemIcon",""]],"*"],oi=["mat-icon, [matMenuItemIcon]","*"];function ai(n,i){n&1&&(kf(),vs(0,"svg",2),bg(1,"polygon",3),fl());}var ri=["*"];function si(n,i){if(n&1){let e=dC();pl(0,"div",0),Rg("click",function(){If(e);let o=mC();return wf(o.closed.emit("click"))})("animationstart",function(o){If(e);let a=mC();return wf(a._onAnimationStart(o.animationName))})("animationend",function(o){If(e);let a=mC();return wf(a._onAnimationDone(o.animationName))})("animationcancel",function(o){If(e);let a=mC();return wf(a._onAnimationDone(o.animationName))}),pl(1,"div",1),DC(2),hl()();}if(n&2){let e=mC();FC(e._classList),Hg("mat-menu-panel-animations-disabled",e._animationsDisabled)("mat-menu-panel-exit-animation",e._panelAnimationState==="void")("mat-menu-panel-animating",e._isAnimating()),Ng("id",e.panelId),Cg("aria-label",e.ariaLabel||null)("aria-labelledby",e.ariaLabelledby||null)("aria-describedby",e.ariaDescribedby||null);}}var pt=new w("MAT_MENU_PANEL"),Be=(()=>{class n{_elementRef=g(Qt);_document=g(U$1);_focusMonitor=g(St);_parentMenu=g(pt,{optional:true});_changeDetectorRef=g(Cl);role="menuitem";disabled=false;disableRipple=false;_hovered=new ce;_focused=new ce;_highlighted=false;_triggersSubmenu=false;constructor(){g(D).load(on),this._parentMenu?.addItem?.(this);}focus(e,t){this._focusMonitor&&e?this._focusMonitor.focusVia(this._getHostElement(),e,t):this._getHostElement().focus(t),this._focused.next(this);}ngAfterViewInit(){this._focusMonitor&&this._focusMonitor.monitor(this._elementRef,false);}ngOnDestroy(){this._focusMonitor&&this._focusMonitor.stopMonitoring(this._elementRef),this._parentMenu&&this._parentMenu.removeItem&&this._parentMenu.removeItem(this),this._hovered.complete(),this._focused.complete();}_getTabIndex(){return this.disabled?"-1":"0"}_getHostElement(){return this._elementRef.nativeElement}_checkDisabled(e){this.disabled&&(e.preventDefault(),e.stopPropagation());}_handleMouseEnter(){this._hovered.next(this);}getLabel(){let e=this._elementRef.nativeElement.cloneNode(true),t=e.querySelectorAll("mat-icon, .material-icons");for(let o=0;o<t.length;o++)t[o].remove();return e.textContent?.trim()||""}_setHighlighted(e){this._highlighted=e,this._changeDetectorRef.markForCheck();}_setTriggersSubmenu(e){this._triggersSubmenu=e,this._changeDetectorRef.markForCheck();}_hasFocus(){return this._document&&this._document.activeElement===this._getHostElement()}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=Aw({type:n,selectors:[["","mat-menu-item",""]],hostAttrs:[1,"mat-mdc-menu-item","mat-focus-indicator"],hostVars:8,hostBindings:function(t,o){t&1&&Ag("click",function(m){return o._checkDisabled(m)})("mouseenter",function(){return o._handleMouseEnter()}),t&2&&(Cg("role",o.role)("tabindex",o._getTabIndex())("aria-disabled",o.disabled)("disabled",o.disabled||null),Hg("mat-mdc-menu-item-highlighted",o._highlighted)("mat-mdc-menu-item-submenu-trigger",o._triggersSubmenu));},inputs:{role:"role",disabled:[2,"disabled","disabled",YT],disableRipple:[2,"disableRipple","disableRipple",YT]},exportAs:["matMenuItem"],ngContentSelectors:oi,decls:5,vars:3,consts:[[1,"mat-mdc-menu-item-text"],["matRipple","",1,"mat-mdc-menu-ripple",3,"matRippleDisabled","matRippleTrigger"],["viewBox","0 0 5 10","focusable","false","aria-hidden","true",1,"mat-mdc-menu-submenu-icon"],["points","0,0 5,5 0,10"]],template:function(t,o){t&1&&(vC(ii),DC(0),vs(1,"span",0),DC(2,1),fl(),bg(3,"div",1),eC(4,ai,2,0,":svg:svg",2)),t&2&&(XE(3),Tg("matRippleDisabled",o.disableRipple||o.disabled)("matRippleTrigger",o._getHostElement()),XE(),tC(o._triggersSubmenu?4:-1));},dependencies:[Oi$1],encapsulation:2})}return n})();var Sn=new w("MatMenuContent"),ya=(()=>{class n{_template=g(dr);_appRef=g(yr);_injector=g(pe);_viewContainerRef=g(mr);_document=g(U$1);_changeDetectorRef=g(Cl);_portal;_outlet;_attached=new ce;attach(e={}){this._portal||(this._portal=new Y(this._template,this._viewContainerRef)),this.detach(),this._outlet||(this._outlet=new tt$1(this._document.createElement("div"),this._appRef,this._injector));let t=this._template.elementRef.nativeElement;t.parentNode.insertBefore(this._outlet.outletElement,t),this._changeDetectorRef.markForCheck(),this._portal.attach(this._outlet,e),this._attached.next();}detach(){this._portal?.isAttached&&this._portal.detach();}ngOnDestroy(){this.detach(),this._outlet?.dispose();}static \u0275fac=function(t){return new(t||n)};static \u0275dir=ks({type:n,selectors:[["ng-template","matMenuContent",""]],features:[nT([{provide:Sn,useExisting:n}])]})}return n})(),li=new w("mat-menu-default-options",{providedIn:"root",factory:()=>({overlapTrigger:false,xPosition:"after",yPosition:"below",backdropClass:"cdk-overlay-transparent-backdrop"})}),mt="_mat-menu-enter",et="_mat-menu-exit",De=(()=>{class n{_elementRef=g(Qt);_changeDetectorRef=g(Cl);_injector=g(pe);_keyManager;_xPosition;_yPosition;_firstItemFocusRef;_exitFallbackTimeout;_animationsDisabled=K();_allItems;_directDescendantItems=new is;_classList={};_panelAnimationState="void";_animationDone=new ce;_isAnimating=Hi$1(false);parentMenu;direction;overlayPanelClass;backdropClass;ariaLabel;ariaLabelledby;ariaDescribedby;get xPosition(){return this._xPosition}set xPosition(e){this._xPosition=e,this.setPositionClasses();}get yPosition(){return this._yPosition}set yPosition(e){this._yPosition=e,this.setPositionClasses();}templateRef;items;lazyContent;overlapTrigger=false;hasBackdrop;get panelClass(){return this._previousPanelClass}set panelClass(e){let t=this._previousPanelClass,o=P({},this._classList);t&&t.length&&t.split(" ").forEach(a=>{o[a]=false;}),this._previousPanelClass=e,e&&e.length&&(e.split(" ").forEach(a=>{o[a]=true;}),this._elementRef.nativeElement.className=""),this._classList=o;}_previousPanelClass="";get classList(){return this.panelClass}set classList(e){this.panelClass=e;}closed=new yt$1;close=this.closed;panelId=g(Ut).getId("mat-menu-panel-");constructor(){let e=g(li);this.overlayPanelClass=e.overlayPanelClass||"",this._xPosition=e.xPosition,this._yPosition=e.yPosition,this.backdropClass=e.backdropClass,this.overlapTrigger=e.overlapTrigger,this.hasBackdrop=e.hasBackdrop;}ngOnInit(){this.setPositionClasses();}ngAfterContentInit(){this._updateDirectDescendants(),this._keyManager=new Bt(this._directDescendantItems).withWrap().withTypeAhead().withHomeAndEnd(),this._keyManager.tabOut.subscribe(()=>this.closed.emit("tab")),this._directDescendantItems.changes.pipe(bd(this._directDescendantItems),ma(e=>Yy(...e.map(t=>t._focused)))).subscribe(e=>this._keyManager.updateActiveItem(e)),this._directDescendantItems.changes.subscribe(e=>{let t=this._keyManager;if(this._panelAnimationState==="enter"&&t.activeItem?._hasFocus()){let o=e.toArray(),a=Math.max(0,Math.min(o.length-1,t.activeItemIndex||0));o[a]&&!o[a].disabled?t.setActiveItem(a):t.setNextItemActive();}});}ngOnDestroy(){this._keyManager?.destroy(),this._directDescendantItems.destroy(),this.closed.complete(),this._firstItemFocusRef?.destroy(),clearTimeout(this._exitFallbackTimeout);}_hovered(){return this._directDescendantItems.changes.pipe(bd(this._directDescendantItems),ma(t=>Yy(...t.map(o=>o._hovered))))}addItem(e){}removeItem(e){}_handleKeydown(e){let t=e.keyCode,o=this._keyManager;switch(t){case 27:Ve(e)||(e.preventDefault(),this.closed.emit("keydown"));break;case 37:this.parentMenu&&this.direction==="ltr"&&this.closed.emit("keydown");break;case 39:this.parentMenu&&this.direction==="rtl"&&this.closed.emit("keydown");break;default:(t===38||t===40)&&o.setFocusOrigin("keyboard"),o.onKeydown(e);return}}focusFirstItem(e="program"){this._firstItemFocusRef?.destroy(),this._firstItemFocusRef=ME(()=>{let t=this._resolvePanel();if(!t||!t.contains(document.activeElement)){let o=this._keyManager;o.setFocusOrigin(e).setFirstItemActive(),!o.activeItem&&t&&t.focus();}},{injector:this._injector});}resetActiveItem(){this._keyManager.setActiveItem(-1);}setElevation(e){}setPositionClasses(e=this.xPosition,t=this.yPosition){this._classList=z$1(P({},this._classList),{"mat-menu-before":e==="before","mat-menu-after":e==="after","mat-menu-above":t==="above","mat-menu-below":t==="below"}),this._changeDetectorRef.markForCheck();}_onAnimationDone(e){let t=e===et;(t||e===mt)&&(t&&(clearTimeout(this._exitFallbackTimeout),this._exitFallbackTimeout=void 0),this._animationDone.next(t?"void":"enter"),this._isAnimating.set(false));}_onAnimationStart(e){(e===mt||e===et)&&this._isAnimating.set(true);}_setIsOpen(e){if(this._panelAnimationState=e?"enter":"void",e){if(this._keyManager.activeItemIndex===0){let t=this._resolvePanel();t&&(t.scrollTop=0);}}else this._animationsDisabled||(this._exitFallbackTimeout=setTimeout(()=>this._onAnimationDone(et),200));this._animationsDisabled&&setTimeout(()=>{this._onAnimationDone(e?mt:et);}),this._changeDetectorRef.markForCheck();}_updateDirectDescendants(){this._allItems.changes.pipe(bd(this._allItems)).subscribe(e=>{this._directDescendantItems.reset(e.filter(t=>t._parentMenu===this)),this._directDescendantItems.notifyOnChanges();});}_resolvePanel(){let e=null;return this._directDescendantItems.length&&(e=this._directDescendantItems.first._getHostElement().closest('[role="menu"]')),e}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=Aw({type:n,selectors:[["mat-menu"]],contentQueries:function(t,o,a){if(t&1&&kg(a,Sn,5)(a,Be,5)(a,Be,4),t&2){let m;IC(m=wC())&&(o.lazyContent=m.first),IC(m=wC())&&(o._allItems=m),IC(m=wC())&&(o.items=m);}},viewQuery:function(t,o){if(t&1&&Fg(dr,5),t&2){let a;IC(a=wC())&&(o.templateRef=a.first);}},hostVars:3,hostBindings:function(t,o){t&2&&Cg("aria-label",null)("aria-labelledby",null)("aria-describedby",null);},inputs:{backdropClass:"backdropClass",ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],ariaDescribedby:[0,"aria-describedby","ariaDescribedby"],xPosition:"xPosition",yPosition:"yPosition",overlapTrigger:[2,"overlapTrigger","overlapTrigger",YT],hasBackdrop:[2,"hasBackdrop","hasBackdrop",e=>e==null?null:YT(e)],panelClass:[0,"class","panelClass"],classList:"classList"},outputs:{closed:"closed",close:"close"},exportAs:["matMenu"],features:[nT([{provide:pt,useExisting:n}])],ngContentSelectors:ri,decls:1,vars:0,consts:[["tabindex","-1","role","menu",1,"mat-mdc-menu-panel",3,"click","animationstart","animationend","animationcancel","id"],[1,"mat-mdc-menu-content"]],template:function(t,o){t&1&&(vC(),Eg(0,si,3,12,"ng-template"));},styles:[`mat-menu {
2
2
  display: none;
3
3
  }
4
4
 
@@ -1 +1 @@
1
- import {p}from'./chunk-CW742eC7.js';import {g,ao as V,J as dy,d3 as y,A as Aw,aw as pl,W as WC,ax as hl,X as XE,a8 as Zg}from'./main-DXWHG4XK.js';import'./chunk-_PndMs0h.js';import'./chunk-RbE7PtJh.js';import'./chunk-Ckk6G7IP.js';import'./chunk-BBJc_ez4.js';var A=class r{route=g(V);http=g(dy);config=g(y);message="Authentication in progress\u2026";ngOnInit(){let e=this.route.snapshot.queryParamMap.get("code"),t=this.route.snapshot.queryParamMap.get("state"),o=this.route.snapshot.queryParamMap.get("error"),i=this.route.snapshot.queryParamMap.get("error_description");if(o){console.warn("[AgentOS OAuth Callback] OAuth error:",o,i),this.notifyParentAndClose({success:false,error:i||o});return}if(!e){console.error("[AgentOS OAuth Callback] Missing authorization code"),this.message="OAuth callback error: missing authorization code.",this.notifyParentAndClose({success:false,error:"Missing authorization code"});return}this.http.post(`${this.config.basePath}/api/oauth/callback`,{code:e,state:t}).subscribe({next:()=>{console.log("[AgentOS OAuth Callback] Backend callback resolved"),this.notifyParentAndClose({success:true});},error:a=>{console.error("[AgentOS OAuth Callback] Backend callback failed:",a),this.notifyParentAndClose({success:false,error:a?.error?.message||a?.message||"Token exchange failed"});}});}notifyParentAndClose(e){if(this.message=e.success?"Authentication complete. You can close this window.":`Authentication failed: ${e.error??"unknown error"}. You can close this window.`,window.opener)try{window.opener.postMessage(e,window.location.origin);}catch(t){console.error("[AgentOS OAuth Callback] postMessage failed:",t),localStorage.setItem(p,JSON.stringify(e));}else console.warn("[AgentOS OAuth Callback] No window.opener \u2014 localStorage fallback"),localStorage.setItem(p,JSON.stringify(e));setTimeout(()=>window.close(),1e3);}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=Aw({type:r,selectors:[["agentos-oauth-callback"]],decls:2,vars:1,consts:[[2,"font-family","sans-serif","padding","2rem","text-align","center"]],template:function(t,o){t&1&&(pl(0,"p",0),WC(1),hl()),t&2&&(XE(),Zg(o.message));},encapsulation:2,changeDetection:1})};export{A as OAuthCallbackComponent};
1
+ import {p}from'./chunk-DHse9w28.js';import {g,ao as V,J as dy,d3 as y,A as Aw,aw as pl,W as WC,ax as hl,X as XE,a8 as Zg}from'./main-XVJVH4GF.js';import'./chunk-C87Bh3Ov.js';import'./chunk--Cv5Auvq.js';import'./chunk-drd9oaGN.js';import'./chunk-DL6rhSDN.js';var A=class r{route=g(V);http=g(dy);config=g(y);message="Authentication in progress\u2026";ngOnInit(){let e=this.route.snapshot.queryParamMap.get("code"),t=this.route.snapshot.queryParamMap.get("state"),o=this.route.snapshot.queryParamMap.get("error"),i=this.route.snapshot.queryParamMap.get("error_description");if(o){console.warn("[AgentOS OAuth Callback] OAuth error:",o,i),this.notifyParentAndClose({success:false,error:i||o});return}if(!e){console.error("[AgentOS OAuth Callback] Missing authorization code"),this.message="OAuth callback error: missing authorization code.",this.notifyParentAndClose({success:false,error:"Missing authorization code"});return}this.http.post(`${this.config.basePath}/api/oauth/callback`,{code:e,state:t}).subscribe({next:()=>{console.log("[AgentOS OAuth Callback] Backend callback resolved"),this.notifyParentAndClose({success:true});},error:a=>{console.error("[AgentOS OAuth Callback] Backend callback failed:",a),this.notifyParentAndClose({success:false,error:a?.error?.message||a?.message||"Token exchange failed"});}});}notifyParentAndClose(e){if(this.message=e.success?"Authentication complete. You can close this window.":`Authentication failed: ${e.error??"unknown error"}. You can close this window.`,window.opener)try{window.opener.postMessage(e,window.location.origin);}catch(t){console.error("[AgentOS OAuth Callback] postMessage failed:",t),localStorage.setItem(p,JSON.stringify(e));}else console.warn("[AgentOS OAuth Callback] No window.opener \u2014 localStorage fallback"),localStorage.setItem(p,JSON.stringify(e));setTimeout(()=>window.close(),1e3);}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=Aw({type:r,selectors:[["agentos-oauth-callback"]],decls:2,vars:1,consts:[[2,"font-family","sans-serif","padding","2rem","text-align","center"]],template:function(t,o){t&1&&(pl(0,"p",0),WC(1),hl()),t&2&&(XE(),Zg(o.message));},encapsulation:2,changeDetection:1})};export{A as OAuthCallbackComponent};
@@ -1 +1 @@
1
- import {g,J as dy,S as ha,bT as Od,u as ue,Y as x}from'./main-DXWHG4XK.js';var f=class s{http=g(dy);agentsCache=new Map;getAgents(e){let t=this.agentsCache.get(e);return t?ha(t):this.http.get(`/api/projects/${e}/agents`).pipe(Od(o=>{this.agentsCache.set(e,o);}))}getAgentsAutocomplete(e,t){return this.getAgents(e).pipe(ue(o=>{if(!t)return o;let i=t.toLowerCase(),a=r=>{let n=r.name.toLowerCase();return n.startsWith(i)?0:n.includes(i)?1:2};return o.filter(r=>{let n=r.name.toLowerCase(),h=r.description?.toLowerCase()||"";return n.includes(i)||h.includes(i)}).sort((r,n)=>a(r)-a(n))}))}clearCache(e){this.agentsCache.delete(e);}clearAllCache(){this.agentsCache.clear();}static \u0275fac=function(t){return new(t||s)};static \u0275prov=x({token:s,factory:s.\u0275fac,providedIn:"root"})};export{f};
1
+ import {g,J as dy,S as ha,bT as Od,u as ue,Y as x}from'./main-XVJVH4GF.js';var f=class s{http=g(dy);agentsCache=new Map;getAgents(e){let t=this.agentsCache.get(e);return t?ha(t):this.http.get(`/api/projects/${e}/agents`).pipe(Od(o=>{this.agentsCache.set(e,o);}))}getAgentsAutocomplete(e,t){return this.getAgents(e).pipe(ue(o=>{if(!t)return o;let i=t.toLowerCase(),a=r=>{let n=r.name.toLowerCase();return n.startsWith(i)?0:n.includes(i)?1:2};return o.filter(r=>{let n=r.name.toLowerCase(),h=r.description?.toLowerCase()||"";return n.includes(i)||h.includes(i)}).sort((r,n)=>a(r)-a(n))}))}clearCache(e){this.agentsCache.delete(e);}clearAllCache(){this.agentsCache.clear();}static \u0275fac=function(t){return new(t||s)};static \u0275prov=x({token:s,factory:s.\u0275fac,providedIn:"root"})};export{f};
@@ -0,0 +1 @@
1
+ import {g,ao as V,G,d4 as N,w as we,H as Hi,b as U,z as z$1,a as P,A as Aw,v as vs,l as Ag,W as WC,k as fl,n as eC,X as XE,a8 as Zg,t as tC,a9 as dC,o as bg,a3 as HI,ac as mC,r as Tg,a6 as $I,a5 as yl,aa as If,ab as wf}from'./main-XVJVH4GF.js';import {o as z,k as _t,b as _e,n as ni,J as Jn,Y as Ye,Z as Zn,l as Xn,C as Cn,E as En}from'./chunk-DL6rhSDN.js';function j(l,a){l&1&&(vs(0,"p",5),WC(1,"Loading\u2026"),fl());}function q(l,a){if(l&1){let e=dC();vs(0,"form",7),Ag("ngSubmit",function(){If(e);let u=mC();return wf(u.submit())}),vs(1,"div",8)(2,"label",9),WC(3,"Name "),vs(4,"span",10),WC(5,"*"),fl()(),bg(6,"input",11),HI(),fl(),vs(7,"div",8)(8,"label",12),WC(9,"Description"),fl(),bg(10,"textarea",13),HI(),fl(),vs(11,"div",8)(12,"label",14),WC(13,"External ID"),fl(),bg(14,"input",15),HI(),fl(),vs(15,"div",8)(16,"label",16),WC(17,"Default agent"),fl(),bg(18,"input",17),HI(),fl(),vs(19,"div",8)(20,"label",18),WC(21,"Config path"),fl(),bg(22,"input",19),HI(),fl(),vs(23,"div",20)(24,"button",21),WC(25),fl(),vs(26,"button",22),Ag("click",function(){If(e);let u=mC();return wf(u.cancel())}),WC(27,"Cancel"),fl()()();}if(l&2){let e=mC();Tg("formGroup",e.form),XE(6),Tg("formControl",e.nameControl),$I(),XE(4),Tg("formControl",e.descriptionControl),$I(),XE(4),Tg("formControl",e.externalIdControl),$I(),XE(4),Tg("formControl",e.defaultAgentNameControl),$I(),XE(4),Tg("formControl",e.configPathControl),$I(),XE(2),Tg("disabled",e.nameControl.invalid||e.isSubmitting()),XE(),yl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var $=class l{route=g(V);router=g(G);namespaceController=g(N);destroyRef=g(we);form=new z({name:new _t("",{nonNullable:true,validators:[_e.required,_e.minLength(1)]}),description:new _t("",{nonNullable:true}),configPath:new _t("",{nonNullable:true}),externalId:new _t("",{nonNullable:true}),defaultAgentName:new _t("",{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get configPathControl(){return this.form.controls.configPath}get externalIdControl(){return this.form.controls.externalId}get defaultAgentNameControl(){return this.form.controls.defaultAgentName}isEditMode=Hi(false);isSubmitting=Hi(false);isLoading=Hi(false);existingNamespace=null;ngOnInit(){let a=this.route.snapshot.paramMap.get("namespaceId");a&&(this.isEditMode.set(true),this.loadNamespace(a));}loadNamespace(a){this.isLoading.set(true),this.namespaceController.getByIdNamespace(a).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingNamespace=e,this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??""),this.configPathControl.setValue(e.configPath??""),this.externalIdControl.setValue(e.externalId??""),this.defaultAgentNameControl.setValue(e.defaultAgentName??""),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.nameControl.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let a=z$1(P({},this.existingNamespace),{name:this.nameControl.value.trim(),description:this.descriptionControl.value.trim()||void 0,configPath:this.configPathControl.value.trim()||void 0,externalId:this.externalIdControl.value.trim()||void 0,defaultAgentName:this.defaultAgentNameControl.value.trim()||void 0});(this.isEditMode()?this.namespaceController.updateNamespace(this.existingNamespace.id??"",a):this.namespaceController.createNamespace(a)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.router.navigate(["/agentos/namespaces"]);}static \u0275fac=function(e){return new(e||l)};static \u0275cmp=Aw({type:l,selectors:[["agentos-namespace-form"]],decls:10,vars:2,consts:[[1,"namespace-form"],[1,"namespace-form__header"],["type","button","title","Back to namespaces",1,"namespace-form__back",3,"click"],[1,"namespace-form__back-icon"],[1,"namespace-form__title"],[1,"namespace-form__loading"],[1,"namespace-form__form",3,"formGroup"],[1,"namespace-form__form",3,"ngSubmit","formGroup"],[1,"namespace-form__field"],["for","ns-name",1,"namespace-form__label"],["aria-hidden","true"],["id","ns-name","type","text","placeholder","Namespace name","autocomplete","off",1,"namespace-form__input",3,"formControl"],["for","ns-description",1,"namespace-form__label"],["id","ns-description","rows","4","placeholder","Optional description",1,"namespace-form__textarea",3,"formControl"],["for","ns-external-id",1,"namespace-form__label"],["id","ns-external-id","type","text","placeholder","Optional federation ID from an external system","autocomplete","off",1,"namespace-form__input",3,"formControl"],["for","ns-default-agent",1,"namespace-form__label"],["id","ns-default-agent","type","text","placeholder","Logical name of the default agent (e.g. coday)","autocomplete","off",1,"namespace-form__input",3,"formControl"],["for","ns-config-path",1,"namespace-form__label"],["id","ns-config-path","type","text","placeholder","Optional path to base configuration directory","autocomplete","off",1,"namespace-form__input",3,"formControl"],[1,"namespace-form__actions"],["type","submit",1,"namespace-form__btn","namespace-form__btn--primary",3,"disabled"],["type","button",1,"namespace-form__btn",3,"click"]],template:function(e,d){e&1&&(vs(0,"div",0)(1,"header",1)(2,"button",2),Ag("click",function(){return d.cancel()}),vs(3,"span",3),WC(4,"\u2190"),fl(),WC(5," Namespaces "),fl(),vs(6,"h1",4),WC(7),fl()(),eC(8,j,2,0,"p",5)(9,q,28,8,"form",6),fl()),e&2&&(XE(7),Zg(d.isEditMode()?"Edit namespace":"New namespace"),XE(),tC(d.isLoading()?8:9));},dependencies:[ni,Jn,Ye,Zn,Xn,Cn,En],styles:[".namespace-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:480px;margin:0 auto;padding:2rem 1rem}.namespace-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.namespace-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.namespace-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.namespace-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.namespace-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.namespace-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.namespace-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.namespace-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.namespace-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.namespace-form__input[_ngcontent-%COMP%], .namespace-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.namespace-form__input[_ngcontent-%COMP%]:focus, .namespace-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.namespace-form__input[_ngcontent-%COMP%]::placeholder, .namespace-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.namespace-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:96px;line-height:1.5}.namespace-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.namespace-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.namespace-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.namespace-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.namespace-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.namespace-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}"]})};export{$ as NamespaceFormComponent};
@@ -0,0 +1,2 @@
1
+ import {v}from'./chunk-DaJf2IFW.js';import {R,q,J}from'./chunk-C26xMDFo.js';import {g,ao as V,G,w as we,H as Hi,F,m as mT,cc as Hf,b as U,z as z$1,a as P$1,A as Aw,v as vs,l as Ag,W as WC,k as fl,n as eC,X as XE,a8 as Zg,t as tC,a9 as dC,q as oC,a4 as rC,a3 as HI,o as bg,ac as mC,r as Tg,a6 as $I,x as iC,a5 as yl,cG as Xw,aa as If,ab as wf,b_ as FC,C as Cg}from'./main-XVJVH4GF.js';import'./chunk-DHse9w28.js';import {k as _t,b as _e$1,o as z,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,A as At,m as mn,Z as Zn,l as Xn,C as Cn,E as En}from'./chunk-DL6rhSDN.js';import'./chunk-SitBftU1.js';import'./chunk-C87Bh3Ov.js';import'./chunk--Cv5Auvq.js';import'./chunk-drd9oaGN.js';function se(i,t){i&1&&(vs(0,"p",5),WC(1,"Loading\u2026"),fl());}function ce(i,t){if(i&1&&(vs(0,"label",23),bg(1,"input",24),HI(),vs(2,"span"),WC(3),fl()()),i&2){let e=t.$implicit,o=mC(3);XE(),Tg("formControl",o.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!o.isAdmin()),$I(),XE(2),Zg(e.label);}}function de(i,t){if(i&1&&(vs(0,"fieldset",8)(1,"legend",22),WC(2,"Configuration scope"),fl(),oC(3,ce,4,4,"label",23,Xw().trackByScope,true),fl()),i&2){let e=mC(2);Tg("disabled",e.isEditMode()),XE(3),iC(e.scopeOptions);}}function ue(i,t){if(i&1&&(vs(0,"option",13),WC(1),fl()),i&2){let e=t.$implicit,o=mC(2);Tg("value",e),XE(),Zg(o.authTypeLabel[e]);}}function pe(i,t){i&1&&WC(0," Leave a field unchanged to keep the stored credential. ");}function he(i,t){i&1&&(vs(0,"span",11),WC(1,"*"),fl());}function me(i,t){if(i&1&&(vs(0,"p",28),WC(1),fl()),i&2){let e=mC(2).$implicit;Tg("id","as-hint-"+e.key),XE(),Zg(e.hint);}}function ge(i,t){if(i&1&&(bg(0,"input",27),HI(),eC(1,me,2,2,"p",28)),i&2){let e=mC().$implicit;FC("auth-setting-form__input"+(e.secret?" auth-setting-form__input--secret":"")),Tg("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),Cg("aria-describedby",e.hint?"as-hint-"+e.key:null),$I(),XE(),tC(e.hint?1:-1);}}function Ce(i,t){if(i&1&&(vs(0,"div",9)(1,"label",26),WC(2),eC(3,he,2,0,"span",11),fl(),eC(4,ge,2,9),fl()),i&2){let e,o=t.$implicit,l=mC(3);XE(),Tg("for","as-cred-"+o.key),XE(),yl(" ",o.label," "),XE(),tC(o.required?3:-1),XE(),tC((e=l.controlForField(o.key))?4:-1,e);}}function fe(i,t){if(i&1&&(vs(0,"fieldset",18)(1,"legend",22),WC(2,"Credentials"),fl(),vs(3,"p",25),WC(4," Values are stored encrypted and masked on read. "),eC(5,pe,1,0),fl(),oC(6,Ce,5,4,"div",9,Xw().trackByField,true),fl()),i&2){let e=mC(2);XE(5),tC(e.isEditMode()?5:-1),XE(),iC(e.credentialFields());}}function ye(i,t){if(i&1){let e=dC();vs(0,"form",7),Ag("ngSubmit",function(){If(e);let l=mC();return wf(l.submit())}),eC(1,de,5,1,"fieldset",8),vs(2,"div",9)(3,"label",10),WC(4,"Auth type "),vs(5,"span",11),WC(6,"*"),fl()(),vs(7,"select",12),oC(8,ue,2,2,"option",13,rC),fl(),HI(),fl(),vs(10,"div",9)(11,"label",14),WC(12,"Name "),vs(13,"span",11),WC(14,"*"),fl()(),bg(15,"input",15),HI(),fl(),vs(16,"div",9)(17,"label",16),WC(18,"Description"),fl(),bg(19,"input",17),HI(),fl(),eC(20,fe,8,1,"fieldset",18),vs(21,"div",19)(22,"button",20),WC(23),fl(),vs(24,"button",21),Ag("click",function(){If(e);let l=mC();return wf(l.cancel())}),WC(25,"Cancel"),fl()()();}if(i&2){let e=mC();Tg("formGroup",e.form),XE(),tC(e.isPlatformMode?-1:1),XE(6),Tg("formControl",e.authTypeControl),$I(),XE(),iC(e.authTypeOptions),XE(7),Tg("formControl",e.nameControl),$I(),XE(4),Tg("formControl",e.descriptionControl),$I(),XE(),tC(e.credentialFields().length>0?20:-1),XE(2),Tg("disabled",e.form.invalid||e.isSubmitting()),XE(),yl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var _e=new Set(["namespace","userOnNs","userGlobal"]),P=Object.freeze({platform:"Platform (read-only)",namespace:"Namespace configuration",userOnNs:"Personal \u2014 this namespace only",userGlobal:"Personal \u2014 all namespaces"}),Se={ApiKeyAuthSetting:[{key:"apiKey",label:"API Key",placeholder:"sk-\u2026",secret:true,required:false}],BasicAuthAuthSetting:[{key:"username",label:"Username",placeholder:"user@example.com",secret:false,required:false},{key:"password",label:"Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",secret:true,required:false}],BearerTokenAuthSetting:[{key:"token",label:"Bearer token",placeholder:"eyJ\u2026",secret:true,required:false}],OAuthDiscoverableAuthSetting:[{key:"discoveryUrl",label:"Discovery URL",placeholder:"https://\u2026/.well-known/openid-configuration",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthCustomAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthRegisteredAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthMcpDiscoverableAuthSetting:[{key:"resourceUrl",label:"Resource URL",placeholder:"https://mcp.example.com",hint:"Use the base URL exactly as documented by your provider \u2014 do not append a path suffix. Examples: https://mcp.hubspot.com (HubSpot), https://mcp.atlassian.com/v1/mcp (Atlassian).",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",hint:"Leave empty to let the server register an OAuth client automatically (RFC 7591 dynamic registration). Fill in only if you have a pre-registered client ID from your provider.",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Leave empty in most cases \u2014 the MCP server declares the required scopes itself. Fill in only if your provider explicitly requires client-declared scopes.",secret:false,required:false}]},le=class i{route=g(V);router=g(G);destroyRef=g(we);state=g(R);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?Hi(true):F(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});authTypeOptions=q;authTypeLabel=J;scopeOptions=[{value:"namespace",label:P.namespace},{value:"userOnNs",label:P.userOnNs},{value:"userGlobal",label:P.userGlobal}];nameControl=new _t("",{nonNullable:true,validators:[_e$1.required,_e$1.minLength(1)]});descriptionControl=new _t(null);authTypeControl=new _t("ApiKeyAuthSetting",{nonNullable:true,validators:[_e$1.required]});scopeControl=new _t("namespace",{nonNullable:true});form=new z({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new _t("",{nonNullable:true});usernameControl=new _t("",{nonNullable:true});passwordControl=new _t("",{nonNullable:true});tokenControl=new _t("",{nonNullable:true});discoveryUrlControl=new _t("",{nonNullable:true});authorizationUrlControl=new _t("",{nonNullable:true});tokenUrlControl=new _t("",{nonNullable:true});clientIdControl=new _t("",{nonNullable:true});clientSecretControl=new _t("",{nonNullable:true});scopesControl=new _t("",{nonNullable:true});resourceUrlControl=new _t("",{nonNullable:true});selectedAuthType=F(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=mT(()=>Se[this.selectedAuthType()]);isEditMode=Hi(false);isSubmitting=Hi(false);isLoading=Hi(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||Hf(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,o=t.get("authSettingId");if(o){this.isEditMode.set(true),this.scopeControl.disable(),this.authTypeControl.disable(),this.loadConfig(o);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable();return}let l=this.parseScope(e.get("scope"));this.scopeControl.setValue(l);let v=e.get("template");v&&this.hydrateFromTemplate(v);}parseScope(t){return t&&_e.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId&&!t.namespaceId?"platform":t.userId?t.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AuthSettingForm] Could not load auth setting '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.authTypeControl.setValue(e.authType),this.clearCredentialControls(),this.initialCredentials={},this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AuthSettingForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){switch(this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.authTypeControl.setValue(t.authType),this.clearCredentialControls(),this.initialCredentials={},t.authType){case "ApiKeyAuthSetting":{let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialCredentials.apiKey=e;break}case "BasicAuthAuthSetting":{let e=t,o=e.username??"",l=e.password??"";this.usernameControl.setValue(o),this.passwordControl.setValue(l),this.initialCredentials.username=o,this.initialCredentials.password=l;break}case "BearerTokenAuthSetting":{let e=t.token??"";this.tokenControl.setValue(e),this.initialCredentials.token=e;break}case "OAuthDiscoverableAuthSetting":{let e=t;this.discoveryUrlControl.setValue(e.discoveryUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.discoveryUrl=e.discoveryUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthCustomAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthRegisteredAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthMcpDiscoverableAuthSetting":{let e=t;this.resourceUrlControl.setValue(e.resourceUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.resourceUrl=e.resourceUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}}}clearCredentialControls(){this.apiKeyControl.setValue(""),this.usernameControl.setValue(""),this.passwordControl.setValue(""),this.tokenControl.setValue(""),this.discoveryUrlControl.setValue(""),this.authorizationUrlControl.setValue(""),this.tokenUrlControl.setValue(""),this.clientIdControl.setValue(""),this.clientSecretControl.setValue(""),this.scopesControl.setValue(""),this.resourceUrlControl.setValue("");}credentialValue(t,e){if(!(this.isEditMode()&&e===this.initialCredentials[t]))return e||void 0}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.nameControl.value.trim(),e=this.descriptionControl.value?.trim()||void 0,o=this.authTypeControl.value,l=this.form.getRawValue().scope,v=this.isPlatformMode?null:this.namespaceId??null,w=this.buildTypedPayload(o,t,e);(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,w,this.existingConfig):this.state.create(w,l,v)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}buildTypedPayload(t,e,o){let l={name:e,description:o};switch(t){case "ApiKeyAuthSetting":return z$1(P$1({},l),{authType:"ApiKeyAuthSetting",apiKey:this.credentialValue("apiKey",this.apiKeyControl.value)});case "BasicAuthAuthSetting":return z$1(P$1({},l),{authType:"BasicAuthAuthSetting",username:this.credentialValue("username",this.usernameControl.value),password:this.credentialValue("password",this.passwordControl.value)});case "BearerTokenAuthSetting":return z$1(P$1({},l),{authType:"BearerTokenAuthSetting",token:this.credentialValue("token",this.tokenControl.value)});case "OAuthDiscoverableAuthSetting":return z$1(P$1({},l),{authType:"OAuthDiscoverableAuthSetting",discoveryUrl:this.credentialValue("discoveryUrl",this.discoveryUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthCustomAuthSetting":return z$1(P$1({},l),{authType:"OAuthCustomAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthRegisteredAuthSetting":return z$1(P$1({},l),{authType:"OAuthRegisteredAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthMcpDiscoverableAuthSetting":return z$1(P$1({},l),{authType:"OAuthMcpDiscoverableAuthSetting",resourceUrl:this.credentialValue("resourceUrl",this.resourceUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)})}}controlForField(t){return {apiKey:this.apiKeyControl,username:this.usernameControl,password:this.passwordControl,token:this.tokenControl,discoveryUrl:this.discoveryUrlControl,authorizationUrl:this.authorizationUrlControl,tokenUrl:this.tokenUrlControl,clientId:this.clientIdControl,clientSecret:this.clientSecretControl,scopes:this.scopesControl,resourceUrl:this.resourceUrlControl}[t]}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","auth-settings"]):this.router.navigate(["/agentos",this.namespaceId,"auth-settings"]);}trackByScope(t,e){return e.value}trackByField(t,e){return e.key}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=Aw({type:i,selectors:[["agentos-auth-setting-form"]],decls:10,vars:2,consts:[[1,"auth-setting-form"],[1,"auth-setting-form__header"],["type","button","title","Back to auth settings",1,"auth-setting-form__back",3,"click"],[1,"auth-setting-form__back-icon"],[1,"auth-setting-form__title"],[1,"auth-setting-form__loading"],[1,"auth-setting-form__form",3,"formGroup"],[1,"auth-setting-form__form",3,"ngSubmit","formGroup"],[1,"auth-setting-form__scope",3,"disabled"],[1,"auth-setting-form__field"],["for","as-auth-type",1,"auth-setting-form__label"],["aria-hidden","true"],["id","as-auth-type",1,"auth-setting-form__select",3,"formControl"],[3,"value"],["for","as-name",1,"auth-setting-form__label"],["id","as-name","type","text","placeholder","e.g. GitHub OAuth App","autocomplete","off",1,"auth-setting-form__input",3,"formControl"],["for","as-description",1,"auth-setting-form__label"],["id","as-description","type","text","placeholder","Optional \u2014 short description of this auth setting","autocomplete","off",1,"auth-setting-form__input",3,"formControl"],[1,"auth-setting-form__credentials"],[1,"auth-setting-form__actions"],["type","submit",1,"auth-setting-form__btn","auth-setting-form__btn--primary",3,"disabled"],["type","button",1,"auth-setting-form__btn",3,"click"],[1,"auth-setting-form__label"],[1,"auth-setting-form__scope-option"],["type","radio",3,"formControl","value","disabled"],[1,"auth-setting-form__credentials-hint"],[1,"auth-setting-form__label",3,"for"],[3,"id","type","placeholder","formControl","autocomplete"],[1,"auth-setting-form__field-hint",3,"id"]],template:function(e,o){e&1&&(vs(0,"div",0)(1,"header",1)(2,"button",2),Ag("click",function(){return o.cancel()}),vs(3,"span",3),WC(4,"\u2190"),fl(),WC(5," Auth Settings "),fl(),vs(6,"h1",4),WC(7),fl()(),eC(8,se,2,0,"p",5)(9,ye,26,8,"form",6),fl()),e&2&&(XE(7),Zg(o.isEditMode()?"Edit auth setting":"New auth setting"),XE(),tC(o.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,At,mn,Zn,Xn,Cn,En],styles:[".auth-setting-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem;padding:1.5rem;max-width:640px}.auth-setting-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.auth-setting-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.4rem;background:none;border:none;cursor:pointer;color:var(--color-text-secondary);font-size:.85rem;padding:0}.auth-setting-form__back[_ngcontent-%COMP%]:hover{color:var(--color-primary)}.auth-setting-form__back-icon[_ngcontent-%COMP%]{font-size:1rem}.auth-setting-form__title[_ngcontent-%COMP%]{font-size:1.4rem;font-weight:600;color:var(--color-text);margin:0}.auth-setting-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem}.auth-setting-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.auth-setting-form__scope[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:8px;padding:.75rem 1rem;display:flex;flex-direction:column;gap:.5rem}.auth-setting-form__scope[_ngcontent-%COMP%] legend[_ngcontent-%COMP%]{padding:0 .25rem}.auth-setting-form__scope-option[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;font-size:.9rem;color:var(--color-text)}.auth-setting-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem}.auth-setting-form__field-hint[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);margin:0;line-height:1.4}.auth-setting-form__label[_ngcontent-%COMP%]{font-size:.85rem;font-weight:500;color:var(--color-text-secondary)}.auth-setting-form__input[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem .75rem;background:var(--color-bg-secondary);color:var(--color-text);font-size:.9rem;outline:none;transition:border-color .15s ease;width:100%;box-sizing:border-box}.auth-setting-form__input[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.auth-setting-form__input--secret[_ngcontent-%COMP%]{font-family:monospace;letter-spacing:.05em}.auth-setting-form__select[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem .75rem;background:var(--color-bg-secondary);color:var(--color-text);font-size:.9rem;outline:none;cursor:pointer;transition:border-color .15s ease}.auth-setting-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.auth-setting-form__credentials[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:8px;padding:.75rem 1rem 1rem;display:flex;flex-direction:column;gap:.75rem;margin:0}.auth-setting-form__credentials[_ngcontent-%COMP%] legend[_ngcontent-%COMP%]{padding:0 .25rem}.auth-setting-form__credentials-hint[_ngcontent-%COMP%]{font-size:.78rem;color:var(--color-text-secondary);margin:0}.auth-setting-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;align-items:center;padding-top:.5rem}.auth-setting-form__btn[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem 1.25rem;cursor:pointer;font-size:.9rem;font-weight:500;background:var(--color-bg-secondary);color:var(--color-text);transition:background .15s ease}.auth-setting-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover)}.auth-setting-form__btn[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.auth-setting-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-on-primary, #fff);border-color:var(--color-primary)}.auth-setting-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, var(--color-primary))}"]})};
2
+ export{le as AuthSettingFormComponent};
@@ -1,4 +1,4 @@
1
- import {f}from'./chunk-E8b2_4uB.js';import {G as Ge,$,K as Ke,E as Et,y as yt$2}from'./chunk-BXiOP6ZW.js';import {U as Ue$1,x as x$1,i as is}from'./chunk-_PndMs0h.js';import {al as yt,an as ce,g,ay as O,F,L,az as Qt,U,N,h as he,G,ap as Vy,ae as Ot,aA as sn,av as dt$1,A as Aw,i as hr$1,aB as fr$1,aC as Cu,v as vs,l as Ag,n as eC,k as fl,X as XE,r as Tg,t as tC,D as Fg,I as IC,E as wC,P as P$1,aD as Ly,Y as x,a9 as dC,ai as Jg,aa as If,aj as KC,ab as wf,a3 as HI,y as Hg,ak as Xg,a6 as $I,B as dE,J as dy,S as ha,aE as A,u as ue,a7 as ga,aF as me$1,H as Hi$1,m as mT,z as z$1,a as P$2,aG as z,b as U$1,aH as TS,q as oC,x as iC,aI as Tr$1,aJ as Nb,am as Gm,j as Gn$1,W as WC,aK as Do$1,aL as qn$1,aM as Nn$1,aN as wt$1,aO as G$1,aP as $a,aQ as As,aR as K,aS as Ut,aT as Ue,aU as U$2,aV as w,aW as D,aX as ft$1,aY as ks,aZ as YT,ac as mC,a_ as XC,a$ as Yg,a5 as yl,o as bg,ah as rT,b0 as An,b1 as Ob,b2 as bb,b3 as oT,b4 as nT,aw as pl,b5 as Sg,ax as hl,a8 as Zg,c as ce$1,b6 as u,b7 as B,b8 as T$1,b9 as v,ba as m,bb as R,bc as h,bd as A$1,be as aT,bf as uT,C as Cg,bg as Hy,p as pr$1,bh as lT,bi as aE,bj as yh}from'./main-DXWHG4XK.js';import {s}from'./chunk-x7Suyrio.js';import {d}from'./chunk-BjDDtMsE.js';import {S as Se$1,P as Pn}from'./chunk-RbE7PtJh.js';import {u as ui$1,m as mt$1,p as pt$1,Z,V as Ve}from'./chunk-Ckk6G7IP.js';import {y as yt$1,w as wt,t as ti$1,Y as Ye,Z as Zn$1,c as cn}from'./chunk-BBJc_ez4.js';var et=class i{sanitizer=g(TS);transform(e,t){if(!t||!e)return e;let n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`(${n})`,"gi"),r=e.replace(o,"<strong>$1</strong>");return this.sanitizer.bypassSecurityTrustHtml(r)}static \u0275fac=function(t){return new(t||i)};static \u0275pipe=An({name:"highlight",type:i,pure:true})};var fe=class i{http=g(dy);projectState=g(P$1);threadState=g(U);transcribeAudio(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow();return this.http.post(`/api/projects/${o}/transcribe`,P$2({audio:e,mimeType:t},n?{language:n}:{}))}sendVoiceMessage(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow(),r=this.threadState.getSelectedThreadIdOrThrow();return this.http.post(`/api/projects/${o}/threads/${r}/voice-message`,P$2({audio:e,mimeType:t},n?{language:n}:{}))}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};var _i=["messageInput"],xi=["fileInput"],yi=(i,e)=>e.name;function wi(i,e){i&1&&(vs(0,"div",3),bg(1,"span",8),WC(2," Recording... Click mic to stop "),fl());}function Ti(i,e){i&1&&(vs(0,"div",3),bg(1,"span",9),WC(2," Transcribing... "),fl());}function Si(i,e){if(i&1&&(vs(0,"span",14),WC(1),fl()),i&2){let t=mC().$implicit,n=mC(2);XE(),Zg(" "+(n.getParameterFormat(t)||""));}}function Mi(i,e){if(i&1){let t=dC();vs(0,"div",11),Ag("click",function(){let o=If(t).$index,r=mC(2);return wf(r.selectAutocompleteItemByClick(o))})("keydown.enter",function(){let o=If(t).$index,r=mC(2);return wf(r.selectAutocompleteItemByClick(o))})("keydown.space",function(){let o=If(t).$index,r=mC(2);return wf(r.selectAutocompleteItemByClick(o))})("mouseenter",function(){let o=If(t).$index,r=mC(2);return wf(r.selectedAutocompleteIndex=o)}),vs(1,"div",12),bg(2,"span",13),aT(3,"highlight"),eC(4,Si,2,1,"span",14),fl(),bg(5,"div",15),aT(6,"highlight"),fl();}if(i&2){let t=e.$implicit,n=e.$index,o=mC(2);Hg("selected",n===o.selectedAutocompleteIndex),Cg("aria-selected",n===o.selectedAutocompleteIndex),XE(2),Tg("innerHTML",lT(3,6,o.autocompleteTrigger+t.name,o.getAutocompleteQuery()),aE),XE(2),tC(o.hasParameterFormat(t)?4:-1),XE(),Tg("innerHTML",lT(6,9,t.description,o.getAutocompleteQuery()),aE);}}function Ei(i,e){if(i&1&&(vs(0,"div",4),oC(1,Mi,7,12,"div",10,yi),fl()),i&2){let t=mC();XE(),iC(t.autocompleteItems);}}function Oi(i,e){if(i&1){let t=dC();vs(0,"ds-icon-button",18),Ag("action",function(){If(t);let o=mC(2);return wf(o.onStopClick())}),fl();}}function Pi(i,e){if(i&1){let t=dC();vs(0,"ds-icon-button",19),Ag("action",function(){If(t);let o=mC(2);return wf(o.sendMessage())}),fl();}if(i&2){let t=mC(2);Hg("hidden",t.isDisabled||!t.message.trim())("active",!!t.message.trim()&&!t.isDisabled),Tg("title",t.getSendButtonTooltip())("disabled",t.isDisabled||!t.message.trim());}}function ki(i,e){if(i&1){let t=dC();vs(0,"ds-icon-button",21),Ag("action",function(){If(t);let o=mC(3);return wf(o.triggerFileUpload())}),fl(),vs(1,"input",22,1),Ag("change",function(o){If(t);let r=mC(3);return wf(r.onFileInputChange(o))}),fl();}if(i&2){let t=mC(3);Tg("disabled",t.isDisabled);}}function Ii(i,e){if(i&1){let t=dC();eC(0,ki,3,1),vs(1,"ds-icon-button",20),Ag("action",function(){If(t);let o=mC(2);return wf(o.toggleRecording())}),fl();}if(i&2){let t=mC(2);tC(!t.showWelcome&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?0:-1),XE(),Hg("hidden",t.message.trim()&&!t.isRecording&&!t.isTranscribing),Tg("variant",t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing)?"danger":"default")("disabled",t.isVoiceMessageMode&&t.isTranscribing)("title",t.isRecording?"Click to stop recording":t.isTranscribing?"Uploading...":"Click to start recording");}}function Di(i,e){if(i&1&&(vs(0,"div",7),eC(1,Oi,1,0,"ds-icon-button",16),eC(2,Pi,1,6,"ds-icon-button",17),eC(3,Ii,2,6),fl()),i&2){let t=mC();XE(),tC(t.isThinking?1:-1),XE(),tC((!t.isThinking||t.message.trim())&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?2:-1),XE(),tC(t.isThinking?-1:3);}}var tt=class i{isDisabled=false;showWelcome=false;isThinking=false;isStarting=false;isSessionInitializing=false;isStopping=false;filesPasted=new yt;messageSubmitted=new yt;voiceMessageReady=new yt;voiceRecordingToggled=new yt;heightChanged=new yt;stopRequested=new yt;textareaFocused=new yt;messageInput;fileInput;message="";isRecording=false;isTranscribing=false;isFocused=false;recognition=null;mediaRecorder=null;audioChunks=[];voiceInputMode="browser";get isVoiceMessageMode(){return this.voiceInputMode==="voice-message"}sessionHadTranscript=false;pendingLineBreaksTimeout=null;lastProcessedResultIndex=0;useEnterToSend=false;currentInvite="";subscriptions=[];thinkingPhrases=["Processing request...","Thinking...","Working on it..."];currentThinkingPhrase="Processing request...";thinkingPhraseIndex=0;thinkingInterval=null;autocompleteVisible=false;autocompleteTrigger=null;autocompleteItems=[];selectedAutocompleteIndex=0;preferencesService=g(L);codayService=g(Ge);agentApiService=g(f);promptApiService=g(d);projectStateService=g(P$1);audioApiService=g(fe);threadStateService=g(U);ngOnInit(){this.initializeVoiceInput(),this.useEnterToSend=this.preferencesService.getEnterToSend(),this.subscriptions.push(this.preferencesService.voiceLanguage$.subscribe(()=>this.updateRecognitionLanguage())),this.subscriptions.push(this.preferencesService.voiceInputMode$.subscribe(e=>{this.voiceInputMode=e;})),this.subscriptions.push(this.preferencesService.enterToSend$.subscribe(e=>{this.useEnterToSend=e;})),this.subscribeToInviteEvents(),this.subscribeToMessageRestore();}ngAfterViewInit(){this.adjustTextareaHeight(),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),200);});}ngOnChanges(e){e.isThinking&&(e.isThinking.currentValue?this.startThinkingAnimation():(this.stopThinkingAnimation(),this.isStopping=false,e.isThinking.previousValue&&(console.log("[CHAT-TEXTAREA] Thinking ended, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100);})))),e.isSessionInitializing&&!e.isSessionInitializing.currentValue&&e.isSessionInitializing.previousValue&&(console.log("[CHAT-TEXTAREA] Session initialization completed, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100);})),e.isStarting&&!e.isStarting.currentValue&&e.isStarting.previousValue&&this.isThinking&&(this.thinkingPhraseIndex===0?(console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index 0 - restarting animation"),this.stopThinkingAnimation(),this.startThinkingAnimation()):console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index",this.thinkingPhraseIndex,"- continuing without restart"));}ngOnDestroy(){this.subscriptions.forEach(e=>e.unsubscribe()),this.subscriptions=[],this.clearPendingLineBreaks(),this.stopThinkingAnimation();}onKeyDown(e){if(this.autocompleteVisible)switch(e.key){case "ArrowDown":e.preventDefault(),this.selectedAutocompleteIndex=Math.min(this.selectedAutocompleteIndex+1,this.autocompleteItems.length-1),this.scrollSelectedItemIntoView();return;case "ArrowUp":e.preventDefault(),this.selectedAutocompleteIndex=Math.max(this.selectedAutocompleteIndex-1,0),this.scrollSelectedItemIntoView();return;case "Tab":case "Enter":if(!this.message.includes(" ")){e.preventDefault(),this.selectAutocompleteItem();return}break;case "Escape":e.preventDefault(),this.hideAutocomplete();return}e.key==="Enter"&&(this.useEnterToSend?!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(e.preventDefault(),this.sendMessage(true)):(navigator.platform.toLowerCase().includes("mac")?e.metaKey:e.ctrlKey)&&!e.shiftKey&&(e.preventDefault(),this.sendMessage(true)));}onInput(){this.adjustTextareaHeight(),this.checkForAutocomplete();}onPaste(e){let t=e.clipboardData?.items;if(!t)return;let n=Array.from(t).filter(r=>r.kind==="file");if(!n.length)return;e.preventDefault();let o=n.reduce((r,d)=>{let v=d.getAsFile();return v?[...r,v]:r},[]);o.length&&this.filesPasted.emit(o);}triggerFileUpload(){console.log("[CHAT-TEXTAREA] Triggering file upload"),this.fileInput?.nativeElement?.click();}onFileInputChange(e){let t=e.target,n=t.files;if(!n||n.length===0){console.log("[CHAT-TEXTAREA] No files selected");return}console.log("[CHAT-TEXTAREA] Files selected:",n.length);let o=Array.from(n);this.filesPasted.emit(o),t.value="";}onDocumentClick(e){if(!this.autocompleteVisible)return;let t=e.target,n=document.querySelector(".autocomplete-popup"),o=this.messageInput?.nativeElement;n&&!n.contains(t)&&o&&!o.contains(t)&&this.hideAutocomplete();}sendMessage(e=false){let t=this.message.trim();!this.isDisabled&&(e||t)&&(this.isRecording&&this.recognition&&(this.clearPendingLineBreaks(),this.recognition.stop()),this.messageSubmitted.emit(t),this.message="",setTimeout(()=>this.adjustTextareaHeight(),0));}onStopClick(){this.isStopping=true,this.stopRequested.emit();}toggleRecording(){this.isRecording?this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.stopWhisperRecording():this.stopRecording():this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.startWhisperRecording():this.startRecording();}startWhisperRecording(){return dt$1(this,null,function*(){if(!this.isRecording)try{let e=yield navigator.mediaDevices.getUserMedia({audio:!0});this.audioChunks=[],this.mediaRecorder=new MediaRecorder(e),this.mediaRecorder.ondataavailable=t=>{t.data.size>0&&this.audioChunks.push(t.data);},this.mediaRecorder.onstop=()=>{e.getTracks().forEach(t=>t.stop()),this.processWhisperAudio();},this.mediaRecorder.onerror=t=>{console.error("[WHISPER] MediaRecorder error:",t),e.getTracks().forEach(n=>n.stop()),this.isRecording=!1,this.voiceRecordingToggled.emit(!1);},this.mediaRecorder.start(),this.isRecording=!0,this.voiceRecordingToggled.emit(!0),console.log("[WHISPER] Started recording");}catch(e){console.error("[WHISPER] Failed to start recording:",e),this.isRecording=false,this.voiceRecordingToggled.emit(false);}})}stopWhisperRecording(){if(!(!this.mediaRecorder||!this.isRecording))try{this.mediaRecorder.stop(),this.isRecording=!1,this.voiceRecordingToggled.emit(!1),console.log("[WHISPER] Stopped recording");}catch(e){console.error("[WHISPER] Failed to stop recording:",e),this.isRecording=false,this.voiceRecordingToggled.emit(false);}}processWhisperAudio(){if(this.audioChunks.length===0)return;let e=new Blob(this.audioChunks,{type:this.mediaRecorder?.mimeType||"audio/webm"}),t=e.type.split(";")[0]||"audio/webm";this.audioChunks=[],this.isTranscribing=true;let n=new FileReader;n.onloadend=()=>{let o=n.result.split(",")[1];if(!o){console.error("[WHISPER] Failed to read audio as base64"),this.isTranscribing=false;return}let d=this.preferencesService.getVoiceLanguage().split("-")[0];if(this.voiceInputMode==="voice-message"){if(!this.threadStateService.getSelectedThreadId()){console.log("[WHISPER] No thread selected \u2014 emitting voiceMessageReady for thread creation"),this.isTranscribing=false,this.voiceMessageReady.emit({base64:o,mimeType:t,language:d});return}this.audioApiService.sendVoiceMessage(o,t,d).subscribe({next:v=>{this.isTranscribing=false,console.log("[WHISPER] Voice message sent, transcription:",v.transcription?.substring(0,50));},error:v=>{console.error("[WHISPER] Voice message error:",v),this.isTranscribing=false,this.fallbackToTranscription(o,t,d);}});}else this.audioApiService.transcribeAudio(o,t,d).subscribe({next:v=>{this.isTranscribing=false,v.text&&this.appendToTextarea(v.text+" ");},error:v=>{console.error("[WHISPER] Transcription error:",v),this.isTranscribing=false;}});},n.readAsDataURL(e);}fallbackToTranscription(e,t,n){this.audioApiService.transcribeAudio(e,t,n).subscribe({next:o=>{this.isTranscribing=false,o.text&&this.appendToTextarea(o.text+" ");},error:o=>{console.error("[WHISPER] Fallback transcription also failed:",o),this.isTranscribing=false;}});}initializeVoiceInput(){let e=window.SpeechRecognition??window.webkitSpeechRecognition;if(console.log("[SPEECH] speechRecognition",e),!e){console.warn("[SPEECH] Speech Recognition API not available");return}this.recognition=new e,this.recognition.continuous=true,this.recognition.interimResults=true,this.recognition.maxAlternatives=1,this.recognition.lang=this.getSelectedLanguage();try{"grammars"in this.recognition&&(this.recognition.serviceURI=void 0);}catch(t){console.log("[SPEECH] Advanced speech recognition parameters not supported");}this.recognition.onresult=t=>{let n="",o=Math.max(t.resultIndex,this.lastProcessedResultIndex);for(let r=o;r<t.results.length;r++)t.results[r].isFinal&&(n+=t.results[r][0].transcript,this.lastProcessedResultIndex=r+1);if(n){let r=this.improveTranscriptPunctuation(n.trim());this.sessionHadTranscript=true,console.log("[SPEECH] onresult ending, appending to textarea",this.isRecording),this.appendToTextarea(r);}},this.recognition.onend=()=>{console.log("[SPEECH] Recognition ended. Was recording:",this.isRecording),this.isRecording=false,this.lastProcessedResultIndex=0,this.voiceRecordingToggled.emit(this.isRecording);},this.recognition.onerror=t=>{console.error("[SPEECH] Speech recognition error:",t.error),console.log("[SPEECH] Error details:",{error:t.error,message:t.message,timeStamp:t.timeStamp}),this.isRecording=false,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording);},this.recognition.onstart=()=>{console.log("[SPEECH] Recognition started successfully");},this.recognition.onspeechstart=()=>{console.log("[SPEECH] Speech detected");},this.recognition.onspeechend=()=>{console.log("[SPEECH] Speech ended");};}startRecording(){return dt$1(this,null,function*(){if(!(!this.recognition||this.isRecording))try{this.isRecording=!0,this.sessionHadTranscript=!1,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording),this.recognition.start(),console.log("[SPEECH] Started recording");}catch(e){console.error("[SPEECH] Failed to start recording:",e),this.isRecording=false,this.voiceRecordingToggled.emit(this.isRecording);}})}stopRecording(){if(!this.recognition||!this.isRecording){console.log("[SPEECH] stopRecording not recording");return}try{console.log("[SPEECH] stopRecording recognition stop"),this.recognition.stop(),this.schedulePendingLineBreaks();}catch(e){console.error("[SPEECH] Failed to stop recording:",e);}}getSelectedLanguage(){return this.preferencesService.getVoiceLanguage()}updateRecognitionLanguage(){if(this.recognition){let e=this.getSelectedLanguage();this.recognition.lang=e,console.log("[SPEECH] Language changed to:",e);}}improveTranscriptPunctuation(e){let t=e;return /[.!?]$/.test(t.trim())||(t=t.trim()+"."),t=t.charAt(0).toUpperCase()+t.slice(1),t=t.replace(/\s+/g," "),t=t+" ",t}appendToTextarea(e){let t=this.message;if(this.message=t?`${t}${e}`:e,this.messageInput?.nativeElement){this.messageInput.nativeElement.focus();let n=this.message.length;this.messageInput.nativeElement.setSelectionRange(n,n);}setTimeout(()=>this.adjustTextareaHeight(),0);}schedulePendingLineBreaks(){this.clearPendingLineBreaks(),this.pendingLineBreaksTimeout=window.setTimeout(()=>{this.sessionHadTranscript&&(console.log("[SPEECH] Adding line breaks after transcript session"),this.appendToTextarea(`
1
+ import {f}from'./chunk-5I4m0Psa.js';import {G as Ge,$,K as Ke,E as Et,y as yt$2}from'./chunk-DxenqkEz.js';import {U as Ue$1,x as x$1,i as is}from'./chunk-C87Bh3Ov.js';import {al as yt,an as ce,g,ay as O,F,L,az as Qt,U,N,h as he,G,ap as Vy,ae as Ot,aA as sn,av as dt$1,A as Aw,i as hr$1,aB as fr$1,aC as Cu,v as vs,l as Ag,n as eC,k as fl,X as XE,r as Tg,t as tC,D as Fg,I as IC,E as wC,P as P$1,aD as Ly,Y as x,a9 as dC,ai as Jg,aa as If,aj as KC,ab as wf,a3 as HI,y as Hg,ak as Xg,a6 as $I,B as dE,J as dy,S as ha,aE as A,u as ue,a7 as ga,aF as me$1,H as Hi$1,m as mT,z as z$1,a as P$2,aG as z,b as U$1,aH as TS,q as oC,x as iC,aI as Tr$1,aJ as Nb,am as Gm,j as Gn$1,W as WC,aK as Do$1,aL as qn$1,aM as Nn$1,aN as wt$1,aO as G$1,aP as $a,aQ as As,aR as K,aS as Ut,aT as Ue,aU as U$2,aV as w,aW as D,aX as ft$1,aY as ks,aZ as YT,ac as mC,a_ as XC,a$ as Yg,a5 as yl,o as bg,ah as rT,b0 as An,b1 as Ob,b2 as bb,b3 as oT,b4 as nT,aw as pl,b5 as Sg,ax as hl,a8 as Zg,c as ce$1,b6 as u,b7 as B,b8 as T$1,b9 as v,ba as m,bb as R,bc as h,bd as A$1,be as aT,bf as uT,C as Cg,bg as Hy,p as pr$1,bh as lT,bi as aE,bj as yh}from'./main-XVJVH4GF.js';import {s}from'./chunk-D4D8VOP2.js';import {d}from'./chunk-XynH5Ted.js';import {S as Se$1,P as Pn}from'./chunk--Cv5Auvq.js';import {u as ui$1,m as mt$1,p as pt$1,Z,V as Ve}from'./chunk-drd9oaGN.js';import {y as yt$1,w as wt,t as ti$1,Y as Ye,Z as Zn$1,c as cn}from'./chunk-DL6rhSDN.js';var et=class i{sanitizer=g(TS);transform(e,t){if(!t||!e)return e;let n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`(${n})`,"gi"),r=e.replace(o,"<strong>$1</strong>");return this.sanitizer.bypassSecurityTrustHtml(r)}static \u0275fac=function(t){return new(t||i)};static \u0275pipe=An({name:"highlight",type:i,pure:true})};var fe=class i{http=g(dy);projectState=g(P$1);threadState=g(U);transcribeAudio(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow();return this.http.post(`/api/projects/${o}/transcribe`,P$2({audio:e,mimeType:t},n?{language:n}:{}))}sendVoiceMessage(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow(),r=this.threadState.getSelectedThreadIdOrThrow();return this.http.post(`/api/projects/${o}/threads/${r}/voice-message`,P$2({audio:e,mimeType:t},n?{language:n}:{}))}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};var _i=["messageInput"],xi=["fileInput"],yi=(i,e)=>e.name;function wi(i,e){i&1&&(vs(0,"div",3),bg(1,"span",8),WC(2," Recording... Click mic to stop "),fl());}function Ti(i,e){i&1&&(vs(0,"div",3),bg(1,"span",9),WC(2," Transcribing... "),fl());}function Si(i,e){if(i&1&&(vs(0,"span",14),WC(1),fl()),i&2){let t=mC().$implicit,n=mC(2);XE(),Zg(" "+(n.getParameterFormat(t)||""));}}function Mi(i,e){if(i&1){let t=dC();vs(0,"div",11),Ag("click",function(){let o=If(t).$index,r=mC(2);return wf(r.selectAutocompleteItemByClick(o))})("keydown.enter",function(){let o=If(t).$index,r=mC(2);return wf(r.selectAutocompleteItemByClick(o))})("keydown.space",function(){let o=If(t).$index,r=mC(2);return wf(r.selectAutocompleteItemByClick(o))})("mouseenter",function(){let o=If(t).$index,r=mC(2);return wf(r.selectedAutocompleteIndex=o)}),vs(1,"div",12),bg(2,"span",13),aT(3,"highlight"),eC(4,Si,2,1,"span",14),fl(),bg(5,"div",15),aT(6,"highlight"),fl();}if(i&2){let t=e.$implicit,n=e.$index,o=mC(2);Hg("selected",n===o.selectedAutocompleteIndex),Cg("aria-selected",n===o.selectedAutocompleteIndex),XE(2),Tg("innerHTML",lT(3,6,o.autocompleteTrigger+t.name,o.getAutocompleteQuery()),aE),XE(2),tC(o.hasParameterFormat(t)?4:-1),XE(),Tg("innerHTML",lT(6,9,t.description,o.getAutocompleteQuery()),aE);}}function Ei(i,e){if(i&1&&(vs(0,"div",4),oC(1,Mi,7,12,"div",10,yi),fl()),i&2){let t=mC();XE(),iC(t.autocompleteItems);}}function Oi(i,e){if(i&1){let t=dC();vs(0,"ds-icon-button",18),Ag("action",function(){If(t);let o=mC(2);return wf(o.onStopClick())}),fl();}}function Pi(i,e){if(i&1){let t=dC();vs(0,"ds-icon-button",19),Ag("action",function(){If(t);let o=mC(2);return wf(o.sendMessage())}),fl();}if(i&2){let t=mC(2);Hg("hidden",t.isDisabled||!t.message.trim())("active",!!t.message.trim()&&!t.isDisabled),Tg("title",t.getSendButtonTooltip())("disabled",t.isDisabled||!t.message.trim());}}function ki(i,e){if(i&1){let t=dC();vs(0,"ds-icon-button",21),Ag("action",function(){If(t);let o=mC(3);return wf(o.triggerFileUpload())}),fl(),vs(1,"input",22,1),Ag("change",function(o){If(t);let r=mC(3);return wf(r.onFileInputChange(o))}),fl();}if(i&2){let t=mC(3);Tg("disabled",t.isDisabled);}}function Ii(i,e){if(i&1){let t=dC();eC(0,ki,3,1),vs(1,"ds-icon-button",20),Ag("action",function(){If(t);let o=mC(2);return wf(o.toggleRecording())}),fl();}if(i&2){let t=mC(2);tC(!t.showWelcome&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?0:-1),XE(),Hg("hidden",t.message.trim()&&!t.isRecording&&!t.isTranscribing),Tg("variant",t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing)?"danger":"default")("disabled",t.isVoiceMessageMode&&t.isTranscribing)("title",t.isRecording?"Click to stop recording":t.isTranscribing?"Uploading...":"Click to start recording");}}function Di(i,e){if(i&1&&(vs(0,"div",7),eC(1,Oi,1,0,"ds-icon-button",16),eC(2,Pi,1,6,"ds-icon-button",17),eC(3,Ii,2,6),fl()),i&2){let t=mC();XE(),tC(t.isThinking?1:-1),XE(),tC((!t.isThinking||t.message.trim())&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?2:-1),XE(),tC(t.isThinking?-1:3);}}var tt=class i{isDisabled=false;showWelcome=false;isThinking=false;isStarting=false;isSessionInitializing=false;isStopping=false;filesPasted=new yt;messageSubmitted=new yt;voiceMessageReady=new yt;voiceRecordingToggled=new yt;heightChanged=new yt;stopRequested=new yt;textareaFocused=new yt;messageInput;fileInput;message="";isRecording=false;isTranscribing=false;isFocused=false;recognition=null;mediaRecorder=null;audioChunks=[];voiceInputMode="browser";get isVoiceMessageMode(){return this.voiceInputMode==="voice-message"}sessionHadTranscript=false;pendingLineBreaksTimeout=null;lastProcessedResultIndex=0;useEnterToSend=false;currentInvite="";subscriptions=[];thinkingPhrases=["Processing request...","Thinking...","Working on it..."];currentThinkingPhrase="Processing request...";thinkingPhraseIndex=0;thinkingInterval=null;autocompleteVisible=false;autocompleteTrigger=null;autocompleteItems=[];selectedAutocompleteIndex=0;preferencesService=g(L);codayService=g(Ge);agentApiService=g(f);promptApiService=g(d);projectStateService=g(P$1);audioApiService=g(fe);threadStateService=g(U);ngOnInit(){this.initializeVoiceInput(),this.useEnterToSend=this.preferencesService.getEnterToSend(),this.subscriptions.push(this.preferencesService.voiceLanguage$.subscribe(()=>this.updateRecognitionLanguage())),this.subscriptions.push(this.preferencesService.voiceInputMode$.subscribe(e=>{this.voiceInputMode=e;})),this.subscriptions.push(this.preferencesService.enterToSend$.subscribe(e=>{this.useEnterToSend=e;})),this.subscribeToInviteEvents(),this.subscribeToMessageRestore();}ngAfterViewInit(){this.adjustTextareaHeight(),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),200);});}ngOnChanges(e){e.isThinking&&(e.isThinking.currentValue?this.startThinkingAnimation():(this.stopThinkingAnimation(),this.isStopping=false,e.isThinking.previousValue&&(console.log("[CHAT-TEXTAREA] Thinking ended, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100);})))),e.isSessionInitializing&&!e.isSessionInitializing.currentValue&&e.isSessionInitializing.previousValue&&(console.log("[CHAT-TEXTAREA] Session initialization completed, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100);})),e.isStarting&&!e.isStarting.currentValue&&e.isStarting.previousValue&&this.isThinking&&(this.thinkingPhraseIndex===0?(console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index 0 - restarting animation"),this.stopThinkingAnimation(),this.startThinkingAnimation()):console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index",this.thinkingPhraseIndex,"- continuing without restart"));}ngOnDestroy(){this.subscriptions.forEach(e=>e.unsubscribe()),this.subscriptions=[],this.clearPendingLineBreaks(),this.stopThinkingAnimation();}onKeyDown(e){if(this.autocompleteVisible)switch(e.key){case "ArrowDown":e.preventDefault(),this.selectedAutocompleteIndex=Math.min(this.selectedAutocompleteIndex+1,this.autocompleteItems.length-1),this.scrollSelectedItemIntoView();return;case "ArrowUp":e.preventDefault(),this.selectedAutocompleteIndex=Math.max(this.selectedAutocompleteIndex-1,0),this.scrollSelectedItemIntoView();return;case "Tab":case "Enter":if(!this.message.includes(" ")){e.preventDefault(),this.selectAutocompleteItem();return}break;case "Escape":e.preventDefault(),this.hideAutocomplete();return}e.key==="Enter"&&(this.useEnterToSend?!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(e.preventDefault(),this.sendMessage(true)):(navigator.platform.toLowerCase().includes("mac")?e.metaKey:e.ctrlKey)&&!e.shiftKey&&(e.preventDefault(),this.sendMessage(true)));}onInput(){this.adjustTextareaHeight(),this.checkForAutocomplete();}onPaste(e){let t=e.clipboardData?.items;if(!t)return;let n=Array.from(t).filter(r=>r.kind==="file");if(!n.length)return;e.preventDefault();let o=n.reduce((r,d)=>{let v=d.getAsFile();return v?[...r,v]:r},[]);o.length&&this.filesPasted.emit(o);}triggerFileUpload(){console.log("[CHAT-TEXTAREA] Triggering file upload"),this.fileInput?.nativeElement?.click();}onFileInputChange(e){let t=e.target,n=t.files;if(!n||n.length===0){console.log("[CHAT-TEXTAREA] No files selected");return}console.log("[CHAT-TEXTAREA] Files selected:",n.length);let o=Array.from(n);this.filesPasted.emit(o),t.value="";}onDocumentClick(e){if(!this.autocompleteVisible)return;let t=e.target,n=document.querySelector(".autocomplete-popup"),o=this.messageInput?.nativeElement;n&&!n.contains(t)&&o&&!o.contains(t)&&this.hideAutocomplete();}sendMessage(e=false){let t=this.message.trim();!this.isDisabled&&(e||t)&&(this.isRecording&&this.recognition&&(this.clearPendingLineBreaks(),this.recognition.stop()),this.messageSubmitted.emit(t),this.message="",setTimeout(()=>this.adjustTextareaHeight(),0));}onStopClick(){this.isStopping=true,this.stopRequested.emit();}toggleRecording(){this.isRecording?this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.stopWhisperRecording():this.stopRecording():this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.startWhisperRecording():this.startRecording();}startWhisperRecording(){return dt$1(this,null,function*(){if(!this.isRecording)try{let e=yield navigator.mediaDevices.getUserMedia({audio:!0});this.audioChunks=[],this.mediaRecorder=new MediaRecorder(e),this.mediaRecorder.ondataavailable=t=>{t.data.size>0&&this.audioChunks.push(t.data);},this.mediaRecorder.onstop=()=>{e.getTracks().forEach(t=>t.stop()),this.processWhisperAudio();},this.mediaRecorder.onerror=t=>{console.error("[WHISPER] MediaRecorder error:",t),e.getTracks().forEach(n=>n.stop()),this.isRecording=!1,this.voiceRecordingToggled.emit(!1);},this.mediaRecorder.start(),this.isRecording=!0,this.voiceRecordingToggled.emit(!0),console.log("[WHISPER] Started recording");}catch(e){console.error("[WHISPER] Failed to start recording:",e),this.isRecording=false,this.voiceRecordingToggled.emit(false);}})}stopWhisperRecording(){if(!(!this.mediaRecorder||!this.isRecording))try{this.mediaRecorder.stop(),this.isRecording=!1,this.voiceRecordingToggled.emit(!1),console.log("[WHISPER] Stopped recording");}catch(e){console.error("[WHISPER] Failed to stop recording:",e),this.isRecording=false,this.voiceRecordingToggled.emit(false);}}processWhisperAudio(){if(this.audioChunks.length===0)return;let e=new Blob(this.audioChunks,{type:this.mediaRecorder?.mimeType||"audio/webm"}),t=e.type.split(";")[0]||"audio/webm";this.audioChunks=[],this.isTranscribing=true;let n=new FileReader;n.onloadend=()=>{let o=n.result.split(",")[1];if(!o){console.error("[WHISPER] Failed to read audio as base64"),this.isTranscribing=false;return}let d=this.preferencesService.getVoiceLanguage().split("-")[0];if(this.voiceInputMode==="voice-message"){if(!this.threadStateService.getSelectedThreadId()){console.log("[WHISPER] No thread selected \u2014 emitting voiceMessageReady for thread creation"),this.isTranscribing=false,this.voiceMessageReady.emit({base64:o,mimeType:t,language:d});return}this.audioApiService.sendVoiceMessage(o,t,d).subscribe({next:v=>{this.isTranscribing=false,console.log("[WHISPER] Voice message sent, transcription:",v.transcription?.substring(0,50));},error:v=>{console.error("[WHISPER] Voice message error:",v),this.isTranscribing=false,this.fallbackToTranscription(o,t,d);}});}else this.audioApiService.transcribeAudio(o,t,d).subscribe({next:v=>{this.isTranscribing=false,v.text&&this.appendToTextarea(v.text+" ");},error:v=>{console.error("[WHISPER] Transcription error:",v),this.isTranscribing=false;}});},n.readAsDataURL(e);}fallbackToTranscription(e,t,n){this.audioApiService.transcribeAudio(e,t,n).subscribe({next:o=>{this.isTranscribing=false,o.text&&this.appendToTextarea(o.text+" ");},error:o=>{console.error("[WHISPER] Fallback transcription also failed:",o),this.isTranscribing=false;}});}initializeVoiceInput(){let e=window.SpeechRecognition??window.webkitSpeechRecognition;if(console.log("[SPEECH] speechRecognition",e),!e){console.warn("[SPEECH] Speech Recognition API not available");return}this.recognition=new e,this.recognition.continuous=true,this.recognition.interimResults=true,this.recognition.maxAlternatives=1,this.recognition.lang=this.getSelectedLanguage();try{"grammars"in this.recognition&&(this.recognition.serviceURI=void 0);}catch(t){console.log("[SPEECH] Advanced speech recognition parameters not supported");}this.recognition.onresult=t=>{let n="",o=Math.max(t.resultIndex,this.lastProcessedResultIndex);for(let r=o;r<t.results.length;r++)t.results[r].isFinal&&(n+=t.results[r][0].transcript,this.lastProcessedResultIndex=r+1);if(n){let r=this.improveTranscriptPunctuation(n.trim());this.sessionHadTranscript=true,console.log("[SPEECH] onresult ending, appending to textarea",this.isRecording),this.appendToTextarea(r);}},this.recognition.onend=()=>{console.log("[SPEECH] Recognition ended. Was recording:",this.isRecording),this.isRecording=false,this.lastProcessedResultIndex=0,this.voiceRecordingToggled.emit(this.isRecording);},this.recognition.onerror=t=>{console.error("[SPEECH] Speech recognition error:",t.error),console.log("[SPEECH] Error details:",{error:t.error,message:t.message,timeStamp:t.timeStamp}),this.isRecording=false,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording);},this.recognition.onstart=()=>{console.log("[SPEECH] Recognition started successfully");},this.recognition.onspeechstart=()=>{console.log("[SPEECH] Speech detected");},this.recognition.onspeechend=()=>{console.log("[SPEECH] Speech ended");};}startRecording(){return dt$1(this,null,function*(){if(!(!this.recognition||this.isRecording))try{this.isRecording=!0,this.sessionHadTranscript=!1,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording),this.recognition.start(),console.log("[SPEECH] Started recording");}catch(e){console.error("[SPEECH] Failed to start recording:",e),this.isRecording=false,this.voiceRecordingToggled.emit(this.isRecording);}})}stopRecording(){if(!this.recognition||!this.isRecording){console.log("[SPEECH] stopRecording not recording");return}try{console.log("[SPEECH] stopRecording recognition stop"),this.recognition.stop(),this.schedulePendingLineBreaks();}catch(e){console.error("[SPEECH] Failed to stop recording:",e);}}getSelectedLanguage(){return this.preferencesService.getVoiceLanguage()}updateRecognitionLanguage(){if(this.recognition){let e=this.getSelectedLanguage();this.recognition.lang=e,console.log("[SPEECH] Language changed to:",e);}}improveTranscriptPunctuation(e){let t=e;return /[.!?]$/.test(t.trim())||(t=t.trim()+"."),t=t.charAt(0).toUpperCase()+t.slice(1),t=t.replace(/\s+/g," "),t=t+" ",t}appendToTextarea(e){let t=this.message;if(this.message=t?`${t}${e}`:e,this.messageInput?.nativeElement){this.messageInput.nativeElement.focus();let n=this.message.length;this.messageInput.nativeElement.setSelectionRange(n,n);}setTimeout(()=>this.adjustTextareaHeight(),0);}schedulePendingLineBreaks(){this.clearPendingLineBreaks(),this.pendingLineBreaksTimeout=window.setTimeout(()=>{this.sessionHadTranscript&&(console.log("[SPEECH] Adding line breaks after transcript session"),this.appendToTextarea(`
2
2
 
3
3
  `),this.sessionHadTranscript=false),this.pendingLineBreaksTimeout=null;},500);}clearPendingLineBreaks(){this.pendingLineBreaksTimeout&&(clearTimeout(this.pendingLineBreaksTimeout),this.pendingLineBreaksTimeout=null);}adjustTextareaHeight(){let e=this.messageInput?.nativeElement;if(!e)return;let t=e.parentElement?.offsetHeight??e.offsetHeight+32;this.heightChanged.emit(t);}getSendButtonShortcut(){return this.useEnterToSend?"Enter":navigator.platform.toLowerCase().includes("mac")?"\u2318+Enter":"Ctrl+Enter"}getSendButtonTooltip(){return this.useEnterToSend?"Send message (Enter) - Shift+Enter for new line":`Send message (${navigator.platform.toLowerCase().includes("mac")?"Cmd+Enter":"Ctrl+Enter"}) - Enter for new line`}getPlaceholder(){return this.isSessionInitializing?"Initializing session...":this.isThinking?this.isStopping?"Stopping...":this.isStarting?"Processing request...":this.currentThinkingPhrase:this.isVoiceMessageMode&&this.isTranscribing?"Uploading...":this.isVoiceMessageMode&&this.isRecording?"Listening...":this.showWelcome?"How can I help you today?":"Type '@' for agents, '/' for commands, or just your message..."}startThinkingAnimation(){this.thinkingPhraseIndex=0,this.currentThinkingPhrase=this.thinkingPhrases[0]??"Thinking...",this.thinkingInterval=window.setInterval(()=>{this.thinkingPhraseIndex<this.thinkingPhrases.length-1&&(this.thinkingPhraseIndex++,this.currentThinkingPhrase=this.thinkingPhrases[this.thinkingPhraseIndex]??"Thinking...");},2e3);}stopThinkingAnimation(){this.thinkingInterval&&(clearInterval(this.thinkingInterval),this.thinkingInterval=null),this.thinkingPhraseIndex=0,this.currentThinkingPhrase="Thinking...";}subscribeToInviteEvents(){this.subscriptions.push(this.codayService.currentInviteEvent$.subscribe(e=>{e?this.handleInviteEvent(e.invite,e.defaultValue):this.currentInvite="";}));}handleInviteEvent(e,t){this.currentInvite=e,t&&(this.message=t,setTimeout(()=>this.adjustTextareaHeight(),0)),setTimeout(()=>{this.messageInput?.nativeElement&&this.messageInput.nativeElement.focus();},50);}subscribeToMessageRestore(){this.subscriptions.push(this.codayService.messageToRestore$.subscribe(e=>{e.trim()&&(console.log("[CHAT-TEXTAREA] Restoring message content:",e.substring(0,50)+"..."),this.restoreMessageContent(e));}));}restoreMessageContent(e){this.message=e,this.messageInput?.nativeElement&&(this.messageInput.nativeElement.focus(),setTimeout(()=>{let t=this.messageInput.nativeElement,n=this.message.length;t.setSelectionRange(n,n);},0)),setTimeout(()=>this.adjustTextareaHeight(),10);}focusTextarea(){let e=this.messageInput?.nativeElement;console.log("[CHAT-TEXTAREA] focusTextarea called",{hasElement:!!e,isDisabled:this.isDisabled,isThinking:this.isThinking,elementDisabled:e?.disabled,isSessionInitializing:this.isSessionInitializing}),e&&!e.disabled?(e.focus(),console.log("[CHAT-TEXTAREA] Textarea focused successfully")):console.log("[CHAT-TEXTAREA] Focus blocked - element disabled or not available");}checkForAutocomplete(){let e=this.message;if(e.startsWith("@")){let t=e.substring(1);if(t.includes(" ")){this.hideAutocomplete();return}this.showAgentAutocomplete(t);return}if(e.startsWith("/")){let t=e.substring(1);if(t.includes(" ")){this.hideAutocomplete();return}this.showPromptAutocomplete(t);return}this.hideAutocomplete();}showAgentAutocomplete(e){this.autocompleteTrigger="@";try{let t=this.projectStateService.getSelectedProjectIdOrThrow();this.agentApiService.getAgentsAutocomplete(t,e).subscribe({next:n=>{this.autocompleteItems=n,this.autocompleteVisible=n.length>0,this.selectedAutocompleteIndex=0;},error:n=>{console.error("[AUTOCOMPLETE] Error loading agents:",n),this.hideAutocomplete();}});}catch(t){console.warn("[AUTOCOMPLETE] No project selected, cannot load agents"),this.hideAutocomplete();}}showPromptAutocomplete(e){this.autocompleteTrigger="/";try{let t=this.projectStateService.getSelectedProjectIdOrThrow();this.promptApiService.getPromptsAutocomplete(t,e).subscribe({next:n=>{this.autocompleteItems=n,this.autocompleteVisible=n.length>0,this.selectedAutocompleteIndex=0;},error:n=>{console.error("[AUTOCOMPLETE] Error loading prompts:",n),this.hideAutocomplete();}});}catch(t){console.warn("[AUTOCOMPLETE] No project selected, cannot load prompts"),this.hideAutocomplete();}}hideAutocomplete(){this.autocompleteVisible=false,this.autocompleteItems=[],this.selectedAutocompleteIndex=0;}selectAutocompleteItem(){let e=this.autocompleteItems[this.selectedAutocompleteIndex];if(!e)return;let t=null;if(this.autocompleteTrigger==="/"){let n=e,o=n.parameterFormat;if(console.log(n),o===void 0)this.message=`/${e.name}`;else if(o==="")this.message=`/${e.name} `;else {this.message=`/${e.name} ${o}`;let r=this.message.indexOf('=""');r!==-1&&(t=r+2);}}else this.message=`@${e.name} `;this.hideAutocomplete(),setTimeout(()=>{if(this.messageInput?.nativeElement)if(this.messageInput.nativeElement.focus(),t!==null)this.messageInput.nativeElement.setSelectionRange(t,t);else {let n=this.message.length;this.messageInput.nativeElement.setSelectionRange(n,n);}},0);}selectAutocompleteItemByClick(e){this.selectedAutocompleteIndex=e,this.selectAutocompleteItem();}getAutocompleteQuery(){return this.message.substring(1).split(" ")[0]??""}getParameterFormat(e){return e.parameterFormat}hasParameterFormat(e){return this.autocompleteTrigger==="/"&&e.parameterFormat!==void 0}scrollSelectedItemIntoView(){setTimeout(()=>{let e=document.querySelector(".autocomplete-popup");if(!e)return;let t=e.querySelector(".autocomplete-item.selected");t&&t.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"});},0);}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=Aw({type:i,selectors:[["app-chat-textarea"]],viewQuery:function(t,n){if(t&1&&Fg(_i,7)(xi,5),t&2){let o;IC(o=wC())&&(n.messageInput=o.first),IC(o=wC())&&(n.fileInput=o.first);}},hostBindings:function(t,n){t&1&&Ag("paste",function(r){return n.onPaste(r)})("click",function(r){return n.onDocumentClick(r)},dE);},inputs:{isDisabled:"isDisabled",showWelcome:"showWelcome",isThinking:"isThinking",isStarting:"isStarting",isSessionInitializing:"isSessionInitializing"},outputs:{filesPasted:"filesPasted",messageSubmitted:"messageSubmitted",voiceMessageReady:"voiceMessageReady",voiceRecordingToggled:"voiceRecordingToggled",heightChanged:"heightChanged",stopRequested:"stopRequested",textareaFocused:"textareaFocused"},features:[Cu],decls:8,vars:15,consts:[["messageInput",""],["fileInput",""],[1,"chat-input-container"],[1,"recording-indicator"],[1,"autocomplete-popup"],[1,"input-row","grouped-input"],[1,"message-input",3,"ngModelChange","keydown","input","focus","blur","ngModel","placeholder","disabled"],[1,"actions"],[1,"recording-dot"],[1,"transcribing-dot"],["role","option","tabindex","0",1,"autocomplete-item",3,"selected"],["role","option","tabindex","0",1,"autocomplete-item",3,"click","keydown.enter","keydown.space","mouseenter"],[1,"item-name"],[3,"innerHTML"],[1,"parameter-format"],[1,"item-description",3,"innerHTML"],["icon","stop","variant","danger","title","Stop generation",1,"action-btn"],["icon","send","variant","primary",1,"send-btn",3,"title","disabled","hidden","active"],["icon","stop","variant","danger","title","Stop generation",1,"action-btn",3,"action"],["icon","send","variant","primary",1,"send-btn",3,"action","title","disabled"],["icon","mic",1,"voice-btn",3,"action","variant","disabled","title"],["icon","attach_file","variant","default","title","Upload files (images or documents)",1,"upload-btn",3,"action","disabled"],["type","file","multiple","","accept","image/*,application/pdf,.pdf,.doc,.docx,.txt,.md,.json,.yaml,.yml,.csv,.xml,.html",2,"display","none",3,"change"]],template:function(t,n){if(t&1){let o=dC();vs(0,"div",2),eC(1,wi,3,0,"div",3),eC(2,Ti,3,0,"div",3),eC(3,Ei,3,0,"div",4),vs(4,"div",5)(5,"textarea",6,0),Jg("ngModelChange",function(d){return If(o),KC(n.message,d)||(n.message=d),wf(d)}),Ag("keydown",function(d){return n.onKeyDown(d)})("input",function(){return n.onInput()})("focus",function(){return If(o),n.isFocused=true,wf(n.textareaFocused.emit())})("blur",function(){return n.isFocused=false}),fl(),HI(),eC(7,Di,4,3,"div",7),fl()();}t&2&&(XE(),tC(!n.isVoiceMessageMode&&n.isRecording?1:-1),XE(),tC(!n.isVoiceMessageMode&&n.isTranscribing?2:-1),XE(),tC(n.autocompleteVisible?3:-1),XE(),Hg("focused",n.isFocused)("welcome-mode",n.showWelcome)("is-thinking",n.isThinking)("is-listening",n.isVoiceMessageMode&&(n.isRecording||n.isTranscribing)),XE(),Xg("ngModel",n.message),Tg("placeholder",n.getPlaceholder())("disabled",n.isDisabled||n.isVoiceMessageMode&&(n.isRecording||n.isTranscribing)),$I(),XE(2),tC(n.isSessionInitializing?-1:7));},dependencies:[ti$1,Ye,Zn$1,cn,Se$1,et],styles:['@keyframes _ngcontent-%COMP%_gradientBorderShift{0%{background-position:0 0}50%{background-position:100% 0}to{background-position:0 0}}.chat-input-container[_ngcontent-%COMP%]{flex-shrink:0;width:100%;position:relative}.thinking-progress[_ngcontent-%COMP%]{position:absolute;top:0;left:0;right:0;height:3px;z-index:1}.thinking-progress[_ngcontent-%COMP%] .mdc-linear-progress__bar-inner{border-top-width:3px}.input-row.grouped-input[_ngcontent-%COMP%]{display:flex;align-items:stretch;background:var(--glass-bg);border-radius:16px;padding:0 .15rem 0 1.25rem;position:relative;transition:border-color .2s,box-shadow .2s,background .3s}.input-row[_ngcontent-%COMP%]{position:relative;background:var(--glass-bg, #1e1e1e)!important;background-clip:padding-box}.input-row[_ngcontent-%COMP%]:before{content:"";position:absolute;inset:-2px;border-radius:inherit;background-size:200% 100%;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);-webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);-webkit-mask-composite:xor;mask-composite:exclude;padding:1px;pointer-events:none;z-index:-1;animation:_ngcontent-%COMP%_gradientBorderShift 3s ease-in-out infinite}.input-row.is-listening[_ngcontent-%COMP%]:before{inset:0;-webkit-mask:none;mask:none;padding:0;opacity:.15;z-index:0;background:linear-gradient(90deg,var(--color-error, #ef4444) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-error, #ef4444) 100%);background-size:200% 100%;animation:_ngcontent-%COMP%_gradientBorderShift 2s ease-in-out infinite}.input-row.is-listening[_ngcontent-%COMP%] .message-input[_ngcontent-%COMP%], .input-row.is-listening[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%]{position:relative;z-index:1}.input-row.is-thinking[_ngcontent-%COMP%]:before{inset:0;-webkit-mask:none;mask:none;padding:0;opacity:.15;z-index:0;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% 100%;animation:_ngcontent-%COMP%_gradientBorderShift 3s ease-in-out infinite}.input-row.is-thinking[_ngcontent-%COMP%] .message-input[_ngcontent-%COMP%], .input-row.is-thinking[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%]{position:relative;z-index:1}.input-row.grouped-input.focused[_ngcontent-%COMP%]:not(.is-thinking):before{background:var(--color-primary);animation:none}.input-row.grouped-input.focused[_ngcontent-%COMP%]:not(.is-thinking){box-shadow:0 0 0 4px #007aff1a}.message-input[_ngcontent-%COMP%]{flex:1;border:none;outline:none;background:transparent!important;box-shadow:none;font-size:1rem;padding:1rem 0;color:var(--color-text);resize:none;field-sizing:content;min-height:36px;max-height:70vh;overflow-y:auto;font-family:-apple-system,BlinkMacSystemFont,SF Pro Display,system-ui,sans-serif;line-height:1.5}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar{width:8px}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:transparent}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:var(--color-border);border-radius:4px}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:var(--color-text-secondary)}.message-input[_ngcontent-%COMP%]:focus{outline:none;border:none;box-shadow:none}.message-input[_ngcontent-%COMP%]:disabled{background-color:var(--color-bg-secondary);color:var(--color-text-secondary);cursor:not-allowed;opacity:.6}.message-input[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary);transition:opacity .3s ease-in-out}.message-input[_ngcontent-%COMP%]:disabled::placeholder{animation:_ngcontent-%COMP%_thinkingPulsate 2s ease-in-out infinite}@keyframes _ngcontent-%COMP%_thinkingPulsate{0%,to{opacity:.6}50%{opacity:1}}.voice-btn[_ngcontent-%COMP%], .send-btn[_ngcontent-%COMP%], .action-btn[_ngcontent-%COMP%], .upload-btn[_ngcontent-%COMP%]{margin:0}.actions[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex-wrap:wrap;justify-content:center}.send-btn[_ngcontent-%COMP%]{transition:opacity .4s,margin-left .4s}.send-btn.active[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{opacity:1}.send-btn[_ngcontent-%COMP%]:not(.active) button[_ngcontent-%COMP%]{opacity:0;margin-left:calc(-.5rem - 36px)}.send-btn[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover:not(:disabled){color:#fff;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-primary, #3b82f6) 20%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 80%,var(--color-primary, #3b82f6) 100%);background-size:300% auto;animation:sendButtonGradientShift 6s ease-in-out infinite;box-shadow:0 4px 14px #007aff30;transform:scale(1.2)}.send-btn[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:active:not(:disabled){transform:scale(1.3);box-shadow:0 4px 24px #007aff30}.recording-indicator[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-top:.2rem;margin-bottom:.2rem;color:var(--color-error, #ff5555);font-size:.9rem;position:absolute;top:-1.5rem}@keyframes _ngcontent-%COMP%_pulse{0%,to{opacity:1}50%{opacity:.5}}.autocomplete-popup[_ngcontent-%COMP%]{position:absolute;bottom:100%;left:0;right:0;margin-bottom:.5rem;background:var(--glass-bg);-webkit-backdrop-filter:var(--glass-backdrop-blur);backdrop-filter:var(--glass-backdrop-blur);border-radius:12px;box-shadow:0 8px 32px #00000026;border:1px solid var(--color-border);max-height:400px;max-width:500px;overflow-y:auto;z-index:100}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar{width:8px}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:transparent}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:var(--color-border);border-radius:4px}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:var(--color-text-secondary)}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%]{padding:.75rem 1rem;cursor:pointer;transition:background .2s;border-left:3px solid transparent}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%]:hover, .autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item.selected[_ngcontent-%COMP%]{background:var(--color-bg-hover)}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item.selected[_ngcontent-%COMP%]{border-left-color:var(--color-primary)}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-name[_ngcontent-%COMP%]{font-weight:600;color:var(--color-text);margin-bottom:.25rem;font-family:SF Mono,Monaco,Menlo,Cascadia Code,Consolas,monospace;font-size:.95rem}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-name[_ngcontent-%COMP%] strong{font-weight:700;color:var(--color-primary);background:var(--color-primary-light, rgba(99, 102, 241, .1));padding:0 2px;border-radius:2px}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-name[_ngcontent-%COMP%] .parameter-format[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-weight:400;opacity:.7}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-description[_ngcontent-%COMP%]{font-size:.85rem;color:var(--color-text-secondary);line-height:1.3}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-description[_ngcontent-%COMP%] strong{font-weight:700;color:var(--color-primary);background:var(--color-primary-light, rgba(99, 102, 241, .1))}@media print{.thinking-progress[_ngcontent-%COMP%], .action-btn[_ngcontent-%COMP%], .voice-btn[_ngcontent-%COMP%], .send-btn[_ngcontent-%COMP%], .upload-btn[_ngcontent-%COMP%], .recording-indicator[_ngcontent-%COMP%], .autocomplete-popup[_ngcontent-%COMP%]{display:none!important}}'],changeDetection:1})};var be=class i{unreadCountSubject=new Tr$1(0);unreadCount$=this.unreadCountSubject.asObservable();constructor(){console.log("[UNREAD] Service initialized");}addUnread(){let t=this.unreadCountSubject.value+1;this.unreadCountSubject.next(t),console.log("[UNREAD] Added unread message, total:",t);}markAllAsRead(){this.unreadCountSubject.value>0&&(this.unreadCountSubject.next(0),console.log("[UNREAD] Marked all messages as read"));}getCurrentCount(){return this.unreadCountSubject.value}reset(){this.unreadCountSubject.next(0),console.log("[UNREAD] Counter reset");}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};var nt=class i{ATTENTION_EMOJI="\u{1F534}";isSystemActive=false;systemActiveTimer=null;SYSTEM_ACTIVE_TIMEOUT=4e3;unreadService=g(be);project=g(P$1);constructor(){this.initializeTitleUpdates();}initializeTitleUpdates(){Ly([this.project.selectedProject$,this.unreadService.unreadCount$]).subscribe(([e,t])=>{this.updateTitle(e?.name??"...",t);});}updateTitle(e,t){let n;this.isSystemActive?n=`\u23F3${t>0?` (${t}) `:" "}${e}`:t>0?n=`${this.ATTENTION_EMOJI} (${t}) ${e}`:n=e,document.title=n,console.log("[TAB-TITLE] Updated to:",n);}setSystemActive(){console.log("[TAB-TITLE] System active - showing hourglass"),this.isSystemActive=true,this.systemActiveTimer&&clearTimeout(this.systemActiveTimer),this.systemActiveTimer=setTimeout(()=>{console.log("[TAB-TITLE] System active timeout - hiding hourglass"),this.isSystemActive=false,this.forceUpdateTitle();},this.SYSTEM_ACTIVE_TIMEOUT),this.forceUpdateTitle();}setSystemInactive(){console.log("[TAB-TITLE] System inactive - hiding hourglass"),this.isSystemActive=false,this.systemActiveTimer&&(clearTimeout(this.systemActiveTimer),this.systemActiveTimer=null),this.forceUpdateTitle();}forceUpdateTitle(){let e=this.project.getSelectedProjectId()??"...",t=this.unreadService.getCurrentCount();this.updateTitle(e,t);}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};var it=class i{pendingFirstMessage=null;pendingVoiceMessage=null;setPendingFirstMessage(e){console.log("[FIRST-MESSAGE-STATE] Storing pending first message:",e.substring(0,50)+"..."),this.pendingFirstMessage=e;}consumePendingFirstMessage(){let e=this.pendingFirstMessage;return e?(console.log("[FIRST-MESSAGE-STATE] Consuming pending first message:",e.substring(0,50)+"..."),this.pendingFirstMessage=null):console.log("[FIRST-MESSAGE-STATE] No pending first message to consume"),e}setPendingVoiceMessage(e){console.log("[FIRST-MESSAGE-STATE] Storing pending voice message"),this.pendingVoiceMessage=e;}consumePendingVoiceMessage(){let e=this.pendingVoiceMessage;return e&&(console.log("[FIRST-MESSAGE-STATE] Consuming pending voice message"),this.pendingVoiceMessage=null),e}hasPendingFirstMessage(){return this.pendingFirstMessage!==null||this.pendingVoiceMessage!==null}clear(){this.pendingFirstMessage&&(console.log("[FIRST-MESSAGE-STATE] Clearing pending first message"),this.pendingFirstMessage=null),this.pendingVoiceMessage=null;}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};var Ai=(i,e)=>e.label;function Fi(i,e){if(i&1){let t=dC();vs(0,"button",2),Ag("click",function(o){let r=If(t).$implicit,d=mC();return wf(d.executeAction(r,o))}),vs(1,"mat-icon"),WC(2),fl()();}if(i&2){let t=e.$implicit;Cg("title",t.tooltip||t.label),XE(),Cg("aria-label",t.label),XE(),Zg(t.icon);}}var ot=class i{actions=[];executeAction(e,t){t.stopPropagation(),e.action();}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=Aw({type:i,selectors:[["app-message-context-menu"]],inputs:{actions:"actions"},decls:3,vars:0,consts:[[1,"context-menu-wrapper"],["mat-icon-button",""],["mat-icon-button","",3,"click"]],template:function(t,n){t&1&&(vs(0,"div",0),oC(1,Fi,3,3,"button",1,Ai),fl()),t&2&&(XE(),iC(n.actions));},dependencies:[Gm,Gn$1,wt],styles:[".context-menu-wrapper[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center}.context-menu-wrapper[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{transform:scale(.75)}"],changeDetection:1})};var J=class i{renderer;constructor(){this.renderer=new Ue$1,this.configureRenderer();}configureRenderer(){let e=this.renderer.link.bind(this.renderer);this.renderer.link=t=>{let n=this.isExternalLink(t.href),o=e(t);if(n){o=o.replace("<a ",'<a target="_blank" rel="noopener noreferrer" ');let r=t.title?`${t.text} - ${t.title} (opens in new tab)`:`${t.text} (opens in new tab)`;o=o.replace("<a ",`<a aria-label="${this.escapeHtml(r)}" `),o=o.replace("</a>",'<span class="external-link-icon" aria-hidden="true">\u2197</span></a>');}return o};}isExternalLink(e){if(!e||e.startsWith("/")||e.startsWith("#")||e.startsWith("?"))return false;if(e.startsWith("//"))return true;try{return new URL(e,window.location.href).hostname!==window.location.hostname}catch(t){return false}}escapeHtml(e){let t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};return e.replace(/[&<>"']/g,n=>t[n]||n)}parse(e){return dt$1(this,null,function*(){let t=yield x$1.parse(e,{renderer:this.renderer,breaks:true,gfm:true});return is.sanitize(t,{ADD_TAGS:["span"],ADD_ATTR:["aria-hidden","aria-label","target","rel"],ALLOWED_URI_REGEXP:/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))/i})})}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};var Ri=i=>({"user-message-wrapper":i});function Hi(i,e){if(i&1&&(vs(0,"div",4)(1,"div",8),WC(2),fl()()),i&2){let t=mC(2);XE(2),yl(" ",t.message.speaker," ");}}function Vi(i,e){if(i&1&&(vs(0,"time",6),WC(1),fl()),i&2){let t=mC(2);XE(),Zg(t.formattedTimestamp);}}function Li(i,e){if(i&1&&(vs(0,"div",7),bg(1,"app-message-context-menu",9),fl()),i&2){let t=mC(2);XE(),Tg("actions",t.actions);}}function zi(i,e){if(i&1&&(eC(0,Hi,3,1,"div",4),bg(1,"div",5),eC(2,Vi,2,1,"time",6),eC(3,Li,2,1,"div",7)),i&2){let t=mC();tC(t.shouldShowSpeaker?0:-1),XE(),Tg("innerHTML",t.renderedContent,aE),XE(),tC(t.formattedTimestamp?2:-1),XE(),tC(t.isLongMessage&&t.shouldShowActions&&t.message.role==="assistant"?3:-1);}}function Ni(i,e){if(i&1&&bg(0,"span",12),i&2){let t=mC(3);Tg("innerHTML",t.renderedContent,aE);}}function $i(i,e){if(i&1&&(vs(0,"span",13),WC(1),fl()),i&2){let t=mC(3);XE(),Zg(t.collapsedErrorText);}}function ji(i,e){i&1&&WC(0," Show less \u25B2 ");}function Ui(i,e){i&1&&WC(0," Show more \u25BC ");}function Bi(i,e){if(i&1){let t=dC();vs(0,"div",10),eC(1,Ni,1,1,"span",12)(2,$i,2,1,"span",13),vs(3,"button",14),Ag("click",function(){If(t);let o=mC(2);return wf(o.toggleErrorExpanded())}),eC(4,ji,1,0)(5,Ui,1,0),fl()();}if(i&2){let t=mC(2);XE(),tC(t.isErrorExpanded()?1:2),XE(3),tC(t.isErrorExpanded()?4:5);}}function Wi(i,e){i&1&&WC(0," \u25B2 ");}function qi(i,e){i&1&&WC(0," \u25BC ");}function Yi(i,e){if(i&1&&(vs(0,"a",17),WC(1,"view"),fl()),i&2){let t=mC(3);Tg("href",t.eventLink,yh);}}function Gi(i,e){if(i&1&&(vs(0,"pre",18),WC(1),fl()),i&2){let t=mC(3);XE(),Zg(t.message.fullContent);}}function Qi(i,e){if(i&1){let t=dC();vs(0,"div",15),bg(1,"span",12),vs(2,"button",16),Ag("click",function(){If(t);let o=mC(2);return wf(o.toggleTechnicalExpanded())}),eC(3,Wi,1,0)(4,qi,1,0),fl(),eC(5,Yi,2,1,"a",17),fl(),eC(6,Gi,2,1,"pre",18);}if(i&2){let t=mC(2);XE(),Tg("innerHTML",t.renderedContent,aE),XE(2),tC(t.isTechnicalExpanded()?3:4),XE(2),tC(t.eventLink?5:-1),XE(),tC(t.isTechnicalExpanded()?6:-1);}}function Xi(i,e){if(i&1&&(vs(0,"a",17),WC(1,"view"),fl()),i&2){let t=mC(3);Tg("href",t.eventLink,yh);}}function Ki(i,e){if(i&1&&(vs(0,"div",11),bg(1,"span",12),eC(2,Xi,2,1,"a",17),fl()),i&2){let t=mC(2);XE(),Tg("innerHTML",t.renderedContent,aE),XE(),tC(t.eventLink?2:-1);}}function Ji(i,e){if(i&1&&eC(0,Bi,6,2,"div",10)(1,Qi,7,4)(2,Ki,3,2,"div",11),i&2){let t=mC();tC(t.message.type==="error"&&t.isLongError?0:t.message.type==="technical"&&t.message.fullContent?1:2);}}function Zi(i,e){if(i&1&&(vs(0,"div",2),bg(1,"app-message-context-menu",9),fl()),i&2){let t=mC();XE(),Tg("actions",t.actions);}}function eo(i,e){if(i&1&&(vs(0,"div",3),bg(1,"app-message-context-menu",9),fl()),i&2){let t=mC();XE(),Tg("actions",t.actions);}}var Ce=class i{destroy$=new ce;message;canDelete=true;isOtherUser=false;containingThreadId;copyRequested=new yt;deleteRequested=new yt;renderedContent="";shouldHideTechnical=false;shouldHideWarning=false;isErrorExpanded=Hi$1(false);static ERROR_COLLAPSE_LINE_THRESHOLD=5;isTechnicalExpanded=Hi$1(false);sanitizer=g(TS);notificationService=g(s);preferencesService=g(L);projectState=g(P$1);threadState=g(U);markdownService=g(J);get messageClasses(){return {[this.message.role]:true,[this.message.type]:true,"hidden-technical":this.shouldHideTechnical&&this.message.type==="technical","hidden-warning":this.shouldHideWarning&&this.message.type==="warning","other-user":this.isOtherUser}}ngOnInit(){return dt$1(this,null,function*(){yield this.renderMarkdown(),this.preferencesService.hideTechnicalMessages$.pipe(Vy(this.destroy$)).subscribe(e=>{this.shouldHideTechnical=e;}),this.preferencesService.hideWarningMessages$.pipe(Vy(this.destroy$)).subscribe(e=>{this.shouldHideWarning=e;}),this.shouldHideTechnical=this.preferencesService.getHideTechnicalMessages(),this.shouldHideWarning=this.preferencesService.getHideWarningMessages();})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete();}get shouldShowSpeaker(){return this.message.role==="user"?this.isOtherUser||this.message.speaker.startsWith("@"):this.message.role==="assistant"}get shouldShowActions(){return this.message.role==="user"||this.message.role==="assistant"}get isSimplified(){return this.message.role!=="user"&&this.message.role!=="assistant"}datePipe=g(Ob);get formattedTimestamp(){if(this.message.role!=="user"||!this.message.timestamp)return null;let e=new Date().toDateString()===this.message.timestamp.toDateString();return this.datePipe.transform(this.message.timestamp,e?"HH:mm":"dd/MM HH:mm")}get isLongError(){return this.message.type!=="error"?false:this.extractTextContent().split(/\n|\\n/).length>i.ERROR_COLLAPSE_LINE_THRESHOLD}get collapsedErrorText(){return this.extractTextContent().split(/\n|\\n/).slice(0,i.ERROR_COLLAPSE_LINE_THRESHOLD).join(`
4
4
  `)+"\u2026"}toggleErrorExpanded(){this.isErrorExpanded.update(e=>!e);}toggleTechnicalExpanded(){this.isTechnicalExpanded.update(e=>!e);}get isLongMessage(){let e=this.extractTextContent();return e.length>1e3||e.split(`
@@ -1 +1 @@
1
- import {m}from'./chunk-CW742eC7.js';import {g,ao as V,G,w as we,d8 as M,H as Hi,b as U,a7 as ga,S as ha,z as z$1,a as P,A as Aw,v as vs,l as Ag,W as WC,k as fl,n as eC,X as XE,a5 as yl,a8 as Zg,t as tC,a9 as dC,o as bg,a3 as HI,q as oC,bn as nC,ac as mC,r as Tg,y as Hg,a6 as $I,x as iC,aa as If,ab as wf}from'./main-DXWHG4XK.js';import {o as z,z as ze,k as _t,b as _e$1,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,A as At,Z as Zn,l as Xn,C as Cn,E as En,p as An,q as Ct,V as Vt}from'./chunk-BBJc_ez4.js';import'./chunk-_PndMs0h.js';import'./chunk-RbE7PtJh.js';import'./chunk-Ckk6G7IP.js';var ne=(i,t)=>t.id;function ie(i,t){i&1&&(vs(0,"p",5),WC(1,"Loading\u2026"),fl());}function ae(i,t){i&1&&(vs(0,"span",12),WC(1,"Name is required."),fl());}function le(i,t){if(i&1&&(vs(0,"p",32),WC(1),fl(),vs(2,"span",26),WC(3,"Agent Config cannot be changed after creation."),fl()),i&2){let e=mC(3);XE(),Zg(e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function me(i,t){if(i&1&&(vs(0,"option",34),WC(1),fl()),i&2){let e=t.$implicit;Tg("ngValue",e.id),XE(),Zg(e.name);}}function pe(i,t){if(i&1&&(vs(0,"select",33)(1,"option",34),WC(2,"\u2014 None \u2014"),fl(),oC(3,me,2,2,"option",34,ne),fl(),HI(),vs(5,"span",26),WC(6,"Optional. Links this prompt to an agent as a starter. Immutable after creation."),fl()),i&2){let e=mC(3);Tg("formControl",e.agentConfigIdControl),$I(),XE(),Tg("ngValue",null),XE(2),iC(e.availableAgentConfigs());}}function de(i,t){if(i&1&&(vs(0,"div",8)(1,"label",31),WC(2,"Agent Config"),fl(),eC(3,le,4,1)(4,pe,7,2),fl()),i&2){let e=mC(2);XE(3),tC(e.isEditMode()&&e.agentConfigIdControl.value?3:e.isEditMode()?-1:4);}}function ce(i,t){i&1&&(vs(0,"p",19),WC(1,"No parameters defined."),fl());}function se(i,t){i&1&&(vs(0,"span",12),WC(1,"Parameter name is required."),fl());}function _e(i,t){if(i&1){let e=dC();vs(0,"div",20)(1,"div",35)(2,"div",36)(3,"label",37),WC(4,"Name "),vs(5,"span",10),WC(6,"*"),fl()(),bg(7,"input",38),HI(),eC(8,se,2,0,"span",12),fl(),vs(9,"div",36)(10,"label",37),WC(11,"Description"),fl(),bg(12,"input",39),HI(),fl(),vs(13,"div",36)(14,"label",37),WC(15,"Default value"),fl(),bg(16,"input",40),HI(),fl()(),vs(17,"button",41),Ag("click",function(){let m=If(e).$index,d=mC(2);return wf(d.removeParameter(m))}),WC(18," \xD7 "),fl()();}if(i&2){let e=t.$implicit,l=t.$index;Tg("formGroupName",l),XE(3),Tg("for","param-name-"+l),XE(4),Hg("prompt-form__input--invalid",e.controls.name.invalid&&e.controls.name.touched),Tg("id","param-name-"+l),$I(),XE(),tC(e.controls.name.invalid&&e.controls.name.touched?8:-1),XE(2),Tg("for","param-desc-"+l),XE(2),Tg("id","param-desc-"+l),$I(),XE(2),Tg("for","param-default-"+l),XE(2),Tg("id","param-default-"+l),$I();}}function fe(i,t){i&1&&(vs(0,"span",12),WC(1,"Content entry must not be blank."),fl());}function ue(i,t){if(i&1){let e=dC();vs(0,"div",22)(1,"span",42),WC(2),fl(),vs(3,"div",43),bg(4,"textarea",44),HI(),eC(5,fe,2,0,"span",12),fl(),vs(6,"button",45),Ag("click",function(){let m=If(e).$index,d=mC(2);return wf(d.removeContentEntry(m))}),WC(7," \xD7 "),fl()();}if(i&2){let e=t.$implicit,l=t.$index,m=mC(2);XE(2),Zg(l+1),XE(2),Hg("prompt-form__textarea--invalid",e.invalid&&e.touched),Tg("formControlName",l),$I(),XE(),tC(e.invalid&&e.touched?5:-1),XE(),Tg("disabled",m.contentArray.length===1);}}function ge(i,t){if(i&1&&(vs(0,"p",23),WC(1),fl()),i&2){let e=mC(2);XE(),Zg(e.errorMessage());}}function Ce(i,t){i&1&&(vs(0,"span",12),WC(1,"Invalid JSON."),fl());}function xe(i,t){if(i&1){let e=dC();vs(0,"button",46),Ag("click",function(){If(e);let m=mC(2);return wf(m.exportYaml())}),WC(1),fl();}if(i&2){let e=mC(2);Tg("disabled",e.isExporting()),XE(),yl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function ve(i,t){if(i&1){let e=dC();vs(0,"form",7),Ag("ngSubmit",function(){If(e);let m=mC();return wf(m.submit())}),vs(1,"div",8)(2,"label",9),WC(3,"Name "),vs(4,"span",10),WC(5,"*"),fl()(),bg(6,"input",11),HI(),eC(7,ae,2,0,"span",12),fl(),vs(8,"div",8)(9,"label",13),WC(10,"Description"),fl(),bg(11,"input",14),HI(),fl(),eC(12,de,5,1,"div",8),vs(13,"fieldset",15)(14,"legend",16),WC(15," Parameters "),vs(16,"span",17),WC(17,"Named placeholders used in content"),fl()(),vs(18,"p",18),WC(19," Each parameter must have a name and a default value. Use "),vs(20,"code"),WC(21),fl(),WC(22," in content entries to reference them. "),fl(),eC(23,ce,2,0,"p",19),oC(24,_e,19,10,"div",20,nC),vs(26,"button",21),Ag("click",function(){If(e);let m=mC();return wf(m.addParameter())}),WC(27,"+ Add parameter"),fl()(),vs(28,"fieldset",15)(29,"legend",16),WC(30," Content "),vs(31,"span",10),WC(32,"*"),fl(),vs(33,"span",17),WC(34,"Ordered list of text commands"),fl()(),vs(35,"p",18),WC(36," Each content entry is a command. Use "),vs(37,"code"),WC(38,"@AgentName"),fl(),WC(39," to target an agent, "),vs(40,"code"),WC(41,"/promptName param1 param2"),fl(),WC(42," to call another prompt, and "),vs(43,"code"),WC(44),fl(),WC(45," for parameter placeholders. "),fl(),oC(46,ue,8,6,"div",22,nC),vs(48,"button",21),Ag("click",function(){If(e);let m=mC();return wf(m.addContentEntry())}),WC(49,"+ Add content entry"),fl()(),eC(50,ge,2,1,"p",23),vs(51,"div",8)(52,"label",24),WC(53,"External Metadata"),fl(),bg(54,"textarea",25),HI(),eC(55,Ce,2,0,"span",12),vs(56,"span",26),WC(57,"Optional. Opaque JSON object stored as-is. Leave empty to clear."),fl()(),vs(58,"div",27)(59,"button",28),WC(60),fl(),eC(61,xe,2,2,"button",29),vs(62,"button",30),Ag("click",function(){If(e);let m=mC();return wf(m.cancel())}),WC(63,"Cancel"),fl()()();}if(i&2){let e=mC();Tg("formGroup",e.form),XE(6),Hg("prompt-form__input--invalid",e.nameControl.invalid&&e.nameControl.touched),Tg("formControl",e.nameControl),$I(),XE(),tC(e.nameControl.invalid&&e.nameControl.touched?7:-1),XE(4),Tg("formControl",e.descriptionControl),$I(),XE(),tC(e.availableAgentConfigs().length>0?12:-1),XE(),Tg("formArrayName","parameters"),XE(8),Zg(e.paramPlaceholderSyntax),XE(2),tC(e.parametersArray.length===0?23:-1),XE(),iC(e.parametersArray.controls),XE(4),Tg("formArrayName","content"),XE(16),Zg(e.paramPlaceholderSyntax),XE(2),iC(e.contentArray.controls),XE(4),tC(e.errorMessage()?50:-1),XE(4),Tg("formControl",e.externalMetadataJsonControl),$I(),XE(),tC(e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?55:-1),XE(4),Tg("disabled",e.form.invalid||e.isSubmitting()),XE(),yl(" ",e.isEditMode()?"Save changes":"Create"," "),XE(),tC(e.isEditMode()?61:-1);}}var re=class i{route=g(V);router=g(G);destroyRef=g(we);promptState=g(m);agentConfigController=g(M);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new z({name:new _t("",{nonNullable:true,validators:[_e$1.required,_e$1.minLength(1)]}),description:new _t(null),agentConfigId:new _t(null),externalMetadataJson:new _t("",{nonNullable:true,validators:[be]}),content:new ze([this.createContentControl()],{validators:[_e$1.required]}),parameters:new ze([])});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}get contentArray(){return this.form.controls.content}get parametersArray(){return this.form.controls.parameters}isEditMode=Hi(false);isSubmitting=Hi(false);isLoading=Hi(false);isExporting=Hi(false);errorMessage=Hi(null);paramPlaceholderSyntax="{{paramName}}";agentConfigs=Hi([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("promptId");t&&(this.isEditMode.set(true),this.loadPrompt(t)),this.isPlatformMode?this.loadPlatformAgentConfigs():this.namespaceId&&this.loadAgentConfigs(this.namespaceId);}loadPrompt(t){this.isLoading.set(true),this.promptState.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingPrompt=e,this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadAgentConfigs(t){this.agentConfigController.listByParentAgentConfig(t).pipe(U(this.destroyRef),ga(()=>ha([]))).subscribe(e=>this.agentConfigs.set(e));}loadPlatformAgentConfigs(){this.agentConfigController.listPlatformAgentsAgentConfig().pipe(U(this.destroyRef),ga(()=>ha([]))).subscribe(t=>this.agentConfigs.set(t));}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId??null),this.contentArray.clear(),(t.content.length>0?t.content:[""]).forEach(l=>this.contentArray.push(this.createContentControl(l))),this.parametersArray.clear(),(t.parameters??[]).forEach(l=>this.parametersArray.push(this.createParameterGroup(l))),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}createContentControl(t=""){return new _t(t,{nonNullable:true,validators:[_e$1.required,_e$1.pattern(/\S/)]})}addContentEntry(){this.contentArray.push(this.createContentControl());}removeContentEntry(t){this.contentArray.length>1&&this.contentArray.removeAt(t);}createParameterGroup(t){return new z({name:new _t(t?.name??"",{nonNullable:true,validators:[_e$1.required,_e$1.minLength(1)]}),description:new _t(t?.description??null),defaultValue:new _t(t?.defaultValue??"",{nonNullable:true,validators:[_e$1.required]})})}addParameter(){this.parametersArray.push(this.createParameterGroup());}removeParameter(t){this.parametersArray.removeAt(t);}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=z$1(P({},this.existingPrompt??{}),{namespaceId:this.namespaceId,sourceLanguage:this.existingPrompt?.sourceLanguage??"en",name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,content:this.contentArray.controls.map(d=>d.value.trim()),parameters:this.parametersArray.controls.map(d=>({name:d.controls.name.value.trim(),description:d.controls.description.value?.trim()||void 0,defaultValue:d.controls.defaultValue.value.trim()}))});t||(e.agentConfigId=this.agentConfigIdControl.value||null);let l=this.externalMetadataJsonControl.value.trim();e.externalMetadata=l?JSON.parse(l):null;let m=t?this.promptState.update(this.existingPrompt.id,e):this.promptState.create(e);this.errorMessage.set(null),m.pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:d=>{this.isSubmitting.set(false),d.status===409?this.errorMessage.set(`A prompt named "${e.name}" already exists in this scope.`):d.status===400?this.errorMessage.set(d.error?.message??"Invalid prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}exportYaml(){let t=this.existingPrompt?.id;!t||this.isExporting()||(this.isExporting.set(true),this.promptState.exportAsYaml(t).pipe(U(this.destroyRef)).subscribe({next:e=>{let l=new Blob([e],{type:"application/yaml"}),m=URL.createObjectURL(l),d=document.createElement("a");d.href=m,d.download=`${this.existingPrompt?.name??"prompt"}.yaml`,d.click(),URL.revokeObjectURL(m),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","prompts"]):this.router.navigate(["/agentos",this.namespaceId,"prompts"]);}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=Aw({type:i,selectors:[["agentos-prompt-form"]],decls:10,vars:3,consts:[[1,"prompt-form"],[1,"prompt-form__header"],["type","button","title","Back to prompts",1,"prompt-form__back",3,"click"],[1,"prompt-form__back-icon"],[1,"prompt-form__title"],[1,"prompt-form__loading"],[1,"prompt-form__form",3,"formGroup"],[1,"prompt-form__form",3,"ngSubmit","formGroup"],[1,"prompt-form__field"],["for","prompt-name",1,"prompt-form__label"],["aria-hidden","true"],["id","prompt-name","type","text","placeholder","e.g. Summarise meeting notes","autocomplete","off",1,"prompt-form__input",3,"formControl"],[1,"prompt-form__field-error"],["for","prompt-description",1,"prompt-form__label"],["id","prompt-description","type","text","placeholder","Optional \u2014 short description of this prompt","autocomplete","off",1,"prompt-form__input",3,"formControl"],[1,"prompt-form__section",3,"formArrayName"],[1,"prompt-form__label"],[1,"prompt-form__label-hint"],[1,"prompt-form__section-hint"],[1,"prompt-form__empty-hint"],[1,"prompt-form__param-row",3,"formGroupName"],["type","button",1,"prompt-form__add-btn",3,"click"],[1,"prompt-form__content-row"],[1,"prompt-form__error"],["for","prompt-external-metadata",1,"prompt-form__label"],["id","prompt-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",1,"prompt-form__textarea","prompt-form__textarea--code",3,"formControl"],[1,"prompt-form__field-hint"],[1,"prompt-form__actions"],["type","submit",1,"prompt-form__btn","prompt-form__btn--primary",3,"disabled"],["type","button",1,"prompt-form__btn","prompt-form__btn--export",3,"disabled"],["type","button",1,"prompt-form__btn",3,"click"],["for","prompt-agent-config",1,"prompt-form__label"],[1,"prompt-form__readonly-value"],["id","prompt-agent-config",1,"prompt-form__select",3,"formControl"],[3,"ngValue"],[1,"prompt-form__param-fields"],[1,"prompt-form__field","prompt-form__field--inline"],[1,"prompt-form__label",3,"for"],["type","text","placeholder","e.g. language","formControlName","name","autocomplete","off",1,"prompt-form__input",3,"id"],["type","text","placeholder","Optional","formControlName","description","autocomplete","off",1,"prompt-form__input",3,"id"],["type","text","placeholder","e.g. English","formControlName","defaultValue","autocomplete","off",1,"prompt-form__input",3,"id"],["type","button","title","Remove this parameter",1,"prompt-form__remove-btn",3,"click"],[1,"prompt-form__content-index"],[1,"prompt-form__content-field"],["rows","4","placeholder","Enter a command\u2026",1,"prompt-form__textarea",3,"formControlName"],["type","button","title","Remove this entry",1,"prompt-form__remove-btn",3,"click","disabled"],["type","button",1,"prompt-form__btn","prompt-form__btn--export",3,"click","disabled"]],template:function(e,l){e&1&&(vs(0,"div",0)(1,"header",1)(2,"button",2),Ag("click",function(){return l.cancel()}),vs(3,"span",3),WC(4,"\u2190"),fl(),WC(5),fl(),vs(6,"h1",4),WC(7),fl()(),eC(8,ie,2,0,"p",5)(9,ve,64,18,"form",6),fl()),e&2&&(XE(5),yl(" ",l.isPlatformMode?"Platform prompts":"Prompts"," "),XE(2),Zg(l.isEditMode()?"Edit prompt":"New prompt"),XE(),tC(l.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,At,Zn,Xn,Cn,En,An,Ct,Vt],styles:[".prompt-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.prompt-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.prompt-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.prompt-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.prompt-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.prompt-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.prompt-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.prompt-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.prompt-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.prompt-form__field--inline[_ngcontent-%COMP%]{flex:1}.prompt-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.prompt-form__label-hint[_ngcontent-%COMP%]{font-weight:400;color:var(--color-text-secondary);margin-left:.375rem}.prompt-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;cursor:pointer;appearance:auto;transition:border-color .15s ease}.prompt-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.prompt-form__field-hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.prompt-form__readonly-value[_ngcontent-%COMP%]{margin:0;padding:.5rem .875rem;border-radius:0;background:var(--color-bg-hover);border:1px solid var(--color-divider);color:var(--color-text);font-size:.9375rem}.prompt-form__input[_ngcontent-%COMP%], .prompt-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.prompt-form__input[_ngcontent-%COMP%]:focus, .prompt-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.prompt-form__input[_ngcontent-%COMP%]::placeholder, .prompt-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.prompt-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:100px;line-height:1.5}.prompt-form__textarea--code[_ngcontent-%COMP%]{font-family:monospace;font-size:.85rem;resize:vertical}.prompt-form__section[_ngcontent-%COMP%]{border:1px solid var(--color-divider);border-radius:0;padding:1rem;margin:0;display:flex;flex-direction:column;gap:.75rem}.prompt-form__section-hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.prompt-form__empty-hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-style:italic}.prompt-form__content-row[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:flex-start}.prompt-form__content-field[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.25rem}.prompt-form__content-index[_ngcontent-%COMP%]{flex-shrink:0;width:1.5rem;padding-top:.6rem;font-size:.8rem;font-weight:600;color:var(--color-text-secondary);text-align:right;-webkit-user-select:none;user-select:none}.prompt-form__param-row[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:flex-end;padding:.75rem;border-radius:0;background:var(--color-bg-hover)}.prompt-form__param-fields[_ngcontent-%COMP%]{flex:1;display:flex;gap:.75rem;flex-wrap:wrap}.prompt-form__add-btn[_ngcontent-%COMP%]{align-self:flex-start;padding:.4rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-accent);font-size:.875rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.prompt-form__add-btn[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);border-color:var(--color-accent)}.prompt-form__remove-btn[_ngcontent-%COMP%]{flex-shrink:0;width:1.75rem;height:1.75rem;display:flex;align-items:center;justify-content:center;border-radius:0;border:1px solid transparent;background:transparent;color:var(--color-neutral-500);font-size:1rem;line-height:1;cursor:pointer;transition:background .15s ease,color .15s ease,border-color .15s ease}.prompt-form__remove-btn[_ngcontent-%COMP%]:hover:not(:disabled){background:color-mix(in srgb,var(--red) 10%,transparent);color:var(--red);border-color:var(--red)}.prompt-form__remove-btn[_ngcontent-%COMP%]:disabled{opacity:.3;cursor:not-allowed}.prompt-form__error[_ngcontent-%COMP%]{margin:0;padding:.625rem .875rem;border-radius:0;background:color-mix(in srgb,var(--red) 10%,transparent);border:1px solid var(--red);color:var(--red);font-size:.875rem;line-height:1.4}.prompt-form__field-error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--red);line-height:1.3}.prompt-form__input--invalid[_ngcontent-%COMP%], .prompt-form__textarea--invalid[_ngcontent-%COMP%]{border-color:var(--red)}.prompt-form__input--invalid[_ngcontent-%COMP%]:focus, .prompt-form__textarea--invalid[_ngcontent-%COMP%]:focus{border-color:var(--red)}.prompt-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.prompt-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.prompt-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.prompt-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.prompt-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.prompt-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}.prompt-form__btn--export[_ngcontent-%COMP%]{border-color:var(--color-divider);color:var(--color-text-secondary)}.prompt-form__btn--export[_ngcontent-%COMP%]:hover:not(:disabled){border-color:var(--color-accent);color:var(--color-accent)}"]})};function be(i){let t=i.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}export{re as PromptFormComponent};
1
+ import {m}from'./chunk-DHse9w28.js';import {g,ao as V,G,w as we,d7 as M,H as Hi,b as U,a7 as ga,S as ha,z as z$1,a as P,A as Aw,v as vs,l as Ag,W as WC,k as fl,n as eC,X as XE,a5 as yl,a8 as Zg,t as tC,a9 as dC,o as bg,a3 as HI,q as oC,bn as nC,ac as mC,r as Tg,y as Hg,a6 as $I,x as iC,aa as If,ab as wf}from'./main-XVJVH4GF.js';import {o as z,z as ze,k as _t,b as _e$1,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,A as At,Z as Zn,l as Xn,C as Cn,E as En,p as An,q as Ct,V as Vt}from'./chunk-DL6rhSDN.js';import'./chunk-C87Bh3Ov.js';import'./chunk--Cv5Auvq.js';import'./chunk-drd9oaGN.js';var ne=(i,t)=>t.id;function ie(i,t){i&1&&(vs(0,"p",5),WC(1,"Loading\u2026"),fl());}function ae(i,t){i&1&&(vs(0,"span",12),WC(1,"Name is required."),fl());}function le(i,t){if(i&1&&(vs(0,"p",32),WC(1),fl(),vs(2,"span",26),WC(3,"Agent Config cannot be changed after creation."),fl()),i&2){let e=mC(3);XE(),Zg(e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function me(i,t){if(i&1&&(vs(0,"option",34),WC(1),fl()),i&2){let e=t.$implicit;Tg("ngValue",e.id),XE(),Zg(e.name);}}function pe(i,t){if(i&1&&(vs(0,"select",33)(1,"option",34),WC(2,"\u2014 None \u2014"),fl(),oC(3,me,2,2,"option",34,ne),fl(),HI(),vs(5,"span",26),WC(6,"Optional. Links this prompt to an agent as a starter. Immutable after creation."),fl()),i&2){let e=mC(3);Tg("formControl",e.agentConfigIdControl),$I(),XE(),Tg("ngValue",null),XE(2),iC(e.availableAgentConfigs());}}function de(i,t){if(i&1&&(vs(0,"div",8)(1,"label",31),WC(2,"Agent Config"),fl(),eC(3,le,4,1)(4,pe,7,2),fl()),i&2){let e=mC(2);XE(3),tC(e.isEditMode()&&e.agentConfigIdControl.value?3:e.isEditMode()?-1:4);}}function ce(i,t){i&1&&(vs(0,"p",19),WC(1,"No parameters defined."),fl());}function se(i,t){i&1&&(vs(0,"span",12),WC(1,"Parameter name is required."),fl());}function _e(i,t){if(i&1){let e=dC();vs(0,"div",20)(1,"div",35)(2,"div",36)(3,"label",37),WC(4,"Name "),vs(5,"span",10),WC(6,"*"),fl()(),bg(7,"input",38),HI(),eC(8,se,2,0,"span",12),fl(),vs(9,"div",36)(10,"label",37),WC(11,"Description"),fl(),bg(12,"input",39),HI(),fl(),vs(13,"div",36)(14,"label",37),WC(15,"Default value"),fl(),bg(16,"input",40),HI(),fl()(),vs(17,"button",41),Ag("click",function(){let m=If(e).$index,d=mC(2);return wf(d.removeParameter(m))}),WC(18," \xD7 "),fl()();}if(i&2){let e=t.$implicit,l=t.$index;Tg("formGroupName",l),XE(3),Tg("for","param-name-"+l),XE(4),Hg("prompt-form__input--invalid",e.controls.name.invalid&&e.controls.name.touched),Tg("id","param-name-"+l),$I(),XE(),tC(e.controls.name.invalid&&e.controls.name.touched?8:-1),XE(2),Tg("for","param-desc-"+l),XE(2),Tg("id","param-desc-"+l),$I(),XE(2),Tg("for","param-default-"+l),XE(2),Tg("id","param-default-"+l),$I();}}function fe(i,t){i&1&&(vs(0,"span",12),WC(1,"Content entry must not be blank."),fl());}function ue(i,t){if(i&1){let e=dC();vs(0,"div",22)(1,"span",42),WC(2),fl(),vs(3,"div",43),bg(4,"textarea",44),HI(),eC(5,fe,2,0,"span",12),fl(),vs(6,"button",45),Ag("click",function(){let m=If(e).$index,d=mC(2);return wf(d.removeContentEntry(m))}),WC(7," \xD7 "),fl()();}if(i&2){let e=t.$implicit,l=t.$index,m=mC(2);XE(2),Zg(l+1),XE(2),Hg("prompt-form__textarea--invalid",e.invalid&&e.touched),Tg("formControlName",l),$I(),XE(),tC(e.invalid&&e.touched?5:-1),XE(),Tg("disabled",m.contentArray.length===1);}}function ge(i,t){if(i&1&&(vs(0,"p",23),WC(1),fl()),i&2){let e=mC(2);XE(),Zg(e.errorMessage());}}function Ce(i,t){i&1&&(vs(0,"span",12),WC(1,"Invalid JSON."),fl());}function xe(i,t){if(i&1){let e=dC();vs(0,"button",46),Ag("click",function(){If(e);let m=mC(2);return wf(m.exportYaml())}),WC(1),fl();}if(i&2){let e=mC(2);Tg("disabled",e.isExporting()),XE(),yl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function ve(i,t){if(i&1){let e=dC();vs(0,"form",7),Ag("ngSubmit",function(){If(e);let m=mC();return wf(m.submit())}),vs(1,"div",8)(2,"label",9),WC(3,"Name "),vs(4,"span",10),WC(5,"*"),fl()(),bg(6,"input",11),HI(),eC(7,ae,2,0,"span",12),fl(),vs(8,"div",8)(9,"label",13),WC(10,"Description"),fl(),bg(11,"input",14),HI(),fl(),eC(12,de,5,1,"div",8),vs(13,"fieldset",15)(14,"legend",16),WC(15," Parameters "),vs(16,"span",17),WC(17,"Named placeholders used in content"),fl()(),vs(18,"p",18),WC(19," Each parameter must have a name and a default value. Use "),vs(20,"code"),WC(21),fl(),WC(22," in content entries to reference them. "),fl(),eC(23,ce,2,0,"p",19),oC(24,_e,19,10,"div",20,nC),vs(26,"button",21),Ag("click",function(){If(e);let m=mC();return wf(m.addParameter())}),WC(27,"+ Add parameter"),fl()(),vs(28,"fieldset",15)(29,"legend",16),WC(30," Content "),vs(31,"span",10),WC(32,"*"),fl(),vs(33,"span",17),WC(34,"Ordered list of text commands"),fl()(),vs(35,"p",18),WC(36," Each content entry is a command. Use "),vs(37,"code"),WC(38,"@AgentName"),fl(),WC(39," to target an agent, "),vs(40,"code"),WC(41,"/promptName param1 param2"),fl(),WC(42," to call another prompt, and "),vs(43,"code"),WC(44),fl(),WC(45," for parameter placeholders. "),fl(),oC(46,ue,8,6,"div",22,nC),vs(48,"button",21),Ag("click",function(){If(e);let m=mC();return wf(m.addContentEntry())}),WC(49,"+ Add content entry"),fl()(),eC(50,ge,2,1,"p",23),vs(51,"div",8)(52,"label",24),WC(53,"External Metadata"),fl(),bg(54,"textarea",25),HI(),eC(55,Ce,2,0,"span",12),vs(56,"span",26),WC(57,"Optional. Opaque JSON object stored as-is. Leave empty to clear."),fl()(),vs(58,"div",27)(59,"button",28),WC(60),fl(),eC(61,xe,2,2,"button",29),vs(62,"button",30),Ag("click",function(){If(e);let m=mC();return wf(m.cancel())}),WC(63,"Cancel"),fl()()();}if(i&2){let e=mC();Tg("formGroup",e.form),XE(6),Hg("prompt-form__input--invalid",e.nameControl.invalid&&e.nameControl.touched),Tg("formControl",e.nameControl),$I(),XE(),tC(e.nameControl.invalid&&e.nameControl.touched?7:-1),XE(4),Tg("formControl",e.descriptionControl),$I(),XE(),tC(e.availableAgentConfigs().length>0?12:-1),XE(),Tg("formArrayName","parameters"),XE(8),Zg(e.paramPlaceholderSyntax),XE(2),tC(e.parametersArray.length===0?23:-1),XE(),iC(e.parametersArray.controls),XE(4),Tg("formArrayName","content"),XE(16),Zg(e.paramPlaceholderSyntax),XE(2),iC(e.contentArray.controls),XE(4),tC(e.errorMessage()?50:-1),XE(4),Tg("formControl",e.externalMetadataJsonControl),$I(),XE(),tC(e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?55:-1),XE(4),Tg("disabled",e.form.invalid||e.isSubmitting()),XE(),yl(" ",e.isEditMode()?"Save changes":"Create"," "),XE(),tC(e.isEditMode()?61:-1);}}var re=class i{route=g(V);router=g(G);destroyRef=g(we);promptState=g(m);agentConfigController=g(M);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new z({name:new _t("",{nonNullable:true,validators:[_e$1.required,_e$1.minLength(1)]}),description:new _t(null),agentConfigId:new _t(null),externalMetadataJson:new _t("",{nonNullable:true,validators:[be]}),content:new ze([this.createContentControl()],{validators:[_e$1.required]}),parameters:new ze([])});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}get contentArray(){return this.form.controls.content}get parametersArray(){return this.form.controls.parameters}isEditMode=Hi(false);isSubmitting=Hi(false);isLoading=Hi(false);isExporting=Hi(false);errorMessage=Hi(null);paramPlaceholderSyntax="{{paramName}}";agentConfigs=Hi([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("promptId");t&&(this.isEditMode.set(true),this.loadPrompt(t)),this.isPlatformMode?this.loadPlatformAgentConfigs():this.namespaceId&&this.loadAgentConfigs(this.namespaceId);}loadPrompt(t){this.isLoading.set(true),this.promptState.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingPrompt=e,this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadAgentConfigs(t){this.agentConfigController.listByParentAgentConfig(t).pipe(U(this.destroyRef),ga(()=>ha([]))).subscribe(e=>this.agentConfigs.set(e));}loadPlatformAgentConfigs(){this.agentConfigController.listPlatformAgentsAgentConfig().pipe(U(this.destroyRef),ga(()=>ha([]))).subscribe(t=>this.agentConfigs.set(t));}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId??null),this.contentArray.clear(),(t.content.length>0?t.content:[""]).forEach(l=>this.contentArray.push(this.createContentControl(l))),this.parametersArray.clear(),(t.parameters??[]).forEach(l=>this.parametersArray.push(this.createParameterGroup(l))),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}createContentControl(t=""){return new _t(t,{nonNullable:true,validators:[_e$1.required,_e$1.pattern(/\S/)]})}addContentEntry(){this.contentArray.push(this.createContentControl());}removeContentEntry(t){this.contentArray.length>1&&this.contentArray.removeAt(t);}createParameterGroup(t){return new z({name:new _t(t?.name??"",{nonNullable:true,validators:[_e$1.required,_e$1.minLength(1)]}),description:new _t(t?.description??null),defaultValue:new _t(t?.defaultValue??"",{nonNullable:true,validators:[_e$1.required]})})}addParameter(){this.parametersArray.push(this.createParameterGroup());}removeParameter(t){this.parametersArray.removeAt(t);}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=z$1(P({},this.existingPrompt??{}),{namespaceId:this.namespaceId,sourceLanguage:this.existingPrompt?.sourceLanguage??"en",name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,content:this.contentArray.controls.map(d=>d.value.trim()),parameters:this.parametersArray.controls.map(d=>({name:d.controls.name.value.trim(),description:d.controls.description.value?.trim()||void 0,defaultValue:d.controls.defaultValue.value.trim()}))});t||(e.agentConfigId=this.agentConfigIdControl.value||null);let l=this.externalMetadataJsonControl.value.trim();e.externalMetadata=l?JSON.parse(l):null;let m=t?this.promptState.update(this.existingPrompt.id,e):this.promptState.create(e);this.errorMessage.set(null),m.pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:d=>{this.isSubmitting.set(false),d.status===409?this.errorMessage.set(`A prompt named "${e.name}" already exists in this scope.`):d.status===400?this.errorMessage.set(d.error?.message??"Invalid prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}exportYaml(){let t=this.existingPrompt?.id;!t||this.isExporting()||(this.isExporting.set(true),this.promptState.exportAsYaml(t).pipe(U(this.destroyRef)).subscribe({next:e=>{let l=new Blob([e],{type:"application/yaml"}),m=URL.createObjectURL(l),d=document.createElement("a");d.href=m,d.download=`${this.existingPrompt?.name??"prompt"}.yaml`,d.click(),URL.revokeObjectURL(m),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","prompts"]):this.router.navigate(["/agentos",this.namespaceId,"prompts"]);}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=Aw({type:i,selectors:[["agentos-prompt-form"]],decls:10,vars:3,consts:[[1,"prompt-form"],[1,"prompt-form__header"],["type","button","title","Back to prompts",1,"prompt-form__back",3,"click"],[1,"prompt-form__back-icon"],[1,"prompt-form__title"],[1,"prompt-form__loading"],[1,"prompt-form__form",3,"formGroup"],[1,"prompt-form__form",3,"ngSubmit","formGroup"],[1,"prompt-form__field"],["for","prompt-name",1,"prompt-form__label"],["aria-hidden","true"],["id","prompt-name","type","text","placeholder","e.g. Summarise meeting notes","autocomplete","off",1,"prompt-form__input",3,"formControl"],[1,"prompt-form__field-error"],["for","prompt-description",1,"prompt-form__label"],["id","prompt-description","type","text","placeholder","Optional \u2014 short description of this prompt","autocomplete","off",1,"prompt-form__input",3,"formControl"],[1,"prompt-form__section",3,"formArrayName"],[1,"prompt-form__label"],[1,"prompt-form__label-hint"],[1,"prompt-form__section-hint"],[1,"prompt-form__empty-hint"],[1,"prompt-form__param-row",3,"formGroupName"],["type","button",1,"prompt-form__add-btn",3,"click"],[1,"prompt-form__content-row"],[1,"prompt-form__error"],["for","prompt-external-metadata",1,"prompt-form__label"],["id","prompt-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",1,"prompt-form__textarea","prompt-form__textarea--code",3,"formControl"],[1,"prompt-form__field-hint"],[1,"prompt-form__actions"],["type","submit",1,"prompt-form__btn","prompt-form__btn--primary",3,"disabled"],["type","button",1,"prompt-form__btn","prompt-form__btn--export",3,"disabled"],["type","button",1,"prompt-form__btn",3,"click"],["for","prompt-agent-config",1,"prompt-form__label"],[1,"prompt-form__readonly-value"],["id","prompt-agent-config",1,"prompt-form__select",3,"formControl"],[3,"ngValue"],[1,"prompt-form__param-fields"],[1,"prompt-form__field","prompt-form__field--inline"],[1,"prompt-form__label",3,"for"],["type","text","placeholder","e.g. language","formControlName","name","autocomplete","off",1,"prompt-form__input",3,"id"],["type","text","placeholder","Optional","formControlName","description","autocomplete","off",1,"prompt-form__input",3,"id"],["type","text","placeholder","e.g. English","formControlName","defaultValue","autocomplete","off",1,"prompt-form__input",3,"id"],["type","button","title","Remove this parameter",1,"prompt-form__remove-btn",3,"click"],[1,"prompt-form__content-index"],[1,"prompt-form__content-field"],["rows","4","placeholder","Enter a command\u2026",1,"prompt-form__textarea",3,"formControlName"],["type","button","title","Remove this entry",1,"prompt-form__remove-btn",3,"click","disabled"],["type","button",1,"prompt-form__btn","prompt-form__btn--export",3,"click","disabled"]],template:function(e,l){e&1&&(vs(0,"div",0)(1,"header",1)(2,"button",2),Ag("click",function(){return l.cancel()}),vs(3,"span",3),WC(4,"\u2190"),fl(),WC(5),fl(),vs(6,"h1",4),WC(7),fl()(),eC(8,ie,2,0,"p",5)(9,ve,64,18,"form",6),fl()),e&2&&(XE(5),yl(" ",l.isPlatformMode?"Platform prompts":"Prompts"," "),XE(2),Zg(l.isEditMode()?"Edit prompt":"New prompt"),XE(),tC(l.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,At,Zn,Xn,Cn,En,An,Ct,Vt],styles:[".prompt-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.prompt-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.prompt-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.prompt-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.prompt-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.prompt-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.prompt-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.prompt-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.prompt-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.prompt-form__field--inline[_ngcontent-%COMP%]{flex:1}.prompt-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.prompt-form__label-hint[_ngcontent-%COMP%]{font-weight:400;color:var(--color-text-secondary);margin-left:.375rem}.prompt-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;cursor:pointer;appearance:auto;transition:border-color .15s ease}.prompt-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.prompt-form__field-hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.prompt-form__readonly-value[_ngcontent-%COMP%]{margin:0;padding:.5rem .875rem;border-radius:0;background:var(--color-bg-hover);border:1px solid var(--color-divider);color:var(--color-text);font-size:.9375rem}.prompt-form__input[_ngcontent-%COMP%], .prompt-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.prompt-form__input[_ngcontent-%COMP%]:focus, .prompt-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.prompt-form__input[_ngcontent-%COMP%]::placeholder, .prompt-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.prompt-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:100px;line-height:1.5}.prompt-form__textarea--code[_ngcontent-%COMP%]{font-family:monospace;font-size:.85rem;resize:vertical}.prompt-form__section[_ngcontent-%COMP%]{border:1px solid var(--color-divider);border-radius:0;padding:1rem;margin:0;display:flex;flex-direction:column;gap:.75rem}.prompt-form__section-hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.prompt-form__empty-hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-style:italic}.prompt-form__content-row[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:flex-start}.prompt-form__content-field[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.25rem}.prompt-form__content-index[_ngcontent-%COMP%]{flex-shrink:0;width:1.5rem;padding-top:.6rem;font-size:.8rem;font-weight:600;color:var(--color-text-secondary);text-align:right;-webkit-user-select:none;user-select:none}.prompt-form__param-row[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:flex-end;padding:.75rem;border-radius:0;background:var(--color-bg-hover)}.prompt-form__param-fields[_ngcontent-%COMP%]{flex:1;display:flex;gap:.75rem;flex-wrap:wrap}.prompt-form__add-btn[_ngcontent-%COMP%]{align-self:flex-start;padding:.4rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-accent);font-size:.875rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.prompt-form__add-btn[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);border-color:var(--color-accent)}.prompt-form__remove-btn[_ngcontent-%COMP%]{flex-shrink:0;width:1.75rem;height:1.75rem;display:flex;align-items:center;justify-content:center;border-radius:0;border:1px solid transparent;background:transparent;color:var(--color-neutral-500);font-size:1rem;line-height:1;cursor:pointer;transition:background .15s ease,color .15s ease,border-color .15s ease}.prompt-form__remove-btn[_ngcontent-%COMP%]:hover:not(:disabled){background:color-mix(in srgb,var(--red) 10%,transparent);color:var(--red);border-color:var(--red)}.prompt-form__remove-btn[_ngcontent-%COMP%]:disabled{opacity:.3;cursor:not-allowed}.prompt-form__error[_ngcontent-%COMP%]{margin:0;padding:.625rem .875rem;border-radius:0;background:color-mix(in srgb,var(--red) 10%,transparent);border:1px solid var(--red);color:var(--red);font-size:.875rem;line-height:1.4}.prompt-form__field-error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--red);line-height:1.3}.prompt-form__input--invalid[_ngcontent-%COMP%], .prompt-form__textarea--invalid[_ngcontent-%COMP%]{border-color:var(--red)}.prompt-form__input--invalid[_ngcontent-%COMP%]:focus, .prompt-form__textarea--invalid[_ngcontent-%COMP%]:focus{border-color:var(--red)}.prompt-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.prompt-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.prompt-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.prompt-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.prompt-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.prompt-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}.prompt-form__btn--export[_ngcontent-%COMP%]{border-color:var(--color-divider);color:var(--color-text-secondary)}.prompt-form__btn--export[_ngcontent-%COMP%]:hover:not(:disabled){border-color:var(--color-accent);color:var(--color-accent)}"]})};function be(i){let t=i.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}export{re as PromptFormComponent};
@@ -1,4 +1,4 @@
1
- import {c as ce,s as se,b as at$1,d as de}from'./chunk-DlFFzFSe.js';import {a as Dr,b as gr,_ as _r,g as gt,z as zi,F as Fn,H as Hi$1}from'./chunk-RbE7PtJh.js';import {W as We,Q as Qt$1}from'./chunk-Ckk6G7IP.js';import {aK as Do,aL as qn,bC as ge,aN as wt,bD as vt,g,bM as F,br as Cl,az as Qt,bs as Qn,aS as Ut,aQ as As,c3 as On,aV as w,aR as K,an as ce$1,H as Hi,bP as Zy,bQ as bd,bR as ma,bO as Yy,al as yt,ae as Ot,u as ue,bx as am,c4 as Et,ap as Vy,aA as sn,bt as Ve,c5 as Rt,bG as Pt$1,c0 as E,A as Aw,c6 as _e$1,aC as Cu,aZ as YT,c7 as QT,bz as vC,v as vs,l as Ag,n as eC,k as fl,c8 as kf,o as bg,af as Dg,T as TC,X as XE,C as Cg,t as tC,r as Tg,b4 as nT,y as Hg,D as Fg,I as IC,E as wC,bu as kg,bK as pe,c2 as kt,W as WC,ac as mC,a8 as Zg,a9 as dC,aa as If,ab as wf,bA as DC,b_ as FC}from'./main-DXWHG4XK.js';import {_,b as _e,d as an,E as En}from'./chunk-BBJc_ez4.js';var Qe=["trigger"],Ye=["panel"],Ue=[[["mat-select-trigger"]],"*"],Xe=["mat-select-trigger","*"];function Je(a,_){if(a&1&&(vs(0,"span",4),WC(1),fl()),a&2){let e=mC();XE(),Zg(e.placeholder);}}function Ze(a,_){a&1&&DC(0);}function $e(a,_){if(a&1&&(vs(0,"span",11),WC(1),fl()),a&2){let e=mC(2);XE(),Zg(e.triggerValue);}}function et(a,_){if(a&1&&(vs(0,"span",5),eC(1,Ze,1,0)(2,$e,2,1,"span",11),fl()),a&2){let e=mC();XE(),tC(e.customTrigger?1:2);}}function tt(a,_){if(a&1){let e=dC();vs(0,"div",12,1),Ag("keydown",function(i){If(e);let n=mC();return wf(n._handleKeydown(i))}),DC(2,1),fl();}if(a&2){let e=mC();FC(e.panelClass),Hg("mat-select-panel-animations-enabled",!e._animationsDisabled)("mat-primary",e._parentFormField?.color==="primary")("mat-accent",e._parentFormField?.color==="accent")("mat-warn",e._parentFormField?.color==="warn")("mat-undefined",!e._parentFormField?.color),Cg("id",e.id+"-panel")("aria-multiselectable",e.multiple)("aria-label",e.ariaLabel||null)("aria-labelledby",e._getPanelAriaLabelledby());}}var it=new w("mat-select-scroll-strategy",{providedIn:"root",factory:()=>{let a=g(pe);return ()=>kt(a)}}),nt=new w("MAT_SELECT_CONFIG"),at=new w("MatSelectTrigger"),B=class{source;value;constructor(_,e){this.source=_,this.value=e;}},Lt=(()=>{class a{_viewportRuler=g(F);_changeDetectorRef=g(Cl);_elementRef=g(Qt);_dir=g(Qn,{optional:true});_idGenerator=g(Ut);_renderer=g(As);_parentFormField=g(se,{optional:true});ngControl=g(_,{self:true,optional:true});_liveAnnouncer=g(On);_defaultOptions=g(nt,{optional:true});_animationsDisabled=K();_popoverLocation;_initialized=new ce$1;_cleanupDetach;options;optionGroups;customTrigger;_positions=[{originX:"start",originY:"bottom",overlayX:"start",overlayY:"top"},{originX:"end",originY:"bottom",overlayX:"end",overlayY:"top"},{originX:"start",originY:"top",overlayX:"start",overlayY:"bottom",panelClass:"mat-mdc-select-panel-above"},{originX:"end",originY:"top",overlayX:"end",overlayY:"bottom",panelClass:"mat-mdc-select-panel-above"}];_scrollOptionIntoView(e){let t=this.options.toArray()[e];if(t){let i=this.panel.nativeElement,n=gr(e,this.options,this.optionGroups),r=t._getHostElement();e===0&&n===1?i.scrollTop=0:i.scrollTop=_r(r.offsetTop,r.offsetHeight,i.scrollTop,i.offsetHeight);}}_positioningSettled(){this._scrollOptionIntoView(this._keyManager.activeItemIndex||0);}_getChangeEvent(e){return new B(this,e)}_scrollStrategyFactory=g(it);_panelOpen=false;_compareWith=(e,t)=>e===t;_uid=this._idGenerator.getId("mat-select-");_triggerAriaLabelledBy=null;_previousControl;_destroy=new ce$1;_errorStateTracker;stateChanges=new ce$1;disableAutomaticLabeling=true;userAriaDescribedBy;_selectionModel;_keyManager;_preferredOverlayOrigin;_overlayWidth;_onChange=()=>{};_onTouched=()=>{};_valueId=this._idGenerator.getId("mat-select-value-");_scrollStrategy;_overlayPanelClass=this._defaultOptions?.overlayPanelClass||"";get focused(){return this._focused||this._panelOpen}_focused=false;controlType="mat-select";trigger;panel;_overlayDir;panelClass;disabled=false;get disableRipple(){return this._disableRipple()}set disableRipple(e){this._disableRipple.set(e);}_disableRipple=Hi(false);tabIndex=0;get hideSingleSelectionIndicator(){return this._hideSingleSelectionIndicator}set hideSingleSelectionIndicator(e){this._hideSingleSelectionIndicator=e,this._syncParentProperties();}_hideSingleSelectionIndicator=this._defaultOptions?.hideSingleSelectionIndicator??false;get placeholder(){return this._placeholder}set placeholder(e){this._placeholder=e,this.stateChanges.next();}_placeholder;get required(){return this._required??this.ngControl?.control?.hasValidator(_e.required)??false}set required(e){this._required=e,this.stateChanges.next();}_required;get multiple(){return this._multiple}set multiple(e){this._selectionModel,this._multiple=e;}_multiple=false;disableOptionCentering=this._defaultOptions?.disableOptionCentering??false;get compareWith(){return this._compareWith}set compareWith(e){this._compareWith=e,this._selectionModel&&this._initializeSelection();}get value(){return this._value}set value(e){this._assignValue(e)&&this._onChange(e);}_value;ariaLabel="";ariaLabelledby;get errorStateMatcher(){return this._errorStateTracker.matcher}set errorStateMatcher(e){this._errorStateTracker.matcher=e;}typeaheadDebounceInterval;sortComparator;get id(){return this._id}set id(e){this._id=e||this._uid,this.stateChanges.next();}_id;get errorState(){return this._errorStateTracker.errorState}set errorState(e){this._errorStateTracker.errorState=e;}panelWidth=this._defaultOptions&&typeof this._defaultOptions.panelWidth<"u"?this._defaultOptions.panelWidth:"auto";canSelectNullableOptions=this._defaultOptions?.canSelectNullableOptions??false;optionSelectionChanges=Zy(()=>{let e=this.options;return e?e.changes.pipe(bd(e),ma(()=>Yy(...e.map(t=>t.onSelectionChange)))):this._initialized.pipe(ma(()=>this.optionSelectionChanges))});openedChange=new yt;_openedStream=this.openedChange.pipe(Ot(e=>e),ue(()=>{}));_closedStream=this.openedChange.pipe(Ot(e=>!e),ue(()=>{}));selectionChange=new yt;valueChange=new yt;constructor(){let e=g(We),t=g(an,{optional:true}),i=g(En,{optional:true}),n=g(new am("tabindex"),{optional:true}),r=g(Et,{optional:true}),d=g(at$1,{optional:true,self:true});this.ngControl&&(this.ngControl.valueAccessor=this),this._defaultOptions?.typeaheadDebounceInterval!=null&&(this.typeaheadDebounceInterval=this._defaultOptions.typeaheadDebounceInterval),this._errorStateTracker=new Qt$1(e,d||this.ngControl,i,t,this.stateChanges),this._scrollStrategy=this._scrollStrategyFactory(),this.tabIndex=n==null?0:parseInt(n)||0,this._popoverLocation=r?.usePopover===false?null:"inline",this.id=this.id;}ngOnInit(){this._selectionModel=new gt(this.multiple),this.stateChanges.next(),this._viewportRuler.change().pipe(Vy(this._destroy)).subscribe(()=>{this.panelOpen&&(this._overlayWidth=this._getOverlayWidth(this._preferredOverlayOrigin),this._changeDetectorRef.detectChanges());});}ngAfterContentInit(){this._initialized.next(),this._initialized.complete(),this._initKeyManager(),this._selectionModel.changed.pipe(Vy(this._destroy)).subscribe(e=>{e.added.forEach(t=>t.select()),e.removed.forEach(t=>t.deselect());}),this.options.changes.pipe(bd(null),Vy(this._destroy)).subscribe(()=>{this._resetOptions(),this._initializeSelection();});}ngDoCheck(){let e=this._getTriggerAriaLabelledby(),t=this.ngControl;if(e!==this._triggerAriaLabelledBy){let i=this._elementRef.nativeElement;this._triggerAriaLabelledBy=e,e?i.setAttribute("aria-labelledby",e):i.removeAttribute("aria-labelledby");}t&&(this._previousControl!==t.control&&(this._previousControl!==void 0&&t.disabled!==null&&t.disabled!==this.disabled&&(this.disabled=t.disabled),this._previousControl=t.control),this.updateErrorState());}ngOnChanges(e){(e.disabled||e.userAriaDescribedBy)&&this.stateChanges.next(),e.typeaheadDebounceInterval&&this._keyManager&&this._keyManager.withTypeAhead(this.typeaheadDebounceInterval),e.panelClass&&this.panelClass instanceof Set&&(this.panelClass=Array.from(this.panelClass));}ngOnDestroy(){this._cleanupDetach?.(),this._keyManager?.destroy(),this._destroy.next(),this._destroy.complete(),this.stateChanges.complete();}toggle(){this.panelOpen?this.close():this.open();}open(){this._canOpen()&&(this._parentFormField&&(this._preferredOverlayOrigin=this._parentFormField.getConnectedOverlayOrigin()),this._cleanupDetach?.(),this._overlayWidth=this._getOverlayWidth(this._preferredOverlayOrigin),this._panelOpen=true,this._overlayDir.positionChange.pipe(sn(1)).subscribe(()=>{this._changeDetectorRef.detectChanges(),this._positioningSettled();}),this._overlayDir.attachOverlay(),this._keyManager.withHorizontalOrientation(null),this._highlightCorrectOption(),this._changeDetectorRef.markForCheck(),this.stateChanges.next(),Promise.resolve().then(()=>this.openedChange.emit(true)));}close(){this._panelOpen&&(this._panelOpen=false,this._exitAndDetach(),this._keyManager.withHorizontalOrientation(this._isRtl()?"rtl":"ltr"),this._changeDetectorRef.markForCheck(),this._onTouched(),this.stateChanges.next(),Promise.resolve().then(()=>this.openedChange.emit(false)));}_exitAndDetach(){if(this._animationsDisabled||!this.panel){this._detachOverlay();return}this._cleanupDetach?.(),this._cleanupDetach=()=>{t(),clearTimeout(i),this._cleanupDetach=void 0;};let e=this.panel.nativeElement,t=this._renderer.listen(e,"animationend",n=>{n.animationName==="_mat-select-exit"&&(this._cleanupDetach?.(),this._detachOverlay());}),i=setTimeout(()=>{this._cleanupDetach?.(),this._detachOverlay();},200);e.classList.add("mat-select-panel-exit");}_detachOverlay(){this._overlayDir.detachOverlay(),this._changeDetectorRef.markForCheck();}writeValue(e){this._assignValue(e);}registerOnChange(e){this._onChange=e;}registerOnTouched(e){this._onTouched=e;}setDisabledState(e){this.disabled=e,this._changeDetectorRef.markForCheck(),this.stateChanges.next();}get panelOpen(){return this._panelOpen}get selected(){return this.multiple?this._selectionModel?.selected||[]:this._selectionModel?.selected[0]}get triggerValue(){if(this.empty)return "";if(this._multiple){let e=this._selectionModel.selected.map(t=>t.viewValue);return this._isRtl()&&e.reverse(),e.join(", ")}return this._selectionModel.selected[0].viewValue}updateErrorState(){this._errorStateTracker.updateErrorState();}_isRtl(){return this._dir?this._dir.value==="rtl":false}_handleKeydown(e){this.disabled||(this.panelOpen?this._handleOpenKeydown(e):this._handleClosedKeydown(e));}_handleClosedKeydown(e){let t=e.keyCode,i=t===40||t===38||t===37||t===39,n=t===13||t===32,r=this._keyManager;if(!r.isTyping()&&n&&!Ve(e)||(this.multiple||e.altKey)&&i)e.preventDefault(),this.open();else if(!this.multiple){let d=this.selected;r.onKeydown(e);let o=this.selected;o&&d!==o&&this._liveAnnouncer.announce(o.viewValue,1e4);}}_handleOpenKeydown(e){let t=this._keyManager,i=e.keyCode,n=i===40||i===38,r=t.isTyping();if(n&&e.altKey)e.preventDefault(),this.close();else if(!r&&(i===13||i===32)&&t.activeItem&&!Ve(e))e.preventDefault(),t.activeItem._selectViaInteraction();else if(!r&&this._multiple&&i===65&&e.ctrlKey){e.preventDefault();let d=this.options.some(o=>!o.disabled&&!o.selected);this.options.forEach(o=>{o.disabled||(d?o.select():o.deselect());});}else {let d=t.activeItemIndex;t.onKeydown(e),this._multiple&&n&&e.shiftKey&&t.activeItem&&t.activeItemIndex!==d&&t.activeItem._selectViaInteraction();}}_handleOverlayKeydown(e){e.keyCode===27&&!Ve(e)&&(e.preventDefault(),this.close());}_onFocus(){this.disabled||(this._focused=true,this.stateChanges.next());}_onBlur(){this._focused=false,this._keyManager?.cancelTypeahead(),!this.disabled&&!this.panelOpen&&(this._onTouched(),this._changeDetectorRef.markForCheck(),this.stateChanges.next());}get empty(){return !this._selectionModel||this._selectionModel.isEmpty()}_initializeSelection(){Promise.resolve().then(()=>{this.ngControl&&(this._value=this.ngControl.value),this._setSelectionByValue(this._value),this.stateChanges.next();});}_setSelectionByValue(e){if(this.options.forEach(t=>t.setInactiveStyles()),this._selectionModel.clear(),this.multiple&&e)e.forEach(t=>this._selectOptionByValue(t)),this._sortValues();else {let t=this._selectOptionByValue(e);t?this._keyManager.updateActiveItem(t):this.panelOpen||this._keyManager.updateActiveItem(-1);}this._changeDetectorRef.markForCheck();}_selectOptionByValue(e){let t=this.options.find(i=>{if(this._selectionModel.isSelected(i))return false;try{return (i.value!=null||this.canSelectNullableOptions)&&this._compareWith(i.value,e)}catch(n){return false}});return t&&this._selectionModel.select(t),t}_assignValue(e){return e!==this._value||this._multiple&&Array.isArray(e)?(this.options&&this._setSelectionByValue(e),this._value=e,true):false}_skipPredicate=e=>this.panelOpen?false:e.disabled;_getOverlayWidth(e){return this.panelWidth==="auto"?(e instanceof Rt?e.elementRef:e||this._elementRef).nativeElement.getBoundingClientRect().width:this.panelWidth===null?"":this.panelWidth}_syncParentProperties(){if(this.options)for(let e of this.options)e._changeDetectorRef.markForCheck();}_initKeyManager(){this._keyManager=new Pt$1(this.options).withTypeAhead(this.typeaheadDebounceInterval).withVerticalOrientation().withHorizontalOrientation(this._isRtl()?"rtl":"ltr").withHomeAndEnd().withPageUpDown().withAllowedModifierKeys(["shiftKey"]).skipPredicate(this._skipPredicate),this._keyManager.tabOut.subscribe(()=>{this.panelOpen&&(!this.multiple&&this._keyManager.activeItem&&this._keyManager.activeItem._selectViaInteraction(),this.focus(),this.close());}),this._keyManager.change.subscribe(()=>{this._panelOpen&&this.panel?this._scrollOptionIntoView(this._keyManager.activeItemIndex||0):!this._panelOpen&&!this.multiple&&this._keyManager.activeItem&&this._keyManager.activeItem._selectViaInteraction();});}_resetOptions(){let e=Yy(this.options.changes,this._destroy);this.optionSelectionChanges.pipe(Vy(e)).subscribe(t=>{this._onSelect(t.source,t.isUserInput),t.isUserInput&&!this.multiple&&this._panelOpen&&(this.close(),this.focus());}),Yy(...this.options.map(t=>t._stateChanges)).pipe(Vy(e)).subscribe(()=>{this._changeDetectorRef.detectChanges(),this.stateChanges.next();});}_onSelect(e,t){let i=this._selectionModel.isSelected(e);!this.canSelectNullableOptions&&e.value==null&&!this._multiple?(e.deselect(),this._selectionModel.clear(),this.value!=null&&this._propagateChanges(e.value)):(i!==e.selected&&(e.selected?this._selectionModel.select(e):this._selectionModel.deselect(e)),t&&this._keyManager.setActiveItem(e),this.multiple&&(this._sortValues(),t&&this.focus())),i!==this._selectionModel.isSelected(e)&&this._propagateChanges(),this.stateChanges.next();}_sortValues(){if(this.multiple){let e=this.options.toArray();this._selectionModel.sort((t,i)=>this.sortComparator?this.sortComparator(t,i,e):e.indexOf(t)-e.indexOf(i)),this.stateChanges.next();}}_propagateChanges(e){let t;this.multiple?t=this.selected.map(i=>i.value):t=this.selected?this.selected.value:e,this._value=t,this.valueChange.emit(t),this._onChange(t),this.selectionChange.emit(this._getChangeEvent(t)),this._changeDetectorRef.markForCheck();}_highlightCorrectOption(){if(this._keyManager)if(this.empty){let e=-1;for(let t=0;t<this.options.length;t++)if(!this.options.get(t).disabled){e=t;break}this._keyManager.setActiveItem(e);}else this._keyManager.setActiveItem(this._selectionModel.selected[0]);}_canOpen(){return !this._panelOpen&&!this.disabled&&this.options?.length>0&&!!this._overlayDir}focus(e){this._elementRef.nativeElement.focus(e);}_getPanelAriaLabelledby(){if(this.ariaLabel)return null;let e=this._parentFormField?.getLabelId()||null,t=e?e+" ":"";return this.ariaLabelledby?t+this.ariaLabelledby:e}_getAriaActiveDescendant(){return this.panelOpen&&this._keyManager&&this._keyManager.activeItem?this._keyManager.activeItem.id:null}_getTriggerAriaLabelledby(){if(this.ariaLabel)return null;let e=this._parentFormField?.getLabelId()||"";return this.ariaLabelledby&&(e+=" "+this.ariaLabelledby),e||(e=this._valueId),e}get describedByIds(){return this._elementRef.nativeElement.getAttribute("aria-describedby")?.split(" ")||[]}setDescribedByIds(e){let t=this._elementRef.nativeElement;e.length?t.setAttribute("aria-describedby",e.join(" ")):t.removeAttribute("aria-describedby");}onContainerClick(e){let t=E(e);t&&(t.tagName==="MAT-OPTION"||t.classList.contains("cdk-overlay-backdrop")||t.closest(".mat-mdc-select-panel"))||(this.focus(),this.open());}get shouldLabelFloat(){return this.panelOpen||!this.empty||this.focused&&!!this.placeholder}static \u0275fac=function(t){return new(t||a)};static \u0275cmp=Aw({type:a,selectors:[["mat-select"]],contentQueries:function(t,i,n){if(t&1&&kg(n,at,5)(n,Fn,5)(n,Hi$1,5),t&2){let r;IC(r=wC())&&(i.customTrigger=r.first),IC(r=wC())&&(i.options=r),IC(r=wC())&&(i.optionGroups=r);}},viewQuery:function(t,i){if(t&1&&Fg(Qe,5)(Ye,5)(_e$1,5),t&2){let n;IC(n=wC())&&(i.trigger=n.first),IC(n=wC())&&(i.panel=n.first),IC(n=wC())&&(i._overlayDir=n.first);}},hostAttrs:["role","combobox","aria-haspopup","listbox",1,"mat-mdc-select"],hostVars:21,hostBindings:function(t,i){t&1&&Ag("keydown",function(r){return i._handleKeydown(r)})("focus",function(){return i._onFocus()})("blur",function(){return i._onBlur()}),t&2&&(Cg("id",i.id)("tabindex",i.disabled?-1:i.tabIndex)("aria-controls",i.panelOpen?i.id+"-panel":null)("aria-expanded",i.panelOpen)("aria-label",i.ariaLabel||null)("aria-required",i.required.toString())("aria-disabled",i.disabled.toString())("aria-invalid",i.errorState)("aria-activedescendant",i._getAriaActiveDescendant()),Hg("mat-mdc-select-disabled",i.disabled)("mat-mdc-select-invalid",i.errorState)("mat-mdc-select-required",i.required)("mat-mdc-select-empty",i.empty)("mat-mdc-select-multiple",i.multiple)("mat-select-open",i.panelOpen));},inputs:{userAriaDescribedBy:[0,"aria-describedby","userAriaDescribedBy"],panelClass:"panelClass",disabled:[2,"disabled","disabled",YT],disableRipple:[2,"disableRipple","disableRipple",YT],tabIndex:[2,"tabIndex","tabIndex",e=>e==null?0:QT(e)],hideSingleSelectionIndicator:[2,"hideSingleSelectionIndicator","hideSingleSelectionIndicator",YT],placeholder:"placeholder",required:[2,"required","required",YT],multiple:[2,"multiple","multiple",YT],disableOptionCentering:[2,"disableOptionCentering","disableOptionCentering",YT],compareWith:"compareWith",value:"value",ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],errorStateMatcher:"errorStateMatcher",typeaheadDebounceInterval:[2,"typeaheadDebounceInterval","typeaheadDebounceInterval",QT],sortComparator:"sortComparator",id:"id",panelWidth:"panelWidth",canSelectNullableOptions:[2,"canSelectNullableOptions","canSelectNullableOptions",YT]},outputs:{openedChange:"openedChange",_openedStream:"opened",_closedStream:"closed",selectionChange:"selectionChange",valueChange:"valueChange"},exportAs:["matSelect"],features:[nT([{provide:de,useExisting:a},{provide:zi,useExisting:a}]),Cu],ngContentSelectors:Xe,decls:11,vars:10,consts:[["fallbackOverlayOrigin","cdkOverlayOrigin","trigger",""],["panel",""],["cdk-overlay-origin","",1,"mat-mdc-select-trigger",3,"click"],[1,"mat-mdc-select-value"],[1,"mat-mdc-select-placeholder","mat-mdc-select-min-line"],[1,"mat-mdc-select-value-text"],[1,"mat-mdc-select-arrow-wrapper"],[1,"mat-mdc-select-arrow"],["viewBox","0 0 24 24","width","24px","height","24px","focusable","false","aria-hidden","true"],["d","M7 10l5 5 5-5z"],["cdk-connected-overlay","","cdkConnectedOverlayHasBackdrop","","cdkConnectedOverlayBackdropClass","cdk-overlay-transparent-backdrop",3,"detach","backdropClick","overlayKeydown","cdkConnectedOverlayDisableClose","cdkConnectedOverlayPanelClass","cdkConnectedOverlayScrollStrategy","cdkConnectedOverlayOrigin","cdkConnectedOverlayPositions","cdkConnectedOverlayWidth","cdkConnectedOverlayFlexibleDimensions","cdkConnectedOverlayUsePopover"],[1,"mat-mdc-select-min-line"],["role","listbox","tabindex","-1",1,"mat-mdc-select-panel","mdc-menu-surface","mdc-menu-surface--open",3,"keydown"]],template:function(t,i){if(t&1&&(vC(Ue),vs(0,"div",2,0),Ag("click",function(){return i.open()}),vs(3,"div",3),eC(4,Je,2,1,"span",4)(5,et,3,1,"span",5),fl(),vs(6,"div",6)(7,"div",7),kf(),vs(8,"svg",8),bg(9,"path",9),fl()()()(),Dg(10,tt,3,16,"ng-template",10),Ag("detach",function(){return i.close()})("backdropClick",function(){return i.close()})("overlayKeydown",function(r){return i._handleOverlayKeydown(r)})),t&2){let n=TC(1);XE(3),Cg("id",i._valueId),XE(),tC(i.empty?4:5),XE(6),Tg("cdkConnectedOverlayDisableClose",true)("cdkConnectedOverlayPanelClass",i._overlayPanelClass)("cdkConnectedOverlayScrollStrategy",i._scrollStrategy)("cdkConnectedOverlayOrigin",i._preferredOverlayOrigin||n)("cdkConnectedOverlayPositions",i._positions)("cdkConnectedOverlayWidth",i._overlayWidth)("cdkConnectedOverlayFlexibleDimensions",true)("cdkConnectedOverlayUsePopover",i._popoverLocation);}},dependencies:[Rt,_e$1],styles:[`@keyframes _mat-select-enter {
1
+ import {c as ce,s as se,b as at$1,d as de}from'./chunk-GU0OGBZz.js';import {a as Dr,b as gr,_ as _r,g as gt,z as zi,F as Fn,H as Hi$1}from'./chunk--Cv5Auvq.js';import {W as We,Q as Qt$1}from'./chunk-drd9oaGN.js';import {aK as Do,aL as qn,bC as ge,aN as wt,bD as vt,g,bM as F,br as Cl,az as Qt,bs as Qn,aS as Ut,aQ as As,c3 as On,aV as w,aR as K,an as ce$1,H as Hi,bP as Zy,bQ as bd,bR as ma,bO as Yy,al as yt,ae as Ot,u as ue,bx as am,c4 as Et,ap as Vy,aA as sn,bt as Ve,c5 as Rt,bG as Pt$1,c0 as E,A as Aw,c6 as _e$1,aC as Cu,aZ as YT,c7 as QT,bz as vC,v as vs,l as Ag,n as eC,k as fl,c8 as kf,o as bg,af as Dg,T as TC,X as XE,C as Cg,t as tC,r as Tg,b4 as nT,y as Hg,D as Fg,I as IC,E as wC,bu as kg,bK as pe,c2 as kt,W as WC,ac as mC,a8 as Zg,a9 as dC,aa as If,ab as wf,bA as DC,b_ as FC}from'./main-XVJVH4GF.js';import {_,b as _e,d as an,E as En}from'./chunk-DL6rhSDN.js';var Qe=["trigger"],Ye=["panel"],Ue=[[["mat-select-trigger"]],"*"],Xe=["mat-select-trigger","*"];function Je(a,_){if(a&1&&(vs(0,"span",4),WC(1),fl()),a&2){let e=mC();XE(),Zg(e.placeholder);}}function Ze(a,_){a&1&&DC(0);}function $e(a,_){if(a&1&&(vs(0,"span",11),WC(1),fl()),a&2){let e=mC(2);XE(),Zg(e.triggerValue);}}function et(a,_){if(a&1&&(vs(0,"span",5),eC(1,Ze,1,0)(2,$e,2,1,"span",11),fl()),a&2){let e=mC();XE(),tC(e.customTrigger?1:2);}}function tt(a,_){if(a&1){let e=dC();vs(0,"div",12,1),Ag("keydown",function(i){If(e);let n=mC();return wf(n._handleKeydown(i))}),DC(2,1),fl();}if(a&2){let e=mC();FC(e.panelClass),Hg("mat-select-panel-animations-enabled",!e._animationsDisabled)("mat-primary",e._parentFormField?.color==="primary")("mat-accent",e._parentFormField?.color==="accent")("mat-warn",e._parentFormField?.color==="warn")("mat-undefined",!e._parentFormField?.color),Cg("id",e.id+"-panel")("aria-multiselectable",e.multiple)("aria-label",e.ariaLabel||null)("aria-labelledby",e._getPanelAriaLabelledby());}}var it=new w("mat-select-scroll-strategy",{providedIn:"root",factory:()=>{let a=g(pe);return ()=>kt(a)}}),nt=new w("MAT_SELECT_CONFIG"),at=new w("MatSelectTrigger"),B=class{source;value;constructor(_,e){this.source=_,this.value=e;}},Lt=(()=>{class a{_viewportRuler=g(F);_changeDetectorRef=g(Cl);_elementRef=g(Qt);_dir=g(Qn,{optional:true});_idGenerator=g(Ut);_renderer=g(As);_parentFormField=g(se,{optional:true});ngControl=g(_,{self:true,optional:true});_liveAnnouncer=g(On);_defaultOptions=g(nt,{optional:true});_animationsDisabled=K();_popoverLocation;_initialized=new ce$1;_cleanupDetach;options;optionGroups;customTrigger;_positions=[{originX:"start",originY:"bottom",overlayX:"start",overlayY:"top"},{originX:"end",originY:"bottom",overlayX:"end",overlayY:"top"},{originX:"start",originY:"top",overlayX:"start",overlayY:"bottom",panelClass:"mat-mdc-select-panel-above"},{originX:"end",originY:"top",overlayX:"end",overlayY:"bottom",panelClass:"mat-mdc-select-panel-above"}];_scrollOptionIntoView(e){let t=this.options.toArray()[e];if(t){let i=this.panel.nativeElement,n=gr(e,this.options,this.optionGroups),r=t._getHostElement();e===0&&n===1?i.scrollTop=0:i.scrollTop=_r(r.offsetTop,r.offsetHeight,i.scrollTop,i.offsetHeight);}}_positioningSettled(){this._scrollOptionIntoView(this._keyManager.activeItemIndex||0);}_getChangeEvent(e){return new B(this,e)}_scrollStrategyFactory=g(it);_panelOpen=false;_compareWith=(e,t)=>e===t;_uid=this._idGenerator.getId("mat-select-");_triggerAriaLabelledBy=null;_previousControl;_destroy=new ce$1;_errorStateTracker;stateChanges=new ce$1;disableAutomaticLabeling=true;userAriaDescribedBy;_selectionModel;_keyManager;_preferredOverlayOrigin;_overlayWidth;_onChange=()=>{};_onTouched=()=>{};_valueId=this._idGenerator.getId("mat-select-value-");_scrollStrategy;_overlayPanelClass=this._defaultOptions?.overlayPanelClass||"";get focused(){return this._focused||this._panelOpen}_focused=false;controlType="mat-select";trigger;panel;_overlayDir;panelClass;disabled=false;get disableRipple(){return this._disableRipple()}set disableRipple(e){this._disableRipple.set(e);}_disableRipple=Hi(false);tabIndex=0;get hideSingleSelectionIndicator(){return this._hideSingleSelectionIndicator}set hideSingleSelectionIndicator(e){this._hideSingleSelectionIndicator=e,this._syncParentProperties();}_hideSingleSelectionIndicator=this._defaultOptions?.hideSingleSelectionIndicator??false;get placeholder(){return this._placeholder}set placeholder(e){this._placeholder=e,this.stateChanges.next();}_placeholder;get required(){return this._required??this.ngControl?.control?.hasValidator(_e.required)??false}set required(e){this._required=e,this.stateChanges.next();}_required;get multiple(){return this._multiple}set multiple(e){this._selectionModel,this._multiple=e;}_multiple=false;disableOptionCentering=this._defaultOptions?.disableOptionCentering??false;get compareWith(){return this._compareWith}set compareWith(e){this._compareWith=e,this._selectionModel&&this._initializeSelection();}get value(){return this._value}set value(e){this._assignValue(e)&&this._onChange(e);}_value;ariaLabel="";ariaLabelledby;get errorStateMatcher(){return this._errorStateTracker.matcher}set errorStateMatcher(e){this._errorStateTracker.matcher=e;}typeaheadDebounceInterval;sortComparator;get id(){return this._id}set id(e){this._id=e||this._uid,this.stateChanges.next();}_id;get errorState(){return this._errorStateTracker.errorState}set errorState(e){this._errorStateTracker.errorState=e;}panelWidth=this._defaultOptions&&typeof this._defaultOptions.panelWidth<"u"?this._defaultOptions.panelWidth:"auto";canSelectNullableOptions=this._defaultOptions?.canSelectNullableOptions??false;optionSelectionChanges=Zy(()=>{let e=this.options;return e?e.changes.pipe(bd(e),ma(()=>Yy(...e.map(t=>t.onSelectionChange)))):this._initialized.pipe(ma(()=>this.optionSelectionChanges))});openedChange=new yt;_openedStream=this.openedChange.pipe(Ot(e=>e),ue(()=>{}));_closedStream=this.openedChange.pipe(Ot(e=>!e),ue(()=>{}));selectionChange=new yt;valueChange=new yt;constructor(){let e=g(We),t=g(an,{optional:true}),i=g(En,{optional:true}),n=g(new am("tabindex"),{optional:true}),r=g(Et,{optional:true}),d=g(at$1,{optional:true,self:true});this.ngControl&&(this.ngControl.valueAccessor=this),this._defaultOptions?.typeaheadDebounceInterval!=null&&(this.typeaheadDebounceInterval=this._defaultOptions.typeaheadDebounceInterval),this._errorStateTracker=new Qt$1(e,d||this.ngControl,i,t,this.stateChanges),this._scrollStrategy=this._scrollStrategyFactory(),this.tabIndex=n==null?0:parseInt(n)||0,this._popoverLocation=r?.usePopover===false?null:"inline",this.id=this.id;}ngOnInit(){this._selectionModel=new gt(this.multiple),this.stateChanges.next(),this._viewportRuler.change().pipe(Vy(this._destroy)).subscribe(()=>{this.panelOpen&&(this._overlayWidth=this._getOverlayWidth(this._preferredOverlayOrigin),this._changeDetectorRef.detectChanges());});}ngAfterContentInit(){this._initialized.next(),this._initialized.complete(),this._initKeyManager(),this._selectionModel.changed.pipe(Vy(this._destroy)).subscribe(e=>{e.added.forEach(t=>t.select()),e.removed.forEach(t=>t.deselect());}),this.options.changes.pipe(bd(null),Vy(this._destroy)).subscribe(()=>{this._resetOptions(),this._initializeSelection();});}ngDoCheck(){let e=this._getTriggerAriaLabelledby(),t=this.ngControl;if(e!==this._triggerAriaLabelledBy){let i=this._elementRef.nativeElement;this._triggerAriaLabelledBy=e,e?i.setAttribute("aria-labelledby",e):i.removeAttribute("aria-labelledby");}t&&(this._previousControl!==t.control&&(this._previousControl!==void 0&&t.disabled!==null&&t.disabled!==this.disabled&&(this.disabled=t.disabled),this._previousControl=t.control),this.updateErrorState());}ngOnChanges(e){(e.disabled||e.userAriaDescribedBy)&&this.stateChanges.next(),e.typeaheadDebounceInterval&&this._keyManager&&this._keyManager.withTypeAhead(this.typeaheadDebounceInterval),e.panelClass&&this.panelClass instanceof Set&&(this.panelClass=Array.from(this.panelClass));}ngOnDestroy(){this._cleanupDetach?.(),this._keyManager?.destroy(),this._destroy.next(),this._destroy.complete(),this.stateChanges.complete();}toggle(){this.panelOpen?this.close():this.open();}open(){this._canOpen()&&(this._parentFormField&&(this._preferredOverlayOrigin=this._parentFormField.getConnectedOverlayOrigin()),this._cleanupDetach?.(),this._overlayWidth=this._getOverlayWidth(this._preferredOverlayOrigin),this._panelOpen=true,this._overlayDir.positionChange.pipe(sn(1)).subscribe(()=>{this._changeDetectorRef.detectChanges(),this._positioningSettled();}),this._overlayDir.attachOverlay(),this._keyManager.withHorizontalOrientation(null),this._highlightCorrectOption(),this._changeDetectorRef.markForCheck(),this.stateChanges.next(),Promise.resolve().then(()=>this.openedChange.emit(true)));}close(){this._panelOpen&&(this._panelOpen=false,this._exitAndDetach(),this._keyManager.withHorizontalOrientation(this._isRtl()?"rtl":"ltr"),this._changeDetectorRef.markForCheck(),this._onTouched(),this.stateChanges.next(),Promise.resolve().then(()=>this.openedChange.emit(false)));}_exitAndDetach(){if(this._animationsDisabled||!this.panel){this._detachOverlay();return}this._cleanupDetach?.(),this._cleanupDetach=()=>{t(),clearTimeout(i),this._cleanupDetach=void 0;};let e=this.panel.nativeElement,t=this._renderer.listen(e,"animationend",n=>{n.animationName==="_mat-select-exit"&&(this._cleanupDetach?.(),this._detachOverlay());}),i=setTimeout(()=>{this._cleanupDetach?.(),this._detachOverlay();},200);e.classList.add("mat-select-panel-exit");}_detachOverlay(){this._overlayDir.detachOverlay(),this._changeDetectorRef.markForCheck();}writeValue(e){this._assignValue(e);}registerOnChange(e){this._onChange=e;}registerOnTouched(e){this._onTouched=e;}setDisabledState(e){this.disabled=e,this._changeDetectorRef.markForCheck(),this.stateChanges.next();}get panelOpen(){return this._panelOpen}get selected(){return this.multiple?this._selectionModel?.selected||[]:this._selectionModel?.selected[0]}get triggerValue(){if(this.empty)return "";if(this._multiple){let e=this._selectionModel.selected.map(t=>t.viewValue);return this._isRtl()&&e.reverse(),e.join(", ")}return this._selectionModel.selected[0].viewValue}updateErrorState(){this._errorStateTracker.updateErrorState();}_isRtl(){return this._dir?this._dir.value==="rtl":false}_handleKeydown(e){this.disabled||(this.panelOpen?this._handleOpenKeydown(e):this._handleClosedKeydown(e));}_handleClosedKeydown(e){let t=e.keyCode,i=t===40||t===38||t===37||t===39,n=t===13||t===32,r=this._keyManager;if(!r.isTyping()&&n&&!Ve(e)||(this.multiple||e.altKey)&&i)e.preventDefault(),this.open();else if(!this.multiple){let d=this.selected;r.onKeydown(e);let o=this.selected;o&&d!==o&&this._liveAnnouncer.announce(o.viewValue,1e4);}}_handleOpenKeydown(e){let t=this._keyManager,i=e.keyCode,n=i===40||i===38,r=t.isTyping();if(n&&e.altKey)e.preventDefault(),this.close();else if(!r&&(i===13||i===32)&&t.activeItem&&!Ve(e))e.preventDefault(),t.activeItem._selectViaInteraction();else if(!r&&this._multiple&&i===65&&e.ctrlKey){e.preventDefault();let d=this.options.some(o=>!o.disabled&&!o.selected);this.options.forEach(o=>{o.disabled||(d?o.select():o.deselect());});}else {let d=t.activeItemIndex;t.onKeydown(e),this._multiple&&n&&e.shiftKey&&t.activeItem&&t.activeItemIndex!==d&&t.activeItem._selectViaInteraction();}}_handleOverlayKeydown(e){e.keyCode===27&&!Ve(e)&&(e.preventDefault(),this.close());}_onFocus(){this.disabled||(this._focused=true,this.stateChanges.next());}_onBlur(){this._focused=false,this._keyManager?.cancelTypeahead(),!this.disabled&&!this.panelOpen&&(this._onTouched(),this._changeDetectorRef.markForCheck(),this.stateChanges.next());}get empty(){return !this._selectionModel||this._selectionModel.isEmpty()}_initializeSelection(){Promise.resolve().then(()=>{this.ngControl&&(this._value=this.ngControl.value),this._setSelectionByValue(this._value),this.stateChanges.next();});}_setSelectionByValue(e){if(this.options.forEach(t=>t.setInactiveStyles()),this._selectionModel.clear(),this.multiple&&e)e.forEach(t=>this._selectOptionByValue(t)),this._sortValues();else {let t=this._selectOptionByValue(e);t?this._keyManager.updateActiveItem(t):this.panelOpen||this._keyManager.updateActiveItem(-1);}this._changeDetectorRef.markForCheck();}_selectOptionByValue(e){let t=this.options.find(i=>{if(this._selectionModel.isSelected(i))return false;try{return (i.value!=null||this.canSelectNullableOptions)&&this._compareWith(i.value,e)}catch(n){return false}});return t&&this._selectionModel.select(t),t}_assignValue(e){return e!==this._value||this._multiple&&Array.isArray(e)?(this.options&&this._setSelectionByValue(e),this._value=e,true):false}_skipPredicate=e=>this.panelOpen?false:e.disabled;_getOverlayWidth(e){return this.panelWidth==="auto"?(e instanceof Rt?e.elementRef:e||this._elementRef).nativeElement.getBoundingClientRect().width:this.panelWidth===null?"":this.panelWidth}_syncParentProperties(){if(this.options)for(let e of this.options)e._changeDetectorRef.markForCheck();}_initKeyManager(){this._keyManager=new Pt$1(this.options).withTypeAhead(this.typeaheadDebounceInterval).withVerticalOrientation().withHorizontalOrientation(this._isRtl()?"rtl":"ltr").withHomeAndEnd().withPageUpDown().withAllowedModifierKeys(["shiftKey"]).skipPredicate(this._skipPredicate),this._keyManager.tabOut.subscribe(()=>{this.panelOpen&&(!this.multiple&&this._keyManager.activeItem&&this._keyManager.activeItem._selectViaInteraction(),this.focus(),this.close());}),this._keyManager.change.subscribe(()=>{this._panelOpen&&this.panel?this._scrollOptionIntoView(this._keyManager.activeItemIndex||0):!this._panelOpen&&!this.multiple&&this._keyManager.activeItem&&this._keyManager.activeItem._selectViaInteraction();});}_resetOptions(){let e=Yy(this.options.changes,this._destroy);this.optionSelectionChanges.pipe(Vy(e)).subscribe(t=>{this._onSelect(t.source,t.isUserInput),t.isUserInput&&!this.multiple&&this._panelOpen&&(this.close(),this.focus());}),Yy(...this.options.map(t=>t._stateChanges)).pipe(Vy(e)).subscribe(()=>{this._changeDetectorRef.detectChanges(),this.stateChanges.next();});}_onSelect(e,t){let i=this._selectionModel.isSelected(e);!this.canSelectNullableOptions&&e.value==null&&!this._multiple?(e.deselect(),this._selectionModel.clear(),this.value!=null&&this._propagateChanges(e.value)):(i!==e.selected&&(e.selected?this._selectionModel.select(e):this._selectionModel.deselect(e)),t&&this._keyManager.setActiveItem(e),this.multiple&&(this._sortValues(),t&&this.focus())),i!==this._selectionModel.isSelected(e)&&this._propagateChanges(),this.stateChanges.next();}_sortValues(){if(this.multiple){let e=this.options.toArray();this._selectionModel.sort((t,i)=>this.sortComparator?this.sortComparator(t,i,e):e.indexOf(t)-e.indexOf(i)),this.stateChanges.next();}}_propagateChanges(e){let t;this.multiple?t=this.selected.map(i=>i.value):t=this.selected?this.selected.value:e,this._value=t,this.valueChange.emit(t),this._onChange(t),this.selectionChange.emit(this._getChangeEvent(t)),this._changeDetectorRef.markForCheck();}_highlightCorrectOption(){if(this._keyManager)if(this.empty){let e=-1;for(let t=0;t<this.options.length;t++)if(!this.options.get(t).disabled){e=t;break}this._keyManager.setActiveItem(e);}else this._keyManager.setActiveItem(this._selectionModel.selected[0]);}_canOpen(){return !this._panelOpen&&!this.disabled&&this.options?.length>0&&!!this._overlayDir}focus(e){this._elementRef.nativeElement.focus(e);}_getPanelAriaLabelledby(){if(this.ariaLabel)return null;let e=this._parentFormField?.getLabelId()||null,t=e?e+" ":"";return this.ariaLabelledby?t+this.ariaLabelledby:e}_getAriaActiveDescendant(){return this.panelOpen&&this._keyManager&&this._keyManager.activeItem?this._keyManager.activeItem.id:null}_getTriggerAriaLabelledby(){if(this.ariaLabel)return null;let e=this._parentFormField?.getLabelId()||"";return this.ariaLabelledby&&(e+=" "+this.ariaLabelledby),e||(e=this._valueId),e}get describedByIds(){return this._elementRef.nativeElement.getAttribute("aria-describedby")?.split(" ")||[]}setDescribedByIds(e){let t=this._elementRef.nativeElement;e.length?t.setAttribute("aria-describedby",e.join(" ")):t.removeAttribute("aria-describedby");}onContainerClick(e){let t=E(e);t&&(t.tagName==="MAT-OPTION"||t.classList.contains("cdk-overlay-backdrop")||t.closest(".mat-mdc-select-panel"))||(this.focus(),this.open());}get shouldLabelFloat(){return this.panelOpen||!this.empty||this.focused&&!!this.placeholder}static \u0275fac=function(t){return new(t||a)};static \u0275cmp=Aw({type:a,selectors:[["mat-select"]],contentQueries:function(t,i,n){if(t&1&&kg(n,at,5)(n,Fn,5)(n,Hi$1,5),t&2){let r;IC(r=wC())&&(i.customTrigger=r.first),IC(r=wC())&&(i.options=r),IC(r=wC())&&(i.optionGroups=r);}},viewQuery:function(t,i){if(t&1&&Fg(Qe,5)(Ye,5)(_e$1,5),t&2){let n;IC(n=wC())&&(i.trigger=n.first),IC(n=wC())&&(i.panel=n.first),IC(n=wC())&&(i._overlayDir=n.first);}},hostAttrs:["role","combobox","aria-haspopup","listbox",1,"mat-mdc-select"],hostVars:21,hostBindings:function(t,i){t&1&&Ag("keydown",function(r){return i._handleKeydown(r)})("focus",function(){return i._onFocus()})("blur",function(){return i._onBlur()}),t&2&&(Cg("id",i.id)("tabindex",i.disabled?-1:i.tabIndex)("aria-controls",i.panelOpen?i.id+"-panel":null)("aria-expanded",i.panelOpen)("aria-label",i.ariaLabel||null)("aria-required",i.required.toString())("aria-disabled",i.disabled.toString())("aria-invalid",i.errorState)("aria-activedescendant",i._getAriaActiveDescendant()),Hg("mat-mdc-select-disabled",i.disabled)("mat-mdc-select-invalid",i.errorState)("mat-mdc-select-required",i.required)("mat-mdc-select-empty",i.empty)("mat-mdc-select-multiple",i.multiple)("mat-select-open",i.panelOpen));},inputs:{userAriaDescribedBy:[0,"aria-describedby","userAriaDescribedBy"],panelClass:"panelClass",disabled:[2,"disabled","disabled",YT],disableRipple:[2,"disableRipple","disableRipple",YT],tabIndex:[2,"tabIndex","tabIndex",e=>e==null?0:QT(e)],hideSingleSelectionIndicator:[2,"hideSingleSelectionIndicator","hideSingleSelectionIndicator",YT],placeholder:"placeholder",required:[2,"required","required",YT],multiple:[2,"multiple","multiple",YT],disableOptionCentering:[2,"disableOptionCentering","disableOptionCentering",YT],compareWith:"compareWith",value:"value",ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],errorStateMatcher:"errorStateMatcher",typeaheadDebounceInterval:[2,"typeaheadDebounceInterval","typeaheadDebounceInterval",QT],sortComparator:"sortComparator",id:"id",panelWidth:"panelWidth",canSelectNullableOptions:[2,"canSelectNullableOptions","canSelectNullableOptions",YT]},outputs:{openedChange:"openedChange",_openedStream:"opened",_closedStream:"closed",selectionChange:"selectionChange",valueChange:"valueChange"},exportAs:["matSelect"],features:[nT([{provide:de,useExisting:a},{provide:zi,useExisting:a}]),Cu],ngContentSelectors:Xe,decls:11,vars:10,consts:[["fallbackOverlayOrigin","cdkOverlayOrigin","trigger",""],["panel",""],["cdk-overlay-origin","",1,"mat-mdc-select-trigger",3,"click"],[1,"mat-mdc-select-value"],[1,"mat-mdc-select-placeholder","mat-mdc-select-min-line"],[1,"mat-mdc-select-value-text"],[1,"mat-mdc-select-arrow-wrapper"],[1,"mat-mdc-select-arrow"],["viewBox","0 0 24 24","width","24px","height","24px","focusable","false","aria-hidden","true"],["d","M7 10l5 5 5-5z"],["cdk-connected-overlay","","cdkConnectedOverlayHasBackdrop","","cdkConnectedOverlayBackdropClass","cdk-overlay-transparent-backdrop",3,"detach","backdropClick","overlayKeydown","cdkConnectedOverlayDisableClose","cdkConnectedOverlayPanelClass","cdkConnectedOverlayScrollStrategy","cdkConnectedOverlayOrigin","cdkConnectedOverlayPositions","cdkConnectedOverlayWidth","cdkConnectedOverlayFlexibleDimensions","cdkConnectedOverlayUsePopover"],[1,"mat-mdc-select-min-line"],["role","listbox","tabindex","-1",1,"mat-mdc-select-panel","mdc-menu-surface","mdc-menu-surface--open",3,"keydown"]],template:function(t,i){if(t&1&&(vC(Ue),vs(0,"div",2,0),Ag("click",function(){return i.open()}),vs(3,"div",3),eC(4,Je,2,1,"span",4)(5,et,3,1,"span",5),fl(),vs(6,"div",6)(7,"div",7),kf(),vs(8,"svg",8),bg(9,"path",9),fl()()()(),Dg(10,tt,3,16,"ng-template",10),Ag("detach",function(){return i.close()})("backdropClick",function(){return i.close()})("overlayKeydown",function(r){return i._handleOverlayKeydown(r)})),t&2){let n=TC(1);XE(3),Cg("id",i._valueId),XE(),tC(i.empty?4:5),XE(6),Tg("cdkConnectedOverlayDisableClose",true)("cdkConnectedOverlayPanelClass",i._overlayPanelClass)("cdkConnectedOverlayScrollStrategy",i._scrollStrategy)("cdkConnectedOverlayOrigin",i._preferredOverlayOrigin||n)("cdkConnectedOverlayPositions",i._positions)("cdkConnectedOverlayWidth",i._overlayWidth)("cdkConnectedOverlayFlexibleDimensions",true)("cdkConnectedOverlayUsePopover",i._popoverLocation);}},dependencies:[Rt,_e$1],styles:[`@keyframes _mat-select-enter {
2
2
  from {
3
3
  opacity: 0;
4
4
  transform: scaleY(0.8);