(()=>{(function(t,x){let M=window.PaoValidation||PaoValidation;x.WC_PAO=x.WC_PAO||{};let h=x.WC_PAO;h.initialized_forms=[],h.Helper={escapeHtml:function(l){return document.createElement("div").appendChild(document.createTextNode(l)).parentNode.innerHTML},isGroupedSubsSelected:function(){var l=t(".product-type-grouped"),_=!1;return l.length&&l.find(".group_table tr.product").each(function(){if(0<t(this).find(".input-text.qty").val()&&t(this).find(".entry-summary .subscription-details").length)return _=!0,!1}),_},addMinutes:function(l,_){return new Date(l.getTime()+_*6e4)},isGroupedMixedProductType:function(){var l=t(".product-type-grouped"),_=0,a=0;return!!(l.length&&(l.find(".group_table tr.product").each(function(){0<t(this).find(".input-text.qty").val()&&(t(this).find(".entry-summary .subscription-details").length?_++:a++)}),0<_&&0<a))},delay:function(l,_){var a=0;clearTimeout(a),a=setTimeout(l,_)}},h.Form=function(){function l(a){if(!(this instanceof l))return new l(a);if(!a.length)return!1;if(this.$el=a,this.$addons=this.$el.find(".wc-pao-addon-field"),!this.$addons.length)return this.$addons=!1,!1;this.is_rtl=document.documentElement.dir==="rtl",this.validation=new M(this),this.totals=new _(this),this.show_incomplete_subtotals=this.totals.showIncompleteSubtotals(),this.contains_required=this.containsRequired(),this.setupEvents(),this.validation.validate(),this.updateTotals(),t(".wc-pao-addon-image-swatch").tipTip({delay:200}),h.initialized_forms.push(this)}l.prototype.setupEvents=function(){var a=this;a.$el.find('button[type="submit"]').on("click",function(){if(a.validation.validate(!0))return!0;var o=a.$el.find(".wc-pao-validation-notice");if(o.length){var n=a.$el.find(o[0].closest(".wc-pao-addon-container"));if(n.length){var i=n.find(".wc-pao-addon-field").first();i.length&&(i.is(":hidden")?t(o[0]).focus():i.focus())}}return!1}),a.$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(o){if(t(this).is(".wc-pao-addon-checkbox")){var n=t(this).closest(".wc-pao-fieldset"),i=t(o.relatedTarget).closest(".wc-pao-fieldset");if(n.is(i))return}a.validation.validateAddon(t(this),!0),a.updateTotals()}),a.$el.on("change",".wc-pao-addon input.wc-pao-addon-file-upload",function(){let o=t(this),n=o.closest(".wc-pao-addon-container"),i=n.find(".reset_file"),d=n.find(".wc-pao-addon-file-name");i.length&&i.addClass("active"),d.length&&d.hide(250,function(){t(this).remove(),o.data("value","")}),a.validation.validateAddon(o,!0),a.updateTotals()}),a.$el.on("input",".wc-pao-addon input:not(.wc-pao-addon-checkbox), .wc-pao-addon textarea, .wc-pao-addon-custom-text",function(){var o=t(this);h.Helper.delay(function(){a.validation.validateAddon(o,!0),a.updateTotals()},300)}),a.$el.on("updated_addons",function(){var o=a.$el.find("#product-addons-total");o.length&&o.find(".wca-loading-bar").removeClass("is-active")}),a.$el.on("change","input.qty",function(){a.updateTotals()});var e;a.$el.on("touchstart",".wc-pao-addon-image-swatch",function(o){e=new Date}),a.$el.on("click touchend",".wc-pao-addon-image-swatch",function(o){if(o.preventDefault(),o.type==="touchend"&&e){var n=new Date-e;if(n>100)return}a.updateImageSwatch(t(this))}),a.$el.on("keydown",".wc-pao-addon-image-swatch",function(o){var n=t(this),i=n.parents(".wc-pao-addon-wrap"),d=i.find(".wc-pao-addon-image-swatch"),p=d.index(n),u=!1;if(o.key==="ArrowRight"||o.key==="ArrowDown")p=(p+1)%d.length,u=!0;else if(o.key==="ArrowLeft"||o.key==="ArrowUp")p=(p-1+d.length)%d.length,u=!0;else if(o.key===" "||o.key==="Enter"){a.updateImageSwatch(n);return}if(u){o.preventDefault();var f=d.eq(p);f.focus(),a.updateImageSwatch(f)}}),a.$el.on("click",".reset_variations",function(){a.totals.reset()}),a.$el.on("wc_variation_form",function(){a.validation.validate(),a.updateTotals()}),a.$el.on("found_variation",function(o,n){a.totals.updateVariation(n),a.validation.validate(),a.updateTotals()}),a.$el.on("hide_variation",function(o){a.updateTotals()}),a.$el.on("woocommerce-product-addons-update",function(){a.validation.validate(),a.updateTotals()});var r=a.$el.find(".datepicker");r.each(function(){var o=t(this),n=o.parent(),i=n.find(".reset_date"),d=n.find('input[name="'+o.attr("name")+'-wc-pao-date"]'),p=n.find('input[name="'+o.attr("name")+'-wc-pao-date-gmt-offset"]');p.length||(p=t("<input/>"),p.attr("type","hidden"),p.attr("name",o.attr("name")+"-wc-pao-date-gmt-offset"),n.append(p));var u=new Date,f=parseFloat(woocommerce_addons_params.gmt_offset,10),y=u.getTimezoneOffset()/60,k=y-f;if(woocommerce_addons_params.date_input_timezone_reference==="default")p.val(y);else if(woocommerce_addons_params.date_input_timezone_reference==="store"){var s=u.getHours()+u.getMinutes()/60,T=s+k;p.val(f)}o.datepicker({beforeShow:function(c,v){woocommerce_addons_params.datepicker_class&&(t("#ui-datepicker-div").removeClass(woocommerce_addons_params.datepicker_class),t("#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"});var w=o.datepicker("getDate");w!==null&&typeof w.getTime=="function"&&(w.setHours(u.getHours(),u.getMinutes()),woocommerce_addons_params.date_input_timezone_reference==="store"&&(w=h.Helper.addMinutes(w,-1*y*60),w=h.Helper.addMinutes(w,f*60)),d.val(w.getTime()/1e3),i.show()),o.on("change",function(){var c=o.datepicker("getDate");if(c!==null&&typeof c.getTime=="function"){var v=new Date;c.setHours(v.getHours(),v.getMinutes()),woocommerce_addons_params.date_input_timezone_reference==="store"&&(c=h.Helper.addMinutes(c,-1*y*60),c=h.Helper.addMinutes(c,f*60)),d.val(c.getTime()/1e3),i.show()}else i.hide(),d.val("")}),i.on("click",function(c){c.preventDefault(),d.val(""),o.val("").trigger("change")})}),a.$el.on("click",".reset_file",function(o){o.preventDefault();let n=t(this).closest(".wc-pao-addon-container"),i=n.find("input.wc-pao-addon-field"),d=n.find(".wc-pao-addon-file-name");d.length&&d.hide(250,function(){t(this).remove()}),t(this).removeClass("active").addClass("inactive"),i.data("value",""),i.val(""),a.validation.validateAddon(i,!0),a.updateTotals()}),t("#credit_called").on("keyup",function(){a.validation.validate(),a.updateTotals()})},l.prototype.updateImageSwatch=function(a){var e=a.data("value"),r=a.parents(".wc-pao-addon-wrap"),o=t.parseHTML(a.data("price")),n=r.find(".wc-pao-addon-image-swatch-selected-swatch");n.html(""),r.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"),r.find(".wc-pao-addon-image-swatch-select").val(e),n.html(o),this.validation.validateAddon(r.find("select.wc-pao-addon-field"),!0),this.updateTotals()},l.prototype.updateTotals=function(){this.totals.calculate();var a=(this.show_incomplete_subtotals||this.isValid())&&(this.contains_required||this.totals.$totals.data("price_data").length);a?this.totals.render():this.totals.reset()},l.prototype.isValid=function(){var a=!0,e=this.$el.find("button.single_add_to_cart_button");return e.is(".disabled")?(a=!1,a):(t.each(this.validation.getValidationState(),function(){if(!this.validity)return a=!1,!1}),a)},l.prototype.containsRequired=function(){var a=!1;return this.$addons.each(function(){var e=t(this).data("restrictions");if(!t.isEmptyObject(e)&&"required"in e&&e.required==="yes")return a=!0}),a};function _(a){if(!(this instanceof _))return new _(a);if(t.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'):!1,this.is_variable=this.$variation_input&&this.$variation_input.length>0,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))return!1;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=this.$subscription_plans.length>0,this.is_rtl=a.is_rtl,this.total=0,this.total_raw=0,this.show_subtotal_panel=!0,this.price_request=null}return _.prototype.showIncompleteSubtotals=function(){return this.$totals.data("show-incomplete-sub-total")===1},_.prototype.updateVariation=function(a){this.$variation_input=this.$form.hasClass("variations_form")?this.$form.find('input[name="variation_id"], input.variation_id'):!1,this.product_id=a.variation_id,this.$totals.data("product-id",this.product_id),typeof a.display_price<"u"?this.base_price=a.display_price:t(a.price_html).find(".amount").last().length&&(this.base_price=t(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)},_.prototype.calculate=function(){var a=this;a.qty=parseFloat(a.$form.find("input.qty").val()),a.addons_price_data=[],a.total=0,a.total_raw=0,a.base_price=a.$totals.data("price"),a.raw_price=a.$totals.data("raw-price"),a.product_id=a.is_variable?a.$variation_input.val():a.$totals.data("product-id"),a.base_price===""&&typeof custom_gift_card_amount<"u"&&custom_gift_card_amount.length&&0<custom_gift_card_amount.val()&&(a.base_price=custom_gift_card_amount.val()),woocommerce_addons_params.is_bookings&&t(".wc-bookings-booking-cost").length&&(a.base_price=parseFloat(t(".wc-bookings-booking-cost").attr("data-raw-price"))),this.$addons.each(function(){var e=t(this),r=e.parents(".wc-pao-addon");if(!(e.is(".wc-pao-addon-file-upload")&&r.find(".wc-pao-addon-file-name input").length&&!r.find(".wc-pao-addon-file-name input").val()||!(e.is(".wc-pao-addon-file-upload")&&r.find(".wc-pao-addon-file-name input").length)&&!e.val())){var o=r.find(".wc-pao-addon-name").length?r.find(".wc-pao-addon-name").data("addon-name"):"",n="",i=0,d=0,p=e.data("price-type"),u=0,f=0,y=e.data("duration-type"),k=!1,s={},T=r.find(".wc-pao-addon-name").length?r.find(".wc-pao-addon-name").data("has-per-person-pricing"):!1,w=r.find(".wc-pao-addon-name").length?r.find(".wc-pao-addon-name").data("has-per-block-pricing"):!1;if(e.is(".wc-pao-addon-custom-price"))k=!0,i=e.val(),d=e.val(),p="quantity_based",woocommerce_addons_params.currency_format_decimal_sep!=="."&&(i=i.replace(woocommerce_addons_params.currency_format_decimal_sep,"."),d=d.replace(woocommerce_addons_params.currency_format_decimal_sep,"."));else if(e.is(".wc-pao-addon-input-multiplier"))e.val()!==""&&(e.val(Math.ceil(e.val())),i=e.data("price")*e.val(),d=e.data("raw-price")*e.val(),u=e.data("duration")*e.val(),f=e.data("raw-duration")*e.val());else if(e.is(".wc-pao-addon-checkbox, .wc-pao-addon-radio")){if(!e.is(":checked"))return;n=e.data("label"),i=e.data("price"),d=e.data("raw-price"),u=e.data("duration"),f=e.data("raw-duration")}else if(e.is(".wc-pao-addon-image-swatch-select, .wc-pao-addon-select")){if(!e.find("option:selected")||e.find("option:selected").val()==="")return;p=e.find("option:selected").data("price-type"),y=e.find("option:selected").data("duration-type"),n=e.find("option:selected").data("label"),i=e.find("option:selected").data("price"),d=e.find("option:selected").data("raw-price"),u=e.find("option:selected").data("duration"),f=e.find("option:selected").data("raw-duration")}else if(e.is(".wc-pao-addon-file-upload"))i=e.data("price"),d=e.data("raw-price");else{if(!e.val())return;i=e.data("price"),d=e.data("raw-price"),u=e.data("duration"),f=e.data("raw-duration")}if(i||(i=0),d||(d=0),u||(u=0),f||(f=0),(a.product_type==="booking"||a.product_type==="accommodation-booking")&&woocommerce_addons_params.is_bookings){a.qty=0;var c=0;typeof t("#wc_bookings_field_duration")<"u"&&0<t("#wc_bookings_field_duration").val()&&(c=t("#wc_bookings_field_duration").val()),typeof t("#wc-bookings-form-end-time")<"u"&&0<t("#wc-bookings-form-end-time").val()&&(c=t("#wc-bookings-form-end-time").val());var v=t("#wc_bookings_field_persons"),$=0;v.length===1?$=parseInt($,10)+parseInt(v.val(),10):t(".wc-bookings-booking-form").find("input").each(function(){var g=this.id.match(/wc_bookings_field_persons_(\d+)/);g!==null&&typeof g<"u"&&t("#"+g[0]).length&&($=parseInt($,10)+parseInt(t("#"+g[0]).val(),10))}),a.qty===0&&t(".wc-bookings-booking-cost").length&&(a.qty=1),T&&$&&(a.qty*=$),w&&c&&(a.qty*=c)}switch(p){case"flat_fee":s.cost=parseFloat(i),s.cost_raw=parseFloat(d);break;case"quantity_based":s.cost_pu=parseFloat(i),s.cost_raw_pu=parseFloat(d),s.cost=s.cost_pu*a.qty,s.cost_raw=s.cost_raw_pu*a.qty;break;case"percentage_based":s.cost_pct=parseFloat(i)/100,s.cost_raw_pct=parseFloat(d)/100,s.cost=parseFloat(a.base_price)*s.cost_pct*a.qty,s.cost_raw=parseFloat(a.raw_price)*s.cost_raw_pct*a.qty;break}switch(a.total+=s.cost||0,a.total_raw+=s.cost_raw||0,y){case"flat_time":case"":s.duration=f,s.duration_raw=f;break;case"quantity_based":s.duration_pu=f,s.duration_raw_pu=f,s.duration=s.duration_pu*a.qty,s.duration_raw=s.duration_raw_pu*a.qty;break}if(typeof n<"u"){if(typeof n=="number"||n.length)s.name=o+(n?" - "+n:""),s.nameFormattedHTML='<span class="wc-pao-addon-name">'+o+"</span>"+(n?' - <span class="wc-pao-addon-value">'+n+"</span>":"");else{var m=e.val(),b=parseInt(woocommerce_addons_params.trim_user_input_characters,10);e.is(".wc-pao-addon-file-upload")?(r.find(".wc-pao-addon-file-name").length&&(m=r.find(".wc-pao-addon-file-name").data("value")),m=m.replace(/^.*[\\\/]/,"")):e.is(".wc-pao-addon-custom-price")&&(woocommerce_addons_params.currency_format_decimal_sep!=="."&&(m=m.replace(woocommerce_addons_params.currency_format_decimal_sep,".")),m=accounting.formatNumber(m,{symbol:"",decimal:woocommerce_addons_params.currency_format_decimal_sep,precision:parseFloat(m)%1===0?0:m.toString().split(".")[1].length})),b<m.length&&(m=m.slice(0,b)+"..."),s.name=o+" - "+h.Helper.escapeHtml(m),s.nameFormattedHTML='<span class="wc-pao-addon-name">'+o+'</span> - <span class="wc-pao-addon-value">'+h.Helper.escapeHtml(m)+"</span>"}s.is_custom_price=k,s.price_type=p,s.duration_type=y,a.addons_price_data.push(s)}}}),a.$totals.data("price_data",a.addons_price_data),a.$totals.find(".wca-loading-bar").length||a.$totals.append('<div class="wca-loading-bar"></div>'),a.$totals.find(".wca-loading-bar").addClass("is-active"),a.$form.trigger("updated_addons")},_.prototype.render=function(){var a=this;if(!a.$totals.data("show-sub-total")){a.$totals.empty(),a.$form.trigger("updated_addons");return}if(a.qty){var e,r,o,n,i,d=a.formatMoney(a.total),p=!1;if(typeof a.base_price<"u"&&a.product_id){t(".wc-bookings-booking-form").length||t(".wc-appointments-appointment-cost").length?e=isNaN(a.base_price)?0:parseFloat(a.base_price):e=parseFloat(a.base_price*a.qty);var u=!!a.$totals.data("hide-product-price");r=u?a.formatMoney(a.total):a.formatMoney(e+a.total)}if(a.has_subscription_plans){var f=a.$form.data("satt_script");if(f&&f.schemes_model.get_active_scheme_key()){var y=a.$subscription_plans.find("input:checked");y.val()&&(o=y.parent().find(".subscription-details"))}}else a.$form.parent().find(".subscription-details").length&&(a.$form.hasClass("bundle_data")||(o=a.$form.parent().find(".subscription-details"),a.$variation_input&&a.$variation_input.length>0&&(o=a.$form.parent().find(".woocommerce-variation .subscription-details"))));if(o&&o.length>0&&(n=" "+o.clone().wrap("<p>").parent().html()),a.product_type==="grouped"?n&&!h.Helper.isGroupedMixedProductType()&&h.Helper.isGroupedSubsSelected()&&(d+=n,r&&(r+=n)):n&&r&&(r+=n),r){var k=a.$form.find(".wc-pao-addon-container").data("product-name"),s=a.formatMoney(e),T=a.$form.find(".wc-pao-addon-container").data("product-tax-status"),u=!!a.$totals.data("hide-product-price");if(u)i='<div class="product-addon-totals"><ul>';else if(t(".wc-bookings-booking-form").length)i='<div class="product-addon-totals"><ul><li><div class="wc-pao-col1"><strong>'+k+'</strong></div><div class="wc-pao-col2"><strong><span class="amount">'+s+"</span></strong></div></li>";else{var w=a.is_rtl?woocommerce_addons_params.quantity_symbol+a.qty:a.qty+woocommerce_addons_params.quantity_symbol;i='<div class="product-addon-totals"><ul><li><div class="wc-pao-col1"><strong><span>'+w+"</span> "+k+'</strong></div><div class="wc-pao-col2"><strong><span class="amount">'+s+"</span></strong></div></li>"}a.addons_price_data.length&&t.each(a.addons_price_data,function(m,b){var g=b.cost,q;g===0?q="-":g>0?q=a.formatMoney(g):q="-"+a.formatMoney(Math.abs(g)),i=i+'<li><div class="wc-pao-col1"><strong>'+b.nameFormattedHTML+'</strong></div><div class="wc-pao-col2"><span class="amount">'+q+"</span></div></li>",woocommerce_addons_params.tax_enabled&&b.is_custom_price&&(p=!0)});var c="",v=typeof a.$totals.data("i18n_sub_total")>"u"?woocommerce_addons_params.i18n_sub_total:a.$totals.data("i18n_sub_total");if(!p&&(!woocommerce_addons_params.price_display_suffix||!woocommerce_addons_params.tax_enabled)){i=i+'<li class="wc-pao-subtotal-line"><p class="price">'+v+' <span class="amount">'+r+"</span></p></li></ul></div>",a.show_subtotal_panel?a.$totals.html(i):a.$totals.html(""),a.$form.trigger("updated_addons");return}if(T==="taxable"&&!p&&!(woocommerce_addons_params.price_display_suffix.indexOf("{price_including_tax}")>-1)&&!(woocommerce_addons_params.price_display_suffix.indexOf("{price_excluding_tax}")>-1)){i=i+'<li class="wc-pao-subtotal-line"><strong>'+v+' <span class="amount">'+r+"</span> "+woocommerce_addons_params.price_display_suffix+"</strong></li></ul></div>",a.show_subtotal_panel?a.$totals.html(i):a.$totals.html(""),a.$form.trigger("updated_addons");return}a.price_request=t.ajax({type:"POST",url:woocommerce_addons_params.ajax_url,data:{action:"wc_product_addons_calculate_tax",product_id:a.product_id,add_on_total:a.total,add_on_total_raw:a.total_raw,qty:a.qty},beforeSend:function(){a.price_request!=null&&a.price_request.abort()},complete:function(){a.price_request=null},success:function(m){if(m.result=="SUCCESS"){c='<small class="woocommerce-price-suffix">'+woocommerce_addons_params.price_display_suffix+"</small>";var b=a.formatMoney(m.price_including_tax),g=a.formatMoney(m.price_excluding_tax);c=c.replace("{price_including_tax}",'<span class="amount">'+b+"</span>"),c=c.replace("{price_excluding_tax}",'<span class="amount">'+g+"</span>");var q=woocommerce_addons_params.display_include_tax?b:g;i=i+'<li class="wc-pao-subtotal-line"><p class="price">'+v+' <span class="amount">'+q+"</span> "+c+" </p></li></ul></div>",a.show_subtotal_panel?a.$totals.html(i):a.$totals.html(""),a.$form.trigger("updated_addons")}else i=i+'<li class="wc-pao-subtotal-line"><p class="price">'+v+' <span class="amount">'+r+"</span></p></li></ul></div>",a.show_subtotal_panel?a.$totals.html(i):a.$totals.html(""),a.$form.trigger("updated_addons")},error:function(){i=i+'<li class="wc-pao-subtotal-line"><p class="price">'+v+' <span class="amount">'+r+"</span></p></li></ul></div>",a.show_subtotal_panel?a.$totals.html(i):a.$totals.html(""),a.$form.trigger("updated_addons")}})}else a.$totals.empty(),a.$form.trigger("updated_addons")}else a.$totals.empty(),a.$form.trigger("updated_addons")},_.prototype.reset=function(){this.$totals.empty(),this.$totals.html(""),this.$form.trigger("updated_addons")},_.prototype.formatMoney=function(a){let e=woocommerce_addons_params.currency_format_num_decimals;if(woocommerce_addons_params.trim_trailing_zeros){let r=parseFloat(a)%1===0;a=parseFloat(a),r?e=0:e=a.toString().split(".")[1].length}return 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:e,format:woocommerce_addons_params.currency_format})},l}(),t(function(){t("body").on("quick-view-displayed",function(){t(this).find(".cart:not(.cart_group)").each(function(){var l=new h.Form(t(this))})}),t("body").find(".cart:not(.cart_group)").each(function(){var l=new h.Form(t(this))})})})(jQuery,window);})();