{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/go4G6RozEpIBDHUVLqLI/Xp88lH4S6oUKR38SSW0Y/View_Counter.js"],
  "sourcesContent": ["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * @framerDisableUnlink\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function PageViews(props){const{textColor,font,setup,suffix}=props;const[views,setViews]=useState(0);const isCanvas=RenderTarget.current()===RenderTarget.canvas;useEffect(()=>{const incrementViews=async()=>{try{if(typeof window===\"undefined\")return;const{pathname,host}=window.location;const slug=host+pathname;const response=await fetch(`${setup.url}/rest/v1/rpc/increment_page_view`,{method:\"POST\",headers:{\"Content-Type\":\"application/json\",apikey:setup.key,Authorization:`Bearer ${setup.key}`},body:JSON.stringify({slug:slug})});if(!response.ok)throw new Error(\"Failed to increment views\");const newViews=await response.json();setViews(newViews);}catch(error){console.error(\"Error:\",error);}};if(!isCanvas){incrementViews();}},[setup]);return /*#__PURE__*/_jsx(\"div\",{style:{...props.style},children:/*#__PURE__*/_jsxs(\"p\",{style:{margin:0,color:textColor,...font},children:[isCanvas?\"123\":views,\" \",suffix]})});}PageViews.defaultProps={suffix:\"views\",setup:{url:\"https://nlbllifiywwihhynrcgn.supabase.co\",key:\"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im5sYmxsaWZpeXd3aWhoeW5yY2duIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MzIxNzU2ODUsImV4cCI6MjA0Nzc1MTY4NX0.aEc2tzhVPBdVuf_zZpOvyvosNbicoXnawczlyTJQhY4\"}};addPropertyControls(PageViews,{// setup: {\n//     type: ControlType.Object,\n//     controls: {\n//         url: {\n//             type: ControlType.String,\n//             title: \"URL\",\n//         },\n//         key: {\n//             type: ControlType.String,\n//             title: \"Anon/Public Key\",\n//             description:\n//                 \"The component will work by default. If you'd like to self host, create a Supabase project and click [here](https://www.google.com), run the command and plugin your own URL and key\",\n//         },\n//     },\n// },\nsuffix:{type:ControlType.String,title:\"Suffix\"},font:{type:ControlType.Font,controls:\"extended\",title:\"Font\"},textColor:{type:ControlType.Color,defaultValue:\"#000000\",title:\"Color\",description:\"Publish to see this in effect. Views may not reflect accurately in preview mode.\\n\\nv1.0 \\n[via SegmentUI](https://www.segmentUI.com)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PageViews\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"*\",\"framerSupportedLayoutHeight\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./View_Counter.map"],
  "mappings": "8JAKkB,SAARA,EAA2BC,EAAM,CAAC,GAAK,CAAC,UAAAC,EAAU,KAAAC,EAAK,MAAAC,EAAM,OAAAC,CAAM,EAAEJ,EAAW,CAACK,EAAMC,CAAQ,EAAEC,EAAS,CAAC,EAAQC,EAASC,EAAa,QAAQ,IAAIA,EAAa,OAAO,OAAAC,EAAU,IAAI,CAA6gBF,IAAvf,SAAS,CAAC,GAAG,CAAC,GAAG,OAAOG,EAAS,IAAY,OAAO,GAAK,CAAC,SAAAC,EAAS,KAAAC,CAAI,EAAEF,EAAO,SAAeG,EAAKD,EAAKD,EAAeG,EAAS,MAAM,MAAM,GAAGZ,EAAM,sCAAsC,CAAC,OAAO,OAAO,QAAQ,CAAC,eAAe,mBAAmB,OAAOA,EAAM,IAAI,cAAc,UAAUA,EAAM,KAAK,EAAE,KAAK,KAAK,UAAU,CAAC,KAAKW,CAAI,CAAC,CAAC,CAAC,EAAE,GAAG,CAACC,EAAS,GAAG,MAAM,IAAI,MAAM,2BAA2B,EAAE,IAAMC,EAAS,MAAMD,EAAS,KAAK,EAAET,EAASU,CAAQ,CAAE,OAAOC,EAAN,CAAa,QAAQ,MAAM,SAASA,CAAK,CAAE,CAAC,GAA+B,CAAG,EAAE,CAACd,CAAK,CAAC,EAAsBe,EAAK,MAAM,CAAC,MAAM,CAAC,GAAGlB,EAAM,KAAK,EAAE,SAAsB,EAAM,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,MAAMC,EAAU,GAAGC,CAAI,EAAE,SAAS,CAACM,EAAS,MAAMH,EAAM,IAAID,CAAM,CAAC,CAAC,CAAC,CAAC,CAAE,CAACL,EAAU,aAAa,CAAC,OAAO,QAAQ,MAAM,CAAC,IAAI,2CAA2C,IAAI,kNAAkN,CAAC,EAAEoB,EAAoBpB,EAAU,CAe1vC,OAAO,CAAC,KAAKqB,EAAY,OAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,KAAKA,EAAY,KAAK,SAAS,WAAW,MAAM,MAAM,EAAE,UAAU,CAAC,KAAKA,EAAY,MAAM,aAAa,UAAU,MAAM,QAAQ,YAAY;AAAA;AAAA;AAAA,2CAAuI,CAAC,CAAC",
  "names": ["PageViews", "props", "textColor", "font", "setup", "suffix", "views", "setViews", "ye", "isCanvas", "RenderTarget", "ue", "window", "pathname", "host", "slug", "response", "newViews", "error", "p", "addPropertyControls", "ControlType"]
}
