"use strict";var countdown=document.getElementsByClassName("js-countdown");if(0!==countdown.length){var countLength=countdown.length,number=83,order=2,numberStr=String(number),minProdCount=1,maxProdCount=5,minTimer=1e4,maxTimer=5e4;if(!isNaN(parseInt(countdown[0].innerText))&&parseInt(countdown[0].innerText)>5&&(number=countdown[0].innerText.trim()),isStorage()){var lastNumber=parseInt(localStorage.getItem("lastNumber"));isNaN(lastNumber)||(number=lastNumber)}updateCounters();var timer=setInterval(doCountdown,getRandomInt(minTimer,maxTimer))}else console.warn('You have to add "js-countdown" class for any DOM element');function prettyNumber(n,t){for(var e=n.toString();e.length<t;)e="0"+e;return e}function updateCounters(){for(;countLength;){var n=countdown[countLength-1].querySelectorAll(".js-count-digit"),t=n.length;if(0===t)numberStr=prettyNumber(number,2),countdown[countLength-1].innerText=numberStr;else{numberStr=prettyNumber(number,t);for(var e=0;e<t;e++)n[e].innerText=numberStr[e]}countLength--}isStorage()&&localStorage.setItem("lastNumber",numberStr)}function doCountdown(){if(countLength=countdown.length,!(number>5))return clearInterval(timer),5;number-=getRandomInt(minProdCount,maxProdCount),updateCounters()}function getRandomInt(n,t){return Math.floor(Math.random()*(t-n+1))+n}function isStorage(){return void 0!==window.localStorage}