{"version":3,"file":"FetchPriority.D2jk7WOc.mjs","names":[],"sources":["https:/framerusercontent.com/modules/GuJcnj8rA5fDSd3Fzodg/RQ6WprQEnBn3i7XLIkG7/FetchPriority.js"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";// For Framer Frame/Image nodes that use a background-image prop.\nexport function withFetchPriority(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,background:{...props.background,fetchPriority:\"high\"}});};}// Apply to any hero container that holds <img> elements (e.g. a Slideshow).\n// Mirrors the VideoFetch pattern: injects a <link rel=\"preload\" fetchpriority=\"high\">\n// for every above-fold image and removes lazy-loading from them.\nexport function withLCPImagePriority(Component){return function LCPPriorityWrapper(props){useEffect(()=>{const vh=window.innerHeight;const imgs=Array.from(document.querySelectorAll(\"img\"));for(const img of imgs){const rect=img.getBoundingClientRect();const aboveFold=rect.top<vh&&rect.bottom>0&&rect.width>100;if(!aboveFold)continue;// Boost priority on the element itself\nimg.setAttribute(\"fetchpriority\",\"high\");if(img.loading===\"lazy\")img.loading=\"eager\";// Inject a preload hint so the browser scheduler acts immediately\nconst src=img.currentSrc||img.src;if(src&&!document.querySelector(`link[rel=\"preload\"][href=\"${src}\"]`)){const link=document.createElement(\"link\");link.rel=\"preload\";link.as=\"image\";link.href=src;link.setAttribute(\"fetchpriority\",\"high\");document.head.prepend(link);}}},[]);return /*#__PURE__*/_jsx(Component,{...props});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withFetchPriority\":{\"type\":\"reactHoc\",\"name\":\"withFetchPriority\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withLCPImagePriority\":{\"type\":\"reactHoc\",\"name\":\"withLCPImagePriority\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FetchPriority.map"],"mappings":"gIACA,SAAgB,EAAkB,EAAU,CAAC,MAAO,IAA4B,EAAK,EAAU,CAAC,GAAG,EAAM,WAAW,CAAC,GAAG,EAAM,WAAW,cAAc,MAAM,CAAC,CAAC,CAAI,CAGnK,SAAgB,EAAqB,EAAU,CAAC,OAAO,SAA4B,EAAM,CAEyL,OAFxL,MAAc,CAAC,IAAM,EAAG,EAAO,YAAkB,EAAK,MAAM,KAAK,SAAS,iBAAiB,KAAK,CAAC,EAAE,IAAI,IAAM,KAAO,EAAK,CAAC,IAAM,EAAK,EAAI,sBAAsB,EAA6D,GAAG,EAA9C,EAAK,IAAI,GAAI,EAAK,OAAO,GAAG,EAAK,MAAM,KAAkB,SACpU,EAAI,aAAa,gBAAgB,MAAM,EAAK,EAAI,UAAU,SAAO,EAAI,QAAQ,SAC7E,IAAM,EAAI,EAAI,YAAY,EAAI,IAAI,GAAG,GAAK,CAAC,SAAS,cAAc,6BAA6B,EAAI,GAAG,EAAE,CAAC,IAAM,EAAK,SAAS,cAAc,MAAM,EAAE,EAAK,IAAI,UAAU,EAAK,GAAG,QAAQ,EAAK,KAAK,EAAI,EAAK,aAAa,gBAAgB,MAAM,EAAE,SAAS,KAAK,QAAQ,CAAI,CAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAsB,EAAK,EAAU,CAAC,GAAG,CAAK,CAAC,CAAE,CAAE,qBANlO,IAA6B"}