/* eslint-disable import/prefer-default-export */
import { h } from "@stencil/core";
export class Toolbar {
    constructor() {
        this.activePage = this.currentPage;
    }
    previousPage() {
        if (this.activePage > 1) {
            this.activePage--;
            this.activePageEvent.emit(this.activePage);
        }
    }
    nextPage() {
        if (this.activePage < this.totalPages) {
            this.activePage++;
            this.activePageEvent.emit(this.activePage);
        }
    }
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
    render() {
        return (h("div", { class: "border" },
            h("span", { class: "op06 w pa1 small dib" },
                "Page ",
                this.activePage,
                " of ",
                this.totalPages),
            h("span", { class: "op06 link w pa1 small dib", onClick: () => this.previousPage() }, "Previous"),
            h("span", { class: "op06 link w pa1 small dib", onClick: () => this.nextPage() }, "Next"),
            h("span", { class: "pa1 dib" },
                h("a", { class: "op06 link w small no-underline", href: this.url, target: "_blank" }, "Open file"))));
    }
    static get is() { return "pdf-toolbar"; }
    static get originalStyleUrls() { return {
        "$": ["toolbar.css"]
    }; }
    static get styleUrls() { return {
        "$": ["toolbar.css"]
    }; }
    static get properties() { return {
        "url": {
            "type": "string",
            "mutable": false,
            "complexType": {
                "original": "string",
                "resolved": "string",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "url",
            "reflect": false
        },
        "totalPages": {
            "type": "number",
            "mutable": false,
            "complexType": {
                "original": "number",
                "resolved": "number",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "total-pages",
            "reflect": false
        },
        "currentPage": {
            "type": "number",
            "mutable": false,
            "complexType": {
                "original": "number",
                "resolved": "number",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "current-page",
            "reflect": false
        }
    }; }
    static get states() { return {
        "activePage": {}
    }; }
    static get events() { return [{
            "method": "activePageEvent",
            "name": "activePageEvent",
            "bubbles": true,
            "cancelable": true,
            "composed": true,
            "docs": {
                "tags": [],
                "text": ""
            },
            "complexType": {
                "original": "any",
                "resolved": "any",
                "references": {}
            }
        }]; }
}
