function PaoValidation(a){return this instanceof PaoValidation?!!a.$addons.length&&(this.$form=a.$el,this.$addons=a.$addons,this.form=a,void(this.validationState=this.getInitialState())):new PaoValidation(a)}PaoValidation.prototype.getInitialState=function(){var a={};return jQuery.each(this.$addons,function(){a[jQuery(this).attr("id")]={validity:!0,message:""}}),a},PaoValidation.prototype.getValidationState=function(){return this.validationState},PaoValidation.prototype.validateAddon=function(a,t=!1){var i=a.data("restrictions"),e=a.attr("id"),o=!0;return this.validationState[e]||(this.validationState[e]={validity:!0,message:""}),a.closest(".wc-pao-addon-container").is(":visible")&&(jQuery.isEmptyObject(i)||((o=(o="required"in i&&"yes"===i.required?this.validateRequired(a):o)&&a.is(".wc-pao-addon-custom-price")?this.validateDecimals(a):o)&&"content"in i&&("only_letters"===i.content?o=this.validateLetters(a):"only_numbers"===i.content?o=this.validateNumbers(a):"only_letters_numbers"===i.content?o=this.validateLettersNumbers(a):"email"===i.content&&(o=this.validateEmail(a))),(o=o&&"min"in i?this.validateMin(a,i.min):o)&&"max"in i&&(o=this.validateMax(a,i.max))),t)&&this.printMessage(a),this.validationState[e].validity},PaoValidation.prototype.validate=function(a=!1){var t=!0,i=this;return jQuery.each(i.$addons,function(){i.validateAddon(jQuery(this),a)||(t=!1)}),t},PaoValidation.prototype.escapeRegExp=function(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")},PaoValidation.prototype.removeNoticeFromAriaDescribed=function(a,t){var i=a.attr("aria-describedby");i&&(0<(i=i.split(" ").filter(function(a){return a!==t&&""!==a.trim()})).length?a.attr("aria-describedby",i.join(" ")):a.removeAttr("aria-describedby"))},PaoValidation.prototype.addNoticeToAriaDescribed=function(a,t){var i=a.attr("aria-describedby"),i=i?i.split(" ").filter(function(a){return a!==t&&""!==a.trim()}):[];i.unshift(t),a.attr("aria-describedby",i.join(" "))},PaoValidation.prototype.printMessage=function(a){var t,i=a.attr("id"),i=this.validationState[i],e=a.closest(".wc-pao-addon-container"),o=e.attr("id")+"-validation-notice";this.clearValidationMessage(e,o),i.validity||(t=e[0].hasAttribute("data-fieldset"),this.showValidationMessage(e,a,o,i.message,t))},PaoValidation.prototype.clearValidationMessage=function(a,t){a.find(".wc-pao-validation-notice").remove();a=a.find(".wc-pao-fieldset, .wc-pao-addon-field").first();a.removeAttr("aria-invalid"),this.removeNoticeFromAriaDescribed(a,t)},PaoValidation.prototype.showValidationMessage=function(a,t,i,e,o){o?((o=a.find(".wc-pao-fieldset")).attr("aria-invalid","true"),this.addNoticeToAriaDescribed(o,i),o=e.replace(/</g,"&lt;").replace(/>/g,"&gt;"),a.find(".wc-pao-addon-wrap").append(`<small id="${i}" class="wc-pao-validation-notice" role="status" tabindex="-1">${o}</small>`)):(t.attr("aria-invalid","true"),this.addNoticeToAriaDescribed(t,i),a=e.replace(/</g,"&lt;").replace(/>/g,"&gt;"),t.after(`<small id="${i}" class="wc-pao-validation-notice" role="status" tabindex="-1">${a}</small>`))},PaoValidation.prototype.validateRequired=function(a){var t=!0,i="",e="",o=a.attr("id");if(a.is(":checkbox")||a.is(":radio")){var r,n=(r=a.closest(".wc-pao-addon-container")).find(".wc-pao-addon-field"),d=this,t=!1;if(jQuery.each(n,function(){jQuery(this).is(":checked")&&(t=!0)}),t)return void jQuery.each(n,function(){var a=jQuery(this).attr("id");d.validationState[a]={validity:t,message:i,reason:e}});i=woocommerce_addons_params.i18n_validation_required_select}else a.hasClass("wc-pao-addon-image-swatch-select")?(r=a.closest(".wc-pao-addon-container"),t=!1,jQuery.each(r.find(".wc-pao-addon-image-swatch"),function(){jQuery(this).hasClass("selected")&&(t=!0)}),t||(i=woocommerce_addons_params.i18n_validation_required_select)):a.val()||(t=!1,"file"===a.attr("type")?void 0!==a.data("value")&&""!==a.data("value")?t=!0:i=woocommerce_addons_params.i18n_validation_required_file:"number"===a.attr("type")||a.is(".wc-pao-addon-custom-price")?i=woocommerce_addons_params.i18n_validation_required_number:a.is("input")||a.is("textarea")?i=woocommerce_addons_params.i18n_validation_required_input:a.is("select")&&(i=woocommerce_addons_params.i18n_validation_required_select));return t||(e="required"),this.validationState[o]={validity:t,message:i,reason:e},this.validationState[o].validity},PaoValidation.prototype.validateLetters=function(a){var t=!/[`!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~\d]/g.test(a.val()),i="",e="",o=a.attr("id");return(t=a.val()?t:!0)||(i=woocommerce_addons_params.i18n_validation_letters_only,e="letters"),this.validationState[o]={validity:t,message:i,reason:e},this.validationState[o].validity},PaoValidation.prototype.validateNumbers=function(a){var t=/^[0-9]*$/g.test(a.val()),i="",e="",o=a.attr("id");return(t=a.val()?t:!0)||(i=woocommerce_addons_params.i18n_validation_numbers_only,e="numbers"),this.validationState[o]={validity:t,message:i,reason:e},this.validationState[o].validity},PaoValidation.prototype.validateLettersNumbers=function(a){var t=!/[`!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/g.test(a.val()),i="",e="",o=a.attr("id");return(t=a.val()?t:!0)||(i=woocommerce_addons_params.i18n_validation_letters_and_numbers_only,e="letters_numbers"),this.validationState[o]={validity:t,message:i,reason:e},this.validationState[o].validity},PaoValidation.prototype.validateEmail=function(a){var t=/^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(a.val()),i="",e="",o=a.attr("id");return(t=a.val()?t:!0)||(i=woocommerce_addons_params.i18n_validation_email_only,e="email"),this.validationState[o]={validity:t,message:i,reason:e},this.validationState[o].validity},PaoValidation.prototype.validateDecimals=function(a){var t=!0,i="",e="",o=a.attr("id"),r=a.val(),n=new RegExp(`^-?\\d+(?:\\${woocommerce_addons_params.currency_format_decimal_sep}\\d+)?$`);return a.val()?n.test(r)||(t=!1,i=woocommerce_addons_params.i18n_validation_decimal_separator.replace("%c",woocommerce_addons_params.currency_format_decimal_sep),e="decimals"):t=!0,this.validationState[o]={validity:t,message:i,reason:e},this.validationState[o].validity},PaoValidation.prototype.validateMin=function(a,t){var i,e=!0,o="",r="",n=a.attr("id");return a.val()?"number"===a.attr("type")||a.is(".wc-pao-addon-custom-price")?(i=(i=a.val()).includes(".")?parseFloat(i):i.includes(woocommerce_addons_params.currency_format_decimal_sep)?parseFloat(i.replace(woocommerce_addons_params.currency_format_decimal_sep,".")):parseInt(i))<t&&(e=!1,a.is(".wc-pao-addon-custom-price")&&(t=accounting.formatNumber(t,{symbol:"",decimal:woocommerce_addons_params.currency_format_decimal_sep,precision:parseFloat(t)%1==0?0:t.toString().split(".")[1].length})),o=woocommerce_addons_params.i18n_validation_min_number.replace("%c",t)):("text"===a.attr("type")||a.is("textarea"))&&a.val().length<t&&(e=!1,o=woocommerce_addons_params.i18n_validation_min_characters.replace("%c",t)):e=!0,this.validationState[n]={validity:e,message:o,reason:r=e?r:"min"},this.validationState[n].validity},PaoValidation.prototype.validateMax=function(a,t){var i,e,o=!0,r="",n=a.attr("id");return a.val()?"number"===a.attr("type")||a.is(".wc-pao-addon-custom-price")?t<(e=(e=a.val()).includes(".")?parseFloat(e):e.includes(woocommerce_addons_params.currency_format_decimal_sep)?parseFloat(e.replace(woocommerce_addons_params.currency_format_decimal_sep,".")):parseInt(e))&&(o=!1,a.is(".wc-pao-addon-custom-price")&&(t=accounting.formatNumber(t,{symbol:"",decimal:woocommerce_addons_params.currency_format_decimal_sep,precision:parseFloat(t)%1==0?0:t.toString().split(".")[1].length})),r=woocommerce_addons_params.i18n_validation_max_number.replace("%c",t)):("text"===a.attr("type")||a.is("textarea"))&&a.val().length>t&&(o=!1,r=woocommerce_addons_params.i18n_validation_max_characters.replace("%c",t)):o=!0,this.validationState[n]={validity:o,message:r,reason:i=o?i:"max"},this.validationState[n].validity};
((f,a)=>{let t=PaoValidation;function e(a){return this instanceof e?!!a.length&&(this.$el=a,this.$addons=this.$el.find(".wc-pao-addon-field"),this.$addons.length?(this.is_rtl="rtl"===document.documentElement.dir,this.validation=new t(this),this.totals=new o(this),this.show_incomplete_subtotals=this.totals.showIncompleteSubtotals(),this.contains_required=this.containsRequired(),this.setupEvents(),this.validation.validate(),this.updateTotals(),"function"==typeof f.fn.tipTip&&f(".wc-pao-addon-image-swatch").tipTip({delay:200}),void WC_PAO.initialized_forms.push(this)):this.$addons=!1):new e(a)}function o(a){return this instanceof o?!f.isEmptyObject(a)&&(this.$form=a.$el,this.$addons=a.$addons,this.$variation_input=!!this.$form.hasClass("variations_form")&&this.$form.find('input[name="variation_id"], input.variation_id'),this.is_variable=this.$variation_input&&0<this.$variation_input.length,this.$totals=this.$form.find("#product-addons-total"),this.product_id=this.is_variable?this.$variation_input.val():this.$totals.data("product-id"),!!this.product_id)&&(this.base_price=this.$totals.data("price"),this.raw_price=this.$totals.data("raw-price"),this.product_type=this.$totals.data("type"),this.qty=parseFloat(this.$form.find("input.qty").val()),this.addons_price_data=[],this.$subscription_plans=this.$form.find(".wcsatt-options-product"),this.has_subscription_plans=0<this.$subscription_plans.length,this.is_rtl=a.is_rtl,this.total=0,this.total_raw=0,this.show_subtotal_panel=!0,void(this.price_request=null)):new o(a)}(WC_PAO=a.WC_PAO||{}).initialized_forms=[],WC_PAO.Helper={escapeHtml:function(a){return document.createElement("div").appendChild(document.createTextNode(a)).parentNode.innerHTML},isGroupedSubsSelected:function(){var a=f(".product-type-grouped"),t=!1;return a.length&&a.find(".group_table tr.product").each(function(){if(0<f(this).find(".input-text.qty").val()&&f(this).find(".entry-summary .subscription-details").length)return!(t=!0)}),t},addMinutes:function(a,t){return new Date(a.getTime()+6e4*t)},isGroupedMixedProductType:function(){var a=f(".product-type-grouped"),t=0,e=0;return!!(a.length&&(a.find(".group_table tr.product").each(function(){0<f(this).find(".input-text.qty").val()&&(f(this).find(".entry-summary .subscription-details").length?t++:e++)}),0<t)&&0<e)},delay:function(a,t){clearTimeout(0),setTimeout(a,t)}},WC_PAO.Form=(e.prototype.setupEvents=function(){var t,n=this;n.$el.find('button[type="submit"]').on("click",function(){var a,t;return!!n.validation.validate(!0)||((a=n.$el.find(".wc-pao-validation-notice")).length&&(t=n.$el.find(a[0].closest(".wc-pao-addon-container"))).length&&(t=t.find(".wc-pao-addon-field").first()).length&&(t.is(":hidden")?f(a[0]):t).focus(),!1)}),n.$el.on("blur change",".wc-pao-addon input:not(.wc-pao-addon-file-upload), .wc-pao-addon textarea, .wc-pao-addon select, .wc-pao-addon-custom-text",function(a){if(f(this).is(".wc-pao-addon-checkbox")){var t=f(this).closest(".wc-pao-fieldset"),a=f(a.relatedTarget).closest(".wc-pao-fieldset");if(t.is(a))return}n.validation.validateAddon(f(this),!0),n.updateTotals()}),n.$el.on("change",".wc-pao-addon input.wc-pao-addon-file-upload",function(){let a=f(this);var t=a.closest(".wc-pao-addon-container"),e=t.find(".reset_file"),t=t.find(".wc-pao-addon-file-name");e.length&&e.addClass("active"),t.length&&t.hide(250,function(){f(this).remove(),a.data("value","")}),n.validation.validateAddon(a,!0),n.updateTotals()}),n.$el.on("input",".wc-pao-addon input:not(.wc-pao-addon-checkbox), .wc-pao-addon textarea, .wc-pao-addon-custom-text",function(){var a=f(this);WC_PAO.Helper.delay(function(){n.validation.validateAddon(a,!0),n.updateTotals()},300)}),n.$el.on("change","input.qty",function(){n.updateTotals()}),n.$el.on("touchstart",".wc-pao-addon-image-swatch",function(a){t=new Date}),n.$el.on("click touchend",".wc-pao-addon-image-swatch",function(a){if((a.preventDefault(),"touchend"===a.type&&t)&&100<new Date-t)return;n.updateImageSwatch(f(this))}),n.$el.on("keydown",".wc-pao-addon-image-swatch",function(a){var t=f(this),e=t.parents(".wc-pao-addon-wrap").find(".wc-pao-addon-image-swatch"),o=e.index(t),i=!1;if("ArrowRight"===a.key||"ArrowDown"===a.key)o=(o+1)%e.length,i=!0;else if("ArrowLeft"===a.key||"ArrowUp"===a.key)o=(o-1+e.length)%e.length,i=!0;else if(" "===a.key||"Enter"===a.key)return void n.updateImageSwatch(t);i&&(a.preventDefault(),(t=e.eq(o)).focus(),n.updateImageSwatch(t))}),n.$el.on("click",".reset_variations",function(){n.totals.reset()}),n.$el.on("wc_variation_form",function(){n.validation.validate(),n.updateTotals()}),n.$el.on("found_variation",function(a,t){n.totals.updateVariation(t),n.validation.validate(),n.updateTotals()}),n.$el.on("hide_variation",function(a){n.updateTotals()}),n.$el.on("woocommerce-product-addons-update",function(){n.validation.validate(),n.updateTotals()}),n.$el.find(".datepicker").each(function(){var e=f(this),a=e.parent(),o=a.find(".reset_date"),i=a.find('input[name="'+e.attr("name")+'-wc-pao-date"]'),t=a.find('input[name="'+e.attr("name")+'-wc-pao-date-gmt-offset"]'),a=(t.length||((t=f("<input/>")).attr("type","hidden"),t.attr("name",e.attr("name")+"-wc-pao-date-gmt-offset"),a.append(t)),new Date),n=parseFloat(woocommerce_addons_params.gmt_offset,10),s=a.getTimezoneOffset()/60,t=("default"===woocommerce_addons_params.date_input_timezone_reference?t.val(s):"store"===woocommerce_addons_params.date_input_timezone_reference&&(a.getHours(),a.getMinutes(),t.val(n)),e.datepicker({beforeShow:function(a,t){woocommerce_addons_params.datepicker_class&&(f("#ui-datepicker-div").removeClass(woocommerce_addons_params.datepicker_class),f("#ui-datepicker-div").addClass(woocommerce_addons_params.datepicker_class))},dateFormat:woocommerce_addons_params.datepicker_date_format,changeMonth:!0,changeYear:!0,yearRange:"c-100:c+10"}),e.datepicker("getDate"));null!==t&&"function"==typeof t.getTime&&(t.setHours(a.getHours(),a.getMinutes()),"store"===woocommerce_addons_params.date_input_timezone_reference&&(t=WC_PAO.Helper.addMinutes(t,-1*s*60),t=WC_PAO.Helper.addMinutes(t,60*n)),i.val(t.getTime()/1e3),o.show()),e.on("change",function(){var a,t=e.datepicker("getDate");null!==t&&"function"==typeof t.getTime?(a=new Date,t.setHours(a.getHours(),a.getMinutes()),"store"===woocommerce_addons_params.date_input_timezone_reference&&(t=WC_PAO.Helper.addMinutes(t,-1*s*60),t=WC_PAO.Helper.addMinutes(t,60*n)),i.val(t.getTime()/1e3),o.show()):(o.hide(),i.val(""))}),o.on("click",function(a){a.preventDefault(),i.val(""),e.val("").trigger("change")})}),n.$el.on("click",".reset_file",function(a){a.preventDefault();var a=f(this).closest(".wc-pao-addon-container"),t=a.find("input.wc-pao-addon-field"),a=a.find(".wc-pao-addon-file-name");a.length&&a.hide(250,function(){f(this).remove()}),f(this).removeClass("active").addClass("inactive"),t.data("value",""),t.val(""),n.validation.validateAddon(t,!0),n.updateTotals()}),f("#credit_called").on("keyup",function(){n.validation.validate(),n.updateTotals()})},e.prototype.updateImageSwatch=function(a){var t=a.data("value"),e=a.parents(".wc-pao-addon-wrap"),o=f.parseHTML(a.data("price")),i=e.find(".wc-pao-addon-image-swatch-selected-swatch");i.html(""),e.find(".wc-pao-addon-image-swatch").removeClass("selected").attr("aria-checked","false").attr("tabindex","-1"),a.addClass("selected").attr("aria-checked","true").attr("tabindex","0"),e.find(".wc-pao-addon-image-swatch-select").val(t),i.html(o),this.validation.validateAddon(e.find("select.wc-pao-addon-field"),!0),this.updateTotals()},e.prototype.updateTotals=function(){this.totals.calculate(),(this.show_incomplete_subtotals||this.isValid())&&(this.contains_required||this.totals.$totals.data("price_data").length)?this.totals.render():this.totals.reset()},e.prototype.isValid=function(){var a=!0;return this.$el.find("button.single_add_to_cart_button").is(".disabled")?a=!1:(f.each(this.validation.getValidationState(),function(){if(!this.validity)return a=!1}),a)},e.prototype.containsRequired=function(){var t=!1;return this.$addons.each(function(){var a=f(this).data("restrictions");if(!f.isEmptyObject(a)&&"required"in a&&"yes"===a.required)return t=!0}),t},o.prototype.showIncompleteSubtotals=function(){return 1===this.$totals.data("show-incomplete-sub-total")},o.prototype.updateVariation=function(a){this.$variation_input=!!this.$form.hasClass("variations_form")&&this.$form.find('input[name="variation_id"], input.variation_id'),this.product_id=a.variation_id,this.$totals.data("product-id",this.product_id),void 0!==a.display_price?this.base_price=a.display_price:f(a.price_html).find(".amount").last().length&&(this.base_price=f(a.price_html).find(".amount").last().text(),this.base_price=this.base_price.replace(woocommerce_addons_params.currency_format_symbol,""),this.base_price=this.base_price.replace(woocommerce_addons_params.currency_format_thousand_sep,""),this.base_price=this.base_price.replace(woocommerce_addons_params.currency_format_decimal_sep,"."),this.base_price=this.base_price.replace(/[^0-9\.]/g,""),this.base_price=parseFloat(this.base_price)),this.$totals.data("price",this.base_price)},o.prototype.calculate=function(){var m=this;m.qty=parseFloat(m.$form.find("input.qty").val()),m.addons_price_data=[],m.total=0,m.total_raw=0,m.base_price=m.$totals.data("price"),m.raw_price=m.$totals.data("raw-price"),m.product_id=m.is_variable?m.$variation_input.val():m.$totals.data("product-id"),""===m.base_price&&"undefined"!=typeof custom_gift_card_amount&&custom_gift_card_amount.length&&0<custom_gift_card_amount.val()&&(m.base_price=custom_gift_card_amount.val()),woocommerce_addons_params.is_bookings&&f(".wc-bookings-booking-cost").length&&(m.base_price=parseFloat(f(".wc-bookings-booking-cost").attr("data-raw-price"))),this.$addons.each(function(){var a=f(this),t=a.parents(".wc-pao-addon");if((!a.is(".wc-pao-addon-file-upload")||!t.find(".wc-pao-addon-file-name input").length||t.find(".wc-pao-addon-file-name input").val())&&(a.is(".wc-pao-addon-file-upload")&&t.find(".wc-pao-addon-file-name input").length||a.val())){var e,o,i,n=t.find(".wc-pao-addon-name").length?t.find(".wc-pao-addon-name").data("addon-name"):"",s="",d=0,r=0,c=a.data("price-type"),p=!1,l={},_=!!t.find(".wc-pao-addon-name").length&&t.find(".wc-pao-addon-name").data("has-per-person-pricing"),u=!!t.find(".wc-pao-addon-name").length&&t.find(".wc-pao-addon-name").data("has-per-block-pricing");if(a.is(".wc-pao-addon-custom-price"))p=!0,d=a.val(),r=a.val(),c="quantity_based","."!==woocommerce_addons_params.currency_format_decimal_sep&&(d=d.replace(woocommerce_addons_params.currency_format_decimal_sep,"."),r=r.replace(woocommerce_addons_params.currency_format_decimal_sep,"."));else if(a.is(".wc-pao-addon-input-multiplier"))""!==a.val()&&(a.val(Math.ceil(a.val())),d=a.data("price")*a.val(),r=a.data("raw-price")*a.val());else if(a.is(".wc-pao-addon-checkbox, .wc-pao-addon-radio")){if(!a.is(":checked"))return;s=a.data("label"),d=a.data("price"),r=a.data("raw-price")}else if(a.is(".wc-pao-addon-image-swatch-select, .wc-pao-addon-select")){if(!a.find("option:selected")||""===a.find("option:selected").val())return;c=a.find("option:selected").data("price-type"),s=a.find("option:selected").data("label"),d=a.find("option:selected").data("price"),r=a.find("option:selected").data("raw-price")}else{if(!a.is(".wc-pao-addon-file-upload")&&!a.val())return;d=a.data("price"),r=a.data("raw-price")}switch(d=d||0,r=r||0,"booking"!==m.product_type&&"accommodation-booking"!==m.product_type||!woocommerce_addons_params.is_bookings||(void(e=m.qty=0)!==f("#wc_bookings_field_duration")&&0<f("#wc_bookings_field_duration").val()&&(e=f("#wc_bookings_field_duration").val()),void 0!==f("#wc-bookings-form-end-time")&&0<f("#wc-bookings-form-end-time").val()&&(e=f("#wc-bookings-form-end-time").val()),i=f("#wc_bookings_field_persons"),o=0,1===i.length?o=parseInt(o,10)+parseInt(i.val(),10):f(".wc-bookings-booking-form").find("input").each(function(){var a=this.id.match(/wc_bookings_field_persons_(\d+)/);null!=a&&f("#"+a[0]).length&&(o=parseInt(o,10)+parseInt(f("#"+a[0]).val(),10))}),0===m.qty&&f(".wc-bookings-booking-cost").length&&(m.qty=1),_&&o&&(m.qty*=o),u&&e&&(m.qty*=e)),c){case"flat_fee":l.cost=parseFloat(d),l.cost_raw=parseFloat(r);break;case"quantity_based":l.cost_pu=parseFloat(d),l.cost_raw_pu=parseFloat(r),l.cost=l.cost_pu*m.qty,l.cost_raw=l.cost_raw_pu*m.qty;break;case"percentage_based":l.cost_pct=parseFloat(d)/100,l.cost_raw_pct=parseFloat(r)/100,l.cost=parseFloat(m.base_price)*l.cost_pct*m.qty,l.cost_raw=parseFloat(m.raw_price)*l.cost_raw_pct*m.qty}m.total+=l.cost||0,m.total_raw+=l.cost_raw||0,void 0!==s&&("number"==typeof s||s.length?(l.name=n+(s?" - "+s:""),l.nameFormattedHTML='<span class="wc-pao-addon-name">'+n+"</span>"+(s?' - <span class="wc-pao-addon-value">'+s+"</span>":"")):(i=a.val(),_=parseInt(woocommerce_addons_params.trim_user_input_characters,10),a.is(".wc-pao-addon-file-upload")?i=(i=t.find(".wc-pao-addon-file-name").length?t.find(".wc-pao-addon-file-name").data("value"):i).replace(/^.*[\\\/]/,""):a.is(".wc-pao-addon-custom-price")&&("."!==woocommerce_addons_params.currency_format_decimal_sep&&(i=i.replace(woocommerce_addons_params.currency_format_decimal_sep,".")),i=accounting.formatNumber(i,{symbol:"",decimal:woocommerce_addons_params.currency_format_decimal_sep,precision:parseFloat(i)%1==0?0:i.toString().split(".")[1].length})),_<i.length&&(i=i.slice(0,_)+"..."),l.name=n+" - "+WC_PAO.Helper.escapeHtml(i),l.nameFormattedHTML='<span class="wc-pao-addon-name">'+n+'</span> - <span class="wc-pao-addon-value">'+WC_PAO.Helper.escapeHtml(i)+"</span>"),l.is_custom_price=p,l.price_type=c,m.addons_price_data.push(l))}}),m.$totals.data("price_data",m.addons_price_data),m.$form.trigger("updated_addons")},o.prototype.render=function(){var a,e,o,t,i,n,s,d,r,c=this;c.$totals.data("show-sub-total")&&c.qty&&(c.formatMoney(c.total),o=!1,void 0!==c.base_price&&c.product_id&&(a=f(".wc-bookings-booking-form").length?isNaN(c.base_price)?0:parseFloat(c.base_price):parseFloat(c.base_price*c.qty),e=c.formatMoney(a+c.total)),c.has_subscription_plans?(t=c.$form.data("satt_script"))&&t.schemes_model.get_active_scheme_key()&&(t=c.$subscription_plans.find("input:checked")).val()&&(i=t.parent().find(".subscription-details")):c.$form.parent().find(".subscription-details").length&&!c.$form.hasClass("bundle_data")&&(i=c.$form.parent().find(".subscription-details"),c.$variation_input)&&0<c.$variation_input.length&&(i=c.$form.parent().find(".woocommerce-variation .subscription-details")),i&&0<i.length&&(n=" "+i.clone().wrap("<p>").parent().html()),"grouped"===c.product_type?n&&!WC_PAO.Helper.isGroupedMixedProductType()&&WC_PAO.Helper.isGroupedSubsSelected()&&e&&(e+=n):n&&e&&(e+=n),e)?(t=c.$form.find(".wc-pao-addon-container").data("product-name"),i=c.formatMoney(a),n=c.$form.find(".wc-pao-addon-container").data("product-tax-status"),s=f(".wc-bookings-booking-form").length?'<div class="product-addon-totals"><ul><li><div class="wc-pao-col1"><strong>'+t+'</strong></div><div class="wc-pao-col2"><strong><span class="amount">'+i+"</span></strong></div></li>":'<div class="product-addon-totals"><ul><li><div class="wc-pao-col1"><strong><span>'+(c.is_rtl?woocommerce_addons_params.quantity_symbol+c.qty:c.qty+woocommerce_addons_params.quantity_symbol)+"</span> "+t+'</strong></div><div class="wc-pao-col2"><strong><span class="amount">'+i+"</span></strong></div></li>",c.addons_price_data.length&&f.each(c.addons_price_data,function(a,t){var e=t.cost,e=0===e?"-":0<e?c.formatMoney(e):"-"+c.formatMoney(Math.abs(e));s=s+'<li><div class="wc-pao-col1"><strong>'+t.nameFormattedHTML+'</strong></div><div class="wc-pao-col2"><span class="amount">'+e+"</span></div></li>",woocommerce_addons_params.tax_enabled&&t.is_custom_price&&(o=!0)}),d="",r=void 0===c.$totals.data("i18n_sub_total")?woocommerce_addons_params.i18n_sub_total:c.$totals.data("i18n_sub_total"),o||woocommerce_addons_params.price_display_suffix&&woocommerce_addons_params.tax_enabled?"taxable"!==n||o||!1!=-1<woocommerce_addons_params.price_display_suffix.indexOf("{price_including_tax}")||!1!=-1<woocommerce_addons_params.price_display_suffix.indexOf("{price_excluding_tax}")?c.price_request=f.ajax({type:"POST",url:woocommerce_addons_params.ajax_url,data:{action:"wc_product_addons_calculate_tax",product_id:c.product_id,add_on_total:c.total,add_on_total_raw:c.total_raw,qty:c.qty},beforeSend:function(){null!=c.price_request&&c.price_request.abort()},complete:function(){c.price_request=null},success:function(a){var t;s="SUCCESS"==a.result?(d='<small class="woocommerce-price-suffix">'+woocommerce_addons_params.price_display_suffix+"</small>",t=c.formatMoney(a.price_including_tax),a=c.formatMoney(a.price_excluding_tax),d=(d=d.replace("{price_including_tax}",'<span class="amount">'+t+"</span>")).replace("{price_excluding_tax}",'<span class="amount">'+a+"</span>"),t=woocommerce_addons_params.display_include_tax?t:a,s+'<li class="wc-pao-subtotal-line"><p class="price">'+r+' <span class="amount">'+t+"</span> "+d+" </p></li></ul></div>"):s+'<li class="wc-pao-subtotal-line"><p class="price">'+r+' <span class="amount">'+e+"</span></p></li></ul></div>",c.show_subtotal_panel?c.$totals.html(s):c.$totals.html(""),c.$form.trigger("updated_addons")},error:function(){s=s+'<li class="wc-pao-subtotal-line"><p class="price">'+r+' <span class="amount">'+e+"</span></p></li></ul></div>",c.show_subtotal_panel?c.$totals.html(s):c.$totals.html(""),c.$form.trigger("updated_addons")}}):(s=s+'<li class="wc-pao-subtotal-line"><strong>'+r+' <span class="amount">'+e+"</span> "+woocommerce_addons_params.price_display_suffix+"</strong></li></ul></div>",c.show_subtotal_panel?c.$totals.html(s):c.$totals.html(""),c.$form.trigger("updated_addons")):(s=s+'<li class="wc-pao-subtotal-line"><p class="price">'+r+' <span class="amount">'+e+"</span></p></li></ul></div>",c.show_subtotal_panel?c.$totals.html(s):c.$totals.html(""),c.$form.trigger("updated_addons"))):(c.$totals.empty(),c.$form.trigger("updated_addons"))},o.prototype.reset=function(){this.$totals.empty(),this.$totals.html(""),this.$form.trigger("updated_addons")},o.prototype.formatMoney=function(a){let t=woocommerce_addons_params.currency_format_num_decimals;var e;return woocommerce_addons_params.trim_trailing_zeros&&(e=parseFloat(a)%1==0,a=parseFloat(a),t=e?0:a.toString().split(".")[1].length),accounting.formatMoney(a,{symbol:woocommerce_addons_params.currency_format_symbol,decimal:woocommerce_addons_params.currency_format_decimal_sep,thousand:woocommerce_addons_params.currency_format_thousand_sep,precision:t,format:woocommerce_addons_params.currency_format})},e),f(function(){f("body").on("quick-view-displayed",function(){f(this).find(".cart:not(.cart_group)").each(function(){new WC_PAO.Form(f(this))})}),f("body").find(".cart:not(.cart_group)").each(function(){new WC_PAO.Form(f(this))})})})(jQuery,window);
(function(){
jQuery(document).ready(function($){
crResizeAllGridItems();
crResizeTrustBadges();
jQuery("form#commentform").attr("enctype", "multipart/form-data").attr("encoding", "multipart/form-data");
jQuery("#commentform").on("submit", function(event){
if(cr_ajax_object.ivole_recaptcha==='1'){
var recaptcha=jQuery("#g-recaptcha-response").val();
if(recaptcha===""){
event.preventDefault();
alert("Please confirm that you are not a robot");
}}
});
jQuery("ol.commentlist").on("click", ".cr-comment-a", function(t){
if(cr_ajax_object.disable_lightbox==='0'){
t.preventDefault();
const oo=jQuery(".pswp");
if(0 < oo.length){
const o=oo[0];
var pics=jQuery(this).parent().parent().find(".cr-comment-a img");
var this_pic=jQuery(this).find("img");
var inx=0;
if(pics.length > 0&&this_pic.length > 0){
var a=[];
for (i=0; i < pics.length; i++){
a.push({
src: pics[i].src,
w: pics[i].naturalWidth,
h: pics[i].naturalHeight,
title: pics[i].alt
});
if(this_pic[0].src==pics[i].src){
inx=i;
}}
var r={
index: inx
};
new PhotoSwipe(o, PhotoSwipeUI_Default, a, r).init();
}}
}});
jQuery(".cr-reviews-grid").on("click", ".image-row-vid, .cr-comment-videoicon", function(t){
if(! jQuery(this).closest(".image-row").hasClass("cr-vid-playing") ){
jQuery(this).closest(".image-row").addClass("cr-vid-playing");
jQuery(this).closest(".image-row").find(".image-row-vid").prop("controls", true);
jQuery(this).closest(".image-row").find(".image-row-vid").get(0).play();
}else{
jQuery(this).closest(".image-row").find(".image-row-vid").get(0).pause();
jQuery(this).closest(".image-row").find(".image-row-vid").prop("controls", false);
jQuery(this).closest(".image-row").removeClass("cr-vid-playing");
}
return false;
});
jQuery(".cr-ajax-reviews-cus-images-modal").on("click", ".cr-ajax-reviews-video, .cr-ajax-reviews-video .cr-comment-videoicon", function(t){
if(! jQuery(this).closest(".cr-ajax-reviews-video").hasClass("cr-vid-playing") ){
jQuery(this).closest(".cr-ajax-reviews-video").addClass("cr-vid-playing");
jQuery(this).closest(".cr-ajax-reviews-video").find("video").prop("controls", true);
jQuery(this).closest(".cr-ajax-reviews-video").find("video").get(0).play();
}else{
jQuery(this).closest(".cr-ajax-reviews-video").find("video").get(0).pause();
jQuery(this).closest(".cr-ajax-reviews-video").find("video").prop("controls", false);
jQuery(this).closest(".cr-ajax-reviews-video").removeClass("cr-vid-playing");
}
return false;
});
jQuery(".cr-reviews-grid").on("click", ".media-row-count", function(t){
if(cr_ajax_object.disable_lightbox==='0'){
t.preventDefault();
const oo=jQuery(".pswp");
let media=jQuery(this).parent().find(".image-row-vid,.image-row-img"),
this_media=jQuery(this),
inx=0;
if(media.length > 0&&this_media.length > 0){
const o=oo[0];
var a=[];
for (i=0; i < media.length; i++){
if("vid"===media[i].dataset.crmedia){
a.push({
html: '<div class="cr-video-wrapper"><video class="cr-media-video" src="' + media[i].src + '" controls></video></div>',
title: media[i].dataset.crtitle
});
}else{
a.push({
src: media[i].src,
w: media[i].naturalWidth,
h: media[i].naturalHeight,
title: media[i].alt
});
}
if(this_media[0].src==media[i].src){
inx=i;
}}
var r={
index: inx
};
new PhotoSwipe(o, PhotoSwipeUI_Default, a, r).init();
}}
});
jQuery(document).on("click", ".cr-video-wrapper .cr-media-video", function(t){
const vid=jQuery(this).get(0);
if(vid){
const isVideoPlaying = !!(vid.currentTime > 0&&!vid.paused&&!vid.ended&&vid.readyState > 2);
if(isVideoPlaying){
vid.pause();
}else{
vid.play();
}}
return false;
});
jQuery(".cr-reviews-grid").on("click", ".image-row-img, .image-row-count", function(t){
if(cr_ajax_object.disable_lightbox==='0'){
t.preventDefault();
const oo=jQuery(".pswp");
if(0 < oo.length){
const o=oo[0];
var pics=jQuery(this).parent().find("img.image-row-img");
var this_pic=jQuery(this);
var inx=0;
if(pics.length > 0&&this_pic.length > 0){
var a=[];
for (i=0; i < pics.length; i++){
a.push({
src: pics[i].src,
w: pics[i].naturalWidth,
h: pics[i].naturalHeight,
title: pics[i].alt
});
if(this_pic[0].src==pics[i].src){
inx=i;
}}
var r={
index: inx
};
new PhotoSwipe(o, PhotoSwipeUI_Default, a, r).init();
}}
}});
initVoteClick("ol.commentlist", ".cr-voting-a", "cr_vote_review");
initVoteClick(".cr-ajax-reviews-cus-images-modal", ".cr-voting-a", "cr_vote_review");
initVoteClick(".cr-qna-block .cr-qna-list-block", ".cr-voting-a", "cr_vote_question");
jQuery("ol.commentlist").on("click", ".cr-video-a, .cr-comment-videoicon", function(t){
if(! jQuery(this).closest(".cr-comment-videos").hasClass("cr-comment-videos-modal") ){
let tt=jQuery(this).closest("[class*='cr-comment-video-']");
jQuery(this).closest(".cr-comment-videos").addClass("cr-comment-videos-modal");
tt.addClass("cr-comment-video-modal");
tt.find("video").prop("controls", true);
tt.find(".cr-comment-videoicon").hide();
tt.find("video").get(0).play();
return false;
}
return false;
});
jQuery("ol.commentlist").on("click", ".cr-comment-videos", function(t){
if(jQuery(this).hasClass("cr-comment-videos-modal") ){
jQuery(this).removeClass("cr-comment-videos-modal");
jQuery(this).find("[class*='cr-comment-video-']").each(function(index, element){
if(jQuery(element).hasClass("cr-comment-video-modal") ){
jQuery(element).removeClass("cr-comment-video-modal");
jQuery(element).find("video").get(0).pause();
jQuery(element).find("video").prop("controls", false);
jQuery(element).find(".cr-comment-videoicon").show();
jQuery(element).removeAttr("style");
}});
return false;
}});
jQuery(".cr-show-more-reviews-prd").on("click", function(t){
t.preventDefault();
crShowMoreReviewsPrd(jQuery(this));
});
jQuery(".cr-ajax-reviews-sort").on("change", function(t){
t.preventDefault();
if(jQuery(this).parents(".cr-all-reviews-shortcode").length){
cr_filter_all_reviews(jQuery(this));
}else{
var cr_product_id=jQuery(this).parents(".cr-reviews-ajax-comments").find(".commentlist.cr-ajax-reviews-list").attr("data-product");
var cr_sort=jQuery(this).children("option:selected").val();
var cr_rating=jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-summaryBox-ajax .ivole-histogramRow.ivole-histogramRow-s .cr-histogram-a").attr("data-rating");
if(!cr_rating){
cr_rating=0;
}
var cr_data={
"action": "cr_sort_reviews",
"productID": cr_product_id,
"sort": cr_sort,
"rating": cr_rating
};
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-search-no-reviews").hide();
jQuery(this).parents(".cr-reviews-ajax-comments").find('.cr-ajax-search input').val("").trigger("change");
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-show-more-reviews-prd").hide();
jQuery(this).parents(".cr-reviews-ajax-comments").find(".commentlist.cr-ajax-reviews-list").hide();
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-show-more-review-spinner").show();
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-summaryBox-ajax").addClass("cr-summaryBar-updating");
jQuery(this).addClass("cr-sort-updating");
jQuery.post({
url: cr_ajax_object.ajax_url,
data: cr_data,
context: this,
success: function(response){
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-show-more-review-spinner").hide();
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-summaryBox-ajax").removeClass("cr-summaryBar-updating");
jQuery(this).removeClass("cr-sort-updating");
if(response.page > 0){
jQuery(this).parents(".cr-reviews-ajax-comments").find(".commentlist.cr-ajax-reviews-list").empty();
jQuery(this).parents(".cr-reviews-ajax-comments").find(".commentlist.cr-ajax-reviews-list").append(response.html);
jQuery(this).parents(".cr-reviews-ajax-comments").find(".commentlist.cr-ajax-reviews-list").show();
jQuery(this).parents(".cr-reviews-ajax-comments").attr("data-page",response.page);
if(response.show_more_label){
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-show-more-reviews-prd").text(response.show_more_label);
}
if(response.count_row){
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-count-row .cr-count-row-count").html(response.count_row);
}
if(!response.last_page){
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-show-more-reviews-prd").show();
}}
},
dataType: "json"
});
}});
jQuery(".cr-noAjax").on("click", ".cr-histogram-a", function (t){
t.preventDefault();
const parser=new URL(window.location);
parser.searchParams.set(cr_ajax_object.rating_filter, jQuery(this).data("rating"));
parser.hash=cr_ajax_object.reviews_tab;
window.location=parser.href;
});
jQuery(".cr-reviews-ajax-comments").on("click", ".cr-histogram-a, .cr-seeAllReviews", function(t){
t.preventDefault();
let tmpParent=jQuery(this).parents(".cr-reviews-ajax-comments");
let cr_product_id=tmpParent.find(".commentlist.cr-ajax-reviews-list").attr("data-product");
let cr_nonce=tmpParent.find(".cr-summaryBox-ajax").attr("data-nonce");
let cr_rating=jQuery(this).attr("data-rating");
let cr_sort=tmpParent.find(".cr-ajax-reviews-sort").children("option:selected").val();
let cr_data={
"action": "cr_filter_reviews",
"productID": cr_product_id,
"rating": cr_rating,
"sort": cr_sort,
"security": cr_nonce
};
tmpParent.find(".cr-summaryBox-ajax .ivole-histogramRow.ivole-histogramRow-s").removeClass("ivole-histogramRow-s");
if(cr_rating > 0){
jQuery(this).closest(".ivole-histogramRow").addClass("ivole-histogramRow-s");
}
tmpParent.find(".cr-search-no-reviews").hide();
tmpParent.find('.cr-ajax-search input').val("").trigger("change");
tmpParent.find(".cr-show-more-reviews-prd").hide();
tmpParent.find(".commentlist.cr-ajax-reviews-list").hide();
tmpParent.find(".cr-show-more-review-spinner").show();
tmpParent.find(".cr-summaryBox-ajax").addClass("cr-summaryBar-updating");
tmpParent.find(".cr-ajax-reviews-sort").addClass("cr-sort-updating");
jQuery.post({
url: cr_ajax_object.ajax_url,
data: cr_data,
context: tmpParent,
success: function(response){
this.find(".cr-show-more-review-spinner").hide();
this.find(".cr-summaryBox-ajax").removeClass("cr-summaryBar-updating");
this.find(".cr-ajax-reviews-sort").removeClass("cr-sort-updating");
if(response.page > 0){
this.find(".commentlist.cr-ajax-reviews-list").empty();
this.find(".commentlist.cr-ajax-reviews-list").append(response.html);
this.find(".commentlist.cr-ajax-reviews-list").show();
this.attr("data-page",response.page);
if(response.show_more_label){
this.find(".cr-show-more-reviews-prd").text(response.show_more_label);
}
if(response.count_row){
this.find(".cr-count-row .cr-count-row-count").html(response.count_row);
}
if(!response.last_page){
this.find(".cr-show-more-reviews-prd").show();
}}
},
dataType: "json"
});
});
jQuery('.cr-ajax-search input').on("keyup", function(e){
if(e.keyCode==13){
jQuery(this).parents(".cr-ajax-search").find("button").trigger("click");
}
if(jQuery(this).val()!==""){
jQuery(this).parents(".cr-ajax-search").find(".cr-clear-input").css("display", "inline-block");
}else{
jQuery(this).parents(".cr-ajax-search").find(".cr-clear-input").css("display", "none");
}}).on("change", function(){
if(jQuery(this).val()==="") jQuery(this).parents(".cr-ajax-search").find(".cr-clear-input").hide();
});
jQuery('.cr-reviews-ajax-reviews .cr-ajax-search input').on('keyup', crDebounce(
(ref)=> {
jQuery(ref.target).parents(".cr-reviews-ajax-comments").attr("data-page", 0);
jQuery(ref.target).parents(".cr-reviews-ajax-reviews").find(".cr-ajax-reviews-list").empty();
crShowMoreReviewsPrd(jQuery(ref.target));
},
1000
));
jQuery(".cr-ajax-search .cr-clear-input").on("click", function (){
jQuery(this).prev("input").val("");
jQuery(this).parents(".cr-ajax-search").find(".cr-clear-input").hide();
jQuery(this).parents(".cr-ajax-search").find("button").trigger("click");
if(jQuery(this).parents(".cr-reviews-ajax-reviews").length){
jQuery(this).parents(".cr-reviews-ajax-comments").attr("data-page", 0);
jQuery(this).parents(".cr-reviews-ajax-reviews").find(".cr-ajax-reviews-list").empty();
crShowMoreReviewsPrd(jQuery(this));
}});
jQuery(".cr-ajax-search button").on("click", function (e){
e.preventDefault();
if(jQuery(this).parents(".cr-all-reviews-shortcode").length){
cr_filter_all_reviews(jQuery(this));
}else{
jQuery(this).parents(".cr-reviews-ajax-comments").attr("data-page", 0);
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-ajax-reviews-list").empty();
crShowMoreReviewsPrd(jQuery(this));
}});
jQuery(".cr-ajax-reviews-add-review, .cr-nosummary-add").on("click", function(t){
t.preventDefault();
jQuery(this).closest(".cr-reviews-ajax-reviews").find(".cr-reviews-ajax-comments").hide();
jQuery(this).closest(".cr-reviews-ajax-reviews").find(".cr-ajax-reviews-review-form").show();
});
jQuery(".cr-review-tags-filter span.cr-tags-filter").on("click", function (e){
e.preventDefault();
if(jQuery(this).hasClass("cr-tag-selected")){
jQuery(this).removeClass("cr-tag-selected");
}else{
jQuery(this).addClass("cr-tag-selected");
}
if(jQuery(this).parents(".cr-all-reviews-shortcode").length){
cr_filter_all_reviews(jQuery(this));
}else{
jQuery(this).parents(".cr-reviews-ajax-comments").attr("data-page", 0);
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-ajax-reviews-list").empty();
crShowMoreReviewsPrd(jQuery(this));
}});
jQuery(".cr-comment-image-top .cr-comment-image-top-item").on("click", function(t){
t.preventDefault();
jQuery("body").addClass("cr-noscroll");
let slide_no=jQuery(this).data("slide");
let imgParent=jQuery(this).closest(".cr-ajax-reviews-cus-images-div").parent();
imgParent.find(".cr-ajax-reviews-cus-images-modal-cont").addClass("cr-mask-active");
imgParent.find(".cr-ajax-reviews-cus-images-modal .cr-ajax-reviews-cus-images-slider-main").slickk('setPosition');
imgParent.find(".cr-ajax-reviews-cus-images-modal .cr-ajax-reviews-cus-images-slider-nav").slickk('setPosition');
if(typeof slide_no!=='undefined'){
imgParent.find(".cr-ajax-reviews-cus-images-modal .cr-ajax-reviews-cus-images-slider-main").slickk('slickGoTo', slide_no, true);
imgParent.find(".cr-ajax-reviews-cus-images-modal .cr-ajax-reviews-cus-images-slider-nav").slickk('slickGoTo', slide_no, true);
}});
jQuery(".cr-comment-image-top .cr-comment-videoicon").on("click", function(t){
jQuery(this).closest(".cr-comment-image-top").find(".cr-comment-image-top-item").trigger("click");
});
jQuery(".cr-ajax-reviews-cus-images-modal-cont, .cr-ajax-reviews-cus-images-modal .cr-ajax-reviews-cus-images-close").on("click", function(t){
t.preventDefault();
let closeParent=jQuery(this).closest(".cr-ajax-reviews-cus-images-modal-cont.cr-mask-active");
closeParent.find(".cr-ajax-reviews-cus-images-modal .cr-ajax-reviews-cus-images-slider-main").slickk('slickGoTo',0,true);
closeParent.find(".cr-ajax-reviews-cus-images-modal .cr-ajax-reviews-cus-images-slider-nav").slickk('slickGoTo',0,true);
closeParent.removeClass("cr-mask-active");
jQuery("body").removeClass("cr-noscroll");
});
jQuery(".cr-ajax-reviews-cus-images-modal-cont .cr-ajax-reviews-cus-images-modal").on("click", function(t){
t.stopPropagation();
});
jQuery(".single_variation_wrap").on("show_variation", function(event, variation){
if(jQuery(".cr_gtin").length){
jQuery(".cr_gtin_val").text(variation._cr_gtin);
}
if(jQuery(".cr_mpn").length){
jQuery(".cr_mpn_val").text(variation._cr_mpn);
}
if(jQuery(".cr_brand").length){
jQuery(".cr_brand_val").text(variation._cr_brand);
}});
jQuery(document).on('reset_data', function (){
var cr_gtin=jQuery(".cr_gtin"),
cr_mpn=jQuery(".cr_mpn"),
cr_brand=jQuery(".cr_brand");
if(cr_gtin.length){
jQuery(".cr_gtin_val").text(cr_gtin.data("o_content"));
}
if(cr_mpn.length){
jQuery(".cr_mpn_val").text(cr_mpn.data("o_content"));
}
if(cr_brand.length){
jQuery(".cr_brand_val").text(cr_brand.data("o_content"));
}});
jQuery('.cr-all-reviews-shortcode .cr-show-more-button').on("click", function (e){
e.preventDefault();
cr_filter_all_reviews(jQuery(this), true);
});
jQuery('.cr-all-reviews-shortcode').on("click", ".cr-page-numbers-a", function (e){
e.preventDefault();
cr_filter_all_reviews(jQuery(this), true);
});
jQuery(".cr-all-reviews-shortcode").on("click", ".cr-histogram-a, .cr-seeAllReviews", function(t){
t.preventDefault();
let cr_rating=jQuery(this).data("rating");
jQuery("div.ivole-summaryBox .ivole-histogramRow.ivole-histogramRow-s").removeClass("ivole-histogramRow-s");
if(cr_rating > 0){
jQuery(this).closest(".ivole-histogramRow").addClass("ivole-histogramRow-s");
}
jQuery(this).parents(".cr-all-reviews-shortcode").find(".cr-review-tags-filter .cr-tag-selected").removeClass("cr-tag-selected");
cr_filter_all_reviews(jQuery(this));
});
jQuery(".cr-reviews-grid .cr-show-more-button").on("click", function (e){
e.preventDefault();
let $this=jQuery(this),
$spinner=$this.next(".cr-show-more-spinner"),
cr_rating=$this.parents(".cr-reviews-grid").find(".ivole-summaryBox.cr-grid-reviews-ajax .ivole-histogramRow.ivole-histogramRow-s .cr-histogram-a").attr("data-rating"),
attributes=$this.parents(".cr-reviews-grid").data("attributes");
attributes.comment__not_in=$this.parents(".cr-reviews-grid").find(".cr-review-card.cr-card-product").map(function(){
return jQuery(this).data("reviewid");
}).get();
attributes.comment__not_in=attributes.comment__not_in.concat($this.parents(".cr-reviews-grid").find(".cr-review-card.cr-card-shop").map(function(){
return jQuery(this).data("reviewid");
}).get());
var grid_data={
'action': "ivole_show_more_grid_reviews",
'rating': cr_rating,
'attributes': attributes
};
$this.hide();
$spinner.show();
jQuery.post(cr_ajax_object.ajax_url, grid_data, function(response){
$spinner.hide();
$reviews=jQuery(response.html).find(".cr-review-card");
let showMoreBtn=jQuery(response.html).find(".cr-show-more-button");
if($reviews.length){
$this.parents(".cr-reviews-grid").find(".cr-reviews-grid-inner").colcade("append", $reviews);
if(showMoreBtn.length){
$this.text(showMoreBtn.text());
$this.show();
}else{
$this.hide();
}}else{
$this.hide();
}}).fail(function(response){
$spinner.hide();
$this.show();
$this.parent().append('<div style="color:#cd2653;text-align:center;display:block;">'+response.responseText+'</div>');
});
});
jQuery(".cr-reviews-grid .cr-summaryBox-wrap").on("click", ".cr-histogram-a, .cr-seeAllReviews", function(e){
e.preventDefault();
let $this=jQuery(this),
$grid=$this.parents(".cr-reviews-grid"),
$spinner=$grid.find(".cr-show-more-spinner"),
cr_rating=$this.attr("data-rating"),
attributes=$grid.data("attributes");
attributes.show_more=attributes.count + attributes.count_shop_reviews;
attributes.comment__not_in=[];
if(!cr_rating) cr_rating=0;
var grid_data={
'action': "ivole_show_more_grid_reviews",
'rating': cr_rating,
'attributes': attributes
};
$grid.find("div.ivole-summaryBox .ivole-histogramRow.ivole-histogramRow-s").removeClass("ivole-histogramRow-s");
if(cr_rating > 0){
$this.closest(".ivole-histogramRow").addClass("ivole-histogramRow-s");
}
$grid.find(".cr-reviews-grid-inner").hide();
$grid.find(".cr-show-more-button").hide();
$spinner.show();
$grid.find("div.ivole-summaryBox").addClass("cr-summaryBar-updating");
jQuery.post(cr_ajax_object.ajax_url, grid_data, function(response){
$spinner.hide();
$grid.find(".cr-show-more-button").show();
$grid.find(".cr-summaryBox-wrap .cr-count-filtered-reviews").empty();
$reviews=jQuery(response.html).find(".cr-review-card");
if($reviews.length){
$grid.find(".cr-reviews-grid-inner").colcade("empty");
$grid.find(".cr-reviews-grid-inner").show();
$grid.find(".cr-reviews-grid-inner").colcade("append", $reviews);
$grid.find("div.ivole-summaryBox").removeClass("cr-summaryBar-updating");
$grid.find(".cr-summaryBox-wrap .cr-count-filtered-reviews").append(jQuery(response.html).find(".cr-count-filtered-reviews").html());
}}).fail(function(response){
$spinner.hide();
$this.parent().append('<div style="color: #cd2653;text-align: center;display: block;">'+response.responseText+'</div>');
});
});
jQuery('#cr_floatingtrustbadge').on("click", function(){
if(!jQuery(this).hasClass('cr-floatingbadge-big') ){
jQuery(this).find('div.cr-badge.badge_size_compact').hide();
jQuery(this).find('div.cr-badge.badge--wide-mobile').css('display', 'block');
jQuery(this).find('div.cr-floatingbadge-close').css('display', 'block');
jQuery(this).addClass('cr-floatingbadge-big');
var crcolors=jQuery(this).data('crcolors');
if(typeof crcolors!=='undefined'){
jQuery(this).css('border-color', crcolors['big']['border']);
jQuery(this).find('div.cr-floatingbadge-background-top').css('background-color', crcolors['big']['top']);
jQuery(this).find('div.cr-floatingbadge-background-middle').css('background-color', crcolors['big']['middle']);
jQuery(this).find('div.cr-floatingbadge-background-bottom').css('background-color', crcolors['big']['bottom']);
jQuery(this).find('div.cr-floatingbadge-background-bottom').css('border-color', crcolors['big']['border']);
}}
});
jQuery('#cr_floatingtrustbadge .cr-floatingbadge-close').on("click", function(event){
if(jQuery('#cr_floatingtrustbadge').hasClass('cr-floatingbadge-big') ){
jQuery(this).closest('#cr_floatingtrustbadge').find('div.cr-badge.badge--wide-mobile').hide();
jQuery(this).closest('#cr_floatingtrustbadge').find('div.cr-badge.badge_size_compact').css('display', 'block');
jQuery(this).closest('#cr_floatingtrustbadge').removeClass('cr-floatingbadge-big');
var crcolors=jQuery(this).closest('#cr_floatingtrustbadge').data('crcolors');
if(typeof crcolors!=='undefined'){
jQuery(this).closest('#cr_floatingtrustbadge').css('border-color', crcolors['small']['border']);
jQuery(this).closest('#cr_floatingtrustbadge').find('div.cr-floatingbadge-background-top').css('background-color', crcolors['small']['top']);
jQuery(this).closest('#cr_floatingtrustbadge').find('div.cr-floatingbadge-background-middle').css('background-color', crcolors['small']['middle']);
jQuery(this).closest('#cr_floatingtrustbadge').find('div.cr-floatingbadge-background-bottom').css('background-color', crcolors['small']['bottom']);
jQuery(this).closest('#cr_floatingtrustbadge').find('div.cr-floatingbadge-background-bottom').css('border-color', crcolors['small']['border']);
}}else{
jQuery('#cr_floatingtrustbadge').hide();
document.cookie='cr_hide_trustbadge=true; path=/; max-age='+60*60*24+';';
}
event.stopPropagation();
});
jQuery('.cr-reviews-slider').on('click', '.cr-slider-read-more a', function (e){
e.preventDefault();
let parent=jQuery(this).parents(".review-text");
parent.find(".cr-slider-read-more").hide();
parent.find(".cr-slider-details").css("display", "inline");
jQuery(this).parents(".cr-reviews-slider").slickk('setPosition');
});
jQuery('.cr-reviews-slider').on('click', '.cr-slider-read-less a', function (e){
e.preventDefault();
let parent=jQuery(this).parents(".review-text");
parent.find(".cr-slider-details").hide();
parent.find(".cr-slider-read-more").css("display", "inline");
jQuery(this).parents(".cr-reviews-slider").slickk('setPosition');
});
jQuery('.cr-reviews-grid').on('click', '.cr-grid-read-more a', function (e){
e.preventDefault();
let parent=jQuery(this).parents(".review-content");
if(0===parent.length){
parent=jQuery(this).parents(".cr-grid-reply-content");
}
parent.find(".cr-grid-read-more").hide();
parent.find(".cr-grid-details").css("display", "inline");
});
jQuery('.cr-reviews-grid').on('click', '.cr-grid-read-less a', function (e){
e.preventDefault();
let parent=jQuery(this).parents(".review-content");
if(0===parent.length){
parent=jQuery(this).parents(".cr-grid-reply-content");
}
parent.find(".cr-grid-details").hide();
parent.find(".cr-grid-read-more").css("display", "inline");
});
jQuery('.cr-qna-block .cr-qna-search-block .cr-qna-ask-button').on('click', function (e){
e.preventDefault();
jQuery(this).closest('.cr-qna-block').addClass('cr-qna-new-q-form-open');
});
jQuery(".cr-qna-block .cr-qna-list-block").on("click", ".cr-qna-ans-button", function (e){
e.preventDefault();
let nameField=jQuery(this).closest('.cr-qna-block').find(".cr-qna-new-q-form .cr-review-form-name");
let nameValue=nameField.find(".cr-review-form-txt").data("defval");
jQuery(this).closest('.cr-qna-list-q-b').find(".cr-qna-list-inl-answ .cr-review-form-name .cr-review-form-txt").val(nameValue);
let emailField=jQuery(this).closest('.cr-qna-block').find(".cr-qna-new-q-form .cr-review-form-email");
let emailValue=emailField.find(".cr-review-form-txt").data("defval");
jQuery(this).closest('.cr-qna-list-q-b').find(".cr-qna-list-inl-answ .cr-review-form-email .cr-review-form-txt").val(emailValue);
jQuery(this).closest('.cr-qna-list-q-b').addClass('cr-qna-ans-form-open');
});
jQuery(".cr-qna-block").on("click", ".cr-show-more-que", function(t){
t.preventDefault();
let qna_block=jQuery(this).parents(".cr-qna-block").eq(0);
let cr_product_id=jQuery(this).attr("data-product");
let cr_page=jQuery(this).attr("data-page");
let cr_attributes=qna_block.data("attributes");
let cr_search=qna_block.find(".cr-ajax-qna-search input").val();
let cr_permalink=jQuery(this).attr("data-permalink");
let cr_data={
"action": "cr_show_more_qna",
"productID": cr_product_id,
"page": cr_page,
"permalink": cr_permalink,
"search": cr_search,
"cr_attributes": cr_attributes
};
qna_block.find(".cr-search-no-qna").hide();
jQuery(this).hide();
qna_block.find("#cr-show-more-q-spinner").show();
jQuery.post(cr_ajax_object.ajax_url, cr_data, function(response){
jQuery(".cr-qna-block #cr-show-more-q-spinner").hide();
if(response.page >=0){
jQuery(".cr-qna-block .cr-qna-list-block .cr-qna-list-block-inner").append(response.html);
jQuery(".cr-qna-block #cr-show-more-q-id").attr("data-page",response.page);
if(!response.last_page){
jQuery(".cr-qna-block #cr-show-more-q-id").show();
}}
if(response.html===""&&response.page===0){
jQuery(".cr-qna-block .cr-search-no-qna").show();
}}, "json");
});
jQuery(".cr-qna-block .cr-ajax-qna-search input").on("keyup", cr_keyup_delay(function(e){
var code=(e.keyCode||e.which);
if(code==37||code==38||code==39||code==40){
return;
}
jQuery(".cr-qna-block #cr-show-more-q-id").attr("data-page", -1);
jQuery(".cr-qna-block .cr-qna-list-block .cr-qna-list-block-inner").empty();
jQuery(".cr-qna-block #cr-show-more-q-id").trigger("click");
}, 500));
jQuery(".cr-qna-block .cr-ajax-qna-search input").on("keyup", function(e){
if(jQuery(this).val()!==""){
jQuery(".cr-qna-block .cr-ajax-qna-search .cr-clear-input").css("display", "inline-block");
}else{
if(jQuery(this).val()==="") jQuery(".cr-qna-block .cr-ajax-qna-search .cr-clear-input").hide();
}}).on("change", function(){
if(jQuery(this).val()==="") jQuery(".cr-qna-block .cr-ajax-qna-search .cr-clear-input").hide();
});
jQuery(".cr-qna-block .cr-ajax-qna-search .cr-clear-input").on("click", function (){
jQuery(this).prev("input").val("");
jQuery(".cr-qna-block .cr-ajax-qna-search .cr-clear-input").hide();
jQuery(".cr-qna-block #cr-show-more-q-id").attr("data-page", -1);
jQuery(".cr-qna-block .cr-qna-list-block .cr-qna-list-block-inner").empty();
jQuery(".cr-qna-block #cr-show-more-q-id").trigger("click");
});
jQuery("body").on("click", "a.cr-qna-link", function (){
const cr_qna_tab=jQuery('.cr_qna_tab a');
if(cr_qna_tab.length){
cr_qna_tab.trigger("click");
}else{
jQuery('.cr-qna-block').parents(':hidden').show();
}
return true;
});
jQuery("body").on("click", ".cr-review-link", function (){
const wc_reviews_tab=jQuery('.reviews_tab a');
if(wc_reviews_tab.length){
wc_reviews_tab.trigger("click");
return true;
}});
jQuery("#cr_review_image").on("change", function (){
jQuery(".cr-upload-images-status").removeClass("cr-upload-images-status-error");
jQuery(".cr-upload-images-status").text(cr_ajax_object.cr_upload_initial);
let allowedTypes=['image/jpeg', 'image/png', 'image/jpg', 'image/gif', 'video/mp4', 'video/mpeg', 'video/ogg', 'video/webm', 'video/quicktime', 'video/x-msvideo'];
let uploadFiles=jQuery("#cr_review_image");
let countFiles=uploadFiles[0].files.length;
let countUploaded=jQuery(".cr-upload-images-preview .cr-upload-images-containers").length;
let lastIndex=1;
let cr_captcha="";
if(jQuery(this).attr("data-lastindex")){
lastIndex=parseInt(jQuery(this).attr("data-lastindex"));
}
if(countFiles + countUploaded > cr_ajax_object.cr_images_upload_limit){
jQuery(".cr-upload-images-status").addClass("cr-upload-images-status-error");
jQuery(".cr-upload-images-status").text(cr_ajax_object.cr_upload_error_too_many);
jQuery(".cr-upload-images-preview .cr-upload-images-containers").not(".cr-upload-ok").remove();
uploadFiles.val("");
return;
}
for(let i=0; i < countFiles; i++){
if(!allowedTypes.includes(uploadFiles[0].files[i].type)){
jQuery(".cr-upload-images-status").addClass("cr-upload-images-status-error");
jQuery(".cr-upload-images-status").text(cr_ajax_object.cr_upload_error_file_type);
jQuery(".cr-upload-images-preview .cr-upload-images-containers").not(".cr-upload-ok").remove();
uploadFiles.val("");
return;
}else if(uploadFiles[0].files[i].size&&uploadFiles[0].files[i].size > cr_ajax_object.cr_images_upload_max_size){
jQuery(".cr-upload-images-status").addClass("cr-upload-images-status-error");
jQuery(".cr-upload-images-status").text(cr_ajax_object.cr_upload_error_file_size);
jQuery(".cr-upload-images-preview .cr-upload-images-containers").not(".cr-upload-ok").remove();
uploadFiles.val("");
return;
}else{
let container=jQuery("<div/>", {class:"cr-upload-images-containers cr-upload-images-container-" + (lastIndex + i)});
let progressBar=jQuery("<div/>", {class:"cr-upload-images-pbar"});
progressBar.append(jQuery("<div/>", {class:"cr-upload-images-pbarin"})
);
if(-1===uploadFiles[0].files[i].type.indexOf('image') ){
container.append(jQuery("<svg class='cr-upload-video-thumbnail' viewBox='0 0 576 512'><path d='M336.2 64H47.8C21.4 64 0 85.4 0 111.8v288.4C0 426.6 21.4 448 47.8 448h288.4c26.4 0 47.8-21.4 47.8-47.8V111.8c0-26.4-21.4-47.8-47.8-47.8zm189.4 37.7L416 177.3v157.4l109.6 75.5c21.2 14.6 50.4-.3 50.4-25.8V127.5c0-25.4-29.1-40.4-50.4-25.8z'></path></svg>")
);
}else{
container.append(jQuery("<img>", {class:"cr-upload-images-thumbnail",src:URL.createObjectURL(uploadFiles[0].files[i])})
);
}
container.append(progressBar
);
let removeButton=jQuery("<button/>", {class:"cr-upload-images-delete"});
removeButton.append('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><rect x="0" fill="none" width="20" height="20"/><g><path class="cr-no-icon" d="M12.12 10l3.53 3.53-2.12 2.12L10 12.12l-3.54 3.54-2.12-2.12L7.88 10 4.34 6.46l2.12-2.12L10 7.88l3.54-3.53 2.12 2.12z"/></g></svg>'
);
container.append(removeButton
);
container.append(jQuery("<input>", {name:"cr-upload-images-ids[]",type:"hidden",value:""})
);
container.append(jQuery("<span/>", {class:"cr-upload-images-delete-spinner"})
);
jQuery(".cr-upload-images-preview").append(container);
}}
for(let i=0; i < countFiles; i++){
let formData=new FormData();
formData.append("action", "cr_upload_local_images_frontend");
formData.append("cr_nonce", jQuery(this).attr("data-nonce"));
formData.append("cr_postid", jQuery(this).attr("data-postid"));
formData.append("cr_file", uploadFiles[0].files[i]);
if(typeof grecaptcha!=="undefined"&&cr_ajax_object.ivole_recaptcha==='1'){
cr_captcha=grecaptcha.getResponse();
grecaptcha.reset();
}
formData.append("cr_captcha", cr_captcha);
jQuery.ajax({
url: cr_ajax_object.ajax_url,
data: formData,
processData: false,
contentType: false,
dataType: "json",
type: "POST",
beforeSend: function(){
},
xhr: function(){
var myXhr=jQuery.ajaxSettings.xhr();
if(myXhr.upload){
myXhr.upload.addEventListener('progress', function(e){
if(e.lengthComputable){
let perc=(e.loaded / e.total) * 100;
perc=perc.toFixed(0);
jQuery(".cr-upload-images-preview .cr-upload-images-containers.cr-upload-images-container-" + (lastIndex + i) + " .cr-upload-images-pbar .cr-upload-images-pbarin").width(perc + "%");
}}, false);
}
return myXhr;
},
success: function(response){
if(200===response["code"]){
let idkey=JSON.stringify({ id: response["attachment"]["id"], key: response["attachment"]["key"] });
jQuery(".cr-upload-images-preview .cr-upload-images-containers.cr-upload-images-container-" + (lastIndex + i) + " input").val(idkey);
jQuery(".cr-upload-images-preview .cr-upload-images-containers.cr-upload-images-container-" + (lastIndex + i)).addClass("cr-upload-ok");
jQuery(".cr-upload-images-preview .cr-upload-images-containers.cr-upload-images-container-" + (lastIndex + i) + " button").attr("data-delnonce",response["attachment"]["nonce"]);
}else if(500 <=response["code"]){
jQuery(".cr-upload-images-preview .cr-upload-images-containers.cr-upload-images-container-" + (lastIndex + i)).remove();
jQuery(".cr-upload-images-status").addClass("cr-upload-images-status-error");
jQuery(".cr-upload-images-status").text(response["message"]);
}}
});
}
jQuery(this).attr("data-lastindex", lastIndex + countFiles);
uploadFiles.val("");
});
jQuery(".cr-upload-images-preview").on("click", ".cr-upload-images-delete", function (e){
e.preventDefault();
jQuery(".cr-upload-images-status").removeClass("cr-upload-images-status-error");
jQuery(".cr-upload-images-status").text(cr_ajax_object.cr_upload_initial);
let classList=jQuery(this).parent().eq(0).attr("class").split(/\s+/);
let classes="";
jQuery.each(classList, function(index, item){
classes +="." + item;
});
let ajaxData={
"action": "cr_delete_local_images_frontend",
"cr_nonce": jQuery(this).attr("data-delnonce"),
"image": jQuery(this).parent().children("input").eq(0).val(),
"class": classes
}
jQuery(this).parent().addClass("cr-upload-delete-pending");
jQuery.post(cr_ajax_object.ajax_url, ajaxData, function(response){
if(200===response["code"]&&response["class"]){
jQuery(".cr-upload-images-preview " + response["class"]).remove();
}
jQuery(".cr-upload-images-preview " + response["class"]).removeClass("cr-upload-delete-pending");
}, "json");
});
jQuery(".cr-review-form-rating .cr-review-form-rating-inner").on("mouseenter",
function(){
let rating=parseInt(jQuery(this).data("rating") );
let ratingActv=parseInt(jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-actv").data("rating") );
if(isNaN(ratingActv) ){
ratingActv=0;
}
for(r=1; r < 6; r++){
if(r > rating&&r > ratingActv){
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-inner[data-rating=" + r + "] .cr-rating-act").hide();
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-inner[data-rating=" + r + "] .cr-rating-deact").show();
}else{
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-inner[data-rating=" + r + "] .cr-rating-deact").hide();
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-inner[data-rating=" + r + "] .cr-rating-act").show();
}}
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-nbr").text(rating + "/5");
}
).on("mouseleave",
function(){
let ratingActv=parseInt(jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-actv").data("rating") );
if(isNaN(ratingActv) ){
ratingActv=0;
}
for(r=1; r < 6; r++){
if(r > ratingActv){
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-inner[data-rating=" + r + "] .cr-rating-act").hide();
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-inner[data-rating=" + r + "] .cr-rating-deact").show();
}else{
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-inner[data-rating=" + r + "] .cr-rating-deact").hide();
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-inner[data-rating=" + r + "] .cr-rating-act").show();
}}
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-nbr").text(ratingActv + "/5");
}
);
jQuery(".cr-review-form-rating .cr-review-form-rating-inner").on("click", function(e){
e.preventDefault();
let rating=parseInt(jQuery(this).data("rating") );
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-inner").removeClass("cr-review-form-rating-actv");
jQuery(this).addClass("cr-review-form-rating-actv");
for(r=1; r < 6; r++){
if(r > rating){
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-inner[data-rating=" + r + "] .cr-rating-act").hide();
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-inner[data-rating=" + r + "] .cr-rating-deact").show();
}else{
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-inner[data-rating=" + r + "] .cr-rating-deact").hide();
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-inner[data-rating=" + r + "] .cr-rating-act").show();
}}
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-nbr").text(rating + "/5");
jQuery(this).closest(".cr-review-form-rating").find(".cr-review-form-rating-inp").val(rating);
jQuery(this).closest(".cr-review-form-rating").removeClass("cr-review-form-error");
});
jQuery(".cr-all-reviews-shortcode .cr-nav-left svg, .cr-all-reviews-shortcode .cr-nav-right svg, .cr-all-reviews-shortcode .cr-review-form-cancel").on("click", function(e){
jQuery(this).closest(".cr-all-reviews-shortcode").removeClass("cr-all-reviews-new-review");
jQuery(this).closest(".cr-review-form-wrap").removeClass("cr-review-form-res");
cr_reset_review_form(jQuery(this) );
});
jQuery(".cr-all-reviews-shortcode .cr-review-form-wrap").on("click", ".cr-review-form-success", function(e){
jQuery(this).closest(".cr-all-reviews-shortcode").removeClass("cr-all-reviews-new-review");
jQuery(this).closest(".cr-review-form-wrap").removeClass("cr-review-form-res");
cr_reset_review_form(jQuery(this) );
window.location.reload();
});
jQuery(".cr-review-form-wrap").on("click", ".cr-review-form-error", function(e){
jQuery(this).closest(".cr-review-form-wrap").removeClass("cr-review-form-res");
});
jQuery(".cr-ajax-reviews-review-form .cr-nav-left svg, .cr-ajax-reviews-review-form .cr-nav-right svg, .cr-ajax-reviews-review-form .cr-review-form-cancel").on("click", function(e){
jQuery(this).closest(".cr-reviews-ajax-reviews").find(".cr-reviews-ajax-comments").show();
jQuery(this).closest(".cr-reviews-ajax-reviews").find(".cr-ajax-reviews-review-form").hide();
jQuery(this).closest(".cr-review-form-wrap").removeClass("cr-review-form-res");
cr_reset_review_form(jQuery(this) );
});
jQuery(".cr-ajax-reviews-review-form .cr-review-form-wrap").on("click", ".cr-review-form-success", function(e){
jQuery(this).closest(".cr-reviews-ajax-reviews").find(".cr-reviews-ajax-comments").show();
jQuery(this).closest(".cr-reviews-ajax-reviews").find(".cr-ajax-reviews-review-form").hide();
jQuery(this).closest(".cr-review-form-wrap").removeClass("cr-review-form-res");
cr_reset_review_form(jQuery(this) );
if(window.location.hash!=='#reviews'){
window.location.href=window.location.pathname + '#reviews';
}
window.location.reload();
});
jQuery(".cr-reviews-grid .cr-nav-left svg, .cr-reviews-grid .cr-nav-right svg, .cr-reviews-grid .cr-review-form-cancel").on("click", function(e){
jQuery(this).closest(".cr-reviews-grid").removeClass("cr-reviews-grid-new-review");
jQuery(this).closest(".cr-review-form-wrap").removeClass("cr-review-form-res");
cr_reset_review_form(jQuery(this) );
});
jQuery(".cr-reviews-grid .cr-review-form-wrap").on("click", ".cr-review-form-success", function(e){
jQuery(this).closest(".cr-reviews-grid").removeClass("cr-reviews-grid-new-review");
jQuery(this).closest(".cr-review-form-wrap").removeClass("cr-review-form-res");
cr_reset_review_form(jQuery(this) );
window.location.reload();
});
jQuery(".cr-qna-block").on("click", ".cr-qna-new-q-form .cr-nav-left svg, .cr-qna-new-q-form .cr-nav-right svg, .cr-qna-new-q-form .cr-review-form-cancel", function(e){
jQuery(this).closest(".cr-qna-block").removeClass("cr-qna-new-q-form-open");
jQuery(this).closest(".cr-qna-new-q-form").removeClass("cr-review-form-res");
cr_reset_qna_form(jQuery(this) );
});
jQuery(".cr-qna-block").on("click", ".cr-qna-new-q-form .cr-review-form-success", function(e){
jQuery(this).closest(".cr-qna-block").removeClass("cr-qna-new-q-form-open");
jQuery(this).closest(".cr-qna-new-q-form").removeClass("cr-review-form-res");
cr_reset_qna_form(jQuery(this) );
});
jQuery(".cr-qna-block").on("click", ".cr-qna-new-q-form .cr-review-form-error", function(e){
jQuery(this).closest(".cr-qna-new-q-form").removeClass("cr-review-form-res");
});
jQuery(".cr-qna-block").on("click", ".cr-qna-list-inl-answ .cr-nav-left svg, .cr-qna-list-inl-answ .cr-nav-right svg, .cr-qna-list-inl-answ .cr-review-form-cancel", function(e){
jQuery(this).closest(".cr-qna-list-q-b").removeClass("cr-qna-ans-form-open");
jQuery(this).closest(".cr-qna-list-inl-answ").removeClass("cr-review-form-res");
cr_reset_ans_form(jQuery(this) );
});
jQuery(".cr-qna-block").on("click", ".cr-qna-list-inl-answ .cr-review-form-success", function(e){
jQuery(this).closest(".cr-qna-list-q-b").removeClass("cr-qna-ans-form-open");
jQuery(this).closest(".cr-qna-list-inl-answ").removeClass("cr-review-form-res");
cr_reset_ans_form(jQuery(this) );
});
jQuery(".cr-qna-block").on("click", ".cr-qna-list-inl-answ .cr-review-form-error", function(e){
jQuery(this).closest(".cr-qna-list-inl-answ").removeClass("cr-review-form-res");
});
jQuery(".cr-review-form-wrap .cr-review-form-submit").on("click", function(e){
if(0 < jQuery(this).closest(".cr-review-form-wrap").find(".cr-form-item-media-preview .cr-upload-images-containers:not(.cr-upload-ok)").length){
return false;
}
jQuery(this).closest(".cr-review-form-wrap").find(".cr-review-form-rating").removeClass("cr-review-form-error");
jQuery(this).closest(".cr-review-form-wrap").find(".cr-review-form-comment").removeClass("cr-review-form-error");
jQuery(this).closest(".cr-review-form-wrap").find(".cr-review-form-name").removeClass("cr-review-form-error");
jQuery(this).closest(".cr-review-form-wrap").find(".cr-review-form-email").removeClass("cr-review-form-error");
jQuery(this).closest(".cr-review-form-wrap").find(".cr-onsite-question").removeClass("cr-review-form-error");
jQuery(this).closest(".cr-review-form-wrap").find(".cr-form-item-media").removeClass("cr-review-form-error");
jQuery(this).closest(".cr-review-form-wrap").find(".cr-review-form-captcha").removeClass("cr-review-form-error");
jQuery(this).closest(".cr-review-form-wrap").find(".cr-review-form-terms").removeClass("cr-review-form-error");
if(cr_validate_review_form(jQuery(this) )){
let onsiteQuestions={};
jQuery(this).closest(".cr-review-form-wrap").find(".cr-review-form-rating input[type='hidden']").each(function(){
onsiteQuestions[jQuery(this).attr('name')]=jQuery(this).val();
}
)
jQuery(this).closest(".cr-review-form-wrap").find(".cr-onsite-question input").each(function(){
onsiteQuestions[jQuery(this).attr('name')]=jQuery(this).val();
}
)
let captchaResponse='';
if(0 < jQuery(this).closest(".cr-review-form-wrap").find('.cr-review-form-captcha .cr-recaptcha').length){
if(grecaptcha){
captchaResponse=grecaptcha.getResponse();
}}
let cr_data={
"action": "cr_submit_review",
"rating": jQuery(this).closest(".cr-review-form-wrap").find(".cr-review-form-rating-overall .cr-review-form-rating-inp").val(),
"review": jQuery(this).closest(".cr-review-form-wrap").find(".cr-review-form-comment-txt").val().trim(),
"name": jQuery(this).closest(".cr-review-form-wrap").find(".cr-review-form-name .cr-review-form-txt").val().trim(),
"id": jQuery(this).closest(".cr-review-form-wrap").find(".cr-review-form-item-id").val(),
"email": jQuery(this).closest(".cr-review-form-wrap").find(".cr-review-form-email .cr-review-form-txt").val().trim(),
"onsiteQuestions": onsiteQuestions,
"cr-upload-images-ids": jQuery(this).closest(".cr-review-form-wrap").find(".cr-form-item-media .cr-upload-images-containers input").map(function(){
return jQuery(this).val();
}).get(),
'g-recaptcha-response': captchaResponse
};
jQuery(this).closest(".cr-review-form-wrap").addClass("cr-review-form-submitting");
jQuery(this).closest(".cr-review-form-wrap").find(".cr-review-form-continue").removeClass("cr-review-form-success");
jQuery(this).closest(".cr-review-form-wrap").find(".cr-review-form-continue").removeClass("cr-review-form-error");
jQuery.post({
url: cr_ajax_object.ajax_url,
data: cr_data,
context: jQuery(this),
success: function(response){
if(! Object.hasOwn(response, 'button') ){
response.button='OK';
}
if(! Object.hasOwn(response, 'description') ){
response.description='An unexpected error that could be caused by a third-party plugin';
}
this.closest(".cr-review-form-wrap").removeClass("cr-review-form-submitting");
this.closest(".cr-review-form-wrap").addClass("cr-review-form-res");
this.closest(".cr-review-form-wrap").find(".cr-review-form-result span").html(response.description);
this.closest(".cr-review-form-wrap").find(".cr-review-form-continue").html(response.button);
if(0===response.code){
this.closest(".cr-review-form-wrap").find(".cr-review-form-continue").addClass("cr-review-form-success");
}else{
this.closest(".cr-review-form-wrap").find(".cr-review-form-continue").addClass("cr-review-form-error");
}},
dataType: "json"
}
);
};});
jQuery(".cr-qna-block .cr-qna-new-q-form").on("click", ".cr-review-form-submit", function(e){
jQuery(this).closest(".cr-qna-new-q-form").find(".cr-review-form-comment").removeClass("cr-review-form-error");
jQuery(this).closest(".cr-qna-new-q-form").find(".cr-review-form-name").removeClass("cr-review-form-error");
jQuery(this).closest(".cr-qna-new-q-form").find(".cr-review-form-email").removeClass("cr-review-form-error");
jQuery(this).closest(".cr-qna-new-q-form").find(".cr-review-form-terms").removeClass("cr-review-form-error");
if(cr_validate_qna(jQuery(this) )){
let cr_data={
"action": "cr_new_qna",
"crNonce": jQuery(this).closest(".cr-qna-block").data("nonce"),
"currentPostID": jQuery(this).closest(".cr-qna-new-q-form").find(".cr-review-form-item-id").val(),
"text": jQuery(this).closest(".cr-qna-new-q-form").find(".cr-review-form-comment-txt").val().trim(),
"name": jQuery(this).closest(".cr-qna-new-q-form").find(".cr-review-form-name .cr-review-form-txt").val().trim(),
"email": jQuery(this).closest(".cr-qna-new-q-form").find(".cr-review-form-email .cr-review-form-txt").val().trim()
};
jQuery(this).closest(".cr-qna-new-q-form").addClass("cr-review-form-submitting");
jQuery(this).closest(".cr-qna-new-q-form").find(".cr-review-form-continue").removeClass("cr-review-form-success");
jQuery(this).closest(".cr-qna-new-q-form").find(".cr-review-form-continue").removeClass("cr-review-form-error");
const postQuestion=(token, data, ref)=> {
data.cptcha=token;
jQuery.post({
url: cr_ajax_object.ajax_url,
data: data,
context: jQuery(ref),
success: function(response){
this.closest(".cr-qna-new-q-form").removeClass("cr-review-form-submitting");
this.closest(".cr-qna-new-q-form").addClass("cr-review-form-res");
this.closest(".cr-qna-new-q-form").find(".cr-review-form-result span").html(response.description);
this.closest(".cr-qna-new-q-form").find(".cr-review-form-continue").html(response.button);
if(0===response.code){
this.closest(".cr-qna-new-q-form").find(".cr-review-form-continue").addClass("cr-review-form-success");
}else{
this.closest(".cr-qna-new-q-form").find(".cr-review-form-continue").addClass("cr-review-form-error");
}},
dataType: "json"
}
);
};
let cr_cptcha=jQuery(this).attr("data-crcptcha");
var rf=this;
if(cr_cptcha&&cr_cptcha.length > 0){
grecaptcha.ready(function(){
grecaptcha.execute(cr_cptcha, {action: 'submit'}).then(function(token){
postQuestion(token, cr_data, rf)
});
});
}else{
postQuestion('', cr_data, rf);
}};});
jQuery(".cr-qna-block").on("click", ".cr-qna-list-inl-answ .cr-review-form-submit", function(e){
jQuery(this).closest(".cr-qna-list-inl-answ").find(".cr-review-form-comment").removeClass("cr-review-form-error");
jQuery(this).closest(".cr-qna-list-inl-answ").find(".cr-review-form-name").removeClass("cr-review-form-error");
jQuery(this).closest(".cr-qna-list-inl-answ").find(".cr-review-form-email").removeClass("cr-review-form-error");
jQuery(this).closest(".cr-qna-list-inl-answ").find(".cr-review-form-terms").removeClass("cr-review-form-error");
if(cr_validate_ans(jQuery(this) )){
let cr_data={
"action": "cr_new_qna",
"crNonce": jQuery(this).closest(".cr-qna-block").data("nonce"),
"currentPostID": jQuery(this).closest(".cr-qna-block").find(".cr-review-form-item-id").val(),
"questionID": jQuery(this).closest(".cr-qna-list-q-b").data("question"),
"productID": jQuery(this).closest(".cr-qna-list-q-b").data("post"),
"text": jQuery(this).closest(".cr-qna-list-inl-answ").find(".cr-review-form-comment-txt").val().trim(),
"name": jQuery(this).closest(".cr-qna-list-inl-answ").find(".cr-review-form-name .cr-review-form-txt").val().trim(),
"email": jQuery(this).closest(".cr-qna-list-inl-answ").find(".cr-review-form-email .cr-review-form-txt").val().trim()
};
jQuery(this).closest(".cr-qna-list-inl-answ").addClass("cr-review-form-submitting");
jQuery(this).closest(".cr-qna-list-inl-answ").find(".cr-review-form-continue").removeClass("cr-review-form-success");
jQuery(this).closest(".cr-qna-list-inl-answ").find(".cr-review-form-continue").removeClass("cr-review-form-error");
const postQuestion=(token, data, ref)=> {
data.cptcha=token;
jQuery.post({
url: cr_ajax_object.ajax_url,
data: data,
context: jQuery(ref),
success: function(response){
this.closest(".cr-qna-list-inl-answ").removeClass("cr-review-form-submitting");
this.closest(".cr-qna-list-inl-answ").addClass("cr-review-form-res");
this.closest(".cr-qna-list-inl-answ").find(".cr-review-form-result span").html(response.description);
this.closest(".cr-qna-list-inl-answ").find(".cr-review-form-continue").html(response.button);
if(0===response.code){
this.closest(".cr-qna-list-inl-answ").find(".cr-review-form-continue").addClass("cr-review-form-success");
}else{
this.closest(".cr-qna-list-inl-answ").find(".cr-review-form-continue").addClass("cr-review-form-error");
}},
dataType: "json"
}
);
};
let cr_cptcha=jQuery(this).attr("data-crcptcha");
var rf=this;
if(cr_cptcha&&cr_cptcha.length > 0&&grecaptcha){
grecaptcha.ready(function(){
grecaptcha.execute(cr_cptcha, {action: 'submit'}).then(function(token){
postQuestion(token, cr_data, rf)
});
});
}else{
postQuestion('', cr_data, rf);
}};});
jQuery(".cr-single-product-review").on("click", ".cr-single-product-rev-submit", function(t){
let validationResult=true;
let reviewForm=jQuery(this).closest(".cr-single-product-review");
reviewForm.find(".cr-review-form-rating-cont.cr-review-form-rating-req").each(function(index){
if(1 > jQuery(this).find(".cr-review-form-rating-actv").length){
jQuery(this).closest(".cr-review-form-rating").addClass("cr-review-form-error");
validationResult=false;
}});
reviewForm.find(".cr-onsite-question.cr-review-form-que-req").each(function(index){
if(1 > jQuery(this).find("input[type=text]").val().trim().length){
jQuery(this).closest(".cr-onsite-question").addClass("cr-review-form-error");
validationResult=false;
}else{
jQuery(this).closest(".cr-onsite-question").removeClass("cr-review-form-error");
}});
reviewForm.find(".cr-review-form-textbox").each(function(index){
if(1 > jQuery(this).val().trim().length){
jQuery(this).addClass("cr-review-form-error");
validationResult=false;
}else{
jQuery(this).removeClass("cr-review-form-error");
}});
if(0 < reviewForm.find('.cr-review-form-terms').length){
if(! reviewForm.find('.cr-review-form-terms .cr-review-form-checkbox').is(':checked')){
alert('Please tick the checkbox to proceed');
validationResult=false;
}}
if(! validationResult){
t.preventDefault();
}});
jQuery(".cr-all-reviews-add-review").on("click", function(t){
t.preventDefault();
if(0 < jQuery(this).closest(".cr-all-reviews-shortcode").length){
jQuery(this).closest(".cr-all-reviews-shortcode").addClass("cr-all-reviews-new-review");
}
if(0 < jQuery(this).closest(".cr-reviews-grid").length){
jQuery(this).closest(".cr-reviews-grid").addClass("cr-reviews-grid-new-review");
}});
jQuery(".cr-review-form-wrap .cr-form-item-media-none").on("click", function(t){
jQuery(this).parent().find("input.cr-form-item-media-file").trigger("click");
});
jQuery(".cr-review-form-wrap .cr-form-item-media-preview").on("click", ".cr-form-item-media-add", function(t){
jQuery(this).parents(".cr-form-item-media").find("input.cr-form-item-media-file").trigger("click");
});
jQuery(".cr-review-form-wrap .cr-form-item-media .cr-form-item-media-file").on("change", function (){
let allowedTypes=['image/jpeg', 'image/png', 'image/jpg', 'image/gif', 'video/mp4', 'video/mpeg', 'video/ogg', 'video/webm', 'video/quicktime', 'video/x-msvideo'],
uploadFiles=jQuery(this),
countFiles=uploadFiles[0].files.length,
lastIndex=1,
mediaPreview=jQuery(this).parent().find(".cr-form-item-media-preview"),
countUploaded=mediaPreview.children(".cr-upload-images-containers").length;
jQuery(this).closest(".cr-form-item-media").removeClass("cr-review-form-error");
if(jQuery(this).attr("data-lastindex")){
lastIndex=parseInt(jQuery(this).attr("data-lastindex") );
}
if(countFiles + countUploaded > cr_ajax_object.cr_images_upload_limit){
jQuery(this).closest(".cr-form-item-media").addClass("cr-review-form-error");
jQuery(this).closest(".cr-form-item-media").find(".cr-review-form-field-error").text(cr_ajax_object.cr_upload_error_too_many);
uploadFiles.val("");
return;
}
for(let i=0; i < countFiles; i++){
if(!allowedTypes.includes(uploadFiles[0].files[i].type)){
jQuery(this).closest(".cr-form-item-media").addClass("cr-review-form-error");
jQuery(this).closest(".cr-form-item-media").find(".cr-review-form-field-error").text(cr_ajax_object.cr_upload_error_file_type);
uploadFiles.val("");
return;
}else if(uploadFiles[0].files[i].size&&uploadFiles[0].files[i].size > cr_ajax_object.cr_images_upload_max_size * 100){
jQuery(this).closest(".cr-form-item-media").addClass("cr-review-form-error");
jQuery(this).closest(".cr-form-item-media").find(".cr-review-form-field-error").text(cr_ajax_object.cr_upload_error_file_size);
uploadFiles.val("");
return;
}else{
let container=jQuery("<div/>", {class:"cr-upload-images-containers cr-upload-images-container-" + (lastIndex + i)});
let progressBar=jQuery("<div/>", {class:"cr-upload-images-pbar"});
progressBar.append(jQuery("<div/>", {class:"cr-upload-images-pbarin"})
);
if(-1===uploadFiles[0].files[i].type.indexOf('image') ){
container.append(jQuery("<svg class='cr-upload-video-thumbnail' viewBox='0 0 576 512'><path d='M336.2 64H47.8C21.4 64 0 85.4 0 111.8v288.4C0 426.6 21.4 448 47.8 448h288.4c26.4 0 47.8-21.4 47.8-47.8V111.8c0-26.4-21.4-47.8-47.8-47.8zm189.4 37.7L416 177.3v157.4l109.6 75.5c21.2 14.6 50.4-.3 50.4-25.8V127.5c0-25.4-29.1-40.4-50.4-25.8z'></path></svg>")
);
}else{
container.append(jQuery("<img>", {class:"cr-upload-images-thumbnail", src:URL.createObjectURL(uploadFiles[0].files[i])})
);
}
container.append(progressBar
);
let removeButton=jQuery("<button/>", {class:"cr-upload-images-delete"});
removeButton.append('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><rect x="0" fill="none" width="20" height="20"/><g><path class="cr-no-icon" d="M12.12 10l3.53 3.53-2.12 2.12L10 12.12l-3.54 3.54-2.12-2.12L7.88 10 4.34 6.46l2.12-2.12L10 7.88l3.54-3.53 2.12 2.12z"/></g></svg>'
);
container.append(removeButton
);
container.append(jQuery("<input>", {name:"cr-upload-images-ids[]",type:"hidden",value:""})
);
container.append(jQuery("<span/>", {class:"cr-upload-images-delete-spinner"})
);
mediaPreview.find(".cr-form-item-media-add").remove();
mediaPreview.append(container);
if(countFiles + countUploaded < cr_ajax_object.cr_images_upload_limit){
mediaPreview.append(jQuery("<div class='cr-form-item-media-add'>+</div>")
);
}}
}
if(0 < mediaPreview.children(".cr-upload-images-containers").length&&! mediaPreview.hasClass("cr-form-visible") ){
mediaPreview.parents(".cr-form-item-subcontainer").addClass("cr-form-visible");
}
for(let i=0; i < countFiles; i++){
let formData=new FormData();
formData.append("action", "cr_upload_media");
formData.append("cr_file", uploadFiles[0].files[i]);
formData.append("cr_item", jQuery(this).closest(".cr-review-form-wrap").find(".cr-review-form-item-id").val());
formData.append("cr_nonce", jQuery(this).closest(".cr-review-form-wrap").data("nonce") );
var currentFileInput=jQuery(this);
jQuery.ajax({
url: cr_ajax_object.ajax_url,
data: formData,
processData: false,
contentType: false,
dataType: "json",
type: "POST",
context: this,
beforeSend: function(){
},
xhr: function(){
var myXhr=jQuery.ajaxSettings.xhr();
if(myXhr.upload){
myXhr.upload.addEventListener('progress', function(e){
if(e.lengthComputable){
let perc=(e.loaded / e.total) * 100;
perc=perc.toFixed(0);
currentFileInput.parent().find(".cr-form-item-media-preview .cr-upload-images-containers.cr-upload-images-container-" + (lastIndex + i) + " .cr-upload-images-pbar .cr-upload-images-pbarin").width(perc + "%");
}}, false);
}
return myXhr;
},
success: function(response){
if(200===response["code"]){
let idkey=JSON.stringify({ "id": response["attachment"]["id"], "key": response["attachment"]["key"] });
currentFileInput.parent().find(".cr-form-item-media-preview .cr-upload-images-containers.cr-upload-images-container-" + (lastIndex + i) + " input").val(idkey);
currentFileInput.parent().find(".cr-form-item-media-preview .cr-upload-images-containers.cr-upload-images-container-" + (lastIndex + i)).addClass("cr-upload-ok");
}else if(500 <=response["code"]){
currentFileInput.parent().find(".cr-form-item-media-preview .cr-upload-images-containers.cr-upload-images-container-" + (lastIndex + i)).remove();
let mediaPreview=jQuery(this).closest(".cr-form-item-media").find(".cr-form-item-media-preview");
let countUploaded=mediaPreview.find(".cr-upload-images-containers").length;
if(0 < countUploaded){
if(0===mediaPreview.children(".cr-form-item-media-add").length){
mediaPreview.append(jQuery("<div class='cr-form-item-media-add'>+</div>")
);
}}else{
mediaPreview.removeClass("cr-form-visible");
mediaPreview.parents(".cr-form-item-subcontainer").removeClass("cr-form-visible");
}
jQuery(this).closest(".cr-form-item-media").addClass("cr-review-form-error");
jQuery(this).closest(".cr-form-item-media").find(".cr-review-form-field-error").text(response["message"]);
}}
});
}
jQuery(this).attr("data-lastindex", lastIndex + countFiles);
uploadFiles.val("");
});
jQuery(".cr-review-form-wrap .cr-form-item-media-preview").on("click", ".cr-upload-images-delete", function (e){
e.preventDefault();
let imgContainer=jQuery(this).parent(),
mediaPreview=imgContainer.parent();
let ajaxData={
"action": "cr_delete_media",
"image": jQuery(this).parent().children("input").eq(0).val()
}
imgContainer.addClass("cr-upload-delete-pending");
jQuery.post(cr_ajax_object.ajax_url, ajaxData, function(response){
imgContainer.removeClass("cr-upload-delete-pending");
if(200===response["code"]){
imgContainer.remove();
let countUploaded=mediaPreview.children(".cr-upload-images-containers").length;
if(0 < countUploaded){
if(0===mediaPreview.children(".cr-form-item-media-add").length){
mediaPreview.append(jQuery("<div class='cr-form-item-media-add'>+</div>")
);
}}else{
mediaPreview.removeClass("cr-form-visible");
mediaPreview.parents(".cr-form-item-subcontainer").removeClass("cr-form-visible");
}}
}, "json");
});
cr_maybe_download_media_frontend();
if("object"===typeof elementorFrontend&&"hooks" in elementorFrontend){
elementorFrontend.hooks.addAction("frontend/element_ready/widget", function($scope){
if(-1!==$scope.data("widget_type").indexOf("shortcode") ){
if(0 < $scope.find(".cr-reviews-grid-inner").length){
crResizeAllGridItems();
}}
});
}});
const crValidateEmail=(email)=> {
return email.match(/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
);
};
function initVoteClick(sel1, sel2, action){
jQuery(sel1).on("click", sel2, function(e){
e.preventDefault();
let reviewIDhtml=jQuery(this).data("vote");
let parent=jQuery(this).parents(".cr-voting-cont-uni");
if(reviewIDhtml!=null){
let reviewID=reviewIDhtml;
let data={
"action": action,
"reviewID": reviewID,
"upvote": jQuery(this).data("upvote")
};
parent.find(".cr-voting-a").removeClass("cr-voting-active");
parent.find(".cr-voting-a").addClass("cr-voting-update");
jQuery.post(cr_ajax_object.ajax_url, data, function(response){
parent.find(".cr-voting-a").removeClass("cr-voting-update");
if(response.code===0){
if(response.votes){
parent.find(".cr-voting-upvote-count").text("(" +  response.votes.upvotes + ")");
parent.find(".cr-voting-downvote-count").text("(" +  response.votes.downvotes + ")");
}
if(0!==response.votes.current){
if(0 < response.votes.current){
parent.find(".cr-voting-upvote").addClass("cr-voting-active");
}else{
parent.find(".cr-voting-downvote").addClass("cr-voting-active");
}}
}}, "json");
}});
}
function cr_keyup_delay(fn, ms){
let timer=0;
return function(...args){
clearTimeout(timer);
timer=setTimeout(fn.bind(this, ...args), ms||0);
};}
function cr_filter_all_reviews(refElement, show_more=false){
let attributes=refElement.parents(".cr-all-reviews-shortcode").data("attributes"),
cr_rating=refElement.parents(".cr-all-reviews-shortcode").find(".ivole-summaryBox .ivole-histogramRow.ivole-histogramRow-s .cr-histogram-a").attr("data-rating"),
cr_search=refElement.parents(".cr-all-reviews-shortcode").find(".cr-ajax-search input").val(),
cr_sort=refElement.parents(".cr-all-reviews-shortcode").find(".cr-ajax-reviews-sort").children("option:selected").val();
let cr_tags=[];
refElement.parents(".cr-all-reviews-shortcode").find(".cr-review-tags-filter .cr-tags-filter.cr-tag-selected").each(function(){
cr_tags.push(jQuery(this).attr("data-crtagid"));
}
);
let cr_data={
"action": "cr_show_more_all_reviews",
"attributes": attributes,
"rating": cr_rating,
"page": 0,
"search": cr_search,
"sort": cr_sort,
"tags": cr_tags
};
if(show_more){
cr_data.page=refElement.data("page");
jQuery(".cr-search-no-reviews").hide();
jQuery('.cr-show-more-button').hide();
if(refElement.hasClass("cr-page-numbers-a") ){
refElement.closest(".cr-all-reviews-shortcode").find(".commentlist").addClass("cr-pagination-load");
refElement.closest(".cr-all-reviews-shortcode").find(".cr-all-reviews-pagination").addClass("cr-pagination-load");
}else{
refElement.closest(".cr-all-reviews-shortcode").find(".cr-show-more-review-spinner").show();
}
jQuery.post({
url: cr_ajax_object.ajax_url,
data: cr_data,
context: refElement,
success: function(response){
let shcode=jQuery(this).closest(".cr-all-reviews-shortcode");
shcode.find(".cr-show-more-review-spinner").hide();
if(response.html!==""){
if(jQuery(this).hasClass("cr-page-numbers-a") ){
shcode.find(".commentlist").find("*").not(".cr-pagination-review-spinner").remove();
shcode.find(".commentlist").prepend(response.html);
}else{
shcode.find(".commentlist").append(response.html);
}
if(! response.last_page){
shcode.find(".cr-show-more-button").text(response.show_more_label);
shcode.find(".cr-show-more-button").show();
}
shcode.find(".cr-show-more-button").data("page", response.page);
shcode.find(".cr-count-row .cr-count-row-count").html(response.count_row);
if(response.pagination!==""){
shcode.find(".cr-all-reviews-pagination").html(response.pagination);
}}else{
shcode.find(".cr-show-more-button").hide();
}
if(response.html==""&&response.page===1){
shcode.find(".cr-search-no-reviews").show();
}
shcode.find(".commentlist").removeClass("cr-pagination-load");
shcode.find(".cr-all-reviews-pagination").removeClass("cr-pagination-load");
},
dataType: "json"
}
);
}else{
refElement.closest(".cr-all-reviews-shortcode").find(".cr-search-no-reviews").hide();
refElement.closest(".cr-all-reviews-shortcode").find(".cr-show-more-button").hide();
refElement.closest(".cr-all-reviews-shortcode").find(".commentlist").hide();
refElement.closest(".cr-all-reviews-shortcode").find(".cr-show-more-review-spinner").show();
refElement.closest(".cr-all-reviews-shortcode").find(".ivole-summaryBox").addClass("cr-summaryBar-updating");
refElement.closest(".cr-all-reviews-shortcode").find(".cr-seeAllReviews").addClass("cr-seeAll-updating");
refElement.closest(".cr-all-reviews-shortcode").find(".cr-ajax-reviews-sort").addClass("cr-sort-updating");
refElement.closest(".cr-all-reviews-shortcode").find(".cr-review-tags-filter").addClass("cr-tags-updating");
refElement.closest(".cr-all-reviews-shortcode").find(".cr-all-reviews-pagination").hide();
jQuery.post({
url: cr_ajax_object.ajax_url,
data: cr_data,
context: refElement,
success: function(response){
let shcode=jQuery(this).closest(".cr-all-reviews-shortcode");
shcode.find(".cr-show-more-review-spinner").hide();
shcode.find(".ivole-summaryBox").removeClass("cr-summaryBar-updating");
shcode.find(".cr-seeAllReviews").removeClass("cr-seeAll-updating");
shcode.find(".cr-ajax-reviews-sort").removeClass("cr-sort-updating");
shcode.find(".cr-review-tags-filter").removeClass("cr-tags-updating");
if(response.html!==""){
shcode.find(".commentlist").empty();
shcode.find(".commentlist").append(response.html);
shcode.find(".commentlist").show();
shcode.find(".cr-show-more-button").data("page",response.page);
if(!response.last_page){
shcode.find(".cr-show-more-button").text(response.show_more_label);
shcode.find(".cr-show-more-button").show();
}}else{
shcode.find(".cr-search-no-reviews").show();
}
shcode.find(".cr-count-row .cr-count-row-count").html(response.count_row);
shcode.find(".cr-all-reviews-pagination").html(response.pagination);
shcode.find(".cr-all-reviews-pagination").show();
},
dataType: "json"
}
);
}}
function cr_maybe_download_media_frontend(){
jQuery(".cr-comment-image-ext,.cr-comment-video-ext").each(function(){
let ajaxData={
"action": "cr_auto_download_media_frontend",
"reviewID": jQuery(this).data("reviewid")
}
jQuery.post(cr_ajax_object.ajax_url, ajaxData, function(response){
}, "json");
return false;
});
}
function cr_validate_review_form(submitBtn){
let validationResult=true;
submitBtn.closest(".cr-review-form-wrap").find(".cr-review-form-rating-cont.cr-review-form-rating-req").each(function(index){
if(1 > jQuery(this).find(".cr-review-form-rating-actv").length){
jQuery(this).closest(".cr-review-form-rating").addClass("cr-review-form-error");
validationResult=false;
}});
if(1 > submitBtn.closest(".cr-review-form-wrap").find(".cr-review-form-comment-txt").val().trim().length){
submitBtn.closest(".cr-review-form-wrap").find(".cr-review-form-comment").addClass("cr-review-form-error");
validationResult=false;
}
if(1 > submitBtn.closest(".cr-review-form-wrap").find(".cr-review-form-name .cr-review-form-txt").val().trim().length){
submitBtn.closest(".cr-review-form-wrap").find(".cr-review-form-name").addClass("cr-review-form-error");
validationResult=false;
}
if(! crValidateEmail(submitBtn.closest(".cr-review-form-wrap").find(".cr-review-form-email .cr-review-form-txt").val().trim()) ){
submitBtn.closest(".cr-review-form-wrap").find(".cr-review-form-email").addClass("cr-review-form-error");
validationResult=false;
}
submitBtn.closest(".cr-review-form-wrap").find(".cr-onsite-question.cr-review-form-que-req").each(function(index){
if(0 < jQuery(this).find("input[type=text]").length){
if(1 > jQuery(this).find("input[type=text]").val().trim().length){
jQuery(this).closest(".cr-onsite-question").addClass("cr-review-form-error");
validationResult=false;
}else{
jQuery(this).closest(".cr-onsite-question").removeClass("cr-review-form-error");
}}
if(0 < jQuery(this).find("input[type=number]").length){
if(1 > jQuery(this).find("input[type=number]").val().trim().length){
jQuery(this).closest(".cr-onsite-question").addClass("cr-review-form-error");
validationResult=false;
}else{
jQuery(this).closest(".cr-onsite-question").removeClass("cr-review-form-error");
}}
});
if(0 < submitBtn.closest(".cr-review-form-wrap").find('.cr-review-form-terms').length){
if(! submitBtn.closest(".cr-review-form-wrap").find('.cr-review-form-terms .cr-review-form-checkbox').is(':checked')){
submitBtn.closest(".cr-review-form-wrap").find(".cr-review-form-terms").addClass("cr-review-form-error");
validationResult=false;
}}
if(0 < submitBtn.closest(".cr-review-form-wrap").find('.cr-review-form-captcha .cr-recaptcha').length){
if(grecaptcha){
let widgetId=0;
if(0 < jQuery(".cr-review-form-captcha .cr-recaptcha").length){
jQuery(".cr-review-form-captcha .cr-recaptcha").each(function(index){
if(submitBtn.closest('.cr-review-form-wrap').find('.cr-review-form-captcha .cr-recaptcha').data('crcaptchaid')===jQuery(this).data('crcaptchaid')
){
widgetId=index;
}}
);
}
let captchaCheck="";
if(0 < widgetId){
captchaCheck=grecaptcha.getResponse(widgetId);
}else{
captchaCheck=grecaptcha.getResponse();
}
if(! captchaCheck.length > 0){
submitBtn.closest(".cr-review-form-wrap").find(".cr-review-form-captcha").addClass("cr-review-form-error");
validationResult=false;
}}
}
return validationResult;
}
function cr_validate_qna(submitBtn){
let validationResult=true;
if(1 > submitBtn.closest(".cr-qna-new-q-form").find(".cr-review-form-comment-txt").val().trim().length){
submitBtn.closest(".cr-qna-new-q-form").find(".cr-review-form-comment").addClass("cr-review-form-error");
validationResult=false;
}
if(1 > submitBtn.closest(".cr-qna-new-q-form").find(".cr-review-form-name .cr-review-form-txt").val().trim().length){
submitBtn.closest(".cr-qna-new-q-form").find(".cr-review-form-name").addClass("cr-review-form-error");
validationResult=false;
}
if(! crValidateEmail(submitBtn.closest(".cr-qna-new-q-form").find(".cr-review-form-email .cr-review-form-txt").val().trim()) ){
submitBtn.closest(".cr-qna-new-q-form").find(".cr-review-form-email").addClass("cr-review-form-error");
validationResult=false;
}
if(0 < submitBtn.closest(".cr-qna-new-q-form").find('.cr-review-form-terms').length){
if(! submitBtn.closest(".cr-qna-new-q-form").find('.cr-review-form-terms .cr-review-form-checkbox').is(':checked')){
submitBtn.closest(".cr-qna-new-q-form").find(".cr-review-form-terms").addClass("cr-review-form-error");
validationResult=false;
}}
return validationResult;
}
function cr_validate_ans(submitBtn){
let validationResult=true;
if(1 > submitBtn.closest(".cr-qna-list-inl-answ").find(".cr-review-form-comment-txt").val().trim().length){
submitBtn.closest(".cr-qna-list-inl-answ").find(".cr-review-form-comment").addClass("cr-review-form-error");
validationResult=false;
}
if(1 > submitBtn.closest(".cr-qna-list-inl-answ").find(".cr-review-form-name .cr-review-form-txt").val().trim().length){
submitBtn.closest(".cr-qna-list-inl-answ").find(".cr-review-form-name").addClass("cr-review-form-error");
validationResult=false;
}
if(! crValidateEmail(submitBtn.closest(".cr-qna-list-inl-answ").find(".cr-review-form-email .cr-review-form-txt").val().trim()) ){
submitBtn.closest(".cr-qna-list-inl-answ").find(".cr-review-form-email").addClass("cr-review-form-error");
validationResult=false;
}
if(0 < submitBtn.closest(".cr-qna-list-inl-answ").find('.cr-review-form-terms').length){
if(! submitBtn.closest(".cr-qna-list-inl-answ").find('.cr-review-form-terms .cr-review-form-checkbox').is(':checked')){
submitBtn.closest(".cr-qna-list-inl-answ").find(".cr-review-form-terms").addClass("cr-review-form-error");
validationResult=false;
}}
return validationResult;
}
function cr_reset_review_form(refElement){
refElement.closest(".cr-review-form-wrap").find(".cr-review-form-rating-cont .cr-review-form-rating-inner").removeClass("cr-review-form-rating-actv");
refElement.closest(".cr-review-form-wrap").find(".cr-review-form-rating-cont .cr-review-form-rating-inner .cr-rating-act").hide();
refElement.closest(".cr-review-form-wrap").find(".cr-review-form-rating-cont .cr-review-form-rating-inner .cr-rating-deact").show();
refElement.closest(".cr-review-form-wrap").find(".cr-review-form-rating-cont .cr-review-form-rating-nbr").text("0/5");
refElement.closest(".cr-review-form-wrap").find(".cr-review-form-rating").removeClass("cr-review-form-error");
refElement.closest(".cr-review-form-wrap").find(".cr-review-form-comment-txt").val('');
refElement.closest(".cr-review-form-wrap").find(".cr-review-form-comment").removeClass("cr-review-form-error");
refElement.closest(".cr-review-form-wrap").find(".cr-review-form-name .cr-review-form-txt").val('');
refElement.closest(".cr-review-form-wrap").find(".cr-review-form-name").removeClass("cr-review-form-error");
refElement.closest(".cr-review-form-wrap").find(".cr-review-form-email .cr-review-form-txt").val('');
refElement.closest(".cr-review-form-wrap").find(".cr-review-form-email").removeClass("cr-review-form-error");
refElement.closest(".cr-review-form-wrap").find(".cr-onsite-questions .cr-onsite-question").removeClass("cr-review-form-error");
refElement.closest(".cr-review-form-wrap").find(".cr-onsite-questions .cr-onsite-question input[type='text']").val('');
refElement.closest(".cr-review-form-wrap").find(".cr-onsite-questions .cr-onsite-question input[type='number']").val('');
refElement.closest(".cr-review-form-wrap").find(".cr-onsite-key-question").removeClass("cr-review-form-error");
refElement.closest(".cr-review-form-wrap").find(".cr-onsite-key-question input[type='text']").val('');
refElement.closest(".cr-review-form-wrap").find(".cr-onsite-key-question input[type='number']").val('');
refElement.closest(".cr-review-form-wrap").find(".cr-form-item-media .cr-upload-images-containers").remove();
refElement.closest(".cr-review-form-wrap").find(".cr-form-item-media .cr-form-item-media-preview").removeClass("cr-form-visible");
refElement.closest(".cr-review-form-wrap").find(".cr-form-item-media .cr-form-item-media-preview").parents(".cr-form-item-subcontainer").removeClass("cr-form-visible");
refElement.closest(".cr-review-form-wrap").find(".cr-review-form-terms .cr-review-form-checkbox").prop('checked', false);
refElement.closest(".cr-review-form-wrap").find(".cr-review-form-terms").removeClass("cr-review-form-error");
refElement.closest(".cr-review-form-wrap").find(".cr-review-form-captcha").removeClass("cr-review-form-error");
}
function cr_reset_qna_form(refElement){
refElement.closest(".cr-qna-new-q-form").find(".cr-review-form-comment-txt").val('');
refElement.closest(".cr-qna-new-q-form").find(".cr-review-form-comment").removeClass("cr-review-form-error");
const nameField=refElement.closest(".cr-qna-new-q-form").find(".cr-review-form-name");
nameField.find(".cr-review-form-txt").val(nameField.find(".cr-review-form-txt").data('defval'));
nameField.removeClass("cr-review-form-error");
const emailField=refElement.closest(".cr-qna-new-q-form").find(".cr-review-form-email");
emailField.find(".cr-review-form-txt").val(emailField.find(".cr-review-form-txt").data('defval'));
emailField.removeClass("cr-review-form-error");
refElement.closest(".cr-qna-new-q-form").find(".cr-review-form-terms .cr-review-form-checkbox").prop('checked', false);
refElement.closest(".cr-qna-new-q-form").find(".cr-review-form-terms").removeClass("cr-review-form-error");
}
function cr_reset_ans_form(refElement){
refElement.closest(".cr-qna-list-inl-answ").find(".cr-review-form-comment-txt").val("");
refElement.closest(".cr-qna-list-inl-answ").find(".cr-review-form-comment").removeClass("cr-review-form-error");
const nameField=refElement.closest(".cr-qna-list-inl-answ").find(".cr-review-form-name");
nameField.find(".cr-review-form-txt").val("");
nameField.removeClass("cr-review-form-error");
const emailField=refElement.closest(".cr-qna-list-inl-answ").find(".cr-review-form-email");
emailField.find(".cr-review-form-txt").val("");
emailField.removeClass("cr-review-form-error");
refElement.closest(".cr-qna-list-inl-answ").find(".cr-review-form-terms .cr-review-form-checkbox").prop('checked', false);
refElement.closest(".cr-qna-list-inl-answ").find(".cr-review-form-terms").removeClass("cr-review-form-error");
}
function crDebounce(callback, wait){
let timeout;
return (...args)=> {
clearTimeout(timeout);
if(0 < args.length&&13===args[0].keyCode){
wait=0;
}else{
wait=1000;
}
timeout=setTimeout(function (){ callback.apply(this, args); }, wait);
};}
function crShowMoreReviewsPrd(refElement){
let cr_product_id=refElement.parents(".cr-reviews-ajax-comments").find(".commentlist.cr-ajax-reviews-list").attr("data-product");
let cr_nonce=refElement.parents(".cr-reviews-ajax-comments").attr("data-nonce");
let cr_page=refElement.parents(".cr-reviews-ajax-comments").attr("data-page");
let cr_sort=refElement.parents(".cr-reviews-ajax-comments").find(".cr-ajax-reviews-sort").children("option:selected").val();
let cr_rating=refElement.parents(".cr-reviews-ajax-comments").find(".cr-summaryBox-ajax .ivole-histogramRow.ivole-histogramRow-s a.cr-histogram-a").attr("data-rating");
let cr_search=refElement.parents(".cr-reviews-ajax-comments").find(".cr-ajax-search input").val();
let cr_tags=[];
refElement.parents(".cr-reviews-ajax-comments").find(".cr-review-tags-filter .cr-tags-filter.cr-tag-selected").each(function(){
cr_tags.push(jQuery(this).attr("data-crtagid"));
}
);
if(! cr_rating){
cr_rating=0;
}
let cr_data={
"action": "cr_show_more_reviews",
"productID": cr_product_id,
"page": cr_page,
"sort": cr_sort,
"rating": cr_rating,
"search": cr_search,
"tags": cr_tags,
"security": cr_nonce
};
refElement.parents(".cr-reviews-ajax-comments").find(".cr-summaryBox-ajax").addClass("cr-summaryBar-updating");
refElement.parents(".cr-reviews-ajax-comments").find(".cr-ajax-reviews-sort").addClass("cr-sort-updating");
refElement.parents(".cr-reviews-ajax-comments").find(".cr-review-tags-filter").addClass("cr-review-tags-filter-disabled");
refElement.parents(".cr-reviews-ajax-comments").find(".cr-search-no-reviews").hide();
refElement.parents(".cr-reviews-ajax-comments").find(".cr-show-more-reviews-prd").hide();
refElement.parents(".cr-reviews-ajax-comments").find(".cr-show-more-review-spinner").show();
jQuery.post({
url: cr_ajax_object.ajax_url,
data: cr_data,
context: refElement,
success: function(response){
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-show-more-review-spinner").hide();
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-summaryBox-ajax").removeClass("cr-summaryBar-updating");
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-ajax-reviews-sort").removeClass("cr-sort-updating");
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-review-tags-filter").removeClass("cr-review-tags-filter-disabled");
if(response.page > 0){
jQuery(this).parents(".cr-reviews-ajax-comments").find(".commentlist.cr-ajax-reviews-list").append(response.html);
jQuery(this).parents(".cr-reviews-ajax-comments").attr("data-page",response.page);
if(response.show_more_label){
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-show-more-reviews-prd").text(response.show_more_label);
}
if(response.count_row){
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-count-row .cr-count-row-count").html(response.count_row);
}
if(! response.last_page){
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-show-more-reviews-prd").show();
}
cr_maybe_download_media_frontend();
}
if(response.html==null&&response.page===1){
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-search-no-reviews").show();
}},
dataType: "json"
});
}})();
function crResizeAllGridItemsUtil(grids){
jQuery(grids).each(function(){
if(800 > jQuery(this).width()){
jQuery(this).find(".cr-reviews-grid-col3").addClass("cr-reviews-grid-col-none");
}
if(550 > jQuery(this).width()){
jQuery(this).find(".cr-reviews-grid-col2").addClass("cr-reviews-grid-col-none");
}
jQuery(this).colcade({
columns: ".cr-reviews-grid-col",
items: ".cr-review-card"
});
});
}
function crResizeAllGridItems(){
if(typeof Colcade!=="undefined" &&
typeof Colcade.makeJQueryPlugin!=="undefined" &&
typeof Colcade.makeJQueryPlugin==="function"
){
if(! typeof jQuery.fn.colcade==="function" ||
typeof jQuery.fn.colcade==="undefined"
){
Colcade.makeJQueryPlugin();
}}
crResizeAllGridItemsUtil(jQuery(".cr-reviews-grid-inner"));
}
function crResizeTrustBadges(){
jQuery(".cr-trustbadgef").each(function(){
let badge=jQuery(this).find(".cr-badge").eq(0);
let scale=jQuery(this).width() / badge.outerWidth();
if(1 > scale){
badge.css("transform", "scale(" + scale + ")");
}
badge.css("visibility", "visible");
});
};
(function(window, factory){
if(typeof define=='function'&&define.amd){
define(factory);
}else if(typeof module=='object'&&module.exports){
module.exports=factory();
}else{
window.Colcade=factory();
}}(window, function factory(){
function Colcade(element, options){
element=getQueryElement(element);
if(element&&element.colcadeGUID){
var instance=instances[ element.colcadeGUID ];
instance.option(options);
return instance;
}
this.element=element;
this.options={};
this.option(options);
this.lastAppend=[];
this.lastColumnHeights=[];
this.create();
element.classList.add('cr-colcade-loaded');
}
var proto=Colcade.prototype;
proto.option=function(options){
this.options=extend(this.options, options);
};
var GUID=0;
var instances={};
proto.create=function(){
this.errorCheck();
var guid=this.guid=++GUID;
this.element.colcadeGUID=guid;
instances[ guid ]=this;
this.reload();
this._windowResizeHandler=this.onWindowResize.bind(this);
this._loadHandler=this.onLoad.bind(this);
window.addEventListener('resize', this._windowResizeHandler);
this.element.addEventListener('load', this._loadHandler, true);
};
proto.errorCheck=function(){
var errors=[];
if(!this.element){
errors.push('Bad element: ' + this.element);
}
if(!this.options.columns){
errors.push('columns option required: ' + this.options.columns);
}
if(!this.options.items){
errors.push('items option required: ' + this.options.items);
}
if(errors.length){
throw new Error('[Colcade error] ' + errors.join('. '));
}};
proto.reload=function(){
this.updateColumns();
this.updateItems();
this.layout();
};
proto.updateColumns=function(){
this.columns=querySelect(this.options.columns, this.element);
};
proto.updateItems=function(){
this.items=querySelect(this.options.items, this.element);
};
proto.getActiveColumns=function(){
return this.columns.filter(function(column){
var style=getComputedStyle(column);
return style.display!='none';
});
};
proto.layout=function(){
this.activeColumns=this.getActiveColumns();
this._layout();
};
proto._layout=function(){
this.columnHeights=this.activeColumns.map(function(){
return 0;
});
this.layoutItems(this.items);
};
proto.layoutItems=function(items){
items.forEach(this.layoutItem, this);
};
proto.layoutItem=function(item){
var minHeight=Math.min.apply(Math, this.columnHeights);
var index=this.columnHeights.indexOf(minHeight);
this.activeColumns[ index ].appendChild(item);
this.columnHeights[ index ] +=item.offsetHeight||1;
};
proto.append=function(elems){
var items=this.getQueryItems(elems);
this.items=this.items.concat(items);
this.lastAppend.length=0;
this.lastAppend=items.slice();
this.lastColumnHeights.length=0;
this.lastColumnHeights=this.columnHeights.slice();
this.layoutItems(items);
};
proto.prepend=function(elems){
var items=this.getQueryItems(elems);
this.items=items.concat(this.items);
this._layout();
};
proto.getQueryItems=function(elems){
elems=makeArray(elems);
var fragment=document.createDocumentFragment();
elems.forEach(function(elem){
fragment.appendChild(elem);
});
return querySelect(this.options.items, fragment);
};
proto.empty=function(){
this.lastAppend.length=0;
this.lastColumnHeights.length=0;
this.items.forEach(function(item){
item.remove();
}, this);
this.items.length=0;
this._layout();
};
proto.measureColumnHeight=function(elem){
var boundingRect=this.element.getBoundingClientRect();
this.activeColumns.forEach(function(column, i){
if(!elem||column.contains(elem) ){
var lastChildRect=column.lastElementChild.getBoundingClientRect();
this.columnHeights[ i ]=lastChildRect.bottom - boundingRect.top;
}}, this);
};
proto.onWindowResize=function(){
clearTimeout(this.resizeTimeout);
this.resizeTimeout=setTimeout(function(){
this.onDebouncedResize();
}.bind(this), 100);
};
proto.onDebouncedResize=function(){
var activeColumns=this.getActiveColumns();
var isSameLength=activeColumns.length==this.activeColumns.length;
var isSameColumns=true;
this.activeColumns.forEach(function(column, i){
isSameColumns=isSameColumns&&column==activeColumns[i];
});
if(isSameLength&&isSameColumns){
return;
}
this.activeColumns=activeColumns;
this._layout();
};
proto.onLoad=function(event){
this.measureColumnHeight(event.target);
if(0 < this.lastColumnHeights.length&&0 < this.lastAppend.length){
this.columnHeights.length=0;
this.columnHeights=this.lastColumnHeights.slice();
this.layoutItems(this.lastAppend);
}};
proto.destroy=function(){
this.items.forEach(function(item){
this.element.appendChild(item);
}, this);
window.removeEventListener('resize', this._windowResizeHandler);
this.element.removeEventListener('load', this._loadHandler, true);
delete this.element.colcadeGUID;
delete instances[ this.guid ];
};
docReady(function(){
var dataElems=querySelect('[data-colcade]');
dataElems.forEach(htmlInit);
});
function htmlInit(elem){
var attr=elem.getAttribute('data-colcade');
var attrParts=attr.split(',');
var options={};
attrParts.forEach(function(part){
var pair=part.split(':');
var key=pair[0].trim();
var value=pair[1].trim();
options[ key ]=value;
});
new Colcade(elem, options);
}
Colcade.data=function(elem){
elem=getQueryElement(elem);
var id=elem&&elem.colcadeGUID;
return id&&instances[ id ];
};
Colcade.makeJQueryPlugin=function($){
$=$||window.jQuery;
if(!$){
return;
}
$.fn.colcade=function(arg0 ){
if(typeof arg0=='string'){
var args=Array.prototype.slice.call(arguments, 1);
return methodCall(this, arg0, args);
}
plainCall(this, arg0);
return this;
};
function methodCall($elems, methodName, args){
var returnValue;
$elems.each(function(i, elem){
var colcade=$.data(elem, 'colcade');
if(!colcade){
return;
}
var value=colcade[ methodName ].apply(colcade, args);
returnValue=returnValue===undefined ? value:returnValue;
});
return returnValue!==undefined ? returnValue:$elems;
}
function plainCall($elems, options){
$elems.each(function(i, elem){
var colcade=$.data(elem, 'colcade');
if(colcade){
colcade.option(options);
colcade.layout();
}else{
colcade=new Colcade(elem, options);
$.data(elem, 'colcade', colcade);
}});
}};
Colcade.makeJQueryPlugin();
function extend(a, b){
for(var prop in b){
a[ prop ]=b[ prop ];
}
return a;
}
function makeArray(obj){
var ary=[];
if(Array.isArray(obj) ){
ary=obj;
}else if(obj&&typeof obj.length=='number'){
for(var i=0; i < obj.length; i++){
ary.push(obj[i]);
}}else{
ary.push(obj);
}
return ary;
}
function querySelect(selector, elem){
elem=elem||document;
var elems=elem.querySelectorAll(selector);
return makeArray(elems);
}
function getQueryElement(elem){
if(typeof elem=='string'){
elem=document.querySelector(elem);
}
return elem;
}
function docReady(onReady){
if(document.readyState=='complete'){
onReady();
return;
}
document.addEventListener('DOMContentLoaded', onReady);
}
return Colcade;
}));
!function(e){var t=!0,a={swing:"cubic-bezier(.02, .01, .47, 1)",linear:"linear",easeInQuad:"cubic-bezier(0.11, 0, 0.5, 0)",easeOutQuad:"cubic-bezier(0.5, 1, 0.89, 1)",easeInOutQuad:"cubic-bezier(0.45, 0, 0.55, 1)",easeInCubic:"cubic-bezier(0.32, 0, 0.67, 0)",easeOutCubic:"cubic-bezier(0.33, 1, 0.68, 1)",easeInOutCubic:"cubic-bezier(0.65, 0, 0.35, 1)",easeInQuart:"cubic-bezier(0.5, 0, 0.75, 0)",easeOutQuart:"cubic-bezier(0.25, 1, 0.5, 1)",easeInOutQuart:"cubic-bezier(0.76, 0, 0.24, 1)",easeInQuint:"cubic-bezier(0.64, 0, 0.78, 0)",easeOutQuint:"cubic-bezier(0.22, 1, 0.36, 1)",easeInOutQuint:"cubic-bezier(0.83, 0, 0.17, 1)",easeInSine:"cubic-bezier(0.12, 0, 0.39, 0)",easeOutSine:"cubic-bezier(0.61, 1, 0.88, 1)",easeInOutSine:"cubic-bezier(0.37, 0, 0.63, 1)",easeInExpo:"cubic-bezier(0.7, 0, 0.84, 0)",easeOutExpo:"cubic-bezier(0.16, 1, 0.3, 1)",easeInOutExpo:"cubic-bezier(0.87, 0, 0.13, 1)",easeInCirc:"cubic-bezier(0.55, 0, 1, 0.45)",easeOutCirc:"cubic-bezier(0, 0.55, 0.45, 1)",easeInOutCirc:"cubic-bezier(0.85, 0, 0.15, 1)",easeInBack:"cubic-bezier(0.36, 0, 0.66, -0.56)",easeOutBack:"cubic-bezier(0.34, 1.56, 0.64, 1)",easeInOutBack:"cubic-bezier(0.68, -0.6, 0.32, 1.6)"};a.jswing=a.swing,e.flexslider=function(i,n){var s=e(i);"undefined"==typeof n.rtl&&"rtl"==e("html").attr("dir")&&(n.rtl=!0),s.vars=e.extend({},e.flexslider.defaults,n);var r,o=s.vars.namespace,l=("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)&&s.vars.touch,c="click touchend keyup flexslider-click",u="",d=a[s.vars.easing]||"ease",v="vertical"===s.vars.direction,p=s.vars.reverse,m=s.vars.itemWidth>0,f="fade"===s.vars.animation,h=""!==s.vars.asNavFor,g={};e.data(i,"flexslider",s),g={init:function(){s.animating=!1,s.currentSlide=parseInt(s.vars.startAt?s.vars.startAt:0,10),isNaN(s.currentSlide)&&(s.currentSlide=0),s.animatingTo=s.currentSlide,s.atEnd=0===s.currentSlide||s.currentSlide===s.last,s.containerSelector=s.vars.selector.substr(0,s.vars.selector.search(" ")),s.slides=e(s.vars.selector,s),s.container=e(s.containerSelector,s),s.count=s.slides.length,s.syncExists=e(s.vars.sync).length>0,"slide"===s.vars.animation&&(s.vars.animation="swing"),s.prop=v?"top":s.vars.rtl?"marginRight":"marginLeft",s.args={},s.manualPause=!1,s.stopped=!1,s.started=!1,s.startTimeout=null,s.transforms=s.transitions=!s.vars.video&&!f&&s.vars.useCSS,s.transforms&&(s.prop="transform"),s.isFirefox=navigator.userAgent.toLowerCase().indexOf("firefox")>-1,s.ensureAnimationEnd="",""!==s.vars.controlsContainer&&(s.controlsContainer=e(s.vars.controlsContainer).length>0&&e(s.vars.controlsContainer)),""!==s.vars.manualControls&&(s.manualControls=e(s.vars.manualControls).length>0&&e(s.vars.manualControls)),""!==s.vars.customDirectionNav&&(s.customDirectionNav=2===e(s.vars.customDirectionNav).length&&e(s.vars.customDirectionNav)),s.vars.randomize&&(s.slides.sort(function(){return Math.round(Math.random())-.5}),s.container.empty().append(s.slides)),s.doMath(),s.setup("init"),s.vars.controlNav&&g.controlNav.setup(),s.vars.directionNav&&g.directionNav.setup(),s.vars.keyboard&&(1===e(s.containerSelector).length||s.vars.multipleKeyboard)&&e(document).on("keyup",function(e){var t=e.keyCode;if(!s.animating&&(39===t||37===t)){var a=s.vars.rtl?37===t?s.getTarget("next"):39===t&&s.getTarget("prev"):39===t?s.getTarget("next"):37===t&&s.getTarget("prev");s.flexAnimate(a,s.vars.pauseOnAction)}}),s.vars.mousewheel&&s.on("mousewheel",function(e,t,a,i){e.preventDefault();var n=t<0?s.getTarget("next"):s.getTarget("prev");s.flexAnimate(n,s.vars.pauseOnAction)}),s.vars.pausePlay&&g.pausePlay.setup(),s.vars.slideshow&&s.vars.pauseInvisible&&g.pauseInvisible(),s.vars.slideshow&&(s.vars.pauseOnHover&&s.on("mouseenter",function(){s.manualPlay||s.manualPause||s.pause()}).on("mouseleave",function(){s.manualPause||s.manualPlay||s.stopped||s.play()}),s.vars.pauseInvisible&&"visible"!==document.visibilityState||(s.vars.initDelay>0?s.startTimeout=setTimeout(s.play,s.vars.initDelay):s.play())),h&&g.asNav.setup(),l&&s.vars.touch&&g.touch(),(!f||f&&s.vars.smoothHeight)&&e(window).on("resize orientationchange focus",g.resize),s.find("img").attr("draggable","false"),setTimeout(function(){s.vars.start(s)},200)},asNav:{setup:function(){s.asNav=!0,s.animatingTo=Math.floor(s.currentSlide/s.move),s.currentItem=s.currentSlide,s.slides.removeClass(o+"active-slide").eq(s.currentItem).addClass(o+"active-slide"),s.slides.on(c,function(t){t.preventDefault();var a=e(this),i=a.index();(s.vars.rtl?-1*(a.offset().right-e(s).scrollLeft()):a.offset().left-e(s).scrollLeft())<=0&&a.hasClass(o+"active-slide")?s.flexAnimate(s.getTarget("prev"),!0):e(s.vars.asNavFor).data("flexslider").animating||a.hasClass(o+"active-slide")||(s.direction=s.currentItem<i?"next":"prev",s.flexAnimate(i,s.vars.pauseOnAction,!1,!0,!0))})}},controlNav:{setup:function(){s.manualControls?g.controlNav.setupManual():g.controlNav.setupPaging()},setupPaging:function(){var t,a,i="thumbnails"===s.vars.controlNav?"control-thumbs":"control-paging",n=1;if(s.controlNavScaffold=e('<ol class="'+o+"control-nav "+o+i+'"></ol>'),s.pagingCount>1)for(var r=0;r<s.pagingCount;r++){if(a=s.slides.eq(r),undefined===a.attr("data-thumb-alt")&&a.attr("data-thumb-alt",""),t=e("<a></a>").attr("href","#").text(n),"thumbnails"===s.vars.controlNav&&(t=e("<img/>",{onload:"this.width=this.naturalWidth; this.height=this.naturalHeight",src:a.attr("data-thumb"),srcset:a.attr("data-thumb-srcset"),sizes:a.attr("data-thumb-sizes"),alt:a.attr("alt")})),""!==a.attr("data-thumb-alt")&&t.attr("alt",a.attr("data-thumb-alt")),"thumbnails"===s.vars.controlNav&&!0===s.vars.thumbCaptions){var l=a.attr("data-thumbcaption");if(""!==l&&undefined!==l){var d=e("<span></span>").addClass(o+"caption").text(l);t.append(d)}}var v=e("<li>");t.appendTo(v),v.append("</li>"),s.controlNavScaffold.append(v),n++}s.controlsContainer?e(s.controlsContainer).append(s.controlNavScaffold):s.append(s.controlNavScaffold),g.controlNav.set(),g.controlNav.active(),s.controlNavScaffold.on(c,"a, img",function(t){if(t.preventDefault(),""===u||u===t.type||"flexslider-click"===t.type){var a=e(this),i=s.controlNav.index(a);a.hasClass(o+"active")||(s.direction=i>s.currentSlide?"next":"prev",s.flexAnimate(i,s.vars.pauseOnAction))}""===u&&"flexslider-click"!==t.type&&(u=t.type),g.setToClearWatchedEvent()})},setupManual:function(){s.controlNav=s.manualControls,g.controlNav.active(),s.controlNav.on(c,function(t){if(t.preventDefault(),""===u||u===t.type||"flexslider-click"===t.type){var a=e(this),i=s.controlNav.index(a);a.hasClass(o+"active")||(i>s.currentSlide?s.direction="next":s.direction="prev",s.flexAnimate(i,s.vars.pauseOnAction))}""===u&&"flexslider-click"!==t.type&&(u=t.type),g.setToClearWatchedEvent()})},set:function(){var t="thumbnails"===s.vars.controlNav?"img":"a";s.controlNav=e("."+o+"control-nav li "+t,s.controlsContainer?s.controlsContainer:s)},active:function(){s.controlNav.removeClass(o+"active").eq(s.animatingTo).addClass(o+"active")},update:function(t,a){s.pagingCount>1&&"add"===t?s.controlNavScaffold.append(e('<li><a href="#">'+s.count+"</a></li>")):1===s.pagingCount?s.controlNavScaffold.find("li").remove():s.controlNav.eq(a).closest("li").remove(),g.controlNav.set(),s.pagingCount>1&&s.pagingCount!==s.controlNav.length?s.update(a,t):g.controlNav.active()}},directionNav:{setup:function(){var t=e('<ul class="'+o+'direction-nav"><li class="'+o+'nav-prev"><a class="'+o+'prev" href="#">'+s.vars.prevText+'</a></li><li class="'+o+'nav-next"><a class="'+o+'next" href="#">'+s.vars.nextText+"</a></li></ul>");s.customDirectionNav?s.directionNav=s.customDirectionNav:s.controlsContainer?(e(s.controlsContainer).append(t),s.directionNav=e("."+o+"direction-nav li a",s.controlsContainer)):(s.append(t),s.directionNav=e("."+o+"direction-nav li a",s)),g.directionNav.update(),s.directionNav.on(c,function(t){var a;t.preventDefault(),""!==u&&u!==t.type&&"flexslider-click"!==t.type||(a=e(this).hasClass(o+"next")?s.getTarget("next"):s.getTarget("prev"),s.flexAnimate(a,s.vars.pauseOnAction)),""===u&&"flexslider-click"!==t.type&&(u=t.type),g.setToClearWatchedEvent()})},update:function(){var e=o+"disabled";1===s.pagingCount?s.directionNav.addClass(e).attr("tabindex","-1"):s.vars.animationLoop?s.directionNav.removeClass(e).prop("tabindex","-1"):0===s.animatingTo?s.directionNav.removeClass(e).filter("."+o+"prev").addClass(e).attr("tabindex","-1"):s.animatingTo===s.last?s.directionNav.removeClass(e).filter("."+o+"next").addClass(e).attr("tabindex","-1"):s.directionNav.removeClass(e).prop("tabindex","-1")}},pausePlay:{setup:function(){var t=e('<div class="'+o+'pauseplay"><a href="#"></a></div>');s.controlsContainer?(s.controlsContainer.append(t),s.pausePlay=e("."+o+"pauseplay a",s.controlsContainer)):(s.append(t),s.pausePlay=e("."+o+"pauseplay a",s)),g.pausePlay.update(s.vars.slideshow?o+"pause":o+"play"),s.pausePlay.on(c,function(t){t.preventDefault(),""!==u&&u!==t.type&&"flexslider-click"!==t.type||(e(this).hasClass(o+"pause")?(s.manualPause=!0,s.manualPlay=!1,s.pause()):(s.manualPause=!1,s.manualPlay=!0,s.play())),""===u&&"flexslider-click"!==t.type&&(u=t.type),g.setToClearWatchedEvent()})},update:function(e){"play"===e?s.pausePlay.removeClass(o+"pause").addClass(o+"play").html(s.vars.playText):s.pausePlay.removeClass(o+"play").addClass(o+"pause").html(s.vars.pauseText)}},touch:function(){var e,t,a,n,r,o,l,c,u,d=!1,h=0,g=0;l=function(r){s.animating?r.preventDefault():1===r.touches.length&&(s.pause(),n=v?s.h:s.w,o=Number(new Date),h=r.touches[0].pageX,g=r.touches[0].pageY,a=m&&p&&s.animatingTo===s.last?0:m&&p?s.limit-(s.itemW+s.vars.itemMargin)*s.move*s.animatingTo:m&&s.currentSlide===s.last?s.limit:m?(s.itemW+s.vars.itemMargin)*s.move*s.currentSlide:p?(s.last-s.currentSlide+s.cloneOffset)*n:(s.currentSlide+s.cloneOffset)*n,e=v?g:h,t=v?h:g,i.addEventListener("touchmove",c,!1),i.addEventListener("touchend",u,!1))},c=function(i){h=i.touches[0].pageX,g=i.touches[0].pageY,r=v?e-g:(s.vars.rtl?-1:1)*(e-h);(!(d=v?Math.abs(r)<Math.abs(h-t):Math.abs(r)<Math.abs(g-t))||Number(new Date)-o>500)&&(i.preventDefault(),f||(s.vars.animationLoop||(r/=0===s.currentSlide&&r<0||s.currentSlide===s.last&&r>0?Math.abs(r)/n+2:1),s.setProps(a+r,"setTouch")))},u=function(l){if(i.removeEventListener("touchmove",c,!1),s.animatingTo===s.currentSlide&&!d&&null!==r){var v=p?-r:r,m=v>0?s.getTarget("next"):s.getTarget("prev");s.canAdvance(m)&&(Number(new Date)-o<550&&Math.abs(v)>50||Math.abs(v)>n/2)?s.flexAnimate(m,s.vars.pauseOnAction):f||s.flexAnimate(s.currentSlide,s.vars.pauseOnAction,!0)}i.removeEventListener("touchend",u,!1),e=null,t=null,r=null,a=null},i.addEventListener("touchstart",l,!1)},resize:function(){!s.animating&&s.is(":visible")&&(m||s.doMath(),f?g.smoothHeight():m?(s.slides.width(s.computedW),s.update(s.pagingCount),s.setProps()):v?(s.viewport.height(s.h),s.setProps(s.h,"setTotal")):(s.setProps(s.computedW,"setTotal"),s.newSlides.width(s.computedW),s.vars.smoothHeight&&g.smoothHeight()))},smoothHeight:function(e){v&&!f||(f?s:s.viewport).css({height:s.slides.eq(s.animatingTo).innerHeight(),transition:e?"height "+e+"ms":"none"})},sync:function(t){var a=e(s.vars.sync).data("flexslider"),i=s.animatingTo;switch(t){case"animate":a.flexAnimate(i,s.vars.pauseOnAction,!1,!0);break;case"play":a.playing||a.asNav||a.play();break;case"pause":a.pause()}},uniqueID:function(t){return t.filter("[id]").add(t.find("[id]")).each(function(){var t=e(this);t.attr("id",t.attr("id")+"_clone")}),t},pauseInvisible:function(){document.addEventListener("visibilitychange",function(){"hidden"===document.visibilityState?s.startTimeout?clearTimeout(s.startTimeout):s.pause():s.started?s.play():s.vars.initDelay>0?setTimeout(s.play,s.vars.initDelay):s.play()})},setToClearWatchedEvent:function(){clearTimeout(r),r=setTimeout(function(){u=""},3e3)}},s.flexAnimate=function(t,a,i,n,r){if(s.vars.animationLoop||t===s.currentSlide||(s.direction=t>s.currentSlide?"next":"prev"),h&&1===s.pagingCount&&(s.direction=s.currentItem<t?"next":"prev"),!s.animating&&(s.canAdvance(t,r)||i)&&s.is(":visible")){if(h&&n){var c=e(s.vars.asNavFor).data("flexslider");if(s.atEnd=0===t||t===s.count-1,c.flexAnimate(t,!0,!1,!0,r),s.direction=s.currentItem<t?"next":"prev",c.direction=s.direction,Math.ceil((t+1)/s.visible)-1===s.currentSlide||0===t)return s.currentItem=t,s.slides.removeClass(o+"active-slide").eq(t).addClass(o+"active-slide"),!1;s.currentItem=t,s.slides.removeClass(o+"active-slide").eq(t).addClass(o+"active-slide"),t=Math.floor(t/s.visible)}if(s.animating=!0,s.animatingTo=t,a&&s.pause(),s.vars.before(s),s.syncExists&&!r&&g.sync("animate"),s.vars.controlNav&&g.controlNav.active(),m||s.slides.removeClass(o+"active-slide").eq(t).addClass(o+"active-slide"),s.atEnd=0===t||t===s.last,s.vars.directionNav&&g.directionNav.update(),t===s.last&&(s.vars.end(s),s.vars.animationLoop||s.pause()),f)l||(s.slides.eq(s.currentSlide).off("transitionend"),s.slides.eq(t).off("transitionend").on("transitionend",s.wrapup)),s.slides.eq(s.currentSlide).css({opacity:0,zIndex:1}),s.slides.eq(t).css({opacity:1,zIndex:2}),l&&s.wrapup(y);else{var u,d,b,y=v?s.slides.filter(":first").height():s.computedW;m?(u=s.vars.itemMargin,d=(b=(s.itemW+u)*s.move*s.animatingTo)>s.limit&&1!==s.visible?s.limit:b):d=0===s.currentSlide&&t===s.count-1&&s.vars.animationLoop&&"next"!==s.direction?p?(s.count+s.cloneOffset)*y:0:s.currentSlide===s.last&&0===t&&s.vars.animationLoop&&"prev"!==s.direction?p?0:(s.count+1)*y:p?(s.count-1-t+s.cloneOffset)*y:(t+s.cloneOffset)*y,s.setProps(d,"",s.vars.animationSpeed),s.vars.animationLoop&&s.atEnd||(s.animating=!1,s.currentSlide=s.animatingTo),s.container.off("transitionend"),s.container.on("transitionend",function(){clearTimeout(s.ensureAnimationEnd),s.wrapup(y)}),clearTimeout(s.ensureAnimationEnd),s.ensureAnimationEnd=setTimeout(function(){s.wrapup(y)},s.vars.animationSpeed+100)}s.vars.smoothHeight&&g.smoothHeight(s.vars.animationSpeed)}},s.wrapup=function(e){f||m||(0===s.currentSlide&&s.animatingTo===s.last&&s.vars.animationLoop?s.setProps(e,"jumpEnd"):s.currentSlide===s.last&&0===s.animatingTo&&s.vars.animationLoop&&s.setProps(e,"jumpStart")),s.animating=!1,s.currentSlide=s.animatingTo,s.vars.after(s)},s.animateSlides=function(){!s.animating&&t&&s.flexAnimate(s.getTarget("next"))},s.pause=function(){clearInterval(s.animatedSlides),s.animatedSlides=null,s.playing=!1,s.vars.pausePlay&&g.pausePlay.update("play"),s.syncExists&&g.sync("pause")},s.play=function(){s.playing&&clearInterval(s.animatedSlides),s.animatedSlides=s.animatedSlides||setInterval(s.animateSlides,s.vars.slideshowSpeed),s.started=s.playing=!0,s.vars.pausePlay&&g.pausePlay.update("pause"),s.syncExists&&g.sync("play")},s.stop=function(){s.pause(),s.stopped=!0},s.canAdvance=function(e,t){var a=h?s.pagingCount-1:s.last;return!!t||(!(!h||s.currentItem!==s.count-1||0!==e||"prev"!==s.direction)||(!h||0!==s.currentItem||e!==s.pagingCount-1||"next"===s.direction)&&(!(e===s.currentSlide&&!h)&&(!!s.vars.animationLoop||(!s.atEnd||0!==s.currentSlide||e!==a||"next"===s.direction)&&(!s.atEnd||s.currentSlide!==a||0!==e||"next"!==s.direction))))},s.getTarget=function(e){return s.direction=e,"next"===e?s.currentSlide===s.last?0:s.currentSlide+1:0===s.currentSlide?s.last:s.currentSlide-1},s.setProps=function(e,t,a){var i,n=(i=e||(s.itemW+s.vars.itemMargin)*s.move*s.animatingTo,function(){if(m)return"setTouch"===t?e:p&&s.animatingTo===s.last?0:p?s.limit-(s.itemW+s.vars.itemMargin)*s.move*s.animatingTo:s.animatingTo===s.last?s.limit:i;switch(t){case"setTotal":return p?(s.count-1-s.currentSlide+s.cloneOffset)*e:(s.currentSlide+s.cloneOffset)*e;case"setTouch":return e;case"jumpEnd":return p?e:s.count*e;case"jumpStart":return p?s.count*e:e;default:return e}}()*(s.vars.rtl?1:-1)+"px");a=a!==undefined?a/1e3+"s":"0s",s.container.css("transition-duration",a),s.transforms?n=v?"translate3d(0,"+n+",0)":"translate3d("+parseInt(n)+"px,0,0)":s.container.css("transition-timing-function",d),s.args[s.prop]=n,s.container.css(s.args)},s.setup=function(t){var a,i;f?(s.vars.rtl?s.slides.css({width:"100%",float:"right",marginLeft:"-100%",position:"relative"}):s.slides.css({width:"100%",float:"left",marginRight:"-100%",position:"relative"}),"init"===t&&(l?s.slides.css({opacity:0,display:"block",transition:"opacity "+s.vars.animationSpeed/1e3+"s ease",zIndex:1}).eq(s.currentSlide).css({opacity:1,zIndex:2}):(0==s.vars.fadeFirstSlide?(s.slides.css({opacity:0,display:"block",zIndex:1}).eq(s.currentSlide).css({opacity:1,zIndex:2}),s.slides.outerWidth()):(s.slides.css({opacity:0,display:"block",zIndex:1}).outerWidth(),s.slides.eq(s.currentSlide).css({opacity:1,zIndex:2})),s.slides.css({transition:"opacity "+s.vars.animationSpeed/1e3+"s "+d}))),s.vars.smoothHeight&&g.smoothHeight()):("init"===t&&(s.viewport=e('<div class="'+o+'viewport"></div>').css({overflow:"hidden",position:"relative"}).appendTo(s).append(s.container),s.cloneCount=0,s.cloneOffset=0,p&&(i=e.makeArray(s.slides).reverse(),s.slides=e(i),s.container.empty().append(s.slides))),s.vars.animationLoop&&!m&&(s.cloneCount=2,s.cloneOffset=1,"init"!==t&&s.container.find(".clone").remove(),s.container.append(g.uniqueID(s.slides.first().clone().addClass("clone")).attr("aria-hidden","true")).prepend(g.uniqueID(s.slides.last().clone().addClass("clone")).attr("aria-hidden","true"))),s.newSlides=e(s.vars.selector,s),a=p?s.count-1-s.currentSlide+s.cloneOffset:s.currentSlide+s.cloneOffset,v&&!m?(s.container.height(200*(s.count+s.cloneCount)+"%").css("position","absolute").width("100%"),setTimeout(function(){s.newSlides.css({display:"block"}),s.doMath(),s.viewport.height(s.h),s.setProps(a*s.h,"init")},"init"===t?100:0)):(s.container.width(200*(s.count+s.cloneCount)+"%"),s.setProps(a*s.computedW,"init"),setTimeout(function(){s.doMath(),s.vars.rtl?s.newSlides.css({width:s.computedW,marginRight:s.computedM,float:"right",display:"block"}):s.newSlides.css({width:s.computedW,marginRight:s.computedM,float:"left",display:"block"}),s.vars.smoothHeight&&g.smoothHeight()},"init"===t?100:0)));m||s.slides.removeClass(o+"active-slide").eq(s.currentSlide).addClass(o+"active-slide"),s.vars.init(s)},s.doMath=function(){var e=s.slides.first(),t=s.vars.itemMargin,a=s.vars.minItems,i=s.vars.maxItems;s.w=s.viewport===undefined?s.width():s.viewport.width(),s.isFirefox&&(s.w=s.width()),s.h=e.height(),s.boxPadding=e.outerWidth()-e.width(),m?(s.itemT=s.vars.itemWidth+t,s.itemM=t,s.minW=a?a*s.itemT:s.w,s.maxW=i?i*s.itemT-t:s.w,s.itemW=s.minW>s.w?(s.w-t*(a-1))/a:s.maxW<s.w?(s.w-t*(i-1))/i:s.vars.itemWidth>s.w?s.w:s.vars.itemWidth,s.visible=Math.floor(s.w/s.itemW),s.move=s.vars.move>0&&s.vars.move<s.visible?s.vars.move:s.visible,s.pagingCount=Math.ceil((s.count-s.visible)/s.move+1),s.last=s.pagingCount-1,s.limit=1===s.pagingCount?0:s.vars.itemWidth>s.w?s.itemW*(s.count-1)+t*(s.count-1):(s.itemW+t)*s.count-s.w-t):(s.itemW=s.w,s.itemM=t,s.pagingCount=s.count,s.last=s.count-1),s.computedW=s.itemW-s.boxPadding,s.computedM=s.itemM},s.update=function(e,t){s.doMath(),m||(e<s.currentSlide?s.currentSlide+=1:e<=s.currentSlide&&0!==e&&(s.currentSlide-=1),s.animatingTo=s.currentSlide),s.vars.controlNav&&!s.manualControls&&("add"===t&&!m||s.pagingCount>s.controlNav.length?g.controlNav.update("add"):("remove"===t&&!m||s.pagingCount<s.controlNav.length)&&(m&&s.currentSlide>s.last&&(s.currentSlide-=1,s.animatingTo-=1),g.controlNav.update("remove",s.last))),s.vars.directionNav&&g.directionNav.update()},s.addSlide=function(t,a){var i=e(t);s.count+=1,s.last=s.count-1,v&&p?a!==undefined?s.slides.eq(s.count-a).after(i):s.container.prepend(i):a!==undefined?s.slides.eq(a).before(i):s.container.append(i),s.update(a,"add"),s.slides=e(s.vars.selector+":not(.clone)",s),s.setup(),s.vars.added(s)},s.removeSlide=function(t){var a=isNaN(t)?s.slides.index(e(t)):t;s.count-=1,s.last=s.count-1,isNaN(t)?e(t,s.slides).remove():v&&p?s.slides.eq(s.last).remove():s.slides.eq(t).remove(),s.doMath(),s.update(a,"remove"),s.slides=e(s.vars.selector+":not(.clone)",s),s.setup(),s.vars.removed(s)},g.init()},e(window).on("blur",function(e){t=!1}).on("focus",function(e){t=!0}),e.flexslider.defaults={namespace:"flex-",selector:".slides > li",animation:"fade",easing:"swing",direction:"horizontal",reverse:!1,animationLoop:!0,smoothHeight:!1,startAt:0,slideshow:!0,slideshowSpeed:7e3,animationSpeed:600,initDelay:0,randomize:!1,fadeFirstSlide:!0,thumbCaptions:!1,pauseOnAction:!0,pauseOnHover:!1,pauseInvisible:!0,useCSS:!0,touch:!0,video:!1,controlNav:!0,directionNav:!0,prevText:"Previous",nextText:"Next",keyboard:!0,multipleKeyboard:!1,mousewheel:!1,pausePlay:!1,pauseText:"Pause",playText:"Play",controlsContainer:"",manualControls:"",customDirectionNav:"",sync:"",asNavFor:"",itemWidth:0,itemMargin:0,minItems:1,maxItems:0,move:0,allowOneSlide:!0,isFirefox:!1,start:function(){},before:function(){},after:function(){},end:function(){},added:function(){},removed:function(){},init:function(){},rtl:!1},e.fn.flexslider=function(t){if(t===undefined&&(t={}),"object"==typeof t)return this.each(function(){var a=e(this),i=t.selector?t.selector:".slides > li",n=a.find(i);if(1===n.length&&!1===t.allowOneSlide||0===n.length){n.length&&n[0].animate([{opacity:0},{opacity:1}],400),t.start&&t.start(a)}else a.data("flexslider")===undefined&&new e.flexslider(this,t)});var a=e(this).data("flexslider");switch(t){case"play":a.play();break;case"pause":a.pause();break;case"stop":a.stop();break;case"next":a.flexAnimate(a.getTarget("next"),!0);break;case"prev":case"previous":a.flexAnimate(a.getTarget("prev"),!0);break;default:"number"==typeof t&&a.flexAnimate(t,!0)}}}(jQuery);
!function(t){t.fn.tipTip=function(e){var o=t.extend({activation:"hover",keepAlive:!1,maxWidth:"200px",edgeOffset:3,defaultPosition:"bottom",delay:400,fadeIn:200,fadeOut:200,attribute:"title",content:!1,enter:function(){},exit:function(){}},e);if(t("#tiptip_holder").length<=0){var n=t('<div id="tiptip_holder" style="max-width:'+o.maxWidth+';"></div>'),i=t('<div id="tiptip_content"></div>'),r=t('<div id="tiptip_arrow"></div>');t("body").append(n.html(i).prepend(r.html('<div id="tiptip_arrow_inner"></div>')))}else n=t("#tiptip_holder"),i=t("#tiptip_content"),r=t("#tiptip_arrow");return this.each(function(){var e=t(this);if(o.content)var a=o.content;else a=DOMPurify.sanitize(e.attr(o.attribute),{ALLOWED_TAGS:["a","b","em","i","strong","p","br","pre","span","img"],ALLOWED_ATTR:["target","href","rel","name","download","title","src","alt","class","style"]});if(""!=a){o.content||e.removeAttr(o.attribute);var f=!1;function d(){var d="function"==typeof o.content?o.content():a;if(d){o.enter.call(this),i.html(d),n.hide().css("margin","0"),n.removeAttr("class"),r.removeAttr("style");var u=parseInt(e.offset().top),s=parseInt(e.offset().left),l=parseInt(e.outerWidth()),p=parseInt(e.outerHeight()),c=n.outerWidth(),h=n.outerHeight(),_=Math.round((l-c)/2),m=Math.round((p-h)/2),v=Math.round(s+_),g=Math.round(u+p+o.edgeOffset),b="",M="",O=Math.round(c-12)/2;"bottom"==o.defaultPosition?b="_bottom":"top"==o.defaultPosition?b="_top":"left"==o.defaultPosition?b="_left":"right"==o.defaultPosition&&(b="_right");var w=_+s<parseInt(t(window).scrollLeft()),A=c+s>parseInt(t(window).width());w&&_<0||"_right"==b&&!A||"_left"==b&&s<c+o.edgeOffset+5?(b="_right",M=Math.round(h-13)/2,O=-12,v=Math.round(s+l+o.edgeOffset),g=Math.round(u+m)):(A&&_<0||"_left"==b&&!w)&&(b="_left",M=Math.round(h-13)/2,O=Math.round(c),v=Math.round(s-(c+o.edgeOffset+5)),g=Math.round(u+m));var x=u+p+o.edgeOffset+h+8>parseInt(t(window).height()+t(window).scrollTop()),I=u+p-(o.edgeOffset+h+8)<0;x||"_bottom"==b&&x||"_top"==b&&!I?("_top"==b||"_bottom"==b?b="_top":b+="_top",M=h,g=Math.round(u-(h+5+o.edgeOffset))):(I|("_top"==b&&I)||"_bottom"==b&&!x)&&("_top"==b||"_bottom"==b?b="_bottom":b+="_bottom",M=-12,g=Math.round(u+p+o.edgeOffset)),"_right_top"==b||"_left_top"==b?g+=5:"_right_bottom"!=b&&"_left_bottom"!=b||(g-=5),"_left_top"!=b&&"_left_bottom"!=b||(v+=5),r.css({"margin-left":O+"px","margin-top":M+"px"}),n.css({"margin-left":v+"px","margin-top":g+"px"}).attr("class","tip"+b),f&&clearTimeout(f),f=setTimeout(function(){n.stop(!0,!0).fadeIn(o.fadeIn)},o.delay)}}function u(){o.exit.call(this),f&&clearTimeout(f),n.fadeOut(o.fadeOut)}"hover"==o.activation?(e.on("mouseenter",function(){d()}).on("mouseleave",function(){o.keepAlive&&n.is(":hover")||u()}),o.keepAlive&&n.on("mouseenter",function(){}).on("mouseleave",function(){u()})):"focus"==o.activation?e.on("focus",function(){d()}).on("blur",function(){u()}):"click"==o.activation&&(e.on("click",function(){return d(),!1}).on("mouseenter",function(){}).on("mouseleave",function(){o.keepAlive||u()}),o.keepAlive&&n.on("mouseenter",function(){}).on("mouseleave",function(){u()}))}})}}(jQuery);