import{template as e,getAspectRatioGlobalSize as t,DEVICES as o,getResponsiveValueByScreen as s,hasTranslatedLiquid as i}from"@gem-sdk/core";import l from"../../grid/components/row/Row.liquid.js";import{createStyle as a,createClass as r,If as m}from"@gem-sdk/system";import d from"../../image/components/AdaptiveImage.liquid.js";import n from"../../video/components/HTML5Embed.liquid.js";import{getContainerStyle as p,getOverlayStyle as u,getRowStyle as c,getAdaptiveStyle as f,getBackgroundStyle as y,getContainBackgroundStyle as g,getYoutubeIframeStyle as v,getHtml5VideoStyle as j}from"../common/styles.js";import{getContainerClasses as $,getOverlayClasses as b,getRowClasses as h,getAdaptivePictureClasses as C,getAdaptiveClasses as I,getBackgroundClasses as w,getContainBackgroundClasses as T,getHtml5VideoClasses as k,getWrapperYoutubeClasses as x,getIframeYoutubeClasses as N,getLazyBackgroundClasses as q}from"../common/classes.js";import{getAspectRatio as L,getYoutubeAspectRatio as z,getBackgroundImageHeroBanner as H,getWidth as A,horizontalAlign as V,getEnableBgImageByDevice as B,getBgImage as E,showVideoType as R,getResponsiveSetting as S,fallbackImg as D}from"../common/helpers.js";import{getImageSrc as M}from"../../image/common/helpers.js";import O from"../../image/components/NextImage.liquid.js";import U from"../../video/components/LiteYouTubeEmbed.liquid.js";import{getYoutubeVideoId as W,youtubeVideoRegex as Y}from"../../video/common/helpers.js";import{isRenderHtmlVideo as F}from"../../grid/components/row/common/helpers.js";import{PRIORITY_LOAD_ATTRS as G}from"../../image/constants.js";import{getSeoTranslated as J}from"../../helpers.js";let K=K=>{let{translatedBackground:P,setting:Q,styles:X,children:Z,builderProps:_,rawChildren:ee,pageContext:et}=K,{layout:eo,verticalAlign:es,enableParallax:ei,alt:el,title:ea,preload:er,isYoutubeVideoMigrated:em}=Q??{},{background:ed,overlayColor:en,verticalGutter:ep,sizeSetting:eu,contentWidth:ec,hoverEffect:ef,contentPosition1Col:ey,contentPosition2Col:eg,videoObjectFit:ev}=X??{},ej=!er&&(et?.enableLazyLoadImage??!0),e$=L(eu,ed),eb=z(ed,ev,e$),eh=S(P||{}),eC=eh.desktop,eI=a({...p(X)}),ew=r({...$(Q,X)}),eT=a({...u(X)}),ek=r({...b(X)}),ex=a({...c(X)}),eN=r({...h(X,Q)}),eq=a({...f(X)}),eL=r({...C()}),ez=r({...I()}),eH=r({...w(ef,ej)}),eA=a({...H(P,ej,!1),...y(X,ei,"")}),eV=r({...T()}),eB=a({...g(X)}),eE=r({...k(!1)}),eR=a({...v(eb,ev)}),eS=r({...x(em)}),eD=a({...j(e$,ev,ed)}),eM=r({...N()}),eO=e=>r({...q(e)});return e`
  <div class="${ew}" style="${eI}">
      <div
        class="${eV}"
        style="${eB}"
      >
        <div class="${eH}" style="${eA}">
          ${(()=>{if(!er)return o.map(e=>m(B(e,P),O({src:M(s(E(P),e),e),alt:J({valueTranslate:el,uid:_?.uid,settingId:"alt",pageContext:et??{}}),title:J({valueTranslate:ea,uid:_?.uid,settingId:"title",pageContext:et??{}}),className:eO(e),isDisableAspectStyle:!0,pageContext:et}))).join("")})()}
          ${(()=>{if(!R(ed))return;if(F(ed))return n({uid:_?.uid,muted:!0,loop:eC?.loop,controls:!1,autoplay:!0,src:eC?.videoHtml5||"",title:"Video",style:eD,className:eE,pageContext:et});let e=eC?.video??"",t=W(e),o=`&loop=false&playlist=${t}&showinfo=0&rel=0&fs=0&enablejsapi=1`,s=i(e);if(eC?.type==="video"&&eC?.videoType==="youtube"&&t&&Y.test(e)||s)return U({uid:_?.uid,id:t??"",translatedVideoUrl:s?e:"",isHeroBanner:!0,autoplay:!0,title:"Video",controls:!1,params:o,adNetwork:!1,noCookie:!0,muted:!0,lazy:eC?.lazyLoad??!0,style:eR,wrapperClass:eS,iframeClass:eM,pageContext:et})})()}
        </div>
        ${m(!!en,e`<div aria-label="Overlay" class="${ek}" style="${eT}"> </div>`)}
      </div>
      ${l({className:eN,style:ex,setting:{layout:eo,horizontalAlign:V(eo,ey,eg),verticalAlign:es},styles:{verticalGutter:ep,width:A(ec),fullWidth:{desktop:!1,tablet:!1,mobile:!1}},children:Z,rawChildren:ee})}
        ${d({pictureClass:eL,srcSet:E(P),className:ez,...er&&G,aspectRatio:t(eu),style:eq,alt:J({valueTranslate:el,uid:_?.uid,settingId:"alt",pageContext:et??{}}),title:J({valueTranslate:ea,uid:_?.uid,settingId:"title",pageContext:et??{}}),pageContext:et,fallbackImg:D})}
  </div>
`};export{K as default};
