@whoz-oss/coday-client 3.24.0 → 3.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/3rdpartylicenses.txt +234 -0
  2. package/browser/{chunk-D4DTIvDf.js → chunk-1xKCP6gl.js} +1 -1
  3. package/browser/{chunk-BHb31ndI.js → chunk-B1gTtKFG.js} +1 -1
  4. package/browser/{chunk-15rAOoZz.js → chunk-BIdH1XJF.js} +2 -2
  5. package/browser/chunk-BSAXfS2x.js +1 -0
  6. package/browser/{chunk-DK1hp0WW.js → chunk-Bbb2Oy9I.js} +6 -6
  7. package/browser/{chunk-DeXXr4BL.js → chunk-BjBW1d-u.js} +6 -6
  8. package/browser/{chunk-C2agnPiQ.js → chunk-BlUiCEeR.js} +1 -1
  9. package/browser/{chunk-CPI0Zzv3.js → chunk-BloWX02p.js} +1 -1
  10. package/browser/{chunk-XBakzM_b.js → chunk-BmHNWYuZ.js} +1 -1
  11. package/browser/{chunk-DgYr3Diz.js → chunk-Bo1DjeiW.js} +1 -1
  12. package/browser/{chunk-CPt7Uw3a.js → chunk-Boc0RvBR.js} +1 -1
  13. package/browser/{chunk-CjPIJIB-.js → chunk-Bol7PdRu.js} +1 -1
  14. package/browser/{chunk-DNVNXvsJ.js → chunk-BtBbv-Bf.js} +1 -1
  15. package/browser/{chunk-I8YepFsn.js → chunk-BvO---8Y.js} +2 -2
  16. package/browser/chunk-Bv_n_Pea.js +141 -0
  17. package/browser/chunk-C-VoWDOg.js +10 -0
  18. package/browser/chunk-C0DMx9CU.js +1 -0
  19. package/browser/chunk-C3cvHmBJ.js +1 -0
  20. package/browser/chunk-C5mPb_F4.js +1 -0
  21. package/browser/chunk-C6x9SBjG.js +1 -0
  22. package/browser/{chunk-C11du_uP.js → chunk-CBwpP2V0.js} +1 -1
  23. package/browser/{chunk-CIcEtCxk.js → chunk-CCEiNYBj.js} +1 -1
  24. package/browser/chunk-CCQAu0MS.js +1 -0
  25. package/browser/chunk-CE5rgBGE.js +182 -0
  26. package/browser/{chunk-BYJTaU4n.js → chunk-CERsD1uZ.js} +1 -1
  27. package/browser/chunk-CFY3CFkD.js +1 -0
  28. package/browser/{chunk-DCx8SlS-.js → chunk-CFfiJ53b.js} +1 -1
  29. package/browser/{chunk-7-d3g3_Q.js → chunk-CG4buEjj.js} +1 -1
  30. package/browser/{chunk-mUd43Vo8.js → chunk-CGL1Leue.js} +1 -1
  31. package/browser/{chunk-kNbhE9tu.js → chunk-CGlvdEI7.js} +1 -1
  32. package/browser/chunk-CHSLALZZ.js +111 -0
  33. package/browser/chunk-CRrjfkUg.js +5 -0
  34. package/browser/chunk-CdkqXKu3.js +1 -0
  35. package/browser/{chunk-DDertr1B.js → chunk-ChTqQ8HQ.js} +1 -1
  36. package/browser/chunk-CjKxvXTd.js +1 -0
  37. package/browser/{chunk-DCjMvdvV.js → chunk-Cmp8otOQ.js} +1 -1
  38. package/browser/{chunk-CbCwwL-W.js → chunk-CpGwP-5T.js} +1 -1
  39. package/browser/{chunk-CaH-AtD3.js → chunk-CrYRdxC9.js} +2 -2
  40. package/browser/chunk-CrZEE1qa.js +1 -0
  41. package/browser/chunk-Cw62GRPX.js +1 -0
  42. package/browser/{chunk-B-t2KLMQ.js → chunk-CxozF4Vf.js} +1 -1
  43. package/browser/{chunk-CzDFGxwY.js → chunk-D-vld_6F.js} +1 -1
  44. package/browser/{chunk-DFjiy89D.js → chunk-D2pgQ9ii.js} +1 -1
  45. package/browser/{chunk-BPAPWlpQ.js → chunk-D5UGtM5T.js} +1 -1
  46. package/browser/{chunk-CKBQdAGJ.js → chunk-DG8M0PqZ.js} +1 -1
  47. package/browser/chunk-DKg7p59a.js +1 -0
  48. package/browser/chunk-DOV6c8DN.js +4 -0
  49. package/browser/{chunk-BLSD82nL.js → chunk-DX05HUs9.js} +1 -1
  50. package/browser/{chunk-IXLj2Qpp.js → chunk-DZe-m4Sd.js} +1 -1
  51. package/browser/chunk-D_aTK145.js +37 -0
  52. package/browser/chunk-DczzZnS1.js +1 -0
  53. package/browser/{chunk-KXiD_ZK3.js → chunk-Ddpg0y75.js} +1 -1
  54. package/browser/chunk-DgmZwFcU.js +2 -0
  55. package/browser/chunk-DpKLsgM9.js +1 -0
  56. package/browser/chunk-DuNMllH-.js +2 -0
  57. package/browser/chunk-Dz1wgxrF.js +1 -0
  58. package/browser/{chunk-CKEgNNXU.js → chunk-Fh0Lvh-K.js} +1 -1
  59. package/browser/{chunk-BK_05kmN.js → chunk-G_l8BMaJ.js} +3 -3
  60. package/browser/{chunk-DpkO3_bQ.js → chunk-Ov4I3GYD.js} +1 -1
  61. package/browser/{chunk-4XIlyOr9.js → chunk-RUBMO7Yb.js} +3 -3
  62. package/browser/{chunk-DwQ0v-xH.js → chunk-WuZ8xi__.js} +1 -1
  63. package/browser/chunk-_2qKLbuS.js +1 -0
  64. package/browser/{chunk-B3xYeZtG.js → chunk-a4RWgm8g.js} +1 -1
  65. package/browser/{chunk-C2Rueaad.js → chunk-bIJnspzL.js} +1 -1
  66. package/browser/{chunk-Co5BFbll.js → chunk-cNEt2yX6.js} +1 -1
  67. package/browser/{chunk-Cf7f_94t.js → chunk-cg5smJeu.js} +1 -1
  68. package/browser/{chunk-CBYDDKYs.js → chunk-q9uyoVUw.js} +1 -1
  69. package/browser/chunk-sqjr_Ky0.js +1 -0
  70. package/browser/{chunk-D-5Imhde.js → chunk-u3jxNXQ8.js} +1 -1
  71. package/browser/chunk-vQXZQsZC.js +1 -0
  72. package/browser/index.html +1 -1
  73. package/browser/main-2GG5NZ4C.js +1811 -0
  74. package/package.json +1 -1
  75. package/browser/chunk-16yQFy5_.js +0 -1
  76. package/browser/chunk-B4l5qLZ6.js +0 -1
  77. package/browser/chunk-B52iVZ-n.js +0 -182
  78. package/browser/chunk-B7GIYsvs.js +0 -1
  79. package/browser/chunk-BBRGEWfs.js +0 -1
  80. package/browser/chunk-BOArVQMu.js +0 -1
  81. package/browser/chunk-BQmHxval.js +0 -1
  82. package/browser/chunk-BYg1TwUC.js +0 -1
  83. package/browser/chunk-BqhCkR9t.js +0 -1
  84. package/browser/chunk-BqxwtKFs.js +0 -1
  85. package/browser/chunk-Byin_63d.js +0 -141
  86. package/browser/chunk-BzZbVcon.js +0 -4
  87. package/browser/chunk-C1RU8zia.js +0 -9
  88. package/browser/chunk-C93ZXc5y.js +0 -1
  89. package/browser/chunk-C9dkqMA4.js +0 -1
  90. package/browser/chunk-CIfgFQUQ.js +0 -5
  91. package/browser/chunk-CqM-2yCQ.js +0 -2
  92. package/browser/chunk-D4_R7aqN.js +0 -1
  93. package/browser/chunk-DIuETvVC.js +0 -1
  94. package/browser/chunk-DuXr-yGB.js +0 -37
  95. package/browser/chunk-TkSR4UzV.js +0 -1
  96. package/browser/chunk-buoxjd5i.js +0 -1
  97. package/browser/chunk-g2nkIubB.js +0 -1
  98. package/browser/chunk-j5aTABHx.js +0 -2
  99. package/browser/chunk-nSYjfmpf.js +0 -1
  100. package/browser/chunk-sLJinEtR.js +0 -1
  101. package/browser/main-JTU33H5D.js +0 -1811
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whoz-oss/coday-client",
3
- "version": "3.24.0",
3
+ "version": "3.26.0",
4
4
  "repository": "https://github.com/whoz-oss/coday",
5
5
  "type": "module",
6
6
  "dependencies": {
@@ -1 +0,0 @@
1
- import {N}from'./chunk-nSYjfmpf.js';import {g,ao as V,G,C as Ce$1,da as M,dn as B,W as Wi,dp as W,d8 as N$1,b as U,a7 as va,X as br,S as Wy,r as re,z as z$1,a as P,j as jw,s as si,k as Cs,n as Lg,J as JC,m as hl,o as aC,u as sI,a8 as em,v as cC,ac as CC,x as xg,a9 as vC,A as Ag,a3 as ZI,a6 as QI,N as Ng,a5 as Dl,q as dC,w as fC,bo as uC,aa as Sf,ab as _f,b0 as tm}from'./main-JTU33H5D.js';import'./chunk-C1RU8zia.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,Z as Zn,l as Xn,$ as $t,W as Wt,C as Cn,E as En}from'./chunk-DuXr-yGB.js';import'./chunk-TkSR4UzV.js';import'./chunk-BK_05kmN.js';import'./chunk-DeXXr4BL.js';import'./chunk-DK1hp0WW.js';var me=(o,t)=>t.config.id,fe=(o,t)=>t.type;function ue(o,t){if(o&1&&(Cs(0,"a",5),JC(1,"View resolved definition \u2192"),hl()),o&2){let e=CC();xg("routerLink",e.inspectRoute());}}function pe(o,t){o&1&&(Cs(0,"span",6),JC(1,"Platform level"),hl());}function _e(o,t){o&1&&(Cs(0,"p",7),JC(1,"Loading\u2026"),hl());}function Ce(o,t){if(o&1&&(Cs(0,"span",46),JC(1),hl()),o&2){let e=CC().$implicit;sI(),em(e.config.integrationType);}}function be(o,t){if(o&1&&(Ag(0,"input",47),ZI()),o&2){let e=CC().$implicit;xg("formControl",e.toolsControl),QI();}}function xe(o,t){if(o&1){let e=vC();Cs(0,"div",42)(1,"label",43)(2,"input",44),Lg("change",function(){let c=Sf(e).$implicit,g=CC(3);return _f(g.toggleIntegration(c))}),hl(),Cs(3,"span",45),JC(4),hl(),aC(5,Ce,2,1,"span",46),hl(),aC(6,be,1,1,"input",47),hl();}if(o&2){let e=t.$implicit;sI(2),xg("checked",e.enabled()),sI(2),em(e.config.name),sI(),cC(e.config.integrationType?5:-1),sI(),cC(e.enabled()?6:-1);}}function he(o,t){if(o&1&&(Cs(0,"p",53),JC(1),hl()),o&2){let e=CC().$implicit;sI(),Dl(" Restricted to: ",e.restrictedTools.join(", ")," (set outside this form, preserved on save) ");}}function ye(o,t){if(o&1){let e=vC();Cs(0,"div",42)(1,"label",43)(2,"span",45),JC(3),hl(),Cs(4,"span",46),JC(5,"built-in"),hl()(),Cs(6,"select",49),Lg("change",function(c){let g=Sf(e).$implicit,p=CC(4);return _f(p.setBuiltInState(g,c.target.value))}),Cs(7,"option",50),JC(8),hl(),Cs(9,"option",51),JC(10,"Enabled"),hl(),Cs(11,"option",52),JC(12,"Disabled"),hl()(),aC(13,he,2,1,"p",53),Cs(14,"p",54),JC(15),hl()();}if(o&2){let e=t.$implicit,r=CC(4);sI(),Ng("for","built-in-"+e.type),sI(2),em(e.displayName),sI(3),xg("id","built-in-"+e.type)("value",e.state()),sI(2),em(r.builtInDefaultLabel(e)),sI(5),cC(e.state()==="on"&&e.restrictedTools?13:-1),sI(2),em(e.description);}}function ve(o,t){if(o&1&&(Cs(0,"p",48),JC(1,"Built-in integrations"),hl(),dC(2,ye,16,7,"div",42,fe)),o&2){let e=CC(3);sI(2),fC(e.builtInRows());}}function we(o,t){if(o&1&&(Cs(0,"fieldset",20)(1,"legend",25),JC(2,"Integrations"),hl(),Cs(3,"p",41),JC(4," Select which integrations this agent can use. Leave tool names empty to allow all tools from an integration. "),hl(),dC(5,xe,7,4,"div",42,me),aC(7,ve,4,0),hl()),o&2){let e=CC(2);sI(5),fC(e.integrationRows()),sI(2),cC(e.builtInRows().length>0?7:-1);}}function Se(o,t){if(o&1){let e=vC();Cs(0,"li",55),Ag(1,"input",56),ZI(),Cs(2,"button",57),Lg("click",function(){let c=Sf(e).$implicit,g=CC(3);return _f(g.removeSubAgent(c))}),JC(3," \u{1F5D1} "),hl()();}if(o&2){let e=t.$implicit;sI(),xg("formControl",e.control),QI();}}function Ie(o,t){if(o&1&&(Cs(0,"ul",28),dC(1,Se,4,1,"li",55,uC),hl()),o&2){let e=CC(2);sI(),fC(e.subAgentRows());}}function Ae(o,t){if(o&1&&JC(0),o&2){let e=CC(2);tm(" : ",e.defaultDelegationTimeoutSeconds()," s (",e.defaultDelegationTimeoutSeconds()/60," min) ");}}function Ee(o,t){o&1&&(Cs(0,"p",35),JC(1," Enter a valid positive whole number of seconds, or leave empty to inherit the server default. "),hl());}function Me(o,t){if(o&1){let e=vC();Cs(0,"button",58),Lg("click",function(){Sf(e);let c=CC(2);return _f(c.useDefaultDelegationTimeout())}),JC(1," Use server default "),hl();}}function ke(o,t){if(o&1){let e=vC();Cs(0,"button",59),Lg("click",function(){Sf(e);let c=CC(2);return _f(c.exportYaml())}),JC(1),hl();}if(o&2){let e=CC(2);xg("disabled",e.isExporting()),sI(),Dl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Oe(o,t){if(o&1){let e=vC();Cs(0,"form",9),Lg("ngSubmit",function(){Sf(e);let c=CC();return _f(c.submit())}),Cs(1,"div",10)(2,"label",11),JC(3,"Name "),Cs(4,"span",12),JC(5,"*"),hl()(),Ag(6,"input",13),ZI(),hl(),Cs(7,"div",10)(8,"label",14),JC(9,"Description"),hl(),Ag(10,"input",15),ZI(),hl(),Cs(11,"div",10)(12,"label",16),JC(13,"Model name"),hl(),Ag(14,"input",17),ZI(),hl(),Cs(15,"div",10)(16,"label",18),JC(17,"Instructions"),hl(),Ag(18,"textarea",19),ZI(),hl(),aC(19,we,8,1,"fieldset",20),Cs(20,"div",10)(21,"label",21),Ag(22,"input",22),ZI(),Cs(23,"span",23),JC(24,"Advanced mode"),hl()(),Cs(25,"p",24),JC(26," When enabled, this agent uses a multi-step reasoning loop instead of a single LLM call. "),hl()(),Cs(27,"div",10)(28,"label",21),Ag(29,"input",22),ZI(),Cs(30,"span",23),JC(31,"Enabled"),hl()(),Cs(32,"p",24),JC(33,"Disabled agents are excluded from namespace resolution."),hl()(),Cs(34,"div",10)(35,"span",25),JC(36,"Sub-agents"),hl(),Cs(37,"p",26),JC(38," Glob patterns for agents this agent may delegate to. "),Cs(39,"code",27),JC(40,"*"),hl(),JC(41," matches any sequence of characters (e.g.\xA0"),Cs(42,"code",27),JC(43,"*Fixer"),hl(),JC(44,", "),Cs(45,"code",27),JC(46,"*"),hl(),JC(47," for all). Leave empty to disable delegation. "),hl(),aC(48,Ie,3,0,"ul",28),Cs(49,"div",29)(50,"input",30),Lg("keydown.enter",function(){Sf(e);let c=CC();return _f(c.addSubAgent())}),hl(),ZI(),Cs(51,"button",31),Lg("click",function(){Sf(e);let c=CC();return _f(c.addSubAgent())}),JC(52," + "),hl()()(),Cs(53,"div",10)(54,"label",32),JC(55,"Delegation timeout (seconds)"),hl(),Cs(56,"p",33),JC(57," Maximum time for each delegation launched by this agent, including nested delegations. On timeout, the sub-agent and its active descendants are stopped. Leave empty to use the server default "),aC(58,Ae,1,2),JC(59," . "),hl(),Ag(60,"input",34),ZI(),aC(61,Ee,2,0,"p",35),aC(62,Me,2,0,"button",36),hl(),Cs(63,"div",37)(64,"button",38),JC(65),hl(),aC(66,ke,2,2,"button",39),Cs(67,"button",40),Lg("click",function(){Sf(e);let c=CC();return _f(c.cancel())}),JC(68,"Cancel"),hl()()();}if(o&2){let e=CC();xg("formGroup",e.form),sI(6),xg("formControl",e.nameControl),QI(),sI(4),xg("formControl",e.descriptionControl),QI(),sI(4),xg("formControl",e.modelNameControl),QI(),sI(4),xg("formControl",e.instructionsControl),QI(),sI(),cC(e.integrationRows().length>0||e.builtInRows().length>0?19:-1),sI(3),xg("formControl",e.advancedExecutionControl),QI(),sI(7),xg("formControl",e.enabledControl),QI(),sI(19),cC(e.subAgentRows().length>0?48:-1),sI(2),xg("formControl",e.newSubAgentControl),QI(),sI(),xg("disabled",!e.newSubAgentControl.value.trim()),sI(7),cC(e.defaultDelegationTimeoutSeconds()!==null?58:-1),sI(2),xg("formControl",e.delegationTimeoutControl),Ng("aria-invalid",e.delegationTimeoutControl.invalid),QI(),sI(),cC(e.delegationTimeoutControl.invalid?61:-1),sI(),cC(e.delegationTimeoutControl.value!==null?62:-1),sI(2),xg("disabled",e.form.invalid||e.isSubmitting()),sI(),Dl(" ",e.isEditMode()?"Save changes":"Create"," "),sI(),cC(e.isEditMode()?66:-1);}}var de=class o{route=g(V);router=g(G);destroyRef=g(Ce$1);agentConfigController=g(M);defaultsController=g(B);defaultDelegationTimeoutSeconds=Wi(null);exportService=g(W);integrationConfigState=g(N);integrationTypeController=g(N$1);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new z({name:new _t("",{nonNullable:true,validators:[_e$1.required,_e$1.minLength(1)]}),description:new _t(null),modelName:new _t(null),instructions:new _t(null),advancedExecution:new _t(false,{nonNullable:true}),delegationTimeoutSeconds:new _t(null,{validators:[_e$1.min(1),_e$1.max(2147483647),_e$1.pattern(/^\d+$/)]}),enabled:new _t(false,{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get modelNameControl(){return this.form.controls.modelName}get instructionsControl(){return this.form.controls.instructions}get advancedExecutionControl(){return this.form.controls.advancedExecution}get delegationTimeoutControl(){return this.form.controls.delegationTimeoutSeconds}useDefaultDelegationTimeout(){this.delegationTimeoutControl.setValue(null),this.delegationTimeoutControl.markAsDirty();}get enabledControl(){return this.form.controls.enabled}subAgentRows=Wi([]);newSubAgentControl=new _t("",{nonNullable:true});isEditMode=Wi(false);isSubmitting=Wi(false);isLoading=Wi(false);isExporting=Wi(false);builtInRows=Wi([]);inspectRoute(){let t=this.route.snapshot.paramMap.get("agentConfigId")??"";return this.isPlatformMode?["/agentos","admin","agent-configs",t,"inspect"]:["/agentos",this.namespaceId,"agent-configs",t,"inspect"]}integrationRows=Wi([]);existingConfig=null;ngOnInit(){this.defaultsController.getAgentConfigDefaults().pipe(U(this.destroyRef),va(()=>br(null))).subscribe(e=>this.defaultDelegationTimeoutSeconds.set(e?.delegationTimeoutSeconds??null));let t=this.route.snapshot.paramMap.get("agentConfigId");t?(this.isEditMode.set(true),this.loadConfigAndIntegrations(t)):this.loadIntegrations(void 0);}loadConfigAndIntegrations(t){this.isLoading.set(true),Wy({config:this.agentConfigController.getByIdAgentConfig(t),namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):br([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes()}).pipe(U(this.destroyRef)).subscribe({next:({config:e,namespaceIntegrations:r,platformIntegrations:c,builtInTypes:g})=>{this.existingConfig=e,this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.modelNameControl.setValue(e.modelName??null),this.instructionsControl.setValue(e.instructions??null),this.advancedExecutionControl.setValue(e.advancedExecution??false),this.delegationTimeoutControl.setValue(e.delegationTimeoutSeconds??null),this.enabledControl.setValue(e.enabled??true);let p=[...c,...r];this.integrationRows.set(this.buildIntegrationRows(p,e.integrations??void 0)),this.builtInRows.set(this.buildBuiltInRows(g,e.integrations??void 0)),this.subAgentRows.set((e.subAgents??[]).map(P=>({control:new _t(P,{nonNullable:true})}))),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadIntegrations(t){Wy({namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):br([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes()}).pipe(U(this.destroyRef)).subscribe({next:({namespaceIntegrations:e,platformIntegrations:r,builtInTypes:c})=>{let g=[...r,...e];this.integrationRows.set(this.buildIntegrationRows(g,t??void 0)),this.builtInRows.set(this.buildBuiltInRows(c,t??void 0));}});}loadBuiltInTypes(){return this.integrationTypeController.listTypesIntegrationType().pipe(re(t=>t.filter(e=>!e.configSchema)),va(t=>(console.error("[agent-config-form] failed to load integration types",t),br([]))))}buildIntegrationRows(t,e){return t.map(r=>{let c=r.name??"",g=e?.[c],p=e!=null&&c in e,P=Array.isArray(g)?g.join(", "):"";return {config:r,enabled:Wi(p),toolsControl:new _t(P,{nonNullable:true})}})}buildBuiltInRows(t,e){return t.map(r=>{let c=e!=null&&r.type in e,g=e?.[r.type],p=c?Array.isArray(g)&&g.length===0?"off":"on":"default";return {type:r.type,displayName:r.displayName,description:r.description,enabledByDefault:r.enabledByDefault===true,state:Wi(p),restrictedTools:Array.isArray(g)&&g.length>0?g:null}})}toggleIntegration(t){t.enabled.update(e=>!e);}setBuiltInState(t,e){t.state.set(e);}builtInDefaultLabel(t){return t.enabledByDefault?"Platform default (enabled)":"Platform default (disabled)"}addSubAgent(){let t=this.newSubAgentControl.value.trim();t&&(this.subAgentRows.update(e=>[...e,{control:new _t(t,{nonNullable:true})}]),this.newSubAgentControl.reset(""));}removeSubAgent(t){this.subAgentRows.update(e=>e.filter(r=>r!==t));}buildSubAgentsPayload(){let t=this.subAgentRows().map(e=>e.control.value.trim()).filter(e=>e.length>0);return t.length>0?t:void 0}buildIntegrationsPayload(){let t={};for(let r of this.integrationRows().filter(c=>c.enabled())){let c=r.config.name??"",g=r.toolsControl.value.trim();t[c]=g===""?null:g.split(",").map(p=>p.trim()).filter(p=>p.length>0);}for(let r of this.builtInRows()){let c=r.state();c==="on"?t[r.type]=r.restrictedTools??null:c==="off"&&(t[r.type]=[]);}let e=new Set([...this.integrationRows().map(r=>r.config.name??""),...this.builtInRows().map(r=>r.type)]);for(let[r,c]of Object.entries(this.existingConfig?.integrations??{}))e.has(r)||(t[r]=c);return Object.keys(t).length>0?t:void 0}submit(){if(this.form.invalid||this.isSubmitting())return;this.addSubAgent(),this.isSubmitting.set(true);let t=z$1(P({},this.existingConfig??{}),{createdOn:this.existingConfig?.createdOn,updatedOn:this.existingConfig?.updatedOn,namespaceId:this.namespaceId,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,modelName:this.modelNameControl.value?.trim()||void 0,instructions:this.instructionsControl.value?.trim()||void 0,integrations:this.buildIntegrationsPayload(),advancedExecution:this.advancedExecutionControl.value,enabled:this.enabledControl.value,subAgents:this.buildSubAgentsPayload(),delegationTimeoutSeconds:this.delegationTimeoutControl.value});(this.isEditMode()?this.agentConfigController.updateAgentConfig(this.existingConfig.id??"",t):this.agentConfigController.createAgentConfig(t)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}exportYaml(){let t=this.existingConfig?.id;!t||this.isExporting()||(this.isExporting.set(true),this.exportService.exportAsYaml(t).pipe(U(this.destroyRef)).subscribe({next:e=>{let r=new Blob([e],{type:"application/yaml"}),c=URL.createObjectURL(r),g=document.createElement("a");g.href=c,g.download=`${this.existingConfig?.name??"agent"}.yaml`,g.click(),URL.revokeObjectURL(c),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"]);}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=jw({type:o,selectors:[["agentos-agent-config-form"]],decls:12,vars:4,consts:[[1,"agent-config-form"],[1,"agent-config-form__header"],["type","button","title","Back to agent configs",1,"agent-config-form__back",3,"click"],[1,"agent-config-form__back-icon"],[1,"agent-config-form__title"],[1,"agent-config-form__sibling-link",3,"routerLink"],[1,"agent-config-form__platform-badge"],[1,"agent-config-form__loading"],[1,"agent-config-form__form",3,"formGroup"],[1,"agent-config-form__form",3,"ngSubmit","formGroup"],[1,"agent-config-form__field"],["for","agent-config-name",1,"agent-config-form__label"],["aria-hidden","true"],["id","agent-config-name","type","text","placeholder","e.g. Support agent","autocomplete","off",1,"agent-config-form__input",3,"formControl"],["for","agent-config-description",1,"agent-config-form__label"],["id","agent-config-description","type","text","placeholder","Optional \u2014 short description of this agent","autocomplete","off",1,"agent-config-form__input",3,"formControl"],["for","agent-config-model-name",1,"agent-config-form__label"],["id","agent-config-model-name","type","text","placeholder","Optional \u2014 model alias or name to use","autocomplete","off",1,"agent-config-form__input",3,"formControl"],["for","agent-config-instructions",1,"agent-config-form__label"],["id","agent-config-instructions","rows","6","placeholder","Optional \u2014 system instructions for this agent",1,"agent-config-form__textarea",3,"formControl"],[1,"agent-config-form__integrations"],[1,"agent-config-form__toggle-label"],["type","checkbox",1,"agent-config-form__toggle-checkbox",3,"formControl"],[1,"agent-config-form__toggle-text"],[1,"agent-config-form__toggle-hint"],[1,"agent-config-form__label"],[1,"agent-config-form__field-hint"],[1,"agent-config-form__code"],[1,"agent-config-form__sub-agent-list"],[1,"agent-config-form__sub-agent-add"],["type","text","placeholder","e.g. *Fixer or *","autocomplete","off",1,"agent-config-form__input","agent-config-form__sub-agent-input",3,"keydown.enter","formControl"],["type","button","title","Add pattern",1,"agent-config-form__sub-agent-btn","agent-config-form__sub-agent-btn--add",3,"click","disabled"],["for","delegation-timeout",1,"agent-config-form__label"],["id","delegation-timeout-hint",1,"agent-config-form__field-hint"],["id","delegation-timeout","type","number","min","1","max","2147483647","step","1","placeholder","Server default","aria-describedby","delegation-timeout-hint delegation-timeout-error",1,"agent-config-form__input",3,"formControl"],["id","delegation-timeout-error","role","alert",1,"agent-config-form__field-hint"],["type","button",1,"agent-config-form__sub-agent-btn"],[1,"agent-config-form__actions"],["type","submit",1,"agent-config-form__btn","agent-config-form__btn--primary",3,"disabled"],["type","button",1,"agent-config-form__btn","agent-config-form__btn--export",3,"disabled"],["type","button",1,"agent-config-form__btn",3,"click"],[1,"agent-config-form__integrations-hint"],[1,"agent-config-form__integration-row"],[1,"agent-config-form__integration-toggle"],["type","checkbox",1,"agent-config-form__integration-checkbox",3,"change","checked"],[1,"agent-config-form__integration-name"],[1,"agent-config-form__integration-type"],["type","text","placeholder","Tool names, comma-separated (empty = all tools)","autocomplete","off",1,"agent-config-form__input","agent-config-form__integration-tools",3,"formControl"],[1,"agent-config-form__integrations-separator"],[1,"agent-config-form__integration-state",3,"change","id","value"],["value","default"],["value","on"],["value","off"],[1,"agent-config-form__integration-restriction"],[1,"agent-config-form__integration-builtin-desc"],[1,"agent-config-form__sub-agent-row"],["type","text","autocomplete","off",1,"agent-config-form__input","agent-config-form__sub-agent-input",3,"formControl"],["type","button","title","Remove",1,"agent-config-form__sub-agent-btn","agent-config-form__sub-agent-btn--danger",3,"click"],["type","button",1,"agent-config-form__sub-agent-btn",3,"click"],["type","button",1,"agent-config-form__btn","agent-config-form__btn--export",3,"click","disabled"]],template:function(e,r){e&1&&(Cs(0,"div",0)(1,"header",1)(2,"button",2),Lg("click",function(){return r.cancel()}),Cs(3,"span",3),JC(4,"\u2190"),hl(),JC(5," Agent Configs "),hl(),Cs(6,"h1",4),JC(7),hl(),aC(8,ue,2,1,"a",5),aC(9,pe,2,0,"span",6),hl(),aC(10,_e,2,0,"p",7)(11,Oe,69,19,"form",8),hl()),e&2&&(sI(7),em(r.isEditMode()?"Edit agent config":"New agent config"),sI(),cC(r.isEditMode()?8:-1),sI(),cC(r.isPlatformMode?9:-1),sI(),cC(r.isLoading()?10:11));},dependencies:[ni,Jn,Qn,ei,Ye,fn,wt,Zn,Xn,$t,Wt,Cn,En,si],styles:[".agent-config-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.agent-config-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.agent-config-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.agent-config-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.agent-config-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.agent-config-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.agent-config-form__sibling-link[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-accent);text-decoration:none}.agent-config-form__sibling-link[_ngcontent-%COMP%]:hover{text-decoration:underline}.agent-config-form__platform-badge[_ngcontent-%COMP%]{display:inline-block;font-size:.75rem;font-weight:500;color:var(--color-text-secondary);background:var(--color-surface);border:1px solid var(--color-divider);border-radius:0;padding:.125rem .5rem;letter-spacing:.02em;align-self:flex-start}.agent-config-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.agent-config-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.agent-config-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.agent-config-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.agent-config-form__input[_ngcontent-%COMP%], .agent-config-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.agent-config-form__input[_ngcontent-%COMP%]:focus, .agent-config-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.agent-config-form__input[_ngcontent-%COMP%]::placeholder, .agent-config-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.agent-config-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:120px;line-height:1.5}.agent-config-form__integrations[_ngcontent-%COMP%]{border:1px solid var(--color-divider);border-radius:0;padding:1rem;margin:0;display:flex;flex-direction:column;gap:.75rem}.agent-config-form__integrations-hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__integration-row[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.agent-config-form__integration-toggle[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.agent-config-form__integration-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-accent);cursor:pointer}.agent-config-form__integration-name[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text)}.agent-config-form__integration-type[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);font-family:monospace}.agent-config-form__integration-tools[_ngcontent-%COMP%]{margin-left:1.5rem;font-size:.875rem}.agent-config-form__integrations-separator[_ngcontent-%COMP%]{margin:.25rem 0 0;padding-top:.5rem;border-top:1px solid var(--color-divider);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);font-family:var(--font-heading)}.agent-config-form__integration-state[_ngcontent-%COMP%]{margin-left:1.5rem;padding:.375rem .625rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.875rem;font-family:inherit;outline:none;transition:border-color .15s ease}.agent-config-form__integration-state[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.agent-config-form__integration-restriction[_ngcontent-%COMP%]{margin:0 0 0 1.5rem;font-size:.8rem;font-style:italic;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.agent-config-form__integration-builtin-desc[_ngcontent-%COMP%]{margin:0 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__field-hint[_ngcontent-%COMP%]{margin:.25rem 0 0;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__code[_ngcontent-%COMP%]{font-family:monospace;font-size:.85em;background:var(--color-surface-muted, rgba(0, 0, 0, .06));padding:.1em .3em;border-radius:0}.agent-config-form__sub-agent-list[_ngcontent-%COMP%]{list-style:none;margin:.5rem 0 0;padding:0;display:flex;flex-direction:column;gap:.375rem}.agent-config-form__sub-agent-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem}.agent-config-form__sub-agent-input[_ngcontent-%COMP%]{flex:1;min-width:0}.agent-config-form__sub-agent-add[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;margin-top:.5rem}.agent-config-form__sub-agent-btn[_ngcontent-%COMP%]{flex-shrink:0;width:2rem;height:2rem;padding:0;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text-secondary);font-size:.9rem;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .15s ease,border-color .15s ease,color .15s ease}.agent-config-form__sub-agent-btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500);color:var(--color-text)}.agent-config-form__sub-agent-btn[_ngcontent-%COMP%]:disabled{opacity:.35;cursor:not-allowed}.agent-config-form__sub-agent-btn--add[_ngcontent-%COMP%]{width:2rem;height:2rem;font-size:1.25rem;font-weight:300;border-color:var(--color-accent);color:var(--color-accent)}.agent-config-form__sub-agent-btn--add[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent);color:#fff}.agent-config-form__sub-agent-btn--danger[_ngcontent-%COMP%]{border:1px solid transparent;color:var(--color-neutral-500)}.agent-config-form__sub-agent-btn--danger[_ngcontent-%COMP%]:hover:not(:disabled){border-color:var(--red);color:var(--red);background:color-mix(in srgb,var(--red) 10%,transparent)}.agent-config-form__toggle-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.agent-config-form__toggle-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-accent);cursor:pointer}.agent-config-form__toggle-text[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text)}.agent-config-form__toggle-hint[_ngcontent-%COMP%]{margin:.25rem 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.agent-config-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.agent-config-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.agent-config-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.agent-config-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.agent-config-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}"]})};export{de as AgentConfigFormComponent};
@@ -1 +0,0 @@
1
- import {c}from'./chunk-IXLj2Qpp.js';import {g,ao as V,G,C as Ce$1,da as M,db as Pe$1,dc as ve$1,W as Wi,dd as je,F,bR as Sd,T as TT,S as Wy,b as U,a7 as va,X as br,z as z$1,a as P,j as jw,k as Cs,n as Lg,J as JC,m as hl,o as aC,u as sI,a5 as Dl,v as cC,a9 as vC,A as Ag,a3 as ZI,q as dC,ac as CC,x as xg,y as qg,a6 as QI,w as fC,a8 as em,aa as Sf,ab as _f,bk as wh}from'./main-JTU33H5D.js';import {o as z,k as _t,b as _e$1,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,f as fn,a as wt,A as At,Z as Zn,l as Xn,$ as $t,C as Cn,E as En}from'./chunk-DuXr-yGB.js';var A=(n,t)=>t.value,me=(n,t)=>t.id;function pe(n,t){n&1&&(Cs(0,"p",5),JC(1,"Loading\u2026"),hl());}function ue(n,t){n&1&&(Cs(0,"span",12),JC(1," Name is required. "),hl());}function fe(n,t){if(n&1&&(Cs(0,"p",42),JC(1),hl(),Cs(2,"span",13),JC(3,"Agent Config cannot be changed after creation."),hl()),n&2){let e=CC(2);sI(),em(e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function _e(n,t){if(n&1&&(Cs(0,"a",43),JC(1,"Add an agent config"),hl(),JC(2," first. ")),n&2){let e=CC(3);xg("href","/agentos/"+e.namespaceId+"/agent-configs/new",wh);}}function he(n,t){if(n&1&&(Cs(0,"p",13),JC(1," No agent configs available in this scope yet. "),aC(2,_e,3,1),hl()),n&2){let e=CC(2);sI(2),cC(e.isPlatformMode?-1:2);}}function ge(n,t){if(n&1&&(Cs(0,"option",23),JC(1),hl()),n&2){let e=t.$implicit;xg("value",e.id),sI(),em(e.name);}}function Ce(n,t){n&1&&(Cs(0,"span",12),JC(1,"Agent Config is required."),hl());}function ve(n,t){if(n&1&&(Cs(0,"select",44)(1,"option",45),JC(2,"Select an agent config\u2026"),hl(),dC(3,ge,2,2,"option",23,me),hl(),ZI(),aC(5,Ce,2,0,"span",12),Cs(6,"span",13),JC(7,"Immutable after creation."),hl()),n&2){let e=CC(2);xg("formControl",e.agentConfigIdControl),QI(),sI(3),fC(e.availableAgentConfigs()),sI(2),cC(e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?5:-1);}}function xe(n,t){n&1&&(Cs(0,"span",12),JC(1,"Opening message is required."),hl());}function ye(n,t){if(n&1&&(Cs(0,"option",23),JC(1),hl()),n&2){let e=t.$implicit;xg("value",e.value),sI(),em(e.label);}}function be(n,t){if(n&1){let e=vC();Cs(0,"label",48)(1,"input",49),Lg("change",function(){let g=Sf(e).$implicit,v=CC(3);return _f(v.toggleDay(g.value))}),hl(),Cs(2,"span",50),JC(3),hl()();}if(n&2){let e=t.$implicit,d=CC(3);sI(),xg("checked",d.isDaySelected(e.value)),sI(2),em(e.label);}}function Se(n,t){if(n&1&&(Cs(0,"div",8)(1,"span",46),JC(2,"Days of week"),hl(),Cs(3,"div",47),dC(4,be,4,2,"label",48,A),hl(),Cs(6,"span",13),JC(7,"Leave empty to run every day of the week."),hl()()),n&2){let e=CC(2);sI(4),fC(e.dayOptions);}}function Ee(n,t){n&1&&(Cs(0,"span",12),JC(1,"Valid time is required (HH:mm)."),hl());}function Pe(n,t){n&1&&(Cs(0,"span",12),JC(1,"Start date is required."),hl());}function Me(n,t){if(n&1&&(Cs(0,"option",23),JC(1),hl()),n&2){let e=t.$implicit;xg("value",e.value),sI(),em(e.label);}}function Oe(n,t){n&1&&(Cs(0,"span",12),JC(1,"End date is required."),hl());}function De(n,t){if(n&1&&(Cs(0,"div",8)(1,"label",51),JC(2," End date "),Cs(3,"span",10),JC(4,"*"),hl()(),Ag(5,"input",52),ZI(),aC(6,Oe,2,0,"span",12),hl()),n&2){let e=CC(2);sI(5),qg("scheduled-prompt-form__input--invalid",e.form.hasError("endDateRequired")&&e.endDateControl.touched),xg("formControl",e.endDateControl),QI(),sI(),cC(e.form.hasError("endDateRequired")&&e.endDateControl.touched?6:-1);}}function Te(n,t){n&1&&(Cs(0,"span",12),JC(1,"Must be at least 1."),hl());}function we(n,t){if(n&1&&(Cs(0,"div",8)(1,"label",53),JC(2," Number of occurrences "),Cs(3,"span",10),JC(4,"*"),hl()(),Ag(5,"input",54),ZI(),aC(6,Te,2,0,"span",12),hl()),n&2){let e=CC(2);sI(5),qg("scheduled-prompt-form__input--invalid",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched),xg("formControl",e.occurrenceCountControl),QI(),sI(),cC(e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?6:-1);}}function ke(n,t){n&1&&(Cs(0,"span",12),JC(1,"Invalid JSON."),hl());}function Ne(n,t){if(n&1&&(Cs(0,"p",38),JC(1),hl()),n&2){let e=CC(2);sI(),em(e.errorMessage());}}function Fe(n,t){if(n&1){let e=vC();Cs(0,"form",7),Lg("ngSubmit",function(){Sf(e);let g=CC();return _f(g.submit())}),Cs(1,"div",8)(2,"label",9),JC(3," Name "),Cs(4,"span",10),JC(5,"*"),hl()(),Ag(6,"input",11),ZI(),aC(7,ue,2,0,"span",12),Cs(8,"span",13),JC(9,'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.'),hl()(),Cs(10,"div",8)(11,"label",14),JC(12,"Description"),hl(),Ag(13,"input",15),ZI(),hl(),Cs(14,"div",8)(15,"label",16),JC(16," Agent Config "),Cs(17,"span",10),JC(18,"*"),hl()(),aC(19,fe,4,1)(20,he,3,1,"p",13)(21,ve,8,2),hl(),Cs(22,"div",8)(23,"label",17),JC(24," Opening message "),Cs(25,"span",10),JC(26,"*"),hl()(),Ag(27,"textarea",18),ZI(),aC(28,xe,2,0,"span",12),Cs(29,"span",13),JC(30," The message sent to the agent when the scheduled prompt fires. "),hl()(),Cs(31,"fieldset",19)(32,"legend",20),JC(33,"Recurrence"),hl(),Cs(34,"div",8)(35,"label",21),JC(36," Unit "),Cs(37,"span",10),JC(38,"*"),hl()(),Cs(39,"select",22),dC(40,ye,2,2,"option",23,A),hl(),ZI(),hl(),aC(42,Se,8,0,"div",8),Cs(43,"div",8)(44,"label",24),JC(45," Time (UTC) "),Cs(46,"span",10),JC(47,"*"),hl()(),Cs(48,"div",25),Ag(49,"input",26),ZI(),Cs(50,"span",27),JC(51,"UTC"),hl()(),aC(52,Ee,2,0,"span",12),hl()(),Cs(53,"fieldset",19)(54,"legend",20),JC(55,"Planning"),hl(),Cs(56,"div",8)(57,"label",28),JC(58," Start date "),Cs(59,"span",10),JC(60,"*"),hl()(),Ag(61,"input",29),ZI(),aC(62,Pe,2,0,"span",12),hl(),Cs(63,"div",8)(64,"label",30),JC(65," Ends "),Cs(66,"span",10),JC(67,"*"),hl()(),Cs(68,"select",31),dC(69,Me,2,2,"option",23,A),hl(),ZI(),hl(),aC(71,De,7,4,"div",8),aC(72,we,7,4,"div",8),hl(),Cs(73,"div",8)(74,"label",32),Ag(75,"input",33),ZI(),Cs(76,"span",34),JC(77,"Enabled"),hl()(),Cs(78,"p",35),JC(79," When disabled, the scheduled prompt is saved but will not run on schedule. "),hl()(),Cs(80,"div",8)(81,"label",36),JC(82,"External Metadata"),hl(),Ag(83,"textarea",37),ZI(),aC(84,ke,2,0,"span",12),Cs(85,"span",13),JC(86,"Optional. Opaque JSON object stored as-is. Leave empty to clear."),hl()(),aC(87,Ne,2,1,"p",38),Cs(88,"div",39)(89,"button",40),JC(90),hl(),Cs(91,"button",41),Lg("click",function(){Sf(e);let g=CC();return _f(g.cancel())}),JC(92,"Cancel"),hl()()();}if(n&2){let e=CC();xg("formGroup",e.form),sI(6),qg("scheduled-prompt-form__input--invalid",e.nameControl.invalid&&e.nameControl.touched),xg("formControl",e.nameControl),QI(),sI(),cC(e.nameControl.invalid&&e.nameControl.touched?7:-1),sI(6),xg("formControl",e.descriptionControl),QI(),sI(6),cC(e.isEditMode()?19:e.availableAgentConfigs().length===0?20:21),sI(8),qg("scheduled-prompt-form__textarea--invalid",e.promptContentControl.invalid&&e.promptContentControl.touched),xg("formControl",e.promptContentControl),QI(),sI(),cC(e.promptContentControl.invalid&&e.promptContentControl.touched?28:-1),sI(11),xg("formControl",e.unitControl),QI(),sI(),fC(e.schedulerUnits),sI(2),cC(e.showDayFilter()?42:-1),sI(7),xg("formControl",e.timeUtcControl),QI(),sI(3),cC(e.timeUtcControl.invalid&&e.timeUtcControl.touched?52:-1),sI(9),qg("scheduled-prompt-form__input--invalid",e.startDateControl.invalid&&e.startDateControl.touched),xg("formControl",e.startDateControl),QI(),sI(),cC(e.startDateControl.invalid&&e.startDateControl.touched?62:-1),sI(6),xg("formControl",e.endTypeControl),QI(),sI(),fC(e.endTypes),sI(2),cC(e.showEndDate()?71:-1),sI(),cC(e.showOccurrenceCount()?72:-1),sI(3),xg("formControl",e.enabledControl),QI(),sI(8),xg("formControl",e.externalMetadataJsonControl),QI(),sI(),cC(e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?84:-1),sI(3),cC(e.errorMessage()?87:-1),sI(2),xg("disabled",e.form.invalid||e.isSubmitting()),sI(),Dl(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var se=class n{route=g(V);router=g(G);destroyRef=g(Ce$1);state=g(c);agentConfigController=g(M);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new z({name:new _t("",{nonNullable:true,validators:[_e$1.required]}),description:new _t(null),agentConfigId:new _t("",{nonNullable:true,validators:[_e$1.required]}),promptContent:new _t("",{nonNullable:true,validators:[_e$1.required]}),unit:new _t(ve$1.WEEK,{nonNullable:true,validators:[_e$1.required]}),days:new _t([],{nonNullable:true}),timeUtc:new _t("09:00",{nonNullable:true,validators:[_e$1.required,_e$1.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new _t("",{nonNullable:true,validators:[_e$1.required]}),endType:new _t(Pe$1.NEVER,{nonNullable:true,validators:[_e$1.required]}),endDate:new _t(null),occurrenceCount:new _t(null),enabled:new _t(true,{nonNullable:true}),externalMetadataJson:new _t("",{nonNullable:true,validators:[Ae]})},{validators:[Ie,Ve]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}isEditMode=Wi(false);isSubmitting=Wi(false);isLoading=Wi(false);errorMessage=Wi(null);SchedulerUnit=ve$1;SchedulerEndType=Pe$1;schedulerUnits=[{value:ve$1.WEEK,label:"Week(s)"},{value:ve$1.MONTH,label:"Month(s)"}];endTypes=[{value:Pe$1.NEVER,label:"Never"},{value:Pe$1.ON_DATE,label:"On date"},{value:Pe$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(je).map(([t,e])=>({value:t,label:e}));unitSignal=F(this.unitControl.valueChanges.pipe(Sd(this.unitControl.value)));endTypeSignal=F(this.endTypeControl.valueChanges.pipe(Sd(this.endTypeControl.value)));showDayFilter=TT(()=>this.unitSignal()===ve$1.WEEK);showEndDate=TT(()=>this.endTypeSignal()===Pe$1.ON_DATE);showOccurrenceCount=TT(()=>this.endTypeSignal()===Pe$1.OCCURRENCES);agentConfigs=Wi([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Re());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(true),this.loadPromptAndResources(t)):this.loadResources();}loadPromptAndResources(t){this.isLoading.set(true),Wy({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(U(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:d})=>{this.existingPrompt=e,this.agentConfigs.set(d),this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadResources(){this.agentConfigs$().pipe(U(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(va(()=>br([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,d=e.includes(t)?e.filter(g=>g!==t):[...e,t];this.daysControl.setValue(d);}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,d=z$1(P({},this.existingPrompt??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,agentConfigId:t?this.existingPrompt.agentConfigId:this.agentConfigIdControl.value,promptContent:this.promptContentControl.value.trim(),recurrence:{unit:this.unitControl.value,days:this.daysControl.value,timeUtc:this.timeUtcControl.value},planning:{startDate:this.startDateControl.value,endType:e,endDate:e===Pe$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===Pe$1.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value,removed:this.existingPrompt?.removed??false,externalMetadata:(()=>{let v=this.externalMetadataJsonControl.value.trim();return v?JSON.parse(v):null})()});(t?this.state.update(this.existingPrompt.id,d):this.state.create(d)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:v=>{this.isSubmitting.set(false),v.status===409?this.errorMessage.set(`A scheduled prompt named "${d.name}" already exists in this scope.`):v.status===400?this.errorMessage.set(v.error?.message??"Invalid scheduled prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","scheduled-prompts"]):this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=jw({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:10,vars:3,consts:[[1,"scheduled-prompt-form"],[1,"scheduled-prompt-form__header"],["type","button","title","Back to scheduled prompts",1,"scheduled-prompt-form__back",3,"click"],[1,"scheduled-prompt-form__back-icon"],[1,"scheduled-prompt-form__title"],[1,"scheduled-prompt-form__loading"],[1,"scheduled-prompt-form__form",3,"formGroup"],[1,"scheduled-prompt-form__form",3,"ngSubmit","formGroup"],[1,"scheduled-prompt-form__field"],["for","sp-name",1,"scheduled-prompt-form__label"],["aria-hidden","true"],["id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],[1,"scheduled-prompt-form__field-error"],[1,"scheduled-prompt-form__field-hint"],["for","sp-description",1,"scheduled-prompt-form__label"],["id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-agent-config",1,"scheduled-prompt-form__label"],["for","sp-prompt-content",1,"scheduled-prompt-form__label"],["id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",1,"scheduled-prompt-form__textarea",3,"formControl"],[1,"scheduled-prompt-form__fieldset"],[1,"scheduled-prompt-form__legend"],["for","sp-unit",1,"scheduled-prompt-form__label"],["id","sp-unit",1,"scheduled-prompt-form__select",3,"formControl"],[3,"value"],["for","sp-time",1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__time-wrapper"],["id","sp-time","type","time",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--time",3,"formControl"],[1,"scheduled-prompt-form__utc-badge"],["for","sp-start-date",1,"scheduled-prompt-form__label"],["id","sp-start-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-end-type",1,"scheduled-prompt-form__label"],["id","sp-end-type",1,"scheduled-prompt-form__select",3,"formControl"],[1,"scheduled-prompt-form__toggle-label"],["type","checkbox",1,"scheduled-prompt-form__toggle-checkbox",3,"formControl"],[1,"scheduled-prompt-form__toggle-text"],[1,"scheduled-prompt-form__toggle-hint"],["for","sp-external-metadata",1,"scheduled-prompt-form__label"],["id","sp-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",1,"scheduled-prompt-form__textarea","scheduled-prompt-form__textarea--code",3,"formControl"],[1,"scheduled-prompt-form__error"],[1,"scheduled-prompt-form__actions"],["type","submit",1,"scheduled-prompt-form__btn","scheduled-prompt-form__btn--primary",3,"disabled"],["type","button",1,"scheduled-prompt-form__btn",3,"click"],[1,"scheduled-prompt-form__readonly-value"],[3,"href"],["id","sp-agent-config",1,"scheduled-prompt-form__select",3,"formControl"],["value","","disabled",""],[1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__day-grid"],[1,"scheduled-prompt-form__day-label"],["type","checkbox",1,"scheduled-prompt-form__day-checkbox",3,"change","checked"],[1,"scheduled-prompt-form__day-text"],["for","sp-end-date",1,"scheduled-prompt-form__label"],["id","sp-end-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-occurrence-count",1,"scheduled-prompt-form__label"],["id","sp-occurrence-count","type","number","min","1",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--number",3,"formControl"]],template:function(e,d){e&1&&(Cs(0,"div",0)(1,"header",1)(2,"button",2),Lg("click",function(){return d.cancel()}),Cs(3,"span",3),JC(4,"\u2190"),hl(),JC(5),hl(),Cs(6,"h1",4),JC(7),hl()(),aC(8,pe,2,0,"p",5)(9,Fe,93,28,"form",6),hl()),e&2&&(sI(5),Dl(" ",d.isPlatformMode?"Platform Scheduled Prompts":"Scheduled Prompts"," "),sI(2),Dl(" ",d.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"," "),sI(),cC(d.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,fn,wt,At,Zn,Xn,$t,Cn,En],styles:[".scheduled-prompt-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.scheduled-prompt-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.scheduled-prompt-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.scheduled-prompt-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.scheduled-prompt-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.scheduled-prompt-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.scheduled-prompt-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.scheduled-prompt-form__row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.scheduled-prompt-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__input[_ngcontent-%COMP%], .scheduled-prompt-form__select[_ngcontent-%COMP%], .scheduled-prompt-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.scheduled-prompt-form__input[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__select[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.scheduled-prompt-form__input[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__select[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__select[_ngcontent-%COMP%]{cursor:pointer;appearance:auto}.scheduled-prompt-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:100px;line-height:1.5}.scheduled-prompt-form__input--time[_ngcontent-%COMP%]{flex:1;min-width:0}.scheduled-prompt-form__input--number[_ngcontent-%COMP%]{max-width:120px}.scheduled-prompt-form__time-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.scheduled-prompt-form__utc-badge[_ngcontent-%COMP%]{flex-shrink:0;font-size:.75rem;font-weight:600;font-family:monospace;color:var(--color-text-secondary, #6e6e73);background:var(--color-surface, rgba(0, 0, 0, .05));padding:.25rem .5rem;border-radius:4px;text-transform:uppercase;letter-spacing:.06em}.scheduled-prompt-form__fieldset[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:8px;padding:1rem 1.25rem 1.25rem;margin:0;display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__legend[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--color-text-secondary, #6e6e73);padding:0 .375rem}.scheduled-prompt-form__day-grid[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.5rem}.scheduled-prompt-form__day-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__day-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__day-text[_ngcontent-%COMP%]{font-size:.875rem;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__hint[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30);margin:0}.scheduled-prompt-form__field-error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30)}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__readonly-value[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;color:var(--color-text, #1d1d1f);padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--color-surface, rgba(0, 0, 0, .03))}.scheduled-prompt-form__input--invalid[_ngcontent-%COMP%], .scheduled-prompt-form__textarea--invalid[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30)}.scheduled-prompt-form__toggle-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__toggle-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__toggle-text[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__toggle-hint[_ngcontent-%COMP%]{margin:.25rem 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.scheduled-prompt-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"]})};function Ie(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===Pe$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ve(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===Pe$1.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function Ae(n){let t=n.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}function Re(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),d=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${d}`}export{se as ScheduledPromptFormComponent};
@@ -1,182 +0,0 @@
1
- import {an as ue,g,L,ci as me,ap as _d,av as dt$1,j as jw,k as Cs,J as JC,m as hl,ai as sm,aj as iT,n as Lg,a3 as ZI,A as Ag,o as aC,q as dC,u as sI,ak as im,a6 as QI,x as xg,v as cC,w as fC,a5 as Dl,aL as wo,aM as Zn$1,aO as wt$1,az as Xt,aW as C,cj as Pn,ce as kb,c8 as ob,af as bg,ag as ET,c9 as Bf,ck as Vf,ch as kg,t as AC,N as Ng,ad as Wg,b$ as UC,y as qg,H as Hg,M as MC,B as NC,aJ as Tr,aG as fe,cl as be,p as pe,l as le,bU as jd,b9 as T,b8 as B,be as A,b7 as u,bd as h,cm as M,d as O,ba as v,bb as m,c as b,cn as F,f,V,bc as R,co as H,cp as K,ca as _e,Y as x,Z as z$1,_ as Ue,am as Xm,i as Gn,e as pr,a0 as jt,a2 as Nt,a1 as Vt,b0 as tm,ac as CC}from'./main-JTU33H5D.js';import {s as se}from'./chunk-I8YepFsn.js';import {t as ti,Q as Qn,e as ei,Y as Ye$1,h as _n,A as At,m as mn,Z as Zn,c as cn,w as wt}from'./chunk-DuXr-yGB.js';var Xe=["determinateSpinner"];function et(c,e){if(c&1&&(Bf(),Cs(0,"svg",11),Ag(1,"circle",12),hl()),c&2){let t=CC();Ng("viewBox",t._viewBox()),sI(),Wg("stroke-dasharray",t._strokeCircumference(),"px")("stroke-dashoffset",t._strokeCircumference()/2,"px")("stroke-width",t._circleStrokeWidth(),"%"),Ng("r",t._circleRadius());}}var tt=new C("mat-progress-spinner-default-options",{providedIn:"root",factory:()=>({diameter:qe})}),qe=100,nt=10,yt=(()=>{class c{_elementRef=g(Xt);_noopAnimations;get color(){return this._color||this._defaultColor}set color(t){this._color=t;}_color;_defaultColor="primary";_determinateCircle;constructor(){let t=g(tt),n=Pn(),i=this._elementRef.nativeElement;this._noopAnimations=n==="di-disabled"&&!!t&&!t._forceAnimations,this.mode=i.nodeName.toLowerCase()==="mat-spinner"?"indeterminate":"determinate",!this._noopAnimations&&n==="reduced-motion"&&i.classList.add("mat-progress-spinner-reduced-motion"),t&&(t.color&&(this.color=this._defaultColor=t.color),t.diameter&&(this.diameter=t.diameter),t.strokeWidth&&(this.strokeWidth=t.strokeWidth));}mode;get value(){return this.mode==="determinate"?this._value:0}set value(t){this._value=Math.max(0,Math.min(100,t||0));}_value=0;get diameter(){return this._diameter}set diameter(t){this._diameter=t||0;}_diameter=qe;get strokeWidth(){return this._strokeWidth??this.diameter/10}set strokeWidth(t){this._strokeWidth=t||0;}_strokeWidth;_circleRadius(){return (this.diameter-nt)/2}_viewBox(){let t=this._circleRadius()*2+this.strokeWidth;return `0 0 ${t} ${t}`}_strokeCircumference(){return 2*Math.PI*this._circleRadius()}_strokeDashOffset(){return this.mode==="determinate"?this._strokeCircumference()*(100-this._value)/100:null}_circleStrokeWidth(){return this.strokeWidth/this.diameter*100}static \u0275fac=function(n){return new(n||c)};static \u0275cmp=jw({type:c,selectors:[["mat-progress-spinner"],["mat-spinner"]],viewQuery:function(n,i){if(n&1&&Hg(Xe,5),n&2){let o;MC(o=NC())&&(i._determinateCircle=o.first);}},hostAttrs:["role","progressbar","tabindex","-1",1,"mat-mdc-progress-spinner","mdc-circular-progress"],hostVars:18,hostBindings:function(n,i){n&2&&(Ng("aria-valuemin",0)("aria-valuemax",100)("aria-valuenow",i.mode==="determinate"?i.value:null)("mode",i.mode),UC("mat-"+i.color),Wg("width",i.diameter,"px")("height",i.diameter,"px")("--mat-progress-spinner-size",i.diameter+"px")("--mat-progress-spinner-active-indicator-width",i.diameter+"px"),qg("_mat-animation-noopable",i._noopAnimations)("mdc-circular-progress--indeterminate",i.mode==="indeterminate"));},inputs:{color:"color",mode:"mode",value:[2,"value","value",ob],diameter:[2,"diameter","diameter",ob],strokeWidth:[2,"strokeWidth","strokeWidth",ob]},exportAs:["matProgressSpinner"],decls:14,vars:11,consts:[["circle",""],["determinateSpinner",""],["aria-hidden","true",1,"mdc-circular-progress__determinate-container"],["xmlns","http://www.w3.org/2000/svg","focusable","false",1,"mdc-circular-progress__determinate-circle-graphic"],["cx","50%","cy","50%",1,"mdc-circular-progress__determinate-circle"],["aria-hidden","true",1,"mdc-circular-progress__indeterminate-container"],[1,"mdc-circular-progress__spinner-layer"],[1,"mdc-circular-progress__circle-clipper","mdc-circular-progress__circle-left"],[3,"ngTemplateOutlet"],[1,"mdc-circular-progress__gap-patch"],[1,"mdc-circular-progress__circle-clipper","mdc-circular-progress__circle-right"],["xmlns","http://www.w3.org/2000/svg","focusable","false",1,"mdc-circular-progress__indeterminate-circle-graphic"],["cx","50%","cy","50%"]],template:function(n,i){if(n&1&&(bg(0,et,2,8,"ng-template",null,0,ET),Cs(2,"div",2,1),Bf(),Cs(4,"svg",3),Ag(5,"circle",4),hl()(),Vf(),Cs(6,"div",5)(7,"div",6)(8,"div",7),kg(9,8),hl(),Cs(10,"div",9),kg(11,8),hl(),Cs(12,"div",10),kg(13,8),hl()()()),n&2){let o=AC(1);sI(4),Ng("viewBox",i._viewBox()),sI(),Wg("stroke-dasharray",i._strokeCircumference(),"px")("stroke-dashoffset",i._strokeDashOffset(),"px")("stroke-width",i._circleStrokeWidth(),"%"),Ng("r",i._circleRadius()),sI(4),xg("ngTemplateOutlet",o),sI(2),xg("ngTemplateOutlet",o),sI(2),xg("ngTemplateOutlet",o);}},dependencies:[kb],styles:[`.mat-mdc-progress-spinner {
2
- --mat-progress-spinner-animation-multiplier: 1;
3
- display: block;
4
- overflow: hidden;
5
- line-height: 0;
6
- position: relative;
7
- direction: ltr;
8
- transition: opacity 250ms cubic-bezier(0.4, 0, 0.6, 1);
9
- }
10
- .mat-mdc-progress-spinner circle {
11
- stroke-width: var(--mat-progress-spinner-active-indicator-width, 4px);
12
- }
13
- .mat-mdc-progress-spinner._mat-animation-noopable, .mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__determinate-circle {
14
- transition: none !important;
15
- }
16
- .mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__indeterminate-circle-graphic,
17
- .mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__spinner-layer,
18
- .mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__indeterminate-container {
19
- animation: none !important;
20
- }
21
- .mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__indeterminate-container circle {
22
- stroke-dasharray: 0 !important;
23
- }
24
- @media (forced-colors: active) {
25
- .mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic,
26
- .mat-mdc-progress-spinner .mdc-circular-progress__determinate-circle {
27
- stroke: currentColor;
28
- stroke: CanvasText;
29
- }
30
- }
31
-
32
- .mat-progress-spinner-reduced-motion {
33
- --mat-progress-spinner-animation-multiplier: 1.25;
34
- }
35
-
36
- .mdc-circular-progress__determinate-container,
37
- .mdc-circular-progress__indeterminate-circle-graphic,
38
- .mdc-circular-progress__indeterminate-container,
39
- .mdc-circular-progress__spinner-layer {
40
- position: absolute;
41
- width: 100%;
42
- height: 100%;
43
- }
44
-
45
- .mdc-circular-progress__determinate-container {
46
- transform: rotate(-90deg);
47
- }
48
- .mdc-circular-progress--indeterminate .mdc-circular-progress__determinate-container {
49
- opacity: 0;
50
- }
51
-
52
- .mdc-circular-progress__indeterminate-container {
53
- font-size: 0;
54
- letter-spacing: 0;
55
- white-space: nowrap;
56
- opacity: 0;
57
- }
58
- .mdc-circular-progress--indeterminate .mdc-circular-progress__indeterminate-container {
59
- opacity: 1;
60
- animation: mdc-circular-progress-container-rotate calc(1568.2352941176ms * var(--mat-progress-spinner-animation-multiplier)) linear infinite;
61
- }
62
-
63
- .mdc-circular-progress__determinate-circle-graphic,
64
- .mdc-circular-progress__indeterminate-circle-graphic {
65
- fill: transparent;
66
- }
67
-
68
- .mat-mdc-progress-spinner .mdc-circular-progress__determinate-circle,
69
- .mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic {
70
- stroke: var(--mat-progress-spinner-active-indicator-color, var(--mat-sys-primary));
71
- }
72
- @media (forced-colors: active) {
73
- .mat-mdc-progress-spinner .mdc-circular-progress__determinate-circle,
74
- .mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic {
75
- stroke: CanvasText;
76
- }
77
- }
78
-
79
- .mdc-circular-progress__determinate-circle {
80
- transition: stroke-dashoffset 500ms cubic-bezier(0, 0, 0.2, 1);
81
- }
82
-
83
- .mdc-circular-progress__gap-patch {
84
- position: absolute;
85
- top: 0;
86
- left: 47.5%;
87
- box-sizing: border-box;
88
- width: 5%;
89
- height: 100%;
90
- overflow: hidden;
91
- }
92
-
93
- .mdc-circular-progress__gap-patch .mdc-circular-progress__indeterminate-circle-graphic {
94
- left: -900%;
95
- width: 2000%;
96
- transform: rotate(180deg);
97
- }
98
- .mdc-circular-progress__circle-clipper .mdc-circular-progress__indeterminate-circle-graphic {
99
- width: 200%;
100
- }
101
- .mdc-circular-progress__circle-right .mdc-circular-progress__indeterminate-circle-graphic {
102
- left: -100%;
103
- }
104
- .mdc-circular-progress--indeterminate .mdc-circular-progress__circle-left .mdc-circular-progress__indeterminate-circle-graphic {
105
- animation: mdc-circular-progress-left-spin calc(1333ms * var(--mat-progress-spinner-animation-multiplier)) cubic-bezier(0.4, 0, 0.2, 1) infinite both;
106
- }
107
- .mdc-circular-progress--indeterminate .mdc-circular-progress__circle-right .mdc-circular-progress__indeterminate-circle-graphic {
108
- animation: mdc-circular-progress-right-spin calc(1333ms * var(--mat-progress-spinner-animation-multiplier)) cubic-bezier(0.4, 0, 0.2, 1) infinite both;
109
- }
110
-
111
- .mdc-circular-progress__circle-clipper {
112
- display: inline-flex;
113
- position: relative;
114
- width: 50%;
115
- height: 100%;
116
- overflow: hidden;
117
- }
118
-
119
- .mdc-circular-progress--indeterminate .mdc-circular-progress__spinner-layer {
120
- animation: mdc-circular-progress-spinner-layer-rotate calc(5332ms * var(--mat-progress-spinner-animation-multiplier)) cubic-bezier(0.4, 0, 0.2, 1) infinite both;
121
- }
122
-
123
- @keyframes mdc-circular-progress-container-rotate {
124
- to {
125
- transform: rotate(360deg);
126
- }
127
- }
128
- @keyframes mdc-circular-progress-spinner-layer-rotate {
129
- 12.5% {
130
- transform: rotate(135deg);
131
- }
132
- 25% {
133
- transform: rotate(270deg);
134
- }
135
- 37.5% {
136
- transform: rotate(405deg);
137
- }
138
- 50% {
139
- transform: rotate(540deg);
140
- }
141
- 62.5% {
142
- transform: rotate(675deg);
143
- }
144
- 75% {
145
- transform: rotate(810deg);
146
- }
147
- 87.5% {
148
- transform: rotate(945deg);
149
- }
150
- 100% {
151
- transform: rotate(1080deg);
152
- }
153
- }
154
- @keyframes mdc-circular-progress-left-spin {
155
- from {
156
- transform: rotate(265deg);
157
- }
158
- 50% {
159
- transform: rotate(130deg);
160
- }
161
- to {
162
- transform: rotate(265deg);
163
- }
164
- }
165
- @keyframes mdc-circular-progress-right-spin {
166
- from {
167
- transform: rotate(-265deg);
168
- }
169
- 50% {
170
- transform: rotate(-130deg);
171
- }
172
- to {
173
- transform: rotate(-265deg);
174
- }
175
- }
176
- `],encapsulation:2})}return c})();var Et=(()=>{class c{static \u0275fac=function(n){return new(n||c)};static \u0275mod=wo({type:c});static \u0275inj=Zn$1({imports:[wt$1]})}return c})();var z=class c{destroy$=new ue;voices;currentUtterance=null;currentOnEndCallback=null;speakingSubject=new Tr(false);speaking$=this.speakingSubject.asObservable();volume=.8;rate=1.2;language="en-US";selectedVoice;preferencesService=g(L);constructor(){this.initializeSpeechSynthesis(),this.subscribeToPreferences();}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),this.stopSpeech();}initializeSpeechSynthesis(){if(!("speechSynthesis"in window)){console.warn("[VOICE-SERVICE] Speech synthesis not available"),this.voices=new Promise(e=>e([]));return}this.voices=new Promise((e,t)=>{let n=speechSynthesis.getVoices();if(n.length)e(n);else {let i=setTimeout(()=>{t("no voices found");},2e3);speechSynthesis.addEventListener("voiceschanged",()=>{let o=speechSynthesis.getVoices();o.length&&(clearTimeout(i),e(o));});}}),console.log("[VOICE-SERVICE] Speech synthesis initialized");}subscribeToPreferences(){this.preferencesService.voiceVolume$.pipe(_d(this.destroy$)).subscribe(e=>{this.volume=e,console.log("[VOICE-SERVICE] Volume updated to:",e);}),this.preferencesService.voiceRate$.pipe(_d(this.destroy$)).subscribe(e=>{this.rate=e,console.log("[VOICE-SERVICE] Rate updated to:",e);}),this.preferencesService.voiceLanguage$.pipe(_d(this.destroy$)).subscribe(e=>{this.language=e,console.log("[VOICE-SERVICE] Language updated to:",e),this.updateSelectedVoiceForLanguage();}),this.preferencesService.selectedVoice$.pipe(_d(this.destroy$)).subscribe(e=>{this.setSelectedVoice(e);}),this.volume=this.preferencesService.getVoiceVolume(),this.rate=this.preferencesService.getVoiceRate(),this.language=this.preferencesService.getVoiceLanguage(),this.setSelectedVoice(this.preferencesService.getSelectedVoice());}isReady(){return "speechSynthesis"in window&&this.selectedVoice!==void 0}isSpeaking(){return speechSynthesis.speaking}speak(e,t){return dt$1(this,null,function*(){if(!this.selectedVoice)return console.warn("[VOICE-SERVICE] No voice selected"),false;if(!e.trim())return console.warn("[VOICE-SERVICE] No text to speak"),false;let n=this.extractPlainText(e);if(!n.trim())return console.warn("[VOICE-SERVICE] No text to speak after markdown cleaning"),false;this.stopSpeech();try{let i=new SpeechSynthesisUtterance(n);i.voice=this.selectedVoice,i.lang=this.selectedVoice.lang,i.volume=this.volume,i.rate=this.rate,this.currentOnEndCallback=t||null,t&&(i.onend=()=>{this.currentOnEndCallback===t&&(this.currentOnEndCallback=null,t());},i.onerror=()=>{this.currentOnEndCallback===t&&(this.currentOnEndCallback=null,t());}),this.currentUtterance=i,this.speakingSubject.next(!0);let o=i.onend,E=i.onerror;return i.onend=C=>{this.speakingSubject.next(!1),o&&o.call(i,C);},i.onerror=C=>{this.speakingSubject.next(!1),E&&E.call(i,C);},speechSynthesis.speak(i),console.log("[VOICE-SERVICE] Started speaking:",e.substring(0,50)+"..."),!0}catch(i){return console.error("[VOICE-SERVICE] Error speaking:",i),false}})}stopSpeech(){if(this.currentUtterance||speechSynthesis.speaking){if(speechSynthesis.cancel(),this.currentUtterance=null,this.currentOnEndCallback){let e=this.currentOnEndCallback;this.currentOnEndCallback=null,e();}this.speakingSubject.next(false),console.log("[VOICE-SERVICE] Speech stopped");}}ding(){try{let e=new(window.AudioContext||window.webkitAudioContext),t=e.createOscillator(),n=e.createGain();t.connect(n),n.connect(e.destination),t.frequency.setValueAtTime(800,e.currentTime),n.gain.setValueAtTime(.1,e.currentTime),n.gain.exponentialRampToValueAtTime(.01,e.currentTime+.1),t.start(e.currentTime),t.stop(e.currentTime+.1),console.log("[VOICE-SERVICE] Notification sound played");}catch(e){console.error("[VOICE-SERVICE] Notification sound failed:",e);}}getVoicesForLanguage(){return dt$1(this,null,function*(){try{let e=this.language.slice(0,2),t=yield this.voices;if(!t||t.length===0)return console.warn("[VOICE-SERVICE] No voices available on system"),[];let n=t.filter(i=>i.lang.toLowerCase().startsWith(e)).sort((i,o)=>i.localService&&!o.localService?-1:!i.localService&&o.localService?1:i.name.localeCompare(o.name));return console.log("[VOICE-SERVICE] Found matching voices:",n.length,"for language:",e),n.map(i=>({name:i.name,lang:i.lang,localService:i.localService,default:i.default,displayName:this.formatVoiceDisplayName(i)}))}catch(e){return console.error("[VOICE-SERVICE] Error getting voices for language:",e),[]}})}formatVoiceDisplayName(e){let t=e.localService?"\u{1F3E0}":"\u2601\uFE0F",n=e.default?" \u2B50":"";return `${t} ${e.name} (${e.lang})${n}`}setSelectedVoice(e){return dt$1(this,null,function*(){if(!e){this.selectedVoice=void 0;return}let[t,n]=e.split("|");if(!t||!n){this.selectedVoice=void 0;return}let i=(yield this.voices)?.find(o=>o.name===t&&o.lang===n);i?(this.selectedVoice=i,console.log("[VOICE-SERVICE] Selected voice:",i.name,i.lang)):(this.selectedVoice=void 0,console.warn("[VOICE-SERVICE] Voice not found:",t,n));})}updateSelectedVoiceForLanguage(){return dt$1(this,null,function*(){let e=yield this.getVoicesForLanguage();if(e.length===0){console.warn("[VOICE-SERVICE] No voices available for language:",this.language),this.selectedVoice=void 0,this.preferencesService.setSelectedVoice(null);return}let t=this.preferencesService.getSelectedVoice();if(t){let[i,o]=t.split("|"),E=o?.slice(0,2),C=this.language.slice(0,2);if(E===C&&e.some(q=>q.name===i&&q.lang===o)){console.log("[VOICE-SERVICE] Keeping current voice for language:",t);return}}let n=e[0];if(n){let i=`${n.name}|${n.lang}`;this.preferencesService.setSelectedVoice(i),console.log("[VOICE-SERVICE] Auto-selected voice for language change:",n.displayName);}})}testSelectedVoice(){setTimeout(()=>{if(!this.selectedVoice){console.log("[VOICE-SERVICE] No voice selected for test");return}this.stopSpeech();let e=this.getTestText();e&&this.speak(e);},100);}getTestText(){let e=this.language.slice(0,2),t={fr:"Bonjour, ceci est un test de la voix s\xE9lectionn\xE9e.",en:"Hello, this is a test of the selected voice.",es:"Hola, esta es una prueba de la voz seleccionada.",de:"Hallo, dies ist ein Test der ausgew\xE4hlten Stimme.",it:"Ciao, questo \xE8 un test della voce selezionata.",pt:"Ol\xE1, este \xE9 um teste da voz selecionada.",ja:"\u3053\u3093\u306B\u3061\u306F\u3001\u3053\u308C\u306F\u9078\u629E\u3055\u308C\u305F\u97F3\u58F0\u306E\u30C6\u30B9\u30C8\u3067\u3059\u3002",ko:"\uC548\uB155\uD558\uC138\uC694, \uC774\uAC83\uC740 \uC120\uD0DD\uB41C \uC74C\uC131\uC758 \uD14C\uC2A4\uD2B8\uC785\uB2C8\uB2E4.",zh:"\u4F60\u597D\uFF0C\u8FD9\u662F\u6240\u9009\u8BED\u97F3\u7684\u6D4B\u8BD5\u3002",ru:"\u041F\u0440\u0438\u0432\u0435\u0442, \u044D\u0442\u043E \u0442\u0435\u0441\u0442 \u0432\u044B\u0431\u0440\u0430\u043D\u043D\u043E\u0433\u043E \u0433\u043E\u043B\u043E\u0441\u0430.",ar:"\u0645\u0631\u062D\u0628\u0627\u060C \u0647\u0630\u0627 \u0627\u062E\u062A\u0628\u0627\u0631 \u0644\u0644\u0635\u0648\u062A \u0627\u0644\u0645\u062D\u062F\u062F."};return t[e]||t.en}extractPlainText(e){let t=e.replace(/[\u{1F600}-\u{1F64F}]|[\u{1F300}-\u{1F5FF}]|[\u{1F680}-\u{1F6FF}]|[\u{1F1E0}-\u{1F1FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]|⭐/gu,"").replace(/```[\s\S]*?```/g,"code block").replace(/`([^`]+)`/g,"$1").replace(/\*\*\*(.*?)\*\*\*/g,"$1").replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/~~(.*?)~~/g,"$1").replace(/#{1,6}\s*(.*)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/https?:\/\/[^\s]+/g,"link").replace(/&nbsp;/g," ").replace(/&amp;/g,"and").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"');return t=this.addNaturalPunctuation(t),t.replace(/\s+/g," ").trim()}addNaturalPunctuation(e){return e.replace(/\n+/g,`
177
- `).split(`
178
- `).map(t=>this.addPeriodIfNeeded(t.trim())).filter(t=>t.length>0).join(" ")}addPeriodIfNeeded(e){return e?/[.!?;:]$/.test(e)?e:e+".":""}static \u0275fac=function(t){return new(t||c)};static \u0275prov=x({token:c,factory:c.\u0275fac,providedIn:"root"})};var rt=(c,e)=>e.code,at=(c,e)=>e.name+e.lang;function st(c,e){c&1&&(Cs(0,"div",17)(1,"mat-icon",39),JC(2,"warning"),hl(),Cs(3,"span",40),JC(4," Browser notifications have been blocked. To enable them, please reset the site permissions in your browser settings. "),hl()());}function ct(c,e){if(c&1&&(Cs(0,"option",25),JC(1),hl()),c&2){let t=e.$implicit;xg("value",t.code),sI(),tm("",t.flag," ",t.label);}}function lt(c,e){c&1&&(Cs(0,"option",32),JC(1,"Loading voices..."),hl());}function dt(c,e){c&1&&(Cs(0,"option",32),JC(1,"No voice available"),hl());}function pt(c,e){if(c&1&&(Cs(0,"option",25),JC(1),hl()),c&2){let t=e.$implicit;xg("value",t.name+"|"+t.lang),sI(),Dl(" ",t.displayName," ");}}var Ye=class c{destroy$=new ue;selectedTheme="light";selectedThemeVariant="industry";selectedVoiceLanguage="en-US";useEnterToSend=false;printTechnicalMessages=false;showTechnicalMessages=true;showWarningMessages=true;voiceInputMode="browser";voiceAnnounceEnabled=false;voiceMode="speech";voiceReadFullText=false;voiceVolume=80;voiceRate=120;agentNotificationEnabled=false;notificationSoundEnabled=true;browserNotificationEnabled=false;browserNotificationDenied=false;missionPreviewEnabled=false;availableVoices=[];selectedVoiceId=null;loadingVoices=false;voiceLanguageOptions=[{code:"fr-FR",label:"Fran\xE7ais",flag:"\u{1F1EB}\u{1F1F7}"},{code:"en-US",label:"English (US)",flag:"\u{1F1FA}\u{1F1F8}"},{code:"en-GB",label:"English (UK)",flag:"\u{1F1EC}\u{1F1E7}"},{code:"es-ES",label:"Espa\xF1ol",flag:"\u{1F1EA}\u{1F1F8}"},{code:"de-DE",label:"Deutsch",flag:"\u{1F1E9}\u{1F1EA}"},{code:"it-IT",label:"Italiano",flag:"\u{1F1EE}\u{1F1F9}"},{code:"pt-BR",label:"Portugu\xEAs",flag:"\u{1F1E7}\u{1F1F7}"},{code:"ja-JP",label:"\u65E5\u672C\u8A9E",flag:"\u{1F1EF}\u{1F1F5}"},{code:"ko-KR",label:"\uD55C\uAD6D\uC5B4",flag:"\u{1F1F0}\u{1F1F7}"},{code:"zh-CN",label:"\u4E2D\u6587 (\u7B80\u4F53)",flag:"\u{1F1E8}\u{1F1F3}"},{code:"ru-RU",label:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439",flag:"\u{1F1F7}\u{1F1FA}"},{code:"ar-SA",label:"\u0627\u0644\u0639\u0631\u0628\u064A\u0629",flag:"\u{1F1F8}\u{1F1E6}"}];preferencesService=g(L);voiceSynthesisService=g(z);themeService=g(me);ngOnInit(){let e=this.themeService.getCurrentTheme();this.selectedTheme=e.mode,this.selectedThemeVariant=e.variant,this.selectedVoiceLanguage=this.preferencesService.getVoiceLanguage(),this.useEnterToSend=this.preferencesService.getEnterToSend(),this.printTechnicalMessages=this.preferencesService.getPrintTechnicalMessages(),this.showTechnicalMessages=!this.preferencesService.getHideTechnicalMessages(),this.showWarningMessages=!this.preferencesService.getHideWarningMessages(),this.voiceInputMode=this.preferencesService.getVoiceInputMode(),this.voiceAnnounceEnabled=this.preferencesService.getVoiceAnnounceEnabled(),this.voiceMode=this.preferencesService.getVoiceMode(),this.voiceReadFullText=this.preferencesService.getVoiceReadFullText(),this.voiceVolume=Math.round(this.preferencesService.getVoiceVolume()*100),this.voiceRate=Math.round(this.preferencesService.getVoiceRate()*100),this.selectedVoiceId=this.preferencesService.getSelectedVoice(),this.agentNotificationEnabled=this.preferencesService.getAgentNotificationEnabled(),this.notificationSoundEnabled=this.preferencesService.getNotificationSoundEnabled(),this.browserNotificationEnabled=this.preferencesService.getBrowserNotificationEnabled(),this.missionPreviewEnabled=this.preferencesService.getMissionPreviewEnabled(),this.loadAvailableVoices(),this.themeService.currentTheme$.pipe(_d(this.destroy$)).subscribe(t=>{this.selectedTheme=t.mode,this.selectedThemeVariant=t.variant;}),this.preferencesService.voiceLanguage$.pipe(_d(this.destroy$)).subscribe(t=>{this.selectedVoiceLanguage=t;}),this.preferencesService.enterToSend$.pipe(_d(this.destroy$)).subscribe(t=>{this.useEnterToSend=t;}),this.preferencesService.printTechnicalMessages$.pipe(_d(this.destroy$)).subscribe(t=>{this.printTechnicalMessages=t;}),this.preferencesService.hideTechnicalMessages$.pipe(_d(this.destroy$)).subscribe(t=>{this.showTechnicalMessages=!t;}),this.preferencesService.hideWarningMessages$.pipe(_d(this.destroy$)).subscribe(t=>{this.showWarningMessages=!t;}),this.preferencesService.voiceInputMode$.pipe(_d(this.destroy$)).subscribe(t=>{this.voiceInputMode=t;}),this.preferencesService.voiceAnnounceEnabled$.pipe(_d(this.destroy$)).subscribe(t=>{this.voiceAnnounceEnabled=t;}),this.preferencesService.voiceMode$.pipe(_d(this.destroy$)).subscribe(t=>{this.voiceMode=t;}),this.preferencesService.voiceReadFullText$.pipe(_d(this.destroy$)).subscribe(t=>{this.voiceReadFullText=t;}),this.preferencesService.voiceVolume$.pipe(_d(this.destroy$)).subscribe(t=>{this.voiceVolume=Math.round(t*100);}),this.preferencesService.voiceRate$.pipe(_d(this.destroy$)).subscribe(t=>{this.voiceRate=Math.round(t*100);}),this.preferencesService.selectedVoice$.pipe(_d(this.destroy$)).subscribe(t=>{this.selectedVoiceId=t;}),this.preferencesService.voiceLanguage$.pipe(_d(this.destroy$)).subscribe(()=>{this.loadAvailableVoices();}),this.preferencesService.agentNotificationEnabled$.pipe(_d(this.destroy$)).subscribe(t=>{this.agentNotificationEnabled=t;}),this.preferencesService.notificationSoundEnabled$.pipe(_d(this.destroy$)).subscribe(t=>{this.notificationSoundEnabled=t;}),this.preferencesService.browserNotificationEnabled$.pipe(_d(this.destroy$)).subscribe(t=>{this.browserNotificationEnabled=t,this.checkNotificationPermission();}),this.preferencesService.missionPreviewEnabled$.pipe(_d(this.destroy$)).subscribe(t=>{this.missionPreviewEnabled=t;});}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete();}onThemeChange(){console.log("[OPTIONS] Theme changed to:",this.selectedTheme),this.themeService.setTheme({variant:this.selectedThemeVariant,mode:this.selectedTheme});}onVoiceLanguageChange(){console.log("[OPTIONS] Voice language changed to:",this.selectedVoiceLanguage),this.preferencesService.setVoiceLanguage(this.selectedVoiceLanguage);}onEnterToSendChange(){console.log("[OPTIONS] Enter to send changed to:",this.useEnterToSend),this.preferencesService.setEnterToSend(this.useEnterToSend);}onPrintTechnicalMessagesChange(){console.log("[OPTIONS] Print technical messages changed to:",this.printTechnicalMessages),this.preferencesService.setPrintTechnicalMessages(this.printTechnicalMessages);}onShowTechnicalMessagesChange(){let e=!this.showTechnicalMessages;console.log("[OPTIONS] Show technical messages changed to:",this.showTechnicalMessages,"(hide:",e,")"),this.preferencesService.setHideTechnicalMessages(e);}onShowWarningMessagesChange(){let e=!this.showWarningMessages;console.log("[OPTIONS] Show warning messages changed to:",this.showWarningMessages,"(hide:",e,")"),this.preferencesService.setHideWarningMessages(e);}onVoiceInputModeChange(e){let t=e.target.value;console.log("[OPTIONS] Voice input mode changed to:",t),this.preferencesService.setVoiceInputMode(t);}onVoiceAnnounceEnabledChange(){console.log("[OPTIONS] Voice announce enabled changed to:",this.voiceAnnounceEnabled),this.preferencesService.setVoiceAnnounceEnabled(this.voiceAnnounceEnabled);}onVoiceModeChange(){console.log("[OPTIONS] Voice mode changed to:",this.voiceMode),this.preferencesService.setVoiceMode(this.voiceMode);}onVoiceReadFullTextChange(){console.log("[OPTIONS] Voice read full text changed to:",this.voiceReadFullText),this.preferencesService.setVoiceReadFullText(this.voiceReadFullText);}onVoiceVolumeChange(){let e=this.voiceVolume/100;console.log("[OPTIONS] Voice volume changed to:",e),this.preferencesService.setVoiceVolume(e);}onVoiceRateChange(){let e=this.voiceRate/100;console.log("[OPTIONS] Voice rate changed to:",e),this.preferencesService.setVoiceRate(e);}loadAvailableVoices(){return dt$1(this,null,function*(){this.loadingVoices=true;try{this.availableVoices=yield this.voiceSynthesisService.getVoicesForLanguage(),console.log("[OPTIONS] Loaded",this.availableVoices.length,"voices for current language");}catch(e){console.error("[OPTIONS] Error loading voices:",e),this.availableVoices=[];}finally{this.loadingVoices=false;}})}onSelectedVoiceChange(){console.log("[OPTIONS] Selected voice changed to:",this.selectedVoiceId),this.preferencesService.setSelectedVoice(this.selectedVoiceId);}testVoice(){console.log("[OPTIONS] Testing voice with current settings"),this.voiceSynthesisService.testSelectedVoice();}onAgentNotificationEnabledChange(){console.log("[OPTIONS] Agent notification enabled changed to:",this.agentNotificationEnabled),this.preferencesService.setAgentNotificationEnabled(this.agentNotificationEnabled);}onNotificationSoundEnabledChange(){console.log("[OPTIONS] Notification sound enabled changed to:",this.notificationSoundEnabled),this.preferencesService.setNotificationSoundEnabled(this.notificationSoundEnabled);}onBrowserNotificationEnabledChange(){console.log("[OPTIONS] Browser notification enabled changed to:",this.browserNotificationEnabled),this.preferencesService.setBrowserNotificationEnabled(this.browserNotificationEnabled);}onMissionPreviewEnabledChange(){console.log("[OPTIONS] Mission preview panel enabled changed to:",this.missionPreviewEnabled),this.preferencesService.setMissionPreviewEnabled(this.missionPreviewEnabled);}checkNotificationPermission(){"Notification"in window&&(this.browserNotificationDenied=Notification.permission==="denied",console.log("[OPTIONS] Notification permission status:",Notification.permission));}static \u0275fac=function(t){return new(t||c)};static \u0275cmp=jw({type:c,selectors:[["app-options-panel"]],decls:168,vars:37,consts:[[1,"options-content"],[1,"option-section"],[1,"section-title"],[1,"option-group"],[1,"radio-group"],[1,"option-radio"],["type","radio","name","theme","value","light",3,"ngModelChange","change","ngModel"],[1,"radio-mark"],["type","radio","name","theme","value","dark",3,"ngModelChange","change","ngModel"],["type","radio","name","theme","value","system",3,"ngModelChange","change","ngModel"],[1,"option-label"],["type","radio","name","enterBehavior",3,"ngModelChange","change","value","ngModel"],[1,"toggle-option"],["color","primary",3,"ngModelChange","change","ngModel"],[1,"option-label-with-hint"],[1,"option-hint"],["color","primary",3,"ngModelChange","change","ngModel","disabled"],[1,"notification-error"],["for","voice-input-mode-select",1,"option-label"],["id","voice-input-mode-select",1,"option-select",3,"change","value"],["value","browser"],["value","whisper"],["value","voice-message"],["for","voice-language-select",1,"option-label"],["id","voice-language-select",1,"option-select",3,"ngModelChange","change","ngModel"],[3,"value"],["type","radio","name","voiceAnnounce",3,"ngModelChange","change","value","ngModel"],["type","radio","name","voiceMode","value","speech",3,"ngModelChange","change","ngModel"],["type","radio","name","voiceMode","value","notification",3,"ngModelChange","change","ngModel"],["type","radio","name","voiceReadFull",3,"ngModelChange","change","value","ngModel"],["for","voice-select",1,"option-label"],["id","voice-select",1,"option-select",3,"ngModelChange","change","ngModel","disabled"],["value",""],["role","button","tabindex","0","title","Test voice with current settings",1,"test-voice-link",3,"click"],[1,"thread-name"],["for","voice-volume-slider",1,"option-label"],["id","voice-volume-slider","type","range","min","0","max","100","step","5",1,"option-slider",3,"ngModelChange","input","ngModel"],["for","voice-rate-slider",1,"option-label"],["id","voice-rate-slider","type","range","min","50","max","200","step","10",1,"option-slider",3,"ngModelChange","input","ngModel"],[1,"error-icon"],[1,"error-message"]],template:function(t,n){t&1&&(Cs(0,"div",0)(1,"div",1)(2,"div",2)(3,"mat-icon"),JC(4,"palette"),hl(),Cs(5,"span"),JC(6,"Appearance"),hl()(),Cs(7,"div",3)(8,"div",4)(9,"label",5)(10,"input",6),sm("ngModelChange",function(o){return iT(n.selectedTheme,o)||(n.selectedTheme=o),o}),Lg("change",function(){return n.onThemeChange()}),hl(),ZI(),Ag(11,"span",7),JC(12," Light "),hl(),Cs(13,"label",5)(14,"input",8),sm("ngModelChange",function(o){return iT(n.selectedTheme,o)||(n.selectedTheme=o),o}),Lg("change",function(){return n.onThemeChange()}),hl(),ZI(),Ag(15,"span",7),JC(16," Dark "),hl(),Cs(17,"label",5)(18,"input",9),sm("ngModelChange",function(o){return iT(n.selectedTheme,o)||(n.selectedTheme=o),o}),Lg("change",function(){return n.onThemeChange()}),hl(),ZI(),Ag(19,"span",7),JC(20," System "),hl()()()(),Cs(21,"div",1)(22,"div",2)(23,"mat-icon"),JC(24,"chat_bubble_outline"),hl(),Cs(25,"span"),JC(26,"Messaging"),hl()(),Cs(27,"div",3)(28,"span",10),JC(29,"Send message behavior:"),hl(),Cs(30,"div",4)(31,"label",5)(32,"input",11),sm("ngModelChange",function(o){return iT(n.useEnterToSend,o)||(n.useEnterToSend=o),o}),Lg("change",function(){return n.onEnterToSendChange()}),hl(),ZI(),Ag(33,"span",7),JC(34," Enter to send "),hl(),Cs(35,"label",5)(36,"input",11),sm("ngModelChange",function(o){return iT(n.useEnterToSend,o)||(n.useEnterToSend=o),o}),Lg("change",function(){return n.onEnterToSendChange()}),hl(),ZI(),Ag(37,"span",7),JC(38," Enter for new line "),hl()()(),Cs(39,"div",3)(40,"div",12)(41,"span",10),JC(42,"Show technical messages"),hl(),Cs(43,"mat-slide-toggle",13),sm("ngModelChange",function(o){return iT(n.showTechnicalMessages,o)||(n.showTechnicalMessages=o),o}),Lg("change",function(){return n.onShowTechnicalMessagesChange()}),hl(),ZI(),hl()(),Cs(44,"div",3)(45,"div",12)(46,"span",10),JC(47,"Show warning messages"),hl(),Cs(48,"mat-slide-toggle",13),sm("ngModelChange",function(o){return iT(n.showWarningMessages,o)||(n.showWarningMessages=o),o}),Lg("change",function(){return n.onShowWarningMessagesChange()}),hl(),ZI(),hl()(),Cs(49,"div",3)(50,"div",12)(51,"span",10),JC(52,"Include technical messages in print"),hl(),Cs(53,"mat-slide-toggle",13),sm("ngModelChange",function(o){return iT(n.printTechnicalMessages,o)||(n.printTechnicalMessages=o),o}),Lg("change",function(){return n.onPrintTechnicalMessagesChange()}),hl(),ZI(),hl()()(),Cs(54,"div",1)(55,"div",2)(56,"mat-icon"),JC(57,"rocket_launch"),hl(),Cs(58,"span"),JC(59,"Mission Control"),hl()(),Cs(60,"div",3)(61,"div",12)(62,"div",14)(63,"span",10),JC(64,"Side-by-side thread preview"),hl(),Cs(65,"span",15),JC(66,"Click a mission card to open a preview panel. Recommended for large screens."),hl()(),Cs(67,"mat-slide-toggle",13),sm("ngModelChange",function(o){return iT(n.missionPreviewEnabled,o)||(n.missionPreviewEnabled=o),o}),Lg("change",function(){return n.onMissionPreviewEnabledChange()}),hl(),ZI(),hl()()(),Cs(68,"div",1)(69,"div",2)(70,"mat-icon"),JC(71,"notifications"),hl(),Cs(72,"span"),JC(73,"Notifications"),hl()(),Cs(74,"div",3)(75,"div",12)(76,"span",10),JC(77,"Notify when the agent answers or requests input"),hl(),Cs(78,"mat-slide-toggle",13),sm("ngModelChange",function(o){return iT(n.agentNotificationEnabled,o)||(n.agentNotificationEnabled=o),o}),Lg("change",function(){return n.onAgentNotificationEnabledChange()}),hl(),ZI(),hl()(),Cs(79,"div",3)(80,"div",12)(81,"span",10),JC(82,"Notification sound"),hl(),Cs(83,"mat-slide-toggle",16),sm("ngModelChange",function(o){return iT(n.notificationSoundEnabled,o)||(n.notificationSoundEnabled=o),o}),Lg("change",function(){return n.onNotificationSoundEnabledChange()}),hl(),ZI(),hl()(),Cs(84,"div",3)(85,"div",12)(86,"span",10),JC(87,"Browser notification"),hl(),Cs(88,"mat-slide-toggle",16),sm("ngModelChange",function(o){return iT(n.browserNotificationEnabled,o)||(n.browserNotificationEnabled=o),o}),Lg("change",function(){return n.onBrowserNotificationEnabledChange()}),hl(),ZI(),hl(),aC(89,st,5,0,"div",17),hl()(),Cs(90,"div",1)(91,"div",2)(92,"mat-icon"),JC(93,"record_voice_over"),hl(),Cs(94,"span"),JC(95,"Voice & Speech"),hl()(),Cs(96,"div",3)(97,"label",18),JC(98,"Voice input method:"),hl(),Cs(99,"select",19),Lg("change",function(o){return n.onVoiceInputModeChange(o)}),Cs(100,"option",20),JC(101,"Browser (real-time)"),hl(),Cs(102,"option",21),JC(103,"Whisper (higher accuracy)"),hl(),Cs(104,"option",22),JC(105,"Voice message (send audio)"),hl()()(),Cs(106,"div",3)(107,"label",23),JC(108,"Voice recognition language:"),hl(),Cs(109,"select",24),sm("ngModelChange",function(o){return iT(n.selectedVoiceLanguage,o)||(n.selectedVoiceLanguage=o),o}),Lg("change",function(){return n.onVoiceLanguageChange()}),dC(110,ct,2,3,"option",25,rt),hl(),ZI(),hl(),Cs(112,"div",3)(113,"span",10),JC(114,"Automatic announcement:"),hl(),Cs(115,"div",4)(116,"label",5)(117,"input",26),sm("ngModelChange",function(o){return iT(n.voiceAnnounceEnabled,o)||(n.voiceAnnounceEnabled=o),o}),Lg("change",function(){return n.onVoiceAnnounceEnabledChange()}),hl(),ZI(),Ag(118,"span",7),JC(119," Enabled "),hl(),Cs(120,"label",5)(121,"input",26),sm("ngModelChange",function(o){return iT(n.voiceAnnounceEnabled,o)||(n.voiceAnnounceEnabled=o),o}),Lg("change",function(){return n.onVoiceAnnounceEnabledChange()}),hl(),ZI(),Ag(122,"span",7),JC(123," Disabled "),hl()()(),Cs(124,"div",3)(125,"span",10),JC(126,"Voice mode:"),hl(),Cs(127,"div",4)(128,"label",5)(129,"input",27),sm("ngModelChange",function(o){return iT(n.voiceMode,o)||(n.voiceMode=o),o}),Lg("change",function(){return n.onVoiceModeChange()}),hl(),ZI(),Ag(130,"span",7),JC(131," Voice synthesis "),hl(),Cs(132,"label",5)(133,"input",28),sm("ngModelChange",function(o){return iT(n.voiceMode,o)||(n.voiceMode=o),o}),Lg("change",function(){return n.onVoiceModeChange()}),hl(),ZI(),Ag(134,"span",7),JC(135," Sound notification "),hl()()(),Cs(136,"div",3)(137,"span",10),JC(138,"Message reading:"),hl(),Cs(139,"div",4)(140,"label",5)(141,"input",29),sm("ngModelChange",function(o){return iT(n.voiceReadFullText,o)||(n.voiceReadFullText=o),o}),Lg("change",function(){return n.onVoiceReadFullTextChange()}),hl(),ZI(),Ag(142,"span",7),JC(143," Full message "),hl(),Cs(144,"label",5)(145,"input",29),sm("ngModelChange",function(o){return iT(n.voiceReadFullText,o)||(n.voiceReadFullText=o),o}),Lg("change",function(){return n.onVoiceReadFullTextChange()}),hl(),ZI(),Ag(146,"span",7),JC(147," First paragraphs only "),hl()()(),Cs(148,"div",3)(149,"label",30),JC(150,"Selected voice:"),hl(),Cs(151,"select",31),sm("ngModelChange",function(o){return iT(n.selectedVoiceId,o)||(n.selectedVoiceId=o),o}),Lg("change",function(){return n.onSelectedVoiceChange()}),aC(152,lt,2,0,"option",32),aC(153,dt,2,0,"option",32),dC(154,pt,2,2,"option",25,at),hl(),ZI(),Ag(156,"div",10),Cs(157,"a",33),Lg("click",function(){return n.testVoice()}),Cs(158,"span",34),JC(159,"Test voice"),hl()()(),Cs(160,"div",3)(161,"label",35),JC(162),hl(),Cs(163,"input",36),sm("ngModelChange",function(o){return iT(n.voiceVolume,o)||(n.voiceVolume=o),o}),Lg("input",function(){return n.onVoiceVolumeChange()}),hl(),ZI(),hl(),Cs(164,"div",3)(165,"label",37),JC(166),hl(),Cs(167,"input",38),sm("ngModelChange",function(o){return iT(n.voiceRate,o)||(n.voiceRate=o),o}),Lg("input",function(){return n.onVoiceRateChange()}),hl(),ZI(),hl()()()),t&2&&(sI(10),im("ngModel",n.selectedTheme),QI(),sI(4),im("ngModel",n.selectedTheme),QI(),sI(4),im("ngModel",n.selectedTheme),QI(),sI(14),xg("value",true),im("ngModel",n.useEnterToSend),QI(),sI(4),xg("value",false),im("ngModel",n.useEnterToSend),QI(),sI(7),im("ngModel",n.showTechnicalMessages),QI(),sI(5),im("ngModel",n.showWarningMessages),QI(),sI(5),im("ngModel",n.printTechnicalMessages),QI(),sI(14),im("ngModel",n.missionPreviewEnabled),QI(),sI(11),im("ngModel",n.agentNotificationEnabled),QI(),sI(5),im("ngModel",n.notificationSoundEnabled),xg("disabled",!n.agentNotificationEnabled),QI(),sI(5),im("ngModel",n.browserNotificationEnabled),xg("disabled",!n.agentNotificationEnabled||n.browserNotificationDenied),QI(),sI(),cC(n.browserNotificationDenied?89:-1),sI(10),xg("value",n.voiceInputMode),sI(10),im("ngModel",n.selectedVoiceLanguage),QI(),sI(),fC(n.voiceLanguageOptions),sI(7),xg("value",true),im("ngModel",n.voiceAnnounceEnabled),QI(),sI(4),xg("value",false),im("ngModel",n.voiceAnnounceEnabled),QI(),sI(8),im("ngModel",n.voiceMode),QI(),sI(4),im("ngModel",n.voiceMode),QI(),sI(8),xg("value",true),im("ngModel",n.voiceReadFullText),QI(),sI(4),xg("value",false),im("ngModel",n.voiceReadFullText),QI(),sI(6),im("ngModel",n.selectedVoiceId),xg("disabled",n.loadingVoices||n.availableVoices.length===0),QI(),sI(),cC(n.loadingVoices?152:-1),sI(),cC(!n.loadingVoices&&n.availableVoices.length===0?153:-1),sI(),fC(n.availableVoices),sI(8),Dl("Volume: ",n.voiceVolume,"%"),sI(),im("ngModel",n.voiceVolume),QI(),sI(3),Dl("Speed: ",n.voiceRate,"%"),sI(),im("ngModel",n.voiceRate),QI());},dependencies:[ti,Qn,ei,Ye$1,_n,At,mn,Zn,cn,wt,se],styles:['.options-content[_ngcontent-%COMP%]{padding:0;width:100%}.option-group[_ngcontent-%COMP%]{padding:0 1rem 1rem;margin-bottom:1rem;border-bottom:1px solid var(--color-border-light)}.option-group[_ngcontent-%COMP%]:last-child{margin-bottom:0;padding-bottom:0;border-bottom:none}.option-label[_ngcontent-%COMP%]{display:block;margin-bottom:.5rem;font-weight:500;color:var(--color-text);font-size:.875rem}.toggle-option[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;gap:1rem}.toggle-option[_ngcontent-%COMP%] .option-label[_ngcontent-%COMP%]{margin-bottom:0;flex:1}.toggle-option[_ngcontent-%COMP%] mat-slide-toggle[_ngcontent-%COMP%]{flex-shrink:0}.option-label-with-hint[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.25rem;flex:1}.option-label-with-hint[_ngcontent-%COMP%] .option-label[_ngcontent-%COMP%]{margin-bottom:0}.option-label-with-hint[_ngcontent-%COMP%] .option-hint[_ngcontent-%COMP%]{font-size:.775rem;color:var(--color-text-secondary);line-height:1.4}.option-select[_ngcontent-%COMP%]{width:100%;padding:.5rem;border:1px solid var(--color-border);border-radius:4px;background:var(--color-input-bg);color:var(--color-text);font-size:.875rem;cursor:pointer}.option-select[_ngcontent-%COMP%]:focus{outline:none;border-color:var(--color-primary);box-shadow:0 0 0 3px #7064fb1a}.option-select[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.option-select[_ngcontent-%COMP%] option[_ngcontent-%COMP%]{padding:.5rem}.option-checkbox[_ngcontent-%COMP%]{display:flex;align-items:center;cursor:pointer;font-size:.875rem;color:var(--color-text);-webkit-user-select:none;user-select:none}.option-checkbox[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{display:none}.option-checkbox[_ngcontent-%COMP%] .checkmark[_ngcontent-%COMP%]{width:18px;height:18px;border:2px solid var(--color-border);border-radius:3px;margin-right:.75rem;display:flex;align-items:center;justify-content:center;transition:all .2s ease;flex-shrink:0}.option-checkbox[_ngcontent-%COMP%] .checkmark[_ngcontent-%COMP%]:after{content:"";width:10px;height:6px;border-left:2px solid transparent;border-bottom:2px solid transparent;transform:rotate(-45deg);transition:all .2s ease;opacity:0}.option-checkbox[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]:checked + .checkmark[_ngcontent-%COMP%]{background-color:var(--color-primary);border-color:var(--color-primary)}.option-checkbox[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]:checked + .checkmark[_ngcontent-%COMP%]:after{border-left-color:#fff;border-bottom-color:#fff;opacity:1}.option-checkbox[_ngcontent-%COMP%]:hover .checkmark[_ngcontent-%COMP%]{border-color:var(--color-primary)}.option-checkbox[_ngcontent-%COMP%]:focus-within .checkmark[_ngcontent-%COMP%]{box-shadow:0 0 0 3px #7064fb1a}.option-section[_ngcontent-%COMP%]{padding-top:1rem;margin-top:1rem;border-top:2px solid var(--color-border)}.option-section[_ngcontent-%COMP%]:first-child{border-top:none;padding-top:0;margin-top:0}.section-title[_ngcontent-%COMP%]{margin:0 0 1rem;padding:0 1rem;font-size:.9rem;font-weight:600;color:var(--color-text);display:flex;align-items:center;gap:.5rem}.section-title[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px}.radio-group[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.option-radio[_ngcontent-%COMP%]{display:flex;align-items:center;cursor:pointer;font-size:.875rem;color:var(--color-text);-webkit-user-select:none;user-select:none}.option-radio[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{display:none}.option-radio[_ngcontent-%COMP%] .radio-mark[_ngcontent-%COMP%]{width:16px;height:16px;border:2px solid var(--color-border);border-radius:50%;margin-right:.5rem;display:flex;align-items:center;justify-content:center;transition:all .2s ease;flex-shrink:0;position:relative}.option-radio[_ngcontent-%COMP%] .radio-mark[_ngcontent-%COMP%]:after{content:"";width:8px;height:8px;border-radius:50%;background-color:var(--color-primary);transition:all .2s ease;opacity:0;transform:scale(0)}.option-radio[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + .radio-mark[_ngcontent-%COMP%]{border-color:var(--color-primary)}.option-radio[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + .radio-mark[_ngcontent-%COMP%]:after{opacity:1;transform:scale(1)}.option-radio[_ngcontent-%COMP%]:hover .radio-mark[_ngcontent-%COMP%]{border-color:var(--color-primary)}.option-radio[_ngcontent-%COMP%]:focus-within .radio-mark[_ngcontent-%COMP%]{box-shadow:0 0 0 3px #7064fb1a}.option-slider[_ngcontent-%COMP%]{width:100%;height:6px;border-radius:3px;background:var(--color-bg-solid);outline:none;cursor:pointer;-webkit-appearance:none;appearance:none}.option-slider[_ngcontent-%COMP%]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:20px;height:20px;border-radius:50%;background:var(--color-primary);cursor:pointer;border:2px solid white;box-shadow:0 2px 6px #0003;transition:all .2s ease}.option-slider[_ngcontent-%COMP%]::-webkit-slider-thumb:hover{transform:scale(1.1);box-shadow:0 2px 8px #0000004d}.option-slider[_ngcontent-%COMP%]::-moz-range-thumb{width:20px;height:20px;border-radius:50%;background:var(--color-primary);cursor:pointer;border:2px solid white;box-shadow:0 2px 6px #0003;transition:all .2s ease}.option-slider[_ngcontent-%COMP%]::-moz-range-thumb:hover{transform:scale(1.1);box-shadow:0 2px 8px #0000004d}.option-slider[_ngcontent-%COMP%]::-webkit-slider-track{height:6px;border-radius:3px;background:var(--color-bg-secondary)}.option-slider[_ngcontent-%COMP%]::-moz-range-track{height:6px;border-radius:3px;background:var(--color-bg-secondary);border:none}.option-slider[_ngcontent-%COMP%]:focus{outline:none}.option-slider[_ngcontent-%COMP%]:focus::-webkit-slider-thumb{box-shadow:0 0 0 3px #7064fb4d,0 2px 6px #0003}.option-slider[_ngcontent-%COMP%]:focus::-moz-range-thumb{box-shadow:0 0 0 3px #7064fb4d,0 2px 6px #0003}.test-voice-btn[_ngcontent-%COMP%]{width:100%;padding:.75rem 1rem;background:var(--color-primary);color:#fff;border:none;border-radius:6px;font-size:.875rem;font-weight:500;cursor:pointer;transition:all .2s ease;display:flex;align-items:center;justify-content:center;gap:.5rem}.test-voice-btn[_ngcontent-%COMP%]:hover{background:var(--color-primary-hover);transform:translateY(-1px);box-shadow:0 2px 8px #7064fb4d}.test-voice-btn[_ngcontent-%COMP%]:active{transform:translateY(0);box-shadow:0 1px 4px #7064fb4d}.test-voice-btn[_ngcontent-%COMP%]:focus{outline:none;box-shadow:0 0 0 3px #7064fb4d}.test-voice-btn[_ngcontent-%COMP%]:disabled{background:var(--color-bg-secondary);color:var(--color-text-secondary);cursor:not-allowed;transform:none;box-shadow:none}.test-voice-link[_ngcontent-%COMP%]{text-decoration-thickness:1.5px;text-underline-offset:3px;background:transparent;border:none;padding:0;font-size:.775rem;font-weight:400;cursor:pointer;transition:all .2s ease;display:inline-flex;align-items:center;justify-content:center;gap:.5rem;text-decoration:underline}.test-voice-link[_ngcontent-%COMP%]:hover{color:var(--color-primary-hover, var(--color-primary));text-decoration-thickness:2px}.test-voice-link[_ngcontent-%COMP%]:active{opacity:.8}.test-voice-link[_ngcontent-%COMP%]:focus{outline:2px solid var(--color-primary);outline-offset:2px}.test-voice-link[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px}.notification-error[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem;padding:.75rem;margin-top:.75rem;background-color:#d32f2f1a;border:1px solid rgba(211,47,47,.3);border-radius:6px;font-size:.8125rem;line-height:1.5}.notification-error[_ngcontent-%COMP%] .error-icon[_ngcontent-%COMP%]{color:#d32f2f;font-size:20px;width:20px;height:20px;flex-shrink:0;margin-top:2px}.notification-error[_ngcontent-%COMP%] .error-message[_ngcontent-%COMP%]{color:var(--color-text);flex:1}.notification-error[_ngcontent-%COMP%]{margin-top:.75rem;padding:.75rem;background-color:#f443361a;border:1px solid rgba(244,67,54,.3);border-radius:6px;display:flex;align-items:flex-start;gap:.5rem}.notification-error[_ngcontent-%COMP%] .error-icon[_ngcontent-%COMP%]{color:#f44336;font-size:20px;width:20px;height:20px;flex-shrink:0;margin-top:2px}.notification-error[_ngcontent-%COMP%] .error-message[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-text);line-height:1.5;flex:1}'],changeDetection:1})};function Qe(c){let e=c.args??"",t;try{let n=JSON.parse(e);t=JSON.stringify(n,null,2);}catch(n){t=e;}return `\u{1F527} ${c.name}
179
-
180
- ${t}`}var Ge=class c{destroy$=new ue;currentProject=null;currentThread=null;messagesSubject=new Tr([]);isThinkingSubject=new Tr(false);currentChoiceSubject=new Tr(null);projectTitleSubject=new Tr("Coday");currentInviteEventSubject=new Tr(null);messageToRestoreSubject=new Tr("");threadUpdateEventSubject=new Tr(null);currentChoiceEvent=null;thinkingTimeout=null;accumulatedChunks="";streamingTextSubject=new Tr("");subThreadEventsSubject=new ue;subThreadEvents$=this.subThreadEventsSubject.asObservable();subThreadEventBuffers=new Map;getBufferedSubThreadEvents(e){return this.subThreadEventBuffers.get(e)??[]}messages$=this.messagesSubject.asObservable();streamingText$=this.streamingTextSubject.asObservable();isThinking$=this.isThinkingSubject.asObservable();currentChoice$=this.currentChoiceSubject.asObservable();currentInviteEvent$=this.currentInviteEventSubject.asObservable();messageToRestore$=this.messageToRestoreSubject.asObservable();threadUpdateEvent$=this.threadUpdateEventSubject.asObservable();connectionStatus$;tabTitleService=null;eventStream=g(fe);messageApi=g(be);userService=g(pe);constructor(){this.connectionStatus$=this.eventStream.connectionStatus$,this.initializeEventHandling();}setTabTitleService(e){this.tabTitleService=e;}connectToThread(e,t){this.currentProject=e,this.currentThread=t,this.eventStream.connectToThread(e,t);}loadHistoryFromRest(e){for(let t of e){let n=le(t);n&&this.handleEvent(n,true);}}resetMessages(){this.messagesSubject.next([]),this.currentChoiceSubject.next(null),this.currentInviteEventSubject.next(null),this.currentChoiceEvent=null,this.accumulatedChunks="",this.streamingTextSubject.next(""),this.subThreadEventBuffers.clear(),this.stopThinking();}sendMessage(e){if(!this.currentProject||!this.currentThread){console.error("[CODAY] Cannot send message: no project or thread selected");return}let t=this.currentInviteEventSubject.value;if(t){this.clearThinkingTimeout(),this.isThinkingSubject.next(true),this.thinkingTimeout=setTimeout(()=>{this.thinkingTimeout=null,this.stopThinking(),console.warn("[CODAY] Safety timeout: no server response after 30 s, releasing thinking state");},3e4),this.tabTitleService?.setSystemActive(),this.currentInviteEventSubject.next(null);let n=t.buildAnswer(e);this.messageApi.sendMessage(n).subscribe({error:i=>{console.error("[CODAY] Send invite answer error:",i),this.currentInviteEventSubject.next(t),this.stopThinking();}});}else this.messageApi.sendFreeMessage(e).subscribe({error:n=>{console.error("[CODAY] Send error:",n);}});}sendChoice(e){if(!this.currentProject||!this.currentThread){console.error("[CODAY] Cannot send choice: no project or thread selected");return}if(this.currentChoiceEvent){this.clearThinkingTimeout(),this.isThinkingSubject.next(true),this.thinkingTimeout=setTimeout(()=>{this.thinkingTimeout=null,this.stopThinking(),console.warn("[CODAY] Safety timeout: no server response after 30 s, releasing thinking state");},3e4),this.tabTitleService?.setSystemActive();let t=this.currentChoiceEvent.buildAnswer(e);this.currentChoiceSubject.next(null),this.currentChoiceEvent=null,this.messageApi.sendMessage(t).subscribe({next:()=>{},error:n=>{console.error("[CODAY-CHOICE] Choice error:",n),this.stopThinking();}});}else console.error("[CODAY-CHOICE] No choice event available for choice:",e);}deleteMessage(e){let t=this.messagesSubject.value.find(i=>i.id===e),n=this.extractTextContentFromMessage(t);return this.messageApi.deleteMessage(e).pipe(jd(i=>{i.success&&(this.removeMessagesFromIndex(e),n.trim()&&this.messageToRestoreSubject.next(n));}))}getCurrentProjectTitle(){return this.projectTitleSubject.value}getCurrentInviteEvent(){return this.currentInviteEventSubject.value}setThinkingForPendingMessage(){this.isThinkingSubject.next(true),this.tabTitleService?.setSystemActive();}initializeEventHandling(){this.eventStream.events$.pipe(_d(this.destroy$)).subscribe({next:e=>this.handleEvent(e),error:e=>console.error("[CODAY] Event stream error:",e),complete:()=>console.log("[CODAY] Event stream completed")});}handleEvent(e,t=false){if(e.threadId&&e.threadId!==this.currentThread){let n=this.subThreadEventBuffers.get(e.threadId);n?n.push(e):this.subThreadEventBuffers.set(e.threadId,[e]),this.subThreadEventsSubject.next(e);return}e instanceof T?this.handleMessageEvent(e):e instanceof B?this.handleTextChunkEvent(e):e instanceof A?this.handleTextEvent(e):e instanceof u?this.handleAnswerEvent(e):e instanceof h?this.handleErrorEvent(e):e instanceof M?this.handleWarnEvent(e):e instanceof O?this.handleThinkingEvent(e):e instanceof v?this.handleToolRequestEvent(e):e instanceof m?this.handleToolResponseEvent(e):e instanceof b?this.handleChoiceEvent(e,t):e instanceof F?this.handleHeartBeatEvent(e):e instanceof f?this.handleInviteEvent(e,t):e instanceof V?this.handleThreadUpdateEvent(e):e instanceof R?this.handleDelegationEvent(e):e instanceof H||e instanceof K||console.warn("[CODAY] Unhandled event type:",e.type);}handleDelegationEvent(e){if(console.log("[CODAY] DelegationEvent received:",e.subThreadId,e.agentName),this.messagesSubject.value.findIndex(i=>i.subThreadId===e.subThreadId)===-1){let i={id:e.timestamp,role:"system",speaker:e.agentName,content:[{type:"text",content:""}],timestamp:new Date,type:"delegation",subThreadId:e.subThreadId,delegationAgentName:e.agentName};this.addMessage(i);}}handleThreadUpdateEvent(e){this.threadUpdateEventSubject.next(e);}handleMessageEvent(e){e.role==="assistant"&&this.accumulatedChunks&&(this.accumulatedChunks="",this.streamingTextSubject.next(""));let t={id:e.timestamp,role:e.role,speaker:e.name,content:e.content,timestamp:e.date,type:"text"};this.addMessage(t);}handleTextChunkEvent(e){this.accumulatedChunks+=e.chunk,this.streamingTextSubject.next(this.accumulatedChunks);}handleTextEvent(e){let t={id:e.timestamp,role:e.speaker?"assistant":"system",speaker:e.speaker??"System",content:[{type:"text",content:e.text}],timestamp:e.date,type:e.speaker?"text":"technical"};this.addMessage(t);}handleAnswerEvent(e){let t=this.currentInviteEventSubject.value;if(t){let i=!!e.parentKey&&e.parentKey===t.timestamp,o=!e.parentKey&&e.date>=t.date;(i||o)&&this.currentInviteEventSubject.next(null);}if(this.currentChoiceEvent){let i=!!e.parentKey&&e.parentKey===this.currentChoiceEvent.timestamp,o=!e.parentKey&&e.date>=this.currentChoiceEvent.date;(i||o)&&(this.currentChoiceEvent=null,this.currentChoiceSubject.next(null));}if(e.silent)return;let n={id:e.timestamp,role:"user",speaker:e.name??this.userService.getUsername()??"User",content:[{type:"text",content:e.answer}],timestamp:e.date,type:"text",parentKey:e.parentKey,invite:e.invite};this.addMessage(n);}handleErrorEvent(e){let t={id:e.timestamp,role:"system",speaker:"System",content:[{type:"text",content:`Error: ${JSON.stringify(e.error)}`}],timestamp:e.date,type:"error"};this.addMessage(t);}handleWarnEvent(e){let t={id:e.timestamp,role:"system",speaker:"System",content:[{type:"text",content:`Warning: ${JSON.stringify(e.warning)}`}],timestamp:e.date,type:"warning"};this.addMessage(t);}handleThinkingEvent(e){this.currentInviteEventSubject.value||this.currentChoiceEvent||(this.clearThinkingTimeout(),this.isThinkingSubject.next(true),this.tabTitleService?.setSystemActive(),this.thinkingTimeout=setTimeout(()=>{this.isThinkingSubject.next(false),this.thinkingTimeout=null,this.tabTitleService?.setSystemInactive();},O.debounce+1e3));}handleToolRequestEvent(e){let t={id:e.timestamp,role:"system",speaker:"System",content:[{type:"text",content:e.toSingleLineString()}],timestamp:e.date,type:"technical",eventId:e.timestamp,fullContent:Qe(e)};this.addMessage(t);}handleToolResponseEvent(e){let t={id:e.timestamp,role:"system",speaker:"System",content:[{type:"text",content:e.toSingleLineString()}],timestamp:e.date,type:"technical",eventId:e.timestamp};this.addMessage(t);}handleChoiceEvent(e,t=false){this.stopThinking();let n={id:e.timestamp,role:"assistant",speaker:"Assistant",content:[{type:"text",content:e.optionalQuestion?`${e.optionalQuestion} ${e.invite}`:e.invite}],timestamp:e.date,type:"text"};if(this.addMessage(n),t||this.messagesSubject.value.some(y=>y.parentKey===e.timestamp||y.role==="user"&&y.timestamp>e.date||y.role==="assistant"&&y.timestamp>e.date))return;this.currentChoiceEvent=e,this.tabTitleService?.setSystemInactive();let E=e.options.map(y=>({value:y,label:y})),C=e.optionalQuestion?`${e.optionalQuestion} ${e.invite}`:e.invite;this.currentChoiceSubject.next({options:E,label:C,allowFreeText:e.allowFreeText});}handleHeartBeatEvent(e){}handleInviteEvent(e,t=false){if(this.stopThinking(),e.invite===_e)t||(this.currentInviteEventSubject.next(e),this.tabTitleService?.setSystemInactive());else {let i={id:e.timestamp,role:"assistant",speaker:"Assistant",content:[{type:"text",content:e.invite}],timestamp:e.date,type:"text"};this.addMessage(i),this.messagesSubject.value.some(C=>C.parentKey===e.timestamp||C.role==="user"&&C.timestamp>e.date||C.role==="assistant"&&C.timestamp>e.date)||t||(this.currentInviteEventSubject.next(e),this.tabTitleService?.setSystemInactive());}}addMessage(e){let t=this.messagesSubject.value;t.some(n=>n.id===e.id)||this.messagesSubject.next([...t,e]);}removeMessagesFromIndex(e){let t=this.messagesSubject.value,n=t.findIndex(o=>o.id===e);if(n===-1||n===0)return;let i=t.slice(0,n);this.messagesSubject.next(i),this.stopThinking();}extractTextContentFromMessage(e){return e?e.content.filter(t=>t.type==="text").map(t=>t.content).join(`
181
-
182
- `):""}clearThinkingTimeout(){this.thinkingTimeout&&(clearTimeout(this.thinkingTimeout),this.thinkingTimeout=null);}stopThinking(){this.clearThinkingTimeout(),this.isThinkingSubject.next(false),this.tabTitleService&&this.tabTitleService.setSystemInactive();}ngOnDestroy(){this.clearThinkingTimeout(),this.destroy$.next(),this.destroy$.complete(),this.currentInviteEventSubject.complete(),this.messageToRestoreSubject.complete(),this.threadUpdateEventSubject.complete(),this.streamingTextSubject.complete(),this.eventStream.disconnect();}static \u0275fac=function(t){return new(t||c)};static \u0275prov=x({token:c,factory:c.\u0275fac,providedIn:"root"})};function gt(c,e){if(c&1&&(Cs(0,"div",3),JC(1),hl()),c&2){let t=CC();sI(),Dl("\u274C ",t.errorMessage);}}var Ze=class c{dialogRef=g(z$1);data=g(Ue);jsonContent;errorMessage="";title;constructor(){this.jsonContent=this.data.initialContent,this.title=this.data.title||this.getDefaultTitle(this.data.configType,this.data.projectName);}getDefaultTitle(e,t){return e==="user"?"User Configuration":`Project Configuration: ${t||"Unknown"}`}onSave(){this.errorMessage="";let e;try{e=JSON.parse(this.jsonContent);}catch(t){this.errorMessage=`Invalid JSON syntax: ${t instanceof Error?t.message:"Unknown error"}`;return}this.dialogRef.close(e);}onCancel(){this.dialogRef.close();}static \u0275fac=function(t){return new(t||c)};static \u0275cmp=jw({type:c,selectors:[["app-json-editor"]],decls:13,vars:3,consts:[["mat-dialog-title",""],["mat-icon-button","","title","Close",1,"close-button",3,"click"],["spellcheck","false","placeholder","Enter JSON configuration...",1,"json-textarea",3,"ngModelChange","ngModel"],[1,"error-message"],["align","end"],["matButton","",3,"click"],["matButton","filled","color","primary",3,"click"]],template:function(t,n){t&1&&(Cs(0,"div",0),JC(1),Cs(2,"button",1),Lg("click",function(){return n.onCancel()}),Cs(3,"mat-icon"),JC(4,"close"),hl()()(),Cs(5,"mat-dialog-content")(6,"textarea",2),sm("ngModelChange",function(o){return iT(n.jsonContent,o)||(n.jsonContent=o),o}),hl(),ZI(),aC(7,gt,2,1,"div",3),hl(),Cs(8,"mat-dialog-actions",4)(9,"button",5),Lg("click",function(){return n.onCancel()}),JC(10,"Cancel"),hl(),Cs(11,"button",6),Lg("click",function(){return n.onSave()}),JC(12,"Save"),hl()()),t&2&&(sI(),Dl(" ",n.title," "),sI(5),im("ngModel",n.jsonContent),QI(),sI(),cC(n.errorMessage?7:-1));},dependencies:[Xm,ti,Ye$1,Zn,cn,wt,Gn,pr,jt,Nt,Vt],styles:["[mat-dialog-title][_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}[mat-dialog-title][_ngcontent-%COMP%] .close-button[_ngcontent-%COMP%]{margin-left:auto}mat-dialog-content[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;min-height:400px}.json-textarea[_ngcontent-%COMP%]{flex:1;min-height:300px;max-height:80vh;padding:1rem;font-family:Monaco,Menlo,Ubuntu Mono,Consolas,monospace;font-size:.875rem;line-height:1.5;background:var(--color-code-bg);color:var(--color-text);border:1px solid var(--color-border);border-radius:4px;resize:vertical;outline:none;transition:border-color .2s}.json-textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.json-textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary);opacity:.6}.error-message[_ngcontent-%COMP%]{padding:.75rem 1rem;border-radius:4px;font-size:.875rem;line-height:1.4;background:#dc26261a;color:#dc2626;border:1px solid rgba(220,38,38,.3)}"],changeDetection:1})};export{Et as E,Ge as G,Qe as Q,Ye as Y,Ze as Z,yt as y,z};
@@ -1 +0,0 @@
1
- import {g,ao as V,G,C as Ce,dm as $,df as U,F,a7 as va,X as br,W as Wi,T as TT,b as U$1,z as z$1,a as P,j as jw,k as Cs,n as Lg,J as JC,m as hl,o as aC,u as sI,a8 as em,v as cC,a9 as vC,A as Ag,a3 as ZI,ac as CC,x as xg,a6 as QI,a5 as Dl,q as dC,cH as iC,w as fC,b0 as tm,aa as Sf,ab as _f}from'./main-JTU33H5D.js';import {o as z,k as _t,b as _e,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,f as fn,A as At,Z as Zn,l as Xn,$ as $t,W as Wt,C as Cn,E as En,p as An}from'./chunk-DuXr-yGB.js';function le(l,t){l&1&&(Cs(0,"p",5),JC(1,"Loading\u2026"),hl());}function ae(l,t){if(l&1&&Ag(0,"input",11),l&2){let e=CC(2);xg("value",e.selectedProviderLabel());}}function de(l,t){if(l&1&&(Cs(0,"option",43),JC(1),hl()),l&2){let e=t.$implicit;xg("value",e.id),sI(),tm("",e.name," (",e.apiType,")");}}function me(l,t){if(l&1&&(Cs(0,"select",12)(1,"option",42),JC(2,"Select provider"),hl(),dC(3,de,2,3,"option",43,iC().trackByProvider,true),hl(),ZI()),l&2){let e=CC(2);xg("formControl",e.aiProviderIdControl),QI(),sI(3),fC(e.providers());}}function ce(l,t){if(l&1){let e=vC();Cs(0,"form",7),Lg("ngSubmit",function(){Sf(e);let u=CC();return _f(u.submit())}),Cs(1,"div",8)(2,"label",9),JC(3," Provider "),Cs(4,"span",10),JC(5,"*"),hl()(),aC(6,ae,1,1,"input",11)(7,me,5,1,"select",12),hl(),Cs(8,"div",8)(9,"label",13),JC(10," API name "),Cs(11,"span",10),JC(12,"*"),hl()(),Ag(13,"input",14),ZI(),hl(),Cs(14,"div",8)(15,"label",15),JC(16,"Description"),hl(),Ag(17,"input",16),ZI(),hl(),Cs(18,"div",8)(19,"label",17),JC(20,"Alias"),hl(),Ag(21,"input",18),ZI(),hl(),Cs(22,"div",8)(23,"label",19),JC(24,"Priority"),hl(),Ag(25,"input",20),ZI(),hl(),Cs(26,"div",21)(27,"div",8)(28,"label",22),JC(29,"Temperature"),hl(),Ag(30,"input",23),ZI(),hl(),Cs(31,"div",8)(32,"label",24),JC(33,"Context window"),hl(),Ag(34,"input",25),ZI(),hl()(),Cs(35,"div",8)(36,"label",26),JC(37,"Max completion tokens"),hl(),Ag(38,"input",27),ZI(),hl(),Cs(39,"fieldset",28)(40,"legend",29),JC(41," Pricing "),Cs(42,"span",30),JC(43,"(per million tokens \u2014 leave blank to skip cost monitoring)"),hl()(),Cs(44,"div",21)(45,"div",8)(46,"label",31),JC(47,"Input"),hl(),Ag(48,"input",32),ZI(),hl(),Cs(49,"div",8)(50,"label",33),JC(51,"Output"),hl(),Ag(52,"input",34),ZI(),hl()(),Cs(53,"div",21)(54,"div",8)(55,"label",35),JC(56,"Cache write"),hl(),Ag(57,"input",36),ZI(),hl(),Cs(58,"div",8)(59,"label",37),JC(60,"Cache read"),hl(),Ag(61,"input",38),ZI(),hl()()(),Cs(62,"div",39)(63,"button",40),JC(64),hl(),Cs(65,"button",41),Lg("click",function(){Sf(e);let u=CC();return _f(u.cancel())}),JC(66,"Cancel"),hl()()();}if(l&2){let e=CC();xg("formGroup",e.form),sI(6),cC(e.isEditMode()?6:7),sI(7),xg("formControl",e.apiModelNameControl),QI(),sI(4),xg("formControl",e.descriptionControl),QI(),sI(4),xg("formControl",e.aliasControl),QI(),sI(4),xg("formControl",e.priorityControl),QI(),sI(5),xg("formControl",e.temperatureControl),QI(),sI(4),xg("formControl",e.contextWindowControl),QI(),sI(4),xg("formControl",e.maxCompletionTokensControl),QI(),sI(),xg("formGroup",e.pricingGroup),sI(9),QI(),sI(4),QI(),sI(5),QI(),sI(4),QI(),sI(2),xg("disabled",e.form.invalid||e.isSubmitting()),sI(),Dl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var re=class l{route=g(V);router=g(G);destroyRef=g(Ce);aiModelController=g($);aiProviderController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;providers=F(this.aiProviderController.listAiProvider(this.isPlatformMode?"none":this.namespaceId).pipe(va(()=>br([]))),{initialValue:[]});form=new z({aiProviderId:new _t("",{nonNullable:true,validators:[_e.required]}),apiModelName:new _t("",{nonNullable:true,validators:[_e.required,_e.minLength(1)]}),description:new _t(null),alias:new _t("",{nonNullable:true}),priority:new _t(0,{nonNullable:true}),temperature:new _t(null),contextWindow:new _t(null),maxCompletionTokens:new _t(null),pricing:new z({inputMTokens:new _t(null),outputMTokens:new _t(null),cacheWrite:new _t(null),cacheRead:new _t(null)})});get aiProviderIdControl(){return this.form.controls.aiProviderId}get apiModelNameControl(){return this.form.controls.apiModelName}get descriptionControl(){return this.form.controls.description}get aliasControl(){return this.form.controls.alias}get priorityControl(){return this.form.controls.priority}get temperatureControl(){return this.form.controls.temperature}get contextWindowControl(){return this.form.controls.contextWindow}get maxCompletionTokensControl(){return this.form.controls.maxCompletionTokens}get pricingGroup(){return this.form.controls.pricing}isEditMode=Wi(false);isSubmitting=Wi(false);isLoading=Wi(false);selectedProviderLabel=TT(()=>{let t=this.aiProviderIdControl.value,e=this.providers().find(p=>p.id===t);return e?`${e.name} (${e.apiType})`:t});existingModel=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("modelId");t&&(this.isEditMode.set(true),this.loadModel(t));}loadModel(t){this.isLoading.set(true),this.aiModelController.getByIdAiModel(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.existingModel=e,this.aiProviderIdControl.setValue(e.aiProviderId),this.aiProviderIdControl.disable(),this.apiModelNameControl.setValue(e.apiModelName),this.descriptionControl.setValue(e.description??null),this.aliasControl.setValue(e.alias??""),this.priorityControl.setValue(e.priority??0),this.temperatureControl.setValue(e.temperature??null),this.contextWindowControl.setValue(e.contextWindow??null),this.maxCompletionTokensControl.setValue(e.maxCompletionTokens??null),this.pricingGroup.setValue({inputMTokens:e.pricing?.inputMTokens??null,outputMTokens:e.pricing?.outputMTokens??null,cacheWrite:e.pricing?.cacheWrite??null,cacheRead:e.pricing?.cacheRead??null}),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.form.getRawValue(),e=t.pricing,u=e.inputMTokens!=null||e.outputMTokens!=null||e.cacheWrite!=null||e.cacheRead!=null?{isEmpty:false,inputMTokens:e.inputMTokens??void 0,outputMTokens:e.outputMTokens??void 0,cacheWrite:e.cacheWrite??void 0,cacheRead:e.cacheRead??void 0}:void 0,k=z$1(P({},this.existingModel??{}),{aiProviderId:t.aiProviderId,namespaceId:this.isPlatformMode?void 0:this.existingModel?.namespaceId??this.namespaceId,apiModelName:t.apiModelName.trim(),description:t.description?.trim()||void 0,alias:t.alias.trim()||void 0,priority:t.priority,temperature:t.temperature??void 0,contextWindow:t.contextWindow??void 0,maxCompletionTokens:t.maxCompletionTokens??void 0,pricing:u});(this.isEditMode()?this.aiModelController.updateAiModel(this.existingModel.id??"",k):this.aiModelController.createAiModel(k)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-models"]):this.router.navigate(["/agentos",this.namespaceId,"ai-models"]);}trackByProvider(t,e){return e.id??""}static \u0275fac=function(e){return new(e||l)};static \u0275cmp=jw({type:l,selectors:[["agentos-ai-model-form"]],decls:10,vars:2,consts:[[1,"ai-model-form"],[1,"ai-model-form__header"],["type","button","title","Back to AI models",1,"ai-model-form__back",3,"click"],[1,"ai-model-form__back-icon"],[1,"ai-model-form__title"],[1,"ai-model-form__loading"],[1,"ai-model-form__form",3,"formGroup"],[1,"ai-model-form__form",3,"ngSubmit","formGroup"],[1,"ai-model-form__field"],["for","model-provider",1,"ai-model-form__label"],["aria-hidden","true"],["id","model-provider","type","text","readonly","","tabindex","-1",1,"ai-model-form__input","ai-model-form__input--readonly",3,"value"],["id","model-provider",1,"ai-model-form__select",3,"formControl"],["for","model-api-name",1,"ai-model-form__label"],["id","model-api-name","type","text","placeholder","e.g. gpt-4o, claude-3-5-sonnet-20241022","autocomplete","off",1,"ai-model-form__input","ai-model-form__input--mono",3,"formControl"],["for","model-description",1,"ai-model-form__label"],["id","model-description","type","text","placeholder","Optional \u2014 short description of this model config","autocomplete","off",1,"ai-model-form__input",3,"formControl"],["for","model-alias",1,"ai-model-form__label"],["id","model-alias","type","text","placeholder","e.g. fast, smart \u2014 short identifier used internally","autocomplete","off",1,"ai-model-form__input",3,"formControl"],["for","model-priority",1,"ai-model-form__label"],["id","model-priority","type","number","placeholder","0 \u2014 higher wins when multiple configs share the same alias","min","0","step","1",1,"ai-model-form__input",3,"formControl"],[1,"ai-model-form__row"],["for","model-temperature",1,"ai-model-form__label"],["id","model-temperature","type","number","placeholder","0 \u2013 2","min","0","max","2","step","0.1",1,"ai-model-form__input",3,"formControl"],["for","model-context-window",1,"ai-model-form__label"],["id","model-context-window","type","number","placeholder","e.g. 128000","min","1","step","1",1,"ai-model-form__input",3,"formControl"],["for","model-max-completion-tokens",1,"ai-model-form__label"],["id","model-max-completion-tokens","type","number","placeholder","e.g. 4096","min","1","step","1",1,"ai-model-form__input",3,"formControl"],[1,"ai-model-form__section",3,"formGroup"],[1,"ai-model-form__section-title"],[1,"ai-model-form__section-hint"],["for","pricing-input",1,"ai-model-form__label"],["id","pricing-input","type","number","placeholder","e.g. 2.50","min","0","step","0.01","formControlName","inputMTokens",1,"ai-model-form__input"],["for","pricing-output",1,"ai-model-form__label"],["id","pricing-output","type","number","placeholder","e.g. 10.00","min","0","step","0.01","formControlName","outputMTokens",1,"ai-model-form__input"],["for","pricing-cache-write",1,"ai-model-form__label"],["id","pricing-cache-write","type","number","placeholder","e.g. 3.75","min","0","step","0.01","formControlName","cacheWrite",1,"ai-model-form__input"],["for","pricing-cache-read",1,"ai-model-form__label"],["id","pricing-cache-read","type","number","placeholder","e.g. 0.30","min","0","step","0.01","formControlName","cacheRead",1,"ai-model-form__input"],[1,"ai-model-form__actions"],["type","submit",1,"ai-model-form__btn","ai-model-form__btn--primary",3,"disabled"],["type","button",1,"ai-model-form__btn",3,"click"],["value","","disabled",""],[3,"value"]],template:function(e,p){e&1&&(Cs(0,"div",0)(1,"header",1)(2,"button",2),Lg("click",function(){return p.cancel()}),Cs(3,"span",3),JC(4,"\u2190"),hl(),JC(5," AI models "),hl(),Cs(6,"h1",4),JC(7),hl()(),aC(8,le,2,0,"p",5)(9,ce,67,12,"form",6),hl()),e&2&&(sI(7),em(p.isEditMode()?"Edit AI model":"New AI model"),sI(),cC(p.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,fn,At,Zn,Xn,$t,Wt,Cn,En,An],styles:[".ai-model-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:480px;margin:0 auto;padding:2rem 1rem}.ai-model-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.ai-model-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.ai-model-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.ai-model-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.ai-model-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.ai-model-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.ai-model-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.ai-model-form__row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.ai-model-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.ai-model-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.ai-model-form__input[_ngcontent-%COMP%], .ai-model-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.ai-model-form__input[_ngcontent-%COMP%]:focus, .ai-model-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.ai-model-form__input[_ngcontent-%COMP%]::placeholder, .ai-model-form__select[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.ai-model-form__input--mono[_ngcontent-%COMP%]{font-family:monospace}.ai-model-form__section[_ngcontent-%COMP%]{border:1px solid var(--color-divider);border-radius:0;padding:1rem;margin:0;display:flex;flex-direction:column;gap:1rem}.ai-model-form__section-title[_ngcontent-%COMP%]{font-size:.875rem;font-weight:600;color:var(--color-text);padding:0 .25rem}.ai-model-form__section-hint[_ngcontent-%COMP%]{font-weight:400;color:var(--color-text-secondary);font-size:.8125rem}.ai-model-form__input--readonly[_ngcontent-%COMP%]{color:var(--color-text-secondary);cursor:default;background:var(--color-surface-muted, rgba(0, 0, 0, .03))}.ai-model-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.ai-model-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.ai-model-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.ai-model-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.ai-model-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.ai-model-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}"]})};export{re as AiModelFormComponent};
@@ -1 +0,0 @@
1
- import {A,k as kt,b as bt}from'./chunk-BHb31ndI.js';import {S as St}from'./chunk-CIfgFQUQ.js';import {E as Et,y as yt$1,G as Ge}from'./chunk-B52iVZ-n.js';import {g,G,P,U,I as N,p as pe$1,K as c,C as Ce$1,W as Wi,F as F$1,T as TT,b as U$1,j as jw,h as hr,e as pr,k as Cs,J as JC,m as hl,n as Lg,o as aC,q as dC,u as sI,x as xg,v as cC,w as fC,y as qg,N as Ng,r as re,ca as _e$1,Y as x,an as ue$1,ap as _d,l as le$1,V,A as Ag,a9 as vC,aa as Sf,ac as CC,ab as _f,a8 as em,a5 as Dl}from'./main-JTU33H5D.js';import'./chunk-DCx8SlS-.js';import'./chunk-I8YepFsn.js';import'./chunk-4XIlyOr9.js';import'./chunk-DK1hp0WW.js';import {y as yt,w as wt}from'./chunk-DuXr-yGB.js';var R=class n{threadState=g(U);codayService=g(Ge);threadList=F$1(this.threadState.threadList$,{initialValue:[]});selectedThread=F$1(this.threadState.selectedThread$,{initialValue:null});isThinking=F$1(this.codayService.isThinking$,{initialValue:false});inviteEvent=F$1(this.codayService.currentInviteEvent$.pipe(re(t=>t?.invite===_e$1?null:t)),{initialValue:null});tasks=TT(()=>{let t=this.threadList(),e=this.selectedThread(),r=this.isThinking(),o=this.inviteEvent();return t.filter(i=>!i.parentThreadId).map(i=>{let m=!!e&&i.id===e.id;return {id:i.id,name:i.name,summary:i.summary,modifiedDate:i.modifiedDate,starring:i.starring??[],users:i.users??[],status:this.deriveStatus(i,m,r,!!o),isActive:m,worktreeProject:i.worktreeProject}}).sort((i,m)=>{let q=kt[i.status]-kt[m.status];return q!==0?q:i.modifiedDate>m.modifiedDate?-1:1})});deriveStatus(t,e,r,o){let i=Date.now()-new Date(t.modifiedDate).getTime();return t.closedByUser?"done":t.pendingInvite?"waiting-you":e?r?"in-progress":"paused":i<bt?"in-progress":"paused"}static \u0275fac=function(e){return new(e||n)};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};var F=class n{projectState=g(P);threadState=g(U);destroy$=new ue$1;eventSource=null;currentProject=null;constructor(){this.projectState.selectedProject$.pipe(_d(this.destroy$)).subscribe(t=>{let e=t?.name??null;e!==this.currentProject&&(this.disconnect(),e&&this.connect(e));});}connect(t,e=5e3){this.currentProject=t;let r=`/api/projects/${encodeURIComponent(t)}/event-stream`;console.log(`[PROJECT_SSE] Connecting to ${r}`),this.eventSource=new EventSource(r),this.eventSource.onmessage=o=>{try{let i=JSON.parse(o.data),m=le$1(i);if(!m)return;m instanceof V&&(console.log("[PROJECT_SSE] ThreadUpdateEvent \u2014 refreshing thread list"),this.threadState.refreshThreadList());}catch(i){console.warn("[PROJECT_SSE] Failed to parse event:",i);}},this.eventSource.onerror=()=>{this.eventSource?.readyState===EventSource.CLOSED&&(console.warn(`[PROJECT_SSE] Connection closed for ${t}, reconnecting in ${e}ms`),this.eventSource=null,setTimeout(()=>{this.currentProject===t&&this.connect(t,Math.min(e*2,6e4));},e));};}disconnect(){this.eventSource&&(this.eventSource.close(),this.eventSource=null,console.log(`[PROJECT_SSE] Disconnected from project ${this.currentProject}`)),this.currentProject=null;}ngOnDestroy(){this.disconnect(),this.destroy$.next(),this.destroy$.complete();}static \u0275fac=function(e){return new(e||n)};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};var ce=(n,t)=>t.key,de=(n,t)=>t.status,le=(n,t)=>t.id;function pe(n,t){n&1&&Ag(0,"mat-spinner",6);}function me(n,t){n&1&&(Cs(0,"mat-icon"),JC(1,"add"),hl());}function ue(n,t){if(n&1&&(Cs(0,"span",16),JC(1),hl()),n&2){let e=CC().$implicit,r=CC();sI(),em(r.filterCounts()[e.key]);}}function ge(n,t){if(n&1){let e=vC();Cs(0,"button",15),Lg("click",function(){let o=Sf(e).$implicit,i=CC();return _f(i.setFilter(o.key))}),Cs(1,"mat-icon",10),JC(2),hl(),Cs(3,"span"),JC(4),hl(),aC(5,ue,2,1,"span",16),hl();}if(n&2){let e=t.$implicit,r=CC();qg("active",r.activeFilter()===e.key),Ng("aria-selected",r.activeFilter()===e.key),sI(2),em(e.icon),sI(2),em(e.label),sI(),cC(r.filterCounts()[e.key]>0?5:-1);}}function _e(n,t){n&1&&(Cs(0,"div",12),Ag(1,"mat-spinner",17),Cs(2,"p"),JC(3,"Loading tasks\u2026"),hl()());}function fe(n,t){if(n&1){let e=vC();Cs(0,"p"),JC(1,"No tasks yet. Start your first one!"),hl(),Cs(2,"button",19),Lg("click",function(){Sf(e);let o=CC(2);return _f(o.createTask())}),Cs(3,"mat-icon"),JC(4,"add"),hl(),JC(5," New Task "),hl();}}function he(n,t){n&1&&(Cs(0,"p"),JC(1,"No tasks in this category."),hl());}function ke(n,t){if(n&1&&(Cs(0,"div",13)(1,"mat-icon",18),JC(2,"rocket_launch"),hl(),aC(3,fe,6,0)(4,he,2,0,"p"),hl()),n&2){let e=CC();sI(3),cC(e.activeFilter()==="all"?3:4);}}function ve(n,t){if(n&1){let e=vC();Cs(0,"app-task-card",25),Lg("stopRequested",function(o){Sf(e);let i=CC(3);return _f(i.onStopRequested(o))})("deleteRequested",function(o){Sf(e);let i=CC(3);return _f(i.onDeleteRequested(o))})("starToggled",function(o){Sf(e);let i=CC(3);return _f(i.onStarToggled(o))})("markDoneRequested",function(o){Sf(e);let i=CC(3);return _f(i.onMarkDoneRequested(o))})("markActiveRequested",function(o){Sf(e);let i=CC(3);return _f(i.onMarkActiveRequested(o))}),hl();}if(n&2){let e=t.$implicit;xg("task",e);}}function Ce(n,t){if(n&1&&(Cs(0,"section",20)(1,"h2",21)(2,"mat-icon",22),JC(3),hl(),JC(4),Cs(5,"span",23),JC(6),hl()(),Cs(7,"div",14),dC(8,ve,1,1,"app-task-card",24,le),hl()()),n&2){let e=t.$implicit;sI(3),em(e.icon),sI(),Dl(" ",e.label," "),sI(2),em(e.tasks.length),sI(2),fC(e.tasks);}}function be(n,t){if(n&1&&dC(0,Ce,10,3,"section",20,de),n&2){let e=CC();fC(e.taskGroups());}}function ye(n,t){if(n&1){let e=vC();Cs(0,"app-task-card",25),Lg("stopRequested",function(o){Sf(e);let i=CC(2);return _f(i.onStopRequested(o))})("deleteRequested",function(o){Sf(e);let i=CC(2);return _f(i.onDeleteRequested(o))})("starToggled",function(o){Sf(e);let i=CC(2);return _f(i.onStarToggled(o))})("markDoneRequested",function(o){Sf(e);let i=CC(2);return _f(i.onMarkDoneRequested(o))})("markActiveRequested",function(o){Sf(e);let i=CC(2);return _f(i.onMarkActiveRequested(o))}),hl();}if(n&2){let e=t.$implicit;xg("task",e);}}function xe(n,t){if(n&1&&(Cs(0,"div",14),dC(1,ye,1,1,"app-task-card",24,le),hl()),n&2){let e=CC();sI(),fC(e.filteredTasks());}}var Te=[{key:"all",label:"All",icon:"grid_view"},{key:"waiting-you",label:"Waiting for you",icon:"mark_unread_chat_alt"},{key:"in-progress",label:"In progress",icon:"pending"},{key:"paused",label:"Paused",icon:"pause_circle"},{key:"done",label:"Done",icon:"check_circle"}],se=class n{router=g(G);projectState=g(P);threadState=g(U);threadApi=g(N);taskStatus=g(R);userService=g(pe$1);projectApi=g(c);destroyRef=g(Ce$1);_projectEventStream=g(F);filters=Te;activeFilter=Wi("all");starredOnly=Wi(false);isCreating=Wi(false);isLoadingList=F$1(this.threadState.isLoadingThreadList$,{initialValue:false});username=F$1(this.userService.username$,{initialValue:null});allTasks=this.taskStatus.tasks;filteredTasks=TT(()=>{let t=this.activeFilter(),e=this.username(),r=this.allTasks();return this.starredOnly()&&e&&(r=r.filter(o=>o.starring.includes(e))),t==="all"?r:r.filter(o=>o.status===t)});filterCounts=TT(()=>{let t=this.username(),e=this.allTasks();return this.starredOnly()&&t&&(e=e.filter(r=>r.starring.includes(t))),{all:e.length,"waiting-you":e.filter(r=>r.status==="waiting-you").length,"in-progress":e.filter(r=>r.status==="in-progress").length,paused:e.filter(r=>r.status==="paused").length,done:e.filter(r=>r.status==="done").length}});taskGroups=TT(()=>{let t=this.username(),e=this.allTasks();this.starredOnly()&&t&&(e=e.filter(o=>o.starring.includes(t)));let r=[{status:"waiting-you",label:"Waiting for you",icon:"mark_unread_chat_alt",tasks:[]},{status:"in-progress",label:"In progress",icon:"pending",tasks:[]},{status:"done",label:"Done",icon:"check_circle",tasks:[]},{status:"paused",label:"Paused",icon:"pause_circle",tasks:[]},{status:"error",label:"Error",icon:"error",tasks:[]}];for(let o of e){let i=r.find(m=>m.status===o.status);i&&i.tasks.push(o);}return r.filter(o=>o.tasks.length>0)});ngOnInit(){this.userService.fetchCurrentUser().pipe(U$1(this.destroyRef)).subscribe({error:t=>console.warn("[TASK-CONTROL] Could not fetch user:",t)});}setFilter(t){this.activeFilter.set(t);}toggleStarredFilter(){this.starredOnly.update(t=>!t);}createTask(){let t=this.projectState.getSelectedProjectId();!t||this.isCreating()||(this.isCreating.set(true),this.threadApi.createThread().pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.isCreating.set(false),this.router.navigate(["project",t,"thread",e.thread.id]);},error:e=>{console.error("[TASK-CONTROL] Failed to create thread:",e),this.isCreating.set(false);}}));}onStopRequested(t){this.threadApi.stopThread(t).pipe(U$1(this.destroyRef)).subscribe({error:e=>console.error("[TASK-CONTROL] Failed to stop thread:",e)});}onDeleteRequested(t){this.threadApi.deleteThread(t).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.threadState.refreshThreadList(),error:e=>console.error("[TASK-CONTROL] Failed to delete thread:",e)});}onStarToggled(t){let e=this.username();if(!e)return;let r=this.allTasks().find(m=>m.id===t);if(!r)return;let o=r.starring.includes(e),i=o?this.threadApi.unstarThread(t):this.threadApi.starThread(t);this.threadState.updateStarLocal(t,!o,e),i.pipe(U$1(this.destroyRef)).subscribe({error:m=>{console.error("[TASK-CONTROL] Failed to toggle star:",m),this.threadState.refreshThreadList();}});}onMarkDoneRequested(t){let e=this.projectState.getSelectedProjectId();e&&this.projectApi.markThreadDone(e,t).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.threadState.refreshThreadList(),error:r=>console.error("[TASK-CONTROL] Failed to mark task as done:",r)});}onMarkActiveRequested(t){let e=this.projectState.getSelectedProjectId();e&&this.projectApi.markThreadActive(e,t).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.threadState.refreshThreadList(),error:r=>console.error("[TASK-CONTROL] Failed to mark task as active:",r)});}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=jw({type:n,selectors:[["app-task-control"]],decls:25,vars:6,consts:[[1,"task-control"],[1,"tc-header"],[1,"tc-title-row"],[1,"tc-title"],[1,"title-icon"],["mat-flat-button","","aria-label","Start a new task",1,"new-task-btn",3,"click","disabled"],["diameter","16"],["role","tablist","aria-label","Filter tasks",1,"tc-filters"],["role","tab",1,"filter-chip",3,"active"],["role","switch","aria-label","Show starred tasks only",1,"filter-chip","starred-filter",3,"click"],[1,"filter-icon"],[1,"tc-grid-wrapper"],[1,"tc-loading"],[1,"tc-empty"],[1,"tc-grid"],["role","tab",1,"filter-chip",3,"click"],[1,"filter-badge"],["diameter","40"],[1,"empty-icon"],["mat-flat-button","",1,"new-task-btn",3,"click"],[1,"tc-group"],[1,"tc-group-title"],[1,"group-icon"],[1,"group-count"],[3,"task"],[3,"stopRequested","deleteRequested","starToggled","markDoneRequested","markActiveRequested","task"]],template:function(e,r){e&1&&(Cs(0,"app-sidenav")(1,"div",0)(2,"header",1)(3,"div",2)(4,"h1",3)(5,"mat-icon",4),JC(6,"rocket_launch"),hl(),JC(7," Task Control "),hl(),Cs(8,"button",5),Lg("click",function(){return r.createTask()}),aC(9,pe,1,0,"mat-spinner",6)(10,me,2,0,"mat-icon"),JC(11," New Task "),hl()(),Cs(12,"nav",7),dC(13,ge,6,6,"button",8,ce),Cs(15,"button",9),Lg("click",function(){return r.toggleStarredFilter()}),Cs(16,"mat-icon",10),JC(17,"star"),hl(),Cs(18,"span"),JC(19,"Starred"),hl()()()(),Cs(20,"main",11),aC(21,_e,4,0,"div",12)(22,ke,5,1,"div",13)(23,be,2,0)(24,xe,3,0,"div",14),hl()()()),e&2&&(sI(8),xg("disabled",r.isCreating()),sI(),cC(r.isCreating()?9:10),sI(4),fC(r.filters),sI(2),qg("active",r.starredOnly()),Ng("aria-checked",r.starredOnly()),sI(6),cC(r.isLoadingList()?21:r.filteredTasks().length===0?22:r.activeFilter()==="all"?23:24));},dependencies:[A,St,yt,wt,hr,pr,Et,yt$1],styles:[".glass-panel[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow)}.glass-interactive[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);transition:all .3s cubic-bezier(.4,0,.2,1)}.glass-interactive[_ngcontent-%COMP%]:hover{transform:translateY(-2px);box-shadow:0 12px 40px #00000026}.glass-interactive[_ngcontent-%COMP%]:active{transform:translateY(0)}.glass-card[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);border-radius:20px;padding:1.5rem}.glass-button[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);transition:all .3s cubic-bezier(.4,0,.2,1)}.glass-button[_ngcontent-%COMP%]:hover{transform:translateY(-2px);box-shadow:0 12px 40px #00000026}.glass-button[_ngcontent-%COMP%]:active{transform:translateY(0)}.glass-button[_ngcontent-%COMP%]{border-radius:12px;padding:.75rem 1.5rem;font-weight:600;cursor:pointer}.glass-button[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed;transform:none}.glass-button[_ngcontent-%COMP%]:disabled:hover{transform:none}.smooth-theme-transition[_ngcontent-%COMP%]{transition:background .3s ease,color .3s ease,border-color .3s ease,box-shadow .3s ease}[_nghost-%COMP%]{display:flex;height:100vh;width:100%;overflow:hidden}.task-control[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%;overflow:hidden;padding:1.5rem;gap:1.25rem;box-sizing:border-box}.tc-header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;flex-shrink:0}.tc-title-row[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:1rem}.tc-title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text)}.tc-title[_ngcontent-%COMP%] .title-icon[_ngcontent-%COMP%]{font-size:1.5rem;width:1.5rem;height:1.5rem;color:var(--color-primary)}.new-task-btn[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;background:var(--color-primary);color:var(--color-text-inverse);border-radius:12px;font-weight:600;padding:0 1rem;height:36px;flex-shrink:0}.new-task-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.1rem;width:1.1rem;height:1.1rem}.new-task-btn[_ngcontent-%COMP%] mat-spinner[_ngcontent-%COMP%]{display:inline-block}.tc-filters[_ngcontent-%COMP%]{display:flex;gap:.5rem;flex-wrap:wrap}.filter-chip[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);display:flex;align-items:center;gap:.375rem;padding:.375rem .875rem;border-radius:100px;font-size:.8rem;font-weight:500;color:var(--color-text-secondary);cursor:pointer;border:1px solid var(--color-border);transition:background .15s ease,color .15s ease,border-color .15s ease;white-space:nowrap}.filter-chip[_ngcontent-%COMP%] .filter-icon[_ngcontent-%COMP%]{font-size:.9rem;width:.9rem;height:.9rem}.filter-chip[_ngcontent-%COMP%] .filter-badge[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-text-inverse);border-radius:100px;padding:0 .375rem;font-size:.7rem;font-weight:700;min-width:18px;text-align:center;line-height:18px}.filter-chip.active[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-text-inverse);border-color:var(--color-primary)}.filter-chip.active[_ngcontent-%COMP%] .filter-icon[_ngcontent-%COMP%]{color:var(--color-text-inverse)}.filter-chip.active[_ngcontent-%COMP%] .filter-badge[_ngcontent-%COMP%]{background:#ffffff4d;color:var(--color-text-inverse)}.filter-chip[_ngcontent-%COMP%]:hover:not(.active){background:var(--color-bg-hover);color:var(--color-text)}.starred-filter.active[_ngcontent-%COMP%]{background:#f5a62326;border-color:#f5a623;color:#f5a623}.starred-filter.active[_ngcontent-%COMP%] .filter-icon[_ngcontent-%COMP%]{color:#f5a623}.tc-group[_ngcontent-%COMP%]{margin-bottom:1.5rem}.tc-group[_ngcontent-%COMP%]:last-child{margin-bottom:0}.tc-group-title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin:0 0 .75rem;font-size:.85rem;font-weight:600;color:var(--color-text-secondary);text-transform:uppercase;letter-spacing:.05em}.tc-group-title[_ngcontent-%COMP%] .group-icon[_ngcontent-%COMP%]{font-size:1rem;width:1rem;height:1rem}.tc-group-title[_ngcontent-%COMP%] .group-count[_ngcontent-%COMP%]{background:var(--color-bg-hover);border-radius:100px;padding:0 .375rem;font-size:.75rem;font-weight:700;min-width:18px;text-align:center;line-height:18px}.tc-grid-wrapper[_ngcontent-%COMP%]{flex:1;overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--color-border) transparent}.tc-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:1rem;padding-bottom:1rem}@media(max-width:600px){.tc-grid[_ngcontent-%COMP%]{grid-template-columns:1fr}}.tc-loading[_ngcontent-%COMP%], .tc-empty[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1rem;height:100%;min-height:240px;color:var(--color-text-secondary);text-align:center}.tc-loading[_ngcontent-%COMP%] p[_ngcontent-%COMP%], .tc-empty[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;font-size:.95rem}.empty-icon[_ngcontent-%COMP%]{font-size:3rem;width:3rem;height:3rem;opacity:.3}"]})};export{se as TaskControlComponent};
@@ -1 +0,0 @@
1
- import {S as St}from'./chunk-CIfgFQUQ.js';import {an as ue,g,L,ao as V,G,I as N$1,ap as _d,j as jw,aq as a,ar as S,as as F,at as c,k as Cs,n as Lg,o as aC,m as hl,x as xg,u as sI,v as cC,H as Hg,M as MC,B as NC,au as uv,ae as kt,av as dt,Y as x,aw as gl,J as JC,ax as ml,a8 as em,a9 as vC,aa as Sf,ac as CC,ab as _f,A as Ag}from'./main-JTU33H5D.js';import {a as at,s as st,r as rt,_ as _i}from'./chunk-Byin_63d.js';import'./chunk-CjPIJIB-.js';import {G as Ge}from'./chunk-B52iVZ-n.js';import'./chunk-BK_05kmN.js';import'./chunk-7-d3g3_Q.js';import'./chunk-XBakzM_b.js';import'./chunk-I8YepFsn.js';import'./chunk-4XIlyOr9.js';import'./chunk-DeXXr4BL.js';import'./chunk-DK1hp0WW.js';import'./chunk-DuXr-yGB.js';var T=class o{welcomeMessages=["Welcome to Coday","Bienvenue sur Coday","Bienvenido a Coday","Willkommen bei Coday","Benvenuto su Coday","Bem-vindo ao Coday","Welkom bij Coday","\u0414\u043E\u0431\u0440\u043E \u043F\u043E\u0436\u0430\u043B\u043E\u0432\u0430\u0442\u044C \u0432 Coday","Coday \u3078\u3088\u3046\u3053\u305D","\u6B22\u8FCE\u6765\u5230 Coday","Coday \uC5D0 \uC624\uC2E0 \uAC83\uC744 \uD658\uC601\uD569\uB2C8\uB2E4","\u0645\u0631\u062D\u0628\u064B\u0627 \u0628\u0643 \u0641\u064A Coday"];currentWelcomeIndex=0;currentWelcomeMessage=this.welcomeMessages[0];welcomeRotationInterval;ngOnInit(){this.startWelcomeRotation();}ngOnDestroy(){this.stopWelcomeRotation();}startWelcomeRotation(){this.welcomeRotationInterval=window.setInterval(()=>{this.currentWelcomeIndex=(this.currentWelcomeIndex+1)%this.welcomeMessages.length,this.currentWelcomeMessage=this.welcomeMessages[this.currentWelcomeIndex];},3e3);}stopWelcomeRotation(){this.welcomeRotationInterval&&(clearInterval(this.welcomeRotationInterval),this.welcomeRotationInterval=void 0);}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=jw({type:o,selectors:[["app-welcome-message"]],decls:2,vars:1,consts:[[1,"welcome-title"]],template:function(t,i){t&1&&(gl(0,"h1",0),JC(1),ml()),t&2&&(sI(),em(i.currentWelcomeMessage));},styles:[".welcome-title[_ngcontent-%COMP%]{font-size:clamp(1.5rem,4vw,4rem);font-weight:700;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% auto;background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;animation:_ngcontent-%COMP%_gradientShift 3s ease-in-out infinite;margin:0;padding:0;line-height:1.2;transition:opacity .5s ease-in-out;display:block;min-height:1.2em;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@keyframes _ngcontent-%COMP%_gradientShift{0%{background-position:0% center}50%{background-position:100% center}to{background-position:0% center}}"],changeDetection:1})};var N=class o{destroy$=new ue;isSetup=false;codayService=g(Ge);preferencesService=g(L);setup(){if(this.isSetup){console.warn("[AGENT-NOTIFICATION] Service already set up");return}console.log("[AGENT-NOTIFICATION] Setting up agent notification service"),this.codayService.isThinking$.pipe(_d(this.destroy$),uv(),kt(([e,t])=>e===true&&t===false)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Agent stopped thinking, notifying task finished"),this.notifyTaskFinishedIfEnabled();}),this.preferencesService.browserNotificationEnabled$.pipe(_d(this.destroy$),uv(),kt(([e,t])=>e===false&&t===true)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Browser notifications enabled, checking permission"),this.handleBrowserNotificationEnabled();}),this.isSetup=true;}notifyTaskFinishedIfEnabled(){this.preferencesService.getAgentNotificationEnabled()&&(this.preferencesService.getNotificationSoundEnabled()&&this.playCompletionSound(),this.preferencesService.getBrowserNotificationEnabled()&&this.sendBrowserNotification());}playCompletionSound(){try{let e=new(window.AudioContext||window.webkitAudioContext),t=e.createOscillator(),i=e.createGain();t.connect(i),i.connect(e.destination),t.frequency.setValueAtTime(700,e.currentTime),i.gain.setValueAtTime(.1,e.currentTime),i.gain.exponentialRampToValueAtTime(.01,e.currentTime+.08),t.start(e.currentTime),t.stop(e.currentTime+.08);let n=e.createOscillator(),r=e.createGain();n.connect(r),r.connect(e.destination);let l=e.currentTime+.11;n.frequency.setValueAtTime(950,l),r.gain.setValueAtTime(.1,l),r.gain.exponentialRampToValueAtTime(.01,l+.09),n.start(l),n.stop(l+.09),console.log("[AGENT-NOTIFICATION] Completion sound played");}catch(e){console.error("[AGENT-NOTIFICATION] Failed to play completion sound:",e);}}handleBrowserNotificationEnabled(){return dt(this,null,function*(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications"),this.preferencesService.setBrowserNotificationEnabled(false);return}if(Notification.permission==="denied"){console.warn("[AGENT-NOTIFICATION] Permission denied, disabling browser notifications"),this.preferencesService.setBrowserNotificationEnabled(false);return}if(Notification.permission==="granted"){console.log("[AGENT-NOTIFICATION] Permission already granted, showing confirmation"),this.createConfirmationNotification();return}try{(yield Notification.requestPermission())==="granted"?(console.log("[AGENT-NOTIFICATION] Permission granted, showing confirmation"),this.createConfirmationNotification()):(console.log("[AGENT-NOTIFICATION] Permission denied or dismissed"),this.preferencesService.setBrowserNotificationEnabled(!1));}catch(e){console.error("[AGENT-NOTIFICATION] Error requesting permission:",e),this.preferencesService.setBrowserNotificationEnabled(false);}})}sendBrowserNotification(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications");return}if(document.hasFocus()){console.warn("[AGENT-NOTIFICATION] Document is focused, skipping browser notification");return}Notification.permission==="granted"?this.createTaskCompleteNotification():console.warn("[AGENT-NOTIFICATION] Permission not granted, cannot send notification");}createConfirmationNotification(){let e=new Notification("Coday - Notifications Enabled",{body:"You will be notified when the agent completes tasks",icon:"/favicon.ico",tag:"coday-notifications-enabled",requireInteraction:false});setTimeout(()=>e.close(),4e3),e.onclick=()=>{window.focus(),e.close();},console.log("[AGENT-NOTIFICATION] Confirmation notification sent");}createTaskCompleteNotification(){let e=new Notification("Coday - Task Complete",{body:"The agent has finished and is waiting for your input",icon:"/favicon.ico",tag:"coday-task-complete",requireInteraction:false});setTimeout(()=>e.close(),5e3),e.onclick=()=>{window.focus(),e.close();},console.log("[AGENT-NOTIFICATION] Task complete notification sent");}ngOnDestroy(){console.log("[AGENT-NOTIFICATION] Service destroyed"),this.destroy$.next(),this.destroy$.complete();}static \u0275fac=function(t){return new(t||o)};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};var Z=["inputSection"];function ee(o,e){if(o&1){let t=vC();Cs(0,"app-thread",4),Lg("chatFocused",function(){Sf(t);let n=CC();return _f(n.onChatFocusedOnMobile())})("drawerStateChange",function(n){Sf(t);let r=CC();return _f(r.onDrawerStateChange(n))}),hl();}if(o&2){let t=CC();xg("projectName",t.projectName)("threadId",t.threadId);}}function te(o,e){if(o&1){let t=vC();Cs(0,"div",5),Ag(1,"app-welcome-message"),hl(),Cs(2,"div",6,0)(4,"div",7)(5,"div",8)(6,"app-chat-textarea",9),Lg("messageSubmitted",function(n){Sf(t);let r=CC();return _f(r.onMessageSubmitted(n))})("voiceMessageReady",function(n){Sf(t);let r=CC();return _f(r.onVoiceMessageReady(n))})("voiceRecordingToggled",function(n){Sf(t);let r=CC();return _f(r.onVoiceToggled(n))})("heightChanged",function(n){Sf(t);let r=CC();return _f(r.onInputHeightChanged(n))})("textareaFocused",function(){Sf(t);let n=CC();return _f(n.onChatFocusedOnMobile())}),hl()()()();}if(o&2){let t=CC();sI(6),xg("isDisabled",t.isSessionInitializing)("isSessionInitializing",t.isSessionInitializing)("showWelcome",true)("isThinking",false)("isStarting",t.isStartingFirstMessage);}}var K=class o{destroy$=new ue;inputSection;sidenav;projectName="";threadId=null;isSessionInitializing=false;isStartingFirstMessage=false;inputSectionHeight=80;codayService=g(Ge);titleService=g(at);preferencesService=g(L);route=g(V);router=g(G);threadApiService=g(N$1);agentNotificationService=g(N);firstMessageState=g(st);constructor(){console.log("[MAIN-APP] Using new thread-based architecture (no clientId needed)");}ngOnInit(){this.agentNotificationService.setup(),this.setupPrintHandlers(),this.route.params.pipe(_d(this.destroy$)).subscribe(e=>{let t=e.projectName,i=e.threadId||null;console.log("[MAIN-APP] Route params updated:",{project:t,thread:i,previousProject:this.projectName,previousThread:this.threadId}),this.projectName=t,this.threadId=i,this.threadId?console.log("[MAIN-APP] Thread selected - ThreadComponent will display"):(console.log("[MAIN-APP] No thread selected - showing welcome view"),this.initializeWelcomeView());});}initializeWelcomeView(){this.codayService.setTabTitleService(this.titleService);}ngAfterViewInit(){setTimeout(()=>this.updateInputSectionHeight(),100);}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),window.removeEventListener("beforeprint",this.handleBeforePrint),window.removeEventListener("afterprint",this.handleAfterPrint);}onMessageSubmitted(e){console.log("[MAIN-APP] First message submitted from welcome view:",e),this.isSessionInitializing=true,this.isStartingFirstMessage=true,this.threadApiService.createThread().subscribe({next:t=>{console.log("[MAIN-APP] Thread created:",t.thread.id),this.firstMessageState.setPendingFirstMessage(e),this.router.navigate(["project",this.projectName,"thread",t.thread.id]);},error:t=>{console.error("[MAIN-APP] Failed to create thread:",t),this.isSessionInitializing=false,this.isStartingFirstMessage=false,alert("Failed to create conversation: "+(t.message||"Unknown error"));}});}onVoiceToggled(e){console.log("[VOICE] Recording in welcome view:",e);}onVoiceMessageReady(e){console.log("[MAIN-APP] Voice message ready from welcome view"),this.isSessionInitializing=true,this.isStartingFirstMessage=true,this.threadApiService.createThread().subscribe({next:t=>{console.log("[MAIN-APP] Thread created for voice message:",t.thread.id),this.firstMessageState.setPendingVoiceMessage(e),this.router.navigate(["project",this.projectName,"thread",t.thread.id]);},error:t=>{console.error("[MAIN-APP] Failed to create thread for voice message:",t),this.isSessionInitializing=false,this.isStartingFirstMessage=false,alert("Failed to create conversation: "+(t.message||"Unknown error"));}});}isDrawerOpen=false;onDrawerStateChange(e){this.isDrawerOpen=e;}onChatFocusedOnMobile(){window.innerWidth<1024&&this.sidenav?.close();}onInputHeightChanged(e){console.log("[MAIN-APP] Input height changed:",e),this.inputSectionHeight=e;}updateInputSectionHeight(){if(this.inputSection?.nativeElement){let e=this.inputSection.nativeElement.offsetHeight;e!==this.inputSectionHeight&&(console.log("[MAIN-APP] Input section height updated:",e),this.inputSectionHeight=e);}}setupPrintHandlers(){window.addEventListener("beforeprint",this.handleBeforePrint),window.addEventListener("afterprint",this.handleAfterPrint);}handleBeforePrint=()=>{console.log("[PRINT] Before print event triggered");let e=this.preferencesService.getPrintTechnicalMessages();console.log("[PRINT] Print technical messages:",e),e?document.body.classList.add("print-include-technical"):document.body.classList.remove("print-include-technical");};handleAfterPrint=()=>{console.log("[PRINT] After print event triggered"),document.body.classList.remove("print-include-technical");};static \u0275fac=function(t){return new(t||o)};static \u0275cmp=jw({type:o,selectors:[["app-main"]],viewQuery:function(t,i){if(t&1&&Hg(Z,5)(St,5),t&2){let n;MC(n=NC())&&(i.inputSection=n.first),MC(n=NC())&&(i.sidenav=n.first);}},decls:4,vars:2,consts:[["inputSection",""],[3,"drawerOpen"],[1,"app",3,"mousedown","touchstart"],[3,"projectName","threadId"],[3,"chatFocused","drawerStateChange","projectName","threadId"],[1,"welcome-section"],[1,"input-section"],[1,"input-center"],[1,"input-glass"],[3,"messageSubmitted","voiceMessageReady","voiceRecordingToggled","heightChanged","textareaFocused","isDisabled","isSessionInitializing","showWelcome","isThinking","isStarting"]],template:function(t,i){t&1&&(Cs(0,"app-sidenav",1)(1,"div",2),Lg("mousedown",function(){return i.onChatFocusedOnMobile()})("touchstart",function(){return i.onChatFocusedOnMobile()}),aC(2,ee,1,2,"app-thread",3)(3,te,7,5),hl()()),t&2&&(xg("drawerOpen",i.isDrawerOpen),sI(2),cC(i.threadId?2:3));},dependencies:[rt,_i,T,St],styles:["[_nghost-%COMP%]{display:flex;height:100vh;width:100%;overflow:hidden;justify-content:center}.app[_ngcontent-%COMP%]{width:100%;max-width:100%;min-width:0;height:100%;display:flex;flex-direction:column;background:var(--color-bg);color:var(--color-text);transition:all .3s ease;position:relative;justify-content:center;overflow:hidden}.chat-wrapper[_ngcontent-%COMP%]{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;background:transparent;width:100%;padding:2.5rem 0 1.5rem;display:flex;justify-content:center}.chat-wrapper[_ngcontent-%COMP%] .chat-center[_ngcontent-%COMP%]{max-width:760px;width:100%;margin:0;padding:0 2rem}@media(max-width:768px){.chat-wrapper[_ngcontent-%COMP%] .chat-center[_ngcontent-%COMP%]{padding:0 1rem}}.welcome-section[_ngcontent-%COMP%]{flex-shrink:0;text-align:center;padding:2rem 1rem;animation:_ngcontent-%COMP%_fadeInUp .8s ease-out;display:flex;justify-content:center;align-items:center;width:100%;min-width:0;overflow:hidden}@keyframes _ngcontent-%COMP%_fadeInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.input-section[_ngcontent-%COMP%]{flex-shrink:0;position:relative;border-top:none;background:transparent;box-shadow:none;padding:2.5rem 0 2rem;overflow-y:visible;max-height:none;width:100%;z-index:10;pointer-events:none;display:flex;justify-content:center}.input-center[_ngcontent-%COMP%]{max-width:760px;width:100%;margin:0;padding:0 2rem;display:flex;justify-content:center;align-items:end;position:relative;pointer-events:auto}@media(max-width:768px){.input-center[_ngcontent-%COMP%]{padding:0 1rem}}.input-glass[_ngcontent-%COMP%]{background:none;box-shadow:none;width:100%;min-height:64px;display:flex;align-items:stretch;gap:0;pointer-events:auto;position:relative;overflow:visible}.input-glass[_ngcontent-%COMP%] app-chat-textarea[_ngcontent-%COMP%]{width:100%;min-width:0;flex:1 1 auto;align-self:stretch;display:flex}body.dark[_nghost-%COMP%], body.dark [_nghost-%COMP%], [_ngcontent-%COMP%]:root[data-theme=dark] .input-glass[_ngcontent-%COMP%]{background:#24283073;border-color:#b4c8ff17;box-shadow:0 8px 32px #0000002b,0 1.5px 8px #00000012}.choice-overlay[_ngcontent-%COMP%]{z-index:10;width:100%;display:flex;justify-content:center;align-items:center}.upload-status[_ngcontent-%COMP%]{position:fixed;bottom:100px;left:50%;transform:translate(-50%);z-index:1000;display:flex;align-items:center;padding:12px 20px;background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);border-radius:16px;font-size:.9em;color:var(--color-text);box-shadow:var(--glass-shadow);max-width:300px;text-align:center}.upload-status.error[_ngcontent-%COMP%]{background:#ff3b3026;color:var(--color-error);border-color:#ff3b304d}@media(max-width:768px){.welcome-section[_ngcontent-%COMP%]{padding:1.5rem 1rem}.input-section[_ngcontent-%COMP%]{padding:1.5rem .75rem 1rem}.input-center[_ngcontent-%COMP%]{padding:0 .5rem}}@media print{[_nghost-%COMP%]{display:block!important;height:auto!important;overflow:visible!important}.app[_ngcontent-%COMP%]{height:auto!important;overflow:visible!important;display:block!important}.input-section[_ngcontent-%COMP%], .welcome-section[_ngcontent-%COMP%]{display:none!important}}"],data:{animation:[a("slideIn",[S(":enter",[F({transform:"translateY(100%)",opacity:0}),c("300ms ease-out",F({transform:"translateY(0)",opacity:1}))]),S(":leave",[c("200ms ease-in",F({transform:"translateY(100%)",opacity:0}))])])]},changeDetection:1})};export{K as MainAppComponent};