{"version":3,"file":"IframeContainer.asjR_nSY.mjs","names":["useState","useRef","useMemo"],"sources":["https:/framerusercontent.com/modules/NCeQ5JGtvcBkpykaRc7C/GR00OaCzumyZEdtmv2NU/Overrides.js","https:/framer.com/m/Overrides-a3xD.js@GR00OaCzumyZEdtmv2NU","https:/framerusercontent.com/modules/3kwmW4MMUYsurb59hpYe/eZYuiFGAPpW1g9OnzNdG/Apis.js","https:/framer.com/m/Apis-A9fL.js@eZYuiFGAPpW1g9OnzNdG","https:/framerusercontent.com/modules/jhiHzKZ5jNat5PXUsNYJ/ZIEa8madvZJcD1dPUHxl/IframeContainer.js"],"sourcesContent":["// Get Started: https://www.framer.com/developers\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useState,createContext,useEffect,forwardRef}from\"react\";const isBrowser=typeof window!==undefined;export const isProduction=isBrowser&&(window?.location?.hostname?.includes(\"gymboxx.com\")||window?.location?.hostname?.includes(\"gymboxx.store\"));export const BASE_URL=isProduction?\"https://prod.supp.fitness\":\"https://dev1.supp.fitness\";// 짐박스 서버 Api 사용 가이드입니다\n// https://www.notion.so/supplies/Framer-API-2a0cac6c910d8006a199eddeaa24008a\n// Swagger API 문서\n// (앱서버 예시) https://prod.supp.fitness/app/swagger-api-docs/#/Gym/GymController_getGymPTTrainer\n// Apis 사용법 예시 - 아래 블럭을 복사해 사용하세요\nexport function withExample(Component){// 1. 이름 알맞게 수정\nreturn /*#__PURE__*/forwardRef((props,ref)=>{const[exampleData,setExampleData]=useState()// 2. 이름 알맞게 수정\n;const getExampleData=async()=>{// 3. 이름 알맞게 수정\ntry{fetch(`${BASE_URL}/app/gym`)// 4. (중요) 엔드포인트 수정\n.then(res=>res.json()).then(json=>setExampleData(// 2번에서 수정한 이름에 맞게 수정\n    json// 필요한 데이터에 맞게 수정 (스웨거 응답값 참고)\n    ));}catch(err){console.error(err);}};useEffect(()=>{getExampleData()// 3번에서 수정한 이름에 맞게 수정\n;},[]);return /*#__PURE__*/_jsx(Component,{...props,data:exampleData})// 빨간줄 수정 - 2번이름에 맞게 수정\n;})// 빨간줄 모두 없게 한 뒤 주석 모두 삭제해주세요.\n;}// 동적 Apis 사용법 예시 - 아래 블럭을 복사해 사용하세요\nexport function withExampleDynamic(Component){// 1. 이름 알맞게 수정\nreturn /*#__PURE__*/forwardRef((props,ref)=>{const[exampleData,setExampleData]=useState()// 2. 이름 알맞게 수정\n;const getExampleData=async()=>{// 3. 이름 알맞게 수정\ntry{const gymId=getGymIdFromPath()// 알맞게 수정\n;fetch(`${BASE_URL}/app/gym/${gymId}/name`)// 4. (중요) 엔드포인트 수정\n.then(res=>res.json()).then(json=>setExampleData(// 2번에서 수정한 이름에 맞게 수정\n    json.gym_name// (중요) 필요한 데이터에 맞게 수정\n    ));}catch(err){console.error(err);}};useEffect(()=>{getExampleData()// 3번에서 수정한 이름에 맞게 수정\n;},[]);return /*#__PURE__*/_jsx(Component,{...props,data:exampleData})// 빨간줄 수정 - 2번이름에 맞게 수정\n;})// 빨간줄 모두 없게 한 뒤 주석 모두 삭제해주세요.\n;}function parseCSVToJSON(csv){const lines=csv.split(\"\\n\").filter(line=>line.trim());if(lines.length<2)return[];// 헤더 파싱\nconst headers=lines[0].split(\",\").map(h=>h.trim());// 데이터 파싱\nconst data=lines.slice(1).map(line=>{const values=line.split(\",\").map(v=>v.trim());const obj={};headers.forEach((header,index)=>{obj[header]=values[index]||\"\";});return obj;});return data;}const CMS_SPREADSHEET_ID=\"1TLw08aYm89AClAWH1qfWBuZOpXBj8f8q-ldEK0s9aOg\";const CMS_SHEET_GID=\"1884952724\";export const CMSContext=isBrowser?/*#__PURE__*/createContext(\"\"):null;export function withCMSfromGoogleSheet(Component){// 1. 이름 알맞게 수정\nreturn /*#__PURE__*/forwardRef((props,ref)=>{const[cmsData,setCmsData]=useState({});async function fetchSheetData(){try{if(!isBrowser)return;// CSV 형식으로 가져오기 (API 키 불필요)\nconst csvUrl=`https://docs.google.com/spreadsheets/d/${CMS_SPREADSHEET_ID}/export?format=csv&gid=${CMS_SHEET_GID}`;const response=await fetch(csvUrl);if(!response.ok){throw new Error(`HTTP error! status: ${response.status}`);}const csvText=await response.text();if(typeof window!==undefined){window.localStorage.setItem(\"CMSraw\",csvText);}const parsedData=parseCSVToJSON(csvText);setCmsData(parsedData);}catch(err){console.error(\"데이터 로드 실패:\",err);}}useEffect(()=>{fetchSheetData();},[]);if(!isBrowser||!CMSContext?.Provider)return /*#__PURE__*/_jsx(Component,{...props});return /*#__PURE__*/_jsx(CMSContext.Provider,{value:cmsData,children:/*#__PURE__*/_jsx(Component,{...props,data:cmsData})});});}const DEFAULT_GYMID=48;function getGymIdFromPath(){if(!isBrowser)return 0;const path=typeof window!==undefined&&window?.location?.pathname;const match=path?.match(/\\/gym\\/(\\d+)/);const gymId=match?match[1]:0;return gymId?gymId:DEFAULT_GYMID;}function getTrainerIdFromQuery(key){if(!isBrowser)return\"\";const urlParams=new URLSearchParams(window.location.search);const value=urlParams.get(key);return value||\"\";}export function withGymIdFromPath(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const gymId=getGymIdFromPath();return /*#__PURE__*/_jsx(Component,{gymId:gymId});});}export function withGymList(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[gymList,setGymList]=useState(\"default\");const getGymList=async()=>{try{fetch(`${BASE_URL}/app/gym`).then(res=>res.json()).then(json=>setGymList(Array.isArray(json?.gym_list)?json.gym_list:[]));}catch(err){console.error(err);}};useEffect(()=>{getGymList();},[]);console.log(\"gymList\",gymList);return /*#__PURE__*/_jsx(Component,{...props,data:gymList});});}export function withGymOTavailability(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[gymAvailablity,setGymAvailability]=useState(null);const getGymAvailablity=async()=>{try{fetch(`${BASE_URL}/app/gym/2/pt/ot/check`).then(res=>res.json()).then(json=>setGymAvailability(json.is_gym_ot_available));}catch(err){console.error(err);}};useEffect(()=>{getGymAvailablity();},[]);return /*#__PURE__*/_jsx(Component,{...props,data:gymAvailablity});});}//트레이너 리스트\nexport function withTrainerList(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[trainerList,setTrainerList]=useState();const getTrainerList=async()=>{try{const gymId=getGymIdFromPath();fetch(`${BASE_URL}/public/gym/${gymId}/trainers`).then(res=>res.json()).then(json=>setTrainerList(json));}catch(err){console.error(err);}};useEffect(()=>{getTrainerList();},[]);return /*#__PURE__*/_jsx(Component,{...props,data:trainerList});});}//지점특징 리스트\nexport function withGymFeature(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[GymFeature,setGymFeature]=useState();const getGymFeature=async()=>{try{const gymId=getGymIdFromPath();fetch(`${BASE_URL}/public/gym/${gymId}/features`).then(res=>res.json()).then(json=>setGymFeature(json));}catch(err){console.error(err);}};useEffect(()=>{getGymFeature();},[]);return /*#__PURE__*/_jsx(Component,{...props,data:GymFeature});});}export function withMachineList(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[machineList,setMachineList]=useState();const getMachineList=async()=>{try{const gymId=getGymIdFromPath();fetch(`${BASE_URL}/public/gym/${gymId}/machines`).then(res=>res.json()).then(json=>setMachineList(json));}catch(err){console.error(err);}};useEffect(()=>{getMachineList();},[]);return /*#__PURE__*/_jsx(Component,{...props,data:machineList});});}//트레이너별 링크 생성\n// export function NavigateWithTrainerId(props): Override {\n//     const href = props.trainerIdLink // TrainerListContainer에서 넘겨준 완성 URL\n//     return {\n//         // a/href가 있어도, 기본 이동을 막고 SPA 방식으로 처리\n//         onTap(event?: any) {\n//             try {\n//                 event?.preventDefault?.()\n//             } catch {}\n//             if (href) {\n//                 history.pushState({}, \"\", href) // URL만 변경 (리로드 없음)\n//                 window?.dispatchEvent?.(new Event(\"popstate\")) // URL 변경 신호 → 상세 패널 훅이 감지\n//             }\n//         },\n//         // 우클릭/복사/SEO를 위해 href는 유지할 수 있음\n//         href: href,\n//     }\n// }\n\nexport const __FramerMetadata__ = {\"exports\":{\"BASE_URL\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"CMSContext\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withTrainerList\":{\"type\":\"reactHoc\",\"name\":\"withTrainerList\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCMSfromGoogleSheet\":{\"type\":\"reactHoc\",\"name\":\"withCMSfromGoogleSheet\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withExample\":{\"type\":\"reactHoc\",\"name\":\"withExample\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withGymOTavailability\":{\"type\":\"reactHoc\",\"name\":\"withGymOTavailability\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withGymIdFromPath\":{\"type\":\"reactHoc\",\"name\":\"withGymIdFromPath\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withGymList\":{\"type\":\"reactHoc\",\"name\":\"withGymList\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withMachineList\":{\"type\":\"reactHoc\",\"name\":\"withMachineList\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"isProduction\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withExampleDynamic\":{\"type\":\"reactHoc\",\"name\":\"withExampleDynamic\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withGymFeature\":{\"type\":\"reactHoc\",\"name\":\"withGymFeature\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Overrides.map","/*\n * Overrides\n *\n * Learn More: https://www.framer.com/asset-urls\n */\n\nexport * from \"https://framerusercontent.com/modules/NCeQ5JGtvcBkpykaRc7C/GR00OaCzumyZEdtmv2NU/Overrides.js\"\n","import{useState,useEffect}from\"react\";import{BASE_URL,isProduction}from\"https://framer.com/m/Overrides-a3xD.js@GR00OaCzumyZEdtmv2NU\";const isBrowser=typeof window!==undefined;const DEFAULT_GYM_ID=isProduction?71:5// 여의도 & dev난곡\n;export function getGymIdFromPath(){if(!isBrowser)return 0;const path=typeof window!==undefined&&window?.location?.pathname;const match=path?.match(/\\/gym\\/(\\d+)/);const gymId=match?match[1]:0;return gymId?gymId:DEFAULT_GYM_ID;}const useQuery=url=>{const[data,setData]=useState();const[error,setError]=useState();const[isLoading,setIsLoading]=useState(false);const getData=()=>{setIsLoading(true);fetch(url).then(res=>res.json()).then(json=>setData(json)).catch(err=>{if(err){setError(err);}}).finally(()=>{setIsLoading(false);});};useEffect(()=>{if(!isBrowser)return;getData();},[url]);return{error,isLoading,data,refetch:getData};};export const useGymListQuery=()=>{const{data,error,isLoading,refetch}=useQuery(`${BASE_URL}/public/gym`);return{data,error,isLoading,refetch};};export const useLazyMachineListQuery=()=>{return async gymId=>{const response=await fetch(`${BASE_URL}/public/gym/${gymId}/machines`).then(res=>res.json());return response;};};export const useLazyGymMachinesSummaryQuery=()=>{return async gymIdList=>{const response=await fetch(`${BASE_URL}/public/gym/machines/summary?gymIdList=${JSON.stringify(gymIdList)}`).then(res=>res.json());return response;};};export default useQuery;\nexport const __FramerMetadata__ = {\"exports\":{\"useGymListQuery\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"default\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getGymIdFromPath\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useLazyGymMachinesSummaryQuery\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useLazyMachineListQuery\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Apis.map","/*\n * Apis\n *\n * Learn More: https://www.framer.com/asset-urls\n */\n\nexport * from \"https://framerusercontent.com/modules/3kwmW4MMUYsurb59hpYe/eZYuiFGAPpW1g9OnzNdG/Apis.js\"\nexport { default } from \"https://framerusercontent.com/modules/3kwmW4MMUYsurb59hpYe/eZYuiFGAPpW1g9OnzNdG/Apis.js\"\n","import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useState,useRef,useMemo}from\"react\";import{getGymIdFromPath}from\"https://framer.com/m/Apis-A9fL.js@eZYuiFGAPpW1g9OnzNdG\";const styles={container:{width:\"100vw\",overflowY:\"hidden\",backgroundColor:\"#030303\"},iframe:{width:\"100%\",border:\"none\"}};function addQueryParam(url,key,value){const separator=url.includes(\"?\")?\"&\":\"?\";// 기존 코드의 `if (!value)`는 0을 \"없음\"으로 취급해버림 → 의도치 않게 빠질 수 있어 수정\nif(value===null||value===undefined||value===\"\")return`${url}`;return`${url}${separator}${key}=${value}`;}export default function IframeContainer(props){const[iframeheight,setIframeHeight]=useState(0);const iframeRef=useRef(null);const isClient=typeof window!==\"undefined\";useEffect(()=>{if(!isClient)return;const handleMessage=event=>{if(event?.data?.type===\"IFRAME_HEIGHT\"&&props.uniqueName===event.data.name){setIframeHeight(event.data.height);}if(event?.data?.type===\"NAVIGATE\"&&!!event?.data?.url){window.location.href=`${window.location.origin}`+event?.data?.url;}};window.addEventListener(\"message\",handleMessage);return()=>window.removeEventListener(\"message\",handleMessage);},[isClient,props.uniqueName]);const urlWithGymId=useMemo(()=>{const params=isClient?new URLSearchParams(window.location.search):new URLSearchParams;const base=addQueryParam(props.url,\"gymSelector\",props.gymSelector?1:0);const withLat=addQueryParam(base,\"latitude\",params.get(\"lat\")||0);const withLong=addQueryParam(withLat,\"longitude\",params.get(\"long\")||0);const gymId=isClient?getGymIdFromPath?.()||41:41;return addQueryParam(withLong,\"gymId\",gymId);},[isClient,props.url,props.gymSelector]);return /*#__PURE__*/_jsx(\"div\",{style:{...styles.container,maxWidth:props.maxWidth?props.maxWidth:\"100%\"},id:`${props.uniqueName}`,children:/*#__PURE__*/_jsx(\"iframe\",{src:urlWithGymId,style:{...styles.iframe,height:iframeheight?iframeheight:props.defaultHeight?props.defaultHeight:\"100vh\"},ref:iframeRef})});}addPropertyControls(IframeContainer,{url:{title:\"url\",type:ControlType.String,defaultValue:\"https://web.supp.fitness/web/iframe\"},uniqueName:{type:ControlType.String,title:\"uniqueName\",defaultValue:\"\"},maxWidth:{title:\"maxWidth\",type:ControlType.Number,defaultValue:1440,optional:true},defaultHeight:{title:\"defaultHeight\",type:ControlType.Number,defaultValue:2e3},gymSelector:{title:\"gymSelector\",type:ControlType.Boolean,defaultValue:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"IframeContainer\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./IframeContainer.map"],"mappings":"oOAC2C,IAA+D,CAAuD,EAAyB,GAAQ,UAAU,UAAU,SAAS,cAAc,EAAE,GAAQ,UAAU,UAAU,SAAS,gBAAgB,qBEAnS,SAAgB,GAAkB,CAAyF,IAAM,GAAjC,GAAQ,UAAU,WAA2B,MAAM,eAAe,CAA8B,OAAjB,EAAM,EAAM,GAAG,IAAqB,yBAD9K,IAA+F,CAAgD,EAAe,EAAa,GAAG,sBCOnG,ICPkP,SAAS,EAAc,EAAI,EAAI,EAAM,CAAC,IAAM,EAAU,EAAI,SAAS,IAAI,CAAC,IAAI,IACjX,OAA3D,GAAQ,MAAyB,IAAQ,GAAS,GAAG,IAAY,GAAG,IAAM,IAAY,EAAI,GAAG,IAAS,SAAwB,EAAgB,EAAM,CAAC,GAAK,CAAC,EAAa,GAAiBA,EAAS,EAAE,CAAO,EAAUC,EAAO,KAAK,CAAO,EAAgB,IAAS,OAAY,MAAc,CAAC,GAAG,CAAC,EAAS,OAAO,IAAM,EAAc,GAAO,CAAI,GAAO,MAAM,OAAO,iBAAiB,EAAM,aAAa,EAAM,KAAK,MAAM,EAAgB,EAAM,KAAK,OAAO,CAAK,GAAO,MAAM,OAAO,YAAc,GAAO,MAAM,MAAK,EAAO,SAAS,KAAK,GAAG,EAAO,SAAS,SAAS,GAAO,MAAM,MAAwD,OAAjD,EAAO,iBAAiB,UAAU,EAAc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