@whoz-oss/coday-client 0.0.0-workstream-forge.106 → 0.0.0-workstream-forge.108

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/browser/{chunk-DIrez99x.js → chunk-1qxtpXum.js} +1 -1
  2. package/browser/{chunk-HRUxEFNV.js → chunk-3arSLCsL.js} +1 -1
  3. package/browser/{chunk-BoMAQeIx.js → chunk-8Fdi2AUg.js} +1 -1
  4. package/browser/{chunk-CjKuOoYl.js → chunk-9HQsVoR7.js} +1 -1
  5. package/browser/{chunk-BrWe3Tc0.js → chunk-AdPMVy2T.js} +1 -1
  6. package/browser/{chunk-m-t8eFzj.js → chunk-B0emNCN6.js} +1 -1
  7. package/browser/{chunk-D4POvHTC.js → chunk-B8kbBJuq.js} +1 -1
  8. package/browser/{chunk-CEizRT71.js → chunk-BAkBK7RM.js} +1 -1
  9. package/browser/{chunk-CHFfpyIc.js → chunk-BDm99Ksh.js} +1 -1
  10. package/browser/{chunk-DNUoJb9d.js → chunk-BGqgwB-o.js} +1 -1
  11. package/browser/{chunk-9t0dGUuC.js → chunk-BHaCDZtZ.js} +1 -1
  12. package/browser/{chunk-BOdSBH-Z.js → chunk-BKiEHvJE.js} +1 -1
  13. package/browser/{chunk-lkQw5eQ_.js → chunk-BKxShcbV.js} +1 -1
  14. package/browser/{chunk-DhCn0LVf.js → chunk-BOTun9xs.js} +1 -1
  15. package/browser/{chunk-Bp63FVq7.js → chunk-BXySg6jk.js} +1 -1
  16. package/browser/{chunk-FV8LaU7e.js → chunk-B_SBnFI8.js} +1 -1
  17. package/browser/{chunk-DqLrAE6M.js → chunk-Ba8pScsz.js} +1 -1
  18. package/browser/{chunk-B6OZW8wN.js → chunk-BbtVOMTU.js} +1 -1
  19. package/browser/{chunk-CIRByaMA.js → chunk-BeOtLXIa.js} +1 -1
  20. package/browser/{chunk-DUxFDQE0.js → chunk-BhQHLrzW.js} +1 -1
  21. package/browser/{chunk-C3o3QVhs.js → chunk-BjqDAkTL.js} +1 -1
  22. package/browser/{chunk-C-oYJ39L.js → chunk-BossQZF6.js} +1 -1
  23. package/browser/{chunk-CYC-I1Mg.js → chunk-BpllynbC.js} +1 -1
  24. package/browser/{chunk-DoJEGSbs.js → chunk-Btt7Zr2M.js} +1 -1
  25. package/browser/{chunk-sqGaEvm9.js → chunk-BvNxH5OS.js} +1 -1
  26. package/browser/{chunk-DSh1tjBw.js → chunk-BwDRO03X.js} +1 -1
  27. package/browser/{chunk-CiGypT43.js → chunk-BwTXpLZu.js} +1 -1
  28. package/browser/{chunk-LtCKJR0U.js → chunk-C-PGqagA.js} +1 -1
  29. package/browser/{chunk-C5_Zcy7N.js → chunk-C2chhSLr.js} +1 -1
  30. package/browser/{chunk-BatX6vs0.js → chunk-C7a54XFG.js} +1 -1
  31. package/browser/{chunk-Bk-0cIam.js → chunk-C93oAiDh.js} +1 -1
  32. package/browser/{chunk-CJaI0n6Y.js → chunk-CB_envwE.js} +1 -1
  33. package/browser/{chunk-ORbAjzgA.js → chunk-CCFqXl1j.js} +1 -1
  34. package/browser/{chunk-CjeED1ew.js → chunk-CKhgf7Wn.js} +1 -1
  35. package/browser/{chunk-BSRWEUf3.js → chunk-CM72Zsqv.js} +1 -1
  36. package/browser/{chunk-BuSX6FVc.js → chunk-CQEl2S8c.js} +1 -1
  37. package/browser/{chunk-Dl8oDumK.js → chunk-CVbM-LbT.js} +1 -1
  38. package/browser/{chunk-DnszH38I.js → chunk-CXU78-_W.js} +1 -1
  39. package/browser/{chunk-C0C_xi5w.js → chunk-CZ3MCbb4.js} +1 -1
  40. package/browser/{chunk-DF1nf97L.js → chunk-ClHl7eW-.js} +1 -1
  41. package/browser/{chunk-DLoICesN.js → chunk-Cn8ABj_T.js} +1 -1
  42. package/browser/{chunk-gFrPRGkc.js → chunk-CsZh-eL4.js} +1 -1
  43. package/browser/{chunk-BqZAHySB.js → chunk-CyI5KqTH.js} +1 -1
  44. package/browser/{chunk-C8UVOyhT.js → chunk-D-C39lLD.js} +1 -1
  45. package/browser/{chunk-prOpH6CY.js → chunk-D3hm7jI9.js} +1 -1
  46. package/browser/{chunk-Diew0ikf.js → chunk-D6ZadDnX.js} +1 -1
  47. package/browser/{chunk-BmZ9yw5t.js → chunk-DFV_94IQ.js} +1 -1
  48. package/browser/{chunk-C0d355eD.js → chunk-DKGIDAkY.js} +1 -1
  49. package/browser/{chunk-BxK6jZXt.js → chunk-DVQCKTyN.js} +1 -1
  50. package/browser/{chunk-BF54SE4Z.js → chunk-Dfxox4tZ.js} +1 -1
  51. package/browser/{chunk-BDCAzL3z.js → chunk-DgLRCX4w.js} +1 -1
  52. package/browser/{chunk-CQnXbo49.js → chunk-DgySCmsc.js} +1 -1
  53. package/browser/{chunk-eeMC5EPB.js → chunk-DnIQopma.js} +1 -1
  54. package/browser/{chunk-CKO-l3V9.js → chunk-DqTacE0P.js} +1 -1
  55. package/browser/{chunk-MZ4wRIEo.js → chunk-DregcDV6.js} +1 -1
  56. package/browser/{chunk-DAtwHi5G.js → chunk-DvgF2GEo.js} +1 -1
  57. package/browser/{chunk-DlGT7b2J.js → chunk-Ei51OvgQ.js} +1 -1
  58. package/browser/{chunk-DqnU1y0y.js → chunk-GLlIZOT9.js} +1 -1
  59. package/browser/{chunk-DYyjYklW.js → chunk-K3v_Owq7.js} +1 -1
  60. package/browser/{chunk-BTwVcLbP.js → chunk-KvVZUdz7.js} +1 -1
  61. package/browser/{chunk-CmObLvei.js → chunk-VgVDkZ4m.js} +1 -1
  62. package/browser/{chunk-Btndt-0_.js → chunk-WQPiAxqd.js} +1 -1
  63. package/browser/{chunk-waGtT2fH.js → chunk-YBI4hQOK.js} +1 -1
  64. package/browser/{chunk-BD1J-qMV.js → chunk-b2XDr4b4.js} +1 -1
  65. package/browser/{chunk-By7YGzD4.js → chunk-dY7-bZcz.js} +1 -1
  66. package/browser/chunk-fBYTYGxD.js +10 -0
  67. package/browser/{chunk-Cvyvj0DZ.js → chunk-ixCHaxFX.js} +1 -1
  68. package/browser/{chunk-B4imwkV0.js → chunk-yApl8vaa.js} +1 -1
  69. package/browser/{chunk-DJTNjd3B.js → chunk-zIMeg4Tv.js} +1 -1
  70. package/browser/{chunk-B4GToBYG.js → chunk-zVECqtqn.js} +1 -1
  71. package/browser/chunk-znO_jWPo.js +1 -0
  72. package/browser/index.html +1 -1
  73. package/browser/{main-EVOOW2CG.js → main-E674WB3K.js} +1 -1
  74. package/package.json +1 -1
  75. package/browser/chunk-Cfby0A0V.js +0 -1
  76. package/browser/chunk-pkNoeD9f.js +0 -10
@@ -1 +1 @@
1
- import {c}from'./chunk-BuSX6FVc.js';import {g,ao as W,F,C as Ce$1,da as $,db as Ie$1,dc as Re$1,G as Gi,dd as Oe$1,a as F$1,bR as wd,m as mT,M as By,b as U,a7 as ya,Q as br,x,w,e as xw,k as ws,q as Rg,n as GC,o as pl,J as Jw,X as XE,a5 as vl,v as eC,a9 as lC,S as Sg,a3 as VI,s as rC,ac as gC,u as bg,z as Ug,a6 as UI,y as oC,a8 as Yg,aa as If,ab as wf,bk as yh}from'./main-EVOOW2CG.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-FV8LaU7e.js';var A=(n,t)=>t.value,me=(n,t)=>t.id;function pe(n,t){n&1&&(ws(0,"p",5),GC(1,"Loading\u2026"),pl());}function ue(n,t){n&1&&(ws(0,"span",12),GC(1," Name is required. "),pl());}function fe(n,t){if(n&1&&(ws(0,"p",42),GC(1),pl(),ws(2,"span",13),GC(3,"Agent Config cannot be changed after creation."),pl()),n&2){let e=gC(2);XE(),Yg(e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function _e(n,t){if(n&1&&(ws(0,"a",43),GC(1,"Add an agent config"),pl(),GC(2," first. ")),n&2){let e=gC(3);bg("href","/agentos/"+e.namespaceId+"/agent-configs/new",yh);}}function he(n,t){if(n&1&&(ws(0,"p",13),GC(1," No agent configs available in this scope yet. "),Jw(2,_e,3,1),pl()),n&2){let e=gC(2);XE(2),eC(e.isPlatformMode?-1:2);}}function ge(n,t){if(n&1&&(ws(0,"option",23),GC(1),pl()),n&2){let e=t.$implicit;bg("value",e.id),XE(),Yg(e.name);}}function Ce(n,t){n&1&&(ws(0,"span",12),GC(1,"Agent Config is required."),pl());}function ve(n,t){if(n&1&&(ws(0,"select",44)(1,"option",45),GC(2,"Select an agent config\u2026"),pl(),rC(3,ge,2,2,"option",23,me),pl(),VI(),Jw(5,Ce,2,0,"span",12),ws(6,"span",13),GC(7,"Immutable after creation."),pl()),n&2){let e=gC(2);bg("formControl",e.agentConfigIdControl),UI(),XE(3),oC(e.availableAgentConfigs()),XE(2),eC(e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?5:-1);}}function xe(n,t){n&1&&(ws(0,"span",12),GC(1,"Opening message is required."),pl());}function ye(n,t){if(n&1&&(ws(0,"option",23),GC(1),pl()),n&2){let e=t.$implicit;bg("value",e.value),XE(),Yg(e.label);}}function be(n,t){if(n&1){let e=lC();ws(0,"label",48)(1,"input",49),Rg("change",function(){let g=If(e).$implicit,v=gC(3);return wf(v.toggleDay(g.value))}),pl(),ws(2,"span",50),GC(3),pl()();}if(n&2){let e=t.$implicit,d=gC(3);XE(),bg("checked",d.isDaySelected(e.value)),XE(2),Yg(e.label);}}function Se(n,t){if(n&1&&(ws(0,"div",8)(1,"span",46),GC(2,"Days of week"),pl(),ws(3,"div",47),rC(4,be,4,2,"label",48,A),pl(),ws(6,"span",13),GC(7,"Leave empty to run every day of the week."),pl()()),n&2){let e=gC(2);XE(4),oC(e.dayOptions);}}function Ee(n,t){n&1&&(ws(0,"span",12),GC(1,"Valid time is required (HH:mm)."),pl());}function Pe(n,t){n&1&&(ws(0,"span",12),GC(1,"Start date is required."),pl());}function Me(n,t){if(n&1&&(ws(0,"option",23),GC(1),pl()),n&2){let e=t.$implicit;bg("value",e.value),XE(),Yg(e.label);}}function Oe(n,t){n&1&&(ws(0,"span",12),GC(1,"End date is required."),pl());}function De(n,t){if(n&1&&(ws(0,"div",8)(1,"label",51),GC(2," End date "),ws(3,"span",10),GC(4,"*"),pl()(),Sg(5,"input",52),VI(),Jw(6,Oe,2,0,"span",12),pl()),n&2){let e=gC(2);XE(5),Ug("scheduled-prompt-form__input--invalid",e.form.hasError("endDateRequired")&&e.endDateControl.touched),bg("formControl",e.endDateControl),UI(),XE(),eC(e.form.hasError("endDateRequired")&&e.endDateControl.touched?6:-1);}}function Te(n,t){n&1&&(ws(0,"span",12),GC(1,"Must be at least 1."),pl());}function we(n,t){if(n&1&&(ws(0,"div",8)(1,"label",53),GC(2," Number of occurrences "),ws(3,"span",10),GC(4,"*"),pl()(),Sg(5,"input",54),VI(),Jw(6,Te,2,0,"span",12),pl()),n&2){let e=gC(2);XE(5),Ug("scheduled-prompt-form__input--invalid",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched),bg("formControl",e.occurrenceCountControl),UI(),XE(),eC(e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?6:-1);}}function ke(n,t){n&1&&(ws(0,"span",12),GC(1,"Invalid JSON."),pl());}function Ne(n,t){if(n&1&&(ws(0,"p",38),GC(1),pl()),n&2){let e=gC(2);XE(),Yg(e.errorMessage());}}function Fe(n,t){if(n&1){let e=lC();ws(0,"form",7),Rg("ngSubmit",function(){If(e);let g=gC();return wf(g.submit())}),ws(1,"div",8)(2,"label",9),GC(3," Name "),ws(4,"span",10),GC(5,"*"),pl()(),Sg(6,"input",11),VI(),Jw(7,ue,2,0,"span",12),ws(8,"span",13),GC(9,'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.'),pl()(),ws(10,"div",8)(11,"label",14),GC(12,"Description"),pl(),Sg(13,"input",15),VI(),pl(),ws(14,"div",8)(15,"label",16),GC(16," Agent Config "),ws(17,"span",10),GC(18,"*"),pl()(),Jw(19,fe,4,1)(20,he,3,1,"p",13)(21,ve,8,2),pl(),ws(22,"div",8)(23,"label",17),GC(24," Opening message "),ws(25,"span",10),GC(26,"*"),pl()(),Sg(27,"textarea",18),VI(),Jw(28,xe,2,0,"span",12),ws(29,"span",13),GC(30," The message sent to the agent when the scheduled prompt fires. "),pl()(),ws(31,"fieldset",19)(32,"legend",20),GC(33,"Recurrence"),pl(),ws(34,"div",8)(35,"label",21),GC(36," Unit "),ws(37,"span",10),GC(38,"*"),pl()(),ws(39,"select",22),rC(40,ye,2,2,"option",23,A),pl(),VI(),pl(),Jw(42,Se,8,0,"div",8),ws(43,"div",8)(44,"label",24),GC(45," Time (UTC) "),ws(46,"span",10),GC(47,"*"),pl()(),ws(48,"div",25),Sg(49,"input",26),VI(),ws(50,"span",27),GC(51,"UTC"),pl()(),Jw(52,Ee,2,0,"span",12),pl()(),ws(53,"fieldset",19)(54,"legend",20),GC(55,"Planning"),pl(),ws(56,"div",8)(57,"label",28),GC(58," Start date "),ws(59,"span",10),GC(60,"*"),pl()(),Sg(61,"input",29),VI(),Jw(62,Pe,2,0,"span",12),pl(),ws(63,"div",8)(64,"label",30),GC(65," Ends "),ws(66,"span",10),GC(67,"*"),pl()(),ws(68,"select",31),rC(69,Me,2,2,"option",23,A),pl(),VI(),pl(),Jw(71,De,7,4,"div",8),Jw(72,we,7,4,"div",8),pl(),ws(73,"div",8)(74,"label",32),Sg(75,"input",33),VI(),ws(76,"span",34),GC(77,"Enabled"),pl()(),ws(78,"p",35),GC(79," When disabled, the scheduled prompt is saved but will not run on schedule. "),pl()(),ws(80,"div",8)(81,"label",36),GC(82,"External Metadata"),pl(),Sg(83,"textarea",37),VI(),Jw(84,ke,2,0,"span",12),ws(85,"span",13),GC(86,"Optional. Opaque JSON object stored as-is. Leave empty to clear."),pl()(),Jw(87,Ne,2,1,"p",38),ws(88,"div",39)(89,"button",40),GC(90),pl(),ws(91,"button",41),Rg("click",function(){If(e);let g=gC();return wf(g.cancel())}),GC(92,"Cancel"),pl()()();}if(n&2){let e=gC();bg("formGroup",e.form),XE(6),Ug("scheduled-prompt-form__input--invalid",e.nameControl.invalid&&e.nameControl.touched),bg("formControl",e.nameControl),UI(),XE(),eC(e.nameControl.invalid&&e.nameControl.touched?7:-1),XE(6),bg("formControl",e.descriptionControl),UI(),XE(6),eC(e.isEditMode()?19:e.availableAgentConfigs().length===0?20:21),XE(8),Ug("scheduled-prompt-form__textarea--invalid",e.promptContentControl.invalid&&e.promptContentControl.touched),bg("formControl",e.promptContentControl),UI(),XE(),eC(e.promptContentControl.invalid&&e.promptContentControl.touched?28:-1),XE(11),bg("formControl",e.unitControl),UI(),XE(),oC(e.schedulerUnits),XE(2),eC(e.showDayFilter()?42:-1),XE(7),bg("formControl",e.timeUtcControl),UI(),XE(3),eC(e.timeUtcControl.invalid&&e.timeUtcControl.touched?52:-1),XE(9),Ug("scheduled-prompt-form__input--invalid",e.startDateControl.invalid&&e.startDateControl.touched),bg("formControl",e.startDateControl),UI(),XE(),eC(e.startDateControl.invalid&&e.startDateControl.touched?62:-1),XE(6),bg("formControl",e.endTypeControl),UI(),XE(),oC(e.endTypes),XE(2),eC(e.showEndDate()?71:-1),XE(),eC(e.showOccurrenceCount()?72:-1),XE(3),bg("formControl",e.enabledControl),UI(),XE(8),bg("formControl",e.externalMetadataJsonControl),UI(),XE(),eC(e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?84:-1),XE(3),eC(e.errorMessage()?87:-1),XE(2),bg("disabled",e.form.invalid||e.isSubmitting()),XE(),vl(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var se=class n{route=g(W);router=g(F);destroyRef=g(Ce$1);state=g(c);agentConfigController=g($);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(Re$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(Ie$1.NEVER,{nonNullable:true,validators:[_e$1.required]}),endDate:new _t(null),occurrenceCount:new _t(null),enabled:new _t(true,{nonNullable:true}),externalMetadataJson:new _t("",{nonNullable:true,validators:[Ae]})},{validators:[Ie,Ve]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}isEditMode=Gi(false);isSubmitting=Gi(false);isLoading=Gi(false);errorMessage=Gi(null);SchedulerUnit=Re$1;SchedulerEndType=Ie$1;schedulerUnits=[{value:Re$1.WEEK,label:"Week(s)"},{value:Re$1.MONTH,label:"Month(s)"}];endTypes=[{value:Ie$1.NEVER,label:"Never"},{value:Ie$1.ON_DATE,label:"On date"},{value:Ie$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(Oe$1).map(([t,e])=>({value:t,label:e}));unitSignal=F$1(this.unitControl.valueChanges.pipe(wd(this.unitControl.value)));endTypeSignal=F$1(this.endTypeControl.valueChanges.pipe(wd(this.endTypeControl.value)));showDayFilter=mT(()=>this.unitSignal()===Re$1.WEEK);showEndDate=mT(()=>this.endTypeSignal()===Ie$1.ON_DATE);showOccurrenceCount=mT(()=>this.endTypeSignal()===Ie$1.OCCURRENCES);agentConfigs=Gi([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Re());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(true),this.loadPromptAndResources(t)):this.loadResources();}loadPromptAndResources(t){this.isLoading.set(true),By({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(U(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:d})=>{this.existingPrompt=e,this.agentConfigs.set(d),this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadResources(){this.agentConfigs$().pipe(U(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(ya(()=>br([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,d=e.includes(t)?e.filter(g=>g!==t):[...e,t];this.daysControl.setValue(d);}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,d=x(w({},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===Ie$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===Ie$1.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value,removed:this.existingPrompt?.removed??false,externalMetadata:(()=>{let v=this.externalMetadataJsonControl.value.trim();return v?JSON.parse(v):null})()});(t?this.state.update(this.existingPrompt.id,d):this.state.create(d)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:v=>{this.isSubmitting.set(false),v.status===409?this.errorMessage.set(`A scheduled prompt named "${d.name}" already exists in this scope.`):v.status===400?this.errorMessage.set(v.error?.message??"Invalid scheduled prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","scheduled-prompts"]):this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=xw({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:10,vars:3,consts:[[1,"scheduled-prompt-form"],[1,"scheduled-prompt-form__header"],["type","button","title","Back to scheduled prompts",1,"scheduled-prompt-form__back",3,"click"],[1,"scheduled-prompt-form__back-icon"],[1,"scheduled-prompt-form__title"],[1,"scheduled-prompt-form__loading"],[1,"scheduled-prompt-form__form",3,"formGroup"],[1,"scheduled-prompt-form__form",3,"ngSubmit","formGroup"],[1,"scheduled-prompt-form__field"],["for","sp-name",1,"scheduled-prompt-form__label"],["aria-hidden","true"],["id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],[1,"scheduled-prompt-form__field-error"],[1,"scheduled-prompt-form__field-hint"],["for","sp-description",1,"scheduled-prompt-form__label"],["id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-agent-config",1,"scheduled-prompt-form__label"],["for","sp-prompt-content",1,"scheduled-prompt-form__label"],["id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",1,"scheduled-prompt-form__textarea",3,"formControl"],[1,"scheduled-prompt-form__fieldset"],[1,"scheduled-prompt-form__legend"],["for","sp-unit",1,"scheduled-prompt-form__label"],["id","sp-unit",1,"scheduled-prompt-form__select",3,"formControl"],[3,"value"],["for","sp-time",1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__time-wrapper"],["id","sp-time","type","time",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--time",3,"formControl"],[1,"scheduled-prompt-form__utc-badge"],["for","sp-start-date",1,"scheduled-prompt-form__label"],["id","sp-start-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-end-type",1,"scheduled-prompt-form__label"],["id","sp-end-type",1,"scheduled-prompt-form__select",3,"formControl"],[1,"scheduled-prompt-form__toggle-label"],["type","checkbox",1,"scheduled-prompt-form__toggle-checkbox",3,"formControl"],[1,"scheduled-prompt-form__toggle-text"],[1,"scheduled-prompt-form__toggle-hint"],["for","sp-external-metadata",1,"scheduled-prompt-form__label"],["id","sp-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",1,"scheduled-prompt-form__textarea","scheduled-prompt-form__textarea--code",3,"formControl"],[1,"scheduled-prompt-form__error"],[1,"scheduled-prompt-form__actions"],["type","submit",1,"scheduled-prompt-form__btn","scheduled-prompt-form__btn--primary",3,"disabled"],["type","button",1,"scheduled-prompt-form__btn",3,"click"],[1,"scheduled-prompt-form__readonly-value"],[3,"href"],["id","sp-agent-config",1,"scheduled-prompt-form__select",3,"formControl"],["value","","disabled",""],[1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__day-grid"],[1,"scheduled-prompt-form__day-label"],["type","checkbox",1,"scheduled-prompt-form__day-checkbox",3,"change","checked"],[1,"scheduled-prompt-form__day-text"],["for","sp-end-date",1,"scheduled-prompt-form__label"],["id","sp-end-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-occurrence-count",1,"scheduled-prompt-form__label"],["id","sp-occurrence-count","type","number","min","1",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--number",3,"formControl"]],template:function(e,d){e&1&&(ws(0,"div",0)(1,"header",1)(2,"button",2),Rg("click",function(){return d.cancel()}),ws(3,"span",3),GC(4,"\u2190"),pl(),GC(5),pl(),ws(6,"h1",4),GC(7),pl()(),Jw(8,pe,2,0,"p",5)(9,Fe,93,28,"form",6),pl()),e&2&&(XE(5),vl(" ",d.isPlatformMode?"Platform Scheduled Prompts":"Scheduled Prompts"," "),XE(2),vl(" ",d.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"," "),XE(),eC(d.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,fn,wt,At,Zn,Xn,$t,Cn,En],styles:[".scheduled-prompt-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.scheduled-prompt-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.scheduled-prompt-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.scheduled-prompt-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.scheduled-prompt-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.scheduled-prompt-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.scheduled-prompt-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.scheduled-prompt-form__row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.scheduled-prompt-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__input[_ngcontent-%COMP%], .scheduled-prompt-form__select[_ngcontent-%COMP%], .scheduled-prompt-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.scheduled-prompt-form__input[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__select[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.scheduled-prompt-form__input[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__select[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__select[_ngcontent-%COMP%]{cursor:pointer;appearance:auto}.scheduled-prompt-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:100px;line-height:1.5}.scheduled-prompt-form__input--time[_ngcontent-%COMP%]{flex:1;min-width:0}.scheduled-prompt-form__input--number[_ngcontent-%COMP%]{max-width:120px}.scheduled-prompt-form__time-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.scheduled-prompt-form__utc-badge[_ngcontent-%COMP%]{flex-shrink:0;font-size:.75rem;font-weight:600;font-family:monospace;color:var(--color-text-secondary, #6e6e73);background:var(--color-surface, rgba(0, 0, 0, .05));padding:.25rem .5rem;border-radius:4px;text-transform:uppercase;letter-spacing:.06em}.scheduled-prompt-form__fieldset[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:8px;padding:1rem 1.25rem 1.25rem;margin:0;display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__legend[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--color-text-secondary, #6e6e73);padding:0 .375rem}.scheduled-prompt-form__day-grid[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.5rem}.scheduled-prompt-form__day-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__day-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__day-text[_ngcontent-%COMP%]{font-size:.875rem;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__hint[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30);margin:0}.scheduled-prompt-form__field-error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30)}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__readonly-value[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;color:var(--color-text, #1d1d1f);padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--color-surface, rgba(0, 0, 0, .03))}.scheduled-prompt-form__input--invalid[_ngcontent-%COMP%], .scheduled-prompt-form__textarea--invalid[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30)}.scheduled-prompt-form__toggle-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__toggle-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__toggle-text[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__toggle-hint[_ngcontent-%COMP%]{margin:.25rem 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.scheduled-prompt-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"]})};function Ie(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===Ie$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ve(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===Ie$1.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function Ae(n){let t=n.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}function Re(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),d=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${d}`}export{se as ScheduledPromptFormComponent};
1
+ import {c}from'./chunk-CQEl2S8c.js';import {g,ao as W,F,C as Ce$1,da as $,db as Ie$1,dc as Re$1,G as Gi,dd as Oe$1,a as F$1,bR as wd,m as mT,M as By,b as U,a7 as ya,Q as br,x,w,e as xw,k as ws,q as Rg,n as GC,o as pl,J as Jw,X as XE,a5 as vl,v as eC,a9 as lC,S as Sg,a3 as VI,s as rC,ac as gC,u as bg,z as Ug,a6 as UI,y as oC,a8 as Yg,aa as If,ab as wf,bk as yh}from'./main-E674WB3K.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-B_SBnFI8.js';var A=(n,t)=>t.value,me=(n,t)=>t.id;function pe(n,t){n&1&&(ws(0,"p",5),GC(1,"Loading\u2026"),pl());}function ue(n,t){n&1&&(ws(0,"span",12),GC(1," Name is required. "),pl());}function fe(n,t){if(n&1&&(ws(0,"p",42),GC(1),pl(),ws(2,"span",13),GC(3,"Agent Config cannot be changed after creation."),pl()),n&2){let e=gC(2);XE(),Yg(e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function _e(n,t){if(n&1&&(ws(0,"a",43),GC(1,"Add an agent config"),pl(),GC(2," first. ")),n&2){let e=gC(3);bg("href","/agentos/"+e.namespaceId+"/agent-configs/new",yh);}}function he(n,t){if(n&1&&(ws(0,"p",13),GC(1," No agent configs available in this scope yet. "),Jw(2,_e,3,1),pl()),n&2){let e=gC(2);XE(2),eC(e.isPlatformMode?-1:2);}}function ge(n,t){if(n&1&&(ws(0,"option",23),GC(1),pl()),n&2){let e=t.$implicit;bg("value",e.id),XE(),Yg(e.name);}}function Ce(n,t){n&1&&(ws(0,"span",12),GC(1,"Agent Config is required."),pl());}function ve(n,t){if(n&1&&(ws(0,"select",44)(1,"option",45),GC(2,"Select an agent config\u2026"),pl(),rC(3,ge,2,2,"option",23,me),pl(),VI(),Jw(5,Ce,2,0,"span",12),ws(6,"span",13),GC(7,"Immutable after creation."),pl()),n&2){let e=gC(2);bg("formControl",e.agentConfigIdControl),UI(),XE(3),oC(e.availableAgentConfigs()),XE(2),eC(e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?5:-1);}}function xe(n,t){n&1&&(ws(0,"span",12),GC(1,"Opening message is required."),pl());}function ye(n,t){if(n&1&&(ws(0,"option",23),GC(1),pl()),n&2){let e=t.$implicit;bg("value",e.value),XE(),Yg(e.label);}}function be(n,t){if(n&1){let e=lC();ws(0,"label",48)(1,"input",49),Rg("change",function(){let g=If(e).$implicit,v=gC(3);return wf(v.toggleDay(g.value))}),pl(),ws(2,"span",50),GC(3),pl()();}if(n&2){let e=t.$implicit,d=gC(3);XE(),bg("checked",d.isDaySelected(e.value)),XE(2),Yg(e.label);}}function Se(n,t){if(n&1&&(ws(0,"div",8)(1,"span",46),GC(2,"Days of week"),pl(),ws(3,"div",47),rC(4,be,4,2,"label",48,A),pl(),ws(6,"span",13),GC(7,"Leave empty to run every day of the week."),pl()()),n&2){let e=gC(2);XE(4),oC(e.dayOptions);}}function Ee(n,t){n&1&&(ws(0,"span",12),GC(1,"Valid time is required (HH:mm)."),pl());}function Pe(n,t){n&1&&(ws(0,"span",12),GC(1,"Start date is required."),pl());}function Me(n,t){if(n&1&&(ws(0,"option",23),GC(1),pl()),n&2){let e=t.$implicit;bg("value",e.value),XE(),Yg(e.label);}}function Oe(n,t){n&1&&(ws(0,"span",12),GC(1,"End date is required."),pl());}function De(n,t){if(n&1&&(ws(0,"div",8)(1,"label",51),GC(2," End date "),ws(3,"span",10),GC(4,"*"),pl()(),Sg(5,"input",52),VI(),Jw(6,Oe,2,0,"span",12),pl()),n&2){let e=gC(2);XE(5),Ug("scheduled-prompt-form__input--invalid",e.form.hasError("endDateRequired")&&e.endDateControl.touched),bg("formControl",e.endDateControl),UI(),XE(),eC(e.form.hasError("endDateRequired")&&e.endDateControl.touched?6:-1);}}function Te(n,t){n&1&&(ws(0,"span",12),GC(1,"Must be at least 1."),pl());}function we(n,t){if(n&1&&(ws(0,"div",8)(1,"label",53),GC(2," Number of occurrences "),ws(3,"span",10),GC(4,"*"),pl()(),Sg(5,"input",54),VI(),Jw(6,Te,2,0,"span",12),pl()),n&2){let e=gC(2);XE(5),Ug("scheduled-prompt-form__input--invalid",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched),bg("formControl",e.occurrenceCountControl),UI(),XE(),eC(e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?6:-1);}}function ke(n,t){n&1&&(ws(0,"span",12),GC(1,"Invalid JSON."),pl());}function Ne(n,t){if(n&1&&(ws(0,"p",38),GC(1),pl()),n&2){let e=gC(2);XE(),Yg(e.errorMessage());}}function Fe(n,t){if(n&1){let e=lC();ws(0,"form",7),Rg("ngSubmit",function(){If(e);let g=gC();return wf(g.submit())}),ws(1,"div",8)(2,"label",9),GC(3," Name "),ws(4,"span",10),GC(5,"*"),pl()(),Sg(6,"input",11),VI(),Jw(7,ue,2,0,"span",12),ws(8,"span",13),GC(9,'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.'),pl()(),ws(10,"div",8)(11,"label",14),GC(12,"Description"),pl(),Sg(13,"input",15),VI(),pl(),ws(14,"div",8)(15,"label",16),GC(16," Agent Config "),ws(17,"span",10),GC(18,"*"),pl()(),Jw(19,fe,4,1)(20,he,3,1,"p",13)(21,ve,8,2),pl(),ws(22,"div",8)(23,"label",17),GC(24," Opening message "),ws(25,"span",10),GC(26,"*"),pl()(),Sg(27,"textarea",18),VI(),Jw(28,xe,2,0,"span",12),ws(29,"span",13),GC(30," The message sent to the agent when the scheduled prompt fires. "),pl()(),ws(31,"fieldset",19)(32,"legend",20),GC(33,"Recurrence"),pl(),ws(34,"div",8)(35,"label",21),GC(36," Unit "),ws(37,"span",10),GC(38,"*"),pl()(),ws(39,"select",22),rC(40,ye,2,2,"option",23,A),pl(),VI(),pl(),Jw(42,Se,8,0,"div",8),ws(43,"div",8)(44,"label",24),GC(45," Time (UTC) "),ws(46,"span",10),GC(47,"*"),pl()(),ws(48,"div",25),Sg(49,"input",26),VI(),ws(50,"span",27),GC(51,"UTC"),pl()(),Jw(52,Ee,2,0,"span",12),pl()(),ws(53,"fieldset",19)(54,"legend",20),GC(55,"Planning"),pl(),ws(56,"div",8)(57,"label",28),GC(58," Start date "),ws(59,"span",10),GC(60,"*"),pl()(),Sg(61,"input",29),VI(),Jw(62,Pe,2,0,"span",12),pl(),ws(63,"div",8)(64,"label",30),GC(65," Ends "),ws(66,"span",10),GC(67,"*"),pl()(),ws(68,"select",31),rC(69,Me,2,2,"option",23,A),pl(),VI(),pl(),Jw(71,De,7,4,"div",8),Jw(72,we,7,4,"div",8),pl(),ws(73,"div",8)(74,"label",32),Sg(75,"input",33),VI(),ws(76,"span",34),GC(77,"Enabled"),pl()(),ws(78,"p",35),GC(79," When disabled, the scheduled prompt is saved but will not run on schedule. "),pl()(),ws(80,"div",8)(81,"label",36),GC(82,"External Metadata"),pl(),Sg(83,"textarea",37),VI(),Jw(84,ke,2,0,"span",12),ws(85,"span",13),GC(86,"Optional. Opaque JSON object stored as-is. Leave empty to clear."),pl()(),Jw(87,Ne,2,1,"p",38),ws(88,"div",39)(89,"button",40),GC(90),pl(),ws(91,"button",41),Rg("click",function(){If(e);let g=gC();return wf(g.cancel())}),GC(92,"Cancel"),pl()()();}if(n&2){let e=gC();bg("formGroup",e.form),XE(6),Ug("scheduled-prompt-form__input--invalid",e.nameControl.invalid&&e.nameControl.touched),bg("formControl",e.nameControl),UI(),XE(),eC(e.nameControl.invalid&&e.nameControl.touched?7:-1),XE(6),bg("formControl",e.descriptionControl),UI(),XE(6),eC(e.isEditMode()?19:e.availableAgentConfigs().length===0?20:21),XE(8),Ug("scheduled-prompt-form__textarea--invalid",e.promptContentControl.invalid&&e.promptContentControl.touched),bg("formControl",e.promptContentControl),UI(),XE(),eC(e.promptContentControl.invalid&&e.promptContentControl.touched?28:-1),XE(11),bg("formControl",e.unitControl),UI(),XE(),oC(e.schedulerUnits),XE(2),eC(e.showDayFilter()?42:-1),XE(7),bg("formControl",e.timeUtcControl),UI(),XE(3),eC(e.timeUtcControl.invalid&&e.timeUtcControl.touched?52:-1),XE(9),Ug("scheduled-prompt-form__input--invalid",e.startDateControl.invalid&&e.startDateControl.touched),bg("formControl",e.startDateControl),UI(),XE(),eC(e.startDateControl.invalid&&e.startDateControl.touched?62:-1),XE(6),bg("formControl",e.endTypeControl),UI(),XE(),oC(e.endTypes),XE(2),eC(e.showEndDate()?71:-1),XE(),eC(e.showOccurrenceCount()?72:-1),XE(3),bg("formControl",e.enabledControl),UI(),XE(8),bg("formControl",e.externalMetadataJsonControl),UI(),XE(),eC(e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?84:-1),XE(3),eC(e.errorMessage()?87:-1),XE(2),bg("disabled",e.form.invalid||e.isSubmitting()),XE(),vl(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var se=class n{route=g(W);router=g(F);destroyRef=g(Ce$1);state=g(c);agentConfigController=g($);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(Re$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(Ie$1.NEVER,{nonNullable:true,validators:[_e$1.required]}),endDate:new _t(null),occurrenceCount:new _t(null),enabled:new _t(true,{nonNullable:true}),externalMetadataJson:new _t("",{nonNullable:true,validators:[Ae]})},{validators:[Ie,Ve]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}isEditMode=Gi(false);isSubmitting=Gi(false);isLoading=Gi(false);errorMessage=Gi(null);SchedulerUnit=Re$1;SchedulerEndType=Ie$1;schedulerUnits=[{value:Re$1.WEEK,label:"Week(s)"},{value:Re$1.MONTH,label:"Month(s)"}];endTypes=[{value:Ie$1.NEVER,label:"Never"},{value:Ie$1.ON_DATE,label:"On date"},{value:Ie$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(Oe$1).map(([t,e])=>({value:t,label:e}));unitSignal=F$1(this.unitControl.valueChanges.pipe(wd(this.unitControl.value)));endTypeSignal=F$1(this.endTypeControl.valueChanges.pipe(wd(this.endTypeControl.value)));showDayFilter=mT(()=>this.unitSignal()===Re$1.WEEK);showEndDate=mT(()=>this.endTypeSignal()===Ie$1.ON_DATE);showOccurrenceCount=mT(()=>this.endTypeSignal()===Ie$1.OCCURRENCES);agentConfigs=Gi([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Re());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(true),this.loadPromptAndResources(t)):this.loadResources();}loadPromptAndResources(t){this.isLoading.set(true),By({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(U(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:d})=>{this.existingPrompt=e,this.agentConfigs.set(d),this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadResources(){this.agentConfigs$().pipe(U(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(ya(()=>br([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,d=e.includes(t)?e.filter(g=>g!==t):[...e,t];this.daysControl.setValue(d);}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,d=x(w({},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===Ie$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===Ie$1.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value,removed:this.existingPrompt?.removed??false,externalMetadata:(()=>{let v=this.externalMetadataJsonControl.value.trim();return v?JSON.parse(v):null})()});(t?this.state.update(this.existingPrompt.id,d):this.state.create(d)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:v=>{this.isSubmitting.set(false),v.status===409?this.errorMessage.set(`A scheduled prompt named "${d.name}" already exists in this scope.`):v.status===400?this.errorMessage.set(v.error?.message??"Invalid scheduled prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","scheduled-prompts"]):this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=xw({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:10,vars:3,consts:[[1,"scheduled-prompt-form"],[1,"scheduled-prompt-form__header"],["type","button","title","Back to scheduled prompts",1,"scheduled-prompt-form__back",3,"click"],[1,"scheduled-prompt-form__back-icon"],[1,"scheduled-prompt-form__title"],[1,"scheduled-prompt-form__loading"],[1,"scheduled-prompt-form__form",3,"formGroup"],[1,"scheduled-prompt-form__form",3,"ngSubmit","formGroup"],[1,"scheduled-prompt-form__field"],["for","sp-name",1,"scheduled-prompt-form__label"],["aria-hidden","true"],["id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],[1,"scheduled-prompt-form__field-error"],[1,"scheduled-prompt-form__field-hint"],["for","sp-description",1,"scheduled-prompt-form__label"],["id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-agent-config",1,"scheduled-prompt-form__label"],["for","sp-prompt-content",1,"scheduled-prompt-form__label"],["id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",1,"scheduled-prompt-form__textarea",3,"formControl"],[1,"scheduled-prompt-form__fieldset"],[1,"scheduled-prompt-form__legend"],["for","sp-unit",1,"scheduled-prompt-form__label"],["id","sp-unit",1,"scheduled-prompt-form__select",3,"formControl"],[3,"value"],["for","sp-time",1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__time-wrapper"],["id","sp-time","type","time",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--time",3,"formControl"],[1,"scheduled-prompt-form__utc-badge"],["for","sp-start-date",1,"scheduled-prompt-form__label"],["id","sp-start-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-end-type",1,"scheduled-prompt-form__label"],["id","sp-end-type",1,"scheduled-prompt-form__select",3,"formControl"],[1,"scheduled-prompt-form__toggle-label"],["type","checkbox",1,"scheduled-prompt-form__toggle-checkbox",3,"formControl"],[1,"scheduled-prompt-form__toggle-text"],[1,"scheduled-prompt-form__toggle-hint"],["for","sp-external-metadata",1,"scheduled-prompt-form__label"],["id","sp-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",1,"scheduled-prompt-form__textarea","scheduled-prompt-form__textarea--code",3,"formControl"],[1,"scheduled-prompt-form__error"],[1,"scheduled-prompt-form__actions"],["type","submit",1,"scheduled-prompt-form__btn","scheduled-prompt-form__btn--primary",3,"disabled"],["type","button",1,"scheduled-prompt-form__btn",3,"click"],[1,"scheduled-prompt-form__readonly-value"],[3,"href"],["id","sp-agent-config",1,"scheduled-prompt-form__select",3,"formControl"],["value","","disabled",""],[1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__day-grid"],[1,"scheduled-prompt-form__day-label"],["type","checkbox",1,"scheduled-prompt-form__day-checkbox",3,"change","checked"],[1,"scheduled-prompt-form__day-text"],["for","sp-end-date",1,"scheduled-prompt-form__label"],["id","sp-end-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-occurrence-count",1,"scheduled-prompt-form__label"],["id","sp-occurrence-count","type","number","min","1",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--number",3,"formControl"]],template:function(e,d){e&1&&(ws(0,"div",0)(1,"header",1)(2,"button",2),Rg("click",function(){return d.cancel()}),ws(3,"span",3),GC(4,"\u2190"),pl(),GC(5),pl(),ws(6,"h1",4),GC(7),pl()(),Jw(8,pe,2,0,"p",5)(9,Fe,93,28,"form",6),pl()),e&2&&(XE(5),vl(" ",d.isPlatformMode?"Platform Scheduled Prompts":"Scheduled Prompts"," "),XE(2),vl(" ",d.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"," "),XE(),eC(d.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,fn,wt,At,Zn,Xn,$t,Cn,En],styles:[".scheduled-prompt-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.scheduled-prompt-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.scheduled-prompt-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.scheduled-prompt-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.scheduled-prompt-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.scheduled-prompt-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.scheduled-prompt-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.scheduled-prompt-form__row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.scheduled-prompt-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__input[_ngcontent-%COMP%], .scheduled-prompt-form__select[_ngcontent-%COMP%], .scheduled-prompt-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.scheduled-prompt-form__input[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__select[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.scheduled-prompt-form__input[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__select[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__select[_ngcontent-%COMP%]{cursor:pointer;appearance:auto}.scheduled-prompt-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:100px;line-height:1.5}.scheduled-prompt-form__input--time[_ngcontent-%COMP%]{flex:1;min-width:0}.scheduled-prompt-form__input--number[_ngcontent-%COMP%]{max-width:120px}.scheduled-prompt-form__time-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.scheduled-prompt-form__utc-badge[_ngcontent-%COMP%]{flex-shrink:0;font-size:.75rem;font-weight:600;font-family:monospace;color:var(--color-text-secondary, #6e6e73);background:var(--color-surface, rgba(0, 0, 0, .05));padding:.25rem .5rem;border-radius:4px;text-transform:uppercase;letter-spacing:.06em}.scheduled-prompt-form__fieldset[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:8px;padding:1rem 1.25rem 1.25rem;margin:0;display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__legend[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--color-text-secondary, #6e6e73);padding:0 .375rem}.scheduled-prompt-form__day-grid[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.5rem}.scheduled-prompt-form__day-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__day-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__day-text[_ngcontent-%COMP%]{font-size:.875rem;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__hint[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30);margin:0}.scheduled-prompt-form__field-error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30)}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__readonly-value[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;color:var(--color-text, #1d1d1f);padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--color-surface, rgba(0, 0, 0, .03))}.scheduled-prompt-form__input--invalid[_ngcontent-%COMP%], .scheduled-prompt-form__textarea--invalid[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30)}.scheduled-prompt-form__toggle-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__toggle-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__toggle-text[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__toggle-hint[_ngcontent-%COMP%]{margin:.25rem 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.scheduled-prompt-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"]})};function Ie(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===Ie$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ve(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===Ie$1.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function Ae(n){let t=n.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}function Re(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),d=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${d}`}export{se as ScheduledPromptFormComponent};
@@ -1 +1 @@
1
- import {N}from'./chunk-9t0dGUuC.js';import {g,ao as W,C as Ce,G as Gi,b as U,e as xw,k as ws,n as GC,o as pl,J as Jw,X as XE,v as eC,ac as gC,a8 as Yg}from'./main-EVOOW2CG.js';import'./chunk-pkNoeD9f.js';import {Y as Yn}from'./chunk-C8UVOyhT.js';import'./chunk-DJTNjd3B.js';import'./chunk-FV8LaU7e.js';import'./chunk-Cfby0A0V.js';import'./chunk-DAtwHi5G.js';function E(a,e){a&1&&(ws(0,"p",2),GC(1,"Loading integration\u2026"),pl());}function S(a,e){a&1&&(ws(0,"p",3),GC(1,"Failed to load this integration configuration."),pl());}function I(a,e){a&1&&(ws(0,"ds-tag",8),GC(1,"YAML"),pl(),ws(2,"ds-tag",9),GC(3,"Read-only"),pl());}function O(a,e){if(a&1&&(ws(0,"section",4)(1,"div",5)(2,"h2"),GC(3,"General"),pl(),Jw(4,I,4,0),pl(),ws(5,"dl")(6,"dt"),GC(7,"Name"),pl(),ws(8,"dd"),GC(9),pl(),ws(10,"dt"),GC(11,"Type"),pl(),ws(12,"dd",6),GC(13),pl(),ws(14,"dt"),GC(15,"Description"),pl(),ws(16,"dd"),GC(17),pl(),ws(18,"dt"),GC(19,"Scope"),pl(),ws(20,"dd"),GC(21),pl(),ws(22,"dt"),GC(23,"Source"),pl(),ws(24,"dd"),GC(25),pl(),ws(26,"dt"),GC(27,"Auto grant"),pl(),ws(28,"dd"),GC(29),pl(),ws(30,"dt"),GC(31,"Auth setting"),pl(),ws(32,"dd"),GC(33),pl()()(),ws(34,"section",4)(35,"h2"),GC(36,"Parameters"),pl(),ws(37,"p",7),GC(38,"Sensitive values are always redacted."),pl(),ws(39,"pre"),GC(40),pl()()),a&2){let o=e,r=gC();XE(4),eC(r.source()==="FILESYSTEM"?4:-1),XE(5),Yg(o.name),XE(4),Yg(o.integrationType),XE(4),Yg(o.description||"\u2014"),XE(4),Yg(r.scopeOf(o)),XE(4),Yg(r.source()),XE(4),Yg(o.autoGrant?"Enabled":"Disabled"),XE(4),Yg(o.authSettingName||"None"),XE(7),Yg(r.parameters());}}var y="\u2022\u2022\u2022\u2022\u2022\u2022",b=/(?:api[-_]?key|token|secret|password|passphrase|credential|private[-_]?key|client[-_]?secret|authorization|cookie)/i,h=class a{route=g(W);destroyRef=g(Ce);state=g(N);integrationId=this.route.snapshot.params.integrationId;isLoading=Gi(true);hasError=Gi(false);config=Gi(null);source=Gi("NEO4J");parameters=Gi("{}");ngOnInit(){this.state.getById(this.integrationId).pipe(U(this.destroyRef)).subscribe({next:e=>{this.config.set(e),this.source.set(this.sourceOf(e)),this.parameters.set(JSON.stringify(this.redact(e.parameters),null,2)),this.isLoading.set(false);},error:()=>{this.hasError.set(true),this.isLoading.set(false);}});}scopeOf(e){let o=e.userId?e.namespaceId?"userOnNs":"userGlobal":e.namespaceId?"namespace":"platform";return {platform:"Platform",namespace:"Namespace",userOnNs:"Personal on namespace",userGlobal:"Personal global"}[o]}sourceOf(e){return e.source??"NEO4J"}redact(e,o=""){return b.test(o)?y:e===null||typeof e=="boolean"||typeof e=="number"?e:typeof e=="string"?this.containsCredential(e)?y:e:Array.isArray(e)?e.map(r=>this.redact(r,o)):typeof e=="object"?Object.fromEntries(Object.entries(e).map(([r,g])=>[r,this.redact(g,r)])):String(e??"")}containsCredential(e){return /^(?:bearer\s+|basic\s+|sk[-_]|gh[opusr]_|xox[baprs]-|-----begin (?:rsa |ec |openssh )?private key-----)/i.test(e.trim())}static \u0275fac=function(o){return new(o||a)};static \u0275cmp=xw({type:a,selectors:[["agentos-integration-config-view"]],decls:7,vars:1,consts:[[1,"integration-view"],[1,"integration-view__header"],["role","status",1,"integration-view__status"],[1,"integration-view__error"],[1,"integration-view__section"],[1,"integration-view__section-title"],[1,"integration-view__mono"],[1,"integration-view__hint"],["variant","neutral"],["variant","outline"]],template:function(o,r){if(o&1&&(ws(0,"div",0)(1,"header",1)(2,"h1"),GC(3,"Integration configuration"),pl()(),Jw(4,E,2,0,"p",2)(5,S,2,0,"p",3)(6,O,41,9),pl()),o&2){let g;XE(4),eC(r.isLoading()?4:r.hasError()?5:(g=r.config())?6:-1,g);}},dependencies:[Yn],styles:[".integration-view[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:24px;max-width:760px;margin:0 auto;padding:24px 8px}.integration-view__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:8px}.integration-view__header[_ngcontent-%COMP%] h1[_ngcontent-%COMP%]{margin:0;color:var(--color-text);font-family:var(--font-heading);font-size:24px}.integration-view__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px;padding:20px;border:1px solid var(--color-divider)}.integration-view__section-title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.integration-view__section[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{margin:0;color:var(--color-text);font-family:var(--font-heading);font-size:16px}.integration-view[_ngcontent-%COMP%] dl[_ngcontent-%COMP%]{display:grid;grid-template-columns:max-content minmax(0,1fr);gap:8px 20px;margin:0}.integration-view[_ngcontent-%COMP%] dt[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:13px;font-weight:600}.integration-view[_ngcontent-%COMP%] dd[_ngcontent-%COMP%]{margin:0;color:var(--color-text);overflow-wrap:anywhere}.integration-view__mono[_ngcontent-%COMP%], .integration-view[_ngcontent-%COMP%] pre[_ngcontent-%COMP%]{font-family:monospace}.integration-view__hint[_ngcontent-%COMP%], .integration-view__status[_ngcontent-%COMP%]{margin:0;color:var(--color-text-secondary)}.integration-view__error[_ngcontent-%COMP%]{margin:0;color:var(--color-error)}.integration-view[_ngcontent-%COMP%] pre[_ngcontent-%COMP%]{max-height:440px;margin:0;padding:14px;overflow:auto;background:var(--color-bg-hover);color:var(--color-text);font-size:13px;white-space:pre-wrap;overflow-wrap:anywhere}@media(max-width:600px){.integration-view[_ngcontent-%COMP%] dl[_ngcontent-%COMP%]{grid-template-columns:1fr;gap:4px}.integration-view[_ngcontent-%COMP%] dd[_ngcontent-%COMP%]{margin-bottom:8px}}"]})};export{h as IntegrationConfigViewComponent};
1
+ import {N}from'./chunk-BHaCDZtZ.js';import {g,ao as W,C as Ce,G as Gi,b as U,e as xw,k as ws,n as GC,o as pl,J as Jw,X as XE,v as eC,ac as gC,a8 as Yg}from'./main-E674WB3K.js';import'./chunk-fBYTYGxD.js';import {Y as Yn}from'./chunk-D-C39lLD.js';import'./chunk-zIMeg4Tv.js';import'./chunk-B_SBnFI8.js';import'./chunk-znO_jWPo.js';import'./chunk-DvgF2GEo.js';function E(a,e){a&1&&(ws(0,"p",2),GC(1,"Loading integration\u2026"),pl());}function S(a,e){a&1&&(ws(0,"p",3),GC(1,"Failed to load this integration configuration."),pl());}function I(a,e){a&1&&(ws(0,"ds-tag",8),GC(1,"YAML"),pl(),ws(2,"ds-tag",9),GC(3,"Read-only"),pl());}function O(a,e){if(a&1&&(ws(0,"section",4)(1,"div",5)(2,"h2"),GC(3,"General"),pl(),Jw(4,I,4,0),pl(),ws(5,"dl")(6,"dt"),GC(7,"Name"),pl(),ws(8,"dd"),GC(9),pl(),ws(10,"dt"),GC(11,"Type"),pl(),ws(12,"dd",6),GC(13),pl(),ws(14,"dt"),GC(15,"Description"),pl(),ws(16,"dd"),GC(17),pl(),ws(18,"dt"),GC(19,"Scope"),pl(),ws(20,"dd"),GC(21),pl(),ws(22,"dt"),GC(23,"Source"),pl(),ws(24,"dd"),GC(25),pl(),ws(26,"dt"),GC(27,"Auto grant"),pl(),ws(28,"dd"),GC(29),pl(),ws(30,"dt"),GC(31,"Auth setting"),pl(),ws(32,"dd"),GC(33),pl()()(),ws(34,"section",4)(35,"h2"),GC(36,"Parameters"),pl(),ws(37,"p",7),GC(38,"Sensitive values are always redacted."),pl(),ws(39,"pre"),GC(40),pl()()),a&2){let o=e,r=gC();XE(4),eC(r.source()==="FILESYSTEM"?4:-1),XE(5),Yg(o.name),XE(4),Yg(o.integrationType),XE(4),Yg(o.description||"\u2014"),XE(4),Yg(r.scopeOf(o)),XE(4),Yg(r.source()),XE(4),Yg(o.autoGrant?"Enabled":"Disabled"),XE(4),Yg(o.authSettingName||"None"),XE(7),Yg(r.parameters());}}var y="\u2022\u2022\u2022\u2022\u2022\u2022",b=/(?:api[-_]?key|token|secret|password|passphrase|credential|private[-_]?key|client[-_]?secret|authorization|cookie)/i,h=class a{route=g(W);destroyRef=g(Ce);state=g(N);integrationId=this.route.snapshot.params.integrationId;isLoading=Gi(true);hasError=Gi(false);config=Gi(null);source=Gi("NEO4J");parameters=Gi("{}");ngOnInit(){this.state.getById(this.integrationId).pipe(U(this.destroyRef)).subscribe({next:e=>{this.config.set(e),this.source.set(this.sourceOf(e)),this.parameters.set(JSON.stringify(this.redact(e.parameters),null,2)),this.isLoading.set(false);},error:()=>{this.hasError.set(true),this.isLoading.set(false);}});}scopeOf(e){let o=e.userId?e.namespaceId?"userOnNs":"userGlobal":e.namespaceId?"namespace":"platform";return {platform:"Platform",namespace:"Namespace",userOnNs:"Personal on namespace",userGlobal:"Personal global"}[o]}sourceOf(e){return e.source??"NEO4J"}redact(e,o=""){return b.test(o)?y:e===null||typeof e=="boolean"||typeof e=="number"?e:typeof e=="string"?this.containsCredential(e)?y:e:Array.isArray(e)?e.map(r=>this.redact(r,o)):typeof e=="object"?Object.fromEntries(Object.entries(e).map(([r,g])=>[r,this.redact(g,r)])):String(e??"")}containsCredential(e){return /^(?:bearer\s+|basic\s+|sk[-_]|gh[opusr]_|xox[baprs]-|-----begin (?:rsa |ec |openssh )?private key-----)/i.test(e.trim())}static \u0275fac=function(o){return new(o||a)};static \u0275cmp=xw({type:a,selectors:[["agentos-integration-config-view"]],decls:7,vars:1,consts:[[1,"integration-view"],[1,"integration-view__header"],["role","status",1,"integration-view__status"],[1,"integration-view__error"],[1,"integration-view__section"],[1,"integration-view__section-title"],[1,"integration-view__mono"],[1,"integration-view__hint"],["variant","neutral"],["variant","outline"]],template:function(o,r){if(o&1&&(ws(0,"div",0)(1,"header",1)(2,"h1"),GC(3,"Integration configuration"),pl()(),Jw(4,E,2,0,"p",2)(5,S,2,0,"p",3)(6,O,41,9),pl()),o&2){let g;XE(4),eC(r.isLoading()?4:r.hasError()?5:(g=r.config())?6:-1,g);}},dependencies:[Yn],styles:[".integration-view[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:24px;max-width:760px;margin:0 auto;padding:24px 8px}.integration-view__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:8px}.integration-view__header[_ngcontent-%COMP%] h1[_ngcontent-%COMP%]{margin:0;color:var(--color-text);font-family:var(--font-heading);font-size:24px}.integration-view__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px;padding:20px;border:1px solid var(--color-divider)}.integration-view__section-title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.integration-view__section[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{margin:0;color:var(--color-text);font-family:var(--font-heading);font-size:16px}.integration-view[_ngcontent-%COMP%] dl[_ngcontent-%COMP%]{display:grid;grid-template-columns:max-content minmax(0,1fr);gap:8px 20px;margin:0}.integration-view[_ngcontent-%COMP%] dt[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:13px;font-weight:600}.integration-view[_ngcontent-%COMP%] dd[_ngcontent-%COMP%]{margin:0;color:var(--color-text);overflow-wrap:anywhere}.integration-view__mono[_ngcontent-%COMP%], .integration-view[_ngcontent-%COMP%] pre[_ngcontent-%COMP%]{font-family:monospace}.integration-view__hint[_ngcontent-%COMP%], .integration-view__status[_ngcontent-%COMP%]{margin:0;color:var(--color-text-secondary)}.integration-view__error[_ngcontent-%COMP%]{margin:0;color:var(--color-error)}.integration-view[_ngcontent-%COMP%] pre[_ngcontent-%COMP%]{max-height:440px;margin:0;padding:14px;overflow:auto;background:var(--color-bg-hover);color:var(--color-text);font-size:13px;white-space:pre-wrap;overflow-wrap:anywhere}@media(max-width:600px){.integration-view[_ngcontent-%COMP%] dl[_ngcontent-%COMP%]{grid-template-columns:1fr;gap:4px}.integration-view[_ngcontent-%COMP%] dd[_ngcontent-%COMP%]{margin-bottom:8px}}"]})};export{h as IntegrationConfigViewComponent};
@@ -1,2 +1,2 @@
1
- import {O}from'./chunk-MZ4wRIEo.js';import {R}from'./chunk-BmZ9yw5t.js';import {N}from'./chunk-9t0dGUuC.js';import {g,F,bm as Mm,C as Ce$1,G as Gi,m as mT,a as F$1,aD as Ly,r as re,b as U,e as xw,k as ws,q as Rg,o as pl,n as GC,J as Jw,X as XE,v as eC,s as rC,ac as gC,y as oC,a9 as lC,z as Ug,T as Tg,a8 as Yg,a5 as vl,S as Sg,a3 as VI,u as bg,a6 as UI,aa as If,ab as wf,cH as Kw}from'./main-EVOOW2CG.js';import {l,I,f}from'./chunk-pkNoeD9f.js';import {S as Se$1}from'./chunk-C8UVOyhT.js';import'./chunk-DJTNjd3B.js';import {o as z,k as _t,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,A as At,Z as Zn,l as Xn,E as En,p as An}from'./chunk-FV8LaU7e.js';import'./chunk-Cfby0A0V.js';import'./chunk-DAtwHi5G.js';var D=(r,i)=>i.value;function se(r,i){r&1&&(ws(0,"p",4),GC(1,"Loading\u2026"),pl());}function de(r,i){if(r&1){let e=lC();ws(0,"button",18),Rg("click",function(){let d=If(e).$implicit,_=gC(2);return wf(_.setThemeVariant(d.value))}),ws(1,"span",19),GC(2),pl(),ws(3,"span",20),GC(4),pl()();}if(r&2){let e=i.$implicit,a=gC(2);Ug("user-profile__theme-variant--active",a.themeVariant()===e.value),Tg("aria-pressed",a.themeVariant()===e.value),XE(2),Yg(e.label),XE(2),Yg(e.description);}}function _e(r,i){if(r&1){let e=lC();ws(0,"button",21),Rg("click",function(){let d=If(e).$implicit,_=gC(2);return wf(_.setTheme(d.value))}),GC(1),pl();}if(r&2){let e=i.$implicit,a=gC(2);Ug("user-profile__segmented-option--active",a.themeMode()===e.value),Tg("aria-pressed",a.themeMode()===e.value),XE(),vl(" ",e.label," ");}}function ce(r,i){if(r&1){let e=lC();ws(0,"button",21),Rg("click",function(){let d=If(e).$implicit,_=gC(2);return wf(_.setEnterKeyBehavior(d.value))}),GC(1),pl();}if(r&2){let e=i.$implicit,a=gC(2);Ug("user-profile__segmented-option--active",a.enterKeyBehavior()===e.value),Tg("aria-pressed",a.enterKeyBehavior()===e.value),XE(),vl(" ",e.label," ");}}function pe(r,i){if(r&1&&(ws(0,"option",32),GC(1),pl()),r&2){let e=i.$implicit;bg("value",e.value),XE(),Yg(e.label);}}function me(r,i){if(r&1){let e=lC();ws(0,"form",22),Rg("ngSubmit",function(){If(e);let d=gC(2);return wf(d.save())}),ws(1,"div",5)(2,"h2",6),GC(3,"Identity"),pl(),ws(4,"div",7)(5,"span",8),GC(6,"Email"),pl(),ws(7,"span",23),GC(8),pl()(),ws(9,"div",7)(10,"span",8),GC(11,"External ID"),pl(),ws(12,"span",23),GC(13),pl()()(),ws(14,"div",5)(15,"h2",6),GC(16,"Profile"),pl(),ws(17,"div",7)(18,"label",24),GC(19,"First name"),pl(),Sg(20,"input",25),VI(),pl(),ws(21,"div",7)(22,"label",26),GC(23,"Last name"),pl(),Sg(24,"input",27),VI(),pl(),ws(25,"div",7)(26,"label",28),GC(27,"Bio"),pl(),Sg(28,"textarea",29),VI(),pl(),ws(29,"div",7)(30,"label",30),GC(31,"Language"),pl(),ws(32,"select",31),rC(33,pe,2,2,"option",32,D),pl(),VI(),pl()(),ws(35,"div",33)(36,"button",34),GC(37),pl(),ws(38,"button",35),Rg("click",function(){If(e);let d=gC(2);return wf(d.cancelEditing())}),GC(39,"Cancel"),pl()()();}if(r&2){let e=gC(),a=gC();bg("formGroup",a.form),XE(8),Yg(e.email),XE(5),Yg(e.externalId),XE(7),UI(),XE(4),UI(),XE(4),UI(),XE(4),UI(),XE(),oC(a.languageOptions),XE(3),bg("disabled",a.isSaving()),XE(),vl(" ",a.isSaving()?"Saving\u2026":"Save changes"," ");}}function ue(r,i){r&1&&(ws(0,"p",43),GC(1," No global configuration yet. Create one from the Integrations / AI Providers / Auth Settings pages of your namespaces. "),pl());}function fe(r,i){if(r&1){let e=lC();ws(0,"span",50),GC(1,"Delete?"),pl(),ws(2,"button",51),Rg("click",function(){If(e);let d=gC().$implicit,_=gC(6);return wf(_.confirmDelete(d))}),GC(3," Confirm "),pl(),ws(4,"button",52),Rg("click",function(){If(e);let d=gC(7);return wf(d.cancelDelete())}),GC(5," Cancel "),pl();}}function ge(r,i){if(r&1){let e=lC();ws(0,"button",52),Rg("click",function(){If(e);let d=gC().$implicit,_=gC(6);return wf(_.armDelete(d))}),GC(1," Delete "),pl();}}function Ce(r,i){if(r&1&&(ws(0,"li",46)(1,"span",47),GC(2),pl(),ws(3,"span",48),GC(4),pl(),Jw(5,fe,6,0)(6,ge,2,0,"button",49),pl()),r&2){let e=i.$implicit,a=gC(6);XE(2),Yg(e.name),XE(2),Yg(e.subtitle),XE(),eC(a.isPendingDelete(e)?5:6);}}function ve(r,i){if(r&1&&(ws(0,"h3",44),GC(1,"Integrations"),pl(),ws(2,"ul",45),rC(3,Ce,7,3,"li",46,Kw().trackEntry,true),pl()),r&2){let e=gC(5);XE(3),oC(e.recap().integrations);}}function xe(r,i){if(r&1){let e=lC();ws(0,"span",50),GC(1,"Delete?"),pl(),ws(2,"button",51),Rg("click",function(){If(e);let d=gC().$implicit,_=gC(6);return wf(_.confirmDelete(d))}),GC(3," Confirm "),pl(),ws(4,"button",52),Rg("click",function(){If(e);let d=gC(7);return wf(d.cancelDelete())}),GC(5," Cancel "),pl();}}function be(r,i){if(r&1){let e=lC();ws(0,"button",52),Rg("click",function(){If(e);let d=gC().$implicit,_=gC(6);return wf(_.armDelete(d))}),GC(1," Delete "),pl();}}function ye(r,i){if(r&1&&(ws(0,"li",46)(1,"span",47),GC(2),pl(),ws(3,"span",48),GC(4),pl(),Jw(5,xe,6,0)(6,be,2,0,"button",49),pl()),r&2){let e=i.$implicit,a=gC(6);XE(2),Yg(e.name),XE(2),Yg(e.subtitle),XE(),eC(a.isPendingDelete(e)?5:6);}}function he(r,i){if(r&1&&(ws(0,"h3",44),GC(1,"AI Providers"),pl(),ws(2,"ul",45),rC(3,ye,7,3,"li",46,Kw().trackEntry,true),pl()),r&2){let e=gC(5);XE(3),oC(e.recap().aiProviders);}}function Ee(r,i){if(r&1){let e=lC();ws(0,"span",50),GC(1,"Delete?"),pl(),ws(2,"button",51),Rg("click",function(){If(e);let d=gC().$implicit,_=gC(6);return wf(_.confirmDelete(d))}),GC(3," Confirm "),pl(),ws(4,"button",52),Rg("click",function(){If(e);let d=gC(7);return wf(d.cancelDelete())}),GC(5," Cancel "),pl();}}function Pe(r,i){if(r&1){let e=lC();ws(0,"button",52),Rg("click",function(){If(e);let d=gC().$implicit,_=gC(6);return wf(_.armDelete(d))}),GC(1," Delete "),pl();}}function Se(r,i){if(r&1&&(ws(0,"li",46)(1,"span",47),GC(2),pl(),ws(3,"span",48),GC(4),pl(),Jw(5,Ee,6,0)(6,Pe,2,0,"button",49),pl()),r&2){let e=i.$implicit,a=gC(6);XE(2),Yg(e.name),XE(2),Yg(e.subtitle),XE(),eC(a.isPendingDelete(e)?5:6);}}function we(r,i){if(r&1&&(ws(0,"h3",44),GC(1,"My global auth settings"),pl(),ws(2,"ul",45),rC(3,Se,7,3,"li",46,Kw().trackEntry,true),pl()),r&2){let e=gC(5);XE(3),oC(e.recap().authSettings);}}function ke(r,i){if(r&1&&(Jw(0,ve,5,0),Jw(1,he,5,0),Jw(2,we,5,0)),r&2){let e=gC(4);eC(e.recap().integrations.length>0?0:-1),XE(),eC(e.recap().aiProviders.length>0?1:-1),XE(),eC(e.recap().authSettings.length>0?2:-1);}}function Me(r,i){if(r&1&&Jw(0,ue,2,0,"p",43)(1,ke,3,3),r&2){let e=gC(3);eC(e.recap().total===0?0:1);}}function Oe(r,i){if(r&1){let e=lC();ws(0,"div",17)(1,"div",5)(2,"h2",6),GC(3,"Identity"),pl(),ws(4,"div",7)(5,"span",8),GC(6,"Email"),pl(),ws(7,"span",36),GC(8),pl()(),ws(9,"div",7)(10,"span",8),GC(11,"External ID"),pl(),ws(12,"span",36),GC(13),pl()()(),ws(14,"div",5)(15,"h2",6),GC(16,"Profile"),pl(),ws(17,"div",7)(18,"span",8),GC(19,"First name"),pl(),ws(20,"span",36),GC(21),pl()(),ws(22,"div",7)(23,"span",8),GC(24,"Last name"),pl(),ws(25,"span",36),GC(26),pl()(),ws(27,"div",37)(28,"span",8),GC(29,"Bio"),pl(),ws(30,"span",36),GC(31),pl()(),ws(32,"div",7)(33,"span",8),GC(34,"Language"),pl(),ws(35,"span",36),GC(36),pl()()(),ws(37,"div",33)(38,"button",38),Rg("click",function(){If(e);let d=gC(2);return wf(d.startEditing())}),GC(39," Edit profile "),pl()(),ws(40,"div",39)(41,"button",40),Rg("click",function(){If(e);let d=gC(2);return wf(d.toggleOverrides())}),ws(42,"span",41),GC(43,"\u25B6"),pl(),GC(44," My global user configurations "),ws(45,"span",42),GC(46),pl()(),Jw(47,Me,2,1),pl()();}if(r&2){let e=gC(),a=gC();XE(8),Yg(e.email),XE(5),Yg(e.externalId),XE(8),Yg(e.firstname||"\u2014"),XE(5),Yg(e.lastname||"\u2014"),XE(5),Yg(e.bio||"\u2014"),XE(5),Yg(e.preferredLanguage||"\u2014"),XE(5),Tg("aria-expanded",a.isOverridesExpanded()),XE(),Ug("user-profile__overrides-arrow--open",a.isOverridesExpanded()),XE(4),vl("(",a.recap().total,")"),XE(),eC(a.isOverridesExpanded()?47:-1);}}function Ue(r,i){if(r&1&&(ws(0,"div",5)(1,"h2",6),GC(2,"Appearance"),pl(),ws(3,"div",7)(4,"span",8),GC(5,"Skin"),pl(),ws(6,"div",9),rC(7,de,5,5,"button",10,D),pl()(),ws(9,"div",7)(10,"span",8),GC(11,"Mode"),pl(),ws(12,"div",11),rC(13,_e,2,4,"button",12,D),pl()()(),ws(15,"div",5)(16,"h2",6),GC(17,"Composer"),pl(),ws(18,"div",7)(19,"span",8),GC(20,"Enter key"),pl(),ws(21,"div",13)(22,"div",14),rC(23,ce,2,4,"button",12,D),pl(),ws(25,"p",15),GC(26,'In "New line" mode, press Ctrl or Cmd + Enter to send.'),pl()()()(),Jw(27,me,40,5,"form",16)(28,Oe,48,11,"div",17)),r&2){let e=gC();XE(7),oC(e.themeVariantOptions),XE(6),oC(e.themeOptions),XE(10),oC(e.enterKeyOptions),XE(4),eC(e.isEditing()?27:28);}}function Te(r,i){r&1&&(ws(0,"p",4),GC(1,"Unable to load profile."),pl());}var le=class r{userState=g(l);router=g(F);location=g(Mm);destroyRef=g(Ce$1);integrationState=g(N);providerState=g(O);authSettingState=g(R);themePort=g(I);preferencesPort=g(f);isEditing=Gi(false);isLoading=Gi(false);isSaving=Gi(false);isOverridesExpanded=Gi(false);currentUser=this.userState.currentUser;theme=this.themePort.theme;themeMode=mT(()=>this.themePort.theme().mode);themeOptions=[{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"system",label:"System"}];themeVariant=mT(()=>this.themePort.theme().variant);themeVariantOptions=[{value:"industry",label:"Industry",description:"Bleu acier, Barlow"},{value:"terminal",label:"Terminal",description:"Ambre CRT, JetBrains Mono"}];enterKeyBehavior=this.preferencesPort.enterKeyBehavior;enterKeyOptions=[{value:"send",label:"Send"},{value:"newline",label:"New line"}];languageOptions=[{value:"",label:"No preference (English fallback)"},{value:"fr",label:"French"},{value:"de",label:"German"},{value:"es",label:"Spanish"},{value:"pt",label:"Portuguese"},{value:"it",label:"Italian"},{value:"nl",label:"Dutch"},{value:"pl",label:"Polish"},{value:"ja",label:"Japanese"},{value:"zh",label:"Chinese"}];form=new z({firstname:new _t("",{nonNullable:true}),lastname:new _t("",{nonNullable:true}),bio:new _t("",{nonNullable:true}),preferredLanguage:new _t("",{nonNullable:true})});recap=F$1(Ly([this.integrationState.userGlobal$,this.providerState.userGlobal$,this.authSettingState.userGlobal$]).pipe(re(([i,e,a])=>{let d=i.map(g=>({category:"integration",id:g.id??"",name:g.name,subtitle:g.integrationType})),_=e.map(g=>({category:"aiProvider",id:g.id??"",name:g.name,subtitle:g.apiType})),I=a.map(g=>({category:"authSetting",id:g.id??"",name:g.name,subtitle:g.authType}));return {integrations:d,aiProviders:_,authSettings:I,total:d.length+_.length+I.length}})),{initialValue:{integrations:[],aiProviders:[],authSettings:[],total:0}});ngOnInit(){if(this.currentUser()){this.syncFormFromState();return}this.isLoading.set(true),this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:()=>{this.syncFormFromState(),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}startEditing(){this.syncFormFromState(),this.isEditing.set(true);}cancelEditing(){this.isEditing.set(false);}setTheme(i){this.themePort.setTheme({variant:this.themePort.theme().variant,mode:i});}setThemeVariant(i){this.themePort.setTheme({variant:i,mode:this.themePort.theme().mode});}setEnterKeyBehavior(i){this.preferencesPort.setEnterKeyBehavior(i);}save(){if(this.isSaving())return;this.isSaving.set(true);let i=this.form.controls.preferredLanguage.value.trim();this.userState.updateMe({firstname:this.form.controls.firstname.value.trim()||void 0,lastname:this.form.controls.lastname.value.trim()||void 0,bio:this.form.controls.bio.value.trim()||void 0,preferredLanguage:i||void 0}).pipe(U(this.destroyRef)).subscribe({next:()=>{this.isSaving.set(false),this.isEditing.set(false);},error:()=>this.isSaving.set(false)});}toggleOverrides(){this.isOverridesExpanded.update(i=>!i),this.pendingDeleteKey.set(null);}pendingDeleteKey=Gi(null);isPendingDelete(i){return this.pendingDeleteKey()===this.entryKey(i)}armDelete(i){i.id&&this.pendingDeleteKey.set(this.entryKey(i));}cancelDelete(){this.pendingDeleteKey.set(null);}confirmDelete(i){if(!i.id)return;this.pendingDeleteKey.set(null),(i.category==="integration"?this.integrationState.delete(i.id,"userGlobal"):i.category==="authSetting"?this.authSettingState.delete(i.id,"userGlobal"):this.providerState.delete(i.id,"userGlobal")).pipe(U(this.destroyRef)).subscribe({error:a=>{console.error(`[UserProfile] Delete failed for ${i.category}:${i.id}:`,a);}});}entryKey(i){return `${i.category}:${i.id}`}goBack(){window.history.length>1?this.location.back():this.router.navigate(["/agentos"]);}trackEntry(i,e){return this.entryKey(e)}syncFormFromState(){let i=this.currentUser();i&&this.form.setValue({firstname:i.firstname??"",lastname:i.lastname??"",bio:i.bio??"",preferredLanguage:i.preferredLanguage??""});}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=xw({type:r,selectors:[["agentos-user-profile"]],decls:8,vars:1,consts:[[1,"user-profile"],[1,"user-profile__header"],["icon","arrow_back","title","Back",3,"action"],[1,"user-profile__title"],[1,"user-profile__loading"],[1,"user-profile__section"],[1,"user-profile__section-title"],[1,"user-profile__field"],[1,"user-profile__label"],[1,"user-profile__theme-variants"],["type","button",1,"user-profile__theme-variant",3,"user-profile__theme-variant--active"],["role","group","aria-label","Color mode",1,"user-profile__segmented"],["type","button",1,"user-profile__segmented-option",3,"user-profile__segmented-option--active"],[1,"user-profile__field-control"],["role","group","aria-label","Enter key behavior",1,"user-profile__segmented"],[1,"user-profile__hint"],[1,"user-profile__form",3,"formGroup"],[1,"user-profile__view"],["type","button",1,"user-profile__theme-variant",3,"click"],[1,"user-profile__theme-variant-name"],[1,"user-profile__theme-variant-desc"],["type","button",1,"user-profile__segmented-option",3,"click"],[1,"user-profile__form",3,"ngSubmit","formGroup"],[1,"user-profile__value","user-profile__value--readonly"],["for","up-firstname",1,"user-profile__label"],["id","up-firstname","type","text","placeholder","Your first name","formControlName","firstname","autocomplete","given-name",1,"user-profile__input"],["for","up-lastname",1,"user-profile__label"],["id","up-lastname","type","text","placeholder","Your last name","formControlName","lastname","autocomplete","family-name",1,"user-profile__input"],["for","up-bio",1,"user-profile__label"],["id","up-bio","placeholder","A short description about yourself","formControlName","bio","rows","4",1,"user-profile__input","user-profile__input--textarea"],["for","up-preferredLanguage",1,"user-profile__label"],["id","up-preferredLanguage","formControlName","preferredLanguage",1,"user-profile__input","user-profile__select"],[3,"value"],[1,"user-profile__actions"],["type","submit",1,"user-profile__btn","user-profile__btn--primary",3,"disabled"],["type","button",1,"user-profile__btn",3,"click"],[1,"user-profile__value"],[1,"user-profile__field","user-profile__field--bio"],["type","button",1,"user-profile__btn","user-profile__btn--primary",3,"click"],[1,"user-profile__overrides"],["type","button",1,"user-profile__overrides-toggle",3,"click"],[1,"user-profile__overrides-arrow"],[1,"user-profile__overrides-count"],[1,"user-profile__overrides-empty"],[1,"user-profile__overrides-subtitle"],[1,"user-profile__overrides-list"],[1,"user-profile__overrides-row"],[1,"user-profile__overrides-name"],[1,"user-profile__overrides-subtitle-text"],["type","button",1,"user-profile__overrides-delete"],[1,"user-profile__overrides-confirm-label"],["type","button",1,"user-profile__overrides-delete","user-profile__overrides-delete--confirm",3,"click"],["type","button",1,"user-profile__overrides-delete",3,"click"]],template:function(e,a){if(e&1&&(ws(0,"div",0)(1,"header",1)(2,"ds-icon-button",2),Rg("action",function(){return a.goBack()}),pl(),ws(3,"h1",3),GC(4,"My profile"),pl()(),Jw(5,se,2,0,"p",4)(6,Ue,29,1)(7,Te,2,0,"p",4),pl()),e&2){let d;XE(5),eC(a.isLoading()?5:(d=a.currentUser())?6:7,d);}},dependencies:[ni,Jn,Qn,ei,Ye,At,Zn,Xn,En,An,Se$1],styles:[`.user-profile[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.user-profile__header[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;gap:.5rem}.user-profile__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)}.user-profile__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.user-profile__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.user-profile__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.user-profile__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.user-profile__view[_ngcontent-%COMP%], .user-profile__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem}.user-profile__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem}.user-profile__section-title[_ngcontent-%COMP%]{margin:0;font-family:var(--font-heading);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);border-bottom:1px solid var(--color-divider);padding-bottom:.5rem}.user-profile__field[_ngcontent-%COMP%]{display:grid;grid-template-columns:140px 1fr;align-items:baseline;gap:.75rem}.user-profile__field--bio[_ngcontent-%COMP%]{align-items:start}.user-profile__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text-secondary);white-space:nowrap}.user-profile__value[_ngcontent-%COMP%]{font-size:.9375rem;color:var(--color-text);word-break:break-word;white-space:pre-wrap}.user-profile__value--readonly[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.875rem}.user-profile__segmented[_ngcontent-%COMP%]{display:inline-flex;justify-self:start;border:1px solid var(--color-divider);overflow:hidden}.user-profile__segmented-option[_ngcontent-%COMP%]{padding:.4rem .85rem;background:transparent;border:none;border-right:1px solid var(--color-divider);color:var(--color-text-secondary);font-size:.875rem;cursor:pointer;transition:background .15s ease,color .15s ease}.user-profile__segmented-option[_ngcontent-%COMP%]:last-child{border-right:none}.user-profile__segmented-option[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.user-profile__segmented-option--active[_ngcontent-%COMP%]{background:var(--color-accent);color:#fff}.user-profile__segmented-option--active[_ngcontent-%COMP%]:hover{background:var(--color-accent-700)}.user-profile__field-control[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-start;gap:.4rem}.user-profile__hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary)}.user-profile__select[_ngcontent-%COMP%]{appearance:none;cursor:pointer;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right .75rem center;padding-right:2.25rem}.user-profile__input[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;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;border-radius:0;transition:border-color .15s ease;resize:none}.user-profile__input[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.user-profile__input[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.user-profile__input--textarea[_ngcontent-%COMP%]{line-height:1.5;resize:vertical}.user-profile__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.user-profile__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;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;border-radius:0;transition:background .15s ease,border-color .15s ease}.user-profile__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.user-profile__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.user-profile__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.user-profile__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}.user-profile__theme-variants[_ngcontent-%COMP%]{display:flex;gap:8px;justify-self:start}.user-profile__theme-variant[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-start;gap:3px;padding:10px 16px;border:1px solid var(--color-divider);background:transparent;cursor:pointer;min-width:120px;transition:background .12s,border-color .12s}.user-profile__theme-variant[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.user-profile__theme-variant--active[_ngcontent-%COMP%]{border-color:var(--color-accent);background:color-mix(in srgb,var(--color-accent) 8%,transparent)}.user-profile__theme-variant-name[_ngcontent-%COMP%]{font-family:var(--font-heading);font-size:13px;font-weight:600;color:var(--color-text)}.user-profile__theme-variant-desc[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-secondary);font-family:var(--font-body)}.user-profile__overrides[_ngcontent-%COMP%]{margin-top:1rem;padding-top:1rem;border-top:1px solid var(--color-divider)}.user-profile__overrides-toggle[_ngcontent-%COMP%]{background:transparent;border:none;padding:.25rem 0;font-size:.85rem;color:var(--color-text-secondary);cursor:pointer;display:flex;align-items:center;gap:.4rem}.user-profile__overrides-toggle[_ngcontent-%COMP%]:hover{color:var(--color-text)}.user-profile__overrides-arrow[_ngcontent-%COMP%]{display:inline-block;font-size:.65rem;transition:transform .15s ease}.user-profile__overrides-arrow--open[_ngcontent-%COMP%]{transform:rotate(90deg)}.user-profile__overrides-count[_ngcontent-%COMP%]{color:var(--color-text-tertiary)}.user-profile__overrides-empty[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary);font-style:italic;padding:.5rem 0 0;margin:0}.user-profile__overrides-subtitle[_ngcontent-%COMP%]{font-family:var(--font-heading);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);margin:.75rem 0 .25rem}.user-profile__overrides-list[_ngcontent-%COMP%]{list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:.25rem}.user-profile__overrides-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.4rem .5rem;font-size:.85rem;border-radius:0}.user-profile__overrides-row[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.user-profile__overrides-name[_ngcontent-%COMP%]{flex:1;color:var(--color-text);font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.user-profile__overrides-subtitle-text[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);font-family:var(--font-heading)}.user-profile__overrides-confirm-label[_ngcontent-%COMP%]{font-size:11px;font-family:var(--font-heading);font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--red-deep);white-space:nowrap}.user-profile__overrides-delete[_ngcontent-%COMP%]{background:transparent;border:1px solid transparent;font-size:11px;font-family:var(--font-heading);font-weight:600;color:var(--color-neutral-500);cursor:pointer;padding:3px 8px;border-radius:0;transition:color .12s,background .12s,border-color .12s}.user-profile__overrides-delete[_ngcontent-%COMP%]:hover{color:var(--red);background:color-mix(in srgb,var(--red) 10%,transparent);border-color:var(--red)}.user-profile__overrides-delete--confirm[_ngcontent-%COMP%]{border-color:var(--red);background:var(--red);color:#fff}.user-profile__overrides-delete--confirm[_ngcontent-%COMP%]:hover{background:var(--red-deep);border-color:var(--red-deep)}`]})};
1
+ import {O}from'./chunk-DregcDV6.js';import {R}from'./chunk-DFV_94IQ.js';import {N}from'./chunk-BHaCDZtZ.js';import {g,F,bm as Mm,C as Ce$1,G as Gi,m as mT,a as F$1,aD as Ly,r as re,b as U,e as xw,k as ws,q as Rg,o as pl,n as GC,J as Jw,X as XE,v as eC,s as rC,ac as gC,y as oC,a9 as lC,z as Ug,T as Tg,a8 as Yg,a5 as vl,S as Sg,a3 as VI,u as bg,a6 as UI,aa as If,ab as wf,cH as Kw}from'./main-E674WB3K.js';import {l,I,f}from'./chunk-fBYTYGxD.js';import {S as Se$1}from'./chunk-D-C39lLD.js';import'./chunk-zIMeg4Tv.js';import {o as z,k as _t,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,A as At,Z as Zn,l as Xn,E as En,p as An}from'./chunk-B_SBnFI8.js';import'./chunk-znO_jWPo.js';import'./chunk-DvgF2GEo.js';var D=(r,i)=>i.value;function se(r,i){r&1&&(ws(0,"p",4),GC(1,"Loading\u2026"),pl());}function de(r,i){if(r&1){let e=lC();ws(0,"button",18),Rg("click",function(){let d=If(e).$implicit,_=gC(2);return wf(_.setThemeVariant(d.value))}),ws(1,"span",19),GC(2),pl(),ws(3,"span",20),GC(4),pl()();}if(r&2){let e=i.$implicit,a=gC(2);Ug("user-profile__theme-variant--active",a.themeVariant()===e.value),Tg("aria-pressed",a.themeVariant()===e.value),XE(2),Yg(e.label),XE(2),Yg(e.description);}}function _e(r,i){if(r&1){let e=lC();ws(0,"button",21),Rg("click",function(){let d=If(e).$implicit,_=gC(2);return wf(_.setTheme(d.value))}),GC(1),pl();}if(r&2){let e=i.$implicit,a=gC(2);Ug("user-profile__segmented-option--active",a.themeMode()===e.value),Tg("aria-pressed",a.themeMode()===e.value),XE(),vl(" ",e.label," ");}}function ce(r,i){if(r&1){let e=lC();ws(0,"button",21),Rg("click",function(){let d=If(e).$implicit,_=gC(2);return wf(_.setEnterKeyBehavior(d.value))}),GC(1),pl();}if(r&2){let e=i.$implicit,a=gC(2);Ug("user-profile__segmented-option--active",a.enterKeyBehavior()===e.value),Tg("aria-pressed",a.enterKeyBehavior()===e.value),XE(),vl(" ",e.label," ");}}function pe(r,i){if(r&1&&(ws(0,"option",32),GC(1),pl()),r&2){let e=i.$implicit;bg("value",e.value),XE(),Yg(e.label);}}function me(r,i){if(r&1){let e=lC();ws(0,"form",22),Rg("ngSubmit",function(){If(e);let d=gC(2);return wf(d.save())}),ws(1,"div",5)(2,"h2",6),GC(3,"Identity"),pl(),ws(4,"div",7)(5,"span",8),GC(6,"Email"),pl(),ws(7,"span",23),GC(8),pl()(),ws(9,"div",7)(10,"span",8),GC(11,"External ID"),pl(),ws(12,"span",23),GC(13),pl()()(),ws(14,"div",5)(15,"h2",6),GC(16,"Profile"),pl(),ws(17,"div",7)(18,"label",24),GC(19,"First name"),pl(),Sg(20,"input",25),VI(),pl(),ws(21,"div",7)(22,"label",26),GC(23,"Last name"),pl(),Sg(24,"input",27),VI(),pl(),ws(25,"div",7)(26,"label",28),GC(27,"Bio"),pl(),Sg(28,"textarea",29),VI(),pl(),ws(29,"div",7)(30,"label",30),GC(31,"Language"),pl(),ws(32,"select",31),rC(33,pe,2,2,"option",32,D),pl(),VI(),pl()(),ws(35,"div",33)(36,"button",34),GC(37),pl(),ws(38,"button",35),Rg("click",function(){If(e);let d=gC(2);return wf(d.cancelEditing())}),GC(39,"Cancel"),pl()()();}if(r&2){let e=gC(),a=gC();bg("formGroup",a.form),XE(8),Yg(e.email),XE(5),Yg(e.externalId),XE(7),UI(),XE(4),UI(),XE(4),UI(),XE(4),UI(),XE(),oC(a.languageOptions),XE(3),bg("disabled",a.isSaving()),XE(),vl(" ",a.isSaving()?"Saving\u2026":"Save changes"," ");}}function ue(r,i){r&1&&(ws(0,"p",43),GC(1," No global configuration yet. Create one from the Integrations / AI Providers / Auth Settings pages of your namespaces. "),pl());}function fe(r,i){if(r&1){let e=lC();ws(0,"span",50),GC(1,"Delete?"),pl(),ws(2,"button",51),Rg("click",function(){If(e);let d=gC().$implicit,_=gC(6);return wf(_.confirmDelete(d))}),GC(3," Confirm "),pl(),ws(4,"button",52),Rg("click",function(){If(e);let d=gC(7);return wf(d.cancelDelete())}),GC(5," Cancel "),pl();}}function ge(r,i){if(r&1){let e=lC();ws(0,"button",52),Rg("click",function(){If(e);let d=gC().$implicit,_=gC(6);return wf(_.armDelete(d))}),GC(1," Delete "),pl();}}function Ce(r,i){if(r&1&&(ws(0,"li",46)(1,"span",47),GC(2),pl(),ws(3,"span",48),GC(4),pl(),Jw(5,fe,6,0)(6,ge,2,0,"button",49),pl()),r&2){let e=i.$implicit,a=gC(6);XE(2),Yg(e.name),XE(2),Yg(e.subtitle),XE(),eC(a.isPendingDelete(e)?5:6);}}function ve(r,i){if(r&1&&(ws(0,"h3",44),GC(1,"Integrations"),pl(),ws(2,"ul",45),rC(3,Ce,7,3,"li",46,Kw().trackEntry,true),pl()),r&2){let e=gC(5);XE(3),oC(e.recap().integrations);}}function xe(r,i){if(r&1){let e=lC();ws(0,"span",50),GC(1,"Delete?"),pl(),ws(2,"button",51),Rg("click",function(){If(e);let d=gC().$implicit,_=gC(6);return wf(_.confirmDelete(d))}),GC(3," Confirm "),pl(),ws(4,"button",52),Rg("click",function(){If(e);let d=gC(7);return wf(d.cancelDelete())}),GC(5," Cancel "),pl();}}function be(r,i){if(r&1){let e=lC();ws(0,"button",52),Rg("click",function(){If(e);let d=gC().$implicit,_=gC(6);return wf(_.armDelete(d))}),GC(1," Delete "),pl();}}function ye(r,i){if(r&1&&(ws(0,"li",46)(1,"span",47),GC(2),pl(),ws(3,"span",48),GC(4),pl(),Jw(5,xe,6,0)(6,be,2,0,"button",49),pl()),r&2){let e=i.$implicit,a=gC(6);XE(2),Yg(e.name),XE(2),Yg(e.subtitle),XE(),eC(a.isPendingDelete(e)?5:6);}}function he(r,i){if(r&1&&(ws(0,"h3",44),GC(1,"AI Providers"),pl(),ws(2,"ul",45),rC(3,ye,7,3,"li",46,Kw().trackEntry,true),pl()),r&2){let e=gC(5);XE(3),oC(e.recap().aiProviders);}}function Ee(r,i){if(r&1){let e=lC();ws(0,"span",50),GC(1,"Delete?"),pl(),ws(2,"button",51),Rg("click",function(){If(e);let d=gC().$implicit,_=gC(6);return wf(_.confirmDelete(d))}),GC(3," Confirm "),pl(),ws(4,"button",52),Rg("click",function(){If(e);let d=gC(7);return wf(d.cancelDelete())}),GC(5," Cancel "),pl();}}function Pe(r,i){if(r&1){let e=lC();ws(0,"button",52),Rg("click",function(){If(e);let d=gC().$implicit,_=gC(6);return wf(_.armDelete(d))}),GC(1," Delete "),pl();}}function Se(r,i){if(r&1&&(ws(0,"li",46)(1,"span",47),GC(2),pl(),ws(3,"span",48),GC(4),pl(),Jw(5,Ee,6,0)(6,Pe,2,0,"button",49),pl()),r&2){let e=i.$implicit,a=gC(6);XE(2),Yg(e.name),XE(2),Yg(e.subtitle),XE(),eC(a.isPendingDelete(e)?5:6);}}function we(r,i){if(r&1&&(ws(0,"h3",44),GC(1,"My global auth settings"),pl(),ws(2,"ul",45),rC(3,Se,7,3,"li",46,Kw().trackEntry,true),pl()),r&2){let e=gC(5);XE(3),oC(e.recap().authSettings);}}function ke(r,i){if(r&1&&(Jw(0,ve,5,0),Jw(1,he,5,0),Jw(2,we,5,0)),r&2){let e=gC(4);eC(e.recap().integrations.length>0?0:-1),XE(),eC(e.recap().aiProviders.length>0?1:-1),XE(),eC(e.recap().authSettings.length>0?2:-1);}}function Me(r,i){if(r&1&&Jw(0,ue,2,0,"p",43)(1,ke,3,3),r&2){let e=gC(3);eC(e.recap().total===0?0:1);}}function Oe(r,i){if(r&1){let e=lC();ws(0,"div",17)(1,"div",5)(2,"h2",6),GC(3,"Identity"),pl(),ws(4,"div",7)(5,"span",8),GC(6,"Email"),pl(),ws(7,"span",36),GC(8),pl()(),ws(9,"div",7)(10,"span",8),GC(11,"External ID"),pl(),ws(12,"span",36),GC(13),pl()()(),ws(14,"div",5)(15,"h2",6),GC(16,"Profile"),pl(),ws(17,"div",7)(18,"span",8),GC(19,"First name"),pl(),ws(20,"span",36),GC(21),pl()(),ws(22,"div",7)(23,"span",8),GC(24,"Last name"),pl(),ws(25,"span",36),GC(26),pl()(),ws(27,"div",37)(28,"span",8),GC(29,"Bio"),pl(),ws(30,"span",36),GC(31),pl()(),ws(32,"div",7)(33,"span",8),GC(34,"Language"),pl(),ws(35,"span",36),GC(36),pl()()(),ws(37,"div",33)(38,"button",38),Rg("click",function(){If(e);let d=gC(2);return wf(d.startEditing())}),GC(39," Edit profile "),pl()(),ws(40,"div",39)(41,"button",40),Rg("click",function(){If(e);let d=gC(2);return wf(d.toggleOverrides())}),ws(42,"span",41),GC(43,"\u25B6"),pl(),GC(44," My global user configurations "),ws(45,"span",42),GC(46),pl()(),Jw(47,Me,2,1),pl()();}if(r&2){let e=gC(),a=gC();XE(8),Yg(e.email),XE(5),Yg(e.externalId),XE(8),Yg(e.firstname||"\u2014"),XE(5),Yg(e.lastname||"\u2014"),XE(5),Yg(e.bio||"\u2014"),XE(5),Yg(e.preferredLanguage||"\u2014"),XE(5),Tg("aria-expanded",a.isOverridesExpanded()),XE(),Ug("user-profile__overrides-arrow--open",a.isOverridesExpanded()),XE(4),vl("(",a.recap().total,")"),XE(),eC(a.isOverridesExpanded()?47:-1);}}function Ue(r,i){if(r&1&&(ws(0,"div",5)(1,"h2",6),GC(2,"Appearance"),pl(),ws(3,"div",7)(4,"span",8),GC(5,"Skin"),pl(),ws(6,"div",9),rC(7,de,5,5,"button",10,D),pl()(),ws(9,"div",7)(10,"span",8),GC(11,"Mode"),pl(),ws(12,"div",11),rC(13,_e,2,4,"button",12,D),pl()()(),ws(15,"div",5)(16,"h2",6),GC(17,"Composer"),pl(),ws(18,"div",7)(19,"span",8),GC(20,"Enter key"),pl(),ws(21,"div",13)(22,"div",14),rC(23,ce,2,4,"button",12,D),pl(),ws(25,"p",15),GC(26,'In "New line" mode, press Ctrl or Cmd + Enter to send.'),pl()()()(),Jw(27,me,40,5,"form",16)(28,Oe,48,11,"div",17)),r&2){let e=gC();XE(7),oC(e.themeVariantOptions),XE(6),oC(e.themeOptions),XE(10),oC(e.enterKeyOptions),XE(4),eC(e.isEditing()?27:28);}}function Te(r,i){r&1&&(ws(0,"p",4),GC(1,"Unable to load profile."),pl());}var le=class r{userState=g(l);router=g(F);location=g(Mm);destroyRef=g(Ce$1);integrationState=g(N);providerState=g(O);authSettingState=g(R);themePort=g(I);preferencesPort=g(f);isEditing=Gi(false);isLoading=Gi(false);isSaving=Gi(false);isOverridesExpanded=Gi(false);currentUser=this.userState.currentUser;theme=this.themePort.theme;themeMode=mT(()=>this.themePort.theme().mode);themeOptions=[{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"system",label:"System"}];themeVariant=mT(()=>this.themePort.theme().variant);themeVariantOptions=[{value:"industry",label:"Industry",description:"Bleu acier, Barlow"},{value:"terminal",label:"Terminal",description:"Ambre CRT, JetBrains Mono"}];enterKeyBehavior=this.preferencesPort.enterKeyBehavior;enterKeyOptions=[{value:"send",label:"Send"},{value:"newline",label:"New line"}];languageOptions=[{value:"",label:"No preference (English fallback)"},{value:"fr",label:"French"},{value:"de",label:"German"},{value:"es",label:"Spanish"},{value:"pt",label:"Portuguese"},{value:"it",label:"Italian"},{value:"nl",label:"Dutch"},{value:"pl",label:"Polish"},{value:"ja",label:"Japanese"},{value:"zh",label:"Chinese"}];form=new z({firstname:new _t("",{nonNullable:true}),lastname:new _t("",{nonNullable:true}),bio:new _t("",{nonNullable:true}),preferredLanguage:new _t("",{nonNullable:true})});recap=F$1(Ly([this.integrationState.userGlobal$,this.providerState.userGlobal$,this.authSettingState.userGlobal$]).pipe(re(([i,e,a])=>{let d=i.map(g=>({category:"integration",id:g.id??"",name:g.name,subtitle:g.integrationType})),_=e.map(g=>({category:"aiProvider",id:g.id??"",name:g.name,subtitle:g.apiType})),I=a.map(g=>({category:"authSetting",id:g.id??"",name:g.name,subtitle:g.authType}));return {integrations:d,aiProviders:_,authSettings:I,total:d.length+_.length+I.length}})),{initialValue:{integrations:[],aiProviders:[],authSettings:[],total:0}});ngOnInit(){if(this.currentUser()){this.syncFormFromState();return}this.isLoading.set(true),this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:()=>{this.syncFormFromState(),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}startEditing(){this.syncFormFromState(),this.isEditing.set(true);}cancelEditing(){this.isEditing.set(false);}setTheme(i){this.themePort.setTheme({variant:this.themePort.theme().variant,mode:i});}setThemeVariant(i){this.themePort.setTheme({variant:i,mode:this.themePort.theme().mode});}setEnterKeyBehavior(i){this.preferencesPort.setEnterKeyBehavior(i);}save(){if(this.isSaving())return;this.isSaving.set(true);let i=this.form.controls.preferredLanguage.value.trim();this.userState.updateMe({firstname:this.form.controls.firstname.value.trim()||void 0,lastname:this.form.controls.lastname.value.trim()||void 0,bio:this.form.controls.bio.value.trim()||void 0,preferredLanguage:i||void 0}).pipe(U(this.destroyRef)).subscribe({next:()=>{this.isSaving.set(false),this.isEditing.set(false);},error:()=>this.isSaving.set(false)});}toggleOverrides(){this.isOverridesExpanded.update(i=>!i),this.pendingDeleteKey.set(null);}pendingDeleteKey=Gi(null);isPendingDelete(i){return this.pendingDeleteKey()===this.entryKey(i)}armDelete(i){i.id&&this.pendingDeleteKey.set(this.entryKey(i));}cancelDelete(){this.pendingDeleteKey.set(null);}confirmDelete(i){if(!i.id)return;this.pendingDeleteKey.set(null),(i.category==="integration"?this.integrationState.delete(i.id,"userGlobal"):i.category==="authSetting"?this.authSettingState.delete(i.id,"userGlobal"):this.providerState.delete(i.id,"userGlobal")).pipe(U(this.destroyRef)).subscribe({error:a=>{console.error(`[UserProfile] Delete failed for ${i.category}:${i.id}:`,a);}});}entryKey(i){return `${i.category}:${i.id}`}goBack(){window.history.length>1?this.location.back():this.router.navigate(["/agentos"]);}trackEntry(i,e){return this.entryKey(e)}syncFormFromState(){let i=this.currentUser();i&&this.form.setValue({firstname:i.firstname??"",lastname:i.lastname??"",bio:i.bio??"",preferredLanguage:i.preferredLanguage??""});}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=xw({type:r,selectors:[["agentos-user-profile"]],decls:8,vars:1,consts:[[1,"user-profile"],[1,"user-profile__header"],["icon","arrow_back","title","Back",3,"action"],[1,"user-profile__title"],[1,"user-profile__loading"],[1,"user-profile__section"],[1,"user-profile__section-title"],[1,"user-profile__field"],[1,"user-profile__label"],[1,"user-profile__theme-variants"],["type","button",1,"user-profile__theme-variant",3,"user-profile__theme-variant--active"],["role","group","aria-label","Color mode",1,"user-profile__segmented"],["type","button",1,"user-profile__segmented-option",3,"user-profile__segmented-option--active"],[1,"user-profile__field-control"],["role","group","aria-label","Enter key behavior",1,"user-profile__segmented"],[1,"user-profile__hint"],[1,"user-profile__form",3,"formGroup"],[1,"user-profile__view"],["type","button",1,"user-profile__theme-variant",3,"click"],[1,"user-profile__theme-variant-name"],[1,"user-profile__theme-variant-desc"],["type","button",1,"user-profile__segmented-option",3,"click"],[1,"user-profile__form",3,"ngSubmit","formGroup"],[1,"user-profile__value","user-profile__value--readonly"],["for","up-firstname",1,"user-profile__label"],["id","up-firstname","type","text","placeholder","Your first name","formControlName","firstname","autocomplete","given-name",1,"user-profile__input"],["for","up-lastname",1,"user-profile__label"],["id","up-lastname","type","text","placeholder","Your last name","formControlName","lastname","autocomplete","family-name",1,"user-profile__input"],["for","up-bio",1,"user-profile__label"],["id","up-bio","placeholder","A short description about yourself","formControlName","bio","rows","4",1,"user-profile__input","user-profile__input--textarea"],["for","up-preferredLanguage",1,"user-profile__label"],["id","up-preferredLanguage","formControlName","preferredLanguage",1,"user-profile__input","user-profile__select"],[3,"value"],[1,"user-profile__actions"],["type","submit",1,"user-profile__btn","user-profile__btn--primary",3,"disabled"],["type","button",1,"user-profile__btn",3,"click"],[1,"user-profile__value"],[1,"user-profile__field","user-profile__field--bio"],["type","button",1,"user-profile__btn","user-profile__btn--primary",3,"click"],[1,"user-profile__overrides"],["type","button",1,"user-profile__overrides-toggle",3,"click"],[1,"user-profile__overrides-arrow"],[1,"user-profile__overrides-count"],[1,"user-profile__overrides-empty"],[1,"user-profile__overrides-subtitle"],[1,"user-profile__overrides-list"],[1,"user-profile__overrides-row"],[1,"user-profile__overrides-name"],[1,"user-profile__overrides-subtitle-text"],["type","button",1,"user-profile__overrides-delete"],[1,"user-profile__overrides-confirm-label"],["type","button",1,"user-profile__overrides-delete","user-profile__overrides-delete--confirm",3,"click"],["type","button",1,"user-profile__overrides-delete",3,"click"]],template:function(e,a){if(e&1&&(ws(0,"div",0)(1,"header",1)(2,"ds-icon-button",2),Rg("action",function(){return a.goBack()}),pl(),ws(3,"h1",3),GC(4,"My profile"),pl()(),Jw(5,se,2,0,"p",4)(6,Ue,29,1)(7,Te,2,0,"p",4),pl()),e&2){let d;XE(5),eC(a.isLoading()?5:(d=a.currentUser())?6:7,d);}},dependencies:[ni,Jn,Qn,ei,Ye,At,Zn,Xn,En,An,Se$1],styles:[`.user-profile[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.user-profile__header[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;gap:.5rem}.user-profile__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)}.user-profile__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.user-profile__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.user-profile__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.user-profile__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.user-profile__view[_ngcontent-%COMP%], .user-profile__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem}.user-profile__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem}.user-profile__section-title[_ngcontent-%COMP%]{margin:0;font-family:var(--font-heading);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);border-bottom:1px solid var(--color-divider);padding-bottom:.5rem}.user-profile__field[_ngcontent-%COMP%]{display:grid;grid-template-columns:140px 1fr;align-items:baseline;gap:.75rem}.user-profile__field--bio[_ngcontent-%COMP%]{align-items:start}.user-profile__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text-secondary);white-space:nowrap}.user-profile__value[_ngcontent-%COMP%]{font-size:.9375rem;color:var(--color-text);word-break:break-word;white-space:pre-wrap}.user-profile__value--readonly[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.875rem}.user-profile__segmented[_ngcontent-%COMP%]{display:inline-flex;justify-self:start;border:1px solid var(--color-divider);overflow:hidden}.user-profile__segmented-option[_ngcontent-%COMP%]{padding:.4rem .85rem;background:transparent;border:none;border-right:1px solid var(--color-divider);color:var(--color-text-secondary);font-size:.875rem;cursor:pointer;transition:background .15s ease,color .15s ease}.user-profile__segmented-option[_ngcontent-%COMP%]:last-child{border-right:none}.user-profile__segmented-option[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.user-profile__segmented-option--active[_ngcontent-%COMP%]{background:var(--color-accent);color:#fff}.user-profile__segmented-option--active[_ngcontent-%COMP%]:hover{background:var(--color-accent-700)}.user-profile__field-control[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-start;gap:.4rem}.user-profile__hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary)}.user-profile__select[_ngcontent-%COMP%]{appearance:none;cursor:pointer;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right .75rem center;padding-right:2.25rem}.user-profile__input[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;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;border-radius:0;transition:border-color .15s ease;resize:none}.user-profile__input[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.user-profile__input[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.user-profile__input--textarea[_ngcontent-%COMP%]{line-height:1.5;resize:vertical}.user-profile__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.user-profile__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;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;border-radius:0;transition:background .15s ease,border-color .15s ease}.user-profile__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.user-profile__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.user-profile__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.user-profile__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}.user-profile__theme-variants[_ngcontent-%COMP%]{display:flex;gap:8px;justify-self:start}.user-profile__theme-variant[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-start;gap:3px;padding:10px 16px;border:1px solid var(--color-divider);background:transparent;cursor:pointer;min-width:120px;transition:background .12s,border-color .12s}.user-profile__theme-variant[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.user-profile__theme-variant--active[_ngcontent-%COMP%]{border-color:var(--color-accent);background:color-mix(in srgb,var(--color-accent) 8%,transparent)}.user-profile__theme-variant-name[_ngcontent-%COMP%]{font-family:var(--font-heading);font-size:13px;font-weight:600;color:var(--color-text)}.user-profile__theme-variant-desc[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-secondary);font-family:var(--font-body)}.user-profile__overrides[_ngcontent-%COMP%]{margin-top:1rem;padding-top:1rem;border-top:1px solid var(--color-divider)}.user-profile__overrides-toggle[_ngcontent-%COMP%]{background:transparent;border:none;padding:.25rem 0;font-size:.85rem;color:var(--color-text-secondary);cursor:pointer;display:flex;align-items:center;gap:.4rem}.user-profile__overrides-toggle[_ngcontent-%COMP%]:hover{color:var(--color-text)}.user-profile__overrides-arrow[_ngcontent-%COMP%]{display:inline-block;font-size:.65rem;transition:transform .15s ease}.user-profile__overrides-arrow--open[_ngcontent-%COMP%]{transform:rotate(90deg)}.user-profile__overrides-count[_ngcontent-%COMP%]{color:var(--color-text-tertiary)}.user-profile__overrides-empty[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary);font-style:italic;padding:.5rem 0 0;margin:0}.user-profile__overrides-subtitle[_ngcontent-%COMP%]{font-family:var(--font-heading);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);margin:.75rem 0 .25rem}.user-profile__overrides-list[_ngcontent-%COMP%]{list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:.25rem}.user-profile__overrides-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.4rem .5rem;font-size:.85rem;border-radius:0}.user-profile__overrides-row[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.user-profile__overrides-name[_ngcontent-%COMP%]{flex:1;color:var(--color-text);font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.user-profile__overrides-subtitle-text[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);font-family:var(--font-heading)}.user-profile__overrides-confirm-label[_ngcontent-%COMP%]{font-size:11px;font-family:var(--font-heading);font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--red-deep);white-space:nowrap}.user-profile__overrides-delete[_ngcontent-%COMP%]{background:transparent;border:1px solid transparent;font-size:11px;font-family:var(--font-heading);font-weight:600;color:var(--color-neutral-500);cursor:pointer;padding:3px 8px;border-radius:0;transition:color .12s,background .12s,border-color .12s}.user-profile__overrides-delete[_ngcontent-%COMP%]:hover{color:var(--red);background:color-mix(in srgb,var(--red) 10%,transparent);border-color:var(--red)}.user-profile__overrides-delete--confirm[_ngcontent-%COMP%]{border-color:var(--red);background:var(--red);color:#fff}.user-profile__overrides-delete--confirm[_ngcontent-%COMP%]:hover{background:var(--red-deep);border-color:var(--red-deep)}`]})};
2
2
  export{le as UserProfileComponent};
@@ -1 +1 @@
1
- import {p}from'./chunk-pkNoeD9f.js';import {g,ao as W,D as py,d4 as y,e as xw,aw as hl,n as GC,ax as gl,X as XE,a8 as Yg}from'./main-EVOOW2CG.js';import'./chunk-DAtwHi5G.js';import'./chunk-C8UVOyhT.js';import'./chunk-DJTNjd3B.js';import'./chunk-FV8LaU7e.js';var A=class r{route=g(W);http=g(py);config=g(y);message="Authentication in progress\u2026";ngOnInit(){let e=this.route.snapshot.queryParamMap.get("code"),t=this.route.snapshot.queryParamMap.get("state"),o=this.route.snapshot.queryParamMap.get("error"),i=this.route.snapshot.queryParamMap.get("error_description");if(o){console.warn("[AgentOS OAuth Callback] OAuth error:",o,i),this.notifyParentAndClose({success:false,error:i||o});return}if(!e){console.error("[AgentOS OAuth Callback] Missing authorization code"),this.message="OAuth callback error: missing authorization code.",this.notifyParentAndClose({success:false,error:"Missing authorization code"});return}this.http.post(`${this.config.basePath}/api/oauth/callback`,{code:e,state:t}).subscribe({next:()=>{console.log("[AgentOS OAuth Callback] Backend callback resolved"),this.notifyParentAndClose({success:true});},error:a=>{console.error("[AgentOS OAuth Callback] Backend callback failed:",a),this.notifyParentAndClose({success:false,error:a?.error?.message||a?.message||"Token exchange failed"});}});}notifyParentAndClose(e){if(this.message=e.success?"Authentication complete. You can close this window.":`Authentication failed: ${e.error??"unknown error"}. You can close this window.`,window.opener)try{window.opener.postMessage(e,window.location.origin);}catch(t){console.error("[AgentOS OAuth Callback] postMessage failed:",t),localStorage.setItem(p,JSON.stringify(e));}else console.warn("[AgentOS OAuth Callback] No window.opener \u2014 localStorage fallback"),localStorage.setItem(p,JSON.stringify(e));setTimeout(()=>window.close(),1e3);}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=xw({type:r,selectors:[["agentos-oauth-callback"]],decls:2,vars:1,consts:[[2,"font-family","sans-serif","padding","2rem","text-align","center"]],template:function(t,o){t&1&&(hl(0,"p",0),GC(1),gl()),t&2&&(XE(),Yg(o.message));},encapsulation:2,changeDetection:1})};export{A as OAuthCallbackComponent};
1
+ import {p}from'./chunk-fBYTYGxD.js';import {g,ao as W,D as py,d4 as y,e as xw,aw as hl,n as GC,ax as gl,X as XE,a8 as Yg}from'./main-E674WB3K.js';import'./chunk-DvgF2GEo.js';import'./chunk-D-C39lLD.js';import'./chunk-zIMeg4Tv.js';import'./chunk-B_SBnFI8.js';var A=class r{route=g(W);http=g(py);config=g(y);message="Authentication in progress\u2026";ngOnInit(){let e=this.route.snapshot.queryParamMap.get("code"),t=this.route.snapshot.queryParamMap.get("state"),o=this.route.snapshot.queryParamMap.get("error"),i=this.route.snapshot.queryParamMap.get("error_description");if(o){console.warn("[AgentOS OAuth Callback] OAuth error:",o,i),this.notifyParentAndClose({success:false,error:i||o});return}if(!e){console.error("[AgentOS OAuth Callback] Missing authorization code"),this.message="OAuth callback error: missing authorization code.",this.notifyParentAndClose({success:false,error:"Missing authorization code"});return}this.http.post(`${this.config.basePath}/api/oauth/callback`,{code:e,state:t}).subscribe({next:()=>{console.log("[AgentOS OAuth Callback] Backend callback resolved"),this.notifyParentAndClose({success:true});},error:a=>{console.error("[AgentOS OAuth Callback] Backend callback failed:",a),this.notifyParentAndClose({success:false,error:a?.error?.message||a?.message||"Token exchange failed"});}});}notifyParentAndClose(e){if(this.message=e.success?"Authentication complete. You can close this window.":`Authentication failed: ${e.error??"unknown error"}. You can close this window.`,window.opener)try{window.opener.postMessage(e,window.location.origin);}catch(t){console.error("[AgentOS OAuth Callback] postMessage failed:",t),localStorage.setItem(p,JSON.stringify(e));}else console.warn("[AgentOS OAuth Callback] No window.opener \u2014 localStorage fallback"),localStorage.setItem(p,JSON.stringify(e));setTimeout(()=>window.close(),1e3);}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=xw({type:r,selectors:[["agentos-oauth-callback"]],decls:2,vars:1,consts:[[2,"font-family","sans-serif","padding","2rem","text-align","center"]],template:function(t,o){t&1&&(hl(0,"p",0),GC(1),gl()),t&2&&(XE(),Yg(o.message));},encapsulation:2,changeDetection:1})};export{A as OAuthCallbackComponent};
@@ -1 +1 @@
1
- import {m,F as F$1,E}from'./chunk-pkNoeD9f.js';import {g,ao as W,F,C as Ce,aJ as Tr,G as Gi,bS as Ea,M as By,a7 as ya,Q as br,b as U$1,e as xw,k as ws,q as Rg,n as GC,o as pl,J as Jw,X as XE,v as eC,a9 as lC,s as rC,ac as gC,u as bg,y as oC,a8 as Yg,aa as If,ab as wf}from'./main-EVOOW2CG.js';import {d as Kn,J as Jn,Y as Yn}from'./chunk-C8UVOyhT.js';import'./chunk-DJTNjd3B.js';import'./chunk-FV8LaU7e.js';import'./chunk-DAtwHi5G.js';var j=(n,t)=>t.key;function z(n,t){n&1&&(ws(0,"p",2),GC(1,"Loading prompts\u2026"),pl());}function B(n,t){n&1&&(ws(0,"p",3),GC(1,"No prompts available."),pl());}function A(n,t){n&1&&(ws(0,"ds-tag",12),GC(1,"Read-only"),pl());}function H(n,t){if(n&1){let e=lC();ws(0,"button",15),Rg("click",function(){If(e);let p=gC().$implicit,l=gC(2);return wf(l.edit(p))}),GC(1,"Edit"),pl(),ws(2,"button",16),Rg("click",function(){If(e);let p=gC().$implicit,l=gC(2);return wf(l.delete(p))}),GC(3,"Delete"),pl();}}function J(n,t){n&1&&(ws(0,"button",14),GC(1,"Inherited"),pl());}function U(n,t){if(n&1&&(ws(0,"tr")(1,"td",8),GC(2),pl(),ws(3,"td",9),GC(4),pl(),ws(5,"td")(6,"div",10)(7,"ds-tag",11),GC(8),pl(),Jw(9,A,2,0,"ds-tag",12),pl()(),ws(10,"td",13),Jw(11,H,4,0)(12,J,2,0,"button",14),pl()()),n&2){let e=t.$implicit;XE(2),Yg(e.prompt.name),XE(2),Yg(e.prompt.description||"\u2014"),XE(3),bg("variant",e.scope==="platform"?"neutral":"accent"),XE(),Yg(e.scope==="platform"?"Platform":"Namespace"),XE(),eC(e.scope==="platform"?9:-1),XE(2),eC(e.scope==="namespace"?11:12);}}function G(n,t){if(n&1){let e=lC();ws(0,"agentos-table-filter",4),Rg("queryChange",function(p){If(e);let l=gC();return wf(l.rowFilter.query.set(p))}),pl(),ws(1,"div",5)(2,"table",6)(3,"thead")(4,"tr")(5,"th"),GC(6,"Name"),pl(),ws(7,"th"),GC(8,"Description"),pl(),ws(9,"th"),GC(10,"Scope"),pl(),ws(11,"th")(12,"span",7),GC(13,"Actions"),pl()()()(),ws(14,"tbody"),rC(15,U,13,6,"tr",null,j),pl()()();}if(n&2){let e=gC();bg("query",e.rowFilter.query()),XE(15),oC(e.rowFilter.filteredRows());}}var L=class n{route=g(W);router=g(F);destroyRef=g(Ce);promptState=g(m);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Tr(void 0);isLoading=Gi(true);rows=Gi([]);rowFilter=F$1(this.rows,t=>[t.prompt.name,t.prompt.description,t.scope].filter(Boolean).join(" "));allPrompts$=this.refresh$.pipe(Ea(()=>(this.isLoading.set(true),By({platform:this.promptState.listPlatform().pipe(ya(()=>br([]))),namespace:this.promptState.listByNamespace(this.namespaceId)}))));constructor(){this.allPrompts$.pipe(U$1(this.destroyRef)).subscribe({next:({platform:t,namespace:e})=>{this.rows.set([...t.map((a,p)=>({key:`platform:${a.id??p}`,prompt:a,scope:"platform"})),...e.map((a,p)=>({key:`namespace:${a.id??p}`,prompt:a,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"prompts","new"]);}edit(t){t.scope==="platform"||!t.prompt.id||this.router.navigate(["/agentos",this.namespaceId,"prompts",t.prompt.id,"edit"]);}delete(t){t.scope==="platform"||!t.prompt.id||!confirm(`Delete prompt \u201C${t.prompt.name}\u201D?`)||this.promptState.delete(t.prompt.id).pipe(U$1(this.destroyRef)).subscribe(()=>this.refresh$.next());}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=xw({type:n,selectors:[["agentos-namespace-prompts"]],decls:6,vars:1,consts:[["title","Prompts","description","Prompts available in this namespace, including prompts inherited from the platform."],["type","button",1,"prompts__new",3,"click"],["role","status",1,"prompts__status"],[1,"prompts__status"],["label","Filter prompts","placeholder","Filter prompts\u2026",3,"queryChange","query"],[1,"prompts__table-wrap"],["dsTable",""],[1,"sr-only"],[1,"prompts__name"],[1,"prompts__description"],[1,"prompts__tags"],[3,"variant"],["variant","outline"],[1,"prompts__actions"],["type","button","disabled",""],["type","button",3,"click"],["type","button",1,"prompts__delete",3,"click"]],template:function(e,a){e&1&&(ws(0,"ds-section-header",0)(1,"button",1),Rg("click",function(){return a.openCreateForm()}),GC(2,"New prompt"),pl()(),Jw(3,z,2,0,"p",2)(4,B,2,0,"p",3)(5,G,17,1)),e&2&&(XE(3),eC(a.isLoading()?3:a.rows().length===0?4:5));},dependencies:[Kn,Jn,Yn,E],styles:[".prompts__new[_ngcontent-%COMP%]{padding:7px 12px;border:1px solid var(--color-accent);border-radius:0;background:var(--color-accent);color:var(--color-bg);cursor:pointer;font-family:var(--font-heading);font-size:14px;font-weight:600}.prompts__status[_ngcontent-%COMP%]{margin:20px 8px;color:var(--color-text-secondary)}.prompts__table-wrap[_ngcontent-%COMP%]{overflow-x:auto}table.ds-table[_ngcontent-%COMP%]{width:100%;border-collapse:collapse;font-size:14px}table.ds-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid var(--color-divider);color:var(--color-neutral-600);font-size:11px;letter-spacing:.08em;text-align:left;text-transform:uppercase}table.ds-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid color-mix(in srgb,var(--color-text) 8%,transparent)}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.prompts__name[_ngcontent-%COMP%]{font-weight:500}.prompts__description[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.prompts__tags[_ngcontent-%COMP%]{display:flex;gap:4px;flex-wrap:wrap}.prompts__actions[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;gap:4px;white-space:nowrap}.prompts__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{padding:4px 7px;border:1px solid transparent;background:transparent;color:var(--color-accent);cursor:pointer;font:inherit}.prompts__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-100)}.prompts__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:disabled{color:var(--color-neutral-600);cursor:default}.prompts__actions[_ngcontent-%COMP%] .prompts__delete[_ngcontent-%COMP%]{color:var(--color-error)}.sr-only[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}"]})};export{L as NamespacePromptsComponent};
1
+ import {m,F as F$1,E}from'./chunk-fBYTYGxD.js';import {g,ao as W,F,C as Ce,aJ as Tr,G as Gi,bS as Ea,M as By,a7 as ya,Q as br,b as U$1,e as xw,k as ws,q as Rg,n as GC,o as pl,J as Jw,X as XE,v as eC,a9 as lC,s as rC,ac as gC,u as bg,y as oC,a8 as Yg,aa as If,ab as wf}from'./main-E674WB3K.js';import {d as Kn,J as Jn,Y as Yn}from'./chunk-D-C39lLD.js';import'./chunk-zIMeg4Tv.js';import'./chunk-B_SBnFI8.js';import'./chunk-DvgF2GEo.js';var j=(n,t)=>t.key;function z(n,t){n&1&&(ws(0,"p",2),GC(1,"Loading prompts\u2026"),pl());}function B(n,t){n&1&&(ws(0,"p",3),GC(1,"No prompts available."),pl());}function A(n,t){n&1&&(ws(0,"ds-tag",12),GC(1,"Read-only"),pl());}function H(n,t){if(n&1){let e=lC();ws(0,"button",15),Rg("click",function(){If(e);let p=gC().$implicit,l=gC(2);return wf(l.edit(p))}),GC(1,"Edit"),pl(),ws(2,"button",16),Rg("click",function(){If(e);let p=gC().$implicit,l=gC(2);return wf(l.delete(p))}),GC(3,"Delete"),pl();}}function J(n,t){n&1&&(ws(0,"button",14),GC(1,"Inherited"),pl());}function U(n,t){if(n&1&&(ws(0,"tr")(1,"td",8),GC(2),pl(),ws(3,"td",9),GC(4),pl(),ws(5,"td")(6,"div",10)(7,"ds-tag",11),GC(8),pl(),Jw(9,A,2,0,"ds-tag",12),pl()(),ws(10,"td",13),Jw(11,H,4,0)(12,J,2,0,"button",14),pl()()),n&2){let e=t.$implicit;XE(2),Yg(e.prompt.name),XE(2),Yg(e.prompt.description||"\u2014"),XE(3),bg("variant",e.scope==="platform"?"neutral":"accent"),XE(),Yg(e.scope==="platform"?"Platform":"Namespace"),XE(),eC(e.scope==="platform"?9:-1),XE(2),eC(e.scope==="namespace"?11:12);}}function G(n,t){if(n&1){let e=lC();ws(0,"agentos-table-filter",4),Rg("queryChange",function(p){If(e);let l=gC();return wf(l.rowFilter.query.set(p))}),pl(),ws(1,"div",5)(2,"table",6)(3,"thead")(4,"tr")(5,"th"),GC(6,"Name"),pl(),ws(7,"th"),GC(8,"Description"),pl(),ws(9,"th"),GC(10,"Scope"),pl(),ws(11,"th")(12,"span",7),GC(13,"Actions"),pl()()()(),ws(14,"tbody"),rC(15,U,13,6,"tr",null,j),pl()()();}if(n&2){let e=gC();bg("query",e.rowFilter.query()),XE(15),oC(e.rowFilter.filteredRows());}}var L=class n{route=g(W);router=g(F);destroyRef=g(Ce);promptState=g(m);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Tr(void 0);isLoading=Gi(true);rows=Gi([]);rowFilter=F$1(this.rows,t=>[t.prompt.name,t.prompt.description,t.scope].filter(Boolean).join(" "));allPrompts$=this.refresh$.pipe(Ea(()=>(this.isLoading.set(true),By({platform:this.promptState.listPlatform().pipe(ya(()=>br([]))),namespace:this.promptState.listByNamespace(this.namespaceId)}))));constructor(){this.allPrompts$.pipe(U$1(this.destroyRef)).subscribe({next:({platform:t,namespace:e})=>{this.rows.set([...t.map((a,p)=>({key:`platform:${a.id??p}`,prompt:a,scope:"platform"})),...e.map((a,p)=>({key:`namespace:${a.id??p}`,prompt:a,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"prompts","new"]);}edit(t){t.scope==="platform"||!t.prompt.id||this.router.navigate(["/agentos",this.namespaceId,"prompts",t.prompt.id,"edit"]);}delete(t){t.scope==="platform"||!t.prompt.id||!confirm(`Delete prompt \u201C${t.prompt.name}\u201D?`)||this.promptState.delete(t.prompt.id).pipe(U$1(this.destroyRef)).subscribe(()=>this.refresh$.next());}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=xw({type:n,selectors:[["agentos-namespace-prompts"]],decls:6,vars:1,consts:[["title","Prompts","description","Prompts available in this namespace, including prompts inherited from the platform."],["type","button",1,"prompts__new",3,"click"],["role","status",1,"prompts__status"],[1,"prompts__status"],["label","Filter prompts","placeholder","Filter prompts\u2026",3,"queryChange","query"],[1,"prompts__table-wrap"],["dsTable",""],[1,"sr-only"],[1,"prompts__name"],[1,"prompts__description"],[1,"prompts__tags"],[3,"variant"],["variant","outline"],[1,"prompts__actions"],["type","button","disabled",""],["type","button",3,"click"],["type","button",1,"prompts__delete",3,"click"]],template:function(e,a){e&1&&(ws(0,"ds-section-header",0)(1,"button",1),Rg("click",function(){return a.openCreateForm()}),GC(2,"New prompt"),pl()(),Jw(3,z,2,0,"p",2)(4,B,2,0,"p",3)(5,G,17,1)),e&2&&(XE(3),eC(a.isLoading()?3:a.rows().length===0?4:5));},dependencies:[Kn,Jn,Yn,E],styles:[".prompts__new[_ngcontent-%COMP%]{padding:7px 12px;border:1px solid var(--color-accent);border-radius:0;background:var(--color-accent);color:var(--color-bg);cursor:pointer;font-family:var(--font-heading);font-size:14px;font-weight:600}.prompts__status[_ngcontent-%COMP%]{margin:20px 8px;color:var(--color-text-secondary)}.prompts__table-wrap[_ngcontent-%COMP%]{overflow-x:auto}table.ds-table[_ngcontent-%COMP%]{width:100%;border-collapse:collapse;font-size:14px}table.ds-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid var(--color-divider);color:var(--color-neutral-600);font-size:11px;letter-spacing:.08em;text-align:left;text-transform:uppercase}table.ds-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid color-mix(in srgb,var(--color-text) 8%,transparent)}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.prompts__name[_ngcontent-%COMP%]{font-weight:500}.prompts__description[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.prompts__tags[_ngcontent-%COMP%]{display:flex;gap:4px;flex-wrap:wrap}.prompts__actions[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;gap:4px;white-space:nowrap}.prompts__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{padding:4px 7px;border:1px solid transparent;background:transparent;color:var(--color-accent);cursor:pointer;font:inherit}.prompts__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-100)}.prompts__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:disabled{color:var(--color-neutral-600);cursor:default}.prompts__actions[_ngcontent-%COMP%] .prompts__delete[_ngcontent-%COMP%]{color:var(--color-error)}.sr-only[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}"]})};export{L as NamespacePromptsComponent};
@@ -1 +1 @@
1
- import {D}from'./chunk-CmObLvei.js';import {a}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-BSRWEUf3.js';import {s}from'./chunk-pkNoeD9f.js';import {g,ao as W$1,F,C as Ce,aJ as Tr,G as Gi,bS as Ea,M as By,a7 as ya,Q as br,r as re,cE as Dd,b as U,e as xw,aK as xb,J as Jw,k as ws,bf as aT,q as Rg,n as GC,o as pl,af as Eg,t as CC,v as eC,X as XE,u as bg,bg as uT,ah as rT,ac as gC,a8 as Yg,a9 as lC,aa as If,ab as wf,ag as fT}from'./main-EVOOW2CG.js';import {$ as $n}from'./chunk-C8UVOyhT.js';import'./chunk-DJTNjd3B.js';import'./chunk-FV8LaU7e.js';import'./chunk-DAtwHi5G.js';var J=()=>[];function W(a,e){if(a&1&&(ws(0,"p",1),GC(1),pl()),a&2){let t=gC();XE(),Yg(t.errorMessage());}}function H(a,e){if(a&1){let t=lC();ws(0,"agentos-skill-item",5),Rg("deleteRequested",function(i){If(t);let o=gC(2);return wf(o.deleteSkill(i))}),pl();}if(a&2){let t=e,n=gC().$implicit,i=gC();bg("skill",t)("namespaceId",i.namespaceId)("readOnly",i.isPlatformSkill(n.id))("namedByAgents",i.namedByAgents(t));}}function Q(a,e){if(a&1&&Jw(0,H,1,4,"agentos-skill-item",4),a&2){let t,n=e.$implicit,i=gC();eC((t=i.resolveSkill(n.id))?0:-1,t);}}var X="platform",Y="namespace",V=class a$1{route=g(W$1);router=g(F);destroyRef=g(Ce);skillState=g(o);agentState=g(s);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Tr(void 0);isLoading=Gi(true);errorMessage=Gi(null);allSkills$=this.refresh$.pipe(Ea(()=>(this.isLoading.set(true),By({platform:this.skillState.listPlatform().pipe(ya(()=>br([]))),namespace:this.skillState.listByNamespace(this.namespaceId),agents:By({namespace:this.agentState.listByNamespace(this.namespaceId),platform:this.agentState.listPlatform().pipe(ya(()=>br([])))}).pipe(re(({namespace:e,platform:t})=>[...e,...t]),ya(()=>br([])))}))),Dd({bufferSize:1,refCount:true}));skillItems$=this.allSkills$.pipe(re(({platform:e,namespace:t})=>[...e.map(n=>({id:n.id??"",name:n.name,description:n.description,groupKey:X,groupLabel:"Platform (read-only)"})),...t.map(n=>({id:n.id??"",name:n.name,description:n.description,groupKey:Y,groupLabel:"Namespace"}))]));namespaceSkillsById=new Map;platformSkillsById=new Map;namedByAgentsByName=new Map;constructor(){this.allSkills$.pipe(U(this.destroyRef)).subscribe({next:({platform:e,namespace:t,agents:n})=>{this.platformSkillsById=new Map(e.map(i=>[i.id??"",i])),this.namespaceSkillsById=new Map(t.map(i=>[i.id??"",i])),this.namedByAgentsByName=this.countNamedBy([...e,...t],n),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}countNamedBy(e,t){let n=new Map;for(let i of e){let o=t.filter(j=>a(j.skillSelectors,i.name)==="named").length;o>0&&n.set(i.name.toLowerCase(),o);}return n}namedByAgents(e){return this.namedByAgentsByName.get(e.name.toLowerCase())??0}goBack(){this.router.navigate(["/agentos","namespaces"]);}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"skills","new"]);}deleteSkill(e){this.errorMessage.set(null),this.skillState.delete(e.id??"").pipe(U(this.destroyRef)).subscribe({next:()=>this.refresh$.next(),error:t=>this.errorMessage.set(t.status===400?`"${e.name}" is defined by a SKILL.md file and cannot be deleted through the API.`:`Deleting "${e.name}" failed.`)});}resolveSkill(e){return this.platformSkillsById.get(e)??this.namespaceSkillsById.get(e)??null}isPlatformSkill(e){return this.platformSkillsById.has(e)}static \u0275fac=function(t){return new(t||a$1)};static \u0275cmp=xw({type:a$1,selectors:[["agentos-namespace-skills"]],decls:7,vars:8,consts:[["skillItemTpl",""],["role","alert",1,"namespace-skills__error"],["title","Skills","emptyMessage","No skills defined yet. Add one above, or drop a SKILL.md under the namespace config path.","cardMinWidth","400px",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","type","button",1,"namespace-skills__back",3,"click"],[3,"skill","namespaceId","readOnly","namedByAgents"],[3,"deleteRequested","skill","namespaceId","readOnly","namedByAgents"]],template:function(t,n){if(t&1&&(Jw(0,W,2,1,"p",1),ws(1,"ds-entity-list",2),aT(2,"async"),Rg("createRequested",function(){return n.openCreateForm()}),ws(3,"button",3),Rg("click",function(){return n.goBack()}),GC(4,"\u2190 Namespaces"),pl()(),Eg(5,Q,1,1,"ng-template",null,0,fT)),t&2){let i=CC(6);eC(n.errorMessage()?0:-1),XE(),bg("items",uT(2,5,n.skillItems$)??rT(7,J))("loading",n.isLoading())("showCreate",true)("itemTemplate",i);}},dependencies:[$n,D,xb],styles:[".namespace-skills__back[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.namespace-skills__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.namespace-skills__error[_ngcontent-%COMP%]{margin:0 0 .75rem;font-size:.875rem;color:var(--color-error, var(--red, #dc2626))}"]})};export{V as NamespaceSkillsComponent};
1
+ import {D}from'./chunk-VgVDkZ4m.js';import {a}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-CM72Zsqv.js';import {s}from'./chunk-fBYTYGxD.js';import {g,ao as W$1,F,C as Ce,aJ as Tr,G as Gi,bS as Ea,M as By,a7 as ya,Q as br,r as re,cE as Dd,b as U,e as xw,aK as xb,J as Jw,k as ws,bf as aT,q as Rg,n as GC,o as pl,af as Eg,t as CC,v as eC,X as XE,u as bg,bg as uT,ah as rT,ac as gC,a8 as Yg,a9 as lC,aa as If,ab as wf,ag as fT}from'./main-E674WB3K.js';import {$ as $n}from'./chunk-D-C39lLD.js';import'./chunk-zIMeg4Tv.js';import'./chunk-B_SBnFI8.js';import'./chunk-DvgF2GEo.js';var J=()=>[];function W(a,e){if(a&1&&(ws(0,"p",1),GC(1),pl()),a&2){let t=gC();XE(),Yg(t.errorMessage());}}function H(a,e){if(a&1){let t=lC();ws(0,"agentos-skill-item",5),Rg("deleteRequested",function(i){If(t);let o=gC(2);return wf(o.deleteSkill(i))}),pl();}if(a&2){let t=e,n=gC().$implicit,i=gC();bg("skill",t)("namespaceId",i.namespaceId)("readOnly",i.isPlatformSkill(n.id))("namedByAgents",i.namedByAgents(t));}}function Q(a,e){if(a&1&&Jw(0,H,1,4,"agentos-skill-item",4),a&2){let t,n=e.$implicit,i=gC();eC((t=i.resolveSkill(n.id))?0:-1,t);}}var X="platform",Y="namespace",V=class a$1{route=g(W$1);router=g(F);destroyRef=g(Ce);skillState=g(o);agentState=g(s);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Tr(void 0);isLoading=Gi(true);errorMessage=Gi(null);allSkills$=this.refresh$.pipe(Ea(()=>(this.isLoading.set(true),By({platform:this.skillState.listPlatform().pipe(ya(()=>br([]))),namespace:this.skillState.listByNamespace(this.namespaceId),agents:By({namespace:this.agentState.listByNamespace(this.namespaceId),platform:this.agentState.listPlatform().pipe(ya(()=>br([])))}).pipe(re(({namespace:e,platform:t})=>[...e,...t]),ya(()=>br([])))}))),Dd({bufferSize:1,refCount:true}));skillItems$=this.allSkills$.pipe(re(({platform:e,namespace:t})=>[...e.map(n=>({id:n.id??"",name:n.name,description:n.description,groupKey:X,groupLabel:"Platform (read-only)"})),...t.map(n=>({id:n.id??"",name:n.name,description:n.description,groupKey:Y,groupLabel:"Namespace"}))]));namespaceSkillsById=new Map;platformSkillsById=new Map;namedByAgentsByName=new Map;constructor(){this.allSkills$.pipe(U(this.destroyRef)).subscribe({next:({platform:e,namespace:t,agents:n})=>{this.platformSkillsById=new Map(e.map(i=>[i.id??"",i])),this.namespaceSkillsById=new Map(t.map(i=>[i.id??"",i])),this.namedByAgentsByName=this.countNamedBy([...e,...t],n),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}countNamedBy(e,t){let n=new Map;for(let i of e){let o=t.filter(j=>a(j.skillSelectors,i.name)==="named").length;o>0&&n.set(i.name.toLowerCase(),o);}return n}namedByAgents(e){return this.namedByAgentsByName.get(e.name.toLowerCase())??0}goBack(){this.router.navigate(["/agentos","namespaces"]);}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"skills","new"]);}deleteSkill(e){this.errorMessage.set(null),this.skillState.delete(e.id??"").pipe(U(this.destroyRef)).subscribe({next:()=>this.refresh$.next(),error:t=>this.errorMessage.set(t.status===400?`"${e.name}" is defined by a SKILL.md file and cannot be deleted through the API.`:`Deleting "${e.name}" failed.`)});}resolveSkill(e){return this.platformSkillsById.get(e)??this.namespaceSkillsById.get(e)??null}isPlatformSkill(e){return this.platformSkillsById.has(e)}static \u0275fac=function(t){return new(t||a$1)};static \u0275cmp=xw({type:a$1,selectors:[["agentos-namespace-skills"]],decls:7,vars:8,consts:[["skillItemTpl",""],["role","alert",1,"namespace-skills__error"],["title","Skills","emptyMessage","No skills defined yet. Add one above, or drop a SKILL.md under the namespace config path.","cardMinWidth","400px",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","type","button",1,"namespace-skills__back",3,"click"],[3,"skill","namespaceId","readOnly","namedByAgents"],[3,"deleteRequested","skill","namespaceId","readOnly","namedByAgents"]],template:function(t,n){if(t&1&&(Jw(0,W,2,1,"p",1),ws(1,"ds-entity-list",2),aT(2,"async"),Rg("createRequested",function(){return n.openCreateForm()}),ws(3,"button",3),Rg("click",function(){return n.goBack()}),GC(4,"\u2190 Namespaces"),pl()(),Eg(5,Q,1,1,"ng-template",null,0,fT)),t&2){let i=CC(6);eC(n.errorMessage()?0:-1),XE(),bg("items",uT(2,5,n.skillItems$)??rT(7,J))("loading",n.isLoading())("showCreate",true)("itemTemplate",i);}},dependencies:[$n,D,xb],styles:[".namespace-skills__back[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.namespace-skills__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.namespace-skills__error[_ngcontent-%COMP%]{margin:0 0 .75rem;font-size:.875rem;color:var(--color-error, var(--red, #dc2626))}"]})};export{V as NamespaceSkillsComponent};