'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),system=require("@gem-sdk/system"),AdaptiveImage=require("./AdaptiveImage.js"),NextImage=require("./NextImage.js"),styles=require("../common/styles.js"),classes=require("../common/classes.js"),attrs=require("../common/attrs.js"),helpers=require("../../helpers.js");const Image=({style:e,styles:s,setting:t,children:a,advanced:r,className:l,builderAttrs:m,builderProps:i,onLoad:c,onClick:y})=>{let{imageLink:n,isAdaptive:g,enableImageLink:u}=t??{},o=core.useEditorMode(),{Wrapper:d,urlData:p}=helpers.getLinkData({defaultWrap:"div",setting:n,enableImageLink:u}),j=system.createStyleReact(styles.getWrapperStyles(s)),x=system.createStyle(styles.getImageStyles(s,i)),I=system.createStyle(styles.getContainerStyles(e,s)),C=system.createClass(classes.getWrapperClasses()),q=system.createClass(classes.getImageClasses(l,s)),A=system.createClass(classes.getContainerClasses(i?.uid,r?.cssClass,s?.shape)),v=system.createAttr(attrs.getContainerAttrs(m,i?.uid)),N=attrs.getLinkWrapperAttrs({urlData:p,imageLink:n,title:t?.title}),f=attrs.getAdaptiveImageAttrs({styles:s,setting:t,mode:o}),h=attrs.getNextImageAttrs({styles:s,setting:t}),R=()=>system.If(g,jsxRuntime.jsx(AdaptiveImage.default,{...f,style:x,className:q}),jsxRuntime.jsx(NextImage.default,{...h,style:x,className:q,onLoad:c}));return jsxRuntime.jsxs("div",{role:"presentation",...v,style:I,className:A,onClick:y,children:[jsxRuntime.jsx(d,{...N,style:j,className:C,children:R()}),a]})};exports.default=Image;
