"use strict";var e=require("@gem-sdk/core");exports.useVariantInteraction=t=>{let{element:n,uid:r}=t,{trigger:i}=e.useInteraction(),a=(e,t)=>{n.current&&(i({event:"gp:rollback:item-selected",selector:`[data-id="${r}"]`,element:n.current}),i({event:"gp:item-selected",selector:`[data-id="${r}"]`,data:{selectedOptions:e,inStock:t},element:n.current}))};return{dispatchInteractionChangeOptions:a,dispatchInteractionChangeOptionsInit:(e,t)=>{let n=()=>{a(e,t),window.removeEventListener("gp:flow-actions-loaded",n)};window.interactionLoaded?a(e,t):window.addEventListener("gp:flow-actions-loaded",n)}}};
