@duplicati/ngclient 0.0.219 → 0.0.220

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.
@@ -0,0 +1,3 @@
1
+ import{a as Ce}from"./chunk-GRE6GKVP.js";import{a as pe}from"./chunk-IFSZJSGH.js";import"./chunk-QDDVZ4CR.js";import"./chunk-BLSV7CNZ.js";import"./chunk-I6MIXWIT.js";import{l as ge,q as b}from"./chunk-DJXLNIMV.js";import"./chunk-CAQ3XMFP.js";import"./chunk-VC55KFAX.js";import"./chunk-ZEFSBETQ.js";import{b as _e}from"./chunk-RJ2JM7C7.js";import"./chunk-WOKYULBU.js";import"./chunk-TCXCC5BM.js";import"./chunk-GKGMP6VF.js";import{a as de}from"./chunk-6Q6SSTBK.js";import"./chunk-YCJYEQF7.js";import"./chunk-OHYENIPP.js";import"./chunk-UTXZPAY6.js";import"./chunk-IMQUTGIK.js";import"./chunk-ANSV4G2K.js";import"./chunk-BACKG7KA.js";import{b as A}from"./chunk-IQL3REGJ.js";import"./chunk-AIAUP7OE.js";import{a as ue}from"./chunk-C6PICAXB.js";import"./chunk-6JS7B4FW.js";import{B as oe,G as ie,H as ae,L as se,P as re,Y as le,c as H,e as z,f as W,j,p as Q,q as Y,r as Z,s as ee,t as te,v as ne}from"./chunk-VKQQDCUN.js";import{b as ce,d as me}from"./chunk-DSYNIXJF.js";import{b as K,d as J,e as X}from"./chunk-NPFPMA4P.js";import"./chunk-O2SMJYPC.js";import"./chunk-N2AU7VKX.js";import"./chunk-ZC23RK4J.js";import"./chunk-OPHQNXYO.js";import{$b as F,Ac as V,Cb as C,Db as m,Eb as a,Fb as r,Mb as G,Qc as q,Sa as d,Tb as _,Ub as p,V as L,Vb as B,Wb as U,Xb as x,Zb as I,_ as u,da as h,ea as S,gb as R,kc as v,pa as E,ra as $,sc as M,tc as D,uc as O,wb as y,xb as k,zc as w}from"./chunk-TQTOIWBK.js";import"./chunk-7CGTOI24.js";var f=class c{#e=new Map;saveState(t){let e=de();return this.#e.set(e,t),e}getState(t){return this.#e.get(t)}static \u0275fac=function(e){return new(e||c)};static \u0275prov=L({token:c,factory:c.\u0275fac,providedIn:"root"})};var he=()=>["backup"];function Se(c,t){c&1&&r(0,"sh-progress-bar",10)}function Te(c,t){if(c&1){let e=G();m(0,"form",11)(1,"sh-select",12)(2,"label",13),_(3,1),r(4,"sh-icon",14),p(),a(),r(5,"input",15),a(),m(6,"sh-form-field")(7,"label",16),_(8,2),r(9,"sh-icon",17),p(),a(),r(10,"textarea",18),a(),m(11,"sh-form-field")(12,"label",19),_(13,3),r(14,"sh-icon",20),p(),a(),r(15,"textarea",21),a()(),m(16,"sh-divider"),B(17,4),a(),m(18,"form",11)(19,"sh-form-field")(20,"label",22),_(21,5),r(22,"sh-icon",23),p(),a(),r(23,"input",24),a(),m(24,"sh-form-field")(25,"label",25),_(26,6),r(27,"sh-icon",26),p(),a(),r(28,"input",27),a(),m(29,"app-filters",28),O("filtersChange",function(i){h(e);let s=F();return D(s.filters,i)||(s.filters=i),S(i)}),I("filtersChange",function(i){h(e);let s=F();return S(s.updateFilters(i))}),a()(),m(30,"app-options-list",29),O("optionsChange",function(i){h(e);let s=F();return D(s.settings,i)||(s.settings=i),S(i)}),a(),m(31,"div",30)(32,"button",31),I("click",function(){h(e);let i=F();return S(i.submit())}),_(33,7),r(34,"sh-icon"),p(),a()()}if(c&2){let e=F();C("formGroup",e.baseCmdForm),d(),C("options",e.commandOptions()??V(11,he))("inlineSearch",!0),d(17),C("formGroup",e.standardFields),d(11),M("filters",e.filters),C("osType",e.osType()??""),d(),M("options",e.settings),C("hasFreeTextSettings",!0),d(2),v("loading",e.isSubmitting()),d(2),U(e.baseCmdForm.value.command),x(33)}}var l=new Z,P=class c{#e=u(b);#n=u(me);#o=u(J);#t=u(K);#a=u(ce);#s=u(_e);#i=u(f);#r=u(ue);osType=q(()=>this.#r.systemInfo()?.OSType);#l=A(this.#t.params);commandOptions=A(this.#a.getApiV1Commandline());isSubmitting=E(!1);optionsFields=this.#e.optionsFields;standardFields=l.group({"backup-id":l.control(""),"backup-name":l.control(""),dbpath:l.control(""),filters:l.array([])});baseCmdForm=l.group({command:l.control("backup"),targetUrl:l.control(""),arguments:l.control("")});finishedLoading=this.#e.finishedLoading;backupId=this.#e.backupId;filters=E([]);settings=this.#e.settings;updateFilters(t){this.standardFields.controls.filters.clear(),t.forEach(e=>this.standardFields.controls.filters.push(l.control(e))),this.filters.set(t)}#m=$(()=>{let t=this.#l()?.id;this.#e.backupId.set(t),this.getBackup(t)});getBackup(t){this.#n.getApiV1BackupById({id:t}).subscribe({next:e=>{this.#e.mapScheduleToForm(e.Schedule??null),e.Backup&&(this.#e.mapGeneralToForm(e.Backup),this.mapStandardFieldsToForm(e.Backup),this.mapBaseCmdToForm(e.Backup),this.#e.mapOptionsToForms(e.Backup,!0)),this.applyStateFromUrl(),this.#e.finishedLoading.set(!0)}})}mapStandardFieldsToForm(t){if(this.standardFields.patchValue({dbpath:t.DBPath,"backup-id":t.ID,"backup-name":t.Name}),this.standardFields.controls.filters.clear(),t.Filters&&t.Filters.length){let e=t.Filters.map(n=>`${n.Include?"":"-"}${n.Expression}`);e.forEach(n=>{this.standardFields.controls.filters.push(l.control(n))}),this.filters.set(e)}else this.filters.set([])}submit(){this.#s.resumeDialogCheck(()=>this.#c())}#c(){this.isSubmitting.set(!0);let t=this.updateUrl(),e=this.baseCmdForm.value,n=e.targetUrl??"",i=(e.arguments??"").split(`
2
+ `)??[],s=[n,...i].filter(o=>o.length>0),g=this.standardFields.value,T=g.filters??[],N=[e.command,...s,`--backup-name=${g["backup-name"]}`,`--dbpath=${g.dbpath}`,`--backup-id=${g["backup-id"]}`,...T.filter(o=>o).map(o=>o.startsWith("-")?`--exclude=${o?.slice(1)}`:`--include=${o}`),...this.#e.mapFormsToSettings(["backup-id","backup-name","dbpath"]).map(o=>`${o.Name.startsWith("--")?"":"--"}${o.Name}=${o.Value}`),"--disable-module=console-password-input"];this.#n.postApiV1Commandline({requestBody:N}).subscribe({next:o=>{o.Status==="OK"&&this.#o.navigate(["backup",this.backupId(),"commandline",o.ID],{queryParams:{state:t}})},error:()=>{this.isSubmitting.set(!1)}})}mapBaseCmdToForm(t){let e=t.TargetURL??null;e&&this.baseCmdForm.patchValue({targetUrl:e??"",arguments:t.Sources?.join(`
3
+ `)??""})}updateUrl(){let t=this.baseCmdForm.value,e=this.standardFields.value,n=e.filters??[],i=this.settings(),s=this.#i.saveState({command:t.command,targetUrl:t.targetUrl,arguments:t.arguments,backupId:e["backup-id"],backupName:e["backup-name"],dbpath:e.dbpath,filters:n,options:i});return this.#o.navigate([],{relativeTo:this.#t,queryParams:{state:s},replaceUrl:!0}),s}applyStateFromUrl(){let e=this.#t.snapshot.queryParams.state;if(!e)return;let n=this.#i.getState(e);n&&(this.baseCmdForm.patchValue({command:n.command,targetUrl:n.targetUrl,arguments:n.arguments}),this.standardFields.patchValue({"backup-id":n.backupId,"backup-name":n.backupName,dbpath:n.dbpath}),n.filters&&(this.standardFields.controls.filters.clear(),n.filters.forEach(i=>{this.standardFields.controls.filters.push(l.control(i))}),this.filters.set(n.filters)),n.options&&n.options.length>0&&this.settings.set(n.options))}static \u0275fac=function(e){return new(e||c)};static \u0275cmp=R({type:c,selectors:[["app-commandline"]],features:[w([b])],decls:8,vars:1,consts:()=>{let t;t=$localize`${"\uFFFD#5\uFFFD"}:START_TAG_SH_ICON:arrow-left${"\uFFFD/#5\uFFFD"}:CLOSE_TAG_SH_ICON: Back `;let e;e=$localize` Command ${"\uFFFD#4\uFFFD"}:START_TAG_SH_ICON:question${"\uFFFD/#4\uFFFD"}:CLOSE_TAG_SH_ICON:`;let n;n=$localize` TargetUrl ${"\uFFFD#9\uFFFD"}:START_TAG_SH_ICON:question${"\uFFFD/#9\uFFFD"}:CLOSE_TAG_SH_ICON:`;let i;i=$localize` Commandline Arguments ${"\uFFFD#14\uFFFD"}:START_TAG_SH_ICON:question${"\uFFFD/#14\uFFFD"}:CLOSE_TAG_SH_ICON:`;let s;s=$localize`Advanced options`;let g;g=$localize` Backup ID ${"\uFFFD#22\uFFFD"}:START_TAG_SH_ICON:question${"\uFFFD/#22\uFFFD"}:CLOSE_TAG_SH_ICON:`;let T;T=$localize` Backup Name ${"\uFFFD#27\uFFFD"}:START_TAG_SH_ICON:question${"\uFFFD/#27\uFFFD"}:CLOSE_TAG_SH_ICON:`;let N;return N=$localize`${"\uFFFD#34\uFFFD"}:START_TAG_SH_ICON:arrow-right${"\uFFFD/#34\uFFFD"}:CLOSE_TAG_SH_ICON: Run "${"\uFFFD0\uFFFD"}:INTERPOLATION:" command now `,[t,e,n,i,s,g,T,N,[1,"back"],["type","button","shButton","","routerLink","/",1,"small"],[1,"indeterminate","primary"],[3,"formGroup"],["placeholder","Select a command...",3,"options","inlineSearch"],["for","command"],["shTooltip","Choose the command to execute"],["type","text","id","command","formControlName","command"],["for","targetUrl"],["shTooltip","Enter the URL of the backup target"],["id","targetUrl","autocomplete","off","formControlName","targetUrl"],["for","arguments"],["shTooltip","Enter one argument per line without quotes (e.g., *.txt)"],["id","arguments","autocomplete","off","rows","5","formControlName","arguments","placeholder","Enter one argument per line without quotes (e.g., *.txt)",1,"arguments"],["for","backup-id"],["shTooltip","The ID of the backup configuration this run belongs to (can be empty)"],["id","backup-id","formControlName","backup-id"],["for","backup-name"],["shTooltip","The optional name of the backup"],["id","backup-name","formControlName","backup-name"],[3,"filtersChange","filters","osType"],[3,"optionsChange","options","hasFreeTextSettings"],[1,"form-actions"],["shButton","",1,"raised","primary",3,"click"]]},template:function(e,n){e&1&&(r(0,"app-status-bar"),m(1,"section")(2,"div",8)(3,"button",9),_(4,0),r(5,"sh-icon"),p(),a()(),y(6,Se,1,0,"sh-progress-bar",10)(7,Te,35,12),a()),e&2&&(d(6),k(n.finishedLoading()?7:6))},dependencies:[ee,j,H,z,W,pe,Ce,ge,te,Y,Q,X,ae,oe,ie,re,se,ne,le],styles:["[_nghost-%COMP%]{display:block}section[_ngcontent-%COMP%]{display:flex;flex-direction:column;width:100%;max-width:40rem;padding:2.5rem;gap:1.25rem}form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.form-actions[_ngcontent-%COMP%]{display:flex;justify-content:flex-end}.row-inputs[_ngcontent-%COMP%]{display:flex;align-items:flex-end;gap:.5rem}.row-inputs[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{flex:1 0}.arguments[_ngcontent-%COMP%]{min-height:6rem;white-space:pre}"],changeDetection:0})};export{P as default};
package/index.html CHANGED
@@ -124,5 +124,5 @@
124
124
  <body>
125
125
  <app-root></app-root>
126
126
  <div class="loading">Connecting ...</div>
127
- <link rel="modulepreload" href="chunk-23SRH7FI.js"><link rel="modulepreload" href="chunk-EXMYBMGI.js"><link rel="modulepreload" href="chunk-EKVZKEQJ.js"><link rel="modulepreload" href="chunk-RJ2JM7C7.js"><link rel="modulepreload" href="chunk-WOKYULBU.js"><link rel="modulepreload" href="chunk-TCXCC5BM.js"><link rel="modulepreload" href="chunk-GKGMP6VF.js"><link rel="modulepreload" href="chunk-6Q6SSTBK.js"><link rel="modulepreload" href="chunk-YCJYEQF7.js"><link rel="modulepreload" href="chunk-IMQUTGIK.js"><script src="polyfills-7RKI4BGK.js" type="module"></script><script src="main-JR6IVB6K.js" type="module"></script></body>
127
+ <link rel="modulepreload" href="chunk-23SRH7FI.js"><link rel="modulepreload" href="chunk-EXMYBMGI.js"><link rel="modulepreload" href="chunk-EKVZKEQJ.js"><link rel="modulepreload" href="chunk-RJ2JM7C7.js"><link rel="modulepreload" href="chunk-WOKYULBU.js"><link rel="modulepreload" href="chunk-TCXCC5BM.js"><link rel="modulepreload" href="chunk-GKGMP6VF.js"><link rel="modulepreload" href="chunk-6Q6SSTBK.js"><link rel="modulepreload" href="chunk-YCJYEQF7.js"><link rel="modulepreload" href="chunk-IMQUTGIK.js"><script src="polyfills-7RKI4BGK.js" type="module"></script><script src="main-7J2QXC6H.js" type="module"></script></body>
128
128
  </html>
@@ -1 +1 @@
1
- import{b as Ie,c as ke}from"./chunk-23SRH7FI.js";import{a as we}from"./chunk-EXMYBMGI.js";import{a as Ee}from"./chunk-EKVZKEQJ.js";import{b as I}from"./chunk-RJ2JM7C7.js";import"./chunk-WOKYULBU.js";import{a as Me}from"./chunk-TCXCC5BM.js";import{b as Te}from"./chunk-GKGMP6VF.js";import{a as V}from"./chunk-6Q6SSTBK.js";import{a as Se}from"./chunk-YCJYEQF7.js";import"./chunk-IMQUTGIK.js";import"./chunk-ANSV4G2K.js";import"./chunk-AIAUP7OE.js";import{a as H}from"./chunk-C6PICAXB.js";import{a as h,b as ye,c as v,d as Re,e as E}from"./chunk-6JS7B4FW.js";import{u as be,x as Ce}from"./chunk-VKQQDCUN.js";import{a as ge,e as ve}from"./chunk-DSYNIXJF.js";import{c as le,d as me,g as de,h as ue,i as he,j as fe}from"./chunk-NPFPMA4P.js";import{a as ne}from"./chunk-O2SMJYPC.js";import{a as re,b as se,c as ie,e as ae,f as pe,g as ce}from"./chunk-N2AU7VKX.js";import{ha as te,ma as oe}from"./chunk-ZC23RK4J.js";import"./chunk-OPHQNXYO.js";import{A as B,F as J,Fb as Y,L as T,Lc as Z,Mc as ee,N as K,V as C,Y as _,_ as s,f as F,g as W,gb as Q,ha as q,ia as z,l as $,m as G,pa as d,q as w,ra as X,z as P}from"./chunk-TQTOIWBK.js";import"./chunk-7CGTOI24.js";var k=class e{#e=s(h);#d=s(v);ngOnInit(){ye(),this.#d.fetchConfig(),this.#e.clearAllNotCurrentVersion()}static \u0275fac=function(t){return new(t||e)};static \u0275cmp=Q({type:e,selectors:[["app-root"]],decls:1,vars:0,template:function(t,n){t&1&&Y(0,"router-outlet")},dependencies:[le],encapsulation:2})};var Ae={production:!0,baseUrl:"/api",machineServerUrl:"${WS_URL}",defaultTimeout:3e4};var f=new _("ENVIRONMENT");var A=class e{#e=s(ve);isLoaded=d(!1);webmodules=d(null);preload(o=!1){let t=this.#e.getApiV1Webmodules().pipe(K(n=>this.webmodules.set(n)),J(()=>this.isLoaded.set(!0)));if(o)return t;t.subscribe()}static \u0275fac=function(t){return new(t||e)};static \u0275prov=C({token:e,factory:e.\u0275fac,providedIn:"root"})};var Ue=()=>{let e=s(E);return e.token()?!0:e.checkProxyAuthed().pipe(T(o=>o?$(!0):e.refreshToken().pipe(w(()=>!0))))},je=()=>{let e=s(v),o=s(I),t=s(q),n=e.relayIsEnabled()?"longpoll":"websocket",i=[t.get(H).preload(!0),t.get(H).preloadFilterGroups(!0),t.get(A).preload(!0)];return e.configLoaded===null?P(i).pipe(w(()=>n)):e.configLoaded?.pipe(T(()=>P(i)))},Fe=()=>!0,Ne={path:"connect/:typeParam",loadComponent:()=>import("./chunk-BZXBH4CN.js")},We=()=>{let e=s(h);return!e.getItem("locale")&&navigator.language&&e.setItem("locale",navigator.language),!0},Oe=[{path:"",children:[{path:"login",canActivate:[],loadComponent:()=>import("./chunk-4E7D5F6K.js")},{path:"logout",loadComponent:()=>import("./chunk-FBU3EBFO.js")},{path:"",canActivate:[Ue],children:[{path:"",canActivate:[je,Fe,We],children:[{path:"welcome",loadComponent:()=>import("./chunk-JPCUISZG.js"),children:[{path:"",redirectTo:"select",pathMatch:"full"},{path:"select",loadComponent:()=>import("./chunk-X276XFCH.js")},Ne]},{path:"",loadComponent:()=>import("./chunk-5RNU5BNO.js"),children:[{path:"",loadComponent:()=>import("./chunk-QOWXL7ZL.js")},Ne,{path:"destinations",loadComponent:()=>import("./chunk-RRDLQLTM.js")},{path:"add-backup",loadComponent:()=>import("./chunk-EDLHTWBA.js")},{path:"backup/:id/export",loadComponent:()=>import("./chunk-KDV2OE64.js")},{path:"backup/import",loadComponent:()=>import("./chunk-NX35OQ3V.js")},{path:"backup-draft/:id",loadComponent:()=>import("./chunk-EPIYGHPM.js"),loadChildren:()=>import("./chunk-DSZ644JT.js")},{path:"backup/:id",loadComponent:()=>import("./chunk-EPIYGHPM.js"),loadChildren:()=>import("./chunk-DSZ644JT.js")},{path:"backup/:id/log",loadComponent:()=>import("./chunk-ZP3QZ43W.js")},{path:"backup/:id/database",loadComponent:()=>import("./chunk-RLWICOKH.js")},{path:"backup/:id/commandline",loadComponent:()=>import("./chunk-X4BDJA6L.js")},{path:"backup/:id/commandline/:runId",loadComponent:()=>import("./chunk-ZYRB2TUK.js")},{path:"backup/:id/delete",loadComponent:()=>import("./chunk-2J2554EV.js")},{path:"restore",children:[{path:"",loadComponent:()=>import("./chunk-PXI3UZ4R.js")},{path:"from-config",loadComponent:()=>import("./chunk-IG7XUEED.js")}]},{path:"restore-from-files",loadComponent:()=>import("./chunk-GN7AO4B6.js"),loadChildren:()=>import("./chunk-N3NJW75G.js")},{path:"restore-draft/:id",loadComponent:()=>import("./chunk-GN7AO4B6.js"),loadChildren:()=>import("./chunk-N3NJW75G.js")},{path:"restore/:id",loadComponent:()=>import("./chunk-GN7AO4B6.js"),loadChildren:()=>import("./chunk-N3NJW75G.js")},{path:"status",loadComponent:()=>import("./chunk-4OJPTRZJ.js")},{path:"settings",loadComponent:()=>import("./chunk-NKUA7I47.js")},{path:"about",loadComponent:()=>import("./chunk-22AR7ES3.js"),children:[{path:"",redirectTo:"general",pathMatch:"full"},{path:"general",loadComponent:()=>import("./chunk-P4R3ERID.js")},{path:"changelog",loadComponent:()=>import("./chunk-FD5CKX3J.js")},{path:"libraries",loadComponent:()=>import("./chunk-ACTJSKQZ.js")},{path:"system-info",loadComponent:()=>import("./chunk-37ODVJFS.js")},{path:"server-settings",loadComponent:()=>import("./chunk-NHS6CQO2.js")},{path:"logs",loadChildren:()=>import("./chunk-YWBZLU6M.js")},{path:"crashlogs",loadComponent:()=>import("./chunk-BKEJZADV.js")}]}]}]}]}]}];var xe=(e,o)=>{let t=s(E),n=s(me),i=s(h),p=s(f),m=i.getItem("locale"),a=s(Ce),g=Ie(m),r=ge.BASE||"",c=e.url===`${r}/api/v1/auth/login`,u=e.url===`${r}/api/v1/auth/logout`,S=e.url===`${r}/api/v1/auth/refresh`,y=e.url===`${r}/api/v1/progressstate`,x=e.url===`${r}/api/v1/remoteoperation/test`,M=e.url===`${r}/api/v1/filesystem/validate`,De=e.url.startsWith(`${r}/api/v2/`),L=t.token(),U=e,j=e.headers.has("custom-proxy-check")||L===Re;if(L&&e.url.startsWith(r+p.baseUrl)&&!j){let l=e.headers.set("Authorization",`Bearer ${L}`);m&&m!=="en-US"&&(l=l.set("X-Ui-Language",g)),U=e.clone({headers:l})}return o(U).pipe(w(l=>{if(l.type===4&&l.status===200&&De){let b=l.body;if(b?.Success===!1)throw{status:200,message:b?.Error??"Unknown error",error:{Error:b?.Error??"Unknown error"},requestBody:b}}return l}),B(l=>{let b=l.error?.Error||`Error Code: ${l.status}, Message: ${l.message}`;if(!j){let R=!0;if((y&&l.status===404||x||M)&&(R=!1),S&&l.status===401&&(R=!1,t.logout(),n.navigate(["/logout"])),!c&&!S&&!u&&l.status===401)return R=!1,t.refreshToken().pipe(T(()=>o(e.clone({headers:e.headers.set("Authorization",`Bearer ${t.token()}`)}))));R&&a.error(b)}return G(()=>({error:l,message:b}))}))};var N=class e{#e=s(z);showError(o){let t=this.#e.querySelector("body > .loading");if(!t)return;t.classList.add("has-error"),t.innerHTML="";let n=this.#e.createElement("div");n.classList.add("loading-title"),n.textContent="Unable to connect";let i=this.#e.createElement("div");i.classList.add("loading-error"),i.textContent=o||"Unknown error";let p=this.#e.createElement("button");p.type="button",p.classList.add("retry-button"),p.textContent="Retry",p.addEventListener("click",()=>{this.#e.defaultView?.location.reload()}),t.append(n,i,p)}static \u0275fac=function(t){return new(t||e)};static \u0275prov=C({token:e,factory:e.\u0275fac,providedIn:"root"})};var $e="1.0.0",Le=`portal-proxy-client-${V()}`,Ge=1,O=class e{#e=1e3;#d=s(f);#u=s(N);#o=d("disconnected");#h=d(this.#e);#a=d(!1);#n=d(!1);#p=d(null);#c=d(null);#s=!1;isConnectedToMachineServer=this.#n.asReadonly();wsState=this.#o.asReadonly();#l=[];#r={};#t=null;#f=new TextDecoder("utf-8");#m=null;#y=X(()=>{let o=this.#a(),t=this.#h(),n=this.#p(),i=this.#c();if(!n||!i||!o||!t||t<this.#e){this.#m&&window.clearInterval(this.#m);return}this.#m=window.setInterval(()=>{this.connectToMachineServer(n,i)},t)});#i(o){this.#s||(this.#s=!0,this.#u.showError(o||"Unable to connect to the server."))}#g(){this.#s||(this.#s=!0)}utf8Atob(o){let t=Uint8Array.from(atob(o),i=>i.charCodeAt(0)),n=this.#f.decode(t);return n?JSON.parse(n):null}connectToMachineServer(o,t,n){let i=n?.reconnect??!1,p=this.wsState();(p==="disconnected"||p==="error"||i)&&(this.#t?.close(),this.#t=null),!this.#t&&(this.#s=!1,this.#t=new WebSocket(t),this.#o.set("connecting"),this.#t.onopen=()=>{this.#o.set("connect"),this.#n.set(!0),this.#a.set(!1),this.#p.set(null),this.#c.set(null)},this.#t.onclose=()=>{this.#o.set("disconnected"),this.#n.set(!1),this.#p.set(o),this.#c.set(t),this.#a.set(!0)},this.#t.onerror=()=>{this.#o.set("error")},this.#t.onmessage=m=>{let a=JSON.parse(m.data);if(this.wsState()==="connect"){if(a.type!=="welcome"){this.disconnectFromMachineServer(`Unexpected message type, expected 'welcome' but got '${a.type}'`);return}let r={token:o,publicKey:"",clientVersion:$e,protocolVersion:Ge},c=this.createResponse(a,"authportal",r);this.#o.set("welcome"),this.#t?.send(c)}else if(this.wsState()==="welcome"){if(a.type!=="authportal"){this.disconnectFromMachineServer(`Unexpected message type, expected 'authportal' but got '${a.type}'`);return}var g=JSON.parse(a.payload??"");if(g.accepted===!1){this.#i("Authentication failed"),this.disconnectFromMachineServer("Authentication failed");return}for(this.#o.set("authenticated"),this.#n.set(!0);this.#l.length>0;){let r=this.#l.pop();r&&this.#r[r.messageId]&&this.activateCommand(r)}}else if(this.wsState()==="authenticated"){if(a.type!=="command"){console.warn(`Unexpected message type, expected 'command' but got '${a.type}'`);return}let r=this.#r[a.messageId];if(r){if(a.errorMessage)this.#i(a.errorMessage),r.reject(a.errorMessage);else{let c=JSON.parse(a.payload??"");c.statusCode>=400?this.#i(c.body||`Initial request failed with status code ${c.statusCode}`):this.#g(),c.body=c?.body==null?null:this.utf8Atob(c.body),r.resolve(c)}delete this.#r[a.messageId],window.clearTimeout(r.timer)}}})}disconnectFromMachineServer(o=null){o&&console.error(o),this.#t?.close(),this.#t=null,this.#o.set("disconnected"),this.#n.set(!1)}createResponse(o,t,n){let i={from:Le,to:o.from,type:t,messageId:o.messageId,payload:JSON.stringify(n)};return JSON.stringify(i)}sendCommand(o,t,n,i,p,m,a,g=5e3){return(this.wsState()==="disconnected"||this.wsState()==="error")&&this.connectToMachineServer(o,n),new Promise((r,c)=>{let u=V(),y={from:Le,to:t,type:"command",messageId:u,payload:JSON.stringify({method:i,path:p,body:m,headers:a})},x={resolve:r,reject:c,timer:window.setTimeout(()=>{let M=this.#r[u];M&&(delete this.#r[u],this.#i("The request timed out before receiving a response."),M.reject("Timeout"))},g)};this.#r[u]=x,this.#n()?this.activateCommand(y):this.#l.push(y)})}activateCommand(o){this.#t?.send(JSON.stringify(o))}static \u0275fac=function(t){return new(t||e)};static \u0275prov=C({token:e,factory:e.\u0275fac,providedIn:"root"})};function Be(e){if(typeof e!="string")return null;let t=new TextEncoder().encode(e);return window.btoa(String.fromCharCode(...t))}function Pe(e,o,t){let n=e.relayconfigState.config();if(n===null)return t(o);let i=Be(o.body),p={};o.headers.keys().forEach(r=>{p[r]=o.headers.get(r)??""});let m=o.headers.get("timeout"),a=m!==null?parseInt(m):e.defaultTimeout;o.url.startsWith("/api/v1/serverstate")&&o.url.includes("longpoll=true")&&(a=1e3*99);let g=e.relayWebsocket.sendCommand(n.accessToken,n.clientId,n.machineServerUrl,o.method,o.url,i,p,a);return new F(r=>{g.then(c=>{let u=new re;p!=null&&Object.keys(p).forEach(y=>{u.set(y,p[y])});let S=new se({body:c.body,status:c.statusCode,statusText:"OK",headers:u});r.next(S),r.complete()}).catch(c=>{r.error(new ie({error:c??"Unknown error",status:0,statusText:c??"Unknown error"}))})})}var He=(e,o)=>{let t={relayconfigState:s(v),defaultTimeout:s(f).defaultTimeout,relayWebsocket:s(O)},n=t.relayconfigState.config();if(t.relayconfigState.configLoaded!==null&&n===null){let i=new W;return t.relayconfigState.configLoaded.subscribe(p=>{p&&Pe(t,e,o).subscribe(i)}),i}return Pe(t,e,o)};var Ve={providers:[Z(),ue(Oe,fe(),he(de)),ae(ce(),pe([He,xe])),h,{provide:f,useValue:Ae},{provide:ee,useValue:ke()},{provide:be,useValue:{alertVariant:"simple"}},we,I,Te,oe,Se,te,Me,Ee]};ne(k,Ve);
1
+ import{b as Ie,c as ke}from"./chunk-23SRH7FI.js";import{a as we}from"./chunk-EXMYBMGI.js";import{a as Ee}from"./chunk-EKVZKEQJ.js";import{b as I}from"./chunk-RJ2JM7C7.js";import"./chunk-WOKYULBU.js";import{a as Me}from"./chunk-TCXCC5BM.js";import{b as Te}from"./chunk-GKGMP6VF.js";import{a as V}from"./chunk-6Q6SSTBK.js";import{a as Se}from"./chunk-YCJYEQF7.js";import"./chunk-IMQUTGIK.js";import"./chunk-ANSV4G2K.js";import"./chunk-AIAUP7OE.js";import{a as H}from"./chunk-C6PICAXB.js";import{a as h,b as ye,c as v,d as Re,e as E}from"./chunk-6JS7B4FW.js";import{u as be,x as Ce}from"./chunk-VKQQDCUN.js";import{a as ge,e as ve}from"./chunk-DSYNIXJF.js";import{c as le,d as me,g as de,h as ue,i as he,j as fe}from"./chunk-NPFPMA4P.js";import{a as ne}from"./chunk-O2SMJYPC.js";import{a as re,b as se,c as ie,e as ae,f as pe,g as ce}from"./chunk-N2AU7VKX.js";import{ha as te,ma as oe}from"./chunk-ZC23RK4J.js";import"./chunk-OPHQNXYO.js";import{A as B,F as J,Fb as Y,L as T,Lc as Z,Mc as ee,N as K,V as C,Y as _,_ as s,f as F,g as W,gb as Q,ha as q,ia as z,l as $,m as G,pa as d,q as w,ra as X,z as P}from"./chunk-TQTOIWBK.js";import"./chunk-7CGTOI24.js";var k=class e{#e=s(h);#d=s(v);ngOnInit(){ye(),this.#d.fetchConfig(),this.#e.clearAllNotCurrentVersion()}static \u0275fac=function(t){return new(t||e)};static \u0275cmp=Q({type:e,selectors:[["app-root"]],decls:1,vars:0,template:function(t,n){t&1&&Y(0,"router-outlet")},dependencies:[le],encapsulation:2})};var Ae={production:!0,baseUrl:"/api",machineServerUrl:"${WS_URL}",defaultTimeout:3e4};var f=new _("ENVIRONMENT");var A=class e{#e=s(ve);isLoaded=d(!1);webmodules=d(null);preload(o=!1){let t=this.#e.getApiV1Webmodules().pipe(K(n=>this.webmodules.set(n)),J(()=>this.isLoaded.set(!0)));if(o)return t;t.subscribe()}static \u0275fac=function(t){return new(t||e)};static \u0275prov=C({token:e,factory:e.\u0275fac,providedIn:"root"})};var Ue=()=>{let e=s(E);return e.token()?!0:e.checkProxyAuthed().pipe(T(o=>o?$(!0):e.refreshToken().pipe(w(()=>!0))))},je=()=>{let e=s(v),o=s(I),t=s(q),n=e.relayIsEnabled()?"longpoll":"websocket",i=[t.get(H).preload(!0),t.get(H).preloadFilterGroups(!0),t.get(A).preload(!0)];return e.configLoaded===null?P(i).pipe(w(()=>n)):e.configLoaded?.pipe(T(()=>P(i)))},Fe=()=>!0,Ne={path:"connect/:typeParam",loadComponent:()=>import("./chunk-BZXBH4CN.js")},We=()=>{let e=s(h);return!e.getItem("locale")&&navigator.language&&e.setItem("locale",navigator.language),!0},Oe=[{path:"",children:[{path:"login",canActivate:[],loadComponent:()=>import("./chunk-4E7D5F6K.js")},{path:"logout",loadComponent:()=>import("./chunk-FBU3EBFO.js")},{path:"",canActivate:[Ue],children:[{path:"",canActivate:[je,Fe,We],children:[{path:"welcome",loadComponent:()=>import("./chunk-JPCUISZG.js"),children:[{path:"",redirectTo:"select",pathMatch:"full"},{path:"select",loadComponent:()=>import("./chunk-X276XFCH.js")},Ne]},{path:"",loadComponent:()=>import("./chunk-5RNU5BNO.js"),children:[{path:"",loadComponent:()=>import("./chunk-QOWXL7ZL.js")},Ne,{path:"destinations",loadComponent:()=>import("./chunk-RRDLQLTM.js")},{path:"add-backup",loadComponent:()=>import("./chunk-EDLHTWBA.js")},{path:"backup/:id/export",loadComponent:()=>import("./chunk-KDV2OE64.js")},{path:"backup/import",loadComponent:()=>import("./chunk-NX35OQ3V.js")},{path:"backup-draft/:id",loadComponent:()=>import("./chunk-EPIYGHPM.js"),loadChildren:()=>import("./chunk-DSZ644JT.js")},{path:"backup/:id",loadComponent:()=>import("./chunk-EPIYGHPM.js"),loadChildren:()=>import("./chunk-DSZ644JT.js")},{path:"backup/:id/log",loadComponent:()=>import("./chunk-ZP3QZ43W.js")},{path:"backup/:id/database",loadComponent:()=>import("./chunk-RLWICOKH.js")},{path:"backup/:id/commandline",loadComponent:()=>import("./chunk-UCHK3SHH.js")},{path:"backup/:id/commandline/:runId",loadComponent:()=>import("./chunk-ZYRB2TUK.js")},{path:"backup/:id/delete",loadComponent:()=>import("./chunk-2J2554EV.js")},{path:"restore",children:[{path:"",loadComponent:()=>import("./chunk-PXI3UZ4R.js")},{path:"from-config",loadComponent:()=>import("./chunk-IG7XUEED.js")}]},{path:"restore-from-files",loadComponent:()=>import("./chunk-GN7AO4B6.js"),loadChildren:()=>import("./chunk-N3NJW75G.js")},{path:"restore-draft/:id",loadComponent:()=>import("./chunk-GN7AO4B6.js"),loadChildren:()=>import("./chunk-N3NJW75G.js")},{path:"restore/:id",loadComponent:()=>import("./chunk-GN7AO4B6.js"),loadChildren:()=>import("./chunk-N3NJW75G.js")},{path:"status",loadComponent:()=>import("./chunk-4OJPTRZJ.js")},{path:"settings",loadComponent:()=>import("./chunk-NKUA7I47.js")},{path:"about",loadComponent:()=>import("./chunk-22AR7ES3.js"),children:[{path:"",redirectTo:"general",pathMatch:"full"},{path:"general",loadComponent:()=>import("./chunk-P4R3ERID.js")},{path:"changelog",loadComponent:()=>import("./chunk-FD5CKX3J.js")},{path:"libraries",loadComponent:()=>import("./chunk-ACTJSKQZ.js")},{path:"system-info",loadComponent:()=>import("./chunk-37ODVJFS.js")},{path:"server-settings",loadComponent:()=>import("./chunk-NHS6CQO2.js")},{path:"logs",loadChildren:()=>import("./chunk-YWBZLU6M.js")},{path:"crashlogs",loadComponent:()=>import("./chunk-BKEJZADV.js")}]}]}]}]}]}];var xe=(e,o)=>{let t=s(E),n=s(me),i=s(h),p=s(f),m=i.getItem("locale"),a=s(Ce),g=Ie(m),r=ge.BASE||"",c=e.url===`${r}/api/v1/auth/login`,u=e.url===`${r}/api/v1/auth/logout`,S=e.url===`${r}/api/v1/auth/refresh`,y=e.url===`${r}/api/v1/progressstate`,x=e.url===`${r}/api/v1/remoteoperation/test`,M=e.url===`${r}/api/v1/filesystem/validate`,De=e.url.startsWith(`${r}/api/v2/`),L=t.token(),U=e,j=e.headers.has("custom-proxy-check")||L===Re;if(L&&e.url.startsWith(r+p.baseUrl)&&!j){let l=e.headers.set("Authorization",`Bearer ${L}`);m&&m!=="en-US"&&(l=l.set("X-Ui-Language",g)),U=e.clone({headers:l})}return o(U).pipe(w(l=>{if(l.type===4&&l.status===200&&De){let b=l.body;if(b?.Success===!1)throw{status:200,message:b?.Error??"Unknown error",error:{Error:b?.Error??"Unknown error"},requestBody:b}}return l}),B(l=>{let b=l.error?.Error||`Error Code: ${l.status}, Message: ${l.message}`;if(!j){let R=!0;if((y&&l.status===404||x||M)&&(R=!1),S&&l.status===401&&(R=!1,t.logout(),n.navigate(["/logout"])),!c&&!S&&!u&&l.status===401)return R=!1,t.refreshToken().pipe(T(()=>o(e.clone({headers:e.headers.set("Authorization",`Bearer ${t.token()}`)}))));R&&a.error(b)}return G(()=>({error:l,message:b}))}))};var N=class e{#e=s(z);showError(o){let t=this.#e.querySelector("body > .loading");if(!t)return;t.classList.add("has-error"),t.innerHTML="";let n=this.#e.createElement("div");n.classList.add("loading-title"),n.textContent="Unable to connect";let i=this.#e.createElement("div");i.classList.add("loading-error"),i.textContent=o||"Unknown error";let p=this.#e.createElement("button");p.type="button",p.classList.add("retry-button"),p.textContent="Retry",p.addEventListener("click",()=>{this.#e.defaultView?.location.reload()}),t.append(n,i,p)}static \u0275fac=function(t){return new(t||e)};static \u0275prov=C({token:e,factory:e.\u0275fac,providedIn:"root"})};var $e="1.0.0",Le=`portal-proxy-client-${V()}`,Ge=1,O=class e{#e=1e3;#d=s(f);#u=s(N);#o=d("disconnected");#h=d(this.#e);#a=d(!1);#n=d(!1);#p=d(null);#c=d(null);#s=!1;isConnectedToMachineServer=this.#n.asReadonly();wsState=this.#o.asReadonly();#l=[];#r={};#t=null;#f=new TextDecoder("utf-8");#m=null;#y=X(()=>{let o=this.#a(),t=this.#h(),n=this.#p(),i=this.#c();if(!n||!i||!o||!t||t<this.#e){this.#m&&window.clearInterval(this.#m);return}this.#m=window.setInterval(()=>{this.connectToMachineServer(n,i)},t)});#i(o){this.#s||(this.#s=!0,this.#u.showError(o||"Unable to connect to the server."))}#g(){this.#s||(this.#s=!0)}utf8Atob(o){let t=Uint8Array.from(atob(o),i=>i.charCodeAt(0)),n=this.#f.decode(t);return n?JSON.parse(n):null}connectToMachineServer(o,t,n){let i=n?.reconnect??!1,p=this.wsState();(p==="disconnected"||p==="error"||i)&&(this.#t?.close(),this.#t=null),!this.#t&&(this.#s=!1,this.#t=new WebSocket(t),this.#o.set("connecting"),this.#t.onopen=()=>{this.#o.set("connect"),this.#n.set(!0),this.#a.set(!1),this.#p.set(null),this.#c.set(null)},this.#t.onclose=()=>{this.#o.set("disconnected"),this.#n.set(!1),this.#p.set(o),this.#c.set(t),this.#a.set(!0)},this.#t.onerror=()=>{this.#o.set("error")},this.#t.onmessage=m=>{let a=JSON.parse(m.data);if(this.wsState()==="connect"){if(a.type!=="welcome"){this.disconnectFromMachineServer(`Unexpected message type, expected 'welcome' but got '${a.type}'`);return}let r={token:o,publicKey:"",clientVersion:$e,protocolVersion:Ge},c=this.createResponse(a,"authportal",r);this.#o.set("welcome"),this.#t?.send(c)}else if(this.wsState()==="welcome"){if(a.type!=="authportal"){this.disconnectFromMachineServer(`Unexpected message type, expected 'authportal' but got '${a.type}'`);return}var g=JSON.parse(a.payload??"");if(g.accepted===!1){this.#i("Authentication failed"),this.disconnectFromMachineServer("Authentication failed");return}for(this.#o.set("authenticated"),this.#n.set(!0);this.#l.length>0;){let r=this.#l.pop();r&&this.#r[r.messageId]&&this.activateCommand(r)}}else if(this.wsState()==="authenticated"){if(a.type!=="command"){console.warn(`Unexpected message type, expected 'command' but got '${a.type}'`);return}let r=this.#r[a.messageId];if(r){if(a.errorMessage)this.#i(a.errorMessage),r.reject(a.errorMessage);else{let c=JSON.parse(a.payload??"");c.statusCode>=400?this.#i(c.body||`Initial request failed with status code ${c.statusCode}`):this.#g(),c.body=c?.body==null?null:this.utf8Atob(c.body),r.resolve(c)}delete this.#r[a.messageId],window.clearTimeout(r.timer)}}})}disconnectFromMachineServer(o=null){o&&console.error(o),this.#t?.close(),this.#t=null,this.#o.set("disconnected"),this.#n.set(!1)}createResponse(o,t,n){let i={from:Le,to:o.from,type:t,messageId:o.messageId,payload:JSON.stringify(n)};return JSON.stringify(i)}sendCommand(o,t,n,i,p,m,a,g=5e3){return(this.wsState()==="disconnected"||this.wsState()==="error")&&this.connectToMachineServer(o,n),new Promise((r,c)=>{let u=V(),y={from:Le,to:t,type:"command",messageId:u,payload:JSON.stringify({method:i,path:p,body:m,headers:a})},x={resolve:r,reject:c,timer:window.setTimeout(()=>{let M=this.#r[u];M&&(delete this.#r[u],this.#i("The request timed out before receiving a response."),M.reject("Timeout"))},g)};this.#r[u]=x,this.#n()?this.activateCommand(y):this.#l.push(y)})}activateCommand(o){this.#t?.send(JSON.stringify(o))}static \u0275fac=function(t){return new(t||e)};static \u0275prov=C({token:e,factory:e.\u0275fac,providedIn:"root"})};function Be(e){if(typeof e!="string")return null;let t=new TextEncoder().encode(e);return window.btoa(String.fromCharCode(...t))}function Pe(e,o,t){let n=e.relayconfigState.config();if(n===null)return t(o);let i=Be(o.body),p={};o.headers.keys().forEach(r=>{p[r]=o.headers.get(r)??""});let m=o.headers.get("timeout"),a=m!==null?parseInt(m):e.defaultTimeout;o.url.startsWith("/api/v1/serverstate")&&o.url.includes("longpoll=true")&&(a=1e3*99);let g=e.relayWebsocket.sendCommand(n.accessToken,n.clientId,n.machineServerUrl,o.method,o.url,i,p,a);return new F(r=>{g.then(c=>{let u=new re;p!=null&&Object.keys(p).forEach(y=>{u.set(y,p[y])});let S=new se({body:c.body,status:c.statusCode,statusText:"OK",headers:u});r.next(S),r.complete()}).catch(c=>{r.error(new ie({error:c??"Unknown error",status:0,statusText:c??"Unknown error"}))})})}var He=(e,o)=>{let t={relayconfigState:s(v),defaultTimeout:s(f).defaultTimeout,relayWebsocket:s(O)},n=t.relayconfigState.config();if(t.relayconfigState.configLoaded!==null&&n===null){let i=new W;return t.relayconfigState.configLoaded.subscribe(p=>{p&&Pe(t,e,o).subscribe(i)}),i}return Pe(t,e,o)};var Ve={providers:[Z(),ue(Oe,fe(),he(de)),ae(ce(),pe([He,xe])),h,{provide:f,useValue:Ae},{provide:ee,useValue:ke()},{provide:be,useValue:{alertVariant:"simple"}},we,I,Te,oe,Se,te,Me,Ee]};ne(k,Ve);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duplicati/ngclient",
3
- "version": "0.0.219",
3
+ "version": "0.0.220",
4
4
  "license": "MIT",
5
5
  "contributors": [
6
6
  "sp90",
package/chunk-X4BDJA6L.js DELETED
@@ -1,3 +0,0 @@
1
- import{a as ge}from"./chunk-GRE6GKVP.js";import{a as _e}from"./chunk-IFSZJSGH.js";import"./chunk-QDDVZ4CR.js";import"./chunk-BLSV7CNZ.js";import"./chunk-I6MIXWIT.js";import{l as pe,q as b}from"./chunk-DJXLNIMV.js";import"./chunk-CAQ3XMFP.js";import"./chunk-VC55KFAX.js";import"./chunk-ZEFSBETQ.js";import{b as de}from"./chunk-RJ2JM7C7.js";import"./chunk-WOKYULBU.js";import"./chunk-TCXCC5BM.js";import"./chunk-GKGMP6VF.js";import"./chunk-6Q6SSTBK.js";import"./chunk-YCJYEQF7.js";import"./chunk-OHYENIPP.js";import"./chunk-UTXZPAY6.js";import"./chunk-IMQUTGIK.js";import"./chunk-ANSV4G2K.js";import"./chunk-BACKG7KA.js";import{b as A}from"./chunk-IQL3REGJ.js";import"./chunk-AIAUP7OE.js";import{a as ue}from"./chunk-C6PICAXB.js";import"./chunk-6JS7B4FW.js";import{B as oe,G as ie,H as ae,L as se,P as re,Y as le,c as H,e as z,f as W,j,p as Q,q as Y,r as Z,s as ee,t as te,v as ne}from"./chunk-VKQQDCUN.js";import{b as ce,d as me}from"./chunk-DSYNIXJF.js";import{b as K,d as J,e as X}from"./chunk-NPFPMA4P.js";import"./chunk-O2SMJYPC.js";import"./chunk-N2AU7VKX.js";import"./chunk-ZC23RK4J.js";import"./chunk-OPHQNXYO.js";import{$b as F,Ac as V,Cb as C,Db as m,Eb as a,Fb as r,Mb as G,Qc as q,Sa as d,Tb as _,Ub as p,V as L,Vb as B,Wb as U,Xb as x,Zb as I,_ as u,da as h,ea as S,gb as y,kc as v,pa as E,ra as $,sc as M,tc as D,uc as O,wb as R,xb as k,zc as w}from"./chunk-TQTOIWBK.js";import"./chunk-7CGTOI24.js";var f=class c{#e=new Map;saveState(t){let e=crypto.randomUUID();return this.#e.set(e,t),e}getState(t){return this.#e.get(t)}static \u0275fac=function(e){return new(e||c)};static \u0275prov=L({token:c,factory:c.\u0275fac,providedIn:"root"})};var Fe=()=>["backup"];function he(c,t){c&1&&r(0,"sh-progress-bar",10)}function Se(c,t){if(c&1){let e=G();m(0,"form",11)(1,"sh-select",12)(2,"label",13),_(3,1),r(4,"sh-icon",14),p(),a(),r(5,"input",15),a(),m(6,"sh-form-field")(7,"label",16),_(8,2),r(9,"sh-icon",17),p(),a(),r(10,"textarea",18),a(),m(11,"sh-form-field")(12,"label",19),_(13,3),r(14,"sh-icon",20),p(),a(),r(15,"textarea",21),a()(),m(16,"sh-divider"),B(17,4),a(),m(18,"form",11)(19,"sh-form-field")(20,"label",22),_(21,5),r(22,"sh-icon",23),p(),a(),r(23,"input",24),a(),m(24,"sh-form-field")(25,"label",25),_(26,6),r(27,"sh-icon",26),p(),a(),r(28,"input",27),a(),m(29,"app-filters",28),O("filtersChange",function(i){h(e);let s=F();return D(s.filters,i)||(s.filters=i),S(i)}),I("filtersChange",function(i){h(e);let s=F();return S(s.updateFilters(i))}),a()(),m(30,"app-options-list",29),O("optionsChange",function(i){h(e);let s=F();return D(s.settings,i)||(s.settings=i),S(i)}),a(),m(31,"div",30)(32,"button",31),I("click",function(){h(e);let i=F();return S(i.submit())}),_(33,7),r(34,"sh-icon"),p(),a()()}if(c&2){let e=F();C("formGroup",e.baseCmdForm),d(),C("options",e.commandOptions()??V(11,Fe))("inlineSearch",!0),d(17),C("formGroup",e.standardFields),d(11),M("filters",e.filters),C("osType",e.osType()??""),d(),M("options",e.settings),C("hasFreeTextSettings",!0),d(2),v("loading",e.isSubmitting()),d(2),U(e.baseCmdForm.value.command),x(33)}}var l=new Z,P=class c{#e=u(b);#n=u(me);#o=u(J);#t=u(K);#a=u(ce);#s=u(de);#i=u(f);#r=u(ue);osType=q(()=>this.#r.systemInfo()?.OSType);#l=A(this.#t.params);commandOptions=A(this.#a.getApiV1Commandline());isSubmitting=E(!1);optionsFields=this.#e.optionsFields;standardFields=l.group({"backup-id":l.control(""),"backup-name":l.control(""),dbpath:l.control(""),filters:l.array([])});baseCmdForm=l.group({command:l.control("backup"),targetUrl:l.control(""),arguments:l.control("")});finishedLoading=this.#e.finishedLoading;backupId=this.#e.backupId;filters=E([]);settings=this.#e.settings;updateFilters(t){this.standardFields.controls.filters.clear(),t.forEach(e=>this.standardFields.controls.filters.push(l.control(e))),this.filters.set(t)}#m=$(()=>{let t=this.#l()?.id;this.#e.backupId.set(t),this.getBackup(t)});getBackup(t){this.#n.getApiV1BackupById({id:t}).subscribe({next:e=>{this.#e.mapScheduleToForm(e.Schedule??null),e.Backup&&(this.#e.mapGeneralToForm(e.Backup),this.mapStandardFieldsToForm(e.Backup),this.mapBaseCmdToForm(e.Backup),this.#e.mapOptionsToForms(e.Backup,!0)),this.applyStateFromUrl(),this.#e.finishedLoading.set(!0)}})}mapStandardFieldsToForm(t){if(this.standardFields.patchValue({dbpath:t.DBPath,"backup-id":t.ID,"backup-name":t.Name}),this.standardFields.controls.filters.clear(),t.Filters&&t.Filters.length){let e=t.Filters.map(n=>`${n.Include?"":"-"}${n.Expression}`);e.forEach(n=>{this.standardFields.controls.filters.push(l.control(n))}),this.filters.set(e)}else this.filters.set([])}submit(){this.#s.resumeDialogCheck(()=>this.#c())}#c(){this.isSubmitting.set(!0);let t=this.updateUrl(),e=this.baseCmdForm.value,n=e.targetUrl??"",i=(e.arguments??"").split(`
2
- `)??[],s=[n,...i].filter(o=>o.length>0),g=this.standardFields.value,T=g.filters??[],N=[e.command,...s,`--backup-name=${g["backup-name"]}`,`--dbpath=${g.dbpath}`,`--backup-id=${g["backup-id"]}`,...T.filter(o=>o).map(o=>o.startsWith("-")?`--exclude=${o?.slice(1)}`:`--include=${o}`),...this.#e.mapFormsToSettings(["backup-id","backup-name","dbpath"]).map(o=>`${o.Name.startsWith("--")?"":"--"}${o.Name}=${o.Value}`),"--disable-module=console-password-input"];this.#n.postApiV1Commandline({requestBody:N}).subscribe({next:o=>{o.Status==="OK"&&this.#o.navigate(["backup",this.backupId(),"commandline",o.ID],{queryParams:{state:t}})},error:()=>{this.isSubmitting.set(!1)}})}mapBaseCmdToForm(t){let e=t.TargetURL??null;e&&this.baseCmdForm.patchValue({targetUrl:e??"",arguments:t.Sources?.join(`
3
- `)??""})}updateUrl(){let t=this.baseCmdForm.value,e=this.standardFields.value,n=e.filters??[],i=this.settings(),s=this.#i.saveState({command:t.command,targetUrl:t.targetUrl,arguments:t.arguments,backupId:e["backup-id"],backupName:e["backup-name"],dbpath:e.dbpath,filters:n,options:i});return this.#o.navigate([],{relativeTo:this.#t,queryParams:{state:s},replaceUrl:!0}),s}applyStateFromUrl(){let e=this.#t.snapshot.queryParams.state;if(!e)return;let n=this.#i.getState(e);n&&(this.baseCmdForm.patchValue({command:n.command,targetUrl:n.targetUrl,arguments:n.arguments}),this.standardFields.patchValue({"backup-id":n.backupId,"backup-name":n.backupName,dbpath:n.dbpath}),n.filters&&(this.standardFields.controls.filters.clear(),n.filters.forEach(i=>{this.standardFields.controls.filters.push(l.control(i))}),this.filters.set(n.filters)),n.options&&n.options.length>0&&this.settings.set(n.options))}static \u0275fac=function(e){return new(e||c)};static \u0275cmp=y({type:c,selectors:[["app-commandline"]],features:[w([b])],decls:8,vars:1,consts:()=>{let t;t=$localize`${"\uFFFD#5\uFFFD"}:START_TAG_SH_ICON:arrow-left${"\uFFFD/#5\uFFFD"}:CLOSE_TAG_SH_ICON: Back `;let e;e=$localize` Command ${"\uFFFD#4\uFFFD"}:START_TAG_SH_ICON:question${"\uFFFD/#4\uFFFD"}:CLOSE_TAG_SH_ICON:`;let n;n=$localize` TargetUrl ${"\uFFFD#9\uFFFD"}:START_TAG_SH_ICON:question${"\uFFFD/#9\uFFFD"}:CLOSE_TAG_SH_ICON:`;let i;i=$localize` Commandline Arguments ${"\uFFFD#14\uFFFD"}:START_TAG_SH_ICON:question${"\uFFFD/#14\uFFFD"}:CLOSE_TAG_SH_ICON:`;let s;s=$localize`Advanced options`;let g;g=$localize` Backup ID ${"\uFFFD#22\uFFFD"}:START_TAG_SH_ICON:question${"\uFFFD/#22\uFFFD"}:CLOSE_TAG_SH_ICON:`;let T;T=$localize` Backup Name ${"\uFFFD#27\uFFFD"}:START_TAG_SH_ICON:question${"\uFFFD/#27\uFFFD"}:CLOSE_TAG_SH_ICON:`;let N;return N=$localize`${"\uFFFD#34\uFFFD"}:START_TAG_SH_ICON:arrow-right${"\uFFFD/#34\uFFFD"}:CLOSE_TAG_SH_ICON: Run "${"\uFFFD0\uFFFD"}:INTERPOLATION:" command now `,[t,e,n,i,s,g,T,N,[1,"back"],["type","button","shButton","","routerLink","/",1,"small"],[1,"indeterminate","primary"],[3,"formGroup"],["placeholder","Select a command...",3,"options","inlineSearch"],["for","command"],["shTooltip","Choose the command to execute"],["type","text","id","command","formControlName","command"],["for","targetUrl"],["shTooltip","Enter the URL of the backup target"],["id","targetUrl","autocomplete","off","formControlName","targetUrl"],["for","arguments"],["shTooltip","Enter one argument per line without quotes (e.g., *.txt)"],["id","arguments","autocomplete","off","rows","5","formControlName","arguments","placeholder","Enter one argument per line without quotes (e.g., *.txt)",1,"arguments"],["for","backup-id"],["shTooltip","The ID of the backup configuration this run belongs to (can be empty)"],["id","backup-id","formControlName","backup-id"],["for","backup-name"],["shTooltip","The optional name of the backup"],["id","backup-name","formControlName","backup-name"],[3,"filtersChange","filters","osType"],[3,"optionsChange","options","hasFreeTextSettings"],[1,"form-actions"],["shButton","",1,"raised","primary",3,"click"]]},template:function(e,n){e&1&&(r(0,"app-status-bar"),m(1,"section")(2,"div",8)(3,"button",9),_(4,0),r(5,"sh-icon"),p(),a()(),R(6,he,1,0,"sh-progress-bar",10)(7,Se,35,12),a()),e&2&&(d(6),k(n.finishedLoading()?7:6))},dependencies:[ee,j,H,z,W,_e,ge,pe,te,Y,Q,X,ae,oe,ie,re,se,ne,le],styles:["[_nghost-%COMP%]{display:block}section[_ngcontent-%COMP%]{display:flex;flex-direction:column;width:100%;max-width:40rem;padding:2.5rem;gap:1.25rem}form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.form-actions[_ngcontent-%COMP%]{display:flex;justify-content:flex-end}.row-inputs[_ngcontent-%COMP%]{display:flex;align-items:flex-end;gap:.5rem}.row-inputs[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{flex:1 0}.arguments[_ngcontent-%COMP%]{min-height:6rem;white-space:pre}"],changeDetection:0})};export{P as default};