@duplicati/ngclient 0.0.147 → 0.0.148

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 as ut,b as ct,c as dt}from"./chunk-23CWXAU4.js";import{a as Oe}from"./chunk-DDWLL7XA.js";import{a as rt,b as Ve,c as _t}from"./chunk-2QJC4PGQ.js";import{b as re}from"./chunk-O64ZZGQZ.js";import{a as it}from"./chunk-DELLEGXW.js";import{a as Te}from"./chunk-VTSUHAP5.js";import{b as fe,c as Y,d as Ae,e as Q,f as Pe,h as ot,i as se,j as De,k as at,n as st,o as Ne,p as lt,q as Me,r as ye,s as le,t as Re}from"./chunk-N5SC4SKW.js";import{b as ie,d as z}from"./chunk-LVP2TPMO.js";import{A as he,C as tt,a as j,b as Je,e as Ze,g as oe,l as q,p as et,t as ae}from"./chunk-H7K35UUX.js";import{h as nt}from"./chunk-NOPMCS2Z.js";import{Ab as s,Bb as l,Cb as m,Gb as B,H as Le,Hb as k,Jb as G,Oc as I,Pc as ne,Qb as C,Ra as _,Rb as F,Sb as f,Tc as Be,Uc as ke,V as ge,Vb as Ge,Vc as Ee,Wb as E,Yb as u,_ as M,bb as H,ea as d,ec as me,fa as p,fc as Ce,gb as qe,gc as be,ic as Fe,lc as x,mc as ve,nc as Qe,oa as g,qc as w,rc as $,sc as L,tb as Ye,ub as y,vb as R,wb as Ie,xb as Ue,yb as xe,zb as T,zc as Se}from"./chunk-HNWRQABR.js";import{a as b,b as X}from"./chunk-EUDKD2JW.js";var we=class a{fromString(t){if(!t)return null;let e=t.match(/(\d+)([smhDWMY])/);return e&&{value:parseInt(e[1]),unit:e[2]}}toString(t,e){return`${t}${e}`}static \u0275fac=function(e){return new(e||a)};static \u0275prov=ge({token:a,factory:a.\u0275fac,providedIn:"root"})};function Ct(a,t){if(a&1){let e=G();s(0,"div",24)(1,"sh-form-field")(2,"label",25),f(3,7),l(),s(4,"input",26,0),L("ngModelChange",function(i){d(e);let o=u();return $(o.scheduleFields.nextTime().time,i)||(o.scheduleFields.nextTime().time=i),p(i)}),E("focus",function(){d(e);let i=be(5);return p(i.showPicker())}),l(),s(6,"sh-icon",27),x(7,"clock"),l()(),s(8,"sh-form-field"),m(9,"label",28),s(10,"input",29,1),L("ngModelChange",function(i){d(e);let o=u();return $(o.scheduleFields.nextTime().date,i)||(o.scheduleFields.nextTime().date=i),p(i)}),E("focus",function(){d(e);let i=be(11);return p(i.showPicker())}),l(),s(12,"sh-icon",27),x(13,"calendar"),l()()(),s(14,"div",24)(15,"sh-form-field")(16,"label",30),f(17,8),l(),s(18,"input",31),L("ngModelChange",function(i){d(e);let o=u();return $(o.scheduleFields.runAgain().repeatValue,i)||(o.scheduleFields.runAgain().repeatValue=i),p(i)}),l()(),s(19,"sh-select",32)(20,"input",33),L("ngModelChange",function(i){d(e);let o=u();return $(o.scheduleFields.runAgain().repeatUnit,i)||(o.scheduleFields.runAgain().repeatUnit=i),p(i)}),l()()(),s(21,"app-toggle-card",34),B(22,35),f(23,9),k(),s(24,"div",36)(25,"sh-toggle",19),C(26,10),s(27,"input",20),L("ngModelChange",function(i){d(e);let o=u();return $(o.scheduleFields.runAgain().allowedDays.mon,i)||(o.scheduleFields.runAgain().allowedDays.mon=i),p(i)}),l(),F(),l(),s(28,"sh-toggle",19),C(29,11),s(30,"input",20),L("ngModelChange",function(i){d(e);let o=u();return $(o.scheduleFields.runAgain().allowedDays.tue,i)||(o.scheduleFields.runAgain().allowedDays.tue=i),p(i)}),l(),F(),l(),s(31,"sh-toggle",19),C(32,12),s(33,"input",20),L("ngModelChange",function(i){d(e);let o=u();return $(o.scheduleFields.runAgain().allowedDays.wed,i)||(o.scheduleFields.runAgain().allowedDays.wed=i),p(i)}),l(),F(),l(),s(34,"sh-toggle",19),C(35,13),s(36,"input",20),L("ngModelChange",function(i){d(e);let o=u();return $(o.scheduleFields.runAgain().allowedDays.thu,i)||(o.scheduleFields.runAgain().allowedDays.thu=i),p(i)}),l(),F(),l(),s(37,"sh-toggle",19),C(38,14),s(39,"input",20),L("ngModelChange",function(i){d(e);let o=u();return $(o.scheduleFields.runAgain().allowedDays.fri,i)||(o.scheduleFields.runAgain().allowedDays.fri=i),p(i)}),l(),F(),l(),s(40,"sh-toggle",19),C(41,15),s(42,"input",20),L("ngModelChange",function(i){d(e);let o=u();return $(o.scheduleFields.runAgain().allowedDays.sat,i)||(o.scheduleFields.runAgain().allowedDays.sat=i),p(i)}),l(),F(),l(),s(43,"sh-toggle",19),C(44,16),s(45,"input",20),L("ngModelChange",function(i){d(e);let o=u();return $(o.scheduleFields.runAgain().allowedDays.sun,i)||(o.scheduleFields.runAgain().allowedDays.sun=i),p(i)}),l(),F(),l()()()}if(a&2){let e=u();_(4),w("ngModel",e.scheduleFields.nextTime().time),_(6),w("ngModel",e.scheduleFields.nextTime().date),_(8),w("ngModel",e.scheduleFields.runAgain().repeatValue),_(),T("options",e.unitOptions)("isClearable",!1),_(),w("ngModel",e.scheduleFields.runAgain().repeatUnit),_(),T("disallowToggle",!0),_(6),w("ngModel",e.scheduleFields.runAgain().allowedDays.mon),_(3),w("ngModel",e.scheduleFields.runAgain().allowedDays.tue),_(3),w("ngModel",e.scheduleFields.runAgain().allowedDays.wed),_(3),w("ngModel",e.scheduleFields.runAgain().allowedDays.thu),_(3),w("ngModel",e.scheduleFields.runAgain().allowedDays.fri),_(3),w("ngModel",e.scheduleFields.runAgain().allowedDays.sat),_(3),w("ngModel",e.scheduleFields.runAgain().allowedDays.sun)}}var Ft=[{key:"s",label:$localize`Seconds`},{key:"m",label:$localize`Minutes`},{key:"h",label:$localize`Hours`},{key:"D",label:$localize`Days`},{key:"W",label:$localize`Weeks`},{key:"M",label:$localize`Months`},{key:"Y",label:$localize`Years`}],ee={autoRun:!0,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}}},Ke=class a{#e=M(J);#t=M(z);#i=M(ie);unitOptions=Ft;scheduleFields=this.#e.scheduleFields;goBack(){this.#t.navigate(["source-data"],{relativeTo:this.#i.parent})}next(){this.#e.isNew()||this.#e.submit(!0),this.#t.navigate(["options"],{relativeTo:this.#i.parent})}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=H({type:a,selectors:[["app-schedule"]],decls:16,vars:2,consts:()=>{let t;t=$localize`Schedule`;let e;e=$localize` Automatically run backups ${"\uFFFD#5\uFFFD\uFFFD/#5\uFFFD"}:TAG_INPUT:`;let n;n=$localize`If a date was missed, the job will run as soon as possible.`;let i;i=$localize`${"\uFFFD#12\uFFFD"}:START_TAG_SH_ICON:arrow-left${"\uFFFD/#12\uFFFD"}:CLOSE_TAG_SH_ICON: Go back `;let o;o=$localize`${"\uFFFD#15\uFFFD"}:START_TAG_SH_ICON:arrow-right${"\uFFFD/#15\uFFFD"}:CLOSE_TAG_SH_ICON: Continue `;let r;r=$localize`Next time`;let c;c=$localize`Run again every`;let h;h=$localize`Allowed days`;let S;S=$localize` Monday ${"\uFFFD#27\uFFFD\uFFFD/#27\uFFFD"}:TAG_INPUT:`;let O;O=$localize` Tuesday ${"\uFFFD#30\uFFFD\uFFFD/#30\uFFFD"}:TAG_INPUT:`;let P;P=$localize` Wednesday ${"\uFFFD#33\uFFFD\uFFFD/#33\uFFFD"}:TAG_INPUT:`;let U;U=$localize` Thursday ${"\uFFFD#36\uFFFD\uFFFD/#36\uFFFD"}:TAG_INPUT:`;let K;K=$localize` Friday ${"\uFFFD#39\uFFFD\uFFFD/#39\uFFFD"}:TAG_INPUT:`;let v;v=$localize` Saturday ${"\uFFFD#42\uFFFD\uFFFD/#42\uFFFD"}:TAG_INPUT:`;let W;return W=$localize` Sunday ${"\uFFFD#45\uFFFD\uFFFD/#45\uFFFD"}:TAG_INPUT:`,[["timeRef",""],["dateRef",""],t,e,n,i,o,r,c,h,S,O,P,U,K,v,W,[1,"title-30"],[1,"toggle-wrap"],[1,"raised","primary"],["type","checkbox",3,"ngModelChange","ngModel"],[1,"form-actions"],["shButton","","type","button",3,"click"],["shButton","",1,"raised","primary",3,"click"],[1,"row-inputs"],["for","time"],["type","time","id","time",3,"ngModelChange","focus","ngModel"],["suffix",""],["for","date"],["type","date","id","date",3,"ngModelChange","focus","ngModel"],["for","repeatValue"],["type","number","id","repeatValue",3,"ngModelChange","ngModel"],["value","key","label","label",3,"options","isClearable"],["type","text","id","repeatUnit",3,"ngModelChange","ngModel"],[3,"disallowToggle"],["title",""],[1,"days-wrap"]]},template:function(e,n){e&1&&(s(0,"h3",17),f(1,2),l(),s(2,"div",18)(3,"sh-toggle",19),C(4,3),s(5,"input",20),L("ngModelChange",function(o){return $(n.scheduleFields.autoRun,o)||(n.scheduleFields.autoRun=o),o}),l(),F(),l(),s(6,"p"),f(7,4),l()(),y(8,Ct,46,14),s(9,"div",21)(10,"button",22),E("click",function(){return n.goBack()}),C(11,5),m(12,"sh-icon"),F(),l(),s(13,"button",23),E("click",function(){return n.next()}),C(14,6),m(15,"sh-icon"),F(),l()()),e&2&&(_(5),w("ngModel",n.scheduleFields.autoRun),_(3),R(n.scheduleFields.autoRun()?8:-1))},dependencies:[le,Y,at,fe,Q,se,q,he,j,oe,ae,Oe],styles:["[_nghost-%COMP%]{display:block;width:100%;max-width:32.5rem;padding:2.5rem 2.5rem 1.5rem;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})};function St(a,t){if(a&1&&(B(0,4),x(1),k()),a&2){let e,n=u();_(),ve((e=n.currentExpressionOption())==null?null:e.startsWith)}}function Et(a,t){if(a&1&&(B(0,5),x(1),k()),a&2){let e,n=u();_(),ve((e=n.currentExpressionOption())==null?null:e.endsWith)}}var ht=[{key:"Excludes folders where name contains",value:"-FolderName"},{key:"Excludes folder",value:"-Folder"},{key:"Excludes files where name contains",value:"-FileName"},{key:"Excludes file extension",value:"-Extension"},{key:"Excludes files where name matches regex",value:"-Regex"},{key:"Includes files where name matches regex",value:"+Regex"},{key:"Excludes file group",value:"-FileGroup"},{key:"Includes expression",value:"+Expression"},{key:"Excludes expression",value:"-Expression"},{key:"None",value:"-Unknown"}],$e=class a{path=ke.required();osType=ke();pathChange=Be();remove=Be();internalPath=g("");pathType=g("-Expression");currentExpressionOption=I(()=>{let t=this.pathType();return this.expressionOptions().find(e=>e.value===t)});expressionOptions=I(()=>{let e=this.osType()==="Windows"?"\\":"/";return ht.map(n=>n.value==="-Folder"||n.value==="+Folder"?X(b({},n),{startsWith:"",endsWith:""}):n.value==="-FolderName"||n.value==="+FolderName"?X(b({},n),{startsWith:"*",endsWith:`*${e}`}):n.value==="-FileName"||n.value==="+FileName"?X(b({},n),{startsWith:"[.*",endsWith:`[^\\${e}]*]`}):n.value==="-FileGroup"||n.value==="+FileGroup"?X(b({},n),{startsWith:"{",endsWith:"}"}):n.value==="-Regex"||n.value==="+Regex"?X(b({},n),{startsWith:"[",endsWith:"]"}):n.value==="-Extension"||n.value==="+Extension"?X(b({},n),{startsWith:"*.",endsWith:""}):X(b({},n),{startsWith:"",endsWith:""}))});pathEffect=ne(()=>{let t=this.path(),e=t.slice(1),n=t.startsWith("-")?"-":"+",i=this.osType()==="Windows",o=i?"\\":"/";e.startsWith("%")&&e.endsWith(o)||i&&e.slice(2).startsWith(o)&&e.endsWith(o)||e.startsWith(o)&&e.endsWith(o)?(this.pathType.set(`${n}Folder`),this.internalPath.set(e)):e.startsWith("*")&&e.endsWith(`*${o}`)?(this.pathType.set(`${n}FolderName`),this.internalPath.set(e.slice(1,-2))):e.startsWith("[.*")&&e.endsWith(`[^\\${o}]*]`)?(this.pathType.set(`${n}FileName`),this.internalPath.set(e.slice(3,-7))):e.startsWith("{")&&e.endsWith("}")?(this.pathType.set(`${n}FileGroup`),this.internalPath.set(e.slice(1,-1))):e.startsWith("[")&&e.endsWith("]")?(this.pathType.set(`${n}Regex`),this.internalPath.set(e.slice(1,-1))):e.startsWith("*.")?(this.pathType.set(`${n}Extension`),this.internalPath.set(e.slice(2))):(this.pathType.set(`${n}Expression`),this.internalPath.set(e))});updateFilter(){let t=this.internalPath(),e=this.currentExpressionOption();t!==""&&this.pathChange.emit(`${e?.value.slice(0,1)}${e?.startsWith??""}${t}${e?.endsWith??""}`)}removeFilter(){this.remove.emit()}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=H({type:a,selectors:[["app-new-filter"]],inputs:{path:[1,"path"],osType:[1,"osType"]},outputs:{pathChange:"pathChange",remove:"remove"},decls:9,vars:6,consts:()=>{let t;return t=$localize`Select an option...`,[["value","value","label","key",3,"options","isClearable"],["type","text","placeholder",t,3,"ngModelChange","ngModel"],[1,"expression-input"],["type","text",3,"ngModelChange","ngModel"],["prefix",""],["suffix",""],[1,"filter-removal",3,"click"],[1,"sh-primary"]]},template:function(e,n){if(e&1&&(s(0,"sh-select",0)(1,"input",1),L("ngModelChange",function(o){return $(n.pathType,o)||(n.pathType=o),o}),E("ngModelChange",function(){return n.updateFilter()}),l()(),s(2,"sh-form-field",2)(3,"input",3),L("ngModelChange",function(o){return $(n.internalPath,o)||(n.internalPath=o),o}),E("ngModelChange",function(){return n.updateFilter()}),l(),y(4,St,2,1,"ng-container",4),y(5,Et,2,1,"ng-container",5),l(),s(6,"div",6),E("click",function(){return n.removeFilter()}),s(7,"sh-icon",7),x(8,"x-circle"),l()()),e&2){let i,o;T("options",n.expressionOptions())("isClearable",!1),_(),w("ngModel",n.pathType),_(2),w("ngModel",n.internalPath),_(),R(!((i=n.currentExpressionOption())==null||i.startsWith==null)&&i.startsWith.length?4:-1),_(),R(!((o=n.currentExpressionOption())==null||o.endsWith==null)&&o.endsWith.length?5:-1)}},dependencies:[le,Y,Q,se,ae,q,j],styles:["[_nghost-%COMP%]{display:grid;grid-template-columns:13.125rem 1fr 1.875rem;gap:.5rem;align-items:flex-end}.expression-input[_ngcontent-%COMP%]{--ff-suffix-bg: var(--base-2)}.filter-removal[_ngcontent-%COMP%]{cursor:pointer;display:flex;align-items:center;justify-content:center;height:2.5rem;flex:0 0}"],changeDetection:0})};var Tt=["formRef"],ze=()=>({standalone:!0});function ft(a,t){if(a&1){let e=G();s(0,"sh-form-field",41)(1,"input",42),L("ngModelChange",function(i){d(e);let o=u(2);return $(o.editingPath,i)||(o.editingPath=i),p(i)}),l()(),s(2,"button",43),E("click",function(){d(e);let i=u(2);return p(i.updatePath())}),s(3,"sh-icon"),x(4,"floppy-disk"),l()(),s(5,"button",43),E("click",function(){d(e);let i=u(2);return p(i.cancelEditPath())}),s(6,"sh-icon"),x(7,"x-bold"),l()()}if(a&2){let e=u(2);_(),w("ngModel",e.editingPath),T("ngModelOptions",Se(2,ze))}}function At(a,t){if(a&1){let e=G();s(0,"sh-form-field",41),m(1,"input",44),l(),s(2,"button",43),E("click",function(){d(e);let i=u().$implicit,o=u();return p(o.editPath(i))}),s(3,"sh-icon"),x(4,"pen"),l()(),s(5,"button",43),E("click",function(){d(e);let i=u().$implicit,o=u();return p(o.removePath(i))}),s(6,"sh-icon"),x(7,"trash-simple"),l()()}if(a&2){let e=u().$implicit;Ye("readonly",!0),_(),T("ngModel",e)("ngModelOptions",Se(3,ze))}}function Pt(a,t){if(a&1&&(s(0,"div",30),y(1,ft,8,3)(2,At,8,4),l()),a&2){let e=t.$implicit,n=u();_(),R(n.oldPath()===e?1:2)}}function Dt(a,t){if(a&1){let e=G();s(0,"app-new-filter",46),E("pathChange",function(i){let o=d(e).$index,r=u(2);return p(r.patchPathAt(i,o))})("remove",function(){let i=d(e).$index,o=u(2);return p(o.removePathAt(i))}),l()}if(a&2){let e=t.$implicit,n=u(2);T("path",e)("osType",n.osType()??"")}}function Nt(a,t){if(a&1&&Ue(0,Dt,1,2,"app-new-filter",45,Ie),a&2){let e=u();xe(e.pathArray())}}function Mt(a,t){if(a&1){let e=G();s(0,"div",31)(1,"app-size",47),E("ngModelChange",function(i){d(e);let o=u();return p(o.updateFilesLargerThan(i))}),l()()}if(a&2){let e=u();_(),T("ngModel",e.filesLargerThan())("ngModelOptions",Se(2,ze))}}var V=new ye,pt=(a={path:"",filters:[],excludes:{hidden:!1,system:!1,temporary:!1,filesLargerThan:null}})=>V.group({path:V.control(a.path),excludes:V.group({hidden:V.control(a.excludes.hidden),system:V.control(a.excludes.system),temporary:V.control(a.excludes.temporary),filesLargerThan:V.group({size:V.control(null),unit:V.control(null)})})}),He=class a{#e=M(J);#t=M(z);#i=M(ie);formRef=Ee.required("formRef");sourceDataForm=this.#e.sourceDataForm;sourceDataFormSignal=this.#e.sourceDataFormSignal;newPathCtrl=new ot("");filesLargerThan=I(()=>this.sourceDataFormSignal()?.excludes?.filesLargerThan?.size!==null);osType=this.#e.osType;pathSignal=re(this.sourceDataForm.controls.path.valueChanges);pathArray=I(()=>this.pathSignal()?.split("\0").filter(t=>t.startsWith("-")||t.startsWith("+")||t==="___none___")??[]);nonFilterPaths=I(()=>this.pathSignal()?.split("\0").filter(t=>!t.startsWith("-")&&!t.startsWith("+")&&t!==""));oldPath=g(null);editingPath=g(null);addingNewPath=g(!1);editPath(t){this.oldPath.set(t),this.editingPath.set(t)}updateFilesLargerThan(t){let{size:e,unit:n}=ct(t);this.sourceDataForm.controls.excludes.controls.filesLargerThan.setValue({size:e,unit:n})}updatePath(){let t=this.oldPath(),e=this.editingPath();if(!t||!e||e===t){this.oldPath.set(null),this.editingPath.set(null);return}let n=this.sourceDataForm.controls.path.value;this.sourceDataForm.controls.path.setValue(n?.replace(t,e)??""),this.oldPath.set(null),this.editingPath.set(null)}cancelEditPath(){this.oldPath.set(null),this.editingPath.set(null)}removePath(t){let n=(this.sourceDataForm.controls.path.value??"").split("\0"),i=n.indexOf(t);if(i===-1)return;n.splice(i,1);let o=n.filter(r=>r&&r!=="").join("\0");this.sourceDataForm.controls.path.setValue(o)}addFilter(t="-*"){let n=[this.sourceDataForm.controls.path.value,t].filter(i=>i&&i!=="").join("\0");this.sourceDataForm.controls.path.setValue(n)}patchPathAt(t,e){let i=this.sourceDataForm.controls.path.value.split("\0").filter(c=>!c.startsWith("-")&&!c.startsWith("+")).join("\0"),o=this.pathArray().map((c,h)=>h===e?`${t}`:`${c}`).join("\0"),r=[i,o].filter(c=>c&&c!=="").join("\0");this.sourceDataForm.controls.path.setValue(r)}removePathAt(t){let n=this.sourceDataForm.controls.path.value.split("\0").filter(r=>!r.startsWith("-")&&!r.startsWith("+")).join("\0"),i=this.pathArray().filter((r,c)=>c!==t).join("\0"),o=[n,i].filter(r=>r&&r!=="").join("\0");this.sourceDataForm.controls.path.setValue(o)}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})}addNewPath(){let t=this.sourceDataForm.controls.path.value,e=this.newPathCtrl.value,n=t?.split("\0")||[];e&&!n.includes(e)&&n.push(e);let i=n.filter(o=>o&&o!=="").join("\0");this.sourceDataForm.controls.path.setValue(i),this.newPathCtrl.setValue("")}goBack(){this.#t.navigate(["destination"],{relativeTo:this.#i.parent})}next(){this.#e.isNew()||this.#e.submit(!0),this.#t.navigate(["schedule"],{relativeTo:this.#i.parent})}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=H({type:a,selectors:[["app-source-data"]],viewQuery:function(e,n){e&1&&me(n.formRef,Tt,5),e&2&&Ce()},decls:56,vars:12,consts:()=>{let t;t=$localize`Path`;let e;e=$localize`Add a direct path`;let n;n=$localize`Hidden files`;let i;i=$localize`System files`;let o;o=$localize`Temporary files`;let r;r=$localize`Source Data`;let c;c=$localize`Folder path`;let h;h=$localize`${"\uFFFD#12\uFFFD"}:START_TAG_SH_ICON:arrow-left${"\uFFFD/#12\uFFFD"}:CLOSE_TAG_SH_ICON: Go back `;let S;S=$localize`${"\uFFFD#15\uFFFD"}:START_TAG_SH_ICON:arrow-right${"\uFFFD/#15\uFFFD"}:CLOSE_TAG_SH_ICON: Continue `;let O;O=$localize`Paths`;let P;P=$localize`Add a path directly from your machine.`;let U;U=$localize`Filters`;let K;K=$localize`Customize your filters.`;let v;v=$localize`Add filter`;let W;W=$localize`Exclude`;let D;D=$localize`Choose if there’s any files you want to exclude.`;let Z;Z=$localize` Files with the Hidden attribute ${"\uFFFD#46\uFFFD\uFFFD/#46\uFFFD"}:TAG_INPUT:`;let _e;_e=$localize` Files with the System attribute ${"\uFFFD#49\uFFFD\uFFFD/#49\uFFFD"}:TAG_INPUT:`;let ue;ue=$localize` Files with the Temporary attribute ${"\uFFFD#52\uFFFD\uFFFD/#52\uFFFD"}:TAG_INPUT:`;let ce;ce=$localize` Files larger than `;let A;return A=$localize`Edit path`,[["formRef",""],r,c,h,S,O,P,U,K,v,W,D,Z,_e,ue,ce,[3,"submit","formGroup"],[1,"left"],[1,"title-30"],[1,"fill",3,"multiSelect","startingPath","showFiles"],["for","path"],["type","text","id","path","tabindex","4","placeholder",t,"formControlName","path"],[1,"form-actions"],["shButton","","type","button",3,"click"],["shButton","","type","submit",1,"raised","primary"],[1,"right"],[3,"disallowToggle"],["title",""],["description",""],[1,"paths"],[1,"path"],[1,"row-inputs"],["type","text","placeholder",e,3,"formControl"],["shButton","","type","button",1,"raised","primary",3,"click"],["type","button","shButton","","action","",3,"click"],["formGroupName","excludes",3,"disallowToggle"],[1,"raised","primary"],["type","checkbox","placeholder",n,"formControlName","hidden"],["type","checkbox","placeholder",i,"formControlName","system"],["type","checkbox","placeholder",o,"formControlName","temporary"],[1,"raised","primary",3,"click"],[1,"small"],["type","text","placeholder",A,3,"ngModelChange","ngModel","ngModelOptions"],["shButton","","type","button",1,"small",3,"click"],["type","text",3,"ngModel","ngModelOptions"],[3,"path","osType"],[3,"pathChange","remove","path","osType"],[3,"ngModelChange","ngModel","ngModelOptions"]]},template:function(e,n){if(e&1){let i=G();s(0,"form",16,0),E("submit",function(){return d(i),p(n.next())}),s(2,"div",17)(3,"h3",18),f(4,1),l(),s(5,"app-file-tree",19)(6,"label",20),f(7,2),l(),m(8,"input",21),l(),s(9,"div",22)(10,"button",23),E("click",function(){return d(i),p(n.goBack())}),C(11,3),m(12,"sh-icon"),F(),l(),s(13,"button",24),C(14,4),m(15,"sh-icon"),F(),l()()(),s(16,"div",25)(17,"app-toggle-card",26),B(18,27),f(19,5),k(),s(20,"p",28),f(21,6),l(),s(22,"div",29),Ue(23,Pt,3,1,"div",30,Ie),s(25,"div",31)(26,"sh-form-field"),m(27,"input",32),l(),s(28,"button",33),E("click",function(){return d(i),p(n.addNewPath())}),s(29,"sh-icon"),x(30,"plus"),l()()()()(),s(31,"app-toggle-card",26),B(32,27),f(33,7),k(),s(34,"p",28),f(35,8),l(),s(36,"button",34),E("click",function(){return d(i),p(n.addFilter())}),f(37,9),l(),y(38,Nt,2,0),l(),s(39,"app-toggle-card",35),B(40,27),f(41,10),k(),s(42,"p",28),f(43,11),l(),s(44,"sh-toggle",36),C(45,12),m(46,"input",37),F(),l(),s(47,"sh-toggle",36),C(48,13),m(49,"input",38),F(),l(),s(50,"sh-toggle",36),C(51,14),m(52,"input",39),F(),l(),s(53,"sh-toggle",40),E("click",function(){return d(i),p(n.toggleFilesLargerThan())}),f(54,15),l(),y(55,Mt,2,3,"div",31),l()()()}if(e&2){let i;T("formGroup",n.sourceDataForm),_(5),T("multiSelect",!0)("startingPath",n.getPath())("showFiles",!0),_(12),T("disallowToggle",!0),_(6),xe(n.nonFilterPaths()),_(4),T("formControl",n.newPathCtrl),_(4),T("disallowToggle",!0),_(7),R((i=n.pathSignal())!=null&&i.length?38:-1),_(),T("disallowToggle",!0),_(14),Fe("active",n.filesLargerThan()),_(2),R(n.filesLargerThan()?55:-1)}},dependencies:[le,De,Y,fe,Q,Pe,se,Re,st,Ne,Me,lt,q,j,oe,he,$e,ut,Oe,dt],styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;width:100%;flex:1 0;overflow:hidden}form[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;flex:1 0;overflow:hidden}.right[_ngcontent-%COMP%], .left[_ngcontent-%COMP%]{flex:1 0;display:flex;flex-direction:column;gap:1.5rem}.left[_ngcontent-%COMP%]{padding:2.5rem;overflow:hidden;border-right:1px solid var(--base-4)}.right[_ngcontent-%COMP%]{padding:2.5rem 1.5rem;overflow:auto}.form-actions[_ngcontent-%COMP%]{display:flex;justify-content:space-between}sh-divider[_ngcontent-%COMP%]{margin:.75rem 0}.row-inputs[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr min-content;gap:.25rem}.paths[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.path[_ngcontent-%COMP%]{display:grid;align-items:center;grid-template-columns:1fr min-content min-content;gap:.25rem}"],changeDetection:0})};var gt="1W:1D,4W:1W,12M:1M",J=class a{#e=M(z);#t=M(Te);#i=M(Ze);#n=M(nt);#a=M(we);generalForm=mt();sourceDataForm=pt();scheduleFields={autoRun:g(ee.autoRun),nextTime:g(ee.nextTime),runAgain:g(ee.runAgain)};settings=g([]);optionsFields={remoteVolumeSize:g("50MB"),backupRetention:g("all"),backupRetentionTime:g(""),backupRetentionVersions:g(0),backupRetentionCustom:g("")};targetUrlModel=g(null);backupMetadata=g(null);isDraft=g(!1);backupId=g(null);backupName=I(()=>this.generalFormSignal()?.name??"");isSubmitting=g(!1);finishedLoading=g(!1);backupDefaults=g(null);applicationOptions=g(null);isNew=I(()=>this.backupId()==="new");osType=I(()=>this.#t.systemInfo()?.OSType);selectedOptions=g([]);sourceDataFormSignal=re(this.sourceDataForm.valueChanges);generalFormSignal=re(this.generalForm.valueChanges);encryptionFieldSignal=re(this.generalForm.controls.encryption.valueChanges);advancedOptions=I(()=>this.#t.systemInfo()?.Options?.map(this.#_)??[]);#o=g("");#s=g(null);#l=null;testSignal=this.#o.asReadonly();testErrorMessage=this.#s.asReadonly();#d=ne(()=>{let t=this.targetUrlModel(),e=this.#o(),n=this.#l;this.#l=t,!(e==="testing"||n===null||n===t)&&(this.#o.set(""),this.#s.set(null))});setTestState(t,e){this.#o.set(t),this.#s.set(e??null)}#_(t){return{name:t.Name,type:t.Type,shortDescription:t.ShortDescription??void 0,longDescription:t.LongDescription??void 0,options:t.ValidValues}}encryptionOptions=I(()=>{let t=this.#t.systemInfo()?.EncryptionModules??[];return[pe,...t]});nonSelectedOptions=I(()=>this.advancedOptions().sort((t,e)=>t?.name&&e?.name?t?.name.localeCompare(e?.name):0).filter(t=>this.selectedOptions()?.findIndex(e=>e.name===t.name)===-1));submit(t=!1){this.isSubmitting.set(!0);let e=this.#u(),n=this.backupId();this.isDraft()&&e.Backup&&(e.Backup.Metadata=this.backupMetadata()),n==="new"||!n||this.isDraft()?this.#n.postApiV1Backups({requestBody:e}).pipe(Le(()=>this.isSubmitting.set(!1))).subscribe({next:i=>{t||this.exit(!1)},error:i=>{}}):this.#n.putApiV1BackupById({id:n,requestBody:e}).pipe(Le(()=>this.isSubmitting.set(!1))).subscribe({next:i=>{t||this.exit(!1)},error:i=>{}})}exit(t){if(!t){this.#r(),this.#e.navigate(["/"]);return}this.#i.open(it,{data:{title:$localize`Confirm exit?`,message:$localize`Are you sure you want to exit?`,confirmText:$localize`Yes`,cancelText:$localize`Cancel`},closed:e=>{e&&(this.#r(),this.#e.navigate(["/"]))}})}mapSourceDataToForm(t){let e=t.Sources??"",n=t.Filters?.map(c=>`${c.Include?"":"-"}${c.Expression}`)??[],i=t.Settings?.find(c=>c.Name==="--exclude-files-attributes")?.Value??"",o=t.Settings?.find(c=>c.Name==="--skip-files-larger-than")??null,r={path:[...e,...n].join("\0"),excludes:{hiddenFiles:i.includes("hidden"),systemFiles:i.includes("system"),tempFiles:i.includes("temporary"),filesLargerThan:o?.Value?.toUpperCase()??null}};this.sourceDataForm.patchValue(r)}mapDestinationToForm(t){this.targetUrlModel.set(t.TargetURL??"")}mapGeneralToForm(t){let e=t.Name??"",n=t.Description??"",i=t.Settings?.find(S=>S.Name==="encryption-module"),o=t.Settings?.find(S=>S.Name==="passphrase")?.Value??"",r=i?.Value&&i.Value.length?i.Value:"",c=t.Settings?.find(S=>S.Name==="compression-module")?.Value??"",h={name:t.Name??"",description:t.Description??""};e&&e!==""&&(h.name=e),n&&n!==""&&(h.description=n),r&&r!==""&&(h.encryption=r),o&&o!==""&&(h.password=o,h.repeatPassword=o),c&&c!==""&&(h.compression=c),this.generalForm.patchValue(h)}mapScheduleToForm(t){if(!t){this.scheduleFields.autoRun.set(!1);return}let e=this.#a.fromString(t.Repeat)??null,n=this.#c(t.Time);this.scheduleFields.autoRun.set(!0),this.scheduleFields.nextTime.update(i=>b(b({},i),n)),this.scheduleFields.runAgain.set({repeatValue:e?.value??1,repeatUnit:e?.unit??"D",allowedDays:{mon:t.AllowedDays?.includes("mon")??!1,tue:t.AllowedDays?.includes("tue")??!1,wed:t.AllowedDays?.includes("wed")??!1,thu:t.AllowedDays?.includes("thu")??!1,fri:t.AllowedDays?.includes("fri")??!1,sat:t.AllowedDays?.includes("sat")??!1,sun:t.AllowedDays?.includes("sun")??!1}})}mapOptionsToForms(t){let e=["--no-encryption","--exclude-files-attributes","--skip-files-larger-than","dblock-size","passphrase","keep-time","keep-versions","retention-policy"],n=t.Settings?.filter(r=>!e.includes(r.Name)),i=t.Settings?.filter(r=>e.includes(r.Name));this.settings.set(n??[]),n?.forEach(r=>{if(r.Name==="encryption-module"&&this.isNew())return this.generalForm.controls.encryption.setValue(r.Value??"")});var o="all";i?.forEach(r=>{if(r.Name==="dblock-size"&&this.optionsFields.remoteVolumeSize.set(r.Value??"50MB"),r.Name==="keep-time"&&(r.Value??"")!=="")return o="time",this.optionsFields.backupRetentionTime.set(r.Value??"");if(r.Name==="keep-versions"&&(r.Value??"")!=="")return o="versions",this.optionsFields.backupRetentionVersions.set(r.Value?parseInt(r.Value):null);if(r.Name==="retention-policy"&&(r.Value??"")!=="")if(r.Value===gt)o="smart";else return o="custom",this.optionsFields.backupRetentionCustom.set(r.Value??"")}),this.optionsFields.backupRetention.set(o)}storeMetadata(t,e){this.backupMetadata.set(e?t.Metadata??null:null)}getScheduleFormValue(){return{autoRun:this.scheduleFields.autoRun(),nextTime:this.scheduleFields.nextTime(),runAgain:this.scheduleFields.runAgain()}}#u(){let t=this.generalForm.value,e=this.getScheduleFormValue(),n=this.sourceDataForm.value,i=this.targetUrlModel(),o=null;e.runAgain?.repeatUnit&&e.runAgain?.repeatValue&&(o=this.#a.toString(e.runAgain.repeatValue,e.runAgain.repeatUnit));let r=e.runAgain?.allowedDays?Object.entries(e.runAgain?.allowedDays).filter(([P,U])=>U).map(([P,U])=>P):[],c=n.path?.split("\0")??[],h=this.mapFormsToSettings(),S=Object.entries(n.excludes??{}).filter(([P,U])=>U&&P!=="filesLargerThan").map(([P])=>P),O=n.excludes?.filesLargerThan;return S.length&&h.push({Name:"--exclude-files-attributes",Value:S.join(",")}),O&&O.size!==null&&O.unit!==null&&h.push({Name:"--skip-files-larger-than",Value:`${O.size}${O.unit}`}),{Backup:{Name:t.name,Description:t.description,TargetURL:i??null,Sources:c.filter(P=>!P.startsWith("-")),Settings:h,Filters:c.filter(P=>P.startsWith("-")).map((P,U)=>({Order:U,Include:!1,Expression:P.slice(1)}))},Schedule:e.autoRun?{Repeat:o,Time:e.nextTime?.date?new Date(`${e.nextTime.date}T${e.nextTime?.time||"00:00:00"}`).toISOString():null,AllowedDays:r}:null}}mapFormsToSettings(t=[]){let e=this.generalForm.value,n=["--no-encryption","--exclude-files-attributes","--skip-files-larger-than","encryption-module","passphrase","keep-time","keep-versions","retention-policy","dblock-size","compression-module"],i=[{Name:"--no-encryption",Value:"True"}];e.encryption!==""&&e.encryption!==pe.Key&&(i=[{Name:"encryption-module",Value:e.encryption??null},{Name:"passphrase",Value:e.password??null}]);let o=[{Name:"compression-module",Value:e.compression}];e.compression===""&&(o=[]);let r=[{Name:"dblock-size",Value:this.optionsFields.remoteVolumeSize()}];switch(this.optionsFields.backupRetention()){case"time":r.push({Name:"keep-time",Value:this.optionsFields.backupRetentionTime()});break;case"versions":r.push({Name:"keep-versions",Value:this.optionsFields.backupRetentionVersions()?.toString()??""});break;case"custom":r.push({Name:"retention-policy",Value:this.optionsFields.backupRetentionCustom()});break;case"smart":r.push({Name:"retention-policy",Value:gt});break}let c=[...t,...n],h=this.settings().filter(S=>!c.includes(S.Name)).map(S=>{let O=S.Value;return typeof S.Value=="number"&&(O=S.Value.toString()),typeof S.Value=="boolean"&&(O=S.Value?"True":"False"),{Name:S.Name?.startsWith("--")?S.Name:`--${S.Name}`,Value:O}});return[...i,...o,...r,...h]}#c(t){if(!t||t?.indexOf("T")===-1)return{time:t??"13:00"};let e=new Date(t);return{time:`${(""+e.getHours()).padStart(2,"0")}:${(""+e.getMinutes()).padStart(2,"0")}`,date:e.toISOString().split("T")[0]}}setTargetUrl(t,e=!1){e&&(this.#l=null),this.targetUrlModel.set(t)}#r(){this.generalForm.reset(),this.sourceDataForm.reset(),this.scheduleFields.autoRun.set(ee.autoRun),this.scheduleFields.nextTime.set(ee.nextTime),this.scheduleFields.runAgain.set(ee.runAgain),this.optionsFields.remoteVolumeSize.set("50MB"),this.optionsFields.backupRetention.set("all"),this.settings.set([]),this.targetUrlModel.set(null)}static \u0275fac=function(e){return new(e||a)};static \u0275prov=ge({token:a,factory:a.\u0275fac,providedIn:"root"})};var yt=["formRef"];function Rt(a,t){a&1&&(s(0,"sh-alert",17),C(1,5),m(2,"sh-icon",26),F(),l())}function Ot(a,t){if(a&1&&x(0),a&2){let e=t.$implicit;Qe(" ",e.DisplayName," ")}}function wt(a,t){if(a&1&&m(0,"sh-progress-bar",40),a&2){let e=u(3);Fe("error",e.calculatePasswordStrength()===1)("warn",e.calculatePasswordStrength()===2)("primary",e.calculatePasswordStrength()===4)("success",e.calculatePasswordStrength()===5),T("value",e.calculatePasswordStrength()*(100/5))}}function $t(a,t){a&1&&(s(0,"span",35),f(1,10),l())}function Lt(a,t){a&1&&(C(0,8,1),m(1,"sh-icon"),F())}function It(a,t){a&1&&(C(0,8,2),m(1,"sh-icon"),F())}function Ut(a,t){a&1&&(C(0,11,1),m(1,"sh-icon",42),F())}function xt(a,t){a&1&&(C(0,11,2),m(1,"sh-icon"),F())}function Gt(a,t){if(a&1){let e=G();s(0,"button",41),E("click",function(){d(e);let i=u(3);return p(i.copyPassword())}),C(1,11),y(2,Ut,2,0)(3,xt,2,0),F(),l()}if(a&2){let e=u(3);_(2),R(e.copiedPassword()?2:3)}}function bt(a,t){a&1&&(s(0,"sh-alert",39),f(1,12),l())}function vt(a,t){if(a&1){let e=G();s(0,"div",30)(1,"sh-form-field")(2,"label",31),C(3,7),m(4,"sup"),F(),l(),m(5,"input",32),l(),y(6,wt,1,9,"sh-progress-bar",33),s(7,"sh-form-field"),m(8,"input",34),y(9,$t,2,0,"span",35),l(),s(10,"div",36)(11,"button",37),E("click",function(){d(e);let i=u(2);return p(i.showPassword.set(!i.showPassword()))}),C(12,8),y(13,Lt,2,0)(14,It,2,0),F(),l(),s(15,"button",37),E("click",function(){d(e);let i=u(2);return p(i.generatePassword())}),C(16,9),m(17,"sh-icon"),F(),l(),y(18,Gt,4,1,"button",38),l(),y(19,bt,2,0,"sh-alert",39),l()}if(a&2){let e=u(2);_(5),T("type",e.showPassword()?"text":"password"),_(),R(e.generalForm.value.password?6:-1),_(2),T("type",e.showPassword()?"text":"password"),_(),R(e.generalForm.value.repeatPassword&&e.generalForm.value.repeatPassword!==e.generalForm.value.password?9:-1),_(4),R(e.showPassword()?13:14),_(5),R(e.showCopyPassword()?18:-1),_(),R(e.generalForm.value.password&&e.generalForm.value.password===e.generalForm.value.repeatPassword?19:-1)}}function Bt(a,t){if(a&1&&(s(0,"sh-select",27)(1,"label",28),f(2,6),l(),m(3,"input",29),qe(4,Ot,1,1,"ng-template"),l(),y(5,vt,20,7,"div",30)),a&2){let e=u();T("options",e.encryptionOptions())("isClearable",!1),_(5),R(e.encryptionFieldSignal()!==e.noneOptionKey?5:-1)}}function kt(a,t){if(a&1&&(s(0,"button",24),C(1,13),m(2,"sh-icon"),F(),l()),a&2){let e=u();T("disabled",e.nameAndDescriptionValid()===!1)}}function Vt(a,t){if(a&1&&(s(0,"button",25),C(1,14),m(2,"sh-icon"),F(),l()),a&2){let e=u();T("disabled",e.generalForm.invalid||e.showCopyPassword()&&!e.copiedPassword())}}var te=new ye,mt=(a={name:"",description:"",encryption:"",password:"",repeatPassword:"",compression:""})=>te.group({name:te.control(a.name,[Ae.required]),description:te.control(a.description),encryption:te.control(a.encryption,[_t()]),password:te.control(a.password,[Ve(t=>t?.value.encryption!=="",[Ae.required])]),repeatPassword:te.control(a.repeatPassword,[Ve(t=>t?.value.encryption!=="",[Ae.required])]),compression:te.control(a.compression)}),pe={Key:"-",DisplayName:"None"},je=class a{#e=M(z);#t=M(ie);#i=M(rt);#n=M(J);#a=M(Te);formRef=Ee.required("formRef");generalForm=this.#n.generalForm;generalFormSignal=this.#n.generalFormSignal;encryptionFieldSignal=this.#n.encryptionFieldSignal;encryptionOptions=this.#n.encryptionOptions;isNew=this.#n.isNew;showPassword=g(!1);copiedPassword=g(!1);showCopyPassword=g(!1);noneOptionKey=pe.Key;encryptionEffect=ne(()=>{this.encryptionFieldSignal()===pe.Key&&(this.copiedPassword.set(!1),this.showCopyPassword.set(!1))});nameAndDescriptionValid=I(()=>{let t=this.generalFormSignal(),e=this.generalForm.controls;return e?.name&&e.name.valid&&e?.description&&e.description.valid});calculatePasswordStrength=I(()=>{let e=this.generalFormSignal()?.password??"";return this.#i.calculatePasswordStrength(e)});ngOnInit(){this.formRef().nativeElement.focus()}exit(){this.#n.exit(!0)}async copyPassword(){let t=this.generalForm.controls.password.value;await this.#o(t??""),this.copiedPassword.set(!0)}async#o(t){try{await navigator.clipboard.writeText(t)}catch{try{let n=document.createElement("textarea");n.value=t,document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n)}catch(n){console.error("Failed to copy text: ",n)}}}generatePassword(){this.copiedPassword.set(!1);let t=this.#i.generate(16);this.generalForm.controls.password.setValue(t),this.generalForm.controls.repeatPassword.setValue(t),this.showCopyPassword.set(!0)}next(){this.#n.isNew()||this.#n.submit(!0),this.#e.navigate(["destination"],{relativeTo:this.#t.parent})}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=H({type:a,selectors:[["app-general"]],viewQuery:function(e,n){e&1&&me(n.formRef,yt,5),e&2&&Ce()},decls:21,vars:4,consts:()=>{let t;t=$localize`Your backup name`;let e;e=$localize`Your backup description`;let n;n=$localize`Remember to copy the password`;let i;i=$localize`General backup settings`;let o;o=$localize` Backup name ${"\uFFFD#8\uFFFD"}:START_SUPERSCRIPT:*${"\uFFFD/#8\uFFFD"}:CLOSE_SUPERSCRIPT:`;let r;r=$localize`Backup description`;let c;c=$localize`${"\uFFFD#18\uFFFD"}:START_TAG_SH_ICON:arrow-left${"\uFFFD/#18\uFFFD"}:CLOSE_TAG_SH_ICON: Exit `;let h;h=$localize`${"\uFFFD#2\uFFFD"}:START_TAG_SH_ICON:lock${"\uFFFD/#2\uFFFD"}:CLOSE_TAG_SH_ICON: Encrypted backup `;let S;S=$localize`Encryption`;let O;O=$localize`Encryption`;let P;P=$localize`Password`;let U;U=$localize`Repeat password`;let K;K=$localize` Create a password ${"\uFFFD#4\uFFFD"}:START_SUPERSCRIPT:*${"\uFFFD/#4\uFFFD"}:CLOSE_SUPERSCRIPT:`;let v;v=$localize`${"\uFFFD*13:1\uFFFD"}:START_BLOCK_IF:${"[\uFFFD#1:1\uFFFD|\uFFFD#1:2\uFFFD]"}:START_TAG_SH_ICON:eye-slash${"[\uFFFD/#1:1\uFFFD|\uFFFD/#1:2\uFFFD]"}:CLOSE_TAG_SH_ICON: hide ${"\uFFFD/*13:1\uFFFD"}:CLOSE_BLOCK_IF:${"\uFFFD*14:2\uFFFD"}:START_BLOCK_ELSE:${"[\uFFFD#1:1\uFFFD|\uFFFD#1:2\uFFFD]"}:START_TAG_SH_ICON:eye${"[\uFFFD/#1:1\uFFFD|\uFFFD/#1:2\uFFFD]"}:CLOSE_TAG_SH_ICON: show ${"\uFFFD/*14:2\uFFFD"}:CLOSE_BLOCK_ELSE:`,v=Ge(v);let W;W=$localize`${"\uFFFD#17\uFFFD"}:START_TAG_SH_ICON:password${"\uFFFD/#17\uFFFD"}:CLOSE_TAG_SH_ICON: Generate password `;let D;D=$localize`Passwords do not match`;let Z;Z=$localize`${"\uFFFD*2:1\uFFFD"}:START_BLOCK_IF:${"\uFFFD#1:1\uFFFD"}:START_TAG_SH_ICON:check${"[\uFFFD/#1:1\uFFFD|\uFFFD/#1:2\uFFFD]"}:CLOSE_TAG_SH_ICON: Copied password ${"\uFFFD/*2:1\uFFFD"}:CLOSE_BLOCK_IF:${"\uFFFD*3:2\uFFFD"}:START_BLOCK_ELSE:${"\uFFFD#1:2\uFFFD"}:START_TAG_SH_ICON_1:copy${"[\uFFFD/#1:1\uFFFD|\uFFFD/#1:2\uFFFD]"}:CLOSE_TAG_SH_ICON: Copy password ${"\uFFFD/*3:2\uFFFD"}:CLOSE_BLOCK_ELSE:`,Z=Ge(Z);let _e;_e=$localize` Tip: Be sure to save your password. If you lose it, you will lose access to your backups. `;let ue;ue=$localize` Continue ${"\uFFFD#2\uFFFD"}:START_TAG_SH_ICON:arrow-right${"\uFFFD/#2\uFFFD"}:CLOSE_TAG_SH_ICON:`;let ce;return ce=$localize` Continue ${"\uFFFD#2\uFFFD"}:START_TAG_SH_ICON:arrow-right${"\uFFFD/#2\uFFFD"}:CLOSE_TAG_SH_ICON:`,[["formRef",""],i,o,r,c,h,O,K,v,W,D,Z,_e,ue,ce,["autocomplete","off",3,"submit","formGroup"],[1,"title-30"],[1,"primary"],["for","backupName"],["type","text","tabindex","1","placeholder",t,"formControlName","name"],["for","backupDescription"],["id","backupDescription","tabindex","2","placeholder",e,"formControlName","description"],[1,"form-actions"],["type","button","shButton","",3,"click"],["shButton","","type","submit",1,"raised","primary",3,"disabled"],["shButton","","type","submit","shTooltip",n,1,"raised","primary",3,"disabled"],["icon",""],["value","Key","label","DisplayName",3,"options","isClearable"],["for","encryption"],["type","text","id","encryption","tabindex","3","placeholder",S,"formControlName","encryption"],[1,"passwords"],["for","password"],["id","password","tabindex","4","autocomplete","off","placeholder",P,"formControlName","password",3,"type"],[1,"raised",3,"error","warn","primary","success","value"],["id","repeatPassword","tabindex","5","autocomplete","off","placeholder",U,"formControlName","repeatPassword",3,"type"],["error",""],[1,"password-actions"],["shButton","","type","button",1,"small",3,"click"],["shButton","","type","button",1,"small","copy"],["type","primary"],[1,"raised",3,"value"],["shButton","","type","button",1,"small","copy",3,"click"],[1,"sh-success"]]},template:function(e,n){if(e&1){let i=G();s(0,"form",15,0),E("submit",function(){return d(i),p(n.next())}),s(2,"h3",16),f(3,1),l(),y(4,Rt,3,0,"sh-alert",17),s(5,"sh-form-field")(6,"label",18),C(7,2),m(8,"sup"),F(),l(),m(9,"input",19),l(),s(10,"sh-form-field")(11,"label",20),f(12,3),l(),m(13,"textarea",21),l(),y(14,Bt,6,3),s(15,"div",22)(16,"button",23),E("click",function(){return d(i),p(n.exit())}),C(17,4),m(18,"sh-icon"),F(),l(),y(19,kt,3,1,"button",24)(20,Vt,3,1,"button",25),l()()}if(e&2){let i;T("formGroup",n.generalForm),_(4),R(!n.isNew()&&((i=n.generalFormSignal())==null?null:i.encryption)!==""?4:-1),_(10),R(n.isNew()?14:-1),_(5),R(n.encryptionFieldSignal()===n.noneOptionKey||!n.isNew()?19:20)}},dependencies:[Re,De,Y,Q,Pe,Ne,Me,q,ae,oe,j,et,Je,tt],styles:["[_nghost-%COMP%]{display:block;width:100%;max-width:32.5rem;padding:2.5rem}form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem;padding-bottom:1.5rem}sup[_ngcontent-%COMP%]{padding:0 .125rem;color:var(--error-8)}.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%] sh-icon.sh-success[_ngcontent-%COMP%]{color:var(--success-8)}"],changeDetection:0})};export{mt as a,pe as b,je as c,ee as d,Ke as e,pt as f,He as g,J as h};
1
+ import{a as ut,b as ct,c as dt}from"./chunk-FZTPUMUC.js";import{a as Oe}from"./chunk-DDWLL7XA.js";import{a as rt,b as Ve,c as _t}from"./chunk-2QJC4PGQ.js";import{b as re}from"./chunk-O64ZZGQZ.js";import{a as it}from"./chunk-DELLEGXW.js";import{a as Te}from"./chunk-VTSUHAP5.js";import{b as fe,c as Y,d as Ae,e as Q,f as Pe,h as ot,i as se,j as De,k as at,n as st,o as Ne,p as lt,q as Me,r as ye,s as le,t as Re}from"./chunk-N5SC4SKW.js";import{b as ie,d as z}from"./chunk-LVP2TPMO.js";import{A as he,C as tt,a as j,b as Je,e as Ze,g as oe,l as q,p as et,t as ae}from"./chunk-H7K35UUX.js";import{h as nt}from"./chunk-NOPMCS2Z.js";import{Ab as s,Bb as l,Cb as m,Gb as B,H as Le,Hb as k,Jb as G,Oc as I,Pc as ne,Qb as C,Ra as _,Rb as F,Sb as f,Tc as Be,Uc as ke,V as ge,Vb as Ge,Vc as Ee,Wb as E,Yb as u,_ as M,bb as H,ea as d,ec as me,fa as p,fc as Ce,gb as qe,gc as be,ic as Fe,lc as x,mc as ve,nc as Qe,oa as g,qc as w,rc as $,sc as L,tb as Ye,ub as y,vb as R,wb as Ie,xb as Ue,yb as xe,zb as T,zc as Se}from"./chunk-HNWRQABR.js";import{a as b,b as X}from"./chunk-EUDKD2JW.js";var we=class a{fromString(t){if(!t)return null;let e=t.match(/(\d+)([smhDWMY])/);return e&&{value:parseInt(e[1]),unit:e[2]}}toString(t,e){return`${t}${e}`}static \u0275fac=function(e){return new(e||a)};static \u0275prov=ge({token:a,factory:a.\u0275fac,providedIn:"root"})};function Ct(a,t){if(a&1){let e=G();s(0,"div",24)(1,"sh-form-field")(2,"label",25),f(3,7),l(),s(4,"input",26,0),L("ngModelChange",function(i){d(e);let o=u();return $(o.scheduleFields.nextTime().time,i)||(o.scheduleFields.nextTime().time=i),p(i)}),E("focus",function(){d(e);let i=be(5);return p(i.showPicker())}),l(),s(6,"sh-icon",27),x(7,"clock"),l()(),s(8,"sh-form-field"),m(9,"label",28),s(10,"input",29,1),L("ngModelChange",function(i){d(e);let o=u();return $(o.scheduleFields.nextTime().date,i)||(o.scheduleFields.nextTime().date=i),p(i)}),E("focus",function(){d(e);let i=be(11);return p(i.showPicker())}),l(),s(12,"sh-icon",27),x(13,"calendar"),l()()(),s(14,"div",24)(15,"sh-form-field")(16,"label",30),f(17,8),l(),s(18,"input",31),L("ngModelChange",function(i){d(e);let o=u();return $(o.scheduleFields.runAgain().repeatValue,i)||(o.scheduleFields.runAgain().repeatValue=i),p(i)}),l()(),s(19,"sh-select",32)(20,"input",33),L("ngModelChange",function(i){d(e);let o=u();return $(o.scheduleFields.runAgain().repeatUnit,i)||(o.scheduleFields.runAgain().repeatUnit=i),p(i)}),l()()(),s(21,"app-toggle-card",34),B(22,35),f(23,9),k(),s(24,"div",36)(25,"sh-toggle",19),C(26,10),s(27,"input",20),L("ngModelChange",function(i){d(e);let o=u();return $(o.scheduleFields.runAgain().allowedDays.mon,i)||(o.scheduleFields.runAgain().allowedDays.mon=i),p(i)}),l(),F(),l(),s(28,"sh-toggle",19),C(29,11),s(30,"input",20),L("ngModelChange",function(i){d(e);let o=u();return $(o.scheduleFields.runAgain().allowedDays.tue,i)||(o.scheduleFields.runAgain().allowedDays.tue=i),p(i)}),l(),F(),l(),s(31,"sh-toggle",19),C(32,12),s(33,"input",20),L("ngModelChange",function(i){d(e);let o=u();return $(o.scheduleFields.runAgain().allowedDays.wed,i)||(o.scheduleFields.runAgain().allowedDays.wed=i),p(i)}),l(),F(),l(),s(34,"sh-toggle",19),C(35,13),s(36,"input",20),L("ngModelChange",function(i){d(e);let o=u();return $(o.scheduleFields.runAgain().allowedDays.thu,i)||(o.scheduleFields.runAgain().allowedDays.thu=i),p(i)}),l(),F(),l(),s(37,"sh-toggle",19),C(38,14),s(39,"input",20),L("ngModelChange",function(i){d(e);let o=u();return $(o.scheduleFields.runAgain().allowedDays.fri,i)||(o.scheduleFields.runAgain().allowedDays.fri=i),p(i)}),l(),F(),l(),s(40,"sh-toggle",19),C(41,15),s(42,"input",20),L("ngModelChange",function(i){d(e);let o=u();return $(o.scheduleFields.runAgain().allowedDays.sat,i)||(o.scheduleFields.runAgain().allowedDays.sat=i),p(i)}),l(),F(),l(),s(43,"sh-toggle",19),C(44,16),s(45,"input",20),L("ngModelChange",function(i){d(e);let o=u();return $(o.scheduleFields.runAgain().allowedDays.sun,i)||(o.scheduleFields.runAgain().allowedDays.sun=i),p(i)}),l(),F(),l()()()}if(a&2){let e=u();_(4),w("ngModel",e.scheduleFields.nextTime().time),_(6),w("ngModel",e.scheduleFields.nextTime().date),_(8),w("ngModel",e.scheduleFields.runAgain().repeatValue),_(),T("options",e.unitOptions)("isClearable",!1),_(),w("ngModel",e.scheduleFields.runAgain().repeatUnit),_(),T("disallowToggle",!0),_(6),w("ngModel",e.scheduleFields.runAgain().allowedDays.mon),_(3),w("ngModel",e.scheduleFields.runAgain().allowedDays.tue),_(3),w("ngModel",e.scheduleFields.runAgain().allowedDays.wed),_(3),w("ngModel",e.scheduleFields.runAgain().allowedDays.thu),_(3),w("ngModel",e.scheduleFields.runAgain().allowedDays.fri),_(3),w("ngModel",e.scheduleFields.runAgain().allowedDays.sat),_(3),w("ngModel",e.scheduleFields.runAgain().allowedDays.sun)}}var Ft=[{key:"s",label:$localize`Seconds`},{key:"m",label:$localize`Minutes`},{key:"h",label:$localize`Hours`},{key:"D",label:$localize`Days`},{key:"W",label:$localize`Weeks`},{key:"M",label:$localize`Months`},{key:"Y",label:$localize`Years`}],ee={autoRun:!0,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}}},Ke=class a{#e=M(J);#t=M(z);#i=M(ie);unitOptions=Ft;scheduleFields=this.#e.scheduleFields;goBack(){this.#t.navigate(["source-data"],{relativeTo:this.#i.parent})}next(){this.#e.isNew()||this.#e.submit(!0),this.#t.navigate(["options"],{relativeTo:this.#i.parent})}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=H({type:a,selectors:[["app-schedule"]],decls:16,vars:2,consts:()=>{let t;t=$localize`Schedule`;let e;e=$localize` Automatically run backups ${"\uFFFD#5\uFFFD\uFFFD/#5\uFFFD"}:TAG_INPUT:`;let n;n=$localize`If a date was missed, the job will run as soon as possible.`;let i;i=$localize`${"\uFFFD#12\uFFFD"}:START_TAG_SH_ICON:arrow-left${"\uFFFD/#12\uFFFD"}:CLOSE_TAG_SH_ICON: Go back `;let o;o=$localize`${"\uFFFD#15\uFFFD"}:START_TAG_SH_ICON:arrow-right${"\uFFFD/#15\uFFFD"}:CLOSE_TAG_SH_ICON: Continue `;let r;r=$localize`Next time`;let c;c=$localize`Run again every`;let h;h=$localize`Allowed days`;let S;S=$localize` Monday ${"\uFFFD#27\uFFFD\uFFFD/#27\uFFFD"}:TAG_INPUT:`;let O;O=$localize` Tuesday ${"\uFFFD#30\uFFFD\uFFFD/#30\uFFFD"}:TAG_INPUT:`;let P;P=$localize` Wednesday ${"\uFFFD#33\uFFFD\uFFFD/#33\uFFFD"}:TAG_INPUT:`;let U;U=$localize` Thursday ${"\uFFFD#36\uFFFD\uFFFD/#36\uFFFD"}:TAG_INPUT:`;let K;K=$localize` Friday ${"\uFFFD#39\uFFFD\uFFFD/#39\uFFFD"}:TAG_INPUT:`;let v;v=$localize` Saturday ${"\uFFFD#42\uFFFD\uFFFD/#42\uFFFD"}:TAG_INPUT:`;let W;return W=$localize` Sunday ${"\uFFFD#45\uFFFD\uFFFD/#45\uFFFD"}:TAG_INPUT:`,[["timeRef",""],["dateRef",""],t,e,n,i,o,r,c,h,S,O,P,U,K,v,W,[1,"title-30"],[1,"toggle-wrap"],[1,"raised","primary"],["type","checkbox",3,"ngModelChange","ngModel"],[1,"form-actions"],["shButton","","type","button",3,"click"],["shButton","",1,"raised","primary",3,"click"],[1,"row-inputs"],["for","time"],["type","time","id","time",3,"ngModelChange","focus","ngModel"],["suffix",""],["for","date"],["type","date","id","date",3,"ngModelChange","focus","ngModel"],["for","repeatValue"],["type","number","id","repeatValue",3,"ngModelChange","ngModel"],["value","key","label","label",3,"options","isClearable"],["type","text","id","repeatUnit",3,"ngModelChange","ngModel"],[3,"disallowToggle"],["title",""],[1,"days-wrap"]]},template:function(e,n){e&1&&(s(0,"h3",17),f(1,2),l(),s(2,"div",18)(3,"sh-toggle",19),C(4,3),s(5,"input",20),L("ngModelChange",function(o){return $(n.scheduleFields.autoRun,o)||(n.scheduleFields.autoRun=o),o}),l(),F(),l(),s(6,"p"),f(7,4),l()(),y(8,Ct,46,14),s(9,"div",21)(10,"button",22),E("click",function(){return n.goBack()}),C(11,5),m(12,"sh-icon"),F(),l(),s(13,"button",23),E("click",function(){return n.next()}),C(14,6),m(15,"sh-icon"),F(),l()()),e&2&&(_(5),w("ngModel",n.scheduleFields.autoRun),_(3),R(n.scheduleFields.autoRun()?8:-1))},dependencies:[le,Y,at,fe,Q,se,q,he,j,oe,ae,Oe],styles:["[_nghost-%COMP%]{display:block;width:100%;max-width:32.5rem;padding:2.5rem 2.5rem 1.5rem;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})};function St(a,t){if(a&1&&(B(0,4),x(1),k()),a&2){let e,n=u();_(),ve((e=n.currentExpressionOption())==null?null:e.startsWith)}}function Et(a,t){if(a&1&&(B(0,5),x(1),k()),a&2){let e,n=u();_(),ve((e=n.currentExpressionOption())==null?null:e.endsWith)}}var ht=[{key:"Excludes folders where name contains",value:"-FolderName"},{key:"Excludes folder",value:"-Folder"},{key:"Excludes files where name contains",value:"-FileName"},{key:"Excludes file extension",value:"-Extension"},{key:"Excludes files where name matches regex",value:"-Regex"},{key:"Includes files where name matches regex",value:"+Regex"},{key:"Excludes file group",value:"-FileGroup"},{key:"Includes expression",value:"+Expression"},{key:"Excludes expression",value:"-Expression"},{key:"None",value:"-Unknown"}],$e=class a{path=ke.required();osType=ke();pathChange=Be();remove=Be();internalPath=g("");pathType=g("-Expression");currentExpressionOption=I(()=>{let t=this.pathType();return this.expressionOptions().find(e=>e.value===t)});expressionOptions=I(()=>{let e=this.osType()==="Windows"?"\\":"/";return ht.map(n=>n.value==="-Folder"||n.value==="+Folder"?X(b({},n),{startsWith:"",endsWith:""}):n.value==="-FolderName"||n.value==="+FolderName"?X(b({},n),{startsWith:"*",endsWith:`*${e}`}):n.value==="-FileName"||n.value==="+FileName"?X(b({},n),{startsWith:"[.*",endsWith:`[^\\${e}]*]`}):n.value==="-FileGroup"||n.value==="+FileGroup"?X(b({},n),{startsWith:"{",endsWith:"}"}):n.value==="-Regex"||n.value==="+Regex"?X(b({},n),{startsWith:"[",endsWith:"]"}):n.value==="-Extension"||n.value==="+Extension"?X(b({},n),{startsWith:"*.",endsWith:""}):X(b({},n),{startsWith:"",endsWith:""}))});pathEffect=ne(()=>{let t=this.path(),e=t.slice(1),n=t.startsWith("-")?"-":"+",i=this.osType()==="Windows",o=i?"\\":"/";e.startsWith("%")&&e.endsWith(o)||i&&e.slice(2).startsWith(o)&&e.endsWith(o)||e.startsWith(o)&&e.endsWith(o)?(this.pathType.set(`${n}Folder`),this.internalPath.set(e)):e.startsWith("*")&&e.endsWith(`*${o}`)?(this.pathType.set(`${n}FolderName`),this.internalPath.set(e.slice(1,-2))):e.startsWith("[.*")&&e.endsWith(`[^\\${o}]*]`)?(this.pathType.set(`${n}FileName`),this.internalPath.set(e.slice(3,-7))):e.startsWith("{")&&e.endsWith("}")?(this.pathType.set(`${n}FileGroup`),this.internalPath.set(e.slice(1,-1))):e.startsWith("[")&&e.endsWith("]")?(this.pathType.set(`${n}Regex`),this.internalPath.set(e.slice(1,-1))):e.startsWith("*.")?(this.pathType.set(`${n}Extension`),this.internalPath.set(e.slice(2))):(this.pathType.set(`${n}Expression`),this.internalPath.set(e))});updateFilter(){let t=this.internalPath(),e=this.currentExpressionOption();t!==""&&this.pathChange.emit(`${e?.value.slice(0,1)}${e?.startsWith??""}${t}${e?.endsWith??""}`)}removeFilter(){this.remove.emit()}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=H({type:a,selectors:[["app-new-filter"]],inputs:{path:[1,"path"],osType:[1,"osType"]},outputs:{pathChange:"pathChange",remove:"remove"},decls:9,vars:6,consts:()=>{let t;return t=$localize`Select an option...`,[["value","value","label","key",3,"options","isClearable"],["type","text","placeholder",t,3,"ngModelChange","ngModel"],[1,"expression-input"],["type","text",3,"ngModelChange","ngModel"],["prefix",""],["suffix",""],[1,"filter-removal",3,"click"],[1,"sh-primary"]]},template:function(e,n){if(e&1&&(s(0,"sh-select",0)(1,"input",1),L("ngModelChange",function(o){return $(n.pathType,o)||(n.pathType=o),o}),E("ngModelChange",function(){return n.updateFilter()}),l()(),s(2,"sh-form-field",2)(3,"input",3),L("ngModelChange",function(o){return $(n.internalPath,o)||(n.internalPath=o),o}),E("ngModelChange",function(){return n.updateFilter()}),l(),y(4,St,2,1,"ng-container",4),y(5,Et,2,1,"ng-container",5),l(),s(6,"div",6),E("click",function(){return n.removeFilter()}),s(7,"sh-icon",7),x(8,"x-circle"),l()()),e&2){let i,o;T("options",n.expressionOptions())("isClearable",!1),_(),w("ngModel",n.pathType),_(2),w("ngModel",n.internalPath),_(),R(!((i=n.currentExpressionOption())==null||i.startsWith==null)&&i.startsWith.length?4:-1),_(),R(!((o=n.currentExpressionOption())==null||o.endsWith==null)&&o.endsWith.length?5:-1)}},dependencies:[le,Y,Q,se,ae,q,j],styles:["[_nghost-%COMP%]{display:grid;grid-template-columns:13.125rem 1fr 1.875rem;gap:.5rem;align-items:flex-end}.expression-input[_ngcontent-%COMP%]{--ff-suffix-bg: var(--base-2)}.filter-removal[_ngcontent-%COMP%]{cursor:pointer;display:flex;align-items:center;justify-content:center;height:2.5rem;flex:0 0}"],changeDetection:0})};var Tt=["formRef"],ze=()=>({standalone:!0});function ft(a,t){if(a&1){let e=G();s(0,"sh-form-field",41)(1,"input",42),L("ngModelChange",function(i){d(e);let o=u(2);return $(o.editingPath,i)||(o.editingPath=i),p(i)}),l()(),s(2,"button",43),E("click",function(){d(e);let i=u(2);return p(i.updatePath())}),s(3,"sh-icon"),x(4,"floppy-disk"),l()(),s(5,"button",43),E("click",function(){d(e);let i=u(2);return p(i.cancelEditPath())}),s(6,"sh-icon"),x(7,"x-bold"),l()()}if(a&2){let e=u(2);_(),w("ngModel",e.editingPath),T("ngModelOptions",Se(2,ze))}}function At(a,t){if(a&1){let e=G();s(0,"sh-form-field",41),m(1,"input",44),l(),s(2,"button",43),E("click",function(){d(e);let i=u().$implicit,o=u();return p(o.editPath(i))}),s(3,"sh-icon"),x(4,"pen"),l()(),s(5,"button",43),E("click",function(){d(e);let i=u().$implicit,o=u();return p(o.removePath(i))}),s(6,"sh-icon"),x(7,"trash-simple"),l()()}if(a&2){let e=u().$implicit;Ye("readonly",!0),_(),T("ngModel",e)("ngModelOptions",Se(3,ze))}}function Pt(a,t){if(a&1&&(s(0,"div",30),y(1,ft,8,3)(2,At,8,4),l()),a&2){let e=t.$implicit,n=u();_(),R(n.oldPath()===e?1:2)}}function Dt(a,t){if(a&1){let e=G();s(0,"app-new-filter",46),E("pathChange",function(i){let o=d(e).$index,r=u(2);return p(r.patchPathAt(i,o))})("remove",function(){let i=d(e).$index,o=u(2);return p(o.removePathAt(i))}),l()}if(a&2){let e=t.$implicit,n=u(2);T("path",e)("osType",n.osType()??"")}}function Nt(a,t){if(a&1&&Ue(0,Dt,1,2,"app-new-filter",45,Ie),a&2){let e=u();xe(e.pathArray())}}function Mt(a,t){if(a&1){let e=G();s(0,"div",31)(1,"app-size",47),E("ngModelChange",function(i){d(e);let o=u();return p(o.updateFilesLargerThan(i))}),l()()}if(a&2){let e=u();_(),T("ngModel",e.filesLargerThan())("ngModelOptions",Se(2,ze))}}var V=new ye,pt=(a={path:"",filters:[],excludes:{hidden:!1,system:!1,temporary:!1,filesLargerThan:null}})=>V.group({path:V.control(a.path),excludes:V.group({hidden:V.control(a.excludes.hidden),system:V.control(a.excludes.system),temporary:V.control(a.excludes.temporary),filesLargerThan:V.group({size:V.control(null),unit:V.control(null)})})}),He=class a{#e=M(J);#t=M(z);#i=M(ie);formRef=Ee.required("formRef");sourceDataForm=this.#e.sourceDataForm;sourceDataFormSignal=this.#e.sourceDataFormSignal;newPathCtrl=new ot("");filesLargerThan=I(()=>this.sourceDataFormSignal()?.excludes?.filesLargerThan?.size!==null);osType=this.#e.osType;pathSignal=re(this.sourceDataForm.controls.path.valueChanges);pathArray=I(()=>this.pathSignal()?.split("\0").filter(t=>t.startsWith("-")||t.startsWith("+")||t==="___none___")??[]);nonFilterPaths=I(()=>this.pathSignal()?.split("\0").filter(t=>!t.startsWith("-")&&!t.startsWith("+")&&t!==""));oldPath=g(null);editingPath=g(null);addingNewPath=g(!1);editPath(t){this.oldPath.set(t),this.editingPath.set(t)}updateFilesLargerThan(t){let{size:e,unit:n}=ct(t);this.sourceDataForm.controls.excludes.controls.filesLargerThan.setValue({size:e,unit:n})}updatePath(){let t=this.oldPath(),e=this.editingPath();if(!t||!e||e===t){this.oldPath.set(null),this.editingPath.set(null);return}let n=this.sourceDataForm.controls.path.value;this.sourceDataForm.controls.path.setValue(n?.replace(t,e)??""),this.oldPath.set(null),this.editingPath.set(null)}cancelEditPath(){this.oldPath.set(null),this.editingPath.set(null)}removePath(t){let n=(this.sourceDataForm.controls.path.value??"").split("\0"),i=n.indexOf(t);if(i===-1)return;n.splice(i,1);let o=n.filter(r=>r&&r!=="").join("\0");this.sourceDataForm.controls.path.setValue(o)}addFilter(t="-*"){let n=[this.sourceDataForm.controls.path.value,t].filter(i=>i&&i!=="").join("\0");this.sourceDataForm.controls.path.setValue(n)}patchPathAt(t,e){let i=this.sourceDataForm.controls.path.value.split("\0").filter(c=>!c.startsWith("-")&&!c.startsWith("+")).join("\0"),o=this.pathArray().map((c,h)=>h===e?`${t}`:`${c}`).join("\0"),r=[i,o].filter(c=>c&&c!=="").join("\0");this.sourceDataForm.controls.path.setValue(r)}removePathAt(t){let n=this.sourceDataForm.controls.path.value.split("\0").filter(r=>!r.startsWith("-")&&!r.startsWith("+")).join("\0"),i=this.pathArray().filter((r,c)=>c!==t).join("\0"),o=[n,i].filter(r=>r&&r!=="").join("\0");this.sourceDataForm.controls.path.setValue(o)}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})}addNewPath(){let t=this.sourceDataForm.controls.path.value,e=this.newPathCtrl.value,n=t?.split("\0")||[];e&&!n.includes(e)&&n.push(e);let i=n.filter(o=>o&&o!=="").join("\0");this.sourceDataForm.controls.path.setValue(i),this.newPathCtrl.setValue("")}goBack(){this.#t.navigate(["destination"],{relativeTo:this.#i.parent})}next(){this.#e.isNew()||this.#e.submit(!0),this.#t.navigate(["schedule"],{relativeTo:this.#i.parent})}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=H({type:a,selectors:[["app-source-data"]],viewQuery:function(e,n){e&1&&me(n.formRef,Tt,5),e&2&&Ce()},decls:56,vars:12,consts:()=>{let t;t=$localize`Path`;let e;e=$localize`Add a direct path`;let n;n=$localize`Hidden files`;let i;i=$localize`System files`;let o;o=$localize`Temporary files`;let r;r=$localize`Source Data`;let c;c=$localize`Folder path`;let h;h=$localize`${"\uFFFD#12\uFFFD"}:START_TAG_SH_ICON:arrow-left${"\uFFFD/#12\uFFFD"}:CLOSE_TAG_SH_ICON: Go back `;let S;S=$localize`${"\uFFFD#15\uFFFD"}:START_TAG_SH_ICON:arrow-right${"\uFFFD/#15\uFFFD"}:CLOSE_TAG_SH_ICON: Continue `;let O;O=$localize`Paths`;let P;P=$localize`Add a path directly from your machine.`;let U;U=$localize`Filters`;let K;K=$localize`Customize your filters.`;let v;v=$localize`Add filter`;let W;W=$localize`Exclude`;let D;D=$localize`Choose if there’s any files you want to exclude.`;let Z;Z=$localize` Files with the Hidden attribute ${"\uFFFD#46\uFFFD\uFFFD/#46\uFFFD"}:TAG_INPUT:`;let _e;_e=$localize` Files with the System attribute ${"\uFFFD#49\uFFFD\uFFFD/#49\uFFFD"}:TAG_INPUT:`;let ue;ue=$localize` Files with the Temporary attribute ${"\uFFFD#52\uFFFD\uFFFD/#52\uFFFD"}:TAG_INPUT:`;let ce;ce=$localize` Files larger than `;let A;return A=$localize`Edit path`,[["formRef",""],r,c,h,S,O,P,U,K,v,W,D,Z,_e,ue,ce,[3,"submit","formGroup"],[1,"left"],[1,"title-30"],[1,"fill",3,"multiSelect","startingPath","showFiles"],["for","path"],["type","text","id","path","tabindex","4","placeholder",t,"formControlName","path"],[1,"form-actions"],["shButton","","type","button",3,"click"],["shButton","","type","submit",1,"raised","primary"],[1,"right"],[3,"disallowToggle"],["title",""],["description",""],[1,"paths"],[1,"path"],[1,"row-inputs"],["type","text","placeholder",e,3,"formControl"],["shButton","","type","button",1,"raised","primary",3,"click"],["type","button","shButton","","action","",3,"click"],["formGroupName","excludes",3,"disallowToggle"],[1,"raised","primary"],["type","checkbox","placeholder",n,"formControlName","hidden"],["type","checkbox","placeholder",i,"formControlName","system"],["type","checkbox","placeholder",o,"formControlName","temporary"],[1,"raised","primary",3,"click"],[1,"small"],["type","text","placeholder",A,3,"ngModelChange","ngModel","ngModelOptions"],["shButton","","type","button",1,"small",3,"click"],["type","text",3,"ngModel","ngModelOptions"],[3,"path","osType"],[3,"pathChange","remove","path","osType"],[3,"ngModelChange","ngModel","ngModelOptions"]]},template:function(e,n){if(e&1){let i=G();s(0,"form",16,0),E("submit",function(){return d(i),p(n.next())}),s(2,"div",17)(3,"h3",18),f(4,1),l(),s(5,"app-file-tree",19)(6,"label",20),f(7,2),l(),m(8,"input",21),l(),s(9,"div",22)(10,"button",23),E("click",function(){return d(i),p(n.goBack())}),C(11,3),m(12,"sh-icon"),F(),l(),s(13,"button",24),C(14,4),m(15,"sh-icon"),F(),l()()(),s(16,"div",25)(17,"app-toggle-card",26),B(18,27),f(19,5),k(),s(20,"p",28),f(21,6),l(),s(22,"div",29),Ue(23,Pt,3,1,"div",30,Ie),s(25,"div",31)(26,"sh-form-field"),m(27,"input",32),l(),s(28,"button",33),E("click",function(){return d(i),p(n.addNewPath())}),s(29,"sh-icon"),x(30,"plus"),l()()()()(),s(31,"app-toggle-card",26),B(32,27),f(33,7),k(),s(34,"p",28),f(35,8),l(),s(36,"button",34),E("click",function(){return d(i),p(n.addFilter())}),f(37,9),l(),y(38,Nt,2,0),l(),s(39,"app-toggle-card",35),B(40,27),f(41,10),k(),s(42,"p",28),f(43,11),l(),s(44,"sh-toggle",36),C(45,12),m(46,"input",37),F(),l(),s(47,"sh-toggle",36),C(48,13),m(49,"input",38),F(),l(),s(50,"sh-toggle",36),C(51,14),m(52,"input",39),F(),l(),s(53,"sh-toggle",40),E("click",function(){return d(i),p(n.toggleFilesLargerThan())}),f(54,15),l(),y(55,Mt,2,3,"div",31),l()()()}if(e&2){let i;T("formGroup",n.sourceDataForm),_(5),T("multiSelect",!0)("startingPath",n.getPath())("showFiles",!0),_(12),T("disallowToggle",!0),_(6),xe(n.nonFilterPaths()),_(4),T("formControl",n.newPathCtrl),_(4),T("disallowToggle",!0),_(7),R((i=n.pathSignal())!=null&&i.length?38:-1),_(),T("disallowToggle",!0),_(14),Fe("active",n.filesLargerThan()),_(2),R(n.filesLargerThan()?55:-1)}},dependencies:[le,De,Y,fe,Q,Pe,se,Re,st,Ne,Me,lt,q,j,oe,he,$e,ut,Oe,dt],styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;width:100%;flex:1 0;overflow:hidden}form[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;flex:1 0;overflow:hidden}.right[_ngcontent-%COMP%], .left[_ngcontent-%COMP%]{flex:1 0;display:flex;flex-direction:column;gap:1.5rem}.left[_ngcontent-%COMP%]{padding:2.5rem;overflow:hidden;border-right:1px solid var(--base-4)}.right[_ngcontent-%COMP%]{padding:2.5rem 1.5rem;overflow:auto}.form-actions[_ngcontent-%COMP%]{display:flex;justify-content:space-between}sh-divider[_ngcontent-%COMP%]{margin:.75rem 0}.row-inputs[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr min-content;gap:.25rem}.paths[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.path[_ngcontent-%COMP%]{display:grid;align-items:center;grid-template-columns:1fr min-content min-content;gap:.25rem}"],changeDetection:0})};var gt="1W:1D,4W:1W,12M:1M",J=class a{#e=M(z);#t=M(Te);#i=M(Ze);#n=M(nt);#a=M(we);generalForm=mt();sourceDataForm=pt();scheduleFields={autoRun:g(ee.autoRun),nextTime:g(ee.nextTime),runAgain:g(ee.runAgain)};settings=g([]);optionsFields={remoteVolumeSize:g("50MB"),backupRetention:g("all"),backupRetentionTime:g(""),backupRetentionVersions:g(0),backupRetentionCustom:g("")};targetUrlModel=g(null);backupMetadata=g(null);isDraft=g(!1);backupId=g(null);backupName=I(()=>this.generalFormSignal()?.name??"");isSubmitting=g(!1);finishedLoading=g(!1);backupDefaults=g(null);applicationOptions=g(null);isNew=I(()=>this.backupId()==="new");osType=I(()=>this.#t.systemInfo()?.OSType);selectedOptions=g([]);sourceDataFormSignal=re(this.sourceDataForm.valueChanges);generalFormSignal=re(this.generalForm.valueChanges);encryptionFieldSignal=re(this.generalForm.controls.encryption.valueChanges);advancedOptions=I(()=>this.#t.systemInfo()?.Options?.map(this.#_)??[]);#o=g("");#s=g(null);#l=null;testSignal=this.#o.asReadonly();testErrorMessage=this.#s.asReadonly();#d=ne(()=>{let t=this.targetUrlModel(),e=this.#o(),n=this.#l;this.#l=t,!(e==="testing"||n===null||n===t)&&(this.#o.set(""),this.#s.set(null))});setTestState(t,e){this.#o.set(t),this.#s.set(e??null)}#_(t){return{name:t.Name,type:t.Type,shortDescription:t.ShortDescription??void 0,longDescription:t.LongDescription??void 0,options:t.ValidValues}}encryptionOptions=I(()=>{let t=this.#t.systemInfo()?.EncryptionModules??[];return[pe,...t]});nonSelectedOptions=I(()=>this.advancedOptions().sort((t,e)=>t?.name&&e?.name?t?.name.localeCompare(e?.name):0).filter(t=>this.selectedOptions()?.findIndex(e=>e.name===t.name)===-1));submit(t=!1){this.isSubmitting.set(!0);let e=this.#u(),n=this.backupId();this.isDraft()&&e.Backup&&(e.Backup.Metadata=this.backupMetadata()),n==="new"||!n||this.isDraft()?this.#n.postApiV1Backups({requestBody:e}).pipe(Le(()=>this.isSubmitting.set(!1))).subscribe({next:i=>{t||this.exit(!1)},error:i=>{}}):this.#n.putApiV1BackupById({id:n,requestBody:e}).pipe(Le(()=>this.isSubmitting.set(!1))).subscribe({next:i=>{t||this.exit(!1)},error:i=>{}})}exit(t){if(!t){this.#r(),this.#e.navigate(["/"]);return}this.#i.open(it,{data:{title:$localize`Confirm exit?`,message:$localize`Are you sure you want to exit?`,confirmText:$localize`Yes`,cancelText:$localize`Cancel`},closed:e=>{e&&(this.#r(),this.#e.navigate(["/"]))}})}mapSourceDataToForm(t){let e=t.Sources??"",n=t.Filters?.map(c=>`${c.Include?"":"-"}${c.Expression}`)??[],i=t.Settings?.find(c=>c.Name==="--exclude-files-attributes")?.Value??"",o=t.Settings?.find(c=>c.Name==="--skip-files-larger-than")??null,r={path:[...e,...n].join("\0"),excludes:{hiddenFiles:i.includes("hidden"),systemFiles:i.includes("system"),tempFiles:i.includes("temporary"),filesLargerThan:o?.Value?.toUpperCase()??null}};this.sourceDataForm.patchValue(r)}mapDestinationToForm(t){this.targetUrlModel.set(t.TargetURL??"")}mapGeneralToForm(t){let e=t.Name??"",n=t.Description??"",i=t.Settings?.find(S=>S.Name==="encryption-module"),o=t.Settings?.find(S=>S.Name==="passphrase")?.Value??"",r=i?.Value&&i.Value.length?i.Value:"",c=t.Settings?.find(S=>S.Name==="compression-module")?.Value??"",h={name:t.Name??"",description:t.Description??""};e&&e!==""&&(h.name=e),n&&n!==""&&(h.description=n),r&&r!==""&&(h.encryption=r),o&&o!==""&&(h.password=o,h.repeatPassword=o),c&&c!==""&&(h.compression=c),this.generalForm.patchValue(h)}mapScheduleToForm(t){if(!t){this.scheduleFields.autoRun.set(!1);return}let e=this.#a.fromString(t.Repeat)??null,n=this.#c(t.Time);this.scheduleFields.autoRun.set(!0),this.scheduleFields.nextTime.update(i=>b(b({},i),n)),this.scheduleFields.runAgain.set({repeatValue:e?.value??1,repeatUnit:e?.unit??"D",allowedDays:{mon:t.AllowedDays?.includes("mon")??!1,tue:t.AllowedDays?.includes("tue")??!1,wed:t.AllowedDays?.includes("wed")??!1,thu:t.AllowedDays?.includes("thu")??!1,fri:t.AllowedDays?.includes("fri")??!1,sat:t.AllowedDays?.includes("sat")??!1,sun:t.AllowedDays?.includes("sun")??!1}})}mapOptionsToForms(t){let e=["--no-encryption","--exclude-files-attributes","--skip-files-larger-than","dblock-size","passphrase","keep-time","keep-versions","retention-policy"],n=t.Settings?.filter(r=>!e.includes(r.Name)),i=t.Settings?.filter(r=>e.includes(r.Name));this.settings.set(n??[]),n?.forEach(r=>{if(r.Name==="encryption-module"&&this.isNew())return this.generalForm.controls.encryption.setValue(r.Value??"")});var o="all";i?.forEach(r=>{if(r.Name==="dblock-size"&&this.optionsFields.remoteVolumeSize.set(r.Value??"50MB"),r.Name==="keep-time"&&(r.Value??"")!=="")return o="time",this.optionsFields.backupRetentionTime.set(r.Value??"");if(r.Name==="keep-versions"&&(r.Value??"")!=="")return o="versions",this.optionsFields.backupRetentionVersions.set(r.Value?parseInt(r.Value):null);if(r.Name==="retention-policy"&&(r.Value??"")!=="")if(r.Value===gt)o="smart";else return o="custom",this.optionsFields.backupRetentionCustom.set(r.Value??"")}),this.optionsFields.backupRetention.set(o)}storeMetadata(t,e){this.backupMetadata.set(e?t.Metadata??null:null)}getScheduleFormValue(){return{autoRun:this.scheduleFields.autoRun(),nextTime:this.scheduleFields.nextTime(),runAgain:this.scheduleFields.runAgain()}}#u(){let t=this.generalForm.value,e=this.getScheduleFormValue(),n=this.sourceDataForm.value,i=this.targetUrlModel(),o=null;e.runAgain?.repeatUnit&&e.runAgain?.repeatValue&&(o=this.#a.toString(e.runAgain.repeatValue,e.runAgain.repeatUnit));let r=e.runAgain?.allowedDays?Object.entries(e.runAgain?.allowedDays).filter(([P,U])=>U).map(([P,U])=>P):[],c=n.path?.split("\0")??[],h=this.mapFormsToSettings(),S=Object.entries(n.excludes??{}).filter(([P,U])=>U&&P!=="filesLargerThan").map(([P])=>P),O=n.excludes?.filesLargerThan;return S.length&&h.push({Name:"--exclude-files-attributes",Value:S.join(",")}),O&&O.size!==null&&O.unit!==null&&h.push({Name:"--skip-files-larger-than",Value:`${O.size}${O.unit}`}),{Backup:{Name:t.name,Description:t.description,TargetURL:i??null,Sources:c.filter(P=>!P.startsWith("-")),Settings:h,Filters:c.filter(P=>P.startsWith("-")).map((P,U)=>({Order:U,Include:!1,Expression:P.slice(1)}))},Schedule:e.autoRun?{Repeat:o,Time:e.nextTime?.date?new Date(`${e.nextTime.date}T${e.nextTime?.time||"00:00:00"}`).toISOString():null,AllowedDays:r}:null}}mapFormsToSettings(t=[]){let e=this.generalForm.value,n=["--no-encryption","--exclude-files-attributes","--skip-files-larger-than","encryption-module","passphrase","keep-time","keep-versions","retention-policy","dblock-size","compression-module"],i=[{Name:"--no-encryption",Value:"True"}];e.encryption!==""&&e.encryption!==pe.Key&&(i=[{Name:"encryption-module",Value:e.encryption??null},{Name:"passphrase",Value:e.password??null}]);let o=[{Name:"compression-module",Value:e.compression}];e.compression===""&&(o=[]);let r=[{Name:"dblock-size",Value:this.optionsFields.remoteVolumeSize()}];switch(this.optionsFields.backupRetention()){case"time":r.push({Name:"keep-time",Value:this.optionsFields.backupRetentionTime()});break;case"versions":r.push({Name:"keep-versions",Value:this.optionsFields.backupRetentionVersions()?.toString()??""});break;case"custom":r.push({Name:"retention-policy",Value:this.optionsFields.backupRetentionCustom()});break;case"smart":r.push({Name:"retention-policy",Value:gt});break}let c=[...t,...n],h=this.settings().filter(S=>!c.includes(S.Name)).map(S=>{let O=S.Value;return typeof S.Value=="number"&&(O=S.Value.toString()),typeof S.Value=="boolean"&&(O=S.Value?"True":"False"),{Name:S.Name?.startsWith("--")?S.Name:`--${S.Name}`,Value:O}});return[...i,...o,...r,...h]}#c(t){if(!t||t?.indexOf("T")===-1)return{time:t??"13:00"};let e=new Date(t);return{time:`${(""+e.getHours()).padStart(2,"0")}:${(""+e.getMinutes()).padStart(2,"0")}`,date:e.toISOString().split("T")[0]}}setTargetUrl(t,e=!1){e&&(this.#l=null),this.targetUrlModel.set(t)}#r(){this.generalForm.reset(),this.sourceDataForm.reset(),this.scheduleFields.autoRun.set(ee.autoRun),this.scheduleFields.nextTime.set(ee.nextTime),this.scheduleFields.runAgain.set(ee.runAgain),this.optionsFields.remoteVolumeSize.set("50MB"),this.optionsFields.backupRetention.set("all"),this.settings.set([]),this.targetUrlModel.set(null)}static \u0275fac=function(e){return new(e||a)};static \u0275prov=ge({token:a,factory:a.\u0275fac,providedIn:"root"})};var yt=["formRef"];function Rt(a,t){a&1&&(s(0,"sh-alert",17),C(1,5),m(2,"sh-icon",26),F(),l())}function Ot(a,t){if(a&1&&x(0),a&2){let e=t.$implicit;Qe(" ",e.DisplayName," ")}}function wt(a,t){if(a&1&&m(0,"sh-progress-bar",40),a&2){let e=u(3);Fe("error",e.calculatePasswordStrength()===1)("warn",e.calculatePasswordStrength()===2)("primary",e.calculatePasswordStrength()===4)("success",e.calculatePasswordStrength()===5),T("value",e.calculatePasswordStrength()*(100/5))}}function $t(a,t){a&1&&(s(0,"span",35),f(1,10),l())}function Lt(a,t){a&1&&(C(0,8,1),m(1,"sh-icon"),F())}function It(a,t){a&1&&(C(0,8,2),m(1,"sh-icon"),F())}function Ut(a,t){a&1&&(C(0,11,1),m(1,"sh-icon",42),F())}function xt(a,t){a&1&&(C(0,11,2),m(1,"sh-icon"),F())}function Gt(a,t){if(a&1){let e=G();s(0,"button",41),E("click",function(){d(e);let i=u(3);return p(i.copyPassword())}),C(1,11),y(2,Ut,2,0)(3,xt,2,0),F(),l()}if(a&2){let e=u(3);_(2),R(e.copiedPassword()?2:3)}}function bt(a,t){a&1&&(s(0,"sh-alert",39),f(1,12),l())}function vt(a,t){if(a&1){let e=G();s(0,"div",30)(1,"sh-form-field")(2,"label",31),C(3,7),m(4,"sup"),F(),l(),m(5,"input",32),l(),y(6,wt,1,9,"sh-progress-bar",33),s(7,"sh-form-field"),m(8,"input",34),y(9,$t,2,0,"span",35),l(),s(10,"div",36)(11,"button",37),E("click",function(){d(e);let i=u(2);return p(i.showPassword.set(!i.showPassword()))}),C(12,8),y(13,Lt,2,0)(14,It,2,0),F(),l(),s(15,"button",37),E("click",function(){d(e);let i=u(2);return p(i.generatePassword())}),C(16,9),m(17,"sh-icon"),F(),l(),y(18,Gt,4,1,"button",38),l(),y(19,bt,2,0,"sh-alert",39),l()}if(a&2){let e=u(2);_(5),T("type",e.showPassword()?"text":"password"),_(),R(e.generalForm.value.password?6:-1),_(2),T("type",e.showPassword()?"text":"password"),_(),R(e.generalForm.value.repeatPassword&&e.generalForm.value.repeatPassword!==e.generalForm.value.password?9:-1),_(4),R(e.showPassword()?13:14),_(5),R(e.showCopyPassword()?18:-1),_(),R(e.generalForm.value.password&&e.generalForm.value.password===e.generalForm.value.repeatPassword?19:-1)}}function Bt(a,t){if(a&1&&(s(0,"sh-select",27)(1,"label",28),f(2,6),l(),m(3,"input",29),qe(4,Ot,1,1,"ng-template"),l(),y(5,vt,20,7,"div",30)),a&2){let e=u();T("options",e.encryptionOptions())("isClearable",!1),_(5),R(e.encryptionFieldSignal()!==e.noneOptionKey?5:-1)}}function kt(a,t){if(a&1&&(s(0,"button",24),C(1,13),m(2,"sh-icon"),F(),l()),a&2){let e=u();T("disabled",e.nameAndDescriptionValid()===!1)}}function Vt(a,t){if(a&1&&(s(0,"button",25),C(1,14),m(2,"sh-icon"),F(),l()),a&2){let e=u();T("disabled",e.generalForm.invalid||e.showCopyPassword()&&!e.copiedPassword())}}var te=new ye,mt=(a={name:"",description:"",encryption:"",password:"",repeatPassword:"",compression:""})=>te.group({name:te.control(a.name,[Ae.required]),description:te.control(a.description),encryption:te.control(a.encryption,[_t()]),password:te.control(a.password,[Ve(t=>t?.value.encryption!=="",[Ae.required])]),repeatPassword:te.control(a.repeatPassword,[Ve(t=>t?.value.encryption!=="",[Ae.required])]),compression:te.control(a.compression)}),pe={Key:"-",DisplayName:"None"},je=class a{#e=M(z);#t=M(ie);#i=M(rt);#n=M(J);#a=M(Te);formRef=Ee.required("formRef");generalForm=this.#n.generalForm;generalFormSignal=this.#n.generalFormSignal;encryptionFieldSignal=this.#n.encryptionFieldSignal;encryptionOptions=this.#n.encryptionOptions;isNew=this.#n.isNew;showPassword=g(!1);copiedPassword=g(!1);showCopyPassword=g(!1);noneOptionKey=pe.Key;encryptionEffect=ne(()=>{this.encryptionFieldSignal()===pe.Key&&(this.copiedPassword.set(!1),this.showCopyPassword.set(!1))});nameAndDescriptionValid=I(()=>{let t=this.generalFormSignal(),e=this.generalForm.controls;return e?.name&&e.name.valid&&e?.description&&e.description.valid});calculatePasswordStrength=I(()=>{let e=this.generalFormSignal()?.password??"";return this.#i.calculatePasswordStrength(e)});ngOnInit(){this.formRef().nativeElement.focus()}exit(){this.#n.exit(!0)}async copyPassword(){let t=this.generalForm.controls.password.value;await this.#o(t??""),this.copiedPassword.set(!0)}async#o(t){try{await navigator.clipboard.writeText(t)}catch{try{let n=document.createElement("textarea");n.value=t,document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n)}catch(n){console.error("Failed to copy text: ",n)}}}generatePassword(){this.copiedPassword.set(!1);let t=this.#i.generate(16);this.generalForm.controls.password.setValue(t),this.generalForm.controls.repeatPassword.setValue(t),this.showCopyPassword.set(!0)}next(){this.#n.isNew()||this.#n.submit(!0),this.#e.navigate(["destination"],{relativeTo:this.#t.parent})}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=H({type:a,selectors:[["app-general"]],viewQuery:function(e,n){e&1&&me(n.formRef,yt,5),e&2&&Ce()},decls:21,vars:4,consts:()=>{let t;t=$localize`Your backup name`;let e;e=$localize`Your backup description`;let n;n=$localize`Remember to copy the password`;let i;i=$localize`General backup settings`;let o;o=$localize` Backup name ${"\uFFFD#8\uFFFD"}:START_SUPERSCRIPT:*${"\uFFFD/#8\uFFFD"}:CLOSE_SUPERSCRIPT:`;let r;r=$localize`Backup description`;let c;c=$localize`${"\uFFFD#18\uFFFD"}:START_TAG_SH_ICON:arrow-left${"\uFFFD/#18\uFFFD"}:CLOSE_TAG_SH_ICON: Exit `;let h;h=$localize`${"\uFFFD#2\uFFFD"}:START_TAG_SH_ICON:lock${"\uFFFD/#2\uFFFD"}:CLOSE_TAG_SH_ICON: Encrypted backup `;let S;S=$localize`Encryption`;let O;O=$localize`Encryption`;let P;P=$localize`Password`;let U;U=$localize`Repeat password`;let K;K=$localize` Create a password ${"\uFFFD#4\uFFFD"}:START_SUPERSCRIPT:*${"\uFFFD/#4\uFFFD"}:CLOSE_SUPERSCRIPT:`;let v;v=$localize`${"\uFFFD*13:1\uFFFD"}:START_BLOCK_IF:${"[\uFFFD#1:1\uFFFD|\uFFFD#1:2\uFFFD]"}:START_TAG_SH_ICON:eye-slash${"[\uFFFD/#1:1\uFFFD|\uFFFD/#1:2\uFFFD]"}:CLOSE_TAG_SH_ICON: hide ${"\uFFFD/*13:1\uFFFD"}:CLOSE_BLOCK_IF:${"\uFFFD*14:2\uFFFD"}:START_BLOCK_ELSE:${"[\uFFFD#1:1\uFFFD|\uFFFD#1:2\uFFFD]"}:START_TAG_SH_ICON:eye${"[\uFFFD/#1:1\uFFFD|\uFFFD/#1:2\uFFFD]"}:CLOSE_TAG_SH_ICON: show ${"\uFFFD/*14:2\uFFFD"}:CLOSE_BLOCK_ELSE:`,v=Ge(v);let W;W=$localize`${"\uFFFD#17\uFFFD"}:START_TAG_SH_ICON:password${"\uFFFD/#17\uFFFD"}:CLOSE_TAG_SH_ICON: Generate password `;let D;D=$localize`Passwords do not match`;let Z;Z=$localize`${"\uFFFD*2:1\uFFFD"}:START_BLOCK_IF:${"\uFFFD#1:1\uFFFD"}:START_TAG_SH_ICON:check${"[\uFFFD/#1:1\uFFFD|\uFFFD/#1:2\uFFFD]"}:CLOSE_TAG_SH_ICON: Copied password ${"\uFFFD/*2:1\uFFFD"}:CLOSE_BLOCK_IF:${"\uFFFD*3:2\uFFFD"}:START_BLOCK_ELSE:${"\uFFFD#1:2\uFFFD"}:START_TAG_SH_ICON_1:copy${"[\uFFFD/#1:1\uFFFD|\uFFFD/#1:2\uFFFD]"}:CLOSE_TAG_SH_ICON: Copy password ${"\uFFFD/*3:2\uFFFD"}:CLOSE_BLOCK_ELSE:`,Z=Ge(Z);let _e;_e=$localize` Tip: Be sure to save your password. If you lose it, you will lose access to your backups. `;let ue;ue=$localize` Continue ${"\uFFFD#2\uFFFD"}:START_TAG_SH_ICON:arrow-right${"\uFFFD/#2\uFFFD"}:CLOSE_TAG_SH_ICON:`;let ce;return ce=$localize` Continue ${"\uFFFD#2\uFFFD"}:START_TAG_SH_ICON:arrow-right${"\uFFFD/#2\uFFFD"}:CLOSE_TAG_SH_ICON:`,[["formRef",""],i,o,r,c,h,O,K,v,W,D,Z,_e,ue,ce,["autocomplete","off",3,"submit","formGroup"],[1,"title-30"],[1,"primary"],["for","backupName"],["type","text","tabindex","1","placeholder",t,"formControlName","name"],["for","backupDescription"],["id","backupDescription","tabindex","2","placeholder",e,"formControlName","description"],[1,"form-actions"],["type","button","shButton","",3,"click"],["shButton","","type","submit",1,"raised","primary",3,"disabled"],["shButton","","type","submit","shTooltip",n,1,"raised","primary",3,"disabled"],["icon",""],["value","Key","label","DisplayName",3,"options","isClearable"],["for","encryption"],["type","text","id","encryption","tabindex","3","placeholder",S,"formControlName","encryption"],[1,"passwords"],["for","password"],["id","password","tabindex","4","autocomplete","off","placeholder",P,"formControlName","password",3,"type"],[1,"raised",3,"error","warn","primary","success","value"],["id","repeatPassword","tabindex","5","autocomplete","off","placeholder",U,"formControlName","repeatPassword",3,"type"],["error",""],[1,"password-actions"],["shButton","","type","button",1,"small",3,"click"],["shButton","","type","button",1,"small","copy"],["type","primary"],[1,"raised",3,"value"],["shButton","","type","button",1,"small","copy",3,"click"],[1,"sh-success"]]},template:function(e,n){if(e&1){let i=G();s(0,"form",15,0),E("submit",function(){return d(i),p(n.next())}),s(2,"h3",16),f(3,1),l(),y(4,Rt,3,0,"sh-alert",17),s(5,"sh-form-field")(6,"label",18),C(7,2),m(8,"sup"),F(),l(),m(9,"input",19),l(),s(10,"sh-form-field")(11,"label",20),f(12,3),l(),m(13,"textarea",21),l(),y(14,Bt,6,3),s(15,"div",22)(16,"button",23),E("click",function(){return d(i),p(n.exit())}),C(17,4),m(18,"sh-icon"),F(),l(),y(19,kt,3,1,"button",24)(20,Vt,3,1,"button",25),l()()}if(e&2){let i;T("formGroup",n.generalForm),_(4),R(!n.isNew()&&((i=n.generalFormSignal())==null?null:i.encryption)!==""?4:-1),_(10),R(n.isNew()?14:-1),_(5),R(n.encryptionFieldSignal()===n.noneOptionKey||!n.isNew()?19:20)}},dependencies:[Re,De,Y,Q,Pe,Ne,Me,q,ae,oe,j,et,Je,tt],styles:["[_nghost-%COMP%]{display:block;width:100%;max-width:32.5rem;padding:2.5rem}form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem;padding-bottom:1.5rem}sup[_ngcontent-%COMP%]{padding:0 .125rem;color:var(--error-8)}.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%] sh-icon.sh-success[_ngcontent-%COMP%]{color:var(--success-8)}"],changeDetection:0})};export{mt as a,pe as b,je as c,ee as d,Ke as e,pt as f,He as g,J as h};
@@ -1 +1 @@
1
- import{e as a,f as b}from"./chunk-DAYBMF7U.js";import"./chunk-4DNWEJIW.js";import"./chunk-TK5QY2QD.js";import"./chunk-23CWXAU4.js";import"./chunk-DDWLL7XA.js";import"./chunk-O64ZZGQZ.js";import"./chunk-UIJYCGKA.js";import"./chunk-DELLEGXW.js";import"./chunk-VTSUHAP5.js";import"./chunk-UP5EOICU.js";import"./chunk-N5SC4SKW.js";import"./chunk-UKQFDBNO.js";import"./chunk-LVP2TPMO.js";import"./chunk-43JMN2ZY.js";import"./chunk-H7K35UUX.js";import"./chunk-NOPMCS2Z.js";import"./chunk-RUXCS4ZK.js";import"./chunk-FPPZ4BUR.js";import"./chunk-HNWRQABR.js";import"./chunk-EUDKD2JW.js";export{a as createRestoreSelectFilesForm,b as default};
1
+ import{e as a,f as b}from"./chunk-7ZTBW6LJ.js";import"./chunk-K56EDP42.js";import"./chunk-TK5QY2QD.js";import"./chunk-FZTPUMUC.js";import"./chunk-DDWLL7XA.js";import"./chunk-O64ZZGQZ.js";import"./chunk-UIJYCGKA.js";import"./chunk-DELLEGXW.js";import"./chunk-VTSUHAP5.js";import"./chunk-UP5EOICU.js";import"./chunk-N5SC4SKW.js";import"./chunk-UKQFDBNO.js";import"./chunk-LVP2TPMO.js";import"./chunk-43JMN2ZY.js";import"./chunk-H7K35UUX.js";import"./chunk-NOPMCS2Z.js";import"./chunk-RUXCS4ZK.js";import"./chunk-FPPZ4BUR.js";import"./chunk-HNWRQABR.js";import"./chunk-EUDKD2JW.js";export{a as createRestoreSelectFilesForm,b as default};
package/index.html CHANGED
@@ -63,5 +63,5 @@
63
63
  <body>
64
64
  <app-root></app-root>
65
65
  <div class="loading">Connecting ...</div>
66
- <link rel="modulepreload" href="chunk-4TDUWDRL.js"><link rel="modulepreload" href="chunk-QDFDQHU3.js"><link rel="modulepreload" href="chunk-6LTGTS6B.js"><link rel="modulepreload" href="chunk-DVDTYV66.js"><link rel="modulepreload" href="chunk-UIJYCGKA.js"><link rel="modulepreload" href="chunk-DELLEGXW.js"><link rel="modulepreload" href="chunk-RHW5QVAY.js"><link rel="modulepreload" href="chunk-VTSUHAP5.js"><link rel="modulepreload" href="chunk-UP5EOICU.js"><link rel="modulepreload" href="chunk-Z3EPZZGY.js"><script src="polyfills-DNO7R5SL.js" type="module"></script><script src="main-USVDGYE2.js" type="module"></script></body>
66
+ <link rel="modulepreload" href="chunk-4TDUWDRL.js"><link rel="modulepreload" href="chunk-QDFDQHU3.js"><link rel="modulepreload" href="chunk-6LTGTS6B.js"><link rel="modulepreload" href="chunk-DVDTYV66.js"><link rel="modulepreload" href="chunk-UIJYCGKA.js"><link rel="modulepreload" href="chunk-DELLEGXW.js"><link rel="modulepreload" href="chunk-RHW5QVAY.js"><link rel="modulepreload" href="chunk-VTSUHAP5.js"><link rel="modulepreload" href="chunk-UP5EOICU.js"><link rel="modulepreload" href="chunk-Z3EPZZGY.js"><script src="polyfills-DNO7R5SL.js" type="module"></script><script src="main-W52VZQVY.js" type="module"></script></body>
67
67
  </html>
@@ -1 +1 @@
1
- import{b as be,c as ve}from"./chunk-4TDUWDRL.js";import{a as he}from"./chunk-QDFDQHU3.js";import{a as I}from"./chunk-6LTGTS6B.js";import"./chunk-DVDTYV66.js";import"./chunk-UIJYCGKA.js";import"./chunk-DELLEGXW.js";import{a as D}from"./chunk-RHW5QVAY.js";import{a as L}from"./chunk-VTSUHAP5.js";import{a as de}from"./chunk-UP5EOICU.js";import"./chunk-Z3EPZZGY.js";import{a as b,b as v,c as ue,d as k}from"./chunk-UKQFDBNO.js";import{c as ie,d as ae,g as pe,h as ce}from"./chunk-LVP2TPMO.js";import{a as ee}from"./chunk-43JMN2ZY.js";import{c as le}from"./chunk-H7K35UUX.js";import{a as te,b as oe,d as ne,e as re,f as se,i as me}from"./chunk-NOPMCS2Z.js";import{a as ge}from"./chunk-TDKBGGNK.js";import{la as Y,qa as Z}from"./chunk-RUXCS4ZK.js";import"./chunk-FPPZ4BUR.js";import{a as ye}from"./chunk-DFMGS3IN.js";import{b as fe}from"./chunk-6OPAGPKF.js";import{A as x,B as G,Cb as z,H as w,Jc as q,Kc as X,N as J,P as R,Pc as Q,R as B,V as M,Y as $,_ as s,bb as _,f as W,i as j,ia as K,n as F,o as U,oa as d,r as S}from"./chunk-HNWRQABR.js";import"./chunk-EUDKD2JW.js";var E=class e{#o=s(b);#s=s(v);ngOnInit(){this.#s.fetchConfig(),this.#o.clearAllNotCurrentVersion()}static \u0275fac=function(o){return new(o||e)};static \u0275cmp=_({type:e,selectors:[["app-root"]],decls:1,vars:0,template:function(o,n){o&1&&z(0,"router-outlet")},dependencies:[ie],encapsulation:2})};var Se={production:!0,baseUrl:"/api",machineServerUrl:"${WS_URL}",defaultTimeout:3e4};var h=new $("ENVIRONMENT");var A=class e{#o=s(me);isLoaded=d(!1);webmodules=d(null);preload(t=!1){let o=this.#o.getApiV1Webmodules().pipe(B(n=>this.webmodules.set(n)),w(()=>this.isLoaded.set(!0)));if(t)return o;o.subscribe()}static \u0275fac=function(o){return new(o||e)};static \u0275prov=M({token:e,factory:e.\u0275fac,providedIn:"root"})};var Ee=()=>{let e=s(k);return e.token()?!0:e.checkProxyAuthed().pipe(R(t=>t?F(!0):e.refreshToken().pipe(S(()=>!0))))},Ae=()=>{let e=s(v),t=s(I),o=s(K),n=e.relayIsEnabled()?"longpoll":"websocket",i=[o.get(L).preload(!0),o.get(L).preloadFilterGroups(!0),o.get(A).preload(!0)];return e.configLoaded===null?x(i).pipe(S(()=>n)):e.configLoaded?.pipe(R(()=>x(i)))},Re=[{path:"",children:[{path:"login",canActivate:[],loadComponent:()=>import("./chunk-FCRM5DER.js")},{path:"logout",loadComponent:()=>import("./chunk-MVNLSG6Z.js")},{path:"",canActivate:[Ee],children:[{path:"",canActivate:[Ae],loadComponent:()=>import("./chunk-AJTK6HBC.js"),children:[{path:"",loadComponent:()=>import("./chunk-ZNWZFRFW.js")},{path:"add-backup",loadComponent:()=>import("./chunk-FZHTJSDJ.js")},{path:"backup/:id/export",loadComponent:()=>import("./chunk-M6WWZKV7.js")},{path:"backup/import",loadComponent:()=>import("./chunk-FUOS2UGQ.js")},{path:"backup-draft/:id",loadComponent:()=>import("./chunk-LBI35OS4.js"),loadChildren:()=>import("./chunk-X35RIHQ2.js")},{path:"backup/:id",loadComponent:()=>import("./chunk-LBI35OS4.js"),loadChildren:()=>import("./chunk-X35RIHQ2.js")},{path:"backup/:id/log",loadComponent:()=>import("./chunk-QITXA3NT.js")},{path:"backup/:id/database",loadComponent:()=>import("./chunk-J3ONM4TQ.js")},{path:"backup/:id/commandline",loadComponent:()=>import("./chunk-AZ7AMASU.js")},{path:"backup/:id/commandline/:runId",loadComponent:()=>import("./chunk-2UCO57JQ.js")},{path:"backup/:id/delete",loadComponent:()=>import("./chunk-DLMKZACT.js")},{path:"restore",children:[{path:"",loadComponent:()=>import("./chunk-NJZSEKTD.js")},{path:"from-config",loadComponent:()=>import("./chunk-VHE3K2F5.js")}]},{path:"restore-from-files",loadComponent:()=>import("./chunk-ZAIUME2O.js"),loadChildren:()=>import("./chunk-WODA6N4N.js")},{path:"restore-draft/:id",loadComponent:()=>import("./chunk-ZAIUME2O.js"),loadChildren:()=>import("./chunk-WODA6N4N.js")},{path:"restore/:id",loadComponent:()=>import("./chunk-ZAIUME2O.js"),loadChildren:()=>import("./chunk-WODA6N4N.js")},{path:"settings",loadComponent:()=>import("./chunk-Z6NPBMOP.js")},{path:"about",loadComponent:()=>import("./chunk-WS76KLII.js"),children:[{path:"",redirectTo:"general",pathMatch:"full"},{path:"general",loadComponent:()=>import("./chunk-E66CBA5F.js")},{path:"changelog",loadComponent:()=>import("./chunk-SFSB73YO.js")},{path:"libraries",loadComponent:()=>import("./chunk-TIWH4NKT.js")},{path:"system-info",loadComponent:()=>import("./chunk-IFW3O4YJ.js")},{path:"server-settings",loadComponent:()=>import("./chunk-TKO3OH2C.js")},{path:"logs",loadChildren:()=>import("./chunk-B2D4QGDJ.js")},{path:"crashlogs",loadComponent:()=>import("./chunk-R5RIFWZO.js")}]}]}]}]}];var P=null,Te=(e,t)=>{let o=s(k),n=s(ae),i=s(b),l=s(h),r=i.getItem("locale"),u=s(le),a=be(r),p=e.url==="/api/v1/auth/login",m=e.url==="/api/v1/auth/refresh",C=e.url==="/api/v1/progressstate",g=e.url==="/api/v1/remoteoperation/test",y=e.url==="/api/v1/filesystem/validate",T=e.url.startsWith("/api/v2/"),O=o.token(),V=e,H=e.headers.has("custom-proxy-check")||O===ue;if(O&&e.url.startsWith(l.baseUrl)&&!H){let c=e.headers.set("Authorization",`Bearer ${O}`);r&&r!=="en-US"&&(c=c.set("X-Ui-Language",a)),V=e.clone({headers:c})}return t(V).pipe(S(c=>{if(c.type===4&&c.status===200&&T){let f=c.body;if(f?.Success===!1)throw{status:200,message:f?.Error??"Unknown error",error:{Error:f?.Error??"Unknown error"},body:f}}return c}),G(c=>{let f=c.error?.Error||`Error Code: ${c.status}, Message: ${c.message}`;return!H&&(C&&c.status===404||g||y||u.error(f),m&&c.status===401&&(o.logout(),n.navigate(["/logout"])),!p&&!m&&c.status===401)?(P??=o.refreshToken().pipe(J()),P.pipe(R(()=>t(e.clone({headers:e.headers.set("Authorization",`Bearer ${o.token()}`)}))),w(()=>P=null))):U(()=>({error:c,message:f}))}))};var Ne="1.0.0",we=`portal-proxy-client-${D()}`,Oe=1,N=class e{#o=1e3;#s=s(h);#t=d("disconnected");#l=d(this.#o);#i=d(!1);#n=d(!1);#a=d(null);isConnectedToMachineServer=this.#n.asReadonly();wsState=this.#t.asReadonly();#p=[];#r={};#e=null;#m=new TextDecoder("utf-8");#c=null;#d=Q(()=>{let t=this.#i(),o=this.#l(),n=this.#a();if(!n||!t||!o||o<this.#o){this.#c&&window.clearInterval(this.#c);return}this.#c=window.setInterval(()=>{this.connectToMachineServer(n)},o)});utf8Atob(t){let o=Uint8Array.from(atob(t),i=>i.charCodeAt(0)),n=this.#m.decode(o);return n?JSON.parse(n):null}connectToMachineServer(t,o){let n=o?.reconnect??!1,i=this.wsState();(i==="disconnected"||i==="error"||n)&&(this.#e?.close(),this.#e=null),!this.#e&&(this.#e=new WebSocket(this.#s.machineServerUrl),this.#t.set("connecting"),this.#e.onopen=()=>{this.#t.set("connect"),this.#n.set(!0),this.#i.set(!1),this.#a.set(null)},this.#e.onclose=()=>{this.#t.set("disconnected"),this.#n.set(!1),this.#a.set(t),this.#i.set(!0)},this.#e.onerror=()=>{this.#t.set("error")},this.#e.onmessage=l=>{let r=JSON.parse(l.data);if(this.wsState()==="connect"){if(r.type!=="welcome"){this.disconnectFromMachineServer(`Unexpected message type, expected 'welcome' but got '${r.type}'`);return}let a={token:t,publicKey:"",clientVersion:Ne,protocolVersion:Oe},p=this.createResponse(r,"authportal",a);this.#t.set("welcome"),this.#e?.send(p)}else if(this.wsState()==="welcome"){if(r.type!=="authportal"){this.disconnectFromMachineServer(`Unexpected message type, expected 'authportal' but got '${r.type}'`);return}var u=JSON.parse(r.payload??"");if(u.accepted===!1){this.disconnectFromMachineServer("Authentication failed");return}for(this.#t.set("authenticated"),this.#n.set(!0);this.#p.length>0;){let a=this.#p.pop();a&&this.#r[a.messageId]&&this.activateCommand(a)}}else if(this.wsState()==="authenticated"){if(r.type!=="command"){console.warn(`Unexpected message type, expected 'command' but got '${r.type}'`);return}let a=this.#r[r.messageId];if(a){if(r.errorMessage){a.reject(r.errorMessage);return}else{let p=JSON.parse(r.payload??"");p.body=p?.body==null?null:this.utf8Atob(p.body),a.resolve(p)}delete this.#r[r.messageId],window.clearTimeout(a.timer)}}})}disconnectFromMachineServer(t=null){t&&console.error(t),this.#e?.close(),this.#e=null,this.#t.set("disconnected"),this.#n.set(!1)}createResponse(t,o,n){let i={from:we,to:t.from,type:o,messageId:t.messageId,payload:JSON.stringify(n)};return JSON.stringify(i)}sendCommand(t,o,n,i,l,r,u=5e3){return(this.wsState()==="disconnected"||this.wsState()==="error")&&this.connectToMachineServer(t),new Promise((a,p)=>{let m=D(),g={from:we,to:o,type:"command",messageId:m,payload:JSON.stringify({method:n,path:i,body:l,headers:r})},y={resolve:a,reject:p,timer:window.setTimeout(()=>{let T=this.#r[m];T&&(delete this.#r[m],T.reject("Timeout"))},u)};this.#r[m]=y,this.#n()?this.activateCommand(g):this.#p.push(g)})}activateCommand(t){this.#e?.send(JSON.stringify(t))}static \u0275fac=function(o){return new(o||e)};static \u0275prov=M({token:e,factory:e.\u0275fac,providedIn:"root"})};function xe(e){if(typeof e!="string")return null;let o=new TextEncoder().encode(e);return window.btoa(String.fromCharCode(...o))}function Me(e,t,o){let n=e.relayconfigState.config();if(n===null)return o(t);let i=xe(t.body),l={};t.headers.keys().forEach(p=>{l[p]=t.headers.get(p)??""});let r=t.headers.get("timeout"),u=r!==null?parseInt(r):e.defaultTimeout;t.url.startsWith("/api/v1/serverstate")&&t.url.includes("longpoll=true")&&(u=1e3*99);let a=e.relayWebsocket.sendCommand(n.accessToken,n.clientId,t.method,t.url,i,l,u);return new W(p=>{a.then(m=>{let C=new te;l!=null&&Object.keys(l).forEach(y=>{C.set(y,l[y])});let g=new oe({body:m.body,status:m.code,statusText:"OK",headers:C});p.next(g),p.complete()})})}var ke=(e,t)=>{let o={relayconfigState:s(v),defaultTimeout:s(h).defaultTimeout,relayWebsocket:s(N)},n=o.relayconfigState.config();if(o.relayconfigState.configLoaded!==null&&n===null){let i=new j;return o.relayconfigState.configLoaded.subscribe(l=>{l&&Me(o,e,t).subscribe(i)}),i}return Me(o,e,t)};var Ie={providers:[q(),pe(Re,ce()),ne(se(),re([ke,Te])),b,{provide:h,useValue:Se},{provide:X,useValue:ve()},he,I,fe,Z,de,Y,ge,ye]};ee(E,Ie);
1
+ import{b as be,c as ve}from"./chunk-4TDUWDRL.js";import{a as he}from"./chunk-QDFDQHU3.js";import{a as I}from"./chunk-6LTGTS6B.js";import"./chunk-DVDTYV66.js";import"./chunk-UIJYCGKA.js";import"./chunk-DELLEGXW.js";import{a as D}from"./chunk-RHW5QVAY.js";import{a as L}from"./chunk-VTSUHAP5.js";import{a as de}from"./chunk-UP5EOICU.js";import"./chunk-Z3EPZZGY.js";import{a as b,b as v,c as ue,d as k}from"./chunk-UKQFDBNO.js";import{c as ie,d as ae,g as pe,h as ce}from"./chunk-LVP2TPMO.js";import{a as ee}from"./chunk-43JMN2ZY.js";import{c as le}from"./chunk-H7K35UUX.js";import{a as te,b as oe,d as ne,e as re,f as se,i as me}from"./chunk-NOPMCS2Z.js";import{a as ge}from"./chunk-TDKBGGNK.js";import{la as Y,qa as Z}from"./chunk-RUXCS4ZK.js";import"./chunk-FPPZ4BUR.js";import{a as ye}from"./chunk-DFMGS3IN.js";import{b as fe}from"./chunk-6OPAGPKF.js";import{A as x,B as G,Cb as z,H as w,Jc as q,Kc as X,N as J,P as R,Pc as Q,R as B,V as M,Y as $,_ as s,bb as _,f as W,i as j,ia as K,n as F,o as U,oa as d,r as S}from"./chunk-HNWRQABR.js";import"./chunk-EUDKD2JW.js";var E=class e{#o=s(b);#s=s(v);ngOnInit(){this.#s.fetchConfig(),this.#o.clearAllNotCurrentVersion()}static \u0275fac=function(o){return new(o||e)};static \u0275cmp=_({type:e,selectors:[["app-root"]],decls:1,vars:0,template:function(o,n){o&1&&z(0,"router-outlet")},dependencies:[ie],encapsulation:2})};var Se={production:!0,baseUrl:"/api",machineServerUrl:"${WS_URL}",defaultTimeout:3e4};var h=new $("ENVIRONMENT");var A=class e{#o=s(me);isLoaded=d(!1);webmodules=d(null);preload(t=!1){let o=this.#o.getApiV1Webmodules().pipe(B(n=>this.webmodules.set(n)),w(()=>this.isLoaded.set(!0)));if(t)return o;o.subscribe()}static \u0275fac=function(o){return new(o||e)};static \u0275prov=M({token:e,factory:e.\u0275fac,providedIn:"root"})};var Ee=()=>{let e=s(k);return e.token()?!0:e.checkProxyAuthed().pipe(R(t=>t?F(!0):e.refreshToken().pipe(S(()=>!0))))},Ae=()=>{let e=s(v),t=s(I),o=s(K),n=e.relayIsEnabled()?"longpoll":"websocket",i=[o.get(L).preload(!0),o.get(L).preloadFilterGroups(!0),o.get(A).preload(!0)];return e.configLoaded===null?x(i).pipe(S(()=>n)):e.configLoaded?.pipe(R(()=>x(i)))},Re=[{path:"",children:[{path:"login",canActivate:[],loadComponent:()=>import("./chunk-FCRM5DER.js")},{path:"logout",loadComponent:()=>import("./chunk-MVNLSG6Z.js")},{path:"",canActivate:[Ee],children:[{path:"",canActivate:[Ae],loadComponent:()=>import("./chunk-AJTK6HBC.js"),children:[{path:"",loadComponent:()=>import("./chunk-ZNWZFRFW.js")},{path:"add-backup",loadComponent:()=>import("./chunk-FZHTJSDJ.js")},{path:"backup/:id/export",loadComponent:()=>import("./chunk-M6WWZKV7.js")},{path:"backup/import",loadComponent:()=>import("./chunk-FUOS2UGQ.js")},{path:"backup-draft/:id",loadComponent:()=>import("./chunk-GWQAMFY2.js"),loadChildren:()=>import("./chunk-UM2R35PK.js")},{path:"backup/:id",loadComponent:()=>import("./chunk-GWQAMFY2.js"),loadChildren:()=>import("./chunk-UM2R35PK.js")},{path:"backup/:id/log",loadComponent:()=>import("./chunk-QITXA3NT.js")},{path:"backup/:id/database",loadComponent:()=>import("./chunk-J3ONM4TQ.js")},{path:"backup/:id/commandline",loadComponent:()=>import("./chunk-2RDLOXGA.js")},{path:"backup/:id/commandline/:runId",loadComponent:()=>import("./chunk-2UCO57JQ.js")},{path:"backup/:id/delete",loadComponent:()=>import("./chunk-DLMKZACT.js")},{path:"restore",children:[{path:"",loadComponent:()=>import("./chunk-NJZSEKTD.js")},{path:"from-config",loadComponent:()=>import("./chunk-VHE3K2F5.js")}]},{path:"restore-from-files",loadComponent:()=>import("./chunk-HTBOWZJ4.js"),loadChildren:()=>import("./chunk-CVEBTGDK.js")},{path:"restore-draft/:id",loadComponent:()=>import("./chunk-HTBOWZJ4.js"),loadChildren:()=>import("./chunk-CVEBTGDK.js")},{path:"restore/:id",loadComponent:()=>import("./chunk-HTBOWZJ4.js"),loadChildren:()=>import("./chunk-CVEBTGDK.js")},{path:"settings",loadComponent:()=>import("./chunk-LF7PTCJR.js")},{path:"about",loadComponent:()=>import("./chunk-WS76KLII.js"),children:[{path:"",redirectTo:"general",pathMatch:"full"},{path:"general",loadComponent:()=>import("./chunk-E66CBA5F.js")},{path:"changelog",loadComponent:()=>import("./chunk-SFSB73YO.js")},{path:"libraries",loadComponent:()=>import("./chunk-TIWH4NKT.js")},{path:"system-info",loadComponent:()=>import("./chunk-IFW3O4YJ.js")},{path:"server-settings",loadComponent:()=>import("./chunk-TKO3OH2C.js")},{path:"logs",loadChildren:()=>import("./chunk-B2D4QGDJ.js")},{path:"crashlogs",loadComponent:()=>import("./chunk-R5RIFWZO.js")}]}]}]}]}];var P=null,Te=(e,t)=>{let o=s(k),n=s(ae),i=s(b),l=s(h),r=i.getItem("locale"),u=s(le),a=be(r),p=e.url==="/api/v1/auth/login",m=e.url==="/api/v1/auth/refresh",C=e.url==="/api/v1/progressstate",g=e.url==="/api/v1/remoteoperation/test",y=e.url==="/api/v1/filesystem/validate",T=e.url.startsWith("/api/v2/"),O=o.token(),V=e,H=e.headers.has("custom-proxy-check")||O===ue;if(O&&e.url.startsWith(l.baseUrl)&&!H){let c=e.headers.set("Authorization",`Bearer ${O}`);r&&r!=="en-US"&&(c=c.set("X-Ui-Language",a)),V=e.clone({headers:c})}return t(V).pipe(S(c=>{if(c.type===4&&c.status===200&&T){let f=c.body;if(f?.Success===!1)throw{status:200,message:f?.Error??"Unknown error",error:{Error:f?.Error??"Unknown error"},body:f}}return c}),G(c=>{let f=c.error?.Error||`Error Code: ${c.status}, Message: ${c.message}`;return!H&&(C&&c.status===404||g||y||u.error(f),m&&c.status===401&&(o.logout(),n.navigate(["/logout"])),!p&&!m&&c.status===401)?(P??=o.refreshToken().pipe(J()),P.pipe(R(()=>t(e.clone({headers:e.headers.set("Authorization",`Bearer ${o.token()}`)}))),w(()=>P=null))):U(()=>({error:c,message:f}))}))};var Ne="1.0.0",we=`portal-proxy-client-${D()}`,Oe=1,N=class e{#o=1e3;#s=s(h);#t=d("disconnected");#l=d(this.#o);#i=d(!1);#n=d(!1);#a=d(null);isConnectedToMachineServer=this.#n.asReadonly();wsState=this.#t.asReadonly();#p=[];#r={};#e=null;#m=new TextDecoder("utf-8");#c=null;#d=Q(()=>{let t=this.#i(),o=this.#l(),n=this.#a();if(!n||!t||!o||o<this.#o){this.#c&&window.clearInterval(this.#c);return}this.#c=window.setInterval(()=>{this.connectToMachineServer(n)},o)});utf8Atob(t){let o=Uint8Array.from(atob(t),i=>i.charCodeAt(0)),n=this.#m.decode(o);return n?JSON.parse(n):null}connectToMachineServer(t,o){let n=o?.reconnect??!1,i=this.wsState();(i==="disconnected"||i==="error"||n)&&(this.#e?.close(),this.#e=null),!this.#e&&(this.#e=new WebSocket(this.#s.machineServerUrl),this.#t.set("connecting"),this.#e.onopen=()=>{this.#t.set("connect"),this.#n.set(!0),this.#i.set(!1),this.#a.set(null)},this.#e.onclose=()=>{this.#t.set("disconnected"),this.#n.set(!1),this.#a.set(t),this.#i.set(!0)},this.#e.onerror=()=>{this.#t.set("error")},this.#e.onmessage=l=>{let r=JSON.parse(l.data);if(this.wsState()==="connect"){if(r.type!=="welcome"){this.disconnectFromMachineServer(`Unexpected message type, expected 'welcome' but got '${r.type}'`);return}let a={token:t,publicKey:"",clientVersion:Ne,protocolVersion:Oe},p=this.createResponse(r,"authportal",a);this.#t.set("welcome"),this.#e?.send(p)}else if(this.wsState()==="welcome"){if(r.type!=="authportal"){this.disconnectFromMachineServer(`Unexpected message type, expected 'authportal' but got '${r.type}'`);return}var u=JSON.parse(r.payload??"");if(u.accepted===!1){this.disconnectFromMachineServer("Authentication failed");return}for(this.#t.set("authenticated"),this.#n.set(!0);this.#p.length>0;){let a=this.#p.pop();a&&this.#r[a.messageId]&&this.activateCommand(a)}}else if(this.wsState()==="authenticated"){if(r.type!=="command"){console.warn(`Unexpected message type, expected 'command' but got '${r.type}'`);return}let a=this.#r[r.messageId];if(a){if(r.errorMessage){a.reject(r.errorMessage);return}else{let p=JSON.parse(r.payload??"");p.body=p?.body==null?null:this.utf8Atob(p.body),a.resolve(p)}delete this.#r[r.messageId],window.clearTimeout(a.timer)}}})}disconnectFromMachineServer(t=null){t&&console.error(t),this.#e?.close(),this.#e=null,this.#t.set("disconnected"),this.#n.set(!1)}createResponse(t,o,n){let i={from:we,to:t.from,type:o,messageId:t.messageId,payload:JSON.stringify(n)};return JSON.stringify(i)}sendCommand(t,o,n,i,l,r,u=5e3){return(this.wsState()==="disconnected"||this.wsState()==="error")&&this.connectToMachineServer(t),new Promise((a,p)=>{let m=D(),g={from:we,to:o,type:"command",messageId:m,payload:JSON.stringify({method:n,path:i,body:l,headers:r})},y={resolve:a,reject:p,timer:window.setTimeout(()=>{let T=this.#r[m];T&&(delete this.#r[m],T.reject("Timeout"))},u)};this.#r[m]=y,this.#n()?this.activateCommand(g):this.#p.push(g)})}activateCommand(t){this.#e?.send(JSON.stringify(t))}static \u0275fac=function(o){return new(o||e)};static \u0275prov=M({token:e,factory:e.\u0275fac,providedIn:"root"})};function xe(e){if(typeof e!="string")return null;let o=new TextEncoder().encode(e);return window.btoa(String.fromCharCode(...o))}function Me(e,t,o){let n=e.relayconfigState.config();if(n===null)return o(t);let i=xe(t.body),l={};t.headers.keys().forEach(p=>{l[p]=t.headers.get(p)??""});let r=t.headers.get("timeout"),u=r!==null?parseInt(r):e.defaultTimeout;t.url.startsWith("/api/v1/serverstate")&&t.url.includes("longpoll=true")&&(u=1e3*99);let a=e.relayWebsocket.sendCommand(n.accessToken,n.clientId,t.method,t.url,i,l,u);return new W(p=>{a.then(m=>{let C=new te;l!=null&&Object.keys(l).forEach(y=>{C.set(y,l[y])});let g=new oe({body:m.body,status:m.code,statusText:"OK",headers:C});p.next(g),p.complete()})})}var ke=(e,t)=>{let o={relayconfigState:s(v),defaultTimeout:s(h).defaultTimeout,relayWebsocket:s(N)},n=o.relayconfigState.config();if(o.relayconfigState.configLoaded!==null&&n===null){let i=new j;return o.relayconfigState.configLoaded.subscribe(l=>{l&&Me(o,e,t).subscribe(i)}),i}return Me(o,e,t)};var Ie={providers:[q(),pe(Re,ce()),ne(se(),re([ke,Te])),b,{provide:h,useValue:Se},{provide:X,useValue:ve()},he,I,fe,Z,de,Y,ge,ye]};ee(E,Ie);
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.147",
2
+ "version": "0.0.148",
3
3
  "name": "@duplicati/ngclient",
4
4
  "license": "MIT",
5
5
  "contributors": [
package/chunk-WODA6N4N.js DELETED
@@ -1 +0,0 @@
1
- import"./chunk-EUDKD2JW.js";var o=[{path:"",redirectTo:"select-files",pathMatch:"full"},{path:"destination",loadComponent:()=>import("./chunk-HTMYJ6GV.js")},{path:"encryption",loadComponent:()=>import("./chunk-QMTQBA5B.js")},{path:"select-files",loadComponent:()=>import("./chunk-EVUH6UI7.js")},{path:"options",loadComponent:()=>import("./chunk-QID36V67.js")},{path:":taskid/progress",loadComponent:()=>import("./chunk-CMON2THK.js")}],t=o;export{t as default};
package/chunk-X35RIHQ2.js DELETED
@@ -1 +0,0 @@
1
- import"./chunk-EUDKD2JW.js";var o=[{path:"",redirectTo:"general",pathMatch:"full"},{path:"general",loadComponent:()=>import("./chunk-DEZMBIZH.js")},{path:"destination",loadComponent:()=>import("./chunk-7UZESCOY.js")},{path:"source-data",loadComponent:()=>import("./chunk-XBWYEQIH.js")},{path:"schedule",loadComponent:()=>import("./chunk-MNGZF3JM.js")},{path:"options",loadComponent:()=>import("./chunk-NMJ4XJ6C.js")}];export{o as default};