import{getResponsiveValueByScreen as e,makeAspectRatio as t,DEVICES as i,makeStyleResponsive as o,removeNullUndefined as r}from"@gem-sdk/core";let l=e=>{let t=e?.desktop,i=e?.tablet===void 0?t:e?.tablet,o=e?.mobile===void 0?i:e?.mobile;return{desktop:t,tablet:i,mobile:o}},a=(e,t)=>{if(!e)return t;if("number"==typeof e)return e;let i=e.replaceAll("px","").replaceAll("%","").replaceAll("rem","").replaceAll("em","");return isNaN(Number(i))?t:Number(i)},n=e=>{if(!e)return{desktop:5};let t=a(e.desktop,5),i=a(e.tablet,t),o=a(e.mobile,i);return{desktop:t,tablet:i,mobile:o}},s=(e,t)=>{let i={};return["desktop","mobile","tablet"].forEach(o=>{i={...i,[`--d${"desktop"===o?"":`-${o}`}`]:`${e(o)?"none":t}`}}),i},d=e=>{let t=e?.["--radius"],i=e?.["--bblr"]||"0px",o=e?.["--bbrr"]||"0px",r=e?.["--btlr"]||"0px",l=e?.["--btrr"]||"0px";return t&&!t.toString().includes("none")&&"0"!==t.toString()||"0px"!==i||"0px"!==o||"0px"!==r||"0px"!==l},u=i=>{let o={};return["desktop","mobile","tablet"].forEach(t=>{let r=e(i,t)?.shapeValue;if(r)o={...o,[t]:r};else{let r=e(i,t)?.shape;switch(r){case"square":o={...o,[t]:"1/1"};break;case"vertical":o={...o,[t]:"3/4"};break;case"horizontal":o={...o,[t]:"4/3"};break;case"original":o={...o,[t]:""}}}}),t(o)},b=t=>{let o={"--gtc":"minmax(0, 12fr)","--gtc-tablet":"minmax(0, 12fr)","--gtc-mobile":"minmax(0, 12fr)"};if(!t.isHiddenGalleryImages){let r=!1;i.forEach(i=>{let l=e(t.position,i),a=e(t.ratioLayout,i),n=e(t.ratioLayoutRight,i),s="desktop"===i?"--gtc":`--gtc-${i}`,d="desktop"===i?"--gtr":`--gtr-${i}`,u="left"===l?a:n,b=["left","right"].includes(l||"");b&&u?(r=!0,Object.assign(o={...o,[s]:`minmax(0, ${u[0]}fr) minmax(0, ${u[1]}fr)`},{[d]:"fit-content(0)"})):r&&Object.assign(o,{[d]:"unset"})})}return o},c=t=>{let i={"--o":"0","--o-tablet":"0","--o-mobile":"0"};return["desktop","mobile","tablet"].forEach(o=>{let r=e(t.position,o),l="desktop"===o?"--o":`--o-${o}`;i={...i,[l]:"left"===r?"1":"0"}}),i},m=t=>{let i={"--o":"1","--o-tablet":"1","--o-mobile":"1"};return["desktop","mobile","tablet"].forEach(o=>{let r=e(t.position,o),l="desktop"===o?"--o":`--o-${o}`;i={...i,[l]:"left"===r?"0":"1"}}),i},p=e=>`{{${e} | image_url: width: 480}} 480w, {{${e} | image_url: width: 768}} 768w, {{${e} | image_url: width: 1024}} 1024w, {{${e} | image_url: width: 1440}} 1440w`,g=e=>{let t=parseInt(e)?`${2*parseInt(e)}px`:`${e} * 2`;return t},f=(t,i,l)=>{let a={},n={},s={},d={},u={},b={};return["desktop","mobile","tablet"].forEach(o=>{let r=e(t,o),c=e(i,o)?.width,m=e(l,o);if(a={...a,[o]:["inside-bottom","inside-left","inside-right"].includes(r)?"absolute":"static"},["inside-bottom"].includes(r)){let e=g(m);c=`calc(100% - ${e})`}["bottom-center","two-col","one-col"].includes(r)&&(c="100%"),s={...s,[o]:"inside-bottom"===r?`${m}`:"auto"},d={...d,[o]:["inside-left","inside-right"].includes(r)?`${m}`:"auto"},b={...b,[o]:["inside-bottom","inside-left"].includes(r)?`${m}`:"auto"},u={...u,[o]:"inside-right"===r?`${m}`:"auto"},n={...n,[o]:c}}),{...o("pos",a),...o("w",r(n)),...o("bottom",r(s)),...o("top",r(d)),...o("left",r(b)),...o("right",r(u))}},h=(t,i)=>{let o=!0,r=!1;return["desktop","mobile","tablet"].forEach(l=>{let a=e(t,l),n=e(i,l);a&&"only-feature"!==a&&(o=!1),(["two-col","one-col"].includes(a)||"images"===n)&&(r=!0)}),{isOnlyFeatureAllDevices:o,isRenderGalleryGrid:r}},k=e=>({...e,setting:{...e.setting}}),$=e=>{let t=e.match(/\d+/g);return t?t[0]:e},y=t=>{let i=u(t),o={desktop:"auto",mobile:"auto",tablet:"auto"};return["desktop","mobile","tablet"].forEach(r=>{let l=e(t,r),a=l?.height,n=l?.width||"",s=$(a||""),d=n.toString().match(/px/g)?$(n):n;if(a&&n&&!isNaN(Number(s))&&!isNaN(Number(d))){o={...o,[r]:`${Number(s)/Number(d)*100}%`};return}if(a&&!isNaN(Number(s))){o={...o,[r]:a};return}let u=i?.[r]!=="auto"&&i?.[r]?i?.[r]?.split("/").reverse().join("/"):"{%if largestRatio == 0%} 100 / 100 {%else%} {{largestRatio}} {%endif%}";o={...o,[r]:`calc((${u})*100%)`}}),o};export{d as checkAddOverFlowClass,n as convertSpacing,g as convertSpacingForIndisdeLayout,a as convertUnitToNumber,u as getAspectRatio,h as getConditionRenderGalleryImages,s as getDisplayStyle,y as getPaddingBottomByShapeSetting,p as getSrcImage,b as getStyleGridLayout,c as getStyleGridOrderForFeature,m as getStyleGridOrderForGallery,f as getStyleInsideLayout,l as getTypeWidthDevice,k as setDefaultWhenUndefineSetting};
