import{useCurrentDevice as e,getResponsiveValueByScreen as r}from"@gem-sdk/core";import{useRef as t,useState as o,useEffect as i}from"react";import{getTypeWidthDevice as n}from"../common/common.js";let l=l=>{let{setting:u,styles:m}=l,s={...u,...m},c=e(),f=t(null),a=t(null),[d,g]=o(""),[p,h]=o(100),[H,b]=o(),v=r(s?.position,c),y="slider"===n(s?.type)[c]||["left","right","inside-left","inside-right"].includes(v);return i(()=>{let e=a?.current;if(!e)return;let r=new ResizeObserver(()=>{h(e.offsetHeight||200)});return r.observe(e),()=>{r.disconnect()}}),{isShowCarousel:y,featureImageHeight:p,featureWrapperImage:a,onClickFeatureArrow:d,activeIndexFromFeatureImage:H,setOnClickFeatureArrow:g,onHandleLoadedFeatureImage:(e,r=200)=>{e&&(f.current&&clearTimeout(f.current),f.current=setTimeout(()=>h(a?.current?.offsetHeight||200),r))},setActiveIndexFromFeatureImage:b}};export{l as useFeatureImageWithGallery};
