@duplicati/ngclient 0.0.8 → 0.0.9

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.
@@ -1 +1 @@
1
- import{a,b,c}from"./chunk-A7NGO6XL.js";import"./chunk-XT6S3PN3.js";import"./chunk-P4AWKIXG.js";import"./chunk-C52YH32J.js";import"./chunk-TIGGJ4KF.js";import"./chunk-S7QBT7L2.js";import"./chunk-AFUS3PYG.js";import"./chunk-L4EVZZOM.js";import"./chunk-SYBUINNV.js";import"./chunk-RBNO3K72.js";export{a as createDestinationForm,b as createDestinationFormGroup,c as default};
1
+ import{a,b,c}from"./chunk-JZTRJKNF.js";import"./chunk-CHPE3R64.js";import"./chunk-P4AWKIXG.js";import"./chunk-C52YH32J.js";import"./chunk-TIGGJ4KF.js";import"./chunk-KCVUEWQV.js";import"./chunk-AFUS3PYG.js";import"./chunk-L4EVZZOM.js";import"./chunk-SYBUINNV.js";import"./chunk-RBNO3K72.js";export{a as createDestinationForm,b as createDestinationFormGroup,c as default};
@@ -1 +1 @@
1
- import{a as P}from"./chunk-35H2LYPK.js";import"./chunk-V7LHB36E.js";import{a as I}from"./chunk-WU4K3UNC.js";import{a as y,d as M,e as D,k as R}from"./chunk-S7QBT7L2.js";import{d as v}from"./chunk-AFUS3PYG.js";import"./chunk-L4EVZZOM.js";import{a as O}from"./chunk-SYBUINNV.js";import{$a as d,Db as r,Fb as B,Gb as S,Jb as b,Lb as h,Oa as l,X as s,Z as m,bb as k,fb as f,gb as g,hb as C,ib as _,jb as i,kb as p,lb as c,rb as x}from"./chunk-RBNO3K72.js";var w=e=>["/restore-flow",e];function L(e,o){e&1&&c(0,"spk-progress-bar",0)}function T(e,o){if(e&1&&(i(0,"spk-card",1),c(1,"img",2),i(2,"div",3)(3,"h3"),r(4),p(),i(5,"p"),r(6),p()(),i(7,"button",4),r(8," Restore "),i(9,"spk-icon"),r(10,"arrow-right"),p()()()),e&2){let t,a,n=o.$implicit;l(4),B("Restore ",(t=n.Backup==null?null:n.Backup.Name)!==null&&t!==void 0?t:"Backup name missing",""),l(2),S(" ",(a=n.Backup==null||n.Backup.Metadata==null?null:n.Backup.Metadata.SourceSizeString)!==null&&a!==void 0?a:"-"," / ",(a=n.Backup==null||n.Backup.Metadata==null?null:n.Backup.Metadata.BackupListCount)!==null&&a!==void 0?a:"-"," "),l(),k("routerLink",h(4,w,n.Backup==null?null:n.Backup.ID))}}function E(e,o){if(e&1&&C(0,T,11,6,"spk-card",1,g),e&2){let t=x();_(t.backups())}}function N(e,o){e&1&&r(0," No backups found ")}var u=class e{#e=s(I);#t=s(O);backups=this.#e.backups;backupsLoading=this.#e.backupsLoading;ngOnInit(){this.#e.getBackups()}restoreNow(o){this.#t.postApiV1BackupByIdRestore({id:o.Backup?.ID,requestBody:{}})}static \u0275fac=function(t){return new(t||e)};static \u0275cmp=m({type:e,selectors:[["app-restore"]],standalone:!0,features:[b],decls:7,vars:1,consts:[[1,"indeterminate","primary"],[1,"type-a"],["src","assets/images/folder.png","alt","","width","48px"],[1,"text"],["spk-button","",3,"routerLink"]],template:function(t,a){t&1&&(c(0,"app-status-bar"),i(1,"section")(2,"h2"),r(3,"Where do you want to restore from?"),p(),d(4,L,1,0,"spk-progress-bar",0)(5,E,2,0)(6,N,1,0),p()),t&2&&(l(4),f(a.backupsLoading()?4:a.backups().length?5:6))},dependencies:[P,D,M,y,R,v],styles:["[_nghost-%COMP%]{display:block}h2[_ngcontent-%COMP%]{font:var(--title-30);text-align:center;padding:2rem}section[_ngcontent-%COMP%]{max-width:43.75rem;margin:0 auto;padding:2rem 0;display:flex;flex-direction:column;gap:1rem}spk-divider[_ngcontent-%COMP%]{color:var(--base-level-60)}spk-card[_ngcontent-%COMP%]{display:flex;align-items:center;gap:1rem;--card-padding: 2rem}spk-card[_ngcontent-%COMP%] .text[_ngcontent-%COMP%]{flex:1 0;display:flex;flex-direction:column;gap:.25rem}"],changeDetection:0})};export{u as default};
1
+ import{a as P}from"./chunk-RUP4GIVS.js";import"./chunk-V7LHB36E.js";import{a as I}from"./chunk-WU4K3UNC.js";import{a as y,d as M,e as D,k as R}from"./chunk-KCVUEWQV.js";import{d as v}from"./chunk-AFUS3PYG.js";import"./chunk-L4EVZZOM.js";import{a as O}from"./chunk-SYBUINNV.js";import{$a as d,Db as r,Fb as B,Gb as S,Jb as b,Lb as h,Oa as l,X as s,Z as m,bb as k,fb as f,gb as g,hb as C,ib as _,jb as i,kb as p,lb as c,rb as x}from"./chunk-RBNO3K72.js";var w=e=>["/restore-flow",e];function L(e,o){e&1&&c(0,"spk-progress-bar",0)}function T(e,o){if(e&1&&(i(0,"spk-card",1),c(1,"img",2),i(2,"div",3)(3,"h3"),r(4),p(),i(5,"p"),r(6),p()(),i(7,"button",4),r(8," Restore "),i(9,"spk-icon"),r(10,"arrow-right"),p()()()),e&2){let t,a,n=o.$implicit;l(4),B("Restore ",(t=n.Backup==null?null:n.Backup.Name)!==null&&t!==void 0?t:"Backup name missing",""),l(2),S(" ",(a=n.Backup==null||n.Backup.Metadata==null?null:n.Backup.Metadata.SourceSizeString)!==null&&a!==void 0?a:"-"," / ",(a=n.Backup==null||n.Backup.Metadata==null?null:n.Backup.Metadata.BackupListCount)!==null&&a!==void 0?a:"-"," "),l(),k("routerLink",h(4,w,n.Backup==null?null:n.Backup.ID))}}function E(e,o){if(e&1&&C(0,T,11,6,"spk-card",1,g),e&2){let t=x();_(t.backups())}}function N(e,o){e&1&&r(0," No backups found ")}var u=class e{#e=s(I);#t=s(O);backups=this.#e.backups;backupsLoading=this.#e.backupsLoading;ngOnInit(){this.#e.getBackups()}restoreNow(o){this.#t.postApiV1BackupByIdRestore({id:o.Backup?.ID,requestBody:{}})}static \u0275fac=function(t){return new(t||e)};static \u0275cmp=m({type:e,selectors:[["app-restore"]],standalone:!0,features:[b],decls:7,vars:1,consts:[[1,"indeterminate","primary"],[1,"type-a"],["src","assets/images/folder.png","alt","","width","48px"],[1,"text"],["spk-button","",3,"routerLink"]],template:function(t,a){t&1&&(c(0,"app-status-bar"),i(1,"section")(2,"h2"),r(3,"Where do you want to restore from?"),p(),d(4,L,1,0,"spk-progress-bar",0)(5,E,2,0)(6,N,1,0),p()),t&2&&(l(4),f(a.backupsLoading()?4:a.backups().length?5:6))},dependencies:[P,D,M,y,R,v],styles:["[_nghost-%COMP%]{display:block}h2[_ngcontent-%COMP%]{font:var(--title-30);text-align:center;padding:2rem}section[_ngcontent-%COMP%]{max-width:43.75rem;margin:0 auto;padding:2rem 0;display:flex;flex-direction:column;gap:1rem}spk-divider[_ngcontent-%COMP%]{color:var(--base-level-60)}spk-card[_ngcontent-%COMP%]{display:flex;align-items:center;gap:1rem;--card-padding: 2rem}spk-card[_ngcontent-%COMP%] .text[_ngcontent-%COMP%]{flex:1 0;display:flex;flex-direction:column;gap:.25rem}"],changeDetection:0})};export{u as default};
@@ -0,0 +1 @@
1
+ import{j as a,k as b}from"./chunk-JZTRJKNF.js";import"./chunk-CHPE3R64.js";import"./chunk-P4AWKIXG.js";import"./chunk-C52YH32J.js";import"./chunk-TIGGJ4KF.js";import"./chunk-KCVUEWQV.js";import"./chunk-AFUS3PYG.js";import"./chunk-L4EVZZOM.js";import"./chunk-SYBUINNV.js";import"./chunk-RBNO3K72.js";export{a as createScheduleForm,b as default};
@@ -0,0 +1 @@
1
+ import{a,b}from"./chunk-DMP4KFQP.js";import"./chunk-5Y47Y3RB.js";import"./chunk-CHPE3R64.js";import"./chunk-P4AWKIXG.js";import"./chunk-C52YH32J.js";import"./chunk-KCVUEWQV.js";import"./chunk-AFUS3PYG.js";import"./chunk-L4EVZZOM.js";import"./chunk-SYBUINNV.js";import"./chunk-RBNO3K72.js";export{a as createRestoreOptionsForm,b as default};
@@ -1,2 +1,2 @@
1
- import{b as M}from"./chunk-P4AWKIXG.js";import{k as b}from"./chunk-S7QBT7L2.js";import{c as S}from"./chunk-L4EVZZOM.js";import{a as k}from"./chunk-SYBUINNV.js";import{$a as d,Db as h,G as p,Jb as v,Ka as c,Oa as g,Ua as f,X as i,Z as m,bb as u,fb as C,jb as y,kb as o,lb as r,s as l}from"./chunk-RBNO3K72.js";function D(n,e){n&1&&r(0,"spk-progress-bar",0)}var a=class n{#e=i(S);#n=i(k);isLoading=f(!0);generalInfo=M(this.#n.getApiV1Acknowledgements().pipe(l(e=>e.Acknowledgements?this.#e.bypassSecurityTrustHtml(e.Acknowledgements.replace(/\r/g,`
1
+ import{b as M}from"./chunk-P4AWKIXG.js";import{k as b}from"./chunk-KCVUEWQV.js";import{c as S}from"./chunk-L4EVZZOM.js";import{a as k}from"./chunk-SYBUINNV.js";import{$a as d,Db as h,G as p,Jb as v,Ka as c,Oa as g,Ua as f,X as i,Z as m,bb as u,fb as C,jb as y,kb as o,lb as r,s as l}from"./chunk-RBNO3K72.js";function D(n,e){n&1&&r(0,"spk-progress-bar",0)}var a=class n{#e=i(S);#n=i(k);isLoading=f(!0);generalInfo=M(this.#n.getApiV1Acknowledgements().pipe(l(e=>e.Acknowledgements?this.#e.bypassSecurityTrustHtml(e.Acknowledgements.replace(/\r/g,`
2
2
  `)):""),p(()=>this.isLoading.set(!1))));static \u0275fac=function(t){return new(t||n)};static \u0275cmp=m({type:n,selectors:[["app-general"]],standalone:!0,features:[v],decls:5,vars:2,consts:[[1,"indeterminate","primary"],[3,"innerHTML"]],template:function(t,s){t&1&&(d(0,D,1,0,"spk-progress-bar",0),y(1,"section")(2,"h3"),h(3,"General"),o(),r(4,"div",1),o()),t&2&&(C(s.isLoading()?0:-1),g(4),u("innerHTML",s.generalInfo(),c))},dependencies:[b],styles:["[_nghost-%COMP%]{display:block;position:relative}h3[_ngcontent-%COMP%]{font:var(--title-30)}section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem}spk-progress-bar[_ngcontent-%COMP%]{position:absolute;top:0;left:0;right:0}"],changeDetection:0})};export{a as default};
@@ -0,0 +1 @@
1
+ import{g as a,h as b,i as c}from"./chunk-JZTRJKNF.js";import"./chunk-CHPE3R64.js";import"./chunk-P4AWKIXG.js";import"./chunk-C52YH32J.js";import"./chunk-TIGGJ4KF.js";import"./chunk-KCVUEWQV.js";import"./chunk-AFUS3PYG.js";import"./chunk-L4EVZZOM.js";import"./chunk-SYBUINNV.js";import"./chunk-RBNO3K72.js";export{b as createAdvancedOption,a as createOptionsForm,c as default};
@@ -1 +1 @@
1
- import{p as se}from"./chunk-C52YH32J.js";import{a as I,c as re,h as ae,i as ce,q as de}from"./chunk-S7QBT7L2.js";import{a as pe}from"./chunk-SYBUINNV.js";import{$a as g,$b as V,Ab as K,Bb as ie,Cb as Q,Db as h,Fb as U,G as W,Jb as B,Lb as D,Mb as ne,Oa as d,Rb as oe,Ua as T,Va as H,Wa as Z,X as Y,Z as O,a as C,b as v,bb as $,bc as E,cb as z,db as f,fb as b,ha as k,hb as ee,ia as w,ib as te,jb as r,kb as a,lc as le,ob as q,pb as N,qb as P,rb as p,sa as R,sb as A,ta as _,tb as y,y as X}from"./chunk-RBNO3K72.js";var Ce=["treeContainer"],ve=["formRef"],Te=[[["label"]],[["label"]],[["input"]]],be=["label","label","input"],Pe=(n,e)=>e.id,xe=n=>({children:n,level:0}),ue=n=>({$implicit:n}),ye=(n,e)=>({children:n,level:e});function Se(n,e){if(n&1){let t=N();r(0,"spk-button-group")(1,"button",8),P("click",function(){k(t);let o=p();return w(o.pathDiscoveryMethod.set("browse"))}),h(2," Browser path "),a(),r(3,"button",8),P("click",function(){k(t);let o=p();return w(o.pathDiscoveryMethod.set("path"))}),h(4," Manually type path "),a()()}if(n&2){let t=p();d(),f("active",t.pathDiscoveryMethod()==="browse"),d(2),f("active",t.pathDiscoveryMethod()==="path")}}function ke(n,e){n&1&&(r(0,"spk-icon",11),h(1,"folder-open"),a())}function we(n,e){n&1&&(r(0,"spk-icon"),h(1,"file"),a())}function Fe(n,e){n&1&&(r(0,"spk-icon",11),h(1,"folder"),a())}function Me(n,e){if(n&1&&g(0,ke,2,0,"spk-icon",11)(1,we,2,0,"spk-icon")(2,Fe,2,0,"spk-icon",11),n&2){let t=p(2).$implicit;b(t.children.length?0:t.cls==="file"?1:2)}}function Ee(n,e){n&1&&(r(0,"spk-icon",11),h(1,"desktop-tower"),a())}function Oe(n,e){n&1&&q(0)}function Ne(n,e){if(n&1&&g(0,Oe,1,0,"ng-container",6),n&2){let t=p(2).$implicit,i=p().$implicit;p();let o=Q(6);$("ngTemplateOutlet",o)("ngTemplateOutletContext",D(5,ue,ne(2,ye,t.children,i.level+1)))}}function Ae(n,e){if(n&1){let t=N();r(0,"div",9,3),P("click",function(o){k(t);let s=p().$implicit,l=p(2);return w(s.id!=="/"&&l.toggleNode(o,s.id,s))}),r(2,"div",10),g(3,Me,3,1)(4,Ee,2,0,"spk-icon",11),a(),r(5,"div",12),P("click",function(o){k(t);let s=p().$implicit,l=p(2);return w(s.id!=="/"&&l.toggleSelectedNode(o,s))}),h(6),a()(),g(7,Ne,1,7,"ng-container")}if(n&2){let t=p().$implicit;f("active",t.isSelected)("open",t.children.length)("usually-hidden",t.hidden),d(3),b(t.id!=="/"?3:4),d(3),U(" ",t.text," "),d(),b(t.children.length>0?7:-1)}}function Be(n,e){if(n&1&&g(0,Ae,8,9),n&2){let t=e.$implicit,i=p(2);b(t.hidden&&i.showHiddenFiles()||!t.hidden?0:-1)}}function De(n,e){if(n&1&&(r(0,"spk-list"),ee(1,Be,1,1,null,null,Pe),a()),n&2){let t=e.$implicit;z("padding-left",t.level*.5,"rem"),d(),te(t.children)}}function Ve(n,e){n&1&&q(0)}var G=class n{#t=Y(pe);multiSelect=_(!1);disabled=_(!1);showFiles=_(!1);startingPath=_(null);rootPath=_(void 0);backupSettings=_(null);includes=R();excludes=R();treeContainerRef=H("treeContainer");formRef=H("formRef");pathDiscoveryMethod=T("browse");isLoading=T(!1);showHiddenFiles=T(!1);currentPath=T("/");#e=T(null);treeSearchQuery=T("");treeNodes=T([]);isByBackupSettings=V(()=>this.rootPath()&&this.backupSettings()?.id&&this.backupSettings()?.time);searchableTreeNodes=V(()=>{let e=this.treeSearchQuery();return e?this.treeNodes().filter(t=>t.text?.toLowerCase().includes(e.toLowerCase())):this.treeNodes()});treeStructure=V(()=>{let e=this.searchableTreeNodes(),t=new Map,i=this.rootPath(),o=i?{id:i,resolvedpath:i,text:i?.replaceAll("/",""),parentPath:"",children:[],isSelected:!1,cls:"folder"}:{id:"/",resolvedpath:"/",text:"Computer",parentPath:"",children:[],isSelected:!1};t.set("/",o);for(let s of e){let u=s.id.replace(i??"","").split("/").filter(Boolean),c="",x=o;for(let m of u){if(c+="/"+m,!t.has(c)){let F={id:s.id,isSelected:s.isSelected,parentPath:c,resolvedpath:s.id?.startsWith("%")?s.resolvedpath+"/":c,hidden:s.hidden,text:s.text,cls:s.cls,children:[]};t.set(c,F),x.children.push(F)}x=t.get(c)}}return[o]});pathDiscoveryMethodEffect=E(()=>{let e=this.pathDiscoveryMethod(),t=this.#e();if(e==="browse"&&t)if(this.multiSelect()){let i=t.value.split("\0");this.treeNodes.update(o=>o.map(s=>v(C({},s),{isSelected:typeof s.id=="string"&&i.includes(s.id)})))}else this.treeNodes.update(i=>i.map(o=>v(C({},o),{isSelected:o.id===t.value})))},{allowSignalWrites:!0});#a(){let e=this.treeContainerRef()?.nativeElement.querySelectorAll(".active");e&&e.length>0&&e[0].scrollIntoView({behavior:"smooth",block:"center"})}currentPathEffect=E(()=>{let e=this.#e();e&&(e.value=this.currentPath(),e.dispatchEvent(new Event("input")))},{allowSignalWrites:!0});selectedPathsEffect=E(()=>{if(this.multiSelect()){let e=this.treeNodes().filter(l=>l.isSelected),t=this.treeNodes().filter(l=>!l.isSelected&&e.some(u=>l.id?.startsWith(u.id))),i=e.filter(l=>!e.some(u=>l.id!==u.id&&l.id?.startsWith(u.id))).map(l=>l.id),o=t.filter(l=>!t.some(u=>l.id!==u.id&&l.id?.startsWith(u.id))).map(l=>`-${l.id}`);this.excludes.emit(o);let s=[...i,...o];this.currentPath.set(s.join("\0"))}else{let e=this.treeNodes().find(i=>i.isSelected),t=e?.resolvedpath;this.currentPath.set(e?.id??"")}},{allowSignalWrites:!0});inputValueChangeAbortController=null;inputRefEffect=E(()=>{let e=this.formRef()?.nativeElement?.querySelector("input");e&&(this.#o(e),this.inputValueChangeAbortController&&this.inputValueChangeAbortController.abort(),this.inputValueChangeAbortController=new AbortController,e.addEventListener("inputValueChanged",t=>{this.currentPath.set(t.detail.value)},{signal:this.inputValueChangeAbortController.signal}),this.#e.set(e),e.autocomplete="off")},{allowSignalWrites:!0});ngOnInit(){let e=this.startingPath();e?(this.currentPath.set(e),this.#r(e)):this.#n(null,this.rootPath())}toggleSelectedNode(e,t){e.stopPropagation(),this.multiSelect()?this.treeNodes.update(i=>i.map(o=>o.id?.startsWith(t.id)?v(C({},o),{isSelected:!t.isSelected}):o)):this.treeNodes.update(i=>i.map(o=>o.id===t.id?v(C({},o),{isSelected:!t.isSelected}):v(C({},o),{isSelected:!1})))}toggleNode(e,t,i=null){e.stopPropagation(),i?.children.length?this.treeNodes.update(o=>o.filter(s=>!s.id?.startsWith(i.id)||s.id===i.id)):this.#n(i,t)}#o(e){return Object.defineProperty(e,"value",{configurable:!0,get(){return Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value").get.call(this)},set(t){return Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value").set.call(this,t),this.dispatchEvent(new CustomEvent("inputValueChanged",{bubbles:!0,cancelable:!0,detail:{value:t}})),t}}),e}#l(e){return this.#t.postApiV1Filesystem({showHidden:!0,requestBody:{path:e},onlyFolders:!this.showFiles()})}#s(e){let t=this.backupSettings(),i={id:t.id,time:t.time,prefixOnly:!1,folderContents:!0};return e&&(i.filter="@"+e),this.#t.getApiV1BackupByIdFiles(i)}#i(e){return this.isByBackupSettings()?this.#s(e):this.#l(e)}#r(e){let t=e.split("\0").filter(l=>l.startsWith("-")).map(l=>l.slice(1,-1)),i=e.split("\0").filter(l=>!l.startsWith("-")).filter(Boolean),o=i.map(l=>l.split("/").filter(Boolean)),s=[this.rootPath()??"/"];o.forEach(l=>{l.forEach((u,c)=>{let x=l.slice(0,c+1).join("/"),m=x.startsWith("%")?x:"/"+x;s.includes(m)||s.push(m)})}),this.isLoading.set(!0),X([...s.map(l=>this.#i(l))]).pipe(W(()=>this.isLoading.set(!1))).subscribe({next:l=>{this.treeNodes.update(u=>{let c=l.flatMap(m=>m.map(F=>{let M=F.id,j=M&&M.split("/").filter(Boolean).slice(0,-1).join("/"),L="/"+(M&&M.split("/").filter(Boolean).join("/")),he=i.findIndex(S=>this.multiSelect()?L.startsWith(S):L===S)>-1,me=i.findIndex(S=>S===M)>-1,ge=t.findIndex(S=>S===L)>-1;return v(C({},F),{parentPath:j.startsWith("%")?j:"/"+j,isSelected:he&&!ge||me})}));return[...new Map([...u,...c].map(m=>[m.resolvedpath??m.id,m])).values()]})}})}#n(e=null,t="/"){this.isLoading.set(!0),this.#i(t).pipe(W(()=>this.isLoading.set(!1))).subscribe({next:i=>{let o=this.isByBackupSettings()?i.Files.map(s=>({text:s.Path.split("/").filter(l=>l!=="").pop(),id:s.Path,cls:s.Path.endsWith("/")?"folder":"file",leaf:e!==null,resolvedpath:s.Path,hidden:!1})):i;this.treeNodes.update(s=>{let l=o.map(c=>v(C({},c),{parentPath:t,isSelected:(this.multiSelect()&&e?.isSelected)??!1}));return[...new Map([...s,...l].map(c=>[c.resolvedpath??c.id,c])).values()]})}})}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=O({type:n,selectors:[["app-file-tree"]],viewQuery:function(t,i){t&1&&(K(i.treeContainerRef,Ce,5),K(i.formRef,ve,5)),t&2&&ie(2)},hostVars:2,hostBindings:function(t,i){t&2&&f("disabled",i.disabled())},inputs:{multiSelect:[1,"multiSelect"],disabled:[1,"disabled"],showFiles:[1,"showFiles"],startingPath:[1,"startingPath"],rootPath:[1,"rootPath"],backupSettings:[1,"backupSettings"]},outputs:{includes:"includes",excludes:"excludes"},standalone:!0,features:[B],ngContentSelectors:be,decls:15,vars:14,consts:[["treeContainer",""],["recursiveTree",""],["formRef",""],["treeNode",""],[1,"section"],[1,"browse-files"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[1,"primary","raised","browse-files-toggle",3,"click"],["type","button",3,"click"],["spk-action-item","",3,"click"],[1,"icon"],[1,"spk-primary"],[1,"text",3,"click"]],template:function(t,i){if(t&1){let o=N();A(Te),g(0,Se,5,4,"spk-button-group"),r(1,"div",4),y(2,0,["ngProjectAs","label",5,["label"]]),r(3,"div",5,0),g(5,De,3,2,"ng-template",null,1,oe)(7,Ve,1,0,"ng-container",6),a(),r(8,"spk-toggle",7),P("click",function(){return k(o),w(i.showHiddenFiles.set(!i.showHiddenFiles()))}),h(9),a()(),r(10,"div",null,2)(12,"spk-form-field"),y(13,1,["ngProjectAs","label",5,["label"]]),y(14,2,["ngProjectAs","input",5,["input"]]),a()()}if(t&2){let o=Q(6);b(i.multiSelect()?-1:0),d(),f("hidden",i.pathDiscoveryMethod()!=="browse"),d(6),$("ngTemplateOutlet",o)("ngTemplateOutletContext",D(12,ue,D(10,xe,i.treeStructure()))),d(),f("active",i.showHiddenFiles()),d(),U(" Show hidden ",i.showFiles()?"files":"folders"," "),d(3),f("hidden",i.pathDiscoveryMethod()!=="path")}},dependencies:[re,de,I,ae,ce,le,se],styles:['[_nghost-%COMP%]{display:flex;flex-direction:column;gap:1rem}.disabled[_nghost-%COMP%]{opacity:.5;-webkit-user-select:none;user-select:none;pointer-events:none;position:relative}.disabled[_nghost-%COMP%]:before{content:"";position:absolute;inset:0;background:transparent}.section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.browse-files[_ngcontent-%COMP%]{display:flex;gap:.5rem;padding:.5rem 1rem;height:12.5rem;border:1px solid var(--base-level-40);border-radius:var(--shape-3);overflow:auto;resize:vertical}.browse-files[_ngcontent-%COMP%] spk-list[_ngcontent-%COMP%]{--list-active-bg: var(--base-level-30);gap:0;padding:0;height:min-content;min-width:min-content}.browse-files[_ngcontent-%COMP%] spk-list[_ngcontent-%COMP%] [spk-action-item][_ngcontent-%COMP%]{padding:0;gap:.25rem}.browse-files[_ngcontent-%COMP%] spk-list[_ngcontent-%COMP%] [spk-action-item].usually-hidden[_ngcontent-%COMP%]{opacity:.6}.browse-files[_ngcontent-%COMP%] spk-list[_ngcontent-%COMP%] [spk-action-item][_ngcontent-%COMP%] .text[_ngcontent-%COMP%]{flex:1 0;height:100%;width:max-content;display:flex;align-items:center}.browse-files[_ngcontent-%COMP%] spk-list[_ngcontent-%COMP%] [spk-action-item][_ngcontent-%COMP%] .icon[_ngcontent-%COMP%]{width:1.5rem;height:1.5rem;display:flex;align-items:center;justify-content:center;cursor:pointer}.browse-files-toggle[_ngcontent-%COMP%]{color:var(--base-level-60R)}.hidden[_ngcontent-%COMP%]{display:none}'],changeDetection:0})};var Ie=[[["","title",""]],"*"],je=["[title]","*"];function Le(n,e){n&1&&h(0,"Title")}function We(n,e){n&1&&(r(0,"spk-icon"),h(1,"caret-down"),a())}var J=class n{isActive=Z(!1);disallowToggle=_(!1);ngOnInit(){this.disallowToggle()&&this.isActive.set(!0)}toggle(){this.isActive.set(!this.isActive())}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=O({type:n,selectors:[["app-toggle-card"]],hostVars:2,hostBindings:function(t,i){t&2&&f("active",i.isActive())},inputs:{isActive:[1,"isActive"],disallowToggle:[1,"disallowToggle"]},outputs:{isActive:"isActiveChange"},standalone:!0,features:[B],ngContentSelectors:je,decls:6,vars:1,consts:[[3,"click"],[1,"content"]],template:function(t,i){t&1&&(A(Ie),r(0,"h3",0),P("click",function(){return i.disallowToggle()||i.toggle()}),y(1,0,null,Le,1,0),g(3,We,2,0,"spk-icon"),a(),r(4,"div",1),y(5,1),a()),t&2&&(d(3),b(i.disallowToggle()?-1:3))},dependencies:[I],styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;border-radius:var(--shape-3);background-color:var(--base-level-20)}.active[_nghost-%COMP%] .content[_ngcontent-%COMP%]{max-height:1000px;transition:max-height 1s linear;padding:0 1rem 1rem}.active[_nghost-%COMP%] spk-icon[_ngcontent-%COMP%]{transform:rotate(180deg)}[_nghost-%COMP%] h3[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;font:var(--paragraph-10);padding:1rem;cursor:pointer;-webkit-user-select:none;user-select:none}[_nghost-%COMP%] spk-icon[_ngcontent-%COMP%]{transform:rotate(0);transform-origin:center;transition:transform .2s ease}.content[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;padding:0 1rem;overflow:hidden;max-height:0;transition:max-height .25s linear,padding .25s linear}"],changeDetection:0})};export{G as a,J as b};
1
+ import{p as se}from"./chunk-C52YH32J.js";import{a as I,c as re,h as ae,i as ce,q as de}from"./chunk-KCVUEWQV.js";import{a as pe}from"./chunk-SYBUINNV.js";import{$a as g,$b as V,Ab as K,Bb as ie,Cb as Q,Db as h,Fb as U,G as W,Jb as B,Lb as D,Mb as ne,Oa as d,Rb as oe,Ua as T,Va as H,Wa as Z,X as Y,Z as O,a as C,b as v,bb as $,bc as E,cb as z,db as f,fb as b,ha as k,hb as ee,ia as w,ib as te,jb as r,kb as a,lc as le,ob as q,pb as N,qb as P,rb as p,sa as R,sb as A,ta as _,tb as y,y as X}from"./chunk-RBNO3K72.js";var Ce=["treeContainer"],ve=["formRef"],Te=[[["label"]],[["label"]],[["input"]]],be=["label","label","input"],Pe=(n,e)=>e.id,xe=n=>({children:n,level:0}),ue=n=>({$implicit:n}),ye=(n,e)=>({children:n,level:e});function Se(n,e){if(n&1){let t=N();r(0,"spk-button-group")(1,"button",8),P("click",function(){k(t);let o=p();return w(o.pathDiscoveryMethod.set("browse"))}),h(2," Browser path "),a(),r(3,"button",8),P("click",function(){k(t);let o=p();return w(o.pathDiscoveryMethod.set("path"))}),h(4," Manually type path "),a()()}if(n&2){let t=p();d(),f("active",t.pathDiscoveryMethod()==="browse"),d(2),f("active",t.pathDiscoveryMethod()==="path")}}function ke(n,e){n&1&&(r(0,"spk-icon",11),h(1,"folder-open"),a())}function we(n,e){n&1&&(r(0,"spk-icon"),h(1,"file"),a())}function Fe(n,e){n&1&&(r(0,"spk-icon",11),h(1,"folder"),a())}function Me(n,e){if(n&1&&g(0,ke,2,0,"spk-icon",11)(1,we,2,0,"spk-icon")(2,Fe,2,0,"spk-icon",11),n&2){let t=p(2).$implicit;b(t.children.length?0:t.cls==="file"?1:2)}}function Ee(n,e){n&1&&(r(0,"spk-icon",11),h(1,"desktop-tower"),a())}function Oe(n,e){n&1&&q(0)}function Ne(n,e){if(n&1&&g(0,Oe,1,0,"ng-container",6),n&2){let t=p(2).$implicit,i=p().$implicit;p();let o=Q(6);$("ngTemplateOutlet",o)("ngTemplateOutletContext",D(5,ue,ne(2,ye,t.children,i.level+1)))}}function Ae(n,e){if(n&1){let t=N();r(0,"div",9,3),P("click",function(o){k(t);let s=p().$implicit,l=p(2);return w(s.id!=="/"&&l.toggleNode(o,s.id,s))}),r(2,"div",10),g(3,Me,3,1)(4,Ee,2,0,"spk-icon",11),a(),r(5,"div",12),P("click",function(o){k(t);let s=p().$implicit,l=p(2);return w(s.id!=="/"&&l.toggleSelectedNode(o,s))}),h(6),a()(),g(7,Ne,1,7,"ng-container")}if(n&2){let t=p().$implicit;f("active",t.isSelected)("open",t.children.length)("usually-hidden",t.hidden),d(3),b(t.id!=="/"?3:4),d(3),U(" ",t.text," "),d(),b(t.children.length>0?7:-1)}}function Be(n,e){if(n&1&&g(0,Ae,8,9),n&2){let t=e.$implicit,i=p(2);b(t.hidden&&i.showHiddenFiles()||!t.hidden?0:-1)}}function De(n,e){if(n&1&&(r(0,"spk-list"),ee(1,Be,1,1,null,null,Pe),a()),n&2){let t=e.$implicit;z("padding-left",t.level*.5,"rem"),d(),te(t.children)}}function Ve(n,e){n&1&&q(0)}var G=class n{#t=Y(pe);multiSelect=_(!1);disabled=_(!1);showFiles=_(!1);startingPath=_(null);rootPath=_(void 0);backupSettings=_(null);includes=R();excludes=R();treeContainerRef=H("treeContainer");formRef=H("formRef");pathDiscoveryMethod=T("browse");isLoading=T(!1);showHiddenFiles=T(!1);currentPath=T("/");#e=T(null);treeSearchQuery=T("");treeNodes=T([]);isByBackupSettings=V(()=>this.rootPath()&&this.backupSettings()?.id&&this.backupSettings()?.time);searchableTreeNodes=V(()=>{let e=this.treeSearchQuery();return e?this.treeNodes().filter(t=>t.text?.toLowerCase().includes(e.toLowerCase())):this.treeNodes()});treeStructure=V(()=>{let e=this.searchableTreeNodes(),t=new Map,i=this.rootPath(),o=i?{id:i,resolvedpath:i,text:i?.replaceAll("/",""),parentPath:"",children:[],isSelected:!1,cls:"folder"}:{id:"/",resolvedpath:"/",text:"Computer",parentPath:"",children:[],isSelected:!1};t.set("/",o);for(let s of e){let u=s.id.replace(i??"","").split("/").filter(Boolean),c="",x=o;for(let m of u){if(c+="/"+m,!t.has(c)){let F={id:s.id,isSelected:s.isSelected,parentPath:c,resolvedpath:s.id?.startsWith("%")?s.resolvedpath+"/":c,hidden:s.hidden,text:s.text,cls:s.cls,children:[]};t.set(c,F),x.children.push(F)}x=t.get(c)}}return[o]});pathDiscoveryMethodEffect=E(()=>{let e=this.pathDiscoveryMethod(),t=this.#e();if(e==="browse"&&t)if(this.multiSelect()){let i=t.value.split("\0");this.treeNodes.update(o=>o.map(s=>v(C({},s),{isSelected:typeof s.id=="string"&&i.includes(s.id)})))}else this.treeNodes.update(i=>i.map(o=>v(C({},o),{isSelected:o.id===t.value})))},{allowSignalWrites:!0});#a(){let e=this.treeContainerRef()?.nativeElement.querySelectorAll(".active");e&&e.length>0&&e[0].scrollIntoView({behavior:"smooth",block:"center"})}currentPathEffect=E(()=>{let e=this.#e();e&&(e.value=this.currentPath(),e.dispatchEvent(new Event("input")))},{allowSignalWrites:!0});selectedPathsEffect=E(()=>{if(this.multiSelect()){let e=this.treeNodes().filter(l=>l.isSelected),t=this.treeNodes().filter(l=>!l.isSelected&&e.some(u=>l.id?.startsWith(u.id))),i=e.filter(l=>!e.some(u=>l.id!==u.id&&l.id?.startsWith(u.id))).map(l=>l.id),o=t.filter(l=>!t.some(u=>l.id!==u.id&&l.id?.startsWith(u.id))).map(l=>`-${l.id}`);this.excludes.emit(o);let s=[...i,...o];this.currentPath.set(s.join("\0"))}else{let e=this.treeNodes().find(i=>i.isSelected),t=e?.resolvedpath;this.currentPath.set(e?.id??"")}},{allowSignalWrites:!0});inputValueChangeAbortController=null;inputRefEffect=E(()=>{let e=this.formRef()?.nativeElement?.querySelector("input");e&&(this.#o(e),this.inputValueChangeAbortController&&this.inputValueChangeAbortController.abort(),this.inputValueChangeAbortController=new AbortController,e.addEventListener("inputValueChanged",t=>{this.currentPath.set(t.detail.value)},{signal:this.inputValueChangeAbortController.signal}),this.#e.set(e),e.autocomplete="off")},{allowSignalWrites:!0});ngOnInit(){let e=this.startingPath();e?(this.currentPath.set(e),this.#r(e)):this.#n(null,this.rootPath())}toggleSelectedNode(e,t){e.stopPropagation(),this.multiSelect()?this.treeNodes.update(i=>i.map(o=>o.id?.startsWith(t.id)?v(C({},o),{isSelected:!t.isSelected}):o)):this.treeNodes.update(i=>i.map(o=>o.id===t.id?v(C({},o),{isSelected:!t.isSelected}):v(C({},o),{isSelected:!1})))}toggleNode(e,t,i=null){e.stopPropagation(),i?.children.length?this.treeNodes.update(o=>o.filter(s=>!s.id?.startsWith(i.id)||s.id===i.id)):this.#n(i,t)}#o(e){return Object.defineProperty(e,"value",{configurable:!0,get(){return Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value").get.call(this)},set(t){return Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value").set.call(this,t),this.dispatchEvent(new CustomEvent("inputValueChanged",{bubbles:!0,cancelable:!0,detail:{value:t}})),t}}),e}#l(e){return this.#t.postApiV1Filesystem({showHidden:!0,requestBody:{path:e},onlyFolders:!this.showFiles()})}#s(e){let t=this.backupSettings(),i={id:t.id,time:t.time,prefixOnly:!1,folderContents:!0};return e&&(i.filter="@"+e),this.#t.getApiV1BackupByIdFiles(i)}#i(e){return this.isByBackupSettings()?this.#s(e):this.#l(e)}#r(e){let t=e.split("\0").filter(l=>l.startsWith("-")).map(l=>l.slice(1,-1)),i=e.split("\0").filter(l=>!l.startsWith("-")).filter(Boolean),o=i.map(l=>l.split("/").filter(Boolean)),s=[this.rootPath()??"/"];o.forEach(l=>{l.forEach((u,c)=>{let x=l.slice(0,c+1).join("/"),m=x.startsWith("%")?x:"/"+x;s.includes(m)||s.push(m)})}),this.isLoading.set(!0),X([...s.map(l=>this.#i(l))]).pipe(W(()=>this.isLoading.set(!1))).subscribe({next:l=>{this.treeNodes.update(u=>{let c=l.flatMap(m=>m.map(F=>{let M=F.id,j=M&&M.split("/").filter(Boolean).slice(0,-1).join("/"),L="/"+(M&&M.split("/").filter(Boolean).join("/")),he=i.findIndex(S=>this.multiSelect()?L.startsWith(S):L===S)>-1,me=i.findIndex(S=>S===M)>-1,ge=t.findIndex(S=>S===L)>-1;return v(C({},F),{parentPath:j.startsWith("%")?j:"/"+j,isSelected:he&&!ge||me})}));return[...new Map([...u,...c].map(m=>[m.resolvedpath??m.id,m])).values()]})}})}#n(e=null,t="/"){this.isLoading.set(!0),this.#i(t).pipe(W(()=>this.isLoading.set(!1))).subscribe({next:i=>{let o=this.isByBackupSettings()?i.Files.map(s=>({text:s.Path.split("/").filter(l=>l!=="").pop(),id:s.Path,cls:s.Path.endsWith("/")?"folder":"file",leaf:e!==null,resolvedpath:s.Path,hidden:!1})):i;this.treeNodes.update(s=>{let l=o.map(c=>v(C({},c),{parentPath:t,isSelected:(this.multiSelect()&&e?.isSelected)??!1}));return[...new Map([...s,...l].map(c=>[c.resolvedpath??c.id,c])).values()]})}})}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=O({type:n,selectors:[["app-file-tree"]],viewQuery:function(t,i){t&1&&(K(i.treeContainerRef,Ce,5),K(i.formRef,ve,5)),t&2&&ie(2)},hostVars:2,hostBindings:function(t,i){t&2&&f("disabled",i.disabled())},inputs:{multiSelect:[1,"multiSelect"],disabled:[1,"disabled"],showFiles:[1,"showFiles"],startingPath:[1,"startingPath"],rootPath:[1,"rootPath"],backupSettings:[1,"backupSettings"]},outputs:{includes:"includes",excludes:"excludes"},standalone:!0,features:[B],ngContentSelectors:be,decls:15,vars:14,consts:[["treeContainer",""],["recursiveTree",""],["formRef",""],["treeNode",""],[1,"section"],[1,"browse-files"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[1,"primary","raised","browse-files-toggle",3,"click"],["type","button",3,"click"],["spk-action-item","",3,"click"],[1,"icon"],[1,"spk-primary"],[1,"text",3,"click"]],template:function(t,i){if(t&1){let o=N();A(Te),g(0,Se,5,4,"spk-button-group"),r(1,"div",4),y(2,0,["ngProjectAs","label",5,["label"]]),r(3,"div",5,0),g(5,De,3,2,"ng-template",null,1,oe)(7,Ve,1,0,"ng-container",6),a(),r(8,"spk-toggle",7),P("click",function(){return k(o),w(i.showHiddenFiles.set(!i.showHiddenFiles()))}),h(9),a()(),r(10,"div",null,2)(12,"spk-form-field"),y(13,1,["ngProjectAs","label",5,["label"]]),y(14,2,["ngProjectAs","input",5,["input"]]),a()()}if(t&2){let o=Q(6);b(i.multiSelect()?-1:0),d(),f("hidden",i.pathDiscoveryMethod()!=="browse"),d(6),$("ngTemplateOutlet",o)("ngTemplateOutletContext",D(12,ue,D(10,xe,i.treeStructure()))),d(),f("active",i.showHiddenFiles()),d(),U(" Show hidden ",i.showFiles()?"files":"folders"," "),d(3),f("hidden",i.pathDiscoveryMethod()!=="path")}},dependencies:[re,de,I,ae,ce,le,se],styles:['[_nghost-%COMP%]{display:flex;flex-direction:column;gap:1rem}.disabled[_nghost-%COMP%]{opacity:.5;-webkit-user-select:none;user-select:none;pointer-events:none;position:relative}.disabled[_nghost-%COMP%]:before{content:"";position:absolute;inset:0;background:transparent}.section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.browse-files[_ngcontent-%COMP%]{display:flex;gap:.5rem;padding:.5rem 1rem;height:12.5rem;border:1px solid var(--base-level-40);border-radius:var(--shape-3);overflow:auto;resize:vertical}.browse-files[_ngcontent-%COMP%] spk-list[_ngcontent-%COMP%]{--list-active-bg: var(--base-level-30);gap:0;padding:0;height:min-content;min-width:min-content}.browse-files[_ngcontent-%COMP%] spk-list[_ngcontent-%COMP%] [spk-action-item][_ngcontent-%COMP%]{padding:0;gap:.25rem}.browse-files[_ngcontent-%COMP%] spk-list[_ngcontent-%COMP%] [spk-action-item].usually-hidden[_ngcontent-%COMP%]{opacity:.6}.browse-files[_ngcontent-%COMP%] spk-list[_ngcontent-%COMP%] [spk-action-item][_ngcontent-%COMP%] .text[_ngcontent-%COMP%]{flex:1 0;height:100%;width:max-content;display:flex;align-items:center}.browse-files[_ngcontent-%COMP%] spk-list[_ngcontent-%COMP%] [spk-action-item][_ngcontent-%COMP%] .icon[_ngcontent-%COMP%]{width:1.5rem;height:1.5rem;display:flex;align-items:center;justify-content:center;cursor:pointer}.browse-files-toggle[_ngcontent-%COMP%]{color:var(--base-level-60R)}.hidden[_ngcontent-%COMP%]{display:none}'],changeDetection:0})};var Ie=[[["","title",""]],"*"],je=["[title]","*"];function Le(n,e){n&1&&h(0,"Title")}function We(n,e){n&1&&(r(0,"spk-icon"),h(1,"caret-down"),a())}var J=class n{isActive=Z(!1);disallowToggle=_(!1);ngOnInit(){this.disallowToggle()&&this.isActive.set(!0)}toggle(){this.isActive.set(!this.isActive())}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=O({type:n,selectors:[["app-toggle-card"]],hostVars:2,hostBindings:function(t,i){t&2&&f("active",i.isActive())},inputs:{isActive:[1,"isActive"],disallowToggle:[1,"disallowToggle"]},outputs:{isActive:"isActiveChange"},standalone:!0,features:[B],ngContentSelectors:je,decls:6,vars:1,consts:[[3,"click"],[1,"content"]],template:function(t,i){t&1&&(A(Ie),r(0,"h3",0),P("click",function(){return i.disallowToggle()||i.toggle()}),y(1,0,null,Le,1,0),g(3,We,2,0,"spk-icon"),a(),r(4,"div",1),y(5,1),a()),t&2&&(d(3),b(i.disallowToggle()?-1:3))},dependencies:[I],styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;border-radius:var(--shape-3);background-color:var(--base-level-20)}.active[_nghost-%COMP%] .content[_ngcontent-%COMP%]{max-height:1000px;transition:max-height 1s linear;padding:0 1rem 1rem}.active[_nghost-%COMP%] spk-icon[_ngcontent-%COMP%]{transform:rotate(180deg)}[_nghost-%COMP%] h3[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;font:var(--paragraph-10);padding:1rem;cursor:pointer;-webkit-user-select:none;user-select:none}[_nghost-%COMP%] spk-icon[_ngcontent-%COMP%]{transform:rotate(0);transform-origin:center;transition:transform .2s ease}.content[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;padding:0 1rem;overflow:hidden;max-height:0;transition:max-height .25s linear,padding .25s linear}"],changeDetection:0})};export{G as a,J as b};
@@ -1 +1 @@
1
- import{a as y}from"./chunk-35H2LYPK.js";import"./chunk-V7LHB36E.js";import"./chunk-WU4K3UNC.js";import{n as d}from"./chunk-A7NGO6XL.js";import"./chunk-XT6S3PN3.js";import"./chunk-P4AWKIXG.js";import"./chunk-C52YH32J.js";import"./chunk-TIGGJ4KF.js";import{l as g,p as h}from"./chunk-S7QBT7L2.js";import{a as v,b as C,d as f,e as S}from"./chunk-AFUS3PYG.js";import"./chunk-L4EVZZOM.js";import"./chunk-SYBUINNV.js";import{Db as r,Ib as k,Jb as b,Lb as p,Oa as a,X as s,Z as l,bb as o,jb as n,kb as i,lb as t}from"./chunk-RBNO3K72.js";var I=e=>["/backup",e,"general"],L=e=>["/backup",e,"destination"],F=e=>["/backup",e,"source-data"],_=e=>["/backup",e,"schedule"],D=e=>["/backup",e,"options"],m=class e{#t=s(v);#e=s(d);backupId=this.#e.backupId;ngOnInit(){this.#e.init(this.#t.snapshot.params.id)}static \u0275fac=function(u){return new(u||e)};static \u0275cmp=l({type:e,selectors:[["app-create-edit-backup"]],standalone:!0,features:[k([d]),b],decls:19,vars:15,consts:[["spk-step","","routerLinkActive","active",3,"routerLink"]],template:function(u,c){u&1&&(t(0,"app-status-bar"),n(1,"spk-stepper")(2,"div",0),t(3,"spk-radio"),r(4," General "),i(),n(5,"div",0),t(6,"spk-radio"),r(7," Destination "),i(),n(8,"div",0),t(9,"spk-radio"),r(10," Source Data "),i(),n(11,"div",0),t(12,"spk-radio"),r(13," Schedule "),i(),n(14,"div",0),t(15,"spk-radio"),r(16," Options "),i()(),n(17,"section"),t(18,"router-outlet"),i()),u&2&&(a(2),o("routerLink",p(5,I,c.backupId())),a(3),o("routerLink",p(7,L,c.backupId())),a(3),o("routerLink",p(9,F,c.backupId())),a(3),o("routerLink",p(11,_,c.backupId())),a(3),o("routerLink",p(13,D,c.backupId())))},dependencies:[C,f,S,y,g,h],styles:["[_nghost-%COMP%]{display:block}spk-stepper[_ngcontent-%COMP%]{max-width:31.25rem;margin:2.5rem auto}section[_ngcontent-%COMP%]{max-width:31.25rem;margin:0 auto 2.5rem}"],changeDetection:0})};export{m as default};
1
+ import{a as y}from"./chunk-RUP4GIVS.js";import"./chunk-V7LHB36E.js";import"./chunk-WU4K3UNC.js";import{n as d}from"./chunk-JZTRJKNF.js";import"./chunk-CHPE3R64.js";import"./chunk-P4AWKIXG.js";import"./chunk-C52YH32J.js";import"./chunk-TIGGJ4KF.js";import{l as g,p as h}from"./chunk-KCVUEWQV.js";import{a as v,b as C,d as f,e as S}from"./chunk-AFUS3PYG.js";import"./chunk-L4EVZZOM.js";import"./chunk-SYBUINNV.js";import{Db as r,Ib as k,Jb as b,Lb as p,Oa as a,X as s,Z as l,bb as o,jb as n,kb as i,lb as t}from"./chunk-RBNO3K72.js";var I=e=>["/backup",e,"general"],L=e=>["/backup",e,"destination"],F=e=>["/backup",e,"source-data"],_=e=>["/backup",e,"schedule"],D=e=>["/backup",e,"options"],m=class e{#t=s(v);#e=s(d);backupId=this.#e.backupId;ngOnInit(){this.#e.init(this.#t.snapshot.params.id)}static \u0275fac=function(u){return new(u||e)};static \u0275cmp=l({type:e,selectors:[["app-create-edit-backup"]],standalone:!0,features:[k([d]),b],decls:19,vars:15,consts:[["spk-step","","routerLinkActive","active",3,"routerLink"]],template:function(u,c){u&1&&(t(0,"app-status-bar"),n(1,"spk-stepper")(2,"div",0),t(3,"spk-radio"),r(4," General "),i(),n(5,"div",0),t(6,"spk-radio"),r(7," Destination "),i(),n(8,"div",0),t(9,"spk-radio"),r(10," Source Data "),i(),n(11,"div",0),t(12,"spk-radio"),r(13," Schedule "),i(),n(14,"div",0),t(15,"spk-radio"),r(16," Options "),i()(),n(17,"section"),t(18,"router-outlet"),i()),u&2&&(a(2),o("routerLink",p(5,I,c.backupId())),a(3),o("routerLink",p(7,L,c.backupId())),a(3),o("routerLink",p(9,F,c.backupId())),a(3),o("routerLink",p(11,_,c.backupId())),a(3),o("routerLink",p(13,D,c.backupId())))},dependencies:[C,f,S,y,g,h],styles:["[_nghost-%COMP%]{display:block}spk-stepper[_ngcontent-%COMP%]{max-width:31.25rem;margin:2.5rem auto}section[_ngcontent-%COMP%]{max-width:31.25rem;margin:0 auto 2.5rem}"],changeDetection:0})};export{m as default};
@@ -1 +1 @@
1
- import{a as be}from"./chunk-5Y47Y3RB.js";import{a as L,b as Ce}from"./chunk-XT6S3PN3.js";import{b as q}from"./chunk-P4AWKIXG.js";import{a as me,b as O,d as V,e as E,f as T,g as ce,h as ue,i as P,l as R,m as de,n as fe,o as N,q as I}from"./chunk-C52YH32J.js";import{a as B,d as D,k as ge,l as he,n as Fe,q as Se}from"./chunk-S7QBT7L2.js";import{a as w,c as C}from"./chunk-AFUS3PYG.js";import{a as M}from"./chunk-SYBUINNV.js";import{$a as $,$b as pe,D as Y,Db as r,G as j,Gb as re,Ib as se,Jb as x,L as Z,M as ee,Oa as u,Ob as le,Qb as ae,R as te,Ua as d,X as p,Z as k,bb as c,f as K,fb as J,gb as ie,ha as f,hb as oe,ia as g,ib as ne,jb as i,kb as n,lb as m,mb as h,mc as _,nb as F,o as Q,pb as y,qb as S,rb as W,s as U,y as X}from"./chunk-RBNO3K72.js";function we(l,t){l&1&&m(0,"spk-progress-bar",3)}function Oe(l,t){if(l&1&&(i(0,"option",10),r(1),le(2,"date"),n()),l&2){let e=t.$implicit;c("value",e.Version),u(),re("",e.Version,": ",ae(2,3,e.Time,"d MMM y, h:mm"),"")}}function Ve(l,t){if(l&1&&(i(0,"app-file-tree",11)(1,"label",12),r(2,"Path"),n(),m(3,"input",13),n()),l&2){let e=W(2);c("rootPath",e.rootPath())("backupSettings",e.backupSettings())("multiSelect",!0)("showFiles",!0)}}function Ee(l,t){if(l&1&&(i(0,"spk-select",7),m(1,"input",8),h(2,9),oe(3,Oe,3,6,"option",10,ie),F(),n(),$(5,Ve,4,4,"app-file-tree",11)),l&2){let e=W();c("displayFn",e.displayFn()),u(3),ne(e.versionOptions()),u(2),J(e.rootPathLoaded()?5:-1)}}var A=new N,ke=()=>A.group({filesToRestore:A.control(""),selectedOption:A.control(null),passphrase:A.control(null)}),z=class l{#t=p(M);#e=p(b);#i=p(C);#o=p(w);#n=p(_);selectFilesForm=this.#e.selectFilesForm;selectFilesFormSignal=this.#e.selectFilesFormSignal;backupId=this.#e.backupId;versionOptionsLoading=this.#e.versionOptionsLoading;versionOptions=this.#e.versionOptions;backupSettings=pe(()=>{let t=this.backupId(),e=this.selectFilesFormSignal()?.selectedOption;if(typeof e!="number"||!t)return null;let s=this.versionOptions()?.find(a=>a.Version===e)?.Time??null;return s?{id:t,time:s}:null});rootPathLoaded=d(!1);rootPath=be([this.selectFilesFormSignal,this.backupId],K(Z([null,null]),ee(([t,e])=>{let o=t?.selectedOption,s=e;if(typeof o!="number"||!s)return Q("/");let a=this.versionOptions()?.find(G=>G.Version===o);return this.#t.getApiV1BackupByIdFiles({id:s,time:a?.Time??"",prefixOnly:!1,folderContents:!0}).pipe(U(G=>(this.rootPathLoaded.set(!0),G.Files[0].Path)))})));displayFn(){let t=this.versionOptions();return e=>{if(!e)return"";let o=t?.find(s=>s.Version?.toString()===e);return o?`${o.Version}: ${this.#n.transform(o.Time,"d MMM y, h:mm")}`:""}}next(){this.#i.navigate(["options"],{relativeTo:this.#o.parent})}exit(){this.#e.exit()}static \u0275fac=function(e){return new(e||l)};static \u0275cmp=k({type:l,selectors:[["app-select-files"]],standalone:!0,features:[se([_]),x],decls:15,vars:2,consts:[["formRef",""],[3,"submit","formGroup"],[1,"title-30"],[1,"indeterminate","primary"],[1,"form-actions"],["spk-button","","type","button",3,"click"],["spk-button","","type","submit",1,"raised","primary"],[3,"displayFn"],["type","number","placeholder","Select an option...","formControlName","selectedOption"],["options",""],[3,"value"],[3,"rootPath","backupSettings","multiSelect","showFiles"],["for","path"],["type","text","id","path","formControlName","filesToRestore"]],template:function(e,o){if(e&1){let s=y();i(0,"form",1,0),S("submit",function(){return f(s),g(o.next())}),i(2,"h3",2),r(3,"Select files"),n(),$(4,we,1,0,"spk-progress-bar",3)(5,Ee,6,2),i(6,"div",4)(7,"button",5),S("click",function(){return f(s),g(o.exit())}),i(8,"spk-icon"),r(9,"arrow-left"),n(),r(10," Exit "),n(),i(11,"button",6)(12,"spk-icon"),r(13,"arrow-right"),n(),r(14," Continue "),n()()()}e&2&&(c("formGroup",o.selectFilesForm),u(4),J(o.versionOptionsLoading()?4:5))},dependencies:[I,T,de,fe,O,ce,V,E,P,R,_,L,D,B,Fe,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}"],changeDetection:0})};var b=class l{#t=p(C);#e=p(M);backupId=d(null);backup=d(null);selectFilesForm=ke();optionsForm=ye();optionsFormSignal=q(this.optionsForm.valueChanges);selectFilesFormSignal=q(this.selectFilesForm.valueChanges);versionOptionsLoading=d(!1);versionOptions=d([]);isSubmitting=d(!1);init(t){this.backupId.set(t),this.#i(t,!0)}submit(){this.isSubmitting.set(!0);let t=this.backupId(),e=this.optionsForm.value,o=this.selectFilesForm.value,s=this.versionOptions()?.find(a=>a.Version===o.selectedOption);this.#e.postApiV1BackupByIdRestore({id:t??"",requestBody:{paths:o.filesToRestore?.split("\0").map(a=>`${a}*`)??[],passphrase:o.passphrase??null,time:s?.Time,restore_path:e.restoreFromPath,overwrite:e.handleExisting==="overwrite",permissions:e.permissions,skip_metadata:!0}}).pipe(j(()=>this.isSubmitting.set(!1))).subscribe({next:()=>{this.exit()},error:a=>{console.error("restore error",a)}})}exit(){this.#o(),this.#t.navigate(["/"])}getVersionOptions(){this.versionOptions()}#i(t,e=!1){this.versionOptionsLoading.set(!0),X([this.#e.getApiV1BackupById({id:t}),this.#e.getApiV1BackupByIdFilesets({id:t})]).pipe(Y(1),j(()=>this.versionOptionsLoading.set(!1))).subscribe({next:([o,s])=>{this.versionOptions.set(s),this.backup.set(o),e&&this.selectFilesForm.controls.selectedOption.setValue(s[0].Version)}})}#o(){this.selectFilesForm.reset(),this.optionsForm.reset()}static \u0275fac=function(e){return new(e||l)};static \u0275prov=te({token:l,factory:l.\u0275fac,providedIn:"root"})};var v=new N,ye=()=>v.group({restoreFrom:v.control("orignal"),restoreFromPath:v.control(""),handleExisting:v.control("overwrite"),permissions:v.control(!1)}),H=class l{#t=p(b);#e=p(C);#i=p(w);optionsForm=this.#t.optionsForm;optionsFormSignal=this.#t.optionsFormSignal;goBack(){this.#e.navigate(["select-files"],{relativeTo:this.#i.parent})}submit(){this.#t.submit()}static \u0275fac=function(e){return new(e||l)};static \u0275cmp=k({type:l,selectors:[["app-options"]],standalone:!0,features:[x],decls:41,vars:4,consts:[["formRef",""],[3,"submit","formGroup"],[1,"title-30"],[3,"disallowToggle"],["title",""],[1,"raised","primary"],["type","radio","name","restoreFrom","value","orignal","formControlName","restoreFrom"],["type","radio","name","restoreFrom","value","pickLocation","formControlName","restoreFrom"],[3,"disabled"],["for","path"],["type","text","id","path","formControlName","restoreFromPath"],["type","radio","name","handleExisting","value","overwrite","formControlName","handleExisting"],["type","radio","name","handleExisting","value","saveTimestamp","formControlName","handleExisting"],[1,"primary","raised"],["type","checkbox","formControlName","permissions"],[1,"form-actions"],["spk-button","","type","button",3,"click"],["spk-button","","type","submit",1,"raised","primary"]],template:function(e,o){if(e&1){let s=y();i(0,"form",1,0),S("submit",function(){return f(s),g(o.submit())}),i(2,"h3",2),r(3,"Restore options"),n(),i(4,"app-toggle-card",3),h(5,4),r(6,"Where do you want to restore files from?"),F(),i(7,"spk-radio",5),r(8," Original location "),m(9,"input",6),n(),i(10,"spk-radio",5),r(11," Pick location "),m(12,"input",7),n(),i(13,"app-file-tree",8)(14,"label",9),r(15,"Path"),n(),m(16,"input",10),n()(),i(17,"app-toggle-card",3),h(18,4),r(19,"How do you want to handle existing files?"),F(),i(20,"spk-radio",5),r(21," Overwrite "),m(22,"input",11),n(),i(23,"spk-radio",5),r(24," Save different versions with timestamp in file name "),m(25,"input",12),n()(),i(26,"app-toggle-card"),h(27,4),r(28,"Permissions"),F(),i(29,"spk-toggle",13),r(30," Restore read/write permissions "),m(31,"input",14),n()(),i(32,"div",15)(33,"button",16),S("click",function(){return f(s),g(o.goBack())}),i(34,"spk-icon"),r(35,"arrow-left"),n(),r(36," Go back "),n(),i(37,"button",17)(38,"spk-icon"),r(39,"arrow-right"),n(),r(40," Submit "),n()()()}if(e&2){let s;c("formGroup",o.optionsForm),u(4),c("disallowToggle",!0),u(9),c("disabled",((s=o.optionsFormSignal())==null?null:s.restoreFrom)!=="pickLocation"),u(4),c("disallowToggle",!0)}},dependencies:[I,T,O,me,ue,V,E,P,R,Ce,L,Se,he,D,B],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}"],changeDetection:0})};export{ye as a,H as b,ke as c,z as d,b as e};
1
+ import{a as be}from"./chunk-5Y47Y3RB.js";import{a as L,b as Ce}from"./chunk-CHPE3R64.js";import{b as q}from"./chunk-P4AWKIXG.js";import{a as me,b as O,d as V,e as E,f as T,g as ce,h as ue,i as P,l as R,m as de,n as fe,o as N,q as I}from"./chunk-C52YH32J.js";import{a as B,d as D,k as ge,l as he,n as Fe,q as Se}from"./chunk-KCVUEWQV.js";import{a as w,c as C}from"./chunk-AFUS3PYG.js";import{a as M}from"./chunk-SYBUINNV.js";import{$a as $,$b as pe,D as Y,Db as r,G as j,Gb as re,Ib as se,Jb as x,L as Z,M as ee,Oa as u,Ob as le,Qb as ae,R as te,Ua as d,X as p,Z as k,bb as c,f as K,fb as J,gb as ie,ha as f,hb as oe,ia as g,ib as ne,jb as i,kb as n,lb as m,mb as h,mc as _,nb as F,o as Q,pb as y,qb as S,rb as W,s as U,y as X}from"./chunk-RBNO3K72.js";function we(l,t){l&1&&m(0,"spk-progress-bar",3)}function Oe(l,t){if(l&1&&(i(0,"option",10),r(1),le(2,"date"),n()),l&2){let e=t.$implicit;c("value",e.Version),u(),re("",e.Version,": ",ae(2,3,e.Time,"d MMM y, h:mm"),"")}}function Ve(l,t){if(l&1&&(i(0,"app-file-tree",11)(1,"label",12),r(2,"Path"),n(),m(3,"input",13),n()),l&2){let e=W(2);c("rootPath",e.rootPath())("backupSettings",e.backupSettings())("multiSelect",!0)("showFiles",!0)}}function Ee(l,t){if(l&1&&(i(0,"spk-select",7),m(1,"input",8),h(2,9),oe(3,Oe,3,6,"option",10,ie),F(),n(),$(5,Ve,4,4,"app-file-tree",11)),l&2){let e=W();c("displayFn",e.displayFn()),u(3),ne(e.versionOptions()),u(2),J(e.rootPathLoaded()?5:-1)}}var A=new N,ke=()=>A.group({filesToRestore:A.control(""),selectedOption:A.control(null),passphrase:A.control(null)}),z=class l{#t=p(M);#e=p(b);#i=p(C);#o=p(w);#n=p(_);selectFilesForm=this.#e.selectFilesForm;selectFilesFormSignal=this.#e.selectFilesFormSignal;backupId=this.#e.backupId;versionOptionsLoading=this.#e.versionOptionsLoading;versionOptions=this.#e.versionOptions;backupSettings=pe(()=>{let t=this.backupId(),e=this.selectFilesFormSignal()?.selectedOption;if(typeof e!="number"||!t)return null;let s=this.versionOptions()?.find(a=>a.Version===e)?.Time??null;return s?{id:t,time:s}:null});rootPathLoaded=d(!1);rootPath=be([this.selectFilesFormSignal,this.backupId],K(Z([null,null]),ee(([t,e])=>{let o=t?.selectedOption,s=e;if(typeof o!="number"||!s)return Q("/");let a=this.versionOptions()?.find(G=>G.Version===o);return this.#t.getApiV1BackupByIdFiles({id:s,time:a?.Time??"",prefixOnly:!1,folderContents:!0}).pipe(U(G=>(this.rootPathLoaded.set(!0),G.Files[0].Path)))})));displayFn(){let t=this.versionOptions();return e=>{if(!e)return"";let o=t?.find(s=>s.Version?.toString()===e);return o?`${o.Version}: ${this.#n.transform(o.Time,"d MMM y, h:mm")}`:""}}next(){this.#i.navigate(["options"],{relativeTo:this.#o.parent})}exit(){this.#e.exit()}static \u0275fac=function(e){return new(e||l)};static \u0275cmp=k({type:l,selectors:[["app-select-files"]],standalone:!0,features:[se([_]),x],decls:15,vars:2,consts:[["formRef",""],[3,"submit","formGroup"],[1,"title-30"],[1,"indeterminate","primary"],[1,"form-actions"],["spk-button","","type","button",3,"click"],["spk-button","","type","submit",1,"raised","primary"],[3,"displayFn"],["type","number","placeholder","Select an option...","formControlName","selectedOption"],["options",""],[3,"value"],[3,"rootPath","backupSettings","multiSelect","showFiles"],["for","path"],["type","text","id","path","formControlName","filesToRestore"]],template:function(e,o){if(e&1){let s=y();i(0,"form",1,0),S("submit",function(){return f(s),g(o.next())}),i(2,"h3",2),r(3,"Select files"),n(),$(4,we,1,0,"spk-progress-bar",3)(5,Ee,6,2),i(6,"div",4)(7,"button",5),S("click",function(){return f(s),g(o.exit())}),i(8,"spk-icon"),r(9,"arrow-left"),n(),r(10," Exit "),n(),i(11,"button",6)(12,"spk-icon"),r(13,"arrow-right"),n(),r(14," Continue "),n()()()}e&2&&(c("formGroup",o.selectFilesForm),u(4),J(o.versionOptionsLoading()?4:5))},dependencies:[I,T,de,fe,O,ce,V,E,P,R,_,L,D,B,Fe,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}"],changeDetection:0})};var b=class l{#t=p(C);#e=p(M);backupId=d(null);backup=d(null);selectFilesForm=ke();optionsForm=ye();optionsFormSignal=q(this.optionsForm.valueChanges);selectFilesFormSignal=q(this.selectFilesForm.valueChanges);versionOptionsLoading=d(!1);versionOptions=d([]);isSubmitting=d(!1);init(t){this.backupId.set(t),this.#i(t,!0)}submit(){this.isSubmitting.set(!0);let t=this.backupId(),e=this.optionsForm.value,o=this.selectFilesForm.value,s=this.versionOptions()?.find(a=>a.Version===o.selectedOption);this.#e.postApiV1BackupByIdRestore({id:t??"",requestBody:{paths:o.filesToRestore?.split("\0").map(a=>`${a}*`)??[],passphrase:o.passphrase??null,time:s?.Time,restore_path:e.restoreFromPath,overwrite:e.handleExisting==="overwrite",permissions:e.permissions,skip_metadata:!0}}).pipe(j(()=>this.isSubmitting.set(!1))).subscribe({next:()=>{this.exit()},error:a=>{console.error("restore error",a)}})}exit(){this.#o(),this.#t.navigate(["/"])}getVersionOptions(){this.versionOptions()}#i(t,e=!1){this.versionOptionsLoading.set(!0),X([this.#e.getApiV1BackupById({id:t}),this.#e.getApiV1BackupByIdFilesets({id:t})]).pipe(Y(1),j(()=>this.versionOptionsLoading.set(!1))).subscribe({next:([o,s])=>{this.versionOptions.set(s),this.backup.set(o),e&&this.selectFilesForm.controls.selectedOption.setValue(s[0].Version)}})}#o(){this.selectFilesForm.reset(),this.optionsForm.reset()}static \u0275fac=function(e){return new(e||l)};static \u0275prov=te({token:l,factory:l.\u0275fac,providedIn:"root"})};var v=new N,ye=()=>v.group({restoreFrom:v.control("orignal"),restoreFromPath:v.control(""),handleExisting:v.control("overwrite"),permissions:v.control(!1)}),H=class l{#t=p(b);#e=p(C);#i=p(w);optionsForm=this.#t.optionsForm;optionsFormSignal=this.#t.optionsFormSignal;goBack(){this.#e.navigate(["select-files"],{relativeTo:this.#i.parent})}submit(){this.#t.submit()}static \u0275fac=function(e){return new(e||l)};static \u0275cmp=k({type:l,selectors:[["app-options"]],standalone:!0,features:[x],decls:41,vars:4,consts:[["formRef",""],[3,"submit","formGroup"],[1,"title-30"],[3,"disallowToggle"],["title",""],[1,"raised","primary"],["type","radio","name","restoreFrom","value","orignal","formControlName","restoreFrom"],["type","radio","name","restoreFrom","value","pickLocation","formControlName","restoreFrom"],[3,"disabled"],["for","path"],["type","text","id","path","formControlName","restoreFromPath"],["type","radio","name","handleExisting","value","overwrite","formControlName","handleExisting"],["type","radio","name","handleExisting","value","saveTimestamp","formControlName","handleExisting"],[1,"primary","raised"],["type","checkbox","formControlName","permissions"],[1,"form-actions"],["spk-button","","type","button",3,"click"],["spk-button","","type","submit",1,"raised","primary"]],template:function(e,o){if(e&1){let s=y();i(0,"form",1,0),S("submit",function(){return f(s),g(o.submit())}),i(2,"h3",2),r(3,"Restore options"),n(),i(4,"app-toggle-card",3),h(5,4),r(6,"Where do you want to restore files from?"),F(),i(7,"spk-radio",5),r(8," Original location "),m(9,"input",6),n(),i(10,"spk-radio",5),r(11," Pick location "),m(12,"input",7),n(),i(13,"app-file-tree",8)(14,"label",9),r(15,"Path"),n(),m(16,"input",10),n()(),i(17,"app-toggle-card",3),h(18,4),r(19,"How do you want to handle existing files?"),F(),i(20,"spk-radio",5),r(21," Overwrite "),m(22,"input",11),n(),i(23,"spk-radio",5),r(24," Save different versions with timestamp in file name "),m(25,"input",12),n()(),i(26,"app-toggle-card"),h(27,4),r(28,"Permissions"),F(),i(29,"spk-toggle",13),r(30," Restore read/write permissions "),m(31,"input",14),n()(),i(32,"div",15)(33,"button",16),S("click",function(){return f(s),g(o.goBack())}),i(34,"spk-icon"),r(35,"arrow-left"),n(),r(36," Go back "),n(),i(37,"button",17)(38,"spk-icon"),r(39,"arrow-right"),n(),r(40," Submit "),n()()()}if(e&2){let s;c("formGroup",o.optionsForm),u(4),c("disallowToggle",!0),u(9),c("disabled",((s=o.optionsFormSignal())==null?null:s.restoreFrom)!=="pickLocation"),u(4),c("disallowToggle",!0)}},dependencies:[I,T,O,me,ue,V,E,P,R,Ce,L,Se,he,D,B],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}"],changeDetection:0})};export{ye as a,H as b,ke as c,z as d,b as e};
@@ -0,0 +1 @@
1
+ import{l as a,m as b}from"./chunk-JZTRJKNF.js";import"./chunk-CHPE3R64.js";import"./chunk-P4AWKIXG.js";import"./chunk-C52YH32J.js";import"./chunk-TIGGJ4KF.js";import"./chunk-KCVUEWQV.js";import"./chunk-AFUS3PYG.js";import"./chunk-L4EVZZOM.js";import"./chunk-SYBUINNV.js";import"./chunk-RBNO3K72.js";export{a as createSourceDataForm,b as default};
@@ -0,0 +1 @@
1
+ import{c as a,d as b}from"./chunk-DMP4KFQP.js";import"./chunk-5Y47Y3RB.js";import"./chunk-CHPE3R64.js";import"./chunk-P4AWKIXG.js";import"./chunk-C52YH32J.js";import"./chunk-KCVUEWQV.js";import"./chunk-AFUS3PYG.js";import"./chunk-L4EVZZOM.js";import"./chunk-SYBUINNV.js";import"./chunk-RBNO3K72.js";export{a as createRestoreSelectFilesForm,b as default};
@@ -1 +1 @@
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};
1
+ import{a as Ue,b as ge}from"./chunk-CHPE3R64.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-KCVUEWQV.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};