!function(){"use strict";var e={};function t(e,t,n,r,a,o,c){try{var u=e[o](c),i=u.value}catch(e){return void n(e)}u.done?t(i):Promise.resolve(i).then(r,a)}function n(e){return function(){var n=this,r=arguments;return new Promise((function(a,o){var c=e.apply(n,r);function u(e){t(c,a,o,u,i,"next",e)}function i(e){t(c,a,o,u,i,"throw",e)}u(void 0)}))}}e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,{a:n}),n},e.d=function(t,n){for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},e.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var r=window.regeneratorRuntime,a=e.n(r);function o(){return(o=n(a().mark((function e(t){var n,r,o,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new FormData,r=t.dataset,n.append("action",r.action),o=new URLSearchParams(window.location.search),(u=o.get("key"))&&n.append("wcOrderKey",u),e.next=8,c(r,n,t);case 8:t.classList.add("done"),document.body.classList.remove("worldline-return-page-active");case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function c(e,t,n){return u.apply(this,arguments)}function u(){return u=n(a().mark((function e(t,n,r){var o,u,i,s,d,p,l=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=l.length>3&&void 0!==l[3]&&l[3],u=l.length>4&&void 0!==l[4]?l[4]:1,e.prev=2,n.set("forceUpdate",o?"true":"false"),e.next=6,fetch(woocommerce_params.ajax_url,{method:"POST",body:n});case 6:return i=e.sent,e.next=9,i.json();case 9:s=e.sent,e.t0=s.data.status,e.next="pending"===e.t0?13:"cancelled"===e.t0||"failed"===e.t0?18:20;break;case 13:if(d=parseInt(t.retryCount),p=parseInt(t.timeout),!(u<d)){e.next=17;break}return e.abrupt("return",new Promise((function(e){return setTimeout((function(){e(c(t,n,r,u+1===d,u+1))}),p)})));case 17:return e.abrupt("break",20);case 18:return location.reload(),e.abrupt("break",20);case 20:r.innerHTML=s.data.message,e.next=26;break;case 23:e.prev=23,e.t1=e.catch(2),console.error(e.t1);case 26:case"end":return e.stop()}}),e,null,[[2,23]])}))),u.apply(this,arguments)}document.addEventListener("DOMContentLoaded",(function(){var e=document.querySelector(".worldline-return-page-order-payment-status")||null;e&&!e.classList.contains("done")&&function(_x){o.apply(this,arguments)}(e)}))}();