import{r as o,h as r,H as i}from"./p-e97fde0a.js";import{s as n}from"./p-4cae87fc.js";import{c as s}from"./p-03fa5ba7.js";import"./p-03631502.js";import"./p-6c74654a.js";import"./p-9dbc54d6.js";import"./p-d3366af3.js";import"./p-401e165e.js";import"./p-830ab1a3.js";import"./p-ec182234.js";import"./p-3f6362a4.js";import"./p-95325ec5.js";import"./p-610295e2.js";import"./p-e2e1fe1f.js";const l=(o,r)=>(o||[]).some((({rules:o})=>e(o,r)));const e=(o,{checkout:r,processor:i})=>o.map((o=>{var n,s;const l=Array.isArray(o===null||o===void 0?void 0:o.value)?(o===null||o===void 0?void 0:o.value).map((o=>(o===null||o===void 0?void 0:o.value)||o)):o===null||o===void 0?void 0:o.value;switch(o===null||o===void 0?void 0:o.condition){case"total":return v(parseFloat(r.total_amount),parseFloat(l),o===null||o===void 0?void 0:o.operator);case"products":return d(t(r),l,o===null||o===void 0?void 0:o.operator);case"coupons":return d(u(r),l,o===null||o===void 0?void 0:o.operator);case"shipping_country":return d([(n=r===null||r===void 0?void 0:r.shipping_address)===null||n===void 0?void 0:n.country],l,o===null||o===void 0?void 0:o.operator);case"billing_country":return d([(s=r===null||r===void 0?void 0:r.billing_address)===null||s===void 0?void 0:s.country],l,o===null||o===void 0?void 0:o.operator);case"processors":return d([i],l,o===null||o===void 0?void 0:o.operator);default:return false}})).every((o=>o));const t=o=>{var r;return(((r=o===null||o===void 0?void 0:o.line_items)===null||r===void 0?void 0:r.data)||[]).map((({price:o})=>{var r;return(r=o===null||o===void 0?void 0:o.product)===null||r===void 0?void 0:r.id}))};const u=o=>{var r,i,n,s;return((i=(r=o===null||o===void 0?void 0:o.discount)===null||r===void 0?void 0:r.coupon)===null||i===void 0?void 0:i.id)?[(s=(n=o===null||o===void 0?void 0:o.discount)===null||n===void 0?void 0:n.coupon)===null||s===void 0?void 0:s.id]:[]};const d=(o,r,i)=>{switch(i){case"all":return r.filter((r=>o.some((o=>r==o)))).length===r.length;case"any":return o.filter((o=>r.some((r=>o==r)))).length>=1;case"none":return o.filter((o=>r.some((r=>o==r)))).length===0;case"exist":return o.length>=1;case"not_exist":return o.length===0;default:return false}};const v=(o,r,i)=>{switch(i){case"==":return o===r;case"!=":return o!==r;case">":return o>r;case"<":return o<r;case"<=":return o<=r;case">=":return o>=r}return false};const c=":host{display:block}";const a=c;const p=class{constructor(r){o(this,r);this.rule_groups=undefined}render(){let o=l(this.rule_groups,{checkout:s(),processor:n===null||n===void 0?void 0:n.id});if(!o)return null;return r(i,null,r("slot",null))}};p.style=a;export{p as sc_conditional_form};
//# sourceMappingURL=p-6f5c19b7.entry.js.map