{"version":3,"file":"get-day-relative-percent.cjs","names":[],"sources":["../../../src/utils/get-day-relative-percent/get-day-relative-percent.ts"],"sourcesContent":["interface GetDayRelativePercentInput {\n  clientX: number;\n  containerLeft: number;\n  containerWidth: number;\n  dayIndex: number;\n  dayCount: number;\n}\n\n/**\n * Maps a horizontal pointer position to a percent (0-100) within a single day's\n * sub-region of a container that holds `dayCount` equal-width days side by side.\n * `dayIndex === 0` and `dayCount === 1` make it equivalent to a plain percent\n * across the whole container. The result is clamped to the `[0, 100]` range.\n */\nexport function getDayRelativePercent({\n  clientX,\n  containerLeft,\n  containerWidth,\n  dayIndex,\n  dayCount,\n}: GetDayRelativePercentInput): number {\n  const dayWidth = containerWidth / dayCount;\n  if (dayWidth <= 0) {\n    return 0;\n  }\n  const dayLeft = containerLeft + dayIndex * dayWidth;\n  const relativeX = clientX - dayLeft;\n  return Math.max(0, Math.min(100, (relativeX / dayWidth) * 100));\n}\n"],"mappings":";;;;;;;;AAcA,SAAgB,sBAAsB,EACpC,SACA,eACA,gBACA,UACA,YACqC;CACrC,MAAM,WAAW,iBAAiB;CAClC,IAAI,YAAY,GACd,OAAO;CAGT,MAAM,YAAY,WADF,gBAAgB,WAAW;CAE3C,OAAO,KAAK,IAAI,GAAG,KAAK,IAAI,KAAM,YAAY,WAAY,GAAG,CAAC;AAChE"}