PageSourceSearch

https://cheekymonkey.com.au/cdn/shop/t/6/assets/utils.js?v=11660763158696810971791169713

js cheekymonkey.com.au collected 2026-10-09 22:41:13 UTC 16,068 bytes, 2 lines download raw bytes

1function formatMoney(cents,formatString=theme.moneyFormat){(typeof cents>"u"||cents===null)&&(cents=0),typeof cents=="string"&&(cents=cents.replace(".",""));let value="";const placeholderRegex=/\{\{\s*(\w+)\s*\}\}/;function formatWithDelimiters(number,precision=2,thousands=",",decimal="."){if(isNaN(number)||number===null||number===void 0)return 0;number=(number/100).toFixed(precision);const parts=number.split("."),dollarsAmount=parts[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,`$1${thousands}`),centsAmount=parts[1]?decimal+parts[1]:"";return dollarsAmount+centsAmount}switch(formatString.match(placeholderRegex)[1]){case"amount":value=formatWithDelimiters(cents,2);break;case"amount_no_decimals":value=formatWithDelimiters(cents,0);break;case"amount_with_comma_separator":value=formatWithDelimiters(cents,2,".",",");break;case"amount_no_decimals_with_comma_separator":value=formatWithDelimiters(cents,0,".",",");break}return formatString.replace(placeholderRegex,value)}window.switchDOMContentLoaded=!1,document.addEventListener("DOMContentLoaded",()=>{window.switchDOMContentLoaded=!0}),window.switchOnDOMContentLoaded=cb=>{if(cb){if(window.switchDOMContentLoaded){cb();return}document.addEventListener("DOMContentLoaded",()=>{cb()})}else return new Promise(resolve=>{if(window.switchDOMContentLoaded){resolve();return}document.addEventListener("DOMContentLoaded",()=>{resolve()},{once:!0})})},window.requestIdleCallback=window.requestIdleCallback||function(cb){const start=Date.now();return setTimeout(function(){cb({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-start))}})},1)},window.cancelIdleCallback=window.cancelIdleCallback||function(id){clearTimeout(id)};function throttle(callback,limit){var waiting=!1;return function(){waiting||(callback.apply(this,arguments),waiting=!0,setTimeout(function(){waiting=!1},limit))}}function objectWithDefaults(defaults,provided){return filterObjectByValues(provided,value=>value==null),Object.assign(defaults,provided)}function wrap(el,tagName="div"){const wrapper=document.createElement(tagName);return el.parentNode.insertBefore(wrapper,el),wrapper.appendChild(el),wrapper}function wrapAll(nodes,wrapper){for(var parent=nodes[0].parentNode,previousSibling=nodes[0].previousSibling,i=0;nodes.length-i;wrapper.firstChild===nodes[0]&&i++)wrapper.appendChild(nodes[i]);return parent.insertBefore(wrapper,previousSibling.nextSibling),wrapper}function unwrap(wrapper){for(var docFrag=document.createDocumentFragment();wrapper.firstChild;){var child=wrapper.removeChild(wrapper.firstChild);docFrag.appendChild(child)}wrapper.parentNode.replaceChild(docFrag,wrapper)}function initTeleport(el){if(!el)return;const teleportCandidates=el.querySelectorAll("[data-should-teleport]");teleportCandidates.length&&teleportCandidates.forEach(teleportCandidate=>{teleportCandidate.setAttribute("x-teleport",teleportCandidate.dataset.shouldTeleport)})}async function fetchSectionHTML(url,selector){const fetchedSection=await(await fetch(url)).text(),result=querySelectorInHTMLString(selector,fetchedSection);return result===null?null:result.innerHTML}function fetchConfigDefaults(acceptHeader="application/json"){return{method:"POST",credentials:"same-origin",headers:{"X-Requested-With":"XMLHttpRequest","Content-Type":"application/json;",Accept:acceptHeader}}}function parseDOMFromString(htmlString){return window.___shapesDOMParser=window.___shapesDOMParser||new DOMParser,window.___shapesDOMParser.parseFromString(htmlString,"text/html")}function querySelectorInHTMLString(selector,htmlString){const parsedDOM=parseDOMFromString(htmlString);let result=parsedDOM.querySelector(selector);if(result)return result;const templateEls=parsedDOM.querySelectorAll("template");for(const templateEl of templateEls)if(result=templateEl.content.querySelector(selector),result)return result;return null}const CART_STATIC_SECTION_IDS=["cart-items","cart-footer","cart-item-count","cart-live-region"],CART_SECTION_RESPONSE_MODE_DRAWER="drawer-section",CART_SECTION_RESPONSE_MODE_STATIC="static-sections";function getCartDrawerSectionId(){return window.theme?.cartSectionIds?.["cart-drawer"]||null}function getCartRenderContext(){const cartType=window.theme?.settings?.cartType||"page",isCartPage=window.location.pathname===window.theme?.routes?.cart_url,drawerSectionId=getCartDrawerSectionId(),useCartDrawer=cartType==="modal"&&!isCartPage;return{cartType,isCartPage,drawerSectionId,useCartDrawer,useStaticSectionFallback:useCartDrawer&&!drawerSectionId}}function getCartSectionRequestIds(){const{useCartDrawer,drawerSectionId,useStaticSectionFallback}=getCartRenderContext();return useStaticSectionFallback?(window.__shapesCartDrawerSectionFallbackLogged||(console.error("Modal cart is active but the cart drawer section id is unavailable. Falling back to static cart sections for this update."),window.__shapesCartDrawerSectionFallbackLogged=!0),[...CART_STATIC_SECTION_IDS]):useCartDrawer?[drawerSectionId,"cart-item-count","cart-live-region"]:[...CART_STATIC_SECTION_IDS]}function getCartSectionResponseMode(responseSections){const{useCartDrawer,drawerSectionId}=getCartRenderContext();return useCartDrawer&&drawerSectionId&&responseSections?.[drawerSectionId]?CART_SECTION_RESPONSE_MODE_DRAWER:CART_SECTION_RESPONSE_MODE_STATIC}function getCartDrawerTemplateContent(responseSections){const{drawerSectionId}=getCartRenderContext();if(!drawerSectionId)return null;const drawerSectionHTML=responseSections?.[drawerSectionId];return drawerSectionHTML&&parseDOMFromString(drawerSectionHTML).querySelector("template[data-should-teleport]")?.content||null}function getCartSectionHTML(responseSections,target){if(!responseSections||!target)return null;switch(target){case"count":return responseSections["cart-item-count"]||null;case"liveRegion":return responseSections["cart-live-region"]||null;case"items":case"footer":{const responseMode=getCartSectionResponseMode(responseSections),selector=target==="items"?"[data-cart-items]":"[data-cart-footer]";if(responseMode===CART_SECTION_RESPONSE_MODE_DRAWER)return getCartDrawerTemplateContent(responseSections)?.querySelector(selector)?.outerHTML||null;const sectionHTML=responseSections[target==="items"?"cart-items":"cart-footer"];return sectionHTML&&querySelectorInHTMLString(selector,sectionHTML)?.outerHTML||null}default:return null}}window.__fetchCache=window.__fetchCache||{};const RESPONSE_TYPE_JSON=0,RESPONSE_TYPE_TEXT=1;async function fetchAndCache(url,options,cacheTimeout=5e3,forceFresh=!!Shopify.designMode,responseType){const key=url.toString();if(__fetchCache[key]&&!forceFresh)return __fetchCache[key];const responseReader=responseType===RESPONSE_TYPE_TEXT?Response.prototype.text:Response.prototype.json,res=await fetch(url,options),data=responseReader.call(res);return cacheTimeout&&cacheTimeout>0&&(__fetchCache[key]=data,setTimeout(()=>{delete __fetchCache[key]},cacheTimeout)),data}
1function invalidateCacheForKeysContaining(string){const matchingKeys=Object.keys(__fetchCache).filter(key=>key.includes(string));for(const key of matchingKeys)delete __fetchCache[key]}async function fetchHTML(url,options,cacheTimeout=5e3,forceFresh=!!Shopify.designMode){return fetchAndCache(url,options,cacheTimeout,forceFresh,RESPONSE_TYPE_TEXT)}function freshHTML(url,options){return fetchHTML(url,options,0,!0)}async function fetchJSON(url,options,cacheTimeout=5e3,forceFresh=!!Shopify.designMode){return fetchAndCache(url,options,cacheTimeout,forceFresh,RESPONSE_TYPE_JSON)}function freshJSON(url,options){return fetchJSON(url,options,0,!0)}async function fetchHTMLFragment(url,selector){const fetchedHTMLString=await fetchHTML(url),fragment=querySelectorInHTMLString(selector,fetchedHTMLString);return fragment?fragment.innerHTML:""}function mdBreakpointMQL(){return window.matchMedia("(min-width: 768px)")}function isMdBreakpoint(){return window.mdBreakpointMQL().matches}function maxMdBreakpointMQL(){return window.matchMedia("(max-width: 767px)")}function isMaxMdBreakpoint(){return window.maxMdBreakpointMQL().matches}function maxLgBreakpointMQL(){return window.matchMedia("(max-width: 989px)")}function isMaxLgBreakpoint(){return window.maxLgBreakpointMQL().matches}function lgBreakpointMQL(){return window.matchMedia("(min-width: 990px)")}
1function isLgBreakpoint(){return window.lgBreakpointMQL().matches}function motionSafeMQL(){return window.matchMedia("(prefers-reduced-motion: reduce)")}function isMotionSafe(){return!window.motionSafeMQL().matches}function reducedDataMQL(){return window.matchMedia("(prefers-reduced-data: reduce)")}function prefersReducedData(){return reducedDataMQL().matches}function isSlowConnection(){if("connection"in navigator){const{connection}=navigator;return connection.effectiveType==="slow-2g"||connection.effectiveType==="2g"}return!1}function shouldTryToSaveData(){return prefersReducedData()||isSlowConnection()||"connection"in navigator&&navigator.connection.saveData===!0}function kebabCase(subject){return[" ","_"].includes(subject)?subject:subject.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[_\s]/,"-").toLowerCase()}function clearURLSearchParams(url){for(const key of[...url.searchParams.keys()])url.searchParams.delete(key)}function _getURLByModifyingParams(urlString,paramsInput,clear=!1,append){const url=new URL(urlString,window.location.origin);clear&&clearURLSearchParams(url);const params=new URLSearchParams(paramsInput),setOrAppendParam=append?URLSearchParams.prototype.append:URLSearchParams.prototype.set;for(const[key,value]of params)setOrAppendParam.call(url.searchParams,key,value);return url}function getURLWithParams(url,paramsInput,clear=!1){return _getURLByModifyingParams(url,paramsInput,clear,!1)}function currentURLWithParams(paramsInput,clear=!1){return getURLWithParams(window.location.href,paramsInput,clear)}function getURLAddingParams(url,paramsInput,clear=!1){return _getURLByModifyingParams(url,paramsInput,clear,!0)}function currentURLAddingParams(paramsInput,clear=!1){return getURLAddingParams(window.location.href,paramsInput,clear)}function iFrameCommand(iFrameEl,commandString){!iFrameEl||!commandString||iFrameEl.contentWindow.postMessage(JSON.stringify({event:"command",func:commandString,args:""}),"*")}function iFrameMethod(iFrameEl,methodString){!iFrameEl||!methodString||iFrameEl.contentWindow.postMessage(JSON.stringify({method:methodString}),"*")}let touchDevice=!1;window.setTouch=function(){touchDevice=!0},window.isTouch=function(){return touchDevice};async function getModalLabel(modalSlotName,slotEl){if(Alpine.store("modals")[modalSlotName].open){await globalNextTick();const labelSourceEl=Array.from(slotEl.children).filter(el=>el.hasAttribute("data-modal-label"))[0];if(labelSourceEl)return labelSourceEl.dataset.modalLabel}return!1}function waitForContent(element=null){return new Promise((resolve,reject)=>{let fallbackTimeoutId;if(!element){const err=new Error("waitForContent: No element provided");err.element=null,reject(err);return}if(element.innerHTML.trim().length>0){resolve();return}const mutationObserver=new MutationObserver((_mutationsList,observer)=>{element.innerHTML.trim().length>0&&(observer.disconnect(),clearTimeout(fallbackTimeoutId),resolve())});mutationObserver.observe(element,{childList:!0,subtree:!0,characterData:!0}),fallbackTimeoutId=setTimeout(()=>{if(mutationObserver.disconnect(),element.innerHTML.trim().length>0){resolve();return}const err=new Error("waitForContent: Awaited content was not received after 10 seconds, aborting");err.element=element,reject(err)},1e4)})}function capitalize(string){return string.charAt(0).toUpperCase()+string.slice(1)}function asyncTimeout(ms){return new Promise(resolve=>{setTimeout(resolve,ms)})}function globalNextTick(){return new Promise(resolve=>{queueMicrotask(resolve)})}function rafTick(){return new Promise(resolve=>{requestAnimationFrame(resolve)})}function getSectionId(el){return el._closestSectionId||(el._closestSectionId=el.closest(".shopify-section")?.getAttribute("id").replace("shopify-section-","")),el._closestSectionId}function daysInMs(days){return days*24*60*60*1e3}function msInDays(ms){return ms/1e3/60/60/24}function isInTheFuture(msSinceEpoch){return msSinceEpoch>Date.now()}function setExpiringStorageItem(key,value,expiresIn){localStorage.setItem(key,JSON.stringify({value,expires:Date.now()+expiresIn}))}function getExpiringStorageItem(key){const value=localStorage.getItem(key);if(!value)return null;let valueObject;try{valueObject=JSON.parse(value)}catch{}return valueObject&&valueObject.expires?isInTheFuture(valueObject.expires)?valueObject.value:(localStorage.removeItem(key),null):null}function getRecentlyViewedProducts(){let currentRecentlyViewedProducts;const localStorageItem=localStorage.getItem("switch-recently-viewed-products");try{const parsedItem=JSON.parse(localStorageItem);currentRecentlyViewedProducts=Array.isArray(parsedItem)?parsedItem:[]}catch{currentRecentlyViewedProducts=[]}return currentRecentlyViewedProducts}
1function updateRecentlyViewedProducts(productId){if(!productId)return;const currentRecentlyViewedProducts=getRecentlyViewedProducts().filter(id=>id!==productId);currentRecentlyViewedProducts.unshift(productId),localStorage.setItem("switch-recently-viewed-products",JSON.stringify(currentRecentlyViewedProducts))}function reevaluateScriptsIn(el){const scriptEls=el.querySelectorAll("script");for(const scriptEl of scriptEls){const newScriptEl=document.createElement("script");for(const attributeName of scriptEl.getAttributeNames())newScriptEl.setAttribute(attributeName,scriptEl.getAttribute(attributeName));newScriptEl.textContent=scriptEl.textContent,scriptEl.replaceWith(newScriptEl)}}window.replaceMainContentAbortController=null;async function replaceMainContent(url,options=void 0,cacheFor=0,onReplaced=(_newEl,_oldEl)=>{}){if(!url)return;window.replaceMainContentAbortController?.abort(),window.replaceMainContentAbortController=new AbortController;const html=await fetchHTML(url,{...options,signal:window.replaceMainContentAbortController.signal},cacheFor,!1).catch(e=>{if(e.name!=="AbortError")throw e}),mainEl=document.querySelector("main#MainContent"),newMainEl=querySelectorInHTMLString("main#MainContent",html);if(newMainEl){window.Alpine?.destroyTree(mainEl),destroySlideshowsIn(mainEl),mainEl.replaceWith(newMainEl),reevaluateScriptsIn(newMainEl),discoverNewSlideshows(newMainEl),await globalNextTick(),onReplaced(newMainEl,mainEl);const historyURLAsString=url.toString();window.history.replaceState({path:historyURLAsString},"",historyURLAsString)}window.replaceMainContentAbortController=null}async function replaceElement(el,url,options=void 0,cacheFor=0,onReplaced=(_newEl,_oldEl)=>{}){if(!el||!url)return;if(!el.getAttribute("id")){console.error("replaceElement needs an element with an id");return}el.updateAbortController?.abort(),el.updateAbortController=new AbortController;const html=await fetchHTML(url,{...options,signal:el.updateAbortController.signal},cacheFor,!1).catch(e=>{if(e.name!=="AbortError")throw e});if(!html)return;const newEl=parseDOMFromString(html).getElementById(el.getAttribute("id"));newEl&&(window.Alpine?.destroyTree(el),destroySlideshowsIn(el),el.replaceWith(newEl),reevaluateScriptsIn(newEl),discoverNewSlideshows(newEl),await globalNextTick(),onReplaced(newEl,el))}function isInView(element){const bounding=element.getBoundingClientRect();return bounding.top>=0&&bounding.left>=0&&bounding.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&bounding.right<=(window.innerWidth||document.documentElement.clientWidth)}function maintainScrollVisibility(activeElement,scrollParent){const{offsetHeight}=activeElement,{offsetHeight:parentOffsetHeight,scrollTop}=scrollParent,offsetTop=activeElement.getBoundingClientRect().top-scrollParent.getBoundingClientRect().top+scrollTop,isAbove=offsetTop<scrollTop,isBelow=offsetTop+offsetHeight>scrollTop+parentOffsetHeight;isAbove?scrollParent.scrollTo(0,offsetTop):isBelow&&scrollParent.scrollTo(0,offsetTop-parentOffsetHeight+offsetHeight)}
2//# sourceMappingURL=/cdn/shop/t/6/assets/utils.js.map?v=11660763158696810971791169713

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.