!function({jQuery:e,surchargeData:t}){e(function(e){e("body").on("change",'input[name="payment_method"]',function(){e("body").trigger("update_checkout")})}),t&&document.body.classList.contains("woocommerce-order-pay")&&e(function(o){let r=!1;const a=o('input:hidden[name="mollie-woocommerce-orderKey"]');a.length&&(r=a.val());const c=t.gatewayFeeLabel,n=()=>{e.ajax({url:t.ajaxUrl,method:"POST",data:{action:"update_surcharge_order_pay",method:o('input:radio[name="payment_method"]:checked').val(),orderKey:r,nonce:o('input[name="mollie-surcharge-nonce"]').val()},success:e=>{const t=e.data;if(t){const e="</th><td class='product-total'><span class='woocommerce-Price-amount amount'><bdi><span class='woocommerce-Price-currencySymbol'>"+t.currency+"</span>"+t.newTotal+"</bdi></span></td>";if(t.amount){const r="<tr><th scope='row' colspan='2'>"+t.name+"</th><td class='product-total'><span class='woocommerce-Price-amount amount'><bdi><span class='woocommerce-Price-currencySymbol'>"+t.currency+"</span>"+t.amount.toFixed(2)+"</bdi></span></td></tr>";-1!==o("#order_review table:first-child tfoot tr").text().indexOf(c)?(o('#order_review table:first-child tfoot tr:contains("'+c+'")').replaceWith(r),o("#order_review table:first-child tfoot tr:last td").replaceWith(e)):(o("#order_review table:first-child tfoot tr:first").after(r),o("#order_review table:first-child tfoot tr:last td").replaceWith(e))}else-1!==o("#order_review table:first-child tfoot tr").text().indexOf(c)&&(o('#order_review table:first-child tfoot tr:contains("'+c+'")').remove(),o("#order_review table:first-child tfoot tr:last td").replaceWith(e))}},error:(e,t,o)=>{console.warn(t,o)}})};n(),o("body").on("change",'input[name="payment_method"]',function(){n()})})}(window);