"use strict";var e=require("@gem-sdk/core"),t=require("./common.js");const c=e=>e?.includes("px")?e:`${e}px`,i=e=>["auto","Auto",void 0].includes(e)?"0px":c(`${e}`),a=e=>{let{device:c,position:i,leftGap:a,rightGap:o}=e,r=t.getDeviceSpecificStyle(e?.imageShape,c)?.width||"100%",l=t.getDeviceSpecificStyle(e?.imageAlign,c);switch(i){case"left":return"flex-end"===l?`calc((100% - ${r}) + ${a})`:"center"===l?`calc((100% - ${r}) / 2 + ${a})`:a;case"center":return"flex-end"===l?`calc((200% - ${r}) / 2 + ${a})`:"center"===l?"50%":`calc(${r} / 2 + ${a})`;case"right":return"flex-start"===l?`calc((100% - ${r}) + ${o})`:"center"===l?`calc((100% - ${r}) / 2 + ${o})`:o}},o=e=>{let{position:t,leftGap:c,rightGap:i}=e;switch(t){case"left":return c;case"center":return"50%";case"right":return i}},r=e=>{let{device:c,imageLayout:i}=e,r=t.getDeviceSpecificStyle(i,c);return"only-feature"===r?a(e):o(e)},l=(e,t,c)=>r(e),s=e=>{let{device:c,bottomGap:i,dotSize:a,dotGapToCarousel:o,key:r,dotStyle:l,imageLayout:s}=e,$=t.getDeviceSpecificStyle(l,c),n=t.getDeviceSpecificStyle(s,c);return"none"!==$&&"only-feature"===n?{[`--bottom${r}`]:`calc(${a?.[c]||a?.desktop||0}px + ${o?.[e.device]||o?.desktop||0}px + ${i})`}:{[`--bottom${r}`]:i}};exports.getGapBottom=s,exports.getGapCompareProductImage=r,exports.getShapePosition=c=>{let{positionType:a,navigationPosition:o,dataImage:r}=c;return e.DEVICES.reduce((e,c)=>{let $="desktop"===c?"":`-${c}`,n=t.getDeviceSpecificStyle(a,c)?.placement||"",p=i(t.getDeviceSpecificStyle(a,c)?.topGap),u=i(t.getDeviceSpecificStyle(a,c)?.rightGap),g=i(t.getDeviceSpecificStyle(a,c)?.bottomGap),f=i(t.getDeviceSpecificStyle(a,c)?.leftGap);o?.[c]!=="outside"||["bottom","top"].includes(n)||(u=`calc(${u} + 56px)`,f=`calc(${f} + 56px)`);let m=e=>({position:e,device:c,imageLayout:r?.imageLayout,imageAlign:r?.imageAlign,imageShape:r?.imageShape,leftGap:f,rightGap:u}),S={device:c,bottomGap:g,key:$,dotSize:r?.dotSize,dotGapToCarousel:r?.dotGapToCarousel,dotStyle:r?.dotStyle,imageLayout:r?.imageLayout},h={};switch(n){case"top-left":h={[`--top${$}`]:p,[`--left${$}`]:l(m("left")),[`--right${$}`]:"unset",[`--bottom${$}`]:"unset",[`--t${$}`]:"unset"};break;case"top":h={[`--top${$}`]:p,[`--left${$}`]:l(m("center")),[`--right${$}`]:"unset",[`--bottom${$}`]:"unset",[`--t${$}`]:"translateX(-50%)"};break;case"top-right":h={[`--top${$}`]:p,[`--right${$}`]:l(m("right")),[`--left${$}`]:"unset",[`--bottom${$}`]:"unset",[`--t${$}`]:"unset"};break;case"left":h={[`--top${$}`]:"50%",[`--left${$}`]:l(m("left")),[`--right${$}`]:"unset",[`--bottom${$}`]:"unset",[`--t${$}`]:"translateY(-50%)"};break;case"right":h={[`--top${$}`]:"50%",[`--right${$}`]:l(m("right")),[`--left${$}`]:"unset",[`--bottom${$}`]:"unset",[`--t${$}`]:"translateY(-50%)"};break;case"bottom-left":h={...s(S),[`--left${$}`]:l(m("left")),[`--right${$}`]:"unset",[`--top${$}`]:"unset",[`--t${$}`]:"unset"};break;case"bottom":h={...s(S),[`--left${$}`]:l(m("center")),[`--top${$}`]:"unset",[`--right${$}`]:"unset",[`--t${$}`]:"translateX(-50%)"};break;case"bottom-right":h={...s(S),[`--right${$}`]:l(m("right")),[`--left${$}`]:"unset",[`--top${$}`]:"unset",[`--t${$}`]:"unset"}}return{...e,...h}},{})};
