(()=>{"use strict";!function(i){var t=function(){var t=(window.RTSB||{}).cache,n=null==t?void 0:t.create("quickView"),o=null==n?void 0:n.get("modal");return o||(o=new RtsbModal({footer:!1,header:!0,title:!1,wrapClass:"quick-view-modal",maxWidth:QvModalParams.modal_width>0?QvModalParams.modal_width:950}),null==n||n.set("modal",o)),{name:"quickView",version:"1.0.0",init:function(){return this.bindQuickViewButtonEvents(),this.initQuickViewEventActions(),n.set("initialized",!0),this},bindQuickViewButtonEvents:function(){var t=this,a=".rtsb-quick-view-btn";i(document).off("click",a).on("click",a,function(a){a.preventDefault(),a.stopPropagation();var d=i(a.currentTarget).data("product_id");if(!d)return console.log("No product selected"),t;var c=null==n?void 0:n.get(d);if(c)return e(o,c,!0),t;i.ajax({url:rtsbQvParams.ajaxurl,data:{action:"rtsb_load_product_quick_view",product_id:d,lang:rtsbQvParams.lang},dataType:"json",type:"POST",beforeSend:function(){o.addModal().addLoading()},success:function(i){var t;i.success&&null!==(t=i.data)&&void 0!==t&&t.html?(null==n||n.set(d,i.data.html),e(o,i.data.html)):(o.removeLoading(),console.log("Failed to load quick view content."))},fail:function(){o.removeLoading(),i(document).trigger("rtsbQv.error")},always:function(){i(document).trigger("rtsbQv.loaded")}})})},initQuickViewEventActions:function(){var t=this;i(document).on("yith_infs_adding_elem yith-wcan-ajax-filtered",function(){t.bindQuickViewButtonEvents()})},destroy:function(){i(document).off("click",".rtsb-quick-view-btn"),i(document).off("yith_infs_adding_elem yith-wcan-ajax-filtered"),n.clear("quickView")}}},e=function(t,e){arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&t.addModal(),t.body.addClass("woocommerce single-product"),t.addTitle(""),t.content(""),t.content(e);var n=t.body.find(".variations_form");n.each(function(t,e){i(e).wc_variation_form()}),n.trigger("check_variations"),n.trigger("reset_image"),void 0!==i.fn.wc_product_gallery&&t.body.find(".woocommerce-product-gallery").each(function(t,e){i(e).wc_product_gallery()}),t.body.find(".elementor-element")&&t.body.addClass("rtsb-build-with-elementor"),i(document).trigger("rtsbQv.success"),setTimeout(function(){t.removeLoading()},150)};if(window.RTSB&&window.RTSB._initialized){var n;null===(n=RTSB.modules.register("quickView",t))||void 0===n||n.init()}else{var o=t();i.fn.rtsb_quick_view=function(){o.bindQuickViewButtonEvents()},i.fn.rtsb_quick_view(),o.initQuickViewEventActions()}}(jQuery)})();