PageSourceSearch

https://barringtoncoffee.com/wp-content/plugins/woocommerce-produc…/assets/js/frontend/addons.min.js?ver=8.4.2

js barringtoncoffee.com collected 2026-09-26 08:52:39 UTC 18,937 bytes, 1 lines download raw bytes

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

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.