{"version":3,"file":"DownloadButton.OhPisa_a.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/2bH7vO7HTT83lzikfGky/2An4tnbFmEyDILuM73Op/DownloadButton.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";import{motion}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";const onHoverStyle={scale:1.05,cursor:\"pointer\"};const spring={type:\"spring\",stiffness:300,damping:30};const hexToRgb=hex=>{const bigint=parseInt(hex.replace(\"#\",\"\"),16);const r=bigint>>16&255;const g=bigint>>8&255;const b=bigint&255;return`${r}, ${g}, ${b}`;};/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function Download(props){const[blobUrl,setBlobUrl]=useState(null);const{fileName,title,tint,style,file,radius,topLeftRadius,topRightRadius,bottomRightRadius,bottomLeftRadius,isMixedRadius=false,stylePadding,topLeftPadding,topRightPadding,bottomRightPadding,bottomLeftPadding,isMixedPadding=false,font,shadowColor,shadowX,shadowY,shadowBlur,shadowSpread,shadowOpacity}=props;const borderRadius=isMixedRadius?`${topLeftRadius}px ${topRightRadius}px ${bottomRightRadius}px ${bottomLeftRadius}px`:`${radius}px`;const padding=isMixedPadding?`${topLeftPadding}px ${topRightPadding}px ${bottomRightPadding}px ${bottomLeftPadding}px`:`${stylePadding}px`;const boxShadow=`${shadowX}px ${shadowY}px ${shadowBlur}px ${shadowSpread}px rgba(${hexToRgb(shadowColor)}, ${shadowOpacity})`;const handleClick=async()=>{const response=await fetch(props.file);const blob=await response.blob();const url=URL.createObjectURL(blob);setBlobUrl(url);};useEffect(()=>{handleClick();},[]);return /*#__PURE__*/_jsx(motion.div,{style:{...style,...containerStyle},children:/*#__PURE__*/_jsx(motion.div,{style:{borderRadius,padding,backgroundColor:tint,fontSize:font.size,fontWeight:font.weight,color:font.color,fontFamily:`'${font.fontFace}'`,overflow:\"visible\",boxShadow:boxShadow},whileHover:onHoverStyle,transition:spring,children:/*#__PURE__*/_jsx(\"a\",{href:blobUrl,style:{textDecoration:\"none\",color:font.color},download:fileName,children:title})})});}const containerStyle={display:\"flex\",justifyContent:\"center\",alignItems:\"center\",overflow:\"visible\"};addPropertyControls(Download,{fileName:{type:ControlType.String,defaultValue:\"File\"},title:{title:\"Label\",type:ControlType.String,defaultValue:\"Download!\"},tint:{title:\"Background Color\",type:ControlType.Color,defaultValue:\"#242424\"},font:{type:ControlType.Object,controls:{fontFace:{type:ControlType.String,defaultValue:\"Inter\"},size:{type:ControlType.Number,defaultValue:18},color:{type:ControlType.Color,defaultValue:\"#ffffff\"},weight:{type:ControlType.Enum,defaultValue:\"bold\",options:[\"normal\",\"bold\",\"bolder\",\"lighter\"]}}},file:{title:\"File\",type:ControlType.File,allowedFileTypes:[]},radius:{type:ControlType.FusedNumber,title:\"Radius\",defaultValue:8,toggleKey:\"isMixedRadius\",toggleTitles:[\"All\",\"Individual\"],valueKeys:[\"topLeftRadius\",\"topRightRadius\",\"bottomRightRadius\",\"bottomLeftRadius\"],valueLabels:[\"T\",\"R\",\"B\",\"L\"],min:0},stylePadding:{type:ControlType.FusedNumber,title:\"Padding\",defaultValue:16,toggleKey:\"isMixedPadding\",toggleTitles:[\"All\",\"Individual\"],valueKeys:[\"topLeftPadding\",\"topRightPadding\",\"bottomRightPadding\",\"bottomLeftPadding\"],valueLabels:[\"T\",\"R\",\"B\",\"L\"],min:0},shadowColor:{type:ControlType.Color,title:\"Shadow Color\",defaultValue:\"#000000\"},shadowX:{type:ControlType.Number,title:\"Shadow X\",defaultValue:5},shadowY:{type:ControlType.Number,title:\"Shadow Y\",defaultValue:5},shadowBlur:{type:ControlType.Number,title:\"Blur\",defaultValue:12,min:0},shadowSpread:{type:ControlType.Number,title:\"Spread\",defaultValue:0},shadowOpacity:{type:ControlType.Number,title:\"Opacity\",defaultValue:.2,min:0,max:1}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Download\",\"slots\":[],\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