!function(o){"use strict";var e=function(){var e=fusionGetScrollOffset();o("html, body").stop(),setTimeout(function(){o("html, body").animate({scrollTop:o(".woocommerce-notices-wrapper").offset().top-e},500)},10)};o("form.checkout").on("checkout_place_order",function(){if(Boolean(fusionWooNoticesVars.login_required)&&!fusionWooNoticesVars.is_logged_in)return e(),!1}),o("form.checkout_coupon").on("submit",function(e){const n=o(e.currentTarget);n.find("#coupon_code").length?n.find(".awb-coupon-error-wrapper").find(".coupon-error-notice").remove():(n.prepend('<div class="awb-coupon-error-wrapper"><span id="coupon_code"></span></div>'),n.find(".awb-coupon-error-wrapper").hide())}),o(document.body).on("checkout_error avada_checkout_error",function(n,c){var r,t,i=0,s="undefined"!=typeof avadaWooCommerceVars?avadaWooCommerceVars.woocommerce_checkout_error:"";o(".fusion-woo-notices-tb .woocommerce-notices-wrapper").length&&("checkout_error"===n.type&&void 0!==c?((r=o(c.replace(/<li>/g,'<li class="avada-checkout-error">'))).find("li[data-id]").each(function(){o("#"+o(this).data("id")+"_field").addClass("woocommerce-invalid woocommerce-invalid-required-field")}),1<r.find("li").length&&r.find("li").each(function(){o(this)[0].hasAttribute("data-id")&&(i++,o(this).remove())}),0<i&&r.find("ul").append('<li class="avada-checkout-error">'+s+"</li>"),fusion.getAdminbarHeight(),t=o(".fusion-header-wrapper").find("div"),t.each(function(){"fixed"===o(this).css("position")&&o(this).height()})):(void 0===c&&(c=s),r=o('<ul class="woocommerce-error"><li class="avada-checkout-error">'+c+"</li><ul>")),r.find(".wc-block-components-notice-banner__summary").length?r.find(".wc-block-components-notice-banner__summary").wrapInner('<span class="wc-notices-text"></span>').prepend(fusionWooNoticesVars.error_icon):r.find(".wc-block-components-notice-banner__content").wrapInner('<span class="wc-notices-text"></span>').prepend(fusionWooNoticesVars.error_icon),o(".woocommerce-NoticeGroup-checkout, .woocommerce-error, .woocommerce-message").remove(),o(".fusion-woo-notices-tb .woocommerce-notices-wrapper").prepend(r[0].outerHTML),"checkout_error"===n.type&&e())}).on("applied_coupon_in_checkout removed_coupon_in_checkout",function(n,c){var r="applied_coupon_in_checkout"===n.type?"form.checkout_coupon":"form.woocommerce-checkout",t="success",i=o(".fusion-woo-notices-tb .woocommerce-notices-wrapper"),s="";i.empty(),o(r).children(".awb-coupon-error-wrapper").children(".coupon-error-notice").length?(t="error",s=o('<div class="wc-block-components-notice-banner is-error" role="alert"><div class="wc-block-components-notice-banner__content">'+o(r).children(".awb-coupon-error-wrapper").children(".coupon-error-notice").text()+"</div></div>")):(s=o(r).prev()).hasClass("is-info")&&(t="notice"),i.length&&s.length&&(s.find(".wc-block-components-notice-banner__summary").length?s.find(".wc-block-components-notice-banner__summary").wrapInner('<span class="wc-notices-text"></span>').prepend(fusionWooNoticesVars[t+"_icon"]):s.find(".wc-block-components-notice-banner__content").wrapInner('<span class="wc-notices-text"></span>').prepend(fusionWooNoticesVars[t+"_icon"]),i.prepend(s),e())}).on("applied_coupon removed_coupon",function(n,c){var r=o(".fusion-woo-notices-tb .woocommerce-notices-wrapper"),t="success",i="";o(".avada-cart-actions .coupon").find(".coupon-error-notice").length?(t="error",i='<div class="wc-block-components-notice-banner is-error" role="alert"><div class="wc-block-components-notice-banner__content">'+o(".avada-cart-actions .coupon").find(".coupon-error-notice").text()+"</div></div>",r.append(i)):r.find(".is-info").length&&(t="notice"),r.length&&(r.find(".wc-block-components-notice-banner__summary").length?r.find(".wc-block-components-notice-banner__summary").wrapInner('<span class="wc-notices-text"></span>').prepend(fusionWooNoticesVars[t+"_icon"]):r.find(".wc-block-components-notice-banner__content").wrapInner('<span class="wc-notices-text"></span>').prepend(fusionWooNoticesVars[t+"_icon"]),e())}).on("updated_checkout payment_method_selected",function(e,n){o(".fusion-woo-notices-tb .woocommerce-notices-wrapper").length&&o(".woocommerce-notices-wrapper").filter(function(){return 0===o(this).closest(".fusion-woo-notices-tb").length}).remove()})}(jQuery);