@knoflows/engine 0.1.1-alpha.0 → 0.1.1-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/engine.js +31 -19
  2. package/dist/migrations/20260923070000_local_repo_default_reviewers/migration.sql +1 -0
  3. package/dist/migrations/20260923072051_hard_beast/migration.sql +2 -0
  4. package/dist/migrations/20260923072051_hard_beast/snapshot.json +1408 -0
  5. package/package.json +4 -4
  6. package/static/assets/i18n/en.json +23 -0
  7. package/static/assets/i18n/es.json +23 -0
  8. package/static/chunk-5P9quDD0.js +1 -0
  9. package/static/chunk-B1I44qNh.js +1 -0
  10. package/static/{chunk-BHko4hHm.js → chunk-B67hwr1X.js} +1 -1
  11. package/static/{chunk-CGHIKxZG.js → chunk-B7mctPQM.js} +1 -1
  12. package/static/{chunk-EDwdt-Wk.js → chunk-BAPXVTBt.js} +1 -1
  13. package/static/chunk-BNQus_d_.js +1 -0
  14. package/static/chunk-Bh5et471.js +1 -0
  15. package/static/{chunk--EZIkevK.js → chunk-BidviQhN.js} +1 -1
  16. package/static/chunk-BldTY6RI.js +1 -0
  17. package/static/chunk-BmEXmF8m.js +1 -0
  18. package/static/chunk-BqhxU3er.js +1 -0
  19. package/static/{chunk-Det50scT.js → chunk-Bv65hEw_.js} +1 -1
  20. package/static/{chunk-Dm_EWkUz.js → chunk-C07s4-rF.js} +1 -1
  21. package/static/chunk-C5eZIOiF.js +1 -0
  22. package/static/{chunk-BRAytoQl.js → chunk-C61nx2gP.js} +1 -1
  23. package/static/{chunk-DbQy6dR8.js → chunk-CI75Yj8J.js} +1 -1
  24. package/static/chunk-CNip9Ktj.js +1 -0
  25. package/static/chunk-CP6elnGc.js +1 -0
  26. package/static/{chunk-YU-Bg77r.js → chunk-Cf14heGp.js} +1 -1
  27. package/static/chunk-CiB-X52X.js +1 -0
  28. package/static/chunk-Cj5izLCS.js +1 -0
  29. package/static/{chunk-BIJScqTM.js → chunk-CxnyhsKe.js} +1 -1
  30. package/static/chunk-CyvupcYz.js +1 -0
  31. package/static/{chunk-CoQPYpxp.js → chunk-D1sSb3lO.js} +1 -1
  32. package/static/{chunk-iIEmH_ui.js → chunk-D5BPM_KC.js} +1 -1
  33. package/static/{chunk-D-ueyYEC.js → chunk-D9f8Ltay.js} +3 -3
  34. package/static/{chunk-DdDI9wRc.js → chunk-DBtN2lWe.js} +3 -3
  35. package/static/chunk-DD_o_6mU.js +1 -0
  36. package/static/chunk-DRe_kA_l.js +1 -0
  37. package/static/{chunk-BcDRgzYZ.js → chunk-Dt7AgNFd.js} +1 -1
  38. package/static/chunk-Dxa2JdVP.js +1 -0
  39. package/static/{chunk-CtiubhW7.js → chunk-DyGh8J3-.js} +1 -1
  40. package/static/chunk-IZZsw-Ul.js +1 -0
  41. package/static/{chunk-vINo5yVD.js → chunk-MciiAFro.js} +1 -1
  42. package/static/{chunk-CJWR0gwk.js → chunk-RWVebRsq.js} +1 -1
  43. package/static/chunk-doY5ozP9.js +1 -0
  44. package/static/{chunk-8ezEUcxN.js → chunk-g20-BKKx.js} +6 -6
  45. package/static/chunk-lPfYUUfU.js +1 -0
  46. package/static/chunk-vnmh6IU3.js +1 -0
  47. package/static/chunk-zWWkMLc1.js +1 -0
  48. package/static/index.html +1 -1
  49. package/static/{main-3VZRFHGG.js → main-GFNB573R.js} +1 -1
  50. package/static/chunk-B17yZLWe.js +0 -1
  51. package/static/chunk-B8OjWpOp.js +0 -1
  52. package/static/chunk-BKYaECRn.js +0 -1
  53. package/static/chunk-BLN4QkSi.js +0 -1
  54. package/static/chunk-BaLWULJh.js +0 -1
  55. package/static/chunk-Bok52e_k.js +0 -1
  56. package/static/chunk-BowAQ7m9.js +0 -1
  57. package/static/chunk-Bz7bE4tT.js +0 -1
  58. package/static/chunk-C7P7hUiX.js +0 -1
  59. package/static/chunk-CAxHAuhV.js +0 -1
  60. package/static/chunk-CZA-kp5w.js +0 -1
  61. package/static/chunk-CwEMAptL.js +0 -1
  62. package/static/chunk-D1355dNd.js +0 -1
  63. package/static/chunk-D8qyjd0z.js +0 -1
  64. package/static/chunk-DOAz4S6b.js +0 -1
  65. package/static/chunk-DoJknvak.js +0 -1
  66. package/static/chunk-DrncP2Qx.js +0 -1
  67. package/static/chunk-IjKs-6Cl.js +0 -1
  68. package/static/chunk-LPXHXTnJ.js +0 -1
  69. package/static/chunk-SiaN7xSQ.js +0 -1
  70. package/static/chunk-bSS_wejP.js +0 -1
@@ -1 +0,0 @@
1
- import {f as f$1}from'./chunk--EZIkevK.js';import {o as ot}from'./chunk-Det50scT.js';import {_ as _n,C as Cn}from'./chunk-vINo5yVD.js';import {f}from'./chunk-BIJScqTM.js';import {Z as ZE,n as uh,C,V as Ve,b as at,q as qo,U as Uw,u as ue,s,r as r$1,c as bi,d as $8,e as al,bb as er,f as rl,g as $i,Y as pf,a0 as bd,a1 as sp,a2 as fp,h as ex,F as Fm,A as Am,K as Kt,j as _i,I as Iw,P as Pw,J as Jc,m as mh,l as _D,o as gI,L as Lh,p as Fw,z as rl$1,M as MD,H as HD,G as FD,k as iE,x as xD,w as lh,y as aE,B as AD,D as ch,O as Fu,Q as ju}from'./main-3VZRFHGG.js';import {a as ai,z}from'./chunk-Dm_EWkUz.js';import {j as j_,O as O_}from'./chunk-8ezEUcxN.js';import {p as pc,a as as,d as dc,K as Kl,c as cc,J as Ji,l as ls}from'./chunk-CtiubhW7.js';import'./chunk-iIEmH_ui.js';var _e=(n,h)=>h.id;function Ie(n,h){n&1&&(_i(0,"p",3),Iw(1),Pw(2,"transloco"),Jc()),n&2&&(gI(),Lh(Fw(2,1,"common.loading")));}function be(n,h){if(n&1&&(_i(0,"p",4),Iw(1),Jc()),n&2){let e=HD();gI(),Lh(e.loadError());}}function ye(n,h){if(n&1&&(_i(0,"p",5),Iw(1),Jc()),n&2){let e=HD(2);gI(),Lh(e.deleteError());}}function Re(n,h){if(n&1&&(_i(0,"p",9),Iw(1),Jc()),n&2){let e=HD(3);gI(),Lh(e.saveError());}}function Me(n,h){if(n&1&&uh(0,"nz-option",16),n&2){let e=h.$implicit,t=HD(3);lh("nzValue",e.id)("nzLabel",t.instanceLabel(e));}}function Ee(n,h){if(n&1){let e=FD();_i(0,"label",10)(1,"span"),Iw(2),Pw(3,"transloco"),Jc(),_i(4,"nz-select",20),Pw(5,"transloco"),mh("ngModelChange",function(a){Fu(e);let d=HD(3);return ju(d.formRemoteIdentifier.set(a))}),Jc(),iE(),Jc();}if(n&2){let e=HD(3);gI(2),Lh(Fw(3,4,"local-repos.form.remoteIdentifier")),gI(2),lh("nzOptions",e.remoteIdentifierOptions())("nzPlaceHolder",Fw(5,6,"local-repos.form.remoteIdentifierPlaceholder"))("ngModel",e.formRemoteIdentifier()),aE();}}function Le(n,h){if(n&1){let e=FD();_i(0,"section",6),_D(1,Re,2,1,"p",9),_i(2,"label",10)(3,"span"),Iw(4),Pw(5,"transloco"),Jc(),_i(6,"input",11),mh("ngModelChange",function(a){Fu(e);let d=HD(2);return ju(d.formName.set(a))}),Jc(),iE(),Jc(),_i(7,"div",10)(8,"span"),Iw(9),Pw(10,"transloco"),Jc(),_i(11,"app-path-picker",12),mh("pathChange",function(a){Fu(e);let d=HD(2);return ju(d.formLocalPath.set(a))}),Jc()(),_i(12,"div",10)(13,"span"),Iw(14),Pw(15,"transloco"),Jc(),_i(16,"p",13),Iw(17),Pw(18,"transloco"),Jc(),_i(19,"app-path-picker",12),mh("pathChange",function(a){Fu(e);let d=HD(2);return ju(d.formWorktreeBasePath.set(a))}),Jc()(),_i(20,"label",10)(21,"span"),Iw(22),Pw(23,"transloco"),Jc(),_i(24,"input",14),mh("ngModelChange",function(a){Fu(e);let d=HD(2);return ju(d.formDefaultBranch.set(a))}),Jc(),iE(),Jc(),_i(25,"label",10)(26,"span"),Iw(27),Pw(28,"transloco"),Jc(),_i(29,"p",13),Iw(30),Pw(31,"transloco"),Jc(),_i(32,"nz-select",15),Pw(33,"transloco"),mh("ngModelChange",function(a){Fu(e);let d=HD(2);return ju(d.onRemoteInstanceChange(a))}),xD(34,Me,1,2,"nz-option",16,_e),Jc(),iE(),Jc(),_D(36,Ee,6,8,"label",10),_i(37,"div",17)(38,"button",18),mh("click",function(){Fu(e);let a=HD(2);return ju(a.submitForm())}),Iw(39),Pw(40,"transloco"),Jc(),_i(41,"button",19),mh("click",function(){Fu(e);let a=HD(2);return ju(a.cancelForm())}),Iw(42),Pw(43,"transloco"),Jc()()();}if(n&2){let e=HD(2);gI(),MD(e.saveError()?1:-1),gI(3),Lh(Fw(5,18,"local-repos.form.name")),gI(2),lh("ngModel",e.formName()),aE(),gI(3),Lh(Fw(10,20,"local-repos.form.localPath")),gI(2),lh("path",e.formLocalPath()),gI(3),Lh(Fw(15,22,"local-repos.form.worktreeBasePath")),gI(3),Lh(Fw(18,24,"local-repos.form.worktreeBaseHint")),gI(2),lh("path",e.formWorktreeBasePath()),gI(3),Lh(Fw(23,26,"local-repos.form.defaultBranch")),gI(2),lh("ngModel",e.formDefaultBranch()),aE(),gI(3),Lh(Fw(28,28,"local-repos.form.remoteInstance")),gI(3),Lh(Fw(31,30,"local-repos.form.remoteHint")),gI(2),lh("nzPlaceHolder",Fw(33,32,"local-repos.form.remoteInstancePlaceholder"))("ngModel",e.formRemoteInstanceId()),aE(),gI(2),AD(e.repoCapableInstances()),gI(2),MD(e.formRemoteInstanceId()?36:-1),gI(2),lh("disabled",e.saving()),gI(),rl$1(" ",Fw(40,34,"common.save")," "),gI(3),rl$1(" ",Fw(43,36,"common.cancel")," ");}}function ze(n,h){n&1&&(_i(0,"p",7),Iw(1),Pw(2,"transloco"),Jc()),n&2&&(gI(),Lh(Fw(2,1,"local-repos.emptyState")));}function Be(n,h){if(n&1){let e=FD();_i(0,"tr")(1,"td"),Iw(2),Jc(),_i(3,"td",21),Iw(4),Jc(),_i(5,"td",21),Iw(6),Jc(),_i(7,"td"),Iw(8),Jc(),_i(9,"td"),Iw(10),Jc(),_i(11,"td",22)(12,"button",23),mh("click",function(){let a=Fu(e).$implicit,d=HD(3);return ju(d.openEditForm(a))}),Iw(13),Pw(14,"transloco"),Jc(),_i(15,"button",24),Pw(16,"transloco"),mh("nzOnConfirm",function(){let a=Fu(e).$implicit,d=HD(3);return ju(d.deleteRepo(a))}),Iw(17),Pw(18,"transloco"),Jc()()();}if(n&2){let e=h.$implicit,t=HD(3);ch("data-testid","local-repo-row-"+e.id),gI(2),Lh(e.name),gI(2),Lh(e.localPath),gI(2),Lh(e.worktreeBasePath||"\u2014"),gI(2),Lh(e.defaultBranch||"\u2014"),gI(2),Lh(t.remoteRepoLabel(e)),gI(2),ch("data-testid","edit-local-repo-"+e.id),gI(),rl$1(" ",Fw(14,11,"local-repos.edit")," "),gI(2),lh("nzPopconfirmTitle",Fw(16,13,"local-repos.deleteConfirm")),ch("data-testid","delete-local-repo-"+e.id),gI(2),rl$1(" ",Fw(18,15,"local-repos.delete")," ");}}function Pe(n,h){if(n&1&&(_i(0,"nz-table",8)(1,"thead")(2,"tr")(3,"th"),Iw(4),Pw(5,"transloco"),Jc(),_i(6,"th"),Iw(7),Pw(8,"transloco"),Jc(),_i(9,"th"),Iw(10),Pw(11,"transloco"),Jc(),_i(12,"th"),Iw(13),Pw(14,"transloco"),Jc(),_i(15,"th"),Iw(16),Pw(17,"transloco"),Jc(),_i(18,"th"),Iw(19),Pw(20,"transloco"),Jc()()(),_i(21,"tbody"),xD(22,Be,19,17,"tr",null,_e),Jc()()),n&2){let e=HD(2);lh("nzData",e.repos())("nzShowPagination",false),gI(4),Lh(Fw(5,8,"local-repos.column.name")),gI(3),Lh(Fw(8,10,"local-repos.column.localPath")),gI(3),Lh(Fw(11,12,"local-repos.column.worktreeBasePath")),gI(3),Lh(Fw(14,14,"local-repos.column.defaultBranch")),gI(3),Lh(Fw(17,16,"local-repos.column.remoteRepo")),gI(3),Lh(Fw(20,18,"local-repos.column.actions")),gI(3),AD(e.repos());}}function Se(n,h){if(n&1&&(_D(0,ye,2,1,"p",5),_D(1,Le,44,38,"section",6),_D(2,ze,3,3,"p",7)(3,Pe,24,20,"nz-table",8)),n&2){let e=HD();MD(e.deleteError()?0:-1),gI(),MD(e.formOpen()?1:-1),gI(),MD(e.repos().length===0&&!e.formOpen()?2:e.repos().length>0?3:-1);}}var Ne=[],ge=(()=>{class n{constructor(){this.reposApi=C(f),this.settingsApi=C(f$1),this.transloco=C(Ve),this.destroyRef=C(at),this.repos=qo([]),this.settings=qo(null),this.loading=qo(true),this.loadError=qo(null),this.saveError=qo(null),this.deleteError=qo(null),this.saving=qo(false),this.formOpen=qo(false),this.editingId=qo(null),this.formName=qo(""),this.formLocalPath=qo(""),this.formWorktreeBasePath=qo(""),this.formDefaultBranch=qo(""),this.formRemoteInstanceId=qo(null),this.formRemoteIdentifier=qo(null),this.repoCapableInstances=Uw(()=>(this.settings()?.providerInstances??[]).filter(e=>j_(e)&&e.subjectType==="pull_request")),this.selectedRemoteInstance=Uw(()=>{let e=this.formRemoteInstanceId();return this.repoCapableInstances().find(t=>t.id===e)??null}),this.remoteIdentifierOptions=Uw(()=>{let e=this.selectedRemoteInstance(),t=e?O_(e.config):Ne,a=this.formRemoteIdentifier()?.trim()??"";return (a&&!t.includes(a)?[a,...t]:t).map(x=>({label:x,value:x}))}),this.reload(),this.settingsApi.getSettings().pipe(ue(this.destroyRef)).subscribe({next:e=>this.settings.set(e),error:()=>this.settings.set({providerInstances:[]})});}instanceLabel(e){return e.displayName||e.id}remoteRepoLabel(e){let t=e.remoteRepo;if(!t)return "\u2014";let d=this.repoCapableInstances().find(x=>x.id===t.providerInstanceId)?.displayName||t.providerInstanceId;return `${t.identifier} (${d})`}openCreateForm(){this.editingId.set(null),this.formName.set(""),this.formLocalPath.set(""),this.formWorktreeBasePath.set(""),this.formDefaultBranch.set(""),this.formRemoteInstanceId.set(null),this.formRemoteIdentifier.set(null),this.saveError.set(null),this.formOpen.set(true);}openEditForm(e){this.editingId.set(e.id),this.formName.set(e.name),this.formLocalPath.set(e.localPath),this.formWorktreeBasePath.set(e.worktreeBasePath??""),this.formDefaultBranch.set(e.defaultBranch??""),this.formRemoteInstanceId.set(e.remoteRepo?.providerInstanceId??null),this.formRemoteIdentifier.set(e.remoteRepo?.identifier??null),this.saveError.set(null),this.formOpen.set(true);}cancelForm(){this.formOpen.set(false),this.editingId.set(null),this.saveError.set(null);}onRemoteInstanceChange(e){this.formRemoteInstanceId.set(e);let t=e?O_(this.repoCapableInstances().find(d=>d.id===e)?.config):[],a=this.formRemoteIdentifier();a&&!t.includes(a)?this.formRemoteIdentifier.set(t[0]??null):!a&&t.length===1?this.formRemoteIdentifier.set(t[0]):e||this.formRemoteIdentifier.set(null);}submitForm(){if(this.saving())return;this.saveError.set(null),this.saving.set(true);let e=this.formRemoteInstanceId()?.trim()??"",t=this.formRemoteIdentifier()?.trim()??"",a=e&&t?{providerInstanceId:e,identifier:t}:null,d=s(r$1(r$1({name:this.formName().trim(),localPath:this.formLocalPath().trim()},this.formWorktreeBasePath().trim()?{worktreeBasePath:this.formWorktreeBasePath().trim()}:{worktreeBasePath:void 0}),this.formDefaultBranch().trim()?{defaultBranch:this.formDefaultBranch().trim()}:{defaultBranch:void 0}),{remoteRepo:a??void 0}),x=this.editingId();(x?this.reposApi.update(x,s(r$1({},d),{remoteRepo:a})):this.reposApi.create(d)).pipe(ue(this.destroyRef)).subscribe({next:L=>{this.saving.set(false),this.formOpen.set(false),this.editingId.set(null),this.repos.update(Ce=>[...Ce.filter(T=>T.id!==L.id),L].sort((T,xe)=>T.name.localeCompare(xe.name))),this.formName.set(""),this.formLocalPath.set(""),this.formWorktreeBasePath.set(""),this.formDefaultBranch.set(""),this.formRemoteInstanceId.set(null),this.formRemoteIdentifier.set(null);},error:L=>{this.saving.set(false),this.saveError.set(this.errorMessage(L,this.transloco.translate("local-repos.saveFailed")));}});}deleteRepo(e){this.deleteError.set(null),this.reposApi.delete(e.id).pipe(ue(this.destroyRef)).subscribe({next:()=>{this.repos.update(t=>t.filter(a=>a.id!==e.id));},error:t=>{this.deleteError.set(this.errorMessage(t,this.transloco.translate("local-repos.deleteFailed")));}});}reload(){this.loading.set(true),this.loadError.set(null),this.reposApi.list().pipe(ue(this.destroyRef)).subscribe({next:e=>{this.repos.set(e),this.loading.set(false);},error:e=>{this.loading.set(false),this.loadError.set(this.errorMessage(e,this.transloco.translate("local-repos.loadFailed")));}});}errorMessage(e,t){return e instanceof bi||e instanceof Error?e.message:t}static{this.\u0275fac=function(t){return new(t||n)};}static{this.\u0275cmp=ZE({type:n,selectors:[["app-local-repository-list"]],decls:11,vars:7,consts:[["data-testid","local-repos-manage",1,"list-page"],[1,"header"],["nz-button","","nzType","primary","type","button","data-testid","create-local-repo",3,"click"],["data-testid","loading"],["data-testid","load-error",1,"error"],["data-testid","delete-error",1,"error"],["data-testid","local-repo-form",1,"form"],["data-testid","empty-state",1,"empty"],["data-testid","local-repo-table",3,"nzData","nzShowPagination"],["data-testid","save-error",1,"error"],[1,"field"],["nz-input","","data-testid","local-repo-name",3,"ngModelChange","ngModel"],["mode","directories",3,"pathChange","path"],[1,"hint"],["nz-input","","data-testid","local-repo-default-branch",3,"ngModelChange","ngModel"],["data-testid","local-repo-remote-instance","nzAllowClear","",3,"ngModelChange","nzPlaceHolder","ngModel"],[3,"nzValue","nzLabel"],[1,"form-actions"],["nz-button","","nzType","primary","type","button","data-testid","save-local-repo",3,"click","disabled"],["nz-button","","type","button","data-testid","cancel-local-repo",3,"click"],["data-testid","local-repo-remote-identifier","nzAllowClear","",3,"ngModelChange","nzOptions","nzPlaceHolder","ngModel"],[1,"path-cell"],[1,"actions"],["nz-button","","nzType","link","type","button",3,"click"],["nz-button","","nzType","link","nzDanger","","type","button","nz-popconfirm","",3,"nzOnConfirm","nzPopconfirmTitle"]],template:function(t,a){t&1&&(_i(0,"div",0)(1,"header",1)(2,"h1"),Iw(3),Pw(4,"transloco"),Jc(),_i(5,"button",2),mh("click",function(){return a.openCreateForm()}),Iw(6),Pw(7,"transloco"),Jc()(),_D(8,Ie,3,3,"p",3)(9,be,2,1,"p",4)(10,Se,4,3),Jc()),t&2&&(gI(3),Lh(Fw(4,3,"local-repos.title")),gI(3),rl$1(" ",Fw(7,5,"local-repos.create")," "),gI(2),MD(a.loading()?8:a.loadError()?9:10));},dependencies:[$8,al,er,rl,$i,pf,bd,sp,fp,ai,z,_n,Cn,ex,Fm,Am,pc,as,dc,Kl,cc,Ji,ls,ot,Kt],styles:[".list-page[_ngcontent-%COMP%]{padding:1.25rem 1.5rem 3rem;display:flex;flex-direction:column;gap:1rem}.header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;gap:1rem;align-items:flex-start}.form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.65rem;padding:.85rem;border:1px solid #e7e5e4;background:#fff}.field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem}.field[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{font-size:.85rem;color:#57534e}.hint[_ngcontent-%COMP%]{margin:.2rem 0 0;font-size:.8rem;color:#78716c}.form-actions[_ngcontent-%COMP%]{display:flex;gap:.5rem}.empty[_ngcontent-%COMP%]{text-align:center;padding:2.5rem 1rem;border:1px dashed #d6d3d1;background:#fff9}.error[_ngcontent-%COMP%]{color:#9f1239}.actions[_ngcontent-%COMP%]{white-space:nowrap}.path-cell[_ngcontent-%COMP%]{overflow-wrap:anywhere;word-break:break-word}"]});}}return n})();var st=(()=>{class n{static{this.\u0275fac=function(t){return new(t||n)};}static{this.\u0275cmp=ZE({type:n,selectors:[["app-local-repositories-manage"]],decls:1,vars:0,template:function(t,a){t&1&&uh(0,"app-local-repository-list");},dependencies:[ge],encapsulation:2});}}return n})();export{st as LocalRepositoriesManageComponent};
@@ -1 +0,0 @@
1
- import {l}from'./chunk-D19C8Gcb.js';import {T}from'./chunk-SiaN7xSQ.js';import {_ as _n,C as Cn}from'./chunk-vINo5yVD.js';import {C,V as Ve,b as at,b0 as jn,R as J1,q as qo,u as ue,aS as v,aY as Dg,c as bi,Z as ZE,d as $8,e as al,f as rl,g as $i,v as v3,Y as pf,a0 as bd,a1 as sp,a2 as fp,b1 as ts,h as ex,F as Fm,A as Am,K as Kt$1,G as FD,j as _i,I as Iw,P as Pw,J as Jc,m as mh,l as _D,o as gI,L as Lh,p as Fw,w as lh,z as rl$1,M as MD,b2 as Le,b3 as Wn,az as jw,E as Aw,H as HD,x as xD,N as ND,k as iE,y as aE,B as AD,b4 as N2,aV as ix,b5 as cx,i as ie$1,n as uh,D as ch,aO as SD,aP as Mh,O as Fu,Q as ju,aH as QD}from'./main-3VZRFHGG.js';import {b}from'./chunk-BcDRgzYZ.js';import {N as Nt,K as Ke}from'./chunk-C7P7hUiX.js';import {W,I}from'./chunk-Bok52e_k.js';import {i as ig,c as c_}from'./chunk-8ezEUcxN.js';import {p as pc,a as as,d as dc,K as Kl,c as cc,J as Ji,l as ls}from'./chunk-CtiubhW7.js';import'./chunk-iIEmH_ui.js';var Ot=i=>({name:i}),Lt=(()=>{class i{constructor(){this.modalRef=C(Le),this.data=C(Wn);}cancel(){this.modalRef.close(void 0);}choose(t){this.modalRef.close(t);}static{this.\u0275fac=function(e){return new(e||i)};}static{this.\u0275cmp=ZE({type:i,selectors:[["app-workflow-import-conflict"]],decls:14,vars:15,consts:[["data-testid","import-conflict-dialog"],["data-testid","import-conflict-message"],[1,"dialog-actions"],["nz-button","","type","button","data-testid","import-conflict-cancel",3,"click"],["nz-button","","type","button","data-testid","import-conflict-create-new",3,"click"],["nz-button","","nzType","primary","type","button","data-testid","import-conflict-update",3,"click"]],template:function(e,a){e&1&&(_i(0,"div",0)(1,"p",1),Iw(2),Pw(3,"transloco"),Jc(),_i(4,"div",2)(5,"button",3),mh("click",function(){return a.cancel()}),Iw(6),Pw(7,"transloco"),Jc(),_i(8,"button",4),mh("click",function(){return a.choose("create_new")}),Iw(9),Pw(10,"transloco"),Jc(),_i(11,"button",5),mh("click",function(){return a.choose("update")}),Iw(12),Pw(13,"transloco"),Jc()()()),e&2&&(gI(2),rl$1(" ",jw(3,4,"workflows.import.conflictBody",Aw(13,Ot,a.data.name))," "),gI(4),rl$1(" ",Fw(7,7,"common.cancel")," "),gI(3),rl$1(" ",Fw(10,9,"workflows.import.createNew")," "),gI(3),rl$1(" ",Fw(13,11,"workflows.import.update")," "));},dependencies:[pf,bd,sp,fp,Kt$1],styles:["p[_ngcontent-%COMP%]{margin:0 0 1.25rem;color:#44403c}.dialog-actions[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:.5rem}"]});}}return i})();var Pt=(()=>{class i{constructor(){this.http=C(N2),this.baseUrl=`${ix.apiBaseUrl}/workflow-library`;}list(){return this.http.get(this.baseUrl).pipe(cx())}add(t){return this.http.post(`${this.baseUrl}/${encodeURIComponent(t)}/add`,{}).pipe(cx())}static{this.\u0275fac=function(e){return new(e||i)};}static{this.\u0275prov=ie$1({token:i,factory:i.\u0275fac,providedIn:"root"});}}return i})();var At=(i,d)=>d.id;function Vt(i,d){i&1&&(_i(0,"p",2),Iw(1),Pw(2,"transloco"),Jc()),i&2&&(gI(),Lh(Fw(2,1,"common.loading")));}function Rt(i,d){if(i&1&&(_i(0,"p",3),Iw(1),Jc()),i&2){let t=HD();gI(),Lh(t.loadError());}}function Ht(i,d){if(i&1&&(_i(0,"p",4),Iw(1),Jc()),i&2){let t=HD(2);gI(),Lh(t.addError());}}function Kt(i,d){if(i&1&&(_i(0,"nz-tag"),Iw(1),Pw(2,"transloco"),Jc()),i&2){let t=d.$implicit,e=HD(3);gI(),Lh(Fw(2,1,e.subjectTypeKey(t)));}}function Ut(i,d){if(i&1&&(_i(0,"li")(1,"span"),Iw(2),Jc(),_i(3,"span",14),Iw(4),Pw(5,"transloco"),Jc()()),i&2){let t=d.$implicit,e=HD(4);Mh("margin-left",t.depth,"rem"),gI(2),Lh(t.name),gI(2),Lh(Fw(5,4,e.stepTypeKey(t.type)));}}function Jt(i,d){if(i&1&&(_i(0,"ol",12),xD(1,Ut,6,6,"li",13,SD),Jc()),i&2){let t=HD().$implicit,e=HD(2);ch("data-testid","library-steps-"+t.id),gI(),AD(e.previewSteps(t));}}function Zt(i,d){if(i&1){let t=FD();_i(0,"nz-card")(1,"div",6)(2,"h2"),Iw(3),Jc(),_i(4,"nz-tag"),Iw(5),Pw(6,"transloco"),Jc()(),_i(7,"p",7),Iw(8),Jc(),_i(9,"div",8),xD(10,Kt,3,3,"nz-tag",null,ND),Jc(),_i(12,"div",9)(13,"button",10),mh("click",function(){let a=Fu(t).$implicit,f=HD(2);return ju(f.togglePreview(a.id))}),Iw(14),Pw(15,"transloco"),Jc(),_i(16,"button",11),mh("click",function(){let a=Fu(t).$implicit,f=HD(2);return ju(f.addToMyWorkflows(a.id))}),Iw(17),Pw(18,"transloco"),Jc()(),_D(19,Jt,3,1,"ol",12),Jc();}if(i&2){let t=d.$implicit,e=HD(2);ch("data-testid","library-entry-"+t.id),gI(2),ch("data-testid","library-name-"+t.id),gI(),Lh(t.name),gI(),ch("data-testid","library-source-"+t.id),gI(),Lh(Fw(6,13,e.sourceKey(t.source))),gI(2),ch("data-testid","library-description-"+t.id),gI(),rl$1(" ",t.description," "),gI(2),AD(e.appliesToValues(t)),gI(3),ch("data-testid","library-preview-"+t.id),gI(),rl$1(" ",Fw(15,15,e.isExpanded(t.id)?"workflow-library.hideSteps":"workflow-library.previewSteps")," "),gI(2),lh("disabled",e.addingId()!==null),ch("data-testid","library-add-"+t.id),gI(),rl$1(" ",Fw(18,17,e.addingId()===t.id?"workflow-library.adding":"workflow-library.add")," "),gI(2),MD(e.isExpanded(t.id)?19:-1);}}function qt(i,d){if(i&1&&(_D(0,Ht,2,1,"p",4),_i(1,"div",5),xD(2,Zt,20,19,"nz-card",null,At),Jc()),i&2){let t=HD();MD(t.addError()?0:-1),gI(2),AD(t.entries());}}var jt=(()=>{class i{constructor(){this.libraryApi=C(Pt),this.router=C(J1),this.transloco=C(Ve),this.destroyRef=C(at),this.modalRef=C(Le,{optional:true}),this.entries=qo([]),this.loading=qo(true),this.loadError=qo(null),this.addError=qo(null),this.addingId=qo(null),this.expandedIds=qo(new Set),this.libraryApi.list().pipe(ue(this.destroyRef)).subscribe({next:t=>{this.entries.set(t),this.loading.set(false);},error:t=>{this.loading.set(false),this.loadError.set(this.errorMessage(t,this.transloco.translate("workflow-library.loadFailed")));}});}sourceKey(t){return `workflow-library.source.${t}`}appliesToValues(t){let e=t.workflowDefinition.appliesTo;return e==="none"?["none"]:Array.isArray(e)?e:[e]}subjectTypeKey(t){return `workflow-editor.subjectType.${t}`}stepTypeKey(t){return `step-list.stepType.${t}`}isExpanded(t){return this.expandedIds().has(t)}togglePreview(t){this.expandedIds.update(e=>{let a=new Set(e);return a.has(t)?a.delete(t):a.add(t),a});}previewSteps(t){return Dt(t.workflowDefinition.steps,0)}addToMyWorkflows(t){this.addingId()||(this.addError.set(null),this.addingId.set(t),this.libraryApi.add(t).pipe(ue(this.destroyRef)).subscribe({next:e=>{this.addingId.set(null),this.modalRef?.close(),this.router.navigate(["/workflows",e.id,"edit"]);},error:e=>{this.addingId.set(null),this.addError.set(this.errorMessage(e,this.transloco.translate("workflow-library.addFailed")));}}));}errorMessage(t,e){return t instanceof bi||t instanceof Error?t.message:e}static{this.\u0275fac=function(e){return new(e||i)};}static{this.\u0275cmp=ZE({type:i,selectors:[["app-workflow-library-browser"]],decls:7,vars:4,consts:[["data-testid","workflow-library-browser",1,"library"],[1,"lede"],["data-testid","library-loading"],["data-testid","library-load-error",1,"error"],["data-testid","library-add-error",1,"error"],[1,"cards"],[1,"card-head"],[1,"description"],[1,"applies-to"],[1,"card-actions"],["nz-button","","nzType","link","type","button",3,"click"],["nz-button","","nzType","primary","type","button",3,"click","disabled"],[1,"steps-preview"],[3,"margin-left"],[1,"step-type"]],template:function(e,a){e&1&&(_i(0,"div",0)(1,"p",1),Iw(2),Pw(3,"transloco"),Jc(),_D(4,Vt,3,3,"p",2)(5,Rt,2,1,"p",3)(6,qt,4,1),Jc()),e&2&&(gI(2),Lh(Fw(3,2,"workflow-library.lede")),gI(2),MD(a.loading()?4:a.loadError()?5:6));},dependencies:[$8,pf,bd,sp,fp,Nt,Ke,W,I,Kt$1],styles:[".library[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.75rem}.lede[_ngcontent-%COMP%]{margin:0;color:#57534e}.cards[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.75rem}.card-head[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:flex-start;gap:.75rem}.card-head[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{margin:0;font-size:1.05rem;font-weight:600}.description[_ngcontent-%COMP%]{margin:.5rem 0 0;color:#57534e}.applies-to[_ngcontent-%COMP%]{margin-top:.5rem}.card-actions[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.5rem;align-items:center;margin-top:.5rem}.steps-preview[_ngcontent-%COMP%]{margin:.75rem 0 0;padding-left:1.25rem;color:#44403c}.steps-preview[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{display:flex;justify-content:space-between;gap:.75rem;margin:.25rem 0}.step-type[_ngcontent-%COMP%]{color:#78716c;font-size:.85rem}.error[_ngcontent-%COMP%]{color:#9f1239}"]});}}return i})();function Dt(i,d){let t=[];for(let e of i)t.push({name:e.name,type:e.type,depth:d}),e.type==="loop"&&Array.isArray(e.steps)&&t.push(...Dt(e.steps,d+1));return t}var Gt=i=>({count:i}),Qt=i=>["/workflows",i,"edit"],Xt=(i,d)=>d.id;function Yt(i,d){if(i&1&&(_i(0,"p",9),Iw(1),Jc()),i&2){let t=HD();gI(),Lh(t.actionError());}}function te(i,d){i&1&&(_i(0,"p",10),Iw(1),Pw(2,"transloco"),Jc()),i&2&&(gI(),Lh(Fw(2,1,"common.loading")));}function ee(i,d){if(i&1&&(_i(0,"p",11),Iw(1),Jc()),i&2){let t=HD();gI(),Lh(t.loadError());}}function ie(i,d){if(i&1&&(uh(0,"nz-option",14),Pw(1,"transloco")),i&2){let t=d.$implicit,e=HD(2);lh("nzValue",t)("nzLabel",Fw(1,2,e.subjectHandlingFilterKey(t)));}}function ne(i,d){if(i&1&&(_i(0,"p",15),Iw(1),Jc()),i&2){let t=HD(2);gI(),Lh(t.deleteError());}}function oe(i,d){if(i&1){let t=FD();_i(0,"section",16)(1,"p"),Iw(2),Pw(3,"transloco"),Jc(),_i(4,"div",18)(5,"button",19),mh("click",function(){Fu(t);let a=HD(2);return ju(a.openLibrary())}),Iw(6),Pw(7,"transloco"),Jc(),_i(8,"a",20),Iw(9),Pw(10,"transloco"),Jc()()();}i&2&&(gI(2),Lh(Fw(3,3,"workflows.list.emptyState")),gI(4),rl$1(" ",Fw(7,5,"workflows.list.emptyBrowseLibrary")," "),gI(3),rl$1(" ",Fw(10,7,"workflows.list.emptyCreateButton")," "));}function re(i,d){if(i&1&&(_i(0,"span"),Iw(1),Jc()),i&2){let t=HD().$implicit;ch("data-testid","description-"+t.id),gI(),Lh(t.description);}}function ae(i,d){if(i&1&&(_i(0,"span",22),Iw(1),Pw(2,"transloco"),Jc()),i&2){let t=HD().$implicit;ch("data-testid","description-"+t.id),gI(),Lh(Fw(2,2,"workflows.list.noDescription"));}}function le(i,d){if(i&1&&(_i(0,"nz-tag"),Iw(1),Pw(2,"transloco"),Jc()),i&2){let t=d.$implicit,e=HD().$implicit,a=HD(3);ch("data-testid","applies-to-"+e.id),gI(),Lh(Fw(2,2,a.subjectTypeKey(t)));}}function se(i,d){if(i&1){let t=FD();_i(0,"tr")(1,"td")(2,"span"),Iw(3),Jc()(),_i(4,"td",21),_D(5,re,2,2,"span")(6,ae,3,4,"span",22),Jc(),_i(7,"td"),xD(8,le,3,4,"nz-tag",null,ND),Jc(),_i(10,"td")(11,"nz-tag"),Iw(12),Pw(13,"transloco"),Jc()(),_i(14,"td")(15,"span"),Iw(16),Pw(17,"transloco"),Jc()(),_i(18,"td",23)(19,"a",24),Iw(20),Pw(21,"transloco"),Jc(),_i(22,"button",25),mh("click",function(){let a=Fu(t).$implicit,f=HD(3);return ju(f.exportWorkflow(a))}),Iw(23),Pw(24,"transloco"),Jc(),_i(25,"button",26),Pw(26,"transloco"),Pw(27,"transloco"),Pw(28,"transloco"),mh("nzOnConfirm",function(){let a=Fu(t).$implicit,f=HD(3);return ju(f.deleteWorkflow(a.id))}),Iw(29),Pw(30,"transloco"),Jc()()();}if(i&2){let t=d.$implicit,e=HD(3);ch("data-testid","workflow-"+t.id),gI(2),ch("data-testid","name-"+t.id),gI(),Lh(t.name),gI(2),MD(t.description?.trim()?5:6),gI(3),AD(e.appliesToValues(t)),gI(3),ch("data-testid","subject-handling-"+t.id),gI(),Lh(Fw(13,18,e.subjectHandlingKey(t.subjectHandling))),gI(3),ch("data-testid","step-count-"+t.id),gI(),Lh(jw(17,20,"workflows.list.stepCount",Aw(35,Gt,t.steps.length))),gI(3),lh("routerLink",Aw(37,Qt,t.id)),ch("data-testid","edit-"+t.id),gI(),rl$1(" ",Fw(21,23,"workflows.list.edit")," "),gI(2),ch("data-testid","export-"+t.id),gI(),rl$1(" ",Fw(24,25,"workflows.list.export")," "),gI(2),lh("nzPopconfirmTitle",Fw(26,27,"workflows.list.deleteConfirm"))("nzOkText",Fw(27,29,"workflows.list.delete"))("nzCancelText",Fw(28,31,"common.cancel")),ch("data-testid","delete-"+t.id),gI(4),rl$1(" ",Fw(30,33,"workflows.list.delete")," ");}}function pe(i,d){if(i&1&&(_i(0,"nz-table",17)(1,"thead")(2,"tr")(3,"th"),Iw(4),Pw(5,"transloco"),Jc(),_i(6,"th"),Iw(7),Pw(8,"transloco"),Jc(),_i(9,"th"),Iw(10),Pw(11,"transloco"),Jc(),_i(12,"th"),Iw(13),Pw(14,"transloco"),Jc(),_i(15,"th"),Iw(16),Pw(17,"transloco"),Jc(),_i(18,"th"),Iw(19),Pw(20,"transloco"),Jc()()(),_i(21,"tbody"),xD(22,se,31,39,"tr",null,Xt),Jc()()),i&2){let t=HD(2);lh("nzData",t.workflows())("nzFrontPagination",false)("nzShowPagination",false),gI(4),Lh(Fw(5,9,"workflows.list.column.name")),gI(3),Lh(Fw(8,11,"workflows.list.column.description")),gI(3),Lh(Fw(11,13,"workflow-editor.appliesTo")),gI(3),Lh(Fw(14,15,"workflow-editor.subjectHandling.label")),gI(3),Lh(Fw(17,17,"workflows.list.column.steps")),gI(3),Lh(Fw(20,19,"workflows.list.column.actions")),gI(3),AD(t.workflows());}}function de(i,d){if(i&1){let t=FD();_i(0,"div",12)(1,"span"),Iw(2),Pw(3,"transloco"),Jc(),_i(4,"nz-select",13),mh("ngModelChange",function(a){Fu(t);let f=HD();return ju(f.setSubjectHandlingFilter(a))}),xD(5,ie,2,4,"nz-option",14,ND),Jc(),iE(),Jc(),_D(7,ne,2,1,"p",15),_D(8,oe,11,9,"section",16)(9,pe,24,21,"nz-table",17);}if(i&2){let t=HD();gI(2),Lh(Fw(3,4,"workflows.list.filterBySubjectHandling")),gI(2),lh("ngModel",t.subjectHandlingFilter()),aE(),gI(),AD(t.subjectHandlingOptions),gI(2),MD(t.deleteError()?7:-1),gI(),MD(t.workflows().length===0?8:9);}}var si=(()=>{class i{constructor(){this.workflowsApi=C(b),this.transloco=C(Ve),this.destroyRef=C(at),this.modal=C(jn),this.router=C(J1),this.workflows=qo([]),this.loading=qo(true),this.loadError=qo(null),this.deleteError=qo(null),this.actionError=qo(null),this.importing=qo(false),this.subjectHandlingFilter=qo("all"),this.subjectHandlingOptions=["all","per-subject","collection"],this.load();}setSubjectHandlingFilter(t){this.subjectHandlingFilter.set(t),this.load();}appliesToValues(t){let e=t.appliesTo;return e==="none"?["none"]:Array.isArray(e)?e:[e]}subjectTypeKey(t){return `workflow-editor.subjectType.${t}`}subjectHandlingKey(t){return `workflow-editor.subjectHandling.${t}`}subjectHandlingFilterKey(t){return t==="all"?"workflows.list.filterAll":`workflow-editor.subjectHandling.${t}`}deleteWorkflow(t){this.deleteError.set(null),this.workflowsApi.delete(t).pipe(ue(this.destroyRef)).subscribe({next:()=>{this.workflows.update(e=>e.filter(a=>a.id!==t));},error:e=>{this.deleteError.set(this.errorMessage(e,this.transloco.translate("workflows.list.deleteFailed")));}});}openLibrary(){this.modal.create({nzTitle:this.transloco.translate("workflow-library.title"),nzContent:jt,nzFooter:null,nzWidth:720});}exportWorkflow(t){this.actionError.set(null),this.workflowsApi.exportDefinition(t.id).pipe(ue(this.destroyRef)).subscribe({next:e=>{l(`${ig(e.name)}.json`,JSON.stringify(e,null,2),"application/json");},error:e=>{this.actionError.set(this.errorMessage(e,this.transloco.translate("workflows.list.exportFailed")));}});}downloadInstructions(){this.actionError.set(null),this.workflowsApi.getInstructions().pipe(ue(this.destroyRef)).subscribe({next:t=>{l("knoflows-workflow-agent-instructions.md",t,"text/markdown;charset=utf-8");},error:t=>{this.actionError.set(this.errorMessage(t,this.transloco.translate("workflows.list.instructionsFailed")));}});}onImportFile(t){let e=t.target,a=e.files?.[0];e.value="",!(!a||this.importing())&&this.readAndImport(a);}importJsonText(t){this.actionError.set(null);let e;try{e=JSON.parse(t);}catch(f){this.actionError.set(this.transloco.translate("workflows.list.importInvalidJson"));return}let a=c_.safeParse(e);if(!a.success){let f=T(a.error);this.actionError.set(`${this.transloco.translate("workflows.list.importInvalidSchema")}: ${f[0]??""}`);return}this.postImport(e);}readAndImport(t){return v(this,null,function*(){try{this.importJsonText(yield t.text());}catch(e){this.actionError.set(this.transloco.translate("workflows.list.importInvalidJson"));}})}postImport(t,e){this.importing.set(true),this.actionError.set(null),this.workflowsApi.importDefinition(e?{workflowDefinition:t,resolution:e}:{workflowDefinition:t}).pipe(ue(this.destroyRef)).subscribe({next:a=>{this.importing.set(false),this.router.navigate(["/workflows",a.id,"edit"]);},error:a=>{this.importing.set(false);let f=this.importConflict(a);if(f&&!e){this.openImportConflict(t,f.name);return}this.actionError.set(this.errorMessage(a,this.transloco.translate("workflows.list.importFailed")));}});}openImportConflict(t,e){(this.modal.create({nzTitle:this.transloco.translate("workflows.import.conflictTitle"),nzContent:Lt,nzData:{name:e},nzFooter:null}).afterClose??Dg(void 0)).pipe(ue(this.destroyRef)).subscribe(T=>{(T==="update"||T==="create_new")&&this.postImport(t,T);});}importConflict(t){if(!(t instanceof bi)||t.httpStatus!==409||!t.details)return null;let e=t.details.conflictingWorkflowId,a=t.details.conflictingWorkflowName;return typeof e!="string"||typeof a!="string"?null:{id:e,name:a}}load(){let t=this.subjectHandlingFilter();this.loading.set(true),this.loadError.set(null),this.workflowsApi.list(t==="all"?void 0:{subjectHandling:t}).pipe(ue(this.destroyRef)).subscribe({next:e=>{this.workflows.set(e),this.loading.set(false);},error:e=>{this.loading.set(false),this.loadError.set(this.errorMessage(e,this.transloco.translate("workflows.list.loadFailed")));}});}errorMessage(t,e){return t instanceof bi||t instanceof Error?t.message:e}static{this.\u0275fac=function(e){return new(e||i)};}static{this.\u0275cmp=ZE({type:i,selectors:[["app-workflow-list"]],decls:24,vars:18,consts:[["importFileInput",""],["data-testid","workflows-list",1,"list-page"],[1,"header"],[1,"header-actions"],["type","file","accept","application/json,.json","hidden","","data-testid","import-file",3,"change"],["nz-button","","type","button","data-testid","import-workflow",3,"click","disabled"],["nz-button","","type","button","data-testid","download-instructions",3,"click"],["nz-button","","type","button","data-testid","browse-library",3,"click"],["nz-button","","nzType","primary","routerLink","/workflows/new","data-testid","create-workflow"],["data-testid","action-error",1,"error"],["data-testid","loading"],["data-testid","load-error",1,"error"],[1,"field"],["data-testid","subject-handling-filter",3,"ngModelChange","ngModel"],[3,"nzValue","nzLabel"],["data-testid","delete-error",1,"error"],["data-testid","empty-state",1,"empty"],["data-testid","workflow-items",3,"nzData","nzFrontPagination","nzShowPagination"],[1,"empty-actions"],["nz-button","","type","button","data-testid","empty-browse-library",3,"click"],["nz-button","","nzType","primary","routerLink","/workflows/new","data-testid","empty-create"],[1,"description-cell"],[1,"muted"],[1,"actions"],["nz-button","","nzType","link",3,"routerLink"],["nz-button","","nzType","link","type","button",3,"click"],["nz-button","","nzType","link","nzDanger","","type","button","nz-popconfirm","",3,"nzOnConfirm","nzPopconfirmTitle","nzOkText","nzCancelText"]],template:function(e,a){if(e&1){let f=FD();_i(0,"main",1)(1,"header",2)(2,"h1"),Iw(3),Pw(4,"transloco"),Jc(),_i(5,"div",3)(6,"input",4,0),mh("change",function(U){return a.onImportFile(U)}),Jc(),_i(8,"button",5),mh("click",function(){Fu(f);let U=QD(7);return ju(U.click())}),Iw(9),Pw(10,"transloco"),Jc(),_i(11,"button",6),mh("click",function(){return a.downloadInstructions()}),Iw(12),Pw(13,"transloco"),Jc(),_i(14,"button",7),mh("click",function(){return a.openLibrary()}),Iw(15),Pw(16,"transloco"),Jc(),_i(17,"a",8),Iw(18),Pw(19,"transloco"),Jc()()(),_D(20,Yt,2,1,"p",9),_D(21,te,3,3,"p",10)(22,ee,2,1,"p",11)(23,de,10,6),Jc();}e&2&&(gI(3),Lh(Fw(4,8,"workflows.list.title")),gI(5),lh("disabled",a.importing()),gI(),rl$1(" ",Fw(10,10,"workflows.list.import")," "),gI(3),rl$1(" ",Fw(13,12,"workflows.list.downloadInstructions")," "),gI(3),rl$1(" ",Fw(16,14,"workflows.list.browseLibrary")," "),gI(3),rl$1(" ",Fw(19,16,"workflows.list.createButton")," "),gI(2),MD(a.actionError()?20:-1),gI(),MD(a.loading()?21:a.loadError()?22:23));},dependencies:[$8,al,rl,$i,v3,pf,bd,sp,fp,ts,_n,Cn,ex,Fm,Am,pc,as,dc,Kl,cc,Ji,ls,W,I,Kt$1],styles:[".list-page[_ngcontent-%COMP%]{padding:1.25rem 1.5rem 3rem;display:flex;flex-direction:column;gap:1rem}.header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;gap:1rem;align-items:flex-start}.header-actions[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.75rem;align-items:center;flex-shrink:0;justify-content:flex-end}.field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem;max-width:16rem}.field[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{font-size:.85rem;color:#57534e}.muted[_ngcontent-%COMP%]{color:#a8a29e;font-style:italic}.empty[_ngcontent-%COMP%]{text-align:center;padding:2.5rem 1rem;border:1px dashed #d6d3d1;background:#fff9}.empty[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0 0 1rem;color:#57534e}.empty-actions[_ngcontent-%COMP%]{display:flex;justify-content:center;flex-wrap:wrap;gap:.75rem}.error[_ngcontent-%COMP%]{color:#9f1239}.actions[_ngcontent-%COMP%]{white-space:nowrap}[_nghost-%COMP%] td.description-cell{white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;text-overflow:unset;max-width:28rem;vertical-align:top}[_nghost-%COMP%] .ant-table-tbody>tr>td{white-space:normal;vertical-align:top}"]});}}return i})();export{si as WorkflowListComponent,si as WorkflowsManageComponent};
@@ -1 +0,0 @@
1
- import {e as h_,f as U_,P as P_,b as bg,g as e_,j as j_}from'./chunk-8ezEUcxN.js';import {C,b4 as N2,aV as ix,b5 as cx,i as ie,s,r as r$1}from'./main-3VZRFHGG.js';var w=(()=>{class e{constructor(){this.http=C(N2),this.baseUrl=`${ix.apiBaseUrl}/providers`;}listQueryTemplates(t){return this.http.get(`${this.baseUrl}/${encodeURIComponent(t)}/query-templates`).pipe(cx())}listExtendedActions(t){return this.http.get(`${this.baseUrl}/${encodeURIComponent(t)}/actions`).pipe(cx())}resolveQueryTemplate(t,i,s){return this.http.post(`${this.baseUrl}/${encodeURIComponent(t)}/query-templates/${encodeURIComponent(i)}/resolve`,{params:s}).pipe(cx())}previewModels(t){return this.http.post(`${this.baseUrl}/preview-models`,t).pipe(cx())}testConnection(t){return this.http.post(`${this.baseUrl}/test-connection`,t).pipe(cx())}static{this.\u0275fac=function(i){return new(i||e)};}static{this.\u0275prov=ie({token:e,factory:e.\u0275fac,providedIn:"root"});}}return e})();var d=[{id:"jira",labelKey:"settings.typeOption.jira",kind:"subject",type:"jira",subjectType:"ticket"},{id:"bitbucket",labelKey:"settings.typeOption.bitbucket",kind:"subject",type:"bitbucket",subjectType:"pull_request"},{id:"github",labelKey:"settings.typeOption.github",kind:"subject",type:"github",subjectType:"ticket"},{id:"confluence",labelKey:"settings.typeOption.confluence",kind:"subject",type:"confluence",subjectType:"documentation"},{id:"manual-ticket",labelKey:"settings.typeOption.manualTicket",kind:"subject",type:"manual",subjectType:"ticket"},{id:"manual-documentation",labelKey:"settings.typeOption.manualDocumentation",kind:"subject",type:"manual",subjectType:"documentation"},{id:"claude",labelKey:"settings.typeOption.claude",kind:"agent",type:"claude"},{id:"cursor",labelKey:"settings.typeOption.cursor",kind:"agent",type:"cursor"}],F=["ticket","pull_request","documentation"];function f(e){return d.find(n=>n.id===e)??d[0]}function T(e){return d.find(t=>t.kind!==e.kind||t.type!==e.type?false:t.kind==="agent"?true:j_(e)&&t.subjectType===e.subjectType)?.id??e.type}function N(e){let n=T(e);return f(n).labelKey}function K(e){return e==="jira"?[{key:"baseUrl",labelKey:"settings.jira.baseUrl"},{key:"email",labelKey:"settings.jira.email"}]:e==="bitbucket"?[{key:"email",labelKey:"settings.bitbucket.email"},{key:"workspace",labelKey:"settings.bitbucket.workspace"}]:e==="github"?[{key:"username",labelKey:"settings.github.username"}]:e==="confluence"?[{key:"baseUrl",labelKey:"settings.confluence.baseUrl"},{key:"email",labelKey:"settings.confluence.email"}]:[]}function P(){let e=d[0];return {originalId:null,id:"",idAutoSync:true,optionId:e.id,kind:e.kind,type:e.type,subjectType:e.subjectType??null,displayName:"",config:{},secretKey:U_("instance",e.kind),secretValue:"",expiresOn:"",knownRepoSlugs:[],defaultAgent:false,maxConcurrent:h_}}function _(e,n=false){let t={};for(let o of K(e.type)){let r=e.config[o.key];typeof r=="string"&&(t[o.key]=r);}if(P_(e)){let o=e.config.model;typeof o=="string"&&o.trim()&&(t.model=o.trim());}let i=T(e),s=f(i);return {originalId:e.id,id:e.id,idAutoSync:false,optionId:i,kind:s.kind,type:s.type,subjectType:s.subjectType??null,displayName:e.displayName,config:t,secretKey:e.secretKey,secretValue:"",expiresOn:e.expiresOn??"",knownRepoSlugs:e.type==="bitbucket"?bg(e.config):[],defaultAgent:s.kind==="agent"?n:false,maxConcurrent:P_(e)?e.maxConcurrent??h_:h_}}function q(e,n){let t=f(n);return s(r$1({},e),{optionId:t.id,kind:t.kind,type:t.type,subjectType:t.subjectType??null,config:{},secretKey:U_(e.id||"instance",t.kind),knownRepoSlugs:[],defaultAgent:t.kind==="agent"?e.defaultAgent:false,maxConcurrent:t.kind==="agent"?e.maxConcurrent||h_:e.maxConcurrent})}function D(e,n,t){if(!e.idAutoSync)return s(r$1({},e),{displayName:n});let i=n.trim().length>0?e_(n,t):"";return s(r$1({},e),{displayName:n,id:i,secretKey:U_(i||"instance",e.kind)})}function M(e,n){return s(r$1({},e),{id:n,idAutoSync:false,secretKey:U_(n.trim()||"instance",e.kind)})}function V(e){let n={};for(let r of K(e.type)){let g=(e.config[r.key]??"").trim();g&&(n[r.key]=g);}if(e.type==="bitbucket"){let r=bg({knownRepoSlugs:e.knownRepoSlugs});r.length>0&&(n.knownRepoSlugs=r);}let t=e.id.trim(),i=e.displayName.trim()||t,s=e.secretKey.trim()||U_(t,e.kind),o=e.expiresOn.trim()||void 0;if(e.kind==="agent"){let r=(e.config.model??"").trim();return r&&(n.model=r),r$1({id:t,kind:"agent",type:e.type,displayName:i,config:n,secretKey:s,maxConcurrent:Math.max(1,Math.floor(Number(e.maxConcurrent)||h_))},o?{expiresOn:o}:{})}return r$1({id:t,kind:"subject",type:e.type,subjectType:e.subjectType??"ticket",displayName:i,config:n,secretKey:s},o?{expiresOn:o}:{})}function B(e){return e.issues.map(n=>`${n.path.length>0?n.path.map(String).join("."):"(root)"}: ${n.message}`)}function U(e){return (e?.providerInstances??[]).filter(j_)}function L(e,n){return U(e).filter(t=>j_(t)&&n.includes(t.subjectType))}export{B,D,F,K,L,M,N,P,V,_,d,q,w};
@@ -1 +0,0 @@
1
- import {x,h,b,w,O}from'./chunk-D8qyjd0z.js';import {W,I}from'./chunk-Bok52e_k.js';import {p as pc,a as as,d as dc,K as Kl,c as cc,J as Ji,l as ls}from'./chunk-CtiubhW7.js';import {C,$,R as J1,V as Ve,b as at,S as p,a5 as q0,q as qo,T as id,W as qw,aW as Ng,aX as es,aY as Dg,u as ue,c as bi,s,r as r$1,Z as ZE,d as $8,X as M5,v as v3,Y as pf,a0 as bd,a1 as sp,K as Kt,l as _D,M as MD,j as _i,I as Iw,P as Pw,J as Jc,o as gI,L as Lh,p as Fw,H as HD,x as xD,w as lh,B as AD,D as ch,E as Aw,z as rl,G as FD,m as mh,O as Fu,Q as ju}from'./main-3VZRFHGG.js';var bt=o=>["/jobs",o],mt=(o,u)=>u.id;function ut(o,u){o&1&&(_i(0,"p",0),Iw(1),Pw(2,"transloco"),Jc()),o&2&&(gI(),Lh(Fw(2,1,"common.loading")));}function ht(o,u){if(o&1&&(_i(0,"p",1),Iw(1),Jc()),o&2){let t=HD();gI(),Lh(t.loadError());}}function gt(o,u){if(o&1){let t=FD();_i(0,"button",8),mh("click",function(i){Fu(t);let d=HD().$implicit,g=HD(2);return ju(g.retryJob(d,i))}),Iw(1),Pw(2,"transloco"),Jc();}if(o&2){let t=HD().$implicit,e=HD(2);lh("disabled",e.retryingJobId()===t.id),ch("data-testid","job-retry-"+t.id),gI(),rl(" ",Fw(2,3,e.retryingJobId()===t.id?"jobs.detail.retrying":"jobs.table.retry")," ");}}function xt(o,u){if(o&1){let t=FD();_i(0,"button",9),mh("click",function(i){Fu(t);let d=HD().$implicit,g=HD(2);return ju(g.cancelJob(d,i))}),Iw(1),Pw(2,"transloco"),Jc();}if(o&2){let t=HD().$implicit,e=HD(2);lh("disabled",e.cancellingJobId()===t.id),ch("data-testid","job-cancel-"+t.id),gI(),rl(" ",Fw(2,3,e.cancellingJobId()===t.id?"jobs.detail.cancelling":"jobs.table.cancel")," ");}}function ft(o,u){if(o&1&&(_i(0,"tr")(1,"td")(2,"a",3),Iw(3),Jc(),_i(4,"div",4),Iw(5),Jc()(),_i(6,"td")(7,"nz-tag",5),Iw(8),Pw(9,"transloco"),Jc()(),_i(10,"td")(11,"span"),Iw(12),Jc()(),_i(13,"td")(14,"span"),Iw(15),Jc()(),_i(16,"td")(17,"span"),Iw(18),Jc()(),_i(19,"td"),_D(20,gt,3,5,"button",6),_D(21,xt,3,5,"button",7),Jc()()),o&2){let t=u.$implicit,e=HD(2);ch("data-testid","job-row-"+t.id),gI(2),lh("routerLink",Aw(19,bt,t.id)),ch("data-testid","job-link-"+t.id),gI(),rl(" ",e.composeJobTitle(t)," "),gI(2),Lh(t.id),gI(2),lh("nzColor",e.jobStatusTagColor(t.status,e.theme.theme()))("ngClass",e.jobStatusTagClass(t.status,e.theme.theme())),ch("data-testid","job-status-"+t.id),gI(),Lh(Fw(9,17,e.statusKey(t.status))),gI(3),ch("data-testid","job-subject-"+t.id),gI(),Lh(e.subjectText(t)),gI(2),ch("data-testid","job-started-"+t.id),gI(),Lh(t.createdAt),gI(2),ch("data-testid","job-completed-"+t.id),gI(),Lh(t.completedAt??"\u2014"),gI(2),MD(t.status==="failed"?20:-1),gI(),MD(e.isTerminalStatus(t.status)?-1:21);}}function _t(o,u){if(o&1&&(_i(0,"nz-table",2)(1,"thead")(2,"tr")(3,"th"),Iw(4),Pw(5,"transloco"),Jc(),_i(6,"th"),Iw(7),Pw(8,"transloco"),Jc(),_i(9,"th"),Iw(10),Pw(11,"transloco"),Jc(),_i(12,"th"),Iw(13),Pw(14,"transloco"),Jc(),_i(15,"th"),Iw(16),Pw(17,"transloco"),Jc(),_i(18,"th"),Iw(19),Pw(20,"transloco"),Jc()()(),_i(21,"tbody"),xD(22,ft,22,21,"tr",null,mt),Jc()()),o&2){let t=HD();lh("nzData",t.displayJobs())("nzFrontPagination",false)("nzShowPagination",false)("nzSize","middle"),gI(4),Lh(Fw(5,10,"jobs.table.column.id")),gI(3),Lh(Fw(8,12,"jobs.table.column.status")),gI(3),Lh(Fw(11,14,"jobs.table.column.subject")),gI(3),Lh(Fw(14,16,"jobs.table.column.started")),gI(3),Lh(Fw(17,18,"jobs.table.column.completed")),gI(3),Lh(Fw(20,20,"jobs.table.column.actions")),gI(3),AD(t.displayJobs());}}var Lt=(()=>{class o{constructor(){this.jobsApi=C($),this.router=C(J1),this.transloco=C(Ve),this.destroyRef=C(at),this.theme=C(p),this.jobStatusTagClass=x,this.jobStatusTagColor=h,this.composeJobTitle=b,this.jobs=q0(null),this.jobIds=q0([]),this.loaded=qo([]),this.loading=qo(false),this.loadError=qo(null),this.retryingJobId=qo(null),this.cancellingJobId=qo(null),this.patched=qo({}),id(()=>{let t=this.jobs(),e=this.jobIds();if(t!=null){qw(()=>{this.loaded.set([]),this.loading.set(false),this.loadError.set(null),this.patched.set({});});return}if(e.length===0){qw(()=>{this.loaded.set([]),this.loading.set(false);});return}qw(()=>{this.loading.set(true),this.loadError.set(null),Ng(e.map(i=>this.jobsApi.get(i).pipe(es(()=>Dg(null))))).pipe(ue(this.destroyRef)).subscribe({next:i=>{this.loaded.set(i.filter(d=>d!=null)),this.loading.set(false);},error:()=>{this.loading.set(false),this.loadError.set("Failed to load jobs");}});});});}displayJobs(){let t=this.jobs(),e=t??this.loaded(),i=this.patched();return e.map(d=>i[d.id]??d)}isTerminalStatus(t){return w(t)}statusKey(t){return `jobs.status.${t}`}subjectText(t){return O(t.subjectContext)??"\u2014"}retryJob(t,e){e.preventDefault(),e.stopPropagation(),!(t.status!=="failed"||this.retryingJobId()===t.id)&&(this.retryingJobId.set(t.id),this.loadError.set(null),this.jobsApi.retry(t.id).subscribe({next:i=>{this.retryingJobId.set(null),this.router.navigate(["/jobs",i.id]);},error:i=>{this.retryingJobId.set(null),this.loadError.set(i instanceof bi||i instanceof Error?i.message:this.transloco.translate("jobs.errors.retryFailed"));}}));}cancelJob(t,e){e.preventDefault(),e.stopPropagation(),!(w(t.status)||this.cancellingJobId()===t.id)&&(this.cancellingJobId.set(t.id),this.loadError.set(null),this.jobsApi.cancel(t.id).subscribe({next:i=>{this.cancellingJobId.set(null),this.patched.update(d=>s(r$1({},d),{[i.id]:i})),this.loaded.update(d=>d.map(g=>g.id===i.id?i:g));},error:i=>{this.cancellingJobId.set(null),this.loadError.set(i instanceof bi||i instanceof Error?i.message:this.transloco.translate("jobs.errors.cancelFailed"));}}));}static{this.\u0275fac=function(e){return new(e||o)};}static{this.\u0275cmp=ZE({type:o,selectors:[["app-job-status-table"]],inputs:{jobs:[1,"jobs"],jobIds:[1,"jobIds"]},decls:3,vars:1,consts:[["data-testid","job-status-loading"],["data-testid","job-status-error",1,"error"],["data-testid","job-status-table",3,"nzData","nzFrontPagination","nzShowPagination","nzSize"],[3,"routerLink"],[1,"job-row-id","mono"],[3,"nzColor","ngClass"],["nz-button","","nzType","link","type","button",3,"disabled"],["nz-button","","nzType","link","nzDanger","","type","button",3,"disabled"],["nz-button","","nzType","link","type","button",3,"click","disabled"],["nz-button","","nzType","link","nzDanger","","type","button",3,"click","disabled"]],template:function(e,i){e&1&&_D(0,ut,3,3,"p",0)(1,ht,2,1,"p",1)(2,_t,24,22,"nz-table",2),e&2&&MD(i.loading()&&i.jobs()==null?0:i.loadError()?1:2);},dependencies:[$8,M5,v3,pf,bd,sp,pc,as,dc,Kl,cc,Ji,ls,W,I,Kt],styles:["[_nghost-%COMP%]{display:block;min-width:0;max-width:100%}.error[_ngcontent-%COMP%]{color:#9f1239}.job-row-id[_ngcontent-%COMP%]{margin-top:.2rem;font-size:.75rem;color:var(--knoflows-text-secondary, #6b6558)}[_nghost-%COMP%] .ant-table-tbody>tr>td{white-space:normal;vertical-align:top}"]});}}return o})();export{Lt as L};
@@ -1 +0,0 @@
1
- import {l as t_,g as e_}from'./chunk-8ezEUcxN.js';import {s,r as r$1,t as t$1}from'./main-3VZRFHGG.js';var y=["agent","interaction","shell","extract","git","provider_action","sub_workflow","loop"];function I(){return {name:"",appliesTo:"none",subjectHandling:"per-subject",inputSchema:[],steps:[],notificationPolicy:{triggers:[]}}}function d(){return crypto.randomUUID()}function _(t,e){return t.map(n=>{let r=s(r$1({},n),{_key:d(),_idAutoSync:e.idAutoSync});return n.type==="loop"?s(r$1({},r),{steps:_(n.steps,e)}):r})}function h(t,e){let n=e?.id??"",r=e?.name??"",i={_key:e?.key??d(),_idAutoSync:e?.idAutoSync??true};switch(t){case "agent":return r$1({type:t,id:n,name:r,objective:"",outputFormat:"free_text"},i);case "interaction":return r$1({type:t,id:n,name:r,interaction:"questionnaire"},i);case "shell":return r$1({type:t,id:n,name:r,command:""},i);case "extract":return r$1({type:t,id:n,name:r,source:"",onNoMatch:"fail"},i);case "git":return r$1({type:t,id:n,name:r,operation:"create_worktree",params:{}},i);case "provider_action":return r$1({type:t,id:n,name:r,action:"get_subject",params:{}},i);case "sub_workflow":return r$1({type:t,id:n,name:r,workflowId:"",forEach:"selection"},i);case "loop":return r$1({type:t,id:n,name:r,steps:[],until:{type:"field_empty",stepId:"",field:""},maxIterations:3,onMaxIterations:{action:"fail"}},i)}}function b(){return {name:"",label:"",type:"string",required:false}}function A(t){return t?Object.entries(t).map(([e,n])=>({key:e,value:n==null?"":String(n)})):[]}function j(t){let e={};for(let n of t){let r=n.key.trim();r&&(e[r]=n.value);}return e}function T(t){return t.issues.map(e=>`${e.path.length>0?e.path.map(String).join("."):"(root)"}: ${e.message}`)}function m(t){let i=t,{_key:e,_idAutoSync:n}=i,r=t$1(i,["_key","_idAutoSync"]);return r.type==="loop"?s(r$1({},r),{steps:r.steps.map(a=>m(a))}):r}function v(t,e={}){let n=t.steps.map(x=>{let u=m(x);if(!u.id){let p=u,{id:g}=p;return t$1(p,["id"])}return u}),a=t,{id:r}=a,i=t$1(a,["id"]);return e.omitWorkflowId||!r?s(r$1({},i),{steps:n}):s(r$1({},i),{id:r,steps:n})}function E(t,e,n){if(!t._idAutoSync)return s(r$1({},t),{name:e});let r=t_(n);t.id&&r.delete(t.id);let i=e.trim().length>0?e_(e,r):"";return s(r$1({},t),{name:e,id:i})}function P(t,e){return s(r$1({},t),{id:e,_idAutoSync:false})}export{A,E,I,P,T,_,b,h,j,v,y};
@@ -1 +0,0 @@
1
- import {a7 as KE,a8 as fu,aA as mT,C,a9 as Z0,b$ as Gm,ab as Oe,aB as yT,ae as Le$1,aC as zt,Z as ZE,a3 as Ah,a4 as Th,as as st,at as Ee,c0 as Mn,ai as ly,av as K0,l as _D,M as MD,aM as Yl,G as FD,j as _i,c1 as tc,J as Jc,H as HD,al as Sh,w as lh,o as gI,aw as rh,m as mh,n as uh,aJ as tl,I as Iw,aK as nl,L as Lh,O as Fu,Q as ju,c2 as ph}from'./main-3VZRFHGG.js';function X(n,i){n&1&&ph(0);}function $(n,i){if(n&1&&rh(0,X,1,0,"ng-container",7),n&2){let e=HD(3);lh("nzStringTemplateOutlet",e.nzIcon);}}function nn(n,i){if(n&1&&uh(0,"nz-icon",6),n&2){let e=HD(3);lh("nzType",e.nzIconType||e.inferredIconType)("nzTheme",e.iconTheme);}}function en(n,i){if(n&1&&(_i(0,"div",2),_D(1,$,1,1,"ng-container")(2,nn,1,2,"nz-icon",6),Jc()),n&2){let e=HD(2);gI(),MD(e.nzIcon?1:2);}}function tn(n,i){if(n&1&&(tl(0),Iw(1),nl()),n&2){let e=HD(4);gI(),Lh(e.nzMessage);}}function on(n,i){if(n&1&&(_i(0,"span",8),rh(1,tn,2,1,"ng-container",7),Jc()),n&2){let e=HD(3);gI(),lh("nzStringTemplateOutlet",e.nzMessage);}}function an(n,i){if(n&1&&(tl(0),Iw(1),nl()),n&2){let e=HD(4);gI(),Lh(e.nzDescription);}}function rn(n,i){if(n&1&&(_i(0,"span",9),rh(1,an,2,1,"ng-container",7),Jc()),n&2){let e=HD(3);gI(),lh("nzStringTemplateOutlet",e.nzDescription);}}function ln(n,i){if(n&1&&(_i(0,"div",3),_D(1,on,2,1,"span",8),_D(2,rn,2,1,"span",9),Jc()),n&2){let e=HD(2);gI(),MD(e.nzMessage?1:-1),gI(),MD(e.nzDescription?2:-1);}}function cn(n,i){if(n&1&&(tl(0),Iw(1),nl()),n&2){let e=HD(3);gI(),Lh(e.nzAction);}}function sn(n,i){if(n&1&&(_i(0,"div",4),rh(1,cn,2,1,"ng-container",7),Jc()),n&2){let e=HD(2);gI(),lh("nzStringTemplateOutlet",e.nzAction);}}function dn(n,i){if(n&1&&(tl(0),_i(1,"span",12),Iw(2),Jc(),nl()),n&2){let e=HD(4);gI(2),Lh(e.nzCloseText);}}function mn(n,i){if(n&1&&rh(0,dn,3,1,"ng-container",7),n&2){let e=HD(3);lh("nzStringTemplateOutlet",e.nzCloseText);}}function pn(n,i){n&1&&uh(0,"nz-icon",11);}function _n(n,i){if(n&1){let e=FD();_i(0,"button",10),mh("click",function(){Fu(e);let z=HD(2);return ju(z.closeAlert())}),_D(1,mn,1,1,"ng-container")(2,pn,1,0,"nz-icon",11),Jc();}if(n&2){let e=HD(2);gI(),MD(e.nzCloseText?1:2);}}function zn(n,i){if(n&1){let e=FD();_i(0,"div",1),tc(function(z){Fu(e);let T=HD();return ju(T.onLeaveAnimationDone(z))}),_D(1,en,3,1,"div",2),_D(2,ln,3,2,"div",3),_D(3,sn,2,1,"div",4),_D(4,_n,3,1,"button",5),Jc();}if(n&2){let e=HD();Sh("ant-alert-rtl",e.dir()==="rtl")("ant-alert-success",e.nzType==="success")("ant-alert-info",e.nzType==="info")("ant-alert-warning",e.nzType==="warning")("ant-alert-error",e.nzType==="error")("ant-alert-no-icon",!e.nzShowIcon)("ant-alert-banner",e.nzBanner)("ant-alert-closable",e.nzCloseable)("ant-alert-with-description",!!e.nzDescription),lh("nzNoAnimation",e.nzNoAnimation),gI(),MD(e.nzShowIcon?1:-1),gI(),MD(e.nzMessage||e.nzDescription?2:-1),gI(),MD(e.nzAction?3:-1),gI(),MD(e.nzCloseable||e.nzCloseText?4:-1);}}var Z="alert",un=(()=>{let n,i=[],e=[],_,z=[],T=[];return class D{static{let r=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;n=[Yl()],_=[Yl()],mT(null,null,n,{kind:"field",name:"nzCloseable",static:false,private:false,access:{has:t=>"nzCloseable"in t,get:t=>t.nzCloseable,set:(t,l)=>{t.nzCloseable=l;}},metadata:r},i,e),mT(null,null,_,{kind:"field",name:"nzShowIcon",static:false,private:false,access:{has:t=>"nzShowIcon"in t,get:t=>t.nzShowIcon,set:(t,l)=>{t.nzShowIcon=l;}},metadata:r},z,T),r&&Object.defineProperty(this,Symbol.metadata,{enumerable:true,configurable:true,writable:true,value:r});}cdr=C(Z0);animationType=C(Gm,{optional:true});dir=C(Oe).valueSignal;_nzModuleName=Z;nzAction=null;nzCloseText=null;nzIconType=null;nzMessage=null;nzDescription=null;nzType="info";nzCloseable=yT(this,i,false);nzShowIcon=(yT(this,e),yT(this,z,false));nzBanner=(yT(this,T),false);nzNoAnimation=false;nzIcon=null;nzOnClose=new Le$1;closed=false;iconTheme="fill";inferredIconType="info-circle";isTypeSet=false;isShowIconSet=false;constructor(){zt(Z,()=>this.cdr.markForCheck());}closeAlert(){this.closed=true,(this.nzNoAnimation||this.animationType==="NoopAnimations")&&this.nzOnClose.emit(true);}onLeaveAnimationDone(r){let t=r.target;if(this.nzNoAnimation||this.animationType==="NoopAnimations"){r.animationComplete();return}t.classList.add("ant-alert-motion-leave","ant-alert-motion-leave-active");let l=()=>{t.removeEventListener("transitionend",l),this.nzOnClose.emit(true),r.animationComplete();};t.addEventListener("transitionend",l);}ngOnChanges(r){let{nzShowIcon:t,nzDescription:l,nzType:J,nzBanner:K}=r;if(t&&(this.isShowIconSet=true),J)switch(this.isTypeSet=true,this.nzType){case "error":this.inferredIconType="close-circle";break;case "success":this.inferredIconType="check-circle";break;case "info":this.inferredIconType="info-circle";break;case "warning":this.inferredIconType="exclamation-circle";break}l&&(this.iconTheme=this.nzDescription?"outline":"fill"),K&&(this.isTypeSet||(this.nzType="warning"),this.isShowIconSet||(this.nzShowIcon=true));}static \u0275fac=function(t){return new(t||D)};static \u0275cmp=ZE({type:D,selectors:[["nz-alert"]],inputs:{nzAction:"nzAction",nzCloseText:"nzCloseText",nzIconType:"nzIconType",nzMessage:"nzMessage",nzDescription:"nzDescription",nzType:"nzType",nzCloseable:[2,"nzCloseable","nzCloseable",K0],nzShowIcon:[2,"nzShowIcon","nzShowIcon",K0],nzBanner:[2,"nzBanner","nzBanner",K0],nzNoAnimation:[2,"nzNoAnimation","nzNoAnimation",K0],nzIcon:"nzIcon"},outputs:{nzOnClose:"nzOnClose"},exportAs:["nzAlert"],features:[ly],decls:1,vars:1,consts:[[1,"ant-alert",3,"nzNoAnimation","ant-alert-rtl","ant-alert-success","ant-alert-info","ant-alert-warning","ant-alert-error","ant-alert-no-icon","ant-alert-banner","ant-alert-closable","ant-alert-with-description"],[1,"ant-alert",3,"nzNoAnimation"],[1,"ant-alert-icon"],[1,"ant-alert-content"],[1,"ant-alert-action"],["type","button","tabindex","0",1,"ant-alert-close-icon"],[3,"nzType","nzTheme"],[4,"nzStringTemplateOutlet"],[1,"ant-alert-message"],[1,"ant-alert-description"],["type","button","tabindex","0",1,"ant-alert-close-icon",3,"click"],["nzType","close"],[1,"ant-alert-close-text"]],template:function(t,l){t&1&&_D(0,zn,5,23,"div",0),t&2&&MD(l.closed?-1:0);},dependencies:[Ah,Th,st,Ee,Mn],encapsulation:2})}})(),Gn=(()=>{class n{static \u0275fac=function(_){return new(_||n)};static \u0275mod=KE({type:n});static \u0275inj=fu({imports:[un]})}return n})();export{Gn as G,un as u};