@whoz-oss/coday-client 0.214.2 → 0.215.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/browser/{chunk-7JNEJMOU.js → chunk-4OE7SJW2.js} +1 -1
  2. package/browser/{chunk-L5WQCZRE.js → chunk-5M4KUUYB.js} +1 -1
  3. package/browser/{chunk-WQU7BC4Q.js → chunk-7JDBBKA2.js} +1 -1
  4. package/browser/{chunk-BPJO7AWC.js → chunk-AEMA5SBI.js} +1 -1
  5. package/browser/{chunk-PO5YVRVZ.js → chunk-BE66FFWQ.js} +1 -1
  6. package/browser/{chunk-EYIALH4L.js → chunk-D57JBI5M.js} +1 -1
  7. package/browser/{chunk-DRZNSAVZ.js → chunk-DFWRFHZX.js} +1 -1
  8. package/browser/{chunk-QVQF6CQG.js → chunk-DIH267SI.js} +1 -1
  9. package/browser/{chunk-FBB7REI2.js → chunk-DQFOFYA5.js} +1 -1
  10. package/browser/{chunk-OUMQX2CT.js → chunk-FN4P6OBG.js} +1 -1
  11. package/browser/{chunk-277IC2QE.js → chunk-GKB567T3.js} +1 -1
  12. package/browser/{chunk-XYSPIFZC.js → chunk-H4HDBIRV.js} +1 -1
  13. package/browser/{chunk-N2EM2OHG.js → chunk-I7PKQKLV.js} +1 -1
  14. package/browser/{chunk-GN5OSMEB.js → chunk-IBXOOQSH.js} +1 -1
  15. package/browser/{chunk-CPH6KZS7.js → chunk-JZLS7LZL.js} +1 -1
  16. package/browser/{chunk-ZWM3VY6S.js → chunk-KDZNGL3W.js} +1 -1
  17. package/browser/{chunk-42PHOVHW.js → chunk-MH3GGCX2.js} +1 -1
  18. package/browser/{chunk-PVRZ743D.js → chunk-MICEDHUT.js} +1 -1
  19. package/browser/{chunk-SQLOY43N.js → chunk-MMRRYSKY.js} +1 -1
  20. package/browser/{chunk-HGBGIBBE.js → chunk-MQVSB5ST.js} +1 -1
  21. package/browser/{chunk-EEXBA3SZ.js → chunk-N3CMGDX3.js} +1 -1
  22. package/browser/{chunk-34VSHF53.js → chunk-NQMP6GU4.js} +1 -1
  23. package/browser/{chunk-D4HRVNXF.js → chunk-PBTS23YJ.js} +1 -1
  24. package/browser/{chunk-7CZDTFEW.js → chunk-PJFSN2FM.js} +1 -1
  25. package/browser/{chunk-XS2UZDZH.js → chunk-QGECSDNW.js} +1 -1
  26. package/browser/{chunk-R6R7XD7M.js → chunk-QVDTMVXQ.js} +1 -1
  27. package/browser/{chunk-OUSIG6VB.js → chunk-RDOYFMCK.js} +1 -1
  28. package/browser/{chunk-EAYCLP6Q.js → chunk-RGCKRR5L.js} +1 -1
  29. package/browser/{chunk-E6H3OGX4.js → chunk-SC2KBZPS.js} +1 -1
  30. package/browser/{chunk-LS4KFB4C.js → chunk-T67CQJLN.js} +1 -1
  31. package/browser/{chunk-TPQSKNWC.js → chunk-UA3NMJET.js} +1 -1
  32. package/browser/chunk-UZB6WMLR.js +1 -0
  33. package/browser/{chunk-ZET4SKHG.js → chunk-WOSZTHMO.js} +1 -1
  34. package/browser/{chunk-C2K3CJDB.js → chunk-Y6AWENMD.js} +1 -1
  35. package/browser/{chunk-2PRKBGAK.js → chunk-Y7RF7EDO.js} +1 -1
  36. package/browser/{chunk-MRSRN4TG.js → chunk-ZMACFA2A.js} +1 -1
  37. package/browser/index.html +1 -1
  38. package/browser/{main-VMGRWPKV.js → main-BB4NA3ZC.js} +1 -1
  39. package/package.json +1 -1
  40. package/browser/chunk-ZR5OMYGQ.js +0 -1
@@ -1 +1 @@
1
- import{a as K}from"./chunk-LS4KFB4C.js";import"./chunk-QVQF6CQG.js";import{a as T,c as G}from"./chunk-P4GNUQZT.js";import{a as w}from"./chunk-SKBT6DBT.js";import{F as J,c as z,e as c,g as $,h as R,i as F,l as v,n as L,r as N,s as B,t as q,u as U,v as j,w as H}from"./chunk-Z6RFJ6L3.js";import{Bb as y,Db as s,Fb as d,Ka as a,Rb as P,Tb as r,Ub as b,Vb as k,Wa as D,a as A,b as V,ca as h,ga as f,ha as _,lb as u,ma as I,mb as g,nb as S,pb as E,qb as O,rb as p,sb as n,ta as C,tb as o,ub as x}from"./chunk-5NLXR4MK.js";function W(m,t){m&1&&(n(0,"p",5),r(1,"Loading\u2026"),o())}function X(m,t){m&1&&(n(0,"span",12),r(1,"Name is required."),o())}function Y(m,t){m&1&&(n(0,"p",19),r(1,"No parameters defined."),o())}function Z(m,t){m&1&&(n(0,"span",12),r(1,"Parameter name is required."),o())}function ee(m,t){if(m&1){let e=y();n(0,"div",20)(1,"div",27)(2,"div",28)(3,"label",29),r(4,"Name "),n(5,"span",10),r(6,"*"),o()(),x(7,"input",30),u(8,Z,2,0,"span",12),o(),n(9,"div",28)(10,"label",29),r(11,"Description"),o(),x(12,"input",31),o(),n(13,"div",28)(14,"label",29),r(15,"Default value"),o(),x(16,"input",32),o()(),n(17,"button",33),s("click",function(){let l=f(e).$index,M=d(2);return _(M.removeParameter(l))}),r(18," \xD7 "),o()()}if(m&2){let e=t.$implicit,i=t.$index;p("formGroupName",i),a(3),p("for","param-name-"+i),a(4),P("prompt-form__input--invalid",e.controls.name.invalid&&e.controls.name.touched),p("id","param-name-"+i),a(),g(e.controls.name.invalid&&e.controls.name.touched?8:-1),a(2),p("for","param-desc-"+i),a(2),p("id","param-desc-"+i),a(2),p("for","param-default-"+i),a(2),p("id","param-default-"+i)}}function te(m,t){m&1&&(n(0,"span",12),r(1,"Content entry must not be blank."),o())}function re(m,t){if(m&1){let e=y();n(0,"div",22)(1,"span",34),r(2),o(),n(3,"div",35),x(4,"textarea",36),u(5,te,2,0,"span",12),o(),n(6,"button",37),s("click",function(){let l=f(e).$index,M=d(2);return _(M.removeContentEntry(l))}),r(7," \xD7 "),o()()}if(m&2){let e=t.$implicit,i=t.$index,l=d(2);a(2),b(i+1),a(2),P("prompt-form__textarea--invalid",e.invalid&&e.touched),p("formControlName",i),a(),g(e.invalid&&e.touched?5:-1),a(),p("disabled",l.contentArray.length===1)}}function oe(m,t){if(m&1&&(n(0,"p",23),r(1),o()),m&2){let e=d(2);a(),b(e.errorMessage())}}function ne(m,t){if(m&1){let e=y();n(0,"form",7),s("ngSubmit",function(){f(e);let l=d();return _(l.submit())}),n(1,"div",8)(2,"label",9),r(3,"Name "),n(4,"span",10),r(5,"*"),o()(),x(6,"input",11),u(7,X,2,0,"span",12),o(),n(8,"div",8)(9,"label",13),r(10,"Description"),o(),x(11,"input",14),o(),n(12,"fieldset",15)(13,"legend",16),r(14," Parameters "),n(15,"span",17),r(16,"Named placeholders used in content"),o()(),n(17,"p",18),r(18," Each parameter must have a name and a default value. Use "),n(19,"code"),r(20),o(),r(21," in content entries to reference them. "),o(),u(22,Y,2,0,"p",19),E(23,ee,19,10,"div",20,S),n(25,"button",21),s("click",function(){f(e);let l=d();return _(l.addParameter())}),r(26,"+ Add parameter"),o()(),n(27,"fieldset",15)(28,"legend",16),r(29," Content "),n(30,"span",10),r(31,"*"),o(),n(32,"span",17),r(33,"Ordered list of text commands"),o()(),n(34,"p",18),r(35," Each content entry is a command. Use "),n(36,"code"),r(37,"@AgentName"),o(),r(38," to target an agent, "),n(39,"code"),r(40,"/promptName param1 param2"),o(),r(41," to call another prompt, and "),n(42,"code"),r(43),o(),r(44," for parameter placeholders. "),o(),E(45,re,8,6,"div",22,S),n(47,"button",21),s("click",function(){f(e);let l=d();return _(l.addContentEntry())}),r(48,"+ Add content entry"),o()(),u(49,oe,2,1,"p",23),n(50,"div",24)(51,"button",25),r(52),o(),n(53,"button",26),s("click",function(){f(e);let l=d();return _(l.cancel())}),r(54,"Cancel"),o()()()}if(m&2){let e=d();p("formGroup",e.form),a(6),P("prompt-form__input--invalid",e.nameControl.invalid&&e.nameControl.touched),p("formControl",e.nameControl),a(),g(e.nameControl.invalid&&e.nameControl.touched?7:-1),a(4),p("formControl",e.descriptionControl),a(),p("formArrayName","parameters"),a(8),b(e.paramPlaceholderSyntax),a(2),g(e.parametersArray.length===0?22:-1),a(),O(e.parametersArray.controls),a(4),p("formArrayName","content"),a(16),b(e.paramPlaceholderSyntax),a(2),O(e.contentArray.controls),a(4),g(e.errorMessage()?49:-1),a(2),p("disabled",e.form.invalid||e.isSubmitting()),a(),k(" ",e.isEditMode()?"Save changes":"Create"," ")}}var Q=class m{route=h(T);router=h(G);destroyRef=h(I);promptState=h(K);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new F({name:new v("",{nonNullable:!0,validators:[c.required,c.minLength(1)]}),description:new v(null),content:new N([this.createContentControl()],{validators:[c.required]}),parameters:new N([])});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get contentArray(){return this.form.controls.content}get parametersArray(){return this.form.controls.parameters}isEditMode=C(!1);isSubmitting=C(!1);isLoading=C(!1);errorMessage=C(null);paramPlaceholderSyntax="{{paramName}}";existingPrompt=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("promptId");t&&(this.isEditMode.set(!0),this.loadPrompt(t))}loadPrompt(t){this.isLoading.set(!0),this.promptState.getById(t).pipe(w(this.destroyRef)).subscribe({next:e=>{this.existingPrompt=e,this.hydrateForm(e),this.isLoading.set(!1)},error:()=>{this.isLoading.set(!1),this.navigateBack()}})}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.contentArray.clear(),(t.content.length>0?t.content:[""]).forEach(i=>this.contentArray.push(this.createContentControl(i))),this.parametersArray.clear(),(t.parameters??[]).forEach(i=>this.parametersArray.push(this.createParameterGroup(i)))}createContentControl(t=""){return new v(t,{nonNullable:!0,validators:[c.required,c.pattern(/\S/)]})}addContentEntry(){this.contentArray.push(this.createContentControl())}removeContentEntry(t){this.contentArray.length>1&&this.contentArray.removeAt(t)}createParameterGroup(t){return new F({name:new v(t?.name??"",{nonNullable:!0,validators:[c.required,c.minLength(1)]}),description:new v(t?.description??null),defaultValue:new v(t?.defaultValue??"",{nonNullable:!0,validators:[c.required]})})}addParameter(){this.parametersArray.push(this.createParameterGroup())}removeParameter(t){this.parametersArray.removeAt(t)}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(!0);let t=V(A({},this.existingPrompt??{}),{namespaceId:this.namespaceId,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,content:this.contentArray.controls.map(i=>i.value.trim()),parameters:this.parametersArray.controls.map(i=>({name:i.controls.name.value.trim(),description:i.controls.description.value?.trim()||void 0,defaultValue:i.controls.defaultValue.value.trim()}))}),e=this.isEditMode()&&this.existingPrompt?.id?this.promptState.update(this.existingPrompt.id,t):this.promptState.create(t);this.errorMessage.set(null),e.pipe(w(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:i=>{this.isSubmitting.set(!1),i.status===409?this.errorMessage.set(`A prompt named "${t.name}" already exists in this scope.`):i.status===400?this.errorMessage.set(i.error?.message??"Invalid prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.")}})}cancel(){this.navigateBack()}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","prompts"]):this.router.navigate(["/agentos",this.namespaceId,"prompts"])}static \u0275fac=function(e){return new(e||m)};static \u0275cmp=D({type:m,selectors:[["agentos-prompt-form"]],decls:10,vars:3,consts:[[1,"prompt-form"],[1,"prompt-form__header"],["type","button","title","Back to prompts",1,"prompt-form__back",3,"click"],[1,"prompt-form__back-icon"],[1,"prompt-form__title"],[1,"prompt-form__loading"],[1,"prompt-form__form",3,"formGroup"],[1,"prompt-form__form",3,"ngSubmit","formGroup"],[1,"prompt-form__field"],["for","prompt-name",1,"prompt-form__label"],["aria-hidden","true"],["id","prompt-name","type","text","placeholder","e.g. Summarise meeting notes","autocomplete","off",1,"prompt-form__input",3,"formControl"],[1,"prompt-form__field-error"],["for","prompt-description",1,"prompt-form__label"],["id","prompt-description","type","text","placeholder","Optional \u2014 short description of this prompt","autocomplete","off",1,"prompt-form__input",3,"formControl"],[1,"prompt-form__section",3,"formArrayName"],[1,"prompt-form__label"],[1,"prompt-form__label-hint"],[1,"prompt-form__section-hint"],[1,"prompt-form__empty-hint"],[1,"prompt-form__param-row",3,"formGroupName"],["type","button",1,"prompt-form__add-btn",3,"click"],[1,"prompt-form__content-row"],[1,"prompt-form__error"],[1,"prompt-form__actions"],["type","submit",1,"prompt-form__btn","prompt-form__btn--primary",3,"disabled"],["type","button",1,"prompt-form__btn",3,"click"],[1,"prompt-form__param-fields"],[1,"prompt-form__field","prompt-form__field--inline"],[1,"prompt-form__label",3,"for"],["type","text","placeholder","e.g. language","formControlName","name","autocomplete","off",1,"prompt-form__input",3,"id"],["type","text","placeholder","Optional","formControlName","description","autocomplete","off",1,"prompt-form__input",3,"id"],["type","text","placeholder","e.g. English","formControlName","defaultValue","autocomplete","off",1,"prompt-form__input",3,"id"],["type","button","title","Remove this parameter",1,"prompt-form__remove-btn",3,"click"],[1,"prompt-form__content-index"],[1,"prompt-form__content-field"],["rows","4","placeholder","Enter a command\u2026",1,"prompt-form__textarea",3,"formControlName"],["type","button","title","Remove this entry",1,"prompt-form__remove-btn",3,"click","disabled"]],template:function(e,i){e&1&&(n(0,"div",0)(1,"header",1)(2,"button",2),s("click",function(){return i.cancel()}),n(3,"span",3),r(4,"\u2190"),o(),r(5),o(),n(6,"h1",4),r(7),o()(),u(8,W,2,0,"p",5)(9,ne,55,14,"form",6),o()),e&2&&(a(5),k(" ",i.isPlatformMode?"Platform prompts":"Prompts"," "),a(2),b(i.isEditMode()?"Edit prompt":"New prompt"),a(),g(i.isLoading()?8:9))},dependencies:[J,L,z,$,R,B,H,j,q,U],styles:[".prompt-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.prompt-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.prompt-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.prompt-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.prompt-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.prompt-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.prompt-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.prompt-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.prompt-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.prompt-form__field--inline[_ngcontent-%COMP%]{flex:1}.prompt-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text, #1d1d1f)}.prompt-form__label-hint[_ngcontent-%COMP%]{font-weight:400;color:var(--color-text-secondary, #6e6e73);margin-left:.375rem}.prompt-form__input[_ngcontent-%COMP%], .prompt-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.prompt-form__input[_ngcontent-%COMP%]:focus, .prompt-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.prompt-form__input[_ngcontent-%COMP%]::placeholder, .prompt-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.prompt-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:100px;line-height:1.5}.prompt-form__section[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:8px;padding:1rem;margin:0;display:flex;flex-direction:column;gap:.75rem}.prompt-form__section-hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.prompt-form__empty-hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary, #6e6e73);font-style:italic}.prompt-form__content-row[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:flex-start}.prompt-form__content-field[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.25rem}.prompt-form__content-index[_ngcontent-%COMP%]{flex-shrink:0;width:1.5rem;padding-top:.6rem;font-size:.8rem;font-weight:600;color:var(--color-text-secondary, #6e6e73);text-align:right;-webkit-user-select:none;user-select:none}.prompt-form__param-row[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:flex-end;padding:.75rem;border-radius:6px;background:var(--color-surface-hover, rgba(0, 0, 0, .03))}.prompt-form__param-fields[_ngcontent-%COMP%]{flex:1;display:flex;gap:.75rem;flex-wrap:wrap}.prompt-form__add-btn[_ngcontent-%COMP%]{align-self:flex-start;padding:.4rem .875rem;border-radius:6px;border:1px dashed var(--color-border, rgba(0, 0, 0, .15));background:transparent;color:var(--color-primary, #007aff);font-size:.875rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.prompt-form__add-btn[_ngcontent-%COMP%]:hover{background:var(--color-surface-hover, rgba(0, 0, 0, .04));border-color:var(--color-primary, #007aff)}.prompt-form__remove-btn[_ngcontent-%COMP%]{flex-shrink:0;width:1.75rem;height:1.75rem;display:flex;align-items:center;justify-content:center;border-radius:50%;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text-secondary, #6e6e73);font-size:1rem;line-height:1;cursor:pointer;transition:background .15s ease,color .15s ease,border-color .15s ease}.prompt-form__remove-btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-error-light, rgba(255, 59, 48, .08));color:var(--color-error, #ff3b30);border-color:var(--color-error, #ff3b30)}.prompt-form__remove-btn[_ngcontent-%COMP%]:disabled{opacity:.3;cursor:not-allowed}.prompt-form__error[_ngcontent-%COMP%]{margin:0;padding:.625rem .875rem;border-radius:8px;background:var(--color-error-light, rgba(255, 59, 48, .08));border:1px solid var(--color-error, #ff3b30);color:var(--color-error, #ff3b30);font-size:.875rem;line-height:1.4}.prompt-form__field-error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30);line-height:1.3}.prompt-form__input--invalid[_ngcontent-%COMP%], .prompt-form__textarea--invalid[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30)}.prompt-form__input--invalid[_ngcontent-%COMP%]:focus, .prompt-form__textarea--invalid[_ngcontent-%COMP%]:focus{border-color:var(--color-error, #ff3b30)}.prompt-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.prompt-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.prompt-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.prompt-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.prompt-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.prompt-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"],changeDetection:0})};export{Q as PromptFormComponent};
1
+ import{a as K}from"./chunk-T67CQJLN.js";import"./chunk-DIH267SI.js";import{a as T,c as G}from"./chunk-P4GNUQZT.js";import{a as w}from"./chunk-SKBT6DBT.js";import{F as J,c as z,e as c,g as $,h as R,i as F,l as v,n as L,r as N,s as B,t as q,u as U,v as j,w as H}from"./chunk-Z6RFJ6L3.js";import{Bb as y,Db as s,Fb as d,Ka as a,Rb as P,Tb as r,Ub as b,Vb as k,Wa as D,a as A,b as V,ca as h,ga as f,ha as _,lb as u,ma as I,mb as g,nb as S,pb as E,qb as O,rb as p,sb as n,ta as C,tb as o,ub as x}from"./chunk-5NLXR4MK.js";function W(m,t){m&1&&(n(0,"p",5),r(1,"Loading\u2026"),o())}function X(m,t){m&1&&(n(0,"span",12),r(1,"Name is required."),o())}function Y(m,t){m&1&&(n(0,"p",19),r(1,"No parameters defined."),o())}function Z(m,t){m&1&&(n(0,"span",12),r(1,"Parameter name is required."),o())}function ee(m,t){if(m&1){let e=y();n(0,"div",20)(1,"div",27)(2,"div",28)(3,"label",29),r(4,"Name "),n(5,"span",10),r(6,"*"),o()(),x(7,"input",30),u(8,Z,2,0,"span",12),o(),n(9,"div",28)(10,"label",29),r(11,"Description"),o(),x(12,"input",31),o(),n(13,"div",28)(14,"label",29),r(15,"Default value"),o(),x(16,"input",32),o()(),n(17,"button",33),s("click",function(){let l=f(e).$index,M=d(2);return _(M.removeParameter(l))}),r(18," \xD7 "),o()()}if(m&2){let e=t.$implicit,i=t.$index;p("formGroupName",i),a(3),p("for","param-name-"+i),a(4),P("prompt-form__input--invalid",e.controls.name.invalid&&e.controls.name.touched),p("id","param-name-"+i),a(),g(e.controls.name.invalid&&e.controls.name.touched?8:-1),a(2),p("for","param-desc-"+i),a(2),p("id","param-desc-"+i),a(2),p("for","param-default-"+i),a(2),p("id","param-default-"+i)}}function te(m,t){m&1&&(n(0,"span",12),r(1,"Content entry must not be blank."),o())}function re(m,t){if(m&1){let e=y();n(0,"div",22)(1,"span",34),r(2),o(),n(3,"div",35),x(4,"textarea",36),u(5,te,2,0,"span",12),o(),n(6,"button",37),s("click",function(){let l=f(e).$index,M=d(2);return _(M.removeContentEntry(l))}),r(7," \xD7 "),o()()}if(m&2){let e=t.$implicit,i=t.$index,l=d(2);a(2),b(i+1),a(2),P("prompt-form__textarea--invalid",e.invalid&&e.touched),p("formControlName",i),a(),g(e.invalid&&e.touched?5:-1),a(),p("disabled",l.contentArray.length===1)}}function oe(m,t){if(m&1&&(n(0,"p",23),r(1),o()),m&2){let e=d(2);a(),b(e.errorMessage())}}function ne(m,t){if(m&1){let e=y();n(0,"form",7),s("ngSubmit",function(){f(e);let l=d();return _(l.submit())}),n(1,"div",8)(2,"label",9),r(3,"Name "),n(4,"span",10),r(5,"*"),o()(),x(6,"input",11),u(7,X,2,0,"span",12),o(),n(8,"div",8)(9,"label",13),r(10,"Description"),o(),x(11,"input",14),o(),n(12,"fieldset",15)(13,"legend",16),r(14," Parameters "),n(15,"span",17),r(16,"Named placeholders used in content"),o()(),n(17,"p",18),r(18," Each parameter must have a name and a default value. Use "),n(19,"code"),r(20),o(),r(21," in content entries to reference them. "),o(),u(22,Y,2,0,"p",19),E(23,ee,19,10,"div",20,S),n(25,"button",21),s("click",function(){f(e);let l=d();return _(l.addParameter())}),r(26,"+ Add parameter"),o()(),n(27,"fieldset",15)(28,"legend",16),r(29," Content "),n(30,"span",10),r(31,"*"),o(),n(32,"span",17),r(33,"Ordered list of text commands"),o()(),n(34,"p",18),r(35," Each content entry is a command. Use "),n(36,"code"),r(37,"@AgentName"),o(),r(38," to target an agent, "),n(39,"code"),r(40,"/promptName param1 param2"),o(),r(41," to call another prompt, and "),n(42,"code"),r(43),o(),r(44," for parameter placeholders. "),o(),E(45,re,8,6,"div",22,S),n(47,"button",21),s("click",function(){f(e);let l=d();return _(l.addContentEntry())}),r(48,"+ Add content entry"),o()(),u(49,oe,2,1,"p",23),n(50,"div",24)(51,"button",25),r(52),o(),n(53,"button",26),s("click",function(){f(e);let l=d();return _(l.cancel())}),r(54,"Cancel"),o()()()}if(m&2){let e=d();p("formGroup",e.form),a(6),P("prompt-form__input--invalid",e.nameControl.invalid&&e.nameControl.touched),p("formControl",e.nameControl),a(),g(e.nameControl.invalid&&e.nameControl.touched?7:-1),a(4),p("formControl",e.descriptionControl),a(),p("formArrayName","parameters"),a(8),b(e.paramPlaceholderSyntax),a(2),g(e.parametersArray.length===0?22:-1),a(),O(e.parametersArray.controls),a(4),p("formArrayName","content"),a(16),b(e.paramPlaceholderSyntax),a(2),O(e.contentArray.controls),a(4),g(e.errorMessage()?49:-1),a(2),p("disabled",e.form.invalid||e.isSubmitting()),a(),k(" ",e.isEditMode()?"Save changes":"Create"," ")}}var Q=class m{route=h(T);router=h(G);destroyRef=h(I);promptState=h(K);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new F({name:new v("",{nonNullable:!0,validators:[c.required,c.minLength(1)]}),description:new v(null),content:new N([this.createContentControl()],{validators:[c.required]}),parameters:new N([])});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get contentArray(){return this.form.controls.content}get parametersArray(){return this.form.controls.parameters}isEditMode=C(!1);isSubmitting=C(!1);isLoading=C(!1);errorMessage=C(null);paramPlaceholderSyntax="{{paramName}}";existingPrompt=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("promptId");t&&(this.isEditMode.set(!0),this.loadPrompt(t))}loadPrompt(t){this.isLoading.set(!0),this.promptState.getById(t).pipe(w(this.destroyRef)).subscribe({next:e=>{this.existingPrompt=e,this.hydrateForm(e),this.isLoading.set(!1)},error:()=>{this.isLoading.set(!1),this.navigateBack()}})}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.contentArray.clear(),(t.content.length>0?t.content:[""]).forEach(i=>this.contentArray.push(this.createContentControl(i))),this.parametersArray.clear(),(t.parameters??[]).forEach(i=>this.parametersArray.push(this.createParameterGroup(i)))}createContentControl(t=""){return new v(t,{nonNullable:!0,validators:[c.required,c.pattern(/\S/)]})}addContentEntry(){this.contentArray.push(this.createContentControl())}removeContentEntry(t){this.contentArray.length>1&&this.contentArray.removeAt(t)}createParameterGroup(t){return new F({name:new v(t?.name??"",{nonNullable:!0,validators:[c.required,c.minLength(1)]}),description:new v(t?.description??null),defaultValue:new v(t?.defaultValue??"",{nonNullable:!0,validators:[c.required]})})}addParameter(){this.parametersArray.push(this.createParameterGroup())}removeParameter(t){this.parametersArray.removeAt(t)}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(!0);let t=V(A({},this.existingPrompt??{}),{namespaceId:this.namespaceId,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,content:this.contentArray.controls.map(i=>i.value.trim()),parameters:this.parametersArray.controls.map(i=>({name:i.controls.name.value.trim(),description:i.controls.description.value?.trim()||void 0,defaultValue:i.controls.defaultValue.value.trim()}))}),e=this.isEditMode()&&this.existingPrompt?.id?this.promptState.update(this.existingPrompt.id,t):this.promptState.create(t);this.errorMessage.set(null),e.pipe(w(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:i=>{this.isSubmitting.set(!1),i.status===409?this.errorMessage.set(`A prompt named "${t.name}" already exists in this scope.`):i.status===400?this.errorMessage.set(i.error?.message??"Invalid prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.")}})}cancel(){this.navigateBack()}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","prompts"]):this.router.navigate(["/agentos",this.namespaceId,"prompts"])}static \u0275fac=function(e){return new(e||m)};static \u0275cmp=D({type:m,selectors:[["agentos-prompt-form"]],decls:10,vars:3,consts:[[1,"prompt-form"],[1,"prompt-form__header"],["type","button","title","Back to prompts",1,"prompt-form__back",3,"click"],[1,"prompt-form__back-icon"],[1,"prompt-form__title"],[1,"prompt-form__loading"],[1,"prompt-form__form",3,"formGroup"],[1,"prompt-form__form",3,"ngSubmit","formGroup"],[1,"prompt-form__field"],["for","prompt-name",1,"prompt-form__label"],["aria-hidden","true"],["id","prompt-name","type","text","placeholder","e.g. Summarise meeting notes","autocomplete","off",1,"prompt-form__input",3,"formControl"],[1,"prompt-form__field-error"],["for","prompt-description",1,"prompt-form__label"],["id","prompt-description","type","text","placeholder","Optional \u2014 short description of this prompt","autocomplete","off",1,"prompt-form__input",3,"formControl"],[1,"prompt-form__section",3,"formArrayName"],[1,"prompt-form__label"],[1,"prompt-form__label-hint"],[1,"prompt-form__section-hint"],[1,"prompt-form__empty-hint"],[1,"prompt-form__param-row",3,"formGroupName"],["type","button",1,"prompt-form__add-btn",3,"click"],[1,"prompt-form__content-row"],[1,"prompt-form__error"],[1,"prompt-form__actions"],["type","submit",1,"prompt-form__btn","prompt-form__btn--primary",3,"disabled"],["type","button",1,"prompt-form__btn",3,"click"],[1,"prompt-form__param-fields"],[1,"prompt-form__field","prompt-form__field--inline"],[1,"prompt-form__label",3,"for"],["type","text","placeholder","e.g. language","formControlName","name","autocomplete","off",1,"prompt-form__input",3,"id"],["type","text","placeholder","Optional","formControlName","description","autocomplete","off",1,"prompt-form__input",3,"id"],["type","text","placeholder","e.g. English","formControlName","defaultValue","autocomplete","off",1,"prompt-form__input",3,"id"],["type","button","title","Remove this parameter",1,"prompt-form__remove-btn",3,"click"],[1,"prompt-form__content-index"],[1,"prompt-form__content-field"],["rows","4","placeholder","Enter a command\u2026",1,"prompt-form__textarea",3,"formControlName"],["type","button","title","Remove this entry",1,"prompt-form__remove-btn",3,"click","disabled"]],template:function(e,i){e&1&&(n(0,"div",0)(1,"header",1)(2,"button",2),s("click",function(){return i.cancel()}),n(3,"span",3),r(4,"\u2190"),o(),r(5),o(),n(6,"h1",4),r(7),o()(),u(8,W,2,0,"p",5)(9,ne,55,14,"form",6),o()),e&2&&(a(5),k(" ",i.isPlatformMode?"Platform prompts":"Prompts"," "),a(2),b(i.isEditMode()?"Edit prompt":"New prompt"),a(),g(i.isLoading()?8:9))},dependencies:[J,L,z,$,R,B,H,j,q,U],styles:[".prompt-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.prompt-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.prompt-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.prompt-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.prompt-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.prompt-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.prompt-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.prompt-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.prompt-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.prompt-form__field--inline[_ngcontent-%COMP%]{flex:1}.prompt-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text, #1d1d1f)}.prompt-form__label-hint[_ngcontent-%COMP%]{font-weight:400;color:var(--color-text-secondary, #6e6e73);margin-left:.375rem}.prompt-form__input[_ngcontent-%COMP%], .prompt-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.prompt-form__input[_ngcontent-%COMP%]:focus, .prompt-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.prompt-form__input[_ngcontent-%COMP%]::placeholder, .prompt-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.prompt-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:100px;line-height:1.5}.prompt-form__section[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:8px;padding:1rem;margin:0;display:flex;flex-direction:column;gap:.75rem}.prompt-form__section-hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.prompt-form__empty-hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary, #6e6e73);font-style:italic}.prompt-form__content-row[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:flex-start}.prompt-form__content-field[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.25rem}.prompt-form__content-index[_ngcontent-%COMP%]{flex-shrink:0;width:1.5rem;padding-top:.6rem;font-size:.8rem;font-weight:600;color:var(--color-text-secondary, #6e6e73);text-align:right;-webkit-user-select:none;user-select:none}.prompt-form__param-row[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:flex-end;padding:.75rem;border-radius:6px;background:var(--color-surface-hover, rgba(0, 0, 0, .03))}.prompt-form__param-fields[_ngcontent-%COMP%]{flex:1;display:flex;gap:.75rem;flex-wrap:wrap}.prompt-form__add-btn[_ngcontent-%COMP%]{align-self:flex-start;padding:.4rem .875rem;border-radius:6px;border:1px dashed var(--color-border, rgba(0, 0, 0, .15));background:transparent;color:var(--color-primary, #007aff);font-size:.875rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.prompt-form__add-btn[_ngcontent-%COMP%]:hover{background:var(--color-surface-hover, rgba(0, 0, 0, .04));border-color:var(--color-primary, #007aff)}.prompt-form__remove-btn[_ngcontent-%COMP%]{flex-shrink:0;width:1.75rem;height:1.75rem;display:flex;align-items:center;justify-content:center;border-radius:50%;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text-secondary, #6e6e73);font-size:1rem;line-height:1;cursor:pointer;transition:background .15s ease,color .15s ease,border-color .15s ease}.prompt-form__remove-btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-error-light, rgba(255, 59, 48, .08));color:var(--color-error, #ff3b30);border-color:var(--color-error, #ff3b30)}.prompt-form__remove-btn[_ngcontent-%COMP%]:disabled{opacity:.3;cursor:not-allowed}.prompt-form__error[_ngcontent-%COMP%]{margin:0;padding:.625rem .875rem;border-radius:8px;background:var(--color-error-light, rgba(255, 59, 48, .08));border:1px solid var(--color-error, #ff3b30);color:var(--color-error, #ff3b30);font-size:.875rem;line-height:1.4}.prompt-form__field-error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30);line-height:1.3}.prompt-form__input--invalid[_ngcontent-%COMP%], .prompt-form__textarea--invalid[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30)}.prompt-form__input--invalid[_ngcontent-%COMP%]:focus, .prompt-form__textarea--invalid[_ngcontent-%COMP%]:focus{border-color:var(--color-error, #ff3b30)}.prompt-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.prompt-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.prompt-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.prompt-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.prompt-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.prompt-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"],changeDetection:0})};export{Q as PromptFormComponent};
@@ -1 +1 @@
1
- import{a as G}from"./chunk-AIC4U2MU.js";import{a as V}from"./chunk-GN5OSMEB.js";import{a as B}from"./chunk-7FKWFZ3A.js";import{a as K}from"./chunk-TPQSKNWC.js";import"./chunk-U5L2OULZ.js";import"./chunk-R6R7XD7M.js";import"./chunk-QVQF6CQG.js";import{a as D,c as $}from"./chunk-P4GNUQZT.js";import{r as P,x as L}from"./chunk-K7JRH3HO.js";import"./chunk-EBAEYY2S.js";import"./chunk-BZ7URUNM.js";import{a as c}from"./chunk-SKBT6DBT.js";import"./chunk-GF3EMWCA.js";import"./chunk-Z6RFJ6L3.js";import"./chunk-OPSHMM4H.js";import{Bb as A,Db as g,Fb as s,Jc as N,Ka as C,Pb as x,S as y,Tb as E,Ub as w,Wa as v,ab as R,bc as O,ca as r,ec as M,fc as T,ga as l,ha as m,ic as q,lb as b,m as _,ma as I,mb as S,rb as f,sb as p,t as u,ta as h,tb as d}from"./chunk-5NLXR4MK.js";var z=()=>[];function W(o,e){if(o&1&&(p(0,"p",3),E(1),d()),o&2){let t=s().$implicit;C(),w(t.name)}}function U(o,e){if(o&1){let t=A();p(0,"agentos-integration-config-item",5),g("editRequested",function(){let i=l(t),a=s(2);return m(a.onEdit(i))})("deleteRequested",function(){let i=l(t),a=s(2);return m(a.onDelete(i))})("duplicateRequested",function(){let i=l(t),a=s(2);return m(a.onDuplicate(i))}),d()}if(o&2){let t=e,n=s(2);f("config",t.config)("scope",t.scope)("readOnly",t.scope==="platform"||t.scope==="namespace"&&!n.isAdmin())}}function X(o,e){if(o&1&&b(0,W,2,1,"p",3)(1,U,1,3,"agentos-integration-config-item",4),o&2){let t,n=e.$implicit,i=s();S(i.isEmptyPlaceholder(n.id)?0:(t=i.resolve(n.id))?1:-1,t)}}var k=Object.freeze({platform:"Configurations plateforme",namespace:"Configurations du namespace",userOnNs:"Mes overrides sur ce namespace",userGlobal:"Mes overrides globaux"}),F="__empty__",j=class o{route=r(D);router=r($);destroyRef=r(I);state=r(V);namespaceRole=r(K);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=h(!1);listItems$=this.state.vm$.pipe(u(e=>this.toListItems(e)));resolved=new Map;ngOnInit(){this.route.paramMap.pipe(c(this.destroyRef)).subscribe(e=>{let t=e.get("namespaceId")??"";t&&t!==this.namespaceId&&(this.namespaceId=t),this.state.setNamespace(t)}),this.route.paramMap.pipe(u(e=>e.get("namespaceId")??""),y(e=>e?this.namespaceRole.isAdminOfNamespace$(e):_(!1)),c(this.destroyRef)).subscribe(e=>this.isAdmin.set(e)),this.state.vm$.pipe(c(this.destroyRef)).subscribe(e=>{let t=new Map;e.platform.forEach(n=>{n.id&&t.set(this.itemKey("platform",n.id),{config:n,scope:"platform"})}),e.namespace.forEach(n=>{n.id&&t.set(this.itemKey("namespace",n.id),{config:n,scope:"namespace"})}),e.userOnNs.forEach(n=>{n.id&&t.set(this.itemKey("userOnNs",n.id),{config:n,scope:"userOnNs"})}),e.userGlobal.forEach(n=>{n.id&&t.set(this.itemKey("userGlobal",n.id),{config:n,scope:"userGlobal"})}),this.resolved=t})}isEmptyPlaceholder(e){return e.startsWith(F)}resolve(e){return this.resolved.get(e)??null}itemKey(e,t){return`${e}:${t}`}goBack(){this.router.navigate(["/agentos","namespaces"])}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"integrations","new"],{queryParams:{scope:G(this.isAdmin())}})}onEdit(e){let t=e.config.id??"";this.router.navigate(["/agentos",this.namespaceId,"integrations",t,"edit"],{queryParams:{scope:e.scope}})}onDelete(e){let t=e.config.id;t&&this.state.delete(t,e.scope).pipe(c(this.destroyRef)).subscribe({error:n=>{console.error(`[IntegrationsAllScopes] Delete failed for ${e.scope}:${t}:`,n)}})}onDuplicate(e){if(!e.config.id)return;let n=(e.scope==="namespace"||e.scope==="platform")&&!this.isAdmin()?"userOnNs":e.scope;this.router.navigate(["/agentos",this.namespaceId,"integrations","new"],{queryParams:{scope:n,template:e.config.id,templateScope:e.scope}})}toListItems(e){let t=[];return t.push(...this.sectionItems("platform",e.platform)),t.push(...this.sectionItems("namespace",e.namespace)),t.push(...this.sectionItems("userOnNs",e.userOnNs)),t.push(...this.sectionItems("userGlobal",e.userGlobal)),t}sectionItems(e,t){return t.length===0?[{id:`${F}${e}`,name:"Aucune configuration",groupKey:e,groupLabel:k[e]}]:t.filter(n=>!!n.id).map(n=>({id:this.itemKey(e,n.id),name:n.name,description:n.integrationType,groupKey:e,groupLabel:k[e]}))}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=v({type:o,selectors:[["agentos-integrations-all-scopes"]],decls:5,vars:6,consts:[["integrationItemTpl",""],["title","Integrations","emptyMessage","No integrations available.","cardMinWidth","400px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[1,"integrations-all-scopes__empty"],[3,"config","scope","readOnly"],[3,"editRequested","deleteRequested","duplicateRequested","config","scope","readOnly"]],template:function(t,n){if(t&1&&(p(0,"ds-entity-list",1),M(1,"async"),g("createRequested",function(){return n.openCreateForm()}),p(2,"ds-icon-button",2),g("action",function(){return n.goBack()}),d()(),R(3,X,2,1,"ng-template",null,0,q)),t&2){let i=x(4);f("items",T(1,3,n.listItems$)??O(5,z))("showCreate",!0)("itemTemplate",i)}},dependencies:[L,B,P,N],styles:[".integrations-all-scopes__empty[_ngcontent-%COMP%]{margin:0;padding:.65rem 1rem;font-size:.85rem;font-style:italic;color:var(--color-text-secondary)}"],changeDetection:0})};export{j as IntegrationsAllScopesComponent};
1
+ import{a as G}from"./chunk-AIC4U2MU.js";import{a as V}from"./chunk-IBXOOQSH.js";import{a as B}from"./chunk-7FKWFZ3A.js";import{a as K}from"./chunk-UA3NMJET.js";import"./chunk-U5L2OULZ.js";import"./chunk-QVDTMVXQ.js";import"./chunk-DIH267SI.js";import{a as D,c as $}from"./chunk-P4GNUQZT.js";import{r as P,x as L}from"./chunk-K7JRH3HO.js";import"./chunk-EBAEYY2S.js";import"./chunk-BZ7URUNM.js";import{a as c}from"./chunk-SKBT6DBT.js";import"./chunk-GF3EMWCA.js";import"./chunk-Z6RFJ6L3.js";import"./chunk-OPSHMM4H.js";import{Bb as A,Db as g,Fb as s,Jc as N,Ka as C,Pb as x,S as y,Tb as E,Ub as w,Wa as v,ab as R,bc as O,ca as r,ec as M,fc as T,ga as l,ha as m,ic as q,lb as b,m as _,ma as I,mb as S,rb as f,sb as p,t as u,ta as h,tb as d}from"./chunk-5NLXR4MK.js";var z=()=>[];function W(o,e){if(o&1&&(p(0,"p",3),E(1),d()),o&2){let t=s().$implicit;C(),w(t.name)}}function U(o,e){if(o&1){let t=A();p(0,"agentos-integration-config-item",5),g("editRequested",function(){let i=l(t),a=s(2);return m(a.onEdit(i))})("deleteRequested",function(){let i=l(t),a=s(2);return m(a.onDelete(i))})("duplicateRequested",function(){let i=l(t),a=s(2);return m(a.onDuplicate(i))}),d()}if(o&2){let t=e,n=s(2);f("config",t.config)("scope",t.scope)("readOnly",t.scope==="platform"||t.scope==="namespace"&&!n.isAdmin())}}function X(o,e){if(o&1&&b(0,W,2,1,"p",3)(1,U,1,3,"agentos-integration-config-item",4),o&2){let t,n=e.$implicit,i=s();S(i.isEmptyPlaceholder(n.id)?0:(t=i.resolve(n.id))?1:-1,t)}}var k=Object.freeze({platform:"Configurations plateforme",namespace:"Configurations du namespace",userOnNs:"Mes overrides sur ce namespace",userGlobal:"Mes overrides globaux"}),F="__empty__",j=class o{route=r(D);router=r($);destroyRef=r(I);state=r(V);namespaceRole=r(K);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=h(!1);listItems$=this.state.vm$.pipe(u(e=>this.toListItems(e)));resolved=new Map;ngOnInit(){this.route.paramMap.pipe(c(this.destroyRef)).subscribe(e=>{let t=e.get("namespaceId")??"";t&&t!==this.namespaceId&&(this.namespaceId=t),this.state.setNamespace(t)}),this.route.paramMap.pipe(u(e=>e.get("namespaceId")??""),y(e=>e?this.namespaceRole.isAdminOfNamespace$(e):_(!1)),c(this.destroyRef)).subscribe(e=>this.isAdmin.set(e)),this.state.vm$.pipe(c(this.destroyRef)).subscribe(e=>{let t=new Map;e.platform.forEach(n=>{n.id&&t.set(this.itemKey("platform",n.id),{config:n,scope:"platform"})}),e.namespace.forEach(n=>{n.id&&t.set(this.itemKey("namespace",n.id),{config:n,scope:"namespace"})}),e.userOnNs.forEach(n=>{n.id&&t.set(this.itemKey("userOnNs",n.id),{config:n,scope:"userOnNs"})}),e.userGlobal.forEach(n=>{n.id&&t.set(this.itemKey("userGlobal",n.id),{config:n,scope:"userGlobal"})}),this.resolved=t})}isEmptyPlaceholder(e){return e.startsWith(F)}resolve(e){return this.resolved.get(e)??null}itemKey(e,t){return`${e}:${t}`}goBack(){this.router.navigate(["/agentos","namespaces"])}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"integrations","new"],{queryParams:{scope:G(this.isAdmin())}})}onEdit(e){let t=e.config.id??"";this.router.navigate(["/agentos",this.namespaceId,"integrations",t,"edit"],{queryParams:{scope:e.scope}})}onDelete(e){let t=e.config.id;t&&this.state.delete(t,e.scope).pipe(c(this.destroyRef)).subscribe({error:n=>{console.error(`[IntegrationsAllScopes] Delete failed for ${e.scope}:${t}:`,n)}})}onDuplicate(e){if(!e.config.id)return;let n=(e.scope==="namespace"||e.scope==="platform")&&!this.isAdmin()?"userOnNs":e.scope;this.router.navigate(["/agentos",this.namespaceId,"integrations","new"],{queryParams:{scope:n,template:e.config.id,templateScope:e.scope}})}toListItems(e){let t=[];return t.push(...this.sectionItems("platform",e.platform)),t.push(...this.sectionItems("namespace",e.namespace)),t.push(...this.sectionItems("userOnNs",e.userOnNs)),t.push(...this.sectionItems("userGlobal",e.userGlobal)),t}sectionItems(e,t){return t.length===0?[{id:`${F}${e}`,name:"Aucune configuration",groupKey:e,groupLabel:k[e]}]:t.filter(n=>!!n.id).map(n=>({id:this.itemKey(e,n.id),name:n.name,description:n.integrationType,groupKey:e,groupLabel:k[e]}))}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=v({type:o,selectors:[["agentos-integrations-all-scopes"]],decls:5,vars:6,consts:[["integrationItemTpl",""],["title","Integrations","emptyMessage","No integrations available.","cardMinWidth","400px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[1,"integrations-all-scopes__empty"],[3,"config","scope","readOnly"],[3,"editRequested","deleteRequested","duplicateRequested","config","scope","readOnly"]],template:function(t,n){if(t&1&&(p(0,"ds-entity-list",1),M(1,"async"),g("createRequested",function(){return n.openCreateForm()}),p(2,"ds-icon-button",2),g("action",function(){return n.goBack()}),d()(),R(3,X,2,1,"ng-template",null,0,q)),t&2){let i=x(4);f("items",T(1,3,n.listItems$)??O(5,z))("showCreate",!0)("itemTemplate",i)}},dependencies:[L,B,P,N],styles:[".integrations-all-scopes__empty[_ngcontent-%COMP%]{margin:0;padding:.65rem 1rem;font-size:.85rem;font-style:italic;color:var(--color-text-secondary)}"],changeDetection:0})};export{j as IntegrationsAllScopesComponent};
@@ -1 +1 @@
1
- import{a as k}from"./chunk-IDD4RLL7.js";import{a as S}from"./chunk-R6R7XD7M.js";import{c as M}from"./chunk-7EHCV7WH.js";import{b as C,c as x}from"./chunk-P4GNUQZT.js";import{Db as c,Fb as v,Ka as _,Tb as u,Vb as T,Wa as m,ca as p,lb as b,lc as d,mb as f,rb as y,sb as r,ta as h,tb as a,ub as s}from"./chunk-5NLXR4MK.js";function w(o,e){if(o&1&&u(0),o&2){let t=v();T(" ",t.userInitials()," ")}}function N(o,e){o&1&&u(0," \u2022\u2022\u2022 ")}var g=class o{router=p(x);userState=p(S);themePort=p(M);menuOpen=h(!1);isAdmin=d(()=>this.userState.currentUser()?.isAdmin===!0);isDark=d(()=>{let e=this.themePort.theme();return e==="dark"?!0:e==="light"?!1:typeof document<"u"&&document.documentElement.hasAttribute("data-theme")});userInitials=d(()=>{let e=this.userState.currentUser();if(!e)return"";let t=e.firstname?.[0]??"",n=e.lastname?.[0]??"";return(t+n).toUpperCase()||e.email?.[0]?.toUpperCase()||""});showTechnical=h(!1);navigateHome(){this.router.navigate(["/agentos/home"])}toggleMenu(e){e.stopPropagation(),this.menuOpen.update(t=>!t)}closeMenu(e){e.stopPropagation(),this.menuOpen.set(!1)}onNavigate(e){this.menuOpen.set(!1),this.router.navigate([e])}onThemeToggle(){this.menuOpen.set(!1);let e=this.isDark()?"light":"dark";this.themePort.setTheme(e)}onLogsToggle(){this.menuOpen.set(!1)}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=m({type:o,selectors:[["agentos-shell-topbar"]],decls:10,vars:5,consts:[[1,"shell-topbar"],["type","button","title","Home",1,"shell-topbar__brand",3,"click"],["src","CODAY-Logo.png","alt","Coday",1,"shell-topbar__logo-img"],[1,"shell-topbar__logo-text"],[1,"shell-topbar__user-menu"],["type","button","title","Menu",1,"shell-topbar__user-btn",3,"click"],["variant","desktop",3,"navigateTo","themeToggled","logsToggled","closed","open","isAdmin","isDark","showTechnical"]],template:function(t,n){t&1&&(r(0,"div",0)(1,"button",1),c("click",function(){return n.navigateHome()}),s(2,"img",2),r(3,"span",3),u(4,"Coday"),a()(),r(5,"div",4)(6,"button",5),c("click",function(l){return n.toggleMenu(l)}),b(7,w,1,1)(8,N,1,0),a(),r(9,"agentos-shell-user-menu",6),c("navigateTo",function(l){return n.onNavigate(l)})("themeToggled",function(){return n.onThemeToggle()})("logsToggled",function(){return n.onLogsToggle()})("closed",function(l){return n.closeMenu(l)}),a()()()),t&2&&(_(7),f(n.userInitials()?7:8),_(2),y("open",n.menuOpen())("isAdmin",n.isAdmin())("isDark",n.isDark())("showTechnical",n.showTechnical()))},dependencies:[k],styles:[".shell-topbar[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:14px 12px;border-bottom:1px solid var(--color-border, rgba(0, 0, 0, .09));background:var(--color-bg-secondary, rgba(255, 255, 255, .7));flex-shrink:0}.shell-topbar__brand[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;padding:4px 6px;border-radius:8px;border:none;background:transparent;cursor:pointer;transition:background .14s}.shell-topbar__brand[_ngcontent-%COMP%]:hover{background:var(--color-surface-hover, rgba(0, 0, 0, .05))}.shell-topbar__logo-img[_ngcontent-%COMP%]{width:32px;height:32px;border-radius:6px;object-fit:contain}.shell-topbar__logo-text[_ngcontent-%COMP%]{font-size:1rem;font-weight:700;color:var(--color-text);white-space:nowrap;letter-spacing:-.01em}.shell-topbar__user-menu[_ngcontent-%COMP%]{position:relative;flex-shrink:0}.shell-topbar__user-btn[_ngcontent-%COMP%]{width:32px;height:32px;border-radius:8px;border:none;background:var(--color-primary, #016b71);color:#fff;cursor:pointer;display:grid;place-items:center;font-size:.7rem;font-weight:700;letter-spacing:.02em;transition:background .14s}.shell-topbar__user-btn[_ngcontent-%COMP%]:hover{background:var(--color-primary-hover, #015a5f)}"],changeDetection:0})};var O=class o{static \u0275fac=function(t){return new(t||o)};static \u0275cmp=m({type:o,selectors:[["agentos-layout"]],decls:4,vars:0,consts:[[1,"layout"],[1,"layout__content"]],template:function(t,n){t&1&&(r(0,"div",0),s(1,"agentos-shell-topbar"),r(2,"main",1),s(3,"router-outlet"),a()())},dependencies:[C,g],styles:[".layout[_ngcontent-%COMP%]{display:flex;flex-direction:column;min-height:100vh}.layout__content[_ngcontent-%COMP%]{flex:1;overflow-y:auto}"]})};export{O as a};
1
+ import{a as k}from"./chunk-IDD4RLL7.js";import{a as S}from"./chunk-QVDTMVXQ.js";import{c as M}from"./chunk-7EHCV7WH.js";import{b as C,c as x}from"./chunk-P4GNUQZT.js";import{Db as c,Fb as v,Ka as _,Tb as u,Vb as T,Wa as m,ca as p,lb as b,lc as d,mb as f,rb as y,sb as r,ta as h,tb as a,ub as s}from"./chunk-5NLXR4MK.js";function w(o,e){if(o&1&&u(0),o&2){let t=v();T(" ",t.userInitials()," ")}}function N(o,e){o&1&&u(0," \u2022\u2022\u2022 ")}var g=class o{router=p(x);userState=p(S);themePort=p(M);menuOpen=h(!1);isAdmin=d(()=>this.userState.currentUser()?.isAdmin===!0);isDark=d(()=>{let e=this.themePort.theme();return e==="dark"?!0:e==="light"?!1:typeof document<"u"&&document.documentElement.hasAttribute("data-theme")});userInitials=d(()=>{let e=this.userState.currentUser();if(!e)return"";let t=e.firstname?.[0]??"",n=e.lastname?.[0]??"";return(t+n).toUpperCase()||e.email?.[0]?.toUpperCase()||""});showTechnical=h(!1);navigateHome(){this.router.navigate(["/agentos/home"])}toggleMenu(e){e.stopPropagation(),this.menuOpen.update(t=>!t)}closeMenu(e){e.stopPropagation(),this.menuOpen.set(!1)}onNavigate(e){this.menuOpen.set(!1),this.router.navigate([e])}onThemeToggle(){this.menuOpen.set(!1);let e=this.isDark()?"light":"dark";this.themePort.setTheme(e)}onLogsToggle(){this.menuOpen.set(!1)}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=m({type:o,selectors:[["agentos-shell-topbar"]],decls:10,vars:5,consts:[[1,"shell-topbar"],["type","button","title","Home",1,"shell-topbar__brand",3,"click"],["src","CODAY-Logo.png","alt","Coday",1,"shell-topbar__logo-img"],[1,"shell-topbar__logo-text"],[1,"shell-topbar__user-menu"],["type","button","title","Menu",1,"shell-topbar__user-btn",3,"click"],["variant","desktop",3,"navigateTo","themeToggled","logsToggled","closed","open","isAdmin","isDark","showTechnical"]],template:function(t,n){t&1&&(r(0,"div",0)(1,"button",1),c("click",function(){return n.navigateHome()}),s(2,"img",2),r(3,"span",3),u(4,"Coday"),a()(),r(5,"div",4)(6,"button",5),c("click",function(l){return n.toggleMenu(l)}),b(7,w,1,1)(8,N,1,0),a(),r(9,"agentos-shell-user-menu",6),c("navigateTo",function(l){return n.onNavigate(l)})("themeToggled",function(){return n.onThemeToggle()})("logsToggled",function(){return n.onLogsToggle()})("closed",function(l){return n.closeMenu(l)}),a()()()),t&2&&(_(7),f(n.userInitials()?7:8),_(2),y("open",n.menuOpen())("isAdmin",n.isAdmin())("isDark",n.isDark())("showTechnical",n.showTechnical()))},dependencies:[k],styles:[".shell-topbar[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:14px 12px;border-bottom:1px solid var(--color-border, rgba(0, 0, 0, .09));background:var(--color-bg-secondary, rgba(255, 255, 255, .7));flex-shrink:0}.shell-topbar__brand[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;padding:4px 6px;border-radius:8px;border:none;background:transparent;cursor:pointer;transition:background .14s}.shell-topbar__brand[_ngcontent-%COMP%]:hover{background:var(--color-surface-hover, rgba(0, 0, 0, .05))}.shell-topbar__logo-img[_ngcontent-%COMP%]{width:32px;height:32px;border-radius:6px;object-fit:contain}.shell-topbar__logo-text[_ngcontent-%COMP%]{font-size:1rem;font-weight:700;color:var(--color-text);white-space:nowrap;letter-spacing:-.01em}.shell-topbar__user-menu[_ngcontent-%COMP%]{position:relative;flex-shrink:0}.shell-topbar__user-btn[_ngcontent-%COMP%]{width:32px;height:32px;border-radius:8px;border:none;background:var(--color-primary, #016b71);color:#fff;cursor:pointer;display:grid;place-items:center;font-size:.7rem;font-weight:700;letter-spacing:.02em;transition:background .14s}.shell-topbar__user-btn[_ngcontent-%COMP%]:hover{background:var(--color-primary-hover, #015a5f)}"],changeDetection:0})};var O=class o{static \u0275fac=function(t){return new(t||o)};static \u0275cmp=m({type:o,selectors:[["agentos-layout"]],decls:4,vars:0,consts:[[1,"layout"],[1,"layout__content"]],template:function(t,n){t&1&&(r(0,"div",0),s(1,"agentos-shell-topbar"),r(2,"main",1),s(3,"router-outlet"),a()())},dependencies:[C,g],styles:[".layout[_ngcontent-%COMP%]{display:flex;flex-direction:column;min-height:100vh}.layout__content[_ngcontent-%COMP%]{flex:1;overflow-y:auto}"]})};export{O as a};