import{getResponsiveValueByScreen as e,cls as t}from"@gem-sdk/core";import{getDisplayStyle as o}from"./common.js";import{convertUnitToNumber as i}from"../../product-images/common/productFeaturedImage.js";let getZoomDisplay=t=>o(o=>!e(t,o),"flex"),HORIZONTAL_LAYOUT=["right","left","inside-left","inside-right"],sizeSettingDefaultForNewLayout={desktop:{shape:"square",shapeValue:"1/1",width:"20%",height:void 0,shapeLinked:!0}},getCarouselVerticalConfigByPosition=t=>{let o=["desktop","mobile","tablet"],i={};return o.forEach(o=>{let a=e(t,o),l=HORIZONTAL_LAYOUT.includes(a);i=l?{...i,[o]:!0}:{...i,[o]:!1}}),i},getMinHeightByPosition=(o,i)=>{let a=["desktop","mobile","tablet"],l=getCarouselVerticalConfigByPosition(o),r={};return a.forEach(t=>{let o=e(i,t),a="desktop"===t?"":`${t}:`;r[`${a}!gp-min-h-0`]=!!l[t]&&"outside"===o,r[`${a}!gp-min-h-full`]=!(l[t]&&"outside"===o)}),t({...r})},getEditorMinHeightClass=(t,o,i)=>{let a=getCarouselVerticalConfigByPosition(o),l=e(i,t);return a[t]&&"outside"===l?"!gp-min-h-0":"!gp-min-h-full"},getAllowDotConfig=()=>({desktop:!0,tablet:!0,mobile:!0}),getDotStyleConfig=()=>({desktop:"none",tablet:"none",mobile:"none"}),getSettingWidthForGridItem=t=>{let o={},i=["desktop","mobile","tablet"];return i.forEach(i=>{let a=e(t.shapeByLayout,i)?.width,l=e(t.itemSpacing,i),r=0;a?.includes("%")&&(r=100/parseInt(a)),o={...o,[i]:r?`calc(${a} - ${l} * ${r-1} / ${r})`:a}}),o},getSettingWidthForCarouselItem=t=>{let o={},i=["desktop","mobile","tablet"];return i.forEach(i=>{let a=e(t.position,i),l="bottom-center"===a,r=e(t.shapeByLayout,i)?.width;o={...o,[i]:l&&r?.includes("px")?r:"100%"}}),o},getSettingMinWidthForCarouselItem=t=>{let o={},a=["desktop","mobile","tablet"];return a.forEach(a=>{let l=e(t.position,a),r=i(e(t.spacing,a),5),s="bottom-center"===l||"inside-bottom"===l,n=e(t.shapeByLayout,a)?.width,g="100%";if(s){let e=100/i(n,20);g=n?.includes("px")?n:n?.includes("%")?`calc(${n} - ${(e-1)*r/e}px)`:"100%"}o={...o,[a]:g}}),o},checkDisplayGalleryByWidth=t=>{let o={desktop:!0,tablet:!0,mobile:!0},i=["desktop","mobile","tablet"];return i.forEach(i=>{let a=e(t.shapeByLayout,i)?.width??"100%",l=0!==parseInt(a);o={...o,[i]:l}}),o},getSliderPerShowConfig=(t,o)=>{let i={desktop:"auto",tablet:"auto",mobile:"auto"},a=["desktop","mobile","tablet"];return a.forEach(a=>{let l=e(o,a),r="bottom-center"===l||"inside-bottom"===l,s=e(t,a)?.width,n="auto";s?.includes("%")&&(n=100>parseInt(s)?100/parseInt(s):"auto"),i={...i,[a]:r?n:"auto"}}),i},getShapeByLayout=(t,o)=>{let i={},a=["desktop","mobile","tablet"];return a.forEach(a=>{let l=e(o,a);switch(l){case"bottom-center":case"bottom-left":i={...i,[a]:e(t.shapeForBottom,a)};break;case"inside-bottom":i={...i,[a]:e(t.shapeForInsideBottom??sizeSettingDefaultForNewLayout,a)};break;case"left":case"right":i={...i,[a]:e(t.shape,a)};break;case"inside-left":case"inside-right":i={...i,[a]:e(t.shapeForInside??sizeSettingDefaultForNewLayout,a)};break;case"only-feature":i={...i,[a]:e(t.shapeForFtOnly,a)};break;case"one-col":i={...i,[a]:e(t.shapeFor1Col,a)};break;case"two-col":i={...i,[a]:e(t.shapeFor2Col,a)}}}),i};export{HORIZONTAL_LAYOUT,checkDisplayGalleryByWidth,getAllowDotConfig,getCarouselVerticalConfigByPosition,getDotStyleConfig,getEditorMinHeightClass,getMinHeightByPosition,getSettingMinWidthForCarouselItem,getSettingWidthForCarouselItem,getSettingWidthForGridItem,getShapeByLayout,getSliderPerShowConfig,getZoomDisplay,sizeSettingDefaultForNewLayout};
