{"version":3,"file":"Checkout.CVHaugUT.mjs","names":["useStore","getUrlParameter"],"sources":["https:/framer.com/m/framer/store.js@^1.0.0","https:/framerusercontent.com/modules/5qdkjHretxWWSClcRBBN/r1ktMgyhitE2qeaj9s5P/Checkout.js"],"sourcesContent":["import{useState,useEffect}from\"react\";import{Data,useObserveData}from\"framer\";export function createStore(state1){// Use Data so that a Preview reload resets the state\nconst dataStore=Data({state:Object.freeze({...state1})});// Create a set function that updates the state\nconst setDataStore=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(dataStore.state);}dataStore.state=Object.freeze({...dataStore.state,...newState});};// Store the initial state, copy the object if it's an object\nlet storeState=typeof state1===\"object\"?Object.freeze({...state1}):state1;// Keep a list of all the listeners, in the form of React hook setters\nconst storeSetters=new Set();// Create a set function that updates all the listeners / setters\nconst setStoreState=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(storeState);}storeState=typeof newState===\"object\"?Object.freeze({...storeState,...newState}):newState;// Update all the listeners / setters with the new value\nstoreSetters.forEach(setter=>setter(storeState));};// Create the actual hook based on everything above\nfunction useStore(){// Create the hook we are going to use as a listener\nconst[state,setState]=useState(storeState);// If we unmount the component using this hook, we need to remove the listener\n// @ts-ignore\nuseEffect(()=>{// But right now, we need to add the listener\nstoreSetters.add(setState);return()=>storeSetters.delete(setState);},[]);// If Data context exists, use Data, otherwise use vanilla React state\nif(useObserveData()===true){useObserveData();return[dataStore.state,setDataStore];}else{// Return the state and a function to update the central store\nreturn[state,setStoreState];}}return useStore;}\nexport const __FramerMetadata__ = {\"exports\":{\"createStore\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./createStore.map","import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";// Learn more: https://www.framer.com/docs/guides/overrides/\nconst useStore=createStore({background:\"#0099FF\"});const getUrlParameter=name=>{const urlParams=new URLSearchParams(window.location.search);return urlParams.get(name);};// Abstracted locale-checking function\nconst getLocale=()=>{return window.location.pathname.includes(\"/nl/\")?\"nl\":\"en\";};// Mapping functions for display text with locale support\nconst mapActivityLevel=activityLevel=>{const locale=getLocale();const activityLevelMappings={en:{SEDENTARY:\"Not very active\",MILDLY_ACTIVE:\"Lightly active\",ACTIVE:\"Active\",VERY_ACTIVE:\"Very active\"},nl:{SEDENTARY:\"Niet erg actief\",MILDLY_ACTIVE:\"Licht actief\",ACTIVE:\"Actief\",VERY_ACTIVE:\"Zeer actief\"}};return activityLevelMappings[locale][activityLevel]||\"Unknown Activity Level\";};const mapGoalType=goalType=>{const locale=getLocale();const goalTypeMappings={en:{LOSE_WEIGHT:\"Fat loss\",GAIN_MUSCLE:\"Muscle gain\",RECOMPOSITION:\"Maintenance\"},nl:{LOSE_WEIGHT:\"Lichaamsvet verliezen\",GAIN_MUSCLE:\"Spiermassa opbouwen\",RECOMPOSITION:\"Huidig gewicht onderhouden\"}};return goalTypeMappings[locale][goalType]||\"Unknown Goal Type\";};export function withDynamicContent(Component){return function WrappedComponent(props){useEffect(()=>{// Get URL parameters\nconst primaryColor=getUrlParameter(\"primary_colour\");const goalType=getUrlParameter(\"goal_type\");const targetWeight=getUrlParameter(\"target_weight\");const activityLevel=getUrlParameter(\"activity_level\");// Set the background color if specified\nif(primaryColor){document.body.style.backgroundColor=primaryColor;}// Get the DOM elements to update\nconst goalTypeTextElement=document.getElementById(\"goal_type_text\");const targetWeightTextElement=document.getElementById(\"target_weight_text\");const activityLevelTextElement=document.getElementById(\"activity_level_text\");// Update the DOM elements with mapped values\nif(goalType&&goalTypeTextElement){goalTypeTextElement.childNodes[0].textContent=mapGoalType(goalType);}if(targetWeight&&targetWeightTextElement){targetWeightTextElement.childNodes[0].textContent=targetWeight;}if(activityLevel&&activityLevelTextElement){activityLevelTextElement.childNodes[0].textContent=mapActivityLevel(activityLevel);}},[]);return /*#__PURE__*/_jsx(Component,{...props});};}export function withGoalTypeTag(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,id:\"goal_type_text\"});};}export function withTargetWeightTag(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,id:\"target_weight_text\"});};}export function withActivityLevelTag(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,id:\"activity_level_text\"});};}export function withHeroTimerTag(Component){return function WrappedComponent(props){return /*#__PURE__*/_jsx(Component,{...props,id:\"hero_timer\"});};}export function withTimerSecondsTag(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,id:\"timer_seconds\"});};}export function withTimerMinutesTag(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,id:\"timer_minutes\"});};}export function withWeightProgressChartTag(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,id:\"weight_progress_chart\"});};}export function withCountdownTimer(Component){return function WrappedComponent(props){const[timeLeft,setTimeLeft]=useState(600)// 10 minutes in seconds\n;useEffect(()=>{const timer=setInterval(()=>{setTimeLeft(prevTime=>{if(prevTime<=1){clearInterval(timer);return 0;}return prevTime-1;});},1e3);return()=>clearInterval(timer)// Cleanup the timer on component unmount\n;},[]);useEffect(()=>{const updateTimers=()=>{const minutes=Math.floor(timeLeft/60);const seconds=timeLeft%60;const formattedTime=`${minutes}:${seconds<10?\"0\":\"\"}${seconds}`;const heroTimer=document.getElementById(\"hero_timer\");const timerMinutes=document.getElementById(\"timer_minutes\");const timerSeconds=document.getElementById(\"timer_seconds\");if(heroTimer)heroTimer.childNodes[0].textContent=formattedTime;if(timerMinutes)timerMinutes.childNodes[0].textContent=minutes;if(timerSeconds)timerSeconds.childNodes[0].textContent=seconds<10?`0${seconds}`:seconds;};updateTimers();},[timeLeft]);return /*#__PURE__*/_jsx(Component,{...props});};}// Function to adjust the brightness of the color for gradient effect\nfunction shadeColor(color,percent){let R=parseInt(color.substring(1,3),16);let G=parseInt(color.substring(3,5),16);let B=parseInt(color.substring(5,7),16);R=parseInt(R*(100+percent)/100);G=parseInt(G*(100+percent)/100);B=parseInt(B*(100+percent)/100);R=R<255?R:255;G=G<255?G:255;B=B<255?B:255;let RR=R.toString(16).length==1?\"0\"+R.toString(16):R.toString(16);let GG=G.toString(16).length==1?\"0\"+G.toString(16):G.toString(16);let BB=B.toString(16).length==1?\"0\"+B.toString(16):B.toString(16);return\"#\"+RR+GG+BB;}export function withTargetLink(Component){return function WrappedComponent(props){const getUrlParameter=name=>{const urlParams=new URLSearchParams(window.location.search);return urlParams.get(name);};const handleClick=()=>{const targetUrl=getUrlParameter(\"target\");if(targetUrl){window.location.href=targetUrl;}return false;};// Get the primary_colour parameter from the URL\nconst primaryColour=getUrlParameter(\"primary_colour\");// Create a style object with the primaryColour as the background color, if it exists\nconst style=primaryColour?{background:`#${primaryColour}`,color:\"#FFFFFF\"}:{background:`#000000`,color:\"#FFFFFF\"};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick,style:style});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withDynamicContent\":{\"type\":\"reactHoc\",\"name\":\"withDynamicContent\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withTimerSecondsTag\":{\"type\":\"reactHoc\",\"name\":\"withTimerSecondsTag\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withGoalTypeTag\":{\"type\":\"reactHoc\",\"name\":\"withGoalTypeTag\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHeroTimerTag\":{\"type\":\"reactHoc\",\"name\":\"withHeroTimerTag\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withTimerMinutesTag\":{\"type\":\"reactHoc\",\"name\":\"withTimerMinutesTag\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withWeightProgressChartTag\":{\"type\":\"reactHoc\",\"name\":\"withWeightProgressChartTag\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withTargetLink\":{\"type\":\"reactHoc\",\"name\":\"withTargetLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCountdownTimer\":{\"type\":\"reactHoc\",\"name\":\"withCountdownTimer\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withActivityLevelTag\":{\"type\":\"reactHoc\",\"name\":\"withActivityLevelTag\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withTargetWeightTag\":{\"type\":\"reactHoc\",\"name\":\"withTargetWeightTag\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Checkout.map"],"mappings":"sSAA8E,SAAgB,EAAY,EAAO,CACjH,IAAM,EAAU,EAAK,CAAC,MAAM,OAAO,OAAO,CAAC,GAAG,CAAO,EAAC,AAAC,EAAC,CAClD,EAAa,GAAU,CACwC,OAA3D,GAAW,aAAY,EAAS,EAAS,EAAU,MAAM,EAAE,EAAU,MAAM,OAAO,OAAO,CAAC,GAAG,EAAU,MAAM,GAAG,CAAS,EAAC,AAAE,EAClI,SAAkB,GAAS,SAAS,OAAO,OAAO,CAAC,GAAG,CAAO,EAAC,CAAC,EAC7D,EAAa,IAAI,IACjB,EAAc,GAAU,CAE9B,OADU,GAAW,aAAY,EAAS,EAAS,EAAW,EAAE,SAAkB,GAAW,SAAS,OAAO,OAAO,CAAC,GAAG,EAAW,GAAG,CAAS,EAAC,CAAC,EACjJ,EAAa,QAAQ,GAAQ,EAAO,EAAW,CAAC,AAAE,EAClD,SAASA,GAAU,CACnB,GAAK,CAAC,EAAM,EAAS,CAAC,EAAS,EAAW,CAK1C,MAHA,GAAU,KACV,EAAa,IAAI,EAAS,CAAO,IAAI,EAAa,OAAO,EAAS,EAAG,CAAE,EAAC,CACrE,GAAgB,IAAG,GAAM,GAAgB,CAAO,CAAC,EAAU,MAAM,CAAa,GAC3E,CAAC,EAAM,CAAc,CAAG,QAAOA,CAAU,cAf/C,GAAsC,IAAwC,GCG0oB,SAAgB,EAAmB,EAAU,CAAC,OAAO,SAA0B,EAAM,CAItd,MAJud,GAAU,IAAI,CAC5zB,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