@whoz-oss/coday-client 0.249.4 → 0.249.5
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-Dlx5Rt5V.js → chunk-33vlVNIU.js} +1 -1
- package/browser/{chunk-DcWLC4S7.js → chunk-4T0Wfhqy.js} +1 -1
- package/browser/{chunk-nHbbuVx2.js → chunk-B4fIYjLb.js} +1 -1
- package/browser/{chunk-DVQQW6km.js → chunk-BIsBTTbQ.js} +1 -1
- package/browser/{chunk-CBe69s-2.js → chunk-BJTPtUco.js} +1 -1
- package/browser/{chunk-B6DehsQ-.js → chunk-BKMFWybZ.js} +1 -1
- package/browser/{chunk-BZZR3aP2.js → chunk-BLEV4Kd8.js} +1 -1
- package/browser/{chunk-B_crlzIY.js → chunk-BMNFjpsg.js} +1 -1
- package/browser/{chunk-BzkpZO0i.js → chunk-BOSz-hxC.js} +1 -1
- package/browser/{chunk-Bggbx31H.js → chunk-BQWolQ1_.js} +1 -1
- package/browser/{chunk-2TapTaXG.js → chunk-BUPJDuFO.js} +1 -1
- package/browser/{chunk-Pl7edkoq.js → chunk-BXfg4Cn0.js} +1 -1
- package/browser/{chunk-gI_QNDKB.js → chunk-BcgV9w1p.js} +1 -1
- package/browser/{chunk-CSzw8H2F.js → chunk-BiPnnB8X.js} +1 -1
- package/browser/{chunk-DwJCq7KC.js → chunk-BxmtpvI3.js} +1 -1
- package/browser/{chunk-Cxcbg8Y2.js → chunk-C2gFixjV.js} +1 -1
- package/browser/{chunk-cHZU18W6.js → chunk-C7pLql5T.js} +1 -1
- package/browser/{chunk-BC_2TEa6.js → chunk-CGgxj8Ll.js} +1 -1
- package/browser/{chunk-CtWA9Wcw.js → chunk-CK3s5ul2.js} +2 -2
- package/browser/{chunk-ZrkAX8bu.js → chunk-CKzcFadZ.js} +1 -1
- package/browser/{chunk-BUF2p97y.js → chunk-CL8NUXXa.js} +1 -1
- package/browser/{chunk-BPTzJwdV.js → chunk-COF9QnRG.js} +1 -1
- package/browser/{chunk-ZXaT_xHg.js → chunk-COcrCp25.js} +1 -1
- package/browser/{chunk-De9hRkSc.js → chunk-CPHT__IG.js} +1 -1
- package/browser/{chunk-BaP2JhEB.js → chunk-CRB1wakd.js} +1 -1
- package/browser/{chunk-DITp7n6E.js → chunk-CiJ-4xLE.js} +1 -1
- package/browser/{chunk-BRKM9jBe.js → chunk-CjgqGSbb.js} +1 -1
- package/browser/{chunk-DLXkxUg9.js → chunk-Cm8hWWGc.js} +1 -1
- package/browser/{chunk-DrMoRmsm.js → chunk-CnhLV6NJ.js} +1 -1
- package/browser/{chunk-anmUJQp9.js → chunk-Ct5Qp4E2.js} +1 -1
- package/browser/{chunk-CwUIxEoO.js → chunk-CvpbNH1V.js} +1 -1
- package/browser/{chunk-p1EUiu98.js → chunk-CwXyQ4Ju.js} +1 -1
- package/browser/{chunk-CFLyg-oC.js → chunk-Cy26cHH0.js} +1 -1
- package/browser/{chunk-CWFDInt7.js → chunk-DBDq5Tbc.js} +1 -1
- package/browser/{chunk-BWdSq8vF.js → chunk-DBcvm9ht.js} +1 -1
- package/browser/{chunk-CTYiqe0l.js → chunk-DCcqC6CZ.js} +1 -1
- package/browser/chunk-DEYaa_7l.js +1 -0
- package/browser/{chunk-BY3C8HLz.js → chunk-DIqcovfM.js} +1 -1
- package/browser/{chunk-BYD-ZEqa.js → chunk-DJZUs7_z.js} +1 -1
- package/browser/{chunk-CgrWMGhT.js → chunk-DNuwJ0p8.js} +1 -1
- package/browser/{chunk-Dlm3_p0t.js → chunk-DQ4FoWyz.js} +1 -1
- package/browser/{chunk-C4iXIN7X.js → chunk-DVCs6PIN.js} +1 -1
- package/browser/{chunk-spSRZfqJ.js → chunk-DVY7ZRkn.js} +1 -1
- package/browser/{chunk-BtVK9hVG.js → chunk-D_sXoT68.js} +1 -1
- package/browser/{chunk-B0kyFx_y.js → chunk-Dd7TuG2v.js} +1 -1
- package/browser/{chunk-DLsoHfhP.js → chunk-Ddzyej-S.js} +1 -1
- package/browser/{chunk-B4aBp6WW.js → chunk-DijOcbn5.js} +1 -1
- package/browser/{chunk-Bi0_x9sA.js → chunk-Dm3IJf8m.js} +1 -1
- package/browser/{chunk-BkD_xP5e.js → chunk-DxYwvtCM.js} +1 -1
- package/browser/{chunk-D2yqDA1u.js → chunk-FfWh7yzS.js} +1 -1
- package/browser/{chunk-C7zuPRu9.js → chunk-FlhMcqxz.js} +1 -1
- package/browser/{chunk-B-LBXHg-.js → chunk-GBM7ZdiS.js} +1 -1
- package/browser/{chunk-Cr2mSoCg.js → chunk-HGwsSYC8.js} +1 -1
- package/browser/{chunk-BlR-g_sS.js → chunk-Lq8skGXv.js} +1 -1
- package/browser/{chunk-BT_iRqki.js → chunk-MEeAhlKz.js} +1 -1
- package/browser/{chunk-BLwyktBH.js → chunk-McdsPwbe.js} +1 -1
- package/browser/{chunk-BhlAZzwj.js → chunk-UDqQWKAg.js} +1 -1
- package/browser/{chunk-CvL11Svz.js → chunk-XR8SsRgz.js} +1 -1
- package/browser/{chunk-DvXx9y4n.js → chunk-Y_yj5Q5X.js} +1 -1
- package/browser/{chunk-6tHPoek7.js → chunk-ZQW3-vPv.js} +1 -1
- package/browser/{chunk-DoYeTXOn.js → chunk-ZUPZhG8s.js} +1 -1
- package/browser/{chunk-Sc506DO8.js → chunk-dpvvF4wU.js} +1 -1
- package/browser/{chunk-BTNW2iz6.js → chunk-f86mGfJT.js} +1 -1
- package/browser/{chunk-NOr0w_o_.js → chunk-iOgvtXqW.js} +1 -1
- package/browser/{chunk-B6HBR6l3.js → chunk-kfNFXWlK.js} +1 -1
- package/browser/{chunk-CsOfELwl.js → chunk-osSFU_ft.js} +1 -1
- package/browser/index.html +1 -1
- package/browser/{main-ZCJEGFW3.js → main-Z5SI5ZVQ.js} +1 -1
- package/package.json +1 -1
- package/browser/chunk-DVJHLBDM.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import {c}from'./chunk-B0kyFx_y.js';import {g,ao as V,G,w as we$1,d8 as M,d9 as he$1,da as fe$1,H as Hi,db as ge$1,F,bQ as bd,m as mT,Q as By,b as U,a7 as ha,S as pa,z as z$1,a as P,A as Aw,v as vs,l as Ag,W as WC,k as dl,n as eC,X as XE,a5 as ml,t as tC,a9 as dC,o as bg,a3 as HI,q as oC,ac as mC,r as Tg,y as Hg,a6 as $I,x as iC,a8 as Zg,aa as If,ab as wf,bj as yh}from'./main-ZCJEGFW3.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-Pl7edkoq.js';var A=(n,t)=>t.value,se=(n,t)=>t.id;function pe(n,t){n&1&&(vs(0,"p",5),WC(1,"Loading\u2026"),dl());}function ue(n,t){n&1&&(vs(0,"span",12),WC(1," Name is required. "),dl());}function fe(n,t){if(n&1&&(vs(0,"p",40),WC(1),dl(),vs(2,"span",13),WC(3,"Agent Config cannot be changed after creation."),dl()),n&2){let e=mC(2);XE(),Zg(e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function _e(n,t){if(n&1&&(vs(0,"a",41),WC(1,"Add an agent config"),dl(),WC(2," first. ")),n&2){let e=mC(3);Tg("href","/agentos/"+e.namespaceId+"/agent-configs/new",yh);}}function he(n,t){if(n&1&&(vs(0,"p",13),WC(1," No agent configs available in this scope yet. "),eC(2,_e,3,1),dl()),n&2){let e=mC(2);XE(2),tC(e.isPlatformMode?-1:2);}}function ge(n,t){if(n&1&&(vs(0,"option",23),WC(1),dl()),n&2){let e=t.$implicit;Tg("value",e.id),XE(),Zg(e.name);}}function Ce(n,t){n&1&&(vs(0,"span",12),WC(1,"Agent Config is required."),dl());}function ve(n,t){if(n&1&&(vs(0,"select",42)(1,"option",43),WC(2,"Select an agent config\u2026"),dl(),oC(3,ge,2,2,"option",23,se),dl(),HI(),eC(5,Ce,2,0,"span",12),vs(6,"span",13),WC(7,"Immutable after creation."),dl()),n&2){let e=mC(2);Tg("formControl",e.agentConfigIdControl),$I(),XE(3),iC(e.availableAgentConfigs()),XE(2),tC(e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?5:-1);}}function ye(n,t){n&1&&(vs(0,"span",12),WC(1,"Opening message is required."),dl());}function be(n,t){if(n&1&&(vs(0,"option",23),WC(1),dl()),n&2){let e=t.$implicit;Tg("value",e.value),XE(),Zg(e.label);}}function xe(n,t){if(n&1){let e=dC();vs(0,"label",46)(1,"input",47),Ag("change",function(){let h=If(e).$implicit,P=mC(3);return wf(P.toggleDay(h.value))}),dl(),vs(2,"span",48),WC(3),dl()();}if(n&2){let e=t.$implicit,l=mC(3);XE(),Tg("checked",l.isDaySelected(e.value)),XE(2),Zg(e.label);}}function Se(n,t){if(n&1&&(vs(0,"div",8)(1,"span",44),WC(2,"Days of week"),dl(),vs(3,"div",45),oC(4,xe,4,2,"label",46,A),dl(),vs(6,"span",13),WC(7,"Leave empty to run every day of the week."),dl()()),n&2){let e=mC(2);XE(4),iC(e.dayOptions);}}function Pe(n,t){n&1&&(vs(0,"span",12),WC(1,"Valid time is required (HH:mm)."),dl());}function Ee(n,t){n&1&&(vs(0,"span",12),WC(1,"Start date is required."),dl());}function Me(n,t){if(n&1&&(vs(0,"option",23),WC(1),dl()),n&2){let e=t.$implicit;Tg("value",e.value),XE(),Zg(e.label);}}function Oe(n,t){n&1&&(vs(0,"span",12),WC(1,"End date is required."),dl());}function De(n,t){if(n&1&&(vs(0,"div",8)(1,"label",49),WC(2," End date "),vs(3,"span",10),WC(4,"*"),dl()(),bg(5,"input",50),HI(),eC(6,Oe,2,0,"span",12),dl()),n&2){let e=mC(2);XE(5),Hg("scheduled-prompt-form__input--invalid",e.form.hasError("endDateRequired")&&e.endDateControl.touched),Tg("formControl",e.endDateControl),$I(),XE(),tC(e.form.hasError("endDateRequired")&&e.endDateControl.touched?6:-1);}}function Te(n,t){n&1&&(vs(0,"span",12),WC(1,"Must be at least 1."),dl());}function we(n,t){if(n&1&&(vs(0,"div",8)(1,"label",51),WC(2," Number of occurrences "),vs(3,"span",10),WC(4,"*"),dl()(),bg(5,"input",52),HI(),eC(6,Te,2,0,"span",12),dl()),n&2){let e=mC(2);XE(5),Hg("scheduled-prompt-form__input--invalid",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched),Tg("formControl",e.occurrenceCountControl),$I(),XE(),tC(e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?6:-1);}}function ke(n,t){if(n&1&&(vs(0,"p",36),WC(1),dl()),n&2){let e=mC(2);XE(),Zg(e.errorMessage());}}function Fe(n,t){if(n&1){let e=dC();vs(0,"form",7),Ag("ngSubmit",function(){If(e);let h=mC();return wf(h.submit())}),vs(1,"div",8)(2,"label",9),WC(3," Name "),vs(4,"span",10),WC(5,"*"),dl()(),bg(6,"input",11),HI(),eC(7,ue,2,0,"span",12),vs(8,"span",13),WC(9,'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.'),dl()(),vs(10,"div",8)(11,"label",14),WC(12,"Description"),dl(),bg(13,"input",15),HI(),dl(),vs(14,"div",8)(15,"label",16),WC(16," Agent Config "),vs(17,"span",10),WC(18,"*"),dl()(),eC(19,fe,4,1)(20,he,3,1,"p",13)(21,ve,8,2),dl(),vs(22,"div",8)(23,"label",17),WC(24," Opening message "),vs(25,"span",10),WC(26,"*"),dl()(),bg(27,"textarea",18),HI(),eC(28,ye,2,0,"span",12),vs(29,"span",13),WC(30," The message sent to the agent when the scheduled prompt fires. "),dl()(),vs(31,"fieldset",19)(32,"legend",20),WC(33,"Recurrence"),dl(),vs(34,"div",8)(35,"label",21),WC(36," Unit "),vs(37,"span",10),WC(38,"*"),dl()(),vs(39,"select",22),oC(40,be,2,2,"option",23,A),dl(),HI(),dl(),eC(42,Se,8,0,"div",8),vs(43,"div",8)(44,"label",24),WC(45," Time (UTC) "),vs(46,"span",10),WC(47,"*"),dl()(),vs(48,"div",25),bg(49,"input",26),HI(),vs(50,"span",27),WC(51,"UTC"),dl()(),eC(52,Pe,2,0,"span",12),dl()(),vs(53,"fieldset",19)(54,"legend",20),WC(55,"Planning"),dl(),vs(56,"div",8)(57,"label",28),WC(58," Start date "),vs(59,"span",10),WC(60,"*"),dl()(),bg(61,"input",29),HI(),eC(62,Ee,2,0,"span",12),dl(),vs(63,"div",8)(64,"label",30),WC(65," Ends "),vs(66,"span",10),WC(67,"*"),dl()(),vs(68,"select",31),oC(69,Me,2,2,"option",23,A),dl(),HI(),dl(),eC(71,De,7,4,"div",8),eC(72,we,7,4,"div",8),dl(),vs(73,"div",8)(74,"label",32),bg(75,"input",33),HI(),vs(76,"span",34),WC(77,"Enabled"),dl()(),vs(78,"p",35),WC(79," When disabled, the scheduled prompt is saved but will not run on schedule. "),dl()(),eC(80,ke,2,1,"p",36),vs(81,"div",37)(82,"button",38),WC(83),dl(),vs(84,"button",39),Ag("click",function(){If(e);let h=mC();return wf(h.cancel())}),WC(85,"Cancel"),dl()()();}if(n&2){let e=mC();Tg("formGroup",e.form),XE(6),Hg("scheduled-prompt-form__input--invalid",e.nameControl.invalid&&e.nameControl.touched),Tg("formControl",e.nameControl),$I(),XE(),tC(e.nameControl.invalid&&e.nameControl.touched?7:-1),XE(6),Tg("formControl",e.descriptionControl),$I(),XE(6),tC(e.isEditMode()?19:e.availableAgentConfigs().length===0?20:21),XE(8),Hg("scheduled-prompt-form__textarea--invalid",e.promptContentControl.invalid&&e.promptContentControl.touched),Tg("formControl",e.promptContentControl),$I(),XE(),tC(e.promptContentControl.invalid&&e.promptContentControl.touched?28:-1),XE(11),Tg("formControl",e.unitControl),$I(),XE(),iC(e.schedulerUnits),XE(2),tC(e.showDayFilter()?42:-1),XE(7),Tg("formControl",e.timeUtcControl),$I(),XE(3),tC(e.timeUtcControl.invalid&&e.timeUtcControl.touched?52:-1),XE(9),Hg("scheduled-prompt-form__input--invalid",e.startDateControl.invalid&&e.startDateControl.touched),Tg("formControl",e.startDateControl),$I(),XE(),tC(e.startDateControl.invalid&&e.startDateControl.touched?62:-1),XE(6),Tg("formControl",e.endTypeControl),$I(),XE(),iC(e.endTypes),XE(2),tC(e.showEndDate()?71:-1),XE(),tC(e.showOccurrenceCount()?72:-1),XE(3),Tg("formControl",e.enabledControl),$I(),XE(5),tC(e.errorMessage()?80:-1),XE(2),Tg("disabled",e.form.invalid||e.isSubmitting()),XE(),ml(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var me=class n{route=g(V);router=g(G);destroyRef=g(we$1);state=g(c);agentConfigController=g(M);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new z({name:new _t("",{nonNullable:true,validators:[_e$1.required]}),description:new _t(null),agentConfigId:new _t("",{nonNullable:true,validators:[_e$1.required]}),promptContent:new _t("",{nonNullable:true,validators:[_e$1.required]}),unit:new _t(fe$1.WEEK,{nonNullable:true,validators:[_e$1.required]}),days:new _t([],{nonNullable:true}),timeUtc:new _t("09:00",{nonNullable:true,validators:[_e$1.required,_e$1.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new _t("",{nonNullable:true,validators:[_e$1.required]}),endType:new _t(he$1.NEVER,{nonNullable:true,validators:[_e$1.required]}),endDate:new _t(null),occurrenceCount:new _t(null),enabled:new _t(true,{nonNullable:true})},{validators:[Ne,Ie]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}isEditMode=Hi(false);isSubmitting=Hi(false);isLoading=Hi(false);errorMessage=Hi(null);SchedulerUnit=fe$1;SchedulerEndType=he$1;schedulerUnits=[{value:fe$1.WEEK,label:"Week(s)"},{value:fe$1.MONTH,label:"Month(s)"}];endTypes=[{value:he$1.NEVER,label:"Never"},{value:he$1.ON_DATE,label:"On date"},{value:he$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(ge$1).map(([t,e])=>({value:t,label:e}));unitSignal=F(this.unitControl.valueChanges.pipe(bd(this.unitControl.value)));endTypeSignal=F(this.endTypeControl.valueChanges.pipe(bd(this.endTypeControl.value)));showDayFilter=mT(()=>this.unitSignal()===fe$1.WEEK);showEndDate=mT(()=>this.endTypeSignal()===he$1.ON_DATE);showOccurrenceCount=mT(()=>this.endTypeSignal()===he$1.OCCURRENCES);agentConfigs=Hi([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Ve());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(true),this.loadPromptAndResources(t)):this.loadResources();}loadPromptAndResources(t){this.isLoading.set(true),By({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(U(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:l})=>{this.existingPrompt=e,this.agentConfigs.set(l),this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadResources(){this.agentConfigs$().pipe(U(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(ha(()=>pa([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled);}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,l=e.includes(t)?e.filter(h=>h!==t):[...e,t];this.daysControl.setValue(l);}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,l=z$1(P({},this.existingPrompt??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,agentConfigId:t?this.existingPrompt.agentConfigId:this.agentConfigIdControl.value,promptContent:this.promptContentControl.value.trim(),recurrence:{unit:this.unitControl.value,days:this.daysControl.value,timeUtc:this.timeUtcControl.value},planning:{startDate:this.startDateControl.value,endType:e,endDate:e===he$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===he$1.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value});(t?this.state.update(this.existingPrompt.id,l):this.state.create(l)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:P=>{this.isSubmitting.set(false),P.status===409?this.errorMessage.set(`A scheduled prompt named "${l.name}" already exists in this scope.`):P.status===400?this.errorMessage.set(P.error?.message??"Invalid scheduled prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","scheduled-prompts"]):this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Aw({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:10,vars:3,consts:[[1,"scheduled-prompt-form"],[1,"scheduled-prompt-form__header"],["type","button","title","Back to scheduled prompts",1,"scheduled-prompt-form__back",3,"click"],[1,"scheduled-prompt-form__back-icon"],[1,"scheduled-prompt-form__title"],[1,"scheduled-prompt-form__loading"],[1,"scheduled-prompt-form__form",3,"formGroup"],[1,"scheduled-prompt-form__form",3,"ngSubmit","formGroup"],[1,"scheduled-prompt-form__field"],["for","sp-name",1,"scheduled-prompt-form__label"],["aria-hidden","true"],["id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],[1,"scheduled-prompt-form__field-error"],[1,"scheduled-prompt-form__field-hint"],["for","sp-description",1,"scheduled-prompt-form__label"],["id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-agent-config",1,"scheduled-prompt-form__label"],["for","sp-prompt-content",1,"scheduled-prompt-form__label"],["id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",1,"scheduled-prompt-form__textarea",3,"formControl"],[1,"scheduled-prompt-form__fieldset"],[1,"scheduled-prompt-form__legend"],["for","sp-unit",1,"scheduled-prompt-form__label"],["id","sp-unit",1,"scheduled-prompt-form__select",3,"formControl"],[3,"value"],["for","sp-time",1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__time-wrapper"],["id","sp-time","type","time",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--time",3,"formControl"],[1,"scheduled-prompt-form__utc-badge"],["for","sp-start-date",1,"scheduled-prompt-form__label"],["id","sp-start-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-end-type",1,"scheduled-prompt-form__label"],["id","sp-end-type",1,"scheduled-prompt-form__select",3,"formControl"],[1,"scheduled-prompt-form__toggle-label"],["type","checkbox",1,"scheduled-prompt-form__toggle-checkbox",3,"formControl"],[1,"scheduled-prompt-form__toggle-text"],[1,"scheduled-prompt-form__toggle-hint"],[1,"scheduled-prompt-form__error"],[1,"scheduled-prompt-form__actions"],["type","submit",1,"scheduled-prompt-form__btn","scheduled-prompt-form__btn--primary",3,"disabled"],["type","button",1,"scheduled-prompt-form__btn",3,"click"],[1,"scheduled-prompt-form__readonly-value"],[3,"href"],["id","sp-agent-config",1,"scheduled-prompt-form__select",3,"formControl"],["value","","disabled",""],[1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__day-grid"],[1,"scheduled-prompt-form__day-label"],["type","checkbox",1,"scheduled-prompt-form__day-checkbox",3,"change","checked"],[1,"scheduled-prompt-form__day-text"],["for","sp-end-date",1,"scheduled-prompt-form__label"],["id","sp-end-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-occurrence-count",1,"scheduled-prompt-form__label"],["id","sp-occurrence-count","type","number","min","1",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--number",3,"formControl"]],template:function(e,l){e&1&&(vs(0,"div",0)(1,"header",1)(2,"button",2),Ag("click",function(){return l.cancel()}),vs(3,"span",3),WC(4,"\u2190"),dl(),WC(5),dl(),vs(6,"h1",4),WC(7),dl()(),eC(8,pe,2,0,"p",5)(9,Fe,86,26,"form",6),dl()),e&2&&(XE(5),ml(" ",l.isPlatformMode?"Platform Scheduled Prompts":"Scheduled Prompts"," "),XE(2),ml(" ",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"," "),XE(),tC(l.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,fn,wt,At,Zn,Xn,$t,Cn,En],styles:[".scheduled-prompt-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.scheduled-prompt-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.scheduled-prompt-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.scheduled-prompt-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.scheduled-prompt-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.scheduled-prompt-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.scheduled-prompt-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.scheduled-prompt-form__row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.scheduled-prompt-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__input[_ngcontent-%COMP%], .scheduled-prompt-form__select[_ngcontent-%COMP%], .scheduled-prompt-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.scheduled-prompt-form__input[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__select[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.scheduled-prompt-form__input[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__select[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__select[_ngcontent-%COMP%]{cursor:pointer;appearance:auto}.scheduled-prompt-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:100px;line-height:1.5}.scheduled-prompt-form__input--time[_ngcontent-%COMP%]{flex:1;min-width:0}.scheduled-prompt-form__input--number[_ngcontent-%COMP%]{max-width:120px}.scheduled-prompt-form__time-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.scheduled-prompt-form__utc-badge[_ngcontent-%COMP%]{flex-shrink:0;font-size:.75rem;font-weight:600;font-family:monospace;color:var(--color-text-secondary, #6e6e73);background:var(--color-surface, rgba(0, 0, 0, .05));padding:.25rem .5rem;border-radius:4px;text-transform:uppercase;letter-spacing:.06em}.scheduled-prompt-form__fieldset[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:8px;padding:1rem 1.25rem 1.25rem;margin:0;display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__legend[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--color-text-secondary, #6e6e73);padding:0 .375rem}.scheduled-prompt-form__day-grid[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.5rem}.scheduled-prompt-form__day-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__day-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__day-text[_ngcontent-%COMP%]{font-size:.875rem;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__hint[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30);margin:0}.scheduled-prompt-form__field-error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30)}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__readonly-value[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;color:var(--color-text, #1d1d1f);padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--color-surface, rgba(0, 0, 0, .03))}.scheduled-prompt-form__input--invalid[_ngcontent-%COMP%], .scheduled-prompt-form__textarea--invalid[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30)}.scheduled-prompt-form__toggle-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__toggle-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__toggle-text[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__toggle-hint[_ngcontent-%COMP%]{margin:.25rem 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.scheduled-prompt-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"]})};function Ne(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===he$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ie(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===he$1.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function Ve(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${l}`}export{me as ScheduledPromptFormComponent};
|
|
1
|
+
import {c}from'./chunk-Dd7TuG2v.js';import {g,ao as V,G,w as we$1,d8 as M,d9 as he$1,da as fe$1,H as Hi,db as ge$1,F,bQ as bd,m as mT,Q as By,b as U,a7 as ha,S as pa,z as z$1,a as P,A as Aw,v as vs,l as Ag,W as WC,k as dl,n as eC,X as XE,a5 as ml,t as tC,a9 as dC,o as bg,a3 as HI,q as oC,ac as mC,r as Tg,y as Hg,a6 as $I,x as iC,a8 as Zg,aa as If,ab as wf,bj as yh}from'./main-Z5SI5ZVQ.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-BXfg4Cn0.js';var A=(n,t)=>t.value,se=(n,t)=>t.id;function pe(n,t){n&1&&(vs(0,"p",5),WC(1,"Loading\u2026"),dl());}function ue(n,t){n&1&&(vs(0,"span",12),WC(1," Name is required. "),dl());}function fe(n,t){if(n&1&&(vs(0,"p",40),WC(1),dl(),vs(2,"span",13),WC(3,"Agent Config cannot be changed after creation."),dl()),n&2){let e=mC(2);XE(),Zg(e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function _e(n,t){if(n&1&&(vs(0,"a",41),WC(1,"Add an agent config"),dl(),WC(2," first. ")),n&2){let e=mC(3);Tg("href","/agentos/"+e.namespaceId+"/agent-configs/new",yh);}}function he(n,t){if(n&1&&(vs(0,"p",13),WC(1," No agent configs available in this scope yet. "),eC(2,_e,3,1),dl()),n&2){let e=mC(2);XE(2),tC(e.isPlatformMode?-1:2);}}function ge(n,t){if(n&1&&(vs(0,"option",23),WC(1),dl()),n&2){let e=t.$implicit;Tg("value",e.id),XE(),Zg(e.name);}}function Ce(n,t){n&1&&(vs(0,"span",12),WC(1,"Agent Config is required."),dl());}function ve(n,t){if(n&1&&(vs(0,"select",42)(1,"option",43),WC(2,"Select an agent config\u2026"),dl(),oC(3,ge,2,2,"option",23,se),dl(),HI(),eC(5,Ce,2,0,"span",12),vs(6,"span",13),WC(7,"Immutable after creation."),dl()),n&2){let e=mC(2);Tg("formControl",e.agentConfigIdControl),$I(),XE(3),iC(e.availableAgentConfigs()),XE(2),tC(e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?5:-1);}}function ye(n,t){n&1&&(vs(0,"span",12),WC(1,"Opening message is required."),dl());}function be(n,t){if(n&1&&(vs(0,"option",23),WC(1),dl()),n&2){let e=t.$implicit;Tg("value",e.value),XE(),Zg(e.label);}}function xe(n,t){if(n&1){let e=dC();vs(0,"label",46)(1,"input",47),Ag("change",function(){let h=If(e).$implicit,P=mC(3);return wf(P.toggleDay(h.value))}),dl(),vs(2,"span",48),WC(3),dl()();}if(n&2){let e=t.$implicit,l=mC(3);XE(),Tg("checked",l.isDaySelected(e.value)),XE(2),Zg(e.label);}}function Se(n,t){if(n&1&&(vs(0,"div",8)(1,"span",44),WC(2,"Days of week"),dl(),vs(3,"div",45),oC(4,xe,4,2,"label",46,A),dl(),vs(6,"span",13),WC(7,"Leave empty to run every day of the week."),dl()()),n&2){let e=mC(2);XE(4),iC(e.dayOptions);}}function Pe(n,t){n&1&&(vs(0,"span",12),WC(1,"Valid time is required (HH:mm)."),dl());}function Ee(n,t){n&1&&(vs(0,"span",12),WC(1,"Start date is required."),dl());}function Me(n,t){if(n&1&&(vs(0,"option",23),WC(1),dl()),n&2){let e=t.$implicit;Tg("value",e.value),XE(),Zg(e.label);}}function Oe(n,t){n&1&&(vs(0,"span",12),WC(1,"End date is required."),dl());}function De(n,t){if(n&1&&(vs(0,"div",8)(1,"label",49),WC(2," End date "),vs(3,"span",10),WC(4,"*"),dl()(),bg(5,"input",50),HI(),eC(6,Oe,2,0,"span",12),dl()),n&2){let e=mC(2);XE(5),Hg("scheduled-prompt-form__input--invalid",e.form.hasError("endDateRequired")&&e.endDateControl.touched),Tg("formControl",e.endDateControl),$I(),XE(),tC(e.form.hasError("endDateRequired")&&e.endDateControl.touched?6:-1);}}function Te(n,t){n&1&&(vs(0,"span",12),WC(1,"Must be at least 1."),dl());}function we(n,t){if(n&1&&(vs(0,"div",8)(1,"label",51),WC(2," Number of occurrences "),vs(3,"span",10),WC(4,"*"),dl()(),bg(5,"input",52),HI(),eC(6,Te,2,0,"span",12),dl()),n&2){let e=mC(2);XE(5),Hg("scheduled-prompt-form__input--invalid",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched),Tg("formControl",e.occurrenceCountControl),$I(),XE(),tC(e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?6:-1);}}function ke(n,t){if(n&1&&(vs(0,"p",36),WC(1),dl()),n&2){let e=mC(2);XE(),Zg(e.errorMessage());}}function Fe(n,t){if(n&1){let e=dC();vs(0,"form",7),Ag("ngSubmit",function(){If(e);let h=mC();return wf(h.submit())}),vs(1,"div",8)(2,"label",9),WC(3," Name "),vs(4,"span",10),WC(5,"*"),dl()(),bg(6,"input",11),HI(),eC(7,ue,2,0,"span",12),vs(8,"span",13),WC(9,'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.'),dl()(),vs(10,"div",8)(11,"label",14),WC(12,"Description"),dl(),bg(13,"input",15),HI(),dl(),vs(14,"div",8)(15,"label",16),WC(16," Agent Config "),vs(17,"span",10),WC(18,"*"),dl()(),eC(19,fe,4,1)(20,he,3,1,"p",13)(21,ve,8,2),dl(),vs(22,"div",8)(23,"label",17),WC(24," Opening message "),vs(25,"span",10),WC(26,"*"),dl()(),bg(27,"textarea",18),HI(),eC(28,ye,2,0,"span",12),vs(29,"span",13),WC(30," The message sent to the agent when the scheduled prompt fires. "),dl()(),vs(31,"fieldset",19)(32,"legend",20),WC(33,"Recurrence"),dl(),vs(34,"div",8)(35,"label",21),WC(36," Unit "),vs(37,"span",10),WC(38,"*"),dl()(),vs(39,"select",22),oC(40,be,2,2,"option",23,A),dl(),HI(),dl(),eC(42,Se,8,0,"div",8),vs(43,"div",8)(44,"label",24),WC(45," Time (UTC) "),vs(46,"span",10),WC(47,"*"),dl()(),vs(48,"div",25),bg(49,"input",26),HI(),vs(50,"span",27),WC(51,"UTC"),dl()(),eC(52,Pe,2,0,"span",12),dl()(),vs(53,"fieldset",19)(54,"legend",20),WC(55,"Planning"),dl(),vs(56,"div",8)(57,"label",28),WC(58," Start date "),vs(59,"span",10),WC(60,"*"),dl()(),bg(61,"input",29),HI(),eC(62,Ee,2,0,"span",12),dl(),vs(63,"div",8)(64,"label",30),WC(65," Ends "),vs(66,"span",10),WC(67,"*"),dl()(),vs(68,"select",31),oC(69,Me,2,2,"option",23,A),dl(),HI(),dl(),eC(71,De,7,4,"div",8),eC(72,we,7,4,"div",8),dl(),vs(73,"div",8)(74,"label",32),bg(75,"input",33),HI(),vs(76,"span",34),WC(77,"Enabled"),dl()(),vs(78,"p",35),WC(79," When disabled, the scheduled prompt is saved but will not run on schedule. "),dl()(),eC(80,ke,2,1,"p",36),vs(81,"div",37)(82,"button",38),WC(83),dl(),vs(84,"button",39),Ag("click",function(){If(e);let h=mC();return wf(h.cancel())}),WC(85,"Cancel"),dl()()();}if(n&2){let e=mC();Tg("formGroup",e.form),XE(6),Hg("scheduled-prompt-form__input--invalid",e.nameControl.invalid&&e.nameControl.touched),Tg("formControl",e.nameControl),$I(),XE(),tC(e.nameControl.invalid&&e.nameControl.touched?7:-1),XE(6),Tg("formControl",e.descriptionControl),$I(),XE(6),tC(e.isEditMode()?19:e.availableAgentConfigs().length===0?20:21),XE(8),Hg("scheduled-prompt-form__textarea--invalid",e.promptContentControl.invalid&&e.promptContentControl.touched),Tg("formControl",e.promptContentControl),$I(),XE(),tC(e.promptContentControl.invalid&&e.promptContentControl.touched?28:-1),XE(11),Tg("formControl",e.unitControl),$I(),XE(),iC(e.schedulerUnits),XE(2),tC(e.showDayFilter()?42:-1),XE(7),Tg("formControl",e.timeUtcControl),$I(),XE(3),tC(e.timeUtcControl.invalid&&e.timeUtcControl.touched?52:-1),XE(9),Hg("scheduled-prompt-form__input--invalid",e.startDateControl.invalid&&e.startDateControl.touched),Tg("formControl",e.startDateControl),$I(),XE(),tC(e.startDateControl.invalid&&e.startDateControl.touched?62:-1),XE(6),Tg("formControl",e.endTypeControl),$I(),XE(),iC(e.endTypes),XE(2),tC(e.showEndDate()?71:-1),XE(),tC(e.showOccurrenceCount()?72:-1),XE(3),Tg("formControl",e.enabledControl),$I(),XE(5),tC(e.errorMessage()?80:-1),XE(2),Tg("disabled",e.form.invalid||e.isSubmitting()),XE(),ml(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var me=class n{route=g(V);router=g(G);destroyRef=g(we$1);state=g(c);agentConfigController=g(M);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new z({name:new _t("",{nonNullable:true,validators:[_e$1.required]}),description:new _t(null),agentConfigId:new _t("",{nonNullable:true,validators:[_e$1.required]}),promptContent:new _t("",{nonNullable:true,validators:[_e$1.required]}),unit:new _t(fe$1.WEEK,{nonNullable:true,validators:[_e$1.required]}),days:new _t([],{nonNullable:true}),timeUtc:new _t("09:00",{nonNullable:true,validators:[_e$1.required,_e$1.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new _t("",{nonNullable:true,validators:[_e$1.required]}),endType:new _t(he$1.NEVER,{nonNullable:true,validators:[_e$1.required]}),endDate:new _t(null),occurrenceCount:new _t(null),enabled:new _t(true,{nonNullable:true})},{validators:[Ne,Ie]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}isEditMode=Hi(false);isSubmitting=Hi(false);isLoading=Hi(false);errorMessage=Hi(null);SchedulerUnit=fe$1;SchedulerEndType=he$1;schedulerUnits=[{value:fe$1.WEEK,label:"Week(s)"},{value:fe$1.MONTH,label:"Month(s)"}];endTypes=[{value:he$1.NEVER,label:"Never"},{value:he$1.ON_DATE,label:"On date"},{value:he$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(ge$1).map(([t,e])=>({value:t,label:e}));unitSignal=F(this.unitControl.valueChanges.pipe(bd(this.unitControl.value)));endTypeSignal=F(this.endTypeControl.valueChanges.pipe(bd(this.endTypeControl.value)));showDayFilter=mT(()=>this.unitSignal()===fe$1.WEEK);showEndDate=mT(()=>this.endTypeSignal()===he$1.ON_DATE);showOccurrenceCount=mT(()=>this.endTypeSignal()===he$1.OCCURRENCES);agentConfigs=Hi([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Ve());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(true),this.loadPromptAndResources(t)):this.loadResources();}loadPromptAndResources(t){this.isLoading.set(true),By({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(U(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:l})=>{this.existingPrompt=e,this.agentConfigs.set(l),this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadResources(){this.agentConfigs$().pipe(U(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(ha(()=>pa([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled);}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,l=e.includes(t)?e.filter(h=>h!==t):[...e,t];this.daysControl.setValue(l);}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,l=z$1(P({},this.existingPrompt??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,agentConfigId:t?this.existingPrompt.agentConfigId:this.agentConfigIdControl.value,promptContent:this.promptContentControl.value.trim(),recurrence:{unit:this.unitControl.value,days:this.daysControl.value,timeUtc:this.timeUtcControl.value},planning:{startDate:this.startDateControl.value,endType:e,endDate:e===he$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===he$1.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value});(t?this.state.update(this.existingPrompt.id,l):this.state.create(l)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:P=>{this.isSubmitting.set(false),P.status===409?this.errorMessage.set(`A scheduled prompt named "${l.name}" already exists in this scope.`):P.status===400?this.errorMessage.set(P.error?.message??"Invalid scheduled prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","scheduled-prompts"]):this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Aw({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:10,vars:3,consts:[[1,"scheduled-prompt-form"],[1,"scheduled-prompt-form__header"],["type","button","title","Back to scheduled prompts",1,"scheduled-prompt-form__back",3,"click"],[1,"scheduled-prompt-form__back-icon"],[1,"scheduled-prompt-form__title"],[1,"scheduled-prompt-form__loading"],[1,"scheduled-prompt-form__form",3,"formGroup"],[1,"scheduled-prompt-form__form",3,"ngSubmit","formGroup"],[1,"scheduled-prompt-form__field"],["for","sp-name",1,"scheduled-prompt-form__label"],["aria-hidden","true"],["id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],[1,"scheduled-prompt-form__field-error"],[1,"scheduled-prompt-form__field-hint"],["for","sp-description",1,"scheduled-prompt-form__label"],["id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-agent-config",1,"scheduled-prompt-form__label"],["for","sp-prompt-content",1,"scheduled-prompt-form__label"],["id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",1,"scheduled-prompt-form__textarea",3,"formControl"],[1,"scheduled-prompt-form__fieldset"],[1,"scheduled-prompt-form__legend"],["for","sp-unit",1,"scheduled-prompt-form__label"],["id","sp-unit",1,"scheduled-prompt-form__select",3,"formControl"],[3,"value"],["for","sp-time",1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__time-wrapper"],["id","sp-time","type","time",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--time",3,"formControl"],[1,"scheduled-prompt-form__utc-badge"],["for","sp-start-date",1,"scheduled-prompt-form__label"],["id","sp-start-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-end-type",1,"scheduled-prompt-form__label"],["id","sp-end-type",1,"scheduled-prompt-form__select",3,"formControl"],[1,"scheduled-prompt-form__toggle-label"],["type","checkbox",1,"scheduled-prompt-form__toggle-checkbox",3,"formControl"],[1,"scheduled-prompt-form__toggle-text"],[1,"scheduled-prompt-form__toggle-hint"],[1,"scheduled-prompt-form__error"],[1,"scheduled-prompt-form__actions"],["type","submit",1,"scheduled-prompt-form__btn","scheduled-prompt-form__btn--primary",3,"disabled"],["type","button",1,"scheduled-prompt-form__btn",3,"click"],[1,"scheduled-prompt-form__readonly-value"],[3,"href"],["id","sp-agent-config",1,"scheduled-prompt-form__select",3,"formControl"],["value","","disabled",""],[1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__day-grid"],[1,"scheduled-prompt-form__day-label"],["type","checkbox",1,"scheduled-prompt-form__day-checkbox",3,"change","checked"],[1,"scheduled-prompt-form__day-text"],["for","sp-end-date",1,"scheduled-prompt-form__label"],["id","sp-end-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-occurrence-count",1,"scheduled-prompt-form__label"],["id","sp-occurrence-count","type","number","min","1",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--number",3,"formControl"]],template:function(e,l){e&1&&(vs(0,"div",0)(1,"header",1)(2,"button",2),Ag("click",function(){return l.cancel()}),vs(3,"span",3),WC(4,"\u2190"),dl(),WC(5),dl(),vs(6,"h1",4),WC(7),dl()(),eC(8,pe,2,0,"p",5)(9,Fe,86,26,"form",6),dl()),e&2&&(XE(5),ml(" ",l.isPlatformMode?"Platform Scheduled Prompts":"Scheduled Prompts"," "),XE(2),ml(" ",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"," "),XE(),tC(l.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,fn,wt,At,Zn,Xn,$t,Cn,En],styles:[".scheduled-prompt-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.scheduled-prompt-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.scheduled-prompt-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.scheduled-prompt-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.scheduled-prompt-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.scheduled-prompt-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.scheduled-prompt-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.scheduled-prompt-form__row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.scheduled-prompt-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__input[_ngcontent-%COMP%], .scheduled-prompt-form__select[_ngcontent-%COMP%], .scheduled-prompt-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.scheduled-prompt-form__input[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__select[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.scheduled-prompt-form__input[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__select[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__select[_ngcontent-%COMP%]{cursor:pointer;appearance:auto}.scheduled-prompt-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:100px;line-height:1.5}.scheduled-prompt-form__input--time[_ngcontent-%COMP%]{flex:1;min-width:0}.scheduled-prompt-form__input--number[_ngcontent-%COMP%]{max-width:120px}.scheduled-prompt-form__time-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.scheduled-prompt-form__utc-badge[_ngcontent-%COMP%]{flex-shrink:0;font-size:.75rem;font-weight:600;font-family:monospace;color:var(--color-text-secondary, #6e6e73);background:var(--color-surface, rgba(0, 0, 0, .05));padding:.25rem .5rem;border-radius:4px;text-transform:uppercase;letter-spacing:.06em}.scheduled-prompt-form__fieldset[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:8px;padding:1rem 1.25rem 1.25rem;margin:0;display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__legend[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--color-text-secondary, #6e6e73);padding:0 .375rem}.scheduled-prompt-form__day-grid[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.5rem}.scheduled-prompt-form__day-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__day-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__day-text[_ngcontent-%COMP%]{font-size:.875rem;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__hint[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30);margin:0}.scheduled-prompt-form__field-error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30)}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__readonly-value[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;color:var(--color-text, #1d1d1f);padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--color-surface, rgba(0, 0, 0, .03))}.scheduled-prompt-form__input--invalid[_ngcontent-%COMP%], .scheduled-prompt-form__textarea--invalid[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30)}.scheduled-prompt-form__toggle-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__toggle-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__toggle-text[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__toggle-hint[_ngcontent-%COMP%]{margin:.25rem 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.scheduled-prompt-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"]})};function Ne(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===he$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ie(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===he$1.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function Ve(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${l}`}export{me as ScheduledPromptFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {y}from'./chunk-2TapTaXG.js';import {g,ao as V,G,w as we,d8 as M,dk as D,d5 as N,H as Hi,Q as By,S as pa,b as U,u as ue$1,a7 as ha,z as z$1,a as P,A as Aw,s as si,v as vs,l as Ag,W as WC,k as dl,n as eC,X as XE,a8 as Zg,t as tC,ac as mC,r as Tg,a9 as dC,o as bg,a3 as HI,a6 as $I,a5 as ml,q as oC,x as iC,bn as nC,aa as If,ab as wf,C as Cg}from'./main-ZCJEGFW3.js';import'./chunk-CtWA9Wcw.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,a as wt,Z as Zn,l as Xn,C as Cn,E as En}from'./chunk-Pl7edkoq.js';import'./chunk-DVJHLBDM.js';import'./chunk-B6HBR6l3.js';import'./chunk-BLwyktBH.js';import'./chunk-BUF2p97y.js';var le=(r,t)=>t.config.id,ce=(r,t)=>t.type;function ge(r,t){if(r&1&&(vs(0,"a",5),WC(1,"View resolved definition \u2192"),dl()),r&2){let e=mC();Tg("routerLink",e.inspectRoute());}}function se(r,t){r&1&&(vs(0,"span",6),WC(1,"Platform level"),dl());}function de(r,t){r&1&&(vs(0,"p",7),WC(1,"Loading\u2026"),dl());}function me(r,t){if(r&1&&(vs(0,"span",41),WC(1),dl()),r&2){let e=mC().$implicit;XE(),Zg(e.config.integrationType);}}function fe(r,t){if(r&1&&(bg(0,"input",42),HI()),r&2){let e=mC().$implicit;Tg("formControl",e.toolsControl),$I();}}function pe(r,t){if(r&1){let e=dC();vs(0,"div",37)(1,"label",38)(2,"input",39),Ag("change",function(){let l=If(e).$implicit,g=mC(3);return wf(g.toggleIntegration(l))}),dl(),vs(3,"span",40),WC(4),dl(),eC(5,me,2,1,"span",41),dl(),eC(6,fe,1,1,"input",42),dl();}if(r&2){let e=t.$implicit;XE(2),Tg("checked",e.enabled()),XE(2),Zg(e.config.name),XE(),tC(e.config.integrationType?5:-1),XE(),tC(e.enabled()?6:-1);}}function _e(r,t){if(r&1&&(vs(0,"p",48),WC(1),dl()),r&2){let e=mC().$implicit;XE(),ml(" Restricted to: ",e.restrictedTools.join(", ")," (set outside this form, preserved on save) ");}}function ue(r,t){if(r&1){let e=dC();vs(0,"div",37)(1,"label",38)(2,"span",40),WC(3),dl(),vs(4,"span",41),WC(5,"built-in"),dl()(),vs(6,"select",44),Ag("change",function(l){let g=If(e).$implicit,m=mC(4);return wf(m.setBuiltInState(g,l.target.value))}),vs(7,"option",45),WC(8),dl(),vs(9,"option",46),WC(10,"Enabled"),dl(),vs(11,"option",47),WC(12,"Disabled"),dl()(),eC(13,_e,2,1,"p",48),vs(14,"p",49),WC(15),dl()();}if(r&2){let e=t.$implicit,o=mC(4);XE(),Cg("for","built-in-"+e.type),XE(2),Zg(e.displayName),XE(3),Tg("id","built-in-"+e.type)("value",e.state()),XE(2),Zg(o.builtInDefaultLabel(e)),XE(5),tC(e.state()==="on"&&e.restrictedTools?13:-1),XE(2),Zg(e.description);}}function be(r,t){if(r&1&&(vs(0,"p",43),WC(1,"Built-in integrations"),dl(),oC(2,ue,16,7,"div",37,ce)),r&2){let e=mC(3);XE(2),iC(e.builtInRows());}}function Ce(r,t){if(r&1&&(vs(0,"fieldset",20)(1,"legend",25),WC(2,"Integrations"),dl(),vs(3,"p",36),WC(4," Select which integrations this agent can use. Leave tool names empty to allow all tools from an integration. "),dl(),oC(5,pe,7,4,"div",37,le),eC(7,be,4,0),dl()),r&2){let e=mC(2);XE(5),iC(e.integrationRows()),XE(2),tC(e.builtInRows().length>0?7:-1);}}function xe(r,t){if(r&1){let e=dC();vs(0,"li",50),bg(1,"input",51),HI(),vs(2,"button",52),Ag("click",function(){let l=If(e).$implicit,g=mC(3);return wf(g.removeSubAgent(l))}),WC(3," \u{1F5D1} "),dl()();}if(r&2){let e=t.$implicit;XE(),Tg("formControl",e.control),$I();}}function ye(r,t){if(r&1&&(vs(0,"ul",28),oC(1,xe,4,1,"li",50,nC),dl()),r&2){let e=mC(2);XE(),iC(e.subAgentRows());}}function he(r,t){if(r&1){let e=dC();vs(0,"button",53),Ag("click",function(){If(e);let l=mC(2);return wf(l.exportYaml())}),WC(1),dl();}if(r&2){let e=mC(2);Tg("disabled",e.isExporting()),XE(),ml(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function ve(r,t){if(r&1){let e=dC();vs(0,"form",9),Ag("ngSubmit",function(){If(e);let l=mC();return wf(l.submit())}),vs(1,"div",10)(2,"label",11),WC(3,"Name "),vs(4,"span",12),WC(5,"*"),dl()(),bg(6,"input",13),HI(),dl(),vs(7,"div",10)(8,"label",14),WC(9,"Description"),dl(),bg(10,"input",15),HI(),dl(),vs(11,"div",10)(12,"label",16),WC(13,"Model name"),dl(),bg(14,"input",17),HI(),dl(),vs(15,"div",10)(16,"label",18),WC(17,"Instructions"),dl(),bg(18,"textarea",19),HI(),dl(),eC(19,Ce,8,1,"fieldset",20),vs(20,"div",10)(21,"label",21),bg(22,"input",22),HI(),vs(23,"span",23),WC(24,"Advanced mode"),dl()(),vs(25,"p",24),WC(26," When enabled, this agent uses a multi-step reasoning loop instead of a single LLM call. "),dl()(),vs(27,"div",10)(28,"label",21),bg(29,"input",22),HI(),vs(30,"span",23),WC(31,"Enabled"),dl()(),vs(32,"p",24),WC(33,"Disabled agents are excluded from namespace resolution."),dl()(),vs(34,"div",10)(35,"span",25),WC(36,"Sub-agents"),dl(),vs(37,"p",26),WC(38," Glob patterns for agents this agent may delegate to. "),vs(39,"code",27),WC(40,"*"),dl(),WC(41," matches any sequence of characters (e.g.\xA0"),vs(42,"code",27),WC(43,"*Fixer"),dl(),WC(44,", "),vs(45,"code",27),WC(46,"*"),dl(),WC(47," for all). Leave empty to disable delegation. "),dl(),eC(48,ye,3,0,"ul",28),vs(49,"div",29)(50,"input",30),Ag("keydown.enter",function(){If(e);let l=mC();return wf(l.addSubAgent())}),dl(),HI(),vs(51,"button",31),Ag("click",function(){If(e);let l=mC();return wf(l.addSubAgent())}),WC(52," + "),dl()()(),vs(53,"div",32)(54,"button",33),WC(55),dl(),eC(56,he,2,2,"button",34),vs(57,"button",35),Ag("click",function(){If(e);let l=mC();return wf(l.cancel())}),WC(58,"Cancel"),dl()()();}if(r&2){let e=mC();Tg("formGroup",e.form),XE(6),Tg("formControl",e.nameControl),$I(),XE(4),Tg("formControl",e.descriptionControl),$I(),XE(4),Tg("formControl",e.modelNameControl),$I(),XE(4),Tg("formControl",e.instructionsControl),$I(),XE(),tC(e.integrationRows().length>0||e.builtInRows().length>0?19:-1),XE(3),Tg("formControl",e.advancedExecutionControl),$I(),XE(7),Tg("formControl",e.enabledControl),$I(),XE(19),tC(e.subAgentRows().length>0?48:-1),XE(2),Tg("formControl",e.newSubAgentControl),$I(),XE(),Tg("disabled",!e.newSubAgentControl.value.trim()),XE(3),Tg("disabled",e.form.invalid||e.isSubmitting()),XE(),ml(" ",e.isEditMode()?"Save changes":"Create"," "),XE(),tC(e.isEditMode()?56:-1);}}var ae=class r{route=g(V);router=g(G);destroyRef=g(we);agentConfigController=g(M);exportService=g(D);integrationConfigState=g(y);integrationTypeController=g(N);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new z({name:new _t("",{nonNullable:true,validators:[_e$1.required,_e$1.minLength(1)]}),description:new _t(null),modelName:new _t(null),instructions:new _t(null),advancedExecution:new _t(false,{nonNullable:true}),enabled:new _t(false,{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get modelNameControl(){return this.form.controls.modelName}get instructionsControl(){return this.form.controls.instructions}get advancedExecutionControl(){return this.form.controls.advancedExecution}get enabledControl(){return this.form.controls.enabled}subAgentRows=Hi([]);newSubAgentControl=new _t("",{nonNullable:true});isEditMode=Hi(false);isSubmitting=Hi(false);isLoading=Hi(false);isExporting=Hi(false);builtInRows=Hi([]);inspectRoute(){let t=this.route.snapshot.paramMap.get("agentConfigId")??"";return this.isPlatformMode?["/agentos","admin","agent-configs",t,"inspect"]:["/agentos",this.namespaceId,"agent-configs",t,"inspect"]}integrationRows=Hi([]);existingConfig=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("agentConfigId");t?(this.isEditMode.set(true),this.loadConfigAndIntegrations(t)):this.loadIntegrations(void 0);}loadConfigAndIntegrations(t){this.isLoading.set(true),By({config:this.agentConfigController.getByIdAgentConfig(t),namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):pa([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes()}).pipe(U(this.destroyRef)).subscribe({next:({config:e,namespaceIntegrations:o,platformIntegrations:l,builtInTypes:g})=>{this.existingConfig=e,this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.modelNameControl.setValue(e.modelName??null),this.instructionsControl.setValue(e.instructions??null),this.advancedExecutionControl.setValue(e.advancedExecution??false),this.enabledControl.setValue(e.enabled??true);let m=[...l,...o];this.integrationRows.set(this.buildIntegrationRows(m,e.integrations??void 0)),this.builtInRows.set(this.buildBuiltInRows(g,e.integrations??void 0)),this.subAgentRows.set((e.subAgents??[]).map(P=>({control:new _t(P,{nonNullable:true})}))),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadIntegrations(t){By({namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):pa([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes()}).pipe(U(this.destroyRef)).subscribe({next:({namespaceIntegrations:e,platformIntegrations:o,builtInTypes:l})=>{let g=[...o,...e];this.integrationRows.set(this.buildIntegrationRows(g,t??void 0)),this.builtInRows.set(this.buildBuiltInRows(l,t??void 0));}});}loadBuiltInTypes(){return this.integrationTypeController.listTypesIntegrationType().pipe(ue$1(t=>t.filter(e=>!e.configSchema)),ha(t=>(console.error("[agent-config-form] failed to load integration types",t),pa([]))))}buildIntegrationRows(t,e){return t.map(o=>{let l=o.name??"",g=e?.[l],m=e!=null&&l in e,P=Array.isArray(g)?g.join(", "):"";return {config:o,enabled:Hi(m),toolsControl:new _t(P,{nonNullable:true})}})}buildBuiltInRows(t,e){return t.map(o=>{let l=e!=null&&o.type in e,g=e?.[o.type],m=l?Array.isArray(g)&&g.length===0?"off":"on":"default";return {type:o.type,displayName:o.displayName,description:o.description,enabledByDefault:o.enabledByDefault===true,state:Hi(m),restrictedTools:Array.isArray(g)&&g.length>0?g:null}})}toggleIntegration(t){t.enabled.update(e=>!e);}setBuiltInState(t,e){t.state.set(e);}builtInDefaultLabel(t){return t.enabledByDefault?"Platform default (enabled)":"Platform default (disabled)"}addSubAgent(){let t=this.newSubAgentControl.value.trim();t&&(this.subAgentRows.update(e=>[...e,{control:new _t(t,{nonNullable:true})}]),this.newSubAgentControl.reset(""));}removeSubAgent(t){this.subAgentRows.update(e=>e.filter(o=>o!==t));}buildSubAgentsPayload(){let t=this.subAgentRows().map(e=>e.control.value.trim()).filter(e=>e.length>0);return t.length>0?t:void 0}buildIntegrationsPayload(){let t={};for(let o of this.integrationRows().filter(l=>l.enabled())){let l=o.config.name??"",g=o.toolsControl.value.trim();t[l]=g===""?null:g.split(",").map(m=>m.trim()).filter(m=>m.length>0);}for(let o of this.builtInRows()){let l=o.state();l==="on"?t[o.type]=o.restrictedTools??null:l==="off"&&(t[o.type]=[]);}let e=new Set([...this.integrationRows().map(o=>o.config.name??""),...this.builtInRows().map(o=>o.type)]);for(let[o,l]of Object.entries(this.existingConfig?.integrations??{}))e.has(o)||(t[o]=l);return Object.keys(t).length>0?t:void 0}submit(){if(this.form.invalid||this.isSubmitting())return;this.addSubAgent(),this.isSubmitting.set(true);let t=z$1(P({},this.existingConfig??{}),{createdOn:this.existingConfig?.createdOn,updatedOn:this.existingConfig?.updatedOn,namespaceId:this.namespaceId,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,modelName:this.modelNameControl.value?.trim()||void 0,instructions:this.instructionsControl.value?.trim()||void 0,integrations:this.buildIntegrationsPayload(),advancedExecution:this.advancedExecutionControl.value,enabled:this.enabledControl.value,subAgents:this.buildSubAgentsPayload()});(this.isEditMode()?this.agentConfigController.updateAgentConfig(this.existingConfig.id??"",t):this.agentConfigController.createAgentConfig(t)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}exportYaml(){let t=this.existingConfig?.id;!t||this.isExporting()||(this.isExporting.set(true),this.exportService.exportAsYaml(t).pipe(U(this.destroyRef)).subscribe({next:e=>{let o=new Blob([e],{type:"application/yaml"}),l=URL.createObjectURL(o),g=document.createElement("a");g.href=l,g.download=`${this.existingConfig?.name??"agent"}.yaml`,g.click(),URL.revokeObjectURL(l),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"]);}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=Aw({type:r,selectors:[["agentos-agent-config-form"]],decls:12,vars:4,consts:[[1,"agent-config-form"],[1,"agent-config-form__header"],["type","button","title","Back to agent configs",1,"agent-config-form__back",3,"click"],[1,"agent-config-form__back-icon"],[1,"agent-config-form__title"],[1,"agent-config-form__sibling-link",3,"routerLink"],[1,"agent-config-form__platform-badge"],[1,"agent-config-form__loading"],[1,"agent-config-form__form",3,"formGroup"],[1,"agent-config-form__form",3,"ngSubmit","formGroup"],[1,"agent-config-form__field"],["for","agent-config-name",1,"agent-config-form__label"],["aria-hidden","true"],["id","agent-config-name","type","text","placeholder","e.g. Support agent","autocomplete","off",1,"agent-config-form__input",3,"formControl"],["for","agent-config-description",1,"agent-config-form__label"],["id","agent-config-description","type","text","placeholder","Optional \u2014 short description of this agent","autocomplete","off",1,"agent-config-form__input",3,"formControl"],["for","agent-config-model-name",1,"agent-config-form__label"],["id","agent-config-model-name","type","text","placeholder","Optional \u2014 model alias or name to use","autocomplete","off",1,"agent-config-form__input",3,"formControl"],["for","agent-config-instructions",1,"agent-config-form__label"],["id","agent-config-instructions","rows","6","placeholder","Optional \u2014 system instructions for this agent",1,"agent-config-form__textarea",3,"formControl"],[1,"agent-config-form__integrations"],[1,"agent-config-form__toggle-label"],["type","checkbox",1,"agent-config-form__toggle-checkbox",3,"formControl"],[1,"agent-config-form__toggle-text"],[1,"agent-config-form__toggle-hint"],[1,"agent-config-form__label"],[1,"agent-config-form__field-hint"],[1,"agent-config-form__code"],[1,"agent-config-form__sub-agent-list"],[1,"agent-config-form__sub-agent-add"],["type","text","placeholder","e.g. *Fixer or *","autocomplete","off",1,"agent-config-form__input","agent-config-form__sub-agent-input",3,"keydown.enter","formControl"],["type","button","title","Add pattern",1,"agent-config-form__sub-agent-btn","agent-config-form__sub-agent-btn--add",3,"click","disabled"],[1,"agent-config-form__actions"],["type","submit",1,"agent-config-form__btn","agent-config-form__btn--primary",3,"disabled"],["type","button",1,"agent-config-form__btn","agent-config-form__btn--export",3,"disabled"],["type","button",1,"agent-config-form__btn",3,"click"],[1,"agent-config-form__integrations-hint"],[1,"agent-config-form__integration-row"],[1,"agent-config-form__integration-toggle"],["type","checkbox",1,"agent-config-form__integration-checkbox",3,"change","checked"],[1,"agent-config-form__integration-name"],[1,"agent-config-form__integration-type"],["type","text","placeholder","Tool names, comma-separated (empty = all tools)","autocomplete","off",1,"agent-config-form__input","agent-config-form__integration-tools",3,"formControl"],[1,"agent-config-form__integrations-separator"],[1,"agent-config-form__integration-state",3,"change","id","value"],["value","default"],["value","on"],["value","off"],[1,"agent-config-form__integration-restriction"],[1,"agent-config-form__integration-builtin-desc"],[1,"agent-config-form__sub-agent-row"],["type","text","autocomplete","off",1,"agent-config-form__input","agent-config-form__sub-agent-input",3,"formControl"],["type","button","title","Remove",1,"agent-config-form__sub-agent-btn","agent-config-form__sub-agent-btn--danger",3,"click"],["type","button",1,"agent-config-form__btn","agent-config-form__btn--export",3,"click","disabled"]],template:function(e,o){e&1&&(vs(0,"div",0)(1,"header",1)(2,"button",2),Ag("click",function(){return o.cancel()}),vs(3,"span",3),WC(4,"\u2190"),dl(),WC(5," Agent Configs "),dl(),vs(6,"h1",4),WC(7),dl(),eC(8,ge,2,1,"a",5),eC(9,se,2,0,"span",6),dl(),eC(10,de,2,0,"p",7)(11,ve,59,14,"form",8),dl()),e&2&&(XE(7),Zg(o.isEditMode()?"Edit agent config":"New agent config"),XE(),tC(o.isEditMode()?8:-1),XE(),tC(o.isPlatformMode?9:-1),XE(),tC(o.isLoading()?10:11));},dependencies:[ni,Jn,Qn,ei,Ye,wt,Zn,Xn,Cn,En,si],styles:[".agent-config-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.agent-config-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.agent-config-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)}.agent-config-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.agent-config-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.agent-config-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.agent-config-form__sibling-link[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-accent);text-decoration:none}.agent-config-form__sibling-link[_ngcontent-%COMP%]:hover{text-decoration:underline}.agent-config-form__platform-badge[_ngcontent-%COMP%]{display:inline-block;font-size:.75rem;font-weight:500;color:var(--color-text-secondary);background:var(--color-surface);border:1px solid var(--color-divider);border-radius:0;padding:.125rem .5rem;letter-spacing:.02em;align-self:flex-start}.agent-config-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.agent-config-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.agent-config-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.agent-config-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.agent-config-form__input[_ngcontent-%COMP%], .agent-config-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.agent-config-form__input[_ngcontent-%COMP%]:focus, .agent-config-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.agent-config-form__input[_ngcontent-%COMP%]::placeholder, .agent-config-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.agent-config-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:120px;line-height:1.5}.agent-config-form__integrations[_ngcontent-%COMP%]{border:1px solid var(--color-divider);border-radius:0;padding:1rem;margin:0;display:flex;flex-direction:column;gap:.75rem}.agent-config-form__integrations-hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__integration-row[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.agent-config-form__integration-toggle[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.agent-config-form__integration-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-accent);cursor:pointer}.agent-config-form__integration-name[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text)}.agent-config-form__integration-type[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);font-family:monospace}.agent-config-form__integration-tools[_ngcontent-%COMP%]{margin-left:1.5rem;font-size:.875rem}.agent-config-form__integrations-separator[_ngcontent-%COMP%]{margin:.25rem 0 0;padding-top:.5rem;border-top:1px solid var(--color-divider);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);font-family:var(--font-heading)}.agent-config-form__integration-state[_ngcontent-%COMP%]{margin-left:1.5rem;padding:.375rem .625rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.875rem;font-family:inherit;outline:none;transition:border-color .15s ease}.agent-config-form__integration-state[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.agent-config-form__integration-restriction[_ngcontent-%COMP%]{margin:0 0 0 1.5rem;font-size:.8rem;font-style:italic;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.agent-config-form__integration-builtin-desc[_ngcontent-%COMP%]{margin:0 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__field-hint[_ngcontent-%COMP%]{margin:.25rem 0 0;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__code[_ngcontent-%COMP%]{font-family:monospace;font-size:.85em;background:var(--color-surface-muted, rgba(0, 0, 0, .06));padding:.1em .3em;border-radius:0}.agent-config-form__sub-agent-list[_ngcontent-%COMP%]{list-style:none;margin:.5rem 0 0;padding:0;display:flex;flex-direction:column;gap:.375rem}.agent-config-form__sub-agent-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem}.agent-config-form__sub-agent-input[_ngcontent-%COMP%]{flex:1;min-width:0}.agent-config-form__sub-agent-add[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;margin-top:.5rem}.agent-config-form__sub-agent-btn[_ngcontent-%COMP%]{flex-shrink:0;width:2rem;height:2rem;padding:0;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text-secondary);font-size:.9rem;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .15s ease,border-color .15s ease,color .15s ease}.agent-config-form__sub-agent-btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500);color:var(--color-text)}.agent-config-form__sub-agent-btn[_ngcontent-%COMP%]:disabled{opacity:.35;cursor:not-allowed}.agent-config-form__sub-agent-btn--add[_ngcontent-%COMP%]{width:2rem;height:2rem;font-size:1.25rem;font-weight:300;border-color:var(--color-accent);color:var(--color-accent)}.agent-config-form__sub-agent-btn--add[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent);color:#fff}.agent-config-form__sub-agent-btn--danger[_ngcontent-%COMP%]{border:1px solid transparent;color:var(--color-neutral-500)}.agent-config-form__sub-agent-btn--danger[_ngcontent-%COMP%]:hover:not(:disabled){border-color:var(--red);color:var(--red);background:color-mix(in srgb,var(--red) 10%,transparent)}.agent-config-form__toggle-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.agent-config-form__toggle-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-accent);cursor:pointer}.agent-config-form__toggle-text[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text)}.agent-config-form__toggle-hint[_ngcontent-%COMP%]{margin:.25rem 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.agent-config-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}.agent-config-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.agent-config-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.agent-config-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.agent-config-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}"]})};export{ae as AgentConfigFormComponent};
|
|
1
|
+
import {y}from'./chunk-BUPJDuFO.js';import {g,ao as V,G,w as we,d8 as M,dk as D,d5 as N,H as Hi,Q as By,S as pa,b as U,u as ue$1,a7 as ha,z as z$1,a as P,A as Aw,s as si,v as vs,l as Ag,W as WC,k as dl,n as eC,X as XE,a8 as Zg,t as tC,ac as mC,r as Tg,a9 as dC,o as bg,a3 as HI,a6 as $I,a5 as ml,q as oC,x as iC,bn as nC,aa as If,ab as wf,C as Cg}from'./main-Z5SI5ZVQ.js';import'./chunk-CK3s5ul2.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,a as wt,Z as Zn,l as Xn,C as Cn,E as En}from'./chunk-BXfg4Cn0.js';import'./chunk-DEYaa_7l.js';import'./chunk-kfNFXWlK.js';import'./chunk-McdsPwbe.js';import'./chunk-CL8NUXXa.js';var le=(r,t)=>t.config.id,ce=(r,t)=>t.type;function ge(r,t){if(r&1&&(vs(0,"a",5),WC(1,"View resolved definition \u2192"),dl()),r&2){let e=mC();Tg("routerLink",e.inspectRoute());}}function se(r,t){r&1&&(vs(0,"span",6),WC(1,"Platform level"),dl());}function de(r,t){r&1&&(vs(0,"p",7),WC(1,"Loading\u2026"),dl());}function me(r,t){if(r&1&&(vs(0,"span",41),WC(1),dl()),r&2){let e=mC().$implicit;XE(),Zg(e.config.integrationType);}}function fe(r,t){if(r&1&&(bg(0,"input",42),HI()),r&2){let e=mC().$implicit;Tg("formControl",e.toolsControl),$I();}}function pe(r,t){if(r&1){let e=dC();vs(0,"div",37)(1,"label",38)(2,"input",39),Ag("change",function(){let l=If(e).$implicit,g=mC(3);return wf(g.toggleIntegration(l))}),dl(),vs(3,"span",40),WC(4),dl(),eC(5,me,2,1,"span",41),dl(),eC(6,fe,1,1,"input",42),dl();}if(r&2){let e=t.$implicit;XE(2),Tg("checked",e.enabled()),XE(2),Zg(e.config.name),XE(),tC(e.config.integrationType?5:-1),XE(),tC(e.enabled()?6:-1);}}function _e(r,t){if(r&1&&(vs(0,"p",48),WC(1),dl()),r&2){let e=mC().$implicit;XE(),ml(" Restricted to: ",e.restrictedTools.join(", ")," (set outside this form, preserved on save) ");}}function ue(r,t){if(r&1){let e=dC();vs(0,"div",37)(1,"label",38)(2,"span",40),WC(3),dl(),vs(4,"span",41),WC(5,"built-in"),dl()(),vs(6,"select",44),Ag("change",function(l){let g=If(e).$implicit,m=mC(4);return wf(m.setBuiltInState(g,l.target.value))}),vs(7,"option",45),WC(8),dl(),vs(9,"option",46),WC(10,"Enabled"),dl(),vs(11,"option",47),WC(12,"Disabled"),dl()(),eC(13,_e,2,1,"p",48),vs(14,"p",49),WC(15),dl()();}if(r&2){let e=t.$implicit,o=mC(4);XE(),Cg("for","built-in-"+e.type),XE(2),Zg(e.displayName),XE(3),Tg("id","built-in-"+e.type)("value",e.state()),XE(2),Zg(o.builtInDefaultLabel(e)),XE(5),tC(e.state()==="on"&&e.restrictedTools?13:-1),XE(2),Zg(e.description);}}function be(r,t){if(r&1&&(vs(0,"p",43),WC(1,"Built-in integrations"),dl(),oC(2,ue,16,7,"div",37,ce)),r&2){let e=mC(3);XE(2),iC(e.builtInRows());}}function Ce(r,t){if(r&1&&(vs(0,"fieldset",20)(1,"legend",25),WC(2,"Integrations"),dl(),vs(3,"p",36),WC(4," Select which integrations this agent can use. Leave tool names empty to allow all tools from an integration. "),dl(),oC(5,pe,7,4,"div",37,le),eC(7,be,4,0),dl()),r&2){let e=mC(2);XE(5),iC(e.integrationRows()),XE(2),tC(e.builtInRows().length>0?7:-1);}}function xe(r,t){if(r&1){let e=dC();vs(0,"li",50),bg(1,"input",51),HI(),vs(2,"button",52),Ag("click",function(){let l=If(e).$implicit,g=mC(3);return wf(g.removeSubAgent(l))}),WC(3," \u{1F5D1} "),dl()();}if(r&2){let e=t.$implicit;XE(),Tg("formControl",e.control),$I();}}function ye(r,t){if(r&1&&(vs(0,"ul",28),oC(1,xe,4,1,"li",50,nC),dl()),r&2){let e=mC(2);XE(),iC(e.subAgentRows());}}function he(r,t){if(r&1){let e=dC();vs(0,"button",53),Ag("click",function(){If(e);let l=mC(2);return wf(l.exportYaml())}),WC(1),dl();}if(r&2){let e=mC(2);Tg("disabled",e.isExporting()),XE(),ml(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function ve(r,t){if(r&1){let e=dC();vs(0,"form",9),Ag("ngSubmit",function(){If(e);let l=mC();return wf(l.submit())}),vs(1,"div",10)(2,"label",11),WC(3,"Name "),vs(4,"span",12),WC(5,"*"),dl()(),bg(6,"input",13),HI(),dl(),vs(7,"div",10)(8,"label",14),WC(9,"Description"),dl(),bg(10,"input",15),HI(),dl(),vs(11,"div",10)(12,"label",16),WC(13,"Model name"),dl(),bg(14,"input",17),HI(),dl(),vs(15,"div",10)(16,"label",18),WC(17,"Instructions"),dl(),bg(18,"textarea",19),HI(),dl(),eC(19,Ce,8,1,"fieldset",20),vs(20,"div",10)(21,"label",21),bg(22,"input",22),HI(),vs(23,"span",23),WC(24,"Advanced mode"),dl()(),vs(25,"p",24),WC(26," When enabled, this agent uses a multi-step reasoning loop instead of a single LLM call. "),dl()(),vs(27,"div",10)(28,"label",21),bg(29,"input",22),HI(),vs(30,"span",23),WC(31,"Enabled"),dl()(),vs(32,"p",24),WC(33,"Disabled agents are excluded from namespace resolution."),dl()(),vs(34,"div",10)(35,"span",25),WC(36,"Sub-agents"),dl(),vs(37,"p",26),WC(38," Glob patterns for agents this agent may delegate to. "),vs(39,"code",27),WC(40,"*"),dl(),WC(41," matches any sequence of characters (e.g.\xA0"),vs(42,"code",27),WC(43,"*Fixer"),dl(),WC(44,", "),vs(45,"code",27),WC(46,"*"),dl(),WC(47," for all). Leave empty to disable delegation. "),dl(),eC(48,ye,3,0,"ul",28),vs(49,"div",29)(50,"input",30),Ag("keydown.enter",function(){If(e);let l=mC();return wf(l.addSubAgent())}),dl(),HI(),vs(51,"button",31),Ag("click",function(){If(e);let l=mC();return wf(l.addSubAgent())}),WC(52," + "),dl()()(),vs(53,"div",32)(54,"button",33),WC(55),dl(),eC(56,he,2,2,"button",34),vs(57,"button",35),Ag("click",function(){If(e);let l=mC();return wf(l.cancel())}),WC(58,"Cancel"),dl()()();}if(r&2){let e=mC();Tg("formGroup",e.form),XE(6),Tg("formControl",e.nameControl),$I(),XE(4),Tg("formControl",e.descriptionControl),$I(),XE(4),Tg("formControl",e.modelNameControl),$I(),XE(4),Tg("formControl",e.instructionsControl),$I(),XE(),tC(e.integrationRows().length>0||e.builtInRows().length>0?19:-1),XE(3),Tg("formControl",e.advancedExecutionControl),$I(),XE(7),Tg("formControl",e.enabledControl),$I(),XE(19),tC(e.subAgentRows().length>0?48:-1),XE(2),Tg("formControl",e.newSubAgentControl),$I(),XE(),Tg("disabled",!e.newSubAgentControl.value.trim()),XE(3),Tg("disabled",e.form.invalid||e.isSubmitting()),XE(),ml(" ",e.isEditMode()?"Save changes":"Create"," "),XE(),tC(e.isEditMode()?56:-1);}}var ae=class r{route=g(V);router=g(G);destroyRef=g(we);agentConfigController=g(M);exportService=g(D);integrationConfigState=g(y);integrationTypeController=g(N);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new z({name:new _t("",{nonNullable:true,validators:[_e$1.required,_e$1.minLength(1)]}),description:new _t(null),modelName:new _t(null),instructions:new _t(null),advancedExecution:new _t(false,{nonNullable:true}),enabled:new _t(false,{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get modelNameControl(){return this.form.controls.modelName}get instructionsControl(){return this.form.controls.instructions}get advancedExecutionControl(){return this.form.controls.advancedExecution}get enabledControl(){return this.form.controls.enabled}subAgentRows=Hi([]);newSubAgentControl=new _t("",{nonNullable:true});isEditMode=Hi(false);isSubmitting=Hi(false);isLoading=Hi(false);isExporting=Hi(false);builtInRows=Hi([]);inspectRoute(){let t=this.route.snapshot.paramMap.get("agentConfigId")??"";return this.isPlatformMode?["/agentos","admin","agent-configs",t,"inspect"]:["/agentos",this.namespaceId,"agent-configs",t,"inspect"]}integrationRows=Hi([]);existingConfig=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("agentConfigId");t?(this.isEditMode.set(true),this.loadConfigAndIntegrations(t)):this.loadIntegrations(void 0);}loadConfigAndIntegrations(t){this.isLoading.set(true),By({config:this.agentConfigController.getByIdAgentConfig(t),namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):pa([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes()}).pipe(U(this.destroyRef)).subscribe({next:({config:e,namespaceIntegrations:o,platformIntegrations:l,builtInTypes:g})=>{this.existingConfig=e,this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.modelNameControl.setValue(e.modelName??null),this.instructionsControl.setValue(e.instructions??null),this.advancedExecutionControl.setValue(e.advancedExecution??false),this.enabledControl.setValue(e.enabled??true);let m=[...l,...o];this.integrationRows.set(this.buildIntegrationRows(m,e.integrations??void 0)),this.builtInRows.set(this.buildBuiltInRows(g,e.integrations??void 0)),this.subAgentRows.set((e.subAgents??[]).map(P=>({control:new _t(P,{nonNullable:true})}))),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadIntegrations(t){By({namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):pa([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes()}).pipe(U(this.destroyRef)).subscribe({next:({namespaceIntegrations:e,platformIntegrations:o,builtInTypes:l})=>{let g=[...o,...e];this.integrationRows.set(this.buildIntegrationRows(g,t??void 0)),this.builtInRows.set(this.buildBuiltInRows(l,t??void 0));}});}loadBuiltInTypes(){return this.integrationTypeController.listTypesIntegrationType().pipe(ue$1(t=>t.filter(e=>!e.configSchema)),ha(t=>(console.error("[agent-config-form] failed to load integration types",t),pa([]))))}buildIntegrationRows(t,e){return t.map(o=>{let l=o.name??"",g=e?.[l],m=e!=null&&l in e,P=Array.isArray(g)?g.join(", "):"";return {config:o,enabled:Hi(m),toolsControl:new _t(P,{nonNullable:true})}})}buildBuiltInRows(t,e){return t.map(o=>{let l=e!=null&&o.type in e,g=e?.[o.type],m=l?Array.isArray(g)&&g.length===0?"off":"on":"default";return {type:o.type,displayName:o.displayName,description:o.description,enabledByDefault:o.enabledByDefault===true,state:Hi(m),restrictedTools:Array.isArray(g)&&g.length>0?g:null}})}toggleIntegration(t){t.enabled.update(e=>!e);}setBuiltInState(t,e){t.state.set(e);}builtInDefaultLabel(t){return t.enabledByDefault?"Platform default (enabled)":"Platform default (disabled)"}addSubAgent(){let t=this.newSubAgentControl.value.trim();t&&(this.subAgentRows.update(e=>[...e,{control:new _t(t,{nonNullable:true})}]),this.newSubAgentControl.reset(""));}removeSubAgent(t){this.subAgentRows.update(e=>e.filter(o=>o!==t));}buildSubAgentsPayload(){let t=this.subAgentRows().map(e=>e.control.value.trim()).filter(e=>e.length>0);return t.length>0?t:void 0}buildIntegrationsPayload(){let t={};for(let o of this.integrationRows().filter(l=>l.enabled())){let l=o.config.name??"",g=o.toolsControl.value.trim();t[l]=g===""?null:g.split(",").map(m=>m.trim()).filter(m=>m.length>0);}for(let o of this.builtInRows()){let l=o.state();l==="on"?t[o.type]=o.restrictedTools??null:l==="off"&&(t[o.type]=[]);}let e=new Set([...this.integrationRows().map(o=>o.config.name??""),...this.builtInRows().map(o=>o.type)]);for(let[o,l]of Object.entries(this.existingConfig?.integrations??{}))e.has(o)||(t[o]=l);return Object.keys(t).length>0?t:void 0}submit(){if(this.form.invalid||this.isSubmitting())return;this.addSubAgent(),this.isSubmitting.set(true);let t=z$1(P({},this.existingConfig??{}),{createdOn:this.existingConfig?.createdOn,updatedOn:this.existingConfig?.updatedOn,namespaceId:this.namespaceId,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,modelName:this.modelNameControl.value?.trim()||void 0,instructions:this.instructionsControl.value?.trim()||void 0,integrations:this.buildIntegrationsPayload(),advancedExecution:this.advancedExecutionControl.value,enabled:this.enabledControl.value,subAgents:this.buildSubAgentsPayload()});(this.isEditMode()?this.agentConfigController.updateAgentConfig(this.existingConfig.id??"",t):this.agentConfigController.createAgentConfig(t)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}exportYaml(){let t=this.existingConfig?.id;!t||this.isExporting()||(this.isExporting.set(true),this.exportService.exportAsYaml(t).pipe(U(this.destroyRef)).subscribe({next:e=>{let o=new Blob([e],{type:"application/yaml"}),l=URL.createObjectURL(o),g=document.createElement("a");g.href=l,g.download=`${this.existingConfig?.name??"agent"}.yaml`,g.click(),URL.revokeObjectURL(l),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"]);}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=Aw({type:r,selectors:[["agentos-agent-config-form"]],decls:12,vars:4,consts:[[1,"agent-config-form"],[1,"agent-config-form__header"],["type","button","title","Back to agent configs",1,"agent-config-form__back",3,"click"],[1,"agent-config-form__back-icon"],[1,"agent-config-form__title"],[1,"agent-config-form__sibling-link",3,"routerLink"],[1,"agent-config-form__platform-badge"],[1,"agent-config-form__loading"],[1,"agent-config-form__form",3,"formGroup"],[1,"agent-config-form__form",3,"ngSubmit","formGroup"],[1,"agent-config-form__field"],["for","agent-config-name",1,"agent-config-form__label"],["aria-hidden","true"],["id","agent-config-name","type","text","placeholder","e.g. Support agent","autocomplete","off",1,"agent-config-form__input",3,"formControl"],["for","agent-config-description",1,"agent-config-form__label"],["id","agent-config-description","type","text","placeholder","Optional \u2014 short description of this agent","autocomplete","off",1,"agent-config-form__input",3,"formControl"],["for","agent-config-model-name",1,"agent-config-form__label"],["id","agent-config-model-name","type","text","placeholder","Optional \u2014 model alias or name to use","autocomplete","off",1,"agent-config-form__input",3,"formControl"],["for","agent-config-instructions",1,"agent-config-form__label"],["id","agent-config-instructions","rows","6","placeholder","Optional \u2014 system instructions for this agent",1,"agent-config-form__textarea",3,"formControl"],[1,"agent-config-form__integrations"],[1,"agent-config-form__toggle-label"],["type","checkbox",1,"agent-config-form__toggle-checkbox",3,"formControl"],[1,"agent-config-form__toggle-text"],[1,"agent-config-form__toggle-hint"],[1,"agent-config-form__label"],[1,"agent-config-form__field-hint"],[1,"agent-config-form__code"],[1,"agent-config-form__sub-agent-list"],[1,"agent-config-form__sub-agent-add"],["type","text","placeholder","e.g. *Fixer or *","autocomplete","off",1,"agent-config-form__input","agent-config-form__sub-agent-input",3,"keydown.enter","formControl"],["type","button","title","Add pattern",1,"agent-config-form__sub-agent-btn","agent-config-form__sub-agent-btn--add",3,"click","disabled"],[1,"agent-config-form__actions"],["type","submit",1,"agent-config-form__btn","agent-config-form__btn--primary",3,"disabled"],["type","button",1,"agent-config-form__btn","agent-config-form__btn--export",3,"disabled"],["type","button",1,"agent-config-form__btn",3,"click"],[1,"agent-config-form__integrations-hint"],[1,"agent-config-form__integration-row"],[1,"agent-config-form__integration-toggle"],["type","checkbox",1,"agent-config-form__integration-checkbox",3,"change","checked"],[1,"agent-config-form__integration-name"],[1,"agent-config-form__integration-type"],["type","text","placeholder","Tool names, comma-separated (empty = all tools)","autocomplete","off",1,"agent-config-form__input","agent-config-form__integration-tools",3,"formControl"],[1,"agent-config-form__integrations-separator"],[1,"agent-config-form__integration-state",3,"change","id","value"],["value","default"],["value","on"],["value","off"],[1,"agent-config-form__integration-restriction"],[1,"agent-config-form__integration-builtin-desc"],[1,"agent-config-form__sub-agent-row"],["type","text","autocomplete","off",1,"agent-config-form__input","agent-config-form__sub-agent-input",3,"formControl"],["type","button","title","Remove",1,"agent-config-form__sub-agent-btn","agent-config-form__sub-agent-btn--danger",3,"click"],["type","button",1,"agent-config-form__btn","agent-config-form__btn--export",3,"click","disabled"]],template:function(e,o){e&1&&(vs(0,"div",0)(1,"header",1)(2,"button",2),Ag("click",function(){return o.cancel()}),vs(3,"span",3),WC(4,"\u2190"),dl(),WC(5," Agent Configs "),dl(),vs(6,"h1",4),WC(7),dl(),eC(8,ge,2,1,"a",5),eC(9,se,2,0,"span",6),dl(),eC(10,de,2,0,"p",7)(11,ve,59,14,"form",8),dl()),e&2&&(XE(7),Zg(o.isEditMode()?"Edit agent config":"New agent config"),XE(),tC(o.isEditMode()?8:-1),XE(),tC(o.isPlatformMode?9:-1),XE(),tC(o.isLoading()?10:11));},dependencies:[ni,Jn,Qn,ei,Ye,wt,Zn,Xn,Cn,En,si],styles:[".agent-config-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.agent-config-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.agent-config-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)}.agent-config-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.agent-config-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.agent-config-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.agent-config-form__sibling-link[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-accent);text-decoration:none}.agent-config-form__sibling-link[_ngcontent-%COMP%]:hover{text-decoration:underline}.agent-config-form__platform-badge[_ngcontent-%COMP%]{display:inline-block;font-size:.75rem;font-weight:500;color:var(--color-text-secondary);background:var(--color-surface);border:1px solid var(--color-divider);border-radius:0;padding:.125rem .5rem;letter-spacing:.02em;align-self:flex-start}.agent-config-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.agent-config-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.agent-config-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.agent-config-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.agent-config-form__input[_ngcontent-%COMP%], .agent-config-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.agent-config-form__input[_ngcontent-%COMP%]:focus, .agent-config-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.agent-config-form__input[_ngcontent-%COMP%]::placeholder, .agent-config-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.agent-config-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:120px;line-height:1.5}.agent-config-form__integrations[_ngcontent-%COMP%]{border:1px solid var(--color-divider);border-radius:0;padding:1rem;margin:0;display:flex;flex-direction:column;gap:.75rem}.agent-config-form__integrations-hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__integration-row[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.agent-config-form__integration-toggle[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.agent-config-form__integration-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-accent);cursor:pointer}.agent-config-form__integration-name[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text)}.agent-config-form__integration-type[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);font-family:monospace}.agent-config-form__integration-tools[_ngcontent-%COMP%]{margin-left:1.5rem;font-size:.875rem}.agent-config-form__integrations-separator[_ngcontent-%COMP%]{margin:.25rem 0 0;padding-top:.5rem;border-top:1px solid var(--color-divider);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);font-family:var(--font-heading)}.agent-config-form__integration-state[_ngcontent-%COMP%]{margin-left:1.5rem;padding:.375rem .625rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.875rem;font-family:inherit;outline:none;transition:border-color .15s ease}.agent-config-form__integration-state[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.agent-config-form__integration-restriction[_ngcontent-%COMP%]{margin:0 0 0 1.5rem;font-size:.8rem;font-style:italic;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.agent-config-form__integration-builtin-desc[_ngcontent-%COMP%]{margin:0 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__field-hint[_ngcontent-%COMP%]{margin:.25rem 0 0;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__code[_ngcontent-%COMP%]{font-family:monospace;font-size:.85em;background:var(--color-surface-muted, rgba(0, 0, 0, .06));padding:.1em .3em;border-radius:0}.agent-config-form__sub-agent-list[_ngcontent-%COMP%]{list-style:none;margin:.5rem 0 0;padding:0;display:flex;flex-direction:column;gap:.375rem}.agent-config-form__sub-agent-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem}.agent-config-form__sub-agent-input[_ngcontent-%COMP%]{flex:1;min-width:0}.agent-config-form__sub-agent-add[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;margin-top:.5rem}.agent-config-form__sub-agent-btn[_ngcontent-%COMP%]{flex-shrink:0;width:2rem;height:2rem;padding:0;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text-secondary);font-size:.9rem;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .15s ease,border-color .15s ease,color .15s ease}.agent-config-form__sub-agent-btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500);color:var(--color-text)}.agent-config-form__sub-agent-btn[_ngcontent-%COMP%]:disabled{opacity:.35;cursor:not-allowed}.agent-config-form__sub-agent-btn--add[_ngcontent-%COMP%]{width:2rem;height:2rem;font-size:1.25rem;font-weight:300;border-color:var(--color-accent);color:var(--color-accent)}.agent-config-form__sub-agent-btn--add[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent);color:#fff}.agent-config-form__sub-agent-btn--danger[_ngcontent-%COMP%]{border:1px solid transparent;color:var(--color-neutral-500)}.agent-config-form__sub-agent-btn--danger[_ngcontent-%COMP%]:hover:not(:disabled){border-color:var(--red);color:var(--red);background:color-mix(in srgb,var(--red) 10%,transparent)}.agent-config-form__toggle-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.agent-config-form__toggle-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-accent);cursor:pointer}.agent-config-form__toggle-text[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text)}.agent-config-form__toggle-hint[_ngcontent-%COMP%]{margin:.25rem 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.agent-config-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}.agent-config-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.agent-config-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.agent-config-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.agent-config-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}"]})};export{ae as AgentConfigFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {i}from'./chunk-
|
|
1
|
+
import {i}from'./chunk-DEYaa_7l.js';import {u}from'./chunk-CK3s5ul2.js';import {g as g$1,dd as $,aI as Tr,aD as Ly,bR as ga,a7 as ha,S as pa,u as ue,cD as Rd,bT as Od,a as P,Y as x}from'./main-Z5SI5ZVQ.js';var g="none",N="me",O=class p{nsController=g$1($);userState=g$1(u);refresh$=new Tr(void 0);namespaceId$=new Tr(null);vm$=Ly([this.namespaceId$,this.refresh$]).pipe(ga(([e])=>{let r=this.loadPlatformProviders().pipe(ha(()=>pa([])));return e?Ly([r,this.loadNamespaceProviders(e).pipe(ha(()=>pa([]))),this.loadUserProviders(e).pipe(ha(()=>pa([]))),this.loadUserProviders("global").pipe(ha(()=>pa([])))]).pipe(ue(([i,n,s,t])=>({platform:i,namespace:n,userOnNs:s,userGlobal:t}))):Ly([r,this.loadNamespaceProviders("").pipe(ha(()=>pa([]))),this.loadUserProviders("global").pipe(ha(()=>pa([])))]).pipe(ue(([i,n,s])=>({platform:i,namespace:n,userOnNs:[],userGlobal:s})))}),Rd({bufferSize:1,refCount:true}));setNamespace(e){this.namespaceId$.value!==e&&this.namespaceId$.next(e);}refresh(){this.refresh$.next();}loadUserProviders(e){let r=e==="global"?g:e;return this.nsController.listAiProvider(r,N)}userGlobal$=i(this.refresh$,()=>this.loadUserProviders("global"),[]);loadPlatformProviders(){return this.nsController.listAiProvider(g)}loadNamespaceProviders(e){return e?this.nsController.listAiProvider(e):pa([])}getById(e,r){return this.nsController.getByIdAiProvider(e)}create(e,r,i){let s=this.userState.currentUser()?.id;if((r==="userOnNs"||r==="userGlobal")&&!s)throw new Error(`Cannot create ${r} provider before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(r==="namespace"){if(i===void 0||i==="")throw new Error("Cannot create namespace-scoped provider without a namespaceId");let S={name:e.name,apiType:e.apiType,description:e.description,baseUrl:e.baseUrl,apiKey:e.apiKey,headers:e.headers??void 0,namespaceId:i??void 0};return this.nsController.createAiProvider(S).pipe(Od(()=>this.refresh()))}if(r==="userOnNs"&&!i)throw new Error("Cannot create userOnNs provider without a namespaceId");let t={name:e.name,apiType:e.apiType,description:e.description,baseUrl:e.baseUrl,apiKey:e.apiKey,headers:e.headers??void 0,userId:s,namespaceId:r==="userOnNs"?i:void 0};return this.nsController.createAiProvider(t).pipe(Od(()=>this.refresh()))}update(e,r,i,n){let s=r.apiKey===null?{}:{apiKey:r.apiKey},t=P({name:r.name,apiType:r.apiType,description:r.description,baseUrl:r.baseUrl,headers:r.headers??void 0,namespaceId:n.namespaceId,userId:n.userId},s);return this.nsController.updateAiProvider(e,t).pipe(Od(()=>this.refresh()))}delete(e,r){return this.nsController.deleteAiProvider(e).pipe(Od(()=>this.refresh()))}static \u0275fac=function(r){return new(r||p)};static \u0275prov=x({token:p,factory:p.\u0275fac,providedIn:"root"})};export{O};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {i}from'./chunk-
|
|
1
|
+
import {i}from'./chunk-DEYaa_7l.js';import {u}from'./chunk-CK3s5ul2.js';import {g,d6 as U$1,aI as Tr,aD as Ly,bR as ga,a7 as ha,S as pa,u as ue,cD as Rd,z as z$1,a as P,bT as Od,Y as x}from'./main-Z5SI5ZVQ.js';var q=["ApiKeyAuthSetting","BasicAuthAuthSetting","BearerTokenAuthSetting","OAuthDiscoverableAuthSetting","OAuthMcpDiscoverableAuthSetting","OAuthCustomAuthSetting","OAuthRegisteredAuthSetting"],J={ApiKeyAuthSetting:"API Key",BasicAuthAuthSetting:"Basic Auth (username / password)",BearerTokenAuthSetting:"Bearer Token",OAuthDiscoverableAuthSetting:"OAuth \u2014 Discovery URL",OAuthMcpDiscoverableAuthSetting:"OAuth \u2014 MCP Discoverable",OAuthCustomAuthSetting:"OAuth \u2014 Custom endpoints",OAuthRegisteredAuthSetting:"OAuth \u2014 Registered app"},_="none",C="me",I={ApiKeyAuthSetting:"API_KEY",BasicAuthAuthSetting:"BASIC_AUTH",BearerTokenAuthSetting:"BEARER_TOKEN",OAuthDiscoverableAuthSetting:"OAUTH_DISCOVERABLE",OAuthMcpDiscoverableAuthSetting:"OAUTH_MCP_DISCOVERABLE",OAuthCustomAuthSetting:"OAUTH_CUSTOM",OAuthRegisteredAuthSetting:"OAUTH_REGISTERED"},U={API_KEY:"ApiKeyAuthSetting",BASIC_AUTH:"BasicAuthAuthSetting",BEARER_TOKEN:"BearerTokenAuthSetting",OAUTH_DISCOVERABLE:"OAuthDiscoverableAuthSetting",OAUTH_MCP_DISCOVERABLE:"OAuthMcpDiscoverableAuthSetting",OAUTH_CUSTOM:"OAuthCustomAuthSetting",OAUTH_REGISTERED:"OAuthRegisteredAuthSetting"};function E(n){let t=I[n.authType];return t?z$1(P({},n),{authType:t}):n}function d(n){return R(n)}function O(n){return n.map(R)}function R(n){let t=n;if(typeof t.authType=="string"){let e=U[t.authType];if(e)return z$1(P({},t),{authType:e})}return n}var v=class n{controller=g(U$1);userState=g(u);refresh$=new Tr(void 0);namespaceId$=new Tr(null);vm$=Ly([this.namespaceId$,this.refresh$]).pipe(ga(([t])=>{let e=this.loadPlatformSettings().pipe(ha(()=>pa([])));return t?Ly([e,this.loadNamespaceSettings(t).pipe(ha(()=>pa([]))),this.loadUserSettings(t).pipe(ha(()=>pa([]))),this.loadUserSettings("global").pipe(ha(()=>pa([])))]).pipe(ue(([i,s,u,p])=>({platform:i,namespace:s,userOnNs:u,userGlobal:p}))):Ly([e,this.loadNamespaceSettings("").pipe(ha(()=>pa([]))),this.loadUserSettings("global").pipe(ha(()=>pa([])))]).pipe(ue(([i,s,u])=>({platform:i,namespace:s,userOnNs:[],userGlobal:u})))}),Rd({bufferSize:1,refCount:true}));setNamespace(t){this.namespaceId$.value!==t&&this.namespaceId$.next(t);}refresh(){this.refresh$.next();}loadUserSettings(t){let e=t==="global"?_:t;return this.controller.listAuthSetting(e,C).pipe(ue(i=>O(i)))}userGlobal$=i(this.refresh$,()=>this.loadUserSettings("global"),[]);loadPlatformSettings(){return this.controller.listAuthSetting().pipe(ue(t=>O(t)))}loadNamespaceSettings(t){return t?this.controller.listAuthSetting(t).pipe(ue(e=>O(e))):pa([])}getById(t,e){return this.controller.getByIdAuthSetting(t).pipe(ue(i=>d(i)))}create(t,e,i){let u=this.userState.currentUser()?.id;if((e==="userOnNs"||e==="userGlobal")&&!u)throw new Error(`Cannot create ${e} auth setting before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(e==="namespace"&&(i===void 0||i===""))throw new Error("Cannot create namespace-scoped auth setting without a namespaceId");if(e==="userOnNs"&&!i)throw new Error("Cannot create userOnNs auth setting without a namespaceId");let p=E(z$1(P({},t),{namespaceId:e==="namespace"||e==="userOnNs"?i??void 0:void 0,userId:e==="userOnNs"||e==="userGlobal"?u:void 0}));return this.controller.createAuthSetting(p).pipe(ue(B=>d(B)),Od(()=>this.refresh()))}update(t,e,i){let s=E(z$1(P({},e),{namespaceId:i.namespaceId,userId:i.userId,authType:i.authType}));return this.controller.updateAuthSetting(t,s).pipe(ue(u=>d(u)),Od(()=>this.refresh()))}delete(t,e){return this.controller.deleteAuthSetting(t).pipe(Od(()=>this.refresh()))}static \u0275fac=function(e){return new(e||n)};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};export{J,q,v};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {O}from'./chunk-
|
|
1
|
+
import {O}from'./chunk-DCcqC6CZ.js';import {g,G,w as we,d8 as M,aI as Tr,bR as ga,u as ue,b as U,A as Aw,aJ as Nb,v as vs,be as aT,l as Ag,k as dl,af as Dg,T as TC,r as Tg,bf as uT,ah as rT,n as eC,ac as mC,t as tC,a9 as dC,aa as If,ab as wf,ag as fT}from'./main-Z5SI5ZVQ.js';import {W as Wn,D as De}from'./chunk-McdsPwbe.js';import'./chunk-CL8NUXXa.js';import'./chunk-BXfg4Cn0.js';var S=()=>[];function F(n,t){if(n&1){let e=dC();vs(0,"agentos-agent-config-item",4),Ag("deleteRequested",function(o){If(e);let E=mC(2);return wf(E.deleteConfig(o))}),dl();}n&2&&Tg("config",t)("platformMode",true);}function L(n,t){if(n&1&&eC(0,F,1,2,"agentos-agent-config-item",3),n&2){let e,i=t.$implicit,o=mC();tC((e=o.resolveConfig(i.id))?0:-1,e);}}var D=class n{router=g(G);destroyRef=g(we);agentConfigController=g(M);refresh$=new Tr(void 0);configs$=this.refresh$.pipe(ga(()=>this.agentConfigController.listPlatformAgentsAgentConfig(true)));configItems$=this.configs$.pipe(ue(t=>t.map(e=>({id:e.id??"",name:e.name,description:e.description}))));configsById=new Map;constructor(){this.configs$.pipe(U(this.destroyRef)).subscribe(t=>{this.configsById=new Map(t.map(e=>[e.id??"",e]));});}goBack(){this.router.navigate(["/agentos","admin"]);}openCreateForm(){this.router.navigate(["/agentos","admin","agent-configs","new"]);}deleteConfig(t){this.agentConfigController.deleteAgentConfig(t.id??"").pipe(U(this.destroyRef)).subscribe(()=>this.refresh$.next());}resolveConfig(t){return this.configsById.get(t)??null}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Aw({type:n,selectors:[["agentos-platform-agent-configs"]],decls:5,vars:6,consts:[["agentConfigItemTpl",""],["title","Platform Agent Configs","emptyMessage","No platform agent configs defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[3,"config","platformMode"],[3,"deleteRequested","config","platformMode"]],template:function(e,i){if(e&1&&(vs(0,"ds-entity-list",1),aT(1,"async"),Ag("createRequested",function(){return i.openCreateForm()}),vs(2,"ds-icon-button",2),Ag("action",function(){return i.goBack()}),dl()(),Dg(3,L,1,1,"ng-template",null,0,fT)),e&2){let o=TC(4);Tg("items",uT(1,3,i.configItems$)??rT(5,S))("showCreate",true)("itemTemplate",o);}},dependencies:[Wn,O,De,Nb],styles:[".platform-agent-configs__back[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.platform-agent-configs__back[_ngcontent-%COMP%]:hover{text-decoration:underline}"]})};export{D as PlatformAgentConfigsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,G,ca as hB,cb as pB,H as Hi,A as Aw,v as vs,W as WC,k as dl,n as eC,y as Hg,X as XE,a8 as Zg,t as tC,ac as mC,a9 as dC,l as Ag,r as Tg,aa as If,ab as wf}from'./main-
|
|
1
|
+
import {g,G,ca as hB,cb as pB,H as Hi,A as Aw,v as vs,W as WC,k as dl,n as eC,y as Hg,X as XE,a8 as Zg,t as tC,ac as mC,a9 as dC,l as Ag,r as Tg,aa as If,ab as wf}from'./main-Z5SI5ZVQ.js';import {Z as Zn,D as De}from'./chunk-McdsPwbe.js';function k(t,r){if(t&1&&(vs(0,"span",3),WC(1),dl()),t&2){let e=mC();XE(),Zg(e.prompt().description);}}function S(t,r){if(t&1){let e=dC();vs(0,"span",6),WC(1,"Delete?"),dl(),vs(2,"ds-icon-button",7),Ag("action",function(){If(e);let m=mC();return wf(m.onDeleteConfirmed())}),dl(),vs(3,"ds-icon-button",8),Ag("action",function(){If(e);let m=mC();return wf(m.onDeleteCancelled())}),dl();}}function E(t,r){if(t&1){let e=dC();vs(0,"ds-kebab-menu",9),Ag("itemSelected",function(m){If(e);let O=mC();return wf(O.onMenuAction(m))}),dl();}if(t&2){let e=mC();Tg("items",e.menuItems);}}var I=class t{router=g(G);prompt=hB.required();namespaceId=hB(void 0);platformMode=hB(false);readOnly=hB(false);deleteRequested=pB();pendingDelete=Hi(false);menuItems=[{key:"edit",label:"Edit prompt",icon:"edit"},{key:"delete",label:"Delete prompt",icon:"delete",variant:"danger"}];onMenuAction(r){switch(r){case "edit":this.platformMode()?this.router.navigate(["/agentos","admin","prompts",this.prompt().id,"edit"]):this.router.navigate(["/agentos",this.namespaceId(),"prompts",this.prompt().id,"edit"]);break;case "delete":this.pendingDelete.set(true);break}}onDeleteConfirmed(){this.pendingDelete.set(false),this.deleteRequested.emit(this.prompt());}onDeleteCancelled(){this.pendingDelete.set(false);}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=Aw({type:t,selectors:[["agentos-prompt-item"]],inputs:{prompt:[1,"prompt"],namespaceId:[1,"namespaceId"],platformMode:[1,"platformMode"],readOnly:[1,"readOnly"]},outputs:{deleteRequested:"deleteRequested"},decls:8,vars:5,consts:[["role","listitem",1,"prompt-item"],[1,"prompt-item__body"],[1,"prompt-item__name"],[1,"prompt-item__description"],[1,"prompt-item__actions"],[3,"items"],[1,"prompt-item__confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel deletion",3,"action"],[3,"itemSelected","items"]],template:function(e,o){e&1&&(vs(0,"div",0)(1,"div",1)(2,"span",2),WC(3),dl(),eC(4,k,2,1,"span",3),dl(),vs(5,"div",4),eC(6,S,4,0)(7,E,1,1,"ds-kebab-menu",5),dl()()),e&2&&(Hg("prompt-item--pending-delete",o.pendingDelete()),XE(3),Zg(o.prompt().name),XE(),tC(o.prompt().description?4:-1),XE(2),tC(o.pendingDelete()?6:o.readOnly()?-1:7));},dependencies:[Zn,De],styles:[".prompt-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem 1rem;border-radius:10px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--glass-bg, rgba(255, 255, 255, .72));-webkit-backdrop-filter:var(--glass-backdrop-blur, blur(20px));backdrop-filter:var(--glass-backdrop-blur, blur(20px));transition:background .15s ease,border-color .15s ease}.prompt-item[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .04));border-color:var(--color-primary, #007aff)}.prompt-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.prompt-item__name[_ngcontent-%COMP%]{font-size:.95rem;font-weight:500;color:var(--color-text, #1d1d1f);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.prompt-item__description[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary, #6e6e73);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.prompt-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.prompt-item[_ngcontent-%COMP%]:hover .prompt-item__actions[_ngcontent-%COMP%], .prompt-item[_ngcontent-%COMP%]:focus-within .prompt-item__actions[_ngcontent-%COMP%], .prompt-item--pending-delete[_ngcontent-%COMP%] .prompt-item__actions[_ngcontent-%COMP%]{opacity:1}.prompt-item__confirm-label[_ngcontent-%COMP%]{font-size:.8rem;font-weight:500;color:var(--color-error, #ff3b30);margin-right:.25rem;white-space:nowrap}"]})};export{I};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {S as St}from'./chunk-BZZR3aP2.js';import {an as ce,g,L,ao as V,G,N as N$1,ap as Vy,A as Aw,aq as a,ar as S,as as F,at as c,v as vs,l as Ag,n as eC,k as dl,r as Tg,X as XE,t as tC,D as Fg,I as IC,E as wC,au as tv,ae as Ot,av as dt,Y as x,aw as fl,W as WC,ax as pl,a8 as Zg,a9 as dC,aa as If,ac as mC,ab as wf,o as bg}from'./main-ZCJEGFW3.js';import {n as nt,i as it,t as tt,C as Ci}from'./chunk-gI_QNDKB.js';import'./chunk-BT_iRqki.js';import {G as Ge}from'./chunk-DLsoHfhP.js';import'./chunk-B6HBR6l3.js';import'./chunk-Sc506DO8.js';import'./chunk-nHbbuVx2.js';import'./chunk-DcWLC4S7.js';import'./chunk-spSRZfqJ.js';import'./chunk-BLwyktBH.js';import'./chunk-BUF2p97y.js';import'./chunk-Pl7edkoq.js';var T=class o{welcomeMessages=["Welcome to Coday","Bienvenue sur Coday","Bienvenido a Coday","Willkommen bei Coday","Benvenuto su Coday","Bem-vindo ao Coday","Welkom bij Coday","\u0414\u043E\u0431\u0440\u043E \u043F\u043E\u0436\u0430\u043B\u043E\u0432\u0430\u0442\u044C \u0432 Coday","Coday \u3078\u3088\u3046\u3053\u305D","\u6B22\u8FCE\u6765\u5230 Coday","Coday \uC5D0 \uC624\uC2E0 \uAC83\uC744 \uD658\uC601\uD569\uB2C8\uB2E4","\u0645\u0631\u062D\u0628\u064B\u0627 \u0628\u0643 \u0641\u064A Coday"];currentWelcomeIndex=0;currentWelcomeMessage=this.welcomeMessages[0];welcomeRotationInterval;ngOnInit(){this.startWelcomeRotation();}ngOnDestroy(){this.stopWelcomeRotation();}startWelcomeRotation(){this.welcomeRotationInterval=window.setInterval(()=>{this.currentWelcomeIndex=(this.currentWelcomeIndex+1)%this.welcomeMessages.length,this.currentWelcomeMessage=this.welcomeMessages[this.currentWelcomeIndex];},3e3);}stopWelcomeRotation(){this.welcomeRotationInterval&&(clearInterval(this.welcomeRotationInterval),this.welcomeRotationInterval=void 0);}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=Aw({type:o,selectors:[["app-welcome-message"]],decls:2,vars:1,consts:[[1,"welcome-title"]],template:function(t,i){t&1&&(fl(0,"h1",0),WC(1),pl()),t&2&&(XE(),Zg(i.currentWelcomeMessage));},styles:[".welcome-title[_ngcontent-%COMP%]{font-size:clamp(1.5rem,4vw,4rem);font-weight:700;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% auto;background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;animation:_ngcontent-%COMP%_gradientShift 3s ease-in-out infinite;margin:0;padding:0;line-height:1.2;transition:opacity .5s ease-in-out;display:block;min-height:1.2em;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@keyframes _ngcontent-%COMP%_gradientShift{0%{background-position:0% center}50%{background-position:100% center}to{background-position:0% center}}"],changeDetection:1})};var N=class o{destroy$=new ce;isSetup=false;codayService=g(Ge);preferencesService=g(L);setup(){if(this.isSetup){console.warn("[AGENT-NOTIFICATION] Service already set up");return}console.log("[AGENT-NOTIFICATION] Setting up agent notification service"),this.codayService.isThinking$.pipe(Vy(this.destroy$),tv(),Ot(([e,t])=>e===true&&t===false)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Agent stopped thinking, notifying task finished"),this.notifyTaskFinishedIfEnabled();}),this.preferencesService.browserNotificationEnabled$.pipe(Vy(this.destroy$),tv(),Ot(([e,t])=>e===false&&t===true)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Browser notifications enabled, checking permission"),this.handleBrowserNotificationEnabled();}),this.isSetup=true;}notifyTaskFinishedIfEnabled(){this.preferencesService.getAgentNotificationEnabled()&&(this.preferencesService.getNotificationSoundEnabled()&&this.playCompletionSound(),this.preferencesService.getBrowserNotificationEnabled()&&this.sendBrowserNotification());}playCompletionSound(){try{let e=new(window.AudioContext||window.webkitAudioContext),t=e.createOscillator(),i=e.createGain();t.connect(i),i.connect(e.destination),t.frequency.setValueAtTime(700,e.currentTime),i.gain.setValueAtTime(.1,e.currentTime),i.gain.exponentialRampToValueAtTime(.01,e.currentTime+.08),t.start(e.currentTime),t.stop(e.currentTime+.08);let n=e.createOscillator(),r=e.createGain();n.connect(r),r.connect(e.destination);let l=e.currentTime+.11;n.frequency.setValueAtTime(950,l),r.gain.setValueAtTime(.1,l),r.gain.exponentialRampToValueAtTime(.01,l+.09),n.start(l),n.stop(l+.09),console.log("[AGENT-NOTIFICATION] Completion sound played");}catch(e){console.error("[AGENT-NOTIFICATION] Failed to play completion sound:",e);}}handleBrowserNotificationEnabled(){return dt(this,null,function*(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications"),this.preferencesService.setBrowserNotificationEnabled(false);return}if(Notification.permission==="denied"){console.warn("[AGENT-NOTIFICATION] Permission denied, disabling browser notifications"),this.preferencesService.setBrowserNotificationEnabled(false);return}if(Notification.permission==="granted"){console.log("[AGENT-NOTIFICATION] Permission already granted, showing confirmation"),this.createConfirmationNotification();return}try{(yield Notification.requestPermission())==="granted"?(console.log("[AGENT-NOTIFICATION] Permission granted, showing confirmation"),this.createConfirmationNotification()):(console.log("[AGENT-NOTIFICATION] Permission denied or dismissed"),this.preferencesService.setBrowserNotificationEnabled(!1));}catch(e){console.error("[AGENT-NOTIFICATION] Error requesting permission:",e),this.preferencesService.setBrowserNotificationEnabled(false);}})}sendBrowserNotification(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications");return}if(document.hasFocus()){console.warn("[AGENT-NOTIFICATION] Document is focused, skipping browser notification");return}Notification.permission==="granted"?this.createTaskCompleteNotification():console.warn("[AGENT-NOTIFICATION] Permission not granted, cannot send notification");}createConfirmationNotification(){let e=new Notification("Coday - Notifications Enabled",{body:"You will be notified when the agent completes tasks",icon:"/favicon.ico",tag:"coday-notifications-enabled",requireInteraction:false});setTimeout(()=>e.close(),4e3),e.onclick=()=>{window.focus(),e.close();},console.log("[AGENT-NOTIFICATION] Confirmation notification sent");}createTaskCompleteNotification(){let e=new Notification("Coday - Task Complete",{body:"The agent has finished and is waiting for your input",icon:"/favicon.ico",tag:"coday-task-complete",requireInteraction:false});setTimeout(()=>e.close(),5e3),e.onclick=()=>{window.focus(),e.close();},console.log("[AGENT-NOTIFICATION] Task complete notification sent");}ngOnDestroy(){console.log("[AGENT-NOTIFICATION] Service destroyed"),this.destroy$.next(),this.destroy$.complete();}static \u0275fac=function(t){return new(t||o)};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};var Z=["inputSection"];function ee(o,e){if(o&1){let t=dC();vs(0,"app-thread",4),Ag("chatFocused",function(){If(t);let n=mC();return wf(n.onChatFocusedOnMobile())})("drawerStateChange",function(n){If(t);let r=mC();return wf(r.onDrawerStateChange(n))}),dl();}if(o&2){let t=mC();Tg("projectName",t.projectName)("threadId",t.threadId);}}function te(o,e){if(o&1){let t=dC();vs(0,"div",5),bg(1,"app-welcome-message"),dl(),vs(2,"div",6,0)(4,"div",7)(5,"div",8)(6,"app-chat-textarea",9),Ag("messageSubmitted",function(n){If(t);let r=mC();return wf(r.onMessageSubmitted(n))})("voiceMessageReady",function(n){If(t);let r=mC();return wf(r.onVoiceMessageReady(n))})("voiceRecordingToggled",function(n){If(t);let r=mC();return wf(r.onVoiceToggled(n))})("heightChanged",function(n){If(t);let r=mC();return wf(r.onInputHeightChanged(n))})("textareaFocused",function(){If(t);let n=mC();return wf(n.onChatFocusedOnMobile())}),dl()()()();}if(o&2){let t=mC();XE(6),Tg("isDisabled",t.isSessionInitializing)("isSessionInitializing",t.isSessionInitializing)("showWelcome",true)("isThinking",false)("isStarting",t.isStartingFirstMessage);}}var K=class o{destroy$=new ce;inputSection;sidenav;projectName="";threadId=null;isSessionInitializing=false;isStartingFirstMessage=false;inputSectionHeight=80;codayService=g(Ge);titleService=g(nt);preferencesService=g(L);route=g(V);router=g(G);threadApiService=g(N$1);agentNotificationService=g(N);firstMessageState=g(it);constructor(){console.log("[MAIN-APP] Using new thread-based architecture (no clientId needed)");}ngOnInit(){this.agentNotificationService.setup(),this.setupPrintHandlers(),this.route.params.pipe(Vy(this.destroy$)).subscribe(e=>{let t=e.projectName,i=e.threadId||null;console.log("[MAIN-APP] Route params updated:",{project:t,thread:i,previousProject:this.projectName,previousThread:this.threadId}),this.projectName=t,this.threadId=i,this.threadId?console.log("[MAIN-APP] Thread selected - ThreadComponent will display"):(console.log("[MAIN-APP] No thread selected - showing welcome view"),this.initializeWelcomeView());});}initializeWelcomeView(){this.codayService.setTabTitleService(this.titleService);}ngAfterViewInit(){setTimeout(()=>this.updateInputSectionHeight(),100);}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),window.removeEventListener("beforeprint",this.handleBeforePrint),window.removeEventListener("afterprint",this.handleAfterPrint);}onMessageSubmitted(e){console.log("[MAIN-APP] First message submitted from welcome view:",e),this.isSessionInitializing=true,this.isStartingFirstMessage=true,this.threadApiService.createThread().subscribe({next:t=>{console.log("[MAIN-APP] Thread created:",t.thread.id),this.firstMessageState.setPendingFirstMessage(e),this.router.navigate(["project",this.projectName,"thread",t.thread.id]);},error:t=>{console.error("[MAIN-APP] Failed to create thread:",t),this.isSessionInitializing=false,this.isStartingFirstMessage=false,alert("Failed to create conversation: "+(t.message||"Unknown error"));}});}onVoiceToggled(e){console.log("[VOICE] Recording in welcome view:",e);}onVoiceMessageReady(e){console.log("[MAIN-APP] Voice message ready from welcome view"),this.isSessionInitializing=true,this.isStartingFirstMessage=true,this.threadApiService.createThread().subscribe({next:t=>{console.log("[MAIN-APP] Thread created for voice message:",t.thread.id),this.firstMessageState.setPendingVoiceMessage(e),this.router.navigate(["project",this.projectName,"thread",t.thread.id]);},error:t=>{console.error("[MAIN-APP] Failed to create thread for voice message:",t),this.isSessionInitializing=false,this.isStartingFirstMessage=false,alert("Failed to create conversation: "+(t.message||"Unknown error"));}});}isDrawerOpen=false;onDrawerStateChange(e){this.isDrawerOpen=e;}onChatFocusedOnMobile(){window.innerWidth<1024&&this.sidenav?.close();}onInputHeightChanged(e){console.log("[MAIN-APP] Input height changed:",e),this.inputSectionHeight=e;}updateInputSectionHeight(){if(this.inputSection?.nativeElement){let e=this.inputSection.nativeElement.offsetHeight;e!==this.inputSectionHeight&&(console.log("[MAIN-APP] Input section height updated:",e),this.inputSectionHeight=e);}}setupPrintHandlers(){window.addEventListener("beforeprint",this.handleBeforePrint),window.addEventListener("afterprint",this.handleAfterPrint);}handleBeforePrint=()=>{console.log("[PRINT] Before print event triggered");let e=this.preferencesService.getPrintTechnicalMessages();console.log("[PRINT] Print technical messages:",e),e?document.body.classList.add("print-include-technical"):document.body.classList.remove("print-include-technical");};handleAfterPrint=()=>{console.log("[PRINT] After print event triggered"),document.body.classList.remove("print-include-technical");};static \u0275fac=function(t){return new(t||o)};static \u0275cmp=Aw({type:o,selectors:[["app-main"]],viewQuery:function(t,i){if(t&1&&Fg(Z,5)(St,5),t&2){let n;IC(n=wC())&&(i.inputSection=n.first),IC(n=wC())&&(i.sidenav=n.first);}},decls:4,vars:2,consts:[["inputSection",""],[3,"drawerOpen"],[1,"app",3,"mousedown","touchstart"],[3,"projectName","threadId"],[3,"chatFocused","drawerStateChange","projectName","threadId"],[1,"welcome-section"],[1,"input-section"],[1,"input-center"],[1,"input-glass"],[3,"messageSubmitted","voiceMessageReady","voiceRecordingToggled","heightChanged","textareaFocused","isDisabled","isSessionInitializing","showWelcome","isThinking","isStarting"]],template:function(t,i){t&1&&(vs(0,"app-sidenav",1)(1,"div",2),Ag("mousedown",function(){return i.onChatFocusedOnMobile()})("touchstart",function(){return i.onChatFocusedOnMobile()}),eC(2,ee,1,2,"app-thread",3)(3,te,7,5),dl()()),t&2&&(Tg("drawerOpen",i.isDrawerOpen),XE(2),tC(i.threadId?2:3));},dependencies:[tt,Ci,T,St],styles:["[_nghost-%COMP%]{display:flex;height:100vh;width:100%;overflow:hidden;justify-content:center}.app[_ngcontent-%COMP%]{width:100%;max-width:100%;min-width:0;height:100%;display:flex;flex-direction:column;background:var(--color-bg);color:var(--color-text);transition:all .3s ease;position:relative;justify-content:center;overflow:hidden}.chat-wrapper[_ngcontent-%COMP%]{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;background:transparent;width:100%;padding:2.5rem 0 1.5rem;display:flex;justify-content:center}.chat-wrapper[_ngcontent-%COMP%] .chat-center[_ngcontent-%COMP%]{max-width:760px;width:100%;margin:0;padding:0 2rem}@media(max-width:768px){.chat-wrapper[_ngcontent-%COMP%] .chat-center[_ngcontent-%COMP%]{padding:0 1rem}}.welcome-section[_ngcontent-%COMP%]{flex-shrink:0;text-align:center;padding:2rem 1rem;animation:_ngcontent-%COMP%_fadeInUp .8s ease-out;display:flex;justify-content:center;align-items:center;width:100%;min-width:0;overflow:hidden}@keyframes _ngcontent-%COMP%_fadeInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.input-section[_ngcontent-%COMP%]{flex-shrink:0;position:relative;border-top:none;background:transparent;box-shadow:none;padding:2.5rem 0 2rem;overflow-y:visible;max-height:none;width:100%;z-index:10;pointer-events:none;display:flex;justify-content:center}.input-center[_ngcontent-%COMP%]{max-width:760px;width:100%;margin:0;padding:0 2rem;display:flex;justify-content:center;align-items:end;position:relative;pointer-events:auto}@media(max-width:768px){.input-center[_ngcontent-%COMP%]{padding:0 1rem}}.input-glass[_ngcontent-%COMP%]{background:none;box-shadow:none;width:100%;min-height:64px;display:flex;align-items:stretch;gap:0;pointer-events:auto;position:relative;overflow:visible}.input-glass[_ngcontent-%COMP%] app-chat-textarea[_ngcontent-%COMP%]{width:100%;min-width:0;flex:1 1 auto;align-self:stretch;display:flex}body.dark[_nghost-%COMP%], body.dark [_nghost-%COMP%], [_ngcontent-%COMP%]:root[data-theme=dark] .input-glass[_ngcontent-%COMP%]{background:#24283073;border-color:#b4c8ff17;box-shadow:0 8px 32px #0000002b,0 1.5px 8px #00000012}.choice-overlay[_ngcontent-%COMP%]{z-index:10;width:100%;display:flex;justify-content:center;align-items:center}.upload-status[_ngcontent-%COMP%]{position:fixed;bottom:100px;left:50%;transform:translate(-50%);z-index:1000;display:flex;align-items:center;padding:12px 20px;background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);border-radius:16px;font-size:.9em;color:var(--color-text);box-shadow:var(--glass-shadow);max-width:300px;text-align:center}.upload-status.error[_ngcontent-%COMP%]{background:#ff3b3026;color:var(--color-error);border-color:#ff3b304d}@media(max-width:768px){.welcome-section[_ngcontent-%COMP%]{padding:1.5rem 1rem}.input-section[_ngcontent-%COMP%]{padding:1.5rem .75rem 1rem}.input-center[_ngcontent-%COMP%]{padding:0 .5rem}}@media print{[_nghost-%COMP%]{display:block!important;height:auto!important;overflow:visible!important}.app[_ngcontent-%COMP%]{height:auto!important;overflow:visible!important;display:block!important}.input-section[_ngcontent-%COMP%], .welcome-section[_ngcontent-%COMP%]{display:none!important}}"],data:{animation:[a("slideIn",[S(":enter",[F({transform:"translateY(100%)",opacity:0}),c("300ms ease-out",F({transform:"translateY(0)",opacity:1}))]),S(":leave",[c("200ms ease-in",F({transform:"translateY(100%)",opacity:0}))])])]},changeDetection:1})};export{K as MainAppComponent};
|
|
1
|
+
import {S as St}from'./chunk-BLEV4Kd8.js';import {an as ce,g,L,ao as V,G,N as N$1,ap as Vy,A as Aw,aq as a,ar as S,as as F,at as c,v as vs,l as Ag,n as eC,k as dl,r as Tg,X as XE,t as tC,D as Fg,I as IC,E as wC,au as tv,ae as Ot,av as dt,Y as x,aw as fl,W as WC,ax as pl,a8 as Zg,a9 as dC,aa as If,ac as mC,ab as wf,o as bg}from'./main-Z5SI5ZVQ.js';import {n as nt,i as it,t as tt,C as Ci}from'./chunk-BcgV9w1p.js';import'./chunk-MEeAhlKz.js';import {G as Ge}from'./chunk-Ddzyej-S.js';import'./chunk-kfNFXWlK.js';import'./chunk-dpvvF4wU.js';import'./chunk-B4fIYjLb.js';import'./chunk-4T0Wfhqy.js';import'./chunk-DVY7ZRkn.js';import'./chunk-McdsPwbe.js';import'./chunk-CL8NUXXa.js';import'./chunk-BXfg4Cn0.js';var T=class o{welcomeMessages=["Welcome to Coday","Bienvenue sur Coday","Bienvenido a Coday","Willkommen bei Coday","Benvenuto su Coday","Bem-vindo ao Coday","Welkom bij Coday","\u0414\u043E\u0431\u0440\u043E \u043F\u043E\u0436\u0430\u043B\u043E\u0432\u0430\u0442\u044C \u0432 Coday","Coday \u3078\u3088\u3046\u3053\u305D","\u6B22\u8FCE\u6765\u5230 Coday","Coday \uC5D0 \uC624\uC2E0 \uAC83\uC744 \uD658\uC601\uD569\uB2C8\uB2E4","\u0645\u0631\u062D\u0628\u064B\u0627 \u0628\u0643 \u0641\u064A Coday"];currentWelcomeIndex=0;currentWelcomeMessage=this.welcomeMessages[0];welcomeRotationInterval;ngOnInit(){this.startWelcomeRotation();}ngOnDestroy(){this.stopWelcomeRotation();}startWelcomeRotation(){this.welcomeRotationInterval=window.setInterval(()=>{this.currentWelcomeIndex=(this.currentWelcomeIndex+1)%this.welcomeMessages.length,this.currentWelcomeMessage=this.welcomeMessages[this.currentWelcomeIndex];},3e3);}stopWelcomeRotation(){this.welcomeRotationInterval&&(clearInterval(this.welcomeRotationInterval),this.welcomeRotationInterval=void 0);}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=Aw({type:o,selectors:[["app-welcome-message"]],decls:2,vars:1,consts:[[1,"welcome-title"]],template:function(t,i){t&1&&(fl(0,"h1",0),WC(1),pl()),t&2&&(XE(),Zg(i.currentWelcomeMessage));},styles:[".welcome-title[_ngcontent-%COMP%]{font-size:clamp(1.5rem,4vw,4rem);font-weight:700;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% auto;background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;animation:_ngcontent-%COMP%_gradientShift 3s ease-in-out infinite;margin:0;padding:0;line-height:1.2;transition:opacity .5s ease-in-out;display:block;min-height:1.2em;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@keyframes _ngcontent-%COMP%_gradientShift{0%{background-position:0% center}50%{background-position:100% center}to{background-position:0% center}}"],changeDetection:1})};var N=class o{destroy$=new ce;isSetup=false;codayService=g(Ge);preferencesService=g(L);setup(){if(this.isSetup){console.warn("[AGENT-NOTIFICATION] Service already set up");return}console.log("[AGENT-NOTIFICATION] Setting up agent notification service"),this.codayService.isThinking$.pipe(Vy(this.destroy$),tv(),Ot(([e,t])=>e===true&&t===false)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Agent stopped thinking, notifying task finished"),this.notifyTaskFinishedIfEnabled();}),this.preferencesService.browserNotificationEnabled$.pipe(Vy(this.destroy$),tv(),Ot(([e,t])=>e===false&&t===true)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Browser notifications enabled, checking permission"),this.handleBrowserNotificationEnabled();}),this.isSetup=true;}notifyTaskFinishedIfEnabled(){this.preferencesService.getAgentNotificationEnabled()&&(this.preferencesService.getNotificationSoundEnabled()&&this.playCompletionSound(),this.preferencesService.getBrowserNotificationEnabled()&&this.sendBrowserNotification());}playCompletionSound(){try{let e=new(window.AudioContext||window.webkitAudioContext),t=e.createOscillator(),i=e.createGain();t.connect(i),i.connect(e.destination),t.frequency.setValueAtTime(700,e.currentTime),i.gain.setValueAtTime(.1,e.currentTime),i.gain.exponentialRampToValueAtTime(.01,e.currentTime+.08),t.start(e.currentTime),t.stop(e.currentTime+.08);let n=e.createOscillator(),r=e.createGain();n.connect(r),r.connect(e.destination);let l=e.currentTime+.11;n.frequency.setValueAtTime(950,l),r.gain.setValueAtTime(.1,l),r.gain.exponentialRampToValueAtTime(.01,l+.09),n.start(l),n.stop(l+.09),console.log("[AGENT-NOTIFICATION] Completion sound played");}catch(e){console.error("[AGENT-NOTIFICATION] Failed to play completion sound:",e);}}handleBrowserNotificationEnabled(){return dt(this,null,function*(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications"),this.preferencesService.setBrowserNotificationEnabled(false);return}if(Notification.permission==="denied"){console.warn("[AGENT-NOTIFICATION] Permission denied, disabling browser notifications"),this.preferencesService.setBrowserNotificationEnabled(false);return}if(Notification.permission==="granted"){console.log("[AGENT-NOTIFICATION] Permission already granted, showing confirmation"),this.createConfirmationNotification();return}try{(yield Notification.requestPermission())==="granted"?(console.log("[AGENT-NOTIFICATION] Permission granted, showing confirmation"),this.createConfirmationNotification()):(console.log("[AGENT-NOTIFICATION] Permission denied or dismissed"),this.preferencesService.setBrowserNotificationEnabled(!1));}catch(e){console.error("[AGENT-NOTIFICATION] Error requesting permission:",e),this.preferencesService.setBrowserNotificationEnabled(false);}})}sendBrowserNotification(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications");return}if(document.hasFocus()){console.warn("[AGENT-NOTIFICATION] Document is focused, skipping browser notification");return}Notification.permission==="granted"?this.createTaskCompleteNotification():console.warn("[AGENT-NOTIFICATION] Permission not granted, cannot send notification");}createConfirmationNotification(){let e=new Notification("Coday - Notifications Enabled",{body:"You will be notified when the agent completes tasks",icon:"/favicon.ico",tag:"coday-notifications-enabled",requireInteraction:false});setTimeout(()=>e.close(),4e3),e.onclick=()=>{window.focus(),e.close();},console.log("[AGENT-NOTIFICATION] Confirmation notification sent");}createTaskCompleteNotification(){let e=new Notification("Coday - Task Complete",{body:"The agent has finished and is waiting for your input",icon:"/favicon.ico",tag:"coday-task-complete",requireInteraction:false});setTimeout(()=>e.close(),5e3),e.onclick=()=>{window.focus(),e.close();},console.log("[AGENT-NOTIFICATION] Task complete notification sent");}ngOnDestroy(){console.log("[AGENT-NOTIFICATION] Service destroyed"),this.destroy$.next(),this.destroy$.complete();}static \u0275fac=function(t){return new(t||o)};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};var Z=["inputSection"];function ee(o,e){if(o&1){let t=dC();vs(0,"app-thread",4),Ag("chatFocused",function(){If(t);let n=mC();return wf(n.onChatFocusedOnMobile())})("drawerStateChange",function(n){If(t);let r=mC();return wf(r.onDrawerStateChange(n))}),dl();}if(o&2){let t=mC();Tg("projectName",t.projectName)("threadId",t.threadId);}}function te(o,e){if(o&1){let t=dC();vs(0,"div",5),bg(1,"app-welcome-message"),dl(),vs(2,"div",6,0)(4,"div",7)(5,"div",8)(6,"app-chat-textarea",9),Ag("messageSubmitted",function(n){If(t);let r=mC();return wf(r.onMessageSubmitted(n))})("voiceMessageReady",function(n){If(t);let r=mC();return wf(r.onVoiceMessageReady(n))})("voiceRecordingToggled",function(n){If(t);let r=mC();return wf(r.onVoiceToggled(n))})("heightChanged",function(n){If(t);let r=mC();return wf(r.onInputHeightChanged(n))})("textareaFocused",function(){If(t);let n=mC();return wf(n.onChatFocusedOnMobile())}),dl()()()();}if(o&2){let t=mC();XE(6),Tg("isDisabled",t.isSessionInitializing)("isSessionInitializing",t.isSessionInitializing)("showWelcome",true)("isThinking",false)("isStarting",t.isStartingFirstMessage);}}var K=class o{destroy$=new ce;inputSection;sidenav;projectName="";threadId=null;isSessionInitializing=false;isStartingFirstMessage=false;inputSectionHeight=80;codayService=g(Ge);titleService=g(nt);preferencesService=g(L);route=g(V);router=g(G);threadApiService=g(N$1);agentNotificationService=g(N);firstMessageState=g(it);constructor(){console.log("[MAIN-APP] Using new thread-based architecture (no clientId needed)");}ngOnInit(){this.agentNotificationService.setup(),this.setupPrintHandlers(),this.route.params.pipe(Vy(this.destroy$)).subscribe(e=>{let t=e.projectName,i=e.threadId||null;console.log("[MAIN-APP] Route params updated:",{project:t,thread:i,previousProject:this.projectName,previousThread:this.threadId}),this.projectName=t,this.threadId=i,this.threadId?console.log("[MAIN-APP] Thread selected - ThreadComponent will display"):(console.log("[MAIN-APP] No thread selected - showing welcome view"),this.initializeWelcomeView());});}initializeWelcomeView(){this.codayService.setTabTitleService(this.titleService);}ngAfterViewInit(){setTimeout(()=>this.updateInputSectionHeight(),100);}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),window.removeEventListener("beforeprint",this.handleBeforePrint),window.removeEventListener("afterprint",this.handleAfterPrint);}onMessageSubmitted(e){console.log("[MAIN-APP] First message submitted from welcome view:",e),this.isSessionInitializing=true,this.isStartingFirstMessage=true,this.threadApiService.createThread().subscribe({next:t=>{console.log("[MAIN-APP] Thread created:",t.thread.id),this.firstMessageState.setPendingFirstMessage(e),this.router.navigate(["project",this.projectName,"thread",t.thread.id]);},error:t=>{console.error("[MAIN-APP] Failed to create thread:",t),this.isSessionInitializing=false,this.isStartingFirstMessage=false,alert("Failed to create conversation: "+(t.message||"Unknown error"));}});}onVoiceToggled(e){console.log("[VOICE] Recording in welcome view:",e);}onVoiceMessageReady(e){console.log("[MAIN-APP] Voice message ready from welcome view"),this.isSessionInitializing=true,this.isStartingFirstMessage=true,this.threadApiService.createThread().subscribe({next:t=>{console.log("[MAIN-APP] Thread created for voice message:",t.thread.id),this.firstMessageState.setPendingVoiceMessage(e),this.router.navigate(["project",this.projectName,"thread",t.thread.id]);},error:t=>{console.error("[MAIN-APP] Failed to create thread for voice message:",t),this.isSessionInitializing=false,this.isStartingFirstMessage=false,alert("Failed to create conversation: "+(t.message||"Unknown error"));}});}isDrawerOpen=false;onDrawerStateChange(e){this.isDrawerOpen=e;}onChatFocusedOnMobile(){window.innerWidth<1024&&this.sidenav?.close();}onInputHeightChanged(e){console.log("[MAIN-APP] Input height changed:",e),this.inputSectionHeight=e;}updateInputSectionHeight(){if(this.inputSection?.nativeElement){let e=this.inputSection.nativeElement.offsetHeight;e!==this.inputSectionHeight&&(console.log("[MAIN-APP] Input section height updated:",e),this.inputSectionHeight=e);}}setupPrintHandlers(){window.addEventListener("beforeprint",this.handleBeforePrint),window.addEventListener("afterprint",this.handleAfterPrint);}handleBeforePrint=()=>{console.log("[PRINT] Before print event triggered");let e=this.preferencesService.getPrintTechnicalMessages();console.log("[PRINT] Print technical messages:",e),e?document.body.classList.add("print-include-technical"):document.body.classList.remove("print-include-technical");};handleAfterPrint=()=>{console.log("[PRINT] After print event triggered"),document.body.classList.remove("print-include-technical");};static \u0275fac=function(t){return new(t||o)};static \u0275cmp=Aw({type:o,selectors:[["app-main"]],viewQuery:function(t,i){if(t&1&&Fg(Z,5)(St,5),t&2){let n;IC(n=wC())&&(i.inputSection=n.first),IC(n=wC())&&(i.sidenav=n.first);}},decls:4,vars:2,consts:[["inputSection",""],[3,"drawerOpen"],[1,"app",3,"mousedown","touchstart"],[3,"projectName","threadId"],[3,"chatFocused","drawerStateChange","projectName","threadId"],[1,"welcome-section"],[1,"input-section"],[1,"input-center"],[1,"input-glass"],[3,"messageSubmitted","voiceMessageReady","voiceRecordingToggled","heightChanged","textareaFocused","isDisabled","isSessionInitializing","showWelcome","isThinking","isStarting"]],template:function(t,i){t&1&&(vs(0,"app-sidenav",1)(1,"div",2),Ag("mousedown",function(){return i.onChatFocusedOnMobile()})("touchstart",function(){return i.onChatFocusedOnMobile()}),eC(2,ee,1,2,"app-thread",3)(3,te,7,5),dl()()),t&2&&(Tg("drawerOpen",i.isDrawerOpen),XE(2),tC(i.threadId?2:3));},dependencies:[tt,Ci,T,St],styles:["[_nghost-%COMP%]{display:flex;height:100vh;width:100%;overflow:hidden;justify-content:center}.app[_ngcontent-%COMP%]{width:100%;max-width:100%;min-width:0;height:100%;display:flex;flex-direction:column;background:var(--color-bg);color:var(--color-text);transition:all .3s ease;position:relative;justify-content:center;overflow:hidden}.chat-wrapper[_ngcontent-%COMP%]{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;background:transparent;width:100%;padding:2.5rem 0 1.5rem;display:flex;justify-content:center}.chat-wrapper[_ngcontent-%COMP%] .chat-center[_ngcontent-%COMP%]{max-width:760px;width:100%;margin:0;padding:0 2rem}@media(max-width:768px){.chat-wrapper[_ngcontent-%COMP%] .chat-center[_ngcontent-%COMP%]{padding:0 1rem}}.welcome-section[_ngcontent-%COMP%]{flex-shrink:0;text-align:center;padding:2rem 1rem;animation:_ngcontent-%COMP%_fadeInUp .8s ease-out;display:flex;justify-content:center;align-items:center;width:100%;min-width:0;overflow:hidden}@keyframes _ngcontent-%COMP%_fadeInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.input-section[_ngcontent-%COMP%]{flex-shrink:0;position:relative;border-top:none;background:transparent;box-shadow:none;padding:2.5rem 0 2rem;overflow-y:visible;max-height:none;width:100%;z-index:10;pointer-events:none;display:flex;justify-content:center}.input-center[_ngcontent-%COMP%]{max-width:760px;width:100%;margin:0;padding:0 2rem;display:flex;justify-content:center;align-items:end;position:relative;pointer-events:auto}@media(max-width:768px){.input-center[_ngcontent-%COMP%]{padding:0 1rem}}.input-glass[_ngcontent-%COMP%]{background:none;box-shadow:none;width:100%;min-height:64px;display:flex;align-items:stretch;gap:0;pointer-events:auto;position:relative;overflow:visible}.input-glass[_ngcontent-%COMP%] app-chat-textarea[_ngcontent-%COMP%]{width:100%;min-width:0;flex:1 1 auto;align-self:stretch;display:flex}body.dark[_nghost-%COMP%], body.dark [_nghost-%COMP%], [_ngcontent-%COMP%]:root[data-theme=dark] .input-glass[_ngcontent-%COMP%]{background:#24283073;border-color:#b4c8ff17;box-shadow:0 8px 32px #0000002b,0 1.5px 8px #00000012}.choice-overlay[_ngcontent-%COMP%]{z-index:10;width:100%;display:flex;justify-content:center;align-items:center}.upload-status[_ngcontent-%COMP%]{position:fixed;bottom:100px;left:50%;transform:translate(-50%);z-index:1000;display:flex;align-items:center;padding:12px 20px;background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);border-radius:16px;font-size:.9em;color:var(--color-text);box-shadow:var(--glass-shadow);max-width:300px;text-align:center}.upload-status.error[_ngcontent-%COMP%]{background:#ff3b3026;color:var(--color-error);border-color:#ff3b304d}@media(max-width:768px){.welcome-section[_ngcontent-%COMP%]{padding:1.5rem 1rem}.input-section[_ngcontent-%COMP%]{padding:1.5rem .75rem 1rem}.input-center[_ngcontent-%COMP%]{padding:0 .5rem}}@media print{[_nghost-%COMP%]{display:block!important;height:auto!important;overflow:visible!important}.app[_ngcontent-%COMP%]{height:auto!important;overflow:visible!important;display:block!important}.input-section[_ngcontent-%COMP%], .welcome-section[_ngcontent-%COMP%]{display:none!important}}"],data:{animation:[a("slideIn",[S(":enter",[F({transform:"translateY(100%)",opacity:0}),c("300ms ease-out",F({transform:"translateY(0)",opacity:1}))]),S(":leave",[c("200ms ease-in",F({transform:"translateY(100%)",opacity:0}))])])]},changeDetection:1})};export{K as MainAppComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {I}from'./chunk-
|
|
1
|
+
import {I}from'./chunk-BxmtpvI3.js';import {g,ao as V$1,G as G$1,w as we,de as B,dd as $,aI as Tr,bR as ga,Q as By,a7 as ha,S as pa,u as ue,b as U$1,A as Aw,aJ as Nb,v as vs,be as aT,l as Ag,k as dl,af as Dg,T as TC,r as Tg,bf as uT,ah as rT,n as eC,ac as mC,t as tC,a9 as dC,aa as If,ab as wf,ag as fT}from'./main-Z5SI5ZVQ.js';import {W as Wn,D as De}from'./chunk-McdsPwbe.js';import'./chunk-CL8NUXXa.js';import'./chunk-BXfg4Cn0.js';var V=()=>[];function K(n,t){if(n&1){let i=dC();vs(0,"agentos-ai-model-item",4),Ag("deleteRequested",function(a){If(i);let e=mC(2);return wf(e.deleteModel(a))})("editRequested",function(a){If(i);let e=mC(2);return wf(e.editModel(a))}),dl();}if(n&2){let i=mC().$implicit,o=mC();Tg("model",t)("namespaceId",o.namespaceId)("readOnly",o.isPlatformModel(i.id));}}function U(n,t){if(n&1&&eC(0,K,1,3,"agentos-ai-model-item",3),n&2){let i,o=t.$implicit,a=mC();tC((i=a.resolveModel(o.id))?0:-1,i);}}var j="__platform__",G="Platform (read-only)",F=class n{route=g(V$1);router=g(G$1);destroyRef=g(we);aiModelController=g(B);aiProviderController=g($);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Tr(void 0);data$=this.refresh$.pipe(ga(()=>By({namespace:this.aiModelController.listByNamespaceIdAiModel(this.namespaceId),platform:this.aiModelController.listPlatformLevelAiModel().pipe(ha(()=>pa([]))),providers:this.aiProviderController.listAiProvider(this.namespaceId)})));modelItems$=this.data$.pipe(ue(({namespace:t,platform:i,providers:o})=>{let a=new Map(o.map(e=>[e.id??"",e.name]));return [...i.map(e=>({id:e.id??"",name:e.alias??e.apiModelName,description:e.apiModelName,groupKey:j,groupLabel:G})),...t.map(e=>({id:e.id??"",name:e.alias??e.apiModelName,description:e.apiModelName,groupKey:e.aiProviderId,groupLabel:a.get(e.aiProviderId)??e.aiProviderId}))]}));namespaceModelsById=new Map;platformModelsById=new Map;constructor(){this.data$.pipe(U$1(this.destroyRef)).subscribe(({namespace:t,platform:i})=>{this.namespaceModelsById=new Map(t.map(o=>[o.id??"",o])),this.platformModelsById=new Map(i.map(o=>[o.id??"",o]));});}goBack(){this.router.navigate(["/agentos","namespaces"]);}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"ai-models","new"]);}editModel(t){this.router.navigate(["/agentos",this.namespaceId,"ai-models",t.id,"edit"]);}deleteModel(t){this.aiModelController.deleteAiModel(t.id??"").pipe(U$1(this.destroyRef)).subscribe(()=>this.refresh$.next());}resolveModel(t){return this.namespaceModelsById.get(t)??this.platformModelsById.get(t)??null}isPlatformModel(t){return this.platformModelsById.has(t)}static \u0275fac=function(i){return new(i||n)};static \u0275cmp=Aw({type:n,selectors:[["agentos-namespace-ai-models"]],decls:5,vars:6,consts:[["aiModelItemTpl",""],["title","AI models","emptyMessage","No AI models configured yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[3,"model","namespaceId","readOnly"],[3,"deleteRequested","editRequested","model","namespaceId","readOnly"]],template:function(i,o){if(i&1&&(vs(0,"ds-entity-list",1),aT(1,"async"),Ag("createRequested",function(){return o.openCreateForm()}),vs(2,"ds-icon-button",2),Ag("action",function(){return o.goBack()}),dl()(),Dg(3,U,1,1,"ng-template",null,0,fT)),i&2){let a=TC(4);Tg("items",uT(1,3,o.modelItems$)??rT(5,V))("showCreate",true)("itemTemplate",a);}},dependencies:[Wn,I,De,Nb],encapsulation:2})};export{F as NamespaceAiModelsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,J as dy,S as pa,bT as Od,u as ue,Y as x}from'./main-
|
|
1
|
+
import {g,J as dy,S as pa,bT as Od,u as ue,Y as x}from'./main-Z5SI5ZVQ.js';var f=class s{http=g(dy);agentsCache=new Map;getAgents(e){let t=this.agentsCache.get(e);return t?pa(t):this.http.get(`/api/projects/${e}/agents`).pipe(Od(o=>{this.agentsCache.set(e,o);}))}getAgentsAutocomplete(e,t){return this.getAgents(e).pipe(ue(o=>{if(!t)return o;let i=t.toLowerCase(),a=r=>{let n=r.name.toLowerCase();return n.startsWith(i)?0:n.includes(i)?1:2};return o.filter(r=>{let n=r.name.toLowerCase(),h=r.description?.toLowerCase()||"";return n.includes(i)||h.includes(i)}).sort((r,n)=>a(r)-a(n))}))}clearCache(e){this.agentsCache.delete(e);}clearAllCache(){this.agentsCache.clear();}static \u0275fac=function(t){return new(t||s)};static \u0275prov=x({token:s,factory:s.\u0275fac,providedIn:"root"})};export{f};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {N as Ne,u as ui$1,a as me,f as fi$1,Y as Yt,V as Ve$1,n as ne}from'./chunk-BUF2p97y.js';import {g,az as Qt,aQ as As,aY as ks,al as yt,A as Aw,o as bg,v as vs,q as oC,k as dl,T as TC,r as Tg,X as XE,x as iC,D as Fg,I as IC,E as wC,j as Gn$1,l as Ag,W as WC,b_ as FC,C as Cg,a8 as Zg,O as Ot,w as we$1,cJ as gB,ca as hB,H as Hi$1,m as mT,b as U,bz as vC,bA as DC,ad as Vg,y as Hg,aw as fl,b5 as Sg,ax as pl,n as eC,t as tC,cb as pB,cq as mB,cc as Hf,cu as Lg,cv as CC,cd as Sb,af as Dg,an as ce,cK as Id,cL as Nd,bR as ga$1,S as pa,cI as Rg,b$ as Ng,cM as An$1,aK as Do$1,aL as Wn$1,bq as sn,bC as ge,aN as wt$1,bD as vt,br as wl,bK as pe,aR as K,cN as is,a as P,aS as Ut,cO as Bt,bQ as bd,bO as Yy,bt as Ve,c1 as ME,z as z$1,aZ as YT,bH as Eg,b4 as nT,aV as w,bu as kg,aU as U$1,bv as St,aW as D,bw as on,by as Oi$1,bE as X,cP as q,cQ as X$1,ac as mC,a9 as dC,aa as If,ab as wf,a5 as ml,cR as Yt$1,cS as Gp,bL as gr,aO as G,ae as Ot$1,aA as sn$1,bV as Y,cT as pi,cU as yg,aC as wu,bx as am,cA as on$1,c7 as QT,ah as rT,a4 as rC,c8 as kf,bs as Qn$2,ap as Vy,bW as Pt,bY as X$2,bZ as xt,cV as YI,cC as Ce,a3 as HI,a6 as $I,bn as nC,c2 as kt,bI as lr,a_ as XC,b3 as oT,a$ as Yg,cg as Mg,cW as yr,cX as tt$1,aX as ft$1,cy as Xr,ag as fT}from'./main-ZCJEGFW3.js';import {w as wt,j as Yn$1,k as _t$1,n as ni,l as Xn$1,E as En$1,z as ze,Q as Qn$1,e as ei,Y as Ye,f as fn,a as wt$2,A as At,Z as Zn$1,C as Cn}from'./chunk-Pl7edkoq.js';var ii=[[["mat-icon"],["","matMenuItemIcon",""]],"*"],oi=["mat-icon, [matMenuItemIcon]","*"];function ai(n,i){n&1&&(kf(),vs(0,"svg",2),bg(1,"polygon",3),dl());}var ri=["*"];function si(n,i){if(n&1){let e=dC();fl(0,"div",0),Rg("click",function(){If(e);let o=mC();return wf(o.closed.emit("click"))})("animationstart",function(o){If(e);let a=mC();return wf(a._onAnimationStart(o.animationName))})("animationend",function(o){If(e);let a=mC();return wf(a._onAnimationDone(o.animationName))})("animationcancel",function(o){If(e);let a=mC();return wf(a._onAnimationDone(o.animationName))}),fl(1,"div",1),DC(2),pl()();}if(n&2){let e=mC();FC(e._classList),Hg("mat-menu-panel-animations-disabled",e._animationsDisabled)("mat-menu-panel-exit-animation",e._panelAnimationState==="void")("mat-menu-panel-animating",e._isAnimating()),Ng("id",e.panelId),Cg("aria-label",e.ariaLabel||null)("aria-labelledby",e.ariaLabelledby||null)("aria-describedby",e.ariaDescribedby||null);}}var mt=new w("MAT_MENU_PANEL"),Le=(()=>{class n{_elementRef=g(Qt);_document=g(U$1);_focusMonitor=g(St);_parentMenu=g(mt,{optional:true});_changeDetectorRef=g(wl);role="menuitem";disabled=false;disableRipple=false;_hovered=new ce;_focused=new ce;_highlighted=false;_triggersSubmenu=false;constructor(){g(D).load(on),this._parentMenu?.addItem?.(this);}focus(e,t){this._focusMonitor&&e?this._focusMonitor.focusVia(this._getHostElement(),e,t):this._getHostElement().focus(t),this._focused.next(this);}ngAfterViewInit(){this._focusMonitor&&this._focusMonitor.monitor(this._elementRef,false);}ngOnDestroy(){this._focusMonitor&&this._focusMonitor.stopMonitoring(this._elementRef),this._parentMenu&&this._parentMenu.removeItem&&this._parentMenu.removeItem(this),this._hovered.complete(),this._focused.complete();}_getTabIndex(){return this.disabled?"-1":"0"}_getHostElement(){return this._elementRef.nativeElement}_checkDisabled(e){this.disabled&&(e.preventDefault(),e.stopPropagation());}_handleMouseEnter(){this._hovered.next(this);}getLabel(){let e=this._elementRef.nativeElement.cloneNode(true),t=e.querySelectorAll("mat-icon, .material-icons");for(let o=0;o<t.length;o++)t[o].remove();return e.textContent?.trim()||""}_setHighlighted(e){this._highlighted=e,this._changeDetectorRef.markForCheck();}_setTriggersSubmenu(e){this._triggersSubmenu=e,this._changeDetectorRef.markForCheck();}_hasFocus(){return this._document&&this._document.activeElement===this._getHostElement()}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=Aw({type:n,selectors:[["","mat-menu-item",""]],hostAttrs:[1,"mat-mdc-menu-item","mat-focus-indicator"],hostVars:8,hostBindings:function(t,o){t&1&&Ag("click",function(m){return o._checkDisabled(m)})("mouseenter",function(){return o._handleMouseEnter()}),t&2&&(Cg("role",o.role)("tabindex",o._getTabIndex())("aria-disabled",o.disabled)("disabled",o.disabled||null),Hg("mat-mdc-menu-item-highlighted",o._highlighted)("mat-mdc-menu-item-submenu-trigger",o._triggersSubmenu));},inputs:{role:"role",disabled:[2,"disabled","disabled",YT],disableRipple:[2,"disableRipple","disableRipple",YT]},exportAs:["matMenuItem"],ngContentSelectors:oi,decls:5,vars:3,consts:[[1,"mat-mdc-menu-item-text"],["matRipple","",1,"mat-mdc-menu-ripple",3,"matRippleDisabled","matRippleTrigger"],["viewBox","0 0 5 10","focusable","false","aria-hidden","true",1,"mat-mdc-menu-submenu-icon"],["points","0,0 5,5 0,10"]],template:function(t,o){t&1&&(vC(ii),DC(0),vs(1,"span",0),DC(2,1),dl(),bg(3,"div",1),eC(4,ai,2,0,":svg:svg",2)),t&2&&(XE(3),Tg("matRippleDisabled",o.disableRipple||o.disabled)("matRippleTrigger",o._getHostElement()),XE(),tC(o._triggersSubmenu?4:-1));},dependencies:[Oi$1],encapsulation:2})}return n})();var Sn=new w("MatMenuContent"),ga=(()=>{class n{_template=g(lr);_appRef=g(yr);_injector=g(pe);_viewContainerRef=g(gr);_document=g(U$1);_changeDetectorRef=g(wl);_portal;_outlet;_attached=new ce;attach(e={}){this._portal||(this._portal=new Y(this._template,this._viewContainerRef)),this.detach(),this._outlet||(this._outlet=new tt$1(this._document.createElement("div"),this._appRef,this._injector));let t=this._template.elementRef.nativeElement;t.parentNode.insertBefore(this._outlet.outletElement,t),this._changeDetectorRef.markForCheck(),this._portal.attach(this._outlet,e),this._attached.next();}detach(){this._portal?.isAttached&&this._portal.detach();}ngOnDestroy(){this.detach(),this._outlet?.dispose();}static \u0275fac=function(t){return new(t||n)};static \u0275dir=ks({type:n,selectors:[["ng-template","matMenuContent",""]],features:[nT([{provide:Sn,useExisting:n}])]})}return n})(),li=new w("mat-menu-default-options",{providedIn:"root",factory:()=>({overlapTrigger:false,xPosition:"after",yPosition:"below",backdropClass:"cdk-overlay-transparent-backdrop"})}),dt="_mat-menu-enter",Ze="_mat-menu-exit",ke=(()=>{class n{_elementRef=g(Qt);_changeDetectorRef=g(wl);_injector=g(pe);_keyManager;_xPosition;_yPosition;_firstItemFocusRef;_exitFallbackTimeout;_animationsDisabled=K();_allItems;_directDescendantItems=new is;_classList={};_panelAnimationState="void";_animationDone=new ce;_isAnimating=Hi$1(false);parentMenu;direction;overlayPanelClass;backdropClass;ariaLabel;ariaLabelledby;ariaDescribedby;get xPosition(){return this._xPosition}set xPosition(e){this._xPosition=e,this.setPositionClasses();}get yPosition(){return this._yPosition}set yPosition(e){this._yPosition=e,this.setPositionClasses();}templateRef;items;lazyContent;overlapTrigger=false;hasBackdrop;get panelClass(){return this._previousPanelClass}set panelClass(e){let t=this._previousPanelClass,o=P({},this._classList);t&&t.length&&t.split(" ").forEach(a=>{o[a]=false;}),this._previousPanelClass=e,e&&e.length&&(e.split(" ").forEach(a=>{o[a]=true;}),this._elementRef.nativeElement.className=""),this._classList=o;}_previousPanelClass="";get classList(){return this.panelClass}set classList(e){this.panelClass=e;}closed=new yt;close=this.closed;panelId=g(Ut).getId("mat-menu-panel-");constructor(){let e=g(li);this.overlayPanelClass=e.overlayPanelClass||"",this._xPosition=e.xPosition,this._yPosition=e.yPosition,this.backdropClass=e.backdropClass,this.overlapTrigger=e.overlapTrigger,this.hasBackdrop=e.hasBackdrop;}ngOnInit(){this.setPositionClasses();}ngAfterContentInit(){this._updateDirectDescendants(),this._keyManager=new Bt(this._directDescendantItems).withWrap().withTypeAhead().withHomeAndEnd(),this._keyManager.tabOut.subscribe(()=>this.closed.emit("tab")),this._directDescendantItems.changes.pipe(bd(this._directDescendantItems),ga$1(e=>Yy(...e.map(t=>t._focused)))).subscribe(e=>this._keyManager.updateActiveItem(e)),this._directDescendantItems.changes.subscribe(e=>{let t=this._keyManager;if(this._panelAnimationState==="enter"&&t.activeItem?._hasFocus()){let o=e.toArray(),a=Math.max(0,Math.min(o.length-1,t.activeItemIndex||0));o[a]&&!o[a].disabled?t.setActiveItem(a):t.setNextItemActive();}});}ngOnDestroy(){this._keyManager?.destroy(),this._directDescendantItems.destroy(),this.closed.complete(),this._firstItemFocusRef?.destroy(),clearTimeout(this._exitFallbackTimeout);}_hovered(){return this._directDescendantItems.changes.pipe(bd(this._directDescendantItems),ga$1(t=>Yy(...t.map(o=>o._hovered))))}addItem(e){}removeItem(e){}_handleKeydown(e){let t=e.keyCode,o=this._keyManager;switch(t){case 27:Ve(e)||(e.preventDefault(),this.closed.emit("keydown"));break;case 37:this.parentMenu&&this.direction==="ltr"&&this.closed.emit("keydown");break;case 39:this.parentMenu&&this.direction==="rtl"&&this.closed.emit("keydown");break;default:(t===38||t===40)&&o.setFocusOrigin("keyboard"),o.onKeydown(e);return}}focusFirstItem(e="program"){this._firstItemFocusRef?.destroy(),this._firstItemFocusRef=ME(()=>{let t=this._resolvePanel();if(!t||!t.contains(document.activeElement)){let o=this._keyManager;o.setFocusOrigin(e).setFirstItemActive(),!o.activeItem&&t&&t.focus();}},{injector:this._injector});}resetActiveItem(){this._keyManager.setActiveItem(-1);}setElevation(e){}setPositionClasses(e=this.xPosition,t=this.yPosition){this._classList=z$1(P({},this._classList),{"mat-menu-before":e==="before","mat-menu-after":e==="after","mat-menu-above":t==="above","mat-menu-below":t==="below"}),this._changeDetectorRef.markForCheck();}_onAnimationDone(e){let t=e===Ze;(t||e===dt)&&(t&&(clearTimeout(this._exitFallbackTimeout),this._exitFallbackTimeout=void 0),this._animationDone.next(t?"void":"enter"),this._isAnimating.set(false));}_onAnimationStart(e){(e===dt||e===Ze)&&this._isAnimating.set(true);}_setIsOpen(e){if(this._panelAnimationState=e?"enter":"void",e){if(this._keyManager.activeItemIndex===0){let t=this._resolvePanel();t&&(t.scrollTop=0);}}else this._animationsDisabled||(this._exitFallbackTimeout=setTimeout(()=>this._onAnimationDone(Ze),200));this._animationsDisabled&&setTimeout(()=>{this._onAnimationDone(e?dt:Ze);}),this._changeDetectorRef.markForCheck();}_updateDirectDescendants(){this._allItems.changes.pipe(bd(this._allItems)).subscribe(e=>{this._directDescendantItems.reset(e.filter(t=>t._parentMenu===this)),this._directDescendantItems.notifyOnChanges();});}_resolvePanel(){let e=null;return this._directDescendantItems.length&&(e=this._directDescendantItems.first._getHostElement().closest('[role="menu"]')),e}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=Aw({type:n,selectors:[["mat-menu"]],contentQueries:function(t,o,a){if(t&1&&kg(a,Sn,5)(a,Le,5)(a,Le,4),t&2){let m;IC(m=wC())&&(o.lazyContent=m.first),IC(m=wC())&&(o._allItems=m),IC(m=wC())&&(o.items=m);}},viewQuery:function(t,o){if(t&1&&Fg(lr,5),t&2){let a;IC(a=wC())&&(o.templateRef=a.first);}},hostVars:3,hostBindings:function(t,o){t&2&&Cg("aria-label",null)("aria-labelledby",null)("aria-describedby",null);},inputs:{backdropClass:"backdropClass",ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],ariaDescribedby:[0,"aria-describedby","ariaDescribedby"],xPosition:"xPosition",yPosition:"yPosition",overlapTrigger:[2,"overlapTrigger","overlapTrigger",YT],hasBackdrop:[2,"hasBackdrop","hasBackdrop",e=>e==null?null:YT(e)],panelClass:[0,"class","panelClass"],classList:"classList"},outputs:{closed:"closed",close:"close"},exportAs:["matMenu"],features:[nT([{provide:mt,useExisting:n}])],ngContentSelectors:ri,decls:1,vars:0,consts:[["tabindex","-1","role","menu",1,"mat-mdc-menu-panel",3,"click","animationstart","animationend","animationcancel","id"],[1,"mat-mdc-menu-content"]],template:function(t,o){t&1&&(vC(),Eg(0,si,3,12,"ng-template"));},styles:[`mat-menu {
|
|
1
|
+
import {N as Ne,u as ui$1,a as me,f as fi$1,Y as Yt,V as Ve$1,n as ne}from'./chunk-CL8NUXXa.js';import {g,az as Qt,aQ as As,aY as ks,al as yt,A as Aw,o as bg,v as vs,q as oC,k as dl,T as TC,r as Tg,X as XE,x as iC,D as Fg,I as IC,E as wC,j as Gn$1,l as Ag,W as WC,b_ as FC,C as Cg,a8 as Zg,O as Ot,w as we$1,cJ as gB,ca as hB,H as Hi$1,m as mT,b as U,bz as vC,bA as DC,ad as Vg,y as Hg,aw as fl,b5 as Sg,ax as pl,n as eC,t as tC,cb as pB,cq as mB,cc as Hf,cu as Lg,cv as CC,cd as Sb,af as Dg,an as ce,cK as Id,cL as Nd,bR as ga$1,S as pa,cI as Rg,b$ as Ng,cM as An$1,aK as Do$1,aL as Wn$1,bq as sn,bC as ge,aN as wt$1,bD as vt,br as wl,bK as pe,aR as K,cN as is,a as P,aS as Ut,cO as Bt,bQ as bd,bO as Yy,bt as Ve,c1 as ME,z as z$1,aZ as YT,bH as Eg,b4 as nT,aV as w,bu as kg,aU as U$1,bv as St,aW as D,bw as on,by as Oi$1,bE as X,cP as q,cQ as X$1,ac as mC,a9 as dC,aa as If,ab as wf,a5 as ml,cR as Yt$1,cS as Gp,bL as gr,aO as G,ae as Ot$1,aA as sn$1,bV as Y,cT as pi,cU as yg,aC as wu,bx as am,cA as on$1,c7 as QT,ah as rT,a4 as rC,c8 as kf,bs as Qn$2,ap as Vy,bW as Pt,bY as X$2,bZ as xt,cV as YI,cC as Ce,a3 as HI,a6 as $I,bn as nC,c2 as kt,bI as lr,a_ as XC,b3 as oT,a$ as Yg,cg as Mg,cW as yr,cX as tt$1,aX as ft$1,cy as Xr,ag as fT}from'./main-Z5SI5ZVQ.js';import {w as wt,j as Yn$1,k as _t$1,n as ni,l as Xn$1,E as En$1,z as ze,Q as Qn$1,e as ei,Y as Ye,f as fn,a as wt$2,A as At,Z as Zn$1,C as Cn}from'./chunk-BXfg4Cn0.js';var ii=[[["mat-icon"],["","matMenuItemIcon",""]],"*"],oi=["mat-icon, [matMenuItemIcon]","*"];function ai(n,i){n&1&&(kf(),vs(0,"svg",2),bg(1,"polygon",3),dl());}var ri=["*"];function si(n,i){if(n&1){let e=dC();fl(0,"div",0),Rg("click",function(){If(e);let o=mC();return wf(o.closed.emit("click"))})("animationstart",function(o){If(e);let a=mC();return wf(a._onAnimationStart(o.animationName))})("animationend",function(o){If(e);let a=mC();return wf(a._onAnimationDone(o.animationName))})("animationcancel",function(o){If(e);let a=mC();return wf(a._onAnimationDone(o.animationName))}),fl(1,"div",1),DC(2),pl()();}if(n&2){let e=mC();FC(e._classList),Hg("mat-menu-panel-animations-disabled",e._animationsDisabled)("mat-menu-panel-exit-animation",e._panelAnimationState==="void")("mat-menu-panel-animating",e._isAnimating()),Ng("id",e.panelId),Cg("aria-label",e.ariaLabel||null)("aria-labelledby",e.ariaLabelledby||null)("aria-describedby",e.ariaDescribedby||null);}}var mt=new w("MAT_MENU_PANEL"),Le=(()=>{class n{_elementRef=g(Qt);_document=g(U$1);_focusMonitor=g(St);_parentMenu=g(mt,{optional:true});_changeDetectorRef=g(wl);role="menuitem";disabled=false;disableRipple=false;_hovered=new ce;_focused=new ce;_highlighted=false;_triggersSubmenu=false;constructor(){g(D).load(on),this._parentMenu?.addItem?.(this);}focus(e,t){this._focusMonitor&&e?this._focusMonitor.focusVia(this._getHostElement(),e,t):this._getHostElement().focus(t),this._focused.next(this);}ngAfterViewInit(){this._focusMonitor&&this._focusMonitor.monitor(this._elementRef,false);}ngOnDestroy(){this._focusMonitor&&this._focusMonitor.stopMonitoring(this._elementRef),this._parentMenu&&this._parentMenu.removeItem&&this._parentMenu.removeItem(this),this._hovered.complete(),this._focused.complete();}_getTabIndex(){return this.disabled?"-1":"0"}_getHostElement(){return this._elementRef.nativeElement}_checkDisabled(e){this.disabled&&(e.preventDefault(),e.stopPropagation());}_handleMouseEnter(){this._hovered.next(this);}getLabel(){let e=this._elementRef.nativeElement.cloneNode(true),t=e.querySelectorAll("mat-icon, .material-icons");for(let o=0;o<t.length;o++)t[o].remove();return e.textContent?.trim()||""}_setHighlighted(e){this._highlighted=e,this._changeDetectorRef.markForCheck();}_setTriggersSubmenu(e){this._triggersSubmenu=e,this._changeDetectorRef.markForCheck();}_hasFocus(){return this._document&&this._document.activeElement===this._getHostElement()}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=Aw({type:n,selectors:[["","mat-menu-item",""]],hostAttrs:[1,"mat-mdc-menu-item","mat-focus-indicator"],hostVars:8,hostBindings:function(t,o){t&1&&Ag("click",function(m){return o._checkDisabled(m)})("mouseenter",function(){return o._handleMouseEnter()}),t&2&&(Cg("role",o.role)("tabindex",o._getTabIndex())("aria-disabled",o.disabled)("disabled",o.disabled||null),Hg("mat-mdc-menu-item-highlighted",o._highlighted)("mat-mdc-menu-item-submenu-trigger",o._triggersSubmenu));},inputs:{role:"role",disabled:[2,"disabled","disabled",YT],disableRipple:[2,"disableRipple","disableRipple",YT]},exportAs:["matMenuItem"],ngContentSelectors:oi,decls:5,vars:3,consts:[[1,"mat-mdc-menu-item-text"],["matRipple","",1,"mat-mdc-menu-ripple",3,"matRippleDisabled","matRippleTrigger"],["viewBox","0 0 5 10","focusable","false","aria-hidden","true",1,"mat-mdc-menu-submenu-icon"],["points","0,0 5,5 0,10"]],template:function(t,o){t&1&&(vC(ii),DC(0),vs(1,"span",0),DC(2,1),dl(),bg(3,"div",1),eC(4,ai,2,0,":svg:svg",2)),t&2&&(XE(3),Tg("matRippleDisabled",o.disableRipple||o.disabled)("matRippleTrigger",o._getHostElement()),XE(),tC(o._triggersSubmenu?4:-1));},dependencies:[Oi$1],encapsulation:2})}return n})();var Sn=new w("MatMenuContent"),ga=(()=>{class n{_template=g(lr);_appRef=g(yr);_injector=g(pe);_viewContainerRef=g(gr);_document=g(U$1);_changeDetectorRef=g(wl);_portal;_outlet;_attached=new ce;attach(e={}){this._portal||(this._portal=new Y(this._template,this._viewContainerRef)),this.detach(),this._outlet||(this._outlet=new tt$1(this._document.createElement("div"),this._appRef,this._injector));let t=this._template.elementRef.nativeElement;t.parentNode.insertBefore(this._outlet.outletElement,t),this._changeDetectorRef.markForCheck(),this._portal.attach(this._outlet,e),this._attached.next();}detach(){this._portal?.isAttached&&this._portal.detach();}ngOnDestroy(){this.detach(),this._outlet?.dispose();}static \u0275fac=function(t){return new(t||n)};static \u0275dir=ks({type:n,selectors:[["ng-template","matMenuContent",""]],features:[nT([{provide:Sn,useExisting:n}])]})}return n})(),li=new w("mat-menu-default-options",{providedIn:"root",factory:()=>({overlapTrigger:false,xPosition:"after",yPosition:"below",backdropClass:"cdk-overlay-transparent-backdrop"})}),dt="_mat-menu-enter",Ze="_mat-menu-exit",ke=(()=>{class n{_elementRef=g(Qt);_changeDetectorRef=g(wl);_injector=g(pe);_keyManager;_xPosition;_yPosition;_firstItemFocusRef;_exitFallbackTimeout;_animationsDisabled=K();_allItems;_directDescendantItems=new is;_classList={};_panelAnimationState="void";_animationDone=new ce;_isAnimating=Hi$1(false);parentMenu;direction;overlayPanelClass;backdropClass;ariaLabel;ariaLabelledby;ariaDescribedby;get xPosition(){return this._xPosition}set xPosition(e){this._xPosition=e,this.setPositionClasses();}get yPosition(){return this._yPosition}set yPosition(e){this._yPosition=e,this.setPositionClasses();}templateRef;items;lazyContent;overlapTrigger=false;hasBackdrop;get panelClass(){return this._previousPanelClass}set panelClass(e){let t=this._previousPanelClass,o=P({},this._classList);t&&t.length&&t.split(" ").forEach(a=>{o[a]=false;}),this._previousPanelClass=e,e&&e.length&&(e.split(" ").forEach(a=>{o[a]=true;}),this._elementRef.nativeElement.className=""),this._classList=o;}_previousPanelClass="";get classList(){return this.panelClass}set classList(e){this.panelClass=e;}closed=new yt;close=this.closed;panelId=g(Ut).getId("mat-menu-panel-");constructor(){let e=g(li);this.overlayPanelClass=e.overlayPanelClass||"",this._xPosition=e.xPosition,this._yPosition=e.yPosition,this.backdropClass=e.backdropClass,this.overlapTrigger=e.overlapTrigger,this.hasBackdrop=e.hasBackdrop;}ngOnInit(){this.setPositionClasses();}ngAfterContentInit(){this._updateDirectDescendants(),this._keyManager=new Bt(this._directDescendantItems).withWrap().withTypeAhead().withHomeAndEnd(),this._keyManager.tabOut.subscribe(()=>this.closed.emit("tab")),this._directDescendantItems.changes.pipe(bd(this._directDescendantItems),ga$1(e=>Yy(...e.map(t=>t._focused)))).subscribe(e=>this._keyManager.updateActiveItem(e)),this._directDescendantItems.changes.subscribe(e=>{let t=this._keyManager;if(this._panelAnimationState==="enter"&&t.activeItem?._hasFocus()){let o=e.toArray(),a=Math.max(0,Math.min(o.length-1,t.activeItemIndex||0));o[a]&&!o[a].disabled?t.setActiveItem(a):t.setNextItemActive();}});}ngOnDestroy(){this._keyManager?.destroy(),this._directDescendantItems.destroy(),this.closed.complete(),this._firstItemFocusRef?.destroy(),clearTimeout(this._exitFallbackTimeout);}_hovered(){return this._directDescendantItems.changes.pipe(bd(this._directDescendantItems),ga$1(t=>Yy(...t.map(o=>o._hovered))))}addItem(e){}removeItem(e){}_handleKeydown(e){let t=e.keyCode,o=this._keyManager;switch(t){case 27:Ve(e)||(e.preventDefault(),this.closed.emit("keydown"));break;case 37:this.parentMenu&&this.direction==="ltr"&&this.closed.emit("keydown");break;case 39:this.parentMenu&&this.direction==="rtl"&&this.closed.emit("keydown");break;default:(t===38||t===40)&&o.setFocusOrigin("keyboard"),o.onKeydown(e);return}}focusFirstItem(e="program"){this._firstItemFocusRef?.destroy(),this._firstItemFocusRef=ME(()=>{let t=this._resolvePanel();if(!t||!t.contains(document.activeElement)){let o=this._keyManager;o.setFocusOrigin(e).setFirstItemActive(),!o.activeItem&&t&&t.focus();}},{injector:this._injector});}resetActiveItem(){this._keyManager.setActiveItem(-1);}setElevation(e){}setPositionClasses(e=this.xPosition,t=this.yPosition){this._classList=z$1(P({},this._classList),{"mat-menu-before":e==="before","mat-menu-after":e==="after","mat-menu-above":t==="above","mat-menu-below":t==="below"}),this._changeDetectorRef.markForCheck();}_onAnimationDone(e){let t=e===Ze;(t||e===dt)&&(t&&(clearTimeout(this._exitFallbackTimeout),this._exitFallbackTimeout=void 0),this._animationDone.next(t?"void":"enter"),this._isAnimating.set(false));}_onAnimationStart(e){(e===dt||e===Ze)&&this._isAnimating.set(true);}_setIsOpen(e){if(this._panelAnimationState=e?"enter":"void",e){if(this._keyManager.activeItemIndex===0){let t=this._resolvePanel();t&&(t.scrollTop=0);}}else this._animationsDisabled||(this._exitFallbackTimeout=setTimeout(()=>this._onAnimationDone(Ze),200));this._animationsDisabled&&setTimeout(()=>{this._onAnimationDone(e?dt:Ze);}),this._changeDetectorRef.markForCheck();}_updateDirectDescendants(){this._allItems.changes.pipe(bd(this._allItems)).subscribe(e=>{this._directDescendantItems.reset(e.filter(t=>t._parentMenu===this)),this._directDescendantItems.notifyOnChanges();});}_resolvePanel(){let e=null;return this._directDescendantItems.length&&(e=this._directDescendantItems.first._getHostElement().closest('[role="menu"]')),e}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=Aw({type:n,selectors:[["mat-menu"]],contentQueries:function(t,o,a){if(t&1&&kg(a,Sn,5)(a,Le,5)(a,Le,4),t&2){let m;IC(m=wC())&&(o.lazyContent=m.first),IC(m=wC())&&(o._allItems=m),IC(m=wC())&&(o.items=m);}},viewQuery:function(t,o){if(t&1&&Fg(lr,5),t&2){let a;IC(a=wC())&&(o.templateRef=a.first);}},hostVars:3,hostBindings:function(t,o){t&2&&Cg("aria-label",null)("aria-labelledby",null)("aria-describedby",null);},inputs:{backdropClass:"backdropClass",ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],ariaDescribedby:[0,"aria-describedby","ariaDescribedby"],xPosition:"xPosition",yPosition:"yPosition",overlapTrigger:[2,"overlapTrigger","overlapTrigger",YT],hasBackdrop:[2,"hasBackdrop","hasBackdrop",e=>e==null?null:YT(e)],panelClass:[0,"class","panelClass"],classList:"classList"},outputs:{closed:"closed",close:"close"},exportAs:["matMenu"],features:[nT([{provide:mt,useExisting:n}])],ngContentSelectors:ri,decls:1,vars:0,consts:[["tabindex","-1","role","menu",1,"mat-mdc-menu-panel",3,"click","animationstart","animationend","animationcancel","id"],[1,"mat-mdc-menu-content"]],template:function(t,o){t&1&&(vC(),Eg(0,si,3,12,"ng-template"));},styles:[`mat-menu {
|
|
2
2
|
display: none;
|
|
3
3
|
}
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {u}from'./chunk-
|
|
1
|
+
import {u}from'./chunk-CK3s5ul2.js';import {g,dg as Q,dh as T,S as pa,bR as ga,u as ue,a7 as ha,cD as Rd,Y as x}from'./main-Z5SI5ZVQ.js';var v=class i{userState=g(u);membership=g(Q);currentUser$=T(this.userState.currentUser);cache=new Map;isAdminOfNamespace$(e){if(!e)return pa(false);let t=this.cache.get(e);if(t)return t;let s=this.currentUser$.pipe(ga(a=>a?a.isAdmin?pa(true):this.membership.getMembersNamespaceMembership(e).pipe(ue(d=>d.some(n=>n.id===a.id&&n.role==="ADMIN")),ha(()=>pa(false))):pa(false)),Rd({bufferSize:1,refCount:false}));return this.cache.set(e,s),s}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};export{v};
|