// source --> https://mundomaisverde.com/wp-content/plugins/woocommerce/assets/js/frontend/single-product.min.js?ver=10.7.0 
jQuery(function(t){if("undefined"==typeof wc_single_product_params)return!1;t("body").on("init",".wc-tabs-wrapper, .woocommerce-tabs",function(){t(this).find(".wc-tab, .woocommerce-tabs .panel:not(.panel .panel)").hide();var e=window.location.hash,i=window.location.href,o=t(this).find(".wc-tabs, ul.tabs").first();e.toLowerCase().indexOf("comment-")>=0||"#reviews"===e||"#tab-reviews"===e?o.find("li.reviews_tab a").trigger("click"):i.indexOf("comment-page-")>0||i.indexOf("cpage=")>0?o.find("li.reviews_tab a").trigger("click"):"#tab-additional_information"===e?o.find("li.additional_information_tab a").trigger("click"):o.find("li:first a").trigger("click")}).on("click",".wc-tabs li a, ul.tabs li a",function(e){e.preventDefault();var i=t(this),o=i.closest(".wc-tabs-wrapper, .woocommerce-tabs"),a=o.find(".wc-tabs, ul.tabs");a.find("li").removeClass("active"),a.find('a[role="tab"]').attr("aria-selected","false").attr("tabindex","-1"),o.find(".wc-tab, .panel:not(.panel .panel)").hide(),i.closest("li").addClass("active"),i.attr("aria-selected","true").attr("tabindex","0"),o.find("#"+i.attr("href").split("#")[1]).show()}).on("keydown",".wc-tabs li a, ul.tabs li a",function(e){var i="rtl"===document.documentElement.dir,o=e.key,a=i?"ArrowLeft":"ArrowRight",r=i?"ArrowRight":"ArrowLeft",n="ArrowDown",s="ArrowUp",l="Home",c="End";if([a,r,n,s,c,l].includes(o)){var d=t(this),p=d.closest(".wc-tabs-wrapper, .woocommerce-tabs").find(".wc-tabs, ul.tabs").find('a[role="tab"]'),h=p.length-1,g=p.index(d),u=o===r||o===s?g-1:g+1,m="horizontal";if(p.length>=2){var _=p[0].getBoundingClientRect(),f=p[1].getBoundingClientRect();m=Math.abs(f.top-_.top)>Math.abs(f.left-_.left)?"vertical":"horizontal"}("vertical"!==m||o!==r&&o!==a)&&("horizontal"!==m||o!==s&&o!==n)&&(e.preventDefault(),o===r&&0===g&&"horizontal"===m||o===s&&0===g&&"vertical"===m||o===c?u=h:(a===o&&g===h&&"horizontal"===m||n===o&&g===h&&"vertical"===m||o===l)&&(u=0),p.eq(u).focus())}}).on("click","a.woocommerce-review-link",function(){return t(".reviews_tab a").trigger("click"),!0}).on("init","#rating",function(){t(this).hide().before('<p class="stars">\t\t\t\t\t\t<span role="group" aria-labelledby="comment-form-rating-label">\t\t\t\t\t\t\t<a role="radio" tabindex="0" aria-checked="false" class="star-1" href="#">'+wc_single_product_params.i18n_rating_options[0]+'</a>\t\t\t\t\t\t\t<a role="radio" tabindex="-1" aria-checked="false" class="star-2" href="#">'+wc_single_product_params.i18n_rating_options[1]+'</a>\t\t\t\t\t\t\t<a role="radio" tabindex="-1" aria-checked="false" class="star-3" href="#">'+wc_single_product_params.i18n_rating_options[2]+'</a>\t\t\t\t\t\t\t<a role="radio" tabindex="-1" aria-checked="false" class="star-4" href="#">'+wc_single_product_params.i18n_rating_options[3]+'</a>\t\t\t\t\t\t\t<a role="radio" tabindex="-1" aria-checked="false" class="star-5" href="#">'+wc_single_product_params.i18n_rating_options[4]+"</a>\t\t\t\t\t\t</span>\t\t\t\t\t</p>")}).on("click","#respond p.stars a",function(){var e=t(this),i=e.closest("p.stars").find("a").index(e)+1,o=t(this).closest("#respond").find("#rating"),a=t(this).closest(".stars");return o.val(i),e.siblings("a").removeClass("active").attr("aria-checked","false").attr("tabindex","-1"),e.addClass("active").attr("aria-checked","true").attr("tabindex","0"),a.addClass("selected"),!1}).on("click","#respond #submit",function(){var e=t(this).closest("#respond").find("#rating"),i=e.val();if(e.length>0&&!i&&"yes"===wc_single_product_params.review_rating_required)return window.alert(wc_single_product_params.i18n_required_rating_text),!1}).on("keyup",".wc-tabs li a, ul.tabs li a, #respond p.stars a",function(e){var i=e.key,o=["ArrowRight","ArrowDown"];o.concat(["ArrowLeft","ArrowUp"]).includes(i)&&(e.preventDefault(),e.stopPropagation(),o.includes(i)?t(this).next().focus().click():t(this).prev().focus().click())}),t(".wc-tabs-wrapper, .woocommerce-tabs, #rating").trigger("init");var e=function(e,i){this.$target=e,this.$images=t(".woocommerce-product-gallery__image",e),0!==this.$images.length?(e.data("product_gallery",this),this.flexslider_enabled="function"==typeof t.fn.flexslider&&wc_single_product_params.flexslider_enabled,this.zoom_enabled="function"==typeof t.fn.zoom&&wc_single_product_params.zoom_enabled,this.photoswipe_enabled="undefined"!=typeof PhotoSwipe&&wc_single_product_params.photoswipe_enabled,i&&(this.flexslider_enabled=!1!==i.flexslider_enabled&&this.flexslider_enabled,this.zoom_enabled=!1!==i.zoom_enabled&&this.zoom_enabled,this.photoswipe_enabled=!1!==i.photoswipe_enabled&&this.photoswipe_enabled),1===this.$images.length&&(this.flexslider_enabled=!1),this.initFlexslider=this.initFlexslider.bind(this),this.initZoom=this.initZoom.bind(this),this.initZoomForTarget=this.initZoomForTarget.bind(this),this.initPhotoswipe=this.initPhotoswipe.bind(this),this.onResetSlidePosition=this.onResetSlidePosition.bind(this),this.getGalleryItems=this.getGalleryItems.bind(this),this.openPhotoswipe=this.openPhotoswipe.bind(this),this.trapFocusPhotoswipe=this.trapFocusPhotoswipe.bind(this),this.handlePswpTrapFocus=this.handlePswpTrapFocus.bind(this),this.flexslider_enabled?(this.initFlexslider(i.flexslider),e.on("woocommerce_gallery_reset_slide_position",this.onResetSlidePosition)):this.$target.css("opacity",1),this.zoom_enabled&&(this.initZoom(),e.on("woocommerce_gallery_init_zoom",this.initZoom)),this.photoswipe_enabled&&this.initPhotoswipe()):this.$target.css("opacity",1)};e.prototype.initFlexslider=function(e){var i=this.$target,o=this,a=t.extend({selector:".woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image",start:function(){i.css("opacity",1)},after:function(t){o.initZoomForTarget(o.$images.eq(t.currentSlide))}},e);i.flexslider(a),t(".woocommerce-product-gallery__wrapper .woocommerce-product-gallery__image:eq(0) .wp-post-image").one("load",function(){var e=t(this);e&&setTimeout(function(){var t=e.closest(".woocommerce-product-gallery__image").height(),i=e.closest(".flex-viewport");t&&i&&i.height(t)},100)}).each(function(){this.complete&&t(this).trigger("load")})},e.prototype.initZoom=function(){"complete"===document.readyState?this.initZoomForTarget(this.$images.first()):t(window).on("load",()=>{this.initZoomForTarget(this.$images.first())})},e.prototype.initZoomForTarget=function(e){if(!this.zoom_enabled)return!1;var i=this.$target.width(),o=!1;if(t(e).each(function(e,a){if(t(a).find("img").data("large_image_width")>i)return o=!0,!1}),o){var a=t.extend({touch:!1,callback:function(){var t=this;setTimeout(function(){t.removeAttribute("role"),t.setAttribute("alt",""),t.setAttribute("aria-hidden","true")},100)}},wc_single_product_params.zoom_options);"ontouchstart"in document.documentElement&&(a.on="click"),e.trigger("zoom.destroy"),e.zoom(a),setTimeout(function(){e.find(":hover").length&&e.trigger("mouseover")},100)}},e.prototype.initPhotoswipe=function(){this.zoom_enabled&&this.$images.length>0?(this.$target.prepend('<a href="#" role="button" class="woocommerce-product-gallery__trigger" aria-haspopup="dialog" aria-controls="photoswipe-fullscreen-dialog" aria-label="'+wc_single_product_params.i18n_product_gallery_trigger_text+'"><span aria-hidden="true">🔍</span></a>'),this.$target.on("click",".woocommerce-product-gallery__trigger",this.openPhotoswipe),this.$target.on("keydown",".woocommerce-product-gallery__trigger",t=>{" "===t.key&&this.openPhotoswipe(t)}),this.$target.on("click",".woocommerce-product-gallery__image a",function(t){t.preventDefault()}),this.flexslider_enabled||this.$target.on("click",".woocommerce-product-gallery__image a",this.openPhotoswipe)):this.$target.on("click",".woocommerce-product-gallery__image a",this.openPhotoswipe)},e.prototype.onResetSlidePosition=function(){this.$target.flexslider(0)},e.prototype.getGalleryItems=function(){var e=this.$images,i=[];return e.length>0&&e.each(function(e,o){var a=t(o).find("img");if(a.length){var r=a.attr("data-large_image"),n=a.attr("data-large_image_width"),s=a.attr("data-large_image_height"),l={alt:a.attr("alt"),src:r,w:n,h:s,title:a.attr("data-caption")?a.attr("data-caption"):a.attr("title")};i.push(l)}}),i},e.prototype.openPhotoswipe=function(e){e.preventDefault();var i,o=t(".pswp")[0],a=this.getGalleryItems(),r=t(e.target),n=e.currentTarget,s=this;i=0<r.closest(".woocommerce-product-gallery__trigger").length?this.$target.find(".flex-active-slide"):r.closest(".woocommerce-product-gallery__image");var l=t.extend({index:t(i).index(),addCaptionHTMLFn:function(t,e){return t.title?(e.children[0].textContent=t.title,!0):(e.children[0].textContent="",!1)},timeToIdle:0},wc_single_product_params.photoswipe_options),c=new PhotoSwipe(o,PhotoSwipeUI_Default,a,l);c.listen("afterInit",function(){s.trapFocusPhotoswipe(!0)}),c.listen("close",function(){s.trapFocusPhotoswipe(!1),n.focus()}),c.init()},e.prototype.trapFocusPhotoswipe=function(t){var e=document.querySelector(".pswp");e&&(t?e.addEventListener("keydown",this.handlePswpTrapFocus):e.removeEventListener("keydown",this.handlePswpTrapFocus))},e.prototype.handlePswpTrapFocus=function(t){var e=t.currentTarget.querySelectorAll("button:not([disabled])"),i=Array.from(e).filter(function(t){return"none"!==t.style.display&&"none"!==window.getComputedStyle(t).display});if(!(1>=i.length)){var o=i[0],a=i[i.length-1];"Tab"===t.key&&(t.shiftKey?document.activeElement===o&&(t.preventDefault(),a.focus()):document.activeElement===a&&(t.preventDefault(),o.focus()))}},t.fn.wc_product_gallery=function(t){return new e(this,t||wc_single_product_params),this},t(".woocommerce-product-gallery").each(function(){t(this).trigger("wc-product-gallery-before-init",[this,wc_single_product_params]),t(this).wc_product_gallery(wc_single_product_params),t(this).trigger("wc-product-gallery-after-init",[this,wc_single_product_params])})});
// source --> https://mundomaisverde.com/wp-content/plugins/woocommerce/assets/js/js-cookie/js.cookie.min.js?ver=2.1.4-wc.10.7.0 
/*! js-cookie v3.0.5 | MIT */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self,function(){var n=e.Cookies,o=e.Cookies=t();o.noConflict=function(){return e.Cookies=n,o}}())}(this,function(){"use strict";function e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)e[o]=n[o]}return e}return function t(n,o){function r(t,r,i){if("undefined"!=typeof document){"number"==typeof(i=e({},o,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var c="";for(var u in i)i[u]&&(c+="; "+u,!0!==i[u]&&(c+="="+i[u].split(";")[0]));return document.cookie=t+"="+n.write(r,t)+c}}return Object.create({set:r,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var t=document.cookie?document.cookie.split("; "):[],o={},r=0;r<t.length;r++){var i=t[r].split("="),c=i.slice(1).join("=");try{var u=decodeURIComponent(i[0]);if(o[u]=n.read(c,u),e===u)break}catch(f){}}return e?o[e]:o}},remove:function(t,n){r(t,"",e({},n,{expires:-1}))},withAttributes:function(n){return t(this.converter,e({},this.attributes,n))},withConverter:function(n){return t(e({},this.converter,n),this.attributes)}},{attributes:{value:Object.freeze(o)},converter:{value:Object.freeze(n)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"})});
// source --> https://mundomaisverde.com/wp-content/plugins/shipping-simulator-for-woocommerce/assets/js/form.min.js?ver=2.4.4 
(()=>{window.addEventListener("DOMContentLoaded",()=>{let u=(e,o=document)=>o.querySelector(e),_=(e,o,n)=>e.addEventListener(o,n),k=u("#wc-shipping-sim");if(!k)return;let f=u("#wc-shipping-sim-form"),d=JSON.parse(f.dataset.params),s=u(".input-postcode",f),m=u(".button.submit",f),v=u("#wc-shipping-sim-results"),p=e=>e,t={...d,requesting:!1,hooks:{filterFormData:p,filterXHR:p,filterResults:p,filterProduct:p,filterQuantity:p,filterPostcodeMaxLength:()=>t.postcode_mask?t.postcode_mask.length:15,beforeSubmit:e=>{t.hooks.resultsHandler(""),s.disabled=!0,m.classList.add("loading")},afterSubmit:e=>{s.disabled=!1,m.classList.remove("loading")},resultsHandler:e=>{v.ariaBusy=e?"false":"true",v.innerHTML=e},errorHandler:(e,o)=>{alert(e||t.errors.unexpected),console.error("wc-shipping-simulator request error:",o)},submitHandler:e=>{if(e.preventDefault(),t.requesting)return;let o=g();if(o.id===0)return;t.requesting=!0;let n=o.variation_id?"&variation_id="+o.variation_id:"",a=b(),h=t.hooks.filterFormData(`action=${d.ajax_action}&postcode=${s.value}&product_id=${o.id}&quantity=${a>=1?a:1}${n}`),r=new XMLHttpRequest;r.open("POST",d.ajax_url,!0),r.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),r.timeout=+t.timeout||0,r.onload=()=>{t.requesting=!1,t.hooks.afterSubmit(r);try{let i=JSON.parse(r.responseText);if(i.success){let l=t.hooks.filterResults(i.results_html?i.results_html:"");t.hooks.resultsHandler(l)}else t.hooks.errorHandler(i.error,i)}catch(i){t.hooks.errorHandler(null,i)}},r.ontimeout=()=>{t.requesting=!1,t.hooks.afterSubmit(r),t.hooks.errorHandler(t.errors.timeout,"timeout")},r=t.hooks.filterXHR(r),t.hooks.beforeSubmit(r),r.send(h)},inputMaskHandler:()=>{if(s.maxLength=t.hooks.filterPostcodeMaxLength(),t.postcode_mask){let o=function(n,a,h="X"){if(!a)return n;let r="",i=(n+"").replace(/[^0-9]/g,"");for(let l=0,c=0,w=a.length;l<w&&i[c];l++)h===a[l]?(r+=i[c],c++):(r+=a[l]||"",c=c>0?c--:0);return r};var e=o;_(s,"input",n=>{let a=t.postcode_mask;s.value=o(s.value||"",a),s.maxLength=t.postcode_mask.length}),s.dispatchEvent(new Event("input"))}}}};window.wc_shipping_simulator=t,document.dispatchEvent(new Event("wc_shipping_simulator:init")),k.style.display=t.root_display,t.hooks.inputMaskHandler&&t.hooks.inputMaskHandler(),_(f,"submit",t.hooks.submitHandler),t.auto_submit&&t.postcode_mask&&_(s,"input",e=>{let o=t.hooks.filterPostcodeMaxLength();o>0&&s.value.length===o&&(s.blur(),m.click())});function g(){let e={type:d.product_type,id:d.product_id};if(e.type==="variable"){let o=u(".variations_form .variation_id");if(e.variation_id=o?o.value:0,t.requires_variation&&!e.variation_id){let n=wc_add_to_cart_variation_params?wc_add_to_cart_variation_params.i18n_make_a_selection_text:"";t.hooks.errorHandler(n,"no_variation_selected"),e.id=0}}return t.hooks.filterProduct(e)}function b(){let e=1,o=u('.cart [name="quantity"]');return o&&(e=o.value),t.hooks.filterQuantity(+e||1)}});})();
// source --> https://mundomaisverde.com/wp-content/plugins/melhor-envio-cotacao/assets/js/shipping-product-page.js?ver=1707ae824362bebd67785847eed20c17 
(function ($) {
    'use strict';
    $(function () {
        toggleCalculator();
        $(document).on('keyup', '.iptCep', function (e) {
            jQuery('.observation-shipping-free').hide();
            resetarTabela();
            if ($(this).val().length === 9) {
                var url = $('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto #calculo_frete_endpoint_url').val();
                var cep = $(this).val();
                var id_produto = $('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto #id_produto').val();

                if ($(e.target).is('a#cfpp_credits')) { return; }

                var errors = [];
                if (errors.length > 0) {
                    var row = '';
                    row = '<tr><td colspan="3">Ocorreu um erro ao obter informações sobre o valor do frete</td></tr>';
                    errors.map(item => {
                        row += `<tr><td colspan="3">${item}</td></tr>`;
                        return row;
                    });
                    $('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto .resultado-frete table tbody').append(row);
                    esconderLoader();
                    exibirTabela();
                    return false;
                }

                let inpCEP = $(this);
                inpCEP.attr('disabled', 'disabled');
                exibirLoader();
                esconderTabela();
                resetarTabela();

                let qty = 1;
                let inpQty = $('.quantity .qty:visible').val();
                if (typeof inpQty != 'undefined') {
                    qty = inpQty;
                }

                $.ajax({
                    url: url,
                    type: "POST",
                    data: {
                        'action': 'cotation_product_page',
                        'data': {
                            'cep_origem': cep,
                            'id_produto': id_produto,
                            'quantity': qty
                        }
                    },
                    error: function (jqXHR, exception) {
                        inpCEP.removeAttr('disabled');
                        inpCEP.val('');
                        alert(jqXHR.responseJSON.error);
                        esconderLoader();
                        esconderTabela();
                        resetarTabela();
                        return false;
                    },
                    success: function (response) {
                        $('#destiny-shipping-mehor-envio').text('Frete para ' + response.data.destination);
                        var row = '';
                        let  data  = response.data.quotations;
                        data.map(item => {
                            if (item.observations && item.observations !== 'Frete Grátis') {
                                jQuery('.observation-shipping-free').show();
                                jQuery('.observation-shipping-free').html(item.observations);
                            }
                            let name = item.name
                            if (!item.delivery_time) {
                                item.delivery_time = '';
                            }
                            row += `<tr><td>${name} ${item.delivery_time}: ${item.price}</td></tr>`;
                        });

                        if (row == '') {
                            row = '<tr><td colspan="3">Desculpe, o cálculo de frete para este produto só está disponível no Carrinho, por favor, prossiga com a compra normalmente.</td></tr>';
                        }

                        $('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto .resultado-frete table tbody').append(row);
                        esconderLoader();
                        exibirTabela();
                        inpCEP.removeAttr('disabled');
                        inpCEP.val('');
                    }
                });
            }
        })

        function exibirLoader() {
            $('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto #calcular-frete').css('display', 'none');
            $('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto #calcular-frete-loader').css('display', 'flex');
        }

        function esconderLoader() {
            $('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto #calcular-frete').css('display', 'inline-block');
            $('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto #calcular-frete-loader').css('display', 'none');
        }

        function exibirTabela() {
            $('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto .resultado-frete').show();
        }

        function esconderTabela() {
            $('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto .resultado-frete').hide();
        }

        function resetarTabela() {
            $('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto .resultado-frete table tbody').html('');
            $('#destiny-shipping-mehor-envio').text('');
        }

        $(".single_variation_wrap").on("show_variation", function (event, variation) {
            resetarTabela();
            esconderTabela();
            $('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto #calculo_frete_produto_preco').val(variation.display_price.toFixed(2));
        });
    });
})(jQuery);
// source --> https://mundomaisverde.com/wp-content/plugins/melhor-envio-cotacao/assets/js/shipping-product-page-variacao.js?ver=1707ae824362bebd67785847eed20c17 
(function (jQuery) {
    'use strict';
    jQuery(function () {
        jQuery(document).ready(function () {
            jQuery(document).change(function () {
                let variation_id = jQuery('.variation_id').val();
                if (variation_id) {
                    jQuery('#id_produto').val(variation_id);
                }
            });
        })
    });
})(jQuery);
// source --> https://mundomaisverde.com/wp-content/plugins/melhor-envio-cotacao/assets/js/calculator.js?ver=1707ae824362bebd67785847eed20c17 
function toggleCalculator() {

    let widthProduct = document.querySelector('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto #calculo_frete_produto_altura');
    if (!widthProduct) {
        return;
    }

    document.querySelector('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto').style.display = 'block';
}

function getDimension() {
    let dimensions = {
        'heigth': document.querySelector('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto #calculo_frete_produto_altura').value,
        'width': document.querySelector('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto #calculo_frete_produto_largura').value,
        'length': document.querySelector('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto #calculo_frete_produto_comprimento').value,
        'weight': document.querySelector('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto #calculo_frete_produto_peso').value
    }
    return dimensions;
}

/**
 *  mask to replace non number
 * @param {string} content - number to format
 * @returns {string}
 * @example
 * const valueToFormat = '12345678'
 * numberMask(valueToFormat);
 */
function numberMask(content) {
    return content.replace(/[^0-9-]+/g, "");
}

/**
 *  mask to format postal code
 * @param {string} content - postal code number
 * @returns {string}
 * @example
 * const valueToFormat = '12345678'
 * postalCodeMask(valueToFormat);
 */
 function postalCodeMask(content, input) {
    let value = content;
    let formatedValue = '';

    if(isNaN(content)) {
        input.value = numberMask(content);

        return;
    }

    //regex to add " - " in position 5 of cep: EX:123456-78
    formatedValue = value.replace(/(\d{5})(\d{1,2})$/, "$1-$2");
    input.value = formatedValue;
}

/**
 *  this function is used to apply the postal code mask in the input to calculate the quotation
 */
function usePostalCodeMask(evt='') {
    const inputDefault = evt ? evt.target : evt;
    const inputShortcode = document.querySelector('.iptCepShortcode');


    if(inputDefault) {
        const content = inputDefault.value;
        postalCodeMask(content, inputDefault);
    }

    if(inputShortcode) {
        const content = inputShortcode.value;
        postalCodeMask(content, inputShortcode);
    }
}

function validateNumber(event) {
    var key = window.event ? event.keyCode : event.which;
    if (event.keyCode === 8 || event.keyCode === 46) {
        return true;
    } else if (key < 48 || key > 57) {
        return false;
    } else {
        return true;
    }
};