/**
 * @license
 * Copyright 2023 Tyler Technologies, Inc. 
 * License: Apache-2.0
 */
import { __decorate } from "tslib";
import { CustomElement, attachShadowTemplate, coerceNumber, coerceBoolean, FoundationProperty } from '@tylertech/forge-core';
import { ProductIconAdapter } from './product-icon-adapter';
import { ProductIconFoundation } from './product-icon-foundation';
import { PRODUCT_ICON_CONSTANTS } from './product-icon-constants';
import { BaseComponent } from '../core/base/base-component';
const template = '<template><div class=\"forge-product-icon__background\" part=\"root\"><div class=\"forge-product-icon__container\" part=\"container\"><span class=\"forge-product-icon__icon\" part=\"icon-container\"><slot></slot></span><span class=\"forge-product-icon__text\" part=\"text-container\"><slot name=\"text\"></slot></span></div></div></template>';
const styles = '.forge-product-icon__background{border-radius:50%;border-radius:var(--forge-product-icon-border-radius,50%);height:64px;width:64px;overflow:hidden}.forge-product-icon__container{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;-webkit-box-pack:center;justify-content:center;height:100%;width:100%}.forge-product-icon__icon ::slotted(*),.forge-product-icon__text ::slotted(*){display:-webkit-box!important;display:flex!important;color:#fff!important;font-size:var(--forge-product-icon-font-size, 48px)!important}:host{display:inline-block}:host([hidden]){display:none}';
/**
 * The web component class behind the `<forge-product-icon>` custom element.
 *
 * @tag forge-product-icon
 */
let ProductIconComponent = class ProductIconComponent extends BaseComponent {
    constructor() {
        super();
        attachShadowTemplate(this, template, styles);
        this._foundation = new ProductIconFoundation(new ProductIconAdapter(this));
    }
    static get observedAttributes() {
        return [
            PRODUCT_ICON_CONSTANTS.attributes.COLOR,
            PRODUCT_ICON_CONSTANTS.attributes.SIZE,
            PRODUCT_ICON_CONSTANTS.attributes.SHADOW,
            PRODUCT_ICON_CONSTANTS.attributes.ITERATIONS
        ];
    }
    connectedCallback() {
        this._foundation.initialize();
    }
    attributeChangedCallback(name, oldValue, newValue) {
        switch (name) {
            case PRODUCT_ICON_CONSTANTS.attributes.COLOR:
                this.color = newValue;
                break;
            case PRODUCT_ICON_CONSTANTS.attributes.SIZE:
                this.size = coerceNumber(newValue);
                break;
            case PRODUCT_ICON_CONSTANTS.attributes.SHADOW:
                this.shadow = coerceBoolean(newValue);
                break;
            case PRODUCT_ICON_CONSTANTS.attributes.ITERATIONS:
                this.iterations = coerceNumber(newValue);
                break;
        }
    }
};
__decorate([
    FoundationProperty()
], ProductIconComponent.prototype, "color", void 0);
__decorate([
    FoundationProperty()
], ProductIconComponent.prototype, "size", void 0);
__decorate([
    FoundationProperty()
], ProductIconComponent.prototype, "shadow", void 0);
__decorate([
    FoundationProperty()
], ProductIconComponent.prototype, "iterations", void 0);
ProductIconComponent = __decorate([
    CustomElement({
        name: PRODUCT_ICON_CONSTANTS.elementName
    })
], ProductIconComponent);
export { ProductIconComponent };
