Files
CookieMonster/dist/Disp.js
2021-03-09 23:14:47 +01:00

1 line
83 KiB
JavaScript

(()=>{"use strict";const e={FormatTime:function(e,t){if(e===1/0)return e;e=Math.ceil(e);const i=Math.floor(e/31557600),o=Math.floor(e%31557600/86400),a=Math.floor(e%86400/3600),n=Math.floor(e%3600/60),s=Math.floor(e%60);let r="";if(CM.Options.TimeFormat){if(e>315576e4)return"XX:XX:XX:XX:XX";r+=(i<10?"0":"")+i+":",r+=(o<10?"0":"")+o+":",r+=(a<10?"0":"")+a+":",r+=(n<10?"0":"")+n+":",r+=(s<10?"0":"")+s}else{if(e>7776e5)return t?"Over 9000 days!":">9000d";r+=i>0?i+(t?1===i?" year":" years":"y")+", ":"",r+=o>0?o+(t?1===o?" day":" days":"d")+", ":"",(r.length>0||a>0)&&(r+=a+(t?1===a?" hour":" hours":"h")+", "),(r.length>0||n>0)&&(r+=n+(t?1===n?" minute":" minutes":"m")+", "),r+=s+(t?1===s?" second":" seconds":"s")}return r}};CM.Disp=e,CM.Disp.GetWrinkConfigBank=function(){return 1===CM.Options.CalcWrink?CM.Cache.WrinklersTotal:2===CM.Options.CalcWrink?CM.Cache.WrinklersFattest[0]:0},CM.Disp.PopAllNormalWrinklers=function(){for(const e of Object.keys(Game.wrinklers))Game.wrinklers[e].sucked>0&&0===Game.wrinklers[e].type&&(Game.wrinklers[e].hp=0)},CM.Disp.GetCPS=function(){return CM.Options.CPSMode?CM.Cache.AvgCPS:0===CM.Options.CalcWrink?Game.cookiesPs*(1-Game.cpsSucked):1===CM.Options.CalcWrink?Game.cookiesPs*(CM.Cache.CurrWrinklerCPSMult+(1-.05*CM.Cache.CurrWrinklerCount)):2===CM.Options.CalcWrink&&1===Game.wrinklers[CM.Cache.WrinklersFattest[1]].type?Game.cookiesPs*(3*CM.Cache.CurrWrinklerCPSMult/CM.Cache.CurrWrinklerCount+(1-.05*CM.Cache.CurrWrinklerCount)):Game.cookiesPs*(CM.Cache.CurrWrinklerCPSMult/CM.Cache.CurrWrinklerCount+(1-.05*CM.Cache.CurrWrinklerCount))},CM.Disp.CalculateGrimoireRefillTime=function(e,t,i){let o=0;for(;e<i;)e+=.002*Math.max(.002,(e/Math.max(t,100))**.5),o++;return o/Game.fps},CM.Disp.GetLumpColor=function(e){return 0===e?{text:"Normal",color:CM.Disp.colorGray}:1===e?{text:"Bifurcated",color:CM.Disp.colorGreen}:2===e?{text:"Golden",color:CM.Disp.colorYellow}:3===e?{text:"Meaty",color:CM.Disp.colorOrange}:4===e?{text:"Caramelized",color:CM.Disp.colorPurple}:{text:"Unknown Sugar Lump",color:CM.Disp.colorRed}},CM.Disp.GetTimeColor=function(e){let t,i;return e<0?(i=CM.Options.TimeFormat?"00:00:00:00:00":"Done!",t=CM.Disp.colorGreen):(i=CM.Disp.FormatTime(e),t=e>300?CM.Disp.colorRed:e>60?CM.Disp.colorOrange:CM.Disp.colorYellow),{text:i,color:t}},CM.Disp.Beautify=function(e,t,i){const o=CM.Options.ScaleDecimals+1;if(e===1/0)return"Infinity";if(void 0===e)return"0";if(0===CM.Options.Scale)return CM.Backup.Beautify(e,t);if(Number.isFinite(e)){let a="";if(0===e)return e.toString();if(e>.001&&e<CM.Options.ScaleCutoff){a=e.toFixed(2),CM.Options.ScaleSeparator&&(a=a.toLocaleString("nl"));for(let e=0;e<3;e++)"0"!==a[a.length-1]&&"."!==a[a.length-1]||(a=a.slice(0,-1));return a}if(4===CM.Options.Scale&&!i||4===i)a=e.toExponential(o).toString().replace("e","E");else{const t=e.toExponential().toString(),n=Math.floor(t.slice(t.indexOf("e")+1)/3);a=(e/Number("1e"+3*n)).toFixed(o),1===CM.Options.Scale&&!i||1===i?e>=.01&&e<Number("1e"+3*CM.Data.metric.length)?a+=` ${CM.Data.metric[n]}`:a=CM.Disp.Beautify(e,0,4):2===CM.Options.Scale&&!i||2===i?e>=.01&&e<Number("1e"+3*CM.Data.shortScale.length)?a+=` ${CM.Data.shortScale[n]}`:a=CM.Disp.Beautify(e,0,4):3===CM.Options.Scale&&!i||3===i?e>=.01&&e<Number("1e"+3*CM.Data.shortScaleAbbreviated.length)?a+=` ${CM.Data.shortScaleAbbreviated[n]}`:a=CM.Disp.Beautify(e,0,4):(5===CM.Options.Scale&&!i||5===i)&&(a+="E"+3*n)}return""===a&&(console.log(`Could not beautify number with CM.Disp.Beautify: ${e}`),a=CM.Backup.Beautify(e,t)),CM.Options.ScaleSeparator&&(a=a.replace(".",",")),a}return console.log(`Could not beautify number with CM.Disp.Beautify: ${e}`),CM.Backup.Beautify(e,t)},CM.Disp.UpdateAscendState=function(){Game.OnAscend?(l("game").style.bottom="0px",1===CM.Options.BotBar&&(CM.Disp.BotBar.style.display="none"),1===CM.Options.TimerBar&&(CM.Disp.TimerBar.style.display="none")):(CM.Disp.ToggleBotBar(),CM.Disp.ToggleTimerBar()),CM.Disp.UpdateBackground()},CM.Disp.CreateCssArea=function(){CM.Disp.Css=document.createElement("style"),CM.Disp.Css.type="text/css",document.head.appendChild(CM.Disp.Css)},CM.Disp.UpdateBuildingUpgradeStyle=function(){l("products").style.display="grid",l("storeBulk").style.gridRow="1/1",l("upgrades").style.display="flex",l("upgrades").style["flex-wrap"]="wrap"},CM.Disp.UpdateBackground=function(){Game.Background.canvas.width=Game.Background.canvas.parentNode.offsetWidth,Game.Background.canvas.height=Game.Background.canvas.parentNode.offsetHeight,Game.LeftBackground.canvas.width=Game.LeftBackground.canvas.parentNode.offsetWidth,Game.LeftBackground.canvas.height=Game.LeftBackground.canvas.parentNode.offsetHeight},CM.Disp.Draw=function(){if(Game.prefs.autosave&&Game.drawT%10==0&&"stats"===Game.onMenu&&CM.Options.Stats){const e=document.getElementById("CMStatsAutosaveTimer");e&&(e.innerText=Game.sayTime(60*Game.fps-Game.T%(60*Game.fps),4))}CM.Disp.UpdateBuildings(),CM.Disp.UpdateUpgrades(),CM.Disp.UpdateTimerBar(),CM.Disp.UpdateBotBar(),CM.Disp.UpdateTooltip(),CM.Disp.CheckWrinklerTooltip(),CM.Disp.UpdateWrinklerTooltip(),CM.Disp.RefreshMenu()},CM.Disp.ToggleBotBar=function(){1===CM.Options.BotBar?(CM.Disp.BotBar.style.display="",CM.Footer.isInitzializing||CM.Disp.UpdateBotBar()):CM.Disp.BotBar.style.display="none",CM.Disp.UpdateBotTimerBarPosition()},CM.Disp.CreateBotBar=function(){CM.Disp.BotBar=document.createElement("div"),CM.Disp.BotBar.id="CMBotBar",CM.Disp.BotBar.style.height="69px",CM.Disp.BotBar.style.width="100%",CM.Disp.BotBar.style.position="absolute",CM.Disp.BotBar.style.display="none",CM.Disp.BotBar.style.backgroundColor="#262224",CM.Disp.BotBar.style.backgroundImage="linear-gradient(to bottom, #4d4548, #000000)",CM.Disp.BotBar.style.borderTop="1px solid black",CM.Disp.BotBar.style.overflow="auto",CM.Disp.BotBar.style.textShadow="-1px 0 black, 0 1px black, 1px 0 black, 0 -1px black";const e=CM.Disp.BotBar.appendChild(document.createElement("table"));e.style.width="100%",e.style.textAlign="center",e.style.whiteSpace="nowrap";const t=e.appendChild(document.createElement("tbody")),i=function(e,t){const i=document.createElement("td");return i.style.textAlign="right",i.className=CM.Disp.colorTextPre+t,i.textContent=e,i},o=t.appendChild(document.createElement("tr"));o.style.fontWeight="bold",o.appendChild(i(`CM ${CM.VersionMajor}.${CM.VersionMinor}`,CM.Disp.colorYellow)),t.appendChild(document.createElement("tr")).appendChild(i("Bonus Income",CM.Disp.colorBlue)),t.appendChild(document.createElement("tr")).appendChild(i("Payback Period",CM.Disp.colorBlue)),t.appendChild(document.createElement("tr")).appendChild(i("Time Left",CM.Disp.colorBlue));for(const e of Object.keys(Game.Objects))CM.Disp.CreateBotBarBuildingColumn(e);l("wrapper").appendChild(CM.Disp.BotBar)},CM.Disp.UpdateBotBar=function(){if(1===CM.Options.BotBar&&CM.Cache.Objects1&&1===Game.buyMode){let e=0;for(const t of Object.keys(CM.Cache.Objects1)){let i=`Objects${Game.buyBulk}`;1===Game.buyMode?CM.Disp.LastTargetBotBar=i:i=CM.Disp.LastTargetBotBar,e++,CM.Disp.BotBar.firstChild.firstChild.childNodes[0].childNodes[e].childNodes[1].textContent=Game.Objects[t].amount,CM.Disp.BotBar.firstChild.firstChild.childNodes[1].childNodes[e].textContent=Beautify(CM.Cache[i][t].bonus,2),CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[e].className=CM.Disp.colorTextPre+CM.Cache[i][t].color,CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[e].textContent=Beautify(CM.Cache[i][t].pp,2);const o=CM.Disp.GetTimeColor((Game.Objects[t].bulkPrice-(Game.cookies+CM.Disp.GetWrinkConfigBank()))/CM.Disp.GetCPS());CM.Disp.BotBar.firstChild.firstChild.childNodes[3].childNodes[e].className=CM.Disp.colorTextPre+o.color,"Done!"===o.text&&Game.cookies<Game.Objects[t].bulkPrice?CM.Disp.BotBar.firstChild.firstChild.childNodes[3].childNodes[e].textContent=`${o.text} (with Wrink)`:CM.Disp.BotBar.firstChild.firstChild.childNodes[3].childNodes[e].textContent=o.text}}},CM.Disp.CreateBotBarBuildingColumn=function(e){if(!CM.Disp.BotBar)return void CM.Disp.CreateBotBar();const t=CM.Disp.BotBar.firstChild.firstChild.childNodes[0],i=CM.Disp.BotBar.firstChild.firstChild.childNodes[1],o=CM.Disp.BotBar.firstChild.firstChild.childNodes[2],a=CM.Disp.BotBar.firstChild.firstChild.childNodes[3],n=e,s=t.appendChild(document.createElement("td"));s.appendChild(document.createTextNode(`${-1!==n.indexOf(" ")?n.substring(0,n.indexOf(" ")):n} (`)),s.appendChild(document.createElement("span")).className=CM.Disp.colorTextPre+CM.Disp.colorBlue,s.appendChild(document.createTextNode(")")),i.appendChild(document.createElement("td")),o.appendChild(document.createElement("td")),a.appendChild(document.createElement("td"))},CM.Disp.CreateTimerBar=function(){CM.Disp.TimerBar=document.createElement("div"),CM.Disp.TimerBar.id="CMTimerBar",CM.Disp.TimerBar.style.position="absolute",CM.Disp.TimerBar.style.display="none",CM.Disp.TimerBar.style.height="0px",CM.Disp.TimerBar.style.fontSize="10px",CM.Disp.TimerBar.style.fontWeight="bold",CM.Disp.TimerBar.style.backgroundColor="black",CM.Disp.TimerBars={},CM.Disp.BuffTimerBars={},CM.Disp.TimerBars.CMTimerBarGC=CM.Disp.TimerBarCreateBar("CMTimerBarGC","Next Cookie",[{id:"CMTimerBarGCMinBar",color:CM.Disp.colorGray},{id:"CMTimerBarGCBar",color:CM.Disp.colorPurple}]),CM.Disp.TimerBar.appendChild(CM.Disp.TimerBars.CMTimerBarGC),CM.Disp.TimerBars.CMTimerBarRen=CM.Disp.TimerBarCreateBar("CMTimerBarRen","Next Reindeer",[{id:"CMTimerBarRenMinBar",color:CM.Disp.colorGray},{id:"CMTimerBarRenBar",color:CM.Disp.colorOrange}]),CM.Disp.TimerBar.appendChild(CM.Disp.TimerBars.CMTimerBarRen),l("wrapper").appendChild(CM.Disp.TimerBar)},CM.Disp.TimerBarCreateBar=function(e,t,i){const o=document.createElement("div");o.id="CMTimerBar",o.style.height="12px",o.style.margin="0px 10px",o.style.position="relative";const a=document.createElement("div");a.style.width="100%",a.style.height="10px",a.style.margin="auto",a.style.position="absolute",a.style.left="0px",a.style.top="0px",a.style.right="0px",a.style.bottom="0px";const n=document.createElement("span");n.style.display="inline-block",n.style.textAlign="right",n.style.fontSize="10px",n.style.width="108px",n.style.marginRight="5px",n.style.verticalAlign="text-top",n.textContent=t,a.appendChild(n);for(let e=0;e<i.length;e++){const t=document.createElement("span");t.id=i[e].id,t.style.display="inline-block",t.style.height="10px",t.style.verticalAlign="text-top",t.style.textAlign="center",i.length-1===e&&(t.style.borderTopRightRadius="10px",t.style.borderBottomRightRadius="10px"),void 0!==i[e].color&&(t.className=CM.Disp.colorBackPre+i[e].color),a.appendChild(t)}const s=document.createElement("span");return s.id=`${e}Time`,s.style.marginLeft="5px",s.style.verticalAlign="text-top",a.appendChild(s),o.appendChild(a),o},CM.Disp.UpdateTimerBar=function(){if(1===CM.Options.TimerBar){const e=CM.Disp.TimerBar.offsetWidth-163,t=CM.Disp.TimerBar.offsetWidth-133;let i=0;0!==Game.shimmerTypes.golden.spawned||Game.Has("Golden switch [off]")?CM.Disp.TimerBars.CMTimerBarGC.style.display="none":(CM.Disp.TimerBars.CMTimerBarGC.style.display="",l("CMTimerBarGCMinBar").style.width=`${Math.round(Math.max(0,Game.shimmerTypes.golden.minTime-Game.shimmerTypes.golden.time)*e/Game.shimmerTypes.golden.maxTime)}px`,CM.Options.TimerBarOverlay>=1?l("CMTimerBarGCMinBar").textContent=Math.ceil((Game.shimmerTypes.golden.minTime-Game.shimmerTypes.golden.time)/Game.fps):l("CMTimerBarGCMinBar").textContent="",Game.shimmerTypes.golden.minTime===Game.shimmerTypes.golden.maxTime?(l("CMTimerBarGCMinBar").style.borderTopRightRadius="10px",l("CMTimerBarGCMinBar").style.borderBottomRightRadius="10px"):(l("CMTimerBarGCMinBar").style.borderTopRightRadius="",l("CMTimerBarGCMinBar").style.borderBottomRightRadius=""),l("CMTimerBarGCBar").style.width=`${Math.round(Math.min(Game.shimmerTypes.golden.maxTime-Game.shimmerTypes.golden.minTime,Game.shimmerTypes.golden.maxTime-Game.shimmerTypes.golden.time)*e/Game.shimmerTypes.golden.maxTime)}px`,CM.Options.TimerBarOverlay>=1?l("CMTimerBarGCBar").textContent=Math.ceil(Math.min(Game.shimmerTypes.golden.maxTime-Game.shimmerTypes.golden.minTime,Game.shimmerTypes.golden.maxTime-Game.shimmerTypes.golden.time)/Game.fps):l("CMTimerBarGCBar").textContent="",l("CMTimerBarGCTime").textContent=Math.ceil((Game.shimmerTypes.golden.maxTime-Game.shimmerTypes.golden.time)/Game.fps),i++),"christmas"===Game.season&&0===Game.shimmerTypes.reindeer.spawned?(CM.Disp.TimerBars.CMTimerBarRen.style.display="",l("CMTimerBarRenMinBar").style.width=`${Math.round(Math.max(0,Game.shimmerTypes.reindeer.minTime-Game.shimmerTypes.reindeer.time)*e/Game.shimmerTypes.reindeer.maxTime)}px`,CM.Options.TimerBarOverlay>=1?l("CMTimerBarRenMinBar").textContent=Math.ceil((Game.shimmerTypes.reindeer.minTime-Game.shimmerTypes.reindeer.time)/Game.fps):l("CMTimerBarRenMinBar").textContent="",l("CMTimerBarRenBar").style.width=`${Math.round(Math.min(Game.shimmerTypes.reindeer.maxTime-Game.shimmerTypes.reindeer.minTime,Game.shimmerTypes.reindeer.maxTime-Game.shimmerTypes.reindeer.time)*e/Game.shimmerTypes.reindeer.maxTime)}px`,CM.Options.TimerBarOverlay>=1?l("CMTimerBarRenBar").textContent=Math.ceil(Math.min(Game.shimmerTypes.reindeer.maxTime-Game.shimmerTypes.reindeer.minTime,Game.shimmerTypes.reindeer.maxTime-Game.shimmerTypes.reindeer.time)/Game.fps):l("CMTimerBarRenBar").textContent="",l("CMTimerBarRenTime").textContent=Math.ceil((Game.shimmerTypes.reindeer.maxTime-Game.shimmerTypes.reindeer.time)/Game.fps),i++):CM.Disp.TimerBars.CMTimerBarRen.style.display="none";for(const e of Object.keys(CM.Disp.BuffTimerBars))CM.Disp.BuffTimerBars[e].remove();CM.Disp.BuffTimerBars={};for(const e of Object.keys(Game.buffs))if(Game.buffs[e]){const o=CM.Disp.TimerBarCreateBar(Game.buffs[e].name,Game.buffs[e].name,[{id:`${Game.buffs[e].name}Bar`}]);o.style.display="";let a="";a=void 0!==CM.Disp.buffColors[Game.buffs[e].name]?CM.Disp.buffColors[Game.buffs[e].name]:CM.Disp.colorPurple,o.lastChild.children[1].className=CM.Disp.colorBackPre+a,o.lastChild.children[1].style.color="black",2===CM.Options.TimerBarOverlay?o.lastChild.children[1].textContent=`${Math.round(Game.buffs[e].time/Game.buffs[e].maxTime*100)}%`:o.lastChild.children[1].textContent="",o.lastChild.children[1].style.width=`${Math.round(Game.buffs[e].time*(t-8*Math.ceil(Game.buffs[e].time/Game.fps).toString().length)/Game.buffs[e].maxTime)}px`,o.lastChild.children[2].textContent=Math.ceil(Game.buffs[e].time/Game.fps),i++,CM.Disp.BuffTimerBars[Game.buffs[e].name]=o}for(const e of Object.keys(CM.Disp.BuffTimerBars))CM.Disp.TimerBar.appendChild(CM.Disp.BuffTimerBars[e]);0!==i&&(CM.Disp.TimerBar.style.height=12*i+2+"px"),CM.Disp.LastNumberOfTimers!==i&&(CM.Disp.LastNumberOfTimers=i,CM.Disp.UpdateBotTimerBarPosition())}},CM.Disp.ToggleTimerBar=function(){1===CM.Options.TimerBar?CM.Disp.TimerBar.style.display="":CM.Disp.TimerBar.style.display="none",CM.Disp.UpdateBotTimerBarPosition()},CM.Disp.ToggleTimerBarPos=function(){0===CM.Options.TimerBarPos?(CM.Disp.TimerBar.style.width="30%",CM.Disp.TimerBar.style.bottom="",l("game").insertBefore(CM.Disp.TimerBar,l("sectionLeft"))):(CM.Disp.TimerBar.style.width="100%",CM.Disp.TimerBar.style.bottom="0px",l("wrapper").appendChild(CM.Disp.TimerBar)),CM.Disp.UpdateBotTimerBarPosition()},CM.Disp.UpdateBotTimerBarPosition=function(){1===CM.Options.BotBar&&1===CM.Options.TimerBar&&1===CM.Options.TimerBarPos?(CM.Disp.BotBar.style.bottom=CM.Disp.TimerBar.style.height,l("game").style.bottom=`${Number(CM.Disp.TimerBar.style.height.replace("px",""))+70}px`):1===CM.Options.BotBar?(CM.Disp.BotBar.style.bottom="0px",l("game").style.bottom="70px"):1===CM.Options.TimerBar&&1===CM.Options.TimerBarPos?l("game").style.bottom=CM.Disp.TimerBar.style.height:l("game").style.bottom="0px",1===CM.Options.TimerBar&&0===CM.Options.TimerBarPos?l("sectionLeft").style.top=CM.Disp.TimerBar.style.height:l("sectionLeft").style.top="",CM.Disp.UpdateBackground()},CM.Disp.UpdateBuildings=function(){let e=`Objects${Game.buyBulk}`;if(1===Game.buyMode?CM.Disp.LastTargetBuildings=e:e=CM.Disp.LastTargetBuildings,1===Game.buyMode)if(1===CM.Options.BuildColor)for(const t of Object.keys(CM.Cache[e]))l(`productPrice${Game.Objects[t].id}`).style.color=CM.Options.Colors[CM.Cache[e][t].color];else for(const e of Object.keys(Game.Objects))l(`productPrice${Game.Objects[e].id}`).style.removeProperty("color");else if(-1===Game.buyMode)for(const e of Object.keys(CM.Cache.Objects1)){const t=Game.Objects[e];l(`productPrice${t.id}`).style.color="",l(`productPrice${t.id}`).innerHTML=Beautify(CM.Sim.BuildingSell(t,t.basePrice,t.amount,t.free,Game.buyBulk,1))}if(1===Game.buyMode&&CM.Options.SortBuildings){const t=Object.keys(CM.Cache[e]).map((t=>{const i=CM.Cache[e][t];return i.name=t,i.id=Game.Objects[t].id,i}));t.sort((function(e,t){return CM.Disp.colors.indexOf(e.color)>CM.Disp.colors.indexOf(t.color)?1:CM.Disp.colors.indexOf(e.color)<CM.Disp.colors.indexOf(t.color)||e.pp<t.pp?-1:0}));for(let e=0;e<t.length;e++)Game.Objects[t[e].name].l.style.gridRow=`${e+2}/${e+2}`}else{const e=Object.keys(CM.Cache.Objects1).map((e=>{const t=CM.Cache.Objects1[e];return t.name=e,t.id=Game.Objects[e].id,t}));e.sort(((e,t)=>e.id-t.id));for(let t=0;t<e.length;t++)Game.Objects[e[t].name].l.style.gridRow=`${t+2}/${t+2}`}},CM.Disp.UpdateUpgrades=function(){if(CM.Options.UpBarColor>0){let e=0,t=0,i=0,o=0,a=0,n=0,s=0;for(const r of Object.keys(Game.UpgradesInStore)){const p=Game.UpgradesInStore[r];let C=!1;for(let e=0;e<l(`upgrade${r}`).childNodes.length;e++)if(-1!==l(`upgrade${r}`).childNodes[e].className.indexOf(CM.Disp.colorBackPre)){l(`upgrade${r}`).childNodes[e].className=CM.Disp.colorBackPre+CM.Cache.Upgrades[p.name].color,C=!0;break}if(!C){const e=document.createElement("div");e.style.width="10px",e.style.height="10px",e.className=CM.Disp.colorBackPre+CM.Cache.Upgrades[p.name].color,l(`upgrade${r}`).appendChild(e)}CM.Cache.Upgrades[p.name].color===CM.Disp.colorBlue?e++:CM.Cache.Upgrades[p.name].color===CM.Disp.colorGreen?t++:CM.Cache.Upgrades[p.name].color===CM.Disp.colorYellow?i++:CM.Cache.Upgrades[p.name].color===CM.Disp.colorOrange?o++:CM.Cache.Upgrades[p.name].color===CM.Disp.colorRed?a++:CM.Cache.Upgrades[p.name].color===CM.Disp.colorPurple?n++:CM.Cache.Upgrades[p.name].color===CM.Disp.colorGray&&s++}l("CMUpgradeBarBlue").textContent=e,l("CMUpgradeBarGreen").textContent=t,l("CMUpgradeBarYellow").textContent=i,l("CMUpgradeBarOrange").textContent=o,l("CMUpgradeBarRed").textContent=a,l("CMUpgradeBarPurple").textContent=n,l("CMUpgradeBarGray").textContent=s}const e=[];for(let t=0;t<Game.UpgradesInStore.length;t++){const i={};i.name=Game.UpgradesInStore[t].name,i.price=Game.UpgradesInStore[t].basePrice,i.pp=CM.Cache.Upgrades[i.name].pp,e.push(i)}CM.Options.SortUpgrades?e.sort((function(e,t){return CM.Disp.colors.indexOf(e.color)>CM.Disp.colors.indexOf(t.color)?1:CM.Disp.colors.indexOf(e.color)<CM.Disp.colors.indexOf(t.color)||e.pp<t.pp?-1:0})):e.sort(((e,t)=>e.price-t.price));const t=function(e,t){return e.findIndex((e=>e.name===t.name))};for(let i=0;i<Game.UpgradesInStore.length;i++)l(`upgrade${i}`).style.order=t(e,Game.UpgradesInStore[i])+1},CM.Disp.ToggleUpgradeBarAndColor=function(){1===CM.Options.UpBarColor?(CM.Disp.UpgradeBar.style.display="",CM.Disp.UpdateUpgrades()):2===CM.Options.UpBarColor?(CM.Disp.UpgradeBar.style.display="none",CM.Disp.UpdateUpgrades()):(CM.Disp.UpgradeBar.style.display="none",Game.RebuildUpgrades())},CM.Disp.ToggleUpgradeBarFixedPos=function(){1===CM.Options.UpgradeBarFixedPos?(CM.Disp.UpgradeBar.style.position="sticky",CM.Disp.UpgradeBar.style.top="0px"):CM.Disp.UpgradeBar.style.position=""},CM.Disp.CreateUpgradeBar=function(){CM.Disp.UpgradeBar=document.createElement("div"),CM.Disp.UpgradeBar.id="CMUpgradeBar",CM.Disp.UpgradeBar.style.width="100%",CM.Disp.UpgradeBar.style.backgroundColor="black",CM.Disp.UpgradeBar.style.textAlign="center",CM.Disp.UpgradeBar.style.fontWeight="bold",CM.Disp.UpgradeBar.style.display="none",CM.Disp.UpgradeBar.style.zIndex="21",CM.Disp.UpgradeBar.onmouseout=function(){Game.tooltip.hide()};const e=document.createElement("div");e.appendChild(CM.Disp.CreateUpgradeBarLegend()),CM.Disp.UpgradeBar.onmouseover=function(){Game.tooltip.draw(this,escape(e.innerHTML),"store")};const t=function(e,t){const i=document.createElement("span");return i.id=e,i.className=CM.Disp.colorTextPre+t,i.style.width="14.28571428571429%",i.style.display="inline-block",i.textContent="0",i};CM.Disp.UpgradeBar.appendChild(t("CMUpgradeBarBlue",CM.Disp.colorBlue)),CM.Disp.UpgradeBar.appendChild(t("CMUpgradeBarGreen",CM.Disp.colorGreen)),CM.Disp.UpgradeBar.appendChild(t("CMUpgradeBarYellow",CM.Disp.colorYellow)),CM.Disp.UpgradeBar.appendChild(t("CMUpgradeBarOrange",CM.Disp.colorOrange)),CM.Disp.UpgradeBar.appendChild(t("CMUpgradeBarRed",CM.Disp.colorRed)),CM.Disp.UpgradeBar.appendChild(t("CMUpgradeBarPurple",CM.Disp.colorPurple)),CM.Disp.UpgradeBar.appendChild(t("CMUpgradeBarGray",CM.Disp.colorGray)),l("upgrades").parentNode.insertBefore(CM.Disp.UpgradeBar,l("upgrades").parentNode.childNodes[3])},CM.Disp.CreateUpgradeBarLegend=function(){const e=document.createElement("div");e.style.minWidth="330px",e.style.marginBottom="4px";const t=document.createElement("div");t.className="name",t.style.marginBottom="4px",t.textContent="Legend",e.appendChild(t);const i=function(e,t){const i=document.createElement("div");i.style.verticalAlign="middle";const o=document.createElement("span");return o.className=CM.Disp.colorBackPre+e,o.style.display="inline-block",o.style.height="10px",o.style.width="10px",o.style.marginRight="4px",i.appendChild(o),i.appendChild(document.createTextNode(t)),i};return e.appendChild(i(CM.Disp.colorBlue,"Better than best PP building")),e.appendChild(i(CM.Disp.colorGreen,"Same as best PP building")),e.appendChild(i(CM.Disp.colorYellow,"Between best and worst PP buildings closer to best")),e.appendChild(i(CM.Disp.colorOrange,"Between best and worst PP buildings closer to worst")),e.appendChild(i(CM.Disp.colorRed,"Same as worst PP building")),e.appendChild(i(CM.Disp.colorPurple,"Worse than worst PP building")),e.appendChild(i(CM.Disp.colorGray,"Negative or infinity PP")),e},CM.Disp.CreateWhiteScreen=function(){CM.Disp.WhiteScreen=document.createElement("div"),CM.Disp.WhiteScreen.id="CMWhiteScreen",CM.Disp.WhiteScreen.style.width="100%",CM.Disp.WhiteScreen.style.height="100%",CM.Disp.WhiteScreen.style.backgroundColor="white",CM.Disp.WhiteScreen.style.display="none",CM.Disp.WhiteScreen.style.zIndex="9999999999",CM.Disp.WhiteScreen.style.position="absolute",l("wrapper").appendChild(CM.Disp.WhiteScreen)},CM.Disp.Flash=function(e,t){1===CM.Options[t]&&3===e&&!1===CM.Footer.isInitzializing||1===e?(CM.Disp.WhiteScreen.style.opacity="0.5",3===e?(CM.Disp.WhiteScreen.style.display="inline",setTimeout((function(){CM.Disp.Flash(2,t)}),1e3/Game.fps)):setTimeout((function(){CM.Disp.Flash(0,t)}),1e3/Game.fps)):2===e?(CM.Disp.WhiteScreen.style.opacity="1",setTimeout((function(){CM.Disp.Flash(1,t)}),1e3/Game.fps)):0===e&&(CM.Disp.WhiteScreen.style.display="none")},CM.Disp.PlaySound=function(e,t,i){if(1===CM.Options[t]&&!1===CM.Footer.isInitzializing){const t=new realAudio(e);CM.Options.GeneralSound?t.volume=CM.Options[i]/100*(Game.volume/100):t.volume=CM.Options[i]/100,t.play()}},CM.Disp.Notification=function(e,t,i){1===CM.Options[e]&&"hidden"===document.visibilityState&&!1===CM.Footer.isInitzializing&&new Notification(t,{body:i,badge:"https://orteil.dashnet.org/cookieclicker/favicon.ico"})},CM.Disp.CreateFavicon=function(){CM.Disp.Favicon=document.createElement("link"),CM.Disp.Favicon.id="CMFavicon",CM.Disp.Favicon.rel="shortcut icon",CM.Disp.Favicon.href="https://orteil.dashnet.org/cookieclicker/favicon.ico",document.getElementsByTagName("head")[0].appendChild(CM.Disp.Favicon)},CM.Disp.UpdateFavicon=function(){1===CM.Options.Favicon&&CM.Main.lastGoldenCookieState>0?CM.Cache.spawnedGoldenShimmer.wrath?CM.Disp.Favicon.href="https://aktanusa.github.io/CookieMonster/favicon/wrathCookie.ico":CM.Disp.Favicon.href="https://aktanusa.github.io/CookieMonster/favicon/goldenCookie.ico":CM.Disp.Favicon.href="https://orteil.dashnet.org/cookieclicker/favicon.ico"},CM.Disp.UpdateTitle=function(){if(Game.OnAscend||0===CM.Options.Title)document.title=CM.Disp.Title;else if(1===CM.Options.Title){let e,t,i,o=!1,a=!1;e=CM.Cache.spawnedGoldenShimmer?CM.Cache.spawnedGoldenShimmer.wrath?`[W${Math.ceil(CM.Cache.spawnedGoldenShimmer.life/Game.fps)}]`:`[G${Math.ceil(CM.Cache.spawnedGoldenShimmer.life/Game.fps)}]`:Game.Has("Golden switch [off]")?"[GS]":`[${Number(l("CMTimerBarGCMinBar").textContent)<0?"!":""}${Math.ceil((Game.shimmerTypes.golden.maxTime-Game.shimmerTypes.golden.time)/Game.fps)}]`,CM.Main.lastTickerFortuneState&&(o=!0,t="[F]"),"christmas"===Game.season&&(a=!0,i=CM.Main.lastSeasonPopupState?`[R${Math.ceil(CM.Cache.seasonPopShimmer.life/Game.fps)}]`:`[${Number(l("CMTimerBarRenMinBar").textContent)<0?"!":""}${Math.ceil((Game.shimmerTypes.reindeer.maxTime-Game.shimmerTypes.reindeer.time)/Game.fps)}]`);let n=CM.Disp.Title;"["===n.charAt(0)&&(n=n.substring(n.lastIndexOf("]")+1)),document.title=`${e+(o?t:"")+(a?i:"")} ${n}`}else if(2===CM.Options.Title){let e="",t=!1;CM.Cache.spawnedGoldenShimmer&&(t=!0,CM.Cache.spawnedGoldenShimmer.wrath?e+=`[W${Math.ceil(CM.Cache.spawnedGoldenShimmer.life/Game.fps)}]`:e+=`[G${Math.ceil(CM.Cache.spawnedGoldenShimmer.life/Game.fps)}]`),CM.Main.lastTickerFortuneState&&(t=!0,e+="[F]"),"christmas"===Game.season&&CM.Main.lastSeasonPopupState&&(e+=`[R${Math.ceil(CM.Cache.seasonPopShimmer.life/Game.fps)}]`,t=!0),t&&(e+=" - ");let i="Cookie Clicker";"fools"===Game.season&&(i="Cookie Baker"),e+=i,document.title=e}},CM.Disp.CreateGCTimer=function(e){const t=document.createElement("div");t.id=`GCTimer${e.id}`,t.style.width="96px",t.style.height="96px",t.style.position="absolute",t.style.zIndex="10000000001",t.style.textAlign="center",t.style.lineHeight="96px",t.style.fontFamily='"Kavoon", Georgia, serif',t.style.fontSize="35px",t.style.cursor="pointer",t.style.display="block",0===CM.Options.GCTimer&&(t.style.display="none"),t.style.left=e.l.style.left,t.style.top=e.l.style.top,t.onclick=function(){e.pop()},t.onmouseover=function(){e.l.style.filter="brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))",e.l.style.webkitFilter="brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))"},t.onmouseout=function(){e.l.style.filter="",e.l.style.webkitFilter=""},CM.Disp.GCTimers[e.id]=t,l("shimmers").appendChild(t)},CM.Disp.ToggleGCTimer=function(){if(1===CM.Options.GCTimer)for(const e of Object.keys(CM.Disp.GCTimers))CM.Disp.GCTimers[e].style.display="block",CM.Disp.GCTimers[e].style.left=CM.Cache.goldenShimmersByID[e].l.style.left,CM.Disp.GCTimers[e].style.top=CM.Cache.goldenShimmersByID[e].l.style.top;else for(const e of Object.keys(CM.Disp.GCTimers))CM.Disp.GCTimers[e].style.display="none"},CM.Disp.CreateSimpleTooltip=function(e,t,i){CM.Disp[e]=document.createElement("div");const o=document.createElement("div");o.style.minWidth=i,o.style.marginBottom="4px";const a=document.createElement("div");a.style.textAlign="left",a.textContent=t,o.appendChild(a),CM.Disp[e].appendChild(o)},CM.Disp.ReplaceTooltipUpgrade=function(){CM.Disp.TooltipUpgradeBackup=[];for(const e of Object.keys(Game.UpgradesInStore))null!==l(`upgrade${e}`).onmouseover&&(CM.Disp.TooltipUpgradeBackup[e]=l(`upgrade${e}`).onmouseover,l(`upgrade${e}`).onmouseover=function(){Game.mouseDown||(Game.setOnCrate(this),Game.tooltip.dynamic=1,Game.tooltip.draw(this,(function(){return CM.Disp.Tooltip("u",`${e}`)}),"store"),Game.tooltip.wobble())})},CM.Disp.Tooltip=function(e,t){if("b"===e){if(l("tooltip").innerHTML=Game.Objects[t].tooltip(),1===CM.Options.TooltipAmor){const e=CM.Sim.BuildingGetPrice(Game.Objects[t],Game.Objects[t].basePrice,0,Game.Objects[t].free,Game.Objects[t].amount),i=e-Game.Objects[t].totalCookies;i>0&&(l("tooltip").innerHTML=l("tooltip").innerHTML.split("so far</div>").join(`so far<br/>&bull; <b>${Beautify(i)}</b> ${1===Math.floor(i)?"cookie":"cookies"} left to amortize (${CM.Disp.GetTimeColor((e-Game.Objects[t].totalCookies)/(Game.Objects[t].storedTotalCps*Game.globalCpsMult)).text})</div>`))}-1===Game.buyMode&&(l("tooltip").innerHTML=l("tooltip").innerHTML.split(Beautify(Game.Objects[t].bulkPrice)).join(Beautify(CM.Sim.BuildingSell(Game.Objects[t],Game.Objects[t].basePrice,Game.Objects[t].amount,Game.Objects[t].free,Game.buyBulk,1))))}else if("u"===e){if(!Game.UpgradesInStore[t])return"";l("tooltip").innerHTML=Game.crateTooltip(Game.UpgradesInStore[t],"store")}else"s"===e?l("tooltip").innerHTML=Game.lumpTooltip():"g"===e?l("tooltip").innerHTML=Game.Objects["Wizard tower"].minigame.spellTooltip(t)():"p"===e?l("tooltip").innerHTML=Game.ObjectsById[2].minigame.tileTooltip(t[0],t[1])():"ha"===e&&(l("tooltip").innerHTML=Game.ObjectsById[2].minigame.toolTooltip(1)());if("b"===e&&1===Game.buyMode||"u"===e||"s"===e||"g"===e||"p"===e&&!Game.keys[16]||"ha"===e){const e=document.createElement("div");e.id="CMTooltipArea",l("tooltip").appendChild(e)}return CM.Disp.tooltipType=e,CM.Disp.tooltipName=t,CM.Disp.UpdateTooltip(),l("tooltip").innerHTML},CM.Disp.TooltipCreateTooltipBox=function(){l("tooltip").firstChild.style.paddingBottom="4px";const e=document.createElement("div");return e.style.border="1px solid",e.style.padding="4px",e.style.margin="0px -4px",e.id="CMTooltipBorder",e.className=CM.Disp.colorTextPre+CM.Disp.colorGray,e},CM.Disp.TooltipCreateHeader=function(e){const t=document.createElement("div");return t.style.fontWeight="bold",t.id=`${e}Title`,t.className=CM.Disp.colorTextPre+CM.Disp.colorBlue,t.textContent=e,t},CM.Disp.TooltipCreateCalculationSection=function(e){e.appendChild(CM.Disp.TooltipCreateHeader("Bonus Income"));const t=document.createElement("div");t.style.marginBottom="4px",t.style.color="white",t.id="CMTooltipIncome",e.appendChild(t),e.appendChild(CM.Disp.TooltipCreateHeader("Bonus Cookies per Click")),e.lastChild.style.display="none";const i=document.createElement("div");i.style.marginBottom="4px",i.style.color="white",i.style.display="none",i.id="CMTooltipCookiePerClick",e.appendChild(i),e.appendChild(CM.Disp.TooltipCreateHeader("Payback Period"));const o=document.createElement("div");o.style.marginBottom="4px",o.id="CMTooltipPP",e.appendChild(o),e.appendChild(CM.Disp.TooltipCreateHeader("Time Left"));const a=document.createElement("div");if(a.id="CMTooltipTime",e.appendChild(a),"b"===CM.Disp.tooltipType){e.appendChild(CM.Disp.TooltipCreateHeader("Production left till next achievement")),e.lastChild.id="CMTooltipProductionHeader";const t=document.createElement("div");t.id="CMTooltipProduction",e.appendChild(t)}},CM.Disp.TooltipCreateWarningSection=function(){CM.Disp.TooltipWarn=document.createElement("div"),CM.Disp.TooltipWarn.style.position="absolute",CM.Disp.TooltipWarn.style.display="block",CM.Disp.TooltipWarn.style.left="auto",CM.Disp.TooltipWarn.style.bottom="auto",CM.Disp.TooltipWarn.id="CMDispTooltipWarningParent";const e=function(e,t,i,o,a){const n=document.createElement("div");n.id=e,n.style.display="none",n.style.transition="opacity 0.1s ease-out",n.className=CM.Disp.colorBorderPre+t,n.style.padding="2px",n.style.background="#000 url(img/darkNoise.png)";const s=document.createElement("div");n.appendChild(s);const r=document.createElement("span");r.className=CM.Disp.colorTextPre+t,r.style.fontWeight="bold",r.textContent=i,s.appendChild(r),s.appendChild(document.createTextNode(o));const l=document.createElement("div");n.appendChild(l);const p=document.createElement("span");return p.id=a,l.appendChild(document.createTextNode("Deficit: ")),l.appendChild(p),n};return CM.Disp.TooltipWarn.appendChild(e("CMDispTooltipWarnLucky",CM.Disp.colorRed,"Warning: ",'Purchase of this item will put you under the number of Cookies required for "Lucky!"',"CMDispTooltipWarnLuckyText")),CM.Disp.TooltipWarn.firstChild.style.marginBottom="4px",CM.Disp.TooltipWarn.appendChild(e("CMDispTooltipWarnLuckyFrenzy",CM.Disp.colorYellow,"Warning: ",'Purchase of this item will put you under the number of Cookies required for "Lucky!" (Frenzy)',"CMDispTooltipWarnLuckyFrenzyText")),CM.Disp.TooltipWarn.lastChild.style.marginBottom="4px",CM.Disp.TooltipWarn.appendChild(e("CMDispTooltipWarnConjure",CM.Disp.colorPurple,"Warning: ",'Purchase of this item will put you under the number of Cookies required for "Conjure Baked Goods"',"CMDispTooltipWarnConjureText")),CM.Disp.TooltipWarn.lastChild.style.marginBottom="4px",CM.Disp.TooltipWarn.appendChild(e("CMDispTooltipWarnConjureFrenzy",CM.Disp.colorPurple,"Warning: ",'Purchase of this item will put you under the number of Cookies required for "Conjure Baked Goods" (Frenzy)',"CMDispTooltipWarnConjureFrenzyText")),CM.Disp.TooltipWarn.lastChild.style.marginBottom="4px",CM.Disp.TooltipWarn.appendChild(e("CMDispTooltipWarnEdifice",CM.Disp.colorPurple,"Warning: ",'Purchase of this item will put you under the number of Cookies needed for "Spontaneous Edifice" to possibly give you your most expensive building"',"CMDispTooltipWarnEdificeText")),CM.Disp.TooltipWarn.lastChild.style.marginBottom="4px",CM.Disp.TooltipWarn.appendChild(e("CMDispTooltipWarnUser",CM.Disp.colorRed,"Warning: ",`Purchase of this item will put you under the number of Cookies equal to ${CM.Options.ToolWarnUser} seconds of CPS`,"CMDispTooltipWarnUserText")),CM.Disp.TooltipWarn},CM.Disp.UpdateTooltip=function(){if(CM.Sim.CopyData(),"none"!==l("tooltipAnchor").style.display&&l("CMTooltipArea")){l("CMTooltipArea").innerHTML="";const e=CM.Disp.TooltipCreateTooltipBox();l("CMTooltipArea").appendChild(e),"b"===CM.Disp.tooltipType?CM.Disp.UpdateTooltipBuilding():"u"===CM.Disp.tooltipType?CM.Disp.UpdateTooltipUpgrade():"s"===CM.Disp.tooltipType?CM.Disp.UpdateTooltipSugarLump():"g"===CM.Disp.tooltipType?CM.Disp.UpdateTooltipGrimoire():"p"===CM.Disp.tooltipType?CM.Disp.UpdateTooltipGardenPlots():"ha"===CM.Disp.tooltipType&&CM.Disp.UpdateTooltipHarvestAll(),CM.Disp.UpdateTooltipWarnings()}else null===l("CMTooltipArea")&&null!==l("CMDispTooltipWarningParent")&&l("CMDispTooltipWarningParent").remove()},CM.Disp.UpdateTooltipBuilding=function(){if(1===CM.Options.TooltipBuildUpgrade&&1===Game.buyMode){const e=l("CMTooltipBorder");CM.Disp.TooltipCreateCalculationSection(e);let t=`Objects${Game.buyBulk}`;if(1===Game.buyMode?CM.Disp.LastTargetTooltipBuilding=t:t=CM.Disp.LastTargetTooltipBuilding,CM.Disp.TooltipPrice=Game.Objects[CM.Disp.tooltipName].bulkPrice,CM.Disp.TooltipBonusIncome=CM.Cache[t][CM.Disp.tooltipName].bonus,1===CM.Options.TooltipBuildUpgrade&&1===Game.buyMode){l("CMTooltipIncome").textContent=Beautify(CM.Disp.TooltipBonusIncome,2);const e=Math.round(CM.Disp.TooltipBonusIncome/Game.cookiesPs*1e4);Number.isFinite(e)&&0!==e&&(l("CMTooltipIncome").textContent+=` (${e/100}% of income)`),l("CMTooltipBorder").className=CM.Disp.colorTextPre+CM.Cache[t][CM.Disp.tooltipName].color,l("CMTooltipPP").textContent=Beautify(CM.Cache[t][CM.Disp.tooltipName].pp,2),l("CMTooltipPP").className=CM.Disp.colorTextPre+CM.Cache[t][CM.Disp.tooltipName].color;const i=CM.Disp.GetTimeColor((CM.Disp.TooltipPrice-(Game.cookies+CM.Disp.GetWrinkConfigBank()))/CM.Disp.GetCPS());l("CMTooltipTime").textContent=i.text,"Done!"===i.text&&Game.cookies<CM.Cache[t][CM.Disp.tooltipName].price?l("CMTooltipTime").textContent=`${i.text} (with Wrink)`:l("CMTooltipTime").textContent=i.text,l("CMTooltipTime").className=CM.Disp.colorTextPre+i.color}l("CMTooltipProductionHeader").style.display="none",l("CMTooltipTime").style.marginBottom="0px";for(const e of Object.keys(Game.Objects[CM.Disp.tooltipName].productionAchievs))if(!Game.HasAchiev(Game.Objects[CM.Disp.tooltipName].productionAchievs[e].achiev.name)){const t=Game.Objects[CM.Disp.tooltipName].productionAchievs[e];l("CMTooltipTime").style.marginBottom="4px",l("CMTooltipProductionHeader").style.display="",l("CMTooltipProduction").className=`ProdAchievement${CM.Disp.tooltipName}`,l("CMTooltipProduction").textContent=Beautify(t.pow-CM.Sim.Objects[CM.Disp.tooltipName].totalCookies,15),l("CMTooltipProduction").style.color="white";break}}else l("CMTooltipArea").style.display="none"},CM.Disp.UpdateTooltipUpgrade=function(){const e=l("CMTooltipBorder");if(CM.Disp.TooltipCreateCalculationSection(e),CM.Disp.TooltipBonusIncome=CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].bonus,CM.Disp.TooltipPrice=Game.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].getPrice(),CM.Disp.TooltipBonusMouse=CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].bonusMouse,1===CM.Options.TooltipBuildUpgrade){l("CMTooltipIncome").textContent=Beautify(CM.Disp.TooltipBonusIncome,2);const e=Math.round(CM.Disp.TooltipBonusIncome/Game.cookiesPs*1e4);"0"!==l("CMTooltipIncome").textContent||"b"!==CM.Disp.tooltipType&&"u"!==CM.Disp.tooltipType?(Number.isFinite(e)&&0!==e&&(l("CMTooltipIncome").textContent+=` (${e/100}% of income)`),l("CMTooltipBorder").className=CM.Disp.colorTextPre+CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].color,CM.Disp.TooltipBonusMouse&&(l("CMTooltipCookiePerClick").textContent=Beautify(CM.Disp.TooltipBonusMouse),l("CMTooltipCookiePerClick").style.display="block",l("CMTooltipCookiePerClick").previousSibling.style.display="block"),0===CM.Disp.TooltipBonusIncome&&CM.Disp.TooltipBonusMouse?(l("CMTooltipPP").textContent=`${Beautify(CM.Disp.TooltipPrice/CM.Disp.TooltipBonusMouse)} Clicks`,l("CMTooltipPP").style.color="white"):(l("CMTooltipPP").textContent=Beautify(CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].pp,2),l("CMTooltipPP").className=CM.Disp.colorTextPre+CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].color)):(l("Bonus IncomeTitle").style.display="none",l("CMTooltipIncome").style.display="none",l("Payback PeriodTitle").style.display="none",l("CMTooltipPP").style.display="none");const t=CM.Disp.GetTimeColor((CM.Disp.TooltipPrice-(Game.cookies+CM.Disp.GetWrinkConfigBank()))/CM.Disp.GetCPS());if(l("CMTooltipTime").textContent=t.text,"Done!"===t.text&&Game.cookies<Game.UpgradesInStore[CM.Disp.tooltipName].getPrice()?l("CMTooltipTime").textContent=`${t.text} (with Wrink)`:l("CMTooltipTime").textContent=t.text,l("CMTooltipTime").className=CM.Disp.colorTextPre+t.color,"Chocolate egg"===Game.UpgradesInStore[CM.Disp.tooltipName].name){l("CMTooltipBorder").lastChild.style.marginBottom="4px",l("CMTooltipBorder").appendChild(CM.Disp.TooltipCreateHeader("Cookies to be gained (Currently/Max)"));const e=document.createElement("div");e.style.color="white",e.textContent=`${CM.Disp.Beautify(.05*Game.cookies)} / ${CM.Disp.Beautify(CM.Cache.lastChoEgg)}`,l("CMTooltipBorder").appendChild(e)}}else l("CMTooltipArea").style.display="none"},CM.Disp.UpdateTooltipSugarLump=function(){if(1===CM.Options.TooltipLump){const e=l("CMTooltipBorder");e.appendChild(CM.Disp.TooltipCreateHeader("Current Sugar Lump"));const t=document.createElement("div");t.id="CMTooltipTime",e.appendChild(t);const i=CM.Disp.GetLumpColor(Game.lumpCurrentType);t.textContent=i.text,t.className=CM.Disp.colorTextPre+i.color}else l("CMTooltipArea").style.display="none"},CM.Disp.UpdateTooltipGrimoire=function(){const e=Game.Objects["Wizard tower"].minigame,t=e.getSpellCost(e.spellsById[CM.Disp.tooltipName]);if(1===CM.Options.TooltipGrim&&t<=e.magicM){const i=l("CMTooltipBorder");i.appendChild(CM.Disp.TooltipCreateHeader("Time Left"));const o=document.createElement("div");o.id="CMTooltipTime",i.appendChild(o);const a=CM.Disp.GetTimeColor(CM.Disp.CalculateGrimoireRefillTime(e.magic,e.magicM,t));if(o.textContent=a.text,o.className=CM.Disp.colorTextPre+a.color,t<=e.magic){i.appendChild(CM.Disp.TooltipCreateHeader("Recover Time"));const o=document.createElement("div");o.id="CMTooltipRecover",i.appendChild(o);const a=CM.Disp.GetTimeColor(CM.Disp.CalculateGrimoireRefillTime(Math.max(0,e.magic-t),e.magicM,e.magic));o.textContent=a.text,o.className=CM.Disp.colorTextPre+a.color}if("0"===CM.Disp.tooltipName){i.appendChild(CM.Disp.TooltipCreateHeader("Cookies to be gained/lost"));const e=document.createElement("div");e.id="x",i.appendChild(e);const t=document.createElement("span");t.style.color="#33FF00",t.textContent=Beautify(Math.min(.15*(Game.cookies+CM.Disp.GetWrinkConfigBank()),60*CM.Cache.NoGoldSwitchCookiesPS*30),2),e.appendChild(t);const o=document.createElement("span");o.textContent=" / ",e.appendChild(o);const a=document.createElement("span");a.style.color="red",a.textContent=Beautify(60*CM.Cache.NoGoldSwitchCookiesPS*15,2),e.appendChild(a)}l("CMTooltipArea").appendChild(i)}else l("CMTooltipArea").style.display="none"},CM.Disp.UpdateTooltipGardenPlots=function(){const e=Game.Objects.Farm.minigame;if(CM.Options.TooltipPlots&&0!==e.plot[CM.Disp.tooltipName[1]][CM.Disp.tooltipName[0]][0]){const t=e.plot[CM.Disp.tooltipName[1]][CM.Disp.tooltipName[0]][1]>e.plantsById[e.plot[CM.Disp.tooltipName[1]][CM.Disp.tooltipName[0]][0]-1].matureBase,i=e.plantsById[e.plot[CM.Disp.tooltipName[1]][CM.Disp.tooltipName[0]][0]-1].name;l("CMTooltipBorder").appendChild(CM.Disp.TooltipCreateHeader("Reward (Current / Maximum)"));const o=document.createElement("div");o.id="CMTooltipPlantReward",l("CMTooltipBorder").appendChild(o),"Bakeberry"===i?l("CMTooltipPlantReward").textContent=`${t?CM.Disp.Beautify(Math.min(.03*Game.cookies,60*Game.cookiesPs*30)):"0"} / ${CM.Disp.Beautify(60*Game.cookiesPs*30)}`:"Chocoroot"===i||"White chocoroot"===i?l("CMTooltipPlantReward").textContent=`${t?CM.Disp.Beautify(Math.min(.03*Game.cookies,60*Game.cookiesPs*3)):"0"} / ${CM.Disp.Beautify(60*Game.cookiesPs*3)}`:"Queenbeet"===i?l("CMTooltipPlantReward").textContent=`${t?CM.Disp.Beautify(Math.min(.04*Game.cookies,60*Game.cookiesPs*60)):"0"} / ${CM.Disp.Beautify(60*Game.cookiesPs*60)}`:"Duketater"===i?l("CMTooltipPlantReward").textContent=`${t?CM.Disp.Beautify(Math.min(.08*Game.cookies,60*Game.cookiesPs*120)):"0"} / ${CM.Disp.Beautify(60*Game.cookiesPs*120)}`:l("CMTooltipArea").style.display="none"}else l("CMTooltipArea").style.display="none"},CM.Disp.UpdateTooltipHarvestAll=function(){const e=Game.Objects.Farm.minigame;if(CM.Options.TooltipLump){l("CMTooltipBorder").appendChild(CM.Disp.TooltipCreateHeader("Cookies gained from harvesting:"));let t=0,i=0;Game.keys[16]&&Game.keys[17]&&(i=1);for(let o=0;o<6;o++)for(let a=0;a<6;a++)if(e.plot[o][a][0]>=1){const n=e.plot[o][a],s=e.plantsById[n[0]-1],r=s.name;let l=!0;i&&s.immortal&&(l=!1),n[1]<s.matureBase&&(l=!1),l&&"Bakeberry"===r?t+=Math.min(.03*Game.cookies,60*Game.cookiesPs*30):l&&"Chocoroot"===r||"White chocoroot"===r?t+=Math.min(.03*Game.cookies,60*Game.cookiesPs*3):l&&"Queenbeet"===r?t+=Math.min(.04*Game.cookies,60*Game.cookiesPs*60):l&&"Duketater"===r&&(t+=Math.min(.08*Game.cookies,60*Game.cookiesPs*120))}l("CMTooltipBorder").appendChild(document.createTextNode(CM.Disp.Beautify(t)))}else l("CMTooltipArea").style.display="none"},CM.Disp.UpdateTooltipWarnings=function(){if("b"===CM.Disp.tooltipType||"u"===CM.Disp.tooltipType){if(null===document.getElementById("CMDispTooltipWarningParent")){const e=CM.Disp.TooltipCreateWarningSection();l("tooltipAnchor").appendChild(e),CM.Disp.ToggleToolWarnPos()}0===CM.Options.ToolWarnPos?CM.Disp.TooltipWarn.style.right="0px":CM.Disp.TooltipWarn.style.top=`${l("tooltip").offsetHeight}px`,CM.Disp.TooltipWarn.style.width=l("tooltip").offsetWidth-6+"px";const e=Game.cookies+CM.Disp.GetWrinkConfigBank()-CM.Disp.TooltipPrice,t=CM.Options.ToolWarnBon?CM.Disp.TooltipBonusIncome:0;let i=CM.Cache.Lucky;if(1===CM.Options.ToolWarnBon){let e=CM.Disp.TooltipBonusIncome;e/=CM.Cache.getCPSBuffMult(),i+=60*e*15/.15}if(1===CM.Options.ToolWarnLucky&&e<i&&("b"!==CM.Disp.tooltipType||1===Game.buyMode)?(l("CMDispTooltipWarnLucky").style.display="",l("CMDispTooltipWarnLuckyText").textContent=`${Beautify(i-e)} (${CM.Disp.FormatTime((i-e)/(CM.Disp.GetCPS()+t))})`):l("CMDispTooltipWarnLucky").style.display="none",1===CM.Options.ToolWarnLuckyFrenzy){const o=7*i;e<o&&("b"!==CM.Disp.tooltipType||1===Game.buyMode)?(l("CMDispTooltipWarnLuckyFrenzy").style.display="",l("CMDispTooltipWarnLuckyFrenzyText").textContent=`${Beautify(o-e)} (${CM.Disp.FormatTime((o-e)/(CM.Disp.GetCPS()+t))})`):l("CMDispTooltipWarnLuckyFrenzy").style.display="none"}else l("CMDispTooltipWarnLuckyFrenzy").style.display="none";if(1===CM.Options.ToolWarnConjure){const o=2*i;e<o&&("b"!==CM.Disp.tooltipType||1===Game.buyMode)?(l("CMDispTooltipWarnConjure").style.display="",l("CMDispTooltipWarnConjureText").textContent=`${Beautify(o-e)} (${CM.Disp.FormatTime((o-e)/(CM.Disp.GetCPS()+t))})`):l("CMDispTooltipWarnConjure").style.display="none"}else l("CMDispTooltipWarnConjure").style.display="none";if(1===CM.Options.ToolWarnConjureFrenzy){const o=2*i*7;e<o&&("b"!==CM.Disp.tooltipType||1===Game.buyMode)?(l("CMDispTooltipWarnConjureFrenzy").style.display="",l("CMDispTooltipWarnConjureFrenzyText").textContent=`${Beautify(o-e)} (${CM.Disp.FormatTime((o-e)/(CM.Disp.GetCPS()+t))})`):l("CMDispTooltipWarnConjureFrenzy").style.display="none"}else l("CMDispTooltipWarnConjureFrenzy").style.display="none";1===CM.Options.ToolWarnEdifice&&Game.Objects["Wizard tower"].minigameLoaded&&CM.Cache.Edifice&&e<CM.Cache.Edifice&&("b"!==CM.Disp.tooltipType||1===Game.buyMode)?(l("CMDispTooltipWarnEdifice").style.display="",l("CMDispTooltipWarnEdificeText").textContent=`${Beautify(CM.Cache.Edifice-e)} (${CM.Disp.FormatTime((CM.Cache.Edifice-e)/(CM.Disp.GetCPS()+t))})`):l("CMDispTooltipWarnEdifice").style.display="none",CM.Options.ToolWarnUser>0&&e<CM.Options.ToolWarnUser*CM.Disp.GetCPS()&&("b"!==CM.Disp.tooltipType||1===Game.buyMode)?(l("CMDispTooltipWarnUser").style.display="",l("CMDispTooltipWarnUser").children[0].textContent=`Purchase of this item will put you under the number of Cookies equal to ${CM.Options.ToolWarnUser} seconds of CPS`,l("CMDispTooltipWarnUserText").textContent=`${Beautify(CM.Options.ToolWarnUser*CM.Disp.GetCPS()-e)} (${CM.Disp.FormatTime((CM.Options.ToolWarnUser*CM.Disp.GetCPS()-e)/(CM.Disp.GetCPS()+t))})`):l("CMDispTooltipWarnUser").style.display="none"}else null!==l("CMDispTooltipWarningParent")&&l("CMDispTooltipWarningParent").remove()},CM.Disp.UpdateTooltipLocation=function(){if("store"===Game.tooltip.origin){let e=0;1===CM.Options.ToolWarnLucky&&1===CM.Options.ToolWarnPos&&void 0!==CM.Disp.TooltipWarn&&(e=CM.Disp.TooltipWarn.clientHeight-4),Game.tooltip.tta.style.top=`${Math.min(parseInt(Game.tooltip.tta.style.top),l("game").clientHeight+l("topBar").clientHeight-Game.tooltip.tt.clientHeight-e-46)}px`}},CM.Disp.ToggleToolWarnPos=function(){void 0!==CM.Disp.TooltipWarn&&(0===CM.Options.ToolWarnPos?(CM.Disp.TooltipWarn.style.top="auto",CM.Disp.TooltipWarn.style.margin="4px -4px",CM.Disp.TooltipWarn.style.padding="3px 4px"):(CM.Disp.TooltipWarn.style.right="auto",CM.Disp.TooltipWarn.style.margin="4px",CM.Disp.TooltipWarn.style.padding="4px 3px"))},CM.Disp.CheckWrinklerTooltip=function(){if(1===CM.Options.TooltipWrink&&1===CM.Disp.TooltipWrinklerArea){let e=!1;for(const t of Object.keys(Game.wrinklers)){const i=Game.wrinklers[t];if(i.phase>0&&i.selected){if(e=!0,0!==CM.Disp.TooltipWrinklerBeingShown[t]&&void 0!==CM.Disp.TooltipWrinklerBeingShown[t])break;{const e=document.createElement("div"),i=document.createElement("div");i.style.minWidth="120px",i.style.marginBottom="4px";const o=document.createElement("div");o.style.textAlign="center",o.id="CMTooltipWrinkler",i.appendChild(o),e.appendChild(i),Game.tooltip.draw(this,escape(e.innerHTML)),CM.Disp.TooltipWrinkler=t,CM.Disp.TooltipWrinklerBeingShown[t]=1}}else CM.Disp.TooltipWrinklerBeingShown[t]=0}e||Game.tooltip.hide()}},CM.Disp.UpdateWrinklerTooltip=function(){if(1===CM.Options.TooltipWrink&&null!==l("CMTooltipWrinkler")){let e=Game.wrinklers[CM.Disp.TooltipWrinkler].sucked,t=1.1;if(Game.Has("Sacrilegious corruption")&&(t*=1.05),1===Game.wrinklers[CM.Disp.TooltipWrinkler].type&&(t*=3),e*=t,Game.Has("Wrinklerspawn")&&(e*=1.05),CM.Sim.Objects.Temple.minigameLoaded){const t=Game.hasGod("scorn");1===t?e*=1.15:2===t?e*=1.1:3===t&&(e*=1.05)}l("CMTooltipWrinkler").textContent=Beautify(e)}},CM.Disp.AddAuraInfo=function(e){if(1===CM.Options.DragonAuraInfo){const[t,i]=CM.Sim.CalculateChangeAura(e),o=CM.Disp.FormatTime(i/(t+Game.cookiesPs)),a=CM.Disp.Beautify(t/Game.cookiesPs);l("dragonAuraInfo").style.minHeight="60px",l("dragonAuraInfo").style.margin="8px",l("dragonAuraInfo").appendChild(document.createElement("div")).className="line";const n=document.createElement("div");n.style.minWidth="200px",n.style.textAlign="center",n.textContent=`Picking this aura will change CPS by ${CM.Disp.Beautify(t)} (${a}% of current CPS).`,l("dragonAuraInfo").appendChild(n);const s=document.createElement("div");s.style.minWidth="200px",s.style.textAlign="center",s.textContent=`It will take ${o} to recover the cost.`,l("dragonAuraInfo").appendChild(s)}},CM.Disp.AddDragonLevelUpTooltip=function(){if(null!==(l("specialPopup").className.match(/onScreen/)&&l("specialPopup").children[0].style.background.match(/dragon/)))for(let e=0;e<l("specialPopup").childNodes.length;e++)"optionBox"===l("specialPopup").childNodes[e].className&&(l("specialPopup").children[e].onmouseover=function(){CM.Cache.CacheDragonCost(),Game.tooltip.dynamic=1,Game.tooltip.draw(l("specialPopup"),`<div style="min-width:200px;text-align:center;">${CM.Cache.CostDragonUpgrade}</div>`,"this"),Game.tooltip.wobble()},l("specialPopup").children[e].onmouseout=function(){Game.tooltip.shouldHide=1})},CM.Disp.AddMenu=function(){const e=document.createElement("div");e.className="title","prefs"===Game.onMenu?(e.textContent="Cookie Monster Settings",CM.Disp.AddMenuPref(e)):"stats"===Game.onMenu?CM.Options.Stats&&(e.textContent="Cookie Monster Statistics",CM.Disp.AddMenuStats(e)):"log"===Game.onMenu&&(e.textContent="Cookie Monster ",CM.Disp.AddMenuInfo(e))},CM.Disp.RefreshMenu=function(){CM.Options.UpStats&&"stats"===Game.onMenu&&(Game.drawT-1)%(5*Game.fps)!=0&&(Game.drawT-1)%Game.fps==0&&Game.UpdateMenu()},CM.Disp.AddMenuPref=function(e){const t=document.createDocumentFragment();t.appendChild(e);for(const e of Object.keys(CM.Data.ConfigGroups)){const i=CM.Disp.CreatePrefHeader(e,CM.Data.ConfigGroups[e]);if(t.appendChild(i),CM.Options.Header[e])if("Notification"===e)for(const e of Object.keys(CM.Data.ConfigGroupsNotification)){const i=CM.Disp.CreatePrefHeader(e,CM.Data.ConfigGroupsNotification[e]);if(i.style.fontSize="15px",i.style.opacity="0.5",t.appendChild(i),CM.Options.Header[e])for(const i in CM.Data.Config)CM.Data.Config[i].group===e&&t.appendChild(CM.Disp.CreatePrefOption(i))}else for(const i of Object.keys(CM.Data.Config))CM.Data.Config[i].group===e&&t.appendChild(CM.Disp.CreatePrefOption(i))}const i=document.createElement("div");i.className="listing";const o=document.createElement("a");o.className="option",o.onclick=function(){CM.Config.RestoreDefault()},o.textContent="Restore Default",i.appendChild(o),t.appendChild(i),l("menu").childNodes[2].insertBefore(t,l("menu").childNodes[2].childNodes[l("menu").childNodes[2].childNodes.length-1])},CM.Disp.CreatePrefHeader=function(e,t){const i=document.createElement("div");i.className="title",i.style.opacity="0.7",i.style.fontSize="17px",i.appendChild(document.createTextNode(`${t} `));const o=document.createElement("span");return o.style.cursor="pointer",o.style.display="inline-block",o.style.height="14px",o.style.width="14px",o.style.borderRadius="7px",o.style.textAlign="center",o.style.backgroundColor="#C0C0C0",o.style.color="black",o.style.fontSize="13px",o.style.verticalAlign="middle",o.textContent=CM.Options.Header[e]?"-":"+",o.onclick=function(){CM.Config.ToggleHeader(e),Game.UpdateMenu()},i.appendChild(o),i},CM.Disp.CreatePrefOption=function(e){const t=document.createElement("div");if(t.className="listing","bool"===CM.Data.Config[e].type){const i=document.createElement("a");CM.Data.Config[e].toggle&&0===CM.Options[e]?i.className="option off":i.className="option",i.id=CM.Config.ConfigPrefix+e,i.onclick=function(){CM.Config.ToggleConfig(e)},i.textContent=CM.Data.Config[e].label[CM.Options[e]],t.appendChild(i);const o=document.createElement("label");return o.textContent=CM.Data.Config[e].desc,t.appendChild(o),t}if("vol"===CM.Data.Config[e].type){const i=document.createElement("div");i.className="sliderBox";const o=document.createElement("div");o.style.float="left",o.innerHTML=CM.Data.Config[e].desc,i.appendChild(o);const a=document.createElement("div");a.id=`slider${e}right`,a.style.float="right",a.innerHTML=`${CM.Options[e]}%`,i.appendChild(a);const n=document.createElement("input");return n.className="slider",n.id=`slider${e}`,n.style.clear="both",n.type="range",n.min="0",n.max="100",n.step="1",n.value=CM.Options[e],n.oninput=function(){CM.Config.ToggleConfigVolume(e)},n.onchange=function(){CM.Config.ToggleConfigVolume(e)},i.appendChild(n),t.appendChild(i),t}if("url"===CM.Data.Config[e].type){const i=document.createElement("span");i.className="option",i.textContent=`${CM.Data.Config[e].label} `,t.appendChild(i);const o=document.createElement("input");o.id=CM.Config.ConfigPrefix+e,o.className="option",o.type="text",o.readOnly=!0,o.setAttribute("value",CM.Options[e]),o.style.width="300px",t.appendChild(o),t.appendChild(document.createTextNode(" "));const a=document.createElement("input");a.id=`${CM.Config.ConfigPrefix+e}Prompt`,a.className="option",a.type="text",a.setAttribute("value",CM.Options[e]);const n=document.createElement("a");n.className="option",n.onclick=function(){Game.Prompt(a.outerHTML,[["Save",`CM.Options['${e}'] = l(CM.Config.ConfigPrefix + '${e}' + 'Prompt').value; CM.Config.SaveConfig(); Game.ClosePrompt(); Game.UpdateMenu();`],"Cancel"])},n.textContent="Edit",t.appendChild(n);const s=document.createElement("label");return s.textContent=CM.Data.Config[e].desc,t.appendChild(s),t}if("color"===CM.Data.Config[e].type){t.className="";for(let e=0;e<CM.Disp.colors.length;e++){const i=document.createElement("div");i.className="listing";const o=document.createElement("input");o.id=CM.Disp.colors[e],o.style.width="65px",o.setAttribute("value",CM.Options.Colors[CM.Disp.colors[e]]),i.appendChild(o),new JSColor(o,{hash:!0,position:"right",onInput:function(){CM.Options.Colors[this.targetElement.id]=this.toHEXString(),CM.Disp.UpdateColors(),CM.Config.SaveConfig(),Game.UpdateMenu()}});const a=document.createElement("label");a.textContent=CM.Data.Config.Colors.desc[CM.Disp.colors[e]],i.appendChild(a),t.appendChild(i)}return t}if("numscale"===CM.Data.Config[e].type){const i=document.createElement("span");i.className="option",i.textContent=`${CM.Data.Config[e].label} `,t.appendChild(i);const o=document.createElement("input");o.id=CM.Config.ConfigPrefix+e,o.className="option",o.type="number",o.value=CM.Options[e],o.min=CM.Data.Config[e].min,o.max=CM.Data.Config[e].max,o.oninput=function(){this.value>this.max&&console.log("TEST"),CM.Options[e]=this.value,CM.Config.SaveConfig(),CM.Disp.RefreshScale()},t.appendChild(o),t.appendChild(document.createTextNode(" "));const a=document.createElement("label");return a.textContent=CM.Data.Config[e].desc,t.appendChild(a),t}return t},CM.Disp.ToggleDetailedTime=function(){1===CM.Options.DetailedTime?Game.sayTime=CM.Disp.sayTime:Game.sayTime=CM.Backup.sayTime},CM.Disp.RefreshScale=function(){BeautifyAll(),Game.RefreshStore(),Game.RebuildUpgrades(),CM.Disp.UpdateBotBar(),CM.Disp.UpdateBuildings(),CM.Disp.UpdateUpgrades()},CM.Disp.UpdateColors=function(){let e="";for(let t=0;t<CM.Disp.colors.length;t++)e+=`.${CM.Disp.colorTextPre}${CM.Disp.colors[t]} { color: ${CM.Options.Colors[CM.Disp.colors[t]]}; }\n`;for(let t=0;t<CM.Disp.colors.length;t++)e+=`.${CM.Disp.colorBackPre}${CM.Disp.colors[t]} { background-color: ${CM.Options.Colors[CM.Disp.colors[t]]}; }\n`;for(let t=0;t<CM.Disp.colors.length;t++)e+=`.${CM.Disp.colorBorderPre}${CM.Disp.colors[t]} { border: 1px solid ${CM.Options.Colors[CM.Disp.colors[t]]}; }\n`;CM.Disp.Css.textContent=e,CM.Disp.UpdateBuildings()},CM.Disp.AddMenuStats=function(e){const t=document.createElement("div");if(t.className="subsection",t.appendChild(e),t.appendChild(CM.Disp.CreateStatsHeader("Lucky Cookies","Lucky")),CM.Options.Header.Lucky&&t.appendChild(CM.Disp.CreateStatsLuckySection()),t.appendChild(CM.Disp.CreateStatsHeader("Chain Cookies","Chain")),CM.Options.Header.Chain&&t.appendChild(CM.Disp.CreateStatsChainSection()),Game.Objects["Wizard tower"].minigameLoaded&&(t.appendChild(CM.Disp.CreateStatsHeader("Spells","Spells")),CM.Options.Header.Spells&&t.appendChild(CM.Disp.CreateStatsSpellsSection())),Game.Objects.Farm.minigameLoaded&&(t.appendChild(CM.Disp.CreateStatsHeader("Garden","Garden")),CM.Options.Header.Garden&&t.appendChild(CM.Disp.CreateStatsGardenSection())),t.appendChild(CM.Disp.CreateStatsHeader("Prestige","Prestige")),CM.Options.Header.Prestige&&t.appendChild(CM.Disp.CreateStatsPrestigeSection()),Game.cpsSucked>0&&(t.appendChild(CM.Disp.CreateStatsHeader("Wrinklers","Wrink")),CM.Options.Header.Wrink)){const e=document.createDocumentFragment();e.appendChild(document.createTextNode(`${Beautify(CM.Cache.WrinklersTotal)} / ${Beautify(CM.Cache.WrinklersNormal)} `));const i=document.createElement("a");i.textContent="Pop All Normal",i.className="option",i.onclick=function(){CM.Disp.PopAllNormalWrinklers()},e.appendChild(i),t.appendChild(CM.Disp.CreateStatsListing("basic","Rewards of Popping (All/Normal)",e));const o=document.createDocumentFragment();o.appendChild(document.createTextNode(`${Beautify(CM.Cache.WrinklersFattest[0])} `));const a=document.createElement("a");a.textContent="Pop Single Fattest",a.className="option",a.onclick=function(){null!==CM.Cache.WrinklersFattest[1]&&(Game.wrinklers[CM.Cache.WrinklersFattest[1]].hp=0)},o.appendChild(a),t.appendChild(CM.Disp.CreateStatsListing("basic",`Rewards of Popping Single Fattest Non-Shiny Wrinkler (id: ${null!==CM.Cache.WrinklersFattest[1]?CM.Cache.WrinklersFattest[1]:"None"})`,o))}let i=!1;const o=[];for(const e of Object.keys(CM.Data.HalloCookies))Game.Has(CM.Data.HalloCookies[e])||(o.push(CM.Data.HalloCookies[e]),i=!0);const a=[];for(const e of Object.keys(CM.Data.ChristCookies))Game.Has(CM.Data.ChristCookies[e])||(a.push(CM.Data.ChristCookies[e]),i=!0);const n=[];for(const e of Object.keys(CM.Data.ValCookies))Game.Has(CM.Data.ValCookies[e])||(n.push(CM.Data.ValCookies[e]),i=!0);const s=[];for(const e of Object.keys(Game.eggDrops))Game.HasUnlocked(Game.eggDrops[e])||(s.push(Game.eggDrops[e]),i=!0);const r=[];for(const e of Object.keys(Game.rareEggDrops))Game.HasUnlocked(Game.rareEggDrops[e])||(r.push(Game.rareEggDrops[e]),i=!0);const p=[];for(const e of Object.keys(CM.Data.PlantDrops))Game.HasUnlocked(CM.Data.PlantDrops[e])||(p.push(CM.Data.PlantDrops[e]),i=!0);const C=Game.HasUnlocked("Chocolate egg")&&!Game.Has("Chocolate egg"),c=Game.Has("Century egg");if(("christmas"===Game.season||i||C||c)&&(t.appendChild(CM.Disp.CreateStatsHeader("Season Specials","Sea")),CM.Options.Header.Sea&&(0!==o.length&&t.appendChild(CM.Disp.CreateStatsListing("basic","Halloween Cookies Left to Buy",CM.Disp.CreateStatsMissDisp(o))),0!==a.length&&t.appendChild(CM.Disp.CreateStatsListing("basic","Christmas Cookies Left to Buy",CM.Disp.CreateStatsMissDisp(a))),0!==n.length&&t.appendChild(CM.Disp.CreateStatsListing("basic","Valentine Cookies Left to Buy",CM.Disp.CreateStatsMissDisp(n))),0!==s.length&&t.appendChild(CM.Disp.CreateStatsListing("basic","Normal Easter Eggs Left to Unlock",CM.Disp.CreateStatsMissDisp(s))),0!==r.length&&t.appendChild(CM.Disp.CreateStatsListing("basic","Rare Easter Eggs Left to Unlock",CM.Disp.CreateStatsMissDisp(r))),0!==p.length&&t.appendChild(CM.Disp.CreateStatsListing("basic","Rare Plant Drops Left to Unlock",CM.Disp.CreateStatsMissDisp(p))),"christmas"===Game.season&&t.appendChild(CM.Disp.CreateStatsListing("basic","Reindeer Reward",document.createTextNode(Beautify(CM.Cache.SeaSpec)))),C&&t.appendChild(CM.Disp.CreateStatsListing("withTooltip","Chocolate Egg Cookies",document.createTextNode(Beautify(CM.Cache.lastChoEgg)),"ChoEggTooltipPlaceholder")),c&&t.appendChild(CM.Disp.CreateStatsListing("basic","Century Egg Multiplier",document.createTextNode(Math.round(1e4*(CM.Cache.CentEgg-1))/100+"%"))))),t.appendChild(CM.Disp.CreateStatsHeader("Miscellaneous","Misc")),CM.Options.Header.Misc){if(t.appendChild(CM.Disp.CreateStatsListing("basic",`Average Cookies Per Second (Past ${CM.Disp.cookieTimes[CM.Options.AvgCPSHist]<60?`${CM.Disp.cookieTimes[CM.Options.AvgCPSHist]} seconds`:CM.Disp.cookieTimes[CM.Options.AvgCPSHist]/60+(3===CM.Options.AvgCPSHist?" minute":" minutes")})`,document.createTextNode(Beautify(CM.Disp.GetCPS(),3)))),t.appendChild(CM.Disp.CreateStatsListing("basic",`Average Cookie Clicks Per Second (Past ${CM.Disp.clickTimes[CM.Options.AvgClicksHist]}${0===CM.Options.AvgClicksHist?" second":" seconds"})`,document.createTextNode(Beautify(CM.Cache.AverageClicks,1)))),Game.Has("Fortune cookies")){const e=[];for(const t of Object.keys(CM.Data.Fortunes))Game.Has(CM.Data.Fortunes[t])||e.push(CM.Data.Fortunes[t]);0!==e.length&&t.appendChild(CM.Disp.CreateStatsListing("basic","Fortune Upgrades Left to Buy",CM.Disp.CreateStatsMissDisp(e)))}if(CM.Options.ShowMissedGC&&t.appendChild(CM.Disp.CreateStatsListing("basic","Missed Golden Cookies",document.createTextNode(Beautify(Game.missedGoldenClicks)))),Game.prefs.autosave){const e=document.createElement("span");e.id="CMStatsAutosaveTimer",e.innerText=Game.sayTime(60*Game.fps-(Game.OnAscend?0:Game.T%(60*Game.fps)),4),t.appendChild(CM.Disp.CreateStatsListing("basic","Time till autosave",e))}}l("menu").insertBefore(t,l("menu").childNodes[2]),CM.Options.MissingUpgrades&&CM.Disp.AddMissingUpgrades()},CM.Disp.CreateStatsHeader=function(e,t){const i=document.createElement("div");i.className="title",i.style.padding="0px 16px",i.style.opacity="0.7",i.style.fontSize="17px",i.style.fontFamily='"Kavoon", Georgia, serif',i.appendChild(document.createTextNode(`${e} `));const o=document.createElement("span");return o.style.cursor="pointer",o.style.display="inline-block",o.style.height="14px",o.style.width="14px",o.style.borderRadius="7px",o.style.textAlign="center",o.style.backgroundColor="#C0C0C0",o.style.color="black",o.style.fontSize="13px",o.style.verticalAlign="middle",o.textContent=CM.Options.Header[t]?"-":"+",o.onclick=function(){CM.Config.ToggleHeader(t),Game.UpdateMenu()},i.appendChild(o),i},CM.Disp.CreateStatsListing=function(e,t,i,o){const a=document.createElement("div");a.className="listing";const n=document.createElement("b");if(n.textContent=t,a.appendChild(n),"withTooltip"===e){a.className="listing",a.appendChild(document.createTextNode(" "));const e=document.createElement("span");e.onmouseout=function(){Game.tooltip.hide()},e.onmouseover=function(){Game.tooltip.draw(this,escape(CM.Disp[o].innerHTML))},e.style.cursor="default",e.style.display="inline-block",e.style.height="10px",e.style.width="10px",e.style.borderRadius="5px",e.style.textAlign="center",e.style.backgroundColor="#C0C0C0",e.style.color="black",e.style.fontSize="9px",e.style.verticalAlign="bottom",e.textContent="?",a.appendChild(e)}return a.appendChild(document.createTextNode(": ")),a.appendChild(i),a},CM.Disp.CreateStatsMissDisp=function(e){const t=document.createDocumentFragment();t.appendChild(document.createTextNode(`${e.length} `));const i=document.createElement("span");i.onmouseout=function(){Game.tooltip.hide()};const o=document.createElement("div"),a=document.createElement("div");a.style.minWidth="140px",a.style.marginBottom="4px";const n=document.createElement("div");n.className="name",n.style.marginBottom="4px",n.style.textAlign="center",n.textContent="Missing",a.appendChild(n);for(const t of Object.keys(e)){const i=document.createElement("div");i.style.textAlign="center",i.appendChild(document.createTextNode(e[t])),a.appendChild(i)}return o.appendChild(a),i.onmouseover=function(){Game.tooltip.draw(this,escape(o.innerHTML))},i.style.cursor="default",i.style.display="inline-block",i.style.height="10px",i.style.width="10px",i.style.borderRadius="5px",i.style.textAlign="center",i.style.backgroundColor="#C0C0C0",i.style.color="black",i.style.fontSize="9px",i.style.verticalAlign="bottom",i.textContent="?",t.appendChild(i),t},CM.Disp.CreateStatsLuckySection=function(){const e=Game.auraMult("Dragon's Fortune")?"GoldCookDragonsFortuneTooltipPlaceholder":"GoldCookTooltipPlaceholder",t=document.createElement("div");t.className="CMStatsLuckySection";const i=Game.cookies+CM.Disp.GetWrinkConfigBank()<CM.Cache.Lucky?CM.Disp.colorRed:CM.Disp.colorGreen,o=Game.cookies+CM.Disp.GetWrinkConfigBank()<CM.Cache.Lucky?CM.Disp.FormatTime((CM.Cache.Lucky-(Game.cookies+CM.Disp.GetWrinkConfigBank()))/CM.Disp.GetCPS()):"",a=document.createDocumentFragment(),n=document.createElement("span");if(n.style.fontWeight="bold",n.className=CM.Disp.colorTextPre+i,n.textContent=Beautify(CM.Cache.Lucky),a.appendChild(n),""!==o){const e=document.createElement("small");e.textContent=` (${o})`,a.appendChild(e)}t.appendChild(CM.Disp.CreateStatsListing("withTooltip",'"Lucky!" Cookies Required',a,e));const s=Game.cookies+CM.Disp.GetWrinkConfigBank()<CM.Cache.LuckyFrenzy?CM.Disp.colorRed:CM.Disp.colorGreen,r=Game.cookies+CM.Disp.GetWrinkConfigBank()<CM.Cache.LuckyFrenzy?CM.Disp.FormatTime((CM.Cache.LuckyFrenzy-(Game.cookies+CM.Disp.GetWrinkConfigBank()))/CM.Disp.GetCPS()):"",l=document.createDocumentFragment(),p=document.createElement("span");if(p.style.fontWeight="bold",p.className=CM.Disp.colorTextPre+s,p.textContent=Beautify(CM.Cache.LuckyFrenzy),l.appendChild(p),""!==r){const e=document.createElement("small");e.textContent=` (${r})`,l.appendChild(e)}t.appendChild(CM.Disp.CreateStatsListing("withTooltip",'"Lucky!" Cookies Required (Frenzy)',l,e));const C=CM.Cache.LuckyReward!==CM.Cache.LuckyWrathReward,c=document.createElement("span");c.style.fontWeight="bold",c.className=CM.Disp.colorTextPre+CM.Cache.LuckyReward,c.textContent=Beautify(CM.Cache.LuckyReward)+(C?` / ${Beautify(CM.Cache.LuckyWrathReward)}`:""),t.appendChild(CM.Disp.CreateStatsListing("withTooltip",'"Lucky!" Reward (MAX)'+(C?" (Golden / Wrath)":""),c,e));const d=document.createElement("span");d.style.fontWeight="bold",d.className=CM.Disp.colorTextPre+d,d.textContent=Beautify(CM.Cache.LuckyRewardFrenzy)+(C?` / ${Beautify(CM.Cache.LuckyWrathRewardFrenzy)}`:""),t.appendChild(CM.Disp.CreateStatsListing("withTooltip",'"Lucky!" Reward (MAX) (Frenzy)'+(C?" (Golden / Wrath)":""),d,e));const m=Math.min(.15*(Game.cookies+CM.Disp.GetWrinkConfigBank()),CM.Cache.NoGoldSwitchCookiesPS*CM.Cache.DragonsFortuneMultAdjustment*60*15)+13,M=document.createElement("span");return M.style.fontWeight="bold",M.className=CM.Disp.colorTextPre+M,M.textContent=Beautify(CM.Cache.GoldenCookiesMult*m)+(C?` / ${Beautify(CM.Cache.WrathCookiesMult*m)}`:""),t.appendChild(CM.Disp.CreateStatsListing("withTooltip",'"Lucky!" Reward (CUR)'+(C?" (Golden / Wrath)":""),M,e)),t},CM.Disp.CreateStatsChainSection=function(){const e=Game.auraMult("Dragon's Fortune")?"GoldCookDragonsFortuneTooltipPlaceholder":"GoldCookTooltipPlaceholder",t=document.createElement("div");t.className="CMStatsChainSection";const i=Game.cookies+CM.Disp.GetWrinkConfigBank()<CM.Cache.ChainRequired?CM.Disp.colorRed:CM.Disp.colorGreen,o=Game.cookies+CM.Disp.GetWrinkConfigBank()<CM.Cache.ChainRequired?CM.Disp.FormatTime((CM.Cache.ChainRequired-(Game.cookies+CM.Disp.GetWrinkConfigBank()))/CM.Disp.GetCPS()):"",a=document.createDocumentFragment(),n=document.createElement("span");if(n.style.fontWeight="bold",n.className=CM.Disp.colorTextPre+i,n.textContent=Beautify(CM.Cache.ChainRequired),a.appendChild(n),""!==o){const e=document.createElement("small");e.textContent=` (${o})`,a.appendChild(e)}t.appendChild(CM.Disp.CreateStatsListing("withTooltip",'"Chain" Cookies Required',a,e));const s=Game.cookies+CM.Disp.GetWrinkConfigBank()<CM.Cache.ChainWrathRequired?CM.Disp.colorRed:CM.Disp.colorGreen,r=Game.cookies+CM.Disp.GetWrinkConfigBank()<CM.Cache.ChainWrathRequired?CM.Disp.FormatTime((CM.Cache.ChainWrathRequired-(Game.cookies+CM.Disp.GetWrinkConfigBank()))/CM.Disp.GetCPS()):"",l=document.createDocumentFragment(),p=document.createElement("span");if(p.style.fontWeight="bold",p.className=CM.Disp.colorTextPre+s,p.textContent=Beautify(CM.Cache.ChainWrathRequired),l.appendChild(p),""!==r){const e=document.createElement("small");e.textContent=` (${r})`,l.appendChild(e)}t.appendChild(CM.Disp.CreateStatsListing("withTooltip",'"Chain" Cookies Required (Wrath)',l,e));const C=Game.cookies+CM.Disp.GetWrinkConfigBank()<CM.Cache.ChainFrenzyRequired?CM.Disp.colorRed:CM.Disp.colorGreen,c=Game.cookies+CM.Disp.GetWrinkConfigBank()<CM.Cache.ChainFrenzyRequired?CM.Disp.FormatTime((CM.Cache.ChainFrenzyRequired-(Game.cookies+CM.Disp.GetWrinkConfigBank()))/CM.Disp.GetCPS()):"",d=document.createDocumentFragment(),m=document.createElement("span");if(m.style.fontWeight="bold",m.className=CM.Disp.colorTextPre+C,m.textContent=Beautify(CM.Cache.ChainFrenzyRequired),d.appendChild(m),""!==c){const e=document.createElement("small");e.textContent=` (${c})`,d.appendChild(e)}t.appendChild(CM.Disp.CreateStatsListing("withTooltip",'"Chain" Cookies Required (Frenzy)',d,e));const M=Game.cookies+CM.Disp.GetWrinkConfigBank()<CM.Cache.ChainFrenzyWrathRequired?CM.Disp.colorRed:CM.Disp.colorGreen,u=Game.cookies+CM.Disp.GetWrinkConfigBank()<CM.Cache.ChainFrenzyWrathRequired?CM.Disp.FormatTime((CM.Cache.ChainFrenzyWrathRequired-(Game.cookies+CM.Disp.GetWrinkConfigBank()))/CM.Disp.GetCPS()):"",h=document.createDocumentFragment(),g=document.createElement("span");if(g.style.fontWeight="bold",g.className=CM.Disp.colorTextPre+M,g.textContent=Beautify(CM.Cache.ChainFrenzyWrathRequired),h.appendChild(g),""!==u){const e=document.createElement("small");e.textContent=` (${u})`,h.appendChild(e)}t.appendChild(CM.Disp.CreateStatsListing("withTooltip",'"Chain" Cookies Required (Frenzy) (Wrath)',h,e)),t.appendChild(CM.Disp.CreateStatsListing("withTooltip",'"Chain" Reward (MAX) (Golden / Wrath)',document.createTextNode(`${Beautify(CM.Cache.ChainMaxReward[0])} / ${Beautify(CM.Cache.ChainMaxWrathReward[0])}`),e)),t.appendChild(CM.Disp.CreateStatsListing("withTooltip",'"Chain" Reward (MAX) (Frenzy) (Golden / Wrath)',document.createTextNode(`${Beautify(CM.Cache.ChainFrenzyMaxReward[0])} / ${Beautify(CM.Cache.ChainFrenzyMaxWrathReward[0])}`),e));const D=Math.min(60*Game.cookiesPs*60*6*CM.Cache.DragonsFortuneMultAdjustment,.5*Game.cookies),y=CM.Cache.MaxChainCookieReward(7,D,CM.Cache.GoldenCookiesMult)[0],f=CM.Cache.MaxChainCookieReward(6,D,CM.Cache.WrathCookiesMult)[0];return t.appendChild(CM.Disp.CreateStatsListing("withTooltip",'"Chain" Reward (CUR) (Golden / Wrath)',document.createTextNode(`${Beautify(y)} / ${Beautify(f)}`),e)),t.appendChild(CM.Disp.CreateStatsListing("withTooltip","CPS Needed For Next Level (G / W)",document.createTextNode(`${Beautify(CM.Cache.ChainRequiredNext)} / ${Beautify(CM.Cache.ChainWrathRequiredNext)}`),"ChainNextLevelPlaceholder")),t.appendChild(CM.Disp.CreateStatsListing("withTooltip","CPS Needed For Next Level (Frenzy) (G / W)",document.createTextNode(`${Beautify(CM.Cache.ChainFrenzyRequiredNext)} / ${Beautify(CM.Cache.ChainFrenzyWrathRequiredNext)}`),"ChainNextLevelPlaceholder")),t},CM.Disp.CreateStatsSpellsSection=function(){const e=document.createElement("div");e.className="CMStatsSpellsSection";const t=Game.cookies+CM.Disp.GetWrinkConfigBank()<CM.Cache.Conjure?CM.Disp.colorRed:CM.Disp.colorGreen,i=Game.cookies+CM.Disp.GetWrinkConfigBank()<CM.Cache.Conjure?CM.Disp.FormatTime((CM.Cache.Conjure-(Game.cookies+CM.Disp.GetWrinkConfigBank()))/CM.Disp.GetCPS()):"",o=document.createDocumentFragment(),a=document.createElement("span");if(a.style.fontWeight="bold",a.className=CM.Disp.colorTextPre+t,a.textContent=Beautify(CM.Cache.Conjure),o.appendChild(a),""!==i){const e=document.createElement("small");e.textContent=` (${i})`,o.appendChild(e)}e.appendChild(CM.Disp.CreateStatsListing("withTooltip",'"Conjure Baked Goods" Cookies Required',o,"GoldCookTooltipPlaceholder")),e.appendChild(CM.Disp.CreateStatsListing("withTooltip",'"Conjure Baked Goods" Reward (MAX)',document.createTextNode(CM.Disp.Beautify(CM.Cache.ConjureReward)),"GoldCookTooltipPlaceholder"));const n=Game.cookies+CM.Disp.GetWrinkConfigBank()<7*CM.Cache.Conjure?CM.Disp.colorRed:CM.Disp.colorGreen,s=Math.min(.15*(Game.cookies+CM.Disp.GetWrinkConfigBank()),60*CM.Cache.NoGoldSwitchCookiesPS*30),r=Game.cookies+CM.Disp.GetWrinkConfigBank()<7*CM.Cache.Conjure?CM.Disp.FormatTime((7*CM.Cache.Conjure-(Game.cookies+CM.Disp.GetWrinkConfigBank()))/CM.Disp.GetCPS()):"",l=document.createDocumentFragment(),p=document.createElement("span");if(p.style.fontWeight="bold",p.className=CM.Disp.colorTextPre+n,p.textContent=Beautify(7*CM.Cache.Conjure),l.appendChild(p),""!==r){const e=document.createElement("small");e.textContent=` (${r})`,l.appendChild(e)}return e.appendChild(CM.Disp.CreateStatsListing("withTooltip",'"Conjure Baked Goods" Cookies Required (Frenzy)',l,"GoldCookTooltipPlaceholder")),e.appendChild(CM.Disp.CreateStatsListing("withTooltip",'"Conjure Baked Goods" Reward (MAX) (Frenzy)',document.createTextNode(CM.Disp.Beautify(7*CM.Cache.ConjureReward)),"GoldCookTooltipPlaceholder")),e.appendChild(CM.Disp.CreateStatsListing("withTooltip",'"Conjure Baked Goods" Reward (CUR)',document.createTextNode(CM.Disp.Beautify(s)),"GoldCookTooltipPlaceholder")),CM.Cache.Edifice&&e.appendChild(CM.Disp.CreateStatsListing("withTooltip",'"Spontaneous Edifice" Cookies Required (most expensive building)',document.createTextNode(`${CM.Disp.Beautify(CM.Cache.Edifice)} (${CM.Cache.EdificeBuilding})`),"GoldCookTooltipPlaceholder")),e},CM.Disp.CreateStatsGardenSection=function(){const e=document.createElement("div");e.className="CMStatsGardenSection";const t=Game.cookies<60*Game.cookiesPs*30?CM.Disp.colorRed:CM.Disp.colorGreen,i=document.createElement("span");i.style.fontWeight="bold",i.className=CM.Disp.colorTextPre+t,i.textContent=Beautify(60*Game.cookiesPs*30),e.appendChild(CM.Disp.CreateStatsListing("basic","Cookies required for max reward of Bakeberry: ",i));const o=Game.cookies<60*Game.cookiesPs*3?CM.Disp.colorRed:CM.Disp.colorGreen,a=document.createElement("span");a.style.fontWeight="bold",a.className=CM.Disp.colorTextPre+o,a.textContent=Beautify(60*Game.cookiesPs*3),e.appendChild(CM.Disp.CreateStatsListing("basic","Cookies required for max reward of Chocoroot: ",a));const n=Game.cookies<60*Game.cookiesPs*60?CM.Disp.colorRed:CM.Disp.colorGreen,s=document.createElement("span");s.style.fontWeight="bold",s.className=CM.Disp.colorTextPre+n,s.textContent=Beautify(60*Game.cookiesPs*60),e.appendChild(CM.Disp.CreateStatsListing("basic","Cookies required for max reward of Queenbeet: ",s));const r=Game.cookies<60*Game.cookiesPs*120?CM.Disp.colorRed:CM.Disp.colorGreen,l=document.createElement("span");return l.style.fontWeight="bold",l.className=CM.Disp.colorTextPre+r,l.textContent=Beautify(60*Game.cookiesPs*120),e.appendChild(CM.Disp.CreateStatsListing("basic","Cookies required for max reward of Duketater: ",l)),e},CM.Disp.CreateStatsPrestigeSection=function(){const e=document.createElement("div");e.className="CMStatsPrestigeSection";const t=Math.floor(Game.HowMuchPrestige(CM.Cache.RealCookiesEarned+Game.cookiesReset+CM.Cache.WrinklersTotal+(Game.HasUnlocked("Chocolate egg")&&!Game.Has("Chocolate egg")?CM.Cache.lastChoEgg:0)));e.appendChild(CM.Disp.CreateStatsListing("withTooltip","Prestige Level (CUR / MAX)",document.createTextNode(`${Beautify(Game.prestige)} / ${Beautify(t)}`),"PrestMaxTooltipPlaceholder"));const i=Game.HowManyCookiesReset(t+1)-(CM.Cache.RealCookiesEarned+Game.cookiesReset+CM.Cache.WrinklersTotal+(Game.HasUnlocked("Chocolate egg")&&!Game.Has("Chocolate egg")&&CM.Cache.lastChoEgg?CM.Cache.lastChoEgg:0)),o=document.createDocumentFragment();o.appendChild(document.createTextNode(Beautify(i)));const a=document.createElement("small");a.textContent=` (${CM.Disp.FormatTime(i/CM.Cache.AvgCPSWithChoEgg,1)})`,o.appendChild(a),e.appendChild(CM.Disp.CreateStatsListing("withTooltip","Cookies To Next Level",o,"NextPrestTooltipPlaceholder")),e.appendChild(CM.Disp.CreateStatsListing("withTooltip","Heavenly Chips (CUR / MAX)",document.createTextNode(`${Beautify(Game.heavenlyChips)} / ${Beautify(t-Game.prestige+Game.heavenlyChips)}`),"HeavenChipMaxTooltipPlaceholder")),e.appendChild(CM.Disp.CreateStatsListing("basic","Heavenly Chips Per Second (last 5 seconds)",document.createTextNode(Beautify(CM.Cache.HCPerSecond,2))));const n=Number(CM.Options.HeavenlyChipsTarget);if(!isNaN(n)){const t=n-Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned));t>0&&(e.appendChild(CM.Disp.CreateStatsListing("basic","Heavenly Chips To Target Set In Settings (CUR)",document.createTextNode(Beautify(t)))),e.appendChild(CM.Disp.CreateStatsListing("basic","Time To Target (CUR, Current 5 Second Average)",document.createTextNode(CM.Disp.FormatTime(t/CM.Cache.HCPerSecond)))))}const s=CM.Sim.ResetBonus(t),r=document.createDocumentFragment();r.appendChild(document.createTextNode(Beautify(s)));const l=Math.round(s/Game.cookiesPs*1e4);if(isFinite(l)&&0!==l){const e=document.createElement("small");e.textContent=` (${l/100}% of income)`,r.appendChild(e)}e.appendChild(CM.Disp.CreateStatsListing("withTooltip","Reset Bonus Income",r,"ResetTooltipPlaceholder"));const p=Math.floor(Game.HowMuchPrestige(Game.cookiesReset)),C=Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned)),c=C-p;if(!Game.Has("Lucky digit")){let t=7-C%10;t<0&&(t+=10);const i=c+t,o=C+t,a=document.createDocumentFragment();a.appendChild(document.createTextNode(`${o.toLocaleString()} / ${i.toLocaleString()} (+${t})`)),e.appendChild(CM.Disp.CreateStatsListing("basic",'Next "Lucky Digit" (total / reset)',a))}if(!Game.Has("Lucky number")){let t=777-C%1e3;t<0&&(t+=1e3);const i=c+t,o=C+t,a=document.createDocumentFragment();a.appendChild(document.createTextNode(`${o.toLocaleString()} / ${i.toLocaleString()} (+${t})`)),e.appendChild(CM.Disp.CreateStatsListing("basic",'Next "Lucky Number" (total / reset)',a))}if(!Game.Has("Lucky payout")){let t=777777-C%1e6;t<0&&(t+=1e6);const i=c+t,o=C+t,a=document.createDocumentFragment();a.appendChild(document.createTextNode(`${o.toLocaleString()} / ${i.toLocaleString()} (+${t})`)),e.appendChild(CM.Disp.CreateStatsListing("basic",'Next "Lucky Payout" (total / reset)',a))}return e},CM.Disp.AddMissingUpgrades=function(){for(const e of l("menu").children)if(e.children[0])if("Prestige"===e.children[0].innerHTML&&CM.Cache.MissingUpgradesPrestige){const t=CM.Cache.MissingUpgradesPrestige.match(new RegExp("div","g")||0).length/2,i=document.createElement("div");i.id="CMMissingUpgradesPrestigeTitle",i.className="listing";const o=document.createElement("div");o.innerHTML=`<b>Missing Prestige upgrades:</b> ${t}/${Game.PrestigeUpgrades.length} (${Math.floor(t/Game.PrestigeUpgrades.length*100)}%)`,i.appendChild(o),e.appendChild(i);const a=document.createElement("div");a.className="listing crateBox",a.innerHTML=CM.Cache.MissingUpgradesPrestige,e.appendChild(a)}else if("Upgrades"===e.children[0].innerHTML){if(CM.Cache.MissingUpgrades){const t=CM.Cache.MissingUpgrades.match(new RegExp("div","g")||0).length/2,i=document.createElement("div");i.id="CMMissingUpgradesTitle",i.className="listing";const o=document.createElement("div");o.innerHTML=`<b>Missing normal upgrades:</b> ${t}/${Game.UpgradesByPool[""].length+Game.UpgradesByPool.tech.length} (${Math.floor(t/(Game.UpgradesByPool[""].length+Game.UpgradesByPool.tech.length)*100)}%)`,i.appendChild(o),e.insertBefore(i,e.childNodes[3]);const a=document.createElement("div");a.className="listing crateBox",a.innerHTML=CM.Cache.MissingUpgrades,e.insertBefore(a,document.getElementById("CMMissingUpgradesTitle").nextSibling)}if(CM.Cache.MissingUpgradesCookies){const t=CM.Cache.MissingUpgradesCookies.match(new RegExp("div","g")||0).length/2,i=document.createElement("div");i.id="CMMissingUpgradesCookiesTitle",i.className="listing";const o=document.createElement("div");o.innerHTML=`<b>Missing Cookie upgrades:</b> ${t}/${Game.UpgradesByPool.cookie.length} (${Math.floor(t/Game.UpgradesByPool.cookie.length*100)}%)`,i.appendChild(o),e.appendChild(i);const a=document.createElement("div");a.className="listing crateBox",a.innerHTML=CM.Cache.MissingUpgradesCookies,e.appendChild(a)}}},CM.Disp.crateMissing=function(e){let t="crate upgrade missing";"prestige"===e.pool&&(t+=" heavenly");let i=0;Game.prefs.crates||(i=1),i&&(t+=" noFrame");let o=e.icon;e.iconFunction&&(o=e.iconFunction());const a=`function() {return Game.crateTooltip(Game.UpgradesById[${e.id}], 'stats');}`;return`<div class="${t}"\n\t${Game.getDynamicTooltip(a,"top",!0)}\n\tstyle = "${o[2]?`background-image: url(${o[2]});`:""}background-position:${48*-o[0]}px ${48*-o[1]}px;">\n\t</div>`},CM.Disp.AddMenuInfo=function(e){const t=document.createElement("div");t.className="subsection";const i=document.createElement("span");if(i.style.cursor="pointer",i.style.display="inline-block",i.style.height="14px",i.style.width="14px",i.style.borderRadius="7px",i.style.textAlign="center",i.style.backgroundColor="#C0C0C0",i.style.color="black",i.style.fontSize="13px",i.style.verticalAlign="middle",i.textContent=CM.Options.Header.InfoTab?"-":"+",i.onclick=function(){CM.Config.ToggleHeader("InfoTab"),Game.UpdateMenu()},e.appendChild(i),t.appendChild(e),CM.Options.Header.InfoTab){const e=document.createElement("div");e.innerHTML=CM.Data.ModDescription,t.appendChild(e);const i=document.createElement("div");i.innerHTML=CM.Data.LatestReleaseNotes,t.appendChild(i)}const o=l("menu").children[1];o.insertBefore(t,o.children[1])},CM.Disp.CreateWrinklerButtons=function(){const e=document.createElement("a");e.id="PopAllNormalWrinklerButton",e.textContent="Pop All Normal",e.className="option",e.onclick=function(){CM.Disp.PopAllNormalWrinklers()},l("sectionLeftExtra").children[0].append(e);const t=document.createElement("a");t.id="PopFattestWrinklerButton",t.textContent="Pop Single Fattest",t.className="option",t.onclick=function(){null!==CM.Cache.WrinklersFattest[1]&&(Game.wrinklers[CM.Cache.WrinklersFattest[1]].hp=0)},l("sectionLeftExtra").children[0].append(t)},CM.Disp.UpdateWrinklerButtons=function(){CM.Options.WrinklerButtons?(l("PopAllNormalWrinklerButton").style.display="",l("PopFattestWrinklerButton").style.display=""):(l("PopAllNormalWrinklerButton").style.display="none",l("PopFattestWrinklerButton").style.display="none")},CM.Disp.TooltipText=[["GoldCookTooltipPlaceholder","Calculated with Golden Switch off","200px"],["GoldCookDragonsFortuneTooltipPlaceholder","Calculated with Golden Switch off and at least one golden cookie on-screen","240px"],["PrestMaxTooltipPlaceholder","The MAX prestige is calculated with the cookies gained from popping all wrinklers with Skruuia god in Diamond slot, selling all stock market goods, selling all buildings with Earth Shatterer and Reality Bending auras, and buying Chocolate egg","320px"],["NextPrestTooltipPlaceholder","Calculated with cookies gained from wrinklers and Chocolate egg","200px"],["HeavenChipMaxTooltipPlaceholder","The MAX heavenly chips is calculated with the cookies gained from popping all wrinklers with Skruuia god in Diamond slot, selling all stock market goods, selling all buildings with Earth Shatterer and Reality Bending auras, and buying Chocolate egg","330px"],["ResetTooltipPlaceholder","The bonus income you would get from new prestige levels unlocked at 100% of its potential and from ascension achievements if you have the same buildings/upgrades after reset","370px"],["ChoEggTooltipPlaceholder","The amount of cookies you would get from popping all wrinklers with Skruuia god in Diamond slot, selling all stock market goods, selling all buildings with Earth Shatterer and Reality Bending auras, and then buying Chocolate egg","300px"],["ChainNextLevelPlaceholder","Cheated cookies might break this formula","250px"]],CM.Disp.colorTextPre="CMText",CM.Disp.colorBackPre="CMBack",CM.Disp.colorBorderPre="CMBorder",CM.Disp.colorBlue="Blue",CM.Disp.colorGreen="Green",CM.Disp.colorYellow="Yellow",CM.Disp.colorOrange="Orange",CM.Disp.colorRed="Red",CM.Disp.colorPurple="Purple",CM.Disp.colorGray="Gray",CM.Disp.colorPink="Pink",CM.Disp.colorBrown="Brown",CM.Disp.colors=[CM.Disp.colorGray,CM.Disp.colorBlue,CM.Disp.colorGreen,CM.Disp.colorYellow,CM.Disp.colorOrange,CM.Disp.colorRed,CM.Disp.colorPurple,CM.Disp.colorPink,CM.Disp.colorBrown],CM.Disp.buffColors={Frenzy:CM.Disp.colorYellow,"Dragon Harvest":CM.Disp.colorBrown,"Elder frenzy":CM.Disp.colorGreen,Clot:CM.Disp.colorRed,"Click frenzy":CM.Disp.colorBlue,Dragonflight:CM.Disp.colorPink},CM.Disp.GCTimers={},CM.Disp.cookieTimes=[10,15,30,60,300,600,900,1800],CM.Disp.clickTimes=[1,5,10,15,30],CM.Disp.TooltipWrinklerBeingShown=[],CM.Disp.TooltipWrinklerArea=0,CM.Disp.TooltipWrinkler=-1,CM.Disp.Title="",CM.Disp.LastTargetBotBar=1,CM.Disp.LastTargetBuildings=1,CM.Disp.LastTargetTooltipBuilding=1})();