!function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:o})},n.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}();var r=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.ajaxUrl=e,this.migrationTrigger=document.querySelector(".wpml-start-jobs-migration"),this.results=document.querySelector(".wpml-js-jobs-migration-progress"),this.jobsMigrated=document.querySelector(".wpml-js-migrated-jobs"),this.jobsMigratedCount=0,this.totalJobs=document.querySelector(".wpml-js-total-jobs"),this.totalJobsCount=0,this.spinner=document.querySelector(".wpml-jobs-migration-spinner"),this.nonce=document.querySelector("#wpml_translation_jobs_migration").value}return o(t,[{key:"attachEvents",value:function(){var t=this;this.migrationTrigger.addEventListener("click",function(){return t.run()})}},{key:"run",value:function(){this.migrationTrigger.disabled=!0,this.spinner.classList.add("is-active"),this.migrate()}},{key:"migrate",value:function(){var t=this;fetch(this.ajaxUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=utf-8"},body:"action=wpml_translation_jobs_migration&nonce="+this.nonce,credentials:"same-origin"}).then(function(t){return t.json()}).then(function(e){if(!e.success)throw e;t.results.style.display="block",t.jobsMigratedCount+=e.data.jobsMigrated,t.updateResults(t.jobsMigratedCount),t.totalJobsCount||(t.totalJobsCount=e.data.totalJobs,t.totalJobs.innerHTML=t.totalJobsCount),e.data.done?location.reload():t.migrate()}).catch(function(t){var e=document.querySelector(".wpml-job-migration-error");e&&(t.data&&(e.querySelector(".error-message").textContent=t.data),e.style.display="block")})}},{key:"updateResults",value:function(t){this.jobsMigrated.innerHTML=t}}]),t}();e.default=r},function(t,e,n){"use strict";var o,r=n(0),i=(o=r)&&o.__esModule?o:{default:o};document.addEventListener("DOMContentLoaded",function(){return new i.default(ajaxurl).attachEvents()})},function(t,e,n){t.exports=n(1)}]);