{"version":3,"file":"DownloadButton.BP2R2a-e.mjs","names":["useState","startTransition","__esmMin","init_npm_react_18_3_1","init_ssg_sandbox_shims","window","te","_e","p","c","init_jsx_runtime","init_framer_DKtAEkcX","ControlType","addPropertyControls","DownloadButton","props","isHovered","setIsHovered","downloadState","setDownloadState","handleDownload","uploadedFile","blob","urlParts","filename","url","link","error","getIcon","showIcon","iconStyle","iconColor","getCurrentText","loadingText","successText","downloadText","buttonStyle","hoverColor","backgroundColor","textColor","borderRadius","buttonFont","style","init_DownloadButton"],"sources":["https:/framerusercontent.com/modules/vTtdWwQwyeJt8Af7quBg/h1xi8ghxH6TnJU0DYrAr/DownloadButton.js"],"sourcesContent":["// Download button component with file upload and download functionality\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Download Button with File Upload\n * \n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function DownloadButton(props){const{uploadedFile=\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",downloadText=\"Download\",loadingText=\"Downloading...\",successText=\"Downloaded!\",backgroundColor=\"#0066FF\",textColor=\"#FFFFFF\",hoverColor=\"#0052CC\",borderRadius=8,buttonFont,showIcon=true,iconColor=\"#FFFFFF\",style}=props;const[isHovered,setIsHovered]=useState(false);const[downloadState,setDownloadState]=useState(\"idle\");const handleDownload=async()=>{if(!uploadedFile||downloadState===\"loading\")return;try{startTransition(()=>setDownloadState(\"loading\"));const response=await fetch(uploadedFile);const blob=await response.blob();// Extract filename from URL or use default\nconst urlParts=uploadedFile.split(\"/\");const filename=urlParts[urlParts.length-1]||\"download\";// Create download link\nconst url=window.URL.createObjectURL(blob);const link=document.createElement(\"a\");link.href=url;link.download=filename;document.body.appendChild(link);link.click();// Cleanup\ndocument.body.removeChild(link);window.URL.revokeObjectURL(url);startTransition(()=>setDownloadState(\"success\"));// Reset to idle after 2 seconds\nsetTimeout(()=>{startTransition(()=>setDownloadState(\"idle\"));},2e3);}catch(error){console.error(\"Download failed:\",error);startTransition(()=>setDownloadState(\"idle\"));}};const getIcon=()=>{if(!showIcon)return null;const iconStyle={width:\"24px\",height:\"24px\",marginRight:\"8px\",fill:iconColor};if(downloadState===\"loading\"){return /*#__PURE__*/_jsxs(\"svg\",{viewBox:\"0 0 24 24\",style:iconStyle,children:[/*#__PURE__*/_jsx(\"circle\",{cx:\"12\",cy:\"12\",r:\"10\",stroke:iconColor,strokeWidth:\"2\",fill:\"none\",opacity:\"0.3\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M12 2a10 10 0 0 1 10 10\",stroke:iconColor,strokeWidth:\"2\",fill:\"none\",children:/*#__PURE__*/_jsx(\"animateTransform\",{attributeName:\"transform\",type:\"rotate\",values:\"0 12 12;360 12 12\",dur:\"1s\",repeatCount:\"indefinite\"})})]});}if(downloadState===\"success\"){return /*#__PURE__*/_jsxs(\"svg\",{viewBox:\"0 0 24 24\",style:iconStyle,children:[/*#__PURE__*/_jsx(\"circle\",{cx:\"12\",cy:\"12\",r:\"10\",stroke:iconColor,strokeWidth:\"2\",fill:\"none\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M9 12l2 2 4-4\",stroke:iconColor,strokeWidth:\"2\",fill:\"none\"})]});}return /*#__PURE__*/_jsxs(\"svg\",{viewBox:\"0 0 24 24\",style:iconStyle,children:[/*#__PURE__*/_jsx(\"circle\",{cx:\"12\",cy:\"12\",r:\"10\",stroke:iconColor,strokeWidth:\"2\",fill:\"none\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M8 12l4 4 4-4M12 8v8\",stroke:iconColor,strokeWidth:\"2\",fill:\"none\"})]});};const getCurrentText=()=>{switch(downloadState){case\"loading\":return loadingText;case\"success\":return successText;default:return downloadText;}};const buttonStyle={display:\"inline-flex\",alignItems:\"center\",justifyContent:\"center\",padding:\"12px 24px\",backgroundColor:downloadState===\"success\"?\"#22CC66\":isHovered?hoverColor:backgroundColor,color:textColor,border:\"none\",borderRadius:`${borderRadius}px`,cursor:downloadState===\"loading\"?\"not-allowed\":\"pointer\",transition:\"background-color 0.2s ease\",...buttonFont,minWidth:\"max-content\",opacity:downloadState===\"loading\"?.7:1};return /*#__PURE__*/_jsx(\"div\",{style:{...style,position:\"relative\"},children:/*#__PURE__*/_jsxs(\"button\",{style:buttonStyle,onClick:handleDownload,onMouseEnter:()=>downloadState===\"idle\"&&startTransition(()=>setIsHovered(true)),onMouseLeave:()=>startTransition(()=>setIsHovered(false)),disabled:downloadState===\"loading\",children:[getIcon(),getCurrentText()]})});}addPropertyControls(DownloadButton,{uploadedFile:{type:ControlType.File,title:\"Upload File\",allowedFileTypes:[\"mp3\",\"wav\",\"ogg\",\"m4a\",\"mp4\",\"webm\",\"mov\",\"avi\",\"pdf\",\"doc\",\"docx\",\"xls\",\"xlsx\",\"csv\"]},downloadText:{type:ControlType.String,title:\"Download Text\",defaultValue:\"Download\"},loadingText:{type:ControlType.String,title:\"Loading Text\",defaultValue:\"Downloading...\"},successText:{type:ControlType.String,title:\"Success Text\",defaultValue:\"Downloaded!\"},backgroundColor:{type:ControlType.Color,title:\"Background Color\",defaultValue:\"#0066FF\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#FFFFFF\"},hoverColor:{type:ControlType.Color,title:\"Hover Color\",defaultValue:\"#0052CC\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:8,min:0,max:50,step:1,unit:\"px\"},buttonFont:{type:ControlType.Font,title:\"Button Font\",defaultValue:{fontSize:\"14px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},showIcon:{type:ControlType.Boolean,title:\"Show Icon\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},iconColor:{type:ControlType.Color,title:\"Icon Color\",defaultValue:\"#FFFFFF\",hidden:({showIcon})=>!showIcon}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"DownloadButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"auto\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DownloadButton.map"],"mappings":"A,sMAMG,SAAwBc,EAAe,EAAM,CAAC,GAAK,CAAC,eAAa,sEAAsE,eAAa,WAAW,cAAY,iBAAiB,cAAY,cAAc,kBAAgB,UAAU,YAAU,UAAU,aAAW,UAAU,eAAa,EAAE,aAAW,WAAS,GAAK,YAAU,UAAU,SAAOC,EAAW,CAACC,EAAUC,GAAcjB,EAAS,EAAK,EAAO,CAACkB,EAAcC,GAAkBnB,EAAS,MAAM,EAAQoB,EAAe,SAAS,CAAC,GAAIC,GAAcH,IAAgB,UAAiB,GAAG,CAACZ,MAAoBa,EAAiB,SAAS,CAAC,EAA2C,IAAMG,EAAK,MAAM,MAArC,MAAMD,CAAY,EAAA,CAA4B,KAAK,EACnpBE,EAASF,EAAa,MAAM,GAAG,EAAQG,EAASD,EAASA,EAAS,OAAO,IAAI,WAC7EE,EAAIpB,EAAO,IAAI,gBAAgBiB,CAAI,EAAQI,EAAK,SAAS,cAAc,GAAG,EAAE,EAAK,KAAKD,EAAI,EAAK,SAASD,EAAS,SAAS,KAAK,YAAYE,CAAI,EAAEA,EAAK,MAAM,EAClK,SAAS,KAAK,YAAYA,CAAI,EAAErB,EAAO,IAAI,gBAAgBoB,CAAG,EAAEnB,MAAoBa,EAAiB,SAAS,CAAC,EAC/G,eAAe,CAACb,MAAoBa,EAAiB,MAAM,CAAC,CAAE,EAAE,GAAG,CAAE,OAAOQ,EAAM,CAAC,QAAQ,MAAM,mBAAmBA,CAAK,EAAErB,MAAoBa,EAAiB,MAAM,CAAC,CAAE,CAAC,EAAQS,MAAY,CAAC,GAAG,CAACC,EAAS,OAAO,KAAK,IAAMC,EAAU,CAAC,MAAM,OAAO,O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