"use strict";var core=require("@gem-sdk/core"),helpers=require("./helpers.js");function filterTruthyStyles(e){return Object.fromEntries(Object.entries(e||{}).filter(([,e])=>void 0!==e||""===e))}const getStyle=(e,t,r)=>{let{sizeSetting:l}=e??{},o={...r,...helpers.getVisibilityStyle(r),...core.makeStyleWithDefault("w",core.getWidthByShapeGlobalSize(l,!0),{desktop:"--g-ct-w",tablet:"--g-ct-w",mobile:"--g-ct-w"}),...core.makeStyleResponsive("h",core.getHeightByShapeGlobalSize(l))};return filterTruthyStyles(o)},getContainerStyle=e=>{let{sizeSetting:t,background:r,borderBg:l,cornerBg:o,shadowBg:i,hasActiveShadow:a}=e??{},s={...core.makeStyleResponsive("h",core.getHeightByShapeGlobalSize(t)),...helpers.getStyleAspectRatioHeroBannerCustom(r,t),...core.makeStyle({bs:l?.border??l?.border,bw:l?.width??l?.width,bc:core.getSingleColorVariable(l?.color)}),...core.getRadiusStyleActiveState({...o,active:{...o||{},radiusType:"custom"}}),...r?{...core.getStyleBgColor(r)}:{},...core.getStyleShadow({value:i,styleAppliedFor:"box-shadow",isEnableShadow:a})};return filterTruthyStyles(s)},getOverlayStyle=e=>{let{overlayColor:t,overlayOpacity:r,hoverEffect:l}=e??{},{disableOpacity:o}=helpers.opacityEnabledData(e),i="number"!=typeof r?.normal||isNaN(r?.normal)?"string"==typeof r?.normal?`${parseInt(r?.normal)}%`:"0%":`${r?.normal}%`,a=core.makeStyleState("op",{normal:i,hover:helpers.getOpacityHover(e)}),s=core.getGlobalColorStateStyle("bgc",{...t,hover:t?.hover||t?.normal});o&&(delete s?.["--bgc"],delete a?.["--op"]),l||(delete s?.["--hvr-bgc"],delete a?.["--hvr-op"]);let y={...s,...a,"--top":"0","--left":"0"};return filterTruthyStyles(y)},getRowStyle=e=>{let{contentPadding:t}=e??{},r={...core.getResponsiveStylePadding(t)};return filterTruthyStyles(r)},getAdaptiveStyle=e=>{let{sizeSetting:t,background:r}=e??{},l={...helpers.getDisplayStyleByFitContent(t,r),...core.makeStyleResponsive("h",core.getHeightByShapeGlobalSize(t)),...core.makeStyleWithDefault("w",core.getWidthByShapeGlobalSize(t,!0),{desktop:"--g-ct-w",tablet:"--g-ct-w",mobile:"--g-ct-w"})};return filterTruthyStyles(l)},getBackgroundStyle=(e,t,r)=>{let{hoverEffectScale:l,background:o,hoverEffectDuration:i}=e??{},a=`${parseFloat(`${i}`)??.5}s`,s={...helpers.getStyleHeroBannerBg(helpers.getResponsiveSetting(o||{}),t),...core.getStyleBackgroundByDevice(o,{ignoreBgAttachment:!0,ignoreBackgroundImage:!0}),"--duration":a,"--scale":helpers.formatHoverScale(l),...core.makeStyleResponsive("pos",helpers.getAttachmentDevice(o)),transform:r,transition:`transform ${a} cubic-bezier(0,0,0,1)`};return filterTruthyStyles(s)},getContainBackgroundStyle=e=>{let{borderBg:t,cornerBg:r}=e??{},l={"clip-path":helpers.getClipPath(t?.width,r)};return filterTruthyStyles(l)},mapVideoObjectFit=e=>{if(e)return{desktop:core.getValueByDevice(e,"desktop"),tablet:core.getValueByDevice(e,"tablet"),mobile:core.getValueByDevice(e,"mobile")}},mapVideoAlignResponsive=e=>{if(!e)return;let t={};return core.DEVICES.forEach(r=>{let l=core.getResponsiveValueByScreen(e,r),o=l?.videoAlign;t[r]=o||"top"}),Object.keys(t).length>0?t:void 0},getHtml5VideoStyle=(e,t,r)=>{let l=mapVideoObjectFit(t),o=mapVideoAlignResponsive(r),i={...core.makeStyleResponsive("aspect",e),...l?core.makeStyleResponsive("objf",l):{},...o?core.makeStyleResponsive("objp",o):{}};return filterTruthyStyles(i)},getYoutubeIframeStyle=(e,t)=>{let r=mapVideoObjectFit(t),l={...core.makeStyleResponsive("aspect",e),...r?core.makeStyleResponsive("objf",r):{},"pointer-events":"none"};return filterTruthyStyles(l)};exports.getAdaptiveStyle=getAdaptiveStyle,exports.getBackgroundStyle=getBackgroundStyle,exports.getContainBackgroundStyle=getContainBackgroundStyle,exports.getContainerStyle=getContainerStyle,exports.getHtml5VideoStyle=getHtml5VideoStyle,exports.getOverlayStyle=getOverlayStyle,exports.getRowStyle=getRowStyle,exports.getStyle=getStyle,exports.getYoutubeIframeStyle=getYoutubeIframeStyle;
