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