"use strict";const isObject=t=>t&&"object"==typeof t&&!Array.isArray(t),getSerializedState=()=>{const t=document.querySelector('script[type="application/json"]#sc-store-data');if(!t)return{};try{const o=JSON.parse(t.textContent);if(isObject(o))return o;throw Error("Parsed state is not an object")}catch(t){console.error(t)}return{}},isProductVariantOptionSoldOut=(t,o,i,n)=>{var a,r,l,e,d;const s=t=>{var o;return(null!==(o=null==t?void 0:t.has_unlimited_stock)&&void 0!==o?o:null==n?void 0:n.has_unlimited_stock)?1/0:t.available_stock},u=t=>!!t.length&&Math.max(...t.map(s))<=0;return u(1===t?null===(l=(r=(null===(a=n.variants)||void 0===a?void 0:a.data)||[]).filter)||void 0===l?void 0:l.call(r,(t=>t.option_1===o)):2===t?((null===(e=n.variants)||void 0===e?void 0:e.data)||[]).filter((t=>(null==t?void 0:t.option_1)===i.option_1&&t.option_2===o)):((null===(d=n.variants)||void 0===d?void 0:d.data)||[]).filter((t=>(null==t?void 0:t.option_1)===i.option_1&&(null==t?void 0:t.option_2)===i.option_2&&t.option_3===o)))},isProductVariantOptionMissing=(t,o,i,n)=>{var a,r,l;return 1===t?!((null===(a=null==n?void 0:n.variants)||void 0===a?void 0:a.data)||[]).some((t=>t.option_1===o)):2===t?!((null===(r=null==n?void 0:n.variants)||void 0===r?void 0:r.data)||[]).some((t=>(null==t?void 0:t.option_1)===i.option_1&&t.option_2===o)):!((null===(l=null==n?void 0:n.variants)||void 0===l?void 0:l.data)||[]).some((t=>(null==t?void 0:t.option_1)===i.option_1&&(null==t?void 0:t.option_2)===i.option_2&&t.option_3===o))};exports.getSerializedState=getSerializedState,exports.isProductVariantOptionMissing=isProductVariantOptionMissing,exports.isProductVariantOptionSoldOut=isProductVariantOptionSoldOut;