{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "calendar",
  "type": "registry:ui",
  "title": "<ui-calendar>",
  "description": "Modern, accessible calendar month grid following the WAI-ARIA APG \"Date Picker Dialog\" grid model. Inspired by Cally: - Single date, range date, and multi-date selection (`multi`) - Multi-month side-by-side view (`months`, 1 to 12; `page-by=\"single\"` turns one month at a time) - Cally's heading selects (`<ui-calendar-select-month>`, `<ui-calendar-select-year>`; slot `heading` for your own) - Cally's options: `show-outside-days`, `show-week-numbers`, `weekday-format`, `today`, `getDayParts`; ←/→ swap right-to-left - Fully round circular days and seamless continuous range ribbons - Rich CSS parts for deep customization Copied from @purpurabog/ui 2.3.0; the package is the maintained source, this copy is yours to change. Icons from the Carbon Design System (Apache-2.0, © IBM Corp.; see THIRD-PARTY-NOTICES.md in the package).",
  "dependencies": [
    "lit@^3.3.0"
  ],
  "registryDependencies": [
    "@kanok-ui/core-date",
    "@kanok-ui/shared-element",
    "@kanok-ui/shared-field",
    "@kanok-ui/shared-localize",
    "@kanok-ui/tokens"
  ],
  "files": [
    {
      "path": "src/primitives/calendar/calendar-select.ts",
      "type": "registry:ui",
      "target": "components/ui/primitives/calendar/calendar-select.ts",
      "content": "import { css, html, LitElement, type PropertyValues } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { srOnlyStyles } from '../shared/field.ts';\nimport { addMonths, monthChoices, toDisplayYear, withYear, yearChoices, type Era } from '../../core/date.ts';\nimport { UiElement } from '../shared/element.ts';\n\n/** What a heading select shows, given by its `<ui-calendar>`: the day it moves from (the first month's), the limits and the language. */\nexport interface CalendarHeadingView {\n    /** The focused day; with several months, that day in the first month. */\n    focus: Date;\n    min: string;\n    max: string;\n    locale: string;\n    era: Era;\n    /** The select's name for assistive tech (the calendar's translation: Month / Year). */\n    label: string;\n}\n\n/** Detail of `ui-focus-day`: the day the calendar should move its focus to. */\nexport interface CalendarFocusDayDetail {\n    date: Date;\n}\n\ninterface Choice {\n    value: number;\n    label: string;\n    disabled: boolean;\n}\n\nconst selectStyles = css`\n    :host {\n        display: inline-flex;\n        position: relative;\n        align-items: center;\n    }\n\n    select {\n        box-sizing: border-box;\n        height: 28px;\n        margin: 0;\n        padding-block: 0;\n        padding-inline: 6px 20px;\n        border: none;\n        border-radius: var(--ui-radius-sm, 6px);\n        appearance: none;\n        background: transparent;\n        color: var(--ui-ink);\n        font: var(--ui-font-body-emphasis);\n        font-size: var(--ui-field-font-size, 0.9375rem);\n        font-weight: 600;\n        letter-spacing: var(--ui-tracking-body);\n        cursor: pointer;\n        touch-action: manipulation; /* a tap opens it at once, as the calendar's buttons (Cally) */\n        transition: background-color var(--ui-duration-fast, 150ms) var(--ui-easing);\n        field-sizing: content; /* as wide as the chosen option, not the longest (where supported) */\n    }\n\n    select:hover {\n        background-color: var(--ui-canvas-hover, rgba(0, 0, 0, 0.05));\n    }\n\n    select:focus-visible {\n        outline: var(--ui-focus-width, 2px) solid var(--ui-focus);\n        outline-offset: -1px;\n    }\n\n    option {\n        color: var(--ui-ink);\n        background-color: var(--ui-overlay-background, var(--ui-surface-1));\n    }\n\n    .chevron {\n        position: absolute;\n        inset-inline-end: 4px;\n        width: 12px;\n        height: 12px;\n        fill: var(--ui-ink-muted, currentColor);\n        pointer-events: none;\n    }\n\n    @media (forced-colors: active) {\n        select {\n            border: 1px solid ButtonText;\n        }\n\n        .chevron {\n            fill: ButtonText;\n        }\n    }\n`;\n\n/**\n * A native select in `<ui-calendar>`'s heading (Cally `calendar-select-month` / `calendar-select-year`): the calendar\n * gives it `view`; a choice asks the calendar, with `ui-focus-day`, to move its focus.\n */\nabstract class CalendarSelect extends UiElement {\n    static override readonly shadowRootOptions: ShadowRootInit = { ...LitElement.shadowRootOptions, delegatesFocus: true };\n\n    static override readonly styles = [srOnlyStyles, selectStyles];\n\n    /** Set by the enclosing `<ui-calendar>` (its own heading, or the elements slotted into its `heading` slot). */\n    @property({ attribute: false }) view?: CalendarHeadingView;\n\n    @query('select') private readonly select!: HTMLSelectElement | null;\n\n    protected abstract choices(view: CalendarHeadingView): { options: Choice[]; selected: number };\n\n    /** The day a choice of `value` moves to. */\n    protected abstract dayFor(view: CalendarHeadingView, value: number): Date;\n\n    protected override updated(changed: PropertyValues<this>) {\n        super.updated(changed);\n        // set after the options render: a value bound on the <select> itself would be set before them\n        if (this.view && this.select) this.select.value = String(this.choices(this.view).selected);\n    }\n\n    private onChange(event: Event) {\n        if (!this.view) return;\n        const date = this.dayFor(this.view, Number((event.target as HTMLSelectElement).value));\n        this.dispatchEvent(new CustomEvent<CalendarFocusDayDetail>('ui-focus-day', { detail: { date }, bubbles: true }));\n    }\n\n    override render() {\n        const view = this.view;\n        const { options, selected } = view ? this.choices(view) : { options: [], selected: -1 };\n        return html`\n            <label class=\"sr-only\" part=\"label\" for=\"select\"><slot name=\"label\">${view?.label ?? ''}</slot></label>\n            <select id=\"select\" part=\"select\" @change=${this.onChange}>\n                ${options.map((o) => html`<option value=${o.value} ?disabled=${o.disabled} ?selected=${o.value === selected}>${o.label}</option>`)}\n            </select>\n            <svg class=\"chevron\" viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M8 11 3 6l.7-.7L8 9.6l4.3-4.3.7.7z\" /></svg>\n        `;\n    }\n}\n\n/**\n * The month select of `<ui-calendar>`'s heading (Cally `calendar-select-month`): the months of the year shown, those\n * wholly outside `min` / `max` off. `<ui-calendar>` shows one by default; put your own in its `heading` slot.\n *\n * @csspart label - The visually hidden label\n * @csspart select - The native select\n * @slot label - Replaces the label (default: the calendar's \"Month\")\n * @fires ui-focus-day - Detail `{ date }`, a month was chosen: the enclosing calendar moves its focus there\n */\n@customElement('ui-calendar-select-month')\nexport class UiCalendarSelectMonth extends CalendarSelect {\n    /** Month names `long` (October) or `short` (Oct), as Cally's `format-month`. */\n    @property({ attribute: 'format-month' }) formatMonth: 'long' | 'short' = 'long';\n\n    protected choices(view: CalendarHeadingView) {\n        const names = new Intl.DateTimeFormat(view.locale, { month: this.formatMonth });\n        const year = view.focus.getFullYear();\n        const options = monthChoices(view.focus, view).map((c) => ({ value: c.month, label: names.format(new Date(year, c.month, 1)), disabled: c.disabled }));\n        return { options, selected: view.focus.getMonth() };\n    }\n\n    protected dayFor(view: CalendarHeadingView, month: number) {\n        return addMonths(view.focus, month - view.focus.getMonth());\n    }\n}\n\n/**\n * The year select of `<ui-calendar>`'s heading (Cally `calendar-select-year`): `max-years` years around the year shown,\n * cut to those `min` / `max` allow, in the calendar's era (พ.ศ. in Thai). `<ui-calendar>` shows one by default; put\n * your own in its `heading` slot.\n *\n * @csspart label - The visually hidden label\n * @csspart select - The native select\n * @slot label - Replaces the label (default: the calendar's \"Year\")\n * @fires ui-focus-day - Detail `{ date }`, a year was chosen: the enclosing calendar moves its focus there\n */\n@customElement('ui-calendar-select-year')\nexport class UiCalendarSelectYear extends CalendarSelect {\n    /** How many years to offer, around the year shown (Cally's `max-years`, default 20). */\n    @property({ type: Number, attribute: 'max-years' }) maxYears = 20;\n\n    protected choices(view: CalendarHeadingView) {\n        const options = yearChoices(view.focus, this.maxYears, view).map((year) => ({ value: year, label: String(toDisplayYear(year, view.era)), disabled: false }));\n        return { options, selected: view.focus.getFullYear() };\n    }\n\n    protected dayFor(view: CalendarHeadingView, year: number) {\n        return withYear(view.focus, year);\n    }\n}\n\ndeclare global {\n    interface HTMLElementTagNameMap {\n        'ui-calendar-select-month': UiCalendarSelectMonth;\n        'ui-calendar-select-year': UiCalendarSelectYear;\n    }\n}\n"
    },
    {
      "path": "src/primitives/calendar/calendar.styles.ts",
      "type": "registry:ui",
      "target": "components/ui/primitives/calendar/calendar.styles.ts",
      "content": "import { css } from 'lit';\n\n/**\n * Modern, Cally-level calendar styles for ui-calendar:\n * - Fully round circular days\n * - Seamless continuous date range ribbons with rounded caps\n * - Two-month side-by-side view support\n * - Multi-date selection support\n * - Clean CSS parts for external customization\n */\nexport const calendarStyles = css`\n    :host {\n        display: block;\n        font-family: var(--ui-font-family);\n        color: var(--ui-ink);\n        user-select: none;\n    }\n\n    /* Multi-month layout container */\n    .months-container {\n        display: flex;\n        gap: var(--ui-space-lg, 24px);\n        align-items: flex-start;\n        justify-content: center;\n        flex-wrap: wrap;\n    }\n\n    .month-view {\n        width: 100%;\n        max-width: 280px;\n        flex: 0 0 280px;\n    }\n\n    /* --- Header: Clean, balanced, modern (Cally style) --- */\n    .cal-header {\n        display: flex;\n        align-items: center;\n        justify-content: space-between;\n        padding: 0;\n        margin-bottom: var(--ui-space-xs, 8px);\n    }\n\n    .month-year {\n        display: inline-flex;\n        align-items: center;\n        justify-content: center;\n        gap: var(--ui-space-xxs, 4px);\n        height: 28px;\n        font: var(--ui-font-body-emphasis);\n        font-weight: 600;\n        letter-spacing: var(--ui-tracking-body);\n        color: var(--ui-ink);\n    }\n\n    /* several months: each grid's name over it, set like the header's selects (which show the first month) */\n    .month-title {\n        display: flex;\n        align-items: center;\n        justify-content: center;\n        height: 28px;\n        margin-bottom: var(--ui-space-xs, 8px);\n        font: var(--ui-font-body-emphasis);\n        font-size: 0.9375rem;\n        font-weight: 600;\n        letter-spacing: var(--ui-tracking-body);\n        color: var(--ui-ink);\n    }\n\n    /* a tap is a click at once: no double-tap zoom to wait for between quick taps (Cally: touch-action on every button) */\n    .nav,\n    .day,\n    .today-button {\n        touch-action: manipulation;\n    }\n\n    /* Navigation buttons: circular, clean, soft hover (Cally style) */\n    .nav {\n        display: inline-flex;\n        align-items: center;\n        justify-content: center;\n        width: 36px;\n        height: 36px;\n        padding: 0;\n        border: none;\n        border-radius: var(--ui-icon-control-radius, 9999px);\n        background: transparent;\n        color: var(--ui-ink);\n        cursor: pointer;\n        transition: background-color var(--ui-duration-fast, 150ms) var(--ui-easing),\n                    color var(--ui-duration-fast, 150ms) var(--ui-easing);\n    }\n\n    .nav:hover {\n        background-color: var(--ui-ghost-hover);\n    }\n\n    .nav:active {\n        background-color: var(--ui-ghost-active);\n    }\n\n    .nav:focus-visible {\n        outline: var(--ui-focus-width, 2px) solid var(--ui-focus);\n        outline-offset: var(--ui-focus-offset, -2px);\n    }\n\n    .nav:disabled {\n        color: var(--ui-ink-disabled);\n        cursor: not-allowed;\n        background: transparent;\n        opacity: 0.3;\n    }\n\n    .nav svg {\n        width: 16px;\n        height: 16px;\n        fill: currentColor;\n    }\n\n    /* --- Table & Grid: 7 equal 40px columns (280px total) --- */\n    table {\n        width: 100%;\n        max-width: 280px;\n        margin-inline: auto;\n        border-collapse: collapse;\n        table-layout: fixed;\n    }\n\n    th {\n        height: 40px;\n        padding: 0;\n        text-align: center;\n        vertical-align: middle;\n        font: var(--ui-font-body-sm);\n        letter-spacing: var(--ui-tracking-body);\n        color: var(--ui-ink-muted, var(--ui-ink));\n        font-weight: 500;\n    }\n\n    /* show-week-numbers: an eighth 40px column of ISO week numbers, quieter than the days */\n    :host([show-week-numbers]) .month-view,\n    :host([show-week-numbers]) table {\n        max-width: 320px;\n        flex-basis: 320px;\n    }\n\n    .week-number {\n        color: var(--ui-ink-helper);\n        font: var(--ui-font-caption);\n        letter-spacing: var(--ui-tracking-caption);\n    }\n\n    /* td is 40px wide, 41px row pitch (40px + 1px bottom padding) */\n    td {\n        padding: 0 0 1px;\n        margin: 0;\n        height: 40px;\n        text-align: center;\n        vertical-align: middle;\n        position: relative;\n        box-sizing: border-box;\n    }\n\n    /* --- Day Button (Cally / Airbnb / Apple Calendar Style) --- */\n    .day {\n        position: relative;\n        z-index: 1;\n        box-sizing: border-box;\n        display: inline-flex;\n        align-items: center;\n        justify-content: center;\n        width: 100%;\n        height: 40px;\n        margin: 0;\n        padding: 0;\n        border: none;\n        border-radius: var(--ui-calendar-day-radius, 9999px);\n        background: transparent;\n        color: var(--ui-ink);\n        font: var(--ui-font-body-sm);\n        letter-spacing: var(--ui-tracking-body);\n        cursor: pointer;\n        /* --ui-calendar-day-duration: a design can make the keys' moves instant (Kanok: 0s, as Cally) */\n        transition: background-color var(--ui-calendar-day-duration, var(--ui-duration-fast, 150ms)) var(--ui-easing),\n                    color var(--ui-calendar-day-duration, var(--ui-duration-fast, 150ms)) var(--ui-easing);\n    }\n\n    .day:hover:not([aria-pressed='true']):not(.in-range) {\n        background-color: var(--ui-ghost-hover);\n        border-radius: var(--ui-calendar-day-radius, 9999px);\n    }\n\n    .day.outside {\n        color: var(--ui-ink-helper);\n        opacity: 0.55;\n    }\n\n    /* Today indicator */\n    .day.today {\n        color: var(--ui-link);\n        font-weight: 600;\n    }\n\n    .day.today::after {\n        content: '';\n        position: absolute;\n        bottom: 5px;\n        left: 50%;\n        transform: translateX(-50%);\n        width: 4px;\n        height: 4px;\n        border-radius: var(--ui-calendar-today-dot-radius, 50%);\n        background-color: var(--ui-link);\n    }\n\n    .day.today[aria-pressed='true']::after {\n        background-color: var(--ui-on-primary, #ffffff);\n    }\n\n    /* Selected single day / multi-selected days / range endpoints */\n    .day[aria-pressed='true'] {\n        background-color: var(--ui-primary);\n        color: var(--ui-on-primary, #ffffff);\n        font-weight: 600;\n        border-radius: var(--ui-calendar-day-radius, 9999px);\n    }\n\n    .day[aria-pressed='true']:hover {\n        background-color: var(--ui-primary);\n    }\n\n    /* --- Continuous Range Ribbon (Cally / Airbnb Style) --- */\n    /* Range start day: round left cap, flat right edge connecting to next day */\n    .day.range-start:not(.range-end) {\n        background-color: var(--ui-primary) !important;\n        color: var(--ui-on-primary, #ffffff) !important;\n        border-radius: var(--ui-calendar-day-radius, 9999px) 0 0 var(--ui-calendar-day-radius, 9999px) !important;\n    }\n\n    /* Range end day: flat left edge, round right cap */\n    .day.range-end:not(.range-start) {\n        background-color: var(--ui-primary) !important;\n        color: var(--ui-on-primary, #ffffff) !important;\n        border-radius: 0 var(--ui-calendar-day-radius, 9999px) var(--ui-calendar-day-radius, 9999px) 0 !important;\n    }\n\n    /* Range start and end on the SAME day: fully round circle */\n    .day.range-start.range-end {\n        border-radius: var(--ui-calendar-day-radius, 9999px) !important;\n    }\n\n    /* In-between days: continuous ribbon with 0 radius */\n    .day.in-range {\n        background-color: var(--ui-highlight, #edf5fd) !important;\n        color: var(--ui-ink) !important;\n        border-radius: 0 !important;\n    }\n\n    .day.in-range:hover {\n        background-color: var(--ui-ghost-hover) !important;\n    }\n\n    /* Row wrap caps for week boundaries */\n    tr td:first-child .day.in-range,\n    tr td:first-child .day.range-end {\n        border-top-left-radius: var(--ui-calendar-day-radius, 9999px) !important;\n        border-bottom-left-radius: var(--ui-calendar-day-radius, 9999px) !important;\n    }\n\n    tr td:last-child .day.in-range,\n    tr td:last-child .day.range-start {\n        border-top-right-radius: var(--ui-calendar-day-radius, 9999px) !important;\n        border-bottom-right-radius: var(--ui-calendar-day-radius, 9999px) !important;\n    }\n\n    /* Range preview end before picked */\n    .day.range-end:not([aria-pressed='true']) {\n        z-index: 1;\n        background-color: var(--_ui-calendar-surface, var(--ui-surface-1));\n        color: var(--ui-ink);\n        outline: var(--ui-focus-width, 2px) solid var(--ui-focus);\n        outline-offset: -2px;\n    }\n\n    /* Focus visible */\n    .day:focus-visible {\n        outline: var(--ui-focus-width, 2px) solid var(--ui-calendar-day-focus, var(--ui-primary));\n        outline-offset: -2px;\n        z-index: 2;\n    }\n\n    /* --ui-calendar-day-focus-background: the keyboard's day filled as under the pointer (Cally fills it; Carbon: none) */\n    .day:focus-visible:not([aria-pressed='true'], .in-range) {\n        background-color: var(--ui-calendar-day-focus-background, transparent);\n    }\n\n    .day[aria-pressed='true']:focus {\n        outline: var(--ui-calendar-selected-focus-width, 1px) solid var(--ui-calendar-selected-focus, var(--ui-layer-2));\n        outline-offset: var(--ui-calendar-selected-focus-offset, -3px);\n        z-index: var(--ui-calendar-selected-focus-layer, auto);\n    }\n\n    /* the chosen day after a click: a design that rings the keyboard only shows none (--ui-pointer-focus; Carbon: the ring stays) */\n    .day[aria-pressed='true']:focus:not(:focus-visible) {\n        outline-color: var(--ui-pointer-focus, var(--ui-calendar-selected-focus, var(--ui-layer-2)));\n    }\n\n    /* Quiet focus */\n    :host([data-quiet-focus]) .day:focus-visible {\n        outline-color: var(--ui-pointer-focus, var(--ui-calendar-day-focus, var(--ui-primary)));\n    }\n\n    :host([data-quiet-focus]) .day[aria-pressed='true']:focus {\n        outline-color: var(--ui-pointer-focus, var(--ui-calendar-selected-focus, var(--ui-layer-2)));\n    }\n\n    /* Disabled */\n    .day[aria-disabled='true'] {\n        color: var(--ui-ink-disabled);\n        text-decoration: line-through;\n        cursor: not-allowed;\n        background: transparent !important;\n        opacity: 0.4;\n    }\n\n    /* Footer / Today button */\n    .cal-footer {\n        display: flex;\n        justify-content: flex-end;\n        margin-top: var(--ui-space-xxs, 4px);\n        border-top: 1px solid var(--ui-hairline);\n    }\n\n    .today-button {\n        height: 32px;\n        padding: 0 var(--ui-space-md);\n        border: none;\n        border-radius: var(--ui-focus-radius, 6px);\n        background: transparent;\n        color: var(--ui-link);\n        font: var(--ui-font-body-sm);\n        letter-spacing: var(--ui-tracking-body);\n        cursor: pointer;\n        transition: background-color var(--ui-duration-fast, 150ms) var(--ui-easing);\n    }\n\n    .today-button:hover {\n        background-color: var(--ui-ghost-hover);\n    }\n\n    .today-button:focus-visible {\n        outline: var(--ui-focus-width, 2px) solid var(--ui-focus);\n        outline-offset: var(--ui-focus-offset, -2px);\n    }\n\n    .today-button:disabled {\n        color: var(--ui-ink-disabled);\n        cursor: not-allowed;\n        background: transparent;\n    }\n\n    @media (forced-colors: active) {\n        .day[aria-pressed='true'] {\n            forced-color-adjust: none;\n            background-color: Highlight;\n            color: HighlightText;\n        }\n        .day.in-range {\n            forced-color-adjust: none;\n            outline: 1px solid Highlight;\n            background-color: Canvas;\n            color: CanvasText;\n        }\n    }\n`;\n"
    },
    {
      "path": "src/primitives/calendar/calendar.ts",
      "type": "registry:ui",
      "target": "components/ui/primitives/calendar/calendar.ts",
      "content": "import { html, nothing } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { srOnlyStyles, uid } from '../shared/field.ts';\nimport {\n    addMonths,\n    calendarMonths,\n    clampDate,\n    fromIso,\n    isThai,\n    isUnavailable,\n    isoWeek,\n    monthGrid,\n    monthNavDisabled,\n    moveByKey,\n    pageStartFor,\n    pickInRange,\n    rangePosition,\n    sameDay,\n    shownRange,\n    toIso,\n    turnPage,\n    type DateLimits,\n    type Era,\n} from '../../core/date.ts';\nimport { calendarStyles } from './calendar.styles.ts';\nimport { UiCalendarSelectYear, type CalendarFocusDayDetail, type CalendarHeadingView, type UiCalendarSelectMonth } from './calendar-select.ts';\n\nexport * from './calendar-select.ts';\n\n/** The heading's selects, the calendar's own or slotted. */\nconst HEADING_SELECTS = 'ui-calendar-select-month, ui-calendar-select-year';\nimport { getTranslation, LocalizeController } from '../shared/localize.ts';\nimport { UiElement } from '../shared/element.ts';\n\n/**\n * Modern, accessible calendar month grid following the WAI-ARIA APG \"Date Picker Dialog\" grid model.\n * Inspired by Cally:\n * - Single date, range date, and multi-date selection (`multi`)\n * - Multi-month side-by-side view (`months`, 1 to 12; `page-by=\"single\"` turns one month at a time)\n * - Cally's heading selects (`<ui-calendar-select-month>`, `<ui-calendar-select-year>`; slot `heading` for your own)\n * - Cally's options: `show-outside-days`, `show-week-numbers`, `weekday-format`, `today`, `getDayParts`;\n *   ←/→ swap right-to-left\n * - Fully round circular days and seamless continuous range ribbons\n * - Rich CSS parts for deep customization\n *\n * @csspart months - Multi-month layout container\n * @csspart month-view - Container of a single month\n * @csspart month-title - A month's name above its grid when two months show (the header then has the year only)\n * @csspart header - Month / year row container\n * @csspart nav - Previous / next navigation buttons\n * @csspart prev-button - The previous month button\n * @csspart next-button - The next month button\n * @csspart heading - The month and year selects' row (the `heading` slot)\n * @csspart month-select - The default heading's month select (`<ui-calendar-select-month>`'s `select`)\n * @csspart year-select - The default heading's year select (`<ui-calendar-select-year>`'s `select`)\n * @csspart grid - The table grid of days\n * @csspart table - The table grid of days\n * @csspart thead - The table header row with weekday labels\n * @csspart th - Individual weekday heading cell (also `day-N`, 0 = Sunday; the week-number heading also `weeknumber`)\n * @csspart weeknumber - A week-number cell (`show-week-numbers`)\n * @csspart tbody - The table body of weeks\n * @csspart row - Each week table row\n * @csspart cell - Each day table cell\n * @csspart day - Each day button; its state adds `day-N` (0 = Sunday), `selected`, `today`, `outside` (another month),\n *   `disabled` (before `min` / after `max`), `disallowed` (refused by `isDateDisabled`), `range-start`, `range-end`,\n *   `in-range`, and the names `getDayParts` returns\n * @csspart today-button - The optional \"Today\" footer button\n * @csspart footer - The footer container\n *\n * @cssprop --ui-calendar-day-radius - Corner radius of a day button (default 9999px for circular days)\n * @cssprop --ui-calendar-today-dot-radius - Corner radius of today's indicator dot (default 50%)\n * @cssprop --ui-calendar-day-focus - The keyboard focus ring on a day\n * @cssprop --ui-calendar-selected-focus - Focus ring on a selected day\n *\n * @fires ui-pick - Detail `{ date }`, when a day is activated\n * @fires ui-multi-pick - Detail `{ date, values }`, in multi mode when a day is toggled\n * @fires ui-focus-change - Detail `{ date }`, when keyboard or navigation moves the focused date\n * @fires change - Detail `{ value, endValue, values }`, native-like change event on a pick (with `range`, once both ends are picked)\n * @fires ui-range-start - Detail `{ date }`, with `range`: the first end was picked (Cally `rangestart`)\n * @fires ui-range-end - Detail `{ date }`, with `range`: the second end was picked (Cally `rangeend`)\n * @fires ui-page-change - Detail `{ start, end }`, the first and last day shown after the months on show changed (Cally `pagechange`)\n *\n * @slot previous - Replaces the previous button's arrow icon\n * @slot next - Replaces the next button's arrow icon\n * @slot heading - Replaces the month and year selects; `<ui-calendar-select-month>` / `<ui-calendar-select-year>` put here follow the calendar\n */\n@customElement('ui-calendar')\nexport class UiCalendar extends UiElement {\n    static override readonly styles = [srOnlyStyles, calendarStyles];\n\n    /** Chosen day (start day in range mode), ISO yyyy-mm-dd. */\n    @property() value = '';\n\n    /** Range mode: chosen end day, ISO yyyy-mm-dd. */\n    @property({ attribute: 'end-value' }) endValue = '';\n\n    /** Whether range selection is enabled. */\n    @property({ type: Boolean }) range = false;\n\n    /** Multi-date selection mode: select multiple individual dates (like Cally's calendar-multi). */\n    @property({ type: Boolean }) multi = false;\n\n    /** Selected dates in multi mode (array or comma/space-separated ISO string). */\n    @property({ attribute: 'values' }) values: string[] | string = [];\n\n    /** Months on show side by side, 1 to 12 (default 1; 12 paged by the page is a calendar year, from January). */\n    @property({ type: Number }) months = 1;\n\n    /** With more than one month, ‹ › and the keys turn a whole page (`months`, the default) or one month (`single`), as Cally's `page-by`. */\n    @property({ attribute: 'page-by' }) pageBy: 'months' | 'single' = 'months';\n\n    /** Show the days of the months before and after, in six weeks (Cally `show-outside-days`); by default they are blank and only the weeks the month needs show. Several months never show them. */\n    @property({ type: Boolean, attribute: 'show-outside-days' }) showOutsideDays = false;\n\n    /** A column of ISO week numbers before the weeks (Cally `show-week-numbers`). */\n    @property({ type: Boolean, attribute: 'show-week-numbers' }) showWeekNumbers = false;\n\n    /** Weekday headings `narrow` (S / อา) or `short` (Sun / อา.); by default narrow in Thai, short otherwise (Cally `format-weekday`). */\n    @property({ attribute: 'weekday-format' }) weekdayFormat: 'narrow' | 'short' | '' = '';\n\n    /** The day marked as today, ISO (default the real today): for tests, demos and another time zone (Cally `today`). */\n    @property() today = '';\n\n    /** Extra `part` names for a day, e.g. `holiday` (Cally `getDayParts`). */\n    @property({ attribute: false }) getDayParts?: (date: Date) => string;\n\n    /** Range mode: which end a pick will set; drives the preview highlight. */\n    @property({ attribute: 'active-field' }) activeField: 'start' | 'end' = 'start';\n\n    /** Day that holds the roving tab stop; its month is shown. */\n    @property({ attribute: false }) focusDate = new Date();\n\n    /** Minimum selectable ISO date. */\n    @property() min = '';\n\n    /** Maximum selectable ISO date. */\n    @property() max = '';\n\n    /** Callback to disable individual dates (e.g. weekends, holidays). */\n    @property({ attribute: false }) isDateDisabled?: (date: Date) => boolean | string;\n\n    /** BCP 47 locale for names and labels. Defaults to the nearest `lang`. */\n    @property() locale = '';\n\n    /** Year era: `be` (พ.ศ.) or `ce` (ค.ศ.). Defaults to `be` for Thai locales. */\n    @property() era: Era | '' = '';\n\n    /** 0 = Sunday … 6 = Saturday. */\n    @property({ type: Number, attribute: 'first-day' }) firstDay = 0;\n\n    /** Whether to display the \"Today\" footer shortcut button. */\n    @property({ type: Boolean, attribute: 'show-today' }) showToday = false;\n\n    /** Range mode: the last day the pointer rested on, for the provisional range preview (kept when it leaves the grid, as Cally; a key clears it). */\n    @state() private hoverDate: Date | null = null;\n\n    /** First month on show; it turns a whole page only when focus leaves the shown months (Cally page-by=\"months\"). */\n    @state() private pageStart?: Date;\n\n    @query('.day[tabindex=\"0\"]') private readonly focusedDay!: HTMLButtonElement | null;\n\n    private readonly liveId = uid('ui-calendar');\n    private readonly localize = new LocalizeController(this);\n\n    private get resolvedLocale() {\n        return this.locale || this.localize.lang();\n    }\n\n    private get resolvedEra(): Era {\n        if (this.era) return this.era;\n        return isThai(this.resolvedLocale) ? 'be' : 'ce';\n    }\n\n    /** Selected dates as clean ISO array in multi mode. */\n    get multiValues(): string[] {\n        if (Array.isArray(this.values)) return this.values;\n        if (typeof this.values === 'string' && this.values.trim()) {\n            return this.values.trim().split(/[\\s,]+/);\n        }\n        return [];\n    }\n\n    /** Move DOM focus with focusDate only when the user is navigating the grid itself. */\n    private focusFromGrid = false;\n\n    /** Puts DOM focus on the day that holds the roving tab stop. */\n    focusDay() {\n        this.focusedDay?.focus();\n    }\n\n    /** The calendar's Tab stops in order: ‹, its own month and year selects (not when `heading` is slotted), ›, the day that holds the tab stop and Today. */\n    tabStops(): HTMLElement[] {\n        const ownHeading = !this.renderRoot.querySelector<HTMLSlotElement>('slot[name=\"heading\"]')?.assignedElements().length;\n        return [...this.renderRoot.querySelectorAll<HTMLElement>(`button, ${HEADING_SELECTS}`)].filter((el) => (el instanceof HTMLButtonElement ? !el.disabled && el.tabIndex >= 0 : ownHeading));\n    }\n\n    /** Months on show side by side: 1 to 12. */\n    private get monthCount() {\n        return calendarMonths(this.months);\n    }\n\n    /** How far ‹ › turn the page: the whole page, or one month with `page-by=\"single\"`. */\n    private get pageStep() {\n        return this.pageBy === 'single' ? 1 : this.monthCount;\n    }\n\n    /** The day shown as today. */\n    private get todayDate() {\n        return fromIso(this.today) ?? new Date();\n    }\n\n    protected override willUpdate(changed: Map<string, unknown>) {\n        if (changed.has('focusDate') || changed.has('months') || changed.has('pageBy')) {\n            this.pageStart = pageStartFor(this.focusDate, this.pageStart, this.monthCount, this.pageStep);\n        }\n    }\n\n    protected override updated(changed: Map<string, unknown>) {\n        this.syncHeading();\n        if (changed.has('focusDate') && this.focusFromGrid) {\n            this.focusFromGrid = false;\n            this.focusDay();\n        }\n        const before = changed.get('pageStart') as Date | undefined;\n        if (before && this.pageStart && toIso(before) !== toIso(this.pageStart)) {\n            const start = this.pageStart;\n            const end = new Date(start.getFullYear(), start.getMonth() + this.monthCount, 0);\n            this.dispatchEvent(new CustomEvent('ui-page-change', { detail: { start, end }, bubbles: true }));\n        }\n    }\n\n    /** A weekday's heading: `weekday-format`, else the translation's own names when it matches the language, else narrow in Thai and short otherwise. */\n    private weekdayNames() {\n        const intl = this.dtf({ weekday: this.weekdayFormat || (isThai(this.resolvedLocale) ? 'narrow' : 'short') });\n        const own = this.weekdayFormat ? undefined : this.ownWeekdays();\n        return (d: Date) => own?.[d.getDay()] ?? intl.format(d);\n    }\n\n    /** Weekday headings from translation when matching current language, otherwise Intl. */\n    private ownWeekdays() {\n        const t = getTranslation(this.resolvedLocale);\n        const lang = (code: string) => code.toLowerCase().split('-')[0];\n        return lang(t.$code) === lang(this.resolvedLocale) ? t.datePicker.weekdays : undefined;\n    }\n\n    private get messages() {\n        return getTranslation(this.resolvedLocale).datePicker;\n    }\n\n    private get limits(): DateLimits {\n        return { min: this.min, max: this.max, isDateDisabled: this.isDateDisabled };\n    }\n\n    private unavailable(d: Date) {\n        return isUnavailable(d, this.limits);\n    }\n\n    private dtf(options: Intl.DateTimeFormatOptions) {\n        const calendar = this.resolvedEra === 'be' ? 'buddhist' : 'gregory';\n        return new Intl.DateTimeFormat(this.resolvedLocale, { calendar, ...options });\n    }\n\n    // ---- Interaction ----\n\n    private pick(d: Date) {\n        if (this.unavailable(d)) return;\n        const iso = toIso(d);\n\n        if (this.multi) {\n            const current = [...this.multiValues];\n            const idx = current.indexOf(iso);\n            if (idx >= 0) current.splice(idx, 1);\n            else current.push(iso);\n            current.sort();\n            this.values = current;\n            this.dispatchEvent(new CustomEvent('ui-multi-pick', { detail: { date: d, values: current }, bubbles: true }));\n            this.dispatchEvent(new CustomEvent('change', { detail: { values: current }, bubbles: true, composed: true }));\n            return;\n        }\n\n        let done = true;\n        if (this.range) {\n            // with a whole range chosen, a pick starts a new one (Cally; core pickInRange)\n            const next = pickInRange({ start: this.value, end: this.endValue, active: this.activeField }, iso);\n            this.value = next.start;\n            this.endValue = next.end;\n            this.activeField = next.active;\n            done = next.done;\n        } else {\n            this.value = iso;\n        }\n\n        // ui-range-start / -end first, as Cally's rangestart / rangeend come before its change (a picker changes on ui-pick)\n        if (this.range) this.dispatchEvent(new CustomEvent(done ? 'ui-range-end' : 'ui-range-start', { detail: { date: d }, bubbles: true }));\n        this.dispatchEvent(new CustomEvent('ui-pick', { detail: { date: d }, bubbles: true }));\n        // a range changes once both ends are picked (Cally); ui-pick reports each pick\n        if (done) this.dispatchEvent(new CustomEvent('change', { detail: { value: this.value, endValue: this.endValue }, bubbles: true, composed: true }));\n    }\n\n    /** The pointer's day previews the range; a day that can't be picked leaves the preview where it is (Cally). */\n    private onDayHover(d: Date) {\n        if (!this.unavailable(d)) this.hoverDate = d;\n    }\n\n    /** A clicked day also takes roving focus; one before `min` / after `max` does nothing (Cally: a disabled button). */\n    private onDayClick(d: Date) {\n        if (toIso(clampDate(d, this.limits)) !== toIso(d)) return;\n        this.moveFocus(d);\n        this.pick(d);\n    }\n\n    private moveFocus(d: Date, fromGrid = true) {\n        this.focusFromGrid = fromGrid;\n        if (fromGrid) this.hoverDate = null;\n        this.focusDate = clampDate(d, this.limits);\n        this.dispatchEvent(new CustomEvent('ui-focus-change', { detail: { date: this.focusDate }, bubbles: true }));\n    }\n\n    /** ‹ › turn the page; focus moves only when its day leaves the page (Cally). */\n    private turnPage(by: number) {\n        const start = this.pageStart ?? new Date(this.focusDate.getFullYear(), this.focusDate.getMonth(), 1);\n        const next = turnPage(this.focusDate, start, this.monthCount, by);\n        this.pageStart = next.start;\n        if (next.focus !== this.focusDate) this.moveFocus(next.focus, false);\n    }\n\n    private onGridKeydown(event: KeyboardEvent) {\n        const next = moveByKey(this.focusDate, event.key, event.shiftKey, this.firstDay, this.matches(':dir(rtl)'));\n        if (next) {\n            event.preventDefault();\n            this.moveFocus(next);\n        } else if (event.key === 'Enter' || event.key === ' ') {\n            event.preventDefault();\n            this.pick(this.focusDate);\n        }\n    }\n\n    /** Information marking a day's place in the range (start, end, inside). */\n    private rangeInfo(d: Date) {\n        if (!this.range || !this.value) return { start: false, end: false, inside: false };\n        const shown = shownRange(this.value, this.endValue, this.activeField, toIso(this.hoverDate ?? this.focusDate));\n        return rangePosition(toIso(d), shown.start, shown.end);\n    }\n\n    // ---- Heading (month and year selects) ----\n\n    /** The day the heading's selects move from: the focused day; with several months, that day in the first month (the one they show). */\n    private get yearBase() {\n        if (this.monthCount === 1 || !this.pageStart) return this.focusDate; // several months: the first one's\n        const { pageStart } = this;\n        const days = new Date(pageStart.getFullYear(), pageStart.getMonth() + 1, 0).getDate();\n        return new Date(pageStart.getFullYear(), pageStart.getMonth(), Math.min(this.focusDate.getDate(), days));\n    }\n\n    /** What the heading's selects show (one view for both; each takes its label). */\n    private headingView(label: 'month' | 'year' = 'month'): CalendarHeadingView {\n        const m = this.messages;\n        return { focus: this.yearBase, min: this.min, max: this.max, locale: this.resolvedLocale, era: this.resolvedEra, label: label === 'month' ? (m.month ?? 'Month') : m.year };\n    }\n\n    /** Selects slotted into `heading` (or inside what is slotted there) get the calendar's view, as its own do. */\n    private readonly syncHeading = () => {\n        const slot = this.renderRoot.querySelector<HTMLSlotElement>('slot[name=\"heading\"]');\n        const selects = (slot?.assignedElements({ flatten: true }) ?? []).flatMap((el) => (el.matches(HEADING_SELECTS) ? [el] : [...el.querySelectorAll(HEADING_SELECTS)]));\n        for (const el of selects as (UiCalendarSelectMonth | UiCalendarSelectYear)[]) el.view = this.headingView(el instanceof UiCalendarSelectYear ? 'year' : 'month');\n    };\n\n    /** A heading select's choice moves focus there (Cally `focusday`), without taking DOM focus from the select. */\n    private onHeadingFocusDay(event: CustomEvent<CalendarFocusDayDetail>) {\n        event.stopPropagation();\n        this.moveFocus(event.detail.date, false);\n    }\n\n    // ---- Rendering ----\n\n    /** A day's classes and parts: the parts add Cally's (its weekday `day-N`, `disabled` past min / max, `disallowed`) and `getDayParts`'. */\n    private dayLook(d: Date, month: number, isSelected: boolean) {\n        const range = this.rangeInfo(d);\n        const states = [\n            sameDay(d, this.todayDate) && 'today',\n            d.getMonth() !== month && 'outside',\n            range.start && 'range-start',\n            range.end && 'range-end',\n            range.inside && 'in-range',\n        ].filter((name): name is string => !!name);\n        const outsideLimits = toIso(clampDate(d, this.limits)) !== toIso(d);\n        const refused = !outsideLimits && this.unavailable(d);\n        const parts = ['day', `day-${d.getDay()}`, isSelected && 'selected', ...states, outsideLimits && 'disabled', refused && 'disallowed', this.getDayParts?.(d)];\n        return { classes: ['day', ...states].join(' '), parts: parts.filter(Boolean).join(' ') };\n    }\n\n    private renderDay(d: Date, month: number, selected: Date | null, full: Intl.DateTimeFormat) {\n        const iso = toIso(d);\n        const isMultiSelected = this.multi && this.multiValues.includes(iso);\n        const isSelected = isMultiSelected || sameDay(d, selected) || (this.range && sameDay(d, fromIso(this.endValue)));\n        const isToday = sameDay(d, this.todayDate);\n        const look = this.dayLook(d, month, isSelected);\n\n        return html`<td role=\"gridcell\" part=\"cell\" aria-selected=${isSelected ? 'true' : 'false'}>\n            <button\n                class=${look.classes}\n                part=${look.parts}\n                type=\"button\"\n                tabindex=${sameDay(d, this.focusDate) ? 0 : -1}\n                aria-label=${full.format(d)}\n                aria-pressed=${isSelected ? 'true' : 'false'}\n                aria-current=${isToday ? 'date' : nothing}\n                aria-disabled=${this.unavailable(d) ? 'true' : 'false'}\n                @pointerenter=${() => this.onDayHover(d)}\n                @click=${() => this.onDayClick(d)}\n            >\n                ${d.getDate()}\n            </button>\n        </td>`;\n    }\n\n    /** ‹, the month and year selects (`heading` slot), ›. Several months (Cally): one header over all, the year select only (each grid has its month's name). */\n    private renderMonthHeader(monthDate: Date, lastMonth = monthDate) {\n        const m = this.messages;\n        const prevDisabled = monthNavDisabled(monthDate, this.limits).previous;\n        const nextDisabled = monthNavDisabled(lastMonth, this.limits).next;\n\n        return html`\n            <div class=\"cal-header\" part=\"header\">\n                <button\n                    class=\"nav\"\n                    part=\"nav prev-button\"\n                    type=\"button\"\n                    aria-label=${m.previousMonth}\n                    ?disabled=${prevDisabled}\n                    @pointerdown=${(e: Event) => e.preventDefault()}\n                    @mousedown=${(e: Event) => e.preventDefault()}\n                    @click=${() => this.turnPage(-this.pageStep)}\n                >\n                    <slot name=\"previous\"><svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"m5 8 5-5 .7.7L6.4 8l4.3 4.3-.7.7z\" /></svg></slot>\n                </button>\n                <div class=\"month-year\" part=\"heading\">\n                    <slot name=\"heading\" @ui-focus-day=${this.onHeadingFocusDay} @slotchange=${this.syncHeading}>\n                        ${lastMonth === monthDate ? html`<ui-calendar-select-month exportparts=\"select: month-select\" .view=${this.headingView('month')}></ui-calendar-select-month>` : nothing}\n                        <ui-calendar-select-year exportparts=\"select: year-select\" .view=${this.headingView('year')}></ui-calendar-select-year>\n                    </slot>\n                </div>\n                <button\n                    class=\"nav\"\n                    part=\"nav next-button\"\n                    type=\"button\"\n                    aria-label=${m.nextMonth}\n                    ?disabled=${nextDisabled}\n                    @pointerdown=${(e: Event) => e.preventDefault()}\n                    @mousedown=${(e: Event) => e.preventDefault()}\n                    @click=${() => this.turnPage(this.pageStep)}\n                >\n                    <slot name=\"next\"><svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"m11 8-5 5-.7-.7L9.6 8 5.3 3.7 6 3z\" /></svg></slot>\n                </button>\n            </div>\n        `;\n    }\n\n    /**\n     * One month's grid, named by the live region (several months: after its month and year, as each needs its own name);\n     * `title` (several months): its name above it. Only the month's own days show, in the weeks they fall in (Cally),\n     * unless `show-outside-days` (one month); `show-week-numbers` adds a column of ISO week numbers.\n     */\n    private renderMonthGrid(monthDate: Date, title?: string) {\n        const month = monthDate.getMonth();\n        const allWeeks = monthGrid(monthDate, this.firstDay);\n        const ownDaysOnly = !!title || !this.showOutsideDays;\n        const weeks = ownDaysOnly ? allWeeks.filter((week) => week.some((d) => d.getMonth() === month)) : allWeeks;\n        const selected = fromIso(this.value);\n\n        const weekdays = allWeeks[0];\n        const short = this.weekdayNames();\n        const long = this.dtf({ weekday: 'long' });\n        const full = this.dtf({ dateStyle: 'full' });\n\n        return html`\n            <div class=\"month-view\" part=\"month-view\">\n                ${title ? html`<div class=\"month-title\" part=\"month-title\">${title}</div>` : this.renderMonthHeader(monthDate)}\n                <table\n                    part=\"grid table\"\n                    role=\"grid\"\n                    aria-labelledby=${title ? nothing : `${this.liveId}-month`}\n                    aria-label=${title ? this.dtf({ month: 'long', year: 'numeric' }).format(monthDate) : nothing}\n                    @keydown=${this.onGridKeydown}\n                >\n                    <thead part=\"thead\">\n                        <tr part=\"row\">\n                            ${this.showWeekNumbers ? html`<th class=\"week-number\" part=\"th weeknumber\" scope=\"col\" abbr=${this.messages.week ?? 'Week'}>#</th>` : nothing}\n                            ${weekdays.map((d) => html`<th part=\"th day-${d.getDay()}\" scope=\"col\" abbr=${long.format(d)}>${short(d)}</th>`)}\n                        </tr>\n                    </thead>\n                    <tbody part=\"tbody\">\n                        ${weeks.map(\n                            (week) => html`<tr part=\"row\">\n                                ${this.showWeekNumbers ? html`<th class=\"week-number\" part=\"th weeknumber\" scope=\"row\">${isoWeek(week[0])}</th>` : nothing}\n                                ${week.map((d) => (ownDaysOnly && d.getMonth() !== month ? html`<td role=\"gridcell\" part=\"cell\"></td>` : this.renderDay(d, month, selected, full)))}\n                            </tr>`,\n                        )}\n                    </tbody>\n                </table>\n            </div>\n        `;\n    }\n\n    private renderFooter() {\n        if (!this.showToday) return nothing;\n        const today = this.todayDate;\n        return html`<div class=\"cal-footer\" part=\"footer\">\n            <button class=\"today-button\" part=\"today-button\" type=\"button\" ?disabled=${this.unavailable(today)} @click=${() => this.pick(today)}>\n                ${this.messages.today}\n            </button>\n        </div>`;\n    }\n\n    /** Focus on the day with the tab stop, or with `{ target: 'previous' | 'next' }` on a month arrow (Cally's `focus()`). */\n    override focus(options?: FocusOptions & { target?: 'day' | 'previous' | 'next' }) {\n        const target = options?.target ?? 'day';\n        if (target === 'day') this.focusedDay?.focus(options);\n        else this.renderRoot.querySelector<HTMLButtonElement>(`[part~='${target === 'next' ? 'next-button' : 'prev-button'}']`)?.focus(options);\n    }\n\n    override render() {\n        const count = this.monthCount;\n        const firstMonth = this.pageStart ?? new Date(this.focusDate.getFullYear(), this.focusDate.getMonth(), 1);\n\n        if (count === 1) {\n            return html`\n                <div class=\"months-container\" part=\"months\">${this.renderMonthGrid(firstMonth)}</div>\n                ${this.renderLiveRegion(firstMonth)} ${this.renderFooter()}\n            `;\n        }\n        const months = Array.from({ length: count }, (_, i) => addMonths(firstMonth, i));\n        // each grid's name; with its year when that differs from the one in the header (December | January)\n        const name = (d: Date) => this.dtf(d.getFullYear() === firstMonth.getFullYear() ? { month: 'long' } : { month: 'long', year: 'numeric' }).format(d);\n        return html`\n            ${this.renderMonthHeader(firstMonth, months[count - 1])}\n            <div class=\"months-container\" part=\"months\">${months.map((d) => this.renderMonthGrid(d, name(d)))}</div>\n            ${this.renderLiveRegion(firstMonth)} ${this.renderFooter()}\n        `;\n    }\n\n    private renderLiveRegion(firstMonth: Date) {\n        return html`\n            <div class=\"sr-only\" id=\"${this.liveId}-month\" aria-live=\"polite\">\n                ${this.dtf({ month: 'long', year: 'numeric' }).format(firstMonth)}\n            </div>\n        `;\n    }\n}\n\nexport interface CalendarDateDetail {\n    date: Date;\n}\n\n/** The first and last day on show (`ui-page-change`). */\nexport interface CalendarPageDetail {\n    start: Date;\n    end: Date;\n}\n\nexport interface CalendarMultiDetail {\n    date: Date;\n    values: string[];\n}\n\nexport interface CalendarChangeDetail {\n    value?: string;\n    endValue?: string;\n    values?: string[];\n}\n\nexport interface UiCalendarEventMap extends HTMLElementEventMap {\n    'ui-pick': CustomEvent<CalendarDateDetail>;\n    'ui-multi-pick': CustomEvent<CalendarMultiDetail>;\n    'ui-focus-change': CustomEvent<CalendarDateDetail>;\n    'ui-range-start': CustomEvent<CalendarDateDetail>;\n    'ui-range-end': CustomEvent<CalendarDateDetail>;\n    'ui-page-change': CustomEvent<CalendarPageDetail>;\n    change: CustomEvent<CalendarChangeDetail>;\n}\n\nexport interface UiCalendar {\n    addEventListener<K extends keyof UiCalendarEventMap>(type: K, listener: (this: UiCalendar, event: UiCalendarEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;\n    removeEventListener<K extends keyof UiCalendarEventMap>(type: K, listener: (this: UiCalendar, event: UiCalendarEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;\n    removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;\n}\n\ndeclare global {\n    interface HTMLElementTagNameMap {\n        'ui-calendar': UiCalendar;\n    }\n}\n"
    }
  ]
}
