'use client';
import{jsx as t,jsxs as e}from"react/jsx-runtime";import{useRenderMode as o,isEmptyChildren as s}from"@gem-sdk/core";import{isValidElement as n}from"react";import r from"../../../common/components/NoDataState.js";import{createClass as i,createStyle as l,If as d}from"@gem-sdk/system";import{getSizeSettings as m,getContainerStyles as u}from"./common/styles.js";import{getContainerClasses as c,getNoDiscountClasses as a}from"./common/classes.js";import p from"./hooks/useProductBundleDataState.js";import f from"./hooks/useProductBundleDiscountState.js";import h from"./ProductBundleDiscountChildrenItem.js";let ProductBundleDiscount=({builderAttrs:y,style:b,children:I,setting:g,styles:j,advanced:D})=>{let{isEditMode:k,isPreviewSharePageMode:S}=o(),{isSelected:x,setSelected:B}=f(g),{emitRedirectSetupPage:P,redirectGuideline:N,svgVertical:T,svgHorizontal:v}=p(),A=i(c(g,D?.cssClass)),C=i(a),q=l(m(j)?.gap),w=l(u(q,j,b));if(!g?.bundleItems?.length&&k)return t(r,{elementType:"secondary",description:"Increase AOV with bundle quantity.",descriptionActions:[{text:"Setup bundle discount",callback:P},{text:"read guideline",callback:N}],additionalMedia:g?.layout=="horizontal-layout"?v:T});let z=(e,o)=>{if(g?.hideNoDiscountItem&&e?.discountType==="no_discount")return null;let s=I?.[o];if(n(s))return t(h,{index:o,childItem:s,setting:g,styles:j,isSelected:x(o),setSelected:B,bundleItem:e},o)},M=(s(I)||g?.bundleItems?.length==0)&&!S;return e("div",{...y,className:A,style:w,children:[d(M,t("div",{className:C,children:"This product has no bundle discount"})),g?.bundleItems?.map((t,e)=>z(t,e))]})};export{ProductBundleDiscount as default};
