{"version":3,"file":"date.DBjQZAVT.mjs","names":[],"sources":["https:/asset.29cm.co.kr/contents/framer/node_modules/date-fns/compareAsc.js","https:/asset.29cm.co.kr/contents/framer/node_modules/date-fns/isWithinInterval.js","https:/asset.29cm.co.kr/contents/framer/utils/date.js"],"sourcesContent":["import { toDate } from \"./toDate.js\";\nfunction compareAsc(dateLeft, dateRight) {\n  const _dateLeft = toDate(dateLeft);\n  const _dateRight = toDate(dateRight);\n  const diff = _dateLeft.getTime() - _dateRight.getTime();\n  if (diff < 0) {\n    return -1;\n  } else if (diff > 0) {\n    return 1;\n  } else {\n    return diff;\n  }\n}\nexport {\n  compareAsc,\n  compareAsc as default\n};\n","import { toDate } from \"./toDate.js\";\nfunction isWithinInterval(date, interval) {\n  const time = +toDate(date);\n  const [startTime, endTime] = [\n    +toDate(interval.start),\n    +toDate(interval.end)\n  ].sort((a, b) => a - b);\n  return time >= startTime && time <= endTime;\n}\nexport {\n  isWithinInterval as default,\n  isWithinInterval\n};\n","import { createKRTimeZoneDate } from \"./createUTCDate.js\";\nimport { isAfter } from \"../node_modules/date-fns/isAfter.js\";\nimport { compareAsc } from \"../node_modules/date-fns/compareAsc.js\";\nimport { isWithinInterval } from \"../node_modules/date-fns/isWithinInterval.js\";\nimport { isEqual } from \"../node_modules/date-fns/isEqual.js\";\nimport { parseISO } from \"../node_modules/date-fns/parseISO.js\";\nimport { isBefore } from \"../node_modules/date-fns/isBefore.js\";\nconst composeFramerDateTime = (dateTime) => {\n  const {\n    date,\n    hours,\n    minutes,\n    seconds\n  } = dateTime;\n  if (!date) {\n    return;\n  }\n  const copied = createKRTimeZoneDate(date);\n  copied.setHours(hours, minutes, seconds);\n  return copied;\n};\nconst appendFramerTime = (date, time) => {\n  const {\n    hours,\n    minutes,\n    seconds\n  } = time;\n  const copied = new Date(date);\n  copied.setHours(hours, minutes, seconds);\n  return copied;\n};\nconst isAbove = (date, dateToCompare) => isEqual(date, dateToCompare) || isAfter(date, dateToCompare);\nconst orderByDateAsc = (items, selector) => {\n  return [...items].sort((x, y) => compareAsc(selector(x), selector(y)));\n};\nconst getCurrentScheduleIndex = (list, startDateSelector, endDateSelector) => {\n  const now = createKRTimeZoneDate();\n  const currentIndex = list.findIndex((item, index) => {\n    const nextItem = list[index + 1];\n    const startDate = startDateSelector(item);\n    const endDate = endDateSelector(item, nextItem);\n    const start = parseISO(startDate.toString());\n    const end = endDate ? parseISO(endDate.toString()) : void 0;\n    const isWithin = end ? isWithinInterval(now, {\n      start,\n      end\n    }) : false;\n    const isUpcoming = isBefore(now, start);\n    const isLast = nextItem === void 0;\n    return isWithin || isUpcoming || isLast;\n  });\n  return currentIndex === -1 ? void 0 : currentIndex;\n};\nconst getScheduleStatus = (startAt, endAt) => {\n  const now = createKRTimeZoneDate();\n  const isOngoing = isWithinInterval(now, {\n    start: startAt,\n    end: endAt\n  });\n  if (isOngoing) {\n    return \"ongoing\";\n  }\n  const isUpcoming = isBefore(now, startAt);\n  if (isUpcoming) {\n    return \"upcoming\";\n  }\n  return \"end\";\n};\nexport {\n  appendFramerTime,\n  composeFramerDateTime,\n  getCurrentScheduleIndex,\n  getScheduleStatus,\n  isAbove,\n  orderByDateAsc\n};\n"],"x_google_ignoreList":[0,1],"mappings":"uLACA,SAAS,EAAW,EAAU,EAAW,CACvC,IAAM,EAAY,EAAO,EAAS,CAC5B,EAAa,EAAO,EAAU,CAC9B,EAAO,EAAU,SAAS,CAAG,EAAW,SAAS,CAMrD,OALE,EAAO,EACF,GACE,EAAO,EACT,EAEA,mBAV0B,ICCrC,SAAS,EAAiB,EAAM,EAAU,CACxC,IAAM,EAAO,CAAC,EAAO,EAAK,CACpB,CAAC,EAAW,GAAW,CAC3B,CAAC,EAAO,EAAS,MAAM,CACvB,CAAC,EAAO,EAAS,IAAI,CACtB,CAAC,MAAM,EAAG,IAAM,EAAI,EAAE,CACvB,OAAO,GAAQ,GAAa,GAAQ,mBAPD,yBCAqB,IACI,IACM,IACY,IAClB,IACE,IACA,CAC1D,EA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