import{makeGlobalSize as t,getStyleShadow as e,composeTypographyStyle as o,convertDecimalToNumber as r}from"@gem-sdk/core";import{convertToStyle as i,getSize as a,getWrapperStyle as n,getShapeWrapperPadding as p,checkDiscountContentProductBadge as s}from"../utils/common.js";import{getShapePosition as d}from"../utils/getShapePosition.js";import{composeShapeStyleByPosition as l,composeTextStyleByPosition as g}from"../utils/getRotateShape.js";import{getStyleAdvanced as m}from"../utils/getStyleAdvanced.js";import{getWhiteSpaceStyle as u}from"../utils/getWhiteSpace.js";import{generateShadowCSS as h,getStyleBackground as y,getStyleBorder as S,getStyleCornerRadius as x}from"../utils/stylesV2.js";import{getShape as c}from"../utils/shape.js";import{checkShowBadge as C}from"../utils/renderBadgeILP.js";let T=t=>{let{setting:e,styles:o}=t,r=c(e?.shape),i=e?.contentType==="text",n=i?o?.textSizeV2:o?.imageSizeV2;return i?a(r,n):a(void 0,n)},f=(t,e=!1)=>{let{setting:o,styles:r,style:i,navigationPosition:a,imageData:p,dotData:s}=t,l=o?.positionWithImage==="outside",g=n(e),u=d({positionType:r?.position,navigationPosition:a,dataImage:{...p,...s}}),h=T(t),y=m(l?{}:{...u,...h},i);return{...!l&&{"--pos":"absolute"},...g,...y}},B=({styles:r,setting:a})=>{let n=t(r?.textSizeV2).padding,p=c(a?.shape),s=a?.positionWithImage==="outside";return{...u(r?.textSizeV2),...i(p?.textStyle),...g(p,r?.position,s),...o(r?.typo),...e({value:r?.typo?.custom?.textShadow,styleAppliedFor:"text-shadow",isEnableShadow:r?.typo?.custom?.hasShadowText}),...y(!!p?.backgroundColorInText,r?.badgeColorV2),...n}},b=({styles:t,setting:e})=>{let o=c(e?.shape),r=e?.contentType==="text";return o?.supportBorder?r?S(t?.textBadgeBorder):S(t?.imageBadgeBorder):{}},I=({styles:t,setting:e})=>{let o=c(e?.shape),r=e?.contentType==="text";return o?.supportCorner?r?x(t?.textBadgeCorner,o?.shapeRadius):x(t?.imageBadgeCorner,o?.shapeRadius):{}},j=({styles:t,setting:e})=>{let o=c(e?.shape),r=b({setting:e,styles:t}),i=e?.positionWithImage==="outside",a=I({setting:e,styles:t}),n=p(o?.ratio);return{...r,...a,...l(o,t?.position,i),...y(!o?.backgroundColorInText,t?.badgeColorV2),...n,height:o?.ratio===1?"0px":"100%"}},V=({styles:e,setting:o})=>{let r=b({setting:o,styles:e}),i=I({setting:o,styles:e}),a=t(e?.imageSizeV2).padding;return{...r,...i,...a}},W=({props:t,currentVariant:e,product:o,isEditMode:i})=>{let{"bundle-item":a,setting:n}=t;if(a)return 1;let p=n?.contentType==="text",d=p&&!n?.displayContent?.trim(),l=s(n?.displayContent);if(d)return i?.2:0;let g=r(e?.price)??0,m=r(e?.salePrice)??0,u=C(n?.displayTrigger,o,e);return(m-g>0||!l)&&u?1:i?.2:0},w=({props:t,product:e,currentVariant:o,isEditMode:r})=>{let{setting:i}=t,a=i?.positionWithImage==="outside",n=T(t),p=r&&o?W({props:t,currentVariant:o,product:e,isEditMode:r}):1;return{...a?{...n,"--mb":0}:{},opacity:p}},z=t=>{let{styles:e,setting:o,builderProps:r}=t,i=o?.contentType==="text";return h(`[id="${r?.uid}"] .product-badge-item`,i?e?.textBadgeShadow:e?.imageBadgeShadow)};export{f as getContainerStyle,z as getContentStyleInternal,V as getImageContainerStyles,w as getSubWrapperStyle,j as getTextBadgeWrapperStyles,B as getTextContentStyle};
