'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),s=require("@gem-sdk/core"),a=require("../../grid/components/row/Row.js"),l=require("@gem-sdk/system"),r=require("../../image/components/AdaptiveImage.js"),o=require("../../video/components/HTML5Embed.js"),i=require("../common/styles.js"),d=require("../common/classes.js"),u=require("../common/helpers.js"),c=require("../../video/components/LiteYouTubeEmbed.js"),n=require("../../video/common/helpers.js"),m=require("../hooks/useHeroBannerItem.js"),y=require("../../video/common/classes.js");exports.default=g=>{s.useEditorMode();let{setting:p,styles:C,children:v,elementRef:b,transform:f,dataVideo:j,bgRef:h,isShowVideoHtml5:S,layoutResponsive:q,heroBannerWrapperRef:k}=g,{layout:x,verticalAlign:B,enableParallax:T,alt:w,title:V}=p??{},{background:H,overlayColor:I,verticalGutter:N,sizeSetting:Y,contentWidth:A,hoverEffect:M,contentPosition1Col:R,contentPosition2Col:z,videoObjectFit:E}=C??{},O=l.createStyle({...i.getContainerStyle(C)}),L=l.createClass({...d.getContainerClasses(p,C)}),P=l.createStyle({...i.getOverlayStyle(C)}),W=l.createClass({...d.getOverlayClasses(C)}),$=l.createStyle({...i.getRowStyle(C)}),_=l.createClass({...d.getRowClasses(C,p)}),G=l.createStyle({...i.getAdaptiveStyle(C)}),D=l.createClass({...d.getAdaptivePictureClasses()}),F=l.createClass({...d.getAdaptiveClasses()}),J=l.createClass({...d.getBackgroundClasses(M,!1)}),K=l.createStyle({...u.getBackgroundImageHeroBanner(H,!1,!0),...i.getBackgroundStyle(C,T,f)}),Q=l.createClass({...d.getContainBackgroundClasses()}),U=l.createStyle({...i.getContainBackgroundStyle(C)}),X=l.createClass({...d.getHtml5VideoClasses(!S)}),{youtubeIframeWrapperRef:Z,resolvedAspectRatio:ee,youtubeAspectRatio:et}=m.default({videoType:j?.videoType,sizeSetting:Y,background:H,videoObjectFit:E,heroBannerWrapperRef:k,isYoutubeVideoMigrated:p?.isYoutubeVideoMigrated}),es=l.createStyle({...i.getYoutubeIframeStyle(et,E)}),ea=l.createStyle({...i.getHtml5VideoStyle(ee,E,H)}),el=l.createClass({...d.getWrapperYoutubeClasses(p?.isYoutubeVideoMigrated)}),er=l.createClass({...d.getIframeYoutubeClasses()}),eo=l.createClass({...y.getYoutubeContentClasses()}),ei=t.useMemo(()=>{if(!u.showVideoType(H))return;if(j?.videoType==="html5"&&!j.videoHtml5||j?.videoType==="youtube"&&!j.video)return null;if(j?.type==="video"&&j?.videoType==="html5"&&j?.videoHtml5)return e.jsx(o.default,{muted:!0,loop:j?.loop,controls:!1,autoplay:!0,src:j?.videoHtml5||"",title:"Video",style:ea,className:X});let t=j?.video??"",s=n.getYoutubeVideoId(t),a=j?.loop?1:0,l=`&loop=${a}&playlist=${s}&showinfo=0&rel=0&fs=0&enablejsapi=1`;if(j?.type==="video"&&j?.videoType==="youtube"&&s&&n.youtubeVideoRegex.test(t))return e.jsx("div",{className:eo,ref:Z,children:e.jsx(c.default,{id:s,isHeroBanner:!0,autoplay:!0,title:"Video",controls:!1,params:l,adNetwork:!1,noCookie:!0,muted:!0,lazy:j?.lazyLoad??!0,style:es,wrapperClass:el,iframeClass:er})})},[j,H,X,er,el,es,ea,Z]);return e.jsxs("div",{className:L,style:O,children:[e.jsxs("div",{ref:b,className:Q,style:U,children:[e.jsx("div",{ref:h,className:J,style:K,children:ei}),!!I&&e.jsx("div",{"aria-label":"Overlay",className:W,style:P})]}),e.jsx(a.default,{className:_,style:$,setting:{layout:x,horizontalAlign:u.horizontalAlign(x,R,z),verticalAlign:B},styles:{verticalGutter:N,width:u.getWidth(A),fullWidth:{desktop:!1,tablet:!1,mobile:!1}},hiddenEmptyCol:q?.cols?.length===1,onBlur:e=>u.scrollToContentBanner(e),children:s.filterToolbarPreview(v)}),e.jsx(r.default,{pictureClass:D,srcSet:u.getBgImage(H),className:F,aspectRatio:s.getAspectRatioGlobalSize(Y),style:G,alt:w,title:V,fallbackImg:u.fallbackImg})]})};
