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