@whoz-oss/coday-client 0.0.0-workstream-forge.133 → 0.0.0-workstream-forge.134

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/browser/{chunk-DDBndX8X.js → chunk--feYJyA0.js} +1 -1
  2. package/browser/{chunk-DuNcnigb.js → chunk-4tQ6wT_r.js} +1 -1
  3. package/browser/{chunk-Z-Rdihxb.js → chunk-B-420TGb.js} +1 -1
  4. package/browser/chunk-B2R438Y9.js +1 -0
  5. package/browser/{chunk-g6gWH0wW.js → chunk-B49VVx1Q.js} +1 -1
  6. package/browser/{chunk-BC30_IWf.js → chunk-BBrd_rzb.js} +1 -1
  7. package/browser/{chunk-MlnYbyuc.js → chunk-BHB8LN2u.js} +1 -1
  8. package/browser/{chunk-CaT9J2-R.js → chunk-BLhL2k2M.js} +1 -1
  9. package/browser/{chunk-C0DGRdrH.js → chunk-BZdZJ9Du.js} +1 -1
  10. package/browser/{chunk-CXH1B4xE.js → chunk-BarxPWfR.js} +1 -1
  11. package/browser/{chunk-Ca58sP9P.js → chunk-Bb0hRNwj.js} +1 -1
  12. package/browser/{chunk-DJqD0QrN.js → chunk-Bf8dXEH6.js} +1 -1
  13. package/browser/{chunk-CzhH5dEk.js → chunk-Bh0lrOP3.js} +1 -1
  14. package/browser/{chunk-DecNPOnx.js → chunk-BiWF-SYd.js} +1 -1
  15. package/browser/{chunk-p_goS9vk.js → chunk-BkG1XalM.js} +1 -1
  16. package/browser/{chunk-BYfLHvn5.js → chunk-BlFiuNZL.js} +1 -1
  17. package/browser/{chunk-EEpjj7pA.js → chunk-BynzLX1z.js} +1 -1
  18. package/browser/{chunk-DdISK7Z0.js → chunk-C881tCOG.js} +15 -15
  19. package/browser/{chunk-DyBGilQA.js → chunk-C8OiYFXu.js} +1 -1
  20. package/browser/{chunk-D745ywTz.js → chunk-CEq8StOt.js} +1 -1
  21. package/browser/{chunk-Crn_FmOc.js → chunk-CF2pGQL4.js} +1 -1
  22. package/browser/{chunk-DX_WpNI8.js → chunk-CGLqLL6j.js} +1 -1
  23. package/browser/{chunk-BvNh363O.js → chunk-COJvBXX0.js} +1 -1
  24. package/browser/{chunk-B3wVhaOY.js → chunk-CR06wkhU.js} +1 -1
  25. package/browser/{chunk-DPNvDTDA.js → chunk-CZHly4Dq.js} +1 -1
  26. package/browser/{chunk-DQhzfd4q.js → chunk-C_b5pfWY.js} +1 -1
  27. package/browser/{chunk-MQfO-veq.js → chunk-C_gNvdAF.js} +1 -1
  28. package/browser/{chunk-HewsBsjw.js → chunk-Cp-5kKxu.js} +1 -1
  29. package/browser/{chunk-C9ZLvHyT.js → chunk-D8eawm0e.js} +1 -1
  30. package/browser/{chunk-QA6-T4TH.js → chunk-DHaFI5Hf.js} +1 -1
  31. package/browser/{chunk-1aPU-VYN.js → chunk-DNcnyOb1.js} +1 -1
  32. package/browser/{chunk-xpXkr85F.js → chunk-DSIbqC98.js} +1 -1
  33. package/browser/{chunk-BwDnFY17.js → chunk-DXYmdB1U.js} +1 -1
  34. package/browser/{chunk-BIEipUAm.js → chunk-DaITEw07.js} +1 -1
  35. package/browser/{chunk-BmpYp8SI.js → chunk-Dfp_jhqs.js} +1 -1
  36. package/browser/{chunk-B94rMV4D.js → chunk-Didf0Mgo.js} +1 -1
  37. package/browser/{chunk-BPPwlunf.js → chunk-DpMHVWww.js} +1 -1
  38. package/browser/{chunk-DMBR9TyF.js → chunk-DzFKiP1U.js} +1 -1
  39. package/browser/{chunk-Cvn7x879.js → chunk-Dzos_5V1.js} +1 -1
  40. package/browser/{chunk-DumghPgi.js → chunk-TeYvI4OV.js} +1 -1
  41. package/browser/{chunk-Dv74-YPZ.js → chunk-Vpl-omFV.js} +1 -1
  42. package/browser/{chunk-CSbT6gXC.js → chunk-cp0eeDIu.js} +1 -1
  43. package/browser/{chunk-BJvKgH9M.js → chunk-e25EAfhY.js} +1 -1
  44. package/browser/{chunk-ChHdIgC7.js → chunk-mu6roncT.js} +1 -1
  45. package/browser/{chunk-DIiUGYyE.js → chunk-zESdhhlk.js} +1 -1
  46. package/browser/index.html +1 -1
  47. package/browser/{main-OIPNBOIH.js → main-5NWD4SCX.js} +1 -1
  48. package/package.json +1 -1
  49. package/browser/chunk-2uSZyBhs.js +0 -1
@@ -1,2 +1,2 @@
1
- import {v}from'./chunk-B94rMV4D.js';import {R,q,J}from'./chunk-Cvn7x879.js';import {p,$ as $t,c as It,M as Me,i as ie,E as Mi,F as Sg,x,w,v as vf,z as za,f as dc,r as r_,C as Cf,h as hT,a as yb,I as Iv,d as pT,e as bT,n as yT,J as mT,s as sS,l as lc,N as NT,t as tv,g as cS,o as vT,R as Rf,H as dT,k as ig,m as sg,ag as WT,V as uc}from'./main-OIPNBOIH.js';import {F,v as vt,a as ve,$,U,K as Kn,z as zn,Z as Zn,X as Xn,Y as Ye,e as bt,g as fn,L as Ln,W as Wn,b as pn,V as Vn}from'./chunk-DdISK7Z0.js';import'./chunk-2uSZyBhs.js';function se(i,t){i&1&&(za(0,"p",5),r_(1,"Loading\u2026"),Cf());}function ce(i,t){if(i&1&&(za(0,"label",23),lc(1,"input",24),sS(),za(2,"span"),r_(3),Cf()()),i&2){let e=t.$implicit,o=NT(3);yb(),tv("formControl",o.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!o.isAdmin()),cS(),yb(2),Iv(e.label);}}function de(i,t){if(i&1&&(za(0,"fieldset",8)(1,"legend",22),r_(2,"Configuration scope"),Cf(),yT(3,ce,4,4,"label",23,dT().trackByScope,true),Cf()),i&2){let e=NT(2);tv("disabled",e.isEditMode()),yb(3),vT(e.scopeOptions);}}function ue(i,t){if(i&1&&(za(0,"option",13),r_(1),Cf()),i&2){let e=t.$implicit,o=NT(2);tv("value",e),yb(),Iv(o.authTypeLabel[e]);}}function pe(i,t){i&1&&r_(0," Leave a field unchanged to keep the stored credential. ");}function he(i,t){i&1&&(za(0,"span",11),r_(1,"*"),Cf());}function me(i,t){if(i&1&&(za(0,"p",28),r_(1),Cf()),i&2){let e=NT(2).$implicit;tv("id","as-hint-"+e.key),yb(),Iv(e.hint);}}function ge(i,t){if(i&1&&(lc(0,"input",27),sS(),hT(1,me,2,2,"p",28)),i&2){let e=NT().$implicit;WT("auth-setting-form__input"+(e.secret?" auth-setting-form__input--secret":"")),tv("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),uc("aria-describedby",e.hint?"as-hint-"+e.key:null),cS(),yb(),pT(e.hint?1:-1);}}function Ce(i,t){if(i&1&&(za(0,"div",9)(1,"label",26),r_(2),hT(3,he,2,0,"span",11),Cf(),hT(4,ge,2,9),Cf()),i&2){let e,o=t.$implicit,l=NT(3);yb(),tv("for","as-cred-"+o.key),yb(),Rf(" ",o.label," "),yb(),pT(o.required?3:-1),yb(),pT((e=l.controlForField(o.key))?4:-1,e);}}function fe(i,t){if(i&1&&(za(0,"fieldset",18)(1,"legend",22),r_(2,"Credentials"),Cf(),za(3,"p",25),r_(4," Values are stored encrypted and masked on read. "),hT(5,pe,1,0),Cf(),yT(6,Ce,5,4,"div",9,dT().trackByField,true),Cf()),i&2){let e=NT(2);yb(5),pT(e.isEditMode()?5:-1),yb(),vT(e.credentialFields());}}function ye(i,t){if(i&1){let e=bT();za(0,"form",7),dc("ngSubmit",function(){ig(e);let l=NT();return sg(l.submit())}),hT(1,de,5,1,"fieldset",8),za(2,"div",9)(3,"label",10),r_(4,"Auth type "),za(5,"span",11),r_(6,"*"),Cf()(),za(7,"select",12),yT(8,ue,2,2,"option",13,mT),Cf(),sS(),Cf(),za(10,"div",9)(11,"label",14),r_(12,"Name "),za(13,"span",11),r_(14,"*"),Cf()(),lc(15,"input",15),sS(),Cf(),za(16,"div",9)(17,"label",16),r_(18,"Description"),Cf(),lc(19,"input",17),sS(),Cf(),hT(20,fe,8,1,"fieldset",18),za(21,"div",19)(22,"button",20),r_(23),Cf(),za(24,"button",21),dc("click",function(){ig(e);let l=NT();return sg(l.cancel())}),r_(25,"Cancel"),Cf()()();}if(i&2){let e=NT();tv("formGroup",e.form),yb(),pT(e.isPlatformMode?-1:1),yb(6),tv("formControl",e.authTypeControl),cS(),yb(),vT(e.authTypeOptions),yb(7),tv("formControl",e.nameControl),cS(),yb(4),tv("formControl",e.descriptionControl),cS(),yb(),pT(e.credentialFields().length>0?20:-1),yb(2),tv("disabled",e.form.invalid||e.isSubmitting()),yb(),Rf(" ",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=p($t);router=p(It);destroyRef=p(Me);state=p(R);namespaceRole=p(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?ie(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 vt("",{nonNullable:true,validators:[ve.required,ve.minLength(1)]});descriptionControl=new vt(null);authTypeControl=new vt("ApiKeyAuthSetting",{nonNullable:true,validators:[ve.required]});scopeControl=new vt("namespace",{nonNullable:true});form=new $({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new vt("",{nonNullable:true});usernameControl=new vt("",{nonNullable:true});passwordControl=new vt("",{nonNullable:true});tokenControl=new vt("",{nonNullable:true});discoveryUrlControl=new vt("",{nonNullable:true});authorizationUrlControl=new vt("",{nonNullable:true});tokenUrlControl=new vt("",{nonNullable:true});clientIdControl=new vt("",{nonNullable:true});clientSecretControl=new vt("",{nonNullable:true});scopesControl=new vt("",{nonNullable:true});resourceUrlControl=new vt("",{nonNullable:true});selectedAuthType=F(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=Mi(()=>Se[this.selectedAuthType()]);isEditMode=ie(false);isSubmitting=ie(false);isLoading=ie(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||Sg(()=>{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 x(w({},l),{authType:"ApiKeyAuthSetting",apiKey:this.credentialValue("apiKey",this.apiKeyControl.value)});case "BasicAuthAuthSetting":return x(w({},l),{authType:"BasicAuthAuthSetting",username:this.credentialValue("username",this.usernameControl.value),password:this.credentialValue("password",this.passwordControl.value)});case "BearerTokenAuthSetting":return x(w({},l),{authType:"BearerTokenAuthSetting",token:this.credentialValue("token",this.tokenControl.value)});case "OAuthDiscoverableAuthSetting":return x(w({},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 x(w({},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 x(w({},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 x(w({},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=vf({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&&(za(0,"div",0)(1,"header",1)(2,"button",2),dc("click",function(){return o.cancel()}),za(3,"span",3),r_(4,"\u2190"),Cf(),r_(5," Auth Settings "),Cf(),za(6,"h1",4),r_(7),Cf()(),hT(8,se,2,0,"p",5)(9,ye,26,8,"form",6),Cf()),e&2&&(yb(7),Iv(o.isEditMode()?"Edit auth setting":"New auth setting"),yb(),pT(o.isLoading()?8:9));},dependencies:[Kn,zn,Zn,Xn,Ye,bt,fn,Ln,Wn,pn,Vn],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))}"]})};
1
+ import {v}from'./chunk-Didf0Mgo.js';import {R,q,J}from'./chunk-Dzos_5V1.js';import {p,$ as $t,c as It,M as Me,i as ie,E as Mi,F as Sg,x,w,v as vf,z as za,f as dc,r as r_,C as Cf,h as hT,a as yb,I as Iv,d as pT,e as bT,n as yT,J as mT,s as sS,l as lc,N as NT,t as tv,g as cS,o as vT,R as Rf,H as dT,k as ig,m as sg,ag as WT,V as uc}from'./main-5NWD4SCX.js';import {F,v as vt,a as ve,$,U,K as Kn,z as zn,Z as Zn,X as Xn,Y as Ye,e as bt,g as fn,L as Ln,W as Wn,b as pn,V as Vn}from'./chunk-C881tCOG.js';import'./chunk-B2R438Y9.js';function se(i,t){i&1&&(za(0,"p",5),r_(1,"Loading\u2026"),Cf());}function ce(i,t){if(i&1&&(za(0,"label",23),lc(1,"input",24),sS(),za(2,"span"),r_(3),Cf()()),i&2){let e=t.$implicit,o=NT(3);yb(),tv("formControl",o.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!o.isAdmin()),cS(),yb(2),Iv(e.label);}}function de(i,t){if(i&1&&(za(0,"fieldset",8)(1,"legend",22),r_(2,"Configuration scope"),Cf(),yT(3,ce,4,4,"label",23,dT().trackByScope,true),Cf()),i&2){let e=NT(2);tv("disabled",e.isEditMode()),yb(3),vT(e.scopeOptions);}}function ue(i,t){if(i&1&&(za(0,"option",13),r_(1),Cf()),i&2){let e=t.$implicit,o=NT(2);tv("value",e),yb(),Iv(o.authTypeLabel[e]);}}function pe(i,t){i&1&&r_(0," Leave a field unchanged to keep the stored credential. ");}function he(i,t){i&1&&(za(0,"span",11),r_(1,"*"),Cf());}function me(i,t){if(i&1&&(za(0,"p",28),r_(1),Cf()),i&2){let e=NT(2).$implicit;tv("id","as-hint-"+e.key),yb(),Iv(e.hint);}}function ge(i,t){if(i&1&&(lc(0,"input",27),sS(),hT(1,me,2,2,"p",28)),i&2){let e=NT().$implicit;WT("auth-setting-form__input"+(e.secret?" auth-setting-form__input--secret":"")),tv("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),uc("aria-describedby",e.hint?"as-hint-"+e.key:null),cS(),yb(),pT(e.hint?1:-1);}}function Ce(i,t){if(i&1&&(za(0,"div",9)(1,"label",26),r_(2),hT(3,he,2,0,"span",11),Cf(),hT(4,ge,2,9),Cf()),i&2){let e,o=t.$implicit,l=NT(3);yb(),tv("for","as-cred-"+o.key),yb(),Rf(" ",o.label," "),yb(),pT(o.required?3:-1),yb(),pT((e=l.controlForField(o.key))?4:-1,e);}}function fe(i,t){if(i&1&&(za(0,"fieldset",18)(1,"legend",22),r_(2,"Credentials"),Cf(),za(3,"p",25),r_(4," Values are stored encrypted and masked on read. "),hT(5,pe,1,0),Cf(),yT(6,Ce,5,4,"div",9,dT().trackByField,true),Cf()),i&2){let e=NT(2);yb(5),pT(e.isEditMode()?5:-1),yb(),vT(e.credentialFields());}}function ye(i,t){if(i&1){let e=bT();za(0,"form",7),dc("ngSubmit",function(){ig(e);let l=NT();return sg(l.submit())}),hT(1,de,5,1,"fieldset",8),za(2,"div",9)(3,"label",10),r_(4,"Auth type "),za(5,"span",11),r_(6,"*"),Cf()(),za(7,"select",12),yT(8,ue,2,2,"option",13,mT),Cf(),sS(),Cf(),za(10,"div",9)(11,"label",14),r_(12,"Name "),za(13,"span",11),r_(14,"*"),Cf()(),lc(15,"input",15),sS(),Cf(),za(16,"div",9)(17,"label",16),r_(18,"Description"),Cf(),lc(19,"input",17),sS(),Cf(),hT(20,fe,8,1,"fieldset",18),za(21,"div",19)(22,"button",20),r_(23),Cf(),za(24,"button",21),dc("click",function(){ig(e);let l=NT();return sg(l.cancel())}),r_(25,"Cancel"),Cf()()();}if(i&2){let e=NT();tv("formGroup",e.form),yb(),pT(e.isPlatformMode?-1:1),yb(6),tv("formControl",e.authTypeControl),cS(),yb(),vT(e.authTypeOptions),yb(7),tv("formControl",e.nameControl),cS(),yb(4),tv("formControl",e.descriptionControl),cS(),yb(),pT(e.credentialFields().length>0?20:-1),yb(2),tv("disabled",e.form.invalid||e.isSubmitting()),yb(),Rf(" ",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=p($t);router=p(It);destroyRef=p(Me);state=p(R);namespaceRole=p(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?ie(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 vt("",{nonNullable:true,validators:[ve.required,ve.minLength(1)]});descriptionControl=new vt(null);authTypeControl=new vt("ApiKeyAuthSetting",{nonNullable:true,validators:[ve.required]});scopeControl=new vt("namespace",{nonNullable:true});form=new $({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new vt("",{nonNullable:true});usernameControl=new vt("",{nonNullable:true});passwordControl=new vt("",{nonNullable:true});tokenControl=new vt("",{nonNullable:true});discoveryUrlControl=new vt("",{nonNullable:true});authorizationUrlControl=new vt("",{nonNullable:true});tokenUrlControl=new vt("",{nonNullable:true});clientIdControl=new vt("",{nonNullable:true});clientSecretControl=new vt("",{nonNullable:true});scopesControl=new vt("",{nonNullable:true});resourceUrlControl=new vt("",{nonNullable:true});selectedAuthType=F(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=Mi(()=>Se[this.selectedAuthType()]);isEditMode=ie(false);isSubmitting=ie(false);isLoading=ie(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||Sg(()=>{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 x(w({},l),{authType:"ApiKeyAuthSetting",apiKey:this.credentialValue("apiKey",this.apiKeyControl.value)});case "BasicAuthAuthSetting":return x(w({},l),{authType:"BasicAuthAuthSetting",username:this.credentialValue("username",this.usernameControl.value),password:this.credentialValue("password",this.passwordControl.value)});case "BearerTokenAuthSetting":return x(w({},l),{authType:"BearerTokenAuthSetting",token:this.credentialValue("token",this.tokenControl.value)});case "OAuthDiscoverableAuthSetting":return x(w({},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 x(w({},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 x(w({},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 x(w({},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=vf({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&&(za(0,"div",0)(1,"header",1)(2,"button",2),dc("click",function(){return o.cancel()}),za(3,"span",3),r_(4,"\u2190"),Cf(),r_(5," Auth Settings "),Cf(),za(6,"h1",4),r_(7),Cf()(),hT(8,se,2,0,"p",5)(9,ye,26,8,"form",6),Cf()),e&2&&(yb(7),Iv(o.isEditMode()?"Edit auth setting":"New auth setting"),yb(),pT(o.isLoading()?8:9));},dependencies:[Kn,zn,Zn,Xn,Ye,bt,fn,Ln,Wn,pn,Vn],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
2
  export{le as AuthSettingFormComponent};
@@ -1 +1 @@
1
- import {i}from'./chunk-2uSZyBhs.js';import {l}from'./chunk-DdISK7Z0.js';import {p,at as z,O as De,ak as Ms,P as Ae,an as gw,Q as j,_,x,w,L as Le,q as R$1,aa as Wn}from'./main-OIPNBOIH.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?x(w({},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 x(w({},t),{authType:e})}return n}var R=class n{controller=p(z);userState=p(l);refresh$=new De(void 0);namespaceId$=new De(null);vm$=Ms([this.namespaceId$,this.refresh$]).pipe(Ae(([t])=>{let e=this.loadPlatformSettings().pipe(Wn(()=>_([])));return t?Ms([e,this.loadNamespaceSettings(t).pipe(Wn(()=>_([]))),this.loadUserSettings(t).pipe(Wn(()=>_([]))),this.loadUserSettings("global").pipe(Wn(()=>_([])))]).pipe(j(([i,s,u,p])=>({platform:i,namespace:s,userOnNs:u,userGlobal:p}))):Ms([e,this.loadNamespaceSettings("").pipe(Wn(()=>_([]))),this.loadUserSettings("global").pipe(Wn(()=>_([])))]).pipe(j(([i,s,u])=>({platform:i,namespace:s,userOnNs:[],userGlobal:u})))}),gw({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(j(i=>O(i)))}userGlobal$=i(this.refresh$,()=>this.loadUserSettings("global"),[]);loadPlatformSettings(){return this.controller.listAuthSetting(E).pipe(j(t=>O(t)))}loadNamespaceSettings(t){return t?this.controller.listAuthSetting(t).pipe(j(e=>O(e))):_([])}getById(t,e){return this.controller.getByIdAuthSetting(t).pipe(j(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(x(w({},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(j(_=>d(_)),Le(()=>this.refresh()))}update(t,e,i){let s=v(x(w({},e),{namespaceId:i.namespaceId,userId:i.userId,authType:i.authType}));return this.controller.updateAuthSetting(t,s).pipe(j(u=>d(u)),Le(()=>this.refresh()))}delete(t,e){return this.controller.deleteAuthSetting(t).pipe(Le(()=>this.refresh()))}static \u0275fac=function(e){return new(e||n)};static \u0275prov=R$1({token:n,factory:n.\u0275fac,providedIn:"root"})};export{J,R,q};
1
+ import {i}from'./chunk-B2R438Y9.js';import {l}from'./chunk-C881tCOG.js';import {p,at as z,O as De,ak as Ms,P as Ae,an as gw,Q as j,_,x,w,L as Le,q as R$1,aa as Wn}from'./main-5NWD4SCX.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?x(w({},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 x(w({},t),{authType:e})}return n}var R=class n{controller=p(z);userState=p(l);refresh$=new De(void 0);namespaceId$=new De(null);vm$=Ms([this.namespaceId$,this.refresh$]).pipe(Ae(([t])=>{let e=this.loadPlatformSettings().pipe(Wn(()=>_([])));return t?Ms([e,this.loadNamespaceSettings(t).pipe(Wn(()=>_([]))),this.loadUserSettings(t).pipe(Wn(()=>_([]))),this.loadUserSettings("global").pipe(Wn(()=>_([])))]).pipe(j(([i,s,u,p])=>({platform:i,namespace:s,userOnNs:u,userGlobal:p}))):Ms([e,this.loadNamespaceSettings("").pipe(Wn(()=>_([]))),this.loadUserSettings("global").pipe(Wn(()=>_([])))]).pipe(j(([i,s,u])=>({platform:i,namespace:s,userOnNs:[],userGlobal:u})))}),gw({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(j(i=>O(i)))}userGlobal$=i(this.refresh$,()=>this.loadUserSettings("global"),[]);loadPlatformSettings(){return this.controller.listAuthSetting(E).pipe(j(t=>O(t)))}loadNamespaceSettings(t){return t?this.controller.listAuthSetting(t).pipe(j(e=>O(e))):_([])}getById(t,e){return this.controller.getByIdAuthSetting(t).pipe(j(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(x(w({},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(j(_=>d(_)),Le(()=>this.refresh()))}update(t,e,i){let s=v(x(w({},e),{namespaceId:i.namespaceId,userId:i.userId,authType:i.authType}));return this.controller.updateAuthSetting(t,s).pipe(j(u=>d(u)),Le(()=>this.refresh()))}delete(t,e){return this.controller.deleteAuthSetting(t).pipe(Le(()=>this.refresh()))}static \u0275fac=function(e){return new(e||n)};static \u0275prov=R$1({token:n,factory:n.\u0275fac,providedIn:"root"})};export{J,R,q};
@@ -1 +1 @@
1
- import {a}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-DPNvDTDA.js';import {s,U,O as On}from'./chunk-DdISK7Z0.js';import {p,$ as $t,c as It,M as Me,i as ie$1,E as Mi,a9 as pw,aa as Wn,_,v as vf,al as pu,z as za,f as dc,r as r_,C as Cf,h as hT,a as yb,d as pT,N as NT,t as tv,e as bT,I as Iv,D as gv,R as Rf,V as uc,n as yT,o as vT,l as lc,Y as v_,a1 as E_,J as mT,k as ig,m as sg,am as NC}from'./main-OIPNBOIH.js';var J=(e,n)=>n.name+n.grant;function K(e,n){if(e&1&&(za(0,"a",5),r_(1,"Edit skill \u2192"),Cf()),e&2){let i=NT();tv("routerLink",i.editRoute());}}function q(e,n){e&1&&(za(0,"span",6),r_(1,"Platform level"),Cf());}function Q(e,n){e&1&&(za(0,"p",7),r_(1,"Loading\u2026"),Cf());}function W(e,n){e&1&&(za(0,"p",8),r_(1,"Failed to load skill."),Cf());}function X(e,n){if(e&1&&(za(0,"dt",13),r_(1,"Created by"),Cf(),za(2,"dd",15),r_(3),Cf()),e&2){let i=NT(2);yb(3),Iv(i.createdBy);}}function Y(e,n){if(e&1&&(za(0,"dt",13),r_(1,"Last updated"),Cf(),za(2,"dd",15),r_(3),Cf()),e&2){let i=NT(2);yb(3),Iv(i.updatedOn);}}function Z(e,n){if(e&1&&(hT(0,X,4,1),hT(1,Y,4,1)),e&2){let i=NT();pT(i.createdBy?0:-1),yb(),pT(i.updatedOn?1:-1);}}function ee(e,n){if(e&1&&(za(0,"span",17),r_(1),Cf()),e&2){let i=NT(2);yb(),Rf("(",i.consumers().length,")");}}function te(e,n){e&1&&(za(0,"p",18),r_(1," A platform skill is offered to every namespace. Open it from a namespace to see which of its agents use it. "),Cf());}function ne(e,n){e&1&&(za(0,"p",18),r_(1,"Loading\u2026"),Cf());}function ie(e,n){e&1&&(za(0,"p",8),r_(1," The agent configs could not be read, so it is unknown whether any agent uses this skill. "),Cf());}function oe(e,n){e&1&&(za(0,"p",18),r_(1,"No agent references this skill."),Cf());}function le(e,n){e&1&&(za(0,"span",16),r_(1,"platform agent"),Cf());}function ae(e,n){e&1&&(za(0,"span",16),r_(1,"via *"),Cf());}function re(e,n){if(e&1&&(za(0,"li",24)(1,"span",26),r_(2),Cf(),hT(3,le,2,0,"span",16),hT(4,ae,2,0,"span",16),Cf()),e&2){let i=n.$implicit;yb(2),Iv(i.name),yb(),pT(i.platform?3:-1),yb(),pT(i.grant==="all"?4:-1);}}function se(e,n){if(e&1&&(za(0,"ul",23),yT(1,re,5,3,"li",24,J),Cf(),za(3,"p",25),r_(4," An agent listed "),za(5,"code"),r_(6,"via *"),Cf(),r_(7," takes the whole catalogue and keeps working without this skill. The others name it, so deleting the skill leaves their selector resolving to nothing. "),Cf()),e&2){let i=NT(2);yb(),vT(i.consumers());}}function ce(e,n){if(e&1&&(lc(0,"div",21),v_(1,"agentosMarkdown")),e&2){let i=NT();tv("innerHTML",E_(1,1,i.body),NC);}}function de(e,n){e&1&&(za(0,"p",18),r_(1,"No resources bundled with this skill."),Cf());}function pe(e,n){if(e&1&&(za(0,"pre",30),r_(1),Cf()),e&2){let i=NT().$implicit,a=NT(3);yb(),Iv(a.resourceContent(i));}}function me(e,n){if(e&1){let i=bT();za(0,"li",27)(1,"button",28),dc("click",function(){let s=ig(i).$implicit,g=NT(3);return sg(g.toggleResource(s))}),za(2,"span",29),r_(3),Cf(),za(4,"span",20),r_(5,"\u25BC"),Cf()(),hT(6,pe,2,1,"pre",30),Cf();}if(e&2){let i=n.$implicit,a=NT(3);yb(),uc("aria-expanded",a.isResourceExpanded(i)),yb(2),Iv(i),yb(),gv("skill-inspect__chevron--open",a.isResourceExpanded(i)),yb(2),pT(a.isResourceExpanded(i)?6:-1);}}function _e(e,n){if(e&1&&(za(0,"ul",22),yT(1,me,7,5,"li",27,mT),Cf()),e&2){let i=NT(2);yb(),vT(i.resourcePaths());}}function ge(e,n){if(e&1){let i=bT();za(0,"div",9)(1,"section",10)(2,"h2",11),r_(3,"General"),Cf(),za(4,"dl",12)(5,"dt",13),r_(6,"Name"),Cf(),za(7,"dd",14),r_(8),Cf(),za(9,"dt",13),r_(10,"Description"),Cf(),za(11,"dd",15),r_(12),Cf(),za(13,"dt",13),r_(14,"Scope"),Cf(),za(15,"dd",15),r_(16),Cf(),za(17,"dt",13),r_(18,"Storage"),Cf(),za(19,"dd",15)(20,"span",16),r_(21),Cf()(),hT(22,Z,2,2),Cf()(),za(23,"section",10)(24,"h2",11),r_(25," Used by "),hT(26,ee,2,1,"span",17),Cf(),hT(27,te,2,0,"p",18)(28,ne,2,0,"p",18)(29,ie,2,0,"p",8)(30,oe,2,0,"p",18)(31,se,8,0),Cf(),za(32,"section",10)(33,"button",19),dc("click",function(){ig(i);let s=NT();return sg(s.toggleBody())}),za(34,"h2",11),r_(35,"Body"),Cf(),za(36,"span",20),r_(37,"\u25BC"),Cf()(),hT(38,ce,2,3,"div",21),Cf(),za(39,"section",10)(40,"h2",11),r_(41," Resources "),za(42,"span",17),r_(43),Cf()(),hT(44,de,2,0,"p",18)(45,_e,3,0,"ul",22),Cf()();}if(e&2){let i=n,a=NT();yb(8),Iv(i.name),yb(4),Iv(i.description),yb(4),Iv(i.namespaceId?"Namespace":"Platform"),yb(4),gv("skill-inspect__badge--readonly",a.isFilesystemBacked()),yb(),Rf(" ",a.isFilesystemBacked()?"SKILL.md file (read-only)":"Database"," "),yb(),pT(a.isFilesystemBacked()?-1:22),yb(4),pT(!a.isPlatformMode&&!a.consumersLoading()&&!a.consumersUnavailable()?26:-1),yb(),pT(a.isPlatformMode?27:a.consumersLoading()?28:a.consumersUnavailable()?29:a.consumers().length===0?30:31),yb(6),uc("aria-expanded",!a.bodyCollapsed()),yb(3),gv("skill-inspect__chevron--open",!a.bodyCollapsed()),yb(2),pT(a.bodyCollapsed()?-1:38),yb(5),Rf("(",a.resourcePaths().length,")"),yb(),pT(a.resourcePaths().length===0?44:45);}}var G=class e{route=p($t);router=p(It);destroyRef=p(Me);skillState=p(o);agentState=p(s);namespaceId=this.route.snapshot.params.namespaceId;skillId=this.route.snapshot.params.skillId;isPlatformMode=!this.namespaceId;isLoading=ie$1(true);hasError=ie$1(false);skill=ie$1(null);bodyCollapsed=ie$1(false);expandedResources=ie$1(new Set);resourcePaths=Mi(()=>Object.keys(this.skill()?.resources??{}).sort());isFilesystemBacked=Mi(()=>this.skill()?.readOnly===true);consumers=ie$1([]);consumersUnavailable=ie$1(false);consumersLoading=ie$1(false);ngOnInit(){this.skillState.getById(this.skillId).pipe(U(this.destroyRef)).subscribe({next:n=>{this.skill.set(n),this.isLoading.set(false),this.loadConsumers(n.name);},error:()=>{this.hasError.set(true),this.isLoading.set(false);}});}loadConsumers(n){this.namespaceId&&(this.consumersLoading.set(true),pw({namespace:this.agentState.listByNamespace(this.namespaceId),platform:this.agentState.listPlatform().pipe(Wn(()=>_([])))}).pipe(U(this.destroyRef)).subscribe({next:({namespace:i,platform:a})=>{let s=[...this.toConsumers(i,n,false),...this.toConsumers(a,n,true)];this.consumers.set([...s.filter(g=>g.grant==="named"),...s.filter(g=>g.grant==="all")]),this.consumersLoading.set(false);},error:()=>{this.consumersUnavailable.set(true),this.consumersLoading.set(false);}}));}toConsumers(n,i,a$1){return n.map(s=>({config:s,grant:a(s.skillSelectors,i)})).filter(s=>s.grant!=="none").map(({config:s,grant:g})=>({name:s.name,grant:g,platform:a$1}))}toggleBody(){this.bodyCollapsed.update(n=>!n);}toggleResource(n){this.expandedResources.update(i=>{let a=new Set(i);return a.has(n)?a.delete(n):a.add(n),a});}isResourceExpanded(n){return this.expandedResources().has(n)}resourceContent(n){return this.skill()?.resources?.[n]??""}editRoute(){return this.isPlatformMode?["/agentos","admin","skills",this.skillId,"edit"]:["/agentos",this.namespaceId,"skills",this.skillId,"edit"]}back(){this.isPlatformMode?this.router.navigate(["/agentos","admin","skills"]):this.router.navigate(["/agentos",this.namespaceId,"skills"]);}static \u0275fac=function(i){return new(i||e)};static \u0275cmp=vf({type:e,selectors:[["agentos-skill-inspect"]],decls:13,vars:3,consts:[[1,"skill-inspect"],[1,"skill-inspect__header"],["type","button","title","Back to skills",1,"skill-inspect__back",3,"click"],[1,"skill-inspect__back-icon"],[1,"skill-inspect__title"],[1,"skill-inspect__sibling-link",3,"routerLink"],[1,"skill-inspect__platform-badge"],[1,"skill-inspect__loading"],["role","alert",1,"skill-inspect__error"],[1,"skill-inspect__content"],[1,"skill-inspect__section"],[1,"skill-inspect__section-title"],[1,"skill-inspect__dl"],[1,"skill-inspect__dt"],[1,"skill-inspect__dd","skill-inspect__dd--mono"],[1,"skill-inspect__dd"],[1,"skill-inspect__badge"],[1,"skill-inspect__count"],[1,"skill-inspect__empty"],["type","button",1,"skill-inspect__collapsible",3,"click"],[1,"skill-inspect__chevron"],[1,"skill-inspect__body",3,"innerHTML"],[1,"skill-inspect__resources"],[1,"skill-inspect__consumers"],[1,"skill-inspect__consumer"],[1,"skill-inspect__consumers-hint"],[1,"skill-inspect__consumer-name"],[1,"skill-inspect__resource"],["type","button",1,"skill-inspect__resource-header",3,"click"],[1,"skill-inspect__resource-path"],[1,"skill-inspect__resource-content"]],template:function(i,a){if(i&1&&(za(0,"div",0)(1,"header",1)(2,"button",2),dc("click",function(){return a.back()}),za(3,"span",3),r_(4,"\u2190"),Cf(),r_(5," Skills "),Cf(),za(6,"h1",4),r_(7,"Skill"),Cf(),hT(8,K,2,1,"a",5),hT(9,q,2,0,"span",6),Cf(),hT(10,Q,2,0,"p",7)(11,W,2,0,"p",8)(12,ge,46,15,"div",9),Cf()),i&2){let s;yb(8),pT(a.skill()&&!a.isFilesystemBacked()?8:-1),yb(),pT(a.isPlatformMode?9:-1),yb(),pT(a.isLoading()?10:a.hasError()?11:(s=a.skill())?12:-1,s);}},dependencies:[pu,On],styles:[".skill-inspect[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:720px;margin:0 auto;padding:2rem 1rem}.skill-inspect__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.skill-inspect__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}.skill-inspect__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.skill-inspect__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.skill-inspect__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.skill-inspect__sibling-link[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-primary, #007aff);text-decoration:none}.skill-inspect__sibling-link[_ngcontent-%COMP%]:hover{text-decoration:underline}.skill-inspect__platform-badge[_ngcontent-%COMP%]{align-self:flex-start;font-family:var(--font-heading);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;padding:.15rem .5rem;border:1px solid var(--color-divider, rgba(0, 0, 0, .12));color:var(--color-neutral-600, #6e6e73)}.skill-inspect__loading[_ngcontent-%COMP%], .skill-inspect__error[_ngcontent-%COMP%], .skill-inspect__empty[_ngcontent-%COMP%]{margin:0;font-size:.9rem;color:var(--color-text-secondary, #6e6e73)}.skill-inspect__error[_ngcontent-%COMP%]{color:var(--color-error, #ff3b30)}.skill-inspect__content[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.skill-inspect__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.75rem;padding:1.25rem;border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:10px}.skill-inspect__section-title[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;font-weight:600;color:var(--color-text, #1d1d1f)}.skill-inspect__count[_ngcontent-%COMP%]{font-weight:400;color:var(--color-text-secondary, #6e6e73);font-size:.875rem;margin-left:.25rem}.skill-inspect__dl[_ngcontent-%COMP%]{display:grid;grid-template-columns:max-content 1fr;gap:.5rem 1.25rem;margin:0}.skill-inspect__dt[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:500;color:var(--color-text-secondary, #6e6e73);align-self:center}.skill-inspect__dd[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;color:var(--color-text, #1d1d1f);align-self:center;word-break:break-word}.skill-inspect__dd--mono[_ngcontent-%COMP%]{font-family:monospace;font-size:.875rem}.skill-inspect__consumers[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:.375rem}.skill-inspect__consumer[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem}.skill-inspect__consumer-name[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500}.skill-inspect__consumers-hint[_ngcontent-%COMP%]{margin:.5rem 0 0;font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.skill-inspect__badge[_ngcontent-%COMP%]{display:inline-block;padding:.2em .6em;border-radius:4px;font-size:.75rem;font-weight:500;background:var(--color-surface-muted, rgba(0, 0, 0, .06));color:var(--color-text-secondary, #6e6e73)}.skill-inspect__badge--readonly[_ngcontent-%COMP%]{background:var(--color-surface-muted, rgba(0, 0, 0, .06));color:var(--color-text, #1d1d1f);border:1px solid var(--color-divider, rgba(0, 0, 0, .12))}.skill-inspect__collapsible[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:.5rem;width:100%;background:none;border:none;padding:0;cursor:pointer;font-family:inherit;text-align:left}.skill-inspect__chevron[_ngcontent-%COMP%]{font-size:.7rem;color:var(--color-text-secondary, #6e6e73);transition:transform .15s ease;flex-shrink:0}.skill-inspect__chevron--open[_ngcontent-%COMP%]{transform:rotate(180deg)}.skill-inspect__body[_ngcontent-%COMP%]{font-size:.9375rem;line-height:1.6;color:var(--color-text, #1d1d1f);max-height:520px;overflow-y:auto;padding:.875rem 1rem;border-radius:6px;background:var(--color-surface-muted, rgba(0, 0, 0, .04));word-break:break-word}.skill-inspect__body[_ngcontent-%COMP%] [_ngcontent-%COMP%]:first-child{margin-top:0}.skill-inspect__body[_ngcontent-%COMP%] [_ngcontent-%COMP%]:last-child{margin-bottom:0}.skill-inspect__body[_ngcontent-%COMP%] pre[_ngcontent-%COMP%], .skill-inspect__body[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{font-family:var(--font-code, monospace);font-size:.8125rem}.skill-inspect__body[_ngcontent-%COMP%] pre[_ngcontent-%COMP%]{padding:.75rem;border-radius:6px;background:var(--color-code-bg, rgba(0, 0, 0, .06));overflow-x:auto}.skill-inspect__resources[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:.5rem}.skill-inspect__resource[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .08));border-radius:6px;overflow:hidden}.skill-inspect__resource-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:.75rem;width:100%;background:none;border:none;padding:.625rem .875rem;cursor:pointer;font-family:inherit;text-align:left}.skill-inspect__resource-header[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .04))}.skill-inspect__resource-path[_ngcontent-%COMP%]{font-family:var(--font-code, monospace);font-size:.8125rem;color:var(--color-text, #1d1d1f);word-break:break-all}.skill-inspect__resource-content[_ngcontent-%COMP%]{margin:0;padding:.875rem;font-family:var(--font-code, monospace);font-size:.8125rem;color:var(--color-text, #1d1d1f);background:var(--color-surface-muted, rgba(0, 0, 0, .04));white-space:pre-wrap;word-break:break-word;max-height:320px;overflow-y:auto}"]})};export{G as SkillInspectComponent};
1
+ import {a}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-CZHly4Dq.js';import {s,U,O as On}from'./chunk-C881tCOG.js';import {p,$ as $t,c as It,M as Me,i as ie$1,E as Mi,a9 as pw,aa as Wn,_,v as vf,al as pu,z as za,f as dc,r as r_,C as Cf,h as hT,a as yb,d as pT,N as NT,t as tv,e as bT,I as Iv,D as gv,R as Rf,V as uc,n as yT,o as vT,l as lc,Y as v_,a1 as E_,J as mT,k as ig,m as sg,am as NC}from'./main-5NWD4SCX.js';var J=(e,n)=>n.name+n.grant;function K(e,n){if(e&1&&(za(0,"a",5),r_(1,"Edit skill \u2192"),Cf()),e&2){let i=NT();tv("routerLink",i.editRoute());}}function q(e,n){e&1&&(za(0,"span",6),r_(1,"Platform level"),Cf());}function Q(e,n){e&1&&(za(0,"p",7),r_(1,"Loading\u2026"),Cf());}function W(e,n){e&1&&(za(0,"p",8),r_(1,"Failed to load skill."),Cf());}function X(e,n){if(e&1&&(za(0,"dt",13),r_(1,"Created by"),Cf(),za(2,"dd",15),r_(3),Cf()),e&2){let i=NT(2);yb(3),Iv(i.createdBy);}}function Y(e,n){if(e&1&&(za(0,"dt",13),r_(1,"Last updated"),Cf(),za(2,"dd",15),r_(3),Cf()),e&2){let i=NT(2);yb(3),Iv(i.updatedOn);}}function Z(e,n){if(e&1&&(hT(0,X,4,1),hT(1,Y,4,1)),e&2){let i=NT();pT(i.createdBy?0:-1),yb(),pT(i.updatedOn?1:-1);}}function ee(e,n){if(e&1&&(za(0,"span",17),r_(1),Cf()),e&2){let i=NT(2);yb(),Rf("(",i.consumers().length,")");}}function te(e,n){e&1&&(za(0,"p",18),r_(1," A platform skill is offered to every namespace. Open it from a namespace to see which of its agents use it. "),Cf());}function ne(e,n){e&1&&(za(0,"p",18),r_(1,"Loading\u2026"),Cf());}function ie(e,n){e&1&&(za(0,"p",8),r_(1," The agent configs could not be read, so it is unknown whether any agent uses this skill. "),Cf());}function oe(e,n){e&1&&(za(0,"p",18),r_(1,"No agent references this skill."),Cf());}function le(e,n){e&1&&(za(0,"span",16),r_(1,"platform agent"),Cf());}function ae(e,n){e&1&&(za(0,"span",16),r_(1,"via *"),Cf());}function re(e,n){if(e&1&&(za(0,"li",24)(1,"span",26),r_(2),Cf(),hT(3,le,2,0,"span",16),hT(4,ae,2,0,"span",16),Cf()),e&2){let i=n.$implicit;yb(2),Iv(i.name),yb(),pT(i.platform?3:-1),yb(),pT(i.grant==="all"?4:-1);}}function se(e,n){if(e&1&&(za(0,"ul",23),yT(1,re,5,3,"li",24,J),Cf(),za(3,"p",25),r_(4," An agent listed "),za(5,"code"),r_(6,"via *"),Cf(),r_(7," takes the whole catalogue and keeps working without this skill. The others name it, so deleting the skill leaves their selector resolving to nothing. "),Cf()),e&2){let i=NT(2);yb(),vT(i.consumers());}}function ce(e,n){if(e&1&&(lc(0,"div",21),v_(1,"agentosMarkdown")),e&2){let i=NT();tv("innerHTML",E_(1,1,i.body),NC);}}function de(e,n){e&1&&(za(0,"p",18),r_(1,"No resources bundled with this skill."),Cf());}function pe(e,n){if(e&1&&(za(0,"pre",30),r_(1),Cf()),e&2){let i=NT().$implicit,a=NT(3);yb(),Iv(a.resourceContent(i));}}function me(e,n){if(e&1){let i=bT();za(0,"li",27)(1,"button",28),dc("click",function(){let s=ig(i).$implicit,g=NT(3);return sg(g.toggleResource(s))}),za(2,"span",29),r_(3),Cf(),za(4,"span",20),r_(5,"\u25BC"),Cf()(),hT(6,pe,2,1,"pre",30),Cf();}if(e&2){let i=n.$implicit,a=NT(3);yb(),uc("aria-expanded",a.isResourceExpanded(i)),yb(2),Iv(i),yb(),gv("skill-inspect__chevron--open",a.isResourceExpanded(i)),yb(2),pT(a.isResourceExpanded(i)?6:-1);}}function _e(e,n){if(e&1&&(za(0,"ul",22),yT(1,me,7,5,"li",27,mT),Cf()),e&2){let i=NT(2);yb(),vT(i.resourcePaths());}}function ge(e,n){if(e&1){let i=bT();za(0,"div",9)(1,"section",10)(2,"h2",11),r_(3,"General"),Cf(),za(4,"dl",12)(5,"dt",13),r_(6,"Name"),Cf(),za(7,"dd",14),r_(8),Cf(),za(9,"dt",13),r_(10,"Description"),Cf(),za(11,"dd",15),r_(12),Cf(),za(13,"dt",13),r_(14,"Scope"),Cf(),za(15,"dd",15),r_(16),Cf(),za(17,"dt",13),r_(18,"Storage"),Cf(),za(19,"dd",15)(20,"span",16),r_(21),Cf()(),hT(22,Z,2,2),Cf()(),za(23,"section",10)(24,"h2",11),r_(25," Used by "),hT(26,ee,2,1,"span",17),Cf(),hT(27,te,2,0,"p",18)(28,ne,2,0,"p",18)(29,ie,2,0,"p",8)(30,oe,2,0,"p",18)(31,se,8,0),Cf(),za(32,"section",10)(33,"button",19),dc("click",function(){ig(i);let s=NT();return sg(s.toggleBody())}),za(34,"h2",11),r_(35,"Body"),Cf(),za(36,"span",20),r_(37,"\u25BC"),Cf()(),hT(38,ce,2,3,"div",21),Cf(),za(39,"section",10)(40,"h2",11),r_(41," Resources "),za(42,"span",17),r_(43),Cf()(),hT(44,de,2,0,"p",18)(45,_e,3,0,"ul",22),Cf()();}if(e&2){let i=n,a=NT();yb(8),Iv(i.name),yb(4),Iv(i.description),yb(4),Iv(i.namespaceId?"Namespace":"Platform"),yb(4),gv("skill-inspect__badge--readonly",a.isFilesystemBacked()),yb(),Rf(" ",a.isFilesystemBacked()?"SKILL.md file (read-only)":"Database"," "),yb(),pT(a.isFilesystemBacked()?-1:22),yb(4),pT(!a.isPlatformMode&&!a.consumersLoading()&&!a.consumersUnavailable()?26:-1),yb(),pT(a.isPlatformMode?27:a.consumersLoading()?28:a.consumersUnavailable()?29:a.consumers().length===0?30:31),yb(6),uc("aria-expanded",!a.bodyCollapsed()),yb(3),gv("skill-inspect__chevron--open",!a.bodyCollapsed()),yb(2),pT(a.bodyCollapsed()?-1:38),yb(5),Rf("(",a.resourcePaths().length,")"),yb(),pT(a.resourcePaths().length===0?44:45);}}var G=class e{route=p($t);router=p(It);destroyRef=p(Me);skillState=p(o);agentState=p(s);namespaceId=this.route.snapshot.params.namespaceId;skillId=this.route.snapshot.params.skillId;isPlatformMode=!this.namespaceId;isLoading=ie$1(true);hasError=ie$1(false);skill=ie$1(null);bodyCollapsed=ie$1(false);expandedResources=ie$1(new Set);resourcePaths=Mi(()=>Object.keys(this.skill()?.resources??{}).sort());isFilesystemBacked=Mi(()=>this.skill()?.readOnly===true);consumers=ie$1([]);consumersUnavailable=ie$1(false);consumersLoading=ie$1(false);ngOnInit(){this.skillState.getById(this.skillId).pipe(U(this.destroyRef)).subscribe({next:n=>{this.skill.set(n),this.isLoading.set(false),this.loadConsumers(n.name);},error:()=>{this.hasError.set(true),this.isLoading.set(false);}});}loadConsumers(n){this.namespaceId&&(this.consumersLoading.set(true),pw({namespace:this.agentState.listByNamespace(this.namespaceId),platform:this.agentState.listPlatform().pipe(Wn(()=>_([])))}).pipe(U(this.destroyRef)).subscribe({next:({namespace:i,platform:a})=>{let s=[...this.toConsumers(i,n,false),...this.toConsumers(a,n,true)];this.consumers.set([...s.filter(g=>g.grant==="named"),...s.filter(g=>g.grant==="all")]),this.consumersLoading.set(false);},error:()=>{this.consumersUnavailable.set(true),this.consumersLoading.set(false);}}));}toConsumers(n,i,a$1){return n.map(s=>({config:s,grant:a(s.skillSelectors,i)})).filter(s=>s.grant!=="none").map(({config:s,grant:g})=>({name:s.name,grant:g,platform:a$1}))}toggleBody(){this.bodyCollapsed.update(n=>!n);}toggleResource(n){this.expandedResources.update(i=>{let a=new Set(i);return a.has(n)?a.delete(n):a.add(n),a});}isResourceExpanded(n){return this.expandedResources().has(n)}resourceContent(n){return this.skill()?.resources?.[n]??""}editRoute(){return this.isPlatformMode?["/agentos","admin","skills",this.skillId,"edit"]:["/agentos",this.namespaceId,"skills",this.skillId,"edit"]}back(){this.isPlatformMode?this.router.navigate(["/agentos","admin","skills"]):this.router.navigate(["/agentos",this.namespaceId,"skills"]);}static \u0275fac=function(i){return new(i||e)};static \u0275cmp=vf({type:e,selectors:[["agentos-skill-inspect"]],decls:13,vars:3,consts:[[1,"skill-inspect"],[1,"skill-inspect__header"],["type","button","title","Back to skills",1,"skill-inspect__back",3,"click"],[1,"skill-inspect__back-icon"],[1,"skill-inspect__title"],[1,"skill-inspect__sibling-link",3,"routerLink"],[1,"skill-inspect__platform-badge"],[1,"skill-inspect__loading"],["role","alert",1,"skill-inspect__error"],[1,"skill-inspect__content"],[1,"skill-inspect__section"],[1,"skill-inspect__section-title"],[1,"skill-inspect__dl"],[1,"skill-inspect__dt"],[1,"skill-inspect__dd","skill-inspect__dd--mono"],[1,"skill-inspect__dd"],[1,"skill-inspect__badge"],[1,"skill-inspect__count"],[1,"skill-inspect__empty"],["type","button",1,"skill-inspect__collapsible",3,"click"],[1,"skill-inspect__chevron"],[1,"skill-inspect__body",3,"innerHTML"],[1,"skill-inspect__resources"],[1,"skill-inspect__consumers"],[1,"skill-inspect__consumer"],[1,"skill-inspect__consumers-hint"],[1,"skill-inspect__consumer-name"],[1,"skill-inspect__resource"],["type","button",1,"skill-inspect__resource-header",3,"click"],[1,"skill-inspect__resource-path"],[1,"skill-inspect__resource-content"]],template:function(i,a){if(i&1&&(za(0,"div",0)(1,"header",1)(2,"button",2),dc("click",function(){return a.back()}),za(3,"span",3),r_(4,"\u2190"),Cf(),r_(5," Skills "),Cf(),za(6,"h1",4),r_(7,"Skill"),Cf(),hT(8,K,2,1,"a",5),hT(9,q,2,0,"span",6),Cf(),hT(10,Q,2,0,"p",7)(11,W,2,0,"p",8)(12,ge,46,15,"div",9),Cf()),i&2){let s;yb(8),pT(a.skill()&&!a.isFilesystemBacked()?8:-1),yb(),pT(a.isPlatformMode?9:-1),yb(),pT(a.isLoading()?10:a.hasError()?11:(s=a.skill())?12:-1,s);}},dependencies:[pu,On],styles:[".skill-inspect[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:720px;margin:0 auto;padding:2rem 1rem}.skill-inspect__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.skill-inspect__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}.skill-inspect__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.skill-inspect__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.skill-inspect__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.skill-inspect__sibling-link[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-primary, #007aff);text-decoration:none}.skill-inspect__sibling-link[_ngcontent-%COMP%]:hover{text-decoration:underline}.skill-inspect__platform-badge[_ngcontent-%COMP%]{align-self:flex-start;font-family:var(--font-heading);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;padding:.15rem .5rem;border:1px solid var(--color-divider, rgba(0, 0, 0, .12));color:var(--color-neutral-600, #6e6e73)}.skill-inspect__loading[_ngcontent-%COMP%], .skill-inspect__error[_ngcontent-%COMP%], .skill-inspect__empty[_ngcontent-%COMP%]{margin:0;font-size:.9rem;color:var(--color-text-secondary, #6e6e73)}.skill-inspect__error[_ngcontent-%COMP%]{color:var(--color-error, #ff3b30)}.skill-inspect__content[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.skill-inspect__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.75rem;padding:1.25rem;border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:10px}.skill-inspect__section-title[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;font-weight:600;color:var(--color-text, #1d1d1f)}.skill-inspect__count[_ngcontent-%COMP%]{font-weight:400;color:var(--color-text-secondary, #6e6e73);font-size:.875rem;margin-left:.25rem}.skill-inspect__dl[_ngcontent-%COMP%]{display:grid;grid-template-columns:max-content 1fr;gap:.5rem 1.25rem;margin:0}.skill-inspect__dt[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:500;color:var(--color-text-secondary, #6e6e73);align-self:center}.skill-inspect__dd[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;color:var(--color-text, #1d1d1f);align-self:center;word-break:break-word}.skill-inspect__dd--mono[_ngcontent-%COMP%]{font-family:monospace;font-size:.875rem}.skill-inspect__consumers[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:.375rem}.skill-inspect__consumer[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem}.skill-inspect__consumer-name[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500}.skill-inspect__consumers-hint[_ngcontent-%COMP%]{margin:.5rem 0 0;font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.skill-inspect__badge[_ngcontent-%COMP%]{display:inline-block;padding:.2em .6em;border-radius:4px;font-size:.75rem;font-weight:500;background:var(--color-surface-muted, rgba(0, 0, 0, .06));color:var(--color-text-secondary, #6e6e73)}.skill-inspect__badge--readonly[_ngcontent-%COMP%]{background:var(--color-surface-muted, rgba(0, 0, 0, .06));color:var(--color-text, #1d1d1f);border:1px solid var(--color-divider, rgba(0, 0, 0, .12))}.skill-inspect__collapsible[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:.5rem;width:100%;background:none;border:none;padding:0;cursor:pointer;font-family:inherit;text-align:left}.skill-inspect__chevron[_ngcontent-%COMP%]{font-size:.7rem;color:var(--color-text-secondary, #6e6e73);transition:transform .15s ease;flex-shrink:0}.skill-inspect__chevron--open[_ngcontent-%COMP%]{transform:rotate(180deg)}.skill-inspect__body[_ngcontent-%COMP%]{font-size:.9375rem;line-height:1.6;color:var(--color-text, #1d1d1f);max-height:520px;overflow-y:auto;padding:.875rem 1rem;border-radius:6px;background:var(--color-surface-muted, rgba(0, 0, 0, .04));word-break:break-word}.skill-inspect__body[_ngcontent-%COMP%] [_ngcontent-%COMP%]:first-child{margin-top:0}.skill-inspect__body[_ngcontent-%COMP%] [_ngcontent-%COMP%]:last-child{margin-bottom:0}.skill-inspect__body[_ngcontent-%COMP%] pre[_ngcontent-%COMP%], .skill-inspect__body[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{font-family:var(--font-code, monospace);font-size:.8125rem}.skill-inspect__body[_ngcontent-%COMP%] pre[_ngcontent-%COMP%]{padding:.75rem;border-radius:6px;background:var(--color-code-bg, rgba(0, 0, 0, .06));overflow-x:auto}.skill-inspect__resources[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:.5rem}.skill-inspect__resource[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .08));border-radius:6px;overflow:hidden}.skill-inspect__resource-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:.75rem;width:100%;background:none;border:none;padding:.625rem .875rem;cursor:pointer;font-family:inherit;text-align:left}.skill-inspect__resource-header[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .04))}.skill-inspect__resource-path[_ngcontent-%COMP%]{font-family:var(--font-code, monospace);font-size:.8125rem;color:var(--color-text, #1d1d1f);word-break:break-all}.skill-inspect__resource-content[_ngcontent-%COMP%]{margin:0;padding:.875rem;font-family:var(--font-code, monospace);font-size:.8125rem;color:var(--color-text, #1d1d1f);background:var(--color-surface-muted, rgba(0, 0, 0, .04));white-space:pre-wrap;word-break:break-word;max-height:320px;overflow-y:auto}"]})};export{G as SkillInspectComponent};
@@ -1,2 +1,2 @@
1
- import {R}from'./chunk-Cvn7x879.js';import {p,$ as $t,aN as _,M as Me,i as ie$1,E as Mi,aO as Re,a9 as pw,aa as Wn,_ as _$1,v as vf,z as za,r as r_,C as Cf,h as hT,a as yb,d as pT,e as bT,f as dc,s as sS,n as yT,N as NT,t as tv,g as cS,o as vT,R as Rf,I as Iv,D as gv,aj as Cv,k as ig,m as sg}from'./main-OIPNBOIH.js';import {U,D as Yn,Z as Zn,X as Xn,Y as Ye,f as Ft,e as bt,L as Ln,H as ln}from'./chunk-DdISK7Z0.js';import'./chunk-2uSZyBhs.js';var q=(a,t)=>t.id;function $(a,t){a&1&&(za(0,"p",3),r_(1,"Loading\u2026"),Cf());}function J(a,t){if(a&1&&(za(0,"p",6),r_(1),Cf()),a&2){let e=NT(2);yb(),Iv(e.errorMessage());}}function Q(a,t){if(a&1){let e=bT();za(0,"button",26),dc("click",function(){ig(e);let s=NT(2);return sg(s.retryLoad())}),r_(1,"Retry loading"),Cf();}}function X(a,t){if(a&1&&(za(0,"span",28),r_(1),Cf()),a&2){let e=NT(3);yb(),Iv(e.association()?.checkoutFailureReason);}}function Z(a,t){if(a&1&&(za(0,"p",27),r_(1),hT(2,X,2,1,"span",28),Cf()),a&2){let e=NT(2);gv("namespace-git__status--failed",e.checkoutStatus()===e.CheckoutStatus.FAILED)("namespace-git__status--ready",e.checkoutStatus()===e.CheckoutStatus.READY),yb(),Rf(" Repository: ",e.checkoutStatus()," "),yb(),pT(e.association()?.checkoutFailureReason?2:-1);}}function ee(a,t){if(a&1&&(za(0,"option",18),r_(1),Cf()),a&2){let e=t.$implicit,d=NT(2);tv("value",e.id),yb(),Cv("",e.name," (",d.authTypeLabel(e.authType),")");}}function te(a,t){a&1&&(za(0,"span",19),r_(1," No usable auth setting in this namespace. Create a BEARER_TOKEN one first. "),Cf());}function ne(a,t){if(a&1){let e=bT();za(0,"button",29),dc("click",function(){ig(e);let s=NT(2);return sg(s.remove())}),r_(1," Remove association "),Cf();}if(a&2){let e=NT(2);tv("disabled",!e.associationLoaded()||e.isSaving());}}function ie(a,t){if(a&1){let e=bT();za(0,"div",4)(1,"p",5),r_(2," Associating a repository enables Git workspaces for this namespace. When worktree creation is enabled, every new top-level case gets a repo/ directory shared by its sub-cases. Namespace files remain shared documents outside Git. Agents create branches and pull requests in their workflows. "),Cf(),hT(3,J,2,1,"p",6),hT(4,Q,2,0,"button",7),hT(5,Z,3,6,"p",8),za(6,"fieldset",9)(7,"legend",10),r_(8,"Repository"),Cf(),za(9,"label",11)(10,"span",12),r_(11,"Repository URL"),Cf(),za(12,"input",13),dc("ngModelChange",function(s){ig(e);let p=NT();return sg(p.repositoryUrl.set(s))}),Cf(),sS(),za(13,"span",14),r_(14,"HTTPS only, without credentials in the URL."),Cf()(),za(15,"label",11)(16,"span",12),r_(17,"Main branch"),Cf(),za(18,"input",15),dc("ngModelChange",function(s){ig(e);let p=NT();return sg(p.mainBranch.set(s))}),Cf(),sS(),za(19,"span",14),r_(20,"New worktrees start at this branch\u2019s commit, without creating a branch."),Cf()(),za(21,"label",11)(22,"span",12),r_(23,"Service account"),Cf(),za(24,"select",16),dc("ngModelChange",function(s){ig(e);let p=NT();return sg(p.serviceAuthSettingId.set(s))}),za(25,"option",17),r_(26,"Select an auth setting\u2026"),Cf(),yT(27,ee,2,3,"option",18,q),Cf(),sS(),za(29,"span",14),r_(30," Shared by the namespace. Every Git operation uses this identity, never the identity of whoever opened the case. "),Cf(),hT(31,te,2,0,"span",19),Cf()(),za(32,"fieldset",9)(33,"legend",10),r_(34,"Automation"),Cf(),za(35,"label",20)(36,"input",21),dc("ngModelChange",function(s){ig(e);let p=NT();return sg(p.autoWorktree.set(s))}),Cf(),sS(),za(37,"span"),r_(38,"Create a worktree for every new top-level case"),Cf()(),za(39,"span",14),r_(40," Applies to cases created from now on. Turning this on later never equips existing cases, and turning it off never removes a worktree already created. "),Cf(),za(41,"label",11)(42,"span",12),r_(43,"Setup command (optional)"),Cf(),za(44,"input",22),dc("ngModelChange",function(s){ig(e);let p=NT();return sg(p.setupCommand.set(s))}),Cf(),sS(),za(45,"span",19),r_(46," Runs on the server, as the service user, in each new worktree. It executes code from the branch \u2014 prefer a command that disables lifecycle scripts. "),Cf()()(),za(47,"div",23)(48,"button",24),dc("click",function(){ig(e);let s=NT();return sg(s.save())}),r_(49),Cf(),hT(50,ne,2,1,"button",25),Cf()();}if(a&2){let e=NT();yb(3),pT(e.errorMessage()?3:-1),yb(),pT(e.associationLoaded()?-1:4),yb(),pT(e.isAssociated()&&e.checkoutStatus()?5:-1),yb(),tv("disabled",!e.associationLoaded()||e.isSaving()),yb(6),tv("ngModel",e.repositoryUrl()),cS(),yb(6),tv("ngModel",e.mainBranch()),cS(),yb(6),tv("ngModel",e.serviceAuthSettingId()),cS(),yb(3),vT(e.eligibleAuthSettings()),yb(4),pT(e.eligibleAuthSettings().length===0?31:-1),yb(),tv("disabled",!e.associationLoaded()||e.isSaving()),yb(4),tv("ngModel",e.autoWorktree()),cS(),yb(8),tv("ngModel",e.setupCommand()),cS(),yb(4),tv("disabled",!e.canSave()),yb(),Rf(" ",e.isSaving()?"Saving\u2026":e.isAssociated()?"Update":"Associate"," "),yb(),pT(e.isAssociated()?50:-1);}}var ae=["BearerTokenAuthSetting","BasicAuthAuthSetting","ApiKeyAuthSetting"],oe={BearerTokenAuthSetting:"token",BasicAuthAuthSetting:"basic auth",ApiKeyAuthSetting:"API key"},j=class a{route=p($t);gitApi=p(_);authSettingState=p(R);destroyRef=p(Me);isLoading=ie$1(true);isSaving=ie$1(false);associationLoaded=ie$1(false);errorMessage=ie$1(null);association=ie$1(null);authSettings=ie$1([]);repositoryUrl=ie$1("");mainBranch=ie$1("main");serviceAuthSettingId=ie$1("");autoWorktree=ie$1(false);setupCommand=ie$1("");namespaceId="";isAssociated=Mi(()=>this.association()?.associated===true);eligibleAuthSettings=Mi(()=>this.authSettings().filter(t=>ae.includes(t.authType)));authTypeLabel(t){return oe[t??""]??t??"unknown"}canSave=Mi(()=>this.associationLoaded()&&!this.isLoading()&&!this.isSaving()&&this.repositoryUrl().trim().length>0&&this.serviceAuthSettingId().length>0);checkoutStatus=Mi(()=>this.association()?.checkoutStatus??null);CheckoutStatus=Re;ngOnInit(){this.namespaceId=this.route.snapshot.paramMap.get("namespaceId")??"",this.load();}retryLoad(){this.isLoading()||this.isSaving()||this.load();}load(){this.isLoading.set(true),this.associationLoaded.set(false),this.errorMessage.set(null),pw({association:this.gitApi.getAssociationNamespaceGit(this.namespaceId),authSettings:this.authSettingState.loadNamespaceSettings(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe({next:({association:t,authSettings:e})=>{this.authSettings.set(e??[]),this.acceptAssociation(t),this.isLoading.set(false);},error:t=>{console.error("Failed to load the Git repository settings",t),this.errorMessage.set(this.messageOf(t)),this.isLoading.set(false);}});}acceptAssociation(t){this.association.set(t);let e=t?.associated===false||t?.associated===true&&typeof t.repositoryUrl=="string"&&typeof t.mainBranch=="string"&&typeof t.serviceAuthSettingId=="string"&&typeof t.autoWorktreeForRootCases=="boolean"&&(t.setupCommand==null||typeof t.setupCommand=="string");this.associationLoaded.set(e),e?this.applyToForm(t):this.errorMessage.set("The repository settings could not be loaded completely. Retry before making changes.");}applyToForm(t){this.repositoryUrl.set(t.repositoryUrl??""),this.mainBranch.set(t.mainBranch??"main"),this.serviceAuthSettingId.set(t.serviceAuthSettingId??""),this.autoWorktree.set(t.autoWorktreeForRootCases??false),this.setupCommand.set(t.setupCommand??"");}save(){this.canSave()&&(this.isSaving.set(true),this.errorMessage.set(null),this.gitApi.setAssociationNamespaceGit(this.namespaceId,{repositoryUrl:this.repositoryUrl().trim(),mainBranch:this.mainBranch().trim()||void 0,serviceAuthSettingId:this.serviceAuthSettingId(),autoWorktreeForRootCases:this.autoWorktree(),setupCommand:this.setupCommand().trim()||void 0}).pipe(U(this.destroyRef),Wn(t=>(console.error("Failed to save the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),_$1(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}remove(){!this.associationLoaded()||this.isLoading()||this.isSaving()||!this.isAssociated()||confirm("Remove the repository association? Existing workspaces keep their worktree.")&&(this.isSaving.set(true),this.gitApi.removeAssociationNamespaceGit(this.namespaceId).pipe(U(this.destroyRef),Wn(t=>(console.error("Failed to remove the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),_$1(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}messageOf(t){return t.error?.message??t.message??"Unexpected error"}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=vf({type:a,selectors:[["agentos-namespace-git"]],decls:6,vars:1,consts:[[1,"namespace-git"],[1,"namespace-git__header"],[1,"namespace-git__title"],[1,"namespace-git__loading"],[1,"namespace-git__body"],[1,"namespace-git__hint"],["role","alert",1,"namespace-git__error"],["type","button",1,"namespace-git__retry"],[1,"namespace-git__status",3,"namespace-git__status--failed","namespace-git__status--ready"],[1,"namespace-git__section",3,"disabled"],[1,"namespace-git__label"],[1,"namespace-git__field"],[1,"namespace-git__field-label"],["type","url","placeholder","https://forge.example/org/project.git","name","repositoryUrl",1,"namespace-git__input",3,"ngModelChange","ngModel"],[1,"namespace-git__field-hint"],["type","text","placeholder","main","name","mainBranch",1,"namespace-git__input",3,"ngModelChange","ngModel"],["name","serviceAuthSettingId",1,"namespace-git__input",3,"ngModelChange","ngModel"],["value",""],[3,"value"],[1,"namespace-git__field-hint","namespace-git__field-hint--warn"],[1,"namespace-git__checkbox"],["type","checkbox","name","autoWorktree",3,"ngModelChange","ngModel"],["type","text","placeholder","pnpm install --ignore-scripts","name","setupCommand",1,"namespace-git__input",3,"ngModelChange","ngModel"],[1,"namespace-git__actions"],["type","button",1,"namespace-git__save",3,"click","disabled"],["type","button",1,"namespace-git__remove",3,"disabled"],["type","button",1,"namespace-git__retry",3,"click"],[1,"namespace-git__status"],[1,"namespace-git__status-reason"],["type","button",1,"namespace-git__remove",3,"click","disabled"]],template:function(e,d){e&1&&(za(0,"div",0)(1,"header",1)(2,"h1",2),r_(3,"Git repository"),Cf()(),hT(4,$,2,0,"p",3)(5,ie,51,14,"div",4),Cf()),e&2&&(yb(4),pT(d.isLoading()?4:5));},dependencies:[Yn,Zn,Xn,Ye,Ft,bt,Ln,ln],styles:[".namespace-git[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.namespace-git__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.namespace-git__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}.namespace-git__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.namespace-git__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem}.namespace-git__body[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.namespace-git__hint[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6b7280)}.namespace-git__error[_ngcontent-%COMP%]{margin:0;padding:.75rem;border-radius:.375rem;background:var(--red-bg, #fef2f2);color:var(--color-error, #b91c1c);font-size:.875rem}.namespace-git__status[_ngcontent-%COMP%]{margin:0;padding:.5rem .75rem;border-radius:.375rem;background:var(--color-surface-secondary, #f3f4f6);font-size:.875rem;display:flex;flex-direction:column;gap:.25rem}.namespace-git__status--ready[_ngcontent-%COMP%]{background:var(--color-success-bg, #ecfdf5);color:var(--color-success, #047857)}.namespace-git__status--failed[_ngcontent-%COMP%]{background:var(--red-bg, #fef2f2);color:var(--color-error, #b91c1c)}.namespace-git__status-reason[_ngcontent-%COMP%]{font-size:.8125rem;opacity:.9}.namespace-git__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;border:1px solid var(--color-border, #e5e7eb);border-radius:.5rem;padding:1rem;margin:0}.namespace-git__label[_ngcontent-%COMP%]{font-weight:600;font-size:.9375rem;padding:0 .25rem}.namespace-git__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.namespace-git__field-label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500}.namespace-git__field-hint[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-text-secondary, #6b7280)}.namespace-git__field-hint--warn[_ngcontent-%COMP%]{color:var(--color-warning, #b45309)}.namespace-git__input[_ngcontent-%COMP%]{font-family:inherit;font-size:.875rem;padding:.5rem .625rem;border:1px solid var(--color-border, #e5e7eb);border-radius:.375rem;background:var(--color-surface, #fff);color:inherit}.namespace-git__checkbox[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;font-size:.875rem;cursor:pointer}.namespace-git__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;align-items:center}.namespace-git__save[_ngcontent-%COMP%], .namespace-git__retry[_ngcontent-%COMP%], .namespace-git__remove[_ngcontent-%COMP%], .namespace-git__cancel[_ngcontent-%COMP%]{font-family:inherit;font-size:.875rem;padding:.5rem 1rem;border-radius:.375rem;cursor:pointer;border:1px solid transparent}.namespace-git__save[_ngcontent-%COMP%]:disabled, .namespace-git__retry[_ngcontent-%COMP%]:disabled, .namespace-git__remove[_ngcontent-%COMP%]:disabled, .namespace-git__cancel[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.namespace-git__save[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);color:var(--color-text-on-accent, #fff)}.namespace-git__remove[_ngcontent-%COMP%]{background:none;border-color:var(--color-error, #b91c1c);color:var(--color-error, #b91c1c)}.namespace-git__cancel[_ngcontent-%COMP%], .namespace-git__retry[_ngcontent-%COMP%]{background:none;border-color:var(--color-border, #e5e7eb);color:inherit}"]})};
1
+ import {R}from'./chunk-Dzos_5V1.js';import {p,$ as $t,aN as _,M as Me,i as ie$1,E as Mi,aO as Re,a9 as pw,aa as Wn,_ as _$1,v as vf,z as za,r as r_,C as Cf,h as hT,a as yb,d as pT,e as bT,f as dc,s as sS,n as yT,N as NT,t as tv,g as cS,o as vT,R as Rf,I as Iv,D as gv,aj as Cv,k as ig,m as sg}from'./main-5NWD4SCX.js';import {U,D as Yn,Z as Zn,X as Xn,Y as Ye,f as Ft,e as bt,L as Ln,H as ln}from'./chunk-C881tCOG.js';import'./chunk-B2R438Y9.js';var q=(a,t)=>t.id;function $(a,t){a&1&&(za(0,"p",3),r_(1,"Loading\u2026"),Cf());}function J(a,t){if(a&1&&(za(0,"p",6),r_(1),Cf()),a&2){let e=NT(2);yb(),Iv(e.errorMessage());}}function Q(a,t){if(a&1){let e=bT();za(0,"button",26),dc("click",function(){ig(e);let s=NT(2);return sg(s.retryLoad())}),r_(1,"Retry loading"),Cf();}}function X(a,t){if(a&1&&(za(0,"span",28),r_(1),Cf()),a&2){let e=NT(3);yb(),Iv(e.association()?.checkoutFailureReason);}}function Z(a,t){if(a&1&&(za(0,"p",27),r_(1),hT(2,X,2,1,"span",28),Cf()),a&2){let e=NT(2);gv("namespace-git__status--failed",e.checkoutStatus()===e.CheckoutStatus.FAILED)("namespace-git__status--ready",e.checkoutStatus()===e.CheckoutStatus.READY),yb(),Rf(" Repository: ",e.checkoutStatus()," "),yb(),pT(e.association()?.checkoutFailureReason?2:-1);}}function ee(a,t){if(a&1&&(za(0,"option",18),r_(1),Cf()),a&2){let e=t.$implicit,d=NT(2);tv("value",e.id),yb(),Cv("",e.name," (",d.authTypeLabel(e.authType),")");}}function te(a,t){a&1&&(za(0,"span",19),r_(1," No usable auth setting in this namespace. Create a BEARER_TOKEN one first. "),Cf());}function ne(a,t){if(a&1){let e=bT();za(0,"button",29),dc("click",function(){ig(e);let s=NT(2);return sg(s.remove())}),r_(1," Remove association "),Cf();}if(a&2){let e=NT(2);tv("disabled",!e.associationLoaded()||e.isSaving());}}function ie(a,t){if(a&1){let e=bT();za(0,"div",4)(1,"p",5),r_(2," Associating a repository enables Git workspaces for this namespace. When worktree creation is enabled, every new top-level case gets a repo/ directory shared by its sub-cases. Namespace files remain shared documents outside Git. Agents create branches and pull requests in their workflows. "),Cf(),hT(3,J,2,1,"p",6),hT(4,Q,2,0,"button",7),hT(5,Z,3,6,"p",8),za(6,"fieldset",9)(7,"legend",10),r_(8,"Repository"),Cf(),za(9,"label",11)(10,"span",12),r_(11,"Repository URL"),Cf(),za(12,"input",13),dc("ngModelChange",function(s){ig(e);let p=NT();return sg(p.repositoryUrl.set(s))}),Cf(),sS(),za(13,"span",14),r_(14,"HTTPS only, without credentials in the URL."),Cf()(),za(15,"label",11)(16,"span",12),r_(17,"Main branch"),Cf(),za(18,"input",15),dc("ngModelChange",function(s){ig(e);let p=NT();return sg(p.mainBranch.set(s))}),Cf(),sS(),za(19,"span",14),r_(20,"New worktrees start at this branch\u2019s commit, without creating a branch."),Cf()(),za(21,"label",11)(22,"span",12),r_(23,"Service account"),Cf(),za(24,"select",16),dc("ngModelChange",function(s){ig(e);let p=NT();return sg(p.serviceAuthSettingId.set(s))}),za(25,"option",17),r_(26,"Select an auth setting\u2026"),Cf(),yT(27,ee,2,3,"option",18,q),Cf(),sS(),za(29,"span",14),r_(30," Shared by the namespace. Every Git operation uses this identity, never the identity of whoever opened the case. "),Cf(),hT(31,te,2,0,"span",19),Cf()(),za(32,"fieldset",9)(33,"legend",10),r_(34,"Automation"),Cf(),za(35,"label",20)(36,"input",21),dc("ngModelChange",function(s){ig(e);let p=NT();return sg(p.autoWorktree.set(s))}),Cf(),sS(),za(37,"span"),r_(38,"Create a worktree for every new top-level case"),Cf()(),za(39,"span",14),r_(40," Applies to cases created from now on. Turning this on later never equips existing cases, and turning it off never removes a worktree already created. "),Cf(),za(41,"label",11)(42,"span",12),r_(43,"Setup command (optional)"),Cf(),za(44,"input",22),dc("ngModelChange",function(s){ig(e);let p=NT();return sg(p.setupCommand.set(s))}),Cf(),sS(),za(45,"span",19),r_(46," Runs on the server, as the service user, in each new worktree. It executes code from the branch \u2014 prefer a command that disables lifecycle scripts. "),Cf()()(),za(47,"div",23)(48,"button",24),dc("click",function(){ig(e);let s=NT();return sg(s.save())}),r_(49),Cf(),hT(50,ne,2,1,"button",25),Cf()();}if(a&2){let e=NT();yb(3),pT(e.errorMessage()?3:-1),yb(),pT(e.associationLoaded()?-1:4),yb(),pT(e.isAssociated()&&e.checkoutStatus()?5:-1),yb(),tv("disabled",!e.associationLoaded()||e.isSaving()),yb(6),tv("ngModel",e.repositoryUrl()),cS(),yb(6),tv("ngModel",e.mainBranch()),cS(),yb(6),tv("ngModel",e.serviceAuthSettingId()),cS(),yb(3),vT(e.eligibleAuthSettings()),yb(4),pT(e.eligibleAuthSettings().length===0?31:-1),yb(),tv("disabled",!e.associationLoaded()||e.isSaving()),yb(4),tv("ngModel",e.autoWorktree()),cS(),yb(8),tv("ngModel",e.setupCommand()),cS(),yb(4),tv("disabled",!e.canSave()),yb(),Rf(" ",e.isSaving()?"Saving\u2026":e.isAssociated()?"Update":"Associate"," "),yb(),pT(e.isAssociated()?50:-1);}}var ae=["BearerTokenAuthSetting","BasicAuthAuthSetting","ApiKeyAuthSetting"],oe={BearerTokenAuthSetting:"token",BasicAuthAuthSetting:"basic auth",ApiKeyAuthSetting:"API key"},j=class a{route=p($t);gitApi=p(_);authSettingState=p(R);destroyRef=p(Me);isLoading=ie$1(true);isSaving=ie$1(false);associationLoaded=ie$1(false);errorMessage=ie$1(null);association=ie$1(null);authSettings=ie$1([]);repositoryUrl=ie$1("");mainBranch=ie$1("main");serviceAuthSettingId=ie$1("");autoWorktree=ie$1(false);setupCommand=ie$1("");namespaceId="";isAssociated=Mi(()=>this.association()?.associated===true);eligibleAuthSettings=Mi(()=>this.authSettings().filter(t=>ae.includes(t.authType)));authTypeLabel(t){return oe[t??""]??t??"unknown"}canSave=Mi(()=>this.associationLoaded()&&!this.isLoading()&&!this.isSaving()&&this.repositoryUrl().trim().length>0&&this.serviceAuthSettingId().length>0);checkoutStatus=Mi(()=>this.association()?.checkoutStatus??null);CheckoutStatus=Re;ngOnInit(){this.namespaceId=this.route.snapshot.paramMap.get("namespaceId")??"",this.load();}retryLoad(){this.isLoading()||this.isSaving()||this.load();}load(){this.isLoading.set(true),this.associationLoaded.set(false),this.errorMessage.set(null),pw({association:this.gitApi.getAssociationNamespaceGit(this.namespaceId),authSettings:this.authSettingState.loadNamespaceSettings(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe({next:({association:t,authSettings:e})=>{this.authSettings.set(e??[]),this.acceptAssociation(t),this.isLoading.set(false);},error:t=>{console.error("Failed to load the Git repository settings",t),this.errorMessage.set(this.messageOf(t)),this.isLoading.set(false);}});}acceptAssociation(t){this.association.set(t);let e=t?.associated===false||t?.associated===true&&typeof t.repositoryUrl=="string"&&typeof t.mainBranch=="string"&&typeof t.serviceAuthSettingId=="string"&&typeof t.autoWorktreeForRootCases=="boolean"&&(t.setupCommand==null||typeof t.setupCommand=="string");this.associationLoaded.set(e),e?this.applyToForm(t):this.errorMessage.set("The repository settings could not be loaded completely. Retry before making changes.");}applyToForm(t){this.repositoryUrl.set(t.repositoryUrl??""),this.mainBranch.set(t.mainBranch??"main"),this.serviceAuthSettingId.set(t.serviceAuthSettingId??""),this.autoWorktree.set(t.autoWorktreeForRootCases??false),this.setupCommand.set(t.setupCommand??"");}save(){this.canSave()&&(this.isSaving.set(true),this.errorMessage.set(null),this.gitApi.setAssociationNamespaceGit(this.namespaceId,{repositoryUrl:this.repositoryUrl().trim(),mainBranch:this.mainBranch().trim()||void 0,serviceAuthSettingId:this.serviceAuthSettingId(),autoWorktreeForRootCases:this.autoWorktree(),setupCommand:this.setupCommand().trim()||void 0}).pipe(U(this.destroyRef),Wn(t=>(console.error("Failed to save the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),_$1(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}remove(){!this.associationLoaded()||this.isLoading()||this.isSaving()||!this.isAssociated()||confirm("Remove the repository association? Existing workspaces keep their worktree.")&&(this.isSaving.set(true),this.gitApi.removeAssociationNamespaceGit(this.namespaceId).pipe(U(this.destroyRef),Wn(t=>(console.error("Failed to remove the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),_$1(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}messageOf(t){return t.error?.message??t.message??"Unexpected error"}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=vf({type:a,selectors:[["agentos-namespace-git"]],decls:6,vars:1,consts:[[1,"namespace-git"],[1,"namespace-git__header"],[1,"namespace-git__title"],[1,"namespace-git__loading"],[1,"namespace-git__body"],[1,"namespace-git__hint"],["role","alert",1,"namespace-git__error"],["type","button",1,"namespace-git__retry"],[1,"namespace-git__status",3,"namespace-git__status--failed","namespace-git__status--ready"],[1,"namespace-git__section",3,"disabled"],[1,"namespace-git__label"],[1,"namespace-git__field"],[1,"namespace-git__field-label"],["type","url","placeholder","https://forge.example/org/project.git","name","repositoryUrl",1,"namespace-git__input",3,"ngModelChange","ngModel"],[1,"namespace-git__field-hint"],["type","text","placeholder","main","name","mainBranch",1,"namespace-git__input",3,"ngModelChange","ngModel"],["name","serviceAuthSettingId",1,"namespace-git__input",3,"ngModelChange","ngModel"],["value",""],[3,"value"],[1,"namespace-git__field-hint","namespace-git__field-hint--warn"],[1,"namespace-git__checkbox"],["type","checkbox","name","autoWorktree",3,"ngModelChange","ngModel"],["type","text","placeholder","pnpm install --ignore-scripts","name","setupCommand",1,"namespace-git__input",3,"ngModelChange","ngModel"],[1,"namespace-git__actions"],["type","button",1,"namespace-git__save",3,"click","disabled"],["type","button",1,"namespace-git__remove",3,"disabled"],["type","button",1,"namespace-git__retry",3,"click"],[1,"namespace-git__status"],[1,"namespace-git__status-reason"],["type","button",1,"namespace-git__remove",3,"click","disabled"]],template:function(e,d){e&1&&(za(0,"div",0)(1,"header",1)(2,"h1",2),r_(3,"Git repository"),Cf()(),hT(4,$,2,0,"p",3)(5,ie,51,14,"div",4),Cf()),e&2&&(yb(4),pT(d.isLoading()?4:5));},dependencies:[Yn,Zn,Xn,Ye,Ft,bt,Ln,ln],styles:[".namespace-git[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.namespace-git__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.namespace-git__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}.namespace-git__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.namespace-git__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem}.namespace-git__body[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.namespace-git__hint[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6b7280)}.namespace-git__error[_ngcontent-%COMP%]{margin:0;padding:.75rem;border-radius:.375rem;background:var(--red-bg, #fef2f2);color:var(--color-error, #b91c1c);font-size:.875rem}.namespace-git__status[_ngcontent-%COMP%]{margin:0;padding:.5rem .75rem;border-radius:.375rem;background:var(--color-surface-secondary, #f3f4f6);font-size:.875rem;display:flex;flex-direction:column;gap:.25rem}.namespace-git__status--ready[_ngcontent-%COMP%]{background:var(--color-success-bg, #ecfdf5);color:var(--color-success, #047857)}.namespace-git__status--failed[_ngcontent-%COMP%]{background:var(--red-bg, #fef2f2);color:var(--color-error, #b91c1c)}.namespace-git__status-reason[_ngcontent-%COMP%]{font-size:.8125rem;opacity:.9}.namespace-git__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;border:1px solid var(--color-border, #e5e7eb);border-radius:.5rem;padding:1rem;margin:0}.namespace-git__label[_ngcontent-%COMP%]{font-weight:600;font-size:.9375rem;padding:0 .25rem}.namespace-git__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.namespace-git__field-label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500}.namespace-git__field-hint[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-text-secondary, #6b7280)}.namespace-git__field-hint--warn[_ngcontent-%COMP%]{color:var(--color-warning, #b45309)}.namespace-git__input[_ngcontent-%COMP%]{font-family:inherit;font-size:.875rem;padding:.5rem .625rem;border:1px solid var(--color-border, #e5e7eb);border-radius:.375rem;background:var(--color-surface, #fff);color:inherit}.namespace-git__checkbox[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;font-size:.875rem;cursor:pointer}.namespace-git__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;align-items:center}.namespace-git__save[_ngcontent-%COMP%], .namespace-git__retry[_ngcontent-%COMP%], .namespace-git__remove[_ngcontent-%COMP%], .namespace-git__cancel[_ngcontent-%COMP%]{font-family:inherit;font-size:.875rem;padding:.5rem 1rem;border-radius:.375rem;cursor:pointer;border:1px solid transparent}.namespace-git__save[_ngcontent-%COMP%]:disabled, .namespace-git__retry[_ngcontent-%COMP%]:disabled, .namespace-git__remove[_ngcontent-%COMP%]:disabled, .namespace-git__cancel[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.namespace-git__save[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);color:var(--color-text-on-accent, #fff)}.namespace-git__remove[_ngcontent-%COMP%]{background:none;border-color:var(--color-error, #b91c1c);color:var(--color-error, #b91c1c)}.namespace-git__cancel[_ngcontent-%COMP%], .namespace-git__retry[_ngcontent-%COMP%]{background:none;border-color:var(--color-border, #e5e7eb);color:inherit}"]})};
2
2
  export{j as NamespaceGitComponent};
@@ -1 +1 @@
1
- import {j as Vi,h as qe}from'./chunk-DdISK7Z0.js';import {p,c as It,T as mc,U as N$,i as ie,E as Mi,v as vf,z as za,r as r_,C as Cf,h as hT,D as gv,a as yb,I as Iv,d as pT,N as NT,aj as Cv,e as bT,f as dc,t as tv,k as ig,m as sg}from'./main-OIPNBOIH.js';function A(t,n){t&1&&(za(0,"span",4),r_(1,"SKILL.md"),Cf());}function E(t,n){if(t&1&&(za(0,"span",5),r_(1),Cf()),t&2){let e=NT();yb(),Iv(e.skill().description);}}function T(t,n){if(t&1&&(za(0,"span",6),r_(1),Cf()),t&2){let e=NT();yb(),Cv(" ",e.resourceCount()," ",e.resourceCount()===1?"resource":"resources"," ");}}function B(t,n){if(t&1&&(za(0,"span",6),r_(1),Cf()),t&2){let e=NT();yb(),Cv(" named by ",e.namedByAgents()," ",e.namedByAgents()===1?"agent":"agents"," ");}}function N(t,n){if(t&1&&r_(0),t&2){let e=NT(2);Cv(" Delete? ",e.namedByAgents()," ",e.namedByAgents()===1?"agent":"agents"," would be left naming it. ");}}function V(t,n){t&1&&r_(0," Delete? ");}function K(t,n){if(t&1){let e=bT();za(0,"span",9),hT(1,N,1,2)(2,V,1,0),Cf(),za(3,"ds-icon-button",10),dc("action",function(){ig(e);let p=NT();return sg(p.onDeleteConfirmed())}),Cf(),za(4,"ds-icon-button",11),dc("action",function(){ig(e);let p=NT();return sg(p.onDeleteCancelled())}),Cf();}if(t&2){let e=NT();yb(),pT(e.namedByAgents()>0?1:2);}}function q(t,n){if(t&1){let e=bT();za(0,"ds-kebab-menu",12),dc("itemSelected",function(p){ig(e);let P=NT();return sg(P.onMenuAction(p))}),Cf();}if(t&2){let e=NT();tv("items",e.isImmutable()?e.readOnlyMenuItems:e.menuItems);}}var D=class t{router=p(It);skill=mc.required();namespaceId=mc(void 0);platformMode=mc(false);readOnly=mc(false);namedByAgents=mc(0);deleteRequested=N$();pendingDelete=ie(false);isImmutable=Mi(()=>this.readOnly()||this.skill().readOnly===true);resourceCount=Mi(()=>Object.keys(this.skill().resources??{}).length);menuItems=[{key:"inspect",label:"View skill",icon:"search"},{key:"edit",label:"Edit skill",icon:"edit"},{key:"delete",label:"Delete skill",icon:"delete",variant:"danger"}];readOnlyMenuItems=[{key:"inspect",label:"View skill",icon:"search"}];onMenuAction(n){switch(n){case "inspect":this.router.navigate(this.route("inspect"));break;case "edit":this.router.navigate(this.route("edit"));break;case "delete":this.pendingDelete.set(true);break}}onDeleteConfirmed(){this.pendingDelete.set(false),this.deleteRequested.emit(this.skill());}onDeleteCancelled(){this.pendingDelete.set(false);}route(n){let e=this.skill().id??"";return this.platformMode()?["/agentos","admin","skills",e,n]:["/agentos",this.namespaceId()??"","skills",e,n]}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=vf({type:t,selectors:[["agentos-skill-item"]],inputs:{skill:[1,"skill"],namespaceId:[1,"namespaceId"],platformMode:[1,"platformMode"],readOnly:[1,"readOnly"],namedByAgents:[1,"namedByAgents"]},outputs:{deleteRequested:"deleteRequested"},decls:12,vars:8,consts:[["role","listitem",1,"skill-item"],[1,"skill-item__body"],[1,"skill-item__name-row"],[1,"skill-item__name"],["data-variant","neutral","aria-label","Skill defined by a SKILL.md file, read-only through the API",1,"skill-item__badge"],[1,"skill-item__description"],[1,"skill-item__meta"],[1,"skill-item__actions"],[3,"items"],[1,"skill-item__confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel deletion",3,"action"],[3,"itemSelected","items"]],template:function(e,a){e&1&&(za(0,"div",0)(1,"div",1)(2,"div",2)(3,"span",3),r_(4),Cf(),hT(5,A,2,0,"span",4),Cf(),hT(6,E,2,1,"span",5),hT(7,T,2,2,"span",6),hT(8,B,2,2,"span",6),Cf(),za(9,"div",7),hT(10,K,5,1)(11,q,1,1,"ds-kebab-menu",8),Cf()()),e&2&&(gv("skill-item--pending-delete",a.pendingDelete()),yb(4),Iv(a.skill().name),yb(),pT(a.skill().readOnly?5:-1),yb(),pT(a.skill().description?6:-1),yb(),pT(a.resourceCount()>0?7:-1),yb(),pT(a.namedByAgents()>0?8:-1),yb(2),pT(a.pendingDelete()?10:11));},dependencies:[Vi,qe],styles:[".skill-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem 1rem;border-radius:10px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--glass-bg, rgba(255, 255, 255, .72));-webkit-backdrop-filter:var(--glass-backdrop-blur, blur(20px));backdrop-filter:var(--glass-backdrop-blur, blur(20px));transition:background .15s ease,border-color .15s ease}.skill-item[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .04));border-color:var(--color-primary, #007aff)}.skill-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.skill-item__name-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;min-width:0}.skill-item__name[_ngcontent-%COMP%]{font-size:.95rem;font-weight:500;color:var(--color-text, #1d1d1f);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.skill-item__badge[_ngcontent-%COMP%]{flex-shrink:0;font-family:var(--font-heading);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:none;border-radius:0;padding:.15rem .5rem;white-space:nowrap}.skill-item__badge[data-variant=neutral][_ngcontent-%COMP%]{border:1px solid var(--color-divider, rgba(0, 0, 0, .12));color:var(--color-neutral-600, #6e6e73);background:transparent}.skill-item__description[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary, #6e6e73);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.skill-item__meta[_ngcontent-%COMP%]{font-size:.7rem;color:var(--color-text-tertiary, #8e8e93)}.skill-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.skill-item[_ngcontent-%COMP%]:hover .skill-item__actions[_ngcontent-%COMP%], .skill-item[_ngcontent-%COMP%]:focus-within .skill-item__actions[_ngcontent-%COMP%], .skill-item--pending-delete[_ngcontent-%COMP%] .skill-item__actions[_ngcontent-%COMP%]{opacity:1}.skill-item__confirm-label[_ngcontent-%COMP%]{font-size:.8rem;font-weight:500;color:var(--color-error, #ff3b30);margin-right:.25rem;white-space:nowrap}"]})};export{D};
1
+ import {j as Vi,h as qe}from'./chunk-C881tCOG.js';import {p,c as It,T as mc,U as N$,i as ie,E as Mi,v as vf,z as za,r as r_,C as Cf,h as hT,D as gv,a as yb,I as Iv,d as pT,N as NT,aj as Cv,e as bT,f as dc,t as tv,k as ig,m as sg}from'./main-5NWD4SCX.js';function A(t,n){t&1&&(za(0,"span",4),r_(1,"SKILL.md"),Cf());}function E(t,n){if(t&1&&(za(0,"span",5),r_(1),Cf()),t&2){let e=NT();yb(),Iv(e.skill().description);}}function T(t,n){if(t&1&&(za(0,"span",6),r_(1),Cf()),t&2){let e=NT();yb(),Cv(" ",e.resourceCount()," ",e.resourceCount()===1?"resource":"resources"," ");}}function B(t,n){if(t&1&&(za(0,"span",6),r_(1),Cf()),t&2){let e=NT();yb(),Cv(" named by ",e.namedByAgents()," ",e.namedByAgents()===1?"agent":"agents"," ");}}function N(t,n){if(t&1&&r_(0),t&2){let e=NT(2);Cv(" Delete? ",e.namedByAgents()," ",e.namedByAgents()===1?"agent":"agents"," would be left naming it. ");}}function V(t,n){t&1&&r_(0," Delete? ");}function K(t,n){if(t&1){let e=bT();za(0,"span",9),hT(1,N,1,2)(2,V,1,0),Cf(),za(3,"ds-icon-button",10),dc("action",function(){ig(e);let p=NT();return sg(p.onDeleteConfirmed())}),Cf(),za(4,"ds-icon-button",11),dc("action",function(){ig(e);let p=NT();return sg(p.onDeleteCancelled())}),Cf();}if(t&2){let e=NT();yb(),pT(e.namedByAgents()>0?1:2);}}function q(t,n){if(t&1){let e=bT();za(0,"ds-kebab-menu",12),dc("itemSelected",function(p){ig(e);let P=NT();return sg(P.onMenuAction(p))}),Cf();}if(t&2){let e=NT();tv("items",e.isImmutable()?e.readOnlyMenuItems:e.menuItems);}}var D=class t{router=p(It);skill=mc.required();namespaceId=mc(void 0);platformMode=mc(false);readOnly=mc(false);namedByAgents=mc(0);deleteRequested=N$();pendingDelete=ie(false);isImmutable=Mi(()=>this.readOnly()||this.skill().readOnly===true);resourceCount=Mi(()=>Object.keys(this.skill().resources??{}).length);menuItems=[{key:"inspect",label:"View skill",icon:"search"},{key:"edit",label:"Edit skill",icon:"edit"},{key:"delete",label:"Delete skill",icon:"delete",variant:"danger"}];readOnlyMenuItems=[{key:"inspect",label:"View skill",icon:"search"}];onMenuAction(n){switch(n){case "inspect":this.router.navigate(this.route("inspect"));break;case "edit":this.router.navigate(this.route("edit"));break;case "delete":this.pendingDelete.set(true);break}}onDeleteConfirmed(){this.pendingDelete.set(false),this.deleteRequested.emit(this.skill());}onDeleteCancelled(){this.pendingDelete.set(false);}route(n){let e=this.skill().id??"";return this.platformMode()?["/agentos","admin","skills",e,n]:["/agentos",this.namespaceId()??"","skills",e,n]}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=vf({type:t,selectors:[["agentos-skill-item"]],inputs:{skill:[1,"skill"],namespaceId:[1,"namespaceId"],platformMode:[1,"platformMode"],readOnly:[1,"readOnly"],namedByAgents:[1,"namedByAgents"]},outputs:{deleteRequested:"deleteRequested"},decls:12,vars:8,consts:[["role","listitem",1,"skill-item"],[1,"skill-item__body"],[1,"skill-item__name-row"],[1,"skill-item__name"],["data-variant","neutral","aria-label","Skill defined by a SKILL.md file, read-only through the API",1,"skill-item__badge"],[1,"skill-item__description"],[1,"skill-item__meta"],[1,"skill-item__actions"],[3,"items"],[1,"skill-item__confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel deletion",3,"action"],[3,"itemSelected","items"]],template:function(e,a){e&1&&(za(0,"div",0)(1,"div",1)(2,"div",2)(3,"span",3),r_(4),Cf(),hT(5,A,2,0,"span",4),Cf(),hT(6,E,2,1,"span",5),hT(7,T,2,2,"span",6),hT(8,B,2,2,"span",6),Cf(),za(9,"div",7),hT(10,K,5,1)(11,q,1,1,"ds-kebab-menu",8),Cf()()),e&2&&(gv("skill-item--pending-delete",a.pendingDelete()),yb(4),Iv(a.skill().name),yb(),pT(a.skill().readOnly?5:-1),yb(),pT(a.skill().description?6:-1),yb(),pT(a.resourceCount()>0?7:-1),yb(),pT(a.namedByAgents()>0?8:-1),yb(2),pT(a.pendingDelete()?10:11));},dependencies:[Vi,qe],styles:[".skill-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem 1rem;border-radius:10px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--glass-bg, rgba(255, 255, 255, .72));-webkit-backdrop-filter:var(--glass-backdrop-blur, blur(20px));backdrop-filter:var(--glass-backdrop-blur, blur(20px));transition:background .15s ease,border-color .15s ease}.skill-item[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .04));border-color:var(--color-primary, #007aff)}.skill-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.skill-item__name-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;min-width:0}.skill-item__name[_ngcontent-%COMP%]{font-size:.95rem;font-weight:500;color:var(--color-text, #1d1d1f);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.skill-item__badge[_ngcontent-%COMP%]{flex-shrink:0;font-family:var(--font-heading);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:none;border-radius:0;padding:.15rem .5rem;white-space:nowrap}.skill-item__badge[data-variant=neutral][_ngcontent-%COMP%]{border:1px solid var(--color-divider, rgba(0, 0, 0, .12));color:var(--color-neutral-600, #6e6e73);background:transparent}.skill-item__description[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary, #6e6e73);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.skill-item__meta[_ngcontent-%COMP%]{font-size:.7rem;color:var(--color-text-tertiary, #8e8e93)}.skill-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.skill-item[_ngcontent-%COMP%]:hover .skill-item__actions[_ngcontent-%COMP%], .skill-item[_ngcontent-%COMP%]:focus-within .skill-item__actions[_ngcontent-%COMP%], .skill-item--pending-delete[_ngcontent-%COMP%] .skill-item__actions[_ngcontent-%COMP%]{opacity:1}.skill-item__confirm-label[_ngcontent-%COMP%]{font-size:.8rem;font-weight:500;color:var(--color-error, #ff3b30);margin-right:.25rem;white-space:nowrap}"]})};export{D};
@@ -1,2 +1,2 @@
1
- import {O}from'./chunk-BC30_IWf.js';import {R}from'./chunk-Cvn7x879.js';import {N}from'./chunk-EEpjj7pA.js';import {p,c as It,ar as Pn,M as Me$1,i as ie,E as Mi,ak as Ms,Q as j,v as vf,z as za,f as dc,C as Cf,r as r_,h as hT,a as yb,d as pT,n as yT,N as NT,o as vT,e as bT,D as gv,V as uc,I as Iv,R as Rf,l as lc,s as sS,t as tv,g as cS,k as ig,m as sg,H as dT}from'./main-OIPNBOIH.js';import {l,I,r as f,$,v as vt,F,U,K as Kn,z as zn,Z as Zn,X as Xn,Y as Ye,e as bt,L as Ln,W as Wn,V as Vn,y as yn,h as qe}from'./chunk-DdISK7Z0.js';import'./chunk-2uSZyBhs.js';var D=(r,i)=>i.value;function se(r,i){r&1&&(za(0,"p",4),r_(1,"Loading\u2026"),Cf());}function de(r,i){if(r&1){let e=bT();za(0,"button",18),dc("click",function(){let d=ig(e).$implicit,_=NT(2);return sg(_.setThemeVariant(d.value))}),za(1,"span",19),r_(2),Cf(),za(3,"span",20),r_(4),Cf()();}if(r&2){let e=i.$implicit,a=NT(2);gv("user-profile__theme-variant--active",a.themeVariant()===e.value),uc("aria-pressed",a.themeVariant()===e.value),yb(2),Iv(e.label),yb(2),Iv(e.description);}}function _e(r,i){if(r&1){let e=bT();za(0,"button",21),dc("click",function(){let d=ig(e).$implicit,_=NT(2);return sg(_.setTheme(d.value))}),r_(1),Cf();}if(r&2){let e=i.$implicit,a=NT(2);gv("user-profile__segmented-option--active",a.themeMode()===e.value),uc("aria-pressed",a.themeMode()===e.value),yb(),Rf(" ",e.label," ");}}function ce(r,i){if(r&1){let e=bT();za(0,"button",21),dc("click",function(){let d=ig(e).$implicit,_=NT(2);return sg(_.setEnterKeyBehavior(d.value))}),r_(1),Cf();}if(r&2){let e=i.$implicit,a=NT(2);gv("user-profile__segmented-option--active",a.enterKeyBehavior()===e.value),uc("aria-pressed",a.enterKeyBehavior()===e.value),yb(),Rf(" ",e.label," ");}}function pe(r,i){if(r&1&&(za(0,"option",32),r_(1),Cf()),r&2){let e=i.$implicit;tv("value",e.value),yb(),Iv(e.label);}}function me(r,i){if(r&1){let e=bT();za(0,"form",22),dc("ngSubmit",function(){ig(e);let d=NT(2);return sg(d.save())}),za(1,"div",5)(2,"h2",6),r_(3,"Identity"),Cf(),za(4,"div",7)(5,"span",8),r_(6,"Email"),Cf(),za(7,"span",23),r_(8),Cf()(),za(9,"div",7)(10,"span",8),r_(11,"External ID"),Cf(),za(12,"span",23),r_(13),Cf()()(),za(14,"div",5)(15,"h2",6),r_(16,"Profile"),Cf(),za(17,"div",7)(18,"label",24),r_(19,"First name"),Cf(),lc(20,"input",25),sS(),Cf(),za(21,"div",7)(22,"label",26),r_(23,"Last name"),Cf(),lc(24,"input",27),sS(),Cf(),za(25,"div",7)(26,"label",28),r_(27,"Bio"),Cf(),lc(28,"textarea",29),sS(),Cf(),za(29,"div",7)(30,"label",30),r_(31,"Language"),Cf(),za(32,"select",31),yT(33,pe,2,2,"option",32,D),Cf(),sS(),Cf()(),za(35,"div",33)(36,"button",34),r_(37),Cf(),za(38,"button",35),dc("click",function(){ig(e);let d=NT(2);return sg(d.cancelEditing())}),r_(39,"Cancel"),Cf()()();}if(r&2){let e=NT(),a=NT();tv("formGroup",a.form),yb(8),Iv(e.email),yb(5),Iv(e.externalId),yb(7),cS(),yb(4),cS(),yb(4),cS(),yb(4),cS(),yb(),vT(a.languageOptions),yb(3),tv("disabled",a.isSaving()),yb(),Rf(" ",a.isSaving()?"Saving\u2026":"Save changes"," ");}}function ue(r,i){r&1&&(za(0,"p",43),r_(1," No global configuration yet. Create one from the Integrations / AI Providers / Auth Settings pages of your namespaces. "),Cf());}function fe(r,i){if(r&1){let e=bT();za(0,"span",50),r_(1,"Delete?"),Cf(),za(2,"button",51),dc("click",function(){ig(e);let d=NT().$implicit,_=NT(6);return sg(_.confirmDelete(d))}),r_(3," Confirm "),Cf(),za(4,"button",52),dc("click",function(){ig(e);let d=NT(7);return sg(d.cancelDelete())}),r_(5," Cancel "),Cf();}}function ge(r,i){if(r&1){let e=bT();za(0,"button",52),dc("click",function(){ig(e);let d=NT().$implicit,_=NT(6);return sg(_.armDelete(d))}),r_(1," Delete "),Cf();}}function Ce(r,i){if(r&1&&(za(0,"li",46)(1,"span",47),r_(2),Cf(),za(3,"span",48),r_(4),Cf(),hT(5,fe,6,0)(6,ge,2,0,"button",49),Cf()),r&2){let e=i.$implicit,a=NT(6);yb(2),Iv(e.name),yb(2),Iv(e.subtitle),yb(),pT(a.isPendingDelete(e)?5:6);}}function ve(r,i){if(r&1&&(za(0,"h3",44),r_(1,"Integrations"),Cf(),za(2,"ul",45),yT(3,Ce,7,3,"li",46,dT().trackEntry,true),Cf()),r&2){let e=NT(5);yb(3),vT(e.recap().integrations);}}function xe(r,i){if(r&1){let e=bT();za(0,"span",50),r_(1,"Delete?"),Cf(),za(2,"button",51),dc("click",function(){ig(e);let d=NT().$implicit,_=NT(6);return sg(_.confirmDelete(d))}),r_(3," Confirm "),Cf(),za(4,"button",52),dc("click",function(){ig(e);let d=NT(7);return sg(d.cancelDelete())}),r_(5," Cancel "),Cf();}}function be(r,i){if(r&1){let e=bT();za(0,"button",52),dc("click",function(){ig(e);let d=NT().$implicit,_=NT(6);return sg(_.armDelete(d))}),r_(1," Delete "),Cf();}}function ye(r,i){if(r&1&&(za(0,"li",46)(1,"span",47),r_(2),Cf(),za(3,"span",48),r_(4),Cf(),hT(5,xe,6,0)(6,be,2,0,"button",49),Cf()),r&2){let e=i.$implicit,a=NT(6);yb(2),Iv(e.name),yb(2),Iv(e.subtitle),yb(),pT(a.isPendingDelete(e)?5:6);}}function he(r,i){if(r&1&&(za(0,"h3",44),r_(1,"AI Providers"),Cf(),za(2,"ul",45),yT(3,ye,7,3,"li",46,dT().trackEntry,true),Cf()),r&2){let e=NT(5);yb(3),vT(e.recap().aiProviders);}}function Ee(r,i){if(r&1){let e=bT();za(0,"span",50),r_(1,"Delete?"),Cf(),za(2,"button",51),dc("click",function(){ig(e);let d=NT().$implicit,_=NT(6);return sg(_.confirmDelete(d))}),r_(3," Confirm "),Cf(),za(4,"button",52),dc("click",function(){ig(e);let d=NT(7);return sg(d.cancelDelete())}),r_(5," Cancel "),Cf();}}function Pe(r,i){if(r&1){let e=bT();za(0,"button",52),dc("click",function(){ig(e);let d=NT().$implicit,_=NT(6);return sg(_.armDelete(d))}),r_(1," Delete "),Cf();}}function Se(r,i){if(r&1&&(za(0,"li",46)(1,"span",47),r_(2),Cf(),za(3,"span",48),r_(4),Cf(),hT(5,Ee,6,0)(6,Pe,2,0,"button",49),Cf()),r&2){let e=i.$implicit,a=NT(6);yb(2),Iv(e.name),yb(2),Iv(e.subtitle),yb(),pT(a.isPendingDelete(e)?5:6);}}function we(r,i){if(r&1&&(za(0,"h3",44),r_(1,"My global auth settings"),Cf(),za(2,"ul",45),yT(3,Se,7,3,"li",46,dT().trackEntry,true),Cf()),r&2){let e=NT(5);yb(3),vT(e.recap().authSettings);}}function ke(r,i){if(r&1&&(hT(0,ve,5,0),hT(1,he,5,0),hT(2,we,5,0)),r&2){let e=NT(4);pT(e.recap().integrations.length>0?0:-1),yb(),pT(e.recap().aiProviders.length>0?1:-1),yb(),pT(e.recap().authSettings.length>0?2:-1);}}function Me(r,i){if(r&1&&hT(0,ue,2,0,"p",43)(1,ke,3,3),r&2){let e=NT(3);pT(e.recap().total===0?0:1);}}function Oe(r,i){if(r&1){let e=bT();za(0,"div",17)(1,"div",5)(2,"h2",6),r_(3,"Identity"),Cf(),za(4,"div",7)(5,"span",8),r_(6,"Email"),Cf(),za(7,"span",36),r_(8),Cf()(),za(9,"div",7)(10,"span",8),r_(11,"External ID"),Cf(),za(12,"span",36),r_(13),Cf()()(),za(14,"div",5)(15,"h2",6),r_(16,"Profile"),Cf(),za(17,"div",7)(18,"span",8),r_(19,"First name"),Cf(),za(20,"span",36),r_(21),Cf()(),za(22,"div",7)(23,"span",8),r_(24,"Last name"),Cf(),za(25,"span",36),r_(26),Cf()(),za(27,"div",37)(28,"span",8),r_(29,"Bio"),Cf(),za(30,"span",36),r_(31),Cf()(),za(32,"div",7)(33,"span",8),r_(34,"Language"),Cf(),za(35,"span",36),r_(36),Cf()()(),za(37,"div",33)(38,"button",38),dc("click",function(){ig(e);let d=NT(2);return sg(d.startEditing())}),r_(39," Edit profile "),Cf()(),za(40,"div",39)(41,"button",40),dc("click",function(){ig(e);let d=NT(2);return sg(d.toggleOverrides())}),za(42,"span",41),r_(43,"\u25B6"),Cf(),r_(44," My global user configurations "),za(45,"span",42),r_(46),Cf()(),hT(47,Me,2,1),Cf()();}if(r&2){let e=NT(),a=NT();yb(8),Iv(e.email),yb(5),Iv(e.externalId),yb(8),Iv(e.firstname||"\u2014"),yb(5),Iv(e.lastname||"\u2014"),yb(5),Iv(e.bio||"\u2014"),yb(5),Iv(e.preferredLanguage||"\u2014"),yb(5),uc("aria-expanded",a.isOverridesExpanded()),yb(),gv("user-profile__overrides-arrow--open",a.isOverridesExpanded()),yb(4),Rf("(",a.recap().total,")"),yb(),pT(a.isOverridesExpanded()?47:-1);}}function Ue(r,i){if(r&1&&(za(0,"div",5)(1,"h2",6),r_(2,"Appearance"),Cf(),za(3,"div",7)(4,"span",8),r_(5,"Skin"),Cf(),za(6,"div",9),yT(7,de,5,5,"button",10,D),Cf()(),za(9,"div",7)(10,"span",8),r_(11,"Mode"),Cf(),za(12,"div",11),yT(13,_e,2,4,"button",12,D),Cf()()(),za(15,"div",5)(16,"h2",6),r_(17,"Composer"),Cf(),za(18,"div",7)(19,"span",8),r_(20,"Enter key"),Cf(),za(21,"div",13)(22,"div",14),yT(23,ce,2,4,"button",12,D),Cf(),za(25,"p",15),r_(26,'In "New line" mode, press Ctrl or Cmd + Enter to send.'),Cf()()()(),hT(27,me,40,5,"form",16)(28,Oe,48,11,"div",17)),r&2){let e=NT();yb(7),vT(e.themeVariantOptions),yb(6),vT(e.themeOptions),yb(10),vT(e.enterKeyOptions),yb(4),pT(e.isEditing()?27:28);}}function Te(r,i){r&1&&(za(0,"p",4),r_(1,"Unable to load profile."),Cf());}var le=class r{userState=p(l);router=p(It);location=p(Pn);destroyRef=p(Me$1);integrationState=p(N);providerState=p(O);authSettingState=p(R);themePort=p(I);preferencesPort=p(f);isEditing=ie(false);isLoading=ie(false);isSaving=ie(false);isOverridesExpanded=ie(false);currentUser=this.userState.currentUser;theme=this.themePort.theme;themeMode=Mi(()=>this.themePort.theme().mode);themeOptions=[{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"system",label:"System"}];themeVariant=Mi(()=>this.themePort.theme().variant);themeVariantOptions=[{value:"industry",label:"Industry",description:"Bleu acier, Barlow"},{value:"terminal",label:"Terminal",description:"Ambre CRT, JetBrains Mono"}];enterKeyBehavior=this.preferencesPort.enterKeyBehavior;enterKeyOptions=[{value:"send",label:"Send"},{value:"newline",label:"New line"}];languageOptions=[{value:"",label:"No preference (English fallback)"},{value:"fr",label:"French"},{value:"de",label:"German"},{value:"es",label:"Spanish"},{value:"pt",label:"Portuguese"},{value:"it",label:"Italian"},{value:"nl",label:"Dutch"},{value:"pl",label:"Polish"},{value:"ja",label:"Japanese"},{value:"zh",label:"Chinese"}];form=new $({firstname:new vt("",{nonNullable:true}),lastname:new vt("",{nonNullable:true}),bio:new vt("",{nonNullable:true}),preferredLanguage:new vt("",{nonNullable:true})});recap=F(Ms([this.integrationState.userGlobal$,this.providerState.userGlobal$,this.authSettingState.userGlobal$]).pipe(j(([i,e,a])=>{let d=i.map(g=>({category:"integration",id:g.id??"",name:g.name,subtitle:g.integrationType})),_=e.map(g=>({category:"aiProvider",id:g.id??"",name:g.name,subtitle:g.apiType})),I=a.map(g=>({category:"authSetting",id:g.id??"",name:g.name,subtitle:g.authType}));return {integrations:d,aiProviders:_,authSettings:I,total:d.length+_.length+I.length}})),{initialValue:{integrations:[],aiProviders:[],authSettings:[],total:0}});ngOnInit(){if(this.currentUser()){this.syncFormFromState();return}this.isLoading.set(true),this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:()=>{this.syncFormFromState(),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}startEditing(){this.syncFormFromState(),this.isEditing.set(true);}cancelEditing(){this.isEditing.set(false);}setTheme(i){this.themePort.setTheme({variant:this.themePort.theme().variant,mode:i});}setThemeVariant(i){this.themePort.setTheme({variant:i,mode:this.themePort.theme().mode});}setEnterKeyBehavior(i){this.preferencesPort.setEnterKeyBehavior(i);}save(){if(this.isSaving())return;this.isSaving.set(true);let i=this.form.controls.preferredLanguage.value.trim();this.userState.updateMe({firstname:this.form.controls.firstname.value.trim()||void 0,lastname:this.form.controls.lastname.value.trim()||void 0,bio:this.form.controls.bio.value.trim()||void 0,preferredLanguage:i||void 0}).pipe(U(this.destroyRef)).subscribe({next:()=>{this.isSaving.set(false),this.isEditing.set(false);},error:()=>this.isSaving.set(false)});}toggleOverrides(){this.isOverridesExpanded.update(i=>!i),this.pendingDeleteKey.set(null);}pendingDeleteKey=ie(null);isPendingDelete(i){return this.pendingDeleteKey()===this.entryKey(i)}armDelete(i){i.id&&this.pendingDeleteKey.set(this.entryKey(i));}cancelDelete(){this.pendingDeleteKey.set(null);}confirmDelete(i){if(!i.id)return;this.pendingDeleteKey.set(null),(i.category==="integration"?this.integrationState.delete(i.id,"userGlobal"):i.category==="authSetting"?this.authSettingState.delete(i.id,"userGlobal"):this.providerState.delete(i.id,"userGlobal")).pipe(U(this.destroyRef)).subscribe({error:a=>{console.error(`[UserProfile] Delete failed for ${i.category}:${i.id}:`,a);}});}entryKey(i){return `${i.category}:${i.id}`}goBack(){window.history.length>1?this.location.back():this.router.navigate(["/agentos"]);}trackEntry(i,e){return this.entryKey(e)}syncFormFromState(){let i=this.currentUser();i&&this.form.setValue({firstname:i.firstname??"",lastname:i.lastname??"",bio:i.bio??"",preferredLanguage:i.preferredLanguage??""});}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=vf({type:r,selectors:[["agentos-user-profile"]],decls:8,vars:1,consts:[[1,"user-profile"],[1,"user-profile__header"],["icon","arrow_back","title","Back",3,"action"],[1,"user-profile__title"],[1,"user-profile__loading"],[1,"user-profile__section"],[1,"user-profile__section-title"],[1,"user-profile__field"],[1,"user-profile__label"],[1,"user-profile__theme-variants"],["type","button",1,"user-profile__theme-variant",3,"user-profile__theme-variant--active"],["role","group","aria-label","Color mode",1,"user-profile__segmented"],["type","button",1,"user-profile__segmented-option",3,"user-profile__segmented-option--active"],[1,"user-profile__field-control"],["role","group","aria-label","Enter key behavior",1,"user-profile__segmented"],[1,"user-profile__hint"],[1,"user-profile__form",3,"formGroup"],[1,"user-profile__view"],["type","button",1,"user-profile__theme-variant",3,"click"],[1,"user-profile__theme-variant-name"],[1,"user-profile__theme-variant-desc"],["type","button",1,"user-profile__segmented-option",3,"click"],[1,"user-profile__form",3,"ngSubmit","formGroup"],[1,"user-profile__value","user-profile__value--readonly"],["for","up-firstname",1,"user-profile__label"],["id","up-firstname","type","text","placeholder","Your first name","formControlName","firstname","autocomplete","given-name",1,"user-profile__input"],["for","up-lastname",1,"user-profile__label"],["id","up-lastname","type","text","placeholder","Your last name","formControlName","lastname","autocomplete","family-name",1,"user-profile__input"],["for","up-bio",1,"user-profile__label"],["id","up-bio","placeholder","A short description about yourself","formControlName","bio","rows","4",1,"user-profile__input","user-profile__input--textarea"],["for","up-preferredLanguage",1,"user-profile__label"],["id","up-preferredLanguage","formControlName","preferredLanguage",1,"user-profile__input","user-profile__select"],[3,"value"],[1,"user-profile__actions"],["type","submit",1,"user-profile__btn","user-profile__btn--primary",3,"disabled"],["type","button",1,"user-profile__btn",3,"click"],[1,"user-profile__value"],[1,"user-profile__field","user-profile__field--bio"],["type","button",1,"user-profile__btn","user-profile__btn--primary",3,"click"],[1,"user-profile__overrides"],["type","button",1,"user-profile__overrides-toggle",3,"click"],[1,"user-profile__overrides-arrow"],[1,"user-profile__overrides-count"],[1,"user-profile__overrides-empty"],[1,"user-profile__overrides-subtitle"],[1,"user-profile__overrides-list"],[1,"user-profile__overrides-row"],[1,"user-profile__overrides-name"],[1,"user-profile__overrides-subtitle-text"],["type","button",1,"user-profile__overrides-delete"],[1,"user-profile__overrides-confirm-label"],["type","button",1,"user-profile__overrides-delete","user-profile__overrides-delete--confirm",3,"click"],["type","button",1,"user-profile__overrides-delete",3,"click"]],template:function(e,a){if(e&1&&(za(0,"div",0)(1,"header",1)(2,"ds-icon-button",2),dc("action",function(){return a.goBack()}),Cf(),za(3,"h1",3),r_(4,"My profile"),Cf()(),hT(5,se,2,0,"p",4)(6,Ue,29,1)(7,Te,2,0,"p",4),Cf()),e&2){let d;yb(5),pT(a.isLoading()?5:(d=a.currentUser())?6:7,d);}},dependencies:[Kn,zn,Zn,Xn,Ye,bt,Ln,Wn,Vn,yn,qe],styles:[`.user-profile[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.user-profile__header[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;gap:.5rem}.user-profile__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.user-profile__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.user-profile__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.user-profile__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.user-profile__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.user-profile__view[_ngcontent-%COMP%], .user-profile__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem}.user-profile__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem}.user-profile__section-title[_ngcontent-%COMP%]{margin:0;font-family:var(--font-heading);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);border-bottom:1px solid var(--color-divider);padding-bottom:.5rem}.user-profile__field[_ngcontent-%COMP%]{display:grid;grid-template-columns:140px 1fr;align-items:baseline;gap:.75rem}.user-profile__field--bio[_ngcontent-%COMP%]{align-items:start}.user-profile__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text-secondary);white-space:nowrap}.user-profile__value[_ngcontent-%COMP%]{font-size:.9375rem;color:var(--color-text);word-break:break-word;white-space:pre-wrap}.user-profile__value--readonly[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.875rem}.user-profile__segmented[_ngcontent-%COMP%]{display:inline-flex;justify-self:start;border:1px solid var(--color-divider);overflow:hidden}.user-profile__segmented-option[_ngcontent-%COMP%]{padding:.4rem .85rem;background:transparent;border:none;border-right:1px solid var(--color-divider);color:var(--color-text-secondary);font-size:.875rem;cursor:pointer;transition:background .15s ease,color .15s ease}.user-profile__segmented-option[_ngcontent-%COMP%]:last-child{border-right:none}.user-profile__segmented-option[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.user-profile__segmented-option--active[_ngcontent-%COMP%]{background:var(--color-accent);color:#fff}.user-profile__segmented-option--active[_ngcontent-%COMP%]:hover{background:var(--color-accent-700)}.user-profile__field-control[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-start;gap:.4rem}.user-profile__hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary)}.user-profile__select[_ngcontent-%COMP%]{appearance:none;cursor:pointer;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right .75rem center;padding-right:2.25rem}.user-profile__input[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;border-radius:0;transition:border-color .15s ease;resize:none}.user-profile__input[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.user-profile__input[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.user-profile__input--textarea[_ngcontent-%COMP%]{line-height:1.5;resize:vertical}.user-profile__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.user-profile__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;border-radius:0;transition:background .15s ease,border-color .15s ease}.user-profile__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.user-profile__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.user-profile__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.user-profile__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}.user-profile__theme-variants[_ngcontent-%COMP%]{display:flex;gap:8px;justify-self:start}.user-profile__theme-variant[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-start;gap:3px;padding:10px 16px;border:1px solid var(--color-divider);background:transparent;cursor:pointer;min-width:120px;transition:background .12s,border-color .12s}.user-profile__theme-variant[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.user-profile__theme-variant--active[_ngcontent-%COMP%]{border-color:var(--color-accent);background:color-mix(in srgb,var(--color-accent) 8%,transparent)}.user-profile__theme-variant-name[_ngcontent-%COMP%]{font-family:var(--font-heading);font-size:13px;font-weight:600;color:var(--color-text)}.user-profile__theme-variant-desc[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-secondary);font-family:var(--font-body)}.user-profile__overrides[_ngcontent-%COMP%]{margin-top:1rem;padding-top:1rem;border-top:1px solid var(--color-divider)}.user-profile__overrides-toggle[_ngcontent-%COMP%]{background:transparent;border:none;padding:.25rem 0;font-size:.85rem;color:var(--color-text-secondary);cursor:pointer;display:flex;align-items:center;gap:.4rem}.user-profile__overrides-toggle[_ngcontent-%COMP%]:hover{color:var(--color-text)}.user-profile__overrides-arrow[_ngcontent-%COMP%]{display:inline-block;font-size:.65rem;transition:transform .15s ease}.user-profile__overrides-arrow--open[_ngcontent-%COMP%]{transform:rotate(90deg)}.user-profile__overrides-count[_ngcontent-%COMP%]{color:var(--color-text-tertiary)}.user-profile__overrides-empty[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary);font-style:italic;padding:.5rem 0 0;margin:0}.user-profile__overrides-subtitle[_ngcontent-%COMP%]{font-family:var(--font-heading);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);margin:.75rem 0 .25rem}.user-profile__overrides-list[_ngcontent-%COMP%]{list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:.25rem}.user-profile__overrides-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.4rem .5rem;font-size:.85rem;border-radius:0}.user-profile__overrides-row[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.user-profile__overrides-name[_ngcontent-%COMP%]{flex:1;color:var(--color-text);font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.user-profile__overrides-subtitle-text[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);font-family:var(--font-heading)}.user-profile__overrides-confirm-label[_ngcontent-%COMP%]{font-size:11px;font-family:var(--font-heading);font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--red-deep);white-space:nowrap}.user-profile__overrides-delete[_ngcontent-%COMP%]{background:transparent;border:1px solid transparent;font-size:11px;font-family:var(--font-heading);font-weight:600;color:var(--color-neutral-500);cursor:pointer;padding:3px 8px;border-radius:0;transition:color .12s,background .12s,border-color .12s}.user-profile__overrides-delete[_ngcontent-%COMP%]:hover{color:var(--red);background:color-mix(in srgb,var(--red) 10%,transparent);border-color:var(--red)}.user-profile__overrides-delete--confirm[_ngcontent-%COMP%]{border-color:var(--red);background:var(--red);color:#fff}.user-profile__overrides-delete--confirm[_ngcontent-%COMP%]:hover{background:var(--red-deep);border-color:var(--red-deep)}`]})};
1
+ import {O}from'./chunk-BBrd_rzb.js';import {R}from'./chunk-Dzos_5V1.js';import {N}from'./chunk-BynzLX1z.js';import {p,c as It,ar as Pn,M as Me$1,i as ie,E as Mi,ak as Ms,Q as j,v as vf,z as za,f as dc,C as Cf,r as r_,h as hT,a as yb,d as pT,n as yT,N as NT,o as vT,e as bT,D as gv,V as uc,I as Iv,R as Rf,l as lc,s as sS,t as tv,g as cS,k as ig,m as sg,H as dT}from'./main-5NWD4SCX.js';import {l,I,r as f,$,v as vt,F,U,K as Kn,z as zn,Z as Zn,X as Xn,Y as Ye,e as bt,L as Ln,W as Wn,V as Vn,y as yn,h as qe}from'./chunk-C881tCOG.js';import'./chunk-B2R438Y9.js';var D=(r,i)=>i.value;function se(r,i){r&1&&(za(0,"p",4),r_(1,"Loading\u2026"),Cf());}function de(r,i){if(r&1){let e=bT();za(0,"button",18),dc("click",function(){let d=ig(e).$implicit,_=NT(2);return sg(_.setThemeVariant(d.value))}),za(1,"span",19),r_(2),Cf(),za(3,"span",20),r_(4),Cf()();}if(r&2){let e=i.$implicit,a=NT(2);gv("user-profile__theme-variant--active",a.themeVariant()===e.value),uc("aria-pressed",a.themeVariant()===e.value),yb(2),Iv(e.label),yb(2),Iv(e.description);}}function _e(r,i){if(r&1){let e=bT();za(0,"button",21),dc("click",function(){let d=ig(e).$implicit,_=NT(2);return sg(_.setTheme(d.value))}),r_(1),Cf();}if(r&2){let e=i.$implicit,a=NT(2);gv("user-profile__segmented-option--active",a.themeMode()===e.value),uc("aria-pressed",a.themeMode()===e.value),yb(),Rf(" ",e.label," ");}}function ce(r,i){if(r&1){let e=bT();za(0,"button",21),dc("click",function(){let d=ig(e).$implicit,_=NT(2);return sg(_.setEnterKeyBehavior(d.value))}),r_(1),Cf();}if(r&2){let e=i.$implicit,a=NT(2);gv("user-profile__segmented-option--active",a.enterKeyBehavior()===e.value),uc("aria-pressed",a.enterKeyBehavior()===e.value),yb(),Rf(" ",e.label," ");}}function pe(r,i){if(r&1&&(za(0,"option",32),r_(1),Cf()),r&2){let e=i.$implicit;tv("value",e.value),yb(),Iv(e.label);}}function me(r,i){if(r&1){let e=bT();za(0,"form",22),dc("ngSubmit",function(){ig(e);let d=NT(2);return sg(d.save())}),za(1,"div",5)(2,"h2",6),r_(3,"Identity"),Cf(),za(4,"div",7)(5,"span",8),r_(6,"Email"),Cf(),za(7,"span",23),r_(8),Cf()(),za(9,"div",7)(10,"span",8),r_(11,"External ID"),Cf(),za(12,"span",23),r_(13),Cf()()(),za(14,"div",5)(15,"h2",6),r_(16,"Profile"),Cf(),za(17,"div",7)(18,"label",24),r_(19,"First name"),Cf(),lc(20,"input",25),sS(),Cf(),za(21,"div",7)(22,"label",26),r_(23,"Last name"),Cf(),lc(24,"input",27),sS(),Cf(),za(25,"div",7)(26,"label",28),r_(27,"Bio"),Cf(),lc(28,"textarea",29),sS(),Cf(),za(29,"div",7)(30,"label",30),r_(31,"Language"),Cf(),za(32,"select",31),yT(33,pe,2,2,"option",32,D),Cf(),sS(),Cf()(),za(35,"div",33)(36,"button",34),r_(37),Cf(),za(38,"button",35),dc("click",function(){ig(e);let d=NT(2);return sg(d.cancelEditing())}),r_(39,"Cancel"),Cf()()();}if(r&2){let e=NT(),a=NT();tv("formGroup",a.form),yb(8),Iv(e.email),yb(5),Iv(e.externalId),yb(7),cS(),yb(4),cS(),yb(4),cS(),yb(4),cS(),yb(),vT(a.languageOptions),yb(3),tv("disabled",a.isSaving()),yb(),Rf(" ",a.isSaving()?"Saving\u2026":"Save changes"," ");}}function ue(r,i){r&1&&(za(0,"p",43),r_(1," No global configuration yet. Create one from the Integrations / AI Providers / Auth Settings pages of your namespaces. "),Cf());}function fe(r,i){if(r&1){let e=bT();za(0,"span",50),r_(1,"Delete?"),Cf(),za(2,"button",51),dc("click",function(){ig(e);let d=NT().$implicit,_=NT(6);return sg(_.confirmDelete(d))}),r_(3," Confirm "),Cf(),za(4,"button",52),dc("click",function(){ig(e);let d=NT(7);return sg(d.cancelDelete())}),r_(5," Cancel "),Cf();}}function ge(r,i){if(r&1){let e=bT();za(0,"button",52),dc("click",function(){ig(e);let d=NT().$implicit,_=NT(6);return sg(_.armDelete(d))}),r_(1," Delete "),Cf();}}function Ce(r,i){if(r&1&&(za(0,"li",46)(1,"span",47),r_(2),Cf(),za(3,"span",48),r_(4),Cf(),hT(5,fe,6,0)(6,ge,2,0,"button",49),Cf()),r&2){let e=i.$implicit,a=NT(6);yb(2),Iv(e.name),yb(2),Iv(e.subtitle),yb(),pT(a.isPendingDelete(e)?5:6);}}function ve(r,i){if(r&1&&(za(0,"h3",44),r_(1,"Integrations"),Cf(),za(2,"ul",45),yT(3,Ce,7,3,"li",46,dT().trackEntry,true),Cf()),r&2){let e=NT(5);yb(3),vT(e.recap().integrations);}}function xe(r,i){if(r&1){let e=bT();za(0,"span",50),r_(1,"Delete?"),Cf(),za(2,"button",51),dc("click",function(){ig(e);let d=NT().$implicit,_=NT(6);return sg(_.confirmDelete(d))}),r_(3," Confirm "),Cf(),za(4,"button",52),dc("click",function(){ig(e);let d=NT(7);return sg(d.cancelDelete())}),r_(5," Cancel "),Cf();}}function be(r,i){if(r&1){let e=bT();za(0,"button",52),dc("click",function(){ig(e);let d=NT().$implicit,_=NT(6);return sg(_.armDelete(d))}),r_(1," Delete "),Cf();}}function ye(r,i){if(r&1&&(za(0,"li",46)(1,"span",47),r_(2),Cf(),za(3,"span",48),r_(4),Cf(),hT(5,xe,6,0)(6,be,2,0,"button",49),Cf()),r&2){let e=i.$implicit,a=NT(6);yb(2),Iv(e.name),yb(2),Iv(e.subtitle),yb(),pT(a.isPendingDelete(e)?5:6);}}function he(r,i){if(r&1&&(za(0,"h3",44),r_(1,"AI Providers"),Cf(),za(2,"ul",45),yT(3,ye,7,3,"li",46,dT().trackEntry,true),Cf()),r&2){let e=NT(5);yb(3),vT(e.recap().aiProviders);}}function Ee(r,i){if(r&1){let e=bT();za(0,"span",50),r_(1,"Delete?"),Cf(),za(2,"button",51),dc("click",function(){ig(e);let d=NT().$implicit,_=NT(6);return sg(_.confirmDelete(d))}),r_(3," Confirm "),Cf(),za(4,"button",52),dc("click",function(){ig(e);let d=NT(7);return sg(d.cancelDelete())}),r_(5," Cancel "),Cf();}}function Pe(r,i){if(r&1){let e=bT();za(0,"button",52),dc("click",function(){ig(e);let d=NT().$implicit,_=NT(6);return sg(_.armDelete(d))}),r_(1," Delete "),Cf();}}function Se(r,i){if(r&1&&(za(0,"li",46)(1,"span",47),r_(2),Cf(),za(3,"span",48),r_(4),Cf(),hT(5,Ee,6,0)(6,Pe,2,0,"button",49),Cf()),r&2){let e=i.$implicit,a=NT(6);yb(2),Iv(e.name),yb(2),Iv(e.subtitle),yb(),pT(a.isPendingDelete(e)?5:6);}}function we(r,i){if(r&1&&(za(0,"h3",44),r_(1,"My global auth settings"),Cf(),za(2,"ul",45),yT(3,Se,7,3,"li",46,dT().trackEntry,true),Cf()),r&2){let e=NT(5);yb(3),vT(e.recap().authSettings);}}function ke(r,i){if(r&1&&(hT(0,ve,5,0),hT(1,he,5,0),hT(2,we,5,0)),r&2){let e=NT(4);pT(e.recap().integrations.length>0?0:-1),yb(),pT(e.recap().aiProviders.length>0?1:-1),yb(),pT(e.recap().authSettings.length>0?2:-1);}}function Me(r,i){if(r&1&&hT(0,ue,2,0,"p",43)(1,ke,3,3),r&2){let e=NT(3);pT(e.recap().total===0?0:1);}}function Oe(r,i){if(r&1){let e=bT();za(0,"div",17)(1,"div",5)(2,"h2",6),r_(3,"Identity"),Cf(),za(4,"div",7)(5,"span",8),r_(6,"Email"),Cf(),za(7,"span",36),r_(8),Cf()(),za(9,"div",7)(10,"span",8),r_(11,"External ID"),Cf(),za(12,"span",36),r_(13),Cf()()(),za(14,"div",5)(15,"h2",6),r_(16,"Profile"),Cf(),za(17,"div",7)(18,"span",8),r_(19,"First name"),Cf(),za(20,"span",36),r_(21),Cf()(),za(22,"div",7)(23,"span",8),r_(24,"Last name"),Cf(),za(25,"span",36),r_(26),Cf()(),za(27,"div",37)(28,"span",8),r_(29,"Bio"),Cf(),za(30,"span",36),r_(31),Cf()(),za(32,"div",7)(33,"span",8),r_(34,"Language"),Cf(),za(35,"span",36),r_(36),Cf()()(),za(37,"div",33)(38,"button",38),dc("click",function(){ig(e);let d=NT(2);return sg(d.startEditing())}),r_(39," Edit profile "),Cf()(),za(40,"div",39)(41,"button",40),dc("click",function(){ig(e);let d=NT(2);return sg(d.toggleOverrides())}),za(42,"span",41),r_(43,"\u25B6"),Cf(),r_(44," My global user configurations "),za(45,"span",42),r_(46),Cf()(),hT(47,Me,2,1),Cf()();}if(r&2){let e=NT(),a=NT();yb(8),Iv(e.email),yb(5),Iv(e.externalId),yb(8),Iv(e.firstname||"\u2014"),yb(5),Iv(e.lastname||"\u2014"),yb(5),Iv(e.bio||"\u2014"),yb(5),Iv(e.preferredLanguage||"\u2014"),yb(5),uc("aria-expanded",a.isOverridesExpanded()),yb(),gv("user-profile__overrides-arrow--open",a.isOverridesExpanded()),yb(4),Rf("(",a.recap().total,")"),yb(),pT(a.isOverridesExpanded()?47:-1);}}function Ue(r,i){if(r&1&&(za(0,"div",5)(1,"h2",6),r_(2,"Appearance"),Cf(),za(3,"div",7)(4,"span",8),r_(5,"Skin"),Cf(),za(6,"div",9),yT(7,de,5,5,"button",10,D),Cf()(),za(9,"div",7)(10,"span",8),r_(11,"Mode"),Cf(),za(12,"div",11),yT(13,_e,2,4,"button",12,D),Cf()()(),za(15,"div",5)(16,"h2",6),r_(17,"Composer"),Cf(),za(18,"div",7)(19,"span",8),r_(20,"Enter key"),Cf(),za(21,"div",13)(22,"div",14),yT(23,ce,2,4,"button",12,D),Cf(),za(25,"p",15),r_(26,'In "New line" mode, press Ctrl or Cmd + Enter to send.'),Cf()()()(),hT(27,me,40,5,"form",16)(28,Oe,48,11,"div",17)),r&2){let e=NT();yb(7),vT(e.themeVariantOptions),yb(6),vT(e.themeOptions),yb(10),vT(e.enterKeyOptions),yb(4),pT(e.isEditing()?27:28);}}function Te(r,i){r&1&&(za(0,"p",4),r_(1,"Unable to load profile."),Cf());}var le=class r{userState=p(l);router=p(It);location=p(Pn);destroyRef=p(Me$1);integrationState=p(N);providerState=p(O);authSettingState=p(R);themePort=p(I);preferencesPort=p(f);isEditing=ie(false);isLoading=ie(false);isSaving=ie(false);isOverridesExpanded=ie(false);currentUser=this.userState.currentUser;theme=this.themePort.theme;themeMode=Mi(()=>this.themePort.theme().mode);themeOptions=[{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"system",label:"System"}];themeVariant=Mi(()=>this.themePort.theme().variant);themeVariantOptions=[{value:"industry",label:"Industry",description:"Bleu acier, Barlow"},{value:"terminal",label:"Terminal",description:"Ambre CRT, JetBrains Mono"}];enterKeyBehavior=this.preferencesPort.enterKeyBehavior;enterKeyOptions=[{value:"send",label:"Send"},{value:"newline",label:"New line"}];languageOptions=[{value:"",label:"No preference (English fallback)"},{value:"fr",label:"French"},{value:"de",label:"German"},{value:"es",label:"Spanish"},{value:"pt",label:"Portuguese"},{value:"it",label:"Italian"},{value:"nl",label:"Dutch"},{value:"pl",label:"Polish"},{value:"ja",label:"Japanese"},{value:"zh",label:"Chinese"}];form=new $({firstname:new vt("",{nonNullable:true}),lastname:new vt("",{nonNullable:true}),bio:new vt("",{nonNullable:true}),preferredLanguage:new vt("",{nonNullable:true})});recap=F(Ms([this.integrationState.userGlobal$,this.providerState.userGlobal$,this.authSettingState.userGlobal$]).pipe(j(([i,e,a])=>{let d=i.map(g=>({category:"integration",id:g.id??"",name:g.name,subtitle:g.integrationType})),_=e.map(g=>({category:"aiProvider",id:g.id??"",name:g.name,subtitle:g.apiType})),I=a.map(g=>({category:"authSetting",id:g.id??"",name:g.name,subtitle:g.authType}));return {integrations:d,aiProviders:_,authSettings:I,total:d.length+_.length+I.length}})),{initialValue:{integrations:[],aiProviders:[],authSettings:[],total:0}});ngOnInit(){if(this.currentUser()){this.syncFormFromState();return}this.isLoading.set(true),this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:()=>{this.syncFormFromState(),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}startEditing(){this.syncFormFromState(),this.isEditing.set(true);}cancelEditing(){this.isEditing.set(false);}setTheme(i){this.themePort.setTheme({variant:this.themePort.theme().variant,mode:i});}setThemeVariant(i){this.themePort.setTheme({variant:i,mode:this.themePort.theme().mode});}setEnterKeyBehavior(i){this.preferencesPort.setEnterKeyBehavior(i);}save(){if(this.isSaving())return;this.isSaving.set(true);let i=this.form.controls.preferredLanguage.value.trim();this.userState.updateMe({firstname:this.form.controls.firstname.value.trim()||void 0,lastname:this.form.controls.lastname.value.trim()||void 0,bio:this.form.controls.bio.value.trim()||void 0,preferredLanguage:i||void 0}).pipe(U(this.destroyRef)).subscribe({next:()=>{this.isSaving.set(false),this.isEditing.set(false);},error:()=>this.isSaving.set(false)});}toggleOverrides(){this.isOverridesExpanded.update(i=>!i),this.pendingDeleteKey.set(null);}pendingDeleteKey=ie(null);isPendingDelete(i){return this.pendingDeleteKey()===this.entryKey(i)}armDelete(i){i.id&&this.pendingDeleteKey.set(this.entryKey(i));}cancelDelete(){this.pendingDeleteKey.set(null);}confirmDelete(i){if(!i.id)return;this.pendingDeleteKey.set(null),(i.category==="integration"?this.integrationState.delete(i.id,"userGlobal"):i.category==="authSetting"?this.authSettingState.delete(i.id,"userGlobal"):this.providerState.delete(i.id,"userGlobal")).pipe(U(this.destroyRef)).subscribe({error:a=>{console.error(`[UserProfile] Delete failed for ${i.category}:${i.id}:`,a);}});}entryKey(i){return `${i.category}:${i.id}`}goBack(){window.history.length>1?this.location.back():this.router.navigate(["/agentos"]);}trackEntry(i,e){return this.entryKey(e)}syncFormFromState(){let i=this.currentUser();i&&this.form.setValue({firstname:i.firstname??"",lastname:i.lastname??"",bio:i.bio??"",preferredLanguage:i.preferredLanguage??""});}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=vf({type:r,selectors:[["agentos-user-profile"]],decls:8,vars:1,consts:[[1,"user-profile"],[1,"user-profile__header"],["icon","arrow_back","title","Back",3,"action"],[1,"user-profile__title"],[1,"user-profile__loading"],[1,"user-profile__section"],[1,"user-profile__section-title"],[1,"user-profile__field"],[1,"user-profile__label"],[1,"user-profile__theme-variants"],["type","button",1,"user-profile__theme-variant",3,"user-profile__theme-variant--active"],["role","group","aria-label","Color mode",1,"user-profile__segmented"],["type","button",1,"user-profile__segmented-option",3,"user-profile__segmented-option--active"],[1,"user-profile__field-control"],["role","group","aria-label","Enter key behavior",1,"user-profile__segmented"],[1,"user-profile__hint"],[1,"user-profile__form",3,"formGroup"],[1,"user-profile__view"],["type","button",1,"user-profile__theme-variant",3,"click"],[1,"user-profile__theme-variant-name"],[1,"user-profile__theme-variant-desc"],["type","button",1,"user-profile__segmented-option",3,"click"],[1,"user-profile__form",3,"ngSubmit","formGroup"],[1,"user-profile__value","user-profile__value--readonly"],["for","up-firstname",1,"user-profile__label"],["id","up-firstname","type","text","placeholder","Your first name","formControlName","firstname","autocomplete","given-name",1,"user-profile__input"],["for","up-lastname",1,"user-profile__label"],["id","up-lastname","type","text","placeholder","Your last name","formControlName","lastname","autocomplete","family-name",1,"user-profile__input"],["for","up-bio",1,"user-profile__label"],["id","up-bio","placeholder","A short description about yourself","formControlName","bio","rows","4",1,"user-profile__input","user-profile__input--textarea"],["for","up-preferredLanguage",1,"user-profile__label"],["id","up-preferredLanguage","formControlName","preferredLanguage",1,"user-profile__input","user-profile__select"],[3,"value"],[1,"user-profile__actions"],["type","submit",1,"user-profile__btn","user-profile__btn--primary",3,"disabled"],["type","button",1,"user-profile__btn",3,"click"],[1,"user-profile__value"],[1,"user-profile__field","user-profile__field--bio"],["type","button",1,"user-profile__btn","user-profile__btn--primary",3,"click"],[1,"user-profile__overrides"],["type","button",1,"user-profile__overrides-toggle",3,"click"],[1,"user-profile__overrides-arrow"],[1,"user-profile__overrides-count"],[1,"user-profile__overrides-empty"],[1,"user-profile__overrides-subtitle"],[1,"user-profile__overrides-list"],[1,"user-profile__overrides-row"],[1,"user-profile__overrides-name"],[1,"user-profile__overrides-subtitle-text"],["type","button",1,"user-profile__overrides-delete"],[1,"user-profile__overrides-confirm-label"],["type","button",1,"user-profile__overrides-delete","user-profile__overrides-delete--confirm",3,"click"],["type","button",1,"user-profile__overrides-delete",3,"click"]],template:function(e,a){if(e&1&&(za(0,"div",0)(1,"header",1)(2,"ds-icon-button",2),dc("action",function(){return a.goBack()}),Cf(),za(3,"h1",3),r_(4,"My profile"),Cf()(),hT(5,se,2,0,"p",4)(6,Ue,29,1)(7,Te,2,0,"p",4),Cf()),e&2){let d;yb(5),pT(a.isLoading()?5:(d=a.currentUser())?6:7,d);}},dependencies:[Kn,zn,Zn,Xn,Ye,bt,Ln,Wn,Vn,yn,qe],styles:[`.user-profile[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.user-profile__header[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;gap:.5rem}.user-profile__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.user-profile__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.user-profile__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.user-profile__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.user-profile__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.user-profile__view[_ngcontent-%COMP%], .user-profile__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem}.user-profile__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem}.user-profile__section-title[_ngcontent-%COMP%]{margin:0;font-family:var(--font-heading);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);border-bottom:1px solid var(--color-divider);padding-bottom:.5rem}.user-profile__field[_ngcontent-%COMP%]{display:grid;grid-template-columns:140px 1fr;align-items:baseline;gap:.75rem}.user-profile__field--bio[_ngcontent-%COMP%]{align-items:start}.user-profile__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text-secondary);white-space:nowrap}.user-profile__value[_ngcontent-%COMP%]{font-size:.9375rem;color:var(--color-text);word-break:break-word;white-space:pre-wrap}.user-profile__value--readonly[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.875rem}.user-profile__segmented[_ngcontent-%COMP%]{display:inline-flex;justify-self:start;border:1px solid var(--color-divider);overflow:hidden}.user-profile__segmented-option[_ngcontent-%COMP%]{padding:.4rem .85rem;background:transparent;border:none;border-right:1px solid var(--color-divider);color:var(--color-text-secondary);font-size:.875rem;cursor:pointer;transition:background .15s ease,color .15s ease}.user-profile__segmented-option[_ngcontent-%COMP%]:last-child{border-right:none}.user-profile__segmented-option[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.user-profile__segmented-option--active[_ngcontent-%COMP%]{background:var(--color-accent);color:#fff}.user-profile__segmented-option--active[_ngcontent-%COMP%]:hover{background:var(--color-accent-700)}.user-profile__field-control[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-start;gap:.4rem}.user-profile__hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary)}.user-profile__select[_ngcontent-%COMP%]{appearance:none;cursor:pointer;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right .75rem center;padding-right:2.25rem}.user-profile__input[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;border-radius:0;transition:border-color .15s ease;resize:none}.user-profile__input[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.user-profile__input[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.user-profile__input--textarea[_ngcontent-%COMP%]{line-height:1.5;resize:vertical}.user-profile__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.user-profile__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;border-radius:0;transition:background .15s ease,border-color .15s ease}.user-profile__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.user-profile__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.user-profile__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.user-profile__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}.user-profile__theme-variants[_ngcontent-%COMP%]{display:flex;gap:8px;justify-self:start}.user-profile__theme-variant[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-start;gap:3px;padding:10px 16px;border:1px solid var(--color-divider);background:transparent;cursor:pointer;min-width:120px;transition:background .12s,border-color .12s}.user-profile__theme-variant[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.user-profile__theme-variant--active[_ngcontent-%COMP%]{border-color:var(--color-accent);background:color-mix(in srgb,var(--color-accent) 8%,transparent)}.user-profile__theme-variant-name[_ngcontent-%COMP%]{font-family:var(--font-heading);font-size:13px;font-weight:600;color:var(--color-text)}.user-profile__theme-variant-desc[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-secondary);font-family:var(--font-body)}.user-profile__overrides[_ngcontent-%COMP%]{margin-top:1rem;padding-top:1rem;border-top:1px solid var(--color-divider)}.user-profile__overrides-toggle[_ngcontent-%COMP%]{background:transparent;border:none;padding:.25rem 0;font-size:.85rem;color:var(--color-text-secondary);cursor:pointer;display:flex;align-items:center;gap:.4rem}.user-profile__overrides-toggle[_ngcontent-%COMP%]:hover{color:var(--color-text)}.user-profile__overrides-arrow[_ngcontent-%COMP%]{display:inline-block;font-size:.65rem;transition:transform .15s ease}.user-profile__overrides-arrow--open[_ngcontent-%COMP%]{transform:rotate(90deg)}.user-profile__overrides-count[_ngcontent-%COMP%]{color:var(--color-text-tertiary)}.user-profile__overrides-empty[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary);font-style:italic;padding:.5rem 0 0;margin:0}.user-profile__overrides-subtitle[_ngcontent-%COMP%]{font-family:var(--font-heading);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);margin:.75rem 0 .25rem}.user-profile__overrides-list[_ngcontent-%COMP%]{list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:.25rem}.user-profile__overrides-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.4rem .5rem;font-size:.85rem;border-radius:0}.user-profile__overrides-row[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.user-profile__overrides-name[_ngcontent-%COMP%]{flex:1;color:var(--color-text);font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.user-profile__overrides-subtitle-text[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);font-family:var(--font-heading)}.user-profile__overrides-confirm-label[_ngcontent-%COMP%]{font-size:11px;font-family:var(--font-heading);font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--red-deep);white-space:nowrap}.user-profile__overrides-delete[_ngcontent-%COMP%]{background:transparent;border:1px solid transparent;font-size:11px;font-family:var(--font-heading);font-weight:600;color:var(--color-neutral-500);cursor:pointer;padding:3px 8px;border-radius:0;transition:color .12s,background .12s,border-color .12s}.user-profile__overrides-delete[_ngcontent-%COMP%]:hover{color:var(--red);background:color-mix(in srgb,var(--red) 10%,transparent);border-color:var(--red)}.user-profile__overrides-delete--confirm[_ngcontent-%COMP%]{border-color:var(--red);background:var(--red);color:#fff}.user-profile__overrides-delete--confirm[_ngcontent-%COMP%]:hover{background:var(--red-deep);border-color:var(--red-deep)}`]})};
2
2
  export{le as UserProfileComponent};
@@ -1 +1 @@
1
- import {O}from'./chunk-BC30_IWf.js';import {v}from'./chunk-B94rMV4D.js';import {p,$ as $t,c as It,M as Me,i as ie,ae as Te,F as Sg,v as vf,z as za,f as dc,r as r_,C as Cf,h as hT,a as yb,I as Iv,d as pT,e as bT,n as yT,J as mT,s as sS,l as lc,ad as gT,N as NT,t as tv,g as cS,o as vT,R as Rf,H as dT,k as ig,m as sg}from'./main-OIPNBOIH.js';import {F as F$1,$,k as ze,v as vt,a as ve$1,U,K as Kn,z as zn,Z as Zn,X as Xn,Y as Ye,e as bt,g as fn,L as Ln,W as Wn,b as pn,V as Vn,y as yn,n as yt,C as Ct}from'./chunk-DdISK7Z0.js';import'./chunk-2uSZyBhs.js';function ce(a,r){a&1&&(za(0,"p",5),r_(1,"Loading\u2026"),Cf());}function me(a,r){if(a&1&&(za(0,"label",30),lc(1,"input",31),sS(),za(2,"span"),r_(3),Cf()()),a&2){let e=r.$implicit,l=NT(3);yb(),tv("formControl",l.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!l.isAdmin()),cS(),yb(2),Iv(e.label);}}function ue(a,r){if(a&1&&(za(0,"fieldset",8)(1,"legend",24),r_(2,"Port\xE9e de la configuration"),Cf(),yT(3,me,4,4,"label",30,dT().trackByScope,true),Cf()),a&2){let e=NT(2);tv("disabled",e.isEditMode()),yb(3),vT(e.scopeOptions);}}function ve(a,r){if(a&1&&(za(0,"option",13),r_(1),Cf()),a&2){let e=r.$implicit;tv("value",e),yb(),Iv(e);}}function fe(a,r){if(a&1){let e=bT();za(0,"div",26),lc(1,"input",32),sS(),lc(2,"input",33),sS(),za(3,"button",34),dc("click",function(){let s=ig(e).$index,f=NT(2);return sg(f.removeHeader(s))}),r_(4," \xD7 "),Cf()();}if(a&2){let e=r.$index;tv("formGroupName",e),yb(),cS(),yb(),cS();}}function _e(a,r){if(a&1){let e=bT();za(0,"form",7),dc("ngSubmit",function(){ig(e);let s=NT();return sg(s.submit())}),hT(1,ue,5,1,"fieldset",8),za(2,"div",9)(3,"label",10),r_(4,"API type "),za(5,"span",11),r_(6,"*"),Cf()(),za(7,"select",12),yT(8,ve,2,2,"option",13,mT),Cf(),sS(),Cf(),za(10,"div",9)(11,"label",14),r_(12,"Name "),za(13,"span",11),r_(14,"*"),Cf()(),lc(15,"input",15),sS(),Cf(),za(16,"div",9)(17,"label",16),r_(18,"Description"),Cf(),lc(19,"input",17),sS(),Cf(),za(20,"div",9)(21,"label",18),r_(22,"Base URL"),Cf(),lc(23,"input",19),sS(),Cf(),za(24,"div",9)(25,"label",20),r_(26,"API key"),Cf(),lc(27,"input",21),sS(),Cf(),za(28,"div",22)(29,"div",23)(30,"span",24),r_(31,"Custom headers"),Cf(),za(32,"button",25),dc("click",function(){ig(e);let s=NT();return sg(s.addHeader())}),r_(33,"+ Add header"),Cf()(),yT(34,fe,5,1,"div",26,gT),Cf(),za(36,"div",27)(37,"button",28),r_(38),Cf(),za(39,"button",29),dc("click",function(){ig(e);let s=NT();return sg(s.cancel())}),r_(40,"Cancel"),Cf()()();}if(a&2){let e=NT();tv("formGroup",e.form),yb(),pT(e.isPlatformMode?-1:1),yb(6),tv("formControl",e.apiTypeControl),cS(),yb(),vT(e.apiTypeOptions),yb(7),tv("formControl",e.nameControl),cS(),yb(4),tv("formControl",e.descriptionControl),cS(),yb(4),tv("formControl",e.baseUrlControl),cS(),yb(4),tv("formControl",e.apiKeyControl),cS(),yb(),tv("formArrayName","headers"),yb(6),vT(e.headersArray.controls),yb(3),tv("disabled",e.form.invalid||e.isSubmitting()),yb(),Rf(" ",e.isEditMode()?"Save changes":"Create"," ");}}var ge=new Set(["namespace","userOnNs","userGlobal"]),F=Object.freeze({platform:"Configuration de niveau plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),se=class a{route=p($t);router=p(It);destroyRef=p(Me);state=p(O);namespaceRole=p(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?ie(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});apiTypeOptions=Object.values(Te);scopeOptions=[{value:"namespace",label:F.namespace},{value:"userOnNs",label:F.userOnNs},{value:"userGlobal",label:F.userGlobal}];form=new $({name:new vt("",{nonNullable:true,validators:[ve$1.required,ve$1.minLength(1)]}),description:new vt(null),apiType:new vt("OpenAI",{nonNullable:true,validators:[ve$1.required]}),baseUrl:new vt("",{nonNullable:true}),apiKey:new vt("",{nonNullable:true}),scope:new vt("namespace",{nonNullable:true}),headers:new ze([],{validators:[]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get apiTypeControl(){return this.form.controls.apiType}get baseUrlControl(){return this.form.controls.baseUrl}get apiKeyControl(){return this.form.controls.apiKey}get scopeControl(){return this.form.controls.scope}get headersArray(){return this.form.controls.headers}addHeader(){this.headersArray.push(new $({key:new vt("",{nonNullable:true,validators:[ve$1.required]}),value:new vt("",{nonNullable:true})}));}removeHeader(r){this.headersArray.removeAt(r);}isEditMode=ie(false);isSubmitting=ie(false);isLoading=ie(false);existingConfig=null;initialApiKey="";constructor(){this.isPlatformMode||Sg(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let r=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,l=r.get("aiProviderId"),s=this.isPlatformMode?"namespace":this.parseScope(e.get("scope"));if(l){this.isEditMode.set(true),this.scopeControl.disable(),this.apiTypeControl.disable(),this.loadConfig(l);return}this.scopeControl.setValue(s);let f=e.get("template");f&&this.hydrateFromTemplate(f);}parseScope(r){return r&&ge.has(r)?r:"namespace"}deriveScopeFromConfig(r){return !r.userId?"namespace":r.namespaceId?"userOnNs":"userGlobal"}loadConfig(r){this.isLoading.set(true),this.state.getById(r).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(`[AiProviderForm] Could not load provider '${r}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(r){this.isLoading.set(true),this.state.getById(r).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.apiTypeControl.setValue(e.apiType),this.baseUrlControl.setValue(e.baseUrl??""),this.apiKeyControl.setValue(""),this.initialApiKey="",this.apiKeyControl.markAsTouched(),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AiProviderForm] Could not hydrate from template ${r}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(r){this.nameControl.setValue(r.name),this.descriptionControl.setValue(r.description??null),this.apiTypeControl.setValue(r.apiType),this.baseUrlControl.setValue(r.baseUrl??"");let e=r.apiKey??"";this.apiKeyControl.setValue(e),this.initialApiKey=e,this.headersArray.clear();for(let[l,s]of Object.entries(r.headers??{}))this.headersArray.push(new $({key:new vt(l,{nonNullable:true,validators:[ve$1.required]}),value:new vt(s,{nonNullable:true})}));}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let r=this.descriptionControl.value?.trim(),e=this.baseUrlControl.value.trim(),l=this.apiKeyControl.value,s=this.isEditMode()&&l===this.initialApiKey?null:l,f=this.headersArray.controls.filter(x=>x.controls.key.value.trim()).map(x=>[x.controls.key.value.trim(),x.controls.value.value]),de=f.length>0?Object.fromEntries(f):null,N={name:this.nameControl.value.trim(),apiType:this.apiTypeControl.value,description:r||null,baseUrl:e||null,apiKey:s,headers:de},T=this.form.getRawValue().scope,pe=this.isPlatformMode?null:this.namespaceId??null;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,N,T,this.existingConfig):this.state.create(N,T,pe)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-providers"]):this.router.navigate(["/agentos",this.namespaceId,"ai-providers"]);}trackByScope(r,e){return e.value}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=vf({type:a,selectors:[["agentos-ai-provider-form"]],decls:10,vars:2,consts:[[1,"ai-provider-form"],[1,"ai-provider-form__header"],["type","button","title","Back to AI providers",1,"ai-provider-form__back",3,"click"],[1,"ai-provider-form__back-icon"],[1,"ai-provider-form__title"],[1,"ai-provider-form__loading"],[1,"ai-provider-form__form",3,"formGroup"],[1,"ai-provider-form__form",3,"ngSubmit","formGroup"],[1,"ai-provider-form__scope",3,"disabled"],[1,"ai-provider-form__field"],["for","llm-api-type",1,"ai-provider-form__label"],["aria-hidden","true"],["id","llm-api-type",1,"ai-provider-form__select",3,"formControl"],[3,"value"],["for","llm-name",1,"ai-provider-form__label"],["id","llm-name","type","text","placeholder","e.g. OpenAI prod","autocomplete","off",1,"ai-provider-form__input",3,"formControl"],["for","llm-description",1,"ai-provider-form__label"],["id","llm-description","type","text","placeholder","Optional \u2014 short description of this provider","autocomplete","off",1,"ai-provider-form__input",3,"formControl"],["for","llm-base-url",1,"ai-provider-form__label"],["id","llm-base-url","type","url","placeholder","Optional \u2014 leave empty for default endpoint","autocomplete","off",1,"ai-provider-form__input",3,"formControl"],["for","llm-api-key",1,"ai-provider-form__label"],["id","llm-api-key","type","password","placeholder","sk-\u2026","autocomplete","new-password",1,"ai-provider-form__input","ai-provider-form__input--secret",3,"formControl"],[1,"ai-provider-form__headers",3,"formArrayName"],[1,"ai-provider-form__headers-title"],[1,"ai-provider-form__label"],["type","button",1,"ai-provider-form__headers-add",3,"click"],[1,"ai-provider-form__header-row",3,"formGroupName"],[1,"ai-provider-form__actions"],["type","submit",1,"ai-provider-form__btn","ai-provider-form__btn--primary",3,"disabled"],["type","button",1,"ai-provider-form__btn",3,"click"],[1,"ai-provider-form__scope-option"],["type","radio",3,"formControl","value","disabled"],["type","text","placeholder","Header name","formControlName","key","autocomplete","off",1,"ai-provider-form__input"],["type","text","placeholder","Value","formControlName","value","autocomplete","off",1,"ai-provider-form__input"],["type","button","title","Remove header","aria-label","Remove header",1,"ai-provider-form__header-remove",3,"click"]],template:function(e,l){e&1&&(za(0,"div",0)(1,"header",1)(2,"button",2),dc("click",function(){return l.cancel()}),za(3,"span",3),r_(4,"\u2190"),Cf(),r_(5," AI Providers "),Cf(),za(6,"h1",4),r_(7),Cf()(),hT(8,ce,2,0,"p",5)(9,_e,41,10,"form",6),Cf()),e&2&&(yb(7),Iv(l.isEditMode()?"Edit AI provider":"New AI provider"),yb(),pT(l.isLoading()?8:9));},dependencies:[Kn,zn,Zn,Xn,Ye,bt,fn,Ln,Wn,pn,Vn,yn,yt,Ct],styles:[".ai-provider-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:480px;margin:0 auto;padding:2rem 1rem}.ai-provider-form__scope[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.4rem;border:1px solid var(--color-divider);border-radius:0;padding:.75rem 1rem;margin:0}.ai-provider-form__scope[disabled][_ngcontent-%COMP%]{opacity:.6}.ai-provider-form__scope-option[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;font-size:.85rem;color:var(--color-text);cursor:pointer}.ai-provider-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.ai-provider-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.ai-provider-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.ai-provider-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.ai-provider-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.ai-provider-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.ai-provider-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.ai-provider-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.ai-provider-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.ai-provider-form__input[_ngcontent-%COMP%], .ai-provider-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.ai-provider-form__input[_ngcontent-%COMP%]:focus, .ai-provider-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.ai-provider-form__input[_ngcontent-%COMP%]::placeholder, .ai-provider-form__select[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.ai-provider-form__input--secret[_ngcontent-%COMP%]{font-family:monospace;letter-spacing:.05em}.ai-provider-form__headers[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.ai-provider-form__headers-title[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between}.ai-provider-form__headers-add[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.8125rem;color:var(--color-accent)}.ai-provider-form__headers-add[_ngcontent-%COMP%]:hover{text-decoration:underline}.ai-provider-form__header-row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr auto;gap:.5rem;align-items:center}.ai-provider-form__header-remove[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:2rem;height:2rem;background:none;border:1px solid transparent;border-radius:0;cursor:pointer;font-size:1rem;color:var(--color-neutral-500);transition:background .15s ease,color .15s ease,border-color .15s ease;flex-shrink:0}.ai-provider-form__header-remove[_ngcontent-%COMP%]:hover{color:var(--red);background:color-mix(in srgb,var(--red) 10%,transparent);border-color:var(--red)}.ai-provider-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.ai-provider-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.ai-provider-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.ai-provider-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.ai-provider-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.ai-provider-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}"]})};export{se as AiProviderFormComponent};
1
+ import {O}from'./chunk-BBrd_rzb.js';import {v}from'./chunk-Didf0Mgo.js';import {p,$ as $t,c as It,M as Me,i as ie,ae as Te,F as Sg,v as vf,z as za,f as dc,r as r_,C as Cf,h as hT,a as yb,I as Iv,d as pT,e as bT,n as yT,J as mT,s as sS,l as lc,ad as gT,N as NT,t as tv,g as cS,o as vT,R as Rf,H as dT,k as ig,m as sg}from'./main-5NWD4SCX.js';import {F as F$1,$,k as ze,v as vt,a as ve$1,U,K as Kn,z as zn,Z as Zn,X as Xn,Y as Ye,e as bt,g as fn,L as Ln,W as Wn,b as pn,V as Vn,y as yn,n as yt,C as Ct}from'./chunk-C881tCOG.js';import'./chunk-B2R438Y9.js';function ce(a,r){a&1&&(za(0,"p",5),r_(1,"Loading\u2026"),Cf());}function me(a,r){if(a&1&&(za(0,"label",30),lc(1,"input",31),sS(),za(2,"span"),r_(3),Cf()()),a&2){let e=r.$implicit,l=NT(3);yb(),tv("formControl",l.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!l.isAdmin()),cS(),yb(2),Iv(e.label);}}function ue(a,r){if(a&1&&(za(0,"fieldset",8)(1,"legend",24),r_(2,"Port\xE9e de la configuration"),Cf(),yT(3,me,4,4,"label",30,dT().trackByScope,true),Cf()),a&2){let e=NT(2);tv("disabled",e.isEditMode()),yb(3),vT(e.scopeOptions);}}function ve(a,r){if(a&1&&(za(0,"option",13),r_(1),Cf()),a&2){let e=r.$implicit;tv("value",e),yb(),Iv(e);}}function fe(a,r){if(a&1){let e=bT();za(0,"div",26),lc(1,"input",32),sS(),lc(2,"input",33),sS(),za(3,"button",34),dc("click",function(){let s=ig(e).$index,f=NT(2);return sg(f.removeHeader(s))}),r_(4," \xD7 "),Cf()();}if(a&2){let e=r.$index;tv("formGroupName",e),yb(),cS(),yb(),cS();}}function _e(a,r){if(a&1){let e=bT();za(0,"form",7),dc("ngSubmit",function(){ig(e);let s=NT();return sg(s.submit())}),hT(1,ue,5,1,"fieldset",8),za(2,"div",9)(3,"label",10),r_(4,"API type "),za(5,"span",11),r_(6,"*"),Cf()(),za(7,"select",12),yT(8,ve,2,2,"option",13,mT),Cf(),sS(),Cf(),za(10,"div",9)(11,"label",14),r_(12,"Name "),za(13,"span",11),r_(14,"*"),Cf()(),lc(15,"input",15),sS(),Cf(),za(16,"div",9)(17,"label",16),r_(18,"Description"),Cf(),lc(19,"input",17),sS(),Cf(),za(20,"div",9)(21,"label",18),r_(22,"Base URL"),Cf(),lc(23,"input",19),sS(),Cf(),za(24,"div",9)(25,"label",20),r_(26,"API key"),Cf(),lc(27,"input",21),sS(),Cf(),za(28,"div",22)(29,"div",23)(30,"span",24),r_(31,"Custom headers"),Cf(),za(32,"button",25),dc("click",function(){ig(e);let s=NT();return sg(s.addHeader())}),r_(33,"+ Add header"),Cf()(),yT(34,fe,5,1,"div",26,gT),Cf(),za(36,"div",27)(37,"button",28),r_(38),Cf(),za(39,"button",29),dc("click",function(){ig(e);let s=NT();return sg(s.cancel())}),r_(40,"Cancel"),Cf()()();}if(a&2){let e=NT();tv("formGroup",e.form),yb(),pT(e.isPlatformMode?-1:1),yb(6),tv("formControl",e.apiTypeControl),cS(),yb(),vT(e.apiTypeOptions),yb(7),tv("formControl",e.nameControl),cS(),yb(4),tv("formControl",e.descriptionControl),cS(),yb(4),tv("formControl",e.baseUrlControl),cS(),yb(4),tv("formControl",e.apiKeyControl),cS(),yb(),tv("formArrayName","headers"),yb(6),vT(e.headersArray.controls),yb(3),tv("disabled",e.form.invalid||e.isSubmitting()),yb(),Rf(" ",e.isEditMode()?"Save changes":"Create"," ");}}var ge=new Set(["namespace","userOnNs","userGlobal"]),F=Object.freeze({platform:"Configuration de niveau plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),se=class a{route=p($t);router=p(It);destroyRef=p(Me);state=p(O);namespaceRole=p(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?ie(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});apiTypeOptions=Object.values(Te);scopeOptions=[{value:"namespace",label:F.namespace},{value:"userOnNs",label:F.userOnNs},{value:"userGlobal",label:F.userGlobal}];form=new $({name:new vt("",{nonNullable:true,validators:[ve$1.required,ve$1.minLength(1)]}),description:new vt(null),apiType:new vt("OpenAI",{nonNullable:true,validators:[ve$1.required]}),baseUrl:new vt("",{nonNullable:true}),apiKey:new vt("",{nonNullable:true}),scope:new vt("namespace",{nonNullable:true}),headers:new ze([],{validators:[]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get apiTypeControl(){return this.form.controls.apiType}get baseUrlControl(){return this.form.controls.baseUrl}get apiKeyControl(){return this.form.controls.apiKey}get scopeControl(){return this.form.controls.scope}get headersArray(){return this.form.controls.headers}addHeader(){this.headersArray.push(new $({key:new vt("",{nonNullable:true,validators:[ve$1.required]}),value:new vt("",{nonNullable:true})}));}removeHeader(r){this.headersArray.removeAt(r);}isEditMode=ie(false);isSubmitting=ie(false);isLoading=ie(false);existingConfig=null;initialApiKey="";constructor(){this.isPlatformMode||Sg(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let r=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,l=r.get("aiProviderId"),s=this.isPlatformMode?"namespace":this.parseScope(e.get("scope"));if(l){this.isEditMode.set(true),this.scopeControl.disable(),this.apiTypeControl.disable(),this.loadConfig(l);return}this.scopeControl.setValue(s);let f=e.get("template");f&&this.hydrateFromTemplate(f);}parseScope(r){return r&&ge.has(r)?r:"namespace"}deriveScopeFromConfig(r){return !r.userId?"namespace":r.namespaceId?"userOnNs":"userGlobal"}loadConfig(r){this.isLoading.set(true),this.state.getById(r).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(`[AiProviderForm] Could not load provider '${r}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(r){this.isLoading.set(true),this.state.getById(r).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.apiTypeControl.setValue(e.apiType),this.baseUrlControl.setValue(e.baseUrl??""),this.apiKeyControl.setValue(""),this.initialApiKey="",this.apiKeyControl.markAsTouched(),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AiProviderForm] Could not hydrate from template ${r}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(r){this.nameControl.setValue(r.name),this.descriptionControl.setValue(r.description??null),this.apiTypeControl.setValue(r.apiType),this.baseUrlControl.setValue(r.baseUrl??"");let e=r.apiKey??"";this.apiKeyControl.setValue(e),this.initialApiKey=e,this.headersArray.clear();for(let[l,s]of Object.entries(r.headers??{}))this.headersArray.push(new $({key:new vt(l,{nonNullable:true,validators:[ve$1.required]}),value:new vt(s,{nonNullable:true})}));}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let r=this.descriptionControl.value?.trim(),e=this.baseUrlControl.value.trim(),l=this.apiKeyControl.value,s=this.isEditMode()&&l===this.initialApiKey?null:l,f=this.headersArray.controls.filter(x=>x.controls.key.value.trim()).map(x=>[x.controls.key.value.trim(),x.controls.value.value]),de=f.length>0?Object.fromEntries(f):null,N={name:this.nameControl.value.trim(),apiType:this.apiTypeControl.value,description:r||null,baseUrl:e||null,apiKey:s,headers:de},T=this.form.getRawValue().scope,pe=this.isPlatformMode?null:this.namespaceId??null;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,N,T,this.existingConfig):this.state.create(N,T,pe)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-providers"]):this.router.navigate(["/agentos",this.namespaceId,"ai-providers"]);}trackByScope(r,e){return e.value}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=vf({type:a,selectors:[["agentos-ai-provider-form"]],decls:10,vars:2,consts:[[1,"ai-provider-form"],[1,"ai-provider-form__header"],["type","button","title","Back to AI providers",1,"ai-provider-form__back",3,"click"],[1,"ai-provider-form__back-icon"],[1,"ai-provider-form__title"],[1,"ai-provider-form__loading"],[1,"ai-provider-form__form",3,"formGroup"],[1,"ai-provider-form__form",3,"ngSubmit","formGroup"],[1,"ai-provider-form__scope",3,"disabled"],[1,"ai-provider-form__field"],["for","llm-api-type",1,"ai-provider-form__label"],["aria-hidden","true"],["id","llm-api-type",1,"ai-provider-form__select",3,"formControl"],[3,"value"],["for","llm-name",1,"ai-provider-form__label"],["id","llm-name","type","text","placeholder","e.g. OpenAI prod","autocomplete","off",1,"ai-provider-form__input",3,"formControl"],["for","llm-description",1,"ai-provider-form__label"],["id","llm-description","type","text","placeholder","Optional \u2014 short description of this provider","autocomplete","off",1,"ai-provider-form__input",3,"formControl"],["for","llm-base-url",1,"ai-provider-form__label"],["id","llm-base-url","type","url","placeholder","Optional \u2014 leave empty for default endpoint","autocomplete","off",1,"ai-provider-form__input",3,"formControl"],["for","llm-api-key",1,"ai-provider-form__label"],["id","llm-api-key","type","password","placeholder","sk-\u2026","autocomplete","new-password",1,"ai-provider-form__input","ai-provider-form__input--secret",3,"formControl"],[1,"ai-provider-form__headers",3,"formArrayName"],[1,"ai-provider-form__headers-title"],[1,"ai-provider-form__label"],["type","button",1,"ai-provider-form__headers-add",3,"click"],[1,"ai-provider-form__header-row",3,"formGroupName"],[1,"ai-provider-form__actions"],["type","submit",1,"ai-provider-form__btn","ai-provider-form__btn--primary",3,"disabled"],["type","button",1,"ai-provider-form__btn",3,"click"],[1,"ai-provider-form__scope-option"],["type","radio",3,"formControl","value","disabled"],["type","text","placeholder","Header name","formControlName","key","autocomplete","off",1,"ai-provider-form__input"],["type","text","placeholder","Value","formControlName","value","autocomplete","off",1,"ai-provider-form__input"],["type","button","title","Remove header","aria-label","Remove header",1,"ai-provider-form__header-remove",3,"click"]],template:function(e,l){e&1&&(za(0,"div",0)(1,"header",1)(2,"button",2),dc("click",function(){return l.cancel()}),za(3,"span",3),r_(4,"\u2190"),Cf(),r_(5," AI Providers "),Cf(),za(6,"h1",4),r_(7),Cf()(),hT(8,ce,2,0,"p",5)(9,_e,41,10,"form",6),Cf()),e&2&&(yb(7),Iv(l.isEditMode()?"Edit AI provider":"New AI provider"),yb(),pT(l.isLoading()?8:9));},dependencies:[Kn,zn,Zn,Xn,Ye,bt,fn,Ln,Wn,pn,Vn,yn,yt,Ct],styles:[".ai-provider-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:480px;margin:0 auto;padding:2rem 1rem}.ai-provider-form__scope[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.4rem;border:1px solid var(--color-divider);border-radius:0;padding:.75rem 1rem;margin:0}.ai-provider-form__scope[disabled][_ngcontent-%COMP%]{opacity:.6}.ai-provider-form__scope-option[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;font-size:.85rem;color:var(--color-text);cursor:pointer}.ai-provider-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.ai-provider-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.ai-provider-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.ai-provider-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.ai-provider-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.ai-provider-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.ai-provider-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.ai-provider-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.ai-provider-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.ai-provider-form__input[_ngcontent-%COMP%], .ai-provider-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.ai-provider-form__input[_ngcontent-%COMP%]:focus, .ai-provider-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.ai-provider-form__input[_ngcontent-%COMP%]::placeholder, .ai-provider-form__select[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.ai-provider-form__input--secret[_ngcontent-%COMP%]{font-family:monospace;letter-spacing:.05em}.ai-provider-form__headers[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.ai-provider-form__headers-title[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between}.ai-provider-form__headers-add[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.8125rem;color:var(--color-accent)}.ai-provider-form__headers-add[_ngcontent-%COMP%]:hover{text-decoration:underline}.ai-provider-form__header-row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr auto;gap:.5rem;align-items:center}.ai-provider-form__header-remove[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:2rem;height:2rem;background:none;border:1px solid transparent;border-radius:0;cursor:pointer;font-size:1rem;color:var(--color-neutral-500);transition:background .15s ease,color .15s ease,border-color .15s ease;flex-shrink:0}.ai-provider-form__header-remove[_ngcontent-%COMP%]:hover{color:var(--red);background:color-mix(in srgb,var(--red) 10%,transparent);border-color:var(--red)}.ai-provider-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.ai-provider-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.ai-provider-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.ai-provider-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.ai-provider-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.ai-provider-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}"]})};export{se as AiProviderFormComponent};