(()=>{"use strict";const e=window.wc.__experimentalInteractivity;var o=function(e){return e[e.ESC=27]="ESC",e[e.LEFT_ARROW=37]="LEFT_ARROW",e[e.RIGHT_ARROW=39]="RIGHT_ARROW",e}(o||{});(0,e.store)({state:{},effects:{woocommerce:{keyboardAccess:e=>{const{context:c,actions:m}=e;let t=!0;document.addEventListener("keydown",(i=>{var n;t&&null!==(n=c.woocommerce)&&void 0!==n&&n.isDialogOpen&&(t=!1,requestAnimationFrame((()=>{t=!0})),i.keyCode===o.ESC&&(c.woocommerce.isDialogOpen=!1),i.keyCode===o.LEFT_ARROW&&m.woocommerce.handlePreviousImageButtonClick(e),i.keyCode===o.RIGHT_ARROW&&m.woocommerce.handleNextImageButtonClick(e))}))}}},selectors:{woocommerce:{isSelected:({context:e})=>(null==e?void 0:e.woocommerce.selectedImage)===(null==e?void 0:e.woocommerce.imageId),pagerDotFillOpacity(e){const{context:o}=e;return(null==o?void 0:o.woocommerce.selectedImage)===(null==o?void 0:o.woocommerce.imageId)?1:.2},isDialogOpen:({context:e})=>e.woocommerce.isDialogOpen}},actions:{woocommerce:{thumbnails:{handleClick:({context:e})=>{e.woocommerce.selectedImage=e.woocommerce.imageId}},dialog:{handleCloseButtonClick:({context:e})=>{e.woocommerce.isDialogOpen=!1}},handleSelectImage:({context:e})=>{e.woocommerce.selectedImage=e.woocommerce.imageId},handleNextImageButtonClick:e=>{const{context:o}=e,c=o.woocommerce.visibleImagesIds.indexOf(o.woocommerce.selectedImage),m=Math.min(c+1,o.woocommerce.visibleImagesIds.length-1);o.woocommerce.selectedImage=o.woocommerce.visibleImagesIds[m]},handlePreviousImageButtonClick:e=>{const{context:o}=e,c=o.woocommerce.visibleImagesIds.indexOf(o.woocommerce.selectedImage),m=Math.max(c-1,0);o.woocommerce.selectedImage=o.woocommerce.visibleImagesIds[m]}}}})})();