"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),t=require("../common/helpers.js"),a=require("@gem-sdk/system"),l=require("../common/attrs.js"),i=require("../common/styles.js"),s=require("../common/classes.js"),r=require("./HTML5Embed.liquid.js"),o=require("./LiteVimeoEmbed.liquid.js"),d=require("./LiteYouTubeEmbed.liquid.js"),u=require("../../image/components/NextImage.liquid.js"),m=require("../../image/common/helpers.js");exports.default=({className:c,setting:n,style:g,builderAttrs:y,builderProps:p,advanced:b,pageContext:V})=>{let q=t.getSettingTranslatedVideoAndThumbnail({setting:n,uid:p?.uid,pageContext:V??{}}),{youtubeUrl:f="",vimeoUrl:S="",html5Url:k,autoplay:h=!1,loopVideo:I=!1,controls:j=!1,mute:v,poster:C,startTime:T,endTime:$,lazy:L,type:x}=q??{},{youtubeUrlTranslated:R,vimeoUrlTranslated:F}=q,N=m.getImageSrc(C),{cssClass:U}=b??{},A=t.getAspectRatioSettings(q?.ratioOptions,q?.aspectRatio),z=a.createAttr({...l.getAttr({uid:p?.uid||""})}),E=a.createStyle({...i.getStyle(q,g)}),Y=a.createStyle({...i.getYoutubeStyle(A)}),w=a.createStyle({...i.getVimeoStyle(A)}),H=a.createStyle({...i.getHtml5Style(A)}),M=a.createStyle({...i.getFallBackImageStyle(n?.aspectRatio)}),O=a.createClass({...s.getFallbackImageClasses()}),P=a.createClass({...s.getClasses({className:c,builderProps:p,isInstantLP:!1,advancedCssClass:U})});return e.template`
    <div
      ${{...y}} ${{...z}} class="${P}" style="${E}">
      ${(()=>{switch(x){case"youtube":{let a=t.getYoutubeVideoId(f),l=e.hasTranslatedLiquid(R);if((!t.youtubeVideoRegex.test(f)||!a)&&!l)return u.default({src:t.fallbackImageVideoUrl,alt:"Fallback video",className:O,style:M});let i="";return I&&(i+=`&loop=1&playlist=${a}`),T&&(i+=`&start=${t.parseTimeVideo(T)}`),$&&(i+=`&end=${t.parseTimeVideo($)}`),d.default({uid:p?.uid,id:a??"",translatedVideoUrl:l?R:"",autoplay:h,title:"Video",controls:j,params:i,adNetwork:!1,noCookie:!0,muted:!v,thumbnail:N,lazy:L??!0,poster:C,style:Y,pageContext:V})}case"vimeo":{let a=t.getVimeoVideoId(S),l=e.hasTranslatedLiquid(F);if((!t.vimeoVideoRegex.test(S)||!a)&&!l)return u.default({src:t.fallbackImageVideoUrl,alt:"Fallback video",className:O,style:M});return o.default({muted:!v,loop:I,controls:j,thumbnail:N,thumbnailLink:C?.src,autoplay:h,lazy:L??!0,id:a??"",translatedVideoUrl:l?F:"",title:"Video",aspectRatio:A,poster:C,vimeoStyleIframe:w,pageContext:V})}case"html5":if(!k)return u.default({src:t.fallbackImageVideoUrl,alt:"Fallback video",className:O,style:M});return r.default({uid:p?.uid,muted:!v,loop:I,controls:j,autoplay:h,src:k,thumbnail:N,title:"Video",poster:C,lazy:L??!0,isVideoComponent:!0,style:H,pageContext:V})}})()}
    </div>
  `};
