// #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 { HTMLElementEventEmitter } from '@breadstone/mosaik-elements';
import { Emit } from '../../../../events/Decorators/EmitDecorator';
import { Appearanceable } from '../../../Behaviors/Appearanceable';
import { Disableable } from '../../../Behaviors/Disableable';
import { Slottable } from '../../../Behaviors/Slottable';
import { Themeable } from '../../../Behaviors/Themeable';
import { Variantable } from '../../../Behaviors/Variantable';
import { Component } from '../../../Decorators/ComponentDecorator';
import { Property } from '../../../Decorators/PropertyDecorator';
import { CustomElement } from '../../Abstracts/CustomElement';
import { TextElement } from '../../Primitives/Text/TextElement';
import { ChipElement } from '../Chip/ChipElement';
import { chatInputAttachmentListElementTemplate } from './ChatInputAttachmentListElementTemplate';
import { chatInputAttachmentListElementCosmopolitanStyle } from './Themes/ChatInputAttachmentListElement.Cosmopolitan';
import { chatInputAttachmentListElementJoyStyle } from './Themes/ChatInputAttachmentListElement.Joy';
import { chatInputAttachmentListElementMemphisStyle } from './Themes/ChatInputAttachmentListElement.Memphis';
// #endregion
/**
 * Chat Input Attachment List - Represents the list of attachments in the chat input.
 *
 * @csspart attachment - The attachment part.
 * @csspart content - The content part.
 * @csspart dismiss - The dismiss part.
 * @csspart label - The label part.
 * @csspart thumbnail - The thumbnail part.
 * @csspart type - The type part.
 *
 * @cssprop {String} --chat-input-attachment-list-background-color - The input attachment list background color CSS custom property.
 * @cssprop {String} --chat-input-attachment-list-border-color - The input attachment list border color CSS custom property.
 * @cssprop {String} --chat-input-attachment-list-border-radius - The input attachment list border radius CSS custom property.
 * @cssprop {String} --chat-input-attachment-list-border-style - The input attachment list border style CSS custom property.
 * @cssprop {String} --chat-input-attachment-list-border-width - The input attachment list border width CSS custom property.
 * @cssprop {String} --chat-input-attachment-list-font-family - The input attachment list font family CSS custom property.
 * @cssprop {String} --chat-input-attachment-list-font-letter-spacing - The input attachment list font letter spacing CSS custom property.
 * @cssprop {String} --chat-input-attachment-list-font-line-height - The input attachment list font line height CSS custom property.
 * @cssprop {String} --chat-input-attachment-list-font-size - The input attachment list font size CSS custom property.
 * @cssprop {String} --chat-input-attachment-list-font-text-decoration - The input attachment list font text decoration CSS custom property.
 * @cssprop {String} --chat-input-attachment-list-font-text-transform - The input attachment list font text transform CSS custom property.
 * @cssprop {String} --chat-input-attachment-list-font-weight - The input attachment list font weight CSS custom property.
 * @cssprop {String} --chat-input-attachment-list-foreground-color - The input attachment list foreground color CSS custom property.
 * @cssprop {String} --chat-input-attachment-list-gap - The input attachment list gap CSS custom property.
 * @cssprop {String} --chat-input-attachment-list-padding-bottom - The input attachment list padding bottom CSS custom property.
 * @cssprop {String} --chat-input-attachment-list-padding-left - The input attachment list padding left CSS custom property.
 * @cssprop {String} --chat-input-attachment-list-padding-right - The input attachment list padding right CSS custom property.
 * @cssprop {String} --chat-input-attachment-list-padding-top - The input attachment list padding top CSS custom property.
 * @cssprop {String} --chat-input-attachment-list-shadow - The input attachment list shadow CSS custom property.
 * @cssprop {String} --chat-input-attachment-list-shadow-blur - The input attachment list shadow blur CSS custom property.
 * @cssprop {String} --chat-input-attachment-list-shadow-color - The input attachment list shadow color CSS custom property.
 * @cssprop {String} --chat-input-attachment-list-shadow-offset-x - The input attachment list shadow offset x CSS custom property.
 * @cssprop {String} --chat-input-attachment-list-shadow-offset-y - The input attachment list shadow offset y CSS custom property.
 * @cssprop {String} --chat-input-attachment-list-shadow-spread - The input attachment list shadow spread CSS custom property.
 * @cssprop {String} --chat-input-attachment-list-transition-duration - The input attachment list transition duration CSS custom property.
 * @cssprop {String} --chat-input-attachment-list-transition-mode - The input attachment list transition mode CSS custom property.
 * @cssprop {String} --chat-input-attachment-list-transition-property - The input attachment list transition property CSS custom property.
 * @cssprop {String} --chat-input-attachment-list-translate - The input attachment list translate CSS custom property.
 *
 * @fires attachmentAdd {AttachmentAddEvent} - Called when an attachment is added.
 * @fires attachmentRemove {AttachmentRemoveEvent} - Called when an attachment is removed.
 *
 * @dependency mosaik-box - The Box element.
 * @dependency mosaik-dismiss - The Dismiss element.
 * @dependency mosaik-text - The Text element.
 * @dependency mosaik-thumbnail - The Thumbnail element.
 *
 * @example
 * Basic attachment list:
 * ```html
 * <mosaik-chat-input-attachment-list></mosaik-chat-input-attachment-list>
 * ```
 *
 * @example
 * Disabled attachment list:
 * ```html
 * <mosaik-chat-input-attachment-list disabled></mosaik-chat-input-attachment-list>
 * ```
 *
 * @public
 */
let ChatInputAttachmentListElement = class ChatInputAttachmentListElement extends Themeable(Variantable(Appearanceable(Disableable(Slottable(CustomElement))))) {
    // #region Fields
    _attachmentAdded;
    _attachmentRemoved;
    _files;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._files = new Array();
        this._attachmentAdded = new HTMLElementEventEmitter(this, 'attachmentAdd', { bubbles: false });
        this._attachmentRemoved = new HTMLElementEventEmitter(this, 'attachmentRemove', { bubbles: false });
    }
    // #endregion
    // #region Properties
    /**
     * Returns the `is` property.
     * The `is` property represents natural name of this element.
     *
     * @public
     * @static
     * @readonly
     */
    static get is() {
        return 'mosaik-chat-input-attachment-list';
    }
    /**
     * Gets or sets the `files` property.
     *
     * @public
     */
    get files() {
        return this._files;
    }
    set files(value) {
        if (this._files !== value) {
            this._files = value;
            this.requestUpdate('files');
        }
    }
    /**
     * Called when an attachment is added.
     * Provides reference to `IEventDetail` as event detail.
     *
     * @public
     * @readonly
     * @eventProperty
     */
    get attachmentAdded() {
        return this._attachmentAdded;
    }
    /**
     * Called when an attachment is removed.
     * Provides reference to `IEventDetail` as event detail.
     *
     * @public
     * @readonly
     * @eventProperty
     */
    get attachmentRemoved() {
        return this._attachmentRemoved;
    }
    // #endregion
    // #region Methods
    /**
     * @public
     */
    addAttachment(file) {
        this.files = [...this.files, file];
        this.onAttachmentAdded({ file });
    }
    /**
     * @public
     */
    removeAttachment(file) {
        this.files = this.files.filter((f) => f !== file);
        this.onAttachmentRemoved({ file });
    }
    /**
     * @private
     * @template
     */
    onDismiss(e, file) {
        e.stopPropagation();
        this.removeAttachment(file);
    }
    /**
     * Emits the `attachmentAdded` event.
     *
     * @protected
     */
    onAttachmentAdded(args) {
        this._attachmentAdded.emit(args);
    }
    /**
     * Emits the `attachmentRemoved` event.
     *
     * @protected
     */
    onAttachmentRemoved(args) {
        this._attachmentRemoved.emit(args);
    }
};
__decorate([
    Emit({ eventName: 'attachmentAdd' }),
    __metadata("design:type", Object)
], ChatInputAttachmentListElement.prototype, "_attachmentAdded", void 0);
__decorate([
    Emit({ eventName: 'attachmentRemove' }),
    __metadata("design:type", Object)
], ChatInputAttachmentListElement.prototype, "_attachmentRemoved", void 0);
__decorate([
    Property({ type: Array }),
    __metadata("design:type", Array),
    __metadata("design:paramtypes", [Array])
], ChatInputAttachmentListElement.prototype, "files", null);
ChatInputAttachmentListElement = __decorate([
    Component({
        selector: 'mosaik-chat-input-attachment-list',
        template: chatInputAttachmentListElementTemplate,
        themes: {
            joy: chatInputAttachmentListElementJoyStyle,
            memphis: chatInputAttachmentListElementMemphisStyle,
            cosmopolitan: chatInputAttachmentListElementCosmopolitanStyle
        },
        host: {
            role: 'list'
        },
        imports: [
            TextElement,
            ChipElement
        ]
    }),
    __metadata("design:paramtypes", [])
], ChatInputAttachmentListElement);
export { ChatInputAttachmentListElement };
//# sourceMappingURL=ChatInputAttachmentListElement.js.map