'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),common=require("./utils/common.js");require("./constants.js");var NoDataState=require("../../../common/components/NoDataState.js"),TooltipHover=require("../../../common/components/TooltipHover.js"),system=require("@gem-sdk/system"),attrs=require("./common/attrs.js"),classes=require("./common/classes.js"),styles=require("./common/styles.js");const ProductBadge=e=>{let{t:s}=core.useI18nStore(),{setting:t,styles:r,children:a,builderAttrs:l,...o}=e,c=core.useProduct(),n=core.useCurrentVariant(),{moneyFormat:m}=core.useMoneyFormat(),i=core.useCurrentDevice(),{useProductCompareAtPrice:y}=core.useProductBundleDiscount(),u=o?.["bundle-item"],d=core.useEditorMode(),{isEditMode:g}=core.useRenderMode(),j="STATIC"===core.usePageType(),x=common.getBadgeContent({detail:c,currentVariant:n,bundleItem:u,useProductCompareAtPrice:y},t?.displayContent,m),C=common.getIsNoDiscountState({props:e,product:c,currentVariant:n,moneyFormat:m,useProductCompareAtPrice:y}),p=system.createClass({...classes.getContainerClasses({mode:d,isInstant:j,product:c,currentVariant:n,props:e})}),S=system.createStyle({...styles.getContainerStyle(e)}),T=system.createAttr({...attrs.getEditTooltipAttrs(e,g)}),v=system.createClass({...classes.getWrapperClasses(e)}),N=system.createClass({...classes.getSubWrapperClass(e,i)}),R=system.createStyle({...styles.getSubWrapperStyle({props:e,product:c,currentVariant:n,isEditMode:g})}),A=system.createAttr({...attrs.getSubWrapperAttrs(e,c)}),h=styles.getContentStyleInternal(e),q=system.createClass({...classes.getTextContainerClasses()}),I=system.createAttr({...attrs.getContainerAttrs(e)}),f=system.createClass({...classes.getTextWrapperClasses()}),P=system.createStyle({...styles.getTextBadgeWrapperStyles({setting:t,styles:r})}),b=system.createClass({...classes.getTextContentClasses(r)}),D=system.createStyle({...styles.getTextContentStyle({setting:t,styles:r})}),W=system.createAttr({...attrs.getTextContentAttrs()}),B=system.createClass({...classes.getImageContainerClasses()}),M=system.createStyle({...styles.getImageContainerStyles({setting:t,styles:r})}),H=system.createClass({...classes.getImageClasses()}),k=system.createAttr({...attrs.getImageAttr({setting:t})});return c?jsxRuntime.jsxs("div",{...I,style:S,className:p,children:[system.If(g&&C,jsxRuntime.jsx(TooltipHover.default,{...T,children:jsxRuntime.jsx(NoDataState.default,{...l,elementType:"secondary",description:s("No discount"),rawMode:!0})}),jsxRuntime.jsx("div",{className:v,children:jsxRuntime.jsxs("div",{...A,className:N,style:R,children:[jsxRuntime.jsx("style",{children:h}),system.If(t?.shape!=="image",jsxRuntime.jsx("div",{className:q,children:jsxRuntime.jsx("div",{className:f,style:P,children:jsxRuntime.jsx("pre",{...W,className:b,style:D,children:x})})}),jsxRuntime.jsx("div",{className:B,style:M,children:jsxRuntime.jsx("img",{...k,className:H,alt:""})}))]})})),core.filterToolbarPreview(a,!0)]}):null};exports.default=ProductBadge;
