const Css={classes:{displayNone:"d-none",darkTheme:"dark-theme",lightTheme:"light-theme",bgBlack:"bg-black",bgWhite:"bg-white",bgPrimary:"bg-primary",bgOrange:"bg-primary",bgGreen:"bg-success",bgBlue:"bg-blue",memoryCardStyleOne:"style-one",memoryCardStyleTwo:"style-two"}},Firework={set:0,intervalIds:[],stopTimeoutId:0,fireworkClass:"firework",fireworkTime:750,autoRemoveFfireworkTime:9e3,random:function(e,t){return e+Math.random()*(t+1-e)},create:function(){var t=Firework.random(40,60),s=Firework.random(40,60),o="#"+Math.random().toString(16).substr(2,6);for(let e=1;e<=30;e++){var n=document.createElement("div");n.className=Firework.fireworkClass,n.classList.add(Firework.fireworkClass+e),n.classList.add("set"+this.set),n.style.backgroundColor=o,n.style.left=t+"%",n.style.top=s+"%",document.body.appendChild(n)}this.set++},delete:function(){var e=this.set-1;0<=this.set&&document.getElemntsByClassName("set"+e).forEach(e=>{e.remove()})},start:function(){(_this=Firework).create(),_this.intervalIds.push(setInterval(Firework.create,_this.fireworkTime)),_this.intervalIds.push(setInterval(Firework.delete,3*_this.fireworkTime)),setTimeout(_this.stop,_this.autoRemoveFfireworkTime)},stop:function(){_this=Firework;for(let e=0;e<_this.intervalIds.length;e++)clearInterval(_this.intervalIds[e]);for(var e=document.getElementsByClassName(_this.fireworkClass);0t.colors.length-1){let e=Math.random().toString(16).substr(2,3);for(;-1e.counter||e.highscorePairsCount===e.countPairs&&e.highscorePairs>21:o;return String(o)},getSaltetString(e,t,s){switch(t[s]%3){case 1:return e.amountPairs+".a!"+e.emojis[t[s]]+e.highscoreCount+"t"+t[s]+"Rt.a!"+e.highscorePairs;case 2:return e.amountPairs+".T!"+ +e.highscorePairs+"t"+e.emojis[t[s]]+"t.R!"+e.highscoreCount;default:return e.amountPairs+e.emojis[t[s]]+".Ec"+t[s]+e.highscoreCount+"tt.a#"+e.highscorePairs}},randomLongString:function(e,t,s){return e.getCharCode(e.toHex(e.simpleHashCode(e.getSaltetString(e,t,s))))},randomShortString:function(e,t,s){return e.getCharCode(e.simpleHashCode(e.getSaltetString(e,t,s)))},randomizeShortStringForMemorie:function(e,t,s){return e.getCharCode(e.simpleHashCode(e.getSaltetString(e,t,s)))},getContrastYIQ:function(e){return 3===e.length&&(e=e.split("").map(function(e){return e+e}).join("")),128<=(299*parseInt(e.substr(0,2),16)+587*parseInt(e.substr(2,2),16)+114*parseInt(e.substr(4,2),16))/1e3?"black":"white"},createCardBackDom:function(e,t,s,o){var n=document.createElement("div");switch(e=Memory,n.className=e.memoryCardBackClass,-1'+e.emojis[e.emojiCategories[0][t[s]]]+"
"):n.style="background-image: url("+e.images[t[s]]+");";break;case 3:case 4:n.innerHTML='
'+e.randomShortString(e,t,s)+"
";break;case 5:case 6:n.innerHTML='
'+e.randomLongString(e,t,s)+"
";break;case 7:case 8:n.innerHTML='
'+t[s]+"
";break;case 28:case 29:n.innerHTML='
'+e.simpleHashCode(t[s]+"")+"
";break;case 9:break;default:void 0===e.MAP.backStyle2Emoji[e.backStyle]?void 0===e.images[t[s]]?(n.style="background-color: #"+e.colors[t[s]]+";",n.innerHTML='
'+e.emojis[e.emojiCategories[0][t[s]]]+"
"):n.style="background-image: url("+e.images[t[s]]+");":n.innerHTML='
'+e.emojis[e.emojiCategories[e.MAP.backStyle2Emoji[e.backStyle]][t[s]]]+"
"}return n},drawSingleMemoryCard:function(e,t,s){var o=document.createElement("div"),n=(o.id=e.memoryCardIdPrefix+s,o.className=e.memoryCardClass,o.setAttribute("tabindex",0),o.style="width: "+e.size+"em; height: "+e.size+"em",document.createElement("div")),i=(n.className=e.memoryCardInnerClass,document.createElement("div"));i.className=e.memoryCardFrontClass+" "+e.MAP.frontStyle2Class[e.frontStyle],n.appendChild(i),n.appendChild(e.createCardBackDom(e,t,s,.8*e.size)),o.appendChild(n),e.cardClick(e,o),e.memoryDom.appendChild(o)},draw:function(t){for(;t.memoryDom.firstChild;)t.memoryDom.removeChild(t.memoryDom.firstChild);null!==t.images&&t.randomize(t.images);for(let e=0;e{if("serviceWorker"in navigator)try{var e=await navigator.serviceWorker.register("./sw.js",{scope:"./"});e.installing||e.waiting||e.active}catch(e){console.error("Registration failed with "+e)}});window.addEventListener("DOMContentLoaded",async function(e){registerServiceWorker()});