(()=>{"use strict";const e=window.wc.__experimentalInteractivity,t=t=>(0,e.getContext)(t),{state:o,actions:s}=(0,e.store)("woocommerce/product-gallery");let r=!1;const n={state:{get styles(){const{styles:e}=t();return Object.entries(null!=e?e:[]).reduce(((e,[t,o])=>{const s=`${t}:${o};`;return e.length>0?`${e} ${s}`:s}),"")}},actions:{startZoom:e=>{if(!e.target.classList.contains("wc-block-woocommerce-product-gallery-large-image__image"))return s.resetZoom();const o=e.target,r=e.offsetX/o.clientWidth*100,n=e.offsetY/o.clientHeight*100,{styles:c}=t();c&&(c.transform="scale(1.3)",c["transform-origin"]=`${r}% ${n}%`)},resetZoom:()=>{const e=t();e.styles&&(e.styles.transform="scale(1.0)",e.styles["transform-origin"]="")}},callbacks:{scrollInto:()=>{if(!o.isSelected)return;const{isDialogOpen:s}=t(),{ref:n}=(0,e.getElement)();s===r&&n.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"}),s&&s!==r&&n.closest("dialog")&&(n.scrollIntoView({behavior:"instant",block:"nearest",inline:"center"}),r=s),s||s===r||(n.scrollIntoView({behavior:"instant",block:"nearest",inline:"center"}),r=s)}}};(0,e.store)("woocommerce/product-gallery",n)})();