"use strict";var core=require("@gem-sdk/core");const getAspectRatioSettings=(e,t)=>{let o={desktop:e?.desktop?.width,tablet:e?.tablet?.width,mobile:e?.mobile?.width},s={desktop:e?.desktop?.height,tablet:e?.tablet?.height,mobile:e?.mobile?.height},i={desktop:t?.desktop==="custom"?`${core.getResponsiveValueByScreen(o,"desktop")}/${core.getResponsiveValueByScreen(s,"desktop")}`:t?.desktop==="cover"?"unset":t?.desktop,tablet:t?.tablet==="custom"?`${core.getResponsiveValueByScreen(o,"tablet")}/${core.getResponsiveValueByScreen(s,"tablet")}`:t?.tablet==="cover"?"unset":t?.tablet,mobile:t?.mobile==="custom"?`${core.getResponsiveValueByScreen(o,"mobile")}/${core.getResponsiveValueByScreen(s,"mobile")}`:t?.mobile==="cover"?"unset":t?.mobile};return i},getYoutubeParams=e=>{let{id:t,params:o,muted:s,webp:i,controls:a,adNetwork:r,autoplay:p,lazy:l}=e,m=encodeURIComponent(t),d="hqdefault",u=`${o}`||"",b=s?"&mute=1":"",n=i?"webp":"jpg",c=i?"vi_webp":"vi",g=e.thumbnail||`https://i.ytimg.com/${c}/${m}/${d}.${n}`,v=e.noCookie?"https://www.youtube-nocookie.com":"https://www.youtube.com",V=`${v}/embed/${m}?autoplay=${!!l||p}&state=1${b}${u}&controls=${a?1:0}`,h=r||!1;return{videoId:m,posterImp:d,paramsImp:u,mutedImp:b,format:n,vi:c,posterUrl:g,ytUrl:v,iframeSrc:V,adNetworkImp:h}},getVimeoParams=e=>{let{id:t,autoplay:o,muted:s,controls:i,loop:a,lazy:r}=e,p=encodeURIComponent(t),l=`?&autoplay=${r?1:o?1:0}&muted=${s?1:0}&loop=${a?1:0}&controls=${i}&autopause=false`,m=`https://player.vimeo.com/video/${p}${l}`;return{videoId:p,params:l,iframeSrc:m}},makeStyleResponsiveRatio=(e,t)=>({[`--${e}`]:t?.desktop,[`--${e}-tablet`]:t?.tablet,[`--${e}-mobile`]:t?.mobile}),fallbackImageVideoUrl="https://cdn.shopify.com/s/files/1/0703/5214/2562/files/gempages_518090459516502570-3d3a4631-1d7d-4a2f-9ef0-9bbe7220e02d.jpg",youtubeVideoRegex=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=|shorts\/)|youtu\.be\/)([^"&?/\s]{11})/i,vimeoVideoRegex=/^(?:http:\/\/|https:\/\/)vimeo\.com\/[\w/]+(?:\?.*)?$/im,getYoutubeVideoId=e=>{let t=e.match(youtubeVideoRegex);return t?.[1]??void 0},getVimeoVideoId=e=>{let t=/https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|album\/(\d+)\/video\/|video\/)?(\d+)(?:$|\/|\?)/,o=e.match(t);return o?.[3]},parseTimeVideo=e=>{let t=e.split(":",2);return t.length<=1?parseInt(t[0]||"0"):60*parseInt(t[0]||"0")+parseInt(t[1]||"0")},covertStrParamsToObj=e=>{let t=e.split("&");return t.shift(),t.reduce((e,t)=>{let[o,s]=t.split("=");return"loop"!==o?{...e,[o]:s}:e},{})},isSettingLoop=e=>e.includes("loop=1");exports.covertStrParamsToObj=covertStrParamsToObj,exports.fallbackImageVideoUrl="https://cdn.shopify.com/s/files/1/0703/5214/2562/files/gempages_518090459516502570-3d3a4631-1d7d-4a2f-9ef0-9bbe7220e02d.jpg",exports.getAspectRatioSettings=getAspectRatioSettings,exports.getVimeoParams=getVimeoParams,exports.getVimeoVideoId=getVimeoVideoId,exports.getYoutubeParams=getYoutubeParams,exports.getYoutubeVideoId=getYoutubeVideoId,exports.isSettingLoop=isSettingLoop,exports.makeStyleResponsiveRatio=makeStyleResponsiveRatio,exports.parseTimeVideo=parseTimeVideo,exports.vimeoVideoRegex=vimeoVideoRegex,exports.youtubeVideoRegex=youtubeVideoRegex;
