import{useCurrentVariant as e}from"@gem-sdk/core";import{useCallback as t,useMemo as r}from"react";let useFilterImagesByVariant=({productImages:l,displayByVariant:a,variantSelect:n})=>{let i=e(),s=t(()=>{let e=i?.selectedOptions??[],t=e.find(e=>e.name===n);return t?.value?.toLowerCase()??""},[i?.selectedOptions,n]),o=r(()=>{if(!a||!n||!l)return l;let e=s();if(!e)return l;let t=l.filter(t=>{let r=(t.alt||"").toLowerCase();return r.includes(e)});return t.length>0?t:l},[a,n,l,s]);return{filteredProductImages:o,selectedVariantValue:s()}};export{useFilterImagesByVariant};
