"use strict";var core=require("@gem-sdk/core"),React=require("react");const useFilterImagesByVariant=({productImages:e,displayByVariant:t,variantSelect:r})=>{let a=core.useCurrentVariant(),s=React.useCallback(()=>{let e=a?.selectedOptions??[],t=e.find(e=>e.name===r);return t?.value?.toLowerCase()??""},[a?.selectedOptions,r]),l=React.useMemo(()=>{if(!t||!r||!e)return e;let a=s();if(!a)return e;let l=e.filter(e=>{let t=(e.alt||"").toLowerCase();return t.includes(a)});return l.length>0?l:e},[t,r,e,s]);return{filteredProductImages:l,selectedVariantValue:s()}};exports.useFilterImagesByVariant=useFilterImagesByVariant;
