// #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 { Themeable } from '../../../Behaviors/Themeable';
import { Attribute } from '../../../Decorators/AttributeDecorator';
import { Component } from '../../../Decorators/ComponentDecorator';
import { Watch } from '../../../Decorators/WatchDecorator';
import { CustomElement } from '../../Abstracts/CustomElement';
import { tourAnchorElementCosmopolitanStyle } from './Themes/TourAnchorElement.Cosmopolitan';
import { tourAnchorElementJoyStyle } from './Themes/TourAnchorElement.Joy';
import { tourAnchorElementMemphisStyle } from './Themes/TourAnchorElement.Memphis';
import { tourAnchorElementTemplate } from './TourAnchorElementTemplate';
import { addTourRegistryController } from './TourRegistryController';
// #endregion
/**
 * Tour Anchor - A marker element that registers a target for tour steps.
 *
 * @name TourAnchorElement
 * @element mosaik-tour-anchor
 * @category Overlays
 *
 * @slot - Content that should be associated with the anchor.
 *
 * @public
 */
let TourAnchorElement = class TourAnchorElement extends Themeable(CustomElement) {
    // #region Fields
    _registryController;
    _tourId;
    _anchorId;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._tourId = 'default';
        this._anchorId = '';
        this._registryController = addTourRegistryController(this, {
            getTourId: () => this.tourId,
            getAnchorId: () => this.anchorId
        });
    }
    // #endregion
    // #region Properties
    /**
     * Gets or sets the `tourId` property.
     *
     * @public
     * @attr
     */
    get tourId() {
        return this._tourId;
    }
    set tourId(value) {
        if (this.tourId !== value) {
            this._tourId = value || 'default';
            this.requestUpdate('tourId');
        }
    }
    /**
     * Gets or sets the `anchorId` property.
     *
     * @public
     * @attr
     */
    get anchorId() {
        return this._anchorId;
    }
    set anchorId(value) {
        if (this.anchorId !== value) {
            this._anchorId = value;
            this.requestUpdate('anchorId');
        }
    }
    // #endregion
    // #region Methods
    /**
     * @protected
     */
    onAnchorIdChanged(previousValue, nextValue) {
        if (previousValue === nextValue) {
            return;
        }
        this._registryController.updateRegistration(this.tourId, previousValue);
    }
    /**
     * @protected
     */
    onTourIdChanged(previousValue, nextValue) {
        if (previousValue === nextValue) {
            return;
        }
        this._registryController.updateRegistration(previousValue, this.anchorId);
    }
};
__decorate([
    Attribute({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], TourAnchorElement.prototype, "tourId", null);
__decorate([
    Attribute({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], TourAnchorElement.prototype, "anchorId", null);
__decorate([
    Watch('anchorId', { waitUntilFirstUpdate: true }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, String]),
    __metadata("design:returntype", void 0)
], TourAnchorElement.prototype, "onAnchorIdChanged", null);
__decorate([
    Watch('tourId', { waitUntilFirstUpdate: true }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, String]),
    __metadata("design:returntype", void 0)
], TourAnchorElement.prototype, "onTourIdChanged", null);
TourAnchorElement = __decorate([
    Component({
        selector: 'mosaik-tour-anchor',
        template: tourAnchorElementTemplate,
        themes: {
            joy: tourAnchorElementJoyStyle,
            memphis: tourAnchorElementMemphisStyle,
            cosmopolitan: tourAnchorElementCosmopolitanStyle
        }
    }),
    __metadata("design:paramtypes", [])
], TourAnchorElement);
export { TourAnchorElement };
//# sourceMappingURL=TourAnchorElement.js.map