{"version":3,"file":"Download_Button.DXQJsEhc.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":"6KAMG,SAAwB,EAAuB,EAAM,CAAC,GAAK,CAAC,OAAK,WAAS,iBAAe,eAAa,SAAO,EAAY,EAAS,EAAa,SAAS,GAAG,EAAa,OAAa,EAAe,SAAS,CAAK,KAAY,GAAG,CAAkC,IAAM,EAAK,MAA7B,MAAM,MAAM,EAAK,EAA2B,MAAM,CAAO,EAAI,EAAO,IAAI,gBAAgB,EAAK,CAAO,EAAK,SAAS,cAAc,IAAI,CAAC,EAAK,KAAK,EAAI,EAAK,SAAS,GAAU,WAAc,IAAa,EAAK,OAAO,UAAS,SAAS,KAAK,YAAY,EAAK,CAAC,EAAK,OAAO,CAAC,SAAS,KAAK,YAAY,EAAK,CAAC,EAAO,IAAI,gBAAgB,EAAI,OAAQ,EAAI,CAAC,QAAQ,MAAM,kBAAkB,EAAI,GAAuL,OAAhL,EAA8B,EAAK,MAAM,CAAC,MAAM,CAAC,GAAG,EAAM,QAAQ,GAAG,WAAW,UAAU,aAAa,EAAE,SAAS,GAAG,UAAU,SAAS,CAAC,SAAS,2BAA2B,CAAC,CAAsB,EAAK,MAAM,CAAC,MAAM,CAAC,GAAG,EAAM,CAAC,QAAQ,EAAe,SAAS,EAAe,CAAC,sBANz1B,IAAiE,CAM0xB,EAAuB,aAAa,CAAC,SAAS,WAAW,aAAa,GAAM,CAAC,EAAoB,EAAuB,CAAC,SAAS,CAAC,KAAK,EAAY,OAAO,MAAM,WAAW,YAAY,UAAU,CAAC,KAAK,CAAC,KAAK,EAAY,KAAK,MAAM,OAAO,iBAAiB,CAAC,MAAM,MAAM,OAAO,MAAM,OAAO,MAAM,MAAM,MAAM,OAAO,CAAC,CAAC,eAAe,CAAC,KAAK,EAAY,kBAAkB,MAAM,SAAS,CAAC,aAAa,CAAC,KAAK,EAAY,QAAQ,MAAM,UAAU,aAAa,MAAM,cAAc,KAAK,CAAC,CAAC"}