"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),helpers$1=require("../../../helpers.js"),HTML5Embed_liquid=require("../../../video/components/HTML5Embed.liquid.js"),system=require("@gem-sdk/system"),helpers$2=require("../../../video/common/helpers.js"),LiteYouTubeEmbed_liquid=require("../../../video/components/LiteYouTubeEmbed.liquid.js"),attrs=require("./common/attrs.js"),classes=require("./common/classes.js"),styles=require("./common/styles.js"),helpers=require("./common/helpers.js"),helpers$3=require("../../../hero-banner/common/helpers.js");const Row=e=>{let{styles:r,setting:s,rawChildren:t,builderProps:o}=e,{isSection:l}=s??{},{background:i}=r??{},a=l?"section":"div",{stateData:d}=helpers.getData(e),{rowStyle:p,backgroundBoxStyle:c,embedVideoStyle:n,sectionStyle:u}=styles.getRowStyle(e),{rowAttr:m}=attrs.getAttr(e),{rowClass:g,backgroundBoxClass:$,backgroundBoxInnerClass:f,sectionClass:h,wrapperYoutubeClasses:y,iframeYoutubeClasses:b}=classes.getClass(e),v=system.createClass({[g]:!0}),k=()=>{if(!helpers.checkHasBackgroundVideo(i))return;let e=helpers$3.getResponsiveSetting(i||{});if(helpers.isRenderHtmlVideo(i))return HTML5Embed_liquid.default({uid:o?.uid,muted:!0,loop:e.desktop?.loop,controls:!1,autoplay:!0,src:"",title:"Video",className:"gp-relative",style:n});if(helpers.isRenderYoutubeVideo(i)){let r=e?.desktop?.video??"",s=helpers$2.getYoutubeVideoId(r)||"",t=`&loop=false&playlist=${s}&showinfo=0&rel=0&fs=0&enablejsapi=1`;return LiteYouTubeEmbed_liquid.default({uid:o?.uid,id:s,autoplay:!0,title:"Video",controls:!1,params:t,adNetwork:!1,noCookie:!0,muted:!0,lazy:e?.desktop?.lazyLoad??!0,preload:!0,style:n,wrapperClass:y,iframeClass:b})}},q=()=>{if(helpers.checkHasBackgroundVideo(i))return core.template`
      ${core.RenderIf(core.isLocalEnv,`<script ${helpers$1.getSettingPreloadData('class="gps-link" delay',"src")}="{{ 'gp-row-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${helpers$1.getSettingPreloadData('class="gps-link" delay',"src")}="${core.baseAssetURL}/assets-v2/gp-row-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
    `},R=core.template`
    <gp-row gp-data='${d}' ${{...m}} class="${v}" style="${p()}">
      ${system.If(!!k(),core.template`
          <div class="${$}" style="${c}">
            <div class="${f}">${k()}</div>
          </div>
        `)}

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

      ${q()}
    </gp-row>
  `;return core.template`
    ${core.RenderIf(!!r?.preloadBgImage,`${core.RenderIf(!!i?.desktop?.image?.src,`<link rel="preload" href="${i?.desktop?.image?.src}" as="image" />`)}${core.RenderIf(!!i?.tablet?.image?.src,`<link rel="preload" href="${i?.tablet?.image?.src}" as="image" />`)}${core.RenderIf(!!i?.mobile?.image?.src,`<link rel="preload" href="${i?.mobile?.image?.src}" as="image" />`)}`)}

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

    ${system.If(l,core.template`
        <${a}
          class="${h} ${l?helpers$1.getSettingPreloadData("gps-lazy"):""}"
          style="${u}"
        >
          ${R}
        </${a}>
      `,core.template`${R}`)}
  `};exports.default=Row;
