"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),t=require("../../../helpers.js"),r=require("../../../video/components/HTML5Embed.liquid.js"),s=require("@gem-sdk/system"),a=require("../../../video/common/helpers.js"),o=require("../../../video/components/LiteYouTubeEmbed.liquid.js"),i=require("./common/attrs.js"),l=require("../../settings/configs/row/translate.js"),d=require("./common/classes.js"),n=require("./common/styles.js"),p=require("./common/helpers.js"),u=require("../../../hero-banner/common/helpers.js");exports.default=g=>{let{styles:c,setting:m,rawChildren:$,builderProps:f}=g,{isSection:y}=m??{},{background:k}=c??{},v=y?"section":"div",q=t.getBackgroundTranslated({background:k,uid:f?.uid,enableTranslate:!!l.Row?.background?.id,pageContext:g.pageContext??{}}),{stateData:b}=p.getData(g,q),{rowStyle:j,backgroundBoxStyle:h,embedVideoStyle:R,sectionStyle:C}=n.getRowStyle({rowProps:g,type:"Liquid",translatedBackground:q}),{rowAttr:w}=i.getAttr(g),{rowClass:I,backgroundBoxClass:S,backgroundBoxInnerClass:V,sectionClass:x,wrapperYoutubeClasses:P,iframeYoutubeClasses:E}=d.getClass(g),L=s.createClass({[I]:!0}),T=()=>{if(!p.checkHasBackgroundVideo(k))return;let t=u.getResponsiveSetting(k||{});if(p.isRenderHtmlVideo(k))return r.default({uid:f?.uid,muted:!0,loop:t.desktop?.loop,controls:!1,autoplay:!0,src:"",title:"Video",className:"gp-relative",style:R,pageContext:g.pageContext});if(p.isRenderYoutubeVideo(k)){let r=t?.desktop?.video??"",s=a.getYoutubeVideoId(r)||"",i=e.hasTranslatedLiquid(r),l=`&loop=false&playlist=${s}&showinfo=0&rel=0&fs=0&enablejsapi=1`;return o.default({uid:f?.uid,id:s,autoplay:!0,title:"Video",translatedVideoUrl:i?r:"",controls:!1,params:l,adNetwork:!1,noCookie:!0,muted:!0,lazy:t?.desktop?.lazyLoad??!0,style:R,wrapperClass:P,iframeClass:E,pageContext:g.pageContext})}},A=e.template`
    <gp-row gp-data='${b}' ${{...w}} class="${L}" style="${j()}">
      ${s.If(!!T(),e.template`
          <div class="${S}" style="${h}">
            <div class="${V}">${T()}</div>
          </div>
        `)}

      ${e.WrapRenderChildren({uid:f?.uid||"",customProps:$?.[0].customProps},$?.map(t=>{if(t)return e.RenderChildren({...t,order:m?.order,layout:m?.layout,justifyContent:m?.verticalAlign})}))}

      ${(()=>{if(p.checkHasBackgroundVideo(k))return e.template`
      ${e.RenderIf(e.isLocalEnv,`<script ${t.getSettingPreloadData('class="gps-link" delay',"src")}="{{ 'gp-row-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${t.getSettingPreloadData('class="gps-link" delay',"src")}="${e.baseAssetURL}/assets-v2/gp-row-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
    `})()}
    </gp-row>
  `;return e.template`
    ${e.RenderIf(!!c?.preloadBgImage,`${e.RenderIf(!!k?.desktop?.image?.src,`<link rel="preload" href="${k?.desktop?.image?.src}" as="image" />`)}${e.RenderIf(!!k?.tablet?.image?.src,`<link rel="preload" href="${k?.tablet?.image?.src}" as="image" />`)}${e.RenderIf(!!k?.mobile?.image?.src,`<link rel="preload" href="${k?.mobile?.image?.src}" as="image" />`)}`)}

    ${e.RenderIf(!!y,"{% assign locationOrigin = request.origin | append: routes.root_url | split: '/' | join: '/' %}")}

    ${s.If(y,e.template`
        <${v}
          class="${x} ${y?t.getSettingPreloadData("gps-lazy"):""}"
          style="${C}"
        >
          ${A}
        </${v}>
      `,e.template`${A}`)}
  `};
