{"version":3,"file":"ReceiptLabelComponent.3nir2XZK.mjs","names":["transitionStyle","c","primaryDiscountedPrice","useFormStore","useFormStore","useFormStore","useFormStore","useFormStore","useFormStore","useFormStore","toCategoryMap","toCategoryMap","useState","e","React","FadeIn","useMemo"],"sources":["https:/framerusercontent.com/modules/EIVOVFb6xjz6Fvh11iJi/xWzF6BpHgBg3ynKGezHq/VacationDisplay.js","https:/framerusercontent.com/modules/jTRIrvvdhM8hGc8tF4E7/Q2QLVylG6dtj4TyzXmqg/EvaluateCoupons.js","https:/framerusercontent.com/modules/j1JmQpFlkCqsnz6Zbn4l/2xQ5QMTphaYXKxXhCCKm/ReservationForm.js","https:/framerusercontent.com/modules/k847LPNIMdkhfIs0ouwF/EUEOlsedw6DGLY16dhfq/AdditionalService.js","https:/framerusercontent.com/modules/t32tReeHmrCTzbf5rVbb/4t3CRMaMn0Lfv4MD0qXL/PriceDisplay.js","https:/framerusercontent.com/modules/j1JmQpFlkCqsnz6Zbn4l/YjsxyPUIDz3mFiWkcq8K/ReservationForm.js","https:/framerusercontent.com/modules/t32tReeHmrCTzbf5rVbb/TLfCNhuEI4KQbK1YsDnN/PriceDisplay.js","https:/framerusercontent.com/modules/j1JmQpFlkCqsnz6Zbn4l/sQOM0NWjDE6RjJGyiNKC/ReservationForm.js","https:/framerusercontent.com/modules/t32tReeHmrCTzbf5rVbb/De8eB0ZfIM1LfAH1YA89/PriceDisplay.js","https:/framerusercontent.com/modules/j1JmQpFlkCqsnz6Zbn4l/NSaVcHRS2cI5mCDsFap1/ReservationForm.js","https:/framerusercontent.com/modules/t32tReeHmrCTzbf5rVbb/3ELxjnSVbzBtkBySqj4t/PriceDisplay.js","https:/framerusercontent.com/modules/j1JmQpFlkCqsnz6Zbn4l/BYasgVKKRdsmyswKAly1/ReservationForm.js","https:/framerusercontent.com/modules/t32tReeHmrCTzbf5rVbb/R6m5PfQA9MX51zW1YOpv/PriceDisplay.js","https:/framerusercontent.com/modules/j1JmQpFlkCqsnz6Zbn4l/bGMmyNcEKojl4EjjVGtC/ReservationForm.js","https:/framerusercontent.com/modules/t32tReeHmrCTzbf5rVbb/9tPAzOAQErQII62FaBq1/PriceDisplay.js","https:/framerusercontent.com/modules/j1JmQpFlkCqsnz6Zbn4l/uk405UIITh0zyxiSBkhM/ReservationForm.js","https:/framerusercontent.com/modules/t32tReeHmrCTzbf5rVbb/ihBLS6K1p7JMVKDqGKPI/PriceDisplay.js","https:/framerusercontent.com/modules/j1JmQpFlkCqsnz6Zbn4l/kgR4ltfA7bgAS5uFS2LP/ReservationForm.js","https:/framerusercontent.com/modules/t32tReeHmrCTzbf5rVbb/vpRaQ9eP11jyrHeciRqe/PriceDisplay.js","https:/framerusercontent.com/modules/VB0CUTtrSV4ToCjcWKaC/oO5bmFEiZU9AscOIfYRy/ReceiptLabelComponent.js"],"sourcesContent":["// VacationDisplay.tsx\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useStore}from\"https://framerusercontent.com/modules/c2GloFFeVhaMQsbMcdTk/XiJZ0vjlltE7FPQAQ8Lk/MainStore.js\";import{MONTH_NAMES}from\"https://framerusercontent.com/modules/r9TbzE6j44OxXp6KiYut/AVa7liQ3ciCThgvwP0SB/MonthDisplay.js\";import{parseDate}from\"https://framerusercontent.com/modules/1J9pgwrYtYGWgtmRStO4/muZZYJxbZe3foLJMfVTS/DateUtils.js\";const transitionStyle=visible=>({opacity:visible?1:0,color:\"inherit\",transition:\"opacity 0.3s ease-in-out\",display:\"inline-block\"});const WEEKDAYS=[\"일\",\"월\",\"화\",\"수\",\"목\",\"금\",\"토\"];function formatFullDate(date){const d=new Date(date.year,date.month,date.day);const weekday=WEEKDAYS[d.getDay()];return`${d.getFullYear()}.${String(d.getMonth()+1).padStart(2,\"0\")}.${String(d.getDate()).padStart(2,\"0\")} (${weekday})`;}function calculatePeriod(start,end){const msPerDay=1e3*60*60*24;const days=Math.round((end.getTime()-start.getTime())/msPerDay);const nights=days;const fullDays=days+1;return`${nights}박 ${fullDays}일`;}export function displayStartMonth(Component){return props=>{const[store]=useStore();const start=store.firstDate;const end=store.secondDate;const show=!!start;const showYear=start&&end&&start.year!==end.year;const text=start?`${showYear?`${start.year}`:`${start.year}`}. ${MONTH_NAMES[start.month]}`:\"\";return /*#__PURE__*/_jsx(Component,{...props,text:text,style:transitionStyle(show)});};}export function displayStartDay(Component){return props=>{const[store]=useStore();const start=store.firstDate;const text=start?String(start.day).padStart(2,\"0\"):\"\";const show=!!start;return /*#__PURE__*/_jsx(Component,{...props,text:text,style:transitionStyle(show)});};}export function displayEndMonth(Component){return props=>{const[store]=useStore();const start=store.firstDate;const end=store.secondDate;const show=!!end;const showYear=start&&end&&start.year!==end.year;const text=end?`${showYear?`${end.year}`:`${end.year}`}. ${MONTH_NAMES[end.month]}`:\"\";return /*#__PURE__*/_jsx(Component,{...props,text:text,style:transitionStyle(show)});};}export function displayEndDay(Component){return props=>{const[store]=useStore();const end=store.secondDate;const text=end?String(end.day).padStart(2,\"0\"):\"\";const show=!!end;return /*#__PURE__*/_jsx(Component,{...props,text:text,style:transitionStyle(show)});};}export function displayStartDate(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const start=store.firstDate||firstDate;const end=store.secondDate||secondDate;const show=!!start&&!!end;const text=show?formatFullDate(start):\"\";return /*#__PURE__*/_jsx(Component,{...props,text:text,style:transitionStyle(show)});};}export function displayEndDate(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const start=store.firstDate||firstDate;const end=store.secondDate||secondDate;const show=!!start&&!!end;const text=show?formatFullDate(end):\"\";return /*#__PURE__*/_jsx(Component,{...props,text:text,style:transitionStyle(show)});};}export function displayTilde(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const start=store.firstDate||firstDate;const end=store.secondDate||secondDate;const show=!!start&&!!end;return /*#__PURE__*/_jsx(Component,{...props,text:show?\" ~ \":\"\",style:transitionStyle(show)});};}export function displayPeriod(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const start=store.firstDate||firstDate;const end=store.secondDate||secondDate;const show=!!start&&!!end;const text=show?calculatePeriod(new Date(start.year,start.month,start.day),new Date(end.year,end.month,end.day)):\"\";return /*#__PURE__*/_jsx(Component,{...props,text:text,style:transitionStyle(show)});};}\nexport const __FramerMetadata__ = {\"exports\":{\"displayStartMonth\":{\"type\":\"reactHoc\",\"name\":\"displayStartMonth\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayPeriod\":{\"type\":\"reactHoc\",\"name\":\"displayPeriod\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayStartDay\":{\"type\":\"reactHoc\",\"name\":\"displayStartDay\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayStartDate\":{\"type\":\"reactHoc\",\"name\":\"displayStartDate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayEndDate\":{\"type\":\"reactHoc\",\"name\":\"displayEndDate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayEndDay\":{\"type\":\"reactHoc\",\"name\":\"displayEndDay\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayEndMonth\":{\"type\":\"reactHoc\",\"name\":\"displayEndMonth\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayTilde\":{\"type\":\"reactHoc\",\"name\":\"displayTilde\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","// EvaluateCoupons.ts\n// UNDER CONSTRUCTION /////////////////////////////////////\nimport{unmuDayLimits}from\"https://framerusercontent.com/modules/eNYxylYRmdtVvI7ZdKLb/0en1WDSZhtTM3MSYaSzV/UnmuMembership.js\";function getKSTDate(baseDate=new Date){const utc=baseDate.getTime()+baseDate.getTimezoneOffset()*6e4;return new Date(utc+9*60*60*1e3);}function toDate(obj){return new Date(obj.year,obj.month,obj.day);}function getKey(d){return`${d.getFullYear()}-${String(d.getMonth()+1).padStart(2,\"0\")}-${String(d.getDate()).padStart(2,\"0\")}`;}// Step 1: Initial price 계산\nexport function calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate){let first=null;let second=null;if(firstDate&&secondDate){first=toDate(firstDate);second=new Date(toDate(secondDate));}else{first=toDate(store.firstDate);second=new Date(toDate(store.secondDate));}second.setDate(second.getDate()-1)// 퇴실일은 계산에 포함 X\n;const dailyItems=[];const basePrices=[];const categoryCount={Weekday:0,Weekend:0,Peak:0};// UNDER CONSTRUCTION /////////////////////////////////////\nconst isUnmu=[\"UNMU 6\",\"UNMU 9\",\"UNMU 12\",\"UNMU 24\",\"TERENE 6\",\"TERENE 9\",\"TERENE 12\",\"TERENE 24\"].includes(store.membership);for(let d=new Date(first);d<=second;d.setDate(d.getDate()+1)){const key=getKey(d);const category=categoryMap[key]??\"Weekday\";const def=categoryDefs[category];if(!def){console.warn(\"[calculateInitialPrices] unknown category:\",category);continue;}const basePrice=Number(def.unmu_price);basePrices.push(basePrice);let price;if(store.membership===\"Non-Member\"){price=basePrice;}else if(isUnmu){const limits=unmuDayLimits[store.membership];let categoryKey=\"Weekday\";if(category===\"Weekend\")categoryKey=\"Weekend\";else if(category===\"Peak-Weekday\"||category===\"Peak-Weekend\")categoryKey=\"Peak\";const current=categoryCount[categoryKey];const allowed=limits[categoryKey];if(current<allowed){price=Math.round(basePrice*1);}else{price=Math.round(basePrice*1)// 1.4였는데, 멤버쉽이 쿠폰화되면서 이부분은 아얘 폐지되는게 맞다고 생각함\n;}categoryCount[categoryKey]+=1;}else{// 'All-Free' case\nprice=0;}dailyItems.push({date:key,price,category});}// initialPrice는 basePrice만 더해서 계산\nconst initialPrice=basePrices.reduce((acc,val)=>acc+val,0);return{initialPrice,dailyItems};}/////////////////////////////////////////////////////////////////////////////////////////////////////////\n/////////////////////////////////////////////////////////////////////////////////////////////////////////\n/////////////////////////////////////////////////////////////////////////////////////////////////////////\n/////////////////////////////////////////////////////////////////////////////////////////////////////////\nexport function filterCoupons(coupons,store,dailyItems){const{enteredCouponCode,signupDate}=store;const totalPrice=dailyItems.reduce((acc,i)=>acc+i.price,0);const stayLength=dailyItems.length;const stayDates=dailyItems.map(i=>i.date);const allCategories=new Set(dailyItems.map(i=>i.category));const now=getKSTDate();function kstEndOfDayFromYMD(ymd){const[y,m,d]=ymd.split(\"-\").map(v=>Number(v));return new Date(Date.UTC(y,m-1,d,14,59,59,999))// KST(UTC+9) 23:59:59.999\n;}// const codes = coupons\n//     .filter((c) => c.coupon_code && c.coupon_code[0] == \"H\") // code 필드가 존재하는 쿠폰만\n//     .map((c) => c.coupon_code as string) // 문자열로 추출\nconst passedCoupons=coupons.filter(c=>{if(!c.enabled)return false;if(c.type===\"code\"&&(!enteredCouponCode||!enteredCouponCode.includes(c.coupon_code))){// if (enteredCouponCode.length > 0 && c.coupon_code.includes(\"H8\"))\n//     alert(\n//         `A-1) entered: ${JSON.stringify(enteredCouponCode)}\\nc.coupon_code: ${c.coupon_code}\\n일치여부: ${enteredCouponCode.includes(c.coupon_code)}`\n//     )\nreturn false;}// // Check if validity_value (YYYY-MM-DD) is expired\n// if (c.validity_value) {\n//     const validityDate = new Date(`${c.validity_value}T00:00:00+09:00`) // KST\n//     // console.log(JSON.stringify(validityDate))\n//     // console.log(now)\n//     // console.log(validityDate < now)\n//     if (validityDate < now) {\n//         if (\n//             enteredCouponCode.length > 0 &&\n//             c.coupon_code.includes(\"H8\")\n//         )\n//             alert(`A-3`)\n//         return false\n//     }\n// }\nif(c.validity_value){const validityDate=kstEndOfDayFromYMD(c.validity_value);if(now.getTime()>validityDate.getTime()){// if (\n//     (enteredCouponCode?.length ?? 0) > 0 &&\n//     c.coupon_code?.includes(\"H8\")\n// )\n//     alert(`A-3`)\nreturn false;}}// Check if coupon_due (full ISO datetime) is expired\nif(c.coupon_due){const dueDate=new Date(c.coupon_due);if(dueDate<now){// if (\n//     enteredCouponCode.length > 0 &&\n//     c.coupon_code.includes(\"H8\")\n// )\n//     alert(`A-4`)\nreturn false;}}const conditions=Array.isArray(c.conditions_json)?c.conditions_json:[];for(const cond of conditions){if(cond.type===\"membership\"&&!cond.members.includes(store.membership)){return false;}if(cond.type===\"phase\"){// 1단계: phase 조건이 맞는지 확인\nif(!cond.phases.includes(store.phase)){return false;}}if(cond.type===\"revisit\"&&!cond.days.includes(store.revisit)){return false;}if(cond.type===\"minimum_price\"&&totalPrice<Number(cond.min??0)){return false;}if(cond.type===\"relay\"){if(stayLength<(Number(cond.min)??0))return false;if(cond.max&&stayLength>Number(cond.max))return false;}if(cond.type===\"date\"){const start=cond.startDate?getKSTDate(new Date(cond.startDate)):null;const end=cond.endDate?getKSTDate(new Date(cond.endDate)):null;const matched=stayDates.some(d=>{const date=getKSTDate(new Date(d));return(!start||date>=start)&&(!end||date<=end);});if(!matched){return false;}}if(cond.type===\"seasonal\"){const allowed=new Set(cond.allowedCategories||[]);const matched=[...allCategories].some(c=>allowed.has(c));if(!matched)return false;}}return true;});// if (enteredCouponCode && enteredCouponCode.length > 0)\n//     alert(\n//         `A-2) entered: ${enteredCouponCode}\\nexisting: ${codes}\\npassed: ${JSON.stringify(passedCoupons)}`\n//     )\nreturn{passedPrimaryCoupons:passedCoupons.filter(c=>c.discount_type===\"percentage\"&&c.type===\"global\"),passedSecondaryCoupons:passedCoupons.filter(c=>c.discount_type===\"percentage\"&&c.type===\"code\"||c.discount_type===\"fixed\")};}/////////////////////////////////////////////////////////////////////////////////////////////////////////\n/////////////////////////////////////////////////////////////////////////////////////////////////////////\n/////////////////////////////////////////////////////////////////////////////////////////////////////////\n/////////////////////////////////////////////////////////////////////////////////////////////////////////\nexport function evaluateCoupons(primaryCoupons,secondaryCoupons,dailyItems,store){const totalPrice=dailyItems.reduce((sum,d)=>sum+d.price,0);// console.log(`total price: ${totalPrice}`)\nconst ignoredCodeCoupons=[];if(store?.membership===\"All-Free\"){const id=\"all-free\";const baseCoupon={id,name:id,description:id,amount:totalPrice};return{primaryDiscountedPrice:0,secondaryDiscountedPrice:0,primaryDetails:[baseCoupon],secondaryDetails:[]};}let primaryTotalDiscount=0;let secondaryTotalDiscount=0;const primaryDetailsMap1=new Map// Step 1\n;const primaryDetailsMap2=new Map// Step 2\n;const secondaryDetailsMap=new Map;const couponRemainingScope=new Map;for(const c of[...primaryCoupons,...secondaryCoupons]){const scope=c.scope??-1;couponRemainingScope.set(c.coupon_instance_id||c.coupon_definition_id,scope);}for(let i=0;i<dailyItems.length;i++){const day=dailyItems[i];// console.log(JSON.stringify(day))\nconst originalPrice=day.price;let primaryDiscountedPrice=originalPrice;const dateStr=day.date;// === Step 1: Primary Coupons ===\nfor(const coupon of primaryCoupons){if(coupon.discount_type!==\"percentage\")continue;const couponId=coupon.coupon_instance_id||coupon.coupon_definition_id;const remainingScope=couponRemainingScope.get(couponId);if(remainingScope===0)continue;const conditions=Array.isArray(coupon.conditions_json)?coupon.conditions_json:[];let skipCoupon=false;for(const cond of conditions){// Phase 조건 로직\nif(cond.type===\"phase\"){if(!cond.phases.includes(store?.phase)){skipCoupon=true;break;}// Phase-1이면 signup_date로부터 1년 지난 경우 skip\nif(store?.phase===\"Phase-1\"&&store.signup_date&&day.date// 현재 날짜 문자열\n){const signupDate=new Date(`${store.signup_date}T00:00:00+09:00`);const oneYearLater=new Date(signupDate);oneYearLater.setFullYear(oneYearLater.getFullYear()+1);const currentDate=getKSTDate(new Date(day.date));if(currentDate>oneYearLater){skipCoupon=true;break;}}}if(cond.type===\"relay\"&&i===0){skipCoupon=true;break;}if(cond.type===\"seasonal\"){const allowed=new Set(cond.allowedCategories||[]);if(!allowed.has(day.category)){skipCoupon=true;break;}}if(cond.type===\"date\"){const start=cond.startDate?getKSTDate(new Date(cond.startDate)):null;const end=cond.endDate?getKSTDate(new Date(cond.endDate)):null;const current=getKSTDate(new Date(dateStr));if(start&&current<start||end&&current>end){skipCoupon=true;break;}}}if(skipCoupon)continue;const discountValue=Number(coupon.discount_value);let max_amount=Infinity;for(const cond of conditions){if(cond.type===\"applied_discount\"&&cond.max){max_amount=Number(cond.max);}}let amount=Math.min(Math.round(originalPrice*(discountValue/100)),max_amount);// console.log(\n//     `[Primary][${dateStr}] Coupon: ${coupon.name} (${couponId}), Original Price: ${originalPrice}, Discount Value: ${discountValue}, Max Amount: ${max_amount}, Amount: ${amount}`\n// )\nif(primaryDiscountedPrice<amount)amount=primaryDiscountedPrice;if(amount>0){primaryDiscountedPrice-=amount;primaryTotalDiscount+=amount;const existing=primaryDetailsMap1.get(couponId);if(existing)existing.amount+=amount;else{primaryDetailsMap1.set(couponId,{id:couponId,name:coupon.name,description:coupon.description,amount});}if(remainingScope>0){couponRemainingScope.set(couponId,remainingScope-1);}}}// === Step 2: Membership Coupon ===\nconst membershipCoupon=store?.membershipCouponByDate?.[dateStr];const def=membershipCoupon?.definition;if(membershipCoupon&&def){const discountValue=Number(def.discount_value);let amount=0;if(def.discount_type===\"percentage\"){amount=Math.round(primaryDiscountedPrice*(discountValue/100));}else if(def.discount_type===\"fixed\"){amount=discountValue;}if(primaryDiscountedPrice<amount)amount=primaryDiscountedPrice;if(amount>0){primaryDiscountedPrice-=amount;primaryTotalDiscount+=amount;const id=membershipCoupon.coupon_instance_id;const existing=primaryDetailsMap2.get(id);if(existing)existing.amount+=amount;else{primaryDetailsMap2.set(id,{id,name:membershipCoupon.name??id,description:def.description??\"\",amount});}}}let secondaryDiscountedPrice=primaryDiscountedPrice;// === Step 3: Secondary Coupons (percentage only) ===\nfor(const coupon of secondaryCoupons){if(coupon.discount_type!==\"percentage\")continue;const couponId=coupon.coupon_instance_id||coupon.coupon_definition_id;const remainingScope=couponRemainingScope.get(couponId);if(remainingScope===0)continue;const conditions=Array.isArray(coupon.conditions_json)?coupon.conditions_json:[];let skipCoupon=false;for(const cond of conditions){// Phase 조건 로직\nif(cond.type===\"phase\"){if(!cond.phases.includes(store?.phase)){skipCoupon=true;break;}// Phase-1이면 signup_date로부터 1년 지난 경우 skip\nif(store?.phase===\"Phase-1\"&&store.signup_date&&day.date// 현재 날짜 문자열\n){const signupDate=new Date(`${store.signup_date}T00:00:00+09:00`);const oneYearLater=new Date(signupDate);oneYearLater.setFullYear(oneYearLater.getFullYear()+1);const currentDate=getKSTDate(new Date(day.date));if(currentDate>oneYearLater){skipCoupon=true;break;}}}if(cond.type===\"relay\"&&i===0){skipCoupon=true;break;}if(cond.type===\"seasonal\"){const allowed=new Set(cond.allowedCategories||[]);if(!allowed.has(day.category)){skipCoupon=true;break;}}if(cond.type===\"date\"){const start=cond.startDate?getKSTDate(new Date(cond.startDate)):null;const end=cond.endDate?getKSTDate(new Date(cond.endDate)):null;const current=getKSTDate(new Date(dateStr));if(start&&current<start||end&&current>end){skipCoupon=true;break;}}}if(skipCoupon)continue;const discountValue=Number(coupon.discount_value);let max_amount=Infinity;for(const cond of conditions){if(cond.type===\"applied_discount\"&&cond.max){max_amount=Number(cond.max);}}let amount=Math.min(Math.round(primaryDiscountedPrice*(discountValue/100)),max_amount);if(secondaryDiscountedPrice<amount)amount=secondaryDiscountedPrice;if(amount>0){secondaryDiscountedPrice-=amount;secondaryTotalDiscount+=amount;const existing=secondaryDetailsMap.get(couponId);if(existing)existing.amount+=amount;else{secondaryDetailsMap.set(couponId,{id:couponId,name:coupon.name,description:coupon.description,amount});}if(remainingScope>0){couponRemainingScope.set(couponId,remainingScope-1);}}}}const primaryDiscountedPrice=totalPrice-primaryTotalDiscount;// === Step 4: Remaining secondary coupons ===\nfor(const coupon of secondaryCoupons){if(coupon.discount_type!==\"fixed\")continue;const couponId=coupon.coupon_instance_id||coupon.coupon_definition_id;if(secondaryDetailsMap.has(couponId))continue;const discountValue=Number(coupon.discount_value);const amount=Math.min(discountValue,primaryDiscountedPrice-secondaryTotalDiscount);secondaryTotalDiscount+=amount;secondaryDetailsMap.set(couponId,{id:couponId,name:coupon.name,description:coupon.description,amount});}{const mileage=Math.max(0,Math.floor(Number(store?.usedMileage??0)));if(mileage>0){const remaining=Math.max(0,primaryDiscountedPrice-secondaryTotalDiscount);const applied=Math.min(mileage,remaining);if(applied>0){secondaryTotalDiscount+=applied;secondaryDetailsMap.set(`MI-${mileage}`,{id:`MI-${mileage}`,name:`마일리지 ${mileage.toLocaleString()}p`,description:`마일리지 ${mileage.toLocaleString()}p`,amount:applied});}}}const primaryDetails=[...primaryDetailsMap1.values(),...primaryDetailsMap2.values()];// console.log(JSON.stringify(primaryDetails))\nconst secondaryDiscountedPrice=primaryDiscountedPrice-secondaryTotalDiscount;return{primaryDiscountedPrice,secondaryDiscountedPrice,primaryDetails:primaryDetails,secondaryDetails:Array.from(secondaryDetailsMap.values())};}\nexport const __FramerMetadata__ = {\"exports\":{\"calculateInitialPrices\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"CategoryMap\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"filterCoupons\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"evaluateCoupons\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","import{jsx as _jsx}from\"react/jsx-runtime\";import{useState}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import*as React from\"react\";import{useStore}from\"https://framerusercontent.com/modules/c2GloFFeVhaMQsbMcdTk/XiJZ0vjlltE7FPQAQ8Lk/MainStore.js\";import{parseDate}from\"https://framerusercontent.com/modules/1J9pgwrYtYGWgtmRStO4/muZZYJxbZe3foLJMfVTS/DateUtils.js\";import{toCategoryMap}from\"https://framerusercontent.com/modules/t32tReeHmrCTzbf5rVbb/4t3CRMaMn0Lfv4MD0qXL/PriceDisplay.js\";// ✅ 추가: 계산/필터 함수 import (PriceDisplay와 동일 파이프라인 사용)\nimport{calculateInitialPrices,filterCoupons,evaluateCoupons}from\"https://framerusercontent.com/modules/jTRIrvvdhM8hGc8tF4E7/Q2QLVylG6dtj4TyzXmqg/EvaluateCoupons.js\";import{useDayCategoryDefinitions}from\"https://framerusercontent.com/modules/pKMQTtBDnyThccjiINTr/R6FlauGV8dPyEKPorKpi/useDayCategoryDefinitions.js\";function getKSTDate(baseDate=new Date){const utc=baseDate.getTime()+baseDate.getTimezoneOffset()*6e4;return new Date(utc+9*60*60*1e3);}function getKSTISOString(date=new Date){const kstDate=getKSTDate(date);const pad=n=>String(n).padStart(2,\"0\");const year=kstDate.getFullYear();const month=pad(kstDate.getMonth()+1);const day=pad(kstDate.getDate());const hours=pad(kstDate.getHours());const minutes=pad(kstDate.getMinutes());const seconds=pad(kstDate.getSeconds());return`${year}-${month}-${day}T${hours}:${minutes}:${seconds}+09:00`;}export const useFormStore=createStore({name:null,birthdate:null,phone:null,email:null,emailDomain:null,nationality:\"domestic\",reserver_number:null,reserver_name:null,reserver_birthdate:null,reserver_phone:null,reserver_email:null,reserver_email_domain:null,isSameReserverStay:false,stay_name:null,stay_birthdate:null,stay_phone:null,couponCode:null,mileage:0,special_requests:null,anniversary_type:\"기념일 종류\",anniversary_name:null,anniversary_value:null,facility_policy:false,cancellation_policy:false,privacy_policy:false,marketing_consent:false,refund_name:null,refund_phone:null,refund_bank:null,refund_account:null});export function toggleName(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({name:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleBirthdate(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({birthdate:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function togglePhone(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({phone:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleEmail(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({email:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleNationality(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.nationality===\"domestic\"||mainStore.nationality===\"foreign\";// const shouldAutofill = false\nReact.useEffect(()=>{if(shouldAutofill&&formStore.nationality!==mainStore.nationality){setFormStore({nationality:mainStore.nationality});}},[shouldAutofill,mainStore.nationality]);const handleChange=value=>{setFormStore({nationality:value});};return /*#__PURE__*/_jsx(Component,{...props,disabled:shouldAutofill,selectedValue:shouldAutofill?mainStore.nationality:props.selectedValue,onChange:shouldAutofill?undefined:handleChange,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverNumber(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_number!==mainStore.membership_number){setFormStore({reserver_name:mainStore.membership_number});}},[shouldAutofill,mainStore.name]);const handleChange=event=>{setFormStore({reserver_number:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.membership_number:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverName(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_name!==mainStore.name){setFormStore({reserver_name:mainStore.name});}},[shouldAutofill,mainStore.name]);const handleChange=event=>{setFormStore({reserver_name:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.name:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverBirthdate(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_birthdate!==mainStore.birthdate){setFormStore({reserver_birthdate:mainStore.birthdate});}},[shouldAutofill,mainStore.birthdate]);const handleChange=event=>{setFormStore({reserver_birthdate:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.birthdate:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverPhone(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_phone!==mainStore.phone){setFormStore({reserver_phone:mainStore.phone});}},[shouldAutofill,mainStore.phone]);const handleChange=event=>{setFormStore({reserver_phone:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.phone:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverEmail(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_email!==mainStore.email){setFormStore({reserver_email:mainStore.email});}},[shouldAutofill,mainStore.email]);const handleChange=event=>{setFormStore({reserver_email:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.email:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function handleEmailDomainDropdown(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const selectedValue=event.target.value;if(selectedValue&&selectedValue!==\"직접 입력\"){setStore({reserver_email_domain:selectedValue});}};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleReserverNameNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_name!==mainStore.name){setFormStore({reserver_name:mainStore.name});}},[shouldAutofill,mainStore.name]);const handleChange=event=>{setFormStore({reserver_name:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.name:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverBirthdateNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_birthdate!==mainStore.birthdate){setFormStore({reserver_birthdate:mainStore.birthdate});}},[shouldAutofill,mainStore.birthdate]);const handleChange=event=>{setFormStore({reserver_birthdate:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.birthdate:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverPhoneNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_phone!==mainStore.phone){setFormStore({reserver_phone:mainStore.phone});}},[shouldAutofill,mainStore.phone]);const handleChange=event=>{setFormStore({reserver_phone:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.phone:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverEmailNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_email!==mainStore.email){setFormStore({reserver_email:mainStore.email});}},[shouldAutofill,mainStore.email]);const handleChange=event=>{setFormStore({reserver_email:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.email:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleSameReserverStay(Component){return props=>{const[store,setStore]=useFormStore();const toggle=()=>{setStore({isSameReserverStay:!store.isSameReserverStay});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function toggleStayName(Component){return props=>{const[store]=useStore();const[formStore,setFormStore]=useFormStore();const shouldAutofill=formStore.isSameReserverStay||store.membership==\"All-Free\";const autofillValue=formStore.reserver_name??\"\";React.useEffect(()=>{if(shouldAutofill&&formStore.stay_name!==autofillValue){setFormStore({stay_name:autofillValue});}},[shouldAutofill,autofillValue]);const handleChange=event=>{setFormStore({stay_name:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?autofillValue:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleStayBirthdate(Component){return props=>{const[store]=useStore();const[formStore,setFormStore]=useFormStore();const shouldAutofill=formStore.isSameReserverStay||store.membership==\"All-Free\";const autofillValue=formStore.reserver_birthdate??\"\";React.useEffect(()=>{if(shouldAutofill&&formStore.stay_birthdate!==autofillValue){setFormStore({stay_birthdate:autofillValue});}},[shouldAutofill,autofillValue]);const handleChange=event=>{setFormStore({stay_birthdate:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?autofillValue:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleStayPhone(Component){return props=>{const[store]=useStore();const[formStore,setFormStore]=useFormStore();const shouldAutofill=formStore.isSameReserverStay||store.membership==\"All-Free\";const autofillValue=formStore.reserver_phone??\"\";React.useEffect(()=>{if(shouldAutofill&&formStore.stay_phone!==autofillValue){setFormStore({stay_phone:autofillValue});}},[shouldAutofill,autofillValue]);const handleChange=event=>{setFormStore({stay_phone:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?autofillValue:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleCouponCode(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({couponCode:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function applyCouponCode(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[store,setStore]=useStore();const handleClick=async()=>{const code=formStore.couponCode?.trim();if(!code){alert(\"쿠폰 번호를 입력해주세요.\");return;}// if (store.expiredCoupons.includes(code)) {\n//     alert(\"한번 사용한 쿠폰은 재사용할 수 없습니다.\")\n//     return\n// }\nif(store.enteredCouponCode.includes(code)){alert(\"이미 적용된 쿠폰입니다.\");return;}try{// 쿠폰 데이터 가져오기\nconst[defRes,instRes]=await Promise.all([fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-definitions\"),fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-instances\")]);const definitions=await defRes.json();const instances=await instRes.json();// code 타입 정의만 필터링\nconst codeDefs=definitions.filter(def=>def.type===\"code\");// 인스턴스 + 정의 병합\nconst mergedCoupons=instances.filter(inst=>inst.coupon_code===code).map(inst=>{const def=codeDefs.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return def?{...def,...inst}:null;}).filter(Boolean);if(mergedCoupons.length===0){alert(\"쿠폰이 존재하지 않거나 쿠폰번호가 잘못되었습니다.\");return;}const[found]=mergedCoupons;// 상태 체크\nif(found.status!==\"available\"){alert(\"이 쿠폰은 현재 사용이 불가능합니다.\");return;}// 유효기간 체크\nif(found.coupon_due){const now=new Date;const due=new Date(found.coupon_due);if(isNaN(due.getTime())||now>due){alert(\"이 쿠폰의 유효기간이 지났습니다.\");return;}}// 적용 확인\nconst isConfirmed=window.confirm(`쿠폰 ${code}을 적용합니다.`);if(isConfirmed){setStore({enteredCouponCode:[...store.enteredCouponCode,code]});}}catch(error){console.error(\"쿠폰 확인 중 오류 발생:\",error);alert(\"쿠폰 확인 중 오류가 발생했습니다. 다시 시도해주세요.\");}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}// -----------------------------------------\nexport function checkRevisitAndCouponCode(Component){return props=>{const[formStore]=useFormStore();const[store,setStore]=useStore();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const handleClick=async()=>{const code=formStore.couponCode?.trim();if(!code){alert(\"쿠폰 번호를 입력해주세요.\");return;}try{// revisit 계산 (체크아웃 기준)\nconst ordersRes=await fetch(\"https://terene-db-server.onrender.com/api/v2/orders\");const orders=await ordersRes.json();const normalize=str=>str?.replace(/[\\s\\-./]/g,\"\").toLowerCase().trim();const revisitCount=orders.filter(order=>{return order.stay_status===\"checked_out\"&&normalize(order.reserver_name)===normalize(formStore.reserver_name)&&normalize(order.reserver_birthdate)===normalize(formStore.reserver_birthdate)&&normalize(order.reserver_contact)===normalize(formStore.reserver_phone);}).length;setStore({revisit:String(revisitCount)});if(store.enteredCouponCode?.includes(code)){alert(\"이미 적용된 쿠폰입니다.\");return;}// 쿠폰 정의/인스턴스 가져오기\nconst[defRes,instRes]=await Promise.all([fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-definitions\"),fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-instances\")]);const definitions=await defRes.json();const instances=await instRes.json();const codeDefs=definitions.filter(def=>def.type===\"code\");const mergedCoupons=instances.filter(inst=>inst.coupon_code===code).map(inst=>{const def=codeDefs.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return def?{...def,...inst}:null;}).filter(Boolean);if(mergedCoupons.length===0){alert(\"쿠폰이 존재하지 않거나 쿠폰번호가 잘못되었습니다.\");return;}const[found]=mergedCoupons;// 🔁 중복 제한(요구사항 반영): exclusive ↔ 모든 code형 쿠폰 상호배타\nconst appliedCodeCoupons=(store.enteredCouponCode??[]).map(appliedCode=>{const inst=instances.find(i=>i.coupon_code===appliedCode);if(!inst)return null;const def=definitions.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return def?{...def,...inst}:null;}).filter(c=>c&&c.type===\"code\");const hasAppliedExclusiveCode=appliedCodeCoupons.some(c=>c.exclusive===true);if(found.exclusive){// 이미 어떤 code형 쿠폰이라도 적용돼 있으면 exclusive는 불가\nif(appliedCodeCoupons.length>0){const conflict=appliedCodeCoupons[0];alert(`해당 쿠폰은 단독형 쿠폰으로, 기존 쿠폰(${conflict.description})과 함께 사용할 수 없습니다.`);return;}}else{// exclusive가 한 번이라도 적용돼 있으면 모든 code형 쿠폰 추가 불가\nif(hasAppliedExclusiveCode){const conflict=appliedCodeCoupons.find(c=>c.exclusive===true);alert(`이미 단독형 쿠폰(${conflict.description})이 적용되어 있어 다른 쿠폰을 사용할 수 없습니다.`);return;}}// 수취인/멤버십 일치 검증\nconst n=v=>String(v??\"\").replace(/[\\s\\-./]/g,\"\").toLowerCase().trim();const mismatch=(a,b)=>n(a)!==n(b);const hasMembership=found.membership_number!=null&&n(found.membership_number)!==\"\";const membershipMismatch=mismatch(found.membership_number,store.membership_number);const infoMismatch=mismatch(found.receiver_info?.name,formStore.reserver_name)||mismatch(found.receiver_info?.birthdate,formStore.reserver_birthdate)||mismatch(found.receiver_info?.contact,formStore.reserver_phone);const isEmptyCoupon=!found.receiver_info?.name&&!found.receiver_info?.birthdate&&!found.receiver_info?.contact&&!hasMembership;const shouldAlert=hasMembership?membershipMismatch:infoMismatch;if(!isEmptyCoupon&&shouldAlert){alert(\"쿠폰이 존재하지 않거나 쿠폰번호가 잘못되었습니다.\");return;}if(found.status!==\"available\"){alert(\"이 쿠폰은 현재 사용이 불가능합니다.\");return;}if(found.coupon_due){const now=new Date;const due=new Date(found.coupon_due);if(isNaN(due.getTime())||now>due){alert(\"이 쿠폰의 유효기간이 지났습니다.\");return;}}// ----------------------------\n// 날짜 준비/검증\n// ----------------------------\nconst queryParams=new URLSearchParams(window.location.search);const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDateFromQuery=first?parseDate(first):null;const secondDateFromQuery=second?parseDate(second):null;const firstDateObj=store.firstDate??firstDateFromQuery;const secondDateObj=store.secondDate??secondDateFromQuery;if(!firstDateObj||!secondDateObj){alert(\"체크인/체크아웃 날짜를 먼저 선택한 뒤 쿠폰을 적용해주세요.\");return;}// ----------------------------\n// 카테고리 맵 로드\n// ----------------------------\nlet categoryMap={};try{const holidayRes=await fetch(\"https://terene-db-server.onrender.com/api/v3/days\");const days=await holidayRes.json();const rawMap={};for(const item of days){rawMap[item.date]=item.category;}categoryMap=toCategoryMap(rawMap);}catch(err){console.error(\"❌ Category map load failed:\",err);categoryMap={};}console.log(\"firstDateObj\",firstDateObj);console.log(\"secondDateObj\",secondDateObj);// ----------------------------\n// 일자별 가격 계산 (명시적 날짜 전달)\n// ----------------------------\nconst{dailyItems}=calculateInitialPrices({...store},categoryMap,categoryDefs,firstDateObj,secondDateObj);// 글로벌 + 현재 코드만 구성\nconst globalDefs=definitions.filter(def=>def.type===\"global\");const couponsForCheck=[...globalDefs,found];// 가상 store: enteredCouponCode에 현재 코드 포함\nconst simulatedStore={...store,enteredCouponCode:[...store.enteredCouponCode??[],code]};// 필터 통과 여부\nconst{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(couponsForCheck,simulatedStore,dailyItems);// const codes = couponsForCheck\n//     .filter((c) => c.coupon_code && c.coupon_code[0] == \"H\") // coupon_code 필드가 존재하는 쿠폰만\n//     .map((c) => c.coupon_code as string) // 문자열로 추출\n// alert(\n//     `B-1) check: ${JSON.stringify(codes)}\\npassedSecondary: ${JSON.stringify(passedSecondaryCoupons)}`\n// )\nconst targetId=found.coupon_instance_id||found.coupon_definition_id;const included=passedSecondaryCoupons.some(c=>(c.coupon_instance_id||c.coupon_definition_id)===targetId);if(!included){// 🔸 필터에서 제외된 경우\nalert(`사용할 수 없는 쿠폰 조건입니다.`);return;}// 실제 할인액 계산\nconst{secondaryDetails}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,simulatedStore);const detail=secondaryDetails.find(d=>d.id===targetId);const appliedAmount=detail?.amount??0;if(!detail||appliedAmount<=0){// 🔸 필터는 통과했지만, 적용 가능한 결제 금액(잔액/상한)을 초과해 0원 처리된 경우\nalert(\"결제 할인 금액을 초과하여 쿠폰을 사용할 수 없습니다.\");return;}// 최종 적용\nconst isConfirmed=window.confirm(`쿠폰 ${code}을 적용합니다.`);if(isConfirmed){setStore({enteredCouponCode:[...store.enteredCouponCode??[],code]});}}catch(error){console.error(\"쿠폰 확인 중 오류 발생:\",error);alert(\"쿠폰 확인 중 오류가 발생했습니다. 다시 시도해주세요.\");}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}export async function fetchTotalMileage(membershipNumber){try{const res=await fetch(\"https://terene-db-server.onrender.com/api/v2/mileages\");if(!res.ok)throw new Error(\"Failed to fetch mileage data\");const data=await res.json();const userMileage=data.filter(m=>m.membership_number===membershipNumber);const totalAmount=userMileage.reduce((sum,entry)=>sum+Number(entry.mileage_amount||0),0);return totalAmount;}catch(error){console.error(\"마일리지 조회 실패:\",error);return 0;}}export function toggleMileage(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({mileage:Number(inputValue)});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleSpecialRequests(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({special_requests:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function handleAnniversaryDropdown(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const selectedValue=event.target.value;if(selectedValue!==\"기념일 종류\"){setStore({anniversary_type:selectedValue});}};return /*#__PURE__*/_jsx(Component,{...props,value:store.anniversary_type,onChange:handleChange});};}export function toggleAnniversaryName(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({anniversary_name:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleAnniversaryValue(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({anniversary_value:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}// ----- 토스 결제 / Paypal 결제 분기점 -----\nexport function toggleTossPayment(Component){return props=>{const[store,setStore]=useStore();const[formStore,setformStore]=useFormStore();const[payment,setPayment]=useState(formStore.payment);const toggle=()=>{setStore({payment:\"toss\"});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function togglePaypalPayment(Component){return props=>{const[store,setStore]=useStore();const[formStore,setformStore]=useFormStore();const[payment,setPayment]=useState(formStore.payment);const toggle=()=>{setStore({payment:\"paypal\"});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function toggleForeignCardPayment(Component){return props=>{const[store,setStore]=useStore();const[formStore,setformStore]=useFormStore();const[payment,setPayment]=useState(formStore.payment);const toggle=()=>{setStore({payment:\"foreignCard\"});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function toggleRefundName(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({refund_name:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleRefundPhone(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({refund_phone:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function handleRefundBank(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const selectedValue=event.target.value;if(selectedValue!==\"은행명\"){setStore({refund_bank:selectedValue});}};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleRefundAccount(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({refund_account:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function getAvailableMileage(Component){return props=>{const[store]=useStore();return /*#__PURE__*/_jsx(Component,{...props,text:`사용 가능 ${(store.totalMileage-store.usedMileage).toLocaleString()}p`});};}export function getTotalMileage(Component){return props=>{const[store,setStore]=useStore();React.useEffect(()=>{const fetchMileages=async()=>{if(!store.membership_number)return;try{const res=await fetch(\"https://terene-db-server.onrender.com/api/v2/mileages\");if(!res.ok)throw new Error(\"마일리지 조회 실패\");const data=await res.json();const sum=data.filter(m=>m.membership_number===store.membership_number).reduce((acc,m)=>acc+Number(m.mileage_amount||0),0);setStore({totalMileage:sum});}catch(e){console.error(\"마일리지 불러오기 실패:\",e);setStore({totalMileage:0});}};fetchMileages();},[store.membership_number]);return /*#__PURE__*/_jsx(Component,{...props,text:`보유 ${store.totalMileage.toLocaleString()}p`});};}export function applyMileage(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[store,setStore]=useStore();const handleClick=async()=>{if(!formStore.mileage){alert(`마일리지를 입력해주세요.`);return;}if(!Number.isInteger(formStore.mileage)||formStore.mileage<=0){alert(\"마일리지는 1 이상의 자연수로만 입력해주세요.\");return;}// if (!store.membership_number) {\n//     alert(\"멤버십 로그인이 필요합니다.\")\n//     return\n// }\n// const totalMileage = await fetchTotalMileage(\n//     store.membership_number\n// )\nconst availableMileage=store.totalMileage-store.usedMileage;if(formStore.mileage>availableMileage||availableMileage<=0){alert(`마일리지 수 부족: ${availableMileage.toLocaleString()}p`);return;}if(formStore.mileage>store.integratedPrice){alert(`최대 적용 가능한 마일리지 수를 초과하였습니다.\n현재 최대 적용 가능한 마일리지 수: ${store.integratedPrice.toLocaleString()}p`);return;}if(store.usedMileage==0){const isConfirmed=window.confirm(`마일리지 ${formStore.mileage.toLocaleString()}p를 적용합니다.`);if(isConfirmed){setStore({usedMileage:(store.usedMileage||0)+formStore.mileage});}}else{const isConfirmed=window.confirm(`마일리지 ${formStore.mileage.toLocaleString()}p를 추가로 적용합니다.`);if(isConfirmed){setStore({usedMileage:(store.usedMileage||0)+formStore.mileage});}}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}export function hidePaypalInfo(Component){return props=>{const[store,setStore]=useStore();if(store.payment!==\"paypal\")return null;return /*#__PURE__*/_jsx(Component,{...props});};}\nexport const __FramerMetadata__ = {\"exports\":{\"toggleMileage\":{\"type\":\"reactHoc\",\"name\":\"toggleMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"checkRevisitAndCouponCode\":{\"type\":\"reactHoc\",\"name\":\"checkRevisitAndCouponCode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleAnniversaryValue\":{\"type\":\"reactHoc\",\"name\":\"toggleAnniversaryValue\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleEmail\":{\"type\":\"reactHoc\",\"name\":\"toggleEmail\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"handleEmailDomainDropdown\":{\"type\":\"reactHoc\",\"name\":\"handleEmailDomainDropdown\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"togglePaypalPayment\":{\"type\":\"reactHoc\",\"name\":\"togglePaypalPayment\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverBirthdateNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverBirthdateNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleForeignCardPayment\":{\"type\":\"reactHoc\",\"name\":\"toggleForeignCardPayment\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleStayBirthdate\":{\"type\":\"reactHoc\",\"name\":\"toggleStayBirthdate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"applyCouponCode\":{\"type\":\"reactHoc\",\"name\":\"applyCouponCode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleTossPayment\":{\"type\":\"reactHoc\",\"name\":\"toggleTossPayment\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleStayName\":{\"type\":\"reactHoc\",\"name\":\"toggleStayName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverEmailNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverEmailNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleRefundPhone\":{\"type\":\"reactHoc\",\"name\":\"toggleRefundPhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleName\":{\"type\":\"reactHoc\",\"name\":\"toggleName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getAvailableMileage\":{\"type\":\"reactHoc\",\"name\":\"getAvailableMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverBirthdate\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverBirthdate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleAnniversaryName\":{\"type\":\"reactHoc\",\"name\":\"toggleAnniversaryName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"applyMileage\":{\"type\":\"reactHoc\",\"name\":\"applyMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverEmail\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverEmail\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverPhoneNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverPhoneNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverPhone\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverPhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useFormStore\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"togglePhone\":{\"type\":\"reactHoc\",\"name\":\"togglePhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleStayPhone\":{\"type\":\"reactHoc\",\"name\":\"toggleStayPhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverNameNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverNameNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleNationality\":{\"type\":\"reactHoc\",\"name\":\"toggleNationality\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleRefundAccount\":{\"type\":\"reactHoc\",\"name\":\"toggleRefundAccount\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleCouponCode\":{\"type\":\"reactHoc\",\"name\":\"toggleCouponCode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"handleAnniversaryDropdown\":{\"type\":\"reactHoc\",\"name\":\"handleAnniversaryDropdown\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverNumber\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverNumber\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverName\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"fetchTotalMileage\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getTotalMileage\":{\"type\":\"reactHoc\",\"name\":\"getTotalMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"hidePaypalInfo\":{\"type\":\"reactHoc\",\"name\":\"hidePaypalInfo\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"handleRefundBank\":{\"type\":\"reactHoc\",\"name\":\"handleRefundBank\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleBirthdate\":{\"type\":\"reactHoc\",\"name\":\"toggleBirthdate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleSameReserverStay\":{\"type\":\"reactHoc\",\"name\":\"toggleSameReserverStay\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleRefundName\":{\"type\":\"reactHoc\",\"name\":\"toggleRefundName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleSpecialRequests\":{\"type\":\"reactHoc\",\"name\":\"toggleSpecialRequests\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","// AdditionalService.tsx\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";const useAdditionalServiceStore=createStore({adult:1,teenager:0,child:0});function extractNumber(value){const match=value.match(/^(\\d+)(인|회)$/);return match?Number(match[1]):0;}export function createAdditionalServiceList(myStore,store){const selected=myStore.selectedServices||{};// \"All-Free\" 멤버십일 경우 추가요금 전액 0원 처리\nif(store.membership===\"All-Free\"){return Object.values(selected).filter(s=>s.checked).map(s=>({type:s.title,amount:0}));}// ✅ 일반 케이스\nreturn Object.values(selected).filter(s=>s.checked).map(s=>{const quantity=s.show_dropdown?s.dropdownValue:1;return{...s,quantity};}).filter(s=>s.quantity>0).map(s=>({type:s.title,amount:(s.price||0)*s.quantity}));}const TOTAL_MAX=8;const ADULT_MIN=1;const ADULT_MAX=8;const TEENAGER_MIN=0;const TEENAGER_MAX=6;const CHILD_MIN=0;const CHILD_MAX=6;// 텍스트 표시: 성인 n명\nexport function displayAdult(Component){return props=>{const[store]=useAdditionalServiceStore();const label=`일반   ${store.adult}명`;return /*#__PURE__*/_jsx(Component,{...props,text:label});};}// 텍스트 표시: 청소년/아동 n명\nexport function displayTeenager(Component){return props=>{const[store]=useAdditionalServiceStore();const label=`청소년/아동   ${store.teenager}명`;return /*#__PURE__*/_jsx(Component,{...props,text:label});};}// 텍스트 표시: 영유아 n명\nexport function displayChild(Component){return props=>{const[store]=useAdditionalServiceStore();const label=`유아   ${store.child}명`;return /*#__PURE__*/_jsx(Component,{...props,text:label});};}// ✅ 체크 상태 토글 버튼\nexport function toggleBBQGrill(Component){return props=>{const[store,setStore]=useAdditionalServiceStore();const toggle=()=>{setStore({checkedBBQGrill:!store.checkedBBQGrill});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function toggleBBQFood(Component){return props=>{const[store,setStore]=useAdditionalServiceStore();const toggle=()=>{setStore({checkedBBQFood:!store.checkedBBQFood});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function toggleStretch(Component){return props=>{const[store,setStore]=useAdditionalServiceStore();const toggle=()=>{setStore({checkedStretch:!store.checkedStretch});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function toggleCatering(Component){return props=>{const[store,setStore]=useAdditionalServiceStore();const toggle=()=>{setStore({checkedCatering:!store.checkedCatering});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function handleBBQGrillDropdown(Component){return props=>{const[store,setStore]=useAdditionalServiceStore();const handleChange=event=>{const selectedValue=event.target.value;setStore({BBQGrillValue:selectedValue});};return /*#__PURE__*/_jsx(Component,{...props,value:store.BBQGrillValue,onChange:handleChange});};}export function handleBBQFoodDropdown(Component){return props=>{const[store,setStore]=useAdditionalServiceStore();const handleChange=event=>{const selectedValue=event.target.value;setStore({BBQFoodValue:selectedValue});};return /*#__PURE__*/_jsx(Component,{...props,value:store.BBQFoodValue,onChange:handleChange});};}export function handleStretchDropdown(Component){return props=>{const[store,setStore]=useAdditionalServiceStore();const handleChange=event=>{const selectedValue=event.target.value;setStore({StretchValue:selectedValue});};return /*#__PURE__*/_jsx(Component,{...props,value:store.StretchValue,onChange:handleChange});};}export function handleCateringDropdown(Component){return props=>{const[store,setStore]=useAdditionalServiceStore();const handleChange=event=>{const selectedValue=event.target.value;setStore({CateringValue:selectedValue});};return /*#__PURE__*/_jsx(Component,{...props,value:store.CateringValue,onChange:handleChange});};}// 증가 버튼: 성인\nexport function incrementAdult(Component){return props=>{const[store,setStore]=useAdditionalServiceStore();const increment=()=>{const total=store.adult+store.teenager;if(store.adult<ADULT_MAX&&total<TOTAL_MAX){setStore({adult:store.adult+1});}};return /*#__PURE__*/_jsx(Component,{...props,onClick:increment});};}// 감소 버튼: 성인\nexport function decrementAdult(Component){return props=>{const[store,setStore]=useAdditionalServiceStore();const decrement=()=>{if(store.adult>ADULT_MIN){setStore({adult:store.adult-1});}};return /*#__PURE__*/_jsx(Component,{...props,onClick:decrement});};}// 증가 버튼: 청소년/아동\nexport function incrementTeenager(Component){return props=>{const[store,setStore]=useAdditionalServiceStore();const increment=()=>{const total=store.adult+store.teenager;if(store.teenager<TEENAGER_MAX&&total<TOTAL_MAX){setStore({teenager:store.teenager+1});}};return /*#__PURE__*/_jsx(Component,{...props,onClick:increment});};}// 감소 버튼: 청소년/아동\nexport function decrementTeenager(Component){return props=>{const[store,setStore]=useAdditionalServiceStore();const decrement=()=>{if(store.teenager>TEENAGER_MIN){setStore({teenager:store.teenager-1});}};return /*#__PURE__*/_jsx(Component,{...props,onClick:decrement});};}// 증가 버튼: 영유아\nexport function incrementChild(Component){return props=>{const[store,setStore]=useAdditionalServiceStore();const increment=()=>{if(store.child<CHILD_MAX){setStore({child:store.child+1});}};return /*#__PURE__*/_jsx(Component,{...props,onClick:increment});};}// 감소 버튼: 영유아\nexport function decrementChild(Component){return props=>{const[store,setStore]=useAdditionalServiceStore();const decrement=()=>{if(store.child>CHILD_MIN){setStore({child:store.child-1});}};return /*#__PURE__*/_jsx(Component,{...props,onClick:decrement});};}export{useAdditionalServiceStore};\nexport const __FramerMetadata__ = {\"exports\":{\"decrementTeenager\":{\"type\":\"reactHoc\",\"name\":\"decrementTeenager\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"decrementAdult\":{\"type\":\"reactHoc\",\"name\":\"decrementAdult\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayTeenager\":{\"type\":\"reactHoc\",\"name\":\"displayTeenager\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayAdult\":{\"type\":\"reactHoc\",\"name\":\"displayAdult\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useAdditionalServiceStore\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"handleCateringDropdown\":{\"type\":\"reactHoc\",\"name\":\"handleCateringDropdown\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleCatering\":{\"type\":\"reactHoc\",\"name\":\"toggleCatering\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleBBQGrill\":{\"type\":\"reactHoc\",\"name\":\"toggleBBQGrill\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"handleBBQGrillDropdown\":{\"type\":\"reactHoc\",\"name\":\"handleBBQGrillDropdown\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"incrementTeenager\":{\"type\":\"reactHoc\",\"name\":\"incrementTeenager\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleBBQFood\":{\"type\":\"reactHoc\",\"name\":\"toggleBBQFood\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"incrementAdult\":{\"type\":\"reactHoc\",\"name\":\"incrementAdult\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleStretch\":{\"type\":\"reactHoc\",\"name\":\"toggleStretch\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"handleStretchDropdown\":{\"type\":\"reactHoc\",\"name\":\"handleStretchDropdown\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"decrementChild\":{\"type\":\"reactHoc\",\"name\":\"decrementChild\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"createAdditionalServiceList\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"handleBBQFoodDropdown\":{\"type\":\"reactHoc\",\"name\":\"handleBBQFoodDropdown\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayChild\":{\"type\":\"reactHoc\",\"name\":\"displayChild\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"incrementChild\":{\"type\":\"reactHoc\",\"name\":\"incrementChild\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AdditionalService.map","// PriceDisplay.tsx\nimport{jsx as _jsx}from\"react/jsx-runtime\";import React,{useEffect,useMemo}from\"react\";import{useStore}from\"https://framerusercontent.com/modules/c2GloFFeVhaMQsbMcdTk/XiJZ0vjlltE7FPQAQ8Lk/MainStore.js\";import{useFormStore}from\"https://framerusercontent.com/modules/j1JmQpFlkCqsnz6Zbn4l/2xQ5QMTphaYXKxXhCCKm/ReservationForm.js\";import{calculateInitialPrices,filterCoupons,evaluateCoupons}from\"https://framerusercontent.com/modules/jTRIrvvdhM8hGc8tF4E7/Q2QLVylG6dtj4TyzXmqg/EvaluateCoupons.js\";import{useAdditionalServiceStore,createAdditionalServiceList}from\"https://framerusercontent.com/modules/k847LPNIMdkhfIs0ouwF/EUEOlsedw6DGLY16dhfq/AdditionalService.js\";import{parseDate}from\"https://framerusercontent.com/modules/1J9pgwrYtYGWgtmRStO4/muZZYJxbZe3foLJMfVTS/DateUtils.js\";import{motion}from\"framer-motion\";import{useDayCategoryDefinitions}from\"https://framerusercontent.com/modules/pKMQTtBDnyThccjiINTr/R6FlauGV8dPyEKPorKpi/useDayCategoryDefinitions.js\";const FadeIn=({children})=>/*#__PURE__*/_jsx(motion.div,{initial:{opacity:0,y:0},animate:{opacity:1,y:0},exit:{opacity:0,y:0},transition:{duration:.4,ease:\"easeOut\"},children:children});// 공휴일 카테고리 가져오기 (v3 구조 대응)\nexport function useHolidayCategoryMap(){const[categories,setCategories]=React.useState({});const[isLoading,setIsLoading]=React.useState(true);React.useEffect(()=>{fetch(\"https://terene-db-server.onrender.com/api/v3/days\").then(res=>res.json()).then(data=>{const map={};for(const item of data){// ✅ days_250928 구조 반영\n// item = { date, category, is_holiday, location, checkin_occupied, ... }\nmap[item.date]=item.category;}setCategories(map);}).catch(err=>console.error(\"Holiday fetch error\",err)).finally(()=>setIsLoading(false));},[]);return{categories,isLoading};}// ✅ 문자열 → 카테고리 매핑\nexport function toCategoryMap(input){return input;}export function useCoupons(){const[coupons,setCoupons]=React.useState([]);const[isLoading,setIsLoading]=React.useState(true);React.useEffect(()=>{async function fetchCoupons(){try{// Fetch definitions first\nconst defRes=await fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-definitions\");const definitions=await defRes.json();// Separate global and code types (ignore membership)\nconst globalDefs=definitions.filter(def=>def.type===\"global\");const codeDefs=definitions.filter(def=>def.type===\"code\");// Fetch instances only if there are code definitions\nlet codeInstances=[];if(codeDefs.length>0){const instRes=await fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-instances\");const instances=await instRes.json();codeInstances=instances.filter(inst=>codeDefs.some(def=>def.coupon_definition_id===inst.coupon_definition_id));}// Merge code definitions and their instances\nconst codeCoupons=codeInstances.map(inst=>{const def=codeDefs.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return{...def,...inst};});// Combine global and code coupons\nconst combined=[...globalDefs,...codeCoupons];// Sort by optional priority if present\nconst sorted=combined.sort((a,b)=>(a.priority||0)-(b.priority||0));setCoupons(sorted);}catch(err){console.error(\"Coupon fetch error:\",err);}finally{setIsLoading(false);}}fetchCoupons();},[]);return{coupons,isLoading};}function useDiscountCalculation(){const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isReady=store.firstDate&&store.secondDate||firstDate&&secondDate;const result=useMemo(()=>{if(!isReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice,dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);return{initialPrice,discountedPrice};},[store,categories,coupons,firstDate,secondDate,categoryLoading,couponLoading]);return{isLoading:!isReady||categoryLoading||couponLoading,data:result};}export function displayInitialPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();// console.log(\"### COUPONS ###\")\n// console.log(JSON.stringify(coupons))\nconst{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const text=store.payment===\"paypal\"?`KRW ${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")} 원`;return(// <FadeIn>\n/*#__PURE__*/_jsx(Component,{...props,text:text}));};}export function displayDiscountedPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const text=store.payment===\"paypal\"?`KRW ${Math.max(discountedPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(discountedPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}function transitionStyle(visible){return{opacity:visible?1:0,color:\"inherit\",transition:\"opacity 0.3s ease-in-out\",display:\"inline-block\"};}export function displayDiscountBar(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice,dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const show=initialPrice!==Math.max(discountedPrice,0);const baseStyle=transitionStyle(show);const width=initialPrice>=1e8?144:initialPrice>=1e7?128:112;const barStyle={...baseStyle,width,position:\"relative\",right:0,transform:`translateX(${92-width}px)`};// <Component {...props} style={barStyle} />\nreturn /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,style:baseStyle})});};}export function displaySoftInitialPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const text=store.payment===\"paypal\"?`KRW ${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function getAdditionalPrice(){const[store]=useStore();const[additionalServiceStore]=useAdditionalServiceStore();const additionalServiceList=createAdditionalServiceList(additionalServiceStore,store);const totalAmount=additionalServiceList.reduce((sum,service)=>{return sum+service.amount;},0);return totalAmount;}export function displayIntegratedPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=store.membership===\"All-Free\"?0:Math.max(discountedPrice,0)+additionalPrice;const text=store.payment===\"paypal\"?`KRW ${Math.max(integratedPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(integratedPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayExchangeMarginPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=Math.max(discountedPrice,0)+additionalPrice;const exchangeMarginPrice=store.membership===\"All-Free\"||store.payment!==\"paypal\"?0:Math.round(integratedPrice*.05)// 기존 가격의 5%만큼 환전 수수료 적용\n;const text=store.payment===\"paypal\"?`KRW ${Math.max(exchangeMarginPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(exchangeMarginPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayVatPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=Math.max(discountedPrice,0)+additionalPrice;const vatPrice=store.membership===\"All-Free\"?0:Math.round(integratedPrice*.1);const text=store.payment===\"paypal\"?`KRW ${Math.max(vatPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(vatPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayDepositPrice(Component){const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;return props=>{const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const depositPrice=store.membership===\"Non-Member\"?3e5:0;const text=store.payment===\"paypal\"?`KRW ${Math.max(depositPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(depositPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayFinalPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store,setStore]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;const priceData=useMemo(()=>{if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const initialPrice=dailyItems.reduce((sum,item)=>sum+item.price,0);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice,primaryDetails,secondaryDetails}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=store.membership===\"All-Free\"?0:Math.max(discountedPrice,0)+additionalPrice;const exchangeMarginPrice=store.payment===\"paypal\"?Math.round(integratedPrice*.05)// 기존 가격의 5%만큼 환전 수수료 적용\n:0;const vatPrice=Math.round(integratedPrice*.1);const depositPrice=store.membership===\"Non-Member\"?3e5:0;const finalPrice=store.membership===\"All-Free\"?0:integratedPrice+exchangeMarginPrice+vatPrice+depositPrice;const text=store.payment===\"paypal\"?`KRW ${Math.max(finalPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(finalPrice,0).toLocaleString(\"ko-KR\")} 원`;return{initialPrice,discountedPrice,additionalPrice,integratedPrice,exchangeMarginPrice,vatPrice,depositPrice,finalPrice,text,primaryDetails,secondaryDetails};},[isStoreReady,categoryLoading,couponLoading,store,categories,coupons,additionalPrice]);useEffect(()=>{if(!priceData)return;setStore(prev=>{const isSame=prev.finalPrice===priceData.finalPrice&&prev.initialPrice===priceData.initialPrice&&prev.discountedPrice===priceData.discountedPrice&&prev.additionalPrice===priceData.additionalPrice&&prev.integratedPrice===priceData.integratedPrice&&prev.exchangeMarginPrice===priceData.exchangeMarginPrice&&prev.vatPrice===priceData.vatPrice&&prev.depositPrice===priceData.depositPrice;if(isSame)return prev;return{...prev,initialPrice:priceData.initialPrice,discountedPrice:priceData.discountedPrice,additionalPrice:priceData.additionalPrice,integratedPrice:priceData.integratedPrice,exchangeMarginPrice:priceData.exchangeMarginPrice,vatPrice:priceData.vatPrice,depositPrice:priceData.depositPrice,finalPrice:priceData.finalPrice,couponPrimaryDetails:priceData.primaryDetails,couponSecondaryDetails:priceData.secondaryDetails};});},[priceData?.initialPrice,priceData?.discountedPrice,priceData?.additionalPrice,priceData?.integratedPrice,priceData?.exchangeMarginPrice,priceData?.vatPrice,priceData?.depositPrice,priceData?.finalPrice]);if(!priceData)return null;// console.log(priceData?.finalPrice)\nreturn /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:priceData.text})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"useCoupons\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayInitialPrice\":{\"type\":\"reactHoc\",\"name\":\"displayInitialPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayDiscountedPrice\":{\"type\":\"reactHoc\",\"name\":\"displayDiscountedPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useHolidayCategoryMap\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displaySoftInitialPrice\":{\"type\":\"reactHoc\",\"name\":\"displaySoftInitialPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayIntegratedPrice\":{\"type\":\"reactHoc\",\"name\":\"displayIntegratedPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayVatPrice\":{\"type\":\"reactHoc\",\"name\":\"displayVatPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayFinalPrice\":{\"type\":\"reactHoc\",\"name\":\"displayFinalPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayExchangeMarginPrice\":{\"type\":\"reactHoc\",\"name\":\"displayExchangeMarginPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toCategoryMap\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayDepositPrice\":{\"type\":\"reactHoc\",\"name\":\"displayDepositPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getAdditionalPrice\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayDiscountBar\":{\"type\":\"reactHoc\",\"name\":\"displayDiscountBar\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","import{jsx as _jsx}from\"react/jsx-runtime\";import{useState}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import*as React from\"react\";import{useStore}from\"https://framerusercontent.com/modules/c2GloFFeVhaMQsbMcdTk/XiJZ0vjlltE7FPQAQ8Lk/MainStore.js\";import{parseDate}from\"https://framerusercontent.com/modules/1J9pgwrYtYGWgtmRStO4/muZZYJxbZe3foLJMfVTS/DateUtils.js\";import{toCategoryMap}from\"https://framerusercontent.com/modules/t32tReeHmrCTzbf5rVbb/4t3CRMaMn0Lfv4MD0qXL/PriceDisplay.js\";// ✅ 추가: 계산/필터 함수 import (PriceDisplay와 동일 파이프라인 사용)\nimport{calculateInitialPrices,filterCoupons,evaluateCoupons}from\"https://framerusercontent.com/modules/jTRIrvvdhM8hGc8tF4E7/Q2QLVylG6dtj4TyzXmqg/EvaluateCoupons.js\";import{useDayCategoryDefinitions}from\"https://framerusercontent.com/modules/pKMQTtBDnyThccjiINTr/R6FlauGV8dPyEKPorKpi/useDayCategoryDefinitions.js\";function getKSTDate(baseDate=new Date){const utc=baseDate.getTime()+baseDate.getTimezoneOffset()*6e4;return new Date(utc+9*60*60*1e3);}function getKSTISOString(date=new Date){const kstDate=getKSTDate(date);const pad=n=>String(n).padStart(2,\"0\");const year=kstDate.getFullYear();const month=pad(kstDate.getMonth()+1);const day=pad(kstDate.getDate());const hours=pad(kstDate.getHours());const minutes=pad(kstDate.getMinutes());const seconds=pad(kstDate.getSeconds());return`${year}-${month}-${day}T${hours}:${minutes}:${seconds}+09:00`;}export const useFormStore=createStore({name:null,birthdate:null,phone:null,email:null,emailDomain:null,nationality:\"domestic\",reserver_number:null,reserver_name:null,reserver_birthdate:null,reserver_phone:null,reserver_email:null,reserver_email_domain:null,isSameReserverStay:false,stay_name:null,stay_birthdate:null,stay_phone:null,couponCode:null,mileage:0,special_requests:null,anniversary_type:\"기념일 종류\",anniversary_name:null,anniversary_value:null,facility_policy:false,cancellation_policy:false,privacy_policy:false,marketing_consent:false,refund_name:null,refund_phone:null,refund_bank:null,refund_account:null});export function toggleName(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({name:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleBirthdate(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({birthdate:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function togglePhone(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({phone:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleEmail(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({email:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleNationality(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.nationality===\"domestic\"||mainStore.nationality===\"foreign\";// const shouldAutofill = false\nReact.useEffect(()=>{if(shouldAutofill&&formStore.nationality!==mainStore.nationality){setFormStore({nationality:mainStore.nationality});}},[shouldAutofill,mainStore.nationality]);const handleChange=value=>{setFormStore({nationality:value});};return /*#__PURE__*/_jsx(Component,{...props,disabled:shouldAutofill,selectedValue:shouldAutofill?mainStore.nationality:props.selectedValue,onChange:shouldAutofill?undefined:handleChange,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverNumber(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_number!==mainStore.membership_number){setFormStore({reserver_name:mainStore.membership_number});}},[shouldAutofill,mainStore.name]);const handleChange=event=>{setFormStore({reserver_number:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.membership_number:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverName(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_name!==mainStore.name){setFormStore({reserver_name:mainStore.name});}},[shouldAutofill,mainStore.name]);const handleChange=event=>{setFormStore({reserver_name:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.name:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverBirthdate(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_birthdate!==mainStore.birthdate){setFormStore({reserver_birthdate:mainStore.birthdate});}},[shouldAutofill,mainStore.birthdate]);const handleChange=event=>{setFormStore({reserver_birthdate:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.birthdate:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverPhone(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_phone!==mainStore.phone){setFormStore({reserver_phone:mainStore.phone});}},[shouldAutofill,mainStore.phone]);const handleChange=event=>{setFormStore({reserver_phone:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.phone:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverEmail(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_email!==mainStore.email){setFormStore({reserver_email:mainStore.email});}},[shouldAutofill,mainStore.email]);const handleChange=event=>{setFormStore({reserver_email:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.email:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function handleEmailDomainDropdown(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const selectedValue=event.target.value;if(selectedValue&&selectedValue!==\"직접 입력\"){setStore({reserver_email_domain:selectedValue});}};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleReserverNameNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_name!==mainStore.name){setFormStore({reserver_name:mainStore.name});}},[shouldAutofill,mainStore.name]);const handleChange=event=>{setFormStore({reserver_name:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.name:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverBirthdateNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_birthdate!==mainStore.birthdate){setFormStore({reserver_birthdate:mainStore.birthdate});}},[shouldAutofill,mainStore.birthdate]);const handleChange=event=>{setFormStore({reserver_birthdate:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.birthdate:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverPhoneNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_phone!==mainStore.phone){setFormStore({reserver_phone:mainStore.phone});}},[shouldAutofill,mainStore.phone]);const handleChange=event=>{setFormStore({reserver_phone:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.phone:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverEmailNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_email!==mainStore.email){setFormStore({reserver_email:mainStore.email});}},[shouldAutofill,mainStore.email]);const handleChange=event=>{setFormStore({reserver_email:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.email:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleSameReserverStay(Component){return props=>{const[store,setStore]=useFormStore();const toggle=()=>{setStore({isSameReserverStay:!store.isSameReserverStay});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function toggleStayName(Component){return props=>{const[store]=useStore();const[formStore,setFormStore]=useFormStore();const shouldAutofill=formStore.isSameReserverStay||store.membership==\"All-Free\";const autofillValue=formStore.reserver_name??\"\";React.useEffect(()=>{if(shouldAutofill&&formStore.stay_name!==autofillValue){setFormStore({stay_name:autofillValue});}},[shouldAutofill,autofillValue]);const handleChange=event=>{setFormStore({stay_name:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?autofillValue:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleStayBirthdate(Component){return props=>{const[store]=useStore();const[formStore,setFormStore]=useFormStore();const shouldAutofill=formStore.isSameReserverStay||store.membership==\"All-Free\";const autofillValue=formStore.reserver_birthdate??\"\";React.useEffect(()=>{if(shouldAutofill&&formStore.stay_birthdate!==autofillValue){setFormStore({stay_birthdate:autofillValue});}},[shouldAutofill,autofillValue]);const handleChange=event=>{setFormStore({stay_birthdate:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?autofillValue:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleStayPhone(Component){return props=>{const[store]=useStore();const[formStore,setFormStore]=useFormStore();const shouldAutofill=formStore.isSameReserverStay||store.membership==\"All-Free\";const autofillValue=formStore.reserver_phone??\"\";React.useEffect(()=>{if(shouldAutofill&&formStore.stay_phone!==autofillValue){setFormStore({stay_phone:autofillValue});}},[shouldAutofill,autofillValue]);const handleChange=event=>{setFormStore({stay_phone:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?autofillValue:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleCouponCode(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({couponCode:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function applyCouponCode(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[store,setStore]=useStore();const handleClick=async()=>{const code=formStore.couponCode?.trim();if(!code){alert(\"쿠폰 번호를 입력해주세요.\");return;}// if (store.expiredCoupons.includes(code)) {\n//     alert(\"한번 사용한 쿠폰은 재사용할 수 없습니다.\")\n//     return\n// }\nif(store.enteredCouponCode.includes(code)){alert(\"이미 적용된 쿠폰입니다.\");return;}try{// 쿠폰 데이터 가져오기\nconst[defRes,instRes]=await Promise.all([fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-definitions\"),fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-instances\")]);const definitions=await defRes.json();const instances=await instRes.json();// code 타입 정의만 필터링\nconst codeDefs=definitions.filter(def=>def.type===\"code\");// 인스턴스 + 정의 병합\nconst mergedCoupons=instances.filter(inst=>inst.coupon_code===code).map(inst=>{const def=codeDefs.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return def?{...def,...inst}:null;}).filter(Boolean);if(mergedCoupons.length===0){alert(\"쿠폰이 존재하지 않거나 쿠폰번호가 잘못되었습니다.\");return;}const[found]=mergedCoupons;// 상태 체크\nif(found.status!==\"available\"){alert(\"이 쿠폰은 현재 사용이 불가능합니다.\");return;}// 유효기간 체크\nif(found.coupon_due){const now=new Date;const due=new Date(found.coupon_due);if(isNaN(due.getTime())||now>due){alert(\"이 쿠폰의 유효기간이 지났습니다.\");return;}}// 적용 확인\nconst isConfirmed=window.confirm(`쿠폰 ${code}을 적용합니다.`);if(isConfirmed){setStore({enteredCouponCode:[...store.enteredCouponCode,code]});}}catch(error){console.error(\"쿠폰 확인 중 오류 발생:\",error);alert(\"쿠폰 확인 중 오류가 발생했습니다. 다시 시도해주세요.\");}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}// -----------------------------------------\nexport function checkRevisitAndCouponCode(Component){return props=>{const[formStore]=useFormStore();const[store,setStore]=useStore();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const handleClick=async()=>{const code=formStore.couponCode?.trim();if(!code){alert(\"쿠폰 번호를 입력해주세요.\");return;}try{// revisit 계산 (체크아웃 기준)\nconst ordersRes=await fetch(\"https://terene-db-server.onrender.com/api/v2/orders\");const orders=await ordersRes.json();const normalize=str=>str?.replace(/[\\s\\-./]/g,\"\").toLowerCase().trim();const revisitCount=orders.filter(order=>{return order.stay_status===\"checked_out\"&&normalize(order.reserver_name)===normalize(formStore.reserver_name)&&normalize(order.reserver_birthdate)===normalize(formStore.reserver_birthdate)&&normalize(order.reserver_contact)===normalize(formStore.reserver_phone);}).length;setStore({revisit:String(revisitCount)});if(store.enteredCouponCode?.includes(code)){alert(\"이미 적용된 쿠폰입니다.\");return;}// 쿠폰 정의/인스턴스 가져오기\nconst[defRes,instRes]=await Promise.all([fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-definitions\"),fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-instances\")]);const definitions=await defRes.json();const instances=await instRes.json();const codeDefs=definitions.filter(def=>def.type===\"code\");const mergedCoupons=instances.filter(inst=>inst.coupon_code===code).map(inst=>{const def=codeDefs.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return def?{...def,...inst}:null;}).filter(Boolean);if(mergedCoupons.length===0){alert(\"쿠폰이 존재하지 않거나 쿠폰번호가 잘못되었습니다.\");return;}const[found]=mergedCoupons;// 🔁 중복 제한(요구사항 반영): exclusive ↔ 모든 code형 쿠폰 상호배타\nconst appliedCodeCoupons=(store.enteredCouponCode??[]).map(appliedCode=>{const inst=instances.find(i=>i.coupon_code===appliedCode);if(!inst)return null;const def=definitions.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return def?{...def,...inst}:null;}).filter(c=>c&&c.type===\"code\");const hasAppliedExclusiveCode=appliedCodeCoupons.some(c=>c.exclusive===true);if(found.exclusive){// 이미 어떤 code형 쿠폰이라도 적용돼 있으면 exclusive는 불가\nif(appliedCodeCoupons.length>0){const conflict=appliedCodeCoupons[0];alert(`해당 쿠폰은 단독형 쿠폰으로, 기존 쿠폰(${conflict.description})과 함께 사용할 수 없습니다.`);return;}}else{// exclusive가 한 번이라도 적용돼 있으면 모든 code형 쿠폰 추가 불가\nif(hasAppliedExclusiveCode){const conflict=appliedCodeCoupons.find(c=>c.exclusive===true);alert(`이미 단독형 쿠폰(${conflict.description})이 적용되어 있어 다른 쿠폰을 사용할 수 없습니다.`);return;}}// 수취인/멤버십 일치 검증\nconst n=v=>String(v??\"\").replace(/[\\s\\-./]/g,\"\").toLowerCase().trim();const mismatch=(a,b)=>n(a)!==n(b);const hasMembership=found.membership_number!=null&&n(found.membership_number)!==\"\";const membershipMismatch=mismatch(found.membership_number,store.membership_number);const infoMismatch=mismatch(found.receiver_info?.name,formStore.reserver_name)||mismatch(found.receiver_info?.birthdate,formStore.reserver_birthdate)||mismatch(found.receiver_info?.contact,formStore.reserver_phone);const isEmptyCoupon=!found.receiver_info?.name&&!found.receiver_info?.birthdate&&!found.receiver_info?.contact&&!hasMembership;const shouldAlert=hasMembership?membershipMismatch:infoMismatch;if(!isEmptyCoupon&&shouldAlert){alert(\"쿠폰이 존재하지 않거나 쿠폰번호가 잘못되었습니다.\");return;}if(found.status!==\"available\"){alert(\"이 쿠폰은 현재 사용이 불가능합니다.\");return;}if(found.coupon_due){const now=new Date;const due=new Date(found.coupon_due);if(isNaN(due.getTime())||now>due){alert(\"이 쿠폰의 유효기간이 지났습니다.\");return;}}// ----------------------------\n// 날짜 준비/검증\n// ----------------------------\nconst queryParams=new URLSearchParams(window.location.search);const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDateFromQuery=first?parseDate(first):null;const secondDateFromQuery=second?parseDate(second):null;const firstDateObj=store.firstDate??firstDateFromQuery;const secondDateObj=store.secondDate??secondDateFromQuery;if(!firstDateObj||!secondDateObj){alert(\"체크인/체크아웃 날짜를 먼저 선택한 뒤 쿠폰을 적용해주세요.\");return;}// ----------------------------\n// 카테고리 맵 로드\n// ----------------------------\nlet categoryMap={};try{const holidayRes=await fetch(\"https://terene-db-server.onrender.com/api/v3/days\");const days=await holidayRes.json();const rawMap={};for(const item of days){rawMap[item.date]=item.category;}categoryMap=toCategoryMap(rawMap);}catch(err){console.error(\"❌ Category map load failed:\",err);categoryMap={};}console.log(\"firstDateObj\",firstDateObj);console.log(\"secondDateObj\",secondDateObj);// ----------------------------\n// 일자별 가격 계산 (명시적 날짜 전달)\n// ----------------------------\nconst{dailyItems}=calculateInitialPrices({...store},categoryMap,categoryDefs,firstDateObj,secondDateObj);// 글로벌 + 현재 코드만 구성\nconst globalDefs=definitions.filter(def=>def.type===\"global\");const couponsForCheck=[...globalDefs,found];// 가상 store: enteredCouponCode에 현재 코드 포함\nconst simulatedStore={...store,enteredCouponCode:[...store.enteredCouponCode??[],code]};// 필터 통과 여부\nconst{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(couponsForCheck,simulatedStore,dailyItems);// const codes = couponsForCheck\n//     .filter((c) => c.coupon_code && c.coupon_code[0] == \"H\") // coupon_code 필드가 존재하는 쿠폰만\n//     .map((c) => c.coupon_code as string) // 문자열로 추출\n// alert(\n//     `B-1) check: ${JSON.stringify(codes)}\\npassedSecondary: ${JSON.stringify(passedSecondaryCoupons)}`\n// )\nconst targetId=found.coupon_instance_id||found.coupon_definition_id;const included=passedSecondaryCoupons.some(c=>(c.coupon_instance_id||c.coupon_definition_id)===targetId);if(!included){// 🔸 필터에서 제외된 경우\nalert(`사용할 수 없는 쿠폰 조건입니다.`);return;}// 실제 할인액 계산\nconst{secondaryDetails}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,simulatedStore);const detail=secondaryDetails.find(d=>d.id===targetId);const appliedAmount=detail?.amount??0;if(!detail||appliedAmount<=0){// 🔸 필터는 통과했지만, 적용 가능한 결제 금액(잔액/상한)을 초과해 0원 처리된 경우\nalert(\"결제 할인 금액을 초과하여 쿠폰을 사용할 수 없습니다.\");return;}// 최종 적용\nconst isConfirmed=window.confirm(`쿠폰 ${code}을 적용합니다.`);if(isConfirmed){setStore({enteredCouponCode:[...store.enteredCouponCode??[],code]});}}catch(error){console.error(\"쿠폰 확인 중 오류 발생:\",error);alert(\"쿠폰 확인 중 오류가 발생했습니다. 다시 시도해주세요.\");}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}export async function fetchTotalMileage(membershipNumber){try{const res=await fetch(\"https://terene-db-server.onrender.com/api/v2/mileages\");if(!res.ok)throw new Error(\"Failed to fetch mileage data\");const data=await res.json();const userMileage=data.filter(m=>m.membership_number===membershipNumber);const totalAmount=userMileage.reduce((sum,entry)=>sum+Number(entry.mileage_amount||0),0);return totalAmount;}catch(error){console.error(\"마일리지 조회 실패:\",error);return 0;}}export function toggleMileage(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({mileage:Number(inputValue)});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleSpecialRequests(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({special_requests:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,autoCapitalize:\"none\",autoCorrect:\"off\",spellCheck:false,inputMode:\"text\",onChange:handleChange});};}export function handleAnniversaryDropdown(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const selectedValue=event.target.value;if(selectedValue!==\"기념일 종류\"){setStore({anniversary_type:selectedValue});}};return /*#__PURE__*/_jsx(Component,{...props,value:store.anniversary_type,onChange:handleChange});};}export function toggleAnniversaryName(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({anniversary_name:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleAnniversaryValue(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({anniversary_value:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}// ----- 토스 결제 / Paypal 결제 분기점 -----\nexport function toggleTossPayment(Component){return props=>{const[store,setStore]=useStore();const[formStore,setformStore]=useFormStore();const[payment,setPayment]=useState(formStore.payment);const toggle=()=>{setStore({payment:\"toss\"});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function togglePaypalPayment(Component){return props=>{const[store,setStore]=useStore();const[formStore,setformStore]=useFormStore();const[payment,setPayment]=useState(formStore.payment);const toggle=()=>{setStore({payment:\"paypal\"});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function toggleForeignCardPayment(Component){return props=>{const[store,setStore]=useStore();const[formStore,setformStore]=useFormStore();const[payment,setPayment]=useState(formStore.payment);const toggle=()=>{setStore({payment:\"foreignCard\"});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function toggleRefundName(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({refund_name:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleRefundPhone(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({refund_phone:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function handleRefundBank(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const selectedValue=event.target.value;if(selectedValue!==\"은행명\"){setStore({refund_bank:selectedValue});}};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleRefundAccount(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({refund_account:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function getAvailableMileage(Component){return props=>{const[store]=useStore();return /*#__PURE__*/_jsx(Component,{...props,text:`사용 가능 ${(store.totalMileage-store.usedMileage).toLocaleString()}p`});};}export function getTotalMileage(Component){return props=>{const[store,setStore]=useStore();React.useEffect(()=>{const fetchMileages=async()=>{if(!store.membership_number)return;try{const res=await fetch(\"https://terene-db-server.onrender.com/api/v2/mileages\");if(!res.ok)throw new Error(\"마일리지 조회 실패\");const data=await res.json();const sum=data.filter(m=>m.membership_number===store.membership_number).reduce((acc,m)=>acc+Number(m.mileage_amount||0),0);setStore({totalMileage:sum});}catch(e){console.error(\"마일리지 불러오기 실패:\",e);setStore({totalMileage:0});}};fetchMileages();},[store.membership_number]);return /*#__PURE__*/_jsx(Component,{...props,text:`보유 ${store.totalMileage.toLocaleString()}p`});};}export function applyMileage(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[store,setStore]=useStore();const handleClick=async()=>{if(!formStore.mileage){alert(`마일리지를 입력해주세요.`);return;}if(!Number.isInteger(formStore.mileage)||formStore.mileage<=0){alert(\"마일리지는 1 이상의 자연수로만 입력해주세요.\");return;}// if (!store.membership_number) {\n//     alert(\"멤버십 로그인이 필요합니다.\")\n//     return\n// }\n// const totalMileage = await fetchTotalMileage(\n//     store.membership_number\n// )\nconst availableMileage=store.totalMileage-store.usedMileage;if(formStore.mileage>availableMileage||availableMileage<=0){alert(`마일리지 수 부족: ${availableMileage.toLocaleString()}p`);return;}if(formStore.mileage>store.integratedPrice){alert(`최대 적용 가능한 마일리지 수를 초과하였습니다.\n현재 최대 적용 가능한 마일리지 수: ${store.integratedPrice.toLocaleString()}p`);return;}if(store.usedMileage==0){const isConfirmed=window.confirm(`마일리지 ${formStore.mileage.toLocaleString()}p를 적용합니다.`);if(isConfirmed){setStore({usedMileage:(store.usedMileage||0)+formStore.mileage});}}else{const isConfirmed=window.confirm(`마일리지 ${formStore.mileage.toLocaleString()}p를 추가로 적용합니다.`);if(isConfirmed){setStore({usedMileage:(store.usedMileage||0)+formStore.mileage});}}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}export function hidePaypalInfo(Component){return props=>{const[store,setStore]=useStore();if(store.payment!==\"paypal\")return null;return /*#__PURE__*/_jsx(Component,{...props});};}\nexport const __FramerMetadata__ = {\"exports\":{\"toggleBirthdate\":{\"type\":\"reactHoc\",\"name\":\"toggleBirthdate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleRefundAccount\":{\"type\":\"reactHoc\",\"name\":\"toggleRefundAccount\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleStayBirthdate\":{\"type\":\"reactHoc\",\"name\":\"toggleStayBirthdate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverNameNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverNameNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleSpecialRequests\":{\"type\":\"reactHoc\",\"name\":\"toggleSpecialRequests\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverBirthdateNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverBirthdateNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleForeignCardPayment\":{\"type\":\"reactHoc\",\"name\":\"toggleForeignCardPayment\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverName\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverEmailNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverEmailNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverBirthdate\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverBirthdate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverNumber\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverNumber\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"applyMileage\":{\"type\":\"reactHoc\",\"name\":\"applyMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverPhoneNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverPhoneNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"handleRefundBank\":{\"type\":\"reactHoc\",\"name\":\"handleRefundBank\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleAnniversaryValue\":{\"type\":\"reactHoc\",\"name\":\"toggleAnniversaryValue\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleStayPhone\":{\"type\":\"reactHoc\",\"name\":\"toggleStayPhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useFormStore\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleRefundName\":{\"type\":\"reactHoc\",\"name\":\"toggleRefundName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleEmail\":{\"type\":\"reactHoc\",\"name\":\"toggleEmail\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"togglePaypalPayment\":{\"type\":\"reactHoc\",\"name\":\"togglePaypalPayment\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"handleAnniversaryDropdown\":{\"type\":\"reactHoc\",\"name\":\"handleAnniversaryDropdown\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"hidePaypalInfo\":{\"type\":\"reactHoc\",\"name\":\"hidePaypalInfo\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getTotalMileage\":{\"type\":\"reactHoc\",\"name\":\"getTotalMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleName\":{\"type\":\"reactHoc\",\"name\":\"toggleName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleAnniversaryName\":{\"type\":\"reactHoc\",\"name\":\"toggleAnniversaryName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"checkRevisitAndCouponCode\":{\"type\":\"reactHoc\",\"name\":\"checkRevisitAndCouponCode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleRefundPhone\":{\"type\":\"reactHoc\",\"name\":\"toggleRefundPhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverPhone\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverPhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleTossPayment\":{\"type\":\"reactHoc\",\"name\":\"toggleTossPayment\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleMileage\":{\"type\":\"reactHoc\",\"name\":\"toggleMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getAvailableMileage\":{\"type\":\"reactHoc\",\"name\":\"getAvailableMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleCouponCode\":{\"type\":\"reactHoc\",\"name\":\"toggleCouponCode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"togglePhone\":{\"type\":\"reactHoc\",\"name\":\"togglePhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"handleEmailDomainDropdown\":{\"type\":\"reactHoc\",\"name\":\"handleEmailDomainDropdown\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverEmail\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverEmail\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"applyCouponCode\":{\"type\":\"reactHoc\",\"name\":\"applyCouponCode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleNationality\":{\"type\":\"reactHoc\",\"name\":\"toggleNationality\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleSameReserverStay\":{\"type\":\"reactHoc\",\"name\":\"toggleSameReserverStay\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleStayName\":{\"type\":\"reactHoc\",\"name\":\"toggleStayName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"fetchTotalMileage\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ReservationForm.map","// PriceDisplay.tsx\nimport{jsx as _jsx}from\"react/jsx-runtime\";import React,{useEffect,useMemo}from\"react\";import{useStore}from\"https://framerusercontent.com/modules/c2GloFFeVhaMQsbMcdTk/XiJZ0vjlltE7FPQAQ8Lk/MainStore.js\";import{useFormStore}from\"https://framerusercontent.com/modules/j1JmQpFlkCqsnz6Zbn4l/YjsxyPUIDz3mFiWkcq8K/ReservationForm.js\";import{calculateInitialPrices,filterCoupons,evaluateCoupons}from\"https://framerusercontent.com/modules/jTRIrvvdhM8hGc8tF4E7/Q2QLVylG6dtj4TyzXmqg/EvaluateCoupons.js\";import{useAdditionalServiceStore,createAdditionalServiceList}from\"https://framerusercontent.com/modules/k847LPNIMdkhfIs0ouwF/EUEOlsedw6DGLY16dhfq/AdditionalService.js\";import{parseDate}from\"https://framerusercontent.com/modules/1J9pgwrYtYGWgtmRStO4/muZZYJxbZe3foLJMfVTS/DateUtils.js\";import{motion}from\"framer-motion\";import{useDayCategoryDefinitions}from\"https://framerusercontent.com/modules/pKMQTtBDnyThccjiINTr/R6FlauGV8dPyEKPorKpi/useDayCategoryDefinitions.js\";const FadeIn=({children})=>/*#__PURE__*/_jsx(motion.div,{initial:{opacity:0,y:0},animate:{opacity:1,y:0},exit:{opacity:0,y:0},transition:{duration:.4,ease:\"easeOut\"},children:children});// 공휴일 카테고리 가져오기 (v3 구조 대응)\nexport function useHolidayCategoryMap(){const[categories,setCategories]=React.useState({});const[isLoading,setIsLoading]=React.useState(true);React.useEffect(()=>{fetch(\"https://terene-db-server.onrender.com/api/v3/days\").then(res=>res.json()).then(data=>{const map={};for(const item of data){// ✅ days_250928 구조 반영\n// item = { date, category, is_holiday, location, checkin_occupied, ... }\nmap[item.date]=item.category;}setCategories(map);}).catch(err=>console.error(\"Holiday fetch error\",err)).finally(()=>setIsLoading(false));},[]);return{categories,isLoading};}// ✅ 문자열 → 카테고리 매핑\nexport function toCategoryMap(input){return input;}export function useCoupons(){const[coupons,setCoupons]=React.useState([]);const[isLoading,setIsLoading]=React.useState(true);React.useEffect(()=>{async function fetchCoupons(){try{// Fetch definitions first\nconst defRes=await fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-definitions\");const definitions=await defRes.json();// Separate global and code types (ignore membership)\nconst globalDefs=definitions.filter(def=>def.type===\"global\");const codeDefs=definitions.filter(def=>def.type===\"code\");// Fetch instances only if there are code definitions\nlet codeInstances=[];if(codeDefs.length>0){const instRes=await fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-instances\");const instances=await instRes.json();codeInstances=instances.filter(inst=>codeDefs.some(def=>def.coupon_definition_id===inst.coupon_definition_id));}// Merge code definitions and their instances\nconst codeCoupons=codeInstances.map(inst=>{const def=codeDefs.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return{...def,...inst};});// Combine global and code coupons\nconst combined=[...globalDefs,...codeCoupons];// Sort by optional priority if present\nconst sorted=combined.sort((a,b)=>(a.priority||0)-(b.priority||0));setCoupons(sorted);}catch(err){console.error(\"Coupon fetch error:\",err);}finally{setIsLoading(false);}}fetchCoupons();},[]);return{coupons,isLoading};}function useDiscountCalculation(){const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isReady=store.firstDate&&store.secondDate||firstDate&&secondDate;const result=useMemo(()=>{if(!isReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice,dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);return{initialPrice,discountedPrice};},[store,categories,coupons,firstDate,secondDate,categoryLoading,couponLoading]);return{isLoading:!isReady||categoryLoading||couponLoading,data:result};}export function displayInitialPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();// console.log(\"### COUPONS ###\")\n// console.log(JSON.stringify(coupons))\nconst{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const text=store.payment===\"paypal\"?`KRW ${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")} 원`;return(// <FadeIn>\n/*#__PURE__*/_jsx(Component,{...props,text:text}));};}export function displayDiscountedPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const text=store.payment===\"paypal\"?`KRW ${Math.max(discountedPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(discountedPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}function transitionStyle(visible){return{opacity:visible?1:0,color:\"inherit\",transition:\"opacity 0.3s ease-in-out\",display:\"inline-block\"};}export function displayDiscountBar(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice,dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const show=initialPrice!==Math.max(discountedPrice,0);const baseStyle=transitionStyle(show);const width=initialPrice>=1e8?144:initialPrice>=1e7?128:112;const barStyle={...baseStyle,width,position:\"relative\",right:0,transform:`translateX(${92-width}px)`};// <Component {...props} style={barStyle} />\nreturn /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,style:baseStyle})});};}export function displaySoftInitialPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const text=store.payment===\"paypal\"?`KRW ${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function getAdditionalPrice(){const[store]=useStore();const[additionalServiceStore]=useAdditionalServiceStore();const additionalServiceList=createAdditionalServiceList(additionalServiceStore,store);const totalAmount=additionalServiceList.reduce((sum,service)=>{return sum+service.amount;},0);return totalAmount;}export function displayIntegratedPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=store.membership===\"All-Free\"?0:Math.max(discountedPrice,0)+additionalPrice;const text=store.payment===\"paypal\"?`KRW ${Math.max(integratedPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(integratedPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayExchangeMarginPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=Math.max(discountedPrice,0)+additionalPrice;const exchangeMarginPrice=store.membership===\"All-Free\"||store.payment!==\"paypal\"?0:Math.round(integratedPrice*.05)// 기존 가격의 5%만큼 환전 수수료 적용\n;const text=store.payment===\"paypal\"?`KRW ${Math.max(exchangeMarginPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(exchangeMarginPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayVatPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=Math.max(discountedPrice,0)+additionalPrice;const vatPrice=store.membership===\"All-Free\"?0:Math.round(integratedPrice*.1);const text=store.payment===\"paypal\"?`KRW ${Math.max(vatPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(vatPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayDepositPrice(Component){const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;return props=>{const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const depositPrice=store.membership===\"Non-Member\"?3e5:0;const text=store.payment===\"paypal\"?`KRW ${Math.max(depositPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(depositPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayFinalPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store,setStore]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;const priceData=useMemo(()=>{if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const initialPrice=dailyItems.reduce((sum,item)=>sum+item.price,0);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice,primaryDetails,secondaryDetails}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=store.membership===\"All-Free\"?0:Math.max(discountedPrice,0)+additionalPrice;const exchangeMarginPrice=store.payment===\"paypal\"?Math.round(integratedPrice*.05)// 기존 가격의 5%만큼 환전 수수료 적용\n:0;const vatPrice=Math.round(integratedPrice*.1);const depositPrice=store.membership===\"Non-Member\"?3e5:0;const finalPrice=store.membership===\"All-Free\"?0:integratedPrice+exchangeMarginPrice+vatPrice+depositPrice;const text=store.payment===\"paypal\"?`KRW ${Math.max(finalPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(finalPrice,0).toLocaleString(\"ko-KR\")} 원`;return{initialPrice,discountedPrice,additionalPrice,integratedPrice,exchangeMarginPrice,vatPrice,depositPrice,finalPrice,text,primaryDetails,secondaryDetails};},[isStoreReady,categoryLoading,couponLoading,store,categories,coupons,additionalPrice]);useEffect(()=>{if(!priceData)return;setStore(prev=>{const isSame=prev.finalPrice===priceData.finalPrice&&prev.initialPrice===priceData.initialPrice&&prev.discountedPrice===priceData.discountedPrice&&prev.additionalPrice===priceData.additionalPrice&&prev.integratedPrice===priceData.integratedPrice&&prev.exchangeMarginPrice===priceData.exchangeMarginPrice&&prev.vatPrice===priceData.vatPrice&&prev.depositPrice===priceData.depositPrice;if(isSame)return prev;return{...prev,initialPrice:priceData.initialPrice,discountedPrice:priceData.discountedPrice,additionalPrice:priceData.additionalPrice,integratedPrice:priceData.integratedPrice,exchangeMarginPrice:priceData.exchangeMarginPrice,vatPrice:priceData.vatPrice,depositPrice:priceData.depositPrice,finalPrice:priceData.finalPrice,couponPrimaryDetails:priceData.primaryDetails,couponSecondaryDetails:priceData.secondaryDetails};});},[priceData?.initialPrice,priceData?.discountedPrice,priceData?.additionalPrice,priceData?.integratedPrice,priceData?.exchangeMarginPrice,priceData?.vatPrice,priceData?.depositPrice,priceData?.finalPrice]);if(!priceData)return null;// console.log(priceData?.finalPrice)\nreturn /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:priceData.text})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"useCoupons\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayInitialPrice\":{\"type\":\"reactHoc\",\"name\":\"displayInitialPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayDiscountedPrice\":{\"type\":\"reactHoc\",\"name\":\"displayDiscountedPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useHolidayCategoryMap\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displaySoftInitialPrice\":{\"type\":\"reactHoc\",\"name\":\"displaySoftInitialPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayIntegratedPrice\":{\"type\":\"reactHoc\",\"name\":\"displayIntegratedPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayVatPrice\":{\"type\":\"reactHoc\",\"name\":\"displayVatPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayFinalPrice\":{\"type\":\"reactHoc\",\"name\":\"displayFinalPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayExchangeMarginPrice\":{\"type\":\"reactHoc\",\"name\":\"displayExchangeMarginPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toCategoryMap\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayDepositPrice\":{\"type\":\"reactHoc\",\"name\":\"displayDepositPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getAdditionalPrice\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayDiscountBar\":{\"type\":\"reactHoc\",\"name\":\"displayDiscountBar\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","import{jsx as _jsx}from\"react/jsx-runtime\";import{useState}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import*as React from\"react\";import{useStore}from\"https://framerusercontent.com/modules/c2GloFFeVhaMQsbMcdTk/XiJZ0vjlltE7FPQAQ8Lk/MainStore.js\";import{parseDate}from\"https://framerusercontent.com/modules/1J9pgwrYtYGWgtmRStO4/muZZYJxbZe3foLJMfVTS/DateUtils.js\";import{toCategoryMap}from\"https://framerusercontent.com/modules/t32tReeHmrCTzbf5rVbb/TLfCNhuEI4KQbK1YsDnN/PriceDisplay.js\";// ✅ 추가: 계산/필터 함수 import (PriceDisplay와 동일 파이프라인 사용)\nimport{calculateInitialPrices,filterCoupons,evaluateCoupons}from\"https://framerusercontent.com/modules/jTRIrvvdhM8hGc8tF4E7/Q2QLVylG6dtj4TyzXmqg/EvaluateCoupons.js\";import{useDayCategoryDefinitions}from\"https://framerusercontent.com/modules/pKMQTtBDnyThccjiINTr/R6FlauGV8dPyEKPorKpi/useDayCategoryDefinitions.js\";function getKSTDate(baseDate=new Date){const utc=baseDate.getTime()+baseDate.getTimezoneOffset()*6e4;return new Date(utc+9*60*60*1e3);}function getKSTISOString(date=new Date){const kstDate=getKSTDate(date);const pad=n=>String(n).padStart(2,\"0\");const year=kstDate.getFullYear();const month=pad(kstDate.getMonth()+1);const day=pad(kstDate.getDate());const hours=pad(kstDate.getHours());const minutes=pad(kstDate.getMinutes());const seconds=pad(kstDate.getSeconds());return`${year}-${month}-${day}T${hours}:${minutes}:${seconds}+09:00`;}export const useFormStore=createStore({name:null,birthdate:null,phone:null,email:null,emailDomain:null,nationality:\"domestic\",reserver_number:null,reserver_name:null,reserver_birthdate:null,reserver_phone:null,reserver_email:null,reserver_email_domain:null,isSameReserverStay:false,stay_name:null,stay_birthdate:null,stay_phone:null,couponCode:null,mileage:0,special_requests:null,anniversary_type:\"기념일 종류\",anniversary_name:null,anniversary_value:null,facility_policy:false,cancellation_policy:false,privacy_policy:false,marketing_consent:false,refund_name:null,refund_phone:null,refund_bank:null,refund_account:null});export function toggleName(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({name:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleBirthdate(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({birthdate:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function togglePhone(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({phone:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleEmail(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({email:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleNationality(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.nationality===\"domestic\"||mainStore.nationality===\"foreign\";// const shouldAutofill = false\nReact.useEffect(()=>{if(shouldAutofill&&formStore.nationality!==mainStore.nationality){setFormStore({nationality:mainStore.nationality});}},[shouldAutofill,mainStore.nationality]);const handleChange=value=>{setFormStore({nationality:value});};return /*#__PURE__*/_jsx(Component,{...props,disabled:shouldAutofill,selectedValue:shouldAutofill?mainStore.nationality:props.selectedValue,onChange:shouldAutofill?undefined:handleChange,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverNumber(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_number!==mainStore.membership_number){setFormStore({reserver_name:mainStore.membership_number});}},[shouldAutofill,mainStore.name]);const handleChange=event=>{setFormStore({reserver_number:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.membership_number:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverName(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_name!==mainStore.name){setFormStore({reserver_name:mainStore.name});}},[shouldAutofill,mainStore.name]);const handleChange=event=>{setFormStore({reserver_name:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.name:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverBirthdate(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_birthdate!==mainStore.birthdate){setFormStore({reserver_birthdate:mainStore.birthdate});}},[shouldAutofill,mainStore.birthdate]);const handleChange=event=>{setFormStore({reserver_birthdate:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.birthdate:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverPhone(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_phone!==mainStore.phone){setFormStore({reserver_phone:mainStore.phone});}},[shouldAutofill,mainStore.phone]);const handleChange=event=>{setFormStore({reserver_phone:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.phone:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverEmail(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_email!==mainStore.email){setFormStore({reserver_email:mainStore.email});}},[shouldAutofill,mainStore.email]);const handleChange=event=>{setFormStore({reserver_email:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.email:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function handleEmailDomainDropdown(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const selectedValue=event.target.value;if(selectedValue&&selectedValue!==\"직접 입력\"){setStore({reserver_email_domain:selectedValue});}};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleReserverNameNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_name!==mainStore.name){setFormStore({reserver_name:mainStore.name});}},[shouldAutofill,mainStore.name]);const handleChange=event=>{setFormStore({reserver_name:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.name:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverBirthdateNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_birthdate!==mainStore.birthdate){setFormStore({reserver_birthdate:mainStore.birthdate});}},[shouldAutofill,mainStore.birthdate]);const handleChange=event=>{setFormStore({reserver_birthdate:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.birthdate:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverPhoneNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_phone!==mainStore.phone){setFormStore({reserver_phone:mainStore.phone});}},[shouldAutofill,mainStore.phone]);const handleChange=event=>{setFormStore({reserver_phone:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.phone:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverEmailNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_email!==mainStore.email){setFormStore({reserver_email:mainStore.email});}},[shouldAutofill,mainStore.email]);const handleChange=event=>{setFormStore({reserver_email:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.email:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleSameReserverStay(Component){return props=>{const[store,setStore]=useFormStore();const toggle=()=>{setStore({isSameReserverStay:!store.isSameReserverStay});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function toggleStayName(Component){return props=>{const[store]=useStore();const[formStore,setFormStore]=useFormStore();const shouldAutofill=formStore.isSameReserverStay||store.membership==\"All-Free\";const autofillValue=formStore.reserver_name??\"\";React.useEffect(()=>{if(shouldAutofill&&formStore.stay_name!==autofillValue){setFormStore({stay_name:autofillValue});}},[shouldAutofill,autofillValue]);const handleChange=event=>{setFormStore({stay_name:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?autofillValue:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleStayBirthdate(Component){return props=>{const[store]=useStore();const[formStore,setFormStore]=useFormStore();const shouldAutofill=formStore.isSameReserverStay||store.membership==\"All-Free\";const autofillValue=formStore.reserver_birthdate??\"\";React.useEffect(()=>{if(shouldAutofill&&formStore.stay_birthdate!==autofillValue){setFormStore({stay_birthdate:autofillValue});}},[shouldAutofill,autofillValue]);const handleChange=event=>{setFormStore({stay_birthdate:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?autofillValue:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleStayPhone(Component){return props=>{const[store]=useStore();const[formStore,setFormStore]=useFormStore();const shouldAutofill=formStore.isSameReserverStay||store.membership==\"All-Free\";const autofillValue=formStore.reserver_phone??\"\";React.useEffect(()=>{if(shouldAutofill&&formStore.stay_phone!==autofillValue){setFormStore({stay_phone:autofillValue});}},[shouldAutofill,autofillValue]);const handleChange=event=>{setFormStore({stay_phone:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?autofillValue:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleCouponCode(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({couponCode:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function applyCouponCode(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[store,setStore]=useStore();const handleClick=async()=>{const code=formStore.couponCode?.trim();if(!code){alert(\"쿠폰 번호를 입력해주세요.\");return;}// if (store.expiredCoupons.includes(code)) {\n//     alert(\"한번 사용한 쿠폰은 재사용할 수 없습니다.\")\n//     return\n// }\nif(store.enteredCouponCode.includes(code)){alert(\"이미 적용된 쿠폰입니다.\");return;}try{// 쿠폰 데이터 가져오기\nconst[defRes,instRes]=await Promise.all([fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-definitions\"),fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-instances\")]);const definitions=await defRes.json();const instances=await instRes.json();// code 타입 정의만 필터링\nconst codeDefs=definitions.filter(def=>def.type===\"code\");// 인스턴스 + 정의 병합\nconst mergedCoupons=instances.filter(inst=>inst.coupon_code===code).map(inst=>{const def=codeDefs.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return def?{...def,...inst}:null;}).filter(Boolean);if(mergedCoupons.length===0){alert(\"쿠폰이 존재하지 않거나 쿠폰번호가 잘못되었습니다.\");return;}const[found]=mergedCoupons;// 상태 체크\nif(found.status!==\"available\"){alert(\"이 쿠폰은 현재 사용이 불가능합니다.\");return;}// 유효기간 체크\nif(found.coupon_due){const now=new Date;const due=new Date(found.coupon_due);if(isNaN(due.getTime())||now>due){alert(\"이 쿠폰의 유효기간이 지났습니다.\");return;}}// 적용 확인\nconst isConfirmed=window.confirm(`쿠폰 ${code}을 적용합니다.`);if(isConfirmed){setStore({enteredCouponCode:[...store.enteredCouponCode,code]});}}catch(error){console.error(\"쿠폰 확인 중 오류 발생:\",error);alert(\"쿠폰 확인 중 오류가 발생했습니다. 다시 시도해주세요.\");}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}// -----------------------------------------\nexport function checkRevisitAndCouponCode(Component){return props=>{const[formStore]=useFormStore();const[store,setStore]=useStore();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const handleClick=async()=>{const code=formStore.couponCode?.trim();if(!code){alert(\"쿠폰 번호를 입력해주세요.\");return;}try{// revisit 계산 (체크아웃 기준)\nconst ordersRes=await fetch(\"https://terene-db-server.onrender.com/api/v2/orders\");const orders=await ordersRes.json();const normalize=str=>str?.replace(/[\\s\\-./]/g,\"\").toLowerCase().trim();const revisitCount=orders.filter(order=>{return order.stay_status===\"checked_out\"&&normalize(order.reserver_name)===normalize(formStore.reserver_name)&&normalize(order.reserver_birthdate)===normalize(formStore.reserver_birthdate)&&normalize(order.reserver_contact)===normalize(formStore.reserver_phone);}).length;setStore({revisit:String(revisitCount)});if(store.enteredCouponCode?.includes(code)){alert(\"이미 적용된 쿠폰입니다.\");return;}// 쿠폰 정의/인스턴스 가져오기\nconst[defRes,instRes]=await Promise.all([fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-definitions\"),fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-instances\")]);const definitions=await defRes.json();const instances=await instRes.json();const codeDefs=definitions.filter(def=>def.type===\"code\");const mergedCoupons=instances.filter(inst=>inst.coupon_code===code).map(inst=>{const def=codeDefs.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return def?{...def,...inst}:null;}).filter(Boolean);if(mergedCoupons.length===0){alert(\"쿠폰이 존재하지 않거나 쿠폰번호가 잘못되었습니다.\");return;}const[found]=mergedCoupons;// 🔁 중복 제한(요구사항 반영): exclusive ↔ 모든 code형 쿠폰 상호배타\nconst appliedCodeCoupons=(store.enteredCouponCode??[]).map(appliedCode=>{const inst=instances.find(i=>i.coupon_code===appliedCode);if(!inst)return null;const def=definitions.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return def?{...def,...inst}:null;}).filter(c=>c&&c.type===\"code\");const hasAppliedExclusiveCode=appliedCodeCoupons.some(c=>c.exclusive===true);if(found.exclusive){// 이미 어떤 code형 쿠폰이라도 적용돼 있으면 exclusive는 불가\nif(appliedCodeCoupons.length>0){const conflict=appliedCodeCoupons[0];alert(`해당 쿠폰은 단독형 쿠폰으로, 기존 쿠폰(${conflict.description})과 함께 사용할 수 없습니다.`);return;}}else{// exclusive가 한 번이라도 적용돼 있으면 모든 code형 쿠폰 추가 불가\nif(hasAppliedExclusiveCode){const conflict=appliedCodeCoupons.find(c=>c.exclusive===true);alert(`이미 단독형 쿠폰(${conflict.description})이 적용되어 있어 다른 쿠폰을 사용할 수 없습니다.`);return;}}// 수취인/멤버십 일치 검증\nconst n=v=>String(v??\"\").replace(/[\\s\\-./]/g,\"\").toLowerCase().trim();const mismatch=(a,b)=>n(a)!==n(b);const hasMembership=found.membership_number!=null&&n(found.membership_number)!==\"\";const membershipMismatch=mismatch(found.membership_number,store.membership_number);const infoMismatch=mismatch(found.receiver_info?.name,formStore.reserver_name)||mismatch(found.receiver_info?.birthdate,formStore.reserver_birthdate)||mismatch(found.receiver_info?.contact,formStore.reserver_phone);const isEmptyCoupon=!found.receiver_info?.name&&!found.receiver_info?.birthdate&&!found.receiver_info?.contact&&!hasMembership;const shouldAlert=hasMembership?membershipMismatch:infoMismatch;if(!isEmptyCoupon&&shouldAlert){alert(\"쿠폰이 존재하지 않거나 쿠폰번호가 잘못되었습니다.\");return;}if(found.status!==\"available\"){alert(\"이 쿠폰은 현재 사용이 불가능합니다.\");return;}if(found.coupon_due){const now=new Date;const due=new Date(found.coupon_due);if(isNaN(due.getTime())||now>due){alert(\"이 쿠폰의 유효기간이 지났습니다.\");return;}}// ----------------------------\n// 날짜 준비/검증\n// ----------------------------\nconst queryParams=new URLSearchParams(window.location.search);const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDateFromQuery=first?parseDate(first):null;const secondDateFromQuery=second?parseDate(second):null;const firstDateObj=store.firstDate??firstDateFromQuery;const secondDateObj=store.secondDate??secondDateFromQuery;if(!firstDateObj||!secondDateObj){alert(\"체크인/체크아웃 날짜를 먼저 선택한 뒤 쿠폰을 적용해주세요.\");return;}// ----------------------------\n// 카테고리 맵 로드\n// ----------------------------\nlet categoryMap={};try{const holidayRes=await fetch(\"https://terene-db-server.onrender.com/api/v3/days\");const days=await holidayRes.json();const rawMap={};for(const item of days){rawMap[item.date]=item.category;}categoryMap=toCategoryMap(rawMap);}catch(err){console.error(\"❌ Category map load failed:\",err);categoryMap={};}console.log(\"firstDateObj\",firstDateObj);console.log(\"secondDateObj\",secondDateObj);// ----------------------------\n// 일자별 가격 계산 (명시적 날짜 전달)\n// ----------------------------\nconst{dailyItems}=calculateInitialPrices({...store},categoryMap,categoryDefs,firstDateObj,secondDateObj);// 글로벌 + 현재 코드만 구성\nconst globalDefs=definitions.filter(def=>def.type===\"global\");const couponsForCheck=[...globalDefs,found];// 가상 store: enteredCouponCode에 현재 코드 포함\nconst simulatedStore={...store,enteredCouponCode:[...store.enteredCouponCode??[],code]};// 필터 통과 여부\nconst{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(couponsForCheck,simulatedStore,dailyItems);// const codes = couponsForCheck\n//     .filter((c) => c.coupon_code && c.coupon_code[0] == \"H\") // coupon_code 필드가 존재하는 쿠폰만\n//     .map((c) => c.coupon_code as string) // 문자열로 추출\n// alert(\n//     `B-1) check: ${JSON.stringify(codes)}\\npassedSecondary: ${JSON.stringify(passedSecondaryCoupons)}`\n// )\nconst targetId=found.coupon_instance_id||found.coupon_definition_id;const included=passedSecondaryCoupons.some(c=>(c.coupon_instance_id||c.coupon_definition_id)===targetId);if(!included){// 🔸 필터에서 제외된 경우\nalert(`사용할 수 없는 쿠폰 조건입니다.`);return;}// 실제 할인액 계산\nconst{secondaryDetails}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,simulatedStore);const detail=secondaryDetails.find(d=>d.id===targetId);const appliedAmount=detail?.amount??0;if(!detail||appliedAmount<=0){// 🔸 필터는 통과했지만, 적용 가능한 결제 금액(잔액/상한)을 초과해 0원 처리된 경우\nalert(\"결제 할인 금액을 초과하여 쿠폰을 사용할 수 없습니다.\");return;}// 최종 적용\nconst isConfirmed=window.confirm(`쿠폰 ${code}을 적용합니다.`);if(isConfirmed){setStore({enteredCouponCode:[...store.enteredCouponCode??[],code]});}}catch(error){console.error(\"쿠폰 확인 중 오류 발생:\",error);alert(\"쿠폰 확인 중 오류가 발생했습니다. 다시 시도해주세요.\");}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}export async function fetchTotalMileage(membershipNumber){try{const res=await fetch(\"https://terene-db-server.onrender.com/api/v2/mileages\");if(!res.ok)throw new Error(\"Failed to fetch mileage data\");const data=await res.json();const userMileage=data.filter(m=>m.membership_number===membershipNumber);const totalAmount=userMileage.reduce((sum,entry)=>sum+Number(entry.mileage_amount||0),0);return totalAmount;}catch(error){console.error(\"마일리지 조회 실패:\",error);return 0;}}export function toggleMileage(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({mileage:Number(inputValue)});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleSpecialRequests(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({special_requests:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,autoCapitalize:\"none\",autoCorrect:\"off\",spellCheck:false,inputMode:\"text\",onChange:handleChange});};}export function handleAnniversaryDropdown(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const selectedValue=event.target.value;if(selectedValue!==\"기념일 종류\"){setStore({anniversary_type:selectedValue});}};return /*#__PURE__*/_jsx(Component,{...props,value:store.anniversary_type,onChange:handleChange});};}export function toggleAnniversaryName(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({anniversary_name:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleAnniversaryValue(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({anniversary_value:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}// ----- 토스 결제 / Paypal 결제 분기점 -----\nexport function toggleTossPayment(Component){return props=>{const[store,setStore]=useStore();const[formStore,setformStore]=useFormStore();const[payment,setPayment]=useState(formStore.payment);const toggle=()=>{setStore({payment:\"toss\"});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function togglePaypalPayment(Component){return props=>{const[store,setStore]=useStore();const[formStore,setformStore]=useFormStore();const[payment,setPayment]=useState(formStore.payment);const toggle=()=>{setStore({payment:\"paypal\"});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function toggleForeignCardPayment(Component){return props=>{const[store,setStore]=useStore();const[formStore,setformStore]=useFormStore();const[payment,setPayment]=useState(formStore.payment);const toggle=()=>{setStore({payment:\"foreignCard\"});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function toggleRefundName(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({refund_name:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleRefundPhone(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({refund_phone:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function handleRefundBank(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const selectedValue=event.target.value;if(selectedValue!==\"은행명\"){setStore({refund_bank:selectedValue});}};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleRefundAccount(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({refund_account:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function getAvailableMileage(Component){return props=>{const[store]=useStore();return /*#__PURE__*/_jsx(Component,{...props,text:`사용 가능 ${(store.totalMileage-store.usedMileage).toLocaleString()}p`});};}export function getTotalMileage(Component){return props=>{const[store,setStore]=useStore();React.useEffect(()=>{const fetchMileages=async()=>{if(!store.membership_number)return;try{const res=await fetch(\"https://terene-db-server.onrender.com/api/v2/mileages\");if(!res.ok)throw new Error(\"마일리지 조회 실패\");const data=await res.json();const sum=data.filter(m=>m.membership_number===store.membership_number).reduce((acc,m)=>acc+Number(m.mileage_amount||0),0);setStore({totalMileage:sum});}catch(e){console.error(\"마일리지 불러오기 실패:\",e);setStore({totalMileage:0});}};fetchMileages();},[store.membership_number]);return /*#__PURE__*/_jsx(Component,{...props,text:`보유 ${store.totalMileage.toLocaleString()}p`});};}export function applyMileage(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[store,setStore]=useStore();const handleClick=async()=>{if(!formStore.mileage){alert(`마일리지를 입력해주세요.`);return;}if(!Number.isInteger(formStore.mileage)||formStore.mileage<=0){alert(\"마일리지는 1 이상의 자연수로만 입력해주세요.\");return;}// if (!store.membership_number) {\n//     alert(\"멤버십 로그인이 필요합니다.\")\n//     return\n// }\n// const totalMileage = await fetchTotalMileage(\n//     store.membership_number\n// )\nconst availableMileage=store.totalMileage-store.usedMileage;if(formStore.mileage>availableMileage||availableMileage<=0){alert(`마일리지 수 부족: ${availableMileage.toLocaleString()}p`);return;}if(formStore.mileage>store.integratedPrice){alert(`최대 적용 가능한 마일리지 수를 초과하였습니다.\n현재 최대 적용 가능한 마일리지 수: ${store.integratedPrice.toLocaleString()}p`);return;}if(store.usedMileage==0){const isConfirmed=window.confirm(`마일리지 ${formStore.mileage.toLocaleString()}p를 적용합니다.`);if(isConfirmed){setStore({usedMileage:(store.usedMileage||0)+formStore.mileage});}}else{const isConfirmed=window.confirm(`마일리지 ${formStore.mileage.toLocaleString()}p를 추가로 적용합니다.`);if(isConfirmed){setStore({usedMileage:(store.usedMileage||0)+formStore.mileage});}}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}export function hidePaypalInfo(Component){return props=>{const[store,setStore]=useStore();if(store.payment!==\"paypal\")return null;return /*#__PURE__*/_jsx(Component,{...props});};}\nexport const __FramerMetadata__ = {\"exports\":{\"toggleTossPayment\":{\"type\":\"reactHoc\",\"name\":\"toggleTossPayment\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"togglePaypalPayment\":{\"type\":\"reactHoc\",\"name\":\"togglePaypalPayment\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverName\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverNumber\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverNumber\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleRefundAccount\":{\"type\":\"reactHoc\",\"name\":\"toggleRefundAccount\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getTotalMileage\":{\"type\":\"reactHoc\",\"name\":\"getTotalMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverEmail\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverEmail\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleStayBirthdate\":{\"type\":\"reactHoc\",\"name\":\"toggleStayBirthdate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"hidePaypalInfo\":{\"type\":\"reactHoc\",\"name\":\"hidePaypalInfo\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverBirthdateNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverBirthdateNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleBirthdate\":{\"type\":\"reactHoc\",\"name\":\"toggleBirthdate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleAnniversaryValue\":{\"type\":\"reactHoc\",\"name\":\"toggleAnniversaryValue\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleStayName\":{\"type\":\"reactHoc\",\"name\":\"toggleStayName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"fetchTotalMileage\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"handleAnniversaryDropdown\":{\"type\":\"reactHoc\",\"name\":\"handleAnniversaryDropdown\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"handleRefundBank\":{\"type\":\"reactHoc\",\"name\":\"handleRefundBank\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleSameReserverStay\":{\"type\":\"reactHoc\",\"name\":\"toggleSameReserverStay\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleNationality\":{\"type\":\"reactHoc\",\"name\":\"toggleNationality\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleRefundName\":{\"type\":\"reactHoc\",\"name\":\"toggleRefundName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleEmail\":{\"type\":\"reactHoc\",\"name\":\"toggleEmail\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"checkRevisitAndCouponCode\":{\"type\":\"reactHoc\",\"name\":\"checkRevisitAndCouponCode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverPhone\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverPhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleCouponCode\":{\"type\":\"reactHoc\",\"name\":\"toggleCouponCode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleName\":{\"type\":\"reactHoc\",\"name\":\"toggleName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useFormStore\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverPhoneNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverPhoneNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverNameNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverNameNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"handleEmailDomainDropdown\":{\"type\":\"reactHoc\",\"name\":\"handleEmailDomainDropdown\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleStayPhone\":{\"type\":\"reactHoc\",\"name\":\"toggleStayPhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverBirthdate\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverBirthdate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverEmailNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverEmailNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleForeignCardPayment\":{\"type\":\"reactHoc\",\"name\":\"toggleForeignCardPayment\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"applyMileage\":{\"type\":\"reactHoc\",\"name\":\"applyMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleSpecialRequests\":{\"type\":\"reactHoc\",\"name\":\"toggleSpecialRequests\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"applyCouponCode\":{\"type\":\"reactHoc\",\"name\":\"applyCouponCode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleRefundPhone\":{\"type\":\"reactHoc\",\"name\":\"toggleRefundPhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"togglePhone\":{\"type\":\"reactHoc\",\"name\":\"togglePhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getAvailableMileage\":{\"type\":\"reactHoc\",\"name\":\"getAvailableMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleMileage\":{\"type\":\"reactHoc\",\"name\":\"toggleMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleAnniversaryName\":{\"type\":\"reactHoc\",\"name\":\"toggleAnniversaryName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ReservationForm.map","// PriceDisplay.tsx\nimport{jsx as _jsx}from\"react/jsx-runtime\";import React,{useEffect,useMemo}from\"react\";import{useStore}from\"https://framerusercontent.com/modules/c2GloFFeVhaMQsbMcdTk/XiJZ0vjlltE7FPQAQ8Lk/MainStore.js\";import{useFormStore}from\"https://framerusercontent.com/modules/j1JmQpFlkCqsnz6Zbn4l/sQOM0NWjDE6RjJGyiNKC/ReservationForm.js\";import{calculateInitialPrices,filterCoupons,evaluateCoupons}from\"https://framerusercontent.com/modules/jTRIrvvdhM8hGc8tF4E7/Q2QLVylG6dtj4TyzXmqg/EvaluateCoupons.js\";import{useAdditionalServiceStore,createAdditionalServiceList}from\"https://framerusercontent.com/modules/k847LPNIMdkhfIs0ouwF/EUEOlsedw6DGLY16dhfq/AdditionalService.js\";import{parseDate}from\"https://framerusercontent.com/modules/1J9pgwrYtYGWgtmRStO4/muZZYJxbZe3foLJMfVTS/DateUtils.js\";import{motion}from\"framer-motion\";import{useDayCategoryDefinitions}from\"https://framerusercontent.com/modules/pKMQTtBDnyThccjiINTr/R6FlauGV8dPyEKPorKpi/useDayCategoryDefinitions.js\";const FadeIn=({children})=>/*#__PURE__*/_jsx(motion.div,{initial:{opacity:0,y:0},animate:{opacity:1,y:0},exit:{opacity:0,y:0},transition:{duration:.4,ease:\"easeOut\"},children:children});// 공휴일 카테고리 가져오기 (v3 구조 대응)\nexport function useHolidayCategoryMap(){const[categories,setCategories]=React.useState({});const[isLoading,setIsLoading]=React.useState(true);React.useEffect(()=>{fetch(\"https://terene-db-server.onrender.com/api/v3/days\").then(res=>res.json()).then(data=>{const map={};for(const item of data){// ✅ days_250928 구조 반영\n// item = { date, category, is_holiday, location, checkin_occupied, ... }\nmap[item.date]=item.category;}setCategories(map);}).catch(err=>console.error(\"Holiday fetch error\",err)).finally(()=>setIsLoading(false));},[]);return{categories,isLoading};}// ✅ 문자열 → 카테고리 매핑\nexport function toCategoryMap(input){return input;}export function useCoupons(){const[coupons,setCoupons]=React.useState([]);const[isLoading,setIsLoading]=React.useState(true);React.useEffect(()=>{async function fetchCoupons(){try{// Fetch definitions first\nconst defRes=await fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-definitions\");const definitions=await defRes.json();// Separate global and code types (ignore membership)\nconst globalDefs=definitions.filter(def=>def.type===\"global\");const codeDefs=definitions.filter(def=>def.type===\"code\");// Fetch instances only if there are code definitions\nlet codeInstances=[];if(codeDefs.length>0){const instRes=await fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-instances\");const instances=await instRes.json();codeInstances=instances.filter(inst=>codeDefs.some(def=>def.coupon_definition_id===inst.coupon_definition_id));}// Merge code definitions and their instances\nconst codeCoupons=codeInstances.map(inst=>{const def=codeDefs.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return{...def,...inst};});// Combine global and code coupons\nconst combined=[...globalDefs,...codeCoupons];// Sort by optional priority if present\nconst sorted=combined.sort((a,b)=>(a.priority||0)-(b.priority||0));setCoupons(sorted);}catch(err){console.error(\"Coupon fetch error:\",err);}finally{setIsLoading(false);}}fetchCoupons();},[]);return{coupons,isLoading};}function useDiscountCalculation(){const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isReady=store.firstDate&&store.secondDate||firstDate&&secondDate;const result=useMemo(()=>{if(!isReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice,dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);return{initialPrice,discountedPrice};},[store,categories,coupons,firstDate,secondDate,categoryLoading,couponLoading]);return{isLoading:!isReady||categoryLoading||couponLoading,data:result};}export function displayInitialPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();// console.log(\"### COUPONS ###\")\n// console.log(JSON.stringify(coupons))\nconst{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const text=store.payment===\"paypal\"?`KRW ${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")} 원`;return(// <FadeIn>\n/*#__PURE__*/_jsx(Component,{...props,text:text}));};}export function displayDiscountedPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const text=store.payment===\"paypal\"?`KRW ${Math.max(discountedPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(discountedPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}function transitionStyle(visible){return{opacity:visible?1:0,color:\"inherit\",transition:\"opacity 0.3s ease-in-out\",display:\"inline-block\"};}export function displayDiscountBar(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice,dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const show=initialPrice!==Math.max(discountedPrice,0);const baseStyle=transitionStyle(show);const width=initialPrice>=1e8?144:initialPrice>=1e7?128:112;const barStyle={...baseStyle,width,position:\"relative\",right:0,transform:`translateX(${92-width}px)`};// <Component {...props} style={barStyle} />\nreturn /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,style:baseStyle})});};}export function displaySoftInitialPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const text=store.payment===\"paypal\"?`KRW ${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function getAdditionalPrice(){const[store]=useStore();const[additionalServiceStore]=useAdditionalServiceStore();const additionalServiceList=createAdditionalServiceList(additionalServiceStore,store);const totalAmount=additionalServiceList.reduce((sum,service)=>{return sum+service.amount;},0);return totalAmount;}export function displayIntegratedPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=store.membership===\"All-Free\"?0:Math.max(discountedPrice,0)+additionalPrice;const text=store.payment===\"paypal\"?`KRW ${Math.max(integratedPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(integratedPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayExchangeMarginPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=Math.max(discountedPrice,0)+additionalPrice;const exchangeMarginPrice=store.membership===\"All-Free\"||store.payment!==\"paypal\"?0:Math.round(integratedPrice*.05)// 기존 가격의 5%만큼 환전 수수료 적용\n;const text=store.payment===\"paypal\"?`KRW ${Math.max(exchangeMarginPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(exchangeMarginPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayVatPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=Math.max(discountedPrice,0)+additionalPrice;const vatPrice=store.membership===\"All-Free\"?0:Math.round(integratedPrice*.1);const text=store.payment===\"paypal\"?`KRW ${Math.max(vatPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(vatPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayDepositPrice(Component){const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;return props=>{const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const depositPrice=store.membership===\"Non-Member\"?3e5:0;const text=store.payment===\"paypal\"?`KRW ${Math.max(depositPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(depositPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayFinalPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store,setStore]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;const priceData=useMemo(()=>{if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const initialPrice=dailyItems.reduce((sum,item)=>sum+item.price,0);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice,primaryDetails,secondaryDetails}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=store.membership===\"All-Free\"?0:Math.max(discountedPrice,0)+additionalPrice;const exchangeMarginPrice=store.payment===\"paypal\"?Math.round(integratedPrice*.05)// 기존 가격의 5%만큼 환전 수수료 적용\n:0;const vatPrice=Math.round(integratedPrice*.1);const depositPrice=store.membership===\"Non-Member\"?3e5:0;const finalPrice=store.membership===\"All-Free\"?0:integratedPrice+exchangeMarginPrice+vatPrice+depositPrice;const text=store.payment===\"paypal\"?`KRW ${Math.max(finalPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(finalPrice,0).toLocaleString(\"ko-KR\")} 원`;return{initialPrice,discountedPrice,additionalPrice,integratedPrice,exchangeMarginPrice,vatPrice,depositPrice,finalPrice,text,primaryDetails,secondaryDetails};},[isStoreReady,categoryLoading,couponLoading,store,categories,coupons,additionalPrice]);useEffect(()=>{if(!priceData)return;setStore(prev=>{const isSame=prev.finalPrice===priceData.finalPrice&&prev.initialPrice===priceData.initialPrice&&prev.discountedPrice===priceData.discountedPrice&&prev.additionalPrice===priceData.additionalPrice&&prev.integratedPrice===priceData.integratedPrice&&prev.exchangeMarginPrice===priceData.exchangeMarginPrice&&prev.vatPrice===priceData.vatPrice&&prev.depositPrice===priceData.depositPrice;if(isSame)return prev;return{...prev,initialPrice:priceData.initialPrice,discountedPrice:priceData.discountedPrice,additionalPrice:priceData.additionalPrice,integratedPrice:priceData.integratedPrice,exchangeMarginPrice:priceData.exchangeMarginPrice,vatPrice:priceData.vatPrice,depositPrice:priceData.depositPrice,finalPrice:priceData.finalPrice,couponPrimaryDetails:priceData.primaryDetails,couponSecondaryDetails:priceData.secondaryDetails};});},[priceData?.initialPrice,priceData?.discountedPrice,priceData?.additionalPrice,priceData?.integratedPrice,priceData?.exchangeMarginPrice,priceData?.vatPrice,priceData?.depositPrice,priceData?.finalPrice]);if(!priceData)return null;// console.log(priceData?.finalPrice)\nreturn /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:priceData.text})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"useCoupons\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayInitialPrice\":{\"type\":\"reactHoc\",\"name\":\"displayInitialPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayDiscountedPrice\":{\"type\":\"reactHoc\",\"name\":\"displayDiscountedPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useHolidayCategoryMap\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displaySoftInitialPrice\":{\"type\":\"reactHoc\",\"name\":\"displaySoftInitialPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayIntegratedPrice\":{\"type\":\"reactHoc\",\"name\":\"displayIntegratedPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayVatPrice\":{\"type\":\"reactHoc\",\"name\":\"displayVatPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayFinalPrice\":{\"type\":\"reactHoc\",\"name\":\"displayFinalPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayExchangeMarginPrice\":{\"type\":\"reactHoc\",\"name\":\"displayExchangeMarginPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toCategoryMap\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayDepositPrice\":{\"type\":\"reactHoc\",\"name\":\"displayDepositPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getAdditionalPrice\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayDiscountBar\":{\"type\":\"reactHoc\",\"name\":\"displayDiscountBar\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","import{jsx as _jsx}from\"react/jsx-runtime\";import{useState}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import*as React from\"react\";import{useStore}from\"https://framerusercontent.com/modules/c2GloFFeVhaMQsbMcdTk/XiJZ0vjlltE7FPQAQ8Lk/MainStore.js\";import{parseDate}from\"https://framerusercontent.com/modules/1J9pgwrYtYGWgtmRStO4/muZZYJxbZe3foLJMfVTS/DateUtils.js\";import{toCategoryMap}from\"https://framerusercontent.com/modules/t32tReeHmrCTzbf5rVbb/De8eB0ZfIM1LfAH1YA89/PriceDisplay.js\";// ✅ 추가: 계산/필터 함수 import (PriceDisplay와 동일 파이프라인 사용)\nimport{calculateInitialPrices,filterCoupons,evaluateCoupons}from\"https://framerusercontent.com/modules/jTRIrvvdhM8hGc8tF4E7/Q2QLVylG6dtj4TyzXmqg/EvaluateCoupons.js\";import{useDayCategoryDefinitions}from\"https://framerusercontent.com/modules/pKMQTtBDnyThccjiINTr/R6FlauGV8dPyEKPorKpi/useDayCategoryDefinitions.js\";function getKSTDate(baseDate=new Date){const utc=baseDate.getTime()+baseDate.getTimezoneOffset()*6e4;return new Date(utc+9*60*60*1e3);}function getKSTISOString(date=new Date){const kstDate=getKSTDate(date);const pad=n=>String(n).padStart(2,\"0\");const year=kstDate.getFullYear();const month=pad(kstDate.getMonth()+1);const day=pad(kstDate.getDate());const hours=pad(kstDate.getHours());const minutes=pad(kstDate.getMinutes());const seconds=pad(kstDate.getSeconds());return`${year}-${month}-${day}T${hours}:${minutes}:${seconds}+09:00`;}export const useFormStore=createStore({name:null,birthdate:null,phone:null,email:null,emailDomain:null,nationality:\"domestic\",reserver_number:null,reserver_name:null,reserver_birthdate:null,reserver_phone:null,reserver_email:null,reserver_email_domain:null,isSameReserverStay:false,stay_name:null,stay_birthdate:null,stay_phone:null,couponCode:null,mileage:0,special_requests:null,anniversary_type:\"기념일 종류\",anniversary_name:null,anniversary_value:null,facility_policy:false,cancellation_policy:false,privacy_policy:false,marketing_consent:false,refund_name:null,refund_phone:null,refund_bank:null,refund_account:null});export function toggleName(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({name:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleBirthdate(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({birthdate:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function togglePhone(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({phone:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleEmail(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({email:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleNationality(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.nationality===\"domestic\"||mainStore.nationality===\"foreign\";// const shouldAutofill = false\nReact.useEffect(()=>{if(shouldAutofill&&formStore.nationality!==mainStore.nationality){setFormStore({nationality:mainStore.nationality});}},[shouldAutofill,mainStore.nationality]);const handleChange=value=>{setFormStore({nationality:value});};return /*#__PURE__*/_jsx(Component,{...props,disabled:shouldAutofill,selectedValue:shouldAutofill?mainStore.nationality:props.selectedValue,onChange:shouldAutofill?undefined:handleChange,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverNumber(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_number!==mainStore.membership_number){setFormStore({reserver_name:mainStore.membership_number});}},[shouldAutofill,mainStore.name]);const handleChange=event=>{setFormStore({reserver_number:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.membership_number:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverName(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_name!==mainStore.name){setFormStore({reserver_name:mainStore.name});}},[shouldAutofill,mainStore.name]);const handleChange=event=>{setFormStore({reserver_name:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.name:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverBirthdate(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_birthdate!==mainStore.birthdate){setFormStore({reserver_birthdate:mainStore.birthdate});}},[shouldAutofill,mainStore.birthdate]);const handleChange=event=>{setFormStore({reserver_birthdate:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.birthdate:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverPhone(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_phone!==mainStore.phone){setFormStore({reserver_phone:mainStore.phone});}},[shouldAutofill,mainStore.phone]);const handleChange=event=>{setFormStore({reserver_phone:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.phone:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverEmail(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_email!==mainStore.email){setFormStore({reserver_email:mainStore.email});}},[shouldAutofill,mainStore.email]);const handleChange=event=>{setFormStore({reserver_email:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.email:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function handleEmailDomainDropdown(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const selectedValue=event.target.value;if(selectedValue&&selectedValue!==\"직접 입력\"){setStore({reserver_email_domain:selectedValue});}};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleReserverNameNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_name!==mainStore.name){setFormStore({reserver_name:mainStore.name});}},[shouldAutofill,mainStore.name]);const handleChange=event=>{setFormStore({reserver_name:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.name:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverBirthdateNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_birthdate!==mainStore.birthdate){setFormStore({reserver_birthdate:mainStore.birthdate});}},[shouldAutofill,mainStore.birthdate]);const handleChange=event=>{setFormStore({reserver_birthdate:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.birthdate:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverPhoneNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_phone!==mainStore.phone){setFormStore({reserver_phone:mainStore.phone});}},[shouldAutofill,mainStore.phone]);const handleChange=event=>{setFormStore({reserver_phone:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.phone:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverEmailNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_email!==mainStore.email){setFormStore({reserver_email:mainStore.email});}},[shouldAutofill,mainStore.email]);const handleChange=event=>{setFormStore({reserver_email:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.email:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleSameReserverStay(Component){return props=>{const[store,setStore]=useFormStore();const toggle=()=>{setStore({isSameReserverStay:!store.isSameReserverStay});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function toggleStayName(Component){return props=>{const[store]=useStore();const[formStore,setFormStore]=useFormStore();const shouldAutofill=formStore.isSameReserverStay||store.membership==\"All-Free\";const autofillValue=formStore.reserver_name??\"\";React.useEffect(()=>{if(shouldAutofill&&formStore.stay_name!==autofillValue){setFormStore({stay_name:autofillValue});}},[shouldAutofill,autofillValue]);const handleChange=event=>{setFormStore({stay_name:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?autofillValue:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleStayBirthdate(Component){return props=>{const[store]=useStore();const[formStore,setFormStore]=useFormStore();const shouldAutofill=formStore.isSameReserverStay||store.membership==\"All-Free\";const autofillValue=formStore.reserver_birthdate??\"\";React.useEffect(()=>{if(shouldAutofill&&formStore.stay_birthdate!==autofillValue){setFormStore({stay_birthdate:autofillValue});}},[shouldAutofill,autofillValue]);const handleChange=event=>{setFormStore({stay_birthdate:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?autofillValue:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleStayPhone(Component){return props=>{const[store]=useStore();const[formStore,setFormStore]=useFormStore();const shouldAutofill=formStore.isSameReserverStay||store.membership==\"All-Free\";const autofillValue=formStore.reserver_phone??\"\";React.useEffect(()=>{if(shouldAutofill&&formStore.stay_phone!==autofillValue){setFormStore({stay_phone:autofillValue});}},[shouldAutofill,autofillValue]);const handleChange=event=>{setFormStore({stay_phone:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?autofillValue:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleCouponCode(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({couponCode:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function applyCouponCode(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[store,setStore]=useStore();const handleClick=async()=>{const code=formStore.couponCode?.trim();if(!code){alert(\"쿠폰 번호를 입력해주세요.\");return;}// if (store.expiredCoupons.includes(code)) {\n//     alert(\"한번 사용한 쿠폰은 재사용할 수 없습니다.\")\n//     return\n// }\nif(store.enteredCouponCode.includes(code)){alert(\"이미 적용된 쿠폰입니다.\");return;}try{// 쿠폰 데이터 가져오기\nconst[defRes,instRes]=await Promise.all([fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-definitions\"),fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-instances\")]);const definitions=await defRes.json();const instances=await instRes.json();// code 타입 정의만 필터링\nconst codeDefs=definitions.filter(def=>def.type===\"code\");// 인스턴스 + 정의 병합\nconst mergedCoupons=instances.filter(inst=>inst.coupon_code===code).map(inst=>{const def=codeDefs.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return def?{...def,...inst}:null;}).filter(Boolean);if(mergedCoupons.length===0){alert(\"쿠폰이 존재하지 않거나 쿠폰번호가 잘못되었습니다.\");return;}const[found]=mergedCoupons;// 상태 체크\nif(found.status!==\"available\"){alert(\"이 쿠폰은 현재 사용이 불가능합니다.\");return;}// 유효기간 체크\nif(found.coupon_due){const now=new Date;const due=new Date(found.coupon_due);if(isNaN(due.getTime())||now>due){alert(\"이 쿠폰의 유효기간이 지났습니다.\");return;}}// 적용 확인\nconst isConfirmed=window.confirm(`쿠폰 ${code}을 적용합니다.`);if(isConfirmed){setStore({enteredCouponCode:[...store.enteredCouponCode,code]});}}catch(error){console.error(\"쿠폰 확인 중 오류 발생:\",error);alert(\"쿠폰 확인 중 오류가 발생했습니다. 다시 시도해주세요.\");}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}// -----------------------------------------\nexport function checkRevisitAndCouponCode(Component){return props=>{const[formStore]=useFormStore();const[store,setStore]=useStore();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const handleClick=async()=>{const code=formStore.couponCode?.trim();if(!code){alert(\"쿠폰 번호를 입력해주세요.\");return;}try{// revisit 계산 (체크아웃 기준)\nconst ordersRes=await fetch(\"https://terene-db-server.onrender.com/api/v2/orders\");const orders=await ordersRes.json();const normalize=str=>str?.replace(/[\\s\\-./]/g,\"\").toLowerCase().trim();const revisitCount=orders.filter(order=>{return order.stay_status===\"checked_out\"&&normalize(order.reserver_name)===normalize(formStore.reserver_name)&&normalize(order.reserver_birthdate)===normalize(formStore.reserver_birthdate)&&normalize(order.reserver_contact)===normalize(formStore.reserver_phone);}).length;setStore({revisit:String(revisitCount)});if(store.enteredCouponCode?.includes(code)){alert(\"이미 적용된 쿠폰입니다.\");return;}// 쿠폰 정의/인스턴스 가져오기\nconst[defRes,instRes]=await Promise.all([fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-definitions\"),fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-instances\")]);const definitions=await defRes.json();const instances=await instRes.json();const codeDefs=definitions.filter(def=>def.type===\"code\");const mergedCoupons=instances.filter(inst=>inst.coupon_code===code).map(inst=>{const def=codeDefs.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return def?{...def,...inst}:null;}).filter(Boolean);if(mergedCoupons.length===0){alert(\"쿠폰이 존재하지 않거나 쿠폰번호가 잘못되었습니다.\");return;}const[found]=mergedCoupons;// 🔁 중복 제한(요구사항 반영): exclusive ↔ 모든 code형 쿠폰 상호배타\nconst appliedCodeCoupons=(store.enteredCouponCode??[]).map(appliedCode=>{const inst=instances.find(i=>i.coupon_code===appliedCode);if(!inst)return null;const def=definitions.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return def?{...def,...inst}:null;}).filter(c=>c&&c.type===\"code\");const hasAppliedExclusiveCode=appliedCodeCoupons.some(c=>c.exclusive===true);if(found.exclusive){// 이미 어떤 code형 쿠폰이라도 적용돼 있으면 exclusive는 불가\nif(appliedCodeCoupons.length>0){const conflict=appliedCodeCoupons[0];alert(`해당 쿠폰은 단독형 쿠폰으로, 기존 쿠폰(${conflict.description})과 함께 사용할 수 없습니다.`);return;}}else{// exclusive가 한 번이라도 적용돼 있으면 모든 code형 쿠폰 추가 불가\nif(hasAppliedExclusiveCode){const conflict=appliedCodeCoupons.find(c=>c.exclusive===true);alert(`이미 단독형 쿠폰(${conflict.description})이 적용되어 있어 다른 쿠폰을 사용할 수 없습니다.`);return;}}// 수취인/멤버십 일치 검증\nconst n=v=>String(v??\"\").replace(/[\\s\\-./]/g,\"\").toLowerCase().trim();const mismatch=(a,b)=>n(a)!==n(b);const hasMembership=found.membership_number!=null&&n(found.membership_number)!==\"\";const membershipMismatch=mismatch(found.membership_number,store.membership_number);const infoMismatch=mismatch(found.receiver_info?.name,formStore.reserver_name)||mismatch(found.receiver_info?.birthdate,formStore.reserver_birthdate)||mismatch(found.receiver_info?.contact,formStore.reserver_phone);const isEmptyCoupon=!found.receiver_info?.name&&!found.receiver_info?.birthdate&&!found.receiver_info?.contact&&!hasMembership;const shouldAlert=hasMembership?membershipMismatch:infoMismatch;if(!isEmptyCoupon&&shouldAlert){alert(\"쿠폰이 존재하지 않거나 쿠폰번호가 잘못되었습니다.\");return;}if(found.status!==\"available\"){alert(\"이 쿠폰은 현재 사용이 불가능합니다.\");return;}if(found.coupon_due){const now=new Date;const due=new Date(found.coupon_due);if(isNaN(due.getTime())||now>due){alert(\"이 쿠폰의 유효기간이 지났습니다.\");return;}}// ----------------------------\n// 날짜 준비/검증\n// ----------------------------\nconst queryParams=new URLSearchParams(window.location.search);const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDateFromQuery=first?parseDate(first):null;const secondDateFromQuery=second?parseDate(second):null;const firstDateObj=store.firstDate??firstDateFromQuery;const secondDateObj=store.secondDate??secondDateFromQuery;if(!firstDateObj||!secondDateObj){alert(\"체크인/체크아웃 날짜를 먼저 선택한 뒤 쿠폰을 적용해주세요.\");return;}// ----------------------------\n// 카테고리 맵 로드\n// ----------------------------\nlet categoryMap={};try{const holidayRes=await fetch(\"https://terene-db-server.onrender.com/api/v3/days\");const days=await holidayRes.json();const rawMap={};for(const item of days){rawMap[item.date]=item.category;}categoryMap=toCategoryMap(rawMap);}catch(err){console.error(\"❌ Category map load failed:\",err);categoryMap={};}console.log(\"firstDateObj\",firstDateObj);console.log(\"secondDateObj\",secondDateObj);// ----------------------------\n// 일자별 가격 계산 (명시적 날짜 전달)\n// ----------------------------\nconst{dailyItems}=calculateInitialPrices({...store},categoryMap,categoryDefs,firstDateObj,secondDateObj);// 글로벌 + 현재 코드만 구성\nconst globalDefs=definitions.filter(def=>def.type===\"global\");const couponsForCheck=[...globalDefs,found];// 가상 store: enteredCouponCode에 현재 코드 포함\nconst simulatedStore={...store,enteredCouponCode:[...store.enteredCouponCode??[],code]};// 필터 통과 여부\nconst{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(couponsForCheck,simulatedStore,dailyItems);// const codes = couponsForCheck\n//     .filter((c) => c.coupon_code && c.coupon_code[0] == \"H\") // coupon_code 필드가 존재하는 쿠폰만\n//     .map((c) => c.coupon_code as string) // 문자열로 추출\n// alert(\n//     `B-1) check: ${JSON.stringify(codes)}\\npassedSecondary: ${JSON.stringify(passedSecondaryCoupons)}`\n// )\nconst targetId=found.coupon_instance_id||found.coupon_definition_id;const included=passedSecondaryCoupons.some(c=>(c.coupon_instance_id||c.coupon_definition_id)===targetId);if(!included){// 🔸 필터에서 제외된 경우\nalert(`사용할 수 없는 쿠폰 조건입니다.`);return;}// 실제 할인액 계산\nconst{secondaryDetails}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,simulatedStore);const detail=secondaryDetails.find(d=>d.id===targetId);const appliedAmount=detail?.amount??0;if(!detail||appliedAmount<=0){// 🔸 필터는 통과했지만, 적용 가능한 결제 금액(잔액/상한)을 초과해 0원 처리된 경우\nalert(\"결제 할인 금액을 초과하여 쿠폰을 사용할 수 없습니다.\");return;}// 최종 적용\nconst isConfirmed=window.confirm(`쿠폰 ${code}을 적용합니다.`);if(isConfirmed){setStore({enteredCouponCode:[...store.enteredCouponCode??[],code]});}}catch(error){console.error(\"쿠폰 확인 중 오류 발생:\",error);alert(\"쿠폰 확인 중 오류가 발생했습니다. 다시 시도해주세요.\");}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}export async function fetchTotalMileage(membershipNumber){try{const res=await fetch(\"https://terene-db-server.onrender.com/api/v2/mileages\");if(!res.ok)throw new Error(\"Failed to fetch mileage data\");const data=await res.json();const userMileage=data.filter(m=>m.membership_number===membershipNumber);const totalAmount=userMileage.reduce((sum,entry)=>sum+Number(entry.mileage_amount||0),0);return totalAmount;}catch(error){console.error(\"마일리지 조회 실패:\",error);return 0;}}export function toggleMileage(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({mileage:Number(inputValue)});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleSpecialRequests(Component){return props=>{const[,setStore]=useFormStore();const sync=v=>{setStore({special_requests:String(v??\"\")});};const handleChange=e=>{sync(e?.target?.value);};const handlePaste=e=>{const text=e?.clipboardData?.getData?.(\"text/plain\")??e?.clipboardData?.getData?.(\"text\")??\"\";if(text){e.preventDefault();sync(text);}};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange,onPaste:handlePaste});};}export function handleAnniversaryDropdown(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const selectedValue=event.target.value;if(selectedValue!==\"기념일 종류\"){setStore({anniversary_type:selectedValue});}};return /*#__PURE__*/_jsx(Component,{...props,value:store.anniversary_type,onChange:handleChange});};}export function toggleAnniversaryName(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({anniversary_name:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleAnniversaryValue(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({anniversary_value:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}// ----- 토스 결제 / Paypal 결제 분기점 -----\nexport function toggleTossPayment(Component){return props=>{const[store,setStore]=useStore();const[formStore,setformStore]=useFormStore();const[payment,setPayment]=useState(formStore.payment);const toggle=()=>{setStore({payment:\"toss\"});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function togglePaypalPayment(Component){return props=>{const[store,setStore]=useStore();const[formStore,setformStore]=useFormStore();const[payment,setPayment]=useState(formStore.payment);const toggle=()=>{setStore({payment:\"paypal\"});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function toggleForeignCardPayment(Component){return props=>{const[store,setStore]=useStore();const[formStore,setformStore]=useFormStore();const[payment,setPayment]=useState(formStore.payment);const toggle=()=>{setStore({payment:\"foreignCard\"});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function toggleRefundName(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({refund_name:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleRefundPhone(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({refund_phone:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function handleRefundBank(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const selectedValue=event.target.value;if(selectedValue!==\"은행명\"){setStore({refund_bank:selectedValue});}};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleRefundAccount(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({refund_account:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function getAvailableMileage(Component){return props=>{const[store]=useStore();return /*#__PURE__*/_jsx(Component,{...props,text:`사용 가능 ${(store.totalMileage-store.usedMileage).toLocaleString()}p`});};}export function getTotalMileage(Component){return props=>{const[store,setStore]=useStore();React.useEffect(()=>{const fetchMileages=async()=>{if(!store.membership_number)return;try{const res=await fetch(\"https://terene-db-server.onrender.com/api/v2/mileages\");if(!res.ok)throw new Error(\"마일리지 조회 실패\");const data=await res.json();const sum=data.filter(m=>m.membership_number===store.membership_number).reduce((acc,m)=>acc+Number(m.mileage_amount||0),0);setStore({totalMileage:sum});}catch(e){console.error(\"마일리지 불러오기 실패:\",e);setStore({totalMileage:0});}};fetchMileages();},[store.membership_number]);return /*#__PURE__*/_jsx(Component,{...props,text:`보유 ${store.totalMileage.toLocaleString()}p`});};}export function applyMileage(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[store,setStore]=useStore();const handleClick=async()=>{if(!formStore.mileage){alert(`마일리지를 입력해주세요.`);return;}if(!Number.isInteger(formStore.mileage)||formStore.mileage<=0){alert(\"마일리지는 1 이상의 자연수로만 입력해주세요.\");return;}// if (!store.membership_number) {\n//     alert(\"멤버십 로그인이 필요합니다.\")\n//     return\n// }\n// const totalMileage = await fetchTotalMileage(\n//     store.membership_number\n// )\nconst availableMileage=store.totalMileage-store.usedMileage;if(formStore.mileage>availableMileage||availableMileage<=0){alert(`마일리지 수 부족: ${availableMileage.toLocaleString()}p`);return;}if(formStore.mileage>store.integratedPrice){alert(`최대 적용 가능한 마일리지 수를 초과하였습니다.\n현재 최대 적용 가능한 마일리지 수: ${store.integratedPrice.toLocaleString()}p`);return;}if(store.usedMileage==0){const isConfirmed=window.confirm(`마일리지 ${formStore.mileage.toLocaleString()}p를 적용합니다.`);if(isConfirmed){setStore({usedMileage:(store.usedMileage||0)+formStore.mileage});}}else{const isConfirmed=window.confirm(`마일리지 ${formStore.mileage.toLocaleString()}p를 추가로 적용합니다.`);if(isConfirmed){setStore({usedMileage:(store.usedMileage||0)+formStore.mileage});}}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}export function hidePaypalInfo(Component){return props=>{const[store,setStore]=useStore();if(store.payment!==\"paypal\")return null;return /*#__PURE__*/_jsx(Component,{...props});};}\nexport const __FramerMetadata__ = {\"exports\":{\"toggleMileage\":{\"type\":\"reactHoc\",\"name\":\"toggleMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useFormStore\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getAvailableMileage\":{\"type\":\"reactHoc\",\"name\":\"getAvailableMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"fetchTotalMileage\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"handleEmailDomainDropdown\":{\"type\":\"reactHoc\",\"name\":\"handleEmailDomainDropdown\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleTossPayment\":{\"type\":\"reactHoc\",\"name\":\"toggleTossPayment\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverEmail\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverEmail\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverEmailNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverEmailNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleSpecialRequests\":{\"type\":\"reactHoc\",\"name\":\"toggleSpecialRequests\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleForeignCardPayment\":{\"type\":\"reactHoc\",\"name\":\"toggleForeignCardPayment\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleBirthdate\":{\"type\":\"reactHoc\",\"name\":\"toggleBirthdate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"applyCouponCode\":{\"type\":\"reactHoc\",\"name\":\"applyCouponCode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getTotalMileage\":{\"type\":\"reactHoc\",\"name\":\"getTotalMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleAnniversaryName\":{\"type\":\"reactHoc\",\"name\":\"toggleAnniversaryName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleRefundAccount\":{\"type\":\"reactHoc\",\"name\":\"toggleRefundAccount\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"handleAnniversaryDropdown\":{\"type\":\"reactHoc\",\"name\":\"handleAnniversaryDropdown\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverBirthdate\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverBirthdate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleEmail\":{\"type\":\"reactHoc\",\"name\":\"toggleEmail\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"applyMileage\":{\"type\":\"reactHoc\",\"name\":\"applyMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleStayBirthdate\":{\"type\":\"reactHoc\",\"name\":\"toggleStayBirthdate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleCouponCode\":{\"type\":\"reactHoc\",\"name\":\"toggleCouponCode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverPhoneNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverPhoneNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleSameReserverStay\":{\"type\":\"reactHoc\",\"name\":\"toggleSameReserverStay\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleNationality\":{\"type\":\"reactHoc\",\"name\":\"toggleNationality\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverName\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"handleRefundBank\":{\"type\":\"reactHoc\",\"name\":\"handleRefundBank\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleRefundPhone\":{\"type\":\"reactHoc\",\"name\":\"toggleRefundPhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverPhone\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverPhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"togglePaypalPayment\":{\"type\":\"reactHoc\",\"name\":\"togglePaypalPayment\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"hidePaypalInfo\":{\"type\":\"reactHoc\",\"name\":\"hidePaypalInfo\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleStayPhone\":{\"type\":\"reactHoc\",\"name\":\"toggleStayPhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"togglePhone\":{\"type\":\"reactHoc\",\"name\":\"togglePhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleRefundName\":{\"type\":\"reactHoc\",\"name\":\"toggleRefundName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleStayName\":{\"type\":\"reactHoc\",\"name\":\"toggleStayName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverBirthdateNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverBirthdateNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"checkRevisitAndCouponCode\":{\"type\":\"reactHoc\",\"name\":\"checkRevisitAndCouponCode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleName\":{\"type\":\"reactHoc\",\"name\":\"toggleName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverNumber\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverNumber\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleAnniversaryValue\":{\"type\":\"reactHoc\",\"name\":\"toggleAnniversaryValue\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverNameNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverNameNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ReservationForm.map","// PriceDisplay.tsx\nimport{jsx as _jsx}from\"react/jsx-runtime\";import React,{useEffect,useMemo}from\"react\";import{useStore}from\"https://framerusercontent.com/modules/c2GloFFeVhaMQsbMcdTk/XiJZ0vjlltE7FPQAQ8Lk/MainStore.js\";import{useFormStore}from\"https://framerusercontent.com/modules/j1JmQpFlkCqsnz6Zbn4l/NSaVcHRS2cI5mCDsFap1/ReservationForm.js\";import{calculateInitialPrices,filterCoupons,evaluateCoupons}from\"https://framerusercontent.com/modules/jTRIrvvdhM8hGc8tF4E7/Q2QLVylG6dtj4TyzXmqg/EvaluateCoupons.js\";import{useAdditionalServiceStore,createAdditionalServiceList}from\"https://framerusercontent.com/modules/k847LPNIMdkhfIs0ouwF/EUEOlsedw6DGLY16dhfq/AdditionalService.js\";import{parseDate}from\"https://framerusercontent.com/modules/1J9pgwrYtYGWgtmRStO4/muZZYJxbZe3foLJMfVTS/DateUtils.js\";import{motion}from\"framer-motion\";import{useDayCategoryDefinitions}from\"https://framerusercontent.com/modules/pKMQTtBDnyThccjiINTr/R6FlauGV8dPyEKPorKpi/useDayCategoryDefinitions.js\";const FadeIn=({children})=>/*#__PURE__*/_jsx(motion.div,{initial:{opacity:0,y:0},animate:{opacity:1,y:0},exit:{opacity:0,y:0},transition:{duration:.4,ease:\"easeOut\"},children:children});// 공휴일 카테고리 가져오기 (v3 구조 대응)\nexport function useHolidayCategoryMap(){const[categories,setCategories]=React.useState({});const[isLoading,setIsLoading]=React.useState(true);React.useEffect(()=>{fetch(\"https://terene-db-server.onrender.com/api/v3/days\").then(res=>res.json()).then(data=>{const map={};for(const item of data){// ✅ days_250928 구조 반영\n// item = { date, category, is_holiday, location, checkin_occupied, ... }\nmap[item.date]=item.category;}setCategories(map);}).catch(err=>console.error(\"Holiday fetch error\",err)).finally(()=>setIsLoading(false));},[]);return{categories,isLoading};}// ✅ 문자열 → 카테고리 매핑\nexport function toCategoryMap(input){return input;}export function useCoupons(){const[coupons,setCoupons]=React.useState([]);const[isLoading,setIsLoading]=React.useState(true);React.useEffect(()=>{async function fetchCoupons(){try{// Fetch definitions first\nconst defRes=await fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-definitions\");const definitions=await defRes.json();// Separate global and code types (ignore membership)\nconst globalDefs=definitions.filter(def=>def.type===\"global\");const codeDefs=definitions.filter(def=>def.type===\"code\");// Fetch instances only if there are code definitions\nlet codeInstances=[];if(codeDefs.length>0){const instRes=await fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-instances\");const instances=await instRes.json();codeInstances=instances.filter(inst=>codeDefs.some(def=>def.coupon_definition_id===inst.coupon_definition_id));}// Merge code definitions and their instances\nconst codeCoupons=codeInstances.map(inst=>{const def=codeDefs.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return{...def,...inst};});// Combine global and code coupons\nconst combined=[...globalDefs,...codeCoupons];// Sort by optional priority if present\nconst sorted=combined.sort((a,b)=>(a.priority||0)-(b.priority||0));setCoupons(sorted);}catch(err){console.error(\"Coupon fetch error:\",err);}finally{setIsLoading(false);}}fetchCoupons();},[]);return{coupons,isLoading};}function useDiscountCalculation(){const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isReady=store.firstDate&&store.secondDate||firstDate&&secondDate;const result=useMemo(()=>{if(!isReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice,dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);return{initialPrice,discountedPrice};},[store,categories,coupons,firstDate,secondDate,categoryLoading,couponLoading]);return{isLoading:!isReady||categoryLoading||couponLoading,data:result};}export function displayInitialPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();// console.log(\"### COUPONS ###\")\n// console.log(JSON.stringify(coupons))\nconst{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const text=store.payment===\"paypal\"?`KRW ${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")} 원`;return(// <FadeIn>\n/*#__PURE__*/_jsx(Component,{...props,text:text}));};}export function displayDiscountedPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const text=store.payment===\"paypal\"?`KRW ${Math.max(discountedPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(discountedPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}function transitionStyle(visible){return{opacity:visible?1:0,color:\"inherit\",transition:\"opacity 0.3s ease-in-out\",display:\"inline-block\"};}export function displayDiscountBar(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice,dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const show=initialPrice!==Math.max(discountedPrice,0);const baseStyle=transitionStyle(show);const width=initialPrice>=1e8?144:initialPrice>=1e7?128:112;const barStyle={...baseStyle,width,position:\"relative\",right:0,transform:`translateX(${92-width}px)`};// <Component {...props} style={barStyle} />\nreturn /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,style:baseStyle})});};}export function displaySoftInitialPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const text=store.payment===\"paypal\"?`KRW ${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function getAdditionalPrice(){const[store]=useStore();const[additionalServiceStore]=useAdditionalServiceStore();const additionalServiceList=createAdditionalServiceList(additionalServiceStore,store);const totalAmount=additionalServiceList.reduce((sum,service)=>{return sum+service.amount;},0);return totalAmount;}export function displayIntegratedPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=store.membership===\"All-Free\"?0:Math.max(discountedPrice,0)+additionalPrice;const text=store.payment===\"paypal\"?`KRW ${Math.max(integratedPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(integratedPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayExchangeMarginPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=Math.max(discountedPrice,0)+additionalPrice;const exchangeMarginPrice=store.membership===\"All-Free\"||store.payment!==\"paypal\"?0:Math.round(integratedPrice*.05)// 기존 가격의 5%만큼 환전 수수료 적용\n;const text=store.payment===\"paypal\"?`KRW ${Math.max(exchangeMarginPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(exchangeMarginPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayVatPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=Math.max(discountedPrice,0)+additionalPrice;const vatPrice=store.membership===\"All-Free\"?0:Math.round(integratedPrice*.1);const text=store.payment===\"paypal\"?`KRW ${Math.max(vatPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(vatPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayDepositPrice(Component){const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;return props=>{const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const depositPrice=store.membership===\"Non-Member\"?3e5:0;const text=store.payment===\"paypal\"?`KRW ${Math.max(depositPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(depositPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayFinalPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store,setStore]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;const priceData=useMemo(()=>{if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const initialPrice=dailyItems.reduce((sum,item)=>sum+item.price,0);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice,primaryDetails,secondaryDetails}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=store.membership===\"All-Free\"?0:Math.max(discountedPrice,0)+additionalPrice;const exchangeMarginPrice=store.payment===\"paypal\"?Math.round(integratedPrice*.05)// 기존 가격의 5%만큼 환전 수수료 적용\n:0;const vatPrice=Math.round(integratedPrice*.1);const depositPrice=store.membership===\"Non-Member\"?3e5:0;const finalPrice=store.membership===\"All-Free\"?0:integratedPrice+exchangeMarginPrice+vatPrice+depositPrice;const text=store.payment===\"paypal\"?`KRW ${Math.max(finalPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(finalPrice,0).toLocaleString(\"ko-KR\")} 원`;return{initialPrice,discountedPrice,additionalPrice,integratedPrice,exchangeMarginPrice,vatPrice,depositPrice,finalPrice,text,primaryDetails,secondaryDetails};},[isStoreReady,categoryLoading,couponLoading,store,categories,coupons,additionalPrice]);useEffect(()=>{if(!priceData)return;setStore(prev=>{const isSame=prev.finalPrice===priceData.finalPrice&&prev.initialPrice===priceData.initialPrice&&prev.discountedPrice===priceData.discountedPrice&&prev.additionalPrice===priceData.additionalPrice&&prev.integratedPrice===priceData.integratedPrice&&prev.exchangeMarginPrice===priceData.exchangeMarginPrice&&prev.vatPrice===priceData.vatPrice&&prev.depositPrice===priceData.depositPrice;if(isSame)return prev;return{...prev,initialPrice:priceData.initialPrice,discountedPrice:priceData.discountedPrice,additionalPrice:priceData.additionalPrice,integratedPrice:priceData.integratedPrice,exchangeMarginPrice:priceData.exchangeMarginPrice,vatPrice:priceData.vatPrice,depositPrice:priceData.depositPrice,finalPrice:priceData.finalPrice,couponPrimaryDetails:priceData.primaryDetails,couponSecondaryDetails:priceData.secondaryDetails};});},[priceData?.initialPrice,priceData?.discountedPrice,priceData?.additionalPrice,priceData?.integratedPrice,priceData?.exchangeMarginPrice,priceData?.vatPrice,priceData?.depositPrice,priceData?.finalPrice]);if(!priceData)return null;// console.log(priceData?.finalPrice)\nreturn /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:priceData.text})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"useCoupons\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayInitialPrice\":{\"type\":\"reactHoc\",\"name\":\"displayInitialPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayDiscountedPrice\":{\"type\":\"reactHoc\",\"name\":\"displayDiscountedPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useHolidayCategoryMap\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displaySoftInitialPrice\":{\"type\":\"reactHoc\",\"name\":\"displaySoftInitialPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayIntegratedPrice\":{\"type\":\"reactHoc\",\"name\":\"displayIntegratedPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayVatPrice\":{\"type\":\"reactHoc\",\"name\":\"displayVatPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayFinalPrice\":{\"type\":\"reactHoc\",\"name\":\"displayFinalPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayExchangeMarginPrice\":{\"type\":\"reactHoc\",\"name\":\"displayExchangeMarginPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toCategoryMap\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayDepositPrice\":{\"type\":\"reactHoc\",\"name\":\"displayDepositPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getAdditionalPrice\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayDiscountBar\":{\"type\":\"reactHoc\",\"name\":\"displayDiscountBar\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","import{jsx as _jsx}from\"react/jsx-runtime\";import{useState}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import*as React from\"react\";import{useStore}from\"https://framerusercontent.com/modules/c2GloFFeVhaMQsbMcdTk/XiJZ0vjlltE7FPQAQ8Lk/MainStore.js\";import{parseDate}from\"https://framerusercontent.com/modules/1J9pgwrYtYGWgtmRStO4/muZZYJxbZe3foLJMfVTS/DateUtils.js\";import{toCategoryMap}from\"https://framerusercontent.com/modules/t32tReeHmrCTzbf5rVbb/3ELxjnSVbzBtkBySqj4t/PriceDisplay.js\";// ✅ 추가: 계산/필터 함수 import (PriceDisplay와 동일 파이프라인 사용)\nimport{calculateInitialPrices,filterCoupons,evaluateCoupons}from\"https://framerusercontent.com/modules/jTRIrvvdhM8hGc8tF4E7/Q2QLVylG6dtj4TyzXmqg/EvaluateCoupons.js\";import{useDayCategoryDefinitions}from\"https://framerusercontent.com/modules/pKMQTtBDnyThccjiINTr/R6FlauGV8dPyEKPorKpi/useDayCategoryDefinitions.js\";function getKSTDate(baseDate=new Date){const utc=baseDate.getTime()+baseDate.getTimezoneOffset()*6e4;return new Date(utc+9*60*60*1e3);}function getKSTISOString(date=new Date){const kstDate=getKSTDate(date);const pad=n=>String(n).padStart(2,\"0\");const year=kstDate.getFullYear();const month=pad(kstDate.getMonth()+1);const day=pad(kstDate.getDate());const hours=pad(kstDate.getHours());const minutes=pad(kstDate.getMinutes());const seconds=pad(kstDate.getSeconds());return`${year}-${month}-${day}T${hours}:${minutes}:${seconds}+09:00`;}export const useFormStore=createStore({name:null,birthdate:null,phone:null,email:null,emailDomain:null,nationality:\"domestic\",reserver_number:null,reserver_name:null,reserver_birthdate:null,reserver_phone:null,reserver_email:null,reserver_email_domain:null,isSameReserverStay:false,stay_name:null,stay_birthdate:null,stay_phone:null,couponCode:null,mileage:0,special_requests:null,anniversary_type:\"기념일 종류\",anniversary_name:null,anniversary_value:null,facility_policy:false,cancellation_policy:false,privacy_policy:false,marketing_consent:false,refund_name:null,refund_phone:null,refund_bank:null,refund_account:null});export function toggleName(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({name:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleBirthdate(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({birthdate:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function togglePhone(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({phone:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleEmail(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({email:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleNationality(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.nationality===\"domestic\"||mainStore.nationality===\"foreign\";// const shouldAutofill = false\nReact.useEffect(()=>{if(shouldAutofill&&formStore.nationality!==mainStore.nationality){setFormStore({nationality:mainStore.nationality});}},[shouldAutofill,mainStore.nationality]);const handleChange=value=>{setFormStore({nationality:value});};return /*#__PURE__*/_jsx(Component,{...props,disabled:shouldAutofill,selectedValue:shouldAutofill?mainStore.nationality:props.selectedValue,onChange:shouldAutofill?undefined:handleChange,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverNumber(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_number!==mainStore.membership_number){setFormStore({reserver_name:mainStore.membership_number});}},[shouldAutofill,mainStore.name]);const handleChange=event=>{setFormStore({reserver_number:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.membership_number:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverName(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_name!==mainStore.name){setFormStore({reserver_name:mainStore.name});}},[shouldAutofill,mainStore.name]);const handleChange=event=>{setFormStore({reserver_name:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.name:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverBirthdate(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_birthdate!==mainStore.birthdate){setFormStore({reserver_birthdate:mainStore.birthdate});}},[shouldAutofill,mainStore.birthdate]);const handleChange=event=>{setFormStore({reserver_birthdate:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.birthdate:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverPhone(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_phone!==mainStore.phone){setFormStore({reserver_phone:mainStore.phone});}},[shouldAutofill,mainStore.phone]);const handleChange=event=>{setFormStore({reserver_phone:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.phone:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverEmail(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_email!==mainStore.email){setFormStore({reserver_email:mainStore.email});}},[shouldAutofill,mainStore.email]);const handleChange=event=>{setFormStore({reserver_email:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.email:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function handleEmailDomainDropdown(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const selectedValue=event.target.value;if(selectedValue&&selectedValue!==\"직접 입력\"){setStore({reserver_email_domain:selectedValue});}};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleReserverNameNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_name!==mainStore.name){setFormStore({reserver_name:mainStore.name});}},[shouldAutofill,mainStore.name]);const handleChange=event=>{setFormStore({reserver_name:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.name:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverBirthdateNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_birthdate!==mainStore.birthdate){setFormStore({reserver_birthdate:mainStore.birthdate});}},[shouldAutofill,mainStore.birthdate]);const handleChange=event=>{setFormStore({reserver_birthdate:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.birthdate:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverPhoneNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_phone!==mainStore.phone){setFormStore({reserver_phone:mainStore.phone});}},[shouldAutofill,mainStore.phone]);const handleChange=event=>{setFormStore({reserver_phone:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.phone:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverEmailNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_email!==mainStore.email){setFormStore({reserver_email:mainStore.email});}},[shouldAutofill,mainStore.email]);const handleChange=event=>{setFormStore({reserver_email:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.email:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleSameReserverStay(Component){return props=>{const[store,setStore]=useFormStore();const toggle=()=>{setStore({isSameReserverStay:!store.isSameReserverStay});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function toggleStayName(Component){return props=>{const[store]=useStore();const[formStore,setFormStore]=useFormStore();const shouldAutofill=formStore.isSameReserverStay||store.membership==\"All-Free\";const autofillValue=formStore.reserver_name??\"\";React.useEffect(()=>{if(shouldAutofill&&formStore.stay_name!==autofillValue){setFormStore({stay_name:autofillValue});}},[shouldAutofill,autofillValue]);const handleChange=event=>{setFormStore({stay_name:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?autofillValue:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleStayBirthdate(Component){return props=>{const[store]=useStore();const[formStore,setFormStore]=useFormStore();const shouldAutofill=formStore.isSameReserverStay||store.membership==\"All-Free\";const autofillValue=formStore.reserver_birthdate??\"\";React.useEffect(()=>{if(shouldAutofill&&formStore.stay_birthdate!==autofillValue){setFormStore({stay_birthdate:autofillValue});}},[shouldAutofill,autofillValue]);const handleChange=event=>{setFormStore({stay_birthdate:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?autofillValue:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleStayPhone(Component){return props=>{const[store]=useStore();const[formStore,setFormStore]=useFormStore();const shouldAutofill=formStore.isSameReserverStay||store.membership==\"All-Free\";const autofillValue=formStore.reserver_phone??\"\";React.useEffect(()=>{if(shouldAutofill&&formStore.stay_phone!==autofillValue){setFormStore({stay_phone:autofillValue});}},[shouldAutofill,autofillValue]);const handleChange=event=>{setFormStore({stay_phone:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?autofillValue:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleCouponCode(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({couponCode:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function applyCouponCode(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[store,setStore]=useStore();const handleClick=async()=>{const code=formStore.couponCode?.trim();if(!code){alert(\"쿠폰 번호를 입력해주세요.\");return;}// if (store.expiredCoupons.includes(code)) {\n//     alert(\"한번 사용한 쿠폰은 재사용할 수 없습니다.\")\n//     return\n// }\nif(store.enteredCouponCode.includes(code)){alert(\"이미 적용된 쿠폰입니다.\");return;}try{// 쿠폰 데이터 가져오기\nconst[defRes,instRes]=await Promise.all([fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-definitions\"),fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-instances\")]);const definitions=await defRes.json();const instances=await instRes.json();// code 타입 정의만 필터링\nconst codeDefs=definitions.filter(def=>def.type===\"code\");// 인스턴스 + 정의 병합\nconst mergedCoupons=instances.filter(inst=>inst.coupon_code===code).map(inst=>{const def=codeDefs.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return def?{...def,...inst}:null;}).filter(Boolean);if(mergedCoupons.length===0){alert(\"쿠폰이 존재하지 않거나 쿠폰번호가 잘못되었습니다.\");return;}const[found]=mergedCoupons;// 상태 체크\nif(found.status!==\"available\"){alert(\"이 쿠폰은 현재 사용이 불가능합니다.\");return;}// 유효기간 체크\nif(found.coupon_due){const now=new Date;const due=new Date(found.coupon_due);if(isNaN(due.getTime())||now>due){alert(\"이 쿠폰의 유효기간이 지났습니다.\");return;}}// 적용 확인\nconst isConfirmed=window.confirm(`쿠폰 ${code}을 적용합니다.`);if(isConfirmed){setStore({enteredCouponCode:[...store.enteredCouponCode,code]});}}catch(error){console.error(\"쿠폰 확인 중 오류 발생:\",error);alert(\"쿠폰 확인 중 오류가 발생했습니다. 다시 시도해주세요.\");}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}// -----------------------------------------\nexport function checkRevisitAndCouponCode(Component){return props=>{const[formStore]=useFormStore();const[store,setStore]=useStore();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const handleClick=async()=>{const code=formStore.couponCode?.trim();if(!code){alert(\"쿠폰 번호를 입력해주세요.\");return;}try{// revisit 계산 (체크아웃 기준)\nconst ordersRes=await fetch(\"https://terene-db-server.onrender.com/api/v2/orders\");const orders=await ordersRes.json();const normalize=str=>str?.replace(/[\\s\\-./]/g,\"\").toLowerCase().trim();const revisitCount=orders.filter(order=>{return order.stay_status===\"checked_out\"&&normalize(order.reserver_name)===normalize(formStore.reserver_name)&&normalize(order.reserver_birthdate)===normalize(formStore.reserver_birthdate)&&normalize(order.reserver_contact)===normalize(formStore.reserver_phone);}).length;setStore({revisit:String(revisitCount)});if(store.enteredCouponCode?.includes(code)){alert(\"이미 적용된 쿠폰입니다.\");return;}// 쿠폰 정의/인스턴스 가져오기\nconst[defRes,instRes]=await Promise.all([fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-definitions\"),fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-instances\")]);const definitions=await defRes.json();const instances=await instRes.json();const codeDefs=definitions.filter(def=>def.type===\"code\");const mergedCoupons=instances.filter(inst=>inst.coupon_code===code).map(inst=>{const def=codeDefs.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return def?{...def,...inst}:null;}).filter(Boolean);if(mergedCoupons.length===0){alert(\"쿠폰이 존재하지 않거나 쿠폰번호가 잘못되었습니다.\");return;}const[found]=mergedCoupons;// 🔁 중복 제한(요구사항 반영): exclusive ↔ 모든 code형 쿠폰 상호배타\nconst appliedCodeCoupons=(store.enteredCouponCode??[]).map(appliedCode=>{const inst=instances.find(i=>i.coupon_code===appliedCode);if(!inst)return null;const def=definitions.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return def?{...def,...inst}:null;}).filter(c=>c&&c.type===\"code\");const hasAppliedExclusiveCode=appliedCodeCoupons.some(c=>c.exclusive===true);if(found.exclusive){// 이미 어떤 code형 쿠폰이라도 적용돼 있으면 exclusive는 불가\nif(appliedCodeCoupons.length>0){const conflict=appliedCodeCoupons[0];alert(`해당 쿠폰은 단독형 쿠폰으로, 기존 쿠폰(${conflict.description})과 함께 사용할 수 없습니다.`);return;}}else{// exclusive가 한 번이라도 적용돼 있으면 모든 code형 쿠폰 추가 불가\nif(hasAppliedExclusiveCode){const conflict=appliedCodeCoupons.find(c=>c.exclusive===true);alert(`이미 단독형 쿠폰(${conflict.description})이 적용되어 있어 다른 쿠폰을 사용할 수 없습니다.`);return;}}// 수취인/멤버십 일치 검증\nconst n=v=>String(v??\"\").replace(/[\\s\\-./]/g,\"\").toLowerCase().trim();const mismatch=(a,b)=>n(a)!==n(b);const hasMembership=found.membership_number!=null&&n(found.membership_number)!==\"\";const membershipMismatch=mismatch(found.membership_number,store.membership_number);const infoMismatch=mismatch(found.receiver_info?.name,formStore.reserver_name)||mismatch(found.receiver_info?.birthdate,formStore.reserver_birthdate)||mismatch(found.receiver_info?.contact,formStore.reserver_phone);const isEmptyCoupon=!found.receiver_info?.name&&!found.receiver_info?.birthdate&&!found.receiver_info?.contact&&!hasMembership;const shouldAlert=hasMembership?membershipMismatch:infoMismatch;if(!isEmptyCoupon&&shouldAlert){alert(\"쿠폰이 존재하지 않거나 쿠폰번호가 잘못되었습니다.\");return;}if(found.status!==\"available\"){alert(\"이 쿠폰은 현재 사용이 불가능합니다.\");return;}if(found.coupon_due){const now=new Date;const due=new Date(found.coupon_due);if(isNaN(due.getTime())||now>due){alert(\"이 쿠폰의 유효기간이 지났습니다.\");return;}}// ----------------------------\n// 날짜 준비/검증\n// ----------------------------\nconst queryParams=new URLSearchParams(window.location.search);const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDateFromQuery=first?parseDate(first):null;const secondDateFromQuery=second?parseDate(second):null;const firstDateObj=store.firstDate??firstDateFromQuery;const secondDateObj=store.secondDate??secondDateFromQuery;if(!firstDateObj||!secondDateObj){alert(\"체크인/체크아웃 날짜를 먼저 선택한 뒤 쿠폰을 적용해주세요.\");return;}// ----------------------------\n// 카테고리 맵 로드\n// ----------------------------\nlet categoryMap={};try{const holidayRes=await fetch(\"https://terene-db-server.onrender.com/api/v3/days\");const days=await holidayRes.json();const rawMap={};for(const item of days){rawMap[item.date]=item.category;}categoryMap=toCategoryMap(rawMap);}catch(err){console.error(\"❌ Category map load failed:\",err);categoryMap={};}console.log(\"firstDateObj\",firstDateObj);console.log(\"secondDateObj\",secondDateObj);// ----------------------------\n// 일자별 가격 계산 (명시적 날짜 전달)\n// ----------------------------\nconst{dailyItems}=calculateInitialPrices({...store},categoryMap,categoryDefs,firstDateObj,secondDateObj);// 글로벌 + 현재 코드만 구성\nconst globalDefs=definitions.filter(def=>def.type===\"global\");const couponsForCheck=[...globalDefs,found];// 가상 store: enteredCouponCode에 현재 코드 포함\nconst simulatedStore={...store,enteredCouponCode:[...store.enteredCouponCode??[],code]};// 필터 통과 여부\nconst{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(couponsForCheck,simulatedStore,dailyItems);// const codes = couponsForCheck\n//     .filter((c) => c.coupon_code && c.coupon_code[0] == \"H\") // coupon_code 필드가 존재하는 쿠폰만\n//     .map((c) => c.coupon_code as string) // 문자열로 추출\n// alert(\n//     `B-1) check: ${JSON.stringify(codes)}\\npassedSecondary: ${JSON.stringify(passedSecondaryCoupons)}`\n// )\nconst targetId=found.coupon_instance_id||found.coupon_definition_id;const included=passedSecondaryCoupons.some(c=>(c.coupon_instance_id||c.coupon_definition_id)===targetId);if(!included){// 🔸 필터에서 제외된 경우\nalert(`사용할 수 없는 쿠폰 조건입니다.`);return;}// 실제 할인액 계산\nconst{secondaryDetails}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,simulatedStore);const detail=secondaryDetails.find(d=>d.id===targetId);const appliedAmount=detail?.amount??0;if(!detail||appliedAmount<=0){// 🔸 필터는 통과했지만, 적용 가능한 결제 금액(잔액/상한)을 초과해 0원 처리된 경우\nalert(\"결제 할인 금액을 초과하여 쿠폰을 사용할 수 없습니다.\");return;}// 최종 적용\nconst isConfirmed=window.confirm(`쿠폰 ${code}을 적용합니다.`);if(isConfirmed){setStore({enteredCouponCode:[...store.enteredCouponCode??[],code]});}}catch(error){console.error(\"쿠폰 확인 중 오류 발생:\",error);alert(\"쿠폰 확인 중 오류가 발생했습니다. 다시 시도해주세요.\");}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}export async function fetchTotalMileage(membershipNumber){try{const res=await fetch(\"https://terene-db-server.onrender.com/api/v2/mileages\");if(!res.ok)throw new Error(\"Failed to fetch mileage data\");const data=await res.json();const userMileage=data.filter(m=>m.membership_number===membershipNumber);const totalAmount=userMileage.reduce((sum,entry)=>sum+Number(entry.mileage_amount||0),0);return totalAmount;}catch(error){console.error(\"마일리지 조회 실패:\",error);return 0;}}export function toggleMileage(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({mileage:Number(inputValue)});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleSpecialRequests(Component){return props=>{const[,setStore]=useFormStore();const sync=v=>setStore({special_requests:String(v??\"\")});const handleChange=e=>{sync(e?.target?.value);};const handlePasteCapture=e=>{const text=e?.clipboardData?.getData?.(\"text/plain\")??e?.clipboardData?.getData?.(\"text\")??\"\";if(text){e.preventDefault();e.stopPropagation();sync(text);}};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange,onPasteCapture:handlePasteCapture});};}export function handleAnniversaryDropdown(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const selectedValue=event.target.value;if(selectedValue!==\"기념일 종류\"){setStore({anniversary_type:selectedValue});}};return /*#__PURE__*/_jsx(Component,{...props,value:store.anniversary_type,onChange:handleChange});};}export function toggleAnniversaryName(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({anniversary_name:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleAnniversaryValue(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({anniversary_value:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}// ----- 토스 결제 / Paypal 결제 분기점 -----\nexport function toggleTossPayment(Component){return props=>{const[store,setStore]=useStore();const[formStore,setformStore]=useFormStore();const[payment,setPayment]=useState(formStore.payment);const toggle=()=>{setStore({payment:\"toss\"});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function togglePaypalPayment(Component){return props=>{const[store,setStore]=useStore();const[formStore,setformStore]=useFormStore();const[payment,setPayment]=useState(formStore.payment);const toggle=()=>{setStore({payment:\"paypal\"});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function toggleForeignCardPayment(Component){return props=>{const[store,setStore]=useStore();const[formStore,setformStore]=useFormStore();const[payment,setPayment]=useState(formStore.payment);const toggle=()=>{setStore({payment:\"foreignCard\"});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function toggleRefundName(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({refund_name:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleRefundPhone(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({refund_phone:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function handleRefundBank(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const selectedValue=event.target.value;if(selectedValue!==\"은행명\"){setStore({refund_bank:selectedValue});}};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleRefundAccount(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({refund_account:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function getAvailableMileage(Component){return props=>{const[store]=useStore();return /*#__PURE__*/_jsx(Component,{...props,text:`사용 가능 ${(store.totalMileage-store.usedMileage).toLocaleString()}p`});};}export function getTotalMileage(Component){return props=>{const[store,setStore]=useStore();React.useEffect(()=>{const fetchMileages=async()=>{if(!store.membership_number)return;try{const res=await fetch(\"https://terene-db-server.onrender.com/api/v2/mileages\");if(!res.ok)throw new Error(\"마일리지 조회 실패\");const data=await res.json();const sum=data.filter(m=>m.membership_number===store.membership_number).reduce((acc,m)=>acc+Number(m.mileage_amount||0),0);setStore({totalMileage:sum});}catch(e){console.error(\"마일리지 불러오기 실패:\",e);setStore({totalMileage:0});}};fetchMileages();},[store.membership_number]);return /*#__PURE__*/_jsx(Component,{...props,text:`보유 ${store.totalMileage.toLocaleString()}p`});};}export function applyMileage(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[store,setStore]=useStore();const handleClick=async()=>{if(!formStore.mileage){alert(`마일리지를 입력해주세요.`);return;}if(!Number.isInteger(formStore.mileage)||formStore.mileage<=0){alert(\"마일리지는 1 이상의 자연수로만 입력해주세요.\");return;}// if (!store.membership_number) {\n//     alert(\"멤버십 로그인이 필요합니다.\")\n//     return\n// }\n// const totalMileage = await fetchTotalMileage(\n//     store.membership_number\n// )\nconst availableMileage=store.totalMileage-store.usedMileage;if(formStore.mileage>availableMileage||availableMileage<=0){alert(`마일리지 수 부족: ${availableMileage.toLocaleString()}p`);return;}if(formStore.mileage>store.integratedPrice){alert(`최대 적용 가능한 마일리지 수를 초과하였습니다.\n현재 최대 적용 가능한 마일리지 수: ${store.integratedPrice.toLocaleString()}p`);return;}if(store.usedMileage==0){const isConfirmed=window.confirm(`마일리지 ${formStore.mileage.toLocaleString()}p를 적용합니다.`);if(isConfirmed){setStore({usedMileage:(store.usedMileage||0)+formStore.mileage});}}else{const isConfirmed=window.confirm(`마일리지 ${formStore.mileage.toLocaleString()}p를 추가로 적용합니다.`);if(isConfirmed){setStore({usedMileage:(store.usedMileage||0)+formStore.mileage});}}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}export function hidePaypalInfo(Component){return props=>{const[store,setStore]=useStore();if(store.payment!==\"paypal\")return null;return /*#__PURE__*/_jsx(Component,{...props});};}\nexport const __FramerMetadata__ = {\"exports\":{\"checkRevisitAndCouponCode\":{\"type\":\"reactHoc\",\"name\":\"checkRevisitAndCouponCode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useFormStore\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleRefundPhone\":{\"type\":\"reactHoc\",\"name\":\"toggleRefundPhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"applyMileage\":{\"type\":\"reactHoc\",\"name\":\"applyMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleSpecialRequests\":{\"type\":\"reactHoc\",\"name\":\"toggleSpecialRequests\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleAnniversaryValue\":{\"type\":\"reactHoc\",\"name\":\"toggleAnniversaryValue\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleRefundAccount\":{\"type\":\"reactHoc\",\"name\":\"toggleRefundAccount\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleNationality\":{\"type\":\"reactHoc\",\"name\":\"toggleNationality\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"hidePaypalInfo\":{\"type\":\"reactHoc\",\"name\":\"hidePaypalInfo\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getAvailableMileage\":{\"type\":\"reactHoc\",\"name\":\"getAvailableMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"handleEmailDomainDropdown\":{\"type\":\"reactHoc\",\"name\":\"handleEmailDomainDropdown\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleTossPayment\":{\"type\":\"reactHoc\",\"name\":\"toggleTossPayment\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleForeignCardPayment\":{\"type\":\"reactHoc\",\"name\":\"toggleForeignCardPayment\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleCouponCode\":{\"type\":\"reactHoc\",\"name\":\"toggleCouponCode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverName\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverBirthdateNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverBirthdateNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverPhone\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverPhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleStayBirthdate\":{\"type\":\"reactHoc\",\"name\":\"toggleStayBirthdate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleStayName\":{\"type\":\"reactHoc\",\"name\":\"toggleStayName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleSameReserverStay\":{\"type\":\"reactHoc\",\"name\":\"toggleSameReserverStay\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"togglePaypalPayment\":{\"type\":\"reactHoc\",\"name\":\"togglePaypalPayment\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleName\":{\"type\":\"reactHoc\",\"name\":\"toggleName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverNameNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverNameNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleMileage\":{\"type\":\"reactHoc\",\"name\":\"toggleMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverEmailNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverEmailNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"applyCouponCode\":{\"type\":\"reactHoc\",\"name\":\"applyCouponCode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"handleRefundBank\":{\"type\":\"reactHoc\",\"name\":\"handleRefundBank\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverPhoneNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverPhoneNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleRefundName\":{\"type\":\"reactHoc\",\"name\":\"toggleRefundName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleStayPhone\":{\"type\":\"reactHoc\",\"name\":\"toggleStayPhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getTotalMileage\":{\"type\":\"reactHoc\",\"name\":\"getTotalMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleAnniversaryName\":{\"type\":\"reactHoc\",\"name\":\"toggleAnniversaryName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverEmail\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverEmail\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"togglePhone\":{\"type\":\"reactHoc\",\"name\":\"togglePhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverNumber\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverNumber\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"fetchTotalMileage\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleEmail\":{\"type\":\"reactHoc\",\"name\":\"toggleEmail\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverBirthdate\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverBirthdate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleBirthdate\":{\"type\":\"reactHoc\",\"name\":\"toggleBirthdate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"handleAnniversaryDropdown\":{\"type\":\"reactHoc\",\"name\":\"handleAnniversaryDropdown\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ReservationForm.map","// PriceDisplay.tsx\nimport{jsx as _jsx}from\"react/jsx-runtime\";import React,{useEffect,useMemo}from\"react\";import{useStore}from\"https://framerusercontent.com/modules/c2GloFFeVhaMQsbMcdTk/XiJZ0vjlltE7FPQAQ8Lk/MainStore.js\";import{useFormStore}from\"https://framerusercontent.com/modules/j1JmQpFlkCqsnz6Zbn4l/BYasgVKKRdsmyswKAly1/ReservationForm.js\";import{calculateInitialPrices,filterCoupons,evaluateCoupons}from\"https://framerusercontent.com/modules/jTRIrvvdhM8hGc8tF4E7/Q2QLVylG6dtj4TyzXmqg/EvaluateCoupons.js\";import{useAdditionalServiceStore,createAdditionalServiceList}from\"https://framerusercontent.com/modules/k847LPNIMdkhfIs0ouwF/EUEOlsedw6DGLY16dhfq/AdditionalService.js\";import{parseDate}from\"https://framerusercontent.com/modules/1J9pgwrYtYGWgtmRStO4/muZZYJxbZe3foLJMfVTS/DateUtils.js\";import{motion}from\"framer-motion\";import{useDayCategoryDefinitions}from\"https://framerusercontent.com/modules/pKMQTtBDnyThccjiINTr/R6FlauGV8dPyEKPorKpi/useDayCategoryDefinitions.js\";const FadeIn=({children})=>/*#__PURE__*/_jsx(motion.div,{initial:{opacity:0,y:0},animate:{opacity:1,y:0},exit:{opacity:0,y:0},transition:{duration:.4,ease:\"easeOut\"},children:children});// 공휴일 카테고리 가져오기 (v3 구조 대응)\nexport function useHolidayCategoryMap(){const[categories,setCategories]=React.useState({});const[isLoading,setIsLoading]=React.useState(true);React.useEffect(()=>{fetch(\"https://terene-db-server.onrender.com/api/v3/days\").then(res=>res.json()).then(data=>{const map={};for(const item of data){// ✅ days_250928 구조 반영\n// item = { date, category, is_holiday, location, checkin_occupied, ... }\nmap[item.date]=item.category;}setCategories(map);}).catch(err=>console.error(\"Holiday fetch error\",err)).finally(()=>setIsLoading(false));},[]);return{categories,isLoading};}// ✅ 문자열 → 카테고리 매핑\nexport function toCategoryMap(input){return input;}export function useCoupons(){const[coupons,setCoupons]=React.useState([]);const[isLoading,setIsLoading]=React.useState(true);React.useEffect(()=>{async function fetchCoupons(){try{// Fetch definitions first\nconst defRes=await fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-definitions\");const definitions=await defRes.json();// Separate global and code types (ignore membership)\nconst globalDefs=definitions.filter(def=>def.type===\"global\");const codeDefs=definitions.filter(def=>def.type===\"code\");// Fetch instances only if there are code definitions\nlet codeInstances=[];if(codeDefs.length>0){const instRes=await fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-instances\");const instances=await instRes.json();codeInstances=instances.filter(inst=>codeDefs.some(def=>def.coupon_definition_id===inst.coupon_definition_id));}// Merge code definitions and their instances\nconst codeCoupons=codeInstances.map(inst=>{const def=codeDefs.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return{...def,...inst};});// Combine global and code coupons\nconst combined=[...globalDefs,...codeCoupons];// Sort by optional priority if present\nconst sorted=combined.sort((a,b)=>(a.priority||0)-(b.priority||0));setCoupons(sorted);}catch(err){console.error(\"Coupon fetch error:\",err);}finally{setIsLoading(false);}}fetchCoupons();},[]);return{coupons,isLoading};}function useDiscountCalculation(){const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isReady=store.firstDate&&store.secondDate||firstDate&&secondDate;const result=useMemo(()=>{if(!isReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice,dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);return{initialPrice,discountedPrice};},[store,categories,coupons,firstDate,secondDate,categoryLoading,couponLoading]);return{isLoading:!isReady||categoryLoading||couponLoading,data:result};}export function displayInitialPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();// console.log(\"### COUPONS ###\")\n// console.log(JSON.stringify(coupons))\nconst{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const text=store.payment===\"paypal\"?`KRW ${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")} 원`;return(// <FadeIn>\n/*#__PURE__*/_jsx(Component,{...props,text:text}));};}export function displayDiscountedPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const text=store.payment===\"paypal\"?`KRW ${Math.max(discountedPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(discountedPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}function transitionStyle(visible){return{opacity:visible?1:0,color:\"inherit\",transition:\"opacity 0.3s ease-in-out\",display:\"inline-block\"};}export function displayDiscountBar(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice,dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const show=initialPrice!==Math.max(discountedPrice,0);const baseStyle=transitionStyle(show);const width=initialPrice>=1e8?144:initialPrice>=1e7?128:112;const barStyle={...baseStyle,width,position:\"relative\",right:0,transform:`translateX(${92-width}px)`};// <Component {...props} style={barStyle} />\nreturn /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,style:baseStyle})});};}export function displaySoftInitialPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const text=store.payment===\"paypal\"?`KRW ${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function getAdditionalPrice(){const[store]=useStore();const[additionalServiceStore]=useAdditionalServiceStore();const additionalServiceList=createAdditionalServiceList(additionalServiceStore,store);const totalAmount=additionalServiceList.reduce((sum,service)=>{return sum+service.amount;},0);return totalAmount;}export function displayIntegratedPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=store.membership===\"All-Free\"?0:Math.max(discountedPrice,0)+additionalPrice;const text=store.payment===\"paypal\"?`KRW ${Math.max(integratedPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(integratedPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayExchangeMarginPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=Math.max(discountedPrice,0)+additionalPrice;const exchangeMarginPrice=store.membership===\"All-Free\"||store.payment!==\"paypal\"?0:Math.round(integratedPrice*.05)// 기존 가격의 5%만큼 환전 수수료 적용\n;const text=store.payment===\"paypal\"?`KRW ${Math.max(exchangeMarginPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(exchangeMarginPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayVatPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=Math.max(discountedPrice,0)+additionalPrice;const vatPrice=store.membership===\"All-Free\"?0:Math.round(integratedPrice*.1);const text=store.payment===\"paypal\"?`KRW ${Math.max(vatPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(vatPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayDepositPrice(Component){const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;return props=>{const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const depositPrice=store.membership===\"Non-Member\"?3e5:0;const text=store.payment===\"paypal\"?`KRW ${Math.max(depositPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(depositPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayFinalPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store,setStore]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;const priceData=useMemo(()=>{if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const initialPrice=dailyItems.reduce((sum,item)=>sum+item.price,0);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice,primaryDetails,secondaryDetails}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=store.membership===\"All-Free\"?0:Math.max(discountedPrice,0)+additionalPrice;const exchangeMarginPrice=store.payment===\"paypal\"?Math.round(integratedPrice*.05)// 기존 가격의 5%만큼 환전 수수료 적용\n:0;const vatPrice=Math.round(integratedPrice*.1);const depositPrice=store.membership===\"Non-Member\"?3e5:0;const finalPrice=store.membership===\"All-Free\"?0:integratedPrice+exchangeMarginPrice+vatPrice+depositPrice;const text=store.payment===\"paypal\"?`KRW ${Math.max(finalPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(finalPrice,0).toLocaleString(\"ko-KR\")} 원`;return{initialPrice,discountedPrice,additionalPrice,integratedPrice,exchangeMarginPrice,vatPrice,depositPrice,finalPrice,text,primaryDetails,secondaryDetails};},[isStoreReady,categoryLoading,couponLoading,store,categories,coupons,additionalPrice]);useEffect(()=>{if(!priceData)return;setStore(prev=>{const isSame=prev.finalPrice===priceData.finalPrice&&prev.initialPrice===priceData.initialPrice&&prev.discountedPrice===priceData.discountedPrice&&prev.additionalPrice===priceData.additionalPrice&&prev.integratedPrice===priceData.integratedPrice&&prev.exchangeMarginPrice===priceData.exchangeMarginPrice&&prev.vatPrice===priceData.vatPrice&&prev.depositPrice===priceData.depositPrice;if(isSame)return prev;return{...prev,initialPrice:priceData.initialPrice,discountedPrice:priceData.discountedPrice,additionalPrice:priceData.additionalPrice,integratedPrice:priceData.integratedPrice,exchangeMarginPrice:priceData.exchangeMarginPrice,vatPrice:priceData.vatPrice,depositPrice:priceData.depositPrice,finalPrice:priceData.finalPrice,couponPrimaryDetails:priceData.primaryDetails,couponSecondaryDetails:priceData.secondaryDetails};});},[priceData?.initialPrice,priceData?.discountedPrice,priceData?.additionalPrice,priceData?.integratedPrice,priceData?.exchangeMarginPrice,priceData?.vatPrice,priceData?.depositPrice,priceData?.finalPrice]);if(!priceData)return null;// console.log(priceData?.finalPrice)\nreturn /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:priceData.text})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"useCoupons\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayInitialPrice\":{\"type\":\"reactHoc\",\"name\":\"displayInitialPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayDiscountedPrice\":{\"type\":\"reactHoc\",\"name\":\"displayDiscountedPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useHolidayCategoryMap\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displaySoftInitialPrice\":{\"type\":\"reactHoc\",\"name\":\"displaySoftInitialPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayIntegratedPrice\":{\"type\":\"reactHoc\",\"name\":\"displayIntegratedPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayVatPrice\":{\"type\":\"reactHoc\",\"name\":\"displayVatPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayFinalPrice\":{\"type\":\"reactHoc\",\"name\":\"displayFinalPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayExchangeMarginPrice\":{\"type\":\"reactHoc\",\"name\":\"displayExchangeMarginPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toCategoryMap\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayDepositPrice\":{\"type\":\"reactHoc\",\"name\":\"displayDepositPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getAdditionalPrice\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayDiscountBar\":{\"type\":\"reactHoc\",\"name\":\"displayDiscountBar\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","import{jsx as _jsx}from\"react/jsx-runtime\";import{useState}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import*as React from\"react\";import{useStore}from\"https://framerusercontent.com/modules/c2GloFFeVhaMQsbMcdTk/XiJZ0vjlltE7FPQAQ8Lk/MainStore.js\";import{parseDate}from\"https://framerusercontent.com/modules/1J9pgwrYtYGWgtmRStO4/muZZYJxbZe3foLJMfVTS/DateUtils.js\";import{toCategoryMap}from\"https://framerusercontent.com/modules/t32tReeHmrCTzbf5rVbb/R6m5PfQA9MX51zW1YOpv/PriceDisplay.js\";// ✅ 추가: 계산/필터 함수 import (PriceDisplay와 동일 파이프라인 사용)\nimport{calculateInitialPrices,filterCoupons,evaluateCoupons}from\"https://framerusercontent.com/modules/jTRIrvvdhM8hGc8tF4E7/Q2QLVylG6dtj4TyzXmqg/EvaluateCoupons.js\";import{useDayCategoryDefinitions}from\"https://framerusercontent.com/modules/pKMQTtBDnyThccjiINTr/R6FlauGV8dPyEKPorKpi/useDayCategoryDefinitions.js\";function getKSTDate(baseDate=new Date){const utc=baseDate.getTime()+baseDate.getTimezoneOffset()*6e4;return new Date(utc+9*60*60*1e3);}function getKSTISOString(date=new Date){const kstDate=getKSTDate(date);const pad=n=>String(n).padStart(2,\"0\");const year=kstDate.getFullYear();const month=pad(kstDate.getMonth()+1);const day=pad(kstDate.getDate());const hours=pad(kstDate.getHours());const minutes=pad(kstDate.getMinutes());const seconds=pad(kstDate.getSeconds());return`${year}-${month}-${day}T${hours}:${minutes}:${seconds}+09:00`;}export const useFormStore=createStore({name:null,birthdate:null,phone:null,email:null,emailDomain:null,nationality:\"domestic\",reserver_number:null,reserver_name:null,reserver_birthdate:null,reserver_phone:null,reserver_email:null,reserver_email_domain:null,isSameReserverStay:false,stay_name:null,stay_birthdate:null,stay_phone:null,couponCode:null,mileage:0,special_requests:null,anniversary_type:\"기념일 종류\",anniversary_name:null,anniversary_value:null,facility_policy:false,cancellation_policy:false,privacy_policy:false,marketing_consent:false,refund_name:null,refund_phone:null,refund_bank:null,refund_account:null});export function toggleName(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({name:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleBirthdate(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({birthdate:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function togglePhone(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({phone:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleEmail(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({email:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleNationality(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.nationality===\"domestic\"||mainStore.nationality===\"foreign\";// const shouldAutofill = false\nReact.useEffect(()=>{if(shouldAutofill&&formStore.nationality!==mainStore.nationality){setFormStore({nationality:mainStore.nationality});}},[shouldAutofill,mainStore.nationality]);const handleChange=value=>{setFormStore({nationality:value});};return /*#__PURE__*/_jsx(Component,{...props,disabled:shouldAutofill,selectedValue:shouldAutofill?mainStore.nationality:props.selectedValue,onChange:shouldAutofill?undefined:handleChange,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverNumber(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_number!==mainStore.membership_number){setFormStore({reserver_name:mainStore.membership_number});}},[shouldAutofill,mainStore.name]);const handleChange=event=>{setFormStore({reserver_number:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.membership_number:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverName(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_name!==mainStore.name){setFormStore({reserver_name:mainStore.name});}},[shouldAutofill,mainStore.name]);const handleChange=event=>{setFormStore({reserver_name:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.name:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverBirthdate(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_birthdate!==mainStore.birthdate){setFormStore({reserver_birthdate:mainStore.birthdate});}},[shouldAutofill,mainStore.birthdate]);const handleChange=event=>{setFormStore({reserver_birthdate:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.birthdate:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverPhone(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_phone!==mainStore.phone){setFormStore({reserver_phone:mainStore.phone});}},[shouldAutofill,mainStore.phone]);const handleChange=event=>{setFormStore({reserver_phone:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.phone:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverEmail(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_email!==mainStore.email){setFormStore({reserver_email:mainStore.email});}},[shouldAutofill,mainStore.email]);const handleChange=event=>{setFormStore({reserver_email:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.email:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function handleEmailDomainDropdown(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const selectedValue=event.target.value;if(selectedValue&&selectedValue!==\"직접 입력\"){setStore({reserver_email_domain:selectedValue});}};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleReserverNameNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_name!==mainStore.name){setFormStore({reserver_name:mainStore.name});}},[shouldAutofill,mainStore.name]);const handleChange=event=>{setFormStore({reserver_name:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.name:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverBirthdateNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_birthdate!==mainStore.birthdate){setFormStore({reserver_birthdate:mainStore.birthdate});}},[shouldAutofill,mainStore.birthdate]);const handleChange=event=>{setFormStore({reserver_birthdate:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.birthdate:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverPhoneNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_phone!==mainStore.phone){setFormStore({reserver_phone:mainStore.phone});}},[shouldAutofill,mainStore.phone]);const handleChange=event=>{setFormStore({reserver_phone:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.phone:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverEmailNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_email!==mainStore.email){setFormStore({reserver_email:mainStore.email});}},[shouldAutofill,mainStore.email]);const handleChange=event=>{setFormStore({reserver_email:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.email:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleSameReserverStay(Component){return props=>{const[store,setStore]=useFormStore();const toggle=()=>{setStore({isSameReserverStay:!store.isSameReserverStay});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function toggleStayName(Component){return props=>{const[store]=useStore();const[formStore,setFormStore]=useFormStore();const shouldAutofill=formStore.isSameReserverStay||store.membership==\"All-Free\";const autofillValue=formStore.reserver_name??\"\";React.useEffect(()=>{if(shouldAutofill&&formStore.stay_name!==autofillValue){setFormStore({stay_name:autofillValue});}},[shouldAutofill,autofillValue]);const handleChange=event=>{setFormStore({stay_name:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?autofillValue:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleStayBirthdate(Component){return props=>{const[store]=useStore();const[formStore,setFormStore]=useFormStore();const shouldAutofill=formStore.isSameReserverStay||store.membership==\"All-Free\";const autofillValue=formStore.reserver_birthdate??\"\";React.useEffect(()=>{if(shouldAutofill&&formStore.stay_birthdate!==autofillValue){setFormStore({stay_birthdate:autofillValue});}},[shouldAutofill,autofillValue]);const handleChange=event=>{setFormStore({stay_birthdate:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?autofillValue:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleStayPhone(Component){return props=>{const[store]=useStore();const[formStore,setFormStore]=useFormStore();const shouldAutofill=formStore.isSameReserverStay||store.membership==\"All-Free\";const autofillValue=formStore.reserver_phone??\"\";React.useEffect(()=>{if(shouldAutofill&&formStore.stay_phone!==autofillValue){setFormStore({stay_phone:autofillValue});}},[shouldAutofill,autofillValue]);const handleChange=event=>{setFormStore({stay_phone:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?autofillValue:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleCouponCode(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({couponCode:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function applyCouponCode(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[store,setStore]=useStore();const handleClick=async()=>{const code=formStore.couponCode?.trim();if(!code){alert(\"쿠폰 번호를 입력해주세요.\");return;}// if (store.expiredCoupons.includes(code)) {\n//     alert(\"한번 사용한 쿠폰은 재사용할 수 없습니다.\")\n//     return\n// }\nif(store.enteredCouponCode.includes(code)){alert(\"이미 적용된 쿠폰입니다.\");return;}try{// 쿠폰 데이터 가져오기\nconst[defRes,instRes]=await Promise.all([fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-definitions\"),fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-instances\")]);const definitions=await defRes.json();const instances=await instRes.json();// code 타입 정의만 필터링\nconst codeDefs=definitions.filter(def=>def.type===\"code\");// 인스턴스 + 정의 병합\nconst mergedCoupons=instances.filter(inst=>inst.coupon_code===code).map(inst=>{const def=codeDefs.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return def?{...def,...inst}:null;}).filter(Boolean);if(mergedCoupons.length===0){alert(\"쿠폰이 존재하지 않거나 쿠폰번호가 잘못되었습니다.\");return;}const[found]=mergedCoupons;// 상태 체크\nif(found.status!==\"available\"){alert(\"이 쿠폰은 현재 사용이 불가능합니다.\");return;}// 유효기간 체크\nif(found.coupon_due){const now=new Date;const due=new Date(found.coupon_due);if(isNaN(due.getTime())||now>due){alert(\"이 쿠폰의 유효기간이 지났습니다.\");return;}}// 적용 확인\nconst isConfirmed=window.confirm(`쿠폰 ${code}을 적용합니다.`);if(isConfirmed){setStore({enteredCouponCode:[...store.enteredCouponCode,code]});}}catch(error){console.error(\"쿠폰 확인 중 오류 발생:\",error);alert(\"쿠폰 확인 중 오류가 발생했습니다. 다시 시도해주세요.\");}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}// -----------------------------------------\nexport function checkRevisitAndCouponCode(Component){return props=>{const[formStore]=useFormStore();const[store,setStore]=useStore();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const handleClick=async()=>{const code=formStore.couponCode?.trim();if(!code){alert(\"쿠폰 번호를 입력해주세요.\");return;}try{// revisit 계산 (체크아웃 기준)\nconst ordersRes=await fetch(\"https://terene-db-server.onrender.com/api/v2/orders\");const orders=await ordersRes.json();const normalize=str=>str?.replace(/[\\s\\-./]/g,\"\").toLowerCase().trim();const revisitCount=orders.filter(order=>{return order.stay_status===\"checked_out\"&&normalize(order.reserver_name)===normalize(formStore.reserver_name)&&normalize(order.reserver_birthdate)===normalize(formStore.reserver_birthdate)&&normalize(order.reserver_contact)===normalize(formStore.reserver_phone);}).length;setStore({revisit:String(revisitCount)});if(store.enteredCouponCode?.includes(code)){alert(\"이미 적용된 쿠폰입니다.\");return;}// 쿠폰 정의/인스턴스 가져오기\nconst[defRes,instRes]=await Promise.all([fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-definitions\"),fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-instances\")]);const definitions=await defRes.json();const instances=await instRes.json();const codeDefs=definitions.filter(def=>def.type===\"code\");const mergedCoupons=instances.filter(inst=>inst.coupon_code===code).map(inst=>{const def=codeDefs.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return def?{...def,...inst}:null;}).filter(Boolean);if(mergedCoupons.length===0){alert(\"쿠폰이 존재하지 않거나 쿠폰번호가 잘못되었습니다.\");return;}const[found]=mergedCoupons;// 🔁 중복 제한(요구사항 반영): exclusive ↔ 모든 code형 쿠폰 상호배타\nconst appliedCodeCoupons=(store.enteredCouponCode??[]).map(appliedCode=>{const inst=instances.find(i=>i.coupon_code===appliedCode);if(!inst)return null;const def=definitions.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return def?{...def,...inst}:null;}).filter(c=>c&&c.type===\"code\");const hasAppliedExclusiveCode=appliedCodeCoupons.some(c=>c.exclusive===true);if(found.exclusive){// 이미 어떤 code형 쿠폰이라도 적용돼 있으면 exclusive는 불가\nif(appliedCodeCoupons.length>0){const conflict=appliedCodeCoupons[0];alert(`해당 쿠폰은 단독형 쿠폰으로, 기존 쿠폰(${conflict.description})과 함께 사용할 수 없습니다.`);return;}}else{// exclusive가 한 번이라도 적용돼 있으면 모든 code형 쿠폰 추가 불가\nif(hasAppliedExclusiveCode){const conflict=appliedCodeCoupons.find(c=>c.exclusive===true);alert(`이미 단독형 쿠폰(${conflict.description})이 적용되어 있어 다른 쿠폰을 사용할 수 없습니다.`);return;}}// 수취인/멤버십 일치 검증\nconst n=v=>String(v??\"\").replace(/[\\s\\-./]/g,\"\").toLowerCase().trim();const mismatch=(a,b)=>n(a)!==n(b);const hasMembership=found.membership_number!=null&&n(found.membership_number)!==\"\";const membershipMismatch=mismatch(found.membership_number,store.membership_number);const infoMismatch=mismatch(found.receiver_info?.name,formStore.reserver_name)||mismatch(found.receiver_info?.birthdate,formStore.reserver_birthdate)||mismatch(found.receiver_info?.contact,formStore.reserver_phone);const isEmptyCoupon=!found.receiver_info?.name&&!found.receiver_info?.birthdate&&!found.receiver_info?.contact&&!hasMembership;const shouldAlert=hasMembership?membershipMismatch:infoMismatch;if(!isEmptyCoupon&&shouldAlert){alert(\"쿠폰이 존재하지 않거나 쿠폰번호가 잘못되었습니다.\");return;}if(found.status!==\"available\"){alert(\"이 쿠폰은 현재 사용이 불가능합니다.\");return;}if(found.coupon_due){const now=new Date;const due=new Date(found.coupon_due);if(isNaN(due.getTime())||now>due){alert(\"이 쿠폰의 유효기간이 지났습니다.\");return;}}// ----------------------------\n// 날짜 준비/검증\n// ----------------------------\nconst queryParams=new URLSearchParams(window.location.search);const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDateFromQuery=first?parseDate(first):null;const secondDateFromQuery=second?parseDate(second):null;const firstDateObj=store.firstDate??firstDateFromQuery;const secondDateObj=store.secondDate??secondDateFromQuery;if(!firstDateObj||!secondDateObj){alert(\"체크인/체크아웃 날짜를 먼저 선택한 뒤 쿠폰을 적용해주세요.\");return;}// ----------------------------\n// 카테고리 맵 로드\n// ----------------------------\nlet categoryMap={};try{const holidayRes=await fetch(\"https://terene-db-server.onrender.com/api/v3/days\");const days=await holidayRes.json();const rawMap={};for(const item of days){rawMap[item.date]=item.category;}categoryMap=toCategoryMap(rawMap);}catch(err){console.error(\"❌ Category map load failed:\",err);categoryMap={};}console.log(\"firstDateObj\",firstDateObj);console.log(\"secondDateObj\",secondDateObj);// ----------------------------\n// 일자별 가격 계산 (명시적 날짜 전달)\n// ----------------------------\nconst{dailyItems}=calculateInitialPrices({...store},categoryMap,categoryDefs,firstDateObj,secondDateObj);// 글로벌 + 현재 코드만 구성\nconst globalDefs=definitions.filter(def=>def.type===\"global\");const couponsForCheck=[...globalDefs,found];// 가상 store: enteredCouponCode에 현재 코드 포함\nconst simulatedStore={...store,enteredCouponCode:[...store.enteredCouponCode??[],code]};// 필터 통과 여부\nconst{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(couponsForCheck,simulatedStore,dailyItems);// const codes = couponsForCheck\n//     .filter((c) => c.coupon_code && c.coupon_code[0] == \"H\") // coupon_code 필드가 존재하는 쿠폰만\n//     .map((c) => c.coupon_code as string) // 문자열로 추출\n// alert(\n//     `B-1) check: ${JSON.stringify(codes)}\\npassedSecondary: ${JSON.stringify(passedSecondaryCoupons)}`\n// )\nconst targetId=found.coupon_instance_id||found.coupon_definition_id;const included=passedSecondaryCoupons.some(c=>(c.coupon_instance_id||c.coupon_definition_id)===targetId);if(!included){// 🔸 필터에서 제외된 경우\nalert(`사용할 수 없는 쿠폰 조건입니다.`);return;}// 실제 할인액 계산\nconst{secondaryDetails}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,simulatedStore);const detail=secondaryDetails.find(d=>d.id===targetId);const appliedAmount=detail?.amount??0;if(!detail||appliedAmount<=0){// 🔸 필터는 통과했지만, 적용 가능한 결제 금액(잔액/상한)을 초과해 0원 처리된 경우\nalert(\"결제 할인 금액을 초과하여 쿠폰을 사용할 수 없습니다.\");return;}// 최종 적용\nconst isConfirmed=window.confirm(`쿠폰 ${code}을 적용합니다.`);if(isConfirmed){setStore({enteredCouponCode:[...store.enteredCouponCode??[],code]});}}catch(error){console.error(\"쿠폰 확인 중 오류 발생:\",error);alert(\"쿠폰 확인 중 오류가 발생했습니다. 다시 시도해주세요.\");}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}export async function fetchTotalMileage(membershipNumber){try{const res=await fetch(\"https://terene-db-server.onrender.com/api/v2/mileages\");if(!res.ok)throw new Error(\"Failed to fetch mileage data\");const data=await res.json();const userMileage=data.filter(m=>m.membership_number===membershipNumber);const totalAmount=userMileage.reduce((sum,entry)=>sum+Number(entry.mileage_amount||0),0);return totalAmount;}catch(error){console.error(\"마일리지 조회 실패:\",error);return 0;}}export function toggleMileage(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({mileage:Number(inputValue)});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleSpecialRequests(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({special_requests:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function handleAnniversaryDropdown(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const selectedValue=event.target.value;if(selectedValue!==\"기념일 종류\"){setStore({anniversary_type:selectedValue});}};return /*#__PURE__*/_jsx(Component,{...props,value:store.anniversary_type,onChange:handleChange});};}export function toggleAnniversaryName(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({anniversary_name:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleAnniversaryValue(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({anniversary_value:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}// ----- 토스 결제 / Paypal 결제 분기점 -----\nexport function toggleTossPayment(Component){return props=>{const[store,setStore]=useStore();const[formStore,setformStore]=useFormStore();const[payment,setPayment]=useState(formStore.payment);const toggle=()=>{setStore({payment:\"toss\"});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function togglePaypalPayment(Component){return props=>{const[store,setStore]=useStore();const[formStore,setformStore]=useFormStore();const[payment,setPayment]=useState(formStore.payment);const toggle=()=>{setStore({payment:\"paypal\"});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function toggleForeignCardPayment(Component){return props=>{const[store,setStore]=useStore();const[formStore,setformStore]=useFormStore();const[payment,setPayment]=useState(formStore.payment);const toggle=()=>{setStore({payment:\"foreignCard\"});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function toggleRefundName(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({refund_name:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleRefundPhone(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({refund_phone:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function handleRefundBank(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const selectedValue=event.target.value;if(selectedValue!==\"은행명\"){setStore({refund_bank:selectedValue});}};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleRefundAccount(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({refund_account:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function getAvailableMileage(Component){return props=>{const[store]=useStore();return /*#__PURE__*/_jsx(Component,{...props,text:`사용 가능 ${(store.totalMileage-store.usedMileage).toLocaleString()}p`});};}export function getTotalMileage(Component){return props=>{const[store,setStore]=useStore();React.useEffect(()=>{const fetchMileages=async()=>{if(!store.membership_number)return;try{const res=await fetch(\"https://terene-db-server.onrender.com/api/v2/mileages\");if(!res.ok)throw new Error(\"마일리지 조회 실패\");const data=await res.json();const sum=data.filter(m=>m.membership_number===store.membership_number).reduce((acc,m)=>acc+Number(m.mileage_amount||0),0);setStore({totalMileage:sum});}catch(e){console.error(\"마일리지 불러오기 실패:\",e);setStore({totalMileage:0});}};fetchMileages();},[store.membership_number]);return /*#__PURE__*/_jsx(Component,{...props,text:`보유 ${store.totalMileage.toLocaleString()}p`});};}export function applyMileage(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[store,setStore]=useStore();const handleClick=async()=>{if(!formStore.mileage){alert(`마일리지를 입력해주세요.`);return;}if(!Number.isInteger(formStore.mileage)||formStore.mileage<=0){alert(\"마일리지는 1 이상의 자연수로만 입력해주세요.\");return;}// if (!store.membership_number) {\n//     alert(\"멤버십 로그인이 필요합니다.\")\n//     return\n// }\n// const totalMileage = await fetchTotalMileage(\n//     store.membership_number\n// )\nconst availableMileage=store.totalMileage-store.usedMileage;if(formStore.mileage>availableMileage||availableMileage<=0){alert(`마일리지 수 부족: ${availableMileage.toLocaleString()}p`);return;}if(formStore.mileage>store.integratedPrice){alert(`최대 적용 가능한 마일리지 수를 초과하였습니다.\n현재 최대 적용 가능한 마일리지 수: ${store.integratedPrice.toLocaleString()}p`);return;}if(store.usedMileage==0){const isConfirmed=window.confirm(`마일리지 ${formStore.mileage.toLocaleString()}p를 적용합니다.`);if(isConfirmed){setStore({usedMileage:(store.usedMileage||0)+formStore.mileage});}}else{const isConfirmed=window.confirm(`마일리지 ${formStore.mileage.toLocaleString()}p를 추가로 적용합니다.`);if(isConfirmed){setStore({usedMileage:(store.usedMileage||0)+formStore.mileage});}}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}export function hidePaypalInfo(Component){return props=>{const[store,setStore]=useStore();if(store.payment!==\"paypal\")return null;return /*#__PURE__*/_jsx(Component,{...props});};}\nexport const __FramerMetadata__ = {\"exports\":{\"togglePhone\":{\"type\":\"reactHoc\",\"name\":\"togglePhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverNumber\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverNumber\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleRefundAccount\":{\"type\":\"reactHoc\",\"name\":\"toggleRefundAccount\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"handleRefundBank\":{\"type\":\"reactHoc\",\"name\":\"handleRefundBank\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleStayBirthdate\":{\"type\":\"reactHoc\",\"name\":\"toggleStayBirthdate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleRefundPhone\":{\"type\":\"reactHoc\",\"name\":\"toggleRefundPhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleCouponCode\":{\"type\":\"reactHoc\",\"name\":\"toggleCouponCode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"handleAnniversaryDropdown\":{\"type\":\"reactHoc\",\"name\":\"handleAnniversaryDropdown\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleAnniversaryName\":{\"type\":\"reactHoc\",\"name\":\"toggleAnniversaryName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleRefundName\":{\"type\":\"reactHoc\",\"name\":\"toggleRefundName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"hidePaypalInfo\":{\"type\":\"reactHoc\",\"name\":\"hidePaypalInfo\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"applyMileage\":{\"type\":\"reactHoc\",\"name\":\"applyMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"handleEmailDomainDropdown\":{\"type\":\"reactHoc\",\"name\":\"handleEmailDomainDropdown\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverEmail\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverEmail\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverNameNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverNameNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleAnniversaryValue\":{\"type\":\"reactHoc\",\"name\":\"toggleAnniversaryValue\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useFormStore\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleSameReserverStay\":{\"type\":\"reactHoc\",\"name\":\"toggleSameReserverStay\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverEmailNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverEmailNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverBirthdate\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverBirthdate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getTotalMileage\":{\"type\":\"reactHoc\",\"name\":\"getTotalMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleMileage\":{\"type\":\"reactHoc\",\"name\":\"toggleMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleEmail\":{\"type\":\"reactHoc\",\"name\":\"toggleEmail\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverPhoneNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverPhoneNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleBirthdate\":{\"type\":\"reactHoc\",\"name\":\"toggleBirthdate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"fetchTotalMileage\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleForeignCardPayment\":{\"type\":\"reactHoc\",\"name\":\"toggleForeignCardPayment\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"togglePaypalPayment\":{\"type\":\"reactHoc\",\"name\":\"togglePaypalPayment\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleStayPhone\":{\"type\":\"reactHoc\",\"name\":\"toggleStayPhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverName\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"checkRevisitAndCouponCode\":{\"type\":\"reactHoc\",\"name\":\"checkRevisitAndCouponCode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverPhone\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverPhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleTossPayment\":{\"type\":\"reactHoc\",\"name\":\"toggleTossPayment\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getAvailableMileage\":{\"type\":\"reactHoc\",\"name\":\"getAvailableMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleStayName\":{\"type\":\"reactHoc\",\"name\":\"toggleStayName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleSpecialRequests\":{\"type\":\"reactHoc\",\"name\":\"toggleSpecialRequests\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverBirthdateNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverBirthdateNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"applyCouponCode\":{\"type\":\"reactHoc\",\"name\":\"applyCouponCode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleNationality\":{\"type\":\"reactHoc\",\"name\":\"toggleNationality\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleName\":{\"type\":\"reactHoc\",\"name\":\"toggleName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ReservationForm.map","// PriceDisplay.tsx\nimport{jsx as _jsx}from\"react/jsx-runtime\";import React,{useEffect,useMemo}from\"react\";import{useStore}from\"https://framerusercontent.com/modules/c2GloFFeVhaMQsbMcdTk/XiJZ0vjlltE7FPQAQ8Lk/MainStore.js\";import{useFormStore}from\"https://framerusercontent.com/modules/j1JmQpFlkCqsnz6Zbn4l/bGMmyNcEKojl4EjjVGtC/ReservationForm.js\";import{calculateInitialPrices,filterCoupons,evaluateCoupons}from\"https://framerusercontent.com/modules/jTRIrvvdhM8hGc8tF4E7/Q2QLVylG6dtj4TyzXmqg/EvaluateCoupons.js\";import{useAdditionalServiceStore,createAdditionalServiceList}from\"https://framerusercontent.com/modules/k847LPNIMdkhfIs0ouwF/EUEOlsedw6DGLY16dhfq/AdditionalService.js\";import{parseDate}from\"https://framerusercontent.com/modules/1J9pgwrYtYGWgtmRStO4/muZZYJxbZe3foLJMfVTS/DateUtils.js\";import{motion}from\"framer-motion\";import{useDayCategoryDefinitions}from\"https://framerusercontent.com/modules/pKMQTtBDnyThccjiINTr/R6FlauGV8dPyEKPorKpi/useDayCategoryDefinitions.js\";const FadeIn=({children})=>/*#__PURE__*/_jsx(motion.div,{initial:{opacity:0,y:0},animate:{opacity:1,y:0},exit:{opacity:0,y:0},transition:{duration:.4,ease:\"easeOut\"},children:children});// 공휴일 카테고리 가져오기 (v3 구조 대응)\nexport function useHolidayCategoryMap(){const[categories,setCategories]=React.useState({});const[isLoading,setIsLoading]=React.useState(true);React.useEffect(()=>{fetch(\"https://terene-db-server.onrender.com/api/v3/days\").then(res=>res.json()).then(data=>{const map={};for(const item of data){// ✅ days_250928 구조 반영\n// item = { date, category, is_holiday, location, checkin_occupied, ... }\nmap[item.date]=item.category;}setCategories(map);}).catch(err=>console.error(\"Holiday fetch error\",err)).finally(()=>setIsLoading(false));},[]);return{categories,isLoading};}// ✅ 문자열 → 카테고리 매핑\nexport function toCategoryMap(input){return input;}export function useCoupons(){const[coupons,setCoupons]=React.useState([]);const[isLoading,setIsLoading]=React.useState(true);React.useEffect(()=>{async function fetchCoupons(){try{// Fetch definitions first\nconst defRes=await fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-definitions\");const definitions=await defRes.json();// Separate global and code types (ignore membership)\nconst globalDefs=definitions.filter(def=>def.type===\"global\");const codeDefs=definitions.filter(def=>def.type===\"code\");// Fetch instances only if there are code definitions\nlet codeInstances=[];if(codeDefs.length>0){const instRes=await fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-instances\");const instances=await instRes.json();codeInstances=instances.filter(inst=>codeDefs.some(def=>def.coupon_definition_id===inst.coupon_definition_id));}// Merge code definitions and their instances\nconst codeCoupons=codeInstances.map(inst=>{const def=codeDefs.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return{...def,...inst};});// Combine global and code coupons\nconst combined=[...globalDefs,...codeCoupons];// Sort by optional priority if present\nconst sorted=combined.sort((a,b)=>(a.priority||0)-(b.priority||0));setCoupons(sorted);}catch(err){console.error(\"Coupon fetch error:\",err);}finally{setIsLoading(false);}}fetchCoupons();},[]);return{coupons,isLoading};}function useDiscountCalculation(){const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isReady=store.firstDate&&store.secondDate||firstDate&&secondDate;const result=useMemo(()=>{if(!isReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice,dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);return{initialPrice,discountedPrice};},[store,categories,coupons,firstDate,secondDate,categoryLoading,couponLoading]);return{isLoading:!isReady||categoryLoading||couponLoading,data:result};}export function displayInitialPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();// console.log(\"### COUPONS ###\")\n// console.log(JSON.stringify(coupons))\nconst{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const text=store.payment===\"paypal\"?`KRW ${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")} 원`;return(// <FadeIn>\n/*#__PURE__*/_jsx(Component,{...props,text:text}));};}export function displayDiscountedPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const text=store.payment===\"paypal\"?`KRW ${Math.max(discountedPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(discountedPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}function transitionStyle(visible){return{opacity:visible?1:0,color:\"inherit\",transition:\"opacity 0.3s ease-in-out\",display:\"inline-block\"};}export function displayDiscountBar(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice,dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const show=initialPrice!==Math.max(discountedPrice,0);const baseStyle=transitionStyle(show);const width=initialPrice>=1e8?144:initialPrice>=1e7?128:112;const barStyle={...baseStyle,width,position:\"relative\",right:0,transform:`translateX(${92-width}px)`};// <Component {...props} style={barStyle} />\nreturn /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,style:baseStyle})});};}export function displaySoftInitialPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const text=store.payment===\"paypal\"?`KRW ${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function getAdditionalPrice(){const[store]=useStore();const[additionalServiceStore]=useAdditionalServiceStore();const additionalServiceList=createAdditionalServiceList(additionalServiceStore,store);const totalAmount=additionalServiceList.reduce((sum,service)=>{return sum+service.amount;},0);return totalAmount;}export function displayIntegratedPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=store.membership===\"All-Free\"?0:Math.max(discountedPrice,0)+additionalPrice;const text=store.payment===\"paypal\"?`KRW ${Math.max(integratedPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(integratedPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayExchangeMarginPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=Math.max(discountedPrice,0)+additionalPrice;const exchangeMarginPrice=store.membership===\"All-Free\"||store.payment!==\"paypal\"?0:Math.round(integratedPrice*.05)// 기존 가격의 5%만큼 환전 수수료 적용\n;const text=store.payment===\"paypal\"?`KRW ${Math.max(exchangeMarginPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(exchangeMarginPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayVatPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=Math.max(discountedPrice,0)+additionalPrice;const vatPrice=store.membership===\"All-Free\"?0:Math.round(integratedPrice*.1);const text=store.payment===\"paypal\"?`KRW ${Math.max(vatPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(vatPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayDepositPrice(Component){const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;return props=>{const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const depositPrice=store.membership===\"Non-Member\"?3e5:0;const text=store.payment===\"paypal\"?`KRW ${Math.max(depositPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(depositPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayFinalPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store,setStore]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;const priceData=useMemo(()=>{if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const initialPrice=dailyItems.reduce((sum,item)=>sum+item.price,0);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice,primaryDetails,secondaryDetails}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=store.membership===\"All-Free\"?0:Math.max(discountedPrice,0)+additionalPrice;const exchangeMarginPrice=store.payment===\"paypal\"?Math.round(integratedPrice*.05)// 기존 가격의 5%만큼 환전 수수료 적용\n:0;const vatPrice=Math.round(integratedPrice*.1);const depositPrice=store.membership===\"Non-Member\"?3e5:0;const finalPrice=store.membership===\"All-Free\"?0:integratedPrice+exchangeMarginPrice+vatPrice+depositPrice;const text=store.payment===\"paypal\"?`KRW ${Math.max(finalPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(finalPrice,0).toLocaleString(\"ko-KR\")} 원`;return{initialPrice,discountedPrice,additionalPrice,integratedPrice,exchangeMarginPrice,vatPrice,depositPrice,finalPrice,text,primaryDetails,secondaryDetails};},[isStoreReady,categoryLoading,couponLoading,store,categories,coupons,additionalPrice]);useEffect(()=>{if(!priceData)return;setStore(prev=>{const isSame=prev.finalPrice===priceData.finalPrice&&prev.initialPrice===priceData.initialPrice&&prev.discountedPrice===priceData.discountedPrice&&prev.additionalPrice===priceData.additionalPrice&&prev.integratedPrice===priceData.integratedPrice&&prev.exchangeMarginPrice===priceData.exchangeMarginPrice&&prev.vatPrice===priceData.vatPrice&&prev.depositPrice===priceData.depositPrice;if(isSame)return prev;return{...prev,initialPrice:priceData.initialPrice,discountedPrice:priceData.discountedPrice,additionalPrice:priceData.additionalPrice,integratedPrice:priceData.integratedPrice,exchangeMarginPrice:priceData.exchangeMarginPrice,vatPrice:priceData.vatPrice,depositPrice:priceData.depositPrice,finalPrice:priceData.finalPrice,couponPrimaryDetails:priceData.primaryDetails,couponSecondaryDetails:priceData.secondaryDetails};});},[priceData?.initialPrice,priceData?.discountedPrice,priceData?.additionalPrice,priceData?.integratedPrice,priceData?.exchangeMarginPrice,priceData?.vatPrice,priceData?.depositPrice,priceData?.finalPrice]);if(!priceData)return null;// console.log(priceData?.finalPrice)\nreturn /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:priceData.text})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"useCoupons\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayInitialPrice\":{\"type\":\"reactHoc\",\"name\":\"displayInitialPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayDiscountedPrice\":{\"type\":\"reactHoc\",\"name\":\"displayDiscountedPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useHolidayCategoryMap\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displaySoftInitialPrice\":{\"type\":\"reactHoc\",\"name\":\"displaySoftInitialPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayIntegratedPrice\":{\"type\":\"reactHoc\",\"name\":\"displayIntegratedPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayVatPrice\":{\"type\":\"reactHoc\",\"name\":\"displayVatPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayFinalPrice\":{\"type\":\"reactHoc\",\"name\":\"displayFinalPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayExchangeMarginPrice\":{\"type\":\"reactHoc\",\"name\":\"displayExchangeMarginPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toCategoryMap\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayDepositPrice\":{\"type\":\"reactHoc\",\"name\":\"displayDepositPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getAdditionalPrice\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayDiscountBar\":{\"type\":\"reactHoc\",\"name\":\"displayDiscountBar\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","import{jsx as _jsx}from\"react/jsx-runtime\";import{useState}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import*as React from\"react\";import{useStore}from\"https://framerusercontent.com/modules/c2GloFFeVhaMQsbMcdTk/XiJZ0vjlltE7FPQAQ8Lk/MainStore.js\";import{parseDate}from\"https://framerusercontent.com/modules/1J9pgwrYtYGWgtmRStO4/muZZYJxbZe3foLJMfVTS/DateUtils.js\";import{toCategoryMap}from\"https://framerusercontent.com/modules/t32tReeHmrCTzbf5rVbb/9tPAzOAQErQII62FaBq1/PriceDisplay.js\";// ✅ 추가: 계산/필터 함수 import (PriceDisplay와 동일 파이프라인 사용)\nimport{calculateInitialPrices,filterCoupons,evaluateCoupons}from\"https://framerusercontent.com/modules/jTRIrvvdhM8hGc8tF4E7/Q2QLVylG6dtj4TyzXmqg/EvaluateCoupons.js\";import{useDayCategoryDefinitions}from\"https://framerusercontent.com/modules/pKMQTtBDnyThccjiINTr/R6FlauGV8dPyEKPorKpi/useDayCategoryDefinitions.js\";function getKSTDate(baseDate=new Date){const utc=baseDate.getTime()+baseDate.getTimezoneOffset()*6e4;return new Date(utc+9*60*60*1e3);}function getKSTISOString(date=new Date){const kstDate=getKSTDate(date);const pad=n=>String(n).padStart(2,\"0\");const year=kstDate.getFullYear();const month=pad(kstDate.getMonth()+1);const day=pad(kstDate.getDate());const hours=pad(kstDate.getHours());const minutes=pad(kstDate.getMinutes());const seconds=pad(kstDate.getSeconds());return`${year}-${month}-${day}T${hours}:${minutes}:${seconds}+09:00`;}export const useFormStore=createStore({name:null,birthdate:null,phone:null,email:null,emailDomain:null,nationality:\"domestic\",reserver_number:null,reserver_name:null,reserver_birthdate:null,reserver_phone:null,reserver_email:null,reserver_email_domain:null,isSameReserverStay:false,stay_name:null,stay_birthdate:null,stay_phone:null,couponCode:null,mileage:0,special_requests:null,anniversary_type:\"기념일 종류\",anniversary_name:null,anniversary_value:null,facility_policy:false,cancellation_policy:false,privacy_policy:false,marketing_consent:false,refund_name:null,refund_phone:null,refund_bank:null,refund_account:null});export function toggleName(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({name:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleBirthdate(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({birthdate:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function togglePhone(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({phone:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleEmail(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({email:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleNationality(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.nationality===\"domestic\"||mainStore.nationality===\"foreign\";// const shouldAutofill = false\nReact.useEffect(()=>{if(shouldAutofill&&formStore.nationality!==mainStore.nationality){setFormStore({nationality:mainStore.nationality});}},[shouldAutofill,mainStore.nationality]);const handleChange=value=>{setFormStore({nationality:value});};return /*#__PURE__*/_jsx(Component,{...props,disabled:shouldAutofill,selectedValue:shouldAutofill?mainStore.nationality:props.selectedValue,onChange:shouldAutofill?undefined:handleChange,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverNumber(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_number!==mainStore.membership_number){setFormStore({reserver_name:mainStore.membership_number});}},[shouldAutofill,mainStore.name]);const handleChange=event=>{setFormStore({reserver_number:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.membership_number:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverName(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_name!==mainStore.name){setFormStore({reserver_name:mainStore.name});}},[shouldAutofill,mainStore.name]);const handleChange=event=>{setFormStore({reserver_name:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.name:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverBirthdate(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_birthdate!==mainStore.birthdate){setFormStore({reserver_birthdate:mainStore.birthdate});}},[shouldAutofill,mainStore.birthdate]);const handleChange=event=>{setFormStore({reserver_birthdate:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.birthdate:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverPhone(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_phone!==mainStore.phone){setFormStore({reserver_phone:mainStore.phone});}},[shouldAutofill,mainStore.phone]);const handleChange=event=>{setFormStore({reserver_phone:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.phone:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverEmail(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_email!==mainStore.email){setFormStore({reserver_email:mainStore.email});}},[shouldAutofill,mainStore.email]);const handleChange=event=>{setFormStore({reserver_email:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.email:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function handleEmailDomainDropdown(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const selectedValue=event.target.value;if(selectedValue&&selectedValue!==\"직접 입력\"){setStore({reserver_email_domain:selectedValue});}};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleReserverNameNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_name!==mainStore.name){setFormStore({reserver_name:mainStore.name});}},[shouldAutofill,mainStore.name]);const handleChange=event=>{setFormStore({reserver_name:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.name:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverBirthdateNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_birthdate!==mainStore.birthdate){setFormStore({reserver_birthdate:mainStore.birthdate});}},[shouldAutofill,mainStore.birthdate]);const handleChange=event=>{setFormStore({reserver_birthdate:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.birthdate:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverPhoneNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_phone!==mainStore.phone){setFormStore({reserver_phone:mainStore.phone});}},[shouldAutofill,mainStore.phone]);const handleChange=event=>{setFormStore({reserver_phone:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.phone:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverEmailNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_email!==mainStore.email){setFormStore({reserver_email:mainStore.email});}},[shouldAutofill,mainStore.email]);const handleChange=event=>{setFormStore({reserver_email:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.email:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleSameReserverStay(Component){return props=>{const[store,setStore]=useFormStore();const toggle=()=>{setStore({isSameReserverStay:!store.isSameReserverStay});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function toggleStayName(Component){return props=>{const[store]=useStore();const[formStore,setFormStore]=useFormStore();const shouldAutofill=formStore.isSameReserverStay;const autofillValue=formStore.reserver_name??\"\";React.useEffect(()=>{if(shouldAutofill&&formStore.stay_name!==autofillValue){setFormStore({stay_name:autofillValue});}},[shouldAutofill,autofillValue]);const handleChange=event=>{setFormStore({stay_name:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?autofillValue:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleStayBirthdate(Component){return props=>{const[store]=useStore();const[formStore,setFormStore]=useFormStore();const shouldAutofill=formStore.isSameReserverStay;const autofillValue=formStore.reserver_birthdate??\"\";React.useEffect(()=>{if(shouldAutofill&&formStore.stay_birthdate!==autofillValue){setFormStore({stay_birthdate:autofillValue});}},[shouldAutofill,autofillValue]);const handleChange=event=>{setFormStore({stay_birthdate:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?autofillValue:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleStayPhone(Component){return props=>{const[store]=useStore();const[formStore,setFormStore]=useFormStore();const shouldAutofill=formStore.isSameReserverStay;const autofillValue=formStore.reserver_phone??\"\";React.useEffect(()=>{if(shouldAutofill&&formStore.stay_phone!==autofillValue){setFormStore({stay_phone:autofillValue});}},[shouldAutofill,autofillValue]);const handleChange=event=>{setFormStore({stay_phone:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?autofillValue:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleCouponCode(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({couponCode:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function applyCouponCode(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[store,setStore]=useStore();const handleClick=async()=>{const code=formStore.couponCode?.trim();if(!code){alert(\"쿠폰 번호를 입력해주세요.\");return;}// if (store.expiredCoupons.includes(code)) {\n//     alert(\"한번 사용한 쿠폰은 재사용할 수 없습니다.\")\n//     return\n// }\nif(store.enteredCouponCode.includes(code)){alert(\"이미 적용된 쿠폰입니다.\");return;}try{// 쿠폰 데이터 가져오기\nconst[defRes,instRes]=await Promise.all([fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-definitions\"),fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-instances\")]);const definitions=await defRes.json();const instances=await instRes.json();// code 타입 정의만 필터링\nconst codeDefs=definitions.filter(def=>def.type===\"code\");// 인스턴스 + 정의 병합\nconst mergedCoupons=instances.filter(inst=>inst.coupon_code===code).map(inst=>{const def=codeDefs.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return def?{...def,...inst}:null;}).filter(Boolean);if(mergedCoupons.length===0){alert(\"쿠폰이 존재하지 않거나 쿠폰번호가 잘못되었습니다.\");return;}const[found]=mergedCoupons;// 상태 체크\nif(found.status!==\"available\"){alert(\"이 쿠폰은 현재 사용이 불가능합니다.\");return;}// 유효기간 체크\nif(found.coupon_due){const now=new Date;const due=new Date(found.coupon_due);if(isNaN(due.getTime())||now>due){alert(\"이 쿠폰의 유효기간이 지났습니다.\");return;}}// 적용 확인\nconst isConfirmed=window.confirm(`쿠폰 ${code}을 적용합니다.`);if(isConfirmed){setStore({enteredCouponCode:[...store.enteredCouponCode,code]});}}catch(error){console.error(\"쿠폰 확인 중 오류 발생:\",error);alert(\"쿠폰 확인 중 오류가 발생했습니다. 다시 시도해주세요.\");}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}// -----------------------------------------\nexport function checkRevisitAndCouponCode(Component){return props=>{const[formStore]=useFormStore();const[store,setStore]=useStore();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const handleClick=async()=>{const code=formStore.couponCode?.trim();if(!code){alert(\"쿠폰 번호를 입력해주세요.\");return;}try{// revisit 계산 (체크아웃 기준)\nconst ordersRes=await fetch(\"https://terene-db-server.onrender.com/api/v2/orders\");const orders=await ordersRes.json();const normalize=str=>str?.replace(/[\\s\\-./]/g,\"\").toLowerCase().trim();const revisitCount=orders.filter(order=>{return order.stay_status===\"checked_out\"&&normalize(order.reserver_name)===normalize(formStore.reserver_name)&&normalize(order.reserver_birthdate)===normalize(formStore.reserver_birthdate)&&normalize(order.reserver_contact)===normalize(formStore.reserver_phone);}).length;setStore({revisit:String(revisitCount)});if(store.enteredCouponCode?.includes(code)){alert(\"이미 적용된 쿠폰입니다.\");return;}// 쿠폰 정의/인스턴스 가져오기\nconst[defRes,instRes]=await Promise.all([fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-definitions\"),fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-instances\")]);const definitions=await defRes.json();const instances=await instRes.json();const codeDefs=definitions.filter(def=>def.type===\"code\");const mergedCoupons=instances.filter(inst=>inst.coupon_code===code).map(inst=>{const def=codeDefs.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return def?{...def,...inst}:null;}).filter(Boolean);if(mergedCoupons.length===0){alert(\"쿠폰이 존재하지 않거나 쿠폰번호가 잘못되었습니다.\");return;}const[found]=mergedCoupons;// 🔁 중복 제한(요구사항 반영): exclusive ↔ 모든 code형 쿠폰 상호배타\nconst appliedCodeCoupons=(store.enteredCouponCode??[]).map(appliedCode=>{const inst=instances.find(i=>i.coupon_code===appliedCode);if(!inst)return null;const def=definitions.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return def?{...def,...inst}:null;}).filter(c=>c&&c.type===\"code\");const hasAppliedExclusiveCode=appliedCodeCoupons.some(c=>c.exclusive===true);if(found.exclusive){// 이미 어떤 code형 쿠폰이라도 적용돼 있으면 exclusive는 불가\nif(appliedCodeCoupons.length>0){const conflict=appliedCodeCoupons[0];alert(`해당 쿠폰은 단독형 쿠폰으로, 기존 쿠폰(${conflict.description})과 함께 사용할 수 없습니다.`);return;}}else{// exclusive가 한 번이라도 적용돼 있으면 모든 code형 쿠폰 추가 불가\nif(hasAppliedExclusiveCode){const conflict=appliedCodeCoupons.find(c=>c.exclusive===true);alert(`이미 단독형 쿠폰(${conflict.description})이 적용되어 있어 다른 쿠폰을 사용할 수 없습니다.`);return;}}// 수취인/멤버십 일치 검증\nconst n=v=>String(v??\"\").replace(/[\\s\\-./]/g,\"\").toLowerCase().trim();const mismatch=(a,b)=>n(a)!==n(b);const hasMembership=found.membership_number!=null&&n(found.membership_number)!==\"\";const membershipMismatch=mismatch(found.membership_number,store.membership_number);const infoMismatch=mismatch(found.receiver_info?.name,formStore.reserver_name)||mismatch(found.receiver_info?.birthdate,formStore.reserver_birthdate)||mismatch(found.receiver_info?.contact,formStore.reserver_phone);const isEmptyCoupon=!found.receiver_info?.name&&!found.receiver_info?.birthdate&&!found.receiver_info?.contact&&!hasMembership;const shouldAlert=hasMembership?membershipMismatch:infoMismatch;if(!isEmptyCoupon&&shouldAlert){alert(\"쿠폰이 존재하지 않거나 쿠폰번호가 잘못되었습니다.\");return;}if(found.status!==\"available\"){alert(\"이 쿠폰은 현재 사용이 불가능합니다.\");return;}if(found.coupon_due){const now=new Date;const due=new Date(found.coupon_due);if(isNaN(due.getTime())||now>due){alert(\"이 쿠폰의 유효기간이 지났습니다.\");return;}}// ----------------------------\n// 날짜 준비/검증\n// ----------------------------\nconst queryParams=new URLSearchParams(window.location.search);const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDateFromQuery=first?parseDate(first):null;const secondDateFromQuery=second?parseDate(second):null;const firstDateObj=store.firstDate??firstDateFromQuery;const secondDateObj=store.secondDate??secondDateFromQuery;if(!firstDateObj||!secondDateObj){alert(\"체크인/체크아웃 날짜를 먼저 선택한 뒤 쿠폰을 적용해주세요.\");return;}// ----------------------------\n// 카테고리 맵 로드\n// ----------------------------\nlet categoryMap={};try{const holidayRes=await fetch(\"https://terene-db-server.onrender.com/api/v3/days\");const days=await holidayRes.json();const rawMap={};for(const item of days){rawMap[item.date]=item.category;}categoryMap=toCategoryMap(rawMap);}catch(err){console.error(\"❌ Category map load failed:\",err);categoryMap={};}console.log(\"firstDateObj\",firstDateObj);console.log(\"secondDateObj\",secondDateObj);// ----------------------------\n// 일자별 가격 계산 (명시적 날짜 전달)\n// ----------------------------\nconst{dailyItems}=calculateInitialPrices({...store},categoryMap,categoryDefs,firstDateObj,secondDateObj);// 글로벌 + 현재 코드만 구성\nconst globalDefs=definitions.filter(def=>def.type===\"global\");const couponsForCheck=[...globalDefs,found];// 가상 store: enteredCouponCode에 현재 코드 포함\nconst simulatedStore={...store,enteredCouponCode:[...store.enteredCouponCode??[],code]};// 필터 통과 여부\nconst{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(couponsForCheck,simulatedStore,dailyItems);// const codes = couponsForCheck\n//     .filter((c) => c.coupon_code && c.coupon_code[0] == \"H\") // coupon_code 필드가 존재하는 쿠폰만\n//     .map((c) => c.coupon_code as string) // 문자열로 추출\n// alert(\n//     `B-1) check: ${JSON.stringify(codes)}\\npassedSecondary: ${JSON.stringify(passedSecondaryCoupons)}`\n// )\nconst targetId=found.coupon_instance_id||found.coupon_definition_id;const included=passedSecondaryCoupons.some(c=>(c.coupon_instance_id||c.coupon_definition_id)===targetId);if(!included){// 🔸 필터에서 제외된 경우\nalert(`사용할 수 없는 쿠폰 조건입니다.`);return;}// 실제 할인액 계산\nconst{secondaryDetails}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,simulatedStore);const detail=secondaryDetails.find(d=>d.id===targetId);const appliedAmount=detail?.amount??0;if(!detail||appliedAmount<=0){// 🔸 필터는 통과했지만, 적용 가능한 결제 금액(잔액/상한)을 초과해 0원 처리된 경우\nalert(\"결제 할인 금액을 초과하여 쿠폰을 사용할 수 없습니다.\");return;}// 최종 적용\nconst isConfirmed=window.confirm(`쿠폰 ${code}을 적용합니다.`);if(isConfirmed){setStore({enteredCouponCode:[...store.enteredCouponCode??[],code]});}}catch(error){console.error(\"쿠폰 확인 중 오류 발생:\",error);alert(\"쿠폰 확인 중 오류가 발생했습니다. 다시 시도해주세요.\");}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}export async function fetchTotalMileage(membershipNumber){try{const res=await fetch(\"https://terene-db-server.onrender.com/api/v2/mileages\");if(!res.ok)throw new Error(\"Failed to fetch mileage data\");const data=await res.json();const userMileage=data.filter(m=>m.membership_number===membershipNumber);const totalAmount=userMileage.reduce((sum,entry)=>sum+Number(entry.mileage_amount||0),0);return totalAmount;}catch(error){console.error(\"마일리지 조회 실패:\",error);return 0;}}export function toggleMileage(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({mileage:Number(inputValue)});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleSpecialRequests(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({special_requests:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function handleAnniversaryDropdown(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const selectedValue=event.target.value;if(selectedValue!==\"기념일 종류\"){setStore({anniversary_type:selectedValue});}};return /*#__PURE__*/_jsx(Component,{...props,value:store.anniversary_type,onChange:handleChange});};}export function toggleAnniversaryName(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({anniversary_name:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleAnniversaryValue(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({anniversary_value:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}// ----- 토스 결제 / Paypal 결제 분기점 -----\nexport function toggleTossPayment(Component){return props=>{const[store,setStore]=useStore();const[formStore,setformStore]=useFormStore();const[payment,setPayment]=useState(formStore.payment);const toggle=()=>{setStore({payment:\"toss\"});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function togglePaypalPayment(Component){return props=>{const[store,setStore]=useStore();const[formStore,setformStore]=useFormStore();const[payment,setPayment]=useState(formStore.payment);const toggle=()=>{setStore({payment:\"paypal\"});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function toggleForeignCardPayment(Component){return props=>{const[store,setStore]=useStore();const[formStore,setformStore]=useFormStore();const[payment,setPayment]=useState(formStore.payment);const toggle=()=>{setStore({payment:\"foreignCard\"});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function toggleRefundName(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({refund_name:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleRefundPhone(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({refund_phone:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function handleRefundBank(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const selectedValue=event.target.value;if(selectedValue!==\"은행명\"){setStore({refund_bank:selectedValue});}};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleRefundAccount(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({refund_account:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function getAvailableMileage(Component){return props=>{const[store]=useStore();return /*#__PURE__*/_jsx(Component,{...props,text:`사용 가능 ${(store.totalMileage-store.usedMileage).toLocaleString()}p`});};}export function getTotalMileage(Component){return props=>{const[store,setStore]=useStore();React.useEffect(()=>{const fetchMileages=async()=>{if(!store.membership_number)return;try{const res=await fetch(\"https://terene-db-server.onrender.com/api/v2/mileages\");if(!res.ok)throw new Error(\"마일리지 조회 실패\");const data=await res.json();const sum=data.filter(m=>m.membership_number===store.membership_number).reduce((acc,m)=>acc+Number(m.mileage_amount||0),0);setStore({totalMileage:sum});}catch(e){console.error(\"마일리지 불러오기 실패:\",e);setStore({totalMileage:0});}};fetchMileages();},[store.membership_number]);return /*#__PURE__*/_jsx(Component,{...props,text:`보유 ${store.totalMileage.toLocaleString()}p`});};}export function applyMileage(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[store,setStore]=useStore();const handleClick=async()=>{if(!formStore.mileage){alert(`마일리지를 입력해주세요.`);return;}if(!Number.isInteger(formStore.mileage)||formStore.mileage<=0){alert(\"마일리지는 1 이상의 자연수로만 입력해주세요.\");return;}// if (!store.membership_number) {\n//     alert(\"멤버십 로그인이 필요합니다.\")\n//     return\n// }\n// const totalMileage = await fetchTotalMileage(\n//     store.membership_number\n// )\nconst availableMileage=store.totalMileage-store.usedMileage;if(formStore.mileage>availableMileage||availableMileage<=0){alert(`마일리지 수 부족: ${availableMileage.toLocaleString()}p`);return;}if(formStore.mileage>store.integratedPrice){alert(`최대 적용 가능한 마일리지 수를 초과하였습니다.\n현재 최대 적용 가능한 마일리지 수: ${store.integratedPrice.toLocaleString()}p`);return;}if(store.usedMileage==0){const isConfirmed=window.confirm(`마일리지 ${formStore.mileage.toLocaleString()}p를 적용합니다.`);if(isConfirmed){setStore({usedMileage:(store.usedMileage||0)+formStore.mileage});}}else{const isConfirmed=window.confirm(`마일리지 ${formStore.mileage.toLocaleString()}p를 추가로 적용합니다.`);if(isConfirmed){setStore({usedMileage:(store.usedMileage||0)+formStore.mileage});}}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}export function hidePaypalInfo(Component){return props=>{const[store,setStore]=useStore();if(store.payment!==\"paypal\")return null;return /*#__PURE__*/_jsx(Component,{...props});};}\nexport const __FramerMetadata__ = {\"exports\":{\"togglePhone\":{\"type\":\"reactHoc\",\"name\":\"togglePhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverBirthdate\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverBirthdate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleEmail\":{\"type\":\"reactHoc\",\"name\":\"toggleEmail\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleName\":{\"type\":\"reactHoc\",\"name\":\"toggleName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"handleRefundBank\":{\"type\":\"reactHoc\",\"name\":\"handleRefundBank\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"checkRevisitAndCouponCode\":{\"type\":\"reactHoc\",\"name\":\"checkRevisitAndCouponCode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"fetchTotalMileage\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleRefundName\":{\"type\":\"reactHoc\",\"name\":\"toggleRefundName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverEmailNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverEmailNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverNumber\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverNumber\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"applyMileage\":{\"type\":\"reactHoc\",\"name\":\"applyMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"handleAnniversaryDropdown\":{\"type\":\"reactHoc\",\"name\":\"handleAnniversaryDropdown\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleStayPhone\":{\"type\":\"reactHoc\",\"name\":\"toggleStayPhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleForeignCardPayment\":{\"type\":\"reactHoc\",\"name\":\"toggleForeignCardPayment\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getAvailableMileage\":{\"type\":\"reactHoc\",\"name\":\"getAvailableMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverBirthdateNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverBirthdateNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleStayName\":{\"type\":\"reactHoc\",\"name\":\"toggleStayName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverEmail\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverEmail\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleSameReserverStay\":{\"type\":\"reactHoc\",\"name\":\"toggleSameReserverStay\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverNameNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverNameNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getTotalMileage\":{\"type\":\"reactHoc\",\"name\":\"getTotalMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleBirthdate\":{\"type\":\"reactHoc\",\"name\":\"toggleBirthdate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleCouponCode\":{\"type\":\"reactHoc\",\"name\":\"toggleCouponCode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleTossPayment\":{\"type\":\"reactHoc\",\"name\":\"toggleTossPayment\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleMileage\":{\"type\":\"reactHoc\",\"name\":\"toggleMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleRefundPhone\":{\"type\":\"reactHoc\",\"name\":\"toggleRefundPhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"hidePaypalInfo\":{\"type\":\"reactHoc\",\"name\":\"hidePaypalInfo\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleSpecialRequests\":{\"type\":\"reactHoc\",\"name\":\"toggleSpecialRequests\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverName\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleNationality\":{\"type\":\"reactHoc\",\"name\":\"toggleNationality\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleAnniversaryName\":{\"type\":\"reactHoc\",\"name\":\"toggleAnniversaryName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleAnniversaryValue\":{\"type\":\"reactHoc\",\"name\":\"toggleAnniversaryValue\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleRefundAccount\":{\"type\":\"reactHoc\",\"name\":\"toggleRefundAccount\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"togglePaypalPayment\":{\"type\":\"reactHoc\",\"name\":\"togglePaypalPayment\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"handleEmailDomainDropdown\":{\"type\":\"reactHoc\",\"name\":\"handleEmailDomainDropdown\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleStayBirthdate\":{\"type\":\"reactHoc\",\"name\":\"toggleStayBirthdate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverPhone\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverPhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverPhoneNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverPhoneNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"applyCouponCode\":{\"type\":\"reactHoc\",\"name\":\"applyCouponCode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useFormStore\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ReservationForm.map","// PriceDisplay.tsx\nimport{jsx as _jsx}from\"react/jsx-runtime\";import React,{useEffect,useMemo}from\"react\";import{useStore}from\"https://framerusercontent.com/modules/c2GloFFeVhaMQsbMcdTk/XiJZ0vjlltE7FPQAQ8Lk/MainStore.js\";import{useFormStore}from\"https://framerusercontent.com/modules/j1JmQpFlkCqsnz6Zbn4l/uk405UIITh0zyxiSBkhM/ReservationForm.js\";import{calculateInitialPrices,filterCoupons,evaluateCoupons}from\"https://framerusercontent.com/modules/jTRIrvvdhM8hGc8tF4E7/Q2QLVylG6dtj4TyzXmqg/EvaluateCoupons.js\";import{useAdditionalServiceStore,createAdditionalServiceList}from\"https://framerusercontent.com/modules/k847LPNIMdkhfIs0ouwF/EUEOlsedw6DGLY16dhfq/AdditionalService.js\";import{parseDate}from\"https://framerusercontent.com/modules/1J9pgwrYtYGWgtmRStO4/muZZYJxbZe3foLJMfVTS/DateUtils.js\";import{motion}from\"framer-motion\";import{useDayCategoryDefinitions}from\"https://framerusercontent.com/modules/pKMQTtBDnyThccjiINTr/R6FlauGV8dPyEKPorKpi/useDayCategoryDefinitions.js\";const FadeIn=({children})=>/*#__PURE__*/_jsx(motion.div,{initial:{opacity:0,y:0},animate:{opacity:1,y:0},exit:{opacity:0,y:0},transition:{duration:.4,ease:\"easeOut\"},children:children});// 공휴일 카테고리 가져오기 (v3 구조 대응)\nexport function useHolidayCategoryMap(){const[categories,setCategories]=React.useState({});const[isLoading,setIsLoading]=React.useState(true);React.useEffect(()=>{fetch(\"https://terene-db-server.onrender.com/api/v3/days\").then(res=>res.json()).then(data=>{const map={};for(const item of data){// ✅ days_250928 구조 반영\n// item = { date, category, is_holiday, location, checkin_occupied, ... }\nmap[item.date]=item.category;}setCategories(map);}).catch(err=>console.error(\"Holiday fetch error\",err)).finally(()=>setIsLoading(false));},[]);return{categories,isLoading};}// ✅ 문자열 → 카테고리 매핑\nexport function toCategoryMap(input){return input;}export function useCoupons(){const[coupons,setCoupons]=React.useState([]);const[isLoading,setIsLoading]=React.useState(true);React.useEffect(()=>{async function fetchCoupons(){try{// Fetch definitions first\nconst defRes=await fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-definitions\");const definitions=await defRes.json();// Separate global and code types (ignore membership)\nconst globalDefs=definitions.filter(def=>def.type===\"global\");const codeDefs=definitions.filter(def=>def.type===\"code\");// Fetch instances only if there are code definitions\nlet codeInstances=[];if(codeDefs.length>0){const instRes=await fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-instances\");const instances=await instRes.json();codeInstances=instances.filter(inst=>codeDefs.some(def=>def.coupon_definition_id===inst.coupon_definition_id));}// Merge code definitions and their instances\nconst codeCoupons=codeInstances.map(inst=>{const def=codeDefs.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return{...def,...inst};});// Combine global and code coupons\nconst combined=[...globalDefs,...codeCoupons];// Sort by optional priority if present\nconst sorted=combined.sort((a,b)=>(a.priority||0)-(b.priority||0));setCoupons(sorted);}catch(err){console.error(\"Coupon fetch error:\",err);}finally{setIsLoading(false);}}fetchCoupons();},[]);return{coupons,isLoading};}function useDiscountCalculation(){const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isReady=store.firstDate&&store.secondDate||firstDate&&secondDate;const result=useMemo(()=>{if(!isReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice,dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);return{initialPrice,discountedPrice};},[store,categories,coupons,firstDate,secondDate,categoryLoading,couponLoading]);return{isLoading:!isReady||categoryLoading||couponLoading,data:result};}export function displayInitialPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();// console.log(\"### COUPONS ###\")\n// console.log(JSON.stringify(coupons))\nconst{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const text=store.payment===\"paypal\"?`KRW ${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")} 원`;return(// <FadeIn>\n/*#__PURE__*/_jsx(Component,{...props,text:text}));};}export function displayDiscountedPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const text=store.payment===\"paypal\"?`KRW ${Math.max(discountedPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(discountedPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}function transitionStyle(visible){return{opacity:visible?1:0,color:\"inherit\",transition:\"opacity 0.3s ease-in-out\",display:\"inline-block\"};}export function displayDiscountBar(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice,dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const show=initialPrice!==Math.max(discountedPrice,0);const baseStyle=transitionStyle(show);const width=initialPrice>=1e8?144:initialPrice>=1e7?128:112;const barStyle={...baseStyle,width,position:\"relative\",right:0,transform:`translateX(${92-width}px)`};// <Component {...props} style={barStyle} />\nreturn /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,style:baseStyle})});};}export function displaySoftInitialPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const text=store.payment===\"paypal\"?`KRW ${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function getAdditionalPrice(){const[store]=useStore();const[additionalServiceStore]=useAdditionalServiceStore();const additionalServiceList=createAdditionalServiceList(additionalServiceStore,store);const totalAmount=additionalServiceList.reduce((sum,service)=>{return sum+service.amount;},0);return totalAmount;}export function displayIntegratedPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=store.membership===\"All-Free\"?0:Math.max(discountedPrice,0)+additionalPrice;const text=store.payment===\"paypal\"?`KRW ${Math.max(integratedPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(integratedPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayExchangeMarginPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=Math.max(discountedPrice,0)+additionalPrice;const exchangeMarginPrice=store.membership===\"All-Free\"||store.payment!==\"paypal\"?0:Math.round(integratedPrice*.05)// 기존 가격의 5%만큼 환전 수수료 적용\n;const text=store.payment===\"paypal\"?`KRW ${Math.max(exchangeMarginPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(exchangeMarginPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayVatPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=Math.max(discountedPrice,0)+additionalPrice;const vatPrice=store.membership===\"All-Free\"?0:Math.round(integratedPrice*.1);const text=store.payment===\"paypal\"?`KRW ${Math.max(vatPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(vatPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayDepositPrice(Component){const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;return props=>{const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const depositPrice=store.membership===\"Non-Member\"?3e5:0;const text=store.payment===\"paypal\"?`KRW ${Math.max(depositPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(depositPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayFinalPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store,setStore]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;const priceData=useMemo(()=>{if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const initialPrice=dailyItems.reduce((sum,item)=>sum+item.price,0);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice,primaryDetails,secondaryDetails}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=store.membership===\"All-Free\"?0:Math.max(discountedPrice,0)+additionalPrice;const exchangeMarginPrice=store.payment===\"paypal\"?Math.round(integratedPrice*.05)// 기존 가격의 5%만큼 환전 수수료 적용\n:0;const vatPrice=Math.round(integratedPrice*.1);const depositPrice=store.membership===\"Non-Member\"?3e5:0;const finalPrice=store.membership===\"All-Free\"?0:integratedPrice+exchangeMarginPrice+vatPrice+depositPrice;const text=store.payment===\"paypal\"?`KRW ${Math.max(finalPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(finalPrice,0).toLocaleString(\"ko-KR\")} 원`;return{initialPrice,discountedPrice,additionalPrice,integratedPrice,exchangeMarginPrice,vatPrice,depositPrice,finalPrice,text,primaryDetails,secondaryDetails};},[isStoreReady,categoryLoading,couponLoading,store,categories,coupons,additionalPrice]);useEffect(()=>{if(!priceData)return;setStore(prev=>{const isSame=prev.finalPrice===priceData.finalPrice&&prev.initialPrice===priceData.initialPrice&&prev.discountedPrice===priceData.discountedPrice&&prev.additionalPrice===priceData.additionalPrice&&prev.integratedPrice===priceData.integratedPrice&&prev.exchangeMarginPrice===priceData.exchangeMarginPrice&&prev.vatPrice===priceData.vatPrice&&prev.depositPrice===priceData.depositPrice;if(isSame)return prev;return{...prev,initialPrice:priceData.initialPrice,discountedPrice:priceData.discountedPrice,additionalPrice:priceData.additionalPrice,integratedPrice:priceData.integratedPrice,exchangeMarginPrice:priceData.exchangeMarginPrice,vatPrice:priceData.vatPrice,depositPrice:priceData.depositPrice,finalPrice:priceData.finalPrice,couponPrimaryDetails:priceData.primaryDetails,couponSecondaryDetails:priceData.secondaryDetails};});},[priceData?.initialPrice,priceData?.discountedPrice,priceData?.additionalPrice,priceData?.integratedPrice,priceData?.exchangeMarginPrice,priceData?.vatPrice,priceData?.depositPrice,priceData?.finalPrice]);if(!priceData)return null;// console.log(priceData?.finalPrice)\nreturn /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:priceData.text})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"useHolidayCategoryMap\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useCoupons\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayDiscountedPrice\":{\"type\":\"reactHoc\",\"name\":\"displayDiscountedPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayExchangeMarginPrice\":{\"type\":\"reactHoc\",\"name\":\"displayExchangeMarginPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayInitialPrice\":{\"type\":\"reactHoc\",\"name\":\"displayInitialPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayDiscountBar\":{\"type\":\"reactHoc\",\"name\":\"displayDiscountBar\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayFinalPrice\":{\"type\":\"reactHoc\",\"name\":\"displayFinalPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayIntegratedPrice\":{\"type\":\"reactHoc\",\"name\":\"displayIntegratedPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toCategoryMap\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displaySoftInitialPrice\":{\"type\":\"reactHoc\",\"name\":\"displaySoftInitialPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getAdditionalPrice\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayDepositPrice\":{\"type\":\"reactHoc\",\"name\":\"displayDepositPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayVatPrice\":{\"type\":\"reactHoc\",\"name\":\"displayVatPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","import{jsx as _jsx}from\"react/jsx-runtime\";import{useState}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import*as React from\"react\";import{useStore}from\"https://framerusercontent.com/modules/c2GloFFeVhaMQsbMcdTk/XiJZ0vjlltE7FPQAQ8Lk/MainStore.js\";import{parseDate}from\"https://framerusercontent.com/modules/1J9pgwrYtYGWgtmRStO4/muZZYJxbZe3foLJMfVTS/DateUtils.js\";import{toCategoryMap}from\"https://framerusercontent.com/modules/t32tReeHmrCTzbf5rVbb/ihBLS6K1p7JMVKDqGKPI/PriceDisplay.js\";// ✅ 추가: 계산/필터 함수 import (PriceDisplay와 동일 파이프라인 사용)\nimport{calculateInitialPrices,filterCoupons,evaluateCoupons}from\"https://framerusercontent.com/modules/jTRIrvvdhM8hGc8tF4E7/Q2QLVylG6dtj4TyzXmqg/EvaluateCoupons.js\";import{useDayCategoryDefinitions}from\"https://framerusercontent.com/modules/pKMQTtBDnyThccjiINTr/R6FlauGV8dPyEKPorKpi/useDayCategoryDefinitions.js\";function getKSTDate(baseDate=new Date){const utc=baseDate.getTime()+baseDate.getTimezoneOffset()*6e4;return new Date(utc+9*60*60*1e3);}function getKSTISOString(date=new Date){const kstDate=getKSTDate(date);const pad=n=>String(n).padStart(2,\"0\");const year=kstDate.getFullYear();const month=pad(kstDate.getMonth()+1);const day=pad(kstDate.getDate());const hours=pad(kstDate.getHours());const minutes=pad(kstDate.getMinutes());const seconds=pad(kstDate.getSeconds());return`${year}-${month}-${day}T${hours}:${minutes}:${seconds}+09:00`;}export const useFormStore=createStore({name:null,birthdate:null,phone:null,email:null,emailDomain:null,nationality:\"domestic\",reserver_number:null,reserver_name:null,reserver_birthdate:null,reserver_phone:null,reserver_email:null,reserver_email_domain:null,isSameReserverStay:false,stay_name:null,stay_birthdate:null,stay_phone:null,couponCode:null,mileage:0,special_requests:null,anniversary_type:\"기념일 종류\",anniversary_name:null,anniversary_value:null,facility_policy:false,cancellation_policy:false,privacy_policy:false,marketing_consent:false,refund_name:null,refund_phone:null,refund_bank:null,refund_account:null});export function toggleName(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({name:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleBirthdate(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({birthdate:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function togglePhone(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({phone:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleEmail(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({email:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleNationality(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.nationality===\"domestic\"||mainStore.nationality===\"foreign\";// const shouldAutofill = false\nReact.useEffect(()=>{if(shouldAutofill&&formStore.nationality!==mainStore.nationality){setFormStore({nationality:mainStore.nationality});}},[shouldAutofill,mainStore.nationality]);const handleChange=value=>{setFormStore({nationality:value});};return /*#__PURE__*/_jsx(Component,{...props,disabled:shouldAutofill,selectedValue:shouldAutofill?mainStore.nationality:props.selectedValue,onChange:shouldAutofill?undefined:handleChange,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverNumber(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_number!==mainStore.membership_number){setFormStore({reserver_name:mainStore.membership_number});}},[shouldAutofill,mainStore.name]);const handleChange=event=>{setFormStore({reserver_number:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.membership_number:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverName(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_name!==mainStore.name){setFormStore({reserver_name:mainStore.name});}},[shouldAutofill,mainStore.name]);const handleChange=event=>{setFormStore({reserver_name:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.name:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverBirthdate(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_birthdate!==mainStore.birthdate){setFormStore({reserver_birthdate:mainStore.birthdate});}},[shouldAutofill,mainStore.birthdate]);const handleChange=event=>{setFormStore({reserver_birthdate:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.birthdate:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverPhone(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_phone!==mainStore.phone){setFormStore({reserver_phone:mainStore.phone});}},[shouldAutofill,mainStore.phone]);const handleChange=event=>{setFormStore({reserver_phone:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.phone:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverEmail(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=mainStore.name!==null&&mainStore.birthdate!==null&&mainStore.phone!==null&&mainStore.email!==null;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_email!==mainStore.email){setFormStore({reserver_email:mainStore.email});}},[shouldAutofill,mainStore.email]);const handleChange=event=>{setFormStore({reserver_email:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.email:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function handleEmailDomainDropdown(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const selectedValue=event.target.value;if(selectedValue&&selectedValue!==\"직접 입력\"){setStore({reserver_email_domain:selectedValue});}};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleReserverNameNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_name!==mainStore.name){setFormStore({reserver_name:mainStore.name});}},[shouldAutofill,mainStore.name]);const handleChange=event=>{setFormStore({reserver_name:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.name:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverBirthdateNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_birthdate!==mainStore.birthdate){setFormStore({reserver_birthdate:mainStore.birthdate});}},[shouldAutofill,mainStore.birthdate]);const handleChange=event=>{setFormStore({reserver_birthdate:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.birthdate:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverPhoneNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_phone!==mainStore.phone){setFormStore({reserver_phone:mainStore.phone});}},[shouldAutofill,mainStore.phone]);const handleChange=event=>{setFormStore({reserver_phone:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.phone:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleReserverEmailNonmember(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[mainStore]=useStore();const shouldAutofill=false;React.useEffect(()=>{if(shouldAutofill&&formStore.reserver_email!==mainStore.email){setFormStore({reserver_email:mainStore.email});}},[shouldAutofill,mainStore.email]);const handleChange=event=>{setFormStore({reserver_email:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?mainStore.email:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleSameReserverStay(Component){return props=>{const[store,setStore]=useFormStore();const toggle=()=>{setStore({isSameReserverStay:!store.isSameReserverStay});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function toggleStayName(Component){return props=>{const[store]=useStore();const[formStore,setFormStore]=useFormStore();const shouldAutofill=formStore.isSameReserverStay;const autofillValue=formStore.reserver_name??\"\";React.useEffect(()=>{if(shouldAutofill&&formStore.stay_name!==autofillValue){setFormStore({stay_name:autofillValue});}},[shouldAutofill,autofillValue]);const handleChange=event=>{setFormStore({stay_name:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?autofillValue:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleStayBirthdate(Component){return props=>{const[store]=useStore();const[formStore,setFormStore]=useFormStore();const shouldAutofill=formStore.isSameReserverStay;const autofillValue=formStore.reserver_birthdate??\"\";React.useEffect(()=>{if(shouldAutofill&&formStore.stay_birthdate!==autofillValue){setFormStore({stay_birthdate:autofillValue});}},[shouldAutofill,autofillValue]);const handleChange=event=>{setFormStore({stay_birthdate:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?autofillValue:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleStayPhone(Component){return props=>{const[store]=useStore();const[formStore,setFormStore]=useFormStore();const shouldAutofill=formStore.isSameReserverStay;const autofillValue=formStore.reserver_phone??\"\";React.useEffect(()=>{if(shouldAutofill&&formStore.stay_phone!==autofillValue){setFormStore({stay_phone:autofillValue});}},[shouldAutofill,autofillValue]);const handleChange=event=>{setFormStore({stay_phone:event.target.value});};return /*#__PURE__*/_jsx(Component,{...props,onChange:shouldAutofill?undefined:handleChange,value:shouldAutofill?autofillValue:undefined,mode:shouldAutofill?\"autofill\":\"default\"});};}export function toggleCouponCode(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({couponCode:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function applyCouponCode(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[store,setStore]=useStore();const handleClick=async()=>{const code=formStore.couponCode?.trim();if(!code){alert(\"쿠폰 번호를 입력해주세요.\");return;}// if (store.expiredCoupons.includes(code)) {\n//     alert(\"한번 사용한 쿠폰은 재사용할 수 없습니다.\")\n//     return\n// }\nif(store.enteredCouponCode.includes(code)){alert(\"이미 적용된 쿠폰입니다.\");return;}try{// 쿠폰 데이터 가져오기\nconst[defRes,instRes]=await Promise.all([fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-definitions\"),fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-instances\")]);const definitions=await defRes.json();const instances=await instRes.json();// code 타입 정의만 필터링\nconst codeDefs=definitions.filter(def=>def.type===\"code\");// 인스턴스 + 정의 병합\nconst mergedCoupons=instances.filter(inst=>inst.coupon_code===code).map(inst=>{const def=codeDefs.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return def?{...def,...inst}:null;}).filter(Boolean);if(mergedCoupons.length===0){alert(\"쿠폰이 존재하지 않거나 쿠폰번호가 잘못되었습니다.\");return;}const[found]=mergedCoupons;// 상태 체크\nif(found.status!==\"available\"){alert(\"이 쿠폰은 현재 사용이 불가능합니다.\");return;}// 유효기간 체크\nif(found.coupon_due){const now=new Date;const due=new Date(found.coupon_due);if(isNaN(due.getTime())||now>due){alert(\"이 쿠폰의 유효기간이 지났습니다.\");return;}}// 적용 확인\nconst isConfirmed=window.confirm(`쿠폰 ${code}을 적용합니다.`);if(isConfirmed){setStore({enteredCouponCode:[...store.enteredCouponCode,code]});}}catch(error){console.error(\"쿠폰 확인 중 오류 발생:\",error);alert(\"쿠폰 확인 중 오류가 발생했습니다. 다시 시도해주세요.\");}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}// -----------------------------------------\nexport function checkRevisitAndCouponCode(Component){return props=>{const[formStore]=useFormStore();const[store,setStore]=useStore();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const handleClick=async()=>{const code=formStore.couponCode?.trim();if(!code){alert(\"쿠폰 번호를 입력해주세요.\");return;}try{// revisit 계산 (체크아웃 기준)\nconst ordersRes=await fetch(\"https://terene-db-server.onrender.com/api/v2/orders\");const orders=await ordersRes.json();const normalize=str=>str?.replace(/[\\s\\-./]/g,\"\").toLowerCase().trim();const revisitCount=orders.filter(order=>{return order.stay_status===\"checked_out\"&&normalize(order.reserver_name)===normalize(formStore.reserver_name)&&normalize(order.reserver_birthdate)===normalize(formStore.reserver_birthdate)&&normalize(order.reserver_contact)===normalize(formStore.reserver_phone);}).length;setStore({revisit:String(revisitCount)});if(store.enteredCouponCode?.includes(code)){alert(\"이미 적용된 쿠폰입니다.\");return;}// 쿠폰 정의/인스턴스 가져오기\nconst[defRes,instRes]=await Promise.all([fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-definitions\"),fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-instances\")]);const definitions=await defRes.json();const instances=await instRes.json();const codeDefs=definitions.filter(def=>def.type===\"code\");const mergedCoupons=instances.filter(inst=>inst.coupon_code===code).map(inst=>{const def=codeDefs.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return def?{...def,...inst}:null;}).filter(Boolean);if(mergedCoupons.length===0){alert(\"쿠폰이 존재하지 않거나 쿠폰번호가 잘못되었습니다.\");return;}const[found]=mergedCoupons;// 🔁 중복 제한(요구사항 반영): exclusive ↔ 모든 code형 쿠폰 상호배타\nconst appliedCodeCoupons=(store.enteredCouponCode??[]).map(appliedCode=>{const inst=instances.find(i=>i.coupon_code===appliedCode);if(!inst)return null;const def=definitions.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return def?{...def,...inst}:null;}).filter(c=>c&&c.type===\"code\");const hasAppliedExclusiveCode=appliedCodeCoupons.some(c=>c.exclusive===true);if(found.exclusive){// 이미 어떤 code형 쿠폰이라도 적용돼 있으면 exclusive는 불가\nif(appliedCodeCoupons.length>0){const conflict=appliedCodeCoupons[0];alert(`해당 쿠폰은 단독형 쿠폰으로, 기존 쿠폰(${conflict.description})과 함께 사용할 수 없습니다.`);return;}}else{// exclusive가 한 번이라도 적용돼 있으면 모든 code형 쿠폰 추가 불가\nif(hasAppliedExclusiveCode){const conflict=appliedCodeCoupons.find(c=>c.exclusive===true);alert(`이미 단독형 쿠폰(${conflict.description})이 적용되어 있어 다른 쿠폰을 사용할 수 없습니다.`);return;}}// 수취인/멤버십 일치 검증\nconst n=v=>String(v??\"\").replace(/[\\s\\-./]/g,\"\").toLowerCase().trim();const mismatch=(a,b)=>n(a)!==n(b);const hasMembership=found.membership_number!=null&&n(found.membership_number)!==\"\";const membershipMismatch=mismatch(found.membership_number,store.membership_number);const infoMismatch=mismatch(found.receiver_info?.name,formStore.reserver_name)||mismatch(found.receiver_info?.birthdate,formStore.reserver_birthdate)||mismatch(found.receiver_info?.contact,formStore.reserver_phone);const isEmptyCoupon=!found.receiver_info?.name&&!found.receiver_info?.birthdate&&!found.receiver_info?.contact&&!hasMembership;const shouldAlert=hasMembership?membershipMismatch:infoMismatch;if(!isEmptyCoupon&&shouldAlert){alert(\"쿠폰이 존재하지 않거나 쿠폰번호가 잘못되었습니다.\");return;}if(found.status!==\"available\"){alert(\"이 쿠폰은 현재 사용이 불가능합니다.\");return;}if(found.coupon_due){const now=new Date;const due=new Date(found.coupon_due);if(isNaN(due.getTime())||now>due){alert(\"이 쿠폰의 유효기간이 지났습니다.\");return;}}// ----------------------------\n// 날짜 준비/검증\n// ----------------------------\nconst queryParams=new URLSearchParams(window.location.search);const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDateFromQuery=first?parseDate(first):null;const secondDateFromQuery=second?parseDate(second):null;const firstDateObj=store.firstDate??firstDateFromQuery;const secondDateObj=store.secondDate??secondDateFromQuery;if(!firstDateObj||!secondDateObj){alert(\"체크인/체크아웃 날짜를 먼저 선택한 뒤 쿠폰을 적용해주세요.\");return;}// ----------------------------\n// 카테고리 맵 로드\n// ----------------------------\nlet categoryMap={};try{const holidayRes=await fetch(\"https://terene-db-server.onrender.com/api/v3/days\");const days=await holidayRes.json();const rawMap={};for(const item of days){rawMap[item.date]=item.category;}categoryMap=toCategoryMap(rawMap);}catch(err){console.error(\"❌ Category map load failed:\",err);categoryMap={};}console.log(\"firstDateObj\",firstDateObj);console.log(\"secondDateObj\",secondDateObj);// ----------------------------\n// 일자별 가격 계산 (명시적 날짜 전달)\n// ----------------------------\nconst{dailyItems}=calculateInitialPrices({...store},categoryMap,categoryDefs,firstDateObj,secondDateObj);// 글로벌 + 현재 코드만 구성\nconst globalDefs=definitions.filter(def=>def.type===\"global\");const couponsForCheck=[...globalDefs,found];// 가상 store: enteredCouponCode에 현재 코드 포함\nconst simulatedStore={...store,enteredCouponCode:[...store.enteredCouponCode??[],code]};// 필터 통과 여부\nconst{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(couponsForCheck,simulatedStore,dailyItems);// const codes = couponsForCheck\n//     .filter((c) => c.coupon_code && c.coupon_code[0] == \"H\") // coupon_code 필드가 존재하는 쿠폰만\n//     .map((c) => c.coupon_code as string) // 문자열로 추출\n// alert(\n//     `B-1) check: ${JSON.stringify(codes)}\\npassedSecondary: ${JSON.stringify(passedSecondaryCoupons)}`\n// )\nconst targetId=found.coupon_instance_id||found.coupon_definition_id;const included=passedSecondaryCoupons.some(c=>(c.coupon_instance_id||c.coupon_definition_id)===targetId);if(!included){// 🔸 필터에서 제외된 경우\nalert(`사용할 수 없는 쿠폰 조건입니다.`);return;}// 실제 할인액 계산\nconst{secondaryDetails}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,simulatedStore);const detail=secondaryDetails.find(d=>d.id===targetId);const appliedAmount=detail?.amount??0;if(!detail||appliedAmount<=0){// 🔸 필터는 통과했지만, 적용 가능한 결제 금액(잔액/상한)을 초과해 0원 처리된 경우\nalert(\"결제 할인 금액을 초과하여 쿠폰을 사용할 수 없습니다.\");return;}// 최종 적용\nconst isConfirmed=window.confirm(`쿠폰 ${code}을 적용합니다.`);if(isConfirmed){setStore({enteredCouponCode:[...store.enteredCouponCode??[],code]});}}catch(error){console.error(\"쿠폰 확인 중 오류 발생:\",error);alert(\"쿠폰 확인 중 오류가 발생했습니다. 다시 시도해주세요.\");}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}export async function fetchTotalMileage(membershipNumber){try{const res=await fetch(\"https://terene-db-server.onrender.com/api/v2/mileages\");if(!res.ok)throw new Error(\"Failed to fetch mileage data\");const data=await res.json();const userMileage=data.filter(m=>m.membership_number===membershipNumber);const totalAmount=userMileage.reduce((sum,entry)=>sum+Number(entry.mileage_amount||0),0);return totalAmount;}catch(error){console.error(\"마일리지 조회 실패:\",error);return 0;}}export function toggleMileage(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({mileage:Number(inputValue)});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleSpecialRequests(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({special_requests:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function handleAnniversaryDropdown(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const selectedValue=event.target.value;if(selectedValue!==\"기념일 종류\"){setStore({anniversary_type:selectedValue});}};return /*#__PURE__*/_jsx(Component,{...props,value:store.anniversary_type,onChange:handleChange});};}export function toggleAnniversaryName(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({anniversary_name:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleAnniversaryValue(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({anniversary_value:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}// ----- 토스 결제 / Paypal 결제 분기점 -----\nexport function toggleTossPayment(Component){return props=>{const[store,setStore]=useStore();const[formStore,setformStore]=useFormStore();const[payment,setPayment]=useState(formStore.payment);const toggle=()=>{setStore({payment:\"toss\"});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function togglePaypalPayment(Component){return props=>{const[store,setStore]=useStore();const[formStore,setformStore]=useFormStore();const[payment,setPayment]=useState(formStore.payment);const toggle=()=>{setStore({payment:\"paypal\"});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function toggleForeignCardPayment(Component){return props=>{const[store,setStore]=useStore();const[formStore,setformStore]=useFormStore();const[payment,setPayment]=useState(formStore.payment);const toggle=()=>{setStore({payment:\"foreignCard\"});};return /*#__PURE__*/_jsx(Component,{...props,onClick:toggle});};}export function toggleRefundName(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({refund_name:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleRefundPhone(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({refund_phone:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function handleRefundBank(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const selectedValue=event.target.value;if(selectedValue!==\"은행명\"){setStore({refund_bank:selectedValue});}};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function toggleRefundAccount(Component){return props=>{const[store,setStore]=useFormStore();const handleChange=event=>{const inputValue=event.target.value;setStore({refund_account:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}export function getAvailableMileage(Component){return props=>{const[store]=useStore();return /*#__PURE__*/_jsx(Component,{...props,text:`사용 가능 ${(store.totalMileage-store.usedMileage).toLocaleString()}p`});};}export function getTotalMileage(Component){return props=>{const[store,setStore]=useStore();React.useEffect(()=>{const fetchMileages=async()=>{if(!store.membership_number)return;try{const res=await fetch(\"https://terene-db-server.onrender.com/api/v2/mileages\");if(!res.ok)throw new Error(\"마일리지 조회 실패\");const data=await res.json();const sum=data.filter(m=>m.membership_number===store.membership_number).reduce((acc,m)=>acc+Number(m.mileage_amount||0),0);setStore({totalMileage:sum});}catch(e){console.error(\"마일리지 불러오기 실패:\",e);setStore({totalMileage:0});}};fetchMileages();},[store.membership_number]);return /*#__PURE__*/_jsx(Component,{...props,text:`보유 ${store.totalMileage.toLocaleString()}p`});};}export function applyMileage(Component){return props=>{const[formStore,setFormStore]=useFormStore();const[store,setStore]=useStore();const handleClick=async()=>{if(!formStore.mileage){alert(`마일리지를 입력해주세요.`);return;}if(!Number.isInteger(formStore.mileage)||formStore.mileage<=0){alert(\"마일리지는 1 이상의 자연수로만 입력해주세요.\");return;}// if (!store.membership_number) {\n//     alert(\"멤버십 로그인이 필요합니다.\")\n//     return\n// }\n// const totalMileage = await fetchTotalMileage(\n//     store.membership_number\n// )\nconst availableMileage=store.totalMileage-store.usedMileage;if(formStore.mileage>availableMileage||availableMileage<=0){alert(`마일리지 수 부족: ${availableMileage.toLocaleString()}p`);return;}if(formStore.mileage>store.integratedPrice){alert(`최대 적용 가능한 마일리지 수를 초과하였습니다.\n현재 최대 적용 가능한 마일리지 수: ${store.integratedPrice.toLocaleString()}p`);return;}if(store.usedMileage==0){const isConfirmed=window.confirm(`마일리지 ${formStore.mileage.toLocaleString()}p를 적용합니다.`);if(isConfirmed){setStore({usedMileage:(store.usedMileage||0)+formStore.mileage});}}else{const isConfirmed=window.confirm(`마일리지 ${formStore.mileage.toLocaleString()}p를 추가로 적용합니다.`);if(isConfirmed){setStore({usedMileage:(store.usedMileage||0)+formStore.mileage});}}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}export function hidePaypalInfo(Component){return props=>{const[store,setStore]=useStore();if(store.payment!==\"paypal\")return null;return /*#__PURE__*/_jsx(Component,{...props});};}\nexport const __FramerMetadata__ = {\"exports\":{\"toggleTossPayment\":{\"type\":\"reactHoc\",\"name\":\"toggleTossPayment\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleRefundName\":{\"type\":\"reactHoc\",\"name\":\"toggleRefundName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverPhone\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverPhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleRefundPhone\":{\"type\":\"reactHoc\",\"name\":\"toggleRefundPhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverName\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleEmail\":{\"type\":\"reactHoc\",\"name\":\"toggleEmail\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"togglePaypalPayment\":{\"type\":\"reactHoc\",\"name\":\"togglePaypalPayment\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleForeignCardPayment\":{\"type\":\"reactHoc\",\"name\":\"toggleForeignCardPayment\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getAvailableMileage\":{\"type\":\"reactHoc\",\"name\":\"getAvailableMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"applyMileage\":{\"type\":\"reactHoc\",\"name\":\"applyMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleStayBirthdate\":{\"type\":\"reactHoc\",\"name\":\"toggleStayBirthdate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverPhoneNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverPhoneNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleAnniversaryName\":{\"type\":\"reactHoc\",\"name\":\"toggleAnniversaryName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"handleRefundBank\":{\"type\":\"reactHoc\",\"name\":\"handleRefundBank\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverBirthdateNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverBirthdateNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleBirthdate\":{\"type\":\"reactHoc\",\"name\":\"toggleBirthdate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleSpecialRequests\":{\"type\":\"reactHoc\",\"name\":\"toggleSpecialRequests\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"handleEmailDomainDropdown\":{\"type\":\"reactHoc\",\"name\":\"handleEmailDomainDropdown\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverEmailNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverEmailNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleStayName\":{\"type\":\"reactHoc\",\"name\":\"toggleStayName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverNameNonmember\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverNameNonmember\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleMileage\":{\"type\":\"reactHoc\",\"name\":\"toggleMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleCouponCode\":{\"type\":\"reactHoc\",\"name\":\"toggleCouponCode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"fetchTotalMileage\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleStayPhone\":{\"type\":\"reactHoc\",\"name\":\"toggleStayPhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"applyCouponCode\":{\"type\":\"reactHoc\",\"name\":\"applyCouponCode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleNationality\":{\"type\":\"reactHoc\",\"name\":\"toggleNationality\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverBirthdate\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverBirthdate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"hidePaypalInfo\":{\"type\":\"reactHoc\",\"name\":\"hidePaypalInfo\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleName\":{\"type\":\"reactHoc\",\"name\":\"toggleName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleSameReserverStay\":{\"type\":\"reactHoc\",\"name\":\"toggleSameReserverStay\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"checkRevisitAndCouponCode\":{\"type\":\"reactHoc\",\"name\":\"checkRevisitAndCouponCode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleAnniversaryValue\":{\"type\":\"reactHoc\",\"name\":\"toggleAnniversaryValue\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getTotalMileage\":{\"type\":\"reactHoc\",\"name\":\"getTotalMileage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverEmail\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverEmail\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleReserverNumber\":{\"type\":\"reactHoc\",\"name\":\"toggleReserverNumber\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useFormStore\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"togglePhone\":{\"type\":\"reactHoc\",\"name\":\"togglePhone\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"handleAnniversaryDropdown\":{\"type\":\"reactHoc\",\"name\":\"handleAnniversaryDropdown\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleRefundAccount\":{\"type\":\"reactHoc\",\"name\":\"toggleRefundAccount\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ReservationForm.map","// PriceDisplay.tsx\nimport{jsx as _jsx}from\"react/jsx-runtime\";import React,{useEffect,useMemo}from\"react\";import{useStore}from\"https://framerusercontent.com/modules/c2GloFFeVhaMQsbMcdTk/XiJZ0vjlltE7FPQAQ8Lk/MainStore.js\";import{useFormStore}from\"https://framerusercontent.com/modules/j1JmQpFlkCqsnz6Zbn4l/kgR4ltfA7bgAS5uFS2LP/ReservationForm.js\";import{calculateInitialPrices,filterCoupons,evaluateCoupons}from\"https://framerusercontent.com/modules/jTRIrvvdhM8hGc8tF4E7/Q2QLVylG6dtj4TyzXmqg/EvaluateCoupons.js\";import{useAdditionalServiceStore,createAdditionalServiceList}from\"https://framerusercontent.com/modules/k847LPNIMdkhfIs0ouwF/EUEOlsedw6DGLY16dhfq/AdditionalService.js\";import{parseDate}from\"https://framerusercontent.com/modules/1J9pgwrYtYGWgtmRStO4/muZZYJxbZe3foLJMfVTS/DateUtils.js\";import{motion}from\"framer-motion\";import{useDayCategoryDefinitions}from\"https://framerusercontent.com/modules/pKMQTtBDnyThccjiINTr/R6FlauGV8dPyEKPorKpi/useDayCategoryDefinitions.js\";const FadeIn=({children})=>/*#__PURE__*/_jsx(motion.div,{initial:{opacity:0,y:0},animate:{opacity:1,y:0},exit:{opacity:0,y:0},transition:{duration:.4,ease:\"easeOut\"},children:children});// 공휴일 카테고리 가져오기 (v3 구조 대응)\nexport function useHolidayCategoryMap(){const[categories,setCategories]=React.useState({});const[isLoading,setIsLoading]=React.useState(true);React.useEffect(()=>{fetch(\"https://terene-db-server.onrender.com/api/v3/days\").then(res=>res.json()).then(data=>{const map={};for(const item of data){// ✅ days_250928 구조 반영\n// item = { date, category, is_holiday, location, checkin_occupied, ... }\nmap[item.date]=item.category;}setCategories(map);}).catch(err=>console.error(\"Holiday fetch error\",err)).finally(()=>setIsLoading(false));},[]);return{categories,isLoading};}// ✅ 문자열 → 카테고리 매핑\nexport function toCategoryMap(input){return input;}export function useCoupons(){const[coupons,setCoupons]=React.useState([]);const[isLoading,setIsLoading]=React.useState(true);React.useEffect(()=>{async function fetchCoupons(){try{// Fetch definitions first\nconst defRes=await fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-definitions\");const definitions=await defRes.json();// Separate global and code types (ignore membership)\nconst globalDefs=definitions.filter(def=>def.type===\"global\");const codeDefs=definitions.filter(def=>def.type===\"code\");// Fetch instances only if there are code definitions\nlet codeInstances=[];if(codeDefs.length>0){const instRes=await fetch(\"https://terene-db-server.onrender.com/api/v2/coupon-instances\");const instances=await instRes.json();codeInstances=instances.filter(inst=>codeDefs.some(def=>def.coupon_definition_id===inst.coupon_definition_id));}// Merge code definitions and their instances\nconst codeCoupons=codeInstances.map(inst=>{const def=codeDefs.find(d=>d.coupon_definition_id===inst.coupon_definition_id);return{...def,...inst};});// Combine global and code coupons\nconst combined=[...globalDefs,...codeCoupons];// Sort by optional priority if present\nconst sorted=combined.sort((a,b)=>(a.priority||0)-(b.priority||0));setCoupons(sorted);}catch(err){console.error(\"Coupon fetch error:\",err);}finally{setIsLoading(false);}}fetchCoupons();},[]);return{coupons,isLoading};}function useDiscountCalculation(){const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isReady=store.firstDate&&store.secondDate||firstDate&&secondDate;const result=useMemo(()=>{if(!isReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice,dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);return{initialPrice,discountedPrice};},[store,categories,coupons,firstDate,secondDate,categoryLoading,couponLoading]);return{isLoading:!isReady||categoryLoading||couponLoading,data:result};}export function displayInitialPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();// console.log(\"### COUPONS ###\")\n// console.log(JSON.stringify(coupons))\nconst{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const text=store.payment===\"paypal\"?`KRW ${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")} 원`;return(// <FadeIn>\n/*#__PURE__*/_jsx(Component,{...props,text:text}));};}export function displayDiscountedPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const text=store.payment===\"paypal\"?`KRW ${Math.max(discountedPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(discountedPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}function transitionStyle(visible){return{opacity:visible?1:0,color:\"inherit\",transition:\"opacity 0.3s ease-in-out\",display:\"inline-block\"};}export function displayDiscountBar(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice,dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const show=initialPrice!==Math.max(discountedPrice,0);const baseStyle=transitionStyle(show);const width=initialPrice>=1e8?144:initialPrice>=1e7?128:112;const barStyle={...baseStyle,width,position:\"relative\",right:0,transform:`translateX(${92-width}px)`};// <Component {...props} style={barStyle} />\nreturn /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,style:baseStyle})});};}export function displaySoftInitialPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{initialPrice}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const text=store.payment===\"paypal\"?`KRW ${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(initialPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function getAdditionalPrice(){const[store]=useStore();const[additionalServiceStore]=useAdditionalServiceStore();const additionalServiceList=createAdditionalServiceList(additionalServiceStore,store);const totalAmount=additionalServiceList.reduce((sum,service)=>{return sum+service.amount;},0);return totalAmount;}export function displayIntegratedPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=store.membership===\"All-Free\"?0:Math.max(discountedPrice,0)+additionalPrice;const text=store.payment===\"paypal\"?`KRW ${Math.max(integratedPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(integratedPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayExchangeMarginPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=Math.max(discountedPrice,0)+additionalPrice;const exchangeMarginPrice=store.membership===\"All-Free\"||store.payment!==\"paypal\"?0:Math.round(integratedPrice*.05)// 기존 가격의 5%만큼 환전 수수료 적용\n;const text=store.payment===\"paypal\"?`KRW ${Math.max(exchangeMarginPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(exchangeMarginPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayVatPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=Math.max(discountedPrice,0)+additionalPrice;const vatPrice=store.membership===\"All-Free\"?0:Math.round(integratedPrice*.1);const text=store.payment===\"paypal\"?`KRW ${Math.max(vatPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(vatPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayDepositPrice(Component){const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;return props=>{const[store]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const depositPrice=store.membership===\"Non-Member\"?3e5:0;const text=store.payment===\"paypal\"?`KRW ${Math.max(depositPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(depositPrice,0).toLocaleString(\"ko-KR\")} 원`;return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:text})});};}export function displayFinalPrice(Component){return props=>{const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store,setStore]=useStore();const[formStore]=useFormStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const additionalPrice=getAdditionalPrice();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;const priceData=useMemo(()=>{if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return null;const categoryMap=toCategoryMap(categories);const{dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const initialPrice=dailyItems.reduce((sum,item)=>sum+item.price,0);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{secondaryDiscountedPrice:discountedPrice,primaryDetails,secondaryDetails}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const integratedPrice=store.membership===\"All-Free\"?0:Math.max(discountedPrice,0)+additionalPrice;const exchangeMarginPrice=store.payment===\"paypal\"?Math.round(integratedPrice*.05)// 기존 가격의 5%만큼 환전 수수료 적용\n:0;const vatPrice=Math.round(integratedPrice*.1);const depositPrice=store.membership===\"Non-Member\"?3e5:0;const finalPrice=store.membership===\"All-Free\"?0:integratedPrice+exchangeMarginPrice+vatPrice+depositPrice;const text=store.payment===\"paypal\"?`KRW ${Math.max(finalPrice,0).toLocaleString(\"ko-KR\")}`:`${Math.max(finalPrice,0).toLocaleString(\"ko-KR\")} 원`;return{initialPrice,discountedPrice,additionalPrice,integratedPrice,exchangeMarginPrice,vatPrice,depositPrice,finalPrice,text,primaryDetails,secondaryDetails};},[isStoreReady,categoryLoading,couponLoading,store,categories,coupons,additionalPrice]);useEffect(()=>{if(!priceData)return;setStore(prev=>{const isSame=prev.finalPrice===priceData.finalPrice&&prev.initialPrice===priceData.initialPrice&&prev.discountedPrice===priceData.discountedPrice&&prev.additionalPrice===priceData.additionalPrice&&prev.integratedPrice===priceData.integratedPrice&&prev.exchangeMarginPrice===priceData.exchangeMarginPrice&&prev.vatPrice===priceData.vatPrice&&prev.depositPrice===priceData.depositPrice;if(isSame)return prev;return{...prev,initialPrice:priceData.initialPrice,discountedPrice:priceData.discountedPrice,additionalPrice:priceData.additionalPrice,integratedPrice:priceData.integratedPrice,exchangeMarginPrice:priceData.exchangeMarginPrice,vatPrice:priceData.vatPrice,depositPrice:priceData.depositPrice,finalPrice:priceData.finalPrice,couponPrimaryDetails:priceData.primaryDetails,couponSecondaryDetails:priceData.secondaryDetails};});},[priceData?.initialPrice,priceData?.discountedPrice,priceData?.additionalPrice,priceData?.integratedPrice,priceData?.exchangeMarginPrice,priceData?.vatPrice,priceData?.depositPrice,priceData?.finalPrice]);if(!priceData)return null;// console.log(priceData?.finalPrice)\nreturn /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsx(Component,{...props,text:priceData.text})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"useHolidayCategoryMap\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useCoupons\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayDiscountedPrice\":{\"type\":\"reactHoc\",\"name\":\"displayDiscountedPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayExchangeMarginPrice\":{\"type\":\"reactHoc\",\"name\":\"displayExchangeMarginPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayInitialPrice\":{\"type\":\"reactHoc\",\"name\":\"displayInitialPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayDiscountBar\":{\"type\":\"reactHoc\",\"name\":\"displayDiscountBar\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayFinalPrice\":{\"type\":\"reactHoc\",\"name\":\"displayFinalPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayIntegratedPrice\":{\"type\":\"reactHoc\",\"name\":\"displayIntegratedPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toCategoryMap\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displaySoftInitialPrice\":{\"type\":\"reactHoc\",\"name\":\"displaySoftInitialPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getAdditionalPrice\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayDepositPrice\":{\"type\":\"reactHoc\",\"name\":\"displayDepositPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayVatPrice\":{\"type\":\"reactHoc\",\"name\":\"displayVatPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","// ReceiptLabelComponent.tsx\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useStore}from\"https://framerusercontent.com/modules/c2GloFFeVhaMQsbMcdTk/XiJZ0vjlltE7FPQAQ8Lk/MainStore.js\";import{useHolidayCategoryMap,useCoupons,toCategoryMap}from\"https://framerusercontent.com/modules/t32tReeHmrCTzbf5rVbb/vpRaQ9eP11jyrHeciRqe/PriceDisplay.js\";import{calculateInitialPrices,filterCoupons,evaluateCoupons}from\"https://framerusercontent.com/modules/jTRIrvvdhM8hGc8tF4E7/Q2QLVylG6dtj4TyzXmqg/EvaluateCoupons.js\";import{useAdditionalServiceStore,createAdditionalServiceList}from\"https://framerusercontent.com/modules/k847LPNIMdkhfIs0ouwF/EUEOlsedw6DGLY16dhfq/AdditionalService.js\";import{parseDate}from\"https://framerusercontent.com/modules/1J9pgwrYtYGWgtmRStO4/muZZYJxbZe3foLJMfVTS/DateUtils.js\";import{motion}from\"framer-motion\";import{useDayCategoryDefinitions}from\"https://framerusercontent.com/modules/pKMQTtBDnyThccjiINTr/R6FlauGV8dPyEKPorKpi/useDayCategoryDefinitions.js\";const FadeIn=({children})=>/*#__PURE__*/_jsx(motion.div,{initial:{opacity:0,y:0},animate:{opacity:1,y:0},exit:{opacity:0,y:0},transition:{duration:.4,ease:\"easeOut\"},children:children});export function ReceiptLabelComponent({variant}){const queryParams=typeof window!==\"undefined\"?new URLSearchParams(window.location.search):new URLSearchParams(\"\");const first=queryParams.get(\"first\");const second=queryParams.get(\"second\");const firstDate=first?parseDate(first):null;const secondDate=second?parseDate(second):null;const[store]=useStore();const[additionalServiceStore]=useAdditionalServiceStore();const{categories,isLoading:categoryLoading}=useHolidayCategoryMap();const{coupons,isLoading:couponLoading}=useCoupons();const{categoryDefs,isLoading:categoryDefLoading}=useDayCategoryDefinitions();const isStoreReady=store.firstDate&&store.secondDate||firstDate&&secondDate;// v2 + Mobile 포함하도록 확장\nconst isPrimary=variant===\"Primary\"||variant===\"PrimaryMobile\";const isSecondary=variant===\"Secondary\"||variant===\"SecondaryMobile\";const isAdditional=variant.startsWith(\"Additional\");const isReceiptLike=variant.startsWith(\"Receipt\")||variant.startsWith(\"Primary\")||variant.startsWith(\"Secondary\");if(!isStoreReady||categoryLoading||couponLoading||categoryDefLoading)return /*#__PURE__*/_jsxs(\"div\",{style:getRowStyle(variant),children:[/*#__PURE__*/_jsx(\"div\",{style:{...getMainLabelStyle(variant),display:\"flex\",justifyContent:\"space-between\",width:\"100%\"},children:/*#__PURE__*/_jsx(\"span\",{children:isPrimary?\"객실요금\":isSecondary?\"특별할인\":isReceiptLike?\"할인요금\":isAdditional?\"추가 서비스 이용료\":\"기본할인\"})}),/*#__PURE__*/_jsx(\"div\",{style:couponContainerStyle(variant),children:/*#__PURE__*/_jsx(\"div\",{style:getLineStyle(variant)})})]});const categoryMap=toCategoryMap(categories);const{initialPrice,dailyItems}=calculateInitialPrices(store,categoryMap,categoryDefs,firstDate,secondDate);const{passedPrimaryCoupons,passedSecondaryCoupons}=filterCoupons(coupons,store,dailyItems);const{primaryDiscountedPrice,primaryDetails,secondaryDetails}=evaluateCoupons(passedPrimaryCoupons,passedSecondaryCoupons,dailyItems,store);const additionalServiceList=createAdditionalServiceList(additionalServiceStore,store);const couponDetailsToRender=isPrimary?primaryDetails:isSecondary?secondaryDetails:[];// ▼ 새로 추가: 헤더 우측에 표시할 합계들\nconst secondaryTotal=secondaryDetails?.reduce((sum,item)=>sum+(item?.amount||0),0);const additionalTotal=additionalServiceList?.reduce((sum,item)=>sum+(item?.amount||0),0);return /*#__PURE__*/_jsx(FadeIn,{children:/*#__PURE__*/_jsxs(\"div\",{style:getRowStyle(variant),children:[/*#__PURE__*/_jsxs(\"div\",{style:{...getMainLabelStyle(variant),display:\"flex\",justifyContent:\"space-between\",width:\"100%\"},children:[/*#__PURE__*/_jsx(\"span\",{children:isPrimary?\"객실요금\":isSecondary?\"특별할인\":isReceiptLike?\"할인요금\":isAdditional?\"추가 서비스 이용료\":\"기본할인\"}),isPrimary&&/*#__PURE__*/_jsx(\"span\",{style:getRightPriceStyle(variant,true),children:store.payment===\"paypal\"?`KRW ${primaryDiscountedPrice.toLocaleString(\"ko-KR\")}`:`${primaryDiscountedPrice.toLocaleString(\"ko-KR\")} 원`}),isSecondary&&/*#__PURE__*/_jsx(\"span\",{style:getRightPriceStyle(variant,true),children:store.payment===\"paypal\"?`-KRW ${secondaryTotal.toLocaleString(\"ko-KR\")}`:`-${secondaryTotal.toLocaleString(\"ko-KR\")} 원`}),isAdditional&&/*#__PURE__*/_jsx(\"span\",{style:getRightPriceStyle(variant,true),children:store.payment===\"paypal\"?`+KRW ${additionalTotal.toLocaleString(\"ko-KR\")}`:`+${additionalTotal.toLocaleString(\"ko-KR\")} 원`})]}),isPrimary&&/*#__PURE__*/_jsx(\"div\",{style:getLineStyle(variant),children:/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",justifyContent:\"space-between\",width:\"100%\"},children:[/*#__PURE__*/_jsx(\"span\",{style:getLeftDescriptionStyle(variant),children:\"기본요금\"}),/*#__PURE__*/_jsx(\"span\",{style:getRightPriceStyle(variant,false),children:store.payment===\"paypal\"?`KRW ${initialPrice.toLocaleString(\"ko-KR\")}`:`${initialPrice.toLocaleString(\"ko-KR\")} 원`})]})}),/*#__PURE__*/_jsx(\"div\",{style:couponContainerStyle(variant),children:isAdditional?additionalServiceList.filter(({amount})=>amount>0).map(({type,amount})=>/*#__PURE__*/_jsx(\"div\",{style:getLineStyle(variant),children:/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",justifyContent:\"space-between\",width:\"100%\"},children:[/*#__PURE__*/_jsx(\"span\",{style:getLeftDescriptionStyle(variant),children:type}),/*#__PURE__*/_jsx(\"span\",{style:getRightPriceStyle(variant,false),children:store.payment===\"paypal\"?`+KRW ${amount.toLocaleString(\"ko-KR\")}`:`+${amount.toLocaleString(\"ko-KR\")} 원`})]})},type)):couponDetailsToRender.map(({id,name,description,amount})=>{const label=id===\"phase-1\"?`Phase-1 계정 숙박비 전액 할인`:id===\"all-free\"?\"Admin 계정 전액 할인\":description||name||id;return /*#__PURE__*/_jsx(\"div\",{style:getLineStyle(variant),children:/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",justifyContent:\"space-between\",width:\"100%\"},children:[/*#__PURE__*/_jsx(\"span\",{style:getLeftDescriptionStyle(variant),children:label}),isReceiptLike&&/*#__PURE__*/_jsx(\"span\",{style:getRightPriceStyle(variant,false),children:store.payment===\"paypal\"?`-KRW ${amount.toLocaleString(\"ko-KR\")}`:`-${amount.toLocaleString(\"ko-KR\")} 원`})]})},id);})})]})});}// ===== 스타일 함수 =====\nfunction getRowStyle(variant){const base={display:\"flex\"};switch(variant){case\"Receipt\":case\"ReceiptMobile\":case\"Additional\":case\"AdditionalMobile\":case\"Primary\":case\"PrimaryMobile\":case\"Secondary\":case\"SecondaryMobile\":return{...base,flexDirection:\"column\",alignItems:\"flex-start\",width:\"100%\",gap:\"15px\"};case\"CalendarMobile\":return{...base,flexDirection:\"row\",alignItems:\"center\",gap:\"14px\"};default:return{...base,flexDirection:\"row\",alignItems:\"flex-start\",gap:\"14px\"};}}function getMainLabelStyle(variant){const base={display:\"flex\",alignItems:\"center\"};switch(variant){case\"Receipt\":case\"Primary\":case\"Secondary\":return{...base,fontFamily:\"Pretendard Regular, sans-serif\",fontSize:\"14px\",height:\"18px\",width:\"100%\",color:\"#000000\"};case\"PrimaryMobile\":case\"SecondaryMobile\":return{...base,fontFamily:\"Pretendard Regular, sans-serif\",fontSize:\"12px\",height:\"18px\",width:\"100%\",color:\"#000000\"};case\"ReceiptMobile\":return{...base,fontFamily:\"Pretendard Regular, sans-serif\",fontSize:\"12px\",height:\"18px\",width:\"100%\",color:\"#000000\"};case\"Additional\":return{...base,fontFamily:\"Pretendard Regular, sans-serif\",fontSize:\"14px\",height:\"18px\",width:\"104px\",color:\"#000000\"};case\"AdditionalMobile\":return{...base,fontFamily:\"Pretendard Regular, sans-serif\",fontSize:\"12px\",height:\"18px\",width:\"89px\",color:\"#000000\"};case\"CalendarMobile\":return{...base,fontFamily:\"Pretendard Light, sans-serif\",fontSize:\"12px\",height:\"20px\",width:\"42px\",color:\"#000000\"};case\"Calendar\":default:return{...base,fontFamily:\"Pretendard Light, sans-serif\",fontSize:\"16px\",height:\"20px\",width:\"56px\",color:\"#000000\"};}}function couponContainerStyle(variant){return{display:\"flex\",flexDirection:\"column\",gap:\"10px\",width:\"100%\",flex:1};}function getLineStyle(variant){const isReceiptOrAdditionalOrV2=variant.startsWith(\"Receipt\")||variant.startsWith(\"Additional\")||variant.startsWith(\"Primary\")||variant.startsWith(\"Secondary\");return{display:\"flex\",alignItems:\"center\",width:\"100%\",...isReceiptOrAdditionalOrV2?{height:\"18px\"}:{}};}function getLeftDescriptionStyle(variant){return{fontFamily:\"Pretendard Light, sans-serif\",fontSize:[\"ReceiptMobile\",\"AdditionalMobile\",\"PrimaryMobile\",\"SecondaryMobile\"].includes(variant)?\"9px\":\"12px\",color:\"#4D4D4D\"};}// 헬퍼: 어떤 variant가 모바일인지 체크\nfunction isMobileVariant(variant){return[\"ReceiptMobile\",\"AdditionalMobile\",\"PrimaryMobile\",\"SecondaryMobile\"].includes(variant);}// 교체 버전\nfunction getRightPriceStyle(variant,emphasized){const mobile=isMobileVariant(variant);return{fontFamily:emphasized?\"Pretendard Regular, sans-serif\":\"Pretendard Light, sans-serif\",fontWeight:300,fontSize:mobile?emphasized?\"12px\":\"9px\":emphasized?\"14px\":\"12px\",color:emphasized?\"#000000\":\"#4D4D4D\",whiteSpace:\"nowrap\"};}addPropertyControls(ReceiptLabelComponent,{variant:{type:ControlType.Enum,title:\"Variant\",options:[\"Calendar\",\"CalendarMobile\",\"Receipt\",\"ReceiptMobile\",\"Additional\",\"AdditionalMobile\",\"Primary\",\"PrimaryMobile\",\"Secondary\",\"SecondaryMobile\"],optionTitles:[\"객실요금\",\"객실요금 Mobile\",\"할인요금\",\"할인요금 Mobile\",\"추가 서비스 이용료\",\"추가 서비스 이용료 Mobile\",\"객실요금_v2\",\"객실요금_v2 Mobile\",\"특별할인_v2\",\"특별할인_v2 Mobile\"],defaultValue:\"Receipt\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"ReceiptLabelComponent\":{\"type\":\"reactComponent\",\"name\":\"ReceiptLabelComponent\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],"mappings":"sbAC4jB,SAAS,EAAe,EAAK,CAAC,IAAM,EAAE,IAAI,KAAK,EAAK,KAAK,EAAK,MAAM,EAAK,IAAI,CAAO,EAAQ,EAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,EA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