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