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