@whoz-oss/coday-client 3.16.0 → 3.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/chunk--yaU4Sri.js +1 -0
- package/browser/{chunk-kvCfAm7Z.js → chunk-4uEZjTft.js} +1 -1
- package/browser/chunk-4v7WiOTx.js +1 -0
- package/browser/chunk-B-UKlpjJ.js +1 -0
- package/browser/chunk-B13_C_P9.js +675 -0
- package/browser/chunk-B17Inq8D.js +2 -0
- package/browser/chunk-B1vuv-dv.js +1 -0
- package/browser/{chunk-Bhq5earA.js → chunk-BEdQqXxw.js} +1 -1
- package/browser/{chunk-B_9LxHBv.js → chunk-BGTRsbsl.js} +1 -1
- package/browser/{chunk-pH1k_bet.js → chunk-BHiaH1Jm.js} +1 -1
- package/browser/chunk-BJld3zB5.js +9 -0
- package/browser/{chunk-7jUQT_3F.js → chunk-BVmICoo4.js} +1 -1
- package/browser/chunk-BXCHG0wB.js +1 -0
- package/browser/{chunk-DOq0u21j.js → chunk-B_Sx6nwb.js} +1 -1
- package/browser/{chunk-CXLytVC3.js → chunk-BbPMe8u2.js} +1 -1
- package/browser/{chunk-6gdeYlLc.js → chunk-Bb_J3EoX.js} +1 -1
- package/browser/chunk-BfE6wTUj.js +1 -0
- package/browser/chunk-Bnj9Hkqy.js +276 -0
- package/browser/chunk-BqWEyotW.js +55 -0
- package/browser/{chunk-Dcftf7UY.js → chunk-Buu9Jf-V.js} +2 -2
- package/browser/{chunk-0OiZWE88.js → chunk-CJAdjOmi.js} +1 -1
- package/browser/{chunk-Bn3R3VC2.js → chunk-CJEW8Ogd.js} +5 -5
- package/browser/chunk-CM1_Z4h5.js +1 -0
- package/browser/{chunk-BTS5TBK0.js → chunk-CP3b1EMm.js} +1 -1
- package/browser/chunk-CR817PBg.js +1 -0
- package/browser/{chunk-YfG457Nc.js → chunk-CXgj_KJY.js} +3 -3
- package/browser/{chunk-CYulIMKp.js → chunk-CakkML6n.js} +1 -1
- package/browser/{chunk-DQLU3kYb.js → chunk-CfPmQ0Fw.js} +1 -1
- package/browser/chunk-CgNkwpQ7.js +508 -0
- package/browser/chunk-Cjk-zAXy.js +1 -0
- package/browser/chunk-ClCDsg8D.js +5 -0
- package/browser/{chunk-BdpJ2ZCM.js → chunk-CmyT-Z4A.js} +1 -1
- package/browser/{chunk-C_s4Z3Dk.js → chunk-CqJ7rGVY.js} +1 -1
- package/browser/{chunk-SbH2L3h2.js → chunk-CxpHnwnx.js} +1 -1
- package/browser/{chunk-CtWMrBfw.js → chunk-D1ZnLng-.js} +1 -1
- package/browser/{chunk-swj7IkJA.js → chunk-D26Y186i.js} +1 -1
- package/browser/chunk-D2zGvbD2.js +190 -0
- package/browser/{chunk-IUvEtpfr.js → chunk-D30bRRTP.js} +1 -1
- package/browser/{chunk-CTuHnJP4.js → chunk-D4dmZgr6.js} +1 -1
- package/browser/{chunk-CiWu4t_i.js → chunk-D6nkbOg1.js} +1 -1
- package/browser/chunk-D8nXP3jN.js +2 -0
- package/browser/{chunk-BNS6Fgaw.js → chunk-D92adUD_.js} +1 -1
- package/browser/{chunk-Bib1Seeu.js → chunk-DDu5Ufv3.js} +1 -1
- package/browser/{chunk-HjD5Rk4C.js → chunk-DFjZf9oL.js} +3 -3
- package/browser/{chunk-B0vRsgnD.js → chunk-DJjbZAaS.js} +1 -1
- package/browser/{chunk-CgqDTJ5-.js → chunk-DKQvH1hP.js} +1 -1
- package/browser/{chunk-UzUd84Qf.js → chunk-DMUiJ7oP.js} +1 -1
- package/browser/chunk-DMyGIjcZ.js +1 -0
- package/browser/chunk-DOHvMo5p.js +1 -0
- package/browser/{chunk-CbK5Lcu9.js → chunk-DVTNoWCQ.js} +1 -1
- package/browser/chunk-DV_7IOl_.js +1 -0
- package/browser/chunk-DaoWXYMw.js +1 -0
- package/browser/{chunk-jv0lz5Ah.js → chunk-DmaEv05C.js} +1 -1
- package/browser/{chunk-BSSDDOqW.js → chunk-DoqL_RuM.js} +2 -2
- package/browser/chunk-FMHkoXwM.js +37 -0
- package/browser/{chunk-axGY7UtD.js → chunk-Fr6-w83-.js} +1 -1
- package/browser/{chunk-iNIQR015.js → chunk-HHPhxe9B.js} +1 -1
- package/browser/{chunk-fhFxOLYS.js → chunk-IYMfBoNU.js} +1 -1
- package/browser/chunk-PQu4_Hy2.js +2 -0
- package/browser/chunk-Qpb04pBJ.js +1 -0
- package/browser/{chunk-CBNhmZDS.js → chunk-W5DNK5PC.js} +1 -1
- package/browser/{chunk-BHZY3TvC.js → chunk-WSA7xa0h.js} +5 -5
- package/browser/{chunk-BJYyjaQ6.js → chunk-lX2E6ugr.js} +1 -1
- package/browser/{chunk-CGMAzvSo.js → chunk-o2LY9dfG.js} +1 -1
- package/browser/{chunk-DzlrRiVM.js → chunk-py_Q_oQH.js} +1 -1
- package/browser/{chunk-BUJoEGsf.js → chunk-t87lD8bQ.js} +1 -1
- package/browser/{chunk-Be1LOFvg.js → chunk-vL7dLM7S.js} +1 -1
- package/browser/{chunk-Co81dkbz.js → chunk-zvR-rokl.js} +1 -1
- package/browser/index.html +1 -1
- package/browser/main-YYHD6X7H.js +1811 -0
- package/package.json +1 -1
- package/browser/chunk-BEKR4Un_.js +0 -1
- package/browser/chunk-BEUXx3TO.js +0 -1
- package/browser/chunk-BJeLQooO.js +0 -1
- package/browser/chunk-BY7uKZAo.js +0 -9
- package/browser/chunk-BdApeECy.js +0 -1
- package/browser/chunk-C-aF2_1R.js +0 -55
- package/browser/chunk-CFZbDe5T.js +0 -5
- package/browser/chunk-CPBcDx4G.js +0 -1
- package/browser/chunk-Ci1jk71f.js +0 -276
- package/browser/chunk-CjrWXBiR.js +0 -2
- package/browser/chunk-CtkiOUdU.js +0 -675
- package/browser/chunk-CwaAd8kk.js +0 -1
- package/browser/chunk-DDnWPYAA.js +0 -2
- package/browser/chunk-Dfujxxcr.js +0 -1
- package/browser/chunk-DgrvmqY2.js +0 -2
- package/browser/chunk-DoKoAMs6.js +0 -1
- package/browser/chunk-Dtu-PLbq.js +0 -1
- package/browser/chunk-S8F5_Te_.js +0 -508
- package/browser/chunk-YS-vAhPY.js +0 -190
- package/browser/chunk-fYErSEXN.js +0 -1
- package/browser/chunk-gmPqDrDS.js +0 -1
- package/browser/chunk-izARvh_2.js +0 -1
- package/browser/chunk-rwEyLSEP.js +0 -1
- package/browser/chunk-tTmeIHGS.js +0 -37
- package/browser/main-5PAOSHSM.js +0 -1811
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {n as ne}from'./chunk-Buu9Jf-V.js';import {g,X as z$1,Y as Ue,j as jw,Z as zt,a0 as jt,a1 as Vt,a2 as Nt,h as hr,e as pr,k as Cs,J as JC,m as hl,o as aC,n as kg,t as sI,w as zg,a5 as Dl,a8 as Kg,u as cC,_ as _g,a9 as vC,ai as rm,aa as Cf,ac as CC,aj as iT,ab as Tf,a3 as ZI,ak as nm,a6 as QI}from'./main-YYHD6X7H.js';import {y as yt,w as wt,t as ti,Z as Zn,c as cn}from'./chunk-FMHkoXwM.js';function G(c,p){if(c&1){let t=vC();Cs(0,"mat-checkbox",5),rm("ngModelChange",function(l){Cf(t);let f=CC();return iT(f.checkboxChecked,l)||(f.checkboxChecked=l),Tf(l)}),JC(1),hl(),ZI();}if(c&2){let t=CC();nm("ngModel",t.checkboxChecked),QI(),sI(),Kg(t.data.checkboxLabel);}}var z=class c{dialogRef=g(z$1);data=g(Ue);checkboxChecked=false;confirm(){this.dialogRef.close({confirmed:true,checkboxChecked:this.checkboxChecked});}cancel(){this.dialogRef.close({confirmed:false});}static \u0275fac=function(t){return new(t||c)};static \u0275cmp=jw({type:c,selectors:[["app-confirm-dialog"]],decls:13,vars:8,consts:[["mat-dialog-title",""],[3,"ngModel"],["align","end"],["mat-button","",3,"click"],["mat-flat-button","",3,"click","color"],[3,"ngModelChange","ngModel"]],template:function(t,e){t&1&&(Cs(0,"h2",0)(1,"mat-icon"),JC(2,"warning"),hl(),JC(3),hl(),Cs(4,"mat-dialog-content")(5,"p"),JC(6),hl(),aC(7,G,2,2,"mat-checkbox",1),hl(),Cs(8,"mat-dialog-actions",2)(9,"button",3),kg("click",function(){return e.cancel()}),JC(10),hl(),Cs(11,"button",4),kg("click",function(){return e.confirm()}),JC(12),hl()()),t&2&&(sI(),zg("destructive",!!e.data.isDestructive),sI(2),Dl(" ",e.data.title,`
|
|
2
|
+
`),sI(3),Kg(e.data.message),sI(),cC(e.data.checkboxLabel?7:-1),sI(3),Kg(e.data.cancelLabel??"Cancel"),sI(),_g("color",e.data.isDestructive?"warn":"primary"),sI(),Dl(" ",e.data.confirmLabel??"Confirm"," "));},dependencies:[zt,jt,Vt,Nt,hr,pr,yt,wt,ne,ti,Zn,cn],styles:["h2[mat-dialog-title][_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}h2[mat-dialog-title][_ngcontent-%COMP%] mat-icon.destructive[_ngcontent-%COMP%]{color:var(--color-error, #f44336)}mat-dialog-content[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{color:var(--color-text-secondary);line-height:1.5}mat-dialog-content[_ngcontent-%COMP%] mat-checkbox[_ngcontent-%COMP%]{display:block;margin-top:8px;font-size:.875rem}"]})};export{z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {I}from'./chunk-BEdQqXxw.js';import {m}from'./chunk-BJld3zB5.js';import {g,G,C as Ce,aJ as Tr,W as Wi,bS as Da,r as re,b as U,j as jw,aK as Lb,k as Cs,bf as gT,n as kg,m as hl,af as wg,A as AC,_ as _g,bg as yT,ah as dT,o as aC,ac as CC,u as cC,a9 as vC,aa as Cf,ab as Tf,ag as ET}from'./main-YYHD6X7H.js';import {W as Wn,S as Se}from'./chunk-B13_C_P9.js';import'./chunk-CgNkwpQ7.js';import'./chunk-FMHkoXwM.js';import'./chunk-4uEZjTft.js';var F=()=>[];function N(o,e){if(o&1){let t=vC();Cs(0,"agentos-prompt-item",4),kg("deleteRequested",function(n){Cf(t);let E=CC(2);return Tf(E.deletePrompt(n))}),hl();}o&2&&_g("prompt",e)("platformMode",true);}function V(o,e){if(o&1&&aC(0,N,1,2,"agentos-prompt-item",3),o&2){let t,r=e.$implicit,n=CC();cC((t=n.resolvePrompt(r.id))?0:-1,t);}}var q=class o{router=g(G);destroyRef=g(Ce);promptState=g(m);refresh$=new Tr(void 0);isLoading=Wi(true);prompts$=this.refresh$.pipe(Da(()=>(this.isLoading.set(true),this.promptState.listPlatform())));promptItems$=this.prompts$.pipe(re(e=>e.map(t=>({id:t.id??"",name:t.name,description:t.description}))));promptsById=new Map;constructor(){this.prompts$.pipe(U(this.destroyRef)).subscribe({next:e=>{this.promptsById=new Map(e.map(t=>[t.id??"",t])),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}goBack(){this.router.navigate(["/agentos","admin"]);}openCreateForm(){this.router.navigate(["/agentos","admin","prompts","new"]);}deletePrompt(e){this.promptState.delete(e.id??"").pipe(U(this.destroyRef)).subscribe(()=>this.refresh$.next());}resolvePrompt(e){return this.promptsById.get(e)??null}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=jw({type:o,selectors:[["agentos-platform-prompts"]],decls:5,vars:7,consts:[["promptItemTpl",""],["title","Platform Prompts","emptyMessage","No platform prompts defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[3,"prompt","platformMode"],[3,"deleteRequested","prompt","platformMode"]],template:function(t,r){if(t&1&&(Cs(0,"ds-entity-list",1),gT(1,"async"),kg("createRequested",function(){return r.openCreateForm()}),Cs(2,"ds-icon-button",2),kg("action",function(){return r.goBack()}),hl()(),wg(3,V,1,1,"ng-template",null,0,ET)),t&2){let n=AC(4);_g("items",yT(1,4,r.promptItems$)??dT(6,F))("loading",r.isLoading())("showCreate",true)("itemTemplate",n);}},dependencies:[Wn,I,Se,Lb],styles:[".platform-prompts__back[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.platform-prompts__back[_ngcontent-%COMP%]:hover{text-decoration:underline}"]})};export{q as PlatformPromptsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,G,cb as
|
|
1
|
+
import {g,G,cb as JB,cc as XB,W as Wi,j as jw,k as Cs,J as JC,m as hl,o as aC,w as zg,t as sI,a8 as Kg,u as cC,ac as CC,a9 as vC,n as kg,_ as _g,aa as Cf,ab as Tf}from'./main-YYHD6X7H.js';import {Z as Zn,S as Se}from'./chunk-B13_C_P9.js';function k(t,r){if(t&1&&(Cs(0,"span",3),JC(1),hl()),t&2){let e=CC();sI(),Kg(e.prompt().description);}}function S(t,r){if(t&1){let e=vC();Cs(0,"span",6),JC(1,"Delete?"),hl(),Cs(2,"ds-icon-button",7),kg("action",function(){Cf(e);let m=CC();return Tf(m.onDeleteConfirmed())}),hl(),Cs(3,"ds-icon-button",8),kg("action",function(){Cf(e);let m=CC();return Tf(m.onDeleteCancelled())}),hl();}}function E(t,r){if(t&1){let e=vC();Cs(0,"ds-kebab-menu",9),kg("itemSelected",function(m){Cf(e);let O=CC();return Tf(O.onMenuAction(m))}),hl();}if(t&2){let e=CC();_g("items",e.menuItems);}}var I=class t{router=g(G);prompt=JB.required();namespaceId=JB(void 0);platformMode=JB(false);readOnly=JB(false);deleteRequested=XB();pendingDelete=Wi(false);menuItems=[{key:"edit",label:"Edit prompt",icon:"edit"},{key:"delete",label:"Delete prompt",icon:"delete",variant:"danger"}];onMenuAction(r){switch(r){case "edit":this.platformMode()?this.router.navigate(["/agentos","admin","prompts",this.prompt().id,"edit"]):this.router.navigate(["/agentos",this.namespaceId(),"prompts",this.prompt().id,"edit"]);break;case "delete":this.pendingDelete.set(true);break}}onDeleteConfirmed(){this.pendingDelete.set(false),this.deleteRequested.emit(this.prompt());}onDeleteCancelled(){this.pendingDelete.set(false);}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=jw({type:t,selectors:[["agentos-prompt-item"]],inputs:{prompt:[1,"prompt"],namespaceId:[1,"namespaceId"],platformMode:[1,"platformMode"],readOnly:[1,"readOnly"]},outputs:{deleteRequested:"deleteRequested"},decls:8,vars:5,consts:[["role","listitem",1,"prompt-item"],[1,"prompt-item__body"],[1,"prompt-item__name"],[1,"prompt-item__description"],[1,"prompt-item__actions"],[3,"items"],[1,"prompt-item__confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel deletion",3,"action"],[3,"itemSelected","items"]],template:function(e,o){e&1&&(Cs(0,"div",0)(1,"div",1)(2,"span",2),JC(3),hl(),aC(4,k,2,1,"span",3),hl(),Cs(5,"div",4),aC(6,S,4,0)(7,E,1,1,"ds-kebab-menu",5),hl()()),e&2&&(zg("prompt-item--pending-delete",o.pendingDelete()),sI(3),Kg(o.prompt().name),sI(),cC(o.prompt().description?4:-1),sI(2),cC(o.pendingDelete()?6:o.readOnly()?-1:7));},dependencies:[Zn,Se],styles:[".prompt-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem 1rem;border-radius:10px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--glass-bg, rgba(255, 255, 255, .72));-webkit-backdrop-filter:var(--glass-backdrop-blur, blur(20px));backdrop-filter:var(--glass-backdrop-blur, blur(20px));transition:background .15s ease,border-color .15s ease}.prompt-item[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .04));border-color:var(--color-primary, #007aff)}.prompt-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.prompt-item__name[_ngcontent-%COMP%]{font-size:.95rem;font-weight:500;color:var(--color-text, #1d1d1f);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.prompt-item__description[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary, #6e6e73);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.prompt-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.prompt-item[_ngcontent-%COMP%]:hover .prompt-item__actions[_ngcontent-%COMP%], .prompt-item[_ngcontent-%COMP%]:focus-within .prompt-item__actions[_ngcontent-%COMP%], .prompt-item--pending-delete[_ngcontent-%COMP%] .prompt-item__actions[_ngcontent-%COMP%]{opacity:1}.prompt-item__confirm-label[_ngcontent-%COMP%]{font-size:.8rem;font-weight:500;color:var(--color-error, #ff3b30);margin-right:.25rem;white-space:nowrap}"]})};export{I};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {I}from'./chunk-
|
|
1
|
+
import {I}from'./chunk-CxpHnwnx.js';import {g,G,C as Ce,de as B,dd as $,aJ as Tr,W as Wi,bS as Da,aD as Hy,r as re,b as U,j as jw,aK as Lb,k as Cs,bf as gT,n as kg,m as hl,af as wg,A as AC,_ as _g,bg as yT,ah as dT,o as aC,ac as CC,u as cC,a9 as vC,aa as Cf,ab as Tf,ag as ET}from'./main-YYHD6X7H.js';import {W as Wn,S as Se}from'./chunk-B13_C_P9.js';import'./chunk-CgNkwpQ7.js';import'./chunk-FMHkoXwM.js';var V=()=>[];function F(n,t){if(n&1){let o=vC();Cs(0,"agentos-ai-model-item",4),kg("editRequested",function(e){Cf(o);let s=CC(2);return Tf(s.onEdit(e))})("deleteRequested",function(e){Cf(o);let s=CC(2);return Tf(s.deleteModel(e))}),hl();}n&2&&_g("model",t);}function O(n,t){if(n&1&&aC(0,F,1,1,"agentos-ai-model-item",3),n&2){let o,i=t.$implicit,e=CC();cC((o=e.resolveModel(i.id))?0:-1,o);}}var S=class n{router=g(G);destroyRef=g(Ce);aiModelController=g(B);aiProviderController=g($);refresh$=new Tr(void 0);isLoading=Wi(true);data$=this.refresh$.pipe(Da(()=>(this.isLoading.set(true),Hy([this.aiModelController.listPlatformLevelAiModel(),this.aiProviderController.listAiProvider("none")]))));modelItems$=this.data$.pipe(re(([t,o])=>{let i=new Map(o.map(e=>[e.id??"",e.name]));return t.map(e=>({id:e.id??"",name:e.alias??e.apiModelName,description:e.apiModelName,groupKey:e.aiProviderId,groupLabel:i.get(e.aiProviderId)??e.aiProviderId}))}));modelsById=new Map;constructor(){this.data$.pipe(U(this.destroyRef)).subscribe({next:([t])=>{this.modelsById=new Map(t.map(o=>[o.id??"",o])),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}goBack(){this.router.navigate(["/agentos","admin"]);}openCreateForm(){this.router.navigate(["/agentos","admin","ai-models","new"]);}deleteModel(t){this.aiModelController.deleteAiModel(t.id??"").pipe(U(this.destroyRef)).subscribe(()=>this.refresh$.next());}onEdit(t){t.id&&this.router.navigate(["/agentos","admin","ai-models",t.id,"edit"]);}resolveModel(t){return this.modelsById.get(t)??null}static \u0275fac=function(o){return new(o||n)};static \u0275cmp=jw({type:n,selectors:[["agentos-platform-ai-models"]],decls:5,vars:7,consts:[["aiModelItemTpl",""],["title","Platform AI Models","emptyMessage","No platform AI models defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[3,"model"],[3,"editRequested","deleteRequested","model"]],template:function(o,i){if(o&1&&(Cs(0,"ds-entity-list",1),gT(1,"async"),kg("createRequested",function(){return i.openCreateForm()}),Cs(2,"ds-icon-button",2),kg("action",function(){return i.goBack()}),hl()(),wg(3,O,1,1,"ng-template",null,0,ET)),o&2){let e=AC(4);_g("items",yT(1,4,i.modelItems$)??dT(6,V))("loading",i.isLoading())("showCreate",true)("itemTemplate",e);}},dependencies:[Wn,I,Se,Lb],styles:[".platform-ai-models__back[_ngcontent-%COMP%]{background:none;border:none;cursor:pointer;font-family:inherit;font-size:.875rem;color:var(--color-text-secondary, #6e6e73);padding:.25rem .5rem;border-radius:4px;transition:color .15s ease}.platform-ai-models__back[_ngcontent-%COMP%]:hover{color:var(--color-primary, #007aff)}"]})};export{S as PlatformAiModelsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,bm as _m,R as Re,a as Gi,E as ET,h as Fw,i as hr,k as Gn,m as ws,o as Rg,Q as QC,n as hl,a3 as GI,q as oC,af as Eg,ag as mT,M as MC,t as nI,v as bg,a6 as qI,x as iC,Z as z,bl as Mt,_ as Ue$1,am as Wm,$ as zt,a0 as jt,a1 as Vt,a2 as Nt,j as pr,bn as Xt,ai as em,aj as tT,r as cC,bo as sC,a8 as Yg,ak as Jg,y as uC,a5 as Dl,ac as EC,a9 as gC,aa as wf,ab as Cf,bp as yl,bq as vl,ah as aT,b4 as cT,A as Ug}from'./main-5PAOSHSM.js';import {d}from'./chunk-BdpJ2ZCM.js';import {W,k as ke,s as se}from'./chunk-BSSDDOqW.js';import {T as Tn,S as Sn,n as nt,a as ae,l as le,c as ce}from'./chunk-YfG457Nc.js';import {W as Wn,o as ot,i as it,I as In,D as De,B as Be,y as ya,E as En}from'./chunk-CtkiOUdU.js';import'./chunk-S8F5_Te_.js';import {y as yt,w as wt,t as ti,Z as Zn,c as cn,Y as Ye$1,a as wt$1,m as mn,g as gt}from'./chunk-tTmeIHGS.js';function Ue(s,i){if(s&1){let e=gC();ws(0,"div",9)(1,"mat-form-field",18)(2,"mat-label"),QC(3),hl(),ws(4,"textarea",19),em("ngModelChange",function(r){let m=wf(e).$index,D=EC();return tT(D.commands[m],r)||(D.commands[m]=r),Cf(r)}),hl(),GI(),ws(5,"mat-hint"),QC(6,"Use placeholder for dynamic values"),hl()(),ws(7,"button",20),Rg("click",function(){let r=wf(e).$index,m=EC();return Cf(m.removeCommand(r))}),ws(8,"mat-icon"),QC(9,"delete"),hl()()();}if(s&2){let e=i.$index,t=EC();nI(3),Dl("Prompt ",e+1),nI(),Jg("ngModel",t.commands[e]),qI(),nI(3),bg("disabled",t.commands.length===1);}}function Ne(s,i){if(s&1){let e=gC();ws(0,"div",10)(1,"h3"),QC(2,"Save to"),hl(),ws(3,"div",21)(4,"label",22)(5,"input",23),em("ngModelChange",function(r){wf(e);let m=EC();return tT(m.source,r)||(m.source=r),Cf(r)}),hl(),GI(),ws(6,"div",24)(7,"div",25)(8,"span",26),QC(9,"\u{1F464}"),hl(),ws(10,"span",27),QC(11,"Local"),hl()(),ws(12,"p",28),QC(13,"Personal prompt in ~/.coday/... (not committed)"),hl()()(),ws(14,"label",22)(15,"input",29),em("ngModelChange",function(r){wf(e);let m=EC();return tT(m.source,r)||(m.source=r),Cf(r)}),hl(),GI(),ws(16,"div",24)(17,"div",25)(18,"span",26),QC(19,"\u{1F4E6}"),hl(),ws(20,"span",27),QC(21,"Project"),hl()(),ws(22,"p",28),QC(23,"Shared prompt in ./prompts/ (committable)"),hl()()()(),ws(24,"p",30),QC(25,"Storage location is permanent and cannot be changed after creation"),hl()();}if(s&2){let e=EC();nI(4),Ug("selected",e.source==="local"),nI(),Jg("ngModel",e.source),qI(),nI(9),Ug("selected",e.source==="project"),nI(),Jg("ngModel",e.source),qI();}}function je(s,i){if(s&1&&(ws(0,"div",11)(1,"h3"),QC(2,"Storage Location"),hl(),ws(3,"div",31)(4,"span",26),QC(5),hl(),ws(6,"span",27),QC(7),hl()(),ws(8,"p",30),QC(9,"Cannot be changed after creation"),hl()()),s&2){let e=EC();nI(3),Ug("badge-local",e.source==="local")("badge-project",e.source==="project"),nI(2),Yg(e.source==="local"?"\u{1F464}":"\u{1F4E6}"),nI(2),Yg(e.source==="local"?"Local":"Project");}}function qe(s,i){if(s&1){let e=gC();ws(0,"div",12)(1,"label",32)(2,"input",33),em("ngModelChange",function(r){wf(e);let m=EC();return tT(m.webhookEnabled,r)||(m.webhookEnabled=r),Cf(r)}),hl(),GI(),ws(3,"span"),QC(4,"Enable webhook"),hl()(),ws(5,"p",30),QC(6,"Enable webhook to trigger this prompt via HTTP POST"),hl()();}if(s&2){let e=EC();nI(2),Jg("ngModel",e.webhookEnabled),qI();}}function He(s,i){if(s&1){let e=gC();ws(0,"div",13)(1,"div",34)(2,"mat-icon",35),QC(3,"link"),hl(),ws(4,"h4"),QC(5,"Webhook URL"),hl()(),ws(6,"div",36)(7,"p",37),QC(8),hl(),ws(9,"button",38),Rg("click",function(){wf(e);let r=EC();return Cf(r.copyWebhookUrl())}),ws(10,"mat-icon"),QC(11,"content_copy"),hl(),ws(12,"span"),QC(13,"Copy URL"),hl()()(),ws(14,"p",30),QC(15,"Use this URL to trigger the prompt via HTTP POST"),hl()();}if(s&2){let e=EC();nI(8),Yg(e.getWebhookUrl());}}function Ye(s,i){if(s&1&&(ws(0,"div",14)(1,"mat-icon"),QC(2,"error"),hl(),ws(3,"span"),QC(4),hl()()),s&2){let e=EC();nI(4),Yg(e.errorMessage);}}var S=class s{promptApi=g(d);dialogRef=g(z);configApi=g(W);snackBar=g(Mt);name="";description="";commands=[""];webhookEnabled=false;threadLifetime="";source="local";isSaving=false;errorMessage="";isAdmin=false;isEditMode=false;promptId="";data=g(Ue$1);constructor(){this.isEditMode=this.data.mode==="edit";}ngOnInit(){this.configApi.getUserConfig().subscribe({next:i=>{this.isAdmin=i.groups?.includes("CODAY_ADMIN")??false;},error:i=>{console.error("[PROMPT_FORM] Error loading user config:",i),this.isAdmin=false;}}),this.isEditMode&&this.data.prompt&&(this.promptId=this.data.prompt.id,this.name=this.data.prompt.name,this.description=this.data.prompt.description,this.commands=[...this.data.prompt.commands],this.webhookEnabled=this.data.prompt.webhookEnabled,this.source=this.data.prompt.source);}addCommand(){this.commands.push("");}removeCommand(i){this.commands.length>1&&this.commands.splice(i,1);}trackByIndex(i){return i}normalizeName(){this.name=this.name.replace(/[\s_.,;:!?()[\]{}]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase();}validateForm(){return this.name.trim()?this.description.trim()?this.commands.filter(e=>e.trim()).length===0?(this.errorMessage="At least one command is required",false):true:(this.errorMessage="Description is required",false):(this.errorMessage="Name is required",false)}save(){if(this.errorMessage="",!this.validateForm())return;let i=this.commands.filter(e=>e.trim());if(this.isSaving=true,this.isEditMode&&this.data.prompt){let e={name:this.name.trim(),description:this.description.trim(),commands:i,webhookEnabled:this.webhookEnabled};this.promptApi.updatePrompt(this.data.prompt.id,e).subscribe({next:()=>{this.isSaving=false,this.dialogRef.close(true);},error:t=>{console.error("Error updating prompt:",t),this.errorMessage=t?.error?.error||t?.message||"Failed to update prompt",this.isSaving=false;}});}else {let e={name:this.name.trim(),description:this.description.trim(),commands:i,webhookEnabled:this.webhookEnabled,source:this.source};this.promptApi.createPrompt(e).subscribe({next:()=>{this.isSaving=false,this.dialogRef.close(true);},error:t=>{console.error("Error creating prompt:",t),this.errorMessage=t?.error?.error||t?.message||"Failed to create prompt",this.isSaving=false;}});}}cancel(){this.dialogRef.close(false);}getWebhookUrl(){return `${window.location.origin}/api/webhooks/${this.promptId}/execute`}copyWebhookUrl(){if(!this.webhookEnabled){this.snackBar.open("Webhook is not enabled","Close",{duration:3e3});return}if(!this.promptId){this.snackBar.open("Prompt must be saved before getting webhook URL","Close",{duration:3e3});return}let i=this.getWebhookUrl();navigator.clipboard.writeText(i).then(()=>{this.snackBar.open("Webhook URL copied to clipboard!","Close",{duration:3e3});}).catch(e=>{console.error("Failed to copy webhook URL:",e),this.snackBar.open("Failed to copy URL","Close",{duration:3e3});});}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=Fw({type:s,selectors:[["app-prompt-form"]],decls:36,vars:11,consts:[["mat-dialog-title",""],[1,"form-container"],["appearance","outline",1,"full-width"],["matInput","","placeholder","my-prompt","required","",3,"ngModelChange","blur","ngModel"],["matInput","","placeholder","What does this prompt do?","rows","3","required","",3,"ngModelChange","ngModel"],[1,"commands-section"],[1,"section-header"],["mat-icon-button","","type","button","title","Add command",3,"click"],[1,"commands-list"],[1,"command-item"],[1,"source-section"],[1,"source-display"],[1,"webhook-section"],[1,"webhook-url-section"],[1,"error-message"],["align","end"],["mat-button","",3,"click","disabled"],["mat-raised-button","","color","primary",3,"click","disabled"],["appearance","outline",1,"command-field"],["matInput","","placeholder","Enter command with placeholders like \\{\\{key\\}\\}","rows","2",3,"ngModelChange","ngModel"],["mat-icon-button","","type","button","title","Remove command",1,"remove-btn",3,"click","disabled"],[1,"source-options"],[1,"source-option"],["type","radio","name","source","value","local",3,"ngModelChange","ngModel"],[1,"source-content"],[1,"source-header"],[1,"source-icon"],[1,"source-label"],[1,"source-description"],["type","radio","name","source","value","project",3,"ngModelChange","ngModel"],[1,"hint"],[1,"source-badge"],[1,"checkbox-label"],["type","checkbox",3,"ngModelChange","ngModel"],[1,"webhook-url-header"],[1,"webhook-icon"],[1,"webhook-url-content"],[1,"url-text"],["mat-raised-button","","color","accent","type","button",3,"click"]],template:function(e,t){e&1&&(ws(0,"h2",0),QC(1),hl(),ws(2,"mat-dialog-content")(3,"div",1)(4,"mat-form-field",2)(5,"mat-label"),QC(6,"Name"),hl(),ws(7,"input",3),em("ngModelChange",function(m){return tT(t.name,m)||(t.name=m),m}),Rg("blur",function(){return t.normalizeName()}),hl(),GI(),ws(8,"mat-hint"),QC(9,"A descriptive name (spaces and punctuation will be replaced with hyphens), will be used as command name"),hl()(),ws(10,"mat-form-field",2)(11,"mat-label"),QC(12,"Description"),hl(),ws(13,"textarea",4),em("ngModelChange",function(m){return tT(t.description,m)||(t.description=m),m}),hl(),GI(),ws(14,"mat-hint"),QC(15,"Explain the purpose of this prompt, helps for searchability"),hl()(),ws(16,"div",5)(17,"div",6)(18,"h3"),QC(19,"Prompts"),hl(),ws(20,"button",7),Rg("click",function(){return t.addCommand()}),ws(21,"mat-icon"),QC(22,"add"),hl()()(),ws(23,"div",8),cC(24,Ue,10,3,"div",9,sC),hl()(),oC(26,Ne,26,6,"div",10),oC(27,je,10,6,"div",11),oC(28,qe,7,1,"div",12),oC(29,He,16,1,"div",13),oC(30,Ye,5,1,"div",14),hl()(),ws(31,"mat-dialog-actions",15)(32,"button",16),Rg("click",function(){return t.cancel()}),QC(33,"Cancel"),hl(),ws(34,"button",17),Rg("click",function(){return t.save()}),QC(35),hl()()),e&2&&(nI(),Yg(t.isEditMode?"Edit Prompt":"Create Prompt"),nI(6),Jg("ngModel",t.name),qI(),nI(6),Jg("ngModel",t.description),qI(),nI(11),uC(t.commands),nI(2),iC(t.isEditMode?-1:26),nI(),iC(t.isEditMode?27:-1),nI(),iC(t.isAdmin?28:-1),nI(),iC(t.isEditMode&&t.webhookEnabled&&t.isAdmin?29:-1),nI(),iC(t.errorMessage?30:-1),nI(2),bg("disabled",t.isSaving),nI(2),bg("disabled",t.isSaving),nI(),Dl(" ",t.isSaving?"Saving...":"Save"," "));},dependencies:[Wm,ti,Ye$1,wt$1,mn,Zn,gt,cn,zt,jt,Vt,Nt,hr,pr,Gn,Tn,Sn,nt,ae,le,ce,yt,wt,Xt],styles:[".form-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;padding:0;min-width:500px}@media(max-width:768px){.form-container[_ngcontent-%COMP%]{min-width:auto}}.full-width[_ngcontent-%COMP%]{width:100%}.commands-section[_ngcontent-%COMP%] .section-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;margin-bottom:.5rem}.commands-section[_ngcontent-%COMP%] .section-header[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0;font-size:1rem;font-weight:600}.commands-section[_ngcontent-%COMP%] .commands-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem}.commands-section[_ngcontent-%COMP%] .command-item[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem}.commands-section[_ngcontent-%COMP%] .command-item[_ngcontent-%COMP%] .command-field[_ngcontent-%COMP%]{flex:1}.commands-section[_ngcontent-%COMP%] .command-item[_ngcontent-%COMP%] .remove-btn[_ngcontent-%COMP%]{margin-top:8px}.commands-section[_ngcontent-%COMP%] .command-item[_ngcontent-%COMP%] .remove-btn[_ngcontent-%COMP%]:disabled{opacity:.3;cursor:not-allowed}.webhook-section[_ngcontent-%COMP%]{padding:1rem;background:var(--color-surface);border-radius:8px;border:1px solid var(--color-border)}.webhook-section[_ngcontent-%COMP%] .checkbox-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer}.webhook-section[_ngcontent-%COMP%] .checkbox-label[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{width:18px;height:18px;cursor:pointer}.webhook-section[_ngcontent-%COMP%] .checkbox-label[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-size:.95rem}.webhook-section[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:.5rem 0 0;font-size:.85rem;color:var(--color-text-secondary)}.webhook-url-section[_ngcontent-%COMP%]{padding:1rem;background:var(--color-surface);border-radius:8px;border:1px solid var(--color-border)}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-bottom:.75rem}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-header[_ngcontent-%COMP%] .webhook-icon[_ngcontent-%COMP%]{color:var(--color-primary)}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-header[_ngcontent-%COMP%] h4[_ngcontent-%COMP%]{margin:0;font-size:1rem;font-weight:600}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-content[_ngcontent-%COMP%]{display:flex;align-items:center;gap:1rem;margin-bottom:.5rem}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-content[_ngcontent-%COMP%] .url-text[_ngcontent-%COMP%]{flex:1;margin:0;padding:.75rem;background:var(--color-bg);border:1px solid var(--color-border);border-radius:4px;font-family:monospace;font-size:.85rem;word-break:break-all;color:var(--color-text)}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-content[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{white-space:nowrap;display:flex;align-items:center;gap:.5rem}.webhook-url-section[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary)}.error-message[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem;background:#f443361a;border:1px solid var(--color-error);border-radius:4px;color:var(--color-error)}.error-message[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem}.error-message[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{flex:1}.source-section[_ngcontent-%COMP%]{padding:1rem;background:var(--color-surface);border-radius:8px;border:1px solid var(--color-border)}.source-section[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0 0 1rem;font-size:1rem;font-weight:600}.source-section[_ngcontent-%COMP%] .source-options[_ngcontent-%COMP%]{display:flex;gap:1rem;margin-bottom:.75rem}@media(max-width:768px){.source-section[_ngcontent-%COMP%] .source-options[_ngcontent-%COMP%]{flex-direction:column}}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%]{flex:1;display:flex;align-items:flex-start;gap:.75rem;padding:1rem;background:var(--color-bg);border:2px solid var(--color-border);border-radius:8px;cursor:pointer;transition:all .2s ease}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%]:hover{border-color:var(--color-primary);background:var(--color-bg-hover)}.source-section[_ngcontent-%COMP%] .source-option.selected[_ngcontent-%COMP%]{border-color:var(--color-primary);background:var(--color-bg-hover);box-shadow:0 0 0 1px var(--color-primary)}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{margin-top:2px;cursor:pointer}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%]{flex:1}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-bottom:.5rem}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%] .source-icon[_ngcontent-%COMP%]{font-size:1.25rem}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%] .source-label[_ngcontent-%COMP%]{font-weight:600;font-size:.95rem}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-description[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);line-height:1.4}.source-section[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-style:italic}.thread-lifetime-disabled[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.75rem;padding:1rem;background:#2196f30d;border:1px solid rgba(33,150,243,.2);border-radius:8px;margin-bottom:1rem}.thread-lifetime-disabled[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:#2196f3cc;font-size:1.25rem;width:1.25rem;height:1.25rem;margin-top:2px}.thread-lifetime-disabled[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;flex:1}.thread-lifetime-disabled[_ngcontent-%COMP%] p[_ngcontent-%COMP%] strong[_ngcontent-%COMP%]{font-size:.95rem;color:var(--color-text)}.thread-lifetime-disabled[_ngcontent-%COMP%] p[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{display:block;margin-top:.25rem;font-size:.85rem;color:var(--color-text-secondary);line-height:1.4}.source-display[_ngcontent-%COMP%]{padding:1rem;background:var(--color-surface);border-radius:8px;border:1px solid var(--color-border)}.source-display[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0 0 .75rem;font-size:1rem;font-weight:600}.source-display[_ngcontent-%COMP%] .source-badge[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;padding:.5rem 1rem;border-radius:6px;font-size:.9rem;font-weight:500;margin-bottom:.5rem}.source-display[_ngcontent-%COMP%] .source-badge[_ngcontent-%COMP%] .source-icon[_ngcontent-%COMP%]{font-size:1.1rem}.source-display[_ngcontent-%COMP%] .source-badge.badge-local[_ngcontent-%COMP%]{background:#2196f31a;color:#2196f3;border:1px solid rgba(33,150,243,.3)}.source-display[_ngcontent-%COMP%] .source-badge.badge-project[_ngcontent-%COMP%]{background:#4caf501a;color:#4caf50;border:1px solid rgba(76,175,80,.3)}.source-display[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-style:italic}"],changeDetection:1})};var Ge=()=>[],Ke=s=>({id:s});function Je(s,i){if(s&1&&(ws(0,"div",6),QC(1),hl()),s&2){let e=EC();nI(),Yg(e.errorMessage());}}function Qe(s,i){if(s&1){let e=gC();ws(0,"ds-entity-card",8),Rg("selected",function(r){wf(e);let m=EC();return Cf(m.onEdit(r))}),yl(1,9),ws(2,"button",10),Rg("click",function(r){return r.stopPropagation()}),ws(3,"mat-icon"),QC(4,"more_vert"),hl()(),vl(),hl();}if(s&2){let e=i.$implicit;EC();let t=MC(11);bg("id",e.id)("name",e.name)("description",e.description)("badges",e.badges??aT(6,Ge)),nI(2),bg("matMenuTriggerFor",t)("matMenuTriggerData",cT(7,Ke,e.id));}}function Xe(s,i){if(s&1){let e=gC();ws(0,"button",11),Rg("click",function(){wf(e);let r=EC().id,m=EC();return Cf(m.onToggleWebhook(r))}),ws(1,"mat-icon"),QC(2),hl(),QC(3),hl();}if(s&2){let e=EC().id,t=EC();nI(2),Yg(t.isWebhookEnabled(e)?"link_off":"link"),nI(),Dl(" ",t.isWebhookEnabled(e)?"Disable webhook":"Enable webhook"," ");}}function Ze(s,i){if(s&1){let e=gC();ws(0,"button",11),Rg("click",function(){let r=wf(e).id,m=EC();return Cf(m.onEdit(r))}),ws(1,"mat-icon"),QC(2,"edit"),hl(),QC(3," Edit "),hl(),oC(4,Xe,4,2,"button",12),ws(5,"button",13),Rg("click",function(){let r=wf(e).id,m=EC();return Cf(m.onDelete(r))}),ws(6,"mat-icon"),QC(7,"delete"),hl(),QC(8," Delete "),hl();}if(s&2){let e=EC();nI(4),iC(e.isAdmin()?4:-1);}}var Le="system",Ie=class s{promptApi=g(d);configApi=g(W);location=g(_m);dialog=g(Re);prompts=Gi([]);isLoading=Gi(false);errorMessage=Gi(null);showOnlyMine=Gi(true);isAdmin=Gi(false);currentUsername=Gi("");promptItems=ET(()=>{let i=this.prompts(),e=this.currentUsername(),r=this.showOnlyMine()&&e?i.filter(p=>this.isMyPrompt(p)):i,D=[...new Set(r.map(p=>p.createdBy))].sort((p,k)=>p===e&&k!==e?-1:k===e&&p!==e||p===Le?1:k===Le?-1:p.localeCompare(k)),H=[];for(let p of D){let k=p===e?`${p} (you)`:p;for(let F of r.filter(Ae=>Ae.createdBy===p))H.push({id:F.id,name:F.name,description:F.description,badges:this.buildBadges(F),groupKey:p,groupLabel:k});}return H});ngOnInit(){this.configApi.getUserConfig().subscribe({next:i=>{this.isAdmin.set(i.groups?.includes("CODAY_ADMIN")??false),this.currentUsername.set(i.username??"");},error:()=>this.isAdmin.set(false)}),this.loadPrompts();}loadPrompts(){this.isLoading.set(true),this.promptApi.listPrompts().subscribe({next:i=>{this.prompts.set(i.filter(e=>!e.id.startsWith("builtin"))),this.isLoading.set(false);},error:i=>{this.errorMessage.set(i?.error?.error??"Failed to load prompts"),this.isLoading.set(false);}});}onBack(){this.location.back();}onCreate(){this.dialog.open(S,{width:"700px",maxHeight:"90vh",data:{mode:"create"}}).afterClosed().subscribe(e=>{e&&this.loadPrompts();});}onEdit(i){this.promptApi.getPrompt(i).subscribe({next:e=>{this.dialog.open(S,{width:"700px",maxHeight:"90vh",data:{mode:"edit",prompt:e}}).afterClosed().subscribe(r=>{r&&this.loadPrompts();});},error:e=>this.errorMessage.set(e?.error?.error??"Failed to load prompt")});}onDelete(i){confirm("Are you sure you want to delete this prompt?")&&this.promptApi.deletePrompt(i).subscribe({next:()=>this.loadPrompts(),error:e=>this.errorMessage.set(e?.error?.error??"Failed to delete prompt")});}onToggleWebhook(i){let e=this.prompts().find(r=>r.id===i);if(!e)return;(e.webhookEnabled?this.promptApi.disableWebhook(i):this.promptApi.enableWebhook(i)).subscribe({next:()=>this.loadPrompts(),error:r=>this.errorMessage.set(r?.error?.error??"Failed to toggle webhook")});}isWebhookEnabled(i){return this.prompts().find(e=>e.id===i)?.webhookEnabled??false}isMyPrompt(i){let e=t=>t.replace(/[.\s]+/g,"_").toLowerCase();return e(i.createdBy)===e(this.currentUsername())}buildBadges(i){let e=[];return i.source==="local"?e.push({label:"local",variant:"info"}):e.push({label:"project",variant:"success"}),i.webhookEnabled&&e.push({label:"webhook",variant:"warning"}),e}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=Fw({type:s,selectors:[["app-prompt-list"]],decls:13,vars:6,consts:[["promptCard",""],["cardMenu","matMenu"],[1,"prompt-list-page"],["title","Prompts","cardMinWidth","320px","contentMaxWidth","1400px","searchPlaceholder","Filter prompts\u2026","emptyMessage","No prompts found.",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","mat-icon-button","","title","Back",3,"click"],["toolbar-extras","","color","primary",1,"prompt-list__mine-toggle",3,"ngModelChange","ngModel"],[1,"prompt-list__error"],["matMenuContent",""],[3,"selected","id","name","description","badges"],["dsCardActions",""],["mat-icon-button","",3,"click","matMenuTriggerFor","matMenuTriggerData"],["mat-menu-item","",3,"click"],["mat-menu-item",""],["mat-menu-item","",1,"prompt-list__delete-item",3,"click"]],template:function(e,t){if(e&1&&(ws(0,"div",2)(1,"ds-entity-list",3),Rg("createRequested",function(){return t.onCreate()}),ws(2,"button",4),Rg("click",function(){return t.onBack()}),ws(3,"mat-icon"),QC(4,"chevron_left"),hl()(),ws(5,"mat-slide-toggle",5),Rg("ngModelChange",function(m){return t.showOnlyMine.set(m)}),QC(6," Mine "),hl(),GI(),hl(),oC(7,Je,2,1,"div",6),hl(),Eg(8,Qe,5,9,"ng-template",null,0,mT),ws(10,"mat-menu",null,1),Eg(12,Ze,9,1,"ng-template",7),hl()),e&2){let r=MC(9);nI(),bg("items",t.promptItems())("loading",t.isLoading())("showCreate",true)("itemTemplate",r),nI(4),bg("ngModel",t.showOnlyMine()),qI(),nI(2),iC(t.errorMessage()?7:-1);}},dependencies:[Wn,ot,it,hr,Gn,yt,wt,ke,se,In,De,Be,ya,En,ti,Zn,cn],styles:["[_nghost-%COMP%]{display:block;width:100%;min-height:100vh;background:var(--color-bg);overflow-y:auto}.prompt-list__mine-toggle[_ngcontent-%COMP%]{flex-shrink:0;font-size:.875rem}.prompt-list__delete-item[_ngcontent-%COMP%]{color:var(--color-error, #ff3b30)}.prompt-list__delete-item[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:inherit}.prompt-list__error[_ngcontent-%COMP%]{margin:1rem auto;max-width:900px;padding:.75rem 1rem;background:#dc262614;border:1px solid rgba(220,38,38,.25);border-radius:8px;color:var(--color-error, #ff3b30);font-size:.875rem}"],changeDetection:1})};export{Ie as PromptListComponent};
|
|
1
|
+
import {g,bm as xm,R as Re,W as Wi,T as TT,j as jw,h as hr,i as Gn,k as Cs,n as kg,J as JC,m as hl,a3 as ZI,o as aC,af as wg,ag as ET,A as AC,t as sI,_ as _g,a6 as QI,u as cC,X as z,bl as Mt,Y as Ue$1,am as Ym,Z as zt,a0 as jt,a1 as Vt,a2 as Nt,e as pr,bn as Xt,ai as rm,aj as iT,q as dC,bo as uC,a8 as Kg,ak as nm,v as fC,a5 as Dl,ac as CC,a9 as vC,aa as Cf,ab as Tf,bp as yl,bq as vl,ah as dT,b4 as fT,w as zg}from'./main-YYHD6X7H.js';import {d}from'./chunk-CmyT-Z4A.js';import {W,k as ke,s as se}from'./chunk-DoqL_RuM.js';import {T as Tn,S as Sn,n as nt,a as ae,l as le,c as ce}from'./chunk-CXgj_KJY.js';import {W as Wn,o as ot,i as it,I as In,D as De,B as Be,y as ya,E as En}from'./chunk-B13_C_P9.js';import'./chunk-CgNkwpQ7.js';import {y as yt,w as wt,t as ti,Z as Zn,c as cn,Y as Ye$1,a as wt$1,m as mn,g as gt}from'./chunk-FMHkoXwM.js';function Ue(s,i){if(s&1){let e=vC();Cs(0,"div",9)(1,"mat-form-field",18)(2,"mat-label"),JC(3),hl(),Cs(4,"textarea",19),rm("ngModelChange",function(r){let m=Cf(e).$index,D=CC();return iT(D.commands[m],r)||(D.commands[m]=r),Tf(r)}),hl(),ZI(),Cs(5,"mat-hint"),JC(6,"Use placeholder for dynamic values"),hl()(),Cs(7,"button",20),kg("click",function(){let r=Cf(e).$index,m=CC();return Tf(m.removeCommand(r))}),Cs(8,"mat-icon"),JC(9,"delete"),hl()()();}if(s&2){let e=i.$index,t=CC();sI(3),Dl("Prompt ",e+1),sI(),nm("ngModel",t.commands[e]),QI(),sI(3),_g("disabled",t.commands.length===1);}}function Ne(s,i){if(s&1){let e=vC();Cs(0,"div",10)(1,"h3"),JC(2,"Save to"),hl(),Cs(3,"div",21)(4,"label",22)(5,"input",23),rm("ngModelChange",function(r){Cf(e);let m=CC();return iT(m.source,r)||(m.source=r),Tf(r)}),hl(),ZI(),Cs(6,"div",24)(7,"div",25)(8,"span",26),JC(9,"\u{1F464}"),hl(),Cs(10,"span",27),JC(11,"Local"),hl()(),Cs(12,"p",28),JC(13,"Personal prompt in ~/.coday/... (not committed)"),hl()()(),Cs(14,"label",22)(15,"input",29),rm("ngModelChange",function(r){Cf(e);let m=CC();return iT(m.source,r)||(m.source=r),Tf(r)}),hl(),ZI(),Cs(16,"div",24)(17,"div",25)(18,"span",26),JC(19,"\u{1F4E6}"),hl(),Cs(20,"span",27),JC(21,"Project"),hl()(),Cs(22,"p",28),JC(23,"Shared prompt in ./prompts/ (committable)"),hl()()()(),Cs(24,"p",30),JC(25,"Storage location is permanent and cannot be changed after creation"),hl()();}if(s&2){let e=CC();sI(4),zg("selected",e.source==="local"),sI(),nm("ngModel",e.source),QI(),sI(9),zg("selected",e.source==="project"),sI(),nm("ngModel",e.source),QI();}}function je(s,i){if(s&1&&(Cs(0,"div",11)(1,"h3"),JC(2,"Storage Location"),hl(),Cs(3,"div",31)(4,"span",26),JC(5),hl(),Cs(6,"span",27),JC(7),hl()(),Cs(8,"p",30),JC(9,"Cannot be changed after creation"),hl()()),s&2){let e=CC();sI(3),zg("badge-local",e.source==="local")("badge-project",e.source==="project"),sI(2),Kg(e.source==="local"?"\u{1F464}":"\u{1F4E6}"),sI(2),Kg(e.source==="local"?"Local":"Project");}}function qe(s,i){if(s&1){let e=vC();Cs(0,"div",12)(1,"label",32)(2,"input",33),rm("ngModelChange",function(r){Cf(e);let m=CC();return iT(m.webhookEnabled,r)||(m.webhookEnabled=r),Tf(r)}),hl(),ZI(),Cs(3,"span"),JC(4,"Enable webhook"),hl()(),Cs(5,"p",30),JC(6,"Enable webhook to trigger this prompt via HTTP POST"),hl()();}if(s&2){let e=CC();sI(2),nm("ngModel",e.webhookEnabled),QI();}}function He(s,i){if(s&1){let e=vC();Cs(0,"div",13)(1,"div",34)(2,"mat-icon",35),JC(3,"link"),hl(),Cs(4,"h4"),JC(5,"Webhook URL"),hl()(),Cs(6,"div",36)(7,"p",37),JC(8),hl(),Cs(9,"button",38),kg("click",function(){Cf(e);let r=CC();return Tf(r.copyWebhookUrl())}),Cs(10,"mat-icon"),JC(11,"content_copy"),hl(),Cs(12,"span"),JC(13,"Copy URL"),hl()()(),Cs(14,"p",30),JC(15,"Use this URL to trigger the prompt via HTTP POST"),hl()();}if(s&2){let e=CC();sI(8),Kg(e.getWebhookUrl());}}function Ye(s,i){if(s&1&&(Cs(0,"div",14)(1,"mat-icon"),JC(2,"error"),hl(),Cs(3,"span"),JC(4),hl()()),s&2){let e=CC();sI(4),Kg(e.errorMessage);}}var S=class s{promptApi=g(d);dialogRef=g(z);configApi=g(W);snackBar=g(Mt);name="";description="";commands=[""];webhookEnabled=false;threadLifetime="";source="local";isSaving=false;errorMessage="";isAdmin=false;isEditMode=false;promptId="";data=g(Ue$1);constructor(){this.isEditMode=this.data.mode==="edit";}ngOnInit(){this.configApi.getUserConfig().subscribe({next:i=>{this.isAdmin=i.groups?.includes("CODAY_ADMIN")??false;},error:i=>{console.error("[PROMPT_FORM] Error loading user config:",i),this.isAdmin=false;}}),this.isEditMode&&this.data.prompt&&(this.promptId=this.data.prompt.id,this.name=this.data.prompt.name,this.description=this.data.prompt.description,this.commands=[...this.data.prompt.commands],this.webhookEnabled=this.data.prompt.webhookEnabled,this.source=this.data.prompt.source);}addCommand(){this.commands.push("");}removeCommand(i){this.commands.length>1&&this.commands.splice(i,1);}trackByIndex(i){return i}normalizeName(){this.name=this.name.replace(/[\s_.,;:!?()[\]{}]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase();}validateForm(){return this.name.trim()?this.description.trim()?this.commands.filter(e=>e.trim()).length===0?(this.errorMessage="At least one command is required",false):true:(this.errorMessage="Description is required",false):(this.errorMessage="Name is required",false)}save(){if(this.errorMessage="",!this.validateForm())return;let i=this.commands.filter(e=>e.trim());if(this.isSaving=true,this.isEditMode&&this.data.prompt){let e={name:this.name.trim(),description:this.description.trim(),commands:i,webhookEnabled:this.webhookEnabled};this.promptApi.updatePrompt(this.data.prompt.id,e).subscribe({next:()=>{this.isSaving=false,this.dialogRef.close(true);},error:t=>{console.error("Error updating prompt:",t),this.errorMessage=t?.error?.error||t?.message||"Failed to update prompt",this.isSaving=false;}});}else {let e={name:this.name.trim(),description:this.description.trim(),commands:i,webhookEnabled:this.webhookEnabled,source:this.source};this.promptApi.createPrompt(e).subscribe({next:()=>{this.isSaving=false,this.dialogRef.close(true);},error:t=>{console.error("Error creating prompt:",t),this.errorMessage=t?.error?.error||t?.message||"Failed to create prompt",this.isSaving=false;}});}}cancel(){this.dialogRef.close(false);}getWebhookUrl(){return `${window.location.origin}/api/webhooks/${this.promptId}/execute`}copyWebhookUrl(){if(!this.webhookEnabled){this.snackBar.open("Webhook is not enabled","Close",{duration:3e3});return}if(!this.promptId){this.snackBar.open("Prompt must be saved before getting webhook URL","Close",{duration:3e3});return}let i=this.getWebhookUrl();navigator.clipboard.writeText(i).then(()=>{this.snackBar.open("Webhook URL copied to clipboard!","Close",{duration:3e3});}).catch(e=>{console.error("Failed to copy webhook URL:",e),this.snackBar.open("Failed to copy URL","Close",{duration:3e3});});}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=jw({type:s,selectors:[["app-prompt-form"]],decls:36,vars:11,consts:[["mat-dialog-title",""],[1,"form-container"],["appearance","outline",1,"full-width"],["matInput","","placeholder","my-prompt","required","",3,"ngModelChange","blur","ngModel"],["matInput","","placeholder","What does this prompt do?","rows","3","required","",3,"ngModelChange","ngModel"],[1,"commands-section"],[1,"section-header"],["mat-icon-button","","type","button","title","Add command",3,"click"],[1,"commands-list"],[1,"command-item"],[1,"source-section"],[1,"source-display"],[1,"webhook-section"],[1,"webhook-url-section"],[1,"error-message"],["align","end"],["mat-button","",3,"click","disabled"],["mat-raised-button","","color","primary",3,"click","disabled"],["appearance","outline",1,"command-field"],["matInput","","placeholder","Enter command with placeholders like \\{\\{key\\}\\}","rows","2",3,"ngModelChange","ngModel"],["mat-icon-button","","type","button","title","Remove command",1,"remove-btn",3,"click","disabled"],[1,"source-options"],[1,"source-option"],["type","radio","name","source","value","local",3,"ngModelChange","ngModel"],[1,"source-content"],[1,"source-header"],[1,"source-icon"],[1,"source-label"],[1,"source-description"],["type","radio","name","source","value","project",3,"ngModelChange","ngModel"],[1,"hint"],[1,"source-badge"],[1,"checkbox-label"],["type","checkbox",3,"ngModelChange","ngModel"],[1,"webhook-url-header"],[1,"webhook-icon"],[1,"webhook-url-content"],[1,"url-text"],["mat-raised-button","","color","accent","type","button",3,"click"]],template:function(e,t){e&1&&(Cs(0,"h2",0),JC(1),hl(),Cs(2,"mat-dialog-content")(3,"div",1)(4,"mat-form-field",2)(5,"mat-label"),JC(6,"Name"),hl(),Cs(7,"input",3),rm("ngModelChange",function(m){return iT(t.name,m)||(t.name=m),m}),kg("blur",function(){return t.normalizeName()}),hl(),ZI(),Cs(8,"mat-hint"),JC(9,"A descriptive name (spaces and punctuation will be replaced with hyphens), will be used as command name"),hl()(),Cs(10,"mat-form-field",2)(11,"mat-label"),JC(12,"Description"),hl(),Cs(13,"textarea",4),rm("ngModelChange",function(m){return iT(t.description,m)||(t.description=m),m}),hl(),ZI(),Cs(14,"mat-hint"),JC(15,"Explain the purpose of this prompt, helps for searchability"),hl()(),Cs(16,"div",5)(17,"div",6)(18,"h3"),JC(19,"Prompts"),hl(),Cs(20,"button",7),kg("click",function(){return t.addCommand()}),Cs(21,"mat-icon"),JC(22,"add"),hl()()(),Cs(23,"div",8),dC(24,Ue,10,3,"div",9,uC),hl()(),aC(26,Ne,26,6,"div",10),aC(27,je,10,6,"div",11),aC(28,qe,7,1,"div",12),aC(29,He,16,1,"div",13),aC(30,Ye,5,1,"div",14),hl()(),Cs(31,"mat-dialog-actions",15)(32,"button",16),kg("click",function(){return t.cancel()}),JC(33,"Cancel"),hl(),Cs(34,"button",17),kg("click",function(){return t.save()}),JC(35),hl()()),e&2&&(sI(),Kg(t.isEditMode?"Edit Prompt":"Create Prompt"),sI(6),nm("ngModel",t.name),QI(),sI(6),nm("ngModel",t.description),QI(),sI(11),fC(t.commands),sI(2),cC(t.isEditMode?-1:26),sI(),cC(t.isEditMode?27:-1),sI(),cC(t.isAdmin?28:-1),sI(),cC(t.isEditMode&&t.webhookEnabled&&t.isAdmin?29:-1),sI(),cC(t.errorMessage?30:-1),sI(2),_g("disabled",t.isSaving),sI(2),_g("disabled",t.isSaving),sI(),Dl(" ",t.isSaving?"Saving...":"Save"," "));},dependencies:[Ym,ti,Ye$1,wt$1,mn,Zn,gt,cn,zt,jt,Vt,Nt,hr,pr,Gn,Tn,Sn,nt,ae,le,ce,yt,wt,Xt],styles:[".form-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;padding:0;min-width:500px}@media(max-width:768px){.form-container[_ngcontent-%COMP%]{min-width:auto}}.full-width[_ngcontent-%COMP%]{width:100%}.commands-section[_ngcontent-%COMP%] .section-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;margin-bottom:.5rem}.commands-section[_ngcontent-%COMP%] .section-header[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0;font-size:1rem;font-weight:600}.commands-section[_ngcontent-%COMP%] .commands-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem}.commands-section[_ngcontent-%COMP%] .command-item[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem}.commands-section[_ngcontent-%COMP%] .command-item[_ngcontent-%COMP%] .command-field[_ngcontent-%COMP%]{flex:1}.commands-section[_ngcontent-%COMP%] .command-item[_ngcontent-%COMP%] .remove-btn[_ngcontent-%COMP%]{margin-top:8px}.commands-section[_ngcontent-%COMP%] .command-item[_ngcontent-%COMP%] .remove-btn[_ngcontent-%COMP%]:disabled{opacity:.3;cursor:not-allowed}.webhook-section[_ngcontent-%COMP%]{padding:1rem;background:var(--color-surface);border-radius:8px;border:1px solid var(--color-border)}.webhook-section[_ngcontent-%COMP%] .checkbox-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer}.webhook-section[_ngcontent-%COMP%] .checkbox-label[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{width:18px;height:18px;cursor:pointer}.webhook-section[_ngcontent-%COMP%] .checkbox-label[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-size:.95rem}.webhook-section[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:.5rem 0 0;font-size:.85rem;color:var(--color-text-secondary)}.webhook-url-section[_ngcontent-%COMP%]{padding:1rem;background:var(--color-surface);border-radius:8px;border:1px solid var(--color-border)}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-bottom:.75rem}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-header[_ngcontent-%COMP%] .webhook-icon[_ngcontent-%COMP%]{color:var(--color-primary)}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-header[_ngcontent-%COMP%] h4[_ngcontent-%COMP%]{margin:0;font-size:1rem;font-weight:600}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-content[_ngcontent-%COMP%]{display:flex;align-items:center;gap:1rem;margin-bottom:.5rem}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-content[_ngcontent-%COMP%] .url-text[_ngcontent-%COMP%]{flex:1;margin:0;padding:.75rem;background:var(--color-bg);border:1px solid var(--color-border);border-radius:4px;font-family:monospace;font-size:.85rem;word-break:break-all;color:var(--color-text)}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-content[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{white-space:nowrap;display:flex;align-items:center;gap:.5rem}.webhook-url-section[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary)}.error-message[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem;background:#f443361a;border:1px solid var(--color-error);border-radius:4px;color:var(--color-error)}.error-message[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem}.error-message[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{flex:1}.source-section[_ngcontent-%COMP%]{padding:1rem;background:var(--color-surface);border-radius:8px;border:1px solid var(--color-border)}.source-section[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0 0 1rem;font-size:1rem;font-weight:600}.source-section[_ngcontent-%COMP%] .source-options[_ngcontent-%COMP%]{display:flex;gap:1rem;margin-bottom:.75rem}@media(max-width:768px){.source-section[_ngcontent-%COMP%] .source-options[_ngcontent-%COMP%]{flex-direction:column}}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%]{flex:1;display:flex;align-items:flex-start;gap:.75rem;padding:1rem;background:var(--color-bg);border:2px solid var(--color-border);border-radius:8px;cursor:pointer;transition:all .2s ease}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%]:hover{border-color:var(--color-primary);background:var(--color-bg-hover)}.source-section[_ngcontent-%COMP%] .source-option.selected[_ngcontent-%COMP%]{border-color:var(--color-primary);background:var(--color-bg-hover);box-shadow:0 0 0 1px var(--color-primary)}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{margin-top:2px;cursor:pointer}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%]{flex:1}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-bottom:.5rem}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%] .source-icon[_ngcontent-%COMP%]{font-size:1.25rem}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%] .source-label[_ngcontent-%COMP%]{font-weight:600;font-size:.95rem}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-description[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);line-height:1.4}.source-section[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-style:italic}.thread-lifetime-disabled[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.75rem;padding:1rem;background:#2196f30d;border:1px solid rgba(33,150,243,.2);border-radius:8px;margin-bottom:1rem}.thread-lifetime-disabled[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:#2196f3cc;font-size:1.25rem;width:1.25rem;height:1.25rem;margin-top:2px}.thread-lifetime-disabled[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;flex:1}.thread-lifetime-disabled[_ngcontent-%COMP%] p[_ngcontent-%COMP%] strong[_ngcontent-%COMP%]{font-size:.95rem;color:var(--color-text)}.thread-lifetime-disabled[_ngcontent-%COMP%] p[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{display:block;margin-top:.25rem;font-size:.85rem;color:var(--color-text-secondary);line-height:1.4}.source-display[_ngcontent-%COMP%]{padding:1rem;background:var(--color-surface);border-radius:8px;border:1px solid var(--color-border)}.source-display[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0 0 .75rem;font-size:1rem;font-weight:600}.source-display[_ngcontent-%COMP%] .source-badge[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;padding:.5rem 1rem;border-radius:6px;font-size:.9rem;font-weight:500;margin-bottom:.5rem}.source-display[_ngcontent-%COMP%] .source-badge[_ngcontent-%COMP%] .source-icon[_ngcontent-%COMP%]{font-size:1.1rem}.source-display[_ngcontent-%COMP%] .source-badge.badge-local[_ngcontent-%COMP%]{background:#2196f31a;color:#2196f3;border:1px solid rgba(33,150,243,.3)}.source-display[_ngcontent-%COMP%] .source-badge.badge-project[_ngcontent-%COMP%]{background:#4caf501a;color:#4caf50;border:1px solid rgba(76,175,80,.3)}.source-display[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-style:italic}"],changeDetection:1})};var Ge=()=>[],Ke=s=>({id:s});function Je(s,i){if(s&1&&(Cs(0,"div",6),JC(1),hl()),s&2){let e=CC();sI(),Kg(e.errorMessage());}}function Qe(s,i){if(s&1){let e=vC();Cs(0,"ds-entity-card",8),kg("selected",function(r){Cf(e);let m=CC();return Tf(m.onEdit(r))}),yl(1,9),Cs(2,"button",10),kg("click",function(r){return r.stopPropagation()}),Cs(3,"mat-icon"),JC(4,"more_vert"),hl()(),vl(),hl();}if(s&2){let e=i.$implicit;CC();let t=AC(11);_g("id",e.id)("name",e.name)("description",e.description)("badges",e.badges??dT(6,Ge)),sI(2),_g("matMenuTriggerFor",t)("matMenuTriggerData",fT(7,Ke,e.id));}}function Xe(s,i){if(s&1){let e=vC();Cs(0,"button",11),kg("click",function(){Cf(e);let r=CC().id,m=CC();return Tf(m.onToggleWebhook(r))}),Cs(1,"mat-icon"),JC(2),hl(),JC(3),hl();}if(s&2){let e=CC().id,t=CC();sI(2),Kg(t.isWebhookEnabled(e)?"link_off":"link"),sI(),Dl(" ",t.isWebhookEnabled(e)?"Disable webhook":"Enable webhook"," ");}}function Ze(s,i){if(s&1){let e=vC();Cs(0,"button",11),kg("click",function(){let r=Cf(e).id,m=CC();return Tf(m.onEdit(r))}),Cs(1,"mat-icon"),JC(2,"edit"),hl(),JC(3," Edit "),hl(),aC(4,Xe,4,2,"button",12),Cs(5,"button",13),kg("click",function(){let r=Cf(e).id,m=CC();return Tf(m.onDelete(r))}),Cs(6,"mat-icon"),JC(7,"delete"),hl(),JC(8," Delete "),hl();}if(s&2){let e=CC();sI(4),cC(e.isAdmin()?4:-1);}}var Le="system",Ie=class s{promptApi=g(d);configApi=g(W);location=g(xm);dialog=g(Re);prompts=Wi([]);isLoading=Wi(false);errorMessage=Wi(null);showOnlyMine=Wi(true);isAdmin=Wi(false);currentUsername=Wi("");promptItems=TT(()=>{let i=this.prompts(),e=this.currentUsername(),r=this.showOnlyMine()&&e?i.filter(p=>this.isMyPrompt(p)):i,D=[...new Set(r.map(p=>p.createdBy))].sort((p,k)=>p===e&&k!==e?-1:k===e&&p!==e||p===Le?1:k===Le?-1:p.localeCompare(k)),H=[];for(let p of D){let k=p===e?`${p} (you)`:p;for(let F of r.filter(Ae=>Ae.createdBy===p))H.push({id:F.id,name:F.name,description:F.description,badges:this.buildBadges(F),groupKey:p,groupLabel:k});}return H});ngOnInit(){this.configApi.getUserConfig().subscribe({next:i=>{this.isAdmin.set(i.groups?.includes("CODAY_ADMIN")??false),this.currentUsername.set(i.username??"");},error:()=>this.isAdmin.set(false)}),this.loadPrompts();}loadPrompts(){this.isLoading.set(true),this.promptApi.listPrompts().subscribe({next:i=>{this.prompts.set(i.filter(e=>!e.id.startsWith("builtin"))),this.isLoading.set(false);},error:i=>{this.errorMessage.set(i?.error?.error??"Failed to load prompts"),this.isLoading.set(false);}});}onBack(){this.location.back();}onCreate(){this.dialog.open(S,{width:"700px",maxHeight:"90vh",data:{mode:"create"}}).afterClosed().subscribe(e=>{e&&this.loadPrompts();});}onEdit(i){this.promptApi.getPrompt(i).subscribe({next:e=>{this.dialog.open(S,{width:"700px",maxHeight:"90vh",data:{mode:"edit",prompt:e}}).afterClosed().subscribe(r=>{r&&this.loadPrompts();});},error:e=>this.errorMessage.set(e?.error?.error??"Failed to load prompt")});}onDelete(i){confirm("Are you sure you want to delete this prompt?")&&this.promptApi.deletePrompt(i).subscribe({next:()=>this.loadPrompts(),error:e=>this.errorMessage.set(e?.error?.error??"Failed to delete prompt")});}onToggleWebhook(i){let e=this.prompts().find(r=>r.id===i);if(!e)return;(e.webhookEnabled?this.promptApi.disableWebhook(i):this.promptApi.enableWebhook(i)).subscribe({next:()=>this.loadPrompts(),error:r=>this.errorMessage.set(r?.error?.error??"Failed to toggle webhook")});}isWebhookEnabled(i){return this.prompts().find(e=>e.id===i)?.webhookEnabled??false}isMyPrompt(i){let e=t=>t.replace(/[.\s]+/g,"_").toLowerCase();return e(i.createdBy)===e(this.currentUsername())}buildBadges(i){let e=[];return i.source==="local"?e.push({label:"local",variant:"info"}):e.push({label:"project",variant:"success"}),i.webhookEnabled&&e.push({label:"webhook",variant:"warning"}),e}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=jw({type:s,selectors:[["app-prompt-list"]],decls:13,vars:6,consts:[["promptCard",""],["cardMenu","matMenu"],[1,"prompt-list-page"],["title","Prompts","cardMinWidth","320px","contentMaxWidth","1400px","searchPlaceholder","Filter prompts\u2026","emptyMessage","No prompts found.",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","mat-icon-button","","title","Back",3,"click"],["toolbar-extras","","color","primary",1,"prompt-list__mine-toggle",3,"ngModelChange","ngModel"],[1,"prompt-list__error"],["matMenuContent",""],[3,"selected","id","name","description","badges"],["dsCardActions",""],["mat-icon-button","",3,"click","matMenuTriggerFor","matMenuTriggerData"],["mat-menu-item","",3,"click"],["mat-menu-item",""],["mat-menu-item","",1,"prompt-list__delete-item",3,"click"]],template:function(e,t){if(e&1&&(Cs(0,"div",2)(1,"ds-entity-list",3),kg("createRequested",function(){return t.onCreate()}),Cs(2,"button",4),kg("click",function(){return t.onBack()}),Cs(3,"mat-icon"),JC(4,"chevron_left"),hl()(),Cs(5,"mat-slide-toggle",5),kg("ngModelChange",function(m){return t.showOnlyMine.set(m)}),JC(6," Mine "),hl(),ZI(),hl(),aC(7,Je,2,1,"div",6),hl(),wg(8,Qe,5,9,"ng-template",null,0,ET),Cs(10,"mat-menu",null,1),wg(12,Ze,9,1,"ng-template",7),hl()),e&2){let r=AC(9);sI(),_g("items",t.promptItems())("loading",t.isLoading())("showCreate",true)("itemTemplate",r),sI(4),_g("ngModel",t.showOnlyMine()),QI(),sI(2),cC(t.errorMessage()?7:-1);}},dependencies:[Wn,ot,it,hr,Gn,yt,wt,ke,se,In,De,Be,ya,En,ti,Zn,cn],styles:["[_nghost-%COMP%]{display:block;width:100%;min-height:100vh;background:var(--color-bg);overflow-y:auto}.prompt-list__mine-toggle[_ngcontent-%COMP%]{flex-shrink:0;font-size:.875rem}.prompt-list__delete-item[_ngcontent-%COMP%]{color:var(--color-error, #ff3b30)}.prompt-list__delete-item[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:inherit}.prompt-list__error[_ngcontent-%COMP%]{margin:1rem auto;max-width:900px;padding:.75rem 1rem;background:#dc262614;border:1px solid rgba(220,38,38,.25);border-radius:8px;color:var(--color-error, #ff3b30);font-size:.875rem}"],changeDetection:1})};export{Ie as PromptListComponent};
|