{"version":3,"file":"PoolData.CWFta614.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js","https:/framer.com/m/framer/store.js@^1.0.0","https:/framerusercontent.com/modules/i5VNV29jUPw0Jx6AQCtg/vs12VK5uSPG88xjNekdW/PoolData.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","/*\n * createStore (framer/store@1.0.1)\n *\n * Learn More: https://www.framer.com/asset-urls\n */\n\nexport * from \"https://framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js\"\n","import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";// 1. Match the store pattern exactly\nconst useStore=createStore({poolName:\"Loading...\",poolDescription:\"\",poolImage:\"\",memberCount:0,hasLoaded:false,notFound:false});const API_URL=\"https://us-central1-dating-app-backend-37fa3.cloudfunctions.net/api_public/share/pool/preview\";// Outside the component to persist across re-renders\nlet isFetching=false;export function withPoolMetadata(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[store,setStore]=useStore();useEffect(()=>{// if (typeof window === \"undefined\") return\n// // 1. If already loaded or currently fetching, ABORT.\n// if (\n//     store.hasLoaded ||\n//     (store.isLoading === false &&\n//         store.poolName !== \"Loading...\") ||\n//     isFetching\n// )\n//     return\n// // 1. Get the current clean path from the browser (e.g., \"/join/pool_12345\")\n// const path = window.location.pathname\n// // 2. Split the path by forward slashes and filter out empty strings\n// const segments = path.split(\"/\").filter(Boolean)\n// // 3. Extract the last segment dynamically\n// // If the URL is just \"/join\", fall back to a default handle so it doesn't crash\n// let handle = segments[segments.length - 1] || \"\" //\"coolpool\"\n// // Optional: A quick safety check to ensure we didn't just grab \"join\"\n// if (handle === \"join\") {\n//     handle = \"\" //\"coolpool\"\n// }\nif(typeof window===\"undefined\")return;// 1. If already loaded or currently fetching, ABORT.\nif(store.hasLoaded||store.isLoading===false&&store.poolName!==\"Loading...\"||isFetching)return;// 1. Safely grab the query string parameters from the URL bar\nconst urlParams=new URLSearchParams(window.location.search);// 2. Extract the 'handle' parameter, defaulting to an empty string if it's missing\nlet handle=urlParams.get(\"handle\")||\"\";async function fetchMetadata(){isFetching=true// Set lock\n;try{console.log(\"CALLING THE METADATA\");console.log(\"NAVIGATOR DATA: \",navigator);const response=await fetch(API_URL,{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify({poolId:handle,metadata:{screenResolution:`${window.screen.width*window.devicePixelRatio}x${window.screen.height*window.devicePixelRatio}`,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,language:navigator.language.toLowerCase(),platform:navigator.platform}})});if(response.status===429){console.error(\"Rate limit hit on Express.\");return;}const data=await response.json();console.log(\"DATA HERE: \",data);console.log(\"DATA ERR: \",data.error);if(!data||data.error||!data.name){console.log(\"NOT FOUND OVER HERE\");setStore({poolName:\"Not Found\",hasLoaded:true,notFound:true});return;}// console.log(\"DATA: \", data)\nsetStore({poolName:data.name||\"Matchpool\",poolDescription:data.description||\"\",poolImage:data.imageUrl||\"\",memberCount:data.memberCount||0,hasLoaded:true,notFound:false});}catch(error){console.error(\"Network error:\",error);}finally{isFetching=false// Release lock\n;}}fetchMetadata();},[store.hasLoaded]);return /*#__PURE__*/_jsx(Component,{...props,ref:ref});});}/**\n * CONFIGURATION\n * Update these once you have your store IDs in late April.\n */const CONFIG={appScheme:\"matchpools://\",appleAppId:\"6773175650\",androidPackageName:\"com.matchpools.app\",websiteFallback:\"https://matchpools.co/download\",// 🧪 TEMPORARY TESTFLIGHT CONFIG\nisTestFlightPhase:true,testFlightLink:\"https://testflight.apple.com/join/UtT9KA84\"};export function poolCTAButton(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const handleJoinClick=()=>{const win=window;const userAgent=navigator.userAgent||navigator.vendor||win.opera;const isiOS=/iPad|iPhone|iPod/.test(userAgent)&&!win.MSStream;const isAndroid=/android/i.test(userAgent);// 1. Prepare Redirect URLs\n// I used window.location.search in the appUrl. This means if someone clicks matchpools.com/pool?id=cool-pool from discord or elsewhere, the flutter app when opening app will receive matchpools://join?id=cool-pool. This helps your Flutter app know exactly which pool to show immediately.\nconst appUrl=`${CONFIG.appScheme}pool${window.location.search}`;let nativeStoreUrl=CONFIG.websiteFallback;let webStoreUrl=CONFIG.websiteFallback;if(isiOS){// If we're in the beta phase, route both to the TestFlight link\nif(CONFIG.isTestFlightPhase){nativeStoreUrl=CONFIG.testFlightLink;webStoreUrl=CONFIG.testFlightLink;}else{// Leaves your production App Store logic untouched for later\nnativeStoreUrl=`itms-apps://itunes.apple.com/app/id${CONFIG.appleAppId}`;webStoreUrl=`https://apps.apple.com/app/id${CONFIG.appleAppId}`;}}else if(isAndroid){nativeStoreUrl=`market://details?id=${CONFIG.androidPackageName}`;webStoreUrl=`https://play.google.com/store/apps/details?id=${CONFIG.androidPackageName}`;}// --- THE EXECUTION FLOW ---\nconst start=Date.now();// STEP 1: Attempt to open the app directly\nwindow.location.href=appUrl;// STEP 2: If app doesn't open, try native store apps\nsetTimeout(()=>{if(Date.now()-start<1500){console.log(\"App not installed, attempting native store...\");window.location.href=nativeStoreUrl;// STEP 3: If native store fails (e.g. tablet or weird browser), hit the web store\nsetTimeout(()=>{if(Date.now()-start<3e3){console.log(\"Native store failed, falling back to browser...\");window.location.href=webStoreUrl;}},800);}},800);};return /*#__PURE__*/_jsx(Component,{...props,ref:ref,onClick:e=>{if(props.onClick)props.onClick(e);handleJoinClick();}});});}/**\n * Data Injections\n */export function getPoolName(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[store]=useStore();return /*#__PURE__*/_jsx(Component,{...props,ref:ref,text:store.poolName});});}export function getPoolDescription(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[store]=useStore();return /*#__PURE__*/_jsx(Component,{...props,ref:ref,text:store.poolDescription});});}export function getMemberCount(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[store]=useStore();const text=store.hasLoaded?`${store.memberCount} members`:\"Checking...\";return /*#__PURE__*/_jsx(Component,{...props,ref:ref,text:text});});}export function getPoolImage(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[store]=useStore();const hasRemoteImage=store.hasLoaded&&store.poolImage&&store.poolImage.startsWith(\"http\");// 1. Fallback: Show original component with its shapes\nif(!hasRemoteImage){return /*#__PURE__*/_jsx(Component,{...props,ref:ref});}// 2. Success: Inject image and KILL the children (the shapes)\nreturn /*#__PURE__*/_jsx(Component,{...props,ref:ref,// These three props often kill internal template icons\nchildren:null,content:null,image:store.poolImage,style:{...props.style,backgroundImage:`url(\"${store.poolImage}\")`,backgroundSize:\"cover\",backgroundPosition:\"center\",backgroundRepeat:\"no-repeat\",// Ensure any internal SVGs are hidden via CSS\nfontSize:0,color:\"transparent\"}});});}/**\n * Meant to show if the pool is not found. (SORRY component)\n */export function showSorryComponent(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[store]=useStore();// Show only if loaded AND not found\nconst visible=store.hasLoaded&&store.notFound;console.log(\"VISIBLE HERE: \",visible);if(!visible)return null;return /*#__PURE__*/_jsx(Component,{...props,ref:ref});});}/**\n * Meant to show when the pool is found\n */export function showPoolComponent(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[store]=useStore();// Hide if we've finished loading and the pool is gone\nconst shouldHide=store.hasLoaded&&store.notFound;console.log(\"SHOULD HIDE HERE: \",shouldHide);if(shouldHide)return null// Completely removes it from the DOM aka hides it\n;return /*#__PURE__*/_jsx(Component,{...props,ref:ref});});}\nexport const __FramerMetadata__ = {\"exports\":{\"getPoolName\":{\"type\":\"reactHoc\",\"name\":\"getPoolName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"poolCTAButton\":{\"type\":\"reactHoc\",\"name\":\"poolCTAButton\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withPoolMetadata\":{\"type\":\"reactHoc\",\"name\":\"withPoolMetadata\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"showSorryComponent\":{\"type\":\"reactHoc\",\"name\":\"showSorryComponent\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getPoolImage\":{\"type\":\"reactHoc\",\"name\":\"getPoolImage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"showPoolComponent\":{\"type\":\"reactHoc\",\"name\":\"showPoolComponent\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getMemberCount\":{\"type\":\"reactHoc\",\"name\":\"getMemberCount\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getPoolDescription\":{\"type\":\"reactHoc\",\"name\":\"getPoolDescription\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PoolData.map"],"mappings":"8MAA8E,SAAgB,EAAY,EAAO,CACjH,IAAM,EAAU,EAAK,CAAC,MAAM,OAAO,OAAO,CAAC,GAAG,CAAM,CAAC,CAAC,CAAC,EACjD,EAAa,GAAU,CAC1B,OAAO,GAAW,aAAY,EAAS,EAAS,EAAU,KAAK,GAAG,EAAU,MAAM,OAAO,OAAO,CAAC,GAAG,EAAU,MAAM,GAAG,CAAQ,CAAC,CAAE,EACjI,EAAW,OAAO,GAAS,SAAS,OAAO,OAAO,CAAC,GAAG,CAAM,CAAC,EAAE,EAC7D,EAAa,IAAI,IACjB,EAAc,GAAU,CAC3B,OAAO,GAAW,aAAY,EAAS,EAAS,CAAU,GAAG,EAAW,OAAO,GAAW,SAAS,OAAO,OAAO,CAAC,GAAG,EAAW,GAAG,CAAQ,CAAC,EAAE,EACjJ,EAAa,QAAQ,GAAQ,EAAO,CAAU,CAAC,CAAE,EACjD,SAAS,GAAU,CACnB,GAAK,CAAC,EAAM,GAAUA,EAAS,CAAU,EAKzC,OAHA,OACA,EAAa,IAAI,CAAQ,MAAY,EAAa,OAAO,CAAQ,GAAI,CAAC,CAAC,EACpE,EAAe,IAAI,IAAM,EAAe,EAAQ,CAAC,EAAU,MAAM,CAAY,GAC1E,CAAC,EAAM,CAAa,CAAG,CAAC,OAAO,CAAS,iBAfT,IAAwC,sBEExD,SAAgB,EAAiB,EAAU,CAAC,OAAoB,GAAY,EAAM,IAAM,CAAC,GAAK,CAAC,EAAM,GAAU,EAAS,EA0BrG,OA1BuG,MAAc,CAqB7J,GADU,IAAS,QAChB,EAAM,WAAW,EAAM,YAAY,IAAO,EAAM,WAAW,cAAc,EAAW,OAEvF,IAAI,EAAO,IADS,gBAAgB,EAAO,SAAS,MACjC,CAA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