{"version":3,"file":"GameComponent.Dg3IX-kx.mjs","names":["_Fragment"],"sources":["https:/framerusercontent.com/modules/uMcCxS0qR9eyFoDtc2nc/29BtW4w7yIJmLEWSmyz3/GameComponent.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import*as React from\"react\";import{motion,AnimatePresence}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";export function GameComponent({gameUrl=\"https://showcase.gadgame.com/full/vital-garden\",openButtonText=\"Chơi thử\",closeButtonText=\"Đ\\xf3ng game\",buttonBackgroundColor=\"#F01D85\",buttonTextColor=\"#FFFFFF\",buttonFontSize=23,buttonWidth=172,buttonHeight=65,showAsButton=true,textColor=\"#000000\",fontFamily=\"Nunito, sans-serif\",fontWeight=600,fontStyle=\"normal\"}){const[showGame,setShowGame]=React.useState(false);const[isMobile,setIsMobile]=React.useState(false);const[dynamicHeight,setDynamicHeight]=React.useState(\"100vh\");React.useEffect(()=>{const checkIfMobile=()=>{setIsMobile(window.innerWidth<=768);};const updateDynamicHeight=()=>{setDynamicHeight(`${window.innerHeight}px`);};checkIfMobile();updateDynamicHeight();window.addEventListener(\"resize\",checkIfMobile);window.addEventListener(\"resize\",updateDynamicHeight);window.addEventListener(\"orientationchange\",updateDynamicHeight);return()=>{window.removeEventListener(\"resize\",checkIfMobile);window.removeEventListener(\"resize\",updateDynamicHeight);window.removeEventListener(\"orientationchange\",updateDynamicHeight);};},[]);const toggleGame=()=>{setShowGame(!showGame);};const buttonStyle={width:`${buttonWidth}px`,height:`${buttonHeight}px`,backgroundColor:buttonBackgroundColor,color:buttonTextColor,fontFamily,fontSize:`${buttonFontSize}px`,fontWeight,fontStyle,borderRadius:\"36px\",border:\"none\",cursor:\"pointer\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\"};const textStyle={color:textColor,fontSize:`${buttonFontSize}px`,fontFamily,fontWeight,fontStyle,cursor:\"pointer\"};const overlayStyle=isMobile?{width:\"100%\",height:dynamicHeight}:{width:\"auto\",height:\"90vh\",aspectRatio:\"9 / 16\"};const OpenComponent=showAsButton?/*#__PURE__*/_jsx(motion.button,{style:buttonStyle,whileHover:{scale:1.05},whileTap:{scale:.95},onClick:toggleGame,children:openButtonText}):/*#__PURE__*/_jsx(motion.span,{style:textStyle,whileHover:{opacity:.8},whileTap:{scale:.95},onClick:toggleGame,children:openButtonText});return /*#__PURE__*/_jsxs(_Fragment,{children:[OpenComponent,/*#__PURE__*/_jsx(AnimatePresence,{children:showGame&&/*#__PURE__*/_jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},style:{position:\"fixed\",top:0,left:0,right:0,bottom:0,backgroundColor:\"rgba(0, 0, 0, 0.75)\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",zIndex:1e3,height:dynamicHeight},children:/*#__PURE__*/_jsxs(motion.div,{initial:{scale:.8},animate:{scale:1},exit:{scale:.8},style:{...overlayStyle,backgroundColor:\"white\",borderRadius:isMobile?0:\"12px\",overflow:\"hidden\",display:\"flex\",flexDirection:\"column\"},children:[/*#__PURE__*/_jsx(\"iframe\",{src:gameUrl,style:{width:\"100%\",height:isMobile?`calc(${dynamicHeight} - 85px)`:\"calc(100% - 75px)\",border:\"none\"},title:\"Embedded Game\",allowFullScreen:true}),/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",justifyContent:\"center\",alignItems:\"center\",padding:\"10px 0\",backgroundColor:\"white\"},children:showAsButton?/*#__PURE__*/_jsx(motion.button,{style:buttonStyle,whileHover:{scale:1.05},whileTap:{scale:.95},onClick:toggleGame,children:closeButtonText}):/*#__PURE__*/_jsx(motion.span,{style:textStyle,whileHover:{opacity:.8},whileTap:{scale:.95},onClick:toggleGame,children:closeButtonText})})]})})})]});}addPropertyControls(GameComponent,{gameUrl:{type:ControlType.String,defaultValue:\"https://showcase.gadgame.com/full/vital-garden\",title:\"Game URL\"},openButtonText:{type:ControlType.String,defaultValue:\"Chơi thử\",title:\"Open Text\"},closeButtonText:{type:ControlType.String,defaultValue:\"Đ\\xf3ng game\",title:\"Close Text\"},showAsButton:{type:ControlType.Boolean,defaultValue:true,title:\"Show as Button\"},buttonBackgroundColor:{type:ControlType.Color,defaultValue:\"#F01D85\",title:\"Button Background Color\",hidden:props=>!props.showAsButton},buttonTextColor:{type:ControlType.Color,defaultValue:\"#FFFFFF\",title:\"Button Text Color\",hidden:props=>!props.showAsButton},textColor:{type:ControlType.Color,defaultValue:\"#000000\",title:\"Text Color\",hidden:props=>props.showAsButton},buttonFontSize:{type:ControlType.Number,defaultValue:23,min:12,max:48,step:1,title:\"Font Size\"},buttonWidth:{type:ControlType.Number,defaultValue:172,min:100,max:300,step:1,title:\"Button Width\",hidden:props=>!props.showAsButton},buttonHeight:{type:ControlType.Number,defaultValue:65,min:40,max:100,step:1,title:\"Button Height\",hidden:props=>!props.showAsButton},fontFamily:{type:ControlType.String,defaultValue:\"Nunito, sans-serif\",title:\"Font Family\"},fontWeight:{type:ControlType.Enum,options:[\"100\",\"200\",\"300\",\"400\",\"500\",\"600\",\"700\",\"800\",\"900\",\"bold\",\"normal\"],defaultValue:\"600\",title:\"Font Weight\"},fontStyle:{type:ControlType.Enum,options:[\"normal\",\"italic\"],defaultValue:\"normal\",title:\"Font Style\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"GameComponent\":{\"type\":\"reactComponent\",\"name\":\"GameComponent\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./GameComponent.map"],"mappings":"qaAAiN,SAAgB,EAAc,CAAC,UAAQ,iDAAiD,iBAAe,WAAW,kBAAgB,YAAe,wBAAsB,UAAU,kBAAgB,UAAU,iBAAe,GAAG,cAAY,IAAI,eAAa,GAAG,eAAa,GAAK,YAAU,UAAU,aAAW,qBAAqB,aAAW,IAAI,YAAU,SAAS,CAAC,CAAC,GAAK,CAAC,EAAS,EAAY,CAAA,EAAgB,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