{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "lib-pagination-window",
  "type": "registry:lib",
  "title": "lib/pagination-window",
  "description": "Pagination 번호 창 (components/pagination.md \"번호 창\").",
  "files": [
    {
      "path": "poc/design-system/implement/src/lib/pagination-window.ts",
      "content": "/**\n * Pagination 번호 창 (components/pagination.md \"번호 창\").\n *\n * 원본 규칙: 번호는 한 번에 최대 maxPageButtons(기본 10)개이며, **묶음 단위**로 넘어갑니다.\n * 현재 페이지를 가운데 두는 슬라이딩 창(lib/pagination.ts 의 getPageItems)과 다릅니다 —\n * 같은 묶음 안에서는 번호 위치가 고정되고, 생략 기호(…)도 없습니다.\n *\n *   pageIndex 0  (1페이지)  → 1~10\n *   pageIndex 14 (15페이지) → 11~20\n *   pageCount 24, pageIndex 23 → 21~24 (마지막 묶음은 남은 개수만)\n *\n * 모든 인덱스는 0부터 셉니다. 화면 번호(1부터)로의 변환은 컴포넌트에서 한 번만 합니다.\n */\n\n/** pageCount 0 은 1 로 봅니다(원본 Props). */\nexport function normalizePageCount(pageCount: number): number {\n  return Math.max(1, Math.floor(pageCount) || 0);\n}\n\n/** 0 ≤ pageIndex ≤ pageCount - 1 로 맞춥니다. */\nexport function clampPageIndex(pageIndex: number, pageCount: number): number {\n  const count = normalizePageCount(pageCount);\n  return Math.min(Math.max(0, Math.floor(pageIndex) || 0), count - 1);\n}\n\n/** 현재 묶음에 보일 페이지 인덱스(0-based) 목록 */\nexport function getPageWindow(pageIndex: number, pageCount: number, maxPageButtons = 10): number[] {\n  const count = normalizePageCount(pageCount);\n  const size = Math.max(1, Math.floor(maxPageButtons) || 1);\n  const index = clampPageIndex(pageIndex, count);\n  const start = Math.floor(index / size) * size;\n  const end = Math.min(start + size, count);\n  return Array.from({ length: end - start }, (_, i) => start + i);\n}\n",
      "type": "registry:lib",
      "target": "components/lib/pagination-window.ts"
    }
  ],
  "categories": [
    "internal"
  ],
  "meta": {
    "version": "0.1.0"
  }
}
