"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[15],{8:function(t,e){var n=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{s(r.next(t))}catch(t){i(t)}}function c(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,c)}s((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.ccpa_dns=e.imagePixel=e.sha256=e.cancellableFetch=e.uuid=e.reduceCartItems=e.getOldCart=e.updateCart=e.safeParse=e.isShopifyCart=e.isShopifyCartItem=e.normalizeCart=e.callOrlyTagHooks=e.entries=e.buildProductAndVariant=e.readCookie=e.loadScriptWithDelay=e.loadScript=void 0;const r={};function o(t,e=(()=>{})){const{src:n,id:o,anonymous:i=!0}=t;if(r[n]&&window.clearTimeout(r[n]),document.getElementById(o))return;const a=document.createElement("script");a.src=n,a.defer=!0,a.id=o,i&&(a.crossOrigin="anonymous"),a.onload="function"==typeof window.requestIdleCallback?()=>window.requestIdleCallback(e):e,document.body.append(a)}function i(t){return"string"==typeof t.key&&"number"==typeof t.quantity}function a(t){if("object"!=typeof t||null===t)return!1;const{items:e}=t;return Array.isArray(e)&&e.every(i)}e.loadScript=o,e.loadScriptWithDelay=function(t,e=(()=>{})){const{src:n,id:i}=t;if(document.getElementById(i))"function"==typeof window.requestIdleCallback?window.requestIdleCallback(e):window.setTimeout(e,0);else if(t.useRequestIdleCallback&&"function"==typeof window.requestIdleCallback)window.requestIdleCallback((()=>o(t,e)));else{const i=t.timeout||window.scriptDelayTime||1e4;r[n]=window.setTimeout(o,i,t,e)}},e.readCookie=function(t){return function(t){const e={};for(let t=0,n=document.cookie.split(/ *; */);t[{id:`${t.product_id}`,handle:t.handle,title:t.product_title,tags:[],price:t.price.toString(),compareAtPrice:t.original_price.toString(),vendor:t.vendor,productType:t.product_type,image:t.image,quantity:t.quantity},{id:`${t.variant_id}`,sku:t.sku,brand:t.vendor,title:t.variant_title,price:t.price.toString(),selectedOptions:t.options_with_values}],e.entries=function(t){return Object.entries(t)},e.callOrlyTagHooks=function(t,...e){var r;return n(this,void 0,void 0,(function*(){const n=[];null===(r=window._orlyTags)||void 0===r||r.forEach((([r,o])=>{r===t&&n.push(o(...e).catch((n=>(console.error(`callOrlyTagHooks: error in type: ${t}\n params: ${JSON.stringify(e,null,2)}\n error: ${n}`),n))))})),yield Promise.allSettled(n)}))},e.normalizeCart=t=>{return Object.assign(Object.assign({},t),{items:(e=t.items,e.map((t=>Object.assign(Object.assign({},t),{price:.01*t.price,original_price:.01*t.original_price}))))});var e},e.isShopifyCartItem=i,e.isShopifyCart=a,e.safeParse=t=>{try{return JSON.parse(t)}catch(t){return}};const c="outsmartly-shopify-cart";e.updateCart=t=>{window.localStorage.setItem(c,JSON.stringify(t))},e.getOldCart=()=>{var t;const n=null!==(t=window.localStorage.getItem(c))&&void 0!==t?t:"",r=(0,e.safeParse)(n);if(a(r))return r},e.reduceCartItems=t=>t.reduce(((t,e)=>{const n=t.get(e.id);return n?n.quantity+=e.quantity:t.set(e.id,Object.assign({},e)),t}),new Map);const s="xxxx-4xxx-xxxx-xxxxxxxxxxxx";e.uuid=function(){let t="";try{const e=window.crypto||window.msCrypto,n=new Uint16Array(31);e.getRandomValues(n);let r=0;t=s.replace(/[x]/g,(function(t){for(let t=[],e=1;e>>0}catch(e){t=(new Date).getTime()>>>0}try{e=performance.now()>>>0}catch(t){e=0}const n=Math.abs(t+e).toString(16).toLowerCase();return"00000000".substring(0,8-n.length)+n}()+"-"+t},e.cancellableFetch=function(t,e={}){const n=new AbortController,{signal:r}=n;return{response:fetch(t,Object.assign(Object.assign({},e),{signal:r})),cancel:()=>n.abort()}},e.sha256=function(t){return n(this,void 0,void 0,(function*(){const e=(new TextEncoder).encode(t),n=yield crypto.subtle.digest("SHA-256",e);return Array.from(new Uint8Array(n)).map((t=>t.toString(16).padStart(2,"0"))).join("")}))},e.imagePixel=function(t){return n(this,void 0,void 0,(function*(){const e=new Image;e.height=1,e.width=1,e.setAttribute("style","display:none;"),e.src=t,document.body.append(e)}))},e.ccpa_dns=function(){return/__ccpa_dns=true/.test(document.cookie)}}}]);