@whoz-oss/coday-client 1.3.4 → 1.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/{chunk-BbOdBhQy.js → chunk-9ZIVSIz9.js} +1 -1
- package/browser/{chunk-Brj8HlXc.js → chunk-ALF3Etyg.js} +1 -1
- package/browser/{chunk-3QjpTDpt.js → chunk-ALup_Ly_.js} +1 -1
- package/browser/{chunk-CekA5yLC.js → chunk-B1vCx0Aw.js} +1 -1
- package/browser/{chunk-CTjZECqR.js → chunk-B5WBKaLQ.js} +1 -1
- package/browser/{chunk-DLhvPTZP.js → chunk-B5hayZW5.js} +1 -1
- package/browser/{chunk-_Wj2M8II.js → chunk-BC3HH9Va.js} +1 -1
- package/browser/{chunk-i62b6Gtt.js → chunk-BIPTZVDt.js} +1 -1
- package/browser/{chunk-_kolzKbl.js → chunk-BJDJk0Qw.js} +1 -1
- package/browser/{chunk-Cy-MbcIf.js → chunk-BOeKkAt9.js} +1 -1
- package/browser/{chunk-Cek4dv2K.js → chunk-BPJN1TJ6.js} +1 -1
- package/browser/{chunk-Bc_JiT75.js → chunk-BUhk1lXE.js} +1 -1
- package/browser/{chunk-Cm42_zF7.js → chunk-BXjEydcy.js} +1 -1
- package/browser/{chunk-CH0b9ss9.js → chunk-B_mBd-rJ.js} +1 -1
- package/browser/{chunk-CbSC-SSJ.js → chunk-BaLweBz6.js} +1 -1
- package/browser/{chunk-D1ggthOI.js → chunk-BabsTpOI.js} +1 -1
- package/browser/{chunk-By4bK8Lp.js → chunk-Bgpsos5f.js} +1 -1
- package/browser/{chunk-CpMYZ9dG.js → chunk-BmuS0ENl.js} +1 -1
- package/browser/{chunk-eqpKdy80.js → chunk-BpE5xudb.js} +1 -1
- package/browser/{chunk-vkYtcaIT.js → chunk-BqE69IJ1.js} +1 -1
- package/browser/{chunk-DgFkTqkZ.js → chunk-Br-xdmwY.js} +1 -1
- package/browser/{chunk-hL6iczXD.js → chunk-BunwHHGw.js} +1 -1
- package/browser/{chunk-DXVBbChn.js → chunk-BxdDXOEe.js} +1 -1
- package/browser/{chunk-8RFsf09R.js → chunk-C6kRPJL_.js} +1 -1
- package/browser/{chunk-CeTVH-vp.js → chunk-C6mFVPqf.js} +1 -1
- package/browser/{chunk-C8qVsVH8.js → chunk-CLDRxFlZ.js} +1 -1
- package/browser/{chunk-BxT6IsjS.js → chunk-CMmtnH6_.js} +1 -1
- package/browser/{chunk-DpRS0jIN.js → chunk-CNG_Bi14.js} +1 -1
- package/browser/{chunk-CTx3Z0hA.js → chunk-CTyQQD3V.js} +1 -1
- package/browser/{chunk-X4zIHpcE.js → chunk-CZnExQ8R.js} +1 -1
- package/browser/{chunk-BDqV-dXo.js → chunk-Cd2C0rIT.js} +1 -1
- package/browser/{chunk-BYAMVo7F.js → chunk-CfYSvYjI.js} +1 -1
- package/browser/{chunk-7IEj5tud.js → chunk-CgvdMQUi.js} +1 -1
- package/browser/{chunk-OpV-oEpT.js → chunk-Ckg9-rFg.js} +1 -1
- package/browser/{chunk-BGM4NjUk.js → chunk-CnkX6sMv.js} +1 -1
- package/browser/{chunk-CywonzJi.js → chunk-CubZY2rj.js} +1 -1
- package/browser/{chunk-CisLHTrk.js → chunk-D26OOz0C.js} +1 -1
- package/browser/{chunk-_si25xRH.js → chunk-D4ES5TMV.js} +1 -1
- package/browser/{chunk-BhKcjruH.js → chunk-D73vXOHn.js} +1 -1
- package/browser/chunk-D8_VVodV.js +1 -0
- package/browser/{chunk-9rFJllaP.js → chunk-D9kPNzC_.js} +1 -1
- package/browser/{chunk-CJpYYZh2.js → chunk-DCFeDlSq.js} +1 -1
- package/browser/{chunk-DWrJdp3G.js → chunk-DDhqox9Y.js} +1 -1
- package/browser/{chunk-DJz2cMcV.js → chunk-DLXvIMAi.js} +1 -1
- package/browser/{chunk-BfoCTjUr.js → chunk-DNDvYXLF.js} +1 -1
- package/browser/{chunk-Cb82rqle.js → chunk-DPOrpckU.js} +5 -5
- package/browser/{chunk-CFw8eyQX.js → chunk-DPfl06Mj.js} +1 -1
- package/browser/{chunk-S_TYzsa6.js → chunk-DW0qghBO.js} +1 -1
- package/browser/{chunk-DoS8-ZTX.js → chunk-DYB4CuDq.js} +1 -1
- package/browser/{chunk-Lluy_pM_.js → chunk-D_f8A0gu.js} +1 -1
- package/browser/{chunk-BMBD8g8i.js → chunk-DaR7d7B8.js} +1 -1
- package/browser/{chunk-eCkjwC-y.js → chunk-DajFJ9f4.js} +1 -1
- package/browser/{chunk-B3mPWOwM.js → chunk-Dd1MXCU4.js} +1 -1
- package/browser/{chunk-Bj9y8qST.js → chunk-DdQGvevi.js} +1 -1
- package/browser/{chunk-CInfUnUL.js → chunk-DhQrwAbV.js} +1 -1
- package/browser/{chunk-DvV6rFWO.js → chunk-DiDEqeDl.js} +1 -1
- package/browser/{chunk-DVSN51SP.js → chunk-DtIy18G6.js} +1 -1
- package/browser/{chunk-CrExrE4n.js → chunk-DvruZLJd.js} +1 -1
- package/browser/{chunk-NPBU5yIa.js → chunk-DxrUPGvH.js} +1 -1
- package/browser/{chunk-CsvLyu6R.js → chunk-Dz0byKBh.js} +1 -1
- package/browser/{chunk-zyGtaVKQ.js → chunk-DzItpRbk.js} +1 -1
- package/browser/{chunk-CVuNrNOH.js → chunk-Fa0LLSZf.js} +1 -1
- package/browser/{chunk-CXVQ4M5H.js → chunk-IeUdKidF.js} +1 -1
- package/browser/{chunk-DFaRJnOg.js → chunk-OltVHUw7.js} +1 -1
- package/browser/{chunk-hcl2JPuw.js → chunk-XZia3sF0.js} +1 -1
- package/browser/{chunk-xk_bqNV0.js → chunk-j91G9621.js} +1 -1
- package/browser/index.html +1 -1
- package/browser/{main-FEA3BAHM.js → main-5DW6JQ3Z.js} +1 -1
- package/package.json +1 -1
- package/browser/chunk-Cm35aeo6.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Q as Qe,Y as Ye$1,E as Et$1,y as yt$3}from'./chunk-
|
|
1
|
+
import {Q as Qe,Y as Ye$1,E as Et$1,y as yt$3}from'./chunk-XZia3sF0.js';import {an as ce,al as yt$1,g,O as Ot$1,F,u as ue,H as Hi,m as mT,R as Re,P,K as c,G,L,U,ap as Vy,A as Aw,i as hr,j as Gn,bz as vC,n as eC,v as vs,l as Ag,W as WC,k as fl,bA as DC,o as bg,t as tC,X as XE,y as Hg,r as Tg,C as Cg,bj as yh,a8 as Zg,D as Fg,I as IC,E as wC,aK as Do,aL as qn,aN as wt$1,ca as mB,N,h as he,w as we$1,cc as Hf,z as z$1,a as P$1,b as U$1,cd as Sb,Q as By,q as oC,x as iC,aw as pl,bn as nC,ax as hl,b5 as Sg,b$ as Ng,ad as Vg,a9 as dC,aa as If,ac as mC,ab as wf,ai as Jg,aj as KC,a3 as HI,ak as Xg,a6 as $I,af as Dg,ag as fT,a5 as yl,aF as me$1,ae as Ot$2,ce as W$1,Y as x,T as TC,cf as iT,cg as Mg,b3 as oT}from'./main-5DW6JQ3Z.js';import {W}from'./chunk-DiDEqeDl.js';import {T as Tn$1,c as ce$1}from'./chunk-DNDvYXLF.js';import {u as ui,a as me,f as fi,Y as Yt$1,H as He,V as Ve,n as ne}from'./chunk-CMmtnH6_.js';import {t as ti,Y as Ye,Z as Zn,c as cn$1,y as yt$2,w as wt,X as Xt$1}from'./chunk-OltVHUw7.js';var bt=(()=>{class n{static \u0275fac=function(i){return new(i||n)};static \u0275mod=Do({type:n});static \u0275inj=qn({imports:[wt$1]})}return n})();var Tt=(n,t)=>({subThreads:n,depth:t}),Ot=n=>({subThreads:n,depth:1}),xt=(n,t)=>t.id,kt=(n,t)=>t.label;function Et(n,t){if(n&1){let e=dC();vs(0,"mat-icon",10),Ag("click",function(o){If(e);let s=mC().$implicit,f=mC(3);return wf(f.toggleSubThreads(o,s.id))}),WC(1),fl();}if(n&2){let e=mC().$implicit,i=mC(3);XE(),Zg(i.isParentExpanded(e.id)?"expand_more":"chevron_right");}}function Dt(n,t){n&1&&Mg(0);}function Nt(n,t){if(n&1&&Dg(0,Dt,1,0,"ng-container",11),n&2){let e=mC().$implicit,i=mC().depth;mC();let o=TC(1);Tg("ngTemplateOutlet",o)("ngTemplateOutletContext",iT(2,Tt,e.subThreads,i+1));}}function jt(n,t){if(n&1){let e=dC();vs(0,"div",5)(1,"a",6),Ag("click",function(o){let s=If(e).$implicit;return mC(3).selectThread(s.id),wf(o.preventDefault())})("keydown.enter",function(o){let s=If(e).$implicit;return mC(3).selectThread(s.id),wf(o.preventDefault())})("keydown.space",function(o){let s=If(e).$implicit;return mC(3).selectThread(s.id),wf(o.preventDefault())}),eC(2,Et,2,1,"mat-icon",7),vs(3,"span",8),WC(4),fl(),vs(5,"span",9),WC(6),fl()()(),eC(7,Nt,1,5,"ng-container");}if(n&2){let e=t.$implicit,i=mC().depth,o=mC(2);Vg("--sub-depth",i),Hg("current",e.id===o.currentThread()?.id),XE(2),tC(e.subThreads?.length?2:-1),XE(2),Zg(e.delegatedAgentName||"Agent"),XE(2),Zg(e.delegatedTask||e.name),XE(),tC(o.isParentExpanded(e.id)&&e.subThreads?.length?7:-1);}}function Vt(n,t){if(n&1&&oC(0,jt,8,8,null,null,xt),n&2){let e=t.subThreads;iC(e);}}function Ft(n,t){n&1&&(vs(0,"div",4),bg(1,"span",12),vs(2,"span",13),WC(3,"Loading threads..."),fl()());}function It(n,t){if(n&1&&(vs(0,"div",27),WC(1),fl()),n&2){let e=mC(6);XE(),Zg(e.renameErrorMessage);}}function zt(n,t){if(n&1){let e=dC();vs(0,"div",18)(1,"input",26),Jg("ngModelChange",function(o){If(e);let s=mC(5);return KC(s.editingThreadName,o)||(s.editingThreadName=o),wf(o)}),Ag("keydown",function(o){If(e);let s=mC(5);return wf(s.onEditKeydown(o))})("blur",function(){If(e);let o=mC(5);return wf(o.onEditBlur())})("click",function(o){return o.stopPropagation()}),fl(),HI(),eC(2,It,2,1,"div",27),fl();}if(n&2){let e=mC(5);XE(),Xg("ngModel",e.editingThreadName),Tg("disabled",e.isRenamingThread),$I(),XE(),tC(e.renameErrorMessage?2:-1);}}function At(n,t){if(n&1){let e=dC();vs(0,"mat-icon",10),Ag("click",function(o){If(e);let s=mC(2).$implicit,f=mC(4);return wf(f.toggleSubThreads(o,s.id))}),WC(1),fl();}if(n&2){let e=mC(2).$implicit,i=mC(4);XE(),Zg(i.isParentExpanded(e.id)?"expand_more":"chevron_right");}}function Lt(n,t){if(n&1&&(vs(0,"span",29),WC(1),fl()),n&2){let e=mC(2).$implicit;XE(),Zg(e.name);}}function Rt(n,t){n&1&&(bg(0,"mat-spinner",31),vs(1,"span",32),WC(2,"Generating name..."),fl()),n&2&&Tg("diameter",16);}function $t(n,t){n&1&&(vs(0,"mat-icon",30),WC(1,"group"),fl());}function Bt(n,t){if(n&1){let e=dC();vs(0,"a",28),Ag("click",function(o){If(e);let s=mC().$implicit;return mC(4).selectThread(s.id),wf(o.preventDefault())})("keydown.enter",function(o){If(e);let s=mC().$implicit;return mC(4).selectThread(s.id),wf(o.preventDefault())})("keydown.space",function(o){If(e);let s=mC().$implicit;return mC(4).selectThread(s.id),wf(o.preventDefault())}),eC(1,At,2,1,"mat-icon",7),eC(2,Lt,2,1,"span",29)(3,Rt,3,1),eC(4,$t,2,0,"mat-icon",30),fl();}if(n&2){let e=mC().$implicit,i=mC(4);Tg("matTooltip",e.name?e.name+`
|
|
2
2
|
|
|
3
3
|
`+(e.summary||""):e.summary||"")("matTooltipDisabled",!e.summary),XE(),tC(e.subThreads?.length?1:-1),XE(),tC(e.name?2:3),XE(2),tC(i.isSharedThread(e)?4:-1);}}function Ut(n,t){if(n&1){let e=dC();vs(0,"button",33),Ag("click",function(o){If(e);let s=mC().$implicit,f=mC(4);return wf(f.startEditingThreadName(o,s))}),vs(1,"mat-icon"),WC(2,"edit"),fl()();}}function Xt(n,t){if(n&1){let e=dC();vs(0,"button",34),Ag("click",function(o){If(e);let s=mC().$implicit,f=mC(4);return wf(f.markActive(o,s))}),vs(1,"mat-icon"),WC(2,"replay"),fl()();}}function Qt(n,t){if(n&1){let e=dC();vs(0,"button",35),Ag("click",function(o){If(e);let s=mC().$implicit,f=mC(4);return wf(f.markDone(o,s))}),vs(1,"mat-icon"),WC(2,"check_circle_outline"),fl()();}}function Gt(n,t){n&1&&Mg(0);}function Ht(n,t){if(n&1&&Dg(0,Gt,1,0,"ng-container",11),n&2){let e=mC().$implicit;mC(3);let i=TC(1);Tg("ngTemplateOutlet",i)("ngTemplateOutletContext",oT(2,Ot,e.subThreads));}}function qt(n,t){if(n&1){let e=dC();vs(0,"div",17),eC(1,zt,3,3,"div",18)(2,Bt,5,5,"a",19),vs(3,"div",20),eC(4,Ut,3,0,"button",21),eC(5,Xt,3,0,"button",22)(6,Qt,3,0,"button",23),vs(7,"button",24),Ag("click",function(o){let s=If(e).$implicit,f=mC(4);return wf(f.toggleStar(o,s))}),vs(8,"mat-icon"),WC(9),fl()(),vs(10,"button",25),Ag("click",function(o){let s=If(e).$implicit,f=mC(4);return wf(f.deleteThread(o,s))}),vs(11,"mat-icon"),WC(12,"delete"),fl()()()(),eC(13,Ht,1,4,"ng-container");}if(n&2){let e=t.$implicit,i=mC(4);Hg("current",e.id===i.currentThread()?.id),XE(),tC(i.editingThreadId===e.id?1:2),XE(3),tC(i.editingThreadId!==e.id&&e.name?4:-1),XE(),tC(e.closedByUser?5:6),XE(2),Hg("starred",i.isStarred(e)),Tg("title",i.isStarred(e)?"Unstar thread":"Star thread"),XE(2),Zg(i.isStarred(e)?"star":"star_outline"),XE(4),tC(i.isParentExpanded(e.id)&&e.subThreads?.length?13:-1);}}function Wt(n,t){if(n&1&&(vs(0,"div",14)(1,"div",16),WC(2),fl(),oC(3,qt,14,10,null,null,xt),fl()),n&2){let e=t.$implicit;XE(2),Zg(e.label),XE(),iC(e.threads);}}function Jt(n,t){n&1&&(vs(0,"div",15),WC(1,"No existing threads"),fl());}function Yt(n,t){if(n&1&&(vs(0,"div",15),WC(1),fl()),n&2){let e=mC(3);XE(),yl('No threads matching "',e.searchQuery(),'"');}}function Zt(n,t){if(n&1&&(oC(0,Wt,5,1,"div",14,kt),eC(2,Jt,2,0,"div",15)(3,Yt,2,1,"div",15)),n&2){let e=mC(2);iC(e.getGroupedThreads()),XE(2),tC(!e.threads()?.length&&!e.searchQuery()?2:e.searchQuery()&&e.getGroupedThreads().length===0?3:-1);}}function Kt(n,t){if(n&1&&(Dg(0,Vt,2,0,"ng-template",null,0,fT),vs(2,"div",3),eC(3,Ft,4,0,"div",4)(4,Zt,4,1),fl()),n&2){let e=mC();XE(3),tC(e.isLoadingThreadList()?3:4);}}function en(n,t){n&1&&(vs(0,"span",36),WC(1,"No project selected"),fl());}function tn(n,t){n&1&&(vs(0,"span",36),WC(1,"Loading..."),fl());}function nn(n,t){if(n&1&&(vs(0,"div",2),eC(1,en,2,0,"span",36)(2,tn,2,0,"span",36),fl()),n&2){let e=mC();XE(),tC(e.currentProject()?.name?2:1);}}var we=class n{projects=null;searchMode=false;searchQuery=mB("");searchModeChange=new yt$1;threadSelected=new yt$1;projectStateService=g(P);threadStateService=g(U);threadApiService=g(N);userService=g(he);router=g(G);destroyRef=g(we$1);currentThread=F(this.threadStateService.selectedThread$);currentProject=F(this.projectStateService.selectedProject$);threads=F(this.threadStateService.threadList$);isLoadingThreadList=F(this.threadStateService.isLoadingThreadList$);username=F(this.userService.username$);isTouchDevice="ontouchstart"in window||navigator.maxTouchPoints>0;editingThreadId=null;editingThreadName="";isRenamingThread=false;renameErrorMessage="";expandedParents=new Set;constructor(){Hf(()=>{let t=this.currentThread()?.id,e=this.threads();if(!t||!e?.length)return;let i=new Map;for(let s of e)s.parentThreadId&&i.set(s.id,s.parentThreadId);let o=t;for(;o;){let s=i.get(o);s&&this.expandedParents.add(s),o=s;}});}ngOnInit(){this.userService.fetchCurrentUser().subscribe({error:t=>{console.error("[THREAD-SELECTOR] Failed to load current user:",t);}});}selectThread(t){this.threadStateService.selectThread(t),this.threadSelected.emit(),this.router.navigate(["project",this.currentProject()?.name,"thread",t]);}getGroupedThreads(){let t=this.threads();if(!t?.length)return [];let e=new Set(t.map(h=>h.id)),i=t.filter(h=>!h.parentThreadId),o=t.filter(h=>!!h.parentThreadId),s=o.filter(h=>!e.has(h.parentThreadId)),f=o.filter(h=>e.has(h.parentThreadId)),A=new Map;for(let h of f){let O=h.parentThreadId;A.has(O)||A.set(O,[]),A.get(O).push(h);}let J=h=>(A.get(h)||[]).sort((j,I)=>j.modifiedDate>I.modifiedDate?-1:1).map(j=>z$1(P$1({},j),{subThreads:J(j.id)})),L=[...i,...s];if(this.searchQuery()&&this.searchQuery().trim()){let h=this.searchQuery().toLowerCase().trim();L=L.filter(O=>O.name.toLowerCase().includes(h)||O.summary&&O.summary.toLowerCase().includes(h));}if(!L.length)return [];let R=this.username();if(!R)return [];let Ie=L.map(h=>z$1(P$1({},h),{subThreads:J(h.id)})),ze=Ie.filter(h=>h.starring&&h.starring.includes(R)),Mt=Ie.filter(h=>!h.starring||!h.starring.includes(R)),Y=new Map,Ae=new Date;Ae.setHours(0,0,0,0);for(let h of Mt){let O=new Date(h.modifiedDate);O.setHours(0,0,0,0);let j=Ae.getTime()-O.getTime(),I=Math.floor(j/(1e3*60*60*24)),D;I===0?D="Today":I===1?D="Yesterday":I<7?D="This Week":I<30?D="This Month":I<90?D="Last 3 Months":D="Older",Y.has(D)||Y.set(D,[]),Y.get(D).push(h);}let Ee=[];if(ze.length>0){let h=[...ze].sort((O,j)=>O.modifiedDate>j.modifiedDate?-1:1);Ee.push({label:"Starred",threads:h});}return ["Today","Yesterday","This Week","This Month","Last 3 Months","Older"].filter(h=>Y.has(h)).forEach(h=>{Ee.push({label:h,threads:Y.get(h)});}),Ee}isParentExpanded(t){return this.expandedParents.has(t)}toggleSubThreads(t,e){t.stopPropagation(),this.expandedParents.has(e)?this.expandedParents.delete(e):this.expandedParents.add(e);}isSubThread(t){return !!t.parentThreadId}isSharedThread(t){return t.users&&t.users.length>1}isStarred(t){let e=this.username();return !!e&&t.starring&&t.starring.includes(e)}toggleStar(t,e){t.stopPropagation();let i=this.username();if(!i)return;let o=e.starring&&e.starring.includes(i),s=o?this.threadApiService.unstarThread(e.id):this.threadApiService.starThread(e.id);this.threadStateService.updateStarLocal(e.id,!o,i),s.pipe(U$1(this.destroyRef)).subscribe({next:()=>{},error:f=>{console.error("Error toggling star:",f),this.threadStateService.refreshThreadList();}});}markDone(t,e){t.stopPropagation(),this.threadStateService.markDone(e.id);}markActive(t,e){t.stopPropagation(),this.threadStateService.markActive(e.id);}deleteThread(t,e){t.stopPropagation();let i=this.currentProject()?.name;!i||!confirm(`Are you sure you want to delete the thread "${e.name}"?`)||this.threadApiService.deleteThread(e.id).subscribe({next:()=>{this.currentThread()?.id===e.id&&(this.threadStateService.clearSelection(),this.router.navigate(["project",i])),this.threadStateService.refreshThreadList();},error:s=>{console.error("Error deleting thread:",s),alert("Failed to delete thread. Please try again.");}});}formatDate(t){try{let e=new Date(t),o=new Date().getTime()-e.getTime(),s=Math.floor(o/(1e3*60*60*24));return s===0?"Today":s===1?"Yesterday":s<7?`${s} days ago`:e.toLocaleDateString("en-EN",{day:"numeric",month:"short"})}catch(e){return "No date"}}startEditingThreadName(t,e){t.stopPropagation(),this.editingThreadId=e.id,this.editingThreadName=e.name||"",this.renameErrorMessage="",setTimeout(()=>{let i=document.querySelector(".thread-name-input");i&&(i.focus(),i.select());},0);}cancelEditingThreadName(){this.editingThreadId=null,this.editingThreadName="",this.renameErrorMessage="";}saveThreadName(t){if(t&&t.stopPropagation(),!this.editingThreadId)return;let e=this.editingThreadName.trim();if(!e){this.renameErrorMessage="Thread name cannot be empty";return}if(e.length>200){this.renameErrorMessage="Thread name is too long (max 200 characters)";return}let i=this.editingThreadId;this.isRenamingThread=true,this.renameErrorMessage="",this.threadStateService.renameThread(i,e).subscribe({next:()=>{console.log("[THREAD-SELECTOR] Thread renamed successfully"),this.cancelEditingThreadName(),this.isRenamingThread=false;},error:o=>{console.error("[THREAD-SELECTOR] Error renaming thread:",o),this.renameErrorMessage=o.message||"Failed to rename thread",this.isRenamingThread=false;}});}onEditKeydown(t){t.key==="Enter"?(t.preventDefault(),t.stopPropagation(),this.saveThreadName()):t.key==="Escape"&&(t.preventDefault(),t.stopPropagation(),this.cancelEditingThreadName());}onEditBlur(){setTimeout(()=>{this.editingThreadId&&!this.isRenamingThread&&this.saveThreadName();},200);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Aw({type:n,selectors:[["app-thread-selector"]],inputs:{searchMode:"searchMode",searchQuery:[1,"searchQuery"]},outputs:{searchModeChange:"searchModeChange",threadSelected:"threadSelected"},decls:3,vars:1,consts:[["subThreadTemplate",""],["tabindex","0","role","application","aria-label","Thread selector",1,"thread-selector",3,"click","keydown"],[1,"thread-disabled"],["role","menu","aria-label","Thread selection",1,"thread-list"],[1,"thread-loading"],[1,"thread-item-wrapper","sub-thread"],["role","menuitem","tabindex","0",1,"thread-item","sub-thread-item",3,"click","keydown.enter","keydown.space"],[1,"sub-thread-toggle"],[1,"sub-thread-agent"],[1,"sub-thread-task"],[1,"sub-thread-toggle",3,"click"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[1,"loading-spinner"],[1,"loading-text"],[1,"thread-group"],[1,"thread-empty"],[1,"thread-group-header"],[1,"thread-item-wrapper"],[1,"thread-name-edit-wrapper"],["matTooltipShowDelay","1000","role","menuitem","tabindex","0",1,"thread-item",3,"matTooltip","matTooltipDisabled"],[1,"action-buttons"],["mat-icon-button","","title","Rename thread","type","button",1,"action-button","edit-button"],["mat-icon-button","","title","Mark as active","type","button",1,"action-button","mark-active-button"],["mat-icon-button","","title","Mark as done","type","button",1,"action-button","mark-done-button"],["mat-icon-button","","type","button",1,"action-button","star-button",3,"click","title"],["mat-icon-button","","title","Delete thread","type","button",1,"action-button","delete-button",3,"click"],["type","text","maxlength","200",1,"thread-name-input",3,"ngModelChange","keydown","blur","click","ngModel","disabled"],[1,"rename-error"],["matTooltipShowDelay","1000","role","menuitem","tabindex","0",1,"thread-item",3,"click","keydown.enter","keydown.space","matTooltip","matTooltipDisabled"],[1,"thread-name"],["matTooltip","Shared thread",1,"shared-indicator"],[1,"thread-name-spinner",3,"diameter"],[1,"thread-name","thread-name-generating"],["mat-icon-button","","title","Rename thread","type","button",1,"action-button","edit-button",3,"click"],["mat-icon-button","","title","Mark as active","type","button",1,"action-button","mark-active-button",3,"click"],["mat-icon-button","","title","Mark as done","type","button",1,"action-button","mark-done-button",3,"click"],[1,"disabled-text"]],template:function(e,i){e&1&&(vs(0,"div",1),Ag("click",function(s){return s.stopPropagation()})("keydown",function(s){return s.stopPropagation()}),eC(1,Kt,5,1)(2,nn,3,1,"div",2),fl()),e&2&&(XE(),tC(i.currentProject()?.name?1:2));},dependencies:[Sb,ti,Ye,Zn,Xt$1,cn$1,yt$2,wt,hr,Gn,Tn$1,ce$1,Et$1,yt$3,Ve,ne],styles:[".thread-selector[_ngcontent-%COMP%]{display:flex;flex-direction:column;width:100%;flex:1;min-height:0;overflow-x:hidden;overflow-y:auto}.thread-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:0;max-height:none;overflow:visible}.thread-group[_ngcontent-%COMP%]{display:flex;flex-direction:column;margin-bottom:.5rem}.thread-group[_ngcontent-%COMP%]:last-child{margin-bottom:0}.thread-group-header[_ngcontent-%COMP%]{padding:.5rem 1rem .25rem;font-size:.75rem;font-weight:600;color:var(--color-text-secondary);text-transform:uppercase;letter-spacing:.5px;position:sticky;top:0;background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);z-index:1}.thread-item-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;position:relative;width:100%;border-radius:0;min-width:0;gap:.25rem}.thread-item-wrapper[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.thread-item-wrapper[_ngcontent-%COMP%]:hover .action-buttons[_ngcontent-%COMP%]{display:flex}.thread-item-wrapper.current[_ngcontent-%COMP%]{background:var(--color-primary-light)}.thread-item-wrapper.current[_ngcontent-%COMP%] .thread-item[_ngcontent-%COMP%]{color:var(--color-primary-text);font-weight:600}.thread-item[_ngcontent-%COMP%]{display:flex;align-items:center;flex:1;min-width:0;padding:.75rem 1rem;text-decoration:none;cursor:pointer;transition:all .2s ease;background:transparent;border:none;border-radius:0;color:var(--color-text);text-align:left;justify-content:flex-start}.thread-item.new-thread-item[_ngcontent-%COMP%]{margin-bottom:.25rem}.thread-item[_ngcontent-%COMP%]:hover{color:var(--color-primary)}.thread-item[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-primary);outline-offset:-2px}.action-buttons[_ngcontent-%COMP%]{display:none;align-items:center;gap:.25rem;flex-shrink:0;margin-right:.5rem}.thread-item-wrapper[_ngcontent-%COMP%]:hover .action-buttons[_ngcontent-%COMP%], .thread-item-wrapper.current[_ngcontent-%COMP%] .action-buttons[_ngcontent-%COMP%]{display:flex}.action-button[_ngcontent-%COMP%]{flex-shrink:0;border-radius:4px!important;width:28px!important;height:28px!important;padding:0!important}.action-button[_ngcontent-%COMP%] .mat-mdc-button-persistent-ripple{border-radius:4px!important}.action-button[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)!important}.action-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px}.action-button.edit-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px}.action-button.edit-button[_ngcontent-%COMP%]:hover{background-color:var(--color-primary-hover)!important}.action-button.edit-button[_ngcontent-%COMP%]:hover mat-icon[_ngcontent-%COMP%]{color:var(--color-primary)}.action-button.star-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{transition:color .2s ease}.action-button.star-button.starred[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:#fbbf24}.action-button.star-button[_ngcontent-%COMP%]:not(.starred):hover mat-icon[_ngcontent-%COMP%]{color:#fbbf24}.action-button.delete-button[_ngcontent-%COMP%]:hover mat-icon[_ngcontent-%COMP%]{color:#ef4444}.action-button.mark-done-button[_ngcontent-%COMP%]:hover mat-icon[_ngcontent-%COMP%]{color:#22c55e}.action-button.mark-active-button[_ngcontent-%COMP%]:hover mat-icon[_ngcontent-%COMP%]{color:var(--color-primary)}.thread-link[_ngcontent-%COMP%]{display:inline-flex;align-items:center;background:transparent;border:none;text-decoration:none;cursor:pointer;transition:all .2s ease;gap:.5rem;font-size:.875rem;font-weight:400;padding:0 1rem;min-width:0}.thread-link[_ngcontent-%COMP%]:hover:not(.new-thread-link){color:var(--color-primary-hover, var(--color-primary));text-decoration:underline;text-decoration-thickness:1.5px;text-underline-offset:3px}.thread-link[_ngcontent-%COMP%]:focus{outline:2px solid var(--color-primary);outline-offset:2px}.thread-link.new-thread-link[_ngcontent-%COMP%]{margin-bottom:.5rem;font-weight:600;font-size:.95rem}.thread-link.new-thread-link[_ngcontent-%COMP%] .thread-name[_ngcontent-%COMP%]{background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% auto;background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;animation:_ngcontent-%COMP%_gradientShift 3s ease-in-out infinite}.thread-link.new-thread-link[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:var(--color-primary);animation:_ngcontent-%COMP%_iconPulse 3s ease-in-out infinite}.thread-link.new-thread-link[_ngcontent-%COMP%]:hover{transform:translate(4px)}.thread-link.new-thread-link[_ngcontent-%COMP%]:hover mat-icon[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_iconPulse 1.5s ease-in-out infinite}.thread-link[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px}@keyframes _ngcontent-%COMP%_gradientShift{0%{background-position:0 center}50%{background-position:100% center}to{background-position:0 center}}@keyframes _ngcontent-%COMP%_iconPulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.8;transform:scale(1.05)}}.thread-name[_ngcontent-%COMP%]{flex:1;font-size:.875rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:left}.thread-name.thread-name-generating[_ngcontent-%COMP%]{color:var(--color-text-muted);font-style:italic}.thread-name-edit-wrapper[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;padding:0 .5rem}.thread-name-input[_ngcontent-%COMP%]{width:100%;padding:.5rem;border:1px solid var(--color-border);border-radius:4px;background:var(--color-bg-secondary);color:var(--color-text-primary);font-size:.9rem;font-family:inherit}.thread-name-input[_ngcontent-%COMP%]:focus{outline:none;border-color:var(--color-primary);box-shadow:0 0 0 2px #3b82f61a}.thread-name-input[_ngcontent-%COMP%]:disabled{opacity:.6;cursor:not-allowed}.rename-error[_ngcontent-%COMP%]{color:var(--color-error);font-size:.75rem;margin-top:.25rem;padding-left:.5rem}.thread-name-spinner[_ngcontent-%COMP%]{flex-shrink:0;margin-right:.5rem}.thread-name-spinner[_ngcontent-%COMP%] .mat-mdc-progress-spinner circle{stroke:var(--color-primary)!important}.current-indicator[_ngcontent-%COMP%]{color:var(--color-success);font-weight:700;flex-shrink:0;font-size:1rem}.thread-separator[_ngcontent-%COMP%]{height:1px;background:var(--color-border);margin:.25rem 0}.thread-empty[_ngcontent-%COMP%]{padding:1.5rem 1rem;text-align:center;color:var(--color-text-muted);font-size:.8rem;font-style:italic}.thread-loading[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:2rem 1rem;gap:.75rem}.thread-loading[_ngcontent-%COMP%] .loading-spinner[_ngcontent-%COMP%]{width:24px;height:24px;border:3px solid var(--color-border);border-top-color:var(--color-primary);border-radius:50%;animation:_ngcontent-%COMP%_spin .8s linear infinite}.thread-loading[_ngcontent-%COMP%] .loading-text[_ngcontent-%COMP%]{color:var(--color-text-muted);font-size:.8rem}@keyframes _ngcontent-%COMP%_spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.thread-disabled[_ngcontent-%COMP%]{padding:1.5rem 1rem}.thread-disabled[_ngcontent-%COMP%] .disabled-text[_ngcontent-%COMP%]{display:block;color:var(--color-text-muted);font-size:.85rem;font-style:italic;text-align:center}.thread-item-wrapper.sub-thread[_ngcontent-%COMP%]{padding-left:calc(.2rem + var(--sub-depth, 1) * 1.5rem);border-left:2px solid var(--color-primary, #3b82f6);margin-left:.75rem}.thread-item-wrapper.sub-thread[_ngcontent-%COMP%] .sub-thread-item[_ngcontent-%COMP%]{padding:.35rem .5rem .35rem 0;gap:.2rem;font-size:.8rem;color:var(--color-text-secondary)}.thread-item-wrapper.sub-thread[_ngcontent-%COMP%] .sub-thread-item[_ngcontent-%COMP%]:hover{color:var(--color-primary)}.thread-item-wrapper.sub-thread[_ngcontent-%COMP%] .sub-thread-agent[_ngcontent-%COMP%]{font-weight:600;color:var(--color-primary);white-space:nowrap;flex-shrink:0;font-size:.8rem}.thread-item-wrapper.sub-thread[_ngcontent-%COMP%] .sub-thread-task[_ngcontent-%COMP%]{color:var(--color-text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:.75rem}.sub-thread-toggle[_ngcontent-%COMP%]{font-size:16px;width:16px;height:16px;flex-shrink:0;cursor:pointer;color:var(--color-text-secondary);margin-right:.25rem}.sub-thread-toggle[_ngcontent-%COMP%]:hover{color:var(--color-primary)}.shared-indicator[_ngcontent-%COMP%]{font-size:14px;width:14px;height:14px;color:var(--color-text-secondary);flex-shrink:0;margin-left:.25rem}@media(max-width:768px){.thread-item[_ngcontent-%COMP%]{padding:.6rem .8rem}.thread-name[_ngcontent-%COMP%]{font-size:.8rem}}"],changeDetection:1})};var on=["logsContent"],rn=(n,t)=>t.name;function an(n,t){if(n&1){let e=dC();vs(0,"button",12),Ag("click",function(){If(e);let o=mC().$implicit,s=mC();return wf(s.start(o.name))}),vs(1,"mat-icon"),WC(2,"play_arrow"),fl()();}if(n&2){let e=mC().$implicit;Tg("disabled",e.isLoading);}}function sn(n,t){if(n&1){let e=dC();vs(0,"button",13),Ag("click",function(){If(e);let o=mC().$implicit,s=mC();return wf(s.stop(o.name))}),vs(1,"mat-icon"),WC(2,"stop"),fl()();}if(n&2){let e=mC().$implicit;Tg("disabled",e.isLoading);}}function cn(n,t){if(n&1&&(vs(0,"a",8)(1,"mat-icon",14),WC(2,"open_in_new"),fl()()),n&2){let e=mC().$implicit;Tg("href",e.url,yh)("title",e.url);}}function ln(n,t){if(n&1&&(vs(0,"div",15),WC(1),fl()),n&2){let e=mC(),i=e.$implicit,o=e.$index;Vg("order",o*2),XE(),Zg(i.errorMessage);}}function dn(n,t){if(n&1){let e=dC();vs(0,"button",21),Ag("click",function(){If(e);let o=mC(3);return wf(o.onManualRefresh())}),vs(1,"mat-icon"),WC(2,"refresh"),fl()();}}function mn(n,t){if(n&1&&(vs(0,"div",16)(1,"div",17)(2,"span",18),WC(3),fl(),eC(4,dn,3,0,"button",19),fl(),vs(5,"pre",20,0),WC(7),fl()()),n&2){let e=mC(),i=e.$implicit,o=e.$index,s=mC();Vg("order",o*2+1),XE(3),yl("",i.name," logs"),XE(),tC(i.status==="running"?4:-1),XE(3),Zg(s.logs()||"(empty)");}}function pn(n,t){if(n&1){let e=dC();vs(0,"div",2)(1,"span",3),WC(2),fl(),vs(3,"div",4),eC(4,an,3,1,"button",5)(5,sn,3,1,"button",6),vs(6,"span",7),WC(7),fl(),eC(8,cn,3,2,"a",8),vs(9,"button",9),Ag("click",function(){let o=If(e).$implicit,s=mC();return wf(s.toggleLogs(o.name))}),vs(10,"mat-icon"),WC(11),fl()()()(),eC(12,ln,2,3,"div",10),eC(13,mn,8,5,"div",11);}if(n&2){let e=t.$implicit,i=t.$index,o=mC();Vg("order",i*2),XE(2),Zg(e.name),XE(2),tC(e.status==="stopped"?4:5),XE(2),Hg("running",e.status==="running"),XE(),yl(" ",e.status==="running"?"Running":"Stopped"," "),XE(),tC(e.url?8:-1),XE(),Tg("title",o.logsOpenFor()===e.name?"Hide logs":"Show logs"),XE(2),Zg(o.logsOpenFor()===e.name?"expand_less":"terminal"),XE(),tC(e.errorMessage?12:-1),XE(),tC(o.logsOpenFor()===e.name?13:-1);}}var Te=class n{destroyRef=g(we$1);projectApi=g(c);projectName=mB.required();entryStates=Hi([]);hasPreview=mT(()=>this.entryStates().length>0);logsOpenFor=Hi(null);logs=Hi("");logsContent;logsPollTimer=null;logsTimeoutTimer=null;static LOGS_POLL_MS=5e3;static LOGS_TIMEOUT_MS=1200*1e3;constructor(){Hf(()=>{let t=this.projectName();t&&this.onProjectChanged(t);},{}),Hf(()=>{console.log("entry states",this.entryStates());});}ngOnDestroy(){this.stopLogPolling();}onProjectChanged(t){this.stopLogPolling(),this.entryStates.set([]),this.logsOpenFor.set(null),this.logs.set(""),this.projectApi.getPreviewEntries(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{let i=e.entries;if(i.length===0)return;let o=i.map(f=>({name:f.name,command:f.command,url:f.url,status:"stopped",isLoading:false,errorMessage:""}));this.entryStates.set(o);let s=i.map(f=>this.projectApi.getPreviewStatus(t,f.name));By(s).pipe(U$1(this.destroyRef)).subscribe({next:f=>{this.entryStates.update(A=>A.map((J,L)=>{let R=f[L];return R?z$1(P$1({},J),{status:R.status}):J}));},error:()=>{}});},error:()=>{}});}start(t){this.updateEntry(t,{isLoading:true,errorMessage:""}),this.projectApi.startPreview(this.projectName(),t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.updateEntry(t,{status:e.status,isLoading:false});},error:e=>{this.updateEntry(t,{errorMessage:e?.error?.error??"Failed to start preview",isLoading:false});}});}stop(t){this.updateEntry(t,{isLoading:true,errorMessage:""}),this.projectApi.stopPreview(this.projectName(),t).pipe(U$1(this.destroyRef)).subscribe({next:()=>{this.updateEntry(t,{status:"stopped",isLoading:false}),this.logsOpenFor()===t&&this.stopLogPolling();},error:e=>{this.updateEntry(t,{errorMessage:e?.error?.error??"Failed to stop preview",isLoading:false});}});}toggleLogs(t){this.logsOpenFor()===t?(this.logsOpenFor.set(null),this.logs.set(""),this.stopLogPolling()):(this.logsOpenFor.set(t),this.refreshLogs(),this.startLogPolling());}onManualRefresh(){this.refreshLogs(),this.logsPollTimer&&this.resetLogsTimeout();}refreshLogs(){let t=this.logsOpenFor();t&&this.projectApi.getPreviewLogs(this.projectName(),t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.logs.set(e.logs),this.scrollLogsToBottom();},error:()=>this.logs.set("(failed to load logs)")});}updateEntry(t,e){this.entryStates.update(i=>i.map(o=>o.name===t?P$1(P$1({},o),e):o));}startLogPolling(){this.stopLogPolling(),this.logsPollTimer=setInterval(()=>{this.logsOpenFor()?this.refreshLogs():this.stopLogPolling();},n.LOGS_POLL_MS),this.resetLogsTimeout();}stopLogPolling(){this.logsPollTimer&&(clearInterval(this.logsPollTimer),this.logsPollTimer=null),this.logsTimeoutTimer&&(clearTimeout(this.logsTimeoutTimer),this.logsTimeoutTimer=null);}resetLogsTimeout(){this.logsTimeoutTimer&&clearTimeout(this.logsTimeoutTimer),this.logsTimeoutTimer=setTimeout(()=>{this.stopLogPolling();},n.LOGS_TIMEOUT_MS);}scrollLogsToBottom(){setTimeout(()=>{let t=this.logsContent?.nativeElement;t&&(t.scrollTop=t.scrollHeight);});}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Aw({type:n,selectors:[["app-preview-panel"]],viewQuery:function(e,i){if(e&1&&Fg(on,5),e&2){let o;IC(o=wC())&&(i.logsContent=o.first);}},inputs:{projectName:[1,"projectName"]},decls:3,vars:0,consts:[["logsContent",""],[1,"preview-panel"],[1,"entry-row"],[1,"entry-name"],[1,"entry-actions"],["mat-icon-button","","title","Start","type","button",1,"entry-btn","start",3,"disabled"],["mat-icon-button","","title","Stop","type","button",1,"entry-btn","stop",3,"disabled"],[1,"status-pill"],["target","_blank","rel","noopener noreferrer",1,"preview-url",3,"href","title"],["mat-icon-button","","type","button",1,"entry-btn","logs",3,"click","title"],[1,"preview-error",3,"order"],[1,"logs-container",3,"order"],["mat-icon-button","","title","Start","type","button",1,"entry-btn","start",3,"click","disabled"],["mat-icon-button","","title","Stop","type","button",1,"entry-btn","stop",3,"click","disabled"],[1,"link-icon"],[1,"preview-error"],[1,"logs-container"],[1,"logs-header"],[1,"logs-title"],["mat-icon-button","","title","Refresh logs","type","button",1,"entry-btn"],[1,"logs-content"],["mat-icon-button","","title","Refresh logs","type","button",1,"entry-btn",3,"click"]],template:function(e,i){e&1&&(vs(0,"div",1),oC(1,pn,14,12,null,null,rn),fl()),e&2&&(XE(),iC(i.entryStates()));},dependencies:[hr,Gn,yt$2,wt],styles:["[_nghost-%COMP%]{display:block}.preview-panel[_ngcontent-%COMP%]{display:flex;flex-direction:column;padding:.25rem 0}.entry-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;padding:.125rem .5rem;min-height:36px}.entry-name[_ngcontent-%COMP%]{font-size:.82rem;font-weight:500;color:var(--on-surface, #e0e0e0);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1 1 auto;min-width:0}.entry-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.25rem;flex-shrink:0}.entry-btn[_ngcontent-%COMP%]{width:28px!important;height:28px!important;padding:0!important;display:inline-flex!important;align-items:center;justify-content:center;flex-shrink:0}.entry-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px;line-height:18px}.entry-btn.start[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:var(--color-primary)}.entry-btn.stop[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:#e53935}.entry-btn.logs[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:16px;width:16px;height:16px;line-height:16px;color:var(--color-text-secondary)}.entry-btn[disabled][_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.status-pill[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;padding:1px 6px;border-radius:12px;font-size:.68rem;font-weight:600;letter-spacing:.02em;flex-shrink:0;min-width:52px;text-align:center;background:var(--color-bg-hover);color:var(--color-text-secondary);border:1px solid var(--color-border)}.status-pill.running[_ngcontent-%COMP%]{background:#22c55e26;color:#16a34a;border-color:#22c55e66}.preview-url[_ngcontent-%COMP%]{display:inline-flex;align-items:center;text-decoration:none;color:var(--color-primary);flex-shrink:0}.preview-url[_ngcontent-%COMP%]:hover{text-decoration:underline}.preview-url[_ngcontent-%COMP%] .link-icon[_ngcontent-%COMP%]{font-size:14px;width:14px;height:14px}.preview-error[_ngcontent-%COMP%]{font-size:.75rem;color:#c00;padding:0 .75rem}.logs-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;margin:.125rem .5rem .25rem;background:var(--color-bg-hover);border-radius:8px;overflow:hidden;border:1px solid var(--color-border)}.logs-header[_ngcontent-%COMP%]{display:flex;align-items:center;padding:.25rem .75rem;border-bottom:1px solid var(--color-border)}.logs-header[_ngcontent-%COMP%] .logs-title[_ngcontent-%COMP%]{flex:1;font-size:.72rem;font-weight:600;color:var(--color-text-secondary);text-transform:uppercase;letter-spacing:.05em}.logs-content[_ngcontent-%COMP%]{margin:0;padding:.5rem .75rem;font-family:Courier New,Courier,monospace;font-size:.72rem;line-height:1.5;color:var(--color-text);white-space:pre-wrap;word-break:break-all;max-height:200px;overflow-y:auto}.logs-content[_ngcontent-%COMP%]::-webkit-scrollbar{width:6px}.logs-content[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:transparent}.logs-content[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:var(--color-text-secondary);border-radius:3px}"],changeDetection:1})};var Oe=class n{eventStream=g(me$1);threadState=g(U);ratio=Hi(0);inputTokens=Hi(0);contextWindow=Hi(0);price=Hi(0);iterations=Hi(0);cacheReadTokens=Hi(0);visible=Hi(false);level=mT(()=>{let t=this.ratio();return t<.6?"ok":t<.85?"warning":"danger"});constructor(){this.eventStream.events$.pipe(Ot$2(t=>t instanceof W$1),Ot$2(t=>!t.threadId||t.threadId===this.threadState.getSelectedThreadId())).subscribe(t=>{this.inputTokens.set(t.inputTokens),this.contextWindow.set(t.contextWindow),this.price.set(t.price),this.iterations.set(t.iterations),this.cacheReadTokens.set(t.cacheReadTokens),this.ratio.set(t.contextWindow>0?t.inputTokens/t.contextWindow:0),this.visible.set(true);}),this.eventStream.connectionStatus$.pipe(Ot$2(t=>!t.connected)).subscribe(()=>{this.visible.set(false),this.ratio.set(0),this.inputTokens.set(0),this.contextWindow.set(0),this.price.set(0),this.iterations.set(0),this.cacheReadTokens.set(0);});}static \u0275fac=function(e){return new(e||n)};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};function gn(n,t){if(n&1&&Sg(0,"div",12),n&2){let e=t.$implicit,i=t.$index,o=mC();Vg("--delay",e.delay+"s")("--left",e.left+"%")("--dur",e.dur+"s")("--size",e.size+"px")("--rise",e.rise+"px"),Hg("invisible",i>=o.aboveBubbleCount());}}function _n(n,t){if(n&1&&Sg(0,"div",13),n&2){let e=t.$implicit;Vg("--delay",e.delay+"s")("--size",e.size+"px")("--left",e.left+"%")("--dur",e.dur+"s")("--top",e.top+"px");}}function un(n,t){if(n&1&&Sg(0,"div",14),n&2){let e=t.$implicit,i=t.$index,o=mC();Vg("--delay",e.delay+"s")("--left",e.left+"%")("--dur",e.dur+"s")("--size",e.size+"px"),Hg("invisible",i>=o.insideBubbleCount());}}var yt=30,Pt=27,hn=40;function T(n,t,e,i=0){return i+(n*137+t*31)%e}var ke=class n{gaugeState=g(Oe);sidenavOpen=mB(false);aboveBubbles=Array.from({length:yt},(t,e)=>({delay:T(e,1,30)/10,left:T(e,2,82,5),dur:2.5+T(e,3,20)/10,size:1.5+T(e,4,40)/10,rise:150+T(e,5,150)}));insideBubbles=Array.from({length:Pt},(t,e)=>({delay:T(e,6,20)/10,left:T(e,7,80,5),dur:1.2+T(e,8,15)/10,size:2+T(e,9,35)/10}));foamBubbles=Array.from({length:hn},(t,e)=>({delay:T(e,10,25)/10,left:T(e,11,85,3),dur:1.5+T(e,12,10)/10,size:(3+T(e,13,80)/10)*.75,top:T(e,14,4)+8}));displayRatio=mT(()=>Math.min(100,this.gaugeState.ratio()*100));liquidColor=mT(()=>{let t=this.gaugeState.ratio();return t<=.5?`rgb(${Math.round(t*2*255)}, 255, 0)`:`rgb(255, ${Math.round((1-(t-.5)*2)*255)}, 0)`});aboveBubbleCount=mT(()=>Math.round(this.gaugeState.ratio()*yt));insideBubbleCount=mT(()=>{let t=this.gaugeState.ratio();return t<.5?0:t<.65?5:t<.8?13:t<.9?20:Pt});foamActive=mT(()=>this.gaugeState.ratio()>=.5);overflowing=mT(()=>this.gaugeState.ratio()>=.9);tooltipText=mT(()=>{let t=Math.round(this.gaugeState.ratio()*100),e=this.gaugeState.price().toFixed(4);return [`${this.gaugeState.inputTokens().toLocaleString()} / ${this.gaugeState.contextWindow().toLocaleString()} tokens (${t}%)`,`Cost: $${e}`,`Iterations: ${this.gaugeState.iterations()}`,`Cache read: ${this.gaugeState.cacheReadTokens().toLocaleString()}`].join(`
|
|
4
4
|
`)});static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Aw({type:n,selectors:[["app-context-gauge"]],inputs:{sidenavOpen:[1,"sidenavOpen"]},decls:15,vars:11,consts:[[1,"tube-host",3,"title"],[1,"tube"],[1,"bubbles-above"],[1,"bubble-color",3,"invisible","--delay","--left","--dur","--size","--rise"],[1,"foam"],[1,"foam-bubble",3,"--delay","--size","--left","--dur","--top"],[1,"body"],[1,"shine"],[1,"liquid"],[1,"percentage"],[1,"bubbles-inside"],[1,"bubble-dark",3,"invisible","--delay","--left","--dur","--size"],[1,"bubble-color"],[1,"foam-bubble"],[1,"bubble-dark"]],template:function(e,i){e&1&&(pl(0,"div",0)(1,"div",1)(2,"div",2),oC(3,gn,1,12,"div",3,nC),hl(),pl(5,"div",4),oC(6,_n,1,10,"div",5,nC),hl(),pl(8,"div",6),Sg(9,"div",7),pl(10,"div",8)(11,"div",9)(12,"div",10),oC(13,un,1,10,"div",11,nC),hl()()()()()()),e&2&&(Hg("hidden",i.sidenavOpen()),Ng("title",i.tooltipText()),XE(),Vg("--tube-color",i.liquidColor()),XE(2),iC(i.aboveBubbles),XE(2),Vg("bottom",i.displayRatio()+"%"),Hg("active",i.foamActive()),XE(),iC(i.foamBubbles),XE(5),Vg("height",i.displayRatio(),"%"),XE(2),iC(i.insideBubbles));},styles:['[_nghost-%COMP%]{position:fixed;left:calc(1rem + 10px);z-index:1500;display:block;top:calc(3.5rem + 80px);--gauge-glass: #dddddd}[data-theme$=dark][_nghost-%COMP%], [data-theme$=dark] [_nghost-%COMP%]{--gauge-glass: #333333}.tube-host[_ngcontent-%COMP%]{position:relative;display:flex;flex-direction:column;align-items:center}.tube-host.hidden[_ngcontent-%COMP%]{visibility:hidden}.tube[_ngcontent-%COMP%]{position:relative;height:100px;width:24px;border:none;border-radius:0 0 50rem 50rem;background-color:var(--gauge-glass, #333333);cursor:default;overflow:visible}.tube[_ngcontent-%COMP%]:after{content:"";position:absolute;left:-3px;top:0;width:calc(100% + 6px);height:4px;border-radius:50rem;background:var(--gauge-glass, #333333)}.body[_ngcontent-%COMP%]{position:absolute;border-radius:inherit;height:100%;width:100%;bottom:0;overflow:hidden;z-index:5}.shine[_ngcontent-%COMP%]{position:absolute;left:20%;top:0;width:10%;height:100%;z-index:90;opacity:.2;pointer-events:none}.shine[_ngcontent-%COMP%]:before, .shine[_ngcontent-%COMP%]:after{content:"";position:absolute;background-color:#fff;border-radius:50rem;top:10%;height:40%;width:100%}.shine[_ngcontent-%COMP%]:after{height:15%;top:60%}@keyframes _ngcontent-%COMP%_liquid-spin{0%{transform:translate(-50%) rotate(0)}to{transform:translate(-50%) rotate(360deg)}}.liquid[_ngcontent-%COMP%]{position:absolute;height:100%;width:100%;bottom:0}.percentage[_ngcontent-%COMP%]{position:absolute;height:0%;width:100%;bottom:0;left:0;z-index:80;transition:height .9s cubic-bezier(.4,0,.2,1);overflow:visible}.percentage[_ngcontent-%COMP%]:before, .percentage[_ngcontent-%COMP%]:after{position:absolute;content:"";width:100px;height:100px;border-radius:40px;animation:_ngcontent-%COMP%_liquid-spin 4s infinite linear;transform:translate(-50%);left:50%;top:0;background:var(--tube-color, #34c759);transition:background .5s ease}.percentage[_ngcontent-%COMP%]:after{opacity:.4;animation-direction:reverse;border-radius:30px}@keyframes _ngcontent-%COMP%_bubble-rise-inside{0%{bottom:2%;opacity:0;transform:scale(.5)}15%{opacity:.7}85%{opacity:.4}to{bottom:96%;opacity:0;transform:scale(1.1)}}.bubbles-inside[_ngcontent-%COMP%]{position:absolute;left:0;bottom:0;width:100%;height:100%;z-index:10;pointer-events:none}.bubbles-inside[_ngcontent-%COMP%] .bubble-dark[_ngcontent-%COMP%]{position:absolute;border-radius:50%;background:var(--color-bg, rgba(20, 20, 20, .55));width:var(--size, 3px);height:var(--size, 3px);opacity:0;bottom:2%;left:var(--left, 30%);animation:_ngcontent-%COMP%_bubble-rise-inside var(--dur, 1.5s) infinite ease-in;animation-delay:var(--delay, 0s)}.bubbles-inside[_ngcontent-%COMP%] .bubble-dark.invisible[_ngcontent-%COMP%]{animation:none;opacity:0}@keyframes _ngcontent-%COMP%_bubble-rise-above{0%{bottom:0;opacity:0;transform:scale(.4)}10%{opacity:.9}70%{opacity:.8}90%{opacity:.3}to{bottom:var(--rise, 80px);opacity:0;transform:scale(1.2)}}.bubbles-above[_ngcontent-%COMP%]{position:absolute;left:0;bottom:0;width:100%;height:100%;z-index:20;pointer-events:none;overflow:visible}.bubbles-above[_ngcontent-%COMP%] .bubble-color[_ngcontent-%COMP%]{position:absolute;border-radius:50%;background:var(--tube-color, #34c759);opacity:0;bottom:0;left:var(--left, 30%);width:var(--size, 3px);height:var(--size, 3px);animation:_ngcontent-%COMP%_bubble-rise-above var(--dur, 1.5s) infinite ease-in;animation-delay:var(--delay, 0s)}.bubbles-above[_ngcontent-%COMP%] .bubble-color.invisible[_ngcontent-%COMP%]{animation:none;opacity:0}.foam[_ngcontent-%COMP%]{position:absolute;bottom:0;left:-1px;width:100%;height:14px;z-index:100;pointer-events:none;overflow:visible;transition:bottom .9s cubic-bezier(.4,0,.2,1)}.foam[_ngcontent-%COMP%] .foam-bubble[_ngcontent-%COMP%]{position:absolute;top:var(--top, 0px);left:var(--left, 50%);width:var(--size, 4px);height:var(--size, 4px);border-radius:50%;background:#fff0;animation:none}.foam.active[_ngcontent-%COMP%] .foam-bubble[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_foam-pulse var(--dur, 1.5s) ease-in-out infinite;animation-delay:var(--delay, 0s)}@keyframes _ngcontent-%COMP%_foam-pulse{0%{background:#fff0;transform:scale(.5)}30%{background:#ffffff73;transform:scale(1)}60%{background:#ffffff40;transform:scale(1.1)}to{background:#fff0;transform:scale(.6)}}@media(max-width:768px){[_nghost-%COMP%]{top:calc(3.25rem + 80px);left:calc(.75rem + 10px)}.tube[_ngcontent-%COMP%]{height:75px;width:20px}}']})};var fn=["threadSearchInput"],bn=["*"];function vn(n,t){if(n&1){let e=dC();vs(0,"button",28),Ag("click",function(){If(e);let o=mC();return wf(o.toggle())}),vs(1,"mat-icon"),WC(2,"menu"),fl()(),vs(3,"button",29),Ag("click",function(){If(e);let o=mC();return wf(o.createNewThread())}),vs(4,"mat-icon",10),WC(5,"play_circle"),fl()();}if(n&2){let e=mC();XE(3),Tg("disabled",!e.selectedProjectName());}}function Cn(n,t){if(n&1){let e=dC();vs(0,"div",12)(1,"a",30),Ag("click",function(o){return If(e),mC().openMissionControl(),wf(o.preventDefault())}),vs(2,"mat-icon"),WC(3,"rocket_launch"),fl(),vs(4,"span",31),WC(5,"Task Control"),fl()()();}}function xn(n,t){if(n&1){let e=dC();vs(0,"div",15)(1,"mat-icon",32),WC(2,"search"),fl(),vs(3,"input",33,0),Jg("ngModelChange",function(o){If(e);let s=mC();return KC(s.threadSearchQuery,o)||(s.threadSearchQuery=o),wf(o)}),Ag("input",function(){If(e);let o=mC();return wf(o.onThreadSearchInput())}),fl(),HI(),vs(5,"button",34),Ag("click",function(){If(e);let o=mC();return wf(o.closeThreadSearch())}),vs(6,"mat-icon"),WC(7,"close"),fl()()();}if(n&2){let e=mC();XE(3),Xg("ngModel",e.threadSearchQuery),$I();}}function yn(n,t){if(n&1){let e=dC();vs(0,"div",16)(1,"mat-icon",23),WC(2,"forum"),fl(),vs(3,"span",24),WC(4,"Threads"),fl(),vs(5,"button",35),Ag("click",function(o){If(e);let s=mC();return wf(s.toggleThreadSearch(o))}),vs(6,"mat-icon"),WC(7,"search"),fl()()();}}function Pn(n,t){n&1&&(vs(0,"mat-icon",22),WC(1,"keyboard_arrow_up"),fl());}function Sn(n,t){n&1&&(vs(0,"mat-icon",23),WC(1,"hub"),fl());}function Mn(n,t){n&1&&(vs(0,"mat-icon",22),WC(1,"keyboard_arrow_up"),fl());}function wn(n,t){n&1&&(vs(0,"mat-icon",23),WC(1,"tune"),fl());}function Tn(n,t){n&1&&(vs(0,"div",37)(1,"div",41),bg(2,"app-options-panel",42),fl()());}function On(n,t){if(n&1){let e=dC();vs(0,"div",36)(1,"a",21),Ag("click",function(o){return If(e),mC(3).openProjectConfig(),o.preventDefault(),wf(o.stopPropagation())}),vs(2,"mat-icon",23),WC(3,"settings_applications"),fl(),vs(4,"span",24),WC(5,"Project Configuration"),fl()()();}}function kn(n,t){n&1&&(vs(0,"div",36)(1,"a",43)(2,"mat-icon",23),WC(3,"settings_applications"),fl(),vs(4,"span",24),WC(5,"Project config (No project)"),fl()()());}function En(n,t){if(n&1&&eC(0,On,6,0,"div",36)(1,kn,6,0,"div",36),n&2){let e=mC(2);tC(e.selectedProjectName()?0:1);}}function Dn(n,t){if(n&1){let e=dC();vs(0,"div",36)(1,"a",21),Ag("click",function(o){return If(e),mC(2).openAgents(),o.preventDefault(),wf(o.stopPropagation())}),vs(2,"mat-icon",23),WC(3,"smart_toy"),fl(),vs(4,"span",24),WC(5,"Agents"),fl()()();}}function Nn(n,t){n&1&&(vs(0,"div",36)(1,"a",43)(2,"mat-icon",23),WC(3,"smart_toy"),fl(),vs(4,"span",24),WC(5,"Agents (No project)"),fl()()());}function jn(n,t){if(n&1){let e=dC();vs(0,"div",36)(1,"a",21),Ag("click",function(o){return If(e),mC(2).openPrompts(),o.preventDefault(),wf(o.stopPropagation())}),vs(2,"mat-icon",23),WC(3,"description"),fl(),vs(4,"span",24),WC(5,"Prompts"),fl()()();}}function Vn(n,t){n&1&&(vs(0,"div",36)(1,"a",43)(2,"mat-icon",23),WC(3,"description"),fl(),vs(4,"span",24),WC(5,"Prompts (No project)"),fl()()());}function Fn(n,t){if(n&1){let e=dC();vs(0,"div",36)(1,"a",21),Ag("click",function(o){return If(e),mC(2).openSchedulers(),o.preventDefault(),wf(o.stopPropagation())}),vs(2,"mat-icon",23),WC(3,"schedule"),fl(),vs(4,"span",24),WC(5,"Schedulers"),fl()()();}}function In(n,t){n&1&&(vs(0,"div",36)(1,"a",43)(2,"mat-icon",23),WC(3,"schedule"),fl(),vs(4,"span",24),WC(5,"Schedulers (No project)"),fl()()());}function zn(n,t){n&1&&(vs(0,"mat-icon",22),WC(1,"keyboard_arrow_up"),fl());}function An(n,t){n&1&&(vs(0,"mat-icon",23),WC(1,"rocket_launch"),fl());}function Ln(n,t){if(n&1&&(vs(0,"div",37),bg(1,"app-preview-panel",44),fl()),n&2){let e=mC(3);XE(),Tg("projectName",e.selectedProjectName());}}function Rn(n,t){if(n&1){let e=dC();vs(0,"div",36)(1,"a",21),Ag("click",function(o){return If(e),mC(2).toggleSection("preview"),o.preventDefault(),wf(o.stopPropagation())}),eC(2,zn,2,0,"mat-icon",22)(3,An,2,0,"mat-icon",23),vs(4,"span",24),WC(5,"Preview Server"),fl()(),eC(6,Ln,2,1,"div",37),fl();}if(n&2){let e=mC(2);Hg("expanded",e.expandedSections.preview),XE(),Hg("active",e.expandedSections.preview),XE(),tC(e.expandedSections.preview?2:3),XE(4),tC(e.expandedSections.preview?6:-1);}}function $n(n,t){if(n&1){let e=dC();vs(0,"div",25)(1,"div",36)(2,"a",21),Ag("click",function(o){return If(e),mC().toggleSection("config"),wf(o.preventDefault())}),eC(3,Mn,2,0,"mat-icon",22)(4,wn,2,0,"mat-icon",23),vs(5,"span",24),WC(6,"Preferences"),fl()(),eC(7,Tn,3,0,"div",37),fl(),vs(8,"div",36)(9,"a",21),Ag("click",function(o){return If(e),mC().openTokenUsage(),o.preventDefault(),wf(o.stopPropagation())}),vs(10,"mat-icon",23),WC(11,"data_usage"),fl(),vs(12,"span",24),WC(13,"Token Usage"),fl()()(),vs(14,"div",36)(15,"a",21),Ag("click",function(o){return If(e),mC().openUserConfig(),o.preventDefault(),wf(o.stopPropagation())}),vs(16,"mat-icon",23),WC(17,"manage_accounts"),fl(),vs(18,"span",24),WC(19,"User Configuration"),fl()()(),eC(20,En,2,1),eC(21,Dn,6,0,"div",36)(22,Nn,6,0,"div",36),eC(23,jn,6,0,"div",36)(24,Vn,6,0,"div",36),eC(25,Fn,6,0,"div",36)(26,In,6,0,"div",36),eC(27,Rn,7,6,"div",38),vs(28,"div",36)(29,"a",39),bg(30,"img",40),vs(31,"span",24),WC(32,"Contribute on GitHub"),fl()()()();}if(n&2){let e=mC();XE(),Hg("expanded",e.expandedSections.config),XE(),Hg("active",e.expandedSections.config),XE(),tC(e.expandedSections.config?3:4),XE(4),tC(e.expandedSections.config?7:-1),XE(13),tC(e.isAdmin?20:-1),XE(),tC(e.selectedProjectName()?21:22),XE(2),tC(e.selectedProjectName()?23:24),XE(2),tC(e.selectedProjectName()?25:26),XE(2),tC(e.hasPreviewConfig()?27:-1),XE(3),Cg("src","CODAY-Logo.png",yh);}}function Bn(n,t){if(n&1){let e=dC();vs(0,"div",27)(1,"mat-icon",45),WC(2,"warning"),fl(),vs(3,"span",46),WC(4),fl(),vs(5,"button",47),Ag("click",function(){If(e);let o=mC();return wf(o.configErrorMessage="")}),vs(6,"mat-icon"),WC(7,"close"),fl()()();}if(n&2){let e=mC();XE(4),Zg(e.configErrorMessage);}}var St=class n{destroy$=new ce;sidenavStateChange=new yt$1;drawerOpen=false;breakpointObserver=g(Ot$1);isDesktop=F(this.breakpointObserver.observe("(min-width: 1400px)").pipe(ue(t=>t.matches)),{initialValue:false});userOpenPreference=Hi(true);isOpen=mT(()=>this.userOpenPreference());isAdmin=false;configErrorMessage="";expandedSections={config:false,preview:false,settings:false};isThreadSearchActive=false;threadSearchQuery="";threadSearchInput;dialog=g(Re);configApi=g(W);projectStateService=g(P);projectApi=g(c);router=g(G);preferences=g(L);threadStateService=g(U);projects=F(this.projectStateService.projectList$);selectedProject=F(this.projectStateService.selectedProject$);selectedProjectName=F(this.projectStateService.selectedProject$.pipe(ue(t=>t?.name)));isProjectVolatile=F(this.projectStateService.selectedProject$.pipe(ue(t=>t?.config?.volatile||false)));forcedProject=F(this.projectStateService.forcedProject$);hasPreviewConfig=F(this.projectStateService.selectedProject$.pipe(ue(t=>{let e=t?.config?.preview;return Array.isArray(e)&&!!e.length})),{initialValue:false});ngOnInit(){let t=window.innerWidth>=1024,e=this.preferences.getPreference("sidenavOpen",t);this.userOpenPreference.set(e??t),this.configApi.getUserConfig().pipe(Vy(this.destroy$)).subscribe({next:i=>{this.isAdmin=i.groups?.includes("CODAY_ADMIN")??false,console.log("[SIDENAV] User admin status:",this.isAdmin);},error:i=>{console.error("[SIDENAV] Error loading user config for roles:",i),this.isAdmin=false;}});}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete();}toggle(){let t=!this.userOpenPreference();this.userOpenPreference.set(t),this.saveSidenavState(t),this.sidenavStateChange.emit(t);}close(){this.userOpenPreference()&&(this.userOpenPreference.set(false),this.saveSidenavState(false),this.sidenavStateChange.emit(false));}saveSidenavState(t){this.preferences.setPreference("sidenavOpen",t);}openTokenUsage(){this.configErrorMessage="",this.router.navigate(["/token-usage"]);}openUserConfig(){console.log("[SIDENAV] openUserConfig called"),this.configErrorMessage="",this.configApi.getUserConfig().pipe(Vy(this.destroy$)).subscribe({next:t=>{console.log("[SIDENAV] User config loaded, opening dialog"),this.dialog.open(Qe,{data:{configType:"user",initialContent:JSON.stringify(t,null,2)}}).afterClosed().subscribe(i=>{i&&this.saveUserConfig(i);});},error:t=>{console.error("[SIDENAV] Error loading user config:",t),this.configErrorMessage=t?.error?.error||"Failed to load user configuration";}});}saveUserConfig(t){this.configApi.updateUserConfig(t).pipe(Vy(this.destroy$)).subscribe({next:e=>{console.log("[SIDENAV] User config saved successfully");},error:e=>{console.error("[SIDENAV] Error saving user config:",e),this.configErrorMessage=e?.error?.error||"Failed to save user configuration";}});}openProjectConfig(){let t=this.selectedProjectName();if(!t){console.error("[SIDENAV] No project selected"),this.configErrorMessage="No project selected. Please select a project first.";return}this.configErrorMessage="",this.projectApi.getProjectConfig(t).pipe(Vy(this.destroy$)).subscribe({next:e=>{console.log("[SIDENAV] Project config loaded, opening dialog"),this.dialog.open(Qe,{data:{configType:"project",projectName:t,initialContent:JSON.stringify(e,null,2)}}).afterClosed().subscribe(o=>{o&&this.saveProjectConfig(t,o);});},error:e=>{console.error("[SIDENAV] Error loading project config:",e),this.configErrorMessage=e?.error?.error||"Failed to load project configuration";}});}saveProjectConfig(t,e){this.projectApi.updateProjectConfig(t,e).pipe(Vy(this.destroy$)).subscribe({next:i=>{console.log("[SIDENAV] Project config saved successfully");},error:i=>{console.error("[SIDENAV] Error saving project config:",i),this.configErrorMessage=i?.error?.error||"Failed to save project configuration";}});}requireProjectSelection(t){return this.selectedProjectName()?true:(console.error(`[SIDENAV] No project selected, cannot ${t}`),this.configErrorMessage="Please select a project first",false)}openAgents(){if(!this.requireProjectSelection("open agents"))return;let t=this.selectedProjectName();this.router.navigate(["project",t,"agents"]);}openPrompts(){if(!this.requireProjectSelection("open prompts"))return;let t=this.selectedProjectName();this.router.navigate(["project",t,"prompts"]);}openSchedulers(){if(!this.requireProjectSelection("open schedulers"))return;let t=this.selectedProjectName();this.router.navigate(["project",t,"schedulers"]);}toggleSection(t){let e=this.expandedSections[t];t==="settings"?this.expandedSections[t]=!e:(["config","preview"].forEach(o=>{this.expandedSections[o]=false;}),this.expandedSections[t]=!e);}navigateToHome(){console.log("[SIDENAV] Navigating to home (project selection)"),this.projectStateService.clearSelection(),this.router.navigate(["/"]);}openMissionControl(){let t=this.selectedProjectName();t&&(this.router.navigate(["project",t,"tasks"]),this.close());}createNewThread(){let t=this.selectedProjectName();if(!t){console.error("[SIDENAV] No project selected, cannot create new thread"),this.configErrorMessage="Please select a project first";return}console.log("[SIDENAV] Navigating to welcome view for new thread"),this.threadStateService.clearSelection(),this.router.navigate(["project",t]);}onThreadSelectedOnMobile(){this.isDesktop()||this.close();}toggleThreadSearch(t){t.stopPropagation(),this.isThreadSearchActive=true,this.threadSearchQuery="",setTimeout(()=>{this.threadSearchInput?.nativeElement.focus();},0);}closeThreadSearch(){this.isThreadSearchActive=false,this.threadSearchQuery="";}onThreadSearchInput(){}onThreadSearchModeChange(t){t||this.closeThreadSearch();}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Aw({type:n,selectors:[["app-sidenav"]],viewQuery:function(e,i){if(e&1&&Fg(fn,5),e&2){let o;IC(o=wC())&&(i.threadSearchInput=o.first);}},inputs:{drawerOpen:"drawerOpen"},outputs:{sidenavStateChange:"sidenavStateChange"},ngContentSelectors:bn,decls:36,vars:24,consts:[["threadSearchInput",""],[1,"sidenav-container",3,"hasBackdrop"],["mode","push","position","start",1,"app-sidenav",3,"closed","opened","disableClose"],[1,"sidenav-header"],["mat-icon-button","","title","Close menu",3,"click"],["alt","coday","title","Go to project selection","role","button","tabindex","0",1,"sidenav-logo","clickable",3,"click","keydown.enter","keydown.space"],[1,"header-title-section"],[1,"sidenav-title"],[1,"new-thread-section"],["role","button","tabindex","0",1,"new-thread-link",3,"click"],["fontSet","material-icons-outlined"],[1,"new-thread-text"],[1,"mission-control-section"],[1,"sidenav-sections"],[1,"section-container","expanded"],[1,"search-header"],[1,"section-toggle","active","threads-header"],[1,"section-content","threads"],[1,"sidenav-thread-selector",3,"searchModeChange","threadSelected","searchMode","searchQuery"],[1,"sidenav-nav"],[1,"section-container","settings-group"],["role","button","tabindex","0",1,"section-toggle",3,"click"],[1,"arrow-icon","expanded"],[1,"section-icon"],[1,"section-label"],[1,"section-content","settings-content"],[3,"sidenavOpen"],["role","alert",1,"error-notification"],["mat-icon-button","","title","Menu","type","button",1,"sidenav-toggle-btn",3,"click"],["mat-icon-button","","title","Start a new thread","type","button",1,"sidenav-new-thread-btn",3,"click","disabled"],["role","button","tabindex","0",1,"mission-control-link",3,"click"],[1,"mission-control-text"],[1,"search-icon"],["type","text","placeholder","Search threads...",1,"search-input",3,"ngModelChange","input","ngModel"],["mat-icon-button","","title","Close search","type","button",1,"close-search-btn",3,"click"],["mat-icon-button","","title","Search threads","type","button",1,"search-button",3,"click"],[1,"section-container"],[1,"section-content"],[1,"section-container",3,"expanded"],["href","https://github.com/whoz-oss/coday","target","_blank","rel","noopener noreferrer","title","Contribute on GitHub",1,"section-toggle","contribute-btn"],["alt","Coday",1,"contribute-logo"],[1,"preference-item"],[1,"inline-panel"],["role","button","tabindex","-1","aria-disabled","true",1,"section-toggle","disabled"],[3,"projectName"],[1,"error-icon"],[1,"error-text"],["mat-icon-button","","aria-label","Close error message",1,"error-close",3,"click"]],template:function(e,i){e&1&&(vC(),eC(0,vn,6,1),vs(1,"mat-sidenav-container",1)(2,"mat-sidenav",2),Ag("closed",function(){return i.close()}),vs(3,"div",3)(4,"button",4),Ag("click",function(){return i.close()}),vs(5,"mat-icon"),WC(6,"chevron_left"),fl()(),vs(7,"img",5),Ag("click",function(s){return i.navigateToHome(),s.stopPropagation()})("keydown.enter",function(s){return i.navigateToHome(),s.preventDefault(),s.stopPropagation()})("keydown.space",function(s){return i.navigateToHome(),s.preventDefault(),s.stopPropagation()}),fl(),vs(8,"div",6)(9,"h2",7),WC(10),fl()()(),vs(11,"div",8)(12,"a",9),Ag("click",function(s){return i.createNewThread(),s.preventDefault()}),vs(13,"mat-icon",10),WC(14,"play_circle"),fl(),vs(15,"span",11),WC(16,"Start a new thread"),fl()()(),eC(17,Cn,6,0,"div",12),vs(18,"div",13)(19,"div",14),eC(20,xn,8,1,"div",15)(21,yn,8,0,"div",16),vs(22,"div",17)(23,"app-thread-selector",18),Ag("searchModeChange",function(s){return i.onThreadSearchModeChange(s)})("threadSelected",function(){return i.onThreadSelectedOnMobile()}),fl()()()(),vs(24,"div",19)(25,"div",20)(26,"a",21),Ag("click",function(s){return i.toggleSection("settings"),s.preventDefault()}),eC(27,Pn,2,0,"mat-icon",22)(28,Sn,2,0,"mat-icon",23),vs(29,"span",24),WC(30,"Control Center"),fl()(),eC(31,$n,33,12,"div",25),fl()()(),vs(32,"mat-sidenav-content"),DC(33),fl()(),bg(34,"app-context-gauge",26),eC(35,Bn,8,1,"div",27)),e&2&&(tC(!i.isOpen()&&!i.drawerOpen?0:-1),XE(),Hg("sidenav-open",i.isOpen()),Tg("hasBackdrop",false),XE(),Tg("opened",i.isOpen())("disableClose",true),XE(5),Cg("src","CODAY-Logo.png",yh),XE(3),Zg(i.selectedProjectName()),XE(7),tC(i.selectedProjectName()?17:-1),XE(3),tC(i.isThreadSearchActive?20:21),XE(3),Tg("searchMode",i.isThreadSearchActive)("searchQuery",i.threadSearchQuery),XE(),Hg("is-admin",i.isAdmin),XE(),Hg("expanded",i.expandedSections.settings),XE(),Hg("active",i.expandedSections.settings),XE(),tC(i.expandedSections.settings?27:28),XE(4),tC(i.expandedSections.settings?31:-1),XE(),Hg("sidenav-closed-offset",!i.isOpen()),XE(2),Tg("sidenavOpen",i.isOpen()),XE(),tC(i.configErrorMessage?35:-1));},dependencies:[ti,Ye,Zn,cn$1,ui,me,fi,Yt$1,yt$2,wt,hr,Gn,He,bt,Ye$1,we,Te,ke],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%;position:relative}.sidenav-container[_ngcontent-%COMP%]{position:fixed;top:0;left:0;right:0;height:100dvh;z-index:1400;transition:width;display:flex}.sidenav-container[_ngcontent-%COMP%] mat-sidenav[_ngcontent-%COMP%]{position:relative!important;transition:width;width:25%;min-width:320px;height:100dvh!important;flex-shrink:0}.sidenav-container[_ngcontent-%COMP%] mat-sidenav[_ngcontent-%COMP%]:not(.mat-drawer-opened){width:0!important;min-width:0;overflow:hidden!important;visibility:hidden!important}.sidenav-container[_ngcontent-%COMP%] mat-sidenav-content[_ngcontent-%COMP%]{width:100%;margin:0!important}@media(min-width:1024px){.sidenav-container[_ngcontent-%COMP%] mat-sidenav-content[_ngcontent-%COMP%]{min-width:0}}[_nghost-%COMP%] .mat-drawer-backdrop{pointer-events:auto}[_nghost-%COMP%] .mat-drawer-content{pointer-events:auto!important;background:transparent!important;overflow:visible!important}[_nghost-%COMP%] .mat-drawer-inner-container{overflow:hidden!important;height:100dvh!important;display:flex!important;flex-direction:column!important}.sidenav-new-thread-btn[_ngcontent-%COMP%], .sidenav-toggle-btn[_ngcontent-%COMP%]{position:fixed!important;z-index:1500!important;width:40px!important;height:40px!important;border-radius:50%!important;background:var(--glass-bg)!important;backdrop-filter:var(--glass-backdrop-blur)!important;-webkit-backdrop-filter:var(--glass-backdrop-blur)!important;border:1px solid var(--glass-border)!important;box-shadow:var(--glass-shadow)!important}.sidenav-toggle-btn[_ngcontent-%COMP%]{top:1rem!important;left:1rem!important}.sidenav-new-thread-btn[_ngcontent-%COMP%]{top:calc(1.5rem + 40px)!important;left:1rem!important}.sidenav-new-thread-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:var(--color-primary)!important}.sidenav-new-thread-btn[_ngcontent-%COMP%]:disabled{opacity:.5!important}.sidenav-logo-btn[_ngcontent-%COMP%]{position:fixed!important;bottom:1rem!important;left:1rem!important;z-index:1500!important;width:56px!important;height:56px!important;border-radius:50%!important;border:1px solid var(--glass-border)!important;padding:4px!important;background:var(--glass-bg)!important;backdrop-filter:var(--glass-backdrop-blur)!important;-webkit-backdrop-filter:var(--glass-backdrop-blur)!important;box-shadow:var(--glass-shadow)!important;transition:all .3s cubic-bezier(.4,0,.2,1)!important;cursor:pointer!important;pointer-events:auto!important;display:flex!important;align-items:center!important;justify-content:center!important;overflow:hidden!important;text-decoration:none!important}.sidenav-logo-btn[_ngcontent-%COMP%]:hover{transform:scale(1.08) translateY(-2px)!important;box-shadow:0 16px 48px #0003!important;border-color:var(--color-primary)!important}.sidenav-logo-btn[_ngcontent-%COMP%]:active{transform:scale(.96)!important}.sidenav-logo-btn[_ngcontent-%COMP%] .logo[_ngcontent-%COMP%]{width:48px;height:48px;border-radius:2px}.app-sidenav[_ngcontent-%COMP%]{width:480px;height:100dvh!important;min-height:0!important;position:relative;background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);overflow:hidden!important;display:flex;flex-direction:column}.sidenav-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:1rem;padding:1.5rem 1rem .5rem;flex-shrink:0}.sidenav-header[_ngcontent-%COMP%] .sidenav-logo[_ngcontent-%COMP%]{width:40px;height:40px;border-radius:4px;flex-shrink:0;transition:all .2s ease}.sidenav-header[_ngcontent-%COMP%] .sidenav-logo.clickable[_ngcontent-%COMP%]{cursor:pointer}.sidenav-header[_ngcontent-%COMP%] .sidenav-logo.clickable[_ngcontent-%COMP%]:hover{transform:scale(1.1);filter:drop-shadow(0 4px 12px rgba(0,0,0,.15))}.sidenav-header[_ngcontent-%COMP%] .sidenav-logo.clickable[_ngcontent-%COMP%]:active{transform:scale(.95)}.sidenav-header[_ngcontent-%COMP%] .sidenav-logo.clickable[_ngcontent-%COMP%]:focus{outline:2px solid var(--color-primary);outline-offset:2px}.sidenav-header[_ngcontent-%COMP%] .header-title-section[_ngcontent-%COMP%]{flex:1;display:flex;align-items:center;min-width:0}.sidenav-header[_ngcontent-%COMP%] .header-title-section[_ngcontent-%COMP%] .sidenav-title[_ngcontent-%COMP%]{margin:0;font-size:1.25rem;font-weight:600;color:var(--color-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mission-control-section[_ngcontent-%COMP%]{padding:.25rem 1rem .5rem;flex-shrink:0}.mission-control-link[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;background:transparent;border:none;text-decoration:none;cursor:pointer;transition:all .2s ease;font-size:.875rem;font-weight:500;color:var(--color-text-secondary);padding:0}.mission-control-link[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px;color:var(--color-text-secondary);transition:color .2s ease}.mission-control-link[_ngcontent-%COMP%]:hover{color:var(--color-primary);transform:translate(3px)}.mission-control-link[_ngcontent-%COMP%]:hover mat-icon[_ngcontent-%COMP%]{color:var(--color-primary)}.mission-control-link[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-primary);outline-offset:2px;border-radius:4px}.new-thread-section[_ngcontent-%COMP%]{padding:1rem 1rem .5rem;flex-shrink:0}.new-thread-link[_ngcontent-%COMP%]{display:inline-flex;align-items:center;background:transparent;border:none;text-decoration:none;cursor:pointer;transition:all .2s ease;gap:.5rem;font-size:.95rem;font-weight:600;padding:0}.new-thread-link[_ngcontent-%COMP%] .new-thread-text[_ngcontent-%COMP%]{background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% auto;background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;animation:_ngcontent-%COMP%_gradientShift 3s ease-in-out infinite}.new-thread-link[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px;color:var(--color-primary);animation:_ngcontent-%COMP%_iconPulse 3s ease-in-out infinite}.new-thread-link[_ngcontent-%COMP%]:hover{transform:translate(4px)}.new-thread-link[_ngcontent-%COMP%]:hover mat-icon[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_iconPulse 1.5s ease-in-out infinite}.new-thread-link[_ngcontent-%COMP%]:focus{transform:scale(1.1)}@keyframes _ngcontent-%COMP%_gradientShift{0%{background-position:0% center}50%{background-position:100% center}to{background-position:0% center}}@keyframes _ngcontent-%COMP%_iconPulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.8;transform:scale(1.05)}}.sidenav-sections[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex:1;min-height:100px;overflow:hidden}.sidenav-sections[_ngcontent-%COMP%] > .section-container[_ngcontent-%COMP%], .sidenav-sections[_ngcontent-%COMP%] > .section-container.expanded[_ngcontent-%COMP%], .sidenav-sections[_ngcontent-%COMP%] > .section-container[_ngcontent-%COMP%] > .section-content.threads[_ngcontent-%COMP%], .sidenav-sections[_ngcontent-%COMP%] > .section-container[_ngcontent-%COMP%] > .section-content.threads[_ngcontent-%COMP%] > app-thread-selector[_ngcontent-%COMP%]{display:flex!important;flex-direction:column!important;flex:1!important;min-height:0!important;overflow:hidden!important}.sidenav-nav[_ngcontent-%COMP%]{flex-shrink:0;display:flex;flex-direction:column;overflow:hidden;max-height:70%;border-top:1px solid var(--color-border)}.sidenav-nav[_ngcontent-%COMP%] > .settings-group[_ngcontent-%COMP%] > .section-toggle.active[_ngcontent-%COMP%]{border-top:none}.sidenav-nav[_ngcontent-%COMP%] .settings-group[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden}.sidenav-nav[_ngcontent-%COMP%] .settings-group[_ngcontent-%COMP%] > .section-toggle[_ngcontent-%COMP%]{flex-shrink:0}.sidenav-nav[_ngcontent-%COMP%] .settings-group[_ngcontent-%COMP%] > .section-content.settings-content[_ngcontent-%COMP%]{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden}.settings-group[_ngcontent-%COMP%] > .section-content.settings-content[_ngcontent-%COMP%]{padding:0;border-bottom:1px solid var(--color-border);overflow:visible}.settings-group[_ngcontent-%COMP%] > .section-content.settings-content[_ngcontent-%COMP%] .section-container.expanded[_ngcontent-%COMP%] .section-content[_ngcontent-%COMP%]{max-height:40vh;overflow-y:auto;overflow-x:hidden}.contribute-btn[_ngcontent-%COMP%] .contribute-logo[_ngcontent-%COMP%]{width:20px;height:20px;border-radius:2px;flex-shrink:0}.section-container[_ngcontent-%COMP%]{flex-shrink:0;display:flex;flex-direction:column}.section-container.expanded[_ngcontent-%COMP%] .section-content[_ngcontent-%COMP%]{border-bottom:none}.section-toggle[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.75rem;width:100%;padding:.5rem 1rem;height:50px;text-decoration:none;cursor:pointer;transition:all .2s ease;background:transparent;border:none;border-radius:0;color:var(--color-text);flex-shrink:0}.section-toggle.active[_ngcontent-%COMP%]{border-top:1px solid var(--color-border)}.section-toggle.disabled[_ngcontent-%COMP%]{opacity:.5;cursor:not-allowed;pointer-events:none}.section-toggle[_ngcontent-%COMP%] .arrow-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px;color:var(--color-text-secondary);transition:transform .2s ease;flex-shrink:0}.section-toggle[_ngcontent-%COMP%] .section-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px;color:var(--color-text-secondary);flex-shrink:0}.section-toggle[_ngcontent-%COMP%] .section-label[_ngcontent-%COMP%]{flex:1;font-size:.9rem;color:var(--color-text);text-align:left}.section-toggle[_ngcontent-%COMP%] .search-button[_ngcontent-%COMP%]{margin-left:auto;flex-shrink:0}.section-toggle[_ngcontent-%COMP%] .search-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px}.section-toggle[_ngcontent-%COMP%]:hover:not(.disabled){background:var(--color-bg-hover)}.section-toggle[_ngcontent-%COMP%]:active:not(.disabled){transform:scale(.98)}.section-toggle[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-primary);outline-offset:-2px}.search-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.5rem 1rem;height:50px;background:var(--color-bg-hover);border-top:1px solid var(--color-border);transition:all .2s ease}.search-header[_ngcontent-%COMP%] .search-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px;color:var(--color-text-secondary);flex-shrink:0}.search-header[_ngcontent-%COMP%] .search-input[_ngcontent-%COMP%]{flex:1;border:none;outline:none;background:transparent;color:var(--color-text);font-size:.9rem;padding:0;min-width:0}.search-header[_ngcontent-%COMP%] .search-input[_ngcontent-%COMP%]::placeholder{color:var(--color-text-muted)}.search-header[_ngcontent-%COMP%] .close-search-btn[_ngcontent-%COMP%]{flex-shrink:0}.search-header[_ngcontent-%COMP%] .close-search-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px}.section-content[_ngcontent-%COMP%]{padding:.5rem 0 0;animation:_ngcontent-%COMP%_slideDown .2s ease;border-bottom:1px solid var(--color-border);display:flex;flex-direction:column}.section-content.threads[_ngcontent-%COMP%]{padding:0;border-bottom:none;flex:1!important;min-height:0!important;overflow:hidden!important}.section-content.threads[_ngcontent-%COMP%] app-thread-selector[_ngcontent-%COMP%]{flex:1!important;min-height:0!important;overflow:hidden!important;display:flex!important;flex-direction:column!important}@keyframes _ngcontent-%COMP%_slideDown{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}.preference-item[_ngcontent-%COMP%]{padding-bottom:1rem;margin-bottom:1rem;border-bottom:1px solid var(--color-border)}.preference-item[_ngcontent-%COMP%]:last-child{margin-bottom:0;padding-bottom:0;border-bottom:none}.preference-item[_ngcontent-%COMP%] .preference-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.75rem;margin-bottom:.75rem;padding:0 1rem}.preference-item[_ngcontent-%COMP%] .preference-header[_ngcontent-%COMP%] .item-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px}.preference-item[_ngcontent-%COMP%] .preference-header[_ngcontent-%COMP%] .item-text[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.preference-item[_ngcontent-%COMP%] .preference-content[_ngcontent-%COMP%]{padding:0 1rem}.error-notification[_ngcontent-%COMP%]{position:fixed;top:5rem;left:50%;transform:translate(-50%);z-index:2000;display:flex;align-items:center;gap:.75rem;background:#ff3b3026;backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid rgba(255,59,48,.3);border-radius:16px;padding:1rem 1.5rem;box-shadow:var(--glass-shadow);animation:_ngcontent-%COMP%_errorSlideDown .3s cubic-bezier(.4,0,.2,1)}.error-notification[_ngcontent-%COMP%] .error-icon[_ngcontent-%COMP%]{font-size:1.2rem;flex-shrink:0;color:#c00}.error-notification[_ngcontent-%COMP%] .error-text[_ngcontent-%COMP%]{flex:1;color:#c00;font-size:.9rem;font-weight:500}@keyframes _ngcontent-%COMP%_errorSlideDown{0%{opacity:0;transform:translate(-50%,-10px)}to{opacity:1;transform:translate(-50%)}}@media(max-width:480px){.app-sidenav[_ngcontent-%COMP%]{width:320px}.sidenav-toggle-btn[_ngcontent-%COMP%]{top:.75rem!important;left:.75rem!important}.sidenav-new-thread-btn[_ngcontent-%COMP%]{top:calc(1.25rem + 40px)!important;left:.75rem!important}.error-notification[_ngcontent-%COMP%]{left:1rem;right:1rem;transform:none;max-width:calc(100vw - 2rem)}}body.dark[_nghost-%COMP%] .app-sidenav[_ngcontent-%COMP%], body.dark [_nghost-%COMP%] .app-sidenav[_ngcontent-%COMP%], [_ngcontent-%COMP%]:root[data-theme=dark] .app-sidenav[_ngcontent-%COMP%]{background:#242830f2;border-right-color:#b4c8ff17}body.dark[_nghost-%COMP%] .sidenav-header[_ngcontent-%COMP%], body.dark [_nghost-%COMP%] .sidenav-header[_ngcontent-%COMP%], [_ngcontent-%COMP%]:root[data-theme=dark] .sidenav-header[_ngcontent-%COMP%]{background:#242830b3}"],changeDetection:1})};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {x as xe}from'./chunk-CJpYYZh2.js';import {P as Pt$1,L as Lt}from'./chunk-CInfUnUL.js';import {v as ve,n as ne}from'./chunk-_kolzKbl.js';import {d}from'./chunk-Cy-MbcIf.js';import {W,k as ke,s as se}from'./chunk-DvV6rFWO.js';import {T as Tn,S as Sn,n as nt,a as ae,l as le,c as ce}from'./chunk-BfoCTjUr.js';import {W as Wn,o as ot,i as it,I as In,D as De,B as Be,y as ya,E as En,F as Fn,g as gt$1,A as An}from'./chunk-DXVBbChn.js';import'./chunk-BxT6IsjS.js';import {g,bl as Sm,R as Re,H as Hi,m as mT,A as Aw,i as hr,j as Gn,v as vs,l as Ag,W as WC,k as fl,a3 as HI,n as eC,af as Dg,ag as fT,T as TC,X as XE,r as Tg,a6 as $I,t as tC,Z as z,_ as Ue,am as Gm,$ as zt$1,a0 as jt$1,a1 as Vt,a2 as Nt$1,p as pr,ai as Jg,aj as KC,q as oC,a8 as Zg,ak as Xg,x as iC,a5 as yl,ac as mC,a9 as dC,aa as If,ab as wf,bo as gl,bp as ml,ah as rT,b3 as oT,aK as Do,aL as qn,bq as sn,aN as wt$1,br as Cl,bs as Qn,aS as Ut$1,al as yt$2,aV as w,bt as Ve,aY as ks,aZ as YT,b4 as nT,C as Cg,y as Hg,bu as kg,I as IC,E as wC,az as Qt$1,bv as St,aR as K$1,aW as D$1,bw as on,bx as am,by as Oi,bz as vC,bA as DC,o as bg,D as Fg,bB as Ii,bn as nC}from'./main-FEA3BAHM.js';import {y as yt$1,w as wt,t as ti,Z as Zn,c as cn,Y as Ye,f as fn,g as gt,$ as $t$1,D}from'./chunk-DFaRJnOg.js';var Pt=["button"],Ot=["*"];function Ft(l,a){if(l&1&&(vs(0,"div",2),bg(1,"mat-pseudo-checkbox",6),fl()),l&2){let e=mC();XE(),Tg("disabled",e.disabled);}}var yt=new w("MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS",{providedIn:"root",factory:()=>({hideSingleSelectionIndicator:false,hideMultipleSelectionIndicator:false,disabledInteractive:false})}),vt=new w("MatButtonToggleGroup"),Dt={provide:D,useExisting:Ii(()=>ie),multi:true},K=class{source;value;constructor(a,e){this.source=a,this.value=e;}},ie=(()=>{class l{_changeDetector=g(Cl);_dir=g(Qn,{optional:true});_multiple=false;_disabled=false;_disabledInteractive=false;_selectionModel;_rawValue;_controlValueAccessorChangeFn=()=>{};_onTouched=()=>{};_buttonToggles;appearance;get name(){return this._name}set name(e){this._name=e,this._markButtonsForCheck();}_name=g(Ut$1).getId("mat-button-toggle-group-");vertical=false;get value(){let e=this._selectionModel?this._selectionModel.selected:[];return this.multiple?e.map(t=>t.value):e[0]?e[0].value:void 0}set value(e){this._setSelectionByValue(e),this.valueChange.emit(this.value);}valueChange=new yt$2;get selected(){let e=this._selectionModel?this._selectionModel.selected:[];return this.multiple?e:e[0]||null}get multiple(){return this._multiple}set multiple(e){this._multiple=e,this._markButtonsForCheck();}get disabled(){return this._disabled}set disabled(e){this._disabled=e,this._markButtonsForCheck();}get disabledInteractive(){return this._disabledInteractive}set disabledInteractive(e){this._disabledInteractive=e,this._markButtonsForCheck();}get dir(){return this._dir&&this._dir.value==="rtl"?"rtl":"ltr"}change=new yt$2;get hideSingleSelectionIndicator(){return this._hideSingleSelectionIndicator}set hideSingleSelectionIndicator(e){this._hideSingleSelectionIndicator=e,this._markButtonsForCheck();}_hideSingleSelectionIndicator;get hideMultipleSelectionIndicator(){return this._hideMultipleSelectionIndicator}set hideMultipleSelectionIndicator(e){this._hideMultipleSelectionIndicator=e,this._markButtonsForCheck();}_hideMultipleSelectionIndicator;constructor(){let e=g(yt,{optional:true});this.appearance=e&&e.appearance?e.appearance:"standard",this._hideSingleSelectionIndicator=e?.hideSingleSelectionIndicator??false,this._hideMultipleSelectionIndicator=e?.hideMultipleSelectionIndicator??false;}ngOnInit(){this._selectionModel=new gt$1(this.multiple,void 0,false);}ngAfterContentInit(){this._selectionModel.select(...this._buttonToggles.filter(e=>e.checked)),this.multiple||this._initializeTabIndex();}writeValue(e){this.value=e,this._changeDetector.markForCheck();}registerOnChange(e){this._controlValueAccessorChangeFn=e;}registerOnTouched(e){this._onTouched=e;}setDisabledState(e){this.disabled=e;}_keydown(e){if(this.multiple||this.disabled||Ve(e))return;let n=e.target.id,o=this._buttonToggles.toArray().findIndex(I=>I.buttonId===n),u=null;switch(e.keyCode){case 32:case 13:u=this._buttonToggles.get(o)||null;break;case 38:u=this._getNextButton(o,-1);break;case 37:u=this._getNextButton(o,this.dir==="ltr"?-1:1);break;case 40:u=this._getNextButton(o,1);break;case 39:u=this._getNextButton(o,this.dir==="ltr"?1:-1);break;default:return}u&&(e.preventDefault(),u._onButtonClick(),u.focus());}_emitChangeEvent(e){let t=new K(e,this.value);this._rawValue=t.value,this._controlValueAccessorChangeFn(t.value),this.change.emit(t);}_syncButtonToggle(e,t,n=false,o=false){!this.multiple&&this.selected&&!e.checked&&(this.selected.checked=false),this._selectionModel?t?this._selectionModel.select(e):this._selectionModel.deselect(e):o=true,o?Promise.resolve().then(()=>this._updateModelValue(e,n)):this._updateModelValue(e,n);}_isSelected(e){return this._selectionModel&&this._selectionModel.isSelected(e)}_isPrechecked(e){return typeof this._rawValue>"u"?false:this.multiple&&Array.isArray(this._rawValue)?this._rawValue.some(t=>e.value!=null&&t===e.value):e.value===this._rawValue}_initializeTabIndex(){if(this._buttonToggles.forEach(e=>{e.tabIndex=-1;}),this.selected)this.selected.tabIndex=0;else for(let e=0;e<this._buttonToggles.length;e++){let t=this._buttonToggles.get(e);if(!t.disabled){t.tabIndex=0;break}}}_getNextButton(e,t){let n=this._buttonToggles;for(let o=1;o<=n.length;o++){let u=(e+t*o+n.length)%n.length,I=n.get(u);if(I&&!I.disabled)return I}return null}_setSelectionByValue(e){if(this._rawValue=e,!this._buttonToggles)return;let t=this._buttonToggles.toArray();if(this.multiple&&e?(this._clearSelection(),e.forEach(n=>this._selectValue(n,t))):(this._clearSelection(),this._selectValue(e,t)),!this.multiple&&t.every(n=>n.tabIndex===-1)){for(let n of t)if(!n.disabled){n.tabIndex=0;break}}}_clearSelection(){this._selectionModel.clear(),this._buttonToggles.forEach(e=>{e.checked=false,this.multiple||(e.tabIndex=-1);});}_selectValue(e,t){for(let n of t)if(n.value===e){n.checked=true,this._selectionModel.select(n),this.multiple||(n.tabIndex=0);break}}_updateModelValue(e,t){t&&this._emitChangeEvent(e),this.valueChange.emit(this.value);}_markButtonsForCheck(){this._buttonToggles?.forEach(e=>e._markForCheck());}static \u0275fac=function(t){return new(t||l)};static \u0275dir=ks({type:l,selectors:[["mat-button-toggle-group"]],contentQueries:function(t,n,o){if(t&1&&kg(o,X,5),t&2){let u;IC(u=wC())&&(n._buttonToggles=u);}},hostAttrs:[1,"mat-button-toggle-group"],hostVars:6,hostBindings:function(t,n){t&1&&Ag("keydown",function(u){return n._keydown(u)}),t&2&&(Cg("role",n.multiple?"group":"radiogroup")("aria-disabled",n.disabled),Hg("mat-button-toggle-vertical",n.vertical)("mat-button-toggle-group-appearance-standard",n.appearance==="standard"));},inputs:{appearance:"appearance",name:"name",vertical:[2,"vertical","vertical",YT],value:"value",multiple:[2,"multiple","multiple",YT],disabled:[2,"disabled","disabled",YT],disabledInteractive:[2,"disabledInteractive","disabledInteractive",YT],hideSingleSelectionIndicator:[2,"hideSingleSelectionIndicator","hideSingleSelectionIndicator",YT],hideMultipleSelectionIndicator:[2,"hideMultipleSelectionIndicator","hideMultipleSelectionIndicator",YT]},outputs:{valueChange:"valueChange",change:"change"},exportAs:["matButtonToggleGroup"],features:[nT([Dt,{provide:vt,useExisting:l}])]})}return l})(),X=(()=>{class l{_changeDetectorRef=g(Cl);_elementRef=g(Qt$1);_focusMonitor=g(St);_idGenerator=g(Ut$1);_animationDisabled=K$1();_checked=false;ariaLabel;ariaLabelledby=null;_buttonElement;buttonToggleGroup;get buttonId(){return `${this.id}-button`}id;name;value;get tabIndex(){return this._tabIndex()}set tabIndex(e){this._tabIndex.set(e);}_tabIndex;disableRipple=false;get appearance(){return this.buttonToggleGroup?this.buttonToggleGroup.appearance:this._appearance}set appearance(e){this._appearance=e;}_appearance;get checked(){return this.buttonToggleGroup?this.buttonToggleGroup._isSelected(this):this._checked}set checked(e){e!==this._checked&&(this._checked=e,this.buttonToggleGroup&&this.buttonToggleGroup._syncButtonToggle(this,this._checked),this._changeDetectorRef.markForCheck());}get disabled(){return this._disabled||this.buttonToggleGroup&&this.buttonToggleGroup.disabled}set disabled(e){this._disabled=e;}_disabled=false;get disabledInteractive(){return this._disabledInteractive||this.buttonToggleGroup!==null&&this.buttonToggleGroup.disabledInteractive}set disabledInteractive(e){this._disabledInteractive=e;}_disabledInteractive;change=new yt$2;constructor(){g(D$1).load(on);let e=g(vt,{optional:true}),t=g(new am("tabindex"),{optional:true})||"",n=g(yt,{optional:true});this._tabIndex=Hi(parseInt(t)||0),this.buttonToggleGroup=e,this._appearance=n&&n.appearance?n.appearance:"standard",this._disabledInteractive=n?.disabledInteractive??false;}ngOnInit(){let e=this.buttonToggleGroup;this.id=this.id||this._idGenerator.getId("mat-button-toggle-"),e&&(e._isPrechecked(this)?this.checked=true:e._isSelected(this)!==this._checked&&e._syncButtonToggle(this,this._checked));}ngAfterViewInit(){this._animationDisabled||this._elementRef.nativeElement.classList.add("mat-button-toggle-animations-enabled"),this._focusMonitor.monitor(this._elementRef,true);}ngOnDestroy(){let e=this.buttonToggleGroup;this._focusMonitor.stopMonitoring(this._elementRef),e&&e._isSelected(this)&&e._syncButtonToggle(this,false,false,true);}focus(e){this._buttonElement.nativeElement.focus(e);}_onButtonClick(){if(this.disabled)return;let e=this.isSingleSelector()?true:!this._checked;if(e!==this._checked&&(this._checked=e,this.buttonToggleGroup&&(this.buttonToggleGroup._syncButtonToggle(this,this._checked,true),this.buttonToggleGroup._onTouched())),this.isSingleSelector()){let t=this.buttonToggleGroup._buttonToggles.find(n=>n.tabIndex===0);t&&(t.tabIndex=-1),this.tabIndex=0;}this.change.emit(new K(this,this.value));}_markForCheck(){this._changeDetectorRef.markForCheck();}_getButtonName(){return this.isSingleSelector()?this.buttonToggleGroup.name:this.name||null}isSingleSelector(){return this.buttonToggleGroup&&!this.buttonToggleGroup.multiple}static \u0275fac=function(t){return new(t||l)};static \u0275cmp=Aw({type:l,selectors:[["mat-button-toggle"]],viewQuery:function(t,n){if(t&1&&Fg(Pt,5),t&2){let o;IC(o=wC())&&(n._buttonElement=o.first);}},hostAttrs:["role","presentation",1,"mat-button-toggle"],hostVars:14,hostBindings:function(t,n){t&1&&Ag("focus",function(){return n.focus()}),t&2&&(Cg("aria-label",null)("aria-labelledby",null)("id",n.id)("name",null),Hg("mat-button-toggle-standalone",!n.buttonToggleGroup)("mat-button-toggle-checked",n.checked)("mat-button-toggle-disabled",n.disabled)("mat-button-toggle-disabled-interactive",n.disabledInteractive)("mat-button-toggle-appearance-standard",n.appearance==="standard"));},inputs:{ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],id:"id",name:"name",value:"value",tabIndex:"tabIndex",disableRipple:[2,"disableRipple","disableRipple",YT],appearance:"appearance",checked:[2,"checked","checked",YT],disabled:[2,"disabled","disabled",YT],disabledInteractive:[2,"disabledInteractive","disabledInteractive",YT]},outputs:{change:"change"},exportAs:["matButtonToggle"],ngContentSelectors:Ot,decls:7,vars:13,consts:[["button",""],["type","button",1,"mat-button-toggle-button","mat-focus-indicator",3,"click","id","disabled"],[1,"mat-button-toggle-checkbox-wrapper"],[1,"mat-button-toggle-label-content"],[1,"mat-button-toggle-focus-overlay"],["matRipple","",1,"mat-button-toggle-ripple",3,"matRippleTrigger","matRippleDisabled"],["state","checked","aria-hidden","true","appearance","minimal",3,"disabled"]],template:function(t,n){if(t&1&&(vC(),vs(0,"button",1,0),Ag("click",function(){return n._onButtonClick()}),eC(2,Ft,2,1,"div",2),vs(3,"span",3),DC(4),fl()(),bg(5,"span",4)(6,"span",5)),t&2){let o=TC(1);Tg("id",n.buttonId)("disabled",n.disabled&&!n.disabledInteractive||null),Cg("role",n.isSingleSelector()?"radio":"button")("tabindex",n.disabled&&!n.disabledInteractive?-1:n.tabIndex)("aria-pressed",n.isSingleSelector()?null:n.checked)("aria-checked",n.isSingleSelector()?n.checked:null)("name",n._getButtonName())("aria-label",n.ariaLabel)("aria-labelledby",n.ariaLabelledby)("aria-disabled",n.disabled&&n.disabledInteractive?"true":null),XE(2),tC(n.buttonToggleGroup&&(!n.buttonToggleGroup.multiple&&!n.buttonToggleGroup.hideSingleSelectionIndicator||n.buttonToggleGroup.multiple&&!n.buttonToggleGroup.hideMultipleSelectionIndicator)?2:-1),XE(4),Tg("matRippleTrigger",o)("matRippleDisabled",n.disableRipple||n.disabled);}},dependencies:[Oi,An],styles:[`.mat-button-toggle-standalone,
|
|
1
|
+
import {x as xe}from'./chunk-DCFeDlSq.js';import {P as Pt$1,L as Lt}from'./chunk-DhQrwAbV.js';import {v as ve,n as ne}from'./chunk-BJDJk0Qw.js';import {d}from'./chunk-BOeKkAt9.js';import {W,k as ke,s as se}from'./chunk-DiDEqeDl.js';import {T as Tn,S as Sn,n as nt,a as ae,l as le,c as ce}from'./chunk-DNDvYXLF.js';import {W as Wn,o as ot,i as it,I as In,D as De,B as Be,y as ya,E as En,F as Fn,g as gt$1,A as An}from'./chunk-BxdDXOEe.js';import'./chunk-CMmtnH6_.js';import {g,bl as Sm,R as Re,H as Hi,m as mT,A as Aw,i as hr,j as Gn,v as vs,l as Ag,W as WC,k as fl,a3 as HI,n as eC,af as Dg,ag as fT,T as TC,X as XE,r as Tg,a6 as $I,t as tC,Z as z,_ as Ue,am as Gm,$ as zt$1,a0 as jt$1,a1 as Vt,a2 as Nt$1,p as pr,ai as Jg,aj as KC,q as oC,a8 as Zg,ak as Xg,x as iC,a5 as yl,ac as mC,a9 as dC,aa as If,ab as wf,bo as gl,bp as ml,ah as rT,b3 as oT,aK as Do,aL as qn,bq as sn,aN as wt$1,br as Cl,bs as Qn,aS as Ut$1,al as yt$2,aV as w,bt as Ve,aY as ks,aZ as YT,b4 as nT,C as Cg,y as Hg,bu as kg,I as IC,E as wC,az as Qt$1,bv as St,aR as K$1,aW as D$1,bw as on,bx as am,by as Oi,bz as vC,bA as DC,o as bg,D as Fg,bB as Ii,bn as nC}from'./main-5DW6JQ3Z.js';import {y as yt$1,w as wt,t as ti,Z as Zn,c as cn,Y as Ye,f as fn,g as gt,$ as $t$1,D}from'./chunk-OltVHUw7.js';var Pt=["button"],Ot=["*"];function Ft(l,a){if(l&1&&(vs(0,"div",2),bg(1,"mat-pseudo-checkbox",6),fl()),l&2){let e=mC();XE(),Tg("disabled",e.disabled);}}var yt=new w("MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS",{providedIn:"root",factory:()=>({hideSingleSelectionIndicator:false,hideMultipleSelectionIndicator:false,disabledInteractive:false})}),vt=new w("MatButtonToggleGroup"),Dt={provide:D,useExisting:Ii(()=>ie),multi:true},K=class{source;value;constructor(a,e){this.source=a,this.value=e;}},ie=(()=>{class l{_changeDetector=g(Cl);_dir=g(Qn,{optional:true});_multiple=false;_disabled=false;_disabledInteractive=false;_selectionModel;_rawValue;_controlValueAccessorChangeFn=()=>{};_onTouched=()=>{};_buttonToggles;appearance;get name(){return this._name}set name(e){this._name=e,this._markButtonsForCheck();}_name=g(Ut$1).getId("mat-button-toggle-group-");vertical=false;get value(){let e=this._selectionModel?this._selectionModel.selected:[];return this.multiple?e.map(t=>t.value):e[0]?e[0].value:void 0}set value(e){this._setSelectionByValue(e),this.valueChange.emit(this.value);}valueChange=new yt$2;get selected(){let e=this._selectionModel?this._selectionModel.selected:[];return this.multiple?e:e[0]||null}get multiple(){return this._multiple}set multiple(e){this._multiple=e,this._markButtonsForCheck();}get disabled(){return this._disabled}set disabled(e){this._disabled=e,this._markButtonsForCheck();}get disabledInteractive(){return this._disabledInteractive}set disabledInteractive(e){this._disabledInteractive=e,this._markButtonsForCheck();}get dir(){return this._dir&&this._dir.value==="rtl"?"rtl":"ltr"}change=new yt$2;get hideSingleSelectionIndicator(){return this._hideSingleSelectionIndicator}set hideSingleSelectionIndicator(e){this._hideSingleSelectionIndicator=e,this._markButtonsForCheck();}_hideSingleSelectionIndicator;get hideMultipleSelectionIndicator(){return this._hideMultipleSelectionIndicator}set hideMultipleSelectionIndicator(e){this._hideMultipleSelectionIndicator=e,this._markButtonsForCheck();}_hideMultipleSelectionIndicator;constructor(){let e=g(yt,{optional:true});this.appearance=e&&e.appearance?e.appearance:"standard",this._hideSingleSelectionIndicator=e?.hideSingleSelectionIndicator??false,this._hideMultipleSelectionIndicator=e?.hideMultipleSelectionIndicator??false;}ngOnInit(){this._selectionModel=new gt$1(this.multiple,void 0,false);}ngAfterContentInit(){this._selectionModel.select(...this._buttonToggles.filter(e=>e.checked)),this.multiple||this._initializeTabIndex();}writeValue(e){this.value=e,this._changeDetector.markForCheck();}registerOnChange(e){this._controlValueAccessorChangeFn=e;}registerOnTouched(e){this._onTouched=e;}setDisabledState(e){this.disabled=e;}_keydown(e){if(this.multiple||this.disabled||Ve(e))return;let n=e.target.id,o=this._buttonToggles.toArray().findIndex(I=>I.buttonId===n),u=null;switch(e.keyCode){case 32:case 13:u=this._buttonToggles.get(o)||null;break;case 38:u=this._getNextButton(o,-1);break;case 37:u=this._getNextButton(o,this.dir==="ltr"?-1:1);break;case 40:u=this._getNextButton(o,1);break;case 39:u=this._getNextButton(o,this.dir==="ltr"?1:-1);break;default:return}u&&(e.preventDefault(),u._onButtonClick(),u.focus());}_emitChangeEvent(e){let t=new K(e,this.value);this._rawValue=t.value,this._controlValueAccessorChangeFn(t.value),this.change.emit(t);}_syncButtonToggle(e,t,n=false,o=false){!this.multiple&&this.selected&&!e.checked&&(this.selected.checked=false),this._selectionModel?t?this._selectionModel.select(e):this._selectionModel.deselect(e):o=true,o?Promise.resolve().then(()=>this._updateModelValue(e,n)):this._updateModelValue(e,n);}_isSelected(e){return this._selectionModel&&this._selectionModel.isSelected(e)}_isPrechecked(e){return typeof this._rawValue>"u"?false:this.multiple&&Array.isArray(this._rawValue)?this._rawValue.some(t=>e.value!=null&&t===e.value):e.value===this._rawValue}_initializeTabIndex(){if(this._buttonToggles.forEach(e=>{e.tabIndex=-1;}),this.selected)this.selected.tabIndex=0;else for(let e=0;e<this._buttonToggles.length;e++){let t=this._buttonToggles.get(e);if(!t.disabled){t.tabIndex=0;break}}}_getNextButton(e,t){let n=this._buttonToggles;for(let o=1;o<=n.length;o++){let u=(e+t*o+n.length)%n.length,I=n.get(u);if(I&&!I.disabled)return I}return null}_setSelectionByValue(e){if(this._rawValue=e,!this._buttonToggles)return;let t=this._buttonToggles.toArray();if(this.multiple&&e?(this._clearSelection(),e.forEach(n=>this._selectValue(n,t))):(this._clearSelection(),this._selectValue(e,t)),!this.multiple&&t.every(n=>n.tabIndex===-1)){for(let n of t)if(!n.disabled){n.tabIndex=0;break}}}_clearSelection(){this._selectionModel.clear(),this._buttonToggles.forEach(e=>{e.checked=false,this.multiple||(e.tabIndex=-1);});}_selectValue(e,t){for(let n of t)if(n.value===e){n.checked=true,this._selectionModel.select(n),this.multiple||(n.tabIndex=0);break}}_updateModelValue(e,t){t&&this._emitChangeEvent(e),this.valueChange.emit(this.value);}_markButtonsForCheck(){this._buttonToggles?.forEach(e=>e._markForCheck());}static \u0275fac=function(t){return new(t||l)};static \u0275dir=ks({type:l,selectors:[["mat-button-toggle-group"]],contentQueries:function(t,n,o){if(t&1&&kg(o,X,5),t&2){let u;IC(u=wC())&&(n._buttonToggles=u);}},hostAttrs:[1,"mat-button-toggle-group"],hostVars:6,hostBindings:function(t,n){t&1&&Ag("keydown",function(u){return n._keydown(u)}),t&2&&(Cg("role",n.multiple?"group":"radiogroup")("aria-disabled",n.disabled),Hg("mat-button-toggle-vertical",n.vertical)("mat-button-toggle-group-appearance-standard",n.appearance==="standard"));},inputs:{appearance:"appearance",name:"name",vertical:[2,"vertical","vertical",YT],value:"value",multiple:[2,"multiple","multiple",YT],disabled:[2,"disabled","disabled",YT],disabledInteractive:[2,"disabledInteractive","disabledInteractive",YT],hideSingleSelectionIndicator:[2,"hideSingleSelectionIndicator","hideSingleSelectionIndicator",YT],hideMultipleSelectionIndicator:[2,"hideMultipleSelectionIndicator","hideMultipleSelectionIndicator",YT]},outputs:{valueChange:"valueChange",change:"change"},exportAs:["matButtonToggleGroup"],features:[nT([Dt,{provide:vt,useExisting:l}])]})}return l})(),X=(()=>{class l{_changeDetectorRef=g(Cl);_elementRef=g(Qt$1);_focusMonitor=g(St);_idGenerator=g(Ut$1);_animationDisabled=K$1();_checked=false;ariaLabel;ariaLabelledby=null;_buttonElement;buttonToggleGroup;get buttonId(){return `${this.id}-button`}id;name;value;get tabIndex(){return this._tabIndex()}set tabIndex(e){this._tabIndex.set(e);}_tabIndex;disableRipple=false;get appearance(){return this.buttonToggleGroup?this.buttonToggleGroup.appearance:this._appearance}set appearance(e){this._appearance=e;}_appearance;get checked(){return this.buttonToggleGroup?this.buttonToggleGroup._isSelected(this):this._checked}set checked(e){e!==this._checked&&(this._checked=e,this.buttonToggleGroup&&this.buttonToggleGroup._syncButtonToggle(this,this._checked),this._changeDetectorRef.markForCheck());}get disabled(){return this._disabled||this.buttonToggleGroup&&this.buttonToggleGroup.disabled}set disabled(e){this._disabled=e;}_disabled=false;get disabledInteractive(){return this._disabledInteractive||this.buttonToggleGroup!==null&&this.buttonToggleGroup.disabledInteractive}set disabledInteractive(e){this._disabledInteractive=e;}_disabledInteractive;change=new yt$2;constructor(){g(D$1).load(on);let e=g(vt,{optional:true}),t=g(new am("tabindex"),{optional:true})||"",n=g(yt,{optional:true});this._tabIndex=Hi(parseInt(t)||0),this.buttonToggleGroup=e,this._appearance=n&&n.appearance?n.appearance:"standard",this._disabledInteractive=n?.disabledInteractive??false;}ngOnInit(){let e=this.buttonToggleGroup;this.id=this.id||this._idGenerator.getId("mat-button-toggle-"),e&&(e._isPrechecked(this)?this.checked=true:e._isSelected(this)!==this._checked&&e._syncButtonToggle(this,this._checked));}ngAfterViewInit(){this._animationDisabled||this._elementRef.nativeElement.classList.add("mat-button-toggle-animations-enabled"),this._focusMonitor.monitor(this._elementRef,true);}ngOnDestroy(){let e=this.buttonToggleGroup;this._focusMonitor.stopMonitoring(this._elementRef),e&&e._isSelected(this)&&e._syncButtonToggle(this,false,false,true);}focus(e){this._buttonElement.nativeElement.focus(e);}_onButtonClick(){if(this.disabled)return;let e=this.isSingleSelector()?true:!this._checked;if(e!==this._checked&&(this._checked=e,this.buttonToggleGroup&&(this.buttonToggleGroup._syncButtonToggle(this,this._checked,true),this.buttonToggleGroup._onTouched())),this.isSingleSelector()){let t=this.buttonToggleGroup._buttonToggles.find(n=>n.tabIndex===0);t&&(t.tabIndex=-1),this.tabIndex=0;}this.change.emit(new K(this,this.value));}_markForCheck(){this._changeDetectorRef.markForCheck();}_getButtonName(){return this.isSingleSelector()?this.buttonToggleGroup.name:this.name||null}isSingleSelector(){return this.buttonToggleGroup&&!this.buttonToggleGroup.multiple}static \u0275fac=function(t){return new(t||l)};static \u0275cmp=Aw({type:l,selectors:[["mat-button-toggle"]],viewQuery:function(t,n){if(t&1&&Fg(Pt,5),t&2){let o;IC(o=wC())&&(n._buttonElement=o.first);}},hostAttrs:["role","presentation",1,"mat-button-toggle"],hostVars:14,hostBindings:function(t,n){t&1&&Ag("focus",function(){return n.focus()}),t&2&&(Cg("aria-label",null)("aria-labelledby",null)("id",n.id)("name",null),Hg("mat-button-toggle-standalone",!n.buttonToggleGroup)("mat-button-toggle-checked",n.checked)("mat-button-toggle-disabled",n.disabled)("mat-button-toggle-disabled-interactive",n.disabledInteractive)("mat-button-toggle-appearance-standard",n.appearance==="standard"));},inputs:{ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],id:"id",name:"name",value:"value",tabIndex:"tabIndex",disableRipple:[2,"disableRipple","disableRipple",YT],appearance:"appearance",checked:[2,"checked","checked",YT],disabled:[2,"disabled","disabled",YT],disabledInteractive:[2,"disabledInteractive","disabledInteractive",YT]},outputs:{change:"change"},exportAs:["matButtonToggle"],ngContentSelectors:Ot,decls:7,vars:13,consts:[["button",""],["type","button",1,"mat-button-toggle-button","mat-focus-indicator",3,"click","id","disabled"],[1,"mat-button-toggle-checkbox-wrapper"],[1,"mat-button-toggle-label-content"],[1,"mat-button-toggle-focus-overlay"],["matRipple","",1,"mat-button-toggle-ripple",3,"matRippleTrigger","matRippleDisabled"],["state","checked","aria-hidden","true","appearance","minimal",3,"disabled"]],template:function(t,n){if(t&1&&(vC(),vs(0,"button",1,0),Ag("click",function(){return n._onButtonClick()}),eC(2,Ft,2,1,"div",2),vs(3,"span",3),DC(4),fl()(),bg(5,"span",4)(6,"span",5)),t&2){let o=TC(1);Tg("id",n.buttonId)("disabled",n.disabled&&!n.disabledInteractive||null),Cg("role",n.isSingleSelector()?"radio":"button")("tabindex",n.disabled&&!n.disabledInteractive?-1:n.tabIndex)("aria-pressed",n.isSingleSelector()?null:n.checked)("aria-checked",n.isSingleSelector()?n.checked:null)("name",n._getButtonName())("aria-label",n.ariaLabel)("aria-labelledby",n.ariaLabelledby)("aria-disabled",n.disabled&&n.disabledInteractive?"true":null),XE(2),tC(n.buttonToggleGroup&&(!n.buttonToggleGroup.multiple&&!n.buttonToggleGroup.hideSingleSelectionIndicator||n.buttonToggleGroup.multiple&&!n.buttonToggleGroup.hideMultipleSelectionIndicator)?2:-1),XE(4),Tg("matRippleTrigger",o)("matRippleDisabled",n.disableRipple||n.disabled);}},dependencies:[Oi,An],styles:[`.mat-button-toggle-standalone,
|
|
2
2
|
.mat-button-toggle-group {
|
|
3
3
|
position: relative;
|
|
4
4
|
display: inline-flex;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,di as te,Y as x}from'./main-
|
|
1
|
+
import {g,di as te,Y as x}from'./main-5DW6JQ3Z.js';var c=class r{api=g(te);getById(e){return this.api.getByIdScheduledPrompt(e)}listPlatform(){return this.api.searchScheduledPrompt({namespaceId:null,userId:null})}listByNamespace(e){return this.api.searchScheduledPrompt({namespaceId:e,userId:null})}search(e){return this.api.searchScheduledPrompt(e)}listEffective(e){return this.api.resolveEffectiveScheduledPrompt(e)}create(e){return this.api.createScheduledPrompt(e)}update(e,t){return this.api.updateScheduledPrompt(e,t)}enable(e){return this.api.enableScheduledPrompt(e)}disable(e){return this.api.disableScheduledPrompt(e)}delete(e){return this.api.deleteScheduledPrompt(e)}static \u0275fac=function(t){return new(t||r)};static \u0275prov=x({token:r,factory:r.\u0275fac,providedIn:"root"})};export{c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {c}from'./chunk-CsvLyu6R.js';import {g,ao as V,G,w as we$1,d7 as M,d8 as he$1,d9 as fe$1,H as Hi,da as ge$1,F,bQ as bd,m as mT,Q as By,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,t as tC,a9 as dC,o as bg,a3 as HI,q as oC,ac as mC,r as Tg,y as Hg,a6 as $I,x as iC,a8 as Zg,aa as If,ab as wf,bj as yh}from'./main-FEA3BAHM.js';import {o as z,k as _t,b as _e$1,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,f as fn,a as wt,A as At,Z as Zn,l as Xn,$ as $t,C as Cn,E as En}from'./chunk-DFaRJnOg.js';var A=(n,t)=>t.value,se=(n,t)=>t.id;function pe(n,t){n&1&&(vs(0,"p",5),WC(1,"Loading\u2026"),fl());}function ue(n,t){n&1&&(vs(0,"span",12),WC(1," Name is required. "),fl());}function fe(n,t){if(n&1&&(vs(0,"p",40),WC(1),fl(),vs(2,"span",13),WC(3,"Agent Config cannot be changed after creation."),fl()),n&2){let e=mC(2);XE(),Zg(e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function _e(n,t){if(n&1&&(vs(0,"a",41),WC(1,"Add an agent config"),fl(),WC(2," first. ")),n&2){let e=mC(3);Tg("href","/agentos/"+e.namespaceId+"/agent-configs/new",yh);}}function he(n,t){if(n&1&&(vs(0,"p",13),WC(1," No agent configs available in this scope yet. "),eC(2,_e,3,1),fl()),n&2){let e=mC(2);XE(2),tC(e.isPlatformMode?-1:2);}}function ge(n,t){if(n&1&&(vs(0,"option",23),WC(1),fl()),n&2){let e=t.$implicit;Tg("value",e.id),XE(),Zg(e.name);}}function Ce(n,t){n&1&&(vs(0,"span",12),WC(1,"Agent Config is required."),fl());}function ve(n,t){if(n&1&&(vs(0,"select",42)(1,"option",43),WC(2,"Select an agent config\u2026"),fl(),oC(3,ge,2,2,"option",23,se),fl(),HI(),eC(5,Ce,2,0,"span",12),vs(6,"span",13),WC(7,"Immutable after creation."),fl()),n&2){let e=mC(2);Tg("formControl",e.agentConfigIdControl),$I(),XE(3),iC(e.availableAgentConfigs()),XE(2),tC(e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?5:-1);}}function ye(n,t){n&1&&(vs(0,"span",12),WC(1,"Opening message is required."),fl());}function be(n,t){if(n&1&&(vs(0,"option",23),WC(1),fl()),n&2){let e=t.$implicit;Tg("value",e.value),XE(),Zg(e.label);}}function xe(n,t){if(n&1){let e=dC();vs(0,"label",46)(1,"input",47),Ag("change",function(){let h=If(e).$implicit,P=mC(3);return wf(P.toggleDay(h.value))}),fl(),vs(2,"span",48),WC(3),fl()();}if(n&2){let e=t.$implicit,l=mC(3);XE(),Tg("checked",l.isDaySelected(e.value)),XE(2),Zg(e.label);}}function Se(n,t){if(n&1&&(vs(0,"div",8)(1,"span",44),WC(2,"Days of week"),fl(),vs(3,"div",45),oC(4,xe,4,2,"label",46,A),fl(),vs(6,"span",13),WC(7,"Leave empty to run every day of the week."),fl()()),n&2){let e=mC(2);XE(4),iC(e.dayOptions);}}function Pe(n,t){n&1&&(vs(0,"span",12),WC(1,"Valid time is required (HH:mm)."),fl());}function Ee(n,t){n&1&&(vs(0,"span",12),WC(1,"Start date is required."),fl());}function Me(n,t){if(n&1&&(vs(0,"option",23),WC(1),fl()),n&2){let e=t.$implicit;Tg("value",e.value),XE(),Zg(e.label);}}function Oe(n,t){n&1&&(vs(0,"span",12),WC(1,"End date is required."),fl());}function De(n,t){if(n&1&&(vs(0,"div",8)(1,"label",49),WC(2," End date "),vs(3,"span",10),WC(4,"*"),fl()(),bg(5,"input",50),HI(),eC(6,Oe,2,0,"span",12),fl()),n&2){let e=mC(2);XE(5),Hg("scheduled-prompt-form__input--invalid",e.form.hasError("endDateRequired")&&e.endDateControl.touched),Tg("formControl",e.endDateControl),$I(),XE(),tC(e.form.hasError("endDateRequired")&&e.endDateControl.touched?6:-1);}}function Te(n,t){n&1&&(vs(0,"span",12),WC(1,"Must be at least 1."),fl());}function we(n,t){if(n&1&&(vs(0,"div",8)(1,"label",51),WC(2," Number of occurrences "),vs(3,"span",10),WC(4,"*"),fl()(),bg(5,"input",52),HI(),eC(6,Te,2,0,"span",12),fl()),n&2){let e=mC(2);XE(5),Hg("scheduled-prompt-form__input--invalid",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched),Tg("formControl",e.occurrenceCountControl),$I(),XE(),tC(e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?6:-1);}}function ke(n,t){if(n&1&&(vs(0,"p",36),WC(1),fl()),n&2){let e=mC(2);XE(),Zg(e.errorMessage());}}function Fe(n,t){if(n&1){let e=dC();vs(0,"form",7),Ag("ngSubmit",function(){If(e);let h=mC();return wf(h.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,ue,2,0,"span",12),vs(8,"span",13),WC(9,'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.'),fl()(),vs(10,"div",8)(11,"label",14),WC(12,"Description"),fl(),bg(13,"input",15),HI(),fl(),vs(14,"div",8)(15,"label",16),WC(16," Agent Config "),vs(17,"span",10),WC(18,"*"),fl()(),eC(19,fe,4,1)(20,he,3,1,"p",13)(21,ve,8,2),fl(),vs(22,"div",8)(23,"label",17),WC(24," Opening message "),vs(25,"span",10),WC(26,"*"),fl()(),bg(27,"textarea",18),HI(),eC(28,ye,2,0,"span",12),vs(29,"span",13),WC(30," The message sent to the agent when the scheduled prompt fires. "),fl()(),vs(31,"fieldset",19)(32,"legend",20),WC(33,"Recurrence"),fl(),vs(34,"div",8)(35,"label",21),WC(36," Unit "),vs(37,"span",10),WC(38,"*"),fl()(),vs(39,"select",22),oC(40,be,2,2,"option",23,A),fl(),HI(),fl(),eC(42,Se,8,0,"div",8),vs(43,"div",8)(44,"label",24),WC(45," Time (UTC) "),vs(46,"span",10),WC(47,"*"),fl()(),vs(48,"div",25),bg(49,"input",26),HI(),vs(50,"span",27),WC(51,"UTC"),fl()(),eC(52,Pe,2,0,"span",12),fl()(),vs(53,"fieldset",19)(54,"legend",20),WC(55,"Planning"),fl(),vs(56,"div",8)(57,"label",28),WC(58," Start date "),vs(59,"span",10),WC(60,"*"),fl()(),bg(61,"input",29),HI(),eC(62,Ee,2,0,"span",12),fl(),vs(63,"div",8)(64,"label",30),WC(65," Ends "),vs(66,"span",10),WC(67,"*"),fl()(),vs(68,"select",31),oC(69,Me,2,2,"option",23,A),fl(),HI(),fl(),eC(71,De,7,4,"div",8),eC(72,we,7,4,"div",8),fl(),vs(73,"div",8)(74,"label",32),bg(75,"input",33),HI(),vs(76,"span",34),WC(77,"Enabled"),fl()(),vs(78,"p",35),WC(79," When disabled, the scheduled prompt is saved but will not run on schedule. "),fl()(),eC(80,ke,2,1,"p",36),vs(81,"div",37)(82,"button",38),WC(83),fl(),vs(84,"button",39),Ag("click",function(){If(e);let h=mC();return wf(h.cancel())}),WC(85,"Cancel"),fl()()();}if(n&2){let e=mC();Tg("formGroup",e.form),XE(6),Hg("scheduled-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(6),Tg("formControl",e.descriptionControl),$I(),XE(6),tC(e.isEditMode()?19:e.availableAgentConfigs().length===0?20:21),XE(8),Hg("scheduled-prompt-form__textarea--invalid",e.promptContentControl.invalid&&e.promptContentControl.touched),Tg("formControl",e.promptContentControl),$I(),XE(),tC(e.promptContentControl.invalid&&e.promptContentControl.touched?28:-1),XE(11),Tg("formControl",e.unitControl),$I(),XE(),iC(e.schedulerUnits),XE(2),tC(e.showDayFilter()?42:-1),XE(7),Tg("formControl",e.timeUtcControl),$I(),XE(3),tC(e.timeUtcControl.invalid&&e.timeUtcControl.touched?52:-1),XE(9),Hg("scheduled-prompt-form__input--invalid",e.startDateControl.invalid&&e.startDateControl.touched),Tg("formControl",e.startDateControl),$I(),XE(),tC(e.startDateControl.invalid&&e.startDateControl.touched?62:-1),XE(6),Tg("formControl",e.endTypeControl),$I(),XE(),iC(e.endTypes),XE(2),tC(e.showEndDate()?71:-1),XE(),tC(e.showOccurrenceCount()?72:-1),XE(3),Tg("formControl",e.enabledControl),$I(),XE(5),tC(e.errorMessage()?80:-1),XE(2),Tg("disabled",e.form.invalid||e.isSubmitting()),XE(),yl(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var me=class n{route=g(V);router=g(G);destroyRef=g(we$1);state=g(c);agentConfigController=g(M);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new z({name:new _t("",{nonNullable:true,validators:[_e$1.required]}),description:new _t(null),agentConfigId:new _t("",{nonNullable:true,validators:[_e$1.required]}),promptContent:new _t("",{nonNullable:true,validators:[_e$1.required]}),unit:new _t(fe$1.WEEK,{nonNullable:true,validators:[_e$1.required]}),days:new _t([],{nonNullable:true}),timeUtc:new _t("09:00",{nonNullable:true,validators:[_e$1.required,_e$1.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new _t("",{nonNullable:true,validators:[_e$1.required]}),endType:new _t(he$1.NEVER,{nonNullable:true,validators:[_e$1.required]}),endDate:new _t(null),occurrenceCount:new _t(null),enabled:new _t(true,{nonNullable:true})},{validators:[Ne,Ie]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}isEditMode=Hi(false);isSubmitting=Hi(false);isLoading=Hi(false);errorMessage=Hi(null);SchedulerUnit=fe$1;SchedulerEndType=he$1;schedulerUnits=[{value:fe$1.WEEK,label:"Week(s)"},{value:fe$1.MONTH,label:"Month(s)"}];endTypes=[{value:he$1.NEVER,label:"Never"},{value:he$1.ON_DATE,label:"On date"},{value:he$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(ge$1).map(([t,e])=>({value:t,label:e}));unitSignal=F(this.unitControl.valueChanges.pipe(bd(this.unitControl.value)));endTypeSignal=F(this.endTypeControl.valueChanges.pipe(bd(this.endTypeControl.value)));showDayFilter=mT(()=>this.unitSignal()===fe$1.WEEK);showEndDate=mT(()=>this.endTypeSignal()===he$1.ON_DATE);showOccurrenceCount=mT(()=>this.endTypeSignal()===he$1.OCCURRENCES);agentConfigs=Hi([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Ve());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(true),this.loadPromptAndResources(t)):this.loadResources();}loadPromptAndResources(t){this.isLoading.set(true),By({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(U(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:l})=>{this.existingPrompt=e,this.agentConfigs.set(l),this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadResources(){this.agentConfigs$().pipe(U(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(ga(()=>ha([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled);}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,l=e.includes(t)?e.filter(h=>h!==t):[...e,t];this.daysControl.setValue(l);}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,l=z$1(P({},this.existingPrompt??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,agentConfigId:t?this.existingPrompt.agentConfigId:this.agentConfigIdControl.value,promptContent:this.promptContentControl.value.trim(),recurrence:{unit:this.unitControl.value,days:this.daysControl.value,timeUtc:this.timeUtcControl.value},planning:{startDate:this.startDateControl.value,endType:e,endDate:e===he$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===he$1.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value});(t?this.state.update(this.existingPrompt.id,l):this.state.create(l)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:P=>{this.isSubmitting.set(false),P.status===409?this.errorMessage.set(`A scheduled prompt named "${l.name}" already exists in this scope.`):P.status===400?this.errorMessage.set(P.error?.message??"Invalid scheduled prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","scheduled-prompts"]):this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Aw({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:10,vars:3,consts:[[1,"scheduled-prompt-form"],[1,"scheduled-prompt-form__header"],["type","button","title","Back to scheduled prompts",1,"scheduled-prompt-form__back",3,"click"],[1,"scheduled-prompt-form__back-icon"],[1,"scheduled-prompt-form__title"],[1,"scheduled-prompt-form__loading"],[1,"scheduled-prompt-form__form",3,"formGroup"],[1,"scheduled-prompt-form__form",3,"ngSubmit","formGroup"],[1,"scheduled-prompt-form__field"],["for","sp-name",1,"scheduled-prompt-form__label"],["aria-hidden","true"],["id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],[1,"scheduled-prompt-form__field-error"],[1,"scheduled-prompt-form__field-hint"],["for","sp-description",1,"scheduled-prompt-form__label"],["id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-agent-config",1,"scheduled-prompt-form__label"],["for","sp-prompt-content",1,"scheduled-prompt-form__label"],["id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",1,"scheduled-prompt-form__textarea",3,"formControl"],[1,"scheduled-prompt-form__fieldset"],[1,"scheduled-prompt-form__legend"],["for","sp-unit",1,"scheduled-prompt-form__label"],["id","sp-unit",1,"scheduled-prompt-form__select",3,"formControl"],[3,"value"],["for","sp-time",1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__time-wrapper"],["id","sp-time","type","time",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--time",3,"formControl"],[1,"scheduled-prompt-form__utc-badge"],["for","sp-start-date",1,"scheduled-prompt-form__label"],["id","sp-start-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-end-type",1,"scheduled-prompt-form__label"],["id","sp-end-type",1,"scheduled-prompt-form__select",3,"formControl"],[1,"scheduled-prompt-form__toggle-label"],["type","checkbox",1,"scheduled-prompt-form__toggle-checkbox",3,"formControl"],[1,"scheduled-prompt-form__toggle-text"],[1,"scheduled-prompt-form__toggle-hint"],[1,"scheduled-prompt-form__error"],[1,"scheduled-prompt-form__actions"],["type","submit",1,"scheduled-prompt-form__btn","scheduled-prompt-form__btn--primary",3,"disabled"],["type","button",1,"scheduled-prompt-form__btn",3,"click"],[1,"scheduled-prompt-form__readonly-value"],[3,"href"],["id","sp-agent-config",1,"scheduled-prompt-form__select",3,"formControl"],["value","","disabled",""],[1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__day-grid"],[1,"scheduled-prompt-form__day-label"],["type","checkbox",1,"scheduled-prompt-form__day-checkbox",3,"change","checked"],[1,"scheduled-prompt-form__day-text"],["for","sp-end-date",1,"scheduled-prompt-form__label"],["id","sp-end-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-occurrence-count",1,"scheduled-prompt-form__label"],["id","sp-occurrence-count","type","number","min","1",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--number",3,"formControl"]],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,pe,2,0,"p",5)(9,Fe,86,26,"form",6),fl()),e&2&&(XE(5),yl(" ",l.isPlatformMode?"Platform Scheduled Prompts":"Scheduled Prompts"," "),XE(2),yl(" ",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"," "),XE(),tC(l.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,fn,wt,At,Zn,Xn,$t,Cn,En],styles:[".scheduled-prompt-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.scheduled-prompt-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.scheduled-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-primary, #007aff);font-family:inherit}.scheduled-prompt-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.scheduled-prompt-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.scheduled-prompt-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.scheduled-prompt-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.scheduled-prompt-form__row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.scheduled-prompt-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__input[_ngcontent-%COMP%], .scheduled-prompt-form__select[_ngcontent-%COMP%], .scheduled-prompt-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.scheduled-prompt-form__input[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__select[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.scheduled-prompt-form__input[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__select[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__select[_ngcontent-%COMP%]{cursor:pointer;appearance:auto}.scheduled-prompt-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:100px;line-height:1.5}.scheduled-prompt-form__input--time[_ngcontent-%COMP%]{flex:1;min-width:0}.scheduled-prompt-form__input--number[_ngcontent-%COMP%]{max-width:120px}.scheduled-prompt-form__time-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.scheduled-prompt-form__utc-badge[_ngcontent-%COMP%]{flex-shrink:0;font-size:.75rem;font-weight:600;font-family:monospace;color:var(--color-text-secondary, #6e6e73);background:var(--color-surface, rgba(0, 0, 0, .05));padding:.25rem .5rem;border-radius:4px;text-transform:uppercase;letter-spacing:.06em}.scheduled-prompt-form__fieldset[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:8px;padding:1rem 1.25rem 1.25rem;margin:0;display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__legend[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--color-text-secondary, #6e6e73);padding:0 .375rem}.scheduled-prompt-form__day-grid[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.5rem}.scheduled-prompt-form__day-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__day-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__day-text[_ngcontent-%COMP%]{font-size:.875rem;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__hint[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30);margin:0}.scheduled-prompt-form__field-error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30)}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__readonly-value[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;color:var(--color-text, #1d1d1f);padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--color-surface, rgba(0, 0, 0, .03))}.scheduled-prompt-form__input--invalid[_ngcontent-%COMP%], .scheduled-prompt-form__textarea--invalid[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30)}.scheduled-prompt-form__toggle-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__toggle-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__toggle-text[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__toggle-hint[_ngcontent-%COMP%]{margin:.25rem 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.scheduled-prompt-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"]})};function Ne(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===he$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ie(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===he$1.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function Ve(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${l}`}export{me as ScheduledPromptFormComponent};
|
|
1
|
+
import {c}from'./chunk-Dz0byKBh.js';import {g,ao as V,G,w as we$1,d7 as M,d8 as he$1,d9 as fe$1,H as Hi,da as ge$1,F,bQ as bd,m as mT,Q as By,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,t as tC,a9 as dC,o as bg,a3 as HI,q as oC,ac as mC,r as Tg,y as Hg,a6 as $I,x as iC,a8 as Zg,aa as If,ab as wf,bj as yh}from'./main-5DW6JQ3Z.js';import {o as z,k as _t,b as _e$1,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,f as fn,a as wt,A as At,Z as Zn,l as Xn,$ as $t,C as Cn,E as En}from'./chunk-OltVHUw7.js';var A=(n,t)=>t.value,se=(n,t)=>t.id;function pe(n,t){n&1&&(vs(0,"p",5),WC(1,"Loading\u2026"),fl());}function ue(n,t){n&1&&(vs(0,"span",12),WC(1," Name is required. "),fl());}function fe(n,t){if(n&1&&(vs(0,"p",40),WC(1),fl(),vs(2,"span",13),WC(3,"Agent Config cannot be changed after creation."),fl()),n&2){let e=mC(2);XE(),Zg(e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function _e(n,t){if(n&1&&(vs(0,"a",41),WC(1,"Add an agent config"),fl(),WC(2," first. ")),n&2){let e=mC(3);Tg("href","/agentos/"+e.namespaceId+"/agent-configs/new",yh);}}function he(n,t){if(n&1&&(vs(0,"p",13),WC(1," No agent configs available in this scope yet. "),eC(2,_e,3,1),fl()),n&2){let e=mC(2);XE(2),tC(e.isPlatformMode?-1:2);}}function ge(n,t){if(n&1&&(vs(0,"option",23),WC(1),fl()),n&2){let e=t.$implicit;Tg("value",e.id),XE(),Zg(e.name);}}function Ce(n,t){n&1&&(vs(0,"span",12),WC(1,"Agent Config is required."),fl());}function ve(n,t){if(n&1&&(vs(0,"select",42)(1,"option",43),WC(2,"Select an agent config\u2026"),fl(),oC(3,ge,2,2,"option",23,se),fl(),HI(),eC(5,Ce,2,0,"span",12),vs(6,"span",13),WC(7,"Immutable after creation."),fl()),n&2){let e=mC(2);Tg("formControl",e.agentConfigIdControl),$I(),XE(3),iC(e.availableAgentConfigs()),XE(2),tC(e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?5:-1);}}function ye(n,t){n&1&&(vs(0,"span",12),WC(1,"Opening message is required."),fl());}function be(n,t){if(n&1&&(vs(0,"option",23),WC(1),fl()),n&2){let e=t.$implicit;Tg("value",e.value),XE(),Zg(e.label);}}function xe(n,t){if(n&1){let e=dC();vs(0,"label",46)(1,"input",47),Ag("change",function(){let h=If(e).$implicit,P=mC(3);return wf(P.toggleDay(h.value))}),fl(),vs(2,"span",48),WC(3),fl()();}if(n&2){let e=t.$implicit,l=mC(3);XE(),Tg("checked",l.isDaySelected(e.value)),XE(2),Zg(e.label);}}function Se(n,t){if(n&1&&(vs(0,"div",8)(1,"span",44),WC(2,"Days of week"),fl(),vs(3,"div",45),oC(4,xe,4,2,"label",46,A),fl(),vs(6,"span",13),WC(7,"Leave empty to run every day of the week."),fl()()),n&2){let e=mC(2);XE(4),iC(e.dayOptions);}}function Pe(n,t){n&1&&(vs(0,"span",12),WC(1,"Valid time is required (HH:mm)."),fl());}function Ee(n,t){n&1&&(vs(0,"span",12),WC(1,"Start date is required."),fl());}function Me(n,t){if(n&1&&(vs(0,"option",23),WC(1),fl()),n&2){let e=t.$implicit;Tg("value",e.value),XE(),Zg(e.label);}}function Oe(n,t){n&1&&(vs(0,"span",12),WC(1,"End date is required."),fl());}function De(n,t){if(n&1&&(vs(0,"div",8)(1,"label",49),WC(2," End date "),vs(3,"span",10),WC(4,"*"),fl()(),bg(5,"input",50),HI(),eC(6,Oe,2,0,"span",12),fl()),n&2){let e=mC(2);XE(5),Hg("scheduled-prompt-form__input--invalid",e.form.hasError("endDateRequired")&&e.endDateControl.touched),Tg("formControl",e.endDateControl),$I(),XE(),tC(e.form.hasError("endDateRequired")&&e.endDateControl.touched?6:-1);}}function Te(n,t){n&1&&(vs(0,"span",12),WC(1,"Must be at least 1."),fl());}function we(n,t){if(n&1&&(vs(0,"div",8)(1,"label",51),WC(2," Number of occurrences "),vs(3,"span",10),WC(4,"*"),fl()(),bg(5,"input",52),HI(),eC(6,Te,2,0,"span",12),fl()),n&2){let e=mC(2);XE(5),Hg("scheduled-prompt-form__input--invalid",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched),Tg("formControl",e.occurrenceCountControl),$I(),XE(),tC(e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?6:-1);}}function ke(n,t){if(n&1&&(vs(0,"p",36),WC(1),fl()),n&2){let e=mC(2);XE(),Zg(e.errorMessage());}}function Fe(n,t){if(n&1){let e=dC();vs(0,"form",7),Ag("ngSubmit",function(){If(e);let h=mC();return wf(h.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,ue,2,0,"span",12),vs(8,"span",13),WC(9,'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.'),fl()(),vs(10,"div",8)(11,"label",14),WC(12,"Description"),fl(),bg(13,"input",15),HI(),fl(),vs(14,"div",8)(15,"label",16),WC(16," Agent Config "),vs(17,"span",10),WC(18,"*"),fl()(),eC(19,fe,4,1)(20,he,3,1,"p",13)(21,ve,8,2),fl(),vs(22,"div",8)(23,"label",17),WC(24," Opening message "),vs(25,"span",10),WC(26,"*"),fl()(),bg(27,"textarea",18),HI(),eC(28,ye,2,0,"span",12),vs(29,"span",13),WC(30," The message sent to the agent when the scheduled prompt fires. "),fl()(),vs(31,"fieldset",19)(32,"legend",20),WC(33,"Recurrence"),fl(),vs(34,"div",8)(35,"label",21),WC(36," Unit "),vs(37,"span",10),WC(38,"*"),fl()(),vs(39,"select",22),oC(40,be,2,2,"option",23,A),fl(),HI(),fl(),eC(42,Se,8,0,"div",8),vs(43,"div",8)(44,"label",24),WC(45," Time (UTC) "),vs(46,"span",10),WC(47,"*"),fl()(),vs(48,"div",25),bg(49,"input",26),HI(),vs(50,"span",27),WC(51,"UTC"),fl()(),eC(52,Pe,2,0,"span",12),fl()(),vs(53,"fieldset",19)(54,"legend",20),WC(55,"Planning"),fl(),vs(56,"div",8)(57,"label",28),WC(58," Start date "),vs(59,"span",10),WC(60,"*"),fl()(),bg(61,"input",29),HI(),eC(62,Ee,2,0,"span",12),fl(),vs(63,"div",8)(64,"label",30),WC(65," Ends "),vs(66,"span",10),WC(67,"*"),fl()(),vs(68,"select",31),oC(69,Me,2,2,"option",23,A),fl(),HI(),fl(),eC(71,De,7,4,"div",8),eC(72,we,7,4,"div",8),fl(),vs(73,"div",8)(74,"label",32),bg(75,"input",33),HI(),vs(76,"span",34),WC(77,"Enabled"),fl()(),vs(78,"p",35),WC(79," When disabled, the scheduled prompt is saved but will not run on schedule. "),fl()(),eC(80,ke,2,1,"p",36),vs(81,"div",37)(82,"button",38),WC(83),fl(),vs(84,"button",39),Ag("click",function(){If(e);let h=mC();return wf(h.cancel())}),WC(85,"Cancel"),fl()()();}if(n&2){let e=mC();Tg("formGroup",e.form),XE(6),Hg("scheduled-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(6),Tg("formControl",e.descriptionControl),$I(),XE(6),tC(e.isEditMode()?19:e.availableAgentConfigs().length===0?20:21),XE(8),Hg("scheduled-prompt-form__textarea--invalid",e.promptContentControl.invalid&&e.promptContentControl.touched),Tg("formControl",e.promptContentControl),$I(),XE(),tC(e.promptContentControl.invalid&&e.promptContentControl.touched?28:-1),XE(11),Tg("formControl",e.unitControl),$I(),XE(),iC(e.schedulerUnits),XE(2),tC(e.showDayFilter()?42:-1),XE(7),Tg("formControl",e.timeUtcControl),$I(),XE(3),tC(e.timeUtcControl.invalid&&e.timeUtcControl.touched?52:-1),XE(9),Hg("scheduled-prompt-form__input--invalid",e.startDateControl.invalid&&e.startDateControl.touched),Tg("formControl",e.startDateControl),$I(),XE(),tC(e.startDateControl.invalid&&e.startDateControl.touched?62:-1),XE(6),Tg("formControl",e.endTypeControl),$I(),XE(),iC(e.endTypes),XE(2),tC(e.showEndDate()?71:-1),XE(),tC(e.showOccurrenceCount()?72:-1),XE(3),Tg("formControl",e.enabledControl),$I(),XE(5),tC(e.errorMessage()?80:-1),XE(2),Tg("disabled",e.form.invalid||e.isSubmitting()),XE(),yl(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var me=class n{route=g(V);router=g(G);destroyRef=g(we$1);state=g(c);agentConfigController=g(M);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new z({name:new _t("",{nonNullable:true,validators:[_e$1.required]}),description:new _t(null),agentConfigId:new _t("",{nonNullable:true,validators:[_e$1.required]}),promptContent:new _t("",{nonNullable:true,validators:[_e$1.required]}),unit:new _t(fe$1.WEEK,{nonNullable:true,validators:[_e$1.required]}),days:new _t([],{nonNullable:true}),timeUtc:new _t("09:00",{nonNullable:true,validators:[_e$1.required,_e$1.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new _t("",{nonNullable:true,validators:[_e$1.required]}),endType:new _t(he$1.NEVER,{nonNullable:true,validators:[_e$1.required]}),endDate:new _t(null),occurrenceCount:new _t(null),enabled:new _t(true,{nonNullable:true})},{validators:[Ne,Ie]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}isEditMode=Hi(false);isSubmitting=Hi(false);isLoading=Hi(false);errorMessage=Hi(null);SchedulerUnit=fe$1;SchedulerEndType=he$1;schedulerUnits=[{value:fe$1.WEEK,label:"Week(s)"},{value:fe$1.MONTH,label:"Month(s)"}];endTypes=[{value:he$1.NEVER,label:"Never"},{value:he$1.ON_DATE,label:"On date"},{value:he$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(ge$1).map(([t,e])=>({value:t,label:e}));unitSignal=F(this.unitControl.valueChanges.pipe(bd(this.unitControl.value)));endTypeSignal=F(this.endTypeControl.valueChanges.pipe(bd(this.endTypeControl.value)));showDayFilter=mT(()=>this.unitSignal()===fe$1.WEEK);showEndDate=mT(()=>this.endTypeSignal()===he$1.ON_DATE);showOccurrenceCount=mT(()=>this.endTypeSignal()===he$1.OCCURRENCES);agentConfigs=Hi([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Ve());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(true),this.loadPromptAndResources(t)):this.loadResources();}loadPromptAndResources(t){this.isLoading.set(true),By({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(U(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:l})=>{this.existingPrompt=e,this.agentConfigs.set(l),this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadResources(){this.agentConfigs$().pipe(U(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(ga(()=>ha([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled);}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,l=e.includes(t)?e.filter(h=>h!==t):[...e,t];this.daysControl.setValue(l);}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,l=z$1(P({},this.existingPrompt??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,agentConfigId:t?this.existingPrompt.agentConfigId:this.agentConfigIdControl.value,promptContent:this.promptContentControl.value.trim(),recurrence:{unit:this.unitControl.value,days:this.daysControl.value,timeUtc:this.timeUtcControl.value},planning:{startDate:this.startDateControl.value,endType:e,endDate:e===he$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===he$1.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value});(t?this.state.update(this.existingPrompt.id,l):this.state.create(l)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:P=>{this.isSubmitting.set(false),P.status===409?this.errorMessage.set(`A scheduled prompt named "${l.name}" already exists in this scope.`):P.status===400?this.errorMessage.set(P.error?.message??"Invalid scheduled prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","scheduled-prompts"]):this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Aw({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:10,vars:3,consts:[[1,"scheduled-prompt-form"],[1,"scheduled-prompt-form__header"],["type","button","title","Back to scheduled prompts",1,"scheduled-prompt-form__back",3,"click"],[1,"scheduled-prompt-form__back-icon"],[1,"scheduled-prompt-form__title"],[1,"scheduled-prompt-form__loading"],[1,"scheduled-prompt-form__form",3,"formGroup"],[1,"scheduled-prompt-form__form",3,"ngSubmit","formGroup"],[1,"scheduled-prompt-form__field"],["for","sp-name",1,"scheduled-prompt-form__label"],["aria-hidden","true"],["id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],[1,"scheduled-prompt-form__field-error"],[1,"scheduled-prompt-form__field-hint"],["for","sp-description",1,"scheduled-prompt-form__label"],["id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-agent-config",1,"scheduled-prompt-form__label"],["for","sp-prompt-content",1,"scheduled-prompt-form__label"],["id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",1,"scheduled-prompt-form__textarea",3,"formControl"],[1,"scheduled-prompt-form__fieldset"],[1,"scheduled-prompt-form__legend"],["for","sp-unit",1,"scheduled-prompt-form__label"],["id","sp-unit",1,"scheduled-prompt-form__select",3,"formControl"],[3,"value"],["for","sp-time",1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__time-wrapper"],["id","sp-time","type","time",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--time",3,"formControl"],[1,"scheduled-prompt-form__utc-badge"],["for","sp-start-date",1,"scheduled-prompt-form__label"],["id","sp-start-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-end-type",1,"scheduled-prompt-form__label"],["id","sp-end-type",1,"scheduled-prompt-form__select",3,"formControl"],[1,"scheduled-prompt-form__toggle-label"],["type","checkbox",1,"scheduled-prompt-form__toggle-checkbox",3,"formControl"],[1,"scheduled-prompt-form__toggle-text"],[1,"scheduled-prompt-form__toggle-hint"],[1,"scheduled-prompt-form__error"],[1,"scheduled-prompt-form__actions"],["type","submit",1,"scheduled-prompt-form__btn","scheduled-prompt-form__btn--primary",3,"disabled"],["type","button",1,"scheduled-prompt-form__btn",3,"click"],[1,"scheduled-prompt-form__readonly-value"],[3,"href"],["id","sp-agent-config",1,"scheduled-prompt-form__select",3,"formControl"],["value","","disabled",""],[1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__day-grid"],[1,"scheduled-prompt-form__day-label"],["type","checkbox",1,"scheduled-prompt-form__day-checkbox",3,"change","checked"],[1,"scheduled-prompt-form__day-text"],["for","sp-end-date",1,"scheduled-prompt-form__label"],["id","sp-end-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-occurrence-count",1,"scheduled-prompt-form__label"],["id","sp-occurrence-count","type","number","min","1",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--number",3,"formControl"]],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,pe,2,0,"p",5)(9,Fe,86,26,"form",6),fl()),e&2&&(XE(5),yl(" ",l.isPlatformMode?"Platform Scheduled Prompts":"Scheduled Prompts"," "),XE(2),yl(" ",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"," "),XE(),tC(l.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,fn,wt,At,Zn,Xn,$t,Cn,En],styles:[".scheduled-prompt-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.scheduled-prompt-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.scheduled-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-primary, #007aff);font-family:inherit}.scheduled-prompt-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.scheduled-prompt-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.scheduled-prompt-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.scheduled-prompt-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.scheduled-prompt-form__row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.scheduled-prompt-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__input[_ngcontent-%COMP%], .scheduled-prompt-form__select[_ngcontent-%COMP%], .scheduled-prompt-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.scheduled-prompt-form__input[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__select[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.scheduled-prompt-form__input[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__select[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__select[_ngcontent-%COMP%]{cursor:pointer;appearance:auto}.scheduled-prompt-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:100px;line-height:1.5}.scheduled-prompt-form__input--time[_ngcontent-%COMP%]{flex:1;min-width:0}.scheduled-prompt-form__input--number[_ngcontent-%COMP%]{max-width:120px}.scheduled-prompt-form__time-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.scheduled-prompt-form__utc-badge[_ngcontent-%COMP%]{flex-shrink:0;font-size:.75rem;font-weight:600;font-family:monospace;color:var(--color-text-secondary, #6e6e73);background:var(--color-surface, rgba(0, 0, 0, .05));padding:.25rem .5rem;border-radius:4px;text-transform:uppercase;letter-spacing:.06em}.scheduled-prompt-form__fieldset[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:8px;padding:1rem 1.25rem 1.25rem;margin:0;display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__legend[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--color-text-secondary, #6e6e73);padding:0 .375rem}.scheduled-prompt-form__day-grid[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.5rem}.scheduled-prompt-form__day-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__day-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__day-text[_ngcontent-%COMP%]{font-size:.875rem;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__hint[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30);margin:0}.scheduled-prompt-form__field-error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30)}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__readonly-value[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;color:var(--color-text, #1d1d1f);padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--color-surface, rgba(0, 0, 0, .03))}.scheduled-prompt-form__input--invalid[_ngcontent-%COMP%], .scheduled-prompt-form__textarea--invalid[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30)}.scheduled-prompt-form__toggle-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__toggle-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__toggle-text[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__toggle-hint[_ngcontent-%COMP%]{margin:.25rem 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.scheduled-prompt-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"]})};function Ne(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===he$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ie(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===he$1.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function Ve(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${l}`}export{me as ScheduledPromptFormComponent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {f}from'./chunk-Bc_JiT75.js';import {G as Ge,$,K as Ke,E as Et,y as yt$2}from'./chunk-hcl2JPuw.js';import {U as Ue$1,x as x$1,i as is}from'./chunk-Lluy_pM_.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-FEA3BAHM.js';import {s}from'./chunk-CH0b9ss9.js';import {d}from'./chunk-Cy-MbcIf.js';import {S as Se$1,P as Pn}from'./chunk-DXVBbChn.js';import {u as ui$1,m as mt$1,p as pt$1,Z,V as Ve}from'./chunk-BxT6IsjS.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-DFaRJnOg.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-BUhk1lXE.js';import {G as Ge,$,K as Ke,E as Et,y as yt$2}from'./chunk-XZia3sF0.js';import {U as Ue$1,x as x$1,i as is}from'./chunk-D_f8A0gu.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-5DW6JQ3Z.js';import {s}from'./chunk-B_mBd-rJ.js';import {d}from'./chunk-BOeKkAt9.js';import {S as Se$1,P as Pn}from'./chunk-BxdDXOEe.js';import {u as ui$1,m as mt$1,p as pt$1,Z,V as Ve}from'./chunk-CMmtnH6_.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-OltVHUw7.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={"&":"&","<":"<",">":">",'"':""","'":"'"};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(`
|