(window["aioseopjsonp"]=window["aioseopjsonp"]||[]).push([["redirects-partials-ImportAioseo-vue"],{"0964":function(e,i,t){"use strict";t.r(i);var s=function(){var e=this,i=e.$createElement,t=e._self._c||i;return t("core-card",{staticClass:"aioseo-redirects-import-aioseo",attrs:{slug:"importAioseoRedirects",toggles:!1,"no-slide":"","header-text":e.strings.importRestoreAioseoRedirects},scopedSlots:e._u([{key:"header-icon",fn:function(){return[t("svg-download")]},proxy:!0}])},[e.uploadError?t("core-alert",{staticClass:"import-error",attrs:{type:"red"}},[e._v(" "+e._s(e.uploadError)+" ")]):e._e(),e.uploadSuccess?t("core-alert",{staticClass:"import-error",attrs:{type:"green"}},[e._v(" "+e._s(e.strings.fileUploadedSuccessfully)+" ")]):e._e(),t("div",{staticClass:"file-upload"},[t("base-input",{class:{"aioseo-error":e.uploadError},attrs:{size:"medium",placeholder:e.strings.fileUploadPlaceholder},on:{focus:e.triggerFileUpload},model:{value:e.filename,callback:function(i){e.filename=i},expression:"filename"}}),t("base-button",{attrs:{type:"black",size:"medium"}},[e._v(" "+e._s(e.strings.chooseAFile)+" "),t("base-input",{ref:"file",attrs:{type:"file"},on:{click:e.reset,change:e.handleFileUpload},model:{value:e.inputFile,callback:function(i){e.inputFile=i},expression:"inputFile"}})],1)],1),t("div",{staticClass:"aioseo-description"},[e._v(" "+e._s(e.strings.fileUploadDescription)+" ")]),t("base-button",{staticClass:"import",attrs:{type:"blue",size:"medium",disabled:!e.file||!e.importValidated,loading:e.loading},on:{click:e.submitFile}},[e._v(" "+e._s(e.strings.import)+" ")])],1)},r=[],l=(t("b0c0"),t("8a79"),t("5530")),o=t("2f62"),a={data:function(){return{inputFile:null,filename:null,file:null,uploadError:!1,uploadSuccess:!1,loading:!1,strings:{importRestoreAioseoRedirects:this.$t.sprintf(this.$t.__("Import Redirects from %1$s File",this.$td),"AIOSEO"),fileUploadPlaceholder:this.$t.__("Import from a JSON file...",this.$td),chooseAFile:this.$t.__("Choose a File",this.$td),fileUploadDescription:this.$t.__("Imported redirects will overwrite existing redirects and will not be merged.",this.$td),import:this.$t.__("Import",this.$td),jsonFileTypeRequired:this.$t.__("A JSON file is required to import redirects.",this.$td),fileUploadedSuccessfully:this.$t.__("Success! Your redirects have been imported.",this.$td),fileUploadFailed:this.$t.__("There was an error importing your redirects. Please make sure you are uploading the correct file or it is in the proper format.",this.$td)}}},computed:{importValidated:function(){return!("application/json"!==this.file.type&&!this.file.name.endsWith(".ini"))}},methods:Object(l["a"])(Object(l["a"])({},Object(o["b"])("redirects",["uploadFile"])),{},{reset:function(){this.uploadError=!1,this.filename=null,this.file=null,this.inputFile=null},triggerFileUpload:function(){this.reset(),this.$refs.file.$el.querySelector("input").focus(),this.$refs.file.$el.querySelector("input").click()},submitFile:function(){var e=this;this.loading=!0,this.uploadFile({file:this.file,filename:this.filename}).then((function(){e.reset(),e.uploadSuccess=!0,e.loading=!1})).catch((function(){e.reset(),e.loading=!1,e.uploadError=e.strings.fileUploadFailed}))},handleFileUpload:function(){this.reset(),this.file=this.$refs.file.$el.querySelector("input").files[0],this.file&&(this.filename=this.file.name,"application/json"!==this.file.type&&(this.uploadError=this.strings.jsonFileTypeRequired))}})},n=a,d=(t("3afb"),t("2877")),c=Object(d["a"])(n,s,r,!1,null,null,null);i["default"]=c.exports},"3afb":function(e,i,t){"use strict";var s=t("fdcf"),r=t.n(s);r.a},fdcf:function(e,i,t){}}]);