{"version":3,"file":"Download_Button.DMdO1Pyy.mjs","names":["__esmMin","window","init_jsx_runtime","c","init_ssg_sandbox_shims","RenderTarget","addPropertyControls","init_framer_BisrWwwE","ControlType","CustomFilenameDownload","props","isCanvas","handleDownload","file","blob","url","link","filename","openInNewTab","err","style","buttonInstance","init_Download_Button"],"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":"A,kLAMG,SAAwBS,EAAuB,EAAM,CAAC,GAAK,CAAC,OAAK,WAAS,iBAAe,eAAa,SAAOC,EAAYC,EAASN,EAAa,QAAQ,IAAIA,EAAa,OAAaO,EAAe,SAAS,CAAC,GAAIC,EAAY,GAAG,CAAkC,IAAMC,EAAK,MAAM,MAA7B,MAAMD,CAAI,EAAA,CAA4B,KAAK,EAAQE,EAAId,EAAO,IAAI,gBAAgBa,CAAI,EAAQE,EAAK,SAAS,cAAc,GAAG,EAAE,EAAK,KAAKD,EAAI,EAAK,SAASE,GAAU,WAAcC,IAAa,EAAK,OAAO,UAAS,SAAS,KAAK,YAAYF,CAAI,EAAEA,EAAK,MAAM,EAAE,SAAS,KAAK,YAAYA,CAAI,EAAEf,EAAO,IAAI,gBAAgBc,CAAG,CAAE,OAAOI,EAAI,CAAC,QAAQ,MAAM,kBAAkBA,CAAG,CAAE,CAAC,EAAqL,OAAhLR,EAA8B,gBAAK,MAAM,CAAC,MAAM,CAAC,GAAGS,EAAM,QAAQ,GAAG,WAAW,UAAU,aAAa,EAAE,SAAS,GAAG,UAAU,QAAQ,EAAE,SAAS,0BAA0B,CAAC,EAAuB,gBAAK,MAAM,CAAC,MAAM,CAAC,GAAGA,CAAK,EAAE,QAAQR,EAAe,SAASS,CAAc,CAAC,CAAE,C,0CAAC,EAAuB,aAAa,CAAC,SAAS,WAAW,aAAa,EAAK,EAAEf,EAAoBG,EAAuB,CAAC,SAAS,CAAC,KAAKD,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