{"version":3,"file":"CustomHooks.BlrTKB-5.mjs","names":["useState","useCallback","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":"kKAEM,GAAU,EAAc,EAAU,KAAO,CAAC,GAAK,CAAC,EAAO,EAAU,CAACA,EAAS,QAAa,CAAC,EAAK,EAAQ,CAACA,EAAS,MAAW,CAAC,EAAM,EAAS,CAACA,EAAS,MAIrJ,EAAQC,OAAiB,EAAU,WAAW,EAAQ,MAAM,EAAS,MAAa,IAAgB,KAAK,GAAU,CAAC,EAAQ,GAAU,EAAU,UAAY,GAAE,MAAM,GAAO,CAAC,EAASC,GAAO,EAAU,QAAU,IAAI,CAAC,EAAc,EAGxK,OAA/D,MAAc,CAAI,GAAW,GAAY,EAAC,CAAC,EAAQ,EAAU,EAAQ,CAAC,UAAQ,SAAO,OAAK,QAAM,AAAE"}