// source --> https://www.skinbeautysolutions.com/wp-content/plugins/woo-extra-flat-rate/public/js/advanced-flat-rate-shipping-for-woocommerce-public.js?ver=v4.5.1 
!function(t){"use strict";t(document).ready(function(){t("body").on("change",'input[name="payment_method"]',function(){t("body").trigger("update_checkout")}),t(document.body).on("updated_checkout",function(){var e;t(".cfw-shipping-methods-list").addClass("afrsm_shipping"),t(".cfw-shipping-methods-list li").each(function(){t(this).find(".extra-flate-tool-tip").length>0&&(e=t(this).find(".extra-flate-tool-tip"),t(e).appendTo(t(this).find(".cfw-shipping-method-inner"))),t(this).find(".forceall-tooltip").length>0&&(e=t(this).find(".forceall-tooltip"),t(e).appendTo(t(this).find(".cfw-shipping-method-inner")))})});var e=!1,i=null;s(),n();let o=new MutationObserver(function(o){var s=!1;o.forEach(function(e){if(e.addedNodes.length>0)for(var i=0;i<e.addedNodes.length;i++){var o=e.addedNodes[i];if(1===o.nodeType&&!t(o).hasClass("wc-afrsm-help-tip")&&!t(o).find(".wc-afrsm-help-tip").length&&t(o).closest(".wc-block-components-totals-item, .wc-block-components-shipping-rates-control").length>0){s=!0;break}}}),s&&!e&&(clearTimeout(i),i=setTimeout(n,300))});function n(){if(t(".wc-afrsm-help-tip").remove(),t(".afrsm-shipping-subtitle").remove(),!e&&"undefined"!=typeof afrsm_public_vars&&afrsm_public_vars.shipping_tooltip_data){e=!0;var i=t(".wc-afrsm-help-tip"),n=!0,l="",c=t(".wc-block-components-shipping-rates-control .wc-block-components-radio-control__option-checked");if(c.length>0){var a=c.find(".wc-block-components-radio-control__label");a.length>0&&(l=a.text().trim())}else l=t(".wc-block-components-totals-shipping .wc-block-components-totals-item__label").text().trim();if(!l){e=!1;return}var p=l.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");if(i.length>0){var r=i.first().attr("class").match(/afrsm-help-tip-([^\s]+)/);r&&r[1]===p&&(n=!1)}if(!n){e=!1;return}var h=null,f=null,d=null;if(t.each(afrsm_public_vars.shipping_tooltip_data,function(t,e){if(t===p)return h=e.text,d=e.type,f=t,!1}),!h||!f){e=!1;return}t(".wc-block-components-totals-item").each(function(){var e=t(this),i=e.find(".wc-block-components-totals-item__label").text().trim();if(e.hasClass("wc-block-components-totals-item--subtotal")||e.closest(".wc-block-components-totals-fees").length>0||e.closest(".wc-block-components-totals-footer-item").hasClass("wc-block-components-totals-footer-item--total"))return!0;var n=i.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),s=!1;if(n===f||n===p?s=!0:i===l?s=!0:-1!==i.indexOf(l)&&(s=!0),s){var c=e.find(".wc-block-components-totals-item__value");if(c.length>0&&0===t(".afrsm-help-tip-"+f).length){if(o.disconnect(),"tooltip"===d){let a=t('<span class="wc-afrsm-help-tip wc-block-components-tooltip afrsm-help-tip-'+f+'" data-tip="'+h+'"></span>');c.after(a)}else{var r=c.next(".wc-block-components-totals-item__description");let m=t('<span class="afrsm-shipping-subtitle afrsm-subtitle-'+f+'">'+h+"</span>");r.html(m)}setTimeout(function(){o.observe(document.body,{childList:!0,subtree:!0})},100)}}}),s(),setTimeout(function(){e=!1},200)}}function s(){setTimeout(function(){t(".wc-afrsm-help-tip").each(function(){t(this).data("tiptip-initialized")||(t(this).tipTip({content:t(this).data("tip"),keepAlive:!0,edgeOffset:2}),t(this).data("tiptip-initialized",!0))})},1e3)}o.observe(document.body,{childList:!0,subtree:!0})}),t(window).on("load",function(){t(".forceall_shipping_method").length&&t(".forceall_shipping_method").is(":hidden")&&(t(".forceall_shipping_method").attr("checked",!0).trigger("change"),"true"===t(".forceall_shipping_method").is(":checked")&&t('[name="update_cart"]').trigger("click"))})}(jQuery);