{"version":3,"file":"CustomHooks.DeXUgCGn.mjs","names":["error"],"sources":["https:/framerusercontent.com/modules/QKffHBv8HPr45fvuCCky/YlRVWTB1Blp0rB3xrs4w/CustomHooks.js"],"sourcesContent":["import{useState,useCallback,useEffect}from\"react\";// Helper hook for async requests in idiomatic React (SWR currently does not work!)\n// Source: https://usehooks.com\nconst useAsync=(asyncFunction,immediate=true)=>{const[status,setStatus]=useState(\"idle\");const[data,setData]=useState(null);const[error,setError]=useState(null);// The execute function wraps asyncFunction and\n// handles setting state for pending, value, and error.\n// useCallback ensures the below useEffect is not called\n// on every render, but only if asyncFunction changes.\nconst execute=useCallback(()=>{setStatus(\"pending\");setData(null);setError(null);return asyncFunction().then(response=>{setData(response);setStatus(\"success\");}).catch(error=>{setError(error);setStatus(\"error\");});},[asyncFunction]);// Call execute if we want to fire it right away.\n// Otherwise execute can be called later, such as\n// in an onClick handler.\nuseEffect(()=>{if(immediate){execute();}},[execute,immediate]);return{execute,status,data,error};};export{useAsync};\nexport const __FramerMetadata__ = {\"exports\":{\"useAsync\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CustomHooks.map"],"mappings":"6JAEM,AAFN,GAAkD,CAE5C,EAAS,CAAC,EAAc,GAAU,IAAO,CAAC,GAAK,CAAC,EAAO,EAAU,CAAC,EAAS,OAAO,CAAM,CAAC,EAAK,EAAQ,CAAC,EAAS,KAAK,CAAM,CAAC,EAAM,EAAS,CAAC,EAAS,KAAK,CAI1J,EAAQ,EAAY,KAAK,EAAU,UAAU,CAAC,EAAQ,KAAK,CAAC,EAAS,KAAK,CAAQ,GAAe,CAAC,KAAK,GAAU,CAAmB,AAAlB,EAAQ,EAAS,CAAC,EAAU,UAAU,AAAE,EAAC,CAAC,MAAM,GAAO,CAAiB,AAAhB,EAASA,EAAM,CAAC,EAAU,QAAQ,AAAE,EAAC,EAAG,CAAC,CAAc,EAAC,CAGzK,MAA/D,GAAU,IAAI,CAAC,AAAG,GAAW,GAAS,AAAG,EAAC,CAAC,EAAQ,CAAU,EAAC,CAAO,CAAC,UAAQ,SAAO,OAAK,OAAM,CAAE"}