@whoz-oss/coday-client 3.17.0 → 3.19.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-2H_m7V_L.js +1 -0
- package/browser/{chunk-BXkvjekT.js → chunk-3m_nS8Y5.js} +2 -2
- package/browser/chunk-4tOVGgPj.js +1 -0
- package/browser/{chunk-BPfJALqU.js → chunk-82BMsVX3.js} +1 -1
- package/browser/{chunk-CxUcyBb9.js → chunk-B3NyUUXq.js} +1 -1
- package/browser/chunk-B55TXBfo.js +1 -0
- package/browser/{chunk-CI760KmO.js → chunk-B9NYLAhC.js} +1 -1
- package/browser/chunk-BEaYQhbI.js +508 -0
- package/browser/chunk-BI4kHPfc.js +1 -0
- package/browser/chunk-BID9NaLj.js +1 -0
- package/browser/{chunk-Ci9l-k84.js → chunk-BOpm3F5F.js} +1 -1
- package/browser/{chunk-CpZK7G-Q.js → chunk-BWLCegs8.js} +2 -2
- package/browser/{chunk-DjoW6kqa.js → chunk-BWZcAdUl.js} +5 -5
- package/browser/{chunk-DqC8XT4v.js → chunk-BXsNw_60.js} +1 -1
- package/browser/chunk-BZ-rNYX5.js +1 -0
- package/browser/{chunk-BHvLB-pV.js → chunk-B_5qWQZJ.js} +1 -1
- package/browser/{chunk-DMtXGu5h.js → chunk-BcHHkjC4.js} +1 -1
- package/browser/{chunk-CI7wYBKk.js → chunk-BhD8uvAV.js} +1 -1
- package/browser/{chunk-DpHEu7EG.js → chunk-Bha8h69K.js} +1 -1
- package/browser/chunk-BhdMedPO.js +37 -0
- package/browser/chunk-BiwhEkuA.js +1 -0
- package/browser/{chunk-ClSDInQq.js → chunk-Bkwb10Tz.js} +1 -1
- package/browser/chunk-BlO8XEX7.js +1 -0
- package/browser/{chunk-b6g-uBR5.js → chunk-BmiWFhjp.js} +1 -1
- package/browser/{chunk-BVAD9f9s.js → chunk-BnDz6aYG.js} +1 -1
- package/browser/chunk-BqH7Wffn.js +5 -0
- package/browser/{chunk-LVItL87L.js → chunk-BrZnGAfk.js} +1 -1
- package/browser/{chunk-D202v_ff.js → chunk-Bu2KbiEO.js} +1 -1
- package/browser/{chunk-B6BZBDSv.js → chunk-C3kED08r.js} +5 -5
- package/browser/{chunk-Bu5Xq3QT.js → chunk-C4bnTLvT.js} +1 -1
- package/browser/{chunk-EBW8PloQ.js → chunk-C5I2MlRU.js} +1 -1
- package/browser/{chunk-ClEmA_ih.js → chunk-C9j9HPDY.js} +1 -1
- package/browser/{chunk-B626-rya.js → chunk-CEeAV-bb.js} +1 -1
- package/browser/{chunk-Brx_KbnM.js → chunk-CNQEET68.js} +1 -1
- package/browser/chunk-CNfTQeDy.js +1 -0
- package/browser/{chunk-DFQuWS_F.js → chunk-CR2xcumM.js} +1 -1
- package/browser/{chunk-BkN5jb4J.js → chunk-CUeRU4T-.js} +1 -1
- package/browser/chunk-Cno6SC-J.js +2 -0
- package/browser/{chunk-bfpuueWC.js → chunk-CorOD5-V.js} +3 -3
- package/browser/{chunk-B1OTuTxt.js → chunk-CvEqqOCm.js} +1 -1
- package/browser/{chunk-DQtoh8wv.js → chunk-Cwpn9dPE.js} +1 -1
- package/browser/{chunk-B7kKWG4P.js → chunk-Cx3RQESQ.js} +1 -1
- package/browser/{chunk-DO3lSvop.js → chunk-CxKynLjd.js} +1 -1
- package/browser/chunk-D8Bz7q-C.js +675 -0
- package/browser/{chunk-DCwEaE_b.js → chunk-DAyHNJOx.js} +1 -1
- package/browser/chunk-DBfSV0o-.js +2 -0
- package/browser/chunk-DEAo8Gsm.js +190 -0
- package/browser/{chunk-DKllQ3Ve.js → chunk-DHF4GvxN.js} +1 -1
- package/browser/chunk-DIhIuMRR.js +9 -0
- package/browser/chunk-DK7la0Zv.js +1 -0
- package/browser/{chunk-Bgd8Jkga.js → chunk-DKUyWR_o.js} +1 -1
- package/browser/chunk-DP1Oiy0T.js +1 -0
- package/browser/chunk-DSgmn8Nl.js +276 -0
- package/browser/{chunk-CUz5MHdA.js → chunk-DVVwrDwV.js} +1 -1
- package/browser/chunk-DWlwteaE.js +55 -0
- package/browser/{chunk-DxrynR3o.js → chunk-DXAodgYO.js} +1 -1
- package/browser/chunk-Ddy7zzYX.js +1 -0
- package/browser/{chunk-C5WD0UQE.js → chunk-DrITgtaw.js} +3 -3
- package/browser/{chunk-mrKeqPKc.js → chunk-Drt7fOvo.js} +1 -1
- package/browser/chunk-Dw8nvU1v.js +2 -0
- package/browser/{chunk-C2VdQfMJ.js → chunk-HERnQhug.js} +1 -1
- package/browser/{chunk-CKhGzoqa.js → chunk-RlCcRMQy.js} +1 -1
- package/browser/chunk-iwYQP1W9.js +1 -0
- package/browser/chunk-kXODoW4J.js +1 -0
- package/browser/{chunk-CXTwGKdl.js → chunk-nbZfjdVD.js} +1 -1
- package/browser/{chunk-DHb3-uKf.js → chunk-t5r49PeM.js} +1 -1
- package/browser/{chunk-B3-4EW3s.js → chunk-vG5Um99w.js} +1 -1
- package/browser/{chunk-BtEXE3Xz.js → chunk-vse5stCO.js} +1 -1
- package/browser/chunk-wricEDWB.js +1 -0
- package/browser/index.html +1 -1
- package/browser/main-K6RKSHKK.js +1811 -0
- package/package.json +1 -1
- package/browser/chunk-0njD_aMa.js +0 -2
- package/browser/chunk-6WIaUDav.js +0 -1
- package/browser/chunk-B7yga-a4.js +0 -1
- package/browser/chunk-BAWubWk8.js +0 -1
- package/browser/chunk-BDaTUrH4.js +0 -1
- package/browser/chunk-BJ5G7Y-a.js +0 -276
- package/browser/chunk-BTX631I3.js +0 -5
- package/browser/chunk-BYyTBqh4.js +0 -37
- package/browser/chunk-B_49KV6W.js +0 -1
- package/browser/chunk-BaO2vi_O.js +0 -675
- package/browser/chunk-BcT0wYqu.js +0 -2
- package/browser/chunk-BdJzYh5V.js +0 -190
- package/browser/chunk-BwDJA6_r.js +0 -55
- package/browser/chunk-C49BBPGm.js +0 -1
- package/browser/chunk-CNAj5Eon.js +0 -1
- package/browser/chunk-D-jBfPIO.js +0 -1
- package/browser/chunk-DMRb150M.js +0 -2
- package/browser/chunk-DjMtxVWg.js +0 -508
- package/browser/chunk-DqioJb1X.js +0 -1
- package/browser/chunk-DrzvCb86.js +0 -1
- package/browser/chunk-DwFGK2iu.js +0 -1
- package/browser/chunk-DxvmpOv5.js +0 -1
- package/browser/chunk-P8B5rz7L.js +0 -1
- package/browser/chunk-R-GmZrHu.js +0 -9
- package/browser/main-LBRSRTYI.js +0 -1811
|
@@ -1 +1 @@
|
|
|
1
|
-
import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-
|
|
1
|
+
import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-kXODoW4J.js';import {O}from'./chunk-CvEqqOCm.js';import {N}from'./chunk-vG5Um99w.js';import {g,ao as V,G,C as Ce,W as Wi,r as re,b as U$1,bS as Da,I as br,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,J as JC,t as sI,a8 as Kg,a9 as vC,aa as Cf,ab as Tf,ag as ET}from'./main-K6RKSHKK.js';import'./chunk-DIhIuMRR.js';import {W as Wn,S as Se}from'./chunk-D8Bz7q-C.js';import'./chunk-BEaYQhbI.js';import'./chunk-BhdMedPO.js';import'./chunk-B55TXBfo.js';import'./chunk-Bkwb10Tz.js';var z=()=>[];function W(o,e){if(o&1&&(Cs(0,"p",3),JC(1),hl()),o&2){let t=CC().$implicit;sI(),Kg(t.name);}}function U(o,e){if(o&1){let t=vC();Cs(0,"agentos-integration-config-item",5),kg("editRequested",function(){let i=Cf(t),r=CC(2);return Tf(r.onEdit(i))})("deleteRequested",function(){let i=Cf(t),r=CC(2);return Tf(r.onDelete(i))})("duplicateRequested",function(){let i=Cf(t),r=CC(2);return Tf(r.onDuplicate(i))}),hl();}if(o&2){let t=e,n=CC(2);_g("config",t.config)("scope",t.scope)("readOnly",t.scope==="platform"||t.scope==="namespace"&&!n.isAdmin());}}function X(o,e){if(o&1&&aC(0,W,2,1,"p",3)(1,U,1,3,"agentos-integration-config-item",4),o&2){let t,n=e.$implicit,i=CC();cC(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=g(V);router=g(G);destroyRef=g(Ce);state=g(N);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=Wi(false);listItems$=this.state.vm$.pipe(re(e=>this.toListItems(e)));isLoading=Wi(true);resolved=new Map;ngOnInit(){this.route.paramMap.pipe(U$1(this.destroyRef)).subscribe(e=>{let t=e.get("namespaceId")??"";t&&t!==this.namespaceId&&(this.namespaceId=t),this.state.setNamespace(t);}),this.route.paramMap.pipe(re(e=>e.get("namespaceId")??""),Da(e=>e?this.namespaceRole.isAdminOfNamespace$(e):br(false)),U$1(this.destroyRef)).subscribe(e=>this.isAdmin.set(e)),this.state.vm$.pipe(U$1(this.destroyRef)).subscribe(e=>{this.isLoading.set(false);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:n(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(U$1(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=jw({type:o,selectors:[["agentos-integrations-all-scopes"]],decls:5,vars:7,consts:[["integrationItemTpl",""],["title","Integrations","emptyMessage","No integrations available.","cardMinWidth","400px",3,"createRequested","items","loading","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&&(Cs(0,"ds-entity-list",1),gT(1,"async"),kg("createRequested",function(){return n.openCreateForm()}),Cs(2,"ds-icon-button",2),kg("action",function(){return n.goBack()}),hl()(),wg(3,X,2,1,"ng-template",null,0,ET)),t&2){let i=AC(4);_g("items",yT(1,4,n.listItems$)??dT(6,z))("loading",n.isLoading())("showCreate",true)("itemTemplate",i);}},dependencies:[Wn,O,Se,Lb],styles:[".integrations-all-scopes__empty[_ngcontent-%COMP%]{margin:0;padding:.65rem 1rem;font-size:.85rem;font-style:italic;color:var(--color-text-secondary)}"]})};export{j as IntegrationsAllScopesComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,
|
|
1
|
+
import {g,B as gy,P,I as br,r as re,K as x}from'./main-K6RKSHKK.js';var d=class i{http=g(gy);projectState=g(P);promptsCache=new Map;getBaseUrl(){return `/api/projects/${this.projectState.getSelectedProjectIdOrThrow()}/prompts`}listPrompts(){return this.http.get(this.getBaseUrl())}getPromptsAutocomplete(t,e){let r=this.promptsCache.get(t);return r?br(this.filterPromptsForAutocomplete(r,e)):this.http.get(`/api/projects/${t}/prompts`).pipe(re(p=>(this.promptsCache.set(t,p),this.filterPromptsForAutocomplete(p,e))))}filterPromptsForAutocomplete(t,e){let r=e.toLowerCase();return t.filter(o=>o.name.toLowerCase().includes(r)||o.description.toLowerCase().includes(r)).map(o=>({name:o.name,description:o.description,parameterFormat:o.parameterFormat}))}clearCache(t){t?this.promptsCache.delete(t):this.promptsCache.clear();}getPrompt(t){return this.http.get(`${this.getBaseUrl()}/${t}`)}createPrompt(t){return this.http.post(this.getBaseUrl(),t).pipe(re(e=>(this.clearCache(this.projectState.getSelectedProjectId()??void 0),e)))}updatePrompt(t,e){return this.http.put(`${this.getBaseUrl()}/${t}`,e).pipe(re(r=>(this.clearCache(this.projectState.getSelectedProjectId()??void 0),r)))}deletePrompt(t){return this.http.delete(`${this.getBaseUrl()}/${t}`).pipe(re(e=>(this.clearCache(this.projectState.getSelectedProjectId()??void 0),e)))}enableWebhook(t){return this.http.post(`${this.getBaseUrl()}/${t}/webhook`,{})}disableWebhook(t){return this.http.delete(`${this.getBaseUrl()}/${t}/webhook`)}static \u0275fac=function(e){return new(e||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};export{d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {A,k as kt,b as bt}from'./chunk-B9NYLAhC.js';import {S as St}from'./chunk-BqH7Wffn.js';import {E as Et,y as yt$1,G as Ge}from'./chunk-BWZcAdUl.js';import {g,G,P,U,E as N,p as pe$1,H as c,C as Ce$1,W as Wi,F as F$1,T as TT,b as U$1,j as jw,h as hr,e as pr,k as Cs,J as JC,m as hl,n as kg,o as aC,q as dC,t as sI,_ as _g,u as cC,v as fC,w as zg,S as Sg,r as re,ca as _e$1,K as x,an as ue$1,ap as zy,l as le$1,V,M as Mg,a9 as vC,aa as Cf,ac as CC,ab as Tf,a8 as Kg,a5 as Dl}from'./main-K6RKSHKK.js';import'./chunk-3m_nS8Y5.js';import'./chunk-BWLCegs8.js';import'./chunk-CorOD5-V.js';import'./chunk-BEaYQhbI.js';import {y as yt,w as wt}from'./chunk-BhdMedPO.js';var R=class n{threadState=g(U);codayService=g(Ge);threadList=F$1(this.threadState.threadList$,{initialValue:[]});selectedThread=F$1(this.threadState.selectedThread$,{initialValue:null});isThinking=F$1(this.codayService.isThinking$,{initialValue:false});inviteEvent=F$1(this.codayService.currentInviteEvent$.pipe(re(t=>t?.invite===_e$1?null:t)),{initialValue:null});tasks=TT(()=>{let t=this.threadList(),e=this.selectedThread(),r=this.isThinking(),o=this.inviteEvent();return t.filter(i=>!i.parentThreadId).map(i=>{let m=!!e&&i.id===e.id;return {id:i.id,name:i.name,summary:i.summary,modifiedDate:i.modifiedDate,starring:i.starring??[],users:i.users??[],status:this.deriveStatus(i,m,r,!!o),isActive:m,worktreeProject:i.worktreeProject}}).sort((i,m)=>{let q=kt[i.status]-kt[m.status];return q!==0?q:i.modifiedDate>m.modifiedDate?-1:1})});deriveStatus(t,e,r,o){let i=Date.now()-new Date(t.modifiedDate).getTime();return t.closedByUser?"done":t.pendingInvite?"waiting-you":e?r?"in-progress":"paused":i<bt?"in-progress":"paused"}static \u0275fac=function(e){return new(e||n)};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};var F=class n{projectState=g(P);threadState=g(U);destroy$=new ue$1;eventSource=null;currentProject=null;constructor(){this.projectState.selectedProject$.pipe(zy(this.destroy$)).subscribe(t=>{let e=t?.name??null;e!==this.currentProject&&(this.disconnect(),e&&this.connect(e));});}connect(t,e=5e3){this.currentProject=t;let r=`/api/projects/${encodeURIComponent(t)}/event-stream`;console.log(`[PROJECT_SSE] Connecting to ${r}`),this.eventSource=new EventSource(r),this.eventSource.onmessage=o=>{try{let i=JSON.parse(o.data),m=le$1(i);if(!m)return;m instanceof V&&(console.log("[PROJECT_SSE] ThreadUpdateEvent \u2014 refreshing thread list"),this.threadState.refreshThreadList());}catch(i){console.warn("[PROJECT_SSE] Failed to parse event:",i);}},this.eventSource.onerror=()=>{this.eventSource?.readyState===EventSource.CLOSED&&(console.warn(`[PROJECT_SSE] Connection closed for ${t}, reconnecting in ${e}ms`),this.eventSource=null,setTimeout(()=>{this.currentProject===t&&this.connect(t,Math.min(e*2,6e4));},e));};}disconnect(){this.eventSource&&(this.eventSource.close(),this.eventSource=null,console.log(`[PROJECT_SSE] Disconnected from project ${this.currentProject}`)),this.currentProject=null;}ngOnDestroy(){this.disconnect(),this.destroy$.next(),this.destroy$.complete();}static \u0275fac=function(e){return new(e||n)};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};var ce=(n,t)=>t.key,de=(n,t)=>t.status,le=(n,t)=>t.id;function pe(n,t){n&1&&Mg(0,"mat-spinner",6);}function me(n,t){n&1&&(Cs(0,"mat-icon"),JC(1,"add"),hl());}function ue(n,t){if(n&1&&(Cs(0,"span",16),JC(1),hl()),n&2){let e=CC().$implicit,r=CC();sI(),Kg(r.filterCounts()[e.key]);}}function ge(n,t){if(n&1){let e=vC();Cs(0,"button",15),kg("click",function(){let o=Cf(e).$implicit,i=CC();return Tf(i.setFilter(o.key))}),Cs(1,"mat-icon",10),JC(2),hl(),Cs(3,"span"),JC(4),hl(),aC(5,ue,2,1,"span",16),hl();}if(n&2){let e=t.$implicit,r=CC();zg("active",r.activeFilter()===e.key),Sg("aria-selected",r.activeFilter()===e.key),sI(2),Kg(e.icon),sI(2),Kg(e.label),sI(),cC(r.filterCounts()[e.key]>0?5:-1);}}function _e(n,t){n&1&&(Cs(0,"div",12),Mg(1,"mat-spinner",17),Cs(2,"p"),JC(3,"Loading tasks\u2026"),hl()());}function fe(n,t){if(n&1){let e=vC();Cs(0,"p"),JC(1,"No tasks yet. Start your first one!"),hl(),Cs(2,"button",19),kg("click",function(){Cf(e);let o=CC(2);return Tf(o.createTask())}),Cs(3,"mat-icon"),JC(4,"add"),hl(),JC(5," New Task "),hl();}}function he(n,t){n&1&&(Cs(0,"p"),JC(1,"No tasks in this category."),hl());}function ke(n,t){if(n&1&&(Cs(0,"div",13)(1,"mat-icon",18),JC(2,"rocket_launch"),hl(),aC(3,fe,6,0)(4,he,2,0,"p"),hl()),n&2){let e=CC();sI(3),cC(e.activeFilter()==="all"?3:4);}}function ve(n,t){if(n&1){let e=vC();Cs(0,"app-task-card",25),kg("stopRequested",function(o){Cf(e);let i=CC(3);return Tf(i.onStopRequested(o))})("deleteRequested",function(o){Cf(e);let i=CC(3);return Tf(i.onDeleteRequested(o))})("starToggled",function(o){Cf(e);let i=CC(3);return Tf(i.onStarToggled(o))})("markDoneRequested",function(o){Cf(e);let i=CC(3);return Tf(i.onMarkDoneRequested(o))})("markActiveRequested",function(o){Cf(e);let i=CC(3);return Tf(i.onMarkActiveRequested(o))}),hl();}if(n&2){let e=t.$implicit;_g("task",e);}}function Ce(n,t){if(n&1&&(Cs(0,"section",20)(1,"h2",21)(2,"mat-icon",22),JC(3),hl(),JC(4),Cs(5,"span",23),JC(6),hl()(),Cs(7,"div",14),dC(8,ve,1,1,"app-task-card",24,le),hl()()),n&2){let e=t.$implicit;sI(3),Kg(e.icon),sI(),Dl(" ",e.label," "),sI(2),Kg(e.tasks.length),sI(2),fC(e.tasks);}}function be(n,t){if(n&1&&dC(0,Ce,10,3,"section",20,de),n&2){let e=CC();fC(e.taskGroups());}}function ye(n,t){if(n&1){let e=vC();Cs(0,"app-task-card",25),kg("stopRequested",function(o){Cf(e);let i=CC(2);return Tf(i.onStopRequested(o))})("deleteRequested",function(o){Cf(e);let i=CC(2);return Tf(i.onDeleteRequested(o))})("starToggled",function(o){Cf(e);let i=CC(2);return Tf(i.onStarToggled(o))})("markDoneRequested",function(o){Cf(e);let i=CC(2);return Tf(i.onMarkDoneRequested(o))})("markActiveRequested",function(o){Cf(e);let i=CC(2);return Tf(i.onMarkActiveRequested(o))}),hl();}if(n&2){let e=t.$implicit;_g("task",e);}}function xe(n,t){if(n&1&&(Cs(0,"div",14),dC(1,ye,1,1,"app-task-card",24,le),hl()),n&2){let e=CC();sI(),fC(e.filteredTasks());}}var Te=[{key:"all",label:"All",icon:"grid_view"},{key:"waiting-you",label:"Waiting for you",icon:"mark_unread_chat_alt"},{key:"in-progress",label:"In progress",icon:"pending"},{key:"paused",label:"Paused",icon:"pause_circle"},{key:"done",label:"Done",icon:"check_circle"}],se=class n{router=g(G);projectState=g(P);threadState=g(U);threadApi=g(N);taskStatus=g(R);userService=g(pe$1);projectApi=g(c);destroyRef=g(Ce$1);_projectEventStream=g(F);filters=Te;activeFilter=Wi("all");starredOnly=Wi(false);isCreating=Wi(false);isLoadingList=F$1(this.threadState.isLoadingThreadList$,{initialValue:false});username=F$1(this.userService.username$,{initialValue:null});allTasks=this.taskStatus.tasks;filteredTasks=TT(()=>{let t=this.activeFilter(),e=this.username(),r=this.allTasks();return this.starredOnly()&&e&&(r=r.filter(o=>o.starring.includes(e))),t==="all"?r:r.filter(o=>o.status===t)});filterCounts=TT(()=>{let t=this.username(),e=this.allTasks();return this.starredOnly()&&t&&(e=e.filter(r=>r.starring.includes(t))),{all:e.length,"waiting-you":e.filter(r=>r.status==="waiting-you").length,"in-progress":e.filter(r=>r.status==="in-progress").length,paused:e.filter(r=>r.status==="paused").length,done:e.filter(r=>r.status==="done").length}});taskGroups=TT(()=>{let t=this.username(),e=this.allTasks();this.starredOnly()&&t&&(e=e.filter(o=>o.starring.includes(t)));let r=[{status:"waiting-you",label:"Waiting for you",icon:"mark_unread_chat_alt",tasks:[]},{status:"in-progress",label:"In progress",icon:"pending",tasks:[]},{status:"done",label:"Done",icon:"check_circle",tasks:[]},{status:"paused",label:"Paused",icon:"pause_circle",tasks:[]},{status:"error",label:"Error",icon:"error",tasks:[]}];for(let o of e){let i=r.find(m=>m.status===o.status);i&&i.tasks.push(o);}return r.filter(o=>o.tasks.length>0)});ngOnInit(){this.userService.fetchCurrentUser().pipe(U$1(this.destroyRef)).subscribe({error:t=>console.warn("[TASK-CONTROL] Could not fetch user:",t)});}setFilter(t){this.activeFilter.set(t);}toggleStarredFilter(){this.starredOnly.update(t=>!t);}createTask(){let t=this.projectState.getSelectedProjectId();!t||this.isCreating()||(this.isCreating.set(true),this.threadApi.createThread().pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.isCreating.set(false),this.router.navigate(["project",t,"thread",e.thread.id]);},error:e=>{console.error("[TASK-CONTROL] Failed to create thread:",e),this.isCreating.set(false);}}));}onStopRequested(t){this.threadApi.stopThread(t).pipe(U$1(this.destroyRef)).subscribe({error:e=>console.error("[TASK-CONTROL] Failed to stop thread:",e)});}onDeleteRequested(t){this.threadApi.deleteThread(t).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.threadState.refreshThreadList(),error:e=>console.error("[TASK-CONTROL] Failed to delete thread:",e)});}onStarToggled(t){let e=this.username();if(!e)return;let r=this.allTasks().find(m=>m.id===t);if(!r)return;let o=r.starring.includes(e),i=o?this.threadApi.unstarThread(t):this.threadApi.starThread(t);this.threadState.updateStarLocal(t,!o,e),i.pipe(U$1(this.destroyRef)).subscribe({error:m=>{console.error("[TASK-CONTROL] Failed to toggle star:",m),this.threadState.refreshThreadList();}});}onMarkDoneRequested(t){let e=this.projectState.getSelectedProjectId();e&&this.projectApi.markThreadDone(e,t).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.threadState.refreshThreadList(),error:r=>console.error("[TASK-CONTROL] Failed to mark task as done:",r)});}onMarkActiveRequested(t){let e=this.projectState.getSelectedProjectId();e&&this.projectApi.markThreadActive(e,t).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.threadState.refreshThreadList(),error:r=>console.error("[TASK-CONTROL] Failed to mark task as active:",r)});}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=jw({type:n,selectors:[["app-task-control"]],decls:25,vars:6,consts:[[1,"task-control"],[1,"tc-header"],[1,"tc-title-row"],[1,"tc-title"],[1,"title-icon"],["mat-flat-button","","aria-label","Start a new task",1,"new-task-btn",3,"click","disabled"],["diameter","16"],["role","tablist","aria-label","Filter tasks",1,"tc-filters"],["role","tab",1,"filter-chip",3,"active"],["role","switch","aria-label","Show starred tasks only",1,"filter-chip","starred-filter",3,"click"],[1,"filter-icon"],[1,"tc-grid-wrapper"],[1,"tc-loading"],[1,"tc-empty"],[1,"tc-grid"],["role","tab",1,"filter-chip",3,"click"],[1,"filter-badge"],["diameter","40"],[1,"empty-icon"],["mat-flat-button","",1,"new-task-btn",3,"click"],[1,"tc-group"],[1,"tc-group-title"],[1,"group-icon"],[1,"group-count"],[3,"task"],[3,"stopRequested","deleteRequested","starToggled","markDoneRequested","markActiveRequested","task"]],template:function(e,r){e&1&&(Cs(0,"app-sidenav")(1,"div",0)(2,"header",1)(3,"div",2)(4,"h1",3)(5,"mat-icon",4),JC(6,"rocket_launch"),hl(),JC(7," Task Control "),hl(),Cs(8,"button",5),kg("click",function(){return r.createTask()}),aC(9,pe,1,0,"mat-spinner",6)(10,me,2,0,"mat-icon"),JC(11," New Task "),hl()(),Cs(12,"nav",7),dC(13,ge,6,6,"button",8,ce),Cs(15,"button",9),kg("click",function(){return r.toggleStarredFilter()}),Cs(16,"mat-icon",10),JC(17,"star"),hl(),Cs(18,"span"),JC(19,"Starred"),hl()()()(),Cs(20,"main",11),aC(21,_e,4,0,"div",12)(22,ke,5,1,"div",13)(23,be,2,0)(24,xe,3,0,"div",14),hl()()()),e&2&&(sI(8),_g("disabled",r.isCreating()),sI(),cC(r.isCreating()?9:10),sI(4),fC(r.filters),sI(2),zg("active",r.starredOnly()),Sg("aria-checked",r.starredOnly()),sI(6),cC(r.isLoadingList()?21:r.filteredTasks().length===0?22:r.activeFilter()==="all"?23:24));},dependencies:[A,St,yt,wt,hr,pr,Et,yt$1],styles:[".glass-panel[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow)}.glass-interactive[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);transition:all .3s cubic-bezier(.4,0,.2,1)}.glass-interactive[_ngcontent-%COMP%]:hover{transform:translateY(-2px);box-shadow:0 12px 40px #00000026}.glass-interactive[_ngcontent-%COMP%]:active{transform:translateY(0)}.glass-card[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);border-radius:20px;padding:1.5rem}.glass-button[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);transition:all .3s cubic-bezier(.4,0,.2,1)}.glass-button[_ngcontent-%COMP%]:hover{transform:translateY(-2px);box-shadow:0 12px 40px #00000026}.glass-button[_ngcontent-%COMP%]:active{transform:translateY(0)}.glass-button[_ngcontent-%COMP%]{border-radius:12px;padding:.75rem 1.5rem;font-weight:600;cursor:pointer}.glass-button[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed;transform:none}.glass-button[_ngcontent-%COMP%]:disabled:hover{transform:none}.smooth-theme-transition[_ngcontent-%COMP%]{transition:background .3s ease,color .3s ease,border-color .3s ease,box-shadow .3s ease}[_nghost-%COMP%]{display:flex;height:100vh;width:100%;overflow:hidden}.task-control[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%;overflow:hidden;padding:1.5rem;gap:1.25rem;box-sizing:border-box}.tc-header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;flex-shrink:0}.tc-title-row[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:1rem}.tc-title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text)}.tc-title[_ngcontent-%COMP%] .title-icon[_ngcontent-%COMP%]{font-size:1.5rem;width:1.5rem;height:1.5rem;color:var(--color-primary)}.new-task-btn[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;background:var(--color-primary);color:var(--color-text-inverse);border-radius:12px;font-weight:600;padding:0 1rem;height:36px;flex-shrink:0}.new-task-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.1rem;width:1.1rem;height:1.1rem}.new-task-btn[_ngcontent-%COMP%] mat-spinner[_ngcontent-%COMP%]{display:inline-block}.tc-filters[_ngcontent-%COMP%]{display:flex;gap:.5rem;flex-wrap:wrap}.filter-chip[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);display:flex;align-items:center;gap:.375rem;padding:.375rem .875rem;border-radius:100px;font-size:.8rem;font-weight:500;color:var(--color-text-secondary);cursor:pointer;border:1px solid var(--color-border);transition:background .15s ease,color .15s ease,border-color .15s ease;white-space:nowrap}.filter-chip[_ngcontent-%COMP%] .filter-icon[_ngcontent-%COMP%]{font-size:.9rem;width:.9rem;height:.9rem}.filter-chip[_ngcontent-%COMP%] .filter-badge[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-text-inverse);border-radius:100px;padding:0 .375rem;font-size:.7rem;font-weight:700;min-width:18px;text-align:center;line-height:18px}.filter-chip.active[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-text-inverse);border-color:var(--color-primary)}.filter-chip.active[_ngcontent-%COMP%] .filter-icon[_ngcontent-%COMP%]{color:var(--color-text-inverse)}.filter-chip.active[_ngcontent-%COMP%] .filter-badge[_ngcontent-%COMP%]{background:#ffffff4d;color:var(--color-text-inverse)}.filter-chip[_ngcontent-%COMP%]:hover:not(.active){background:var(--color-bg-hover);color:var(--color-text)}.starred-filter.active[_ngcontent-%COMP%]{background:#f5a62326;border-color:#f5a623;color:#f5a623}.starred-filter.active[_ngcontent-%COMP%] .filter-icon[_ngcontent-%COMP%]{color:#f5a623}.tc-group[_ngcontent-%COMP%]{margin-bottom:1.5rem}.tc-group[_ngcontent-%COMP%]:last-child{margin-bottom:0}.tc-group-title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin:0 0 .75rem;font-size:.85rem;font-weight:600;color:var(--color-text-secondary);text-transform:uppercase;letter-spacing:.05em}.tc-group-title[_ngcontent-%COMP%] .group-icon[_ngcontent-%COMP%]{font-size:1rem;width:1rem;height:1rem}.tc-group-title[_ngcontent-%COMP%] .group-count[_ngcontent-%COMP%]{background:var(--color-bg-hover);border-radius:100px;padding:0 .375rem;font-size:.75rem;font-weight:700;min-width:18px;text-align:center;line-height:18px}.tc-grid-wrapper[_ngcontent-%COMP%]{flex:1;overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--color-border) transparent}.tc-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:1rem;padding-bottom:1rem}@media(max-width:600px){.tc-grid[_ngcontent-%COMP%]{grid-template-columns:1fr}}.tc-loading[_ngcontent-%COMP%], .tc-empty[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1rem;height:100%;min-height:240px;color:var(--color-text-secondary);text-align:center}.tc-loading[_ngcontent-%COMP%] p[_ngcontent-%COMP%], .tc-empty[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;font-size:.95rem}.empty-icon[_ngcontent-%COMP%]{font-size:3rem;width:3rem;height:3rem;opacity:.3}"]})};export{se as TaskControlComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {l}from'./chunk-DIhIuMRR.js';import {g,dg as Z,dh as T,I as br,bS as Da,r as re,a7 as va,cE as kd,K as x}from'./main-K6RKSHKK.js';var v=class i{userState=g(l);membership=g(Z);currentUser$=T(this.userState.currentUser);cache=new Map;isAdminOfNamespace$(e){if(!e)return br(false);let t=this.cache.get(e);if(t)return t;let s=this.currentUser$.pipe(Da(a=>a?a.isAdmin?br(true):this.membership.getMembersNamespaceMembership(e).pipe(re(d=>d.some(n=>n.id===a.id&&n.role==="ADMIN")),va(()=>br(false))):br(false)),kd({bufferSize:1,refCount:false}));return this.cache.set(e,s),s}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};export{v};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {R}from'./chunk-BAWubWk8.js';import {g,ao as V,G,dm as k,w as we,a as Gi,E as ET,W as Vy,a7 as va,X as br,c as U,h as Fw,m as ws,o as Rg,Q as QC,n as hl,q as oC,t as nI,x as iC,a9 as gC,a3 as GI,r as cC,ac as EC,v as bg,a6 as qI,y as uC,a5 as Dl,a8 as Yg,A as Ug,b0 as Qg,aa as wf,ab as Cf}from'./main-LBRSRTYI.js';import'./chunk-R-GmZrHu.js';import {t as ti,Q as Qn,e as ei,Y as Ye,A as At,Z as Zn,c as cn}from'./chunk-BYyTBqh4.js';import'./chunk-BDaTUrH4.js';import'./chunk-ClSDInQq.js';import'./chunk-BaO2vi_O.js';import'./chunk-DjMtxVWg.js';var $=(i,e)=>e.id;function J(i,e){i&1&&(ws(0,"p",5),QC(1,"Loading\u2026"),hl());}function q(i,e){if(i&1&&(ws(0,"p",8),QC(1),hl()),i&2){let t=EC(2);nI(),Yg(t.errorMessage());}}function Q(i,e){if(i&1&&(ws(0,"span",26),QC(1),hl()),i&2){let t=EC(3);nI(),Yg(t.association()?.checkoutFailureReason);}}function W(i,e){if(i&1&&(ws(0,"p",25),QC(1),oC(2,Q,2,1,"span",26),hl()),i&2){let t=EC(2);Ug("namespace-git__status--failed",t.checkoutStatus()==="FAILED")("namespace-git__status--ready",t.checkoutStatus()==="READY"),nI(),Dl(" Repository: ",t.checkoutStatus()," "),nI(),iC(t.association()?.checkoutFailureReason?2:-1);}}function X(i,e){if(i&1&&(ws(0,"option",19),QC(1),hl()),i&2){let t=e.$implicit,l=EC(2);bg("value",t.id),nI(),Qg("",t.name," (",l.authTypeLabel(t.authType),")");}}function Z(i,e){i&1&&(ws(0,"span",20),QC(1," No usable auth setting in this namespace. Create a BEARER_TOKEN one first. "),hl());}function ee(i,e){if(i&1){let t=gC();ws(0,"button",27),Rg("click",function(){wf(t);let c=EC(2);return Cf(c.remove())}),QC(1," Remove association "),hl();}if(i&2){let t=EC(2);bg("disabled",t.isSaving());}}function te(i,e){if(i&1){let t=gC();ws(0,"div",6)(1,"p",7),QC(2," Associate a repository with this namespace and prepare an internal clone. Namespace files remain shared documents outside Git. "),hl(),oC(3,q,2,1,"p",8),oC(4,W,3,6,"p",9),ws(5,"fieldset",10)(6,"legend",11),QC(7,"Repository"),hl(),ws(8,"label",12)(9,"span",13),QC(10,"Repository URL"),hl(),ws(11,"input",14),Rg("ngModelChange",function(c){wf(t);let v=EC();return Cf(v.repositoryUrl.set(c))}),hl(),GI(),ws(12,"span",15),QC(13,"HTTPS only, without credentials in the URL."),hl()(),ws(14,"label",12)(15,"span",13),QC(16,"Main branch"),hl(),ws(17,"input",16),Rg("ngModelChange",function(c){wf(t);let v=EC();return Cf(v.mainBranch.set(c))}),hl(),GI(),ws(18,"span",15),QC(19,"The internal clone starts from this remote branch."),hl()(),ws(20,"label",12)(21,"span",13),QC(22,"Service account"),hl(),ws(23,"select",17),Rg("ngModelChange",function(c){wf(t);let v=EC();return Cf(v.serviceAuthSettingId.set(c))}),ws(24,"option",18),QC(25,"Select an auth setting\u2026"),hl(),cC(26,X,2,3,"option",19,$),hl(),GI(),ws(28,"span",15),QC(29," Shared by the namespace. Every Git operation uses this identity, never the identity of whoever opened the case. "),hl(),oC(30,Z,2,0,"span",20),hl()(),ws(31,"div",21)(32,"button",22),Rg("click",function(){wf(t);let c=EC();return Cf(c.save())}),QC(33),hl(),oC(34,ee,2,1,"button",23),ws(35,"button",24),Rg("click",function(){wf(t);let c=EC();return Cf(c.cancel())}),QC(36,"Cancel"),hl()()();}if(i&2){let t=EC();nI(3),iC(t.errorMessage()?3:-1),nI(),iC(t.isAssociated()&&t.checkoutStatus()?4:-1),nI(7),bg("ngModel",t.repositoryUrl()),qI(),nI(6),bg("ngModel",t.mainBranch()),qI(),nI(6),bg("ngModel",t.serviceAuthSettingId()),qI(),nI(3),uC(t.eligibleAuthSettings()),nI(4),iC(t.eligibleAuthSettings().length===0?30:-1),nI(2),bg("disabled",!t.canSave()),nI(),Dl(" ",t.isSaving()?"Saving\u2026":t.isAssociated()?"Update":"Associate"," "),nI(),iC(t.isAssociated()?34:-1);}}var ne=["BearerTokenAuthSetting","BasicAuthAuthSetting","ApiKeyAuthSetting"],ie={BearerTokenAuthSetting:"token",BasicAuthAuthSetting:"basic auth",ApiKeyAuthSetting:"API key"},j=class i{route=g(V);router=g(G);gitApi=g(k);authSettingState=g(R);destroyRef=g(we);isLoading=Gi(true);isSaving=Gi(false);errorMessage=Gi(null);association=Gi(null);authSettings=Gi([]);repositoryUrl=Gi("");mainBranch=Gi("main");serviceAuthSettingId=Gi("");namespaceId="";isAssociated=ET(()=>this.association()?.associated===true);eligibleAuthSettings=ET(()=>this.authSettings().filter(e=>ne.includes(e.authType)));authTypeLabel(e){return ie[e??""]??e??"unknown"}canSave=ET(()=>this.repositoryUrl().trim().length>0&&this.serviceAuthSettingId().length>0&&!this.isSaving());checkoutStatus=ET(()=>this.association()?.checkoutStatus??null);ngOnInit(){this.namespaceId=this.route.snapshot.paramMap.get("namespaceId")??"",this.load();}load(){this.isLoading.set(true),Vy({association:this.gitApi.getAssociationNamespaceGit(this.namespaceId).pipe(va(e=>(console.error("Failed to load the Git association",e),this.errorMessage.set(this.messageOf(e)),br(null)))),authSettings:this.authSettingState.loadNamespaceSettings(this.namespaceId).pipe(va(e=>(console.error("Failed to load namespace auth settings",e),br([]))))}).pipe(U(this.destroyRef)).subscribe(({association:e,authSettings:t})=>{this.authSettings.set(t??[]),e&&(this.association.set(e),this.applyToForm(e)),this.isLoading.set(false);});}applyToForm(e){this.repositoryUrl.set(e.repositoryUrl??""),this.mainBranch.set(e.mainBranch??"main"),this.serviceAuthSettingId.set(e.serviceAuthSettingId??"");}save(){this.canSave()&&(this.isSaving.set(true),this.errorMessage.set(null),this.gitApi.setAssociationNamespaceGit(this.namespaceId,{repositoryUrl:this.repositoryUrl().trim(),mainBranch:this.mainBranch().trim()||void 0,serviceAuthSettingId:this.serviceAuthSettingId()}).pipe(U(this.destroyRef),va(e=>(console.error("Failed to save the Git association",e),this.errorMessage.set(this.messageOf(e)),this.isSaving.set(false),br(null)))).subscribe(e=>{e&&(this.association.set(e),this.applyToForm(e)),this.isSaving.set(false);}));}remove(){confirm("Remove the repository association? The internal clone is preserved.")&&(this.isSaving.set(true),this.gitApi.removeAssociationNamespaceGit(this.namespaceId).pipe(U(this.destroyRef),va(e=>(console.error("Failed to remove the Git association",e),this.errorMessage.set(this.messageOf(e)),this.isSaving.set(false),br(null)))).subscribe(e=>{e&&(this.association.set(e),this.applyToForm(e)),this.isSaving.set(false);}));}cancel(){this.router.navigate(["/agentos/namespaces"]);}messageOf(e){return e.error?.message??e.message??"Unexpected error"}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=Fw({type:i,selectors:[["agentos-namespace-git"]],decls:10,vars:1,consts:[[1,"namespace-git"],[1,"namespace-git__header"],["type","button","title","Back to namespaces",1,"namespace-git__back",3,"click"],[1,"namespace-git__back-icon"],[1,"namespace-git__title"],[1,"namespace-git__loading"],[1,"namespace-git__body"],[1,"namespace-git__hint"],["role","alert",1,"namespace-git__error"],[1,"namespace-git__status",3,"namespace-git__status--failed","namespace-git__status--ready"],[1,"namespace-git__section"],[1,"namespace-git__label"],[1,"namespace-git__field"],[1,"namespace-git__field-label"],["type","url","placeholder","https://forge.example/org/project.git","name","repositoryUrl",1,"namespace-git__input",3,"ngModelChange","ngModel"],[1,"namespace-git__field-hint"],["type","text","placeholder","main","name","mainBranch",1,"namespace-git__input",3,"ngModelChange","ngModel"],["name","serviceAuthSettingId",1,"namespace-git__input",3,"ngModelChange","ngModel"],["value",""],[3,"value"],[1,"namespace-git__field-hint","namespace-git__field-hint--warn"],[1,"namespace-git__actions"],["type","button",1,"namespace-git__save",3,"click","disabled"],["type","button",1,"namespace-git__remove",3,"disabled"],["type","button",1,"namespace-git__cancel",3,"click"],[1,"namespace-git__status"],[1,"namespace-git__status-reason"],["type","button",1,"namespace-git__remove",3,"click","disabled"]],template:function(t,l){t&1&&(ws(0,"div",0)(1,"header",1)(2,"button",2),Rg("click",function(){return l.cancel()}),ws(3,"span",3),QC(4,"\u2190"),hl(),QC(5," Namespaces "),hl(),ws(6,"h1",4),QC(7,"Git repository"),hl()(),oC(8,J,2,0,"p",5)(9,te,37,9,"div",6),hl()),t&2&&(nI(8),iC(l.isLoading()?8:9));},dependencies:[ti,Qn,ei,Ye,At,Zn,cn],styles:[".namespace-git[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.namespace-git__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.namespace-git__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.namespace-git__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.namespace-git__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem}.namespace-git__body[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.namespace-git__hint[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6b7280)}.namespace-git__error[_ngcontent-%COMP%]{margin:0;padding:.75rem;border-radius:.375rem;background:var(--red-bg, #fef2f2);color:var(--color-error, #b91c1c);font-size:.875rem}.namespace-git__status[_ngcontent-%COMP%]{margin:0;padding:.5rem .75rem;border-radius:.375rem;background:var(--color-surface-secondary, #f3f4f6);font-size:.875rem;display:flex;flex-direction:column;gap:.25rem}.namespace-git__status--ready[_ngcontent-%COMP%]{background:var(--color-success-bg, #ecfdf5);color:var(--color-success, #047857)}.namespace-git__status--failed[_ngcontent-%COMP%]{background:var(--red-bg, #fef2f2);color:var(--color-error, #b91c1c)}.namespace-git__status-reason[_ngcontent-%COMP%]{font-size:.8125rem;opacity:.9}.namespace-git__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;border:1px solid var(--color-border, #e5e7eb);border-radius:.5rem;padding:1rem;margin:0}.namespace-git__label[_ngcontent-%COMP%]{font-weight:600;font-size:.9375rem;padding:0 .25rem}.namespace-git__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.namespace-git__field-label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500}.namespace-git__field-hint[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-text-secondary, #6b7280)}.namespace-git__field-hint--warn[_ngcontent-%COMP%]{color:var(--color-warning, #b45309)}.namespace-git__input[_ngcontent-%COMP%]{font-family:inherit;font-size:.875rem;padding:.5rem .625rem;border:1px solid var(--color-border, #e5e7eb);border-radius:.375rem;background:var(--color-surface, #fff);color:inherit}.namespace-git__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;align-items:center}.namespace-git__save[_ngcontent-%COMP%], .namespace-git__remove[_ngcontent-%COMP%], .namespace-git__cancel[_ngcontent-%COMP%]{font-family:inherit;font-size:.875rem;padding:.5rem 1rem;border-radius:.375rem;cursor:pointer;border:1px solid transparent}.namespace-git__save[_ngcontent-%COMP%]:disabled, .namespace-git__remove[_ngcontent-%COMP%]:disabled, .namespace-git__cancel[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.namespace-git__save[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);color:var(--color-text-on-accent, #fff)}.namespace-git__remove[_ngcontent-%COMP%]{background:none;border-color:var(--color-error, #b91c1c);color:var(--color-error, #b91c1c)}.namespace-git__cancel[_ngcontent-%COMP%]{background:none;border-color:var(--color-border, #e5e7eb);color:inherit}"]})};
|
|
1
|
+
import {R}from'./chunk-BiwhEkuA.js';import {g,ao as V,G,dq as k,C as Ce,W as Wi,T as TT,$ as $y,a7 as va,I as br,b as U,j as jw,k as Cs,n as kg,J as JC,m as hl,o as aC,t as sI,u as cC,a9 as vC,a3 as ZI,q as dC,ac as CC,_ as _g,a6 as QI,v as fC,a5 as Dl,a8 as Kg,w as zg,b0 as Xg,aa as Cf,ab as Tf}from'./main-K6RKSHKK.js';import'./chunk-DIhIuMRR.js';import {t as ti,Q as Qn,e as ei,Y as Ye,A as At,Z as Zn,c as cn}from'./chunk-BhdMedPO.js';import'./chunk-B55TXBfo.js';import'./chunk-Bkwb10Tz.js';import'./chunk-D8Bz7q-C.js';import'./chunk-BEaYQhbI.js';var $=(i,e)=>e.id;function J(i,e){i&1&&(Cs(0,"p",5),JC(1,"Loading\u2026"),hl());}function q(i,e){if(i&1&&(Cs(0,"p",8),JC(1),hl()),i&2){let t=CC(2);sI(),Kg(t.errorMessage());}}function Q(i,e){if(i&1&&(Cs(0,"span",26),JC(1),hl()),i&2){let t=CC(3);sI(),Kg(t.association()?.checkoutFailureReason);}}function W(i,e){if(i&1&&(Cs(0,"p",25),JC(1),aC(2,Q,2,1,"span",26),hl()),i&2){let t=CC(2);zg("namespace-git__status--failed",t.checkoutStatus()==="FAILED")("namespace-git__status--ready",t.checkoutStatus()==="READY"),sI(),Dl(" Repository: ",t.checkoutStatus()," "),sI(),cC(t.association()?.checkoutFailureReason?2:-1);}}function X(i,e){if(i&1&&(Cs(0,"option",19),JC(1),hl()),i&2){let t=e.$implicit,l=CC(2);_g("value",t.id),sI(),Xg("",t.name," (",l.authTypeLabel(t.authType),")");}}function Z(i,e){i&1&&(Cs(0,"span",20),JC(1," No usable auth setting in this namespace. Create a BEARER_TOKEN one first. "),hl());}function ee(i,e){if(i&1){let t=vC();Cs(0,"button",27),kg("click",function(){Cf(t);let c=CC(2);return Tf(c.remove())}),JC(1," Remove association "),hl();}if(i&2){let t=CC(2);_g("disabled",t.isSaving());}}function te(i,e){if(i&1){let t=vC();Cs(0,"div",6)(1,"p",7),JC(2," Associate a repository with this namespace and prepare an internal clone. Namespace files remain shared documents outside Git. "),hl(),aC(3,q,2,1,"p",8),aC(4,W,3,6,"p",9),Cs(5,"fieldset",10)(6,"legend",11),JC(7,"Repository"),hl(),Cs(8,"label",12)(9,"span",13),JC(10,"Repository URL"),hl(),Cs(11,"input",14),kg("ngModelChange",function(c){Cf(t);let v=CC();return Tf(v.repositoryUrl.set(c))}),hl(),ZI(),Cs(12,"span",15),JC(13,"HTTPS only, without credentials in the URL."),hl()(),Cs(14,"label",12)(15,"span",13),JC(16,"Main branch"),hl(),Cs(17,"input",16),kg("ngModelChange",function(c){Cf(t);let v=CC();return Tf(v.mainBranch.set(c))}),hl(),ZI(),Cs(18,"span",15),JC(19,"The internal clone starts from this remote branch."),hl()(),Cs(20,"label",12)(21,"span",13),JC(22,"Service account"),hl(),Cs(23,"select",17),kg("ngModelChange",function(c){Cf(t);let v=CC();return Tf(v.serviceAuthSettingId.set(c))}),Cs(24,"option",18),JC(25,"Select an auth setting\u2026"),hl(),dC(26,X,2,3,"option",19,$),hl(),ZI(),Cs(28,"span",15),JC(29," Shared by the namespace. Every Git operation uses this identity, never the identity of whoever opened the case. "),hl(),aC(30,Z,2,0,"span",20),hl()(),Cs(31,"div",21)(32,"button",22),kg("click",function(){Cf(t);let c=CC();return Tf(c.save())}),JC(33),hl(),aC(34,ee,2,1,"button",23),Cs(35,"button",24),kg("click",function(){Cf(t);let c=CC();return Tf(c.cancel())}),JC(36,"Cancel"),hl()()();}if(i&2){let t=CC();sI(3),cC(t.errorMessage()?3:-1),sI(),cC(t.isAssociated()&&t.checkoutStatus()?4:-1),sI(7),_g("ngModel",t.repositoryUrl()),QI(),sI(6),_g("ngModel",t.mainBranch()),QI(),sI(6),_g("ngModel",t.serviceAuthSettingId()),QI(),sI(3),fC(t.eligibleAuthSettings()),sI(4),cC(t.eligibleAuthSettings().length===0?30:-1),sI(2),_g("disabled",!t.canSave()),sI(),Dl(" ",t.isSaving()?"Saving\u2026":t.isAssociated()?"Update":"Associate"," "),sI(),cC(t.isAssociated()?34:-1);}}var ne=["BearerTokenAuthSetting","BasicAuthAuthSetting","ApiKeyAuthSetting"],ie={BearerTokenAuthSetting:"token",BasicAuthAuthSetting:"basic auth",ApiKeyAuthSetting:"API key"},j=class i{route=g(V);router=g(G);gitApi=g(k);authSettingState=g(R);destroyRef=g(Ce);isLoading=Wi(true);isSaving=Wi(false);errorMessage=Wi(null);association=Wi(null);authSettings=Wi([]);repositoryUrl=Wi("");mainBranch=Wi("main");serviceAuthSettingId=Wi("");namespaceId="";isAssociated=TT(()=>this.association()?.associated===true);eligibleAuthSettings=TT(()=>this.authSettings().filter(e=>ne.includes(e.authType)));authTypeLabel(e){return ie[e??""]??e??"unknown"}canSave=TT(()=>this.repositoryUrl().trim().length>0&&this.serviceAuthSettingId().length>0&&!this.isSaving());checkoutStatus=TT(()=>this.association()?.checkoutStatus??null);ngOnInit(){this.namespaceId=this.route.snapshot.paramMap.get("namespaceId")??"",this.load();}load(){this.isLoading.set(true),$y({association:this.gitApi.getAssociationNamespaceGit(this.namespaceId).pipe(va(e=>(console.error("Failed to load the Git association",e),this.errorMessage.set(this.messageOf(e)),br(null)))),authSettings:this.authSettingState.loadNamespaceSettings(this.namespaceId).pipe(va(e=>(console.error("Failed to load namespace auth settings",e),br([]))))}).pipe(U(this.destroyRef)).subscribe(({association:e,authSettings:t})=>{this.authSettings.set(t??[]),e&&(this.association.set(e),this.applyToForm(e)),this.isLoading.set(false);});}applyToForm(e){this.repositoryUrl.set(e.repositoryUrl??""),this.mainBranch.set(e.mainBranch??"main"),this.serviceAuthSettingId.set(e.serviceAuthSettingId??"");}save(){this.canSave()&&(this.isSaving.set(true),this.errorMessage.set(null),this.gitApi.setAssociationNamespaceGit(this.namespaceId,{repositoryUrl:this.repositoryUrl().trim(),mainBranch:this.mainBranch().trim()||void 0,serviceAuthSettingId:this.serviceAuthSettingId()}).pipe(U(this.destroyRef),va(e=>(console.error("Failed to save the Git association",e),this.errorMessage.set(this.messageOf(e)),this.isSaving.set(false),br(null)))).subscribe(e=>{e&&(this.association.set(e),this.applyToForm(e)),this.isSaving.set(false);}));}remove(){confirm("Remove the repository association? The internal clone is preserved.")&&(this.isSaving.set(true),this.gitApi.removeAssociationNamespaceGit(this.namespaceId).pipe(U(this.destroyRef),va(e=>(console.error("Failed to remove the Git association",e),this.errorMessage.set(this.messageOf(e)),this.isSaving.set(false),br(null)))).subscribe(e=>{e&&(this.association.set(e),this.applyToForm(e)),this.isSaving.set(false);}));}cancel(){this.router.navigate(["/agentos/namespaces"]);}messageOf(e){return e.error?.message??e.message??"Unexpected error"}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=jw({type:i,selectors:[["agentos-namespace-git"]],decls:10,vars:1,consts:[[1,"namespace-git"],[1,"namespace-git__header"],["type","button","title","Back to namespaces",1,"namespace-git__back",3,"click"],[1,"namespace-git__back-icon"],[1,"namespace-git__title"],[1,"namespace-git__loading"],[1,"namespace-git__body"],[1,"namespace-git__hint"],["role","alert",1,"namespace-git__error"],[1,"namespace-git__status",3,"namespace-git__status--failed","namespace-git__status--ready"],[1,"namespace-git__section"],[1,"namespace-git__label"],[1,"namespace-git__field"],[1,"namespace-git__field-label"],["type","url","placeholder","https://forge.example/org/project.git","name","repositoryUrl",1,"namespace-git__input",3,"ngModelChange","ngModel"],[1,"namespace-git__field-hint"],["type","text","placeholder","main","name","mainBranch",1,"namespace-git__input",3,"ngModelChange","ngModel"],["name","serviceAuthSettingId",1,"namespace-git__input",3,"ngModelChange","ngModel"],["value",""],[3,"value"],[1,"namespace-git__field-hint","namespace-git__field-hint--warn"],[1,"namespace-git__actions"],["type","button",1,"namespace-git__save",3,"click","disabled"],["type","button",1,"namespace-git__remove",3,"disabled"],["type","button",1,"namespace-git__cancel",3,"click"],[1,"namespace-git__status"],[1,"namespace-git__status-reason"],["type","button",1,"namespace-git__remove",3,"click","disabled"]],template:function(t,l){t&1&&(Cs(0,"div",0)(1,"header",1)(2,"button",2),kg("click",function(){return l.cancel()}),Cs(3,"span",3),JC(4,"\u2190"),hl(),JC(5," Namespaces "),hl(),Cs(6,"h1",4),JC(7,"Git repository"),hl()(),aC(8,J,2,0,"p",5)(9,te,37,9,"div",6),hl()),t&2&&(sI(8),cC(l.isLoading()?8:9));},dependencies:[ti,Qn,ei,Ye,At,Zn,cn],styles:[".namespace-git[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.namespace-git__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.namespace-git__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.namespace-git__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.namespace-git__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem}.namespace-git__body[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.namespace-git__hint[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6b7280)}.namespace-git__error[_ngcontent-%COMP%]{margin:0;padding:.75rem;border-radius:.375rem;background:var(--red-bg, #fef2f2);color:var(--color-error, #b91c1c);font-size:.875rem}.namespace-git__status[_ngcontent-%COMP%]{margin:0;padding:.5rem .75rem;border-radius:.375rem;background:var(--color-surface-secondary, #f3f4f6);font-size:.875rem;display:flex;flex-direction:column;gap:.25rem}.namespace-git__status--ready[_ngcontent-%COMP%]{background:var(--color-success-bg, #ecfdf5);color:var(--color-success, #047857)}.namespace-git__status--failed[_ngcontent-%COMP%]{background:var(--red-bg, #fef2f2);color:var(--color-error, #b91c1c)}.namespace-git__status-reason[_ngcontent-%COMP%]{font-size:.8125rem;opacity:.9}.namespace-git__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;border:1px solid var(--color-border, #e5e7eb);border-radius:.5rem;padding:1rem;margin:0}.namespace-git__label[_ngcontent-%COMP%]{font-weight:600;font-size:.9375rem;padding:0 .25rem}.namespace-git__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.namespace-git__field-label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500}.namespace-git__field-hint[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-text-secondary, #6b7280)}.namespace-git__field-hint--warn[_ngcontent-%COMP%]{color:var(--color-warning, #b45309)}.namespace-git__input[_ngcontent-%COMP%]{font-family:inherit;font-size:.875rem;padding:.5rem .625rem;border:1px solid var(--color-border, #e5e7eb);border-radius:.375rem;background:var(--color-surface, #fff);color:inherit}.namespace-git__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;align-items:center}.namespace-git__save[_ngcontent-%COMP%], .namespace-git__remove[_ngcontent-%COMP%], .namespace-git__cancel[_ngcontent-%COMP%]{font-family:inherit;font-size:.875rem;padding:.5rem 1rem;border-radius:.375rem;cursor:pointer;border:1px solid transparent}.namespace-git__save[_ngcontent-%COMP%]:disabled, .namespace-git__remove[_ngcontent-%COMP%]:disabled, .namespace-git__cancel[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.namespace-git__save[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);color:var(--color-text-on-accent, #fff)}.namespace-git__remove[_ngcontent-%COMP%]{background:none;border-color:var(--color-error, #b91c1c);color:var(--color-error, #b91c1c)}.namespace-git__cancel[_ngcontent-%COMP%]{background:none;border-color:var(--color-border, #e5e7eb);color:inherit}"]})};
|
|
2
2
|
export{j as NamespaceGitComponent};
|
|
@@ -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-LBRSRTYI.js';import {d}from'./chunk-CKhGzoqa.js';import {W,k as ke,s as se}from'./chunk-CpZK7G-Q.js';import {T as Tn,S as Sn,n as nt,a as ae,l as le,c as ce}from'./chunk-bfpuueWC.js';import {W as Wn,o as ot,i as it,I as In,D as De,B as Be,y as ya,E as En}from'./chunk-BaO2vi_O.js';import'./chunk-DjMtxVWg.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-BYyTBqh4.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-K6RKSHKK.js';import {d}from'./chunk-RlCcRMQy.js';import {W,k as ke,s as se}from'./chunk-BWLCegs8.js';import {T as Tn,S as Sn,n as nt,a as ae,l as le,c as ce}from'./chunk-CorOD5-V.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-D8Bz7q-C.js';import'./chunk-BEaYQhbI.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-BhdMedPO.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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {i}from'./chunk-
|
|
1
|
+
import {i}from'./chunk-B55TXBfo.js';import {l}from'./chunk-DIhIuMRR.js';import {g,d9 as U,dj as de,aJ as Tr,aD as Hy,bS as Da,a7 as va,I as br,r as re,cE as kd,bU as Fd,K as x}from'./main-K6RKSHKK.js';var y="none",O="me",N=class f{nsController=g(U);exportService=g(de);userState=g(l);refresh$=new Tr(void 0);namespaceId$=new Tr(null);vm$=Hy([this.namespaceId$,this.refresh$]).pipe(Da(([e])=>{let n=this.loadPlatformConfigs().pipe(va(()=>br([]))),t=this.loadUserConfigs("global").pipe(va(()=>br([])));return e?Hy([n,this.loadNamespaceConfigs(e).pipe(va(()=>br([]))),this.loadUserConfigs(e).pipe(va(()=>br([]))),t]).pipe(re(([i,r,c,s])=>({platform:i,namespace:r,userOnNs:c,userGlobal:s}))):Hy([n,t]).pipe(re(([i,r])=>({platform:i,namespace:[],userOnNs:[],userGlobal:r})))}),kd({bufferSize:1,refCount:true}));setNamespace(e){this.namespaceId$.value!==e&&this.namespaceId$.next(e);}refresh(){this.refresh$.next();}loadPlatformConfigs(){return this.nsController.listIntegrationConfig(y)}loadUserConfigs(e){let n=e==="global"?y:e;return this.nsController.listIntegrationConfig(n,O)}userGlobal$=i(this.refresh$,()=>this.loadUserConfigs("global"),[]);loadNamespaceConfigs(e){return e?this.nsController.listIntegrationConfig(e):br([])}getById(e,n){return this.nsController.getByIdIntegrationConfig(e)}create(e,n,t){let r=this.userState.currentUser()?.id;if((n==="userOnNs"||n==="userGlobal")&&!r)throw new Error(`Cannot create ${n} config before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(n==="platform"){let s={name:e.name,integrationType:e.integrationType,description:e.description,parameters:e.parameters,authSettingName:e.authSettingName??void 0};return this.nsController.createIntegrationConfig(s).pipe(Fd(()=>this.refresh()))}if(n==="namespace"){if(!t)throw new Error("Cannot create namespace-scoped config without a namespaceId");let s={name:e.name,integrationType:e.integrationType,description:e.description,namespaceId:t,parameters:e.parameters,authSettingName:e.authSettingName??void 0};return this.nsController.createIntegrationConfig(s).pipe(Fd(()=>this.refresh()))}if(n==="userOnNs"&&!t)throw new Error("Cannot create userOnNs config without a namespaceId");let c={name:e.name,integrationType:e.integrationType,description:e.description,userId:r,namespaceId:n==="userOnNs"?t:void 0,parameters:e.parameters,authSettingName:e.authSettingName??void 0};return this.nsController.createIntegrationConfig(c).pipe(Fd(()=>this.refresh()))}update(e,n,t,i){let r={name:n.name,integrationType:n.integrationType,description:n.description,userId:i.userId,namespaceId:i.namespaceId,parameters:n.parameters,authSettingName:n.authSettingName??void 0};return this.nsController.updateIntegrationConfig(e,r).pipe(Fd(()=>this.refresh()))}delete(e,n){return this.nsController.deleteIntegrationConfig(e).pipe(Fd(()=>this.refresh()))}exportAsYaml(e){return this.exportService.exportAsYaml(e)}static \u0275fac=function(n){return new(n||f)};static \u0275prov=x({token:f,factory:f.\u0275fac,providedIn:"root"})};export{N};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,G,cb as
|
|
1
|
+
import {g,G,cb as JB,cc as XB,W as Wi,dc as me,dl as ve,j as jw,k as Cs,J as JC,m as hl,o as aC,t as sI,a8 as Kg,w as zg,a5 as Dl,u as cC,ac as CC,a9 as vC,n as kg,_ as _g,aa as Cf,ab as Tf}from'./main-K6RKSHKK.js';import {Z as Zn,S as Se}from'./chunk-D8Bz7q-C.js';function L(n,t){if(n&1&&(Cs(0,"span",5),JC(1),hl()),n&2){let e=CC();sI(),Kg(e.definition().description);}}function q(n,t){if(n&1&&(Cs(0,"span",7),JC(1),hl()),n&2){let e=CC();sI(),Dl("Next: ",e.nextRunLabel);}}function U(n,t){if(n&1&&(Cs(0,"span",8),JC(1),hl()),n&2){let e=CC();sI(),Dl("Last run: ",e.lastRunLabel);}}function $(n,t){if(n&1){let e=vC();Cs(0,"span",12),JC(1,"Delete?"),hl(),Cs(2,"ds-icon-button",13),kg("action",function(){Cf(e);let a=CC(2);return Tf(a.onDeleteConfirmed())}),hl(),Cs(3,"ds-icon-button",14),kg("action",function(){Cf(e);let a=CC(2);return Tf(a.onDeleteCancelled())}),hl();}}function N(n,t){if(n&1){let e=vC();Cs(0,"ds-kebab-menu",15),kg("itemSelected",function(a){Cf(e);let p=CC(2);return Tf(p.onMenuAction(a))}),hl();}if(n&2){let e=CC(2);_g("items",e.menuItems);}}function V(n,t){if(n&1&&(Cs(0,"div",10),aC(1,$,4,0)(2,N,1,1,"ds-kebab-menu",11),hl()),n&2){let e=CC();zg("scheduled-prompt-item__actions--confirming",e.pendingDelete()),sI(),cC(e.pendingDelete()?1:2);}}var R=class n{router=g(G);definition=JB.required();namespaceId=JB(void 0);platformMode=JB(false);readOnly=JB(false);enableRequested=XB();disableRequested=XB();deleteRequested=XB();pendingDelete=Wi(false);get scheduleLabel(){let{recurrence:t}=this.definition(),e=t.unit,i=t.timeUtc,a=e===me.WEEK?"week":"month",p=e===me.WEEK&&t.days?.length?` (${t.days.map(_=>ve[_]??_).join(", ")})`:"";return `Every ${a}${p} at ${i} UTC`}formatInstant(t){if(!t)return null;let e=new Date(t),i=e.getUTCDate(),a=e.toLocaleString("en-GB",{month:"short",timeZone:"UTC"}),p=e.getUTCFullYear(),_=String(e.getUTCHours()).padStart(2,"0"),T=String(e.getUTCMinutes()).padStart(2,"0");return `${i} ${a} ${p} at ${_}:${T} UTC`}get nextRunLabel(){return this.formatInstant(this.definition().nextRunAt)}get lastRunLabel(){return this.formatInstant(this.definition().lastRunAt)}get menuItems(){let t=this.definition();return [{key:"edit",label:"Edit scheduled prompt",icon:"edit"},{key:"toggle",label:t.enabled?"Disable":"Enable",icon:t.enabled?"toggle_on":"toggle_off"},{key:"delete",label:"Delete scheduled prompt",icon:"delete",variant:"danger"}]}onMenuAction(t){let e=this.definition();switch(t){case "edit":this.platformMode()?this.router.navigate(["/agentos","admin","scheduled-prompts",e.id,"edit"]):this.router.navigate(["/agentos",this.namespaceId(),"scheduled-prompts",e.id,"edit"]);break;case "toggle":e.enabled?this.disableRequested.emit(e):this.enableRequested.emit(e);break;case "delete":this.pendingDelete.set(true);break}}onDeleteConfirmed(){this.pendingDelete.set(false),this.deleteRequested.emit(this.definition());}onDeleteCancelled(){this.pendingDelete.set(false);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=jw({type:n,selectors:[["agentos-scheduled-prompt-item"]],inputs:{definition:[1,"definition"],namespaceId:[1,"namespaceId"],platformMode:[1,"platformMode"],readOnly:[1,"readOnly"]},outputs:{enableRequested:"enableRequested",disableRequested:"disableRequested",deleteRequested:"deleteRequested"},decls:13,vars:11,consts:[["role","listitem",1,"scheduled-prompt-item"],[1,"scheduled-prompt-item__body"],[1,"scheduled-prompt-item__header"],[1,"scheduled-prompt-item__name"],[1,"scheduled-prompt-item__status"],[1,"scheduled-prompt-item__description"],[1,"scheduled-prompt-item__schedule"],[1,"scheduled-prompt-item__next-run"],[1,"scheduled-prompt-item__last-run"],[1,"scheduled-prompt-item__actions",3,"scheduled-prompt-item__actions--confirming"],[1,"scheduled-prompt-item__actions"],[3,"items"],[1,"scheduled-prompt-item__confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel deletion",3,"action"],[3,"itemSelected","items"]],template:function(e,i){e&1&&(Cs(0,"div",0)(1,"div",1)(2,"div",2)(3,"span",3),JC(4),hl(),Cs(5,"span",4),JC(6),hl()(),aC(7,L,2,1,"span",5),Cs(8,"span",6),JC(9),hl(),aC(10,q,2,1,"span",7),aC(11,U,2,1,"span",8),hl(),aC(12,V,3,3,"div",9),hl()),e&2&&(sI(4),Kg(i.definition().name),sI(),zg("scheduled-prompt-item__status--enabled",i.definition().enabled)("scheduled-prompt-item__status--disabled",!i.definition().enabled),sI(),Dl(" ",i.definition().enabled?"Enabled":"Disabled"," "),sI(),cC(i.definition().description?7:-1),sI(2),Kg(i.scheduleLabel),sI(),cC(i.nextRunLabel?10:-1),sI(),cC(i.lastRunLabel?11:-1),sI(),cC(i.readOnly()?-1:12));},dependencies:[Zn,Se],styles:[".scheduled-prompt-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem 1rem;border-radius:10px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--glass-bg, rgba(255, 255, 255, .72));-webkit-backdrop-filter:var(--glass-backdrop-blur, blur(20px));backdrop-filter:var(--glass-backdrop-blur, blur(20px));transition:background .15s ease,border-color .15s ease}.scheduled-prompt-item[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .04));border-color:var(--color-primary, #007aff)}.scheduled-prompt-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.scheduled-prompt-item__header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;min-width:0}.scheduled-prompt-item__name[_ngcontent-%COMP%]{font-size:.95rem;font-weight:500;color:var(--color-text, #1d1d1f);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;min-width:0}.scheduled-prompt-item__status[_ngcontent-%COMP%]{font-size:.7rem;font-weight:600;padding:.15rem .5rem;border-radius:999px;white-space:nowrap;flex-shrink:0;text-transform:uppercase;letter-spacing:.04em}.scheduled-prompt-item__status--enabled[_ngcontent-%COMP%]{background:var(--color-success-bg, rgba(52, 199, 89, .12));color:var(--color-success, #34c759)}.scheduled-prompt-item__status--disabled[_ngcontent-%COMP%]{background:var(--color-warning-bg, rgba(255, 159, 10, .12));color:var(--color-warning, #ff9f0a)}.scheduled-prompt-item__description[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, #6e6e73);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.scheduled-prompt-item__schedule[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, #6e6e73);font-family:monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.scheduled-prompt-item__next-run[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text, #1d1d1f);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.scheduled-prompt-item__last-run[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary, #6e6e73);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.scheduled-prompt-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.scheduled-prompt-item[_ngcontent-%COMP%]:hover .scheduled-prompt-item__actions[_ngcontent-%COMP%], .scheduled-prompt-item[_ngcontent-%COMP%]:focus-within .scheduled-prompt-item__actions[_ngcontent-%COMP%]{opacity:1}.scheduled-prompt-item__actions--confirming[_ngcontent-%COMP%]{opacity:1}.scheduled-prompt-item__confirm-label[_ngcontent-%COMP%]{font-size:.8rem;font-weight:500;color:var(--color-error, #ff3b30);margin-right:.25rem;white-space:nowrap}"]})};export{R};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {g,G,P,j as jw,h as hr,e as pr,k as Cs,n as kg,J as JC,m as hl,o as aC,t as sI,_ as _g,u as cC,a5 as Dl,al as vt,am as Ym,a9 as vC,ai as rm,aa as Cf,aj as iT,ab as Tf,a3 as ZI,ak as nm,a6 as QI,x as jg,y as MC,N as NC,ac as CC,a8 as Kg}from'./main-K6RKSHKK.js';import {y as yt,w as wt,t as ti,Y as Ye,Z as Zn,c as cn}from'./chunk-BhdMedPO.js';var J=["inputElement"];function K(o,r){if(o&1&&(Cs(0,"span",3),JC(1),hl()),o&2){let t=CC();sI(),Kg(t.label);}}function U(o,r){if(o&1&&(Cs(0,"small",5),JC(1),hl()),o&2){let t=CC();sI(),Kg(t.hint);}}var h=class o{label="";placeholder="";hint="";isDisabled=false;value="";autoFocus=true;valueChange=new vt;enterPressed=new vt;inputElement;inputValue="";ngAfterViewInit(){this.inputValue=this.value,this.autoFocus&&setTimeout(()=>this.inputElement?.nativeElement.focus(),100);}onValueChange(r){this.valueChange.emit(r);}onEnter(){this.inputValue.trim()&&this.enterPressed.emit(this.inputValue.trim());}focus(){this.inputElement?.nativeElement.focus();}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=jw({type:o,selectors:[["app-text-input"]],viewQuery:function(t,e){if(t&1&&jg(J,5),t&2){let p;MC(p=NC())&&(e.inputElement=p.first);}},inputs:{label:"label",placeholder:"placeholder",hint:"hint",isDisabled:"isDisabled",value:"value",autoFocus:"autoFocus"},outputs:{valueChange:"valueChange",enterPressed:"enterPressed"},decls:6,vars:5,consts:[["inputElement",""],[1,"text-input-container"],[1,"text-input-wrapper"],[1,"text-input-label"],["type","text",1,"text-input-field",3,"ngModelChange","keydown.enter","ngModel","placeholder","disabled"],[1,"text-input-hint"]],template:function(t,e){if(t&1){let p=vC();Cs(0,"div",1)(1,"label",2),aC(2,K,2,1,"span",3),Cs(3,"input",4,0),rm("ngModelChange",function(m){return Cf(p),iT(e.inputValue,m)||(e.inputValue=m),Tf(m)}),kg("ngModelChange",function(m){return e.onValueChange(m)})("keydown.enter",function(){return e.onEnter()}),hl(),ZI(),hl(),aC(5,U,2,1,"small",5),hl();}t&2&&(sI(2),cC(e.label?2:-1),sI(),nm("ngModel",e.inputValue),_g("placeholder",e.placeholder)("disabled",e.isDisabled),QI(),sI(2),cC(e.hint?5:-1));},dependencies:[ti,Ye,Zn,cn,Ym],styles:[".text-input-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem;width:100%}.text-input-wrapper[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem;width:100%;cursor:text}.text-input-label[_ngcontent-%COMP%]{font-size:.95rem;font-weight:500;color:var(--color-text);margin:0}.text-input-field[_ngcontent-%COMP%]{width:100%;padding:.75rem 1rem;font-size:1rem;color:var(--color-text);background:var(--color-bg);border:1px solid var(--color-border);border-radius:8px;outline:none;transition:all .2s ease}.text-input-field[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary);opacity:.7}.text-input-field[_ngcontent-%COMP%]:focus{border-color:var(--color-primary);box-shadow:0 0 0 3px rgba(var(--color-primary-rgb),.1)}.text-input-field[_ngcontent-%COMP%]:disabled{opacity:.6;cursor:not-allowed;background:var(--color-surface)}.text-input-hint[_ngcontent-%COMP%]{font-size:.85rem;color:var(--color-text-secondary);margin:0;font-style:italic}@media(max-width:768px){.text-input-field[_ngcontent-%COMP%]{padding:.65rem .85rem;font-size:.95rem}.text-input-label[_ngcontent-%COMP%]{font-size:.9rem}.text-input-hint[_ngcontent-%COMP%]{font-size:.8rem}}"],changeDetection:1})};function X(o,r){if(o&1&&(Cs(0,"div",8),JC(1),hl()),o&2){let t=CC();sI(),Kg(t.errorMessage);}}var L=class o{router=g(G);projectStateService=g(P);projectName="";projectPath="";isCreating=false;errorMessage=null;isValid(){return this.projectName.trim()!==""&&this.projectPath.trim()!==""}onCreate(){if(!this.isValid()){this.errorMessage="Both name and path are required";return}this.isCreating=true,this.errorMessage=null,this.projectStateService.createProject(this.projectName.trim(),this.projectPath.trim()).subscribe({next:()=>{let r=this.projectName.trim();this.isCreating=false,this.projectStateService.selectProject(r),this.router.navigate(["project",r]);},error:r=>{this.errorMessage=r.error?.error??"Failed to create project",this.isCreating=false;}});}onCancel(){this.router.navigate(["/"]);}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=jw({type:o,selectors:[["app-project-new"]],decls:19,vars:9,consts:[[1,"project-new-page"],[1,"project-new-card"],["mat-button","",1,"project-new__back",3,"click"],[1,"project-new__title"],[1,"project-new__subtitle"],[1,"project-new__form"],["label","Project name","placeholder","my-project",3,"valueChange","value","isDisabled","autoFocus"],["label","Project path","placeholder","/path/to/project","hint","Absolute path to the project directory",3,"valueChange","enterPressed","value","isDisabled"],[1,"project-new__error"],[1,"project-new__actions"],["mat-button","",3,"click","disabled"],["mat-flat-button","","color","primary",3,"click","disabled"]],template:function(t,e){t&1&&(Cs(0,"div",0)(1,"div",1)(2,"button",2),kg("click",function(){return e.onCancel()}),Cs(3,"mat-icon"),JC(4,"arrow_back"),hl(),JC(5," Back to projects "),hl(),Cs(6,"h1",3),JC(7,"New project"),hl(),Cs(8,"p",4),JC(9,"Point Coday to an existing directory on your machine."),hl(),Cs(10,"div",5)(11,"app-text-input",6),kg("valueChange",function(d){return e.projectName=d}),hl(),Cs(12,"app-text-input",7),kg("valueChange",function(d){return e.projectPath=d})("enterPressed",function(){return e.onCreate()}),hl(),aC(13,X,2,1,"div",8),hl(),Cs(14,"div",9)(15,"button",10),kg("click",function(){return e.onCancel()}),JC(16,"Cancel"),hl(),Cs(17,"button",11),kg("click",function(){return e.onCreate()}),JC(18),hl()()()()),t&2&&(sI(11),_g("value",e.projectName)("isDisabled",e.isCreating)("autoFocus",true),sI(),_g("value",e.projectPath)("isDisabled",e.isCreating),sI(),cC(e.errorMessage?13:-1),sI(2),_g("disabled",e.isCreating),sI(2),_g("disabled",!e.isValid()||e.isCreating),sI(),Dl(" ",e.isCreating?"Creating\u2026":"Create project"," "));},dependencies:[hr,pr,yt,wt,h],styles:[".project-new-page[_ngcontent-%COMP%]{display:flex;align-items:flex-start;justify-content:center;min-height:100vh;width:100%;background:var(--color-bg);padding:2rem 1.5rem;box-sizing:border-box}.project-new-card[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem;width:100%;max-width:560px;padding:2rem;background:var(--color-bg-secondary, rgba(255, 255, 255, .7));border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:16px;box-shadow:var(--glass-shadow, 0 8px 32px rgba(31, 38, 135, .15));margin-top:2rem}.project-new__back[_ngcontent-%COMP%]{align-self:flex-start;margin-left:-.5rem;color:var(--color-text-secondary, #6e6e73)}.project-new__title[_ngcontent-%COMP%]{margin:0;font-size:1.625rem;font-weight:700;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.project-new__subtitle[_ngcontent-%COMP%]{margin:-.75rem 0 0;font-size:.9375rem;color:var(--color-text-secondary, #6e6e73)}.project-new__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.project-new__error[_ngcontent-%COMP%]{padding:.75rem 1rem;background:#dc262614;border:1px solid rgba(220,38,38,.25);border-radius:8px;color:var(--color-error, #ff3b30);font-size:.875rem}.project-new__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;justify-content:flex-end;padding-top:.25rem}"],changeDetection:1})};export{L as ProjectNewComponent};
|
package/browser/index.html
CHANGED
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
<style>:root{--color-bg:#f5f6f8;--color-bg-solid:#f5f6f8;--color-bg-secondary:rgba(255, 255, 255, .7);--color-bg-secondary-rgb:255 255 255;--color-text:#1d1d1f;--color-text-secondary:#6e6e73;--color-text-inverse:#ffffff;--color-text-tertiary:#a1a1a6;--color-primary:#007aff;--color-primary-hover:#0051d5;--color-accent:#8b5cf6;--color-link:#007aff;--color-border:rgba(0, 0, 0, .1);--color-border-light:rgba(40, 40, 40, .08);--color-input-bg:rgba(255, 255, 255, .8);--color-bg-hover:rgba(0, 0, 0, .04);--color-success:#34c759;--color-success-bg:#e3f5e1;--color-error:#ff3b30;--color-warning:#ff9500;--color-info:#5ac8fa;--color-message-user:rgba(0, 122, 255, .1);--color-message-ai:rgba(255, 255, 255, .8);--color-code-bg:rgba(142, 142, 147, .12);--color-code-text:#ff375f;--glass-bg:rgba(255, 255, 255, .72);--glass-border:rgba(255, 255, 255, .18);--glass-shadow:0 8px 32px 0 rgba(31, 38, 135, .15);--glass-backdrop-blur:blur(20px);--color-modal-bg:#ffffff;--color-surface:#ffffff;--color-modal-border:rgba(0, 0, 0, .12);--color-modal-shadow:0 8px 40px rgba(0, 0, 0, .18), 0 2px 8px rgba(0, 0, 0, .1);--color-shadow:rgba(0, 0, 0, .08);--color-overlay:rgba(0, 0, 0, .4);--color-surface-hover:var(--color-bg-hover);--color-surface-secondary:rgba(0, 0, 0, .03);--color-surface-muted:rgba(0, 0, 0, .05);--color-divider:rgba(0, 0, 0, .1)}@media print{html,body,app-root{height:auto!important;max-height:none!important;min-height:auto!important;overflow:visible!important;position:static!important}body{background:#fff!important;color:#000!important;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif!important;font-size:11pt;line-height:1.6;padding:1rem!important}*{animation:none!important;transition:none!important;box-shadow:none!important;text-shadow:none!important}}*{box-sizing:border-box}html{color-scheme:light}html{--mat-sys-background:light-dark(#faf9fd, #121316);--mat-sys-error:light-dark(#ba1a1a, #ffb4ab);--mat-sys-error-container:light-dark(#ffdad6, #93000a);--mat-sys-inverse-on-surface:light-dark(#f2f0f4, #2f3033);--mat-sys-inverse-primary:light-dark(#abc7ff, #005cbb);--mat-sys-inverse-surface:light-dark(#2f3033, #e3e2e6);--mat-sys-on-background:light-dark(#1a1b1f, #e3e2e6);--mat-sys-on-error:light-dark(#ffffff, #690005);--mat-sys-on-error-container:light-dark(#93000a, #ffdad6);--mat-sys-on-primary:light-dark(#ffffff, #002f65);--mat-sys-on-primary-container:light-dark(#00458f, #d7e3ff);--mat-sys-on-primary-fixed:light-dark(#001b3f, #001b3f);--mat-sys-on-primary-fixed-variant:light-dark(#00458f, #00458f);--mat-sys-on-secondary:light-dark(#ffffff, #283041);--mat-sys-on-secondary-container:light-dark(#3e4759, #dae2f9);--mat-sys-on-secondary-fixed:light-dark(#131c2b, #131c2b);--mat-sys-on-secondary-fixed-variant:light-dark(#3e4759, #3e4759);--mat-sys-on-surface:light-dark(#1a1b1f, #e3e2e6);--mat-sys-on-surface-variant:light-dark(#44474e, #e0e2ec);--mat-sys-on-tertiary:light-dark(#ffffff, #002f65);--mat-sys-on-tertiary-container:light-dark(#00458f, #d7e3ff);--mat-sys-on-tertiary-fixed:light-dark(#001b3f, #001b3f);--mat-sys-on-tertiary-fixed-variant:light-dark(#00458f, #00458f);--mat-sys-outline:light-dark(#74777f, #8e9099);--mat-sys-outline-variant:light-dark(#c4c6d0, #44474e);--mat-sys-primary:light-dark(#005cbb, #abc7ff);--mat-sys-primary-container:light-dark(#d7e3ff, #00458f);--mat-sys-primary-fixed:light-dark(#d7e3ff, #d7e3ff);--mat-sys-primary-fixed-dim:light-dark(#abc7ff, #abc7ff);--mat-sys-scrim:light-dark(#000000, #000000);--mat-sys-secondary:light-dark(#565e71, #bec6dc);--mat-sys-secondary-container:light-dark(#dae2f9, #3e4759);--mat-sys-secondary-fixed:light-dark(#dae2f9, #dae2f9);--mat-sys-secondary-fixed-dim:light-dark(#bec6dc, #bec6dc);--mat-sys-shadow:light-dark(#000000, #000000);--mat-sys-surface:light-dark(#faf9fd, #121316);--mat-sys-surface-bright:light-dark(#faf9fd, #38393c);--mat-sys-surface-container:light-dark(#efedf0, #1f2022);--mat-sys-surface-container-high:light-dark(#e9e7eb, #292a2c);--mat-sys-surface-container-highest:light-dark(#e3e2e6, #343537);--mat-sys-surface-container-low:light-dark(#f4f3f6, #1a1b1f);--mat-sys-surface-container-lowest:light-dark(#ffffff, #0d0e11);--mat-sys-surface-dim:light-dark(#dbd9dd, #121316);--mat-sys-surface-tint:light-dark(#005cbb, #abc7ff);--mat-sys-surface-variant:light-dark(#e0e2ec, #44474e);--mat-sys-tertiary:light-dark(#005cbb, #abc7ff);--mat-sys-tertiary-container:light-dark(#d7e3ff, #00458f);--mat-sys-tertiary-fixed:light-dark(#d7e3ff, #d7e3ff);--mat-sys-tertiary-fixed-dim:light-dark(#abc7ff, #abc7ff);--mat-sys-neutral-variant20:#2d3038;--mat-sys-neutral10:#1a1b1f;--mat-sys-level0:0px 0px 0px 0px rgba(0, 0, 0, .2), 0px 0px 0px 0px rgba(0, 0, 0, .14), 0px 0px 0px 0px rgba(0, 0, 0, .12);--mat-sys-level1:0px 2px 1px -1px rgba(0, 0, 0, .2), 0px 1px 1px 0px rgba(0, 0, 0, .14), 0px 1px 3px 0px rgba(0, 0, 0, .12);--mat-sys-level2:0px 3px 3px -2px rgba(0, 0, 0, .2), 0px 3px 4px 0px rgba(0, 0, 0, .14), 0px 1px 8px 0px rgba(0, 0, 0, .12);--mat-sys-level3:0px 3px 5px -1px rgba(0, 0, 0, .2), 0px 6px 10px 0px rgba(0, 0, 0, .14), 0px 1px 18px 0px rgba(0, 0, 0, .12);--mat-sys-level4:0px 5px 5px -3px rgba(0, 0, 0, .2), 0px 8px 10px 1px rgba(0, 0, 0, .14), 0px 3px 14px 2px rgba(0, 0, 0, .12);--mat-sys-level5:0px 7px 8px -4px rgba(0, 0, 0, .2), 0px 12px 17px 2px rgba(0, 0, 0, .14), 0px 5px 22px 4px rgba(0, 0, 0, .12);--mat-sys-body-large:400 1rem / 1.5rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-body-large-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-body-large-line-height:1.5rem;--mat-sys-body-large-size:1rem;--mat-sys-body-large-tracking:.031rem;--mat-sys-body-large-weight:400;--mat-sys-body-medium:400 .875rem / 1.25rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-body-medium-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-body-medium-line-height:1.25rem;--mat-sys-body-medium-size:.875rem;--mat-sys-body-medium-tracking:.016rem;--mat-sys-body-medium-weight:400;--mat-sys-body-small:400 .75rem / 1rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-body-small-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-body-small-line-height:1rem;--mat-sys-body-small-size:.75rem;--mat-sys-body-small-tracking:.025rem;--mat-sys-body-small-weight:400;--mat-sys-display-large:400 3.562rem / 4rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-display-large-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-display-large-line-height:4rem;--mat-sys-display-large-size:3.562rem;--mat-sys-display-large-tracking:-.016rem;--mat-sys-display-large-weight:400;--mat-sys-display-medium:400 2.812rem / 3.25rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-display-medium-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-display-medium-line-height:3.25rem;--mat-sys-display-medium-size:2.812rem;--mat-sys-display-medium-tracking:0;--mat-sys-display-medium-weight:400;--mat-sys-display-small:400 2.25rem / 2.75rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-display-small-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-display-small-line-height:2.75rem;--mat-sys-display-small-size:2.25rem;--mat-sys-display-small-tracking:0;--mat-sys-display-small-weight:400;--mat-sys-headline-large:400 2rem / 2.5rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-headline-large-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-headline-large-line-height:2.5rem;--mat-sys-headline-large-size:2rem;--mat-sys-headline-large-tracking:0;--mat-sys-headline-large-weight:400;--mat-sys-headline-medium:400 1.75rem / 2.25rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-headline-medium-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-headline-medium-line-height:2.25rem;--mat-sys-headline-medium-size:1.75rem;--mat-sys-headline-medium-tracking:0;--mat-sys-headline-medium-weight:400;--mat-sys-headline-small:400 1.5rem / 2rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-headline-small-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-headline-small-line-height:2rem;--mat-sys-headline-small-size:1.5rem;--mat-sys-headline-small-tracking:0;--mat-sys-headline-small-weight:400;--mat-sys-label-large:500 .875rem / 1.25rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-label-large-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-label-large-line-height:1.25rem;--mat-sys-label-large-size:.875rem;--mat-sys-label-large-tracking:.006rem;--mat-sys-label-large-weight:500;--mat-sys-label-large-weight-prominent:700;--mat-sys-label-medium:500 .75rem / 1rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-label-medium-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-label-medium-line-height:1rem;--mat-sys-label-medium-size:.75rem;--mat-sys-label-medium-tracking:.031rem;--mat-sys-label-medium-weight:500;--mat-sys-label-medium-weight-prominent:700;--mat-sys-label-small:500 .688rem / 1rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-label-small-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-label-small-line-height:1rem;--mat-sys-label-small-size:.688rem;--mat-sys-label-small-tracking:.031rem;--mat-sys-label-small-weight:500;--mat-sys-title-large:400 1.375rem / 1.75rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-title-large-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-title-large-line-height:1.75rem;--mat-sys-title-large-size:1.375rem;--mat-sys-title-large-tracking:0;--mat-sys-title-large-weight:400;--mat-sys-title-medium:500 1rem / 1.5rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-title-medium-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-title-medium-line-height:1.5rem;--mat-sys-title-medium-size:1rem;--mat-sys-title-medium-tracking:.009rem;--mat-sys-title-medium-weight:500;--mat-sys-title-small:500 .875rem / 1.25rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-title-small-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-title-small-line-height:1.25rem;--mat-sys-title-small-size:.875rem;--mat-sys-title-small-tracking:.006rem;--mat-sys-title-small-weight:500;--mat-sys-corner-extra-large:28px;--mat-sys-corner-extra-large-top:28px 28px 0 0;--mat-sys-corner-extra-small:4px;--mat-sys-corner-extra-small-top:4px 4px 0 0;--mat-sys-corner-full:9999px;--mat-sys-corner-large:16px;--mat-sys-corner-large-end:0 16px 16px 0;--mat-sys-corner-large-start:16px 0 0 16px;--mat-sys-corner-large-top:16px 16px 0 0;--mat-sys-corner-medium:12px;--mat-sys-corner-none:0;--mat-sys-corner-small:8px;--mat-sys-dragged-state-layer-opacity:.16;--mat-sys-focus-state-layer-opacity:.12;--mat-sys-hover-state-layer-opacity:.08;--mat-sys-pressed-state-layer-opacity:.12;--mat-snack-bar-container-shape:transparent;--mat-snack-bar-container-color:transparent;--mat-snack-bar-supporting-text-color:var(--color-text)}html,body{margin:0;padding:0;width:100%;height:100%}body{background:var(--color-bg);color:var(--color-text);font-family:-apple-system,BlinkMacSystemFont,SF Pro Display,Segoe UI,Helvetica Neue,Arial,sans-serif;transition:background .3s ease,color .3s ease;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;padding:0!important}</style><link rel="stylesheet" href="styles-HDA2O7OH.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles-HDA2O7OH.css"></noscript></head>
|
|
32
32
|
<body>
|
|
33
33
|
<app-root></app-root>
|
|
34
|
-
<script src="polyfills-2FSRUXKO.js" type="module"></script><script src="main-
|
|
34
|
+
<script src="polyfills-2FSRUXKO.js" type="module"></script><script src="main-K6RKSHKK.js" type="module"></script></body>
|
|
35
35
|
</html>
|