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