From 141a7d4d394942353d38a62f5d70539c27abff15 Mon Sep 17 00:00:00 2001 From: "callum.wood" Date: Sun, 24 Oct 2021 02:09:32 +0800 Subject: [PATCH] Add spells tracker (current / next achievement) Modifiy the spellsSection of the statistics page to include a line that tracks the total spells cast, and the number till the next achievement. --- dist/CookieMonster.js | 2 +- dist/CookieMonster.js.map | 2 +- dist/CookieMonsterDev.js | 2 +- dist/CookieMonsterDev.js.map | 2 +- .../Statistics/CreateStatsSections.js | 22 +++++++++++++++++++ 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/dist/CookieMonster.js b/dist/CookieMonster.js index de0e2190..3ff9e4c7 100644 --- a/dist/CookieMonster.js +++ b/dist/CookieMonster.js @@ -1,3 +1,3 @@ /*! For license information please see CookieMonster.js.LICENSE.txt */ -(()=>{var e={877:function(e){!function(t,o){"use strict";"object"!=typeof e.exports?o(t):e.exports=t.document?o(t):function(e){if(!e.document)throw new Error("jscolor needs a window with document");return o(e)}}("undefined"!=typeof window?window:this,(function(e){"use strict";var t,o,a,n,i=(n={initialized:!1,instances:[],readyQueue:[],register:function(){void 0!==e&&e.document&&e.document.addEventListener("DOMContentLoaded",n.pub.init,!1)},installBySelector:function(t,o){if(!(o=o?n.node(o):e.document))throw new Error("Missing root node");for(var a=o.querySelectorAll(t),i=new RegExp("(^|\\s)("+n.pub.lookupClass+")(\\s*(\\{[^}]*\\})|\\s|$)","i"),r=0;r-1},isButtonEmpty:function(e){switch(n.nodeName(e)){case"input":return!e.value||""===e.value.trim();case"button":return""===e.textContent.trim()}return null},isPassiveEventSupported:function(){var t=!1;try{var o=Object.defineProperty({},"passive",{get:function(){t=!0}});e.addEventListener("testPassive",null,o),e.removeEventListener("testPassive",null,o)}catch(e){}return t}(),isColorAttrSupported:(a=e.document.createElement("input"),!(!a.setAttribute||(a.setAttribute("type","color"),"color"!=a.type.toLowerCase()))),dataProp:"_data_jscolor",setData:function(){var e=arguments[0];if(3===arguments.length){var t=e.hasOwnProperty(n.dataProp)?e[n.dataProp]:e[n.dataProp]={},o=arguments[2];return t[i=arguments[1]]=o,!0}if(2===arguments.length&&"object"==typeof arguments[1]){t=e.hasOwnProperty(n.dataProp)?e[n.dataProp]:e[n.dataProp]={};var a=arguments[1];for(var i in a)a.hasOwnProperty(i)&&(t[i]=a[i]);return!0}throw new Error("Invalid arguments")},removeData:function(){var e=arguments[0];if(!e.hasOwnProperty(n.dataProp))return!0;for(var t=1;t=3&&(a=s[0].match(l))&&(n=s[1].match(l))&&(i=s[2].match(l)))return o.format="rgb",o.rgba=[parseFloat(a[1])||0,parseFloat(n[1])||0,parseFloat(i[1])||0,null],s.length>=4&&(r=s[3].match(l))&&(o.format="rgba",o.rgba[3]=parseFloat(r[1])||0),o}return!1},parsePaletteValue:function(e){var t=[];"string"==typeof e?e.replace(/#[0-9A-F]{3}([0-9A-F]{3})?|rgba?\(([^)]*)\)/gi,(function(e){t.push(e)})):Array.isArray(e)&&(t=e);for(var o=[],a=0;al[a]&&-t[a]+e[a]+s[a]/2>l[a]/2&&e[a]+s[a]-d[a]>=0?e[a]+s[a]-d[a]:e[a],-t[i]+e[i]+s[i]+d[i]-m+m*r>l[i]?-t[i]+e[i]+s[i]/2>l[i]/2&&e[i]+s[i]-m-m*r>=0?e[i]+s[i]-m-m*r:e[i]+s[i]-m+m*r:e[i]+s[i]-m+m*r>=0?e[i]+s[i]-m+m*r:e[i]+s[i]-m-m*r];else var p=[e[a],e[i]+s[i]-m+m*r];var u=p[a],h=p[i],g=o.fixed?"fixed":"absolute",f=(p[0]+d[0]>e[0]||p[0]0?Math.ceil(s/o):0,n=Math.max(1,Math.floor((t-(o-1)*e.paletteSpacing)/o)),i=e.paletteHeight?Math.min(e.paletteHeight,n):n),a&&(r=a*i+(a-1)*e.paletteSpacing),{cols:o,rows:a,cellW:n,cellH:i,width:t,height:r}},getControlPadding:function(e){return Math.max(e.padding/2,2*e.pointerBorderWidth+e.pointerThickness-e.controlBorderWidth)},getPadYChannel:function(e){return"v"===e.mode.charAt(1).toLowerCase()?"v":"s"},getSliderChannel:function(e){if(e.mode.length>2)switch(e.mode.charAt(2).toLowerCase()){case"s":return"s";case"v":return"v"}return null},triggerCallback:function(e,t){if(e[t]){var o=null;if("string"==typeof e[t])try{o=new Function(e[t])}catch(e){console.error(e)}else o=e[t];o&&o.call(e)}},triggerGlobal:function(e){for(var t=n.getInstances(),o=0;o0)for(var c=0;c=2&&"string"==typeof arguments[0]){try{if(!i(arguments[0],arguments[1]))return!1}catch(e){return console.warn(e),!1}return this.redraw(),this.exposeColor(),!0}if(1===arguments.length&&"object"==typeof arguments[0]){var e=arguments[0],t=!0;for(var o in e)if(e.hasOwnProperty(o))try{i(o,e[o])||(t=!1)}catch(e){console.warn(e),t=!1}return this.redraw(),this.exposeColor(),t}throw new Error("Invalid arguments")},this.channel=function(e,t){if("string"!=typeof e)throw new Error("Invalid value for channel name: "+e);if(void 0===t)return this.channels.hasOwnProperty(e.toLowerCase())?this.channels[e.toLowerCase()]:(console.warn("Getting unknown channel: "+e),!1);var o=!1;switch(e.toLowerCase()){case"r":o=this.fromRGBA(t,null,null,null);break;case"g":o=this.fromRGBA(null,t,null,null);break;case"b":o=this.fromRGBA(null,null,t,null);break;case"h":o=this.fromHSVA(t,null,null,null);break;case"s":o=this.fromHSVA(null,t,null,null);break;case"v":o=this.fromHSVA(null,null,t,null);break;case"a":o=this.fromHSVA(null,null,null,t);break;default:return console.warn("Setting unknown channel: "+e),!1}return!!o&&(this.redraw(),!0)},this.trigger=function(e){for(var t=n.strList(e),o=0;o127.5},this.hide=function(){m()&&(n.removeClass(a.targetElement,n.pub.activeClassName),n.picker.wrap.parentNode.removeChild(n.picker.wrap),delete n.picker.owner)},this.show=function(){s()},this.redraw=function(){m()&&s()},this.getFormat=function(){return this._currentFormat},this._setFormat=function(e){this._currentFormat=e.toLowerCase()},this.hasAlphaChannel=function(){return"auto"===this.alphaChannel?"any"===this.format.toLowerCase()||n.isAlphaFormat(this.getFormat())||void 0!==this.alpha||void 0!==this.alphaElement:this.alphaChannel},this.processValueInput=function(e){this.fromString(e)||this.exposeColor()},this.processAlphaInput=function(e){this.fromHSVA(null,null,null,parseFloat(e))||this.exposeColor()},this.exposeColor=function(e){var t=this.toString(),o=this.getFormat();if(n.setDataAttr(this.targetElement,"current-color",t),e&n.flags.leaveValue||!this.valueElement||("hex"!==o&&"hexa"!==o||(this.uppercase||(t=t.toLowerCase()),this.hash||(t=t.replace(/^#/,""))),this.setValueElementValue(t)),!(e&n.flags.leaveAlpha)&&this.alphaElement){var a=Math.round(100*this.channels.a)/100;this.setAlphaElementValue(a)}e&n.flags.leavePreview||!this.previewElement||((n.isTextInput(this.previewElement)||n.isButton(this.previewElement)&&!n.isButtonEmpty(this.previewElement))&&this.previewPosition,this.setPreviewElementBg(this.toRGBAString())),m()&&(l(),c(),d())},this.setPreviewElementBg=function(e){if(this.previewElement){var t=null,o=null;(n.isTextInput(this.previewElement)||n.isButton(this.previewElement)&&!n.isButtonEmpty(this.previewElement))&&(t=this.previewPosition,o=this.previewSize);var a=[];if(e){a.push({image:n.genColorPreviewGradient(e,t,o?o-n.pub.previewSeparator.length:null),position:"left top",size:"auto",repeat:t?"repeat-y":"repeat",origin:"padding-box"});var i=n.genColorPreviewCanvas("rgba(0,0,0,0)",t?{left:"right",right:"left"}[t]:null,o,!0);a.push({image:"url('"+i.canvas.toDataURL()+"')",position:(t||"left")+" top",size:i.width+"px "+i.height+"px",repeat:t?"repeat-y":"repeat",origin:"padding-box"})}else a.push({image:"none",position:"left top",size:"auto",repeat:"no-repeat",origin:"padding-box"});for(var r={image:[],position:[],size:[],repeat:[],origin:[]},s=0;s=0;h-=1){var g=u[h];if(g)if(n.pub.presets.hasOwnProperty(g)){for(var p in n.pub.presets[g])if(n.pub.presets[g].hasOwnProperty(p))try{i(p,n.pub.presets[g][p])}catch(e){console.warn(e)}}else console.warn("Unknown preset: %s",g)}var f=["preset"];for(var p in o)if(o.hasOwnProperty(p)&&-1===f.indexOf(p))try{i(p,o[p])}catch(e){console.warn(e)}if(void 0===this.container?this.container=e.document.body:this.container=n.node(this.container),!this.container)throw new Error("Cannot instantiate color picker without a container element");if(this.targetElement=n.node(t),!this.targetElement){if("string"==typeof t&&/^[a-zA-Z][\w:.-]*$/.test(t))throw new Error("If '"+t+"' is supposed to be an ID, please use '#"+t+"' or any valid CSS selector.");throw new Error("Cannot instantiate color picker without a target element")}if(this.targetElement.jscolor&&this.targetElement.jscolor instanceof n.pub)throw new Error("Color picker already installed on this element");if(this.targetElement.jscolor=this,n.addClass(this.targetElement,n.pub.className),n.instances.push(this),n.isButton(this.targetElement)&&("button"!==this.targetElement.type.toLowerCase()&&(this.targetElement.type="button"),n.isButtonEmpty(this.targetElement))){n.removeChildren(this.targetElement),this.targetElement.appendChild(e.document.createTextNode(" "));var k=n.getCompStyle(this.targetElement);(parseFloat(k["min-width"])||0)-1){var b=n.parseColorString(M);this._currentFormat=b?b.format:"hex"}else this._currentFormat=this.format.toLowerCase();this.processValueInput(M),void 0!==y&&this.processAlphaInput(y),this.random&&this.randomize.apply(this,Array.isArray(this.random)?this.random:[])}},n.pub.className="jscolor",n.pub.activeClassName="jscolor-active",n.pub.looseJSON=!0,n.pub.presets={},n.pub.presets.default={},n.pub.presets.light={backgroundColor:"rgba(255,255,255,1)",controlBorderColor:"rgba(187,187,187,1)",buttonColor:"rgba(0,0,0,1)"},n.pub.presets.dark={backgroundColor:"rgba(51,51,51,1)",controlBorderColor:"rgba(153,153,153,1)",buttonColor:"rgba(240,240,240,1)"},n.pub.presets.small={width:101,height:101,padding:10,sliderSize:14,paletteCols:8},n.pub.presets.medium={width:181,height:101,padding:12,sliderSize:16,paletteCols:10},n.pub.presets.large={width:271,height:151,padding:12,sliderSize:24,paletteCols:15},n.pub.presets.thin={borderWidth:1,controlBorderWidth:1,pointerBorderWidth:1},n.pub.presets.thick={borderWidth:2,controlBorderWidth:2,pointerBorderWidth:2},n.pub.sliderInnerSpace=3,n.pub.chessboardSize=8,n.pub.chessboardColor1="#666666",n.pub.chessboardColor2="#999999",n.pub.previewSeparator=["rgba(255,255,255,.65)","rgba(128,128,128,.65)"],n.pub.init=function(){if(!n.initialized)for(e.document.addEventListener("mousedown",n.onDocumentMouseDown,!1),e.document.addEventListener("keyup",n.onDocumentKeyUp,!1),e.addEventListener("resize",n.onWindowResize,!1),e.addEventListener("scroll",n.onWindowScroll,!1),n.pub.install(),n.initialized=!0;n.readyQueue.length;)n.readyQueue.shift()()},n.pub.install=function(e){var t=!0;try{n.installBySelector("[data-jscolor]",e)}catch(e){t=!1,console.warn(e)}if(n.pub.lookupClass)try{n.installBySelector("input."+n.pub.lookupClass+", button."+n.pub.lookupClass,e)}catch(e){}return t},n.pub.ready=function(e){return"function"!=typeof e?(console.warn("Passed value is not a function"),!1):(n.initialized?e():n.readyQueue.push(e),!0)},n.pub.trigger=function(e){var t=function(){n.triggerGlobal(e)};n.initialized?t():n.pub.ready(t)},n.pub.hide=function(){n.picker&&n.picker.owner&&n.picker.owner.hide()},n.pub.chessboard=function(e){return e||(e="rgba(0,0,0,0)"),n.genColorPreviewCanvas(e).canvas.toDataURL()},n.pub.background=function(e){var t=[];t.push(n.genColorPreviewGradient(e));var o=n.genColorPreviewCanvas();return t.push(["url('"+o.canvas.toDataURL()+"')","left top","repeat"].join(" ")),t.join(", ")},n.pub.options={},n.pub.lookupClass="jscolor",n.pub.installByClassName=function(){return console.error('jscolor.installByClassName() is DEPRECATED. Use data-jscolor="" attribute instead of a class name.'+n.docsRef),!1},n.register(),n.pub);return void 0===e.jscolor&&(e.jscolor=e.JSColor=i),i}))}},t={};function o(a){var n=t[a];if(void 0!==n)return n.exports;var i=t[a]={exports:{}};return e[a].call(i.exports,i,i.exports,o),i.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var a in t)o.o(t,a)&&!o.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";class e{constructor(e,t,o){this.defaultValue=e,this.type=t,this.group=o}}function t(e,t){Game.promptWrapL.className="framed",Game.promptL.innerHTML=`${e}
`,Object.keys(t).forEach((e=>{const o=document.createElement("a");o.id=`promptOption${e}`,o.className="option",o.onclick=function(){PlaySound("snd/tick.mp3"),t[e][1]()},o.textContent=t[e][0],Game.promptL.children[1].appendChild(o)})),Game.promptAnchorL.style.display="block",Game.darkenL.style.display="block",Game.promptL.focus(),Game.promptOn=1,Game.UpdatePrompt()}function a(e,t,o,n){(1===Game.mods.cookieMonsterFramework.saveData[e].settings[o]||n)&&3===t&&!1===window.cookieMonsterFrameworkData.isInitializing||1===t?(l("CMFlashScreen").style.backgroundColor=Game.mods.cookieMonsterFramework.saveData[e].settings[`Colour${o}`],l("CMFlashScreen").style.opacity="0.5",3===t?(l("CMFlashScreen").style.display="inline",setTimeout((()=>{a(e,2,o,!0)}),1e3/Game.fps)):setTimeout((()=>{a(e,0,o,!0)}),1e3/Game.fps)):2===t?(l("CMFlashScreen").style.opacity="1",setTimeout((()=>{a(e,1,o,!0)}),1e3/Game.fps)):0===t&&(l("CMFlashScreen").style.display="none")}function n(){Object.keys(Game.mods.cookieMonsterFramework.saveData).forEach((e=>{const t=JSON.stringify(Game.mods.cookieMonsterFramework.saveData[e]),o=b64_to_utf8(unescape(localStorage.getItem("CookieClickerGame")).split("!END!")[0]),a=new RegExp(`${e}.*(;|$)`),n=o.match(a);if(null!==n){const a=o.replace(n[0],`${e}:${t}`);localStorage.setItem("CookieClickerGame",escape(`${utf8_to_b64(a)}!END!`))}}))}function i(e,t){void 0===Game.mods.cookieMonsterFramework.saveData[e].headers[t]&&(Game.mods.cookieMonsterFramework.saveData[e].headers[t]=1),0===Game.mods.cookieMonsterFramework.saveData[e].headers[t]?Game.mods.cookieMonsterFramework.saveData[e].headers[t]=1:Game.mods.cookieMonsterFramework.saveData[e].headers[t]=0,n()}var r=o(877),s=o.n(r);function c(e,t,o,a,n){if((1===Game.mods.cookieMonsterFramework.saveData[e].settings[o]||n)&&!1===window.cookieMonsterFrameworkData.isInitializing){const o=new Audio(t);Game.mods.cookieMonsterFramework.saveData[e].settings.GeneralSound?o.volume=Game.mods.cookieMonsterFramework.saveData[e].settings[a]/100*(Game.volume/100):o.volume=Game.mods.cookieMonsterFramework.saveData[e].settings[a]/100,o.play()}}function d(e,t){null!==l(`slider${e}${t}`)&&(l(`slider${e}${t}right`).innerHTML=`${l(`slider${e}${t}`).value}%`,Game.mods.cookieMonsterFramework.saveData[e].settings[t]=Math.round(l(`slider${e}${t}`).value)),n()}function m(e,t){t.disconnect(),"log"===Game.onMenu?function(){const e=l("menu").children[1];if(e.insertBefore(function(){const e=document.createElement("div");e.className="subsection",e.id="cookieMonsterFrameworkMenuSection";const t=document.createElement("div");t.className="title",t.innerHTML="Cookie Monster Mod Family";const o=document.createElement("span");if(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=Game.mods.cookieMonsterFramework.saveData.cookieMonsterFramework.headers.infoMenu?"-":"+",o.onclick=function(){i("cookieMonsterFramework","infoMenu"),Game.UpdateMenu()},t.appendChild(o),e.appendChild(t),Game.mods.cookieMonsterFramework.saveData.cookieMonsterFramework.headers.infoMenu){const t=document.createElement("div");t.className="listing",t.innerHTML='Cookie Monster Team\noffers a suite of tools to enhance your game experience.
\nOriginally known from our work on the Cookie Monster add-on we are now expanding and working on new tools within the Cookie Monster Mod Family.
\nKeep an eye on our GitHub to see future work or use it to report bugs or feature requests!
\n',e.appendChild(t)}return e}(),e.children[1]),Game.mods.cookieMonsterFramework.saveData.cookieMonsterFramework.headers.infoMenu){const e=Game.mods.cookieMonsterFramework.listeners.infoMenu;for(let t=0;t{void 0===e.settings||void 0===e.settings[o]?n[o]=t[o].defaultValue:n[o]=e.settings[o]})),a.settings=n;const i={};return Object.keys(o).forEach((t=>{void 0===e.headers||void 0===e.headers[t]?i[t]=o[t]:i[t]=e.headers[t]})),a.headers=i,Object.keys(e).forEach((t=>{"settings"!==t&&"headers"!==t&&(a[t]=e[t])})),void 0===a.favouriteSettings&&(a.favouriteSettings=[]),a}(r,o,a),n(),i(),Object.keys(Game.mods.cookieMonsterFramework.saveData[e].settings).forEach((e=>{void 0!==o[e].func&&o[e].func()})),Game.UpdateMenu()}function g(){}const f={};function k(e){h("cookieMonsterFramework",e,f,u,g)}const C={init:function(){window.cookieMonsterFrameworkData={isInitializing:!0},new MutationObserver(m).observe(document.getElementById("menu"),{attributes:!0,childList:!0,subtree:!0}),function(){const e=document.createElement("div");e.id="CMFlashScreen",e.style.width="100%",e.style.height="100%",e.style.backgroundColor="white",e.style.display="none",e.style.zIndex="9999999999",e.style.position="absolute",e.style.pointerEvents="none",l("wrapper").appendChild(e)}(),Game.registerHook("draw",p),void 0===Game.modSaveData.cookieMonsterFramework&&k("{}"),window.cookieMonsterFrameworkData.isInitializing=!1},load:k,save:function(){return JSON.stringify(Game.mods.cookieMonsterFramework.saveData.cookieMonsterFramework)},listeners:{infoMenu:[],optionsMenu:[]},saveData:{cookieMonsterFramework:{headers:{},settings:{}}}},M=function(){"undefined"==typeof cookieMonsterFrameworkData&&Game.registerMod("cookieMonsterFramework",C)},y=function(e){Game.mods.cookieMonsterFramework.saveData[e]={favouriteSettings:[],headers:{},settings:{}}},b={createInfoListing:function(e){const t=document.createElement("div");return t.className="listing",t.innerHTML=e,t},createOptionsListing:function(e,o,i,m,p){const u=document.createElement("div");if(u.className="listing",1===Game.mods.cookieMonsterFramework.saveData[e].settings.FavouriteSettings&&u.appendChild(function(e,t,o){const a=document.createElement("a");return o.includes(t)?(a.innerText="★",a.style.color="yellow"):a.innerText="☆",a.className="option",a.onclick=function(){!function(e,t){Game.mods.cookieMonsterFramework.saveData[e].favouriteSettings.includes(t)?Game.mods.cookieMonsterFramework.saveData[e].favouriteSettings=Game.mods.cookieMonsterFramework.saveData[e].favouriteSettings.filter((e=>e!==t)):Game.mods.cookieMonsterFramework.saveData[e].favouriteSettings.push(t),n()}(e,t),n(),Game.UpdateMenu()},a.onmouseover=function(){Game.tooltip.draw(this,escape('
Click to set this setting as favourite and show it in \'favourite\' settings at the top of the Cookie Monster Settings
'))},a.onmouseout=function(){Game.tooltip.hide()},a.appendChild(document.createTextNode(" ")),a}(e,o,Game.mods.cookieMonsterFramework.saveData[e].favouriteSettings)),"bool"===i[o].type){const t=document.createElement("a");i[o].toggle&&0===Game.mods.cookieMonsterFramework.saveData[e].settings[o]?t.className="option off":t.className="option",t.id=`${e}Options${o}`,t.onclick=function(){!function(e,t,o){Game.mods.cookieMonsterFramework.saveData[e].settings[t]+=1,Game.mods.cookieMonsterFramework.saveData[e].settings[t]===o[t].label.length?(Game.mods.cookieMonsterFramework.saveData[e].settings[t]=0,o[t].toggle&&(l(`${e}Options${t}`).className="option off")):l(`${e}Options${t}`).className="option",void 0!==o[t].func&&o[t].func(),n()}(e,o,i),Game.UpdateMenu()},t.textContent=i[o].label[Game.mods.cookieMonsterFramework.saveData[e].settings[o]],u.appendChild(t);const a=document.createElement("label");return a.textContent=i[o].desc,a.style.lineHeight="1.6",u.appendChild(a),u}if("vol"===i[o].type){const t=document.createElement("div");t.className="sliderBox";const a=document.createElement("div");a.style.float="left",a.innerHTML=i[o].desc,t.appendChild(a);const n=document.createElement("div");n.id=`slider${e}${o}right`,n.style.float="right",n.innerHTML=`${Game.mods.cookieMonsterFramework.saveData[e].settings[o]}%`,t.appendChild(n);const r=document.createElement("input");r.className="slider",r.id=`slider${e}${o}`,r.style.clear="both",r.type="range",r.min="0",r.max="100",r.step="1",r.value=Game.mods.cookieMonsterFramework.saveData[e].settings[o],r.oninput=function(){d(e,o),Game.UpdateMenu()},r.onchange=function(){d(e,o),Game.UpdateMenu()},t.appendChild(r),u.appendChild(t);const s=document.createElement("a");return s.className="option",s.onclick=function(){c(e,Game.mods.cookieMonsterFramework.saveData[e].settings[o.replace("Volume","SoundURL")],o.replace("Volume","Sound"),o,!0)},s.textContent="Test sound",u.appendChild(s),u}if("url"===i[o].type){const a=document.createElement("span");a.className="option",a.textContent=`${i[o].label} `,a.style.lineHeight="1.6",u.appendChild(a);const r=document.createElement("input");r.id=`${e}Options${o}`,r.className="option",r.type="text",r.readOnly=!0,r.value=Game.mods.cookieMonsterFramework.saveData[e].settings[o],r.style.width="300px",u.appendChild(r),u.appendChild(document.createTextNode(" "));const s=document.createElement("input");s.id=`${e}Options${o}Prompt`,s.className="option",s.type="text",s.value=Game.mods.cookieMonsterFramework.saveData[e].settings[o];const c=document.createElement("a");c.className="option",c.onclick=function(){t(s.outerHTML,[["Save",function(){Game.mods.cookieMonsterFramework.saveData[e].settings[o]=l(`${e}Options${o}Prompt`).value,n(),Game.ClosePrompt(),Game.UpdateMenu()}],["Cancel",function(){Game.ClosePrompt()}]])},c.textContent="Edit",u.appendChild(c);const d=document.createElement("label");return d.textContent=i[o].desc,d.style.lineHeight="1.6",u.appendChild(d),u}if("colour"===i[o].type){const t=document.createElement("span");t.className="option";const l=document.createElement("input");l.id=o,l.style.width="65px",l.value=Game.mods.cookieMonsterFramework.saveData[e].settings[o],t.appendChild(l),new r(l,{hash:!0,position:"right",onInput:function(){Game.mods.cookieMonsterFramework.saveData[e].settings[this.targetElement.id]=this.toHEXString(),m(),n(),Game.UpdateMenu()}});const c=document.createElement("label");if(c.textContent=i[o].desc,c.style.lineHeight="1.6",t.appendChild(c),o.includes("Flash")){const n=document.createElement("a");n.className="option",n.onclick=function(){a(e,3,o.replace("Colour",""),!0)},n.textContent="Test flash",t.appendChild(n)}return u.appendChild(t),s().init(),u}if("numscale"===i[o].type){const t=document.createElement("span");t.className="option",t.textContent=`${i[o].label} `,t.style.lineHeight="1.6",u.appendChild(t);const a=document.createElement("input");a.id=`${e}Options${o}`,a.className="option",a.type="number",a.value=Game.mods.cookieMonsterFramework.saveData[e].settings[o],a.min=i[o].min,a.max=i[o].max,a.oninput=function(){Game.mods.cookieMonsterFramework.saveData[e].settings[o]=this.value,n(),p(),Game.UpdateMenu()},u.appendChild(a),u.appendChild(document.createTextNode(" "));const r=document.createElement("label");return r.textContent=i[o].desc,r.style.lineHeight="1.6",u.appendChild(r),u}if("keycode"===i[o].type){const a=document.createElement("input");a.id=`${e}Options${o}Prompt`,a.className="option",a.type="text",a.value=Game.mods.cookieMonsterFramework.saveData[e].settings[o].displayName;const r=document.createElement("a");r.className="option",r.id=`${e}Options${o}`,r.onclick=function(){t(a.outerHTML,[]),l(`${e}Options${o}Prompt`).addEventListener("keyup",(t=>{!function(e,t,o){const a={key:o.key,altKey:o.altKey,ctrlKey:o.ctrlKey,shiftKey:o.shiftKey,displayName:`${o.shiftKey?"Shift + ":""}${o.altKey?"Alt + ":""}${o.ctrlKey?"Ctrl + ":""}${o.key}`};Game.mods.cookieMonsterFramework.saveData[e].settings[t]=a,n()}(e,o,t),Game.ClosePrompt(),Game.UpdateMenu()}))},r.textContent=Game.mods.cookieMonsterFramework.saveData[e].settings[o].displayName,u.appendChild(r);const s=document.createElement("label");return s.textContent=i[o].desc,s.style.lineHeight="1.6",u.appendChild(s),u}return u},createOptionsSubHeader:function(e,t,o){const a=document.createElement("div");a.className="title",a.style.opacity="0.7",a.style.fontSize="17px",a.appendChild(document.createTextNode(`${o} `));const n=document.createElement("span");return n.style.cursor="pointer",n.style.display="inline-block",n.style.height="14px",n.style.width="14px",n.style.borderRadius="7px",n.style.textAlign="center",n.style.backgroundColor="#C0C0C0",n.style.color="black",n.style.fontSize="13px",n.style.verticalAlign="middle",n.textContent=Game.mods.cookieMonsterFramework.saveData[e].headers[t]?"-":"+",n.onclick=function(){i(e,t),Game.UpdateMenu()},a.appendChild(n),a}},G=function(e,t,o){const a=document.createElement("div");a.className="subsection",a.id=`${e}MenuSection`;const n=document.createElement("div");n.className="title",n.style.fontSize="18px",n.innerHTML=t;const r=document.createElement("span");return r.style.cursor="pointer",r.style.display="inline-block",r.style.height="14px",r.style.width="14px",r.style.borderRadius="7px",r.style.textAlign="center",r.style.backgroundColor="#C0C0C0",r.style.color="black",r.style.fontSize="13px",r.style.verticalAlign="middle",r.textContent=Game.mods.cookieMonsterFramework.saveData[e].headers[o]?"-":"+",r.onclick=function(){i(e,o),Game.UpdateMenu()},n.appendChild(r),a.appendChild(n),a},v={createFlash:a,createNotification:function(e,t,o,a){1===Game.mods.cookieMonsterFramework.saveData[e].settings[t]&&"hidden"===document.visibilityState&&!1===window.cookieMonsterFrameworkData.isInitializing&&new Notification(o,{body:a,badge:"https://orteil.dashnet.org/cookieclicker/favicon.ico"})},cookieMonsterPrompt:t,playCMSound:c},w={loadMod:h,saveFramework:n},x=class extends e{constructor(e,t,o,a){super(e,t,o),this.desc=a}},T=class extends e{constructor(e,t,o,a,n,i,r){super(e,t,o),this.label=a,this.desc=n,this.min=i,this.max=r}},S=class extends e{constructor(e,t,o,a,n,i){super(e,t,o),this.label=a,this.desc=n,this.toggle=i}},F=class extends e{constructor(e,t,o,a,n,i,r){super(e,t,o),this.label=a,this.desc=n,this.toggle=i,void 0!==r&&(this.func=r)}},E=class extends e{constructor(e,t,o,a,n){super(e,t,o),this.label=a,this.desc=n;for(let e=0;e<101;e++)this.label[e]=`${e}%`}};function B(){Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerButtons&&Game.elderWrath?(l("PopAllNormalWrinklerButton").style.display="",l("PopFattestWrinklerButton").style.display=""):(l("PopAllNormalWrinklerButton").style.display="none",l("PopFattestWrinklerButton").style.display="none")}const P=["","","M","G","T","P","E","Z","Y"],N=["","","M","B","Tr","Quadr","Quint","Sext","Sept","Oct","Non","Dec","Undec","Duodec","Tredec","Quattuordec","Quindec","Sexdec","Septendec","Octodec","Novemdec","Vigint","Unvigint","Duovigint","Trevigint","Quattuorvigint"],O=["","K","M","B","T","Qa","Qi","Sx","Sp","Oc","No","De","UDe","DDe","TDe","QaDe","QiDe","SxDe","SpDe","ODe","NDe","Vi","UVi","DVi","TVi","QaVi","QiVi","SxVi","SpVi","OVi","NVi","Tr","UTr","DTr","TTr","QaTr","QiTr","SxTr","SpTr","OTr","NTr","Qaa","UQa","DQa","TQa","QaQa","QiQa","SxQa","SpQa","OQa","NQa","Qia","UQi","DQi","TQi","QaQi","QiQi","SxQi","SpQi","OQi","NQi","Sxa","USx","DSx","TSx","QaSx","QiSx","SxSx","SpSx","OSx","NSx","Spa","USp","DSp","TSp","QaSp","QiSp","SxSp","SpSp","OSp","NSp","Oco","UOc","DOc","TOc","QaOc","QiOc","SxOc","SpOc","OOc","NOc","Noa","UNo","DNo","TNo","QaNo","QiNo","SxNo","SpNo","ONo","NNo","Ct","UCt"];let D,L,A,W,j,$,H,U,R,I,z,V,_,X,Q,q,Y=[],K=[],J=[],Z={},ee=Date.now(),te=Date.now();function oe(e,t,o){const a=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ScaleDecimals+1;if(e===1/0)return"Infinity";if(void 0===e)return"0";if(0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Scale)return Z.Beautify(e,t);if(Number.isFinite(e)){if(e<0)return`-${oe(Math.abs(e))}`;let n="";if(0===e)return e.toString();if(e>.001&&e=.01&&e=.01&&e=.01&&e0&&(c+=o,l-=1)}return c}const to="CMText",oo="CMBack",ao="Blue",no="Green",io="Yellow",ro="Orange",so="Red",lo="Purple",co="Gray",mo="Pink",po="Brown",uo=[ao,no,io,ro,so,lo,mo,po,co],ho=[["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"],["FavouriteSettingPlaceholder","Click to set this setting as favourite and show it in 'favourite' settings at the top of the Cookie Monster Settings","250px"]],go={};let fo,ko=0,Co=-1,Mo=[],yo=function(){},bo=1,Go=1,vo=1;const wo=[10,15,30,60,300,600,900,1800],xo=[1,5,10,15,30],To={Frenzy:io,"Dragon Harvest":po,"Elder frenzy":no,Clot:so,"Click frenzy":ao,Dragonflight:mo};let So,Fo,Eo,Bo,Po,No,Oo,Do={},Lo="";function Ao(){let e,t=Game.buyBulk;1===Game.buyMode?Go=t:t=Go,1===t?t=lt:10===t?t=ct:100===t&&(t=dt),l("storeBulk1").style.removeProperty("color"),l("storeBulk10").style.removeProperty("color"),l("storeBulk100").style.removeProperty("color"),1===Game.buyMode?1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BuildColour?(Object.keys(t).forEach((e=>{l(`productPrice${Game.Objects[e].id}`).style.color=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[`Colour${t[e].colour}`]})),l(`storeBulk${Ht}`).style.color=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ColourGreen):Object.keys(Game.Objects).forEach((e=>{l(`productPrice${Game.Objects[e].id}`).style.removeProperty("color")})):-1===Game.buyMode&&Object.keys(lt).forEach((e=>{const t=Game.Objects[e];l(`productPrice${t.id}`).style.color="",l(`productPrice${t.id}`).innerHTML=oe(eo(t,t.basePrice,t.amount,t.free,Game.buyBulk,1))})),1===Game.buyMode&&Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortBuildings?1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortBuildings?(e=Object.keys(lt).map((e=>{const t={};return t.name=e,t.pp=lt[e].pp,t.colour=lt[e].colour,t})),e.sort(((e,t)=>uo.indexOf(e.colour)===uo.indexOf(t.colour)?e.pp-t.pp:uo.indexOf(e.colour)-uo.indexOf(t.colour)))):2===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortBuildings?(e=Object.keys(t).map((e=>{const o={};return o.name=e,o.pp=t[e].pp,o.colour=t[e].colour,o})),e.sort(((e,t)=>uo.indexOf(e.colour)===uo.indexOf(t.colour)?e.pp-t.pp:uo.indexOf(e.colour)-uo.indexOf(t.colour)))):3===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortBuildings&&(e=Object.keys(mt).map((e=>{const t={};return t.name=e,t.id=Game.Objects[e].id,t.amountUntilNext=mt[e].AmountNeeded,t.priceUntilNext=mt[e].price,t})),e.sort(((e,t)=>e.id-t.id)),e.sort(((e,t)=>(101!==e.amountUntilNext?e.priceUntilNext:1/0)-(101!==t.amountUntilNext?t.priceUntilNext:1/0)))):(e=Object.keys(lt).map((e=>{const t={};return t.name=e,t.id=Game.Objects[e].id,t})),e.sort(((e,t)=>e.id-t.id)));for(let t=0;t{Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpgradesNeverCollapse||"products"===e.id?e.style.height="auto":"vaultUpgrades"===e.id?(e.style.height="",e.style.minHeight="0px"):"upgrades"===e.id?(e.style.height="",e.className.includes("hasMenu")?e.style.minHeight="82px":e.style.minHeight="60px"):(e.style.height="",e.style.minHeight="60px")}))}function jo(){if(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpBarColour>0){let e=0,t=0,o=0,a=0,n=0,i=0,r=0;Object.keys(Game.UpgradesInStore).forEach((s=>{const c=Game.UpgradesInStore[s];let d=!1;for(let e=0;euo.indexOf(e.colour)===uo.indexOf(t.colour)?e.pp-t.pp:uo.indexOf(e.colour)-uo.indexOf(t.colour))):e.sort(((e,t)=>e.price-t.price));const t=function(e,t){return e.findIndex((e=>e.name===t.name))};for(let o=0;o7776e5)return t?"Over 9000 days!":">9000d";l+=a>0?a+(t?1===a?" year":" years":"y")+", ":"",(l.length>0||n>0)&&(l+=n+(t?1===n?" day":" days":"d")+", "),(l.length>0||i>0)&&(l+=i+(t?1===i?" hour":" hours":"h")+", "),(l.length>0||r>0)&&(l+=r+(t?1===r?" minute":" minutes":"m")+", "),l+=s+(t?1===s?" second":" seconds":"s")}else if(1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimeFormat){if(o>315576e4)return"XX:XX:XX:XX:XX";l+=(a<10?"0":"")+a+":",l+=(n<10?"0":"")+n+":",l+=(i<10?"0":"")+i+":",l+=(r<10?"0":"")+r+":",l+=(s<10?"0":"")+s}else{if(o>7776e5)return t?"Over 9000 days!":">9000d";a>0?(l+=a+(t?1===a?" year":" years":"y")+", ",l+=n+(t?1===n?" day":" days":"d")):n>0?(l+=n+(t?1===n?" day":" days":"d")+", ",l+=i+(t?1===i?" hour":" hours":"h")):i>0?(l+=i+(t?1===i?" hour":" hours":"h")+", ",l+=r+(t?1===r?" minute":" minutes":"m")):r>0?(l+=r+(t?1===r?" minute":" minutes":"m")+", ",l+=s+(t?1===s?" second":" seconds":"s")):l+=s+(t?1===s?" second":" seconds":"s")}return l}function Ho(e){let t,o;return e<=0?(o=1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimeFormat?"00:00:00:00:00":"Done!",t=no):(o=$o(e),t=e>300?so:e>60?ro:io),{text:o,colour:t}}function Uo(){return Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CPSMode?Me:0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink?Game.cookiesPs*(1-Game.cpsSucked):1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink?Game.cookiesPs*(gt+(1-.05*ft)):null!==ht[1]&&2===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink&&1===Game.wrinklers[ht[1]].type?Game.cookiesPs*(3*gt/ft+(1-.05*ft)):Game.cookiesPs*(gt/ft+(1-.05*ft))}function Ro(){return 1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink?pt:2===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink?ht[0]:0}function Io(e,t,o){const a=document.createElement("div");a.id=e,a.style.height="12px",a.style.margin="0px 10px",a.style.position="relative";const n=document.createElement("div");n.style.width="100%",n.style.height="10px",n.style.margin="auto",n.style.position="absolute",n.style.left="0px",n.style.top="0px",n.style.right="0px",n.style.bottom="0px";const i=document.createElement("span");i.style.display="inline-block",i.style.textAlign="right",i.style.fontSize="10px",i.style.width="108px",i.style.marginRight="5px",i.style.verticalAlign="text-top",i.textContent=t,n.appendChild(i);for(let e=0;e{let o,a=Game.buyBulk;1===Game.buyMode?bo=a:a=bo,1===a&&(a=lt),10===a&&(a=ct),100===a&&(a=dt),e+=1,l("CMBotBar").firstChild.firstChild.childNodes[0].childNodes[e].childNodes[1].textContent=Game.Objects[t].amount,l("CMBotBar").firstChild.firstChild.childNodes[1].childNodes[e].textContent=oe(a[t].bonus,2),l("CMBotBar").firstChild.firstChild.childNodes[2].childNodes[e].className=to+a[t].colour,o=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPDisplayTime?$o(Math.round(a[t].pp)):oe(Math.round(a[t].pp),2),l("CMBotBar").firstChild.firstChild.childNodes[2].childNodes[e].textContent=o;const n=Ho((Game.Objects[t].bulkPrice-(Game.cookies+Ro()))/Uo());l("CMBotBar").firstChild.firstChild.childNodes[3].childNodes[e].className=to+n.colour,"Done!"===n.text&&Game.cookies{!Game.Tiers[e.tieredUpgrades[o].tier].special&&Kt(e.tieredUpgrades[o].name)&&(t*=2)})),Object.keys(e.synergies).forEach((o=>{if(Kt(e.synergies[o].name)){const a=e.synergies[o];a.buildingTie1.name===e.name?t*=1+.05*a.buildingTie2.amount:a.buildingTie2.name===e.name&&(t*=1+.001*a.buildingTie1.amount)}})),e.fortune&&Kt(e.fortune.name)&&(t*=1.07),e.grandma&&Kt(e.grandma.name)&&(t*=1+.01*Vt.Grandma.amount*(1/(e.id-1))),"object"==typeof e.tieredUpgrades.misfortune&&1===e.vanilla&&Kt(e.tieredUpgrades.misfortune.name))switch(Game.elderWrath){default:t*=1;break;case 1:t*=1.02;break;case 2:t*=1.04;break;case 3:t*=1.06}return t}function Jo(e){const t=Game.Objects[e],o={};return"Cursor"===t.name?o.cps=function(e){let t=0;Kt("Thousand fingers")&&(t+=.1),Kt("Million fingers")&&(t*=5),Kt("Billion fingers")&&(t*=10),Kt("Trillion fingers")&&(t*=20),Kt("Quadrillion fingers")&&(t*=20),Kt("Quintillion fingers")&&(t*=20),Kt("Sextillion fingers")&&(t*=20),Kt("Septillion fingers")&&(t*=20),Kt("Octillion fingers")&&(t*=20),Kt("Nonillion fingers")&&(t*=20);let o=1,a=0;return Object.keys(Vt).forEach((e=>{"Cursor"!==Vt[e].name&&(a+=Vt[e].amount)})),t*=a,o*=Ko(e),o*=Game.magicCpS("Cursor"),o*=Yt("cursorCps"),Game.ComputeCps(.1,Kt("Reinforced index finger")+Kt("Carpal tunnel prevention cream")+Kt("Ambidextrous"),t)*o}:"Grandma"===t.name?o.cps=function(e){let o=1;if(Object.keys(Game.GrandmaSynergies).forEach((e=>{Kt(Game.GrandmaSynergies[e])&&(o*=2)})),Kt("Bingo center/Research facility")&&(o*=4),Kt("Ritual rolling pins")&&(o*=2),Kt("Naughty list")&&(o*=2),Kt("Elderwort biscuits")&&(o*=1.02),o*=Yt("grandmaCps"),Kt("Cat ladies"))for(let e=0;e{"Grandma"!==Vt[e].name&&(n+=Vt[e].amount)})),o*=1+.01*Qt("Elder Battalion")*n,o*=Game.magicCpS(t.name),(t.baseCps+a)*o}:o.cps=function(e){let t=1;return t*=Ko(e),t*=Game.magicCpS(e.name),e.baseCPS*t},o.baseCps=t.baseCps,o.name=t.name,o.tieredUpgrades=t.tieredUpgrades,o.synergies=t.synergies,o.fortune=t.fortune,o.grandma=t.grandma,o.baseCPS=t.baseCps,o.id=t.id,o.vanilla=t.vanilla,o}function Zo(e){const t=Game.Upgrades[e],o={};return o.power=t.power,"function"==typeof o.power&&("Sugar crystal cookies"===t.name?o.power=function(){let e=5;return Object.keys(Vt).forEach((t=>{Vt[t].level>=10&&(e+=1)})),e}:o.power=function(){let e=2;if(Kt("Starlove")&&(e=3),Game.hasGod){const t=Jt("seasons");1===t?e*=1.3:2===t?e*=1.2:3===t&&(e*=1.1)}return e}),o.pool=t.pool,o.name=t.name,o}function ea(){xe=Game.UpgradesOwned,Te=Game.pledges,Se=Game.AchievementsOwned,Fe=Game.heavenlyPower,Ee=Game.prestige,Object.keys(Game.Objects).forEach((e=>{const t=Game.Objects[e];let o=Vt[e];void 0===o&&(Vt[e]=Jo(e),o=Vt[e],zo(e)),o.amount=t.amount,o.level=t.level,o.totalCookies=t.totalCookies,o.basePrice=t.basePrice,o.free=t.free,t.minigameLoaded&&("Temple"===t.name&&(Ne=t.minigame.slot[0],Oe=t.minigame.slot[1],De=t.minigame.slot[2]),o.minigameLoaded=t.minigameLoaded,o.minigame=t.minigame),Vt[e]=o})),Object.keys(Game.Upgrades).forEach((e=>{const t=Game.Upgrades[e];let o=_t[e];void 0===o&&(_t[e]=Zo(e),o=_t[e]),o.bought=t.bought,_t[e]=o})),Object.keys(Game.Achievements).forEach((e=>{const t=Game.Achievements[e];let o=Xt[e];void 0===o&&(Xt[e]=Yo(e),o=Xt[e]),o.won=t.won,Xt[e]=o})),qo(),Be=He,Pe=Ue}function ta(e){const t=document.createElement("div");return t.style.fontWeight="bold",t.id=`${e}Title`,t.className="CMTextBlue",t.textContent=e,t}function oa(e){e.appendChild(ta("Bonus Income"));const t=document.createElement("div");t.style.marginBottom="4px",t.style.color="white",t.id="CMTooltipIncome",e.appendChild(t),e.appendChild(ta("Bonus Cookies per Click")),e.lastChild.style.display="none";const o=document.createElement("div");o.style.marginBottom="4px",o.style.color="white",o.style.display="none",o.id="CMTooltipCookiePerClick",e.appendChild(o),e.appendChild(ta("Payback Period"));const a=document.createElement("div");a.style.marginBottom="4px",a.id="CMTooltipPP",e.appendChild(a),e.appendChild(ta("Time Left"));const n=document.createElement("div");if(n.id="CMTooltipTime",e.appendChild(n),"b"===Eo){e.appendChild(ta("Production left till next achievement")),e.lastChild.id="CMTooltipProductionLeftHeader";const t=document.createElement("div");t.id="CMTooltipProductionLeft",e.appendChild(t)}if("b"===Eo){e.appendChild(ta("Buildings (price / PP) left till next achievement")),e.lastChild.id="CMTooltipNextAchievementHeader";const t=document.createElement("div");t.id="CMTooltipNextAchievement",e.appendChild(t)}}function aa(e,t){let o="";return o=e.pp<=0||e.pp===1/0?co:e.pp<$t?ao:e.pp===$t?no:e.pp0&&(o=so),o}function na(){let e=1;return Object.keys(Game.buffs).forEach((t=>{void 0!==Game.buffs[t].multCpS&&(e*=Game.buffs[t].multCpS)})),e}function ia(e){Xt[e]&&0===Xt[e].won&&(Xt[e].won=1,"shadow"!==Game.Achievements[e].pool&&(Se+=1))}function ra(){We=0;let e=1;const t={};Object.keys(Game.Objects).forEach((e=>{if(Game.Objects[e].minigameLoaded&&Game.Objects[e].minigame.effs){const o=Game.Objects[e].minigame.effs;Object.keys(o).forEach((e=>{t[e]?t[e]*=o[e]:t[e]=o[e]}))}})),Ae=t,1!==Game.ascensionMode&&(e+=.01*parseFloat(Ee)*Fe*function(){let e=0;if(Kt("Heavenly chip secret")&&(e+=.05),Kt("Heavenly cookie stand")&&(e+=.2),Kt("Heavenly bakery")&&(e+=.25),Kt("Heavenly confectionery")&&(e+=.25),Kt("Heavenly key")&&(e+=.25),e*=1+.05*Qt("Dragon God"),Kt("Lucky digit")&&(e*=1.01),Kt("Lucky number")&&(e*=1.01),Kt("Lucky payout")&&(e*=1.01),Game.hasGod){const t=Jt("creation");1===t?e*=.7:2===t?e*=.8:3===t&&(e*=.9)}return e}()),e*=Yt("cps"),Kt("Heralds")&&1!==Game.ascensionMode&&(e*=1+.01*Game.heralds),Object.keys(Game.cookieUpgrades).forEach((t=>{const o=Game.cookieUpgrades[t];Kt(o.name)&&("function"==typeof o.power?e*=1+.01*_t[o.name].power(_t[o.name]):e*=1+.01*o.power)})),Kt("Specialized chocolate chips")&&(e*=1.01),Kt("Designer cocoa beans")&&(e*=1.02),Kt("Underworld ovens")&&(e*=1.03),Kt("Exotic nuts")&&(e*=1.04),Kt("Arcane sugar")&&(e*=1.05),Kt("Increased merriness")&&(e*=1.15),Kt("Improved jolliness")&&(e*=1.15),Kt("A lump of coal")&&(e*=1.01),Kt("An itchy sweater")&&(e*=1.01),Kt("Santa's dominion")&&(e*=1.2),Kt("Fortune #100")&&(e*=1.01),Kt("Fortune #101")&&(e*=1.07),Kt("Dragon scale")&&(e*=1.03);let o=1;if(Jt){let t=Jt("asceticism");1===t?e*=1.15:2===t?e*=1.1:3===t&&(e*=1.05),t=Jt("ages"),1===t?e*=1+.15*Math.sin(ee/1e3/10800*Math.PI*2):2===t?e*=1+.15*Math.sin(ee/1e3/43200*Math.PI*2):3===t&&(e*=1+.15*Math.sin(ee/1e3/86400*Math.PI*2)),t=Jt("decadence"),1===t?o*=.93:2===t?o*=.95:3===t&&(o*=.98),t=Jt("industry"),1===t?o*=1.1:2===t?o*=1.06:3===t&&(o*=1.03),t=Jt("labor"),1===t?o*=.97:2===t?o*=.98:3===t&&(o*=.99)}Kt("Santa's legacy")&&(e*=1+.03*(Game.santaLevel+1));const a=Se/25;let n=1;if(Kt("Santa's milk and cookies")&&(n*=1.05),n*=1+.05*Qt("Breath of Milk"),Jt){const e=Jt("mother");1===e?n*=1.1:2===e?n*=1.05:3===e&&(n*=1.03)}n*=Yt("milk");let i=1;Kt("Kitten helpers")&&(i*=1+.1*a*n),Kt("Kitten workers")&&(i*=1+.125*a*n),Kt("Kitten engineers")&&(i*=1+.15*a*n),Kt("Kitten overseers")&&(i*=1+.175*a*n),Kt("Kitten managers")&&(i*=1+.2*a*n),Kt("Kitten accountants")&&(i*=1+.2*a*n),Kt("Kitten specialists")&&(i*=1+.2*a*n),Kt("Kitten experts")&&(i*=1+.2*a*n),Kt("Kitten consultants")&&(i*=1+.2*a*n),Kt("Kitten assistants to the regional manager")&&(i*=1+.175*a*n),Kt("Kitten marketeers")&&(i*=1+.15*a*n),Kt("Kitten analysts")&&(i*=1+.125*a*n),Kt("Kitten executives")&&(i*=1+.115*a*n),Kt("Kitten angels")&&(i*=1+.1*a*n),Kt("Fortune #103")&&(i*=1+.05*a*n),Object.keys(Vt).forEach((e=>{const t=Vt[e];let i=t.cps(t);1!==Game.ascensionMode&&(i*=(1+.01*t.level)*o),"Grandma"===t.name&&Kt("Milkhelp® lactose intolerance relief tablets")&&(i*=1+.05*a*n),We+=t.amount*i})),Kt('"egg"')&&(We+=9),e*=i;let r=1;if(Kt("Chicken egg")&&(r*=1.01),Kt("Duck egg")&&(r*=1.01),Kt("Turkey egg")&&(r*=1.01),Kt("Quail egg")&&(r*=1.01),Kt("Robin egg")&&(r*=1.01),Kt("Ostrich egg")&&(r*=1.01),Kt("Cassowary egg")&&(r*=1.01),Kt("Salmon roe")&&(r*=1.01),Kt("Frogspawn")&&(r*=1.01),Kt("Shark egg")&&(r*=1.01),Kt("Turtle egg")&&(r*=1.01),Kt("Ant larva")&&(r*=1.01),Kt("Century egg")){let e=10*Math.floor((te-Game.startDate)/1e3/10)/60/60/24;e=Math.min(e,100),it=1+.1*(1-(1-e/100)**3),r*=it}e*=r,Kt("Sugar baking")&&(e*=1+.01*Math.min(100,Game.lumps)),e*=1+Qt("Radiant Appetite");const s=We*e;Object.keys(Game.CpsAchievements).forEach((e=>{s>=Game.CpsAchievements[e].threshold&&ia(Game.CpsAchievements[e].name)})),je=s;const{n:l}=Game.shimmerTypes.golden,c=Qt("Dragon's Fortune");for(let t=0;t{Kt(e[o])&&(t+=.1)}))}e*=t}if(Kt("Shimmering veil [off]")){let t=.5;Kt("Reinforced membrane")&&(t+=.1),e*=1+t}Kt("Magic shenanigans")&&(e*=1e3),Kt("Occult obstruction")&&(e*=0),We=Game.runModHookOnValue("cps",We),e*=na(),We*=e}const sa=["Fortune #001","Fortune #002","Fortune #003","Fortune #004","Fortune #005","Fortune #006","Fortune #007","Fortune #008","Fortune #009","Fortune #010","Fortune #011","Fortune #012","Fortune #013","Fortune #014","Fortune #015","Fortune #016","Fortune #017","Fortune #018","Fortune #100","Fortune #101","Fortune #102","Fortune #103","Fortune #104"],la=["Skull cookies","Ghost cookies","Bat cookies","Slime cookies","Pumpkin cookies","Eyeball cookies","Spider cookies"],ca=["Christmas tree biscuits","Snowflake biscuits","Snowman biscuits","Holly biscuits","Candy cane biscuits","Bell biscuits","Present biscuits"],da=["Pure heart biscuits","Ardent heart biscuits","Sour heart biscuits","Weeping heart biscuits","Golden heart biscuits","Eternal heart biscuits","Prism heart biscuits"],ma=["Elderwort biscuits","Bakeberry cookies","Duketater cookies","Green yeast digestives","Wheat slims","Fern tea","Ichor syrup"];function pa(e){return Xt[e]?Xt[e].won:0}function ua(){let e=0;Object.keys(Game.GrandmaSynergies).forEach((t=>{Kt(Game.GrandmaSynergies[t])&&(e+=1)})),!pa("Elder")&&e>=7&&ia("Elder"),!pa("Veteran")&&e>=14&&ia("Veteran");let t=0,o=1,a=1,n=1e5;Object.keys(Vt).forEach((e=>{t+=Vt[e].amount,n=Math.min(Vt[e].amount,n),pa("Mathematician")||Vt[e].amount=1&&ia("One with everything"),1===o&&ia("Mathematician"),1===a&&ia("Base 10"),n>=100&&ia("Centennial"),n>=150&&ia("Centennial and a half"),n>=200&&ia("Bicentennial"),n>=250&&ia("Bicentennial and a half"),n>=300&&ia("Tricentennial"),n>=350&&ia("Tricentennial and a half"),n>=400&&ia("Quadricentennial"),n>=450&&ia("Quadricentennial and a half"),n>=500&&ia("Quincentennial"),n>=550&&ia("Quincentennial and a half"),n>=600&&ia("Sexcentennial"),t>=100&&ia("Builder"),t>=500&&ia("Architect"),t>=1e3&&ia("Engineer"),t>=2e3&&ia("Lord of Constructs"),t>=4e3&&ia("Grand design"),t>=8e3&&ia("Ecumenopolis"),xe>=20&&ia("Enhancer"),xe>=50&&ia("Augmenter"),xe>=100&&ia("Upgrader"),xe>=200&&ia("Lord of Progress"),xe>=300&&ia("The full picture"),xe>=400&&ia("When there's nothing left to add"),t>=4e3&&xe>=300&&ia("Polymath"),t>=8e3&&xe>=400&&ia("Renaissance baker"),Vt.Cursor.amount+Vt.Grandma.amount>=777&&ia("The elder scrolls");let i=!0;Object.keys(la).forEach((e=>{Kt(la[e])||(i=!1)})),i&&ia("Spooky cookies");let r=!0;if(Object.keys(ca).forEach((e=>{Kt(ca[e])||(r=!1)})),r&&ia("Let it snow"),Kt("Fortune cookies")){const e=Game.Tiers.fortune.upgrades;let t=0;Object.keys(e).forEach((o=>{Kt(e[o].name)&&(t+=1)})),t>=e.length&&ia("O Fortuna")}}function ha(e,t){ea(),Vt[e].amount+=t;const o=Vt[e];"Cursor"===e?(o.amount>=1&&ia("Click"),o.amount>=2&&ia("Double-click"),o.amount>=50&&ia("Mouse wheel"),o.amount>=100&&ia("Of Mice and Men"),o.amount>=200&&ia("The Digital"),o.amount>=300&&ia("Extreme polydactyly"),o.amount>=400&&ia("Dr. T"),o.amount>=500&&ia("Thumbs, phalanges, metacarpals"),o.amount>=600&&ia("With her finger and her thumb"),o.amount>=700&&ia("Gotta hand it to you"),o.amount>=800&&ia("The devil's workshop")):Object.keys(Game.Objects[o.name].tieredAchievs).forEach((e=>{o.amount>=Game.Tiers[Game.Objects[o.name].tieredAchievs[e].tier].achievUnlock&&ia(Game.Objects[o.name].tieredAchievs[e].name)}));const a=Se;return ra(),ua(),a!==Se&&ra(),We-Game.cookiesPs}function ga(e,t,o){let a=e,n=0;for(;ae.plantsById[e.plot[Bo[1]][Bo[0]][0]-1].mature,o=e.plantsById[e.plot[Bo[1]][Bo[0]][0]-1].name;l("CMTooltipBorder").appendChild(ta("Reward (Current / Maximum)"));const a=document.createElement("div");a.id="CMTooltipPlantReward",l("CMTooltipBorder").appendChild(a),"Bakeberry"===o?l("CMTooltipPlantReward").textContent=`${t?oe(Math.min(.03*Game.cookies,60*Game.cookiesPs*30)):"0"} / ${oe(60*Game.cookiesPs*30)}`:"Chocoroot"===o||"White chocoroot"===o?l("CMTooltipPlantReward").textContent=`${t?oe(Math.min(.03*Game.cookies,60*Game.cookiesPs*3)):"0"} / ${oe(60*Game.cookiesPs*3)}`:"Queenbeet"===o?l("CMTooltipPlantReward").textContent=`${t?oe(Math.min(.04*Game.cookies,60*Game.cookiesPs*60)):"0"} / ${oe(60*Game.cookiesPs*60)}`:"Duketater"===o?l("CMTooltipPlantReward").textContent=`${t?oe(Math.min(.08*Game.cookies,60*Game.cookiesPs*120)):"0"} / ${oe(60*Game.cookiesPs*120)}`:l("CMTooltipArea").style.display="none"}else l("CMTooltipArea").style.display="none"}():"ha"===Eo?function(){const{minigame:e}=Game.Objects.Farm;if(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipLump){l("CMTooltipBorder").appendChild(ta("Cookies gained from harvesting:"));let t=0,o=0;Game.keys[16]&&Game.keys[17]&&(o=1);for(let a=0;a<6;a++)for(let n=0;n<6;n++)if(e.plot[a][n][0]>=1){const i=e.plot[a][n],r=e.plantsById[i[0]-1],s=r.name;let l=!0;o&&r.immortal&&(l=!1),i[1]0&&e=1?l("CMTimerBarAutosaveBar").textContent=Math.ceil(e):l("CMTimerBarAutosaveBar").textContent="",l("CMTimerBarAutosaveTime").textContent=Math.ceil(e),o+=1}else l("CMTimerBarAutosave").style.display="none";if(0!==Game.shimmerTypes.golden.spawned||Game.Has("Golden switch [off]"))l("CMTimerBarGC").style.display="none";else{l("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`,Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.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`,Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.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="";const t=Math.max(0,(Game.shimmerTypes.golden.time-Game.shimmerTypes.golden.minTime)/(Game.shimmerTypes.golden.maxTime-Game.shimmerTypes.golden.minTime))**5;l("CMTimerBarGCTime").textContent=`${Math.ceil((Game.shimmerTypes.golden.maxTime-Game.shimmerTypes.golden.time)/Game.fps)} ${t<.01?"<":""}${t.toLocaleString("en",{style:"percent"})}`,o+=1}if("christmas"===Game.season&&0===Game.shimmerTypes.reindeer.spawned){l("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`,Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.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`,Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.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="";const t=Math.max(0,(Game.shimmerTypes.reindeer.time-Game.shimmerTypes.reindeer.minTime)/(Game.shimmerTypes.reindeer.maxTime-Game.shimmerTypes.reindeer.minTime))**5;l("CMTimerBarRenTime").textContent=`${Math.ceil((Game.shimmerTypes.reindeer.maxTime-Game.shimmerTypes.reindeer.time)/Game.fps)} ${t<.01?"<":""}${t.toLocaleString("en",{style:"percent"})}`,o+=1}else l("CMTimerBarRen").style.display="none";const a={};l("CMTimerBarBuffTimers").innerHTML="",Object.keys(Game.buffs).forEach((e=>{if(Game.buffs[e]){const n=Io(Game.buffs[e].name,Game.buffs[e].name,[{id:`${Game.buffs[e].name}Bar`}]);n.style.display="";let i="";i=void 0!==To[Game.buffs[e].name]?To[Game.buffs[e].name]:lo,n.lastChild.children[1].className=oo+i,n.lastChild.children[1].style.color="black",2===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarOverlay?n.lastChild.children[1].textContent=`${Math.round(Game.buffs[e].time/Game.buffs[e].maxTime*100)}%`:n.lastChild.children[1].textContent="",n.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`,n.lastChild.children[2].textContent=Math.ceil(Game.buffs[e].time/Game.fps),o+=1,a[Game.buffs[e].name]=n}})),Object.keys(a).forEach((e=>{l("CMTimerBarBuffTimers").appendChild(a[e])})),0!==o&&(l("CMTimerBar").style.height=12*o+2+"px"),Oo!==o&&(Oo=o,Xo())}}(),Vo(),ka(),function(){if(1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipWrink&&1===ko){let e=!1;Object.keys(Game.wrinklers).forEach((t=>{const o=Game.wrinklers[t];if(o.phase>0&&o.selected){if(e=!0,0===Mo[t]||void 0===Mo[t]){const e=document.createElement("div"),o=document.createElement("div");o.style.minWidth="120px",o.style.marginBottom="4px";const a=document.createElement("div");a.style.textAlign="center",a.id="CMTooltipWrinkler",o.appendChild(a),e.appendChild(o),Game.tooltip.draw(this,escape(e.innerHTML)),Co=t,Mo[t]=1}}else Mo[t]=0})),e||Game.tooltip.hide()}}(),function(){if(1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipWrink&&null!==l("CMTooltipWrinkler")){let{sucked:e}=Game.wrinklers[Co],t=1.1;if(Game.Has("Sacrilegious corruption")&&(t*=1.05),1===Game.wrinklers[Co].type&&(t*=3),e*=t,Game.Has("Wrinklerspawn")&&(e*=1.05),Vt.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=oe(e)}}(),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpStats&&"stats"===Game.onMenu&&(Game.drawT-1)%(5*Game.fps)!=0&&(Game.drawT-1)%Game.fps==0&&Game.UpdateMenu(),B(),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Scale&&!Game.OnAscend){let e=l("cookies").innerHTML.replace(/.*(?=
)/i,oe(Game.cookies));Game.prefs.monospace&&(e=`${e}`),l("cookies").innerHTML=e}}function Ma(){ae.addLatest(Game.computedMouseCps)}class ya{constructor(e){this.maxLength=e,this.queue=[]}addLatest(e){this.queue.push(e)>this.maxLength&&this.queue.shift()}calcAverage(e){let t=e;t>this.maxLength&&(t=this.maxLength),t>this.queue.length&&(t=this.queue.length);let o=0;for(let e=this.queue.length-1;e>=0&&e>this.queue.length-1-t;e--)o+=this.queue[e];return 0===o?0:o/t}calcSum(e){let t=e;return t>this.maxLength&&(t=this.maxLength),t>this.queue.length&&(t=this.queue.length),0===t?0:this.queue.slice(-t).reduce(((e,t)=>e+t),0)}}function ba(e){"Cache"in window.CookieMonsterData||(window.CookieMonsterData.Cache={}),Object.keys(e).forEach((t=>{const o=t.replace(/^Cache/,"");void 0===e[t]?window.CookieMonsterData.Cache[o]=void 0:window.CookieMonsterData.Cache[o]=JSON.parse(JSON.stringify(e[t]))}))}function Ga(){const e=Math.floor(Date.now()/1e3);if(Game.T/Game.fps%1==0){let t=Game.cookies+It;Game.cpsSucked>0&&(t+=pt),Dt=Math.max(Game.cookiesEarned,t),t*=.05;const o=e-de,a=Math.max(0,Game.cookies-me)/o,n=Math.max(0,pt-pe)/o,i=Math.max(0,ht[0]-ue)/o,r=Math.max(0,t-st)/o,s=(Game.cookieClicks-he)/o;for(let e=0;e{if(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPRigidelMode&&1===t)e[o].colour=co;else{e[o].colour=aa(e[o],va(o,Game.Objects[o].basePrice,Game.Objects[o].amount,Game.Objects[o].free,t));for(let t=0;t{const a=va(o,Game.Objects[o].basePrice,Game.Objects[o].amount,Game.Objects[o].free,t);Game.cookiesPs?e[o].pp=Math.max(a-(Game.cookies+Ro()),0)/Game.cookiesPs+a/e[o].bonus:e[o].pp=a/e[o].bonus,Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPRigidelMode&&1===t||Ut.push([e[o].pp,t,a])}))}function Ta(){!function(){$t=1/0,Ut=[],void 0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPExcludeTop&&(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPExcludeTop=0),xa(lt,1),xa(ct,10),xa(dt,100),Ut.sort(((e,t)=>e[0]-t[0]));let e=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPExcludeTop;if(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPOnlyConsiderBuyable)for(;Ut[e][2]>Game.cookies&&(e+=1,Ut.length!==e+1););$t=Ut[e][0],Ht=Ut[e][1],wa(lt,1),wa(ct,10),wa(dt,100),ba({CacheMinPP:$t,CacheMinPPBulk:Ht,CachePPArray:Ut})}(),Object.keys(kt).forEach((e=>{Game.cookiesPs?kt[e].pp=Math.max(Game.Upgrades[e].getPrice()-(Game.cookies+Ro()),0)/Game.cookiesPs+Game.Upgrades[e].getPrice()/kt[e].bonus:kt[e].pp=Game.Upgrades[e].getPrice()/kt[e].bonus,Number.isNaN(kt[e].pp)&&(kt[e].pp=1/0),kt[e].colour=aa(kt[e],Game.Upgrades[e].getPrice())})),window.CookieMonsterData.Objects1=JSON.parse(JSON.stringify(lt)),window.CookieMonsterData.Objects10=JSON.parse(JSON.stringify(ct)),window.CookieMonsterData.Objects100=JSON.parse(JSON.stringify(dt)),window.CookieMonsterData.Upgrades=[],Object.entries(kt).forEach((e=>{window.CookieMonsterData.Upgrades[e[0]]=JSON.parse(JSON.stringify(e[1]))}))}function Sa(e){if("toggle"===Game.Upgrades[e].pool||0===Game.Upgrades[e].bought&&Game.Upgrades[e].unlocked&&"prestige"!==Game.Upgrades[e].pool){ea(),"Shimmering veil [on]"===_t[e].name?_t["Shimmering veil [off]"].bought=0:"Golden switch [on]"===_t[e].name?_t["Golden switch [off]"].bought=0:_t[e].bought=(_t[e].bought+1)%2,Game.CountsAsUpgradeOwned(Game.Upgrades[e].pool)&&(xe+=1),"Elder Pledge"===e?(Te+=1,Te>0&&ia("Elder nap"),Te>=5&&ia("Elder slumber")):"Elder Covenant"===e?ia("Elder calm"):"Prism heart biscuits"===e?ia("Lovely cookies"):"Heavenly key"===e&&ia("Wholesome");const t=Se;ra(),ua(),t!==Se&&ra();const o=function(){let e=0;Kt("Thousand fingers")&&(e+=.1),Kt("Million fingers")&&(e*=5),Kt("Billion fingers")&&(e*=10),Kt("Trillion fingers")&&(e*=20),Kt("Quadrillion fingers")&&(e*=20),Kt("Quintillion fingers")&&(e*=20),Kt("Sextillion fingers")&&(e*=20),Kt("Septillion fingers")&&(e*=20),Kt("Octillion fingers")&&(e*=20),Kt("Nonillion fingers")&&(e*=20);let t=0;Object.keys(Vt).forEach((e=>{t+=Vt[e].amount})),t-=Vt.Cursor.amount,e*=t,Kt("Plastic mouse")&&(e+=.01*We),Kt("Iron mouse")&&(e+=.01*We),Kt("Titanium mouse")&&(e+=.01*We),Kt("Adamantium mouse")&&(e+=.01*We),Kt("Unobtainium mouse")&&(e+=.01*We),Kt("Eludium mouse")&&(e+=.01*We),Kt("Wishalloy mouse")&&(e+=.01*We),Kt("Fantasteel mouse")&&(e+=.01*We),Kt("Nevercrack mouse")&&(e+=.01*We),Kt("Armythril mouse")&&(e+=.01*We),Kt("Technobsidian mouse")&&(e+=.01*We),Kt("Plasmarble mouse")&&(e+=.01*We),Kt("Miraculite mouse")&&(e+=.01*We),Kt("Fortune #104")&&(e+=.01*We);let o=1;if(Kt("Santa's helpers")&&(o*=1.1),Kt("Cookie egg")&&(o*=1.1),Kt("Halo gloves")&&(o*=1.1),Kt("Dragon claw")&&(o*=1.03),Kt("Aura gloves")&&(o*=1+.05*Math.min(Game.Objects.Cursor.level,Kt("Luminous gloves")?20:10)),o*=Yt("click"),Vt.Temple.minigameLoaded&&Jt){const e=Jt("labor");1===e?o*=1.15:2===e?o*=1.1:3===e&&(o*=1.05)}Object.keys(Game.buffs).forEach((e=>{void 0!==Game.buffs[e].multClick&&(o*=Game.buffs[e].multClick)})),o*=1+.05*Qt("Dragon Cursor");let a=o*Game.ComputeCps(1,Kt("Reinforced index finger")+Kt("Carpal tunnel prevention cream")+Kt("Ambidextrous"),e);return a=Game.runModHookOnValue("cookiesPerClick",a),Game.hasBuff("Cursed finger")&&(a=Game.buffs["Cursed finger"].power),a}()-Game.computedMouseCps;return o?[We-Game.cookiesPs,o]:[We-Game.cookiesPs]}return[]}function Fa(e){const t={};return Object.keys(Game.Objects).forEach((o=>{t[o]={},t[o].bonus=ha(o,e),1!==e&&(Ge=1)})),t}function Ea(){Object.keys(Game.Objects).forEach((e=>{lt[e].price=va(e,Game.Objects[e].basePrice,Game.Objects[e].amount,Game.Objects[e].free,1),ct[e].price=va(e,Game.Objects[e].basePrice,Game.Objects[e].amount,Game.Objects[e].free,10),dt[e].price=va(e,Game.Objects[e].basePrice,Game.Objects[e].amount,Game.Objects[e].free,100),mt[e].price=va(e,Game.Objects[e].basePrice,Game.Objects[e].amount,Game.Objects[e].free,mt[e].AmountNeeded)})),ba({CacheObjectsNextAchievement:mt})}function Ba(){lt=Fa(1),ct=Fa(10),dt=Fa(100),function(){kt={};for(let e=0;e0?e/=t:e=0,wt=Pa(7,e,ot),Gt=2*wt[1]/ot,vt=wt[2]/60/60/6/tt,St=Pa(6,e,at),xt=2*St[1]/at,Tt=St[2]/60/60/6/tt,Bt=Pa(7,7*e,ot),Ft=2*Bt[1]/ot,Et=Bt[2]/60/60/6/tt,Ot=Pa(6,7*e,at),Pt=2*Ot[1]/at,Nt=Ot[2]/60/60/6/tt,ba({CacheChainMaxReward:wt,CacheChainRequired:Gt,CacheChainRequiredNext:vt,CacheChainWrathMaxReward:St,CacheChainWrathRequired:xt,CacheChainWrathRequiredNext:Tt,CacheChainFrenzyMaxReward:Bt,CacheChainFrenzyRequired:Ft,CacheChainFrenzyRequiredNext:Et,CacheChainFrenzyWrathMaxReward:Ot,CacheChainFrenzyWrathRequired:Pt,CacheChainFrenzyWrathRequiredNext:Nt})}function Oa(){const e=Math.floor(Date.now()/1e3);if(Game.T/Game.fps%1==0){const t=Game.HowMuchPrestige(Game.cookiesReset),o=Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned))-Math.floor(t),a=e-ye,n=Math.max(0,o-be)/a;for(let e=0;e{e.push(Game.Upgrades[t])})),e.sort((function(e,t){return e.order>t.order?1:e.order{const o=e[t];if(0===o.bought){let e="";e+=function(e){let t="crate upgrade missing";"prestige"===e.pool&&(t+=" heavenly");let o=0;Game.prefs.crates||(o=1),o&&(t+=" noFrame");let{icon:a}=e;e.iconFunction&&(a=e.iconFunction());const n=`function() {return Game.crateTooltip(Game.UpgradesById[${e.id}], 'stats');}`;return`
\n\t
`}(o),"prestige"===o.pool?yt+=e:"cookie"===o.pool?bt+=e:"toggle"!==o.pool&&"unused"!==o.pool&&"debug"!==o.pool&&(Mt+=e)}}))}function La(){if("christmas"===Game.season){let e=60*Game.cookiesPs;Game.hasBuff("Elder frenzy")&&(e*=.5),Game.hasBuff("Frenzy")&&(e*=.75),rt=Math.max(25,e),Game.Has("Ho ho ho-flavored frosting")&&(rt*=2)}ba({CacheSeaSpec:rt})}function Aa(){ze=900*et/.15,ze*=tt;const e=na();e>0?ze/=e:ze=0,Ve=ot*(.15*ze)+13,_e=at*(.15*ze)+13,Xe=7*ze,Qe=ot*(.15*Xe)+13,qe=at*(.15*Xe)+13,Ye=2*ze,Ke=.15*Ye,Je=0;let t=0,o=0;Object.keys(Game.Objects).forEach((e=>{Game.Objects[e].amount>t&&(t=Game.Objects[e].amount),Game.Objects[e].amount>0&&(o+=1)})),Object.keys(Game.Objects).forEach((e=>{(Game.Objects[e].amountJe&&(Je=2*Game.Objects[e].price,Ze=e)})),ba({CacheLucky:ze,CacheLuckyReward:Ve,CacheLuckyWrathReward:_e,CacheLuckyFrenzy:Xe,CacheLuckyRewardFrenzy:Qe,CacheLuckyWrathRewardFrenzy:qe,CacheConjure:Ye,CacheConjureReward:Ke,CacheEdifice:Je,CacheEdificeBuilding:Ze})}function Wa(){let e=1,t=1,o=1;Kt("Green yeast digestives")&&(o*=1.01),Kt("Dragon fang")&&(o*=1.03),e*=1+.1*Game.auraMult("Ancestral Metamorphosis"),e*=Game.eff("goldenCookieGain"),t*=1+.1*Game.auraMult("Unholy Dominion"),t*=Game.eff("wrathCookieGain"),ot=o*e,at=o*t,tt=1,0===Game.shimmerTypes.golden.n&&(tt*=1+1.23*Game.auraMult("Dragon's Fortune")),ba({CacheGoldenCookiesMult:ot,CacheWrathCookiesMult:at,CacheDragonsFortuneMultAdjustment:tt})}function ja(e){const t={};Object.keys(Game.Objects).forEach((o=>{if(0!==Object.keys(mt).length&&mt[o].TotalNeeded>Game.Objects[o].amount&&!e)t[o]={AmountNeeded:mt[o].TotalNeeded-Game.Objects[o].amount,TotalNeeded:mt[o].TotalNeeded,price:va(o,Game.Objects[o].basePrice,Game.Objects[o].amount,Game.Objects[o].free,mt[o].TotalNeeded-Game.Objects[o].amount)};else{const e=function(e){const t=Game.AchievementsOwned;let o=100,a=100;for(;o>-1;)if(ha(e,o),Se>t)a=o,o-=10;else{if(100===o)return 101;for(o+=1;o<=a;){if(ha(e,o),Se>t)return o;o+=1}}return 101}(o);t[o]={AmountNeeded:e,TotalNeeded:Game.Objects[o].amount+e,price:va(o,Game.Objects[o].basePrice,Game.Objects[o].amount,Game.Objects[o].free,e)}}})),mt=t,ba({CacheObjectsNextAchievement:mt})}function $a(){pt=0,ut=0,ht=[0,null];for(let e=0;eht[0]&&(ht=[t,e]))}ba({CacheWrinklersTotal:pt,CacheWrinklersNormal:ut,CacheWrinklersFattest:ht})}function Ha(){qo(),$a(),Aa(),Wa(),Na(),Da(),La(),ne=new ya(wo[wo.length-1]),ie=new ya(wo[wo.length-1]),re=new ya(wo[wo.length-1]),se=new ya(wo[wo.length-1]),le=new ya(xo[xo.length-1]),ce=new ya(5),ae=new ya(20*xo[xo.length-1]),Oa(),ja(),Ga(),Ba(),Ea(),Ta()}function Ua(){Object.keys(Game.wrinklers).forEach((e=>{Game.wrinklers[e].sucked>0&&0===Game.wrinklers[e].type&&(Game.wrinklers[e].hp=0)}))}function Ra(e,t){if("b"===e){if(l("tooltip").innerHTML=Game.Objects[t].tooltip(),1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipAmor){const e=va(t,Game.Objects[t].basePrice,0,Game.Objects[t].free,Game.Objects[t].amount),o=e-Game.Objects[t].totalCookies;o>0&&(l("tooltip").innerHTML=l("tooltip").innerHTML.split("so far").join(`so far
${oe(o)} ${1===Math.floor(o)?"cookie":"cookies"} left to amortize (${Ho((e-Game.Objects[t].totalCookies)/(Game.Objects[t].storedTotalCps*Game.globalCpsMult)).text})`))}-1===Game.buyMode&&(l("tooltip").innerHTML=l("tooltip").innerHTML.split(oe(Game.Objects[t].bulkPrice)).join(oe((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)():"wb"===e?l("tooltip").innerHTML="":"pag"===e?l("tooltip").innerHTML=Game.Objects.Temple.minigame.godTooltip(t)():"pas"===e&&(l("tooltip").innerHTML=Game.Objects.Temple.minigame.slotTooltip(t[0])());if("b"===e&&1===Game.buyMode||"u"===e||"s"===e||"g"===e||"p"===e&&!Game.keys[16]||"ha"===e||"wb"===e||"pag"===e||"pas"===e&&-1!==t[1]){const e=document.createElement("div");e.id="CMTooltipArea",l("tooltip").appendChild(e)}return Eo=e,Bo=t,ka(),l("tooltip").innerHTML}function Ia(){1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Favicon&&V>0?At.wrath?l("CMFavicon").href="https://CookieMonsterTeam.github.io/CookieMonster/favicon/wrathCookie.ico":l("CMFavicon").href="https://CookieMonsterTeam.github.io/CookieMonster/favicon/goldenCookie.ico":l("CMFavicon").href="https://orteil.dashnet.org/cookieclicker/favicon.ico"}function za(){Vt=[],Object.keys(Game.Objects).forEach((e=>{Vt[e]=Jo(e)})),_t=[],Object.keys(Game.Upgrades).forEach((e=>{_t[e]=Zo(e)})),Xt=[],Object.keys(Game.Achievements).forEach((e=>{Xt[e]=Yo(e)})),ea()}function Va(){Game.Objects["Wizard tower"].minigameLoaded&&Object.keys(Game.Objects["Wizard tower"].minigame.spellsById).forEach((e=>{null!==l(`grimoireSpell${e}`).onmouseover&&(K[e]=l(`grimoireSpell${e}`).onmouseover,l(`grimoireSpell${e}`).onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>Ra("g",`${e}`)),"this"),Game.tooltip.wobble()})}))}function _a(){if(!H&&Game.Objects["Wizard tower"].minigameLoaded){const{minigame:e}=Game.Objects["Wizard tower"];j=e.draw,Game.Objects["Wizard tower"].minigame.draw=function(){j(),1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GrimoireBar&&e.magic{if(t=a,Game.Objects[t].amount{Le=!0})),Scale:new F(2,"bool","Notation",["Game's setting scale","Metric","Short scale","Short scale (Abbreviated)","Scientific notation","Engineering notation"],"Change how long numbers are formatted",!1,(()=>{Ja()})),ScaleDecimals:new F(2,"bool","Notation",["1 decimals","2 decimals","3 decimals"],'Set the number of decimals used when applicable. This only works with Cookie Monster scales and not with "Game\'s Setting Scale"',!1,(()=>{Ja()})),ScaleSeparator:new F(0,"bool","Notation",[". for decimals (standard)",". for thousands"],"Set the separator used for decimals and thousands",!1,(()=>{Ja()})),ScaleCutoff:new T(999999,"numscale","Notation","Notation cut-off point: ","The number from which Cookie Monster will start formatting numbers based on chosen scale. Standard is 999,999. Setting this above 999,999,999 might break certain notations",1,999999999),TimeFormat:new S(0,"bool","Notation",["Time XXd, XXh, XXm, XXs","Time XX:XX:XX:XX:XX","Time XXx, XXx"],"Change the time format",!1),DetailedTime:new F(1,"bool","Notation",["Detailed time OFF","Detailed time ON"],"Change how time is displayed in certain statistics and tooltips",!0,(()=>{1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.DetailedTime?Game.sayTime=yo:Game.sayTime=Z.sayTime})),PPDisplayTime:new S(0,"bool","Notation",["PP as value (standard)","PP as time unit"],"Display PP as calculated value or as approximate time unit. Note that PP does not translate directly into a time unit and this is therefore only an approximation.",!1),BuildColour:new F(1,"bool","Colours",["Building colours OFF","Building colours ON"],"Colour code buildings",!0,(()=>{Ao()})),PPOnlyConsiderBuyable:new S(0,"bool","Colours",["Don't ignore non-buyable","Ignore non-buyable"],"Makes Cookie Monster label buildings and upgrades you can't buy right now red, useful in those situations where you just want to spend your full bank 'most optimally'",!0),PPExcludeTop:new S(0,"bool","Colours",["Don't ignore any","Ignore 1st best","Ignore 1st and 2nd best","Ignore 1st, 2nd and 3rd best"],"Makes Cookie Monster ignore the 1st, 2nd or 3rd best buildings in labeling and colouring PP values",!0),PPRigidelMode:new S(0,"bool","Colours",["Rigidel mode OFF","Rigidel mode ON"],'Makes Cookie Monster ignore all "buy 1" options when colouring PP in order to stay at a total building count ending in 10 for pantheon god Rigidel',!0),PPSecondsLowerLimit:new T(0,"numscale","Colours","Lower limit for PP (in seconds): ",'If a building or upgrade costs less than the specified seconds of CPS it will also be considered optimal and label it as such ("PP is less than xx seconds of CPS"); setting to 0 ignores this option',0,1/0),ColourBlue:new x("#4bb8f0","colour","Colours","Standard colour is blue. Used to show upgrades better than best PP building, for Click Frenzy bar, and for various labels"),ColourGreen:new x("#00ff00","colour","Colours","Standard colour is green. Used to show best PP building, for Blood Frenzy bar, and for various labels"),ColourYellow:new x("#ffff00","colour","Colours","Standard colour is yellow. Used to show buildings within the top 10 of PP, for Frenzy bar, and for various labels"),ColourOrange:new x("#ff7f00","colour","Colours","Standard colour is orange. Used to show buildings within the top 20 of PP, for Next Reindeer bar, and for various labels"),ColourRed:new x("#ff0000","colour","Colours","Standard colour is Red. Used to show buildings within the top 30 of PP, for Clot bar, and for various labels"),ColourPurple:new x("#ff00ff","colour","Colours","Standard colour is purple. Used to show buildings outside of the top 30 of PP, for Next Cookie bar, and for various labels"),ColourGray:new x("#b3b3b3","colour","Colours","Standard colour is gray. Used to show negative or infinity PP, and for Next Cookie/Next Reindeer bar"),ColourPink:new x("#ff1493","colour","Colours","Standard colour is pink. Used for Dragonflight bar"),ColourBrown:new x("#8b4513","colour","Colours","Standard colour is brown. Used for Dragon Harvest bar"),BotBar:new F(1,"bool","BarsDisplay",["Bottom bar OFF","Bottom bar ON"],"Building information",!0,(()=>{Za()})),TimerBar:new F(1,"bool","BarsDisplay",["Timer bar OFF","Timer bar ON"],"Bar with timers for golden cookie, season popup, Frenzy (Normal, Clot, Elder), Click Frenzy",!0,(()=>{Qo()})),TimerBarPos:new F(0,"bool","BarsDisplay",["Timer bar position (top left)","Timer bar position (bottom)"],"Placement of the timer bar",!1,(()=>{0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarPos?(l("CMTimerBar").style.width="30%",l("CMTimerBar").style.bottom="",l("game").insertBefore(l("CMTimerBar"),l("sectionLeft"))):(l("CMTimerBar").style.width="100%",l("CMTimerBar").style.bottom="0px",l("wrapper").appendChild(l("CMTimerBar"))),Xo()})),TimerBarOverlay:new S(2,"bool","BarsDisplay",["Timer bar overlay OFF","Timer bar overlay only seconds","Timer bar overlay full"],"Overlay on timers displaying seconds and/or percentage left",!0),AutosaveTimerBar:new S(0,"bool","BarsDisplay",["Autosave timer bar OFF","Autosave timer bar ON"],"Show a timer counting down till next autosave in the timer bar",!0),UpBarColour:new F(1,"bool","BarsDisplay",["Upgrade colours/bar OFF","Upgrade colours with bar ON","Upgrade colours without bar ON"],"Colour code upgrades and optionally add a counter bar",!1,(()=>{1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpBarColour?(l("CMUpgradeBar").style.display="",jo()):2===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpBarColour?(l("CMUpgradeBar").style.display="none",jo()):(l("CMUpgradeBar").style.display="none",Game.RebuildUpgrades())})),UpgradeBarFixedPos:new F(1,"bool","BarsDisplay",["Upgrade bar fixed position OFF","Upgrade bar fixed position ON"],"Lock the upgrade bar at top of the screen to prevent it from moving ofscreen when scrolling",!0,(()=>{1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpgradeBarFixedPos?(l("CMUpgradeBar").style.position="sticky",l("CMUpgradeBar").style.top="0px"):l("CMUpgradeBar").style.position=""})),SortBuildings:new F(0,"bool","BarsDisplay",["Sort buildings: default","Sort buildings: PP of x1 purchase","Sort buildings: PP of selected bulk mode","Sort buildings: price until next achievement"],"Sort the display of buildings in default order, by PP, or until next achievement",!1,(()=>{Ao()})),SortUpgrades:new F(0,"bool","BarsDisplay",["Sort upgrades: default","Sort upgrades: PP"],"Sort the display of upgrades in either default order or by PP",!1,(()=>{jo()})),UpgradesNeverCollapse:new F(0,"bool","BarsDisplay",["Upgrades always expanded OFF","Upgrades always expanded ON"],"Toggle to make the upgrades sections always expanded to the size needed to display all upgrades",!0,(()=>{Wo()})),DragonAuraInfo:new S(1,"bool","BarsDisplay",["Extra dragon aura info OFF","Extra dragon aura info ON"],"Shows information about changes in CPS and costs in the dragon aura interface.",!0),GrimoireBar:new S(1,"bool","BarsDisplay",["Grimoire magic meter timer OFF","Grimoire magic meter timer ON"],"A timer overlay showing how long till the Grimoire magic meter is full",!0),GCTimer:new F(1,"bool","BarsDisplay",["Golden cookie timer OFF","Golden cookie timer ON"],"A timer on the golden cookie when it has been spawned",!0,(()=>{1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GCTimer?Object.keys(Do).forEach((e=>{Do[e].style.display="block",Do[e].style.left=Rt[e].l.style.left,Do[e].style.top=Rt[e].l.style.top})):Object.keys(Do).forEach((e=>Do[e].style.display="none"))})),Favicon:new F(1,"bool","BarsDisplay",["Favicon OFF","Favicon ON"],"Update favicon with golden/wrath cookie",!0,(()=>{Ia()})),WrinklerButtons:new F(1,"bool","BarsDisplay",["Extra wrinkler buttons OFF","Extra wrinkler buttons ON"],"Show buttons for popping wrinklers at bottom of cookie section",!0,(()=>{B()})),HideSectionsButtons:new F(0,"bool","BarsDisplay",["Hide buildings/upgrades button OFF","Hide buildings/upgrades button ON"],"Show buttons for hiding and showing the buildings and upgrades sections in the right column",!0,(()=>{Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.HideSectionsButtons?l("CMSectionHidButtons").style.display="":l("CMSectionHidButtons").style.display="none"})),TooltipBuildUpgrade:new S(1,"bool","Tooltip",["Building/upgrade tooltip information OFF","Building/upgrade tooltip information ON"],"Extra information in building/upgrade tooltips",!0),TooltipAmor:new S(0,"bool","Tooltip",["Buildings tooltip amortization information OFF","Buildings tooltip amortization information ON"],"Add amortization information to buildings tooltip",!0),ToolWarnLucky:new S(1,"bool","Tooltip",["Tooltip lucky warning OFF","Tooltip lucky warning ON"],'A warning when buying if it will put the bank under the amount needed for max "Lucky!" rewards',!0),ToolWarnLuckyFrenzy:new S(1,"bool","Tooltip",["Tooltip lucky frenzy warning OFF","Tooltip lucky frenzy warning ON"],'A warning when buying if it will put the bank under the amount needed for max "Lucky!" (Frenzy) rewards',!0),ToolWarnConjure:new S(1,"bool","Tooltip",["Tooltip conjure warning OFF","Tooltip conjure warning ON"],'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards',!0),ToolWarnConjureFrenzy:new S(1,"bool","Tooltip",["Tooltip conjure frenzy warning OFF","Tooltip conjure frenzy warning ON"],'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards with Frenzy active',!0),ToolWarnEdifice:new S(1,"bool","Tooltip",["Tooltip edifice warning OFF","Tooltip edifice warning ON"],'A warning when buying if it will put the bank under the amount needed for "Spontaneous Edifice" to possibly give you your most expensive building',!0),ToolWarnUser:new T(0,"numscale","Tooltip","Tooltip warning at x times CPS: ","Use this to show a customized warning if buying it will put the bank under the amount equal to value times cps; setting to 0 disables the function altogether",0,1/0),ToolWarnBon:new S(1,"bool","Tooltip",["Calculate tooltip warning with bonus CPS OFF","Calculate tooltip warning with bonus CPS ON"],"Calculate the warning with or without the bonus CPS you get from buying",!0),ToolWarnPos:new F(1,"bool","Tooltip",["Tooltip warning position (left)","Tooltip warning position (bottom)"],"Placement of the warning boxes",!1,(()=>{fa()})),TooltipGrim:new S(1,"bool","Tooltip",["Grimoire tooltip information OFF","Grimoire tooltip information ON"],"Extra information in tooltip for grimoire",!0),TooltipWrink:new S(1,"bool","Tooltip",["Wrinkler tooltip OFF","Wrinkler tooltip ON"],"Shows the amount of cookies a wrinkler will give when popping it",!0),TooltipLump:new S(1,"bool","Tooltip",["Sugar lump tooltip OFF","Sugar lump tooltip ON"],"Shows the current Sugar Lump type in Sugar lump tooltip.",!0),TooltipPlots:new S(1,"bool","Tooltip",["Garden plots tooltip OFF","Garden plots tooltip ON"],"Shows a tooltip for plants that have a cookie reward.",!0),TooltipPantheon:new S(1,"bool","Tooltip",["Pantheon tooltip OFF","Pantheon tooltip ON"],"Shows additional info in the pantheon tooltip",!0),TooltipAscendButton:new S(1,"bool","Tooltip",["Show Extra Info Ascend Tooltip OFF","Show Extra Info Ascend Tooltip ON"],"Shows additional info in the ascend tooltip",!0),Stats:new S(1,"bool","Statistics",["Statistics OFF","Statistics ON"],"Extra Cookie Monster statistics!",!0),MissingUpgrades:new S(1,"bool","Statistics",["Missing upgrades OFF","Missing upgrades ON"],"Shows missing upgrades in statistics menu",!0),MissingAchievements:new S(0,"bool","Statistics",["Missing Achievements OFF","Missing Normal Achievements ON"],"Shows missing normal achievements in statistics menu.",!0),UpStats:new S(1,"bool","Statistics",["Statistics update rate (default)","Statistics update rate (1s)"],"Default rate is once every 5 seconds",!1),HeavenlyChipsTarget:new T(1,"numscale","Statistics","Heavenly chips target: ",'Use this to set a heavenly chips target that will be counted towards in the "prestige" statsistics sections',1,1/0),ShowMissedGC:new S(1,"bool","Statistics",["Missed GC OFF","Missed GC ON"],"Show a stat in the statistics screen that counts how many golden cookies you have missed",!0),Title:new S(1,"bool","NotificationGeneral",["Title OFF","Title ON","Title pinned tab highlight"],'Update title with colden cookie/season popup timers; pinned tab highlight only changes the title when a golden cookie/season popup spawns; "!" means that golden cookie/reindeer can spawn',!0),GeneralSound:new S(1,"bool","NotificationGeneral",["Consider game volume setting OFF","Consider game volume setting ON"],'Turning this toggle to "off" makes Cookie Monster no longer consider the volume setting of the base game, allowing mod notifications to play with base game volume turned down',!0),GCNotification:new F(0,"bool","NotificationGC",["Notification OFF","Notification ON"],"Create a notification when golden cookie spawns",!0,(()=>{Ka(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GCNotification)})),GCFlash:new S(1,"bool","NotificationGC",["Flash OFF","Flash ON"],"Flash screen on golden cookie",!0),ColourGCFlash:new x("#ffffff","colour","NotificationGC","The colour of the GC flash, standard colour is white"),GCSound:new S(1,"bool","NotificationGC",["Sound OFF","Sound ON"],"Play a sound on golden cookie",!0),GCVolume:new E(100,"vol","NotificationGC",[],"Volume"),GCSoundURL:new S("https://freesound.org/data/previews/66/66717_931655-lq.mp3","url","NotificationGC","Sound URL:","URL of the sound to be played when a golden cookie spawns"),FortuneNotification:new F(0,"bool","NotificationFC",["Notification OFF","Notification ON"],"Create a notification when fortune cookie is on the ticker",!0,(()=>{Ka(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.FortuneNotification)})),FortuneFlash:new S(1,"bool","NotificationFC",["Flash OFF","Flash ON"],"Flash screen on fortune cookie spawn",!0),ColourFortuneFlash:new x("#ffffff","colour","NotificationFC","The colour of the fortune flash, standard colour is white"),FortuneSound:new S(1,"bool","NotificationFC",["Sound OFF","Sound ON"],"Play a sound on fortune cookie spawn",!0),FortuneVolume:new E(100,"vol","NotificationFC",[],"Volume"),FortuneSoundURL:new S("https://freesound.org/data/previews/174/174027_3242494-lq.mp3","url","NotificationFC","Sound URL:","URL of the sound to be played when the ticker has a fortune cookie"),SeaNotification:new F(0,"bool","NotificationSea",["Notification OFF","Notification ON"],"Create a notification on season popup",!0,(()=>{Ka(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SeaNotification)})),SeaFlash:new S(1,"bool","NotificationSea",["Flash OFF","Flash ON"],"Flash screen on season popup",!0),ColourSeaFlash:new x("#ffffff","colour","NotificationSea","The colour of the season popup flash, standard colour is white"),SeaSound:new S(1,"bool","NotificationSea",["Sound OFF","Sound ON"],"Play a sound on season popup",!0),SeaVolume:new E(100,"vol","NotificationSea",[],"Volume"),SeaSoundURL:new S("https://www.freesound.org/data/previews/121/121099_2193266-lq.mp3","url","NotificationSea","Sound URL:","URL of the sound to be played when on season popup spawns"),GardFlash:new S(1,"bool","NotificationGard",["Garden Tick Flash OFF","Flash ON"],"Flash screen on garden tick",!0),ColourGardFlash:new x("#ffffff","colour","NotificationGard","The colour of the garden flash, standard colour is white"),GardSound:new S(1,"bool","NotificationGard",["Sound OFF","Sound ON"],"Play a sound on garden tick",!0),GardVolume:new E(100,"vol","NotificationGard",[],"Volume"),GardSoundURL:new S("https://freesound.org/data/previews/103/103046_861714-lq.mp3","url","NotificationGard","Garden Tick Sound URL:","URL of the sound to be played when the garden ticks"),MagicNotification:new F(0,"bool","NotificationMagi",["Notification OFF","Notification ON"],"Create a notification when magic reaches maximum",!0,(()=>{Ka(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.MagicNotification)})),MagicFlash:new S(1,"bool","NotificationMagi",["Flash OFF","Flash ON"],"Flash screen when magic reaches maximum",!0),ColourMagicFlash:new x("#ffffff","colour","NotificationMagi","The colour of the magic flash, standard colour is white"),MagicSound:new S(1,"bool","NotificationMagi",["Sound OFF","Sound ON"],"Play a sound when magic reaches maximum",!0),MagicVolume:new E(100,"vol","NotificationMagi",[],"Volume"),MagicSoundURL:new S("https://freesound.org/data/previews/221/221683_1015240-lq.mp3","url","NotificationMagi","Sound URL:","URL of the sound to be played when magic reaches maxium"),WrinklerNotification:new F(0,"bool","NotificationWrink",["Notification OFF","Notification ON"],"Create a notification when a wrinkler appears",!0,(()=>{Ka(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerNotification)})),WrinklerFlash:new S(1,"bool","NotificationWrink",["Flash OFF","Flash ON"],"Flash screen when a wrinkler appears",!0),ColourWrinklerFlash:new x("#ffffff","colour","NotificationWrink","The colour of the wrinkler flash, standard colour is white"),WrinklerSound:new S(1,"bool","NotificationWrink",["Sound OFF","Sound ON"],"Play a sound when a wrinkler appears",!0),WrinklerVolume:new E(100,"vol","NotificationWrink",[],"Volume"),WrinklerSoundURL:new S("https://freesound.org/data/previews/124/124186_8043-lq.mp3","url","NotificationWrink","Sound URL:","URL of the sound to be played when a wrinkler appears"),WrinklerMaxNotification:new F(0,"bool","NotificationWrinkMax",["Notification OFF","Notification ON"],"Create a notification when the maximum amount of wrinklers has appeared",!0,(()=>{Ka(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerMaxNotification)})),WrinklerMaxFlash:new S(1,"bool","NotificationWrinkMax",["Flash OFF","Flash ON"],"Flash screen when the maximum amount of Wrinklers has appeared",!0),ColourWrinklerMaxFlash:new x("#ffffff","colour","NotificationWrinkMax","The colour of the maximum wrinkler flash, standard colour is white"),WrinklerMaxSound:new S(1,"bool","NotificationWrinkMax",["Sound OFF","Sound ON"],"Play a sound when the maximum amount of wrinklers has appeared",!0),WrinklerMaxVolume:new E(100,"vol","NotificationWrinkMax",[],"Volume"),WrinklerMaxSoundURL:new S("https://freesound.org/data/previews/152/152743_15663-lq.mp3","url","NotificationWrinkMax","Sound URL:","URL of the sound to be played when the maximum amount of wrinklers has appeared"),BulkBuyBlock:new S(1,"bool","Miscellaneous",["Block bulk buying OFF","Block bulk buying ON"],"Block clicking bulk buying when you can't buy all. This prevents buying 7 of a building when you are in buy-10 or buy-100 mode.",!0),FavouriteSettings:new F(1,"bool","Miscellaneous",["Favourite settings section OFF","Favourite settings section ON","Favourite settings section ON (Locked)"],"Show stars before each setting which allows selecting it for a 'favourites' section at the top of the Cookie Monster settings. Setting this to Locked removes the stars but shows the 'favourites' section",!0,(()=>{Game.UpdateMenu()}))};function tn(){let e="";for(let t=0;t{if("Favourite"===t){if(0!==Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.favouriteSettings.length&&Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.FavouriteSettings>0&&(e.appendChild(b.createOptionsSubHeader("cookieMonsterMod",t,qa[t])),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[t]))for(let t=0;t{const o=b.createOptionsSubHeader("cookieMonsterMod",t,Ya[t]);o.style.fontSize="15px",o.style.opacity="0.5",e.appendChild(o),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[t]&&Object.keys(en).forEach((o=>{en[o].group===t&&e.appendChild(b.createOptionsListing("cookieMonsterMod",o,en,tn,Ja))}))})):Object.keys(en).forEach((o=>{en[o].group===t&&e.appendChild(b.createOptionsListing("cookieMonsterMod",o,en,tn,Ja))})))})),e}function an(e,t){const o=document.createElement("div");o.className="title",o.style.padding="0px 16px",o.style.opacity="0.7",o.style.fontSize="17px",o.style.fontFamily='"Kavoon", Georgia, serif',o.appendChild(document.createTextNode(`${e} `));const a=document.createElement("span");return a.style.cursor="pointer",a.style.display="inline-block",a.style.height="14px",a.style.width="14px",a.style.borderRadius="7px",a.style.textAlign="center",a.style.backgroundColor="#C0C0C0",a.style.color="black",a.style.fontSize="13px",a.style.verticalAlign="middle",a.textContent=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[t]?"-":"+",a.onclick=function(){!function(e){Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[e]+=1,Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[e]>1&&(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[e]=0),w.saveFramework()}(t),Game.UpdateMenu()},o.appendChild(a),o}function nn(e,t,o,a){const n=document.createElement("div");n.className="listing";const i=document.createElement("b");if(i.textContent=t,n.appendChild(i),"withTooltip"===e){n.className="listing",n.appendChild(document.createTextNode(" "));const e=document.createElement("span");e.onmouseout=function(){Game.tooltip.hide()},e.onmouseover=function(){Game.tooltip.draw(this,escape(go[a].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="?",n.appendChild(e)}return n.appendChild(document.createTextNode(": ")),n.appendChild(o),n}function rn(e,t,o,a){const n=document.createElement("div");n.className="listing";const i=document.createElement("b");return i.textContent=t,!0===a&&(i.style.color=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ColourGreen),n.appendChild(i),n.appendChild(document.createTextNode(": ")),n.appendChild(o),n}function sn(e){const t=document.createDocumentFragment();t.appendChild(document.createTextNode(`${e.length} `));const o=document.createElement("span");o.onmouseout=function(){Game.tooltip.hide()};const a=document.createElement("div"),n=document.createElement("div");n.style.minWidth="140px",n.style.marginBottom="4px";const i=document.createElement("div");return i.className="name",i.style.marginBottom="4px",i.style.textAlign="center",i.textContent="Missing",n.appendChild(i),Object.keys(e).forEach((t=>{const o=document.createElement("div");o.style.textAlign="center",o.appendChild(document.createTextNode(e[t])),n.appendChild(o)})),a.appendChild(n),o.onmouseover=function(){Game.tooltip.draw(this,escape(a.innerHTML))},o.style.cursor="default",o.style.display="inline-block",o.style.height="10px",o.style.width="10px",o.style.borderRadius="5px",o.style.textAlign="center",o.style.backgroundColor="#C0C0C0",o.style.color="black",o.style.fontSize="9px",o.style.verticalAlign="bottom",o.textContent="?",t.appendChild(o),t}function ln(e){const t=document.createElement("div");if(t.className="subsection",t.appendChild(e),t.appendChild(an("Lucky Cookies","Lucky")),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Lucky&&t.appendChild(function(){const e=Game.auraMult("Dragon's Fortune")?"GoldCookDragonsFortuneTooltipPlaceholder":"GoldCookTooltipPlaceholder",t=document.createElement("div");t.className="CMStatsLuckySection";const o=Game.cookies+Ro(){Game.HasUnlocked(ma[e])||c.push(ma[e])})),0!==c.length&&e.appendChild(nn("basic","Rare plant drops left to unlock",sn(c))),e}())),t.appendChild(an("Prestige","Prestige")),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Prestige&&t.appendChild(function(){const e=document.createElement("div");e.className="CMStatsPrestigeSection";const t=Math.floor(Game.HowMuchPrestige(Dt+Game.cookiesReset+pt+(Game.HasUnlocked("Chocolate egg")&&!Game.Has("Chocolate egg")?st:0)));e.appendChild(nn("withTooltip","Prestige level (cur / max)",document.createTextNode(`${oe(Game.prestige)} / ${oe(t)}`),"PrestMaxTooltipPlaceholder"));const o=Math.max(0,Game.HowManyCookiesReset(t+1)-(Dt+Game.cookiesReset+pt+(Game.HasUnlocked("Chocolate egg")&&!Game.Has("Chocolate egg")&&st?st:0))),a=document.createDocumentFragment();a.appendChild(document.createTextNode(oe(o)));const n=document.createElement("small");n.textContent=` (${$o(o/Lt,1)})`,a.appendChild(n),e.appendChild(nn("withTooltip","Cookies to next level",a,"NextPrestTooltipPlaceholder")),e.appendChild(nn("withTooltip","Heavenly chips (cur / max)",document.createTextNode(`${oe(Game.heavenlyChips)} / ${oe(t-Game.prestige+Game.heavenlyChips)}`),"HeavenChipMaxTooltipPlaceholder")),e.appendChild(nn("basic","Heavenly chips per second (last 5 seconds)",document.createTextNode(oe(nt,2))));const i=Number(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.HeavenlyChipsTarget);if(!Number.isNaN(i)){const t=i-Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned));t>0&&(e.appendChild(nn("basic","Heavenly chips to target set in settings (cur)",document.createTextNode(oe(t)))),e.appendChild(nn("basic","Time till target (cur, current 5 second average)",document.createTextNode($o(t/nt)))))}const r=function(e){let t=Game.cookiesPs;ea(),0===_t["Heavenly key"].bought&&(_t["Heavenly chip secret"].bought=1,_t["Heavenly cookie stand"].bought=1,_t["Heavenly bakery"].bought=1,_t["Heavenly confectionery"].bought=1,_t["Heavenly key"].bought=1,ra(),t=We,ea()),Dt>=1e6&&ia("Sacrifice"),Dt>=1e9&&ia("Oblivion"),Dt>=1e12&&ia("From scratch"),Dt>=1e15&&ia("Nihilism"),Dt>=1e18&&ia("Dematerialize"),Dt>=1e21&&ia("Nil zero zilch"),Dt>=1e24&&ia("Transcendence"),Dt>=1e27&&ia("Obliterate"),Dt>=1e30&&ia("Negative void"),Dt>=1e33&&ia("To crumbs, you say?"),Dt>=1e36&&ia("You get nothing"),Dt>=1e39&&ia("Humble rebeginnings"),Dt>=1e42&&ia("The end of the world"),Dt>=1e45&&ia("Oh, you're back"),Dt>=1e48&&ia("Lazarus"),Dt>=1e51&&ia("Smurf account"),Dt>=1e54&&ia("If at first you don't succeed"),_t["Heavenly chip secret"].bought=1,_t["Heavenly cookie stand"].bought=1,_t["Heavenly bakery"].bought=1,_t["Heavenly confectionery"].bought=1,_t["Heavenly key"].bought=1,Ee=e;const o=Se;ra(),ua(),o!==Se&&ra();const a=We-t;return Ee=Game.prestige,a}(t),s=document.createDocumentFragment();s.appendChild(document.createTextNode(oe(r)));const l=Math.round(r/Game.cookiesPs*1e4);if(Number.isFinite(l)&&0!==l){const e=document.createElement("small");e.textContent=` (${l/100}% of income)`,s.appendChild(e)}e.appendChild(nn("withTooltip","Reset bonus income",s,"ResetTooltipPlaceholder"));const c=Math.floor(Game.HowMuchPrestige(Game.cookiesReset)),d=Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned)),m=d-c;if(!Game.Has("Lucky digit")){let t=7-d%10;t<0&&(t+=10);const o=m+t,a=d+t,n=document.createDocumentFragment();n.appendChild(document.createTextNode(`${a.toLocaleString()} / ${o.toLocaleString()} (+${t})`)),e.appendChild(nn("basic",'Next "Lucky Digit" (total / reset)',n))}if(!Game.Has("Lucky number")){let t=777-d%1e3;t<0&&(t+=1e3);const o=m+t,a=d+t,n=document.createDocumentFragment();n.appendChild(document.createTextNode(`${a.toLocaleString()} / ${o.toLocaleString()} (+${t})`)),e.appendChild(nn("basic",'Next "Lucky Number" (total / reset)',n))}if(!Game.Has("Lucky payout")){let t=777777-d%1e6;t<0&&(t+=1e6);const o=m+t,a=d+t,n=document.createDocumentFragment();n.appendChild(document.createTextNode(`${a.toLocaleString()} / ${o.toLocaleString()} (+${t})`)),e.appendChild(nn("basic",'Next "Lucky Payout" (total / reset)',n))}return e}()),Game.cpsSucked>0&&(t.appendChild(an("Wrinklers","Wrink")),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Wrink)){const e=document.createDocumentFragment();e.appendChild(document.createTextNode(`${oe(pt)} / ${oe(ut)} `));const o=document.createElement("a");o.textContent="Pop All Normal",o.className="option",o.onclick=function(){Ua()},e.appendChild(o),t.appendChild(nn("basic","Rewards of Popping (All/Normal)",e));const a=document.createDocumentFragment();a.appendChild(document.createTextNode(`${oe(ht[0])} `));const n=document.createElement("a");n.textContent="Pop Single Fattest",n.className="option",n.onclick=function(){null!==ht[1]&&(Game.wrinklers[ht[1]].hp=0)},a.appendChild(n),t.appendChild(nn("basic",`Rewards of Popping Single Fattest Non-Shiny Wrinkler (id: ${null!==ht[1]?ht[1]:"None"})`,a))}if(t.appendChild(function(){const e=document.createElement("div");e.className="CMStatsSeasonSection";let t=!1;const o=[];Object.keys(la).forEach((e=>{Game.Has(la[e])||(o.push(la[e]),t=!0)}));const a=[];Object.keys(ca).forEach((e=>{Game.Has(ca[e])||(a.push(ca[e]),t=!0)}));const n=[];Object.keys(da).forEach((e=>{Game.Has(da[e])||(n.push(da[e]),t=!0)}));const i=[];Object.keys(Game.eggDrops).forEach((e=>{Game.HasUnlocked(Game.eggDrops[e])||(i.push(Game.eggDrops[e]),t=!0)}));const r=[];Object.keys(Game.rareEggDrops).forEach((e=>{Game.HasUnlocked(Game.rareEggDrops[e])||(r.push(Game.rareEggDrops[e]),t=!0)}));const s=Game.HasUnlocked("Chocolate egg")&&!Game.Has("Chocolate egg"),l=Game.Has("Century egg");if(("christmas"===Game.season||t||s||l)&&(e.appendChild(an("Season Specials","Sea")),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Sea)){if(0!==o.length){e.appendChild(rn(0,"Halloween cookies left to buy",sn(o),"halloween"===Game.season));let t=.95;if(Game.HasAchiev("Spooky cookies")&&(t=.8),Game.Has("Starterror")&&(t*=.9),t*=1/Game.dropRateMult(),Game.hasGod){const e=Game.hasGod("seasons");1===e?t*=.9:2===e?t*=.95:3===e&&(t*=.97)}const a=o.length/7;e.appendChild(rn(0,"Chance of receiving a cookie from wrinkler/shiny wrinkler",document.createTextNode(`${oe((1-t)*a*100)}% / ${oe((1-.9*t)*a*100)}%`),"halloween"===Game.season))}if(0!==a.length){e.appendChild(rn(0,"Christmas cookies left to buy",sn(a),"christmas"===Game.season));let t=.8;if(Game.HasAchiev("Let it snow")&&(t=.6),t*=1/Game.dropRateMult(),Game.Has("Starsnow")&&(t*=.95),Game.hasGod){const e=Game.hasGod("seasons");1===e?t*=.9:2===e?t*=.95:3===e&&(t*=.97)}const o=a.length/7;e.appendChild(rn(0,"Chance of receiving a cookie from reindeer",document.createTextNode(`${oe((1-t)*o*100)}%`),"christmas"===Game.season))}0!==n.length&&e.appendChild(rn(0,"Valentine cookies left to buy",sn(n),"valentines"===Game.season));const t=function(e){let t=e*(1/Game.dropRateMult());if(Game.HasAchiev("Hide & seek champion")&&(t*=.7),Game.Has("Omelette")&&(t*=.9),Game.Has("Starspawn")&&(t*=.9),Game.hasGod){const e=Game.hasGod("seasons");1===e?t*=.9:2===e?t*=.95:3===e&&(t*=.97)}const o=1-t,a=Game.eggDrops.length-i.length,n=Game.rareEggDrops.length-r.length,s=.9*o*(1-a/Game.eggDrops.length),l=.1*o*(1-n/Game.rareEggDrops.length),c=.9*o*(a/Game.eggDrops.length)+.1*o*(n/Game.rareEggDrops.length);return[s+.9*c*(1-a/Game.eggDrops.length),l+.1*c*(1-n/Game.rareEggDrops.length)]};0!==i.length&&(e.appendChild(rn(0,"Normal easter eggs left to unlock",sn(i),"easter"===Game.season)),e.appendChild(rn(0,"Chance of receiving an egg from wrinkler/golden cookie",document.createTextNode(`${oe(100*t(.98)[0])}% / ${oe(100*t(.9)[0])}%`),"easter"===Game.season))),0!==r.length&&(e.appendChild(rn(0,"Rare easter eggs left to unlock",sn(r),"easter"===Game.season)),e.appendChild(rn(0,"Chance of receiving a rare egg from wrinkler/golden cookie",document.createTextNode(`${oe(100*t(.98)[1])}% / ${oe(100*t(.9)[1])}%`),"easter"===Game.season))),"christmas"===Game.season&&e.appendChild(rn(0,"Reindeer reward",document.createTextNode(oe(rt)),!0)),s&&e.appendChild(nn("withTooltip","Chocolate egg cookies",document.createTextNode(oe(st)),"ChoEggTooltipPlaceholder")),l&&e.appendChild(nn("basic","Century egg multiplier",document.createTextNode(Math.round(1e4*(it-1))/100+"%")))}return e}()),t.appendChild(an("Achievements","Achievs")),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Achievs&&Object.keys(Game.Objects).forEach((e=>{const o=mt[e];t.appendChild(nn("basic",e,o.AmountNeeded<101?document.createTextNode(`Next achievement in ${o.AmountNeeded}, price: ${oe(o.price)}`):document.createTextNode("No new achievement for next 100 buildings")))})),t.appendChild(an("Miscellaneous","Misc")),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Misc){if(t.appendChild(nn("basic",`Average cookies per second (past ${wo[Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgCPSHist]<60?`${wo[Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgCPSHist]} seconds`:wo[Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgCPSHist]/60+(3===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgCPSHist?" minute":" minutes")})`,document.createTextNode(oe(Uo(),3)))),t.appendChild(nn("basic",`Average cookie clicks per second (past ${xo[Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgClicksHist]}${0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgClicksHist?" second":" seconds"})`,document.createTextNode(oe(Ct,1)))),t.appendChild(nn("basic",`Cookies from clicking (past ${xo[Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgClicksHist]}${0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgClicksHist?" second":" seconds"})`,document.createTextNode(oe(ae.calcSum(Ct*xo[Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgClicksHist]))))),Game.Has("Fortune cookies")){const e=[];Object.keys(sa).forEach((t=>{Game.Has(sa[t])||e.push(sa[t])})),0!==e.length&&t.appendChild(nn("basic","Fortune Upgrades Left to Buy",sn(e)))}if(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ShowMissedGC&&t.appendChild(nn("basic","Missed golden cookies",document.createTextNode(oe(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(nn("basic","Time till autosave",e))}}l("menu").insertBefore(t,l("menu").childNodes[2]),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.MissingUpgrades&&l("menu").childNodes.forEach((e=>{if(e.children[0])if("Prestige"===e.children[0].innerHTML&&yt){const t=yt.match(new RegExp("div","g")||0).length/2,o=document.createElement("div");o.id="CMMissingUpgradesPrestigeTitle",o.className="listing";const a=document.createElement("div");a.innerHTML=`Missing Prestige upgrades: ${t}/${Game.PrestigeUpgrades.length} (${Math.floor(t/Game.PrestigeUpgrades.length*100)}%)`,o.appendChild(a),e.appendChild(o);const n=document.createElement("div");n.className="listing crateBox",n.innerHTML=yt,e.appendChild(n)}else if("Upgrades"===e.children[0].innerHTML){if(Mt){const t=Mt.match(new RegExp("div","g")||0).length/2,o=document.createElement("div");o.id="CMMissingUpgradesTitle",o.className="listing";const a=document.createElement("div");a.innerHTML=`Missing normal upgrades: ${t}/${Game.UpgradesByPool[""].length+Game.UpgradesByPool.tech.length} (${Math.floor(t/(Game.UpgradesByPool[""].length+Game.UpgradesByPool.tech.length)*100)}%)`,o.appendChild(a),e.insertBefore(o,e.childNodes[3]);const n=document.createElement("div");n.className="listing crateBox",n.innerHTML=Mt,e.insertBefore(n,document.getElementById("CMMissingUpgradesTitle").nextSibling)}if(bt){const t=bt.match(new RegExp("div","g")||0).length/2,o=document.createElement("div");o.id="CMMissingUpgradesCookiesTitle",o.className="listing";const a=document.createElement("div");a.innerHTML=`Missing Cookie upgrades: ${t}/${Game.UpgradesByPool.cookie.length} (${Math.floor(t/Game.UpgradesByPool.cookie.length*100)}%)`,o.appendChild(a),e.appendChild(o);const n=document.createElement("div");n.className="listing crateBox",n.innerHTML=bt,e.appendChild(n)}}})),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.MissingAchievements&&function(){let e;Object.values(document.querySelectorAll("div.title")).forEach((t=>{t.textContent.includes("Achievements")&&(e=t.parentElement.querySelectorAll("div.listing.crateBox")[0])})),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.MissingAchievements&&Object.values(e.children).forEach((e=>{if(!e.className.includes("enabled")){const t=e.onclick.toString().split(/\[(.*)\]/gi)[1],{icon:o}=Game.AchievementsById[t];e.style.backgroundPosition=`${48*-o[0]}px ${48*-o[1]}px`,e.onmouseover=function(){Game.mouseDown||(Game.setOnCrate(this),Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>function(e){const t=[];"shadow"===e.pool?t.push("Shadow Achievement","#9700cf"):t.push("Achievement",0),t.push("Locked",0);let o=0;(Game.Has("Neuromancy")||Game.sesame&&"debug"===e.pool)&&(o=1),o&&0===e.won?t.push("Click to win!","#00c462"):o&&e.won>0&&t.push("Click to lose!","#00c462");let{icon:a}=e;e.iconFunction&&(a=e.iconFunction());let{desc:n}=e;e.descFunc&&(n=e.descFunc("stats"));let i="";for(let e=0;e[${t[e]}]`);return i=i.substring(1),`
\n
\n
${e.name}
\n ${i}
${n}
\n ${Game.sesame?`
Id : ${e.id} | Order : ${Math.floor(e.order)}${e.tier?` | Tier : ${e.tier}`:""}
`:""}`}(Game.AchievementsById[t])),"top"),Game.tooltip.wobble())}}}))}()}function cn(e){if(1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBar&&0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarPos){const t=parseInt(l("CMTimerBar").style.height,10);Game.mouseY-=t,e(),Game.mouseY+=t}else e()}function dn(){Z.Beautify=Beautify,Beautify=oe,Z.CalculateGains=Game.CalculateGains,Game.CalculateGains=function(){Z.CalculateGains(),Le=1,ee=Date.now(),te=Date.now()},Z.tooltip={},Z.tooltip.draw=Game.tooltip.draw,Z.tooltip.drawMod=new Function(`return ${Game.tooltip.draw.toString().split("this").join("Game.tooltip")}`)(),Game.tooltip.draw=function(e,t,o){Z.tooltip.drawMod(e,t,o)},Z.tooltip.update=Game.tooltip.update,Z.tooltip.updateMod=new Function(`return ${Game.tooltip.update.toString().split("this.").join("Game.tooltip.")}`)(),Game.tooltip.update=function(){Z.tooltip.updateMod(),function(){if("store"===Game.tooltip.origin){let e=0;1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnLucky&&1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnPos&&null!==l("CMDispTooltipWarningParent")&&(e=l("CMDispTooltipWarningParent").clientHeight-4),Game.tooltip.tta.style.top=`${Math.min(parseInt(Game.tooltip.tta.style.top,10),l("game").clientHeight+l("topBar").clientHeight-Game.tooltip.tt.clientHeight-e-46)}px`}}()},Z.UpdateWrinklers=Game.UpdateWrinklers,Game.UpdateWrinklers=function(){cn(Z.UpdateWrinklers)},Z.UpdateSpecial=Game.UpdateSpecial,Game.UpdateSpecial=function(){cn(Z.UpdateSpecial)},l("bigCookie").removeEventListener("click",Game.ClickCookie,!1),l("bigCookie").addEventListener("click",(e=>{cn((()=>Game.ClickCookie(e,0)))}),!1),Z.RebuildUpgrades=Game.RebuildUpgrades,Game.RebuildUpgrades=function(){Z.RebuildUpgrades(),J=[],Object.keys(Game.UpgradesInStore).forEach((e=>{null!==l(`upgrade${e}`).onmouseover&&(J[e]=l(`upgrade${e}`).onmouseover,l(`upgrade${e}`).onmouseover=function(){Game.mouseDown||(Game.setOnCrate(this),Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>Ra("u",`${e}`)),"store"),Game.tooltip.wobble())})})),Game.CalculateGains()},Z.ClickProduct=Game.ClickProduct,Game.ClickProduct=function(e){(!Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BulkBuyBlock||Game.ObjectsById[e].bulkPrice-1;--e)if(Game.ObjectsById[e].amount>0){const o=Vt[Game.ObjectsById[e].name].name;Vt[o].amount-=1,we-=1,t=Vt[o].basePrice*Game.priceIncrease**Math.max(0,Vt[o].amount-1-Vt[o].free),t=Game.modifyBuildingPrice(Vt[o],t),t=Math.ceil(t);break}const o=Se;return ra(),ua(),o!==Se&&ra(),[We-Game.cookiesPs,t]}(e),a=$o(o/(t+Game.cookiesPs));let n;n=0===Game.cookiesPs?oe(1/0):oe(t/Game.cookiesPs*100),l("dragonAuraInfo").style.minHeight="60px",l("dragonAuraInfo").style.margin="8px",l("dragonAuraInfo").appendChild(document.createElement("div")).className="line";const i=document.createElement("div");i.style.minWidth="200px",i.style.textAlign="center",i.textContent=`Picking this aura will change CPS by ${oe(t)} (${n}% of current CPS).`,l("dragonAuraInfo").appendChild(i);const r=document.createElement("div");r.style.minWidth="200px",r.style.textAlign="center",r.textContent=`It will take ${a} to recover the cost.`,l("dragonAuraInfo").appendChild(r)}}(e)},Z.ToggleSpecialMenu=Game.ToggleSpecialMenu,Game.ToggleSpecialMenu=function(e){Z.ToggleSpecialMenu(e),function(){if(null!==(l("specialPopup").className.match(/onScreen/)&&l("specialPopup").children[0].style.background.match(/dragon/)))for(let e=0;e${Ie}`,"this"),Game.tooltip.wobble()},l("specialPopup").children[e].onmouseout=function(){Game.tooltip.shouldHide=1})}()},Z.UpdateMenu=Game.UpdateMenu,Game.UpdateMenu=function(){void 0!==s().picker&&void 0!==s().picker.owner||(Z.UpdateMenu(),function(){const e=document.createElement("div");e.className="title","stats"===Game.onMenu?Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Stats&&(e.textContent="Cookie Monster Statistics",ln(e)):"prefs"===Game.onMenu&&l("menu").childNodes[2].insertBefore(on(),l("menu").childNodes[2].childNodes[l("menu").childNodes[2].childNodes.length-1])}())},Z.sayTime=Game.sayTime,yo=function(e,t){return Number.isNaN(e)||e<=0?Z.sayTime(e,t):$o(e/Game.fps,1)},Z.Logic=Game.Logic,Game.Logic=function(){Z.Logic();let e="Cookie Clicker";"fools"===Game.season&&(e="Cookie Baker"),Lo=`${Game.OnAscend?"Ascending! ":""}${oe(Game.cookies)} ${1===Game.cookies?"cookie":"cookies"} - ${e}`,function(){if(Game.OnAscend||0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Title)document.title=Lo;else if(1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Title){let e,t,o,a=!1,n=!1;e=At?At.wrath?`[W${Math.ceil(At.life/Game.fps)}]`:`[G${Math.ceil(At.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)}]`,I&&(a=!0,t="[F]"),"christmas"===Game.season&&(n=!0,o=R?`[R${Math.ceil(Wt.life/Game.fps)}]`:`[${Number(l("CMTimerBarRenMinBar").textContent)<0?"!":""}${Math.ceil((Game.shimmerTypes.reindeer.maxTime-Game.shimmerTypes.reindeer.time)/Game.fps)}]`);let i=Lo;"["===i.charAt(0)&&(i=i.substring(i.lastIndexOf("]")+1)),document.title=`${e+(a?t:"")+(n?o:"")} ${i}`}else if(2===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Title){let e="",t=!1;At&&(t=!0,At.wrath?e+=`[W${Math.ceil(At.life/Game.fps)}]`:e+=`[G${Math.ceil(At.life/Game.fps)}]`),I&&(t=!0,e+="[F]"),"christmas"===Game.season&&R&&(e+=`[R${Math.ceil(Wt.life/Game.fps)}]`,t=!0),t&&(e+=" - ");let o="Cookie Clicker";"fools"===Game.season&&(o="Cookie Baker"),e+=o,document.title=e}}(),function(){const e=Math.max(0,Game.HowManyCookiesReset(Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned))+1)-(Game.cookiesEarned+Game.cookiesReset)),t=Game.sayTime((Date.now()-Game.startDate)/1e3*Game.fps,-1);let o=`You've been on this run for ${""===t?"not very long":t}.
\n
`;Game.prestige>0&&(o+=`Your prestige level is currently ${oe(Game.prestige)}.
(CpS +${oe(Game.prestige)}%)\n
`),o+=be<1?"Ascending now would grant you no prestige.":be<2?"Ascending now would grant you
1 prestige level (+1% CpS)
and 1 heavenly chip to spend.":`Ascending now would grant you
${oe(be)} prestige levels (+${oe(be)}% CpS)
and ${oe(be)} heavenly chips to spend.`,o+=`
\n You need ${oe(e)} more cookies for the next level.
\n ${Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipAscendButton?`
It takes ${jt} to reach the next level and you were making ${oe(nt,2)} chips on average in the last 5 seconds.
`:""}`,l("ascendTooltip").innerHTML=o}()}}function mn(){window.CookieMonsterData={},Game.mods.cookieMonsterFramework.listeners.optionsMenu.push(on),za(),Aa(),Ha(),D=Object.keys(Game.mods).length,$e=document.createElement("style"),$e.type="text/css",$e.id="CMCSS",document.head.appendChild($e),function(){const e=document.createElement("div");e.id="CMBotBar",e.style.height="69px",e.style.width="100%",e.style.position="absolute",e.style.display="none",e.style.backgroundColor="#262224",e.style.backgroundImage="linear-gradient(to bottom, #4d4548, #000000)",e.style.borderTop="1px solid black",e.style.overflow="auto",e.style.textShadow="-1px 0 black, 0 1px black, 1px 0 black, 0 -1px black";const t=e.appendChild(document.createElement("table"));t.style.width="100%",t.style.textAlign="center",t.style.whiteSpace="nowrap";const o=t.appendChild(document.createElement("tbody")),a=function(e,t){const o=document.createElement("td");return o.style.textAlign="right",o.className=to+t,o.textContent=e,o},n=o.appendChild(document.createElement("tr"));n.style.fontWeight="bold",n.appendChild(a("CM 2.031.10",io)),o.appendChild(document.createElement("tr")).appendChild(a("Bonus Income",ao)),o.appendChild(document.createElement("tr")).appendChild(a("Payback Period",ao)),o.appendChild(document.createElement("tr")).appendChild(a("Time Left",ao)),l("wrapper").appendChild(e),Object.keys(Game.Objects).forEach((e=>{zo(e)}))}(),function(){const e=document.createElement("div");e.id="CMTimerBar",e.style.position="absolute",e.style.display="none",e.style.height="0px",e.style.fontSize="10px",e.style.fontWeight="bold",e.style.backgroundColor="black";const t=Io("CMTimerBarAutosave","Autosave",[{id:"CMTimerBarAutosaveBar",colour:lo}]);e.appendChild(t);const o=Io("CMTimerBarGC","Next Cookie",[{id:"CMTimerBarGCMinBar",colour:co},{id:"CMTimerBarGCBar",colour:lo}]);e.appendChild(o);const a=Io("CMTimerBarRen","Next Reindeer",[{id:"CMTimerBarRenMinBar",colour:co},{id:"CMTimerBarRenBar",colour:ro}]);e.appendChild(a);const n=document.createElement("div");n.id="CMTimerBarBuffTimers",e.appendChild(n),l("wrapper").appendChild(e)}(),function(){const e=document.createElement("div");e.id="CMUpgradeBar",e.style.width="100%",e.style.backgroundColor="black",e.style.textAlign="center",e.style.fontWeight="bold",e.style.display="none",e.style.zIndex="21",e.onmouseout=function(){Game.tooltip.hide()};const t=document.createElement("div");t.appendChild(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 o=function(e,t){const o=document.createElement("div");o.style.verticalAlign="middle";const a=document.createElement("span");return a.className=oo+e,a.style.display="inline-block",a.style.height="10px",a.style.width="10px",a.style.marginRight="4px",o.appendChild(a),o.appendChild(document.createTextNode(t)),o};return e.appendChild(o(ao,"Better than the best PP of a building option")),e.appendChild(o(no,"Same as the best PP building option")),e.appendChild(o(io,"Within the top 10 of PP for buildings")),e.appendChild(o(ro,"Within the top 20 of PP for buildings")),e.appendChild(o(so,"Within the top 30 of PP for buildings")),e.appendChild(o(lo,"Outside of the top 30 of PP for buildings")),e.appendChild(o(co,"Negative or infinity PP")),e}()),e.onmouseover=function(){Game.tooltip.draw(this,escape(t.innerHTML),"store")};const o=function(e,t){const o=document.createElement("span");return o.id=e,o.className=to+t,o.style.width="14.28571428571429%",o.style.display="inline-block",o.textContent="0",o};e.appendChild(o("CMUpgradeBarBlue",ao)),e.appendChild(o("CMUpgradeBarGreen",no)),e.appendChild(o("CMUpgradeBarYellow",io)),e.appendChild(o("CMUpgradeBarOrange",ro)),e.appendChild(o("CMUpgradeBarRed",so)),e.appendChild(o("CMUpgradeBarPurple",lo)),e.appendChild(o("CMUpgradeBarGray",co)),l("upgrades").parentNode.insertBefore(e,l("upgrades").parentNode.childNodes[3])}(),function(){const e=document.createElement("div");e.id="CMSectionHidButtons",e.style.textAlign="center";const t=document.createElement("a");t.className="option",t.onclick=function(){"flex"===l("upgrades").style.display?(l("upgrades").style.display="none",l("toggleUpgrades").style.display="none",l("techUpgrades").style.display="none",l("vaultUpgrades").style.display="none"):(l("upgrades").style.display="flex",0!==l("toggleUpgrades").children.length&&(l("toggleUpgrades").style.display="block"),0!==l("techUpgrades").children.length&&(l("techUpgrades").style.display="block"),0!==l("vaultUpgrades").children.length&&(l("vaultUpgrades").style.display="block"))},t.textContent="Hide/Show Upgrades",e.appendChild(t);const o=document.createElement("a");o.className="option",o.onclick=function(){"grid"===l("products").style.display?l("products").style.display="none":l("products").style.display="grid"},o.textContent="Hide/Show Buildings",e.appendChild(o),l("store").insertBefore(e,l("store").childNodes[2])}(),function(){const e=document.createElement("link");e.id="CMFavicon",e.rel="shortcut icon",e.href="https://orteil.dashnet.org/cookieclicker/favicon.ico",document.getElementsByTagName("head")[0].appendChild(e)}(),Object.keys(ho).forEach((e=>{!function(e,t,o){const a=document.createElement("div");a.id=e;const n=document.createElement("div");n.style.minWidth=o,n.style.marginBottom="4px";const i=document.createElement("div");i.style.textAlign="left",i.textContent=t,n.appendChild(i),a.appendChild(n),go[e]=a}(ho[e][0],ho[e][1],ho[e][2])})),function(){const e=document.createElement("a");e.id="PopAllNormalWrinklerButton",e.textContent="Pop All Normal",e.className="option",e.onclick=function(){Ua()},e.onmouseout=function(){Game.tooltip.shouldHide=1},e.onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>Ra("wb","PopAllNormal")),"this"),Game.tooltip.wobble()},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!==ht[1]&&(Game.wrinklers[ht[1]].hp=0)},t.onmouseout=function(){Game.tooltip.shouldHide=1},t.onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>Ra("wb","PopFattest")),"this"),Game.tooltip.wobble()},l("sectionLeftExtra").children[0].append(t)}(),l("products").style.display="grid",l("storeBulk").style.gridRow="1/1",l("upgrades").style.display="flex",l("upgrades").style["flex-wrap"]="wrap",Object.keys(l("rows").children).forEach((e=>{const t=l("rows").children[e].children[1],o=document.createElement("div");o.id=`productLock${Number(e)+1}`,o.className="productButton",o.innerHTML="Lock",o.onclick=function(){!function(e){"Lock"===l(`productLock${e}`).innerHTML?(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.lockedMinigames.push(e.toString()),l(`row${e}`).style.pointerEvents="none",l(`row${e}`).style.opacity="0.4",l(`productLock${e}`).innerHTML="Unlock",l(`productLock${e}`).style.pointerEvents="auto"):(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.lockedMinigames.includes(e.toString())&&(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.lockedMinigames=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.lockedMinigames.filter((t=>t!==e.toString()))),l(`productLock${e}`).innerHTML="Lock",l(`row${e}`).style.pointerEvents="auto",l(`row${e}`).style.opacity="1")}(Number(e)+1)},t.appendChild(o)})),Object.keys(Game.Objects).forEach((e=>{const t=Game.Objects[e];null!==l(`product${t.id}`).onmouseover&&(Y[e]=l(`product${t.id}`).onmouseover,l(`product${t.id}`).onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>Ra("b",`${e}`)),"store"),Game.tooltip.wobble()})})),Game.canLumps()&&(L=l("lumps").onmouseover,l("lumps").onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>Ra("s","Lump")),"this"),Game.tooltip.wobble()}),U=Game.LoadMinigames,Game.LoadMinigames=function(){U(),Game.Objects.Farm.minigameLoaded&&(l("gardenTool-1").onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>Ra("ha","HarvestAllButton")),"this"),Game.tooltip.wobble()},Array.from(l("gardenPlot").children).forEach((e=>{const t=e.id.slice(-3);e.onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>Ra("p",[`${t[0]}`,`${t[2]}`])),"this"),Game.tooltip.wobble()}}))),Va(),function(){if(Game.Objects.Temple.minigameLoaded){for(let e=0;e<11;e+=1)l(`templeGod${e}`).onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>Ra("pag",e)),"this"),Game.tooltip.wobble()};for(let e=0;e<3;e+=1)l(`templeSlot${e}`).onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>Ra("pas",[e,Game.Objects.Temple.minigame.slot[e]])),"this"),Game.tooltip.wobble()}}}(),Xa()},Game.LoadMinigames(),l("backgroundLeftCanvas").onmouseover=function(){ko=1},l("backgroundLeftCanvas").onmouseout=function(){ko=0,Game.tooltip.hide(),Object.keys(Game.wrinklers).forEach((e=>{Mo[e]=0}))},dn(),Xa(),Game.CalculateGains(),fo=Game.OnAscend,Game.prefs.popups?Game.Popup("Cookie Monster version 2.031.10 loaded!"):Game.Notify("Cookie Monster version 2.031.10 loaded!","","",1,1),Game.Win("Third-party")}function pn(e,t){if(!Game.Objects.Temple.minigameLoaded)return 0;ea();const{minigame:o}=Game.Objects.Temple,a=o.godsById[e].slot;"0"===a?Ne=o.slot[t]:"1"===a?Oe=o.slot[t]:"2"===a&&(De=o.slot[t]),0===t?Ne=e:1===t?Oe=e:2===t&&(De=e);const n=Se;return ra(),ua(),n!==Se&&ra(),We-Game.cookiesPs}function un(){if(No!==Game.OnAscend&&(No=Game.OnAscend,Game.OnAscend?(l("game").style.bottom="0px",1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BotBar&&(l("CMBotBar").style.display="none"),1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBar&&(l("CMTimerBar").style.display="none")):(Za(),Qo()),_o()),!Game.OnAscend&&0===Game.AscendTimer){D!==Object.keys(Game.mods).length&&(za(),Ha(),D=Object.keys(Game.mods).length),Le&&(ja(!0),Ba(),Game.Has("Golden switch [off]")?(ea(),_t["Golden switch [off]"].bought=0,ra(),et=We):et=Game.cookiesPs,ba({CacheNoGoldSwitchCookiesPS:et}),Wa(),Aa(),Da(),Na(),Qa(),function(){for(let e=0;e<11;e+=1)for(let t=0;t<3;t+=1)zt[e][t]=pn(e,t);ba({CacheGods:zt})}(),La(),function(){let e=0;if(Game.Objects.Bank.minigameLoaded){const t=Game.Objects.Bank.minigame.goods;let o=0;Object.keys(t).forEach((e=>{const a=t[e];o+=a.stock*a.val})),e+=o*Game.cookiesPsRawHighest}e+=function(){let e=0;ea();let t=2;5!==Be&&18!==Be||(t-=1),5!==Pe&&18!==Pe||(t-=1),Be=5,Pe=18;for(let e=0;e{Vt[t].amount>0&&(e=t)})),Vt[e].amount-=1,we-=1}return Object.keys(Vt).forEach((t=>{const o=Vt[t];e+=eo(Game.Objects[o.name],Game.Objects[t].basePrice,o.amount,Game.Objects[t].free,o.amount)})),e}(),It=e,ba({CacheSellForChoEgg:It})}(),Le=0);const e=Game.auraMult("Fierce Hoarder")>0;!ve&&e?(ve=!0,Ge=1):ve&&!e&&(ve=!1,Ge=1),Ge&&(Ea(),Ge=0),function(){$a(),Ta(),ja(!1),function(){gt=0;let e=0;Object.keys(Game.wrinklers).forEach((t=>{2===Game.wrinklers[t].phase&&(e+=1)}));let t=1;if(Vt.Temple.minigameLoaded){const e=Game.hasGod("scorn");1===e?t*=1.15:2===e?t*=1.1:3===e&&(t*=1.05)}ft=e,gt=e*(.05*e*1.1)*(.05*Game.Has("Sacrilegious corruption")+1)*(.05*Game.Has("Wrinklerspawn")+1)*t,ba({CacheCurrWrinklerCount:ft,CacheCurrWrinklerCPSMult:gt})}(),Ga(),Oa();const e=Game.HowManyCookiesReset(Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned))+1)-(Game.cookiesEarned+Game.cookiesReset);jt=$o(e/Uo())}(),I!==(Game.TickerEffect&&"fortune"===Game.TickerEffect.type)&&(I=Game.TickerEffect&&"fortune"===Game.TickerEffect.type,I&&(v.createFlash("cookieMonsterMod",3,"FortuneFlash",!1),v.playCMSound("cookieMonsterMod",Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.FortuneSoundURL,"FortuneSound","FortuneVolume",!1),v.createNotification("cookieMonsterMod","FortuneNotification","Fortune Cookie found","A Fortune Cookie has appeared on the Ticker."))),R!==Game.shimmerTypes.reindeer.spawned&&(R=Game.shimmerTypes.reindeer.spawned,Object.keys(Game.shimmers).forEach((e=>{Game.shimmers[e].spawnLead&&"reindeer"===Game.shimmers[e].type&&(Wt=Game.shimmers[e])})),v.createFlash("cookieMonsterMod",3,"SeaFlash",!1),v.playCMSound("cookieMonsterMod",Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SeaSoundURL,"SeaSound","SeaVolume",!1),v.createNotification("cookieMonsterMod","SeaNotification","Reindeer sighted!","A Reindeer has spawned. Click it now!")),Game.Objects.Farm.minigameLoaded&&z!==Game.Objects.Farm.minigame.nextStep&&(0!==z&&z0){let e=0;Object.keys(Game.wrinklers).forEach((t=>{2===Game.wrinklers[t].phase&&(e+=1)})),e>q?(q=e,e===Game.getWrinklersMax()&&Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerMaxFlash?v.createFlash("cookieMonsterMod",3,"WrinklerMaxFlash",!1):v.createFlash("cookieMonsterMod",3,"WrinklerFlash",!1),e===Game.getWrinklersMax()&&Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerMaxSound?v.playCMSound("cookieMonsterMod",Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerMaxSoundURL,"WrinklerMaxSound","WrinklerMaxVolume",!1):v.playCMSound("cookieMonsterMod",Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerSoundURL,"WrinklerSound","WrinklerVolume",!1),e===Game.getWrinklersMax()&&Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerMaxNotification?v.createNotification("cookieMonsterMod","WrinklerMaxNotification","Maximum Wrinklers Reached","You have reached your maximum ammount of wrinklers"):v.createNotification("cookieMonsterMod","WrinklerNotification","A Wrinkler appeared","A new wrinkler has appeared")):q=e}}()}Q=0,Rt={},Object.keys(Game.shimmers).forEach((e=>{Rt[Game.shimmers[e].id]=Game.shimmers[e],Game.shimmers[e].spawnLead&&"golden"===Game.shimmers[e].type&&(At=Game.shimmers[e],Q+=1)})),Object.keys(Do).forEach((e=>{void 0===Rt[e]&&(Do[e].parentNode.removeChild(Do[e]),delete Do[e])})),V!==Game.shimmerTypes.golden.n?(V=Game.shimmerTypes.golden.n,V&&(_{void 0===Do[Game.shimmers[e].id]&&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",t.style.pointerEvents="none",0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.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=""},Do[e.id]=t,l("shimmers").appendChild(t)}(Game.shimmers[e])}))),Ia(),_=Q,0===Q&&(At=0)):1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GCTimer&&V&&Object.keys(Do).forEach((e=>{Do[e].style.opacity=Rt[e].l.style.opacity,Do[e].style.transform=Rt[e].l.style.transform,Do[e].textContent=Math.ceil(Rt[e].life/Game.fps)}))}const hn={Favourite:1,Calculation:1,Notation:1,Colours:1,BarsDisplay:1,Tooltip:1,Statistics:1,Notification:1,NotificationGeneral:1,NotificationGC:1,NotificationFC:1,NotificationSea:1,NotificationGard:1,NotificationMagi:1,NotificationWrink:1,NotificationWrinkMax:1,Miscellaneous:1,Lucky:1,Chain:1,Spells:1,Garden:1,Prestige:1,Wrink:1,Sea:1,Achievs:1,Misc:1,infoMenu:1,optionsMenu:1};function gn(e){za(),w.loadMod("cookieMonsterMod",e,en,hn,un),void 0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.lockedMinigames&&(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.lockedMinigames=[]),tn();for(let e=0;e{var e={877:function(e){!function(t,o){"use strict";"object"!=typeof e.exports?o(t):e.exports=t.document?o(t):function(e){if(!e.document)throw new Error("jscolor needs a window with document");return o(e)}}("undefined"!=typeof window?window:this,(function(e){"use strict";var t,o,a,n,i=(n={initialized:!1,instances:[],readyQueue:[],register:function(){void 0!==e&&e.document&&e.document.addEventListener("DOMContentLoaded",n.pub.init,!1)},installBySelector:function(t,o){if(!(o=o?n.node(o):e.document))throw new Error("Missing root node");for(var a=o.querySelectorAll(t),i=new RegExp("(^|\\s)("+n.pub.lookupClass+")(\\s*(\\{[^}]*\\})|\\s|$)","i"),r=0;r-1},isButtonEmpty:function(e){switch(n.nodeName(e)){case"input":return!e.value||""===e.value.trim();case"button":return""===e.textContent.trim()}return null},isPassiveEventSupported:function(){var t=!1;try{var o=Object.defineProperty({},"passive",{get:function(){t=!0}});e.addEventListener("testPassive",null,o),e.removeEventListener("testPassive",null,o)}catch(e){}return t}(),isColorAttrSupported:(a=e.document.createElement("input"),!(!a.setAttribute||(a.setAttribute("type","color"),"color"!=a.type.toLowerCase()))),dataProp:"_data_jscolor",setData:function(){var e=arguments[0];if(3===arguments.length){var t=e.hasOwnProperty(n.dataProp)?e[n.dataProp]:e[n.dataProp]={},o=arguments[2];return t[i=arguments[1]]=o,!0}if(2===arguments.length&&"object"==typeof arguments[1]){t=e.hasOwnProperty(n.dataProp)?e[n.dataProp]:e[n.dataProp]={};var a=arguments[1];for(var i in a)a.hasOwnProperty(i)&&(t[i]=a[i]);return!0}throw new Error("Invalid arguments")},removeData:function(){var e=arguments[0];if(!e.hasOwnProperty(n.dataProp))return!0;for(var t=1;t=3&&(a=s[0].match(l))&&(n=s[1].match(l))&&(i=s[2].match(l)))return o.format="rgb",o.rgba=[parseFloat(a[1])||0,parseFloat(n[1])||0,parseFloat(i[1])||0,null],s.length>=4&&(r=s[3].match(l))&&(o.format="rgba",o.rgba[3]=parseFloat(r[1])||0),o}return!1},parsePaletteValue:function(e){var t=[];"string"==typeof e?e.replace(/#[0-9A-F]{3}([0-9A-F]{3})?|rgba?\(([^)]*)\)/gi,(function(e){t.push(e)})):Array.isArray(e)&&(t=e);for(var o=[],a=0;al[a]&&-t[a]+e[a]+s[a]/2>l[a]/2&&e[a]+s[a]-d[a]>=0?e[a]+s[a]-d[a]:e[a],-t[i]+e[i]+s[i]+d[i]-m+m*r>l[i]?-t[i]+e[i]+s[i]/2>l[i]/2&&e[i]+s[i]-m-m*r>=0?e[i]+s[i]-m-m*r:e[i]+s[i]-m+m*r:e[i]+s[i]-m+m*r>=0?e[i]+s[i]-m+m*r:e[i]+s[i]-m-m*r];else var p=[e[a],e[i]+s[i]-m+m*r];var u=p[a],h=p[i],g=o.fixed?"fixed":"absolute",f=(p[0]+d[0]>e[0]||p[0]0?Math.ceil(s/o):0,n=Math.max(1,Math.floor((t-(o-1)*e.paletteSpacing)/o)),i=e.paletteHeight?Math.min(e.paletteHeight,n):n),a&&(r=a*i+(a-1)*e.paletteSpacing),{cols:o,rows:a,cellW:n,cellH:i,width:t,height:r}},getControlPadding:function(e){return Math.max(e.padding/2,2*e.pointerBorderWidth+e.pointerThickness-e.controlBorderWidth)},getPadYChannel:function(e){return"v"===e.mode.charAt(1).toLowerCase()?"v":"s"},getSliderChannel:function(e){if(e.mode.length>2)switch(e.mode.charAt(2).toLowerCase()){case"s":return"s";case"v":return"v"}return null},triggerCallback:function(e,t){if(e[t]){var o=null;if("string"==typeof e[t])try{o=new Function(e[t])}catch(e){console.error(e)}else o=e[t];o&&o.call(e)}},triggerGlobal:function(e){for(var t=n.getInstances(),o=0;o0)for(var c=0;c=2&&"string"==typeof arguments[0]){try{if(!i(arguments[0],arguments[1]))return!1}catch(e){return console.warn(e),!1}return this.redraw(),this.exposeColor(),!0}if(1===arguments.length&&"object"==typeof arguments[0]){var e=arguments[0],t=!0;for(var o in e)if(e.hasOwnProperty(o))try{i(o,e[o])||(t=!1)}catch(e){console.warn(e),t=!1}return this.redraw(),this.exposeColor(),t}throw new Error("Invalid arguments")},this.channel=function(e,t){if("string"!=typeof e)throw new Error("Invalid value for channel name: "+e);if(void 0===t)return this.channels.hasOwnProperty(e.toLowerCase())?this.channels[e.toLowerCase()]:(console.warn("Getting unknown channel: "+e),!1);var o=!1;switch(e.toLowerCase()){case"r":o=this.fromRGBA(t,null,null,null);break;case"g":o=this.fromRGBA(null,t,null,null);break;case"b":o=this.fromRGBA(null,null,t,null);break;case"h":o=this.fromHSVA(t,null,null,null);break;case"s":o=this.fromHSVA(null,t,null,null);break;case"v":o=this.fromHSVA(null,null,t,null);break;case"a":o=this.fromHSVA(null,null,null,t);break;default:return console.warn("Setting unknown channel: "+e),!1}return!!o&&(this.redraw(),!0)},this.trigger=function(e){for(var t=n.strList(e),o=0;o127.5},this.hide=function(){m()&&(n.removeClass(a.targetElement,n.pub.activeClassName),n.picker.wrap.parentNode.removeChild(n.picker.wrap),delete n.picker.owner)},this.show=function(){s()},this.redraw=function(){m()&&s()},this.getFormat=function(){return this._currentFormat},this._setFormat=function(e){this._currentFormat=e.toLowerCase()},this.hasAlphaChannel=function(){return"auto"===this.alphaChannel?"any"===this.format.toLowerCase()||n.isAlphaFormat(this.getFormat())||void 0!==this.alpha||void 0!==this.alphaElement:this.alphaChannel},this.processValueInput=function(e){this.fromString(e)||this.exposeColor()},this.processAlphaInput=function(e){this.fromHSVA(null,null,null,parseFloat(e))||this.exposeColor()},this.exposeColor=function(e){var t=this.toString(),o=this.getFormat();if(n.setDataAttr(this.targetElement,"current-color",t),e&n.flags.leaveValue||!this.valueElement||("hex"!==o&&"hexa"!==o||(this.uppercase||(t=t.toLowerCase()),this.hash||(t=t.replace(/^#/,""))),this.setValueElementValue(t)),!(e&n.flags.leaveAlpha)&&this.alphaElement){var a=Math.round(100*this.channels.a)/100;this.setAlphaElementValue(a)}e&n.flags.leavePreview||!this.previewElement||((n.isTextInput(this.previewElement)||n.isButton(this.previewElement)&&!n.isButtonEmpty(this.previewElement))&&this.previewPosition,this.setPreviewElementBg(this.toRGBAString())),m()&&(l(),c(),d())},this.setPreviewElementBg=function(e){if(this.previewElement){var t=null,o=null;(n.isTextInput(this.previewElement)||n.isButton(this.previewElement)&&!n.isButtonEmpty(this.previewElement))&&(t=this.previewPosition,o=this.previewSize);var a=[];if(e){a.push({image:n.genColorPreviewGradient(e,t,o?o-n.pub.previewSeparator.length:null),position:"left top",size:"auto",repeat:t?"repeat-y":"repeat",origin:"padding-box"});var i=n.genColorPreviewCanvas("rgba(0,0,0,0)",t?{left:"right",right:"left"}[t]:null,o,!0);a.push({image:"url('"+i.canvas.toDataURL()+"')",position:(t||"left")+" top",size:i.width+"px "+i.height+"px",repeat:t?"repeat-y":"repeat",origin:"padding-box"})}else a.push({image:"none",position:"left top",size:"auto",repeat:"no-repeat",origin:"padding-box"});for(var r={image:[],position:[],size:[],repeat:[],origin:[]},s=0;s=0;h-=1){var g=u[h];if(g)if(n.pub.presets.hasOwnProperty(g)){for(var p in n.pub.presets[g])if(n.pub.presets[g].hasOwnProperty(p))try{i(p,n.pub.presets[g][p])}catch(e){console.warn(e)}}else console.warn("Unknown preset: %s",g)}var f=["preset"];for(var p in o)if(o.hasOwnProperty(p)&&-1===f.indexOf(p))try{i(p,o[p])}catch(e){console.warn(e)}if(void 0===this.container?this.container=e.document.body:this.container=n.node(this.container),!this.container)throw new Error("Cannot instantiate color picker without a container element");if(this.targetElement=n.node(t),!this.targetElement){if("string"==typeof t&&/^[a-zA-Z][\w:.-]*$/.test(t))throw new Error("If '"+t+"' is supposed to be an ID, please use '#"+t+"' or any valid CSS selector.");throw new Error("Cannot instantiate color picker without a target element")}if(this.targetElement.jscolor&&this.targetElement.jscolor instanceof n.pub)throw new Error("Color picker already installed on this element");if(this.targetElement.jscolor=this,n.addClass(this.targetElement,n.pub.className),n.instances.push(this),n.isButton(this.targetElement)&&("button"!==this.targetElement.type.toLowerCase()&&(this.targetElement.type="button"),n.isButtonEmpty(this.targetElement))){n.removeChildren(this.targetElement),this.targetElement.appendChild(e.document.createTextNode(" "));var k=n.getCompStyle(this.targetElement);(parseFloat(k["min-width"])||0)-1){var b=n.parseColorString(M);this._currentFormat=b?b.format:"hex"}else this._currentFormat=this.format.toLowerCase();this.processValueInput(M),void 0!==y&&this.processAlphaInput(y),this.random&&this.randomize.apply(this,Array.isArray(this.random)?this.random:[])}},n.pub.className="jscolor",n.pub.activeClassName="jscolor-active",n.pub.looseJSON=!0,n.pub.presets={},n.pub.presets.default={},n.pub.presets.light={backgroundColor:"rgba(255,255,255,1)",controlBorderColor:"rgba(187,187,187,1)",buttonColor:"rgba(0,0,0,1)"},n.pub.presets.dark={backgroundColor:"rgba(51,51,51,1)",controlBorderColor:"rgba(153,153,153,1)",buttonColor:"rgba(240,240,240,1)"},n.pub.presets.small={width:101,height:101,padding:10,sliderSize:14,paletteCols:8},n.pub.presets.medium={width:181,height:101,padding:12,sliderSize:16,paletteCols:10},n.pub.presets.large={width:271,height:151,padding:12,sliderSize:24,paletteCols:15},n.pub.presets.thin={borderWidth:1,controlBorderWidth:1,pointerBorderWidth:1},n.pub.presets.thick={borderWidth:2,controlBorderWidth:2,pointerBorderWidth:2},n.pub.sliderInnerSpace=3,n.pub.chessboardSize=8,n.pub.chessboardColor1="#666666",n.pub.chessboardColor2="#999999",n.pub.previewSeparator=["rgba(255,255,255,.65)","rgba(128,128,128,.65)"],n.pub.init=function(){if(!n.initialized)for(e.document.addEventListener("mousedown",n.onDocumentMouseDown,!1),e.document.addEventListener("keyup",n.onDocumentKeyUp,!1),e.addEventListener("resize",n.onWindowResize,!1),e.addEventListener("scroll",n.onWindowScroll,!1),n.pub.install(),n.initialized=!0;n.readyQueue.length;)n.readyQueue.shift()()},n.pub.install=function(e){var t=!0;try{n.installBySelector("[data-jscolor]",e)}catch(e){t=!1,console.warn(e)}if(n.pub.lookupClass)try{n.installBySelector("input."+n.pub.lookupClass+", button."+n.pub.lookupClass,e)}catch(e){}return t},n.pub.ready=function(e){return"function"!=typeof e?(console.warn("Passed value is not a function"),!1):(n.initialized?e():n.readyQueue.push(e),!0)},n.pub.trigger=function(e){var t=function(){n.triggerGlobal(e)};n.initialized?t():n.pub.ready(t)},n.pub.hide=function(){n.picker&&n.picker.owner&&n.picker.owner.hide()},n.pub.chessboard=function(e){return e||(e="rgba(0,0,0,0)"),n.genColorPreviewCanvas(e).canvas.toDataURL()},n.pub.background=function(e){var t=[];t.push(n.genColorPreviewGradient(e));var o=n.genColorPreviewCanvas();return t.push(["url('"+o.canvas.toDataURL()+"')","left top","repeat"].join(" ")),t.join(", ")},n.pub.options={},n.pub.lookupClass="jscolor",n.pub.installByClassName=function(){return console.error('jscolor.installByClassName() is DEPRECATED. Use data-jscolor="" attribute instead of a class name.'+n.docsRef),!1},n.register(),n.pub);return void 0===e.jscolor&&(e.jscolor=e.JSColor=i),i}))}},t={};function o(a){var n=t[a];if(void 0!==n)return n.exports;var i=t[a]={exports:{}};return e[a].call(i.exports,i,i.exports,o),i.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var a in t)o.o(t,a)&&!o.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";class e{constructor(e,t,o){this.defaultValue=e,this.type=t,this.group=o}}function t(e,t){Game.promptWrapL.className="framed",Game.promptL.innerHTML=`${e}
`,Object.keys(t).forEach((e=>{const o=document.createElement("a");o.id=`promptOption${e}`,o.className="option",o.onclick=function(){PlaySound("snd/tick.mp3"),t[e][1]()},o.textContent=t[e][0],Game.promptL.children[1].appendChild(o)})),Game.promptAnchorL.style.display="block",Game.darkenL.style.display="block",Game.promptL.focus(),Game.promptOn=1,Game.UpdatePrompt()}function a(e,t,o,n){(1===Game.mods.cookieMonsterFramework.saveData[e].settings[o]||n)&&3===t&&!1===window.cookieMonsterFrameworkData.isInitializing||1===t?(l("CMFlashScreen").style.backgroundColor=Game.mods.cookieMonsterFramework.saveData[e].settings[`Colour${o}`],l("CMFlashScreen").style.opacity="0.5",3===t?(l("CMFlashScreen").style.display="inline",setTimeout((()=>{a(e,2,o,!0)}),1e3/Game.fps)):setTimeout((()=>{a(e,0,o,!0)}),1e3/Game.fps)):2===t?(l("CMFlashScreen").style.opacity="1",setTimeout((()=>{a(e,1,o,!0)}),1e3/Game.fps)):0===t&&(l("CMFlashScreen").style.display="none")}function n(){Object.keys(Game.mods.cookieMonsterFramework.saveData).forEach((e=>{const t=JSON.stringify(Game.mods.cookieMonsterFramework.saveData[e]),o=b64_to_utf8(unescape(localStorage.getItem("CookieClickerGame")).split("!END!")[0]),a=new RegExp(`${e}.*(;|$)`),n=o.match(a);if(null!==n){const a=o.replace(n[0],`${e}:${t}`);localStorage.setItem("CookieClickerGame",escape(`${utf8_to_b64(a)}!END!`))}}))}function i(e,t){void 0===Game.mods.cookieMonsterFramework.saveData[e].headers[t]&&(Game.mods.cookieMonsterFramework.saveData[e].headers[t]=1),0===Game.mods.cookieMonsterFramework.saveData[e].headers[t]?Game.mods.cookieMonsterFramework.saveData[e].headers[t]=1:Game.mods.cookieMonsterFramework.saveData[e].headers[t]=0,n()}var r=o(877),s=o.n(r);function c(e,t,o,a,n){if((1===Game.mods.cookieMonsterFramework.saveData[e].settings[o]||n)&&!1===window.cookieMonsterFrameworkData.isInitializing){const o=new Audio(t);Game.mods.cookieMonsterFramework.saveData[e].settings.GeneralSound?o.volume=Game.mods.cookieMonsterFramework.saveData[e].settings[a]/100*(Game.volume/100):o.volume=Game.mods.cookieMonsterFramework.saveData[e].settings[a]/100,o.play()}}function d(e,t){null!==l(`slider${e}${t}`)&&(l(`slider${e}${t}right`).innerHTML=`${l(`slider${e}${t}`).value}%`,Game.mods.cookieMonsterFramework.saveData[e].settings[t]=Math.round(l(`slider${e}${t}`).value)),n()}function m(e,t){t.disconnect(),"log"===Game.onMenu?function(){const e=l("menu").children[1];if(e.insertBefore(function(){const e=document.createElement("div");e.className="subsection",e.id="cookieMonsterFrameworkMenuSection";const t=document.createElement("div");t.className="title",t.innerHTML="Cookie Monster Mod Family";const o=document.createElement("span");if(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=Game.mods.cookieMonsterFramework.saveData.cookieMonsterFramework.headers.infoMenu?"-":"+",o.onclick=function(){i("cookieMonsterFramework","infoMenu"),Game.UpdateMenu()},t.appendChild(o),e.appendChild(t),Game.mods.cookieMonsterFramework.saveData.cookieMonsterFramework.headers.infoMenu){const t=document.createElement("div");t.className="listing",t.innerHTML='Cookie Monster Team\noffers a suite of tools to enhance your game experience.
\nOriginally known from our work on the Cookie Monster add-on we are now expanding and working on new tools within the Cookie Monster Mod Family.
\nKeep an eye on our GitHub to see future work or use it to report bugs or feature requests!
\n',e.appendChild(t)}return e}(),e.children[1]),Game.mods.cookieMonsterFramework.saveData.cookieMonsterFramework.headers.infoMenu){const e=Game.mods.cookieMonsterFramework.listeners.infoMenu;for(let t=0;t{void 0===e.settings||void 0===e.settings[o]?n[o]=t[o].defaultValue:n[o]=e.settings[o]})),a.settings=n;const i={};return Object.keys(o).forEach((t=>{void 0===e.headers||void 0===e.headers[t]?i[t]=o[t]:i[t]=e.headers[t]})),a.headers=i,Object.keys(e).forEach((t=>{"settings"!==t&&"headers"!==t&&(a[t]=e[t])})),void 0===a.favouriteSettings&&(a.favouriteSettings=[]),a}(r,o,a),n(),i(),Object.keys(Game.mods.cookieMonsterFramework.saveData[e].settings).forEach((e=>{void 0!==o[e].func&&o[e].func()})),Game.UpdateMenu()}function g(){}const f={};function k(e){h("cookieMonsterFramework",e,f,u,g)}const C={init:function(){window.cookieMonsterFrameworkData={isInitializing:!0},new MutationObserver(m).observe(document.getElementById("menu"),{attributes:!0,childList:!0,subtree:!0}),function(){const e=document.createElement("div");e.id="CMFlashScreen",e.style.width="100%",e.style.height="100%",e.style.backgroundColor="white",e.style.display="none",e.style.zIndex="9999999999",e.style.position="absolute",e.style.pointerEvents="none",l("wrapper").appendChild(e)}(),Game.registerHook("draw",p),void 0===Game.modSaveData.cookieMonsterFramework&&k("{}"),window.cookieMonsterFrameworkData.isInitializing=!1},load:k,save:function(){return JSON.stringify(Game.mods.cookieMonsterFramework.saveData.cookieMonsterFramework)},listeners:{infoMenu:[],optionsMenu:[]},saveData:{cookieMonsterFramework:{headers:{},settings:{}}}},M=function(){"undefined"==typeof cookieMonsterFrameworkData&&Game.registerMod("cookieMonsterFramework",C)},y=function(e){Game.mods.cookieMonsterFramework.saveData[e]={favouriteSettings:[],headers:{},settings:{}}},b={createInfoListing:function(e){const t=document.createElement("div");return t.className="listing",t.innerHTML=e,t},createOptionsListing:function(e,o,i,m,p){const u=document.createElement("div");if(u.className="listing",1===Game.mods.cookieMonsterFramework.saveData[e].settings.FavouriteSettings&&u.appendChild(function(e,t,o){const a=document.createElement("a");return o.includes(t)?(a.innerText="★",a.style.color="yellow"):a.innerText="☆",a.className="option",a.onclick=function(){!function(e,t){Game.mods.cookieMonsterFramework.saveData[e].favouriteSettings.includes(t)?Game.mods.cookieMonsterFramework.saveData[e].favouriteSettings=Game.mods.cookieMonsterFramework.saveData[e].favouriteSettings.filter((e=>e!==t)):Game.mods.cookieMonsterFramework.saveData[e].favouriteSettings.push(t),n()}(e,t),n(),Game.UpdateMenu()},a.onmouseover=function(){Game.tooltip.draw(this,escape('
Click to set this setting as favourite and show it in \'favourite\' settings at the top of the Cookie Monster Settings
'))},a.onmouseout=function(){Game.tooltip.hide()},a.appendChild(document.createTextNode(" ")),a}(e,o,Game.mods.cookieMonsterFramework.saveData[e].favouriteSettings)),"bool"===i[o].type){const t=document.createElement("a");i[o].toggle&&0===Game.mods.cookieMonsterFramework.saveData[e].settings[o]?t.className="option off":t.className="option",t.id=`${e}Options${o}`,t.onclick=function(){!function(e,t,o){Game.mods.cookieMonsterFramework.saveData[e].settings[t]+=1,Game.mods.cookieMonsterFramework.saveData[e].settings[t]===o[t].label.length?(Game.mods.cookieMonsterFramework.saveData[e].settings[t]=0,o[t].toggle&&(l(`${e}Options${t}`).className="option off")):l(`${e}Options${t}`).className="option",void 0!==o[t].func&&o[t].func(),n()}(e,o,i),Game.UpdateMenu()},t.textContent=i[o].label[Game.mods.cookieMonsterFramework.saveData[e].settings[o]],u.appendChild(t);const a=document.createElement("label");return a.textContent=i[o].desc,a.style.lineHeight="1.6",u.appendChild(a),u}if("vol"===i[o].type){const t=document.createElement("div");t.className="sliderBox";const a=document.createElement("div");a.style.float="left",a.innerHTML=i[o].desc,t.appendChild(a);const n=document.createElement("div");n.id=`slider${e}${o}right`,n.style.float="right",n.innerHTML=`${Game.mods.cookieMonsterFramework.saveData[e].settings[o]}%`,t.appendChild(n);const r=document.createElement("input");r.className="slider",r.id=`slider${e}${o}`,r.style.clear="both",r.type="range",r.min="0",r.max="100",r.step="1",r.value=Game.mods.cookieMonsterFramework.saveData[e].settings[o],r.oninput=function(){d(e,o),Game.UpdateMenu()},r.onchange=function(){d(e,o),Game.UpdateMenu()},t.appendChild(r),u.appendChild(t);const s=document.createElement("a");return s.className="option",s.onclick=function(){c(e,Game.mods.cookieMonsterFramework.saveData[e].settings[o.replace("Volume","SoundURL")],o.replace("Volume","Sound"),o,!0)},s.textContent="Test sound",u.appendChild(s),u}if("url"===i[o].type){const a=document.createElement("span");a.className="option",a.textContent=`${i[o].label} `,a.style.lineHeight="1.6",u.appendChild(a);const r=document.createElement("input");r.id=`${e}Options${o}`,r.className="option",r.type="text",r.readOnly=!0,r.value=Game.mods.cookieMonsterFramework.saveData[e].settings[o],r.style.width="300px",u.appendChild(r),u.appendChild(document.createTextNode(" "));const s=document.createElement("input");s.id=`${e}Options${o}Prompt`,s.className="option",s.type="text",s.value=Game.mods.cookieMonsterFramework.saveData[e].settings[o];const c=document.createElement("a");c.className="option",c.onclick=function(){t(s.outerHTML,[["Save",function(){Game.mods.cookieMonsterFramework.saveData[e].settings[o]=l(`${e}Options${o}Prompt`).value,n(),Game.ClosePrompt(),Game.UpdateMenu()}],["Cancel",function(){Game.ClosePrompt()}]])},c.textContent="Edit",u.appendChild(c);const d=document.createElement("label");return d.textContent=i[o].desc,d.style.lineHeight="1.6",u.appendChild(d),u}if("colour"===i[o].type){const t=document.createElement("span");t.className="option";const l=document.createElement("input");l.id=o,l.style.width="65px",l.value=Game.mods.cookieMonsterFramework.saveData[e].settings[o],t.appendChild(l),new r(l,{hash:!0,position:"right",onInput:function(){Game.mods.cookieMonsterFramework.saveData[e].settings[this.targetElement.id]=this.toHEXString(),m(),n(),Game.UpdateMenu()}});const c=document.createElement("label");if(c.textContent=i[o].desc,c.style.lineHeight="1.6",t.appendChild(c),o.includes("Flash")){const n=document.createElement("a");n.className="option",n.onclick=function(){a(e,3,o.replace("Colour",""),!0)},n.textContent="Test flash",t.appendChild(n)}return u.appendChild(t),s().init(),u}if("numscale"===i[o].type){const t=document.createElement("span");t.className="option",t.textContent=`${i[o].label} `,t.style.lineHeight="1.6",u.appendChild(t);const a=document.createElement("input");a.id=`${e}Options${o}`,a.className="option",a.type="number",a.value=Game.mods.cookieMonsterFramework.saveData[e].settings[o],a.min=i[o].min,a.max=i[o].max,a.oninput=function(){Game.mods.cookieMonsterFramework.saveData[e].settings[o]=this.value,n(),p(),Game.UpdateMenu()},u.appendChild(a),u.appendChild(document.createTextNode(" "));const r=document.createElement("label");return r.textContent=i[o].desc,r.style.lineHeight="1.6",u.appendChild(r),u}if("keycode"===i[o].type){const a=document.createElement("input");a.id=`${e}Options${o}Prompt`,a.className="option",a.type="text",a.value=Game.mods.cookieMonsterFramework.saveData[e].settings[o].displayName;const r=document.createElement("a");r.className="option",r.id=`${e}Options${o}`,r.onclick=function(){t(a.outerHTML,[]),l(`${e}Options${o}Prompt`).addEventListener("keyup",(t=>{!function(e,t,o){const a={key:o.key,altKey:o.altKey,ctrlKey:o.ctrlKey,shiftKey:o.shiftKey,displayName:`${o.shiftKey?"Shift + ":""}${o.altKey?"Alt + ":""}${o.ctrlKey?"Ctrl + ":""}${o.key}`};Game.mods.cookieMonsterFramework.saveData[e].settings[t]=a,n()}(e,o,t),Game.ClosePrompt(),Game.UpdateMenu()}))},r.textContent=Game.mods.cookieMonsterFramework.saveData[e].settings[o].displayName,u.appendChild(r);const s=document.createElement("label");return s.textContent=i[o].desc,s.style.lineHeight="1.6",u.appendChild(s),u}return u},createOptionsSubHeader:function(e,t,o){const a=document.createElement("div");a.className="title",a.style.opacity="0.7",a.style.fontSize="17px",a.appendChild(document.createTextNode(`${o} `));const n=document.createElement("span");return n.style.cursor="pointer",n.style.display="inline-block",n.style.height="14px",n.style.width="14px",n.style.borderRadius="7px",n.style.textAlign="center",n.style.backgroundColor="#C0C0C0",n.style.color="black",n.style.fontSize="13px",n.style.verticalAlign="middle",n.textContent=Game.mods.cookieMonsterFramework.saveData[e].headers[t]?"-":"+",n.onclick=function(){i(e,t),Game.UpdateMenu()},a.appendChild(n),a}},G=function(e,t,o){const a=document.createElement("div");a.className="subsection",a.id=`${e}MenuSection`;const n=document.createElement("div");n.className="title",n.style.fontSize="18px",n.innerHTML=t;const r=document.createElement("span");return r.style.cursor="pointer",r.style.display="inline-block",r.style.height="14px",r.style.width="14px",r.style.borderRadius="7px",r.style.textAlign="center",r.style.backgroundColor="#C0C0C0",r.style.color="black",r.style.fontSize="13px",r.style.verticalAlign="middle",r.textContent=Game.mods.cookieMonsterFramework.saveData[e].headers[o]?"-":"+",r.onclick=function(){i(e,o),Game.UpdateMenu()},n.appendChild(r),a.appendChild(n),a},v={createFlash:a,createNotification:function(e,t,o,a){1===Game.mods.cookieMonsterFramework.saveData[e].settings[t]&&"hidden"===document.visibilityState&&!1===window.cookieMonsterFrameworkData.isInitializing&&new Notification(o,{body:a,badge:"https://orteil.dashnet.org/cookieclicker/favicon.ico"})},cookieMonsterPrompt:t,playCMSound:c},w={loadMod:h,saveFramework:n},x=class extends e{constructor(e,t,o,a){super(e,t,o),this.desc=a}},T=class extends e{constructor(e,t,o,a,n,i,r){super(e,t,o),this.label=a,this.desc=n,this.min=i,this.max=r}},S=class extends e{constructor(e,t,o,a,n,i){super(e,t,o),this.label=a,this.desc=n,this.toggle=i}},F=class extends e{constructor(e,t,o,a,n,i,r){super(e,t,o),this.label=a,this.desc=n,this.toggle=i,void 0!==r&&(this.func=r)}},E=class extends e{constructor(e,t,o,a,n){super(e,t,o),this.label=a,this.desc=n;for(let e=0;e<101;e++)this.label[e]=`${e}%`}};function B(){Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerButtons&&Game.elderWrath?(l("PopAllNormalWrinklerButton").style.display="",l("PopFattestWrinklerButton").style.display=""):(l("PopAllNormalWrinklerButton").style.display="none",l("PopFattestWrinklerButton").style.display="none")}const P=["","","M","G","T","P","E","Z","Y"],N=["","","M","B","Tr","Quadr","Quint","Sext","Sept","Oct","Non","Dec","Undec","Duodec","Tredec","Quattuordec","Quindec","Sexdec","Septendec","Octodec","Novemdec","Vigint","Unvigint","Duovigint","Trevigint","Quattuorvigint"],O=["","K","M","B","T","Qa","Qi","Sx","Sp","Oc","No","De","UDe","DDe","TDe","QaDe","QiDe","SxDe","SpDe","ODe","NDe","Vi","UVi","DVi","TVi","QaVi","QiVi","SxVi","SpVi","OVi","NVi","Tr","UTr","DTr","TTr","QaTr","QiTr","SxTr","SpTr","OTr","NTr","Qaa","UQa","DQa","TQa","QaQa","QiQa","SxQa","SpQa","OQa","NQa","Qia","UQi","DQi","TQi","QaQi","QiQi","SxQi","SpQi","OQi","NQi","Sxa","USx","DSx","TSx","QaSx","QiSx","SxSx","SpSx","OSx","NSx","Spa","USp","DSp","TSp","QaSp","QiSp","SxSp","SpSp","OSp","NSp","Oco","UOc","DOc","TOc","QaOc","QiOc","SxOc","SpOc","OOc","NOc","Noa","UNo","DNo","TNo","QaNo","QiNo","SxNo","SpNo","ONo","NNo","Ct","UCt"];let D,L,A,W,j,$,H,U,R,I,z,V,_,X,Q,q,Y=[],K=[],J=[],Z={},ee=Date.now(),te=Date.now();function oe(e,t,o){const a=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ScaleDecimals+1;if(e===1/0)return"Infinity";if(void 0===e)return"0";if(0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Scale)return Z.Beautify(e,t);if(Number.isFinite(e)){if(e<0)return`-${oe(Math.abs(e))}`;let n="";if(0===e)return e.toString();if(e>.001&&e=.01&&e=.01&&e=.01&&e0&&(c+=o,l-=1)}return c}const to="CMText",oo="CMBack",ao="Blue",no="Green",io="Yellow",ro="Orange",so="Red",lo="Purple",co="Gray",mo="Pink",po="Brown",uo=[ao,no,io,ro,so,lo,mo,po,co],ho=[["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"],["FavouriteSettingPlaceholder","Click to set this setting as favourite and show it in 'favourite' settings at the top of the Cookie Monster Settings","250px"]],go={};let fo,ko=0,Co=-1,Mo=[],yo=function(){},bo=1,Go=1,vo=1;const wo=[10,15,30,60,300,600,900,1800],xo=[1,5,10,15,30],To={Frenzy:io,"Dragon Harvest":po,"Elder frenzy":no,Clot:so,"Click frenzy":ao,Dragonflight:mo};let So,Fo,Eo,Bo,Po,No,Oo,Do={},Lo="";function Ao(){let e,t=Game.buyBulk;1===Game.buyMode?Go=t:t=Go,1===t?t=lt:10===t?t=ct:100===t&&(t=dt),l("storeBulk1").style.removeProperty("color"),l("storeBulk10").style.removeProperty("color"),l("storeBulk100").style.removeProperty("color"),1===Game.buyMode?1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BuildColour?(Object.keys(t).forEach((e=>{l(`productPrice${Game.Objects[e].id}`).style.color=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[`Colour${t[e].colour}`]})),l(`storeBulk${Ht}`).style.color=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ColourGreen):Object.keys(Game.Objects).forEach((e=>{l(`productPrice${Game.Objects[e].id}`).style.removeProperty("color")})):-1===Game.buyMode&&Object.keys(lt).forEach((e=>{const t=Game.Objects[e];l(`productPrice${t.id}`).style.color="",l(`productPrice${t.id}`).innerHTML=oe(eo(t,t.basePrice,t.amount,t.free,Game.buyBulk,1))})),1===Game.buyMode&&Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortBuildings?1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortBuildings?(e=Object.keys(lt).map((e=>{const t={};return t.name=e,t.pp=lt[e].pp,t.colour=lt[e].colour,t})),e.sort(((e,t)=>uo.indexOf(e.colour)===uo.indexOf(t.colour)?e.pp-t.pp:uo.indexOf(e.colour)-uo.indexOf(t.colour)))):2===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortBuildings?(e=Object.keys(t).map((e=>{const o={};return o.name=e,o.pp=t[e].pp,o.colour=t[e].colour,o})),e.sort(((e,t)=>uo.indexOf(e.colour)===uo.indexOf(t.colour)?e.pp-t.pp:uo.indexOf(e.colour)-uo.indexOf(t.colour)))):3===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortBuildings&&(e=Object.keys(mt).map((e=>{const t={};return t.name=e,t.id=Game.Objects[e].id,t.amountUntilNext=mt[e].AmountNeeded,t.priceUntilNext=mt[e].price,t})),e.sort(((e,t)=>e.id-t.id)),e.sort(((e,t)=>(101!==e.amountUntilNext?e.priceUntilNext:1/0)-(101!==t.amountUntilNext?t.priceUntilNext:1/0)))):(e=Object.keys(lt).map((e=>{const t={};return t.name=e,t.id=Game.Objects[e].id,t})),e.sort(((e,t)=>e.id-t.id)));for(let t=0;t{Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpgradesNeverCollapse||"products"===e.id?e.style.height="auto":"vaultUpgrades"===e.id?(e.style.height="",e.style.minHeight="0px"):"upgrades"===e.id?(e.style.height="",e.className.includes("hasMenu")?e.style.minHeight="82px":e.style.minHeight="60px"):(e.style.height="",e.style.minHeight="60px")}))}function jo(){if(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpBarColour>0){let e=0,t=0,o=0,a=0,n=0,i=0,r=0;Object.keys(Game.UpgradesInStore).forEach((s=>{const c=Game.UpgradesInStore[s];let d=!1;for(let e=0;euo.indexOf(e.colour)===uo.indexOf(t.colour)?e.pp-t.pp:uo.indexOf(e.colour)-uo.indexOf(t.colour))):e.sort(((e,t)=>e.price-t.price));const t=function(e,t){return e.findIndex((e=>e.name===t.name))};for(let o=0;o7776e5)return t?"Over 9000 days!":">9000d";l+=a>0?a+(t?1===a?" year":" years":"y")+", ":"",(l.length>0||n>0)&&(l+=n+(t?1===n?" day":" days":"d")+", "),(l.length>0||i>0)&&(l+=i+(t?1===i?" hour":" hours":"h")+", "),(l.length>0||r>0)&&(l+=r+(t?1===r?" minute":" minutes":"m")+", "),l+=s+(t?1===s?" second":" seconds":"s")}else if(1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimeFormat){if(o>315576e4)return"XX:XX:XX:XX:XX";l+=(a<10?"0":"")+a+":",l+=(n<10?"0":"")+n+":",l+=(i<10?"0":"")+i+":",l+=(r<10?"0":"")+r+":",l+=(s<10?"0":"")+s}else{if(o>7776e5)return t?"Over 9000 days!":">9000d";a>0?(l+=a+(t?1===a?" year":" years":"y")+", ",l+=n+(t?1===n?" day":" days":"d")):n>0?(l+=n+(t?1===n?" day":" days":"d")+", ",l+=i+(t?1===i?" hour":" hours":"h")):i>0?(l+=i+(t?1===i?" hour":" hours":"h")+", ",l+=r+(t?1===r?" minute":" minutes":"m")):r>0?(l+=r+(t?1===r?" minute":" minutes":"m")+", ",l+=s+(t?1===s?" second":" seconds":"s")):l+=s+(t?1===s?" second":" seconds":"s")}return l}function Ho(e){let t,o;return e<=0?(o=1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimeFormat?"00:00:00:00:00":"Done!",t=no):(o=$o(e),t=e>300?so:e>60?ro:io),{text:o,colour:t}}function Uo(){return Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CPSMode?Me:0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink?Game.cookiesPs*(1-Game.cpsSucked):1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink?Game.cookiesPs*(gt+(1-.05*ft)):null!==ht[1]&&2===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink&&1===Game.wrinklers[ht[1]].type?Game.cookiesPs*(3*gt/ft+(1-.05*ft)):Game.cookiesPs*(gt/ft+(1-.05*ft))}function Ro(){return 1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink?pt:2===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink?ht[0]:0}function Io(e,t,o){const a=document.createElement("div");a.id=e,a.style.height="12px",a.style.margin="0px 10px",a.style.position="relative";const n=document.createElement("div");n.style.width="100%",n.style.height="10px",n.style.margin="auto",n.style.position="absolute",n.style.left="0px",n.style.top="0px",n.style.right="0px",n.style.bottom="0px";const i=document.createElement("span");i.style.display="inline-block",i.style.textAlign="right",i.style.fontSize="10px",i.style.width="108px",i.style.marginRight="5px",i.style.verticalAlign="text-top",i.textContent=t,n.appendChild(i);for(let e=0;e{let o,a=Game.buyBulk;1===Game.buyMode?bo=a:a=bo,1===a&&(a=lt),10===a&&(a=ct),100===a&&(a=dt),e+=1,l("CMBotBar").firstChild.firstChild.childNodes[0].childNodes[e].childNodes[1].textContent=Game.Objects[t].amount,l("CMBotBar").firstChild.firstChild.childNodes[1].childNodes[e].textContent=oe(a[t].bonus,2),l("CMBotBar").firstChild.firstChild.childNodes[2].childNodes[e].className=to+a[t].colour,o=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPDisplayTime?$o(Math.round(a[t].pp)):oe(Math.round(a[t].pp),2),l("CMBotBar").firstChild.firstChild.childNodes[2].childNodes[e].textContent=o;const n=Ho((Game.Objects[t].bulkPrice-(Game.cookies+Ro()))/Uo());l("CMBotBar").firstChild.firstChild.childNodes[3].childNodes[e].className=to+n.colour,"Done!"===n.text&&Game.cookies{!Game.Tiers[e.tieredUpgrades[o].tier].special&&Kt(e.tieredUpgrades[o].name)&&(t*=2)})),Object.keys(e.synergies).forEach((o=>{if(Kt(e.synergies[o].name)){const a=e.synergies[o];a.buildingTie1.name===e.name?t*=1+.05*a.buildingTie2.amount:a.buildingTie2.name===e.name&&(t*=1+.001*a.buildingTie1.amount)}})),e.fortune&&Kt(e.fortune.name)&&(t*=1.07),e.grandma&&Kt(e.grandma.name)&&(t*=1+.01*Vt.Grandma.amount*(1/(e.id-1))),"object"==typeof e.tieredUpgrades.misfortune&&1===e.vanilla&&Kt(e.tieredUpgrades.misfortune.name))switch(Game.elderWrath){default:t*=1;break;case 1:t*=1.02;break;case 2:t*=1.04;break;case 3:t*=1.06}return t}function Jo(e){const t=Game.Objects[e],o={};return"Cursor"===t.name?o.cps=function(e){let t=0;Kt("Thousand fingers")&&(t+=.1),Kt("Million fingers")&&(t*=5),Kt("Billion fingers")&&(t*=10),Kt("Trillion fingers")&&(t*=20),Kt("Quadrillion fingers")&&(t*=20),Kt("Quintillion fingers")&&(t*=20),Kt("Sextillion fingers")&&(t*=20),Kt("Septillion fingers")&&(t*=20),Kt("Octillion fingers")&&(t*=20),Kt("Nonillion fingers")&&(t*=20);let o=1,a=0;return Object.keys(Vt).forEach((e=>{"Cursor"!==Vt[e].name&&(a+=Vt[e].amount)})),t*=a,o*=Ko(e),o*=Game.magicCpS("Cursor"),o*=Yt("cursorCps"),Game.ComputeCps(.1,Kt("Reinforced index finger")+Kt("Carpal tunnel prevention cream")+Kt("Ambidextrous"),t)*o}:"Grandma"===t.name?o.cps=function(e){let o=1;if(Object.keys(Game.GrandmaSynergies).forEach((e=>{Kt(Game.GrandmaSynergies[e])&&(o*=2)})),Kt("Bingo center/Research facility")&&(o*=4),Kt("Ritual rolling pins")&&(o*=2),Kt("Naughty list")&&(o*=2),Kt("Elderwort biscuits")&&(o*=1.02),o*=Yt("grandmaCps"),Kt("Cat ladies"))for(let e=0;e{"Grandma"!==Vt[e].name&&(n+=Vt[e].amount)})),o*=1+.01*Qt("Elder Battalion")*n,o*=Game.magicCpS(t.name),(t.baseCps+a)*o}:o.cps=function(e){let t=1;return t*=Ko(e),t*=Game.magicCpS(e.name),e.baseCPS*t},o.baseCps=t.baseCps,o.name=t.name,o.tieredUpgrades=t.tieredUpgrades,o.synergies=t.synergies,o.fortune=t.fortune,o.grandma=t.grandma,o.baseCPS=t.baseCps,o.id=t.id,o.vanilla=t.vanilla,o}function Zo(e){const t=Game.Upgrades[e],o={};return o.power=t.power,"function"==typeof o.power&&("Sugar crystal cookies"===t.name?o.power=function(){let e=5;return Object.keys(Vt).forEach((t=>{Vt[t].level>=10&&(e+=1)})),e}:o.power=function(){let e=2;if(Kt("Starlove")&&(e=3),Game.hasGod){const t=Jt("seasons");1===t?e*=1.3:2===t?e*=1.2:3===t&&(e*=1.1)}return e}),o.pool=t.pool,o.name=t.name,o}function ea(){xe=Game.UpgradesOwned,Te=Game.pledges,Se=Game.AchievementsOwned,Fe=Game.heavenlyPower,Ee=Game.prestige,Object.keys(Game.Objects).forEach((e=>{const t=Game.Objects[e];let o=Vt[e];void 0===o&&(Vt[e]=Jo(e),o=Vt[e],zo(e)),o.amount=t.amount,o.level=t.level,o.totalCookies=t.totalCookies,o.basePrice=t.basePrice,o.free=t.free,t.minigameLoaded&&("Temple"===t.name&&(Ne=t.minigame.slot[0],Oe=t.minigame.slot[1],De=t.minigame.slot[2]),o.minigameLoaded=t.minigameLoaded,o.minigame=t.minigame),Vt[e]=o})),Object.keys(Game.Upgrades).forEach((e=>{const t=Game.Upgrades[e];let o=_t[e];void 0===o&&(_t[e]=Zo(e),o=_t[e]),o.bought=t.bought,_t[e]=o})),Object.keys(Game.Achievements).forEach((e=>{const t=Game.Achievements[e];let o=Xt[e];void 0===o&&(Xt[e]=Yo(e),o=Xt[e]),o.won=t.won,Xt[e]=o})),qo(),Be=He,Pe=Ue}function ta(e){const t=document.createElement("div");return t.style.fontWeight="bold",t.id=`${e}Title`,t.className="CMTextBlue",t.textContent=e,t}function oa(e){e.appendChild(ta("Bonus Income"));const t=document.createElement("div");t.style.marginBottom="4px",t.style.color="white",t.id="CMTooltipIncome",e.appendChild(t),e.appendChild(ta("Bonus Cookies per Click")),e.lastChild.style.display="none";const o=document.createElement("div");o.style.marginBottom="4px",o.style.color="white",o.style.display="none",o.id="CMTooltipCookiePerClick",e.appendChild(o),e.appendChild(ta("Payback Period"));const a=document.createElement("div");a.style.marginBottom="4px",a.id="CMTooltipPP",e.appendChild(a),e.appendChild(ta("Time Left"));const n=document.createElement("div");if(n.id="CMTooltipTime",e.appendChild(n),"b"===Eo){e.appendChild(ta("Production left till next achievement")),e.lastChild.id="CMTooltipProductionLeftHeader";const t=document.createElement("div");t.id="CMTooltipProductionLeft",e.appendChild(t)}if("b"===Eo){e.appendChild(ta("Buildings (price / PP) left till next achievement")),e.lastChild.id="CMTooltipNextAchievementHeader";const t=document.createElement("div");t.id="CMTooltipNextAchievement",e.appendChild(t)}}function aa(e,t){let o="";return o=e.pp<=0||e.pp===1/0?co:e.pp<$t?ao:e.pp===$t?no:e.pp0&&(o=so),o}function na(){let e=1;return Object.keys(Game.buffs).forEach((t=>{void 0!==Game.buffs[t].multCpS&&(e*=Game.buffs[t].multCpS)})),e}function ia(e){Xt[e]&&0===Xt[e].won&&(Xt[e].won=1,"shadow"!==Game.Achievements[e].pool&&(Se+=1))}function ra(){We=0;let e=1;const t={};Object.keys(Game.Objects).forEach((e=>{if(Game.Objects[e].minigameLoaded&&Game.Objects[e].minigame.effs){const o=Game.Objects[e].minigame.effs;Object.keys(o).forEach((e=>{t[e]?t[e]*=o[e]:t[e]=o[e]}))}})),Ae=t,1!==Game.ascensionMode&&(e+=.01*parseFloat(Ee)*Fe*function(){let e=0;if(Kt("Heavenly chip secret")&&(e+=.05),Kt("Heavenly cookie stand")&&(e+=.2),Kt("Heavenly bakery")&&(e+=.25),Kt("Heavenly confectionery")&&(e+=.25),Kt("Heavenly key")&&(e+=.25),e*=1+.05*Qt("Dragon God"),Kt("Lucky digit")&&(e*=1.01),Kt("Lucky number")&&(e*=1.01),Kt("Lucky payout")&&(e*=1.01),Game.hasGod){const t=Jt("creation");1===t?e*=.7:2===t?e*=.8:3===t&&(e*=.9)}return e}()),e*=Yt("cps"),Kt("Heralds")&&1!==Game.ascensionMode&&(e*=1+.01*Game.heralds),Object.keys(Game.cookieUpgrades).forEach((t=>{const o=Game.cookieUpgrades[t];Kt(o.name)&&("function"==typeof o.power?e*=1+.01*_t[o.name].power(_t[o.name]):e*=1+.01*o.power)})),Kt("Specialized chocolate chips")&&(e*=1.01),Kt("Designer cocoa beans")&&(e*=1.02),Kt("Underworld ovens")&&(e*=1.03),Kt("Exotic nuts")&&(e*=1.04),Kt("Arcane sugar")&&(e*=1.05),Kt("Increased merriness")&&(e*=1.15),Kt("Improved jolliness")&&(e*=1.15),Kt("A lump of coal")&&(e*=1.01),Kt("An itchy sweater")&&(e*=1.01),Kt("Santa's dominion")&&(e*=1.2),Kt("Fortune #100")&&(e*=1.01),Kt("Fortune #101")&&(e*=1.07),Kt("Dragon scale")&&(e*=1.03);let o=1;if(Jt){let t=Jt("asceticism");1===t?e*=1.15:2===t?e*=1.1:3===t&&(e*=1.05),t=Jt("ages"),1===t?e*=1+.15*Math.sin(ee/1e3/10800*Math.PI*2):2===t?e*=1+.15*Math.sin(ee/1e3/43200*Math.PI*2):3===t&&(e*=1+.15*Math.sin(ee/1e3/86400*Math.PI*2)),t=Jt("decadence"),1===t?o*=.93:2===t?o*=.95:3===t&&(o*=.98),t=Jt("industry"),1===t?o*=1.1:2===t?o*=1.06:3===t&&(o*=1.03),t=Jt("labor"),1===t?o*=.97:2===t?o*=.98:3===t&&(o*=.99)}Kt("Santa's legacy")&&(e*=1+.03*(Game.santaLevel+1));const a=Se/25;let n=1;if(Kt("Santa's milk and cookies")&&(n*=1.05),n*=1+.05*Qt("Breath of Milk"),Jt){const e=Jt("mother");1===e?n*=1.1:2===e?n*=1.05:3===e&&(n*=1.03)}n*=Yt("milk");let i=1;Kt("Kitten helpers")&&(i*=1+.1*a*n),Kt("Kitten workers")&&(i*=1+.125*a*n),Kt("Kitten engineers")&&(i*=1+.15*a*n),Kt("Kitten overseers")&&(i*=1+.175*a*n),Kt("Kitten managers")&&(i*=1+.2*a*n),Kt("Kitten accountants")&&(i*=1+.2*a*n),Kt("Kitten specialists")&&(i*=1+.2*a*n),Kt("Kitten experts")&&(i*=1+.2*a*n),Kt("Kitten consultants")&&(i*=1+.2*a*n),Kt("Kitten assistants to the regional manager")&&(i*=1+.175*a*n),Kt("Kitten marketeers")&&(i*=1+.15*a*n),Kt("Kitten analysts")&&(i*=1+.125*a*n),Kt("Kitten executives")&&(i*=1+.115*a*n),Kt("Kitten angels")&&(i*=1+.1*a*n),Kt("Fortune #103")&&(i*=1+.05*a*n),Object.keys(Vt).forEach((e=>{const t=Vt[e];let i=t.cps(t);1!==Game.ascensionMode&&(i*=(1+.01*t.level)*o),"Grandma"===t.name&&Kt("Milkhelp® lactose intolerance relief tablets")&&(i*=1+.05*a*n),We+=t.amount*i})),Kt('"egg"')&&(We+=9),e*=i;let r=1;if(Kt("Chicken egg")&&(r*=1.01),Kt("Duck egg")&&(r*=1.01),Kt("Turkey egg")&&(r*=1.01),Kt("Quail egg")&&(r*=1.01),Kt("Robin egg")&&(r*=1.01),Kt("Ostrich egg")&&(r*=1.01),Kt("Cassowary egg")&&(r*=1.01),Kt("Salmon roe")&&(r*=1.01),Kt("Frogspawn")&&(r*=1.01),Kt("Shark egg")&&(r*=1.01),Kt("Turtle egg")&&(r*=1.01),Kt("Ant larva")&&(r*=1.01),Kt("Century egg")){let e=10*Math.floor((te-Game.startDate)/1e3/10)/60/60/24;e=Math.min(e,100),it=1+.1*(1-(1-e/100)**3),r*=it}e*=r,Kt("Sugar baking")&&(e*=1+.01*Math.min(100,Game.lumps)),e*=1+Qt("Radiant Appetite");const s=We*e;Object.keys(Game.CpsAchievements).forEach((e=>{s>=Game.CpsAchievements[e].threshold&&ia(Game.CpsAchievements[e].name)})),je=s;const{n:l}=Game.shimmerTypes.golden,c=Qt("Dragon's Fortune");for(let t=0;t{Kt(e[o])&&(t+=.1)}))}e*=t}if(Kt("Shimmering veil [off]")){let t=.5;Kt("Reinforced membrane")&&(t+=.1),e*=1+t}Kt("Magic shenanigans")&&(e*=1e3),Kt("Occult obstruction")&&(e*=0),We=Game.runModHookOnValue("cps",We),e*=na(),We*=e}const sa=["Fortune #001","Fortune #002","Fortune #003","Fortune #004","Fortune #005","Fortune #006","Fortune #007","Fortune #008","Fortune #009","Fortune #010","Fortune #011","Fortune #012","Fortune #013","Fortune #014","Fortune #015","Fortune #016","Fortune #017","Fortune #018","Fortune #100","Fortune #101","Fortune #102","Fortune #103","Fortune #104"],la=["Skull cookies","Ghost cookies","Bat cookies","Slime cookies","Pumpkin cookies","Eyeball cookies","Spider cookies"],ca=["Christmas tree biscuits","Snowflake biscuits","Snowman biscuits","Holly biscuits","Candy cane biscuits","Bell biscuits","Present biscuits"],da=["Pure heart biscuits","Ardent heart biscuits","Sour heart biscuits","Weeping heart biscuits","Golden heart biscuits","Eternal heart biscuits","Prism heart biscuits"],ma=["Elderwort biscuits","Bakeberry cookies","Duketater cookies","Green yeast digestives","Wheat slims","Fern tea","Ichor syrup"];function pa(e){return Xt[e]?Xt[e].won:0}function ua(){let e=0;Object.keys(Game.GrandmaSynergies).forEach((t=>{Kt(Game.GrandmaSynergies[t])&&(e+=1)})),!pa("Elder")&&e>=7&&ia("Elder"),!pa("Veteran")&&e>=14&&ia("Veteran");let t=0,o=1,a=1,n=1e5;Object.keys(Vt).forEach((e=>{t+=Vt[e].amount,n=Math.min(Vt[e].amount,n),pa("Mathematician")||Vt[e].amount=1&&ia("One with everything"),1===o&&ia("Mathematician"),1===a&&ia("Base 10"),n>=100&&ia("Centennial"),n>=150&&ia("Centennial and a half"),n>=200&&ia("Bicentennial"),n>=250&&ia("Bicentennial and a half"),n>=300&&ia("Tricentennial"),n>=350&&ia("Tricentennial and a half"),n>=400&&ia("Quadricentennial"),n>=450&&ia("Quadricentennial and a half"),n>=500&&ia("Quincentennial"),n>=550&&ia("Quincentennial and a half"),n>=600&&ia("Sexcentennial"),t>=100&&ia("Builder"),t>=500&&ia("Architect"),t>=1e3&&ia("Engineer"),t>=2e3&&ia("Lord of Constructs"),t>=4e3&&ia("Grand design"),t>=8e3&&ia("Ecumenopolis"),xe>=20&&ia("Enhancer"),xe>=50&&ia("Augmenter"),xe>=100&&ia("Upgrader"),xe>=200&&ia("Lord of Progress"),xe>=300&&ia("The full picture"),xe>=400&&ia("When there's nothing left to add"),t>=4e3&&xe>=300&&ia("Polymath"),t>=8e3&&xe>=400&&ia("Renaissance baker"),Vt.Cursor.amount+Vt.Grandma.amount>=777&&ia("The elder scrolls");let i=!0;Object.keys(la).forEach((e=>{Kt(la[e])||(i=!1)})),i&&ia("Spooky cookies");let r=!0;if(Object.keys(ca).forEach((e=>{Kt(ca[e])||(r=!1)})),r&&ia("Let it snow"),Kt("Fortune cookies")){const e=Game.Tiers.fortune.upgrades;let t=0;Object.keys(e).forEach((o=>{Kt(e[o].name)&&(t+=1)})),t>=e.length&&ia("O Fortuna")}}function ha(e,t){ea(),Vt[e].amount+=t;const o=Vt[e];"Cursor"===e?(o.amount>=1&&ia("Click"),o.amount>=2&&ia("Double-click"),o.amount>=50&&ia("Mouse wheel"),o.amount>=100&&ia("Of Mice and Men"),o.amount>=200&&ia("The Digital"),o.amount>=300&&ia("Extreme polydactyly"),o.amount>=400&&ia("Dr. T"),o.amount>=500&&ia("Thumbs, phalanges, metacarpals"),o.amount>=600&&ia("With her finger and her thumb"),o.amount>=700&&ia("Gotta hand it to you"),o.amount>=800&&ia("The devil's workshop")):Object.keys(Game.Objects[o.name].tieredAchievs).forEach((e=>{o.amount>=Game.Tiers[Game.Objects[o.name].tieredAchievs[e].tier].achievUnlock&&ia(Game.Objects[o.name].tieredAchievs[e].name)}));const a=Se;return ra(),ua(),a!==Se&&ra(),We-Game.cookiesPs}function ga(e,t,o){let a=e,n=0;for(;ae.plantsById[e.plot[Bo[1]][Bo[0]][0]-1].mature,o=e.plantsById[e.plot[Bo[1]][Bo[0]][0]-1].name;l("CMTooltipBorder").appendChild(ta("Reward (Current / Maximum)"));const a=document.createElement("div");a.id="CMTooltipPlantReward",l("CMTooltipBorder").appendChild(a),"Bakeberry"===o?l("CMTooltipPlantReward").textContent=`${t?oe(Math.min(.03*Game.cookies,60*Game.cookiesPs*30)):"0"} / ${oe(60*Game.cookiesPs*30)}`:"Chocoroot"===o||"White chocoroot"===o?l("CMTooltipPlantReward").textContent=`${t?oe(Math.min(.03*Game.cookies,60*Game.cookiesPs*3)):"0"} / ${oe(60*Game.cookiesPs*3)}`:"Queenbeet"===o?l("CMTooltipPlantReward").textContent=`${t?oe(Math.min(.04*Game.cookies,60*Game.cookiesPs*60)):"0"} / ${oe(60*Game.cookiesPs*60)}`:"Duketater"===o?l("CMTooltipPlantReward").textContent=`${t?oe(Math.min(.08*Game.cookies,60*Game.cookiesPs*120)):"0"} / ${oe(60*Game.cookiesPs*120)}`:l("CMTooltipArea").style.display="none"}else l("CMTooltipArea").style.display="none"}():"ha"===Eo?function(){const{minigame:e}=Game.Objects.Farm;if(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipLump){l("CMTooltipBorder").appendChild(ta("Cookies gained from harvesting:"));let t=0,o=0;Game.keys[16]&&Game.keys[17]&&(o=1);for(let a=0;a<6;a++)for(let n=0;n<6;n++)if(e.plot[a][n][0]>=1){const i=e.plot[a][n],r=e.plantsById[i[0]-1],s=r.name;let l=!0;o&&r.immortal&&(l=!1),i[1]0&&e=1?l("CMTimerBarAutosaveBar").textContent=Math.ceil(e):l("CMTimerBarAutosaveBar").textContent="",l("CMTimerBarAutosaveTime").textContent=Math.ceil(e),o+=1}else l("CMTimerBarAutosave").style.display="none";if(0!==Game.shimmerTypes.golden.spawned||Game.Has("Golden switch [off]"))l("CMTimerBarGC").style.display="none";else{l("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`,Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.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`,Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.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="";const t=Math.max(0,(Game.shimmerTypes.golden.time-Game.shimmerTypes.golden.minTime)/(Game.shimmerTypes.golden.maxTime-Game.shimmerTypes.golden.minTime))**5;l("CMTimerBarGCTime").textContent=`${Math.ceil((Game.shimmerTypes.golden.maxTime-Game.shimmerTypes.golden.time)/Game.fps)} ${t<.01?"<":""}${t.toLocaleString("en",{style:"percent"})}`,o+=1}if("christmas"===Game.season&&0===Game.shimmerTypes.reindeer.spawned){l("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`,Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.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`,Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.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="";const t=Math.max(0,(Game.shimmerTypes.reindeer.time-Game.shimmerTypes.reindeer.minTime)/(Game.shimmerTypes.reindeer.maxTime-Game.shimmerTypes.reindeer.minTime))**5;l("CMTimerBarRenTime").textContent=`${Math.ceil((Game.shimmerTypes.reindeer.maxTime-Game.shimmerTypes.reindeer.time)/Game.fps)} ${t<.01?"<":""}${t.toLocaleString("en",{style:"percent"})}`,o+=1}else l("CMTimerBarRen").style.display="none";const a={};l("CMTimerBarBuffTimers").innerHTML="",Object.keys(Game.buffs).forEach((e=>{if(Game.buffs[e]){const n=Io(Game.buffs[e].name,Game.buffs[e].name,[{id:`${Game.buffs[e].name}Bar`}]);n.style.display="";let i="";i=void 0!==To[Game.buffs[e].name]?To[Game.buffs[e].name]:lo,n.lastChild.children[1].className=oo+i,n.lastChild.children[1].style.color="black",2===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarOverlay?n.lastChild.children[1].textContent=`${Math.round(Game.buffs[e].time/Game.buffs[e].maxTime*100)}%`:n.lastChild.children[1].textContent="",n.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`,n.lastChild.children[2].textContent=Math.ceil(Game.buffs[e].time/Game.fps),o+=1,a[Game.buffs[e].name]=n}})),Object.keys(a).forEach((e=>{l("CMTimerBarBuffTimers").appendChild(a[e])})),0!==o&&(l("CMTimerBar").style.height=12*o+2+"px"),Oo!==o&&(Oo=o,Xo())}}(),Vo(),ka(),function(){if(1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipWrink&&1===ko){let e=!1;Object.keys(Game.wrinklers).forEach((t=>{const o=Game.wrinklers[t];if(o.phase>0&&o.selected){if(e=!0,0===Mo[t]||void 0===Mo[t]){const e=document.createElement("div"),o=document.createElement("div");o.style.minWidth="120px",o.style.marginBottom="4px";const a=document.createElement("div");a.style.textAlign="center",a.id="CMTooltipWrinkler",o.appendChild(a),e.appendChild(o),Game.tooltip.draw(this,escape(e.innerHTML)),Co=t,Mo[t]=1}}else Mo[t]=0})),e||Game.tooltip.hide()}}(),function(){if(1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipWrink&&null!==l("CMTooltipWrinkler")){let{sucked:e}=Game.wrinklers[Co],t=1.1;if(Game.Has("Sacrilegious corruption")&&(t*=1.05),1===Game.wrinklers[Co].type&&(t*=3),e*=t,Game.Has("Wrinklerspawn")&&(e*=1.05),Vt.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=oe(e)}}(),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpStats&&"stats"===Game.onMenu&&(Game.drawT-1)%(5*Game.fps)!=0&&(Game.drawT-1)%Game.fps==0&&Game.UpdateMenu(),B(),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Scale&&!Game.OnAscend){let e=l("cookies").innerHTML.replace(/.*(?=
)/i,oe(Game.cookies));Game.prefs.monospace&&(e=`${e}`),l("cookies").innerHTML=e}}function Ma(){ae.addLatest(Game.computedMouseCps)}class ya{constructor(e){this.maxLength=e,this.queue=[]}addLatest(e){this.queue.push(e)>this.maxLength&&this.queue.shift()}calcAverage(e){let t=e;t>this.maxLength&&(t=this.maxLength),t>this.queue.length&&(t=this.queue.length);let o=0;for(let e=this.queue.length-1;e>=0&&e>this.queue.length-1-t;e--)o+=this.queue[e];return 0===o?0:o/t}calcSum(e){let t=e;return t>this.maxLength&&(t=this.maxLength),t>this.queue.length&&(t=this.queue.length),0===t?0:this.queue.slice(-t).reduce(((e,t)=>e+t),0)}}function ba(e){"Cache"in window.CookieMonsterData||(window.CookieMonsterData.Cache={}),Object.keys(e).forEach((t=>{const o=t.replace(/^Cache/,"");void 0===e[t]?window.CookieMonsterData.Cache[o]=void 0:window.CookieMonsterData.Cache[o]=JSON.parse(JSON.stringify(e[t]))}))}function Ga(){const e=Math.floor(Date.now()/1e3);if(Game.T/Game.fps%1==0){let t=Game.cookies+It;Game.cpsSucked>0&&(t+=pt),Dt=Math.max(Game.cookiesEarned,t),t*=.05;const o=e-de,a=Math.max(0,Game.cookies-me)/o,n=Math.max(0,pt-pe)/o,i=Math.max(0,ht[0]-ue)/o,r=Math.max(0,t-st)/o,s=(Game.cookieClicks-he)/o;for(let e=0;e{if(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPRigidelMode&&1===t)e[o].colour=co;else{e[o].colour=aa(e[o],va(o,Game.Objects[o].basePrice,Game.Objects[o].amount,Game.Objects[o].free,t));for(let t=0;t{const a=va(o,Game.Objects[o].basePrice,Game.Objects[o].amount,Game.Objects[o].free,t);Game.cookiesPs?e[o].pp=Math.max(a-(Game.cookies+Ro()),0)/Game.cookiesPs+a/e[o].bonus:e[o].pp=a/e[o].bonus,Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPRigidelMode&&1===t||Ut.push([e[o].pp,t,a])}))}function Ta(){!function(){$t=1/0,Ut=[],void 0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPExcludeTop&&(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPExcludeTop=0),xa(lt,1),xa(ct,10),xa(dt,100),Ut.sort(((e,t)=>e[0]-t[0]));let e=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPExcludeTop;if(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPOnlyConsiderBuyable)for(;Ut[e][2]>Game.cookies&&(e+=1,Ut.length!==e+1););$t=Ut[e][0],Ht=Ut[e][1],wa(lt,1),wa(ct,10),wa(dt,100),ba({CacheMinPP:$t,CacheMinPPBulk:Ht,CachePPArray:Ut})}(),Object.keys(kt).forEach((e=>{Game.cookiesPs?kt[e].pp=Math.max(Game.Upgrades[e].getPrice()-(Game.cookies+Ro()),0)/Game.cookiesPs+Game.Upgrades[e].getPrice()/kt[e].bonus:kt[e].pp=Game.Upgrades[e].getPrice()/kt[e].bonus,Number.isNaN(kt[e].pp)&&(kt[e].pp=1/0),kt[e].colour=aa(kt[e],Game.Upgrades[e].getPrice())})),window.CookieMonsterData.Objects1=JSON.parse(JSON.stringify(lt)),window.CookieMonsterData.Objects10=JSON.parse(JSON.stringify(ct)),window.CookieMonsterData.Objects100=JSON.parse(JSON.stringify(dt)),window.CookieMonsterData.Upgrades=[],Object.entries(kt).forEach((e=>{window.CookieMonsterData.Upgrades[e[0]]=JSON.parse(JSON.stringify(e[1]))}))}function Sa(e){if("toggle"===Game.Upgrades[e].pool||0===Game.Upgrades[e].bought&&Game.Upgrades[e].unlocked&&"prestige"!==Game.Upgrades[e].pool){ea(),"Shimmering veil [on]"===_t[e].name?_t["Shimmering veil [off]"].bought=0:"Golden switch [on]"===_t[e].name?_t["Golden switch [off]"].bought=0:_t[e].bought=(_t[e].bought+1)%2,Game.CountsAsUpgradeOwned(Game.Upgrades[e].pool)&&(xe+=1),"Elder Pledge"===e?(Te+=1,Te>0&&ia("Elder nap"),Te>=5&&ia("Elder slumber")):"Elder Covenant"===e?ia("Elder calm"):"Prism heart biscuits"===e?ia("Lovely cookies"):"Heavenly key"===e&&ia("Wholesome");const t=Se;ra(),ua(),t!==Se&&ra();const o=function(){let e=0;Kt("Thousand fingers")&&(e+=.1),Kt("Million fingers")&&(e*=5),Kt("Billion fingers")&&(e*=10),Kt("Trillion fingers")&&(e*=20),Kt("Quadrillion fingers")&&(e*=20),Kt("Quintillion fingers")&&(e*=20),Kt("Sextillion fingers")&&(e*=20),Kt("Septillion fingers")&&(e*=20),Kt("Octillion fingers")&&(e*=20),Kt("Nonillion fingers")&&(e*=20);let t=0;Object.keys(Vt).forEach((e=>{t+=Vt[e].amount})),t-=Vt.Cursor.amount,e*=t,Kt("Plastic mouse")&&(e+=.01*We),Kt("Iron mouse")&&(e+=.01*We),Kt("Titanium mouse")&&(e+=.01*We),Kt("Adamantium mouse")&&(e+=.01*We),Kt("Unobtainium mouse")&&(e+=.01*We),Kt("Eludium mouse")&&(e+=.01*We),Kt("Wishalloy mouse")&&(e+=.01*We),Kt("Fantasteel mouse")&&(e+=.01*We),Kt("Nevercrack mouse")&&(e+=.01*We),Kt("Armythril mouse")&&(e+=.01*We),Kt("Technobsidian mouse")&&(e+=.01*We),Kt("Plasmarble mouse")&&(e+=.01*We),Kt("Miraculite mouse")&&(e+=.01*We),Kt("Fortune #104")&&(e+=.01*We);let o=1;if(Kt("Santa's helpers")&&(o*=1.1),Kt("Cookie egg")&&(o*=1.1),Kt("Halo gloves")&&(o*=1.1),Kt("Dragon claw")&&(o*=1.03),Kt("Aura gloves")&&(o*=1+.05*Math.min(Game.Objects.Cursor.level,Kt("Luminous gloves")?20:10)),o*=Yt("click"),Vt.Temple.minigameLoaded&&Jt){const e=Jt("labor");1===e?o*=1.15:2===e?o*=1.1:3===e&&(o*=1.05)}Object.keys(Game.buffs).forEach((e=>{void 0!==Game.buffs[e].multClick&&(o*=Game.buffs[e].multClick)})),o*=1+.05*Qt("Dragon Cursor");let a=o*Game.ComputeCps(1,Kt("Reinforced index finger")+Kt("Carpal tunnel prevention cream")+Kt("Ambidextrous"),e);return a=Game.runModHookOnValue("cookiesPerClick",a),Game.hasBuff("Cursed finger")&&(a=Game.buffs["Cursed finger"].power),a}()-Game.computedMouseCps;return o?[We-Game.cookiesPs,o]:[We-Game.cookiesPs]}return[]}function Fa(e){const t={};return Object.keys(Game.Objects).forEach((o=>{t[o]={},t[o].bonus=ha(o,e),1!==e&&(Ge=1)})),t}function Ea(){Object.keys(Game.Objects).forEach((e=>{lt[e].price=va(e,Game.Objects[e].basePrice,Game.Objects[e].amount,Game.Objects[e].free,1),ct[e].price=va(e,Game.Objects[e].basePrice,Game.Objects[e].amount,Game.Objects[e].free,10),dt[e].price=va(e,Game.Objects[e].basePrice,Game.Objects[e].amount,Game.Objects[e].free,100),mt[e].price=va(e,Game.Objects[e].basePrice,Game.Objects[e].amount,Game.Objects[e].free,mt[e].AmountNeeded)})),ba({CacheObjectsNextAchievement:mt})}function Ba(){lt=Fa(1),ct=Fa(10),dt=Fa(100),function(){kt={};for(let e=0;e0?e/=t:e=0,wt=Pa(7,e,ot),Gt=2*wt[1]/ot,vt=wt[2]/60/60/6/tt,St=Pa(6,e,at),xt=2*St[1]/at,Tt=St[2]/60/60/6/tt,Bt=Pa(7,7*e,ot),Ft=2*Bt[1]/ot,Et=Bt[2]/60/60/6/tt,Ot=Pa(6,7*e,at),Pt=2*Ot[1]/at,Nt=Ot[2]/60/60/6/tt,ba({CacheChainMaxReward:wt,CacheChainRequired:Gt,CacheChainRequiredNext:vt,CacheChainWrathMaxReward:St,CacheChainWrathRequired:xt,CacheChainWrathRequiredNext:Tt,CacheChainFrenzyMaxReward:Bt,CacheChainFrenzyRequired:Ft,CacheChainFrenzyRequiredNext:Et,CacheChainFrenzyWrathMaxReward:Ot,CacheChainFrenzyWrathRequired:Pt,CacheChainFrenzyWrathRequiredNext:Nt})}function Oa(){const e=Math.floor(Date.now()/1e3);if(Game.T/Game.fps%1==0){const t=Game.HowMuchPrestige(Game.cookiesReset),o=Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned))-Math.floor(t),a=e-ye,n=Math.max(0,o-be)/a;for(let e=0;e{e.push(Game.Upgrades[t])})),e.sort((function(e,t){return e.order>t.order?1:e.order{const o=e[t];if(0===o.bought){let e="";e+=function(e){let t="crate upgrade missing";"prestige"===e.pool&&(t+=" heavenly");let o=0;Game.prefs.crates||(o=1),o&&(t+=" noFrame");let{icon:a}=e;e.iconFunction&&(a=e.iconFunction());const n=`function() {return Game.crateTooltip(Game.UpgradesById[${e.id}], 'stats');}`;return`
\n\t
`}(o),"prestige"===o.pool?yt+=e:"cookie"===o.pool?bt+=e:"toggle"!==o.pool&&"unused"!==o.pool&&"debug"!==o.pool&&(Mt+=e)}}))}function La(){if("christmas"===Game.season){let e=60*Game.cookiesPs;Game.hasBuff("Elder frenzy")&&(e*=.5),Game.hasBuff("Frenzy")&&(e*=.75),rt=Math.max(25,e),Game.Has("Ho ho ho-flavored frosting")&&(rt*=2)}ba({CacheSeaSpec:rt})}function Aa(){ze=900*et/.15,ze*=tt;const e=na();e>0?ze/=e:ze=0,Ve=ot*(.15*ze)+13,_e=at*(.15*ze)+13,Xe=7*ze,Qe=ot*(.15*Xe)+13,qe=at*(.15*Xe)+13,Ye=2*ze,Ke=.15*Ye,Je=0;let t=0,o=0;Object.keys(Game.Objects).forEach((e=>{Game.Objects[e].amount>t&&(t=Game.Objects[e].amount),Game.Objects[e].amount>0&&(o+=1)})),Object.keys(Game.Objects).forEach((e=>{(Game.Objects[e].amountJe&&(Je=2*Game.Objects[e].price,Ze=e)})),ba({CacheLucky:ze,CacheLuckyReward:Ve,CacheLuckyWrathReward:_e,CacheLuckyFrenzy:Xe,CacheLuckyRewardFrenzy:Qe,CacheLuckyWrathRewardFrenzy:qe,CacheConjure:Ye,CacheConjureReward:Ke,CacheEdifice:Je,CacheEdificeBuilding:Ze})}function Wa(){let e=1,t=1,o=1;Kt("Green yeast digestives")&&(o*=1.01),Kt("Dragon fang")&&(o*=1.03),e*=1+.1*Game.auraMult("Ancestral Metamorphosis"),e*=Game.eff("goldenCookieGain"),t*=1+.1*Game.auraMult("Unholy Dominion"),t*=Game.eff("wrathCookieGain"),ot=o*e,at=o*t,tt=1,0===Game.shimmerTypes.golden.n&&(tt*=1+1.23*Game.auraMult("Dragon's Fortune")),ba({CacheGoldenCookiesMult:ot,CacheWrathCookiesMult:at,CacheDragonsFortuneMultAdjustment:tt})}function ja(e){const t={};Object.keys(Game.Objects).forEach((o=>{if(0!==Object.keys(mt).length&&mt[o].TotalNeeded>Game.Objects[o].amount&&!e)t[o]={AmountNeeded:mt[o].TotalNeeded-Game.Objects[o].amount,TotalNeeded:mt[o].TotalNeeded,price:va(o,Game.Objects[o].basePrice,Game.Objects[o].amount,Game.Objects[o].free,mt[o].TotalNeeded-Game.Objects[o].amount)};else{const e=function(e){const t=Game.AchievementsOwned;let o=100,a=100;for(;o>-1;)if(ha(e,o),Se>t)a=o,o-=10;else{if(100===o)return 101;for(o+=1;o<=a;){if(ha(e,o),Se>t)return o;o+=1}}return 101}(o);t[o]={AmountNeeded:e,TotalNeeded:Game.Objects[o].amount+e,price:va(o,Game.Objects[o].basePrice,Game.Objects[o].amount,Game.Objects[o].free,e)}}})),mt=t,ba({CacheObjectsNextAchievement:mt})}function $a(){pt=0,ut=0,ht=[0,null];for(let e=0;eht[0]&&(ht=[t,e]))}ba({CacheWrinklersTotal:pt,CacheWrinklersNormal:ut,CacheWrinklersFattest:ht})}function Ha(){qo(),$a(),Aa(),Wa(),Na(),Da(),La(),ne=new ya(wo[wo.length-1]),ie=new ya(wo[wo.length-1]),re=new ya(wo[wo.length-1]),se=new ya(wo[wo.length-1]),le=new ya(xo[xo.length-1]),ce=new ya(5),ae=new ya(20*xo[xo.length-1]),Oa(),ja(),Ga(),Ba(),Ea(),Ta()}function Ua(){Object.keys(Game.wrinklers).forEach((e=>{Game.wrinklers[e].sucked>0&&0===Game.wrinklers[e].type&&(Game.wrinklers[e].hp=0)}))}function Ra(e,t){if("b"===e){if(l("tooltip").innerHTML=Game.Objects[t].tooltip(),1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipAmor){const e=va(t,Game.Objects[t].basePrice,0,Game.Objects[t].free,Game.Objects[t].amount),o=e-Game.Objects[t].totalCookies;o>0&&(l("tooltip").innerHTML=l("tooltip").innerHTML.split("so far").join(`so far
${oe(o)} ${1===Math.floor(o)?"cookie":"cookies"} left to amortize (${Ho((e-Game.Objects[t].totalCookies)/(Game.Objects[t].storedTotalCps*Game.globalCpsMult)).text})`))}-1===Game.buyMode&&(l("tooltip").innerHTML=l("tooltip").innerHTML.split(oe(Game.Objects[t].bulkPrice)).join(oe((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)():"wb"===e?l("tooltip").innerHTML="":"pag"===e?l("tooltip").innerHTML=Game.Objects.Temple.minigame.godTooltip(t)():"pas"===e&&(l("tooltip").innerHTML=Game.Objects.Temple.minigame.slotTooltip(t[0])());if("b"===e&&1===Game.buyMode||"u"===e||"s"===e||"g"===e||"p"===e&&!Game.keys[16]||"ha"===e||"wb"===e||"pag"===e||"pas"===e&&-1!==t[1]){const e=document.createElement("div");e.id="CMTooltipArea",l("tooltip").appendChild(e)}return Eo=e,Bo=t,ka(),l("tooltip").innerHTML}function Ia(){1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Favicon&&V>0?At.wrath?l("CMFavicon").href="https://CookieMonsterTeam.github.io/CookieMonster/favicon/wrathCookie.ico":l("CMFavicon").href="https://CookieMonsterTeam.github.io/CookieMonster/favicon/goldenCookie.ico":l("CMFavicon").href="https://orteil.dashnet.org/cookieclicker/favicon.ico"}function za(){Vt=[],Object.keys(Game.Objects).forEach((e=>{Vt[e]=Jo(e)})),_t=[],Object.keys(Game.Upgrades).forEach((e=>{_t[e]=Zo(e)})),Xt=[],Object.keys(Game.Achievements).forEach((e=>{Xt[e]=Yo(e)})),ea()}function Va(){Game.Objects["Wizard tower"].minigameLoaded&&Object.keys(Game.Objects["Wizard tower"].minigame.spellsById).forEach((e=>{null!==l(`grimoireSpell${e}`).onmouseover&&(K[e]=l(`grimoireSpell${e}`).onmouseover,l(`grimoireSpell${e}`).onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>Ra("g",`${e}`)),"this"),Game.tooltip.wobble()})}))}function _a(){if(!H&&Game.Objects["Wizard tower"].minigameLoaded){const{minigame:e}=Game.Objects["Wizard tower"];j=e.draw,Game.Objects["Wizard tower"].minigame.draw=function(){j(),1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GrimoireBar&&e.magic{if(t=a,Game.Objects[t].amount{Le=!0})),Scale:new F(2,"bool","Notation",["Game's setting scale","Metric","Short scale","Short scale (Abbreviated)","Scientific notation","Engineering notation"],"Change how long numbers are formatted",!1,(()=>{Ja()})),ScaleDecimals:new F(2,"bool","Notation",["1 decimals","2 decimals","3 decimals"],'Set the number of decimals used when applicable. This only works with Cookie Monster scales and not with "Game\'s Setting Scale"',!1,(()=>{Ja()})),ScaleSeparator:new F(0,"bool","Notation",[". for decimals (standard)",". for thousands"],"Set the separator used for decimals and thousands",!1,(()=>{Ja()})),ScaleCutoff:new T(999999,"numscale","Notation","Notation cut-off point: ","The number from which Cookie Monster will start formatting numbers based on chosen scale. Standard is 999,999. Setting this above 999,999,999 might break certain notations",1,999999999),TimeFormat:new S(0,"bool","Notation",["Time XXd, XXh, XXm, XXs","Time XX:XX:XX:XX:XX","Time XXx, XXx"],"Change the time format",!1),DetailedTime:new F(1,"bool","Notation",["Detailed time OFF","Detailed time ON"],"Change how time is displayed in certain statistics and tooltips",!0,(()=>{1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.DetailedTime?Game.sayTime=yo:Game.sayTime=Z.sayTime})),PPDisplayTime:new S(0,"bool","Notation",["PP as value (standard)","PP as time unit"],"Display PP as calculated value or as approximate time unit. Note that PP does not translate directly into a time unit and this is therefore only an approximation.",!1),BuildColour:new F(1,"bool","Colours",["Building colours OFF","Building colours ON"],"Colour code buildings",!0,(()=>{Ao()})),PPOnlyConsiderBuyable:new S(0,"bool","Colours",["Don't ignore non-buyable","Ignore non-buyable"],"Makes Cookie Monster label buildings and upgrades you can't buy right now red, useful in those situations where you just want to spend your full bank 'most optimally'",!0),PPExcludeTop:new S(0,"bool","Colours",["Don't ignore any","Ignore 1st best","Ignore 1st and 2nd best","Ignore 1st, 2nd and 3rd best"],"Makes Cookie Monster ignore the 1st, 2nd or 3rd best buildings in labeling and colouring PP values",!0),PPRigidelMode:new S(0,"bool","Colours",["Rigidel mode OFF","Rigidel mode ON"],'Makes Cookie Monster ignore all "buy 1" options when colouring PP in order to stay at a total building count ending in 10 for pantheon god Rigidel',!0),PPSecondsLowerLimit:new T(0,"numscale","Colours","Lower limit for PP (in seconds): ",'If a building or upgrade costs less than the specified seconds of CPS it will also be considered optimal and label it as such ("PP is less than xx seconds of CPS"); setting to 0 ignores this option',0,1/0),ColourBlue:new x("#4bb8f0","colour","Colours","Standard colour is blue. Used to show upgrades better than best PP building, for Click Frenzy bar, and for various labels"),ColourGreen:new x("#00ff00","colour","Colours","Standard colour is green. Used to show best PP building, for Blood Frenzy bar, and for various labels"),ColourYellow:new x("#ffff00","colour","Colours","Standard colour is yellow. Used to show buildings within the top 10 of PP, for Frenzy bar, and for various labels"),ColourOrange:new x("#ff7f00","colour","Colours","Standard colour is orange. Used to show buildings within the top 20 of PP, for Next Reindeer bar, and for various labels"),ColourRed:new x("#ff0000","colour","Colours","Standard colour is Red. Used to show buildings within the top 30 of PP, for Clot bar, and for various labels"),ColourPurple:new x("#ff00ff","colour","Colours","Standard colour is purple. Used to show buildings outside of the top 30 of PP, for Next Cookie bar, and for various labels"),ColourGray:new x("#b3b3b3","colour","Colours","Standard colour is gray. Used to show negative or infinity PP, and for Next Cookie/Next Reindeer bar"),ColourPink:new x("#ff1493","colour","Colours","Standard colour is pink. Used for Dragonflight bar"),ColourBrown:new x("#8b4513","colour","Colours","Standard colour is brown. Used for Dragon Harvest bar"),BotBar:new F(1,"bool","BarsDisplay",["Bottom bar OFF","Bottom bar ON"],"Building information",!0,(()=>{Za()})),TimerBar:new F(1,"bool","BarsDisplay",["Timer bar OFF","Timer bar ON"],"Bar with timers for golden cookie, season popup, Frenzy (Normal, Clot, Elder), Click Frenzy",!0,(()=>{Qo()})),TimerBarPos:new F(0,"bool","BarsDisplay",["Timer bar position (top left)","Timer bar position (bottom)"],"Placement of the timer bar",!1,(()=>{0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarPos?(l("CMTimerBar").style.width="30%",l("CMTimerBar").style.bottom="",l("game").insertBefore(l("CMTimerBar"),l("sectionLeft"))):(l("CMTimerBar").style.width="100%",l("CMTimerBar").style.bottom="0px",l("wrapper").appendChild(l("CMTimerBar"))),Xo()})),TimerBarOverlay:new S(2,"bool","BarsDisplay",["Timer bar overlay OFF","Timer bar overlay only seconds","Timer bar overlay full"],"Overlay on timers displaying seconds and/or percentage left",!0),AutosaveTimerBar:new S(0,"bool","BarsDisplay",["Autosave timer bar OFF","Autosave timer bar ON"],"Show a timer counting down till next autosave in the timer bar",!0),UpBarColour:new F(1,"bool","BarsDisplay",["Upgrade colours/bar OFF","Upgrade colours with bar ON","Upgrade colours without bar ON"],"Colour code upgrades and optionally add a counter bar",!1,(()=>{1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpBarColour?(l("CMUpgradeBar").style.display="",jo()):2===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpBarColour?(l("CMUpgradeBar").style.display="none",jo()):(l("CMUpgradeBar").style.display="none",Game.RebuildUpgrades())})),UpgradeBarFixedPos:new F(1,"bool","BarsDisplay",["Upgrade bar fixed position OFF","Upgrade bar fixed position ON"],"Lock the upgrade bar at top of the screen to prevent it from moving ofscreen when scrolling",!0,(()=>{1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpgradeBarFixedPos?(l("CMUpgradeBar").style.position="sticky",l("CMUpgradeBar").style.top="0px"):l("CMUpgradeBar").style.position=""})),SortBuildings:new F(0,"bool","BarsDisplay",["Sort buildings: default","Sort buildings: PP of x1 purchase","Sort buildings: PP of selected bulk mode","Sort buildings: price until next achievement"],"Sort the display of buildings in default order, by PP, or until next achievement",!1,(()=>{Ao()})),SortUpgrades:new F(0,"bool","BarsDisplay",["Sort upgrades: default","Sort upgrades: PP"],"Sort the display of upgrades in either default order or by PP",!1,(()=>{jo()})),UpgradesNeverCollapse:new F(0,"bool","BarsDisplay",["Upgrades always expanded OFF","Upgrades always expanded ON"],"Toggle to make the upgrades sections always expanded to the size needed to display all upgrades",!0,(()=>{Wo()})),DragonAuraInfo:new S(1,"bool","BarsDisplay",["Extra dragon aura info OFF","Extra dragon aura info ON"],"Shows information about changes in CPS and costs in the dragon aura interface.",!0),GrimoireBar:new S(1,"bool","BarsDisplay",["Grimoire magic meter timer OFF","Grimoire magic meter timer ON"],"A timer overlay showing how long till the Grimoire magic meter is full",!0),GCTimer:new F(1,"bool","BarsDisplay",["Golden cookie timer OFF","Golden cookie timer ON"],"A timer on the golden cookie when it has been spawned",!0,(()=>{1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GCTimer?Object.keys(Do).forEach((e=>{Do[e].style.display="block",Do[e].style.left=Rt[e].l.style.left,Do[e].style.top=Rt[e].l.style.top})):Object.keys(Do).forEach((e=>Do[e].style.display="none"))})),Favicon:new F(1,"bool","BarsDisplay",["Favicon OFF","Favicon ON"],"Update favicon with golden/wrath cookie",!0,(()=>{Ia()})),WrinklerButtons:new F(1,"bool","BarsDisplay",["Extra wrinkler buttons OFF","Extra wrinkler buttons ON"],"Show buttons for popping wrinklers at bottom of cookie section",!0,(()=>{B()})),HideSectionsButtons:new F(0,"bool","BarsDisplay",["Hide buildings/upgrades button OFF","Hide buildings/upgrades button ON"],"Show buttons for hiding and showing the buildings and upgrades sections in the right column",!0,(()=>{Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.HideSectionsButtons?l("CMSectionHidButtons").style.display="":l("CMSectionHidButtons").style.display="none"})),TooltipBuildUpgrade:new S(1,"bool","Tooltip",["Building/upgrade tooltip information OFF","Building/upgrade tooltip information ON"],"Extra information in building/upgrade tooltips",!0),TooltipAmor:new S(0,"bool","Tooltip",["Buildings tooltip amortization information OFF","Buildings tooltip amortization information ON"],"Add amortization information to buildings tooltip",!0),ToolWarnLucky:new S(1,"bool","Tooltip",["Tooltip lucky warning OFF","Tooltip lucky warning ON"],'A warning when buying if it will put the bank under the amount needed for max "Lucky!" rewards',!0),ToolWarnLuckyFrenzy:new S(1,"bool","Tooltip",["Tooltip lucky frenzy warning OFF","Tooltip lucky frenzy warning ON"],'A warning when buying if it will put the bank under the amount needed for max "Lucky!" (Frenzy) rewards',!0),ToolWarnConjure:new S(1,"bool","Tooltip",["Tooltip conjure warning OFF","Tooltip conjure warning ON"],'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards',!0),ToolWarnConjureFrenzy:new S(1,"bool","Tooltip",["Tooltip conjure frenzy warning OFF","Tooltip conjure frenzy warning ON"],'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards with Frenzy active',!0),ToolWarnEdifice:new S(1,"bool","Tooltip",["Tooltip edifice warning OFF","Tooltip edifice warning ON"],'A warning when buying if it will put the bank under the amount needed for "Spontaneous Edifice" to possibly give you your most expensive building',!0),ToolWarnUser:new T(0,"numscale","Tooltip","Tooltip warning at x times CPS: ","Use this to show a customized warning if buying it will put the bank under the amount equal to value times cps; setting to 0 disables the function altogether",0,1/0),ToolWarnBon:new S(1,"bool","Tooltip",["Calculate tooltip warning with bonus CPS OFF","Calculate tooltip warning with bonus CPS ON"],"Calculate the warning with or without the bonus CPS you get from buying",!0),ToolWarnPos:new F(1,"bool","Tooltip",["Tooltip warning position (left)","Tooltip warning position (bottom)"],"Placement of the warning boxes",!1,(()=>{fa()})),TooltipGrim:new S(1,"bool","Tooltip",["Grimoire tooltip information OFF","Grimoire tooltip information ON"],"Extra information in tooltip for grimoire",!0),TooltipWrink:new S(1,"bool","Tooltip",["Wrinkler tooltip OFF","Wrinkler tooltip ON"],"Shows the amount of cookies a wrinkler will give when popping it",!0),TooltipLump:new S(1,"bool","Tooltip",["Sugar lump tooltip OFF","Sugar lump tooltip ON"],"Shows the current Sugar Lump type in Sugar lump tooltip.",!0),TooltipPlots:new S(1,"bool","Tooltip",["Garden plots tooltip OFF","Garden plots tooltip ON"],"Shows a tooltip for plants that have a cookie reward.",!0),TooltipPantheon:new S(1,"bool","Tooltip",["Pantheon tooltip OFF","Pantheon tooltip ON"],"Shows additional info in the pantheon tooltip",!0),TooltipAscendButton:new S(1,"bool","Tooltip",["Show Extra Info Ascend Tooltip OFF","Show Extra Info Ascend Tooltip ON"],"Shows additional info in the ascend tooltip",!0),Stats:new S(1,"bool","Statistics",["Statistics OFF","Statistics ON"],"Extra Cookie Monster statistics!",!0),MissingUpgrades:new S(1,"bool","Statistics",["Missing upgrades OFF","Missing upgrades ON"],"Shows missing upgrades in statistics menu",!0),MissingAchievements:new S(0,"bool","Statistics",["Missing Achievements OFF","Missing Normal Achievements ON"],"Shows missing normal achievements in statistics menu.",!0),UpStats:new S(1,"bool","Statistics",["Statistics update rate (default)","Statistics update rate (1s)"],"Default rate is once every 5 seconds",!1),HeavenlyChipsTarget:new T(1,"numscale","Statistics","Heavenly chips target: ",'Use this to set a heavenly chips target that will be counted towards in the "prestige" statsistics sections',1,1/0),ShowMissedGC:new S(1,"bool","Statistics",["Missed GC OFF","Missed GC ON"],"Show a stat in the statistics screen that counts how many golden cookies you have missed",!0),Title:new S(1,"bool","NotificationGeneral",["Title OFF","Title ON","Title pinned tab highlight"],'Update title with colden cookie/season popup timers; pinned tab highlight only changes the title when a golden cookie/season popup spawns; "!" means that golden cookie/reindeer can spawn',!0),GeneralSound:new S(1,"bool","NotificationGeneral",["Consider game volume setting OFF","Consider game volume setting ON"],'Turning this toggle to "off" makes Cookie Monster no longer consider the volume setting of the base game, allowing mod notifications to play with base game volume turned down',!0),GCNotification:new F(0,"bool","NotificationGC",["Notification OFF","Notification ON"],"Create a notification when golden cookie spawns",!0,(()=>{Ka(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GCNotification)})),GCFlash:new S(1,"bool","NotificationGC",["Flash OFF","Flash ON"],"Flash screen on golden cookie",!0),ColourGCFlash:new x("#ffffff","colour","NotificationGC","The colour of the GC flash, standard colour is white"),GCSound:new S(1,"bool","NotificationGC",["Sound OFF","Sound ON"],"Play a sound on golden cookie",!0),GCVolume:new E(100,"vol","NotificationGC",[],"Volume"),GCSoundURL:new S("https://freesound.org/data/previews/66/66717_931655-lq.mp3","url","NotificationGC","Sound URL:","URL of the sound to be played when a golden cookie spawns"),FortuneNotification:new F(0,"bool","NotificationFC",["Notification OFF","Notification ON"],"Create a notification when fortune cookie is on the ticker",!0,(()=>{Ka(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.FortuneNotification)})),FortuneFlash:new S(1,"bool","NotificationFC",["Flash OFF","Flash ON"],"Flash screen on fortune cookie spawn",!0),ColourFortuneFlash:new x("#ffffff","colour","NotificationFC","The colour of the fortune flash, standard colour is white"),FortuneSound:new S(1,"bool","NotificationFC",["Sound OFF","Sound ON"],"Play a sound on fortune cookie spawn",!0),FortuneVolume:new E(100,"vol","NotificationFC",[],"Volume"),FortuneSoundURL:new S("https://freesound.org/data/previews/174/174027_3242494-lq.mp3","url","NotificationFC","Sound URL:","URL of the sound to be played when the ticker has a fortune cookie"),SeaNotification:new F(0,"bool","NotificationSea",["Notification OFF","Notification ON"],"Create a notification on season popup",!0,(()=>{Ka(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SeaNotification)})),SeaFlash:new S(1,"bool","NotificationSea",["Flash OFF","Flash ON"],"Flash screen on season popup",!0),ColourSeaFlash:new x("#ffffff","colour","NotificationSea","The colour of the season popup flash, standard colour is white"),SeaSound:new S(1,"bool","NotificationSea",["Sound OFF","Sound ON"],"Play a sound on season popup",!0),SeaVolume:new E(100,"vol","NotificationSea",[],"Volume"),SeaSoundURL:new S("https://www.freesound.org/data/previews/121/121099_2193266-lq.mp3","url","NotificationSea","Sound URL:","URL of the sound to be played when on season popup spawns"),GardFlash:new S(1,"bool","NotificationGard",["Garden Tick Flash OFF","Flash ON"],"Flash screen on garden tick",!0),ColourGardFlash:new x("#ffffff","colour","NotificationGard","The colour of the garden flash, standard colour is white"),GardSound:new S(1,"bool","NotificationGard",["Sound OFF","Sound ON"],"Play a sound on garden tick",!0),GardVolume:new E(100,"vol","NotificationGard",[],"Volume"),GardSoundURL:new S("https://freesound.org/data/previews/103/103046_861714-lq.mp3","url","NotificationGard","Garden Tick Sound URL:","URL of the sound to be played when the garden ticks"),MagicNotification:new F(0,"bool","NotificationMagi",["Notification OFF","Notification ON"],"Create a notification when magic reaches maximum",!0,(()=>{Ka(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.MagicNotification)})),MagicFlash:new S(1,"bool","NotificationMagi",["Flash OFF","Flash ON"],"Flash screen when magic reaches maximum",!0),ColourMagicFlash:new x("#ffffff","colour","NotificationMagi","The colour of the magic flash, standard colour is white"),MagicSound:new S(1,"bool","NotificationMagi",["Sound OFF","Sound ON"],"Play a sound when magic reaches maximum",!0),MagicVolume:new E(100,"vol","NotificationMagi",[],"Volume"),MagicSoundURL:new S("https://freesound.org/data/previews/221/221683_1015240-lq.mp3","url","NotificationMagi","Sound URL:","URL of the sound to be played when magic reaches maxium"),WrinklerNotification:new F(0,"bool","NotificationWrink",["Notification OFF","Notification ON"],"Create a notification when a wrinkler appears",!0,(()=>{Ka(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerNotification)})),WrinklerFlash:new S(1,"bool","NotificationWrink",["Flash OFF","Flash ON"],"Flash screen when a wrinkler appears",!0),ColourWrinklerFlash:new x("#ffffff","colour","NotificationWrink","The colour of the wrinkler flash, standard colour is white"),WrinklerSound:new S(1,"bool","NotificationWrink",["Sound OFF","Sound ON"],"Play a sound when a wrinkler appears",!0),WrinklerVolume:new E(100,"vol","NotificationWrink",[],"Volume"),WrinklerSoundURL:new S("https://freesound.org/data/previews/124/124186_8043-lq.mp3","url","NotificationWrink","Sound URL:","URL of the sound to be played when a wrinkler appears"),WrinklerMaxNotification:new F(0,"bool","NotificationWrinkMax",["Notification OFF","Notification ON"],"Create a notification when the maximum amount of wrinklers has appeared",!0,(()=>{Ka(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerMaxNotification)})),WrinklerMaxFlash:new S(1,"bool","NotificationWrinkMax",["Flash OFF","Flash ON"],"Flash screen when the maximum amount of Wrinklers has appeared",!0),ColourWrinklerMaxFlash:new x("#ffffff","colour","NotificationWrinkMax","The colour of the maximum wrinkler flash, standard colour is white"),WrinklerMaxSound:new S(1,"bool","NotificationWrinkMax",["Sound OFF","Sound ON"],"Play a sound when the maximum amount of wrinklers has appeared",!0),WrinklerMaxVolume:new E(100,"vol","NotificationWrinkMax",[],"Volume"),WrinklerMaxSoundURL:new S("https://freesound.org/data/previews/152/152743_15663-lq.mp3","url","NotificationWrinkMax","Sound URL:","URL of the sound to be played when the maximum amount of wrinklers has appeared"),BulkBuyBlock:new S(1,"bool","Miscellaneous",["Block bulk buying OFF","Block bulk buying ON"],"Block clicking bulk buying when you can't buy all. This prevents buying 7 of a building when you are in buy-10 or buy-100 mode.",!0),FavouriteSettings:new F(1,"bool","Miscellaneous",["Favourite settings section OFF","Favourite settings section ON","Favourite settings section ON (Locked)"],"Show stars before each setting which allows selecting it for a 'favourites' section at the top of the Cookie Monster settings. Setting this to Locked removes the stars but shows the 'favourites' section",!0,(()=>{Game.UpdateMenu()}))};function tn(){let e="";for(let t=0;t{if("Favourite"===t){if(0!==Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.favouriteSettings.length&&Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.FavouriteSettings>0&&(e.appendChild(b.createOptionsSubHeader("cookieMonsterMod",t,qa[t])),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[t]))for(let t=0;t{const o=b.createOptionsSubHeader("cookieMonsterMod",t,Ya[t]);o.style.fontSize="15px",o.style.opacity="0.5",e.appendChild(o),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[t]&&Object.keys(en).forEach((o=>{en[o].group===t&&e.appendChild(b.createOptionsListing("cookieMonsterMod",o,en,tn,Ja))}))})):Object.keys(en).forEach((o=>{en[o].group===t&&e.appendChild(b.createOptionsListing("cookieMonsterMod",o,en,tn,Ja))})))})),e}function an(e,t){const o=document.createElement("div");o.className="title",o.style.padding="0px 16px",o.style.opacity="0.7",o.style.fontSize="17px",o.style.fontFamily='"Kavoon", Georgia, serif',o.appendChild(document.createTextNode(`${e} `));const a=document.createElement("span");return a.style.cursor="pointer",a.style.display="inline-block",a.style.height="14px",a.style.width="14px",a.style.borderRadius="7px",a.style.textAlign="center",a.style.backgroundColor="#C0C0C0",a.style.color="black",a.style.fontSize="13px",a.style.verticalAlign="middle",a.textContent=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[t]?"-":"+",a.onclick=function(){!function(e){Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[e]+=1,Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[e]>1&&(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[e]=0),w.saveFramework()}(t),Game.UpdateMenu()},o.appendChild(a),o}function nn(e,t,o,a){const n=document.createElement("div");n.className="listing";const i=document.createElement("b");if(i.textContent=t,n.appendChild(i),"withTooltip"===e){n.className="listing",n.appendChild(document.createTextNode(" "));const e=document.createElement("span");e.onmouseout=function(){Game.tooltip.hide()},e.onmouseover=function(){Game.tooltip.draw(this,escape(go[a].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="?",n.appendChild(e)}return n.appendChild(document.createTextNode(": ")),n.appendChild(o),n}function rn(e,t,o,a){const n=document.createElement("div");n.className="listing";const i=document.createElement("b");return i.textContent=t,!0===a&&(i.style.color=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ColourGreen),n.appendChild(i),n.appendChild(document.createTextNode(": ")),n.appendChild(o),n}function sn(e){const t=document.createDocumentFragment();t.appendChild(document.createTextNode(`${e.length} `));const o=document.createElement("span");o.onmouseout=function(){Game.tooltip.hide()};const a=document.createElement("div"),n=document.createElement("div");n.style.minWidth="140px",n.style.marginBottom="4px";const i=document.createElement("div");return i.className="name",i.style.marginBottom="4px",i.style.textAlign="center",i.textContent="Missing",n.appendChild(i),Object.keys(e).forEach((t=>{const o=document.createElement("div");o.style.textAlign="center",o.appendChild(document.createTextNode(e[t])),n.appendChild(o)})),a.appendChild(n),o.onmouseover=function(){Game.tooltip.draw(this,escape(a.innerHTML))},o.style.cursor="default",o.style.display="inline-block",o.style.height="10px",o.style.width="10px",o.style.borderRadius="5px",o.style.textAlign="center",o.style.backgroundColor="#C0C0C0",o.style.color="black",o.style.fontSize="9px",o.style.verticalAlign="bottom",o.textContent="?",t.appendChild(o),t}function ln(e){const t=document.createElement("div");if(t.className="subsection",t.appendChild(e),t.appendChild(an("Lucky Cookies","Lucky")),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Lucky&&t.appendChild(function(){const e=Game.auraMult("Dragon's Fortune")?"GoldCookDragonsFortuneTooltipPlaceholder":"GoldCookTooltipPlaceholder",t=document.createElement("div");t.className="CMStatsLuckySection";const o=Game.cookies+Ro(){Game.HasUnlocked(ma[e])||c.push(ma[e])})),0!==c.length&&e.appendChild(nn("basic","Rare plant drops left to unlock",sn(c))),e}())),t.appendChild(an("Prestige","Prestige")),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Prestige&&t.appendChild(function(){const e=document.createElement("div");e.className="CMStatsPrestigeSection";const t=Math.floor(Game.HowMuchPrestige(Dt+Game.cookiesReset+pt+(Game.HasUnlocked("Chocolate egg")&&!Game.Has("Chocolate egg")?st:0)));e.appendChild(nn("withTooltip","Prestige level (cur / max)",document.createTextNode(`${oe(Game.prestige)} / ${oe(t)}`),"PrestMaxTooltipPlaceholder"));const o=Math.max(0,Game.HowManyCookiesReset(t+1)-(Dt+Game.cookiesReset+pt+(Game.HasUnlocked("Chocolate egg")&&!Game.Has("Chocolate egg")&&st?st:0))),a=document.createDocumentFragment();a.appendChild(document.createTextNode(oe(o)));const n=document.createElement("small");n.textContent=` (${$o(o/Lt,1)})`,a.appendChild(n),e.appendChild(nn("withTooltip","Cookies to next level",a,"NextPrestTooltipPlaceholder")),e.appendChild(nn("withTooltip","Heavenly chips (cur / max)",document.createTextNode(`${oe(Game.heavenlyChips)} / ${oe(t-Game.prestige+Game.heavenlyChips)}`),"HeavenChipMaxTooltipPlaceholder")),e.appendChild(nn("basic","Heavenly chips per second (last 5 seconds)",document.createTextNode(oe(nt,2))));const i=Number(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.HeavenlyChipsTarget);if(!Number.isNaN(i)){const t=i-Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned));t>0&&(e.appendChild(nn("basic","Heavenly chips to target set in settings (cur)",document.createTextNode(oe(t)))),e.appendChild(nn("basic","Time till target (cur, current 5 second average)",document.createTextNode($o(t/nt)))))}const r=function(e){let t=Game.cookiesPs;ea(),0===_t["Heavenly key"].bought&&(_t["Heavenly chip secret"].bought=1,_t["Heavenly cookie stand"].bought=1,_t["Heavenly bakery"].bought=1,_t["Heavenly confectionery"].bought=1,_t["Heavenly key"].bought=1,ra(),t=We,ea()),Dt>=1e6&&ia("Sacrifice"),Dt>=1e9&&ia("Oblivion"),Dt>=1e12&&ia("From scratch"),Dt>=1e15&&ia("Nihilism"),Dt>=1e18&&ia("Dematerialize"),Dt>=1e21&&ia("Nil zero zilch"),Dt>=1e24&&ia("Transcendence"),Dt>=1e27&&ia("Obliterate"),Dt>=1e30&&ia("Negative void"),Dt>=1e33&&ia("To crumbs, you say?"),Dt>=1e36&&ia("You get nothing"),Dt>=1e39&&ia("Humble rebeginnings"),Dt>=1e42&&ia("The end of the world"),Dt>=1e45&&ia("Oh, you're back"),Dt>=1e48&&ia("Lazarus"),Dt>=1e51&&ia("Smurf account"),Dt>=1e54&&ia("If at first you don't succeed"),_t["Heavenly chip secret"].bought=1,_t["Heavenly cookie stand"].bought=1,_t["Heavenly bakery"].bought=1,_t["Heavenly confectionery"].bought=1,_t["Heavenly key"].bought=1,Ee=e;const o=Se;ra(),ua(),o!==Se&&ra();const a=We-t;return Ee=Game.prestige,a}(t),s=document.createDocumentFragment();s.appendChild(document.createTextNode(oe(r)));const l=Math.round(r/Game.cookiesPs*1e4);if(Number.isFinite(l)&&0!==l){const e=document.createElement("small");e.textContent=` (${l/100}% of income)`,s.appendChild(e)}e.appendChild(nn("withTooltip","Reset bonus income",s,"ResetTooltipPlaceholder"));const c=Math.floor(Game.HowMuchPrestige(Game.cookiesReset)),d=Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned)),m=d-c;if(!Game.Has("Lucky digit")){let t=7-d%10;t<0&&(t+=10);const o=m+t,a=d+t,n=document.createDocumentFragment();n.appendChild(document.createTextNode(`${a.toLocaleString()} / ${o.toLocaleString()} (+${t})`)),e.appendChild(nn("basic",'Next "Lucky Digit" (total / reset)',n))}if(!Game.Has("Lucky number")){let t=777-d%1e3;t<0&&(t+=1e3);const o=m+t,a=d+t,n=document.createDocumentFragment();n.appendChild(document.createTextNode(`${a.toLocaleString()} / ${o.toLocaleString()} (+${t})`)),e.appendChild(nn("basic",'Next "Lucky Number" (total / reset)',n))}if(!Game.Has("Lucky payout")){let t=777777-d%1e6;t<0&&(t+=1e6);const o=m+t,a=d+t,n=document.createDocumentFragment();n.appendChild(document.createTextNode(`${a.toLocaleString()} / ${o.toLocaleString()} (+${t})`)),e.appendChild(nn("basic",'Next "Lucky Payout" (total / reset)',n))}return e}()),Game.cpsSucked>0&&(t.appendChild(an("Wrinklers","Wrink")),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Wrink)){const e=document.createDocumentFragment();e.appendChild(document.createTextNode(`${oe(pt)} / ${oe(ut)} `));const o=document.createElement("a");o.textContent="Pop All Normal",o.className="option",o.onclick=function(){Ua()},e.appendChild(o),t.appendChild(nn("basic","Rewards of Popping (All/Normal)",e));const a=document.createDocumentFragment();a.appendChild(document.createTextNode(`${oe(ht[0])} `));const n=document.createElement("a");n.textContent="Pop Single Fattest",n.className="option",n.onclick=function(){null!==ht[1]&&(Game.wrinklers[ht[1]].hp=0)},a.appendChild(n),t.appendChild(nn("basic",`Rewards of Popping Single Fattest Non-Shiny Wrinkler (id: ${null!==ht[1]?ht[1]:"None"})`,a))}if(t.appendChild(function(){const e=document.createElement("div");e.className="CMStatsSeasonSection";let t=!1;const o=[];Object.keys(la).forEach((e=>{Game.Has(la[e])||(o.push(la[e]),t=!0)}));const a=[];Object.keys(ca).forEach((e=>{Game.Has(ca[e])||(a.push(ca[e]),t=!0)}));const n=[];Object.keys(da).forEach((e=>{Game.Has(da[e])||(n.push(da[e]),t=!0)}));const i=[];Object.keys(Game.eggDrops).forEach((e=>{Game.HasUnlocked(Game.eggDrops[e])||(i.push(Game.eggDrops[e]),t=!0)}));const r=[];Object.keys(Game.rareEggDrops).forEach((e=>{Game.HasUnlocked(Game.rareEggDrops[e])||(r.push(Game.rareEggDrops[e]),t=!0)}));const s=Game.HasUnlocked("Chocolate egg")&&!Game.Has("Chocolate egg"),l=Game.Has("Century egg");if(("christmas"===Game.season||t||s||l)&&(e.appendChild(an("Season Specials","Sea")),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Sea)){if(0!==o.length){e.appendChild(rn(0,"Halloween cookies left to buy",sn(o),"halloween"===Game.season));let t=.95;if(Game.HasAchiev("Spooky cookies")&&(t=.8),Game.Has("Starterror")&&(t*=.9),t*=1/Game.dropRateMult(),Game.hasGod){const e=Game.hasGod("seasons");1===e?t*=.9:2===e?t*=.95:3===e&&(t*=.97)}const a=o.length/7;e.appendChild(rn(0,"Chance of receiving a cookie from wrinkler/shiny wrinkler",document.createTextNode(`${oe((1-t)*a*100)}% / ${oe((1-.9*t)*a*100)}%`),"halloween"===Game.season))}if(0!==a.length){e.appendChild(rn(0,"Christmas cookies left to buy",sn(a),"christmas"===Game.season));let t=.8;if(Game.HasAchiev("Let it snow")&&(t=.6),t*=1/Game.dropRateMult(),Game.Has("Starsnow")&&(t*=.95),Game.hasGod){const e=Game.hasGod("seasons");1===e?t*=.9:2===e?t*=.95:3===e&&(t*=.97)}const o=a.length/7;e.appendChild(rn(0,"Chance of receiving a cookie from reindeer",document.createTextNode(`${oe((1-t)*o*100)}%`),"christmas"===Game.season))}0!==n.length&&e.appendChild(rn(0,"Valentine cookies left to buy",sn(n),"valentines"===Game.season));const t=function(e){let t=e*(1/Game.dropRateMult());if(Game.HasAchiev("Hide & seek champion")&&(t*=.7),Game.Has("Omelette")&&(t*=.9),Game.Has("Starspawn")&&(t*=.9),Game.hasGod){const e=Game.hasGod("seasons");1===e?t*=.9:2===e?t*=.95:3===e&&(t*=.97)}const o=1-t,a=Game.eggDrops.length-i.length,n=Game.rareEggDrops.length-r.length,s=.9*o*(1-a/Game.eggDrops.length),l=.1*o*(1-n/Game.rareEggDrops.length),c=.9*o*(a/Game.eggDrops.length)+.1*o*(n/Game.rareEggDrops.length);return[s+.9*c*(1-a/Game.eggDrops.length),l+.1*c*(1-n/Game.rareEggDrops.length)]};0!==i.length&&(e.appendChild(rn(0,"Normal easter eggs left to unlock",sn(i),"easter"===Game.season)),e.appendChild(rn(0,"Chance of receiving an egg from wrinkler/golden cookie",document.createTextNode(`${oe(100*t(.98)[0])}% / ${oe(100*t(.9)[0])}%`),"easter"===Game.season))),0!==r.length&&(e.appendChild(rn(0,"Rare easter eggs left to unlock",sn(r),"easter"===Game.season)),e.appendChild(rn(0,"Chance of receiving a rare egg from wrinkler/golden cookie",document.createTextNode(`${oe(100*t(.98)[1])}% / ${oe(100*t(.9)[1])}%`),"easter"===Game.season))),"christmas"===Game.season&&e.appendChild(rn(0,"Reindeer reward",document.createTextNode(oe(rt)),!0)),s&&e.appendChild(nn("withTooltip","Chocolate egg cookies",document.createTextNode(oe(st)),"ChoEggTooltipPlaceholder")),l&&e.appendChild(nn("basic","Century egg multiplier",document.createTextNode(Math.round(1e4*(it-1))/100+"%")))}return e}()),t.appendChild(an("Achievements","Achievs")),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Achievs&&Object.keys(Game.Objects).forEach((e=>{const o=mt[e];t.appendChild(nn("basic",e,o.AmountNeeded<101?document.createTextNode(`Next achievement in ${o.AmountNeeded}, price: ${oe(o.price)}`):document.createTextNode("No new achievement for next 100 buildings")))})),t.appendChild(an("Miscellaneous","Misc")),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Misc){if(t.appendChild(nn("basic",`Average cookies per second (past ${wo[Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgCPSHist]<60?`${wo[Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgCPSHist]} seconds`:wo[Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgCPSHist]/60+(3===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgCPSHist?" minute":" minutes")})`,document.createTextNode(oe(Uo(),3)))),t.appendChild(nn("basic",`Average cookie clicks per second (past ${xo[Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgClicksHist]}${0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgClicksHist?" second":" seconds"})`,document.createTextNode(oe(Ct,1)))),t.appendChild(nn("basic",`Cookies from clicking (past ${xo[Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgClicksHist]}${0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgClicksHist?" second":" seconds"})`,document.createTextNode(oe(ae.calcSum(Ct*xo[Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgClicksHist]))))),Game.Has("Fortune cookies")){const e=[];Object.keys(sa).forEach((t=>{Game.Has(sa[t])||e.push(sa[t])})),0!==e.length&&t.appendChild(nn("basic","Fortune Upgrades Left to Buy",sn(e)))}if(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ShowMissedGC&&t.appendChild(nn("basic","Missed golden cookies",document.createTextNode(oe(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(nn("basic","Time till autosave",e))}}l("menu").insertBefore(t,l("menu").childNodes[2]),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.MissingUpgrades&&l("menu").childNodes.forEach((e=>{if(e.children[0])if("Prestige"===e.children[0].innerHTML&&yt){const t=yt.match(new RegExp("div","g")||0).length/2,o=document.createElement("div");o.id="CMMissingUpgradesPrestigeTitle",o.className="listing";const a=document.createElement("div");a.innerHTML=`Missing Prestige upgrades: ${t}/${Game.PrestigeUpgrades.length} (${Math.floor(t/Game.PrestigeUpgrades.length*100)}%)`,o.appendChild(a),e.appendChild(o);const n=document.createElement("div");n.className="listing crateBox",n.innerHTML=yt,e.appendChild(n)}else if("Upgrades"===e.children[0].innerHTML){if(Mt){const t=Mt.match(new RegExp("div","g")||0).length/2,o=document.createElement("div");o.id="CMMissingUpgradesTitle",o.className="listing";const a=document.createElement("div");a.innerHTML=`Missing normal upgrades: ${t}/${Game.UpgradesByPool[""].length+Game.UpgradesByPool.tech.length} (${Math.floor(t/(Game.UpgradesByPool[""].length+Game.UpgradesByPool.tech.length)*100)}%)`,o.appendChild(a),e.insertBefore(o,e.childNodes[3]);const n=document.createElement("div");n.className="listing crateBox",n.innerHTML=Mt,e.insertBefore(n,document.getElementById("CMMissingUpgradesTitle").nextSibling)}if(bt){const t=bt.match(new RegExp("div","g")||0).length/2,o=document.createElement("div");o.id="CMMissingUpgradesCookiesTitle",o.className="listing";const a=document.createElement("div");a.innerHTML=`Missing Cookie upgrades: ${t}/${Game.UpgradesByPool.cookie.length} (${Math.floor(t/Game.UpgradesByPool.cookie.length*100)}%)`,o.appendChild(a),e.appendChild(o);const n=document.createElement("div");n.className="listing crateBox",n.innerHTML=bt,e.appendChild(n)}}})),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.MissingAchievements&&function(){let e;Object.values(document.querySelectorAll("div.title")).forEach((t=>{t.textContent.includes("Achievements")&&(e=t.parentElement.querySelectorAll("div.listing.crateBox")[0])})),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.MissingAchievements&&Object.values(e.children).forEach((e=>{if(!e.className.includes("enabled")){const t=e.onclick.toString().split(/\[(.*)\]/gi)[1],{icon:o}=Game.AchievementsById[t];e.style.backgroundPosition=`${48*-o[0]}px ${48*-o[1]}px`,e.onmouseover=function(){Game.mouseDown||(Game.setOnCrate(this),Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>function(e){const t=[];"shadow"===e.pool?t.push("Shadow Achievement","#9700cf"):t.push("Achievement",0),t.push("Locked",0);let o=0;(Game.Has("Neuromancy")||Game.sesame&&"debug"===e.pool)&&(o=1),o&&0===e.won?t.push("Click to win!","#00c462"):o&&e.won>0&&t.push("Click to lose!","#00c462");let{icon:a}=e;e.iconFunction&&(a=e.iconFunction());let{desc:n}=e;e.descFunc&&(n=e.descFunc("stats"));let i="";for(let e=0;e[${t[e]}]`);return i=i.substring(1),`
\n
\n
${e.name}
\n ${i}
${n}
\n ${Game.sesame?`
Id : ${e.id} | Order : ${Math.floor(e.order)}${e.tier?` | Tier : ${e.tier}`:""}
`:""}`}(Game.AchievementsById[t])),"top"),Game.tooltip.wobble())}}}))}()}function cn(e){if(1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBar&&0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarPos){const t=parseInt(l("CMTimerBar").style.height,10);Game.mouseY-=t,e(),Game.mouseY+=t}else e()}function dn(){Z.Beautify=Beautify,Beautify=oe,Z.CalculateGains=Game.CalculateGains,Game.CalculateGains=function(){Z.CalculateGains(),Le=1,ee=Date.now(),te=Date.now()},Z.tooltip={},Z.tooltip.draw=Game.tooltip.draw,Z.tooltip.drawMod=new Function(`return ${Game.tooltip.draw.toString().split("this").join("Game.tooltip")}`)(),Game.tooltip.draw=function(e,t,o){Z.tooltip.drawMod(e,t,o)},Z.tooltip.update=Game.tooltip.update,Z.tooltip.updateMod=new Function(`return ${Game.tooltip.update.toString().split("this.").join("Game.tooltip.")}`)(),Game.tooltip.update=function(){Z.tooltip.updateMod(),function(){if("store"===Game.tooltip.origin){let e=0;1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnLucky&&1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnPos&&null!==l("CMDispTooltipWarningParent")&&(e=l("CMDispTooltipWarningParent").clientHeight-4),Game.tooltip.tta.style.top=`${Math.min(parseInt(Game.tooltip.tta.style.top,10),l("game").clientHeight+l("topBar").clientHeight-Game.tooltip.tt.clientHeight-e-46)}px`}}()},Z.UpdateWrinklers=Game.UpdateWrinklers,Game.UpdateWrinklers=function(){cn(Z.UpdateWrinklers)},Z.UpdateSpecial=Game.UpdateSpecial,Game.UpdateSpecial=function(){cn(Z.UpdateSpecial)},l("bigCookie").removeEventListener("click",Game.ClickCookie,!1),l("bigCookie").addEventListener("click",(e=>{cn((()=>Game.ClickCookie(e,0)))}),!1),Z.RebuildUpgrades=Game.RebuildUpgrades,Game.RebuildUpgrades=function(){Z.RebuildUpgrades(),J=[],Object.keys(Game.UpgradesInStore).forEach((e=>{null!==l(`upgrade${e}`).onmouseover&&(J[e]=l(`upgrade${e}`).onmouseover,l(`upgrade${e}`).onmouseover=function(){Game.mouseDown||(Game.setOnCrate(this),Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>Ra("u",`${e}`)),"store"),Game.tooltip.wobble())})})),Game.CalculateGains()},Z.ClickProduct=Game.ClickProduct,Game.ClickProduct=function(e){(!Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BulkBuyBlock||Game.ObjectsById[e].bulkPrice-1;--e)if(Game.ObjectsById[e].amount>0){const o=Vt[Game.ObjectsById[e].name].name;Vt[o].amount-=1,we-=1,t=Vt[o].basePrice*Game.priceIncrease**Math.max(0,Vt[o].amount-1-Vt[o].free),t=Game.modifyBuildingPrice(Vt[o],t),t=Math.ceil(t);break}const o=Se;return ra(),ua(),o!==Se&&ra(),[We-Game.cookiesPs,t]}(e),a=$o(o/(t+Game.cookiesPs));let n;n=0===Game.cookiesPs?oe(1/0):oe(t/Game.cookiesPs*100),l("dragonAuraInfo").style.minHeight="60px",l("dragonAuraInfo").style.margin="8px",l("dragonAuraInfo").appendChild(document.createElement("div")).className="line";const i=document.createElement("div");i.style.minWidth="200px",i.style.textAlign="center",i.textContent=`Picking this aura will change CPS by ${oe(t)} (${n}% of current CPS).`,l("dragonAuraInfo").appendChild(i);const r=document.createElement("div");r.style.minWidth="200px",r.style.textAlign="center",r.textContent=`It will take ${a} to recover the cost.`,l("dragonAuraInfo").appendChild(r)}}(e)},Z.ToggleSpecialMenu=Game.ToggleSpecialMenu,Game.ToggleSpecialMenu=function(e){Z.ToggleSpecialMenu(e),function(){if(null!==(l("specialPopup").className.match(/onScreen/)&&l("specialPopup").children[0].style.background.match(/dragon/)))for(let e=0;e${Ie}`,"this"),Game.tooltip.wobble()},l("specialPopup").children[e].onmouseout=function(){Game.tooltip.shouldHide=1})}()},Z.UpdateMenu=Game.UpdateMenu,Game.UpdateMenu=function(){void 0!==s().picker&&void 0!==s().picker.owner||(Z.UpdateMenu(),function(){const e=document.createElement("div");e.className="title","stats"===Game.onMenu?Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Stats&&(e.textContent="Cookie Monster Statistics",ln(e)):"prefs"===Game.onMenu&&l("menu").childNodes[2].insertBefore(on(),l("menu").childNodes[2].childNodes[l("menu").childNodes[2].childNodes.length-1])}())},Z.sayTime=Game.sayTime,yo=function(e,t){return Number.isNaN(e)||e<=0?Z.sayTime(e,t):$o(e/Game.fps,1)},Z.Logic=Game.Logic,Game.Logic=function(){Z.Logic();let e="Cookie Clicker";"fools"===Game.season&&(e="Cookie Baker"),Lo=`${Game.OnAscend?"Ascending! ":""}${oe(Game.cookies)} ${1===Game.cookies?"cookie":"cookies"} - ${e}`,function(){if(Game.OnAscend||0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Title)document.title=Lo;else if(1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Title){let e,t,o,a=!1,n=!1;e=At?At.wrath?`[W${Math.ceil(At.life/Game.fps)}]`:`[G${Math.ceil(At.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)}]`,I&&(a=!0,t="[F]"),"christmas"===Game.season&&(n=!0,o=R?`[R${Math.ceil(Wt.life/Game.fps)}]`:`[${Number(l("CMTimerBarRenMinBar").textContent)<0?"!":""}${Math.ceil((Game.shimmerTypes.reindeer.maxTime-Game.shimmerTypes.reindeer.time)/Game.fps)}]`);let i=Lo;"["===i.charAt(0)&&(i=i.substring(i.lastIndexOf("]")+1)),document.title=`${e+(a?t:"")+(n?o:"")} ${i}`}else if(2===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Title){let e="",t=!1;At&&(t=!0,At.wrath?e+=`[W${Math.ceil(At.life/Game.fps)}]`:e+=`[G${Math.ceil(At.life/Game.fps)}]`),I&&(t=!0,e+="[F]"),"christmas"===Game.season&&R&&(e+=`[R${Math.ceil(Wt.life/Game.fps)}]`,t=!0),t&&(e+=" - ");let o="Cookie Clicker";"fools"===Game.season&&(o="Cookie Baker"),e+=o,document.title=e}}(),function(){const e=Math.max(0,Game.HowManyCookiesReset(Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned))+1)-(Game.cookiesEarned+Game.cookiesReset)),t=Game.sayTime((Date.now()-Game.startDate)/1e3*Game.fps,-1);let o=`You've been on this run for ${""===t?"not very long":t}.
\n
`;Game.prestige>0&&(o+=`Your prestige level is currently ${oe(Game.prestige)}.
(CpS +${oe(Game.prestige)}%)\n
`),o+=be<1?"Ascending now would grant you no prestige.":be<2?"Ascending now would grant you
1 prestige level (+1% CpS)
and 1 heavenly chip to spend.":`Ascending now would grant you
${oe(be)} prestige levels (+${oe(be)}% CpS)
and ${oe(be)} heavenly chips to spend.`,o+=`
\n You need ${oe(e)} more cookies for the next level.
\n ${Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipAscendButton?`
It takes ${jt} to reach the next level and you were making ${oe(nt,2)} chips on average in the last 5 seconds.
`:""}`,l("ascendTooltip").innerHTML=o}()}}function mn(){window.CookieMonsterData={},Game.mods.cookieMonsterFramework.listeners.optionsMenu.push(on),za(),Aa(),Ha(),D=Object.keys(Game.mods).length,$e=document.createElement("style"),$e.type="text/css",$e.id="CMCSS",document.head.appendChild($e),function(){const e=document.createElement("div");e.id="CMBotBar",e.style.height="69px",e.style.width="100%",e.style.position="absolute",e.style.display="none",e.style.backgroundColor="#262224",e.style.backgroundImage="linear-gradient(to bottom, #4d4548, #000000)",e.style.borderTop="1px solid black",e.style.overflow="auto",e.style.textShadow="-1px 0 black, 0 1px black, 1px 0 black, 0 -1px black";const t=e.appendChild(document.createElement("table"));t.style.width="100%",t.style.textAlign="center",t.style.whiteSpace="nowrap";const o=t.appendChild(document.createElement("tbody")),a=function(e,t){const o=document.createElement("td");return o.style.textAlign="right",o.className=to+t,o.textContent=e,o},n=o.appendChild(document.createElement("tr"));n.style.fontWeight="bold",n.appendChild(a("CM 2.031.10",io)),o.appendChild(document.createElement("tr")).appendChild(a("Bonus Income",ao)),o.appendChild(document.createElement("tr")).appendChild(a("Payback Period",ao)),o.appendChild(document.createElement("tr")).appendChild(a("Time Left",ao)),l("wrapper").appendChild(e),Object.keys(Game.Objects).forEach((e=>{zo(e)}))}(),function(){const e=document.createElement("div");e.id="CMTimerBar",e.style.position="absolute",e.style.display="none",e.style.height="0px",e.style.fontSize="10px",e.style.fontWeight="bold",e.style.backgroundColor="black";const t=Io("CMTimerBarAutosave","Autosave",[{id:"CMTimerBarAutosaveBar",colour:lo}]);e.appendChild(t);const o=Io("CMTimerBarGC","Next Cookie",[{id:"CMTimerBarGCMinBar",colour:co},{id:"CMTimerBarGCBar",colour:lo}]);e.appendChild(o);const a=Io("CMTimerBarRen","Next Reindeer",[{id:"CMTimerBarRenMinBar",colour:co},{id:"CMTimerBarRenBar",colour:ro}]);e.appendChild(a);const n=document.createElement("div");n.id="CMTimerBarBuffTimers",e.appendChild(n),l("wrapper").appendChild(e)}(),function(){const e=document.createElement("div");e.id="CMUpgradeBar",e.style.width="100%",e.style.backgroundColor="black",e.style.textAlign="center",e.style.fontWeight="bold",e.style.display="none",e.style.zIndex="21",e.onmouseout=function(){Game.tooltip.hide()};const t=document.createElement("div");t.appendChild(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 o=function(e,t){const o=document.createElement("div");o.style.verticalAlign="middle";const a=document.createElement("span");return a.className=oo+e,a.style.display="inline-block",a.style.height="10px",a.style.width="10px",a.style.marginRight="4px",o.appendChild(a),o.appendChild(document.createTextNode(t)),o};return e.appendChild(o(ao,"Better than the best PP of a building option")),e.appendChild(o(no,"Same as the best PP building option")),e.appendChild(o(io,"Within the top 10 of PP for buildings")),e.appendChild(o(ro,"Within the top 20 of PP for buildings")),e.appendChild(o(so,"Within the top 30 of PP for buildings")),e.appendChild(o(lo,"Outside of the top 30 of PP for buildings")),e.appendChild(o(co,"Negative or infinity PP")),e}()),e.onmouseover=function(){Game.tooltip.draw(this,escape(t.innerHTML),"store")};const o=function(e,t){const o=document.createElement("span");return o.id=e,o.className=to+t,o.style.width="14.28571428571429%",o.style.display="inline-block",o.textContent="0",o};e.appendChild(o("CMUpgradeBarBlue",ao)),e.appendChild(o("CMUpgradeBarGreen",no)),e.appendChild(o("CMUpgradeBarYellow",io)),e.appendChild(o("CMUpgradeBarOrange",ro)),e.appendChild(o("CMUpgradeBarRed",so)),e.appendChild(o("CMUpgradeBarPurple",lo)),e.appendChild(o("CMUpgradeBarGray",co)),l("upgrades").parentNode.insertBefore(e,l("upgrades").parentNode.childNodes[3])}(),function(){const e=document.createElement("div");e.id="CMSectionHidButtons",e.style.textAlign="center";const t=document.createElement("a");t.className="option",t.onclick=function(){"flex"===l("upgrades").style.display?(l("upgrades").style.display="none",l("toggleUpgrades").style.display="none",l("techUpgrades").style.display="none",l("vaultUpgrades").style.display="none"):(l("upgrades").style.display="flex",0!==l("toggleUpgrades").children.length&&(l("toggleUpgrades").style.display="block"),0!==l("techUpgrades").children.length&&(l("techUpgrades").style.display="block"),0!==l("vaultUpgrades").children.length&&(l("vaultUpgrades").style.display="block"))},t.textContent="Hide/Show Upgrades",e.appendChild(t);const o=document.createElement("a");o.className="option",o.onclick=function(){"grid"===l("products").style.display?l("products").style.display="none":l("products").style.display="grid"},o.textContent="Hide/Show Buildings",e.appendChild(o),l("store").insertBefore(e,l("store").childNodes[2])}(),function(){const e=document.createElement("link");e.id="CMFavicon",e.rel="shortcut icon",e.href="https://orteil.dashnet.org/cookieclicker/favicon.ico",document.getElementsByTagName("head")[0].appendChild(e)}(),Object.keys(ho).forEach((e=>{!function(e,t,o){const a=document.createElement("div");a.id=e;const n=document.createElement("div");n.style.minWidth=o,n.style.marginBottom="4px";const i=document.createElement("div");i.style.textAlign="left",i.textContent=t,n.appendChild(i),a.appendChild(n),go[e]=a}(ho[e][0],ho[e][1],ho[e][2])})),function(){const e=document.createElement("a");e.id="PopAllNormalWrinklerButton",e.textContent="Pop All Normal",e.className="option",e.onclick=function(){Ua()},e.onmouseout=function(){Game.tooltip.shouldHide=1},e.onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>Ra("wb","PopAllNormal")),"this"),Game.tooltip.wobble()},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!==ht[1]&&(Game.wrinklers[ht[1]].hp=0)},t.onmouseout=function(){Game.tooltip.shouldHide=1},t.onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>Ra("wb","PopFattest")),"this"),Game.tooltip.wobble()},l("sectionLeftExtra").children[0].append(t)}(),l("products").style.display="grid",l("storeBulk").style.gridRow="1/1",l("upgrades").style.display="flex",l("upgrades").style["flex-wrap"]="wrap",Object.keys(l("rows").children).forEach((e=>{const t=l("rows").children[e].children[1],o=document.createElement("div");o.id=`productLock${Number(e)+1}`,o.className="productButton",o.innerHTML="Lock",o.onclick=function(){!function(e){"Lock"===l(`productLock${e}`).innerHTML?(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.lockedMinigames.push(e.toString()),l(`row${e}`).style.pointerEvents="none",l(`row${e}`).style.opacity="0.4",l(`productLock${e}`).innerHTML="Unlock",l(`productLock${e}`).style.pointerEvents="auto"):(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.lockedMinigames.includes(e.toString())&&(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.lockedMinigames=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.lockedMinigames.filter((t=>t!==e.toString()))),l(`productLock${e}`).innerHTML="Lock",l(`row${e}`).style.pointerEvents="auto",l(`row${e}`).style.opacity="1")}(Number(e)+1)},t.appendChild(o)})),Object.keys(Game.Objects).forEach((e=>{const t=Game.Objects[e];null!==l(`product${t.id}`).onmouseover&&(Y[e]=l(`product${t.id}`).onmouseover,l(`product${t.id}`).onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>Ra("b",`${e}`)),"store"),Game.tooltip.wobble()})})),Game.canLumps()&&(L=l("lumps").onmouseover,l("lumps").onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>Ra("s","Lump")),"this"),Game.tooltip.wobble()}),U=Game.LoadMinigames,Game.LoadMinigames=function(){U(),Game.Objects.Farm.minigameLoaded&&(l("gardenTool-1").onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>Ra("ha","HarvestAllButton")),"this"),Game.tooltip.wobble()},Array.from(l("gardenPlot").children).forEach((e=>{const t=e.id.slice(-3);e.onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>Ra("p",[`${t[0]}`,`${t[2]}`])),"this"),Game.tooltip.wobble()}}))),Va(),function(){if(Game.Objects.Temple.minigameLoaded){for(let e=0;e<11;e+=1)l(`templeGod${e}`).onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>Ra("pag",e)),"this"),Game.tooltip.wobble()};for(let e=0;e<3;e+=1)l(`templeSlot${e}`).onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>Ra("pas",[e,Game.Objects.Temple.minigame.slot[e]])),"this"),Game.tooltip.wobble()}}}(),Xa()},Game.LoadMinigames(),l("backgroundLeftCanvas").onmouseover=function(){ko=1},l("backgroundLeftCanvas").onmouseout=function(){ko=0,Game.tooltip.hide(),Object.keys(Game.wrinklers).forEach((e=>{Mo[e]=0}))},dn(),Xa(),Game.CalculateGains(),fo=Game.OnAscend,Game.prefs.popups?Game.Popup("Cookie Monster version 2.031.10 loaded!"):Game.Notify("Cookie Monster version 2.031.10 loaded!","","",1,1),Game.Win("Third-party")}function pn(e,t){if(!Game.Objects.Temple.minigameLoaded)return 0;ea();const{minigame:o}=Game.Objects.Temple,a=o.godsById[e].slot;"0"===a?Ne=o.slot[t]:"1"===a?Oe=o.slot[t]:"2"===a&&(De=o.slot[t]),0===t?Ne=e:1===t?Oe=e:2===t&&(De=e);const n=Se;return ra(),ua(),n!==Se&&ra(),We-Game.cookiesPs}function un(){if(No!==Game.OnAscend&&(No=Game.OnAscend,Game.OnAscend?(l("game").style.bottom="0px",1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BotBar&&(l("CMBotBar").style.display="none"),1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBar&&(l("CMTimerBar").style.display="none")):(Za(),Qo()),_o()),!Game.OnAscend&&0===Game.AscendTimer){D!==Object.keys(Game.mods).length&&(za(),Ha(),D=Object.keys(Game.mods).length),Le&&(ja(!0),Ba(),Game.Has("Golden switch [off]")?(ea(),_t["Golden switch [off]"].bought=0,ra(),et=We):et=Game.cookiesPs,ba({CacheNoGoldSwitchCookiesPS:et}),Wa(),Aa(),Da(),Na(),Qa(),function(){for(let e=0;e<11;e+=1)for(let t=0;t<3;t+=1)zt[e][t]=pn(e,t);ba({CacheGods:zt})}(),La(),function(){let e=0;if(Game.Objects.Bank.minigameLoaded){const t=Game.Objects.Bank.minigame.goods;let o=0;Object.keys(t).forEach((e=>{const a=t[e];o+=a.stock*a.val})),e+=o*Game.cookiesPsRawHighest}e+=function(){let e=0;ea();let t=2;5!==Be&&18!==Be||(t-=1),5!==Pe&&18!==Pe||(t-=1),Be=5,Pe=18;for(let e=0;e{Vt[t].amount>0&&(e=t)})),Vt[e].amount-=1,we-=1}return Object.keys(Vt).forEach((t=>{const o=Vt[t];e+=eo(Game.Objects[o.name],Game.Objects[t].basePrice,o.amount,Game.Objects[t].free,o.amount)})),e}(),It=e,ba({CacheSellForChoEgg:It})}(),Le=0);const e=Game.auraMult("Fierce Hoarder")>0;!ve&&e?(ve=!0,Ge=1):ve&&!e&&(ve=!1,Ge=1),Ge&&(Ea(),Ge=0),function(){$a(),Ta(),ja(!1),function(){gt=0;let e=0;Object.keys(Game.wrinklers).forEach((t=>{2===Game.wrinklers[t].phase&&(e+=1)}));let t=1;if(Vt.Temple.minigameLoaded){const e=Game.hasGod("scorn");1===e?t*=1.15:2===e?t*=1.1:3===e&&(t*=1.05)}ft=e,gt=e*(.05*e*1.1)*(.05*Game.Has("Sacrilegious corruption")+1)*(.05*Game.Has("Wrinklerspawn")+1)*t,ba({CacheCurrWrinklerCount:ft,CacheCurrWrinklerCPSMult:gt})}(),Ga(),Oa();const e=Game.HowManyCookiesReset(Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned))+1)-(Game.cookiesEarned+Game.cookiesReset);jt=$o(e/Uo())}(),I!==(Game.TickerEffect&&"fortune"===Game.TickerEffect.type)&&(I=Game.TickerEffect&&"fortune"===Game.TickerEffect.type,I&&(v.createFlash("cookieMonsterMod",3,"FortuneFlash",!1),v.playCMSound("cookieMonsterMod",Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.FortuneSoundURL,"FortuneSound","FortuneVolume",!1),v.createNotification("cookieMonsterMod","FortuneNotification","Fortune Cookie found","A Fortune Cookie has appeared on the Ticker."))),R!==Game.shimmerTypes.reindeer.spawned&&(R=Game.shimmerTypes.reindeer.spawned,Object.keys(Game.shimmers).forEach((e=>{Game.shimmers[e].spawnLead&&"reindeer"===Game.shimmers[e].type&&(Wt=Game.shimmers[e])})),v.createFlash("cookieMonsterMod",3,"SeaFlash",!1),v.playCMSound("cookieMonsterMod",Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SeaSoundURL,"SeaSound","SeaVolume",!1),v.createNotification("cookieMonsterMod","SeaNotification","Reindeer sighted!","A Reindeer has spawned. Click it now!")),Game.Objects.Farm.minigameLoaded&&z!==Game.Objects.Farm.minigame.nextStep&&(0!==z&&z0){let e=0;Object.keys(Game.wrinklers).forEach((t=>{2===Game.wrinklers[t].phase&&(e+=1)})),e>q?(q=e,e===Game.getWrinklersMax()&&Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerMaxFlash?v.createFlash("cookieMonsterMod",3,"WrinklerMaxFlash",!1):v.createFlash("cookieMonsterMod",3,"WrinklerFlash",!1),e===Game.getWrinklersMax()&&Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerMaxSound?v.playCMSound("cookieMonsterMod",Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerMaxSoundURL,"WrinklerMaxSound","WrinklerMaxVolume",!1):v.playCMSound("cookieMonsterMod",Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerSoundURL,"WrinklerSound","WrinklerVolume",!1),e===Game.getWrinklersMax()&&Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerMaxNotification?v.createNotification("cookieMonsterMod","WrinklerMaxNotification","Maximum Wrinklers Reached","You have reached your maximum ammount of wrinklers"):v.createNotification("cookieMonsterMod","WrinklerNotification","A Wrinkler appeared","A new wrinkler has appeared")):q=e}}()}Q=0,Rt={},Object.keys(Game.shimmers).forEach((e=>{Rt[Game.shimmers[e].id]=Game.shimmers[e],Game.shimmers[e].spawnLead&&"golden"===Game.shimmers[e].type&&(At=Game.shimmers[e],Q+=1)})),Object.keys(Do).forEach((e=>{void 0===Rt[e]&&(Do[e].parentNode.removeChild(Do[e]),delete Do[e])})),V!==Game.shimmerTypes.golden.n?(V=Game.shimmerTypes.golden.n,V&&(_{void 0===Do[Game.shimmers[e].id]&&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",t.style.pointerEvents="none",0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.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=""},Do[e.id]=t,l("shimmers").appendChild(t)}(Game.shimmers[e])}))),Ia(),_=Q,0===Q&&(At=0)):1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GCTimer&&V&&Object.keys(Do).forEach((e=>{Do[e].style.opacity=Rt[e].l.style.opacity,Do[e].style.transform=Rt[e].l.style.transform,Do[e].textContent=Math.ceil(Rt[e].life/Game.fps)}))}const hn={Favourite:1,Calculation:1,Notation:1,Colours:1,BarsDisplay:1,Tooltip:1,Statistics:1,Notification:1,NotificationGeneral:1,NotificationGC:1,NotificationFC:1,NotificationSea:1,NotificationGard:1,NotificationMagi:1,NotificationWrink:1,NotificationWrinkMax:1,Miscellaneous:1,Lucky:1,Chain:1,Spells:1,Garden:1,Prestige:1,Wrink:1,Sea:1,Achievs:1,Misc:1,infoMenu:1,optionsMenu:1};function gn(e){za(),w.loadMod("cookieMonsterMod",e,en,hn,un),void 0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.lockedMinigames&&(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.lockedMinigames=[]),tn();for(let e=0;e try to evaluate the options string as JavaScript object\r\n\t\t\t\ttry {\r\n\t\t\t\t\topts = (new Function ('var opts = (' + str + '); return typeof opts === \"object\" ? opts : {};'))();\r\n\t\t\t\t} catch (eEval) {\r\n\t\t\t\t\tthrow new Error('Could not evaluate jscolor options: ' + eEval);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn opts;\r\n\t},\r\n\r\n\r\n\tgetInstances : function () {\r\n\t\tvar inst = [];\r\n\t\tfor (var i = 0; i < jsc.instances.length; i += 1) {\r\n\t\t\t// if the targetElement still exists, the instance is considered \"alive\"\r\n\t\t\tif (jsc.instances[i] && jsc.instances[i].targetElement) {\r\n\t\t\t\tinst.push(jsc.instances[i]);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn inst;\r\n\t},\r\n\r\n\r\n\tcreateEl : function (tagName) {\r\n\t\tvar el = window.document.createElement(tagName);\r\n\t\tjsc.setData(el, 'gui', true);\r\n\t\treturn el;\r\n\t},\r\n\r\n\r\n\tnode : function (nodeOrSelector) {\r\n\t\tif (!nodeOrSelector) {\r\n\t\t\treturn null;\r\n\t\t}\r\n\r\n\t\tif (typeof nodeOrSelector === 'string') {\r\n\t\t\t// query selector\r\n\t\t\tvar sel = nodeOrSelector;\r\n\t\t\tvar el = null;\r\n\t\t\ttry {\r\n\t\t\t\tel = window.document.querySelector(sel);\r\n\t\t\t} catch (e) {\r\n\t\t\t\tconsole.warn(e);\r\n\t\t\t\treturn null;\r\n\t\t\t}\r\n\t\t\tif (!el) {\r\n\t\t\t\tconsole.warn('No element matches the selector: %s', sel);\r\n\t\t\t}\r\n\t\t\treturn el;\r\n\t\t}\r\n\r\n\t\tif (jsc.isNode(nodeOrSelector)) {\r\n\t\t\t// DOM node\r\n\t\t\treturn nodeOrSelector;\r\n\t\t}\r\n\r\n\t\tconsole.warn('Invalid node of type %s: %s', typeof nodeOrSelector, nodeOrSelector);\r\n\t\treturn null;\r\n\t},\r\n\r\n\r\n\t// See https://stackoverflow.com/questions/384286/\r\n\tisNode : function (val) {\r\n\t\tif (typeof Node === 'object') {\r\n\t\t\treturn val instanceof Node;\r\n\t\t}\r\n\t\treturn val && typeof val === 'object' && typeof val.nodeType === 'number' && typeof val.nodeName === 'string';\r\n\t},\r\n\r\n\r\n\tnodeName : function (node) {\r\n\t\tif (node && node.nodeName) {\r\n\t\t\treturn node.nodeName.toLowerCase();\r\n\t\t}\r\n\t\treturn false;\r\n\t},\r\n\r\n\r\n\tremoveChildren : function (node) {\r\n\t\twhile (node.firstChild) {\r\n\t\t\tnode.removeChild(node.firstChild);\r\n\t\t}\r\n\t},\r\n\r\n\r\n\tisTextInput : function (el) {\r\n\t\treturn el && jsc.nodeName(el) === 'input' && el.type.toLowerCase() === 'text';\r\n\t},\r\n\r\n\r\n\tisButton : function (el) {\r\n\t\tif (!el) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tvar n = jsc.nodeName(el);\r\n\t\treturn (\r\n\t\t\t(n === 'button') ||\r\n\t\t\t(n === 'input' && ['button', 'submit', 'reset'].indexOf(el.type.toLowerCase()) > -1)\r\n\t\t);\r\n\t},\r\n\r\n\r\n\tisButtonEmpty : function (el) {\r\n\t\tswitch (jsc.nodeName(el)) {\r\n\t\t\tcase 'input': return (!el.value || el.value.trim() === '');\r\n\t\t\tcase 'button': return (el.textContent.trim() === '');\r\n\t\t}\r\n\t\treturn null; // could not determine element's text\r\n\t},\r\n\r\n\r\n\t// See https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md\r\n\tisPassiveEventSupported : (function () {\r\n\t\tvar supported = false;\r\n\r\n\t\ttry {\r\n\t\t\tvar opts = Object.defineProperty({}, 'passive', {\r\n\t\t\t\tget: function () { supported = true; }\r\n\t\t\t});\r\n\t\t\twindow.addEventListener('testPassive', null, opts);\r\n\t\t\twindow.removeEventListener('testPassive', null, opts);\r\n\t\t} catch (e) {}\r\n\r\n\t\treturn supported;\r\n\t})(),\r\n\r\n\r\n\tisColorAttrSupported : (function () {\r\n\t\tvar elm = window.document.createElement('input');\r\n\t\tif (elm.setAttribute) {\r\n\t\t\telm.setAttribute('type', 'color');\r\n\t\t\tif (elm.type.toLowerCase() == 'color') {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t})(),\r\n\r\n\r\n\tdataProp : '_data_jscolor',\r\n\r\n\r\n\t// usage:\r\n\t// setData(obj, prop, value)\r\n\t// setData(obj, {prop:value, ...})\r\n\t//\r\n\tsetData : function () {\r\n\t\tvar obj = arguments[0];\r\n\r\n\t\tif (arguments.length === 3) {\r\n\t\t\t// setting a single property\r\n\t\t\tvar data = obj.hasOwnProperty(jsc.dataProp) ? obj[jsc.dataProp] : (obj[jsc.dataProp] = {});\r\n\t\t\tvar prop = arguments[1];\r\n\t\t\tvar value = arguments[2];\r\n\r\n\t\t\tdata[prop] = value;\r\n\t\t\treturn true;\r\n\r\n\t\t} else if (arguments.length === 2 && typeof arguments[1] === 'object') {\r\n\t\t\t// setting multiple properties\r\n\t\t\tvar data = obj.hasOwnProperty(jsc.dataProp) ? obj[jsc.dataProp] : (obj[jsc.dataProp] = {});\r\n\t\t\tvar map = arguments[1];\r\n\r\n\t\t\tfor (var prop in map) {\r\n\t\t\t\tif (map.hasOwnProperty(prop)) {\r\n\t\t\t\t\tdata[prop] = map[prop];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t\tthrow new Error('Invalid arguments');\r\n\t},\r\n\r\n\r\n\t// usage:\r\n\t// removeData(obj, prop, [prop...])\r\n\t//\r\n\tremoveData : function () {\r\n\t\tvar obj = arguments[0];\r\n\t\tif (!obj.hasOwnProperty(jsc.dataProp)) {\r\n\t\t\treturn true; // data object does not exist\r\n\t\t}\r\n\t\tfor (var i = 1; i < arguments.length; i += 1) {\r\n\t\t\tvar prop = arguments[i];\r\n\t\t\tdelete obj[jsc.dataProp][prop];\r\n\t\t}\r\n\t\treturn true;\r\n\t},\r\n\r\n\r\n\tgetData : function (obj, prop, setDefault) {\r\n\t\tif (!obj.hasOwnProperty(jsc.dataProp)) {\r\n\t\t\t// data object does not exist\r\n\t\t\tif (setDefault !== undefined) {\r\n\t\t\t\tobj[jsc.dataProp] = {}; // create data object\r\n\t\t\t} else {\r\n\t\t\t\treturn undefined; // no value to return\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar data = obj[jsc.dataProp];\r\n\r\n\t\tif (!data.hasOwnProperty(prop) && setDefault !== undefined) {\r\n\t\t\tdata[prop] = setDefault;\r\n\t\t}\r\n\t\treturn data[prop];\r\n\t},\r\n\r\n\r\n\tgetDataAttr : function (el, name) {\r\n\t\tvar attrName = 'data-' + name;\r\n\t\tvar attrValue = el.getAttribute(attrName);\r\n\t\treturn attrValue;\r\n\t},\r\n\r\n\r\n\tsetDataAttr : function (el, name, value) {\r\n\t\tvar attrName = 'data-' + name;\r\n\t\tel.setAttribute(attrName, value);\r\n\t},\r\n\r\n\r\n\t_attachedGroupEvents : {},\r\n\r\n\r\n\tattachGroupEvent : function (groupName, el, evnt, func) {\r\n\t\tif (!jsc._attachedGroupEvents.hasOwnProperty(groupName)) {\r\n\t\t\tjsc._attachedGroupEvents[groupName] = [];\r\n\t\t}\r\n\t\tjsc._attachedGroupEvents[groupName].push([el, evnt, func]);\r\n\t\tel.addEventListener(evnt, func, false);\r\n\t},\r\n\r\n\r\n\tdetachGroupEvents : function (groupName) {\r\n\t\tif (jsc._attachedGroupEvents.hasOwnProperty(groupName)) {\r\n\t\t\tfor (var i = 0; i < jsc._attachedGroupEvents[groupName].length; i += 1) {\r\n\t\t\t\tvar evt = jsc._attachedGroupEvents[groupName][i];\r\n\t\t\t\tevt[0].removeEventListener(evt[1], evt[2], false);\r\n\t\t\t}\r\n\t\t\tdelete jsc._attachedGroupEvents[groupName];\r\n\t\t}\r\n\t},\r\n\r\n\r\n\tpreventDefault : function (e) {\r\n\t\tif (e.preventDefault) { e.preventDefault(); }\r\n\t\te.returnValue = false;\r\n\t},\r\n\r\n\r\n\tcaptureTarget : function (target) {\r\n\t\t// IE\r\n\t\tif (target.setCapture) {\r\n\t\t\tjsc._capturedTarget = target;\r\n\t\t\tjsc._capturedTarget.setCapture();\r\n\t\t}\r\n\t},\r\n\r\n\r\n\treleaseTarget : function () {\r\n\t\t// IE\r\n\t\tif (jsc._capturedTarget) {\r\n\t\t\tjsc._capturedTarget.releaseCapture();\r\n\t\t\tjsc._capturedTarget = null;\r\n\t\t}\r\n\t},\r\n\r\n\r\n\ttriggerEvent : function (el, eventName, bubbles, cancelable) {\r\n\t\tif (!el) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tvar ev = null;\r\n\r\n\t\tif (typeof Event === 'function') {\r\n\t\t\tev = new Event(eventName, {\r\n\t\t\t\tbubbles: bubbles,\r\n\t\t\t\tcancelable: cancelable\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\t// IE\r\n\t\t\tev = window.document.createEvent('Event');\r\n\t\t\tev.initEvent(eventName, bubbles, cancelable);\r\n\t\t}\r\n\r\n\t\tif (!ev) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\t// so that we know that the event was triggered internally\r\n\t\tjsc.setData(ev, 'internal', true);\r\n\r\n\t\tel.dispatchEvent(ev);\r\n\t\treturn true;\r\n\t},\r\n\r\n\r\n\ttriggerInputEvent : function (el, eventName, bubbles, cancelable) {\r\n\t\tif (!el) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (jsc.isTextInput(el)) {\r\n\t\t\tjsc.triggerEvent(el, eventName, bubbles, cancelable);\r\n\t\t}\r\n\t},\r\n\r\n\r\n\teventKey : function (ev) {\r\n\t\tvar keys = {\r\n\t\t\t9: 'Tab',\r\n\t\t\t13: 'Enter',\r\n\t\t\t27: 'Escape',\r\n\t\t};\r\n\t\tif (typeof ev.code === 'string') {\r\n\t\t\treturn ev.code;\r\n\t\t} else if (ev.keyCode !== undefined && keys.hasOwnProperty(ev.keyCode)) {\r\n\t\t\treturn keys[ev.keyCode];\r\n\t\t}\r\n\t\treturn null;\r\n\t},\r\n\r\n\r\n\tstrList : function (str) {\r\n\t\tif (!str) {\r\n\t\t\treturn [];\r\n\t\t}\r\n\t\treturn str.replace(/^\\s+|\\s+$/g, '').split(/\\s+/);\r\n\t},\r\n\r\n\r\n\t// The className parameter (str) can only contain a single class name\r\n\thasClass : function (elm, className) {\r\n\t\tif (!className) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tif (elm.classList !== undefined) {\r\n\t\t\treturn elm.classList.contains(className);\r\n\t\t}\r\n\t\t// polyfill\r\n\t\treturn -1 != (' ' + elm.className.replace(/\\s+/g, ' ') + ' ').indexOf(' ' + className + ' ');\r\n\t},\r\n\r\n\r\n\t// The className parameter (str) can contain multiple class names separated by whitespace\r\n\taddClass : function (elm, className) {\r\n\t\tvar classNames = jsc.strList(className);\r\n\r\n\t\tif (elm.classList !== undefined) {\r\n\t\t\tfor (var i = 0; i < classNames.length; i += 1) {\r\n\t\t\t\telm.classList.add(classNames[i]);\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t// polyfill\r\n\t\tfor (var i = 0; i < classNames.length; i += 1) {\r\n\t\t\tif (!jsc.hasClass(elm, classNames[i])) {\r\n\t\t\t\telm.className += (elm.className ? ' ' : '') + classNames[i];\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\r\n\t// The className parameter (str) can contain multiple class names separated by whitespace\r\n\tremoveClass : function (elm, className) {\r\n\t\tvar classNames = jsc.strList(className);\r\n\r\n\t\tif (elm.classList !== undefined) {\r\n\t\t\tfor (var i = 0; i < classNames.length; i += 1) {\r\n\t\t\t\telm.classList.remove(classNames[i]);\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t// polyfill\r\n\t\tfor (var i = 0; i < classNames.length; i += 1) {\r\n\t\t\tvar repl = new RegExp(\r\n\t\t\t\t'^\\\\s*' + classNames[i] + '\\\\s*|' +\r\n\t\t\t\t'\\\\s*' + classNames[i] + '\\\\s*$|' +\r\n\t\t\t\t'\\\\s+' + classNames[i] + '(\\\\s+)',\r\n\t\t\t\t'g'\r\n\t\t\t);\r\n\t\t\telm.className = elm.className.replace(repl, '$1');\r\n\t\t}\r\n\t},\r\n\r\n\r\n\tgetCompStyle : function (elm) {\r\n\t\tvar compStyle = window.getComputedStyle ? window.getComputedStyle(elm) : elm.currentStyle;\r\n\r\n\t\t// Note: In Firefox, getComputedStyle returns null in a hidden iframe,\r\n\t\t// that's why we need to check if the returned value is non-empty\r\n\t\tif (!compStyle) {\r\n\t\t\treturn {};\r\n\t\t}\r\n\t\treturn compStyle;\r\n\t},\r\n\r\n\r\n\t// Note:\r\n\t// Setting a property to NULL reverts it to the state before it was first set\r\n\t// with the 'reversible' flag enabled\r\n\t//\r\n\tsetStyle : function (elm, styles, important, reversible) {\r\n\t\t// using '' for standard priority (IE10 apparently doesn't like value undefined)\r\n\t\tvar priority = important ? 'important' : '';\r\n\t\tvar origStyle = null;\r\n\r\n\t\tfor (var prop in styles) {\r\n\t\t\tif (styles.hasOwnProperty(prop)) {\r\n\t\t\t\tvar setVal = null;\r\n\r\n\t\t\t\tif (styles[prop] === null) {\r\n\t\t\t\t\t// reverting a property value\r\n\r\n\t\t\t\t\tif (!origStyle) {\r\n\t\t\t\t\t\t// get the original style object, but dont't try to create it if it doesn't exist\r\n\t\t\t\t\t\torigStyle = jsc.getData(elm, 'origStyle');\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (origStyle && origStyle.hasOwnProperty(prop)) {\r\n\t\t\t\t\t\t// we have property's original value -> use it\r\n\t\t\t\t\t\tsetVal = origStyle[prop];\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// setting a property value\r\n\r\n\t\t\t\t\tif (reversible) {\r\n\t\t\t\t\t\tif (!origStyle) {\r\n\t\t\t\t\t\t\t// get the original style object and if it doesn't exist, create it\r\n\t\t\t\t\t\t\torigStyle = jsc.getData(elm, 'origStyle', {});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (!origStyle.hasOwnProperty(prop)) {\r\n\t\t\t\t\t\t\t// original property value not yet stored -> store it\r\n\t\t\t\t\t\t\torigStyle[prop] = elm.style[prop];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tsetVal = styles[prop];\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (setVal !== null) {\r\n\t\t\t\t\telm.style.setProperty(prop, setVal, priority);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\r\n\thexColor : function (r, g, b) {\r\n\t\treturn '#' + (\r\n\t\t\t('0' + Math.round(r).toString(16)).substr(-2) +\r\n\t\t\t('0' + Math.round(g).toString(16)).substr(-2) +\r\n\t\t\t('0' + Math.round(b).toString(16)).substr(-2)\r\n\t\t).toUpperCase();\r\n\t},\r\n\r\n\r\n\thexaColor : function (r, g, b, a) {\r\n\t\treturn '#' + (\r\n\t\t\t('0' + Math.round(r).toString(16)).substr(-2) +\r\n\t\t\t('0' + Math.round(g).toString(16)).substr(-2) +\r\n\t\t\t('0' + Math.round(b).toString(16)).substr(-2) +\r\n\t\t\t('0' + Math.round(a * 255).toString(16)).substr(-2)\r\n\t\t).toUpperCase();\r\n\t},\r\n\r\n\r\n\trgbColor : function (r, g, b) {\r\n\t\treturn 'rgb(' +\r\n\t\t\tMath.round(r) + ',' +\r\n\t\t\tMath.round(g) + ',' +\r\n\t\t\tMath.round(b) +\r\n\t\t')';\r\n\t},\r\n\r\n\r\n\trgbaColor : function (r, g, b, a) {\r\n\t\treturn 'rgba(' +\r\n\t\t\tMath.round(r) + ',' +\r\n\t\t\tMath.round(g) + ',' +\r\n\t\t\tMath.round(b) + ',' +\r\n\t\t\t(Math.round((a===undefined || a===null ? 1 : a) * 100) / 100) +\r\n\t\t')';\r\n\t},\r\n\r\n\r\n\tlinearGradient : (function () {\r\n\r\n\t\tfunction getFuncName () {\r\n\t\t\tvar stdName = 'linear-gradient';\r\n\t\t\tvar prefixes = ['', '-webkit-', '-moz-', '-o-', '-ms-'];\r\n\t\t\tvar helper = window.document.createElement('div');\r\n\r\n\t\t\tfor (var i = 0; i < prefixes.length; i += 1) {\r\n\t\t\t\tvar tryFunc = prefixes[i] + stdName;\r\n\t\t\t\tvar tryVal = tryFunc + '(to right, rgba(0,0,0,0), rgba(0,0,0,0))';\r\n\r\n\t\t\t\thelper.style.background = tryVal;\r\n\t\t\t\tif (helper.style.background) { // CSS background successfully set -> function name is supported\r\n\t\t\t\t\treturn tryFunc;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn stdName; // fallback to standard 'linear-gradient' without vendor prefix\r\n\t\t}\r\n\r\n\t\tvar funcName = getFuncName();\r\n\r\n\t\treturn function () {\r\n\t\t\treturn funcName + '(' + Array.prototype.join.call(arguments, ', ') + ')';\r\n\t\t};\r\n\r\n\t})(),\r\n\r\n\r\n\tsetBorderRadius : function (elm, value) {\r\n\t\tjsc.setStyle(elm, {'border-radius' : value || '0'});\r\n\t},\r\n\r\n\r\n\tsetBoxShadow : function (elm, value) {\r\n\t\tjsc.setStyle(elm, {'box-shadow': value || 'none'});\r\n\t},\r\n\r\n\r\n\tgetElementPos : function (e, relativeToViewport) {\r\n\t\tvar x=0, y=0;\r\n\t\tvar rect = e.getBoundingClientRect();\r\n\t\tx = rect.left;\r\n\t\ty = rect.top;\r\n\t\tif (!relativeToViewport) {\r\n\t\t\tvar viewPos = jsc.getViewPos();\r\n\t\t\tx += viewPos[0];\r\n\t\t\ty += viewPos[1];\r\n\t\t}\r\n\t\treturn [x, y];\r\n\t},\r\n\r\n\r\n\tgetElementSize : function (e) {\r\n\t\treturn [e.offsetWidth, e.offsetHeight];\r\n\t},\r\n\r\n\r\n\t// get pointer's X/Y coordinates relative to viewport\r\n\tgetAbsPointerPos : function (e) {\r\n\t\tvar x = 0, y = 0;\r\n\t\tif (typeof e.changedTouches !== 'undefined' && e.changedTouches.length) {\r\n\t\t\t// touch devices\r\n\t\t\tx = e.changedTouches[0].clientX;\r\n\t\t\ty = e.changedTouches[0].clientY;\r\n\t\t} else if (typeof e.clientX === 'number') {\r\n\t\t\tx = e.clientX;\r\n\t\t\ty = e.clientY;\r\n\t\t}\r\n\t\treturn { x: x, y: y };\r\n\t},\r\n\r\n\r\n\t// get pointer's X/Y coordinates relative to target element\r\n\tgetRelPointerPos : function (e) {\r\n\t\tvar target = e.target || e.srcElement;\r\n\t\tvar targetRect = target.getBoundingClientRect();\r\n\r\n\t\tvar x = 0, y = 0;\r\n\r\n\t\tvar clientX = 0, clientY = 0;\r\n\t\tif (typeof e.changedTouches !== 'undefined' && e.changedTouches.length) {\r\n\t\t\t// touch devices\r\n\t\t\tclientX = e.changedTouches[0].clientX;\r\n\t\t\tclientY = e.changedTouches[0].clientY;\r\n\t\t} else if (typeof e.clientX === 'number') {\r\n\t\t\tclientX = e.clientX;\r\n\t\t\tclientY = e.clientY;\r\n\t\t}\r\n\r\n\t\tx = clientX - targetRect.left;\r\n\t\ty = clientY - targetRect.top;\r\n\t\treturn { x: x, y: y };\r\n\t},\r\n\r\n\r\n\tgetViewPos : function () {\r\n\t\tvar doc = window.document.documentElement;\r\n\t\treturn [\r\n\t\t\t(window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0),\r\n\t\t\t(window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0)\r\n\t\t];\r\n\t},\r\n\r\n\r\n\tgetViewSize : function () {\r\n\t\tvar doc = window.document.documentElement;\r\n\t\treturn [\r\n\t\t\t(window.innerWidth || doc.clientWidth),\r\n\t\t\t(window.innerHeight || doc.clientHeight),\r\n\t\t];\r\n\t},\r\n\r\n\r\n\t// r: 0-255\r\n\t// g: 0-255\r\n\t// b: 0-255\r\n\t//\r\n\t// returns: [ 0-360, 0-100, 0-100 ]\r\n\t//\r\n\tRGB_HSV : function (r, g, b) {\r\n\t\tr /= 255;\r\n\t\tg /= 255;\r\n\t\tb /= 255;\r\n\t\tvar n = Math.min(Math.min(r,g),b);\r\n\t\tvar v = Math.max(Math.max(r,g),b);\r\n\t\tvar m = v - n;\r\n\t\tif (m === 0) { return [ null, 0, 100 * v ]; }\r\n\t\tvar h = r===n ? 3+(b-g)/m : (g===n ? 5+(r-b)/m : 1+(g-r)/m);\r\n\t\treturn [\r\n\t\t\t60 * (h===6?0:h),\r\n\t\t\t100 * (m/v),\r\n\t\t\t100 * v\r\n\t\t];\r\n\t},\r\n\r\n\r\n\t// h: 0-360\r\n\t// s: 0-100\r\n\t// v: 0-100\r\n\t//\r\n\t// returns: [ 0-255, 0-255, 0-255 ]\r\n\t//\r\n\tHSV_RGB : function (h, s, v) {\r\n\t\tvar u = 255 * (v / 100);\r\n\r\n\t\tif (h === null) {\r\n\t\t\treturn [ u, u, u ];\r\n\t\t}\r\n\r\n\t\th /= 60;\r\n\t\ts /= 100;\r\n\r\n\t\tvar i = Math.floor(h);\r\n\t\tvar f = i%2 ? h-i : 1-(h-i);\r\n\t\tvar m = u * (1 - s);\r\n\t\tvar n = u * (1 - s * f);\r\n\t\tswitch (i) {\r\n\t\t\tcase 6:\r\n\t\t\tcase 0: return [u,n,m];\r\n\t\t\tcase 1: return [n,u,m];\r\n\t\t\tcase 2: return [m,u,n];\r\n\t\t\tcase 3: return [m,n,u];\r\n\t\t\tcase 4: return [n,m,u];\r\n\t\t\tcase 5: return [u,m,n];\r\n\t\t}\r\n\t},\r\n\r\n\r\n\tparseColorString : function (str) {\r\n\t\tvar ret = {\r\n\t\t\trgba: null,\r\n\t\t\tformat: null // 'hex' | 'hexa' | 'rgb' | 'rgba'\r\n\t\t};\r\n\r\n\t\tvar m;\r\n\r\n\t\tif (m = str.match(/^\\W*([0-9A-F]{3,8})\\W*$/i)) {\r\n\t\t\t// HEX notation\r\n\r\n\t\t\tif (m[1].length === 8) {\r\n\t\t\t\t// 8-char notation (= with alpha)\r\n\t\t\t\tret.format = 'hexa';\r\n\t\t\t\tret.rgba = [\r\n\t\t\t\t\tparseInt(m[1].substr(0,2),16),\r\n\t\t\t\t\tparseInt(m[1].substr(2,2),16),\r\n\t\t\t\t\tparseInt(m[1].substr(4,2),16),\r\n\t\t\t\t\tparseInt(m[1].substr(6,2),16) / 255\r\n\t\t\t\t];\r\n\r\n\t\t\t} else if (m[1].length === 6) {\r\n\t\t\t\t// 6-char notation\r\n\t\t\t\tret.format = 'hex';\r\n\t\t\t\tret.rgba = [\r\n\t\t\t\t\tparseInt(m[1].substr(0,2),16),\r\n\t\t\t\t\tparseInt(m[1].substr(2,2),16),\r\n\t\t\t\t\tparseInt(m[1].substr(4,2),16),\r\n\t\t\t\t\tnull\r\n\t\t\t\t];\r\n\r\n\t\t\t} else if (m[1].length === 3) {\r\n\t\t\t\t// 3-char notation\r\n\t\t\t\tret.format = 'hex';\r\n\t\t\t\tret.rgba = [\r\n\t\t\t\t\tparseInt(m[1].charAt(0) + m[1].charAt(0),16),\r\n\t\t\t\t\tparseInt(m[1].charAt(1) + m[1].charAt(1),16),\r\n\t\t\t\t\tparseInt(m[1].charAt(2) + m[1].charAt(2),16),\r\n\t\t\t\t\tnull\r\n\t\t\t\t];\r\n\r\n\t\t\t} else {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\treturn ret;\r\n\t\t}\r\n\r\n\t\tif (m = str.match(/^\\W*rgba?\\(([^)]*)\\)\\W*$/i)) {\r\n\t\t\t// rgb(...) or rgba(...) notation\r\n\r\n\t\t\tvar par = m[1].split(',');\r\n\t\t\tvar re = /^\\s*(\\d+|\\d*\\.\\d+|\\d+\\.\\d*)\\s*$/;\r\n\t\t\tvar mR, mG, mB, mA;\r\n\t\t\tif (\r\n\t\t\t\tpar.length >= 3 &&\r\n\t\t\t\t(mR = par[0].match(re)) &&\r\n\t\t\t\t(mG = par[1].match(re)) &&\r\n\t\t\t\t(mB = par[2].match(re))\r\n\t\t\t) {\r\n\t\t\t\tret.format = 'rgb';\r\n\t\t\t\tret.rgba = [\r\n\t\t\t\t\tparseFloat(mR[1]) || 0,\r\n\t\t\t\t\tparseFloat(mG[1]) || 0,\r\n\t\t\t\t\tparseFloat(mB[1]) || 0,\r\n\t\t\t\t\tnull\r\n\t\t\t\t];\r\n\r\n\t\t\t\tif (\r\n\t\t\t\t\tpar.length >= 4 &&\r\n\t\t\t\t\t(mA = par[3].match(re))\r\n\t\t\t\t) {\r\n\t\t\t\t\tret.format = 'rgba';\r\n\t\t\t\t\tret.rgba[3] = parseFloat(mA[1]) || 0;\r\n\t\t\t\t}\r\n\t\t\t\treturn ret;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\t},\r\n\r\n\r\n\tparsePaletteValue : function (mixed) {\r\n\t\tvar vals = [];\r\n\r\n\t\tif (typeof mixed === 'string') { // input is a string of space separated color values\r\n\t\t\t// rgb() and rgba() may contain spaces too, so let's find all color values by regex\r\n\t\t\tmixed.replace(/#[0-9A-F]{3}([0-9A-F]{3})?|rgba?\\(([^)]*)\\)/ig, function (val) {\r\n\t\t\t\tvals.push(val);\r\n\t\t\t});\r\n\t\t} else if (Array.isArray(mixed)) { // input is an array of color values\r\n\t\t\tvals = mixed;\r\n\t\t}\r\n\r\n\t\t// convert all values into uniform color format\r\n\r\n\t\tvar colors = [];\r\n\r\n\t\tfor (var i = 0; i < vals.length; i++) {\r\n\t\t\tvar color = jsc.parseColorString(vals[i]);\r\n\t\t\tif (color) {\r\n\t\t\t\tcolors.push(color);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn colors;\r\n\t},\r\n\r\n\r\n\tcontainsTranparentColor : function (colors) {\r\n\t\tfor (var i = 0; i < colors.length; i++) {\r\n\t\t\tvar a = colors[i].rgba[3];\r\n\t\t\tif (a !== null && a < 1.0) {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t},\r\n\r\n\r\n\tisAlphaFormat : function (format) {\r\n\t\tswitch (format.toLowerCase()) {\r\n\t\tcase 'hexa':\r\n\t\tcase 'rgba':\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t},\r\n\r\n\r\n\t// Canvas scaling for retina displays\r\n\t//\r\n\t// adapted from https://www.html5rocks.com/en/tutorials/canvas/hidpi/\r\n\t//\r\n\tscaleCanvasForHighDPR : function (canvas) {\r\n\t\tvar dpr = window.devicePixelRatio || 1;\r\n\t\tcanvas.width *= dpr;\r\n\t\tcanvas.height *= dpr;\r\n\t\tvar ctx = canvas.getContext('2d');\r\n\t\tctx.scale(dpr, dpr);\r\n\t},\r\n\r\n\r\n\tgenColorPreviewCanvas : function (color, separatorPos, specWidth, scaleForHighDPR) {\r\n\r\n\t\tvar sepW = Math.round(jsc.pub.previewSeparator.length);\r\n\t\tvar sqSize = jsc.pub.chessboardSize;\r\n\t\tvar sqColor1 = jsc.pub.chessboardColor1;\r\n\t\tvar sqColor2 = jsc.pub.chessboardColor2;\r\n\r\n\t\tvar cWidth = specWidth ? specWidth : sqSize * 2;\r\n\t\tvar cHeight = sqSize * 2;\r\n\r\n\t\tvar canvas = jsc.createEl('canvas');\r\n\t\tvar ctx = canvas.getContext('2d');\r\n\r\n\t\tcanvas.width = cWidth;\r\n\t\tcanvas.height = cHeight;\r\n\t\tif (scaleForHighDPR) {\r\n\t\t\tjsc.scaleCanvasForHighDPR(canvas);\r\n\t\t}\r\n\r\n\t\t// transparency chessboard - background\r\n\t\tctx.fillStyle = sqColor1;\r\n\t\tctx.fillRect(0, 0, cWidth, cHeight);\r\n\r\n\t\t// transparency chessboard - squares\r\n\t\tctx.fillStyle = sqColor2;\r\n\t\tfor (var x = 0; x < cWidth; x += sqSize * 2) {\r\n\t\t\tctx.fillRect(x, 0, sqSize, sqSize);\r\n\t\t\tctx.fillRect(x + sqSize, sqSize, sqSize, sqSize);\r\n\t\t}\r\n\r\n\t\tif (color) {\r\n\t\t\t// actual color in foreground\r\n\t\t\tctx.fillStyle = color;\r\n\t\t\tctx.fillRect(0, 0, cWidth, cHeight);\r\n\t\t}\r\n\r\n\t\tvar start = null;\r\n\t\tswitch (separatorPos) {\r\n\t\t\tcase 'left':\r\n\t\t\t\tstart = 0;\r\n\t\t\t\tctx.clearRect(0, 0, sepW/2, cHeight);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'right':\r\n\t\t\t\tstart = cWidth - sepW;\r\n\t\t\t\tctx.clearRect(cWidth - (sepW/2), 0, sepW/2, cHeight);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\tif (start !== null) {\r\n\t\t\tctx.lineWidth = 1;\r\n\t\t\tfor (var i = 0; i < jsc.pub.previewSeparator.length; i += 1) {\r\n\t\t\t\tctx.beginPath();\r\n\t\t\t\tctx.strokeStyle = jsc.pub.previewSeparator[i];\r\n\t\t\t\tctx.moveTo(0.5 + start + i, 0);\r\n\t\t\t\tctx.lineTo(0.5 + start + i, cHeight);\r\n\t\t\t\tctx.stroke();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\tcanvas: canvas,\r\n\t\t\twidth: cWidth,\r\n\t\t\theight: cHeight,\r\n\t\t};\r\n\t},\r\n\r\n\r\n\t// if position or width is not set => fill the entire element (0%-100%)\r\n\tgenColorPreviewGradient : function (color, position, width) {\r\n\t\tvar params = [];\r\n\r\n\t\tif (position && width) {\r\n\t\t\tparams = [\r\n\t\t\t\t'to ' + {'left':'right', 'right':'left'}[position],\r\n\t\t\t\tcolor + ' 0%',\r\n\t\t\t\tcolor + ' ' + width + 'px',\r\n\t\t\t\t'rgba(0,0,0,0) ' + (width + 1) + 'px',\r\n\t\t\t\t'rgba(0,0,0,0) 100%',\r\n\t\t\t];\r\n\t\t} else {\r\n\t\t\tparams = [\r\n\t\t\t\t'to right',\r\n\t\t\t\tcolor + ' 0%',\r\n\t\t\t\tcolor + ' 100%',\r\n\t\t\t];\r\n\t\t}\r\n\r\n\t\treturn jsc.linearGradient.apply(this, params);\r\n\t},\r\n\r\n\r\n\tredrawPosition : function () {\r\n\r\n\t\tif (!jsc.picker || !jsc.picker.owner) {\r\n\t\t\treturn; // picker is not shown\r\n\t\t}\r\n\r\n\t\tvar thisObj = jsc.picker.owner;\r\n\r\n\t\tvar tp, vp;\r\n\r\n\t\tif (thisObj.fixed) {\r\n\t\t\t// Fixed elements are positioned relative to viewport,\r\n\t\t\t// therefore we can ignore the scroll offset\r\n\t\t\ttp = jsc.getElementPos(thisObj.targetElement, true); // target pos\r\n\t\t\tvp = [0, 0]; // view pos\r\n\t\t} else {\r\n\t\t\ttp = jsc.getElementPos(thisObj.targetElement); // target pos\r\n\t\t\tvp = jsc.getViewPos(); // view pos\r\n\t\t}\r\n\r\n\t\tvar ts = jsc.getElementSize(thisObj.targetElement); // target size\r\n\t\tvar vs = jsc.getViewSize(); // view size\r\n\t\tvar pd = jsc.getPickerDims(thisObj);\r\n\t\tvar ps = [pd.borderW, pd.borderH]; // picker outer size\r\n\t\tvar a, b, c;\r\n\t\tswitch (thisObj.position.toLowerCase()) {\r\n\t\t\tcase 'left': a=1; b=0; c=-1; break;\r\n\t\t\tcase 'right':a=1; b=0; c=1; break;\r\n\t\t\tcase 'top': a=0; b=1; c=-1; break;\r\n\t\t\tdefault: a=0; b=1; c=1; break;\r\n\t\t}\r\n\t\tvar l = (ts[b]+ps[b])/2;\r\n\r\n\t\t// compute picker position\r\n\t\tif (!thisObj.smartPosition) {\r\n\t\t\tvar pp = [\r\n\t\t\t\ttp[a],\r\n\t\t\t\ttp[b]+ts[b]-l+l*c\r\n\t\t\t];\r\n\t\t} else {\r\n\t\t\tvar pp = [\r\n\t\t\t\t-vp[a]+tp[a]+ps[a] > vs[a] ?\r\n\t\t\t\t\t(-vp[a]+tp[a]+ts[a]/2 > vs[a]/2 && tp[a]+ts[a]-ps[a] >= 0 ? tp[a]+ts[a]-ps[a] : tp[a]) :\r\n\t\t\t\t\ttp[a],\r\n\t\t\t\t-vp[b]+tp[b]+ts[b]+ps[b]-l+l*c > vs[b] ?\r\n\t\t\t\t\t(-vp[b]+tp[b]+ts[b]/2 > vs[b]/2 && tp[b]+ts[b]-l-l*c >= 0 ? tp[b]+ts[b]-l-l*c : tp[b]+ts[b]-l+l*c) :\r\n\t\t\t\t\t(tp[b]+ts[b]-l+l*c >= 0 ? tp[b]+ts[b]-l+l*c : tp[b]+ts[b]-l-l*c)\r\n\t\t\t];\r\n\t\t}\r\n\r\n\t\tvar x = pp[a];\r\n\t\tvar y = pp[b];\r\n\t\tvar positionValue = thisObj.fixed ? 'fixed' : 'absolute';\r\n\t\tvar contractShadow =\r\n\t\t\t(pp[0] + ps[0] > tp[0] || pp[0] < tp[0] + ts[0]) &&\r\n\t\t\t(pp[1] + ps[1] < tp[1] + ts[1]);\r\n\r\n\t\tjsc._drawPosition(thisObj, x, y, positionValue, contractShadow);\r\n\t},\r\n\r\n\r\n\t_drawPosition : function (thisObj, x, y, positionValue, contractShadow) {\r\n\t\tvar vShadow = contractShadow ? 0 : thisObj.shadowBlur; // px\r\n\r\n\t\tjsc.picker.wrap.style.position = positionValue;\r\n\t\tjsc.picker.wrap.style.left = x + 'px';\r\n\t\tjsc.picker.wrap.style.top = y + 'px';\r\n\r\n\t\tjsc.setBoxShadow(\r\n\t\t\tjsc.picker.boxS,\r\n\t\t\tthisObj.shadow ?\r\n\t\t\t\tnew jsc.BoxShadow(0, vShadow, thisObj.shadowBlur, 0, thisObj.shadowColor) :\r\n\t\t\t\tnull);\r\n\t},\r\n\r\n\r\n\tgetPickerDims : function (thisObj) {\r\n\t\tvar w = 2 * thisObj.controlBorderWidth + thisObj.width;\r\n\t\tvar h = 2 * thisObj.controlBorderWidth + thisObj.height;\r\n\r\n\t\tvar sliderSpace = 2 * thisObj.controlBorderWidth + 2 * jsc.getControlPadding(thisObj) + thisObj.sliderSize;\r\n\r\n\t\tif (jsc.getSliderChannel(thisObj)) {\r\n\t\t\tw += sliderSpace;\r\n\t\t}\r\n\t\tif (thisObj.hasAlphaChannel()) {\r\n\t\t\tw += sliderSpace;\r\n\t\t}\r\n\r\n\t\tvar pal = jsc.getPaletteDims(thisObj, w);\r\n\r\n\t\tif (pal.height) {\r\n\t\t\th += pal.height + thisObj.padding;\r\n\t\t}\r\n\t\tif (thisObj.closeButton) {\r\n\t\t\th += 2 * thisObj.controlBorderWidth + thisObj.padding + thisObj.buttonHeight;\r\n\t\t}\r\n\r\n\t\tvar pW = w + (2 * thisObj.padding);\r\n\t\tvar pH = h + (2 * thisObj.padding);\r\n\r\n\t\treturn {\r\n\t\t\tcontentW: w,\r\n\t\t\tcontentH: h,\r\n\t\t\tpaddedW: pW,\r\n\t\t\tpaddedH: pH,\r\n\t\t\tborderW: pW + (2 * thisObj.borderWidth),\r\n\t\t\tborderH: pH + (2 * thisObj.borderWidth),\r\n\t\t\tpalette: pal,\r\n\t\t};\r\n\t},\r\n\r\n\r\n\tgetPaletteDims : function (thisObj, width) {\r\n\t\tvar cols = 0, rows = 0, cellW = 0, cellH = 0, height = 0;\r\n\t\tvar sampleCount = thisObj._palette ? thisObj._palette.length : 0;\r\n\r\n\t\tif (sampleCount) {\r\n\t\t\tcols = thisObj.paletteCols;\r\n\t\t\trows = cols > 0 ? Math.ceil(sampleCount / cols) : 0;\r\n\r\n\t\t\t// color sample's dimensions (includes border)\r\n\t\t\tcellW = Math.max(1, Math.floor((width - ((cols - 1) * thisObj.paletteSpacing)) / cols));\r\n\t\t\tcellH = thisObj.paletteHeight ? Math.min(thisObj.paletteHeight, cellW) : cellW;\r\n\t\t}\r\n\r\n\t\tif (rows) {\r\n\t\t\theight =\r\n\t\t\t\trows * cellH +\r\n\t\t\t\t(rows - 1) * thisObj.paletteSpacing;\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\tcols: cols,\r\n\t\t\trows: rows,\r\n\t\t\tcellW: cellW,\r\n\t\t\tcellH: cellH,\r\n\t\t\twidth: width,\r\n\t\t\theight: height,\r\n\t\t};\r\n\t},\r\n\r\n\r\n\tgetControlPadding : function (thisObj) {\r\n\t\treturn Math.max(\r\n\t\t\tthisObj.padding / 2,\r\n\t\t\t(2 * thisObj.pointerBorderWidth + thisObj.pointerThickness) - thisObj.controlBorderWidth\r\n\t\t);\r\n\t},\r\n\r\n\r\n\tgetPadYChannel : function (thisObj) {\r\n\t\tswitch (thisObj.mode.charAt(1).toLowerCase()) {\r\n\t\t\tcase 'v': return 'v'; break;\r\n\t\t}\r\n\t\treturn 's';\r\n\t},\r\n\r\n\r\n\tgetSliderChannel : function (thisObj) {\r\n\t\tif (thisObj.mode.length > 2) {\r\n\t\t\tswitch (thisObj.mode.charAt(2).toLowerCase()) {\r\n\t\t\t\tcase 's': return 's'; break;\r\n\t\t\t\tcase 'v': return 'v'; break;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t},\r\n\r\n\r\n\t// calls function specified in picker's property\r\n\ttriggerCallback : function (thisObj, prop) {\r\n\t\tif (!thisObj[prop]) {\r\n\t\t\treturn; // callback func not specified\r\n\t\t}\r\n\t\tvar callback = null;\r\n\r\n\t\tif (typeof thisObj[prop] === 'string') {\r\n\t\t\t// string with code\r\n\t\t\ttry {\r\n\t\t\t\tcallback = new Function (thisObj[prop]);\r\n\t\t\t} catch (e) {\r\n\t\t\t\tconsole.error(e);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t// function\r\n\t\t\tcallback = thisObj[prop];\r\n\t\t}\r\n\r\n\t\tif (callback) {\r\n\t\t\tcallback.call(thisObj);\r\n\t\t}\r\n\t},\r\n\r\n\r\n\t// Triggers a color change related event(s) on all picker instances.\r\n\t// It is possible to specify multiple events separated with a space.\r\n\ttriggerGlobal : function (eventNames) {\r\n\t\tvar inst = jsc.getInstances();\r\n\t\tfor (var i = 0; i < inst.length; i += 1) {\r\n\t\t\tinst[i].trigger(eventNames);\r\n\t\t}\r\n\t},\r\n\r\n\r\n\t_pointerMoveEvent : {\r\n\t\tmouse: 'mousemove',\r\n\t\ttouch: 'touchmove'\r\n\t},\r\n\t_pointerEndEvent : {\r\n\t\tmouse: 'mouseup',\r\n\t\ttouch: 'touchend'\r\n\t},\r\n\r\n\r\n\t_pointerOrigin : null,\r\n\t_capturedTarget : null,\r\n\r\n\r\n\tonDocumentKeyUp : function (e) {\r\n\t\tif (['Tab', 'Escape'].indexOf(jsc.eventKey(e)) !== -1) {\r\n\t\t\tif (jsc.picker && jsc.picker.owner) {\r\n\t\t\t\tjsc.picker.owner.tryHide();\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\r\n\tonWindowResize : function (e) {\r\n\t\tjsc.redrawPosition();\r\n\t},\r\n\r\n\r\n\tonWindowScroll : function (e) {\r\n\t\tjsc.redrawPosition();\r\n\t},\r\n\r\n\r\n\tonParentScroll : function (e) {\r\n\t\t// hide the picker when one of the parent elements is scrolled\r\n\t\tif (jsc.picker && jsc.picker.owner) {\r\n\t\t\tjsc.picker.owner.tryHide();\r\n\t\t}\r\n\t},\r\n\r\n\r\n\tonDocumentMouseDown : function (e) {\r\n\t\tvar target = e.target || e.srcElement;\r\n\r\n\t\tif (target.jscolor && target.jscolor instanceof jsc.pub) { // clicked targetElement -> show picker\r\n\t\t\tif (target.jscolor.showOnClick && !target.disabled) {\r\n\t\t\t\ttarget.jscolor.show();\r\n\t\t\t}\r\n\t\t} else if (jsc.getData(target, 'gui')) { // clicked jscolor's GUI element\r\n\t\t\tvar control = jsc.getData(target, 'control');\r\n\t\t\tif (control) {\r\n\t\t\t\t// jscolor's control\r\n\t\t\t\tjsc.onControlPointerStart(e, target, jsc.getData(target, 'control'), 'mouse');\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t// mouse is outside the picker's controls -> hide the color picker!\r\n\t\t\tif (jsc.picker && jsc.picker.owner) {\r\n\t\t\t\tjsc.picker.owner.tryHide();\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\r\n\tonPickerTouchStart : function (e) {\r\n\t\tvar target = e.target || e.srcElement;\r\n\r\n\t\tif (jsc.getData(target, 'control')) {\r\n\t\t\tjsc.onControlPointerStart(e, target, jsc.getData(target, 'control'), 'touch');\r\n\t\t}\r\n\t},\r\n\r\n\r\n\tonControlPointerStart : function (e, target, controlName, pointerType) {\r\n\t\tvar thisObj = jsc.getData(target, 'instance');\r\n\r\n\t\tjsc.preventDefault(e);\r\n\t\tjsc.captureTarget(target);\r\n\r\n\t\tvar registerDragEvents = function (doc, offset) {\r\n\t\t\tjsc.attachGroupEvent('drag', doc, jsc._pointerMoveEvent[pointerType],\r\n\t\t\t\tjsc.onDocumentPointerMove(e, target, controlName, pointerType, offset));\r\n\t\t\tjsc.attachGroupEvent('drag', doc, jsc._pointerEndEvent[pointerType],\r\n\t\t\t\tjsc.onDocumentPointerEnd(e, target, controlName, pointerType));\r\n\t\t};\r\n\r\n\t\tregisterDragEvents(window.document, [0, 0]);\r\n\r\n\t\tif (window.parent && window.frameElement) {\r\n\t\t\tvar rect = window.frameElement.getBoundingClientRect();\r\n\t\t\tvar ofs = [-rect.left, -rect.top];\r\n\t\t\tregisterDragEvents(window.parent.window.document, ofs);\r\n\t\t}\r\n\r\n\t\tvar abs = jsc.getAbsPointerPos(e);\r\n\t\tvar rel = jsc.getRelPointerPos(e);\r\n\t\tjsc._pointerOrigin = {\r\n\t\t\tx: abs.x - rel.x,\r\n\t\t\ty: abs.y - rel.y\r\n\t\t};\r\n\r\n\t\tswitch (controlName) {\r\n\t\tcase 'pad':\r\n\t\t\t// if the value slider is at the bottom, move it up\r\n\t\t\tif (jsc.getSliderChannel(thisObj) === 'v' && thisObj.channels.v === 0) {\r\n\t\t\t\tthisObj.fromHSVA(null, null, 100, null);\r\n\t\t\t}\r\n\t\t\tjsc.setPad(thisObj, e, 0, 0);\r\n\t\t\tbreak;\r\n\r\n\t\tcase 'sld':\r\n\t\t\tjsc.setSld(thisObj, e, 0);\r\n\t\t\tbreak;\r\n\r\n\t\tcase 'asld':\r\n\t\t\tjsc.setASld(thisObj, e, 0);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tthisObj.trigger('input');\r\n\t},\r\n\r\n\r\n\tonDocumentPointerMove : function (e, target, controlName, pointerType, offset) {\r\n\t\treturn function (e) {\r\n\t\t\tvar thisObj = jsc.getData(target, 'instance');\r\n\t\t\tswitch (controlName) {\r\n\t\t\tcase 'pad':\r\n\t\t\t\tjsc.setPad(thisObj, e, offset[0], offset[1]);\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'sld':\r\n\t\t\t\tjsc.setSld(thisObj, e, offset[1]);\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'asld':\r\n\t\t\t\tjsc.setASld(thisObj, e, offset[1]);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tthisObj.trigger('input');\r\n\t\t}\r\n\t},\r\n\r\n\r\n\tonDocumentPointerEnd : function (e, target, controlName, pointerType) {\r\n\t\treturn function (e) {\r\n\t\t\tvar thisObj = jsc.getData(target, 'instance');\r\n\t\t\tjsc.detachGroupEvents('drag');\r\n\t\t\tjsc.releaseTarget();\r\n\r\n\t\t\t// Always trigger changes AFTER detaching outstanding mouse handlers,\r\n\t\t\t// in case some color change that occured in user-defined onChange/onInput handler\r\n\t\t\t// intruded into current mouse events\r\n\t\t\tthisObj.trigger('input');\r\n\t\t\tthisObj.trigger('change');\r\n\t\t};\r\n\t},\r\n\r\n\r\n\tonPaletteSampleClick : function (e) {\r\n\t\tvar target = e.currentTarget;\r\n\t\tvar thisObj = jsc.getData(target, 'instance');\r\n\t\tvar color = jsc.getData(target, 'color');\r\n\r\n\t\t// when format is flexible, use the original format of this color sample\r\n\t\tif (thisObj.format.toLowerCase() === 'any') {\r\n\t\t\tthisObj._setFormat(color.format); // adapt format\r\n\t\t\tif (!jsc.isAlphaFormat(thisObj.getFormat())) {\r\n\t\t\t\tcolor.rgba[3] = 1.0; // when switching to a format that doesn't support alpha, set full opacity\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// if this color doesn't specify alpha, use alpha of 1.0 (if applicable)\r\n\t\tif (color.rgba[3] === null) {\r\n\t\t\tif (thisObj.paletteSetsAlpha === true || (thisObj.paletteSetsAlpha === 'auto' && thisObj._paletteHasTransparency)) {\r\n\t\t\t\tcolor.rgba[3] = 1.0;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tthisObj.fromRGBA.apply(thisObj, color.rgba);\r\n\r\n\t\tthisObj.trigger('input');\r\n\t\tthisObj.trigger('change');\r\n\r\n\t\tif (thisObj.hideOnPaletteClick) {\r\n\t\t\tthisObj.hide();\r\n\t\t}\r\n\t},\r\n\r\n\r\n\tsetPad : function (thisObj, e, ofsX, ofsY) {\r\n\t\tvar pointerAbs = jsc.getAbsPointerPos(e);\r\n\t\tvar x = ofsX + pointerAbs.x - jsc._pointerOrigin.x - thisObj.padding - thisObj.controlBorderWidth;\r\n\t\tvar y = ofsY + pointerAbs.y - jsc._pointerOrigin.y - thisObj.padding - thisObj.controlBorderWidth;\r\n\r\n\t\tvar xVal = x * (360 / (thisObj.width - 1));\r\n\t\tvar yVal = 100 - (y * (100 / (thisObj.height - 1)));\r\n\r\n\t\tswitch (jsc.getPadYChannel(thisObj)) {\r\n\t\tcase 's': thisObj.fromHSVA(xVal, yVal, null, null); break;\r\n\t\tcase 'v': thisObj.fromHSVA(xVal, null, yVal, null); break;\r\n\t\t}\r\n\t},\r\n\r\n\r\n\tsetSld : function (thisObj, e, ofsY) {\r\n\t\tvar pointerAbs = jsc.getAbsPointerPos(e);\r\n\t\tvar y = ofsY + pointerAbs.y - jsc._pointerOrigin.y - thisObj.padding - thisObj.controlBorderWidth;\r\n\t\tvar yVal = 100 - (y * (100 / (thisObj.height - 1)));\r\n\r\n\t\tswitch (jsc.getSliderChannel(thisObj)) {\r\n\t\tcase 's': thisObj.fromHSVA(null, yVal, null, null); break;\r\n\t\tcase 'v': thisObj.fromHSVA(null, null, yVal, null); break;\r\n\t\t}\r\n\t},\r\n\r\n\r\n\tsetASld : function (thisObj, e, ofsY) {\r\n\t\tvar pointerAbs = jsc.getAbsPointerPos(e);\r\n\t\tvar y = ofsY + pointerAbs.y - jsc._pointerOrigin.y - thisObj.padding - thisObj.controlBorderWidth;\r\n\t\tvar yVal = 1.0 - (y * (1.0 / (thisObj.height - 1)));\r\n\r\n\t\tif (yVal < 1.0) {\r\n\t\t\t// if format is flexible and the current format doesn't support alpha, switch to a suitable one\r\n\t\t\tvar fmt = thisObj.getFormat();\r\n\t\t\tif (thisObj.format.toLowerCase() === 'any' && !jsc.isAlphaFormat(fmt)) {\r\n\t\t\t\tthisObj._setFormat(fmt === 'hex' ? 'hexa' : 'rgba');\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tthisObj.fromHSVA(null, null, null, yVal);\r\n\t},\r\n\r\n\r\n\tcreatePadCanvas : function () {\r\n\r\n\t\tvar ret = {\r\n\t\t\telm: null,\r\n\t\t\tdraw: null\r\n\t\t};\r\n\r\n\t\tvar canvas = jsc.createEl('canvas');\r\n\t\tvar ctx = canvas.getContext('2d');\r\n\r\n\t\tvar drawFunc = function (width, height, type) {\r\n\t\t\tcanvas.width = width;\r\n\t\t\tcanvas.height = height;\r\n\r\n\t\t\tctx.clearRect(0, 0, canvas.width, canvas.height);\r\n\r\n\t\t\tvar hGrad = ctx.createLinearGradient(0, 0, canvas.width, 0);\r\n\t\t\thGrad.addColorStop(0 / 6, '#F00');\r\n\t\t\thGrad.addColorStop(1 / 6, '#FF0');\r\n\t\t\thGrad.addColorStop(2 / 6, '#0F0');\r\n\t\t\thGrad.addColorStop(3 / 6, '#0FF');\r\n\t\t\thGrad.addColorStop(4 / 6, '#00F');\r\n\t\t\thGrad.addColorStop(5 / 6, '#F0F');\r\n\t\t\thGrad.addColorStop(6 / 6, '#F00');\r\n\r\n\t\t\tctx.fillStyle = hGrad;\r\n\t\t\tctx.fillRect(0, 0, canvas.width, canvas.height);\r\n\r\n\t\t\tvar vGrad = ctx.createLinearGradient(0, 0, 0, canvas.height);\r\n\t\t\tswitch (type.toLowerCase()) {\r\n\t\t\tcase 's':\r\n\t\t\t\tvGrad.addColorStop(0, 'rgba(255,255,255,0)');\r\n\t\t\t\tvGrad.addColorStop(1, 'rgba(255,255,255,1)');\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'v':\r\n\t\t\t\tvGrad.addColorStop(0, 'rgba(0,0,0,0)');\r\n\t\t\t\tvGrad.addColorStop(1, 'rgba(0,0,0,1)');\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tctx.fillStyle = vGrad;\r\n\t\t\tctx.fillRect(0, 0, canvas.width, canvas.height);\r\n\t\t};\r\n\r\n\t\tret.elm = canvas;\r\n\t\tret.draw = drawFunc;\r\n\r\n\t\treturn ret;\r\n\t},\r\n\r\n\r\n\tcreateSliderGradient : function () {\r\n\r\n\t\tvar ret = {\r\n\t\t\telm: null,\r\n\t\t\tdraw: null\r\n\t\t};\r\n\r\n\t\tvar canvas = jsc.createEl('canvas');\r\n\t\tvar ctx = canvas.getContext('2d');\r\n\r\n\t\tvar drawFunc = function (width, height, color1, color2) {\r\n\t\t\tcanvas.width = width;\r\n\t\t\tcanvas.height = height;\r\n\r\n\t\t\tctx.clearRect(0, 0, canvas.width, canvas.height);\r\n\r\n\t\t\tvar grad = ctx.createLinearGradient(0, 0, 0, canvas.height);\r\n\t\t\tgrad.addColorStop(0, color1);\r\n\t\t\tgrad.addColorStop(1, color2);\r\n\r\n\t\t\tctx.fillStyle = grad;\r\n\t\t\tctx.fillRect(0, 0, canvas.width, canvas.height);\r\n\t\t};\r\n\r\n\t\tret.elm = canvas;\r\n\t\tret.draw = drawFunc;\r\n\r\n\t\treturn ret;\r\n\t},\r\n\r\n\r\n\tcreateASliderGradient : function () {\r\n\r\n\t\tvar ret = {\r\n\t\t\telm: null,\r\n\t\t\tdraw: null\r\n\t\t};\r\n\r\n\t\tvar canvas = jsc.createEl('canvas');\r\n\t\tvar ctx = canvas.getContext('2d');\r\n\r\n\t\tvar drawFunc = function (width, height, color) {\r\n\t\t\tcanvas.width = width;\r\n\t\t\tcanvas.height = height;\r\n\r\n\t\t\tctx.clearRect(0, 0, canvas.width, canvas.height);\r\n\r\n\t\t\tvar sqSize = canvas.width / 2;\r\n\t\t\tvar sqColor1 = jsc.pub.chessboardColor1;\r\n\t\t\tvar sqColor2 = jsc.pub.chessboardColor2;\r\n\r\n\t\t\t// dark gray background\r\n\t\t\tctx.fillStyle = sqColor1;\r\n\t\t\tctx.fillRect(0, 0, canvas.width, canvas.height);\r\n\r\n\t\t\tif (sqSize > 0) { // to avoid infinite loop\r\n\t\t\t\tfor (var y = 0; y < canvas.height; y += sqSize * 2) {\r\n\t\t\t\t\t// light gray squares\r\n\t\t\t\t\tctx.fillStyle = sqColor2;\r\n\t\t\t\t\tctx.fillRect(0, y, sqSize, sqSize);\r\n\t\t\t\t\tctx.fillRect(sqSize, y + sqSize, sqSize, sqSize);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tvar grad = ctx.createLinearGradient(0, 0, 0, canvas.height);\r\n\t\t\tgrad.addColorStop(0, color);\r\n\t\t\tgrad.addColorStop(1, 'rgba(0,0,0,0)');\r\n\r\n\t\t\tctx.fillStyle = grad;\r\n\t\t\tctx.fillRect(0, 0, canvas.width, canvas.height);\r\n\t\t};\r\n\r\n\t\tret.elm = canvas;\r\n\t\tret.draw = drawFunc;\r\n\r\n\t\treturn ret;\r\n\t},\r\n\r\n\r\n\tBoxShadow : (function () {\r\n\t\tvar BoxShadow = function (hShadow, vShadow, blur, spread, color, inset) {\r\n\t\t\tthis.hShadow = hShadow;\r\n\t\t\tthis.vShadow = vShadow;\r\n\t\t\tthis.blur = blur;\r\n\t\t\tthis.spread = spread;\r\n\t\t\tthis.color = color;\r\n\t\t\tthis.inset = !!inset;\r\n\t\t};\r\n\r\n\t\tBoxShadow.prototype.toString = function () {\r\n\t\t\tvar vals = [\r\n\t\t\t\tMath.round(this.hShadow) + 'px',\r\n\t\t\t\tMath.round(this.vShadow) + 'px',\r\n\t\t\t\tMath.round(this.blur) + 'px',\r\n\t\t\t\tMath.round(this.spread) + 'px',\r\n\t\t\t\tthis.color\r\n\t\t\t];\r\n\t\t\tif (this.inset) {\r\n\t\t\t\tvals.push('inset');\r\n\t\t\t}\r\n\t\t\treturn vals.join(' ');\r\n\t\t};\r\n\r\n\t\treturn BoxShadow;\r\n\t})(),\r\n\r\n\r\n\tflags : {\r\n\t\tleaveValue : 1 << 0,\r\n\t\tleaveAlpha : 1 << 1,\r\n\t\tleavePreview : 1 << 2,\r\n\t},\r\n\r\n\r\n\tenumOpts : {\r\n\t\tformat: ['auto', 'any', 'hex', 'hexa', 'rgb', 'rgba'],\r\n\t\tpreviewPosition: ['left', 'right'],\r\n\t\tmode: ['hsv', 'hvs', 'hs', 'hv'],\r\n\t\tposition: ['left', 'right', 'top', 'bottom'],\r\n\t\talphaChannel: ['auto', true, false],\r\n\t\tpaletteSetsAlpha: ['auto', true, false],\r\n\t},\r\n\r\n\r\n\tdeprecatedOpts : {\r\n\t\t// : ( can be null)\r\n\t\t'styleElement': 'previewElement',\r\n\t\t'onFineChange': 'onInput',\r\n\t\t'overwriteImportant': 'forceStyle',\r\n\t\t'closable': 'closeButton',\r\n\t\t'insetWidth': 'controlBorderWidth',\r\n\t\t'insetColor': 'controlBorderColor',\r\n\t\t'refine': null,\r\n\t},\r\n\r\n\r\n\tdocsRef : ' ' + 'See https://jscolor.com/docs/',\r\n\r\n\r\n\t//\r\n\t// Usage:\r\n\t// var myPicker = new JSColor( [, ])\r\n\t//\r\n\t// (constructor is accessible via both 'jscolor' and 'JSColor' name)\r\n\t//\r\n\r\n\tpub : function (targetElement, opts) {\r\n\r\n\t\tvar THIS = this;\r\n\r\n\t\tif (!opts) {\r\n\t\t\topts = {};\r\n\t\t}\r\n\r\n\t\tthis.channels = {\r\n\t\t\tr: 255, // red [0-255]\r\n\t\t\tg: 255, // green [0-255]\r\n\t\t\tb: 255, // blue [0-255]\r\n\t\t\th: 0, // hue [0-360]\r\n\t\t\ts: 0, // saturation [0-100]\r\n\t\t\tv: 100, // value (brightness) [0-100]\r\n\t\t\ta: 1.0, // alpha (opacity) [0.0 - 1.0]\r\n\t\t};\r\n\r\n\t\t// General options\r\n\t\t//\r\n\t\tthis.format = 'auto'; // 'auto' | 'any' | 'hex' | 'hexa' | 'rgb' | 'rgba' - Format of the input/output value\r\n\t\tthis.value = undefined; // INITIAL color value in any supported format. To change it later, use method fromString(), fromHSVA(), fromRGBA() or channel()\r\n\t\tthis.alpha = undefined; // INITIAL alpha value. To change it later, call method channel('A', )\r\n\t\tthis.random = false; // whether to randomize the initial color. Either true | false, or an array of ranges: [minV, maxV, minS, maxS, minH, maxH, minA, maxA]\r\n\t\tthis.onChange = undefined; // called when color changes. Value can be either a function or a string with JS code.\r\n\t\tthis.onInput = undefined; // called repeatedly as the color is being changed, e.g. while dragging a slider. Value can be either a function or a string with JS code.\r\n\t\tthis.valueElement = undefined; // element that will be used to display and input the color value\r\n\t\tthis.alphaElement = undefined; // element that will be used to display and input the alpha (opacity) value\r\n\t\tthis.previewElement = undefined; // element that will preview the picked color using CSS background\r\n\t\tthis.previewPosition = 'left'; // 'left' | 'right' - position of the color preview in previewElement\r\n\t\tthis.previewSize = 32; // (px) width of the color preview displayed in previewElement\r\n\t\tthis.previewPadding = 8; // (px) space between color preview and content of the previewElement\r\n\t\tthis.required = true; // whether the associated text input must always contain a color value. If false, the input can be left empty.\r\n\t\tthis.hash = true; // whether to prefix the HEX color code with # symbol (only applicable for HEX format)\r\n\t\tthis.uppercase = true; // whether to show the HEX color code in upper case (only applicable for HEX format)\r\n\t\tthis.forceStyle = true; // whether to overwrite CSS style of the previewElement using !important flag\r\n\r\n\t\t// Color Picker options\r\n\t\t//\r\n\t\tthis.width = 181; // width of the color spectrum (in px)\r\n\t\tthis.height = 101; // height of the color spectrum (in px)\r\n\t\tthis.mode = 'HSV'; // 'HSV' | 'HVS' | 'HS' | 'HV' - layout of the color picker controls\r\n\t\tthis.alphaChannel = 'auto'; // 'auto' | true | false - if alpha channel is enabled, the alpha slider will be visible. If 'auto', it will be determined according to color format\r\n\t\tthis.position = 'bottom'; // 'left' | 'right' | 'top' | 'bottom' - position relative to the target element\r\n\t\tthis.smartPosition = true; // automatically change picker position when there is not enough space for it\r\n\t\tthis.showOnClick = true; // whether to show the picker when user clicks its target element\r\n\t\tthis.hideOnLeave = true; // whether to automatically hide the picker when user leaves its target element (e.g. upon clicking the document)\r\n\t\tthis.palette = []; // colors to be displayed in the palette, specified as an array or a string of space separated color values (in any supported format)\r\n\t\tthis.paletteCols = 10; // number of columns in the palette\r\n\t\tthis.paletteSetsAlpha = 'auto'; // 'auto' | true | false - if true, palette colors that don't specify alpha will set alpha to 1.0\r\n\t\tthis.paletteHeight = 16; // maximum height (px) of a row in the palette\r\n\t\tthis.paletteSpacing = 4; // distance (px) between color samples in the palette\r\n\t\tthis.hideOnPaletteClick = false; // when set to true, clicking the palette will also hide the color picker\r\n\t\tthis.sliderSize = 16; // px\r\n\t\tthis.crossSize = 8; // px\r\n\t\tthis.closeButton = false; // whether to display the Close button\r\n\t\tthis.closeText = 'Close';\r\n\t\tthis.buttonColor = 'rgba(0,0,0,1)'; // CSS color\r\n\t\tthis.buttonHeight = 18; // px\r\n\t\tthis.padding = 12; // px\r\n\t\tthis.backgroundColor = 'rgba(255,255,255,1)'; // CSS color\r\n\t\tthis.borderWidth = 1; // px\r\n\t\tthis.borderColor = 'rgba(187,187,187,1)'; // CSS color\r\n\t\tthis.borderRadius = 8; // px\r\n\t\tthis.controlBorderWidth = 1; // px\r\n\t\tthis.controlBorderColor = 'rgba(187,187,187,1)'; // CSS color\r\n\t\tthis.shadow = true; // whether to display a shadow\r\n\t\tthis.shadowBlur = 15; // px\r\n\t\tthis.shadowColor = 'rgba(0,0,0,0.2)'; // CSS color\r\n\t\tthis.pointerColor = 'rgba(76,76,76,1)'; // CSS color\r\n\t\tthis.pointerBorderWidth = 1; // px\r\n\t\tthis.pointerBorderColor = 'rgba(255,255,255,1)'; // CSS color\r\n\t\tthis.pointerThickness = 2; // px\r\n\t\tthis.zIndex = 5000;\r\n\t\tthis.container = undefined; // where to append the color picker (BODY element by default)\r\n\r\n\t\t// Experimental\r\n\t\t//\r\n\t\tthis.minS = 0; // min allowed saturation (0 - 100)\r\n\t\tthis.maxS = 100; // max allowed saturation (0 - 100)\r\n\t\tthis.minV = 0; // min allowed value (brightness) (0 - 100)\r\n\t\tthis.maxV = 100; // max allowed value (brightness) (0 - 100)\r\n\t\tthis.minA = 0.0; // min allowed alpha (opacity) (0.0 - 1.0)\r\n\t\tthis.maxA = 1.0; // max allowed alpha (opacity) (0.0 - 1.0)\r\n\r\n\r\n\t\t// Getter: option(name)\r\n\t\t// Setter: option(name, value)\r\n\t\t// option({name:value, ...})\r\n\t\t//\r\n\t\tthis.option = function () {\r\n\t\t\tif (!arguments.length) {\r\n\t\t\t\tthrow new Error('No option specified');\r\n\t\t\t}\r\n\r\n\t\t\tif (arguments.length === 1 && typeof arguments[0] === 'string') {\r\n\t\t\t\t// getting a single option\r\n\t\t\t\ttry {\r\n\t\t\t\t\treturn getOption(arguments[0]);\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tconsole.warn(e);\r\n\t\t\t\t}\r\n\t\t\t\treturn false;\r\n\r\n\t\t\t} else if (arguments.length >= 2 && typeof arguments[0] === 'string') {\r\n\t\t\t\t// setting a single option\r\n\t\t\t\ttry {\r\n\t\t\t\t\tif (!setOption(arguments[0], arguments[1])) {\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t}\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tconsole.warn(e);\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t\tthis.redraw(); // immediately redraws the picker, if it's displayed\r\n\t\t\t\tthis.exposeColor(); // in case some preview-related or format-related option was changed\r\n\t\t\t\treturn true;\r\n\r\n\t\t\t} else if (arguments.length === 1 && typeof arguments[0] === 'object') {\r\n\t\t\t\t// setting multiple options\r\n\t\t\t\tvar opts = arguments[0];\r\n\t\t\t\tvar success = true;\r\n\t\t\t\tfor (var opt in opts) {\r\n\t\t\t\t\tif (opts.hasOwnProperty(opt)) {\r\n\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\tif (!setOption(opt, opts[opt])) {\r\n\t\t\t\t\t\t\t\tsuccess = false;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t} catch (e) {\r\n\t\t\t\t\t\t\tconsole.warn(e);\r\n\t\t\t\t\t\t\tsuccess = false;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tthis.redraw(); // immediately redraws the picker, if it's displayed\r\n\t\t\t\tthis.exposeColor(); // in case some preview-related or format-related option was changed\r\n\t\t\t\treturn success;\r\n\t\t\t}\r\n\r\n\t\t\tthrow new Error('Invalid arguments');\r\n\t\t}\r\n\r\n\r\n\t\t// Getter: channel(name)\r\n\t\t// Setter: channel(name, value)\r\n\t\t//\r\n\t\tthis.channel = function (name, value) {\r\n\t\t\tif (typeof name !== 'string') {\r\n\t\t\t\tthrow new Error('Invalid value for channel name: ' + name);\r\n\t\t\t}\r\n\r\n\t\t\tif (value === undefined) {\r\n\t\t\t\t// getting channel value\r\n\t\t\t\tif (!this.channels.hasOwnProperty(name.toLowerCase())) {\r\n\t\t\t\t\tconsole.warn('Getting unknown channel: ' + name);\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t\treturn this.channels[name.toLowerCase()];\r\n\r\n\t\t\t} else {\r\n\t\t\t\t// setting channel value\r\n\t\t\t\tvar res = false;\r\n\t\t\t\tswitch (name.toLowerCase()) {\r\n\t\t\t\t\tcase 'r': res = this.fromRGBA(value, null, null, null); break;\r\n\t\t\t\t\tcase 'g': res = this.fromRGBA(null, value, null, null); break;\r\n\t\t\t\t\tcase 'b': res = this.fromRGBA(null, null, value, null); break;\r\n\t\t\t\t\tcase 'h': res = this.fromHSVA(value, null, null, null); break;\r\n\t\t\t\t\tcase 's': res = this.fromHSVA(null, value, null, null); break;\r\n\t\t\t\t\tcase 'v': res = this.fromHSVA(null, null, value, null); break;\r\n\t\t\t\t\tcase 'a': res = this.fromHSVA(null, null, null, value); break;\r\n\t\t\t\t\tdefault:\r\n\t\t\t\t\t\tconsole.warn('Setting unknown channel: ' + name);\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t\tif (res) {\r\n\t\t\t\t\tthis.redraw(); // immediately redraws the picker, if it's displayed\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\r\n\t\t// Triggers given input event(s) by:\r\n\t\t// - executing on callback specified as picker's option\r\n\t\t// - triggering standard DOM event listeners attached to the value element\r\n\t\t//\r\n\t\t// It is possible to specify multiple events separated with a space.\r\n\t\t//\r\n\t\tthis.trigger = function (eventNames) {\r\n\t\t\tvar evs = jsc.strList(eventNames);\r\n\t\t\tfor (var i = 0; i < evs.length; i += 1) {\r\n\t\t\t\tvar ev = evs[i].toLowerCase();\r\n\r\n\t\t\t\t// trigger a callback\r\n\t\t\t\tvar callbackProp = null;\r\n\t\t\t\tswitch (ev) {\r\n\t\t\t\t\tcase 'input': callbackProp = 'onInput'; break;\r\n\t\t\t\t\tcase 'change': callbackProp = 'onChange'; break;\r\n\t\t\t\t}\r\n\t\t\t\tif (callbackProp) {\r\n\t\t\t\t\tjsc.triggerCallback(this, callbackProp);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// trigger standard DOM event listeners on the value element\r\n\t\t\t\tjsc.triggerInputEvent(this.valueElement, ev, true, true);\r\n\t\t\t}\r\n\t\t};\r\n\r\n\r\n\t\t// h: 0-360\r\n\t\t// s: 0-100\r\n\t\t// v: 0-100\r\n\t\t// a: 0.0-1.0\r\n\t\t//\r\n\t\tthis.fromHSVA = function (h, s, v, a, flags) { // null = don't change\r\n\t\t\tif (h === undefined) { h = null; }\r\n\t\t\tif (s === undefined) { s = null; }\r\n\t\t\tif (v === undefined) { v = null; }\r\n\t\t\tif (a === undefined) { a = null; }\r\n\r\n\t\t\tif (h !== null) {\r\n\t\t\t\tif (isNaN(h)) { return false; }\r\n\t\t\t\tthis.channels.h = Math.max(0, Math.min(360, h));\r\n\t\t\t}\r\n\t\t\tif (s !== null) {\r\n\t\t\t\tif (isNaN(s)) { return false; }\r\n\t\t\t\tthis.channels.s = Math.max(0, Math.min(100, this.maxS, s), this.minS);\r\n\t\t\t}\r\n\t\t\tif (v !== null) {\r\n\t\t\t\tif (isNaN(v)) { return false; }\r\n\t\t\t\tthis.channels.v = Math.max(0, Math.min(100, this.maxV, v), this.minV);\r\n\t\t\t}\r\n\t\t\tif (a !== null) {\r\n\t\t\t\tif (isNaN(a)) { return false; }\r\n\t\t\t\tthis.channels.a = this.hasAlphaChannel() ?\r\n\t\t\t\t\tMath.max(0, Math.min(1, this.maxA, a), this.minA) :\r\n\t\t\t\t\t1.0; // if alpha channel is disabled, the color should stay 100% opaque\r\n\t\t\t}\r\n\r\n\t\t\tvar rgb = jsc.HSV_RGB(\r\n\t\t\t\tthis.channels.h,\r\n\t\t\t\tthis.channels.s,\r\n\t\t\t\tthis.channels.v\r\n\t\t\t);\r\n\t\t\tthis.channels.r = rgb[0];\r\n\t\t\tthis.channels.g = rgb[1];\r\n\t\t\tthis.channels.b = rgb[2];\r\n\r\n\t\t\tthis.exposeColor(flags);\r\n\t\t\treturn true;\r\n\t\t};\r\n\r\n\r\n\t\t// r: 0-255\r\n\t\t// g: 0-255\r\n\t\t// b: 0-255\r\n\t\t// a: 0.0-1.0\r\n\t\t//\r\n\t\tthis.fromRGBA = function (r, g, b, a, flags) { // null = don't change\r\n\t\t\tif (r === undefined) { r = null; }\r\n\t\t\tif (g === undefined) { g = null; }\r\n\t\t\tif (b === undefined) { b = null; }\r\n\t\t\tif (a === undefined) { a = null; }\r\n\r\n\t\t\tif (r !== null) {\r\n\t\t\t\tif (isNaN(r)) { return false; }\r\n\t\t\t\tr = Math.max(0, Math.min(255, r));\r\n\t\t\t}\r\n\t\t\tif (g !== null) {\r\n\t\t\t\tif (isNaN(g)) { return false; }\r\n\t\t\t\tg = Math.max(0, Math.min(255, g));\r\n\t\t\t}\r\n\t\t\tif (b !== null) {\r\n\t\t\t\tif (isNaN(b)) { return false; }\r\n\t\t\t\tb = Math.max(0, Math.min(255, b));\r\n\t\t\t}\r\n\t\t\tif (a !== null) {\r\n\t\t\t\tif (isNaN(a)) { return false; }\r\n\t\t\t\tthis.channels.a = this.hasAlphaChannel() ?\r\n\t\t\t\t\tMath.max(0, Math.min(1, this.maxA, a), this.minA) :\r\n\t\t\t\t\t1.0; // if alpha channel is disabled, the color should stay 100% opaque\r\n\t\t\t}\r\n\r\n\t\t\tvar hsv = jsc.RGB_HSV(\r\n\t\t\t\tr===null ? this.channels.r : r,\r\n\t\t\t\tg===null ? this.channels.g : g,\r\n\t\t\t\tb===null ? this.channels.b : b\r\n\t\t\t);\r\n\t\t\tif (hsv[0] !== null) {\r\n\t\t\t\tthis.channels.h = Math.max(0, Math.min(360, hsv[0]));\r\n\t\t\t}\r\n\t\t\tif (hsv[2] !== 0) { // fully black color stays black through entire saturation range, so let's not change saturation\r\n\t\t\t\tthis.channels.s = Math.max(0, this.minS, Math.min(100, this.maxS, hsv[1]));\r\n\t\t\t}\r\n\t\t\tthis.channels.v = Math.max(0, this.minV, Math.min(100, this.maxV, hsv[2]));\r\n\r\n\t\t\t// update RGB according to final HSV, as some values might be trimmed\r\n\t\t\tvar rgb = jsc.HSV_RGB(this.channels.h, this.channels.s, this.channels.v);\r\n\t\t\tthis.channels.r = rgb[0];\r\n\t\t\tthis.channels.g = rgb[1];\r\n\t\t\tthis.channels.b = rgb[2];\r\n\r\n\t\t\tthis.exposeColor(flags);\r\n\t\t\treturn true;\r\n\t\t};\r\n\r\n\r\n\t\t// DEPRECATED. Use .fromHSVA() instead\r\n\t\t//\r\n\t\tthis.fromHSV = function (h, s, v, flags) {\r\n\t\t\tconsole.warn('fromHSV() method is DEPRECATED. Using fromHSVA() instead.' + jsc.docsRef);\r\n\t\t\treturn this.fromHSVA(h, s, v, null, flags);\r\n\t\t};\r\n\r\n\r\n\t\t// DEPRECATED. Use .fromRGBA() instead\r\n\t\t//\r\n\t\tthis.fromRGB = function (r, g, b, flags) {\r\n\t\t\tconsole.warn('fromRGB() method is DEPRECATED. Using fromRGBA() instead.' + jsc.docsRef);\r\n\t\t\treturn this.fromRGBA(r, g, b, null, flags);\r\n\t\t};\r\n\r\n\r\n\t\tthis.fromString = function (str, flags) {\r\n\t\t\tif (!this.required && str.trim() === '') {\r\n\t\t\t\t// setting empty string to an optional color input\r\n\t\t\t\tthis.setPreviewElementBg(null);\r\n\t\t\t\tthis.setValueElementValue('');\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\r\n\t\t\tvar color = jsc.parseColorString(str);\r\n\t\t\tif (!color) {\r\n\t\t\t\treturn false; // could not parse\r\n\t\t\t}\r\n\t\t\tif (this.format.toLowerCase() === 'any') {\r\n\t\t\t\tthis._setFormat(color.format); // adapt format\r\n\t\t\t\tif (!jsc.isAlphaFormat(this.getFormat())) {\r\n\t\t\t\t\tcolor.rgba[3] = 1.0; // when switching to a format that doesn't support alpha, set full opacity\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis.fromRGBA(\r\n\t\t\t\tcolor.rgba[0],\r\n\t\t\t\tcolor.rgba[1],\r\n\t\t\t\tcolor.rgba[2],\r\n\t\t\t\tcolor.rgba[3],\r\n\t\t\t\tflags\r\n\t\t\t);\r\n\t\t\treturn true;\r\n\t\t};\r\n\r\n\r\n\t\tthis.randomize = function (minV, maxV, minS, maxS, minH, maxH, minA, maxA) {\r\n\t\t\tif (minV === undefined) { minV = 0; }\r\n\t\t\tif (maxV === undefined) { maxV = 100; }\r\n\t\t\tif (minS === undefined) { minS = 0; }\r\n\t\t\tif (maxS === undefined) { maxS = 100; }\r\n\t\t\tif (minH === undefined) { minH = 0; }\r\n\t\t\tif (maxH === undefined) { maxH = 359; }\r\n\t\t\tif (minA === undefined) { minA = 1; }\r\n\t\t\tif (maxA === undefined) { maxA = 1; }\r\n\r\n\t\t\tthis.fromHSVA(\r\n\t\t\t\tminH + Math.floor(Math.random() * (maxH - minH + 1)),\r\n\t\t\t\tminS + Math.floor(Math.random() * (maxS - minS + 1)),\r\n\t\t\t\tminV + Math.floor(Math.random() * (maxV - minV + 1)),\r\n\t\t\t\t((100 * minA) + Math.floor(Math.random() * (100 * (maxA - minA) + 1))) / 100\r\n\t\t\t);\r\n\t\t};\r\n\r\n\r\n\t\tthis.toString = function (format) {\r\n\t\t\tif (format === undefined) {\r\n\t\t\t\tformat = this.getFormat(); // format not specified -> use the current format\r\n\t\t\t}\r\n\t\t\tswitch (format.toLowerCase()) {\r\n\t\t\t\tcase 'hex': return this.toHEXString(); break;\r\n\t\t\t\tcase 'hexa': return this.toHEXAString(); break;\r\n\t\t\t\tcase 'rgb': return this.toRGBString(); break;\r\n\t\t\t\tcase 'rgba': return this.toRGBAString(); break;\r\n\t\t\t}\r\n\t\t\treturn false;\r\n\t\t};\r\n\r\n\r\n\t\tthis.toHEXString = function () {\r\n\t\t\treturn jsc.hexColor(\r\n\t\t\t\tthis.channels.r,\r\n\t\t\t\tthis.channels.g,\r\n\t\t\t\tthis.channels.b\r\n\t\t\t);\r\n\t\t};\r\n\r\n\r\n\t\tthis.toHEXAString = function () {\r\n\t\t\treturn jsc.hexaColor(\r\n\t\t\t\tthis.channels.r,\r\n\t\t\t\tthis.channels.g,\r\n\t\t\t\tthis.channels.b,\r\n\t\t\t\tthis.channels.a\r\n\t\t\t);\r\n\t\t};\r\n\r\n\r\n\t\tthis.toRGBString = function () {\r\n\t\t\treturn jsc.rgbColor(\r\n\t\t\t\tthis.channels.r,\r\n\t\t\t\tthis.channels.g,\r\n\t\t\t\tthis.channels.b\r\n\t\t\t);\r\n\t\t};\r\n\r\n\r\n\t\tthis.toRGBAString = function () {\r\n\t\t\treturn jsc.rgbaColor(\r\n\t\t\t\tthis.channels.r,\r\n\t\t\t\tthis.channels.g,\r\n\t\t\t\tthis.channels.b,\r\n\t\t\t\tthis.channels.a\r\n\t\t\t);\r\n\t\t};\r\n\r\n\r\n\t\tthis.toGrayscale = function () {\r\n\t\t\treturn (\r\n\t\t\t\t0.213 * this.channels.r +\r\n\t\t\t\t0.715 * this.channels.g +\r\n\t\t\t\t0.072 * this.channels.b\r\n\t\t\t);\r\n\t\t};\r\n\r\n\r\n\t\tthis.toCanvas = function () {\r\n\t\t\treturn jsc.genColorPreviewCanvas(this.toRGBAString()).canvas;\r\n\t\t};\r\n\r\n\r\n\t\tthis.toDataURL = function () {\r\n\t\t\treturn this.toCanvas().toDataURL();\r\n\t\t};\r\n\r\n\r\n\t\tthis.toBackground = function () {\r\n\t\t\treturn jsc.pub.background(this.toRGBAString());\r\n\t\t};\r\n\r\n\r\n\t\tthis.isLight = function () {\r\n\t\t\treturn this.toGrayscale() > 255 / 2;\r\n\t\t};\r\n\r\n\r\n\t\tthis.hide = function () {\r\n\t\t\tif (isPickerOwner()) {\r\n\t\t\t\tdetachPicker();\r\n\t\t\t}\r\n\t\t};\r\n\r\n\r\n\t\tthis.show = function () {\r\n\t\t\tdrawPicker();\r\n\t\t};\r\n\r\n\r\n\t\tthis.redraw = function () {\r\n\t\t\tif (isPickerOwner()) {\r\n\t\t\t\tdrawPicker();\r\n\t\t\t}\r\n\t\t};\r\n\r\n\r\n\t\tthis.getFormat = function () {\r\n\t\t\treturn this._currentFormat;\r\n\t\t};\r\n\r\n\r\n\t\tthis._setFormat = function (format) {\r\n\t\t\tthis._currentFormat = format.toLowerCase();\r\n\t\t};\r\n\r\n\r\n\t\tthis.hasAlphaChannel = function () {\r\n\t\t\tif (this.alphaChannel === 'auto') {\r\n\t\t\t\treturn (\r\n\t\t\t\t\tthis.format.toLowerCase() === 'any' || // format can change on the fly (e.g. from hex to rgba), so let's consider the alpha channel enabled\r\n\t\t\t\t\tjsc.isAlphaFormat(this.getFormat()) || // the current format supports alpha channel\r\n\t\t\t\t\tthis.alpha !== undefined || // initial alpha value is set, so we're working with alpha channel\r\n\t\t\t\t\tthis.alphaElement !== undefined // the alpha value is redirected, so we're working with alpha channel\r\n\t\t\t\t);\r\n\t\t\t}\r\n\r\n\t\t\treturn this.alphaChannel; // the alpha channel is explicitly set\r\n\t\t};\r\n\r\n\r\n\t\tthis.processValueInput = function (str) {\r\n\t\t\tif (!this.fromString(str)) {\r\n\t\t\t\t// could not parse the color value - let's just expose the current color\r\n\t\t\t\tthis.exposeColor();\r\n\t\t\t}\r\n\t\t};\r\n\r\n\r\n\t\tthis.processAlphaInput = function (str) {\r\n\t\t\tif (!this.fromHSVA(null, null, null, parseFloat(str))) {\r\n\t\t\t\t// could not parse the alpha value - let's just expose the current color\r\n\t\t\t\tthis.exposeColor();\r\n\t\t\t}\r\n\t\t};\r\n\r\n\r\n\t\tthis.exposeColor = function (flags) {\r\n\t\t\tvar colorStr = this.toString();\r\n\t\t\tvar fmt = this.getFormat();\r\n\r\n\t\t\t// reflect current color in data- attribute\r\n\t\t\tjsc.setDataAttr(this.targetElement, 'current-color', colorStr);\r\n\r\n\t\t\tif (!(flags & jsc.flags.leaveValue) && this.valueElement) {\r\n\t\t\t\tif (fmt === 'hex' || fmt === 'hexa') {\r\n\t\t\t\t\tif (!this.uppercase) { colorStr = colorStr.toLowerCase(); }\r\n\t\t\t\t\tif (!this.hash) { colorStr = colorStr.replace(/^#/, ''); }\r\n\t\t\t\t}\r\n\t\t\t\tthis.setValueElementValue(colorStr);\r\n\t\t\t}\r\n\r\n\t\t\tif (!(flags & jsc.flags.leaveAlpha) && this.alphaElement) {\r\n\t\t\t\tvar alphaVal = Math.round(this.channels.a * 100) / 100;\r\n\t\t\t\tthis.setAlphaElementValue(alphaVal);\r\n\t\t\t}\r\n\r\n\t\t\tif (!(flags & jsc.flags.leavePreview) && this.previewElement) {\r\n\t\t\t\tvar previewPos = null; // 'left' | 'right' (null -> fill the entire element)\r\n\r\n\t\t\t\tif (\r\n\t\t\t\t\tjsc.isTextInput(this.previewElement) || // text input\r\n\t\t\t\t\t(jsc.isButton(this.previewElement) && !jsc.isButtonEmpty(this.previewElement)) // button with text\r\n\t\t\t\t) {\r\n\t\t\t\t\tpreviewPos = this.previewPosition;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis.setPreviewElementBg(this.toRGBAString());\r\n\t\t\t}\r\n\r\n\t\t\tif (isPickerOwner()) {\r\n\t\t\t\tredrawPad();\r\n\t\t\t\tredrawSld();\r\n\t\t\t\tredrawASld();\r\n\t\t\t}\r\n\t\t};\r\n\r\n\r\n\t\tthis.setPreviewElementBg = function (color) {\r\n\t\t\tif (!this.previewElement) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tvar position = null; // color preview position: null | 'left' | 'right'\r\n\t\t\tvar width = null; // color preview width: px | null = fill the entire element\r\n\t\t\tif (\r\n\t\t\t\tjsc.isTextInput(this.previewElement) || // text input\r\n\t\t\t\t(jsc.isButton(this.previewElement) && !jsc.isButtonEmpty(this.previewElement)) // button with text\r\n\t\t\t) {\r\n\t\t\t\tposition = this.previewPosition;\r\n\t\t\t\twidth = this.previewSize;\r\n\t\t\t}\r\n\r\n\t\t\tvar backgrounds = [];\r\n\r\n\t\t\tif (!color) {\r\n\t\t\t\t// there is no color preview to display -> let's remove any previous background image\r\n\t\t\t\tbackgrounds.push({\r\n\t\t\t\t\timage: 'none',\r\n\t\t\t\t\tposition: 'left top',\r\n\t\t\t\t\tsize: 'auto',\r\n\t\t\t\t\trepeat: 'no-repeat',\r\n\t\t\t\t\torigin: 'padding-box',\r\n\t\t\t\t});\r\n\t\t\t} else {\r\n\t\t\t\t// CSS gradient for background color preview\r\n\t\t\t\tbackgrounds.push({\r\n\t\t\t\t\timage: jsc.genColorPreviewGradient(\r\n\t\t\t\t\t\tcolor,\r\n\t\t\t\t\t\tposition,\r\n\t\t\t\t\t\twidth ? width - jsc.pub.previewSeparator.length : null\r\n\t\t\t\t\t),\r\n\t\t\t\t\tposition: 'left top',\r\n\t\t\t\t\tsize: 'auto',\r\n\t\t\t\t\trepeat: position ? 'repeat-y' : 'repeat',\r\n\t\t\t\t\torigin: 'padding-box',\r\n\t\t\t\t});\r\n\r\n\t\t\t\t// data URL of generated PNG image with a gray transparency chessboard\r\n\t\t\t\tvar preview = jsc.genColorPreviewCanvas(\r\n\t\t\t\t\t'rgba(0,0,0,0)',\r\n\t\t\t\t\tposition ? {'left':'right', 'right':'left'}[position] : null,\r\n\t\t\t\t\twidth,\r\n\t\t\t\t\ttrue\r\n\t\t\t\t);\r\n\t\t\t\tbackgrounds.push({\r\n\t\t\t\t\timage: 'url(\\'' + preview.canvas.toDataURL() + '\\')',\r\n\t\t\t\t\tposition: (position || 'left') + ' top',\r\n\t\t\t\t\tsize: preview.width + 'px ' + preview.height + 'px',\r\n\t\t\t\t\trepeat: position ? 'repeat-y' : 'repeat',\r\n\t\t\t\t\torigin: 'padding-box',\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\tvar bg = {\r\n\t\t\t\timage: [],\r\n\t\t\t\tposition: [],\r\n\t\t\t\tsize: [],\r\n\t\t\t\trepeat: [],\r\n\t\t\t\torigin: [],\r\n\t\t\t};\r\n\t\t\tfor (var i = 0; i < backgrounds.length; i += 1) {\r\n\t\t\t\tbg.image.push(backgrounds[i].image);\r\n\t\t\t\tbg.position.push(backgrounds[i].position);\r\n\t\t\t\tbg.size.push(backgrounds[i].size);\r\n\t\t\t\tbg.repeat.push(backgrounds[i].repeat);\r\n\t\t\t\tbg.origin.push(backgrounds[i].origin);\r\n\t\t\t}\r\n\r\n\t\t\t// set previewElement's background-images\r\n\t\t\tvar sty = {\r\n\t\t\t\t'background-image': bg.image.join(', '),\r\n\t\t\t\t'background-position': bg.position.join(', '),\r\n\t\t\t\t'background-size': bg.size.join(', '),\r\n\t\t\t\t'background-repeat': bg.repeat.join(', '),\r\n\t\t\t\t'background-origin': bg.origin.join(', '),\r\n\t\t\t};\r\n\t\t\tjsc.setStyle(this.previewElement, sty, this.forceStyle);\r\n\r\n\r\n\t\t\t// set/restore previewElement's padding\r\n\t\t\tvar padding = {\r\n\t\t\t\tleft: null,\r\n\t\t\t\tright: null,\r\n\t\t\t};\r\n\t\t\tif (position) {\r\n\t\t\t\tpadding[position] = (this.previewSize + this.previewPadding) + 'px';\r\n\t\t\t}\r\n\r\n\t\t\tvar sty = {\r\n\t\t\t\t'padding-left': padding.left,\r\n\t\t\t\t'padding-right': padding.right,\r\n\t\t\t};\r\n\t\t\tjsc.setStyle(this.previewElement, sty, this.forceStyle, true);\r\n\t\t};\r\n\r\n\r\n\t\tthis.setValueElementValue = function (str) {\r\n\t\t\tif (this.valueElement) {\r\n\t\t\t\tif (jsc.nodeName(this.valueElement) === 'input') {\r\n\t\t\t\t\tthis.valueElement.value = str;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis.valueElement.innerHTML = str;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\r\n\r\n\t\tthis.setAlphaElementValue = function (str) {\r\n\t\t\tif (this.alphaElement) {\r\n\t\t\t\tif (jsc.nodeName(this.alphaElement) === 'input') {\r\n\t\t\t\t\tthis.alphaElement.value = str;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis.alphaElement.innerHTML = str;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\r\n\r\n\t\tthis._processParentElementsInDOM = function () {\r\n\t\t\tif (this._parentElementsProcessed) { return; }\r\n\t\t\tthis._parentElementsProcessed = true;\r\n\r\n\t\t\tvar elm = this.targetElement;\r\n\t\t\tdo {\r\n\t\t\t\t// If the target element or one of its parent nodes has fixed position,\r\n\t\t\t\t// then use fixed positioning instead\r\n\t\t\t\tvar compStyle = jsc.getCompStyle(elm);\r\n\t\t\t\tif (compStyle.position && compStyle.position.toLowerCase() === 'fixed') {\r\n\t\t\t\t\tthis.fixed = true;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (elm !== this.targetElement) {\r\n\t\t\t\t\t// Ensure to attach onParentScroll only once to each parent element\r\n\t\t\t\t\t// (multiple targetElements can share the same parent nodes)\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// Note: It's not just offsetParents that can be scrollable,\r\n\t\t\t\t\t// that's why we loop through all parent nodes\r\n\t\t\t\t\tif (!jsc.getData(elm, 'hasScrollListener')) {\r\n\t\t\t\t\t\telm.addEventListener('scroll', jsc.onParentScroll, false);\r\n\t\t\t\t\t\tjsc.setData(elm, 'hasScrollListener', true);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} while ((elm = elm.parentNode) && jsc.nodeName(elm) !== 'body');\r\n\t\t};\r\n\r\n\r\n\t\tthis.tryHide = function () {\r\n\t\t\tif (this.hideOnLeave) {\r\n\t\t\t\tthis.hide();\r\n\t\t\t}\r\n\t\t};\r\n\r\n\r\n\t\tthis.set__palette = function (val) {\r\n\t\t\tthis.palette = val;\r\n\t\t\tthis._palette = jsc.parsePaletteValue(val);\r\n\t\t\tthis._paletteHasTransparency = jsc.containsTranparentColor(this._palette);\r\n\t\t};\r\n\r\n\r\n\t\tfunction setOption (option, value) {\r\n\t\t\tif (typeof option !== 'string') {\r\n\t\t\t\tthrow new Error('Invalid value for option name: ' + option);\r\n\t\t\t}\r\n\r\n\t\t\t// enum option\r\n\t\t\tif (jsc.enumOpts.hasOwnProperty(option)) {\r\n\t\t\t\tif (typeof value === 'string') { // enum string values are case insensitive\r\n\t\t\t\t\tvalue = value.toLowerCase();\r\n\t\t\t\t}\r\n\t\t\t\tif (jsc.enumOpts[option].indexOf(value) === -1) {\r\n\t\t\t\t\tthrow new Error('Option \\'' + option + '\\' has invalid value: ' + value);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// deprecated option\r\n\t\t\tif (jsc.deprecatedOpts.hasOwnProperty(option)) {\r\n\t\t\t\tvar oldOpt = option;\r\n\t\t\t\tvar newOpt = jsc.deprecatedOpts[option];\r\n\t\t\t\tif (newOpt) {\r\n\t\t\t\t\t// if we have a new name for this option, let's log a warning and use the new name\r\n\t\t\t\t\tconsole.warn('Option \\'%s\\' is DEPRECATED, using \\'%s\\' instead.' + jsc.docsRef, oldOpt, newOpt);\r\n\t\t\t\t\toption = newOpt;\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// new name not available for the option\r\n\t\t\t\t\tthrow new Error('Option \\'' + option + '\\' is DEPRECATED');\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tvar setter = 'set__' + option;\r\n\r\n\t\t\tif (typeof THIS[setter] === 'function') { // a setter exists for this option\r\n\t\t\t\tTHIS[setter](value);\r\n\t\t\t\treturn true;\r\n\r\n\t\t\t} else if (option in THIS) { // option exists as a property\r\n\t\t\t\tTHIS[option] = value;\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\r\n\t\t\tthrow new Error('Unrecognized configuration option: ' + option);\r\n\t\t}\r\n\r\n\r\n\t\tfunction getOption (option) {\r\n\t\t\tif (typeof option !== 'string') {\r\n\t\t\t\tthrow new Error('Invalid value for option name: ' + option);\r\n\t\t\t}\r\n\r\n\t\t\t// deprecated option\r\n\t\t\tif (jsc.deprecatedOpts.hasOwnProperty(option)) {\r\n\t\t\t\tvar oldOpt = option;\r\n\t\t\t\tvar newOpt = jsc.deprecatedOpts[option];\r\n\t\t\t\tif (newOpt) {\r\n\t\t\t\t\t// if we have a new name for this option, let's log a warning and use the new name\r\n\t\t\t\t\tconsole.warn('Option \\'%s\\' is DEPRECATED, using \\'%s\\' instead.' + jsc.docsRef, oldOpt, newOpt);\r\n\t\t\t\t\toption = newOpt;\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// new name not available for the option\r\n\t\t\t\t\tthrow new Error('Option \\'' + option + '\\' is DEPRECATED');\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tvar getter = 'get__' + option;\r\n\r\n\t\t\tif (typeof THIS[getter] === 'function') { // a getter exists for this option\r\n\t\t\t\treturn THIS[getter](value);\r\n\r\n\t\t\t} else if (option in THIS) { // option exists as a property\r\n\t\t\t\treturn THIS[option];\r\n\t\t\t}\r\n\r\n\t\t\tthrow new Error('Unrecognized configuration option: ' + option);\r\n\t\t}\r\n\r\n\r\n\t\tfunction detachPicker () {\r\n\t\t\tjsc.removeClass(THIS.targetElement, jsc.pub.activeClassName);\r\n\t\t\tjsc.picker.wrap.parentNode.removeChild(jsc.picker.wrap);\r\n\t\t\tdelete jsc.picker.owner;\r\n\t\t}\r\n\r\n\r\n\t\tfunction drawPicker () {\r\n\r\n\t\t\t// At this point, when drawing the picker, we know what the parent elements are\r\n\t\t\t// and we can do all related DOM operations, such as registering events on them\r\n\t\t\t// or checking their positioning\r\n\t\t\tTHIS._processParentElementsInDOM();\r\n\r\n\t\t\tif (!jsc.picker) {\r\n\t\t\t\tjsc.picker = {\r\n\t\t\t\t\towner: null, // owner picker instance\r\n\t\t\t\t\twrap : jsc.createEl('div'),\r\n\t\t\t\t\tbox : jsc.createEl('div'),\r\n\t\t\t\t\tboxS : jsc.createEl('div'), // shadow area\r\n\t\t\t\t\tboxB : jsc.createEl('div'), // border\r\n\t\t\t\t\tpad : jsc.createEl('div'),\r\n\t\t\t\t\tpadB : jsc.createEl('div'), // border\r\n\t\t\t\t\tpadM : jsc.createEl('div'), // mouse/touch area\r\n\t\t\t\t\tpadCanvas : jsc.createPadCanvas(),\r\n\t\t\t\t\tcross : jsc.createEl('div'),\r\n\t\t\t\t\tcrossBY : jsc.createEl('div'), // border Y\r\n\t\t\t\t\tcrossBX : jsc.createEl('div'), // border X\r\n\t\t\t\t\tcrossLY : jsc.createEl('div'), // line Y\r\n\t\t\t\t\tcrossLX : jsc.createEl('div'), // line X\r\n\t\t\t\t\tsld : jsc.createEl('div'), // slider\r\n\t\t\t\t\tsldB : jsc.createEl('div'), // border\r\n\t\t\t\t\tsldM : jsc.createEl('div'), // mouse/touch area\r\n\t\t\t\t\tsldGrad : jsc.createSliderGradient(),\r\n\t\t\t\t\tsldPtrS : jsc.createEl('div'), // slider pointer spacer\r\n\t\t\t\t\tsldPtrIB : jsc.createEl('div'), // slider pointer inner border\r\n\t\t\t\t\tsldPtrMB : jsc.createEl('div'), // slider pointer middle border\r\n\t\t\t\t\tsldPtrOB : jsc.createEl('div'), // slider pointer outer border\r\n\t\t\t\t\tasld : jsc.createEl('div'), // alpha slider\r\n\t\t\t\t\tasldB : jsc.createEl('div'), // border\r\n\t\t\t\t\tasldM : jsc.createEl('div'), // mouse/touch area\r\n\t\t\t\t\tasldGrad : jsc.createASliderGradient(),\r\n\t\t\t\t\tasldPtrS : jsc.createEl('div'), // slider pointer spacer\r\n\t\t\t\t\tasldPtrIB : jsc.createEl('div'), // slider pointer inner border\r\n\t\t\t\t\tasldPtrMB : jsc.createEl('div'), // slider pointer middle border\r\n\t\t\t\t\tasldPtrOB : jsc.createEl('div'), // slider pointer outer border\r\n\t\t\t\t\tpal : jsc.createEl('div'), // palette\r\n\t\t\t\t\tbtn : jsc.createEl('div'),\r\n\t\t\t\t\tbtnT : jsc.createEl('span'), // text\r\n\t\t\t\t};\r\n\r\n\t\t\t\tjsc.picker.pad.appendChild(jsc.picker.padCanvas.elm);\r\n\t\t\t\tjsc.picker.padB.appendChild(jsc.picker.pad);\r\n\t\t\t\tjsc.picker.cross.appendChild(jsc.picker.crossBY);\r\n\t\t\t\tjsc.picker.cross.appendChild(jsc.picker.crossBX);\r\n\t\t\t\tjsc.picker.cross.appendChild(jsc.picker.crossLY);\r\n\t\t\t\tjsc.picker.cross.appendChild(jsc.picker.crossLX);\r\n\t\t\t\tjsc.picker.padB.appendChild(jsc.picker.cross);\r\n\t\t\t\tjsc.picker.box.appendChild(jsc.picker.padB);\r\n\t\t\t\tjsc.picker.box.appendChild(jsc.picker.padM);\r\n\r\n\t\t\t\tjsc.picker.sld.appendChild(jsc.picker.sldGrad.elm);\r\n\t\t\t\tjsc.picker.sldB.appendChild(jsc.picker.sld);\r\n\t\t\t\tjsc.picker.sldB.appendChild(jsc.picker.sldPtrOB);\r\n\t\t\t\tjsc.picker.sldPtrOB.appendChild(jsc.picker.sldPtrMB);\r\n\t\t\t\tjsc.picker.sldPtrMB.appendChild(jsc.picker.sldPtrIB);\r\n\t\t\t\tjsc.picker.sldPtrIB.appendChild(jsc.picker.sldPtrS);\r\n\t\t\t\tjsc.picker.box.appendChild(jsc.picker.sldB);\r\n\t\t\t\tjsc.picker.box.appendChild(jsc.picker.sldM);\r\n\r\n\t\t\t\tjsc.picker.asld.appendChild(jsc.picker.asldGrad.elm);\r\n\t\t\t\tjsc.picker.asldB.appendChild(jsc.picker.asld);\r\n\t\t\t\tjsc.picker.asldB.appendChild(jsc.picker.asldPtrOB);\r\n\t\t\t\tjsc.picker.asldPtrOB.appendChild(jsc.picker.asldPtrMB);\r\n\t\t\t\tjsc.picker.asldPtrMB.appendChild(jsc.picker.asldPtrIB);\r\n\t\t\t\tjsc.picker.asldPtrIB.appendChild(jsc.picker.asldPtrS);\r\n\t\t\t\tjsc.picker.box.appendChild(jsc.picker.asldB);\r\n\t\t\t\tjsc.picker.box.appendChild(jsc.picker.asldM);\r\n\r\n\t\t\t\tjsc.picker.box.appendChild(jsc.picker.pal);\r\n\r\n\t\t\t\tjsc.picker.btn.appendChild(jsc.picker.btnT);\r\n\t\t\t\tjsc.picker.box.appendChild(jsc.picker.btn);\r\n\r\n\t\t\t\tjsc.picker.boxB.appendChild(jsc.picker.box);\r\n\t\t\t\tjsc.picker.wrap.appendChild(jsc.picker.boxS);\r\n\t\t\t\tjsc.picker.wrap.appendChild(jsc.picker.boxB);\r\n\r\n\t\t\t\tjsc.picker.wrap.addEventListener('touchstart', jsc.onPickerTouchStart,\r\n\t\t\t\t\tjsc.isPassiveEventSupported ? {passive: false} : false);\r\n\t\t\t}\r\n\r\n\t\t\tvar p = jsc.picker;\r\n\r\n\t\t\tvar displaySlider = !!jsc.getSliderChannel(THIS);\r\n\t\t\tvar displayAlphaSlider = THIS.hasAlphaChannel();\r\n\t\t\tvar pickerDims = jsc.getPickerDims(THIS);\r\n\t\t\tvar crossOuterSize = (2 * THIS.pointerBorderWidth + THIS.pointerThickness + 2 * THIS.crossSize);\r\n\t\t\tvar controlPadding = jsc.getControlPadding(THIS);\r\n\t\t\tvar borderRadius = Math.min(\r\n\t\t\t\tTHIS.borderRadius,\r\n\t\t\t\tMath.round(THIS.padding * Math.PI)); // px\r\n\t\t\tvar padCursor = 'crosshair';\r\n\r\n\t\t\t// wrap\r\n\t\t\tp.wrap.className = 'jscolor-picker-wrap';\r\n\t\t\tp.wrap.style.clear = 'both';\r\n\t\t\tp.wrap.style.width = pickerDims.borderW + 'px';\r\n\t\t\tp.wrap.style.height = pickerDims.borderH + 'px';\r\n\t\t\tp.wrap.style.zIndex = THIS.zIndex;\r\n\r\n\t\t\t// picker\r\n\t\t\tp.box.className = 'jscolor-picker';\r\n\t\t\tp.box.style.width = pickerDims.paddedW + 'px';\r\n\t\t\tp.box.style.height = pickerDims.paddedH + 'px';\r\n\t\t\tp.box.style.position = 'relative';\r\n\r\n\t\t\t// picker shadow\r\n\t\t\tp.boxS.className = 'jscolor-picker-shadow';\r\n\t\t\tp.boxS.style.position = 'absolute';\r\n\t\t\tp.boxS.style.left = '0';\r\n\t\t\tp.boxS.style.top = '0';\r\n\t\t\tp.boxS.style.width = '100%';\r\n\t\t\tp.boxS.style.height = '100%';\r\n\t\t\tjsc.setBorderRadius(p.boxS, borderRadius + 'px');\r\n\r\n\t\t\t// picker border\r\n\t\t\tp.boxB.className = 'jscolor-picker-border';\r\n\t\t\tp.boxB.style.position = 'relative';\r\n\t\t\tp.boxB.style.border = THIS.borderWidth + 'px solid';\r\n\t\t\tp.boxB.style.borderColor = THIS.borderColor;\r\n\t\t\tp.boxB.style.background = THIS.backgroundColor;\r\n\t\t\tjsc.setBorderRadius(p.boxB, borderRadius + 'px');\r\n\r\n\t\t\t// IE hack:\r\n\t\t\t// If the element is transparent, IE will trigger the event on the elements under it,\r\n\t\t\t// e.g. on Canvas or on elements with border\r\n\t\t\tp.padM.style.background = 'rgba(255,0,0,.2)';\r\n\t\t\tp.sldM.style.background = 'rgba(0,255,0,.2)';\r\n\t\t\tp.asldM.style.background = 'rgba(0,0,255,.2)';\r\n\r\n\t\t\tp.padM.style.opacity =\r\n\t\t\tp.sldM.style.opacity =\r\n\t\t\tp.asldM.style.opacity =\r\n\t\t\t\t'0';\r\n\r\n\t\t\t// pad\r\n\t\t\tp.pad.style.position = 'relative';\r\n\t\t\tp.pad.style.width = THIS.width + 'px';\r\n\t\t\tp.pad.style.height = THIS.height + 'px';\r\n\r\n\t\t\t// pad - color spectrum (HSV and HVS)\r\n\t\t\tp.padCanvas.draw(THIS.width, THIS.height, jsc.getPadYChannel(THIS));\r\n\r\n\t\t\t// pad border\r\n\t\t\tp.padB.style.position = 'absolute';\r\n\t\t\tp.padB.style.left = THIS.padding + 'px';\r\n\t\t\tp.padB.style.top = THIS.padding + 'px';\r\n\t\t\tp.padB.style.border = THIS.controlBorderWidth + 'px solid';\r\n\t\t\tp.padB.style.borderColor = THIS.controlBorderColor;\r\n\r\n\t\t\t// pad mouse area\r\n\t\t\tp.padM.style.position = 'absolute';\r\n\t\t\tp.padM.style.left = 0 + 'px';\r\n\t\t\tp.padM.style.top = 0 + 'px';\r\n\t\t\tp.padM.style.width = (THIS.padding + 2 * THIS.controlBorderWidth + THIS.width + controlPadding) + 'px';\r\n\t\t\tp.padM.style.height = (2 * THIS.controlBorderWidth + 2 * THIS.padding + THIS.height) + 'px';\r\n\t\t\tp.padM.style.cursor = padCursor;\r\n\t\t\tjsc.setData(p.padM, {\r\n\t\t\t\tinstance: THIS,\r\n\t\t\t\tcontrol: 'pad',\r\n\t\t\t})\r\n\r\n\t\t\t// pad cross\r\n\t\t\tp.cross.style.position = 'absolute';\r\n\t\t\tp.cross.style.left =\r\n\t\t\tp.cross.style.top =\r\n\t\t\t\t'0';\r\n\t\t\tp.cross.style.width =\r\n\t\t\tp.cross.style.height =\r\n\t\t\t\tcrossOuterSize + 'px';\r\n\r\n\t\t\t// pad cross border Y and X\r\n\t\t\tp.crossBY.style.position =\r\n\t\t\tp.crossBX.style.position =\r\n\t\t\t\t'absolute';\r\n\t\t\tp.crossBY.style.background =\r\n\t\t\tp.crossBX.style.background =\r\n\t\t\t\tTHIS.pointerBorderColor;\r\n\t\t\tp.crossBY.style.width =\r\n\t\t\tp.crossBX.style.height =\r\n\t\t\t\t(2 * THIS.pointerBorderWidth + THIS.pointerThickness) + 'px';\r\n\t\t\tp.crossBY.style.height =\r\n\t\t\tp.crossBX.style.width =\r\n\t\t\t\tcrossOuterSize + 'px';\r\n\t\t\tp.crossBY.style.left =\r\n\t\t\tp.crossBX.style.top =\r\n\t\t\t\t(Math.floor(crossOuterSize / 2) - Math.floor(THIS.pointerThickness / 2) - THIS.pointerBorderWidth) + 'px';\r\n\t\t\tp.crossBY.style.top =\r\n\t\t\tp.crossBX.style.left =\r\n\t\t\t\t'0';\r\n\r\n\t\t\t// pad cross line Y and X\r\n\t\t\tp.crossLY.style.position =\r\n\t\t\tp.crossLX.style.position =\r\n\t\t\t\t'absolute';\r\n\t\t\tp.crossLY.style.background =\r\n\t\t\tp.crossLX.style.background =\r\n\t\t\t\tTHIS.pointerColor;\r\n\t\t\tp.crossLY.style.height =\r\n\t\t\tp.crossLX.style.width =\r\n\t\t\t\t(crossOuterSize - 2 * THIS.pointerBorderWidth) + 'px';\r\n\t\t\tp.crossLY.style.width =\r\n\t\t\tp.crossLX.style.height =\r\n\t\t\t\tTHIS.pointerThickness + 'px';\r\n\t\t\tp.crossLY.style.left =\r\n\t\t\tp.crossLX.style.top =\r\n\t\t\t\t(Math.floor(crossOuterSize / 2) - Math.floor(THIS.pointerThickness / 2)) + 'px';\r\n\t\t\tp.crossLY.style.top =\r\n\t\t\tp.crossLX.style.left =\r\n\t\t\t\tTHIS.pointerBorderWidth + 'px';\r\n\r\n\r\n\t\t\t// slider\r\n\t\t\tp.sld.style.overflow = 'hidden';\r\n\t\t\tp.sld.style.width = THIS.sliderSize + 'px';\r\n\t\t\tp.sld.style.height = THIS.height + 'px';\r\n\r\n\t\t\t// slider gradient\r\n\t\t\tp.sldGrad.draw(THIS.sliderSize, THIS.height, '#000', '#000');\r\n\r\n\t\t\t// slider border\r\n\t\t\tp.sldB.style.display = displaySlider ? 'block' : 'none';\r\n\t\t\tp.sldB.style.position = 'absolute';\r\n\t\t\tp.sldB.style.left = (THIS.padding + THIS.width + 2 * THIS.controlBorderWidth + 2 * controlPadding) + 'px';\r\n\t\t\tp.sldB.style.top = THIS.padding + 'px';\r\n\t\t\tp.sldB.style.border = THIS.controlBorderWidth + 'px solid';\r\n\t\t\tp.sldB.style.borderColor = THIS.controlBorderColor;\r\n\r\n\t\t\t// slider mouse area\r\n\t\t\tp.sldM.style.display = displaySlider ? 'block' : 'none';\r\n\t\t\tp.sldM.style.position = 'absolute';\r\n\t\t\tp.sldM.style.left = (THIS.padding + THIS.width + 2 * THIS.controlBorderWidth + controlPadding) + 'px';\r\n\t\t\tp.sldM.style.top = 0 + 'px';\r\n\t\t\tp.sldM.style.width = (\r\n\t\t\t\t\t(THIS.sliderSize + 2 * controlPadding + 2 * THIS.controlBorderWidth) +\r\n\t\t\t\t\t(displayAlphaSlider ? 0 : Math.max(0, THIS.padding - controlPadding)) // remaining padding to the right edge\r\n\t\t\t\t) + 'px';\r\n\t\t\tp.sldM.style.height = (2 * THIS.controlBorderWidth + 2 * THIS.padding + THIS.height) + 'px';\r\n\t\t\tp.sldM.style.cursor = 'default';\r\n\t\t\tjsc.setData(p.sldM, {\r\n\t\t\t\tinstance: THIS,\r\n\t\t\t\tcontrol: 'sld',\r\n\t\t\t});\r\n\r\n\t\t\t// slider pointer inner and outer border\r\n\t\t\tp.sldPtrIB.style.border =\r\n\t\t\tp.sldPtrOB.style.border =\r\n\t\t\t\tTHIS.pointerBorderWidth + 'px solid ' + THIS.pointerBorderColor;\r\n\r\n\t\t\t// slider pointer outer border\r\n\t\t\tp.sldPtrOB.style.position = 'absolute';\r\n\t\t\tp.sldPtrOB.style.left = -(2 * THIS.pointerBorderWidth + THIS.pointerThickness) + 'px';\r\n\t\t\tp.sldPtrOB.style.top = '0';\r\n\r\n\t\t\t// slider pointer middle border\r\n\t\t\tp.sldPtrMB.style.border = THIS.pointerThickness + 'px solid ' + THIS.pointerColor;\r\n\r\n\t\t\t// slider pointer spacer\r\n\t\t\tp.sldPtrS.style.width = THIS.sliderSize + 'px';\r\n\t\t\tp.sldPtrS.style.height = jsc.pub.sliderInnerSpace + 'px';\r\n\r\n\r\n\t\t\t// alpha slider\r\n\t\t\tp.asld.style.overflow = 'hidden';\r\n\t\t\tp.asld.style.width = THIS.sliderSize + 'px';\r\n\t\t\tp.asld.style.height = THIS.height + 'px';\r\n\r\n\t\t\t// alpha slider gradient\r\n\t\t\tp.asldGrad.draw(THIS.sliderSize, THIS.height, '#000');\r\n\r\n\t\t\t// alpha slider border\r\n\t\t\tp.asldB.style.display = displayAlphaSlider ? 'block' : 'none';\r\n\t\t\tp.asldB.style.position = 'absolute';\r\n\t\t\tp.asldB.style.left = (\r\n\t\t\t\t\t(THIS.padding + THIS.width + 2 * THIS.controlBorderWidth + controlPadding) +\r\n\t\t\t\t\t(displaySlider ? (THIS.sliderSize + 3 * controlPadding + 2 * THIS.controlBorderWidth) : 0)\r\n\t\t\t\t) + 'px';\r\n\t\t\tp.asldB.style.top = THIS.padding + 'px';\r\n\t\t\tp.asldB.style.border = THIS.controlBorderWidth + 'px solid';\r\n\t\t\tp.asldB.style.borderColor = THIS.controlBorderColor;\r\n\r\n\t\t\t// alpha slider mouse area\r\n\t\t\tp.asldM.style.display = displayAlphaSlider ? 'block' : 'none';\r\n\t\t\tp.asldM.style.position = 'absolute';\r\n\t\t\tp.asldM.style.left = (\r\n\t\t\t\t\t(THIS.padding + THIS.width + 2 * THIS.controlBorderWidth + controlPadding) +\r\n\t\t\t\t\t(displaySlider ? (THIS.sliderSize + 2 * controlPadding + 2 * THIS.controlBorderWidth) : 0)\r\n\t\t\t\t) + 'px';\r\n\t\t\tp.asldM.style.top = 0 + 'px';\r\n\t\t\tp.asldM.style.width = (\r\n\t\t\t\t\t(THIS.sliderSize + 2 * controlPadding + 2 * THIS.controlBorderWidth) +\r\n\t\t\t\t\tMath.max(0, THIS.padding - controlPadding) // remaining padding to the right edge\r\n\t\t\t\t) + 'px';\r\n\t\t\tp.asldM.style.height = (2 * THIS.controlBorderWidth + 2 * THIS.padding + THIS.height) + 'px';\r\n\t\t\tp.asldM.style.cursor = 'default';\r\n\t\t\tjsc.setData(p.asldM, {\r\n\t\t\t\tinstance: THIS,\r\n\t\t\t\tcontrol: 'asld',\r\n\t\t\t})\r\n\r\n\t\t\t// alpha slider pointer inner and outer border\r\n\t\t\tp.asldPtrIB.style.border =\r\n\t\t\tp.asldPtrOB.style.border =\r\n\t\t\t\tTHIS.pointerBorderWidth + 'px solid ' + THIS.pointerBorderColor;\r\n\r\n\t\t\t// alpha slider pointer outer border\r\n\t\t\tp.asldPtrOB.style.position = 'absolute';\r\n\t\t\tp.asldPtrOB.style.left = -(2 * THIS.pointerBorderWidth + THIS.pointerThickness) + 'px';\r\n\t\t\tp.asldPtrOB.style.top = '0';\r\n\r\n\t\t\t// alpha slider pointer middle border\r\n\t\t\tp.asldPtrMB.style.border = THIS.pointerThickness + 'px solid ' + THIS.pointerColor;\r\n\r\n\t\t\t// alpha slider pointer spacer\r\n\t\t\tp.asldPtrS.style.width = THIS.sliderSize + 'px';\r\n\t\t\tp.asldPtrS.style.height = jsc.pub.sliderInnerSpace + 'px';\r\n\r\n\r\n\t\t\t// palette\r\n\t\t\tp.pal.className = 'jscolor-palette';\r\n\t\t\tp.pal.style.display = pickerDims.palette.rows ? 'block' : 'none';\r\n\t\t\tp.pal.style.position = 'absolute';\r\n\t\t\tp.pal.style.left = THIS.padding + 'px';\r\n\t\t\tp.pal.style.top = (2 * THIS.controlBorderWidth + 2 * THIS.padding + THIS.height) + 'px';\r\n\r\n\t\t\t// palette's color samples\r\n\r\n\t\t\tp.pal.innerHTML = '';\r\n\r\n\t\t\tvar chessboard = jsc.genColorPreviewCanvas('rgba(0,0,0,0)');\r\n\r\n\t\t\tvar si = 0; // color sample's index\r\n\t\t\tfor (var r = 0; r < pickerDims.palette.rows; r++) {\r\n\t\t\t\tfor (var c = 0; c < pickerDims.palette.cols && si < THIS._palette.length; c++, si++) {\r\n\t\t\t\t\tvar sampleColor = THIS._palette[si];\r\n\t\t\t\t\tvar sampleCssColor = jsc.rgbaColor.apply(null, sampleColor.rgba);\r\n\r\n\t\t\t\t\tvar sc = jsc.createEl('div'); // color sample's color\r\n\t\t\t\t\tsc.style.width = (pickerDims.palette.cellW - 2 * THIS.controlBorderWidth) + 'px';\r\n\t\t\t\t\tsc.style.height = (pickerDims.palette.cellH - 2 * THIS.controlBorderWidth) + 'px';\r\n\t\t\t\t\tsc.style.backgroundColor = sampleCssColor;\r\n\r\n\t\t\t\t\tvar sw = jsc.createEl('div'); // color sample's wrap\r\n\t\t\t\t\tsw.className = 'jscolor-palette-sample';\r\n\t\t\t\t\tsw.style.display = 'block';\r\n\t\t\t\t\tsw.style.position = 'absolute';\r\n\t\t\t\t\tsw.style.left = (\r\n\t\t\t\t\t\t\tpickerDims.palette.cols <= 1 ? 0 :\r\n\t\t\t\t\t\t\tMath.round(10 * (c * ((pickerDims.contentW - pickerDims.palette.cellW) / (pickerDims.palette.cols - 1)))) / 10\r\n\t\t\t\t\t\t) + 'px';\r\n\t\t\t\t\tsw.style.top = (r * (pickerDims.palette.cellH + THIS.paletteSpacing)) + 'px';\r\n\t\t\t\t\tsw.style.border = THIS.controlBorderWidth + 'px solid';\r\n\t\t\t\t\tsw.style.borderColor = THIS.controlBorderColor;\r\n\t\t\t\t\tsw.style.cursor = 'pointer';\r\n\t\t\t\t\tif (sampleColor.rgba[3] !== null && sampleColor.rgba[3] < 1.0) { // only create chessboard background if the sample has transparency\r\n\t\t\t\t\t\tsw.style.backgroundImage = 'url(\\'' + chessboard.canvas.toDataURL() + '\\')';\r\n\t\t\t\t\t\tsw.style.backgroundRepeat = 'repeat';\r\n\t\t\t\t\t\tsw.style.backgroundPosition = 'center center';\r\n\t\t\t\t\t}\r\n\t\t\t\t\tjsc.setData(sw, {\r\n\t\t\t\t\t\tinstance: THIS,\r\n\t\t\t\t\t\tcontrol: 'palette-sample',\r\n\t\t\t\t\t\tcolor: sampleColor,\r\n\t\t\t\t\t})\r\n\t\t\t\t\tsw.addEventListener('click', jsc.onPaletteSampleClick, false);\r\n\t\t\t\t\tsw.appendChild(sc);\r\n\t\t\t\t\tp.pal.appendChild(sw);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\r\n\t\t\t// the Close button\r\n\t\t\tfunction setBtnBorder () {\r\n\t\t\t\tvar insetColors = THIS.controlBorderColor.split(/\\s+/);\r\n\t\t\t\tvar outsetColor = insetColors.length < 2 ? insetColors[0] : insetColors[1] + ' ' + insetColors[0] + ' ' + insetColors[0] + ' ' + insetColors[1];\r\n\t\t\t\tp.btn.style.borderColor = outsetColor;\r\n\t\t\t}\r\n\t\t\tvar btnPadding = 15; // px\r\n\t\t\tp.btn.className = 'jscolor-btn-close';\r\n\t\t\tp.btn.style.display = THIS.closeButton ? 'block' : 'none';\r\n\t\t\tp.btn.style.position = 'absolute';\r\n\t\t\tp.btn.style.left = THIS.padding + 'px';\r\n\t\t\tp.btn.style.bottom = THIS.padding + 'px';\r\n\t\t\tp.btn.style.padding = '0 ' + btnPadding + 'px';\r\n\t\t\tp.btn.style.maxWidth = (pickerDims.contentW - 2 * THIS.controlBorderWidth - 2 * btnPadding) + 'px';\r\n\t\t\tp.btn.style.overflow = 'hidden';\r\n\t\t\tp.btn.style.height = THIS.buttonHeight + 'px';\r\n\t\t\tp.btn.style.whiteSpace = 'nowrap';\r\n\t\t\tp.btn.style.border = THIS.controlBorderWidth + 'px solid';\r\n\t\t\tsetBtnBorder();\r\n\t\t\tp.btn.style.color = THIS.buttonColor;\r\n\t\t\tp.btn.style.font = '12px sans-serif';\r\n\t\t\tp.btn.style.textAlign = 'center';\r\n\t\t\tp.btn.style.cursor = 'pointer';\r\n\t\t\tp.btn.onmousedown = function () {\r\n\t\t\t\tTHIS.hide();\r\n\t\t\t};\r\n\t\t\tp.btnT.style.lineHeight = THIS.buttonHeight + 'px';\r\n\t\t\tp.btnT.innerHTML = '';\r\n\t\t\tp.btnT.appendChild(window.document.createTextNode(THIS.closeText));\r\n\r\n\t\t\t// reposition the pointers\r\n\t\t\tredrawPad();\r\n\t\t\tredrawSld();\r\n\t\t\tredrawASld();\r\n\r\n\t\t\t// If we are changing the owner without first closing the picker,\r\n\t\t\t// make sure to first deal with the old owner\r\n\t\t\tif (jsc.picker.owner && jsc.picker.owner !== THIS) {\r\n\t\t\t\tjsc.removeClass(jsc.picker.owner.targetElement, jsc.pub.activeClassName);\r\n\t\t\t}\r\n\r\n\t\t\t// Set a new picker owner\r\n\t\t\tjsc.picker.owner = THIS;\r\n\r\n\t\t\t// The redrawPosition() method needs picker.owner to be set, that's why we call it here,\r\n\t\t\t// after setting the owner\r\n\t\t\tif (THIS.container === window.document.body) {\r\n\t\t\t\tjsc.redrawPosition();\r\n\t\t\t} else {\r\n\t\t\t\tjsc._drawPosition(THIS, 0, 0, 'relative', false);\r\n\t\t\t}\r\n\r\n\t\t\tif (p.wrap.parentNode !== THIS.container) {\r\n\t\t\t\tTHIS.container.appendChild(p.wrap);\r\n\t\t\t}\r\n\r\n\t\t\tjsc.addClass(THIS.targetElement, jsc.pub.activeClassName);\r\n\t\t}\r\n\r\n\r\n\t\tfunction redrawPad () {\r\n\t\t\t// redraw the pad pointer\r\n\t\t\tvar yChannel = jsc.getPadYChannel(THIS);\r\n\t\t\tvar x = Math.round((THIS.channels.h / 360) * (THIS.width - 1));\r\n\t\t\tvar y = Math.round((1 - THIS.channels[yChannel] / 100) * (THIS.height - 1));\r\n\t\t\tvar crossOuterSize = (2 * THIS.pointerBorderWidth + THIS.pointerThickness + 2 * THIS.crossSize);\r\n\t\t\tvar ofs = -Math.floor(crossOuterSize / 2);\r\n\t\t\tjsc.picker.cross.style.left = (x + ofs) + 'px';\r\n\t\t\tjsc.picker.cross.style.top = (y + ofs) + 'px';\r\n\r\n\t\t\t// redraw the slider\r\n\t\t\tswitch (jsc.getSliderChannel(THIS)) {\r\n\t\t\tcase 's':\r\n\t\t\t\tvar rgb1 = jsc.HSV_RGB(THIS.channels.h, 100, THIS.channels.v);\r\n\t\t\t\tvar rgb2 = jsc.HSV_RGB(THIS.channels.h, 0, THIS.channels.v);\r\n\t\t\t\tvar color1 = 'rgb(' +\r\n\t\t\t\t\tMath.round(rgb1[0]) + ',' +\r\n\t\t\t\t\tMath.round(rgb1[1]) + ',' +\r\n\t\t\t\t\tMath.round(rgb1[2]) + ')';\r\n\t\t\t\tvar color2 = 'rgb(' +\r\n\t\t\t\t\tMath.round(rgb2[0]) + ',' +\r\n\t\t\t\t\tMath.round(rgb2[1]) + ',' +\r\n\t\t\t\t\tMath.round(rgb2[2]) + ')';\r\n\t\t\t\tjsc.picker.sldGrad.draw(THIS.sliderSize, THIS.height, color1, color2);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'v':\r\n\t\t\t\tvar rgb = jsc.HSV_RGB(THIS.channels.h, THIS.channels.s, 100);\r\n\t\t\t\tvar color1 = 'rgb(' +\r\n\t\t\t\t\tMath.round(rgb[0]) + ',' +\r\n\t\t\t\t\tMath.round(rgb[1]) + ',' +\r\n\t\t\t\t\tMath.round(rgb[2]) + ')';\r\n\t\t\t\tvar color2 = '#000';\r\n\t\t\t\tjsc.picker.sldGrad.draw(THIS.sliderSize, THIS.height, color1, color2);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\t// redraw the alpha slider\r\n\t\t\tjsc.picker.asldGrad.draw(THIS.sliderSize, THIS.height, THIS.toHEXString());\r\n\t\t}\r\n\r\n\r\n\t\tfunction redrawSld () {\r\n\t\t\tvar sldChannel = jsc.getSliderChannel(THIS);\r\n\t\t\tif (sldChannel) {\r\n\t\t\t\t// redraw the slider pointer\r\n\t\t\t\tvar y = Math.round((1 - THIS.channels[sldChannel] / 100) * (THIS.height - 1));\r\n\t\t\t\tjsc.picker.sldPtrOB.style.top = (y - (2 * THIS.pointerBorderWidth + THIS.pointerThickness) - Math.floor(jsc.pub.sliderInnerSpace / 2)) + 'px';\r\n\t\t\t}\r\n\r\n\t\t\t// redraw the alpha slider\r\n\t\t\tjsc.picker.asldGrad.draw(THIS.sliderSize, THIS.height, THIS.toHEXString());\r\n\t\t}\r\n\r\n\r\n\t\tfunction redrawASld () {\r\n\t\t\tvar y = Math.round((1 - THIS.channels.a) * (THIS.height - 1));\r\n\t\t\tjsc.picker.asldPtrOB.style.top = (y - (2 * THIS.pointerBorderWidth + THIS.pointerThickness) - Math.floor(jsc.pub.sliderInnerSpace / 2)) + 'px';\r\n\t\t}\r\n\r\n\r\n\t\tfunction isPickerOwner () {\r\n\t\t\treturn jsc.picker && jsc.picker.owner === THIS;\r\n\t\t}\r\n\r\n\r\n\t\tfunction onValueKeyDown (ev) {\r\n\t\t\tif (jsc.eventKey(ev) === 'Enter') {\r\n\t\t\t\tif (THIS.valueElement) {\r\n\t\t\t\t\tTHIS.processValueInput(THIS.valueElement.value);\r\n\t\t\t\t}\r\n\t\t\t\tTHIS.tryHide();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\t\tfunction onAlphaKeyDown (ev) {\r\n\t\t\tif (jsc.eventKey(ev) === 'Enter') {\r\n\t\t\t\tif (THIS.alphaElement) {\r\n\t\t\t\t\tTHIS.processAlphaInput(THIS.alphaElement.value);\r\n\t\t\t\t}\r\n\t\t\t\tTHIS.tryHide();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\t\tfunction onValueChange (ev) {\r\n\t\t\tif (jsc.getData(ev, 'internal')) {\r\n\t\t\t\treturn; // skip if the event was internally triggered by jscolor\r\n\t\t\t}\r\n\r\n\t\t\tvar oldVal = THIS.valueElement.value;\r\n\r\n\t\t\tTHIS.processValueInput(THIS.valueElement.value); // this might change the value\r\n\r\n\t\t\tjsc.triggerCallback(THIS, 'onChange');\r\n\r\n\t\t\tif (THIS.valueElement.value !== oldVal) {\r\n\t\t\t\t// value was additionally changed -> let's trigger the change event again, even though it was natively dispatched\r\n\t\t\t\tjsc.triggerInputEvent(THIS.valueElement, 'change', true, true);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\t\tfunction onAlphaChange (ev) {\r\n\t\t\tif (jsc.getData(ev, 'internal')) {\r\n\t\t\t\treturn; // skip if the event was internally triggered by jscolor\r\n\t\t\t}\r\n\r\n\t\t\tvar oldVal = THIS.alphaElement.value;\r\n\r\n\t\t\tTHIS.processAlphaInput(THIS.alphaElement.value); // this might change the value\r\n\r\n\t\t\tjsc.triggerCallback(THIS, 'onChange');\r\n\r\n\t\t\t// triggering valueElement's onChange (because changing alpha changes the entire color, e.g. with rgba format)\r\n\t\t\tjsc.triggerInputEvent(THIS.valueElement, 'change', true, true);\r\n\r\n\t\t\tif (THIS.alphaElement.value !== oldVal) {\r\n\t\t\t\t// value was additionally changed -> let's trigger the change event again, even though it was natively dispatched\r\n\t\t\t\tjsc.triggerInputEvent(THIS.alphaElement, 'change', true, true);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\t\tfunction onValueInput (ev) {\r\n\t\t\tif (jsc.getData(ev, 'internal')) {\r\n\t\t\t\treturn; // skip if the event was internally triggered by jscolor\r\n\t\t\t}\r\n\r\n\t\t\tif (THIS.valueElement) {\r\n\t\t\t\tTHIS.fromString(THIS.valueElement.value, jsc.flags.leaveValue);\r\n\t\t\t}\r\n\r\n\t\t\tjsc.triggerCallback(THIS, 'onInput');\r\n\r\n\t\t\t// triggering valueElement's onInput\r\n\t\t\t// (not needed, it was dispatched normally by the browser)\r\n\t\t}\r\n\r\n\r\n\t\tfunction onAlphaInput (ev) {\r\n\t\t\tif (jsc.getData(ev, 'internal')) {\r\n\t\t\t\treturn; // skip if the event was internally triggered by jscolor\r\n\t\t\t}\r\n\r\n\t\t\tif (THIS.alphaElement) {\r\n\t\t\t\tTHIS.fromHSVA(null, null, null, parseFloat(THIS.alphaElement.value), jsc.flags.leaveAlpha);\r\n\t\t\t}\r\n\r\n\t\t\tjsc.triggerCallback(THIS, 'onInput');\r\n\r\n\t\t\t// triggering valueElement's onInput (because changing alpha changes the entire color, e.g. with rgba format)\r\n\t\t\tjsc.triggerInputEvent(THIS.valueElement, 'input', true, true);\r\n\t\t}\r\n\r\n\r\n\t\t// let's process the DEPRECATED 'options' property (this will be later removed)\r\n\t\tif (jsc.pub.options) {\r\n\t\t\t// let's set custom default options, if specified\r\n\t\t\tfor (var opt in jsc.pub.options) {\r\n\t\t\t\tif (jsc.pub.options.hasOwnProperty(opt)) {\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tsetOption(opt, jsc.pub.options[opt]);\r\n\t\t\t\t\t} catch (e) {\r\n\t\t\t\t\t\tconsole.warn(e);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\t\t// let's apply configuration presets\r\n\t\t//\r\n\t\tvar presetsArr = [];\r\n\r\n\t\tif (opts.preset) {\r\n\t\t\tif (typeof opts.preset === 'string') {\r\n\t\t\t\tpresetsArr = opts.preset.split(/\\s+/);\r\n\t\t\t} else if (Array.isArray(opts.preset)) {\r\n\t\t\t\tpresetsArr = opts.preset.slice(); // slice() to clone\r\n\t\t\t} else {\r\n\t\t\t\tconsole.warn('Unrecognized preset value');\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// always use the 'default' preset. If it's not listed, append it to the end.\r\n\t\tif (presetsArr.indexOf('default') === -1) {\r\n\t\t\tpresetsArr.push('default');\r\n\t\t}\r\n\r\n\t\t// let's apply the presets in reverse order, so that should there be any overlapping options,\r\n\t\t// the formerly listed preset will override the latter\r\n\t\tfor (var i = presetsArr.length - 1; i >= 0; i -= 1) {\r\n\t\t\tvar pres = presetsArr[i];\r\n\t\t\tif (!pres) {\r\n\t\t\t\tcontinue; // preset is empty string\r\n\t\t\t}\r\n\t\t\tif (!jsc.pub.presets.hasOwnProperty(pres)) {\r\n\t\t\t\tconsole.warn('Unknown preset: %s', pres);\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tfor (var opt in jsc.pub.presets[pres]) {\r\n\t\t\t\tif (jsc.pub.presets[pres].hasOwnProperty(opt)) {\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tsetOption(opt, jsc.pub.presets[pres][opt]);\r\n\t\t\t\t\t} catch (e) {\r\n\t\t\t\t\t\tconsole.warn(e);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\t\t// let's set specific options for this color picker\r\n\t\tvar nonProperties = [\r\n\t\t\t// these options won't be set as instance properties\r\n\t\t\t'preset',\r\n\t\t];\r\n\t\tfor (var opt in opts) {\r\n\t\t\tif (opts.hasOwnProperty(opt)) {\r\n\t\t\t\tif (nonProperties.indexOf(opt) === -1) {\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tsetOption(opt, opts[opt]);\r\n\t\t\t\t\t} catch (e) {\r\n\t\t\t\t\t\tconsole.warn(e);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\t\t//\r\n\t\t// Install the color picker on chosen element(s)\r\n\t\t//\r\n\r\n\r\n\t\t// Determine picker's container element\r\n\t\tif (this.container === undefined) {\r\n\t\t\tthis.container = window.document.body; // default container is BODY element\r\n\r\n\t\t} else { // explicitly set to custom element\r\n\t\t\tthis.container = jsc.node(this.container);\r\n\t\t}\r\n\r\n\t\tif (!this.container) {\r\n\t\t\tthrow new Error('Cannot instantiate color picker without a container element');\r\n\t\t}\r\n\r\n\r\n\t\t// Fetch the target element\r\n\t\tthis.targetElement = jsc.node(targetElement);\r\n\r\n\t\tif (!this.targetElement) {\r\n\t\t\t// temporarily customized error message to help with migrating from versions prior to 2.2\r\n\t\t\tif (typeof targetElement === 'string' && /^[a-zA-Z][\\w:.-]*$/.test(targetElement)) {\r\n\t\t\t\t// targetElement looks like valid ID\r\n\t\t\t\tvar possiblyId = targetElement;\r\n\t\t\t\tthrow new Error('If \\'' + possiblyId + '\\' is supposed to be an ID, please use \\'#' + possiblyId + '\\' or any valid CSS selector.');\r\n\t\t\t}\r\n\r\n\t\t\tthrow new Error('Cannot instantiate color picker without a target element');\r\n\t\t}\r\n\r\n\t\tif (this.targetElement.jscolor && this.targetElement.jscolor instanceof jsc.pub) {\r\n\t\t\tthrow new Error('Color picker already installed on this element');\r\n\t\t}\r\n\r\n\r\n\t\t// link this instance with the target element\r\n\t\tthis.targetElement.jscolor = this;\r\n\t\tjsc.addClass(this.targetElement, jsc.pub.className);\r\n\r\n\t\t// register this instance\r\n\t\tjsc.instances.push(this);\r\n\r\n\r\n\t\t// if target is BUTTON\r\n\t\tif (jsc.isButton(this.targetElement)) {\r\n\r\n\t\t\tif (this.targetElement.type.toLowerCase() !== 'button') {\r\n\t\t\t\t// on buttons, always force type to be 'button', e.g. in situations the target