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