(self.travelpayoutsWpPlugin=self.travelpayoutsWpPlugin||[]).push([[676],{6199:(t,n,e)=>{"use strict";var o=function(t,n,e,o){return new(e||(e=Promise))(function(i,r){function c(t){try{a(o.next(t))}catch(t){r(t)}}function s(t){try{a(o.throw(t))}catch(t){r(t)}}function a(t){var n;t.done?i(t.value):(n=t.value,n instanceof e?n:new e(function(t){t(n)})).then(c,s)}a((o=o.apply(t,n||[])).next())})};const i=t=>o(void 0,void 0,void 0,function*(){const[n]=Array.from(t),e=yield(t=>new Promise((n,e)=>{const o=new FileReader;o.readAsText(t),o.onload=()=>n(o.result),o.onerror=t=>e(t)}))(n);if("string"==typeof e)try{return JSON.parse(e)}catch(t){}});var r=e(83957),c=e.n(r),s=e(8985),a=function(t,n,e,o){return new(e||(e=Promise))(function(i,r){function c(t){try{a(o.next(t))}catch(t){r(t)}}function s(t){try{a(o.throw(t))}catch(t){r(t)}}function a(t){var n;t.done?i(t.value):(n=t.value,n instanceof e?n:new e(function(t){t(n)})).then(c,s)}a((o=o.apply(t,n||[])).next())})};var u=function(t,n,e,o){return new(e||(e=Promise))(function(i,r){function c(t){try{a(o.next(t))}catch(t){r(t)}}function s(t){try{a(o.throw(t))}catch(t){r(t)}}function a(t){var n;t.done?i(t.value):(n=t.value,n instanceof e?n:new e(function(t){t(n)})).then(c,s)}a((o=o.apply(t,n||[])).next())})};const l=document.querySelector("#travelpayouts_import_settings_button"),f=document.querySelector("#travelpayouts_import_settings_file"),d=document.querySelector("#travelpayouts_settings_import_nonce");if(l&&f&&d){const t=l.style.display;l.style.display="none";const n=()=>u(void 0,void 0,void 0,function*(){if(f.files&&f.files.length){const t=yield i(f.files);if(t){const n=yield((t,n)=>a(void 0,void 0,void 0,function*(){try{const e=(0,s.stringify)({action:"travelpayouts_import_file",travelpayouts_settings_import_nonce:n.value,settings:t}),o=yield c().post(window.ajaxurl,e,{});if(o&&"success"===o.data.status)return!0}catch(t){}return!1}))(t,d);if(n)return window.localStorage.setItem("wp_plugin_import_success","true"),window.onbeforeunload=null,window.scroll({top:0}),void location.reload()}}});l.addEventListener("click",n),f.addEventListener("change",()=>{f.files&&(l.style.display=t)})}},43966:()=>{}}]);