// source --> https://relojesdeco.es/wp-content/plugins/woocommerce-deposits/assets/js/add-to-cart.prod.js?ver=4.6.10 
"use strict";jQuery(document).ready(function(c){var r=wc_deposits_add_to_cart_options;c.fn.initDepositController=function(){var n={init:function(t,o,e){var a=1<arguments.length&&void 0!==o&&o,r=2<arguments.length&&void 0!==e&&e;n.update_html_request=!1;var i=c(t),d=i.find(".webtomizer_wcdp_single_deposit_form");n.$cart=i,(n.$form=d).deposit=d.find(".pay-deposit").get(0),d.full=d.find(".pay-full-amount").get(0),d.msg=d.find(".wc-deposits-notice"),d.amount=d.find(".deposit-amount"),d.ajax_refreh=d.data("ajax-refresh"),d.payment_plans_container=d.find(".wcdp-payment-plans"),i.woocommerce_products_addons=i.find("#product-addons-total"),void 0!==c.epoAPI&&c.epoAPI.addFilter("tcAdjustFormattedFinalTotal",this.tmepo_price_change,10,2),i.on("change","input, select",this.update_status),a||(d.closest(".product").hasClass("product-type-variable")&&d.slideUp(),0<i.woocommerce_products_addons.length&&i.on("updated_addons",this.addons_updated),i.on("show_variation",this.update_variation).on("click",".reset_variations",function(){n.$form.removeAttr("data-variation-id"),c(d).slideUp()}),i.on("hide_variation",this.hide)),r&&("deposit"===r?(c(n.$form.deposit).attr("checked","checked"),c(n.$form.full).removeAttr("checked")):(c(n.$form.full).attr("checked","checked"),c(n.$form.deposit).removeAttr("checked"))),this.update_status(d),d.on("update_html",this.update_html),0<c(d.payment_plans_container).length&&this.update_payment_plans_container()},hide:function(){n.$form.removeAttr("data-variation-id"),n.$form.slideUp(),n.$form.css("display","none!important")},update_payment_plans_container:function(){n.$form.payment_plans_container.find("a.wcdp-view-plan-details").click(function(){var t,o=".plan-details-"+c(this).data("id");"no"===c(this).data("expanded")?(t=c(this).data("hide-text"),c(this).text(t),c(this).data("expanded","yes"),n.$form.find(o).slideDown()):"yes"===c(this).data("expanded")&&(t=c(this).data("view-text"),c(this).text(t),c(this).data("expanded","no"),n.$form.find(o).slideUp())})},tmepo_price_change:function(t,o){var e=o.epo.product_id;0<c(".variation_id").length&&"0"!=c(".variation_id").val()&&(e=c(".variation_id").val());var a={price:o.product_total_price/o.cartQty,product_id:e,trigger:"woocommerce_tm_extra_product_options"};return n.$form.trigger("update_html",a),t},addons_updated:function(){if(n.$cart.hasClass("variations_form")&&!n.$form.data("variation-id"))return;var t,o=n.$cart.woocommerce_products_addons,e={price:0,product_id:c(o).data("product-id"),trigger:"woocommerce_product_addons"};e.price=c(o).data("price"),n.$cart.find("#wc-bookings-booking-form").length&&(0<c(".wc-bookings-booking-cost").length?(t=parseFloat(c(".wc-bookings-booking-cost").attr("data-raw-price")),Number.isNaN(t)||(e.price=t)):e.price=0);var a=c(o).data("price_data");c.each(a,function(t,o){e.price=e.price+o.cost}),void 0===n.$cart.woocommerce_products_addons_price&&(n.$cart.woocommerce_products_addons_price=0),e.price===n.$cart.woocommerce_products_addons_price||n.$form.trigger("update_html",e)},update_html:function(t,e){var a,o;e&&"no"!==n.$form.ajax_refreh&&(Number.isNaN(e.price)||e.product_id&&(a=!1,n.$cart.woocommerce_products_addons.length&&"woocommerce_product_addons"!==e.trigger||("woocommerce_product_addons"===e.trigger&&(n.$cart.hasClass("variations_form")&&(a=n.$form.data("variation-id")),n.$cart.woocommerce_products_addons_price=e.price),n.update_html_request&&(n.update_html_request.abort(),n.update_html_request=!1),n.$cart.block({message:null,overlayCSS:{background:"#fff",backgroundSize:"16px 16px",opacity:.6}}),o={action:"wc_deposits_update_deposit_container",price:e.price,product_id:e.product_id,data:e},n.update_html_request=c.post(r.ajax_url,o).done(function(t){var o;t.success&&(n.$form.replaceWith(t.data),o="full",c(n.$form.deposit).is(":checked")&&(o="deposit"),n.init(n.$cart,!0,o)),"woocommerce_product_addons"===e.trigger&&(n.$cart.woocommerce_products_addons_price=e.price,n.$cart.hasClass("variations_form")&&a&&n.$form.data("variation-id",a)),n.$cart.unblock()}).fail(function(){}))))},update_status:function(){c(n.$form.deposit).is(":checked")?(0<n.$form.payment_plans_container.length&&n.$form.payment_plans_container.slideDown(),c(n.$form.msg).html(r.message.deposit)):c(n.$form.full).is(":checked")&&(0<n.$form.payment_plans_container.length&&n.$form.payment_plans_container.slideUp(),c(n.$form.msg).html(r.message.full))},update_variation:function(t,o){var e=o.variation_id,a={product_id:e};n.$form.data("variation-id",e),n.$form.trigger("update_html",a)}};n.init(this)},c("body").find("form.cart").each(function(t,o){c(o).initDepositController()})});