// #region Imports
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Slottable } from '../../../Behaviors/Slottable';
import { IntersectionAnchorController } from '../../../Controllers/IntersectionAnchorController';
import { Attribute } from '../../../Decorators/AttributeDecorator';
import { Component } from '../../../Decorators/ComponentDecorator';
import { CustomElement } from '../../Abstracts/CustomElement';
import { scrollElementTemplate } from './ScrollElementTemplate';
import { scrollElementJoyStyle } from './Themes/ScrollElement.Joy';
import { scrollElementMemphisStyle } from './Themes/ScrollElement.Memphis';
import { scrollElementCosmopolitanStyle } from './Themes/ScrollElement.Cosmopolitan';
import { Themeable } from '../../../Behaviors/Themeable';
// #endregion
/**
 * The `{@link ScrollElement}` element.
 *
 * @slot - The default content slot.
 *
 * @public
 */
let ScrollElement = class ScrollElement extends Themeable(Slottable(CustomElement)) {
    // #region Fields
    _intersectionAnchorController;
    _isAtScrollTop;
    _isAtScrollBottom;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._isAtScrollTop = false;
        this._isAtScrollBottom = false;
        this._intersectionAnchorController = new IntersectionAnchorController(this, {
            target: '[part="scroller"]',
            anchor: {
                top: '[part="anchorTop"]',
                bottom: '[part="anchorBottom"]'
            },
            callback: (anchor) => {
                this.isAtScrollTop = anchor.isAtScrollTop;
                this.isAtScrollBottom = anchor.isAtScrollBottom;
            }
        });
    }
    // #endregion
    // #region Properties
    /**
     * Returns the `{@link is}` property.
     * The `{@link is}` property represents natural name of this element.
     *
     * @public
     * @static
     * @readonly
     */
    static get is() {
        return 'mosaik-scroll';
    }
    /**
     * Gets or sets the `isAtScrollTop` property.
     *
     * @public
     * @readonly
     * @attr
     */
    get isAtScrollTop() {
        return this._isAtScrollTop;
    }
    set isAtScrollTop(value) {
        if (this._isAtScrollTop !== value) {
            this._isAtScrollTop = value;
            this.requestUpdate('isAtScrollTop');
        }
    }
    /**
     * Gets or sets the `isAtScrollBottom` property.
     *
     * @public
     * @readonly
     * @attr
     */
    get isAtScrollBottom() {
        return this._isAtScrollBottom;
    }
    set isAtScrollBottom(value) {
        if (this._isAtScrollBottom !== value) {
            this._isAtScrollBottom = value;
            this.requestUpdate('isAtScrollBottom');
        }
    }
};
__decorate([
    Attribute({ type: Boolean, useDefault: true }),
    __metadata("design:type", Boolean),
    __metadata("design:paramtypes", [Boolean])
], ScrollElement.prototype, "isAtScrollTop", null);
__decorate([
    Attribute({ type: Boolean, useDefault: true }),
    __metadata("design:type", Boolean),
    __metadata("design:paramtypes", [Boolean])
], ScrollElement.prototype, "isAtScrollBottom", null);
ScrollElement = __decorate([
    Component({
        selector: 'mosaik-scroll',
        template: scrollElementTemplate,
        themes: {
            joy: scrollElementJoyStyle,
            memphis: scrollElementMemphisStyle,
            cosmopolitan: scrollElementCosmopolitanStyle
        },
        imports: []
    }),
    __metadata("design:paramtypes", [])
], ScrollElement);
export { ScrollElement };
//# sourceMappingURL=ScrollElement.js.map