"use strict";var constant=require("../../constant.js"),helpers=require("./helpers.js"),system=require("@gem-sdk/system"),helpers$1=require("../../helpers.js"),constants=require("../constants.js");const getContainerAttrs=(e,t)=>({...e,...t&&{"data-id":t}}),getLinkWrapperAttrs=({urlData:e,imageLink:t,title:r,isLiquid:s=!1})=>{let a=s?{...e,...t?.noFollow&&{rel:"nofollow"},title:r}:{setting:e,title:r};return t?.type!=="go-to-sales-page"?t?.link?a:{}:s?{href:constant.HREF_TO_SALES_PAGE,target:"_self"}:{setting:{href:constant.HREF_TO_SALES_PAGE,target:"_self"}}},getImageLiquidAttrs=({pageContext:e,enableLazyLoadImage:t=!1})=>({...e&&{pageContext:e},...t&&{enableLazyLoadImage:t}}),getAdaptiveImageAttrs=({styles:e,setting:t,mode:r,isLiquid:s})=>{let{alt:a,srcSet:i,priority:l,qualityPercent:g,qualityType:p,title:n}=t??{},o=helpers.getAspectRatio({styles:e,setting:t}),c=()=>{helpers$1.handleClickLink(t?.imageLink,r)},A=i?.desktop?.backupFileKey?helpers.getNewBackupFileKey(i?.desktop?.backupFileKey??"",i?.desktop?.src??""):"",u=s?helpers.getImageSrc({src:i?.desktop?.src,backupFileKey:A,backupFilePath:i?.desktop?.backupFilePath,storage:i?.desktop?.storage}):i?.desktop?.src??"",h=l?{}:{"base-src":u??"","quality-type":helpers.safeStringify(p),"quality-percent":helpers.safeStringify(g)};return{pictureClass:"gp-contents",...a&&{alt:a},...n&&{title:n},...i&&{srcSet:i},...l&&constants.PRIORITY_LOAD_ATTRS,...h,...e?.objectFit&&{layout:e.objectFit},onClick:c,aspectRatio:o}},getNextImageAttrs=({styles:e,setting:t})=>{let{objectFit:r}=e??{},{vw:s,alt:a,title:i,quality:l,priority:g,isNotLazyload:p,qualityType:n,qualityPercent:o}=t??{},c=helpers.getAspectRatio({styles:e,setting:t});return{...t?.image,...s&&{vw:s},...a&&{alt:a},...i&&{title:i},...l&&{quality:l},...g&&{priority:g},isNotLazyload:p,setting:{aspectRatio:c,layout:r,qualityType:n,qualityPercent:o}}},getNextImageLiquidAttrs=e=>{let{srcset:t,setting:r,storage:s,baseSrc:a,priority:i,customAttrs:l,width:g=2237,height:p=1678,isNotLazyload:n,backupFileKey:o,backupFilePath:c,srcIsLiquidCode:A,enableLazyLoadImage:u,alt:h=helpers.NEXT_IMAGE_CONFIG.DEFAULT_ALT,title:I,src:E=helpers.NEXT_IMAGE_CONFIG.DEFAULT_SRC,sizes:_=helpers.NEXT_IMAGE_CONFIG.DEFAULT_SIZES}=e,y=!n&&u&&!i,d=()=>{let e=o?helpers.getNewBackupFileKey(o??"",E):"",r=A?a:helpers.getImageSrc({src:E,backupFileKey:e,backupFilePath:c,storage:s}),l=A?E:helpers.getSrcSet(e??"",s??"THEME",E),n={sizes:"100vw",src:helpers.createBlurDataURL(g,p),...r&&!i?{"base-src":r}:{},...r?{"data-src":r}:{},...l?{"data-srcset":l}:{}},u={sizes:_,src:r??"",isNotLazyload:"true",srcset:t??"",...r&&!i?{"base-src":r}:{},...i?{loading:"eager",fetchpriority:"high"}:{loading:"lazy"}};return{"data-sizes":"auto",...y?n:u}},L=()=>{let{qualityPercent:e,qualityType:t}=r??{},s=!i&&t&&e?{"quality-type":helpers.safeStringify(t),"quality-percent":helpers.safeStringify(e)}:{"quality-type":"","quality-percent":""};return{...h&&{alt:h},...I&&{title:I},width:g,height:p,draggable:"false",...s}};return system.createAttr({...l,...L(),...d()})},getNextImageReactAttrs=e=>{let{width:t=helpers.NEXT_IMAGE_CONFIG.DEFAULT_WIDTH_PROPS,height:r=helpers.NEXT_IMAGE_CONFIG.DEFAULT_HEIGHT_PROPS,quality:s,priority:a,isNotLazyload:i,enableLazyLoadImage:l,base64:g=helpers.IMAGE_PLACEHOLDER,alt:p=helpers.NEXT_IMAGE_CONFIG.DEFAULT_ALT,title:n,src:o=helpers.NEXT_IMAGE_CONFIG.DEFAULT_SRC}=e,c=!i&&l&&!a,A=()=>{let e={loading:"lazy",placeholder:"blur",...g&&{blurDataURL:g}},t={loading:"eager",fetchpriority:"high"};return{...c?e:t}},u=()=>({src:o,alt:p,title:n,width:t,height:r,quality:s}),h=u(),I=system.createAttr(A());return{...h,...I}};exports.getAdaptiveImageAttrs=getAdaptiveImageAttrs,exports.getContainerAttrs=getContainerAttrs,exports.getImageLiquidAttrs=getImageLiquidAttrs,exports.getLinkWrapperAttrs=getLinkWrapperAttrs,exports.getNextImageAttrs=getNextImageAttrs,exports.getNextImageLiquidAttrs=getNextImageLiquidAttrs,exports.getNextImageReactAttrs=getNextImageReactAttrs;
