{"version":3,"file":"DownloadButton.DZdKy79P.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/pvjTj0eZLjgqWOUxkgBp/BFCpOMtPA2ws7g0yRZO5/DownloadButton.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";export default function PrivacyPolicy({text,pdfUrl,downloadName}){const[cachedUrl,setCachedUrl]=useState(null);useEffect(()=>{// Preload the PDF for faster download\nconst preloadPDF=async()=>{try{const response=await fetch(pdfUrl);const blob=await response.blob();const url=window.URL.createObjectURL(blob);setCachedUrl(url);}catch(error){console.error(\"Error preloading the PDF\",error);}};preloadPDF();// Cleanup the URL object when the component unmounts\nreturn()=>{if(cachedUrl){window.URL.revokeObjectURL(cachedUrl);}};},[pdfUrl]);const downloadPDF=()=>{if(!cachedUrl)return;const link=document.createElement(\"a\");link.href=cachedUrl;link.setAttribute(\"download\",encodeURIComponent(downloadName)+\".pdf\");document.body.appendChild(link);link.click();document.body.removeChild(link);};return /*#__PURE__*/_jsx(\"div\",{style:{padding:\"5px\",textAlign:\"center\",color:\"#4A4A68\"},children:/*#__PURE__*/_jsx(\"span\",{onClick:downloadPDF,style:{color:\"#4A4A68\",textDecoration:\"underline\",fontSize:\"1.2rem\",cursor:\"pointer\"},children:text})});}addPropertyControls(PrivacyPolicy,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Privacy Policy\"},pdfUrl:{type:ControlType.String,title:\"PDF URL\",defaultValue:\"https://files.catbox.moe/z53god.pdf\"},downloadName:{type:ControlType.String,title:\"Download Name\",defaultValue:\"Soothfiy\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PrivacyPolicy\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DownloadButton.map"],"mappings":"+LAAqI,SAAwB,EAAc,CAAC,OAAK,SAAO,gBAAc,CAAC,GAAK,CAAC,EAAU,GAAcA,EAAS,KAAK,CAEuF,OAFtF,QACnO,SAAS,CAAC,GAAG,CAAoC,IAAM,EAAK,MAA/B,MAAM,MAAM,EAAO,EAA2B,MAAM,CAA4C,EAAjC,EAAO,IAAI,gBAAgB,EAAK,CAAkB,OAAQ,EAAM,CAAC,QAAQ,MAAM,2BAA2B,EAAM,KAAgB,KACnO,CAAI,GAAW,EAAO,IAAI,gBAAgB,EAAU,GAAM,CAAC,EAAO,CAAC,CAAiR,EAAK,MAAM,CAAC,MAAM,CAAC,QAAQ,MAAM,UAAU,SAAS,MAAM,UAAU,CAAC,SAAsB,EAAK,OAAO,CAAC,YAAlW,CAAC,GAAG,CAAC,EAAU,OAAO,IAAM,EAAK,SAAS,cAAc,IAAI,CAAC,EAAK,KAAK,EAAU,EAAK,aAAa,WAAW,mBAAmB,EAAa,CAAC,OAAO,CAAC,SAAS,KAAK,YAAY,EAAK,CAAC,EAAK,OAAO,CAAC,SAAS,KAAK,YAAY,EAAK,EAAmJ,MAAM,CAAC,MAAM,UAAU,eAAe,YAAY,SAAS,SAAS,OAAO,UAAU,CAAC,SAAS,EAAK,CAAC,CAAC,CAAC,sBAFthB,IAAsC,IAAoD,CAE8b,EAAoB,EAAc,CAAC,KAAK,CAAC,KAAK,EAAY,OAAO,MAAM,OAAO,aAAa,iBAAiB,CAAC,OAAO,CAAC,KAAK,EAAY,OAAO,MAAM,UAAU,aAAa,sCAAsC,CAAC,aAAa,CAAC,KAAK,EAAY,OAAO,MAAM,gBAAgB,aAAa,WAAW,CAAC,CAAC"}