@knoflows/engine 0.1.0-alpha.9 → 0.1.0-beta.18

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 (107) hide show
  1. package/README.md +5 -10
  2. package/dist/engine.js +110 -10
  3. package/dist/migrations/20260918025930_context_files/migration.sql +7 -0
  4. package/dist/migrations/20260918025930_context_files/snapshot.json +1275 -0
  5. package/dist/migrations/20260918074816_large_kate_bishop/migration.sql +8 -0
  6. package/dist/migrations/20260918074816_large_kate_bishop/snapshot.json +1338 -0
  7. package/dist/migrations/20260919073531_tense_grey_gargoyle/migration.sql +1 -0
  8. package/dist/migrations/20260919073531_tense_grey_gargoyle/snapshot.json +1348 -0
  9. package/dist/migrations/20260919081637_fearless_warlock/migration.sql +1 -0
  10. package/dist/migrations/20260919081637_fearless_warlock/snapshot.json +1358 -0
  11. package/package.json +6 -6
  12. package/static/apple-touch-icon.png +0 -0
  13. package/static/assets/i18n/en.json +217 -12
  14. package/static/assets/i18n/es.json +217 -12
  15. package/static/chunk--WRMKpmO.js +5 -0
  16. package/static/{chunk-BmSmqIC7.js → chunk-5xJXPFlv.js} +1 -1
  17. package/static/chunk-7NTQwN96.js +1 -0
  18. package/static/chunk-BCHj6l85.js +1 -0
  19. package/static/chunk-BIL86kgf.js +1 -0
  20. package/static/chunk-BIdwV0jx.js +1 -0
  21. package/static/chunk-BRZ5T52h.js +1 -0
  22. package/static/chunk-B_R_vsLt.js +1 -0
  23. package/static/chunk-BaYdwXIA.js +1 -0
  24. package/static/chunk-BcQQgpKh.js +1 -0
  25. package/static/chunk-BrP_q6LZ.js +1 -0
  26. package/static/chunk-Bv1r1Ly-.js +1 -0
  27. package/static/chunk-C3Xml1YG.js +1 -0
  28. package/static/chunk-C9PkSfMb.js +1 -0
  29. package/static/{chunk-WzBVBHEz.js → chunk-CLM-K-Vg.js} +1 -1
  30. package/static/chunk-CPNxRF7A.js +1 -0
  31. package/static/chunk-CRGkNzel.js +70 -0
  32. package/static/chunk-CV-FUe_H.js +1 -0
  33. package/static/chunk-CZoPJsBm.js +1 -0
  34. package/static/chunk-CuwZV6XG.js +1 -0
  35. package/static/chunk-Cvoe3MtC.js +1 -0
  36. package/static/chunk-D19C8Gcb.js +1 -0
  37. package/static/chunk-D3JZ8ur5.js +66 -0
  38. package/static/chunk-DAONFRT8.js +1 -0
  39. package/static/chunk-DDhSFoAE.js +1 -0
  40. package/static/chunk-DEF7Ge5B.js +1 -0
  41. package/static/chunk-DHC_yfIa.js +1 -0
  42. package/static/chunk-DSgUAlqN.js +1 -0
  43. package/static/chunk-DVJ9L-aC.js +1 -0
  44. package/static/chunk-DaO-gpzS.js +1 -0
  45. package/static/chunk-Dg-4XevL.js +1 -0
  46. package/static/chunk-DvWh-Q5D.js +1 -0
  47. package/static/chunk-Dx92ksvP.js +1 -0
  48. package/static/chunk-DyiDg8XX.js +1 -0
  49. package/static/chunk-VXZaUyyE.js +1 -0
  50. package/static/chunk-Ysn4Fbgj.js +1 -0
  51. package/static/chunk-ZqQUQSE8.js +1 -0
  52. package/static/chunk-hpn_m1ZC.js +1 -0
  53. package/static/chunk-pi-mtheN.js +1 -0
  54. package/static/chunk-xeQj_hSF.js +1 -0
  55. package/static/favicon-16x16.png +0 -0
  56. package/static/favicon-32x32.png +0 -0
  57. package/static/favicon.ico +0 -0
  58. package/static/favicon.svg +12 -0
  59. package/static/icon-192.png +0 -0
  60. package/static/icon-512.png +0 -0
  61. package/static/index.html +30 -5
  62. package/static/main-SI5AKDMC.js +248 -0
  63. package/static/media/inter-latin-400-normal-55WT6UWF.woff2 +0 -0
  64. package/static/media/inter-latin-400-normal-FR5HOXA4.woff +0 -0
  65. package/static/media/inter-latin-500-normal-W62DVTXI.woff2 +0 -0
  66. package/static/media/inter-latin-500-normal-ZNGIZ2YB.woff +0 -0
  67. package/static/media/inter-latin-600-normal-R6Y2SZCR.woff2 +0 -0
  68. package/static/media/inter-latin-600-normal-ZYHV6QZT.woff +0 -0
  69. package/static/media/jetbrains-mono-latin-500-normal-ETEQEOVZ.woff +0 -0
  70. package/static/media/jetbrains-mono-latin-500-normal-V4XIP5OW.woff2 +0 -0
  71. package/static/media/space-grotesk-latin-500-normal-GESQWJQV.woff2 +0 -0
  72. package/static/media/space-grotesk-latin-500-normal-HV4TE4RA.woff +0 -0
  73. package/static/media/space-grotesk-latin-700-normal-6Z7GHSI6.woff +0 -0
  74. package/static/media/space-grotesk-latin-700-normal-I3MXRIUZ.woff2 +0 -0
  75. package/static/nz-theme-dark.css +1 -0
  76. package/static/nz-theme.css +1 -0
  77. package/static/styles-JGCTKGGH.css +1 -0
  78. package/static/chunk-1SlEtaMr.js +0 -1
  79. package/static/chunk-5H-9s7GP.js +0 -7
  80. package/static/chunk-B-P3MXAn.js +0 -1
  81. package/static/chunk-B76UD1mt.js +0 -1
  82. package/static/chunk-BFYi_kYd.js +0 -1
  83. package/static/chunk-BG0Azip9.js +0 -1
  84. package/static/chunk-BWr0M-hk.js +0 -1
  85. package/static/chunk-Bpxo3nwV.js +0 -1
  86. package/static/chunk-Bw9D3p4h.js +0 -1
  87. package/static/chunk-C-T2O6LE.js +0 -1
  88. package/static/chunk-C1E15gBW.js +0 -5
  89. package/static/chunk-C1V4WljN.js +0 -1
  90. package/static/chunk-C3wpjxgW.js +0 -1
  91. package/static/chunk-C4yhGGeB.js +0 -1
  92. package/static/chunk-C5hSEJdm.js +0 -1
  93. package/static/chunk-CTkRZ4w1.js +0 -1
  94. package/static/chunk-CYX8w88D.js +0 -1
  95. package/static/chunk-Cq4-aSSE.js +0 -1
  96. package/static/chunk-Cwf9CcBI.js +0 -1
  97. package/static/chunk-D32ZkSz4.js +0 -1
  98. package/static/chunk-DE9IK0Os.js +0 -1
  99. package/static/chunk-DNtWpE65.js +0 -1
  100. package/static/chunk-DdVQ8Ilm.js +0 -66
  101. package/static/chunk-W0OF0P_2.js +0 -1
  102. package/static/chunk-XvSvuf-k.js +0 -1
  103. package/static/chunk-aWIxMbtR.js +0 -1
  104. package/static/chunk-f1UVptf5.js +0 -1
  105. package/static/chunk-vj0RDTCf.js +0 -1
  106. package/static/main-BRWQ5RNE.js +0 -249
  107. package/static/styles-6MW3GE4V.css +0 -1
@@ -1 +0,0 @@
1
- import {w as we}from'./chunk-D32ZkSz4.js';import {C,a as ae$1,T as Ie,ae as U,U as U$3,V as Ve,b as at,q as qo,H as Hw,u as ue$1,r,a9 as Ng,ab as Dg,o,Q as QE,M as Mi,L as Ln,c as sd,z as zc,d as t7,Z as y7,K as Kt,f as _i,m as bD,g as Kc,p as gI,B as _D,v as vw,R as Rw,P as Ph,O as Ow,E as VD,F as LD,h as gh,x as ch,a3 as xw,w as nl,G as Pu,I as Lu,l as lh}from'./main-BRWQ5RNE.js';import {J,K}from'./chunk-DE9IK0Os.js';import {U as U$1}from'./chunk-BWr0M-hk.js';import {G as Gn,u as un}from'./chunk-B76UD1mt.js';import {U as U$2}from'./chunk-C4yhGGeB.js';import'./chunk-CYX8w88D.js';import'./chunk-C3wpjxgW.js';import'./chunk-WzBVBHEz.js';var te=i=>["/views",i,"edit"],ie=i=>["/batches",i];function ne(i,c){i&1&&(_i(0,"p",1),vw(1),Rw(2,"transloco"),Kc()),i&2&&(gI(),Ph(Ow(2,1,"common.loading")));}function oe(i,c){if(i&1&&(_i(0,"p",2),vw(1),Kc()),i&2){let e=VD();gI(),Ph(e.loadError());}}function ae(i,c){i&1&&(_i(0,"span",8),vw(1),Kc()),i&2&&(gI(),Ph(c.name));}function le(i,c){i&1&&(_i(0,"a",16),vw(1),Rw(2,"transloco"),Kc()),i&2&&(ch("routerLink",xw(4,ie,c)),gI(),nl(" ",Ow(2,2,"views.detail.openBatch")," "));}function re(i,c){if(i&1&&(lh(0,"nz-alert",15),bD(1,le,3,6,"a",16)),i&2){let e,t=VD(2);ch("nzMessage",t.confirmation()),gI(),_D((e=t.confirmationBatchId())?1:-1,e);}}function se(i,c){i&1&&(_i(0,"p",17),vw(1),Rw(2,"transloco"),Kc()),i&2&&(gI(),nl(" ",Ow(2,1,"views.detail.noBulkWorkflows")," "));}function ce(i,c){if(i&1&&(_i(0,"p",20),vw(1),Kc()),i&2){let e=VD(4);gI(),Ph(e.launchError());}}function de(i,c){if(i&1){let e=LD();_i(0,"p",18),vw(1),Kc(),_i(2,"app-workflow-input-form",19),gh("valuesChange",function(o){Pu(e);let l=VD(3);return Lu(l.setInputValues(o))}),Kc(),bD(3,ce,2,1,"p",20),_i(4,"div",21)(5,"button",22),gh("click",function(){Pu(e);let o=VD(3);return Lu(o.launch())}),vw(6),Rw(7,"transloco"),Kc(),_i(8,"button",23),gh("click",function(){Pu(e);let o=VD(3);return Lu(o.cancelLaunch())}),vw(9),Rw(10,"transloco"),Kc()();}if(i&2){let e=c,t=VD(3);gI(),Ph(e.name),gI(),ch("fields",e.inputSchema)("values",t.inputValues()),gI(),_D(t.launchError()?3:-1),gI(2),ch("nzLoading",t.launching())("disabled",t.launching()),gI(),nl(" ",Ow(7,8,t.launching()?"views.detail.launching":"views.detail.launch")," "),gI(3),nl(" ",Ow(10,10,"views.detail.cancelLaunch")," ");}}function ue(i,c){if(i&1&&(_i(0,"section",12)(1,"h2"),vw(2),Rw(3,"transloco"),Kc(),bD(4,se,3,3,"p",17)(5,de,11,12),Kc()),i&2){let e,t=VD(2);gI(2),nl(" ",Ow(3,2,c==="view"?"views.detail.launchViewTitle":"views.detail.launchSelectedTitle")," "),gI(2),_D(t.canBulkLaunch()?(e=t.boundWorkflow())?5:-1:4,e);}}function pe(i,c){i&1&&(_i(0,"p",13),vw(1),Rw(2,"transloco"),Kc()),i&2&&(gI(),Ph(Ow(2,1,"views.detail.emptySubjects")));}function me(i,c){if(i&1){let e=LD();_i(0,"app-runnable-items-table",24),gh("rowAction",function(o){Pu(e);let l=VD(2);return Lu(l.onRowAction(o))})("bulkAction",function(o){Pu(e);let l=VD(2);return Lu(l.onBulkAction(o))}),Kc();}if(i&2){let e=VD(2);ch("rows",e.rows())("selectable",true)("showRowAction",e.showRowAction());}}function he(i,c){if(i&1){let e=LD();_i(0,"header",3)(1,"div")(2,"a",4),vw(3),Rw(4,"transloco"),Kc(),_i(5,"h1",5),vw(6),Kc(),_i(7,"p",6)(8,"span",7),vw(9),Rw(10,"transloco"),Kc(),bD(11,ae,2,1,"span",8),Kc()(),_i(12,"a",9),vw(13),Rw(14,"transloco"),Kc()(),_i(15,"section",10)(16,"button",11),gh("click",function(){Pu(e);let o=VD();return Lu(o.beginLaunch("view"))}),vw(17),Rw(18,"transloco"),Kc()(),bD(19,re,2,2),bD(20,ue,6,4,"section",12),bD(21,pe,3,3,"p",13)(22,me,1,3,"app-runnable-items-table",14);}if(i&2){let e,t,o=c,l=VD();gI(3),Ph(Ow(4,11,"views.detail.backToList")),gI(3),Ph(o.name),gI(3),Ph(Ow(10,13,l.subjectTypeKey(o.subjectType))),gI(2),_D((e=l.boundWorkflow())?11:-1,e),gI(),ch("routerLink",xw(19,te,o.id)),gI(),nl(" ",Ow(14,15,"views.detail.edit")," "),gI(3),ch("disabled",!l.canBulkLaunch()),gI(),nl(" ",Ow(18,17,"views.detail.runOnAll")," "),gI(2),_D(l.confirmation()?19:-1),gI(),_D((t=l.launchMode())?20:-1,t),gI(),_D(l.subjects().length===0?21:22);}}var Ne=(()=>{class i{constructor(){this.route=C(ae$1),this.router=C(Ie),this.viewsApi=C(U),this.workflowsApi=C(U$1),this.batchesApi=C(U$2),this.jobsApi=C(U$3),this.transloco=C(Ve),this.destroyRef=C(at),this.view=qo(null),this.subjects=qo([]),this.workflows=qo([]),this.latestBySubject=qo({}),this.loading=qo(true),this.loadError=qo(null),this.selectedIds=qo([]),this.launchMode=qo(null),this.inputValues=qo({}),this.launching=qo(false),this.launchError=qo(null),this.confirmation=qo(null),this.confirmationBatchId=qo(null),this.boundWorkflow=Hw(()=>{let e=this.view();return e?this.workflows().find(t=>t.id===e.workflowId)??null:null}),this.canBulkLaunch=Hw(()=>this.boundWorkflow()!=null),this.showRowAction=Hw(()=>this.boundWorkflow()?.subjectHandling==="per-subject"),this.rows=Hw(()=>{let e=this.latestBySubject();return this.subjects().map(t=>({id:t.id,primaryLabel:t.title,subtitle:this.subjectDetails(t),latestJob:e[t.id]??null}))}),this.route.paramMap.pipe(ue$1(this.destroyRef)).subscribe(e=>{let t=e.get("id");if(!t){this.loading.set(false),this.loadError.set(this.transloco.translate("views.detail.loadFailed"));return}this.load(t);});}subjectTypeKey(e){return `workflow-editor.subjectType.${e}`}subjectDetails(e){if(e.subjectType==="ticket")return [e.status,e.assignee].filter(Boolean).join(" \xB7 ");if(e.subjectType==="pull_request"){let t=`${e.sourceBranch} \u2192 ${e.targetBranch}`;return e.author?`${e.author} \xB7 ${t}`:t}return e.url??""}onBulkAction(e){this.selectedIds.set(e),this.beginLaunch("manual");}onRowAction(e){let t=this.view();t&&this.router.navigate(["/jobs/new"],{queryParams:{workflowId:t.workflowId,subjectId:e}});}beginLaunch(e){e==="manual"&&this.selectedIds().length===0||(this.launchError.set(null),this.confirmation.set(null),this.confirmationBatchId.set(null),this.launchMode.set(e),this.inputValues.set(J(this.boundWorkflow()?.inputSchema??[])));}cancelLaunch(){this.launchMode.set(null),this.launchError.set(null);}setInputValues(e){this.inputValues.set(e);}launch(){let e=this.view(),t=this.boundWorkflow(),o=this.launchMode();if(!e||!t||!o)return;let l=o==="view"?{mode:"view",viewId:e.id}:{mode:"manual",subjectType:e.subjectType,subjectIds:[...this.selectedIds()]};this.launching.set(true),this.launchError.set(null),this.batchesApi.launch({workflowId:t.id,selection:l,triggeredBy:o==="view"?"view_bulk":"multiselect",inputValues:r({},this.inputValues())}).pipe(ue$1(this.destroyRef)).subscribe({next:v=>{this.launching.set(false),this.confirmation.set(this.confirmationMessage(v)),this.confirmationBatchId.set(v.kind==="batch"?v.batch.id:null),this.launchMode.set(null),this.refreshLatest(e.workflowId,this.subjects().map(ee=>ee.id));},error:v=>{this.launching.set(false),this.launchError.set(this.errorMessage(v,this.transloco.translate("views.detail.launchFailed")));}});}confirmationMessage(e){return e.kind==="batch"?this.transloco.translate("views.detail.confirmation.batch",{id:e.batch.id,count:e.batch.jobIds.length}):this.transloco.translate("views.detail.confirmation.job",{id:e.job.id})}load(e){this.loading.set(true),this.loadError.set(null),this.selectedIds.set([]),this.launchMode.set(null),this.confirmation.set(null),this.confirmationBatchId.set(null),Ng({view:this.viewsApi.get(e),subjects:this.viewsApi.getSubjects(e),workflows:this.workflowsApi.list()}).pipe(ue$1(this.destroyRef)).subscribe({next:({view:t,subjects:o,workflows:l})=>{this.view.set(t),this.subjects.set(o),this.workflows.set(l),this.loading.set(false),this.refreshLatest(t.workflowId,o.map(v=>v.id));},error:t=>{this.loading.set(false),this.loadError.set(this.errorMessage(t,this.transloco.translate("views.detail.loadFailed")));}});}refreshLatest(e,t){(t.length===0?Dg({}):this.jobsApi.latestBySubject(e,t)).pipe(ue$1(this.destroyRef)).subscribe({next:l=>this.latestBySubject.set(l),error:()=>this.latestBySubject.set({})});}errorMessage(e,t){return e instanceof o||e instanceof Error?e.message:t}static{this.\u0275fac=function(t){return new(t||i)};}static{this.\u0275cmp=QE({type:i,selectors:[["app-view-detail"]],decls:4,vars:1,consts:[["data-testid","view-detail",1,"detail-page"],["data-testid","loading"],["data-testid","load-error",1,"error"],[1,"header"],["routerLink","/views"],["data-testid","view-name"],[1,"meta"],["data-testid","view-subject-type"],["data-testid","bound-workflow"],["nz-button","","data-testid","edit-view",3,"routerLink"],[1,"toolbar"],["nz-button","","nzType","primary","type","button","data-testid","run-on-all",3,"click","disabled"],["data-testid","launch-panel",1,"launch-panel"],["data-testid","empty-subjects",1,"muted"],[3,"rows","selectable","showRowAction"],["data-testid","launch-confirmation","nzType","success",3,"nzMessage"],["nz-button","","nzType","link","data-testid","open-batch",3,"routerLink"],["data-testid","no-bulk-workflows",1,"muted"],["data-testid","launch-workflow",1,"muted"],[3,"valuesChange","fields","values"],["data-testid","launch-error",1,"error"],[1,"launch-actions"],["nz-button","","nzType","primary","type","button","data-testid","launch-submit",3,"click","nzLoading","disabled"],["nz-button","","type","button","data-testid","launch-cancel",3,"click"],[3,"rowAction","bulkAction","rows","selectable","showRowAction"]],template:function(t,o){if(t&1&&(_i(0,"main",0),bD(1,ne,3,3,"p",1)(2,oe,2,1,"p",2)(3,he,23,21),Kc()),t&2){let l;gI(),_D(o.loading()?1:o.loadError()?2:(l=o.view())?3:-1,l);}},dependencies:[Mi,Ln,Gn,un,sd,zc,t7,y7,K,we,Kt],styles:[".detail-page[_ngcontent-%COMP%]{max-width:72rem;margin:0 auto;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[_ngcontent-%COMP%] h1[_ngcontent-%COMP%]{margin:.25rem 0 0}.meta[_ngcontent-%COMP%]{margin:.25rem 0 0;color:#57534e}.toolbar[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.75rem;align-items:flex-end}.field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem;min-width:14rem}.field[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{font-size:.85rem;color:#57534e}.launch-panel[_ngcontent-%COMP%]{padding:1rem;border:1px solid #d6d3d1;background:#ffffffb3}.launch-panel[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{margin:0 0 .75rem;font-size:1.1rem}.launch-actions[_ngcontent-%COMP%]{display:flex;gap:.5rem;margin-top:.5rem}.muted[_ngcontent-%COMP%]{color:#78716c}.error[_ngcontent-%COMP%]{color:#9f1239}.actions[_ngcontent-%COMP%]{white-space:nowrap}[_nghost-%COMP%] .ant-table-tbody>tr>td{white-space:normal;vertical-align:top}"]});}}return i})();export{Ne as ViewDetailComponent};
@@ -1 +0,0 @@
1
- import {Q as QE,K as Kt,aW as Jc,v as vw,R as Rw,aX as Xc,p as gI,P as Ph,O as Ow}from'./main-BRWQ5RNE.js';var x=(()=>{class e{static{this.\u0275fac=function(t){return new(t||e)};}static{this.\u0275cmp=QE({type:e,selectors:[["app-preferences-manage"]],decls:9,vars:6,consts:[["data-testid","preferences-manage",1,"list-page"],[1,"header"],[1,"lede"]],template:function(t,l){t&1&&(Jc(0,"main",0)(1,"header",1)(2,"div")(3,"h1"),vw(4),Rw(5,"transloco"),Xc(),Jc(6,"p",2),vw(7),Rw(8,"transloco"),Xc()()()()),t&2&&(gI(4),Ph(Ow(5,2,"manage.preferences.title")),gI(3),Ph(Ow(8,4,"manage.preferences.body")));},dependencies:[Kt],styles:[".list-page[_ngcontent-%COMP%]{max-width:72rem;margin:0 auto;padding:1.25rem 1.5rem 3rem;display:flex;flex-direction:column;gap:1rem}.lede[_ngcontent-%COMP%]{margin:.25rem 0 0;color:#57534e}"]});}}return e})();export{x as PreferencesManageComponent};
@@ -1 +0,0 @@
1
- import {_ as _n,C as Cn}from'./chunk-DNtWpE65.js';import {$ as $$1,R,y,T,P,q,D,N,w,V,_}from'./chunk-Cwf9CcBI.js';import {S as Sk,N as Nx,v as vf,u as uk,I as Ie}from'./chunk-DdVQ8Ilm.js';import {C,ag as $,b as at,V as Ve,q as qo,H as Hw,a9 as Ng,u as ue,s,r,ah as Ml,ai as Se,aa as Xi,ab as Dg,o,Q as QE,M as Mi,n as n8,aj as S4,J as J6,k as k3,c as sd,z as zc,d as t7,Z as y7,$ as $b,e as V5,D as D5,K as Kt$1,f as _i,v as vw,R as Rw,g as Kc,h as gh,m as bD,p as gI,P as Ph,O as Ow,w as nl,B as _D,ak as YE,al as uu,am as pT,an as kt$1,ao as _r,ap as oe,aq as z0,ar as a3,as as hT,at as Le,au as m1,av as St,aw as c8,ax as pt,ay as Se$1,az as Tt,aA as Ie$1,aB as ly,aC as Z0,l as lh,a4 as Mh,x as ch,a5 as ah,aD as Sw,aE as h1,aF as wo,aG as Ih,aH as qD,aI as WD,E as VD,N as ND,A as xD,F as LD,j as oE,y as sE,aJ as ut,aK as nh,S as SD,aL as el,aM as tl,G as Pu,I as Lu}from'./main-BRWQ5RNE.js';import {G as Gn,u as un}from'./chunk-B76UD1mt.js';import {W,I}from'./chunk-BmSmqIC7.js';import {A as Ad,H as Hl,$ as $d,a as Al,V as Vd,b as Ai,X as Xl}from'./chunk-CYX8w88D.js';import'./chunk-C3wpjxgW.js';import'./chunk-WzBVBHEz.js';var yt=["switchElement"];function bt(i,p){i&1&&lh(0,"nz-icon",3);}function Et(i,p){if(i&1&&(el(0),vw(1),tl()),i&2){let e=VD(2);gI(),Ph(e.nzCheckedChildren);}}function It(i,p){if(i&1&&nh(0,Et,2,1,"ng-container",6),i&2){let e=VD();ch("nzStringTemplateOutlet",e.nzCheckedChildren);}}function wt(i,p){if(i&1&&(el(0),vw(1),tl()),i&2){let e=VD(2);gI(),Ph(e.nzUnCheckedChildren);}}function Nt(i,p){if(i&1&&nh(0,wt,2,1,"ng-container",6),i&2){let e=VD();ch("nzStringTemplateOutlet",e.nzUnCheckedChildren);}}var kt="switch",J=(()=>{let i,p=[],e=[];return class K{static{let t=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;i=[ut()],pT(null,null,i,{kind:"field",name:"nzSize",static:false,private:false,access:{has:r=>"nzSize"in r,get:r=>r.nzSize,set:(r,u)=>{r.nzSize=u;}},metadata:t},p,e),t&&Object.defineProperty(this,Symbol.metadata,{enumerable:true,configurable:true,writable:true,value:t});}_nzModuleName=kt;nzConfigService=C(kt$1);el=C(_r).nativeElement;ngZone=C(oe);cdr=C(z0);focusMonitor=C(a3);destroyRef=C(at);isChecked=false;onChange=()=>{};onTouched=()=>{};switchElement;nzLoading=false;nzDisabled=false;nzControl=false;nzCheckedChildren=null;nzUnCheckedChildren=null;nzSize=hT(this,p,"default");nzId=(hT(this,e),null);dir=C(Le).valueSignal;isNzDisableFirstChange=true;size=qo(this.nzSize);formSize=C(m1,{optional:true});finalSize=Hw(()=>this.formSize?.()||this.size());updateValue(t){this.isChecked!==t&&(this.isChecked=t,this.onChange(this.isChecked));}focus(){this.focusMonitor.focusVia(this.switchElement.nativeElement,"keyboard");}blur(){this.switchElement.nativeElement.blur();}constructor(){this.destroyRef.onDestroy(()=>{this.focusMonitor.stopMonitoring(this.switchElement.nativeElement);});}ngOnChanges(t){let{nzSize:r}=t;r&&this.size.set(r.currentValue);}ngOnInit(){St(this.el,"click").pipe(ue(this.destroyRef)).subscribe(t=>{t.preventDefault(),!(this.nzControl||this.nzDisabled||this.nzLoading)&&this.ngZone.run(()=>{this.updateValue(!this.isChecked),this.cdr.markForCheck();});}),St(this.switchElement.nativeElement,"keydown").pipe(ue(this.destroyRef)).subscribe(t=>{if(this.nzControl||this.nzDisabled||this.nzLoading)return;let{keyCode:r}=t;r!==37&&r!==39&&r!==32&&r!==13||(t.preventDefault(),this.ngZone.run(()=>{r===37?this.updateValue(false):r===39?this.updateValue(true):(r===32||r===13)&&this.updateValue(!this.isChecked),this.cdr.markForCheck();}));});}ngAfterViewInit(){this.focusMonitor.monitor(this.switchElement.nativeElement,true).pipe(ue(this.destroyRef)).subscribe(t=>{t||Promise.resolve().then(()=>this.onTouched());});}writeValue(t){this.isChecked=t,this.cdr.markForCheck();}registerOnChange(t){this.onChange=t;}registerOnTouched(t){this.onTouched=t;}setDisabledState(t){this.nzDisabled=this.isNzDisableFirstChange&&this.nzDisabled||t,this.isNzDisableFirstChange=false,this.cdr.markForCheck();}static \u0275fac=function(r){return new(r||K)};static \u0275cmp=QE({type:K,selectors:[["nz-switch"]],viewQuery:function(r,u){if(r&1&&Ih(yt,7),r&2){let q;qD(q=WD())&&(u.switchElement=q.first);}},inputs:{nzLoading:[2,"nzLoading","nzLoading",Z0],nzDisabled:[2,"nzDisabled","nzDisabled",Z0],nzControl:[2,"nzControl","nzControl",Z0],nzCheckedChildren:"nzCheckedChildren",nzUnCheckedChildren:"nzUnCheckedChildren",nzSize:"nzSize",nzId:"nzId"},exportAs:["nzSwitch"],features:[Sw([{provide:h1,useExisting:wo(()=>K),multi:true}]),ly],decls:8,vars:15,consts:[["switchElement",""],["nz-wave","","type","button",1,"ant-switch",3,"disabled","nzWaveExtraNode"],[1,"ant-switch-handle"],["nzType","loading",1,"ant-switch-loading-icon"],[1,"ant-switch-inner"],[1,"ant-click-animating-node"],[4,"nzStringTemplateOutlet"]],template:function(r,u){r&1&&(_i(0,"button",1,0)(2,"span",2),bD(3,bt,1,0,"nz-icon",3),Kc(),_i(4,"span",4),bD(5,It,1,1,"ng-container")(6,Nt,1,1,"ng-container"),Kc(),lh(7,"div",5),Kc()),r&2&&(Mh("ant-switch-checked",u.isChecked)("ant-switch-loading",u.nzLoading)("ant-switch-disabled",u.nzDisabled)("ant-switch-small",u.finalSize()==="small")("ant-switch-rtl",u.dir()==="rtl"),ch("disabled",u.nzDisabled)("nzWaveExtraNode",true),ah("id",u.nzId),gI(3),_D(u.nzLoading?3:-1),gI(2),_D(u.isChecked?5:6));},dependencies:[c8,y7,pt,Se$1,Tt,Ie$1],encapsulation:2})}})(),ht=(()=>{class i{static \u0275fac=function(o){return new(o||i)};static \u0275mod=YE({type:i});static \u0275inj=uu({imports:[J]})}return i})();var Y=(i,p)=>p.id,Dt=(i,p)=>p.key;function Ot(i,p){i&1&&(_i(0,"div",4),lh(1,"nz-alert",9),Rw(2,"transloco"),Kc()),i&2&&(gI(),ch("nzMessage",Ow(2,1,"settings.restartRequired.message")));}function Vt(i,p){i&1&&(_i(0,"p",5),vw(1),Rw(2,"transloco"),Kc()),i&2&&(gI(),Ph(Ow(2,1,"common.loading")));}function Pt(i,p){if(i&1&&(_i(0,"p",6),vw(1),Kc()),i&2){let e=VD();gI(),Ph(e.loadError());}}function At(i,p){if(i&1&&(_i(0,"nz-tag",11),vw(1),Rw(2,"transloco"),Kc()),i&2){let e=VD().$implicit;ah("data-testid",e.id+"-default-chip"),gI(),Ph(Ow(2,2,"settings.defaultAgent.label"));}}function Ft(i,p){if(i&1){let e=LD();_i(0,"tr")(1,"td",10)(2,"span"),vw(3),Kc(),bD(4,At,3,4,"nz-tag",11),Kc(),_i(5,"td")(6,"nz-tag"),vw(7),Rw(8,"transloco"),Kc()(),_i(9,"td"),vw(10),Kc(),_i(11,"td",12)(12,"button",13),gh("click",function(){let t=Pu(e).$implicit,r=VD(2);return Lu(r.openEdit(t))}),vw(13),Rw(14,"transloco"),Kc(),_i(15,"button",14),Rw(16,"transloco"),Rw(17,"transloco"),Rw(18,"transloco"),gh("nzOnConfirm",function(){let t=Pu(e).$implicit,r=VD(2);return Lu(r.removeInstance(t.id))}),vw(19),Rw(20,"transloco"),Kc()()();}if(i&2){let e=p.$implicit,o=VD(2);ah("data-testid","instance-"+e.id),gI(),ah("data-testid",e.id+"-name"),gI(2),Ph(e.displayName),gI(),_D(o.isDefaultAgent(e)?4:-1),gI(2),ah("data-testid",e.id+"-type"),gI(),Ph(Ow(8,15,o.typeLabelKey(e))),gI(2),ah("data-testid",e.id+"-expires"),gI(),nl(" ",e.expiresOn??""," "),gI(2),ah("data-testid",e.id+"-edit"),gI(),nl(" ",Ow(14,17,"settings.edit")," "),gI(2),ch("nzPopconfirmTitle",Ow(16,19,"settings.deleteConfirm"))("nzOkText",Ow(17,21,"settings.delete"))("nzCancelText",Ow(18,23,"common.cancel")),ah("data-testid",e.id+"-delete"),gI(4),nl(" ",Ow(20,25,"settings.delete")," ");}}function Bt(i,p){if(i&1&&(_i(0,"nz-table",7)(1,"thead")(2,"tr")(3,"th"),vw(4),Rw(5,"transloco"),Kc(),_i(6,"th"),vw(7),Rw(8,"transloco"),Kc(),_i(9,"th"),vw(10),Rw(11,"transloco"),Kc(),_i(12,"th"),vw(13),Rw(14,"transloco"),Kc()()(),_i(15,"tbody"),ND(16,Ft,21,27,"tr",null,Y),Kc()()),i&2){let e=VD();ch("nzData",e.instances())("nzFrontPagination",false)("nzShowPagination",false),gI(4),Ph(Ow(5,7,"settings.column.displayName")),gI(3),Ph(Ow(8,9,"settings.column.type")),gI(3),Ph(Ow(11,11,"settings.column.expiresOn")),gI(3),Ph(Ow(14,13,"settings.column.actions")),gI(3),xD(e.instances());}}function Rt(i,p){if(i&1&&(_i(0,"li"),vw(1),Kc()),i&2){let e=p.$implicit;gI(),Ph(e);}}function Lt(i,p){if(i&1&&(_i(0,"section",16)(1,"h3"),vw(2),Rw(3,"transloco"),Kc(),_i(4,"ul"),ND(5,Rt,2,1,"li",null,SD),Kc()()),i&2){let e=VD(2);gI(2),Ph(Ow(3,1,"settings.validation")),gI(3),xD(e.validationErrors());}}function Kt(i,p){if(i&1&&(_i(0,"p",17),vw(1),Kc()),i&2){let e=VD(2);gI(),Ph(e.secretSaveError());}}function qt(i,p){if(i&1&&(lh(0,"nz-option",24),Rw(1,"transloco")),i&2){let e=p.$implicit;ch("nzValue",e.id)("nzLabel",Ow(1,2,e.labelKey));}}function $t(i,p){if(i&1){let e=LD();_i(0,"label",18)(1,"span"),vw(2),Rw(3,"transloco"),Kc(),_i(4,"input",32),gh("ngModelChange",function(t){let r=Pu(e).$implicit,u=VD(2);return Lu(u.setDraftConfig(r.key,t))}),Kc(),oE(),Kc();}if(i&2){let e=p.$implicit,o=VD(2);gI(2),Ph(Ow(3,3,e.labelKey)),gI(2),ch("ngModel",o.configValue(o.draft().config,e.key)),ah("data-testid","provider-config-"+e.key),sE();}}function jt(i,p){if(i&1){let e=LD();_i(0,"button",33),gh("click",function(){Pu(e);let t=VD(2);return Lu(t.fetchModels())}),vw(1),Rw(2,"transloco"),Kc();}if(i&2){let e=VD(2);ch("nzLoading",e.fetchingModels())("disabled",!e.canFetchModels()),gI(),nl(" ",Ow(2,3,"settings.model.fetch")," ");}}function Ut(i,p){if(i&1&&lh(0,"nz-option",24),i&2){let e=VD(3);ch("nzValue",e.configValue(e.draft().config,"model"))("nzLabel",e.configValue(e.draft().config,"model"));}}function Wt(i,p){if(i&1&&lh(0,"nz-option",24),i&2){let e=p.$implicit;ch("nzValue",e.id)("nzLabel",e.displayName);}}function Zt(i,p){if(i&1&&(_i(0,"p",35),vw(1),Kc()),i&2){let e=VD(3);gI(),Ph(e.modelsError());}}function Ht(i,p){if(i&1){let e=LD();_i(0,"div",18)(1,"span"),vw(2),Rw(3,"transloco"),Kc(),_i(4,"nz-select",34),Rw(5,"transloco"),gh("ngModelChange",function(t){Pu(e);let r=VD(2);return Lu(r.setDraftConfig("model",t??""))}),bD(6,Ut,1,2,"nz-option",24),ND(7,Wt,1,2,"nz-option",24,Y),Kc(),oE(),bD(9,Zt,2,1,"p",35),_i(10,"p",22),vw(11),Rw(12,"transloco"),Kc()(),_i(13,"label",36)(14,"span"),vw(15),Rw(16,"transloco"),Kc(),_i(17,"nz-switch",37),gh("ngModelChange",function(t){Pu(e);let r=VD(2);return Lu(r.setDefaultAgentDraft(t))}),Kc(),oE(),Kc();}if(i&2){let e=VD(2);gI(2),Ph(Ow(3,8,"settings.model.label")),gI(2),ch("nzPlaceHolder",Ow(5,10,"settings.model.placeholder"))("ngModel",e.configValue(e.draft().config,"model")),sE(),gI(2),_D(e.selectedModelMissingFromList()?6:-1),gI(),xD(e.availableModels()),gI(2),_D(e.modelsError()?9:-1),gI(2),Ph(Ow(12,12,"settings.model.hint")),gI(4),Ph(Ow(16,14,"settings.defaultAgent.toggle")),gI(2),ch("ngModel",e.draft().defaultAgent),sE();}}function Qt(i,p){if(i&1){let e=LD();_i(0,"div",8)(1,"div",15)(2,"h2"),vw(3),Rw(4,"transloco"),Kc(),bD(5,Lt,7,3,"section",16),bD(6,Kt,2,1,"p",17),_i(7,"label",18)(8,"span"),vw(9),Rw(10,"transloco"),Kc(),_i(11,"input",19),gh("ngModelChange",function(t){Pu(e);let r=VD();return Lu(r.onDisplayNameChange(t))}),Kc(),oE(),Kc(),_i(12,"label",20)(13,"span"),vw(14),Rw(15,"transloco"),Kc(),_i(16,"input",21),gh("ngModelChange",function(t){Pu(e);let r=VD();return Lu(r.onIdChange(t))}),Kc(),oE(),_i(17,"p",22),vw(18),Rw(19,"transloco"),Kc()(),_i(20,"div",18)(21,"span"),vw(22),Rw(23,"transloco"),Kc(),_i(24,"nz-select",23),gh("ngModelChange",function(t){Pu(e);let r=VD();return Lu(r.onTypeChange(t))}),ND(25,qt,2,4,"nz-option",24,Y),Kc(),oE(),Kc(),ND(27,$t,5,5,"label",18,Dt),_i(29,"label",18)(30,"span"),vw(31),Rw(32,"transloco"),Kc(),_i(33,"div",25)(34,"input",26),Rw(35,"transloco"),gh("ngModelChange",function(t){Pu(e);let r=VD();return Lu(r.setSecretValue(t))}),Kc(),oE(),bD(36,jt,3,5,"button",27),Kc()(),bD(37,Ht,18,16),_i(38,"label",18)(39,"span"),vw(40),Rw(41,"transloco"),Kc(),_i(42,"input",28),gh("ngModelChange",function(t){Pu(e);let r=VD();return Lu(r.setExpiresOn(t))}),Kc(),oE(),_i(43,"p",22),vw(44),Rw(45,"transloco"),Kc()(),_i(46,"div",29)(47,"button",30),gh("click",function(){Pu(e);let t=VD();return Lu(t.closeModal())}),vw(48),Rw(49,"transloco"),Kc(),_i(50,"button",31),gh("click",function(){Pu(e);let t=VD();return Lu(t.saveModal())}),vw(51),Rw(52,"transloco"),Kc()()()();}if(i&2){let e=VD();gI(3),nl(" ",Ow(4,21,e.draft().originalId?"settings.editProvider":"settings.addProvider")," "),gI(2),_D(e.validationErrors().length>0?5:-1),gI(),_D(e.secretSaveError()?6:-1),gI(3),Ph(Ow(10,23,"settings.displayName")),gI(2),ch("ngModel",e.draft().displayName),sE(),gI(3),Ph(Ow(15,25,"settings.instanceId")),gI(2),ch("ngModel",e.draft().id),sE(),gI(2),Ph(Ow(19,27,"settings.instanceIdHint")),gI(4),Ph(Ow(23,29,"settings.type.label")),gI(2),ch("ngModel",e.draft().optionId),sE(),gI(),xD(e.typeOptions),gI(2),xD(e.configFields(e.draft().type)),gI(4),Ph(Ow(32,31,"settings.apiKey.label")),gI(3),ch("ngModel",e.draft().secretValue)("placeholder",Ow(35,33,e.draft().originalId?"settings.apiKey.placeholderEdit":"settings.apiKey.placeholderCreate")),sE(),gI(2),_D(e.draft().kind==="agent"?36:-1),gI(),_D(e.draft().kind==="agent"?37:-1),gI(3),Ph(Ow(41,35,"settings.expiresOn.label")),gI(2),ch("ngModel",e.draft().expiresOn),sE(),gI(2),Ph(Ow(45,37,"settings.expiresOn.hint")),gI(4),nl(" ",Ow(49,39,"common.cancel")," "),gI(2),ch("nzLoading",e.saving()),gI(),nl(" ",Ow(52,41,"common.save")," ");}}var Ui=(()=>{class i{constructor(){this.api=C($),this.providersApi=C($$1),this.message=C(Sk),this.destroyRef=C(at),this.transloco=C(Ve),this.loaded=qo({providerInstances:[]}),this.status=qo([]),this.draft=qo(R()),this.loading=qo(true),this.saving=qo(false),this.loadError=qo(null),this.validationErrors=qo([]),this.secretSaveError=qo(null),this.restartRequired=qo(false),this.modalOpen=qo(false),this.availableModels=qo([]),this.fetchingModels=qo(false),this.modelsError=qo(null),this.instances=Hw(()=>this.loaded().providerInstances??[]),this.typeOptions=y,this.configFields=T,this.typeLabelKey=P,this.isAgent=Nx,Ng({settings:this.api.getSettings(),status:this.api.getProviderStatus()}).pipe(ue(this.destroyRef)).subscribe({next:({settings:e,status:o})=>{this.applySettings(e,false),this.status.set(o),this.loading.set(false);},error:e=>{this.loading.set(false),this.loadError.set(this.errorMessage(e,this.transloco.translate("settings.loadFailed")));}});}configValue(e,o){let t=e[o];return typeof t=="string"?t:""}isDefaultAgent(e){return Nx(e)&&this.loaded().defaultAgentInstanceId===e.id}selectedModelMissingFromList(){let e=this.configValue(this.draft().config,"model");return e?!this.availableModels().some(o=>o.id===e):false}canFetchModels(){let e=this.draft();return e.kind==="agent"&&(e.secretValue.trim().length>0||e.originalId!=null)}openCreate(){this.resetModal(R());}openEdit(e){this.resetModal(q(e,this.isDefaultAgent(e)));}closeModal(){this.modalOpen.set(false);}onDisplayNameChange(e){this.draft.update(o=>D(o,e,this.existingIds(o)));}onIdChange(e){this.draft.update(o=>N(o,e));}onTypeChange(e){this.availableModels.set([]),this.modelsError.set(null),this.draft.update(o=>{let t=w(o,e);return t.kind!=="agent"||o.kind==="agent"?t:s(r({},t),{defaultAgent:this.shouldDefaultNewAgent(o)})});}setDraftConfig(e,o){this.draft.update(t=>s(r({},t),{config:s(r({},t.config),{[e]:o})}));}setSecretValue(e){this.draft.update(o=>s(r({},o),{secretValue:e}));}setExpiresOn(e){this.draft.update(o=>s(r({},o),{expiresOn:e}));}setDefaultAgentDraft(e){this.draft.update(o=>s(r({},o),{defaultAgent:e}));}fetchModels(){let e=this.draft();if(e.kind!=="agent"||!this.canFetchModels())return;let o=e.secretValue.trim();this.fetchingModels.set(true),this.modelsError.set(null),this.providersApi.previewModels(o?{type:e.type,apiKey:o}:{type:e.type,instanceId:e.originalId}).pipe(ue(this.destroyRef)).subscribe({next:t=>{this.availableModels.set(t),this.fetchingModels.set(false);},error:t=>{this.fetchingModels.set(false),this.modelsError.set(this.errorMessage(t,this.transloco.translate("settings.model.fetchFailed")));}});}saveModal(){let e=this.draft();if(this.validationErrors.set([]),this.secretSaveError.set(null),!e.displayName.trim()){this.validationErrors.set([this.transloco.translate("settings.displayNameRequired")]);return}if(e.originalId==null&&!e.secretValue.trim()){this.validationErrors.set([this.transloco.translate("settings.apiKey.required")]);return}let o=vf.safeParse(V(e));if(!o.success){this.validationErrors.set(_(o.error));return}this.saving.set(true);let t=o.data,r$1=t.kind==="agent"?{defaultAgent:e.defaultAgent}:{};(e.originalId==null?this.api.createProviderInstance(r(r({},t),r$1)):this.api.updateProviderInstance(e.originalId,r({displayName:t.displayName,config:t.config,secretKey:t.secretKey,expiresOn:t.expiresOn??null},r$1))).pipe(Ml(T=>{this.applySettings(T.settings,T.restartRequired);let P=e.secretValue.trim();return P?this.api.setSecret(t.secretKey,P).pipe(Se(()=>({kind:"ok"})),Xi(_t=>Dg({kind:"secret-failed",err:_t}))):Dg({kind:"ok"})}),ue(this.destroyRef)).subscribe({next:T=>{if(this.saving.set(false),T.kind==="secret-failed"){this.draft.update(P=>s(r({},P),{originalId:t.id,id:t.id,idAutoSync:false,secretKey:t.secretKey})),this.secretSaveError.set(this.errorMessage(T.err,this.transloco.translate("settings.apiKey.setFailedAfterSave"))),this.refreshStatus();return}this.modalOpen.set(false),this.refreshStatus();},error:T=>{this.saving.set(false),this.message.error(this.errorMessage(T,this.transloco.translate("settings.saveFailed")));}});}removeInstance(e){this.api.deleteProviderInstance(e).subscribe({next:o=>this.applySettings(o.settings,o.restartRequired),error:o=>{this.message.error(this.errorMessage(o,this.transloco.translate("settings.saveFailed")));}});}resetModal(e){this.validationErrors.set([]),this.secretSaveError.set(null),this.availableModels.set([]),this.modelsError.set(null),this.fetchingModels.set(false),this.draft.set(e),this.modalOpen.set(true);}shouldDefaultNewAgent(e){return e.originalId&&e.originalId===this.loaded().defaultAgentInstanceId?true:!this.loaded().defaultAgentInstanceId}existingIds(e){return this.instances().map(o=>o.id).filter(o=>o!==e.originalId)}applySettings(e,o){let t=e.providerInstances??[];this.loaded.set(r({providerInstances:t},e.defaultAgentInstanceId?{defaultAgentInstanceId:e.defaultAgentInstanceId}:{})),o&&this.restartRequired.set(true);}refreshStatus(){this.api.getProviderStatus().subscribe({next:e=>this.status.set(e),error:()=>{}});}errorMessage(e,o$1){return e instanceof o||e instanceof Error?e.message:o$1}static{this.\u0275fac=function(o){return new(o||i)};}static{this.\u0275cmp=QE({type:i,selectors:[["app-settings"]],decls:17,vars:12,consts:[["data-testid","settings-page",1,"settings"],[1,"header"],[1,"lede"],["nz-button","","nzType","primary","type","button","data-testid","add-provider",3,"click"],["data-testid","restart-required-banner"],["data-testid","loading"],["data-testid","load-error",1,"error"],["data-testid","provider-instances",3,"nzData","nzFrontPagination","nzShowPagination"],["data-testid","provider-modal",1,"modal-backdrop"],["nzType","warning","nzShowIcon","","nzBanner","",3,"nzMessage"],[1,"name-cell"],["nzColor","blue"],[1,"actions"],["nz-button","","nzType","link","type","button",3,"click"],["nz-button","","nzType","link","nzDanger","","type","button","nz-popconfirm","",3,"nzOnConfirm","nzPopconfirmTitle","nzOkText","nzCancelText"],["role","dialog",1,"modal-panel"],["data-testid","validation-errors",1,"errors"],["data-testid","secret-save-error",1,"error"],[1,"field"],["nz-input","","data-testid","provider-display-name",3,"ngModelChange","ngModel"],[1,"field","field-id"],["nz-input","","data-testid","provider-id",3,"ngModelChange","ngModel"],[1,"hint"],["data-testid","provider-type",3,"ngModelChange","ngModel"],[3,"nzValue","nzLabel"],[1,"api-key-row"],["nz-input","","type","password","autocomplete","off","data-testid","provider-api-key",3,"ngModelChange","ngModel","placeholder"],["nz-button","","type","button","data-testid","provider-fetch-models",3,"nzLoading","disabled"],["nz-input","","type","date","data-testid","provider-expires-on",3,"ngModelChange","ngModel"],[1,"modal-actions"],["nz-button","","type","button","data-testid","provider-cancel",3,"click"],["nz-button","","nzType","primary","type","button","data-testid","provider-save",3,"click","nzLoading"],["nz-input","",3,"ngModelChange","ngModel"],["nz-button","","type","button","data-testid","provider-fetch-models",3,"click","nzLoading","disabled"],["data-testid","provider-model","nzAllowClear","",3,"ngModelChange","nzPlaceHolder","ngModel"],["data-testid","provider-models-error",1,"error"],[1,"field","field-switch"],["data-testid","provider-default-agent",3,"ngModelChange","ngModel"]],template:function(o,t){o&1&&(_i(0,"main",0)(1,"header",1)(2,"div")(3,"h1"),vw(4),Rw(5,"transloco"),Kc(),_i(6,"p",2),vw(7),Rw(8,"transloco"),Kc()(),_i(9,"button",3),gh("click",function(){return t.openCreate()}),vw(10),Rw(11,"transloco"),Kc()(),bD(12,Ot,3,3,"div",4),bD(13,Vt,3,3,"p",5)(14,Pt,2,1,"p",6)(15,Bt,18,15,"nz-table",7),bD(16,Qt,53,43,"div",8),Kc()),o&2&&(gI(4),Ph(Ow(5,6,"settings.title")),gI(3),Ph(Ow(8,8,"settings.lede")),gI(3),nl(" ",Ow(11,10,"settings.addProvider")," "),gI(2),_D(t.restartRequired()?12:-1),gI(),_D(t.loading()?13:t.loadError()?14:15),gI(3),_D(t.modalOpen()?16:-1));},dependencies:[Mi,n8,S4,J6,k3,Gn,un,sd,zc,t7,y7,uk,Ie,_n,Cn,$b,V5,D5,ht,J,Ad,Hl,$d,Al,Vd,Ai,Xl,W,I,Kt$1],styles:[".settings[_ngcontent-%COMP%]{max-width:72rem;margin:0 auto;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}.lede[_ngcontent-%COMP%]{margin:.25rem 0 0;color:#57534e}.field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem;margin:.5rem 0}.field[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{font-size:.85rem;color:#57534e}.field-id[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{font-family:ui-monospace,Consolas,monospace;font-size:.85rem;color:#57534e}.hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:#78716c}.errors[_ngcontent-%COMP%]{border:1px solid #fecdd3;background:#fff1f2;padding:.75rem 1rem}.errors[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0 0 .35rem;font-size:1rem}.error[_ngcontent-%COMP%]{color:#9f1239}.actions[_ngcontent-%COMP%]{white-space:nowrap}.name-cell[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.api-key-row[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:center}.api-key-row[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{flex:1}.field-switch[_ngcontent-%COMP%]{flex-direction:row;align-items:center;justify-content:space-between}.modal-backdrop[_ngcontent-%COMP%]{position:fixed;inset:0;z-index:1000;display:flex;align-items:flex-start;justify-content:center;padding:4rem 1rem 2rem;background:#1c191759}.modal-panel[_ngcontent-%COMP%]{width:min(32rem,100%);max-height:calc(100vh - 6rem);overflow:auto;background:#fff;border-radius:.5rem;padding:1.25rem 1.5rem 1.5rem;box-shadow:0 10px 30px #1c19172e}.modal-panel[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{margin:0 0 .75rem;font-size:1.15rem}.modal-actions[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;gap:.5rem;margin-top:1rem}"]});}}return i})();export{Ui as ProvidersManageComponent,Ui as SettingsComponent};
@@ -1 +0,0 @@
1
- import {o as ox,i as ix}from'./chunk-DdVQ8Ilm.js';import {s,r,t as t$1}from'./main-BRWQ5RNE.js';var y=["agent","interaction","shell","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 g(t,e){return t.map(n=>{let r$1=s(r({},n),{_key:d(),_idAutoSync:e.idAutoSync});return n.type==="loop"?s(r({},r$1),{steps:g(n.steps,e)}):r$1})}function h(t,e){let n=e?.id??"",r$1=e?.name??"",i={_key:e?.key??d(),_idAutoSync:e?.idAutoSync??true};switch(t){case "agent":return r({type:t,id:n,name:r$1,objective:"",outputFormat:"free_text"},i);case "interaction":return r({type:t,id:n,name:r$1,interaction:"questionnaire"},i);case "shell":return r({type:t,id:n,name:r$1,command:""},i);case "git":return r({type:t,id:n,name:r$1,operation:"create_worktree",params:{}},i);case "provider_action":return r({type:t,id:n,name:r$1,action:"get_subject",params:{}},i);case "sub_workflow":return r({type:t,id:n,name:r$1,workflowId:"",forEach:"selection"},i);case "loop":return r({type:t,id:n,name:r$1,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$1=t$1(i,["_key","_idAutoSync"]);return r$1.type==="loop"?s(r({},r$1),{steps:r$1.steps.map(a=>m(a))}):r$1}function v(t,e={}){let n=t.steps.map(_=>{let u=m(_);if(!u.id){let p=u,{id:x}=p;return t$1(p,["id"])}return u}),a=t,{id:r$1}=a,i=t$1(a,["id"]);return e.omitWorkflowId||!r$1?s(r({},i),{steps:n}):s(r({},i),{id:r$1,steps:n})}function E(t,e,n){if(!t._idAutoSync)return s(r({},t),{name:e});let r$1=ox(n);t.id&&r$1.delete(t.id);let i=e.trim().length>0?ix(e,r$1):"";return s(r({},t),{name:e,id:i})}function P(t,e){return s(r({},t),{id:e,_idAutoSync:false})}export{A,E,I,P,T,b,g,h,j,v,y};
@@ -1 +0,0 @@
1
- import {I,g,b,v,T,y,h,E,P,A,j}from'./chunk-f1UVptf5.js';import {$ as $$1,F,B}from'./chunk-Cwf9CcBI.js';import {S as Sk,D as Dx,Y as Yp,d as dx,u as uk,I as Ie$1,y as yf,b as bf,_ as _f,$ as $f,p as px,j as jx}from'./chunk-DdVQ8Ilm.js';import {C,a as ae,T as Ie,ag as $,b as at,V as Ve,aY as O,aZ as de,ai as Se,q as qo$1,H as Hw,u as ue,s,r,o,Q as QE,M as Mi$1,n as n8,aj as S4,J as J6,k as k3,L as Ln$1,c as sd,z as zc,d as t7,Z as y7,$ as $b,e as V5,D as D5,K as Kt,f as _i$1,v as vw,g as Kc,R as Rw,h as gh,m as bD,p as gI,P as Ph,O as Ow,x as ch,w as nl$1,B as _D,ak as YE,al as uu,a_ as P1,am as pT,aq as z0,at as Le,as as hT,a$ as Vt,az as Tt,aA as Ie$2,b0 as es,aC as Z0,aR as BD,b1 as sw,a4 as Mh,b2 as vh,aH as qD,aI as WD,a0 as $0,a1 as B0,X as rd,t as t$1,b3 as $6,N as ND,a5 as ah,A as xD,E as VD,F as LD,j as oE,S as SD,a7 as MD,y as sE,aJ as ut,b4 as l9,aB as ly,aK as nh,l as lh,a6 as Nw,aS as $D,b5 as XE,b6 as Y0,b7 as N1,b8 as q0,ao as _r,b9 as Ee,ar as a3,ba as ga,bb as j3,au as m1,bc as za,bd as Uw,be as W0,bf as D8,bg as u9,bh as a9,bi as Kf,Y as Bw,bj as f9,ax as pt,ay as Se$1,bk as va,bl as Lw,aD as Sw,aE as h1,bm as B1,aF as wo$1,bn as rD,bo as R4,bp as cw,bq as Dh,br as GD,bs as Eh,bt as U0,a2 as Pw,a3 as xw,bu as uh,aT as _h,bv as zD,G as Pu,I as Lu,bw as Vh,bx as jh,aL as el,aM as tl,by as rh,aG as Ih,bz as Er,bA as ww}from'./main-BRWQ5RNE.js';import {U}from'./chunk-BWr0M-hk.js';import {G as Gn$1,u as un}from'./chunk-B76UD1mt.js';import {F as Fe,o as oe}from'./chunk-C3wpjxgW.js';import'./chunk-WzBVBHEz.js';var Rn=["*"];function Kn(t,l){if(t&1&&(_i$1(0,"div",0),lh(1,"nz-skeleton-element",4),Kc()),t&2){let e=VD(2);gI(),ch("nzSize",e.avatar.size||"default")("nzShape",e.avatar.shape||"circle");}}function Hn(t,l){if(t&1&&lh(0,"h3",5),t&2){let e=VD(2);_h("width",e.toCSSUnit(e.title.width));}}function qn(t,l){if(t&1&&lh(0,"li"),t&2){let e=l.$index,n=VD(3);_h("width",n.toCSSUnit(n.widthList[e]));}}function Un(t,l){if(t&1&&(_i$1(0,"ul",3),ND(1,qn,1,2,"li",6,SD),Kc()),t&2){let e=VD(2);gI(),xD(e.rowsList);}}function Gn(t,l){if(t&1&&(bD(0,Kn,2,2,"div",0),_i$1(1,"div",1),bD(2,Hn,1,2,"h3",2),bD(3,Un,3,0,"ul",3),Kc()),t&2){let e=VD();_D(e.nzAvatar?0:-1),gI(2),_D(e.nzTitle?2:-1),gI(),_D(e.nzParagraph?3:-1);}}function Qn(t,l){t&1&&$D(0);}var Zn=(()=>{class t{nzActive=false;nzType;nzBlock=false;static \u0275fac=function(n){return new(n||t)};static \u0275dir=XE({type:t,selectors:[["nz-skeleton-element"]],hostAttrs:[1,"ant-skeleton","ant-skeleton-element"],hostVars:4,hostBindings:function(n,i){n&2&&Mh("ant-skeleton-active",i.nzActive)("ant-skeleton-block",i.nzBlock);},inputs:{nzActive:[2,"nzActive","nzActive",Z0],nzType:"nzType",nzBlock:[2,"nzBlock","nzBlock",Z0]}})}return t})();var Yn=(()=>{class t{nzShape="circle";nzSize="default";styleMap={};ngOnChanges(e){if(e.nzSize&&typeof this.nzSize=="number"){let n=`${this.nzSize}px`;this.styleMap={width:n,height:n,"line-height":n};}else this.styleMap={};}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=QE({type:t,selectors:[["nz-skeleton-element","nzType","avatar"]],inputs:{nzShape:"nzShape",nzSize:"nzSize"},features:[ly],decls:1,vars:10,consts:[[1,"ant-skeleton-avatar"]],template:function(n,i){n&1&&uh(0,"span",0),n&2&&(sw(i.styleMap),Mh("ant-skeleton-avatar-square",i.nzShape==="square")("ant-skeleton-avatar-circle",i.nzShape==="circle")("ant-skeleton-avatar-lg",i.nzSize==="large")("ant-skeleton-avatar-sm",i.nzSize==="small"));},encapsulation:2})}return t})();var wn=(()=>{class t{cdr=C(z0);nzActive=false;nzLoading=true;nzRound=false;nzTitle=true;nzAvatar=false;nzParagraph=true;title;avatar;paragraph;rowsList=[];widthList=[];toCSSUnit(e=""){return l9(e)}getTitleProps(){let e=!!this.nzAvatar,n=!!this.nzParagraph,i="";return !e&&n?i="38%":e&&n&&(i="50%"),r({width:i},this.getProps(this.nzTitle))}getAvatarProps(){let e=this.nzTitle&&!this.nzParagraph?"square":"circle";return r({shape:e,size:"large"},this.getProps(this.nzAvatar))}getParagraphProps(){let e=!!this.nzAvatar,n=!!this.nzTitle,i={};return (!e||!n)&&(i.width="61%"),!e&&n?i.rows=3:i.rows=2,r(r({},i),this.getProps(this.nzParagraph))}getProps(e){return e&&typeof e=="object"?e:{}}getWidthList(){let{width:e,rows:n}=this.paragraph,i=[];return e&&Array.isArray(e)?i=e:e&&!Array.isArray(e)&&(i=[],i[n-1]=e),i}updateProps(){this.title=this.getTitleProps(),this.avatar=this.getAvatarProps(),this.paragraph=this.getParagraphProps(),this.rowsList=[...Array(this.paragraph.rows)],this.widthList=this.getWidthList(),this.cdr.markForCheck();}ngOnInit(){this.updateProps();}ngOnChanges(e){(e.nzTitle||e.nzAvatar||e.nzParagraph)&&this.updateProps();}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=QE({type:t,selectors:[["nz-skeleton"]],hostAttrs:[1,"ant-skeleton"],hostVars:6,hostBindings:function(n,i){n&2&&Mh("ant-skeleton-with-avatar",!!i.nzAvatar)("ant-skeleton-active",i.nzActive)("ant-skeleton-round",i.nzRound);},inputs:{nzActive:[2,"nzActive","nzActive",Z0],nzLoading:[2,"nzLoading","nzLoading",Z0],nzRound:[2,"nzRound","nzRound",Z0],nzTitle:"nzTitle",nzAvatar:"nzAvatar",nzParagraph:"nzParagraph"},exportAs:["nzSkeleton"],features:[ly],ngContentSelectors:Rn,decls:2,vars:1,consts:[[1,"ant-skeleton-header"],[1,"ant-skeleton-content"],[1,"ant-skeleton-title",3,"width"],[1,"ant-skeleton-paragraph"],["nzType","avatar",3,"nzSize","nzShape"],[1,"ant-skeleton-title"],[3,"width"]],template:function(n,i){n&1&&(BD(),bD(0,Gn,4,3)(1,Qn,1,0)),n&2&&_D(i.nzLoading?0:1);},dependencies:[Zn,Yn],encapsulation:2})}return t})(),Sn=(()=>{class t{static \u0275fac=function(n){return new(n||t)};static \u0275mod=YE({type:t});static \u0275inj=uu({})}return t})();function Xn(t,l){}function ei(t,l){if(t&1&&(_i$1(0,"div",0),nh(1,Xn,0,0,"ng-template",2),Kc()),t&2){let e=VD();gI(),ch("ngTemplateOutlet",e.nzAvatar);}}function ti(t,l){if(t&1&&(el(0),vw(1),tl()),t&2){let e=VD(3);gI(),Ph(e.nzTitle);}}function ni(t,l){if(t&1&&(_i$1(0,"div",3),nh(1,ti,2,1,"ng-container",5),Kc()),t&2){let e=VD(2);gI(),ch("nzStringTemplateOutlet",e.nzTitle);}}function ii(t,l){if(t&1&&(el(0),vw(1),tl()),t&2){let e=VD(3);gI(),Ph(e.nzDescription);}}function oi(t,l){if(t&1&&(_i$1(0,"div",4),nh(1,ii,2,1,"ng-container",5),Kc()),t&2){let e=VD(2);gI(),ch("nzStringTemplateOutlet",e.nzDescription);}}function ri(t,l){if(t&1&&(_i$1(0,"div",1),bD(1,ni,2,1,"div",3),bD(2,oi,2,1,"div",4),Kc()),t&2){let e=VD();gI(),_D(e.nzTitle?1:-1),gI(),_D(e.nzDescription?2:-1);}}var Mn=["*"];function ai(t,l){t&1&&$D(0);}var li=()=>({rows:4});function si(t,l){if(t&1&&(el(0),vw(1),tl()),t&2){let e=VD(3);gI(),Ph(e.nzTitle);}}function pi(t,l){if(t&1&&(_i$1(0,"div",6),nh(1,si,2,1,"ng-container",9),Kc()),t&2){let e=VD(2);gI(),ch("nzStringTemplateOutlet",e.nzTitle);}}function di(t,l){if(t&1&&(el(0),vw(1),tl()),t&2){let e=VD(3);gI(),Ph(e.nzExtra);}}function ci(t,l){if(t&1&&(_i$1(0,"div",7),nh(1,di,2,1,"ng-container",9),Kc()),t&2){let e=VD(2);gI(),ch("nzStringTemplateOutlet",e.nzExtra);}}function _i(t,l){}function mi(t,l){if(t&1&&nh(0,_i,0,0,"ng-template",8),t&2){let e=VD(2);ch("ngTemplateOutlet",e.listOfNzCardTabComponent.template);}}function ui(t,l){if(t&1&&(_i$1(0,"div",0)(1,"div",5),bD(2,pi,2,1,"div",6),bD(3,ci,2,1,"div",7),Kc(),bD(4,mi,1,1,null,8),Kc()),t&2){let e=VD();gI(2),_D(e.nzTitle?2:-1),gI(),_D(e.nzExtra?3:-1),gI(),_D(e.listOfNzCardTabComponent?4:-1);}}function fi(t,l){}function Ci(t,l){if(t&1&&(_i$1(0,"div",1),nh(1,fi,0,0,"ng-template",8),Kc()),t&2){let e=VD();gI(),ch("ngTemplateOutlet",e.nzCover);}}function gi(t,l){t&1&&lh(0,"nz-skeleton",3),t&2&&ch("nzActive",true)("nzTitle",false)("nzParagraph",Nw(3,li));}function xi(t,l){t&1&&$D(0);}function hi(t,l){}function zi(t,l){if(t&1&&(_i$1(0,"li")(1,"span"),nh(2,hi,0,0,"ng-template",8),Kc()()),t&2){let e=l.$implicit,n=l.$count;_h("width",100/n,"%"),gI(2),ch("ngTemplateOutlet",e);}}function vi(t,l){if(t&1&&(_i$1(0,"ul",4),ND(1,zi,3,3,"li",10,MD),Kc()),t&2){let e=VD();gI(),xD(e.nzActions);}}var bi=(()=>{class t{nzHoverable=true;static \u0275fac=function(n){return new(n||t)};static \u0275dir=XE({type:t,selectors:[["","nz-card-grid",""]],hostAttrs:[1,"ant-card-grid"],hostVars:2,hostBindings:function(n,i){n&2&&Mh("ant-card-hoverable",i.nzHoverable);},inputs:{nzHoverable:[2,"nzHoverable","nzHoverable",Z0]},exportAs:["nzCardGrid"]})}return t})(),wi=(()=>{class t{nzTitle=null;nzDescription=null;nzAvatar=null;static \u0275fac=function(n){return new(n||t)};static \u0275cmp=QE({type:t,selectors:[["nz-card-meta"]],hostAttrs:[1,"ant-card-meta"],inputs:{nzTitle:"nzTitle",nzDescription:"nzDescription",nzAvatar:"nzAvatar"},exportAs:["nzCardMeta"],decls:2,vars:2,consts:[[1,"ant-card-meta-avatar"],[1,"ant-card-meta-detail"],[3,"ngTemplateOutlet"],[1,"ant-card-meta-title"],[1,"ant-card-meta-description"],[4,"nzStringTemplateOutlet"]],template:function(n,i){n&1&&(bD(0,ei,2,1,"div",0),bD(1,ri,3,2,"div",1)),n&2&&(_D(i.nzAvatar?0:-1),gI(),_D(i.nzTitle||i.nzDescription?1:-1));},dependencies:[es,Tt,Ie$2],encapsulation:2})}return t})(),Si=(()=>{class t{template;static \u0275fac=function(n){return new(n||t)};static \u0275cmp=QE({type:t,selectors:[["nz-card-tab"]],viewQuery:function(n,i){if(n&1&&Ih(Er,7),n&2){let o;qD(o=WD())&&(i.template=o.first);}},exportAs:["nzCardTab"],ngContentSelectors:Mn,decls:1,vars:0,template:function(n,i){n&1&&(BD(),rh(0,ai,1,0,"ng-template"));},encapsulation:2})}return t})(),yn="card",ze=(()=>{let t,l=[],e=[],n,i=[],o=[],d,E=[],K=[];return class Ct{static{let q=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;t=[ut()],n=[ut()],d=[ut()],pT(null,null,t,{kind:"field",name:"nzBordered",static:false,private:false,access:{has:I=>"nzBordered"in I,get:I=>I.nzBordered,set:(I,A)=>{I.nzBordered=A;}},metadata:q},l,e),pT(null,null,n,{kind:"field",name:"nzHoverable",static:false,private:false,access:{has:I=>"nzHoverable"in I,get:I=>I.nzHoverable,set:(I,A)=>{I.nzHoverable=A;}},metadata:q},i,o),pT(null,null,d,{kind:"field",name:"nzSize",static:false,private:false,access:{has:I=>"nzSize"in I,get:I=>I.nzSize,set:(I,A)=>{I.nzSize=A;}},metadata:q},E,K),q&&Object.defineProperty(this,Symbol.metadata,{enumerable:true,configurable:true,writable:true,value:q});}cdr=C(z0);dir=C(Le).valueSignal;_nzModuleName=yn;nzBordered=hT(this,l,true);nzLoading=(hT(this,e),false);nzHoverable=hT(this,i,false);nzBodyStyle=(hT(this,o),null);nzCover;nzActions=[];nzType=null;nzSize=hT(this,E,"default");nzTitle=hT(this,K);nzExtra;listOfNzCardTabComponent;listOfNzCardGridDirective;constructor(){Vt(yn,()=>this.cdr.markForCheck());}static \u0275fac=function(I){return new(I||Ct)};static \u0275cmp=QE({type:Ct,selectors:[["nz-card"]],contentQueries:function(I,A,zt){if(I&1&&vh(zt,Si,5)(zt,bi,4),I&2){let ve;qD(ve=WD())&&(A.listOfNzCardTabComponent=ve.first),qD(ve=WD())&&(A.listOfNzCardGridDirective=ve);}},hostAttrs:[1,"ant-card"],hostVars:16,hostBindings:function(I,A){I&2&&Mh("ant-card-loading",A.nzLoading)("ant-card-bordered",A.nzBordered)("ant-card-hoverable",A.nzHoverable)("ant-card-small",A.nzSize==="small")("ant-card-contain-grid",A.listOfNzCardGridDirective&&A.listOfNzCardGridDirective.length)("ant-card-type-inner",A.nzType==="inner")("ant-card-contain-tabs",!!A.listOfNzCardTabComponent)("ant-card-rtl",A.dir()==="rtl");},inputs:{nzBordered:[2,"nzBordered","nzBordered",Z0],nzLoading:[2,"nzLoading","nzLoading",Z0],nzHoverable:[2,"nzHoverable","nzHoverable",Z0],nzBodyStyle:"nzBodyStyle",nzCover:"nzCover",nzActions:"nzActions",nzType:"nzType",nzSize:"nzSize",nzTitle:"nzTitle",nzExtra:"nzExtra"},exportAs:["nzCard"],ngContentSelectors:Mn,decls:6,vars:6,consts:[[1,"ant-card-head"],[1,"ant-card-cover"],[1,"ant-card-body"],[3,"nzActive","nzTitle","nzParagraph"],[1,"ant-card-actions"],[1,"ant-card-head-wrapper"],[1,"ant-card-head-title"],[1,"ant-card-extra"],[3,"ngTemplateOutlet"],[4,"nzStringTemplateOutlet"],[3,"width"]],template:function(I,A){I&1&&(BD(),bD(0,ui,5,3,"div",0),bD(1,Ci,2,1,"div",1),_i$1(2,"div",2),bD(3,gi,1,4,"nz-skeleton",3)(4,xi,1,0),Kc(),bD(5,vi,3,0,"ul",4)),I&2&&(_D(A.nzTitle||A.nzExtra||A.listOfNzCardTabComponent?0:-1),gI(),_D(A.nzCover?1:-1),gI(),sw(A.nzBodyStyle),gI(),_D(A.nzLoading?3:4),gI(2),_D(A.nzActions.length?5:-1));},dependencies:[Tt,Ie$2,es,Sn,wn],encapsulation:2})}})(),Ge=(()=>{class t{static \u0275fac=function(n){return new(n||t)};static \u0275mod=YE({type:t});static \u0275inj=uu({imports:[ze,wi,P1]})}return t})();var yi=["input"],Mi=["inputNumberHost"],Ti=[[["","nzInputAddonBefore",""]],[["","nzInputAddonAfter",""]],[["","nzInputPrefix",""]],[["","nzInputSuffix",""]],[["","nzInputNumberUpIcon",""]],[["","nzInputNumberDownIcon",""]]],Ni=["[nzInputAddonBefore]","[nzInputAddonAfter]","[nzInputPrefix]","[nzInputSuffix]","[nzInputNumberUpIcon]","[nzInputNumberDownIcon]"];function ki(t,l){}function Ei(t,l){if(t&1&&nh(0,ki,0,0,"ng-template",8),t&2){VD();let e=zD(4);ch("ngTemplateOutlet",e);}}function Ii(t,l){}function Ai(t,l){if(t&1&&nh(0,Ii,0,0,"ng-template",8),t&2){VD();let e=zD(8);ch("ngTemplateOutlet",e);}}function Vi(t,l){}function Fi(t,l){if(t&1&&nh(0,Vi,0,0,"ng-template",8),t&2){VD();let e=zD(12);ch("ngTemplateOutlet",e);}}function Di(t,l){if(t&1&&vw(0),t&2){let e=VD(3);Ph(e.nzAddonBefore());}}function Pi(t,l){t&1&&(_i$1(0,"div",10),$D(1,0,null,Di,1,1),Kc());}function $i(t,l){}function Bi(t,l){if(t&1&&nh(0,$i,0,0,"ng-template",8),t&2){VD(2);let e=zD(6);ch("ngTemplateOutlet",e);}}function Li(t,l){}function Oi(t,l){if(t&1&&nh(0,Li,0,0,"ng-template",8),t&2){VD(2);let e=zD(10);ch("ngTemplateOutlet",e);}}function ji(t,l){if(t&1&&vw(0),t&2){let e=VD(3);Ph(e.nzAddonAfter());}}function Wi(t,l){t&1&&(_i$1(0,"div",10),$D(1,1,null,ji,1,1),Kc());}function Ri(t,l){if(t&1&&(_i$1(0,"div",9),bD(1,Pi,3,0,"div",10),bD(2,Bi,1,1,null,8)(3,Oi,1,1,null,8),bD(4,Wi,3,0,"div",10),Kc()),t&2){let e=VD();gI(),_D(e.hasAddonBefore()?1:-1),gI(),_D(e.hasAffix()?2:3),gI(2),_D(e.hasAddonAfter()?4:-1);}}function Ki(t,l){}function Hi(t,l){if(t&1&&(_i$1(0,"div"),nh(1,Ki,0,0,"ng-template",8),Kc()),t&2){let e=VD(),n=zD(8);cw(e.affixWrapperClass()),gI(),ch("ngTemplateOutlet",n);}}function qi(t,l){if(t&1&&vw(0),t&2){let e=VD(3);Ph(e.nzPrefix());}}function Ui(t,l){t&1&&(_i$1(0,"span",11),$D(1,2,null,qi,1,1),Kc());}function Gi(t,l){}function Qi(t,l){if(t&1&&vw(0),t&2){let e=VD(3);Ph(e.nzSuffix());}}function Zi(t,l){if(t&1&&lh(0,"nz-form-item-feedback-icon",13),t&2){let e=VD(3);ch("status",e.finalStatus());}}function Yi(t,l){if(t&1&&(_i$1(0,"span",12),$D(1,3,null,Qi,1,1),bD(3,Zi,1,1,"nz-form-item-feedback-icon",13),Kc()),t&2){let e=VD(2);gI(3),_D(e.hasFeedback()&&e.finalStatus()?3:-1);}}function Ji(t,l){if(t&1&&(bD(0,Ui,3,0,"span",11),nh(1,Gi,0,0,"ng-template",8),bD(2,Yi,4,1,"span",12)),t&2){let e=VD(),n=zD(10);_D(e.hasPrefix()?0:-1),gI(),ch("ngTemplateOutlet",n),gI(),_D(e.hasSuffix()?2:-1);}}function Xi(t,l){}function eo(t,l){if(t&1&&(_i$1(0,"div",null,5),nh(2,Xi,0,0,"ng-template",8),Kc()),t&2){let e=VD(),n=zD(12);cw(e.inputNumberClass()),gI(2),ch("ngTemplateOutlet",n);}}function to(t,l){t&1&&lh(0,"nz-icon",20);}function no(t,l){t&1&&lh(0,"nz-icon",21);}function io(t,l){if(t&1){let e=LD();_i$1(0,"div",17,7),gh("mouseup",function(){Pu(e);let i=VD(2);return Lu(i.stopAutoStep())})("mouseleave",function(){Pu(e);let i=VD(2);return Lu(i.stopAutoStep())}),_i$1(2,"span",18),gh("mousedown",function(i){Pu(e);let o=VD(2);return Lu(o.onStepMouseDown(i,true))}),$D(3,4,null,to,1,0),Kc(),_i$1(5,"span",19),gh("mousedown",function(i){Pu(e);let o=VD(2);return Lu(o.onStepMouseDown(i,false))}),$D(6,5,null,no,1,0),Kc()();}if(t&2){let e=VD(2);gI(2),Mh("ant-input-number-handler-up-disabled",e.upDisabled()),ah("aria-disabled",e.upDisabled()),gI(3),Mh("ant-input-number-handler-down-disabled",e.downDisabled()),ah("aria-disabled",e.downDisabled());}}function oo(t,l){if(t&1){let e=LD();bD(0,io,8,6,"div",14),_i$1(1,"div",15)(2,"input",16,6),gh("input",function(){Pu(e);let i=zD(3),o=VD();return Lu(o.onInput(i.value))})("wheel",function(i){Pu(e);let o=VD();return Lu(o.onWheel(i))}),Kc()();}if(t&2){let e=VD();_D(e.nzControls()?0:-1),gI(2),ch("value",e.displayValue())("placeholder",e.nzPlaceHolder()??"")("disabled",e.finalDisabled())("readOnly",e.nzReadOnly()),ah("aria-valuemin",e.nzMin())("aria-valuemax",e.nzMax())("id",e.nzId())("step",e.nzStep())("value",e.displayValue());}}var xt=(()=>{class t{nzId=$0(null);nzSize=$0("default");nzPlaceHolder=$0(null);nzStatus=$0("");nzVariant=$0();nzStep=$0(1,{transform:Y0});nzMin=$0(Number.MIN_SAFE_INTEGER,{transform:Y0});nzMax=$0(Number.MAX_SAFE_INTEGER,{transform:Y0});nzPrecision=$0(null);nzParser=$0();nzFormatter=$0();nzDisabled=$0(false,{transform:Z0});nzReadOnly=$0(false,{transform:Z0});nzAutoFocus=$0(false,{transform:Z0});nzKeyboard=$0(true,{transform:Z0});nzControls=$0(true,{transform:Z0});nzChangeOnWheel=$0(true,{transform:Z0});nzPrefix=$0();nzSuffix=$0();nzAddonBefore=$0();nzAddonAfter=$0();nzBlur=B0();nzFocus=B0();nzOnStep=B0();onChange=()=>{};onTouched=()=>{};isDisabledFirstChange=true;compactSize=C(N1,{optional:true});inputRef=q0.required("input");hostRef=q0("inputNumberHost");elementRef=C(_r);injector=C(Ee);focusMonitor=C(a3);directionality=C(Le);nzFormStatusService=C(ga,{optional:true});autoStepTimer=null;defaultFormatter=e=>{let n=this.nzPrecision();return j3(n)?e.toFixed(n):e.toString()};value=qo$1(null);displayValue=qo$1("");formSize=C(m1,{optional:true});formVariant=C(za,{optional:true});dir=C(Le).valueSignal;focused=qo$1(false);hasFeedback=qo$1(false);finalStatus=Uw(()=>this.nzStatus());finalDisabled=Uw(()=>this.nzDisabled());prefix=W0(yf);suffix=W0(bf);addonBefore=W0(_f);addonAfter=W0($f);hasPrefix=Hw(()=>!!this.nzPrefix()||!!this.prefix());hasSuffix=Hw(()=>!!this.nzSuffix()||!!this.suffix()||this.hasFeedback());hasAffix=Hw(()=>this.hasPrefix()||this.hasSuffix());hasAddonBefore=Hw(()=>!!this.nzAddonBefore()||!!this.addonBefore());hasAddonAfter=Hw(()=>!!this.nzAddonAfter()||!!this.addonAfter());hasAddon=Hw(()=>this.hasAddonBefore()||this.hasAddonAfter());class=Hw(()=>this.hasAddon()?this.groupWrapperClass():this.hasAffix()?this.affixWrapperClass():this.inputNumberClass());inputNumberClass=Hw(()=>r(r({"ant-input-number":true,"ant-input-number-lg":this.finalSize()==="large","ant-input-number-sm":this.finalSize()==="small","ant-input-number-disabled":this.finalDisabled(),"ant-input-number-readonly":this.nzReadOnly(),"ant-input-number-focused":this.focused(),"ant-input-number-rtl":this.dir()==="rtl","ant-input-number-in-form-item":!!this.nzFormStatusService,"ant-input-number-out-of-range":this.value()!==null&&!gt(this.value(),this.nzMin(),this.nzMax())},u9("ant-input-number",this.finalVariant())),D8("ant-input-number",this.finalStatus(),this.hasFeedback())));affixWrapperClass=Hw(()=>r(r({"ant-input-number-affix-wrapper":true,"ant-input-number-affix-wrapper-disabled":this.finalDisabled(),"ant-input-number-affix-wrapper-readonly":this.nzReadOnly(),"ant-input-number-affix-wrapper-focused":this.focused(),"ant-input-number-affix-wrapper-rtl":this.dir()==="rtl"},D8("ant-input-number-affix-wrapper",this.finalStatus(),this.hasFeedback())),u9("ant-input-number-affix-wrapper",this.finalVariant())));groupWrapperClass=Hw(()=>r(r({"ant-input-number-group-wrapper":true,"ant-input-number-group-wrapper-rtl":this.dir()==="rtl"},D8("ant-input-number-group-wrapper",this.finalStatus(),this.hasFeedback())),u9("ant-input-number-group-wrapper",this.finalVariant())));finalSize=Hw(()=>this.formSize?.()?this.formSize():this.compactSize?this.compactSize():this.nzSize());finalVariant=Hw(()=>this.nzVariant()||this.formVariant?.()||"outlined");upDisabled=Hw(()=>!a9(this.value())&&this.value()>=this.nzMax());downDisabled=Hw(()=>!a9(this.value())&&this.value()<=this.nzMin());constructor(){let e=C(at);Kf(()=>{let n=this.hostRef(),i=n||this.elementRef;this.focusMonitor.monitor(i,true).pipe(ue(e)).subscribe(o=>{Bw(()=>{this.focused.set(!!o),o?this.nzFocus.emit():(this.fixValue(),this.onTouched(),this.nzBlur.emit());});}),e.onDestroy(()=>{this.focusMonitor.stopMonitoring(i);});}),this.nzFormStatusService?.formStatusChanges.pipe(ue()).subscribe(({status:n,hasFeedback:i})=>{this.finalStatus.set(n),this.hasFeedback.set(i);});}ngOnInit(){this.nzAutoFocus()&&Kf(()=>this.focus(),{injector:this.injector});}writeValue(e){a9(e)&&(e=null),Bw(()=>{this.value.set(e),this.setValue(e);});}registerOnChange(e){this.onChange=e;}registerOnTouched(e){this.onTouched=e;}setDisabledState(e){Bw(()=>{this.finalDisabled.set(this.isDisabledFirstChange&&this.nzDisabled()||e);}),this.isDisabledFirstChange=false;}focus(e){f9(this.inputRef().nativeElement,e);}blur(){this.inputRef().nativeElement.blur();}step(e,n,i){if(n&&this.upDisabled()||!n&&this.downDisabled())return;let o=e.shiftKey?this.nzStep()*10:this.nzStep();n||(o=-o);let E=10**En(o),K=kn((Math.round((this.value()||0)*E)+Math.round(o*E))/E,this.nzMin(),this.nzMax(),this.nzPrecision());this.setValue(K),this.nzOnStep.emit({type:n?"up":"down",value:this.value(),offset:this.nzStep(),emitter:i}),this.focus();}setValue(e){let n=this.nzFormatter()??this.defaultFormatter,i=this.nzPrecision();j3(i)&&(e&&=+e.toFixed(i));let o=a9(e)?"":n(e);this.displayValue.set(o),this.updateValue(e);}setValueByTyping(e){if(this.displayValue.set(e),e===""){this.updateValue(null);return}let i=(this.nzParser()??Nn)(e);if(lo(e)||Number.isNaN(i))return;let o=this.nzFormatter();if(o){let d=o(i);this.displayValue.set(d);}gt(i,this.nzMin(),this.nzMax())&&this.updateValue(i);}updateValue(e){this.value()!==e&&(this.value.set(e),this.onChange(e));}fixValue(){let e=this.displayValue();if(e==="")return;let i=(this.nzParser()??Nn)(e);if(Number.isNaN(i))i=this.value();else {let o=this.nzPrecision();j3(o)&&En(i)!==o&&(i=+i.toFixed(o)),gt(i,this.nzMin(),this.nzMax())||(i=kn(i,this.nzMin(),this.nzMax(),o));}this.setValue(i);}stopAutoStep(){this.autoStepTimer!==null&&(clearTimeout(this.autoStepTimer),this.autoStepTimer=null);}onStepMouseDown(e,n){e.preventDefault(),this.stopAutoStep(),this.step(e,n,"handler");let i=()=>{this.step(e,n,"handler"),this.autoStepTimer=setTimeout(i,ro);};this.autoStepTimer=setTimeout(i,ao);}onKeyDown(e){switch(e.keyCode){case 38:e.preventDefault(),this.nzKeyboard()&&this.step(e,true,"keyboard");break;case 40:e.preventDefault(),this.nzKeyboard()&&this.step(e,false,"keyboard");break;case 13:this.fixValue();break}}onInput(e){this.setValueByTyping(e);}onWheel(e){this.finalDisabled()||this.nzReadOnly()||!this.nzChangeOnWheel()||(e.preventDefault(),this.step(e,e.deltaY<0,"wheel"));}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=QE({type:t,selectors:[["nz-input-number"]],contentQueries:function(n,i,o){n&1&&Eh(o,i.prefix,yf,5)(o,i.suffix,bf,5)(o,i.addonBefore,_f,5)(o,i.addonAfter,$f,5),n&2&&GD(4);},viewQuery:function(n,i){n&1&&Dh(i.inputRef,yi,5)(i.hostRef,Mi,5),n&2&&GD(2);},hostVars:2,hostBindings:function(n,i){n&1&&gh("keydown",function(d){return i.onKeyDown(d)}),n&2&&cw(i.class());},inputs:{nzId:[1,"nzId"],nzSize:[1,"nzSize"],nzPlaceHolder:[1,"nzPlaceHolder"],nzStatus:[1,"nzStatus"],nzVariant:[1,"nzVariant"],nzStep:[1,"nzStep"],nzMin:[1,"nzMin"],nzMax:[1,"nzMax"],nzPrecision:[1,"nzPrecision"],nzParser:[1,"nzParser"],nzFormatter:[1,"nzFormatter"],nzDisabled:[1,"nzDisabled"],nzReadOnly:[1,"nzReadOnly"],nzAutoFocus:[1,"nzAutoFocus"],nzKeyboard:[1,"nzKeyboard"],nzControls:[1,"nzControls"],nzChangeOnWheel:[1,"nzChangeOnWheel"],nzPrefix:[1,"nzPrefix"],nzSuffix:[1,"nzSuffix"],nzAddonBefore:[1,"nzAddonBefore"],nzAddonAfter:[1,"nzAddonAfter"]},outputs:{nzBlur:"nzBlur",nzFocus:"nzFocus",nzOnStep:"nzOnStep"},exportAs:["nzInputNumber"],features:[Sw([{provide:h1,useExisting:wo$1(()=>t),multi:true},{provide:B1,useValue:"input-number"}]),rD([R4])],ngContentSelectors:Ni,decls:13,vars:1,consts:[["inputNumberWithAddonInner",""],["inputNumberWithAffix",""],["inputNumberWithAffixInner",""],["inputNumber",""],["inputNumberInner",""],["inputNumberHost",""],["input",""],["handlers",""],[3,"ngTemplateOutlet"],[1,"ant-input-number-wrapper","ant-input-number-group"],[1,"ant-input-number-group-addon"],[1,"ant-input-number-prefix"],[1,"ant-input-number-suffix"],[3,"status"],[1,"ant-input-number-handler-wrap"],[1,"ant-input-number-input-wrap"],["autocomplete","off","role","spinbutton",1,"ant-input-number-input",3,"input","wheel","value","placeholder","disabled","readOnly"],[1,"ant-input-number-handler-wrap",3,"mouseup","mouseleave"],["role","button","unselectable","on",1,"ant-input-number-handler","ant-input-number-handler-up",3,"mousedown"],["role","button","unselectable","on",1,"ant-input-number-handler","ant-input-number-handler-down",3,"mousedown"],["nzType","up",1,"ant-input-number-handler-up-inner"],["nzType","down",1,"ant-input-number-handler-down-inner"]],template:function(n,i){n&1&&(BD(Ti),bD(0,Ei,1,1,null,8)(1,Ai,1,1,null,8)(2,Fi,1,1,null,8),nh(3,Ri,5,3,"ng-template",null,0,Lw)(5,Hi,2,3,"ng-template",null,1,Lw)(7,Ji,3,3,"ng-template",null,2,Lw)(9,eo,3,3,"ng-template",null,3,Lw)(11,oo,4,10,"ng-template",null,4,Lw)),n&2&&_D(i.hasAddon()?0:i.hasAffix()?1:2);},dependencies:[pt,Se$1,va,es],encapsulation:2})}return t})(),ro=200,ao=600;function Nn(t){let l=t.trim().replace(/,/g,"").replace(/。/g,".");return l.length?+l:NaN}function gt(t,l,e){return t>=l&&t<=e}function kn(t,l,e,n=null){if(n===null)return t<l?l:t>e?e:t;let i=+t.toFixed(n),o=Math.pow(10,n);return i<l?Math.ceil(l*o)/o:i>e?Math.floor(e*o)/o:i}function En(t){return t.toString().split(".")[1]?.length||0}function lo(t){return /[.。](\d*0)?$/.test(t.toString())}var In=(()=>{class t{static \u0275fac=function(n){return new(n||t)};static \u0275mod=YE({type:t});static \u0275inj=uu({imports:[xt]})}return t})();function po(t,l){if(t&1){let e=LD();_i$1(0,"div",1)(1,"input",3),Vh("ngModelChange",function(i){let o=Pu(e).$implicit;return ww(o.key,i)||(o.key=i),Lu(i)}),gh("ngModelChange",function(){Pu(e);let i=VD();return Lu(i.emitRows())}),Kc(),oE(),_i$1(2,"input",4),Vh("ngModelChange",function(i){let o=Pu(e).$implicit;return ww(o.value,i)||(o.value=i),Lu(i)}),gh("ngModelChange",function(){Pu(e);let i=VD();return Lu(i.emitRows())}),Kc(),oE(),_i$1(3,"button",5),gh("click",function(){let i=Pu(e).$index,o=VD();return Lu(o.remove(i))}),vw(4,"Remove"),Kc()();}if(t&2){let e=l.$implicit;gI(),jh("ngModel",e.key),sE(),gI(),jh("ngModel",e.value),sE();}}var $n=(()=>{class t{constructor(){this.rows=U0.required();}add(){this.rows.update(e=>[...e,{key:"",value:""}]);}remove(e){this.rows.update(n=>n.filter((i,o)=>o!==e));}emitRows(){this.rows.set(this.rows().map(e=>r({},e)));}static{this.\u0275fac=function(n){return new(n||t)};}static{this.\u0275cmp=QE({type:t,selectors:[["app-key-value-editor"]],inputs:{rows:[1,"rows"]},outputs:{rows:"rowsChange"},decls:5,vars:0,consts:[[1,"kv-editor"],[1,"kv-row"],["nz-button","","nzType","dashed","type","button",3,"click"],["nz-input","","placeholder","key",3,"ngModelChange","ngModel"],["nz-input","","placeholder","value",3,"ngModelChange","ngModel"],["nz-button","","nzType","default","type","button",3,"click"]],template:function(n,i){n&1&&(_i$1(0,"div",0),ND(1,po,5,2,"div",1,MD),_i$1(3,"button",2),gh("click",function(){return i.add()}),vw(4,"Add param"),Kc()()),n&2&&(gI(),xD(i.rows()));},dependencies:[n8,S4,J6,k3,sd,zc,t7,y7,uk,Ie$1],styles:[".kv-editor[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.kv-row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr auto;gap:.5rem;align-items:center}"]});}}return t})();function Qe(t,l){let e=px(t);return B(l,e).map(n=>n.id)}function Ln(t,l){return Qe(t,l)[0]??""}function Bn(t,l,e){let n=Qe(l,e);if(n.includes(t))return null;let i=(e?.providerInstances??[]).find(o=>o.id===t);return i?jx(i)&&px(l).includes(i.subjectType)?null:{required:t,active:n[0]??i.id}:{required:t,active:n[0]??""}}function On(t,l,e){if(t.extendedAction?.providerId){let n=Bn(t.extendedAction.providerId,l,e);if(n)return n}return t.target?.source?Bn(t.target.source,t.target.subjectType,e):null}function jn(t){return t.extendedAction!=null}var mo=()=>[];function uo(t,l){return this.trackKey(l)}var ht=(t,l)=>l.id,fo=(t,l)=>l.actionId,Co=(t,l)=>l.name;function go(t,l){if(t&1&&(lh(0,"nz-option",15),Rw(1,"transloco")),t&2){let e=l.$implicit,n=VD(3);ch("nzValue",e)("nzLabel",Ow(1,2,n.stepTypeKey(e)));}}function xo(t,l){if(t&1&&(lh(0,"nz-option",15),Rw(1,"transloco")),t&2){let e=l.$implicit,n=VD(4);ch("nzValue",e)("nzLabel",Ow(1,2,n.outputFormatKey(e)));}}function ho(t,l){if(t&1&&lh(0,"nz-option",15),t&2){let e=l.$implicit;ch("nzValue",e.id)("nzLabel",e.displayName);}}function zo(t,l){if(t&1){let e=LD();_i$1(0,"label",16)(1,"span"),vw(2),Rw(3,"transloco"),Kc(),_i$1(4,"textarea",20),gh("ngModelChange",function(i){Pu(e);let o=VD(2).$index,d=VD();return Lu(d.patchAt(o,{objective:i}))}),Kc(),oE(),Kc(),_i$1(5,"div",16)(6,"span"),vw(7),Rw(8,"transloco"),Kc(),_i$1(9,"nz-select",21),gh("ngModelChange",function(i){Pu(e);let o=VD(2).$index,d=VD();return Lu(d.patchAt(o,{outputFormat:i}))}),ND(10,xo,2,4,"nz-option",15,SD),Kc(),oE(),Kc(),_i$1(12,"div",16)(13,"span"),vw(14),Rw(15,"transloco"),Kc(),_i$1(16,"nz-select",21),gh("ngModelChange",function(i){Pu(e);let o=VD(2).$index,d=VD();return Lu(d.setAgentInstance(o,i))}),lh(17,"nz-option",15),Rw(18,"transloco"),ND(19,ho,1,2,"nz-option",15,ht),Kc(),oE(),Kc();}if(t&2){let e=VD(2),n=e.$implicit,i=e.$index,o=VD();gI(),ah("data-testid","agent-prompt-label-"+i),gI(),Ph(Ow(3,12,"step-list.objective")),gI(2),ch("ngModel",o.asAgent(n).objective),ah("data-testid","agent-objective-"+i),sE(),gI(3),Ph(Ow(8,14,"step-list.outputFormat.label")),gI(2),ch("ngModel",o.asAgent(n).outputFormat),ah("data-testid","agent-output-"+i),sE(),gI(),xD(o.outputFormats),gI(4),Ph(Ow(15,16,"step-list.agentInstance.label")),gI(2),ch("ngModel",o.asAgent(n).agentInstanceId??null),ah("data-testid","agent-instance-"+i),sE(),gI(),ch("nzValue",null)("nzLabel",Ow(18,18,"step-list.agentInstance.default")),gI(2),xD(o.agentInstanceOptions());}}function vo(t,l){if(t&1&&(lh(0,"nz-option",15),Rw(1,"transloco")),t&2){let e=l.$implicit,n=VD(4);ch("nzValue",e)("nzLabel",Ow(1,2,n.interactionKey(e)));}}function bo(t,l){if(t&1){let e=LD();_i$1(0,"div",16)(1,"span"),vw(2),Rw(3,"transloco"),Kc(),_i$1(4,"nz-select",21),gh("ngModelChange",function(i){Pu(e);let o=VD(2).$index,d=VD();return Lu(d.patchAt(o,{interaction:i}))}),ND(5,vo,2,4,"nz-option",15,SD),Kc(),oE(),Kc();}if(t&2){let e=VD(2),n=e.$implicit,i=e.$index,o=VD();gI(2),Ph(Ow(3,3,"step-list.interaction.label")),gI(2),ch("ngModel",o.asInteraction(n).interaction),ah("data-testid","interaction-type-"+i),sE(),gI(),xD(o.interactions);}}function wo(t,l){if(t&1){let e=LD();_i$1(0,"label",16)(1,"span"),vw(2),Rw(3,"transloco"),Kc(),_i$1(4,"textarea",20),gh("ngModelChange",function(i){Pu(e);let o=VD(2).$index,d=VD();return Lu(d.patchAt(o,{command:i}))}),Kc(),oE(),Kc();}if(t&2){let e=VD(2),n=e.$implicit,i=e.$index,o=VD();gI(2),Ph(Ow(3,3,"step-list.command")),gI(2),ch("ngModel",o.asShell(n).command),ah("data-testid","shell-command-"+i),sE();}}function So(t,l){if(t&1&&(lh(0,"nz-option",15),Rw(1,"transloco")),t&2){let e=l.$implicit,n=VD(4);ch("nzValue",e)("nzLabel",Ow(1,2,n.gitOperationKey(e)));}}function yo(t,l){if(t&1){let e=LD();_i$1(0,"div",16)(1,"span"),vw(2),Rw(3,"transloco"),Kc(),_i$1(4,"nz-select",21),gh("ngModelChange",function(i){Pu(e);let o=VD(2).$index,d=VD();return Lu(d.patchAt(o,{operation:i}))}),ND(5,So,2,4,"nz-option",15,SD),Kc(),oE(),Kc(),_i$1(7,"div",16)(8,"span"),vw(9),Rw(10,"transloco"),Kc(),_i$1(11,"app-key-value-editor",22),gh("rowsChange",function(i){Pu(e);let o=VD(2),d=o.$implicit,E=o.$index,K=VD();return Lu(K.onParamRowsChange(E,d,i))}),Kc()();}if(t&2){let e=VD(2),n=e.$implicit,i=e.$index,o=VD();gI(2),Ph(Ow(3,5,"step-list.operation")),gI(2),ch("ngModel",o.asGit(n).operation),ah("data-testid","git-operation-"+i),sE(),gI(),xD(o.gitOperations),gI(4),Ph(Ow(10,7,"step-list.params")),gI(2),ch("rows",o.paramRows(n));}}function Mo(t,l){if(t&1&&lh(0,"nz-alert",23),t&2){let e=VD(3).$index;ch("nzMessage",l),ah("data-testid","extended-action-mismatch-"+e);}}function To(t,l){if(t&1&&(lh(0,"nz-option",15),Rw(1,"transloco")),t&2){let e=l.$implicit,n=VD(5);ch("nzValue",e)("nzLabel",Ow(1,2,n.subjectTypeKey(e)));}}function No(t,l){if(t&1&&lh(0,"nz-option",15),t&2){let e=l.$implicit;ch("nzValue",e.id)("nzLabel",e.displayName);}}function ko(t,l){if(t&1){let e=LD();_i$1(0,"div",16)(1,"span"),vw(2),Rw(3,"transloco"),Kc(),_i$1(4,"nz-select",21),gh("ngModelChange",function(i){Pu(e);let o=VD(3).$index,d=VD();return Lu(d.setTargetSubjectType(o,i))}),ND(5,To,2,4,"nz-option",15,SD),Kc(),oE(),Kc(),_i$1(7,"div",16)(8,"span"),vw(9),Rw(10,"transloco"),Kc(),_i$1(11,"nz-select",27),Rw(12,"transloco"),gh("ngModelChange",function(i){Pu(e);let o=VD(3).$index,d=VD();return Lu(d.setTargetSource(o,i))}),ND(13,No,1,2,"nz-option",15,ht),Kc(),oE(),Kc(),_i$1(15,"label",16)(16,"span"),vw(17),Rw(18,"transloco"),Kc(),_i$1(19,"input",18),gh("ngModelChange",function(i){Pu(e);let o=VD(3).$index,d=VD();return Lu(d.setTargetSubjectId(o,i))}),Kc(),oE(),_i$1(20,"span",19),vw(21),Rw(22,"transloco"),Kc()();}if(t&2){let e=l,n=VD(3),i=n.$implicit,o=n.$index,d=VD();gI(2),Ph(Ow(3,11,"step-list.target.subjectType")),gI(2),ch("ngModel",e.subjectType),ah("data-testid","provider-action-target-type-"+o),sE(),gI(),xD(d.targetSubjectTypes),gI(4),Ph(Ow(10,13,"step-list.target.source")),gI(2),ch("ngModel",e.source||null)("nzPlaceHolder",Ow(12,15,"step-list.target.sourcePlaceholder")),ah("data-testid","provider-action-target-source-"+o),sE(),gI(2),xD(d.targetInstanceOptions(d.asProvider(i))),gI(4),Ph(Ow(18,17,"step-list.target.subjectId")),gI(2),ch("ngModel",e.subjectId),ah("data-testid","provider-action-target-id-"+o),sE(),gI(2),Ph(Ow(22,19,"step-list.target.subjectIdHint"));}}function Eo(t,l){if(t&1&&lh(0,"nz-option",15),t&2){let e=l.$implicit,n=VD(5);ch("nzValue",e)("nzLabel",n.providerLabel(e));}}function Io(t,l){if(t&1&&lh(0,"nz-option",15),t&2){let e=l.$implicit;ch("nzValue",e.actionId)("nzLabel",e.label);}}function Ao(t,l){t&1&&(_i$1(0,"span",19),vw(1),Rw(2,"transloco"),Kc()),t&2&&(gI(),Ph(Ow(2,1,"step-list.extendedAction.empty")));}function Vo(t,l){t&1&&(_i$1(0,"span",28),vw(1,"*"),Kc());}function Fo(t,l){if(t&1&&lh(0,"nz-option",15),t&2){let e=l.$implicit;ch("nzValue",e)("nzLabel",e);}}function Do(t,l){if(t&1){let e=LD();_i$1(0,"nz-select",21),gh("ngModelChange",function(i){Pu(e);let o=VD().$implicit,d=VD(5).$index,E=VD();return Lu(E.setExtendedParam(d,o.name,i))}),ND(1,Fo,1,2,"nz-option",15,SD),Kc(),oE();}if(t&2){let e=VD().$implicit,n=VD(5),i=n.$implicit,o=n.$index,d=VD();ch("ngModel",d.extendedParamValue(d.asProvider(i),e.name)),ah("data-testid","extended-action-param-"+e.name+"-"+o),sE(),gI(),xD(e.options??Nw(2,mo));}}function Po(t,l){if(t&1){let e=LD();_i$1(0,"input",18),gh("ngModelChange",function(i){Pu(e);let o=VD().$implicit,d=VD(5).$index,E=VD();return Lu(E.setExtendedParam(d,o.name,i))}),Kc(),oE();}if(t&2){let e=VD().$implicit,n=VD(5),i=n.$implicit,o=n.$index,d=VD();ch("ngModel",d.extendedParamValue(d.asProvider(i),e.name)),ah("data-testid","extended-action-param-"+e.name+"-"+o),sE();}}function $o(t,l){if(t&1&&(_i$1(0,"label",16)(1,"span"),vw(2),bD(3,Vo,2,0,"span",28),Kc(),bD(4,Do,3,3,"nz-select",29)(5,Po,1,2,"input",30),Kc()),t&2){let e=l.$implicit;gI(2),nl$1(" ",e.label," "),gI(),_D(e.required?3:-1),gI(),_D(e.type==="select"?4:5);}}function Bo(t,l){t&1&&ND(0,$o,6,3,"label",16,Co),t&2&&xD(l.params);}function Lo(t,l){if(t&1){let e=LD();_i$1(0,"div",16)(1,"span"),vw(2),Rw(3,"transloco"),Kc(),_i$1(4,"nz-select",21),gh("ngModelChange",function(i){Pu(e);let o=VD(3).$index,d=VD();return Lu(d.setExtendedProvider(o,i))}),ND(5,Eo,1,2,"nz-option",15,SD),Kc(),oE(),Kc(),_i$1(7,"div",16)(8,"span"),vw(9),Rw(10,"transloco"),Kc(),_i$1(11,"nz-select",27),Rw(12,"transloco"),gh("ngModelChange",function(i){Pu(e);let o=VD(3).$index,d=VD();return Lu(d.setExtendedAction(o,i))}),ND(13,Io,1,2,"nz-option",15,fo),Kc(),oE(),bD(15,Ao,3,3,"span",19),Kc(),bD(16,Bo,2,0);}if(t&2){let e,n=VD(3),i=n.$implicit,o=n.$index,d=VD();gI(2),Ph(Ow(3,9,"step-list.extendedAction.provider")),gI(2),ch("ngModel",d.asProvider(i).extendedAction?.providerId),ah("data-testid","extended-action-provider-"+o),sE(),gI(),xD(d.extendedProviderOptions()),gI(4),Ph(Ow(10,11,"step-list.extendedAction.action")),gI(2),ch("ngModel",d.asProvider(i).extendedAction?.actionId||null)("nzPlaceHolder",Ow(12,13,"step-list.extendedAction.none")),ah("data-testid","extended-action-id-"+o),sE(),gI(2),xD(d.extendedDescriptors(d.asProvider(i))),gI(2),_D(d.extendedDescriptors(d.asProvider(i)).length===0?15:-1),gI(),_D((e=d.selectedExtendedDescriptor(d.asProvider(i)))?16:-1,e);}}function Oo(t,l){if(t&1&&(lh(0,"nz-option",15),Rw(1,"transloco")),t&2){let e=l.$implicit,n=VD(5);ch("nzValue",e)("nzLabel",Ow(1,2,n.providerActionKey(e)));}}function jo(t,l){if(t&1){let e=LD();_i$1(0,"div",16)(1,"span"),vw(2),Rw(3,"transloco"),Kc(),_i$1(4,"nz-select",21),gh("ngModelChange",function(i){Pu(e);let o=VD(3).$index,d=VD();return Lu(d.patchAt(o,{action:i}))}),ND(5,Oo,2,4,"nz-option",15,SD),Kc(),oE(),Kc(),_i$1(7,"div",16)(8,"span"),vw(9),Rw(10,"transloco"),Kc(),_i$1(11,"app-key-value-editor",22),gh("rowsChange",function(i){Pu(e);let o=VD(3),d=o.$implicit,E=o.$index,K=VD();return Lu(K.onParamRowsChange(E,d,i))}),Kc()();}if(t&2){let e=VD(3),n=e.$implicit,i=e.$index,o=VD();gI(2),Ph(Ow(3,5,"step-list.action")),gI(2),ch("ngModel",o.asProvider(n).action),ah("data-testid","provider-action-"+i),sE(),gI(),xD(o.providerActions),gI(4),Ph(Ow(10,7,"step-list.params")),gI(2),ch("rows",o.paramRows(n));}}function Wo(t,l){if(t&1){let e=LD();bD(0,Mo,1,2,"nz-alert",23),_i$1(1,"label",24),gh("ngModelChange",function(i){Pu(e);let o=VD(2).$index,d=VD();return Lu(d.setTargetEnabled(o,i))}),vw(2),Rw(3,"transloco"),Kc(),oE(),bD(4,ko,23,21),_i$1(5,"div",16)(6,"span"),vw(7),Rw(8,"transloco"),Kc(),_i$1(9,"nz-select",21),gh("ngModelChange",function(i){Pu(e);let o=VD(2).$index,d=VD();return Lu(d.setActionMode(o,i))}),lh(10,"nz-option",25),Rw(11,"transloco"),lh(12,"nz-option",26),Rw(13,"transloco"),Kc(),oE(),Kc(),bD(14,Lo,17,15)(15,jo,12,9);}if(t&2){let e,n,i=VD(2),o=i.$implicit,d=i.$index,E=VD();_D((e=E.mismatchWarning(E.asProvider(o)))?0:-1,e),gI(),ch("ngModel",E.hasTarget(o)),ah("data-testid","provider-action-target-toggle-"+d),sE(),gI(),nl$1(" ",Ow(3,11,"step-list.target.toggle")," "),gI(2),_D((n=E.asProvider(o).target)?4:-1,n),gI(3),Ph(Ow(8,13,"step-list.extendedAction.mode")),gI(2),ch("ngModel",E.isExtended(o)?"extended":"portable"),ah("data-testid","provider-action-mode-"+d),sE(),gI(),ch("nzLabel",Ow(11,15,"step-list.extendedAction.portable")),gI(2),ch("nzLabel",Ow(13,17,"step-list.extendedAction.extended")),gI(2),_D(E.isExtended(o)?14:15);}}function Ro(t,l){if(t&1&&lh(0,"nz-option",15),t&2){let e=l.$implicit,n=VD(4);ch("nzValue",e.id)("nzLabel",n.workflowOptionLabel(e));}}function Ko(t,l){if(t&1){let e=LD();_i$1(0,"div",16)(1,"span"),vw(2),Rw(3,"transloco"),Kc(),_i$1(4,"nz-select",31),gh("ngModelChange",function(i){Pu(e);let o=VD(2).$index,d=VD();return Lu(d.patchAt(o,{workflowId:i}))}),ND(5,Ro,1,2,"nz-option",15,ht),Kc(),oE(),Kc(),_i$1(7,"p",16)(8,"span"),vw(9),Rw(10,"transloco"),Kc(),_i$1(11,"code",32),vw(12,"selection"),Kc()();}if(t&2){let e=VD(2),n=e.$implicit,i=e.$index,o=VD();gI(2),Ph(Ow(3,4,"step-list.workflowId")),gI(2),ch("ngModel",o.asSubWorkflow(n).workflowId),ah("data-testid","sub-workflow-id-"+i),sE(),gI(),xD(o.availableWorkflows()),gI(4),Ph(Ow(10,6,"step-list.forEach"));}}function Ho(t,l){if(t&1&&(lh(0,"nz-option",15),Rw(1,"transloco")),t&2){let e=l.$implicit,n=VD(4);ch("nzValue",e)("nzLabel",Ow(1,2,n.untilTypeKey(e)));}}function qo(t,l){if(t&1){let e=LD();_i$1(0,"label",16)(1,"span"),vw(2),Rw(3,"transloco"),Kc(),_i$1(4,"input",18),gh("ngModelChange",function(i){Pu(e);let o=VD(3).$index,d=VD();return Lu(d.setUntilValue(o,i))}),Kc(),oE(),Kc();}if(t&2){let e=VD(3),n=e.$implicit,i=e.$index,o=VD();gI(2),Ph(Ow(3,3,"step-list.until.value")),gI(2),ch("ngModel",o.untilValue(o.asLoop(n))),ah("data-testid","loop-until-value-"+i),sE();}}function Uo(t,l){if(t&1&&(lh(0,"nz-option",15),Rw(1,"transloco")),t&2){let e=l.$implicit,n=VD(4);ch("nzValue",e)("nzLabel",Ow(1,2,n.onMaxIterationsKey(e)));}}function Go(t,l){if(t&1){let e=LD();_i$1(0,"div",33)(1,"div",16)(2,"span"),vw(3),Rw(4,"transloco"),Kc(),_i$1(5,"nz-select",21),gh("ngModelChange",function(i){Pu(e);let o=VD(2).$index,d=VD();return Lu(d.setUntilType(o,i))}),ND(6,Ho,2,4,"nz-option",15,SD),Kc(),oE(),Kc(),_i$1(8,"label",16)(9,"span"),vw(10),Rw(11,"transloco"),Kc(),_i$1(12,"input",18),gh("ngModelChange",function(i){Pu(e);let o=VD(2).$index,d=VD();return Lu(d.setUntilField(o,"stepId",i))}),Kc(),oE(),Kc(),_i$1(13,"label",16)(14,"span"),vw(15),Rw(16,"transloco"),Kc(),_i$1(17,"input",18),gh("ngModelChange",function(i){Pu(e);let o=VD(2).$index,d=VD();return Lu(d.setUntilField(o,"field",i))}),Kc(),oE(),Kc(),bD(18,qo,5,5,"label",16),_i$1(19,"label",16)(20,"span"),vw(21),Rw(22,"transloco"),Kc(),_i$1(23,"nz-input-number",34),gh("ngModelChange",function(i){Pu(e);let o=VD(2).$index,d=VD();return Lu(d.patchAt(o,{maxIterations:i??0}))}),Kc(),oE(),Kc(),_i$1(24,"div",16)(25,"span"),vw(26),Rw(27,"transloco"),Kc(),_i$1(28,"nz-select",21),gh("ngModelChange",function(i){Pu(e);let o=VD(2).$index,d=VD();return Lu(d.patchAt(o,{onMaxIterations:{action:i}}))}),ND(29,Uo,2,4,"nz-option",15,SD),Kc(),oE(),Kc()(),_i$1(31,"div",35)(32,"h4"),vw(33),Rw(34,"transloco"),Kc(),_i$1(35,"app-step-list",36),gh("stepsChange",function(i){Pu(e);let o=VD(2).$index,d=VD();return Lu(d.setNestedSteps(o,i))}),Kc()();}if(t&2){let e=VD(2),n=e.$implicit,i=e.$index,o=VD();gI(3),Ph(Ow(4,25,"step-list.until.type")),gI(2),ch("ngModel",o.asLoop(n).until.type),ah("data-testid","loop-until-type-"+i),sE(),gI(),xD(o.untilTypes),gI(4),Ph(Ow(11,27,"step-list.until.stepId")),gI(2),ch("ngModel",o.asLoop(n).until.stepId),ah("data-testid","loop-until-stepId-"+i),sE(),gI(3),Ph(Ow(16,29,"step-list.until.field")),gI(2),ch("ngModel",o.asLoop(n).until.field),ah("data-testid","loop-until-field-"+i),sE(),gI(),_D(o.asLoop(n).until.type==="field_equals"?18:-1),gI(3),Ph(Ow(22,31,"step-list.maxIterations")),gI(2),ch("ngModel",o.asLoop(n).maxIterations)("nzMin",0),ah("data-testid","loop-max-"+i),sE(),gI(3),Ph(Ow(27,33,"step-list.onMaxIterations.action")),gI(2),ch("ngModel",o.asLoop(n).onMaxIterations.action),ah("data-testid","loop-on-max-"+i),sE(),gI(),xD(o.maxIterationActions),gI(2),ah("data-testid","loop-nested-"+i),gI(2),Ph(Ow(34,35,"step-list.nestedSteps")),gI(2),ch("steps",o.asLoop(n).steps)("rootSteps",o.effectiveRoot())("availableWorkflows",o.availableWorkflows())("appliesTo",o.appliesTo())("settings",o.settings())("depth",o.depth()+1);}}function Qo(t,l){if(t&1){let e=LD();_i$1(0,"div",12)(1,"div",13)(2,"nz-select",14),gh("ngModelChange",function(i){Pu(e);let o=VD().$index,d=VD();return Lu(d.changeType(o,i))}),ND(3,go,2,4,"nz-option",15,SD),Kc(),oE(),Kc(),_i$1(5,"label",16)(6,"span"),vw(7),Rw(8,"transloco"),Kc(),_i$1(9,"input",17),gh("ngModelChange",function(i){Pu(e);let o=VD().$index,d=VD();return Lu(d.onNameChange(o,i))}),Kc(),oE(),Kc(),_i$1(10,"label",16)(11,"span"),vw(12),Rw(13,"transloco"),Kc(),_i$1(14,"input",18),gh("ngModelChange",function(i){Pu(e);let o=VD().$index,d=VD();return Lu(d.onIdChange(o,i))}),Kc(),oE(),_i$1(15,"p",19),vw(16),Rw(17,"transloco"),Kc()(),bD(18,zo,21,20)(19,bo,7,5,"div",16)(20,wo,5,5,"label",16)(21,yo,12,9)(22,Wo,16,19)(23,Ko,13,8)(24,Go,36,37),Kc();}if(t&2){let e,n=VD(),i=n.$implicit,o=n.$index,d=VD();ah("data-testid","step-body-"+o),gI(2),ch("ngModel",i.type),ah("data-testid","step-type-"+o),sE(),gI(),xD(d.stepTypes),gI(4),Ph(Ow(8,11,"step-list.name")),gI(2),ch("ngModel",i.name),ah("data-testid","step-name-"+o),sE(),gI(3),Ph(Ow(13,13,"step-list.id")),gI(2),ch("ngModel",i.id),ah("data-testid","step-id-"+o),sE(),gI(2),Ph(Ow(17,15,"step-list.idHint")),gI(2),_D((e=i.type)==="agent"?18:e==="interaction"?19:e==="shell"?20:e==="git"?21:e==="provider_action"?22:e==="sub_workflow"?23:e==="loop"?24:-1);}}function Zo(t,l){if(t&1){let e=LD();_i$1(0,"nz-card",3)(1,"div",4),gh("click",function(){let i=Pu(e).$implicit,o=VD();return Lu(o.toggleExpanded(i))}),_i$1(2,"div",5)(3,"span",6),vw(4),Kc(),_i$1(5,"span",7),vw(6),Rw(7,"transloco"),Kc(),_i$1(8,"span",8),vw(9),Rw(10,"transloco"),Kc()(),_i$1(11,"div",9),gh("click",function(i){return i.stopPropagation()}),_i$1(12,"button",10),gh("click",function(){let i=Pu(e).$index,o=VD();return Lu(o.moveUp(i))}),vw(13),Rw(14,"transloco"),Kc(),_i$1(15,"button",10),gh("click",function(){let i=Pu(e).$index,o=VD();return Lu(o.moveDown(i))}),vw(16),Rw(17,"transloco"),Kc(),_i$1(18,"button",11),gh("click",function(){let i=Pu(e).$index,o=VD();return Lu(o.removeStep(i))}),vw(19),Rw(20,"transloco"),Kc()()(),bD(21,Qo,25,17,"div",12),Kc();}if(t&2){let e=l.$implicit,n=l.$index,i=VD();Mh("step-card-expanded",i.isExpanded(e)),ah("data-testid","step-card-"+n),gI(),ah("data-testid","step-header-"+n),gI(3),Ph(i.isExpanded(e)?"\u25BE":"\u25B8"),gI(),ah("data-testid","step-header-name-"+n),gI(),nl$1(" ",e.name||Ow(7,18,"step-list.unnamed")," "),gI(2),ah("data-testid","step-type-label-"+n),gI(),nl$1(" ",Ow(10,20,i.stepTypeKey(e.type))," "),gI(3),ch("disabled",n===0),ah("data-testid","move-up-"+n),gI(),nl$1(" ",Ow(14,22,"step-list.moveUp")," "),gI(2),ch("disabled",n===i.steps().length-1),ah("data-testid","move-down-"+n),gI(),nl$1(" ",Ow(17,24,"step-list.moveDown")," "),gI(2),ah("data-testid","remove-"+n),gI(),nl$1(" ",Ow(20,26,"step-list.remove")," "),gI(2),_D(i.isExpanded(e)?21:-1);}}var Wn=(()=>{class t{constructor(){this.transloco=C(Ve),this.language=C(O),this.providersApi=C($$1),this.steps=$0.required(),this.rootSteps=$0([]),this.availableWorkflows=$0([]),this.appliesTo=$0("none"),this.settings=$0(Dx),this.depth=$0(0),this.stepsChange=B0(),this.stepTypes=y,this.outputFormats=["questionnaire","confirmation","comment_suggestions","free_text"],this.interactions=["questionnaire","confirmation"],this.gitOperations=["create_worktree","checkout","create_branch","commit","push"],this.providerActions=["get_subject","get_comments","post_comment","update_status","get_content"],this.untilTypes=["field_empty","field_equals"],this.maxIterationActions=["fail","continue","ask_human"],this.expandedKey=qo$1(null),this.paramRowsByStepKey=new Map,this.actionsByProvider=new Map,this.loadingActions=new Set,this.targetSubjectTypes=F,rd(()=>{for(let e of this.steps())e.type==="provider_action"&&e.extendedAction?.providerId&&this.ensureActionsLoaded(e.extendedAction.providerId);});}stepTypeKey(e){return `step-list.stepType.${e}`}outputFormatKey(e){return `step-list.outputFormat.${e}`}interactionKey(e){return `step-list.interaction.${e}`}gitOperationKey(e){return `step-list.gitOperation.${e}`}providerActionKey(e){return `step-list.providerAction.${e}`}untilTypeKey(e){return `step-list.untilType.${e}`}onMaxIterationsKey(e){return `step-list.onMaxIterations.${e}`}workflowOptionLabel(e){return this.language.currentLang(),this.transloco.translate("step-list.workflowOption",{name:e.name,id:e.id})}effectiveRoot(){let e=this.rootSteps();return e.length>0?e:this.steps()}trackKey(e){return e._key}isExpanded(e){return this.expandedKey()===e._key}toggleExpanded(e){this.expandedKey.update(n=>n===e._key?null:e._key);}addStep(){this.emit([...this.steps(),h("agent")]);}removeStep(e){let n=this.steps()[e];n&&this.paramRowsByStepKey.delete(n._key),this.emit(this.steps().filter((i,o)=>o!==e));}moveUp(e){if(e<=0)return;let n=[...this.steps()],i=n[e-1];n[e-1]=n[e],n[e]=i,this.emit(n);}moveDown(e){if(e>=this.steps().length-1)return;let n=[...this.steps()],i=n[e+1];n[e+1]=n[e],n[e]=i,this.emit(n);}changeType(e,n){let i=this.steps()[e];if(!i||i.type===n)return;this.paramRowsByStepKey.delete(i._key);let o=h(n,{id:i.id,name:i.name,idAutoSync:i._idAutoSync,key:i._key});this.replaceAt(e,o);}patchAt(e,n){let i=this.steps()[e];i&&this.replaceAt(e,r(r({},i),n));}onNameChange(e,n){let i=this.steps()[e];i&&this.replaceAt(e,E(i,n,this.effectiveRoot()));}onIdChange(e,n){let i=this.steps()[e];i&&this.replaceAt(e,P(i,n));}setNestedSteps(e,n){let i=this.steps()[e];!i||i.type!=="loop"||this.replaceAt(e,s(r({},i),{steps:n}));}asAgent(e){return e}asInteraction(e){return e}asShell(e){return e}asGit(e){return e}asProvider(e){return e}asSubWorkflow(e){return e}asLoop(e){return e}paramRows(e){let n=this.paramRowsByStepKey.get(e._key);if(!n){let i=e.type==="git"||e.type==="provider_action"?e.params:void 0;n=A(i),this.paramRowsByStepKey.set(e._key,n);}return n}onParamRowsChange(e,n,i){this.paramRowsByStepKey.set(n._key,i),this.patchAt(e,{params:j(i)});}isExtended(e){return e.type==="provider_action"&&jn(this.asProvider(e))}setActionMode(e,n){let i=this.asProvider(this.steps()[e]);if(n==="portable"){let d=i,{extendedAction:E}=d,K=t$1(d,["extendedAction"]);this.replaceAt(e,K);return}let o=Ln(this.appliesTo(),this.settings());this.patchAt(e,{extendedAction:{providerId:o,actionId:"",params:{}}}),this.ensureActionsLoaded(o);}extendedProviderOptions(){return Qe(this.appliesTo(),this.settings())}providerLabel(e){return (this.settings().providerInstances??[]).find(i=>i.id===e)?.displayName||e}agentInstanceOptions(){return (this.settings().providerInstances??[]).filter(e=>e.kind==="agent")}setAgentInstance(e,n){this.patchAt(e,{agentInstanceId:n||void 0});}setExtendedProvider(e,n){this.patchAt(e,{extendedAction:{providerId:n,actionId:"",params:{}}}),this.ensureActionsLoaded(n);}setExtendedAction(e,n){let i=this.asProvider(this.steps()[e]),o=this.extendedDescriptors(i).find(d=>d.actionId===n);this.patchAt(e,{extendedAction:{providerId:i.extendedAction?.providerId??"",actionId:n,params:o?Yo(o):{}}});}setExtendedParam(e,n,i){let d=this.asProvider(this.steps()[e]).extendedAction;d&&this.patchAt(e,{extendedAction:s(r({},d),{params:s(r({},d.params??{}),{[n]:i})})});}extendedParamValue(e,n){let i=e.extendedAction?.params?.[n];return i==null?"":String(i)}extendedDescriptors(e){let n=e.extendedAction?.providerId;return n?this.actionsByProvider.get(n)??[]:[]}selectedExtendedDescriptor(e){let n=e.extendedAction?.actionId;if(n)return this.extendedDescriptors(e).find(i=>i.actionId===n)}mismatchWarning(e){let n=On(e,this.appliesTo(),this.settings());return n?(this.language.currentLang(),this.transloco.translate("step-list.extendedAction.mismatch",n)):null}hasTarget(e){return e.type==="provider_action"&&this.asProvider(e).target!=null}setTargetEnabled(e,n){let i=this.asProvider(this.steps()[e]);if(!n){let o=i,{target:d}=o,E=t$1(o,["target"]);this.replaceAt(e,E);return}this.patchAt(e,{target:{subjectType:"ticket",source:"",subjectId:""}});}setTargetSubjectType(e,n){let i=this.asProvider(this.steps()[e]);this.patchAt(e,{target:{subjectType:n,source:"",subjectId:i.target?.subjectId??""}});}setTargetSource(e,n){let i=this.asProvider(this.steps()[e]);i.target&&this.patchAt(e,{target:s(r({},i.target),{source:n})});}setTargetSubjectId(e,n){let i=this.asProvider(this.steps()[e]);i.target&&this.patchAt(e,{target:s(r({},i.target),{subjectId:n})});}targetInstanceOptions(e){let n=e.target?.subjectType;return n?B(this.settings(),[n]):[]}subjectTypeKey(e){return `workflow-editor.subjectType.${e}`}ensureActionsLoaded(e){!e||this.actionsByProvider.has(e)||this.loadingActions.has(e)||(this.loadingActions.add(e),this.providersApi.listExtendedActions(e).subscribe({next:n=>{this.loadingActions.delete(e),this.actionsByProvider.set(e,n);},error:()=>{this.loadingActions.delete(e),this.actionsByProvider.set(e,[]);}}));}setUntilType(e,n){let i=this.asLoop(this.steps()[e]);if(n==="field_empty"){this.patchAt(e,{until:{type:n,stepId:i.until.stepId,field:i.until.field}});return}let o=i.until.type==="field_equals"?i.until.value:"";this.patchAt(e,{until:{type:n,stepId:i.until.stepId,field:i.until.field,value:o}});}setUntilField(e,n,i){let o=this.asLoop(this.steps()[e]);this.patchAt(e,{until:s(r({},o.until),{[n]:i})});}setUntilValue(e,n){let i=this.asLoop(this.steps()[e]);i.until.type==="field_equals"&&this.patchAt(e,{until:s(r({},i.until),{value:n})});}untilValue(e){return e.until.type==="field_equals"?String(e.until.value??""):""}replaceAt(e,n){this.emit(this.steps().map((i,o)=>o===e?n:i));}emit(e){this.stepsChange.emit(e);}static{this.\u0275fac=function(n){return new(n||t)};}static{this.\u0275cmp=QE({type:t,selectors:[["app-step-list"]],inputs:{steps:[1,"steps"],rootSteps:[1,"rootSteps"],availableWorkflows:[1,"availableWorkflows"],appliesTo:[1,"appliesTo"],settings:[1,"settings"],depth:[1,"depth"]},outputs:{stepsChange:"stepsChange"},decls:6,vars:4,consts:[["data-testid","step-list",1,"step-list"],[1,"step-card",3,"step-card-expanded"],["nz-button","","nzType","dashed","nzBlock","","type","button","data-testid","add-step",3,"click"],[1,"step-card"],[1,"step-header",3,"click"],[1,"step-header-meta"],["aria-hidden","true",1,"step-chevron"],[1,"step-name-preview"],[1,"step-type"],[1,"step-header-actions",3,"click"],["nz-button","","type","button",3,"click","disabled"],["nz-button","","nzDanger","","type","button",3,"click"],[1,"step-body"],[1,"step-toolbar"],[1,"type-select",3,"ngModelChange","ngModel"],[3,"nzValue","nzLabel"],[1,"field"],["nz-input","","required","",3,"ngModelChange","ngModel"],["nz-input","",3,"ngModelChange","ngModel"],[1,"hint"],["nz-input","","rows","3",3,"ngModelChange","ngModel"],[3,"ngModelChange","ngModel"],[3,"rowsChange","rows"],["nzType","warning","nzShowIcon","",1,"mismatch",3,"nzMessage"],["nz-checkbox","",3,"ngModelChange","ngModel"],["nzValue","portable",3,"nzLabel"],["nzValue","extended",3,"nzLabel"],[3,"ngModelChange","ngModel","nzPlaceHolder"],[1,"required"],[3,"ngModel"],["nz-input","",3,"ngModel"],["nzShowSearch","","nzAllowClear","",3,"ngModelChange","ngModel"],["data-testid","sub-workflow-foreach"],[1,"field-grid"],[3,"ngModelChange","ngModel","nzMin"],[1,"nested"],[3,"stepsChange","steps","rootSteps","availableWorkflows","appliesTo","settings","depth"]],template:function(n,i){n&1&&(_i$1(0,"div",0),ND(1,Zo,22,28,"nz-card",1,uo,true),_i$1(3,"button",2),gh("click",function(){return i.addStep()}),vw(4),Rw(5,"transloco"),Kc()()),n&2&&(ah("data-depth",i.depth()),gI(),xD(i.steps()),gI(3),nl$1(" ",Ow(5,2,"step-list.addStep")," "));},dependencies:[t,Mi$1,n8,S4,J6,$6,k3,sd,zc,t7,y7,Ge,ze,Fe,oe,uk,Ie$1,In,xt,$b,V5,D5,Gn$1,un,$n,Kt],styles:[".step-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.75rem}.step-card[_ngcontent-%COMP%]{background:#fff}.step-header[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.75rem;cursor:pointer;-webkit-user-select:none;user-select:none}.step-header-meta[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;min-width:0}.step-chevron[_ngcontent-%COMP%]{color:#78716c;font-size:.85rem;width:.9rem}.step-type[_ngcontent-%COMP%]{font-size:.75rem;font-weight:600;letter-spacing:.02em;text-transform:uppercase;color:#57534e;background:#f5f5f4;border-radius:999px;padding:.15rem .55rem}.step-name-preview[_ngcontent-%COMP%]{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.step-header-actions[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.5rem}.step-body[_ngcontent-%COMP%]{margin-top:.75rem;padding-top:.75rem;border-top:1px solid #e7e5e4}.step-toolbar[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.5rem;margin-bottom:.75rem;align-items:center}.type-select[_ngcontent-%COMP%]{min-width:11rem}.field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem;margin:.65rem 0}.field[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{font-size:.85rem;color:#57534e}.field-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fit,minmax(12rem,1fr));gap:.5rem 1rem}.hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:#78716c}.mismatch[_ngcontent-%COMP%]{margin:.5rem 0}.required[_ngcontent-%COMP%]{color:#b91c1c}.nested[_ngcontent-%COMP%]{margin-top:.75rem;padding:.75rem;border-left:3px solid #d6d3d1;background:#fafaf9}.nested[_ngcontent-%COMP%] h4[_ngcontent-%COMP%]{margin:0 0 .5rem}"]});}}return t})();function Yo(t){let l={};for(let e of t.params)l[e.name]=e.type==="select"?e.options?.[0]??"":"";return l}var Jo=t=>({ids:t});function Xo(t,l){t&1&&(_i$1(0,"p",5),vw(1),Rw(2,"transloco"),Kc()),t&2&&(gI(),Ph(Ow(2,1,"workflow-editor.loading")));}function er(t,l){if(t&1&&(_i$1(0,"p",6),vw(1),Kc()),t&2){let e=VD();gI(),Ph(e.loadError());}}function tr(t,l){if(t&1&&(_i$1(0,"li"),vw(1),Kc()),t&2){let e=l.$implicit;gI(),Ph(e);}}function nr(t,l){if(t&1&&(_i$1(0,"section",7)(1,"h2"),vw(2),Rw(3,"transloco"),Kc(),_i$1(4,"ul"),ND(5,tr,2,1,"li",null,SD),Kc()()),t&2){let e=VD(2);gI(2),Ph(Ow(3,1,"workflow-editor.validation")),gI(3),xD(e.validationErrors());}}function ir(t,l){if(t&1&&(lh(0,"nz-option",13),Rw(1,"transloco")),t&2){let e=l.$implicit,n=VD(2);ch("nzValue",e)("nzLabel",Ow(1,2,n.subjectTypeKey(e)));}}function or(t,l){if(t&1&&(lh(0,"nz-option",15),Rw(1,"transloco")),t&2){let e=l.$implicit,n=VD(2);ch("nzValue",e)("nzLabel",Ow(1,3,n.subjectHandlingKey(e)))("nzDisabled",e==="collection"&&n.appliesToValue()==="none");}}function rr(t,l){if(t&1&&(lh(0,"nz-option",13),Rw(1,"transloco")),t&2){let e=l.$implicit,n=VD(3);ch("nzValue",e)("nzLabel",Ow(1,2,n.inputTypeKey(e)));}}function ar(t,l){if(t&1){let e=LD();_i$1(0,"div",18)(1,"label",10)(2,"span"),vw(3),Rw(4,"transloco"),Kc(),_i$1(5,"input",22),gh("ngModelChange",function(i){let o=Pu(e).$index,d=VD(2);return Lu(d.patchInputField(o,{name:i}))}),Kc(),oE(),Kc(),_i$1(6,"label",10)(7,"span"),vw(8),Rw(9,"transloco"),Kc(),_i$1(10,"input",22),gh("ngModelChange",function(i){let o=Pu(e).$index,d=VD(2);return Lu(d.patchInputField(o,{label:i}))}),Kc(),oE(),Kc(),_i$1(11,"div",10)(12,"span"),vw(13),Rw(14,"transloco"),Kc(),_i$1(15,"nz-select",23),gh("ngModelChange",function(i){let o=Pu(e).$index,d=VD(2);return Lu(d.patchInputField(o,{type:i}))}),ND(16,rr,2,4,"nz-option",13,SD),Kc(),oE(),Kc(),_i$1(18,"label",24),gh("ngModelChange",function(i){let o=Pu(e).$index,d=VD(2);return Lu(d.patchInputField(o,{required:i}))}),vw(19),Rw(20,"transloco"),Kc(),oE(),_i$1(21,"button",25),gh("click",function(){let i=Pu(e).$index,o=VD(2);return Lu(o.removeInputField(i))}),vw(22),Rw(23,"transloco"),Kc()();}if(t&2){let e=l.$implicit,n=l.$index,i=VD(2);ah("data-testid","input-field-"+n),gI(3),Ph(Ow(4,10,"workflow-editor.fieldName")),gI(2),ch("ngModel",e.name),sE(),gI(3),Ph(Ow(9,12,"workflow-editor.fieldLabel")),gI(2),ch("ngModel",e.label),sE(),gI(3),Ph(Ow(14,14,"workflow-editor.fieldType")),gI(2),ch("ngModel",e.type),sE(),gI(),xD(i.inputFieldTypes),gI(2),ch("ngModel",e.required),sE(),gI(),nl$1(" ",Ow(20,16,"workflow-editor.required")," "),gI(3),nl$1(" ",Ow(23,18,"workflow-editor.remove")," ");}}function lr(t,l){if(t&1&&(_i$1(0,"p",20),vw(1),Rw(2,"transloco"),Kc()),t&2){let e=VD(2);gI(),nl$1(" ",Pw(2,1,"workflow-editor.duplicateStepIds",xw(4,Jo,e.duplicateStepIds().join(", ")))," ");}}function sr(t,l){if(t&1){let e=LD();bD(0,nr,7,3,"section",7),_i$1(1,"nz-card",8),Rw(2,"transloco"),_i$1(3,"div",9)(4,"label",10)(5,"span"),vw(6),Rw(7,"transloco"),Kc(),_i$1(8,"input",11),gh("ngModelChange",function(i){Pu(e);let o=VD();return Lu(o.patchWorkflow({name:i}))}),Kc(),oE(),Kc(),_i$1(9,"div",10)(10,"span"),vw(11),Rw(12,"transloco"),Kc(),_i$1(13,"nz-select",12),gh("ngModelChange",function(i){Pu(e);let o=VD();return Lu(o.setAppliesTo(i))}),ND(14,ir,2,4,"nz-option",13,SD),Kc(),oE(),Kc(),_i$1(16,"div",10)(17,"span"),vw(18),Rw(19,"transloco"),Kc(),_i$1(20,"nz-select",14),gh("ngModelChange",function(i){Pu(e);let o=VD();return Lu(o.patchWorkflow({subjectHandling:i}))}),ND(21,or,2,5,"nz-option",15,SD),Kc(),oE(),_i$1(23,"p",16),vw(24),Rw(25,"transloco"),Kc()()(),_i$1(26,"label",10)(27,"span"),vw(28),Rw(29,"transloco"),Kc(),_i$1(30,"textarea",17),gh("ngModelChange",function(i){Pu(e);let o=VD();return Lu(o.patchWorkflow({description:i||void 0}))}),Kc(),oE(),Kc()(),_i$1(31,"nz-card",8),Rw(32,"transloco"),ND(33,ar,24,20,"div",18,MD),_i$1(35,"button",19),gh("click",function(){Pu(e);let i=VD();return Lu(i.addInputField())}),vw(36),Rw(37,"transloco"),Kc()(),_i$1(38,"nz-card",8),Rw(39,"transloco"),bD(40,lr,3,6,"p",20),_i$1(41,"app-step-list",21),gh("stepsChange",function(i){Pu(e);let o=VD();return Lu(o.onStepsChange(i))}),Kc()();}if(t&2){let e=VD();_D(e.validationErrors().length>0?0:-1),gI(),ch("nzTitle",Ow(2,20,"workflow-editor.basics")),gI(5),Ph(Ow(7,22,"workflow-editor.name")),gI(2),ch("ngModel",e.workflow().name),sE(),gI(3),Ph(Ow(12,24,"workflow-editor.appliesTo")),gI(2),ch("ngModel",e.appliesToValue()),sE(),gI(),xD(e.subjectTypes),gI(4),Ph(Ow(19,26,"workflow-editor.subjectHandling.label")),gI(2),ch("ngModel",e.workflow().subjectHandling),sE(),gI(),xD(e.subjectHandlingOptions),gI(3),nl$1(" ",Ow(25,28,e.subjectHandlingHelpKey())," "),gI(4),Ph(Ow(29,30,"workflow-editor.description")),gI(2),ch("ngModel",e.workflow().description??""),sE(),gI(),ch("nzTitle",Ow(32,32,"workflow-editor.inputSchema")),gI(2),xD(e.workflow().inputSchema),gI(3),nl$1(" ",Ow(37,34,"workflow-editor.addInputField")," "),gI(2),ch("nzTitle",Ow(39,36,"workflow-editor.steps")),gI(2),_D(e.duplicateStepIds().length>0?40:-1),gI(),ch("steps",e.workflow().steps)("rootSteps",e.workflow().steps)("availableWorkflows",e.availableWorkflows())("appliesTo",e.workflow().appliesTo)("settings",e.settings());}}var nl=(()=>{class t{constructor(){this.route=C(ae),this.router=C(Ie),this.workflowsApi=C(U),this.settingsApi=C($),this.message=C(Sk),this.destroyRef=C(at),this.transloco=C(Ve),this.language=C(O),this.routeId=de(this.route.paramMap.pipe(Se(e=>e.get("id"))),{initialValue:this.route.snapshot.paramMap.get("id")}),this.workflow=qo$1(I()),this.availableWorkflows=qo$1([]),this.settings=qo$1(Dx),this.loadError=qo$1(null),this.validationErrors=qo$1([]),this.duplicateStepIds=qo$1([]),this.saving=qo$1(false),this.loading=qo$1(true),this.isNew=Hw(()=>!this.routeId()),this.pageTitle=Hw(()=>(this.language.currentLang(),this.isNew()?this.transloco.translate("workflow-editor.titleNew"):this.transloco.translate("workflow-editor.titleEdit",{id:this.workflow().id||this.routeId()}))),this.subjectTypes=["none","ticket","pull_request","documentation"],this.subjectHandlingOptions=["per-subject","collection"],this.inputFieldTypes=["string","number","boolean","select"],this.workflowsApi.list().pipe(ue(this.destroyRef)).subscribe({next:e=>this.availableWorkflows.set(e),error:()=>{}}),this.settingsApi.getSettings().pipe(ue(this.destroyRef)).subscribe({next:e=>this.settings.set(e),error:()=>{}}),this.route.paramMap.pipe(ue(this.destroyRef)).subscribe(e=>{let n=e.get("id");if(this.validationErrors.set([]),this.duplicateStepIds.set([]),this.loadError.set(null),!n){this.workflow.set(I()),this.loading.set(false);return}this.loading.set(true),this.workflowsApi.get(n).subscribe({next:i=>{this.workflow.set(s(r({},structuredClone(i)),{steps:g(i.steps,{idAutoSync:false})})),this.loading.set(false);},error:i=>{this.loading.set(false),this.loadError.set(this.errorMessage(i,`Failed to load workflow ${n}`));}});});}subjectTypeKey(e){return `workflow-editor.subjectType.${e}`}subjectHandlingKey(e){return `workflow-editor.subjectHandling.${e}`}subjectHandlingHelpKey(){return `workflow-editor.subjectHandling.help.${this.workflow().subjectHandling}`}inputTypeKey(e){return `workflow-editor.inputType.${e}`}patchWorkflow(e){this.workflow.update(n=>r(r({},n),e));}setAppliesTo(e){if(e==="none"){this.patchWorkflow({appliesTo:e,subjectHandling:"per-subject"});return}this.patchWorkflow({appliesTo:e});}appliesToValue(){let e=this.workflow().appliesTo;return Array.isArray(e)?e[0]??"none":e}onStepsChange(e){this.patchWorkflow({steps:e}),this.duplicateStepIds.set(Yp(e));}addInputField(){this.patchWorkflow({inputSchema:[...this.workflow().inputSchema,b()]});}removeInputField(e){this.patchWorkflow({inputSchema:this.workflow().inputSchema.filter((n,i)=>i!==e)});}patchInputField(e,n){let i=this.workflow().inputSchema.map((o,d)=>d===e?r(r({},o),n):o);this.patchWorkflow({inputSchema:i});}save(){let e=this.workflow(),n=Yp(e.steps);if(this.duplicateStepIds.set(n),n.length>0){this.validationErrors.set([this.transloco.translate("workflow-editor.duplicateStepIds",{ids:n.join(", ")})]);return}let i=v(e,{omitWorkflowId:this.isNew()}),o=dx.safeParse(i);if(!o.success){this.validationErrors.set(T(o.error));return}this.validationErrors.set([]),this.saving.set(true);let d=o.data,E=this.routeId();(this.isNew()||!E?this.workflowsApi.create(d):this.workflowsApi.update(E,s(r({},d),{id:E}))).subscribe({next:ce=>{this.saving.set(false),this.workflow.set(s(r({},structuredClone(ce)),{steps:g(ce.steps,{idAutoSync:false})})),this.message.success(this.isNew()?"Workflow created":"Workflow saved"),this.isNew()&&this.router.navigate(["/workflows",ce.id,"edit"]);},error:ce=>{this.saving.set(false),this.message.error(this.errorMessage(ce,"Save failed"));}});}errorMessage(e,n){return e instanceof o||e instanceof Error?e.message:n}static{this.\u0275fac=function(n){return new(n||t)};}static{this.\u0275cmp=QE({type:t,selectors:[["app-workflow-editor"]],decls:15,vars:10,consts:[["data-testid","workflow-editor",1,"editor"],[1,"header"],[1,"header-actions"],["routerLink","/jobs"],["nz-button","","nzType","primary","type","button","data-testid","save-button",3,"click","nzLoading","disabled"],["data-testid","loading"],["data-testid","load-error",1,"error"],["data-testid","validation-errors",1,"errors"],[3,"nzTitle"],[1,"grid"],[1,"field"],["nz-input","","data-testid","workflow-name",3,"ngModelChange","ngModel"],["data-testid","workflow-applies-to",3,"ngModelChange","ngModel"],[3,"nzValue","nzLabel"],["data-testid","workflow-subject-handling",3,"ngModelChange","ngModel"],[3,"nzValue","nzLabel","nzDisabled"],["data-testid","workflow-subject-handling-help",1,"help"],["nz-input","","rows","2","data-testid","workflow-description",3,"ngModelChange","ngModel"],[1,"input-field-row"],["nz-button","","nzType","dashed","type","button",3,"click"],["data-testid","duplicate-step-ids",1,"error"],[3,"stepsChange","steps","rootSteps","availableWorkflows","appliesTo","settings"],["nz-input","",3,"ngModelChange","ngModel"],[3,"ngModelChange","ngModel"],["nz-checkbox","",3,"ngModelChange","ngModel"],["nz-button","","nzDanger","","type","button",3,"click"]],template:function(n,i){n&1&&(_i$1(0,"main",0)(1,"header",1)(2,"div")(3,"h1"),vw(4),Kc()(),_i$1(5,"div",2)(6,"a",3),vw(7),Rw(8,"transloco"),Kc(),_i$1(9,"button",4),gh("click",function(){return i.save()}),vw(10),Rw(11,"transloco"),Kc()()(),bD(12,Xo,3,3,"p",5)(13,er,2,1,"p",6)(14,sr,42,38),Kc()),n&2&&(gI(4),Ph(i.pageTitle()),gI(3),Ph(Ow(8,6,"workflow-editor.backToJobs")),gI(2),ch("nzLoading",i.saving())("disabled",i.loading()||!!i.loadError()),gI(),nl$1(" ",Ow(11,8,"common.save")," "),gI(2),_D(i.loading()?12:i.loadError()?13:14));},dependencies:[Mi$1,n8,S4,J6,k3,Ln$1,sd,zc,t7,y7,Ge,ze,Fe,oe,uk,Ie$1,$b,V5,D5,Wn,Kt],styles:[".editor[_ngcontent-%COMP%]{max-width:56rem;margin:0 auto;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;gap:.75rem;align-items:center}.lede[_ngcontent-%COMP%]{margin:.25rem 0 0;color:#57534e}.grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fit,minmax(12rem,1fr));gap:.75rem 1rem}.field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem;margin:.5rem 0}.field[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{font-size:.85rem;color:#57534e}.help[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:#78716c}.checkbox-row[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.75rem;margin-bottom:.5rem}.input-field-row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr 8rem auto auto;gap:.5rem;align-items:end;margin-bottom:.5rem}.input-field-row[_ngcontent-%COMP%] > .field[_ngcontent-%COMP%]{margin:0}.errors[_ngcontent-%COMP%]{border:1px solid #fecdd3;background:#fff1f2;padding:.75rem 1rem}.errors[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{margin:0 0 .35rem;font-size:1rem}.error[_ngcontent-%COMP%]{color:#9f1239}"]});}}return t})();export{nl as WorkflowEditorComponent};