{"version":3,"file":"get-months-range.mjs","names":[],"sources":["../../../src/Heatmap/get-months-range/get-months-range.ts"],"sourcesContent":["interface MonthRangeValue {\n  /** 0 - 11, index of the month, used to retrieve month label from the array */\n  month: number;\n\n  /** Number of weeks displayed previously */\n  position: number;\n\n  /** Number of weeks in the month */\n  size: number;\n}\n\nexport function getMonthsRange(weeksData: (string | null)[][]) {\n  let position = 0;\n  let current: number | null = null;\n  const result: MonthRangeValue[] = [];\n\n  weeksData.forEach((week) => {\n    // it is guaranteed that week has at least 1 day\n    const day = week[0] === null ? week[week.length - 1]! : week[0];\n    const month = new Date(day).getUTCMonth();\n\n    if (current !== month) {\n      current = month;\n      result.push({ month: current, position, size: 0 });\n    }\n\n    result[result.length - 1].size += 1;\n    position += 1;\n  });\n\n  return result;\n}\n"],"mappings":";;AAWA,SAAgB,eAAe,WAAgC;CAC7D,IAAI,WAAW;CACf,IAAI,UAAyB;CAC7B,MAAM,SAA4B,EAAE;AAEpC,WAAU,SAAS,SAAS;EAE1B,MAAM,MAAM,KAAK,OAAO,OAAO,KAAK,KAAK,SAAS,KAAM,KAAK;EAC7D,MAAM,QAAQ,IAAI,KAAK,IAAI,CAAC,aAAa;AAEzC,MAAI,YAAY,OAAO;AACrB,aAAU;AACV,UAAO,KAAK;IAAE,OAAO;IAAS;IAAU,MAAM;IAAG,CAAC;;AAGpD,SAAO,OAAO,SAAS,GAAG,QAAQ;AAClC,cAAY;GACZ;AAEF,QAAO"}