@whoz-oss/coday-client 3.22.0 → 3.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/{chunk-DeRNr5E2.js → chunk-15rAOoZz.js} +2 -2
- package/browser/chunk-16yQFy5_.js +1 -0
- package/browser/{chunk-NNu6xUAE.js → chunk-4XIlyOr9.js} +2 -2
- package/browser/{chunk-afcQqtlz.js → chunk-7-d3g3_Q.js} +1 -1
- package/browser/{chunk-GG036UVD.js → chunk-B-t2KLMQ.js} +1 -1
- package/browser/chunk-B3xYeZtG.js +1 -0
- package/browser/chunk-B4l5qLZ6.js +1 -0
- package/browser/{chunk-BKBTovXz.js → chunk-B52iVZ-n.js} +5 -5
- package/browser/chunk-B7GIYsvs.js +1 -0
- package/browser/{chunk-KoKdufNA.js → chunk-BBRGEWfs.js} +1 -1
- package/browser/{chunk-D1v8TfDX.js → chunk-BHb31ndI.js} +1 -1
- package/browser/{chunk-C_OF_Yht.js → chunk-BK_05kmN.js} +1 -1
- package/browser/chunk-BLSD82nL.js +1 -0
- package/browser/{chunk-MecHdK4O.js → chunk-BOArVQMu.js} +1 -1
- package/browser/{chunk-Bg-7wA2s.js → chunk-BPAPWlpQ.js} +1 -1
- package/browser/{chunk-Duk6Ikve.js → chunk-BQmHxval.js} +1 -1
- package/browser/{chunk-DqDzCK-6.js → chunk-BYJTaU4n.js} +1 -1
- package/browser/{chunk-C5Sn2M5w.js → chunk-BYg1TwUC.js} +1 -1
- package/browser/{chunk-D2fwi0Hc.js → chunk-BqhCkR9t.js} +1 -1
- package/browser/{chunk-DBUR_gpS.js → chunk-BqxwtKFs.js} +1 -1
- package/browser/{chunk-DXd3i3QM.js → chunk-Byin_63d.js} +5 -5
- package/browser/{chunk-C1X5uZwT.js → chunk-BzZbVcon.js} +3 -3
- package/browser/{chunk-CU4qkq0J.js → chunk-C11du_uP.js} +1 -1
- package/browser/chunk-C1RU8zia.js +9 -0
- package/browser/{chunk-I_PMkbKO.js → chunk-C2Rueaad.js} +1 -1
- package/browser/{chunk-DCkYfo8J.js → chunk-C2agnPiQ.js} +1 -1
- package/browser/{chunk-B8IQI7aT.js → chunk-C93ZXc5y.js} +1 -1
- package/browser/{chunk-B69a5iLl.js → chunk-C9dkqMA4.js} +1 -1
- package/browser/{chunk-BCGN7Bq-.js → chunk-CBYDDKYs.js} +1 -1
- package/browser/{chunk-CxXOCgTg.js → chunk-CIcEtCxk.js} +1 -1
- package/browser/{chunk-CPlR5wjp.js → chunk-CIfgFQUQ.js} +3 -3
- package/browser/chunk-CKBQdAGJ.js +1 -0
- package/browser/chunk-CKEgNNXU.js +1 -0
- package/browser/{chunk-BNNLW7hd.js → chunk-CPI0Zzv3.js} +1 -1
- package/browser/{chunk-DmbNv5OX.js → chunk-CPt7Uw3a.js} +1 -1
- package/browser/{chunk-DkqPRNv1.js → chunk-CaH-AtD3.js} +2 -2
- package/browser/{chunk-C9nbDemu.js → chunk-CbCwwL-W.js} +1 -1
- package/browser/{chunk-D4w4_Vsw.js → chunk-Cf7f_94t.js} +1 -1
- package/browser/{chunk-Dipwr8Xn.js → chunk-CjPIJIB-.js} +1 -1
- package/browser/{chunk-CJKwH7Qd.js → chunk-Co5BFbll.js} +1 -1
- package/browser/{chunk-Dwp6OoVJ.js → chunk-CqM-2yCQ.js} +2 -2
- package/browser/{chunk-CFD2_xIF.js → chunk-CzDFGxwY.js} +1 -1
- package/browser/{chunk-dNACuqx8.js → chunk-D-5Imhde.js} +1 -1
- package/browser/{chunk-gaa6JiT9.js → chunk-D4DTIvDf.js} +1 -1
- package/browser/chunk-D4_R7aqN.js +1 -0
- package/browser/{chunk-3KjG4Ivh.js → chunk-DCjMvdvV.js} +1 -1
- package/browser/{chunk-CtVgyQBm.js → chunk-DCx8SlS-.js} +1 -1
- package/browser/{chunk-OuaG8E_K.js → chunk-DDertr1B.js} +1 -1
- package/browser/{chunk-CNz7zaTq.js → chunk-DFjiy89D.js} +1 -1
- package/browser/{chunk-BD91wN51.js → chunk-DIuETvVC.js} +1 -1
- package/browser/{chunk-DAxRjiEx.js → chunk-DK1hp0WW.js} +6 -6
- package/browser/chunk-DNVNXvsJ.js +1 -0
- package/browser/{chunk-CYOKxOkd.js → chunk-DeXXr4BL.js} +6 -6
- package/browser/{chunk-DNRaKymp.js → chunk-DgYr3Diz.js} +1 -1
- package/browser/{chunk-DH88xB_s.js → chunk-DpkO3_bQ.js} +1 -1
- package/browser/{chunk-BLF3w_iN.js → chunk-DuXr-yGB.js} +1 -1
- package/browser/{chunk-DUCSH1q7.js → chunk-DwQ0v-xH.js} +1 -1
- package/browser/{chunk-B1VIKLB-.js → chunk-I8YepFsn.js} +2 -2
- package/browser/{chunk-kUdwsgzt.js → chunk-IXLj2Qpp.js} +1 -1
- package/browser/{chunk-A12eXtlW.js → chunk-KXiD_ZK3.js} +1 -1
- package/browser/chunk-TkSR4UzV.js +1 -0
- package/browser/{chunk-32YJp-72.js → chunk-XBakzM_b.js} +1 -1
- package/browser/chunk-buoxjd5i.js +1 -0
- package/browser/{chunk-CxnQWVA-.js → chunk-g2nkIubB.js} +1 -1
- package/browser/{chunk-CHP4jN9Z.js → chunk-j5aTABHx.js} +1 -1
- package/browser/chunk-kNbhE9tu.js +2 -0
- package/browser/{chunk-Bf3fjpOn.js → chunk-mUd43Vo8.js} +1 -1
- package/browser/{chunk-cyIUrL9y.js → chunk-nSYjfmpf.js} +1 -1
- package/browser/{chunk-DsnIWrL1.js → chunk-sLJinEtR.js} +1 -1
- package/browser/index.html +1 -1
- package/browser/{main-P72KGKGP.js → main-JTU33H5D.js} +18 -18
- package/package.json +1 -1
- package/browser/chunk-BIeOmcVm.js +0 -2
- package/browser/chunk-BRwhmCei.js +0 -1
- package/browser/chunk-BWJO7VDR.js +0 -1
- package/browser/chunk-BgdV8OdP.js +0 -1
- package/browser/chunk-C9ckXqnn.js +0 -1
- package/browser/chunk-CPOlQJvd.js +0 -1
- package/browser/chunk-CThn4VXH.js +0 -1
- package/browser/chunk-CUv3B-19.js +0 -9
- package/browser/chunk-CoPepxeH.js +0 -1
- package/browser/chunk-DJaf3eTF.js +0 -1
- package/browser/chunk-Dpnh8sS8.js +0 -1
- package/browser/chunk-DzcV-nhe.js +0 -1
- package/browser/chunk-NBeBKSWy.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {c}from'./chunk-IXLj2Qpp.js';import {g,ao as V,G,C as Ce$1,da as M,db as Pe$1,dc as ve$1,W as Wi,dd as je,F,bR as Sd,T as TT,S as Wy,b as U,a7 as va,X as br,z as z$1,a as P,j as jw,k as Cs,n as Lg,J as JC,m as hl,o as aC,u as sI,a5 as Dl,v as cC,a9 as vC,A as Ag,a3 as ZI,q as dC,ac as CC,x as xg,y as qg,a6 as QI,w as fC,a8 as em,aa as Sf,ab as _f,bk as wh}from'./main-JTU33H5D.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-DuXr-yGB.js';var A=(n,t)=>t.value,me=(n,t)=>t.id;function pe(n,t){n&1&&(Cs(0,"p",5),JC(1,"Loading\u2026"),hl());}function ue(n,t){n&1&&(Cs(0,"span",12),JC(1," Name is required. "),hl());}function fe(n,t){if(n&1&&(Cs(0,"p",42),JC(1),hl(),Cs(2,"span",13),JC(3,"Agent Config cannot be changed after creation."),hl()),n&2){let e=CC(2);sI(),em(e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function _e(n,t){if(n&1&&(Cs(0,"a",43),JC(1,"Add an agent config"),hl(),JC(2," first. ")),n&2){let e=CC(3);xg("href","/agentos/"+e.namespaceId+"/agent-configs/new",wh);}}function he(n,t){if(n&1&&(Cs(0,"p",13),JC(1," No agent configs available in this scope yet. "),aC(2,_e,3,1),hl()),n&2){let e=CC(2);sI(2),cC(e.isPlatformMode?-1:2);}}function ge(n,t){if(n&1&&(Cs(0,"option",23),JC(1),hl()),n&2){let e=t.$implicit;xg("value",e.id),sI(),em(e.name);}}function Ce(n,t){n&1&&(Cs(0,"span",12),JC(1,"Agent Config is required."),hl());}function ve(n,t){if(n&1&&(Cs(0,"select",44)(1,"option",45),JC(2,"Select an agent config\u2026"),hl(),dC(3,ge,2,2,"option",23,me),hl(),ZI(),aC(5,Ce,2,0,"span",12),Cs(6,"span",13),JC(7,"Immutable after creation."),hl()),n&2){let e=CC(2);xg("formControl",e.agentConfigIdControl),QI(),sI(3),fC(e.availableAgentConfigs()),sI(2),cC(e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?5:-1);}}function xe(n,t){n&1&&(Cs(0,"span",12),JC(1,"Opening message is required."),hl());}function ye(n,t){if(n&1&&(Cs(0,"option",23),JC(1),hl()),n&2){let e=t.$implicit;xg("value",e.value),sI(),em(e.label);}}function be(n,t){if(n&1){let e=vC();Cs(0,"label",48)(1,"input",49),Lg("change",function(){let g=Sf(e).$implicit,v=CC(3);return _f(v.toggleDay(g.value))}),hl(),Cs(2,"span",50),JC(3),hl()();}if(n&2){let e=t.$implicit,d=CC(3);sI(),xg("checked",d.isDaySelected(e.value)),sI(2),em(e.label);}}function Se(n,t){if(n&1&&(Cs(0,"div",8)(1,"span",46),JC(2,"Days of week"),hl(),Cs(3,"div",47),dC(4,be,4,2,"label",48,A),hl(),Cs(6,"span",13),JC(7,"Leave empty to run every day of the week."),hl()()),n&2){let e=CC(2);sI(4),fC(e.dayOptions);}}function Ee(n,t){n&1&&(Cs(0,"span",12),JC(1,"Valid time is required (HH:mm)."),hl());}function Pe(n,t){n&1&&(Cs(0,"span",12),JC(1,"Start date is required."),hl());}function Me(n,t){if(n&1&&(Cs(0,"option",23),JC(1),hl()),n&2){let e=t.$implicit;xg("value",e.value),sI(),em(e.label);}}function Oe(n,t){n&1&&(Cs(0,"span",12),JC(1,"End date is required."),hl());}function De(n,t){if(n&1&&(Cs(0,"div",8)(1,"label",51),JC(2," End date "),Cs(3,"span",10),JC(4,"*"),hl()(),Ag(5,"input",52),ZI(),aC(6,Oe,2,0,"span",12),hl()),n&2){let e=CC(2);sI(5),qg("scheduled-prompt-form__input--invalid",e.form.hasError("endDateRequired")&&e.endDateControl.touched),xg("formControl",e.endDateControl),QI(),sI(),cC(e.form.hasError("endDateRequired")&&e.endDateControl.touched?6:-1);}}function Te(n,t){n&1&&(Cs(0,"span",12),JC(1,"Must be at least 1."),hl());}function we(n,t){if(n&1&&(Cs(0,"div",8)(1,"label",53),JC(2," Number of occurrences "),Cs(3,"span",10),JC(4,"*"),hl()(),Ag(5,"input",54),ZI(),aC(6,Te,2,0,"span",12),hl()),n&2){let e=CC(2);sI(5),qg("scheduled-prompt-form__input--invalid",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched),xg("formControl",e.occurrenceCountControl),QI(),sI(),cC(e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?6:-1);}}function ke(n,t){n&1&&(Cs(0,"span",12),JC(1,"Invalid JSON."),hl());}function Ne(n,t){if(n&1&&(Cs(0,"p",38),JC(1),hl()),n&2){let e=CC(2);sI(),em(e.errorMessage());}}function Fe(n,t){if(n&1){let e=vC();Cs(0,"form",7),Lg("ngSubmit",function(){Sf(e);let g=CC();return _f(g.submit())}),Cs(1,"div",8)(2,"label",9),JC(3," Name "),Cs(4,"span",10),JC(5,"*"),hl()(),Ag(6,"input",11),ZI(),aC(7,ue,2,0,"span",12),Cs(8,"span",13),JC(9,'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.'),hl()(),Cs(10,"div",8)(11,"label",14),JC(12,"Description"),hl(),Ag(13,"input",15),ZI(),hl(),Cs(14,"div",8)(15,"label",16),JC(16," Agent Config "),Cs(17,"span",10),JC(18,"*"),hl()(),aC(19,fe,4,1)(20,he,3,1,"p",13)(21,ve,8,2),hl(),Cs(22,"div",8)(23,"label",17),JC(24," Opening message "),Cs(25,"span",10),JC(26,"*"),hl()(),Ag(27,"textarea",18),ZI(),aC(28,xe,2,0,"span",12),Cs(29,"span",13),JC(30," The message sent to the agent when the scheduled prompt fires. "),hl()(),Cs(31,"fieldset",19)(32,"legend",20),JC(33,"Recurrence"),hl(),Cs(34,"div",8)(35,"label",21),JC(36," Unit "),Cs(37,"span",10),JC(38,"*"),hl()(),Cs(39,"select",22),dC(40,ye,2,2,"option",23,A),hl(),ZI(),hl(),aC(42,Se,8,0,"div",8),Cs(43,"div",8)(44,"label",24),JC(45," Time (UTC) "),Cs(46,"span",10),JC(47,"*"),hl()(),Cs(48,"div",25),Ag(49,"input",26),ZI(),Cs(50,"span",27),JC(51,"UTC"),hl()(),aC(52,Ee,2,0,"span",12),hl()(),Cs(53,"fieldset",19)(54,"legend",20),JC(55,"Planning"),hl(),Cs(56,"div",8)(57,"label",28),JC(58," Start date "),Cs(59,"span",10),JC(60,"*"),hl()(),Ag(61,"input",29),ZI(),aC(62,Pe,2,0,"span",12),hl(),Cs(63,"div",8)(64,"label",30),JC(65," Ends "),Cs(66,"span",10),JC(67,"*"),hl()(),Cs(68,"select",31),dC(69,Me,2,2,"option",23,A),hl(),ZI(),hl(),aC(71,De,7,4,"div",8),aC(72,we,7,4,"div",8),hl(),Cs(73,"div",8)(74,"label",32),Ag(75,"input",33),ZI(),Cs(76,"span",34),JC(77,"Enabled"),hl()(),Cs(78,"p",35),JC(79," When disabled, the scheduled prompt is saved but will not run on schedule. "),hl()(),Cs(80,"div",8)(81,"label",36),JC(82,"External Metadata"),hl(),Ag(83,"textarea",37),ZI(),aC(84,ke,2,0,"span",12),Cs(85,"span",13),JC(86,"Optional. Opaque JSON object stored as-is. Leave empty to clear."),hl()(),aC(87,Ne,2,1,"p",38),Cs(88,"div",39)(89,"button",40),JC(90),hl(),Cs(91,"button",41),Lg("click",function(){Sf(e);let g=CC();return _f(g.cancel())}),JC(92,"Cancel"),hl()()();}if(n&2){let e=CC();xg("formGroup",e.form),sI(6),qg("scheduled-prompt-form__input--invalid",e.nameControl.invalid&&e.nameControl.touched),xg("formControl",e.nameControl),QI(),sI(),cC(e.nameControl.invalid&&e.nameControl.touched?7:-1),sI(6),xg("formControl",e.descriptionControl),QI(),sI(6),cC(e.isEditMode()?19:e.availableAgentConfigs().length===0?20:21),sI(8),qg("scheduled-prompt-form__textarea--invalid",e.promptContentControl.invalid&&e.promptContentControl.touched),xg("formControl",e.promptContentControl),QI(),sI(),cC(e.promptContentControl.invalid&&e.promptContentControl.touched?28:-1),sI(11),xg("formControl",e.unitControl),QI(),sI(),fC(e.schedulerUnits),sI(2),cC(e.showDayFilter()?42:-1),sI(7),xg("formControl",e.timeUtcControl),QI(),sI(3),cC(e.timeUtcControl.invalid&&e.timeUtcControl.touched?52:-1),sI(9),qg("scheduled-prompt-form__input--invalid",e.startDateControl.invalid&&e.startDateControl.touched),xg("formControl",e.startDateControl),QI(),sI(),cC(e.startDateControl.invalid&&e.startDateControl.touched?62:-1),sI(6),xg("formControl",e.endTypeControl),QI(),sI(),fC(e.endTypes),sI(2),cC(e.showEndDate()?71:-1),sI(),cC(e.showOccurrenceCount()?72:-1),sI(3),xg("formControl",e.enabledControl),QI(),sI(8),xg("formControl",e.externalMetadataJsonControl),QI(),sI(),cC(e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?84:-1),sI(3),cC(e.errorMessage()?87:-1),sI(2),xg("disabled",e.form.invalid||e.isSubmitting()),sI(),Dl(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var se=class n{route=g(V);router=g(G);destroyRef=g(Ce$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(ve$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(Pe$1.NEVER,{nonNullable:true,validators:[_e$1.required]}),endDate:new _t(null),occurrenceCount:new _t(null),enabled:new _t(true,{nonNullable:true}),externalMetadataJson:new _t("",{nonNullable:true,validators:[Ae]})},{validators:[Ie,Ve]});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}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}isEditMode=Wi(false);isSubmitting=Wi(false);isLoading=Wi(false);errorMessage=Wi(null);SchedulerUnit=ve$1;SchedulerEndType=Pe$1;schedulerUnits=[{value:ve$1.WEEK,label:"Week(s)"},{value:ve$1.MONTH,label:"Month(s)"}];endTypes=[{value:Pe$1.NEVER,label:"Never"},{value:Pe$1.ON_DATE,label:"On date"},{value:Pe$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(je).map(([t,e])=>({value:t,label:e}));unitSignal=F(this.unitControl.valueChanges.pipe(Sd(this.unitControl.value)));endTypeSignal=F(this.endTypeControl.valueChanges.pipe(Sd(this.endTypeControl.value)));showDayFilter=TT(()=>this.unitSignal()===ve$1.WEEK);showEndDate=TT(()=>this.endTypeSignal()===Pe$1.ON_DATE);showOccurrenceCount=TT(()=>this.endTypeSignal()===Pe$1.OCCURRENCES);agentConfigs=Wi([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Re());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(true),this.loadPromptAndResources(t)):this.loadResources();}loadPromptAndResources(t){this.isLoading.set(true),Wy({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(U(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:d})=>{this.existingPrompt=e,this.agentConfigs.set(d),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(va(()=>br([])))}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),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,d=e.includes(t)?e.filter(g=>g!==t):[...e,t];this.daysControl.setValue(d);}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,d=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===Pe$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===Pe$1.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value,removed:this.existingPrompt?.removed??false,externalMetadata:(()=>{let v=this.externalMetadataJsonControl.value.trim();return v?JSON.parse(v):null})()});(t?this.state.update(this.existingPrompt.id,d):this.state.create(d)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:v=>{this.isSubmitting.set(false),v.status===409?this.errorMessage.set(`A scheduled prompt named "${d.name}" already exists in this scope.`):v.status===400?this.errorMessage.set(v.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=jw({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"],["for","sp-external-metadata",1,"scheduled-prompt-form__label"],["id","sp-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",1,"scheduled-prompt-form__textarea","scheduled-prompt-form__textarea--code",3,"formControl"],[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,d){e&1&&(Cs(0,"div",0)(1,"header",1)(2,"button",2),Lg("click",function(){return d.cancel()}),Cs(3,"span",3),JC(4,"\u2190"),hl(),JC(5),hl(),Cs(6,"h1",4),JC(7),hl()(),aC(8,pe,2,0,"p",5)(9,Fe,93,28,"form",6),hl()),e&2&&(sI(5),Dl(" ",d.isPlatformMode?"Platform Scheduled Prompts":"Scheduled Prompts"," "),sI(2),Dl(" ",d.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"," "),sI(),cC(d.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 Ie(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===Pe$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ve(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===Pe$1.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function Ae(n){let t=n.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}function Re(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),d=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${d}`}export{se as ScheduledPromptFormComponent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {an as ue,g,L,ci as me,ap as
|
|
1
|
+
import {an as ue,g,L,ci as me,ap as _d,av as dt$1,j as jw,k as Cs,J as JC,m as hl,ai as sm,aj as iT,n as Lg,a3 as ZI,A as Ag,o as aC,q as dC,u as sI,ak as im,a6 as QI,x as xg,v as cC,w as fC,a5 as Dl,aL as wo,aM as Zn$1,aO as wt$1,az as Xt,aW as C,cj as Pn,ce as kb,c8 as ob,af as bg,ag as ET,c9 as Bf,ck as Vf,ch as kg,t as AC,N as Ng,ad as Wg,b$ as UC,y as qg,H as Hg,M as MC,B as NC,aJ as Tr,aG as fe,cl as be,p as pe,l as le,bU as jd,b9 as T,b8 as B,be as A,b7 as u,bd as h,cm as M,d as O,ba as v,bb as m,c as b,cn as F,f,V,bc as R,co as H,cp as K,ca as _e,Y as x,Z as z$1,_ as Ue,am as Xm,i as Gn,e as pr,a0 as jt,a2 as Nt,a1 as Vt,b0 as tm,ac as CC}from'./main-JTU33H5D.js';import {s as se}from'./chunk-I8YepFsn.js';import {t as ti,Q as Qn,e as ei,Y as Ye$1,h as _n,A as At,m as mn,Z as Zn,c as cn,w as wt}from'./chunk-DuXr-yGB.js';var Xe=["determinateSpinner"];function et(c,e){if(c&1&&(Bf(),Cs(0,"svg",11),Ag(1,"circle",12),hl()),c&2){let t=CC();Ng("viewBox",t._viewBox()),sI(),Wg("stroke-dasharray",t._strokeCircumference(),"px")("stroke-dashoffset",t._strokeCircumference()/2,"px")("stroke-width",t._circleStrokeWidth(),"%"),Ng("r",t._circleRadius());}}var tt=new C("mat-progress-spinner-default-options",{providedIn:"root",factory:()=>({diameter:qe})}),qe=100,nt=10,yt=(()=>{class c{_elementRef=g(Xt);_noopAnimations;get color(){return this._color||this._defaultColor}set color(t){this._color=t;}_color;_defaultColor="primary";_determinateCircle;constructor(){let t=g(tt),n=Pn(),i=this._elementRef.nativeElement;this._noopAnimations=n==="di-disabled"&&!!t&&!t._forceAnimations,this.mode=i.nodeName.toLowerCase()==="mat-spinner"?"indeterminate":"determinate",!this._noopAnimations&&n==="reduced-motion"&&i.classList.add("mat-progress-spinner-reduced-motion"),t&&(t.color&&(this.color=this._defaultColor=t.color),t.diameter&&(this.diameter=t.diameter),t.strokeWidth&&(this.strokeWidth=t.strokeWidth));}mode;get value(){return this.mode==="determinate"?this._value:0}set value(t){this._value=Math.max(0,Math.min(100,t||0));}_value=0;get diameter(){return this._diameter}set diameter(t){this._diameter=t||0;}_diameter=qe;get strokeWidth(){return this._strokeWidth??this.diameter/10}set strokeWidth(t){this._strokeWidth=t||0;}_strokeWidth;_circleRadius(){return (this.diameter-nt)/2}_viewBox(){let t=this._circleRadius()*2+this.strokeWidth;return `0 0 ${t} ${t}`}_strokeCircumference(){return 2*Math.PI*this._circleRadius()}_strokeDashOffset(){return this.mode==="determinate"?this._strokeCircumference()*(100-this._value)/100:null}_circleStrokeWidth(){return this.strokeWidth/this.diameter*100}static \u0275fac=function(n){return new(n||c)};static \u0275cmp=jw({type:c,selectors:[["mat-progress-spinner"],["mat-spinner"]],viewQuery:function(n,i){if(n&1&&Hg(Xe,5),n&2){let o;MC(o=NC())&&(i._determinateCircle=o.first);}},hostAttrs:["role","progressbar","tabindex","-1",1,"mat-mdc-progress-spinner","mdc-circular-progress"],hostVars:18,hostBindings:function(n,i){n&2&&(Ng("aria-valuemin",0)("aria-valuemax",100)("aria-valuenow",i.mode==="determinate"?i.value:null)("mode",i.mode),UC("mat-"+i.color),Wg("width",i.diameter,"px")("height",i.diameter,"px")("--mat-progress-spinner-size",i.diameter+"px")("--mat-progress-spinner-active-indicator-width",i.diameter+"px"),qg("_mat-animation-noopable",i._noopAnimations)("mdc-circular-progress--indeterminate",i.mode==="indeterminate"));},inputs:{color:"color",mode:"mode",value:[2,"value","value",ob],diameter:[2,"diameter","diameter",ob],strokeWidth:[2,"strokeWidth","strokeWidth",ob]},exportAs:["matProgressSpinner"],decls:14,vars:11,consts:[["circle",""],["determinateSpinner",""],["aria-hidden","true",1,"mdc-circular-progress__determinate-container"],["xmlns","http://www.w3.org/2000/svg","focusable","false",1,"mdc-circular-progress__determinate-circle-graphic"],["cx","50%","cy","50%",1,"mdc-circular-progress__determinate-circle"],["aria-hidden","true",1,"mdc-circular-progress__indeterminate-container"],[1,"mdc-circular-progress__spinner-layer"],[1,"mdc-circular-progress__circle-clipper","mdc-circular-progress__circle-left"],[3,"ngTemplateOutlet"],[1,"mdc-circular-progress__gap-patch"],[1,"mdc-circular-progress__circle-clipper","mdc-circular-progress__circle-right"],["xmlns","http://www.w3.org/2000/svg","focusable","false",1,"mdc-circular-progress__indeterminate-circle-graphic"],["cx","50%","cy","50%"]],template:function(n,i){if(n&1&&(bg(0,et,2,8,"ng-template",null,0,ET),Cs(2,"div",2,1),Bf(),Cs(4,"svg",3),Ag(5,"circle",4),hl()(),Vf(),Cs(6,"div",5)(7,"div",6)(8,"div",7),kg(9,8),hl(),Cs(10,"div",9),kg(11,8),hl(),Cs(12,"div",10),kg(13,8),hl()()()),n&2){let o=AC(1);sI(4),Ng("viewBox",i._viewBox()),sI(),Wg("stroke-dasharray",i._strokeCircumference(),"px")("stroke-dashoffset",i._strokeDashOffset(),"px")("stroke-width",i._circleStrokeWidth(),"%"),Ng("r",i._circleRadius()),sI(4),xg("ngTemplateOutlet",o),sI(2),xg("ngTemplateOutlet",o),sI(2),xg("ngTemplateOutlet",o);}},dependencies:[kb],styles:[`.mat-mdc-progress-spinner {
|
|
2
2
|
--mat-progress-spinner-animation-multiplier: 1;
|
|
3
3
|
display: block;
|
|
4
4
|
overflow: hidden;
|
|
@@ -173,10 +173,10 @@ import {an as ue,g,L,ci as me,ap as zy,av as dt$1,j as jw,k as Cs,J as JC,m as h
|
|
|
173
173
|
transform: rotate(-265deg);
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
|
-
`],encapsulation:2})}return c})();var Et=(()=>{class c{static \u0275fac=function(n){return new(n||c)};static \u0275mod=wo({type:c});static \u0275inj=Zn$1({imports:[wt$1]})}return c})();var z=class c{destroy$=new ue;voices;currentUtterance=null;currentOnEndCallback=null;speakingSubject=new Tr(false);speaking$=this.speakingSubject.asObservable();volume=.8;rate=1.2;language="en-US";selectedVoice;preferencesService=g(L);constructor(){this.initializeSpeechSynthesis(),this.subscribeToPreferences();}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),this.stopSpeech();}initializeSpeechSynthesis(){if(!("speechSynthesis"in window)){console.warn("[VOICE-SERVICE] Speech synthesis not available"),this.voices=new Promise(e=>e([]));return}this.voices=new Promise((e,t)=>{let n=speechSynthesis.getVoices();if(n.length)e(n);else {let i=setTimeout(()=>{t("no voices found");},2e3);speechSynthesis.addEventListener("voiceschanged",()=>{let o=speechSynthesis.getVoices();o.length&&(clearTimeout(i),e(o));});}}),console.log("[VOICE-SERVICE] Speech synthesis initialized");}subscribeToPreferences(){this.preferencesService.voiceVolume$.pipe(
|
|
176
|
+
`],encapsulation:2})}return c})();var Et=(()=>{class c{static \u0275fac=function(n){return new(n||c)};static \u0275mod=wo({type:c});static \u0275inj=Zn$1({imports:[wt$1]})}return c})();var z=class c{destroy$=new ue;voices;currentUtterance=null;currentOnEndCallback=null;speakingSubject=new Tr(false);speaking$=this.speakingSubject.asObservable();volume=.8;rate=1.2;language="en-US";selectedVoice;preferencesService=g(L);constructor(){this.initializeSpeechSynthesis(),this.subscribeToPreferences();}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),this.stopSpeech();}initializeSpeechSynthesis(){if(!("speechSynthesis"in window)){console.warn("[VOICE-SERVICE] Speech synthesis not available"),this.voices=new Promise(e=>e([]));return}this.voices=new Promise((e,t)=>{let n=speechSynthesis.getVoices();if(n.length)e(n);else {let i=setTimeout(()=>{t("no voices found");},2e3);speechSynthesis.addEventListener("voiceschanged",()=>{let o=speechSynthesis.getVoices();o.length&&(clearTimeout(i),e(o));});}}),console.log("[VOICE-SERVICE] Speech synthesis initialized");}subscribeToPreferences(){this.preferencesService.voiceVolume$.pipe(_d(this.destroy$)).subscribe(e=>{this.volume=e,console.log("[VOICE-SERVICE] Volume updated to:",e);}),this.preferencesService.voiceRate$.pipe(_d(this.destroy$)).subscribe(e=>{this.rate=e,console.log("[VOICE-SERVICE] Rate updated to:",e);}),this.preferencesService.voiceLanguage$.pipe(_d(this.destroy$)).subscribe(e=>{this.language=e,console.log("[VOICE-SERVICE] Language updated to:",e),this.updateSelectedVoiceForLanguage();}),this.preferencesService.selectedVoice$.pipe(_d(this.destroy$)).subscribe(e=>{this.setSelectedVoice(e);}),this.volume=this.preferencesService.getVoiceVolume(),this.rate=this.preferencesService.getVoiceRate(),this.language=this.preferencesService.getVoiceLanguage(),this.setSelectedVoice(this.preferencesService.getSelectedVoice());}isReady(){return "speechSynthesis"in window&&this.selectedVoice!==void 0}isSpeaking(){return speechSynthesis.speaking}speak(e,t){return dt$1(this,null,function*(){if(!this.selectedVoice)return console.warn("[VOICE-SERVICE] No voice selected"),false;if(!e.trim())return console.warn("[VOICE-SERVICE] No text to speak"),false;let n=this.extractPlainText(e);if(!n.trim())return console.warn("[VOICE-SERVICE] No text to speak after markdown cleaning"),false;this.stopSpeech();try{let i=new SpeechSynthesisUtterance(n);i.voice=this.selectedVoice,i.lang=this.selectedVoice.lang,i.volume=this.volume,i.rate=this.rate,this.currentOnEndCallback=t||null,t&&(i.onend=()=>{this.currentOnEndCallback===t&&(this.currentOnEndCallback=null,t());},i.onerror=()=>{this.currentOnEndCallback===t&&(this.currentOnEndCallback=null,t());}),this.currentUtterance=i,this.speakingSubject.next(!0);let o=i.onend,E=i.onerror;return i.onend=C=>{this.speakingSubject.next(!1),o&&o.call(i,C);},i.onerror=C=>{this.speakingSubject.next(!1),E&&E.call(i,C);},speechSynthesis.speak(i),console.log("[VOICE-SERVICE] Started speaking:",e.substring(0,50)+"..."),!0}catch(i){return console.error("[VOICE-SERVICE] Error speaking:",i),false}})}stopSpeech(){if(this.currentUtterance||speechSynthesis.speaking){if(speechSynthesis.cancel(),this.currentUtterance=null,this.currentOnEndCallback){let e=this.currentOnEndCallback;this.currentOnEndCallback=null,e();}this.speakingSubject.next(false),console.log("[VOICE-SERVICE] Speech stopped");}}ding(){try{let e=new(window.AudioContext||window.webkitAudioContext),t=e.createOscillator(),n=e.createGain();t.connect(n),n.connect(e.destination),t.frequency.setValueAtTime(800,e.currentTime),n.gain.setValueAtTime(.1,e.currentTime),n.gain.exponentialRampToValueAtTime(.01,e.currentTime+.1),t.start(e.currentTime),t.stop(e.currentTime+.1),console.log("[VOICE-SERVICE] Notification sound played");}catch(e){console.error("[VOICE-SERVICE] Notification sound failed:",e);}}getVoicesForLanguage(){return dt$1(this,null,function*(){try{let e=this.language.slice(0,2),t=yield this.voices;if(!t||t.length===0)return console.warn("[VOICE-SERVICE] No voices available on system"),[];let n=t.filter(i=>i.lang.toLowerCase().startsWith(e)).sort((i,o)=>i.localService&&!o.localService?-1:!i.localService&&o.localService?1:i.name.localeCompare(o.name));return console.log("[VOICE-SERVICE] Found matching voices:",n.length,"for language:",e),n.map(i=>({name:i.name,lang:i.lang,localService:i.localService,default:i.default,displayName:this.formatVoiceDisplayName(i)}))}catch(e){return console.error("[VOICE-SERVICE] Error getting voices for language:",e),[]}})}formatVoiceDisplayName(e){let t=e.localService?"\u{1F3E0}":"\u2601\uFE0F",n=e.default?" \u2B50":"";return `${t} ${e.name} (${e.lang})${n}`}setSelectedVoice(e){return dt$1(this,null,function*(){if(!e){this.selectedVoice=void 0;return}let[t,n]=e.split("|");if(!t||!n){this.selectedVoice=void 0;return}let i=(yield this.voices)?.find(o=>o.name===t&&o.lang===n);i?(this.selectedVoice=i,console.log("[VOICE-SERVICE] Selected voice:",i.name,i.lang)):(this.selectedVoice=void 0,console.warn("[VOICE-SERVICE] Voice not found:",t,n));})}updateSelectedVoiceForLanguage(){return dt$1(this,null,function*(){let e=yield this.getVoicesForLanguage();if(e.length===0){console.warn("[VOICE-SERVICE] No voices available for language:",this.language),this.selectedVoice=void 0,this.preferencesService.setSelectedVoice(null);return}let t=this.preferencesService.getSelectedVoice();if(t){let[i,o]=t.split("|"),E=o?.slice(0,2),C=this.language.slice(0,2);if(E===C&&e.some(q=>q.name===i&&q.lang===o)){console.log("[VOICE-SERVICE] Keeping current voice for language:",t);return}}let n=e[0];if(n){let i=`${n.name}|${n.lang}`;this.preferencesService.setSelectedVoice(i),console.log("[VOICE-SERVICE] Auto-selected voice for language change:",n.displayName);}})}testSelectedVoice(){setTimeout(()=>{if(!this.selectedVoice){console.log("[VOICE-SERVICE] No voice selected for test");return}this.stopSpeech();let e=this.getTestText();e&&this.speak(e);},100);}getTestText(){let e=this.language.slice(0,2),t={fr:"Bonjour, ceci est un test de la voix s\xE9lectionn\xE9e.",en:"Hello, this is a test of the selected voice.",es:"Hola, esta es una prueba de la voz seleccionada.",de:"Hallo, dies ist ein Test der ausgew\xE4hlten Stimme.",it:"Ciao, questo \xE8 un test della voce selezionata.",pt:"Ol\xE1, este \xE9 um teste da voz selecionada.",ja:"\u3053\u3093\u306B\u3061\u306F\u3001\u3053\u308C\u306F\u9078\u629E\u3055\u308C\u305F\u97F3\u58F0\u306E\u30C6\u30B9\u30C8\u3067\u3059\u3002",ko:"\uC548\uB155\uD558\uC138\uC694, \uC774\uAC83\uC740 \uC120\uD0DD\uB41C \uC74C\uC131\uC758 \uD14C\uC2A4\uD2B8\uC785\uB2C8\uB2E4.",zh:"\u4F60\u597D\uFF0C\u8FD9\u662F\u6240\u9009\u8BED\u97F3\u7684\u6D4B\u8BD5\u3002",ru:"\u041F\u0440\u0438\u0432\u0435\u0442, \u044D\u0442\u043E \u0442\u0435\u0441\u0442 \u0432\u044B\u0431\u0440\u0430\u043D\u043D\u043E\u0433\u043E \u0433\u043E\u043B\u043E\u0441\u0430.",ar:"\u0645\u0631\u062D\u0628\u0627\u060C \u0647\u0630\u0627 \u0627\u062E\u062A\u0628\u0627\u0631 \u0644\u0644\u0635\u0648\u062A \u0627\u0644\u0645\u062D\u062F\u062F."};return t[e]||t.en}extractPlainText(e){let t=e.replace(/[\u{1F600}-\u{1F64F}]|[\u{1F300}-\u{1F5FF}]|[\u{1F680}-\u{1F6FF}]|[\u{1F1E0}-\u{1F1FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]|⭐/gu,"").replace(/```[\s\S]*?```/g,"code block").replace(/`([^`]+)`/g,"$1").replace(/\*\*\*(.*?)\*\*\*/g,"$1").replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/~~(.*?)~~/g,"$1").replace(/#{1,6}\s*(.*)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/https?:\/\/[^\s]+/g,"link").replace(/ /g," ").replace(/&/g,"and").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"');return t=this.addNaturalPunctuation(t),t.replace(/\s+/g," ").trim()}addNaturalPunctuation(e){return e.replace(/\n+/g,`
|
|
177
177
|
`).split(`
|
|
178
|
-
`).map(t=>this.addPeriodIfNeeded(t.trim())).filter(t=>t.length>0).join(" ")}addPeriodIfNeeded(e){return e?/[.!?;:]$/.test(e)?e:e+".":""}static \u0275fac=function(t){return new(t||c)};static \u0275prov=x({token:c,factory:c.\u0275fac,providedIn:"root"})};var rt=(c,e)=>e.code,at=(c,e)=>e.name+e.lang;function st(c,e){c&1&&(Cs(0,"div",17)(1,"mat-icon",39),JC(2,"warning"),hl(),Cs(3,"span",40),JC(4," Browser notifications have been blocked. To enable them, please reset the site permissions in your browser settings. "),hl()());}function ct(c,e){if(c&1&&(Cs(0,"option",25),JC(1),hl()),c&2){let t=e.$implicit;_g("value",t.code),sI(),Xg("",t.flag," ",t.label);}}function lt(c,e){c&1&&(Cs(0,"option",32),JC(1,"Loading voices..."),hl());}function dt(c,e){c&1&&(Cs(0,"option",32),JC(1,"No voice available"),hl());}function pt(c,e){if(c&1&&(Cs(0,"option",25),JC(1),hl()),c&2){let t=e.$implicit;_g("value",t.name+"|"+t.lang),sI(),Dl(" ",t.displayName," ");}}var Ye=class c{destroy$=new ue;selectedTheme="light";selectedThemeVariant="industry";selectedVoiceLanguage="en-US";useEnterToSend=false;printTechnicalMessages=false;showTechnicalMessages=true;showWarningMessages=true;voiceInputMode="browser";voiceAnnounceEnabled=false;voiceMode="speech";voiceReadFullText=false;voiceVolume=80;voiceRate=120;agentNotificationEnabled=false;notificationSoundEnabled=true;browserNotificationEnabled=false;browserNotificationDenied=false;missionPreviewEnabled=false;availableVoices=[];selectedVoiceId=null;loadingVoices=false;voiceLanguageOptions=[{code:"fr-FR",label:"Fran\xE7ais",flag:"\u{1F1EB}\u{1F1F7}"},{code:"en-US",label:"English (US)",flag:"\u{1F1FA}\u{1F1F8}"},{code:"en-GB",label:"English (UK)",flag:"\u{1F1EC}\u{1F1E7}"},{code:"es-ES",label:"Espa\xF1ol",flag:"\u{1F1EA}\u{1F1F8}"},{code:"de-DE",label:"Deutsch",flag:"\u{1F1E9}\u{1F1EA}"},{code:"it-IT",label:"Italiano",flag:"\u{1F1EE}\u{1F1F9}"},{code:"pt-BR",label:"Portugu\xEAs",flag:"\u{1F1E7}\u{1F1F7}"},{code:"ja-JP",label:"\u65E5\u672C\u8A9E",flag:"\u{1F1EF}\u{1F1F5}"},{code:"ko-KR",label:"\uD55C\uAD6D\uC5B4",flag:"\u{1F1F0}\u{1F1F7}"},{code:"zh-CN",label:"\u4E2D\u6587 (\u7B80\u4F53)",flag:"\u{1F1E8}\u{1F1F3}"},{code:"ru-RU",label:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439",flag:"\u{1F1F7}\u{1F1FA}"},{code:"ar-SA",label:"\u0627\u0644\u0639\u0631\u0628\u064A\u0629",flag:"\u{1F1F8}\u{1F1E6}"}];preferencesService=g(L);voiceSynthesisService=g(z);themeService=g(me);ngOnInit(){let e=this.themeService.getCurrentTheme();this.selectedTheme=e.mode,this.selectedThemeVariant=e.variant,this.selectedVoiceLanguage=this.preferencesService.getVoiceLanguage(),this.useEnterToSend=this.preferencesService.getEnterToSend(),this.printTechnicalMessages=this.preferencesService.getPrintTechnicalMessages(),this.showTechnicalMessages=!this.preferencesService.getHideTechnicalMessages(),this.showWarningMessages=!this.preferencesService.getHideWarningMessages(),this.voiceInputMode=this.preferencesService.getVoiceInputMode(),this.voiceAnnounceEnabled=this.preferencesService.getVoiceAnnounceEnabled(),this.voiceMode=this.preferencesService.getVoiceMode(),this.voiceReadFullText=this.preferencesService.getVoiceReadFullText(),this.voiceVolume=Math.round(this.preferencesService.getVoiceVolume()*100),this.voiceRate=Math.round(this.preferencesService.getVoiceRate()*100),this.selectedVoiceId=this.preferencesService.getSelectedVoice(),this.agentNotificationEnabled=this.preferencesService.getAgentNotificationEnabled(),this.notificationSoundEnabled=this.preferencesService.getNotificationSoundEnabled(),this.browserNotificationEnabled=this.preferencesService.getBrowserNotificationEnabled(),this.missionPreviewEnabled=this.preferencesService.getMissionPreviewEnabled(),this.loadAvailableVoices(),this.themeService.currentTheme$.pipe(zy(this.destroy$)).subscribe(t=>{this.selectedTheme=t.mode,this.selectedThemeVariant=t.variant;}),this.preferencesService.voiceLanguage$.pipe(zy(this.destroy$)).subscribe(t=>{this.selectedVoiceLanguage=t;}),this.preferencesService.enterToSend$.pipe(zy(this.destroy$)).subscribe(t=>{this.useEnterToSend=t;}),this.preferencesService.printTechnicalMessages$.pipe(zy(this.destroy$)).subscribe(t=>{this.printTechnicalMessages=t;}),this.preferencesService.hideTechnicalMessages$.pipe(zy(this.destroy$)).subscribe(t=>{this.showTechnicalMessages=!t;}),this.preferencesService.hideWarningMessages$.pipe(zy(this.destroy$)).subscribe(t=>{this.showWarningMessages=!t;}),this.preferencesService.voiceInputMode$.pipe(zy(this.destroy$)).subscribe(t=>{this.voiceInputMode=t;}),this.preferencesService.voiceAnnounceEnabled$.pipe(zy(this.destroy$)).subscribe(t=>{this.voiceAnnounceEnabled=t;}),this.preferencesService.voiceMode$.pipe(zy(this.destroy$)).subscribe(t=>{this.voiceMode=t;}),this.preferencesService.voiceReadFullText$.pipe(zy(this.destroy$)).subscribe(t=>{this.voiceReadFullText=t;}),this.preferencesService.voiceVolume$.pipe(zy(this.destroy$)).subscribe(t=>{this.voiceVolume=Math.round(t*100);}),this.preferencesService.voiceRate$.pipe(zy(this.destroy$)).subscribe(t=>{this.voiceRate=Math.round(t*100);}),this.preferencesService.selectedVoice$.pipe(zy(this.destroy$)).subscribe(t=>{this.selectedVoiceId=t;}),this.preferencesService.voiceLanguage$.pipe(zy(this.destroy$)).subscribe(()=>{this.loadAvailableVoices();}),this.preferencesService.agentNotificationEnabled$.pipe(zy(this.destroy$)).subscribe(t=>{this.agentNotificationEnabled=t;}),this.preferencesService.notificationSoundEnabled$.pipe(zy(this.destroy$)).subscribe(t=>{this.notificationSoundEnabled=t;}),this.preferencesService.browserNotificationEnabled$.pipe(zy(this.destroy$)).subscribe(t=>{this.browserNotificationEnabled=t,this.checkNotificationPermission();}),this.preferencesService.missionPreviewEnabled$.pipe(zy(this.destroy$)).subscribe(t=>{this.missionPreviewEnabled=t;});}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete();}onThemeChange(){console.log("[OPTIONS] Theme changed to:",this.selectedTheme),this.themeService.setTheme({variant:this.selectedThemeVariant,mode:this.selectedTheme});}onVoiceLanguageChange(){console.log("[OPTIONS] Voice language changed to:",this.selectedVoiceLanguage),this.preferencesService.setVoiceLanguage(this.selectedVoiceLanguage);}onEnterToSendChange(){console.log("[OPTIONS] Enter to send changed to:",this.useEnterToSend),this.preferencesService.setEnterToSend(this.useEnterToSend);}onPrintTechnicalMessagesChange(){console.log("[OPTIONS] Print technical messages changed to:",this.printTechnicalMessages),this.preferencesService.setPrintTechnicalMessages(this.printTechnicalMessages);}onShowTechnicalMessagesChange(){let e=!this.showTechnicalMessages;console.log("[OPTIONS] Show technical messages changed to:",this.showTechnicalMessages,"(hide:",e,")"),this.preferencesService.setHideTechnicalMessages(e);}onShowWarningMessagesChange(){let e=!this.showWarningMessages;console.log("[OPTIONS] Show warning messages changed to:",this.showWarningMessages,"(hide:",e,")"),this.preferencesService.setHideWarningMessages(e);}onVoiceInputModeChange(e){let t=e.target.value;console.log("[OPTIONS] Voice input mode changed to:",t),this.preferencesService.setVoiceInputMode(t);}onVoiceAnnounceEnabledChange(){console.log("[OPTIONS] Voice announce enabled changed to:",this.voiceAnnounceEnabled),this.preferencesService.setVoiceAnnounceEnabled(this.voiceAnnounceEnabled);}onVoiceModeChange(){console.log("[OPTIONS] Voice mode changed to:",this.voiceMode),this.preferencesService.setVoiceMode(this.voiceMode);}onVoiceReadFullTextChange(){console.log("[OPTIONS] Voice read full text changed to:",this.voiceReadFullText),this.preferencesService.setVoiceReadFullText(this.voiceReadFullText);}onVoiceVolumeChange(){let e=this.voiceVolume/100;console.log("[OPTIONS] Voice volume changed to:",e),this.preferencesService.setVoiceVolume(e);}onVoiceRateChange(){let e=this.voiceRate/100;console.log("[OPTIONS] Voice rate changed to:",e),this.preferencesService.setVoiceRate(e);}loadAvailableVoices(){return dt$1(this,null,function*(){this.loadingVoices=true;try{this.availableVoices=yield this.voiceSynthesisService.getVoicesForLanguage(),console.log("[OPTIONS] Loaded",this.availableVoices.length,"voices for current language");}catch(e){console.error("[OPTIONS] Error loading voices:",e),this.availableVoices=[];}finally{this.loadingVoices=false;}})}onSelectedVoiceChange(){console.log("[OPTIONS] Selected voice changed to:",this.selectedVoiceId),this.preferencesService.setSelectedVoice(this.selectedVoiceId);}testVoice(){console.log("[OPTIONS] Testing voice with current settings"),this.voiceSynthesisService.testSelectedVoice();}onAgentNotificationEnabledChange(){console.log("[OPTIONS] Agent notification enabled changed to:",this.agentNotificationEnabled),this.preferencesService.setAgentNotificationEnabled(this.agentNotificationEnabled);}onNotificationSoundEnabledChange(){console.log("[OPTIONS] Notification sound enabled changed to:",this.notificationSoundEnabled),this.preferencesService.setNotificationSoundEnabled(this.notificationSoundEnabled);}onBrowserNotificationEnabledChange(){console.log("[OPTIONS] Browser notification enabled changed to:",this.browserNotificationEnabled),this.preferencesService.setBrowserNotificationEnabled(this.browserNotificationEnabled);}onMissionPreviewEnabledChange(){console.log("[OPTIONS] Mission preview panel enabled changed to:",this.missionPreviewEnabled),this.preferencesService.setMissionPreviewEnabled(this.missionPreviewEnabled);}checkNotificationPermission(){"Notification"in window&&(this.browserNotificationDenied=Notification.permission==="denied",console.log("[OPTIONS] Notification permission status:",Notification.permission));}static \u0275fac=function(t){return new(t||c)};static \u0275cmp=jw({type:c,selectors:[["app-options-panel"]],decls:168,vars:37,consts:[[1,"options-content"],[1,"option-section"],[1,"section-title"],[1,"option-group"],[1,"radio-group"],[1,"option-radio"],["type","radio","name","theme","value","light",3,"ngModelChange","change","ngModel"],[1,"radio-mark"],["type","radio","name","theme","value","dark",3,"ngModelChange","change","ngModel"],["type","radio","name","theme","value","system",3,"ngModelChange","change","ngModel"],[1,"option-label"],["type","radio","name","enterBehavior",3,"ngModelChange","change","value","ngModel"],[1,"toggle-option"],["color","primary",3,"ngModelChange","change","ngModel"],[1,"option-label-with-hint"],[1,"option-hint"],["color","primary",3,"ngModelChange","change","ngModel","disabled"],[1,"notification-error"],["for","voice-input-mode-select",1,"option-label"],["id","voice-input-mode-select",1,"option-select",3,"change","value"],["value","browser"],["value","whisper"],["value","voice-message"],["for","voice-language-select",1,"option-label"],["id","voice-language-select",1,"option-select",3,"ngModelChange","change","ngModel"],[3,"value"],["type","radio","name","voiceAnnounce",3,"ngModelChange","change","value","ngModel"],["type","radio","name","voiceMode","value","speech",3,"ngModelChange","change","ngModel"],["type","radio","name","voiceMode","value","notification",3,"ngModelChange","change","ngModel"],["type","radio","name","voiceReadFull",3,"ngModelChange","change","value","ngModel"],["for","voice-select",1,"option-label"],["id","voice-select",1,"option-select",3,"ngModelChange","change","ngModel","disabled"],["value",""],["role","button","tabindex","0","title","Test voice with current settings",1,"test-voice-link",3,"click"],[1,"thread-name"],["for","voice-volume-slider",1,"option-label"],["id","voice-volume-slider","type","range","min","0","max","100","step","5",1,"option-slider",3,"ngModelChange","input","ngModel"],["for","voice-rate-slider",1,"option-label"],["id","voice-rate-slider","type","range","min","50","max","200","step","10",1,"option-slider",3,"ngModelChange","input","ngModel"],[1,"error-icon"],[1,"error-message"]],template:function(t,n){t&1&&(Cs(0,"div",0)(1,"div",1)(2,"div",2)(3,"mat-icon"),JC(4,"palette"),hl(),Cs(5,"span"),JC(6,"Appearance"),hl()(),Cs(7,"div",3)(8,"div",4)(9,"label",5)(10,"input",6),rm("ngModelChange",function(o){return iT(n.selectedTheme,o)||(n.selectedTheme=o),o}),kg("change",function(){return n.onThemeChange()}),hl(),ZI(),Mg(11,"span",7),JC(12," Light "),hl(),Cs(13,"label",5)(14,"input",8),rm("ngModelChange",function(o){return iT(n.selectedTheme,o)||(n.selectedTheme=o),o}),kg("change",function(){return n.onThemeChange()}),hl(),ZI(),Mg(15,"span",7),JC(16," Dark "),hl(),Cs(17,"label",5)(18,"input",9),rm("ngModelChange",function(o){return iT(n.selectedTheme,o)||(n.selectedTheme=o),o}),kg("change",function(){return n.onThemeChange()}),hl(),ZI(),Mg(19,"span",7),JC(20," System "),hl()()()(),Cs(21,"div",1)(22,"div",2)(23,"mat-icon"),JC(24,"chat_bubble_outline"),hl(),Cs(25,"span"),JC(26,"Messaging"),hl()(),Cs(27,"div",3)(28,"span",10),JC(29,"Send message behavior:"),hl(),Cs(30,"div",4)(31,"label",5)(32,"input",11),rm("ngModelChange",function(o){return iT(n.useEnterToSend,o)||(n.useEnterToSend=o),o}),kg("change",function(){return n.onEnterToSendChange()}),hl(),ZI(),Mg(33,"span",7),JC(34," Enter to send "),hl(),Cs(35,"label",5)(36,"input",11),rm("ngModelChange",function(o){return iT(n.useEnterToSend,o)||(n.useEnterToSend=o),o}),kg("change",function(){return n.onEnterToSendChange()}),hl(),ZI(),Mg(37,"span",7),JC(38," Enter for new line "),hl()()(),Cs(39,"div",3)(40,"div",12)(41,"span",10),JC(42,"Show technical messages"),hl(),Cs(43,"mat-slide-toggle",13),rm("ngModelChange",function(o){return iT(n.showTechnicalMessages,o)||(n.showTechnicalMessages=o),o}),kg("change",function(){return n.onShowTechnicalMessagesChange()}),hl(),ZI(),hl()(),Cs(44,"div",3)(45,"div",12)(46,"span",10),JC(47,"Show warning messages"),hl(),Cs(48,"mat-slide-toggle",13),rm("ngModelChange",function(o){return iT(n.showWarningMessages,o)||(n.showWarningMessages=o),o}),kg("change",function(){return n.onShowWarningMessagesChange()}),hl(),ZI(),hl()(),Cs(49,"div",3)(50,"div",12)(51,"span",10),JC(52,"Include technical messages in print"),hl(),Cs(53,"mat-slide-toggle",13),rm("ngModelChange",function(o){return iT(n.printTechnicalMessages,o)||(n.printTechnicalMessages=o),o}),kg("change",function(){return n.onPrintTechnicalMessagesChange()}),hl(),ZI(),hl()()(),Cs(54,"div",1)(55,"div",2)(56,"mat-icon"),JC(57,"rocket_launch"),hl(),Cs(58,"span"),JC(59,"Mission Control"),hl()(),Cs(60,"div",3)(61,"div",12)(62,"div",14)(63,"span",10),JC(64,"Side-by-side thread preview"),hl(),Cs(65,"span",15),JC(66,"Click a mission card to open a preview panel. Recommended for large screens."),hl()(),Cs(67,"mat-slide-toggle",13),rm("ngModelChange",function(o){return iT(n.missionPreviewEnabled,o)||(n.missionPreviewEnabled=o),o}),kg("change",function(){return n.onMissionPreviewEnabledChange()}),hl(),ZI(),hl()()(),Cs(68,"div",1)(69,"div",2)(70,"mat-icon"),JC(71,"notifications"),hl(),Cs(72,"span"),JC(73,"Notifications"),hl()(),Cs(74,"div",3)(75,"div",12)(76,"span",10),JC(77,"Notify when the agent answers or requests input"),hl(),Cs(78,"mat-slide-toggle",13),rm("ngModelChange",function(o){return iT(n.agentNotificationEnabled,o)||(n.agentNotificationEnabled=o),o}),kg("change",function(){return n.onAgentNotificationEnabledChange()}),hl(),ZI(),hl()(),Cs(79,"div",3)(80,"div",12)(81,"span",10),JC(82,"Notification sound"),hl(),Cs(83,"mat-slide-toggle",16),rm("ngModelChange",function(o){return iT(n.notificationSoundEnabled,o)||(n.notificationSoundEnabled=o),o}),kg("change",function(){return n.onNotificationSoundEnabledChange()}),hl(),ZI(),hl()(),Cs(84,"div",3)(85,"div",12)(86,"span",10),JC(87,"Browser notification"),hl(),Cs(88,"mat-slide-toggle",16),rm("ngModelChange",function(o){return iT(n.browserNotificationEnabled,o)||(n.browserNotificationEnabled=o),o}),kg("change",function(){return n.onBrowserNotificationEnabledChange()}),hl(),ZI(),hl(),aC(89,st,5,0,"div",17),hl()(),Cs(90,"div",1)(91,"div",2)(92,"mat-icon"),JC(93,"record_voice_over"),hl(),Cs(94,"span"),JC(95,"Voice & Speech"),hl()(),Cs(96,"div",3)(97,"label",18),JC(98,"Voice input method:"),hl(),Cs(99,"select",19),kg("change",function(o){return n.onVoiceInputModeChange(o)}),Cs(100,"option",20),JC(101,"Browser (real-time)"),hl(),Cs(102,"option",21),JC(103,"Whisper (higher accuracy)"),hl(),Cs(104,"option",22),JC(105,"Voice message (send audio)"),hl()()(),Cs(106,"div",3)(107,"label",23),JC(108,"Voice recognition language:"),hl(),Cs(109,"select",24),rm("ngModelChange",function(o){return iT(n.selectedVoiceLanguage,o)||(n.selectedVoiceLanguage=o),o}),kg("change",function(){return n.onVoiceLanguageChange()}),dC(110,ct,2,3,"option",25,rt),hl(),ZI(),hl(),Cs(112,"div",3)(113,"span",10),JC(114,"Automatic announcement:"),hl(),Cs(115,"div",4)(116,"label",5)(117,"input",26),rm("ngModelChange",function(o){return iT(n.voiceAnnounceEnabled,o)||(n.voiceAnnounceEnabled=o),o}),kg("change",function(){return n.onVoiceAnnounceEnabledChange()}),hl(),ZI(),Mg(118,"span",7),JC(119," Enabled "),hl(),Cs(120,"label",5)(121,"input",26),rm("ngModelChange",function(o){return iT(n.voiceAnnounceEnabled,o)||(n.voiceAnnounceEnabled=o),o}),kg("change",function(){return n.onVoiceAnnounceEnabledChange()}),hl(),ZI(),Mg(122,"span",7),JC(123," Disabled "),hl()()(),Cs(124,"div",3)(125,"span",10),JC(126,"Voice mode:"),hl(),Cs(127,"div",4)(128,"label",5)(129,"input",27),rm("ngModelChange",function(o){return iT(n.voiceMode,o)||(n.voiceMode=o),o}),kg("change",function(){return n.onVoiceModeChange()}),hl(),ZI(),Mg(130,"span",7),JC(131," Voice synthesis "),hl(),Cs(132,"label",5)(133,"input",28),rm("ngModelChange",function(o){return iT(n.voiceMode,o)||(n.voiceMode=o),o}),kg("change",function(){return n.onVoiceModeChange()}),hl(),ZI(),Mg(134,"span",7),JC(135," Sound notification "),hl()()(),Cs(136,"div",3)(137,"span",10),JC(138,"Message reading:"),hl(),Cs(139,"div",4)(140,"label",5)(141,"input",29),rm("ngModelChange",function(o){return iT(n.voiceReadFullText,o)||(n.voiceReadFullText=o),o}),kg("change",function(){return n.onVoiceReadFullTextChange()}),hl(),ZI(),Mg(142,"span",7),JC(143," Full message "),hl(),Cs(144,"label",5)(145,"input",29),rm("ngModelChange",function(o){return iT(n.voiceReadFullText,o)||(n.voiceReadFullText=o),o}),kg("change",function(){return n.onVoiceReadFullTextChange()}),hl(),ZI(),Mg(146,"span",7),JC(147," First paragraphs only "),hl()()(),Cs(148,"div",3)(149,"label",30),JC(150,"Selected voice:"),hl(),Cs(151,"select",31),rm("ngModelChange",function(o){return iT(n.selectedVoiceId,o)||(n.selectedVoiceId=o),o}),kg("change",function(){return n.onSelectedVoiceChange()}),aC(152,lt,2,0,"option",32),aC(153,dt,2,0,"option",32),dC(154,pt,2,2,"option",25,at),hl(),ZI(),Mg(156,"div",10),Cs(157,"a",33),kg("click",function(){return n.testVoice()}),Cs(158,"span",34),JC(159,"Test voice"),hl()()(),Cs(160,"div",3)(161,"label",35),JC(162),hl(),Cs(163,"input",36),rm("ngModelChange",function(o){return iT(n.voiceVolume,o)||(n.voiceVolume=o),o}),kg("input",function(){return n.onVoiceVolumeChange()}),hl(),ZI(),hl(),Cs(164,"div",3)(165,"label",37),JC(166),hl(),Cs(167,"input",38),rm("ngModelChange",function(o){return iT(n.voiceRate,o)||(n.voiceRate=o),o}),kg("input",function(){return n.onVoiceRateChange()}),hl(),ZI(),hl()()()),t&2&&(sI(10),nm("ngModel",n.selectedTheme),QI(),sI(4),nm("ngModel",n.selectedTheme),QI(),sI(4),nm("ngModel",n.selectedTheme),QI(),sI(14),_g("value",true),nm("ngModel",n.useEnterToSend),QI(),sI(4),_g("value",false),nm("ngModel",n.useEnterToSend),QI(),sI(7),nm("ngModel",n.showTechnicalMessages),QI(),sI(5),nm("ngModel",n.showWarningMessages),QI(),sI(5),nm("ngModel",n.printTechnicalMessages),QI(),sI(14),nm("ngModel",n.missionPreviewEnabled),QI(),sI(11),nm("ngModel",n.agentNotificationEnabled),QI(),sI(5),nm("ngModel",n.notificationSoundEnabled),_g("disabled",!n.agentNotificationEnabled),QI(),sI(5),nm("ngModel",n.browserNotificationEnabled),_g("disabled",!n.agentNotificationEnabled||n.browserNotificationDenied),QI(),sI(),cC(n.browserNotificationDenied?89:-1),sI(10),_g("value",n.voiceInputMode),sI(10),nm("ngModel",n.selectedVoiceLanguage),QI(),sI(),fC(n.voiceLanguageOptions),sI(7),_g("value",true),nm("ngModel",n.voiceAnnounceEnabled),QI(),sI(4),_g("value",false),nm("ngModel",n.voiceAnnounceEnabled),QI(),sI(8),nm("ngModel",n.voiceMode),QI(),sI(4),nm("ngModel",n.voiceMode),QI(),sI(8),_g("value",true),nm("ngModel",n.voiceReadFullText),QI(),sI(4),_g("value",false),nm("ngModel",n.voiceReadFullText),QI(),sI(6),nm("ngModel",n.selectedVoiceId),_g("disabled",n.loadingVoices||n.availableVoices.length===0),QI(),sI(),cC(n.loadingVoices?152:-1),sI(),cC(!n.loadingVoices&&n.availableVoices.length===0?153:-1),sI(),fC(n.availableVoices),sI(8),Dl("Volume: ",n.voiceVolume,"%"),sI(),nm("ngModel",n.voiceVolume),QI(),sI(3),Dl("Speed: ",n.voiceRate,"%"),sI(),nm("ngModel",n.voiceRate),QI());},dependencies:[ti,Qn,ei,Ye$1,_n,At,mn,Zn,cn,wt,se],styles:['.options-content[_ngcontent-%COMP%]{padding:0;width:100%}.option-group[_ngcontent-%COMP%]{padding:0 1rem 1rem;margin-bottom:1rem;border-bottom:1px solid var(--color-border-light)}.option-group[_ngcontent-%COMP%]:last-child{margin-bottom:0;padding-bottom:0;border-bottom:none}.option-label[_ngcontent-%COMP%]{display:block;margin-bottom:.5rem;font-weight:500;color:var(--color-text);font-size:.875rem}.toggle-option[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;gap:1rem}.toggle-option[_ngcontent-%COMP%] .option-label[_ngcontent-%COMP%]{margin-bottom:0;flex:1}.toggle-option[_ngcontent-%COMP%] mat-slide-toggle[_ngcontent-%COMP%]{flex-shrink:0}.option-label-with-hint[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.25rem;flex:1}.option-label-with-hint[_ngcontent-%COMP%] .option-label[_ngcontent-%COMP%]{margin-bottom:0}.option-label-with-hint[_ngcontent-%COMP%] .option-hint[_ngcontent-%COMP%]{font-size:.775rem;color:var(--color-text-secondary);line-height:1.4}.option-select[_ngcontent-%COMP%]{width:100%;padding:.5rem;border:1px solid var(--color-border);border-radius:4px;background:var(--color-input-bg);color:var(--color-text);font-size:.875rem;cursor:pointer}.option-select[_ngcontent-%COMP%]:focus{outline:none;border-color:var(--color-primary);box-shadow:0 0 0 3px #7064fb1a}.option-select[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.option-select[_ngcontent-%COMP%] option[_ngcontent-%COMP%]{padding:.5rem}.option-checkbox[_ngcontent-%COMP%]{display:flex;align-items:center;cursor:pointer;font-size:.875rem;color:var(--color-text);-webkit-user-select:none;user-select:none}.option-checkbox[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{display:none}.option-checkbox[_ngcontent-%COMP%] .checkmark[_ngcontent-%COMP%]{width:18px;height:18px;border:2px solid var(--color-border);border-radius:3px;margin-right:.75rem;display:flex;align-items:center;justify-content:center;transition:all .2s ease;flex-shrink:0}.option-checkbox[_ngcontent-%COMP%] .checkmark[_ngcontent-%COMP%]:after{content:"";width:10px;height:6px;border-left:2px solid transparent;border-bottom:2px solid transparent;transform:rotate(-45deg);transition:all .2s ease;opacity:0}.option-checkbox[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]:checked + .checkmark[_ngcontent-%COMP%]{background-color:var(--color-primary);border-color:var(--color-primary)}.option-checkbox[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]:checked + .checkmark[_ngcontent-%COMP%]:after{border-left-color:#fff;border-bottom-color:#fff;opacity:1}.option-checkbox[_ngcontent-%COMP%]:hover .checkmark[_ngcontent-%COMP%]{border-color:var(--color-primary)}.option-checkbox[_ngcontent-%COMP%]:focus-within .checkmark[_ngcontent-%COMP%]{box-shadow:0 0 0 3px #7064fb1a}.option-section[_ngcontent-%COMP%]{padding-top:1rem;margin-top:1rem;border-top:2px solid var(--color-border)}.option-section[_ngcontent-%COMP%]:first-child{border-top:none;padding-top:0;margin-top:0}.section-title[_ngcontent-%COMP%]{margin:0 0 1rem;padding:0 1rem;font-size:.9rem;font-weight:600;color:var(--color-text);display:flex;align-items:center;gap:.5rem}.section-title[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px}.radio-group[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.option-radio[_ngcontent-%COMP%]{display:flex;align-items:center;cursor:pointer;font-size:.875rem;color:var(--color-text);-webkit-user-select:none;user-select:none}.option-radio[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{display:none}.option-radio[_ngcontent-%COMP%] .radio-mark[_ngcontent-%COMP%]{width:16px;height:16px;border:2px solid var(--color-border);border-radius:50%;margin-right:.5rem;display:flex;align-items:center;justify-content:center;transition:all .2s ease;flex-shrink:0;position:relative}.option-radio[_ngcontent-%COMP%] .radio-mark[_ngcontent-%COMP%]:after{content:"";width:8px;height:8px;border-radius:50%;background-color:var(--color-primary);transition:all .2s ease;opacity:0;transform:scale(0)}.option-radio[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + .radio-mark[_ngcontent-%COMP%]{border-color:var(--color-primary)}.option-radio[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + .radio-mark[_ngcontent-%COMP%]:after{opacity:1;transform:scale(1)}.option-radio[_ngcontent-%COMP%]:hover .radio-mark[_ngcontent-%COMP%]{border-color:var(--color-primary)}.option-radio[_ngcontent-%COMP%]:focus-within .radio-mark[_ngcontent-%COMP%]{box-shadow:0 0 0 3px #7064fb1a}.option-slider[_ngcontent-%COMP%]{width:100%;height:6px;border-radius:3px;background:var(--color-bg-solid);outline:none;cursor:pointer;-webkit-appearance:none;appearance:none}.option-slider[_ngcontent-%COMP%]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:20px;height:20px;border-radius:50%;background:var(--color-primary);cursor:pointer;border:2px solid white;box-shadow:0 2px 6px #0003;transition:all .2s ease}.option-slider[_ngcontent-%COMP%]::-webkit-slider-thumb:hover{transform:scale(1.1);box-shadow:0 2px 8px #0000004d}.option-slider[_ngcontent-%COMP%]::-moz-range-thumb{width:20px;height:20px;border-radius:50%;background:var(--color-primary);cursor:pointer;border:2px solid white;box-shadow:0 2px 6px #0003;transition:all .2s ease}.option-slider[_ngcontent-%COMP%]::-moz-range-thumb:hover{transform:scale(1.1);box-shadow:0 2px 8px #0000004d}.option-slider[_ngcontent-%COMP%]::-webkit-slider-track{height:6px;border-radius:3px;background:var(--color-bg-secondary)}.option-slider[_ngcontent-%COMP%]::-moz-range-track{height:6px;border-radius:3px;background:var(--color-bg-secondary);border:none}.option-slider[_ngcontent-%COMP%]:focus{outline:none}.option-slider[_ngcontent-%COMP%]:focus::-webkit-slider-thumb{box-shadow:0 0 0 3px #7064fb4d,0 2px 6px #0003}.option-slider[_ngcontent-%COMP%]:focus::-moz-range-thumb{box-shadow:0 0 0 3px #7064fb4d,0 2px 6px #0003}.test-voice-btn[_ngcontent-%COMP%]{width:100%;padding:.75rem 1rem;background:var(--color-primary);color:#fff;border:none;border-radius:6px;font-size:.875rem;font-weight:500;cursor:pointer;transition:all .2s ease;display:flex;align-items:center;justify-content:center;gap:.5rem}.test-voice-btn[_ngcontent-%COMP%]:hover{background:var(--color-primary-hover);transform:translateY(-1px);box-shadow:0 2px 8px #7064fb4d}.test-voice-btn[_ngcontent-%COMP%]:active{transform:translateY(0);box-shadow:0 1px 4px #7064fb4d}.test-voice-btn[_ngcontent-%COMP%]:focus{outline:none;box-shadow:0 0 0 3px #7064fb4d}.test-voice-btn[_ngcontent-%COMP%]:disabled{background:var(--color-bg-secondary);color:var(--color-text-secondary);cursor:not-allowed;transform:none;box-shadow:none}.test-voice-link[_ngcontent-%COMP%]{text-decoration-thickness:1.5px;text-underline-offset:3px;background:transparent;border:none;padding:0;font-size:.775rem;font-weight:400;cursor:pointer;transition:all .2s ease;display:inline-flex;align-items:center;justify-content:center;gap:.5rem;text-decoration:underline}.test-voice-link[_ngcontent-%COMP%]:hover{color:var(--color-primary-hover, var(--color-primary));text-decoration-thickness:2px}.test-voice-link[_ngcontent-%COMP%]:active{opacity:.8}.test-voice-link[_ngcontent-%COMP%]:focus{outline:2px solid var(--color-primary);outline-offset:2px}.test-voice-link[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px}.notification-error[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem;padding:.75rem;margin-top:.75rem;background-color:#d32f2f1a;border:1px solid rgba(211,47,47,.3);border-radius:6px;font-size:.8125rem;line-height:1.5}.notification-error[_ngcontent-%COMP%] .error-icon[_ngcontent-%COMP%]{color:#d32f2f;font-size:20px;width:20px;height:20px;flex-shrink:0;margin-top:2px}.notification-error[_ngcontent-%COMP%] .error-message[_ngcontent-%COMP%]{color:var(--color-text);flex:1}.notification-error[_ngcontent-%COMP%]{margin-top:.75rem;padding:.75rem;background-color:#f443361a;border:1px solid rgba(244,67,54,.3);border-radius:6px;display:flex;align-items:flex-start;gap:.5rem}.notification-error[_ngcontent-%COMP%] .error-icon[_ngcontent-%COMP%]{color:#f44336;font-size:20px;width:20px;height:20px;flex-shrink:0;margin-top:2px}.notification-error[_ngcontent-%COMP%] .error-message[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-text);line-height:1.5;flex:1}'],changeDetection:1})};function Qe(c){let e=c.args??"",t;try{let n=JSON.parse(e);t=JSON.stringify(n,null,2);}catch(n){t=e;}return `\u{1F527} ${c.name}
|
|
178
|
+
`).map(t=>this.addPeriodIfNeeded(t.trim())).filter(t=>t.length>0).join(" ")}addPeriodIfNeeded(e){return e?/[.!?;:]$/.test(e)?e:e+".":""}static \u0275fac=function(t){return new(t||c)};static \u0275prov=x({token:c,factory:c.\u0275fac,providedIn:"root"})};var rt=(c,e)=>e.code,at=(c,e)=>e.name+e.lang;function st(c,e){c&1&&(Cs(0,"div",17)(1,"mat-icon",39),JC(2,"warning"),hl(),Cs(3,"span",40),JC(4," Browser notifications have been blocked. To enable them, please reset the site permissions in your browser settings. "),hl()());}function ct(c,e){if(c&1&&(Cs(0,"option",25),JC(1),hl()),c&2){let t=e.$implicit;xg("value",t.code),sI(),tm("",t.flag," ",t.label);}}function lt(c,e){c&1&&(Cs(0,"option",32),JC(1,"Loading voices..."),hl());}function dt(c,e){c&1&&(Cs(0,"option",32),JC(1,"No voice available"),hl());}function pt(c,e){if(c&1&&(Cs(0,"option",25),JC(1),hl()),c&2){let t=e.$implicit;xg("value",t.name+"|"+t.lang),sI(),Dl(" ",t.displayName," ");}}var Ye=class c{destroy$=new ue;selectedTheme="light";selectedThemeVariant="industry";selectedVoiceLanguage="en-US";useEnterToSend=false;printTechnicalMessages=false;showTechnicalMessages=true;showWarningMessages=true;voiceInputMode="browser";voiceAnnounceEnabled=false;voiceMode="speech";voiceReadFullText=false;voiceVolume=80;voiceRate=120;agentNotificationEnabled=false;notificationSoundEnabled=true;browserNotificationEnabled=false;browserNotificationDenied=false;missionPreviewEnabled=false;availableVoices=[];selectedVoiceId=null;loadingVoices=false;voiceLanguageOptions=[{code:"fr-FR",label:"Fran\xE7ais",flag:"\u{1F1EB}\u{1F1F7}"},{code:"en-US",label:"English (US)",flag:"\u{1F1FA}\u{1F1F8}"},{code:"en-GB",label:"English (UK)",flag:"\u{1F1EC}\u{1F1E7}"},{code:"es-ES",label:"Espa\xF1ol",flag:"\u{1F1EA}\u{1F1F8}"},{code:"de-DE",label:"Deutsch",flag:"\u{1F1E9}\u{1F1EA}"},{code:"it-IT",label:"Italiano",flag:"\u{1F1EE}\u{1F1F9}"},{code:"pt-BR",label:"Portugu\xEAs",flag:"\u{1F1E7}\u{1F1F7}"},{code:"ja-JP",label:"\u65E5\u672C\u8A9E",flag:"\u{1F1EF}\u{1F1F5}"},{code:"ko-KR",label:"\uD55C\uAD6D\uC5B4",flag:"\u{1F1F0}\u{1F1F7}"},{code:"zh-CN",label:"\u4E2D\u6587 (\u7B80\u4F53)",flag:"\u{1F1E8}\u{1F1F3}"},{code:"ru-RU",label:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439",flag:"\u{1F1F7}\u{1F1FA}"},{code:"ar-SA",label:"\u0627\u0644\u0639\u0631\u0628\u064A\u0629",flag:"\u{1F1F8}\u{1F1E6}"}];preferencesService=g(L);voiceSynthesisService=g(z);themeService=g(me);ngOnInit(){let e=this.themeService.getCurrentTheme();this.selectedTheme=e.mode,this.selectedThemeVariant=e.variant,this.selectedVoiceLanguage=this.preferencesService.getVoiceLanguage(),this.useEnterToSend=this.preferencesService.getEnterToSend(),this.printTechnicalMessages=this.preferencesService.getPrintTechnicalMessages(),this.showTechnicalMessages=!this.preferencesService.getHideTechnicalMessages(),this.showWarningMessages=!this.preferencesService.getHideWarningMessages(),this.voiceInputMode=this.preferencesService.getVoiceInputMode(),this.voiceAnnounceEnabled=this.preferencesService.getVoiceAnnounceEnabled(),this.voiceMode=this.preferencesService.getVoiceMode(),this.voiceReadFullText=this.preferencesService.getVoiceReadFullText(),this.voiceVolume=Math.round(this.preferencesService.getVoiceVolume()*100),this.voiceRate=Math.round(this.preferencesService.getVoiceRate()*100),this.selectedVoiceId=this.preferencesService.getSelectedVoice(),this.agentNotificationEnabled=this.preferencesService.getAgentNotificationEnabled(),this.notificationSoundEnabled=this.preferencesService.getNotificationSoundEnabled(),this.browserNotificationEnabled=this.preferencesService.getBrowserNotificationEnabled(),this.missionPreviewEnabled=this.preferencesService.getMissionPreviewEnabled(),this.loadAvailableVoices(),this.themeService.currentTheme$.pipe(_d(this.destroy$)).subscribe(t=>{this.selectedTheme=t.mode,this.selectedThemeVariant=t.variant;}),this.preferencesService.voiceLanguage$.pipe(_d(this.destroy$)).subscribe(t=>{this.selectedVoiceLanguage=t;}),this.preferencesService.enterToSend$.pipe(_d(this.destroy$)).subscribe(t=>{this.useEnterToSend=t;}),this.preferencesService.printTechnicalMessages$.pipe(_d(this.destroy$)).subscribe(t=>{this.printTechnicalMessages=t;}),this.preferencesService.hideTechnicalMessages$.pipe(_d(this.destroy$)).subscribe(t=>{this.showTechnicalMessages=!t;}),this.preferencesService.hideWarningMessages$.pipe(_d(this.destroy$)).subscribe(t=>{this.showWarningMessages=!t;}),this.preferencesService.voiceInputMode$.pipe(_d(this.destroy$)).subscribe(t=>{this.voiceInputMode=t;}),this.preferencesService.voiceAnnounceEnabled$.pipe(_d(this.destroy$)).subscribe(t=>{this.voiceAnnounceEnabled=t;}),this.preferencesService.voiceMode$.pipe(_d(this.destroy$)).subscribe(t=>{this.voiceMode=t;}),this.preferencesService.voiceReadFullText$.pipe(_d(this.destroy$)).subscribe(t=>{this.voiceReadFullText=t;}),this.preferencesService.voiceVolume$.pipe(_d(this.destroy$)).subscribe(t=>{this.voiceVolume=Math.round(t*100);}),this.preferencesService.voiceRate$.pipe(_d(this.destroy$)).subscribe(t=>{this.voiceRate=Math.round(t*100);}),this.preferencesService.selectedVoice$.pipe(_d(this.destroy$)).subscribe(t=>{this.selectedVoiceId=t;}),this.preferencesService.voiceLanguage$.pipe(_d(this.destroy$)).subscribe(()=>{this.loadAvailableVoices();}),this.preferencesService.agentNotificationEnabled$.pipe(_d(this.destroy$)).subscribe(t=>{this.agentNotificationEnabled=t;}),this.preferencesService.notificationSoundEnabled$.pipe(_d(this.destroy$)).subscribe(t=>{this.notificationSoundEnabled=t;}),this.preferencesService.browserNotificationEnabled$.pipe(_d(this.destroy$)).subscribe(t=>{this.browserNotificationEnabled=t,this.checkNotificationPermission();}),this.preferencesService.missionPreviewEnabled$.pipe(_d(this.destroy$)).subscribe(t=>{this.missionPreviewEnabled=t;});}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete();}onThemeChange(){console.log("[OPTIONS] Theme changed to:",this.selectedTheme),this.themeService.setTheme({variant:this.selectedThemeVariant,mode:this.selectedTheme});}onVoiceLanguageChange(){console.log("[OPTIONS] Voice language changed to:",this.selectedVoiceLanguage),this.preferencesService.setVoiceLanguage(this.selectedVoiceLanguage);}onEnterToSendChange(){console.log("[OPTIONS] Enter to send changed to:",this.useEnterToSend),this.preferencesService.setEnterToSend(this.useEnterToSend);}onPrintTechnicalMessagesChange(){console.log("[OPTIONS] Print technical messages changed to:",this.printTechnicalMessages),this.preferencesService.setPrintTechnicalMessages(this.printTechnicalMessages);}onShowTechnicalMessagesChange(){let e=!this.showTechnicalMessages;console.log("[OPTIONS] Show technical messages changed to:",this.showTechnicalMessages,"(hide:",e,")"),this.preferencesService.setHideTechnicalMessages(e);}onShowWarningMessagesChange(){let e=!this.showWarningMessages;console.log("[OPTIONS] Show warning messages changed to:",this.showWarningMessages,"(hide:",e,")"),this.preferencesService.setHideWarningMessages(e);}onVoiceInputModeChange(e){let t=e.target.value;console.log("[OPTIONS] Voice input mode changed to:",t),this.preferencesService.setVoiceInputMode(t);}onVoiceAnnounceEnabledChange(){console.log("[OPTIONS] Voice announce enabled changed to:",this.voiceAnnounceEnabled),this.preferencesService.setVoiceAnnounceEnabled(this.voiceAnnounceEnabled);}onVoiceModeChange(){console.log("[OPTIONS] Voice mode changed to:",this.voiceMode),this.preferencesService.setVoiceMode(this.voiceMode);}onVoiceReadFullTextChange(){console.log("[OPTIONS] Voice read full text changed to:",this.voiceReadFullText),this.preferencesService.setVoiceReadFullText(this.voiceReadFullText);}onVoiceVolumeChange(){let e=this.voiceVolume/100;console.log("[OPTIONS] Voice volume changed to:",e),this.preferencesService.setVoiceVolume(e);}onVoiceRateChange(){let e=this.voiceRate/100;console.log("[OPTIONS] Voice rate changed to:",e),this.preferencesService.setVoiceRate(e);}loadAvailableVoices(){return dt$1(this,null,function*(){this.loadingVoices=true;try{this.availableVoices=yield this.voiceSynthesisService.getVoicesForLanguage(),console.log("[OPTIONS] Loaded",this.availableVoices.length,"voices for current language");}catch(e){console.error("[OPTIONS] Error loading voices:",e),this.availableVoices=[];}finally{this.loadingVoices=false;}})}onSelectedVoiceChange(){console.log("[OPTIONS] Selected voice changed to:",this.selectedVoiceId),this.preferencesService.setSelectedVoice(this.selectedVoiceId);}testVoice(){console.log("[OPTIONS] Testing voice with current settings"),this.voiceSynthesisService.testSelectedVoice();}onAgentNotificationEnabledChange(){console.log("[OPTIONS] Agent notification enabled changed to:",this.agentNotificationEnabled),this.preferencesService.setAgentNotificationEnabled(this.agentNotificationEnabled);}onNotificationSoundEnabledChange(){console.log("[OPTIONS] Notification sound enabled changed to:",this.notificationSoundEnabled),this.preferencesService.setNotificationSoundEnabled(this.notificationSoundEnabled);}onBrowserNotificationEnabledChange(){console.log("[OPTIONS] Browser notification enabled changed to:",this.browserNotificationEnabled),this.preferencesService.setBrowserNotificationEnabled(this.browserNotificationEnabled);}onMissionPreviewEnabledChange(){console.log("[OPTIONS] Mission preview panel enabled changed to:",this.missionPreviewEnabled),this.preferencesService.setMissionPreviewEnabled(this.missionPreviewEnabled);}checkNotificationPermission(){"Notification"in window&&(this.browserNotificationDenied=Notification.permission==="denied",console.log("[OPTIONS] Notification permission status:",Notification.permission));}static \u0275fac=function(t){return new(t||c)};static \u0275cmp=jw({type:c,selectors:[["app-options-panel"]],decls:168,vars:37,consts:[[1,"options-content"],[1,"option-section"],[1,"section-title"],[1,"option-group"],[1,"radio-group"],[1,"option-radio"],["type","radio","name","theme","value","light",3,"ngModelChange","change","ngModel"],[1,"radio-mark"],["type","radio","name","theme","value","dark",3,"ngModelChange","change","ngModel"],["type","radio","name","theme","value","system",3,"ngModelChange","change","ngModel"],[1,"option-label"],["type","radio","name","enterBehavior",3,"ngModelChange","change","value","ngModel"],[1,"toggle-option"],["color","primary",3,"ngModelChange","change","ngModel"],[1,"option-label-with-hint"],[1,"option-hint"],["color","primary",3,"ngModelChange","change","ngModel","disabled"],[1,"notification-error"],["for","voice-input-mode-select",1,"option-label"],["id","voice-input-mode-select",1,"option-select",3,"change","value"],["value","browser"],["value","whisper"],["value","voice-message"],["for","voice-language-select",1,"option-label"],["id","voice-language-select",1,"option-select",3,"ngModelChange","change","ngModel"],[3,"value"],["type","radio","name","voiceAnnounce",3,"ngModelChange","change","value","ngModel"],["type","radio","name","voiceMode","value","speech",3,"ngModelChange","change","ngModel"],["type","radio","name","voiceMode","value","notification",3,"ngModelChange","change","ngModel"],["type","radio","name","voiceReadFull",3,"ngModelChange","change","value","ngModel"],["for","voice-select",1,"option-label"],["id","voice-select",1,"option-select",3,"ngModelChange","change","ngModel","disabled"],["value",""],["role","button","tabindex","0","title","Test voice with current settings",1,"test-voice-link",3,"click"],[1,"thread-name"],["for","voice-volume-slider",1,"option-label"],["id","voice-volume-slider","type","range","min","0","max","100","step","5",1,"option-slider",3,"ngModelChange","input","ngModel"],["for","voice-rate-slider",1,"option-label"],["id","voice-rate-slider","type","range","min","50","max","200","step","10",1,"option-slider",3,"ngModelChange","input","ngModel"],[1,"error-icon"],[1,"error-message"]],template:function(t,n){t&1&&(Cs(0,"div",0)(1,"div",1)(2,"div",2)(3,"mat-icon"),JC(4,"palette"),hl(),Cs(5,"span"),JC(6,"Appearance"),hl()(),Cs(7,"div",3)(8,"div",4)(9,"label",5)(10,"input",6),sm("ngModelChange",function(o){return iT(n.selectedTheme,o)||(n.selectedTheme=o),o}),Lg("change",function(){return n.onThemeChange()}),hl(),ZI(),Ag(11,"span",7),JC(12," Light "),hl(),Cs(13,"label",5)(14,"input",8),sm("ngModelChange",function(o){return iT(n.selectedTheme,o)||(n.selectedTheme=o),o}),Lg("change",function(){return n.onThemeChange()}),hl(),ZI(),Ag(15,"span",7),JC(16," Dark "),hl(),Cs(17,"label",5)(18,"input",9),sm("ngModelChange",function(o){return iT(n.selectedTheme,o)||(n.selectedTheme=o),o}),Lg("change",function(){return n.onThemeChange()}),hl(),ZI(),Ag(19,"span",7),JC(20," System "),hl()()()(),Cs(21,"div",1)(22,"div",2)(23,"mat-icon"),JC(24,"chat_bubble_outline"),hl(),Cs(25,"span"),JC(26,"Messaging"),hl()(),Cs(27,"div",3)(28,"span",10),JC(29,"Send message behavior:"),hl(),Cs(30,"div",4)(31,"label",5)(32,"input",11),sm("ngModelChange",function(o){return iT(n.useEnterToSend,o)||(n.useEnterToSend=o),o}),Lg("change",function(){return n.onEnterToSendChange()}),hl(),ZI(),Ag(33,"span",7),JC(34," Enter to send "),hl(),Cs(35,"label",5)(36,"input",11),sm("ngModelChange",function(o){return iT(n.useEnterToSend,o)||(n.useEnterToSend=o),o}),Lg("change",function(){return n.onEnterToSendChange()}),hl(),ZI(),Ag(37,"span",7),JC(38," Enter for new line "),hl()()(),Cs(39,"div",3)(40,"div",12)(41,"span",10),JC(42,"Show technical messages"),hl(),Cs(43,"mat-slide-toggle",13),sm("ngModelChange",function(o){return iT(n.showTechnicalMessages,o)||(n.showTechnicalMessages=o),o}),Lg("change",function(){return n.onShowTechnicalMessagesChange()}),hl(),ZI(),hl()(),Cs(44,"div",3)(45,"div",12)(46,"span",10),JC(47,"Show warning messages"),hl(),Cs(48,"mat-slide-toggle",13),sm("ngModelChange",function(o){return iT(n.showWarningMessages,o)||(n.showWarningMessages=o),o}),Lg("change",function(){return n.onShowWarningMessagesChange()}),hl(),ZI(),hl()(),Cs(49,"div",3)(50,"div",12)(51,"span",10),JC(52,"Include technical messages in print"),hl(),Cs(53,"mat-slide-toggle",13),sm("ngModelChange",function(o){return iT(n.printTechnicalMessages,o)||(n.printTechnicalMessages=o),o}),Lg("change",function(){return n.onPrintTechnicalMessagesChange()}),hl(),ZI(),hl()()(),Cs(54,"div",1)(55,"div",2)(56,"mat-icon"),JC(57,"rocket_launch"),hl(),Cs(58,"span"),JC(59,"Mission Control"),hl()(),Cs(60,"div",3)(61,"div",12)(62,"div",14)(63,"span",10),JC(64,"Side-by-side thread preview"),hl(),Cs(65,"span",15),JC(66,"Click a mission card to open a preview panel. Recommended for large screens."),hl()(),Cs(67,"mat-slide-toggle",13),sm("ngModelChange",function(o){return iT(n.missionPreviewEnabled,o)||(n.missionPreviewEnabled=o),o}),Lg("change",function(){return n.onMissionPreviewEnabledChange()}),hl(),ZI(),hl()()(),Cs(68,"div",1)(69,"div",2)(70,"mat-icon"),JC(71,"notifications"),hl(),Cs(72,"span"),JC(73,"Notifications"),hl()(),Cs(74,"div",3)(75,"div",12)(76,"span",10),JC(77,"Notify when the agent answers or requests input"),hl(),Cs(78,"mat-slide-toggle",13),sm("ngModelChange",function(o){return iT(n.agentNotificationEnabled,o)||(n.agentNotificationEnabled=o),o}),Lg("change",function(){return n.onAgentNotificationEnabledChange()}),hl(),ZI(),hl()(),Cs(79,"div",3)(80,"div",12)(81,"span",10),JC(82,"Notification sound"),hl(),Cs(83,"mat-slide-toggle",16),sm("ngModelChange",function(o){return iT(n.notificationSoundEnabled,o)||(n.notificationSoundEnabled=o),o}),Lg("change",function(){return n.onNotificationSoundEnabledChange()}),hl(),ZI(),hl()(),Cs(84,"div",3)(85,"div",12)(86,"span",10),JC(87,"Browser notification"),hl(),Cs(88,"mat-slide-toggle",16),sm("ngModelChange",function(o){return iT(n.browserNotificationEnabled,o)||(n.browserNotificationEnabled=o),o}),Lg("change",function(){return n.onBrowserNotificationEnabledChange()}),hl(),ZI(),hl(),aC(89,st,5,0,"div",17),hl()(),Cs(90,"div",1)(91,"div",2)(92,"mat-icon"),JC(93,"record_voice_over"),hl(),Cs(94,"span"),JC(95,"Voice & Speech"),hl()(),Cs(96,"div",3)(97,"label",18),JC(98,"Voice input method:"),hl(),Cs(99,"select",19),Lg("change",function(o){return n.onVoiceInputModeChange(o)}),Cs(100,"option",20),JC(101,"Browser (real-time)"),hl(),Cs(102,"option",21),JC(103,"Whisper (higher accuracy)"),hl(),Cs(104,"option",22),JC(105,"Voice message (send audio)"),hl()()(),Cs(106,"div",3)(107,"label",23),JC(108,"Voice recognition language:"),hl(),Cs(109,"select",24),sm("ngModelChange",function(o){return iT(n.selectedVoiceLanguage,o)||(n.selectedVoiceLanguage=o),o}),Lg("change",function(){return n.onVoiceLanguageChange()}),dC(110,ct,2,3,"option",25,rt),hl(),ZI(),hl(),Cs(112,"div",3)(113,"span",10),JC(114,"Automatic announcement:"),hl(),Cs(115,"div",4)(116,"label",5)(117,"input",26),sm("ngModelChange",function(o){return iT(n.voiceAnnounceEnabled,o)||(n.voiceAnnounceEnabled=o),o}),Lg("change",function(){return n.onVoiceAnnounceEnabledChange()}),hl(),ZI(),Ag(118,"span",7),JC(119," Enabled "),hl(),Cs(120,"label",5)(121,"input",26),sm("ngModelChange",function(o){return iT(n.voiceAnnounceEnabled,o)||(n.voiceAnnounceEnabled=o),o}),Lg("change",function(){return n.onVoiceAnnounceEnabledChange()}),hl(),ZI(),Ag(122,"span",7),JC(123," Disabled "),hl()()(),Cs(124,"div",3)(125,"span",10),JC(126,"Voice mode:"),hl(),Cs(127,"div",4)(128,"label",5)(129,"input",27),sm("ngModelChange",function(o){return iT(n.voiceMode,o)||(n.voiceMode=o),o}),Lg("change",function(){return n.onVoiceModeChange()}),hl(),ZI(),Ag(130,"span",7),JC(131," Voice synthesis "),hl(),Cs(132,"label",5)(133,"input",28),sm("ngModelChange",function(o){return iT(n.voiceMode,o)||(n.voiceMode=o),o}),Lg("change",function(){return n.onVoiceModeChange()}),hl(),ZI(),Ag(134,"span",7),JC(135," Sound notification "),hl()()(),Cs(136,"div",3)(137,"span",10),JC(138,"Message reading:"),hl(),Cs(139,"div",4)(140,"label",5)(141,"input",29),sm("ngModelChange",function(o){return iT(n.voiceReadFullText,o)||(n.voiceReadFullText=o),o}),Lg("change",function(){return n.onVoiceReadFullTextChange()}),hl(),ZI(),Ag(142,"span",7),JC(143," Full message "),hl(),Cs(144,"label",5)(145,"input",29),sm("ngModelChange",function(o){return iT(n.voiceReadFullText,o)||(n.voiceReadFullText=o),o}),Lg("change",function(){return n.onVoiceReadFullTextChange()}),hl(),ZI(),Ag(146,"span",7),JC(147," First paragraphs only "),hl()()(),Cs(148,"div",3)(149,"label",30),JC(150,"Selected voice:"),hl(),Cs(151,"select",31),sm("ngModelChange",function(o){return iT(n.selectedVoiceId,o)||(n.selectedVoiceId=o),o}),Lg("change",function(){return n.onSelectedVoiceChange()}),aC(152,lt,2,0,"option",32),aC(153,dt,2,0,"option",32),dC(154,pt,2,2,"option",25,at),hl(),ZI(),Ag(156,"div",10),Cs(157,"a",33),Lg("click",function(){return n.testVoice()}),Cs(158,"span",34),JC(159,"Test voice"),hl()()(),Cs(160,"div",3)(161,"label",35),JC(162),hl(),Cs(163,"input",36),sm("ngModelChange",function(o){return iT(n.voiceVolume,o)||(n.voiceVolume=o),o}),Lg("input",function(){return n.onVoiceVolumeChange()}),hl(),ZI(),hl(),Cs(164,"div",3)(165,"label",37),JC(166),hl(),Cs(167,"input",38),sm("ngModelChange",function(o){return iT(n.voiceRate,o)||(n.voiceRate=o),o}),Lg("input",function(){return n.onVoiceRateChange()}),hl(),ZI(),hl()()()),t&2&&(sI(10),im("ngModel",n.selectedTheme),QI(),sI(4),im("ngModel",n.selectedTheme),QI(),sI(4),im("ngModel",n.selectedTheme),QI(),sI(14),xg("value",true),im("ngModel",n.useEnterToSend),QI(),sI(4),xg("value",false),im("ngModel",n.useEnterToSend),QI(),sI(7),im("ngModel",n.showTechnicalMessages),QI(),sI(5),im("ngModel",n.showWarningMessages),QI(),sI(5),im("ngModel",n.printTechnicalMessages),QI(),sI(14),im("ngModel",n.missionPreviewEnabled),QI(),sI(11),im("ngModel",n.agentNotificationEnabled),QI(),sI(5),im("ngModel",n.notificationSoundEnabled),xg("disabled",!n.agentNotificationEnabled),QI(),sI(5),im("ngModel",n.browserNotificationEnabled),xg("disabled",!n.agentNotificationEnabled||n.browserNotificationDenied),QI(),sI(),cC(n.browserNotificationDenied?89:-1),sI(10),xg("value",n.voiceInputMode),sI(10),im("ngModel",n.selectedVoiceLanguage),QI(),sI(),fC(n.voiceLanguageOptions),sI(7),xg("value",true),im("ngModel",n.voiceAnnounceEnabled),QI(),sI(4),xg("value",false),im("ngModel",n.voiceAnnounceEnabled),QI(),sI(8),im("ngModel",n.voiceMode),QI(),sI(4),im("ngModel",n.voiceMode),QI(),sI(8),xg("value",true),im("ngModel",n.voiceReadFullText),QI(),sI(4),xg("value",false),im("ngModel",n.voiceReadFullText),QI(),sI(6),im("ngModel",n.selectedVoiceId),xg("disabled",n.loadingVoices||n.availableVoices.length===0),QI(),sI(),cC(n.loadingVoices?152:-1),sI(),cC(!n.loadingVoices&&n.availableVoices.length===0?153:-1),sI(),fC(n.availableVoices),sI(8),Dl("Volume: ",n.voiceVolume,"%"),sI(),im("ngModel",n.voiceVolume),QI(),sI(3),Dl("Speed: ",n.voiceRate,"%"),sI(),im("ngModel",n.voiceRate),QI());},dependencies:[ti,Qn,ei,Ye$1,_n,At,mn,Zn,cn,wt,se],styles:['.options-content[_ngcontent-%COMP%]{padding:0;width:100%}.option-group[_ngcontent-%COMP%]{padding:0 1rem 1rem;margin-bottom:1rem;border-bottom:1px solid var(--color-border-light)}.option-group[_ngcontent-%COMP%]:last-child{margin-bottom:0;padding-bottom:0;border-bottom:none}.option-label[_ngcontent-%COMP%]{display:block;margin-bottom:.5rem;font-weight:500;color:var(--color-text);font-size:.875rem}.toggle-option[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;gap:1rem}.toggle-option[_ngcontent-%COMP%] .option-label[_ngcontent-%COMP%]{margin-bottom:0;flex:1}.toggle-option[_ngcontent-%COMP%] mat-slide-toggle[_ngcontent-%COMP%]{flex-shrink:0}.option-label-with-hint[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.25rem;flex:1}.option-label-with-hint[_ngcontent-%COMP%] .option-label[_ngcontent-%COMP%]{margin-bottom:0}.option-label-with-hint[_ngcontent-%COMP%] .option-hint[_ngcontent-%COMP%]{font-size:.775rem;color:var(--color-text-secondary);line-height:1.4}.option-select[_ngcontent-%COMP%]{width:100%;padding:.5rem;border:1px solid var(--color-border);border-radius:4px;background:var(--color-input-bg);color:var(--color-text);font-size:.875rem;cursor:pointer}.option-select[_ngcontent-%COMP%]:focus{outline:none;border-color:var(--color-primary);box-shadow:0 0 0 3px #7064fb1a}.option-select[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.option-select[_ngcontent-%COMP%] option[_ngcontent-%COMP%]{padding:.5rem}.option-checkbox[_ngcontent-%COMP%]{display:flex;align-items:center;cursor:pointer;font-size:.875rem;color:var(--color-text);-webkit-user-select:none;user-select:none}.option-checkbox[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{display:none}.option-checkbox[_ngcontent-%COMP%] .checkmark[_ngcontent-%COMP%]{width:18px;height:18px;border:2px solid var(--color-border);border-radius:3px;margin-right:.75rem;display:flex;align-items:center;justify-content:center;transition:all .2s ease;flex-shrink:0}.option-checkbox[_ngcontent-%COMP%] .checkmark[_ngcontent-%COMP%]:after{content:"";width:10px;height:6px;border-left:2px solid transparent;border-bottom:2px solid transparent;transform:rotate(-45deg);transition:all .2s ease;opacity:0}.option-checkbox[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]:checked + .checkmark[_ngcontent-%COMP%]{background-color:var(--color-primary);border-color:var(--color-primary)}.option-checkbox[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]:checked + .checkmark[_ngcontent-%COMP%]:after{border-left-color:#fff;border-bottom-color:#fff;opacity:1}.option-checkbox[_ngcontent-%COMP%]:hover .checkmark[_ngcontent-%COMP%]{border-color:var(--color-primary)}.option-checkbox[_ngcontent-%COMP%]:focus-within .checkmark[_ngcontent-%COMP%]{box-shadow:0 0 0 3px #7064fb1a}.option-section[_ngcontent-%COMP%]{padding-top:1rem;margin-top:1rem;border-top:2px solid var(--color-border)}.option-section[_ngcontent-%COMP%]:first-child{border-top:none;padding-top:0;margin-top:0}.section-title[_ngcontent-%COMP%]{margin:0 0 1rem;padding:0 1rem;font-size:.9rem;font-weight:600;color:var(--color-text);display:flex;align-items:center;gap:.5rem}.section-title[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px}.radio-group[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.option-radio[_ngcontent-%COMP%]{display:flex;align-items:center;cursor:pointer;font-size:.875rem;color:var(--color-text);-webkit-user-select:none;user-select:none}.option-radio[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{display:none}.option-radio[_ngcontent-%COMP%] .radio-mark[_ngcontent-%COMP%]{width:16px;height:16px;border:2px solid var(--color-border);border-radius:50%;margin-right:.5rem;display:flex;align-items:center;justify-content:center;transition:all .2s ease;flex-shrink:0;position:relative}.option-radio[_ngcontent-%COMP%] .radio-mark[_ngcontent-%COMP%]:after{content:"";width:8px;height:8px;border-radius:50%;background-color:var(--color-primary);transition:all .2s ease;opacity:0;transform:scale(0)}.option-radio[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + .radio-mark[_ngcontent-%COMP%]{border-color:var(--color-primary)}.option-radio[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + .radio-mark[_ngcontent-%COMP%]:after{opacity:1;transform:scale(1)}.option-radio[_ngcontent-%COMP%]:hover .radio-mark[_ngcontent-%COMP%]{border-color:var(--color-primary)}.option-radio[_ngcontent-%COMP%]:focus-within .radio-mark[_ngcontent-%COMP%]{box-shadow:0 0 0 3px #7064fb1a}.option-slider[_ngcontent-%COMP%]{width:100%;height:6px;border-radius:3px;background:var(--color-bg-solid);outline:none;cursor:pointer;-webkit-appearance:none;appearance:none}.option-slider[_ngcontent-%COMP%]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:20px;height:20px;border-radius:50%;background:var(--color-primary);cursor:pointer;border:2px solid white;box-shadow:0 2px 6px #0003;transition:all .2s ease}.option-slider[_ngcontent-%COMP%]::-webkit-slider-thumb:hover{transform:scale(1.1);box-shadow:0 2px 8px #0000004d}.option-slider[_ngcontent-%COMP%]::-moz-range-thumb{width:20px;height:20px;border-radius:50%;background:var(--color-primary);cursor:pointer;border:2px solid white;box-shadow:0 2px 6px #0003;transition:all .2s ease}.option-slider[_ngcontent-%COMP%]::-moz-range-thumb:hover{transform:scale(1.1);box-shadow:0 2px 8px #0000004d}.option-slider[_ngcontent-%COMP%]::-webkit-slider-track{height:6px;border-radius:3px;background:var(--color-bg-secondary)}.option-slider[_ngcontent-%COMP%]::-moz-range-track{height:6px;border-radius:3px;background:var(--color-bg-secondary);border:none}.option-slider[_ngcontent-%COMP%]:focus{outline:none}.option-slider[_ngcontent-%COMP%]:focus::-webkit-slider-thumb{box-shadow:0 0 0 3px #7064fb4d,0 2px 6px #0003}.option-slider[_ngcontent-%COMP%]:focus::-moz-range-thumb{box-shadow:0 0 0 3px #7064fb4d,0 2px 6px #0003}.test-voice-btn[_ngcontent-%COMP%]{width:100%;padding:.75rem 1rem;background:var(--color-primary);color:#fff;border:none;border-radius:6px;font-size:.875rem;font-weight:500;cursor:pointer;transition:all .2s ease;display:flex;align-items:center;justify-content:center;gap:.5rem}.test-voice-btn[_ngcontent-%COMP%]:hover{background:var(--color-primary-hover);transform:translateY(-1px);box-shadow:0 2px 8px #7064fb4d}.test-voice-btn[_ngcontent-%COMP%]:active{transform:translateY(0);box-shadow:0 1px 4px #7064fb4d}.test-voice-btn[_ngcontent-%COMP%]:focus{outline:none;box-shadow:0 0 0 3px #7064fb4d}.test-voice-btn[_ngcontent-%COMP%]:disabled{background:var(--color-bg-secondary);color:var(--color-text-secondary);cursor:not-allowed;transform:none;box-shadow:none}.test-voice-link[_ngcontent-%COMP%]{text-decoration-thickness:1.5px;text-underline-offset:3px;background:transparent;border:none;padding:0;font-size:.775rem;font-weight:400;cursor:pointer;transition:all .2s ease;display:inline-flex;align-items:center;justify-content:center;gap:.5rem;text-decoration:underline}.test-voice-link[_ngcontent-%COMP%]:hover{color:var(--color-primary-hover, var(--color-primary));text-decoration-thickness:2px}.test-voice-link[_ngcontent-%COMP%]:active{opacity:.8}.test-voice-link[_ngcontent-%COMP%]:focus{outline:2px solid var(--color-primary);outline-offset:2px}.test-voice-link[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px}.notification-error[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem;padding:.75rem;margin-top:.75rem;background-color:#d32f2f1a;border:1px solid rgba(211,47,47,.3);border-radius:6px;font-size:.8125rem;line-height:1.5}.notification-error[_ngcontent-%COMP%] .error-icon[_ngcontent-%COMP%]{color:#d32f2f;font-size:20px;width:20px;height:20px;flex-shrink:0;margin-top:2px}.notification-error[_ngcontent-%COMP%] .error-message[_ngcontent-%COMP%]{color:var(--color-text);flex:1}.notification-error[_ngcontent-%COMP%]{margin-top:.75rem;padding:.75rem;background-color:#f443361a;border:1px solid rgba(244,67,54,.3);border-radius:6px;display:flex;align-items:flex-start;gap:.5rem}.notification-error[_ngcontent-%COMP%] .error-icon[_ngcontent-%COMP%]{color:#f44336;font-size:20px;width:20px;height:20px;flex-shrink:0;margin-top:2px}.notification-error[_ngcontent-%COMP%] .error-message[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-text);line-height:1.5;flex:1}'],changeDetection:1})};function Qe(c){let e=c.args??"",t;try{let n=JSON.parse(e);t=JSON.stringify(n,null,2);}catch(n){t=e;}return `\u{1F527} ${c.name}
|
|
179
179
|
|
|
180
|
-
${t}`}var Ge=class c{destroy$=new ue;currentProject=null;currentThread=null;messagesSubject=new Tr([]);isThinkingSubject=new Tr(false);currentChoiceSubject=new Tr(null);projectTitleSubject=new Tr("Coday");currentInviteEventSubject=new Tr(null);messageToRestoreSubject=new Tr("");threadUpdateEventSubject=new Tr(null);currentChoiceEvent=null;thinkingTimeout=null;accumulatedChunks="";streamingTextSubject=new Tr("");subThreadEventsSubject=new ue;subThreadEvents$=this.subThreadEventsSubject.asObservable();subThreadEventBuffers=new Map;getBufferedSubThreadEvents(e){return this.subThreadEventBuffers.get(e)??[]}messages$=this.messagesSubject.asObservable();streamingText$=this.streamingTextSubject.asObservable();isThinking$=this.isThinkingSubject.asObservable();currentChoice$=this.currentChoiceSubject.asObservable();currentInviteEvent$=this.currentInviteEventSubject.asObservable();messageToRestore$=this.messageToRestoreSubject.asObservable();threadUpdateEvent$=this.threadUpdateEventSubject.asObservable();connectionStatus$;tabTitleService=null;eventStream=g(fe);messageApi=g(be);userService=g(pe);constructor(){this.connectionStatus$=this.eventStream.connectionStatus$,this.initializeEventHandling();}setTabTitleService(e){this.tabTitleService=e;}connectToThread(e,t){this.currentProject=e,this.currentThread=t,this.eventStream.connectToThread(e,t);}loadHistoryFromRest(e){for(let t of e){let n=le(t);n&&this.handleEvent(n,true);}}resetMessages(){this.messagesSubject.next([]),this.currentChoiceSubject.next(null),this.currentInviteEventSubject.next(null),this.currentChoiceEvent=null,this.accumulatedChunks="",this.streamingTextSubject.next(""),this.subThreadEventBuffers.clear(),this.stopThinking();}sendMessage(e){if(!this.currentProject||!this.currentThread){console.error("[CODAY] Cannot send message: no project or thread selected");return}let t=this.currentInviteEventSubject.value;if(t){this.clearThinkingTimeout(),this.isThinkingSubject.next(true),this.thinkingTimeout=setTimeout(()=>{this.thinkingTimeout=null,this.stopThinking(),console.warn("[CODAY] Safety timeout: no server response after 30 s, releasing thinking state");},3e4),this.tabTitleService?.setSystemActive(),this.currentInviteEventSubject.next(null);let n=t.buildAnswer(e);this.messageApi.sendMessage(n).subscribe({error:i=>{console.error("[CODAY] Send invite answer error:",i),this.currentInviteEventSubject.next(t),this.stopThinking();}});}else this.messageApi.sendFreeMessage(e).subscribe({error:n=>{console.error("[CODAY] Send error:",n);}});}sendChoice(e){if(!this.currentProject||!this.currentThread){console.error("[CODAY] Cannot send choice: no project or thread selected");return}if(this.currentChoiceEvent){this.clearThinkingTimeout(),this.isThinkingSubject.next(true),this.thinkingTimeout=setTimeout(()=>{this.thinkingTimeout=null,this.stopThinking(),console.warn("[CODAY] Safety timeout: no server response after 30 s, releasing thinking state");},3e4),this.tabTitleService?.setSystemActive();let t=this.currentChoiceEvent.buildAnswer(e);this.currentChoiceSubject.next(null),this.currentChoiceEvent=null,this.messageApi.sendMessage(t).subscribe({next:()=>{},error:n=>{console.error("[CODAY-CHOICE] Choice error:",n),this.stopThinking();}});}else console.error("[CODAY-CHOICE] No choice event available for choice:",e);}deleteMessage(e){let t=this.messagesSubject.value.find(i=>i.id===e),n=this.extractTextContentFromMessage(t);return this.messageApi.deleteMessage(e).pipe(
|
|
180
|
+
${t}`}var Ge=class c{destroy$=new ue;currentProject=null;currentThread=null;messagesSubject=new Tr([]);isThinkingSubject=new Tr(false);currentChoiceSubject=new Tr(null);projectTitleSubject=new Tr("Coday");currentInviteEventSubject=new Tr(null);messageToRestoreSubject=new Tr("");threadUpdateEventSubject=new Tr(null);currentChoiceEvent=null;thinkingTimeout=null;accumulatedChunks="";streamingTextSubject=new Tr("");subThreadEventsSubject=new ue;subThreadEvents$=this.subThreadEventsSubject.asObservable();subThreadEventBuffers=new Map;getBufferedSubThreadEvents(e){return this.subThreadEventBuffers.get(e)??[]}messages$=this.messagesSubject.asObservable();streamingText$=this.streamingTextSubject.asObservable();isThinking$=this.isThinkingSubject.asObservable();currentChoice$=this.currentChoiceSubject.asObservable();currentInviteEvent$=this.currentInviteEventSubject.asObservable();messageToRestore$=this.messageToRestoreSubject.asObservable();threadUpdateEvent$=this.threadUpdateEventSubject.asObservable();connectionStatus$;tabTitleService=null;eventStream=g(fe);messageApi=g(be);userService=g(pe);constructor(){this.connectionStatus$=this.eventStream.connectionStatus$,this.initializeEventHandling();}setTabTitleService(e){this.tabTitleService=e;}connectToThread(e,t){this.currentProject=e,this.currentThread=t,this.eventStream.connectToThread(e,t);}loadHistoryFromRest(e){for(let t of e){let n=le(t);n&&this.handleEvent(n,true);}}resetMessages(){this.messagesSubject.next([]),this.currentChoiceSubject.next(null),this.currentInviteEventSubject.next(null),this.currentChoiceEvent=null,this.accumulatedChunks="",this.streamingTextSubject.next(""),this.subThreadEventBuffers.clear(),this.stopThinking();}sendMessage(e){if(!this.currentProject||!this.currentThread){console.error("[CODAY] Cannot send message: no project or thread selected");return}let t=this.currentInviteEventSubject.value;if(t){this.clearThinkingTimeout(),this.isThinkingSubject.next(true),this.thinkingTimeout=setTimeout(()=>{this.thinkingTimeout=null,this.stopThinking(),console.warn("[CODAY] Safety timeout: no server response after 30 s, releasing thinking state");},3e4),this.tabTitleService?.setSystemActive(),this.currentInviteEventSubject.next(null);let n=t.buildAnswer(e);this.messageApi.sendMessage(n).subscribe({error:i=>{console.error("[CODAY] Send invite answer error:",i),this.currentInviteEventSubject.next(t),this.stopThinking();}});}else this.messageApi.sendFreeMessage(e).subscribe({error:n=>{console.error("[CODAY] Send error:",n);}});}sendChoice(e){if(!this.currentProject||!this.currentThread){console.error("[CODAY] Cannot send choice: no project or thread selected");return}if(this.currentChoiceEvent){this.clearThinkingTimeout(),this.isThinkingSubject.next(true),this.thinkingTimeout=setTimeout(()=>{this.thinkingTimeout=null,this.stopThinking(),console.warn("[CODAY] Safety timeout: no server response after 30 s, releasing thinking state");},3e4),this.tabTitleService?.setSystemActive();let t=this.currentChoiceEvent.buildAnswer(e);this.currentChoiceSubject.next(null),this.currentChoiceEvent=null,this.messageApi.sendMessage(t).subscribe({next:()=>{},error:n=>{console.error("[CODAY-CHOICE] Choice error:",n),this.stopThinking();}});}else console.error("[CODAY-CHOICE] No choice event available for choice:",e);}deleteMessage(e){let t=this.messagesSubject.value.find(i=>i.id===e),n=this.extractTextContentFromMessage(t);return this.messageApi.deleteMessage(e).pipe(jd(i=>{i.success&&(this.removeMessagesFromIndex(e),n.trim()&&this.messageToRestoreSubject.next(n));}))}getCurrentProjectTitle(){return this.projectTitleSubject.value}getCurrentInviteEvent(){return this.currentInviteEventSubject.value}setThinkingForPendingMessage(){this.isThinkingSubject.next(true),this.tabTitleService?.setSystemActive();}initializeEventHandling(){this.eventStream.events$.pipe(_d(this.destroy$)).subscribe({next:e=>this.handleEvent(e),error:e=>console.error("[CODAY] Event stream error:",e),complete:()=>console.log("[CODAY] Event stream completed")});}handleEvent(e,t=false){if(e.threadId&&e.threadId!==this.currentThread){let n=this.subThreadEventBuffers.get(e.threadId);n?n.push(e):this.subThreadEventBuffers.set(e.threadId,[e]),this.subThreadEventsSubject.next(e);return}e instanceof T?this.handleMessageEvent(e):e instanceof B?this.handleTextChunkEvent(e):e instanceof A?this.handleTextEvent(e):e instanceof u?this.handleAnswerEvent(e):e instanceof h?this.handleErrorEvent(e):e instanceof M?this.handleWarnEvent(e):e instanceof O?this.handleThinkingEvent(e):e instanceof v?this.handleToolRequestEvent(e):e instanceof m?this.handleToolResponseEvent(e):e instanceof b?this.handleChoiceEvent(e,t):e instanceof F?this.handleHeartBeatEvent(e):e instanceof f?this.handleInviteEvent(e,t):e instanceof V?this.handleThreadUpdateEvent(e):e instanceof R?this.handleDelegationEvent(e):e instanceof H||e instanceof K||console.warn("[CODAY] Unhandled event type:",e.type);}handleDelegationEvent(e){if(console.log("[CODAY] DelegationEvent received:",e.subThreadId,e.agentName),this.messagesSubject.value.findIndex(i=>i.subThreadId===e.subThreadId)===-1){let i={id:e.timestamp,role:"system",speaker:e.agentName,content:[{type:"text",content:""}],timestamp:new Date,type:"delegation",subThreadId:e.subThreadId,delegationAgentName:e.agentName};this.addMessage(i);}}handleThreadUpdateEvent(e){this.threadUpdateEventSubject.next(e);}handleMessageEvent(e){e.role==="assistant"&&this.accumulatedChunks&&(this.accumulatedChunks="",this.streamingTextSubject.next(""));let t={id:e.timestamp,role:e.role,speaker:e.name,content:e.content,timestamp:e.date,type:"text"};this.addMessage(t);}handleTextChunkEvent(e){this.accumulatedChunks+=e.chunk,this.streamingTextSubject.next(this.accumulatedChunks);}handleTextEvent(e){let t={id:e.timestamp,role:e.speaker?"assistant":"system",speaker:e.speaker??"System",content:[{type:"text",content:e.text}],timestamp:e.date,type:e.speaker?"text":"technical"};this.addMessage(t);}handleAnswerEvent(e){let t=this.currentInviteEventSubject.value;if(t){let i=!!e.parentKey&&e.parentKey===t.timestamp,o=!e.parentKey&&e.date>=t.date;(i||o)&&this.currentInviteEventSubject.next(null);}if(this.currentChoiceEvent){let i=!!e.parentKey&&e.parentKey===this.currentChoiceEvent.timestamp,o=!e.parentKey&&e.date>=this.currentChoiceEvent.date;(i||o)&&(this.currentChoiceEvent=null,this.currentChoiceSubject.next(null));}if(e.silent)return;let n={id:e.timestamp,role:"user",speaker:e.name??this.userService.getUsername()??"User",content:[{type:"text",content:e.answer}],timestamp:e.date,type:"text",parentKey:e.parentKey,invite:e.invite};this.addMessage(n);}handleErrorEvent(e){let t={id:e.timestamp,role:"system",speaker:"System",content:[{type:"text",content:`Error: ${JSON.stringify(e.error)}`}],timestamp:e.date,type:"error"};this.addMessage(t);}handleWarnEvent(e){let t={id:e.timestamp,role:"system",speaker:"System",content:[{type:"text",content:`Warning: ${JSON.stringify(e.warning)}`}],timestamp:e.date,type:"warning"};this.addMessage(t);}handleThinkingEvent(e){this.currentInviteEventSubject.value||this.currentChoiceEvent||(this.clearThinkingTimeout(),this.isThinkingSubject.next(true),this.tabTitleService?.setSystemActive(),this.thinkingTimeout=setTimeout(()=>{this.isThinkingSubject.next(false),this.thinkingTimeout=null,this.tabTitleService?.setSystemInactive();},O.debounce+1e3));}handleToolRequestEvent(e){let t={id:e.timestamp,role:"system",speaker:"System",content:[{type:"text",content:e.toSingleLineString()}],timestamp:e.date,type:"technical",eventId:e.timestamp,fullContent:Qe(e)};this.addMessage(t);}handleToolResponseEvent(e){let t={id:e.timestamp,role:"system",speaker:"System",content:[{type:"text",content:e.toSingleLineString()}],timestamp:e.date,type:"technical",eventId:e.timestamp};this.addMessage(t);}handleChoiceEvent(e,t=false){this.stopThinking();let n={id:e.timestamp,role:"assistant",speaker:"Assistant",content:[{type:"text",content:e.optionalQuestion?`${e.optionalQuestion} ${e.invite}`:e.invite}],timestamp:e.date,type:"text"};if(this.addMessage(n),t||this.messagesSubject.value.some(y=>y.parentKey===e.timestamp||y.role==="user"&&y.timestamp>e.date||y.role==="assistant"&&y.timestamp>e.date))return;this.currentChoiceEvent=e,this.tabTitleService?.setSystemInactive();let E=e.options.map(y=>({value:y,label:y})),C=e.optionalQuestion?`${e.optionalQuestion} ${e.invite}`:e.invite;this.currentChoiceSubject.next({options:E,label:C,allowFreeText:e.allowFreeText});}handleHeartBeatEvent(e){}handleInviteEvent(e,t=false){if(this.stopThinking(),e.invite===_e)t||(this.currentInviteEventSubject.next(e),this.tabTitleService?.setSystemInactive());else {let i={id:e.timestamp,role:"assistant",speaker:"Assistant",content:[{type:"text",content:e.invite}],timestamp:e.date,type:"text"};this.addMessage(i),this.messagesSubject.value.some(C=>C.parentKey===e.timestamp||C.role==="user"&&C.timestamp>e.date||C.role==="assistant"&&C.timestamp>e.date)||t||(this.currentInviteEventSubject.next(e),this.tabTitleService?.setSystemInactive());}}addMessage(e){let t=this.messagesSubject.value;t.some(n=>n.id===e.id)||this.messagesSubject.next([...t,e]);}removeMessagesFromIndex(e){let t=this.messagesSubject.value,n=t.findIndex(o=>o.id===e);if(n===-1||n===0)return;let i=t.slice(0,n);this.messagesSubject.next(i),this.stopThinking();}extractTextContentFromMessage(e){return e?e.content.filter(t=>t.type==="text").map(t=>t.content).join(`
|
|
181
181
|
|
|
182
|
-
`):""}clearThinkingTimeout(){this.thinkingTimeout&&(clearTimeout(this.thinkingTimeout),this.thinkingTimeout=null);}stopThinking(){this.clearThinkingTimeout(),this.isThinkingSubject.next(false),this.tabTitleService&&this.tabTitleService.setSystemInactive();}ngOnDestroy(){this.clearThinkingTimeout(),this.destroy$.next(),this.destroy$.complete(),this.currentInviteEventSubject.complete(),this.messageToRestoreSubject.complete(),this.threadUpdateEventSubject.complete(),this.streamingTextSubject.complete(),this.eventStream.disconnect();}static \u0275fac=function(t){return new(t||c)};static \u0275prov=x({token:c,factory:c.\u0275fac,providedIn:"root"})};function gt(c,e){if(c&1&&(Cs(0,"div",3),JC(1),hl()),c&2){let t=CC();sI(),Dl("\u274C ",t.errorMessage);}}var Ze=class c{dialogRef=g(z$1);data=g(Ue);jsonContent;errorMessage="";title;constructor(){this.jsonContent=this.data.initialContent,this.title=this.data.title||this.getDefaultTitle(this.data.configType,this.data.projectName);}getDefaultTitle(e,t){return e==="user"?"User Configuration":`Project Configuration: ${t||"Unknown"}`}onSave(){this.errorMessage="";let e;try{e=JSON.parse(this.jsonContent);}catch(t){this.errorMessage=`Invalid JSON syntax: ${t instanceof Error?t.message:"Unknown error"}`;return}this.dialogRef.close(e);}onCancel(){this.dialogRef.close();}static \u0275fac=function(t){return new(t||c)};static \u0275cmp=jw({type:c,selectors:[["app-json-editor"]],decls:13,vars:3,consts:[["mat-dialog-title",""],["mat-icon-button","","title","Close",1,"close-button",3,"click"],["spellcheck","false","placeholder","Enter JSON configuration...",1,"json-textarea",3,"ngModelChange","ngModel"],[1,"error-message"],["align","end"],["matButton","",3,"click"],["matButton","filled","color","primary",3,"click"]],template:function(t,n){t&1&&(Cs(0,"div",0),JC(1),Cs(2,"button",1),
|
|
182
|
+
`):""}clearThinkingTimeout(){this.thinkingTimeout&&(clearTimeout(this.thinkingTimeout),this.thinkingTimeout=null);}stopThinking(){this.clearThinkingTimeout(),this.isThinkingSubject.next(false),this.tabTitleService&&this.tabTitleService.setSystemInactive();}ngOnDestroy(){this.clearThinkingTimeout(),this.destroy$.next(),this.destroy$.complete(),this.currentInviteEventSubject.complete(),this.messageToRestoreSubject.complete(),this.threadUpdateEventSubject.complete(),this.streamingTextSubject.complete(),this.eventStream.disconnect();}static \u0275fac=function(t){return new(t||c)};static \u0275prov=x({token:c,factory:c.\u0275fac,providedIn:"root"})};function gt(c,e){if(c&1&&(Cs(0,"div",3),JC(1),hl()),c&2){let t=CC();sI(),Dl("\u274C ",t.errorMessage);}}var Ze=class c{dialogRef=g(z$1);data=g(Ue);jsonContent;errorMessage="";title;constructor(){this.jsonContent=this.data.initialContent,this.title=this.data.title||this.getDefaultTitle(this.data.configType,this.data.projectName);}getDefaultTitle(e,t){return e==="user"?"User Configuration":`Project Configuration: ${t||"Unknown"}`}onSave(){this.errorMessage="";let e;try{e=JSON.parse(this.jsonContent);}catch(t){this.errorMessage=`Invalid JSON syntax: ${t instanceof Error?t.message:"Unknown error"}`;return}this.dialogRef.close(e);}onCancel(){this.dialogRef.close();}static \u0275fac=function(t){return new(t||c)};static \u0275cmp=jw({type:c,selectors:[["app-json-editor"]],decls:13,vars:3,consts:[["mat-dialog-title",""],["mat-icon-button","","title","Close",1,"close-button",3,"click"],["spellcheck","false","placeholder","Enter JSON configuration...",1,"json-textarea",3,"ngModelChange","ngModel"],[1,"error-message"],["align","end"],["matButton","",3,"click"],["matButton","filled","color","primary",3,"click"]],template:function(t,n){t&1&&(Cs(0,"div",0),JC(1),Cs(2,"button",1),Lg("click",function(){return n.onCancel()}),Cs(3,"mat-icon"),JC(4,"close"),hl()()(),Cs(5,"mat-dialog-content")(6,"textarea",2),sm("ngModelChange",function(o){return iT(n.jsonContent,o)||(n.jsonContent=o),o}),hl(),ZI(),aC(7,gt,2,1,"div",3),hl(),Cs(8,"mat-dialog-actions",4)(9,"button",5),Lg("click",function(){return n.onCancel()}),JC(10,"Cancel"),hl(),Cs(11,"button",6),Lg("click",function(){return n.onSave()}),JC(12,"Save"),hl()()),t&2&&(sI(),Dl(" ",n.title," "),sI(5),im("ngModel",n.jsonContent),QI(),sI(),cC(n.errorMessage?7:-1));},dependencies:[Xm,ti,Ye$1,Zn,cn,wt,Gn,pr,jt,Nt,Vt],styles:["[mat-dialog-title][_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}[mat-dialog-title][_ngcontent-%COMP%] .close-button[_ngcontent-%COMP%]{margin-left:auto}mat-dialog-content[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;min-height:400px}.json-textarea[_ngcontent-%COMP%]{flex:1;min-height:300px;max-height:80vh;padding:1rem;font-family:Monaco,Menlo,Ubuntu Mono,Consolas,monospace;font-size:.875rem;line-height:1.5;background:var(--color-code-bg);color:var(--color-text);border:1px solid var(--color-border);border-radius:4px;resize:vertical;outline:none;transition:border-color .2s}.json-textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.json-textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary);opacity:.6}.error-message[_ngcontent-%COMP%]{padding:.75rem 1rem;border-radius:4px;font-size:.875rem;line-height:1.4;background:#dc26261a;color:#dc2626;border:1px solid rgba(220,38,38,.3)}"],changeDetection:1})};export{Et as E,Ge as G,Qe as Q,Ye as Y,Ze as Z,yt as y,z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {g,ao as V,G,C as Ce,dm as $,df as U,F,a7 as va,X as br,W as Wi,T as TT,b as U$1,z as z$1,a as P,j as jw,k as Cs,n as Lg,J as JC,m as hl,o as aC,u as sI,a8 as em,v as cC,a9 as vC,A as Ag,a3 as ZI,ac as CC,x as xg,a6 as QI,a5 as Dl,q as dC,cH as iC,w as fC,b0 as tm,aa as Sf,ab as _f}from'./main-JTU33H5D.js';import {o as z,k as _t,b as _e,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,f as fn,A as At,Z as Zn,l as Xn,$ as $t,W as Wt,C as Cn,E as En,p as An}from'./chunk-DuXr-yGB.js';function le(l,t){l&1&&(Cs(0,"p",5),JC(1,"Loading\u2026"),hl());}function ae(l,t){if(l&1&&Ag(0,"input",11),l&2){let e=CC(2);xg("value",e.selectedProviderLabel());}}function de(l,t){if(l&1&&(Cs(0,"option",43),JC(1),hl()),l&2){let e=t.$implicit;xg("value",e.id),sI(),tm("",e.name," (",e.apiType,")");}}function me(l,t){if(l&1&&(Cs(0,"select",12)(1,"option",42),JC(2,"Select provider"),hl(),dC(3,de,2,3,"option",43,iC().trackByProvider,true),hl(),ZI()),l&2){let e=CC(2);xg("formControl",e.aiProviderIdControl),QI(),sI(3),fC(e.providers());}}function ce(l,t){if(l&1){let e=vC();Cs(0,"form",7),Lg("ngSubmit",function(){Sf(e);let u=CC();return _f(u.submit())}),Cs(1,"div",8)(2,"label",9),JC(3," Provider "),Cs(4,"span",10),JC(5,"*"),hl()(),aC(6,ae,1,1,"input",11)(7,me,5,1,"select",12),hl(),Cs(8,"div",8)(9,"label",13),JC(10," API name "),Cs(11,"span",10),JC(12,"*"),hl()(),Ag(13,"input",14),ZI(),hl(),Cs(14,"div",8)(15,"label",15),JC(16,"Description"),hl(),Ag(17,"input",16),ZI(),hl(),Cs(18,"div",8)(19,"label",17),JC(20,"Alias"),hl(),Ag(21,"input",18),ZI(),hl(),Cs(22,"div",8)(23,"label",19),JC(24,"Priority"),hl(),Ag(25,"input",20),ZI(),hl(),Cs(26,"div",21)(27,"div",8)(28,"label",22),JC(29,"Temperature"),hl(),Ag(30,"input",23),ZI(),hl(),Cs(31,"div",8)(32,"label",24),JC(33,"Context window"),hl(),Ag(34,"input",25),ZI(),hl()(),Cs(35,"div",8)(36,"label",26),JC(37,"Max completion tokens"),hl(),Ag(38,"input",27),ZI(),hl(),Cs(39,"fieldset",28)(40,"legend",29),JC(41," Pricing "),Cs(42,"span",30),JC(43,"(per million tokens \u2014 leave blank to skip cost monitoring)"),hl()(),Cs(44,"div",21)(45,"div",8)(46,"label",31),JC(47,"Input"),hl(),Ag(48,"input",32),ZI(),hl(),Cs(49,"div",8)(50,"label",33),JC(51,"Output"),hl(),Ag(52,"input",34),ZI(),hl()(),Cs(53,"div",21)(54,"div",8)(55,"label",35),JC(56,"Cache write"),hl(),Ag(57,"input",36),ZI(),hl(),Cs(58,"div",8)(59,"label",37),JC(60,"Cache read"),hl(),Ag(61,"input",38),ZI(),hl()()(),Cs(62,"div",39)(63,"button",40),JC(64),hl(),Cs(65,"button",41),Lg("click",function(){Sf(e);let u=CC();return _f(u.cancel())}),JC(66,"Cancel"),hl()()();}if(l&2){let e=CC();xg("formGroup",e.form),sI(6),cC(e.isEditMode()?6:7),sI(7),xg("formControl",e.apiModelNameControl),QI(),sI(4),xg("formControl",e.descriptionControl),QI(),sI(4),xg("formControl",e.aliasControl),QI(),sI(4),xg("formControl",e.priorityControl),QI(),sI(5),xg("formControl",e.temperatureControl),QI(),sI(4),xg("formControl",e.contextWindowControl),QI(),sI(4),xg("formControl",e.maxCompletionTokensControl),QI(),sI(),xg("formGroup",e.pricingGroup),sI(9),QI(),sI(4),QI(),sI(5),QI(),sI(4),QI(),sI(2),xg("disabled",e.form.invalid||e.isSubmitting()),sI(),Dl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var re=class l{route=g(V);router=g(G);destroyRef=g(Ce);aiModelController=g($);aiProviderController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;providers=F(this.aiProviderController.listAiProvider(this.isPlatformMode?"none":this.namespaceId).pipe(va(()=>br([]))),{initialValue:[]});form=new z({aiProviderId:new _t("",{nonNullable:true,validators:[_e.required]}),apiModelName:new _t("",{nonNullable:true,validators:[_e.required,_e.minLength(1)]}),description:new _t(null),alias:new _t("",{nonNullable:true}),priority:new _t(0,{nonNullable:true}),temperature:new _t(null),contextWindow:new _t(null),maxCompletionTokens:new _t(null),pricing:new z({inputMTokens:new _t(null),outputMTokens:new _t(null),cacheWrite:new _t(null),cacheRead:new _t(null)})});get aiProviderIdControl(){return this.form.controls.aiProviderId}get apiModelNameControl(){return this.form.controls.apiModelName}get descriptionControl(){return this.form.controls.description}get aliasControl(){return this.form.controls.alias}get priorityControl(){return this.form.controls.priority}get temperatureControl(){return this.form.controls.temperature}get contextWindowControl(){return this.form.controls.contextWindow}get maxCompletionTokensControl(){return this.form.controls.maxCompletionTokens}get pricingGroup(){return this.form.controls.pricing}isEditMode=Wi(false);isSubmitting=Wi(false);isLoading=Wi(false);selectedProviderLabel=TT(()=>{let t=this.aiProviderIdControl.value,e=this.providers().find(p=>p.id===t);return e?`${e.name} (${e.apiType})`:t});existingModel=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("modelId");t&&(this.isEditMode.set(true),this.loadModel(t));}loadModel(t){this.isLoading.set(true),this.aiModelController.getByIdAiModel(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.existingModel=e,this.aiProviderIdControl.setValue(e.aiProviderId),this.aiProviderIdControl.disable(),this.apiModelNameControl.setValue(e.apiModelName),this.descriptionControl.setValue(e.description??null),this.aliasControl.setValue(e.alias??""),this.priorityControl.setValue(e.priority??0),this.temperatureControl.setValue(e.temperature??null),this.contextWindowControl.setValue(e.contextWindow??null),this.maxCompletionTokensControl.setValue(e.maxCompletionTokens??null),this.pricingGroup.setValue({inputMTokens:e.pricing?.inputMTokens??null,outputMTokens:e.pricing?.outputMTokens??null,cacheWrite:e.pricing?.cacheWrite??null,cacheRead:e.pricing?.cacheRead??null}),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.form.getRawValue(),e=t.pricing,u=e.inputMTokens!=null||e.outputMTokens!=null||e.cacheWrite!=null||e.cacheRead!=null?{isEmpty:false,inputMTokens:e.inputMTokens??void 0,outputMTokens:e.outputMTokens??void 0,cacheWrite:e.cacheWrite??void 0,cacheRead:e.cacheRead??void 0}:void 0,k=z$1(P({},this.existingModel??{}),{aiProviderId:t.aiProviderId,namespaceId:this.isPlatformMode?void 0:this.existingModel?.namespaceId??this.namespaceId,apiModelName:t.apiModelName.trim(),description:t.description?.trim()||void 0,alias:t.alias.trim()||void 0,priority:t.priority,temperature:t.temperature??void 0,contextWindow:t.contextWindow??void 0,maxCompletionTokens:t.maxCompletionTokens??void 0,pricing:u});(this.isEditMode()?this.aiModelController.updateAiModel(this.existingModel.id??"",k):this.aiModelController.createAiModel(k)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-models"]):this.router.navigate(["/agentos",this.namespaceId,"ai-models"]);}trackByProvider(t,e){return e.id??""}static \u0275fac=function(e){return new(e||l)};static \u0275cmp=jw({type:l,selectors:[["agentos-ai-model-form"]],decls:10,vars:2,consts:[[1,"ai-model-form"],[1,"ai-model-form__header"],["type","button","title","Back to AI models",1,"ai-model-form__back",3,"click"],[1,"ai-model-form__back-icon"],[1,"ai-model-form__title"],[1,"ai-model-form__loading"],[1,"ai-model-form__form",3,"formGroup"],[1,"ai-model-form__form",3,"ngSubmit","formGroup"],[1,"ai-model-form__field"],["for","model-provider",1,"ai-model-form__label"],["aria-hidden","true"],["id","model-provider","type","text","readonly","","tabindex","-1",1,"ai-model-form__input","ai-model-form__input--readonly",3,"value"],["id","model-provider",1,"ai-model-form__select",3,"formControl"],["for","model-api-name",1,"ai-model-form__label"],["id","model-api-name","type","text","placeholder","e.g. gpt-4o, claude-3-5-sonnet-20241022","autocomplete","off",1,"ai-model-form__input","ai-model-form__input--mono",3,"formControl"],["for","model-description",1,"ai-model-form__label"],["id","model-description","type","text","placeholder","Optional \u2014 short description of this model config","autocomplete","off",1,"ai-model-form__input",3,"formControl"],["for","model-alias",1,"ai-model-form__label"],["id","model-alias","type","text","placeholder","e.g. fast, smart \u2014 short identifier used internally","autocomplete","off",1,"ai-model-form__input",3,"formControl"],["for","model-priority",1,"ai-model-form__label"],["id","model-priority","type","number","placeholder","0 \u2014 higher wins when multiple configs share the same alias","min","0","step","1",1,"ai-model-form__input",3,"formControl"],[1,"ai-model-form__row"],["for","model-temperature",1,"ai-model-form__label"],["id","model-temperature","type","number","placeholder","0 \u2013 2","min","0","max","2","step","0.1",1,"ai-model-form__input",3,"formControl"],["for","model-context-window",1,"ai-model-form__label"],["id","model-context-window","type","number","placeholder","e.g. 128000","min","1","step","1",1,"ai-model-form__input",3,"formControl"],["for","model-max-completion-tokens",1,"ai-model-form__label"],["id","model-max-completion-tokens","type","number","placeholder","e.g. 4096","min","1","step","1",1,"ai-model-form__input",3,"formControl"],[1,"ai-model-form__section",3,"formGroup"],[1,"ai-model-form__section-title"],[1,"ai-model-form__section-hint"],["for","pricing-input",1,"ai-model-form__label"],["id","pricing-input","type","number","placeholder","e.g. 2.50","min","0","step","0.01","formControlName","inputMTokens",1,"ai-model-form__input"],["for","pricing-output",1,"ai-model-form__label"],["id","pricing-output","type","number","placeholder","e.g. 10.00","min","0","step","0.01","formControlName","outputMTokens",1,"ai-model-form__input"],["for","pricing-cache-write",1,"ai-model-form__label"],["id","pricing-cache-write","type","number","placeholder","e.g. 3.75","min","0","step","0.01","formControlName","cacheWrite",1,"ai-model-form__input"],["for","pricing-cache-read",1,"ai-model-form__label"],["id","pricing-cache-read","type","number","placeholder","e.g. 0.30","min","0","step","0.01","formControlName","cacheRead",1,"ai-model-form__input"],[1,"ai-model-form__actions"],["type","submit",1,"ai-model-form__btn","ai-model-form__btn--primary",3,"disabled"],["type","button",1,"ai-model-form__btn",3,"click"],["value","","disabled",""],[3,"value"]],template:function(e,p){e&1&&(Cs(0,"div",0)(1,"header",1)(2,"button",2),Lg("click",function(){return p.cancel()}),Cs(3,"span",3),JC(4,"\u2190"),hl(),JC(5," AI models "),hl(),Cs(6,"h1",4),JC(7),hl()(),aC(8,le,2,0,"p",5)(9,ce,67,12,"form",6),hl()),e&2&&(sI(7),em(p.isEditMode()?"Edit AI model":"New AI model"),sI(),cC(p.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,fn,At,Zn,Xn,$t,Wt,Cn,En,An],styles:[".ai-model-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:480px;margin:0 auto;padding:2rem 1rem}.ai-model-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.ai-model-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.ai-model-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.ai-model-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.ai-model-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.ai-model-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.ai-model-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.ai-model-form__row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.ai-model-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.ai-model-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.ai-model-form__input[_ngcontent-%COMP%], .ai-model-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.ai-model-form__input[_ngcontent-%COMP%]:focus, .ai-model-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.ai-model-form__input[_ngcontent-%COMP%]::placeholder, .ai-model-form__select[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.ai-model-form__input--mono[_ngcontent-%COMP%]{font-family:monospace}.ai-model-form__section[_ngcontent-%COMP%]{border:1px solid var(--color-divider);border-radius:0;padding:1rem;margin:0;display:flex;flex-direction:column;gap:1rem}.ai-model-form__section-title[_ngcontent-%COMP%]{font-size:.875rem;font-weight:600;color:var(--color-text);padding:0 .25rem}.ai-model-form__section-hint[_ngcontent-%COMP%]{font-weight:400;color:var(--color-text-secondary);font-size:.8125rem}.ai-model-form__input--readonly[_ngcontent-%COMP%]{color:var(--color-text-secondary);cursor:default;background:var(--color-surface-muted, rgba(0, 0, 0, .03))}.ai-model-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.ai-model-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.ai-model-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.ai-model-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.ai-model-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.ai-model-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}"]})};export{re as AiModelFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {A,k as kt,b as bt}from'./chunk-D1v8TfDX.js';import {S as St}from'./chunk-CPlR5wjp.js';import {E as Et,y as yt$1,G as Ge}from'./chunk-BKBTovXz.js';import {g,G,P,U,E as N,p as pe$1,H as c,C as Ce$1,W as Wi,F as F$1,T as TT,b as U$1,j as jw,h as hr,e as pr,k as Cs,J as JC,m as hl,n as kg,o as aC,q as dC,t as sI,_ as _g,u as cC,v as fC,w as zg,S as Sg,r as re,ca as _e$1,K as x,an as ue$1,ap as zy,l as le$1,V,M as Mg,a9 as vC,aa as Cf,ac as CC,ab as Tf,a8 as Kg,a5 as Dl}from'./main-P72KGKGP.js';import'./chunk-CtVgyQBm.js';import'./chunk-B1VIKLB-.js';import'./chunk-NNu6xUAE.js';import'./chunk-DAxRjiEx.js';import {y as yt,w as wt}from'./chunk-BLF3w_iN.js';var R=class n{threadState=g(U);codayService=g(Ge);threadList=F$1(this.threadState.threadList$,{initialValue:[]});selectedThread=F$1(this.threadState.selectedThread$,{initialValue:null});isThinking=F$1(this.codayService.isThinking$,{initialValue:false});inviteEvent=F$1(this.codayService.currentInviteEvent$.pipe(re(t=>t?.invite===_e$1?null:t)),{initialValue:null});tasks=TT(()=>{let t=this.threadList(),e=this.selectedThread(),r=this.isThinking(),o=this.inviteEvent();return t.filter(i=>!i.parentThreadId).map(i=>{let m=!!e&&i.id===e.id;return {id:i.id,name:i.name,summary:i.summary,modifiedDate:i.modifiedDate,starring:i.starring??[],users:i.users??[],status:this.deriveStatus(i,m,r,!!o),isActive:m,worktreeProject:i.worktreeProject}}).sort((i,m)=>{let q=kt[i.status]-kt[m.status];return q!==0?q:i.modifiedDate>m.modifiedDate?-1:1})});deriveStatus(t,e,r,o){let i=Date.now()-new Date(t.modifiedDate).getTime();return t.closedByUser?"done":t.pendingInvite?"waiting-you":e?r?"in-progress":"paused":i<bt?"in-progress":"paused"}static \u0275fac=function(e){return new(e||n)};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};var F=class n{projectState=g(P);threadState=g(U);destroy$=new ue$1;eventSource=null;currentProject=null;constructor(){this.projectState.selectedProject$.pipe(zy(this.destroy$)).subscribe(t=>{let e=t?.name??null;e!==this.currentProject&&(this.disconnect(),e&&this.connect(e));});}connect(t,e=5e3){this.currentProject=t;let r=`/api/projects/${encodeURIComponent(t)}/event-stream`;console.log(`[PROJECT_SSE] Connecting to ${r}`),this.eventSource=new EventSource(r),this.eventSource.onmessage=o=>{try{let i=JSON.parse(o.data),m=le$1(i);if(!m)return;m instanceof V&&(console.log("[PROJECT_SSE] ThreadUpdateEvent \u2014 refreshing thread list"),this.threadState.refreshThreadList());}catch(i){console.warn("[PROJECT_SSE] Failed to parse event:",i);}},this.eventSource.onerror=()=>{this.eventSource?.readyState===EventSource.CLOSED&&(console.warn(`[PROJECT_SSE] Connection closed for ${t}, reconnecting in ${e}ms`),this.eventSource=null,setTimeout(()=>{this.currentProject===t&&this.connect(t,Math.min(e*2,6e4));},e));};}disconnect(){this.eventSource&&(this.eventSource.close(),this.eventSource=null,console.log(`[PROJECT_SSE] Disconnected from project ${this.currentProject}`)),this.currentProject=null;}ngOnDestroy(){this.disconnect(),this.destroy$.next(),this.destroy$.complete();}static \u0275fac=function(e){return new(e||n)};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};var ce=(n,t)=>t.key,de=(n,t)=>t.status,le=(n,t)=>t.id;function pe(n,t){n&1&&Mg(0,"mat-spinner",6);}function me(n,t){n&1&&(Cs(0,"mat-icon"),JC(1,"add"),hl());}function ue(n,t){if(n&1&&(Cs(0,"span",16),JC(1),hl()),n&2){let e=CC().$implicit,r=CC();sI(),Kg(r.filterCounts()[e.key]);}}function ge(n,t){if(n&1){let e=vC();Cs(0,"button",15),kg("click",function(){let o=Cf(e).$implicit,i=CC();return Tf(i.setFilter(o.key))}),Cs(1,"mat-icon",10),JC(2),hl(),Cs(3,"span"),JC(4),hl(),aC(5,ue,2,1,"span",16),hl();}if(n&2){let e=t.$implicit,r=CC();zg("active",r.activeFilter()===e.key),Sg("aria-selected",r.activeFilter()===e.key),sI(2),Kg(e.icon),sI(2),Kg(e.label),sI(),cC(r.filterCounts()[e.key]>0?5:-1);}}function _e(n,t){n&1&&(Cs(0,"div",12),Mg(1,"mat-spinner",17),Cs(2,"p"),JC(3,"Loading tasks\u2026"),hl()());}function fe(n,t){if(n&1){let e=vC();Cs(0,"p"),JC(1,"No tasks yet. Start your first one!"),hl(),Cs(2,"button",19),kg("click",function(){Cf(e);let o=CC(2);return Tf(o.createTask())}),Cs(3,"mat-icon"),JC(4,"add"),hl(),JC(5," New Task "),hl();}}function he(n,t){n&1&&(Cs(0,"p"),JC(1,"No tasks in this category."),hl());}function ke(n,t){if(n&1&&(Cs(0,"div",13)(1,"mat-icon",18),JC(2,"rocket_launch"),hl(),aC(3,fe,6,0)(4,he,2,0,"p"),hl()),n&2){let e=CC();sI(3),cC(e.activeFilter()==="all"?3:4);}}function ve(n,t){if(n&1){let e=vC();Cs(0,"app-task-card",25),kg("stopRequested",function(o){Cf(e);let i=CC(3);return Tf(i.onStopRequested(o))})("deleteRequested",function(o){Cf(e);let i=CC(3);return Tf(i.onDeleteRequested(o))})("starToggled",function(o){Cf(e);let i=CC(3);return Tf(i.onStarToggled(o))})("markDoneRequested",function(o){Cf(e);let i=CC(3);return Tf(i.onMarkDoneRequested(o))})("markActiveRequested",function(o){Cf(e);let i=CC(3);return Tf(i.onMarkActiveRequested(o))}),hl();}if(n&2){let e=t.$implicit;_g("task",e);}}function Ce(n,t){if(n&1&&(Cs(0,"section",20)(1,"h2",21)(2,"mat-icon",22),JC(3),hl(),JC(4),Cs(5,"span",23),JC(6),hl()(),Cs(7,"div",14),dC(8,ve,1,1,"app-task-card",24,le),hl()()),n&2){let e=t.$implicit;sI(3),Kg(e.icon),sI(),Dl(" ",e.label," "),sI(2),Kg(e.tasks.length),sI(2),fC(e.tasks);}}function be(n,t){if(n&1&&dC(0,Ce,10,3,"section",20,de),n&2){let e=CC();fC(e.taskGroups());}}function ye(n,t){if(n&1){let e=vC();Cs(0,"app-task-card",25),kg("stopRequested",function(o){Cf(e);let i=CC(2);return Tf(i.onStopRequested(o))})("deleteRequested",function(o){Cf(e);let i=CC(2);return Tf(i.onDeleteRequested(o))})("starToggled",function(o){Cf(e);let i=CC(2);return Tf(i.onStarToggled(o))})("markDoneRequested",function(o){Cf(e);let i=CC(2);return Tf(i.onMarkDoneRequested(o))})("markActiveRequested",function(o){Cf(e);let i=CC(2);return Tf(i.onMarkActiveRequested(o))}),hl();}if(n&2){let e=t.$implicit;_g("task",e);}}function xe(n,t){if(n&1&&(Cs(0,"div",14),dC(1,ye,1,1,"app-task-card",24,le),hl()),n&2){let e=CC();sI(),fC(e.filteredTasks());}}var Te=[{key:"all",label:"All",icon:"grid_view"},{key:"waiting-you",label:"Waiting for you",icon:"mark_unread_chat_alt"},{key:"in-progress",label:"In progress",icon:"pending"},{key:"paused",label:"Paused",icon:"pause_circle"},{key:"done",label:"Done",icon:"check_circle"}],se=class n{router=g(G);projectState=g(P);threadState=g(U);threadApi=g(N);taskStatus=g(R);userService=g(pe$1);projectApi=g(c);destroyRef=g(Ce$1);_projectEventStream=g(F);filters=Te;activeFilter=Wi("all");starredOnly=Wi(false);isCreating=Wi(false);isLoadingList=F$1(this.threadState.isLoadingThreadList$,{initialValue:false});username=F$1(this.userService.username$,{initialValue:null});allTasks=this.taskStatus.tasks;filteredTasks=TT(()=>{let t=this.activeFilter(),e=this.username(),r=this.allTasks();return this.starredOnly()&&e&&(r=r.filter(o=>o.starring.includes(e))),t==="all"?r:r.filter(o=>o.status===t)});filterCounts=TT(()=>{let t=this.username(),e=this.allTasks();return this.starredOnly()&&t&&(e=e.filter(r=>r.starring.includes(t))),{all:e.length,"waiting-you":e.filter(r=>r.status==="waiting-you").length,"in-progress":e.filter(r=>r.status==="in-progress").length,paused:e.filter(r=>r.status==="paused").length,done:e.filter(r=>r.status==="done").length}});taskGroups=TT(()=>{let t=this.username(),e=this.allTasks();this.starredOnly()&&t&&(e=e.filter(o=>o.starring.includes(t)));let r=[{status:"waiting-you",label:"Waiting for you",icon:"mark_unread_chat_alt",tasks:[]},{status:"in-progress",label:"In progress",icon:"pending",tasks:[]},{status:"done",label:"Done",icon:"check_circle",tasks:[]},{status:"paused",label:"Paused",icon:"pause_circle",tasks:[]},{status:"error",label:"Error",icon:"error",tasks:[]}];for(let o of e){let i=r.find(m=>m.status===o.status);i&&i.tasks.push(o);}return r.filter(o=>o.tasks.length>0)});ngOnInit(){this.userService.fetchCurrentUser().pipe(U$1(this.destroyRef)).subscribe({error:t=>console.warn("[TASK-CONTROL] Could not fetch user:",t)});}setFilter(t){this.activeFilter.set(t);}toggleStarredFilter(){this.starredOnly.update(t=>!t);}createTask(){let t=this.projectState.getSelectedProjectId();!t||this.isCreating()||(this.isCreating.set(true),this.threadApi.createThread().pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.isCreating.set(false),this.router.navigate(["project",t,"thread",e.thread.id]);},error:e=>{console.error("[TASK-CONTROL] Failed to create thread:",e),this.isCreating.set(false);}}));}onStopRequested(t){this.threadApi.stopThread(t).pipe(U$1(this.destroyRef)).subscribe({error:e=>console.error("[TASK-CONTROL] Failed to stop thread:",e)});}onDeleteRequested(t){this.threadApi.deleteThread(t).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.threadState.refreshThreadList(),error:e=>console.error("[TASK-CONTROL] Failed to delete thread:",e)});}onStarToggled(t){let e=this.username();if(!e)return;let r=this.allTasks().find(m=>m.id===t);if(!r)return;let o=r.starring.includes(e),i=o?this.threadApi.unstarThread(t):this.threadApi.starThread(t);this.threadState.updateStarLocal(t,!o,e),i.pipe(U$1(this.destroyRef)).subscribe({error:m=>{console.error("[TASK-CONTROL] Failed to toggle star:",m),this.threadState.refreshThreadList();}});}onMarkDoneRequested(t){let e=this.projectState.getSelectedProjectId();e&&this.projectApi.markThreadDone(e,t).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.threadState.refreshThreadList(),error:r=>console.error("[TASK-CONTROL] Failed to mark task as done:",r)});}onMarkActiveRequested(t){let e=this.projectState.getSelectedProjectId();e&&this.projectApi.markThreadActive(e,t).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.threadState.refreshThreadList(),error:r=>console.error("[TASK-CONTROL] Failed to mark task as active:",r)});}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=jw({type:n,selectors:[["app-task-control"]],decls:25,vars:6,consts:[[1,"task-control"],[1,"tc-header"],[1,"tc-title-row"],[1,"tc-title"],[1,"title-icon"],["mat-flat-button","","aria-label","Start a new task",1,"new-task-btn",3,"click","disabled"],["diameter","16"],["role","tablist","aria-label","Filter tasks",1,"tc-filters"],["role","tab",1,"filter-chip",3,"active"],["role","switch","aria-label","Show starred tasks only",1,"filter-chip","starred-filter",3,"click"],[1,"filter-icon"],[1,"tc-grid-wrapper"],[1,"tc-loading"],[1,"tc-empty"],[1,"tc-grid"],["role","tab",1,"filter-chip",3,"click"],[1,"filter-badge"],["diameter","40"],[1,"empty-icon"],["mat-flat-button","",1,"new-task-btn",3,"click"],[1,"tc-group"],[1,"tc-group-title"],[1,"group-icon"],[1,"group-count"],[3,"task"],[3,"stopRequested","deleteRequested","starToggled","markDoneRequested","markActiveRequested","task"]],template:function(e,r){e&1&&(Cs(0,"app-sidenav")(1,"div",0)(2,"header",1)(3,"div",2)(4,"h1",3)(5,"mat-icon",4),JC(6,"rocket_launch"),hl(),JC(7," Task Control "),hl(),Cs(8,"button",5),kg("click",function(){return r.createTask()}),aC(9,pe,1,0,"mat-spinner",6)(10,me,2,0,"mat-icon"),JC(11," New Task "),hl()(),Cs(12,"nav",7),dC(13,ge,6,6,"button",8,ce),Cs(15,"button",9),kg("click",function(){return r.toggleStarredFilter()}),Cs(16,"mat-icon",10),JC(17,"star"),hl(),Cs(18,"span"),JC(19,"Starred"),hl()()()(),Cs(20,"main",11),aC(21,_e,4,0,"div",12)(22,ke,5,1,"div",13)(23,be,2,0)(24,xe,3,0,"div",14),hl()()()),e&2&&(sI(8),_g("disabled",r.isCreating()),sI(),cC(r.isCreating()?9:10),sI(4),fC(r.filters),sI(2),zg("active",r.starredOnly()),Sg("aria-checked",r.starredOnly()),sI(6),cC(r.isLoadingList()?21:r.filteredTasks().length===0?22:r.activeFilter()==="all"?23:24));},dependencies:[A,St,yt,wt,hr,pr,Et,yt$1],styles:[".glass-panel[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow)}.glass-interactive[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);transition:all .3s cubic-bezier(.4,0,.2,1)}.glass-interactive[_ngcontent-%COMP%]:hover{transform:translateY(-2px);box-shadow:0 12px 40px #00000026}.glass-interactive[_ngcontent-%COMP%]:active{transform:translateY(0)}.glass-card[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);border-radius:20px;padding:1.5rem}.glass-button[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);transition:all .3s cubic-bezier(.4,0,.2,1)}.glass-button[_ngcontent-%COMP%]:hover{transform:translateY(-2px);box-shadow:0 12px 40px #00000026}.glass-button[_ngcontent-%COMP%]:active{transform:translateY(0)}.glass-button[_ngcontent-%COMP%]{border-radius:12px;padding:.75rem 1.5rem;font-weight:600;cursor:pointer}.glass-button[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed;transform:none}.glass-button[_ngcontent-%COMP%]:disabled:hover{transform:none}.smooth-theme-transition[_ngcontent-%COMP%]{transition:background .3s ease,color .3s ease,border-color .3s ease,box-shadow .3s ease}[_nghost-%COMP%]{display:flex;height:100vh;width:100%;overflow:hidden}.task-control[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%;overflow:hidden;padding:1.5rem;gap:1.25rem;box-sizing:border-box}.tc-header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;flex-shrink:0}.tc-title-row[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:1rem}.tc-title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text)}.tc-title[_ngcontent-%COMP%] .title-icon[_ngcontent-%COMP%]{font-size:1.5rem;width:1.5rem;height:1.5rem;color:var(--color-primary)}.new-task-btn[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;background:var(--color-primary);color:var(--color-text-inverse);border-radius:12px;font-weight:600;padding:0 1rem;height:36px;flex-shrink:0}.new-task-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.1rem;width:1.1rem;height:1.1rem}.new-task-btn[_ngcontent-%COMP%] mat-spinner[_ngcontent-%COMP%]{display:inline-block}.tc-filters[_ngcontent-%COMP%]{display:flex;gap:.5rem;flex-wrap:wrap}.filter-chip[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);display:flex;align-items:center;gap:.375rem;padding:.375rem .875rem;border-radius:100px;font-size:.8rem;font-weight:500;color:var(--color-text-secondary);cursor:pointer;border:1px solid var(--color-border);transition:background .15s ease,color .15s ease,border-color .15s ease;white-space:nowrap}.filter-chip[_ngcontent-%COMP%] .filter-icon[_ngcontent-%COMP%]{font-size:.9rem;width:.9rem;height:.9rem}.filter-chip[_ngcontent-%COMP%] .filter-badge[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-text-inverse);border-radius:100px;padding:0 .375rem;font-size:.7rem;font-weight:700;min-width:18px;text-align:center;line-height:18px}.filter-chip.active[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-text-inverse);border-color:var(--color-primary)}.filter-chip.active[_ngcontent-%COMP%] .filter-icon[_ngcontent-%COMP%]{color:var(--color-text-inverse)}.filter-chip.active[_ngcontent-%COMP%] .filter-badge[_ngcontent-%COMP%]{background:#ffffff4d;color:var(--color-text-inverse)}.filter-chip[_ngcontent-%COMP%]:hover:not(.active){background:var(--color-bg-hover);color:var(--color-text)}.starred-filter.active[_ngcontent-%COMP%]{background:#f5a62326;border-color:#f5a623;color:#f5a623}.starred-filter.active[_ngcontent-%COMP%] .filter-icon[_ngcontent-%COMP%]{color:#f5a623}.tc-group[_ngcontent-%COMP%]{margin-bottom:1.5rem}.tc-group[_ngcontent-%COMP%]:last-child{margin-bottom:0}.tc-group-title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin:0 0 .75rem;font-size:.85rem;font-weight:600;color:var(--color-text-secondary);text-transform:uppercase;letter-spacing:.05em}.tc-group-title[_ngcontent-%COMP%] .group-icon[_ngcontent-%COMP%]{font-size:1rem;width:1rem;height:1rem}.tc-group-title[_ngcontent-%COMP%] .group-count[_ngcontent-%COMP%]{background:var(--color-bg-hover);border-radius:100px;padding:0 .375rem;font-size:.75rem;font-weight:700;min-width:18px;text-align:center;line-height:18px}.tc-grid-wrapper[_ngcontent-%COMP%]{flex:1;overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--color-border) transparent}.tc-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:1rem;padding-bottom:1rem}@media(max-width:600px){.tc-grid[_ngcontent-%COMP%]{grid-template-columns:1fr}}.tc-loading[_ngcontent-%COMP%], .tc-empty[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1rem;height:100%;min-height:240px;color:var(--color-text-secondary);text-align:center}.tc-loading[_ngcontent-%COMP%] p[_ngcontent-%COMP%], .tc-empty[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;font-size:.95rem}.empty-icon[_ngcontent-%COMP%]{font-size:3rem;width:3rem;height:3rem;opacity:.3}"]})};export{se as TaskControlComponent};
|
|
1
|
+
import {A,k as kt,b as bt}from'./chunk-BHb31ndI.js';import {S as St}from'./chunk-CIfgFQUQ.js';import {E as Et,y as yt$1,G as Ge}from'./chunk-B52iVZ-n.js';import {g,G,P,U,I as N,p as pe$1,K as c,C as Ce$1,W as Wi,F as F$1,T as TT,b as U$1,j as jw,h as hr,e as pr,k as Cs,J as JC,m as hl,n as Lg,o as aC,q as dC,u as sI,x as xg,v as cC,w as fC,y as qg,N as Ng,r as re,ca as _e$1,Y as x,an as ue$1,ap as _d,l as le$1,V,A as Ag,a9 as vC,aa as Sf,ac as CC,ab as _f,a8 as em,a5 as Dl}from'./main-JTU33H5D.js';import'./chunk-DCx8SlS-.js';import'./chunk-I8YepFsn.js';import'./chunk-4XIlyOr9.js';import'./chunk-DK1hp0WW.js';import {y as yt,w as wt}from'./chunk-DuXr-yGB.js';var R=class n{threadState=g(U);codayService=g(Ge);threadList=F$1(this.threadState.threadList$,{initialValue:[]});selectedThread=F$1(this.threadState.selectedThread$,{initialValue:null});isThinking=F$1(this.codayService.isThinking$,{initialValue:false});inviteEvent=F$1(this.codayService.currentInviteEvent$.pipe(re(t=>t?.invite===_e$1?null:t)),{initialValue:null});tasks=TT(()=>{let t=this.threadList(),e=this.selectedThread(),r=this.isThinking(),o=this.inviteEvent();return t.filter(i=>!i.parentThreadId).map(i=>{let m=!!e&&i.id===e.id;return {id:i.id,name:i.name,summary:i.summary,modifiedDate:i.modifiedDate,starring:i.starring??[],users:i.users??[],status:this.deriveStatus(i,m,r,!!o),isActive:m,worktreeProject:i.worktreeProject}}).sort((i,m)=>{let q=kt[i.status]-kt[m.status];return q!==0?q:i.modifiedDate>m.modifiedDate?-1:1})});deriveStatus(t,e,r,o){let i=Date.now()-new Date(t.modifiedDate).getTime();return t.closedByUser?"done":t.pendingInvite?"waiting-you":e?r?"in-progress":"paused":i<bt?"in-progress":"paused"}static \u0275fac=function(e){return new(e||n)};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};var F=class n{projectState=g(P);threadState=g(U);destroy$=new ue$1;eventSource=null;currentProject=null;constructor(){this.projectState.selectedProject$.pipe(_d(this.destroy$)).subscribe(t=>{let e=t?.name??null;e!==this.currentProject&&(this.disconnect(),e&&this.connect(e));});}connect(t,e=5e3){this.currentProject=t;let r=`/api/projects/${encodeURIComponent(t)}/event-stream`;console.log(`[PROJECT_SSE] Connecting to ${r}`),this.eventSource=new EventSource(r),this.eventSource.onmessage=o=>{try{let i=JSON.parse(o.data),m=le$1(i);if(!m)return;m instanceof V&&(console.log("[PROJECT_SSE] ThreadUpdateEvent \u2014 refreshing thread list"),this.threadState.refreshThreadList());}catch(i){console.warn("[PROJECT_SSE] Failed to parse event:",i);}},this.eventSource.onerror=()=>{this.eventSource?.readyState===EventSource.CLOSED&&(console.warn(`[PROJECT_SSE] Connection closed for ${t}, reconnecting in ${e}ms`),this.eventSource=null,setTimeout(()=>{this.currentProject===t&&this.connect(t,Math.min(e*2,6e4));},e));};}disconnect(){this.eventSource&&(this.eventSource.close(),this.eventSource=null,console.log(`[PROJECT_SSE] Disconnected from project ${this.currentProject}`)),this.currentProject=null;}ngOnDestroy(){this.disconnect(),this.destroy$.next(),this.destroy$.complete();}static \u0275fac=function(e){return new(e||n)};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};var ce=(n,t)=>t.key,de=(n,t)=>t.status,le=(n,t)=>t.id;function pe(n,t){n&1&&Ag(0,"mat-spinner",6);}function me(n,t){n&1&&(Cs(0,"mat-icon"),JC(1,"add"),hl());}function ue(n,t){if(n&1&&(Cs(0,"span",16),JC(1),hl()),n&2){let e=CC().$implicit,r=CC();sI(),em(r.filterCounts()[e.key]);}}function ge(n,t){if(n&1){let e=vC();Cs(0,"button",15),Lg("click",function(){let o=Sf(e).$implicit,i=CC();return _f(i.setFilter(o.key))}),Cs(1,"mat-icon",10),JC(2),hl(),Cs(3,"span"),JC(4),hl(),aC(5,ue,2,1,"span",16),hl();}if(n&2){let e=t.$implicit,r=CC();qg("active",r.activeFilter()===e.key),Ng("aria-selected",r.activeFilter()===e.key),sI(2),em(e.icon),sI(2),em(e.label),sI(),cC(r.filterCounts()[e.key]>0?5:-1);}}function _e(n,t){n&1&&(Cs(0,"div",12),Ag(1,"mat-spinner",17),Cs(2,"p"),JC(3,"Loading tasks\u2026"),hl()());}function fe(n,t){if(n&1){let e=vC();Cs(0,"p"),JC(1,"No tasks yet. Start your first one!"),hl(),Cs(2,"button",19),Lg("click",function(){Sf(e);let o=CC(2);return _f(o.createTask())}),Cs(3,"mat-icon"),JC(4,"add"),hl(),JC(5," New Task "),hl();}}function he(n,t){n&1&&(Cs(0,"p"),JC(1,"No tasks in this category."),hl());}function ke(n,t){if(n&1&&(Cs(0,"div",13)(1,"mat-icon",18),JC(2,"rocket_launch"),hl(),aC(3,fe,6,0)(4,he,2,0,"p"),hl()),n&2){let e=CC();sI(3),cC(e.activeFilter()==="all"?3:4);}}function ve(n,t){if(n&1){let e=vC();Cs(0,"app-task-card",25),Lg("stopRequested",function(o){Sf(e);let i=CC(3);return _f(i.onStopRequested(o))})("deleteRequested",function(o){Sf(e);let i=CC(3);return _f(i.onDeleteRequested(o))})("starToggled",function(o){Sf(e);let i=CC(3);return _f(i.onStarToggled(o))})("markDoneRequested",function(o){Sf(e);let i=CC(3);return _f(i.onMarkDoneRequested(o))})("markActiveRequested",function(o){Sf(e);let i=CC(3);return _f(i.onMarkActiveRequested(o))}),hl();}if(n&2){let e=t.$implicit;xg("task",e);}}function Ce(n,t){if(n&1&&(Cs(0,"section",20)(1,"h2",21)(2,"mat-icon",22),JC(3),hl(),JC(4),Cs(5,"span",23),JC(6),hl()(),Cs(7,"div",14),dC(8,ve,1,1,"app-task-card",24,le),hl()()),n&2){let e=t.$implicit;sI(3),em(e.icon),sI(),Dl(" ",e.label," "),sI(2),em(e.tasks.length),sI(2),fC(e.tasks);}}function be(n,t){if(n&1&&dC(0,Ce,10,3,"section",20,de),n&2){let e=CC();fC(e.taskGroups());}}function ye(n,t){if(n&1){let e=vC();Cs(0,"app-task-card",25),Lg("stopRequested",function(o){Sf(e);let i=CC(2);return _f(i.onStopRequested(o))})("deleteRequested",function(o){Sf(e);let i=CC(2);return _f(i.onDeleteRequested(o))})("starToggled",function(o){Sf(e);let i=CC(2);return _f(i.onStarToggled(o))})("markDoneRequested",function(o){Sf(e);let i=CC(2);return _f(i.onMarkDoneRequested(o))})("markActiveRequested",function(o){Sf(e);let i=CC(2);return _f(i.onMarkActiveRequested(o))}),hl();}if(n&2){let e=t.$implicit;xg("task",e);}}function xe(n,t){if(n&1&&(Cs(0,"div",14),dC(1,ye,1,1,"app-task-card",24,le),hl()),n&2){let e=CC();sI(),fC(e.filteredTasks());}}var Te=[{key:"all",label:"All",icon:"grid_view"},{key:"waiting-you",label:"Waiting for you",icon:"mark_unread_chat_alt"},{key:"in-progress",label:"In progress",icon:"pending"},{key:"paused",label:"Paused",icon:"pause_circle"},{key:"done",label:"Done",icon:"check_circle"}],se=class n{router=g(G);projectState=g(P);threadState=g(U);threadApi=g(N);taskStatus=g(R);userService=g(pe$1);projectApi=g(c);destroyRef=g(Ce$1);_projectEventStream=g(F);filters=Te;activeFilter=Wi("all");starredOnly=Wi(false);isCreating=Wi(false);isLoadingList=F$1(this.threadState.isLoadingThreadList$,{initialValue:false});username=F$1(this.userService.username$,{initialValue:null});allTasks=this.taskStatus.tasks;filteredTasks=TT(()=>{let t=this.activeFilter(),e=this.username(),r=this.allTasks();return this.starredOnly()&&e&&(r=r.filter(o=>o.starring.includes(e))),t==="all"?r:r.filter(o=>o.status===t)});filterCounts=TT(()=>{let t=this.username(),e=this.allTasks();return this.starredOnly()&&t&&(e=e.filter(r=>r.starring.includes(t))),{all:e.length,"waiting-you":e.filter(r=>r.status==="waiting-you").length,"in-progress":e.filter(r=>r.status==="in-progress").length,paused:e.filter(r=>r.status==="paused").length,done:e.filter(r=>r.status==="done").length}});taskGroups=TT(()=>{let t=this.username(),e=this.allTasks();this.starredOnly()&&t&&(e=e.filter(o=>o.starring.includes(t)));let r=[{status:"waiting-you",label:"Waiting for you",icon:"mark_unread_chat_alt",tasks:[]},{status:"in-progress",label:"In progress",icon:"pending",tasks:[]},{status:"done",label:"Done",icon:"check_circle",tasks:[]},{status:"paused",label:"Paused",icon:"pause_circle",tasks:[]},{status:"error",label:"Error",icon:"error",tasks:[]}];for(let o of e){let i=r.find(m=>m.status===o.status);i&&i.tasks.push(o);}return r.filter(o=>o.tasks.length>0)});ngOnInit(){this.userService.fetchCurrentUser().pipe(U$1(this.destroyRef)).subscribe({error:t=>console.warn("[TASK-CONTROL] Could not fetch user:",t)});}setFilter(t){this.activeFilter.set(t);}toggleStarredFilter(){this.starredOnly.update(t=>!t);}createTask(){let t=this.projectState.getSelectedProjectId();!t||this.isCreating()||(this.isCreating.set(true),this.threadApi.createThread().pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.isCreating.set(false),this.router.navigate(["project",t,"thread",e.thread.id]);},error:e=>{console.error("[TASK-CONTROL] Failed to create thread:",e),this.isCreating.set(false);}}));}onStopRequested(t){this.threadApi.stopThread(t).pipe(U$1(this.destroyRef)).subscribe({error:e=>console.error("[TASK-CONTROL] Failed to stop thread:",e)});}onDeleteRequested(t){this.threadApi.deleteThread(t).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.threadState.refreshThreadList(),error:e=>console.error("[TASK-CONTROL] Failed to delete thread:",e)});}onStarToggled(t){let e=this.username();if(!e)return;let r=this.allTasks().find(m=>m.id===t);if(!r)return;let o=r.starring.includes(e),i=o?this.threadApi.unstarThread(t):this.threadApi.starThread(t);this.threadState.updateStarLocal(t,!o,e),i.pipe(U$1(this.destroyRef)).subscribe({error:m=>{console.error("[TASK-CONTROL] Failed to toggle star:",m),this.threadState.refreshThreadList();}});}onMarkDoneRequested(t){let e=this.projectState.getSelectedProjectId();e&&this.projectApi.markThreadDone(e,t).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.threadState.refreshThreadList(),error:r=>console.error("[TASK-CONTROL] Failed to mark task as done:",r)});}onMarkActiveRequested(t){let e=this.projectState.getSelectedProjectId();e&&this.projectApi.markThreadActive(e,t).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.threadState.refreshThreadList(),error:r=>console.error("[TASK-CONTROL] Failed to mark task as active:",r)});}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=jw({type:n,selectors:[["app-task-control"]],decls:25,vars:6,consts:[[1,"task-control"],[1,"tc-header"],[1,"tc-title-row"],[1,"tc-title"],[1,"title-icon"],["mat-flat-button","","aria-label","Start a new task",1,"new-task-btn",3,"click","disabled"],["diameter","16"],["role","tablist","aria-label","Filter tasks",1,"tc-filters"],["role","tab",1,"filter-chip",3,"active"],["role","switch","aria-label","Show starred tasks only",1,"filter-chip","starred-filter",3,"click"],[1,"filter-icon"],[1,"tc-grid-wrapper"],[1,"tc-loading"],[1,"tc-empty"],[1,"tc-grid"],["role","tab",1,"filter-chip",3,"click"],[1,"filter-badge"],["diameter","40"],[1,"empty-icon"],["mat-flat-button","",1,"new-task-btn",3,"click"],[1,"tc-group"],[1,"tc-group-title"],[1,"group-icon"],[1,"group-count"],[3,"task"],[3,"stopRequested","deleteRequested","starToggled","markDoneRequested","markActiveRequested","task"]],template:function(e,r){e&1&&(Cs(0,"app-sidenav")(1,"div",0)(2,"header",1)(3,"div",2)(4,"h1",3)(5,"mat-icon",4),JC(6,"rocket_launch"),hl(),JC(7," Task Control "),hl(),Cs(8,"button",5),Lg("click",function(){return r.createTask()}),aC(9,pe,1,0,"mat-spinner",6)(10,me,2,0,"mat-icon"),JC(11," New Task "),hl()(),Cs(12,"nav",7),dC(13,ge,6,6,"button",8,ce),Cs(15,"button",9),Lg("click",function(){return r.toggleStarredFilter()}),Cs(16,"mat-icon",10),JC(17,"star"),hl(),Cs(18,"span"),JC(19,"Starred"),hl()()()(),Cs(20,"main",11),aC(21,_e,4,0,"div",12)(22,ke,5,1,"div",13)(23,be,2,0)(24,xe,3,0,"div",14),hl()()()),e&2&&(sI(8),xg("disabled",r.isCreating()),sI(),cC(r.isCreating()?9:10),sI(4),fC(r.filters),sI(2),qg("active",r.starredOnly()),Ng("aria-checked",r.starredOnly()),sI(6),cC(r.isLoadingList()?21:r.filteredTasks().length===0?22:r.activeFilter()==="all"?23:24));},dependencies:[A,St,yt,wt,hr,pr,Et,yt$1],styles:[".glass-panel[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow)}.glass-interactive[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);transition:all .3s cubic-bezier(.4,0,.2,1)}.glass-interactive[_ngcontent-%COMP%]:hover{transform:translateY(-2px);box-shadow:0 12px 40px #00000026}.glass-interactive[_ngcontent-%COMP%]:active{transform:translateY(0)}.glass-card[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);border-radius:20px;padding:1.5rem}.glass-button[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);transition:all .3s cubic-bezier(.4,0,.2,1)}.glass-button[_ngcontent-%COMP%]:hover{transform:translateY(-2px);box-shadow:0 12px 40px #00000026}.glass-button[_ngcontent-%COMP%]:active{transform:translateY(0)}.glass-button[_ngcontent-%COMP%]{border-radius:12px;padding:.75rem 1.5rem;font-weight:600;cursor:pointer}.glass-button[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed;transform:none}.glass-button[_ngcontent-%COMP%]:disabled:hover{transform:none}.smooth-theme-transition[_ngcontent-%COMP%]{transition:background .3s ease,color .3s ease,border-color .3s ease,box-shadow .3s ease}[_nghost-%COMP%]{display:flex;height:100vh;width:100%;overflow:hidden}.task-control[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%;overflow:hidden;padding:1.5rem;gap:1.25rem;box-sizing:border-box}.tc-header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;flex-shrink:0}.tc-title-row[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:1rem}.tc-title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text)}.tc-title[_ngcontent-%COMP%] .title-icon[_ngcontent-%COMP%]{font-size:1.5rem;width:1.5rem;height:1.5rem;color:var(--color-primary)}.new-task-btn[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;background:var(--color-primary);color:var(--color-text-inverse);border-radius:12px;font-weight:600;padding:0 1rem;height:36px;flex-shrink:0}.new-task-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.1rem;width:1.1rem;height:1.1rem}.new-task-btn[_ngcontent-%COMP%] mat-spinner[_ngcontent-%COMP%]{display:inline-block}.tc-filters[_ngcontent-%COMP%]{display:flex;gap:.5rem;flex-wrap:wrap}.filter-chip[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);display:flex;align-items:center;gap:.375rem;padding:.375rem .875rem;border-radius:100px;font-size:.8rem;font-weight:500;color:var(--color-text-secondary);cursor:pointer;border:1px solid var(--color-border);transition:background .15s ease,color .15s ease,border-color .15s ease;white-space:nowrap}.filter-chip[_ngcontent-%COMP%] .filter-icon[_ngcontent-%COMP%]{font-size:.9rem;width:.9rem;height:.9rem}.filter-chip[_ngcontent-%COMP%] .filter-badge[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-text-inverse);border-radius:100px;padding:0 .375rem;font-size:.7rem;font-weight:700;min-width:18px;text-align:center;line-height:18px}.filter-chip.active[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-text-inverse);border-color:var(--color-primary)}.filter-chip.active[_ngcontent-%COMP%] .filter-icon[_ngcontent-%COMP%]{color:var(--color-text-inverse)}.filter-chip.active[_ngcontent-%COMP%] .filter-badge[_ngcontent-%COMP%]{background:#ffffff4d;color:var(--color-text-inverse)}.filter-chip[_ngcontent-%COMP%]:hover:not(.active){background:var(--color-bg-hover);color:var(--color-text)}.starred-filter.active[_ngcontent-%COMP%]{background:#f5a62326;border-color:#f5a623;color:#f5a623}.starred-filter.active[_ngcontent-%COMP%] .filter-icon[_ngcontent-%COMP%]{color:#f5a623}.tc-group[_ngcontent-%COMP%]{margin-bottom:1.5rem}.tc-group[_ngcontent-%COMP%]:last-child{margin-bottom:0}.tc-group-title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin:0 0 .75rem;font-size:.85rem;font-weight:600;color:var(--color-text-secondary);text-transform:uppercase;letter-spacing:.05em}.tc-group-title[_ngcontent-%COMP%] .group-icon[_ngcontent-%COMP%]{font-size:1rem;width:1rem;height:1rem}.tc-group-title[_ngcontent-%COMP%] .group-count[_ngcontent-%COMP%]{background:var(--color-bg-hover);border-radius:100px;padding:0 .375rem;font-size:.75rem;font-weight:700;min-width:18px;text-align:center;line-height:18px}.tc-grid-wrapper[_ngcontent-%COMP%]{flex:1;overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--color-border) transparent}.tc-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:1rem;padding-bottom:1rem}@media(max-width:600px){.tc-grid[_ngcontent-%COMP%]{grid-template-columns:1fr}}.tc-loading[_ngcontent-%COMP%], .tc-empty[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1rem;height:100%;min-height:240px;color:var(--color-text-secondary);text-align:center}.tc-loading[_ngcontent-%COMP%] p[_ngcontent-%COMP%], .tc-empty[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;font-size:.95rem}.empty-icon[_ngcontent-%COMP%]{font-size:3rem;width:3rem;height:3rem;opacity:.3}"]})};export{se as TaskControlComponent};
|