(window.webpackJsonp=window.webpackJsonp||[]).push([[134],{299:function(t,o,e){"use strict";e.r(o);e(35);o.default={data:()=>({seconds:1,pendingProducts:[]}),methods:{handleProductInput(t,o){if(t<=0)this.removeProductFromQueue(o);else{if(o.agotado)return this.askForNotification(o);if(o.presentacion)return this.$store.commit("cart/SET_DRAWER_PRODUCT",{value:!0,product:o});this.addProductToQueue(o),this.fireTimer(o)}},addProductToCart(t){this.$store.commit("cart/ADD",t),this.clearOrigin(t);var o=this.$store.getters["cart/total"],{amount:e,notification:r}=this.$store.getters["commons/minimumPurchase"],c=r||"Para compra minima agrege al carrito";oo.codigo===t.codigo);o?(clearTimeout(o.timer),Object.assign(o,t)):this.pendingProducts.push(t)},removeProductFromQueue(t){var o=this.pendingProducts.findIndex(o=>o.codigo===t.codigo);-1!==o&&(clearTimeout(this.pendingProducts[o].timer),this.pendingProducts.splice(o,1))},fireTimer(t){var o=this.pendingProducts.find(o=>t.codigo===o.codigo),e=setTimeout(()=>{o?(this.addProductToCart(o),this.removeProductFromQueue(o)):this.clearOrigin(t)},1e3*this.seconds);o&&(o.timer=e)},clearOrigin(t){"function"==typeof this.clear&&this.clear(t)}}}}}]);