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