import { Button } from '@masterteam/components/button';
import * as i0 from '@angular/core';
import { inject, model, output, input, computed, Component } from '@angular/core';
import { DOCUMENT, CommonModule } from '@angular/common';
import * as i1 from 'primeng/drawer';
import { DrawerModule } from 'primeng/drawer';
import * as i2 from 'primeng/skeleton';
import { SkeletonModule } from 'primeng/skeleton';

class Drawer {
    doc = inject(DOCUMENT);
    visible = model(false, ...(ngDevMode ? [{ debugName: "visible" }] : []));
    visibleChange = output();
    onShow = output();
    onHide = output();
    position = input('right', ...(ngDevMode ? [{ debugName: "position" }] : []));
    fullScreen = input(false, ...(ngDevMode ? [{ debugName: "fullScreen" }] : []));
    closeOnEscape = input(false, ...(ngDevMode ? [{ debugName: "closeOnEscape" }] : []));
    blockScroll = input(true, ...(ngDevMode ? [{ debugName: "blockScroll" }] : []));
    dismissible = input(true, ...(ngDevMode ? [{ debugName: "dismissible" }] : []));
    title = input('', ...(ngDevMode ? [{ debugName: "title" }] : []));
    subtitle = input('', ...(ngDevMode ? [{ debugName: "subtitle" }] : []));
    loadingHeader = input(false, ...(ngDevMode ? [{ debugName: "loadingHeader" }] : []));
    styleClass = input('', ...(ngDevMode ? [{ debugName: "styleClass" }] : []));
    transitionOptions = input('200ms cubic-bezier(0, 0, 1, 1)', ...(ngDevMode ? [{ debugName: "transitionOptions" }] : []));
    appendTo = input('self', ...(ngDevMode ? [{ debugName: "appendTo" }] : []));
    modal = input(true, ...(ngDevMode ? [{ debugName: "modal" }] : []));
    resolvedAppendTo = computed(() => {
        this.visible();
        const appendTo = this.appendTo();
        if (!appendTo || appendTo === 'self' || appendTo === 'body') {
            return appendTo || 'self';
        }
        if (typeof appendTo !== 'string') {
            return appendTo;
        }
        const selector = appendTo.startsWith('#') || appendTo.startsWith('.')
            ? appendTo
            : `#${appendTo}`;
        return this.doc.querySelector(selector) ?? 'self';
    }, ...(ngDevMode ? [{ debugName: "resolvedAppendTo" }] : []));
    visibleChangeEvent(event) {
        this.visibleChange.emit(event);
    }
    onClose() {
        this.visible.set(false);
        this.visibleChange.emit(false);
        this.onHide.emit(true);
    }
    onShowEvent() {
        this.onShow.emit(true);
    }
    onHideEvent() {
        this.onHide.emit(true);
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: Drawer, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.3", type: Drawer, isStandalone: true, selector: "mt-drawer", inputs: { visible: { classPropertyName: "visible", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, fullScreen: { classPropertyName: "fullScreen", publicName: "fullScreen", isSignal: true, isRequired: false, transformFunction: null }, closeOnEscape: { classPropertyName: "closeOnEscape", publicName: "closeOnEscape", isSignal: true, isRequired: false, transformFunction: null }, blockScroll: { classPropertyName: "blockScroll", publicName: "blockScroll", isSignal: true, isRequired: false, transformFunction: null }, dismissible: { classPropertyName: "dismissible", publicName: "dismissible", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, subtitle: { classPropertyName: "subtitle", publicName: "subtitle", isSignal: true, isRequired: false, transformFunction: null }, loadingHeader: { classPropertyName: "loadingHeader", publicName: "loadingHeader", isSignal: true, isRequired: false, transformFunction: null }, styleClass: { classPropertyName: "styleClass", publicName: "styleClass", isSignal: true, isRequired: false, transformFunction: null }, transitionOptions: { classPropertyName: "transitionOptions", publicName: "transitionOptions", isSignal: true, isRequired: false, transformFunction: null }, appendTo: { classPropertyName: "appendTo", publicName: "appendTo", isSignal: true, isRequired: false, transformFunction: null }, modal: { classPropertyName: "modal", publicName: "modal", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { visible: "visibleChange", visibleChange: "visibleChange", onShow: "onShow", onHide: "onHide" }, ngImport: i0, template: "<p-drawer\n  [(visible)]=\"visible\"\n  [position]=\"position()\"\n  [fullScreen]=\"fullScreen()\"\n  [modal]=\"modal()\"\n  [closable]=\"false\"\r\n  [closeOnEscape]=\"closeOnEscape()\"\r\n  [blockScroll]=\"blockScroll()\"\r\n  [dismissible]=\"dismissible()\"\r\n  [appendTo]=\"resolvedAppendTo()\"\r\n  [transitionOptions]=\"transitionOptions()\"\r\n  [styleClass]=\"styleClass() + ' mt-custom-drawer'\"\r\n  (visibleChange)=\"visibleChangeEvent($event)\"\r\n  (onShow)=\"onShowEvent()\"\r\n  (onHide)=\"onHideEvent()\"\r\n>\r\n  <ng-template #header>\r\n    <div\r\n      class=\"flex items-center justify-between px-5 w-full py-3 border-b border-surface\"\r\n    >\r\n      @if (loadingHeader()) {\r\n        <div class=\"flex flex-1 flex-col gap-2\">\r\n          <p-skeleton width=\"12rem\" height=\"1.75rem\" borderRadius=\"0.5rem\" />\r\n          <p-skeleton width=\"8rem\" height=\"0.875rem\" borderRadius=\"0.5rem\" />\r\n        </div>\r\n      } @else {\r\n        <div class=\"flex flex-1 flex-col\">\r\n          <h3 class=\"text-xl font-semibold\" [innerHTML]=\"title()\"></h3>\r\n          @if (subtitle()) {\r\n            <p class=\"text-sm text-surface-500\" [innerHTML]=\"subtitle()\"></p>\r\n          }\r\n        </div>\r\n      }\r\n      <mt-button\r\n        (onClick)=\"onClose()\"\r\n        variant=\"outlined\"\r\n        styleClass=\"!bg-white\"\r\n        icon=\"general.x-close\"\r\n        severity=\"secondary\"\r\n      >\r\n      </mt-button>\r\n    </div>\r\n  </ng-template>\r\n\r\n  <ng-content select=\"[content]\"></ng-content>\r\n\r\n  <ng-template #footer>\r\n    <div class=\"flex justify-end p-3 gap-2 border-t border-surface-200\">\r\n      <ng-content select=\"[footer]\"></ng-content>\r\n    </div>\r\n  </ng-template>\r\n</p-drawer>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: DrawerModule }, { kind: "component", type: i1.Drawer, selector: "p-drawer", inputs: ["appendTo", "motionOptions", "blockScroll", "style", "styleClass", "ariaCloseLabel", "autoZIndex", "baseZIndex", "modal", "closeButtonProps", "dismissible", "showCloseIcon", "closeOnEscape", "transitionOptions", "visible", "position", "fullScreen", "header", "maskStyle", "closable"], outputs: ["onShow", "onHide", "visibleChange"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i2.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs"], outputs: ["onClick", "onFocus", "onBlur"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: Drawer, decorators: [{
            type: Component,
            args: [{ selector: 'mt-drawer', standalone: true, imports: [CommonModule, DrawerModule, SkeletonModule, Button], template: "<p-drawer\n  [(visible)]=\"visible\"\n  [position]=\"position()\"\n  [fullScreen]=\"fullScreen()\"\n  [modal]=\"modal()\"\n  [closable]=\"false\"\r\n  [closeOnEscape]=\"closeOnEscape()\"\r\n  [blockScroll]=\"blockScroll()\"\r\n  [dismissible]=\"dismissible()\"\r\n  [appendTo]=\"resolvedAppendTo()\"\r\n  [transitionOptions]=\"transitionOptions()\"\r\n  [styleClass]=\"styleClass() + ' mt-custom-drawer'\"\r\n  (visibleChange)=\"visibleChangeEvent($event)\"\r\n  (onShow)=\"onShowEvent()\"\r\n  (onHide)=\"onHideEvent()\"\r\n>\r\n  <ng-template #header>\r\n    <div\r\n      class=\"flex items-center justify-between px-5 w-full py-3 border-b border-surface\"\r\n    >\r\n      @if (loadingHeader()) {\r\n        <div class=\"flex flex-1 flex-col gap-2\">\r\n          <p-skeleton width=\"12rem\" height=\"1.75rem\" borderRadius=\"0.5rem\" />\r\n          <p-skeleton width=\"8rem\" height=\"0.875rem\" borderRadius=\"0.5rem\" />\r\n        </div>\r\n      } @else {\r\n        <div class=\"flex flex-1 flex-col\">\r\n          <h3 class=\"text-xl font-semibold\" [innerHTML]=\"title()\"></h3>\r\n          @if (subtitle()) {\r\n            <p class=\"text-sm text-surface-500\" [innerHTML]=\"subtitle()\"></p>\r\n          }\r\n        </div>\r\n      }\r\n      <mt-button\r\n        (onClick)=\"onClose()\"\r\n        variant=\"outlined\"\r\n        styleClass=\"!bg-white\"\r\n        icon=\"general.x-close\"\r\n        severity=\"secondary\"\r\n      >\r\n      </mt-button>\r\n    </div>\r\n  </ng-template>\r\n\r\n  <ng-content select=\"[content]\"></ng-content>\r\n\r\n  <ng-template #footer>\r\n    <div class=\"flex justify-end p-3 gap-2 border-t border-surface-200\">\r\n      <ng-content select=\"[footer]\"></ng-content>\r\n    </div>\r\n  </ng-template>\r\n</p-drawer>\r\n" }]
        }], propDecorators: { visible: [{ type: i0.Input, args: [{ isSignal: true, alias: "visible", required: false }] }, { type: i0.Output, args: ["visibleChange"] }], visibleChange: [{ type: i0.Output, args: ["visibleChange"] }], onShow: [{ type: i0.Output, args: ["onShow"] }], onHide: [{ type: i0.Output, args: ["onHide"] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], fullScreen: [{ type: i0.Input, args: [{ isSignal: true, alias: "fullScreen", required: false }] }], closeOnEscape: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnEscape", required: false }] }], blockScroll: [{ type: i0.Input, args: [{ isSignal: true, alias: "blockScroll", required: false }] }], dismissible: [{ type: i0.Input, args: [{ isSignal: true, alias: "dismissible", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], subtitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "subtitle", required: false }] }], loadingHeader: [{ type: i0.Input, args: [{ isSignal: true, alias: "loadingHeader", required: false }] }], styleClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "styleClass", required: false }] }], transitionOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "transitionOptions", required: false }] }], appendTo: [{ type: i0.Input, args: [{ isSignal: true, alias: "appendTo", required: false }] }], modal: [{ type: i0.Input, args: [{ isSignal: true, alias: "modal", required: false }] }] } });

/**
 * Generated bundle index. Do not edit.
 */

export { Drawer };
//# sourceMappingURL=masterteam-components-drawer.mjs.map
