"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[4],{7:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{s(r.next(e))}catch(e){a(e)}}function u(e){try{s(r.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,u)}s((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.safePromise=t.typedFromEntries=t.safeParseInt=t.safeParseFloat=t.getThemeColors=t.getPageImage=t.reviewPageKey=t.urlToHandle=t.updateQueryParam=t.isDefined=void 0,t.isDefined=function(e){return Boolean(e)},t.updateQueryParam=function(e,t){if("undefined"==typeof window)return;const n=new URL(window.location.href),r=new URLSearchParams(n.search);r.set(e,t),n.search=r.toString(),window.history.replaceState({path:n.toString()},"",n.toString())},t.urlToHandle=function(e){var t,n;return null!==(n=null===(t=new URL(e).pathname.match(/\/products\/([^/?]+)/))||void 0===t?void 0:t[1])&&void 0!==n?n:""},t.reviewPageKey=function(e,t){return`reviews_${e}_page_${t}`},t.getPageImage=function(e,t){if((null==e?void 0:e.startsWith("http"))||!t||!e)return e;const n=new URL(`https://${t}`);return n.pathname=e,n.toString()},t.getThemeColors=function({selectedVariant:e,getHexForOptionColor:t}){var n;const r=null===(n=null==e?void 0:e.selectedOptions.find((e=>"color"===e.name.toLowerCase())))||void 0===n?void 0:n.value;if(!(null==e?void 0:e.availableForSale))return{hexColor:"#666",color:"#999"};const o=r?null==t?void 0:t(r).hexColor:"#000";return{hexColor:o,color:function(e){const{r:t,g:n,b:r}=function(e){let t=0,n=0,r=0;return 4==e.length?(t=parseInt("0x"+e[1]+e[1],16),n=parseInt("0x"+e[2]+e[2],16),r=parseInt("0x"+e[3]+e[3],16)):7==e.length&&(t=parseInt("0x"+e[1]+e[2],16),n=parseInt("0x"+e[3]+e[4],16),r=parseInt("0x"+e[5]+e[6],16)),{r:t,g:n,b:r}}(e);return(299*t+587*n+114*r)/1e3>=128?"black":"white"}(o)}},t.safeParseFloat=(...e)=>{try{return parseFloat(...e)}catch(e){return}},t.safeParseInt=(...e)=>{try{return parseInt(...e)}catch(e){return}},t.typedFromEntries=function(e){return Object.fromEntries(e)},t.safePromise=function(e){return n(this,void 0,void 0,(function*(){try{return yield e}catch(e){return}}))}}}]);