@whoz-oss/coday-client 3.17.0 → 3.18.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--yaU4Sri.js +1 -0
- package/browser/{chunk-ClSDInQq.js → chunk-4uEZjTft.js} +1 -1
- package/browser/chunk-4v7WiOTx.js +1 -0
- package/browser/chunk-B-UKlpjJ.js +1 -0
- package/browser/chunk-B13_C_P9.js +675 -0
- package/browser/chunk-B17Inq8D.js +2 -0
- package/browser/chunk-B1vuv-dv.js +1 -0
- package/browser/{chunk-DqC8XT4v.js → chunk-BEdQqXxw.js} +1 -1
- package/browser/{chunk-DMtXGu5h.js → chunk-BGTRsbsl.js} +1 -1
- package/browser/{chunk-DHb3-uKf.js → chunk-BHiaH1Jm.js} +1 -1
- package/browser/chunk-BJld3zB5.js +9 -0
- package/browser/{chunk-BPfJALqU.js → chunk-BVmICoo4.js} +1 -1
- package/browser/chunk-BXCHG0wB.js +1 -0
- package/browser/{chunk-LVItL87L.js → chunk-B_Sx6nwb.js} +1 -1
- package/browser/{chunk-D202v_ff.js → chunk-BbPMe8u2.js} +1 -1
- package/browser/{chunk-Bu5Xq3QT.js → chunk-Bb_J3EoX.js} +1 -1
- package/browser/{chunk-BkN5jb4J.js → chunk-BfE6wTUj.js} +1 -1
- package/browser/chunk-Bnj9Hkqy.js +276 -0
- package/browser/chunk-BqWEyotW.js +55 -0
- package/browser/{chunk-BXkvjekT.js → chunk-Buu9Jf-V.js} +2 -2
- package/browser/{chunk-Brx_KbnM.js → chunk-CJAdjOmi.js} +1 -1
- package/browser/{chunk-DjoW6kqa.js → chunk-CJEW8Ogd.js} +5 -5
- package/browser/chunk-CM1_Z4h5.js +1 -0
- package/browser/{chunk-Bgd8Jkga.js → chunk-CP3b1EMm.js} +1 -1
- package/browser/chunk-CR817PBg.js +1 -0
- package/browser/{chunk-bfpuueWC.js → chunk-CXgj_KJY.js} +3 -3
- package/browser/{chunk-CxUcyBb9.js → chunk-CakkML6n.js} +1 -1
- package/browser/{chunk-mrKeqPKc.js → chunk-CfPmQ0Fw.js} +1 -1
- package/browser/chunk-CgNkwpQ7.js +508 -0
- package/browser/chunk-Cjk-zAXy.js +1 -0
- package/browser/chunk-ClCDsg8D.js +5 -0
- package/browser/{chunk-CKhGzoqa.js → chunk-CmyT-Z4A.js} +1 -1
- package/browser/{chunk-EBW8PloQ.js → chunk-CqJ7rGVY.js} +1 -1
- package/browser/{chunk-Ci9l-k84.js → chunk-CxpHnwnx.js} +1 -1
- package/browser/{chunk-DFQuWS_F.js → chunk-D1ZnLng-.js} +1 -1
- package/browser/{chunk-DO3lSvop.js → chunk-D26Y186i.js} +1 -1
- package/browser/chunk-D2zGvbD2.js +190 -0
- package/browser/{chunk-DKllQ3Ve.js → chunk-D30bRRTP.js} +1 -1
- package/browser/{chunk-DQtoh8wv.js → chunk-D4dmZgr6.js} +1 -1
- package/browser/{chunk-b6g-uBR5.js → chunk-D6nkbOg1.js} +1 -1
- package/browser/chunk-D8nXP3jN.js +2 -0
- package/browser/{chunk-CUz5MHdA.js → chunk-D92adUD_.js} +1 -1
- package/browser/{chunk-BtEXE3Xz.js → chunk-DDu5Ufv3.js} +1 -1
- package/browser/{chunk-C5WD0UQE.js → chunk-DFjZf9oL.js} +3 -3
- package/browser/{chunk-B626-rya.js → chunk-DJjbZAaS.js} +1 -1
- package/browser/{chunk-B1OTuTxt.js → chunk-DKQvH1hP.js} +1 -1
- package/browser/{chunk-BHvLB-pV.js → chunk-DMUiJ7oP.js} +1 -1
- package/browser/chunk-DMyGIjcZ.js +1 -0
- package/browser/chunk-DOHvMo5p.js +1 -0
- package/browser/{chunk-ClEmA_ih.js → chunk-DVTNoWCQ.js} +1 -1
- package/browser/chunk-DV_7IOl_.js +1 -0
- package/browser/chunk-DaoWXYMw.js +1 -0
- package/browser/{chunk-B7kKWG4P.js → chunk-DmaEv05C.js} +1 -1
- package/browser/{chunk-CpZK7G-Q.js → chunk-DoqL_RuM.js} +2 -2
- package/browser/chunk-FMHkoXwM.js +37 -0
- package/browser/{chunk-CXTwGKdl.js → chunk-Fr6-w83-.js} +1 -1
- package/browser/{chunk-DxrynR3o.js → chunk-HHPhxe9B.js} +1 -1
- package/browser/{chunk-DpHEu7EG.js → chunk-IYMfBoNU.js} +1 -1
- package/browser/chunk-PQu4_Hy2.js +2 -0
- package/browser/chunk-Qpb04pBJ.js +1 -0
- package/browser/{chunk-BVAD9f9s.js → chunk-W5DNK5PC.js} +1 -1
- package/browser/{chunk-B6BZBDSv.js → chunk-WSA7xa0h.js} +5 -5
- package/browser/{chunk-D-jBfPIO.js → chunk-lX2E6ugr.js} +1 -1
- package/browser/{chunk-C2VdQfMJ.js → chunk-o2LY9dfG.js} +1 -1
- package/browser/{chunk-CI760KmO.js → chunk-py_Q_oQH.js} +1 -1
- package/browser/{chunk-DCwEaE_b.js → chunk-t87lD8bQ.js} +1 -1
- package/browser/{chunk-B3-4EW3s.js → chunk-vL7dLM7S.js} +1 -1
- package/browser/{chunk-CI7wYBKk.js → chunk-zvR-rokl.js} +1 -1
- package/browser/index.html +1 -1
- package/browser/main-YYHD6X7H.js +1811 -0
- package/package.json +1 -1
- package/browser/chunk-0njD_aMa.js +0 -2
- package/browser/chunk-6WIaUDav.js +0 -1
- package/browser/chunk-B7yga-a4.js +0 -1
- package/browser/chunk-BAWubWk8.js +0 -1
- package/browser/chunk-BDaTUrH4.js +0 -1
- package/browser/chunk-BJ5G7Y-a.js +0 -276
- package/browser/chunk-BTX631I3.js +0 -5
- package/browser/chunk-BYyTBqh4.js +0 -37
- package/browser/chunk-B_49KV6W.js +0 -1
- package/browser/chunk-BaO2vi_O.js +0 -675
- package/browser/chunk-BcT0wYqu.js +0 -2
- package/browser/chunk-BdJzYh5V.js +0 -190
- package/browser/chunk-BwDJA6_r.js +0 -55
- package/browser/chunk-C49BBPGm.js +0 -1
- package/browser/chunk-CNAj5Eon.js +0 -1
- package/browser/chunk-DMRb150M.js +0 -2
- package/browser/chunk-DjMtxVWg.js +0 -508
- package/browser/chunk-DqioJb1X.js +0 -1
- package/browser/chunk-DrzvCb86.js +0 -1
- package/browser/chunk-DwFGK2iu.js +0 -1
- package/browser/chunk-DxvmpOv5.js +0 -1
- package/browser/chunk-P8B5rz7L.js +0 -1
- package/browser/chunk-R-GmZrHu.js +0 -9
- package/browser/main-LBRSRTYI.js +0 -1811
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {v}from'./chunk-B_49KV6W.js';import {R,q,J}from'./chunk-BAWubWk8.js';import {g,ao as V,G,w as we,a as Gi,F,E as ET,cd as Uf,c as U,z as z$1,b as P$1,h as Fw,m as ws,o as Rg,Q as QC,n as hl,q as oC,t as nI,a8 as Yg,x as iC,a9 as gC,r as cC,a4 as aC,a3 as GI,S as Sg,ac as EC,v as bg,a6 as qI,y as uC,a5 as Dl,cH as nC,aa as wf,ab as Cf,b$ as BC,T as Tg}from'./main-LBRSRTYI.js';import'./chunk-R-GmZrHu.js';import {k as _t,b as _e$1,o as z,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,A as At,m as mn,Z as Zn,l as Xn,C as Cn,E as En}from'./chunk-BYyTBqh4.js';import'./chunk-BDaTUrH4.js';import'./chunk-ClSDInQq.js';import'./chunk-BaO2vi_O.js';import'./chunk-DjMtxVWg.js';function se(i,t){i&1&&(ws(0,"p",5),QC(1,"Loading\u2026"),hl());}function ce(i,t){if(i&1&&(ws(0,"label",23),Sg(1,"input",24),GI(),ws(2,"span"),QC(3),hl()()),i&2){let e=t.$implicit,o=EC(3);nI(),bg("formControl",o.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!o.isAdmin()),qI(),nI(2),Yg(e.label);}}function de(i,t){if(i&1&&(ws(0,"fieldset",8)(1,"legend",22),QC(2,"Configuration scope"),hl(),cC(3,ce,4,4,"label",23,nC().trackByScope,true),hl()),i&2){let e=EC(2);bg("disabled",e.isEditMode()),nI(3),uC(e.scopeOptions);}}function ue(i,t){if(i&1&&(ws(0,"option",13),QC(1),hl()),i&2){let e=t.$implicit,o=EC(2);bg("value",e),nI(),Yg(o.authTypeLabel[e]);}}function pe(i,t){i&1&&QC(0," Leave a field unchanged to keep the stored credential. ");}function he(i,t){i&1&&(ws(0,"span",11),QC(1,"*"),hl());}function me(i,t){if(i&1&&(ws(0,"p",28),QC(1),hl()),i&2){let e=EC(2).$implicit;bg("id","as-hint-"+e.key),nI(),Yg(e.hint);}}function ge(i,t){if(i&1&&(Sg(0,"input",27),GI(),oC(1,me,2,2,"p",28)),i&2){let e=EC().$implicit;BC("auth-setting-form__input"+(e.secret?" auth-setting-form__input--secret":"")),bg("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),Tg("aria-describedby",e.hint?"as-hint-"+e.key:null),qI(),nI(),iC(e.hint?1:-1);}}function Ce(i,t){if(i&1&&(ws(0,"div",9)(1,"label",26),QC(2),oC(3,he,2,0,"span",11),hl(),oC(4,ge,2,9),hl()),i&2){let e,o=t.$implicit,l=EC(3);nI(),bg("for","as-cred-"+o.key),nI(),Dl(" ",o.label," "),nI(),iC(o.required?3:-1),nI(),iC((e=l.controlForField(o.key))?4:-1,e);}}function fe(i,t){if(i&1&&(ws(0,"fieldset",18)(1,"legend",22),QC(2,"Credentials"),hl(),ws(3,"p",25),QC(4," Values are stored encrypted and masked on read. "),oC(5,pe,1,0),hl(),cC(6,Ce,5,4,"div",9,nC().trackByField,true),hl()),i&2){let e=EC(2);nI(5),iC(e.isEditMode()?5:-1),nI(),uC(e.credentialFields());}}function ye(i,t){if(i&1){let e=gC();ws(0,"form",7),Rg("ngSubmit",function(){wf(e);let l=EC();return Cf(l.submit())}),oC(1,de,5,1,"fieldset",8),ws(2,"div",9)(3,"label",10),QC(4,"Auth type "),ws(5,"span",11),QC(6,"*"),hl()(),ws(7,"select",12),cC(8,ue,2,2,"option",13,aC),hl(),GI(),hl(),ws(10,"div",9)(11,"label",14),QC(12,"Name "),ws(13,"span",11),QC(14,"*"),hl()(),Sg(15,"input",15),GI(),hl(),ws(16,"div",9)(17,"label",16),QC(18,"Description"),hl(),Sg(19,"input",17),GI(),hl(),oC(20,fe,8,1,"fieldset",18),ws(21,"div",19)(22,"button",20),QC(23),hl(),ws(24,"button",21),Rg("click",function(){wf(e);let l=EC();return Cf(l.cancel())}),QC(25,"Cancel"),hl()()();}if(i&2){let e=EC();bg("formGroup",e.form),nI(),iC(e.isPlatformMode?-1:1),nI(6),bg("formControl",e.authTypeControl),qI(),nI(),uC(e.authTypeOptions),nI(7),bg("formControl",e.nameControl),qI(),nI(4),bg("formControl",e.descriptionControl),qI(),nI(),iC(e.credentialFields().length>0?20:-1),nI(2),bg("disabled",e.form.invalid||e.isSubmitting()),nI(),Dl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var _e=new Set(["namespace","userOnNs","userGlobal"]),P=Object.freeze({platform:"Platform (read-only)",namespace:"Namespace configuration",userOnNs:"Personal \u2014 this namespace only",userGlobal:"Personal \u2014 all namespaces"}),Se={ApiKeyAuthSetting:[{key:"apiKey",label:"API Key",placeholder:"sk-\u2026",secret:true,required:false}],BasicAuthAuthSetting:[{key:"username",label:"Username",placeholder:"user@example.com",secret:false,required:false},{key:"password",label:"Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",secret:true,required:false}],BearerTokenAuthSetting:[{key:"token",label:"Bearer token",placeholder:"eyJ\u2026",secret:true,required:false}],OAuthDiscoverableAuthSetting:[{key:"discoveryUrl",label:"Discovery URL",placeholder:"https://\u2026/.well-known/openid-configuration",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthCustomAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthRegisteredAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthMcpDiscoverableAuthSetting:[{key:"resourceUrl",label:"Resource URL",placeholder:"https://mcp.example.com",hint:"Use the base URL exactly as documented by your provider \u2014 do not append a path suffix. Examples: https://mcp.hubspot.com (HubSpot), https://mcp.atlassian.com/v1/mcp (Atlassian).",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",hint:"Leave empty to let the server register an OAuth client automatically (RFC 7591 dynamic registration). Fill in only if you have a pre-registered client ID from your provider.",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Leave empty in most cases \u2014 the MCP server declares the required scopes itself. Fill in only if your provider explicitly requires client-declared scopes.",secret:false,required:false}]},le=class i{route=g(V);router=g(G);destroyRef=g(we);state=g(R);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?Gi(true):F(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});authTypeOptions=q;authTypeLabel=J;scopeOptions=[{value:"namespace",label:P.namespace},{value:"userOnNs",label:P.userOnNs},{value:"userGlobal",label:P.userGlobal}];nameControl=new _t("",{nonNullable:true,validators:[_e$1.required,_e$1.minLength(1)]});descriptionControl=new _t(null);authTypeControl=new _t("ApiKeyAuthSetting",{nonNullable:true,validators:[_e$1.required]});scopeControl=new _t("namespace",{nonNullable:true});form=new z({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new _t("",{nonNullable:true});usernameControl=new _t("",{nonNullable:true});passwordControl=new _t("",{nonNullable:true});tokenControl=new _t("",{nonNullable:true});discoveryUrlControl=new _t("",{nonNullable:true});authorizationUrlControl=new _t("",{nonNullable:true});tokenUrlControl=new _t("",{nonNullable:true});clientIdControl=new _t("",{nonNullable:true});clientSecretControl=new _t("",{nonNullable:true});scopesControl=new _t("",{nonNullable:true});resourceUrlControl=new _t("",{nonNullable:true});selectedAuthType=F(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=ET(()=>Se[this.selectedAuthType()]);isEditMode=Gi(false);isSubmitting=Gi(false);isLoading=Gi(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||Uf(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,o=t.get("authSettingId");if(o){this.isEditMode.set(true),this.scopeControl.disable(),this.authTypeControl.disable(),this.loadConfig(o);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable();return}let l=this.parseScope(e.get("scope"));this.scopeControl.setValue(l);let v=e.get("template");v&&this.hydrateFromTemplate(v);}parseScope(t){return t&&_e.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,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AuthSettingForm] Could not load auth setting '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.authTypeControl.setValue(e.authType),this.clearCredentialControls(),this.initialCredentials={},this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AuthSettingForm] 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){switch(this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.authTypeControl.setValue(t.authType),this.clearCredentialControls(),this.initialCredentials={},t.authType){case "ApiKeyAuthSetting":{let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialCredentials.apiKey=e;break}case "BasicAuthAuthSetting":{let e=t,o=e.username??"",l=e.password??"";this.usernameControl.setValue(o),this.passwordControl.setValue(l),this.initialCredentials.username=o,this.initialCredentials.password=l;break}case "BearerTokenAuthSetting":{let e=t.token??"";this.tokenControl.setValue(e),this.initialCredentials.token=e;break}case "OAuthDiscoverableAuthSetting":{let e=t;this.discoveryUrlControl.setValue(e.discoveryUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.discoveryUrl=e.discoveryUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthCustomAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthRegisteredAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthMcpDiscoverableAuthSetting":{let e=t;this.resourceUrlControl.setValue(e.resourceUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.resourceUrl=e.resourceUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}}}clearCredentialControls(){this.apiKeyControl.setValue(""),this.usernameControl.setValue(""),this.passwordControl.setValue(""),this.tokenControl.setValue(""),this.discoveryUrlControl.setValue(""),this.authorizationUrlControl.setValue(""),this.tokenUrlControl.setValue(""),this.clientIdControl.setValue(""),this.clientSecretControl.setValue(""),this.scopesControl.setValue(""),this.resourceUrlControl.setValue("");}credentialValue(t,e){if(!(this.isEditMode()&&e===this.initialCredentials[t]))return e||void 0}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.nameControl.value.trim(),e=this.descriptionControl.value?.trim()||void 0,o=this.authTypeControl.value,l=this.form.getRawValue().scope,v=this.isPlatformMode?null:this.namespaceId??null,w=this.buildTypedPayload(o,t,e);(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,w,this.existingConfig):this.state.create(w,l,v)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}buildTypedPayload(t,e,o){let l={name:e,description:o};switch(t){case "ApiKeyAuthSetting":return z$1(P$1({},l),{authType:"ApiKeyAuthSetting",apiKey:this.credentialValue("apiKey",this.apiKeyControl.value)});case "BasicAuthAuthSetting":return z$1(P$1({},l),{authType:"BasicAuthAuthSetting",username:this.credentialValue("username",this.usernameControl.value),password:this.credentialValue("password",this.passwordControl.value)});case "BearerTokenAuthSetting":return z$1(P$1({},l),{authType:"BearerTokenAuthSetting",token:this.credentialValue("token",this.tokenControl.value)});case "OAuthDiscoverableAuthSetting":return z$1(P$1({},l),{authType:"OAuthDiscoverableAuthSetting",discoveryUrl:this.credentialValue("discoveryUrl",this.discoveryUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthCustomAuthSetting":return z$1(P$1({},l),{authType:"OAuthCustomAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthRegisteredAuthSetting":return z$1(P$1({},l),{authType:"OAuthRegisteredAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthMcpDiscoverableAuthSetting":return z$1(P$1({},l),{authType:"OAuthMcpDiscoverableAuthSetting",resourceUrl:this.credentialValue("resourceUrl",this.resourceUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)})}}controlForField(t){return {apiKey:this.apiKeyControl,username:this.usernameControl,password:this.passwordControl,token:this.tokenControl,discoveryUrl:this.discoveryUrlControl,authorizationUrl:this.authorizationUrlControl,tokenUrl:this.tokenUrlControl,clientId:this.clientIdControl,clientSecret:this.clientSecretControl,scopes:this.scopesControl,resourceUrl:this.resourceUrlControl}[t]}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","auth-settings"]):this.router.navigate(["/agentos",this.namespaceId,"auth-settings"]);}trackByScope(t,e){return e.value}trackByField(t,e){return e.key}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=Fw({type:i,selectors:[["agentos-auth-setting-form"]],decls:10,vars:2,consts:[[1,"auth-setting-form"],[1,"auth-setting-form__header"],["type","button","title","Back to auth settings",1,"auth-setting-form__back",3,"click"],[1,"auth-setting-form__back-icon"],[1,"auth-setting-form__title"],[1,"auth-setting-form__loading"],[1,"auth-setting-form__form",3,"formGroup"],[1,"auth-setting-form__form",3,"ngSubmit","formGroup"],[1,"auth-setting-form__scope",3,"disabled"],[1,"auth-setting-form__field"],["for","as-auth-type",1,"auth-setting-form__label"],["aria-hidden","true"],["id","as-auth-type",1,"auth-setting-form__select",3,"formControl"],[3,"value"],["for","as-name",1,"auth-setting-form__label"],["id","as-name","type","text","placeholder","e.g. GitHub OAuth App","autocomplete","off",1,"auth-setting-form__input",3,"formControl"],["for","as-description",1,"auth-setting-form__label"],["id","as-description","type","text","placeholder","Optional \u2014 short description of this auth setting","autocomplete","off",1,"auth-setting-form__input",3,"formControl"],[1,"auth-setting-form__credentials"],[1,"auth-setting-form__actions"],["type","submit",1,"auth-setting-form__btn","auth-setting-form__btn--primary",3,"disabled"],["type","button",1,"auth-setting-form__btn",3,"click"],[1,"auth-setting-form__label"],[1,"auth-setting-form__scope-option"],["type","radio",3,"formControl","value","disabled"],[1,"auth-setting-form__credentials-hint"],[1,"auth-setting-form__label",3,"for"],[3,"id","type","placeholder","formControl","autocomplete"],[1,"auth-setting-form__field-hint",3,"id"]],template:function(e,o){e&1&&(ws(0,"div",0)(1,"header",1)(2,"button",2),Rg("click",function(){return o.cancel()}),ws(3,"span",3),QC(4,"\u2190"),hl(),QC(5," Auth Settings "),hl(),ws(6,"h1",4),QC(7),hl()(),oC(8,se,2,0,"p",5)(9,ye,26,8,"form",6),hl()),e&2&&(nI(7),Yg(o.isEditMode()?"Edit auth setting":"New auth setting"),nI(),iC(o.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,At,mn,Zn,Xn,Cn,En],styles:[".auth-setting-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem;padding:1.5rem;max-width:640px}.auth-setting-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.auth-setting-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.4rem;background:none;border:none;cursor:pointer;color:var(--color-text-secondary);font-size:.85rem;padding:0}.auth-setting-form__back[_ngcontent-%COMP%]:hover{color:var(--color-primary)}.auth-setting-form__back-icon[_ngcontent-%COMP%]{font-size:1rem}.auth-setting-form__title[_ngcontent-%COMP%]{font-size:1.4rem;font-weight:600;color:var(--color-text);margin:0}.auth-setting-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem}.auth-setting-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.auth-setting-form__scope[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:8px;padding:.75rem 1rem;display:flex;flex-direction:column;gap:.5rem}.auth-setting-form__scope[_ngcontent-%COMP%] legend[_ngcontent-%COMP%]{padding:0 .25rem}.auth-setting-form__scope-option[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;font-size:.9rem;color:var(--color-text)}.auth-setting-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem}.auth-setting-form__field-hint[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);margin:0;line-height:1.4}.auth-setting-form__label[_ngcontent-%COMP%]{font-size:.85rem;font-weight:500;color:var(--color-text-secondary)}.auth-setting-form__input[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem .75rem;background:var(--color-bg-secondary);color:var(--color-text);font-size:.9rem;outline:none;transition:border-color .15s ease;width:100%;box-sizing:border-box}.auth-setting-form__input[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.auth-setting-form__input--secret[_ngcontent-%COMP%]{font-family:monospace;letter-spacing:.05em}.auth-setting-form__select[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem .75rem;background:var(--color-bg-secondary);color:var(--color-text);font-size:.9rem;outline:none;cursor:pointer;transition:border-color .15s ease}.auth-setting-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.auth-setting-form__credentials[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:8px;padding:.75rem 1rem 1rem;display:flex;flex-direction:column;gap:.75rem;margin:0}.auth-setting-form__credentials[_ngcontent-%COMP%] legend[_ngcontent-%COMP%]{padding:0 .25rem}.auth-setting-form__credentials-hint[_ngcontent-%COMP%]{font-size:.78rem;color:var(--color-text-secondary);margin:0}.auth-setting-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;align-items:center;padding-top:.5rem}.auth-setting-form__btn[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem 1.25rem;cursor:pointer;font-size:.9rem;font-weight:500;background:var(--color-bg-secondary);color:var(--color-text);transition:background .15s ease}.auth-setting-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover)}.auth-setting-form__btn[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.auth-setting-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-on-primary, #fff);border-color:var(--color-primary)}.auth-setting-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, var(--color-primary))}"]})};
|
|
2
|
-
export{le as AuthSettingFormComponent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {N}from'./chunk-B3-4EW3s.js';import {g,ao as V,G,w as we,d8 as M,dl as G$1,d6 as F,a as Gi,W as Vy,X as br,c as U,u as ue$1,a7 as va,z as z$1,b as P,h as Fw,s as si,m as ws,o as Rg,Q as QC,n as hl,q as oC,t as nI,a8 as Yg,x as iC,ac as EC,v as bg,a9 as gC,S as Sg,a3 as GI,a6 as qI,a5 as Dl,r as cC,y as uC,bo as sC,aa as wf,ab as Cf,T as Tg}from'./main-LBRSRTYI.js';import'./chunk-R-GmZrHu.js';import {o as z,k as _t,b as _e$1,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,a as wt,Z as Zn,l as Xn,C as Cn,E as En}from'./chunk-BYyTBqh4.js';import'./chunk-BDaTUrH4.js';import'./chunk-ClSDInQq.js';import'./chunk-BaO2vi_O.js';import'./chunk-DjMtxVWg.js';var le=(r,t)=>t.config.id,ce=(r,t)=>t.type;function ge(r,t){if(r&1&&(ws(0,"a",5),QC(1,"View resolved definition \u2192"),hl()),r&2){let e=EC();bg("routerLink",e.inspectRoute());}}function se(r,t){r&1&&(ws(0,"span",6),QC(1,"Platform level"),hl());}function de(r,t){r&1&&(ws(0,"p",7),QC(1,"Loading\u2026"),hl());}function me(r,t){if(r&1&&(ws(0,"span",41),QC(1),hl()),r&2){let e=EC().$implicit;nI(),Yg(e.config.integrationType);}}function fe(r,t){if(r&1&&(Sg(0,"input",42),GI()),r&2){let e=EC().$implicit;bg("formControl",e.toolsControl),qI();}}function pe(r,t){if(r&1){let e=gC();ws(0,"div",37)(1,"label",38)(2,"input",39),Rg("change",function(){let l=wf(e).$implicit,g=EC(3);return Cf(g.toggleIntegration(l))}),hl(),ws(3,"span",40),QC(4),hl(),oC(5,me,2,1,"span",41),hl(),oC(6,fe,1,1,"input",42),hl();}if(r&2){let e=t.$implicit;nI(2),bg("checked",e.enabled()),nI(2),Yg(e.config.name),nI(),iC(e.config.integrationType?5:-1),nI(),iC(e.enabled()?6:-1);}}function _e(r,t){if(r&1&&(ws(0,"p",48),QC(1),hl()),r&2){let e=EC().$implicit;nI(),Dl(" Restricted to: ",e.restrictedTools.join(", ")," (set outside this form, preserved on save) ");}}function ue(r,t){if(r&1){let e=gC();ws(0,"div",37)(1,"label",38)(2,"span",40),QC(3),hl(),ws(4,"span",41),QC(5,"built-in"),hl()(),ws(6,"select",44),Rg("change",function(l){let g=wf(e).$implicit,m=EC(4);return Cf(m.setBuiltInState(g,l.target.value))}),ws(7,"option",45),QC(8),hl(),ws(9,"option",46),QC(10,"Enabled"),hl(),ws(11,"option",47),QC(12,"Disabled"),hl()(),oC(13,_e,2,1,"p",48),ws(14,"p",49),QC(15),hl()();}if(r&2){let e=t.$implicit,o=EC(4);nI(),Tg("for","built-in-"+e.type),nI(2),Yg(e.displayName),nI(3),bg("id","built-in-"+e.type)("value",e.state()),nI(2),Yg(o.builtInDefaultLabel(e)),nI(5),iC(e.state()==="on"&&e.restrictedTools?13:-1),nI(2),Yg(e.description);}}function be(r,t){if(r&1&&(ws(0,"p",43),QC(1,"Built-in integrations"),hl(),cC(2,ue,16,7,"div",37,ce)),r&2){let e=EC(3);nI(2),uC(e.builtInRows());}}function Ce(r,t){if(r&1&&(ws(0,"fieldset",20)(1,"legend",25),QC(2,"Integrations"),hl(),ws(3,"p",36),QC(4," Select which integrations this agent can use. Leave tool names empty to allow all tools from an integration. "),hl(),cC(5,pe,7,4,"div",37,le),oC(7,be,4,0),hl()),r&2){let e=EC(2);nI(5),uC(e.integrationRows()),nI(2),iC(e.builtInRows().length>0?7:-1);}}function xe(r,t){if(r&1){let e=gC();ws(0,"li",50),Sg(1,"input",51),GI(),ws(2,"button",52),Rg("click",function(){let l=wf(e).$implicit,g=EC(3);return Cf(g.removeSubAgent(l))}),QC(3," \u{1F5D1} "),hl()();}if(r&2){let e=t.$implicit;nI(),bg("formControl",e.control),qI();}}function ye(r,t){if(r&1&&(ws(0,"ul",28),cC(1,xe,4,1,"li",50,sC),hl()),r&2){let e=EC(2);nI(),uC(e.subAgentRows());}}function he(r,t){if(r&1){let e=gC();ws(0,"button",53),Rg("click",function(){wf(e);let l=EC(2);return Cf(l.exportYaml())}),QC(1),hl();}if(r&2){let e=EC(2);bg("disabled",e.isExporting()),nI(),Dl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function ve(r,t){if(r&1){let e=gC();ws(0,"form",9),Rg("ngSubmit",function(){wf(e);let l=EC();return Cf(l.submit())}),ws(1,"div",10)(2,"label",11),QC(3,"Name "),ws(4,"span",12),QC(5,"*"),hl()(),Sg(6,"input",13),GI(),hl(),ws(7,"div",10)(8,"label",14),QC(9,"Description"),hl(),Sg(10,"input",15),GI(),hl(),ws(11,"div",10)(12,"label",16),QC(13,"Model name"),hl(),Sg(14,"input",17),GI(),hl(),ws(15,"div",10)(16,"label",18),QC(17,"Instructions"),hl(),Sg(18,"textarea",19),GI(),hl(),oC(19,Ce,8,1,"fieldset",20),ws(20,"div",10)(21,"label",21),Sg(22,"input",22),GI(),ws(23,"span",23),QC(24,"Advanced mode"),hl()(),ws(25,"p",24),QC(26," When enabled, this agent uses a multi-step reasoning loop instead of a single LLM call. "),hl()(),ws(27,"div",10)(28,"label",21),Sg(29,"input",22),GI(),ws(30,"span",23),QC(31,"Enabled"),hl()(),ws(32,"p",24),QC(33,"Disabled agents are excluded from namespace resolution."),hl()(),ws(34,"div",10)(35,"span",25),QC(36,"Sub-agents"),hl(),ws(37,"p",26),QC(38," Glob patterns for agents this agent may delegate to. "),ws(39,"code",27),QC(40,"*"),hl(),QC(41," matches any sequence of characters (e.g.\xA0"),ws(42,"code",27),QC(43,"*Fixer"),hl(),QC(44,", "),ws(45,"code",27),QC(46,"*"),hl(),QC(47," for all). Leave empty to disable delegation. "),hl(),oC(48,ye,3,0,"ul",28),ws(49,"div",29)(50,"input",30),Rg("keydown.enter",function(){wf(e);let l=EC();return Cf(l.addSubAgent())}),hl(),GI(),ws(51,"button",31),Rg("click",function(){wf(e);let l=EC();return Cf(l.addSubAgent())}),QC(52," + "),hl()()(),ws(53,"div",32)(54,"button",33),QC(55),hl(),oC(56,he,2,2,"button",34),ws(57,"button",35),Rg("click",function(){wf(e);let l=EC();return Cf(l.cancel())}),QC(58,"Cancel"),hl()()();}if(r&2){let e=EC();bg("formGroup",e.form),nI(6),bg("formControl",e.nameControl),qI(),nI(4),bg("formControl",e.descriptionControl),qI(),nI(4),bg("formControl",e.modelNameControl),qI(),nI(4),bg("formControl",e.instructionsControl),qI(),nI(),iC(e.integrationRows().length>0||e.builtInRows().length>0?19:-1),nI(3),bg("formControl",e.advancedExecutionControl),qI(),nI(7),bg("formControl",e.enabledControl),qI(),nI(19),iC(e.subAgentRows().length>0?48:-1),nI(2),bg("formControl",e.newSubAgentControl),qI(),nI(),bg("disabled",!e.newSubAgentControl.value.trim()),nI(3),bg("disabled",e.form.invalid||e.isSubmitting()),nI(),Dl(" ",e.isEditMode()?"Save changes":"Create"," "),nI(),iC(e.isEditMode()?56:-1);}}var ae=class r{route=g(V);router=g(G);destroyRef=g(we);agentConfigController=g(M);exportService=g(G$1);integrationConfigState=g(N);integrationTypeController=g(F);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new z({name:new _t("",{nonNullable:true,validators:[_e$1.required,_e$1.minLength(1)]}),description:new _t(null),modelName:new _t(null),instructions:new _t(null),advancedExecution:new _t(false,{nonNullable:true}),enabled:new _t(false,{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get modelNameControl(){return this.form.controls.modelName}get instructionsControl(){return this.form.controls.instructions}get advancedExecutionControl(){return this.form.controls.advancedExecution}get enabledControl(){return this.form.controls.enabled}subAgentRows=Gi([]);newSubAgentControl=new _t("",{nonNullable:true});isEditMode=Gi(false);isSubmitting=Gi(false);isLoading=Gi(false);isExporting=Gi(false);builtInRows=Gi([]);inspectRoute(){let t=this.route.snapshot.paramMap.get("agentConfigId")??"";return this.isPlatformMode?["/agentos","admin","agent-configs",t,"inspect"]:["/agentos",this.namespaceId,"agent-configs",t,"inspect"]}integrationRows=Gi([]);existingConfig=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("agentConfigId");t?(this.isEditMode.set(true),this.loadConfigAndIntegrations(t)):this.loadIntegrations(void 0);}loadConfigAndIntegrations(t){this.isLoading.set(true),Vy({config:this.agentConfigController.getByIdAgentConfig(t),namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):br([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes()}).pipe(U(this.destroyRef)).subscribe({next:({config:e,namespaceIntegrations:o,platformIntegrations:l,builtInTypes:g})=>{this.existingConfig=e,this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.modelNameControl.setValue(e.modelName??null),this.instructionsControl.setValue(e.instructions??null),this.advancedExecutionControl.setValue(e.advancedExecution??false),this.enabledControl.setValue(e.enabled??true);let m=[...l,...o];this.integrationRows.set(this.buildIntegrationRows(m,e.integrations??void 0)),this.builtInRows.set(this.buildBuiltInRows(g,e.integrations??void 0)),this.subAgentRows.set((e.subAgents??[]).map(P=>({control:new _t(P,{nonNullable:true})}))),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadIntegrations(t){Vy({namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):br([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes()}).pipe(U(this.destroyRef)).subscribe({next:({namespaceIntegrations:e,platformIntegrations:o,builtInTypes:l})=>{let g=[...o,...e];this.integrationRows.set(this.buildIntegrationRows(g,t??void 0)),this.builtInRows.set(this.buildBuiltInRows(l,t??void 0));}});}loadBuiltInTypes(){return this.integrationTypeController.listTypesIntegrationType().pipe(ue$1(t=>t.filter(e=>!e.configSchema)),va(t=>(console.error("[agent-config-form] failed to load integration types",t),br([]))))}buildIntegrationRows(t,e){return t.map(o=>{let l=o.name??"",g=e?.[l],m=e!=null&&l in e,P=Array.isArray(g)?g.join(", "):"";return {config:o,enabled:Gi(m),toolsControl:new _t(P,{nonNullable:true})}})}buildBuiltInRows(t,e){return t.map(o=>{let l=e!=null&&o.type in e,g=e?.[o.type],m=l?Array.isArray(g)&&g.length===0?"off":"on":"default";return {type:o.type,displayName:o.displayName,description:o.description,enabledByDefault:o.enabledByDefault===true,state:Gi(m),restrictedTools:Array.isArray(g)&&g.length>0?g:null}})}toggleIntegration(t){t.enabled.update(e=>!e);}setBuiltInState(t,e){t.state.set(e);}builtInDefaultLabel(t){return t.enabledByDefault?"Platform default (enabled)":"Platform default (disabled)"}addSubAgent(){let t=this.newSubAgentControl.value.trim();t&&(this.subAgentRows.update(e=>[...e,{control:new _t(t,{nonNullable:true})}]),this.newSubAgentControl.reset(""));}removeSubAgent(t){this.subAgentRows.update(e=>e.filter(o=>o!==t));}buildSubAgentsPayload(){let t=this.subAgentRows().map(e=>e.control.value.trim()).filter(e=>e.length>0);return t.length>0?t:void 0}buildIntegrationsPayload(){let t={};for(let o of this.integrationRows().filter(l=>l.enabled())){let l=o.config.name??"",g=o.toolsControl.value.trim();t[l]=g===""?null:g.split(",").map(m=>m.trim()).filter(m=>m.length>0);}for(let o of this.builtInRows()){let l=o.state();l==="on"?t[o.type]=o.restrictedTools??null:l==="off"&&(t[o.type]=[]);}let e=new Set([...this.integrationRows().map(o=>o.config.name??""),...this.builtInRows().map(o=>o.type)]);for(let[o,l]of Object.entries(this.existingConfig?.integrations??{}))e.has(o)||(t[o]=l);return Object.keys(t).length>0?t:void 0}submit(){if(this.form.invalid||this.isSubmitting())return;this.addSubAgent(),this.isSubmitting.set(true);let t=z$1(P({},this.existingConfig??{}),{createdOn:this.existingConfig?.createdOn,updatedOn:this.existingConfig?.updatedOn,namespaceId:this.namespaceId,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,modelName:this.modelNameControl.value?.trim()||void 0,instructions:this.instructionsControl.value?.trim()||void 0,integrations:this.buildIntegrationsPayload(),advancedExecution:this.advancedExecutionControl.value,enabled:this.enabledControl.value,subAgents:this.buildSubAgentsPayload()});(this.isEditMode()?this.agentConfigController.updateAgentConfig(this.existingConfig.id??"",t):this.agentConfigController.createAgentConfig(t)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}exportYaml(){let t=this.existingConfig?.id;!t||this.isExporting()||(this.isExporting.set(true),this.exportService.exportAsYaml(t).pipe(U(this.destroyRef)).subscribe({next:e=>{let o=new Blob([e],{type:"application/yaml"}),l=URL.createObjectURL(o),g=document.createElement("a");g.href=l,g.download=`${this.existingConfig?.name??"agent"}.yaml`,g.click(),URL.revokeObjectURL(l),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"]);}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=Fw({type:r,selectors:[["agentos-agent-config-form"]],decls:12,vars:4,consts:[[1,"agent-config-form"],[1,"agent-config-form__header"],["type","button","title","Back to agent configs",1,"agent-config-form__back",3,"click"],[1,"agent-config-form__back-icon"],[1,"agent-config-form__title"],[1,"agent-config-form__sibling-link",3,"routerLink"],[1,"agent-config-form__platform-badge"],[1,"agent-config-form__loading"],[1,"agent-config-form__form",3,"formGroup"],[1,"agent-config-form__form",3,"ngSubmit","formGroup"],[1,"agent-config-form__field"],["for","agent-config-name",1,"agent-config-form__label"],["aria-hidden","true"],["id","agent-config-name","type","text","placeholder","e.g. Support agent","autocomplete","off",1,"agent-config-form__input",3,"formControl"],["for","agent-config-description",1,"agent-config-form__label"],["id","agent-config-description","type","text","placeholder","Optional \u2014 short description of this agent","autocomplete","off",1,"agent-config-form__input",3,"formControl"],["for","agent-config-model-name",1,"agent-config-form__label"],["id","agent-config-model-name","type","text","placeholder","Optional \u2014 model alias or name to use","autocomplete","off",1,"agent-config-form__input",3,"formControl"],["for","agent-config-instructions",1,"agent-config-form__label"],["id","agent-config-instructions","rows","6","placeholder","Optional \u2014 system instructions for this agent",1,"agent-config-form__textarea",3,"formControl"],[1,"agent-config-form__integrations"],[1,"agent-config-form__toggle-label"],["type","checkbox",1,"agent-config-form__toggle-checkbox",3,"formControl"],[1,"agent-config-form__toggle-text"],[1,"agent-config-form__toggle-hint"],[1,"agent-config-form__label"],[1,"agent-config-form__field-hint"],[1,"agent-config-form__code"],[1,"agent-config-form__sub-agent-list"],[1,"agent-config-form__sub-agent-add"],["type","text","placeholder","e.g. *Fixer or *","autocomplete","off",1,"agent-config-form__input","agent-config-form__sub-agent-input",3,"keydown.enter","formControl"],["type","button","title","Add pattern",1,"agent-config-form__sub-agent-btn","agent-config-form__sub-agent-btn--add",3,"click","disabled"],[1,"agent-config-form__actions"],["type","submit",1,"agent-config-form__btn","agent-config-form__btn--primary",3,"disabled"],["type","button",1,"agent-config-form__btn","agent-config-form__btn--export",3,"disabled"],["type","button",1,"agent-config-form__btn",3,"click"],[1,"agent-config-form__integrations-hint"],[1,"agent-config-form__integration-row"],[1,"agent-config-form__integration-toggle"],["type","checkbox",1,"agent-config-form__integration-checkbox",3,"change","checked"],[1,"agent-config-form__integration-name"],[1,"agent-config-form__integration-type"],["type","text","placeholder","Tool names, comma-separated (empty = all tools)","autocomplete","off",1,"agent-config-form__input","agent-config-form__integration-tools",3,"formControl"],[1,"agent-config-form__integrations-separator"],[1,"agent-config-form__integration-state",3,"change","id","value"],["value","default"],["value","on"],["value","off"],[1,"agent-config-form__integration-restriction"],[1,"agent-config-form__integration-builtin-desc"],[1,"agent-config-form__sub-agent-row"],["type","text","autocomplete","off",1,"agent-config-form__input","agent-config-form__sub-agent-input",3,"formControl"],["type","button","title","Remove",1,"agent-config-form__sub-agent-btn","agent-config-form__sub-agent-btn--danger",3,"click"],["type","button",1,"agent-config-form__btn","agent-config-form__btn--export",3,"click","disabled"]],template:function(e,o){e&1&&(ws(0,"div",0)(1,"header",1)(2,"button",2),Rg("click",function(){return o.cancel()}),ws(3,"span",3),QC(4,"\u2190"),hl(),QC(5," Agent Configs "),hl(),ws(6,"h1",4),QC(7),hl(),oC(8,ge,2,1,"a",5),oC(9,se,2,0,"span",6),hl(),oC(10,de,2,0,"p",7)(11,ve,59,14,"form",8),hl()),e&2&&(nI(7),Yg(o.isEditMode()?"Edit agent config":"New agent config"),nI(),iC(o.isEditMode()?8:-1),nI(),iC(o.isPlatformMode?9:-1),nI(),iC(o.isLoading()?10:11));},dependencies:[ni,Jn,Qn,ei,Ye,wt,Zn,Xn,Cn,En,si],styles:[".agent-config-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.agent-config-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.agent-config-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.agent-config-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.agent-config-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.agent-config-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.agent-config-form__sibling-link[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-accent);text-decoration:none}.agent-config-form__sibling-link[_ngcontent-%COMP%]:hover{text-decoration:underline}.agent-config-form__platform-badge[_ngcontent-%COMP%]{display:inline-block;font-size:.75rem;font-weight:500;color:var(--color-text-secondary);background:var(--color-surface);border:1px solid var(--color-divider);border-radius:0;padding:.125rem .5rem;letter-spacing:.02em;align-self:flex-start}.agent-config-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.agent-config-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.agent-config-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.agent-config-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.agent-config-form__input[_ngcontent-%COMP%], .agent-config-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.agent-config-form__input[_ngcontent-%COMP%]:focus, .agent-config-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.agent-config-form__input[_ngcontent-%COMP%]::placeholder, .agent-config-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.agent-config-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:120px;line-height:1.5}.agent-config-form__integrations[_ngcontent-%COMP%]{border:1px solid var(--color-divider);border-radius:0;padding:1rem;margin:0;display:flex;flex-direction:column;gap:.75rem}.agent-config-form__integrations-hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__integration-row[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.agent-config-form__integration-toggle[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.agent-config-form__integration-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-accent);cursor:pointer}.agent-config-form__integration-name[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text)}.agent-config-form__integration-type[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);font-family:monospace}.agent-config-form__integration-tools[_ngcontent-%COMP%]{margin-left:1.5rem;font-size:.875rem}.agent-config-form__integrations-separator[_ngcontent-%COMP%]{margin:.25rem 0 0;padding-top:.5rem;border-top:1px solid var(--color-divider);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);font-family:var(--font-heading)}.agent-config-form__integration-state[_ngcontent-%COMP%]{margin-left:1.5rem;padding:.375rem .625rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.875rem;font-family:inherit;outline:none;transition:border-color .15s ease}.agent-config-form__integration-state[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.agent-config-form__integration-restriction[_ngcontent-%COMP%]{margin:0 0 0 1.5rem;font-size:.8rem;font-style:italic;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.agent-config-form__integration-builtin-desc[_ngcontent-%COMP%]{margin:0 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__field-hint[_ngcontent-%COMP%]{margin:.25rem 0 0;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__code[_ngcontent-%COMP%]{font-family:monospace;font-size:.85em;background:var(--color-surface-muted, rgba(0, 0, 0, .06));padding:.1em .3em;border-radius:0}.agent-config-form__sub-agent-list[_ngcontent-%COMP%]{list-style:none;margin:.5rem 0 0;padding:0;display:flex;flex-direction:column;gap:.375rem}.agent-config-form__sub-agent-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem}.agent-config-form__sub-agent-input[_ngcontent-%COMP%]{flex:1;min-width:0}.agent-config-form__sub-agent-add[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;margin-top:.5rem}.agent-config-form__sub-agent-btn[_ngcontent-%COMP%]{flex-shrink:0;width:2rem;height:2rem;padding:0;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text-secondary);font-size:.9rem;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .15s ease,border-color .15s ease,color .15s ease}.agent-config-form__sub-agent-btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500);color:var(--color-text)}.agent-config-form__sub-agent-btn[_ngcontent-%COMP%]:disabled{opacity:.35;cursor:not-allowed}.agent-config-form__sub-agent-btn--add[_ngcontent-%COMP%]{width:2rem;height:2rem;font-size:1.25rem;font-weight:300;border-color:var(--color-accent);color:var(--color-accent)}.agent-config-form__sub-agent-btn--add[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent);color:#fff}.agent-config-form__sub-agent-btn--danger[_ngcontent-%COMP%]{border:1px solid transparent;color:var(--color-neutral-500)}.agent-config-form__sub-agent-btn--danger[_ngcontent-%COMP%]:hover:not(:disabled){border-color:var(--red);color:var(--red);background:color-mix(in srgb,var(--red) 10%,transparent)}.agent-config-form__toggle-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.agent-config-form__toggle-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-accent);cursor:pointer}.agent-config-form__toggle-text[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text)}.agent-config-form__toggle-hint[_ngcontent-%COMP%]{margin:.25rem 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.agent-config-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.agent-config-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.agent-config-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.agent-config-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.agent-config-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}"]})};export{ae as AgentConfigFormComponent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {c}from'./chunk-ClEmA_ih.js';import {g,ao as V,G,w as we$1,d8 as M,d9 as He,da as Ce$1,a as Gi,db as xe$1,F,bR as Sd,E as ET,W as Vy,c as U,a7 as va,X as br,z as z$1,b as P,h as Fw,m as ws,o as Rg,Q as QC,n as hl,q as oC,t as nI,a5 as Dl,x as iC,a9 as gC,S as Sg,a3 as GI,r as cC,ac as EC,v as bg,A as Ug,a6 as qI,y as uC,a8 as Yg,aa as wf,ab as Cf,bk as vh}from'./main-LBRSRTYI.js';import {o as z,k as _t,b as _e$1,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,f as fn,a as wt,A as At,Z as Zn,l as Xn,$ as $t,C as Cn,E as En}from'./chunk-BYyTBqh4.js';var A=(n,t)=>t.value,me=(n,t)=>t.id;function pe(n,t){n&1&&(ws(0,"p",5),QC(1,"Loading\u2026"),hl());}function ue(n,t){n&1&&(ws(0,"span",12),QC(1," Name is required. "),hl());}function fe(n,t){if(n&1&&(ws(0,"p",42),QC(1),hl(),ws(2,"span",13),QC(3,"Agent Config cannot be changed after creation."),hl()),n&2){let e=EC(2);nI(),Yg(e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function _e(n,t){if(n&1&&(ws(0,"a",43),QC(1,"Add an agent config"),hl(),QC(2," first. ")),n&2){let e=EC(3);bg("href","/agentos/"+e.namespaceId+"/agent-configs/new",vh);}}function he(n,t){if(n&1&&(ws(0,"p",13),QC(1," No agent configs available in this scope yet. "),oC(2,_e,3,1),hl()),n&2){let e=EC(2);nI(2),iC(e.isPlatformMode?-1:2);}}function ge(n,t){if(n&1&&(ws(0,"option",23),QC(1),hl()),n&2){let e=t.$implicit;bg("value",e.id),nI(),Yg(e.name);}}function Ce(n,t){n&1&&(ws(0,"span",12),QC(1,"Agent Config is required."),hl());}function ve(n,t){if(n&1&&(ws(0,"select",44)(1,"option",45),QC(2,"Select an agent config\u2026"),hl(),cC(3,ge,2,2,"option",23,me),hl(),GI(),oC(5,Ce,2,0,"span",12),ws(6,"span",13),QC(7,"Immutable after creation."),hl()),n&2){let e=EC(2);bg("formControl",e.agentConfigIdControl),qI(),nI(3),uC(e.availableAgentConfigs()),nI(2),iC(e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?5:-1);}}function xe(n,t){n&1&&(ws(0,"span",12),QC(1,"Opening message is required."),hl());}function ye(n,t){if(n&1&&(ws(0,"option",23),QC(1),hl()),n&2){let e=t.$implicit;bg("value",e.value),nI(),Yg(e.label);}}function be(n,t){if(n&1){let e=gC();ws(0,"label",48)(1,"input",49),Rg("change",function(){let g=wf(e).$implicit,v=EC(3);return Cf(v.toggleDay(g.value))}),hl(),ws(2,"span",50),QC(3),hl()();}if(n&2){let e=t.$implicit,d=EC(3);nI(),bg("checked",d.isDaySelected(e.value)),nI(2),Yg(e.label);}}function Se(n,t){if(n&1&&(ws(0,"div",8)(1,"span",46),QC(2,"Days of week"),hl(),ws(3,"div",47),cC(4,be,4,2,"label",48,A),hl(),ws(6,"span",13),QC(7,"Leave empty to run every day of the week."),hl()()),n&2){let e=EC(2);nI(4),uC(e.dayOptions);}}function Ee(n,t){n&1&&(ws(0,"span",12),QC(1,"Valid time is required (HH:mm)."),hl());}function Pe(n,t){n&1&&(ws(0,"span",12),QC(1,"Start date is required."),hl());}function Me(n,t){if(n&1&&(ws(0,"option",23),QC(1),hl()),n&2){let e=t.$implicit;bg("value",e.value),nI(),Yg(e.label);}}function Oe(n,t){n&1&&(ws(0,"span",12),QC(1,"End date is required."),hl());}function De(n,t){if(n&1&&(ws(0,"div",8)(1,"label",51),QC(2," End date "),ws(3,"span",10),QC(4,"*"),hl()(),Sg(5,"input",52),GI(),oC(6,Oe,2,0,"span",12),hl()),n&2){let e=EC(2);nI(5),Ug("scheduled-prompt-form__input--invalid",e.form.hasError("endDateRequired")&&e.endDateControl.touched),bg("formControl",e.endDateControl),qI(),nI(),iC(e.form.hasError("endDateRequired")&&e.endDateControl.touched?6:-1);}}function Te(n,t){n&1&&(ws(0,"span",12),QC(1,"Must be at least 1."),hl());}function we(n,t){if(n&1&&(ws(0,"div",8)(1,"label",53),QC(2," Number of occurrences "),ws(3,"span",10),QC(4,"*"),hl()(),Sg(5,"input",54),GI(),oC(6,Te,2,0,"span",12),hl()),n&2){let e=EC(2);nI(5),Ug("scheduled-prompt-form__input--invalid",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched),bg("formControl",e.occurrenceCountControl),qI(),nI(),iC(e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?6:-1);}}function ke(n,t){n&1&&(ws(0,"span",12),QC(1,"Invalid JSON."),hl());}function Ne(n,t){if(n&1&&(ws(0,"p",38),QC(1),hl()),n&2){let e=EC(2);nI(),Yg(e.errorMessage());}}function Fe(n,t){if(n&1){let e=gC();ws(0,"form",7),Rg("ngSubmit",function(){wf(e);let g=EC();return Cf(g.submit())}),ws(1,"div",8)(2,"label",9),QC(3," Name "),ws(4,"span",10),QC(5,"*"),hl()(),Sg(6,"input",11),GI(),oC(7,ue,2,0,"span",12),ws(8,"span",13),QC(9,'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.'),hl()(),ws(10,"div",8)(11,"label",14),QC(12,"Description"),hl(),Sg(13,"input",15),GI(),hl(),ws(14,"div",8)(15,"label",16),QC(16," Agent Config "),ws(17,"span",10),QC(18,"*"),hl()(),oC(19,fe,4,1)(20,he,3,1,"p",13)(21,ve,8,2),hl(),ws(22,"div",8)(23,"label",17),QC(24," Opening message "),ws(25,"span",10),QC(26,"*"),hl()(),Sg(27,"textarea",18),GI(),oC(28,xe,2,0,"span",12),ws(29,"span",13),QC(30," The message sent to the agent when the scheduled prompt fires. "),hl()(),ws(31,"fieldset",19)(32,"legend",20),QC(33,"Recurrence"),hl(),ws(34,"div",8)(35,"label",21),QC(36," Unit "),ws(37,"span",10),QC(38,"*"),hl()(),ws(39,"select",22),cC(40,ye,2,2,"option",23,A),hl(),GI(),hl(),oC(42,Se,8,0,"div",8),ws(43,"div",8)(44,"label",24),QC(45," Time (UTC) "),ws(46,"span",10),QC(47,"*"),hl()(),ws(48,"div",25),Sg(49,"input",26),GI(),ws(50,"span",27),QC(51,"UTC"),hl()(),oC(52,Ee,2,0,"span",12),hl()(),ws(53,"fieldset",19)(54,"legend",20),QC(55,"Planning"),hl(),ws(56,"div",8)(57,"label",28),QC(58," Start date "),ws(59,"span",10),QC(60,"*"),hl()(),Sg(61,"input",29),GI(),oC(62,Pe,2,0,"span",12),hl(),ws(63,"div",8)(64,"label",30),QC(65," Ends "),ws(66,"span",10),QC(67,"*"),hl()(),ws(68,"select",31),cC(69,Me,2,2,"option",23,A),hl(),GI(),hl(),oC(71,De,7,4,"div",8),oC(72,we,7,4,"div",8),hl(),ws(73,"div",8)(74,"label",32),Sg(75,"input",33),GI(),ws(76,"span",34),QC(77,"Enabled"),hl()(),ws(78,"p",35),QC(79," When disabled, the scheduled prompt is saved but will not run on schedule. "),hl()(),ws(80,"div",8)(81,"label",36),QC(82,"External Metadata"),hl(),Sg(83,"textarea",37),GI(),oC(84,ke,2,0,"span",12),ws(85,"span",13),QC(86,"Optional. Opaque JSON object stored as-is. Leave empty to clear."),hl()(),oC(87,Ne,2,1,"p",38),ws(88,"div",39)(89,"button",40),QC(90),hl(),ws(91,"button",41),Rg("click",function(){wf(e);let g=EC();return Cf(g.cancel())}),QC(92,"Cancel"),hl()()();}if(n&2){let e=EC();bg("formGroup",e.form),nI(6),Ug("scheduled-prompt-form__input--invalid",e.nameControl.invalid&&e.nameControl.touched),bg("formControl",e.nameControl),qI(),nI(),iC(e.nameControl.invalid&&e.nameControl.touched?7:-1),nI(6),bg("formControl",e.descriptionControl),qI(),nI(6),iC(e.isEditMode()?19:e.availableAgentConfigs().length===0?20:21),nI(8),Ug("scheduled-prompt-form__textarea--invalid",e.promptContentControl.invalid&&e.promptContentControl.touched),bg("formControl",e.promptContentControl),qI(),nI(),iC(e.promptContentControl.invalid&&e.promptContentControl.touched?28:-1),nI(11),bg("formControl",e.unitControl),qI(),nI(),uC(e.schedulerUnits),nI(2),iC(e.showDayFilter()?42:-1),nI(7),bg("formControl",e.timeUtcControl),qI(),nI(3),iC(e.timeUtcControl.invalid&&e.timeUtcControl.touched?52:-1),nI(9),Ug("scheduled-prompt-form__input--invalid",e.startDateControl.invalid&&e.startDateControl.touched),bg("formControl",e.startDateControl),qI(),nI(),iC(e.startDateControl.invalid&&e.startDateControl.touched?62:-1),nI(6),bg("formControl",e.endTypeControl),qI(),nI(),uC(e.endTypes),nI(2),iC(e.showEndDate()?71:-1),nI(),iC(e.showOccurrenceCount()?72:-1),nI(3),bg("formControl",e.enabledControl),qI(),nI(8),bg("formControl",e.externalMetadataJsonControl),qI(),nI(),iC(e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?84:-1),nI(3),iC(e.errorMessage()?87:-1),nI(2),bg("disabled",e.form.invalid||e.isSubmitting()),nI(),Dl(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var se=class n{route=g(V);router=g(G);destroyRef=g(we$1);state=g(c);agentConfigController=g(M);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new z({name:new _t("",{nonNullable:true,validators:[_e$1.required]}),description:new _t(null),agentConfigId:new _t("",{nonNullable:true,validators:[_e$1.required]}),promptContent:new _t("",{nonNullable:true,validators:[_e$1.required]}),unit:new _t(Ce$1.WEEK,{nonNullable:true,validators:[_e$1.required]}),days:new _t([],{nonNullable:true}),timeUtc:new _t("09:00",{nonNullable:true,validators:[_e$1.required,_e$1.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new _t("",{nonNullable:true,validators:[_e$1.required]}),endType:new _t(He.NEVER,{nonNullable:true,validators:[_e$1.required]}),endDate:new _t(null),occurrenceCount:new _t(null),enabled:new _t(true,{nonNullable:true}),externalMetadataJson:new _t("",{nonNullable:true,validators:[Ae]})},{validators:[Ie,Ve]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}isEditMode=Gi(false);isSubmitting=Gi(false);isLoading=Gi(false);errorMessage=Gi(null);SchedulerUnit=Ce$1;SchedulerEndType=He;schedulerUnits=[{value:Ce$1.WEEK,label:"Week(s)"},{value:Ce$1.MONTH,label:"Month(s)"}];endTypes=[{value:He.NEVER,label:"Never"},{value:He.ON_DATE,label:"On date"},{value:He.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(xe$1).map(([t,e])=>({value:t,label:e}));unitSignal=F(this.unitControl.valueChanges.pipe(Sd(this.unitControl.value)));endTypeSignal=F(this.endTypeControl.valueChanges.pipe(Sd(this.endTypeControl.value)));showDayFilter=ET(()=>this.unitSignal()===Ce$1.WEEK);showEndDate=ET(()=>this.endTypeSignal()===He.ON_DATE);showOccurrenceCount=ET(()=>this.endTypeSignal()===He.OCCURRENCES);agentConfigs=Gi([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Re());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(true),this.loadPromptAndResources(t)):this.loadResources();}loadPromptAndResources(t){this.isLoading.set(true),Vy({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(U(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:d})=>{this.existingPrompt=e,this.agentConfigs.set(d),this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadResources(){this.agentConfigs$().pipe(U(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(va(()=>br([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,d=e.includes(t)?e.filter(g=>g!==t):[...e,t];this.daysControl.setValue(d);}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,d=z$1(P({},this.existingPrompt??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,agentConfigId:t?this.existingPrompt.agentConfigId:this.agentConfigIdControl.value,promptContent:this.promptContentControl.value.trim(),recurrence:{unit:this.unitControl.value,days:this.daysControl.value,timeUtc:this.timeUtcControl.value},planning:{startDate:this.startDateControl.value,endType:e,endDate:e===He.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===He.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value,removed:this.existingPrompt?.removed??false,externalMetadata:(()=>{let v=this.externalMetadataJsonControl.value.trim();return v?JSON.parse(v):null})()});(t?this.state.update(this.existingPrompt.id,d):this.state.create(d)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:v=>{this.isSubmitting.set(false),v.status===409?this.errorMessage.set(`A scheduled prompt named "${d.name}" already exists in this scope.`):v.status===400?this.errorMessage.set(v.error?.message??"Invalid scheduled prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","scheduled-prompts"]):this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Fw({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:10,vars:3,consts:[[1,"scheduled-prompt-form"],[1,"scheduled-prompt-form__header"],["type","button","title","Back to scheduled prompts",1,"scheduled-prompt-form__back",3,"click"],[1,"scheduled-prompt-form__back-icon"],[1,"scheduled-prompt-form__title"],[1,"scheduled-prompt-form__loading"],[1,"scheduled-prompt-form__form",3,"formGroup"],[1,"scheduled-prompt-form__form",3,"ngSubmit","formGroup"],[1,"scheduled-prompt-form__field"],["for","sp-name",1,"scheduled-prompt-form__label"],["aria-hidden","true"],["id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],[1,"scheduled-prompt-form__field-error"],[1,"scheduled-prompt-form__field-hint"],["for","sp-description",1,"scheduled-prompt-form__label"],["id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-agent-config",1,"scheduled-prompt-form__label"],["for","sp-prompt-content",1,"scheduled-prompt-form__label"],["id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",1,"scheduled-prompt-form__textarea",3,"formControl"],[1,"scheduled-prompt-form__fieldset"],[1,"scheduled-prompt-form__legend"],["for","sp-unit",1,"scheduled-prompt-form__label"],["id","sp-unit",1,"scheduled-prompt-form__select",3,"formControl"],[3,"value"],["for","sp-time",1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__time-wrapper"],["id","sp-time","type","time",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--time",3,"formControl"],[1,"scheduled-prompt-form__utc-badge"],["for","sp-start-date",1,"scheduled-prompt-form__label"],["id","sp-start-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-end-type",1,"scheduled-prompt-form__label"],["id","sp-end-type",1,"scheduled-prompt-form__select",3,"formControl"],[1,"scheduled-prompt-form__toggle-label"],["type","checkbox",1,"scheduled-prompt-form__toggle-checkbox",3,"formControl"],[1,"scheduled-prompt-form__toggle-text"],[1,"scheduled-prompt-form__toggle-hint"],["for","sp-external-metadata",1,"scheduled-prompt-form__label"],["id","sp-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",1,"scheduled-prompt-form__textarea","scheduled-prompt-form__textarea--code",3,"formControl"],[1,"scheduled-prompt-form__error"],[1,"scheduled-prompt-form__actions"],["type","submit",1,"scheduled-prompt-form__btn","scheduled-prompt-form__btn--primary",3,"disabled"],["type","button",1,"scheduled-prompt-form__btn",3,"click"],[1,"scheduled-prompt-form__readonly-value"],[3,"href"],["id","sp-agent-config",1,"scheduled-prompt-form__select",3,"formControl"],["value","","disabled",""],[1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__day-grid"],[1,"scheduled-prompt-form__day-label"],["type","checkbox",1,"scheduled-prompt-form__day-checkbox",3,"change","checked"],[1,"scheduled-prompt-form__day-text"],["for","sp-end-date",1,"scheduled-prompt-form__label"],["id","sp-end-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-occurrence-count",1,"scheduled-prompt-form__label"],["id","sp-occurrence-count","type","number","min","1",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--number",3,"formControl"]],template:function(e,d){e&1&&(ws(0,"div",0)(1,"header",1)(2,"button",2),Rg("click",function(){return d.cancel()}),ws(3,"span",3),QC(4,"\u2190"),hl(),QC(5),hl(),ws(6,"h1",4),QC(7),hl()(),oC(8,pe,2,0,"p",5)(9,Fe,93,28,"form",6),hl()),e&2&&(nI(5),Dl(" ",d.isPlatformMode?"Platform Scheduled Prompts":"Scheduled Prompts"," "),nI(2),Dl(" ",d.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"," "),nI(),iC(d.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,fn,wt,At,Zn,Xn,$t,Cn,En],styles:[".scheduled-prompt-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.scheduled-prompt-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.scheduled-prompt-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.scheduled-prompt-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.scheduled-prompt-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.scheduled-prompt-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.scheduled-prompt-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.scheduled-prompt-form__row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.scheduled-prompt-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__input[_ngcontent-%COMP%], .scheduled-prompt-form__select[_ngcontent-%COMP%], .scheduled-prompt-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.scheduled-prompt-form__input[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__select[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.scheduled-prompt-form__input[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__select[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__select[_ngcontent-%COMP%]{cursor:pointer;appearance:auto}.scheduled-prompt-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:100px;line-height:1.5}.scheduled-prompt-form__input--time[_ngcontent-%COMP%]{flex:1;min-width:0}.scheduled-prompt-form__input--number[_ngcontent-%COMP%]{max-width:120px}.scheduled-prompt-form__time-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.scheduled-prompt-form__utc-badge[_ngcontent-%COMP%]{flex-shrink:0;font-size:.75rem;font-weight:600;font-family:monospace;color:var(--color-text-secondary, #6e6e73);background:var(--color-surface, rgba(0, 0, 0, .05));padding:.25rem .5rem;border-radius:4px;text-transform:uppercase;letter-spacing:.06em}.scheduled-prompt-form__fieldset[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:8px;padding:1rem 1.25rem 1.25rem;margin:0;display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__legend[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--color-text-secondary, #6e6e73);padding:0 .375rem}.scheduled-prompt-form__day-grid[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.5rem}.scheduled-prompt-form__day-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__day-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__day-text[_ngcontent-%COMP%]{font-size:.875rem;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__hint[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30);margin:0}.scheduled-prompt-form__field-error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30)}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__readonly-value[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;color:var(--color-text, #1d1d1f);padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--color-surface, rgba(0, 0, 0, .03))}.scheduled-prompt-form__input--invalid[_ngcontent-%COMP%], .scheduled-prompt-form__textarea--invalid[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30)}.scheduled-prompt-form__toggle-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__toggle-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__toggle-text[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__toggle-hint[_ngcontent-%COMP%]{margin:.25rem 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.scheduled-prompt-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"]})};function Ie(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===He.ON_DATE&&!e?{endDateRequired:true}:null}function Ve(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===He.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function Ae(n){let t=n.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}function Re(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),d=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${d}`}export{se as ScheduledPromptFormComponent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {i}from'./chunk-BDaTUrH4.js';import {l}from'./chunk-R-GmZrHu.js';import {g,dh as J$1,aJ as Tr,aD as jy,bS as Da,a7 as va,X as br,u as ue,cE as Od,z as z$1,b as P,bU as kd,Y as x}from'./main-LBRSRTYI.js';var q=["ApiKeyAuthSetting","BasicAuthAuthSetting","BearerTokenAuthSetting","OAuthDiscoverableAuthSetting","OAuthMcpDiscoverableAuthSetting","OAuthCustomAuthSetting","OAuthRegisteredAuthSetting"],J={ApiKeyAuthSetting:"API Key",BasicAuthAuthSetting:"Basic Auth (username / password)",BearerTokenAuthSetting:"Bearer Token",OAuthDiscoverableAuthSetting:"OAuth \u2014 Discovery URL",OAuthMcpDiscoverableAuthSetting:"OAuth \u2014 MCP Discoverable",OAuthCustomAuthSetting:"OAuth \u2014 Custom endpoints",OAuthRegisteredAuthSetting:"OAuth \u2014 Registered app"},E="none",C="me",I={ApiKeyAuthSetting:"API_KEY",BasicAuthAuthSetting:"BASIC_AUTH",BearerTokenAuthSetting:"BEARER_TOKEN",OAuthDiscoverableAuthSetting:"OAUTH_DISCOVERABLE",OAuthMcpDiscoverableAuthSetting:"OAUTH_MCP_DISCOVERABLE",OAuthCustomAuthSetting:"OAUTH_CUSTOM",OAuthRegisteredAuthSetting:"OAUTH_REGISTERED"},U={API_KEY:"ApiKeyAuthSetting",BASIC_AUTH:"BasicAuthAuthSetting",BEARER_TOKEN:"BearerTokenAuthSetting",OAUTH_DISCOVERABLE:"OAuthDiscoverableAuthSetting",OAUTH_MCP_DISCOVERABLE:"OAuthMcpDiscoverableAuthSetting",OAUTH_CUSTOM:"OAuthCustomAuthSetting",OAUTH_REGISTERED:"OAuthRegisteredAuthSetting"};function v(n){let t=I[n.authType];return t?z$1(P({},n),{authType:t}):n}function d(n){return B(n)}function O(n){return n.map(B)}function B(n){let t=n;if(typeof t.authType=="string"){let e=U[t.authType];if(e)return z$1(P({},t),{authType:e})}return n}var R=class n{controller=g(J$1);userState=g(l);refresh$=new Tr(void 0);namespaceId$=new Tr(null);vm$=jy([this.namespaceId$,this.refresh$]).pipe(Da(([t])=>{let e=this.loadPlatformSettings().pipe(va(()=>br([])));return t?jy([e,this.loadNamespaceSettings(t).pipe(va(()=>br([]))),this.loadUserSettings(t).pipe(va(()=>br([]))),this.loadUserSettings("global").pipe(va(()=>br([])))]).pipe(ue(([i,s,u,p])=>({platform:i,namespace:s,userOnNs:u,userGlobal:p}))):jy([e,this.loadNamespaceSettings("").pipe(va(()=>br([]))),this.loadUserSettings("global").pipe(va(()=>br([])))]).pipe(ue(([i,s,u])=>({platform:i,namespace:s,userOnNs:[],userGlobal:u})))}),Od({bufferSize:1,refCount:true}));setNamespace(t){this.namespaceId$.value!==t&&this.namespaceId$.next(t);}refresh(){this.refresh$.next();}loadUserSettings(t){let e=t==="global"?E:t;return this.controller.listAuthSetting(e,C).pipe(ue(i=>O(i)))}userGlobal$=i(this.refresh$,()=>this.loadUserSettings("global"),[]);loadPlatformSettings(){return this.controller.listAuthSetting(E).pipe(ue(t=>O(t)))}loadNamespaceSettings(t){return t?this.controller.listAuthSetting(t).pipe(ue(e=>O(e))):br([])}getById(t,e){return this.controller.getByIdAuthSetting(t).pipe(ue(i=>d(i)))}create(t,e,i){let u=this.userState.currentUser()?.id;if((e==="userOnNs"||e==="userGlobal")&&!u)throw new Error(`Cannot create ${e} auth setting before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(e==="namespace"&&(i===void 0||i===""))throw new Error("Cannot create namespace-scoped auth setting without a namespaceId");if(e==="userOnNs"&&!i)throw new Error("Cannot create userOnNs auth setting without a namespaceId");let p=v(z$1(P({},t),{namespaceId:e==="namespace"||e==="userOnNs"?i??void 0:void 0,userId:e==="userOnNs"||e==="userGlobal"?u:void 0}));return this.controller.createAuthSetting(p).pipe(ue(_=>d(_)),kd(()=>this.refresh()))}update(t,e,i){let s=v(z$1(P({},e),{namespaceId:i.namespaceId,userId:i.userId,authType:i.authType}));return this.controller.updateAuthSetting(t,s).pipe(ue(u=>d(u)),kd(()=>this.refresh()))}delete(t,e){return this.controller.deleteAuthSetting(t).pipe(kd(()=>this.refresh()))}static \u0275fac=function(e){return new(e||n)};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};export{J,R,q};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {bS as Da,a7 as va,X as br,cE as Od}from'./main-LBRSRTYI.js';function i(t,o,p){return t.pipe(Da(()=>o().pipe(va(()=>br(p)))),Od({bufferSize:1,refCount:true}))}export{i};
|
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
import {x as xe}from'./chunk-BwDJA6_r.js';import {P as Pt$1,L as Lt}from'./chunk-BdJzYh5V.js';import {v as ve,n as ne}from'./chunk-BXkvjekT.js';import {d}from'./chunk-CKhGzoqa.js';import {W,k as ke,s as se}from'./chunk-CpZK7G-Q.js';import {T as Tn,S as Sn,n as nt,a as ae,l as le,c as ce}from'./chunk-bfpuueWC.js';import {W as Wn,o as ot,i as it,I as In,D as De,B as Be,y as ya,E as En,F as Fn,g as gt$1,A as An}from'./chunk-BaO2vi_O.js';import'./chunk-DjMtxVWg.js';import {g,bm as _m,R as Re,a as Gi,E as ET,h as Fw,i as hr,k as Gn,m as ws,o as Rg,Q as QC,n as hl,a3 as GI,q as oC,af as Eg,ag as mT,M as MC,t as nI,v as bg,a6 as qI,x as iC,Z as z,_ as Ue,am as Wm,$ as zt$1,a0 as jt$1,a1 as Vt,a2 as Nt$1,j as pr,ai as em,aj as tT,r as cC,a8 as Yg,ak as Jg,y as uC,a5 as Dl,ac as EC,a9 as gC,aa as wf,ab as Cf,bp as yl,bq as vl,ah as aT,b4 as cT,aL as Eo,aM as qn,br as sn,aO as wt$1,bs as bl,bt as Qn,aT as Ut$1,al as yt$2,aW as w,bu as Ve,aZ as js,a_ as JT,b5 as sT,T as Tg,A as Ug,bv as Fg,D as bC,H as SC,az as Kt$1,bw as St,aS as K$1,aX as D$1,bx as on,by as cm,bz as Oi,bA as wC,bB as CC,S as Sg,C as Pg,bC as bi,bo as sC}from'./main-LBRSRTYI.js';import {y as yt$1,w as wt,t as ti,Z as Zn,c as cn,Y as Ye,f as fn,g as gt,$ as $t$1,D}from'./chunk-BYyTBqh4.js';var Pt=["button"],Ot=["*"];function Ft(l,a){if(l&1&&(ws(0,"div",2),Sg(1,"mat-pseudo-checkbox",6),hl()),l&2){let e=EC();nI(),bg("disabled",e.disabled);}}var yt=new w("MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS",{providedIn:"root",factory:()=>({hideSingleSelectionIndicator:false,hideMultipleSelectionIndicator:false,disabledInteractive:false})}),vt=new w("MatButtonToggleGroup"),Dt={provide:D,useExisting:bi(()=>ie),multi:true},K=class{source;value;constructor(a,e){this.source=a,this.value=e;}},ie=(()=>{class l{_changeDetector=g(bl);_dir=g(Qn,{optional:true});_multiple=false;_disabled=false;_disabledInteractive=false;_selectionModel;_rawValue;_controlValueAccessorChangeFn=()=>{};_onTouched=()=>{};_buttonToggles;appearance;get name(){return this._name}set name(e){this._name=e,this._markButtonsForCheck();}_name=g(Ut$1).getId("mat-button-toggle-group-");vertical=false;get value(){let e=this._selectionModel?this._selectionModel.selected:[];return this.multiple?e.map(t=>t.value):e[0]?e[0].value:void 0}set value(e){this._setSelectionByValue(e),this.valueChange.emit(this.value);}valueChange=new yt$2;get selected(){let e=this._selectionModel?this._selectionModel.selected:[];return this.multiple?e:e[0]||null}get multiple(){return this._multiple}set multiple(e){this._multiple=e,this._markButtonsForCheck();}get disabled(){return this._disabled}set disabled(e){this._disabled=e,this._markButtonsForCheck();}get disabledInteractive(){return this._disabledInteractive}set disabledInteractive(e){this._disabledInteractive=e,this._markButtonsForCheck();}get dir(){return this._dir&&this._dir.value==="rtl"?"rtl":"ltr"}change=new yt$2;get hideSingleSelectionIndicator(){return this._hideSingleSelectionIndicator}set hideSingleSelectionIndicator(e){this._hideSingleSelectionIndicator=e,this._markButtonsForCheck();}_hideSingleSelectionIndicator;get hideMultipleSelectionIndicator(){return this._hideMultipleSelectionIndicator}set hideMultipleSelectionIndicator(e){this._hideMultipleSelectionIndicator=e,this._markButtonsForCheck();}_hideMultipleSelectionIndicator;constructor(){let e=g(yt,{optional:true});this.appearance=e&&e.appearance?e.appearance:"standard",this._hideSingleSelectionIndicator=e?.hideSingleSelectionIndicator??false,this._hideMultipleSelectionIndicator=e?.hideMultipleSelectionIndicator??false;}ngOnInit(){this._selectionModel=new gt$1(this.multiple,void 0,false);}ngAfterContentInit(){this._selectionModel.select(...this._buttonToggles.filter(e=>e.checked)),this.multiple||this._initializeTabIndex();}writeValue(e){this.value=e,this._changeDetector.markForCheck();}registerOnChange(e){this._controlValueAccessorChangeFn=e;}registerOnTouched(e){this._onTouched=e;}setDisabledState(e){this.disabled=e;}_keydown(e){if(this.multiple||this.disabled||Ve(e))return;let n=e.target.id,o=this._buttonToggles.toArray().findIndex(I=>I.buttonId===n),u=null;switch(e.keyCode){case 32:case 13:u=this._buttonToggles.get(o)||null;break;case 38:u=this._getNextButton(o,-1);break;case 37:u=this._getNextButton(o,this.dir==="ltr"?-1:1);break;case 40:u=this._getNextButton(o,1);break;case 39:u=this._getNextButton(o,this.dir==="ltr"?1:-1);break;default:return}u&&(e.preventDefault(),u._onButtonClick(),u.focus());}_emitChangeEvent(e){let t=new K(e,this.value);this._rawValue=t.value,this._controlValueAccessorChangeFn(t.value),this.change.emit(t);}_syncButtonToggle(e,t,n=false,o=false){!this.multiple&&this.selected&&!e.checked&&(this.selected.checked=false),this._selectionModel?t?this._selectionModel.select(e):this._selectionModel.deselect(e):o=true,o?Promise.resolve().then(()=>this._updateModelValue(e,n)):this._updateModelValue(e,n);}_isSelected(e){return this._selectionModel&&this._selectionModel.isSelected(e)}_isPrechecked(e){return typeof this._rawValue>"u"?false:this.multiple&&Array.isArray(this._rawValue)?this._rawValue.some(t=>e.value!=null&&t===e.value):e.value===this._rawValue}_initializeTabIndex(){if(this._buttonToggles.forEach(e=>{e.tabIndex=-1;}),this.selected)this.selected.tabIndex=0;else for(let e=0;e<this._buttonToggles.length;e++){let t=this._buttonToggles.get(e);if(!t.disabled){t.tabIndex=0;break}}}_getNextButton(e,t){let n=this._buttonToggles;for(let o=1;o<=n.length;o++){let u=(e+t*o+n.length)%n.length,I=n.get(u);if(I&&!I.disabled)return I}return null}_setSelectionByValue(e){if(this._rawValue=e,!this._buttonToggles)return;let t=this._buttonToggles.toArray();if(this.multiple&&e?(this._clearSelection(),e.forEach(n=>this._selectValue(n,t))):(this._clearSelection(),this._selectValue(e,t)),!this.multiple&&t.every(n=>n.tabIndex===-1)){for(let n of t)if(!n.disabled){n.tabIndex=0;break}}}_clearSelection(){this._selectionModel.clear(),this._buttonToggles.forEach(e=>{e.checked=false,this.multiple||(e.tabIndex=-1);});}_selectValue(e,t){for(let n of t)if(n.value===e){n.checked=true,this._selectionModel.select(n),this.multiple||(n.tabIndex=0);break}}_updateModelValue(e,t){t&&this._emitChangeEvent(e),this.valueChange.emit(this.value);}_markButtonsForCheck(){this._buttonToggles?.forEach(e=>e._markForCheck());}static \u0275fac=function(t){return new(t||l)};static \u0275dir=js({type:l,selectors:[["mat-button-toggle-group"]],contentQueries:function(t,n,o){if(t&1&&Fg(o,X,5),t&2){let u;bC(u=SC())&&(n._buttonToggles=u);}},hostAttrs:[1,"mat-button-toggle-group"],hostVars:6,hostBindings:function(t,n){t&1&&Rg("keydown",function(u){return n._keydown(u)}),t&2&&(Tg("role",n.multiple?"group":"radiogroup")("aria-disabled",n.disabled),Ug("mat-button-toggle-vertical",n.vertical)("mat-button-toggle-group-appearance-standard",n.appearance==="standard"));},inputs:{appearance:"appearance",name:"name",vertical:[2,"vertical","vertical",JT],value:"value",multiple:[2,"multiple","multiple",JT],disabled:[2,"disabled","disabled",JT],disabledInteractive:[2,"disabledInteractive","disabledInteractive",JT],hideSingleSelectionIndicator:[2,"hideSingleSelectionIndicator","hideSingleSelectionIndicator",JT],hideMultipleSelectionIndicator:[2,"hideMultipleSelectionIndicator","hideMultipleSelectionIndicator",JT]},outputs:{valueChange:"valueChange",change:"change"},exportAs:["matButtonToggleGroup"],features:[sT([Dt,{provide:vt,useExisting:l}])]})}return l})(),X=(()=>{class l{_changeDetectorRef=g(bl);_elementRef=g(Kt$1);_focusMonitor=g(St);_idGenerator=g(Ut$1);_animationDisabled=K$1();_checked=false;ariaLabel;ariaLabelledby=null;_buttonElement;buttonToggleGroup;get buttonId(){return `${this.id}-button`}id;name;value;get tabIndex(){return this._tabIndex()}set tabIndex(e){this._tabIndex.set(e);}_tabIndex;disableRipple=false;get appearance(){return this.buttonToggleGroup?this.buttonToggleGroup.appearance:this._appearance}set appearance(e){this._appearance=e;}_appearance;get checked(){return this.buttonToggleGroup?this.buttonToggleGroup._isSelected(this):this._checked}set checked(e){e!==this._checked&&(this._checked=e,this.buttonToggleGroup&&this.buttonToggleGroup._syncButtonToggle(this,this._checked),this._changeDetectorRef.markForCheck());}get disabled(){return this._disabled||this.buttonToggleGroup&&this.buttonToggleGroup.disabled}set disabled(e){this._disabled=e;}_disabled=false;get disabledInteractive(){return this._disabledInteractive||this.buttonToggleGroup!==null&&this.buttonToggleGroup.disabledInteractive}set disabledInteractive(e){this._disabledInteractive=e;}_disabledInteractive;change=new yt$2;constructor(){g(D$1).load(on);let e=g(vt,{optional:true}),t=g(new cm("tabindex"),{optional:true})||"",n=g(yt,{optional:true});this._tabIndex=Gi(parseInt(t)||0),this.buttonToggleGroup=e,this._appearance=n&&n.appearance?n.appearance:"standard",this._disabledInteractive=n?.disabledInteractive??false;}ngOnInit(){let e=this.buttonToggleGroup;this.id=this.id||this._idGenerator.getId("mat-button-toggle-"),e&&(e._isPrechecked(this)?this.checked=true:e._isSelected(this)!==this._checked&&e._syncButtonToggle(this,this._checked));}ngAfterViewInit(){this._animationDisabled||this._elementRef.nativeElement.classList.add("mat-button-toggle-animations-enabled"),this._focusMonitor.monitor(this._elementRef,true);}ngOnDestroy(){let e=this.buttonToggleGroup;this._focusMonitor.stopMonitoring(this._elementRef),e&&e._isSelected(this)&&e._syncButtonToggle(this,false,false,true);}focus(e){this._buttonElement.nativeElement.focus(e);}_onButtonClick(){if(this.disabled)return;let e=this.isSingleSelector()?true:!this._checked;if(e!==this._checked&&(this._checked=e,this.buttonToggleGroup&&(this.buttonToggleGroup._syncButtonToggle(this,this._checked,true),this.buttonToggleGroup._onTouched())),this.isSingleSelector()){let t=this.buttonToggleGroup._buttonToggles.find(n=>n.tabIndex===0);t&&(t.tabIndex=-1),this.tabIndex=0;}this.change.emit(new K(this,this.value));}_markForCheck(){this._changeDetectorRef.markForCheck();}_getButtonName(){return this.isSingleSelector()?this.buttonToggleGroup.name:this.name||null}isSingleSelector(){return this.buttonToggleGroup&&!this.buttonToggleGroup.multiple}static \u0275fac=function(t){return new(t||l)};static \u0275cmp=Fw({type:l,selectors:[["mat-button-toggle"]],viewQuery:function(t,n){if(t&1&&Pg(Pt,5),t&2){let o;bC(o=SC())&&(n._buttonElement=o.first);}},hostAttrs:["role","presentation",1,"mat-button-toggle"],hostVars:14,hostBindings:function(t,n){t&1&&Rg("focus",function(){return n.focus()}),t&2&&(Tg("aria-label",null)("aria-labelledby",null)("id",n.id)("name",null),Ug("mat-button-toggle-standalone",!n.buttonToggleGroup)("mat-button-toggle-checked",n.checked)("mat-button-toggle-disabled",n.disabled)("mat-button-toggle-disabled-interactive",n.disabledInteractive)("mat-button-toggle-appearance-standard",n.appearance==="standard"));},inputs:{ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],id:"id",name:"name",value:"value",tabIndex:"tabIndex",disableRipple:[2,"disableRipple","disableRipple",JT],appearance:"appearance",checked:[2,"checked","checked",JT],disabled:[2,"disabled","disabled",JT],disabledInteractive:[2,"disabledInteractive","disabledInteractive",JT]},outputs:{change:"change"},exportAs:["matButtonToggle"],ngContentSelectors:Ot,decls:7,vars:13,consts:[["button",""],["type","button",1,"mat-button-toggle-button","mat-focus-indicator",3,"click","id","disabled"],[1,"mat-button-toggle-checkbox-wrapper"],[1,"mat-button-toggle-label-content"],[1,"mat-button-toggle-focus-overlay"],["matRipple","",1,"mat-button-toggle-ripple",3,"matRippleTrigger","matRippleDisabled"],["state","checked","aria-hidden","true","appearance","minimal",3,"disabled"]],template:function(t,n){if(t&1&&(wC(),ws(0,"button",1,0),Rg("click",function(){return n._onButtonClick()}),oC(2,Ft,2,1,"div",2),ws(3,"span",3),CC(4),hl()(),Sg(5,"span",4)(6,"span",5)),t&2){let o=MC(1);bg("id",n.buttonId)("disabled",n.disabled&&!n.disabledInteractive||null),Tg("role",n.isSingleSelector()?"radio":"button")("tabindex",n.disabled&&!n.disabledInteractive?-1:n.tabIndex)("aria-pressed",n.isSingleSelector()?null:n.checked)("aria-checked",n.isSingleSelector()?n.checked:null)("name",n._getButtonName())("aria-label",n.ariaLabel)("aria-labelledby",n.ariaLabelledby)("aria-disabled",n.disabled&&n.disabledInteractive?"true":null),nI(2),iC(n.buttonToggleGroup&&(!n.buttonToggleGroup.multiple&&!n.buttonToggleGroup.hideSingleSelectionIndicator||n.buttonToggleGroup.multiple&&!n.buttonToggleGroup.hideMultipleSelectionIndicator)?2:-1),nI(4),bg("matRippleTrigger",o)("matRippleDisabled",n.disableRipple||n.disabled);}},dependencies:[Oi,An],styles:[`.mat-button-toggle-standalone,
|
|
2
|
-
.mat-button-toggle-group {
|
|
3
|
-
position: relative;
|
|
4
|
-
display: inline-flex;
|
|
5
|
-
flex-direction: row;
|
|
6
|
-
white-space: nowrap;
|
|
7
|
-
overflow: hidden;
|
|
8
|
-
-webkit-tap-highlight-color: transparent;
|
|
9
|
-
border-radius: var(--mat-button-toggle-legacy-shape);
|
|
10
|
-
transform: translateZ(0);
|
|
11
|
-
}
|
|
12
|
-
.mat-button-toggle-standalone:not([class*=mat-elevation-z]),
|
|
13
|
-
.mat-button-toggle-group:not([class*=mat-elevation-z]) {
|
|
14
|
-
box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);
|
|
15
|
-
}
|
|
16
|
-
@media (forced-colors: active) {
|
|
17
|
-
.mat-button-toggle-standalone,
|
|
18
|
-
.mat-button-toggle-group {
|
|
19
|
-
outline: solid 1px;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.mat-button-toggle-standalone.mat-button-toggle-appearance-standard,
|
|
24
|
-
.mat-button-toggle-group-appearance-standard {
|
|
25
|
-
border-radius: var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));
|
|
26
|
-
border: solid 1px var(--mat-button-toggle-divider-color, var(--mat-sys-outline));
|
|
27
|
-
}
|
|
28
|
-
.mat-button-toggle-standalone.mat-button-toggle-appearance-standard .mat-pseudo-checkbox,
|
|
29
|
-
.mat-button-toggle-group-appearance-standard .mat-pseudo-checkbox {
|
|
30
|
-
--mat-pseudo-checkbox-minimal-selected-checkmark-color: var(--mat-button-toggle-selected-state-text-color, var(--mat-sys-on-secondary-container));
|
|
31
|
-
}
|
|
32
|
-
.mat-button-toggle-standalone.mat-button-toggle-appearance-standard:not([class*=mat-elevation-z]),
|
|
33
|
-
.mat-button-toggle-group-appearance-standard:not([class*=mat-elevation-z]) {
|
|
34
|
-
box-shadow: none;
|
|
35
|
-
}
|
|
36
|
-
@media (forced-colors: active) {
|
|
37
|
-
.mat-button-toggle-standalone.mat-button-toggle-appearance-standard,
|
|
38
|
-
.mat-button-toggle-group-appearance-standard {
|
|
39
|
-
outline: 0;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.mat-button-toggle-vertical {
|
|
44
|
-
flex-direction: column;
|
|
45
|
-
}
|
|
46
|
-
.mat-button-toggle-vertical .mat-button-toggle-label-content {
|
|
47
|
-
display: block;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.mat-button-toggle {
|
|
51
|
-
white-space: nowrap;
|
|
52
|
-
position: relative;
|
|
53
|
-
color: var(--mat-button-toggle-legacy-text-color);
|
|
54
|
-
font-family: var(--mat-button-toggle-legacy-label-text-font);
|
|
55
|
-
font-size: var(--mat-button-toggle-legacy-label-text-size);
|
|
56
|
-
line-height: var(--mat-button-toggle-legacy-label-text-line-height);
|
|
57
|
-
font-weight: var(--mat-button-toggle-legacy-label-text-weight);
|
|
58
|
-
letter-spacing: var(--mat-button-toggle-legacy-label-text-tracking);
|
|
59
|
-
--mat-pseudo-checkbox-minimal-selected-checkmark-color: var(--mat-button-toggle-legacy-selected-state-text-color);
|
|
60
|
-
}
|
|
61
|
-
.mat-button-toggle.cdk-keyboard-focused .mat-button-toggle-focus-overlay {
|
|
62
|
-
opacity: var(--mat-button-toggle-legacy-focus-state-layer-opacity);
|
|
63
|
-
}
|
|
64
|
-
.mat-button-toggle .mat-icon svg {
|
|
65
|
-
vertical-align: top;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.mat-button-toggle-checkbox-wrapper {
|
|
69
|
-
display: inline-block;
|
|
70
|
-
justify-content: flex-start;
|
|
71
|
-
align-items: center;
|
|
72
|
-
width: 0;
|
|
73
|
-
height: 18px;
|
|
74
|
-
line-height: 18px;
|
|
75
|
-
overflow: hidden;
|
|
76
|
-
box-sizing: border-box;
|
|
77
|
-
position: absolute;
|
|
78
|
-
top: 50%;
|
|
79
|
-
left: 16px;
|
|
80
|
-
transform: translate3d(0, -50%, 0);
|
|
81
|
-
}
|
|
82
|
-
[dir=rtl] .mat-button-toggle-checkbox-wrapper {
|
|
83
|
-
left: auto;
|
|
84
|
-
right: 16px;
|
|
85
|
-
}
|
|
86
|
-
.mat-button-toggle-appearance-standard .mat-button-toggle-checkbox-wrapper {
|
|
87
|
-
left: 12px;
|
|
88
|
-
}
|
|
89
|
-
[dir=rtl] .mat-button-toggle-appearance-standard .mat-button-toggle-checkbox-wrapper {
|
|
90
|
-
left: auto;
|
|
91
|
-
right: 12px;
|
|
92
|
-
}
|
|
93
|
-
.mat-button-toggle-checked .mat-button-toggle-checkbox-wrapper {
|
|
94
|
-
width: 18px;
|
|
95
|
-
}
|
|
96
|
-
.mat-button-toggle-animations-enabled .mat-button-toggle-checkbox-wrapper {
|
|
97
|
-
transition: width 150ms 45ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
98
|
-
}
|
|
99
|
-
.mat-button-toggle-vertical .mat-button-toggle-checkbox-wrapper {
|
|
100
|
-
transition: none;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.mat-button-toggle-checked {
|
|
104
|
-
color: var(--mat-button-toggle-legacy-selected-state-text-color);
|
|
105
|
-
background-color: var(--mat-button-toggle-legacy-selected-state-background-color);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.mat-button-toggle-disabled {
|
|
109
|
-
pointer-events: none;
|
|
110
|
-
color: var(--mat-button-toggle-legacy-disabled-state-text-color);
|
|
111
|
-
background-color: var(--mat-button-toggle-legacy-disabled-state-background-color);
|
|
112
|
-
--mat-pseudo-checkbox-minimal-disabled-selected-checkmark-color: var(--mat-button-toggle-legacy-disabled-state-text-color);
|
|
113
|
-
}
|
|
114
|
-
.mat-button-toggle-disabled.mat-button-toggle-checked {
|
|
115
|
-
background-color: var(--mat-button-toggle-legacy-disabled-selected-state-background-color);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.mat-button-toggle-disabled-interactive {
|
|
119
|
-
pointer-events: auto;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.mat-button-toggle-appearance-standard {
|
|
123
|
-
color: var(--mat-button-toggle-text-color, var(--mat-sys-on-surface));
|
|
124
|
-
background-color: var(--mat-button-toggle-background-color, transparent);
|
|
125
|
-
font-family: var(--mat-button-toggle-label-text-font, var(--mat-sys-label-large-font));
|
|
126
|
-
font-size: var(--mat-button-toggle-label-text-size, var(--mat-sys-label-large-size));
|
|
127
|
-
line-height: var(--mat-button-toggle-label-text-line-height, var(--mat-sys-label-large-line-height));
|
|
128
|
-
font-weight: var(--mat-button-toggle-label-text-weight, var(--mat-sys-label-large-weight));
|
|
129
|
-
letter-spacing: var(--mat-button-toggle-label-text-tracking, var(--mat-sys-label-large-tracking));
|
|
130
|
-
}
|
|
131
|
-
.mat-button-toggle-group-appearance-standard .mat-button-toggle-appearance-standard + .mat-button-toggle-appearance-standard {
|
|
132
|
-
border-left: solid 1px var(--mat-button-toggle-divider-color, var(--mat-sys-outline));
|
|
133
|
-
}
|
|
134
|
-
[dir=rtl] .mat-button-toggle-group-appearance-standard .mat-button-toggle-appearance-standard + .mat-button-toggle-appearance-standard {
|
|
135
|
-
border-left: none;
|
|
136
|
-
border-right: solid 1px var(--mat-button-toggle-divider-color, var(--mat-sys-outline));
|
|
137
|
-
}
|
|
138
|
-
.mat-button-toggle-group-appearance-standard.mat-button-toggle-vertical .mat-button-toggle-appearance-standard + .mat-button-toggle-appearance-standard {
|
|
139
|
-
border-left: none;
|
|
140
|
-
border-right: none;
|
|
141
|
-
border-top: solid 1px var(--mat-button-toggle-divider-color, var(--mat-sys-outline));
|
|
142
|
-
}
|
|
143
|
-
.mat-button-toggle-appearance-standard.mat-button-toggle-checked {
|
|
144
|
-
color: var(--mat-button-toggle-selected-state-text-color, var(--mat-sys-on-secondary-container));
|
|
145
|
-
background-color: var(--mat-button-toggle-selected-state-background-color, var(--mat-sys-secondary-container));
|
|
146
|
-
}
|
|
147
|
-
.mat-button-toggle-appearance-standard.mat-button-toggle-disabled {
|
|
148
|
-
color: var(--mat-button-toggle-disabled-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));
|
|
149
|
-
background-color: var(--mat-button-toggle-disabled-state-background-color, transparent);
|
|
150
|
-
}
|
|
151
|
-
.mat-button-toggle-appearance-standard.mat-button-toggle-disabled .mat-pseudo-checkbox {
|
|
152
|
-
--mat-pseudo-checkbox-minimal-disabled-selected-checkmark-color: var(--mat-button-toggle-disabled-selected-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));
|
|
153
|
-
}
|
|
154
|
-
.mat-button-toggle-appearance-standard.mat-button-toggle-disabled.mat-button-toggle-checked {
|
|
155
|
-
color: var(--mat-button-toggle-disabled-selected-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));
|
|
156
|
-
background-color: var(--mat-button-toggle-disabled-selected-state-background-color, color-mix(in srgb, var(--mat-sys-on-surface) 12%, transparent));
|
|
157
|
-
}
|
|
158
|
-
.mat-button-toggle-appearance-standard .mat-button-toggle-focus-overlay {
|
|
159
|
-
background-color: var(--mat-button-toggle-state-layer-color, var(--mat-sys-on-surface));
|
|
160
|
-
}
|
|
161
|
-
.mat-button-toggle-appearance-standard:hover .mat-button-toggle-focus-overlay {
|
|
162
|
-
opacity: var(--mat-button-toggle-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity));
|
|
163
|
-
}
|
|
164
|
-
.mat-button-toggle-appearance-standard.cdk-keyboard-focused .mat-button-toggle-focus-overlay {
|
|
165
|
-
opacity: var(--mat-button-toggle-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity));
|
|
166
|
-
}
|
|
167
|
-
@media (hover: none) {
|
|
168
|
-
.mat-button-toggle-appearance-standard:hover .mat-button-toggle-focus-overlay {
|
|
169
|
-
display: none;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
.mat-button-toggle-label-content {
|
|
174
|
-
-webkit-user-select: none;
|
|
175
|
-
user-select: none;
|
|
176
|
-
display: inline-block;
|
|
177
|
-
padding: 0 16px;
|
|
178
|
-
line-height: var(--mat-button-toggle-legacy-height);
|
|
179
|
-
position: relative;
|
|
180
|
-
}
|
|
181
|
-
.mat-button-toggle-appearance-standard .mat-button-toggle-label-content {
|
|
182
|
-
padding: 0 12px;
|
|
183
|
-
line-height: var(--mat-button-toggle-height, 40px);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
.mat-button-toggle-label-content > * {
|
|
187
|
-
vertical-align: middle;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
.mat-button-toggle-focus-overlay {
|
|
191
|
-
top: 0;
|
|
192
|
-
left: 0;
|
|
193
|
-
right: 0;
|
|
194
|
-
bottom: 0;
|
|
195
|
-
position: absolute;
|
|
196
|
-
border-radius: inherit;
|
|
197
|
-
pointer-events: none;
|
|
198
|
-
opacity: 0;
|
|
199
|
-
background-color: var(--mat-button-toggle-legacy-state-layer-color);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
@media (forced-colors: active) {
|
|
203
|
-
.mat-button-toggle-checked .mat-button-toggle-focus-overlay {
|
|
204
|
-
border-bottom: solid 500px;
|
|
205
|
-
opacity: 0.5;
|
|
206
|
-
height: 0;
|
|
207
|
-
}
|
|
208
|
-
.mat-button-toggle-checked:hover .mat-button-toggle-focus-overlay {
|
|
209
|
-
opacity: 0.6;
|
|
210
|
-
}
|
|
211
|
-
.mat-button-toggle-checked.mat-button-toggle-appearance-standard .mat-button-toggle-focus-overlay {
|
|
212
|
-
border-bottom: solid 500px;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
.mat-button-toggle .mat-button-toggle-ripple {
|
|
216
|
-
top: 0;
|
|
217
|
-
left: 0;
|
|
218
|
-
right: 0;
|
|
219
|
-
bottom: 0;
|
|
220
|
-
position: absolute;
|
|
221
|
-
pointer-events: none;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
.mat-button-toggle-button {
|
|
225
|
-
border: 0;
|
|
226
|
-
background: none;
|
|
227
|
-
color: inherit;
|
|
228
|
-
padding: 0;
|
|
229
|
-
margin: 0;
|
|
230
|
-
font: inherit;
|
|
231
|
-
outline: none;
|
|
232
|
-
width: 100%;
|
|
233
|
-
cursor: pointer;
|
|
234
|
-
}
|
|
235
|
-
.mat-button-toggle-animations-enabled .mat-button-toggle-button {
|
|
236
|
-
transition: padding 150ms 45ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
237
|
-
}
|
|
238
|
-
.mat-button-toggle-vertical .mat-button-toggle-button {
|
|
239
|
-
transition: none;
|
|
240
|
-
}
|
|
241
|
-
.mat-button-toggle-disabled .mat-button-toggle-button {
|
|
242
|
-
cursor: default;
|
|
243
|
-
}
|
|
244
|
-
.mat-button-toggle-button::-moz-focus-inner {
|
|
245
|
-
border: 0;
|
|
246
|
-
}
|
|
247
|
-
.mat-button-toggle-checked .mat-button-toggle-button:has(.mat-button-toggle-checkbox-wrapper) {
|
|
248
|
-
padding-left: 30px;
|
|
249
|
-
}
|
|
250
|
-
[dir=rtl] .mat-button-toggle-checked .mat-button-toggle-button:has(.mat-button-toggle-checkbox-wrapper) {
|
|
251
|
-
padding-left: 0;
|
|
252
|
-
padding-right: 30px;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
.mat-button-toggle-standalone.mat-button-toggle-appearance-standard {
|
|
256
|
-
--mat-focus-indicator-border-radius: var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
.mat-button-toggle-group-appearance-standard:not(.mat-button-toggle-vertical) .mat-button-toggle:last-of-type .mat-button-toggle-button::before {
|
|
260
|
-
border-top-right-radius: var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));
|
|
261
|
-
border-bottom-right-radius: var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));
|
|
262
|
-
}
|
|
263
|
-
.mat-button-toggle-group-appearance-standard:not(.mat-button-toggle-vertical) .mat-button-toggle:first-of-type .mat-button-toggle-button::before {
|
|
264
|
-
border-top-left-radius: var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));
|
|
265
|
-
border-bottom-left-radius: var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
.mat-button-toggle-group-appearance-standard.mat-button-toggle-vertical .mat-button-toggle:last-of-type .mat-button-toggle-button::before {
|
|
269
|
-
border-bottom-right-radius: var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));
|
|
270
|
-
border-bottom-left-radius: var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));
|
|
271
|
-
}
|
|
272
|
-
.mat-button-toggle-group-appearance-standard.mat-button-toggle-vertical .mat-button-toggle:first-of-type .mat-button-toggle-button::before {
|
|
273
|
-
border-top-right-radius: var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));
|
|
274
|
-
border-top-left-radius: var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));
|
|
275
|
-
}
|
|
276
|
-
`],encapsulation:2})}return l})(),Mt=(()=>{class l{static \u0275fac=function(t){return new(t||l)};static \u0275mod=Eo({type:l});static \u0275inj=qn({imports:[sn,X,wt$1]})}return l})();var Wt=(l,a)=>a.id,Nt=(l,a)=>a.value;function Gt(l,a){l&1&&(ws(0,"mat-option",5),QC(1,"Loading prompts..."),hl());}function zt(l,a){if(l&1&&(ws(0,"mat-option",6),QC(1),hl()),l&2){let e=a.$implicit;bg("value",e.id),nI(),Dl(" ",e.name," ");}}function Ut(l,a){if(l&1){let e=gC();ws(0,"mat-checkbox",37),Rg("change",function(){let n=wf(e).$implicit,o=EC();return Cf(o.toggleDayOfWeek(n.value))}),QC(1),hl();}if(l&2){let e=a.$implicit,t=EC();bg("checked",t.isDaySelected(e.value)),nI(),Dl(" ",e.label," ");}}function qt(l,a){if(l&1){let e=gC();ws(0,"mat-form-field",2)(1,"mat-label"),QC(2,"Number of Occurrences"),hl(),ws(3,"input",11),em("ngModelChange",function(n){wf(e);let o=EC();return tT(o.endOccurrences,n)||(o.endOccurrences=n),Cf(n)}),hl(),GI(),hl();}if(l&2){let e=EC();nI(3),Jg("ngModel",e.endOccurrences),qI();}}function Ht(l,a){if(l&1){let e=gC();ws(0,"mat-form-field",2)(1,"mat-label"),QC(2,"End Date"),hl(),ws(3,"input",38),em("ngModelChange",function(n){wf(e);let o=EC();return tT(o.endTimestamp,n)||(o.endTimestamp=n),Cf(n)}),hl(),GI(),hl();}if(l&2){let e=EC();nI(3),Jg("ngModel",e.endTimestamp),qI();}}function jt(l,a){if(l&1){let e=gC();ws(0,"div")(1,"mat-form-field",2)(2,"mat-label"),QC(3,"Parameter Value"),hl(),ws(4,"input",39),em("ngModelChange",function(n){wf(e);let o=EC();return tT(o.simpleParameter,n)||(o.simpleParameter=n),Cf(n)}),hl(),GI(),ws(5,"mat-hint"),QC(6),hl()()();}if(l&2){let e=EC();nI(4),Jg("ngModel",e.simpleParameter),qI(),nI(2),Dl("Simple value for ","{{PARAMETERS}}"," placeholder or appended to first command");}}function Qt(l,a){if(l&1){let e=gC();ws(0,"div",42)(1,"mat-form-field",43)(2,"mat-label"),QC(3,"Key"),hl(),ws(4,"input",44),em("ngModelChange",function(n){let o=wf(e).$implicit;return tT(o.key,n)||(o.key=n),Cf(n)}),hl(),GI(),hl(),ws(5,"mat-form-field",45)(6,"mat-label"),QC(7,"Value"),hl(),ws(8,"input",46),em("ngModelChange",function(n){let o=wf(e).$implicit;return tT(o.value,n)||(o.value=n),Cf(n)}),hl(),GI(),hl(),ws(9,"button",47),Rg("click",function(){let n=wf(e).$index,o=EC(3);return Cf(o.removeParameter(n))}),ws(10,"mat-icon"),QC(11,"delete"),hl()()();}if(l&2){let e=a.$implicit;nI(4),Jg("ngModel",e.key),qI(),nI(4),Jg("ngModel",e.value),qI();}}function $t(l,a){if(l&1&&(ws(0,"div",41),cC(1,Qt,12,2,"div",42,sC),hl()),l&2){let e=EC(2);nI(),uC(e.parameters);}}function Kt(l,a){if(l&1){let e=gC();ws(0,"div")(1,"div",28)(2,"button",40),Rg("click",function(){wf(e);let n=EC();return Cf(n.addParameter())}),ws(3,"mat-icon"),QC(4,"add"),hl()()(),oC(5,$t,3,0,"div",41),ws(6,"p",21),QC(7),hl()();}if(l&2){let e=EC();nI(5),iC(e.parameters.length>0?5:-1),nI(2),Dl("Key-value pairs for ","{{key}}"," placeholders in prompt commands");}}function Xt(l,a){if(l&1&&(ws(0,"div",33)(1,"mat-icon"),QC(2,"error"),hl(),ws(3,"span"),QC(4),hl()()),l&2){let e=EC();nI(4),Yg(e.errorMessage);}}var B=class l{schedulerApi=g(xe);promptApi=g(d);dialogRef=g(z);availablePrompts=[];isLoadingPrompts=false;name="";promptId="";enabled=true;startTimestamp="";intervalValue=1;intervalUnit="h";daysOfWeek=[];endConditionType="none";endOccurrences=10;endTimestamp="";parameterMode="simple";simpleParameter="";parameters=[];isSaving=false;errorMessage="";isEditMode=false;schedulerId="";data=g(Ue);daysOfWeekOptions=[{value:0,label:"Sunday"},{value:1,label:"Monday"},{value:2,label:"Tuesday"},{value:3,label:"Wednesday"},{value:4,label:"Thursday"},{value:5,label:"Friday"},{value:6,label:"Saturday"}];constructor(){this.isEditMode=this.data.mode==="edit";}ngOnInit(){if(this.loadPrompts(),this.isEditMode||(this.startTimestamp=this.formatDateForInput(new Date)),this.isEditMode&&this.data.scheduler){if(this.schedulerId=this.data.scheduler.id,this.name=this.data.scheduler.name,this.promptId=this.data.scheduler.promptId??"",this.enabled=this.data.scheduler.enabled,this.data.scheduler.schedule.startTimestamp){let e=new Date(this.data.scheduler.schedule.startTimestamp);this.startTimestamp=this.formatDateForInput(e);}let a=this.data.scheduler.schedule.interval.match(/^(\d+)(min|h|d|M)$/);a&&a[1]&&a[2]&&(this.intervalValue=parseInt(a[1],10),this.intervalUnit=a[2]),this.daysOfWeek=this.data.scheduler.schedule.daysOfWeek||[],this.data.scheduler.schedule.endCondition&&(this.endConditionType=this.data.scheduler.schedule.endCondition.type,this.endConditionType==="occurrences"?this.endOccurrences=this.data.scheduler.schedule.endCondition.value:this.endConditionType==="endTimestamp"&&(this.endTimestamp=this.data.scheduler.schedule.endCondition.value)),this.data.scheduler.parameters&&(typeof this.data.scheduler.parameters=="object"&&Object.keys(this.data.scheduler.parameters).length===1&&"PARAMETERS"in this.data.scheduler.parameters?(this.parameterMode="simple",this.simpleParameter=String(this.data.scheduler.parameters.PARAMETERS)):(this.parameterMode="structured",this.parameters=Object.entries(this.data.scheduler.parameters).map(([e,t])=>({key:e,value:String(t)}))));}}loadPrompts(){this.isLoadingPrompts=true,this.promptApi.listPrompts().subscribe({next:a=>{this.availablePrompts=a,this.isLoadingPrompts=false;},error:a=>{console.error("Error loading prompts:",a),this.errorMessage="Failed to load prompts",this.isLoadingPrompts=false;}});}toggleDayOfWeek(a){let e=this.daysOfWeek.indexOf(a);e>-1?this.daysOfWeek.splice(e,1):this.daysOfWeek.push(a),this.daysOfWeek.sort();}isDaySelected(a){return this.daysOfWeek.includes(a)}addParameter(){this.parameters.push({key:"",value:""});}removeParameter(a){this.parameters.splice(a,1);}trackByIndex(a){return a}formatDateForInput(a){let e=a.getFullYear(),t=String(a.getMonth()+1).padStart(2,"0"),n=String(a.getDate()).padStart(2,"0"),o=String(a.getHours()).padStart(2,"0"),u=String(a.getMinutes()).padStart(2,"0");return `${e}-${t}-${n}T${o}:${u}`}validateForm(){if(!this.name.trim())return this.errorMessage="Name is required",false;if(!this.promptId)return this.errorMessage="Prompt is required",false;if(this.intervalValue<1)return this.errorMessage="Interval must be at least 1",false;switch(this.intervalUnit){case "min":if(this.intervalValue>59)return this.errorMessage="Minutes interval must be between 1 and 59 (use hours for longer)",false;break;case "h":if(this.intervalValue>24)return this.errorMessage="Hours interval must be between 1 and 24 (use days for longer)",false;break;case "d":if(this.intervalValue>31)return this.errorMessage="Days interval must be between 1 and 31 (use months for longer)",false;break;case "M":if(this.intervalValue>12)return this.errorMessage="Months interval must be between 1 and 12",false;break}return this.endConditionType==="occurrences"&&this.endOccurrences<1?(this.errorMessage="Occurrences must be at least 1",false):this.endConditionType==="endTimestamp"&&!this.endTimestamp?(this.errorMessage="End date is required",false):true}buildSchedule(){let e={startTimestamp:(this.startTimestamp?new Date(this.startTimestamp):new Date).toISOString(),interval:`${this.intervalValue}${this.intervalUnit}`};return this.daysOfWeek.length>0&&(e.daysOfWeek=[...this.daysOfWeek]),this.endConditionType==="occurrences"?e.endCondition={type:"occurrences",value:this.endOccurrences}:this.endConditionType==="endTimestamp"&&(e.endCondition={type:"endTimestamp",value:this.endTimestamp}),e}buildParameters(){if(this.parameterMode==="simple")return this.simpleParameter.trim()?{PARAMETERS:this.simpleParameter.trim()}:void 0;let a=this.parameters.filter(t=>t.key.trim());if(a.length===0)return;let e={};return a.forEach(t=>{e[t.key]=t.value;}),e}save(){if(this.errorMessage="",!this.validateForm())return;let a=this.buildSchedule(),e=this.buildParameters();this.isSaving=true,this.isEditMode&&this.schedulerId?this.schedulerApi.updateScheduler(this.schedulerId,{name:this.name.trim(),enabled:this.enabled,promptId:this.promptId,schedule:a,parameters:e}).subscribe({next:()=>{this.isSaving=false,this.dialogRef.close(true);},error:t=>{console.error("Error updating scheduler:",t),this.errorMessage=t?.error?.error||t?.message||"Failed to update scheduler",this.isSaving=false;}}):this.schedulerApi.createScheduler({name:this.name.trim(),promptId:this.promptId,schedule:a,parameters:e,enabled:this.enabled}).subscribe({next:()=>{this.isSaving=false,this.dialogRef.close(true);},error:t=>{console.error("Error creating scheduler:",t),this.errorMessage=t?.error?.error||t?.message||"Failed to create scheduler",this.isSaving=false;}});}cancel(){this.dialogRef.close(false);}static \u0275fac=function(e){return new(e||l)};static \u0275cmp=Fw({type:l,selectors:[["app-scheduler-form"]],decls:90,vars:20,consts:[["mat-dialog-title",""],[1,"form-container"],["appearance","outline",1,"full-width"],["matInput","","placeholder","My Scheduler","required","",3,"ngModelChange","ngModel"],["required","",3,"ngModelChange","ngModel","disabled"],["disabled",""],[3,"value"],["matInput","","type","datetime-local",3,"ngModelChange","ngModel"],[1,"interval-section"],[1,"interval-fields"],["appearance","outline",1,"interval-value"],["matInput","","type","number","min","1","required","",3,"ngModelChange","ngModel"],["appearance","outline",1,"interval-unit"],["required","",3,"ngModelChange","ngModel"],["value","min"],["value","h"],["value","d"],["value","M"],[1,"days-section"],[1,"days-checkboxes"],[3,"checked"],[1,"hint"],[1,"end-condition-section"],[3,"ngModelChange","ngModel"],["value","none"],["value","occurrences"],["value","endTimestamp"],[1,"parameters-section"],[1,"section-header"],[1,"mode-toggle",3,"ngModelChange","ngModel"],["value","simple"],["value","structured"],[1,"enabled-section"],[1,"error-message"],["align","end"],["mat-button","",3,"click","disabled"],["mat-raised-button","","color","primary",3,"click","disabled"],[3,"change","checked"],["matInput","","type","datetime-local","required","",3,"ngModelChange","ngModel"],["matInput","","placeholder","e.g., 1234 or staging",3,"ngModelChange","ngModel"],["mat-icon-button","","type","button","title","Add parameter",3,"click"],[1,"parameters-list"],[1,"parameter-item"],["appearance","outline",1,"param-key"],["matInput","","placeholder","parameterName",3,"ngModelChange","ngModel"],["appearance","outline",1,"param-value"],["matInput","","placeholder","value",3,"ngModelChange","ngModel"],["mat-icon-button","","type","button","title","Remove parameter",1,"remove-btn",3,"click"]],template:function(e,t){e&1&&(ws(0,"h2",0),QC(1),hl(),ws(2,"mat-dialog-content")(3,"div",1)(4,"mat-form-field",2)(5,"mat-label"),QC(6,"Name"),hl(),ws(7,"input",3),em("ngModelChange",function(o){return tT(t.name,o)||(t.name=o),o}),hl(),GI(),ws(8,"mat-hint"),QC(9,"A descriptive name for this scheduler"),hl()(),ws(10,"mat-form-field",2)(11,"mat-label"),QC(12,"Prompt"),hl(),ws(13,"mat-select",4),em("ngModelChange",function(o){return tT(t.promptId,o)||(t.promptId=o),o}),oC(14,Gt,2,0,"mat-option",5),cC(15,zt,2,2,"mat-option",6,Wt),hl(),GI(),ws(17,"mat-hint"),QC(18),hl()(),ws(19,"mat-form-field",2)(20,"mat-label"),QC(21,"Start Date & Time"),hl(),ws(22,"input",7),em("ngModelChange",function(o){return tT(t.startTimestamp,o)||(t.startTimestamp=o),o}),hl(),GI(),ws(23,"mat-hint"),QC(24,"When to start the scheduler (leave empty for now)"),hl()(),ws(25,"div",8)(26,"h3"),QC(27,"Schedule Interval"),hl(),ws(28,"div",9)(29,"mat-form-field",10)(30,"mat-label"),QC(31,"Every"),hl(),ws(32,"input",11),em("ngModelChange",function(o){return tT(t.intervalValue,o)||(t.intervalValue=o),o}),hl(),GI(),hl(),ws(33,"mat-form-field",12)(34,"mat-label"),QC(35,"Unit"),hl(),ws(36,"mat-select",13),em("ngModelChange",function(o){return tT(t.intervalUnit,o)||(t.intervalUnit=o),o}),ws(37,"mat-option",14),QC(38,"Minutes (1-59)"),hl(),ws(39,"mat-option",15),QC(40,"Hours (1-24)"),hl(),ws(41,"mat-option",16),QC(42,"Days (1-31)"),hl(),ws(43,"mat-option",17),QC(44,"Months (1-12)"),hl()(),GI(),hl()()(),ws(45,"div",18)(46,"h3"),QC(47,"Days of Week (Optional)"),hl(),ws(48,"div",19),cC(49,Ut,2,2,"mat-checkbox",20,Nt),hl(),ws(51,"p",21),QC(52,"Leave empty to run every day"),hl()(),ws(53,"div",22)(54,"h3"),QC(55,"End Condition (Optional)"),hl(),ws(56,"mat-form-field",2)(57,"mat-label"),QC(58,"End Type"),hl(),ws(59,"mat-select",23),em("ngModelChange",function(o){return tT(t.endConditionType,o)||(t.endConditionType=o),o}),ws(60,"mat-option",24),QC(61,"Never (run indefinitely)"),hl(),ws(62,"mat-option",25),QC(63,"After X occurrences"),hl(),ws(64,"mat-option",26),QC(65,"Until specific date"),hl()(),GI(),hl(),oC(66,qt,4,1,"mat-form-field",2),oC(67,Ht,4,1,"mat-form-field",2),hl(),ws(68,"div",27)(69,"div",28)(70,"h3"),QC(71,"Parameters (Optional)"),hl(),ws(72,"mat-button-toggle-group",29),em("ngModelChange",function(o){return tT(t.parameterMode,o)||(t.parameterMode=o),o}),ws(73,"mat-button-toggle",30),QC(74,"Simple"),hl(),ws(75,"mat-button-toggle",31),QC(76,"Structured"),hl()(),GI(),hl(),oC(77,jt,7,2,"div"),oC(78,Kt,8,2,"div"),hl(),ws(79,"div",32)(80,"mat-checkbox",23),em("ngModelChange",function(o){return tT(t.enabled,o)||(t.enabled=o),o}),QC(81,"Enabled"),hl(),GI(),ws(82,"p",21),QC(83,"Scheduler will only run if enabled"),hl()(),oC(84,Xt,5,1,"div",33),hl()(),ws(85,"mat-dialog-actions",34)(86,"button",35),Rg("click",function(){return t.cancel()}),QC(87,"Cancel"),hl(),ws(88,"button",36),Rg("click",function(){return t.save()}),QC(89),hl()()),e&2&&(nI(),Yg(t.isEditMode?"Edit Scheduler":"Create Scheduler"),nI(6),Jg("ngModel",t.name),qI(),nI(6),Jg("ngModel",t.promptId),bg("disabled",t.isLoadingPrompts),qI(),nI(),iC(t.isLoadingPrompts?14:-1),nI(),uC(t.availablePrompts),nI(3),Yg(t.isLoadingPrompts?"Loading available prompts...":"Select the prompt to execute"),nI(4),Jg("ngModel",t.startTimestamp),qI(),nI(10),Jg("ngModel",t.intervalValue),qI(),nI(4),Jg("ngModel",t.intervalUnit),qI(),nI(13),uC(t.daysOfWeekOptions),nI(10),Jg("ngModel",t.endConditionType),qI(),nI(7),iC(t.endConditionType==="occurrences"?66:-1),nI(),iC(t.endConditionType==="endTimestamp"?67:-1),nI(5),Jg("ngModel",t.parameterMode),qI(),nI(5),iC(t.parameterMode==="simple"?77:-1),nI(),iC(t.parameterMode==="structured"?78:-1),nI(2),Jg("ngModel",t.enabled),qI(),nI(4),iC(t.errorMessage?84:-1),nI(2),bg("disabled",t.isSaving),nI(2),bg("disabled",t.isSaving),nI(),Dl(" ",t.isSaving?"Saving...":"Save"," "));},dependencies:[Wm,ti,Ye,fn,Zn,gt,$t$1,cn,zt$1,jt$1,Vt,Nt$1,hr,pr,Gn,Tn,Sn,nt,ae,le,ce,yt$1,wt,Pt$1,Lt,Fn,ve,ne,Mt,ie,X],styles:[".form-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;padding:0;min-width:600px}@media(max-width:768px){.form-container[_ngcontent-%COMP%]{min-width:auto}}.full-width[_ngcontent-%COMP%]{width:100%}.interval-section[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0 0 .5rem;font-size:1rem;font-weight:600}.interval-section[_ngcontent-%COMP%] .interval-fields[_ngcontent-%COMP%]{display:flex;gap:1rem}.interval-section[_ngcontent-%COMP%] .interval-fields[_ngcontent-%COMP%] .interval-value[_ngcontent-%COMP%], .interval-section[_ngcontent-%COMP%] .interval-fields[_ngcontent-%COMP%] .interval-unit[_ngcontent-%COMP%]{flex:1}.days-section[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0 0 .5rem;font-size:1rem;font-weight:600}.days-section[_ngcontent-%COMP%] .days-checkboxes[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:1rem;margin-bottom:.5rem}.days-section[_ngcontent-%COMP%] .days-checkboxes[_ngcontent-%COMP%] mat-checkbox[_ngcontent-%COMP%]{min-width:120px}.days-section[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary)}.end-condition-section[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0 0 .5rem;font-size:1rem;font-weight:600}.parameters-section[_ngcontent-%COMP%] .section-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;margin-bottom:.5rem}.parameters-section[_ngcontent-%COMP%] .section-header[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0;font-size:1rem;font-weight:600}.parameters-section[_ngcontent-%COMP%] .section-header[_ngcontent-%COMP%] .mode-toggle[_ngcontent-%COMP%]{height:32px}.parameters-section[_ngcontent-%COMP%] .parameters-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem}.parameters-section[_ngcontent-%COMP%] .parameter-item[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem}.parameters-section[_ngcontent-%COMP%] .parameter-item[_ngcontent-%COMP%] .param-key[_ngcontent-%COMP%]{flex:1}.parameters-section[_ngcontent-%COMP%] .parameter-item[_ngcontent-%COMP%] .param-value[_ngcontent-%COMP%]{flex:2}.parameters-section[_ngcontent-%COMP%] .parameter-item[_ngcontent-%COMP%] .remove-btn[_ngcontent-%COMP%]{margin-top:8px}.parameters-section[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:.5rem 0 0;font-size:.85rem;color:var(--color-text-secondary)}.enabled-section[_ngcontent-%COMP%]{padding:1rem;background:var(--color-surface);border-radius:8px;border:1px solid var(--color-border)}.enabled-section[_ngcontent-%COMP%] mat-checkbox[_ngcontent-%COMP%]{display:block;margin-bottom:.5rem}.enabled-section[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary)}.error-message[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem;background:#f443361a;border:1px solid var(--color-error);border-radius:4px;color:var(--color-error)}.error-message[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem}.error-message[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{flex:1}"],changeDetection:1})};var Yt=()=>[],Zt=l=>({id:l});function Jt(l,a){if(l&1&&(ws(0,"div",6),QC(1),hl()),l&2){let e=EC();nI(),Yg(e.errorMessage());}}function en(l,a){if(l&1){let e=gC();ws(0,"ds-entity-card",8),Rg("selected",function(n){wf(e);let o=EC();return Cf(o.onEdit(n))}),yl(1,9),ws(2,"button",10),Rg("click",function(n){return n.stopPropagation()}),ws(3,"mat-icon"),QC(4,"more_vert"),hl()(),vl(),hl();}if(l&2){let e=a.$implicit;EC();let t=MC(11);bg("id",e.id)("name",e.name)("description",e.description)("badges",e.badges??aT(6,Yt)),nI(2),bg("matMenuTriggerFor",t)("matMenuTriggerData",cT(7,Zt,e.id));}}function tn(l,a){if(l&1){let e=gC();ws(0,"button",11),Rg("click",function(){let n=wf(e).id,o=EC();return Cf(o.onEdit(n))}),ws(1,"mat-icon"),QC(2,"edit"),hl(),QC(3," Edit "),hl(),ws(4,"button",11),Rg("click",function(){let n=wf(e).id,o=EC();return Cf(o.onToggleEnabled(n))}),ws(5,"mat-icon"),QC(6),hl(),QC(7),hl(),ws(8,"button",11),Rg("click",function(){let n=wf(e).id,o=EC();return Cf(o.onRunNow(n))}),ws(9,"mat-icon"),QC(10,"play_arrow"),hl(),QC(11," Run now "),hl(),ws(12,"button",12),Rg("click",function(){let n=wf(e).id,o=EC();return Cf(o.onDelete(n))}),ws(13,"mat-icon"),QC(14,"delete"),hl(),QC(15," Delete "),hl();}if(l&2){let e=a.id,t=EC();nI(6),Yg(t.isEnabled(e)?"pause_circle":"play_circle"),nI(),Dl(" ",t.isEnabled(e)?"Disable":"Enable"," ");}}var Ct=class l{schedulerApi=g(xe);promptApi=g(d);configApi=g(W);location=g(_m);dialog=g(Re);schedulers=Gi([]);prompts=Gi([]);isLoading=Gi(false);errorMessage=Gi(null);showOnlyMine=Gi(true);currentUsername=Gi("");schedulerItems=ET(()=>{let a=this.schedulers(),e=this.currentUsername(),n=this.showOnlyMine()&&e?a.filter(C=>this.isMyScheduler(C)):a,u=[...new Set(n.map(C=>C.createdBy))].sort((C,F)=>C===e&&F!==e?-1:F===e&&C!==e?1:C.localeCompare(F)),I=[];for(let C of u){let F=C===e?`${C} (you)`:C;for(let V of n.filter(St=>St.createdBy===C))I.push({id:V.id,name:V.name,description:this.buildDescription(V),badges:this.buildBadges(V),groupKey:C,groupLabel:F});}return I});ngOnInit(){this.configApi.getUserConfig().subscribe({next:a=>this.currentUsername.set(a.username??""),error:()=>{}}),this.loadPrompts(),this.loadSchedulers();}loadPrompts(){this.promptApi.listPrompts().subscribe({next:a=>this.prompts.set(a),error:()=>{}});}loadSchedulers(){this.isLoading.set(true),this.schedulerApi.listSchedulers().subscribe({next:a=>{this.schedulers.set(a),this.isLoading.set(false);},error:a=>{this.errorMessage.set(a?.error?.error??"Failed to load schedulers"),this.isLoading.set(false);}});}onBack(){this.location.back();}onCreate(){this.dialog.open(B,{width:"700px",maxHeight:"90vh",data:{mode:"create"}}).afterClosed().subscribe(e=>{e&&this.loadSchedulers();});}onEdit(a){this.schedulerApi.getScheduler(a).subscribe({next:e=>{this.dialog.open(B,{width:"700px",maxHeight:"90vh",data:{mode:"edit",scheduler:e}}).afterClosed().subscribe(n=>{n&&this.loadSchedulers();});},error:e=>this.errorMessage.set(e?.error?.error??"Failed to load scheduler")});}onToggleEnabled(a){let e=this.schedulers().find(n=>n.id===a);if(!e)return;(e.enabled?this.schedulerApi.disableScheduler(a):this.schedulerApi.enableScheduler(a)).subscribe({next:()=>this.loadSchedulers(),error:n=>this.errorMessage.set(n?.error?.error??"Failed to toggle scheduler")});}onRunNow(a){this.schedulerApi.runSchedulerNow(a).subscribe({next:e=>{alert(`Scheduler executed successfully! Thread ID: ${e.threadId}`),this.loadSchedulers();},error:e=>this.errorMessage.set(e?.error?.error??"Failed to run scheduler")});}onDelete(a){confirm("Are you sure you want to delete this scheduler?")&&this.schedulerApi.deleteScheduler(a).subscribe({next:()=>this.loadSchedulers(),error:e=>this.errorMessage.set(e?.error?.error??"Failed to delete scheduler")});}isEnabled(a){return this.schedulers().find(e=>e.id===a)?.enabled??false}buildDescription(a){let e;if(a.promptId)e=this.getPromptName(a.promptId);else if(a.agentName&&a.instruction){let o=a.instruction.length>40?a.instruction.slice(0,40)+"\u2026":a.instruction;e=`${a.agentName}: ${o}`;}else console.error(`Scheduler "${a.name}" (${a.id}) has neither promptId nor agentName+instruction`),e="Unknown source";let t=this.formatInterval(a.schedule.interval),n=a.nextRun?new Date(a.nextRun).toLocaleString():"Expired";return `${e} \xB7 ${t} \xB7 Next: ${n}`}buildBadges(a){return [a.enabled?{label:"enabled",variant:"success"}:{label:"disabled",variant:"warning"}]}getPromptName(a){let e=this.prompts().find(t=>t.id===a);return e?e.name:a}formatInterval(a){let e=/^(\d+)(min|h|d|M)$/.exec(a);if(!e)return a;let[,t,n]=e;if(!t||!n)return a;let u={min:"minute",h:"hour",d:"day",M:"month"}[n]??n;return `Every ${t} ${u}${parseInt(t,10)>1?"s":""}`}isMyScheduler(a){let e=t=>t.replace(/[.\s]+/g,"_").toLowerCase();return e(a.createdBy)===e(this.currentUsername())}static \u0275fac=function(e){return new(e||l)};static \u0275cmp=Fw({type:l,selectors:[["app-scheduler-list"]],decls:13,vars:6,consts:[["schedulerCard",""],["cardMenu","matMenu"],[1,"scheduler-list-page"],["title","Schedulers","cardMinWidth","384px","contentMaxWidth","1400px","searchPlaceholder","Filter schedulers\u2026","emptyMessage","No schedulers found.",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","mat-icon-button","","title","Back",3,"click"],["toolbar-extras","","color","primary",1,"scheduler-list__mine-toggle",3,"ngModelChange","ngModel"],[1,"scheduler-list__error"],["matMenuContent",""],[3,"selected","id","name","description","badges"],["dsCardActions",""],["mat-icon-button","",3,"click","matMenuTriggerFor","matMenuTriggerData"],["mat-menu-item","",3,"click"],["mat-menu-item","",1,"scheduler-list__delete-item",3,"click"]],template:function(e,t){if(e&1&&(ws(0,"div",2)(1,"ds-entity-list",3),Rg("createRequested",function(){return t.onCreate()}),ws(2,"button",4),Rg("click",function(){return t.onBack()}),ws(3,"mat-icon"),QC(4,"chevron_left"),hl()(),ws(5,"mat-slide-toggle",5),Rg("ngModelChange",function(o){return t.showOnlyMine.set(o)}),QC(6," Mine "),hl(),GI(),hl(),oC(7,Jt,2,1,"div",6),hl(),Eg(8,en,5,9,"ng-template",null,0,mT),ws(10,"mat-menu",null,1),Eg(12,tn,16,2,"ng-template",7),hl()),e&2){let n=MC(9);nI(),bg("items",t.schedulerItems())("loading",t.isLoading())("showCreate",true)("itemTemplate",n),nI(4),bg("ngModel",t.showOnlyMine()),qI(),nI(2),iC(t.errorMessage()?7:-1);}},dependencies:[Wn,ot,it,hr,Gn,yt$1,wt,ke,se,In,De,Be,ya,En,ti,Zn,cn],styles:["[_nghost-%COMP%]{display:block;width:100%;min-height:100vh;background:var(--color-bg);overflow-y:auto}.scheduler-list__mine-toggle[_ngcontent-%COMP%]{flex-shrink:0;font-size:.875rem}.scheduler-list__delete-item[_ngcontent-%COMP%]{color:var(--color-error, #ff3b30)}.scheduler-list__delete-item[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:inherit}.scheduler-list__error[_ngcontent-%COMP%]{margin:1rem auto;max-width:900px;padding:.75rem 1rem;background:#dc262614;border:1px solid rgba(220,38,38,.25);border-radius:8px;color:var(--color-error, #ff3b30);font-size:.875rem}"],changeDetection:1})};export{Ct as SchedulerListComponent};
|