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