{"version":3,"file":"ScaleByScreenWidth.DQAF97eK.mjs","names":["useRef","useState","useCallback"],"sources":["https:/framerusercontent.com/modules/4NUMB5kmI3exLnFCU9ae/Z7Wg5CjVLauDeKbsGiOa/ScaleByScreenWidth.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useRef,useEffect,useState,useCallback}from\"react\";import{motion}from\"framer-motion\";export function withScale(Component){return props=>{const ref=useRef(null);const[height,setHeight]=useState();const[width,setWidth]=useState();const xGap=40;const handleResize=useCallback(()=>{// Get the window width\nconst windowWidth=window.innerWidth;if(!width){setWidth(ref.current.clientWidth);}if(!height){setHeight(ref.current.clientHeight);}// If the window width is less than 810px, adjust the scale accordingly\nif(windowWidth<1200&&ref.current&&width&&height){const scale=(windowWidth-xGap*2)/width// Scale down based on the window width\n;ref.current.style.transform=`scale(${scale})`;ref.current.style.height=`${scale*height}px`;ref.current.style.transformOrigin=`50% 0`;}else{// If the window width is 810px or greater, set the scale to 1\nref.current.style.transform=\"scale(1)\";}},[width,height]);// This useEffect hook is used to scale the component based on the window width.\nuseEffect(()=>{// Add the event listener for resize events\nwindow.addEventListener(\"resize\",handleResize);// Call the handleResize function initially to set the scale\nhandleResize();// Remove the event listener when the component is unmounted\nreturn()=>{window.removeEventListener(\"resize\",handleResize);};},[width,height])// Empty dependency array means the effect will only run on mount and unmount\n;// Wrap the passed component with the motion.div to apply the scaling effect\nreturn /*#__PURE__*/_jsx(motion.div,{ref:ref,children:/*#__PURE__*/_jsx(Component,{...props})});};}export function withScaleMobile1(Component){return props=>{const ref=useRef(null);const[height,setHeight]=useState();const[width,setWidth]=useState();const xGap=0;const handleResize=useCallback(()=>{// Get the window width\nconst windowWidth=window.innerWidth;if(!width){setWidth(ref.current.clientWidth);}if(!height){setHeight(ref.current.clientHeight);}// If the window width is less than 810px, adjust the scale accordingly\nif(windowWidth<1200&&ref.current&&width&&height){const scale=(windowWidth-xGap*2)/width// Scale down based on the window width\n;ref.current.style.transform=`scale(${scale})`;ref.current.style.height=`${scale*height}px`;ref.current.style.transformOrigin=`50% 0`;}else{// If the window width is 810px or greater, set the scale to 1\nref.current.style.transform=\"scale(1)\";}},[width,height]);// This useEffect hook is used to scale the component based on the window width.\nuseEffect(()=>{// Add the event listener for resize events\nwindow.addEventListener(\"resize\",handleResize);// Call the handleResize function initially to set the scale\nhandleResize();// Remove the event listener when the component is unmounted\nreturn()=>{window.removeEventListener(\"resize\",handleResize);};},[width,height])// Empty dependency array means the effect will only run on mount and unmount\n;// Wrap the passed component with the motion.div to apply the scaling effect\nreturn /*#__PURE__*/_jsx(motion.div,{ref:ref,children:/*#__PURE__*/_jsx(Component,{...props})});};}export function withScaleMobile2(Component){return props=>{const ref=useRef(null);const[height,setHeight]=useState();const[width,setWidth]=useState();const xGap=24;const handleResize=useCallback(()=>{// Get the window width\nconst windowWidth=window.innerWidth;if(!width){setWidth(ref.current.clientWidth);}if(!height){setHeight(ref.current.clientHeight);}// If the window width is less than 810px, adjust the scale accordingly\nif(windowWidth<1200&&ref.current&&width&&height){const scale=(windowWidth-xGap*2)/width// Scale down based on the window width\n;ref.current.style.transform=`scale(${scale})`;ref.current.style.height=`${scale*height}px`;ref.current.style.transformOrigin=`50% 0`;}else{// If the window width is 810px or greater, set the scale to 1\nref.current.style.transform=\"scale(1)\";}},[width,height]);// This useEffect hook is used to scale the component based on the window width.\nuseEffect(()=>{// Add the event listener for resize events\nwindow.addEventListener(\"resize\",handleResize);// Call the handleResize function initially to set the scale\nhandleResize();// Remove the event listener when the component is unmounted\nreturn()=>{window.removeEventListener(\"resize\",handleResize);};},[width,height])// Empty dependency array means the effect will only run on mount and unmount\n;// Wrap the passed component with the motion.div to apply the scaling effect\nreturn /*#__PURE__*/_jsx(motion.div,{ref:ref,children:/*#__PURE__*/_jsx(Component,{...props})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withScaleMobile1\":{\"type\":\"reactHoc\",\"name\":\"withScaleMobile1\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withScaleMobile2\":{\"type\":\"reactHoc\",\"name\":\"withScaleMobile2\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withScale\":{\"type\":\"reactHoc\",\"name\":\"withScale\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScaleByScreenWidth.map"],"mappings":"sMAAsI,SAAgB,EAAU,EAAU,CAAC,MAAO,IAAO,CAAC,IAAM,EAAIA,EAAO,KAAK,CAAM,CAAC,EAAO,GAAWC,GAAU,CAAM,CAAC,EAAM,GAAUA,GAAU,CAAqB,EAAaC,MAAgB,CACtU,IAAM,EAAY,EAAO,WACzB,GADwC,GAAO,EAAS,EAAI,QAAQ,YAAY,CAAM,GAAQ,EAAU,EAAI,QAAQ,aAAa,CAC9H,EAAY,MAAM,EAAI,SAAS,GAAO,EAAO,CAAC,IAAM,GAAO,EAAY,IAAQ,EACjF,EAAI,QAAQ,MAAM,UAAU,SAAS,EAAM,GAAG,EAAI,QAAQ,MAAM,OAAO,GAAG,EAAM,EAAO,IAAI,EAAI,QAAQ,MAAM,gBAAgB,aAC9H,EAAI,QAAQ,MAAM,UAAU,YAAc,CAAC,EAAM,EAAO,CAAC,CAMzD,OALA,OACA,EAAO,iBAAiB,SAAS,EAAa,CAC9C,GAAc,KACJ,CAAC,EAAO,oBAAoB,SAAS,EAAa,GAAK,CAAC,EAAM,EAAO,CAAC,CAE5D,EAAK,EAAO,IAAI,CAAK,MAAI,SAAsB,EAAK,EAAU,CAAC,GAAG,EAAM,CAAC,CAAC,CAAC,EAUI,SAAgB,EAAiB,EAAU,CAAC,MAAO,IAAO,CAAC,IAAM,EAAIF,EAAO,KAAK,CAAM,CAAC,EAAO,GAAWC,GAAU,CAAM,CAAC,EAAM,GAAUA,GAAU,CAAqB,EAAaC,MAAgB,CAC1S,IAAM,EAAY,EAAO,WACzB,GADwC,GAAO,EAAS,EAAI,QAAQ,YAAY,CAAM,GAAQ,EAAU,EAA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