@whoz-oss/coday-client 0.116.0 → 0.117.1

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.
@@ -1 +1 @@
1
- import{a as O,b as P}from"./chunk-FMBLR6NH.js";import{a as E}from"./chunk-FZVCANBC.js";import{a as k}from"./chunk-JCQFYRAF.js";import{w as x}from"./chunk-4NNLWDVJ.js";import"./chunk-5MXEOOQM.js";import"./chunk-AE24ERN3.js";import{a as S}from"./chunk-55ETGHKC.js";import{a as v,b as y,c as M}from"./chunk-NSSFL3WG.js";import"./chunk-H5JAF7XP.js";import"./chunk-2DVVHRX4.js";import"./chunk-VVZKXHDD.js";import{$a as u,Ea as p,Sa as g,Ta as b,Ya as f,Za as t,_a as n,ga as s,ib as l,kb as C,ua as c,yb as o,zb as h}from"./chunk-TRUXCA4C.js";var r=()=>!0;var T=[{path:"",loadComponent:()=>import("./chunk-4SMKZ2HA.js").then(e=>e.AgentosShellComponent),children:[{path:"",loadComponent:()=>import("./chunk-SPAN622B.js").then(e=>e.LayoutComponent),children:[{path:"namespaces/new",canActivate:[r],loadComponent:()=>import("./chunk-5JA4YMVL.js").then(e=>e.NamespaceFormComponent)},{path:"namespaces/:namespaceId/edit",canActivate:[r],loadComponent:()=>import("./chunk-5JA4YMVL.js").then(e=>e.NamespaceFormComponent)},{path:"namespaces",canActivate:[r],loadComponent:()=>import("./chunk-6XQBGSR4.js").then(e=>e.NamespaceListComponent)},{path:":namespaceId/cases",canActivate:[r],loadComponent:()=>import("./chunk-AWTXRCO7.js").then(e=>e.CaseListComponent)},{path:":namespaceId/integrations/new",canActivate:[r],loadComponent:()=>import("./chunk-MN73E3JO.js").then(e=>e.IntegrationFormComponent)},{path:":namespaceId/integrations/:integrationId/edit",canActivate:[r],loadComponent:()=>import("./chunk-MN73E3JO.js").then(e=>e.IntegrationFormComponent)},{path:":namespaceId/integrations",canActivate:[r],loadComponent:()=>import("./chunk-HGEXTRZ7.js").then(e=>e.NamespaceIntegrationsComponent)},{path:":namespaceId/cases/:caseId",canActivate:[r],loadComponent:()=>import("./chunk-B2QVH3K3.js").then(e=>e.CaseChatComponent)},{path:"me",canActivate:[r],loadComponent:()=>import("./chunk-6WUBJOTP.js").then(e=>e.UserProfileComponent)},{path:"",redirectTo:"namespaces",pathMatch:"full"}]}]}];function A(e,m){if(e&1&&(t(0,"p",11),o(1," Last action: "),t(2,"strong"),o(3),n()()),e&2){let a=C();c(3),h(a.lastAction())}}var _=class e{lastAction=s(null);onSend(){this.lastAction.set("send")}onStop(){this.lastAction.set("stop")}onAttach(){this.lastAction.set("attach")}static \u0275fac=function(a){return new(a||e)};static \u0275cmp=p({type:e,selectors:[["agentos-hello"]],decls:35,vars:2,consts:[[1,"hello-agentos"],[1,"card"],[1,"badge"],[1,"principles"],[1,"demo"],[1,"demo-label"],[1,"demo-buttons"],["icon","send","variant","primary","title","Send",3,"action"],["icon","stop","variant","danger","title","Stop",3,"action"],["icon","attach_file","variant","default","title","Attach",3,"action"],["icon","mic","variant","default","title","Record",3,"action","disabled"],[1,"demo-feedback"]],template:function(a,i){a&1&&(t(0,"div",0)(1,"div",1)(2,"div",2),o(3,"AgentOS UI"),n(),t(4,"h1"),o(5,"Hello AgentOS"),n(),t(6,"p"),o(7," This component lives in "),t(8,"code"),o(9,"libs/agentos-ui"),n(),o(10," \u2014 isolated from Coday internals, ready to be published as "),t(11,"code"),o(12,"@whoz-oss/agentos-ui"),n(),o(13,". "),n(),u(14,"agentos-backend-status"),t(15,"ul",3)(16,"li"),o(17,"\u2726 No imports from Coday app"),n(),t(18,"li"),o(19,"\u2726 CSS custom properties as host contract"),n(),t(20,"li"),o(21,"\u2726 Standalone Angular components"),n(),t(22,"li"),o(23,"\u2726 Signals-first reactive state"),n()(),t(24,"div",4)(25,"p",5),o(26,"ds-icon-button from "),t(27,"code"),o(28,"@whoz-oss/design-system"),n()(),t(29,"div",6)(30,"ds-icon-button",7),l("action",function(){return i.onSend()}),n(),t(31,"ds-icon-button",8),l("action",function(){return i.onStop()}),n(),t(32,"ds-icon-button",9),l("action",function(){return i.onAttach()}),n(),t(33,"ds-icon-button",10),l("action",function(){return i.onAttach()}),n()(),g(34,A,4,1,"p",11),n()()()),a&2&&(c(33),f("disabled",!0),c(),b(i.lastAction()?34:-1))},dependencies:[x,v],styles:['@charset "UTF-8";.hello-agentos[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;min-height:100vh;padding:2rem}.card[_ngcontent-%COMP%]{background:var(--glass-bg, rgba(255, 255, 255, .72));border:1px solid var(--glass-border, rgba(255, 255, 255, .18));box-shadow:var(--glass-shadow, 0 8px 32px 0 rgba(31, 38, 135, .15));backdrop-filter:var(--glass-backdrop-blur, blur(20px));-webkit-backdrop-filter:var(--glass-backdrop-blur, blur(20px));border-radius:20px;padding:3rem;max-width:480px;width:100%;text-align:center}.badge[_ngcontent-%COMP%]{display:inline-block;background:var(--color-primary, #007aff);color:var(--color-text-inverse, #ffffff);font-size:.75rem;font-weight:600;letter-spacing:.08em;text-transform:uppercase;padding:.25rem .75rem;border-radius:100px;margin-bottom:1.5rem}h1[_ngcontent-%COMP%]{color:var(--color-text, #1d1d1f);font-size:2rem;font-weight:700;margin:0 0 1rem;letter-spacing:-.02em}p[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);line-height:1.6;margin:0 0 1.5rem}p[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{background:var(--color-code-bg, rgba(142, 142, 147, .12));color:var(--color-code-text, #ff375f);padding:.125rem .375rem;border-radius:6px;font-size:.875em;border:1px solid var(--color-border, rgba(0, 0, 0, .1))}.principles[_ngcontent-%COMP%]{list-style:none;margin:0 0 1.5rem;padding:0;text-align:left;display:flex;flex-direction:column;gap:.5rem}.principles[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;padding:.5rem .75rem;background:var(--color-bg-hover, rgba(0, 0, 0, .04));border-radius:8px;border:1px solid var(--color-border-light, rgba(40, 40, 40, .08))}.demo[_ngcontent-%COMP%]{border-top:1px solid var(--color-border-light, rgba(40, 40, 40, .08));padding-top:1.25rem}.demo[_ngcontent-%COMP%] .demo-label[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.8rem;margin:0 0 .75rem}.demo[_ngcontent-%COMP%] .demo-label[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{background:var(--color-code-bg, rgba(142, 142, 147, .12));color:var(--color-code-text, #ff375f);padding:.125rem .375rem;border-radius:6px;font-size:.875em;border:1px solid var(--color-border, rgba(0, 0, 0, .1))}.demo[_ngcontent-%COMP%] .demo-buttons[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:center;justify-content:center;padding:.75rem;background:var(--color-bg-hover, rgba(0, 0, 0, .04));border-radius:12px;border:1px solid var(--color-border-light, rgba(40, 40, 40, .08))}.demo[_ngcontent-%COMP%] .demo-feedback[_ngcontent-%COMP%]{margin:.75rem 0 0;font-size:.85rem;color:var(--color-text-secondary, #6e6e73)}.demo[_ngcontent-%COMP%] .demo-feedback[_ngcontent-%COMP%] strong[_ngcontent-%COMP%]{color:var(--color-primary, #007aff)}']})};export{T as AGENTOS_ROUTES,S as AgentosShellComponent,v as BackendStatusComponent,k as CaseChatComponent,E as CaseListComponent,y as HeaderComponent,_ as HelloAgentosComponent,M as LayoutComponent,O as NamespaceItemComponent,P as NamespaceListComponent,r as agentosReadyGuard};
1
+ import{a as O,b as P}from"./chunk-FMBLR6NH.js";import{a as E}from"./chunk-FZVCANBC.js";import{a as k}from"./chunk-JCQFYRAF.js";import{w as x}from"./chunk-4NNLWDVJ.js";import"./chunk-5MXEOOQM.js";import"./chunk-AE24ERN3.js";import{a as S}from"./chunk-55ETGHKC.js";import{a as v,b as y,c as M}from"./chunk-NSSFL3WG.js";import"./chunk-H5JAF7XP.js";import"./chunk-2DVVHRX4.js";import"./chunk-VVZKXHDD.js";import{$a as u,Ea as p,Sa as g,Ta as b,Ya as f,Za as t,_a as n,ga as s,ib as l,kb as C,ua as c,yb as o,zb as h}from"./chunk-TRUXCA4C.js";var r=()=>!0;var T=[{path:"",loadComponent:()=>import("./chunk-4SMKZ2HA.js").then(e=>e.AgentosShellComponent),children:[{path:"",loadComponent:()=>import("./chunk-SPAN622B.js").then(e=>e.LayoutComponent),children:[{path:"namespaces/new",canActivate:[r],loadComponent:()=>import("./chunk-5JA4YMVL.js").then(e=>e.NamespaceFormComponent)},{path:"namespaces/:namespaceId/edit",canActivate:[r],loadComponent:()=>import("./chunk-5JA4YMVL.js").then(e=>e.NamespaceFormComponent)},{path:"namespaces",canActivate:[r],loadComponent:()=>import("./chunk-6XQBGSR4.js").then(e=>e.NamespaceListComponent)},{path:":namespaceId/cases",canActivate:[r],loadComponent:()=>import("./chunk-AWTXRCO7.js").then(e=>e.CaseListComponent)},{path:":namespaceId/integrations/new",canActivate:[r],loadComponent:()=>import("./chunk-W6CHMIAC.js").then(e=>e.IntegrationFormComponent)},{path:":namespaceId/integrations/:integrationId/edit",canActivate:[r],loadComponent:()=>import("./chunk-W6CHMIAC.js").then(e=>e.IntegrationFormComponent)},{path:":namespaceId/integrations",canActivate:[r],loadComponent:()=>import("./chunk-HGEXTRZ7.js").then(e=>e.NamespaceIntegrationsComponent)},{path:":namespaceId/cases/:caseId",canActivate:[r],loadComponent:()=>import("./chunk-B2QVH3K3.js").then(e=>e.CaseChatComponent)},{path:"me",canActivate:[r],loadComponent:()=>import("./chunk-6WUBJOTP.js").then(e=>e.UserProfileComponent)},{path:"",redirectTo:"namespaces",pathMatch:"full"}]}]}];function A(e,m){if(e&1&&(t(0,"p",11),o(1," Last action: "),t(2,"strong"),o(3),n()()),e&2){let a=C();c(3),h(a.lastAction())}}var _=class e{lastAction=s(null);onSend(){this.lastAction.set("send")}onStop(){this.lastAction.set("stop")}onAttach(){this.lastAction.set("attach")}static \u0275fac=function(a){return new(a||e)};static \u0275cmp=p({type:e,selectors:[["agentos-hello"]],decls:35,vars:2,consts:[[1,"hello-agentos"],[1,"card"],[1,"badge"],[1,"principles"],[1,"demo"],[1,"demo-label"],[1,"demo-buttons"],["icon","send","variant","primary","title","Send",3,"action"],["icon","stop","variant","danger","title","Stop",3,"action"],["icon","attach_file","variant","default","title","Attach",3,"action"],["icon","mic","variant","default","title","Record",3,"action","disabled"],[1,"demo-feedback"]],template:function(a,i){a&1&&(t(0,"div",0)(1,"div",1)(2,"div",2),o(3,"AgentOS UI"),n(),t(4,"h1"),o(5,"Hello AgentOS"),n(),t(6,"p"),o(7," This component lives in "),t(8,"code"),o(9,"libs/agentos-ui"),n(),o(10," \u2014 isolated from Coday internals, ready to be published as "),t(11,"code"),o(12,"@whoz-oss/agentos-ui"),n(),o(13,". "),n(),u(14,"agentos-backend-status"),t(15,"ul",3)(16,"li"),o(17,"\u2726 No imports from Coday app"),n(),t(18,"li"),o(19,"\u2726 CSS custom properties as host contract"),n(),t(20,"li"),o(21,"\u2726 Standalone Angular components"),n(),t(22,"li"),o(23,"\u2726 Signals-first reactive state"),n()(),t(24,"div",4)(25,"p",5),o(26,"ds-icon-button from "),t(27,"code"),o(28,"@whoz-oss/design-system"),n()(),t(29,"div",6)(30,"ds-icon-button",7),l("action",function(){return i.onSend()}),n(),t(31,"ds-icon-button",8),l("action",function(){return i.onStop()}),n(),t(32,"ds-icon-button",9),l("action",function(){return i.onAttach()}),n(),t(33,"ds-icon-button",10),l("action",function(){return i.onAttach()}),n()(),g(34,A,4,1,"p",11),n()()()),a&2&&(c(33),f("disabled",!0),c(),b(i.lastAction()?34:-1))},dependencies:[x,v],styles:['@charset "UTF-8";.hello-agentos[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;min-height:100vh;padding:2rem}.card[_ngcontent-%COMP%]{background:var(--glass-bg, rgba(255, 255, 255, .72));border:1px solid var(--glass-border, rgba(255, 255, 255, .18));box-shadow:var(--glass-shadow, 0 8px 32px 0 rgba(31, 38, 135, .15));backdrop-filter:var(--glass-backdrop-blur, blur(20px));-webkit-backdrop-filter:var(--glass-backdrop-blur, blur(20px));border-radius:20px;padding:3rem;max-width:480px;width:100%;text-align:center}.badge[_ngcontent-%COMP%]{display:inline-block;background:var(--color-primary, #007aff);color:var(--color-text-inverse, #ffffff);font-size:.75rem;font-weight:600;letter-spacing:.08em;text-transform:uppercase;padding:.25rem .75rem;border-radius:100px;margin-bottom:1.5rem}h1[_ngcontent-%COMP%]{color:var(--color-text, #1d1d1f);font-size:2rem;font-weight:700;margin:0 0 1rem;letter-spacing:-.02em}p[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);line-height:1.6;margin:0 0 1.5rem}p[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{background:var(--color-code-bg, rgba(142, 142, 147, .12));color:var(--color-code-text, #ff375f);padding:.125rem .375rem;border-radius:6px;font-size:.875em;border:1px solid var(--color-border, rgba(0, 0, 0, .1))}.principles[_ngcontent-%COMP%]{list-style:none;margin:0 0 1.5rem;padding:0;text-align:left;display:flex;flex-direction:column;gap:.5rem}.principles[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;padding:.5rem .75rem;background:var(--color-bg-hover, rgba(0, 0, 0, .04));border-radius:8px;border:1px solid var(--color-border-light, rgba(40, 40, 40, .08))}.demo[_ngcontent-%COMP%]{border-top:1px solid var(--color-border-light, rgba(40, 40, 40, .08));padding-top:1.25rem}.demo[_ngcontent-%COMP%] .demo-label[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.8rem;margin:0 0 .75rem}.demo[_ngcontent-%COMP%] .demo-label[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{background:var(--color-code-bg, rgba(142, 142, 147, .12));color:var(--color-code-text, #ff375f);padding:.125rem .375rem;border-radius:6px;font-size:.875em;border:1px solid var(--color-border, rgba(0, 0, 0, .1))}.demo[_ngcontent-%COMP%] .demo-buttons[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:center;justify-content:center;padding:.75rem;background:var(--color-bg-hover, rgba(0, 0, 0, .04));border-radius:12px;border:1px solid var(--color-border-light, rgba(40, 40, 40, .08))}.demo[_ngcontent-%COMP%] .demo-feedback[_ngcontent-%COMP%]{margin:.75rem 0 0;font-size:.85rem;color:var(--color-text-secondary, #6e6e73)}.demo[_ngcontent-%COMP%] .demo-feedback[_ngcontent-%COMP%] strong[_ngcontent-%COMP%]{color:var(--color-primary, #007aff)}']})};export{T as AGENTOS_ROUTES,S as AgentosShellComponent,v as BackendStatusComponent,k as CaseChatComponent,E as CaseListComponent,y as HeaderComponent,_ as HelloAgentosComponent,M as LayoutComponent,O as NamespaceItemComponent,P as NamespaceListComponent,r as agentosReadyGuard};
@@ -0,0 +1 @@
1
+ import{x as Q}from"./chunk-4NNLWDVJ.js";import"./chunk-5MXEOOQM.js";import{D as H,c as B,e as u,g as L,h as j,i as G,l as C,n as J,s as A,u as $,v as q,w as K,x as U}from"./chunk-AE24ERN3.js";import{c as R,d as z}from"./chunk-2DVVHRX4.js";import{a as M,b as I}from"./chunk-VVZKXHDD.js";import{$a as h,Ab as V,Ea as P,Qb as D,Ra as T,Sa as b,T as c,Ta as y,Wa as w,X as f,Xa as E,Y as _,Ya as s,Za as i,_a as o,a as S,b as O,ba as k,ga as d,gb as v,ib as p,kb as g,rc as F,tc as N,ua as l,yb as r,zb as x}from"./chunk-TRUXCA4C.js";function Y(a,t){a&1&&(i(0,"p",5),r(1,"Loading\u2026"),o())}function Z(a,t){if(a&1&&(i(0,"option",13),r(1),o()),a&2){let e=t.$implicit;s("value",e.type),l(),x(e.displayName)}}function ee(a,t){if(a&1){let e=v();i(0,"div",18)(1,"ds-json-schema-form",22),p("valueChange",function(m){f(e);let X=g(2);return _(X.onParamsChange(m))}),o()()}if(a&2){let e=g(2);l(),s("schema",t)("value",e.initialParams())}}function te(a,t){if(a&1){let e=v();i(0,"form",7),p("ngSubmit",function(){f(e);let m=g();return _(m.submit())}),i(1,"div",8)(2,"label",9),r(3,"Type "),i(4,"span",10),r(5,"*"),o()(),i(6,"select",11)(7,"option",12),r(8,"Select type"),o(),w(9,Z,2,2,"option",13,T().trackByType,!0),o()(),i(11,"div",8)(12,"label",14),r(13,"Name "),i(14,"span",10),r(15,"*"),o()(),h(16,"input",15),o(),i(17,"div",8)(18,"label",16),r(19,"Description"),o(),h(20,"textarea",17),o(),b(21,ee,2,2,"div",18),i(22,"div",19)(23,"button",20),r(24),o(),i(25,"button",21),p("click",function(){f(e);let m=g();return _(m.cancel())}),r(26,"Cancel"),o()()()}if(a&2){let e,n=g();s("formGroup",n.form),l(6),s("formControl",n.typeControl),l(3),E(n.integrationTypes()),l(7),s("formControl",n.nameControl),l(4),s("formControl",n.descriptionControl),l(),y((e=n.schema())?21:-1,e),l(2),s("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),l(),V(" ",n.isEditMode()?"Save changes":"Create"," ")}}var W=class a{route=c(F);router=c(N);destroyRef=c(k);integrationConfigController=c(R);integrationTypeController=c(z);namespaceId=this.route.snapshot.params.namespaceId;form=new G({name:new C("",{nonNullable:!0,validators:[u.required,u.minLength(1)]}),description:new C(null),type:new C("",{nonNullable:!0,validators:[u.required]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get typeControl(){return this.form.controls.type}isEditMode=d(!1);isSubmitting=d(!1);isLoading=d(!1);paramsValue=d(null);initialParams=d(null);integrationTypes=I(this.integrationTypeController.listTypesIntegrationType(),{initialValue:[]});selectedType=I(this.form.controls.type.valueChanges,{initialValue:this.form.controls.type.value});schema=D(()=>{let t=this.selectedType();return t?this.integrationTypes().find(n=>n.type===t)?.configSchema??null:null});existingConfig=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("integrationId");t&&(this.isEditMode.set(!0),this.loadConfig(t))}loadConfig(t){this.isLoading.set(!0),this.integrationConfigController.getByIdIntegrationConfig(t).pipe(M(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.typeControl.setValue(e.integrationType),this.initialParams.set(e.parameters),this.paramsValue.set(e.parameters),this.isLoading.set(!1)},error:()=>{this.isLoading.set(!1),this.navigateBack()}})}onParamsChange(t){this.paramsValue.set(t)}submit(){if(this.nameControl.invalid||this.typeControl.invalid||this.isSubmitting())return;this.isSubmitting.set(!0),(this.isEditMode()?this.integrationConfigController.updateIntegrationConfig(this.existingConfig.id??"",O(S({},this.existingConfig),{name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||null,integrationType:this.typeControl.value,parameters:this.paramsValue()})):this.integrationConfigController.createIntegrationConfig({name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||null,integrationType:this.typeControl.value,namespaceId:this.namespaceId,parameters:this.paramsValue()})).pipe(M(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(!1)})}cancel(){this.navigateBack()}navigateBack(){this.router.navigate(["/agentos",this.namespaceId,"integrations"])}trackByType(t,e){return e.type}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=P({type:a,selectors:[["agentos-integration-form"]],decls:10,vars:2,consts:[[1,"integration-form"],[1,"integration-form__header"],["type","button","title","Back to integrations",1,"integration-form__back",3,"click"],[1,"integration-form__back-icon"],[1,"integration-form__title"],[1,"integration-form__loading"],[1,"integration-form__form",3,"formGroup"],[1,"integration-form__form",3,"ngSubmit","formGroup"],[1,"integration-form__field"],["for","integration-type",1,"integration-form__label"],["aria-hidden","true"],["id","integration-type",1,"integration-form__select",3,"formControl"],["value","","disabled",""],[3,"value"],["for","integration-name",1,"integration-form__label"],["id","integration-name","type","text","placeholder","Integration name","autocomplete","off",1,"integration-form__input",3,"formControl"],["for","integration-description",1,"integration-form__label"],["id","integration-description","placeholder","Optional description","rows","3",1,"integration-form__textarea",3,"formControl"],[1,"integration-form__schema-form"],[1,"integration-form__actions"],["type","submit",1,"integration-form__btn","integration-form__btn--primary",3,"disabled"],["type","button",1,"integration-form__btn",3,"click"],[3,"valueChange","schema","value"]],template:function(e,n){e&1&&(i(0,"div",0)(1,"header",1)(2,"button",2),p("click",function(){return n.cancel()}),i(3,"span",3),r(4,"\u2190"),o(),r(5," Integrations "),o(),i(6,"h1",4),r(7),o()(),b(8,Y,2,0,"p",5)(9,te,27,7,"form",6),o()),e&2&&(l(7),x(n.isEditMode()?"Edit integration":"New integration"),l(),y(n.isLoading()?8:9))},dependencies:[H,J,K,U,B,q,L,j,A,$,Q],styles:[".integration-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.integration-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.integration-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}.integration-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.integration-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.integration-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.integration-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.integration-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.integration-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.integration-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text, #1d1d1f)}.integration-form__input[_ngcontent-%COMP%], .integration-form__textarea[_ngcontent-%COMP%], .integration-form__select[_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}.integration-form__input[_ngcontent-%COMP%]:focus, .integration-form__textarea[_ngcontent-%COMP%]:focus, .integration-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.integration-form__input[_ngcontent-%COMP%]::placeholder, .integration-form__textarea[_ngcontent-%COMP%]::placeholder, .integration-form__select[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.integration-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:4.5rem;line-height:1.5}.integration-form__select[_ngcontent-%COMP%]{cursor:pointer}.integration-form__select[_ngcontent-%COMP%] option[disabled][_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73)}.integration-form__schema-form[_ngcontent-%COMP%]{padding:1rem;border-radius:10px;border:1px solid var(--color-border-light, rgba(0, 0, 0, .06));background:var(--glass-bg, rgba(255, 255, 255, .5));-webkit-backdrop-filter:var(--glass-backdrop-blur, blur(20px));backdrop-filter:var(--glass-backdrop-blur, blur(20px))}.integration-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.integration-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}.integration-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.integration-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.integration-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.integration-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"],changeDetection:0})};export{W as IntegrationFormComponent};
@@ -13,5 +13,5 @@
13
13
  <style>:root{--color-bg:linear-gradient(135deg, #fafbfc 0%, #f5f6f8 100%);--color-bg-solid:#fafbfc;--color-bg-secondary:rgba(255, 255, 255, .7);--color-bg-secondary-rgb:255 255 255;--color-text:#1d1d1f;--color-text-secondary:#6e6e73;--color-text-inverse:#ffffff;--color-primary:#007aff;--color-primary-hover:#0051d5;--color-accent:#8b5cf6;--color-link:#007aff;--color-border:rgba(0, 0, 0, .1);--color-border-light:rgba(40, 40, 40, .08);--color-input-bg:rgba(255, 255, 255, .8);--color-success:#34c759;--color-error:#ff3b30;--color-warning:#ff9500;--color-info:#5ac8fa;--color-message-user:rgba(0, 122, 255, .1);--color-message-ai:rgba(255, 255, 255, .8);--color-code-bg:rgba(142, 142, 147, .12);--color-code-text:#ff375f;--color-bg-hover:rgba(0, 0, 0, .04);--glass-bg:rgba(255, 255, 255, .72);--glass-border:rgba(255, 255, 255, .18);--glass-shadow:0 8px 32px 0 rgba(31, 38, 135, .15);--glass-backdrop-blur:blur(20px);--color-modal-bg:#ffffff;--color-modal-border:rgba(0, 0, 0, .12);--color-modal-shadow:0 8px 40px rgba(0, 0, 0, .18), 0 2px 8px rgba(0, 0, 0, .1);--color-shadow:rgba(0, 0, 0, .08);--color-overlay:rgba(0, 0, 0, .4)}@media print{html,body,app-root{height:auto!important;max-height:none!important;min-height:auto!important;overflow:visible!important;position:static!important}body{background:#fff!important;color:#000!important;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif!important;font-size:11pt;line-height:1.6;padding:1rem!important}*{animation:none!important;transition:none!important;box-shadow:none!important;text-shadow:none!important}}*{box-sizing:border-box}html{color-scheme:light}html{--mat-sys-background:light-dark(#faf9fd, #121316);--mat-sys-error:light-dark(#ba1a1a, #ffb4ab);--mat-sys-error-container:light-dark(#ffdad6, #93000a);--mat-sys-inverse-on-surface:light-dark(#f2f0f4, #2f3033);--mat-sys-inverse-primary:light-dark(#abc7ff, #005cbb);--mat-sys-inverse-surface:light-dark(#2f3033, #e3e2e6);--mat-sys-on-background:light-dark(#1a1b1f, #e3e2e6);--mat-sys-on-error:light-dark(#ffffff, #690005);--mat-sys-on-error-container:light-dark(#93000a, #ffdad6);--mat-sys-on-primary:light-dark(#ffffff, #002f65);--mat-sys-on-primary-container:light-dark(#00458f, #d7e3ff);--mat-sys-on-primary-fixed:light-dark(#001b3f, #001b3f);--mat-sys-on-primary-fixed-variant:light-dark(#00458f, #00458f);--mat-sys-on-secondary:light-dark(#ffffff, #283041);--mat-sys-on-secondary-container:light-dark(#3e4759, #dae2f9);--mat-sys-on-secondary-fixed:light-dark(#131c2b, #131c2b);--mat-sys-on-secondary-fixed-variant:light-dark(#3e4759, #3e4759);--mat-sys-on-surface:light-dark(#1a1b1f, #e3e2e6);--mat-sys-on-surface-variant:light-dark(#44474e, #e0e2ec);--mat-sys-on-tertiary:light-dark(#ffffff, #002f65);--mat-sys-on-tertiary-container:light-dark(#00458f, #d7e3ff);--mat-sys-on-tertiary-fixed:light-dark(#001b3f, #001b3f);--mat-sys-on-tertiary-fixed-variant:light-dark(#00458f, #00458f);--mat-sys-outline:light-dark(#74777f, #8e9099);--mat-sys-outline-variant:light-dark(#c4c6d0, #44474e);--mat-sys-primary:light-dark(#005cbb, #abc7ff);--mat-sys-primary-container:light-dark(#d7e3ff, #00458f);--mat-sys-primary-fixed:light-dark(#d7e3ff, #d7e3ff);--mat-sys-primary-fixed-dim:light-dark(#abc7ff, #abc7ff);--mat-sys-scrim:light-dark(#000000, #000000);--mat-sys-secondary:light-dark(#565e71, #bec6dc);--mat-sys-secondary-container:light-dark(#dae2f9, #3e4759);--mat-sys-secondary-fixed:light-dark(#dae2f9, #dae2f9);--mat-sys-secondary-fixed-dim:light-dark(#bec6dc, #bec6dc);--mat-sys-shadow:light-dark(#000000, #000000);--mat-sys-surface:light-dark(#faf9fd, #121316);--mat-sys-surface-bright:light-dark(#faf9fd, #38393c);--mat-sys-surface-container:light-dark(#efedf0, #1f2022);--mat-sys-surface-container-high:light-dark(#e9e7eb, #292a2c);--mat-sys-surface-container-highest:light-dark(#e3e2e6, #343537);--mat-sys-surface-container-low:light-dark(#f4f3f6, #1a1b1f);--mat-sys-surface-container-lowest:light-dark(#ffffff, #0d0e11);--mat-sys-surface-dim:light-dark(#dbd9dd, #121316);--mat-sys-surface-tint:light-dark(#005cbb, #abc7ff);--mat-sys-surface-variant:light-dark(#e0e2ec, #44474e);--mat-sys-tertiary:light-dark(#005cbb, #abc7ff);--mat-sys-tertiary-container:light-dark(#d7e3ff, #00458f);--mat-sys-tertiary-fixed:light-dark(#d7e3ff, #d7e3ff);--mat-sys-tertiary-fixed-dim:light-dark(#abc7ff, #abc7ff);--mat-sys-neutral-variant20:#2d3038;--mat-sys-neutral10:#1a1b1f;--mat-sys-level0:0px 0px 0px 0px rgba(0, 0, 0, .2), 0px 0px 0px 0px rgba(0, 0, 0, .14), 0px 0px 0px 0px rgba(0, 0, 0, .12);--mat-sys-level1:0px 2px 1px -1px rgba(0, 0, 0, .2), 0px 1px 1px 0px rgba(0, 0, 0, .14), 0px 1px 3px 0px rgba(0, 0, 0, .12);--mat-sys-level2:0px 3px 3px -2px rgba(0, 0, 0, .2), 0px 3px 4px 0px rgba(0, 0, 0, .14), 0px 1px 8px 0px rgba(0, 0, 0, .12);--mat-sys-level3:0px 3px 5px -1px rgba(0, 0, 0, .2), 0px 6px 10px 0px rgba(0, 0, 0, .14), 0px 1px 18px 0px rgba(0, 0, 0, .12);--mat-sys-level4:0px 5px 5px -3px rgba(0, 0, 0, .2), 0px 8px 10px 1px rgba(0, 0, 0, .14), 0px 3px 14px 2px rgba(0, 0, 0, .12);--mat-sys-level5:0px 7px 8px -4px rgba(0, 0, 0, .2), 0px 12px 17px 2px rgba(0, 0, 0, .14), 0px 5px 22px 4px rgba(0, 0, 0, .12);--mat-sys-body-large:400 1rem / 1.5rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-body-large-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-body-large-line-height:1.5rem;--mat-sys-body-large-size:1rem;--mat-sys-body-large-tracking:.031rem;--mat-sys-body-large-weight:400;--mat-sys-body-medium:400 .875rem / 1.25rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-body-medium-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-body-medium-line-height:1.25rem;--mat-sys-body-medium-size:.875rem;--mat-sys-body-medium-tracking:.016rem;--mat-sys-body-medium-weight:400;--mat-sys-body-small:400 .75rem / 1rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-body-small-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-body-small-line-height:1rem;--mat-sys-body-small-size:.75rem;--mat-sys-body-small-tracking:.025rem;--mat-sys-body-small-weight:400;--mat-sys-display-large:400 3.562rem / 4rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-display-large-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-display-large-line-height:4rem;--mat-sys-display-large-size:3.562rem;--mat-sys-display-large-tracking:-.016rem;--mat-sys-display-large-weight:400;--mat-sys-display-medium:400 2.812rem / 3.25rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-display-medium-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-display-medium-line-height:3.25rem;--mat-sys-display-medium-size:2.812rem;--mat-sys-display-medium-tracking:0;--mat-sys-display-medium-weight:400;--mat-sys-display-small:400 2.25rem / 2.75rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-display-small-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-display-small-line-height:2.75rem;--mat-sys-display-small-size:2.25rem;--mat-sys-display-small-tracking:0;--mat-sys-display-small-weight:400;--mat-sys-headline-large:400 2rem / 2.5rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-headline-large-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-headline-large-line-height:2.5rem;--mat-sys-headline-large-size:2rem;--mat-sys-headline-large-tracking:0;--mat-sys-headline-large-weight:400;--mat-sys-headline-medium:400 1.75rem / 2.25rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-headline-medium-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-headline-medium-line-height:2.25rem;--mat-sys-headline-medium-size:1.75rem;--mat-sys-headline-medium-tracking:0;--mat-sys-headline-medium-weight:400;--mat-sys-headline-small:400 1.5rem / 2rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-headline-small-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-headline-small-line-height:2rem;--mat-sys-headline-small-size:1.5rem;--mat-sys-headline-small-tracking:0;--mat-sys-headline-small-weight:400;--mat-sys-label-large:500 .875rem / 1.25rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-label-large-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-label-large-line-height:1.25rem;--mat-sys-label-large-size:.875rem;--mat-sys-label-large-tracking:.006rem;--mat-sys-label-large-weight:500;--mat-sys-label-large-weight-prominent:700;--mat-sys-label-medium:500 .75rem / 1rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-label-medium-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-label-medium-line-height:1rem;--mat-sys-label-medium-size:.75rem;--mat-sys-label-medium-tracking:.031rem;--mat-sys-label-medium-weight:500;--mat-sys-label-medium-weight-prominent:700;--mat-sys-label-small:500 .688rem / 1rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-label-small-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-label-small-line-height:1rem;--mat-sys-label-small-size:.688rem;--mat-sys-label-small-tracking:.031rem;--mat-sys-label-small-weight:500;--mat-sys-title-large:400 1.375rem / 1.75rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-title-large-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-title-large-line-height:1.75rem;--mat-sys-title-large-size:1.375rem;--mat-sys-title-large-tracking:0;--mat-sys-title-large-weight:400;--mat-sys-title-medium:500 1rem / 1.5rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-title-medium-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-title-medium-line-height:1.5rem;--mat-sys-title-medium-size:1rem;--mat-sys-title-medium-tracking:.009rem;--mat-sys-title-medium-weight:500;--mat-sys-title-small:500 .875rem / 1.25rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-title-small-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-title-small-line-height:1.25rem;--mat-sys-title-small-size:.875rem;--mat-sys-title-small-tracking:.006rem;--mat-sys-title-small-weight:500;--mat-sys-corner-extra-large:28px;--mat-sys-corner-extra-large-top:28px 28px 0 0;--mat-sys-corner-extra-small:4px;--mat-sys-corner-extra-small-top:4px 4px 0 0;--mat-sys-corner-full:9999px;--mat-sys-corner-large:16px;--mat-sys-corner-large-end:0 16px 16px 0;--mat-sys-corner-large-start:16px 0 0 16px;--mat-sys-corner-large-top:16px 16px 0 0;--mat-sys-corner-medium:12px;--mat-sys-corner-none:0;--mat-sys-corner-small:8px;--mat-sys-dragged-state-layer-opacity:.16;--mat-sys-focus-state-layer-opacity:.12;--mat-sys-hover-state-layer-opacity:.08;--mat-sys-pressed-state-layer-opacity:.12;--mat-snack-bar-container-shape:transparent;--mat-snack-bar-container-color:transparent;--mat-snack-bar-supporting-text-color:var(--color-text)}html,body{margin:0;padding:0;width:100%;height:100%}body{background:var(--color-bg);color:var(--color-text);font-family:-apple-system,BlinkMacSystemFont,SF Pro Display,Segoe UI,Helvetica Neue,Arial,sans-serif;transition:background .3s ease,color .3s ease;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;padding:0!important}</style><link rel="stylesheet" href="styles-7E3CGANH.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles-7E3CGANH.css"></noscript></head>
14
14
  <body>
15
15
  <app-root></app-root>
16
- <link rel="modulepreload" href="chunk-ISPDD5IG.js"><link rel="modulepreload" href="chunk-6F5GPHWV.js"><link rel="modulepreload" href="chunk-3QJA3PD3.js"><link rel="modulepreload" href="chunk-H72Z2LX3.js"><link rel="modulepreload" href="chunk-OUZFS4TC.js"><link rel="modulepreload" href="chunk-4NNLWDVJ.js"><link rel="modulepreload" href="chunk-5MXEOOQM.js"><link rel="modulepreload" href="chunk-L72BYLQX.js"><link rel="modulepreload" href="chunk-AE24ERN3.js"><link rel="modulepreload" href="chunk-2DVVHRX4.js"><script src="polyfills-2FSRUXKO.js" type="module"></script><script src="main-RAKQ5E3N.js" type="module"></script></body>
16
+ <link rel="modulepreload" href="chunk-ISPDD5IG.js"><link rel="modulepreload" href="chunk-6F5GPHWV.js"><link rel="modulepreload" href="chunk-3QJA3PD3.js"><link rel="modulepreload" href="chunk-H72Z2LX3.js"><link rel="modulepreload" href="chunk-OUZFS4TC.js"><link rel="modulepreload" href="chunk-4NNLWDVJ.js"><link rel="modulepreload" href="chunk-5MXEOOQM.js"><link rel="modulepreload" href="chunk-L72BYLQX.js"><link rel="modulepreload" href="chunk-AE24ERN3.js"><link rel="modulepreload" href="chunk-2DVVHRX4.js"><script src="polyfills-2FSRUXKO.js" type="module"></script><script src="main-HAHNWM6R.js" type="module"></script></body>
17
17
  </html>
@@ -358,4 +358,4 @@ This action cannot be undone once you post another message.`)&&(console.log("[CH
358
358
  `],encapsulation:2,changeDetection:0})}return i})(),Qo=(()=>{class i extends Ni{static \u0275fac=(()=>{let t;return function(r){return(t||(t=kr(i)))(r||i)}})();static \u0275cmp=I({type:i,selectors:[["mat-sidenav-content"]],hostAttrs:[1,"mat-drawer-content","mat-sidenav-content"],features:[fn([{provide:li,useExisting:i}]),Ui],ngContentSelectors:Ko,decls:1,vars:0,template:function(n,r){n&1&&(rn(),ht(0))},encapsulation:2,changeDetection:0})}return i})(),js=(()=>{class i extends mr{get fixedInViewport(){return this._fixedInViewport}set fixedInViewport(t){this._fixedInViewport=Dn(t)}_fixedInViewport=!1;get fixedTopGap(){return this._fixedTopGap}set fixedTopGap(t){this._fixedTopGap=Oa(t)}_fixedTopGap=0;get fixedBottomGap(){return this._fixedBottomGap}set fixedBottomGap(t){this._fixedBottomGap=Oa(t)}_fixedBottomGap=0;static \u0275fac=(()=>{let t;return function(r){return(t||(t=kr(i)))(r||i)}})();static \u0275cmp=I({type:i,selectors:[["mat-sidenav"]],hostAttrs:[1,"mat-drawer","mat-sidenav"],hostVars:16,hostBindings:function(n,r){n&2&&(Me("tabIndex",r.mode!=="side"?"-1":null)("align",null),Ke("top",r.fixedInViewport?r.fixedTopGap:null,"px")("bottom",r.fixedInViewport?r.fixedBottomGap:null,"px"),Y("mat-drawer-end",r.position==="end")("mat-drawer-over",r.mode==="over")("mat-drawer-push",r.mode==="push")("mat-drawer-side",r.mode==="side")("mat-sidenav-fixed",r.fixedInViewport))},inputs:{fixedInViewport:"fixedInViewport",fixedTopGap:"fixedTopGap",fixedBottomGap:"fixedBottomGap"},exportAs:["matSidenav"],features:[fn([{provide:mr,useExisting:i}]),Ui],ngContentSelectors:Ko,decls:3,vars:0,consts:[["content",""],["cdkScrollable","",1,"mat-drawer-inner-container"]],template:function(n,r){n&1&&(rn(),l(0,"div",1,0),ht(2),c())},dependencies:[li],encapsulation:2,changeDetection:0})}return i})(),Cp=(()=>{class i extends ur{_allDrawers=void 0;_content=void 0;static \u0275fac=(()=>{let t;return function(r){return(t||(t=kr(i)))(r||i)}})();static \u0275cmp=I({type:i,selectors:[["mat-sidenav-container"]],contentQueries:function(n,r,o){if(n&1&&Ea(o,Qo,5)(o,js,5),n&2){let a;ge(a=fe())&&(r._content=a.first),ge(a=fe())&&(r._allDrawers=a)}},hostAttrs:[1,"mat-drawer-container","mat-sidenav-container"],hostVars:2,hostBindings:function(n,r){n&2&&Y("mat-drawer-container-explicit-backdrop",r._backdropOverride)},exportAs:["matSidenavContainer"],features:[fn([{provide:Ls,useExisting:i},{provide:ur,useExisting:i}]),Ui],ngContentSelectors:cf,decls:4,vars:2,consts:[[1,"mat-drawer-backdrop",3,"mat-drawer-shown"],[1,"mat-drawer-backdrop",3,"click"]],template:function(n,r){n&1&&(rn(lf),C(0,df,1,2,"div",0),ht(1),ht(2,1),C(3,pf,2,0,"mat-sidenav-content")),n&2&&(S(r.hasBackdrop?0:-1),p(3),S(r._content?-1:3))},dependencies:[Qo],styles:[mf],encapsulation:2,changeDetection:0})}return i})(),Xo=(()=>{class i{static \u0275fac=function(n){return new(n||i)};static \u0275mod=wt({type:i});static \u0275inj=xt({imports:[Aa,$t,Aa]})}return i})();var xp="mat-badge-content",hf=(()=>{class i{static \u0275fac=function(n){return new(n||i)};static \u0275cmp=I({type:i,selectors:[["ng-component"]],decls:0,vars:0,template:function(n,r){},styles:[`.mat-badge{position:relative}.mat-badge.mat-badge{overflow:visible}.mat-badge-content{position:absolute;text-align:center;display:inline-block;transition:transform 200ms ease-in-out;transform:scale(0.6);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;box-sizing:border-box;pointer-events:none;background-color:var(--mat-badge-background-color, var(--mat-sys-error));color:var(--mat-badge-text-color, var(--mat-sys-on-error));font-family:var(--mat-badge-text-font, var(--mat-sys-label-small-font));font-weight:var(--mat-badge-text-weight, var(--mat-sys-label-small-weight));border-radius:var(--mat-badge-container-shape, var(--mat-sys-corner-full))}.mat-badge-above .mat-badge-content{bottom:100%}.mat-badge-below .mat-badge-content{top:100%}.mat-badge-before .mat-badge-content{right:100%}[dir=rtl] .mat-badge-before .mat-badge-content{right:auto;left:100%}.mat-badge-after .mat-badge-content{left:100%}[dir=rtl] .mat-badge-after .mat-badge-content{left:auto;right:100%}@media(forced-colors: active){.mat-badge-content{outline:solid 1px;border-radius:0}}.mat-badge-disabled .mat-badge-content{background-color:var(--mat-badge-disabled-state-background-color, color-mix(in srgb, var(--mat-sys-error) 38%, transparent));color:var(--mat-badge-disabled-state-text-color, var(--mat-sys-on-error))}.mat-badge-hidden .mat-badge-content{display:none}.ng-animate-disabled .mat-badge-content,.mat-badge-content._mat-animation-noopable{transition:none}.mat-badge-content.mat-badge-active{transform:none}.mat-badge-small .mat-badge-content{width:var(--mat-badge-legacy-small-size-container-size, unset);height:var(--mat-badge-legacy-small-size-container-size, unset);min-width:var(--mat-badge-small-size-container-size, 6px);min-height:var(--mat-badge-small-size-container-size, 6px);line-height:var(--mat-badge-small-size-line-height, 6px);padding:var(--mat-badge-small-size-container-padding, 0);font-size:var(--mat-badge-small-size-text-size, 0);margin:var(--mat-badge-small-size-container-offset, -6px 0)}.mat-badge-small.mat-badge-overlap .mat-badge-content{margin:var(--mat-badge-small-size-container-overlap-offset, -6px)}.mat-badge-medium .mat-badge-content{width:var(--mat-badge-legacy-container-size, unset);height:var(--mat-badge-legacy-container-size, unset);min-width:var(--mat-badge-container-size, 16px);min-height:var(--mat-badge-container-size, 16px);line-height:var(--mat-badge-line-height, 16px);padding:var(--mat-badge-container-padding, 0 4px);font-size:var(--mat-badge-text-size, var(--mat-sys-label-small-size));margin:var(--mat-badge-container-offset, -12px 0)}.mat-badge-medium.mat-badge-overlap .mat-badge-content{margin:var(--mat-badge-container-overlap-offset, -12px)}.mat-badge-large .mat-badge-content{width:var(--mat-badge-legacy-large-size-container-size, unset);height:var(--mat-badge-legacy-large-size-container-size, unset);min-width:var(--mat-badge-large-size-container-size, 16px);min-height:var(--mat-badge-large-size-container-size, 16px);line-height:var(--mat-badge-large-size-line-height, 16px);padding:var(--mat-badge-large-size-container-padding, 0 4px);font-size:var(--mat-badge-large-size-text-size, var(--mat-sys-label-small-size));margin:var(--mat-badge-large-size-container-offset, -12px 0)}.mat-badge-large.mat-badge-overlap .mat-badge-content{margin:var(--mat-badge-large-size-container-overlap-offset, -12px)}
359
359
  `],encapsulation:2,changeDetection:0})}return i})(),wp=(()=>{class i{_ngZone=f(Lt);_elementRef=f(ft);_ariaDescriber=f(jl);_renderer=f(Pr);_animationsDisabled=$r();_idGenerator=f(Fl);get color(){return this._color}set color(t){this._setColor(t),this._color=t}_color="primary";overlap=!0;disabled=!1;position="above after";get content(){return this._content}set content(t){this._updateRenderedContent(t)}_content;get description(){return this._description}set description(t){this._updateDescription(t)}_description;size="medium";hidden=!1;_badgeElement;_inlineBadgeDescription;_isInitialized=!1;_interactivityChecker=f(zr);_document=f(ii);constructor(){let t=f(Al);t.load(hf),t.load(Il)}isAbove(){return this.position.indexOf("below")===-1}isAfter(){return this.position.indexOf("before")===-1}getBadgeElement(){return this._badgeElement}ngOnInit(){this._clearExistingBadges(),this.content&&!this._badgeElement&&(this._badgeElement=this._createBadgeElement(),this._updateRenderedContent(this.content)),this._isInitialized=!0}ngAfterViewInit(){}ngOnDestroy(){this._renderer.destroyNode&&(this._renderer.destroyNode(this._badgeElement),this._inlineBadgeDescription?.remove()),this._ariaDescriber.removeDescription(this._elementRef.nativeElement,this.description)}_isHostInteractive(){return this._interactivityChecker.isFocusable(this._elementRef.nativeElement,{ignoreVisibility:!0})}_createBadgeElement(){let t=this._renderer.createElement("span"),n="mat-badge-active";return t.setAttribute("id",this._idGenerator.getId("mat-badge-content-")),t.setAttribute("aria-hidden","true"),t.classList.add(xp),this._animationsDisabled&&t.classList.add("_mat-animation-noopable"),this._elementRef.nativeElement.appendChild(t),typeof requestAnimationFrame=="function"&&!this._animationsDisabled?this._ngZone.runOutsideAngular(()=>{requestAnimationFrame(()=>{t.classList.add(n)})}):t.classList.add(n),t}_updateRenderedContent(t){let n=`${t??""}`.trim();this._isInitialized&&n&&!this._badgeElement&&(this._badgeElement=this._createBadgeElement()),this._badgeElement&&(this._badgeElement.textContent=n),this._content=n}_updateDescription(t){this._ariaDescriber.removeDescription(this._elementRef.nativeElement,this.description),(!t||this._isHostInteractive())&&this._removeInlineDescription(),this._description=t,this._isHostInteractive()?this._ariaDescriber.describe(this._elementRef.nativeElement,t):this._updateInlineDescription()}_updateInlineDescription(){this._inlineBadgeDescription||(this._inlineBadgeDescription=this._document.createElement("span"),this._inlineBadgeDescription.classList.add("cdk-visually-hidden")),this._inlineBadgeDescription.textContent=this.description,this._badgeElement?.appendChild(this._inlineBadgeDescription)}_removeInlineDescription(){this._inlineBadgeDescription?.remove(),this._inlineBadgeDescription=void 0}_setColor(t){let n=this._elementRef.nativeElement.classList;n.remove(`mat-badge-${this._color}`),t&&n.add(`mat-badge-${t}`)}_clearExistingBadges(){let t=this._elementRef.nativeElement.querySelectorAll(`:scope > .${xp}`);for(let n of Array.from(t))n!==this._badgeElement&&n.remove()}static \u0275fac=function(n){return new(n||i)};static \u0275dir=_l({type:i,selectors:[["","matBadge",""]],hostAttrs:[1,"mat-badge"],hostVars:20,hostBindings:function(n,r){n&2&&Y("mat-badge-overlap",r.overlap)("mat-badge-above",r.isAbove())("mat-badge-below",!r.isAbove())("mat-badge-before",!r.isAfter())("mat-badge-after",r.isAfter())("mat-badge-small",r.size==="small")("mat-badge-medium",r.size==="medium")("mat-badge-large",r.size==="large")("mat-badge-hidden",r.hidden||!r.content)("mat-badge-disabled",r.disabled)},inputs:{color:[0,"matBadgeColor","color"],overlap:[2,"matBadgeOverlap","overlap",Rr],disabled:[2,"matBadgeDisabled","disabled",Rr],position:[0,"matBadgePosition","position"],content:[0,"matBadge","content"],description:[0,"matBadgeDescription","description"],size:[0,"matBadgeSize","size"],hidden:[2,"matBadgeHidden","hidden",Rr]}})}return i})(),Tp=(()=>{class i{static \u0275fac=function(n){return new(n||i)};static \u0275mod=wt({type:i});static \u0275inj=xt({imports:[Nl,$t]})}return i})();var Fi=class i{ATTENTION_EMOJI="\u{1F534}";isSystemActive=!1;systemActiveTimer=null;SYSTEM_ACTIVE_TIMEOUT=4e3;unreadService=f(Ti);project=f(ye);constructor(){this.initializeTitleUpdates()}initializeTitleUpdates(){Pn([this.project.selectedProject$,this.unreadService.unreadCount$]).subscribe(([e,t])=>{this.updateTitle(e?.name??"...",t)})}updateTitle(e,t){let n;this.isSystemActive?n=`\u23F3${t>0?` (${t}) `:" "}${e}`:t>0?n=`${this.ATTENTION_EMOJI} (${t}) ${e}`:n=e,document.title=n,console.log("[TAB-TITLE] Updated to:",n)}setSystemActive(){console.log("[TAB-TITLE] System active - showing hourglass"),this.isSystemActive=!0,this.systemActiveTimer&&clearTimeout(this.systemActiveTimer),this.systemActiveTimer=setTimeout(()=>{console.log("[TAB-TITLE] System active timeout - hiding hourglass"),this.isSystemActive=!1,this.forceUpdateTitle()},this.SYSTEM_ACTIVE_TIMEOUT),this.forceUpdateTitle()}setSystemInactive(){console.log("[TAB-TITLE] System inactive - hiding hourglass"),this.isSystemActive=!1,this.systemActiveTimer&&(clearTimeout(this.systemActiveTimer),this.systemActiveTimer=null),this.forceUpdateTitle()}forceUpdateTitle(){let e=this.project.getSelectedProjectId()??"...",t=this.unreadService.getCurrentCount();this.updateTitle(e,t)}static \u0275fac=function(t){return new(t||i)};static \u0275prov=H({token:i,factory:i.\u0275fac,providedIn:"root"})};var Jo=class i{http=f(rt);maxFileSize=5*1024*1024;supportedTypes=["image/png","image/jpeg","image/gif","image/webp"];validateFile(e){if(!this.supportedTypes.includes(e.type))throw new Error(`Unsupported file type: ${e.type}`);if(e.size>this.maxFileSize)throw new Error(`File too large: ${(e.size/1024/1024).toFixed(1)}MB exceeds 5MB limit`)}fileToBase64(e){return B(this,null,function*(){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let o=r.result;if(!o){n(new Error("Failed to read file"));return}let a=o.split(",")[1];if(!a){n(new Error("Invalid file format"));return}t(a)},r.onerror=n,r.readAsDataURL(e)})})}getUploadUrl(e,t){return`/api/projects/${e}/threads/${t}/upload`}uploadImage(e,t,n){console.log("[IMAGE-UPLOAD] uploadImage - file:",e.name,e.type,e.size),console.log("[IMAGE-UPLOAD] uploadImage - project:",t,"thread:",n);try{console.log("[IMAGE-UPLOAD] Validating file..."),this.validateFile(e)}catch(r){return console.log("[IMAGE-UPLOAD] Validation failed:",r),kn({success:!1,error:r instanceof Error?r.message:"Validation failed"})}return new Er(r=>{console.log("[IMAGE-UPLOAD] Converting to base64..."),this.fileToBase64(e).then(o=>{console.log("[IMAGE-UPLOAD] Base64 length:",o.length),console.log("[IMAGE-UPLOAD] Sending upload request..."),this.http.post(this.getUploadUrl(t,n),{content:o,mimeType:e.type,filename:e.name}).pipe(Ae(a=>(console.log("[IMAGE-UPLOAD] Upload success result:",a),{success:!0,processedSize:a.processedSize,dimensions:a.dimensions})),mn(a=>{console.log("[IMAGE-UPLOAD] Upload failed:",a);let s=a.error?.error||a.message||"Upload failed";return kn({success:!1,error:s})})).subscribe({next:a=>{r.next(a),r.complete()},error:a=>r.error(a)})}).catch(o=>{console.log("[IMAGE-UPLOAD] Base64 conversion failed:",o),r.next({success:!1,error:o instanceof Error?o.message:"Failed to read file"}),r.complete()})})}hasImageFiles(e){if(console.log("[IMAGE-UPLOAD] hasImageFiles - dataTransfer:",e),!e)return console.log("[IMAGE-UPLOAD] hasImageFiles - no dataTransfer"),!1;if(console.log("[IMAGE-UPLOAD] hasImageFiles - types:",Array.from(e.types)),!Array.from(e.types).includes("Files"))return console.log("[IMAGE-UPLOAD] hasImageFiles - no Files type"),!1;let t=Array.from(e.files||[]);console.log("[IMAGE-UPLOAD] hasImageFiles - files:",t.map(r=>({name:r.name,type:r.type})));let n=t.some(r=>this.supportedTypes.includes(r.type));return console.log("[IMAGE-UPLOAD] hasImageFiles - result:",n),n}filterImageFiles(e){return Array.from(e).filter(n=>this.supportedTypes.includes(n.type))}static \u0275fac=function(t){return new(t||i)};static \u0275prov=H({token:i,factory:i.\u0275fac,providedIn:"root"})};var Li=class i{pendingFirstMessage=null;setPendingFirstMessage(e){console.log("[FIRST-MESSAGE-STATE] Storing pending first message:",e.substring(0,50)+"..."),this.pendingFirstMessage=e}consumePendingFirstMessage(){let e=this.pendingFirstMessage;return e?(console.log("[FIRST-MESSAGE-STATE] Consuming pending first message:",e.substring(0,50)+"..."),this.pendingFirstMessage=null):console.log("[FIRST-MESSAGE-STATE] No pending first message to consume"),e}hasPendingFirstMessage(){return this.pendingFirstMessage!==null}clear(){this.pendingFirstMessage&&(console.log("[FIRST-MESSAGE-STATE] Clearing pending first message"),this.pendingFirstMessage=null)}static \u0275fac=function(t){return new(t||i)};static \u0275prov=H({token:i,factory:i.\u0275fac,providedIn:"root"})};var ff=["inputSection"],_f=()=>[];function bf(i,e){if(i&1){let t=O();l(0,"button",20),v("click",function(){x(t);let r=h();return w(r.toggleFileDrawer())}),l(1,"mat-icon"),u(2,"folder_open"),c()()}if(i&2){let t=h();Y("has-files",t.fileCount>0),T("title",vl("Files Exchange",t.fileCount>0?" ("+t.fileCount+" file"+(t.fileCount>1?"s":"")+")":""))("matBadge",t.fileCount>0?t.fileCount:null)}}function vf(i,e){if(i&1){let t=O();l(0,"button",21),v("click",function(){x(t);let r=h();return w(r.toggleSharePanel())}),l(1,"mat-icon"),u(2,"group"),c()()}if(i&2){let t=h();Y("has-shared-users",((t.threadDetails==null||t.threadDetails.users==null?null:t.threadDetails.users.length)??0)>1)}}function yf(i,e){if(i&1&&(l(0,"div",6),u(1),c()),i&2){let t=h();p(),oi(" \u26A0\uFE0F Connection lost. Reconnecting... (",t.connectionStatus.reconnectAttempts,"/",t.connectionStatus.maxAttempts,") ")}}function Cf(i,e){if(i&1&&(l(0,"div",22),u(1),c()),i&2){let t=h();Y("error",t.uploadStatus.isError),p(),Ne(" ",t.uploadStatus.message," ")}}function Sf(i,e){if(i&1){let t=O();l(0,"app-chat-textarea",23),v("messageSubmitted",function(r){x(t);let o=h();return w(o.onMessageSubmitted(r))})("voiceRecordingToggled",function(r){x(t);let o=h();return w(o.onVoiceToggled(r))})("heightChanged",function(r){x(t);let o=h();return w(o.onInputHeightChanged(r))})("stopRequested",function(){x(t);let r=h();return w(r.onStopRequested())})("filesPasted",function(r){x(t);let o=h();return w(o.onFilesPasted(r))}),c()}if(i&2){let t=h();T("isDisabled",!t.isConnected)("isSessionInitializing",!1)("showWelcome",!1)("isThinking",t.isThinking)("isStarting",!1)}}function xf(i,e){if(i&1){let t=O();l(0,"app-choice-select",24),v("choiceSelected",function(r){x(t);let o=h();return w(o.onChoiceSelected(r))}),c()}if(i&2){let t=h();T("options",t.currentChoice.options)("labelHtml",t.currentChoice.label)("isVisible",!!t.currentChoice)("allowFreeText",t.currentChoice.allowFreeText)}}function wf(i,e){i&1&&F(0,"app-oauth-request-panel")}function Tf(i,e){if(i&1){let t=O();l(0,"app-file-exchange-drawer",25),v("closeDrawer",function(){x(t);let r=h();return w(r.closeDrawer())}),c()}if(i&2){let t=h();T("projectName",t.projectName)("threadId",t.threadId)}}function Ef(i,e){if(i&1){let t=O();l(0,"app-thread-share",26),v("userAdded",function(r){x(t);let o=h();return w(o.onUserAdded(r))})("userRemoved",function(r){x(t);let o=h();return w(o.onUserRemoved(r))})("closed",function(){x(t);let r=h();return w(r.closeDrawer())}),c()}if(i&2){let t=h();T("threadId",t.threadId)("users",t.threadDetails.users||Or(3,_f))("currentUsername",t.currentUsername)}}function Mf(i,e){i&1&&(l(0,"div",19)(1,"div",27)(2,"div",28),u(3,"\u{1F4CE}"),c(),l(4,"div",29),u(5,"Drop files here to upload"),c(),l(6,"div",30),u(7,"Images will be added to conversation, other files to exchange space"),c()()())}var Zo=class i{projectName;threadId;chatFocused=new Z;drawerStateChange=new Z;destroy$=new J;connectionDestroy$=new J;inputSection;messages=[];streamingText="";isThinking=!1;currentChoice=null;connectionStatus=null;isConnected=!1;showConnectionStatus=!1;hasEverConnected=!1;inputSectionHeight=80;uploadStatus={message:"",isError:!1};isDragOver=!1;drawerMode="none";get isDrawerOpen(){return this.drawerMode!=="none"}threadDetails=null;threadShareRef;get fileCount(){return this.fileExchangeState.fileCount()}currentUsername="";authEnabled=!1;pendingFirstMessage=null;subscriptions=[];codayService=f(mt);oauthService=f(Sn);pendingOAuthRequest=Ie(this.oauthService.pendingRequest$,{initialValue:null});preferencesService=f(Pe);titleService=f(Fi);elementRef=f(ft);threadState=f(Ye);userService=f(Qt);router=f(zt);imageUploadService=f(Jo);fileExchangeState=f(ki);firstMessageState=f(Li);ngOnInit(){if(console.log("[THREAD] Initializing with project:",this.projectName,"thread:",this.threadId),!this.projectName||!this.threadId){console.error("[THREAD] Missing required inputs: projectName or threadId");return}this.setupPrintHandlers(),this.userService.authEnabled$.pipe(D(this.destroy$)).subscribe(e=>{this.authEnabled=e}),this.userService.username$.pipe(D(this.destroy$)).subscribe(e=>{this.currentUsername=e??"",this.messages.length>0&&(this.messages=[...this.messages])}),this.initializeThreadConnection()}ngOnChanges(e){console.log("[THREAD] ngOnChanges called",e),e.threadId&&(console.log("[THREAD] threadId changed:",{firstChange:e.threadId.firstChange,previousValue:e.threadId.previousValue,currentValue:e.threadId.currentValue}),e.threadId.firstChange||(console.log("[THREAD] Reconnecting to new thread"),this.initializeThreadConnection()))}initializeThreadConnection(){console.log("[THREAD] Initializing connection for thread:",this.threadId),this.fileExchangeState.initializeForThread(this.projectName,this.threadId),this.connectionDestroy$.next(),this.codayService.messages$.pipe(D(this.connectionDestroy$)).subscribe(t=>{console.log("[THREAD] Messages updated:",t.length),this.messages=t}),this.codayService.streamingText$.pipe(D(this.connectionDestroy$)).subscribe(t=>{this.streamingText=t}),this.codayService.isThinking$.pipe(D(this.connectionDestroy$)).subscribe(t=>{this.isThinking=t}),this.codayService.currentChoice$.pipe(D(this.connectionDestroy$)).subscribe(t=>{this.currentChoice=t}),this.codayService.connectionStatus$.pipe(D(this.connectionDestroy$)).subscribe(t=>{this.connectionStatus=t,this.isConnected=t.connected,t.connected&&!this.hasEverConnected&&(this.hasEverConnected=!0,this.showConnectionStatus=!0),!t.connected&&!this.hasEverConnected?setTimeout(()=>{!this.isConnected&&!this.hasEverConnected&&(this.showConnectionStatus=!0)},2e3):!t.connected&&this.hasEverConnected?this.showConnectionStatus=!0:t.connected&&(this.showConnectionStatus=!0)}),this.codayService.threadUpdateEvent$.pipe(D(this.connectionDestroy$)).subscribe(t=>{t&&(console.log("[THREAD] Thread update event received:",t),this.threadState.refreshThreadList())}),this.threadState.selectedThread$.pipe(D(this.connectionDestroy$)).subscribe(t=>{this.threadDetails=t}),this.codayService.resetMessages(),this.codayService.setTabTitleService(this.titleService),console.log("[THREAD] Connecting to thread event stream"),this.codayService.connectToThread(this.projectName,this.threadId);let e=this.firstMessageState.consumePendingFirstMessage();e?(console.log("[THREAD] First message pending:",e.substring(0,50)+"..."),this.pendingFirstMessage=e,this.codayService.setThinkingForPendingMessage(),this.subscribeToFirstInvite()):console.log("[THREAD] No first message found in state service")}ngAfterViewChecked(){if(this.inputSection?.nativeElement){let e=this.inputSection.nativeElement.offsetHeight;e!==this.inputSectionHeight&&e>0&&(this.inputSectionHeight=e)}}ngOnDestroy(){console.log("[THREAD] Destroying component"),this.connectionDestroy$.next(),this.connectionDestroy$.complete(),this.destroy$.next(),this.destroy$.complete(),this.fileExchangeState.clear(),this.subscriptions.forEach(e=>e.unsubscribe()),this.subscriptions=[],window.removeEventListener("beforeprint",this.handleBeforePrint),window.removeEventListener("afterprint",this.handleAfterPrint)}onMessageSubmitted(e){console.log("[THREAD] Sending message:",e),this.codayService.sendMessage(e)}onVoiceToggled(e){console.log("[VOICE] Recording:",e)}onChoiceSelected(e){console.log("[THREAD] Choice selected:",e),this.codayService.sendChoice(e)}onCopyMessage(e){console.log("[COPY] Message copied:",e.id)}onStopRequested(){this.threadState.stop()}onInputHeightChanged(e){console.log("[THREAD] Input height changed:",e),this.inputSectionHeight=e}onFilesPasted(e){console.log("[THREAD] File(s) pasted:",e.length);let t=this.imageUploadService.filterImageFiles(e),n=e.filter(r=>!r.type.startsWith("image/"));t.length&&this.uploadFilesSequentially(t,0),n.length&&this.uploadFilesToExchangeSpace(n),!t.length&&!n.length&&this.showUploadError("No supported files found")}emitDrawerState(){this.drawerStateChange.emit(this.isDrawerOpen)}toggleFileDrawer(){this.drawerMode=this.drawerMode==="files"?"none":"files",this.emitDrawerState()}toggleSharePanel(){this.drawerMode=this.drawerMode==="share"?"none":"share",this.emitDrawerState()}closeDrawer(){this.drawerMode="none",this.emitDrawerState()}onUserAdded(e){if(console.log("[THREAD] Adding user to thread:",e),!this.threadDetails)return;let t=this.threadDetails.users||[];if(t.some(r=>r.userId===e)){this.threadShareRef?.setError("User already has access to this thread");return}this.threadShareRef?.setAdding(!0);let n=[...t,{userId:e}];this.threadState.updateThreadUsers(this.threadId,n).pipe(D(this.destroy$)).subscribe({next:()=>{console.log("[THREAD] User added successfully"),this.threadShareRef?.setAdding(!1),this.threadState.refreshSelectedThread()},error:r=>{console.error("[THREAD] Error adding user:",r),this.threadShareRef?.setError(r?.error?.error||"Failed to add user")}})}onUserRemoved(e){if(console.log("[THREAD] Removing user from thread:",e),!this.threadDetails)return;let t=e===this.currentUsername,n=(this.threadDetails.users||[]).filter(r=>r.userId!==e);this.threadState.updateThreadUsers(this.threadId,n).pipe(D(this.destroy$)).subscribe({next:()=>{console.log("[THREAD] User removed successfully"),t?(this.threadState.clearSelection(),this.threadState.refreshThreadList(),this.router.navigate(["project",this.projectName])):this.threadState.refreshSelectedThread()},error:r=>{console.error("[THREAD] Error removing user:",r)}})}onDragEnter(e){e.preventDefault(),e.dataTransfer?.types.includes("Files")&&(console.log("[THREAD] Image files detected - showing drag overlay"),this.isDragOver=!0)}onDragOver(e){e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy")}onDragLeave(e){this.elementRef.nativeElement.contains(e.relatedTarget)||(console.log("[THREAD] Leaving component area - hiding drag overlay"),this.isDragOver=!1)}onDrop(e){e.preventDefault(),this.isDragOver=!1,console.log("[THREAD] Files dropped:",e.dataTransfer?.files?.length||0);let t=e.dataTransfer?.files;if(!t||t.length===0){console.log("[THREAD] No files in drop event");return}let n=this.imageUploadService.filterImageFiles(t),r=Array.from(t).filter(o=>!o.type.startsWith("image/"));console.log("[THREAD] Image files:",n.length,"Other files:",r.length),n.length>0&&this.uploadFilesSequentially(n,0),r.length>0&&this.uploadFilesToExchangeSpace(r),n.length===0&&r.length===0&&this.showUploadError("No supported files found")}uploadFilesSequentially(e,t){if(t>=e.length)return;let n=e[t];if(!n){console.error("[THREAD] File at index",t,"is undefined");return}console.log("[THREAD] Uploading file:",n.name),this.uploadStatus={message:`Uploading ${n.name}...`,isError:!1},this.imageUploadService.uploadImage(n,this.projectName,this.threadId).subscribe({next:r=>{r.success?(console.log("[THREAD] Upload successful:",n.name),this.uploadStatus={message:`\u2713 ${n.name} uploaded (${(r.processedSize/1024).toFixed(1)} KB)`,isError:!1},setTimeout(()=>{this.uploadStatus.isError||(this.uploadStatus={message:"",isError:!1})},3e3),this.uploadFilesSequentially(e,t+1)):(console.error("[THREAD] Upload failed:",n.name,r.error),this.showUploadError(`Failed to upload ${n.name}: ${r.error}`))},error:r=>{console.error("[THREAD] Upload error:",n.name,r),this.showUploadError(`Failed to upload ${n.name}: ${r.message||"Unknown error"}`)}})}showUploadError(e){this.uploadStatus={message:e,isError:!0},setTimeout(()=>{this.uploadStatus={message:"",isError:!1}},5e3)}uploadFilesToExchangeSpace(e){return B(this,null,function*(){for(let t of e){console.log("[THREAD] Uploading to exchange space:",t.name),this.uploadStatus={message:`Uploading ${t.name}...`,isError:!1};let n=yield this.fileExchangeState.uploadFile(t);if(n.success)console.log("[THREAD] Upload to exchange space successful:",t.name),this.uploadStatus={message:`\u2713 ${t.name} uploaded to exchange space`,isError:!1},setTimeout(()=>{this.uploadStatus.isError||(this.uploadStatus={message:"",isError:!1})},3e3);else{console.error("[THREAD] Upload to exchange space failed:",t.name,n.error),this.showUploadError(`Failed to upload ${t.name}: ${n.error}`);break}}})}subscribeToFirstInvite(){console.log("[THREAD] Subscribing to wait for InviteEvent"),this.subscriptions.push(this.codayService.currentInviteEvent$.subscribe(e=>{if(e&&this.pendingFirstMessage){console.log("[THREAD] Received InviteEvent, sending pending message");let t=this.pendingFirstMessage;this.pendingFirstMessage=null,this.codayService.sendMessage(t)}}))}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||i)};static \u0275cmp=I({type:i,selectors:[["app-thread"]],viewQuery:function(t,n){if(t&1&&Be(ff,5)(pr,5),t&2){let r;ge(r=fe())&&(n.inputSection=r.first),ge(r=fe())&&(n.threadShareRef=r.first)}},inputs:{projectName:"projectName",threadId:"threadId"},outputs:{chatFocused:"chatFocused",drawerStateChange:"drawerStateChange"},features:[jt],decls:22,vars:16,consts:[["inputSection",""],[1,"drag-drop-wrapper",3,"dragenter","dragover","dragleave","drop"],[1,"file-drawer-container",3,"hasBackdrop"],[1,"thread-container"],["matFab","","type","button",1,"file-drawer-toggle-btn",3,"has-files","matBadge","title"],["matFab","","title","Share thread","type","button",1,"share-toggle-btn",3,"has-shared-users"],[1,"connection-status"],[1,"chat-wrapper",3,"mousedown","touchstart"],[1,"chat-center"],[3,"copyRequested","stopRequested","messages","streamingText","isThinking","currentUsername"],[1,"upload-status",3,"error"],[1,"input-section"],[1,"input-center"],[1,"input-glass"],[3,"isDisabled","isSessionInitializing","showWelcome","isThinking","isStarting"],[1,"choice-overlay",3,"options","labelHtml","isVisible","allowFreeText"],["mode","side","position","end",3,"closed","opened"],[3,"projectName","threadId"],[3,"threadId","users","currentUsername"],[1,"drag-overlay"],["matFab","","type","button",1,"file-drawer-toggle-btn",3,"click","matBadge","title"],["matFab","","title","Share thread","type","button",1,"share-toggle-btn",3,"click"],[1,"upload-status"],[3,"messageSubmitted","voiceRecordingToggled","heightChanged","stopRequested","filesPasted","isDisabled","isSessionInitializing","showWelcome","isThinking","isStarting"],[1,"choice-overlay",3,"choiceSelected","options","labelHtml","isVisible","allowFreeText"],[3,"closeDrawer","projectName","threadId"],[3,"userAdded","userRemoved","closed","threadId","users","currentUsername"],[1,"drag-overlay-content"],[1,"drag-icon"],[1,"drag-text"],[1,"drag-hint"]],template:function(t,n){t&1&&(l(0,"div",1),v("dragenter",function(o){return n.onDragEnter(o)})("dragover",function(o){return n.onDragOver(o)})("dragleave",function(o){return n.onDragLeave(o)})("drop",function(o){return n.onDrop(o)}),l(1,"mat-drawer-container",2)(2,"mat-drawer-content")(3,"div",3),C(4,bf,3,5,"button",4),C(5,vf,3,2,"button",5),C(6,yf,2,2,"div",6),l(7,"div",7),v("mousedown",function(){return n.chatFocused.emit()})("touchstart",function(){return n.chatFocused.emit()}),l(8,"div",8)(9,"app-chat-history",9),v("copyRequested",function(o){return n.onCopyMessage(o)})("stopRequested",function(){return n.onStopRequested()}),c(),C(10,Cf,2,3,"div",10),c()(),l(11,"div",11,0)(13,"div",12)(14,"div",13),C(15,Sf,1,5,"app-chat-textarea",14),C(16,xf,1,4,"app-choice-select",15),C(17,wf,1,0,"app-oauth-request-panel"),c()()()()(),l(18,"mat-drawer",16),v("closed",function(){return n.closeDrawer()}),C(19,Tf,1,2,"app-file-exchange-drawer",17),C(20,Ef,1,4,"app-thread-share",18),c()(),C(21,Mf,8,0,"div",19),c()),t&2&&(p(),T("hasBackdrop",!1),p(3),S(n.drawerMode!=="files"?4:-1),p(),S(n.authEnabled&&n.drawerMode!=="share"?5:-1),p(),S(n.showConnectionStatus&&n.connectionStatus&&!n.connectionStatus.connected?6:-1),p(3),T("messages",n.messages)("streamingText",n.streamingText)("isThinking",n.isThinking)("currentUsername",n.currentUsername),p(),S(n.uploadStatus.message?10:-1),p(5),S(!n.currentChoice&&!n.pendingOAuthRequest()?15:-1),p(),S(n.currentChoice?16:-1),p(),S(n.pendingOAuthRequest()?17:-1),p(),T("opened",n.isDrawerOpen),p(),S(n.drawerMode==="files"?19:-1),p(),S(n.drawerMode==="share"&&n.threadDetails?20:-1),p(),S(n.isDragOver?21:-1))},dependencies:[Ro,yi,No,Lo,qo,pr,Xo,mr,ur,Ni,ke,se,Ge,Br,Tp,wp],styles:[".drag-drop-wrapper[_ngcontent-%COMP%]{height:100vh;height:100dvh;width:100%;position:relative}.thread-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%;width:100%;position:relative;background:transparent}.file-drawer-toggle-btn[_ngcontent-%COMP%]{position:fixed!important;top:1rem!important;right:1rem!important;z-index:100!important}.file-drawer-toggle-btn.has-files[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_pulse-subtle 3s infinite}@media(max-width:768px){.file-drawer-toggle-btn[_ngcontent-%COMP%]{width:40px!important;height:40px!important;top:.75rem!important;right:.75rem!important}.file-drawer-toggle-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px}}.share-toggle-btn[_ngcontent-%COMP%]{position:fixed!important;top:5rem!important;right:1rem!important;z-index:100!important}.share-toggle-btn.has-shared-users[_ngcontent-%COMP%]{color:var(--color-primary)!important}@media(max-width:768px){.share-toggle-btn[_ngcontent-%COMP%]{width:40px!important;height:40px!important;top:calc(1.25rem + 40px)!important;right:.75rem!important}.share-toggle-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px}}@keyframes _ngcontent-%COMP%_pulse-subtle{0%,to{box-shadow:0 2px 8px #00000026}50%{box-shadow:0 4px 16px rgba(var(--color-primary-rgb, 25, 118, 210),.3)}}.file-drawer-container[_ngcontent-%COMP%]{height:100dvh;width:100%;background:var(--color-bg)}.file-drawer-container[_ngcontent-%COMP%] .mat-drawer-content{display:flex;flex-direction:column;height:100%;overflow:hidden;background:transparent}.file-drawer-container[_ngcontent-%COMP%] .mat-drawer{width:35%;min-width:280px;max-width:480px;box-shadow:-2px 0 8px #0000001a}@media(max-width:768px){.file-drawer-container[_ngcontent-%COMP%] .mat-drawer{width:100%;max-width:100%;padding-bottom:env(safe-area-inset-bottom,0px)}}.file-drawer-container[_ngcontent-%COMP%] .mat-drawer-backdrop{display:none}.connection-status[_ngcontent-%COMP%]{position:fixed;top:0;left:0;right:0;z-index:1000;background:var(--color-warning);color:var(--color-text);padding:.5rem 1rem;text-align:center;font-size:.9rem;box-shadow:0 2px 4px #0000001a}.chat-wrapper[_ngcontent-%COMP%]{flex:1;overflow-y:auto;overflow-x:hidden;display:flex;flex-direction:column;width:100%;padding:1rem 0}.chat-center[_ngcontent-%COMP%]{max-width:800px;width:100%;margin:0 auto;padding:0 2rem;display:flex;flex-direction:column;gap:1rem}@media(max-width:768px){.chat-center[_ngcontent-%COMP%]{padding:0 1rem}}.input-section[_ngcontent-%COMP%]{width:100%;padding:1rem 0;padding-bottom:calc(1rem + env(safe-area-inset-bottom,0px));background:transparent;position:relative}.input-center[_ngcontent-%COMP%]{max-width:800px;width:100%;margin:0 auto;padding:0 2rem}@media(max-width:768px){.input-center[_ngcontent-%COMP%]{padding:0 1rem}}.choice-overlay[_ngcontent-%COMP%]{display:block;width:100%}.upload-status[_ngcontent-%COMP%]{padding:.75rem 1rem;border-radius:8px;background:var(--color-success-light);color:var(--color-text);font-size:.9rem;text-align:center}.upload-status.error[_ngcontent-%COMP%]{background:var(--color-error-light)}@media print{.file-drawer-toggle-btn[_ngcontent-%COMP%], .share-toggle-btn[_ngcontent-%COMP%], .connection-status[_ngcontent-%COMP%]{display:none}.thread-container[_ngcontent-%COMP%]{background:#fff}.input-section[_ngcontent-%COMP%]{display:none}}"]})};var ea=class i{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||i)};static \u0275cmp=I({type:i,selectors:[["app-welcome-message"]],decls:2,vars:1,consts:[[1,"welcome-title"]],template:function(t,n){t&1&&(hn(0,"h1",0),u(1),gn()),t&2&&(p(),L(n.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}}"]})};var Ep=(()=>{class i{static \u0275fac=function(n){return new(n||i)};static \u0275mod=wt({type:i});static \u0275inj=xt({imports:[$t]})}return i})();var Mp=(()=>{class i{static \u0275fac=function(n){return new(n||i)};static \u0275mod=wt({type:i});static \u0275inj=xt({imports:[$t]})}return i})();var ji=class i{currentThemeSubject=new W("light");currentTheme$=this.currentThemeSubject.asObservable();preferences=f(Pe);subscription=null;constructor(){console.log("[THEME] Initializing theme service"),this.initializeTheme(),this.setupSystemThemeListener()}ngOnDestroy(){this.subscription?.unsubscribe()}initializeTheme(){this.subscription=this.preferences.theme$.subscribe(e=>{console.log("[THEME] Theme preference changed to:",e),this.applyTheme(e)})}setTheme(e){this.preferences.setPreference("theme",e),this.applyTheme(e)}getCurrentTheme(){return this.currentThemeSubject.value}applyTheme(e){if(console.log("[THEME] Applying theme:",e),this.currentThemeSubject.next(e),e==="system")if(typeof window<"u"&&window.matchMedia){let n=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";console.log("[THEME] System theme resolved to:",n),this.setDocumentTheme(n)}else console.log("[THEME] matchMedia not available, defaulting to light theme"),this.setDocumentTheme("light");else this.setDocumentTheme(e)}setDocumentTheme(e){console.log("[THEME] Setting document theme to:",e),typeof document<"u"&&document.documentElement&&(e==="dark"?document.documentElement.setAttribute("data-theme","dark"):document.documentElement.removeAttribute("data-theme"))}setupSystemThemeListener(){typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",e=>{this.getCurrentTheme()==="system"&&this.setDocumentTheme(e.matches?"dark":"light")})}static \u0275fac=function(t){return new(t||i)};static \u0275prov=H({token:i,factory:i.\u0275fac,providedIn:"root"})};var kf=(i,e)=>e.code,Pf=(i,e)=>e.name+e.lang;function Of(i,e){i&1&&(l(0,"div",15)(1,"mat-icon",32),u(2,"warning"),c(),l(3,"span",33),u(4," Browser notifications have been blocked. To enable them, please reset the site permissions in your browser settings. "),c()())}function Af(i,e){if(i&1&&(l(0,"option",18),u(1),c()),i&2){let t=e.$implicit;T("value",t.code),p(),oi("",t.flag," ",t.label)}}function If(i,e){i&1&&(l(0,"option",25),u(1,"Loading voices..."),c())}function Df(i,e){i&1&&(l(0,"option",25),u(1,"No voice available"),c())}function Rf(i,e){if(i&1&&(l(0,"option",18),u(1),c()),i&2){let t=e.$implicit;T("value",t.name+"|"+t.lang),p(),Ne(" ",t.displayName," ")}}var hr=class i{destroy$=new J;selectedTheme="light";selectedVoiceLanguage="en-US";useEnterToSend=!1;printTechnicalMessages=!1;showTechnicalMessages=!0;showWarningMessages=!0;voiceAnnounceEnabled=!1;voiceMode="speech";voiceReadFullText=!1;voiceVolume=80;voiceRate=120;agentNotificationEnabled=!1;notificationSoundEnabled=!0;browserNotificationEnabled=!1;browserNotificationDenied=!1;availableVoices=[];selectedVoiceId=null;loadingVoices=!1;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=f(Pe);voiceSynthesisService=f(Ei);themeService=f(ji);ngOnInit(){this.selectedTheme=this.themeService.getCurrentTheme(),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.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.loadAvailableVoices(),this.themeService.currentTheme$.pipe(D(this.destroy$)).subscribe(e=>{this.selectedTheme=e}),this.preferencesService.voiceLanguage$.pipe(D(this.destroy$)).subscribe(e=>{this.selectedVoiceLanguage=e}),this.preferencesService.enterToSend$.pipe(D(this.destroy$)).subscribe(e=>{this.useEnterToSend=e}),this.preferencesService.printTechnicalMessages$.pipe(D(this.destroy$)).subscribe(e=>{this.printTechnicalMessages=e}),this.preferencesService.hideTechnicalMessages$.pipe(D(this.destroy$)).subscribe(e=>{this.showTechnicalMessages=!e}),this.preferencesService.hideWarningMessages$.pipe(D(this.destroy$)).subscribe(e=>{this.showWarningMessages=!e}),this.preferencesService.voiceAnnounceEnabled$.pipe(D(this.destroy$)).subscribe(e=>{this.voiceAnnounceEnabled=e}),this.preferencesService.voiceMode$.pipe(D(this.destroy$)).subscribe(e=>{this.voiceMode=e}),this.preferencesService.voiceReadFullText$.pipe(D(this.destroy$)).subscribe(e=>{this.voiceReadFullText=e}),this.preferencesService.voiceVolume$.pipe(D(this.destroy$)).subscribe(e=>{this.voiceVolume=Math.round(e*100)}),this.preferencesService.voiceRate$.pipe(D(this.destroy$)).subscribe(e=>{this.voiceRate=Math.round(e*100)}),this.preferencesService.selectedVoice$.pipe(D(this.destroy$)).subscribe(e=>{this.selectedVoiceId=e}),this.preferencesService.voiceLanguage$.pipe(D(this.destroy$)).subscribe(()=>{this.loadAvailableVoices()}),this.preferencesService.agentNotificationEnabled$.pipe(D(this.destroy$)).subscribe(e=>{this.agentNotificationEnabled=e}),this.preferencesService.notificationSoundEnabled$.pipe(D(this.destroy$)).subscribe(e=>{this.notificationSoundEnabled=e}),this.preferencesService.browserNotificationEnabled$.pipe(D(this.destroy$)).subscribe(e=>{this.browserNotificationEnabled=e,this.checkNotificationPermission()})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}onThemeChange(){console.log("[OPTIONS] Theme changed to:",this.selectedTheme),this.themeService.setTheme(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)}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 B(this,null,function*(){this.loadingVoices=!0;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=!1}})}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)}checkNotificationPermission(){"Notification"in window&&(this.browserNotificationDenied=Notification.permission==="denied",console.log("[OPTIONS] Notification permission status:",Notification.permission))}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-options-panel"]],decls:144,vars:35,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"],["color","primary",3,"ngModelChange","change","ngModel","disabled"],[1,"notification-error"],["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&&(l(0,"div",0)(1,"div",1)(2,"div",2)(3,"mat-icon"),u(4,"palette"),c(),l(5,"span"),u(6,"Appearance"),c()(),l(7,"div",3)(8,"div",4)(9,"label",5)(10,"input",6),ie("ngModelChange",function(o){return ne(n.selectedTheme,o)||(n.selectedTheme=o),o}),v("change",function(){return n.onThemeChange()}),c(),F(11,"span",7),u(12," Light "),c(),l(13,"label",5)(14,"input",8),ie("ngModelChange",function(o){return ne(n.selectedTheme,o)||(n.selectedTheme=o),o}),v("change",function(){return n.onThemeChange()}),c(),F(15,"span",7),u(16," Dark "),c(),l(17,"label",5)(18,"input",9),ie("ngModelChange",function(o){return ne(n.selectedTheme,o)||(n.selectedTheme=o),o}),v("change",function(){return n.onThemeChange()}),c(),F(19,"span",7),u(20," System "),c()()()(),l(21,"div",1)(22,"div",2)(23,"mat-icon"),u(24,"chat_bubble_outline"),c(),l(25,"span"),u(26,"Messaging"),c()(),l(27,"div",3)(28,"span",10),u(29,"Send message behavior:"),c(),l(30,"div",4)(31,"label",5)(32,"input",11),ie("ngModelChange",function(o){return ne(n.useEnterToSend,o)||(n.useEnterToSend=o),o}),v("change",function(){return n.onEnterToSendChange()}),c(),F(33,"span",7),u(34," Enter to send "),c(),l(35,"label",5)(36,"input",11),ie("ngModelChange",function(o){return ne(n.useEnterToSend,o)||(n.useEnterToSend=o),o}),v("change",function(){return n.onEnterToSendChange()}),c(),F(37,"span",7),u(38," Enter for new line "),c()()(),l(39,"div",3)(40,"div",12)(41,"span",10),u(42,"Show technical messages"),c(),l(43,"mat-slide-toggle",13),ie("ngModelChange",function(o){return ne(n.showTechnicalMessages,o)||(n.showTechnicalMessages=o),o}),v("change",function(){return n.onShowTechnicalMessagesChange()}),c()()(),l(44,"div",3)(45,"div",12)(46,"span",10),u(47,"Show warning messages"),c(),l(48,"mat-slide-toggle",13),ie("ngModelChange",function(o){return ne(n.showWarningMessages,o)||(n.showWarningMessages=o),o}),v("change",function(){return n.onShowWarningMessagesChange()}),c()()(),l(49,"div",3)(50,"div",12)(51,"span",10),u(52,"Include technical messages in print"),c(),l(53,"mat-slide-toggle",13),ie("ngModelChange",function(o){return ne(n.printTechnicalMessages,o)||(n.printTechnicalMessages=o),o}),v("change",function(){return n.onPrintTechnicalMessagesChange()}),c()()()(),l(54,"div",1)(55,"div",2)(56,"mat-icon"),u(57,"notifications"),c(),l(58,"span"),u(59,"Notifications"),c()(),l(60,"div",3)(61,"div",12)(62,"span",10),u(63,"Notify when the agent answers or requests input"),c(),l(64,"mat-slide-toggle",13),ie("ngModelChange",function(o){return ne(n.agentNotificationEnabled,o)||(n.agentNotificationEnabled=o),o}),v("change",function(){return n.onAgentNotificationEnabledChange()}),c()()(),l(65,"div",3)(66,"div",12)(67,"span",10),u(68,"Notification sound"),c(),l(69,"mat-slide-toggle",14),ie("ngModelChange",function(o){return ne(n.notificationSoundEnabled,o)||(n.notificationSoundEnabled=o),o}),v("change",function(){return n.onNotificationSoundEnabledChange()}),c()()(),l(70,"div",3)(71,"div",12)(72,"span",10),u(73,"Browser notification"),c(),l(74,"mat-slide-toggle",14),ie("ngModelChange",function(o){return ne(n.browserNotificationEnabled,o)||(n.browserNotificationEnabled=o),o}),v("change",function(){return n.onBrowserNotificationEnabledChange()}),c()(),C(75,Of,5,0,"div",15),c()(),l(76,"div",1)(77,"div",2)(78,"mat-icon"),u(79,"record_voice_over"),c(),l(80,"span"),u(81,"Voice & Speech"),c()(),l(82,"div",3)(83,"label",16),u(84,"Voice recognition language:"),c(),l(85,"select",17),ie("ngModelChange",function(o){return ne(n.selectedVoiceLanguage,o)||(n.selectedVoiceLanguage=o),o}),v("change",function(){return n.onVoiceLanguageChange()}),we(86,Af,2,3,"option",18,kf),c()(),l(88,"div",3)(89,"span",10),u(90,"Automatic announcement:"),c(),l(91,"div",4)(92,"label",5)(93,"input",19),ie("ngModelChange",function(o){return ne(n.voiceAnnounceEnabled,o)||(n.voiceAnnounceEnabled=o),o}),v("change",function(){return n.onVoiceAnnounceEnabledChange()}),c(),F(94,"span",7),u(95," Enabled "),c(),l(96,"label",5)(97,"input",19),ie("ngModelChange",function(o){return ne(n.voiceAnnounceEnabled,o)||(n.voiceAnnounceEnabled=o),o}),v("change",function(){return n.onVoiceAnnounceEnabledChange()}),c(),F(98,"span",7),u(99," Disabled "),c()()(),l(100,"div",3)(101,"span",10),u(102,"Voice mode:"),c(),l(103,"div",4)(104,"label",5)(105,"input",20),ie("ngModelChange",function(o){return ne(n.voiceMode,o)||(n.voiceMode=o),o}),v("change",function(){return n.onVoiceModeChange()}),c(),F(106,"span",7),u(107," Voice synthesis "),c(),l(108,"label",5)(109,"input",21),ie("ngModelChange",function(o){return ne(n.voiceMode,o)||(n.voiceMode=o),o}),v("change",function(){return n.onVoiceModeChange()}),c(),F(110,"span",7),u(111," Sound notification "),c()()(),l(112,"div",3)(113,"span",10),u(114,"Message reading:"),c(),l(115,"div",4)(116,"label",5)(117,"input",22),ie("ngModelChange",function(o){return ne(n.voiceReadFullText,o)||(n.voiceReadFullText=o),o}),v("change",function(){return n.onVoiceReadFullTextChange()}),c(),F(118,"span",7),u(119," Full message "),c(),l(120,"label",5)(121,"input",22),ie("ngModelChange",function(o){return ne(n.voiceReadFullText,o)||(n.voiceReadFullText=o),o}),v("change",function(){return n.onVoiceReadFullTextChange()}),c(),F(122,"span",7),u(123," First paragraphs only "),c()()(),l(124,"div",3)(125,"label",23),u(126,"Selected voice:"),c(),l(127,"select",24),ie("ngModelChange",function(o){return ne(n.selectedVoiceId,o)||(n.selectedVoiceId=o),o}),v("change",function(){return n.onSelectedVoiceChange()}),C(128,If,2,0,"option",25),C(129,Df,2,0,"option",25),we(130,Rf,2,2,"option",18,Pf),c(),F(132,"div",10),l(133,"a",26),v("click",function(){return n.testVoice()}),l(134,"span",27),u(135,"Test voice"),c()()(),l(136,"div",3)(137,"label",28),u(138),c(),l(139,"input",29),ie("ngModelChange",function(o){return ne(n.voiceVolume,o)||(n.voiceVolume=o),o}),v("input",function(){return n.onVoiceVolumeChange()}),c()(),l(140,"div",3)(141,"label",30),u(142),c(),l(143,"input",31),ie("ngModelChange",function(o){return ne(n.voiceRate,o)||(n.voiceRate=o),o}),v("input",function(){return n.onVoiceRateChange()}),c()()()()),t&2&&(p(10),te("ngModel",n.selectedTheme),p(4),te("ngModel",n.selectedTheme),p(4),te("ngModel",n.selectedTheme),p(14),T("value",!0),te("ngModel",n.useEnterToSend),p(4),T("value",!1),te("ngModel",n.useEnterToSend),p(7),te("ngModel",n.showTechnicalMessages),p(5),te("ngModel",n.showWarningMessages),p(5),te("ngModel",n.printTechnicalMessages),p(11),te("ngModel",n.agentNotificationEnabled),p(5),te("ngModel",n.notificationSoundEnabled),T("disabled",!n.agentNotificationEnabled),p(5),te("ngModel",n.browserNotificationEnabled),T("disabled",!n.agentNotificationEnabled||n.browserNotificationDenied),p(),S(n.browserNotificationDenied?75:-1),p(10),te("ngModel",n.selectedVoiceLanguage),p(),Te(n.voiceLanguageOptions),p(7),T("value",!0),te("ngModel",n.voiceAnnounceEnabled),p(4),T("value",!1),te("ngModel",n.voiceAnnounceEnabled),p(8),te("ngModel",n.voiceMode),p(4),te("ngModel",n.voiceMode),p(8),T("value",!0),te("ngModel",n.voiceReadFullText),p(4),T("value",!1),te("ngModel",n.voiceReadFullText),p(6),te("ngModel",n.selectedVoiceId),T("disabled",n.loadingVoices||n.availableVoices.length===0),p(),S(n.loadingVoices?128:-1),p(),S(!n.loadingVoices&&n.availableVoices.length===0?129:-1),p(),Te(n.availableVoices),p(8),Ne("Volume: ",n.voiceVolume,"%"),p(),te("ngModel",n.voiceVolume),p(3),Ne("Speed: ",n.voiceRate,"%"),p(),te("ngModel",n.voiceRate))},dependencies:[lt,Jl,Zl,_t,Kl,Xl,Ql,at,st,se,mc],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-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}']})};var Nf=(i,e)=>({subThreads:i,depth:e}),Ff=i=>({subThreads:i,depth:1}),kp=(i,e)=>e.id,Lf=(i,e)=>e.label;function jf(i,e){if(i&1){let t=O();l(0,"mat-icon",10),v("click",function(r){x(t);let o=h().$implicit,a=h(3);return w(a.toggleSubThreads(r,o.id))}),u(1),c()}if(i&2){let t=h().$implicit,n=h(3);p(),L(n.isParentExpanded(t.id)?"expand_more":"chevron_right")}}function Vf(i,e){i&1&&An(0)}function zf(i,e){if(i&1&&un(0,Vf,1,0,"ng-container",11),i&2){let t=h().$implicit,n=h().depth;h();let r=In(1);T("ngTemplateOutlet",r)("ngTemplateOutletContext",yl(2,Nf,t.subThreads,n+1))}}function $f(i,e){if(i&1){let t=O();l(0,"div",5)(1,"a",6),v("click",function(r){let o=x(t).$implicit;return h(3).selectThread(o.id),w(r.preventDefault())})("keydown.enter",function(r){let o=x(t).$implicit;return h(3).selectThread(o.id),w(r.preventDefault())})("keydown.space",function(r){let o=x(t).$implicit;return h(3).selectThread(o.id),w(r.preventDefault())}),C(2,jf,2,1,"mat-icon",7),l(3,"span",8),u(4),c(),l(5,"span",9),u(6),c()()(),C(7,zf,1,5,"ng-container")}if(i&2){let t,n=e.$implicit,r=h().depth,o=h(2);Ke("--sub-depth",r),Y("current",n.id===((t=o.currentThread())==null?null:t.id)),p(2),S(n.subThreads!=null&&n.subThreads.length?2:-1),p(2),L(n.delegatedAgentName||"Agent"),p(2),L(n.delegatedTask||n.name),p(),S(o.isParentExpanded(n.id)&&(n.subThreads!=null&&n.subThreads.length)?7:-1)}}function Bf(i,e){if(i&1&&we(0,$f,8,8,null,null,kp),i&2){let t=e.subThreads;Te(t)}}function Hf(i,e){i&1&&(l(0,"div",4),F(1,"span",12),l(2,"span",13),u(3,"Loading threads..."),c()())}function Uf(i,e){if(i&1&&(l(0,"div",25),u(1),c()),i&2){let t=h(6);p(),L(t.renameErrorMessage)}}function Wf(i,e){if(i&1){let t=O();l(0,"div",18)(1,"input",24),ie("ngModelChange",function(r){x(t);let o=h(5);return ne(o.editingThreadName,r)||(o.editingThreadName=r),w(r)}),v("keydown",function(r){x(t);let o=h(5);return w(o.onEditKeydown(r))})("blur",function(){x(t);let r=h(5);return w(r.onEditBlur())})("click",function(r){return r.stopPropagation()}),c(),C(2,Uf,2,1,"div",25),c()}if(i&2){let t=h(5);p(),te("ngModel",t.editingThreadName),T("disabled",t.isRenamingThread),p(),S(t.renameErrorMessage?2:-1)}}function qf(i,e){if(i&1){let t=O();l(0,"mat-icon",10),v("click",function(r){x(t);let o=h(2).$implicit,a=h(4);return w(a.toggleSubThreads(r,o.id))}),u(1),c()}if(i&2){let t=h(2).$implicit,n=h(4);p(),L(n.isParentExpanded(t.id)?"expand_more":"chevron_right")}}function Gf(i,e){if(i&1&&(l(0,"span",27),u(1),c()),i&2){let t=h(2).$implicit;p(),L(t.name)}}function Yf(i,e){i&1&&(F(0,"mat-spinner",29),l(1,"span",30),u(2,"Generating name..."),c()),i&2&&T("diameter",16)}function Qf(i,e){i&1&&(l(0,"mat-icon",28),u(1,"group"),c())}function Kf(i,e){if(i&1){let t=O();l(0,"a",26),v("click",function(r){x(t);let o=h().$implicit;return h(4).selectThread(o.id),w(r.preventDefault())})("keydown.enter",function(r){x(t);let o=h().$implicit;return h(4).selectThread(o.id),w(r.preventDefault())})("keydown.space",function(r){x(t);let o=h().$implicit;return h(4).selectThread(o.id),w(r.preventDefault())}),C(1,qf,2,1,"mat-icon",7),C(2,Gf,2,1,"span",27)(3,Yf,3,1),C(4,Qf,2,0,"mat-icon",28),c()}if(i&2){let t=h().$implicit,n=h(4);T("matTooltip",t.name?t.name+`
360
360
 
361
- `+(t.summary||""):t.summary||"")("matTooltipDisabled",!t.summary),p(),S(t.subThreads!=null&&t.subThreads.length?1:-1),p(),S(t.name?2:3),p(2),S(n.isSharedThread(t)?4:-1)}}function Xf(i,e){if(i&1){let t=O();l(0,"button",31),v("click",function(r){x(t);let o=h().$implicit,a=h(4);return w(a.startEditingThreadName(r,o))}),l(1,"mat-icon"),u(2,"edit"),c()()}}function Jf(i,e){i&1&&An(0)}function Zf(i,e){if(i&1&&un(0,Jf,1,0,"ng-container",11),i&2){let t=h().$implicit;h(3);let n=In(1);T("ngTemplateOutlet",n)("ngTemplateOutletContext",Ar(2,Ff,t.subThreads))}}function e0(i,e){if(i&1){let t=O();l(0,"div",17),C(1,Wf,3,3,"div",18)(2,Kf,5,5,"a",19),l(3,"div",20),C(4,Xf,3,0,"button",21),l(5,"button",22),v("click",function(r){let o=x(t).$implicit,a=h(4);return w(a.toggleStar(r,o))}),l(6,"mat-icon"),u(7),c()(),l(8,"button",23),v("click",function(r){let o=x(t).$implicit,a=h(4);return w(a.deleteThread(r,o))}),l(9,"mat-icon"),u(10,"delete"),c()()()(),C(11,Zf,1,4,"ng-container")}if(i&2){let t,n=e.$implicit,r=h(4);Y("current",n.id===((t=r.currentThread())==null?null:t.id)),p(),S(r.editingThreadId===n.id?1:2),p(3),S(r.editingThreadId!==n.id&&n.name?4:-1),p(),Y("starred",r.isStarred(n)),T("title",r.isStarred(n)?"Unstar thread":"Star thread"),p(2),L(r.isStarred(n)?"star":"star_outline"),p(4),S(r.isParentExpanded(n.id)&&(n.subThreads!=null&&n.subThreads.length)?11:-1)}}function t0(i,e){if(i&1&&(l(0,"div",14)(1,"div",16),u(2),c(),we(3,e0,12,9,null,null,kp),c()),i&2){let t=e.$implicit;p(2),L(t.label),p(),Te(t.threads)}}function n0(i,e){i&1&&(l(0,"div",15),u(1,"No existing threads"),c())}function i0(i,e){if(i&1&&(l(0,"div",15),u(1),c()),i&2){let t=h(3);p(),Ne('No threads matching "',t.searchQuery(),'"')}}function r0(i,e){if(i&1&&(we(0,t0,5,1,"div",14,Lf),C(2,n0,2,0,"div",15)(3,i0,2,1,"div",15)),i&2){let t,n=h(2);Te(n.getGroupedThreads()),p(2),S(!((t=n.threads())!=null&&t.length)&&!n.searchQuery()?2:n.searchQuery()&&n.getGroupedThreads().length===0?3:-1)}}function o0(i,e){if(i&1&&(un(0,Bf,2,0,"ng-template",null,0,ai),l(2,"div",3),C(3,Hf,4,0,"div",4)(4,r0,4,1),c()),i&2){let t=h();p(3),S(t.isLoadingThreadList()?3:4)}}function a0(i,e){i&1&&(l(0,"span",32),u(1,"No project selected"),c())}function s0(i,e){i&1&&(l(0,"span",32),u(1,"Loading..."),c())}function l0(i,e){if(i&1&&(l(0,"div",2),C(1,a0,2,0,"span",32)(2,s0,2,0,"span",32),c()),i&2){let t,n=h();p(),S((t=n.currentProject())!=null&&t.name?2:1)}}var ta=class i{projects=null;searchMode=!1;searchQuery=Ir("");searchModeChange=new Z;threadSelected=new Z;projectStateService=f(ye);threadStateService=f(Ye);threadApiService=f(Yt);userService=f(Qt);router=f(zt);destroyRef=f(ri);currentThread=Ie(this.threadStateService.selectedThread$);currentProject=Ie(this.projectStateService.selectedProject$);threads=Ie(this.threadStateService.threadList$);isLoadingThreadList=Ie(this.threadStateService.isLoadingThreadList$);username=Ie(this.userService.username$);isTouchDevice="ontouchstart"in window||navigator.maxTouchPoints>0;editingThreadId=null;editingThreadName="";isRenamingThread=!1;renameErrorMessage="";expandedParents=new Set;constructor(){Hi(()=>{let e=this.currentThread()?.id,t=this.threads();if(!e||!t?.length)return;let n=new Map;for(let o of t)o.parentThreadId&&n.set(o.id,o.parentThreadId);let r=e;for(;r;){let o=n.get(r);o&&this.expandedParents.add(o),r=o}})}ngOnInit(){this.userService.fetchCurrentUser().subscribe({error:e=>{console.error("[THREAD-SELECTOR] Failed to load current user:",e)}})}selectThread(e){this.threadStateService.selectThread(e),this.threadSelected.emit(),this.router.navigate(["project",this.currentProject()?.name,"thread",e])}getGroupedThreads(){let e=this.threads();if(!e?.length)return[];let t=new Set(e.map(N=>N.id)),n=e.filter(N=>!N.parentThreadId),r=e.filter(N=>!!N.parentThreadId),o=r.filter(N=>!t.has(N.parentThreadId)),a=r.filter(N=>t.has(N.parentThreadId)),s=new Map;for(let N of a){let X=N.parentThreadId;s.has(X)||s.set(X,[]),s.get(X).push(N)}let d=N=>(s.get(N)||[]).sort((U,Ee)=>U.modifiedDate>Ee.modifiedDate?-1:1).map(U=>he(G({},U),{subThreads:d(U.id)})),m=[...n,...o];if(this.searchQuery()&&this.searchQuery().trim()){let N=this.searchQuery().toLowerCase().trim();m=m.filter(X=>X.name.toLowerCase().includes(N)||X.summary&&X.summary.toLowerCase().includes(N))}if(!m.length)return[];let _=this.username();if(!_)return[];let b=m.map(N=>he(G({},N),{subThreads:d(N.id)})),y=b.filter(N=>N.starring&&N.starring.includes(_)),k=b.filter(N=>!N.starring||!N.starring.includes(_)),E=new Map,P=new Date;P.setHours(0,0,0,0);for(let N of k){let X=new Date(N.modifiedDate);X.setHours(0,0,0,0);let U=P.getTime()-X.getTime(),Ee=Math.floor(U/(1e3*60*60*24)),de;Ee===0?de="Today":Ee===1?de="Yesterday":Ee<7?de="This Week":Ee<30?de="This Month":Ee<90?de="Last 3 Months":de="Older",E.has(de)||E.set(de,[]),E.get(de).push(N)}let K=[];if(y.length>0){let N=[...y].sort((X,U)=>X.modifiedDate>U.modifiedDate?-1:1);K.push({label:"Starred",threads:N})}return["Today","Yesterday","This Week","This Month","Last 3 Months","Older"].filter(N=>E.has(N)).forEach(N=>{K.push({label:N,threads:E.get(N)})}),K}isParentExpanded(e){return this.expandedParents.has(e)}toggleSubThreads(e,t){e.stopPropagation(),this.expandedParents.has(t)?this.expandedParents.delete(t):this.expandedParents.add(t)}isSubThread(e){return!!e.parentThreadId}isSharedThread(e){return e.users&&e.users.length>1}isStarred(e){let t=this.username();return!!t&&e.starring&&e.starring.includes(t)}toggleStar(e,t){e.stopPropagation();let n=this.username();if(!n)return;let r=t.starring&&t.starring.includes(n),o=r?this.threadApiService.unstarThread(t.id):this.threadApiService.starThread(t.id);this.threadStateService.updateStarLocal(t.id,!r,n),o.pipe(ot(this.destroyRef)).subscribe({next:()=>{},error:a=>{console.error("Error toggling star:",a),this.threadStateService.refreshThreadList()}})}deleteThread(e,t){e.stopPropagation();let n=this.currentProject()?.name;!n||!confirm(`Are you sure you want to delete the thread "${t.name}"?`)||this.threadApiService.deleteThread(t.id).subscribe({next:()=>{this.currentThread()?.id===t.id&&(this.threadStateService.clearSelection(),this.router.navigate(["project",n])),this.threadStateService.refreshThreadList()},error:o=>{console.error("Error deleting thread:",o),alert("Failed to delete thread. Please try again.")}})}formatDate(e){try{let t=new Date(e),r=new Date().getTime()-t.getTime(),o=Math.floor(r/(1e3*60*60*24));return o===0?"Today":o===1?"Yesterday":o<7?`${o} days ago`:t.toLocaleDateString("en-EN",{day:"numeric",month:"short"})}catch(t){return"No date"}}startEditingThreadName(e,t){e.stopPropagation(),this.editingThreadId=t.id,this.editingThreadName=t.name||"",this.renameErrorMessage="",setTimeout(()=>{let n=document.querySelector(".thread-name-input");n&&(n.focus(),n.select())},0)}cancelEditingThreadName(){this.editingThreadId=null,this.editingThreadName="",this.renameErrorMessage=""}saveThreadName(e){if(e&&e.stopPropagation(),!this.editingThreadId)return;let t=this.editingThreadName.trim();if(!t){this.renameErrorMessage="Thread name cannot be empty";return}if(t.length>200){this.renameErrorMessage="Thread name is too long (max 200 characters)";return}let n=this.editingThreadId;this.isRenamingThread=!0,this.renameErrorMessage="",this.threadStateService.renameThread(n,t).subscribe({next:()=>{console.log("[THREAD-SELECTOR] Thread renamed successfully"),this.cancelEditingThreadName(),this.isRenamingThread=!1},error:r=>{console.error("[THREAD-SELECTOR] Error renaming thread:",r),this.renameErrorMessage=r.message||"Failed to rename thread",this.isRenamingThread=!1}})}onEditKeydown(e){e.key==="Enter"?(e.preventDefault(),e.stopPropagation(),this.saveThreadName()):e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),this.cancelEditingThreadName())}onEditBlur(){setTimeout(()=>{this.editingThreadId&&!this.isRenamingThread&&this.saveThreadName()},200)}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-thread-selector"]],inputs:{searchMode:"searchMode",searchQuery:[1,"searchQuery"]},outputs:{searchModeChange:"searchModeChange",threadSelected:"threadSelected"},decls:3,vars:1,consts:[["subThreadTemplate",""],["tabindex","0","role","application","aria-label","Thread selector",1,"thread-selector",3,"click","keydown"],[1,"thread-disabled"],["role","menu","aria-label","Thread selection",1,"thread-list"],[1,"thread-loading"],[1,"thread-item-wrapper","sub-thread"],["role","menuitem","tabindex","0",1,"thread-item","sub-thread-item",3,"click","keydown.enter","keydown.space"],[1,"sub-thread-toggle"],[1,"sub-thread-agent"],[1,"sub-thread-task"],[1,"sub-thread-toggle",3,"click"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[1,"loading-spinner"],[1,"loading-text"],[1,"thread-group"],[1,"thread-empty"],[1,"thread-group-header"],[1,"thread-item-wrapper"],[1,"thread-name-edit-wrapper"],["matTooltipShowDelay","1000","role","menuitem","tabindex","0",1,"thread-item",3,"matTooltip","matTooltipDisabled"],[1,"action-buttons"],["mat-icon-button","","title","Rename thread","type","button",1,"action-button","edit-button"],["mat-icon-button","","type","button",1,"action-button","star-button",3,"click","title"],["mat-icon-button","","title","Delete thread","type","button",1,"action-button","delete-button",3,"click"],["type","text","maxlength","200",1,"thread-name-input",3,"ngModelChange","keydown","blur","click","ngModel","disabled"],[1,"rename-error"],["matTooltipShowDelay","1000","role","menuitem","tabindex","0",1,"thread-item",3,"click","keydown.enter","keydown.space","matTooltip","matTooltipDisabled"],[1,"thread-name"],["matTooltip","Shared thread",1,"shared-indicator"],[1,"thread-name-spinner",3,"diameter"],[1,"thread-name","thread-name-generating"],["mat-icon-button","","title","Rename thread","type","button",1,"action-button","edit-button",3,"click"],[1,"disabled-text"]],template:function(t,n){if(t&1&&(l(0,"div",1),v("click",function(o){return o.stopPropagation()})("keydown",function(o){return o.stopPropagation()}),C(1,o0,5,1)(2,l0,3,1,"div",2),c()),t&2){let r;p(),S((r=n.currentProject())!=null&&r.name?1:2)}},dependencies:[Lr,lt,_t,at,ec,st,ke,se,Ge,ze,oc,rc,wi,xi,Qr,nc],styles:[".thread-selector[_ngcontent-%COMP%]{display:flex;flex-direction:column;width:100%;flex:1;min-height:0;overflow-x:hidden;overflow-y:auto}.thread-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:0;max-height:none;overflow:visible}.thread-group[_ngcontent-%COMP%]{display:flex;flex-direction:column;margin-bottom:.5rem}.thread-group[_ngcontent-%COMP%]:last-child{margin-bottom:0}.thread-group-header[_ngcontent-%COMP%]{padding:.5rem 1rem .25rem;font-size:.75rem;font-weight:600;color:var(--color-text-secondary);text-transform:uppercase;letter-spacing:.5px;position:sticky;top:0;background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);z-index:1}.thread-item-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;position:relative;width:100%;border-radius:0;min-width:0;gap:.25rem}.thread-item-wrapper[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.thread-item-wrapper[_ngcontent-%COMP%]:hover .action-buttons[_ngcontent-%COMP%]{display:flex}.thread-item-wrapper.current[_ngcontent-%COMP%]{background:var(--color-primary-light)}.thread-item-wrapper.current[_ngcontent-%COMP%] .thread-item[_ngcontent-%COMP%]{color:var(--color-primary-text);font-weight:600}.thread-item[_ngcontent-%COMP%]{display:flex;align-items:center;flex:1;min-width:0;padding:.75rem 1rem;text-decoration:none;cursor:pointer;transition:all .2s ease;background:transparent;border:none;border-radius:0;color:var(--color-text);text-align:left;justify-content:flex-start}.thread-item.new-thread-item[_ngcontent-%COMP%]{margin-bottom:.25rem}.thread-item[_ngcontent-%COMP%]:hover{color:var(--color-primary)}.thread-item[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-primary);outline-offset:-2px}.action-buttons[_ngcontent-%COMP%]{display:none;align-items:center;gap:.25rem;flex-shrink:0;margin-right:.5rem}.thread-item-wrapper[_ngcontent-%COMP%]:hover .action-buttons[_ngcontent-%COMP%], .thread-item-wrapper.current[_ngcontent-%COMP%] .action-buttons[_ngcontent-%COMP%]{display:flex}.action-button[_ngcontent-%COMP%]{flex-shrink:0;border-radius:4px!important;width:28px!important;height:28px!important;padding:0!important}.action-button[_ngcontent-%COMP%] .mat-mdc-button-persistent-ripple{border-radius:4px!important}.action-button[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)!important}.action-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px}.action-button.edit-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px}.action-button.edit-button[_ngcontent-%COMP%]:hover{background-color:var(--color-primary-hover)!important}.action-button.edit-button[_ngcontent-%COMP%]:hover mat-icon[_ngcontent-%COMP%]{color:var(--color-primary)}.action-button.star-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{transition:color .2s ease}.action-button.star-button.starred[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:#fbbf24}.action-button.star-button[_ngcontent-%COMP%]:not(.starred):hover mat-icon[_ngcontent-%COMP%]{color:#fbbf24}.action-button.delete-button[_ngcontent-%COMP%]:hover mat-icon[_ngcontent-%COMP%]{color:#ef4444}.thread-link[_ngcontent-%COMP%]{display:inline-flex;align-items:center;background:transparent;border:none;text-decoration:none;cursor:pointer;transition:all .2s ease;gap:.5rem;font-size:.875rem;font-weight:400;padding:0 1rem;min-width:0}.thread-link[_ngcontent-%COMP%]:hover:not(.new-thread-link){color:var(--color-primary-hover, var(--color-primary));text-decoration:underline;text-decoration-thickness:1.5px;text-underline-offset:3px}.thread-link[_ngcontent-%COMP%]:focus{outline:2px solid var(--color-primary);outline-offset:2px}.thread-link.new-thread-link[_ngcontent-%COMP%]{margin-bottom:.5rem;font-weight:600;font-size:.95rem}.thread-link.new-thread-link[_ngcontent-%COMP%] .thread-name[_ngcontent-%COMP%]{background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% auto;background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;animation:_ngcontent-%COMP%_gradientShift 3s ease-in-out infinite}.thread-link.new-thread-link[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:var(--color-primary);animation:_ngcontent-%COMP%_iconPulse 3s ease-in-out infinite}.thread-link.new-thread-link[_ngcontent-%COMP%]:hover{transform:translate(4px)}.thread-link.new-thread-link[_ngcontent-%COMP%]:hover mat-icon[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_iconPulse 1.5s ease-in-out infinite}.thread-link[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px}@keyframes _ngcontent-%COMP%_gradientShift{0%{background-position:0 center}50%{background-position:100% center}to{background-position:0 center}}@keyframes _ngcontent-%COMP%_iconPulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.8;transform:scale(1.05)}}.thread-name[_ngcontent-%COMP%]{flex:1;font-size:.875rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:left}.thread-name.thread-name-generating[_ngcontent-%COMP%]{color:var(--color-text-muted);font-style:italic}.thread-name-edit-wrapper[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;padding:0 .5rem}.thread-name-input[_ngcontent-%COMP%]{width:100%;padding:.5rem;border:1px solid var(--color-border);border-radius:4px;background:var(--color-bg-secondary);color:var(--color-text-primary);font-size:.9rem;font-family:inherit}.thread-name-input[_ngcontent-%COMP%]:focus{outline:none;border-color:var(--color-primary);box-shadow:0 0 0 2px #3b82f61a}.thread-name-input[_ngcontent-%COMP%]:disabled{opacity:.6;cursor:not-allowed}.rename-error[_ngcontent-%COMP%]{color:var(--color-error);font-size:.75rem;margin-top:.25rem;padding-left:.5rem}.thread-name-spinner[_ngcontent-%COMP%]{flex-shrink:0;margin-right:.5rem}.thread-name-spinner[_ngcontent-%COMP%] .mat-mdc-progress-spinner circle{stroke:var(--color-primary)!important}.current-indicator[_ngcontent-%COMP%]{color:var(--color-success);font-weight:700;flex-shrink:0;font-size:1rem}.thread-separator[_ngcontent-%COMP%]{height:1px;background:var(--color-border);margin:.25rem 0}.thread-empty[_ngcontent-%COMP%]{padding:1.5rem 1rem;text-align:center;color:var(--color-text-muted);font-size:.8rem;font-style:italic}.thread-loading[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:2rem 1rem;gap:.75rem}.thread-loading[_ngcontent-%COMP%] .loading-spinner[_ngcontent-%COMP%]{width:24px;height:24px;border:3px solid var(--color-border);border-top-color:var(--color-primary);border-radius:50%;animation:_ngcontent-%COMP%_spin .8s linear infinite}.thread-loading[_ngcontent-%COMP%] .loading-text[_ngcontent-%COMP%]{color:var(--color-text-muted);font-size:.8rem}@keyframes _ngcontent-%COMP%_spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.thread-disabled[_ngcontent-%COMP%]{padding:1.5rem 1rem}.thread-disabled[_ngcontent-%COMP%] .disabled-text[_ngcontent-%COMP%]{display:block;color:var(--color-text-muted);font-size:.85rem;font-style:italic;text-align:center}.thread-item-wrapper.sub-thread[_ngcontent-%COMP%]{padding-left:calc(.2rem + var(--sub-depth, 1) * 1.5rem);border-left:2px solid var(--color-primary, #3b82f6);margin-left:.75rem}.thread-item-wrapper.sub-thread[_ngcontent-%COMP%] .sub-thread-item[_ngcontent-%COMP%]{padding:.35rem .5rem .35rem 0;gap:.2rem;font-size:.8rem;color:var(--color-text-secondary)}.thread-item-wrapper.sub-thread[_ngcontent-%COMP%] .sub-thread-item[_ngcontent-%COMP%]:hover{color:var(--color-primary)}.thread-item-wrapper.sub-thread[_ngcontent-%COMP%] .sub-thread-agent[_ngcontent-%COMP%]{font-weight:600;color:var(--color-primary);white-space:nowrap;flex-shrink:0;font-size:.8rem}.thread-item-wrapper.sub-thread[_ngcontent-%COMP%] .sub-thread-task[_ngcontent-%COMP%]{color:var(--color-text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:.75rem}.sub-thread-toggle[_ngcontent-%COMP%]{font-size:16px;width:16px;height:16px;flex-shrink:0;cursor:pointer;color:var(--color-text-secondary);margin-right:.25rem}.sub-thread-toggle[_ngcontent-%COMP%]:hover{color:var(--color-primary)}.shared-indicator[_ngcontent-%COMP%]{font-size:14px;width:14px;height:14px;color:var(--color-text-secondary);flex-shrink:0;margin-left:.25rem}@media(max-width:768px){.thread-item[_ngcontent-%COMP%]{padding:.6rem .8rem}.thread-name[_ngcontent-%COMP%]{font-size:.8rem}}"]})};var c0=["logsContent"],d0=(i,e)=>e.name;function p0(i,e){if(i&1){let t=O();l(0,"button",12),v("click",function(){x(t);let r=h().$implicit,o=h();return w(o.start(r.name))}),l(1,"mat-icon"),u(2,"play_arrow"),c()()}if(i&2){let t=h().$implicit;T("disabled",t.isLoading)}}function m0(i,e){if(i&1){let t=O();l(0,"button",13),v("click",function(){x(t);let r=h().$implicit,o=h();return w(o.stop(r.name))}),l(1,"mat-icon"),u(2,"stop"),c()()}if(i&2){let t=h().$implicit;T("disabled",t.isLoading)}}function u0(i,e){if(i&1&&(l(0,"a",8)(1,"mat-icon",14),u(2,"open_in_new"),c()()),i&2){let t=h().$implicit;T("href",t.url,On)("title",t.url)}}function h0(i,e){if(i&1&&(l(0,"div",15),u(1),c()),i&2){let t=h(),n=t.$implicit,r=t.$index;Ke("order",r*2),p(),L(n.errorMessage)}}function g0(i,e){if(i&1){let t=O();l(0,"button",21),v("click",function(){x(t);let r=h(3);return w(r.onManualRefresh())}),l(1,"mat-icon"),u(2,"refresh"),c()()}}function f0(i,e){if(i&1&&(l(0,"div",16)(1,"div",17)(2,"span",18),u(3),c(),C(4,g0,3,0,"button",19),c(),l(5,"pre",20,0),u(7),c()()),i&2){let t=h(),n=t.$implicit,r=t.$index,o=h();Ke("order",r*2+1),p(3),Ne("",n.name," logs"),p(),S(n.status==="running"?4:-1),p(3),L(o.logs()||"(empty)")}}function _0(i,e){if(i&1){let t=O();l(0,"div",2)(1,"span",3),u(2),c(),l(3,"div",4),C(4,p0,3,1,"button",5)(5,m0,3,1,"button",6),l(6,"span",7),u(7),c(),C(8,u0,3,2,"a",8),l(9,"button",9),v("click",function(){let r=x(t).$implicit,o=h();return w(o.toggleLogs(r.name))}),l(10,"mat-icon"),u(11),c()()()(),C(12,h0,2,3,"div",10),C(13,f0,8,5,"div",11)}if(i&2){let t=e.$implicit,n=e.$index,r=h();Ke("order",n*2),p(2),L(t.name),p(2),S(t.status==="stopped"?4:5),p(2),Y("running",t.status==="running"),p(),Ne(" ",t.status==="running"?"Running":"Stopped"," "),p(),S(t.url?8:-1),p(),T("title",r.logsOpenFor()===t.name?"Hide logs":"Show logs"),p(2),L(r.logsOpenFor()===t.name?"expand_less":"terminal"),p(),S(t.errorMessage?12:-1),p(),S(r.logsOpenFor()===t.name?13:-1)}}var na=class i{destroyRef=f(ri);projectApi=f(Yr);projectName=Ir.required();entryStates=qe([]);hasPreview=Tt(()=>this.entryStates().length>0);logsOpenFor=qe(null);logs=qe("");logsContent;logsPollTimer=null;logsTimeoutTimer=null;static LOGS_POLL_MS=5e3;static LOGS_TIMEOUT_MS=1200*1e3;constructor(){Hi(()=>{let e=this.projectName();e&&this.onProjectChanged(e)},{allowSignalWrites:!0}),Hi(()=>{console.log("entry states",this.entryStates())})}ngOnDestroy(){this.stopLogPolling()}onProjectChanged(e){this.stopLogPolling(),this.entryStates.set([]),this.logsOpenFor.set(null),this.logs.set(""),this.projectApi.getPreviewEntries(e).pipe(ot(this.destroyRef)).subscribe({next:t=>{let n=t.entries;if(n.length===0)return;let r=n.map(a=>({name:a.name,command:a.command,url:a.url,status:"stopped",isLoading:!1,errorMessage:""}));this.entryStates.set(r);let o=n.map(a=>this.projectApi.getPreviewStatus(e,a.name));ol(o).pipe(ot(this.destroyRef)).subscribe({next:a=>{this.entryStates.update(s=>s.map((d,m)=>{let _=a[m];return _?he(G({},d),{status:_.status}):d}))},error:()=>{}})},error:()=>{}})}start(e){this.updateEntry(e,{isLoading:!0,errorMessage:""}),this.projectApi.startPreview(this.projectName(),e).pipe(ot(this.destroyRef)).subscribe({next:t=>{this.updateEntry(e,{status:t.status,isLoading:!1})},error:t=>{this.updateEntry(e,{errorMessage:t?.error?.error??"Failed to start preview",isLoading:!1})}})}stop(e){this.updateEntry(e,{isLoading:!0,errorMessage:""}),this.projectApi.stopPreview(this.projectName(),e).pipe(ot(this.destroyRef)).subscribe({next:()=>{this.updateEntry(e,{status:"stopped",isLoading:!1}),this.logsOpenFor()===e&&this.stopLogPolling()},error:t=>{this.updateEntry(e,{errorMessage:t?.error?.error??"Failed to stop preview",isLoading:!1})}})}toggleLogs(e){this.logsOpenFor()===e?(this.logsOpenFor.set(null),this.logs.set(""),this.stopLogPolling()):(this.logsOpenFor.set(e),this.refreshLogs(),this.startLogPolling())}onManualRefresh(){this.refreshLogs(),this.logsPollTimer&&this.resetLogsTimeout()}refreshLogs(){let e=this.logsOpenFor();e&&this.projectApi.getPreviewLogs(this.projectName(),e).pipe(ot(this.destroyRef)).subscribe({next:t=>{this.logs.set(t.logs),this.scrollLogsToBottom()},error:()=>this.logs.set("(failed to load logs)")})}updateEntry(e,t){this.entryStates.update(n=>n.map(r=>r.name===e?G(G({},r),t):r))}startLogPolling(){this.stopLogPolling(),this.logsPollTimer=setInterval(()=>{this.logsOpenFor()?this.refreshLogs():this.stopLogPolling()},i.LOGS_POLL_MS),this.resetLogsTimeout()}stopLogPolling(){this.logsPollTimer&&(clearInterval(this.logsPollTimer),this.logsPollTimer=null),this.logsTimeoutTimer&&(clearTimeout(this.logsTimeoutTimer),this.logsTimeoutTimer=null)}resetLogsTimeout(){this.logsTimeoutTimer&&clearTimeout(this.logsTimeoutTimer),this.logsTimeoutTimer=setTimeout(()=>{this.stopLogPolling()},i.LOGS_TIMEOUT_MS)}scrollLogsToBottom(){setTimeout(()=>{let e=this.logsContent?.nativeElement;e&&(e.scrollTop=e.scrollHeight)})}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-preview-panel"]],viewQuery:function(t,n){if(t&1&&Be(c0,5),t&2){let r;ge(r=fe())&&(n.logsContent=r.first)}},inputs:{projectName:[1,"projectName"]},decls:3,vars:0,consts:[["logsContent",""],[1,"preview-panel"],[1,"entry-row"],[1,"entry-name"],[1,"entry-actions"],["mat-icon-button","","title","Start","type","button",1,"entry-btn","start",3,"disabled"],["mat-icon-button","","title","Stop","type","button",1,"entry-btn","stop",3,"disabled"],[1,"status-pill"],["target","_blank","rel","noopener noreferrer",1,"preview-url",3,"href","title"],["mat-icon-button","","type","button",1,"entry-btn","logs",3,"click","title"],[1,"preview-error",3,"order"],[1,"logs-container",3,"order"],["mat-icon-button","","title","Start","type","button",1,"entry-btn","start",3,"click","disabled"],["mat-icon-button","","title","Stop","type","button",1,"entry-btn","stop",3,"click","disabled"],[1,"link-icon"],[1,"preview-error"],[1,"logs-container"],[1,"logs-header"],[1,"logs-title"],["mat-icon-button","","title","Refresh logs","type","button",1,"entry-btn"],[1,"logs-content"],["mat-icon-button","","title","Refresh logs","type","button",1,"entry-btn",3,"click"]],template:function(t,n){t&1&&(l(0,"div",1),we(1,_0,14,12,null,null,d0),c()),t&2&&(p(),Te(n.entryStates()))},dependencies:[Ge,ze,ke,se],styles:["[_nghost-%COMP%]{display:block}.preview-panel[_ngcontent-%COMP%]{display:flex;flex-direction:column;padding:.25rem 0}.entry-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;padding:.125rem .5rem;min-height:36px}.entry-name[_ngcontent-%COMP%]{font-size:.82rem;font-weight:500;color:var(--on-surface, #e0e0e0);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1 1 auto;min-width:0}.entry-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.25rem;flex-shrink:0}.entry-btn[_ngcontent-%COMP%]{width:28px!important;height:28px!important;padding:0!important;display:inline-flex!important;align-items:center;justify-content:center;flex-shrink:0}.entry-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px;line-height:18px}.entry-btn.start[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:var(--color-primary)}.entry-btn.stop[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:#e53935}.entry-btn.logs[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:16px;width:16px;height:16px;line-height:16px;color:var(--color-text-secondary)}.entry-btn[disabled][_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.status-pill[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;padding:1px 6px;border-radius:12px;font-size:.68rem;font-weight:600;letter-spacing:.02em;flex-shrink:0;min-width:52px;text-align:center;background:var(--color-bg-hover);color:var(--color-text-secondary);border:1px solid var(--color-border)}.status-pill.running[_ngcontent-%COMP%]{background:#22c55e26;color:#16a34a;border-color:#22c55e66}.preview-url[_ngcontent-%COMP%]{display:inline-flex;align-items:center;text-decoration:none;color:var(--color-primary);flex-shrink:0}.preview-url[_ngcontent-%COMP%]:hover{text-decoration:underline}.preview-url[_ngcontent-%COMP%] .link-icon[_ngcontent-%COMP%]{font-size:14px;width:14px;height:14px}.preview-error[_ngcontent-%COMP%]{font-size:.75rem;color:#c00;padding:0 .75rem}.logs-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;margin:.125rem .5rem .25rem;background:var(--color-bg-hover);border-radius:8px;overflow:hidden;border:1px solid var(--color-border)}.logs-header[_ngcontent-%COMP%]{display:flex;align-items:center;padding:.25rem .75rem;border-bottom:1px solid var(--color-border)}.logs-header[_ngcontent-%COMP%] .logs-title[_ngcontent-%COMP%]{flex:1;font-size:.72rem;font-weight:600;color:var(--color-text-secondary);text-transform:uppercase;letter-spacing:.05em}.logs-content[_ngcontent-%COMP%]{margin:0;padding:.5rem .75rem;font-family:Courier New,Courier,monospace;font-size:.72rem;line-height:1.5;color:var(--color-text);white-space:pre-wrap;word-break:break-all;max-height:200px;overflow-y:auto}.logs-content[_ngcontent-%COMP%]::-webkit-scrollbar{width:6px}.logs-content[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:transparent}.logs-content[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:var(--color-text-secondary);border-radius:3px}"]})};function b0(i,e){if(i&1&&(l(0,"div",3),u(1),c()),i&2){let t=h();p(),Ne("\u274C ",t.errorMessage)}}var gr=class i{dialogRef=f(Hr);data=f(Ur);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||i)};static \u0275cmp=I({type:i,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&&(l(0,"div",0),u(1),l(2,"button",1),v("click",function(){return n.onCancel()}),l(3,"mat-icon"),u(4,"close"),c()()(),l(5,"mat-dialog-content")(6,"textarea",2),ie("ngModelChange",function(o){return ne(n.jsonContent,o)||(n.jsonContent=o),o}),c(),C(7,b0,2,1,"div",3),c(),l(8,"mat-dialog-actions",4)(9,"button",5),v("click",function(){return n.onCancel()}),u(10,"Cancel"),c(),l(11,"button",6),v("click",function(){return n.onSave()}),u(12,"Save"),c()()),t&2&&(p(),Ne(" ",n.title," "),p(5),te("ngModel",n.jsonContent),p(),S(n.errorMessage?7:-1))},dependencies:[it,lt,_t,at,st,se,ze,si,qr,ql,Gr],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)}"]})};var v0=["threadSearchInput"],y0=["*"];function C0(i,e){if(i&1){let t=O();l(0,"button",26),v("click",function(){x(t);let r=h();return w(r.toggle())}),l(1,"mat-icon"),u(2,"menu"),c()(),l(3,"button",27),v("click",function(){x(t);let r=h();return w(r.createNewThread())}),l(4,"mat-icon",10),u(5,"play_circle"),c()()}if(i&2){let t=h();p(3),T("disabled",!t.selectedProjectName())}}function S0(i,e){if(i&1){let t=O();l(0,"div",14)(1,"mat-icon",28),u(2,"search"),c(),l(3,"input",29,0),ie("ngModelChange",function(r){x(t);let o=h();return ne(o.threadSearchQuery,r)||(o.threadSearchQuery=r),w(r)}),v("input",function(){x(t);let r=h();return w(r.onThreadSearchInput())}),c(),l(5,"button",30),v("click",function(){x(t);let r=h();return w(r.closeThreadSearch())}),l(6,"mat-icon"),u(7,"close"),c()()()}if(i&2){let t=h();p(3),te("ngModel",t.threadSearchQuery)}}function x0(i,e){if(i&1){let t=O();l(0,"div",15)(1,"mat-icon",22),u(2,"forum"),c(),l(3,"span",23),u(4,"Threads"),c(),l(5,"button",31),v("click",function(r){x(t);let o=h();return w(o.toggleThreadSearch(r))}),l(6,"mat-icon"),u(7,"search"),c()()()}}function w0(i,e){i&1&&(l(0,"mat-icon",21),u(1,"keyboard_arrow_up"),c())}function T0(i,e){i&1&&(l(0,"mat-icon",22),u(1,"hub"),c())}function E0(i,e){i&1&&(l(0,"mat-icon",21),u(1,"keyboard_arrow_up"),c())}function M0(i,e){i&1&&(l(0,"mat-icon",22),u(1,"tune"),c())}function k0(i,e){i&1&&(l(0,"div",33)(1,"div",37),F(2,"app-options-panel",38),c()())}function P0(i,e){if(i&1){let t=O();l(0,"div",32)(1,"a",20),v("click",function(r){return x(t),h(3).openProjectConfig(),r.preventDefault(),w(r.stopPropagation())}),l(2,"mat-icon",22),u(3,"settings_applications"),c(),l(4,"span",23),u(5,"Project Configuration"),c()()()}}function O0(i,e){i&1&&(l(0,"div",32)(1,"a",39)(2,"mat-icon",22),u(3,"settings_applications"),c(),l(4,"span",23),u(5,"Project config (No project)"),c()()())}function A0(i,e){if(i&1&&C(0,P0,6,0,"div",32)(1,O0,6,0,"div",32),i&2){let t=h(2);S(t.selectedProjectName()?0:1)}}function I0(i,e){if(i&1){let t=O();l(0,"div",32)(1,"a",20),v("click",function(r){return x(t),h(2).openAgents(),r.preventDefault(),w(r.stopPropagation())}),l(2,"mat-icon",22),u(3,"smart_toy"),c(),l(4,"span",23),u(5,"Agents"),c()()()}}function D0(i,e){i&1&&(l(0,"div",32)(1,"a",39)(2,"mat-icon",22),u(3,"smart_toy"),c(),l(4,"span",23),u(5,"Agents (No project)"),c()()())}function R0(i,e){if(i&1){let t=O();l(0,"div",32)(1,"a",20),v("click",function(r){return x(t),h(2).openPrompts(),r.preventDefault(),w(r.stopPropagation())}),l(2,"mat-icon",22),u(3,"description"),c(),l(4,"span",23),u(5,"Prompts"),c()()()}}function N0(i,e){i&1&&(l(0,"div",32)(1,"a",39)(2,"mat-icon",22),u(3,"description"),c(),l(4,"span",23),u(5,"Prompts (No project)"),c()()())}function F0(i,e){if(i&1){let t=O();l(0,"div",32)(1,"a",20),v("click",function(r){return x(t),h(2).openSchedulers(),r.preventDefault(),w(r.stopPropagation())}),l(2,"mat-icon",22),u(3,"schedule"),c(),l(4,"span",23),u(5,"Schedulers"),c()()()}}function L0(i,e){i&1&&(l(0,"div",32)(1,"a",39)(2,"mat-icon",22),u(3,"schedule"),c(),l(4,"span",23),u(5,"Schedulers (No project)"),c()()())}function j0(i,e){i&1&&(l(0,"mat-icon",21),u(1,"keyboard_arrow_up"),c())}function V0(i,e){i&1&&(l(0,"mat-icon",22),u(1,"rocket_launch"),c())}function z0(i,e){if(i&1&&(l(0,"div",33),F(1,"app-preview-panel",40),c()),i&2){let t=h(3);p(),T("projectName",t.selectedProjectName())}}function $0(i,e){if(i&1){let t=O();l(0,"div",32)(1,"a",20),v("click",function(r){return x(t),h(2).toggleSection("preview"),r.preventDefault(),w(r.stopPropagation())}),C(2,j0,2,0,"mat-icon",21)(3,V0,2,0,"mat-icon",22),l(4,"span",23),u(5,"Preview Server"),c()(),C(6,z0,2,1,"div",33),c()}if(i&2){let t=h(2);Y("expanded",t.expandedSections.preview),p(),Y("active",t.expandedSections.preview),p(),S(t.expandedSections.preview?2:3),p(4),S(t.expandedSections.preview?6:-1)}}function B0(i,e){if(i&1){let t=O();l(0,"div",24)(1,"div",32)(2,"a",20),v("click",function(r){return x(t),h().toggleSection("config"),w(r.preventDefault())}),C(3,E0,2,0,"mat-icon",21)(4,M0,2,0,"mat-icon",22),l(5,"span",23),u(6,"Preferences"),c()(),C(7,k0,3,0,"div",33),c(),l(8,"div",32)(9,"a",20),v("click",function(r){return x(t),h().openTokenUsage(),r.preventDefault(),w(r.stopPropagation())}),l(10,"mat-icon",22),u(11,"data_usage"),c(),l(12,"span",23),u(13,"Token Usage"),c()()(),l(14,"div",32)(15,"a",20),v("click",function(r){return x(t),h().openUserConfig(),r.preventDefault(),w(r.stopPropagation())}),l(16,"mat-icon",22),u(17,"manage_accounts"),c(),l(18,"span",23),u(19,"User Configuration"),c()()(),C(20,A0,2,1),C(21,I0,6,0,"div",32)(22,D0,6,0,"div",32),C(23,R0,6,0,"div",32)(24,N0,6,0,"div",32),C(25,F0,6,0,"div",32)(26,L0,6,0,"div",32),C(27,$0,7,6,"div",34),l(28,"div",32)(29,"a",35),F(30,"img",36),l(31,"span",23),u(32,"Contribute on GitHub"),c()()()()}if(i&2){let t=h();p(),Y("expanded",t.expandedSections.config),p(),Y("active",t.expandedSections.config),p(),S(t.expandedSections.config?3:4),p(4),S(t.expandedSections.config?7:-1),p(13),S(t.isAdmin?20:-1),p(),S(t.selectedProjectName()?21:22),p(2),S(t.selectedProjectName()?23:24),p(2),S(t.selectedProjectName()?25:26),p(2),S(t.hasPreviewConfig()?27:-1),p(3),Me("src","CODAY-Logo.png",On)}}function H0(i,e){if(i&1){let t=O();l(0,"div",25)(1,"mat-icon",41),u(2,"warning"),c(),l(3,"span",42),u(4),c(),l(5,"button",43),v("click",function(){x(t);let r=h();return w(r.configErrorMessage="")}),l(6,"mat-icon"),u(7,"close"),c()()()}if(i&2){let t=h();p(4),L(t.configErrorMessage)}}var fr=class i{destroy$=new J;sidenavStateChange=new Z;drawerOpen=!1;breakpointObserver=f(Dl);isDesktop=Ie(this.breakpointObserver.observe("(min-width: 1400px)").pipe(Ae(e=>e.matches)),{initialValue:!1});userOpenPreference=qe(!0);isOpen=Tt(()=>this.userOpenPreference());isAdmin=!1;configErrorMessage="";expandedSections={config:!1,preview:!1,settings:!1};isThreadSearchActive=!1;threadSearchQuery="";threadSearchInput;dialog=f(Wr);configApi=f(pc);projectStateService=f(ye);projectApi=f(Yr);router=f(zt);preferences=f(Pe);threadStateService=f(Ye);projects=Ie(this.projectStateService.projectList$);selectedProject=Ie(this.projectStateService.selectedProject$);selectedProjectName=Ie(this.projectStateService.selectedProject$.pipe(Ae(e=>e?.name)));isProjectVolatile=Ie(this.projectStateService.selectedProject$.pipe(Ae(e=>e?.config?.volatile||!1)));forcedProject=Ie(this.projectStateService.forcedProject$);hasPreviewConfig=Ie(this.projectStateService.selectedProject$.pipe(Ae(e=>{let t=e?.config?.preview;return Array.isArray(t)&&!!t.length})),{initialValue:!1});ngOnInit(){let e=window.innerWidth>=1024,t=this.preferences.getPreference("sidenavOpen",e);this.userOpenPreference.set(t??e),this.configApi.getUserConfig().pipe(D(this.destroy$)).subscribe({next:n=>{this.isAdmin=n.groups?.includes("CODAY_ADMIN")??!1,console.log("[SIDENAV] User admin status:",this.isAdmin)},error:n=>{console.error("[SIDENAV] Error loading user config for roles:",n),this.isAdmin=!1}})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}toggle(){let e=!this.userOpenPreference();this.userOpenPreference.set(e),this.saveSidenavState(e),this.sidenavStateChange.emit(e)}close(){this.userOpenPreference()&&(this.userOpenPreference.set(!1),this.saveSidenavState(!1),this.sidenavStateChange.emit(!1))}saveSidenavState(e){this.preferences.setPreference("sidenavOpen",e)}openTokenUsage(){this.configErrorMessage="",this.router.navigate(["/token-usage"]),this.close()}openUserConfig(){console.log("[SIDENAV] openUserConfig called"),this.configErrorMessage="",this.configApi.getUserConfig().pipe(D(this.destroy$)).subscribe({next:e=>{console.log("[SIDENAV] User config loaded, opening dialog"),this.dialog.open(gr,{data:{configType:"user",initialContent:JSON.stringify(e,null,2)}}).afterClosed().subscribe(n=>{n&&this.saveUserConfig(n)})},error:e=>{console.error("[SIDENAV] Error loading user config:",e),this.configErrorMessage=e?.error?.error||"Failed to load user configuration"}})}saveUserConfig(e){this.configApi.updateUserConfig(e).pipe(D(this.destroy$)).subscribe({next:t=>{console.log("[SIDENAV] User config saved successfully")},error:t=>{console.error("[SIDENAV] Error saving user config:",t),this.configErrorMessage=t?.error?.error||"Failed to save user configuration"}})}openProjectConfig(){let e=this.selectedProjectName();if(!e){console.error("[SIDENAV] No project selected"),this.configErrorMessage="No project selected. Please select a project first.";return}this.configErrorMessage="",this.projectApi.getProjectConfig(e).pipe(D(this.destroy$)).subscribe({next:t=>{console.log("[SIDENAV] Project config loaded, opening dialog"),this.dialog.open(gr,{data:{configType:"project",projectName:e,initialContent:JSON.stringify(t,null,2)}}).afterClosed().subscribe(r=>{r&&this.saveProjectConfig(e,r)})},error:t=>{console.error("[SIDENAV] Error loading project config:",t),this.configErrorMessage=t?.error?.error||"Failed to load project configuration"}})}saveProjectConfig(e,t){this.projectApi.updateProjectConfig(e,t).pipe(D(this.destroy$)).subscribe({next:n=>{console.log("[SIDENAV] Project config saved successfully")},error:n=>{console.error("[SIDENAV] Error saving project config:",n),this.configErrorMessage=n?.error?.error||"Failed to save project configuration"}})}requireProjectSelection(e){return this.selectedProjectName()?!0:(console.error(`[SIDENAV] No project selected, cannot ${e}`),this.configErrorMessage="Please select a project first",!1)}openAgents(){if(!this.requireProjectSelection("open agents"))return;let e=this.selectedProjectName();this.router.navigate(["project",e,"agents"]),this.close()}openPrompts(){if(!this.requireProjectSelection("open prompts"))return;let e=this.selectedProjectName();this.router.navigate(["project",e,"prompts"]),this.close()}openSchedulers(){if(!this.requireProjectSelection("open schedulers"))return;let e=this.selectedProjectName();this.router.navigate(["project",e,"schedulers"]),this.close()}toggleSection(e){let t=this.expandedSections[e];e==="settings"?this.expandedSections[e]=!t:(["config","preview"].forEach(r=>{this.expandedSections[r]=!1}),this.expandedSections[e]=!t)}navigateToHome(){if(this.forcedProject()){console.log("[SIDENAV] Cannot navigate to home - forced project active");return}console.log("[SIDENAV] Navigating to home (project selection)"),this.projectStateService.clearSelection(),this.router.navigate(["/"])}createNewThread(){let e=this.selectedProjectName();if(!e){console.error("[SIDENAV] No project selected, cannot create new thread"),this.configErrorMessage="Please select a project first";return}console.log("[SIDENAV] Navigating to welcome view for new thread"),this.threadStateService.clearSelection(),this.router.navigate(["project",e])}onThreadSelectedOnMobile(){this.isDesktop()||this.close()}toggleThreadSearch(e){e.stopPropagation(),this.isThreadSearchActive=!0,this.threadSearchQuery="",setTimeout(()=>{this.threadSearchInput?.nativeElement.focus()},0)}closeThreadSearch(){this.isThreadSearchActive=!1,this.threadSearchQuery=""}onThreadSearchInput(){}onThreadSearchModeChange(e){e||this.closeThreadSearch()}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-sidenav"]],viewQuery:function(t,n){if(t&1&&Be(v0,5),t&2){let r;ge(r=fe())&&(n.threadSearchInput=r.first)}},inputs:{drawerOpen:"drawerOpen"},outputs:{sidenavStateChange:"sidenavStateChange"},ngContentSelectors:y0,decls:34,vars:31,consts:[["threadSearchInput",""],[1,"sidenav-container",3,"hasBackdrop"],["mode","push","position","start",1,"app-sidenav",3,"closed","opened","disableClose"],[1,"sidenav-header"],["mat-icon-button","","title","Close menu",3,"click"],["alt","coday",3,"click","keydown.enter","keydown.space","title"],[1,"header-title-section"],[1,"sidenav-title"],[1,"new-thread-section"],["role","button","tabindex","0",1,"new-thread-link",3,"click"],["fontSet","material-icons-outlined"],[1,"new-thread-text"],[1,"sidenav-sections"],[1,"section-container","expanded"],[1,"search-header"],[1,"section-toggle","active","threads-header"],[1,"section-content","threads"],[1,"sidenav-thread-selector",3,"searchModeChange","threadSelected","searchMode","searchQuery"],[1,"sidenav-nav"],[1,"section-container","settings-group"],["role","button","tabindex","0",1,"section-toggle",3,"click"],[1,"arrow-icon","expanded"],[1,"section-icon"],[1,"section-label"],[1,"section-content","settings-content"],["role","alert",1,"error-notification"],["mat-icon-button","","title","Menu","type","button",1,"sidenav-toggle-btn",3,"click"],["mat-icon-button","","title","Start a new thread","type","button",1,"sidenav-new-thread-btn",3,"click","disabled"],[1,"search-icon"],["type","text","placeholder","Search threads...",1,"search-input",3,"ngModelChange","input","ngModel"],["mat-icon-button","","title","Close search","type","button",1,"close-search-btn",3,"click"],["mat-icon-button","","title","Search threads","type","button",1,"search-button",3,"click"],[1,"section-container"],[1,"section-content"],[1,"section-container",3,"expanded"],["href","https://github.com/whoz-oss/coday","target","_blank","rel","noopener noreferrer","title","Contribute on GitHub",1,"section-toggle","contribute-btn"],["alt","Coday",1,"contribute-logo"],[1,"preference-item"],[1,"inline-panel"],["role","button","tabindex","-1","aria-disabled","true",1,"section-toggle","disabled"],[3,"projectName"],[1,"error-icon"],[1,"error-text"],["mat-icon-button","","aria-label","Close error message",1,"error-close",3,"click"]],template:function(t,n){t&1&&(rn(),C(0,C0,6,1),l(1,"mat-sidenav-container",1)(2,"mat-sidenav",2),v("closed",function(){return n.close()}),l(3,"div",3)(4,"button",4),v("click",function(){return n.close()}),l(5,"mat-icon"),u(6,"chevron_left"),c()(),l(7,"img",5),v("click",function(o){return n.navigateToHome(),o.stopPropagation()})("keydown.enter",function(o){return n.navigateToHome(),o.preventDefault(),o.stopPropagation()})("keydown.space",function(o){return n.navigateToHome(),o.preventDefault(),o.stopPropagation()}),c(),l(8,"div",6)(9,"h2",7),u(10),c()()(),l(11,"div",8)(12,"a",9),v("click",function(o){return n.createNewThread(),o.preventDefault()}),l(13,"mat-icon",10),u(14,"play_circle"),c(),l(15,"span",11),u(16,"Start a new thread"),c()()(),l(17,"div",12)(18,"div",13),C(19,S0,8,1,"div",14)(20,x0,8,0,"div",15),l(21,"div",16)(22,"app-thread-selector",17),v("searchModeChange",function(o){return n.onThreadSearchModeChange(o)})("threadSelected",function(){return n.onThreadSelectedOnMobile()}),c()()()(),l(23,"div",18)(24,"div",19)(25,"a",20),v("click",function(o){return n.toggleSection("settings"),o.preventDefault()}),C(26,w0,2,0,"mat-icon",21)(27,T0,2,0,"mat-icon",22),l(28,"span",23),u(29,"Control Center"),c()(),C(30,B0,33,12,"div",24),c()()(),l(31,"mat-sidenav-content"),ht(32),c()(),C(33,H0,8,1,"div",25)),t&2&&(S(!n.isOpen()&&!n.drawerOpen?0:-1),p(),Y("sidenav-open",n.isOpen()),T("hasBackdrop",!1),p(),T("opened",n.isOpen())("disableClose",!0),p(5),Y("sidenav-logo",!0)("clickable",!n.forcedProject())("disabled",n.forcedProject()),T("title",n.forcedProject()?"Project selection disabled":"Go to project selection"),Me("src","CODAY-Logo.png",On)("role",n.forcedProject()?null:"button")("tabindex",n.forcedProject()?null:"0"),p(3),L(n.selectedProjectName()),p(9),S(n.isThreadSearchActive?19:20),p(3),T("searchMode",n.isThreadSearchActive)("searchQuery",n.threadSearchQuery),p(),Y("is-admin",n.isAdmin),p(),Y("expanded",n.expandedSections.settings),p(),Y("active",n.expandedSections.settings),p(),S(n.expandedSections.settings?26:27),p(4),S(n.expandedSections.settings?30:-1),p(),Y("sidenav-closed-offset",!n.isOpen()),p(2),S(n.configErrorMessage?33:-1))},dependencies:[lt,_t,at,st,Xo,js,Cp,Qo,ke,se,Ge,ze,Ep,Mp,hr,ta,na],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%;position:relative}.sidenav-container[_ngcontent-%COMP%]{position:fixed;top:0;left:0;right:0;height:100dvh;z-index:1400;transition:width;display:flex}.sidenav-container[_ngcontent-%COMP%] mat-sidenav[_ngcontent-%COMP%]{position:relative!important;transition:width;width:25%;min-width:320px;height:100dvh!important;flex-shrink:0}.sidenav-container[_ngcontent-%COMP%] mat-sidenav[_ngcontent-%COMP%]:not(.mat-drawer-opened){width:0!important;min-width:0;overflow:hidden!important;visibility:hidden!important}.sidenav-container[_ngcontent-%COMP%] mat-sidenav-content[_ngcontent-%COMP%]{width:100%;margin:0!important}@media(min-width:1024px){.sidenav-container[_ngcontent-%COMP%] mat-sidenav-content[_ngcontent-%COMP%]{min-width:0}}[_nghost-%COMP%] .mat-drawer-backdrop{pointer-events:auto}[_nghost-%COMP%] .mat-drawer-content{pointer-events:auto!important;background:transparent!important;overflow:visible!important}[_nghost-%COMP%] .mat-drawer-inner-container{overflow:hidden!important;height:100dvh!important;display:flex!important;flex-direction:column!important}.sidenav-new-thread-btn[_ngcontent-%COMP%], .sidenav-toggle-btn[_ngcontent-%COMP%]{position:fixed!important;z-index:1500!important;width:40px!important;height:40px!important;border-radius:50%!important;background:var(--glass-bg)!important;backdrop-filter:var(--glass-backdrop-blur)!important;-webkit-backdrop-filter:var(--glass-backdrop-blur)!important;border:1px solid var(--glass-border)!important;box-shadow:var(--glass-shadow)!important}.sidenav-toggle-btn[_ngcontent-%COMP%]{top:1rem!important;left:1rem!important}.sidenav-new-thread-btn[_ngcontent-%COMP%]{top:calc(1.5rem + 40px)!important;left:1rem!important}.sidenav-new-thread-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:var(--color-primary)!important}.sidenav-new-thread-btn[_ngcontent-%COMP%]:disabled{opacity:.5!important}.sidenav-logo-btn[_ngcontent-%COMP%]{position:fixed!important;bottom:1rem!important;left:1rem!important;z-index:1500!important;width:56px!important;height:56px!important;border-radius:50%!important;border:1px solid var(--glass-border)!important;padding:4px!important;background:var(--glass-bg)!important;backdrop-filter:var(--glass-backdrop-blur)!important;-webkit-backdrop-filter:var(--glass-backdrop-blur)!important;box-shadow:var(--glass-shadow)!important;transition:all .3s cubic-bezier(.4,0,.2,1)!important;cursor:pointer!important;pointer-events:auto!important;display:flex!important;align-items:center!important;justify-content:center!important;overflow:hidden!important;text-decoration:none!important}.sidenav-logo-btn[_ngcontent-%COMP%]:hover{transform:scale(1.08) translateY(-2px)!important;box-shadow:0 16px 48px #0003!important;border-color:var(--color-primary)!important}.sidenav-logo-btn[_ngcontent-%COMP%]:active{transform:scale(.96)!important}.sidenav-logo-btn[_ngcontent-%COMP%] .logo[_ngcontent-%COMP%]{width:48px;height:48px;border-radius:2px}.app-sidenav[_ngcontent-%COMP%]{width:480px;height:100dvh!important;min-height:0!important;position:relative;background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border-radius:0;overflow:hidden;overflow-x:hidden!important;display:flex;flex-direction:column}.sidenav-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:1rem;padding:1.5rem 1rem .5rem;flex-shrink:0}.sidenav-header[_ngcontent-%COMP%] .sidenav-logo[_ngcontent-%COMP%]{width:40px;height:40px;border-radius:4px;flex-shrink:0;transition:all .2s ease}.sidenav-header[_ngcontent-%COMP%] .sidenav-logo.clickable[_ngcontent-%COMP%]{cursor:pointer}.sidenav-header[_ngcontent-%COMP%] .sidenav-logo.clickable[_ngcontent-%COMP%]:hover{transform:scale(1.1);filter:drop-shadow(0 4px 12px rgba(0,0,0,.15))}.sidenav-header[_ngcontent-%COMP%] .sidenav-logo.clickable[_ngcontent-%COMP%]:active{transform:scale(.95)}.sidenav-header[_ngcontent-%COMP%] .sidenav-logo.clickable[_ngcontent-%COMP%]:focus{outline:2px solid var(--color-primary);outline-offset:2px}.sidenav-header[_ngcontent-%COMP%] .sidenav-logo.disabled[_ngcontent-%COMP%]{opacity:.5;cursor:not-allowed;pointer-events:none}.sidenav-header[_ngcontent-%COMP%] .header-title-section[_ngcontent-%COMP%]{flex:1;display:flex;align-items:center;min-width:0}.sidenav-header[_ngcontent-%COMP%] .header-title-section[_ngcontent-%COMP%] .sidenav-title[_ngcontent-%COMP%]{margin:0;font-size:1.25rem;font-weight:600;color:var(--color-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.loading-section[_ngcontent-%COMP%]{padding:2rem 1rem;display:flex;align-items:center;justify-content:center}.loading-content[_ngcontent-%COMP%]{width:100%;display:flex;flex-direction:column;gap:1rem;align-items:center}.loading-content[_ngcontent-%COMP%] mat-progress-bar[_ngcontent-%COMP%]{width:100%;height:4px;border-radius:2px}.loading-content[_ngcontent-%COMP%] .loading-text[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary);text-align:center}.new-thread-section[_ngcontent-%COMP%]{padding:1rem 1rem .5rem;flex-shrink:0}.new-thread-link[_ngcontent-%COMP%]{display:inline-flex;align-items:center;background:transparent;border:none;text-decoration:none;cursor:pointer;transition:all .2s ease;gap:.5rem;font-size:.95rem;font-weight:600;padding:0}.new-thread-link[_ngcontent-%COMP%] .new-thread-text[_ngcontent-%COMP%]{background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% auto;background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;animation:_ngcontent-%COMP%_gradientShift 3s ease-in-out infinite}.new-thread-link[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px;color:var(--color-primary);animation:_ngcontent-%COMP%_iconPulse 3s ease-in-out infinite}.new-thread-link[_ngcontent-%COMP%]:hover{transform:translate(4px)}.new-thread-link[_ngcontent-%COMP%]:hover mat-icon[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_iconPulse 1.5s ease-in-out infinite}.new-thread-link[_ngcontent-%COMP%]:focus{transform:scale(1.1)}@keyframes _ngcontent-%COMP%_gradientShift{0%{background-position:0% center}50%{background-position:100% center}to{background-position:0% center}}@keyframes _ngcontent-%COMP%_iconPulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.8;transform:scale(1.05)}}.sidenav-sections[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex:1;min-height:100px;overflow:hidden}.sidenav-sections[_ngcontent-%COMP%] > .section-container[_ngcontent-%COMP%], .sidenav-sections[_ngcontent-%COMP%] > .section-container.expanded[_ngcontent-%COMP%], .sidenav-sections[_ngcontent-%COMP%] > .section-container[_ngcontent-%COMP%] > .section-content.threads[_ngcontent-%COMP%], .sidenav-sections[_ngcontent-%COMP%] > .section-container[_ngcontent-%COMP%] > .section-content.threads[_ngcontent-%COMP%] > app-thread-selector[_ngcontent-%COMP%]{display:flex!important;flex-direction:column!important;flex:1!important;min-height:0!important;overflow:hidden!important}.sidenav-nav[_ngcontent-%COMP%]{flex-shrink:0;display:flex;flex-direction:column;overflow:hidden;max-height:70%;border-top:1px solid var(--color-border)}.sidenav-nav[_ngcontent-%COMP%] > .settings-group[_ngcontent-%COMP%] > .section-toggle.active[_ngcontent-%COMP%]{border-top:none}.sidenav-nav[_ngcontent-%COMP%] .settings-group[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden}.sidenav-nav[_ngcontent-%COMP%] .settings-group[_ngcontent-%COMP%] > .section-toggle[_ngcontent-%COMP%]{flex-shrink:0}.sidenav-nav[_ngcontent-%COMP%] .settings-group[_ngcontent-%COMP%] > .section-content.settings-content[_ngcontent-%COMP%]{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden}.settings-group[_ngcontent-%COMP%] > .section-content.settings-content[_ngcontent-%COMP%]{padding:0;border-bottom:1px solid var(--color-border);overflow:visible}.settings-group[_ngcontent-%COMP%] > .section-content.settings-content[_ngcontent-%COMP%] .section-container.expanded[_ngcontent-%COMP%] .section-content[_ngcontent-%COMP%]{max-height:40vh;overflow-y:auto;overflow-x:hidden}.contribute-btn[_ngcontent-%COMP%] .contribute-logo[_ngcontent-%COMP%]{width:20px;height:20px;border-radius:2px;flex-shrink:0}.section-container[_ngcontent-%COMP%]{flex-shrink:0;display:flex;flex-direction:column}.section-container.expanded[_ngcontent-%COMP%]{display:flex;flex-direction:column}.section-container.expanded[_ngcontent-%COMP%] .section-content[_ngcontent-%COMP%]{border-bottom:none}.section-toggle[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.75rem;width:100%;padding:.5rem 1rem;height:50px;text-decoration:none;cursor:pointer;transition:all .2s ease;background:transparent;border:none;border-radius:0;color:var(--color-text);flex-shrink:0}.section-toggle.active[_ngcontent-%COMP%]{border-top:1px solid var(--color-border)}.section-toggle.disabled[_ngcontent-%COMP%]{opacity:.5;cursor:not-allowed;pointer-events:none}.section-toggle[_ngcontent-%COMP%] .arrow-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px;color:var(--color-text-secondary);transition:transform .2s ease;transform:rotate(0);flex-shrink:0}.section-toggle[_ngcontent-%COMP%] .section-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px;color:var(--color-text-secondary);flex-shrink:0}.section-toggle[_ngcontent-%COMP%] .section-label[_ngcontent-%COMP%]{flex:1;font-size:.9rem;color:var(--color-text);text-align:left}.section-toggle[_ngcontent-%COMP%] .search-button[_ngcontent-%COMP%]{margin-left:auto;flex-shrink:0}.section-toggle[_ngcontent-%COMP%] .search-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px}.section-toggle[_ngcontent-%COMP%]:hover:not(.disabled){background:var(--color-bg-hover)}.section-toggle[_ngcontent-%COMP%]:active:not(.disabled){transform:scale(.98)}.section-toggle[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-primary);outline-offset:-2px}.search-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.5rem 1rem;height:50px;background:var(--color-bg-hover);border-top:1px solid var(--color-border);transition:all .2s ease}.search-header[_ngcontent-%COMP%] .search-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px;color:var(--color-text-secondary);flex-shrink:0}.search-header[_ngcontent-%COMP%] .search-input[_ngcontent-%COMP%]{flex:1;border:none;outline:none;background:transparent;color:var(--color-text);font-size:.9rem;padding:0;min-width:0}.search-header[_ngcontent-%COMP%] .search-input[_ngcontent-%COMP%]::placeholder{color:var(--color-text-muted)}.search-header[_ngcontent-%COMP%] .close-search-btn[_ngcontent-%COMP%]{flex-shrink:0}.search-header[_ngcontent-%COMP%] .close-search-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px}.section-content[_ngcontent-%COMP%]{padding:.5rem 0 0;animation:_ngcontent-%COMP%_slideDown .2s ease;border-bottom:1px solid var(--color-border);display:flex;flex-direction:column}.section-content.threads[_ngcontent-%COMP%]{padding:0;border-bottom:none;flex:1!important;min-height:0!important;overflow:hidden!important}.section-content.threads[_ngcontent-%COMP%] app-thread-selector[_ngcontent-%COMP%]{flex:1!important;min-height:0!important;overflow:hidden!important;display:flex!important;flex-direction:column!important}@keyframes _ngcontent-%COMP%_slideDown{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}.config-links[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.75rem;padding:.5rem 1rem;margin-bottom:1rem}.sidenav-item[_ngcontent-%COMP%]{width:100%}.sidenav-item[_ngcontent-%COMP%] .item-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px;color:var(--color-text-secondary)}.sidenav-item[_ngcontent-%COMP%] .item-text[_ngcontent-%COMP%]{flex:1;font-size:.9rem}.sidenav-item[_ngcontent-%COMP%] .disabled-hint[_ngcontent-%COMP%]{font-size:.7rem;color:var(--color-text-secondary);font-style:italic}.sidenav-link.disabled[_ngcontent-%COMP%]{opacity:.5;cursor:not-allowed;color:var(--color-text-secondary)}.sidenav-link.disabled[_ngcontent-%COMP%] .item-icon[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.sidenav-link[_ngcontent-%COMP%] .item-icon[_ngcontent-%COMP%], .sidenav-link[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px;color:var(--color-primary)}.sidenav-link[_ngcontent-%COMP%] .item-text[_ngcontent-%COMP%]{font-size:.875rem}.preference-item[_ngcontent-%COMP%]{padding-bottom:1rem;margin-bottom:1rem;border-bottom:1px solid var(--color-border)}.preference-item[_ngcontent-%COMP%]:last-child{margin-bottom:0;padding-bottom:0;border-bottom:none}.preference-item[_ngcontent-%COMP%] .preference-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.75rem;margin-bottom:.75rem;padding:0 1rem}.preference-item[_ngcontent-%COMP%] .preference-header[_ngcontent-%COMP%] .item-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px}.preference-item[_ngcontent-%COMP%] .preference-header[_ngcontent-%COMP%] .item-text[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.preference-item[_ngcontent-%COMP%] .preference-content[_ngcontent-%COMP%]{padding:0 1rem}.error-notification[_ngcontent-%COMP%]{position:fixed;top:5rem;left:50%;transform:translate(-50%);z-index:2000;display:flex;align-items:center;gap:.75rem;background:#ff3b3026;backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid rgba(255,59,48,.3);border-radius:16px;padding:1rem 1.5rem;box-shadow:var(--glass-shadow);animation:_ngcontent-%COMP%_errorSlideDown .3s cubic-bezier(.4,0,.2,1)}.error-notification[_ngcontent-%COMP%] .error-icon[_ngcontent-%COMP%]{font-size:1.2rem;flex-shrink:0;color:#c00}.error-notification[_ngcontent-%COMP%] .error-text[_ngcontent-%COMP%]{flex:1;color:#c00;font-size:.9rem;font-weight:500}@keyframes _ngcontent-%COMP%_errorSlideDown{0%{opacity:0;transform:translate(-50%,-10px)}to{opacity:1;transform:translate(-50%)}}@media(max-width:480px){.app-sidenav[_ngcontent-%COMP%]{width:320px}.sidenav-toggle-btn[_ngcontent-%COMP%]{top:.75rem!important;left:.75rem!important}.sidenav-new-thread-btn[_ngcontent-%COMP%]{top:calc(1.25rem + 40px)!important;left:.75rem!important}.error-notification[_ngcontent-%COMP%]{left:1rem;right:1rem;transform:none;max-width:calc(100vw - 2rem)}}body.dark[_nghost-%COMP%] .app-sidenav[_ngcontent-%COMP%], body.dark [_nghost-%COMP%] .app-sidenav[_ngcontent-%COMP%], [_ngcontent-%COMP%]:root[data-theme=dark] .app-sidenav[_ngcontent-%COMP%]{background:#242830f2;border-right-color:#b4c8ff17}body.dark[_nghost-%COMP%] .sidenav-header[_ngcontent-%COMP%], body.dark [_nghost-%COMP%] .sidenav-header[_ngcontent-%COMP%], [_ngcontent-%COMP%]:root[data-theme=dark] .sidenav-header[_ngcontent-%COMP%]{background:#242830b3}"]})};var ia=class i{destroy$=new J;isSetup=!1;codayService=f(mt);preferencesService=f(Pe);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$),ba(),ve(([e,t])=>e===!0&&t===!1)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Agent stopped thinking, notifying task finished"),this.notifyTaskFinishedIfEnabled()}),this.preferencesService.browserNotificationEnabled$.pipe(D(this.destroy$),ba(),ve(([e,t])=>e===!1&&t===!0)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Browser notifications enabled, checking permission"),this.handleBrowserNotificationEnabled()}),this.isSetup=!0}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(),n=e.createGain();t.connect(n),n.connect(e.destination),t.frequency.setValueAtTime(700,e.currentTime),n.gain.setValueAtTime(.1,e.currentTime),n.gain.exponentialRampToValueAtTime(.01,e.currentTime+.08),t.start(e.currentTime),t.stop(e.currentTime+.08);let r=e.createOscillator(),o=e.createGain();r.connect(o),o.connect(e.destination);let a=e.currentTime+.11;r.frequency.setValueAtTime(950,a),o.gain.setValueAtTime(.1,a),o.gain.exponentialRampToValueAtTime(.01,a+.09),r.start(a),r.stop(a+.09),console.log("[AGENT-NOTIFICATION] Completion sound played")}catch(e){console.error("[AGENT-NOTIFICATION] Failed to play completion sound:",e)}}handleBrowserNotificationEnabled(){return B(this,null,function*(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications"),this.preferencesService.setBrowserNotificationEnabled(!1);return}if(Notification.permission==="denied"){console.warn("[AGENT-NOTIFICATION] Permission denied, disabling browser notifications"),this.preferencesService.setBrowserNotificationEnabled(!1);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(!1)}})}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:!1});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:!1});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||i)};static \u0275prov=H({token:i,factory:i.\u0275fac,providedIn:"root"})};var U0=["inputSection"];function W0(i,e){if(i&1){let t=O();l(0,"app-thread",4),v("chatFocused",function(){x(t);let r=h();return w(r.onChatFocusedOnMobile())})("drawerStateChange",function(r){x(t);let o=h();return w(o.onDrawerStateChange(r))}),c()}if(i&2){let t=h();T("projectName",t.projectName)("threadId",t.threadId)}}function q0(i,e){if(i&1){let t=O();l(0,"div",5),F(1,"app-welcome-message"),c(),l(2,"div",6,0)(4,"div",7)(5,"div",8)(6,"app-chat-textarea",9),v("messageSubmitted",function(r){x(t);let o=h();return w(o.onMessageSubmitted(r))})("voiceRecordingToggled",function(r){x(t);let o=h();return w(o.onVoiceToggled(r))})("heightChanged",function(r){x(t);let o=h();return w(o.onInputHeightChanged(r))})("textareaFocused",function(){x(t);let r=h();return w(r.onChatFocusedOnMobile())}),c()()()()}if(i&2){let t=h();p(6),T("isDisabled",t.isSessionInitializing)("isSessionInitializing",t.isSessionInitializing)("showWelcome",!0)("isThinking",!1)("isStarting",t.isStartingFirstMessage)}}var _r=class i{destroy$=new J;inputSection;sidenav;projectName="";threadId=null;isSessionInitializing=!1;isStartingFirstMessage=!1;inputSectionHeight=80;codayService=f(mt);titleService=f(Fi);preferencesService=f(Pe);route=f(jr);router=f(zt);threadApiService=f(Yt);agentNotificationService=f(ia);firstMessageState=f(Li);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,n=e.threadId||null;console.log("[MAIN-APP] Route params updated:",{project:t,thread:n,previousProject:this.projectName,previousThread:this.threadId}),this.projectName=t,this.threadId=n,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=!0,this.isStartingFirstMessage=!0,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=!1,this.isStartingFirstMessage=!1,alert("Failed to create conversation: "+(t.message||"Unknown error"))}})}onVoiceToggled(e){console.log("[VOICE] Recording in welcome view:",e)}isDrawerOpen=!1;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||i)};static \u0275cmp=I({type:i,selectors:[["app-main"]],viewQuery:function(t,n){if(t&1&&Be(U0,5)(fr,5),t&2){let r;ge(r=fe())&&(n.inputSection=r.first),ge(r=fe())&&(n.sidenav=r.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","voiceRecordingToggled","heightChanged","textareaFocused","isDisabled","isSessionInitializing","showWelcome","isThinking","isStarting"]],template:function(t,n){t&1&&(l(0,"app-sidenav",1)(1,"div",2),v("mousedown",function(){return n.onChatFocusedOnMobile()})("touchstart",function(){return n.onChatFocusedOnMobile()}),C(2,W0,1,2,"app-thread",3)(3,q0,7,5),c()()),t&2&&(T("drawerOpen",n.isDrawerOpen),p(2),S(n.threadId?2:3))},dependencies:[yi,Zo,ea,fr],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:[Ia("slideIn",[Xr(":enter",[_n({transform:"translateY(100%)",opacity:0}),Kr("300ms ease-out",_n({transform:"translateY(0)",opacity:1}))]),Xr(":leave",[Kr("200ms ease-in",_n({transform:"translateY(100%)",opacity:0}))])])]}})};var Vi=i=>B(null,null,function*(){let e=f(ye),t=i.params.projectName;return t?e.getSelectedProjectId()===t?!0:(e.selectProject(t),(yield rl(e.selectedProject$.pipe(ll(r=>r?.name===t))))?.name===t):(console.log("[PROJECT GUARD] no project id in route"),!1)});var Pp=i=>B(null,null,function*(){let e=f(Ye),t=f(Qt),n=i.params.threadId;if(!t.getUsername())try{yield ga(t.fetchCurrentUser())}catch(r){console.error("[THREAD GUARD] Failed to load current user:",r)}if(!n)return console.log("[THREAD GUARD] no threadId in route"),!1;if(console.log("[THREAD GUARD] Checking thread:",n),console.log("[THREAD GUARD] Current selected thread:",e.getSelectedThreadId()),e.getSelectedThreadId()===n)return console.log("[THREAD GUARD] Thread already selected, allowing navigation"),!0;console.log("[THREAD GUARD] Selecting thread:",n),e.selectThread(n);try{let r=yield ga(Pn([e.isLoading$,e.selectedThread$]).pipe(gt(([a,s])=>console.log(`\u{1F43C} [${a?"loading":"loaded"}]`,s?.id)),ve(([a,s])=>!a&&!!s),ti(1),Ae(([a,s])=>s?.id))),o=r===n;return o?console.log("[THREAD GUARD] Thread validated, allowing navigation"):console.error("[THREAD GUARD] Thread ID mismatch - route:",n,"loaded:",r),o}catch(r){return console.error("[THREAD GUARD] Error loading thread:",r),!1}});var Op=[{path:"",component:yo},{path:"oauth/callback",component:Fo},{path:"project/new",loadComponent:()=>import("./chunk-QJ5RZT2C.js").then(i=>i.ProjectNewComponent)},{path:"project/:projectName",component:_r,canActivate:[Vi]},{path:"project/:projectName/prompts",loadComponent:()=>import("./chunk-JROTC4FL.js").then(i=>i.PromptListComponent),canActivate:[Vi]},{path:"project/:projectName/schedulers",loadComponent:()=>import("./chunk-STNEVMCX.js").then(i=>i.SchedulerListComponent),canActivate:[Vi]},{path:"project/:projectName/agents",loadComponent:()=>import("./chunk-23NDPEFI.js").then(i=>i.AgentListComponent),canActivate:[Vi]},{path:"project/:projectName/thread/:threadId",component:_r,canActivate:[Vi,Pp]},{path:"token-usage",loadComponent:()=>import("./chunk-6PWH64OF.js").then(i=>i.TokenUsageComponent)},{path:"agentos",loadChildren:()=>import("./chunk-2NHY3763.js").then(i=>i.AGENTOS_ROUTES)},{path:"**",redirectTo:""}];function G0(i){return()=>i.initializeDefaultProject()}function Y0(i){return()=>{console.log("[APP_INIT] OAuthService initialized")}}var Ap={providers:[ml(),Sl({eventCoalescing:!0}),kl(Op),El(),dd(),dl(Ul),{provide:wa,useFactory:G0,deps:[ye],multi:!0},{provide:wa,useFactory:Y0,deps:[Sn],multi:!0},Gl({basePath:"/api/agentos"}),{provide:Wl,useValue:{width:"80vw",maxWidth:"80vw",maxHeight:"80vh"}}]};var ra=class i{title="client";themeService=f(ji);ngOnInit(){console.log("[APP] Application initialized with theme:",this.themeService.getCurrentTheme())}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-root"]],decls:1,vars:0,template:function(t,n){t&1&&F(0,"router-outlet")},dependencies:[Pl,Ml],encapsulation:2})};Tl(ra,Ap).catch(i=>console.error(i));
361
+ `+(t.summary||""):t.summary||"")("matTooltipDisabled",!t.summary),p(),S(t.subThreads!=null&&t.subThreads.length?1:-1),p(),S(t.name?2:3),p(2),S(n.isSharedThread(t)?4:-1)}}function Xf(i,e){if(i&1){let t=O();l(0,"button",31),v("click",function(r){x(t);let o=h().$implicit,a=h(4);return w(a.startEditingThreadName(r,o))}),l(1,"mat-icon"),u(2,"edit"),c()()}}function Jf(i,e){i&1&&An(0)}function Zf(i,e){if(i&1&&un(0,Jf,1,0,"ng-container",11),i&2){let t=h().$implicit;h(3);let n=In(1);T("ngTemplateOutlet",n)("ngTemplateOutletContext",Ar(2,Ff,t.subThreads))}}function e0(i,e){if(i&1){let t=O();l(0,"div",17),C(1,Wf,3,3,"div",18)(2,Kf,5,5,"a",19),l(3,"div",20),C(4,Xf,3,0,"button",21),l(5,"button",22),v("click",function(r){let o=x(t).$implicit,a=h(4);return w(a.toggleStar(r,o))}),l(6,"mat-icon"),u(7),c()(),l(8,"button",23),v("click",function(r){let o=x(t).$implicit,a=h(4);return w(a.deleteThread(r,o))}),l(9,"mat-icon"),u(10,"delete"),c()()()(),C(11,Zf,1,4,"ng-container")}if(i&2){let t,n=e.$implicit,r=h(4);Y("current",n.id===((t=r.currentThread())==null?null:t.id)),p(),S(r.editingThreadId===n.id?1:2),p(3),S(r.editingThreadId!==n.id&&n.name?4:-1),p(),Y("starred",r.isStarred(n)),T("title",r.isStarred(n)?"Unstar thread":"Star thread"),p(2),L(r.isStarred(n)?"star":"star_outline"),p(4),S(r.isParentExpanded(n.id)&&(n.subThreads!=null&&n.subThreads.length)?11:-1)}}function t0(i,e){if(i&1&&(l(0,"div",14)(1,"div",16),u(2),c(),we(3,e0,12,9,null,null,kp),c()),i&2){let t=e.$implicit;p(2),L(t.label),p(),Te(t.threads)}}function n0(i,e){i&1&&(l(0,"div",15),u(1,"No existing threads"),c())}function i0(i,e){if(i&1&&(l(0,"div",15),u(1),c()),i&2){let t=h(3);p(),Ne('No threads matching "',t.searchQuery(),'"')}}function r0(i,e){if(i&1&&(we(0,t0,5,1,"div",14,Lf),C(2,n0,2,0,"div",15)(3,i0,2,1,"div",15)),i&2){let t,n=h(2);Te(n.getGroupedThreads()),p(2),S(!((t=n.threads())!=null&&t.length)&&!n.searchQuery()?2:n.searchQuery()&&n.getGroupedThreads().length===0?3:-1)}}function o0(i,e){if(i&1&&(un(0,Bf,2,0,"ng-template",null,0,ai),l(2,"div",3),C(3,Hf,4,0,"div",4)(4,r0,4,1),c()),i&2){let t=h();p(3),S(t.isLoadingThreadList()?3:4)}}function a0(i,e){i&1&&(l(0,"span",32),u(1,"No project selected"),c())}function s0(i,e){i&1&&(l(0,"span",32),u(1,"Loading..."),c())}function l0(i,e){if(i&1&&(l(0,"div",2),C(1,a0,2,0,"span",32)(2,s0,2,0,"span",32),c()),i&2){let t,n=h();p(),S((t=n.currentProject())!=null&&t.name?2:1)}}var ta=class i{projects=null;searchMode=!1;searchQuery=Ir("");searchModeChange=new Z;threadSelected=new Z;projectStateService=f(ye);threadStateService=f(Ye);threadApiService=f(Yt);userService=f(Qt);router=f(zt);destroyRef=f(ri);currentThread=Ie(this.threadStateService.selectedThread$);currentProject=Ie(this.projectStateService.selectedProject$);threads=Ie(this.threadStateService.threadList$);isLoadingThreadList=Ie(this.threadStateService.isLoadingThreadList$);username=Ie(this.userService.username$);isTouchDevice="ontouchstart"in window||navigator.maxTouchPoints>0;editingThreadId=null;editingThreadName="";isRenamingThread=!1;renameErrorMessage="";expandedParents=new Set;constructor(){Hi(()=>{let e=this.currentThread()?.id,t=this.threads();if(!e||!t?.length)return;let n=new Map;for(let o of t)o.parentThreadId&&n.set(o.id,o.parentThreadId);let r=e;for(;r;){let o=n.get(r);o&&this.expandedParents.add(o),r=o}})}ngOnInit(){this.userService.fetchCurrentUser().subscribe({error:e=>{console.error("[THREAD-SELECTOR] Failed to load current user:",e)}})}selectThread(e){this.threadStateService.selectThread(e),this.threadSelected.emit(),this.router.navigate(["project",this.currentProject()?.name,"thread",e])}getGroupedThreads(){let e=this.threads();if(!e?.length)return[];let t=new Set(e.map(N=>N.id)),n=e.filter(N=>!N.parentThreadId),r=e.filter(N=>!!N.parentThreadId),o=r.filter(N=>!t.has(N.parentThreadId)),a=r.filter(N=>t.has(N.parentThreadId)),s=new Map;for(let N of a){let X=N.parentThreadId;s.has(X)||s.set(X,[]),s.get(X).push(N)}let d=N=>(s.get(N)||[]).sort((U,Ee)=>U.modifiedDate>Ee.modifiedDate?-1:1).map(U=>he(G({},U),{subThreads:d(U.id)})),m=[...n,...o];if(this.searchQuery()&&this.searchQuery().trim()){let N=this.searchQuery().toLowerCase().trim();m=m.filter(X=>X.name.toLowerCase().includes(N)||X.summary&&X.summary.toLowerCase().includes(N))}if(!m.length)return[];let _=this.username();if(!_)return[];let b=m.map(N=>he(G({},N),{subThreads:d(N.id)})),y=b.filter(N=>N.starring&&N.starring.includes(_)),k=b.filter(N=>!N.starring||!N.starring.includes(_)),E=new Map,P=new Date;P.setHours(0,0,0,0);for(let N of k){let X=new Date(N.modifiedDate);X.setHours(0,0,0,0);let U=P.getTime()-X.getTime(),Ee=Math.floor(U/(1e3*60*60*24)),de;Ee===0?de="Today":Ee===1?de="Yesterday":Ee<7?de="This Week":Ee<30?de="This Month":Ee<90?de="Last 3 Months":de="Older",E.has(de)||E.set(de,[]),E.get(de).push(N)}let K=[];if(y.length>0){let N=[...y].sort((X,U)=>X.modifiedDate>U.modifiedDate?-1:1);K.push({label:"Starred",threads:N})}return["Today","Yesterday","This Week","This Month","Last 3 Months","Older"].filter(N=>E.has(N)).forEach(N=>{K.push({label:N,threads:E.get(N)})}),K}isParentExpanded(e){return this.expandedParents.has(e)}toggleSubThreads(e,t){e.stopPropagation(),this.expandedParents.has(t)?this.expandedParents.delete(t):this.expandedParents.add(t)}isSubThread(e){return!!e.parentThreadId}isSharedThread(e){return e.users&&e.users.length>1}isStarred(e){let t=this.username();return!!t&&e.starring&&e.starring.includes(t)}toggleStar(e,t){e.stopPropagation();let n=this.username();if(!n)return;let r=t.starring&&t.starring.includes(n),o=r?this.threadApiService.unstarThread(t.id):this.threadApiService.starThread(t.id);this.threadStateService.updateStarLocal(t.id,!r,n),o.pipe(ot(this.destroyRef)).subscribe({next:()=>{},error:a=>{console.error("Error toggling star:",a),this.threadStateService.refreshThreadList()}})}deleteThread(e,t){e.stopPropagation();let n=this.currentProject()?.name;!n||!confirm(`Are you sure you want to delete the thread "${t.name}"?`)||this.threadApiService.deleteThread(t.id).subscribe({next:()=>{this.currentThread()?.id===t.id&&(this.threadStateService.clearSelection(),this.router.navigate(["project",n])),this.threadStateService.refreshThreadList()},error:o=>{console.error("Error deleting thread:",o),alert("Failed to delete thread. Please try again.")}})}formatDate(e){try{let t=new Date(e),r=new Date().getTime()-t.getTime(),o=Math.floor(r/(1e3*60*60*24));return o===0?"Today":o===1?"Yesterday":o<7?`${o} days ago`:t.toLocaleDateString("en-EN",{day:"numeric",month:"short"})}catch(t){return"No date"}}startEditingThreadName(e,t){e.stopPropagation(),this.editingThreadId=t.id,this.editingThreadName=t.name||"",this.renameErrorMessage="",setTimeout(()=>{let n=document.querySelector(".thread-name-input");n&&(n.focus(),n.select())},0)}cancelEditingThreadName(){this.editingThreadId=null,this.editingThreadName="",this.renameErrorMessage=""}saveThreadName(e){if(e&&e.stopPropagation(),!this.editingThreadId)return;let t=this.editingThreadName.trim();if(!t){this.renameErrorMessage="Thread name cannot be empty";return}if(t.length>200){this.renameErrorMessage="Thread name is too long (max 200 characters)";return}let n=this.editingThreadId;this.isRenamingThread=!0,this.renameErrorMessage="",this.threadStateService.renameThread(n,t).subscribe({next:()=>{console.log("[THREAD-SELECTOR] Thread renamed successfully"),this.cancelEditingThreadName(),this.isRenamingThread=!1},error:r=>{console.error("[THREAD-SELECTOR] Error renaming thread:",r),this.renameErrorMessage=r.message||"Failed to rename thread",this.isRenamingThread=!1}})}onEditKeydown(e){e.key==="Enter"?(e.preventDefault(),e.stopPropagation(),this.saveThreadName()):e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),this.cancelEditingThreadName())}onEditBlur(){setTimeout(()=>{this.editingThreadId&&!this.isRenamingThread&&this.saveThreadName()},200)}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-thread-selector"]],inputs:{searchMode:"searchMode",searchQuery:[1,"searchQuery"]},outputs:{searchModeChange:"searchModeChange",threadSelected:"threadSelected"},decls:3,vars:1,consts:[["subThreadTemplate",""],["tabindex","0","role","application","aria-label","Thread selector",1,"thread-selector",3,"click","keydown"],[1,"thread-disabled"],["role","menu","aria-label","Thread selection",1,"thread-list"],[1,"thread-loading"],[1,"thread-item-wrapper","sub-thread"],["role","menuitem","tabindex","0",1,"thread-item","sub-thread-item",3,"click","keydown.enter","keydown.space"],[1,"sub-thread-toggle"],[1,"sub-thread-agent"],[1,"sub-thread-task"],[1,"sub-thread-toggle",3,"click"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[1,"loading-spinner"],[1,"loading-text"],[1,"thread-group"],[1,"thread-empty"],[1,"thread-group-header"],[1,"thread-item-wrapper"],[1,"thread-name-edit-wrapper"],["matTooltipShowDelay","1000","role","menuitem","tabindex","0",1,"thread-item",3,"matTooltip","matTooltipDisabled"],[1,"action-buttons"],["mat-icon-button","","title","Rename thread","type","button",1,"action-button","edit-button"],["mat-icon-button","","type","button",1,"action-button","star-button",3,"click","title"],["mat-icon-button","","title","Delete thread","type","button",1,"action-button","delete-button",3,"click"],["type","text","maxlength","200",1,"thread-name-input",3,"ngModelChange","keydown","blur","click","ngModel","disabled"],[1,"rename-error"],["matTooltipShowDelay","1000","role","menuitem","tabindex","0",1,"thread-item",3,"click","keydown.enter","keydown.space","matTooltip","matTooltipDisabled"],[1,"thread-name"],["matTooltip","Shared thread",1,"shared-indicator"],[1,"thread-name-spinner",3,"diameter"],[1,"thread-name","thread-name-generating"],["mat-icon-button","","title","Rename thread","type","button",1,"action-button","edit-button",3,"click"],[1,"disabled-text"]],template:function(t,n){if(t&1&&(l(0,"div",1),v("click",function(o){return o.stopPropagation()})("keydown",function(o){return o.stopPropagation()}),C(1,o0,5,1)(2,l0,3,1,"div",2),c()),t&2){let r;p(),S((r=n.currentProject())!=null&&r.name?1:2)}},dependencies:[Lr,lt,_t,at,ec,st,ke,se,Ge,ze,oc,rc,wi,xi,Qr,nc],styles:[".thread-selector[_ngcontent-%COMP%]{display:flex;flex-direction:column;width:100%;flex:1;min-height:0;overflow-x:hidden;overflow-y:auto}.thread-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:0;max-height:none;overflow:visible}.thread-group[_ngcontent-%COMP%]{display:flex;flex-direction:column;margin-bottom:.5rem}.thread-group[_ngcontent-%COMP%]:last-child{margin-bottom:0}.thread-group-header[_ngcontent-%COMP%]{padding:.5rem 1rem .25rem;font-size:.75rem;font-weight:600;color:var(--color-text-secondary);text-transform:uppercase;letter-spacing:.5px;position:sticky;top:0;background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);z-index:1}.thread-item-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;position:relative;width:100%;border-radius:0;min-width:0;gap:.25rem}.thread-item-wrapper[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.thread-item-wrapper[_ngcontent-%COMP%]:hover .action-buttons[_ngcontent-%COMP%]{display:flex}.thread-item-wrapper.current[_ngcontent-%COMP%]{background:var(--color-primary-light)}.thread-item-wrapper.current[_ngcontent-%COMP%] .thread-item[_ngcontent-%COMP%]{color:var(--color-primary-text);font-weight:600}.thread-item[_ngcontent-%COMP%]{display:flex;align-items:center;flex:1;min-width:0;padding:.75rem 1rem;text-decoration:none;cursor:pointer;transition:all .2s ease;background:transparent;border:none;border-radius:0;color:var(--color-text);text-align:left;justify-content:flex-start}.thread-item.new-thread-item[_ngcontent-%COMP%]{margin-bottom:.25rem}.thread-item[_ngcontent-%COMP%]:hover{color:var(--color-primary)}.thread-item[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-primary);outline-offset:-2px}.action-buttons[_ngcontent-%COMP%]{display:none;align-items:center;gap:.25rem;flex-shrink:0;margin-right:.5rem}.thread-item-wrapper[_ngcontent-%COMP%]:hover .action-buttons[_ngcontent-%COMP%], .thread-item-wrapper.current[_ngcontent-%COMP%] .action-buttons[_ngcontent-%COMP%]{display:flex}.action-button[_ngcontent-%COMP%]{flex-shrink:0;border-radius:4px!important;width:28px!important;height:28px!important;padding:0!important}.action-button[_ngcontent-%COMP%] .mat-mdc-button-persistent-ripple{border-radius:4px!important}.action-button[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)!important}.action-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px}.action-button.edit-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px}.action-button.edit-button[_ngcontent-%COMP%]:hover{background-color:var(--color-primary-hover)!important}.action-button.edit-button[_ngcontent-%COMP%]:hover mat-icon[_ngcontent-%COMP%]{color:var(--color-primary)}.action-button.star-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{transition:color .2s ease}.action-button.star-button.starred[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:#fbbf24}.action-button.star-button[_ngcontent-%COMP%]:not(.starred):hover mat-icon[_ngcontent-%COMP%]{color:#fbbf24}.action-button.delete-button[_ngcontent-%COMP%]:hover mat-icon[_ngcontent-%COMP%]{color:#ef4444}.thread-link[_ngcontent-%COMP%]{display:inline-flex;align-items:center;background:transparent;border:none;text-decoration:none;cursor:pointer;transition:all .2s ease;gap:.5rem;font-size:.875rem;font-weight:400;padding:0 1rem;min-width:0}.thread-link[_ngcontent-%COMP%]:hover:not(.new-thread-link){color:var(--color-primary-hover, var(--color-primary));text-decoration:underline;text-decoration-thickness:1.5px;text-underline-offset:3px}.thread-link[_ngcontent-%COMP%]:focus{outline:2px solid var(--color-primary);outline-offset:2px}.thread-link.new-thread-link[_ngcontent-%COMP%]{margin-bottom:.5rem;font-weight:600;font-size:.95rem}.thread-link.new-thread-link[_ngcontent-%COMP%] .thread-name[_ngcontent-%COMP%]{background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% auto;background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;animation:_ngcontent-%COMP%_gradientShift 3s ease-in-out infinite}.thread-link.new-thread-link[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:var(--color-primary);animation:_ngcontent-%COMP%_iconPulse 3s ease-in-out infinite}.thread-link.new-thread-link[_ngcontent-%COMP%]:hover{transform:translate(4px)}.thread-link.new-thread-link[_ngcontent-%COMP%]:hover mat-icon[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_iconPulse 1.5s ease-in-out infinite}.thread-link[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px}@keyframes _ngcontent-%COMP%_gradientShift{0%{background-position:0 center}50%{background-position:100% center}to{background-position:0 center}}@keyframes _ngcontent-%COMP%_iconPulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.8;transform:scale(1.05)}}.thread-name[_ngcontent-%COMP%]{flex:1;font-size:.875rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:left}.thread-name.thread-name-generating[_ngcontent-%COMP%]{color:var(--color-text-muted);font-style:italic}.thread-name-edit-wrapper[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;padding:0 .5rem}.thread-name-input[_ngcontent-%COMP%]{width:100%;padding:.5rem;border:1px solid var(--color-border);border-radius:4px;background:var(--color-bg-secondary);color:var(--color-text-primary);font-size:.9rem;font-family:inherit}.thread-name-input[_ngcontent-%COMP%]:focus{outline:none;border-color:var(--color-primary);box-shadow:0 0 0 2px #3b82f61a}.thread-name-input[_ngcontent-%COMP%]:disabled{opacity:.6;cursor:not-allowed}.rename-error[_ngcontent-%COMP%]{color:var(--color-error);font-size:.75rem;margin-top:.25rem;padding-left:.5rem}.thread-name-spinner[_ngcontent-%COMP%]{flex-shrink:0;margin-right:.5rem}.thread-name-spinner[_ngcontent-%COMP%] .mat-mdc-progress-spinner circle{stroke:var(--color-primary)!important}.current-indicator[_ngcontent-%COMP%]{color:var(--color-success);font-weight:700;flex-shrink:0;font-size:1rem}.thread-separator[_ngcontent-%COMP%]{height:1px;background:var(--color-border);margin:.25rem 0}.thread-empty[_ngcontent-%COMP%]{padding:1.5rem 1rem;text-align:center;color:var(--color-text-muted);font-size:.8rem;font-style:italic}.thread-loading[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:2rem 1rem;gap:.75rem}.thread-loading[_ngcontent-%COMP%] .loading-spinner[_ngcontent-%COMP%]{width:24px;height:24px;border:3px solid var(--color-border);border-top-color:var(--color-primary);border-radius:50%;animation:_ngcontent-%COMP%_spin .8s linear infinite}.thread-loading[_ngcontent-%COMP%] .loading-text[_ngcontent-%COMP%]{color:var(--color-text-muted);font-size:.8rem}@keyframes _ngcontent-%COMP%_spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.thread-disabled[_ngcontent-%COMP%]{padding:1.5rem 1rem}.thread-disabled[_ngcontent-%COMP%] .disabled-text[_ngcontent-%COMP%]{display:block;color:var(--color-text-muted);font-size:.85rem;font-style:italic;text-align:center}.thread-item-wrapper.sub-thread[_ngcontent-%COMP%]{padding-left:calc(.2rem + var(--sub-depth, 1) * 1.5rem);border-left:2px solid var(--color-primary, #3b82f6);margin-left:.75rem}.thread-item-wrapper.sub-thread[_ngcontent-%COMP%] .sub-thread-item[_ngcontent-%COMP%]{padding:.35rem .5rem .35rem 0;gap:.2rem;font-size:.8rem;color:var(--color-text-secondary)}.thread-item-wrapper.sub-thread[_ngcontent-%COMP%] .sub-thread-item[_ngcontent-%COMP%]:hover{color:var(--color-primary)}.thread-item-wrapper.sub-thread[_ngcontent-%COMP%] .sub-thread-agent[_ngcontent-%COMP%]{font-weight:600;color:var(--color-primary);white-space:nowrap;flex-shrink:0;font-size:.8rem}.thread-item-wrapper.sub-thread[_ngcontent-%COMP%] .sub-thread-task[_ngcontent-%COMP%]{color:var(--color-text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:.75rem}.sub-thread-toggle[_ngcontent-%COMP%]{font-size:16px;width:16px;height:16px;flex-shrink:0;cursor:pointer;color:var(--color-text-secondary);margin-right:.25rem}.sub-thread-toggle[_ngcontent-%COMP%]:hover{color:var(--color-primary)}.shared-indicator[_ngcontent-%COMP%]{font-size:14px;width:14px;height:14px;color:var(--color-text-secondary);flex-shrink:0;margin-left:.25rem}@media(max-width:768px){.thread-item[_ngcontent-%COMP%]{padding:.6rem .8rem}.thread-name[_ngcontent-%COMP%]{font-size:.8rem}}"]})};var c0=["logsContent"],d0=(i,e)=>e.name;function p0(i,e){if(i&1){let t=O();l(0,"button",12),v("click",function(){x(t);let r=h().$implicit,o=h();return w(o.start(r.name))}),l(1,"mat-icon"),u(2,"play_arrow"),c()()}if(i&2){let t=h().$implicit;T("disabled",t.isLoading)}}function m0(i,e){if(i&1){let t=O();l(0,"button",13),v("click",function(){x(t);let r=h().$implicit,o=h();return w(o.stop(r.name))}),l(1,"mat-icon"),u(2,"stop"),c()()}if(i&2){let t=h().$implicit;T("disabled",t.isLoading)}}function u0(i,e){if(i&1&&(l(0,"a",8)(1,"mat-icon",14),u(2,"open_in_new"),c()()),i&2){let t=h().$implicit;T("href",t.url,On)("title",t.url)}}function h0(i,e){if(i&1&&(l(0,"div",15),u(1),c()),i&2){let t=h(),n=t.$implicit,r=t.$index;Ke("order",r*2),p(),L(n.errorMessage)}}function g0(i,e){if(i&1){let t=O();l(0,"button",21),v("click",function(){x(t);let r=h(3);return w(r.onManualRefresh())}),l(1,"mat-icon"),u(2,"refresh"),c()()}}function f0(i,e){if(i&1&&(l(0,"div",16)(1,"div",17)(2,"span",18),u(3),c(),C(4,g0,3,0,"button",19),c(),l(5,"pre",20,0),u(7),c()()),i&2){let t=h(),n=t.$implicit,r=t.$index,o=h();Ke("order",r*2+1),p(3),Ne("",n.name," logs"),p(),S(n.status==="running"?4:-1),p(3),L(o.logs()||"(empty)")}}function _0(i,e){if(i&1){let t=O();l(0,"div",2)(1,"span",3),u(2),c(),l(3,"div",4),C(4,p0,3,1,"button",5)(5,m0,3,1,"button",6),l(6,"span",7),u(7),c(),C(8,u0,3,2,"a",8),l(9,"button",9),v("click",function(){let r=x(t).$implicit,o=h();return w(o.toggleLogs(r.name))}),l(10,"mat-icon"),u(11),c()()()(),C(12,h0,2,3,"div",10),C(13,f0,8,5,"div",11)}if(i&2){let t=e.$implicit,n=e.$index,r=h();Ke("order",n*2),p(2),L(t.name),p(2),S(t.status==="stopped"?4:5),p(2),Y("running",t.status==="running"),p(),Ne(" ",t.status==="running"?"Running":"Stopped"," "),p(),S(t.url?8:-1),p(),T("title",r.logsOpenFor()===t.name?"Hide logs":"Show logs"),p(2),L(r.logsOpenFor()===t.name?"expand_less":"terminal"),p(),S(t.errorMessage?12:-1),p(),S(r.logsOpenFor()===t.name?13:-1)}}var na=class i{destroyRef=f(ri);projectApi=f(Yr);projectName=Ir.required();entryStates=qe([]);hasPreview=Tt(()=>this.entryStates().length>0);logsOpenFor=qe(null);logs=qe("");logsContent;logsPollTimer=null;logsTimeoutTimer=null;static LOGS_POLL_MS=5e3;static LOGS_TIMEOUT_MS=1200*1e3;constructor(){Hi(()=>{let e=this.projectName();e&&this.onProjectChanged(e)},{allowSignalWrites:!0}),Hi(()=>{console.log("entry states",this.entryStates())})}ngOnDestroy(){this.stopLogPolling()}onProjectChanged(e){this.stopLogPolling(),this.entryStates.set([]),this.logsOpenFor.set(null),this.logs.set(""),this.projectApi.getPreviewEntries(e).pipe(ot(this.destroyRef)).subscribe({next:t=>{let n=t.entries;if(n.length===0)return;let r=n.map(a=>({name:a.name,command:a.command,url:a.url,status:"stopped",isLoading:!1,errorMessage:""}));this.entryStates.set(r);let o=n.map(a=>this.projectApi.getPreviewStatus(e,a.name));ol(o).pipe(ot(this.destroyRef)).subscribe({next:a=>{this.entryStates.update(s=>s.map((d,m)=>{let _=a[m];return _?he(G({},d),{status:_.status}):d}))},error:()=>{}})},error:()=>{}})}start(e){this.updateEntry(e,{isLoading:!0,errorMessage:""}),this.projectApi.startPreview(this.projectName(),e).pipe(ot(this.destroyRef)).subscribe({next:t=>{this.updateEntry(e,{status:t.status,isLoading:!1})},error:t=>{this.updateEntry(e,{errorMessage:t?.error?.error??"Failed to start preview",isLoading:!1})}})}stop(e){this.updateEntry(e,{isLoading:!0,errorMessage:""}),this.projectApi.stopPreview(this.projectName(),e).pipe(ot(this.destroyRef)).subscribe({next:()=>{this.updateEntry(e,{status:"stopped",isLoading:!1}),this.logsOpenFor()===e&&this.stopLogPolling()},error:t=>{this.updateEntry(e,{errorMessage:t?.error?.error??"Failed to stop preview",isLoading:!1})}})}toggleLogs(e){this.logsOpenFor()===e?(this.logsOpenFor.set(null),this.logs.set(""),this.stopLogPolling()):(this.logsOpenFor.set(e),this.refreshLogs(),this.startLogPolling())}onManualRefresh(){this.refreshLogs(),this.logsPollTimer&&this.resetLogsTimeout()}refreshLogs(){let e=this.logsOpenFor();e&&this.projectApi.getPreviewLogs(this.projectName(),e).pipe(ot(this.destroyRef)).subscribe({next:t=>{this.logs.set(t.logs),this.scrollLogsToBottom()},error:()=>this.logs.set("(failed to load logs)")})}updateEntry(e,t){this.entryStates.update(n=>n.map(r=>r.name===e?G(G({},r),t):r))}startLogPolling(){this.stopLogPolling(),this.logsPollTimer=setInterval(()=>{this.logsOpenFor()?this.refreshLogs():this.stopLogPolling()},i.LOGS_POLL_MS),this.resetLogsTimeout()}stopLogPolling(){this.logsPollTimer&&(clearInterval(this.logsPollTimer),this.logsPollTimer=null),this.logsTimeoutTimer&&(clearTimeout(this.logsTimeoutTimer),this.logsTimeoutTimer=null)}resetLogsTimeout(){this.logsTimeoutTimer&&clearTimeout(this.logsTimeoutTimer),this.logsTimeoutTimer=setTimeout(()=>{this.stopLogPolling()},i.LOGS_TIMEOUT_MS)}scrollLogsToBottom(){setTimeout(()=>{let e=this.logsContent?.nativeElement;e&&(e.scrollTop=e.scrollHeight)})}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-preview-panel"]],viewQuery:function(t,n){if(t&1&&Be(c0,5),t&2){let r;ge(r=fe())&&(n.logsContent=r.first)}},inputs:{projectName:[1,"projectName"]},decls:3,vars:0,consts:[["logsContent",""],[1,"preview-panel"],[1,"entry-row"],[1,"entry-name"],[1,"entry-actions"],["mat-icon-button","","title","Start","type","button",1,"entry-btn","start",3,"disabled"],["mat-icon-button","","title","Stop","type","button",1,"entry-btn","stop",3,"disabled"],[1,"status-pill"],["target","_blank","rel","noopener noreferrer",1,"preview-url",3,"href","title"],["mat-icon-button","","type","button",1,"entry-btn","logs",3,"click","title"],[1,"preview-error",3,"order"],[1,"logs-container",3,"order"],["mat-icon-button","","title","Start","type","button",1,"entry-btn","start",3,"click","disabled"],["mat-icon-button","","title","Stop","type","button",1,"entry-btn","stop",3,"click","disabled"],[1,"link-icon"],[1,"preview-error"],[1,"logs-container"],[1,"logs-header"],[1,"logs-title"],["mat-icon-button","","title","Refresh logs","type","button",1,"entry-btn"],[1,"logs-content"],["mat-icon-button","","title","Refresh logs","type","button",1,"entry-btn",3,"click"]],template:function(t,n){t&1&&(l(0,"div",1),we(1,_0,14,12,null,null,d0),c()),t&2&&(p(),Te(n.entryStates()))},dependencies:[Ge,ze,ke,se],styles:["[_nghost-%COMP%]{display:block}.preview-panel[_ngcontent-%COMP%]{display:flex;flex-direction:column;padding:.25rem 0}.entry-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;padding:.125rem .5rem;min-height:36px}.entry-name[_ngcontent-%COMP%]{font-size:.82rem;font-weight:500;color:var(--on-surface, #e0e0e0);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1 1 auto;min-width:0}.entry-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.25rem;flex-shrink:0}.entry-btn[_ngcontent-%COMP%]{width:28px!important;height:28px!important;padding:0!important;display:inline-flex!important;align-items:center;justify-content:center;flex-shrink:0}.entry-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px;line-height:18px}.entry-btn.start[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:var(--color-primary)}.entry-btn.stop[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:#e53935}.entry-btn.logs[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:16px;width:16px;height:16px;line-height:16px;color:var(--color-text-secondary)}.entry-btn[disabled][_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.status-pill[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;padding:1px 6px;border-radius:12px;font-size:.68rem;font-weight:600;letter-spacing:.02em;flex-shrink:0;min-width:52px;text-align:center;background:var(--color-bg-hover);color:var(--color-text-secondary);border:1px solid var(--color-border)}.status-pill.running[_ngcontent-%COMP%]{background:#22c55e26;color:#16a34a;border-color:#22c55e66}.preview-url[_ngcontent-%COMP%]{display:inline-flex;align-items:center;text-decoration:none;color:var(--color-primary);flex-shrink:0}.preview-url[_ngcontent-%COMP%]:hover{text-decoration:underline}.preview-url[_ngcontent-%COMP%] .link-icon[_ngcontent-%COMP%]{font-size:14px;width:14px;height:14px}.preview-error[_ngcontent-%COMP%]{font-size:.75rem;color:#c00;padding:0 .75rem}.logs-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;margin:.125rem .5rem .25rem;background:var(--color-bg-hover);border-radius:8px;overflow:hidden;border:1px solid var(--color-border)}.logs-header[_ngcontent-%COMP%]{display:flex;align-items:center;padding:.25rem .75rem;border-bottom:1px solid var(--color-border)}.logs-header[_ngcontent-%COMP%] .logs-title[_ngcontent-%COMP%]{flex:1;font-size:.72rem;font-weight:600;color:var(--color-text-secondary);text-transform:uppercase;letter-spacing:.05em}.logs-content[_ngcontent-%COMP%]{margin:0;padding:.5rem .75rem;font-family:Courier New,Courier,monospace;font-size:.72rem;line-height:1.5;color:var(--color-text);white-space:pre-wrap;word-break:break-all;max-height:200px;overflow-y:auto}.logs-content[_ngcontent-%COMP%]::-webkit-scrollbar{width:6px}.logs-content[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:transparent}.logs-content[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:var(--color-text-secondary);border-radius:3px}"]})};function b0(i,e){if(i&1&&(l(0,"div",3),u(1),c()),i&2){let t=h();p(),Ne("\u274C ",t.errorMessage)}}var gr=class i{dialogRef=f(Hr);data=f(Ur);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||i)};static \u0275cmp=I({type:i,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&&(l(0,"div",0),u(1),l(2,"button",1),v("click",function(){return n.onCancel()}),l(3,"mat-icon"),u(4,"close"),c()()(),l(5,"mat-dialog-content")(6,"textarea",2),ie("ngModelChange",function(o){return ne(n.jsonContent,o)||(n.jsonContent=o),o}),c(),C(7,b0,2,1,"div",3),c(),l(8,"mat-dialog-actions",4)(9,"button",5),v("click",function(){return n.onCancel()}),u(10,"Cancel"),c(),l(11,"button",6),v("click",function(){return n.onSave()}),u(12,"Save"),c()()),t&2&&(p(),Ne(" ",n.title," "),p(5),te("ngModel",n.jsonContent),p(),S(n.errorMessage?7:-1))},dependencies:[it,lt,_t,at,st,se,ze,si,qr,ql,Gr],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)}"]})};var v0=["threadSearchInput"],y0=["*"];function C0(i,e){if(i&1){let t=O();l(0,"button",26),v("click",function(){x(t);let r=h();return w(r.toggle())}),l(1,"mat-icon"),u(2,"menu"),c()(),l(3,"button",27),v("click",function(){x(t);let r=h();return w(r.createNewThread())}),l(4,"mat-icon",10),u(5,"play_circle"),c()()}if(i&2){let t=h();p(3),T("disabled",!t.selectedProjectName())}}function S0(i,e){if(i&1){let t=O();l(0,"div",14)(1,"mat-icon",28),u(2,"search"),c(),l(3,"input",29,0),ie("ngModelChange",function(r){x(t);let o=h();return ne(o.threadSearchQuery,r)||(o.threadSearchQuery=r),w(r)}),v("input",function(){x(t);let r=h();return w(r.onThreadSearchInput())}),c(),l(5,"button",30),v("click",function(){x(t);let r=h();return w(r.closeThreadSearch())}),l(6,"mat-icon"),u(7,"close"),c()()()}if(i&2){let t=h();p(3),te("ngModel",t.threadSearchQuery)}}function x0(i,e){if(i&1){let t=O();l(0,"div",15)(1,"mat-icon",22),u(2,"forum"),c(),l(3,"span",23),u(4,"Threads"),c(),l(5,"button",31),v("click",function(r){x(t);let o=h();return w(o.toggleThreadSearch(r))}),l(6,"mat-icon"),u(7,"search"),c()()()}}function w0(i,e){i&1&&(l(0,"mat-icon",21),u(1,"keyboard_arrow_up"),c())}function T0(i,e){i&1&&(l(0,"mat-icon",22),u(1,"hub"),c())}function E0(i,e){i&1&&(l(0,"mat-icon",21),u(1,"keyboard_arrow_up"),c())}function M0(i,e){i&1&&(l(0,"mat-icon",22),u(1,"tune"),c())}function k0(i,e){i&1&&(l(0,"div",33)(1,"div",37),F(2,"app-options-panel",38),c()())}function P0(i,e){if(i&1){let t=O();l(0,"div",32)(1,"a",20),v("click",function(r){return x(t),h(3).openProjectConfig(),r.preventDefault(),w(r.stopPropagation())}),l(2,"mat-icon",22),u(3,"settings_applications"),c(),l(4,"span",23),u(5,"Project Configuration"),c()()()}}function O0(i,e){i&1&&(l(0,"div",32)(1,"a",39)(2,"mat-icon",22),u(3,"settings_applications"),c(),l(4,"span",23),u(5,"Project config (No project)"),c()()())}function A0(i,e){if(i&1&&C(0,P0,6,0,"div",32)(1,O0,6,0,"div",32),i&2){let t=h(2);S(t.selectedProjectName()?0:1)}}function I0(i,e){if(i&1){let t=O();l(0,"div",32)(1,"a",20),v("click",function(r){return x(t),h(2).openAgents(),r.preventDefault(),w(r.stopPropagation())}),l(2,"mat-icon",22),u(3,"smart_toy"),c(),l(4,"span",23),u(5,"Agents"),c()()()}}function D0(i,e){i&1&&(l(0,"div",32)(1,"a",39)(2,"mat-icon",22),u(3,"smart_toy"),c(),l(4,"span",23),u(5,"Agents (No project)"),c()()())}function R0(i,e){if(i&1){let t=O();l(0,"div",32)(1,"a",20),v("click",function(r){return x(t),h(2).openPrompts(),r.preventDefault(),w(r.stopPropagation())}),l(2,"mat-icon",22),u(3,"description"),c(),l(4,"span",23),u(5,"Prompts"),c()()()}}function N0(i,e){i&1&&(l(0,"div",32)(1,"a",39)(2,"mat-icon",22),u(3,"description"),c(),l(4,"span",23),u(5,"Prompts (No project)"),c()()())}function F0(i,e){if(i&1){let t=O();l(0,"div",32)(1,"a",20),v("click",function(r){return x(t),h(2).openSchedulers(),r.preventDefault(),w(r.stopPropagation())}),l(2,"mat-icon",22),u(3,"schedule"),c(),l(4,"span",23),u(5,"Schedulers"),c()()()}}function L0(i,e){i&1&&(l(0,"div",32)(1,"a",39)(2,"mat-icon",22),u(3,"schedule"),c(),l(4,"span",23),u(5,"Schedulers (No project)"),c()()())}function j0(i,e){i&1&&(l(0,"mat-icon",21),u(1,"keyboard_arrow_up"),c())}function V0(i,e){i&1&&(l(0,"mat-icon",22),u(1,"rocket_launch"),c())}function z0(i,e){if(i&1&&(l(0,"div",33),F(1,"app-preview-panel",40),c()),i&2){let t=h(3);p(),T("projectName",t.selectedProjectName())}}function $0(i,e){if(i&1){let t=O();l(0,"div",32)(1,"a",20),v("click",function(r){return x(t),h(2).toggleSection("preview"),r.preventDefault(),w(r.stopPropagation())}),C(2,j0,2,0,"mat-icon",21)(3,V0,2,0,"mat-icon",22),l(4,"span",23),u(5,"Preview Server"),c()(),C(6,z0,2,1,"div",33),c()}if(i&2){let t=h(2);Y("expanded",t.expandedSections.preview),p(),Y("active",t.expandedSections.preview),p(),S(t.expandedSections.preview?2:3),p(4),S(t.expandedSections.preview?6:-1)}}function B0(i,e){if(i&1){let t=O();l(0,"div",24)(1,"div",32)(2,"a",20),v("click",function(r){return x(t),h().toggleSection("config"),w(r.preventDefault())}),C(3,E0,2,0,"mat-icon",21)(4,M0,2,0,"mat-icon",22),l(5,"span",23),u(6,"Preferences"),c()(),C(7,k0,3,0,"div",33),c(),l(8,"div",32)(9,"a",20),v("click",function(r){return x(t),h().openTokenUsage(),r.preventDefault(),w(r.stopPropagation())}),l(10,"mat-icon",22),u(11,"data_usage"),c(),l(12,"span",23),u(13,"Token Usage"),c()()(),l(14,"div",32)(15,"a",20),v("click",function(r){return x(t),h().openUserConfig(),r.preventDefault(),w(r.stopPropagation())}),l(16,"mat-icon",22),u(17,"manage_accounts"),c(),l(18,"span",23),u(19,"User Configuration"),c()()(),C(20,A0,2,1),C(21,I0,6,0,"div",32)(22,D0,6,0,"div",32),C(23,R0,6,0,"div",32)(24,N0,6,0,"div",32),C(25,F0,6,0,"div",32)(26,L0,6,0,"div",32),C(27,$0,7,6,"div",34),l(28,"div",32)(29,"a",35),F(30,"img",36),l(31,"span",23),u(32,"Contribute on GitHub"),c()()()()}if(i&2){let t=h();p(),Y("expanded",t.expandedSections.config),p(),Y("active",t.expandedSections.config),p(),S(t.expandedSections.config?3:4),p(4),S(t.expandedSections.config?7:-1),p(13),S(t.isAdmin?20:-1),p(),S(t.selectedProjectName()?21:22),p(2),S(t.selectedProjectName()?23:24),p(2),S(t.selectedProjectName()?25:26),p(2),S(t.hasPreviewConfig()?27:-1),p(3),Me("src","CODAY-Logo.png",On)}}function H0(i,e){if(i&1){let t=O();l(0,"div",25)(1,"mat-icon",41),u(2,"warning"),c(),l(3,"span",42),u(4),c(),l(5,"button",43),v("click",function(){x(t);let r=h();return w(r.configErrorMessage="")}),l(6,"mat-icon"),u(7,"close"),c()()()}if(i&2){let t=h();p(4),L(t.configErrorMessage)}}var fr=class i{destroy$=new J;sidenavStateChange=new Z;drawerOpen=!1;breakpointObserver=f(Dl);isDesktop=Ie(this.breakpointObserver.observe("(min-width: 1400px)").pipe(Ae(e=>e.matches)),{initialValue:!1});userOpenPreference=qe(!0);isOpen=Tt(()=>this.userOpenPreference());isAdmin=!1;configErrorMessage="";expandedSections={config:!1,preview:!1,settings:!1};isThreadSearchActive=!1;threadSearchQuery="";threadSearchInput;dialog=f(Wr);configApi=f(pc);projectStateService=f(ye);projectApi=f(Yr);router=f(zt);preferences=f(Pe);threadStateService=f(Ye);projects=Ie(this.projectStateService.projectList$);selectedProject=Ie(this.projectStateService.selectedProject$);selectedProjectName=Ie(this.projectStateService.selectedProject$.pipe(Ae(e=>e?.name)));isProjectVolatile=Ie(this.projectStateService.selectedProject$.pipe(Ae(e=>e?.config?.volatile||!1)));forcedProject=Ie(this.projectStateService.forcedProject$);hasPreviewConfig=Ie(this.projectStateService.selectedProject$.pipe(Ae(e=>{let t=e?.config?.preview;return Array.isArray(t)&&!!t.length})),{initialValue:!1});ngOnInit(){let e=window.innerWidth>=1024,t=this.preferences.getPreference("sidenavOpen",e);this.userOpenPreference.set(t??e),this.configApi.getUserConfig().pipe(D(this.destroy$)).subscribe({next:n=>{this.isAdmin=n.groups?.includes("CODAY_ADMIN")??!1,console.log("[SIDENAV] User admin status:",this.isAdmin)},error:n=>{console.error("[SIDENAV] Error loading user config for roles:",n),this.isAdmin=!1}})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}toggle(){let e=!this.userOpenPreference();this.userOpenPreference.set(e),this.saveSidenavState(e),this.sidenavStateChange.emit(e)}close(){this.userOpenPreference()&&(this.userOpenPreference.set(!1),this.saveSidenavState(!1),this.sidenavStateChange.emit(!1))}saveSidenavState(e){this.preferences.setPreference("sidenavOpen",e)}openTokenUsage(){this.configErrorMessage="",this.router.navigate(["/token-usage"]),this.close()}openUserConfig(){console.log("[SIDENAV] openUserConfig called"),this.configErrorMessage="",this.configApi.getUserConfig().pipe(D(this.destroy$)).subscribe({next:e=>{console.log("[SIDENAV] User config loaded, opening dialog"),this.dialog.open(gr,{data:{configType:"user",initialContent:JSON.stringify(e,null,2)}}).afterClosed().subscribe(n=>{n&&this.saveUserConfig(n)})},error:e=>{console.error("[SIDENAV] Error loading user config:",e),this.configErrorMessage=e?.error?.error||"Failed to load user configuration"}})}saveUserConfig(e){this.configApi.updateUserConfig(e).pipe(D(this.destroy$)).subscribe({next:t=>{console.log("[SIDENAV] User config saved successfully")},error:t=>{console.error("[SIDENAV] Error saving user config:",t),this.configErrorMessage=t?.error?.error||"Failed to save user configuration"}})}openProjectConfig(){let e=this.selectedProjectName();if(!e){console.error("[SIDENAV] No project selected"),this.configErrorMessage="No project selected. Please select a project first.";return}this.configErrorMessage="",this.projectApi.getProjectConfig(e).pipe(D(this.destroy$)).subscribe({next:t=>{console.log("[SIDENAV] Project config loaded, opening dialog"),this.dialog.open(gr,{data:{configType:"project",projectName:e,initialContent:JSON.stringify(t,null,2)}}).afterClosed().subscribe(r=>{r&&this.saveProjectConfig(e,r)})},error:t=>{console.error("[SIDENAV] Error loading project config:",t),this.configErrorMessage=t?.error?.error||"Failed to load project configuration"}})}saveProjectConfig(e,t){this.projectApi.updateProjectConfig(e,t).pipe(D(this.destroy$)).subscribe({next:n=>{console.log("[SIDENAV] Project config saved successfully")},error:n=>{console.error("[SIDENAV] Error saving project config:",n),this.configErrorMessage=n?.error?.error||"Failed to save project configuration"}})}requireProjectSelection(e){return this.selectedProjectName()?!0:(console.error(`[SIDENAV] No project selected, cannot ${e}`),this.configErrorMessage="Please select a project first",!1)}openAgents(){if(!this.requireProjectSelection("open agents"))return;let e=this.selectedProjectName();this.router.navigate(["project",e,"agents"]),this.close()}openPrompts(){if(!this.requireProjectSelection("open prompts"))return;let e=this.selectedProjectName();this.router.navigate(["project",e,"prompts"]),this.close()}openSchedulers(){if(!this.requireProjectSelection("open schedulers"))return;let e=this.selectedProjectName();this.router.navigate(["project",e,"schedulers"]),this.close()}toggleSection(e){let t=this.expandedSections[e];e==="settings"?this.expandedSections[e]=!t:(["config","preview"].forEach(r=>{this.expandedSections[r]=!1}),this.expandedSections[e]=!t)}navigateToHome(){if(this.forcedProject()){console.log("[SIDENAV] Cannot navigate to home - forced project active");return}console.log("[SIDENAV] Navigating to home (project selection)"),this.projectStateService.clearSelection(),this.router.navigate(["/"])}createNewThread(){let e=this.selectedProjectName();if(!e){console.error("[SIDENAV] No project selected, cannot create new thread"),this.configErrorMessage="Please select a project first";return}console.log("[SIDENAV] Navigating to welcome view for new thread"),this.threadStateService.clearSelection(),this.router.navigate(["project",e])}onThreadSelectedOnMobile(){this.isDesktop()||this.close()}toggleThreadSearch(e){e.stopPropagation(),this.isThreadSearchActive=!0,this.threadSearchQuery="",setTimeout(()=>{this.threadSearchInput?.nativeElement.focus()},0)}closeThreadSearch(){this.isThreadSearchActive=!1,this.threadSearchQuery=""}onThreadSearchInput(){}onThreadSearchModeChange(e){e||this.closeThreadSearch()}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-sidenav"]],viewQuery:function(t,n){if(t&1&&Be(v0,5),t&2){let r;ge(r=fe())&&(n.threadSearchInput=r.first)}},inputs:{drawerOpen:"drawerOpen"},outputs:{sidenavStateChange:"sidenavStateChange"},ngContentSelectors:y0,decls:34,vars:31,consts:[["threadSearchInput",""],[1,"sidenav-container",3,"hasBackdrop"],["mode","push","position","start",1,"app-sidenav",3,"closed","opened","disableClose"],[1,"sidenav-header"],["mat-icon-button","","title","Close menu",3,"click"],["alt","coday",3,"click","keydown.enter","keydown.space","title"],[1,"header-title-section"],[1,"sidenav-title"],[1,"new-thread-section"],["role","button","tabindex","0",1,"new-thread-link",3,"click"],["fontSet","material-icons-outlined"],[1,"new-thread-text"],[1,"sidenav-sections"],[1,"section-container","expanded"],[1,"search-header"],[1,"section-toggle","active","threads-header"],[1,"section-content","threads"],[1,"sidenav-thread-selector",3,"searchModeChange","threadSelected","searchMode","searchQuery"],[1,"sidenav-nav"],[1,"section-container","settings-group"],["role","button","tabindex","0",1,"section-toggle",3,"click"],[1,"arrow-icon","expanded"],[1,"section-icon"],[1,"section-label"],[1,"section-content","settings-content"],["role","alert",1,"error-notification"],["mat-icon-button","","title","Menu","type","button",1,"sidenav-toggle-btn",3,"click"],["mat-icon-button","","title","Start a new thread","type","button",1,"sidenav-new-thread-btn",3,"click","disabled"],[1,"search-icon"],["type","text","placeholder","Search threads...",1,"search-input",3,"ngModelChange","input","ngModel"],["mat-icon-button","","title","Close search","type","button",1,"close-search-btn",3,"click"],["mat-icon-button","","title","Search threads","type","button",1,"search-button",3,"click"],[1,"section-container"],[1,"section-content"],[1,"section-container",3,"expanded"],["href","https://github.com/whoz-oss/coday","target","_blank","rel","noopener noreferrer","title","Contribute on GitHub",1,"section-toggle","contribute-btn"],["alt","Coday",1,"contribute-logo"],[1,"preference-item"],[1,"inline-panel"],["role","button","tabindex","-1","aria-disabled","true",1,"section-toggle","disabled"],[3,"projectName"],[1,"error-icon"],[1,"error-text"],["mat-icon-button","","aria-label","Close error message",1,"error-close",3,"click"]],template:function(t,n){t&1&&(rn(),C(0,C0,6,1),l(1,"mat-sidenav-container",1)(2,"mat-sidenav",2),v("closed",function(){return n.close()}),l(3,"div",3)(4,"button",4),v("click",function(){return n.close()}),l(5,"mat-icon"),u(6,"chevron_left"),c()(),l(7,"img",5),v("click",function(o){return n.navigateToHome(),o.stopPropagation()})("keydown.enter",function(o){return n.navigateToHome(),o.preventDefault(),o.stopPropagation()})("keydown.space",function(o){return n.navigateToHome(),o.preventDefault(),o.stopPropagation()}),c(),l(8,"div",6)(9,"h2",7),u(10),c()()(),l(11,"div",8)(12,"a",9),v("click",function(o){return n.createNewThread(),o.preventDefault()}),l(13,"mat-icon",10),u(14,"play_circle"),c(),l(15,"span",11),u(16,"Start a new thread"),c()()(),l(17,"div",12)(18,"div",13),C(19,S0,8,1,"div",14)(20,x0,8,0,"div",15),l(21,"div",16)(22,"app-thread-selector",17),v("searchModeChange",function(o){return n.onThreadSearchModeChange(o)})("threadSelected",function(){return n.onThreadSelectedOnMobile()}),c()()()(),l(23,"div",18)(24,"div",19)(25,"a",20),v("click",function(o){return n.toggleSection("settings"),o.preventDefault()}),C(26,w0,2,0,"mat-icon",21)(27,T0,2,0,"mat-icon",22),l(28,"span",23),u(29,"Control Center"),c()(),C(30,B0,33,12,"div",24),c()()(),l(31,"mat-sidenav-content"),ht(32),c()(),C(33,H0,8,1,"div",25)),t&2&&(S(!n.isOpen()&&!n.drawerOpen?0:-1),p(),Y("sidenav-open",n.isOpen()),T("hasBackdrop",!1),p(),T("opened",n.isOpen())("disableClose",!0),p(5),Y("sidenav-logo",!0)("clickable",!n.forcedProject())("disabled",n.forcedProject()),T("title",n.forcedProject()?"Project selection disabled":"Go to project selection"),Me("src","CODAY-Logo.png",On)("role",n.forcedProject()?null:"button")("tabindex",n.forcedProject()?null:"0"),p(3),L(n.selectedProjectName()),p(9),S(n.isThreadSearchActive?19:20),p(3),T("searchMode",n.isThreadSearchActive)("searchQuery",n.threadSearchQuery),p(),Y("is-admin",n.isAdmin),p(),Y("expanded",n.expandedSections.settings),p(),Y("active",n.expandedSections.settings),p(),S(n.expandedSections.settings?26:27),p(4),S(n.expandedSections.settings?30:-1),p(),Y("sidenav-closed-offset",!n.isOpen()),p(2),S(n.configErrorMessage?33:-1))},dependencies:[lt,_t,at,st,Xo,js,Cp,Qo,ke,se,Ge,ze,Ep,Mp,hr,ta,na],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%;position:relative}.sidenav-container[_ngcontent-%COMP%]{position:fixed;top:0;left:0;right:0;height:100dvh;z-index:1400;transition:width;display:flex}.sidenav-container[_ngcontent-%COMP%] mat-sidenav[_ngcontent-%COMP%]{position:relative!important;transition:width;width:25%;min-width:320px;height:100dvh!important;flex-shrink:0}.sidenav-container[_ngcontent-%COMP%] mat-sidenav[_ngcontent-%COMP%]:not(.mat-drawer-opened){width:0!important;min-width:0;overflow:hidden!important;visibility:hidden!important}.sidenav-container[_ngcontent-%COMP%] mat-sidenav-content[_ngcontent-%COMP%]{width:100%;margin:0!important}@media(min-width:1024px){.sidenav-container[_ngcontent-%COMP%] mat-sidenav-content[_ngcontent-%COMP%]{min-width:0}}[_nghost-%COMP%] .mat-drawer-backdrop{pointer-events:auto}[_nghost-%COMP%] .mat-drawer-content{pointer-events:auto!important;background:transparent!important;overflow:visible!important}[_nghost-%COMP%] .mat-drawer-inner-container{overflow:hidden!important;height:100dvh!important;display:flex!important;flex-direction:column!important}.sidenav-new-thread-btn[_ngcontent-%COMP%], .sidenav-toggle-btn[_ngcontent-%COMP%]{position:fixed!important;z-index:1500!important;width:40px!important;height:40px!important;border-radius:50%!important;background:var(--glass-bg)!important;backdrop-filter:var(--glass-backdrop-blur)!important;-webkit-backdrop-filter:var(--glass-backdrop-blur)!important;border:1px solid var(--glass-border)!important;box-shadow:var(--glass-shadow)!important}.sidenav-toggle-btn[_ngcontent-%COMP%]{top:1rem!important;left:1rem!important}.sidenav-new-thread-btn[_ngcontent-%COMP%]{top:calc(1.5rem + 40px)!important;left:1rem!important}.sidenav-new-thread-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:var(--color-primary)!important}.sidenav-new-thread-btn[_ngcontent-%COMP%]:disabled{opacity:.5!important}.sidenav-logo-btn[_ngcontent-%COMP%]{position:fixed!important;bottom:1rem!important;left:1rem!important;z-index:1500!important;width:56px!important;height:56px!important;border-radius:50%!important;border:1px solid var(--glass-border)!important;padding:4px!important;background:var(--glass-bg)!important;backdrop-filter:var(--glass-backdrop-blur)!important;-webkit-backdrop-filter:var(--glass-backdrop-blur)!important;box-shadow:var(--glass-shadow)!important;transition:all .3s cubic-bezier(.4,0,.2,1)!important;cursor:pointer!important;pointer-events:auto!important;display:flex!important;align-items:center!important;justify-content:center!important;overflow:hidden!important;text-decoration:none!important}.sidenav-logo-btn[_ngcontent-%COMP%]:hover{transform:scale(1.08) translateY(-2px)!important;box-shadow:0 16px 48px #0003!important;border-color:var(--color-primary)!important}.sidenav-logo-btn[_ngcontent-%COMP%]:active{transform:scale(.96)!important}.sidenav-logo-btn[_ngcontent-%COMP%] .logo[_ngcontent-%COMP%]{width:48px;height:48px;border-radius:2px}.app-sidenav[_ngcontent-%COMP%]{width:480px;height:100dvh!important;min-height:0!important;position:relative;background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border-radius:0;overflow:hidden;overflow-x:hidden!important;display:flex;flex-direction:column}.sidenav-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:1rem;padding:1.5rem 1rem .5rem;flex-shrink:0}.sidenav-header[_ngcontent-%COMP%] .sidenav-logo[_ngcontent-%COMP%]{width:40px;height:40px;border-radius:4px;flex-shrink:0;transition:all .2s ease}.sidenav-header[_ngcontent-%COMP%] .sidenav-logo.clickable[_ngcontent-%COMP%]{cursor:pointer}.sidenav-header[_ngcontent-%COMP%] .sidenav-logo.clickable[_ngcontent-%COMP%]:hover{transform:scale(1.1);filter:drop-shadow(0 4px 12px rgba(0,0,0,.15))}.sidenav-header[_ngcontent-%COMP%] .sidenav-logo.clickable[_ngcontent-%COMP%]:active{transform:scale(.95)}.sidenav-header[_ngcontent-%COMP%] .sidenav-logo.clickable[_ngcontent-%COMP%]:focus{outline:2px solid var(--color-primary);outline-offset:2px}.sidenav-header[_ngcontent-%COMP%] .sidenav-logo.disabled[_ngcontent-%COMP%]{opacity:.5;cursor:not-allowed;pointer-events:none}.sidenav-header[_ngcontent-%COMP%] .header-title-section[_ngcontent-%COMP%]{flex:1;display:flex;align-items:center;min-width:0}.sidenav-header[_ngcontent-%COMP%] .header-title-section[_ngcontent-%COMP%] .sidenav-title[_ngcontent-%COMP%]{margin:0;font-size:1.25rem;font-weight:600;color:var(--color-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.loading-section[_ngcontent-%COMP%]{padding:2rem 1rem;display:flex;align-items:center;justify-content:center}.loading-content[_ngcontent-%COMP%]{width:100%;display:flex;flex-direction:column;gap:1rem;align-items:center}.loading-content[_ngcontent-%COMP%] mat-progress-bar[_ngcontent-%COMP%]{width:100%;height:4px;border-radius:2px}.loading-content[_ngcontent-%COMP%] .loading-text[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary);text-align:center}.new-thread-section[_ngcontent-%COMP%]{padding:1rem 1rem .5rem;flex-shrink:0}.new-thread-link[_ngcontent-%COMP%]{display:inline-flex;align-items:center;background:transparent;border:none;text-decoration:none;cursor:pointer;transition:all .2s ease;gap:.5rem;font-size:.95rem;font-weight:600;padding:0}.new-thread-link[_ngcontent-%COMP%] .new-thread-text[_ngcontent-%COMP%]{background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% auto;background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;animation:_ngcontent-%COMP%_gradientShift 3s ease-in-out infinite}.new-thread-link[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px;color:var(--color-primary);animation:_ngcontent-%COMP%_iconPulse 3s ease-in-out infinite}.new-thread-link[_ngcontent-%COMP%]:hover{transform:translate(4px)}.new-thread-link[_ngcontent-%COMP%]:hover mat-icon[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_iconPulse 1.5s ease-in-out infinite}.new-thread-link[_ngcontent-%COMP%]:focus{transform:scale(1.1)}@keyframes _ngcontent-%COMP%_gradientShift{0%{background-position:0% center}50%{background-position:100% center}to{background-position:0% center}}@keyframes _ngcontent-%COMP%_iconPulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.8;transform:scale(1.05)}}.sidenav-sections[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex:1;min-height:100px;overflow:hidden}.sidenav-sections[_ngcontent-%COMP%] > .section-container[_ngcontent-%COMP%], .sidenav-sections[_ngcontent-%COMP%] > .section-container.expanded[_ngcontent-%COMP%], .sidenav-sections[_ngcontent-%COMP%] > .section-container[_ngcontent-%COMP%] > .section-content.threads[_ngcontent-%COMP%], .sidenav-sections[_ngcontent-%COMP%] > .section-container[_ngcontent-%COMP%] > .section-content.threads[_ngcontent-%COMP%] > app-thread-selector[_ngcontent-%COMP%]{display:flex!important;flex-direction:column!important;flex:1!important;min-height:0!important;overflow:hidden!important}.sidenav-nav[_ngcontent-%COMP%]{flex-shrink:0;display:flex;flex-direction:column;overflow:hidden;max-height:70%;border-top:1px solid var(--color-border)}.sidenav-nav[_ngcontent-%COMP%] > .settings-group[_ngcontent-%COMP%] > .section-toggle.active[_ngcontent-%COMP%]{border-top:none}.sidenav-nav[_ngcontent-%COMP%] .settings-group[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden}.sidenav-nav[_ngcontent-%COMP%] .settings-group[_ngcontent-%COMP%] > .section-toggle[_ngcontent-%COMP%]{flex-shrink:0}.sidenav-nav[_ngcontent-%COMP%] .settings-group[_ngcontent-%COMP%] > .section-content.settings-content[_ngcontent-%COMP%]{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden}.settings-group[_ngcontent-%COMP%] > .section-content.settings-content[_ngcontent-%COMP%]{padding:0;border-bottom:1px solid var(--color-border);overflow:visible}.settings-group[_ngcontent-%COMP%] > .section-content.settings-content[_ngcontent-%COMP%] .section-container.expanded[_ngcontent-%COMP%] .section-content[_ngcontent-%COMP%]{max-height:40vh;overflow-y:auto;overflow-x:hidden}.contribute-btn[_ngcontent-%COMP%] .contribute-logo[_ngcontent-%COMP%]{width:20px;height:20px;border-radius:2px;flex-shrink:0}.section-container[_ngcontent-%COMP%]{flex-shrink:0;display:flex;flex-direction:column}.section-container.expanded[_ngcontent-%COMP%]{display:flex;flex-direction:column}.section-container.expanded[_ngcontent-%COMP%] .section-content[_ngcontent-%COMP%]{border-bottom:none}.section-toggle[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.75rem;width:100%;padding:.5rem 1rem;height:50px;text-decoration:none;cursor:pointer;transition:all .2s ease;background:transparent;border:none;border-radius:0;color:var(--color-text);flex-shrink:0}.section-toggle.active[_ngcontent-%COMP%]{border-top:1px solid var(--color-border)}.section-toggle.disabled[_ngcontent-%COMP%]{opacity:.5;cursor:not-allowed;pointer-events:none}.section-toggle[_ngcontent-%COMP%] .arrow-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px;color:var(--color-text-secondary);transition:transform .2s ease;transform:rotate(0);flex-shrink:0}.section-toggle[_ngcontent-%COMP%] .section-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px;color:var(--color-text-secondary);flex-shrink:0}.section-toggle[_ngcontent-%COMP%] .section-label[_ngcontent-%COMP%]{flex:1;font-size:.9rem;color:var(--color-text);text-align:left}.section-toggle[_ngcontent-%COMP%] .search-button[_ngcontent-%COMP%]{margin-left:auto;flex-shrink:0}.section-toggle[_ngcontent-%COMP%] .search-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px}.section-toggle[_ngcontent-%COMP%]:hover:not(.disabled){background:var(--color-bg-hover)}.section-toggle[_ngcontent-%COMP%]:active:not(.disabled){transform:scale(.98)}.section-toggle[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-primary);outline-offset:-2px}.search-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.5rem 1rem;height:50px;background:var(--color-bg-hover);border-top:1px solid var(--color-border);transition:all .2s ease}.search-header[_ngcontent-%COMP%] .search-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px;color:var(--color-text-secondary);flex-shrink:0}.search-header[_ngcontent-%COMP%] .search-input[_ngcontent-%COMP%]{flex:1;border:none;outline:none;background:transparent;color:var(--color-text);font-size:.9rem;padding:0;min-width:0}.search-header[_ngcontent-%COMP%] .search-input[_ngcontent-%COMP%]::placeholder{color:var(--color-text-muted)}.search-header[_ngcontent-%COMP%] .close-search-btn[_ngcontent-%COMP%]{flex-shrink:0}.search-header[_ngcontent-%COMP%] .close-search-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px}.section-content[_ngcontent-%COMP%]{padding:.5rem 0 0;animation:_ngcontent-%COMP%_slideDown .2s ease;border-bottom:1px solid var(--color-border);display:flex;flex-direction:column}.section-content.threads[_ngcontent-%COMP%]{padding:0;border-bottom:none;flex:1!important;min-height:0!important;overflow:hidden!important}.section-content.threads[_ngcontent-%COMP%] app-thread-selector[_ngcontent-%COMP%]{flex:1!important;min-height:0!important;overflow:hidden!important;display:flex!important;flex-direction:column!important}@keyframes _ngcontent-%COMP%_slideDown{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}.config-links[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.75rem;padding:.5rem 1rem;margin-bottom:1rem}.sidenav-item[_ngcontent-%COMP%]{width:100%}.sidenav-item[_ngcontent-%COMP%] .item-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px;color:var(--color-text-secondary)}.sidenav-item[_ngcontent-%COMP%] .item-text[_ngcontent-%COMP%]{flex:1;font-size:.9rem}.sidenav-item[_ngcontent-%COMP%] .disabled-hint[_ngcontent-%COMP%]{font-size:.7rem;color:var(--color-text-secondary);font-style:italic}.sidenav-link.disabled[_ngcontent-%COMP%]{opacity:.5;cursor:not-allowed;color:var(--color-text-secondary)}.sidenav-link.disabled[_ngcontent-%COMP%] .item-icon[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.sidenav-link[_ngcontent-%COMP%] .item-icon[_ngcontent-%COMP%], .sidenav-link[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px;color:var(--color-primary)}.sidenav-link[_ngcontent-%COMP%] .item-text[_ngcontent-%COMP%]{font-size:.875rem}.preference-item[_ngcontent-%COMP%]{padding-bottom:1rem;margin-bottom:1rem;border-bottom:1px solid var(--color-border)}.preference-item[_ngcontent-%COMP%]:last-child{margin-bottom:0;padding-bottom:0;border-bottom:none}.preference-item[_ngcontent-%COMP%] .preference-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.75rem;margin-bottom:.75rem;padding:0 1rem}.preference-item[_ngcontent-%COMP%] .preference-header[_ngcontent-%COMP%] .item-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px}.preference-item[_ngcontent-%COMP%] .preference-header[_ngcontent-%COMP%] .item-text[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.preference-item[_ngcontent-%COMP%] .preference-content[_ngcontent-%COMP%]{padding:0 1rem}.error-notification[_ngcontent-%COMP%]{position:fixed;top:5rem;left:50%;transform:translate(-50%);z-index:2000;display:flex;align-items:center;gap:.75rem;background:#ff3b3026;backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid rgba(255,59,48,.3);border-radius:16px;padding:1rem 1.5rem;box-shadow:var(--glass-shadow);animation:_ngcontent-%COMP%_errorSlideDown .3s cubic-bezier(.4,0,.2,1)}.error-notification[_ngcontent-%COMP%] .error-icon[_ngcontent-%COMP%]{font-size:1.2rem;flex-shrink:0;color:#c00}.error-notification[_ngcontent-%COMP%] .error-text[_ngcontent-%COMP%]{flex:1;color:#c00;font-size:.9rem;font-weight:500}@keyframes _ngcontent-%COMP%_errorSlideDown{0%{opacity:0;transform:translate(-50%,-10px)}to{opacity:1;transform:translate(-50%)}}@media(max-width:480px){.app-sidenav[_ngcontent-%COMP%]{width:320px}.sidenav-toggle-btn[_ngcontent-%COMP%]{top:.75rem!important;left:.75rem!important}.sidenav-new-thread-btn[_ngcontent-%COMP%]{top:calc(1.25rem + 40px)!important;left:.75rem!important}.error-notification[_ngcontent-%COMP%]{left:1rem;right:1rem;transform:none;max-width:calc(100vw - 2rem)}}body.dark[_nghost-%COMP%] .app-sidenav[_ngcontent-%COMP%], body.dark [_nghost-%COMP%] .app-sidenav[_ngcontent-%COMP%], [_ngcontent-%COMP%]:root[data-theme=dark] .app-sidenav[_ngcontent-%COMP%]{background:#242830f2;border-right-color:#b4c8ff17}body.dark[_nghost-%COMP%] .sidenav-header[_ngcontent-%COMP%], body.dark [_nghost-%COMP%] .sidenav-header[_ngcontent-%COMP%], [_ngcontent-%COMP%]:root[data-theme=dark] .sidenav-header[_ngcontent-%COMP%]{background:#242830b3}"]})};var ia=class i{destroy$=new J;isSetup=!1;codayService=f(mt);preferencesService=f(Pe);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$),ba(),ve(([e,t])=>e===!0&&t===!1)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Agent stopped thinking, notifying task finished"),this.notifyTaskFinishedIfEnabled()}),this.preferencesService.browserNotificationEnabled$.pipe(D(this.destroy$),ba(),ve(([e,t])=>e===!1&&t===!0)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Browser notifications enabled, checking permission"),this.handleBrowserNotificationEnabled()}),this.isSetup=!0}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(),n=e.createGain();t.connect(n),n.connect(e.destination),t.frequency.setValueAtTime(700,e.currentTime),n.gain.setValueAtTime(.1,e.currentTime),n.gain.exponentialRampToValueAtTime(.01,e.currentTime+.08),t.start(e.currentTime),t.stop(e.currentTime+.08);let r=e.createOscillator(),o=e.createGain();r.connect(o),o.connect(e.destination);let a=e.currentTime+.11;r.frequency.setValueAtTime(950,a),o.gain.setValueAtTime(.1,a),o.gain.exponentialRampToValueAtTime(.01,a+.09),r.start(a),r.stop(a+.09),console.log("[AGENT-NOTIFICATION] Completion sound played")}catch(e){console.error("[AGENT-NOTIFICATION] Failed to play completion sound:",e)}}handleBrowserNotificationEnabled(){return B(this,null,function*(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications"),this.preferencesService.setBrowserNotificationEnabled(!1);return}if(Notification.permission==="denied"){console.warn("[AGENT-NOTIFICATION] Permission denied, disabling browser notifications"),this.preferencesService.setBrowserNotificationEnabled(!1);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(!1)}})}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:!1});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:!1});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||i)};static \u0275prov=H({token:i,factory:i.\u0275fac,providedIn:"root"})};var U0=["inputSection"];function W0(i,e){if(i&1){let t=O();l(0,"app-thread",4),v("chatFocused",function(){x(t);let r=h();return w(r.onChatFocusedOnMobile())})("drawerStateChange",function(r){x(t);let o=h();return w(o.onDrawerStateChange(r))}),c()}if(i&2){let t=h();T("projectName",t.projectName)("threadId",t.threadId)}}function q0(i,e){if(i&1){let t=O();l(0,"div",5),F(1,"app-welcome-message"),c(),l(2,"div",6,0)(4,"div",7)(5,"div",8)(6,"app-chat-textarea",9),v("messageSubmitted",function(r){x(t);let o=h();return w(o.onMessageSubmitted(r))})("voiceRecordingToggled",function(r){x(t);let o=h();return w(o.onVoiceToggled(r))})("heightChanged",function(r){x(t);let o=h();return w(o.onInputHeightChanged(r))})("textareaFocused",function(){x(t);let r=h();return w(r.onChatFocusedOnMobile())}),c()()()()}if(i&2){let t=h();p(6),T("isDisabled",t.isSessionInitializing)("isSessionInitializing",t.isSessionInitializing)("showWelcome",!0)("isThinking",!1)("isStarting",t.isStartingFirstMessage)}}var _r=class i{destroy$=new J;inputSection;sidenav;projectName="";threadId=null;isSessionInitializing=!1;isStartingFirstMessage=!1;inputSectionHeight=80;codayService=f(mt);titleService=f(Fi);preferencesService=f(Pe);route=f(jr);router=f(zt);threadApiService=f(Yt);agentNotificationService=f(ia);firstMessageState=f(Li);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,n=e.threadId||null;console.log("[MAIN-APP] Route params updated:",{project:t,thread:n,previousProject:this.projectName,previousThread:this.threadId}),this.projectName=t,this.threadId=n,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=!0,this.isStartingFirstMessage=!0,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=!1,this.isStartingFirstMessage=!1,alert("Failed to create conversation: "+(t.message||"Unknown error"))}})}onVoiceToggled(e){console.log("[VOICE] Recording in welcome view:",e)}isDrawerOpen=!1;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||i)};static \u0275cmp=I({type:i,selectors:[["app-main"]],viewQuery:function(t,n){if(t&1&&Be(U0,5)(fr,5),t&2){let r;ge(r=fe())&&(n.inputSection=r.first),ge(r=fe())&&(n.sidenav=r.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","voiceRecordingToggled","heightChanged","textareaFocused","isDisabled","isSessionInitializing","showWelcome","isThinking","isStarting"]],template:function(t,n){t&1&&(l(0,"app-sidenav",1)(1,"div",2),v("mousedown",function(){return n.onChatFocusedOnMobile()})("touchstart",function(){return n.onChatFocusedOnMobile()}),C(2,W0,1,2,"app-thread",3)(3,q0,7,5),c()()),t&2&&(T("drawerOpen",n.isDrawerOpen),p(2),S(n.threadId?2:3))},dependencies:[yi,Zo,ea,fr],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:[Ia("slideIn",[Xr(":enter",[_n({transform:"translateY(100%)",opacity:0}),Kr("300ms ease-out",_n({transform:"translateY(0)",opacity:1}))]),Xr(":leave",[Kr("200ms ease-in",_n({transform:"translateY(100%)",opacity:0}))])])]}})};var Vi=i=>B(null,null,function*(){let e=f(ye),t=i.params.projectName;return t?e.getSelectedProjectId()===t?!0:(e.selectProject(t),(yield rl(e.selectedProject$.pipe(ll(r=>r?.name===t))))?.name===t):(console.log("[PROJECT GUARD] no project id in route"),!1)});var Pp=i=>B(null,null,function*(){let e=f(Ye),t=f(Qt),n=i.params.threadId;if(!t.getUsername())try{yield ga(t.fetchCurrentUser())}catch(r){console.error("[THREAD GUARD] Failed to load current user:",r)}if(!n)return console.log("[THREAD GUARD] no threadId in route"),!1;if(console.log("[THREAD GUARD] Checking thread:",n),console.log("[THREAD GUARD] Current selected thread:",e.getSelectedThreadId()),e.getSelectedThreadId()===n)return console.log("[THREAD GUARD] Thread already selected, allowing navigation"),!0;console.log("[THREAD GUARD] Selecting thread:",n),e.selectThread(n);try{let r=yield ga(Pn([e.isLoading$,e.selectedThread$]).pipe(gt(([a,s])=>console.log(`\u{1F43C} [${a?"loading":"loaded"}]`,s?.id)),ve(([a,s])=>!a&&!!s),ti(1),Ae(([a,s])=>s?.id))),o=r===n;return o?console.log("[THREAD GUARD] Thread validated, allowing navigation"):console.error("[THREAD GUARD] Thread ID mismatch - route:",n,"loaded:",r),o}catch(r){return console.error("[THREAD GUARD] Error loading thread:",r),!1}});var Op=[{path:"",component:yo},{path:"oauth/callback",component:Fo},{path:"project/new",loadComponent:()=>import("./chunk-QJ5RZT2C.js").then(i=>i.ProjectNewComponent)},{path:"project/:projectName",component:_r,canActivate:[Vi]},{path:"project/:projectName/prompts",loadComponent:()=>import("./chunk-JROTC4FL.js").then(i=>i.PromptListComponent),canActivate:[Vi]},{path:"project/:projectName/schedulers",loadComponent:()=>import("./chunk-STNEVMCX.js").then(i=>i.SchedulerListComponent),canActivate:[Vi]},{path:"project/:projectName/agents",loadComponent:()=>import("./chunk-23NDPEFI.js").then(i=>i.AgentListComponent),canActivate:[Vi]},{path:"project/:projectName/thread/:threadId",component:_r,canActivate:[Vi,Pp]},{path:"token-usage",loadComponent:()=>import("./chunk-6PWH64OF.js").then(i=>i.TokenUsageComponent)},{path:"agentos",loadChildren:()=>import("./chunk-C74ZFHFW.js").then(i=>i.AGENTOS_ROUTES)},{path:"**",redirectTo:""}];function G0(i){return()=>i.initializeDefaultProject()}function Y0(i){return()=>{console.log("[APP_INIT] OAuthService initialized")}}var Ap={providers:[ml(),Sl({eventCoalescing:!0}),kl(Op),El(),dd(),dl(Ul),{provide:wa,useFactory:G0,deps:[ye],multi:!0},{provide:wa,useFactory:Y0,deps:[Sn],multi:!0},Gl({basePath:"/api/agentos"}),{provide:Wl,useValue:{width:"80vw",maxWidth:"80vw",maxHeight:"80vh"}}]};var ra=class i{title="client";themeService=f(ji);ngOnInit(){console.log("[APP] Application initialized with theme:",this.themeService.getCurrentTheme())}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-root"]],decls:1,vars:0,template:function(t,n){t&1&&F(0,"router-outlet")},dependencies:[Pl,Ml],encapsulation:2})};Tl(ra,Ap).catch(i=>console.error(i));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whoz-oss/coday-client",
3
- "version": "0.116.0",
3
+ "version": "0.117.1",
4
4
  "repository": "https://github.com/whoz-oss/coday",
5
5
  "type": "module",
6
6
  "dependencies": {
@@ -1 +0,0 @@
1
- import{x as Q}from"./chunk-4NNLWDVJ.js";import"./chunk-5MXEOOQM.js";import{D as H,c as B,e as _,g as L,h as j,i as G,l as M,n as J,s as A,u as $,v as q,w as K,x as U}from"./chunk-AE24ERN3.js";import{c as R,d as z}from"./chunk-2DVVHRX4.js";import{a as h,b as x}from"./chunk-VVZKXHDD.js";import{$a as V,Ab as E,Ea as O,Qb as D,Ra as P,Sa as C,T as c,Ta as b,Wa as T,X as f,Xa as w,Y as u,Ya as s,Za as o,_a as i,a as I,b as S,ba as k,ga as d,gb as y,ib as p,kb as g,rc as F,tc as N,ua as l,yb as a,zb as v}from"./chunk-TRUXCA4C.js";function Y(r,t){r&1&&(o(0,"p",5),a(1,"Loading\u2026"),i())}function Z(r,t){if(r&1&&(o(0,"option",13),a(1),i()),r&2){let e=t.$implicit;s("value",e.type),l(),v(e.displayName)}}function ee(r,t){if(r&1){let e=y();o(0,"div",16)(1,"ds-json-schema-form",20),p("valueChange",function(m){f(e);let X=g(2);return u(X.onParamsChange(m))}),i()()}if(r&2){let e=g(2);l(),s("schema",t)("value",e.initialParams())}}function te(r,t){if(r&1){let e=y();o(0,"form",7),p("ngSubmit",function(){f(e);let m=g();return u(m.submit())}),o(1,"div",8)(2,"label",9),a(3,"Type "),o(4,"span",10),a(5,"*"),i()(),o(6,"select",11)(7,"option",12),a(8,"Select type"),i(),T(9,Z,2,2,"option",13,P().trackByType,!0),i()(),o(11,"div",8)(12,"label",14),a(13,"Name "),o(14,"span",10),a(15,"*"),i()(),V(16,"input",15),i(),C(17,ee,2,2,"div",16),o(18,"div",17)(19,"button",18),a(20),i(),o(21,"button",19),p("click",function(){f(e);let m=g();return u(m.cancel())}),a(22,"Cancel"),i()()()}if(r&2){let e,n=g();s("formGroup",n.form),l(6),s("formControl",n.typeControl),l(3),w(n.integrationTypes()),l(7),s("formControl",n.nameControl),l(),b((e=n.schema())?17:-1,e),l(2),s("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),l(),E(" ",n.isEditMode()?"Save changes":"Create"," ")}}var W=class r{route=c(F);router=c(N);destroyRef=c(k);integrationConfigController=c(R);integrationTypeController=c(z);namespaceId=this.route.snapshot.params.namespaceId;form=new G({name:new M("",{nonNullable:!0,validators:[_.required,_.minLength(1)]}),type:new M("",{nonNullable:!0,validators:[_.required]})});get nameControl(){return this.form.controls.name}get typeControl(){return this.form.controls.type}isEditMode=d(!1);isSubmitting=d(!1);isLoading=d(!1);paramsValue=d(null);initialParams=d(null);integrationTypes=x(this.integrationTypeController.listTypesIntegrationType(),{initialValue:[]});selectedType=x(this.form.controls.type.valueChanges,{initialValue:this.form.controls.type.value});schema=D(()=>{let t=this.selectedType();return t?this.integrationTypes().find(n=>n.type===t)?.configSchema??null:null});existingConfig=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("integrationId");t&&(this.isEditMode.set(!0),this.loadConfig(t))}loadConfig(t){this.isLoading.set(!0),this.integrationConfigController.getByIdIntegrationConfig(t).pipe(h(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.nameControl.setValue(e.name),this.typeControl.setValue(e.integrationType),this.initialParams.set(e.parameters),this.paramsValue.set(e.parameters),this.isLoading.set(!1)},error:()=>{this.isLoading.set(!1),this.navigateBack()}})}onParamsChange(t){this.paramsValue.set(t)}submit(){if(this.nameControl.invalid||this.typeControl.invalid||this.isSubmitting())return;this.isSubmitting.set(!0),(this.isEditMode()?this.integrationConfigController.updateIntegrationConfig(this.existingConfig.id??"",S(I({},this.existingConfig),{name:this.nameControl.value.trim(),integrationType:this.typeControl.value,parameters:this.paramsValue()})):this.integrationConfigController.createIntegrationConfig({name:this.nameControl.value.trim(),integrationType:this.typeControl.value,namespaceId:this.namespaceId,parameters:this.paramsValue()})).pipe(h(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(!1)})}cancel(){this.navigateBack()}navigateBack(){this.router.navigate(["/agentos",this.namespaceId,"integrations"])}trackByType(t,e){return e.type}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=O({type:r,selectors:[["agentos-integration-form"]],decls:10,vars:2,consts:[[1,"integration-form"],[1,"integration-form__header"],["type","button","title","Back to integrations",1,"integration-form__back",3,"click"],[1,"integration-form__back-icon"],[1,"integration-form__title"],[1,"integration-form__loading"],[1,"integration-form__form",3,"formGroup"],[1,"integration-form__form",3,"ngSubmit","formGroup"],[1,"integration-form__field"],["for","integration-type",1,"integration-form__label"],["aria-hidden","true"],["id","integration-type",1,"integration-form__select",3,"formControl"],["value","","disabled",""],[3,"value"],["for","integration-name",1,"integration-form__label"],["id","integration-name","type","text","placeholder","Integration name","autocomplete","off",1,"integration-form__input",3,"formControl"],[1,"integration-form__schema-form"],[1,"integration-form__actions"],["type","submit",1,"integration-form__btn","integration-form__btn--primary",3,"disabled"],["type","button",1,"integration-form__btn",3,"click"],[3,"valueChange","schema","value"]],template:function(e,n){e&1&&(o(0,"div",0)(1,"header",1)(2,"button",2),p("click",function(){return n.cancel()}),o(3,"span",3),a(4,"\u2190"),i(),a(5," Integrations "),i(),o(6,"h1",4),a(7),i()(),C(8,Y,2,0,"p",5)(9,te,23,6,"form",6),i()),e&2&&(l(7),v(n.isEditMode()?"Edit integration":"New integration"),l(),b(n.isLoading()?8:9))},dependencies:[H,J,K,U,B,q,L,j,A,$,Q],styles:[".integration-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.integration-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.integration-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}.integration-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.integration-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.integration-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.integration-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.integration-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.integration-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.integration-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text, #1d1d1f)}.integration-form__input[_ngcontent-%COMP%], .integration-form__select[_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}.integration-form__input[_ngcontent-%COMP%]:focus, .integration-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.integration-form__input[_ngcontent-%COMP%]::placeholder, .integration-form__select[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.integration-form__select[_ngcontent-%COMP%]{cursor:pointer}.integration-form__select[_ngcontent-%COMP%] option[disabled][_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73)}.integration-form__schema-form[_ngcontent-%COMP%]{padding:1rem;border-radius:10px;border:1px solid var(--color-border-light, rgba(0, 0, 0, .06));background:var(--glass-bg, rgba(255, 255, 255, .5));-webkit-backdrop-filter:var(--glass-backdrop-blur, blur(20px));backdrop-filter:var(--glass-backdrop-blur, blur(20px))}.integration-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.integration-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}.integration-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.integration-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.integration-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.integration-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"],changeDetection:0})};export{W as IntegrationFormComponent};