{"version":3,"file":"Download_Button.Db49ot2L.mjs","names":[],"sources":["https:/framerusercontent.com/modules/owVBof3huDdcJJdmKAa3/bzOYYMV69KrWbt8M6LNe/Download_Button.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * @framerDisableUnlink\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n * @framerIntrinsicWidth 200\n * @framerIntrinsicHeight 60\n */export default function CustomFilenameDownload(props){const{file,filename,buttonInstance,openInNewTab,style}=props;const isCanvas=RenderTarget.current()===RenderTarget.canvas;const handleDownload=async()=>{if(!file)return;try{const response=await fetch(file);const blob=await response.blob();const url=window.URL.createObjectURL(blob);const link=document.createElement(\"a\");link.href=url;link.download=filename||\"download\";if(openInNewTab)link.target=\"_blank\";document.body.appendChild(link);link.click();document.body.removeChild(link);window.URL.revokeObjectURL(url);}catch(err){console.error(\"Download failed\",err);}};if(isCanvas){return /*#__PURE__*/_jsx(\"div\",{style:{...style,padding:10,background:\"#f3f3f3\",borderRadius:8,fontSize:12,textAlign:\"center\"},children:\"Custom Filename Download\"});}return /*#__PURE__*/_jsx(\"div\",{style:{...style},onClick:handleDownload,children:buttonInstance});}CustomFilenameDownload.defaultProps={filename:\"file.pdf\",openInNewTab:false};addPropertyControls(CustomFilenameDownload,{filename:{type:ControlType.String,title:\"Filename\",placeholder:\"example\"},file:{type:ControlType.File,title:\"File\",allowedFileTypes:[\"pdf\",\"jpg\",\"jpeg\",\"png\",\"webp\",\"svg\",\"zip\",\"doc\",\"docx\"]},buttonInstance:{type:ControlType.ComponentInstance,title:\"Button\"},openInNewTab:{type:ControlType.Boolean,title:\"New Tab\",enabledTitle:\"Yes\",disabledTitle:\"No\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CustomFilenameDownload\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"200\",\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"* @framerSupportedLayoutWidth auto\",\"framerIntrinsicHeight\":\"60\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Download_Button.map"],"mappings":"kLAMG,SAAwB,EAAuB,EAAM,CAAC,GAAK,CAAC,OAAK,WAAS,iBAAe,eAAa,SAAO,EAAY,EAAS,EAAa,QAAQ,IAAI,EAAa,OAAa,EAAe,SAAS,CAAK,KAAY,GAAG,CAAkC,IAAM,EAAK,MAAM,MAA7B,MAAM,CAAI,EAAA,CAA4B,KAAK,EAAQ,EAAI,EAAO,IAAI,gBAAgB,CAAI,EAAQ,EAAK,SAAS,cAAc,GAAG,EAAE,EAAK,KAAK,EAAI,EAAK,SAAS,GAAU,WAAc,IAAa,EAAK,OAAO,UAAS,SAAS,KAAK,YAAY,CAAI,EAAE,EAAK,MAAM,EAAE,SAAS,KAAK,YAAY,CAAI,EAAE,EAAO,IAAI,gBAAgB,CAAG,CAAE,OAAO,EAAI,CAAC,QAAQ,MAAM,kBAAkB,CAAG,CAAE,CAAC,EAAqL,OAAhL,EAA8B,EAAK,MAAM,CAAC,MAAM,CAAC,GAAG,EAAM,QAAQ,GAAG,WAAW,UAAU,aAAa,EAAE,SAAS,GAAG,UAAU,QAAQ,EAAE,SAAS,0BAA0B,CAAC,EAAuB,EAAK,MAAM,CAAC,MAAM,CAAC,GAAG,CAAK,EAAE,QAAQ,EAAe,SAAS,CAAc,CAAC,CAAE,qBAN31B,IAAiE,EAM2xB,EAAuB,aAAa,CAAC,SAAS,WAAW,aAAa,EAAK,EAAE,EAAoB,EAAuB,CAAC,SAAS,CAAC,KAAK,EAAY,OAAO,MAAM,WAAW,YAAY,SAAS,EAAE,KAAK,CAAC,KAAK,EAAY,KAAK,MAAM,OAAO,iBAAiB,CAAC,MAAM,MAAM,OAAO,MAAM,OAAO,MAAM,MAAM,MAAM,MAAM,CAAC,EAAE,eAAe,CAAC,KAAK,EAAY,kBAAkB,MAAM,QAAQ,EAAE,aAAa,CAAC,KAAK,EAAY,QAAQ,MAAM,UAAU,aAAa,MAAM,cAAc,IAAI,CAAC,CAAC"}