{"version":3,"file":"CoverTransition.Bbe0ICT6.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/vEm8ZlJBuv1AvEiX30mG/fgFpbXdnkW0ypQMDBKEo/CoverTransition.js"],"sourcesContent":["// Template by Dee S. (https://dees.lemonsqueezy.com/)\n// Follow https://twitter.com/deespnr\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";export function withTransitionName(Component){const setViewTransitionName=element=>{const imgElements=element.querySelectorAll(\"img\");Array.from(imgElements).forEach(imgElement=>{const imgSrc=imgElement.getAttribute(\"src\");if(imgSrc){const imgSrcCleaned=imgSrc.replace(/[^a-zA-Z]/g,\"\");imgElement.setAttribute(\"style\",`${imgElement.getAttribute(\"style\")}; view-transition-name: ${imgSrcCleaned};`);}});};return props=>{const componentRef=useRef(null);useEffect(()=>{const component=componentRef.current;if(component){setViewTransitionName(component);// Hide view-transition-name after the page is loaded\nsetTimeout(()=>{const imgElements=component.querySelectorAll(\"img\");imgElements.forEach(imgElement=>{imgElement.style.removeProperty(\"view-transition-name\");});},1500);}},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:componentRef});};}export function onClickTransitionName(Component){const handleClick=element=>{const imgElement=element.querySelector(\"img\");if(imgElement){const imgSrc=imgElement.getAttribute(\"src\");if(imgSrc){const imgSrcCleaned=imgSrc.replace(/[^a-zA-Z]/g,\"\");imgElement.setAttribute(\"style\",`${imgElement.getAttribute(\"style\")}; view-transition-name: ${imgSrcCleaned};`);}}};return props=>{const componentRef=useRef(null);useEffect(()=>{const component=componentRef.current;if(component){component.addEventListener(\"click\",()=>handleClick(component));return()=>{component.removeEventListener(\"click\",()=>handleClick(component));};}},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:componentRef});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withTransitionName\":{\"type\":\"reactHoc\",\"name\":\"withTransitionName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"onClickTransitionName\":{\"type\":\"reactHoc\",\"name\":\"onClickTransitionName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CoverTransition.map"],"mappings":"yHAE+E,SAAgB,EAAmB,EAAU,CAAC,IAAM,EAAsB,GAAS,CAAC,IAAM,EAAY,EAAQ,iBAAiB,MAAM,CAAC,MAAM,KAAK,EAAY,CAAC,QAAQ,GAAY,CAAC,IAAM,EAAO,EAAW,aAAa,MAAM,CAAC,GAAG,EAAO,CAAC,IAAM,EAAc,EAAO,QAAQ,aAAa,GAAG,CAAC,EAAW,aAAa,QAAQ,GAAG,EAAW,aAAa,QAAQ,CAAC,0BAA0B,EAAc,GAAG,GAAI,EAAG,MAAO,IAAO,CAAC,IAAM,EAAaA,EAAO,KAAK,CAClW,OADmW,MAAc,CAAC,IAAM,EAAU,EAAa,QAAW,IAAW,EAAsB,EAAU,CACpnB,eAAe,CAAmB,EAAU,iBAAiB,MAAM,CAAa,QAAQ,GAAY,CAAC,EAAW,MAAM,eAAe,uBAAuB,EAAG,EAAG,KAAK,GAAI,EAAE,CAAC,CAAqB,EAAK,EAAU,CAAC,GAAG,EAAM,IAAI,EAAa,CAAC,mBADnM,IAAoC"}