import { ChangeDetectionStrategy, Component, ContentChild, Directive, EventEmitter, inject, Input, Output, TemplateRef, } from '@angular/core';
import { getValueInRange, isNumber } from '../util/util';
import { NgbPaginationConfig } from './pagination-config';
import { NgTemplateOutlet } from '@angular/common';
import * as i0 from "@angular/core";
const _c0 = (a0, a1, a2) => ({ $implicit: a0, pages: a1, disabled: a2 });
const _c1 = a0 => ({ disabled: true, currentPage: a0 });
const _c2 = (a0, a1, a2) => ({ disabled: a0, $implicit: a1, currentPage: a2 });
const _c3 = (a0, a1) => ({ disabled: a0, currentPage: a1 });
const _c4 = a0 => ({ disabled: a0 });
function NgbPagination_ng_template_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 13);
    i0.ɵɵi18n(1, 7);
    i0.ɵɵelementEnd();
} }
function NgbPagination_ng_template_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 13);
    i0.ɵɵi18n(1, 8);
    i0.ɵɵelementEnd();
} }
function NgbPagination_ng_template_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 13);
    i0.ɵɵi18n(1, 9);
    i0.ɵɵelementEnd();
} }
function NgbPagination_ng_template_6_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 13);
    i0.ɵɵi18n(1, 10);
    i0.ɵɵelementEnd();
} }
function NgbPagination_ng_template_8_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵtext(0, "...");
} }
function NgbPagination_ng_template_10_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵtext(0);
} if (rf & 2) {
    const page_r1 = ctx.$implicit;
    i0.ɵɵtextInterpolate(page_r1);
} }
function NgbPagination_ng_template_12_For_1_Conditional_1_ng_template_1_Template(rf, ctx) { }
function NgbPagination_ng_template_12_For_1_Conditional_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "a", 16);
    i0.ɵɵtemplate(1, NgbPagination_ng_template_12_For_1_Conditional_1_ng_template_1_Template, 0, 0, "ng-template", 12);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const page_r2 = i0.ɵɵnextContext(2).$implicit;
    const ctx_r2 = i0.ɵɵnextContext();
    const ellipsis_r4 = i0.ɵɵreference(9);
    i0.ɵɵadvance();
    i0.ɵɵproperty("ngTemplateOutlet", (ctx_r2.tplEllipsis == null ? null : ctx_r2.tplEllipsis.templateRef) || ellipsis_r4)("ngTemplateOutletContext", i0.ɵɵpureFunction1(2, _c1, page_r2));
} }
function NgbPagination_ng_template_12_For_1_Conditional_2_ng_template_1_Template(rf, ctx) { }
function NgbPagination_ng_template_12_For_1_Conditional_2_Template(rf, ctx) { if (rf & 1) {
    const _r5 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "a", 18);
    i0.ɵɵlistener("click", function NgbPagination_ng_template_12_For_1_Conditional_2_Template_a_click_0_listener($event) { i0.ɵɵrestoreView(_r5); const pageNumber_r6 = i0.ɵɵnextContext().$implicit; const ctx_r2 = i0.ɵɵnextContext(2); ctx_r2.selectPage(pageNumber_r6); return i0.ɵɵresetView($event.preventDefault()); });
    i0.ɵɵtemplate(1, NgbPagination_ng_template_12_For_1_Conditional_2_ng_template_1_Template, 0, 0, "ng-template", 12);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const pageNumber_r6 = i0.ɵɵnextContext().$implicit;
    const ctx_r6 = i0.ɵɵnextContext();
    const page_r2 = ctx_r6.$implicit;
    const disabled_r8 = ctx_r6.disabled;
    const ctx_r2 = i0.ɵɵnextContext();
    const defaultNumber_r9 = i0.ɵɵreference(11);
    i0.ɵɵattribute("tabindex", disabled_r8 ? "-1" : null)("aria-disabled", disabled_r8 ? "true" : null);
    i0.ɵɵadvance();
    i0.ɵɵproperty("ngTemplateOutlet", (ctx_r2.tplNumber == null ? null : ctx_r2.tplNumber.templateRef) || defaultNumber_r9)("ngTemplateOutletContext", i0.ɵɵpureFunction3(4, _c2, disabled_r8, pageNumber_r6, page_r2));
} }
function NgbPagination_ng_template_12_For_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "li", 15);
    i0.ɵɵtemplate(1, NgbPagination_ng_template_12_For_1_Conditional_1_Template, 2, 4, "a", 16)(2, NgbPagination_ng_template_12_For_1_Conditional_2_Template, 2, 8, "a", 17);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const pageNumber_r6 = ctx.$implicit;
    const ctx_r6 = i0.ɵɵnextContext();
    const page_r2 = ctx_r6.$implicit;
    const disabled_r8 = ctx_r6.disabled;
    const ctx_r2 = i0.ɵɵnextContext();
    i0.ɵɵclassProp("active", pageNumber_r6 === page_r2)("disabled", ctx_r2.isEllipsis(pageNumber_r6) || disabled_r8);
    i0.ɵɵattribute("aria-current", pageNumber_r6 === page_r2 ? "page" : null);
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r2.isEllipsis(pageNumber_r6) ? 1 : 2);
} }
function NgbPagination_ng_template_12_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵrepeaterCreate(0, NgbPagination_ng_template_12_For_1_Template, 3, 6, "li", 14, i0.ɵɵrepeaterTrackByIndex);
} if (rf & 2) {
    const pages_r10 = ctx.pages;
    i0.ɵɵrepeater(pages_r10);
} }
function NgbPagination_Conditional_15_ng_template_2_Template(rf, ctx) { }
function NgbPagination_Conditional_15_Template(rf, ctx) { if (rf & 1) {
    const _r11 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "li", 15)(1, "a", 19);
    i0.ɵɵlistener("click", function NgbPagination_Conditional_15_Template_a_click_1_listener($event) { i0.ɵɵrestoreView(_r11); const ctx_r2 = i0.ɵɵnextContext(); ctx_r2.selectPage(1); return i0.ɵɵresetView($event.preventDefault()); });
    i0.ɵɵtemplate(2, NgbPagination_Conditional_15_ng_template_2_Template, 0, 0, "ng-template", 12);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r2 = i0.ɵɵnextContext();
    const first_r12 = i0.ɵɵreference(1);
    i0.ɵɵclassProp("disabled", ctx_r2.previousDisabled());
    i0.ɵɵadvance();
    i0.ɵɵattribute("tabindex", ctx_r2.previousDisabled() ? "-1" : null)("aria-disabled", ctx_r2.previousDisabled() ? "true" : null);
    i0.ɵɵadvance();
    i0.ɵɵproperty("ngTemplateOutlet", (ctx_r2.tplFirst == null ? null : ctx_r2.tplFirst.templateRef) || first_r12)("ngTemplateOutletContext", i0.ɵɵpureFunction2(6, _c3, ctx_r2.previousDisabled(), ctx_r2.page));
} }
function NgbPagination_Conditional_16_ng_template_2_Template(rf, ctx) { }
function NgbPagination_Conditional_16_Template(rf, ctx) { if (rf & 1) {
    const _r13 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "li", 15)(1, "a", 20);
    i0.ɵɵlistener("click", function NgbPagination_Conditional_16_Template_a_click_1_listener($event) { i0.ɵɵrestoreView(_r13); const ctx_r2 = i0.ɵɵnextContext(); ctx_r2.selectPage(ctx_r2.page - 1); return i0.ɵɵresetView($event.preventDefault()); });
    i0.ɵɵtemplate(2, NgbPagination_Conditional_16_ng_template_2_Template, 0, 0, "ng-template", 12);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r2 = i0.ɵɵnextContext();
    const previous_r14 = i0.ɵɵreference(3);
    i0.ɵɵclassProp("disabled", ctx_r2.previousDisabled());
    i0.ɵɵadvance();
    i0.ɵɵattribute("tabindex", ctx_r2.previousDisabled() ? "-1" : null)("aria-disabled", ctx_r2.previousDisabled() ? "true" : null);
    i0.ɵɵadvance();
    i0.ɵɵproperty("ngTemplateOutlet", (ctx_r2.tplPrevious == null ? null : ctx_r2.tplPrevious.templateRef) || previous_r14)("ngTemplateOutletContext", i0.ɵɵpureFunction1(6, _c4, ctx_r2.previousDisabled()));
} }
function NgbPagination_ng_template_17_Template(rf, ctx) { }
function NgbPagination_Conditional_18_ng_template_2_Template(rf, ctx) { }
function NgbPagination_Conditional_18_Template(rf, ctx) { if (rf & 1) {
    const _r15 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "li", 15)(1, "a", 21);
    i0.ɵɵlistener("click", function NgbPagination_Conditional_18_Template_a_click_1_listener($event) { i0.ɵɵrestoreView(_r15); const ctx_r2 = i0.ɵɵnextContext(); ctx_r2.selectPage(ctx_r2.page + 1); return i0.ɵɵresetView($event.preventDefault()); });
    i0.ɵɵtemplate(2, NgbPagination_Conditional_18_ng_template_2_Template, 0, 0, "ng-template", 12);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r2 = i0.ɵɵnextContext();
    const next_r16 = i0.ɵɵreference(5);
    i0.ɵɵclassProp("disabled", ctx_r2.nextDisabled());
    i0.ɵɵadvance();
    i0.ɵɵattribute("tabindex", ctx_r2.nextDisabled() ? "-1" : null)("aria-disabled", ctx_r2.nextDisabled() ? "true" : null);
    i0.ɵɵadvance();
    i0.ɵɵproperty("ngTemplateOutlet", (ctx_r2.tplNext == null ? null : ctx_r2.tplNext.templateRef) || next_r16)("ngTemplateOutletContext", i0.ɵɵpureFunction2(6, _c3, ctx_r2.nextDisabled(), ctx_r2.page));
} }
function NgbPagination_Conditional_19_ng_template_2_Template(rf, ctx) { }
function NgbPagination_Conditional_19_Template(rf, ctx) { if (rf & 1) {
    const _r17 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "li", 15)(1, "a", 22);
    i0.ɵɵlistener("click", function NgbPagination_Conditional_19_Template_a_click_1_listener($event) { i0.ɵɵrestoreView(_r17); const ctx_r2 = i0.ɵɵnextContext(); ctx_r2.selectPage(ctx_r2.pageCount); return i0.ɵɵresetView($event.preventDefault()); });
    i0.ɵɵtemplate(2, NgbPagination_Conditional_19_ng_template_2_Template, 0, 0, "ng-template", 12);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r2 = i0.ɵɵnextContext();
    const last_r18 = i0.ɵɵreference(7);
    i0.ɵɵclassProp("disabled", ctx_r2.nextDisabled());
    i0.ɵɵadvance();
    i0.ɵɵattribute("tabindex", ctx_r2.nextDisabled() ? "-1" : null)("aria-disabled", ctx_r2.nextDisabled() ? "true" : null);
    i0.ɵɵadvance();
    i0.ɵɵproperty("ngTemplateOutlet", (ctx_r2.tplLast == null ? null : ctx_r2.tplLast.templateRef) || last_r18)("ngTemplateOutletContext", i0.ɵɵpureFunction2(6, _c3, ctx_r2.nextDisabled(), ctx_r2.page));
} }
/**
 * A directive to match the 'ellipsis' link template
 *
 * @since 4.1.0
 */
export class NgbPaginationEllipsis {
    constructor() {
        this.templateRef = inject((TemplateRef));
    }
    static { this.ɵfac = function NgbPaginationEllipsis_Factory(t) { return new (t || NgbPaginationEllipsis)(); }; }
    static { this.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: NgbPaginationEllipsis, selectors: [["ng-template", "ngbPaginationEllipsis", ""]], standalone: true }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NgbPaginationEllipsis, [{
        type: Directive,
        args: [{ selector: 'ng-template[ngbPaginationEllipsis]', standalone: true }]
    }], null, null); })();
/**
 * A directive to match the 'first' link template
 *
 * @since 4.1.0
 */
export class NgbPaginationFirst {
    constructor() {
        this.templateRef = inject((TemplateRef));
    }
    static { this.ɵfac = function NgbPaginationFirst_Factory(t) { return new (t || NgbPaginationFirst)(); }; }
    static { this.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: NgbPaginationFirst, selectors: [["ng-template", "ngbPaginationFirst", ""]], standalone: true }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NgbPaginationFirst, [{
        type: Directive,
        args: [{ selector: 'ng-template[ngbPaginationFirst]', standalone: true }]
    }], null, null); })();
/**
 * A directive to match the 'last' link template
 *
 * @since 4.1.0
 */
export class NgbPaginationLast {
    constructor() {
        this.templateRef = inject((TemplateRef));
    }
    static { this.ɵfac = function NgbPaginationLast_Factory(t) { return new (t || NgbPaginationLast)(); }; }
    static { this.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: NgbPaginationLast, selectors: [["ng-template", "ngbPaginationLast", ""]], standalone: true }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NgbPaginationLast, [{
        type: Directive,
        args: [{ selector: 'ng-template[ngbPaginationLast]', standalone: true }]
    }], null, null); })();
/**
 * A directive to match the 'next' link template
 *
 * @since 4.1.0
 */
export class NgbPaginationNext {
    constructor() {
        this.templateRef = inject((TemplateRef));
    }
    static { this.ɵfac = function NgbPaginationNext_Factory(t) { return new (t || NgbPaginationNext)(); }; }
    static { this.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: NgbPaginationNext, selectors: [["ng-template", "ngbPaginationNext", ""]], standalone: true }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NgbPaginationNext, [{
        type: Directive,
        args: [{ selector: 'ng-template[ngbPaginationNext]', standalone: true }]
    }], null, null); })();
/**
 * A directive to match the page 'number' link template
 *
 * @since 4.1.0
 */
export class NgbPaginationNumber {
    constructor() {
        this.templateRef = inject((TemplateRef));
    }
    static { this.ɵfac = function NgbPaginationNumber_Factory(t) { return new (t || NgbPaginationNumber)(); }; }
    static { this.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: NgbPaginationNumber, selectors: [["ng-template", "ngbPaginationNumber", ""]], standalone: true }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NgbPaginationNumber, [{
        type: Directive,
        args: [{ selector: 'ng-template[ngbPaginationNumber]', standalone: true }]
    }], null, null); })();
/**
 * A directive to match the 'previous' link template
 *
 * @since 4.1.0
 */
export class NgbPaginationPrevious {
    constructor() {
        this.templateRef = inject((TemplateRef));
    }
    static { this.ɵfac = function NgbPaginationPrevious_Factory(t) { return new (t || NgbPaginationPrevious)(); }; }
    static { this.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: NgbPaginationPrevious, selectors: [["ng-template", "ngbPaginationPrevious", ""]], standalone: true }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NgbPaginationPrevious, [{
        type: Directive,
        args: [{ selector: 'ng-template[ngbPaginationPrevious]', standalone: true }]
    }], null, null); })();
/**
 * A directive to match the 'pages' whole content
 *
 * @since 9.1.0
 */
export class NgbPaginationPages {
    constructor() {
        this.templateRef = inject((TemplateRef));
    }
    static { this.ɵfac = function NgbPaginationPages_Factory(t) { return new (t || NgbPaginationPages)(); }; }
    static { this.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: NgbPaginationPages, selectors: [["ng-template", "ngbPaginationPages", ""]], standalone: true }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NgbPaginationPages, [{
        type: Directive,
        args: [{ selector: 'ng-template[ngbPaginationPages]', standalone: true }]
    }], null, null); })();
/**
 * A component that displays page numbers and allows to customize them in several ways.
 */
export class NgbPagination {
    constructor() {
        this._config = inject(NgbPaginationConfig);
        this.pageCount = 0;
        this.pages = [];
        /**
         * If `true`, pagination links will be disabled.
         */
        this.disabled = this._config.disabled;
        /**
         * If `true`, the "First" and "Last" page links are shown.
         */
        this.boundaryLinks = this._config.boundaryLinks;
        /**
         * If `true`, the "Next" and "Previous" page links are shown.
         */
        this.directionLinks = this._config.directionLinks;
        /**
         * If `true`, the ellipsis symbols and first/last page numbers will be shown when `maxSize` > number of pages.
         */
        this.ellipses = this._config.ellipses;
        /**
         * Whether to rotate pages when `maxSize` > number of pages.
         *
         * The current page always stays in the middle if `true`.
         */
        this.rotate = this._config.rotate;
        /**
         *  The maximum number of pages to display.
         */
        this.maxSize = this._config.maxSize;
        /**
         *  The current page.
         *
         *  Page numbers start with `1`.
         */
        this.page = 1;
        /**
         *  The number of items per page.
         */
        this.pageSize = this._config.pageSize;
        /**
         *  An event fired when the page is changed. Will fire only if collection size is set and all values are valid.
         *
         *  Event payload is the number of the newly selected page.
         *
         *  Page numbers start with `1`.
         */
        this.pageChange = new EventEmitter(true);
        /**
         * The pagination display size.
         *
         * Bootstrap currently supports small and large sizes.
         *
         * If the passed value is a string (ex. 'custom'), it will just add the `pagination-custom` css class
         */
        this.size = this._config.size;
    }
    hasPrevious() {
        return this.page > 1;
    }
    hasNext() {
        return this.page < this.pageCount;
    }
    nextDisabled() {
        return !this.hasNext() || this.disabled;
    }
    previousDisabled() {
        return !this.hasPrevious() || this.disabled;
    }
    selectPage(pageNumber) {
        this._updatePages(pageNumber);
    }
    ngOnChanges(changes) {
        this._updatePages(this.page);
    }
    isEllipsis(pageNumber) {
        return pageNumber === -1;
    }
    /**
     * Appends ellipses and first/last page number to the displayed pages
     */
    _applyEllipses(start, end) {
        if (this.ellipses) {
            if (start > 0) {
                // The first page will always be included. If the displayed range
                // starts after the third page, then add ellipsis. But if the range
                // starts on the third page, then add the second page instead of
                // an ellipsis, because the ellipsis would only hide a single page.
                if (start > 2) {
                    this.pages.unshift(-1);
                }
                else if (start === 2) {
                    this.pages.unshift(2);
                }
                this.pages.unshift(1);
            }
            if (end < this.pageCount) {
                // The last page will always be included. If the displayed range
                // ends before the third-last page, then add ellipsis. But if the range
                // ends on third-last page, then add the second-last page instead of
                // an ellipsis, because the ellipsis would only hide a single page.
                if (end < this.pageCount - 2) {
                    this.pages.push(-1);
                }
                else if (end === this.pageCount - 2) {
                    this.pages.push(this.pageCount - 1);
                }
                this.pages.push(this.pageCount);
            }
        }
    }
    /**
     * Rotates page numbers based on maxSize items visible.
     * Currently selected page stays in the middle:
     *
     * Ex. for selected page = 6:
     * [5,*6*,7] for maxSize = 3
     * [4,5,*6*,7] for maxSize = 4
     */
    _applyRotation() {
        let start = 0;
        let end = this.pageCount;
        let leftOffset = Math.floor(this.maxSize / 2);
        let rightOffset = this.maxSize % 2 === 0 ? leftOffset - 1 : leftOffset;
        if (this.page <= leftOffset) {
            // very beginning, no rotation -> [0..maxSize]
            end = this.maxSize;
        }
        else if (this.pageCount - this.page < leftOffset) {
            // very end, no rotation -> [len-maxSize..len]
            start = this.pageCount - this.maxSize;
        }
        else {
            // rotate
            start = this.page - leftOffset - 1;
            end = this.page + rightOffset;
        }
        return [start, end];
    }
    /**
     * Paginates page numbers based on maxSize items per page.
     */
    _applyPagination() {
        let page = Math.ceil(this.page / this.maxSize) - 1;
        let start = page * this.maxSize;
        let end = start + this.maxSize;
        return [start, end];
    }
    _setPageInRange(newPageNo) {
        const prevPageNo = this.page;
        this.page = getValueInRange(newPageNo, this.pageCount, 1);
        if (this.page !== prevPageNo && isNumber(this.collectionSize)) {
            this.pageChange.emit(this.page);
        }
    }
    _updatePages(newPage) {
        this.pageCount = Math.ceil(this.collectionSize / this.pageSize);
        if (!isNumber(this.pageCount)) {
            this.pageCount = 0;
        }
        // fill-in model needed to render pages
        this.pages.length = 0;
        for (let i = 1; i <= this.pageCount; i++) {
            this.pages.push(i);
        }
        // set page within 1..max range
        this._setPageInRange(newPage);
        // apply maxSize if necessary
        if (this.maxSize > 0 && this.pageCount > this.maxSize) {
            let start = 0;
            let end = this.pageCount;
            // either paginating or rotating page numbers
            if (this.rotate) {
                [start, end] = this._applyRotation();
            }
            else {
                [start, end] = this._applyPagination();
            }
            this.pages = this.pages.slice(start, end);
            // adding ellipses
            this._applyEllipses(start, end);
        }
    }
    static { this.ɵfac = function NgbPagination_Factory(t) { return new (t || NgbPagination)(); }; }
    static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: NgbPagination, selectors: [["ngb-pagination"]], contentQueries: function NgbPagination_ContentQueries(rf, ctx, dirIndex) { if (rf & 1) {
            i0.ɵɵcontentQuery(dirIndex, NgbPaginationEllipsis, 5);
            i0.ɵɵcontentQuery(dirIndex, NgbPaginationFirst, 5);
            i0.ɵɵcontentQuery(dirIndex, NgbPaginationLast, 5);
            i0.ɵɵcontentQuery(dirIndex, NgbPaginationNext, 5);
            i0.ɵɵcontentQuery(dirIndex, NgbPaginationNumber, 5);
            i0.ɵɵcontentQuery(dirIndex, NgbPaginationPrevious, 5);
            i0.ɵɵcontentQuery(dirIndex, NgbPaginationPages, 5);
        } if (rf & 2) {
            let _t;
            i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.tplEllipsis = _t.first);
            i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.tplFirst = _t.first);
            i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.tplLast = _t.first);
            i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.tplNext = _t.first);
            i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.tplNumber = _t.first);
            i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.tplPrevious = _t.first);
            i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.tplPages = _t.first);
        } }, hostAttrs: ["role", "navigation"], inputs: { disabled: "disabled", boundaryLinks: "boundaryLinks", directionLinks: "directionLinks", ellipses: "ellipses", rotate: "rotate", collectionSize: "collectionSize", maxSize: "maxSize", page: "page", pageSize: "pageSize", size: "size" }, outputs: { pageChange: "pageChange" }, standalone: true, features: [i0.ɵɵNgOnChangesFeature, i0.ɵɵStandaloneFeature], decls: 20, vars: 12, consts: () => { let i18n_0; if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
            /**
             * @suppress {msgDescriptions}
             */
            const MSG_EXTERNAL_ngb_pagination_first$$PAGINATION_PAGINATION_TS_0 = goog.getMsg("\u00AB\u00AB");
            i18n_0 = MSG_EXTERNAL_ngb_pagination_first$$PAGINATION_PAGINATION_TS_0;
        }
        else {
            i18n_0 = $localize `:@@ngb.pagination.first:««`;
        } let i18n_1; if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
            /**
             * @suppress {msgDescriptions}
             */
            const MSG_EXTERNAL_ngb_pagination_previous$$PAGINATION_PAGINATION_TS_1 = goog.getMsg("\u00AB");
            i18n_1 = MSG_EXTERNAL_ngb_pagination_previous$$PAGINATION_PAGINATION_TS_1;
        }
        else {
            i18n_1 = $localize `:@@ngb.pagination.previous:«`;
        } let i18n_2; if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
            /**
             * @suppress {msgDescriptions}
             */
            const MSG_EXTERNAL_ngb_pagination_next$$PAGINATION_PAGINATION_TS_2 = goog.getMsg("\u00BB");
            i18n_2 = MSG_EXTERNAL_ngb_pagination_next$$PAGINATION_PAGINATION_TS_2;
        }
        else {
            i18n_2 = $localize `:@@ngb.pagination.next:»`;
        } let i18n_3; if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
            /**
             * @suppress {msgDescriptions}
             */
            const MSG_EXTERNAL_ngb_pagination_last$$PAGINATION_PAGINATION_TS_3 = goog.getMsg("\u00BB\u00BB");
            i18n_3 = MSG_EXTERNAL_ngb_pagination_last$$PAGINATION_PAGINATION_TS_3;
        }
        else {
            i18n_3 = $localize `:@@ngb.pagination.last:»»`;
        } let i18n_4; if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
            /**
             * @suppress {msgDescriptions}
             */
            const MSG_EXTERNAL_ngb_pagination_first_aria$$PAGINATION_PAGINATION_TS_4 = goog.getMsg("First");
            i18n_4 = MSG_EXTERNAL_ngb_pagination_first_aria$$PAGINATION_PAGINATION_TS_4;
        }
        else {
            i18n_4 = $localize `:@@ngb.pagination.first-aria:First`;
        } let i18n_5; if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
            /**
             * @suppress {msgDescriptions}
             */
            const MSG_EXTERNAL_ngb_pagination_previous_aria$$PAGINATION_PAGINATION_TS_5 = goog.getMsg("Previous");
            i18n_5 = MSG_EXTERNAL_ngb_pagination_previous_aria$$PAGINATION_PAGINATION_TS_5;
        }
        else {
            i18n_5 = $localize `:@@ngb.pagination.previous-aria:Previous`;
        } let i18n_6; if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
            /**
             * @suppress {msgDescriptions}
             */
            const MSG_EXTERNAL_ngb_pagination_next_aria$$PAGINATION_PAGINATION_TS_6 = goog.getMsg("Next");
            i18n_6 = MSG_EXTERNAL_ngb_pagination_next_aria$$PAGINATION_PAGINATION_TS_6;
        }
        else {
            i18n_6 = $localize `:@@ngb.pagination.next-aria:Next`;
        } let i18n_7; if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
            /**
             * @suppress {msgDescriptions}
             */
            const MSG_EXTERNAL_ngb_pagination_last_aria$$PAGINATION_PAGINATION_TS_7 = goog.getMsg("Last");
            i18n_7 = MSG_EXTERNAL_ngb_pagination_last_aria$$PAGINATION_PAGINATION_TS_7;
        }
        else {
            i18n_7 = $localize `:@@ngb.pagination.last-aria:Last`;
        } return [["first", ""], ["previous", ""], ["next", ""], ["last", ""], ["ellipsis", ""], ["defaultNumber", ""], ["defaultPages", ""], i18n_0, i18n_1, i18n_2, i18n_3, [1, "page-item", 3, "disabled"], [3, "ngTemplateOutlet", "ngTemplateOutletContext"], ["aria-hidden", "true"], [1, "page-item", 3, "active", "disabled"], [1, "page-item"], ["tabindex", "-1", "aria-disabled", "true", 1, "page-link"], ["href", "", 1, "page-link"], ["href", "", 1, "page-link", 3, "click"], ["aria-label", i18n_4, "href", "", 1, "page-link", 3, "click"], ["aria-label", i18n_5, "href", "", 1, "page-link", 3, "click"], ["aria-label", i18n_6, "href", "", 1, "page-link", 3, "click"], ["aria-label", i18n_7, "href", "", 1, "page-link", 3, "click"]]; }, template: function NgbPagination_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵtemplate(0, NgbPagination_ng_template_0_Template, 2, 0, "ng-template", null, 0, i0.ɵɵtemplateRefExtractor)(2, NgbPagination_ng_template_2_Template, 2, 0, "ng-template", null, 1, i0.ɵɵtemplateRefExtractor)(4, NgbPagination_ng_template_4_Template, 2, 0, "ng-template", null, 2, i0.ɵɵtemplateRefExtractor)(6, NgbPagination_ng_template_6_Template, 2, 0, "ng-template", null, 3, i0.ɵɵtemplateRefExtractor)(8, NgbPagination_ng_template_8_Template, 1, 0, "ng-template", null, 4, i0.ɵɵtemplateRefExtractor)(10, NgbPagination_ng_template_10_Template, 1, 1, "ng-template", null, 5, i0.ɵɵtemplateRefExtractor)(12, NgbPagination_ng_template_12_Template, 2, 0, "ng-template", null, 6, i0.ɵɵtemplateRefExtractor);
            i0.ɵɵelementStart(14, "ul");
            i0.ɵɵtemplate(15, NgbPagination_Conditional_15_Template, 3, 9, "li", 11)(16, NgbPagination_Conditional_16_Template, 3, 8, "li", 11)(17, NgbPagination_ng_template_17_Template, 0, 0, "ng-template", 12)(18, NgbPagination_Conditional_18_Template, 3, 9, "li", 11)(19, NgbPagination_Conditional_19_Template, 3, 9, "li", 11);
            i0.ɵɵelementEnd();
        } if (rf & 2) {
            const defaultPages_r19 = i0.ɵɵreference(13);
            i0.ɵɵadvance(14);
            i0.ɵɵclassMap("pagination" + (ctx.size ? " pagination-" + ctx.size : ""));
            i0.ɵɵadvance();
            i0.ɵɵconditional(ctx.boundaryLinks ? 15 : -1);
            i0.ɵɵadvance();
            i0.ɵɵconditional(ctx.directionLinks ? 16 : -1);
            i0.ɵɵadvance();
            i0.ɵɵproperty("ngTemplateOutlet", (ctx.tplPages == null ? null : ctx.tplPages.templateRef) || defaultPages_r19)("ngTemplateOutletContext", i0.ɵɵpureFunction3(8, _c0, ctx.page, ctx.pages, ctx.disabled));
            i0.ɵɵadvance();
            i0.ɵɵconditional(ctx.directionLinks ? 18 : -1);
            i0.ɵɵadvance();
            i0.ɵɵconditional(ctx.boundaryLinks ? 19 : -1);
        } }, dependencies: [NgTemplateOutlet], encapsulation: 2, changeDetection: 0 }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NgbPagination, [{
        type: Component,
        args: [{
                selector: 'ngb-pagination',
                standalone: true,
                imports: [NgTemplateOutlet],
                changeDetection: ChangeDetectionStrategy.OnPush,
                host: {
                    role: 'navigation',
                },
                template: `
		<ng-template #first><span aria-hidden="true" i18n="@@ngb.pagination.first">&laquo;&laquo;</span></ng-template>
		<ng-template #previous><span aria-hidden="true" i18n="@@ngb.pagination.previous">&laquo;</span></ng-template>
		<ng-template #next><span aria-hidden="true" i18n="@@ngb.pagination.next">&raquo;</span></ng-template>
		<ng-template #last><span aria-hidden="true" i18n="@@ngb.pagination.last">&raquo;&raquo;</span></ng-template>
		<ng-template #ellipsis>...</ng-template>
		<ng-template #defaultNumber let-page let-currentPage="currentPage">{{ page }}</ng-template>
		<ng-template #defaultPages let-page let-pages="pages" let-disabled="disabled">
			@for (pageNumber of pages; track $index) {
				<li
					class="page-item"
					[class.active]="pageNumber === page"
					[class.disabled]="isEllipsis(pageNumber) || disabled"
					[attr.aria-current]="pageNumber === page ? 'page' : null"
				>
					@if (isEllipsis(pageNumber)) {
						<a class="page-link" tabindex="-1" aria-disabled="true">
							<ng-template
								[ngTemplateOutlet]="tplEllipsis?.templateRef || ellipsis"
								[ngTemplateOutletContext]="{ disabled: true, currentPage: page }"
							/>
						</a>
					} @else {
						<a
							class="page-link"
							href
							(click)="selectPage(pageNumber); $event.preventDefault()"
							[attr.tabindex]="disabled ? '-1' : null"
							[attr.aria-disabled]="disabled ? 'true' : null"
						>
							<ng-template
								[ngTemplateOutlet]="tplNumber?.templateRef || defaultNumber"
								[ngTemplateOutletContext]="{ disabled: disabled, $implicit: pageNumber, currentPage: page }"
							/>
						</a>
					}
				</li>
			}
		</ng-template>
		<ul [class]="'pagination' + (size ? ' pagination-' + size : '')">
			@if (boundaryLinks) {
				<li class="page-item" [class.disabled]="previousDisabled()">
					<a
						aria-label="First"
						i18n-aria-label="@@ngb.pagination.first-aria"
						class="page-link"
						href
						(click)="selectPage(1); $event.preventDefault()"
						[attr.tabindex]="previousDisabled() ? '-1' : null"
						[attr.aria-disabled]="previousDisabled() ? 'true' : null"
					>
						<ng-template
							[ngTemplateOutlet]="tplFirst?.templateRef || first"
							[ngTemplateOutletContext]="{ disabled: previousDisabled(), currentPage: page }"
						/>
					</a>
				</li>
			}
			@if (directionLinks) {
				<li class="page-item" [class.disabled]="previousDisabled()">
					<a
						aria-label="Previous"
						i18n-aria-label="@@ngb.pagination.previous-aria"
						class="page-link"
						href
						(click)="selectPage(page - 1); $event.preventDefault()"
						[attr.tabindex]="previousDisabled() ? '-1' : null"
						[attr.aria-disabled]="previousDisabled() ? 'true' : null"
					>
						<ng-template
							[ngTemplateOutlet]="tplPrevious?.templateRef || previous"
							[ngTemplateOutletContext]="{ disabled: previousDisabled() }"
						/>
					</a>
				</li>
			}
			<ng-template
				[ngTemplateOutlet]="tplPages?.templateRef || defaultPages"
				[ngTemplateOutletContext]="{ $implicit: page, pages: pages, disabled: disabled }"
			/>
			@if (directionLinks) {
				<li class="page-item" [class.disabled]="nextDisabled()">
					<a
						aria-label="Next"
						i18n-aria-label="@@ngb.pagination.next-aria"
						class="page-link"
						href
						(click)="selectPage(page + 1); $event.preventDefault()"
						[attr.tabindex]="nextDisabled() ? '-1' : null"
						[attr.aria-disabled]="nextDisabled() ? 'true' : null"
					>
						<ng-template
							[ngTemplateOutlet]="tplNext?.templateRef || next"
							[ngTemplateOutletContext]="{ disabled: nextDisabled(), currentPage: page }"
						/>
					</a>
				</li>
			}
			@if (boundaryLinks) {
				<li class="page-item" [class.disabled]="nextDisabled()">
					<a
						aria-label="Last"
						i18n-aria-label="@@ngb.pagination.last-aria"
						class="page-link"
						href
						(click)="selectPage(pageCount); $event.preventDefault()"
						[attr.tabindex]="nextDisabled() ? '-1' : null"
						[attr.aria-disabled]="nextDisabled() ? 'true' : null"
					>
						<ng-template
							[ngTemplateOutlet]="tplLast?.templateRef || last"
							[ngTemplateOutletContext]="{ disabled: nextDisabled(), currentPage: page }"
						/>
					</a>
				</li>
			}
		</ul>
	`,
            }]
    }], null, { tplEllipsis: [{
            type: ContentChild,
            args: [NgbPaginationEllipsis, { static: false }]
        }], tplFirst: [{
            type: ContentChild,
            args: [NgbPaginationFirst, { static: false }]
        }], tplLast: [{
            type: ContentChild,
            args: [NgbPaginationLast, { static: false }]
        }], tplNext: [{
            type: ContentChild,
            args: [NgbPaginationNext, { static: false }]
        }], tplNumber: [{
            type: ContentChild,
            args: [NgbPaginationNumber, { static: false }]
        }], tplPrevious: [{
            type: ContentChild,
            args: [NgbPaginationPrevious, { static: false }]
        }], tplPages: [{
            type: ContentChild,
            args: [NgbPaginationPages, { static: false }]
        }], disabled: [{
            type: Input
        }], boundaryLinks: [{
            type: Input
        }], directionLinks: [{
            type: Input
        }], ellipses: [{
            type: Input
        }], rotate: [{
            type: Input
        }], collectionSize: [{
            type: Input,
            args: [{ required: true }]
        }], maxSize: [{
            type: Input
        }], page: [{
            type: Input
        }], pageSize: [{
            type: Input
        }], pageChange: [{
            type: Output
        }], size: [{
            type: Input
        }] }); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(NgbPagination, { className: "NgbPagination", filePath: "pagination\\pagination.ts", lineNumber: 280 }); })();
//# sourceMappingURL=data:application/json;base64, 