{"version":3,"file":"Scroll_Lock.CZrwSzTq.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/mCQuIJx8j7h0bSuBoxcy/fd8PUx8ko7sDhESYQqiz/BetterPreloader_Prod.js","https:/framerusercontent.com/modules/eTgdGaSCuSKOZjFOy7Hq/WJPcFOVYilExxQgdL5FT/Scroll_Lock.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{cloneElement,useLayoutEffect,useInsertionEffect,useState}from\"react\";import{ControlType,addPropertyControls,RenderTarget}from\"framer\";import React from\"react\";import{ComponentMessage}from\"https://framer.com/m/Utils-FINc.js\";// ------------------------------------------------------------ //\n// PROPERTY CONTROLS\n// ------------------------------------------------------------ //\naddPropertyControls(BetterPreloader,{preloaderContent:{type:ControlType.ComponentInstance,title:\"Content\"},frequency:{type:ControlType.Object,title:\"Frequency\",controls:{showInterval:{type:ControlType.Enum,title:\"Interval\",options:[\"always\",\"minutes\",\"hours\",\"days\"],optionTitles:[\"Always\",\"Every [𝑿] Minutes\",\"Every [𝑿] Hours\",\"Every [𝑿] Days\"],defaultValue:\"always\",displaySegmentedControl:true,segmentedControlDirection:\"vertical\"},intervalValue:{type:ControlType.Number,title:\"𝑿\",defaultValue:1,min:1,max:365,step:1,displayStepper:true,// @ts-expect-error framer types\nhidden:props=>props.showInterval===\"always\"}},description:\"More components at [Framer University](https://frameruni.link/cc).\"}});// ------------------------------------------------------------ //\n// MAIN COMPONENT\n// ------------------------------------------------------------ //\n/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 200\n * @framerDisableUnlink\n */export default function BetterPreloader(props){const hasContent=\"preloaderContent\"in props&&props.preloaderContent&&props.preloaderContent.length>0;const isOnFramerCanvas=RenderTarget.hasRestrictions();const[shouldShowPreloader,setShouldShowPreloader]=useState(props.frequency.showInterval===\"always\"?true:false);// Set parent z-index before any DOM mutations\nuseInsertionEffect(()=>{if(isOnFramerCanvas)return;// Create and inject a style tag for immediate effect\nconst styleTag=document.createElement(\"style\");styleTag.innerHTML=`\n      #framer-better-preloader-wrapper {\n        z-index: 2147483647 !important;\n      }\n      #framer-better-preloader-wrapper > div {\n        z-index: 2147483647 !important;\n      }\n    `;document.head.appendChild(styleTag);return()=>{styleTag.remove();};},[]);// Handle localStorage check before first render\nuseLayoutEffect(()=>{if(isOnFramerCanvas)return;const storageKey=\"framer-university-preloader-timestamp\";const timestamp=localStorage.getItem(storageKey);if(props.frequency.showInterval===\"always\"){// If interval is set to always, always show the preloader\nsetShouldShowPreloader(true);}else{// If showOnce is false and not always, check interval\nif(!timestamp){// First time showing\nsetShouldShowPreloader(true);localStorage.setItem(storageKey,Date.now().toString());}else{// Check if enough time has passed\nconst lastShown=parseInt(timestamp,10);if(hasIntervalPassed(lastShown,props.frequency.intervalValue,props.frequency.showInterval)){setShouldShowPreloader(true);localStorage.setItem(storageKey,Date.now().toString());}else{setShouldShowPreloader(false);}}}},[props.frequency.showInterval,props.frequency.intervalValue]);const clonedContent=props.preloaderContent.map(content=>{return ensureFullSize(content);});if(!hasContent){return /*#__PURE__*/_jsx(ComponentMessage,{title:\"Better Preloader\",subtitle:\"Set up the component by connecting frame to the component or by adding content to the component properties.\"});}// Don't render anything if loading is complete or if we shouldn't show the preloader\nif(isOnFramerCanvas||!shouldShowPreloader){return null;}return /*#__PURE__*/_jsx(\"div\",{id:\"framer-better-preloader-wrapper\",style:{position:\"fixed\",top:0,left:0,width:\"100vw\",height:\"100vh\",zIndex:2147483647},children:clonedContent});}// ------------------------------------------------------------ //\n// HELPER FUNCTIONS\n// ------------------------------------------------------------ //\n// Calculate milliseconds for a given interval\nconst calculateIntervalInMs=(value,unit)=>{const msInMinute=60*1e3;const msInHour=60*msInMinute;const msInDay=24*msInHour;switch(unit){case\"minutes\":return value*msInMinute;case\"hours\":return value*msInHour;case\"days\":return value*msInDay;default:return 0;}};// Check if enough time has passed since last show\nconst hasIntervalPassed=(lastShownTimestamp,intervalValue,intervalUnit)=>{if(intervalUnit===\"always\")return true;const now=Date.now();const intervalInMs=calculateIntervalInMs(intervalValue,intervalUnit);return now-lastShownTimestamp>=intervalInMs;};// Type guard to ensure we're working with a ReactElement\nconst isReactElement=el=>{return el&&typeof el===\"object\"&&\"props\"in el;};// Helper function to ensure full size\nconst ensureFullSize=element=>{if(!isReactElement(element)){return element;}const newProps={// @ts-expect-error framer types\n...element.props,width:\"100%\",height:\"100%\",zIndex:2147483647,style:{// @ts-expect-error framer types\n...element.props?.style||{},width:\"100%\",height:\"100%\",zIndex:2147483647}};// Recursively apply to children\n// @ts-expect-error framer types\nif(element.props?.children){// @ts-expect-error framer types\nnewProps.children=/*#__PURE__*/React.isValidElement(element.props.children)?ensureFullSize(element.props.children):element.props.children;}return /*#__PURE__*/cloneElement(element,newProps);};BetterPreloader.displayName=\"Better Preloader\";\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"BetterPreloader\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"200\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerDisableUnlink\":\"\",\"framerIntrinsicWidth\":\"400\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./BetterPreloader_Prod.map","import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useRef}from\"react\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n * @framerDisableUnlink\n */export default function ScrollLock({enabled,style}){const selfRef=useRef(null);useEffect(()=>{const TAG=\"data-scroll-lock-inject\";document.querySelector(`style[${TAG}]`)?.remove();if(enabled){const el=document.createElement(\"style\");el.setAttribute(TAG,\"\");el.textContent=\"html,body{overflow:hidden!important;touch-action:none!important}\";document.head.appendChild(el);}return()=>{document.querySelector(`style[${TAG}]`)?.remove();};},[enabled]);// Zero-size div — invisible on canvas AND live site\n// but gives Framer a real DOM node to select, drag, and resize\nreturn /*#__PURE__*/_jsx(\"div\",{ref:selfRef,style:{...style,position:\"absolute\",width:0,height:0,pointerEvents:\"none\",overflow:\"hidden\"}});}ScrollLock.displayName=\"Scroll Lock\";addPropertyControls(ScrollLock,{enabled:{type:ControlType.Boolean,title:\"Lock Scroll\",defaultValue:true,enabledTitle:\"Locked\",disabledTitle:\"Normal\",description:\"When **Locked**, the page cannot be scrolled. \\n\\nMade with ❤️ by [Soyeb](https://framer.link/project)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollLock\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"\",\"framerSupportedLayoutWidth\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Scroll_Lock.map"],"mappings":"gRAaG,SAAwB,EAAgB,EAAM,CAAC,IAAM,EAAW,qBAAqB,GAAO,EAAM,kBAAkB,EAAM,iBAAiB,OAAO,EAAQ,EAAiB,EAAa,gBAAgB,EAAO,CAAC,EAAoB,GAAwBA,EAAS,EAAM,UAAU,eAAe,QAAmB,EAC1T,MAAuB,CAAC,GAAG,EAAiB,OAC5C,IAAM,EAAS,SAAS,cAAc,OAAO,EAOH,MAPK,GAAS,UAAU;;;;;;;MAO5D,SAAS,KAAK,YAAY,CAAQ,MAAY,CAAC,EAAS,OAAO,CAAE,CAAE,EAAE,CAAC,CAAC,EAC7E,MAAoB,CAAC,GAAG,EAAiB,OAAO,IAAM,EAAW,wCAA8C,EAAU,aAAa,QAAQ,CAAU,EAAK,EAAM,UAAU,eAAe,SAC5L,EAAuB,EAAI,EACvB,EAEsC,EAA1B,SAAS,EAAU,EAAiC,EAAE,EAAM,UAAU,cAAc,EAAM,UAAU,YAAY,GAAG,EAAu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