@duplicati/ngclient 0.0.6 → 0.0.7

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 (56) hide show
  1. package/{chunk-CKPPU3GS.js → chunk-2AXNYUNT.js} +1 -1
  2. package/{chunk-YRXI477O.js → chunk-2P7TBSV2.js} +1 -1
  3. package/chunk-35H2LYPK.js +1 -0
  4. package/{chunk-IOWSWUHM.js → chunk-44UCE3JH.js} +1 -1
  5. package/{chunk-RANWFSNY.js → chunk-5SGHSZAK.js} +1 -1
  6. package/{chunk-AC6VDRLC.js → chunk-5Y47Y3RB.js} +1 -1
  7. package/{chunk-4FK75Z4C.js → chunk-66NVA5DG.js} +1 -1
  8. package/{chunk-WLI4RZYL.js → chunk-A7NGO6XL.js} +1 -1
  9. package/chunk-AFUS3PYG.js +1 -0
  10. package/chunk-C52YH32J.js +1 -0
  11. package/{chunk-4MMHXTNF.js → chunk-GI67D57P.js} +1 -1
  12. package/chunk-GYB3IDJ2.js +1 -0
  13. package/{chunk-3MTW6FJP.js → chunk-H2IAZHJK.js} +1 -1
  14. package/{chunk-UTPCUNNU.js → chunk-H7EA5XT6.js} +1 -1
  15. package/{chunk-L47VTK2X.js → chunk-IL52LC7Q.js} +1 -1
  16. package/{chunk-24PLBY6C.js → chunk-JDCFQ6PF.js} +1 -1
  17. package/{chunk-GMANGOGH.js → chunk-K3HFPUKT.js} +1 -1
  18. package/{chunk-XU7PNEZO.js → chunk-K4KGTWQK.js} +1 -1
  19. package/{chunk-IQSBPGVL.js → chunk-L44RMVJT.js} +1 -1
  20. package/{chunk-PY5HJ5U2.js → chunk-L4EVZZOM.js} +1 -1
  21. package/chunk-NCEFK5D4.js +1 -0
  22. package/{chunk-6XUWDRDE.js → chunk-NPPGT43I.js} +1 -1
  23. package/{chunk-X2NZ4CJ5.js → chunk-NSVRJR5X.js} +1 -1
  24. package/{chunk-ZD3JEKWI.js → chunk-P4AWKIXG.js} +1 -1
  25. package/{chunk-NIMPOFJV.js → chunk-PDDKKE7W.js} +1 -1
  26. package/{chunk-ORDBF5MR.js → chunk-RBNO3K72.js} +7 -7
  27. package/{chunk-S76TN27U.js → chunk-S7QBT7L2.js} +1 -1
  28. package/{chunk-PH6AAOK4.js → chunk-SYBUINNV.js} +1 -1
  29. package/chunk-SZ6B2QGN.js +1 -0
  30. package/chunk-T4LLO76D.js +1 -0
  31. package/{chunk-LVLU6MPQ.js → chunk-TIGGJ4KF.js} +1 -1
  32. package/chunk-TOQ4S3RM.js +1 -0
  33. package/chunk-V7LHB36E.js +1 -0
  34. package/{chunk-VPEVWKGB.js → chunk-VSPW7AWV.js} +1 -1
  35. package/chunk-WONBUEO3.js +1 -0
  36. package/{chunk-A66Z6362.js → chunk-WU4K3UNC.js} +1 -1
  37. package/{chunk-57M4MADC.js → chunk-XT6S3PN3.js} +1 -1
  38. package/{chunk-77NTMJCT.js → chunk-ZG7T5UHX.js} +1 -1
  39. package/chunk-ZI6WOAJG.js +1 -0
  40. package/{chunk-I6QIKK6M.js → chunk-ZYCMR5VM.js} +1 -1
  41. package/index.html +5 -5
  42. package/main-NHFMMOPT.js +1 -0
  43. package/package.json +1 -1
  44. package/{styles-6W7ZCKNM.css → styles-LBHWJUQR.css} +1 -1
  45. package/chunk-22HCWJS5.js +0 -1
  46. package/chunk-3MM4GLBS.js +0 -1
  47. package/chunk-7X6SBNMU.js +0 -1
  48. package/chunk-BNNZKRIC.js +0 -1
  49. package/chunk-DYANEO5K.js +0 -1
  50. package/chunk-GJTW7UUU.js +0 -1
  51. package/chunk-N5US3SKW.js +0 -1
  52. package/chunk-QQDSFTZV.js +0 -1
  53. package/chunk-RLJJFBQ2.js +0 -1
  54. package/chunk-VVUYO7E4.js +0 -1
  55. package/chunk-XYJYUMYL.js +0 -1
  56. package/main-5KJRELCN.js +0 -1
@@ -1,2 +1,2 @@
1
- import{a as r}from"./chunk-XU7PNEZO.js";import"./chunk-24PLBY6C.js";import"./chunk-N5US3SKW.js";import"./chunk-PY5HJ5U2.js";import"./chunk-PH6AAOK4.js";import{$ as i,Fb as e,Lb as l,Z as a,lb as s,mb as p}from"./chunk-ORDBF5MR.js";var o=class n{#t=a(r);ngOnInit(){this.#t.logout()}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=i({type:n,selectors:[["app-logout"]],standalone:!0,features:[l],decls:3,vars:0,template:function(t,c){t&1&&(s(0,"p"),e(1,"logout works!"),p(),e(2,`,
1
+ import{a as r}from"./chunk-K4KGTWQK.js";import"./chunk-JDCFQ6PF.js";import"./chunk-AFUS3PYG.js";import"./chunk-L4EVZZOM.js";import"./chunk-SYBUINNV.js";import{Db as e,Jb as l,X as a,Z as i,jb as s,kb as p}from"./chunk-RBNO3K72.js";var o=class n{#t=a(r);ngOnInit(){this.#t.logout()}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=i({type:n,selectors:[["app-logout"]],standalone:!0,features:[l],decls:3,vars:0,template:function(t,c){t&1&&(s(0,"p"),e(1,"logout works!"),p(),e(2,`,
2
2
  `))},styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})};export{o as default};
@@ -1 +1 @@
1
- import{a as f}from"./chunk-XYJYUMYL.js";import"./chunk-22HCWJS5.js";import"./chunk-A66Z6362.js";import{a as u,d as g,e as k}from"./chunk-S76TN27U.js";import{d as l}from"./chunk-N5US3SKW.js";import"./chunk-PY5HJ5U2.js";import"./chunk-PH6AAOK4.js";import{$ as r,Fb as t,Lb as s,Mb as m,Qa as c,db as d,lb as e,mb as n,nb as i}from"./chunk-ORDBF5MR.js";var b=()=>["/backup/new"],o=class p{static \u0275fac=function(a){return new(a||p)};static \u0275cmp=r({type:p,selectors:[["app-add-backup"]],standalone:!0,features:[s],decls:15,vars:2,consts:[[1,"backup-types"],[1,"type-a"],["src","/assets/images/new-backup.png"],["spk-button","",1,"raised","primary",3,"routerLink"]],template:function(a,x){a&1&&(i(0,"app-status-bar"),e(1,"section")(2,"h2"),t(3,"Add a new backup"),n(),e(4,"div",0)(5,"spk-card",1),i(6,"img",2),e(7,"h3"),t(8,"New backup"),n(),e(9,"p"),t(10,"Configure a new backup. Choose your destination, source data and schedule."),n(),e(11,"button",3),t(12," Add a new backup "),e(13,"spk-icon"),t(14,"plus"),n()()()()()),a&2&&(c(11),d("routerLink",m(1,b)))},dependencies:[f,g,k,u,l],styles:["[_nghost-%COMP%]{display:block}section[_ngcontent-%COMP%]{display:flex;align-items:center;flex-direction:column;gap:2rem;padding:2rem 0}div.backup-types[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr;gap:1rem;max-width:700px}spk-card[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;gap:1rem;padding-bottom:3rem}spk-card[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{max-width:300px}spk-card[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{text-wrap:balance;text-align:center;width:75%}"],changeDetection:0})};export{o as default};
1
+ import{a as f}from"./chunk-35H2LYPK.js";import"./chunk-V7LHB36E.js";import"./chunk-WU4K3UNC.js";import{a as u,d as g,e as k}from"./chunk-S7QBT7L2.js";import{d as l}from"./chunk-AFUS3PYG.js";import"./chunk-L4EVZZOM.js";import"./chunk-SYBUINNV.js";import{Db as t,Jb as s,Kb as m,Oa as c,Z as r,bb as d,jb as e,kb as n,lb as i}from"./chunk-RBNO3K72.js";var b=()=>["/backup/new"],o=class p{static \u0275fac=function(a){return new(a||p)};static \u0275cmp=r({type:p,selectors:[["app-add-backup"]],standalone:!0,features:[s],decls:15,vars:2,consts:[[1,"backup-types"],[1,"type-a"],["src","/assets/images/new-backup.png"],["spk-button","",1,"raised","primary",3,"routerLink"]],template:function(a,x){a&1&&(i(0,"app-status-bar"),e(1,"section")(2,"h2"),t(3,"Add a new backup"),n(),e(4,"div",0)(5,"spk-card",1),i(6,"img",2),e(7,"h3"),t(8,"New backup"),n(),e(9,"p"),t(10,"Configure a new backup. Choose your destination, source data and schedule."),n(),e(11,"button",3),t(12," Add a new backup "),e(13,"spk-icon"),t(14,"plus"),n()()()()()),a&2&&(c(11),d("routerLink",m(1,b)))},dependencies:[f,g,k,u,l],styles:["[_nghost-%COMP%]{display:block}section[_ngcontent-%COMP%]{display:flex;align-items:center;flex-direction:column;gap:2rem;padding:2rem 0}div.backup-types[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr;gap:1rem;max-width:700px}spk-card[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;gap:1rem;padding-bottom:3rem}spk-card[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{max-width:300px}spk-card[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{text-wrap:balance;text-align:center;width:75%}"],changeDetection:0})};export{o as default};
@@ -0,0 +1 @@
1
+ import{a as N}from"./chunk-V7LHB36E.js";import{a as M}from"./chunk-WU4K3UNC.js";import{k as V}from"./chunk-S7QBT7L2.js";import{a as O,b as L}from"./chunk-SYBUINNV.js";import{$a as T,$b as d,Db as m,G as h,Gb as b,Jb as A,M as I,Oa as l,Ob as E,Pb as R,R as C,Ua as i,X as r,Z as _,a as k,aa as x,b as S,bb as p,bc as P,fb as w,jb as o,kb as u,lb as c,o as B,rb as v,s as D}from"./chunk-RBNO3K72.js";var f=class a{#t=r(N);transform(e,...t){return this.#t(e).fromNow()}static \u0275fac=function(t){return new(t||a)};static \u0275pipe=x({name:"appRelativeTime",type:a,pure:!0,standalone:!0})};var g=class a{#t=1e3;#d=r(L);#o=r(O);#n=r(M);#e=i(!1);#i=i(!1);#u=i(this.#t);#p=i(null);#r=i(!1);#s=i(!1);#a=i(null);#f=i(!1);statusData=this.#p.asReadonly();serverState=d(()=>{let e=this.#a();return e?(e.ProposedSchedule=e?.ProposedSchedule?.map(t=>{let s=t.Item1?this.#n.getBackupById(t.Item1):null;return S(k({},t),{backup:s})}),e):null});isFetching=this.#i.asReadonly();#l=null;#g=P(()=>{let e=this.#e(),t=this.#u();if(!e||!t||t<this.#t){this.#l&&window.clearInterval(this.#l);return}this.#l=window.setInterval(()=>{this.#m()},t)});start(){this.#r.set(!0),this.#c()}stop(){this.#r.set(!1)}startPollingProgress(){this.#m(),this.#e.set(!0)}stopPollingProgress(){this.#e.set(!1)}setProgressStatePollingInterval(e){if(e<this.#t){console.error(`Polling interval must be at least ${this.#t}ms`);return}this.#u.set(e)}serverStateEffect=P(()=>{if(this.#f()){this.stopPollingProgress();return}!this.#s()&&this.#r()?setTimeout(()=>{this.startPollingProgress(),this.#c()},1e3):this.stopPollingProgress()},{allowSignalWrites:!0});#c(){if(this.#s())return;this.#s.set(!0);let e=this.#a()?.LastEventID,t=e==null?{}:{lastEventId:e,longpoll:!0,duration:"299s"};this.#o.getApiV1Serverstate(t).pipe(h(()=>this.#s.set(!1))).subscribe({next:s=>{this.#a()?.LastDataUpdateID!==s.LastDataUpdateID&&this.#n.getBackups(),this.#a.set(s)}})}#m(){this.#i.set(!0),this.#d.getApiV1Progressstate().pipe(I(e=>{let t=e.TaskID??null;return t===null?B(e):this.#o.getApiV1TaskByTaskid({taskid:t}).pipe(D(s=>S(k({},e),{task:s??null})))}),h(()=>this.#i.set(!1))).subscribe({next:e=>{let t=e.TaskID??null,s=e.BackupID??null;if(t!==null&&s!==null){let n=this.#n.getBackupById(s);e.backup=n}e.task?.Status==="Completed"?this.#e.set(!1):this.#e.set(!0),this.#p.set(e)},error:e=>{e.status===404&&this.#e.set(!1)}})}static \u0275fac=function(t){return new(t||a)};static \u0275prov=C({token:a,factory:a.\u0275fac,providedIn:"root"})};function G(a,e){if(a&1&&(o(0,"div",2),m(1),u(),c(2,"spk-progress-bar",3)),a&2){let t,s,n=v();l(),b("",(t=n.statusData())==null||t.task==null?null:t.task.Status," - ",(t=n.statusData())==null||t.backup==null||t.backup.Backup==null?null:t.backup.Backup.Name,""),l(),p("value",(s=n.statusData())!=null&&s.OverallProgress?((s=n.statusData())==null?null:s.OverallProgress)*100:3)}}function F(a,e){if(a&1&&(o(0,"div",2),m(1),E(2,"appRelativeTime"),u(),c(3,"spk-progress-bar",4)),a&2){let t,s=v();l(),b("",(t=s.nextBackup().backup)==null||t.Backup==null?null:t.Backup.Name," - ",R(2,3,s.nextBackup().time),""),l(2),p("value",3)}}function J(a,e){a&1&&(o(0,"div",2),m(1,"No scheduled tasks"),u(),c(2,"spk-progress-bar",4)),a&2&&(l(2),p("value",3))}function U(a,e){a&1&&(o(0,"div",2),m(1,"Loading..."),u(),c(2,"spk-progress-bar",4)),a&2&&(l(2),p("value",3))}var y=class a{#t=r(g);statusData=this.#t.statusData;serverState=this.#t.serverState;nextBackup=d(()=>({backup:this.serverState()?.ProposedSchedule?.[0]?.backup,time:this.serverState()?.ProposedSchedule?.[0]?.Item2}));ngOnInit(){this.#t.start()}ngOnDestroy(){this.#t.stop()}static \u0275fac=function(t){return new(t||a)};static \u0275cmp=_({type:a,selectors:[["app-status-bar"]],standalone:!0,features:[A],decls:6,vars:1,consts:[[1,"current-backup"],[1,"current-backup-progress"],[1,"label"],[1,"raised","primary",3,"value"],[1,"raised",3,"value"]],template:function(t,s){if(t&1&&(o(0,"div",0)(1,"div",1),T(2,G,3,3)(3,F,4,5)(4,J,3,1)(5,U,3,1),u()()),t&2){let n;l(2),w(!((n=s.statusData())==null||n.task==null)&&n.task.Status&&((n=s.statusData())==null||n.task==null?null:n.task.Status)!=="Completed"?2:s.nextBackup()?3:!s.statusData()||((n=s.statusData())==null||n.task==null?null:n.task.Status)==="Completed"?4:5)}},dependencies:[V,f],styles:["[_nghost-%COMP%]{display:flex;align-items:center;justify-content:space-between;padding:1rem;border-bottom:1px solid var(--base-level-40)}.current-backup[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.current-backup-progress[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.25rem;min-width:18.75rem}.current-backup-actions[_ngcontent-%COMP%]{display:flex;gap:.5rem}"],changeDetection:0})};export{y as a};
@@ -1 +1 @@
1
- import{a as j}from"./chunk-XYJYUMYL.js";import{a as A}from"./chunk-22HCWJS5.js";import{a as z}from"./chunk-A66Z6362.js";import{a as L,d as N,e as $,g as V}from"./chunk-S76TN27U.js";import{d as I}from"./chunk-N5US3SKW.js";import"./chunk-PY5HJ5U2.js";import"./chunk-PH6AAOK4.js";import{$ as h,Fb as n,Hb as u,Lb as F,Mb as b,Nb as T,Qa as p,Qb as M,Rb as w,Sb as D,Z as _,bb as s,ca as v,db as k,hb as m,ib as P,ja as f,jb as y,ka as g,kb as O,lb as a,mb as o,nb as x,oc as H,rb as E,sb as B,tb as c}from"./chunk-ORDBF5MR.js";var C=class t{#t=_(A);transform(l,...e){if(!l)return"";let i=l.split(".")[0],r=parseInt(i.split(":")[0])??0,d=parseInt(i.split(":")[1])??0,R=parseInt(i.split(":")[2])??0;return this.#t.duration({hours:r,minutes:d,seconds:R}).humanize()}static \u0275fac=function(e){return new(e||t)};static \u0275pipe=v({name:"durationFormat",type:t,pure:!0,standalone:!0})};var Y=()=>["/add-backup"],q=()=>["/restore"],G=t=>["/backup",t];function K(t,l){if(t&1&&(n(0),M(1,"durationFormat")),t&2){let e=c().$implicit;u(" - (took ",w(1,1,e.Backup==null||e.Backup.Metadata==null?null:e.Backup.Metadata.LastBackupDuration),") ")}}function Q(t,l){t&1&&n(0," N/A ")}function U(t,l){if(t&1&&n(0),t&2){let e=c().$implicit;u(" ",e.Backup==null||e.Backup.Metadata==null?null:e.Backup.Metadata.SourceSizeString," ")}}function W(t,l){t&1&&n(0," N/A ")}function X(t,l){if(t&1&&n(0),t&2){let e=c().$implicit;u(" ",e.Backup==null||e.Backup.Metadata==null?null:e.Backup.Metadata.TargetSizeString," ")}}function Z(t,l){t&1&&n(0," N/A ")}function tt(t,l){if(t&1&&(a(0,"spk-chip",8),n(1),o()),t&2){let e=c().$implicit;p(),u("",e.Backup==null||e.Backup.Metadata==null?null:e.Backup.Metadata.BackupListCount," Version")}}function et(t,l){t&1&&(a(0,"spk-chip",9),n(1,"No version yet"),o())}function nt(t,l){if(t&1){let e=E();a(0,"div",7)(1,"div",2)(2,"h3"),n(3),a(4,"spk-icon"),n(5,"database"),o()(),a(6,"p")(7,"span"),n(8,"Last successful backup:"),o(),n(9),M(10,"date"),s(11,K,2,3)(12,Q,1,0),o(),a(13,"p")(14,"span"),n(15,"Source:"),o(),s(16,U,1,1)(17,W,1,0),o(),a(18,"p")(19,"span"),n(20,"Destination:"),o(),s(21,X,1,1)(22,Z,1,0),o()(),s(23,tt,2,1,"spk-chip",8)(24,et,2,0,"spk-chip",9),a(25,"div",10)(26,"button",11),B("click",function(){let r=f(e).$implicit,d=c(2);return g(d.startBackup(r.Backup==null?null:r.Backup.ID))}),a(27,"spk-icon"),n(28,"play-circle"),o(),n(29," Start "),o(),a(30,"button",12)(31,"spk-icon"),n(32,"pencil-circle"),o(),n(33," Edit "),o(),a(34,"button",11),B("click",function(){let r=f(e).$implicit,d=c(2);return g(d.deleteBackup(r.Backup==null?null:r.Backup.ID))}),a(35,"spk-icon"),n(36,"x-circle"),o(),n(37," Delete "),o()()()}if(t&2){let e,i=l.$implicit;p(3),u(" ",(e=i.Backup==null?null:i.Backup.Name)!==null&&e!==void 0?e:"Backup name missing"," "),p(6),u(" ",D(10,7,i.Backup==null||i.Backup.Metadata==null?null:i.Backup.Metadata.LastBackupDate,"short")," "),p(2),m(!(i.Backup==null||i.Backup.Metadata==null)&&i.Backup.Metadata.LastBackupDuration?11:12),p(5),m(!(i.Backup==null||i.Backup.Metadata==null)&&i.Backup.Metadata.SourceSizeString?16:17),p(5),m(!(i.Backup==null||i.Backup.Metadata==null)&&i.Backup.Metadata.TargetSizeString?21:22),p(2),m(!(i.Backup==null||i.Backup.Metadata==null)&&i.Backup.Metadata.BackupListCount?23:24),p(7),k("routerLink",T(10,G,i.Backup==null?null:i.Backup.ID))}}function it(t,l){if(t&1&&y(0,nt,38,12,"div",7,P),t&2){let e=c();O(e.backups())}}function at(t,l){t&1&&n(0," No backups founds ")}var S=class t{#t=_(z);backups=this.#t.backups;backupsLoading=this.#t.backupsLoading;ngOnInit(){this.#t.getBackups(!0)}startBackup(l){this.#t.startBackup(l)}deleteBackup(l){l&&this.#t.deleteBackup(l)}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=h({type:t,selectors:[["app-home"]],standalone:!0,features:[F],decls:31,vars:5,consts:[[1,"type-a",3,"routerLink"],["src","/assets/images/backup.png","alt","","width","48px"],[1,"text"],["spk-button",""],["src","/assets/images/restore.png","alt","","width","48px"],[1,"content"],[1,"backups"],[1,"backup"],[1,"simple","success"],[1,"simple"],[1,"actions"],["spk-button","",3,"click"],["spk-button","",3,"routerLink"]],template:function(e,i){e&1&&(x(0,"app-status-bar"),a(1,"section")(2,"header")(3,"spk-card",0),x(4,"img",1),a(5,"div",2)(6,"h3"),n(7,"Backups"),o(),a(8,"p"),n(9,"Backups are stored in the cloud and can be restored at any time."),o()(),a(10,"button",3),n(11," Add "),a(12,"spk-icon"),n(13,"plus"),o()()(),a(14,"spk-card",0),x(15,"img",4),a(16,"div",2)(17,"h3"),n(18,"Restores"),o(),a(19,"p"),n(20,"Restores are stored in the cloud and can be restored at any time."),o()(),a(21,"button",3),n(22," Start "),a(23,"spk-icon"),n(24,"arrow-right"),o()()()(),a(25,"div",5)(26,"h2"),n(27,"My backups"),o(),a(28,"div",6),s(29,it,2,0)(30,at,1,0),o()()()),e&2&&(p(3),k("routerLink",b(3,Y)),p(11),k("routerLink",b(4,q)),p(15),m(i.backups().length?29:30))},dependencies:[I,j,$,N,L,V,H,C],styles:["[_nghost-%COMP%]{display:block}section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;padding:2rem 0}header[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;padding:0 2rem;gap:1rem}spk-card[_ngcontent-%COMP%]{display:flex;align-items:center;gap:1rem}spk-card[_ngcontent-%COMP%] .text[_ngcontent-%COMP%]{flex:1 0;display:flex;flex-direction:column;gap:.25rem}.content[_ngcontent-%COMP%]{display:flex;flex-direction:column;padding:0 2rem;gap:1rem}.backups[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.backup[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;padding:2rem;gap:1rem;border:1px solid var(--base-level-40);border-radius:var(--shape-3);box-shadow:var(--shadow-1)}.backup[_ngcontent-%COMP%] .text[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem;width:100%;max-width:40%}.backup[_ngcontent-%COMP%] .text[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.backup[_ngcontent-%COMP%] .text[_ngcontent-%COMP%] h3[_ngcontent-%COMP%] spk-icon[_ngcontent-%COMP%]{color:var(--base-level-60)}.backup[_ngcontent-%COMP%] .text[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{font:var(--paragraph-30);color:var(--base-level-60)}.backup[_ngcontent-%COMP%] .text[_ngcontent-%COMP%] p[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{color:var(--base-level-70)}.actions[_ngcontent-%COMP%]{display:flex;gap:.5rem}"],changeDetection:0})};export{S as default};
1
+ import{a as j}from"./chunk-35H2LYPK.js";import{a as A}from"./chunk-V7LHB36E.js";import{a as z}from"./chunk-WU4K3UNC.js";import{a as L,d as N,e as $,g as V}from"./chunk-S7QBT7L2.js";import{d as I}from"./chunk-AFUS3PYG.js";import"./chunk-L4EVZZOM.js";import"./chunk-SYBUINNV.js";import{$a as s,Db as n,Fb as u,Jb as F,Kb as b,Lb as T,Oa as p,Ob as M,Pb as w,Qb as D,X as _,Z as h,aa as v,bb as k,fb as m,gb as P,ha as f,hb as y,ia as g,ib as O,jb as a,kb as o,lb as x,mc as H,pb as E,qb as B,rb as c}from"./chunk-RBNO3K72.js";var C=class t{#t=_(A);transform(l,...e){if(!l)return"";let i=l.split(".")[0],r=parseInt(i.split(":")[0])??0,d=parseInt(i.split(":")[1])??0,R=parseInt(i.split(":")[2])??0;return this.#t.duration({hours:r,minutes:d,seconds:R}).humanize()}static \u0275fac=function(e){return new(e||t)};static \u0275pipe=v({name:"durationFormat",type:t,pure:!0,standalone:!0})};var Y=()=>["/add-backup"],q=()=>["/restore"],G=t=>["/backup",t];function K(t,l){if(t&1&&(n(0),M(1,"durationFormat")),t&2){let e=c().$implicit;u(" - (took ",w(1,1,e.Backup==null||e.Backup.Metadata==null?null:e.Backup.Metadata.LastBackupDuration),") ")}}function Q(t,l){t&1&&n(0," N/A ")}function U(t,l){if(t&1&&n(0),t&2){let e=c().$implicit;u(" ",e.Backup==null||e.Backup.Metadata==null?null:e.Backup.Metadata.SourceSizeString," ")}}function W(t,l){t&1&&n(0," N/A ")}function X(t,l){if(t&1&&n(0),t&2){let e=c().$implicit;u(" ",e.Backup==null||e.Backup.Metadata==null?null:e.Backup.Metadata.TargetSizeString," ")}}function Z(t,l){t&1&&n(0," N/A ")}function tt(t,l){if(t&1&&(a(0,"spk-chip",8),n(1),o()),t&2){let e=c().$implicit;p(),u("",e.Backup==null||e.Backup.Metadata==null?null:e.Backup.Metadata.BackupListCount," Version")}}function et(t,l){t&1&&(a(0,"spk-chip",9),n(1,"No version yet"),o())}function nt(t,l){if(t&1){let e=E();a(0,"div",7)(1,"div",2)(2,"h3"),n(3),a(4,"spk-icon"),n(5,"database"),o()(),a(6,"p")(7,"span"),n(8,"Last successful backup:"),o(),n(9),M(10,"date"),s(11,K,2,3)(12,Q,1,0),o(),a(13,"p")(14,"span"),n(15,"Source:"),o(),s(16,U,1,1)(17,W,1,0),o(),a(18,"p")(19,"span"),n(20,"Destination:"),o(),s(21,X,1,1)(22,Z,1,0),o()(),s(23,tt,2,1,"spk-chip",8)(24,et,2,0,"spk-chip",9),a(25,"div",10)(26,"button",11),B("click",function(){let r=f(e).$implicit,d=c(2);return g(d.startBackup(r.Backup==null?null:r.Backup.ID))}),a(27,"spk-icon"),n(28,"play-circle"),o(),n(29," Start "),o(),a(30,"button",12)(31,"spk-icon"),n(32,"pencil-circle"),o(),n(33," Edit "),o(),a(34,"button",11),B("click",function(){let r=f(e).$implicit,d=c(2);return g(d.deleteBackup(r.Backup==null?null:r.Backup.ID))}),a(35,"spk-icon"),n(36,"x-circle"),o(),n(37," Delete "),o()()()}if(t&2){let e,i=l.$implicit;p(3),u(" ",(e=i.Backup==null?null:i.Backup.Name)!==null&&e!==void 0?e:"Backup name missing"," "),p(6),u(" ",D(10,7,i.Backup==null||i.Backup.Metadata==null?null:i.Backup.Metadata.LastBackupDate,"short")," "),p(2),m(!(i.Backup==null||i.Backup.Metadata==null)&&i.Backup.Metadata.LastBackupDuration?11:12),p(5),m(!(i.Backup==null||i.Backup.Metadata==null)&&i.Backup.Metadata.SourceSizeString?16:17),p(5),m(!(i.Backup==null||i.Backup.Metadata==null)&&i.Backup.Metadata.TargetSizeString?21:22),p(2),m(!(i.Backup==null||i.Backup.Metadata==null)&&i.Backup.Metadata.BackupListCount?23:24),p(7),k("routerLink",T(10,G,i.Backup==null?null:i.Backup.ID))}}function it(t,l){if(t&1&&y(0,nt,38,12,"div",7,P),t&2){let e=c();O(e.backups())}}function at(t,l){t&1&&n(0," No backups founds ")}var S=class t{#t=_(z);backups=this.#t.backups;backupsLoading=this.#t.backupsLoading;ngOnInit(){this.#t.getBackups(!0)}startBackup(l){this.#t.startBackup(l)}deleteBackup(l){l&&this.#t.deleteBackup(l)}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=h({type:t,selectors:[["app-home"]],standalone:!0,features:[F],decls:31,vars:5,consts:[[1,"type-a",3,"routerLink"],["src","/assets/images/backup.png","alt","","width","48px"],[1,"text"],["spk-button",""],["src","/assets/images/restore.png","alt","","width","48px"],[1,"content"],[1,"backups"],[1,"backup"],[1,"simple","success"],[1,"simple"],[1,"actions"],["spk-button","",3,"click"],["spk-button","",3,"routerLink"]],template:function(e,i){e&1&&(x(0,"app-status-bar"),a(1,"section")(2,"header")(3,"spk-card",0),x(4,"img",1),a(5,"div",2)(6,"h3"),n(7,"Backups"),o(),a(8,"p"),n(9,"Backups are stored in the cloud and can be restored at any time."),o()(),a(10,"button",3),n(11," Add "),a(12,"spk-icon"),n(13,"plus"),o()()(),a(14,"spk-card",0),x(15,"img",4),a(16,"div",2)(17,"h3"),n(18,"Restores"),o(),a(19,"p"),n(20,"Restores are stored in the cloud and can be restored at any time."),o()(),a(21,"button",3),n(22," Start "),a(23,"spk-icon"),n(24,"arrow-right"),o()()()(),a(25,"div",5)(26,"h2"),n(27,"My backups"),o(),a(28,"div",6),s(29,it,2,0)(30,at,1,0),o()()()),e&2&&(p(3),k("routerLink",b(3,Y)),p(11),k("routerLink",b(4,q)),p(15),m(i.backups().length?29:30))},dependencies:[I,j,$,N,L,V,H,C],styles:["[_nghost-%COMP%]{display:block}section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;padding:2rem 0}header[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;padding:0 2rem;gap:1rem}spk-card[_ngcontent-%COMP%]{display:flex;align-items:center;gap:1rem}spk-card[_ngcontent-%COMP%] .text[_ngcontent-%COMP%]{flex:1 0;display:flex;flex-direction:column;gap:.25rem}.content[_ngcontent-%COMP%]{display:flex;flex-direction:column;padding:0 2rem;gap:1rem}.backups[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.backup[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;padding:2rem;gap:1rem;border:1px solid var(--base-level-40);border-radius:var(--shape-3);box-shadow:var(--shadow-1)}.backup[_ngcontent-%COMP%] .text[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem;width:100%;max-width:40%}.backup[_ngcontent-%COMP%] .text[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.backup[_ngcontent-%COMP%] .text[_ngcontent-%COMP%] h3[_ngcontent-%COMP%] spk-icon[_ngcontent-%COMP%]{color:var(--base-level-60)}.backup[_ngcontent-%COMP%] .text[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{font:var(--paragraph-30);color:var(--base-level-60)}.backup[_ngcontent-%COMP%] .text[_ngcontent-%COMP%] p[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{color:var(--base-level-70)}.actions[_ngcontent-%COMP%]{display:flex;gap:.5rem}"],changeDetection:0})};export{S as default};
@@ -1 +1 @@
1
- import{b as S}from"./chunk-ZD3JEKWI.js";import{a as h}from"./chunk-PH6AAOK4.js";import{$ as l,Fb as p,Gb as d,Lb as f,Qa as n,Qb as u,Rb as C,Z as s,ib as c,jb as m,kb as g,lb as i,mb as a,pc as v}from"./chunk-ORDBF5MR.js";function L(t,o){if(t&1&&(i(0,"pre",0),p(1),u(2,"json"),a()),t&2){let e=o.$implicit;n(),d(C(2,1,e))}}var r=class t{#e=s(h);logs=S(this.#e.getApiV1LogdataLog());static \u0275fac=function(e){return new(e||t)};static \u0275cmp=l({type:t,selectors:[["app-logs"]],standalone:!0,features:[f],decls:4,vars:0,consts:[[2,"white-space","wrap"]],template:function(e,y){e&1&&(i(0,"h3"),p(1,"Logs"),a(),m(2,L,3,3,"pre",0,c)),e&2&&(n(2),g(y.logs()))},dependencies:[v],styles:["[_nghost-%COMP%]{display:block}h3[_ngcontent-%COMP%]{font:var(--title-30)}"],changeDetection:0})};export{r as default};
1
+ import{b as S}from"./chunk-P4AWKIXG.js";import{a as h}from"./chunk-SYBUINNV.js";import{Db as p,Eb as d,Jb as f,Oa as n,Ob as u,Pb as C,X as s,Z as l,gb as c,hb as m,ib as g,jb as i,kb as a,nc as v}from"./chunk-RBNO3K72.js";function L(t,o){if(t&1&&(i(0,"pre",0),p(1),u(2,"json"),a()),t&2){let e=o.$implicit;n(),d(C(2,1,e))}}var r=class t{#e=s(h);logs=S(this.#e.getApiV1LogdataLog());static \u0275fac=function(e){return new(e||t)};static \u0275cmp=l({type:t,selectors:[["app-logs"]],standalone:!0,features:[f],decls:4,vars:0,consts:[[2,"white-space","wrap"]],template:function(e,y){e&1&&(i(0,"h3"),p(1,"Logs"),a(),m(2,L,3,3,"pre",0,c)),e&2&&(n(2),g(y.logs()))},dependencies:[v],styles:["[_nghost-%COMP%]{display:block}h3[_ngcontent-%COMP%]{font:var(--title-30)}"],changeDetection:0})};export{r as default};
@@ -1 +1 @@
1
- import{a as m,b as u}from"./chunk-ZD3JEKWI.js";import{H as l,N as f,Va as v,Z as b,bc as V,cc as w,g as d,ga as I,ha as y,oa as S,p as j,s as h,v as c}from"./chunk-ORDBF5MR.js";function z(e,n,o){!n&&y(e);let i=n??b(S);return o?I(i,o):i}function C(...e){let{normalizedSources:n,hasInitValue:o,operator:i,options:r}=E(e),s=z(C,r?.injector);return o?u(c(n).pipe(i),{initialValue:r.initialValue,injector:s}):u(c(n).pipe(i),{injector:s,requireSync:!0})}function E(e){if(!e||!e.length||typeof e[0]!="object")throw new TypeError("derivedFrom needs sources");let n=typeof e[1]=="function";if(e.length==3&&!n)throw new TypeError("derivedFrom needs pipeable operator as a second argument");n||e.splice(1,0,d);let[o,i,r]=e,s=r?.initialValue!==void 0;return{normalizedSources:Object.entries(o).reduce((p,[a,t])=>{if(v(t))p[a]=m(t,{injector:r?.injector}).pipe(f(w(t)));else if(h(t))p[a]=t.pipe(l());else if(typeof t=="function"){let A=V(t);p[a]=m(A,{injector:r?.injector}).pipe(f(t()))}else p[a]=j(t).pipe(l());return p},Array.isArray(o)?[]:{}),operator:i,hasInitValue:s,options:r}}export{C as a};
1
+ import{a as m,b as u}from"./chunk-P4AWKIXG.js";import{$b as V,F as l,L as f,Ta as v,X as b,ac as w,e as d,ea as I,fa as y,ma as S,n as j,q as h,t as c}from"./chunk-RBNO3K72.js";function z(e,n,o){!n&&y(e);let i=n??b(S);return o?I(i,o):i}function C(...e){let{normalizedSources:n,hasInitValue:o,operator:i,options:r}=E(e),s=z(C,r?.injector);return o?u(c(n).pipe(i),{initialValue:r.initialValue,injector:s}):u(c(n).pipe(i),{injector:s,requireSync:!0})}function E(e){if(!e||!e.length||typeof e[0]!="object")throw new TypeError("derivedFrom needs sources");let n=typeof e[1]=="function";if(e.length==3&&!n)throw new TypeError("derivedFrom needs pipeable operator as a second argument");n||e.splice(1,0,d);let[o,i,r]=e,s=r?.initialValue!==void 0;return{normalizedSources:Object.entries(o).reduce((p,[a,t])=>{if(v(t))p[a]=m(t,{injector:r?.injector}).pipe(f(w(t)));else if(h(t))p[a]=t.pipe(l());else if(typeof t=="function"){let A=V(t);p[a]=m(A,{injector:r?.injector}).pipe(f(t()))}else p[a]=j(t).pipe(l());return p},Array.isArray(o)?[]:{}),operator:i,hasInitValue:s,options:r}}export{C as a};
@@ -1 +1 @@
1
- import{a as me}from"./chunk-AC6VDRLC.js";import{a as le}from"./chunk-GMANGOGH.js";import"./chunk-24PLBY6C.js";import{a as ae}from"./chunk-XYJYUMYL.js";import"./chunk-22HCWJS5.js";import"./chunk-A66Z6362.js";import{b as se}from"./chunk-ZD3JEKWI.js";import{b as L,d as $,e as W,f as q,h as z,i as j,j as H,l as J,m as K,n as Q,o as X,p as Y,q as Z}from"./chunk-7X6SBNMU.js";import{a as re}from"./chunk-LVLU6MPQ.js";import{d as ee,h as te,l as ne,n as ie}from"./chunk-S76TN27U.js";import{a as oe}from"./chunk-PH6AAOK4.js";import{$ as I,Fb as r,Gb as E,Hb as b,Lb as A,N as v,Na as D,Qa as s,Wa as h,Z as y,bb as O,bc as G,db as S,dc as B,fb as M,h as F,hb as C,ib as x,ja as u,jb as T,ka as d,kb as k,lb as n,mb as o,nb as p,ob as R,pb as w,rb as _,sb as m,tb as c,u as U,wb as N}from"./chunk-ORDBF5MR.js";function ue(a,e){if(a&1){let t=_();n(0,"spk-form-field",28),p(1,"input",29),o(),n(2,"button",30),m("click",function(){u(t);let l=c(2);return d(l.beginRemoteRegistration())}),r(3," Register for remote control "),o()}}function de(a,e){if(a&1&&(n(0,"div",26)(1,"label"),r(2,"Machine is now registered, open this link to add it to your account:"),o(),n(3,"a",31),r(4),o()()),a&2){let t=c(2);s(3),N("href",t.remoteControlClaimUrl(),D),s(),E(t.remoteControlClaimUrl())}}function ge(a,e){a&1&&(n(0,"div",26)(1,"label"),r(2,"Registering, please wait..."),o()())}function Ce(a,e){if(a&1){let t=_();n(0,"button",30),m("click",function(){u(t);let l=c(2);return d(l.cancelRemoteRegistration())}),r(1," Cancel registration "),o()}}function _e(a,e){if(a&1){let t=_();n(0,"button",30),m("click",function(){u(t);let l=c(2);return d(l.disableRemoteControl())}),r(1," Disable remote control "),o()}}function fe(a,e){if(a&1){let t=_();n(0,"button",30),m("click",function(){u(t);let l=c(2);return d(l.enableRemoteControl())}),r(1," Enable remote control "),o(),n(2,"button",32),m("click",function(){u(t);let l=c(2);return d(l.deleteRemoteControl())}),r(3," Delete remote control setup "),o()}}function Se(a,e){if(a&1&&(n(0,"div",5),O(1,ue,4,0)(2,de,5,2,"div",26)(3,ge,3,0,"div",26)(4,Ce,2,0,"button",27)(5,_e,2,0,"button",27)(6,fe,4,0),o()),a&2){let t=c();s(),C(t.remoteControlState()==="inactive"?1:-1),s(),C(t.remoteControlState()==="registered"?2:-1),s(),C(t.remoteControlState()==="registering"?3:-1),s(),C(t.remoteControlState()==="registering"||t.remoteControlState()==="registeringfaulted"||t.remoteControlState()==="registered"?4:-1),s(),C(t.remoteControlState()==="connected"||t.remoteControlState()==="enabled"?5:-1),s(),C(t.remoteControlState()==="disabled"?6:-1)}}function he(a,e){if(a&1){let t=_();n(0,"option",33),m("click",function(){let l=u(t).$implicit,g=c();return d(g.pauseSettings.controls.timeType.setValue(l.value))}),r(1),o()}if(a&2){let t=e.$implicit;S("value",t.value),s(),b(" ",t.label," ")}}function be(a,e){if(a&1){let t=_();n(0,"option",33),m("click",function(){let l=u(t).$implicit,g=c();return d(g.pauseSettings.controls.time.setValue(l))}),r(1),o()}if(a&2){let t=e.$implicit;S("value",t),s(),E(t)}}function ve(a,e){if(a&1){let t=_();n(0,"option",33),m("click",function(){let l=u(t).$implicit,g=c();return d(g.settingsForm.controls.usageStatistics.setValue(l.value))}),r(1),o()}if(a&2){let t=e.$implicit;S("value",t.value),s(),b(" ",t.label," ")}}var f=new X,pe=[{value:"s",label:"Seconds"},{value:"m",label:"Minutes"},{value:"h",label:"Hours"}],V=[{value:"en",label:"English"},{value:"fr",label:"French"},{value:"de",label:"German"},{value:"es",label:"Spanish"},{value:"it",label:"Italian"}],ce=[{value:"",label:"System default (information)"},{value:"information",label:"Usage statistics, warnings, errors, and crashes"},{value:"warning",label:"Warnings, errors and crashes"},{value:"error",label:"Errors and crashes"},{value:"crash",label:"Crashes only"},{value:"none",label:"None / disabled"}],P=class a{#i=y(le);#o=y(re);#e=y(oe);sysinfo=this.#o.systemInfo;isDarkMode=this.#i.isDarkMode;editAs=h("list");settingsForm=f.group({pauseSettings:f.group({time:f.control(0),timeType:f.control("s")}),language:f.control("en"),usageStatistics:f.control(""),updateChannel:f.control(""),remoteControlRegisterUrl:f.control("")});remoteControlState=h("unknown");remoteControlClaimUrl=h(null);sysInfoEffect=B(()=>{this.settingsForm.controls.remoteControlRegisterUrl.patchValue(this.sysinfo()?.RemoteControlRegistrationUrl??"")},{allowSignalWrites:!0});get pauseSettings(){return this.settingsForm.controls.pauseSettings}langSignal=se(this.settingsForm.controls.language.valueChanges);timeTypeOptions=h(pe);timeOptions=me([this.pauseSettings.controls.timeType.valueChanges.pipe(v("s")),this.pauseSettings.controls.time.valueChanges.pipe(v(null))],F(U(([e,t])=>{let i=this.#r(e);return t!==null?i.filter(l=>l.toString().includes(t.toString())):i}),v([])));languageOptions=G(()=>this.langSignal()?V.filter(e=>e.value===this.langSignal()):V);usageStatisticsOptions=h(ce);ngOnInit(){this.refreshRemoteControlStatus(),this.getServerSettings()}submit(){let e=`${this.pauseSettings.controls.time.value}${this.pauseSettings.controls.timeType.value}`;this.#e.patchApiV1Serversettings({requestBody:{"usage-reporter-level":this.settingsForm.controls.usageStatistics.value,"startup-delay":e==="0s"?"":e,"update-channel":this.settingsForm.controls.updateChannel.value}}).subscribe({next:t=>{console.log("res",t)},error:t=>{console.error("err",t)}})}getServerSettings(){return this.#e.getApiV1Serversettings().subscribe({next:e=>{let t=e["startup-delay"];this.settingsForm.patchValue({pauseSettings:{time:parseInt(t.substring(0,t.length-1)==""?"0":t.substring(0,t.length-1)),timeType:t.substring(-1)===""?"s":t.substring(-1)},usageStatistics:e["usage-reporter-level"],updateChannel:e["update-channel"]})}})}languageDisplay(e){return e?V.find(t=>t.value===e)?.label??null:null}typeDisplay(e){return e==null?null:pe.find(t=>t.value===e)?.label??null}usageDisplay(e){return typeof e!="string"?null:ce.find(t=>t.value===e)?.label??null}setDarkMode(){this.#i.setDarkMode()}setLightMode(){this.#i.setLightMode()}#r(e){let t=e==="h"?25:61;return new Array(t).fill(0).map((i,l)=>l)}repeatRegisterTimer=null;#t(e){e.RegistrationUrl&&this.remoteControlClaimUrl.set(e.RegistrationUrl),console.log(e),e.IsConnected?this.remoteControlState.set("connected"):e.IsEnabled?this.remoteControlState.set("enabled"):e.CanEnable?this.remoteControlState.set("disabled"):e.IsRegisteringFaulted?this.remoteControlState.set("registeringfaulted"):e.IsRegistering?e.RegistrationUrl!=null&&e.RegistrationUrl.trim().length>0?this.remoteControlState.set("registered"):this.remoteControlState.set("registering"):this.remoteControlState.set("inactive");let t=this.remoteControlState();console.log(t),this.repeatRegisterTimer!==null&&(clearTimeout(this.repeatRegisterTimer),this.repeatRegisterTimer=null),t==="registering"&&(this.repeatRegisterTimer=setTimeout(()=>{this.#e.postApiV1RemotecontrolRegister({requestBody:{RegistrationUrl:""}}).subscribe({next:i=>{this.#t(i)},error:i=>{this.#n(i)}})},5e3)),(t==="enabled"||t==="registered")&&(this.repeatRegisterTimer=setTimeout(()=>{this.#e.getApiV1RemotecontrolStatus().subscribe({next:i=>{this.#t(i)},error:i=>{this.#n(i)}})},5e3)),e.IsRegistering&&e.CanEnable&&this.#e.deleteApiV1RemotecontrolRegister().subscribe({next:i=>{this.#t(i)}})}#n(e){this.#e.getApiV1RemotecontrolStatus().subscribe({next:t=>{this.#t(t)}})}refreshRemoteControlStatus(){this.#e.getApiV1RemotecontrolStatus().subscribe({next:e=>{this.#t(e)},error:e=>{this.#n(e)}})}beginRemoteRegistration(){this.remoteControlState.set("registering");let e=this.settingsForm.controls.remoteControlRegisterUrl.value;this.#e.postApiV1RemotecontrolRegister({requestBody:{RegistrationUrl:e}}).subscribe({next:t=>{this.#t(t)},error:t=>{this.#n(t)}})}cancelRemoteRegistration(){this.#e.deleteApiV1RemotecontrolRegister().subscribe({next:e=>{this.#t(e)},error:e=>{this.#n(e)}})}enableRemoteControl(){this.#e.postApiV1RemotecontrolEnable().subscribe({next:e=>{this.#t(e)},error:e=>{this.#n(e)}})}disableRemoteControl(){this.#e.postApiV1RemotecontrolDisable().subscribe({next:e=>{this.#t(e)},error:e=>{this.#n(e)}})}deleteRemoteControl(){let e=this;confirm("Are you sure you want to delete the remote control registration?")&&e.#e.deleteApiV1RemotecontrolRegistration().subscribe({next:t=>{e.#t(t)},error:t=>{e.#n(t)}})}getRemoteControlStatusText(){let e=this.remoteControlState();return e==="enabled"?"Remote control is enabled but not connected":e==="connected"?"Remote control is connected":e==="registering"?"Registering machine...":e==="registeringfaulted"?"Registration failed":e==="registered"?"Registered, waiting for accept":e==="disabled"?"Remote control is configured but not enabled":e==="unknown"?"...loading...":"Remote control is not set up"}static \u0275fac=function(t){return new(t||a)};static \u0275cmp=I({type:a,selectors:[["app-settings"]],standalone:!0,features:[A],decls:100,vars:11,consts:[[1,"content",3,"submit","formGroup"],[1,"title"],["type","submit","spk-button","",1,"raised","primary"],[1,"left"],[1,"right","remote-control"],[1,"field-row"],[1,"right"],["formGroupName","pauseSettings",1,"field-row"],[3,"displayValue"],["type","text","formControlName","timeType"],["options",""],[3,"value"],["type","search","formControlName","time"],[1,"themes"],["src","/assets/images/light-theme.png","alt","light theme",3,"click"],["src","/assets/images/dark-theme.png","alt","dark theme",3,"click"],[1,"right","radios"],[1,"radio-option",3,"click"],[1,"outlined","primary"],["type","radio","name","updateChannel","value","","formControlName","updateChannel"],["type","radio","name","updateChannel","value","stable","formControlName","updateChannel"],["type","radio","name","updateChannel","value","beta","formControlName","updateChannel"],["type","radio","name","updateChannel","value","experimental","formControlName","updateChannel"],["type","radio","name","updateChannel","value","canary","formControlName","updateChannel"],["href","#"],["type","text","formControlName","usageStatistics"],[1,"field-col"],["type","button","spk-button","",1,"raised"],["label","Registration URL","for","remoteControlRegisterUrl"],["type","text","spk-input","","id","remoteControlRegisterUrl","name","remoteControlRegisterUrl","formControlName","remoteControlRegisterUrl"],["type","button","spk-button","",1,"raised",3,"click"],["target","_blank",3,"href"],["type","button","spk-button","",1,"raised","warn",3,"click"],[3,"click","value"]],template:function(t,i){if(t&1&&(p(0,"app-status-bar"),n(1,"form",0),m("submit",function(){return i.submit()}),n(2,"header")(3,"div",1)(4,"h2"),r(5,"Settings"),o(),n(6,"p"),r(7,"Configure your backup settings."),o()(),n(8,"button",2),r(9,"Save changes"),o()(),n(10,"section")(11,"div",3)(12,"h3"),r(13,"Remote access control"),o(),n(14,"p"),r(15),o()(),n(16,"div",4),O(17,Se,7,6,"div",5),o()(),n(18,"section")(19,"div",3)(20,"h3"),r(21,"Pause after startup or hibernation"),o(),n(22,"p"),r(23," Duplicati will run when started, but will remain in paused state for the duration. Duplicati will occupy minimal system resources and no backups will be run. "),o()(),n(24,"div",6)(25,"div",7)(26,"spk-select",8),p(27,"input",9),R(28,10),T(29,he,2,2,"option",11,x),w(),o(),n(31,"spk-select"),p(32,"input",12),R(33,10),T(34,be,2,2,"option",11,x),w(),o()()()(),n(36,"section")(37,"div",3)(38,"h3"),r(39,"Color theme"),o(),n(40,"p"),r(41,"Customize your application theme"),o()(),n(42,"div",6)(43,"div",13)(44,"img",14),m("click",function(){return i.setLightMode()}),o(),n(45,"img",15),m("click",function(){return i.setDarkMode()}),o()()()(),n(46,"section")(47,"div",3)(48,"h3"),r(49,"Update channel"),o(),n(50,"p"),r(51,"Lorem ipsum dolor sit amet, consectetur adipiscing elit."),o()(),n(52,"div",16)(53,"div",17),m("click",function(){return i.settingsForm.controls.updateChannel.setValue("")}),n(54,"spk-radio",18),r(55),p(56,"input",19),o(),n(57,"p"),r(58),o()(),n(59,"div",17),m("click",function(){return i.settingsForm.controls.updateChannel.setValue("stable")}),n(60,"spk-radio",18),r(61," Stable "),p(62,"input",20),o(),n(63,"p"),r(64,"Official releases"),o()(),n(65,"div",17),m("click",function(){return i.settingsForm.controls.updateChannel.setValue("beta")}),n(66,"spk-radio",18),r(67," Beta "),p(68,"input",21),o(),n(69,"p"),r(70," Try out the new features that we are working on. Currently the most stable version available. Test Restore data before using this in production environments. "),o()(),n(71,"div",17),m("click",function(){return i.settingsForm.controls.updateChannel.setValue("experimental")}),n(72,"spk-radio",18),r(73," Experimental "),p(74,"input",22),o(),n(75,"p"),r(76,"Specific builds for developers only. Not for use with important data."),o()(),n(77,"div",17),m("click",function(){return i.settingsForm.controls.updateChannel.setValue("canary")}),n(78,"spk-radio",18),r(79," Canary "),p(80,"input",23),o(),n(81,"p"),r(82,"Individual builds for developers only. Not for use with important data."),o()()()(),n(83,"section")(84,"div",3)(85,"h3"),r(86,"Usage statistics"),o(),n(87,"p"),r(88," Usage reports help us improve the user experience and evaluate impact of new features. We use them to generate "),n(89,"a",24),r(90,"public usage statistics."),o(),p(91,"br")(92,"br"),r(93," All usage reports are sent anonymously and do not contain any personal information. They contain information about hardware and operating system, the type of backend, backup duration, overall size of source data and similar data. They do not contain paths, filenames, usernames, passwords or similar sensitive information. "),o()(),n(94,"div",6)(95,"spk-select",8),p(96,"input",25),R(97,10),T(98,ve,2,2,"option",11,x),w(),o()()()()),t&2){let l,g;s(),S("formGroup",i.settingsForm),s(14),E(i.getRemoteControlStatusText()),s(2),C(i.remoteControlState()!=="unknown"?17:-1),s(9),S("displayValue",i.typeDisplay(i.settingsForm.value.pauseSettings==null?null:i.settingsForm.value.pauseSettings.timeType)),s(3),k(i.timeTypeOptions()),s(5),k(i.timeOptions()),s(10),M("active",!i.isDarkMode()),s(),M("active",i.isDarkMode()),s(10),b(" Default (",(l=i.sysinfo())==null?null:l.DefaultUpdateChannel,") "),s(3),b("Same as the base install version: ",(g=i.sysinfo())==null?null:g.ServerVersionType,""),s(37),S("displayValue",i.usageDisplay(i.settingsForm.controls.usageStatistics.value)),s(3),k(i.usageStatisticsOptions())}},dependencies:[Y,q,K,Q,L,z,$,W,Z,j,J,H,ae,ee,ne,te,ie],styles:["[_nghost-%COMP%]{display:block}.content[_ngcontent-%COMP%]{display:flex;flex-direction:column;padding:0 2rem 2rem}header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;padding:2rem 0}header[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.25rem}section[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem;padding:2rem 0;border-top:1px solid var(--base-level-40)}section[_ngcontent-%COMP%] .left[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.25rem;align-items:flex-start}section[_ngcontent-%COMP%] .left[_ngcontent-%COMP%] spk-button-group[_ngcontent-%COMP%]{margin-top:.25rem}section[_ngcontent-%COMP%] .left[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{text-wrap:balance;width:50%}.themes[_ngcontent-%COMP%]{display:flex;gap:.5rem}.themes[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{max-width:240px;border-radius:var(--shape-3);cursor:pointer}.themes[_ngcontent-%COMP%] img.active[_ngcontent-%COMP%]{border:2px solid var(--primary-500)}.radios[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem}.radio-option[_ngcontent-%COMP%]{cursor:pointer}.radio-option[_ngcontent-%COMP%] spk-radio[_ngcontent-%COMP%]{color:var(--base-level-60);margin-bottom:.25rem}.radio-option[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{text-wrap:balance;color:var(--base-level-60R)}.field-col[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.field-row[_ngcontent-%COMP%]{display:flex;gap:.5rem;width:100%}.field-row[_ngcontent-%COMP%] spk-form-field[_ngcontent-%COMP%], .field-row[_ngcontent-%COMP%] spk-select[_ngcontent-%COMP%]{flex:1 0}.remote-control[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{white-space:nowrap}"],changeDetection:0})};export{P as default};
1
+ import{a as me}from"./chunk-5Y47Y3RB.js";import{a as le}from"./chunk-K3HFPUKT.js";import"./chunk-JDCFQ6PF.js";import{a as ae}from"./chunk-35H2LYPK.js";import"./chunk-V7LHB36E.js";import"./chunk-WU4K3UNC.js";import{b as se}from"./chunk-P4AWKIXG.js";import{b as L,d as $,e as W,f as q,h as z,i as j,j as H,l as J,m as K,n as Q,o as X,p as Y,q as Z}from"./chunk-C52YH32J.js";import{a as re}from"./chunk-TIGGJ4KF.js";import{d as ee,h as te,l as ne,n as ie}from"./chunk-S7QBT7L2.js";import{a as oe}from"./chunk-SYBUINNV.js";import{$a as O,$b as G,Db as r,Eb as E,Fb as b,Jb as A,L as v,La as D,Oa as s,Ua as h,X as y,Z as I,bb as S,bc as B,db as M,f as F,fb as C,gb as x,ha as u,hb as T,ia as d,ib as k,jb as n,kb as o,lb as p,mb as R,nb as w,pb as _,qb as m,rb as c,s as U,ub as N}from"./chunk-RBNO3K72.js";function ue(a,e){if(a&1){let t=_();n(0,"spk-form-field",28),p(1,"input",29),o(),n(2,"button",30),m("click",function(){u(t);let l=c(2);return d(l.beginRemoteRegistration())}),r(3," Register for remote control "),o()}}function de(a,e){if(a&1&&(n(0,"div",26)(1,"label"),r(2,"Machine is now registered, open this link to add it to your account:"),o(),n(3,"a",31),r(4),o()()),a&2){let t=c(2);s(3),N("href",t.remoteControlClaimUrl(),D),s(),E(t.remoteControlClaimUrl())}}function ge(a,e){a&1&&(n(0,"div",26)(1,"label"),r(2,"Registering, please wait..."),o()())}function Ce(a,e){if(a&1){let t=_();n(0,"button",30),m("click",function(){u(t);let l=c(2);return d(l.cancelRemoteRegistration())}),r(1," Cancel registration "),o()}}function _e(a,e){if(a&1){let t=_();n(0,"button",30),m("click",function(){u(t);let l=c(2);return d(l.disableRemoteControl())}),r(1," Disable remote control "),o()}}function fe(a,e){if(a&1){let t=_();n(0,"button",30),m("click",function(){u(t);let l=c(2);return d(l.enableRemoteControl())}),r(1," Enable remote control "),o(),n(2,"button",32),m("click",function(){u(t);let l=c(2);return d(l.deleteRemoteControl())}),r(3," Delete remote control setup "),o()}}function Se(a,e){if(a&1&&(n(0,"div",5),O(1,ue,4,0)(2,de,5,2,"div",26)(3,ge,3,0,"div",26)(4,Ce,2,0,"button",27)(5,_e,2,0,"button",27)(6,fe,4,0),o()),a&2){let t=c();s(),C(t.remoteControlState()==="inactive"?1:-1),s(),C(t.remoteControlState()==="registered"?2:-1),s(),C(t.remoteControlState()==="registering"?3:-1),s(),C(t.remoteControlState()==="registering"||t.remoteControlState()==="registeringfaulted"||t.remoteControlState()==="registered"?4:-1),s(),C(t.remoteControlState()==="connected"||t.remoteControlState()==="enabled"?5:-1),s(),C(t.remoteControlState()==="disabled"?6:-1)}}function he(a,e){if(a&1){let t=_();n(0,"option",33),m("click",function(){let l=u(t).$implicit,g=c();return d(g.pauseSettings.controls.timeType.setValue(l.value))}),r(1),o()}if(a&2){let t=e.$implicit;S("value",t.value),s(),b(" ",t.label," ")}}function be(a,e){if(a&1){let t=_();n(0,"option",33),m("click",function(){let l=u(t).$implicit,g=c();return d(g.pauseSettings.controls.time.setValue(l))}),r(1),o()}if(a&2){let t=e.$implicit;S("value",t),s(),E(t)}}function ve(a,e){if(a&1){let t=_();n(0,"option",33),m("click",function(){let l=u(t).$implicit,g=c();return d(g.settingsForm.controls.usageStatistics.setValue(l.value))}),r(1),o()}if(a&2){let t=e.$implicit;S("value",t.value),s(),b(" ",t.label," ")}}var f=new X,pe=[{value:"s",label:"Seconds"},{value:"m",label:"Minutes"},{value:"h",label:"Hours"}],V=[{value:"en",label:"English"},{value:"fr",label:"French"},{value:"de",label:"German"},{value:"es",label:"Spanish"},{value:"it",label:"Italian"}],ce=[{value:"",label:"System default (information)"},{value:"information",label:"Usage statistics, warnings, errors, and crashes"},{value:"warning",label:"Warnings, errors and crashes"},{value:"error",label:"Errors and crashes"},{value:"crash",label:"Crashes only"},{value:"none",label:"None / disabled"}],P=class a{#i=y(le);#o=y(re);#e=y(oe);sysinfo=this.#o.systemInfo;isDarkMode=this.#i.isDarkMode;editAs=h("list");settingsForm=f.group({pauseSettings:f.group({time:f.control(0),timeType:f.control("s")}),language:f.control("en"),usageStatistics:f.control(""),updateChannel:f.control(""),remoteControlRegisterUrl:f.control("")});remoteControlState=h("unknown");remoteControlClaimUrl=h(null);sysInfoEffect=B(()=>{this.settingsForm.controls.remoteControlRegisterUrl.patchValue(this.sysinfo()?.RemoteControlRegistrationUrl??"")},{allowSignalWrites:!0});get pauseSettings(){return this.settingsForm.controls.pauseSettings}langSignal=se(this.settingsForm.controls.language.valueChanges);timeTypeOptions=h(pe);timeOptions=me([this.pauseSettings.controls.timeType.valueChanges.pipe(v("s")),this.pauseSettings.controls.time.valueChanges.pipe(v(null))],F(U(([e,t])=>{let i=this.#r(e);return t!==null?i.filter(l=>l.toString().includes(t.toString())):i}),v([])));languageOptions=G(()=>this.langSignal()?V.filter(e=>e.value===this.langSignal()):V);usageStatisticsOptions=h(ce);ngOnInit(){this.refreshRemoteControlStatus(),this.getServerSettings()}submit(){let e=`${this.pauseSettings.controls.time.value}${this.pauseSettings.controls.timeType.value}`;this.#e.patchApiV1Serversettings({requestBody:{"usage-reporter-level":this.settingsForm.controls.usageStatistics.value,"startup-delay":e==="0s"?"":e,"update-channel":this.settingsForm.controls.updateChannel.value}}).subscribe({next:t=>{console.log("res",t)},error:t=>{console.error("err",t)}})}getServerSettings(){return this.#e.getApiV1Serversettings().subscribe({next:e=>{let t=e["startup-delay"];this.settingsForm.patchValue({pauseSettings:{time:parseInt(t.substring(0,t.length-1)==""?"0":t.substring(0,t.length-1)),timeType:t.substring(-1)===""?"s":t.substring(-1)},usageStatistics:e["usage-reporter-level"],updateChannel:e["update-channel"]})}})}languageDisplay(e){return e?V.find(t=>t.value===e)?.label??null:null}typeDisplay(e){return e==null?null:pe.find(t=>t.value===e)?.label??null}usageDisplay(e){return typeof e!="string"?null:ce.find(t=>t.value===e)?.label??null}setDarkMode(){this.#i.setDarkMode()}setLightMode(){this.#i.setLightMode()}#r(e){let t=e==="h"?25:61;return new Array(t).fill(0).map((i,l)=>l)}repeatRegisterTimer=null;#t(e){e.RegistrationUrl&&this.remoteControlClaimUrl.set(e.RegistrationUrl),console.log(e),e.IsConnected?this.remoteControlState.set("connected"):e.IsEnabled?this.remoteControlState.set("enabled"):e.CanEnable?this.remoteControlState.set("disabled"):e.IsRegisteringFaulted?this.remoteControlState.set("registeringfaulted"):e.IsRegistering?e.RegistrationUrl!=null&&e.RegistrationUrl.trim().length>0?this.remoteControlState.set("registered"):this.remoteControlState.set("registering"):this.remoteControlState.set("inactive");let t=this.remoteControlState();console.log(t),this.repeatRegisterTimer!==null&&(clearTimeout(this.repeatRegisterTimer),this.repeatRegisterTimer=null),t==="registering"&&(this.repeatRegisterTimer=setTimeout(()=>{this.#e.postApiV1RemotecontrolRegister({requestBody:{RegistrationUrl:""}}).subscribe({next:i=>{this.#t(i)},error:i=>{this.#n(i)}})},5e3)),(t==="enabled"||t==="registered")&&(this.repeatRegisterTimer=setTimeout(()=>{this.#e.getApiV1RemotecontrolStatus().subscribe({next:i=>{this.#t(i)},error:i=>{this.#n(i)}})},5e3)),e.IsRegistering&&e.CanEnable&&this.#e.deleteApiV1RemotecontrolRegister().subscribe({next:i=>{this.#t(i)}})}#n(e){this.#e.getApiV1RemotecontrolStatus().subscribe({next:t=>{this.#t(t)}})}refreshRemoteControlStatus(){this.#e.getApiV1RemotecontrolStatus().subscribe({next:e=>{this.#t(e)},error:e=>{this.#n(e)}})}beginRemoteRegistration(){this.remoteControlState.set("registering");let e=this.settingsForm.controls.remoteControlRegisterUrl.value;this.#e.postApiV1RemotecontrolRegister({requestBody:{RegistrationUrl:e}}).subscribe({next:t=>{this.#t(t)},error:t=>{this.#n(t)}})}cancelRemoteRegistration(){this.#e.deleteApiV1RemotecontrolRegister().subscribe({next:e=>{this.#t(e)},error:e=>{this.#n(e)}})}enableRemoteControl(){this.#e.postApiV1RemotecontrolEnable().subscribe({next:e=>{this.#t(e)},error:e=>{this.#n(e)}})}disableRemoteControl(){this.#e.postApiV1RemotecontrolDisable().subscribe({next:e=>{this.#t(e)},error:e=>{this.#n(e)}})}deleteRemoteControl(){let e=this;confirm("Are you sure you want to delete the remote control registration?")&&e.#e.deleteApiV1RemotecontrolRegistration().subscribe({next:t=>{e.#t(t)},error:t=>{e.#n(t)}})}getRemoteControlStatusText(){let e=this.remoteControlState();return e==="enabled"?"Remote control is enabled but not connected":e==="connected"?"Remote control is connected":e==="registering"?"Registering machine...":e==="registeringfaulted"?"Registration failed":e==="registered"?"Registered, waiting for accept":e==="disabled"?"Remote control is configured but not enabled":e==="unknown"?"...loading...":"Remote control is not set up"}static \u0275fac=function(t){return new(t||a)};static \u0275cmp=I({type:a,selectors:[["app-settings"]],standalone:!0,features:[A],decls:100,vars:11,consts:[[1,"content",3,"submit","formGroup"],[1,"title"],["type","submit","spk-button","",1,"raised","primary"],[1,"left"],[1,"right","remote-control"],[1,"field-row"],[1,"right"],["formGroupName","pauseSettings",1,"field-row"],[3,"displayValue"],["type","text","formControlName","timeType"],["options",""],[3,"value"],["type","search","formControlName","time"],[1,"themes"],["src","/assets/images/light-theme.png","alt","light theme",3,"click"],["src","/assets/images/dark-theme.png","alt","dark theme",3,"click"],[1,"right","radios"],[1,"radio-option",3,"click"],[1,"outlined","primary"],["type","radio","name","updateChannel","value","","formControlName","updateChannel"],["type","radio","name","updateChannel","value","stable","formControlName","updateChannel"],["type","radio","name","updateChannel","value","beta","formControlName","updateChannel"],["type","radio","name","updateChannel","value","experimental","formControlName","updateChannel"],["type","radio","name","updateChannel","value","canary","formControlName","updateChannel"],["href","#"],["type","text","formControlName","usageStatistics"],[1,"field-col"],["type","button","spk-button","",1,"raised"],["label","Registration URL","for","remoteControlRegisterUrl"],["type","text","spk-input","","id","remoteControlRegisterUrl","name","remoteControlRegisterUrl","formControlName","remoteControlRegisterUrl"],["type","button","spk-button","",1,"raised",3,"click"],["target","_blank",3,"href"],["type","button","spk-button","",1,"raised","warn",3,"click"],[3,"click","value"]],template:function(t,i){if(t&1&&(p(0,"app-status-bar"),n(1,"form",0),m("submit",function(){return i.submit()}),n(2,"header")(3,"div",1)(4,"h2"),r(5,"Settings"),o(),n(6,"p"),r(7,"Configure your backup settings."),o()(),n(8,"button",2),r(9,"Save changes"),o()(),n(10,"section")(11,"div",3)(12,"h3"),r(13,"Remote access control"),o(),n(14,"p"),r(15),o()(),n(16,"div",4),O(17,Se,7,6,"div",5),o()(),n(18,"section")(19,"div",3)(20,"h3"),r(21,"Pause after startup or hibernation"),o(),n(22,"p"),r(23," Duplicati will run when started, but will remain in paused state for the duration. Duplicati will occupy minimal system resources and no backups will be run. "),o()(),n(24,"div",6)(25,"div",7)(26,"spk-select",8),p(27,"input",9),R(28,10),T(29,he,2,2,"option",11,x),w(),o(),n(31,"spk-select"),p(32,"input",12),R(33,10),T(34,be,2,2,"option",11,x),w(),o()()()(),n(36,"section")(37,"div",3)(38,"h3"),r(39,"Color theme"),o(),n(40,"p"),r(41,"Customize your application theme"),o()(),n(42,"div",6)(43,"div",13)(44,"img",14),m("click",function(){return i.setLightMode()}),o(),n(45,"img",15),m("click",function(){return i.setDarkMode()}),o()()()(),n(46,"section")(47,"div",3)(48,"h3"),r(49,"Update channel"),o(),n(50,"p"),r(51,"Lorem ipsum dolor sit amet, consectetur adipiscing elit."),o()(),n(52,"div",16)(53,"div",17),m("click",function(){return i.settingsForm.controls.updateChannel.setValue("")}),n(54,"spk-radio",18),r(55),p(56,"input",19),o(),n(57,"p"),r(58),o()(),n(59,"div",17),m("click",function(){return i.settingsForm.controls.updateChannel.setValue("stable")}),n(60,"spk-radio",18),r(61," Stable "),p(62,"input",20),o(),n(63,"p"),r(64,"Official releases"),o()(),n(65,"div",17),m("click",function(){return i.settingsForm.controls.updateChannel.setValue("beta")}),n(66,"spk-radio",18),r(67," Beta "),p(68,"input",21),o(),n(69,"p"),r(70," Try out the new features that we are working on. Currently the most stable version available. Test Restore data before using this in production environments. "),o()(),n(71,"div",17),m("click",function(){return i.settingsForm.controls.updateChannel.setValue("experimental")}),n(72,"spk-radio",18),r(73," Experimental "),p(74,"input",22),o(),n(75,"p"),r(76,"Specific builds for developers only. Not for use with important data."),o()(),n(77,"div",17),m("click",function(){return i.settingsForm.controls.updateChannel.setValue("canary")}),n(78,"spk-radio",18),r(79," Canary "),p(80,"input",23),o(),n(81,"p"),r(82,"Individual builds for developers only. Not for use with important data."),o()()()(),n(83,"section")(84,"div",3)(85,"h3"),r(86,"Usage statistics"),o(),n(87,"p"),r(88," Usage reports help us improve the user experience and evaluate impact of new features. We use them to generate "),n(89,"a",24),r(90,"public usage statistics."),o(),p(91,"br")(92,"br"),r(93," All usage reports are sent anonymously and do not contain any personal information. They contain information about hardware and operating system, the type of backend, backup duration, overall size of source data and similar data. They do not contain paths, filenames, usernames, passwords or similar sensitive information. "),o()(),n(94,"div",6)(95,"spk-select",8),p(96,"input",25),R(97,10),T(98,ve,2,2,"option",11,x),w(),o()()()()),t&2){let l,g;s(),S("formGroup",i.settingsForm),s(14),E(i.getRemoteControlStatusText()),s(2),C(i.remoteControlState()!=="unknown"?17:-1),s(9),S("displayValue",i.typeDisplay(i.settingsForm.value.pauseSettings==null?null:i.settingsForm.value.pauseSettings.timeType)),s(3),k(i.timeTypeOptions()),s(5),k(i.timeOptions()),s(10),M("active",!i.isDarkMode()),s(),M("active",i.isDarkMode()),s(10),b(" Default (",(l=i.sysinfo())==null?null:l.DefaultUpdateChannel,") "),s(3),b("Same as the base install version: ",(g=i.sysinfo())==null?null:g.ServerVersionType,""),s(37),S("displayValue",i.usageDisplay(i.settingsForm.controls.usageStatistics.value)),s(3),k(i.usageStatisticsOptions())}},dependencies:[Y,q,K,Q,L,z,$,W,Z,j,J,H,ae,ee,ne,te,ie],styles:["[_nghost-%COMP%]{display:block}.content[_ngcontent-%COMP%]{display:flex;flex-direction:column;padding:0 2rem 2rem}header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;padding:2rem 0}header[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.25rem}section[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem;padding:2rem 0;border-top:1px solid var(--base-level-40)}section[_ngcontent-%COMP%] .left[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.25rem;align-items:flex-start}section[_ngcontent-%COMP%] .left[_ngcontent-%COMP%] spk-button-group[_ngcontent-%COMP%]{margin-top:.25rem}section[_ngcontent-%COMP%] .left[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{text-wrap:balance;width:50%}.themes[_ngcontent-%COMP%]{display:flex;gap:.5rem}.themes[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{max-width:240px;border-radius:var(--shape-3);cursor:pointer}.themes[_ngcontent-%COMP%] img.active[_ngcontent-%COMP%]{border:2px solid var(--primary-500)}.radios[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem}.radio-option[_ngcontent-%COMP%]{cursor:pointer}.radio-option[_ngcontent-%COMP%] spk-radio[_ngcontent-%COMP%]{color:var(--base-level-60);margin-bottom:.25rem}.radio-option[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{text-wrap:balance;color:var(--base-level-60R)}.field-col[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.field-row[_ngcontent-%COMP%]{display:flex;gap:.5rem;width:100%}.field-row[_ngcontent-%COMP%] spk-form-field[_ngcontent-%COMP%], .field-row[_ngcontent-%COMP%] spk-select[_ngcontent-%COMP%]{flex:1 0}.remote-control[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{white-space:nowrap}"],changeDetection:0})};export{P as default};
@@ -1 +1 @@
1
- import{a as Ue,b as ge}from"./chunk-57M4MADC.js";import{b as Se}from"./chunk-ZD3JEKWI.js";import{a as we,b as H,c as he,d as Y,e as Z,f as J,g as ue,i as X,j as _e,k as Le,l as ee,m as te,n as ne,o as I,q as ie}from"./chunk-7X6SBNMU.js";import{a as Ce}from"./chunk-LVLU6MPQ.js";import{a as oe,d as fe,f as ft,h as ae,j as ze,m as Ct,n as re,q as De}from"./chunk-S76TN27U.js";import{a as K,c as M}from"./chunk-N5US3SKW.js";import{a as gt}from"./chunk-PH6AAOK4.js";import{$ as z,Cb as j,Db as q,Eb as xe,F as lt,Fb as l,Gb as G,Hb as A,I as ye,Jb as ct,Lb as Q,N as st,Nb as Be,Pb as $e,Qa as s,T as be,Tb as dt,Wa as S,Xa as U,Z as h,a as se,b as Me,bb as f,bc as W,c as rt,cb as $,db as d,fb as mt,hb as _,ib as w,ja as C,jb as D,ka as g,kb as T,lb as a,mb as o,nb as p,nc as ut,ob as k,pb as v,qb as Re,rb as b,sb as y,tb as m,wb as me,wc as _t,xb as O,yb as pt}from"./chunk-ORDBF5MR.js";var je=class t{fromString(n){if(!n)return null;let e=n.match(/(\d+)([smhDWMY])/);return e&&{value:parseInt(e[1]),unit:e[2]}}toString(n,e){return`${n}${e}`}static \u0275fac=function(e){return new(e||t)};static \u0275prov=be({token:t,factory:t.\u0275fac,providedIn:"root"})};var ve=new I,Pe={file:{customFields:{path:{type:"file-tree",name:"path",shortDescription:"File path",longDescription:"The path to store the backup",formElement:t=>ve.control(t??"")}}},ssh:{customFields:{server:{type:"String",name:"server",shortDescription:"Server",longDescription:"The server to connect to",formElement:t=>ve.control(t??"")},port:{type:"Integer",name:"port",shortDescription:"Port",longDescription:"The port to connect to",formElement:t=>ve.control(t??"")},path:{type:"Path",name:"path",shortDescription:"File path on the server",longDescription:"File path on the server",formElement:t=>ve.control(t??"")}},dynamicFields:["auth-username"]},s3:{customFields:{path:{type:"Path",name:"path",shortDescription:"File path on the server",longDescription:"File path on the server",formElement:t=>ve.control(t??"")},bucket:{type:"String",name:"bucket",shortDescription:"Bucket name",longDescription:"Bucket name",formElement:t=>ve.control(t??"")}},dynamicFields:["use-ssl","s3-server-name","auth-username","auth-password"]},gcs:{dynamicFields:["gcs-location","gcs-storage-class","authid"]},googledrive:{oauthField:"authid",customFields:{path:{type:"Path",name:"path",shortDescription:"File path on the server",longDescription:"File path on the server",formElement:t=>ve.control(t??"")}},dynamicFields:["authid"]}};function Te(t,n){let e={},i={};return n.searchParams.forEach((r,c)=>{Pe[t].dynamicFields?.includes(c)?i[c]=decodeURIComponent(r):e[c]=decodeURIComponent(r)}),{advanced:e,dynamic:i}}function Ie(t){let n=t.map(([e,i])=>`${e}=${i?encodeURIComponent(i.toString()):""}`).join("&");return n?"?"+n:""}var Ee={file:{to:t=>{let n=Ie([...Object.entries(t.advanced),...Object.entries(t.dynamic)]);return`${t.destinationType}://${t.custom.path}${n}`},from:(t,n,e)=>{let i=e.indexOf("file:///")===0,r=e.split(i?"///":"//")[1].substring(0,1)+n.hostname.substring(1);return se({destinationType:t,custom:{path:`${i?"/":""}${r}${n.pathname}`}},Te(t,n))}},ssh:{to:t=>{let n=Ie([...Object.entries(t.advanced),...Object.entries(t.dynamic)]);return`${t.destinationType}://${t.custom.server}${t.custom.port?":"+t.custom.port:""}${t.custom.path.startsWith("/")?t.custom.path:"/"+t.custom.path}${n}`},from:(t,n,e)=>se({destinationType:t,custom:{server:n.hostname,port:n.port,path:n.pathname}},Te(t,n))},s3:{to:t=>{let n=Ie([...Object.entries(t.advanced),...Object.entries(t.dynamic)]);return`${t.destinationType}://${t.custom.bucket}${t.custom.path}${n}`},from:(t,n,e)=>se({destinationType:t,custom:{path:n.pathname,bucket:n.hostname}},Te(t,n))},gcs:{to:t=>{let n=t.dynamic["gcs-location"]??"";delete t.dynamic["gcs-location"];let e=Ie([...Object.entries(t.advanced),...Object.entries(t.dynamic)]);return`${t.destinationType}://${n}${e}`},from:(t,n,e)=>{let{advanced:i,dynamic:r}=Te(t,n);return{destinationType:t,advanced:i,dynamic:Me(se({},r),{"gcs-location":n.hostname+n.pathname})}}},googledrive:{to:t=>{let n=t.custom.path,e=Ie([...Object.entries(t.advanced),...Object.entries(t.dynamic)]);return`${t.destinationType}://${n}${e}`},from:(t,n,e)=>{let i=e.replace("googledrive://","");return se({destinationType:t,custom:{path:i}},Te(t,n))}},fallbackMapper:{to:t=>"",from:(t,n,e)=>se({destinationType:t},Te(t,n))}};function Oe(t){let n=t.destinationType;return!n||!Ee.hasOwnProperty(n)?Ee.fallbackMapper.to(t)??"":Ee[n].to(t)??""}function yt(t){let n=URL.canParse(t),e=t.split("://")[0],i="http://"+t.split("://")[1],r=new URL(i);if(!Ee.hasOwnProperty(e))return Ee.fallbackMapper.from(e,r);if(!n)throw new Error("Invalid target path");return Ee[e].from(e,r,t)}var Dt=/[a-zA-Z0-9_\-\+\.]/,qe=class t{generate(n,e=Dt){let i=this;return Array.apply(null,{length:n}).map(()=>{let r;for(;;)if(r=String.fromCharCode(i.#e()),e.test(r))return r},this).join("")}#e(){if(window.crypto&&window.crypto.getRandomValues){let n=new Uint8Array(1);return window.crypto.getRandomValues(n),n[0]}else if(window.msCrypto&&window.msCrypto.getRandomValues){let n=new Uint8Array(1);return window.msCrypto.getRandomValues(n),n[0]}else return Math.floor(Math.random()*256)}static \u0275fac=function(e){return new(e||t)};static \u0275prov=be({token:t,factory:t.\u0275fac,providedIn:"root"})};function Ye(t,n,e="conditional"){return i=>{if(!i.parent)return null;let r=null;if(t(i.parent)&&(r=(Array.isArray(n)?n:[n]).find(F=>F(i)!==null)??null),e&&r){let c={};c[e]=r,r=c}return r}}function xt(){return t=>(t.parent&&Object.values(t.parent.controls).forEach(n=>{n!==t&&n.updateValueAndValidity()}),null)}var Tt=["formRef"];function Et(t,n){if(t&1&&(a(0,"option",14),l(1),o()),t&2){let e=n.$implicit;d("value",e.Key),s(),G(e.DisplayName)}}function Ot(t,n){t&1&&(a(0,"spk-icon"),l(1,"eye-slash"),o(),l(2," hide "))}function Nt(t,n){t&1&&(a(0,"spk-icon"),l(1,"eye"),o(),l(2," show "))}function Vt(t,n){t&1&&(a(0,"spk-icon",23),l(1,"check"),o())}function Pt(t,n){t&1&&(a(0,"spk-icon"),l(1,"copy"),o())}function It(t,n){if(t&1){let e=b();a(0,"button",22),y("click",function(){C(e);let r=m(3);return g(r.copyPassword())}),f(1,Vt,2,0,"spk-icon",23)(2,Pt,2,0,"spk-icon"),l(3),o()}if(t&2){let e=m(3);s(),_(e.copiedPassword()?1:2),s(2),A(" ",e.copiedPassword()?"Copied":"Copy"," password ")}}function Gt(t,n){if(t&1){let e=b();a(0,"div",15)(1,"spk-form-field")(2,"label",16),l(3,"Create a password"),o(),p(4,"input",17),o(),a(5,"spk-form-field"),p(6,"input",18),o(),a(7,"div",19)(8,"button",20),y("click",function(){C(e);let r=m(2);return g(r.showPassword.set(!r.showPassword()))}),f(9,Ot,3,0)(10,Nt,3,0),o(),a(11,"button",20),y("click",function(){C(e);let r=m(2);return g(r.generatePassword())}),a(12,"spk-icon"),l(13,"password"),o(),l(14," Generate password "),o(),f(15,It,4,2,"button",21),o()()}if(t&2){let e=m(2);s(4),d("type",e.showPassword()?"text":"password"),s(2),d("type",e.showPassword()?"text":"password"),s(3),_(e.showPassword()?9:10),s(6),_(e.showCopyPassword()?15:-1)}}function At(t,n){if(t&1&&(a(0,"spk-select",10)(1,"label",11),l(2,"Encryption"),o(),p(3,"input",12),k(4,13),D(5,Et,2,2,"option",14,w),v(),o(),f(7,Gt,16,4,"div",15)),t&2){let e,i=m();d("displayValue",i.displayFn((e=i.generalForm.value.encryption)!==null&&e!==void 0?e:"")),s(5),T(i.encryptionOptions()),s(2),_(i.encryptionFieldSignal()!=="none"?7:-1)}}var Ne=new I,ht=(t={name:"",description:"",encryption:"none",password:"",repeatPassword:""})=>Ne.group({name:Ne.control(t.name,[he.required]),description:Ne.control(t.description),encryption:Ne.control(t.encryption,[he.required,xt()]),password:Ne.control(t.password,[Ye(n=>n?.value.encryption!=="none",[he.required])]),repeatPassword:Ne.control(t.repeatPassword,[Ye(n=>n?.value.encryption!=="none",[he.required])])}),Je={Key:"none",DisplayName:"None"},Ze=class t{#e=h(M);#t=h(K);#n=h(qe);#i=h(R);#o=h(Ce);formRef=U.required("formRef");generalForm=this.#i.generalForm;encryptionFieldSignal=this.#i.encryptionFieldSignal;encryptionOptions=this.#i.encryptionOptions;isNew=this.#i.isNew;showPassword=S(!1);copiedPassword=S(!1);showCopyPassword=S(!1);ngOnInit(){this.formRef().nativeElement.focus()}exit(){this.#i.exit()}async copyPassword(){let n=this.generalForm.controls.password.value;await this.#a(n??""),this.copiedPassword.set(!0)}async#a(n){try{await navigator.clipboard.writeText(n)}catch{try{let i=document.createElement("textarea");i.value=n,document.body.appendChild(i),i.select(),document.execCommand("copy"),document.body.removeChild(i)}catch(i){console.error("Failed to copy text: ",i)}}}displayFn(n){let e=this.#o.systemInfo()?.EncryptionModules??[],i=[Je,...e].find(r=>r.Key===n);return i?`${i.DisplayName}`:""}generatePassword(){this.copiedPassword.set(!1);let n=this.#n.generate(16);this.generalForm.controls.password.setValue(n),this.generalForm.controls.repeatPassword.setValue(n),this.showCopyPassword.set(!0)}next(){this.#e.navigate(["destination"],{relativeTo:this.#t.parent})}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=z({type:t,selectors:[["app-general"]],viewQuery:function(e,i){e&1&&j(i.formRef,Tt,5),e&2&&q()},standalone:!0,features:[Q],decls:23,vars:4,consts:[["formRef",""],["autocomplete","off",3,"submit","formGroup"],[1,"title-30"],["for","backupName"],["type","text","tabindex","1","placeholder","Your backup name","formControlName","name"],["for","backupDescription"],["id","backupDescription","tabindex","2","placeholder","Your backup description","formControlName","description"],[1,"form-actions"],["spk-button","",3,"click"],["spk-button","","type","submit",1,"raised","primary",3,"disabled"],[3,"displayValue"],["for","encryption"],["type","text","id","encryption","tabindex","3","placeholder","Encryption","formControlName","encryption"],["options",""],[3,"value"],[1,"passwords"],["for","password"],["id","password","tabindex","4","placeholder","Password","formControlName","password",3,"type"],["id","repeatPassword","tabindex","5","placeholder","Repeat password","formControlName","repeatPassword",3,"type"],[1,"password-actions"],["spk-button","","type","button",1,"small",3,"click"],["spk-button","","type","button",1,"small","copy"],["spk-button","","type","button",1,"small","copy",3,"click"],[1,"spk-success"]],template:function(e,i){if(e&1){let r=b();a(0,"form",1,0),y("submit",function(){return C(r),g(i.next())}),a(2,"h3",2),l(3,"General backup settings"),o(),a(4,"spk-form-field")(5,"label",3),l(6,"Backup name"),o(),p(7,"input",4),o(),a(8,"spk-form-field")(9,"label",5),l(10,"Backup description"),o(),p(11,"textarea",6),o(),f(12,At,8,2),a(13,"div",7)(14,"button",8),y("click",function(){return C(r),g(i.exit())}),a(15,"spk-icon"),l(16,"arrow-left"),o(),l(17," Exit "),o(),a(18,"div")(19,"button",9)(20,"spk-icon"),l(21,"arrow-right"),o(),l(22," Continue "),o()()()()}e&2&&(d("formGroup",i.generalForm),s(12),_(i.isNew()?12:-1),s(6),$("spk-tooltip-primary",i.generalForm.valid&&i.encryptionFieldSignal()==="none"||i.copiedPassword()?void 0:"Remember to copy the password"),s(),d("disabled",i.generalForm.invalid||i.encryptionFieldSignal()!=="none"&&i.showCopyPassword()&&!i.copiedPassword()))},dependencies:[ie,J,te,ne,H,Y,Z,X,ee,ae,re,fe,oe],styles:["[_nghost-%COMP%]{display:block}form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.passwords[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.password-actions[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:center}.form-actions[_ngcontent-%COMP%]{display:flex;justify-content:space-between}.copy[_ngcontent-%COMP%] spk-icon.spk-success[_ngcontent-%COMP%]{color:var(--success-500)}"],changeDetection:0})};var Mt=["formRef"];function Rt(t,n){if(t&1&&(a(0,"option",9),l(1),o()),t&2){let e=n.$implicit;d("value",e),s(),G(e)}}function Bt(t,n){if(t&1&&(a(0,"option",9),l(1),o()),t&2){let e=n.$implicit;d("value",e),s(),G(e)}}function $t(t,n){if(t&1){let e=b();a(0,"button",22),y("click",function(){let r=C(e).$implicit,c=m();return g(c.addNewOption(r))}),l(1),o()}if(t&2){let e=n.$implicit;s(),G(e.Name)}}function Lt(t,n){t&1&&(a(0,"label",23),l(1,"Name"),o())}function zt(t,n){t&1&&(a(0,"label",25),l(1,"Value"),o())}function Ut(t,n){if(t&1){let e=b();a(0,"div",18)(1,"spk-form-field"),f(2,Lt,2,0,"label",23),p(3,"input",24),o(),a(4,"spk-form-field"),f(5,zt,2,0,"label",25),p(6,"input",26),o(),a(7,"button",27),y("click",function(){let r=C(e).$index,c=m();return g(c.optionsForm.controls.advancedOptions.removeAt(r))}),a(8,"spk-icon"),l(9,"x-circle"),o()()()}if(t&2){let e=n.$implicit,i=n.$index;d("formGroup",e),s(2),_(i===0?2:-1),s(3),_(i===0?5:-1)}}var pe=new I,jt=["Bytes","KB","MB","GB","TB","PB"],qt=["Local folder","Local drive","Remote drive","Cloud drive"],St=(t={remoteVolumeSize:0,size:"GB",backupRetention:"Local folder",advancedOptions:[]})=>pe.group({remoteVolumeSize:pe.group({size:pe.control(t.remoteVolumeSize),unit:pe.control(t.size)}),backupRetention:pe.control(t.backupRetention),advancedOptions:pe.array([])}),et=(t,n)=>pe.group({name:pe.control(t),value:pe.control(n)}),Xe=class t{#e=h(Ce);#t=h(R);#n=h(M);#i=h(K);formRef=U.required("formRef");optionsForm=this.#t.optionsForm;sizeOptions=S(jt);rentationOptions=S(qt);selectionAdvancedOptions=Se(this.optionsForm.controls.advancedOptions.valueChanges.pipe(st([])));advancedOptions=S(this.#e.systemInfo()?.Options??[]);nonSelectedAdvancedOptions=W(()=>this.advancedOptions().filter(n=>this.selectionAdvancedOptions()?.findIndex(e=>e.name===n.Name)===-1));addNewOption(n){this.optionsForm.controls.advancedOptions.push(et(n.Name,n.DefaultValue))}displayFn(){let n=this.advancedOptions();return e=>{let i=n.find(r=>r.Name===e);return i?`${i.Name}`:""}}goBack(){this.#n.navigate(["schedule"],{relativeTo:this.#i.parent})}submit(){this.#t.submit()}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=z({type:t,selectors:[["app-options"]],viewQuery:function(e,i){e&1&&j(i.formRef,Mt,5),e&2&&q()},standalone:!0,features:[Q],decls:49,vars:2,consts:[["formRef",""],[3,"submit","formGroup"],[1,"title-30"],[1,"remote-volume-wrap"],["formGroupName","remoteVolumeSize",1,"row-inputs"],["for","size"],["type","number","id","size","formControlName","size"],["type","text","placeholder","Select an option...","formControlName","unit"],["options",""],[3,"value"],["href","#",1,"spk-primary"],["type","text","placeholder","Local folder or drive","formControlName","backupRetention"],[3,"disallowToggle"],["title",""],["spk-button","","type","button",1,"outlined","small"],["menu",""],["spk-menu-item","","type","button"],["formArrayName","advancedOptions"],[1,"advanced-option",3,"formGroup"],[1,"form-actions"],["spk-button","","type","button",3,"click"],["spk-button","","type","submit",1,"raised","primary"],["spk-menu-item","","type","button",3,"click"],["for","name"],["type","text","id","name","formControlName","name"],["for","value"],["type","text","id","value","formControlName","value"],["spk-button","","type","button",1,"icon",3,"click"]],template:function(e,i){if(e&1){let r=b();a(0,"form",1,0),y("submit",function(){return C(r),g(i.submit())}),a(2,"h3",2),l(3,"Options"),o(),a(4,"div",3)(5,"div",4)(6,"spk-form-field")(7,"label",5),l(8,"Remote volume size"),o(),p(9,"input",6),o(),a(10,"spk-select"),p(11,"input",7),k(12,8),D(13,Rt,2,2,"option",9,w),v(),o()(),a(15,"p"),l(16," The backups will be split up into multiple files called volumes. Here you can set the maximum size of the individual volume files. "),a(17,"a",10),l(18,"Read more"),o()()(),a(19,"spk-select")(20,"label",5),l(21,"Backup retention"),o(),p(22,"input",11),k(23,8),D(24,Bt,2,2,"option",9,w),v(),o(),a(26,"app-toggle-card",12),k(27,13),l(28," Advanced options "),a(29,"spk-menu")(30,"button",14),l(31," Add advanced option "),a(32,"spk-icon"),l(33,"plus"),o()(),k(34,15),D(35,$t,2,1,"button",16,w),v(),o(),v(),k(37,17),D(38,Ut,10,3,"div",18,w),v(),o(),a(40,"div",19)(41,"button",20),y("click",function(){return C(r),g(i.goBack())}),a(42,"spk-icon"),l(43,"arrow-left"),o(),l(44," Go back "),o(),a(45,"button",21)(46,"spk-icon"),l(47,"arrow-right"),o(),l(48," Submit "),o()()()}e&2&&(d("formGroup",i.optionsForm),s(13),T(i.sizeOptions()),s(11),T(i.rentationOptions()),s(2),d("disallowToggle",!0),s(9),T(i.nonSelectedAdvancedOptions()),s(3),T(i.optionsForm.controls.advancedOptions.controls))},dependencies:[ie,J,te,ne,H,ue,Y,Z,X,ee,_e,Le,ze,re,fe,oe,ae,ge],styles:["[_nghost-%COMP%]{display:block}form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.remote-volume-wrap[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.25rem}.row-inputs[_ngcontent-%COMP%]{display:flex;align-items:flex-end;gap:.5rem}.row-inputs[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{flex:1 0}.advanced-option[_ngcontent-%COMP%]{display:grid;gap:.5rem;grid-template-columns:1fr 1fr 40px;align-items:flex-end}.form-actions[_ngcontent-%COMP%]{display:flex;justify-content:space-between}"],changeDetection:0})};var Qt=["formRef"];function Wt(t,n){if(t&1&&(a(0,"option",24),l(1),o()),t&2){let e=n.$implicit;d("value",e.key),s(),G(e.label)}}function Kt(t,n){if(t&1){let e=b();a(0,"div",11)(1,"spk-form-field")(2,"label",12),l(3,"Next time"),o(),a(4,"input",13,1),y("focus",function(){C(e);let r=xe(5);return g(r.showPicker())}),o(),a(6,"spk-icon",14),l(7,"clock"),o()(),a(8,"spk-form-field"),p(9,"label",15),a(10,"input",16,2),y("focus",function(){C(e);let r=xe(11);return g(r.showPicker())}),o(),a(12,"spk-icon",14),l(13,"calendar"),o()()(),k(14,17),a(15,"div",18)(16,"spk-form-field")(17,"label",19),l(18,"Run again every"),o(),p(19,"input",20),o(),a(20,"spk-select",21),p(21,"input",22),k(22,23),D(23,Wt,2,2,"option",24,w),v(),o()(),a(25,"app-toggle-card",25),k(26,26),l(27,"Allowed days"),v(),a(28,"div",27)(29,"spk-toggle",6),l(30," Monday "),p(31,"input",28),o(),a(32,"spk-toggle",6),l(33," Tuesday "),p(34,"input",29),o(),a(35,"spk-toggle",6),l(36," Wednesday "),p(37,"input",30),o(),a(38,"spk-toggle",6),l(39," Thursday "),p(40,"input",31),o(),a(41,"spk-toggle",6),l(42," Friday "),p(43,"input",32),o(),a(44,"spk-toggle",6),l(45," Saturday "),p(46,"input",33),o(),a(47,"spk-toggle",6),l(48," Sunday "),p(49,"input",34),o()()(),v()}if(t&2){let e=m();s(20),d("displayFn",e.displayFn),s(3),T(e.unitOptions),s(2),d("disallowToggle",!0)}}var V=new I,kt=[{key:"s",label:"Seconds"},{key:"m",label:"Minutes"},{key:"h",label:"Hours"},{key:"D",label:"Days"},{key:"W",label:"Weeks"},{key:"M",label:"Months"},{key:"Y",label:"Years"}],vt=(t={autoRun:!1,nextTime:{time:"13:00",date:new Date().toISOString().split("T")[0]},runAgain:{repeatValue:1,repeatUnit:"D",allowedDays:{mon:!1,tue:!1,wed:!1,thu:!1,fri:!1,sat:!1,sun:!1}}})=>V.group({autoRun:V.control(t.autoRun),nextTime:V.group({time:V.control(t.nextTime.time),date:V.control(t.nextTime.date)}),runAgain:V.group({repeatValue:V.control(t.runAgain.repeatValue),repeatUnit:V.control(t.runAgain.repeatUnit),allowedDays:V.group({mon:V.control(t.runAgain.allowedDays.mon),tue:V.control(t.runAgain.allowedDays.tue),wed:V.control(t.runAgain.allowedDays.wed),thu:V.control(t.runAgain.allowedDays.thu),fri:V.control(t.runAgain.allowedDays.fri),sat:V.control(t.runAgain.allowedDays.sat),sun:V.control(t.runAgain.allowedDays.sun)})})}),tt=class t{#e=h(R);#t=h(M);#n=h(K);formRef=U.required("formRef");scheduleForm=this.#e.scheduleForm;scheduleFormSignal=this.#e.scheduleFormSignal;unitOptions=kt;displayFn(n){let e=kt.find(i=>i.key===n);return e?`${e.label}`:""}goBack(){this.#t.navigate(["source-data"],{relativeTo:this.#n.parent})}next(){this.#t.navigate(["options"],{relativeTo:this.#n.parent})}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=z({type:t,selectors:[["app-schedule"]],viewQuery:function(e,i){e&1&&j(i.formRef,Qt,5),e&2&&q()},standalone:!0,features:[Q],decls:20,vars:2,consts:[["formRef",""],["timeRef",""],["dateRef",""],[3,"submit","formGroup"],[1,"title-30"],[1,"toggle-wrap"],[1,"raised","primary"],["type","checkbox","formControlName","autoRun"],[1,"form-actions"],["spk-button","","type","button",3,"click"],["spk-button","","type","submit",1,"raised","primary"],["formGroupName","nextTime",1,"row-inputs"],["for","time"],["type","time","id","time","formControlName","time",3,"focus"],["spkSuffix",""],["for","date"],["type","date","id","date","formControlName","date",3,"focus"],["formGroupName","runAgain"],[1,"row-inputs"],["for","repeatValue"],["type","number","id","repeatValue","formControlName","repeatValue"],[3,"displayFn"],["type","text","id","repeatUnit","formControlName","repeatUnit"],["options",""],[3,"value"],["formGroupName","allowedDays",3,"disallowToggle"],["title",""],[1,"days-wrap"],["type","checkbox","formControlName","mon"],["type","checkbox","formControlName","tue"],["type","checkbox","formControlName","wed"],["type","checkbox","formControlName","thu"],["type","checkbox","formControlName","fri"],["type","checkbox","formControlName","sat"],["type","checkbox","formControlName","sun"]],template:function(e,i){if(e&1){let r=b();a(0,"form",3,0),y("submit",function(){return C(r),g(i.next())}),a(2,"h3",4),l(3,"Schedule"),o(),a(4,"div",5)(5,"spk-toggle",6),l(6," Automatically run backups "),p(7,"input",7),o(),a(8,"p"),l(9,"If a date was missed, the job will run as soon as possible."),o()(),f(10,Kt,50,2),a(11,"div",8)(12,"button",9),y("click",function(){return C(r),g(i.goBack())}),a(13,"spk-icon"),l(14,"arrow-left"),o(),l(15," Go back "),o(),a(16,"button",10)(17,"spk-icon"),l(18,"arrow-right"),o(),l(19," Continue "),o()()()}if(e&2){let r;d("formGroup",i.scheduleForm),s(10),_((r=i.scheduleFormSignal())!=null&&r.autoRun?-1:10)}},dependencies:[ie,J,te,ne,H,ue,we,Y,Z,X,ee,_e,ae,re,De,oe,fe,ge],styles:["[_nghost-%COMP%]{display:block}form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.toggle-wrap[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.25rem}.row-inputs[_ngcontent-%COMP%]{display:flex;align-items:flex-end;gap:.5rem}.row-inputs[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{flex:1 0}.days-wrap[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.form-actions[_ngcontent-%COMP%]{display:flex;justify-content:space-between}"],changeDetection:0})};var Ht=["formRef"];function Yt(t,n){if(t&1&&(a(0,"option",21),l(1),o()),t&2){let e=n.$implicit;d("value",e),s(),G(e)}}function Zt(t,n){if(t&1&&(a(0,"div",14)(1,"spk-form-field"),p(2,"input",18),o(),a(3,"spk-select"),p(4,"input",19),k(5,20),D(6,Yt,2,2,"option",21,w),v(),o()()),t&2){let e=m(2);s(6),T(e.sizeOptions())}}function Jt(t,n){if(t&1){let e=b();a(0,"form",2,0),y("submit",function(){C(e);let r=m();return g(r.next())}),a(2,"h3",3),l(3,"Source Data"),o(),a(4,"app-file-tree",4)(5,"label",5),l(6,"Folder path"),o(),p(7,"input",6),o(),a(8,"app-toggle-card",7),k(9,8),l(10,"Exclude"),v(),a(11,"spk-toggle",9),l(12," Hidden files "),p(13,"input",10),o(),a(14,"spk-toggle",9),l(15," System files "),p(16,"input",11),o(),a(17,"spk-toggle",9),l(18," Temporary files "),p(19,"input",12),o(),a(20,"spk-toggle",13),y("click",function(){C(e);let r=m();return g(r.toggleFilesLargerThan())}),l(21," Files larger than "),o(),f(22,Zt,8,0,"div",14),o(),a(23,"div",15)(24,"button",16),y("click",function(){C(e);let r=m();return g(r.goBack())}),a(25,"spk-icon"),l(26,"arrow-left"),o(),l(27," Go back "),o(),a(28,"button",17)(29,"spk-icon"),l(30,"arrow-right"),o(),l(31," Continue "),o()()()}if(t&2){let e=m();d("formGroup",e.sourceDataForm),s(4),d("multiSelect",!0)("startingPath",e.getPath()),s(4),d("isActive",!0),s(12),mt("active",e.filesLargerThan()),s(2),_(e.filesLargerThan()?22:-1)}}var ce=new I,Xt=["Bytes","KB","MB","GB","TB","PB"],en=["Contains","Does not contain","Is greater than","Is less than"];var Ft=(t={path:"",excludes:{hidden:!1,system:!1,temporary:!1,filesLargerThan:null}})=>ce.group({path:ce.control(t.path),excludes:ce.group({hidden:ce.control(t.excludes.hidden),system:ce.control(t.excludes.system),temporary:ce.control(t.excludes.temporary),filesLargerThan:ce.group({size:ce.control(null),unit:ce.control(null)})})}),nt=class t{#e=h(R);#t=h(M);#n=h(K);formRef=U.required("formRef");sourceDataForm=this.#e.sourceDataForm;sourceDataFormSignal=this.#e.sourceDataFormSignal;destinationIsLoaded=this.#e.destinationIsLoaded;filesLargerThan=W(()=>this.sourceDataFormSignal()?.excludes?.filesLargerThan?.size!==null);sizeOptions=S(Xt);expressionOptions=S(en);getPath(){return this.sourceDataForm.value.path??null}toggleFilesLargerThan(){this.sourceDataForm.controls.excludes.value.filesLargerThan?.size===null?this.sourceDataForm.controls.excludes.controls.filesLargerThan.setValue({size:50,unit:"MB"}):this.sourceDataForm.controls.excludes.controls.filesLargerThan.setValue({size:null,unit:null})}goBack(){this.#t.navigate(["destination"],{relativeTo:this.#n.parent})}next(){this.#t.navigate(["schedule"],{relativeTo:this.#n.parent})}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=z({type:t,selectors:[["app-source-data"]],viewQuery:function(e,i){e&1&&j(i.formRef,Ht,5),e&2&&q()},standalone:!0,features:[Q],decls:1,vars:1,consts:[["formRef",""],[3,"formGroup"],[3,"submit","formGroup"],[1,"title-30"],[3,"multiSelect","startingPath"],["for","path"],["type","text","id","path","tabindex","4","placeholder","Path","formControlName","path"],["formGroupName","excludes",3,"isActive"],["title",""],[1,"raised","primary"],["type","checkbox","placeholder","Hidden files","formControlName","hidden"],["type","checkbox","placeholder","System files","formControlName","system"],["type","checkbox","placeholder","Temporary files","formControlName","temporary"],[1,"raised","primary",3,"click"],["formGroupName","filesLargerThan",1,"row-inputs"],[1,"form-actions"],["spk-button","","type","button",3,"click"],["spk-button","","type","submit",1,"raised","primary"],["type","number","formControlName","size"],["type","text","formControlName","unit","placeholder","Select an option..."],["options",""],[3,"value"]],template:function(e,i){e&1&&f(0,Jt,32,7,"form",1),e&2&&_(i.destinationIsLoaded()?0:-1)},dependencies:[ie,J,te,ne,H,ue,we,Y,Z,X,ee,_e,ae,oe,fe,re,De,Ue,ge],styles:["[_nghost-%COMP%]{display:block}form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.form-actions[_ngcontent-%COMP%]{display:flex;justify-content:space-between}.row-inputs[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr min-content;gap:.5rem}.filter-inputs[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:flex-end}.filter-inputs[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{flex:1 0}.filter-inputs[_ngcontent-%COMP%] .filter-removal[_ngcontent-%COMP%]{cursor:pointer;display:flex;align-items:center;justify-content:center;height:2.5rem;flex:0 0}"],changeDetection:0})};var L=new I,R=class t{#e=h(M);#t=h(Ce);#n=h(gt);#i=h(je);destinationOptions=this.#t.backendModules;backupId=S(null);isSubmitting=S(!1);loadingBackup=S(!1);loadingDefaults=S(!0);destinationIsLoaded=S(!1);isNew=W(()=>this.backupId()==="new");backupDefaults=S(null);generalForm=ht();sourceDataForm=Ft();scheduleForm=vt();destinationForm=bt();optionsForm=St();selectedAdvancedFormPair=S([]);notSelectedAdvancedFormPair=S([]);destinationFormPair=S({oauthField:null,custom:[],dynamic:[],advanced:[]});sourceDataFormSignal=Se(this.sourceDataForm.valueChanges);destinationFormSignal=Se(this.destinationForm.valueChanges);encryptionFieldSignal=Se(this.generalForm.controls.encryption.valueChanges);scheduleFormSignal=Se(this.scheduleForm.valueChanges);encryptionOptions=W(()=>{let n=this.#t.systemInfo()?.EncryptionModules??[];return[Je,...n]});init(n="new"){this.backupId.set(n),n!=="new"?this.getBackup(n):this.getDefaults()}submit(){this.isSubmitting.set(!0);let n=this.#m(),e=this.backupId();e==="new"||!e?this.#n.postApiV1Backups({requestBody:n}).pipe(ye(()=>this.isSubmitting.set(!1))).subscribe({next:i=>{console.log("submitted res",i),this.exit()},error:i=>{console.error("submitted error",i)}}):this.#n.putApiV1BackupById({id:e,requestBody:n}).pipe(ye(()=>this.isSubmitting.set(!1))).subscribe({next:i=>{console.log("submitted res",i),this.exit()},error:i=>{console.error("submitted error",i)}})}exit(){this.#d(),this.#e.navigate(["/"])}getDefaults(){this.loadingDefaults.set(!0),this.#n.getApiV1Backupdefaults().pipe(lt(1),ye(()=>this.loadingDefaults.set(!1))).subscribe({next:n=>{this.#r(n.Schedule),this.#s(n.Backup),this.backupDefaults.set(n),this.destinationIsLoaded.set(!0)}})}getBackup(n){this.loadingBackup.set(!0),this.#n.getApiV1BackupById({id:n}).pipe(ye(()=>this.loadingBackup.set(!1))).subscribe({next:e=>{this.#r(e.Schedule??null),e.Backup&&(this.#l(e.Backup),this.#a(e.Backup),this.#o(e.Backup),this.#s(e.Backup)),this.destinationIsLoaded.set(!0)}})}#o(n){let e=n.Sources??"",i=n.Filters?.map(N=>`${N.Include?"":"-"}${N.Expression}`)??[],r=n.Settings?.find(N=>N.Name==="--exclude-files-attributes")?.Value??"",c=n.Settings?.find(N=>N.Name==="--skip-files-larger-than")??null,F=c?.Value.replace(/[0-9]/g,"")??null,B=c?.Value.replace(/[^0-9]/g,"")??null,le={path:[...e,...i].join("\0"),excludes:{hiddenFiles:r.includes("hidden"),systemFiles:r.includes("system"),tempFiles:r.includes("temporary"),filesLargerThan:F&&B?{size:parseInt(B),unit:F.toUpperCase()}:null}};this.sourceDataForm.patchValue(le)}#a(n){let e=n.TargetURL?yt(n.TargetURL):null;e&&this.addDestinationFormGroup(e.destinationType,{custom:e.custom,dynamic:e.dynamic,advanced:e.advanced})}#l(n){let e=n.Settings?.find(r=>r.Name==="encryption-module"),i=e?.Value&&e.Value.length?e.Value:"none";this.generalForm.patchValue({name:n.Name??"",description:n.Description??"",encryption:i})}#r(n){if(!n){this.scheduleForm.patchValue({autoRun:!0});return}let e=this.#i.fromString(n.Repeat)??null,r={nextTime:this.#c(n.Time),runAgain:{repeatValue:e?.value??1,repeatUnit:e?.unit??"D",allowedDays:{mon:n.AllowedDays?.includes("mon")??!1,tue:n.AllowedDays?.includes("tue")??!1,wed:n.AllowedDays?.includes("wed")??!1,thu:n.AllowedDays?.includes("thu")??!1,fri:n.AllowedDays?.includes("fri")??!1,sat:n.AllowedDays?.includes("sat")??!1,sun:n.AllowedDays?.includes("sun")??!1}}};this.scheduleForm.patchValue(r)}#s(n){let e=["--no-encryption","--exclude-files-attributes","--skip-files-larger-than"];n.Settings?.forEach(i=>{if(i.Name==="encryption-module")return this.generalForm.controls.encryption.setValue(i.Value??"None");i.Name&&e.includes(i.Name)||i.Name&&i.Value&&this.optionsForm.controls.advancedOptions.push(et(i.Name,i.Value))})}mapPub(){this.#m()}#m(){let n=this.generalForm.value,e=this.optionsForm.value,i=this.scheduleForm.value,r=this.sourceDataForm.value,F=this.destinationForm.value.destinations?.length?this.#p(this.destinationForm.controls.destinations):[],B=null;i.runAgain?.repeatUnit&&i.runAgain?.repeatValue&&(B=this.#i.toString(i.runAgain.repeatValue,i.runAgain.repeatUnit));let le=i.runAgain?.allowedDays?Object.entries(i.runAgain?.allowedDays).filter(([x,E])=>E).map(([x,E])=>x):[],N=r.path?.split("\0")??[],Ge=e.advancedOptions?.map(x=>({Name:x.name??null,Value:x.value&&x.value.length?x.value.toString():null}))??[],Fe=[n.encryption==="none"?{Name:"--no-encryption",Value:"True"}:{Name:"encryption-module",Value:n.encryption??null},...Ge.filter(x=>x.Name&&x.Value)],P=Object.entries(r.excludes??{}).filter(([x,E])=>E&&x!=="filesLargerThan").map(([x])=>x),u=r.excludes?.filesLargerThan;return P.length&&Fe.push({Name:"--exclude-files-attributes",Value:P.join(",")}),u&&u.size!==null&&u.unit!==null&&Fe.push({Name:"--skip-files-larger-than",Value:`${u.size}${u.unit}`}),{Backup:{Name:n.name,Description:n.description,TargetURL:F[0]??null,Sources:N.filter(x=>!x.startsWith("-")),Settings:Fe,Filters:N.filter(x=>x.startsWith("-")).map((x,E)=>({Order:E,Include:!1,Expression:x.slice(1)}))},Schedule:i.autoRun?null:{Repeat:B,Time:i.nextTime?.date?new Date(`${i.nextTime.date}T${i.nextTime?.time||"00:00:00"}`).toISOString():null,AllowedDays:le}}}#p(n){return n.controls.map(e=>{if(!e.controls.advanced)return Oe(e.value);let i=Object.keys(e.controls.advanced.controls).filter(r=>e.controls.advanced.controls[r].dirty);return Oe(Me(se({},e.value),{advanced:i.reduce((r,c)=>(r[c]=e.controls.advanced.controls[c].value,r),{})}))})}#c(n){if(!n||n?.indexOf("T")===-1)return{time:n??"13:00"};let e=new Date(n),i={time:`${(""+e.getHours()).padStart(2,"0")}:${(""+e.getMinutes()).padStart(2,"0")}`};return n.indexOf("T")!==-1&&(i.date=e.toISOString().split("T")[0]),i}addDestinationFormGroup(n,e){let i=this.destinationOptions().find(P=>P.Key===n);if(!i||!i.Options)return;let r=Pe.hasOwnProperty(n)&&Pe[n],c=r&&r.customFields?r.customFields:{},F=r&&r.dynamicFields?r.dynamicFields:[],B=r&&r.advancedFields?r.advancedFields:[],le=r&&r.oauthField?r.oauthField:null;this.destinationFormPair.set({oauthField:le,custom:[],dynamic:[],advanced:[]}),this.selectedAdvancedFormPair.set([]);let N=L.group({}),Ge=L.group({}),He=L.group({});if(c)for(n in c){let Fe=c[n],{formElement:P}=Fe,u=rt(Fe,["formElement"]);N.addControl(n,P(e?.custom[n])),this.destinationFormPair.update(x=>(x.custom.push(u),x))}for(let P=0;P<i.Options.length;P++){let u=i.Options[P];if(u.Deprecated)continue;let x=F.includes(u.Name),E=x?Ge:He;this.destinationFormPair.update(Ve=>(Ve[x?"dynamic":"advanced"].push({name:u.Name,type:u.Type,shortDescription:u.ShortDescription??void 0,longDescription:u.LongDescription??void 0,options:u.ValidValues}),Ve));let de=(x?e?.dynamic[u.Name]:e?.advanced[u.Name])??u.DefaultValue;if(u.Type==="String"||u.Type==="Password"||u.Type==="Enumeration"||u.Type==="Path"){E.addControl(u.Name,L.control(de));continue}if(u.Type==="Size"){let Ve=de.replace(/[0-9]/g,""),at=de.replace(/[^0-9]/g,"");E.addControl(u.Name,L.group({size:L.control(at?parseInt(at):50),unit:L.control(Ve?Ve.toUpperCase():"MB")}))}if(u.Type==="Integer"){E.addControl(u.Name,L.control(de?parseInt(de):0));continue}if(u.Type==="Boolean"){E.addControl(u.Name,L.control(de==="true"));continue}if(u.Type==="Flags"){E.addControl(u.Name,L.control(de??""));continue}u.Type==="Timespan"&&E.addControl(u.Name,L.control(de,[he.pattern(/([-+]?\d{1,3}[smhDWMY])+/)]))}this.destinationForm.controls.destinations.length!==0&&this.destinationForm.controls.destinations.removeAt(0),this.destinationFormPair.update(P=>({oauthField:P.oauthField,custom:P.custom,dynamic:P.dynamic.sort((u,x)=>F.indexOf(u.name)-F.indexOf(x.name)),advanced:P.advanced.sort((u,x)=>{let E=B.indexOf(u.name),Ae=B.indexOf(x.name);return E===-1&&Ae!==-1?1:E!==-1&&Ae===-1?-1:E-Ae})})),this.notSelectedAdvancedFormPair.set(this.destinationFormPair().advanced),this.destinationForm.controls.destinations.push(wt({key:i.Key,customGroup:N,dynamicGroup:Ge,advancedGroup:He}))}#d(){this.generalForm.reset(),this.sourceDataForm.reset(),this.scheduleForm.reset(),this.destinationForm.reset(),this.optionsForm.reset()}static \u0275fac=function(e){return new(e||t)};static \u0275prov=be({token:t,factory:t.\u0275fac,providedIn:"root"})};var tn=["formRef"],nn=(t,n,e,i)=>({destination:t,destinationType:n,index:e,formGroupName:"custom",oauthField:i}),ot=t=>({$implicit:t}),on=(t,n,e,i)=>({destination:t,destinationType:n,index:e,formGroupName:"dynamic",oauthField:i}),an=(t,n,e,i)=>({destination:t,destinationType:n,index:e,formGroupName:"advanced",oauthField:i});function rn(t,n){if(t&1){let e=b();a(0,"p",9),y("click",function(){C(e);let r=m(2);return g(r.removeDestinationFormGroup(r.destinationCount()-1))}),l(1," Wanna select another destination? "),a(2,"span",10),l(3,"Click here"),o()()}}function ln(t,n){if(t&1){let e=b();a(0,"div",11)(1,"div",12),y("click",function(){C(e);let r=m(2);return g(r.addDestinationFormGroup("file"))}),a(2,"h3"),l(3,"File system"),o(),a(4,"p"),l(5,"Store backups on your local file system."),o()(),a(6,"div",12),y("click",function(){C(e);let r=m(2);return g(r.addDestinationFormGroup("gcs"))}),a(7,"h3"),l(8,"Google Cloud Storage"),o(),a(9,"p"),l(10,"Store backups in Google Cloud Storage."),o()(),a(11,"div",12),y("click",function(){C(e);let r=m(2);return g(r.addDestinationFormGroup("s3"))}),a(12,"h3"),l(13,"S3 compatible bucket"),o(),a(14,"p"),l(15,"Store backups in any S3 compatible bucket."),o()(),a(16,"div",12),y("click",function(){C(e);let r=m(2);return g(r.addDestinationFormGroup("ssh"))}),a(17,"h3"),l(18,"SSH"),o(),a(19,"p"),l(20,"Store backups in SSH."),o()(),a(21,"div",12),y("click",function(){C(e);let r=m(2);return g(r.addDestinationFormGroup("googledrive"))}),a(22,"h3"),l(23,"Google Drive"),o(),a(24,"p"),l(25,"Store backups in Google Drive."),o()()(),a(26,"p"),l(27,"More destinations are coming soon."),o()}}function sn(t,n){t&1&&Re(0)}function mn(t,n){if(t&1&&f(0,sn,1,0,"ng-container",15),t&2){let e,i=n.$implicit,r=n.$index;m(2);let c=xe(6),F=m(2);d("ngTemplateOutlet",c)("ngTemplateOutletContext",Be(7,ot,$e(2,nn,i,(e=F.destinationFormSignal())==null||e.destinations==null||e.destinations[0]==null?null:e.destinations[0].destinationType,r,F.destinationFormPair().oauthField)))}}function pn(t,n){if(t&1&&(k(0),D(1,mn,1,9,"ng-container",null,w),v()),t&2){let e=m(3);s(),T(e.destinationFormPair().custom)}}function cn(t,n){t&1&&Re(0)}function dn(t,n){if(t&1&&f(0,cn,1,0,"ng-container",15),t&2){let e,i=n.$implicit,r=n.$index;m(2);let c=xe(6),F=m(2);d("ngTemplateOutlet",c)("ngTemplateOutletContext",Be(7,ot,$e(2,on,i,(e=F.destinationFormSignal())==null||e.destinations==null||e.destinations[0]==null?null:e.destinations[0].destinationType,r,F.destinationFormPair().oauthField)))}}function un(t,n){if(t&1&&(k(0),D(1,dn,1,9,"ng-container",null,w),v()),t&2){let e=m(3);s(),T(e.destinationFormPair().dynamic)}}function _n(t,n){if(t&1){let e=b();a(0,"button",20),y("click",function(){let r=C(e).$implicit,c=m(4);return g(c.addAdvancedFormPair(r))}),l(1),o()}if(t&2){let e=n.$implicit;s(),A(" ",e.name," ")}}function fn(t,n){t&1&&Re(0)}function Cn(t,n){if(t&1&&f(0,fn,1,0,"ng-container",15),t&2){let e,i=n.$implicit,r=n.$index;m(2);let c=xe(6),F=m(2);d("ngTemplateOutlet",c)("ngTemplateOutletContext",Be(7,ot,$e(2,an,i,(e=F.destinationFormSignal())==null||e.destinations==null||e.destinations[0]==null?null:e.destinations[0].destinationType,r,F.destinationFormPair().oauthField)))}}function gn(t,n){if(t&1&&(a(0,"app-toggle-card",14),k(1,16),l(2," Advanced options "),a(3,"spk-menu")(4,"button",17),l(5," Add advanced option "),a(6,"spk-icon"),l(7,"plus"),o()(),k(8,18),D(9,_n,2,1,"button",19,w),v(),o(),v(),k(11),D(12,Cn,1,9,"ng-container",null,w),v(),o()),t&2){let e=m(3);d("disallowToggle",!0),s(9),T(e.notSelectedAdvancedFormPair()),s(3),T(e.selectedAdvancedFormPair())}}function yn(t,n){if(t&1&&(a(0,"spk-icon",27),l(1," question "),o()),t&2){let e=m(2).$implicit;$("spk-tooltip-primary",e.destination.longDescription)}}function xn(t,n){if(t&1&&(a(0,"app-file-tree",22)(1,"label",26),l(2),f(3,yn,2,1,"spk-icon",27),o(),p(4,"input",28),o()),t&2){let e,i=m().$implicit,r=m(3);d("startingPath",r.getFormFieldValue(i.index,i.formGroupName,i.destination.name)),s(),pt("for","destination-",i.formGroupName,"-",i.formGroupName,"-",i.index,""),s(),A(" ",(e=i.destination.shortDescription)!==null&&e!==void 0?e:i.destination.name," "),s(),_(i.destination.longDescription?3:-1),s(),O("id","destination-",i.formGroupName,"-",i.index,""),me("formControlName",i.destination.name)}}function hn(t,n){if(t&1&&(a(0,"spk-icon",27),l(1," question "),o()),t&2){let e=m(2).$implicit;$("spk-tooltip-primary",e.destination.longDescription)}}function Sn(t,n){t&1&&(a(0,"spk-icon",29),l(1,"link"),o())}function kn(t,n){t&1&&(a(0,"spk-icon",29),l(1,"textbox"),o())}function vn(t,n){if(t&1&&(a(0,"spk-form-field")(1,"label",26),l(2),f(3,hn,2,1,"spk-icon",27),o(),p(4,"input",28),f(5,Sn,2,0,"spk-icon",29)(6,kn,2,0,"spk-icon",29),o()),t&2){let e,i=m().$implicit;s(),O("for","destination-",i.formGroupName,"-",i.index,""),s(),A(" ",(e=i.destination.shortDescription)!==null&&e!==void 0?e:i.destination.name," "),s(),_(i.destination.longDescription?3:-1),s(),O("id","destination-",i.formGroupName,"-",i.index,""),me("formControlName",i.destination.name),s(),_(i.destination.type==="Path"?5:6)}}function Fn(t,n){if(t&1){let e=b();a(0,"span",33),y("click",function(){C(e);let r=m(2).$implicit,c=m(3);return g(c.oauthStartTokenCreation(r.destinationType))}),l(1,"AuthID"),o()}}function bn(t,n){t&1&&(a(0,"spk-icon",29),l(1,"password"),o())}function wn(t,n){if(t&1){let e=b();a(0,"spk-icon",34),y("click",function(){C(e);let r=m(2).$implicit;return g(r.destination.showPassword=!r.destination.showPassword)}),l(1," eye "),o()}}function Dn(t,n){if(t&1){let e=b();a(0,"spk-icon",34),y("click",function(){C(e);let r=m(2).$implicit;return g(r.destination.showPassword=!r.destination.showPassword)}),l(1," eye-slash "),o()}}function Tn(t,n){if(t&1&&(a(0,"spk-form-field")(1,"label",26),l(2),o(),p(3,"input",30),f(4,Fn,2,0,"span",31)(5,bn,2,0,"spk-icon",29)(6,wn,2,0,"spk-icon",32)(7,Dn,2,0,"spk-icon",32),o()),t&2){let e,i=m().$implicit;s(),O("for","destination-",i.formGroupName,"-",i.index,""),s(),ct(" ",(e=i.destination.shortDescription)!==null&&e!==void 0?e:i.destination.name," -- ",i.oauthField," ",i.destinationType," ",i.destination.name," "),s(),O("id","destination-",i.formGroupName,"-",i.index,""),me("formControlName",i.destination.name),d("type",i.destination.showPassword?"text":"password"),s(),_(i.oauthField===i.destination.name?4:5),s(2),_(i.destination.showPassword?6:7)}}function En(t,n){if(t&1&&(a(0,"spk-icon",27),l(1," question "),o()),t&2){let e=m(2).$implicit;$("spk-tooltip-primary",e.destination.longDescription)}}function On(t,n){if(t&1&&(a(0,"option",37),l(1),o()),t&2){let e=n.$implicit;d("value",e),s(),G(e)}}function Nn(t,n){if(t&1&&(a(0,"spk-select")(1,"label",26),l(2),f(3,En,2,1,"spk-icon",27),o(),p(4,"input",35),k(5,36),D(6,On,2,2,"option",37,w),v(),o()),t&2){let e,i=m().$implicit;s(),O("for","destination-",i.formGroupName,"-",i.index,""),s(),A(" ",(e=i.destination.shortDescription)!==null&&e!==void 0?e:i.destination.name," "),s(),_(i.destination.longDescription?3:-1),s(),O("id","destination-",i.formGroupName,"-",i.index,""),me("formControlName",i.destination.name),s(2),T(i.destination.options)}}function Vn(t,n){if(t&1&&(a(0,"spk-icon",27),l(1," question "),o()),t&2){let e=m(2).$implicit;$("spk-tooltip-primary",e.destination.longDescription)}}function Pn(t,n){if(t&1&&(a(0,"option",37),l(1),o()),t&2){let e=n.$implicit;d("value",e),s(),G(e)}}function In(t,n){if(t&1&&(a(0,"div",23)(1,"label",26),l(2),f(3,Vn,2,1,"spk-icon",27),o(),a(4,"div",38)(5,"spk-form-field"),p(6,"input",39),a(7,"spk-icon",29),l(8,"resize"),o()(),a(9,"spk-select"),p(10,"label")(11,"input",40),k(12,36),D(13,Pn,2,2,"option",37,w),v(),o()()()),t&2){let e,i=m().$implicit,r=m(3);d("formGroupName",i.destination.name),s(),O("for","destination-",i.formGroupName,"-",i.index,""),s(),A(" ",(e=i.destination.shortDescription)!==null&&e!==void 0?e:i.destination.name," "),s(),_(i.destination.longDescription?3:-1),s(3),O("id","destination-",i.formGroupName,"-",i.index,""),s(7),T(r.sizeOptions())}}function Gn(t,n){if(t&1&&(a(0,"spk-icon",27),l(1," question "),o()),t&2){let e=m(2).$implicit;$("spk-tooltip-primary",e.destination.longDescription)}}function An(t,n){if(t&1&&(a(0,"spk-form-field")(1,"label",26),l(2),f(3,Gn,2,1,"spk-icon",27),o(),p(4,"input",41),a(5,"spk-icon",29),l(6,"numpad"),o()()),t&2){let e,i=m().$implicit;s(),O("for","destination-",i.formGroupName,"-",i.index,""),s(),A(" ",(e=i.destination.shortDescription)!==null&&e!==void 0?e:i.destination.name," "),s(),_(i.destination.longDescription?3:-1),s(),O("id","destination-",i.formGroupName,"-",i.index,""),me("formControlName",i.destination.name)}}function Mn(t,n){if(t&1&&(a(0,"spk-icon",27),l(1," question "),o()),t&2){let e=m(2).$implicit;$("spk-tooltip-primary",e.destination.longDescription)}}function Rn(t,n){if(t&1&&(a(0,"spk-toggle",24)(1,"label",26),l(2),f(3,Mn,2,1,"spk-icon",27),o(),p(4,"input",42),o()),t&2){let e,i=m().$implicit;s(),O("for","destination-",i.formGroupName,"-",i.index,""),s(),A(" ",(e=i.destination.shortDescription)!==null&&e!==void 0?e:i.destination.name," "),s(),_(i.destination.longDescription?3:-1),s(),O("id","destination-",i.formGroupName,"-",i.index,""),me("formControlName",i.destination.name)}}function Bn(t,n){if(t&1&&(a(0,"spk-icon",27),l(1," question "),o()),t&2){let e=m(2).$implicit;$("spk-tooltip-primary",e.destination.longDescription)}}function $n(t,n){t&1&&(a(0,"spk-option",44),l(1,"None"),o()),t&2&&d("value","None")}function Ln(t,n){if(t&1&&(a(0,"spk-option",37),l(1),p(2,"spk-checkbox",45),o()),t&2){let e=m().$implicit;d("value",e),s(),A(" ",e," ")}}function zn(t,n){if(t&1&&f(0,$n,2,1,"spk-option",44)(1,Ln,3,2,"spk-option",37),t&2){let e=n.$implicit;_(e==="None"?0:1)}}function Un(t,n){if(t&1&&(a(0,"spk-select",25)(1,"label",26),l(2),f(3,Bn,2,1,"spk-icon",27),o(),p(4,"input",43),k(5,36),D(6,zn,2,1,null,null,w),v(),o()),t&2){let e,i=m().$implicit;d("selectMultiple",!0),s(),O("for","destination-",i.formGroupName,"-",i.index,""),s(),A(" ",(e=i.destination.shortDescription)!==null&&e!==void 0?e:i.destination.name," "),s(),_(i.destination.longDescription?3:-1),s(),me("formControlName",i.destination.name),s(2),T(i.destination.options)}}function jn(t,n){if(t&1&&(a(0,"spk-icon",27),l(1," question "),o()),t&2){let e=m(2).$implicit;$("spk-tooltip-primary",e.destination.longDescription)}}function qn(t,n){if(t&1&&(a(0,"spk-form-field")(1,"label",26),l(2),f(3,jn,2,1,"spk-icon",27),o(),p(4,"input",28)(5,"span",46),o()),t&2){let e,i=m().$implicit;s(),O("for","destination-",i.formGroupName,"-",i.index,""),s(),A(" ",(e=i.destination.shortDescription)!==null&&e!==void 0?e:i.destination.name," "),s(),_(i.destination.longDescription?3:-1),s(),O("id","destination-",i.formGroupName,"-",i.index,""),me("formControlName",i.destination.name)}}function Qn(t,n){if(t&1&&(k(0,21),f(1,xn,5,11,"app-file-tree",22)(2,vn,7,10,"spk-form-field")(3,Tn,8,14,"spk-form-field")(4,Nn,8,9,"spk-select")(5,In,15,9,"div",23)(6,An,7,9,"spk-form-field")(7,Rn,5,9,"spk-toggle",24)(8,Un,8,7,"spk-select",25)(9,qn,6,9,"spk-form-field"),v()),t&2){let e=n.$implicit;d("formGroupName",e.formGroupName),s(),_(e.destination.type==="file-tree"?1:e.destination.type==="String"||e.destination.type==="Path"?2:e.destination.type==="Password"?3:e.destination.type==="Enumeration"?4:e.destination.type==="Size"?5:e.destination.type==="Integer"?6:e.destination.type==="Boolean"?7:e.destination.type==="Flags"?8:e.destination.type==="Timespan"?9:-1)}}function Wn(t,n){if(t&1&&(k(0,5)(1,13),f(2,pn,3,0,"ng-container")(3,un,3,0,"ng-container")(4,gn,14,1,"app-toggle-card",14)(5,Qn,10,2,"ng-template",null,1,dt),v()()),t&2){let e=m(2);s(2),_(e.destinationFormPair().custom.length?2:-1),s(),_(e.destinationFormPair().dynamic.length?3:-1),s(),_(e.destinationFormPair().advanced.length?4:-1)}}function Kn(t,n){if(t&1){let e=b();a(0,"form",3,0),y("submit",function(){C(e);let r=m();return g(r.next())}),a(2,"header")(3,"h3",4),l(4,"Backup destination"),o(),f(5,rn,4,0,"p"),o(),f(6,ln,28,0)(7,Wn,7,3,"ng-container",5),a(8,"div",6)(9,"button",7),y("click",function(){C(e);let r=m();return g(r.goBack())}),a(10,"spk-icon"),l(11,"arrow-left"),o(),l(12," Go back "),o(),a(13,"button",8)(14,"spk-icon"),l(15,"arrow-right"),o(),l(16," Continue "),o()()()}if(t&2){let e,i=m();d("formGroup",i.destinationForm),s(5),_(i.destinationCount()>0?5:-1),s(),_(i.destinationCount()===0?6:-1),s(),_(!((e=i.destinationFormSignal())==null||e.destinations==null)&&e.destinations.length?7:-1)}}var Hn=["Bytes","KB","MB","GB","TB","PB"],Ke=new I,bt=(t={destinations:[]})=>Ke.group({destinations:Ke.array(t.destinations)}),wt=({key:t,customGroup:n,dynamicGroup:e,advancedGroup:i})=>Ke.group({destinationType:Ke.control(t),custom:n,dynamic:e,advanced:i}),it=class t{#e=h(M);#t=h(K);#n=h(Ce);#i=h(_t);#o=h(R);formRef=U.required("formRef");sysIsLoaded=this.#n.isLoaded;destinationIsLoaded=this.#o.destinationIsLoaded;destinationForm=this.#o.destinationForm;destinationFormPair=this.#o.destinationFormPair;selectedAdvancedFormPair=this.#o.selectedAdvancedFormPair;notSelectedAdvancedFormPair=this.#o.notSelectedAdvancedFormPair;destinationOptions=this.#o.destinationOptions;destinationFormSignal=this.#o.destinationFormSignal;destinationCount=W(()=>this.destinationFormSignal()?.destinations?.length??0);sizeOptions=S(Hn);getFormFieldValue(n,e,i){return((this.destinationForm.controls.destinations.controls?.[n]).controls?.[e]).controls[i].value}addDestinationFormGroup(n){this.#o.addDestinationFormGroup(n)}addAdvancedFormPair(n){this.selectedAdvancedFormPair.update(e=>(e.push(n),e)),this.notSelectedAdvancedFormPair.update(e=>(e=e.filter(i=>i.name!==n.name),e))}targetUrl=W(()=>{let n=this.destinationFormSignal()?.destinations?.[0];return n?Oe(n):""});mapToTargetUrl(n){return Oe(n.value)}removeDestinationFormGroup(n){this.destinationForm.controls.destinations.removeAt(n)}displayFn(n){let e=this.destinationOptions().find(i=>i.Key===n);return e?`${e.DisplayName}`:""}goBack(){this.#e.navigate(["general"],{relativeTo:this.#t.parent})}next(){this.#e.navigate(["source-data"],{relativeTo:this.#t.parent})}#a=S("https://duplicati-oauth-handler.appspot.com/").asReadonly();#l=S(Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2)).asReadonly();#r=S(!1);#s=S(null);keyCreation(){}oauthStartTokenCreation(n){this.#r.set(!0);let e=450,i=600,r=this.#a()+"?type="+n+"&token="+this.#l(),c=screen.width/2-e/2,F=screen.height/2-i/2,B=window.open(r,"_blank","height="+i+",width="+e+",menubar=0,status=0,titlebar=0,toolbar=0,left="+c+",top="+F);B?.addEventListener("blur",le=>{console.log("event blur",le)}),B?.addEventListener("beforeunload",le=>{console.log("event beforeunload",le),this.#i.get(this.#a()+"fetch?callback=JSON_CALLBACK",{params:{token:this.#l()}}).pipe(ye(()=>this.#r.set(!1))).subscribe({next:N=>{console.log("res",N),N?.authid&&this.#s.set(N.authid)}})})}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=z({type:t,selectors:[["app-destination"]],viewQuery:function(e,i){e&1&&j(i.formRef,tn,5),e&2&&q()},standalone:!0,features:[Q],decls:1,vars:1,consts:[["formRef",""],["fieldTemplate",""],[3,"formGroup"],[3,"submit","formGroup"],[1,"title-30"],["formArrayName","destinations"],[1,"form-actions"],["spk-button","","type","button",3,"click"],["spk-button","","type","submit",1,"raised","primary"],[3,"click"],[1,"spk-primary"],[1,"most-common-destinations"],[1,"tile",3,"click"],["formGroupName","0"],[3,"disallowToggle"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],["title",""],["spk-button","","type","button",1,"outlined","small"],["menu",""],["spk-menu-item","","type","button"],["spk-menu-item","","type","button",3,"click"],[3,"formGroupName"],[3,"startingPath"],[1,"form-column",3,"formGroupName"],[1,"primary","raised"],[1,"primary",3,"selectMultiple"],[3,"for"],["spk-tooltip-right",""],["type","text",3,"id","formControlName"],["spkPrefix",""],[3,"type","id","formControlName"],["spkPrefix","",1,"link"],["spkSuffix","",1,"clickable"],["spkPrefix","",1,"link",3,"click"],["spkSuffix","",1,"clickable",3,"click"],["type","search",3,"id","formControlName"],["options",""],[3,"value"],[1,"form-row"],["type","number","formControlName","size",3,"id"],["type","search","formControlName","unit"],["type","number",3,"id","formControlName"],["type","checkbox",3,"id","formControlName"],["type","text","id","text",3,"formControlName"],["deselect","",3,"value"],[1,"raised","primary"],["spkError",""]],template:function(e,i){e&1&&f(0,Kn,17,4,"form",2),e&2&&_(i.destinationOptions().length&&i.sysIsLoaded()&&i.destinationIsLoaded()?0:-1)},dependencies:[ie,J,te,ne,H,ue,we,Y,Z,X,ee,_e,Le,ut,ae,re,ze,ft,Ct,oe,De,ge,Ue],styles:["[_nghost-%COMP%]{display:block}header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}header[_ngcontent-%COMP%] p[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{cursor:pointer;text-decoration:underline}form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.form-actions[_ngcontent-%COMP%]{display:flex;justify-content:space-between}.form-column[_ngcontent-%COMP%]{display:flex;flex-direction:column}.form-column[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.25rem}.form-column[_ngcontent-%COMP%] spk-icon[_ngcontent-%COMP%]{font-size:1rem}.form-row[_ngcontent-%COMP%]{display:grid;grid-template-columns:2fr 1fr;gap:.5rem;align-items:flex-end}.clickable[_ngcontent-%COMP%]{cursor:pointer;color:var(--primary-500)}.most-common-destinations[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.most-common-destinations[_ngcontent-%COMP%] .tile[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem;padding:1rem;border:1px solid var(--base-level-40);border-radius:var(--shape-3);box-shadow:var(--shadow-1);background-color:var(--base-level-20);cursor:pointer}.most-common-destinations[_ngcontent-%COMP%] .tile[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{font:var(--paragraph-10);margin:0}[spkprefix].link[_ngcontent-%COMP%]{cursor:pointer;text-decoration:underline;color:var(--primary-500)}"],changeDetection:0})};export{bt as a,wt as b,it as c,ht as d,Je as e,Ze as f,St as g,et as h,Xe as i,vt as j,tt as k,Ft as l,nt as m,R as n};
1
+ import{a as Ue,b as ge}from"./chunk-XT6S3PN3.js";import{b as Se}from"./chunk-P4AWKIXG.js";import{a as we,b as H,c as he,d as Y,e as Z,f as J,g as ue,i as X,j as _e,k as Le,l as ee,m as te,n as ne,o as I,q as ie}from"./chunk-C52YH32J.js";import{a as Ce}from"./chunk-TIGGJ4KF.js";import{a as oe,d as fe,f as ft,h as ae,j as ze,m as Ct,n as re,q as De}from"./chunk-S7QBT7L2.js";import{a as K,c as M}from"./chunk-AFUS3PYG.js";import{a as gt}from"./chunk-SYBUINNV.js";import{$a as f,$b as W,Ab as j,Bb as q,Cb as xe,D as lt,Db as l,Eb as G,Fb as A,G as ye,Hb as ct,Jb as Q,L as st,Lb as Be,Nb as $e,Oa as s,R as be,Rb as dt,Ua as S,Va as U,X as h,Z as z,a as se,ab as $,b as Me,bb as d,c as rt,db as mt,fb as _,gb as w,ha as C,hb as D,ia as g,ib as T,jb as a,kb as o,lb as p,lc as ut,mb as k,nb as v,ob as Re,pb as b,qb as y,rb as m,ub as me,uc as _t,vb as O,wb as pt}from"./chunk-RBNO3K72.js";var je=class t{fromString(n){if(!n)return null;let e=n.match(/(\d+)([smhDWMY])/);return e&&{value:parseInt(e[1]),unit:e[2]}}toString(n,e){return`${n}${e}`}static \u0275fac=function(e){return new(e||t)};static \u0275prov=be({token:t,factory:t.\u0275fac,providedIn:"root"})};var ve=new I,Pe={file:{customFields:{path:{type:"file-tree",name:"path",shortDescription:"File path",longDescription:"The path to store the backup",formElement:t=>ve.control(t??"")}}},ssh:{customFields:{server:{type:"String",name:"server",shortDescription:"Server",longDescription:"The server to connect to",formElement:t=>ve.control(t??"")},port:{type:"Integer",name:"port",shortDescription:"Port",longDescription:"The port to connect to",formElement:t=>ve.control(t??"")},path:{type:"Path",name:"path",shortDescription:"File path on the server",longDescription:"File path on the server",formElement:t=>ve.control(t??"")}},dynamicFields:["auth-username"]},s3:{customFields:{path:{type:"Path",name:"path",shortDescription:"File path on the server",longDescription:"File path on the server",formElement:t=>ve.control(t??"")},bucket:{type:"String",name:"bucket",shortDescription:"Bucket name",longDescription:"Bucket name",formElement:t=>ve.control(t??"")}},dynamicFields:["use-ssl","s3-server-name","auth-username","auth-password"]},gcs:{dynamicFields:["gcs-location","gcs-storage-class","authid"]},googledrive:{oauthField:"authid",customFields:{path:{type:"Path",name:"path",shortDescription:"File path on the server",longDescription:"File path on the server",formElement:t=>ve.control(t??"")}},dynamicFields:["authid"]}};function Te(t,n){let e={},i={};return n.searchParams.forEach((r,c)=>{Pe[t].dynamicFields?.includes(c)?i[c]=decodeURIComponent(r):e[c]=decodeURIComponent(r)}),{advanced:e,dynamic:i}}function Ie(t){let n=t.map(([e,i])=>`${e}=${i?encodeURIComponent(i.toString()):""}`).join("&");return n?"?"+n:""}var Ee={file:{to:t=>{let n=Ie([...Object.entries(t.advanced),...Object.entries(t.dynamic)]);return`${t.destinationType}://${t.custom.path}${n}`},from:(t,n,e)=>{let i=e.indexOf("file:///")===0,r=e.split(i?"///":"//")[1].substring(0,1)+n.hostname.substring(1);return se({destinationType:t,custom:{path:`${i?"/":""}${r}${n.pathname}`}},Te(t,n))}},ssh:{to:t=>{let n=Ie([...Object.entries(t.advanced),...Object.entries(t.dynamic)]);return`${t.destinationType}://${t.custom.server}${t.custom.port?":"+t.custom.port:""}${t.custom.path.startsWith("/")?t.custom.path:"/"+t.custom.path}${n}`},from:(t,n,e)=>se({destinationType:t,custom:{server:n.hostname,port:n.port,path:n.pathname}},Te(t,n))},s3:{to:t=>{let n=Ie([...Object.entries(t.advanced),...Object.entries(t.dynamic)]);return`${t.destinationType}://${t.custom.bucket}${t.custom.path}${n}`},from:(t,n,e)=>se({destinationType:t,custom:{path:n.pathname,bucket:n.hostname}},Te(t,n))},gcs:{to:t=>{let n=t.dynamic["gcs-location"]??"";delete t.dynamic["gcs-location"];let e=Ie([...Object.entries(t.advanced),...Object.entries(t.dynamic)]);return`${t.destinationType}://${n}${e}`},from:(t,n,e)=>{let{advanced:i,dynamic:r}=Te(t,n);return{destinationType:t,advanced:i,dynamic:Me(se({},r),{"gcs-location":n.hostname+n.pathname})}}},googledrive:{to:t=>{let n=t.custom.path,e=Ie([...Object.entries(t.advanced),...Object.entries(t.dynamic)]);return`${t.destinationType}://${n}${e}`},from:(t,n,e)=>{let i=e.replace("googledrive://","");return se({destinationType:t,custom:{path:i}},Te(t,n))}},fallbackMapper:{to:t=>"",from:(t,n,e)=>se({destinationType:t},Te(t,n))}};function Oe(t){let n=t.destinationType;return!n||!Ee.hasOwnProperty(n)?Ee.fallbackMapper.to(t)??"":Ee[n].to(t)??""}function yt(t){let n=URL.canParse(t),e=t.split("://")[0],i="http://"+t.split("://")[1],r=new URL(i);if(!Ee.hasOwnProperty(e))return Ee.fallbackMapper.from(e,r);if(!n)throw new Error("Invalid target path");return Ee[e].from(e,r,t)}var Dt=/[a-zA-Z0-9_\-\+\.]/,qe=class t{generate(n,e=Dt){let i=this;return Array.apply(null,{length:n}).map(()=>{let r;for(;;)if(r=String.fromCharCode(i.#e()),e.test(r))return r},this).join("")}#e(){if(window.crypto&&window.crypto.getRandomValues){let n=new Uint8Array(1);return window.crypto.getRandomValues(n),n[0]}else if(window.msCrypto&&window.msCrypto.getRandomValues){let n=new Uint8Array(1);return window.msCrypto.getRandomValues(n),n[0]}else return Math.floor(Math.random()*256)}static \u0275fac=function(e){return new(e||t)};static \u0275prov=be({token:t,factory:t.\u0275fac,providedIn:"root"})};function Ye(t,n,e="conditional"){return i=>{if(!i.parent)return null;let r=null;if(t(i.parent)&&(r=(Array.isArray(n)?n:[n]).find(F=>F(i)!==null)??null),e&&r){let c={};c[e]=r,r=c}return r}}function xt(){return t=>(t.parent&&Object.values(t.parent.controls).forEach(n=>{n!==t&&n.updateValueAndValidity()}),null)}var Tt=["formRef"];function Et(t,n){if(t&1&&(a(0,"option",14),l(1),o()),t&2){let e=n.$implicit;d("value",e.Key),s(),G(e.DisplayName)}}function Ot(t,n){t&1&&(a(0,"spk-icon"),l(1,"eye-slash"),o(),l(2," hide "))}function Nt(t,n){t&1&&(a(0,"spk-icon"),l(1,"eye"),o(),l(2," show "))}function Vt(t,n){t&1&&(a(0,"spk-icon",23),l(1,"check"),o())}function Pt(t,n){t&1&&(a(0,"spk-icon"),l(1,"copy"),o())}function It(t,n){if(t&1){let e=b();a(0,"button",22),y("click",function(){C(e);let r=m(3);return g(r.copyPassword())}),f(1,Vt,2,0,"spk-icon",23)(2,Pt,2,0,"spk-icon"),l(3),o()}if(t&2){let e=m(3);s(),_(e.copiedPassword()?1:2),s(2),A(" ",e.copiedPassword()?"Copied":"Copy"," password ")}}function Gt(t,n){if(t&1){let e=b();a(0,"div",15)(1,"spk-form-field")(2,"label",16),l(3,"Create a password"),o(),p(4,"input",17),o(),a(5,"spk-form-field"),p(6,"input",18),o(),a(7,"div",19)(8,"button",20),y("click",function(){C(e);let r=m(2);return g(r.showPassword.set(!r.showPassword()))}),f(9,Ot,3,0)(10,Nt,3,0),o(),a(11,"button",20),y("click",function(){C(e);let r=m(2);return g(r.generatePassword())}),a(12,"spk-icon"),l(13,"password"),o(),l(14," Generate password "),o(),f(15,It,4,2,"button",21),o()()}if(t&2){let e=m(2);s(4),d("type",e.showPassword()?"text":"password"),s(2),d("type",e.showPassword()?"text":"password"),s(3),_(e.showPassword()?9:10),s(6),_(e.showCopyPassword()?15:-1)}}function At(t,n){if(t&1&&(a(0,"spk-select",10)(1,"label",11),l(2,"Encryption"),o(),p(3,"input",12),k(4,13),D(5,Et,2,2,"option",14,w),v(),o(),f(7,Gt,16,4,"div",15)),t&2){let e,i=m();d("displayValue",i.displayFn((e=i.generalForm.value.encryption)!==null&&e!==void 0?e:"")),s(5),T(i.encryptionOptions()),s(2),_(i.encryptionFieldSignal()!=="none"?7:-1)}}var Ne=new I,ht=(t={name:"",description:"",encryption:"none",password:"",repeatPassword:""})=>Ne.group({name:Ne.control(t.name,[he.required]),description:Ne.control(t.description),encryption:Ne.control(t.encryption,[he.required,xt()]),password:Ne.control(t.password,[Ye(n=>n?.value.encryption!=="none",[he.required])]),repeatPassword:Ne.control(t.repeatPassword,[Ye(n=>n?.value.encryption!=="none",[he.required])])}),Je={Key:"none",DisplayName:"None"},Ze=class t{#e=h(M);#t=h(K);#n=h(qe);#i=h(R);#o=h(Ce);formRef=U.required("formRef");generalForm=this.#i.generalForm;encryptionFieldSignal=this.#i.encryptionFieldSignal;encryptionOptions=this.#i.encryptionOptions;isNew=this.#i.isNew;showPassword=S(!1);copiedPassword=S(!1);showCopyPassword=S(!1);ngOnInit(){this.formRef().nativeElement.focus()}exit(){this.#i.exit()}async copyPassword(){let n=this.generalForm.controls.password.value;await this.#a(n??""),this.copiedPassword.set(!0)}async#a(n){try{await navigator.clipboard.writeText(n)}catch{try{let i=document.createElement("textarea");i.value=n,document.body.appendChild(i),i.select(),document.execCommand("copy"),document.body.removeChild(i)}catch(i){console.error("Failed to copy text: ",i)}}}displayFn(n){let e=this.#o.systemInfo()?.EncryptionModules??[],i=[Je,...e].find(r=>r.Key===n);return i?`${i.DisplayName}`:""}generatePassword(){this.copiedPassword.set(!1);let n=this.#n.generate(16);this.generalForm.controls.password.setValue(n),this.generalForm.controls.repeatPassword.setValue(n),this.showCopyPassword.set(!0)}next(){this.#e.navigate(["destination"],{relativeTo:this.#t.parent})}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=z({type:t,selectors:[["app-general"]],viewQuery:function(e,i){e&1&&j(i.formRef,Tt,5),e&2&&q()},standalone:!0,features:[Q],decls:23,vars:4,consts:[["formRef",""],["autocomplete","off",3,"submit","formGroup"],[1,"title-30"],["for","backupName"],["type","text","tabindex","1","placeholder","Your backup name","formControlName","name"],["for","backupDescription"],["id","backupDescription","tabindex","2","placeholder","Your backup description","formControlName","description"],[1,"form-actions"],["spk-button","",3,"click"],["spk-button","","type","submit",1,"raised","primary",3,"disabled"],[3,"displayValue"],["for","encryption"],["type","text","id","encryption","tabindex","3","placeholder","Encryption","formControlName","encryption"],["options",""],[3,"value"],[1,"passwords"],["for","password"],["id","password","tabindex","4","placeholder","Password","formControlName","password",3,"type"],["id","repeatPassword","tabindex","5","placeholder","Repeat password","formControlName","repeatPassword",3,"type"],[1,"password-actions"],["spk-button","","type","button",1,"small",3,"click"],["spk-button","","type","button",1,"small","copy"],["spk-button","","type","button",1,"small","copy",3,"click"],[1,"spk-success"]],template:function(e,i){if(e&1){let r=b();a(0,"form",1,0),y("submit",function(){return C(r),g(i.next())}),a(2,"h3",2),l(3,"General backup settings"),o(),a(4,"spk-form-field")(5,"label",3),l(6,"Backup name"),o(),p(7,"input",4),o(),a(8,"spk-form-field")(9,"label",5),l(10,"Backup description"),o(),p(11,"textarea",6),o(),f(12,At,8,2),a(13,"div",7)(14,"button",8),y("click",function(){return C(r),g(i.exit())}),a(15,"spk-icon"),l(16,"arrow-left"),o(),l(17," Exit "),o(),a(18,"div")(19,"button",9)(20,"spk-icon"),l(21,"arrow-right"),o(),l(22," Continue "),o()()()()}e&2&&(d("formGroup",i.generalForm),s(12),_(i.isNew()?12:-1),s(6),$("spk-tooltip-primary",i.generalForm.valid&&i.encryptionFieldSignal()==="none"||i.copiedPassword()?void 0:"Remember to copy the password"),s(),d("disabled",i.generalForm.invalid||i.encryptionFieldSignal()!=="none"&&i.showCopyPassword()&&!i.copiedPassword()))},dependencies:[ie,J,te,ne,H,Y,Z,X,ee,ae,re,fe,oe],styles:["[_nghost-%COMP%]{display:block}form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.passwords[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.password-actions[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:center}.form-actions[_ngcontent-%COMP%]{display:flex;justify-content:space-between}.copy[_ngcontent-%COMP%] spk-icon.spk-success[_ngcontent-%COMP%]{color:var(--success-500)}"],changeDetection:0})};var Mt=["formRef"];function Rt(t,n){if(t&1&&(a(0,"option",9),l(1),o()),t&2){let e=n.$implicit;d("value",e),s(),G(e)}}function Bt(t,n){if(t&1&&(a(0,"option",9),l(1),o()),t&2){let e=n.$implicit;d("value",e),s(),G(e)}}function $t(t,n){if(t&1){let e=b();a(0,"button",22),y("click",function(){let r=C(e).$implicit,c=m();return g(c.addNewOption(r))}),l(1),o()}if(t&2){let e=n.$implicit;s(),G(e.Name)}}function Lt(t,n){t&1&&(a(0,"label",23),l(1,"Name"),o())}function zt(t,n){t&1&&(a(0,"label",25),l(1,"Value"),o())}function Ut(t,n){if(t&1){let e=b();a(0,"div",18)(1,"spk-form-field"),f(2,Lt,2,0,"label",23),p(3,"input",24),o(),a(4,"spk-form-field"),f(5,zt,2,0,"label",25),p(6,"input",26),o(),a(7,"button",27),y("click",function(){let r=C(e).$index,c=m();return g(c.optionsForm.controls.advancedOptions.removeAt(r))}),a(8,"spk-icon"),l(9,"x-circle"),o()()()}if(t&2){let e=n.$implicit,i=n.$index;d("formGroup",e),s(2),_(i===0?2:-1),s(3),_(i===0?5:-1)}}var pe=new I,jt=["Bytes","KB","MB","GB","TB","PB"],qt=["Local folder","Local drive","Remote drive","Cloud drive"],St=(t={remoteVolumeSize:0,size:"GB",backupRetention:"Local folder",advancedOptions:[]})=>pe.group({remoteVolumeSize:pe.group({size:pe.control(t.remoteVolumeSize),unit:pe.control(t.size)}),backupRetention:pe.control(t.backupRetention),advancedOptions:pe.array([])}),et=(t,n)=>pe.group({name:pe.control(t),value:pe.control(n)}),Xe=class t{#e=h(Ce);#t=h(R);#n=h(M);#i=h(K);formRef=U.required("formRef");optionsForm=this.#t.optionsForm;sizeOptions=S(jt);rentationOptions=S(qt);selectionAdvancedOptions=Se(this.optionsForm.controls.advancedOptions.valueChanges.pipe(st([])));advancedOptions=S(this.#e.systemInfo()?.Options??[]);nonSelectedAdvancedOptions=W(()=>this.advancedOptions().filter(n=>this.selectionAdvancedOptions()?.findIndex(e=>e.name===n.Name)===-1));addNewOption(n){this.optionsForm.controls.advancedOptions.push(et(n.Name,n.DefaultValue))}displayFn(){let n=this.advancedOptions();return e=>{let i=n.find(r=>r.Name===e);return i?`${i.Name}`:""}}goBack(){this.#n.navigate(["schedule"],{relativeTo:this.#i.parent})}submit(){this.#t.submit()}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=z({type:t,selectors:[["app-options"]],viewQuery:function(e,i){e&1&&j(i.formRef,Mt,5),e&2&&q()},standalone:!0,features:[Q],decls:49,vars:2,consts:[["formRef",""],[3,"submit","formGroup"],[1,"title-30"],[1,"remote-volume-wrap"],["formGroupName","remoteVolumeSize",1,"row-inputs"],["for","size"],["type","number","id","size","formControlName","size"],["type","text","placeholder","Select an option...","formControlName","unit"],["options",""],[3,"value"],["href","#",1,"spk-primary"],["type","text","placeholder","Local folder or drive","formControlName","backupRetention"],[3,"disallowToggle"],["title",""],["spk-button","","type","button",1,"outlined","small"],["menu",""],["spk-menu-item","","type","button"],["formArrayName","advancedOptions"],[1,"advanced-option",3,"formGroup"],[1,"form-actions"],["spk-button","","type","button",3,"click"],["spk-button","","type","submit",1,"raised","primary"],["spk-menu-item","","type","button",3,"click"],["for","name"],["type","text","id","name","formControlName","name"],["for","value"],["type","text","id","value","formControlName","value"],["spk-button","","type","button",1,"icon",3,"click"]],template:function(e,i){if(e&1){let r=b();a(0,"form",1,0),y("submit",function(){return C(r),g(i.submit())}),a(2,"h3",2),l(3,"Options"),o(),a(4,"div",3)(5,"div",4)(6,"spk-form-field")(7,"label",5),l(8,"Remote volume size"),o(),p(9,"input",6),o(),a(10,"spk-select"),p(11,"input",7),k(12,8),D(13,Rt,2,2,"option",9,w),v(),o()(),a(15,"p"),l(16," The backups will be split up into multiple files called volumes. Here you can set the maximum size of the individual volume files. "),a(17,"a",10),l(18,"Read more"),o()()(),a(19,"spk-select")(20,"label",5),l(21,"Backup retention"),o(),p(22,"input",11),k(23,8),D(24,Bt,2,2,"option",9,w),v(),o(),a(26,"app-toggle-card",12),k(27,13),l(28," Advanced options "),a(29,"spk-menu")(30,"button",14),l(31," Add advanced option "),a(32,"spk-icon"),l(33,"plus"),o()(),k(34,15),D(35,$t,2,1,"button",16,w),v(),o(),v(),k(37,17),D(38,Ut,10,3,"div",18,w),v(),o(),a(40,"div",19)(41,"button",20),y("click",function(){return C(r),g(i.goBack())}),a(42,"spk-icon"),l(43,"arrow-left"),o(),l(44," Go back "),o(),a(45,"button",21)(46,"spk-icon"),l(47,"arrow-right"),o(),l(48," Submit "),o()()()}e&2&&(d("formGroup",i.optionsForm),s(13),T(i.sizeOptions()),s(11),T(i.rentationOptions()),s(2),d("disallowToggle",!0),s(9),T(i.nonSelectedAdvancedOptions()),s(3),T(i.optionsForm.controls.advancedOptions.controls))},dependencies:[ie,J,te,ne,H,ue,Y,Z,X,ee,_e,Le,ze,re,fe,oe,ae,ge],styles:["[_nghost-%COMP%]{display:block}form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.remote-volume-wrap[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.25rem}.row-inputs[_ngcontent-%COMP%]{display:flex;align-items:flex-end;gap:.5rem}.row-inputs[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{flex:1 0}.advanced-option[_ngcontent-%COMP%]{display:grid;gap:.5rem;grid-template-columns:1fr 1fr 40px;align-items:flex-end}.form-actions[_ngcontent-%COMP%]{display:flex;justify-content:space-between}"],changeDetection:0})};var Qt=["formRef"];function Wt(t,n){if(t&1&&(a(0,"option",24),l(1),o()),t&2){let e=n.$implicit;d("value",e.key),s(),G(e.label)}}function Kt(t,n){if(t&1){let e=b();a(0,"div",11)(1,"spk-form-field")(2,"label",12),l(3,"Next time"),o(),a(4,"input",13,1),y("focus",function(){C(e);let r=xe(5);return g(r.showPicker())}),o(),a(6,"spk-icon",14),l(7,"clock"),o()(),a(8,"spk-form-field"),p(9,"label",15),a(10,"input",16,2),y("focus",function(){C(e);let r=xe(11);return g(r.showPicker())}),o(),a(12,"spk-icon",14),l(13,"calendar"),o()()(),k(14,17),a(15,"div",18)(16,"spk-form-field")(17,"label",19),l(18,"Run again every"),o(),p(19,"input",20),o(),a(20,"spk-select",21),p(21,"input",22),k(22,23),D(23,Wt,2,2,"option",24,w),v(),o()(),a(25,"app-toggle-card",25),k(26,26),l(27,"Allowed days"),v(),a(28,"div",27)(29,"spk-toggle",6),l(30," Monday "),p(31,"input",28),o(),a(32,"spk-toggle",6),l(33," Tuesday "),p(34,"input",29),o(),a(35,"spk-toggle",6),l(36," Wednesday "),p(37,"input",30),o(),a(38,"spk-toggle",6),l(39," Thursday "),p(40,"input",31),o(),a(41,"spk-toggle",6),l(42," Friday "),p(43,"input",32),o(),a(44,"spk-toggle",6),l(45," Saturday "),p(46,"input",33),o(),a(47,"spk-toggle",6),l(48," Sunday "),p(49,"input",34),o()()(),v()}if(t&2){let e=m();s(20),d("displayFn",e.displayFn),s(3),T(e.unitOptions),s(2),d("disallowToggle",!0)}}var V=new I,kt=[{key:"s",label:"Seconds"},{key:"m",label:"Minutes"},{key:"h",label:"Hours"},{key:"D",label:"Days"},{key:"W",label:"Weeks"},{key:"M",label:"Months"},{key:"Y",label:"Years"}],vt=(t={autoRun:!1,nextTime:{time:"13:00",date:new Date().toISOString().split("T")[0]},runAgain:{repeatValue:1,repeatUnit:"D",allowedDays:{mon:!1,tue:!1,wed:!1,thu:!1,fri:!1,sat:!1,sun:!1}}})=>V.group({autoRun:V.control(t.autoRun),nextTime:V.group({time:V.control(t.nextTime.time),date:V.control(t.nextTime.date)}),runAgain:V.group({repeatValue:V.control(t.runAgain.repeatValue),repeatUnit:V.control(t.runAgain.repeatUnit),allowedDays:V.group({mon:V.control(t.runAgain.allowedDays.mon),tue:V.control(t.runAgain.allowedDays.tue),wed:V.control(t.runAgain.allowedDays.wed),thu:V.control(t.runAgain.allowedDays.thu),fri:V.control(t.runAgain.allowedDays.fri),sat:V.control(t.runAgain.allowedDays.sat),sun:V.control(t.runAgain.allowedDays.sun)})})}),tt=class t{#e=h(R);#t=h(M);#n=h(K);formRef=U.required("formRef");scheduleForm=this.#e.scheduleForm;scheduleFormSignal=this.#e.scheduleFormSignal;unitOptions=kt;displayFn(n){let e=kt.find(i=>i.key===n);return e?`${e.label}`:""}goBack(){this.#t.navigate(["source-data"],{relativeTo:this.#n.parent})}next(){this.#t.navigate(["options"],{relativeTo:this.#n.parent})}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=z({type:t,selectors:[["app-schedule"]],viewQuery:function(e,i){e&1&&j(i.formRef,Qt,5),e&2&&q()},standalone:!0,features:[Q],decls:20,vars:2,consts:[["formRef",""],["timeRef",""],["dateRef",""],[3,"submit","formGroup"],[1,"title-30"],[1,"toggle-wrap"],[1,"raised","primary"],["type","checkbox","formControlName","autoRun"],[1,"form-actions"],["spk-button","","type","button",3,"click"],["spk-button","","type","submit",1,"raised","primary"],["formGroupName","nextTime",1,"row-inputs"],["for","time"],["type","time","id","time","formControlName","time",3,"focus"],["spkSuffix",""],["for","date"],["type","date","id","date","formControlName","date",3,"focus"],["formGroupName","runAgain"],[1,"row-inputs"],["for","repeatValue"],["type","number","id","repeatValue","formControlName","repeatValue"],[3,"displayFn"],["type","text","id","repeatUnit","formControlName","repeatUnit"],["options",""],[3,"value"],["formGroupName","allowedDays",3,"disallowToggle"],["title",""],[1,"days-wrap"],["type","checkbox","formControlName","mon"],["type","checkbox","formControlName","tue"],["type","checkbox","formControlName","wed"],["type","checkbox","formControlName","thu"],["type","checkbox","formControlName","fri"],["type","checkbox","formControlName","sat"],["type","checkbox","formControlName","sun"]],template:function(e,i){if(e&1){let r=b();a(0,"form",3,0),y("submit",function(){return C(r),g(i.next())}),a(2,"h3",4),l(3,"Schedule"),o(),a(4,"div",5)(5,"spk-toggle",6),l(6," Automatically run backups "),p(7,"input",7),o(),a(8,"p"),l(9,"If a date was missed, the job will run as soon as possible."),o()(),f(10,Kt,50,2),a(11,"div",8)(12,"button",9),y("click",function(){return C(r),g(i.goBack())}),a(13,"spk-icon"),l(14,"arrow-left"),o(),l(15," Go back "),o(),a(16,"button",10)(17,"spk-icon"),l(18,"arrow-right"),o(),l(19," Continue "),o()()()}if(e&2){let r;d("formGroup",i.scheduleForm),s(10),_((r=i.scheduleFormSignal())!=null&&r.autoRun?-1:10)}},dependencies:[ie,J,te,ne,H,ue,we,Y,Z,X,ee,_e,ae,re,De,oe,fe,ge],styles:["[_nghost-%COMP%]{display:block}form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.toggle-wrap[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.25rem}.row-inputs[_ngcontent-%COMP%]{display:flex;align-items:flex-end;gap:.5rem}.row-inputs[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{flex:1 0}.days-wrap[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.form-actions[_ngcontent-%COMP%]{display:flex;justify-content:space-between}"],changeDetection:0})};var Ht=["formRef"];function Yt(t,n){if(t&1&&(a(0,"option",21),l(1),o()),t&2){let e=n.$implicit;d("value",e),s(),G(e)}}function Zt(t,n){if(t&1&&(a(0,"div",14)(1,"spk-form-field"),p(2,"input",18),o(),a(3,"spk-select"),p(4,"input",19),k(5,20),D(6,Yt,2,2,"option",21,w),v(),o()()),t&2){let e=m(2);s(6),T(e.sizeOptions())}}function Jt(t,n){if(t&1){let e=b();a(0,"form",2,0),y("submit",function(){C(e);let r=m();return g(r.next())}),a(2,"h3",3),l(3,"Source Data"),o(),a(4,"app-file-tree",4)(5,"label",5),l(6,"Folder path"),o(),p(7,"input",6),o(),a(8,"app-toggle-card",7),k(9,8),l(10,"Exclude"),v(),a(11,"spk-toggle",9),l(12," Hidden files "),p(13,"input",10),o(),a(14,"spk-toggle",9),l(15," System files "),p(16,"input",11),o(),a(17,"spk-toggle",9),l(18," Temporary files "),p(19,"input",12),o(),a(20,"spk-toggle",13),y("click",function(){C(e);let r=m();return g(r.toggleFilesLargerThan())}),l(21," Files larger than "),o(),f(22,Zt,8,0,"div",14),o(),a(23,"div",15)(24,"button",16),y("click",function(){C(e);let r=m();return g(r.goBack())}),a(25,"spk-icon"),l(26,"arrow-left"),o(),l(27," Go back "),o(),a(28,"button",17)(29,"spk-icon"),l(30,"arrow-right"),o(),l(31," Continue "),o()()()}if(t&2){let e=m();d("formGroup",e.sourceDataForm),s(4),d("multiSelect",!0)("startingPath",e.getPath()),s(4),d("isActive",!0),s(12),mt("active",e.filesLargerThan()),s(2),_(e.filesLargerThan()?22:-1)}}var ce=new I,Xt=["Bytes","KB","MB","GB","TB","PB"],en=["Contains","Does not contain","Is greater than","Is less than"];var Ft=(t={path:"",excludes:{hidden:!1,system:!1,temporary:!1,filesLargerThan:null}})=>ce.group({path:ce.control(t.path),excludes:ce.group({hidden:ce.control(t.excludes.hidden),system:ce.control(t.excludes.system),temporary:ce.control(t.excludes.temporary),filesLargerThan:ce.group({size:ce.control(null),unit:ce.control(null)})})}),nt=class t{#e=h(R);#t=h(M);#n=h(K);formRef=U.required("formRef");sourceDataForm=this.#e.sourceDataForm;sourceDataFormSignal=this.#e.sourceDataFormSignal;destinationIsLoaded=this.#e.destinationIsLoaded;filesLargerThan=W(()=>this.sourceDataFormSignal()?.excludes?.filesLargerThan?.size!==null);sizeOptions=S(Xt);expressionOptions=S(en);getPath(){return this.sourceDataForm.value.path??null}toggleFilesLargerThan(){this.sourceDataForm.controls.excludes.value.filesLargerThan?.size===null?this.sourceDataForm.controls.excludes.controls.filesLargerThan.setValue({size:50,unit:"MB"}):this.sourceDataForm.controls.excludes.controls.filesLargerThan.setValue({size:null,unit:null})}goBack(){this.#t.navigate(["destination"],{relativeTo:this.#n.parent})}next(){this.#t.navigate(["schedule"],{relativeTo:this.#n.parent})}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=z({type:t,selectors:[["app-source-data"]],viewQuery:function(e,i){e&1&&j(i.formRef,Ht,5),e&2&&q()},standalone:!0,features:[Q],decls:1,vars:1,consts:[["formRef",""],[3,"formGroup"],[3,"submit","formGroup"],[1,"title-30"],[3,"multiSelect","startingPath"],["for","path"],["type","text","id","path","tabindex","4","placeholder","Path","formControlName","path"],["formGroupName","excludes",3,"isActive"],["title",""],[1,"raised","primary"],["type","checkbox","placeholder","Hidden files","formControlName","hidden"],["type","checkbox","placeholder","System files","formControlName","system"],["type","checkbox","placeholder","Temporary files","formControlName","temporary"],[1,"raised","primary",3,"click"],["formGroupName","filesLargerThan",1,"row-inputs"],[1,"form-actions"],["spk-button","","type","button",3,"click"],["spk-button","","type","submit",1,"raised","primary"],["type","number","formControlName","size"],["type","text","formControlName","unit","placeholder","Select an option..."],["options",""],[3,"value"]],template:function(e,i){e&1&&f(0,Jt,32,7,"form",1),e&2&&_(i.destinationIsLoaded()?0:-1)},dependencies:[ie,J,te,ne,H,ue,we,Y,Z,X,ee,_e,ae,oe,fe,re,De,Ue,ge],styles:["[_nghost-%COMP%]{display:block}form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.form-actions[_ngcontent-%COMP%]{display:flex;justify-content:space-between}.row-inputs[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr min-content;gap:.5rem}.filter-inputs[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:flex-end}.filter-inputs[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{flex:1 0}.filter-inputs[_ngcontent-%COMP%] .filter-removal[_ngcontent-%COMP%]{cursor:pointer;display:flex;align-items:center;justify-content:center;height:2.5rem;flex:0 0}"],changeDetection:0})};var L=new I,R=class t{#e=h(M);#t=h(Ce);#n=h(gt);#i=h(je);destinationOptions=this.#t.backendModules;backupId=S(null);isSubmitting=S(!1);loadingBackup=S(!1);loadingDefaults=S(!0);destinationIsLoaded=S(!1);isNew=W(()=>this.backupId()==="new");backupDefaults=S(null);generalForm=ht();sourceDataForm=Ft();scheduleForm=vt();destinationForm=bt();optionsForm=St();selectedAdvancedFormPair=S([]);notSelectedAdvancedFormPair=S([]);destinationFormPair=S({oauthField:null,custom:[],dynamic:[],advanced:[]});sourceDataFormSignal=Se(this.sourceDataForm.valueChanges);destinationFormSignal=Se(this.destinationForm.valueChanges);encryptionFieldSignal=Se(this.generalForm.controls.encryption.valueChanges);scheduleFormSignal=Se(this.scheduleForm.valueChanges);encryptionOptions=W(()=>{let n=this.#t.systemInfo()?.EncryptionModules??[];return[Je,...n]});init(n="new"){this.backupId.set(n),n!=="new"?this.getBackup(n):this.getDefaults()}submit(){this.isSubmitting.set(!0);let n=this.#m(),e=this.backupId();e==="new"||!e?this.#n.postApiV1Backups({requestBody:n}).pipe(ye(()=>this.isSubmitting.set(!1))).subscribe({next:i=>{console.log("submitted res",i),this.exit()},error:i=>{console.error("submitted error",i)}}):this.#n.putApiV1BackupById({id:e,requestBody:n}).pipe(ye(()=>this.isSubmitting.set(!1))).subscribe({next:i=>{console.log("submitted res",i),this.exit()},error:i=>{console.error("submitted error",i)}})}exit(){this.#d(),this.#e.navigate(["/"])}getDefaults(){this.loadingDefaults.set(!0),this.#n.getApiV1Backupdefaults().pipe(lt(1),ye(()=>this.loadingDefaults.set(!1))).subscribe({next:n=>{this.#r(n.Schedule),this.#s(n.Backup),this.backupDefaults.set(n),this.destinationIsLoaded.set(!0)}})}getBackup(n){this.loadingBackup.set(!0),this.#n.getApiV1BackupById({id:n}).pipe(ye(()=>this.loadingBackup.set(!1))).subscribe({next:e=>{this.#r(e.Schedule??null),e.Backup&&(this.#l(e.Backup),this.#a(e.Backup),this.#o(e.Backup),this.#s(e.Backup)),this.destinationIsLoaded.set(!0)}})}#o(n){let e=n.Sources??"",i=n.Filters?.map(N=>`${N.Include?"":"-"}${N.Expression}`)??[],r=n.Settings?.find(N=>N.Name==="--exclude-files-attributes")?.Value??"",c=n.Settings?.find(N=>N.Name==="--skip-files-larger-than")??null,F=c?.Value.replace(/[0-9]/g,"")??null,B=c?.Value.replace(/[^0-9]/g,"")??null,le={path:[...e,...i].join("\0"),excludes:{hiddenFiles:r.includes("hidden"),systemFiles:r.includes("system"),tempFiles:r.includes("temporary"),filesLargerThan:F&&B?{size:parseInt(B),unit:F.toUpperCase()}:null}};this.sourceDataForm.patchValue(le)}#a(n){let e=n.TargetURL?yt(n.TargetURL):null;e&&this.addDestinationFormGroup(e.destinationType,{custom:e.custom,dynamic:e.dynamic,advanced:e.advanced})}#l(n){let e=n.Settings?.find(r=>r.Name==="encryption-module"),i=e?.Value&&e.Value.length?e.Value:"none";this.generalForm.patchValue({name:n.Name??"",description:n.Description??"",encryption:i})}#r(n){if(!n){this.scheduleForm.patchValue({autoRun:!0});return}let e=this.#i.fromString(n.Repeat)??null,r={nextTime:this.#c(n.Time),runAgain:{repeatValue:e?.value??1,repeatUnit:e?.unit??"D",allowedDays:{mon:n.AllowedDays?.includes("mon")??!1,tue:n.AllowedDays?.includes("tue")??!1,wed:n.AllowedDays?.includes("wed")??!1,thu:n.AllowedDays?.includes("thu")??!1,fri:n.AllowedDays?.includes("fri")??!1,sat:n.AllowedDays?.includes("sat")??!1,sun:n.AllowedDays?.includes("sun")??!1}}};this.scheduleForm.patchValue(r)}#s(n){let e=["--no-encryption","--exclude-files-attributes","--skip-files-larger-than"];n.Settings?.forEach(i=>{if(i.Name==="encryption-module")return this.generalForm.controls.encryption.setValue(i.Value??"None");i.Name&&e.includes(i.Name)||i.Name&&i.Value&&this.optionsForm.controls.advancedOptions.push(et(i.Name,i.Value))})}mapPub(){this.#m()}#m(){let n=this.generalForm.value,e=this.optionsForm.value,i=this.scheduleForm.value,r=this.sourceDataForm.value,F=this.destinationForm.value.destinations?.length?this.#p(this.destinationForm.controls.destinations):[],B=null;i.runAgain?.repeatUnit&&i.runAgain?.repeatValue&&(B=this.#i.toString(i.runAgain.repeatValue,i.runAgain.repeatUnit));let le=i.runAgain?.allowedDays?Object.entries(i.runAgain?.allowedDays).filter(([x,E])=>E).map(([x,E])=>x):[],N=r.path?.split("\0")??[],Ge=e.advancedOptions?.map(x=>({Name:x.name??null,Value:x.value&&x.value.length?x.value.toString():null}))??[],Fe=[n.encryption==="none"?{Name:"--no-encryption",Value:"True"}:{Name:"encryption-module",Value:n.encryption??null},...Ge.filter(x=>x.Name&&x.Value)],P=Object.entries(r.excludes??{}).filter(([x,E])=>E&&x!=="filesLargerThan").map(([x])=>x),u=r.excludes?.filesLargerThan;return P.length&&Fe.push({Name:"--exclude-files-attributes",Value:P.join(",")}),u&&u.size!==null&&u.unit!==null&&Fe.push({Name:"--skip-files-larger-than",Value:`${u.size}${u.unit}`}),{Backup:{Name:n.name,Description:n.description,TargetURL:F[0]??null,Sources:N.filter(x=>!x.startsWith("-")),Settings:Fe,Filters:N.filter(x=>x.startsWith("-")).map((x,E)=>({Order:E,Include:!1,Expression:x.slice(1)}))},Schedule:i.autoRun?null:{Repeat:B,Time:i.nextTime?.date?new Date(`${i.nextTime.date}T${i.nextTime?.time||"00:00:00"}`).toISOString():null,AllowedDays:le}}}#p(n){return n.controls.map(e=>{if(!e.controls.advanced)return Oe(e.value);let i=Object.keys(e.controls.advanced.controls).filter(r=>e.controls.advanced.controls[r].dirty);return Oe(Me(se({},e.value),{advanced:i.reduce((r,c)=>(r[c]=e.controls.advanced.controls[c].value,r),{})}))})}#c(n){if(!n||n?.indexOf("T")===-1)return{time:n??"13:00"};let e=new Date(n),i={time:`${(""+e.getHours()).padStart(2,"0")}:${(""+e.getMinutes()).padStart(2,"0")}`};return n.indexOf("T")!==-1&&(i.date=e.toISOString().split("T")[0]),i}addDestinationFormGroup(n,e){let i=this.destinationOptions().find(P=>P.Key===n);if(!i||!i.Options)return;let r=Pe.hasOwnProperty(n)&&Pe[n],c=r&&r.customFields?r.customFields:{},F=r&&r.dynamicFields?r.dynamicFields:[],B=r&&r.advancedFields?r.advancedFields:[],le=r&&r.oauthField?r.oauthField:null;this.destinationFormPair.set({oauthField:le,custom:[],dynamic:[],advanced:[]}),this.selectedAdvancedFormPair.set([]);let N=L.group({}),Ge=L.group({}),He=L.group({});if(c)for(n in c){let Fe=c[n],{formElement:P}=Fe,u=rt(Fe,["formElement"]);N.addControl(n,P(e?.custom[n])),this.destinationFormPair.update(x=>(x.custom.push(u),x))}for(let P=0;P<i.Options.length;P++){let u=i.Options[P];if(u.Deprecated)continue;let x=F.includes(u.Name),E=x?Ge:He;this.destinationFormPair.update(Ve=>(Ve[x?"dynamic":"advanced"].push({name:u.Name,type:u.Type,shortDescription:u.ShortDescription??void 0,longDescription:u.LongDescription??void 0,options:u.ValidValues}),Ve));let de=(x?e?.dynamic[u.Name]:e?.advanced[u.Name])??u.DefaultValue;if(u.Type==="String"||u.Type==="Password"||u.Type==="Enumeration"||u.Type==="Path"){E.addControl(u.Name,L.control(de));continue}if(u.Type==="Size"){let Ve=de.replace(/[0-9]/g,""),at=de.replace(/[^0-9]/g,"");E.addControl(u.Name,L.group({size:L.control(at?parseInt(at):50),unit:L.control(Ve?Ve.toUpperCase():"MB")}))}if(u.Type==="Integer"){E.addControl(u.Name,L.control(de?parseInt(de):0));continue}if(u.Type==="Boolean"){E.addControl(u.Name,L.control(de==="true"));continue}if(u.Type==="Flags"){E.addControl(u.Name,L.control(de??""));continue}u.Type==="Timespan"&&E.addControl(u.Name,L.control(de,[he.pattern(/([-+]?\d{1,3}[smhDWMY])+/)]))}this.destinationForm.controls.destinations.length!==0&&this.destinationForm.controls.destinations.removeAt(0),this.destinationFormPair.update(P=>({oauthField:P.oauthField,custom:P.custom,dynamic:P.dynamic.sort((u,x)=>F.indexOf(u.name)-F.indexOf(x.name)),advanced:P.advanced.sort((u,x)=>{let E=B.indexOf(u.name),Ae=B.indexOf(x.name);return E===-1&&Ae!==-1?1:E!==-1&&Ae===-1?-1:E-Ae})})),this.notSelectedAdvancedFormPair.set(this.destinationFormPair().advanced),this.destinationForm.controls.destinations.push(wt({key:i.Key,customGroup:N,dynamicGroup:Ge,advancedGroup:He}))}#d(){this.generalForm.reset(),this.sourceDataForm.reset(),this.scheduleForm.reset(),this.destinationForm.reset(),this.optionsForm.reset()}static \u0275fac=function(e){return new(e||t)};static \u0275prov=be({token:t,factory:t.\u0275fac,providedIn:"root"})};var tn=["formRef"],nn=(t,n,e,i)=>({destination:t,destinationType:n,index:e,formGroupName:"custom",oauthField:i}),ot=t=>({$implicit:t}),on=(t,n,e,i)=>({destination:t,destinationType:n,index:e,formGroupName:"dynamic",oauthField:i}),an=(t,n,e,i)=>({destination:t,destinationType:n,index:e,formGroupName:"advanced",oauthField:i});function rn(t,n){if(t&1){let e=b();a(0,"p",9),y("click",function(){C(e);let r=m(2);return g(r.removeDestinationFormGroup(r.destinationCount()-1))}),l(1," Wanna select another destination? "),a(2,"span",10),l(3,"Click here"),o()()}}function ln(t,n){if(t&1){let e=b();a(0,"div",11)(1,"div",12),y("click",function(){C(e);let r=m(2);return g(r.addDestinationFormGroup("file"))}),a(2,"h3"),l(3,"File system"),o(),a(4,"p"),l(5,"Store backups on your local file system."),o()(),a(6,"div",12),y("click",function(){C(e);let r=m(2);return g(r.addDestinationFormGroup("gcs"))}),a(7,"h3"),l(8,"Google Cloud Storage"),o(),a(9,"p"),l(10,"Store backups in Google Cloud Storage."),o()(),a(11,"div",12),y("click",function(){C(e);let r=m(2);return g(r.addDestinationFormGroup("s3"))}),a(12,"h3"),l(13,"S3 compatible bucket"),o(),a(14,"p"),l(15,"Store backups in any S3 compatible bucket."),o()(),a(16,"div",12),y("click",function(){C(e);let r=m(2);return g(r.addDestinationFormGroup("ssh"))}),a(17,"h3"),l(18,"SSH"),o(),a(19,"p"),l(20,"Store backups in SSH."),o()(),a(21,"div",12),y("click",function(){C(e);let r=m(2);return g(r.addDestinationFormGroup("googledrive"))}),a(22,"h3"),l(23,"Google Drive"),o(),a(24,"p"),l(25,"Store backups in Google Drive."),o()()(),a(26,"p"),l(27,"More destinations are coming soon."),o()}}function sn(t,n){t&1&&Re(0)}function mn(t,n){if(t&1&&f(0,sn,1,0,"ng-container",15),t&2){let e,i=n.$implicit,r=n.$index;m(2);let c=xe(6),F=m(2);d("ngTemplateOutlet",c)("ngTemplateOutletContext",Be(7,ot,$e(2,nn,i,(e=F.destinationFormSignal())==null||e.destinations==null||e.destinations[0]==null?null:e.destinations[0].destinationType,r,F.destinationFormPair().oauthField)))}}function pn(t,n){if(t&1&&(k(0),D(1,mn,1,9,"ng-container",null,w),v()),t&2){let e=m(3);s(),T(e.destinationFormPair().custom)}}function cn(t,n){t&1&&Re(0)}function dn(t,n){if(t&1&&f(0,cn,1,0,"ng-container",15),t&2){let e,i=n.$implicit,r=n.$index;m(2);let c=xe(6),F=m(2);d("ngTemplateOutlet",c)("ngTemplateOutletContext",Be(7,ot,$e(2,on,i,(e=F.destinationFormSignal())==null||e.destinations==null||e.destinations[0]==null?null:e.destinations[0].destinationType,r,F.destinationFormPair().oauthField)))}}function un(t,n){if(t&1&&(k(0),D(1,dn,1,9,"ng-container",null,w),v()),t&2){let e=m(3);s(),T(e.destinationFormPair().dynamic)}}function _n(t,n){if(t&1){let e=b();a(0,"button",20),y("click",function(){let r=C(e).$implicit,c=m(4);return g(c.addAdvancedFormPair(r))}),l(1),o()}if(t&2){let e=n.$implicit;s(),A(" ",e.name," ")}}function fn(t,n){t&1&&Re(0)}function Cn(t,n){if(t&1&&f(0,fn,1,0,"ng-container",15),t&2){let e,i=n.$implicit,r=n.$index;m(2);let c=xe(6),F=m(2);d("ngTemplateOutlet",c)("ngTemplateOutletContext",Be(7,ot,$e(2,an,i,(e=F.destinationFormSignal())==null||e.destinations==null||e.destinations[0]==null?null:e.destinations[0].destinationType,r,F.destinationFormPair().oauthField)))}}function gn(t,n){if(t&1&&(a(0,"app-toggle-card",14),k(1,16),l(2," Advanced options "),a(3,"spk-menu")(4,"button",17),l(5," Add advanced option "),a(6,"spk-icon"),l(7,"plus"),o()(),k(8,18),D(9,_n,2,1,"button",19,w),v(),o(),v(),k(11),D(12,Cn,1,9,"ng-container",null,w),v(),o()),t&2){let e=m(3);d("disallowToggle",!0),s(9),T(e.notSelectedAdvancedFormPair()),s(3),T(e.selectedAdvancedFormPair())}}function yn(t,n){if(t&1&&(a(0,"spk-icon",27),l(1," question "),o()),t&2){let e=m(2).$implicit;$("spk-tooltip-primary",e.destination.longDescription)}}function xn(t,n){if(t&1&&(a(0,"app-file-tree",22)(1,"label",26),l(2),f(3,yn,2,1,"spk-icon",27),o(),p(4,"input",28),o()),t&2){let e,i=m().$implicit,r=m(3);d("startingPath",r.getFormFieldValue(i.index,i.formGroupName,i.destination.name)),s(),pt("for","destination-",i.formGroupName,"-",i.formGroupName,"-",i.index,""),s(),A(" ",(e=i.destination.shortDescription)!==null&&e!==void 0?e:i.destination.name," "),s(),_(i.destination.longDescription?3:-1),s(),O("id","destination-",i.formGroupName,"-",i.index,""),me("formControlName",i.destination.name)}}function hn(t,n){if(t&1&&(a(0,"spk-icon",27),l(1," question "),o()),t&2){let e=m(2).$implicit;$("spk-tooltip-primary",e.destination.longDescription)}}function Sn(t,n){t&1&&(a(0,"spk-icon",29),l(1,"link"),o())}function kn(t,n){t&1&&(a(0,"spk-icon",29),l(1,"textbox"),o())}function vn(t,n){if(t&1&&(a(0,"spk-form-field")(1,"label",26),l(2),f(3,hn,2,1,"spk-icon",27),o(),p(4,"input",28),f(5,Sn,2,0,"spk-icon",29)(6,kn,2,0,"spk-icon",29),o()),t&2){let e,i=m().$implicit;s(),O("for","destination-",i.formGroupName,"-",i.index,""),s(),A(" ",(e=i.destination.shortDescription)!==null&&e!==void 0?e:i.destination.name," "),s(),_(i.destination.longDescription?3:-1),s(),O("id","destination-",i.formGroupName,"-",i.index,""),me("formControlName",i.destination.name),s(),_(i.destination.type==="Path"?5:6)}}function Fn(t,n){if(t&1){let e=b();a(0,"span",33),y("click",function(){C(e);let r=m(2).$implicit,c=m(3);return g(c.oauthStartTokenCreation(r.destinationType))}),l(1,"AuthID"),o()}}function bn(t,n){t&1&&(a(0,"spk-icon",29),l(1,"password"),o())}function wn(t,n){if(t&1){let e=b();a(0,"spk-icon",34),y("click",function(){C(e);let r=m(2).$implicit;return g(r.destination.showPassword=!r.destination.showPassword)}),l(1," eye "),o()}}function Dn(t,n){if(t&1){let e=b();a(0,"spk-icon",34),y("click",function(){C(e);let r=m(2).$implicit;return g(r.destination.showPassword=!r.destination.showPassword)}),l(1," eye-slash "),o()}}function Tn(t,n){if(t&1&&(a(0,"spk-form-field")(1,"label",26),l(2),o(),p(3,"input",30),f(4,Fn,2,0,"span",31)(5,bn,2,0,"spk-icon",29)(6,wn,2,0,"spk-icon",32)(7,Dn,2,0,"spk-icon",32),o()),t&2){let e,i=m().$implicit;s(),O("for","destination-",i.formGroupName,"-",i.index,""),s(),ct(" ",(e=i.destination.shortDescription)!==null&&e!==void 0?e:i.destination.name," -- ",i.oauthField," ",i.destinationType," ",i.destination.name," "),s(),O("id","destination-",i.formGroupName,"-",i.index,""),me("formControlName",i.destination.name),d("type",i.destination.showPassword?"text":"password"),s(),_(i.oauthField===i.destination.name?4:5),s(2),_(i.destination.showPassword?6:7)}}function En(t,n){if(t&1&&(a(0,"spk-icon",27),l(1," question "),o()),t&2){let e=m(2).$implicit;$("spk-tooltip-primary",e.destination.longDescription)}}function On(t,n){if(t&1&&(a(0,"option",37),l(1),o()),t&2){let e=n.$implicit;d("value",e),s(),G(e)}}function Nn(t,n){if(t&1&&(a(0,"spk-select")(1,"label",26),l(2),f(3,En,2,1,"spk-icon",27),o(),p(4,"input",35),k(5,36),D(6,On,2,2,"option",37,w),v(),o()),t&2){let e,i=m().$implicit;s(),O("for","destination-",i.formGroupName,"-",i.index,""),s(),A(" ",(e=i.destination.shortDescription)!==null&&e!==void 0?e:i.destination.name," "),s(),_(i.destination.longDescription?3:-1),s(),O("id","destination-",i.formGroupName,"-",i.index,""),me("formControlName",i.destination.name),s(2),T(i.destination.options)}}function Vn(t,n){if(t&1&&(a(0,"spk-icon",27),l(1," question "),o()),t&2){let e=m(2).$implicit;$("spk-tooltip-primary",e.destination.longDescription)}}function Pn(t,n){if(t&1&&(a(0,"option",37),l(1),o()),t&2){let e=n.$implicit;d("value",e),s(),G(e)}}function In(t,n){if(t&1&&(a(0,"div",23)(1,"label",26),l(2),f(3,Vn,2,1,"spk-icon",27),o(),a(4,"div",38)(5,"spk-form-field"),p(6,"input",39),a(7,"spk-icon",29),l(8,"resize"),o()(),a(9,"spk-select"),p(10,"label")(11,"input",40),k(12,36),D(13,Pn,2,2,"option",37,w),v(),o()()()),t&2){let e,i=m().$implicit,r=m(3);d("formGroupName",i.destination.name),s(),O("for","destination-",i.formGroupName,"-",i.index,""),s(),A(" ",(e=i.destination.shortDescription)!==null&&e!==void 0?e:i.destination.name," "),s(),_(i.destination.longDescription?3:-1),s(3),O("id","destination-",i.formGroupName,"-",i.index,""),s(7),T(r.sizeOptions())}}function Gn(t,n){if(t&1&&(a(0,"spk-icon",27),l(1," question "),o()),t&2){let e=m(2).$implicit;$("spk-tooltip-primary",e.destination.longDescription)}}function An(t,n){if(t&1&&(a(0,"spk-form-field")(1,"label",26),l(2),f(3,Gn,2,1,"spk-icon",27),o(),p(4,"input",41),a(5,"spk-icon",29),l(6,"numpad"),o()()),t&2){let e,i=m().$implicit;s(),O("for","destination-",i.formGroupName,"-",i.index,""),s(),A(" ",(e=i.destination.shortDescription)!==null&&e!==void 0?e:i.destination.name," "),s(),_(i.destination.longDescription?3:-1),s(),O("id","destination-",i.formGroupName,"-",i.index,""),me("formControlName",i.destination.name)}}function Mn(t,n){if(t&1&&(a(0,"spk-icon",27),l(1," question "),o()),t&2){let e=m(2).$implicit;$("spk-tooltip-primary",e.destination.longDescription)}}function Rn(t,n){if(t&1&&(a(0,"spk-toggle",24)(1,"label",26),l(2),f(3,Mn,2,1,"spk-icon",27),o(),p(4,"input",42),o()),t&2){let e,i=m().$implicit;s(),O("for","destination-",i.formGroupName,"-",i.index,""),s(),A(" ",(e=i.destination.shortDescription)!==null&&e!==void 0?e:i.destination.name," "),s(),_(i.destination.longDescription?3:-1),s(),O("id","destination-",i.formGroupName,"-",i.index,""),me("formControlName",i.destination.name)}}function Bn(t,n){if(t&1&&(a(0,"spk-icon",27),l(1," question "),o()),t&2){let e=m(2).$implicit;$("spk-tooltip-primary",e.destination.longDescription)}}function $n(t,n){t&1&&(a(0,"spk-option",44),l(1,"None"),o()),t&2&&d("value","None")}function Ln(t,n){if(t&1&&(a(0,"spk-option",37),l(1),p(2,"spk-checkbox",45),o()),t&2){let e=m().$implicit;d("value",e),s(),A(" ",e," ")}}function zn(t,n){if(t&1&&f(0,$n,2,1,"spk-option",44)(1,Ln,3,2,"spk-option",37),t&2){let e=n.$implicit;_(e==="None"?0:1)}}function Un(t,n){if(t&1&&(a(0,"spk-select",25)(1,"label",26),l(2),f(3,Bn,2,1,"spk-icon",27),o(),p(4,"input",43),k(5,36),D(6,zn,2,1,null,null,w),v(),o()),t&2){let e,i=m().$implicit;d("selectMultiple",!0),s(),O("for","destination-",i.formGroupName,"-",i.index,""),s(),A(" ",(e=i.destination.shortDescription)!==null&&e!==void 0?e:i.destination.name," "),s(),_(i.destination.longDescription?3:-1),s(),me("formControlName",i.destination.name),s(2),T(i.destination.options)}}function jn(t,n){if(t&1&&(a(0,"spk-icon",27),l(1," question "),o()),t&2){let e=m(2).$implicit;$("spk-tooltip-primary",e.destination.longDescription)}}function qn(t,n){if(t&1&&(a(0,"spk-form-field")(1,"label",26),l(2),f(3,jn,2,1,"spk-icon",27),o(),p(4,"input",28)(5,"span",46),o()),t&2){let e,i=m().$implicit;s(),O("for","destination-",i.formGroupName,"-",i.index,""),s(),A(" ",(e=i.destination.shortDescription)!==null&&e!==void 0?e:i.destination.name," "),s(),_(i.destination.longDescription?3:-1),s(),O("id","destination-",i.formGroupName,"-",i.index,""),me("formControlName",i.destination.name)}}function Qn(t,n){if(t&1&&(k(0,21),f(1,xn,5,11,"app-file-tree",22)(2,vn,7,10,"spk-form-field")(3,Tn,8,14,"spk-form-field")(4,Nn,8,9,"spk-select")(5,In,15,9,"div",23)(6,An,7,9,"spk-form-field")(7,Rn,5,9,"spk-toggle",24)(8,Un,8,7,"spk-select",25)(9,qn,6,9,"spk-form-field"),v()),t&2){let e=n.$implicit;d("formGroupName",e.formGroupName),s(),_(e.destination.type==="file-tree"?1:e.destination.type==="String"||e.destination.type==="Path"?2:e.destination.type==="Password"?3:e.destination.type==="Enumeration"?4:e.destination.type==="Size"?5:e.destination.type==="Integer"?6:e.destination.type==="Boolean"?7:e.destination.type==="Flags"?8:e.destination.type==="Timespan"?9:-1)}}function Wn(t,n){if(t&1&&(k(0,5)(1,13),f(2,pn,3,0,"ng-container")(3,un,3,0,"ng-container")(4,gn,14,1,"app-toggle-card",14)(5,Qn,10,2,"ng-template",null,1,dt),v()()),t&2){let e=m(2);s(2),_(e.destinationFormPair().custom.length?2:-1),s(),_(e.destinationFormPair().dynamic.length?3:-1),s(),_(e.destinationFormPair().advanced.length?4:-1)}}function Kn(t,n){if(t&1){let e=b();a(0,"form",3,0),y("submit",function(){C(e);let r=m();return g(r.next())}),a(2,"header")(3,"h3",4),l(4,"Backup destination"),o(),f(5,rn,4,0,"p"),o(),f(6,ln,28,0)(7,Wn,7,3,"ng-container",5),a(8,"div",6)(9,"button",7),y("click",function(){C(e);let r=m();return g(r.goBack())}),a(10,"spk-icon"),l(11,"arrow-left"),o(),l(12," Go back "),o(),a(13,"button",8)(14,"spk-icon"),l(15,"arrow-right"),o(),l(16," Continue "),o()()()}if(t&2){let e,i=m();d("formGroup",i.destinationForm),s(5),_(i.destinationCount()>0?5:-1),s(),_(i.destinationCount()===0?6:-1),s(),_(!((e=i.destinationFormSignal())==null||e.destinations==null)&&e.destinations.length?7:-1)}}var Hn=["Bytes","KB","MB","GB","TB","PB"],Ke=new I,bt=(t={destinations:[]})=>Ke.group({destinations:Ke.array(t.destinations)}),wt=({key:t,customGroup:n,dynamicGroup:e,advancedGroup:i})=>Ke.group({destinationType:Ke.control(t),custom:n,dynamic:e,advanced:i}),it=class t{#e=h(M);#t=h(K);#n=h(Ce);#i=h(_t);#o=h(R);formRef=U.required("formRef");sysIsLoaded=this.#n.isLoaded;destinationIsLoaded=this.#o.destinationIsLoaded;destinationForm=this.#o.destinationForm;destinationFormPair=this.#o.destinationFormPair;selectedAdvancedFormPair=this.#o.selectedAdvancedFormPair;notSelectedAdvancedFormPair=this.#o.notSelectedAdvancedFormPair;destinationOptions=this.#o.destinationOptions;destinationFormSignal=this.#o.destinationFormSignal;destinationCount=W(()=>this.destinationFormSignal()?.destinations?.length??0);sizeOptions=S(Hn);getFormFieldValue(n,e,i){return((this.destinationForm.controls.destinations.controls?.[n]).controls?.[e]).controls[i].value}addDestinationFormGroup(n){this.#o.addDestinationFormGroup(n)}addAdvancedFormPair(n){this.selectedAdvancedFormPair.update(e=>(e.push(n),e)),this.notSelectedAdvancedFormPair.update(e=>(e=e.filter(i=>i.name!==n.name),e))}targetUrl=W(()=>{let n=this.destinationFormSignal()?.destinations?.[0];return n?Oe(n):""});mapToTargetUrl(n){return Oe(n.value)}removeDestinationFormGroup(n){this.destinationForm.controls.destinations.removeAt(n)}displayFn(n){let e=this.destinationOptions().find(i=>i.Key===n);return e?`${e.DisplayName}`:""}goBack(){this.#e.navigate(["general"],{relativeTo:this.#t.parent})}next(){this.#e.navigate(["source-data"],{relativeTo:this.#t.parent})}#a=S("https://duplicati-oauth-handler.appspot.com/").asReadonly();#l=S(Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2)).asReadonly();#r=S(!1);#s=S(null);keyCreation(){}oauthStartTokenCreation(n){this.#r.set(!0);let e=450,i=600,r=this.#a()+"?type="+n+"&token="+this.#l(),c=screen.width/2-e/2,F=screen.height/2-i/2,B=window.open(r,"_blank","height="+i+",width="+e+",menubar=0,status=0,titlebar=0,toolbar=0,left="+c+",top="+F);B?.addEventListener("blur",le=>{console.log("event blur",le)}),B?.addEventListener("beforeunload",le=>{console.log("event beforeunload",le),this.#i.get(this.#a()+"fetch?callback=JSON_CALLBACK",{params:{token:this.#l()}}).pipe(ye(()=>this.#r.set(!1))).subscribe({next:N=>{console.log("res",N),N?.authid&&this.#s.set(N.authid)}})})}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=z({type:t,selectors:[["app-destination"]],viewQuery:function(e,i){e&1&&j(i.formRef,tn,5),e&2&&q()},standalone:!0,features:[Q],decls:1,vars:1,consts:[["formRef",""],["fieldTemplate",""],[3,"formGroup"],[3,"submit","formGroup"],[1,"title-30"],["formArrayName","destinations"],[1,"form-actions"],["spk-button","","type","button",3,"click"],["spk-button","","type","submit",1,"raised","primary"],[3,"click"],[1,"spk-primary"],[1,"most-common-destinations"],[1,"tile",3,"click"],["formGroupName","0"],[3,"disallowToggle"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],["title",""],["spk-button","","type","button",1,"outlined","small"],["menu",""],["spk-menu-item","","type","button"],["spk-menu-item","","type","button",3,"click"],[3,"formGroupName"],[3,"startingPath"],[1,"form-column",3,"formGroupName"],[1,"primary","raised"],[1,"primary",3,"selectMultiple"],[3,"for"],["spk-tooltip-right",""],["type","text",3,"id","formControlName"],["spkPrefix",""],[3,"type","id","formControlName"],["spkPrefix","",1,"link"],["spkSuffix","",1,"clickable"],["spkPrefix","",1,"link",3,"click"],["spkSuffix","",1,"clickable",3,"click"],["type","search",3,"id","formControlName"],["options",""],[3,"value"],[1,"form-row"],["type","number","formControlName","size",3,"id"],["type","search","formControlName","unit"],["type","number",3,"id","formControlName"],["type","checkbox",3,"id","formControlName"],["type","text","id","text",3,"formControlName"],["deselect","",3,"value"],[1,"raised","primary"],["spkError",""]],template:function(e,i){e&1&&f(0,Kn,17,4,"form",2),e&2&&_(i.destinationOptions().length&&i.sysIsLoaded()&&i.destinationIsLoaded()?0:-1)},dependencies:[ie,J,te,ne,H,ue,we,Y,Z,X,ee,_e,Le,ut,ae,re,ze,ft,Ct,oe,De,ge,Ue],styles:["[_nghost-%COMP%]{display:block}header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}header[_ngcontent-%COMP%] p[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{cursor:pointer;text-decoration:underline}form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.form-actions[_ngcontent-%COMP%]{display:flex;justify-content:space-between}.form-column[_ngcontent-%COMP%]{display:flex;flex-direction:column}.form-column[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.25rem}.form-column[_ngcontent-%COMP%] spk-icon[_ngcontent-%COMP%]{font-size:1rem}.form-row[_ngcontent-%COMP%]{display:grid;grid-template-columns:2fr 1fr;gap:.5rem;align-items:flex-end}.clickable[_ngcontent-%COMP%]{cursor:pointer;color:var(--primary-500)}.most-common-destinations[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.most-common-destinations[_ngcontent-%COMP%] .tile[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem;padding:1rem;border:1px solid var(--base-level-40);border-radius:var(--shape-3);box-shadow:var(--shadow-1);background-color:var(--base-level-20);cursor:pointer}.most-common-destinations[_ngcontent-%COMP%] .tile[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{font:var(--paragraph-10);margin:0}[spkprefix].link[_ngcontent-%COMP%]{cursor:pointer;text-decoration:underline;color:var(--primary-500)}"],changeDetection:0})};export{bt as a,wt as b,it as c,ht as d,Je as e,Ze as f,St as g,et as h,Xe as i,vt as j,tt as k,Ft as l,nt as m,R as n};