@whoz-oss/coday-client 3.45.0 → 3.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/{chunk-C771ae8O.js → chunk-15VArnx4.js} +1 -1
- package/browser/{chunk-oPy2UKtT.js → chunk-B4V-chXj.js} +1 -1
- package/browser/{chunk-B2hWQjkA.js → chunk-B6xuebi2.js} +1 -1
- package/browser/{chunk-DSweSugV.js → chunk-BBDiWB4a.js} +1 -1
- package/browser/{chunk-eCi_YK3F.js → chunk-BN8OsVFj.js} +1 -1
- package/browser/chunk-BZHiQPuj.js +1 -0
- package/browser/{chunk-B-YwRcNe.js → chunk-BaGQp6JH.js} +1 -1
- package/browser/{chunk-D6x_voN2.js → chunk-BiIeidH5.js} +1 -1
- package/browser/{chunk-D5lOgsIp.js → chunk-BsWqznQD.js} +1 -1
- package/browser/{chunk-CjaF-EpZ.js → chunk-BuHOxpR2.js} +1 -1
- package/browser/{chunk-C1eTo7wc.js → chunk-BvlgLqYk.js} +1 -1
- package/browser/{chunk-Df1CC9X_.js → chunk-BzRSz9tI.js} +1 -1
- package/browser/{chunk-D68yb1UB.js → chunk-BzY6Ep0G.js} +1 -1
- package/browser/{chunk-csTSAQM4.js → chunk-C2WYF357.js} +1 -1
- package/browser/{chunk-DUWAro43.js → chunk-C3GOVBk_.js} +1 -1
- package/browser/{chunk-DDOOlpHu.js → chunk-C7W7wKW6.js} +1 -1
- package/browser/{chunk-Cgqn35Ol.js → chunk-C7WLRdBz.js} +1 -1
- package/browser/{chunk-DH1h3tET.js → chunk-C8MnxJFR.js} +1 -1
- package/browser/{chunk-BbKrAefJ.js → chunk-C8mKTgpS.js} +1 -1
- package/browser/{chunk-C_sqsgx_.js → chunk-CECAtdfP.js} +1 -1
- package/browser/{chunk-B-buMLNN.js → chunk-CF21NAoC.js} +1 -1
- package/browser/{chunk-BTzNhxkP.js → chunk-CIPAE5QL.js} +1 -1
- package/browser/{chunk-Cd6k_bdl.js → chunk-CM7HBsNp.js} +1 -1
- package/browser/{chunk-C9quyDcE.js → chunk-CQGvcak9.js} +1 -1
- package/browser/{chunk-B91NjE_9.js → chunk-CS-Wd0TM.js} +1 -1
- package/browser/{chunk-DA0XN5ln.js → chunk-CV8oYiu6.js} +1 -1
- package/browser/{chunk-CqNvcgul.js → chunk-CXIzoa4X.js} +1 -1
- package/browser/{chunk-gnmBIG6v.js → chunk-CY_UT4yX.js} +1 -1
- package/browser/{chunk-SmpbZ59n.js → chunk-C_e-V63N.js} +1 -1
- package/browser/{chunk-E7zo1ZWp.js → chunk-Cdc0NZ-7.js} +1 -1
- package/browser/chunk-ChBNuv97.js +1 -0
- package/browser/{chunk-C2GCxjxM.js → chunk-ChSmvipB.js} +1 -1
- package/browser/{chunk-BptxMEz-.js → chunk-Ci4l8tk2.js} +1 -1
- package/browser/{chunk-cNdj6-bt.js → chunk-CnwHtkLr.js} +1 -1
- package/browser/{chunk-kHm1rz1e.js → chunk-CsE4KOo-.js} +1 -1
- package/browser/{chunk-RBP1JMFY.js → chunk-Csx_bIdU.js} +1 -1
- package/browser/{chunk-XFUqZGTc.js → chunk-CweDrs-V.js} +1 -1
- package/browser/{chunk-D7ARdKxn.js → chunk-Cx2_wyOQ.js} +1 -1
- package/browser/{chunk-BiEd7IrH.js → chunk-D-7OXCOn.js} +1 -1
- package/browser/{chunk-CGY7qZrY.js → chunk-D-MHUT7O.js} +1 -1
- package/browser/{chunk-DCzmUfV6.js → chunk-D-Ud3Vfw.js} +1 -1
- package/browser/{chunk-BhikFqJn.js → chunk-D5ZXVt3X.js} +1 -1
- package/browser/{chunk-CmzAQmSp.js → chunk-D76rRppu.js} +1 -1
- package/browser/{chunk-DcnPiwGW.js → chunk-D8Ig2aSp.js} +1 -1
- package/browser/{chunk-8yLfnLvb.js → chunk-DKGDfEzr.js} +1 -1
- package/browser/{chunk-_rOxkml3.js → chunk-DOalt2k2.js} +1 -1
- package/browser/{chunk-CWL6H-PZ.js → chunk-DPURBiWx.js} +1 -1
- package/browser/{chunk-DynfR-mJ.js → chunk-DPq6m0_3.js} +1 -1
- package/browser/{chunk-CSQJWZ40.js → chunk-DTJV7sZ-.js} +1 -1
- package/browser/{chunk-n7ePNuKE.js → chunk-DU7LcSKO.js} +1 -1
- package/browser/{chunk-Bt2pbMYw.js → chunk-DWR28XEB.js} +1 -1
- package/browser/{chunk-DSgNB8rU.js → chunk-DWcyQkaI.js} +1 -1
- package/browser/{chunk-KvfCqdNP.js → chunk-DYHDHQKA.js} +1 -1
- package/browser/{chunk-B9cuFMbC.js → chunk-DmY80nIA.js} +1 -1
- package/browser/{chunk-CqlCP4Lf.js → chunk-DmgkwSGz.js} +1 -1
- package/browser/{chunk-BLlQvCUP.js → chunk-DqA27WRL.js} +1 -1
- package/browser/{chunk-So4mdywy.js → chunk-DuBixCBe.js} +1 -1
- package/browser/{chunk-DlkojuN6.js → chunk-Dwn82CAA.js} +1 -1
- package/browser/{chunk-CC9l_FVn.js → chunk-DxXGn7DP.js} +1 -1
- package/browser/{chunk-EsK0QDKp.js → chunk-DyscmH62.js} +1 -1
- package/browser/{chunk-3MIYtbiX.js → chunk-I8N8a_Ey.js} +1 -1
- package/browser/{chunk-B1ALWfdl.js → chunk-LjBBWEUT.js} +1 -1
- package/browser/{chunk-BD2msI7-.js → chunk-MdZ58GWI.js} +1 -1
- package/browser/{chunk-B4Ve7P2S.js → chunk-Mruv8Diq.js} +1 -1
- package/browser/{chunk-DbbwCq1g.js → chunk-NHXAgcvP.js} +1 -1
- package/browser/{chunk-iHj4pdDT.js → chunk-ScYL38NG.js} +1 -1
- package/browser/chunk-fsGz0NBm.js +1 -0
- package/browser/{chunk-D4PwpNfT.js → chunk-iU0wcjHN.js} +1 -1
- package/browser/{chunk-DD7TeJMI.js → chunk-mC77zXT_.js} +1 -1
- package/browser/{chunk-BCCCuWqt.js → chunk-rB6dVrX3.js} +4 -4
- package/browser/{chunk-B18mCPSe.js → chunk-yJRb-vT3.js} +1 -1
- package/browser/index.html +1 -1
- package/browser/{main-ZRCBAFS7.js → main-B65DSCU3.js} +5 -5
- package/package.json +1 -1
- package/browser/chunk-9VCA2Yhm.js +0 -1
- package/browser/chunk-Bld_RLLz.js +0 -1
- package/browser/chunk-IxrjcLvL.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import {v}from'./chunk-D6x_voN2.js';import {R}from'./chunk-C9quyDcE.js';import {N}from'./chunk-9VCA2Yhm.js';import {g,ao as V,G,C as Ce,d8 as F,F as F$1,W as br,a as Gi,m as mT,cd as Hf,b as U,e as xw,k as ws,q as Rg,n as GC,o as pl,J as Jw,X as XE,a8 as Yg,y as eC,a9 as lC,t as rC,cH as Kw,a3 as VI,S as Sg,a4 as nC,ac as gC,v as bg,z as oC,a6 as UI,a5 as vl,aa as If,ab as wf}from'./main-ZRCBAFS7.js';import'./chunk-BCCCuWqt.js';import {n as nt}from'./chunk-CjaF-EpZ.js';import'./chunk-C771ae8O.js';import {o as z,k as _t,b as _e,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,a as wt,A as At,m as mn,Z as Zn,l as Xn,C as Cn,E as En}from'./chunk-E7zo1ZWp.js';import'./chunk-IxrjcLvL.js';import'./chunk-RBP1JMFY.js';function le(r,t){r&1&&(ws(0,"p",5),GC(1,"Loading\u2026"),pl());}function se(r,t){if(r&1&&(ws(0,"label",10),Sg(1,"input",29),VI(),ws(2,"span"),GC(3),pl()()),r&2){let e=t.$implicit,n=gC(2);XE(),bg("value",e.value)("formControl",n.scopeControl)("disabled",e.value==="namespace"&&!n.isAdmin()),UI(),XE(2),Yg(e.label);}}function ce(r,t){if(r&1&&(ws(0,"option",16),GC(1),pl()),r&2){let e=t.$implicit;bg("value",e.type),XE(),Yg(e.displayName);}}function me(r,t){if(r&1&&(ws(0,"option",16),GC(1),pl()),r&2){let e=t.$implicit;bg("value",e),XE(),Yg(e);}}function pe(r,t){if(r&1&&(ws(0,"div",11)(1,"label",30),Sg(2,"input",31),VI(),ws(3,"span",9),GC(4,"Grant automatically"),pl()(),ws(5,"p",32),GC(6),pl()()),r&2){let e=gC(2);XE(2),bg("formControl",e.autoGrantControl),UI(),XE(4),vl(" Give this integration to ",e.autoGrantReach(),", without each agent having to declare it. An agent can still opt out by mapping this configuration to an empty tool list. ");}}function de(r,t){if(r&1){let e=lC();ws(0,"div",24)(1,"ds-json-schema-form",33),Rg("valueChange",function(s){If(e);let m=gC(2);return wf(m.onParamsChange(s))}),pl()();}if(r&2){let e=gC(2);XE(),bg("schema",t)("value",e.initialParams());}}function ge(r,t){if(r&1){let e=lC();ws(0,"button",34),Rg("click",function(){If(e);let s=gC(2);return wf(s.exportYaml())}),GC(1),pl();}if(r&2){let e=gC(2);bg("disabled",e.isExporting()),XE(),vl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function ue(r,t){if(r&1){let e=lC();ws(0,"form",7),Rg("ngSubmit",function(){If(e);let s=gC();return wf(s.submit())}),ws(1,"fieldset",8)(2,"legend",9),GC(3,"Scope"),pl(),rC(4,se,4,4,"label",10,Kw().trackByScope,true),pl(),ws(6,"div",11)(7,"label",12),GC(8,"Type "),ws(9,"span",13),GC(10,"*"),pl()(),ws(11,"select",14)(12,"option",15),GC(13,"Select type"),pl(),rC(14,ce,2,2,"option",16,Kw().trackByType,true),pl(),VI(),pl(),ws(16,"div",11)(17,"label",17),GC(18,"Name "),ws(19,"span",13),GC(20,"*"),pl()(),Sg(21,"input",18),VI(),pl(),ws(22,"div",11)(23,"label",19),GC(24,"Description"),pl(),Sg(25,"textarea",20),VI(),pl(),ws(26,"div",11)(27,"label",21),GC(28,"Auth Setting"),pl(),ws(29,"select",22)(30,"option",23),GC(31,"None"),pl(),rC(32,me,2,2,"option",16,nC),pl(),VI(),pl(),Jw(34,pe,7,2,"div",11),Jw(35,de,2,2,"div",24),ws(36,"div",25)(37,"button",26),GC(38),pl(),Jw(39,ge,2,2,"button",27),ws(40,"button",28),Rg("click",function(){If(e);let s=gC();return wf(s.cancel())}),GC(41,"Cancel"),pl()()();}if(r&2){let e,n=gC();bg("formGroup",n.form),XE(),bg("disabled",n.isEditMode()),XE(3),oC(n.scopeOptions),XE(7),bg("formControl",n.typeControl),UI(),XE(3),oC(n.integrationTypes()),XE(7),bg("formControl",n.nameControl),UI(),XE(4),bg("formControl",n.descriptionControl),UI(),XE(4),bg("formControl",n.authSettingNameControl),UI(),XE(),bg("ngValue",null),XE(2),oC(n.availableAuthSettings()),XE(2),eC(n.isAutoGrantable()?34:-1),XE(),eC((e=n.schema())?35:-1,e),XE(2),bg("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),XE(),vl(" ",n.isEditMode()?"Save changes":"Create"," "),XE(),eC(n.isEditMode()?39:-1);}}var fe=new Set(["platform","namespace","userOnNs","userGlobal"]),T=Object.freeze({platform:"Configuration plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),re=class r{route=g(V);router=g(G);destroyRef=g(Ce);state=g(N);integrationTypeController=g(F);authSettingState=g(R);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isAdmin=F$1(this.isPlatformMode?br(true):this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:this.isPlatformMode});form=new z({name:new _t("",{nonNullable:true,validators:[_e.required,_e.minLength(1)]}),description:new _t(null),type:new _t("",{nonNullable:true,validators:[_e.required]}),scope:new _t("namespace",{nonNullable:true}),autoGrant:new _t(false,{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get typeControl(){return this.form.controls.type}get scopeControl(){return this.form.controls.scope}get autoGrantControl(){return this.form.controls.autoGrant}isEditMode=Gi(false);isSubmitting=Gi(false);isLoading=Gi(false);isExporting=Gi(false);scopeOptions=[{value:"platform",label:T.platform},{value:"namespace",label:T.namespace},{value:"userOnNs",label:T.userOnNs},{value:"userGlobal",label:T.userGlobal}];authSettingNameControl=new _t(null);availableAuthSettings=Gi([]);paramsValue=Gi(null);initialParams=Gi(null);integrationTypes=F$1(this.integrationTypeController.listTypesIntegrationType(),{initialValue:[]});selectedType=F$1(this.form.controls.type.valueChanges,{initialValue:this.form.controls.type.value});scopeValue=F$1(this.form.controls.scope.valueChanges,{initialValue:this.form.controls.scope.value});schema=mT(()=>{let t=this.selectedType();return t?this.integrationTypes().find(n=>n.type===t)?.configSchema??null:null});isAutoGrantable=mT(()=>{let t=this.selectedType();return t?this.integrationTypes().find(e=>e.type===t)?.autoGrantable??false:false});autoGrantReach=mT(()=>{switch(this.scopeValue()){case "platform":return "every agent of this environment";case "namespace":return "every agent of this namespace";default:return "your own runs"}});existingConfig=null;constructor(){Hf(()=>{if(this.isAdmin()||this.isEditMode())return;["platform","namespace"].includes(this.scopeControl.value)&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,n=t.get("integrationId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable(),this.loadAuthSettingsForScope("platform");return}let s=this.parseScope(e.get("scope"));this.scopeControl.setValue(s),this.loadAuthSettingsForScope(s),this.scopeControl.valueChanges.pipe(U(this.destroyRef)).subscribe(ae=>{this.loadAuthSettingsForScope(ae);});let m=e.get("template");m&&this.hydrateFromTemplate(m);}parseScope(t){return t&&fe.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId&&!t.namespaceId?"platform":t.userId?t.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e;let n=this.deriveScopeFromConfig(e);this.scopeControl.setValue(n),this.applyConfigToForm(e),this.loadAuthSettingsForScope(n),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[IntegrationForm] Could not load config '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.applyConfigToForm(e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[IntegrationForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.typeControl.setValue(t.integrationType),this.initialParams.set(t.parameters),this.paramsValue.set(t.parameters),this.authSettingNameControl.setValue(t.authSettingName??null),this.autoGrantControl.setValue(t.autoGrant??false);}loadAuthSettingsForScope(t){let e;switch(t){case "platform":e=this.authSettingState.loadPlatformSettings();break;case "namespace":e=this.authSettingState.loadNamespaceSettings(this.namespaceId);break;case "userOnNs":e=this.authSettingState.loadUserSettings(this.namespaceId);break;case "userGlobal":e=this.authSettingState.loadUserSettings("global");break}e.pipe(U(this.destroyRef)).subscribe({next:n=>{let s=n.map(m=>m.name).filter(Boolean);this.availableAuthSettings.set([...new Set(s)]);},error:()=>this.availableAuthSettings.set([])});}onParamsChange(t){this.paramsValue.set(t);}submit(){if(this.nameControl.invalid||this.typeControl.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.descriptionControl.value?.trim(),e={name:this.nameControl.value.trim(),description:t||null,integrationType:this.typeControl.value,parameters:this.paramsValue(),authSettingName:this.authSettingNameControl.value||null,autoGrant:this.isAutoGrantable()&&this.autoGrantControl.value},n=this.form.getRawValue().scope;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,e,n,this.existingConfig):this.state.create(e,n,this.namespaceId??null)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}exportYaml(){let t=this.existingConfig?.id;!t||this.isExporting()||(this.isExporting.set(true),this.state.exportAsYaml(t).pipe(U(this.destroyRef)).subscribe({next:e=>{let n=new Blob([e],{type:"application/yaml"}),s=URL.createObjectURL(n),m=document.createElement("a");m.href=s,m.download=`${this.existingConfig?.name??"integration"}.yaml`,m.click(),URL.revokeObjectURL(s),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","integration-configs"]):this.router.navigate(["/agentos",this.namespaceId,"integrations"]);}trackByType(t,e){return e.type}trackByScope(t,e){return e.value}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=xw({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","integration-form__scope",3,"disabled"],[1,"integration-form__label"],[1,"integration-form__scope-option"],[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"],["for","integration-auth-setting",1,"integration-form__label"],["id","integration-auth-setting",1,"integration-form__select",3,"formControl"],[3,"ngValue"],[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","integration-form__btn--export",3,"disabled"],["type","button",1,"integration-form__btn",3,"click"],["type","radio",3,"value","formControl","disabled"],[1,"integration-form__checkbox-row"],["type","checkbox",3,"formControl"],[1,"integration-form__hint"],[3,"valueChange","schema","value"],["type","button",1,"integration-form__btn","integration-form__btn--export",3,"click","disabled"]],template:function(e,n){e&1&&(ws(0,"div",0)(1,"header",1)(2,"button",2),Rg("click",function(){return n.cancel()}),ws(3,"span",3),GC(4,"\u2190"),pl(),GC(5," Integrations "),pl(),ws(6,"h1",4),GC(7),pl()(),Jw(8,le,2,0,"p",5)(9,ue,42,12,"form",6),pl()),e&2&&(XE(7),Yg(n.isEditMode()?"Edit integration":"New integration"),XE(),eC(n.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,wt,At,mn,Zn,Xn,Cn,En,nt],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-accent)}.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:700;color:var(--color-text);letter-spacing:-.02em}.integration-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.integration-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.integration-form__scope[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.4rem;border:1px solid var(--color-divider);border-radius:0;padding:.75rem 1rem;background:transparent;margin:0}.integration-form__scope[disabled][_ngcontent-%COMP%]{opacity:.6}.integration-form__scope-option[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;font-size:.875rem;color:var(--color-text);cursor:pointer}.integration-form__scope-option[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{margin:0}.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)}.integration-form__input[_ngcontent-%COMP%], .integration-form__textarea[_ngcontent-%COMP%], .integration-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.integration-form__input[_ngcontent-%COMP%]:focus, .integration-form__textarea[_ngcontent-%COMP%]:focus, .integration-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.integration-form__input[_ngcontent-%COMP%]::placeholder, .integration-form__textarea[_ngcontent-%COMP%]::placeholder, .integration-form__select[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.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)}.integration-form__checkbox-row[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;cursor:pointer}.integration-form__checkbox-row[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{margin:0}.integration-form__hint[_ngcontent-%COMP%]{margin:0;font-size:.8125rem;line-height:1.4;color:var(--color-text-secondary)}.integration-form__schema-form[_ngcontent-%COMP%]{padding:1rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface)}.integration-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.integration-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.integration-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.integration-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.integration-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.integration-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}.integration-form__btn--export[_ngcontent-%COMP%]{border-color:var(--color-divider);color:var(--color-text-secondary)}.integration-form__btn--export[_ngcontent-%COMP%]:hover:not(:disabled){border-color:var(--color-accent);color:var(--color-accent)}"]})};export{re as IntegrationFormComponent};
|
|
1
|
+
import {v}from'./chunk-BiIeidH5.js';import {R}from'./chunk-CQGvcak9.js';import {N}from'./chunk-BZHiQPuj.js';import {g,ao as V,G,C as Ce,d8 as F,F as F$1,W as br,a as Gi,m as mT,cd as Hf,b as U,e as xw,k as ws,q as Rg,n as GC,o as pl,J as Jw,X as XE,a8 as Yg,y as eC,a9 as lC,t as rC,cH as Kw,a3 as VI,S as Sg,a4 as nC,ac as gC,v as bg,z as oC,a6 as UI,a5 as vl,aa as If,ab as wf}from'./main-B65DSCU3.js';import'./chunk-rB6dVrX3.js';import {n as nt}from'./chunk-BuHOxpR2.js';import'./chunk-15VArnx4.js';import {o as z,k as _t,b as _e,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,a as wt,A as At,m as mn,Z as Zn,l as Xn,C as Cn,E as En}from'./chunk-Cdc0NZ-7.js';import'./chunk-ChBNuv97.js';import'./chunk-Csx_bIdU.js';function le(r,t){r&1&&(ws(0,"p",5),GC(1,"Loading\u2026"),pl());}function se(r,t){if(r&1&&(ws(0,"label",10),Sg(1,"input",29),VI(),ws(2,"span"),GC(3),pl()()),r&2){let e=t.$implicit,n=gC(2);XE(),bg("value",e.value)("formControl",n.scopeControl)("disabled",e.value==="namespace"&&!n.isAdmin()),UI(),XE(2),Yg(e.label);}}function ce(r,t){if(r&1&&(ws(0,"option",16),GC(1),pl()),r&2){let e=t.$implicit;bg("value",e.type),XE(),Yg(e.displayName);}}function me(r,t){if(r&1&&(ws(0,"option",16),GC(1),pl()),r&2){let e=t.$implicit;bg("value",e),XE(),Yg(e);}}function pe(r,t){if(r&1&&(ws(0,"div",11)(1,"label",30),Sg(2,"input",31),VI(),ws(3,"span",9),GC(4,"Grant automatically"),pl()(),ws(5,"p",32),GC(6),pl()()),r&2){let e=gC(2);XE(2),bg("formControl",e.autoGrantControl),UI(),XE(4),vl(" Give this integration to ",e.autoGrantReach(),", without each agent having to declare it. An agent can still opt out by mapping this configuration to an empty tool list. ");}}function de(r,t){if(r&1){let e=lC();ws(0,"div",24)(1,"ds-json-schema-form",33),Rg("valueChange",function(s){If(e);let m=gC(2);return wf(m.onParamsChange(s))}),pl()();}if(r&2){let e=gC(2);XE(),bg("schema",t)("value",e.initialParams());}}function ge(r,t){if(r&1){let e=lC();ws(0,"button",34),Rg("click",function(){If(e);let s=gC(2);return wf(s.exportYaml())}),GC(1),pl();}if(r&2){let e=gC(2);bg("disabled",e.isExporting()),XE(),vl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function ue(r,t){if(r&1){let e=lC();ws(0,"form",7),Rg("ngSubmit",function(){If(e);let s=gC();return wf(s.submit())}),ws(1,"fieldset",8)(2,"legend",9),GC(3,"Scope"),pl(),rC(4,se,4,4,"label",10,Kw().trackByScope,true),pl(),ws(6,"div",11)(7,"label",12),GC(8,"Type "),ws(9,"span",13),GC(10,"*"),pl()(),ws(11,"select",14)(12,"option",15),GC(13,"Select type"),pl(),rC(14,ce,2,2,"option",16,Kw().trackByType,true),pl(),VI(),pl(),ws(16,"div",11)(17,"label",17),GC(18,"Name "),ws(19,"span",13),GC(20,"*"),pl()(),Sg(21,"input",18),VI(),pl(),ws(22,"div",11)(23,"label",19),GC(24,"Description"),pl(),Sg(25,"textarea",20),VI(),pl(),ws(26,"div",11)(27,"label",21),GC(28,"Auth Setting"),pl(),ws(29,"select",22)(30,"option",23),GC(31,"None"),pl(),rC(32,me,2,2,"option",16,nC),pl(),VI(),pl(),Jw(34,pe,7,2,"div",11),Jw(35,de,2,2,"div",24),ws(36,"div",25)(37,"button",26),GC(38),pl(),Jw(39,ge,2,2,"button",27),ws(40,"button",28),Rg("click",function(){If(e);let s=gC();return wf(s.cancel())}),GC(41,"Cancel"),pl()()();}if(r&2){let e,n=gC();bg("formGroup",n.form),XE(),bg("disabled",n.isEditMode()),XE(3),oC(n.scopeOptions),XE(7),bg("formControl",n.typeControl),UI(),XE(3),oC(n.integrationTypes()),XE(7),bg("formControl",n.nameControl),UI(),XE(4),bg("formControl",n.descriptionControl),UI(),XE(4),bg("formControl",n.authSettingNameControl),UI(),XE(),bg("ngValue",null),XE(2),oC(n.availableAuthSettings()),XE(2),eC(n.isAutoGrantable()?34:-1),XE(),eC((e=n.schema())?35:-1,e),XE(2),bg("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),XE(),vl(" ",n.isEditMode()?"Save changes":"Create"," "),XE(),eC(n.isEditMode()?39:-1);}}var fe=new Set(["platform","namespace","userOnNs","userGlobal"]),T=Object.freeze({platform:"Configuration plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),re=class r{route=g(V);router=g(G);destroyRef=g(Ce);state=g(N);integrationTypeController=g(F);authSettingState=g(R);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isAdmin=F$1(this.isPlatformMode?br(true):this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:this.isPlatformMode});form=new z({name:new _t("",{nonNullable:true,validators:[_e.required,_e.minLength(1)]}),description:new _t(null),type:new _t("",{nonNullable:true,validators:[_e.required]}),scope:new _t("namespace",{nonNullable:true}),autoGrant:new _t(false,{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get typeControl(){return this.form.controls.type}get scopeControl(){return this.form.controls.scope}get autoGrantControl(){return this.form.controls.autoGrant}isEditMode=Gi(false);isSubmitting=Gi(false);isLoading=Gi(false);isExporting=Gi(false);scopeOptions=[{value:"platform",label:T.platform},{value:"namespace",label:T.namespace},{value:"userOnNs",label:T.userOnNs},{value:"userGlobal",label:T.userGlobal}];authSettingNameControl=new _t(null);availableAuthSettings=Gi([]);paramsValue=Gi(null);initialParams=Gi(null);integrationTypes=F$1(this.integrationTypeController.listTypesIntegrationType(),{initialValue:[]});selectedType=F$1(this.form.controls.type.valueChanges,{initialValue:this.form.controls.type.value});scopeValue=F$1(this.form.controls.scope.valueChanges,{initialValue:this.form.controls.scope.value});schema=mT(()=>{let t=this.selectedType();return t?this.integrationTypes().find(n=>n.type===t)?.configSchema??null:null});isAutoGrantable=mT(()=>{let t=this.selectedType();return t?this.integrationTypes().find(e=>e.type===t)?.autoGrantable??false:false});autoGrantReach=mT(()=>{switch(this.scopeValue()){case "platform":return "every agent of this environment";case "namespace":return "every agent of this namespace";default:return "your own runs"}});existingConfig=null;constructor(){Hf(()=>{if(this.isAdmin()||this.isEditMode())return;["platform","namespace"].includes(this.scopeControl.value)&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,n=t.get("integrationId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable(),this.loadAuthSettingsForScope("platform");return}let s=this.parseScope(e.get("scope"));this.scopeControl.setValue(s),this.loadAuthSettingsForScope(s),this.scopeControl.valueChanges.pipe(U(this.destroyRef)).subscribe(ae=>{this.loadAuthSettingsForScope(ae);});let m=e.get("template");m&&this.hydrateFromTemplate(m);}parseScope(t){return t&&fe.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId&&!t.namespaceId?"platform":t.userId?t.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e;let n=this.deriveScopeFromConfig(e);this.scopeControl.setValue(n),this.applyConfigToForm(e),this.loadAuthSettingsForScope(n),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[IntegrationForm] Could not load config '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.applyConfigToForm(e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[IntegrationForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.typeControl.setValue(t.integrationType),this.initialParams.set(t.parameters),this.paramsValue.set(t.parameters),this.authSettingNameControl.setValue(t.authSettingName??null),this.autoGrantControl.setValue(t.autoGrant??false);}loadAuthSettingsForScope(t){let e;switch(t){case "platform":e=this.authSettingState.loadPlatformSettings();break;case "namespace":e=this.authSettingState.loadNamespaceSettings(this.namespaceId);break;case "userOnNs":e=this.authSettingState.loadUserSettings(this.namespaceId);break;case "userGlobal":e=this.authSettingState.loadUserSettings("global");break}e.pipe(U(this.destroyRef)).subscribe({next:n=>{let s=n.map(m=>m.name).filter(Boolean);this.availableAuthSettings.set([...new Set(s)]);},error:()=>this.availableAuthSettings.set([])});}onParamsChange(t){this.paramsValue.set(t);}submit(){if(this.nameControl.invalid||this.typeControl.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.descriptionControl.value?.trim(),e={name:this.nameControl.value.trim(),description:t||null,integrationType:this.typeControl.value,parameters:this.paramsValue(),authSettingName:this.authSettingNameControl.value||null,autoGrant:this.isAutoGrantable()&&this.autoGrantControl.value},n=this.form.getRawValue().scope;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,e,n,this.existingConfig):this.state.create(e,n,this.namespaceId??null)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}exportYaml(){let t=this.existingConfig?.id;!t||this.isExporting()||(this.isExporting.set(true),this.state.exportAsYaml(t).pipe(U(this.destroyRef)).subscribe({next:e=>{let n=new Blob([e],{type:"application/yaml"}),s=URL.createObjectURL(n),m=document.createElement("a");m.href=s,m.download=`${this.existingConfig?.name??"integration"}.yaml`,m.click(),URL.revokeObjectURL(s),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","integration-configs"]):this.router.navigate(["/agentos",this.namespaceId,"integrations"]);}trackByType(t,e){return e.type}trackByScope(t,e){return e.value}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=xw({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","integration-form__scope",3,"disabled"],[1,"integration-form__label"],[1,"integration-form__scope-option"],[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"],["for","integration-auth-setting",1,"integration-form__label"],["id","integration-auth-setting",1,"integration-form__select",3,"formControl"],[3,"ngValue"],[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","integration-form__btn--export",3,"disabled"],["type","button",1,"integration-form__btn",3,"click"],["type","radio",3,"value","formControl","disabled"],[1,"integration-form__checkbox-row"],["type","checkbox",3,"formControl"],[1,"integration-form__hint"],[3,"valueChange","schema","value"],["type","button",1,"integration-form__btn","integration-form__btn--export",3,"click","disabled"]],template:function(e,n){e&1&&(ws(0,"div",0)(1,"header",1)(2,"button",2),Rg("click",function(){return n.cancel()}),ws(3,"span",3),GC(4,"\u2190"),pl(),GC(5," Integrations "),pl(),ws(6,"h1",4),GC(7),pl()(),Jw(8,le,2,0,"p",5)(9,ue,42,12,"form",6),pl()),e&2&&(XE(7),Yg(n.isEditMode()?"Edit integration":"New integration"),XE(),eC(n.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,wt,At,mn,Zn,Xn,Cn,En,nt],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-accent)}.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:700;color:var(--color-text);letter-spacing:-.02em}.integration-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.integration-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.integration-form__scope[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.4rem;border:1px solid var(--color-divider);border-radius:0;padding:.75rem 1rem;background:transparent;margin:0}.integration-form__scope[disabled][_ngcontent-%COMP%]{opacity:.6}.integration-form__scope-option[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;font-size:.875rem;color:var(--color-text);cursor:pointer}.integration-form__scope-option[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{margin:0}.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)}.integration-form__input[_ngcontent-%COMP%], .integration-form__textarea[_ngcontent-%COMP%], .integration-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.integration-form__input[_ngcontent-%COMP%]:focus, .integration-form__textarea[_ngcontent-%COMP%]:focus, .integration-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.integration-form__input[_ngcontent-%COMP%]::placeholder, .integration-form__textarea[_ngcontent-%COMP%]::placeholder, .integration-form__select[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.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)}.integration-form__checkbox-row[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;cursor:pointer}.integration-form__checkbox-row[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{margin:0}.integration-form__hint[_ngcontent-%COMP%]{margin:0;font-size:.8125rem;line-height:1.4;color:var(--color-text-secondary)}.integration-form__schema-form[_ngcontent-%COMP%]{padding:1rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface)}.integration-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.integration-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.integration-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.integration-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.integration-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.integration-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}.integration-form__btn--export[_ngcontent-%COMP%]{border-color:var(--color-divider);color:var(--color-text-secondary)}.integration-form__btn--export[_ngcontent-%COMP%]:hover:not(:disabled){border-color:var(--color-accent);color:var(--color-accent)}"]})};export{re as IntegrationFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {K as Kn,Z as Zn,S as Se}from'./chunk-
|
|
1
|
+
import {K as Kn,Z as Zn,S as Se}from'./chunk-BuHOxpR2.js';import {cb as ZB,cc as qB,a as Gi,e as xw,k as ws,n as GC,o as pl,J as Jw,X as XE,a8 as Yg,a5 as vl,y as eC,a9 as lC,q as Rg,ac as gC,v as bg,aa as If,ab as wf}from'./main-B65DSCU3.js';function A(o,a){if(o&1){let e=lC();ws(0,"span",7),GC(1,"Delete?"),pl(),ws(2,"ds-icon-button",8),Rg("action",function(){If(e);let l=gC();return wf(l.onDeleteConfirmed())}),pl(),ws(3,"ds-icon-button",9),Rg("action",function(){If(e);let l=gC();return wf(l.onDeleteCancelled())}),pl();}}function P(o,a){if(o&1){let e=lC();ws(0,"ds-kebab-menu",10),Rg("itemSelected",function(l){If(e);let O=gC();return wf(O.onMenuAction(l))}),pl();}if(o&2){let e=gC();bg("items",e.menuItems);}}var I=class o{model=ZB.required();namespaceId=ZB(void 0);readOnly=ZB(false);deleteRequested=qB();editRequested=qB();pendingDelete=Gi(false);menuItems=[{key:"edit",label:"Edit model",icon:"edit"},{key:"delete",label:"Delete model",icon:"delete",variant:"danger"}];get displayTitle(){return this.model().alias??this.model().apiModelName}onMenuAction(a){switch(a){case "edit":this.editRequested.emit(this.model());break;case "delete":this.pendingDelete.set(true);break}}onDeleteConfirmed(){this.pendingDelete.set(false),this.deleteRequested.emit(this.model());}onDeleteCancelled(){this.pendingDelete.set(false);}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=xw({type:o,selectors:[["agentos-ai-model-item"]],inputs:{model:[1,"model"],namespaceId:[1,"namespaceId"],readOnly:[1,"readOnly"]},outputs:{deleteRequested:"deleteRequested",editRequested:"editRequested"},decls:12,vars:4,consts:[["role","listitem","dsBlueprint","",1,"ai-model-item"],[1,"ai-model-item__body"],[1,"ai-model-item__name"],[1,"ai-model-item__api-name"],[1,"ai-model-item__params"],[1,"ai-model-item__actions"],[3,"items"],[1,"ai-model-item__confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel deletion",3,"action"],[3,"itemSelected","items"]],template:function(e,i){e&1&&(ws(0,"div",0)(1,"div",1)(2,"span",2),GC(3),pl(),ws(4,"span",3),GC(5),pl(),ws(6,"span",4)(7,"span"),GC(8),pl()()(),ws(9,"div",5),Jw(10,A,4,0)(11,P,1,1,"ds-kebab-menu",6),pl()()),e&2&&(XE(3),Yg(i.displayTitle),XE(2),Yg(i.model().apiModelName),XE(3),vl("priority: ",i.model().priority),XE(2),eC(i.pendingDelete()?10:i.readOnly()?-1:11));},dependencies:[Kn,Zn,Se],styles:[".ai-model-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:14px 16px;position:relative;border-radius:0;border:1px solid var(--color-divider);background:var(--color-bg);box-shadow:var(--shadow-sm);overflow:visible;transition:border-color .15s ease}.ai-model-item[_ngcontent-%COMP%]:hover{border-color:var(--color-accent)}.ai-model-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.ai-model-item__name[_ngcontent-%COMP%]{font-size:15px;font-weight:600;color:var(--color-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ai-model-item__api-name[_ngcontent-%COMP%]{font-size:13px;color:var(--color-text-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ai-model-item__params[_ngcontent-%COMP%]{display:flex;gap:.75rem;font-size:13px;color:var(--color-text-secondary)}.ai-model-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.ai-model-item[_ngcontent-%COMP%]:hover .ai-model-item__actions[_ngcontent-%COMP%], .ai-model-item[_ngcontent-%COMP%]:focus-within .ai-model-item__actions[_ngcontent-%COMP%]{opacity:1}.ai-model-item__confirm-label[_ngcontent-%COMP%]{font-family:var(--font-heading);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--red-deep);margin-right:.25rem;white-space:nowrap}"]})};export{I};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {s as se}from'./chunk-
|
|
1
|
+
import {s as se}from'./chunk-yJRb-vT3.js';import {a as Dr,q as qi,F as Fn,b as $i,h as ht,c as br$1,y as yr}from'./chunk-BuHOxpR2.js';import {g,H as py,P,Y as x,aL as wo,aM as Zn,bD as ge,bE as vt,aO as wt,bs as Tl,az as Xt,aW as C,aS as K,bF as J,al as vt$1,aT as Ut,bG as p,bH as Pt,e as xw,a_ as QT,bA as yC,bI as Ig,b5 as nT,D as Pg,bJ as dr,E as EC,I as IC,bv as Fg,bK as fe,bL as pe,bM as mr,aP as G,bt as Qn,bN as F,aR as Fs,an as ue,O as Ot,bO as mt,bP as Wy,ae as kt$1,W as br,r as re,bQ as Gy,bR as Id,bS as va,aF as R$1,bu as Ve$1,bT as pn,bU as Od,bV as Zy,aA as an,bW as Y,bX as Pt$1,bY as po,bZ as X,b_ as xt,aZ as js,aC as Tu,q as Rg,T as Tg,aw as hl,bB as vC,ax as gl,ac as gC,b$ as kC,A as Ug,c0 as xg,c1 as E,c2 as ME,c3 as kt$2,bC as Si}from'./main-B65DSCU3.js';import {D}from'./chunk-Cdc0NZ-7.js';var xe=class a{http=g(py);projectState=g(P);getBaseUrl(){return `/api/projects/${this.projectState.getSelectedProjectIdOrThrow()}/schedulers`}listSchedulers(){return this.http.get(this.getBaseUrl())}getScheduler(o){return this.http.get(`${this.getBaseUrl()}/${o}`)}createScheduler(o){return this.http.post(this.getBaseUrl(),o)}listSchedulersForProject(o){return this.http.get(`/api/projects/${o}/schedulers`)}enableSchedulerForProject(o,e){return this.http.post(`/api/projects/${o}/schedulers/${e}/enable`,{})}disableSchedulerForProject(o,e){return this.http.post(`/api/projects/${o}/schedulers/${e}/disable`,{})}runSchedulerNowForProject(o,e){return this.http.post(`/api/projects/${o}/schedulers/${e}/run-now`,{})}deleteSchedulerForProject(o,e){return this.http.delete(`/api/projects/${o}/schedulers/${e}`)}updateSchedulerForProject(o,e,t){return this.http.put(`/api/projects/${o}/schedulers/${e}`,t)}createSchedulerForProject(o,e){return this.http.post(`/api/projects/${o}/schedulers`,e)}updateScheduler(o,e){return this.http.put(`${this.getBaseUrl()}/${o}`,e)}deleteScheduler(o){return this.http.delete(`${this.getBaseUrl()}/${o}`)}enableScheduler(o){return this.http.post(`${this.getBaseUrl()}/${o}/enable`,{})}disableScheduler(o){return this.http.post(`${this.getBaseUrl()}/${o}/disable`,{})}runSchedulerNow(o){return this.http.post(`${this.getBaseUrl()}/${o}/run-now`,{})}static \u0275fac=function(e){return new(e||a)};static \u0275prov=x({token:a,factory:a.\u0275fac,providedIn:"root"})};var Ke=["panel"],Ue=["*"];function qe(a,o){if(a&1&&(hl(0,"div",1,0),vC(2),gl()),a&2){let e=o.id,t=gC();kC(t._classList),Ug("mat-mdc-autocomplete-visible",t.showPanel)("mat-mdc-autocomplete-hidden",!t.showPanel)("mat-autocomplete-panel-animations-enabled",!t._animationsDisabled)("mat-primary",t._color==="primary")("mat-accent",t._color==="accent")("mat-warn",t._color==="warn"),xg("id",t.id),Tg("aria-label",t.ariaLabel||null)("aria-labelledby",t._getPanelAriaLabelledby(e));}}var R=class{source;option;constructor(o,e){this.source=o,this.option=e;}},Ve=new C("mat-autocomplete-default-options",{providedIn:"root",factory:()=>({autoActiveFirstOption:false,autoSelectActiveOption:false,hideSingleSelectionIndicator:false,requireSelection:false,hasBackdrop:false})}),Ct=(()=>{class a{_changeDetectorRef=g(Tl);_elementRef=g(Xt);_defaults=g(Ve);_animationsDisabled=K();_activeOptionChanges=J.EMPTY;_keyManager;showPanel=false;get isOpen(){return this._isOpen&&this.showPanel}_isOpen=false;_latestOpeningTrigger;_setColor(e){this._color=e,this._changeDetectorRef.markForCheck();}_color;template;panel;options;optionGroups;ariaLabel;ariaLabelledby;displayWith=null;autoActiveFirstOption;autoSelectActiveOption;requireSelection;panelWidth;disableRipple=false;optionSelected=new vt$1;opened=new vt$1;closed=new vt$1;optionActivated=new vt$1;set classList(e){this._classList=e,this._elementRef.nativeElement.className="";}_classList;get hideSingleSelectionIndicator(){return this._hideSingleSelectionIndicator}set hideSingleSelectionIndicator(e){this._hideSingleSelectionIndicator=e,this._syncParentProperties();}_hideSingleSelectionIndicator;_syncParentProperties(){if(this.options)for(let e of this.options)e._changeDetectorRef.markForCheck();}id=g(Ut).getId("mat-autocomplete-");inertGroups;constructor(){let e=g(p);this.inertGroups=e?.SAFARI||false,this.autoActiveFirstOption=!!this._defaults.autoActiveFirstOption,this.autoSelectActiveOption=!!this._defaults.autoSelectActiveOption,this.requireSelection=!!this._defaults.requireSelection,this._hideSingleSelectionIndicator=this._defaults.hideSingleSelectionIndicator??false;}ngAfterContentInit(){this._keyManager=new Pt(this.options).withWrap().skipPredicate(this._skipPredicate),this._activeOptionChanges=this._keyManager.change.subscribe(e=>{this.isOpen&&this.optionActivated.emit({source:this,option:this.options.toArray()[e]||null});}),this._setVisibility();}ngOnDestroy(){this._keyManager?.destroy(),this._activeOptionChanges.unsubscribe();}_setScrollTop(e){this.panel&&(this.panel.nativeElement.scrollTop=e);}_getScrollTop(){return this.panel?this.panel.nativeElement.scrollTop:0}_setVisibility(){this.showPanel=!!this.options?.length,this._changeDetectorRef.markForCheck();}_emitSelectEvent(e){let t=new R(this,e);this.optionSelected.emit(t);}_getPanelAriaLabelledby(e){if(this.ariaLabel)return null;let t=e?e+" ":"";return this.ariaLabelledby?t+this.ariaLabelledby:e}_skipPredicate(){return false}static \u0275fac=function(t){return new(t||a)};static \u0275cmp=xw({type:a,selectors:[["mat-autocomplete"]],contentQueries:function(t,i,n){if(t&1&&Fg(n,Fn,5)(n,$i,5),t&2){let s;EC(s=IC())&&(i.options=s),EC(s=IC())&&(i.optionGroups=s);}},viewQuery:function(t,i){if(t&1&&Pg(dr,7)(Ke,5),t&2){let n;EC(n=IC())&&(i.template=n.first),EC(n=IC())&&(i.panel=n.first);}},hostAttrs:[1,"mat-mdc-autocomplete"],inputs:{ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],displayWith:"displayWith",autoActiveFirstOption:[2,"autoActiveFirstOption","autoActiveFirstOption",QT],autoSelectActiveOption:[2,"autoSelectActiveOption","autoSelectActiveOption",QT],requireSelection:[2,"requireSelection","requireSelection",QT],panelWidth:"panelWidth",disableRipple:[2,"disableRipple","disableRipple",QT],classList:[0,"class","classList"],hideSingleSelectionIndicator:[2,"hideSingleSelectionIndicator","hideSingleSelectionIndicator",QT]},outputs:{optionSelected:"optionSelected",opened:"opened",closed:"closed",optionActivated:"optionActivated"},exportAs:["matAutocomplete"],features:[nT([{provide:qi,useExisting:a}])],ngContentSelectors:Ue,decls:1,vars:0,consts:[["panel",""],["role","listbox",1,"mat-mdc-autocomplete-panel","mdc-menu-surface","mdc-menu-surface--open",3,"id"]],template:function(t,i){t&1&&(yC(),Ig(0,qe,3,17,"ng-template"));},styles:[`div.mat-mdc-autocomplete-panel {
|
|
2
2
|
width: 100%;
|
|
3
3
|
max-height: 256px;
|
|
4
4
|
visibility: hidden;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,bl as Mt,Y as x}from'./main-
|
|
1
|
+
import {g,bl as Mt,Y as x}from'./main-B65DSCU3.js';var s=class n{snackBar=g(Mt);success(t,o=2e3){this.snackBar.open(t,"",{duration:o,horizontalPosition:"center",verticalPosition:"bottom",panelClass:["snackbar-success"]});}error(t,o=3e3){this.snackBar.open(t,"",{duration:o,horizontalPosition:"center",verticalPosition:"bottom",panelClass:["snackbar-error"]});}info(t,o=2e3){this.snackBar.open(t,"",{duration:o,horizontalPosition:"center",verticalPosition:"bottom",panelClass:["snackbar-info"]});}static \u0275fac=function(o){return new(o||n)};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};export{s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,G,cb as ZB,cc as qB,a as Gi,dc as we,dl as Ie,e as xw,k as ws,n as GC,o as pl,J as Jw,X as XE,a8 as Yg,A as Ug,a5 as vl,y as eC,ac as gC,a9 as lC,q as Rg,v as bg,aa as If,ab as wf}from'./main-
|
|
1
|
+
import {g,G,cb as ZB,cc as qB,a as Gi,dc as we,dl as Ie,e as xw,k as ws,n as GC,o as pl,J as Jw,X as XE,a8 as Yg,A as Ug,a5 as vl,y as eC,ac as gC,a9 as lC,q as Rg,v as bg,aa as If,ab as wf}from'./main-B65DSCU3.js';import {Z as Zn,S as Se}from'./chunk-BuHOxpR2.js';function L(n,t){if(n&1&&(ws(0,"span",5),GC(1),pl()),n&2){let e=gC();XE(),Yg(e.definition().description);}}function q(n,t){if(n&1&&(ws(0,"span",7),GC(1),pl()),n&2){let e=gC();XE(),vl("Next: ",e.nextRunLabel);}}function U(n,t){if(n&1&&(ws(0,"span",8),GC(1),pl()),n&2){let e=gC();XE(),vl("Last run: ",e.lastRunLabel);}}function $(n,t){if(n&1){let e=lC();ws(0,"span",12),GC(1,"Delete?"),pl(),ws(2,"ds-icon-button",13),Rg("action",function(){If(e);let a=gC(2);return wf(a.onDeleteConfirmed())}),pl(),ws(3,"ds-icon-button",14),Rg("action",function(){If(e);let a=gC(2);return wf(a.onDeleteCancelled())}),pl();}}function N(n,t){if(n&1){let e=lC();ws(0,"ds-kebab-menu",15),Rg("itemSelected",function(a){If(e);let p=gC(2);return wf(p.onMenuAction(a))}),pl();}if(n&2){let e=gC(2);bg("items",e.menuItems);}}function V(n,t){if(n&1&&(ws(0,"div",10),Jw(1,$,4,0)(2,N,1,1,"ds-kebab-menu",11),pl()),n&2){let e=gC();Ug("scheduled-prompt-item__actions--confirming",e.pendingDelete()),XE(),eC(e.pendingDelete()?1:2);}}var R=class n{router=g(G);definition=ZB.required();namespaceId=ZB(void 0);platformMode=ZB(false);readOnly=ZB(false);enableRequested=qB();disableRequested=qB();deleteRequested=qB();pendingDelete=Gi(false);get scheduleLabel(){let{recurrence:t}=this.definition(),e=t.unit,i=t.timeUtc,a=e===we.WEEK?"week":"month",p=e===we.WEEK&&t.days?.length?` (${t.days.map(_=>Ie[_]??_).join(", ")})`:"";return `Every ${a}${p} at ${i} UTC`}formatInstant(t){if(!t)return null;let e=new Date(t),i=e.getUTCDate(),a=e.toLocaleString("en-GB",{month:"short",timeZone:"UTC"}),p=e.getUTCFullYear(),_=String(e.getUTCHours()).padStart(2,"0"),T=String(e.getUTCMinutes()).padStart(2,"0");return `${i} ${a} ${p} at ${_}:${T} UTC`}get nextRunLabel(){return this.formatInstant(this.definition().nextRunAt)}get lastRunLabel(){return this.formatInstant(this.definition().lastRunAt)}get menuItems(){let t=this.definition();return [{key:"edit",label:"Edit scheduled prompt",icon:"edit"},{key:"toggle",label:t.enabled?"Disable":"Enable",icon:t.enabled?"toggle_on":"toggle_off"},{key:"delete",label:"Delete scheduled prompt",icon:"delete",variant:"danger"}]}onMenuAction(t){let e=this.definition();switch(t){case "edit":this.platformMode()?this.router.navigate(["/agentos","admin","scheduled-prompts",e.id,"edit"]):this.router.navigate(["/agentos",this.namespaceId(),"scheduled-prompts",e.id,"edit"]);break;case "toggle":e.enabled?this.disableRequested.emit(e):this.enableRequested.emit(e);break;case "delete":this.pendingDelete.set(true);break}}onDeleteConfirmed(){this.pendingDelete.set(false),this.deleteRequested.emit(this.definition());}onDeleteCancelled(){this.pendingDelete.set(false);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=xw({type:n,selectors:[["agentos-scheduled-prompt-item"]],inputs:{definition:[1,"definition"],namespaceId:[1,"namespaceId"],platformMode:[1,"platformMode"],readOnly:[1,"readOnly"]},outputs:{enableRequested:"enableRequested",disableRequested:"disableRequested",deleteRequested:"deleteRequested"},decls:13,vars:11,consts:[["role","listitem",1,"scheduled-prompt-item"],[1,"scheduled-prompt-item__body"],[1,"scheduled-prompt-item__header"],[1,"scheduled-prompt-item__name"],[1,"scheduled-prompt-item__status"],[1,"scheduled-prompt-item__description"],[1,"scheduled-prompt-item__schedule"],[1,"scheduled-prompt-item__next-run"],[1,"scheduled-prompt-item__last-run"],[1,"scheduled-prompt-item__actions",3,"scheduled-prompt-item__actions--confirming"],[1,"scheduled-prompt-item__actions"],[3,"items"],[1,"scheduled-prompt-item__confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel deletion",3,"action"],[3,"itemSelected","items"]],template:function(e,i){e&1&&(ws(0,"div",0)(1,"div",1)(2,"div",2)(3,"span",3),GC(4),pl(),ws(5,"span",4),GC(6),pl()(),Jw(7,L,2,1,"span",5),ws(8,"span",6),GC(9),pl(),Jw(10,q,2,1,"span",7),Jw(11,U,2,1,"span",8),pl(),Jw(12,V,3,3,"div",9),pl()),e&2&&(XE(4),Yg(i.definition().name),XE(),Ug("scheduled-prompt-item__status--enabled",i.definition().enabled)("scheduled-prompt-item__status--disabled",!i.definition().enabled),XE(),vl(" ",i.definition().enabled?"Enabled":"Disabled"," "),XE(),eC(i.definition().description?7:-1),XE(2),Yg(i.scheduleLabel),XE(),eC(i.nextRunLabel?10:-1),XE(),eC(i.lastRunLabel?11:-1),XE(),eC(i.readOnly()?-1:12));},dependencies:[Zn,Se],styles:[".scheduled-prompt-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem 1rem;border-radius:10px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--glass-bg, rgba(255, 255, 255, .72));-webkit-backdrop-filter:var(--glass-backdrop-blur, blur(20px));backdrop-filter:var(--glass-backdrop-blur, blur(20px));transition:background .15s ease,border-color .15s ease}.scheduled-prompt-item[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .04));border-color:var(--color-primary, #007aff)}.scheduled-prompt-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.scheduled-prompt-item__header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;min-width:0}.scheduled-prompt-item__name[_ngcontent-%COMP%]{font-size:.95rem;font-weight:500;color:var(--color-text, #1d1d1f);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;min-width:0}.scheduled-prompt-item__status[_ngcontent-%COMP%]{font-size:.7rem;font-weight:600;padding:.15rem .5rem;border-radius:999px;white-space:nowrap;flex-shrink:0;text-transform:uppercase;letter-spacing:.04em}.scheduled-prompt-item__status--enabled[_ngcontent-%COMP%]{background:var(--color-success-bg, rgba(52, 199, 89, .12));color:var(--color-success, #34c759)}.scheduled-prompt-item__status--disabled[_ngcontent-%COMP%]{background:var(--color-warning-bg, rgba(255, 159, 10, .12));color:var(--color-warning, #ff9f0a)}.scheduled-prompt-item__description[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, #6e6e73);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.scheduled-prompt-item__schedule[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, #6e6e73);font-family:monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.scheduled-prompt-item__next-run[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text, #1d1d1f);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.scheduled-prompt-item__last-run[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary, #6e6e73);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.scheduled-prompt-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.scheduled-prompt-item[_ngcontent-%COMP%]:hover .scheduled-prompt-item__actions[_ngcontent-%COMP%], .scheduled-prompt-item[_ngcontent-%COMP%]:focus-within .scheduled-prompt-item__actions[_ngcontent-%COMP%]{opacity:1}.scheduled-prompt-item__actions--confirming[_ngcontent-%COMP%]{opacity:1}.scheduled-prompt-item__confirm-label[_ngcontent-%COMP%]{font-size:.8rem;font-weight:500;color:var(--color-error, #ff3b30);margin-right:.25rem;white-space:nowrap}"]})};export{R};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {b as Qe}from'./chunk-
|
|
1
|
+
import {b as Qe}from'./chunk-15VArnx4.js';import {D as D$1,i as y}from'./chunk-Cdc0NZ-7.js';import {aL as wo,aM as Zn,aO as wt,g as g$1,az as Xt,bs as Tl,aP as G,aS as K,aW as C,al as vt,aX as D,bx as on,by as um,aT as Ut,a as Gi,e as xw,bz as Oi,aC as Tu,a_ as QT,bA as yC,k as ws,q as Rg,o as pl,S as Sg,c9 as kf,ck as Ff,bB as vC,u as CC,v as bg,X as XE,A as Ug,T as Tg,b5 as nT,bC as Si,c8 as KT,c0 as xg,b$ as kC,D as Pg,E as EC,I as IC}from'./main-B65DSCU3.js';var W=["input"],Y=["label"],ee=["*"],f={color:"accent",clickAction:"check-indeterminate",disabledInteractive:false},ce=new C("mat-checkbox-default-options",{providedIn:"root",factory:()=>f}),a=(function(t){return t[t.Init=0]="Init",t[t.Checked=1]="Checked",t[t.Unchecked=2]="Unchecked",t[t.Indeterminate=3]="Indeterminate",t})(a||{}),g=class{source;checked},ne=(()=>{class t{_elementRef=g$1(Xt);_changeDetectorRef=g$1(Tl);_ngZone=g$1(G);_animationsDisabled=K();_options=g$1(ce,{optional:true});focus(){this._inputElement.nativeElement.focus();}_createChangeEvent(e){let n=new g;return n.source=this,n.checked=e,n}_getAnimationTargetElement(){return this._inputElement?.nativeElement}_animationClasses={uncheckedToChecked:"mdc-checkbox--anim-unchecked-checked",uncheckedToIndeterminate:"mdc-checkbox--anim-unchecked-indeterminate",checkedToUnchecked:"mdc-checkbox--anim-checked-unchecked",checkedToIndeterminate:"mdc-checkbox--anim-checked-indeterminate",indeterminateToChecked:"mdc-checkbox--anim-indeterminate-checked",indeterminateToUnchecked:"mdc-checkbox--anim-indeterminate-unchecked"};ariaLabel="";ariaLabelledby=null;ariaDescribedby;ariaExpanded;ariaControls;ariaOwns;_uniqueId;id;get inputId(){return `${this.id||this._uniqueId}-input`}required=false;labelPosition="after";name=null;change=new vt;indeterminateChange=new vt;value;disableRipple=false;_inputElement;_labelElement;tabIndex;color;disabledInteractive;_onTouched=()=>{};_currentAnimationClass="";_currentCheckState=a.Init;_controlValueAccessorChangeFn=()=>{};_validatorChangeFn=()=>{};constructor(){g$1(D).load(on);let e=g$1(new um("tabindex"),{optional:true});this._options=this._options||f,this.color=this._options.color||f.color,this.tabIndex=e==null?0:parseInt(e)||0,this.id=this._uniqueId=g$1(Ut).getId("mat-mdc-checkbox-"),this.disabledInteractive=this._options?.disabledInteractive??false;}ngOnChanges(e){e.required&&this._validatorChangeFn();}ngAfterViewInit(){this._syncIndeterminate(this.indeterminate);}get checked(){return this._checked}set checked(e){e!=this.checked&&(this._checked=e,this._changeDetectorRef.markForCheck());}_checked=false;get disabled(){return this._disabled}set disabled(e){e!==this.disabled&&(this._disabled=e,this._changeDetectorRef.markForCheck());}_disabled=false;get indeterminate(){return this._indeterminate()}set indeterminate(e){let n=e!=this._indeterminate();this._indeterminate.set(e),n&&(e?this._transitionCheckState(a.Indeterminate):this._transitionCheckState(this.checked?a.Checked:a.Unchecked),this.indeterminateChange.emit(e)),this._syncIndeterminate(e);}_indeterminate=Gi(false);_isRippleDisabled(){return this.disableRipple||this.disabled}_onLabelTextChange(){this._changeDetectorRef.detectChanges();}writeValue(e){this.checked=!!e;}registerOnChange(e){this._controlValueAccessorChangeFn=e;}registerOnTouched(e){this._onTouched=e;}setDisabledState(e){this.disabled=e;}validate(e){return this.required&&e.value!==true?{required:true}:null}registerOnValidatorChange(e){this._validatorChangeFn=e;}_transitionCheckState(e){let n=this._currentCheckState,c=this._getAnimationTargetElement();if(!(n===e||!c)&&(this._currentAnimationClass&&c.classList.remove(this._currentAnimationClass),this._currentAnimationClass=this._getAnimationClassForCheckStateTransition(n,e),this._currentCheckState=e,this._currentAnimationClass.length>0)){c.classList.add(this._currentAnimationClass);let o=this._currentAnimationClass;this._ngZone.runOutsideAngular(()=>{setTimeout(()=>{c.classList.remove(o);},1e3);});}}_emitChangeEvent(){this._controlValueAccessorChangeFn(this.checked),this.change.emit(this._createChangeEvent(this.checked)),this._inputElement&&(this._inputElement.nativeElement.checked=this.checked);}toggle(){this.checked=!this.checked,this._controlValueAccessorChangeFn(this.checked);}_handleInputClick(){let e=this._options?.clickAction;!this.disabled&&e!=="noop"?(this.indeterminate&&e!=="check"&&Promise.resolve().then(()=>{this._indeterminate.set(false),this.indeterminateChange.emit(false);}),this._checked=!this._checked,this._transitionCheckState(this._checked?a.Checked:a.Unchecked),this._emitChangeEvent()):(this.disabled&&this.disabledInteractive||!this.disabled&&e==="noop")&&(this._inputElement.nativeElement.checked=this.checked,this._inputElement.nativeElement.indeterminate=this.indeterminate);}_onInteractionEvent(e){e.stopPropagation();}_onBlur(){Promise.resolve().then(()=>{this._onTouched(),this._changeDetectorRef.markForCheck();});}_getAnimationClassForCheckStateTransition(e,n){if(this._animationsDisabled)return "";switch(e){case a.Init:if(n===a.Checked)return this._animationClasses.uncheckedToChecked;if(n==a.Indeterminate)return this._checked?this._animationClasses.checkedToIndeterminate:this._animationClasses.uncheckedToIndeterminate;break;case a.Unchecked:return n===a.Checked?this._animationClasses.uncheckedToChecked:this._animationClasses.uncheckedToIndeterminate;case a.Checked:return n===a.Unchecked?this._animationClasses.checkedToUnchecked:this._animationClasses.checkedToIndeterminate;case a.Indeterminate:return n===a.Checked?this._animationClasses.indeterminateToChecked:this._animationClasses.indeterminateToUnchecked}return ""}_syncIndeterminate(e){let n=this._inputElement;n&&(n.nativeElement.indeterminate=e);}_onInputClick(){this._handleInputClick();}_onTouchTargetClick(){this._handleInputClick(),this.disabled||this._inputElement.nativeElement.focus();}_preventBubblingFromLabel(e){e.target&&this._labelElement.nativeElement.contains(e.target)&&e.stopPropagation();}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=xw({type:t,selectors:[["mat-checkbox"]],viewQuery:function(n,c){if(n&1&&Pg(W,5)(Y,5),n&2){let o;EC(o=IC())&&(c._inputElement=o.first),EC(o=IC())&&(c._labelElement=o.first);}},hostAttrs:[1,"mat-mdc-checkbox"],hostVars:16,hostBindings:function(n,c){n&2&&(xg("id",c.id),Tg("tabindex",null)("aria-label",null)("aria-labelledby",null),kC(c.color?"mat-"+c.color:"mat-accent"),Ug("_mat-animation-noopable",c._animationsDisabled)("mdc-checkbox--disabled",c.disabled)("mat-mdc-checkbox-disabled",c.disabled)("mat-mdc-checkbox-checked",c.checked)("mat-mdc-checkbox-disabled-interactive",c.disabledInteractive));},inputs:{ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],ariaDescribedby:[0,"aria-describedby","ariaDescribedby"],ariaExpanded:[2,"aria-expanded","ariaExpanded",QT],ariaControls:[0,"aria-controls","ariaControls"],ariaOwns:[0,"aria-owns","ariaOwns"],id:"id",required:[2,"required","required",QT],labelPosition:"labelPosition",name:"name",value:"value",disableRipple:[2,"disableRipple","disableRipple",QT],tabIndex:[2,"tabIndex","tabIndex",e=>e==null?void 0:KT(e)],color:"color",disabledInteractive:[2,"disabledInteractive","disabledInteractive",QT],checked:[2,"checked","checked",QT],disabled:[2,"disabled","disabled",QT],indeterminate:[2,"indeterminate","indeterminate",QT]},outputs:{change:"change",indeterminateChange:"indeterminateChange"},exportAs:["matCheckbox"],features:[nT([{provide:D$1,useExisting:Si(()=>t),multi:true},{provide:y,useExisting:t,multi:true}]),Tu],ngContentSelectors:ee,decls:15,vars:23,consts:[["checkbox",""],["input",""],["label",""],["mat-internal-form-field","",3,"click","labelPosition"],[1,"mdc-checkbox"],["aria-hidden","true",1,"mat-mdc-checkbox-touch-target",3,"click"],["type","checkbox",1,"mdc-checkbox__native-control",3,"blur","click","change","checked","indeterminate","disabled","id","required","tabIndex"],["aria-hidden","true",1,"mdc-checkbox__ripple"],["aria-hidden","true",1,"mdc-checkbox__background"],["focusable","false","viewBox","0 0 24 24",1,"mdc-checkbox__checkmark"],["fill","none","d","M1.73,12.91 8.1,19.28 22.79,4.59",1,"mdc-checkbox__checkmark-path"],[1,"mdc-checkbox__mixedmark"],["mat-ripple","","aria-hidden","true",1,"mat-mdc-checkbox-ripple","mat-focus-indicator",3,"matRippleTrigger","matRippleDisabled","matRippleCentered"],[1,"mdc-label",3,"for"]],template:function(n,c){if(n&1&&(yC(),ws(0,"div",3),Rg("click",function(k){return c._preventBubblingFromLabel(k)}),ws(1,"div",4,0)(3,"div",5),Rg("click",function(){return c._onTouchTargetClick()}),pl(),ws(4,"input",6,1),Rg("blur",function(){return c._onBlur()})("click",function(){return c._onInputClick()})("change",function(k){return c._onInteractionEvent(k)}),pl(),Sg(6,"div",7),ws(7,"div",8),kf(),ws(8,"svg",9),Sg(9,"path",10),pl(),Ff(),Sg(10,"div",11),pl(),Sg(11,"div",12),pl(),ws(12,"label",13,2),vC(14),pl()()),n&2){let o=CC(2);bg("labelPosition",c.labelPosition),XE(4),Ug("mdc-checkbox--selected",c.checked),bg("checked",c.checked)("indeterminate",c.indeterminate)("disabled",c.disabled&&!c.disabledInteractive)("id",c.inputId)("required",c.required)("tabIndex",c.disabled&&!c.disabledInteractive?-1:c.tabIndex),Tg("aria-label",c.ariaLabel||null)("aria-labelledby",c.ariaLabelledby)("aria-describedby",c.ariaDescribedby)("aria-checked",c.indeterminate?"mixed":null)("aria-controls",c.ariaControls)("aria-disabled",c.disabled&&c.disabledInteractive?true:null)("aria-expanded",c.ariaExpanded)("aria-owns",c.ariaOwns)("name",c.name)("value",c.value),XE(7),bg("matRippleTrigger",o)("matRippleDisabled",c.disableRipple||c.disabled)("matRippleCentered",true),XE(),bg("for",c.inputId);}},dependencies:[Oi,Qe],styles:[`.mdc-checkbox {
|
|
2
2
|
display: inline-block;
|
|
3
3
|
position: relative;
|
|
4
4
|
flex: 0 0 18px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {f}from'./chunk-BhikFqJn.js';import {G as Ge,z as z$1,Q as Qe,E as Et,y as yt$2}from'./chunk-KvfCqdNP.js';import {U as Ue$1,x as x$2,i as is}from'./chunk-RBP1JMFY.js';import {al as vt$1,an as ue,g,ay as O,F,L,az as Xt,U,N,p as pe$1,G,ap as wd,ae as kt,aA as an,av as B,e as xw,h as hr$1,aB as fr$1,aC as Tu,k as ws,q as Rg,J as Jw,o as pl,X as XE,v as bg,y as eC,D as Pg,E as EC,I as IC,P as P$1,aD as Ly,Y as x,a9 as lC,ai as tm,aa as If,aj as KC,ab as wf,a3 as VI,A as Ug,ak as em,a6 as UI,B as dE,a as Gi$1,aE as W,H as py,W as br$1,aF as R,r as re,a7 as ya,aG as fe,m as mT,x as x$1,w as w$1,aH as z,b as U$1,aI as bS,t as rC,z as oC,aJ as Tr$1,aK as xb,am as qm,j as Gn$1,n as GC,aL as wo$1,aM as Zn$2,aN as Nn,aO as wt$2,aP as G$1,aQ as $a,aR as Fs,aS as K,aT as Ut,aU as Ue,aV as U$2,aW as C,aX as D$1,aY as ft$1,aZ as js,a_ as QT,ac as gC,a$ as XC,b0 as Qg,a5 as vl,S as Sg,ah as rT,b1 as On,b2 as kb,b3 as Sb,b4 as oT,b5 as nT,aw as hl,b6 as _g,ax as gl,l as le,b7 as u,b8 as B$1,b9 as T,ba as v,bb as m,bc as R$1,bd as h,be as A,a8 as Yg,bf as aT,bg as uT,T as Tg,bh as Vy,i as pr$1,bi as lT,bj as aE,bk as yh}from'./main-ZRCBAFS7.js';import {s}from'./chunk-csTSAQM4.js';import {d}from'./chunk-EsK0QDKp.js';import {S as Se$1,P as Pn}from'./chunk-CjaF-EpZ.js';import {u as ui$1,m as mt$1,p as pt$1,Z as Z$1,V as Ve}from'./chunk-C771ae8O.js';import {y as yt$1,w as wt$1,t as ti$1,Y as Ye,Z as Zn$1,c as cn}from'./chunk-E7zo1ZWp.js';var ot=class i{sanitizer=g(bS);transform(e,t){if(!t||!e)return e;let n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`(${n})`,"gi"),r=e.replace(o,"<strong>$1</strong>");return this.sanitizer.bypassSecurityTrustHtml(r)}static \u0275fac=function(t){return new(t||i)};static \u0275pipe=On({name:"highlight",type:i,pure:true})};var be=class i{http=g(py);projectState=g(P$1);threadState=g(U);transcribeAudio(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow();return this.http.post(`/api/projects/${o}/transcribe`,w$1({audio:e,mimeType:t},n?{language:n}:{}))}sendVoiceMessage(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow(),r=this.threadState.getSelectedThreadIdOrThrow();return this.http.post(`/api/projects/${o}/threads/${r}/voice-message`,w$1({audio:e,mimeType:t},n?{language:n}:{}))}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};var yi=["messageInput"],wi=["fileInput"],Ti=(i,e)=>e.name;function Si(i,e){i&1&&(ws(0,"div",3),Sg(1,"span",8),GC(2," Recording... Click mic to stop "),pl());}function Mi(i,e){i&1&&(ws(0,"div",3),Sg(1,"span",9),GC(2," Transcribing... "),pl());}function Ei(i,e){if(i&1&&(ws(0,"span",14),GC(1),pl()),i&2){let t=gC().$implicit,n=gC(2);XE(),Yg(" "+(n.getParameterFormat(t)||""));}}function Oi(i,e){if(i&1){let t=lC();ws(0,"div",11),Rg("click",function(){let o=If(t).$index,r=gC(2);return wf(r.selectAutocompleteItemByClick(o))})("keydown.enter",function(){let o=If(t).$index,r=gC(2);return wf(r.selectAutocompleteItemByClick(o))})("keydown.space",function(){let o=If(t).$index,r=gC(2);return wf(r.selectAutocompleteItemByClick(o))})("mouseenter",function(){let o=If(t).$index,r=gC(2);return wf(r.selectedAutocompleteIndex=o)}),ws(1,"div",12),Sg(2,"span",13),aT(3,"highlight"),Jw(4,Ei,2,1,"span",14),pl(),Sg(5,"div",15),aT(6,"highlight"),pl();}if(i&2){let t=e.$implicit,n=e.$index,o=gC(2);Ug("selected",n===o.selectedAutocompleteIndex),Tg("aria-selected",n===o.selectedAutocompleteIndex),XE(2),bg("innerHTML",lT(3,6,o.autocompleteTrigger+t.name,o.getAutocompleteQuery()),aE),XE(2),eC(o.hasParameterFormat(t)?4:-1),XE(),bg("innerHTML",lT(6,9,t.description,o.getAutocompleteQuery()),aE);}}function Pi(i,e){if(i&1&&(ws(0,"div",4),rC(1,Oi,7,12,"div",10,Ti),pl()),i&2){let t=gC();XE(),oC(t.autocompleteItems);}}function ki(i,e){if(i&1){let t=lC();ws(0,"ds-icon-button",18),Rg("action",function(){If(t);let o=gC(2);return wf(o.onStopClick())}),pl();}}function Ii(i,e){if(i&1){let t=lC();ws(0,"ds-icon-button",19),Rg("action",function(){If(t);let o=gC(2);return wf(o.sendMessage())}),pl();}if(i&2){let t=gC(2);Ug("hidden",t.isDisabled||!t.message.trim())("active",!!t.message.trim()&&!t.isDisabled),bg("title",t.getSendButtonTooltip())("disabled",t.isDisabled||!t.message.trim());}}function Di(i,e){if(i&1){let t=lC();ws(0,"ds-icon-button",21),Rg("action",function(){If(t);let o=gC(3);return wf(o.triggerFileUpload())}),pl(),ws(1,"input",22,1),Rg("change",function(o){If(t);let r=gC(3);return wf(r.onFileInputChange(o))}),pl();}if(i&2){let t=gC(3);bg("disabled",t.isDisabled);}}function Ai(i,e){if(i&1){let t=lC();Jw(0,Di,3,1),ws(1,"ds-icon-button",20),Rg("action",function(){If(t);let o=gC(2);return wf(o.toggleRecording())}),pl();}if(i&2){let t=gC(2);eC(!t.showWelcome&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?0:-1),XE(),Ug("hidden",t.message.trim()&&!t.isRecording&&!t.isTranscribing),bg("variant",t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing)?"danger":"default")("disabled",t.isVoiceMessageMode&&t.isTranscribing)("title",t.isRecording?"Click to stop recording":t.isTranscribing?"Uploading...":"Click to start recording");}}function Fi(i,e){if(i&1&&(ws(0,"div",7),Jw(1,ki,1,0,"ds-icon-button",16),Jw(2,Ii,1,6,"ds-icon-button",17),Jw(3,Ai,2,6),pl()),i&2){let t=gC();XE(),eC(t.isThinking?1:-1),XE(),eC((!t.isThinking||t.message.trim())&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?2:-1),XE(),eC(t.isThinking?-1:3);}}var rt=class i{isDisabled=false;showWelcome=false;isThinking=false;isStarting=false;isSessionInitializing=false;isStopping=false;filesPasted=new vt$1;messageSubmitted=new vt$1;voiceMessageReady=new vt$1;voiceRecordingToggled=new vt$1;heightChanged=new vt$1;stopRequested=new vt$1;textareaFocused=new vt$1;messageInput;fileInput;message="";isRecording=false;isTranscribing=false;isFocused=false;recognition=null;mediaRecorder=null;audioChunks=[];voiceInputMode="browser";get isVoiceMessageMode(){return this.voiceInputMode==="voice-message"}sessionHadTranscript=false;pendingLineBreaksTimeout=null;lastProcessedResultIndex=0;useEnterToSend=false;currentInvite="";subscriptions=[];thinkingPhrases=["Processing request...","Thinking...","Working on it..."];currentThinkingPhrase="Processing request...";thinkingPhraseIndex=0;thinkingInterval=null;autocompleteVisible=false;autocompleteTrigger=null;autocompleteItems=[];selectedAutocompleteIndex=0;preferencesService=g(L);codayService=g(Ge);agentApiService=g(f);promptApiService=g(d);projectStateService=g(P$1);audioApiService=g(be);threadStateService=g(U);ngOnInit(){this.initializeVoiceInput(),this.useEnterToSend=this.preferencesService.getEnterToSend(),this.subscriptions.push(this.preferencesService.voiceLanguage$.subscribe(()=>this.updateRecognitionLanguage())),this.subscriptions.push(this.preferencesService.voiceInputMode$.subscribe(e=>{this.voiceInputMode=e;})),this.subscriptions.push(this.preferencesService.enterToSend$.subscribe(e=>{this.useEnterToSend=e;})),this.subscribeToInviteEvents(),this.subscribeToMessageRestore();}ngAfterViewInit(){this.adjustTextareaHeight(),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),200);});}ngOnChanges(e){e.isThinking&&(e.isThinking.currentValue?this.startThinkingAnimation():(this.stopThinkingAnimation(),this.isStopping=false,e.isThinking.previousValue&&(console.log("[CHAT-TEXTAREA] Thinking ended, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100);})))),e.isSessionInitializing&&!e.isSessionInitializing.currentValue&&e.isSessionInitializing.previousValue&&(console.log("[CHAT-TEXTAREA] Session initialization completed, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100);})),e.isStarting&&!e.isStarting.currentValue&&e.isStarting.previousValue&&this.isThinking&&(this.thinkingPhraseIndex===0?(console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index 0 - restarting animation"),this.stopThinkingAnimation(),this.startThinkingAnimation()):console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index",this.thinkingPhraseIndex,"- continuing without restart"));}ngOnDestroy(){this.subscriptions.forEach(e=>e.unsubscribe()),this.subscriptions=[],this.clearPendingLineBreaks(),this.stopThinkingAnimation();}onKeyDown(e){if(this.autocompleteVisible)switch(e.key){case "ArrowDown":e.preventDefault(),this.selectedAutocompleteIndex=Math.min(this.selectedAutocompleteIndex+1,this.autocompleteItems.length-1),this.scrollSelectedItemIntoView();return;case "ArrowUp":e.preventDefault(),this.selectedAutocompleteIndex=Math.max(this.selectedAutocompleteIndex-1,0),this.scrollSelectedItemIntoView();return;case "Tab":case "Enter":if(!this.message.includes(" ")){e.preventDefault(),this.selectAutocompleteItem();return}break;case "Escape":e.preventDefault(),this.hideAutocomplete();return}e.key==="Enter"&&(this.useEnterToSend?!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(e.preventDefault(),this.sendMessage(true)):(navigator.platform.toLowerCase().includes("mac")?e.metaKey:e.ctrlKey)&&!e.shiftKey&&(e.preventDefault(),this.sendMessage(true)));}onInput(){this.adjustTextareaHeight(),this.checkForAutocomplete();}onPaste(e){let t=e.clipboardData?.items;if(!t)return;let n=Array.from(t).filter(r=>r.kind==="file");if(!n.length)return;e.preventDefault();let o=n.reduce((r,d)=>{let v=d.getAsFile();return v?[...r,v]:r},[]);o.length&&this.filesPasted.emit(o);}triggerFileUpload(){console.log("[CHAT-TEXTAREA] Triggering file upload"),this.fileInput?.nativeElement?.click();}onFileInputChange(e){let t=e.target,n=t.files;if(!n||n.length===0){console.log("[CHAT-TEXTAREA] No files selected");return}console.log("[CHAT-TEXTAREA] Files selected:",n.length);let o=Array.from(n);this.filesPasted.emit(o),t.value="";}onDocumentClick(e){if(!this.autocompleteVisible)return;let t=e.target,n=document.querySelector(".autocomplete-popup"),o=this.messageInput?.nativeElement;n&&!n.contains(t)&&o&&!o.contains(t)&&this.hideAutocomplete();}sendMessage(e=false){let t=this.message.trim();!this.isDisabled&&(e||t)&&(this.isRecording&&this.recognition&&(this.clearPendingLineBreaks(),this.recognition.stop()),this.messageSubmitted.emit(t),this.message="",setTimeout(()=>this.adjustTextareaHeight(),0));}onStopClick(){this.isStopping=true,this.stopRequested.emit();}toggleRecording(){this.isRecording?this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.stopWhisperRecording():this.stopRecording():this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.startWhisperRecording():this.startRecording();}startWhisperRecording(){return B(this,null,function*(){if(!this.isRecording)try{let e=yield navigator.mediaDevices.getUserMedia({audio:!0});this.audioChunks=[],this.mediaRecorder=new MediaRecorder(e),this.mediaRecorder.ondataavailable=t=>{t.data.size>0&&this.audioChunks.push(t.data);},this.mediaRecorder.onstop=()=>{e.getTracks().forEach(t=>t.stop()),this.processWhisperAudio();},this.mediaRecorder.onerror=t=>{console.error("[WHISPER] MediaRecorder error:",t),e.getTracks().forEach(n=>n.stop()),this.isRecording=!1,this.voiceRecordingToggled.emit(!1);},this.mediaRecorder.start(),this.isRecording=!0,this.voiceRecordingToggled.emit(!0),console.log("[WHISPER] Started recording");}catch(e){console.error("[WHISPER] Failed to start recording:",e),this.isRecording=false,this.voiceRecordingToggled.emit(false);}})}stopWhisperRecording(){if(!(!this.mediaRecorder||!this.isRecording))try{this.mediaRecorder.stop(),this.isRecording=!1,this.voiceRecordingToggled.emit(!1),console.log("[WHISPER] Stopped recording");}catch(e){console.error("[WHISPER] Failed to stop recording:",e),this.isRecording=false,this.voiceRecordingToggled.emit(false);}}processWhisperAudio(){if(this.audioChunks.length===0)return;let e=new Blob(this.audioChunks,{type:this.mediaRecorder?.mimeType||"audio/webm"}),t=e.type.split(";")[0]||"audio/webm";this.audioChunks=[],this.isTranscribing=true;let n=new FileReader;n.onloadend=()=>{let o=n.result.split(",")[1];if(!o){console.error("[WHISPER] Failed to read audio as base64"),this.isTranscribing=false;return}let d=this.preferencesService.getVoiceLanguage().split("-")[0];if(this.voiceInputMode==="voice-message"){if(!this.threadStateService.getSelectedThreadId()){console.log("[WHISPER] No thread selected \u2014 emitting voiceMessageReady for thread creation"),this.isTranscribing=false,this.voiceMessageReady.emit({base64:o,mimeType:t,language:d});return}this.audioApiService.sendVoiceMessage(o,t,d).subscribe({next:v=>{this.isTranscribing=false,console.log("[WHISPER] Voice message sent, transcription:",v.transcription?.substring(0,50));},error:v=>{console.error("[WHISPER] Voice message error:",v),this.isTranscribing=false,this.fallbackToTranscription(o,t,d);}});}else this.audioApiService.transcribeAudio(o,t,d).subscribe({next:v=>{this.isTranscribing=false,v.text&&this.appendToTextarea(v.text+" ");},error:v=>{console.error("[WHISPER] Transcription error:",v),this.isTranscribing=false;}});},n.readAsDataURL(e);}fallbackToTranscription(e,t,n){this.audioApiService.transcribeAudio(e,t,n).subscribe({next:o=>{this.isTranscribing=false,o.text&&this.appendToTextarea(o.text+" ");},error:o=>{console.error("[WHISPER] Fallback transcription also failed:",o),this.isTranscribing=false;}});}initializeVoiceInput(){let e=window.SpeechRecognition??window.webkitSpeechRecognition;if(console.log("[SPEECH] speechRecognition",e),!e){console.warn("[SPEECH] Speech Recognition API not available");return}this.recognition=new e,this.recognition.continuous=true,this.recognition.interimResults=true,this.recognition.maxAlternatives=1,this.recognition.lang=this.getSelectedLanguage();try{"grammars"in this.recognition&&(this.recognition.serviceURI=void 0);}catch(t){console.log("[SPEECH] Advanced speech recognition parameters not supported");}this.recognition.onresult=t=>{let n="",o=Math.max(t.resultIndex,this.lastProcessedResultIndex);for(let r=o;r<t.results.length;r++)t.results[r].isFinal&&(n+=t.results[r][0].transcript,this.lastProcessedResultIndex=r+1);if(n){let r=this.improveTranscriptPunctuation(n.trim());this.sessionHadTranscript=true,console.log("[SPEECH] onresult ending, appending to textarea",this.isRecording),this.appendToTextarea(r);}},this.recognition.onend=()=>{console.log("[SPEECH] Recognition ended. Was recording:",this.isRecording),this.isRecording=false,this.lastProcessedResultIndex=0,this.voiceRecordingToggled.emit(this.isRecording);},this.recognition.onerror=t=>{console.error("[SPEECH] Speech recognition error:",t.error),console.log("[SPEECH] Error details:",{error:t.error,message:t.message,timeStamp:t.timeStamp}),this.isRecording=false,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording);},this.recognition.onstart=()=>{console.log("[SPEECH] Recognition started successfully");},this.recognition.onspeechstart=()=>{console.log("[SPEECH] Speech detected");},this.recognition.onspeechend=()=>{console.log("[SPEECH] Speech ended");};}startRecording(){return B(this,null,function*(){if(!(!this.recognition||this.isRecording))try{this.isRecording=!0,this.sessionHadTranscript=!1,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording),this.recognition.start(),console.log("[SPEECH] Started recording");}catch(e){console.error("[SPEECH] Failed to start recording:",e),this.isRecording=false,this.voiceRecordingToggled.emit(this.isRecording);}})}stopRecording(){if(!this.recognition||!this.isRecording){console.log("[SPEECH] stopRecording not recording");return}try{console.log("[SPEECH] stopRecording recognition stop"),this.recognition.stop(),this.schedulePendingLineBreaks();}catch(e){console.error("[SPEECH] Failed to stop recording:",e);}}getSelectedLanguage(){return this.preferencesService.getVoiceLanguage()}updateRecognitionLanguage(){if(this.recognition){let e=this.getSelectedLanguage();this.recognition.lang=e,console.log("[SPEECH] Language changed to:",e);}}improveTranscriptPunctuation(e){let t=e;return /[.!?]$/.test(t.trim())||(t=t.trim()+"."),t=t.charAt(0).toUpperCase()+t.slice(1),t=t.replace(/\s+/g," "),t=t+" ",t}appendToTextarea(e){let t=this.message;if(this.message=t?`${t}${e}`:e,this.messageInput?.nativeElement){this.messageInput.nativeElement.focus();let n=this.message.length;this.messageInput.nativeElement.setSelectionRange(n,n);}setTimeout(()=>this.adjustTextareaHeight(),0);}schedulePendingLineBreaks(){this.clearPendingLineBreaks(),this.pendingLineBreaksTimeout=window.setTimeout(()=>{this.sessionHadTranscript&&(console.log("[SPEECH] Adding line breaks after transcript session"),this.appendToTextarea(`
|
|
1
|
+
import {f}from'./chunk-D5ZXVt3X.js';import {G as Ge,z as z$1,Q as Qe,E as Et,y as yt$2}from'./chunk-DYHDHQKA.js';import {U as Ue$1,x as x$2,i as is}from'./chunk-Csx_bIdU.js';import {al as vt$1,an as ue,g,ay as O,F,L,az as Xt,U,N,p as pe$1,G,ap as wd,ae as kt,aA as an,av as B,e as xw,h as hr$1,aB as fr$1,aC as Tu,k as ws,q as Rg,J as Jw,o as pl,X as XE,v as bg,y as eC,D as Pg,E as EC,I as IC,P as P$1,aD as Ly,Y as x,a9 as lC,ai as tm,aa as If,aj as KC,ab as wf,a3 as VI,A as Ug,ak as em,a6 as UI,B as dE,a as Gi$1,aE as W,H as py,W as br$1,aF as R,r as re,a7 as ya,aG as fe,m as mT,x as x$1,w as w$1,aH as z,b as U$1,aI as bS,t as rC,z as oC,aJ as Tr$1,aK as xb,am as qm,j as Gn$1,n as GC,aL as wo$1,aM as Zn$2,aN as Nn,aO as wt$2,aP as G$1,aQ as $a,aR as Fs,aS as K,aT as Ut,aU as Ue,aV as U$2,aW as C,aX as D$1,aY as ft$1,aZ as js,a_ as QT,ac as gC,a$ as XC,b0 as Qg,a5 as vl,S as Sg,ah as rT,b1 as On,b2 as kb,b3 as Sb,b4 as oT,b5 as nT,aw as hl,b6 as _g,ax as gl,l as le,b7 as u,b8 as B$1,b9 as T,ba as v,bb as m,bc as R$1,bd as h,be as A,a8 as Yg,bf as aT,bg as uT,T as Tg,bh as Vy,i as pr$1,bi as lT,bj as aE,bk as yh}from'./main-B65DSCU3.js';import {s}from'./chunk-C2WYF357.js';import {d}from'./chunk-DyscmH62.js';import {S as Se$1,P as Pn}from'./chunk-BuHOxpR2.js';import {u as ui$1,m as mt$1,p as pt$1,Z as Z$1,V as Ve}from'./chunk-15VArnx4.js';import {y as yt$1,w as wt$1,t as ti$1,Y as Ye,Z as Zn$1,c as cn}from'./chunk-Cdc0NZ-7.js';var ot=class i{sanitizer=g(bS);transform(e,t){if(!t||!e)return e;let n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`(${n})`,"gi"),r=e.replace(o,"<strong>$1</strong>");return this.sanitizer.bypassSecurityTrustHtml(r)}static \u0275fac=function(t){return new(t||i)};static \u0275pipe=On({name:"highlight",type:i,pure:true})};var be=class i{http=g(py);projectState=g(P$1);threadState=g(U);transcribeAudio(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow();return this.http.post(`/api/projects/${o}/transcribe`,w$1({audio:e,mimeType:t},n?{language:n}:{}))}sendVoiceMessage(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow(),r=this.threadState.getSelectedThreadIdOrThrow();return this.http.post(`/api/projects/${o}/threads/${r}/voice-message`,w$1({audio:e,mimeType:t},n?{language:n}:{}))}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};var yi=["messageInput"],wi=["fileInput"],Ti=(i,e)=>e.name;function Si(i,e){i&1&&(ws(0,"div",3),Sg(1,"span",8),GC(2," Recording... Click mic to stop "),pl());}function Mi(i,e){i&1&&(ws(0,"div",3),Sg(1,"span",9),GC(2," Transcribing... "),pl());}function Ei(i,e){if(i&1&&(ws(0,"span",14),GC(1),pl()),i&2){let t=gC().$implicit,n=gC(2);XE(),Yg(" "+(n.getParameterFormat(t)||""));}}function Oi(i,e){if(i&1){let t=lC();ws(0,"div",11),Rg("click",function(){let o=If(t).$index,r=gC(2);return wf(r.selectAutocompleteItemByClick(o))})("keydown.enter",function(){let o=If(t).$index,r=gC(2);return wf(r.selectAutocompleteItemByClick(o))})("keydown.space",function(){let o=If(t).$index,r=gC(2);return wf(r.selectAutocompleteItemByClick(o))})("mouseenter",function(){let o=If(t).$index,r=gC(2);return wf(r.selectedAutocompleteIndex=o)}),ws(1,"div",12),Sg(2,"span",13),aT(3,"highlight"),Jw(4,Ei,2,1,"span",14),pl(),Sg(5,"div",15),aT(6,"highlight"),pl();}if(i&2){let t=e.$implicit,n=e.$index,o=gC(2);Ug("selected",n===o.selectedAutocompleteIndex),Tg("aria-selected",n===o.selectedAutocompleteIndex),XE(2),bg("innerHTML",lT(3,6,o.autocompleteTrigger+t.name,o.getAutocompleteQuery()),aE),XE(2),eC(o.hasParameterFormat(t)?4:-1),XE(),bg("innerHTML",lT(6,9,t.description,o.getAutocompleteQuery()),aE);}}function Pi(i,e){if(i&1&&(ws(0,"div",4),rC(1,Oi,7,12,"div",10,Ti),pl()),i&2){let t=gC();XE(),oC(t.autocompleteItems);}}function ki(i,e){if(i&1){let t=lC();ws(0,"ds-icon-button",18),Rg("action",function(){If(t);let o=gC(2);return wf(o.onStopClick())}),pl();}}function Ii(i,e){if(i&1){let t=lC();ws(0,"ds-icon-button",19),Rg("action",function(){If(t);let o=gC(2);return wf(o.sendMessage())}),pl();}if(i&2){let t=gC(2);Ug("hidden",t.isDisabled||!t.message.trim())("active",!!t.message.trim()&&!t.isDisabled),bg("title",t.getSendButtonTooltip())("disabled",t.isDisabled||!t.message.trim());}}function Di(i,e){if(i&1){let t=lC();ws(0,"ds-icon-button",21),Rg("action",function(){If(t);let o=gC(3);return wf(o.triggerFileUpload())}),pl(),ws(1,"input",22,1),Rg("change",function(o){If(t);let r=gC(3);return wf(r.onFileInputChange(o))}),pl();}if(i&2){let t=gC(3);bg("disabled",t.isDisabled);}}function Ai(i,e){if(i&1){let t=lC();Jw(0,Di,3,1),ws(1,"ds-icon-button",20),Rg("action",function(){If(t);let o=gC(2);return wf(o.toggleRecording())}),pl();}if(i&2){let t=gC(2);eC(!t.showWelcome&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?0:-1),XE(),Ug("hidden",t.message.trim()&&!t.isRecording&&!t.isTranscribing),bg("variant",t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing)?"danger":"default")("disabled",t.isVoiceMessageMode&&t.isTranscribing)("title",t.isRecording?"Click to stop recording":t.isTranscribing?"Uploading...":"Click to start recording");}}function Fi(i,e){if(i&1&&(ws(0,"div",7),Jw(1,ki,1,0,"ds-icon-button",16),Jw(2,Ii,1,6,"ds-icon-button",17),Jw(3,Ai,2,6),pl()),i&2){let t=gC();XE(),eC(t.isThinking?1:-1),XE(),eC((!t.isThinking||t.message.trim())&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?2:-1),XE(),eC(t.isThinking?-1:3);}}var rt=class i{isDisabled=false;showWelcome=false;isThinking=false;isStarting=false;isSessionInitializing=false;isStopping=false;filesPasted=new vt$1;messageSubmitted=new vt$1;voiceMessageReady=new vt$1;voiceRecordingToggled=new vt$1;heightChanged=new vt$1;stopRequested=new vt$1;textareaFocused=new vt$1;messageInput;fileInput;message="";isRecording=false;isTranscribing=false;isFocused=false;recognition=null;mediaRecorder=null;audioChunks=[];voiceInputMode="browser";get isVoiceMessageMode(){return this.voiceInputMode==="voice-message"}sessionHadTranscript=false;pendingLineBreaksTimeout=null;lastProcessedResultIndex=0;useEnterToSend=false;currentInvite="";subscriptions=[];thinkingPhrases=["Processing request...","Thinking...","Working on it..."];currentThinkingPhrase="Processing request...";thinkingPhraseIndex=0;thinkingInterval=null;autocompleteVisible=false;autocompleteTrigger=null;autocompleteItems=[];selectedAutocompleteIndex=0;preferencesService=g(L);codayService=g(Ge);agentApiService=g(f);promptApiService=g(d);projectStateService=g(P$1);audioApiService=g(be);threadStateService=g(U);ngOnInit(){this.initializeVoiceInput(),this.useEnterToSend=this.preferencesService.getEnterToSend(),this.subscriptions.push(this.preferencesService.voiceLanguage$.subscribe(()=>this.updateRecognitionLanguage())),this.subscriptions.push(this.preferencesService.voiceInputMode$.subscribe(e=>{this.voiceInputMode=e;})),this.subscriptions.push(this.preferencesService.enterToSend$.subscribe(e=>{this.useEnterToSend=e;})),this.subscribeToInviteEvents(),this.subscribeToMessageRestore();}ngAfterViewInit(){this.adjustTextareaHeight(),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),200);});}ngOnChanges(e){e.isThinking&&(e.isThinking.currentValue?this.startThinkingAnimation():(this.stopThinkingAnimation(),this.isStopping=false,e.isThinking.previousValue&&(console.log("[CHAT-TEXTAREA] Thinking ended, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100);})))),e.isSessionInitializing&&!e.isSessionInitializing.currentValue&&e.isSessionInitializing.previousValue&&(console.log("[CHAT-TEXTAREA] Session initialization completed, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100);})),e.isStarting&&!e.isStarting.currentValue&&e.isStarting.previousValue&&this.isThinking&&(this.thinkingPhraseIndex===0?(console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index 0 - restarting animation"),this.stopThinkingAnimation(),this.startThinkingAnimation()):console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index",this.thinkingPhraseIndex,"- continuing without restart"));}ngOnDestroy(){this.subscriptions.forEach(e=>e.unsubscribe()),this.subscriptions=[],this.clearPendingLineBreaks(),this.stopThinkingAnimation();}onKeyDown(e){if(this.autocompleteVisible)switch(e.key){case "ArrowDown":e.preventDefault(),this.selectedAutocompleteIndex=Math.min(this.selectedAutocompleteIndex+1,this.autocompleteItems.length-1),this.scrollSelectedItemIntoView();return;case "ArrowUp":e.preventDefault(),this.selectedAutocompleteIndex=Math.max(this.selectedAutocompleteIndex-1,0),this.scrollSelectedItemIntoView();return;case "Tab":case "Enter":if(!this.message.includes(" ")){e.preventDefault(),this.selectAutocompleteItem();return}break;case "Escape":e.preventDefault(),this.hideAutocomplete();return}e.key==="Enter"&&(this.useEnterToSend?!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(e.preventDefault(),this.sendMessage(true)):(navigator.platform.toLowerCase().includes("mac")?e.metaKey:e.ctrlKey)&&!e.shiftKey&&(e.preventDefault(),this.sendMessage(true)));}onInput(){this.adjustTextareaHeight(),this.checkForAutocomplete();}onPaste(e){let t=e.clipboardData?.items;if(!t)return;let n=Array.from(t).filter(r=>r.kind==="file");if(!n.length)return;e.preventDefault();let o=n.reduce((r,d)=>{let v=d.getAsFile();return v?[...r,v]:r},[]);o.length&&this.filesPasted.emit(o);}triggerFileUpload(){console.log("[CHAT-TEXTAREA] Triggering file upload"),this.fileInput?.nativeElement?.click();}onFileInputChange(e){let t=e.target,n=t.files;if(!n||n.length===0){console.log("[CHAT-TEXTAREA] No files selected");return}console.log("[CHAT-TEXTAREA] Files selected:",n.length);let o=Array.from(n);this.filesPasted.emit(o),t.value="";}onDocumentClick(e){if(!this.autocompleteVisible)return;let t=e.target,n=document.querySelector(".autocomplete-popup"),o=this.messageInput?.nativeElement;n&&!n.contains(t)&&o&&!o.contains(t)&&this.hideAutocomplete();}sendMessage(e=false){let t=this.message.trim();!this.isDisabled&&(e||t)&&(this.isRecording&&this.recognition&&(this.clearPendingLineBreaks(),this.recognition.stop()),this.messageSubmitted.emit(t),this.message="",setTimeout(()=>this.adjustTextareaHeight(),0));}onStopClick(){this.isStopping=true,this.stopRequested.emit();}toggleRecording(){this.isRecording?this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.stopWhisperRecording():this.stopRecording():this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.startWhisperRecording():this.startRecording();}startWhisperRecording(){return B(this,null,function*(){if(!this.isRecording)try{let e=yield navigator.mediaDevices.getUserMedia({audio:!0});this.audioChunks=[],this.mediaRecorder=new MediaRecorder(e),this.mediaRecorder.ondataavailable=t=>{t.data.size>0&&this.audioChunks.push(t.data);},this.mediaRecorder.onstop=()=>{e.getTracks().forEach(t=>t.stop()),this.processWhisperAudio();},this.mediaRecorder.onerror=t=>{console.error("[WHISPER] MediaRecorder error:",t),e.getTracks().forEach(n=>n.stop()),this.isRecording=!1,this.voiceRecordingToggled.emit(!1);},this.mediaRecorder.start(),this.isRecording=!0,this.voiceRecordingToggled.emit(!0),console.log("[WHISPER] Started recording");}catch(e){console.error("[WHISPER] Failed to start recording:",e),this.isRecording=false,this.voiceRecordingToggled.emit(false);}})}stopWhisperRecording(){if(!(!this.mediaRecorder||!this.isRecording))try{this.mediaRecorder.stop(),this.isRecording=!1,this.voiceRecordingToggled.emit(!1),console.log("[WHISPER] Stopped recording");}catch(e){console.error("[WHISPER] Failed to stop recording:",e),this.isRecording=false,this.voiceRecordingToggled.emit(false);}}processWhisperAudio(){if(this.audioChunks.length===0)return;let e=new Blob(this.audioChunks,{type:this.mediaRecorder?.mimeType||"audio/webm"}),t=e.type.split(";")[0]||"audio/webm";this.audioChunks=[],this.isTranscribing=true;let n=new FileReader;n.onloadend=()=>{let o=n.result.split(",")[1];if(!o){console.error("[WHISPER] Failed to read audio as base64"),this.isTranscribing=false;return}let d=this.preferencesService.getVoiceLanguage().split("-")[0];if(this.voiceInputMode==="voice-message"){if(!this.threadStateService.getSelectedThreadId()){console.log("[WHISPER] No thread selected \u2014 emitting voiceMessageReady for thread creation"),this.isTranscribing=false,this.voiceMessageReady.emit({base64:o,mimeType:t,language:d});return}this.audioApiService.sendVoiceMessage(o,t,d).subscribe({next:v=>{this.isTranscribing=false,console.log("[WHISPER] Voice message sent, transcription:",v.transcription?.substring(0,50));},error:v=>{console.error("[WHISPER] Voice message error:",v),this.isTranscribing=false,this.fallbackToTranscription(o,t,d);}});}else this.audioApiService.transcribeAudio(o,t,d).subscribe({next:v=>{this.isTranscribing=false,v.text&&this.appendToTextarea(v.text+" ");},error:v=>{console.error("[WHISPER] Transcription error:",v),this.isTranscribing=false;}});},n.readAsDataURL(e);}fallbackToTranscription(e,t,n){this.audioApiService.transcribeAudio(e,t,n).subscribe({next:o=>{this.isTranscribing=false,o.text&&this.appendToTextarea(o.text+" ");},error:o=>{console.error("[WHISPER] Fallback transcription also failed:",o),this.isTranscribing=false;}});}initializeVoiceInput(){let e=window.SpeechRecognition??window.webkitSpeechRecognition;if(console.log("[SPEECH] speechRecognition",e),!e){console.warn("[SPEECH] Speech Recognition API not available");return}this.recognition=new e,this.recognition.continuous=true,this.recognition.interimResults=true,this.recognition.maxAlternatives=1,this.recognition.lang=this.getSelectedLanguage();try{"grammars"in this.recognition&&(this.recognition.serviceURI=void 0);}catch(t){console.log("[SPEECH] Advanced speech recognition parameters not supported");}this.recognition.onresult=t=>{let n="",o=Math.max(t.resultIndex,this.lastProcessedResultIndex);for(let r=o;r<t.results.length;r++)t.results[r].isFinal&&(n+=t.results[r][0].transcript,this.lastProcessedResultIndex=r+1);if(n){let r=this.improveTranscriptPunctuation(n.trim());this.sessionHadTranscript=true,console.log("[SPEECH] onresult ending, appending to textarea",this.isRecording),this.appendToTextarea(r);}},this.recognition.onend=()=>{console.log("[SPEECH] Recognition ended. Was recording:",this.isRecording),this.isRecording=false,this.lastProcessedResultIndex=0,this.voiceRecordingToggled.emit(this.isRecording);},this.recognition.onerror=t=>{console.error("[SPEECH] Speech recognition error:",t.error),console.log("[SPEECH] Error details:",{error:t.error,message:t.message,timeStamp:t.timeStamp}),this.isRecording=false,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording);},this.recognition.onstart=()=>{console.log("[SPEECH] Recognition started successfully");},this.recognition.onspeechstart=()=>{console.log("[SPEECH] Speech detected");},this.recognition.onspeechend=()=>{console.log("[SPEECH] Speech ended");};}startRecording(){return B(this,null,function*(){if(!(!this.recognition||this.isRecording))try{this.isRecording=!0,this.sessionHadTranscript=!1,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording),this.recognition.start(),console.log("[SPEECH] Started recording");}catch(e){console.error("[SPEECH] Failed to start recording:",e),this.isRecording=false,this.voiceRecordingToggled.emit(this.isRecording);}})}stopRecording(){if(!this.recognition||!this.isRecording){console.log("[SPEECH] stopRecording not recording");return}try{console.log("[SPEECH] stopRecording recognition stop"),this.recognition.stop(),this.schedulePendingLineBreaks();}catch(e){console.error("[SPEECH] Failed to stop recording:",e);}}getSelectedLanguage(){return this.preferencesService.getVoiceLanguage()}updateRecognitionLanguage(){if(this.recognition){let e=this.getSelectedLanguage();this.recognition.lang=e,console.log("[SPEECH] Language changed to:",e);}}improveTranscriptPunctuation(e){let t=e;return /[.!?]$/.test(t.trim())||(t=t.trim()+"."),t=t.charAt(0).toUpperCase()+t.slice(1),t=t.replace(/\s+/g," "),t=t+" ",t}appendToTextarea(e){let t=this.message;if(this.message=t?`${t}${e}`:e,this.messageInput?.nativeElement){this.messageInput.nativeElement.focus();let n=this.message.length;this.messageInput.nativeElement.setSelectionRange(n,n);}setTimeout(()=>this.adjustTextareaHeight(),0);}schedulePendingLineBreaks(){this.clearPendingLineBreaks(),this.pendingLineBreaksTimeout=window.setTimeout(()=>{this.sessionHadTranscript&&(console.log("[SPEECH] Adding line breaks after transcript session"),this.appendToTextarea(`
|
|
2
2
|
|
|
3
3
|
`),this.sessionHadTranscript=false),this.pendingLineBreaksTimeout=null;},500);}clearPendingLineBreaks(){this.pendingLineBreaksTimeout&&(clearTimeout(this.pendingLineBreaksTimeout),this.pendingLineBreaksTimeout=null);}adjustTextareaHeight(){let e=this.messageInput?.nativeElement;if(!e)return;let t=e.parentElement?.offsetHeight??e.offsetHeight+32;this.heightChanged.emit(t);}getSendButtonShortcut(){return this.useEnterToSend?"Enter":navigator.platform.toLowerCase().includes("mac")?"\u2318+Enter":"Ctrl+Enter"}getSendButtonTooltip(){return this.useEnterToSend?"Send message (Enter) - Shift+Enter for new line":`Send message (${navigator.platform.toLowerCase().includes("mac")?"Cmd+Enter":"Ctrl+Enter"}) - Enter for new line`}getPlaceholder(){return this.isSessionInitializing?"Initializing session...":this.isThinking?this.isStopping?"Stopping...":this.isStarting?"Processing request...":this.currentThinkingPhrase:this.isVoiceMessageMode&&this.isTranscribing?"Uploading...":this.isVoiceMessageMode&&this.isRecording?"Listening...":this.showWelcome?"How can I help you today?":"Type '@' for agents, '/' for commands, or just your message..."}startThinkingAnimation(){this.thinkingPhraseIndex=0,this.currentThinkingPhrase=this.thinkingPhrases[0]??"Thinking...",this.thinkingInterval=window.setInterval(()=>{this.thinkingPhraseIndex<this.thinkingPhrases.length-1&&(this.thinkingPhraseIndex++,this.currentThinkingPhrase=this.thinkingPhrases[this.thinkingPhraseIndex]??"Thinking...");},2e3);}stopThinkingAnimation(){this.thinkingInterval&&(clearInterval(this.thinkingInterval),this.thinkingInterval=null),this.thinkingPhraseIndex=0,this.currentThinkingPhrase="Thinking...";}subscribeToInviteEvents(){this.subscriptions.push(this.codayService.currentInviteEvent$.subscribe(e=>{e?this.handleInviteEvent(e.invite,e.defaultValue):this.currentInvite="";}));}handleInviteEvent(e,t){this.currentInvite=e,t&&(this.message=t,setTimeout(()=>this.adjustTextareaHeight(),0)),setTimeout(()=>{this.messageInput?.nativeElement&&this.messageInput.nativeElement.focus();},50);}subscribeToMessageRestore(){this.subscriptions.push(this.codayService.messageToRestore$.subscribe(e=>{e.trim()&&(console.log("[CHAT-TEXTAREA] Restoring message content:",e.substring(0,50)+"..."),this.restoreMessageContent(e));}));}restoreMessageContent(e){this.message=e,this.messageInput?.nativeElement&&(this.messageInput.nativeElement.focus(),setTimeout(()=>{let t=this.messageInput.nativeElement,n=this.message.length;t.setSelectionRange(n,n);},0)),setTimeout(()=>this.adjustTextareaHeight(),10);}focusTextarea(){let e=this.messageInput?.nativeElement;console.log("[CHAT-TEXTAREA] focusTextarea called",{hasElement:!!e,isDisabled:this.isDisabled,isThinking:this.isThinking,elementDisabled:e?.disabled,isSessionInitializing:this.isSessionInitializing}),e&&!e.disabled?(e.focus(),console.log("[CHAT-TEXTAREA] Textarea focused successfully")):console.log("[CHAT-TEXTAREA] Focus blocked - element disabled or not available");}checkForAutocomplete(){let e=this.message;if(e.startsWith("@")){let t=e.substring(1);if(t.includes(" ")){this.hideAutocomplete();return}this.showAgentAutocomplete(t);return}if(e.startsWith("/")){let t=e.substring(1);if(t.includes(" ")){this.hideAutocomplete();return}this.showPromptAutocomplete(t);return}this.hideAutocomplete();}showAgentAutocomplete(e){this.autocompleteTrigger="@";try{let t=this.projectStateService.getSelectedProjectIdOrThrow();this.agentApiService.getAgentsAutocomplete(t,e).subscribe({next:n=>{this.autocompleteItems=n,this.autocompleteVisible=n.length>0,this.selectedAutocompleteIndex=0;},error:n=>{console.error("[AUTOCOMPLETE] Error loading agents:",n),this.hideAutocomplete();}});}catch(t){console.warn("[AUTOCOMPLETE] No project selected, cannot load agents"),this.hideAutocomplete();}}showPromptAutocomplete(e){this.autocompleteTrigger="/";try{let t=this.projectStateService.getSelectedProjectIdOrThrow();this.promptApiService.getPromptsAutocomplete(t,e).subscribe({next:n=>{this.autocompleteItems=n,this.autocompleteVisible=n.length>0,this.selectedAutocompleteIndex=0;},error:n=>{console.error("[AUTOCOMPLETE] Error loading prompts:",n),this.hideAutocomplete();}});}catch(t){console.warn("[AUTOCOMPLETE] No project selected, cannot load prompts"),this.hideAutocomplete();}}hideAutocomplete(){this.autocompleteVisible=false,this.autocompleteItems=[],this.selectedAutocompleteIndex=0;}selectAutocompleteItem(){let e=this.autocompleteItems[this.selectedAutocompleteIndex];if(!e)return;let t=null;if(this.autocompleteTrigger==="/"){let n=e,o=n.parameterFormat;if(console.log(n),o===void 0)this.message=`/${e.name}`;else if(o==="")this.message=`/${e.name} `;else {this.message=`/${e.name} ${o}`;let r=this.message.indexOf('=""');r!==-1&&(t=r+2);}}else this.message=`@${e.name} `;this.hideAutocomplete(),setTimeout(()=>{if(this.messageInput?.nativeElement)if(this.messageInput.nativeElement.focus(),t!==null)this.messageInput.nativeElement.setSelectionRange(t,t);else {let n=this.message.length;this.messageInput.nativeElement.setSelectionRange(n,n);}},0);}selectAutocompleteItemByClick(e){this.selectedAutocompleteIndex=e,this.selectAutocompleteItem();}getAutocompleteQuery(){return this.message.substring(1).split(" ")[0]??""}getParameterFormat(e){return e.parameterFormat}hasParameterFormat(e){return this.autocompleteTrigger==="/"&&e.parameterFormat!==void 0}scrollSelectedItemIntoView(){setTimeout(()=>{let e=document.querySelector(".autocomplete-popup");if(!e)return;let t=e.querySelector(".autocomplete-item.selected");t&&t.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"});},0);}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=xw({type:i,selectors:[["app-chat-textarea"]],viewQuery:function(t,n){if(t&1&&Pg(yi,7)(wi,5),t&2){let o;EC(o=IC())&&(n.messageInput=o.first),EC(o=IC())&&(n.fileInput=o.first);}},hostBindings:function(t,n){t&1&&Rg("paste",function(r){return n.onPaste(r)})("click",function(r){return n.onDocumentClick(r)},dE);},inputs:{isDisabled:"isDisabled",showWelcome:"showWelcome",isThinking:"isThinking",isStarting:"isStarting",isSessionInitializing:"isSessionInitializing"},outputs:{filesPasted:"filesPasted",messageSubmitted:"messageSubmitted",voiceMessageReady:"voiceMessageReady",voiceRecordingToggled:"voiceRecordingToggled",heightChanged:"heightChanged",stopRequested:"stopRequested",textareaFocused:"textareaFocused"},features:[Tu],decls:8,vars:15,consts:[["messageInput",""],["fileInput",""],[1,"chat-input-container"],[1,"recording-indicator"],[1,"autocomplete-popup"],[1,"input-row","grouped-input"],[1,"message-input",3,"ngModelChange","keydown","input","focus","blur","ngModel","placeholder","disabled"],[1,"actions"],[1,"recording-dot"],[1,"transcribing-dot"],["role","option","tabindex","0",1,"autocomplete-item",3,"selected"],["role","option","tabindex","0",1,"autocomplete-item",3,"click","keydown.enter","keydown.space","mouseenter"],[1,"item-name"],[3,"innerHTML"],[1,"parameter-format"],[1,"item-description",3,"innerHTML"],["icon","stop","variant","danger","title","Stop generation",1,"action-btn"],["icon","send","variant","primary",1,"send-btn",3,"title","disabled","hidden","active"],["icon","stop","variant","danger","title","Stop generation",1,"action-btn",3,"action"],["icon","send","variant","primary",1,"send-btn",3,"action","title","disabled"],["icon","mic",1,"voice-btn",3,"action","variant","disabled","title"],["icon","attach_file","variant","default","title","Upload files (images or documents)",1,"upload-btn",3,"action","disabled"],["type","file","multiple","","accept","image/*,application/pdf,.pdf,.doc,.docx,.txt,.md,.json,.yaml,.yml,.csv,.xml,.html",2,"display","none",3,"change"]],template:function(t,n){if(t&1){let o=lC();ws(0,"div",2),Jw(1,Si,3,0,"div",3),Jw(2,Mi,3,0,"div",3),Jw(3,Pi,3,0,"div",4),ws(4,"div",5)(5,"textarea",6,0),tm("ngModelChange",function(d){return If(o),KC(n.message,d)||(n.message=d),wf(d)}),Rg("keydown",function(d){return n.onKeyDown(d)})("input",function(){return n.onInput()})("focus",function(){return If(o),n.isFocused=true,wf(n.textareaFocused.emit())})("blur",function(){return n.isFocused=false}),pl(),VI(),Jw(7,Fi,4,3,"div",7),pl()();}t&2&&(XE(),eC(!n.isVoiceMessageMode&&n.isRecording?1:-1),XE(),eC(!n.isVoiceMessageMode&&n.isTranscribing?2:-1),XE(),eC(n.autocompleteVisible?3:-1),XE(),Ug("focused",n.isFocused)("welcome-mode",n.showWelcome)("is-thinking",n.isThinking)("is-listening",n.isVoiceMessageMode&&(n.isRecording||n.isTranscribing)),XE(),em("ngModel",n.message),bg("placeholder",n.getPlaceholder())("disabled",n.isDisabled||n.isVoiceMessageMode&&(n.isRecording||n.isTranscribing)),UI(),XE(2),eC(n.isSessionInitializing?-1:7));},dependencies:[ti$1,Ye,Zn$1,cn,Se$1,ot],styles:['@keyframes _ngcontent-%COMP%_gradientBorderShift{0%{background-position:0 0}50%{background-position:100% 0}to{background-position:0 0}}.chat-input-container[_ngcontent-%COMP%]{flex-shrink:0;width:100%;position:relative}.thinking-progress[_ngcontent-%COMP%]{position:absolute;top:0;left:0;right:0;height:3px;z-index:1}.thinking-progress[_ngcontent-%COMP%] .mdc-linear-progress__bar-inner{border-top-width:3px}.input-row.grouped-input[_ngcontent-%COMP%]{display:flex;align-items:stretch;background:var(--glass-bg);border-radius:16px;padding:0 .15rem 0 1.25rem;position:relative;transition:border-color .2s,box-shadow .2s,background .3s}.input-row[_ngcontent-%COMP%]{position:relative;background:var(--glass-bg, #1e1e1e)!important;background-clip:padding-box}.input-row[_ngcontent-%COMP%]:before{content:"";position:absolute;inset:-2px;border-radius:inherit;background-size:200% 100%;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);-webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);-webkit-mask-composite:xor;mask-composite:exclude;padding:1px;pointer-events:none;z-index:-1;animation:_ngcontent-%COMP%_gradientBorderShift 3s ease-in-out infinite}.input-row.is-listening[_ngcontent-%COMP%]:before{inset:0;-webkit-mask:none;mask:none;padding:0;opacity:.15;z-index:0;background:linear-gradient(90deg,var(--color-error, #ef4444) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-error, #ef4444) 100%);background-size:200% 100%;animation:_ngcontent-%COMP%_gradientBorderShift 2s ease-in-out infinite}.input-row.is-listening[_ngcontent-%COMP%] .message-input[_ngcontent-%COMP%], .input-row.is-listening[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%]{position:relative;z-index:1}.input-row.is-thinking[_ngcontent-%COMP%]:before{inset:0;-webkit-mask:none;mask:none;padding:0;opacity:.15;z-index:0;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% 100%;animation:_ngcontent-%COMP%_gradientBorderShift 3s ease-in-out infinite}.input-row.is-thinking[_ngcontent-%COMP%] .message-input[_ngcontent-%COMP%], .input-row.is-thinking[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%]{position:relative;z-index:1}.input-row.grouped-input.focused[_ngcontent-%COMP%]:not(.is-thinking):before{background:var(--color-primary);animation:none}.input-row.grouped-input.focused[_ngcontent-%COMP%]:not(.is-thinking){box-shadow:0 0 0 4px #007aff1a}.message-input[_ngcontent-%COMP%]{flex:1;border:none;outline:none;background:transparent!important;box-shadow:none;font-size:1rem;padding:1rem 0;color:var(--color-text);resize:none;field-sizing:content;min-height:36px;max-height:70vh;overflow-y:auto;font-family:-apple-system,BlinkMacSystemFont,SF Pro Display,system-ui,sans-serif;line-height:1.5}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar{width:8px}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:transparent}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:var(--color-border);border-radius:4px}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:var(--color-text-secondary)}.message-input[_ngcontent-%COMP%]:focus{outline:none;border:none;box-shadow:none}.message-input[_ngcontent-%COMP%]:disabled{background-color:var(--color-bg-secondary);color:var(--color-text-secondary);cursor:not-allowed;opacity:.6}.message-input[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary);transition:opacity .3s ease-in-out}.message-input[_ngcontent-%COMP%]:disabled::placeholder{animation:_ngcontent-%COMP%_thinkingPulsate 2s ease-in-out infinite}@keyframes _ngcontent-%COMP%_thinkingPulsate{0%,to{opacity:.6}50%{opacity:1}}.voice-btn[_ngcontent-%COMP%], .send-btn[_ngcontent-%COMP%], .action-btn[_ngcontent-%COMP%], .upload-btn[_ngcontent-%COMP%]{margin:0}.actions[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex-wrap:wrap;justify-content:center}.send-btn[_ngcontent-%COMP%]{transition:opacity .4s,margin-left .4s}.send-btn.active[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{opacity:1}.send-btn[_ngcontent-%COMP%]:not(.active) button[_ngcontent-%COMP%]{opacity:0;margin-left:calc(-.5rem - 36px)}.send-btn[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover:not(:disabled){color:#fff;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-primary, #3b82f6) 20%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 80%,var(--color-primary, #3b82f6) 100%);background-size:300% auto;animation:sendButtonGradientShift 6s ease-in-out infinite;box-shadow:0 4px 14px #007aff30;transform:scale(1.2)}.send-btn[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:active:not(:disabled){transform:scale(1.3);box-shadow:0 4px 24px #007aff30}.recording-indicator[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-top:.2rem;margin-bottom:.2rem;color:var(--color-error, #ff5555);font-size:.9rem;position:absolute;top:-1.5rem}@keyframes _ngcontent-%COMP%_pulse{0%,to{opacity:1}50%{opacity:.5}}.autocomplete-popup[_ngcontent-%COMP%]{position:absolute;bottom:100%;left:0;right:0;margin-bottom:.5rem;background:var(--glass-bg);-webkit-backdrop-filter:var(--glass-backdrop-blur);backdrop-filter:var(--glass-backdrop-blur);border-radius:12px;box-shadow:0 8px 32px #00000026;border:1px solid var(--color-border);max-height:400px;max-width:500px;overflow-y:auto;z-index:100}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar{width:8px}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:transparent}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:var(--color-border);border-radius:4px}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:var(--color-text-secondary)}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%]{padding:.75rem 1rem;cursor:pointer;transition:background .2s;border-left:3px solid transparent}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%]:hover, .autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item.selected[_ngcontent-%COMP%]{background:var(--color-bg-hover)}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item.selected[_ngcontent-%COMP%]{border-left-color:var(--color-primary)}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-name[_ngcontent-%COMP%]{font-weight:600;color:var(--color-text);margin-bottom:.25rem;font-family:SF Mono,Monaco,Menlo,Cascadia Code,Consolas,monospace;font-size:.95rem}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-name[_ngcontent-%COMP%] strong{font-weight:700;color:var(--color-primary);background:var(--color-primary-light, rgba(99, 102, 241, .1));padding:0 2px;border-radius:2px}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-name[_ngcontent-%COMP%] .parameter-format[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-weight:400;opacity:.7}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-description[_ngcontent-%COMP%]{font-size:.85rem;color:var(--color-text-secondary);line-height:1.3}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-description[_ngcontent-%COMP%] strong{font-weight:700;color:var(--color-primary);background:var(--color-primary-light, rgba(99, 102, 241, .1))}@media print{.thinking-progress[_ngcontent-%COMP%], .action-btn[_ngcontent-%COMP%], .voice-btn[_ngcontent-%COMP%], .send-btn[_ngcontent-%COMP%], .upload-btn[_ngcontent-%COMP%], .recording-indicator[_ngcontent-%COMP%], .autocomplete-popup[_ngcontent-%COMP%]{display:none!important}}'],changeDetection:1})};var Ce=class i{unreadCountSubject=new Tr$1(0);unreadCount$=this.unreadCountSubject.asObservable();constructor(){console.log("[UNREAD] Service initialized");}addUnread(){let t=this.unreadCountSubject.value+1;this.unreadCountSubject.next(t),console.log("[UNREAD] Added unread message, total:",t);}markAllAsRead(){this.unreadCountSubject.value>0&&(this.unreadCountSubject.next(0),console.log("[UNREAD] Marked all messages as read"));}getCurrentCount(){return this.unreadCountSubject.value}reset(){this.unreadCountSubject.next(0),console.log("[UNREAD] Counter reset");}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};var at=class i{ATTENTION_EMOJI="\u{1F534}";isSystemActive=false;systemActiveTimer=null;SYSTEM_ACTIVE_TIMEOUT=4e3;unreadService=g(Ce);project=g(P$1);constructor(){this.initializeTitleUpdates();}initializeTitleUpdates(){Ly([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=true,this.systemActiveTimer&&clearTimeout(this.systemActiveTimer),this.systemActiveTimer=setTimeout(()=>{console.log("[TAB-TITLE] System active timeout - hiding hourglass"),this.isSystemActive=false,this.forceUpdateTitle();},this.SYSTEM_ACTIVE_TIMEOUT),this.forceUpdateTitle();}setSystemInactive(){console.log("[TAB-TITLE] System inactive - hiding hourglass"),this.isSystemActive=false,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=x({token:i,factory:i.\u0275fac,providedIn:"root"})};var st=class i{pendingFirstMessage=null;pendingVoiceMessage=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}setPendingVoiceMessage(e){console.log("[FIRST-MESSAGE-STATE] Storing pending voice message"),this.pendingVoiceMessage=e;}consumePendingVoiceMessage(){let e=this.pendingVoiceMessage;return e&&(console.log("[FIRST-MESSAGE-STATE] Consuming pending voice message"),this.pendingVoiceMessage=null),e}hasPendingFirstMessage(){return this.pendingFirstMessage!==null||this.pendingVoiceMessage!==null}clear(){this.pendingFirstMessage&&(console.log("[FIRST-MESSAGE-STATE] Clearing pending first message"),this.pendingFirstMessage=null),this.pendingVoiceMessage=null;}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};var Ri=(i,e)=>e.label;function Hi(i,e){if(i&1){let t=lC();ws(0,"button",2),Rg("click",function(o){let r=If(t).$implicit,d=gC();return wf(d.executeAction(r,o))}),ws(1,"mat-icon"),GC(2),pl()();}if(i&2){let t=e.$implicit;Tg("title",t.tooltip||t.label),XE(),Tg("aria-label",t.label),XE(),Yg(t.icon);}}var ct=class i{actions=[];executeAction(e,t){t.stopPropagation(),e.action();}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=xw({type:i,selectors:[["app-message-context-menu"]],inputs:{actions:"actions"},decls:3,vars:0,consts:[[1,"context-menu-wrapper"],["mat-icon-button",""],["mat-icon-button","",3,"click"]],template:function(t,n){t&1&&(ws(0,"div",0),rC(1,Hi,3,3,"button",1,Ri),pl()),t&2&&(XE(),oC(n.actions));},dependencies:[qm,Gn$1,wt$1],styles:[".context-menu-wrapper[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center}.context-menu-wrapper[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{transform:scale(.75)}"],changeDetection:1})};var Z=class i{renderer;constructor(){this.renderer=new Ue$1,this.configureRenderer();}configureRenderer(){let e=this.renderer.link.bind(this.renderer);this.renderer.link=t=>{let n=this.isExternalLink(t.href),o=e(t);if(n){o=o.replace("<a ",'<a target="_blank" rel="noopener noreferrer" ');let r=t.title?`${t.text} - ${t.title} (opens in new tab)`:`${t.text} (opens in new tab)`;o=o.replace("<a ",`<a aria-label="${this.escapeHtml(r)}" `),o=o.replace("</a>",'<span class="external-link-icon" aria-hidden="true">\u2197</span></a>');}return o};}isExternalLink(e){if(!e||e.startsWith("/")||e.startsWith("#")||e.startsWith("?"))return false;if(e.startsWith("//"))return true;try{return new URL(e,window.location.href).hostname!==window.location.hostname}catch(t){return false}}escapeHtml(e){let t={"&":"&","<":"<",">":">",'"':""","'":"'"};return e.replace(/[&<>"']/g,n=>t[n]||n)}parse(e){return B(this,null,function*(){let t=yield x$2.parse(e,{renderer:this.renderer,breaks:true,gfm:true});return is.sanitize(t,{ADD_TAGS:["span"],ADD_ATTR:["aria-hidden","aria-label","target","rel"],ALLOWED_URI_REGEXP:/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))/i})})}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};var Vi=i=>({"user-message-wrapper":i});function Li(i,e){if(i&1&&(ws(0,"div",4)(1,"div",8),GC(2),pl()()),i&2){let t=gC(2);XE(2),vl(" ",t.message.speaker," ");}}function zi(i,e){if(i&1&&(ws(0,"time",6),GC(1),pl()),i&2){let t=gC(2);XE(),Yg(t.formattedTimestamp);}}function Ni(i,e){if(i&1&&(ws(0,"div",7),Sg(1,"app-message-context-menu",9),pl()),i&2){let t=gC(2);XE(),bg("actions",t.actions);}}function $i(i,e){if(i&1&&(Jw(0,Li,3,1,"div",4),Sg(1,"div",5),Jw(2,zi,2,1,"time",6),Jw(3,Ni,2,1,"div",7)),i&2){let t=gC();eC(t.shouldShowSpeaker?0:-1),XE(),bg("innerHTML",t.renderedContent,aE),XE(),eC(t.formattedTimestamp?2:-1),XE(),eC(t.isLongMessage&&t.shouldShowActions&&t.message.role==="assistant"?3:-1);}}function ji(i,e){if(i&1&&Sg(0,"span",12),i&2){let t=gC(3);bg("innerHTML",t.renderedContent,aE);}}function Ui(i,e){if(i&1&&(ws(0,"span",13),GC(1),pl()),i&2){let t=gC(3);XE(),Yg(t.collapsedErrorText);}}function Bi(i,e){i&1&&GC(0," Show less \u25B2 ");}function Wi(i,e){i&1&&GC(0," Show more \u25BC ");}function qi(i,e){if(i&1){let t=lC();ws(0,"div",10),Jw(1,ji,1,1,"span",12)(2,Ui,2,1,"span",13),ws(3,"button",14),Rg("click",function(){If(t);let o=gC(2);return wf(o.toggleErrorExpanded())}),Jw(4,Bi,1,0)(5,Wi,1,0),pl()();}if(i&2){let t=gC(2);XE(),eC(t.isErrorExpanded()?1:2),XE(3),eC(t.isErrorExpanded()?4:5);}}function Yi(i,e){i&1&&GC(0," \u25B2 ");}function Gi(i,e){i&1&&GC(0," \u25BC ");}function Qi(i,e){if(i&1&&(ws(0,"a",17),GC(1,"view"),pl()),i&2){let t=gC(3);bg("href",t.eventLink,yh);}}function Xi(i,e){if(i&1&&(ws(0,"pre",18),GC(1),pl()),i&2){let t=gC(3);XE(),Yg(t.message.fullContent);}}function Ki(i,e){if(i&1){let t=lC();ws(0,"div",15),Sg(1,"span",12),ws(2,"button",16),Rg("click",function(){If(t);let o=gC(2);return wf(o.toggleTechnicalExpanded())}),Jw(3,Yi,1,0)(4,Gi,1,0),pl(),Jw(5,Qi,2,1,"a",17),pl(),Jw(6,Xi,2,1,"pre",18);}if(i&2){let t=gC(2);XE(),bg("innerHTML",t.renderedContent,aE),XE(2),eC(t.isTechnicalExpanded()?3:4),XE(2),eC(t.eventLink?5:-1),XE(),eC(t.isTechnicalExpanded()?6:-1);}}function Ji(i,e){if(i&1&&(ws(0,"a",17),GC(1,"view"),pl()),i&2){let t=gC(3);bg("href",t.eventLink,yh);}}function Zi(i,e){if(i&1&&(ws(0,"div",11),Sg(1,"span",12),Jw(2,Ji,2,1,"a",17),pl()),i&2){let t=gC(2);XE(),bg("innerHTML",t.renderedContent,aE),XE(),eC(t.eventLink?2:-1);}}function eo(i,e){if(i&1&&Jw(0,qi,6,2,"div",10)(1,Ki,7,4)(2,Zi,3,2,"div",11),i&2){let t=gC();eC(t.message.type==="error"&&t.isLongError?0:t.message.type==="technical"&&t.message.fullContent?1:2);}}function to(i,e){if(i&1&&(ws(0,"div",2),Sg(1,"app-message-context-menu",9),pl()),i&2){let t=gC();XE(),bg("actions",t.actions);}}function no(i,e){if(i&1&&(ws(0,"div",3),Sg(1,"app-message-context-menu",9),pl()),i&2){let t=gC();XE(),bg("actions",t.actions);}}var ve=class i{destroy$=new ue;message;canDelete=true;isOtherUser=false;containingThreadId;copyRequested=new vt$1;deleteRequested=new vt$1;renderedContent="";shouldHideTechnical=false;shouldHideWarning=false;isErrorExpanded=Gi$1(false);static ERROR_COLLAPSE_LINE_THRESHOLD=5;isTechnicalExpanded=Gi$1(false);sanitizer=g(bS);notificationService=g(s);preferencesService=g(L);projectState=g(P$1);threadState=g(U);markdownService=g(Z);get messageClasses(){return {[this.message.role]:true,[this.message.type]:true,"hidden-technical":this.shouldHideTechnical&&this.message.type==="technical","hidden-warning":this.shouldHideWarning&&this.message.type==="warning","other-user":this.isOtherUser}}ngOnInit(){return B(this,null,function*(){yield this.renderMarkdown(),this.preferencesService.hideTechnicalMessages$.pipe(wd(this.destroy$)).subscribe(e=>{this.shouldHideTechnical=e;}),this.preferencesService.hideWarningMessages$.pipe(wd(this.destroy$)).subscribe(e=>{this.shouldHideWarning=e;}),this.shouldHideTechnical=this.preferencesService.getHideTechnicalMessages(),this.shouldHideWarning=this.preferencesService.getHideWarningMessages();})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete();}get shouldShowSpeaker(){return this.message.role==="user"?this.isOtherUser||this.message.speaker.startsWith("@"):this.message.role==="assistant"}get shouldShowActions(){return this.message.role==="user"||this.message.role==="assistant"}get isSimplified(){return this.message.role!=="user"&&this.message.role!=="assistant"}datePipe=g(kb);get formattedTimestamp(){if(this.message.role!=="user"||!this.message.timestamp)return null;let e=new Date().toDateString()===this.message.timestamp.toDateString();return this.datePipe.transform(this.message.timestamp,e?"HH:mm":"dd/MM HH:mm")}get isLongError(){return this.message.type!=="error"?false:this.extractTextContent().split(/\n|\\n/).length>i.ERROR_COLLAPSE_LINE_THRESHOLD}get collapsedErrorText(){return this.extractTextContent().split(/\n|\\n/).slice(0,i.ERROR_COLLAPSE_LINE_THRESHOLD).join(`
|
|
4
4
|
`)+"\u2026"}toggleErrorExpanded(){this.isErrorExpanded.update(e=>!e);}toggleTechnicalExpanded(){this.isTechnicalExpanded.update(e=>!e);}get isLongMessage(){let e=this.extractTextContent();return e.length>1e3||e.split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {cb as ZB,cc as qB,g,G as G$1,P,m as mT,e as xw,h as hr,j as Gn,k as ws,q as Rg,J as Jw,n as GC,o as pl,b$ as kC,A as Ug,T as Tg,X as XE,y as eC,a8 as Yg,a5 as vl,v as bg,a9 as lC,aa as If,ac as gC,ab as wf,S as Sg}from'./main-ZRCBAFS7.js';import {v as ve,n as ne}from'./chunk-DDOOlpHu.js';import {V as Ve,n as ne$1}from'./chunk-C771ae8O.js';import {y as yt,w as wt}from'./chunk-E7zo1ZWp.js';function L(a,e){if(a&1){let n=lC();ws(0,"div",1)(1,"mat-checkbox",21),Rg("click",function(r){return r.stopPropagation()})("change",function(r){If(n);let i=gC();return wf(i.selectionChanged.emit({id:i.task().id,selected:r.checked}))}),pl()();}if(a&2){let n=gC();XE(),bg("checked",n.selected()),Tg("aria-label","Select task: "+n.task().name);}}function Y(a,e){a&1&&(ws(0,"mat-icon",2),GC(1,"star"),pl());}function W(a,e){a&1&&Sg(0,"span",6);}function U(a,e){if(a&1&&(ws(0,"div",7)(1,"mat-icon",22),GC(2,"folder"),pl(),ws(3,"span"),GC(4),pl()()),a&2){let n=gC();XE(4),Yg(n.projectName());}}function B(a,e){if(a&1&&(ws(0,"p",9),GC(1),pl()),a&2){let n=gC();XE(),Yg(n.task().summary);}}function $(a,e){a&1&&(ws(0,"p",10),GC(1,"No summary yet"),pl());}function H(a,e){if(a&1){let n=lC();ws(0,"button",23),Rg("click",function(r){If(n);let i=gC();return wf(i.onOpenDirect(r))}),ws(1,"mat-icon"),GC(2,"open_in_new"),pl()();}}function F(a,e){if(a&1){let n=lC();ws(0,"button",24),Rg("click",function(r){If(n);let i=gC();return wf(i.onStop(r))}),ws(1,"mat-icon"),GC(2,"stop_circle"),pl()();}}function G(a,e){if(a&1){let n=lC();ws(0,"button",25),Rg("click",function(r){If(n);let i=gC();return wf(i.onMarkDone(r))}),ws(1,"mat-icon"),GC(2,"check_circle_outline"),pl()();}}function K(a,e){if(a&1){let n=lC();ws(0,"button",26),Rg("click",function(r){If(n);let i=gC();return wf(i.onMarkActive(r))}),ws(1,"mat-icon"),GC(2,"replay"),pl()();}}function J(a,e){if(a&1){let n=lC();ws(0,"button",27),Rg("click",function(r){If(n);let i=gC();return wf(i.onCloseTask(r))}),ws(1,"mat-icon"),GC(2,"close_fullscreen"),pl()();}}var A=class a{task=ZB.required();projectNameOverride=ZB(null);showProject=ZB(false);previewMode=ZB(false);selectable=ZB(false);selected=ZB(false);stopRequested=qB();deleteRequested=qB();starToggled=qB();closeTaskRequested=qB();markDoneRequested=qB();markActiveRequested=qB();previewRequested=qB();selectionChanged=qB();router=g(G$1);projectState=g(P);projectName=mT(()=>this.projectNameOverride()??this.projectState.getSelectedProjectId());statusLabel=mT(()=>Q[this.task().status]);statusIcon=mT(()=>X[this.task().status]);isWorktree=mT(()=>!!this.task().worktreeProject);navigate(){if(this.previewMode()){this.previewRequested.emit(this.task().id);return}let e=this.projectName();e&&(this.projectState.selectProject(e),this.router.navigate(["project",e,"thread",this.task().id]));}onStop(e){e.stopPropagation(),this.stopRequested.emit(this.task().id);}onDelete(e){e.stopPropagation(),this.deleteRequested.emit(this.task().id);}onStarToggle(e){e.stopPropagation(),this.starToggled.emit(this.task().id);}onCloseTask(e){e.stopPropagation(),this.closeTaskRequested.emit(this.task().id);}onMarkDone(e){e.stopPropagation(),this.markDoneRequested.emit(this.task().id);}onMarkActive(e){e.stopPropagation(),this.markActiveRequested.emit(this.task().id);}onOpenDirect(e){e.stopPropagation();let n=this.projectName();n&&(this.projectState.selectProject(n),this.router.navigate(["project",n,"thread",this.task().id]));}formatRelativeTime(e){let n=Date.now()-new Date(e).getTime(),t=Math.floor(n/6e4);if(t<1)return "just now";if(t<60)return `${t} min ago`;let r=Math.floor(t/60);if(r<24)return `${r}h ago`;let i=Math.floor(r/24);return i===1?"yesterday":i<7?`${i} days ago`:new Date(e).toLocaleDateString("en",{day:"numeric",month:"short"})}static \u0275fac=function(n){return new(n||a)};static \u0275cmp=xw({type:a,selectors:[["app-task-card"]],inputs:{task:[1,"task"],projectNameOverride:[1,"projectNameOverride"],showProject:[1,"showProject"],previewMode:[1,"previewMode"],selectable:[1,"selectable"],selected:[1,"selected"]},outputs:{stopRequested:"stopRequested",deleteRequested:"deleteRequested",starToggled:"starToggled",closeTaskRequested:"closeTaskRequested",markDoneRequested:"markDoneRequested",markActiveRequested:"markActiveRequested",previewRequested:"previewRequested",selectionChanged:"selectionChanged"},decls:29,vars:25,consts:[["role","button","tabindex","0",1,"task-card",3,"click","keydown.enter","keydown.space"],[1,"selection-checkbox"],["aria-label","Starred",1,"starred-indicator"],[1,"status-badge"],[1,"status-icon"],[1,"status-label"],["aria-hidden","true",1,"pulse-ring"],[1,"task-project"],[1,"task-name"],[1,"task-summary"],[1,"task-summary","empty"],[1,"task-footer"],[1,"task-time"],[1,"task-actions"],["mat-icon-button","","matTooltip","Open full view","aria-label","Open task in full view",1,"action-btn","open-btn"],["mat-icon-button","","matTooltip","Stop agent","aria-label","Stop agent",1,"action-btn","stop-btn"],["mat-icon-button","","matTooltip","Mark as done","aria-label","Mark as done",1,"action-btn","mark-done-btn"],["mat-icon-button","","matTooltip","Mark as active","aria-label","Mark as active",1,"action-btn","mark-active-btn"],["mat-icon-button","",1,"action-btn","star-btn",3,"click","matTooltip"],["mat-icon-button","","matTooltip","Close task (removes worktree)","aria-label","Close task",1,"action-btn","close-task-btn"],["mat-icon-button","","matTooltip","Delete task","aria-label","Delete task",1,"action-btn","delete-btn",3,"click"],[3,"click","change","checked"],[1,"project-icon"],["mat-icon-button","","matTooltip","Open full view","aria-label","Open task in full view",1,"action-btn","open-btn",3,"click"],["mat-icon-button","","matTooltip","Stop agent","aria-label","Stop agent",1,"action-btn","stop-btn",3,"click"],["mat-icon-button","","matTooltip","Mark as done","aria-label","Mark as done",1,"action-btn","mark-done-btn",3,"click"],["mat-icon-button","","matTooltip","Mark as active","aria-label","Mark as active",1,"action-btn","mark-active-btn",3,"click"],["mat-icon-button","","matTooltip","Close task (removes worktree)","aria-label","Close task",1,"action-btn","close-task-btn",3,"click"]],template:function(n,t){n&1&&(ws(0,"article",0),Rg("click",function(){return t.navigate()})("keydown.enter",function(){return t.navigate()})("keydown.space",function(i){return t.navigate(),i.preventDefault()}),Jw(1,L,2,2,"div",1),Jw(2,Y,2,0,"mat-icon",2),ws(3,"div",3)(4,"mat-icon",4),GC(5),pl(),ws(6,"span",5),GC(7),pl(),Jw(8,W,1,0,"span",6),pl(),Jw(9,U,5,1,"div",7),ws(10,"h3",8),GC(11),pl(),Jw(12,B,2,1,"p",9)(13,$,2,0,"p",10),ws(14,"footer",11)(15,"span",12),GC(16),pl(),ws(17,"div",13),Jw(18,H,3,0,"button",14),Jw(19,F,3,0,"button",15),Jw(20,G,3,0,"button",16)(21,K,3,0,"button",17),ws(22,"button",18),Rg("click",function(i){return t.onStarToggle(i)}),ws(23,"mat-icon"),GC(24),pl()(),Jw(25,J,3,0,"button",19),ws(26,"button",20),Rg("click",function(i){return t.onDelete(i)}),ws(27,"mat-icon"),GC(28,"delete_outline"),pl()()()()()),n&2&&(kC("status-"+t.task().status),Ug("is-active",t.task().isActive)("is-selected",t.selected()),Tg("aria-label","Open task: "+t.task().name),XE(),eC(t.selectable()?1:-1),XE(),eC(t.task().starring.length>0?2:-1),XE(3),Yg(t.statusIcon()),XE(2),Yg(t.statusLabel()),XE(),eC(t.task().status==="waiting-you"?8:-1),XE(),eC(t.showProject()&&t.projectName()?9:-1),XE(2),vl(" ",t.task().name||"Unnamed task"," "),XE(),eC(t.task().summary?12:13),XE(4),Yg(t.formatRelativeTime(t.task().modifiedDate)),XE(2),eC(t.previewMode()?18:-1),XE(),eC(t.task().status==="in-progress"?19:-1),XE(),eC(t.task().status!=="done"?20:21),XE(2),Ug("starred",t.task().starring.length>0),bg("matTooltip",t.task().starring.length>0?"Unstar":"Star"),Tg("aria-label",t.task().starring.length>0?"Unstar task":"Star task"),XE(2),Yg(t.task().starring.length>0?"star":"star_border"),XE(),eC(t.isWorktree()?25:-1));},dependencies:[ve,ne,yt,wt,hr,Gn,Ve,ne$1],styles:['.glass-panel[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow)}.glass-interactive[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);transition:all .3s cubic-bezier(.4,0,.2,1)}.glass-interactive[_ngcontent-%COMP%]:hover{transform:translateY(-2px);box-shadow:0 12px 40px #00000026}.glass-interactive[_ngcontent-%COMP%]:active{transform:translateY(0)}.glass-card[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);border-radius:20px;padding:1.5rem}.glass-button[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);transition:all .3s cubic-bezier(.4,0,.2,1)}.glass-button[_ngcontent-%COMP%]:hover{transform:translateY(-2px);box-shadow:0 12px 40px #00000026}.glass-button[_ngcontent-%COMP%]:active{transform:translateY(0)}.glass-button[_ngcontent-%COMP%]{border-radius:12px;padding:.75rem 1.5rem;font-weight:600;cursor:pointer}.glass-button[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed;transform:none}.glass-button[_ngcontent-%COMP%]:disabled:hover{transform:none}.smooth-theme-transition[_ngcontent-%COMP%]{transition:background .3s ease,color .3s ease,border-color .3s ease,box-shadow .3s ease}[_nghost-%COMP%]{display:block}.task-card[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);border-radius:16px;padding:1.25rem;cursor:pointer;position:relative;overflow:hidden;transition:transform .2s cubic-bezier(.4,0,.2,1),box-shadow .2s cubic-bezier(.4,0,.2,1),border-color .2s ease;outline:none;display:flex;flex-direction:column;gap:.5rem;min-height:160px}.task-card[_ngcontent-%COMP%]:hover, .task-card[_ngcontent-%COMP%]:focus-visible{transform:translateY(-3px);box-shadow:0 16px 48px #00000026}.task-card[_ngcontent-%COMP%]:active{transform:translateY(-1px)}.task-card[_ngcontent-%COMP%]:before{content:"";position:absolute;left:0;top:0;bottom:0;width:4px;border-radius:16px 0 0 16px;background:var(--status-color, var(--color-text-secondary))}.task-card.status-waiting-you[_ngcontent-%COMP%]{--status-color: var(--color-error);border-color:#ff3b3040}.task-card.status-in-progress[_ngcontent-%COMP%]{--status-color: var(--color-warning);border-color:#ff950033}.task-card.status-done[_ngcontent-%COMP%]{--status-color: var(--color-success)}.task-card.status-paused[_ngcontent-%COMP%]{--status-color: var(--color-text-secondary)}.task-card.status-error[_ngcontent-%COMP%]{--status-color: var(--color-error)}.task-card.is-active[_ngcontent-%COMP%]{box-shadow:var(--glass-shadow),0 0 0 2px rgba(var(--color-primary),.3)}.selection-checkbox[_ngcontent-%COMP%]{position:absolute;right:.875rem;top:1.125rem;z-index:2}.task-card.is-selected[_ngcontent-%COMP%]{border-color:var(--color-primary);box-shadow:var(--glass-shadow),0 0 0 2px var(--color-primary)}.task-card.is-selected[_ngcontent-%COMP%]:before{background:var(--color-primary)}.starred-indicator[_ngcontent-%COMP%]{position:absolute;top:.75rem;right:.75rem;font-size:1rem;width:1rem;height:1rem;color:#f5a623;pointer-events:none}.status-badge[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;position:relative}.status-badge[_ngcontent-%COMP%] .status-icon[_ngcontent-%COMP%]{font-size:1rem;width:1rem;height:1rem;color:var(--status-color, var(--color-text-secondary))}.status-in-progress[_ngcontent-%COMP%] .status-badge[_ngcontent-%COMP%] .status-icon[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_spin 2s linear infinite}.status-badge[_ngcontent-%COMP%] .status-label[_ngcontent-%COMP%]{font-size:.7rem;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--status-color, var(--color-text-secondary))}.status-badge[_ngcontent-%COMP%] .pulse-ring[_ngcontent-%COMP%]{position:absolute;left:-2px;top:-2px;width:20px;height:20px;border-radius:50%;border:2px solid var(--color-error);animation:_ngcontent-%COMP%_pulse 1.5s ease-out infinite;pointer-events:none}.task-project[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.25rem;font-size:.72rem;font-weight:600;color:var(--color-primary);opacity:.8;text-transform:uppercase;letter-spacing:.04em}.task-project[_ngcontent-%COMP%] .project-icon[_ngcontent-%COMP%]{font-size:.75rem;width:.75rem;height:.75rem}.task-name[_ngcontent-%COMP%]{margin:0;font-size:.95rem;font-weight:600;color:var(--color-text);line-height:1.3;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.task-summary[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4;flex:1;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}.task-summary.empty[_ngcontent-%COMP%]{font-style:italic;opacity:.6}.task-footer[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;margin-top:auto;padding-top:.25rem}.task-time[_ngcontent-%COMP%]{font-size:.72rem;color:var(--color-text-secondary);opacity:.8}.task-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.task-card[_ngcontent-%COMP%]:hover .task-actions[_ngcontent-%COMP%], .task-card[_ngcontent-%COMP%]:focus-within .task-actions[_ngcontent-%COMP%]{opacity:1}.task-actions[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%]{width:28px;height:28px;display:flex!important;align-items:center!important;justify-content:center!important;padding:0!important}.task-actions[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1rem;width:1rem;height:1rem;display:flex;align-items:center;justify-content:center}.task-actions[_ngcontent-%COMP%] .stop-btn[_ngcontent-%COMP%]{color:var(--color-error)}.task-actions[_ngcontent-%COMP%] .mark-done-btn[_ngcontent-%COMP%]{color:var(--color-success)}.task-actions[_ngcontent-%COMP%] .star-btn[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.task-actions[_ngcontent-%COMP%] .star-btn.starred[_ngcontent-%COMP%]{color:#f5a623}.task-actions[_ngcontent-%COMP%] .delete-btn[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.task-actions[_ngcontent-%COMP%] .delete-btn[_ngcontent-%COMP%]:hover{color:var(--color-error)}.task-actions[_ngcontent-%COMP%] .open-btn[_ngcontent-%COMP%]{color:var(--color-primary)}.task-actions[_ngcontent-%COMP%] .open-btn[_ngcontent-%COMP%]:hover{color:var(--color-primary-hover)}@media(max-width:600px){.task-actions[_ngcontent-%COMP%]{opacity:1}.task-actions[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%]{width:36px;height:36px}.task-actions[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem}}@keyframes _ngcontent-%COMP%_spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes _ngcontent-%COMP%_pulse{0%{transform:scale(.8);opacity:1}to{transform:scale(2.2);opacity:0}}']})},Q={"waiting-you":"Waiting for you","in-progress":"In progress\u2026",done:"Done",paused:"Paused",error:"Error"},X={"waiting-you":"mark_unread_chat_alt","in-progress":"pending",done:"check_circle",paused:"pause_circle",error:"error"};var bt=300*1e3,kt={"waiting-you":0,"in-progress":1,done:2,paused:3,error:4};export{A,bt as b,kt as k};
|
|
1
|
+
import {cb as ZB,cc as qB,g,G as G$1,P,m as mT,e as xw,h as hr,j as Gn,k as ws,q as Rg,J as Jw,n as GC,o as pl,b$ as kC,A as Ug,T as Tg,X as XE,y as eC,a8 as Yg,a5 as vl,v as bg,a9 as lC,aa as If,ac as gC,ab as wf,S as Sg}from'./main-B65DSCU3.js';import {v as ve,n as ne}from'./chunk-C7W7wKW6.js';import {V as Ve,n as ne$1}from'./chunk-15VArnx4.js';import {y as yt,w as wt}from'./chunk-Cdc0NZ-7.js';function L(a,e){if(a&1){let n=lC();ws(0,"div",1)(1,"mat-checkbox",21),Rg("click",function(r){return r.stopPropagation()})("change",function(r){If(n);let i=gC();return wf(i.selectionChanged.emit({id:i.task().id,selected:r.checked}))}),pl()();}if(a&2){let n=gC();XE(),bg("checked",n.selected()),Tg("aria-label","Select task: "+n.task().name);}}function Y(a,e){a&1&&(ws(0,"mat-icon",2),GC(1,"star"),pl());}function W(a,e){a&1&&Sg(0,"span",6);}function U(a,e){if(a&1&&(ws(0,"div",7)(1,"mat-icon",22),GC(2,"folder"),pl(),ws(3,"span"),GC(4),pl()()),a&2){let n=gC();XE(4),Yg(n.projectName());}}function B(a,e){if(a&1&&(ws(0,"p",9),GC(1),pl()),a&2){let n=gC();XE(),Yg(n.task().summary);}}function $(a,e){a&1&&(ws(0,"p",10),GC(1,"No summary yet"),pl());}function H(a,e){if(a&1){let n=lC();ws(0,"button",23),Rg("click",function(r){If(n);let i=gC();return wf(i.onOpenDirect(r))}),ws(1,"mat-icon"),GC(2,"open_in_new"),pl()();}}function F(a,e){if(a&1){let n=lC();ws(0,"button",24),Rg("click",function(r){If(n);let i=gC();return wf(i.onStop(r))}),ws(1,"mat-icon"),GC(2,"stop_circle"),pl()();}}function G(a,e){if(a&1){let n=lC();ws(0,"button",25),Rg("click",function(r){If(n);let i=gC();return wf(i.onMarkDone(r))}),ws(1,"mat-icon"),GC(2,"check_circle_outline"),pl()();}}function K(a,e){if(a&1){let n=lC();ws(0,"button",26),Rg("click",function(r){If(n);let i=gC();return wf(i.onMarkActive(r))}),ws(1,"mat-icon"),GC(2,"replay"),pl()();}}function J(a,e){if(a&1){let n=lC();ws(0,"button",27),Rg("click",function(r){If(n);let i=gC();return wf(i.onCloseTask(r))}),ws(1,"mat-icon"),GC(2,"close_fullscreen"),pl()();}}var A=class a{task=ZB.required();projectNameOverride=ZB(null);showProject=ZB(false);previewMode=ZB(false);selectable=ZB(false);selected=ZB(false);stopRequested=qB();deleteRequested=qB();starToggled=qB();closeTaskRequested=qB();markDoneRequested=qB();markActiveRequested=qB();previewRequested=qB();selectionChanged=qB();router=g(G$1);projectState=g(P);projectName=mT(()=>this.projectNameOverride()??this.projectState.getSelectedProjectId());statusLabel=mT(()=>Q[this.task().status]);statusIcon=mT(()=>X[this.task().status]);isWorktree=mT(()=>!!this.task().worktreeProject);navigate(){if(this.previewMode()){this.previewRequested.emit(this.task().id);return}let e=this.projectName();e&&(this.projectState.selectProject(e),this.router.navigate(["project",e,"thread",this.task().id]));}onStop(e){e.stopPropagation(),this.stopRequested.emit(this.task().id);}onDelete(e){e.stopPropagation(),this.deleteRequested.emit(this.task().id);}onStarToggle(e){e.stopPropagation(),this.starToggled.emit(this.task().id);}onCloseTask(e){e.stopPropagation(),this.closeTaskRequested.emit(this.task().id);}onMarkDone(e){e.stopPropagation(),this.markDoneRequested.emit(this.task().id);}onMarkActive(e){e.stopPropagation(),this.markActiveRequested.emit(this.task().id);}onOpenDirect(e){e.stopPropagation();let n=this.projectName();n&&(this.projectState.selectProject(n),this.router.navigate(["project",n,"thread",this.task().id]));}formatRelativeTime(e){let n=Date.now()-new Date(e).getTime(),t=Math.floor(n/6e4);if(t<1)return "just now";if(t<60)return `${t} min ago`;let r=Math.floor(t/60);if(r<24)return `${r}h ago`;let i=Math.floor(r/24);return i===1?"yesterday":i<7?`${i} days ago`:new Date(e).toLocaleDateString("en",{day:"numeric",month:"short"})}static \u0275fac=function(n){return new(n||a)};static \u0275cmp=xw({type:a,selectors:[["app-task-card"]],inputs:{task:[1,"task"],projectNameOverride:[1,"projectNameOverride"],showProject:[1,"showProject"],previewMode:[1,"previewMode"],selectable:[1,"selectable"],selected:[1,"selected"]},outputs:{stopRequested:"stopRequested",deleteRequested:"deleteRequested",starToggled:"starToggled",closeTaskRequested:"closeTaskRequested",markDoneRequested:"markDoneRequested",markActiveRequested:"markActiveRequested",previewRequested:"previewRequested",selectionChanged:"selectionChanged"},decls:29,vars:25,consts:[["role","button","tabindex","0",1,"task-card",3,"click","keydown.enter","keydown.space"],[1,"selection-checkbox"],["aria-label","Starred",1,"starred-indicator"],[1,"status-badge"],[1,"status-icon"],[1,"status-label"],["aria-hidden","true",1,"pulse-ring"],[1,"task-project"],[1,"task-name"],[1,"task-summary"],[1,"task-summary","empty"],[1,"task-footer"],[1,"task-time"],[1,"task-actions"],["mat-icon-button","","matTooltip","Open full view","aria-label","Open task in full view",1,"action-btn","open-btn"],["mat-icon-button","","matTooltip","Stop agent","aria-label","Stop agent",1,"action-btn","stop-btn"],["mat-icon-button","","matTooltip","Mark as done","aria-label","Mark as done",1,"action-btn","mark-done-btn"],["mat-icon-button","","matTooltip","Mark as active","aria-label","Mark as active",1,"action-btn","mark-active-btn"],["mat-icon-button","",1,"action-btn","star-btn",3,"click","matTooltip"],["mat-icon-button","","matTooltip","Close task (removes worktree)","aria-label","Close task",1,"action-btn","close-task-btn"],["mat-icon-button","","matTooltip","Delete task","aria-label","Delete task",1,"action-btn","delete-btn",3,"click"],[3,"click","change","checked"],[1,"project-icon"],["mat-icon-button","","matTooltip","Open full view","aria-label","Open task in full view",1,"action-btn","open-btn",3,"click"],["mat-icon-button","","matTooltip","Stop agent","aria-label","Stop agent",1,"action-btn","stop-btn",3,"click"],["mat-icon-button","","matTooltip","Mark as done","aria-label","Mark as done",1,"action-btn","mark-done-btn",3,"click"],["mat-icon-button","","matTooltip","Mark as active","aria-label","Mark as active",1,"action-btn","mark-active-btn",3,"click"],["mat-icon-button","","matTooltip","Close task (removes worktree)","aria-label","Close task",1,"action-btn","close-task-btn",3,"click"]],template:function(n,t){n&1&&(ws(0,"article",0),Rg("click",function(){return t.navigate()})("keydown.enter",function(){return t.navigate()})("keydown.space",function(i){return t.navigate(),i.preventDefault()}),Jw(1,L,2,2,"div",1),Jw(2,Y,2,0,"mat-icon",2),ws(3,"div",3)(4,"mat-icon",4),GC(5),pl(),ws(6,"span",5),GC(7),pl(),Jw(8,W,1,0,"span",6),pl(),Jw(9,U,5,1,"div",7),ws(10,"h3",8),GC(11),pl(),Jw(12,B,2,1,"p",9)(13,$,2,0,"p",10),ws(14,"footer",11)(15,"span",12),GC(16),pl(),ws(17,"div",13),Jw(18,H,3,0,"button",14),Jw(19,F,3,0,"button",15),Jw(20,G,3,0,"button",16)(21,K,3,0,"button",17),ws(22,"button",18),Rg("click",function(i){return t.onStarToggle(i)}),ws(23,"mat-icon"),GC(24),pl()(),Jw(25,J,3,0,"button",19),ws(26,"button",20),Rg("click",function(i){return t.onDelete(i)}),ws(27,"mat-icon"),GC(28,"delete_outline"),pl()()()()()),n&2&&(kC("status-"+t.task().status),Ug("is-active",t.task().isActive)("is-selected",t.selected()),Tg("aria-label","Open task: "+t.task().name),XE(),eC(t.selectable()?1:-1),XE(),eC(t.task().starring.length>0?2:-1),XE(3),Yg(t.statusIcon()),XE(2),Yg(t.statusLabel()),XE(),eC(t.task().status==="waiting-you"?8:-1),XE(),eC(t.showProject()&&t.projectName()?9:-1),XE(2),vl(" ",t.task().name||"Unnamed task"," "),XE(),eC(t.task().summary?12:13),XE(4),Yg(t.formatRelativeTime(t.task().modifiedDate)),XE(2),eC(t.previewMode()?18:-1),XE(),eC(t.task().status==="in-progress"?19:-1),XE(),eC(t.task().status!=="done"?20:21),XE(2),Ug("starred",t.task().starring.length>0),bg("matTooltip",t.task().starring.length>0?"Unstar":"Star"),Tg("aria-label",t.task().starring.length>0?"Unstar task":"Star task"),XE(2),Yg(t.task().starring.length>0?"star":"star_border"),XE(),eC(t.isWorktree()?25:-1));},dependencies:[ve,ne,yt,wt,hr,Gn,Ve,ne$1],styles:['.glass-panel[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow)}.glass-interactive[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);transition:all .3s cubic-bezier(.4,0,.2,1)}.glass-interactive[_ngcontent-%COMP%]:hover{transform:translateY(-2px);box-shadow:0 12px 40px #00000026}.glass-interactive[_ngcontent-%COMP%]:active{transform:translateY(0)}.glass-card[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);border-radius:20px;padding:1.5rem}.glass-button[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);transition:all .3s cubic-bezier(.4,0,.2,1)}.glass-button[_ngcontent-%COMP%]:hover{transform:translateY(-2px);box-shadow:0 12px 40px #00000026}.glass-button[_ngcontent-%COMP%]:active{transform:translateY(0)}.glass-button[_ngcontent-%COMP%]{border-radius:12px;padding:.75rem 1.5rem;font-weight:600;cursor:pointer}.glass-button[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed;transform:none}.glass-button[_ngcontent-%COMP%]:disabled:hover{transform:none}.smooth-theme-transition[_ngcontent-%COMP%]{transition:background .3s ease,color .3s ease,border-color .3s ease,box-shadow .3s ease}[_nghost-%COMP%]{display:block}.task-card[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);border-radius:16px;padding:1.25rem;cursor:pointer;position:relative;overflow:hidden;transition:transform .2s cubic-bezier(.4,0,.2,1),box-shadow .2s cubic-bezier(.4,0,.2,1),border-color .2s ease;outline:none;display:flex;flex-direction:column;gap:.5rem;min-height:160px}.task-card[_ngcontent-%COMP%]:hover, .task-card[_ngcontent-%COMP%]:focus-visible{transform:translateY(-3px);box-shadow:0 16px 48px #00000026}.task-card[_ngcontent-%COMP%]:active{transform:translateY(-1px)}.task-card[_ngcontent-%COMP%]:before{content:"";position:absolute;left:0;top:0;bottom:0;width:4px;border-radius:16px 0 0 16px;background:var(--status-color, var(--color-text-secondary))}.task-card.status-waiting-you[_ngcontent-%COMP%]{--status-color: var(--color-error);border-color:#ff3b3040}.task-card.status-in-progress[_ngcontent-%COMP%]{--status-color: var(--color-warning);border-color:#ff950033}.task-card.status-done[_ngcontent-%COMP%]{--status-color: var(--color-success)}.task-card.status-paused[_ngcontent-%COMP%]{--status-color: var(--color-text-secondary)}.task-card.status-error[_ngcontent-%COMP%]{--status-color: var(--color-error)}.task-card.is-active[_ngcontent-%COMP%]{box-shadow:var(--glass-shadow),0 0 0 2px rgba(var(--color-primary),.3)}.selection-checkbox[_ngcontent-%COMP%]{position:absolute;right:.875rem;top:1.125rem;z-index:2}.task-card.is-selected[_ngcontent-%COMP%]{border-color:var(--color-primary);box-shadow:var(--glass-shadow),0 0 0 2px var(--color-primary)}.task-card.is-selected[_ngcontent-%COMP%]:before{background:var(--color-primary)}.starred-indicator[_ngcontent-%COMP%]{position:absolute;top:.75rem;right:.75rem;font-size:1rem;width:1rem;height:1rem;color:#f5a623;pointer-events:none}.status-badge[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;position:relative}.status-badge[_ngcontent-%COMP%] .status-icon[_ngcontent-%COMP%]{font-size:1rem;width:1rem;height:1rem;color:var(--status-color, var(--color-text-secondary))}.status-in-progress[_ngcontent-%COMP%] .status-badge[_ngcontent-%COMP%] .status-icon[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_spin 2s linear infinite}.status-badge[_ngcontent-%COMP%] .status-label[_ngcontent-%COMP%]{font-size:.7rem;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--status-color, var(--color-text-secondary))}.status-badge[_ngcontent-%COMP%] .pulse-ring[_ngcontent-%COMP%]{position:absolute;left:-2px;top:-2px;width:20px;height:20px;border-radius:50%;border:2px solid var(--color-error);animation:_ngcontent-%COMP%_pulse 1.5s ease-out infinite;pointer-events:none}.task-project[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.25rem;font-size:.72rem;font-weight:600;color:var(--color-primary);opacity:.8;text-transform:uppercase;letter-spacing:.04em}.task-project[_ngcontent-%COMP%] .project-icon[_ngcontent-%COMP%]{font-size:.75rem;width:.75rem;height:.75rem}.task-name[_ngcontent-%COMP%]{margin:0;font-size:.95rem;font-weight:600;color:var(--color-text);line-height:1.3;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.task-summary[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4;flex:1;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}.task-summary.empty[_ngcontent-%COMP%]{font-style:italic;opacity:.6}.task-footer[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;margin-top:auto;padding-top:.25rem}.task-time[_ngcontent-%COMP%]{font-size:.72rem;color:var(--color-text-secondary);opacity:.8}.task-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.task-card[_ngcontent-%COMP%]:hover .task-actions[_ngcontent-%COMP%], .task-card[_ngcontent-%COMP%]:focus-within .task-actions[_ngcontent-%COMP%]{opacity:1}.task-actions[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%]{width:28px;height:28px;display:flex!important;align-items:center!important;justify-content:center!important;padding:0!important}.task-actions[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1rem;width:1rem;height:1rem;display:flex;align-items:center;justify-content:center}.task-actions[_ngcontent-%COMP%] .stop-btn[_ngcontent-%COMP%]{color:var(--color-error)}.task-actions[_ngcontent-%COMP%] .mark-done-btn[_ngcontent-%COMP%]{color:var(--color-success)}.task-actions[_ngcontent-%COMP%] .star-btn[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.task-actions[_ngcontent-%COMP%] .star-btn.starred[_ngcontent-%COMP%]{color:#f5a623}.task-actions[_ngcontent-%COMP%] .delete-btn[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.task-actions[_ngcontent-%COMP%] .delete-btn[_ngcontent-%COMP%]:hover{color:var(--color-error)}.task-actions[_ngcontent-%COMP%] .open-btn[_ngcontent-%COMP%]{color:var(--color-primary)}.task-actions[_ngcontent-%COMP%] .open-btn[_ngcontent-%COMP%]:hover{color:var(--color-primary-hover)}@media(max-width:600px){.task-actions[_ngcontent-%COMP%]{opacity:1}.task-actions[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%]{width:36px;height:36px}.task-actions[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem}}@keyframes _ngcontent-%COMP%_spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes _ngcontent-%COMP%_pulse{0%{transform:scale(.8);opacity:1}to{transform:scale(2.2);opacity:0}}']})},Q={"waiting-you":"Waiting for you","in-progress":"In progress\u2026",done:"Done",paused:"Paused",error:"Error"},X={"waiting-you":"mark_unread_chat_alt","in-progress":"pending",done:"check_circle",paused:"pause_circle",error:"error"};var bt=300*1e3,kt={"waiting-you":0,"in-progress":1,done:2,paused:3,error:4};export{A,bt as b,kt as k};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {P}from'./chunk-
|
|
1
|
+
import {P}from'./chunk-CsE4KOo-.js';import {g,ao as V$1,G as G$1,C as Ce,da as M,aJ as Tr,a as Gi,bS as va,Q as By,a7 as ya,W as br,r as re,b as U$1,e as xw,aK as xb,k as ws,bf as aT,q as Rg,n as GC,o as pl,af as Eg,u as CC,v as bg,bg as uT,ah as rT,J as Jw,ac as gC,y as eC,a9 as lC,aa as If,ab as wf,ag as fT}from'./main-B65DSCU3.js';import {$ as $n}from'./chunk-BuHOxpR2.js';import'./chunk-15VArnx4.js';import'./chunk-Cdc0NZ-7.js';var U=()=>[];function V(i,t){if(i&1){let n=lC();ws(0,"agentos-agent-config-item",4),Rg("deleteRequested",function(o){If(n);let F=gC(2);return wf(F.deleteConfig(o))}),pl();}if(i&2){let n=gC().$implicit,e=gC();bg("config",t)("namespaceId",e.namespaceId)("readOnly",e.isPlatformConfig(n.id));}}function j(i,t){if(i&1&&Jw(0,V,1,3,"agentos-agent-config-item",3),i&2){let n,e=t.$implicit,o=gC();eC((n=o.resolveConfig(e.id))?0:-1,n);}}var G="namespace",K="platform",q=class i{route=g(V$1);router=g(G$1);destroyRef=g(Ce);agentConfigController=g(M);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Tr(void 0);isLoading=Gi(true);allConfigs$=this.refresh$.pipe(va(()=>(this.isLoading.set(true),By({namespace:this.agentConfigController.listByParentAgentConfig(this.namespaceId),platform:this.agentConfigController.listPlatformAgentsAgentConfig().pipe(ya(()=>br([])))}))));configItems$=this.allConfigs$.pipe(re(({namespace:t,platform:n})=>[...n.map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:K,groupLabel:"Platform (read-only)"})),...t.map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:G,groupLabel:"Namespace"}))]));namespaceConfigsById=new Map;platformConfigsById=new Map;constructor(){this.allConfigs$.pipe(U$1(this.destroyRef)).subscribe({next:({namespace:t,platform:n})=>{this.namespaceConfigsById=new Map(t.map(e=>[e.id??"",e])),this.platformConfigsById=new Map(n.map(e=>[e.id??"",e])),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}goBack(){this.router.navigate(["/agentos","namespaces"]);}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"agent-configs","new"]);}deleteConfig(t){this.agentConfigController.deleteAgentConfig(t.id??"").pipe(U$1(this.destroyRef)).subscribe(()=>this.refresh$.next());}resolveConfig(t){return this.namespaceConfigsById.get(t)??this.platformConfigsById.get(t)??null}isPlatformConfig(t){return this.platformConfigsById.has(t)}static \u0275fac=function(n){return new(n||i)};static \u0275cmp=xw({type:i,selectors:[["agentos-namespace-agent-configs"]],decls:6,vars:7,consts:[["agentConfigItemTpl",""],["title","Agent Configs","emptyMessage","No agent configs defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","type","button",1,"namespace-agent-configs__back",3,"click"],[3,"config","namespaceId","readOnly"],[3,"deleteRequested","config","namespaceId","readOnly"]],template:function(n,e){if(n&1&&(ws(0,"ds-entity-list",1),aT(1,"async"),Rg("createRequested",function(){return e.openCreateForm()}),ws(2,"button",2),Rg("click",function(){return e.goBack()}),GC(3," \u2190 Namespaces "),pl()(),Eg(4,j,1,1,"ng-template",null,0,fT)),n&2){let o=CC(5);bg("items",uT(1,4,e.configItems$)??rT(6,U))("loading",e.isLoading())("showCreate",true)("itemTemplate",o);}},dependencies:[$n,P,xb],styles:[".namespace-agent-configs__back[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.namespace-agent-configs__back[_ngcontent-%COMP%]:hover{text-decoration:underline}"]})};export{q as NamespaceAgentConfigsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {I}from'./chunk-
|
|
1
|
+
import {I}from'./chunk-I8N8a_Ey.js';import {m}from'./chunk-rB6dVrX3.js';import {g,ao as V$1,G as G$1,C as Ce,aJ as Tr,a as Gi,bS as va,Q as By,a7 as ya,W as br,r as re,b as U$1,e as xw,aK as xb,k as ws,bf as aT,q as Rg,n as GC,o as pl,af as Eg,u as CC,v as bg,bg as uT,ah as rT,J as Jw,ac as gC,y as eC,a9 as lC,aa as If,ab as wf,ag as fT}from'./main-B65DSCU3.js';import {$ as $n}from'./chunk-BuHOxpR2.js';import'./chunk-15VArnx4.js';import'./chunk-Cdc0NZ-7.js';import'./chunk-Csx_bIdU.js';var U=()=>[];function V(r,t){if(r&1){let o=lC();ws(0,"agentos-prompt-item",4),Rg("deleteRequested",function(n){If(o);let F=gC(2);return wf(F.deletePrompt(n))}),pl();}if(r&2){let o=gC().$implicit,e=gC();bg("prompt",t)("namespaceId",e.namespaceId)("readOnly",e.isPlatformPrompt(o.id));}}function j(r,t){if(r&1&&Jw(0,V,1,3,"agentos-prompt-item",3),r&2){let o,e=t.$implicit,n=gC();eC((o=n.resolvePrompt(e.id))?0:-1,o);}}var G="platform",K="namespace",A=class r{route=g(V$1);router=g(G$1);destroyRef=g(Ce);promptState=g(m);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Tr(void 0);isLoading=Gi(true);allPrompts$=this.refresh$.pipe(va(()=>(this.isLoading.set(true),By({platform:this.promptState.listPlatform().pipe(ya(()=>br([]))),namespace:this.promptState.listByNamespace(this.namespaceId)}))));promptItems$=this.allPrompts$.pipe(re(({platform:t,namespace:o})=>[...t.map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:G,groupLabel:"Platform (read-only)"})),...o.map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:K,groupLabel:"Namespace"}))]));namespacePromptsById=new Map;platformPromptsById=new Map;constructor(){this.allPrompts$.pipe(U$1(this.destroyRef)).subscribe({next:({platform:t,namespace:o})=>{this.platformPromptsById=new Map(t.map(e=>[e.id??"",e])),this.namespacePromptsById=new Map(o.map(e=>[e.id??"",e])),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}goBack(){this.router.navigate(["/agentos","namespaces"]);}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"prompts","new"]);}deletePrompt(t){this.promptState.delete(t.id??"").pipe(U$1(this.destroyRef)).subscribe(()=>this.refresh$.next());}resolvePrompt(t){return this.platformPromptsById.get(t)??this.namespacePromptsById.get(t)??null}isPlatformPrompt(t){return this.platformPromptsById.has(t)}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=xw({type:r,selectors:[["agentos-namespace-prompts"]],decls:6,vars:7,consts:[["promptItemTpl",""],["title","Prompts","emptyMessage","No prompts defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","type","button",1,"namespace-prompts__back",3,"click"],[3,"prompt","namespaceId","readOnly"],[3,"deleteRequested","prompt","namespaceId","readOnly"]],template:function(o,e){if(o&1&&(ws(0,"ds-entity-list",1),aT(1,"async"),Rg("createRequested",function(){return e.openCreateForm()}),ws(2,"button",2),Rg("click",function(){return e.goBack()}),GC(3,"\u2190 Namespaces"),pl()(),Eg(4,j,1,1,"ng-template",null,0,fT)),o&2){let n=CC(5);bg("items",uT(1,4,e.promptItems$)??rT(6,U))("loading",e.isLoading())("showCreate",true)("itemTemplate",n);}},dependencies:[$n,I,xb],styles:[".namespace-prompts__back[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.namespace-prompts__back[_ngcontent-%COMP%]:hover{text-decoration:underline}"]})};export{A as NamespacePromptsComponent};
|