import{a as q}from"./chunk-4CALQKGE.js";import{e as N}from"./chunk-SPUEGBWO.js";import"./chunk-GQP2MJQK.js";import{j as b,k as L}from"./chunk-3JLWQSYQ.js";import"./chunk-ROXKKVPK.js";import{A as o,Fa as d,Ga as P,Ha as w,Hc as R,Ic as j,Ma as u,Mc as F,Qb as x,S as r,Sb as T,Sc as O,Ta as t,Ua as i,Vb as k,X as _,ad as U,bc as y,bd as A,cc as B,fb as C,fc as M,ja as g,ka as n,kc as E,la as p,lc as H,ma as h,oc as D,ta as f,xb as S}from"./chunk-ZVAMPSQU.js";import"./chunk-Q4GIRPEW.js";import"./chunk-C4VCQZFV.js";import"./chunk-MK7RKAD6.js";import"./chunk-UGJWQZTF.js";import"./chunk-SWJEEOI6.js";import"./chunk-454IMN7J.js";import"./chunk-AGEZHV7T.js";import"./chunk-6HUFGUZI.js";import"./chunk-CV7FJRES.js";import"./chunk-SM2GS6OU.js";import"./chunk-OKF5LGRG.js";import"./chunk-OTSTEYZJ.js";import{j as I}from"./chunk-FB5LSH2R.js";var ne=(()=>{let s=class s{constructor(){this.loadingService=o(N),this.importService=o(q),this.utilService=o(L),this.alertCtrl=o(F),this.translate=o(U),this.navCtrl=o(T),this.defaultBackHref=b.ImportPage.getPath(),this.username="",this.password=""}alertIncorrectCredentials(){return I(this,null,function*(){let l=yield this.translate.get("pages.importPepperplate.incorrectCredentials.header").toPromise(),a=yield this.translate.get("pages.importPepperplate.incorrectCredentials.message").toPromise(),e=yield this.translate.get("generic.okay").toPromise();yield(yield this.alertCtrl.create({header:l,message:a,buttons:[{text:e}]})).present()})}submit(){return I(this,null,function*(){let l=this.loadingService.start(),a=yield this.importService.importPepperplate({username:this.username,password:this.password},{406:()=>this.alertIncorrectCredentials()});if(l.dismiss(),!a.success)return;let e=yield this.translate.get("pages.import.jobCreated.header").toPromise(),m=yield this.translate.get("pages.import.jobCreated.message").toPromise(),c=yield this.translate.get("generic.okay").toPromise(),z=yield this.alertCtrl.create({header:e,message:m,buttons:[{text:c}]});yield this.navCtrl.navigateForward(b.ImportPage.getPath(),{replaceUrl:!0}),yield z.present()})}};s.\u0275fac=function(a){return new(a||s)},s.\u0275cmp=_({type:s,selectors:[["page-import-pepperplate"]],decls:32,vars:31,consts:[["color","nav"],["slot","start"],[3,"defaultHref"],[1,"ion-padding"],[1,"page-wrapper"],["lines","none"],[1,"ion-text-wrap"],["href","https://docs.recipesage.com/docs/tutorials/settings/import/pepperplate","target","_blank","rel","noopener"],["labelPlacement","stacked","autocomplete","off",3,"ionInput","label","helperText","value"],["labelPlacement","stacked","type","password","autocomplete","off",3,"ionInput","label","helperText","value"],[3,"click"]],template:function(a,e){a&1&&(n(0,"ion-header")(1,"ion-toolbar",0)(2,"ion-buttons",1),h(3,"ion-back-button",2),p(),n(4,"ion-title"),d(5),t(6,"translate"),p()()(),n(7,"ion-content",3)(8,"div",4)(9,"ion-item",5)(10,"ion-label",6),d(11),t(12,"translate"),h(13,"br")(14,"br"),n(15,"a",7),d(16),t(17,"translate"),p()()(),h(18,"br"),n(19,"ion-item",5)(20,"ion-input",8),t(21,"translate"),t(22,"translate"),f("ionInput",function(c){return e.username=c.detail.value||""}),p()(),n(23,"ion-item",5)(24,"ion-input",9),t(25,"translate"),t(26,"translate"),f("ionInput",function(c){return e.password=c.detail.value||""}),p()(),n(27,"ion-item",5)(28,"ion-label")(29,"ion-button",10),f("click",function(){return e.submit()}),d(30),t(31,"translate"),p()()()()()),a&2&&(r(3),g("defaultHref",e.defaultBackHref),r(2),P(i(6,15,"pages.importPepperplate.title")),r(6),w(" ",i(12,17,"pages.importPepperplate.description")," "),r(5),P(i(17,19,"pages.import.viewDocumentation")),r(4),g("label",u(i(21,21,"pages.importPepperplate.username")))("helperText",u(i(22,23,"pages.importPepperplate.username.helperText")))("value",e.username),r(4),g("label",u(i(25,25,"pages.importPepperplate.password")))("helperText",u(i(26,27,"pages.importPepperplate.password.helperText")))("value",e.password),r(6),w(" ",i(31,29,"generic.submit")," "))},dependencies:[C,x,S,E,j,B,k,R,M,H,D,O,y,A],styles:[".slimPage[_ngcontent-%COMP%]{margin-left:auto;margin-right:auto;max-width:800px}.page-wrapper[_ngcontent-%COMP%]{max-width:var(--page-max-width);margin:0 auto}"]});let v=s;return v})();export{ne as ImportPepperplatePage};
