{"version":3,"file":"Download_Button.BTPKvcaP.mjs","names":["__esmMin","init_ssg_sandbox_shims","window","c","init_jsx_runtime","init_framer_motion_DhsWWWsN","motion","init_framer_DKtAEkcX","addPropertyControls","ControlType","Download","props","downloadFile","file","response","url","blob","link","downloadFileName","getFileNameFromUrl","error","style","containerStyle","tint","font","title","parts","init_Download_Button"],"sources":["https:/framerusercontent.com/modules/iBuyssgagIHWn7bOJDYh/eRVzuvSiYUR8sWfPfn0H/Download_Button.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{motion}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";// Learn more: https://www.framer.com/docs/guides/overrides/\n// By Vinaykumar C (www.linkedin.com/in/vinay-sc)\nexport default function Download(props){const{title,tint,font,style,file,downloadFileName}=props;const downloadFile=()=>{fetch(file).then(response=>response.blob()).then(blob=>{const url=window.URL.createObjectURL(blob);const link=document.createElement(\"a\");link.href=url;link.download=downloadFileName||getFileNameFromUrl(file)||\"download\";document.body.appendChild(link);link.click();document.body.removeChild(link);window.URL.revokeObjectURL(url);}).catch(error=>{console.error(\"Error downloading the file:\",error);});};return /*#__PURE__*/_jsx(motion.div,{style:{...style,...containerStyle},children:/*#__PURE__*/_jsx(motion.div,{onTap:downloadFile,style:{margin:0,padding:15,borderRadius:40,backgroundColor:tint,color:font,fontSize:\"16px\",fontWeight:\"bold\",width:\"100%\",height:\"100%\"},whileHover:{scale:1.01},children:title})});}Download.defaultProps={tint:\"#09F\",font:\"#FF\",title:\"Download\",downloadFileName:\"\"};addPropertyControls(Download,{tint:{title:\"BackgroundColor\",type:ControlType.Color},font:{title:\"FontColor\",type:ControlType.Color},title:{title:\"Label\",type:ControlType.String},file:{title:\"File\",type:ControlType.File,allowedFileTypes:[]},downloadFileName:{title:\"Download File Name\",type:ControlType.String,defaultValue:\"\"}});const containerStyle={display:\"flex\",justifyContent:\"center\",alignItems:\"center\",overflow:\"hidden\"};function getFileNameFromUrl(url){const decodedUrl=decodeURIComponent(url);const parts=decodedUrl.split(\"/\");return parts[parts.length-1];}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Download\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Download_Button.map"],"mappings":"A,2NAEA,SAAwBU,EAAS,EAAM,CAAC,GAAK,CAAC,QAAM,OAAK,OAAK,QAAM,OAAK,oBAAkBC,EAAYC,MAAiB,CAAC,MAAMC,CAAI,CAAC,CAAC,KAAK,GAAUC,EAAS,KAAK,CAAC,CAAC,CAAC,KAAK,GAAM,CAAC,IAAMC,EAAIb,EAAO,IAAI,gBAAgBc,CAAI,EAAQC,EAAK,SAAS,cAAc,GAAG,EAAE,EAAK,KAAKF,EAAI,EAAK,SAASG,GAAkBC,EAAmBN,CAAI,GAAG,WAAW,SAAS,KAAK,YAAYI,CAAI,EAAEA,EAAK,MAAM,EAAE,SAAS,KAAK,YAAYA,CAAI,EAAEf,EAAO,IAAI,gBAAgBa,CAAG,CAAE,CAAC,CAAC,CAAC,MAAM,GAAO,CAAC,QAAQ,MAAM,8BAA8BK,CAAK,CAAE,CAAC,CAAE,EAAE,MAAoB,gBAAKd,EAAO,IAAI,CAAC,MAAM,CAAC,GAAGe,EAAM,GAAGC,CAAc,EAAE,SAAsB,gBAAKhB,EAAO,IAAI,CAAC,MAAMM,EAAa,MAAM,CAAC,OAAO,EAAE,QAAQ,GAAG,aAAa,GAAG,gBAAgBW,EAAK,MAAMC,EAAK,SAAS,OAAO,WAAW,OAAO,MAAM,OAAO,OAAO,MAAM,EAAE,WAAW,CAAC,MAAM,IAAI,EAAE,SAASC,CAAK,CAAC,CAAC,CAAC,CAAE,CAAigB,SAASN,EAAmB,EAAI,CAA0C,IAAMO,EAA9B,mBAAmBX,CAA0B,CAAC,CAAC,MAAM,GAAG,EAAE,OAAOW,EAAMA,EAAM,OAAO,EAAG,C,oDAAzoB,EA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