{"version":3,"file":"GitHub.CIUBcACe.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/CJNSU6NQOWv0HbpdOeXo/cb1eTJmJZZbWjDbx1Y9d/GitHub.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";const GITHUB_API_URL=\"https://api.github.com/repos/getumbrel/umbrel\";function formatNumber(num){if(num<1e3){return num;}const units=[\"K\",\"M\",\"B\",\"T\"];let unitIndex=0;while(num>=1e3){unitIndex++;num/=1e3;}num=Math.round(num*10)/10;return`${num}${units[unitIndex-1]}`;}export function withStarCount(Component){return props=>{// Current stars are 6.8K as of 19/June/2024. A fallback number of 7K gives us some rounding wiggle room (6.5K to 7.4K) for a while.\nconst[starCount,setStarCount]=useState(\"7K\");useEffect(()=>{const fetchData=async()=>{try{const response=await fetch(GITHUB_API_URL);const json=await response.json();const{stargazers_count}=json;if(typeof stargazers_count===\"number\"&&!isNaN(stargazers_count)){setStarCount(formatNumber(Number(stargazers_count)));}}catch(error){console.error(\"Error fetching GitHub stars\");}};fetchData();},[]);return /*#__PURE__*/_jsx(Component,{...props,text:starCount});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withStarCount\":{\"type\":\"reactHoc\",\"name\":\"withStarCount\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./GitHub.map"],"mappings":"yHAAsJ,SAAS,EAAa,EAAI,CAAC,GAAG,EAAI,IAAK,OAAO,EAAK,IAAM,EAAM,CAAC,IAAI,IAAI,IAAI,IAAI,CAAK,EAAU,EAAE,KAAM,GAAK,KAAK,IAAY,GAAK,IAA+B,MAA1B,GAAI,KAAK,MAAM,EAAI,GAAG,CAAC,GAAS,GAAG,IAAM,EAAM,EAAU,KAAM,SAAgB,EAAc,EAAU,CAAC,MAAO,IAAO,CACnZ,GAAK,CAAC,EAAU,GAAcA,EAAS,KAAK,CAA8V,OAA7V,MAAc,EAAiB,SAAS,CAAC,GAAG,CAA6E,GAAK,CAAC,oBAA5B,MAAvC,MAAM,MAAM,EAAe,EAA2B,MAAM,CAAiC,OAAO,GAAmB,UAAU,CAAC,MAAM,EAAiB,EAAE,EAAa,EAAa,OAAO,EAAiB,CAAC,CAAC,MAAe,CAAC,QAAQ,MAAM,8BAA8B,KAAe,EAAG,EAAE,CAAC,CAAqB,EAAK,EAAU,CAAC,GAAG,EAAM,KAAK,EAAU,CAAC,qBAD5Z,IAAsC,CAAM,EAAe"}