"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.n = (module)=>{
        var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
        __webpack_require__.d(getter, {
            a: getter
        });
        return getter;
    };
})();
(()=>{
    __webpack_require__.d = (exports1, definition)=>{
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
(()=>{
    __webpack_require__.r = (exports1)=>{
        if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
    AtomicInsightUserActionsModal: ()=>AtomicInsightUserActionsModal
});
require("../../common/atomic-modal/atomic-modal.cjs");
require("../atomic-insight-user-actions-timeline/atomic-insight-user-actions-timeline.cjs");
const external_lit_namespaceObject = require("lit");
const decorators_js_namespaceObject = require("lit/decorators.js");
const when_js_namespaceObject = require("lit/directives/when.js");
const export_parts_cjs_namespaceObject = require("../../common/atomic-modal/export-parts.cjs");
const button_cjs_namespaceObject = require("../../common/button.cjs");
const boolean_converter_cjs_namespaceObject = require("../../../converters/boolean-converter.cjs");
const binding_guard_cjs_namespaceObject = require("../../../decorators/binding-guard.cjs");
const bindings_cjs_namespaceObject = require("../../../decorators/bindings.cjs");
const error_guard_cjs_namespaceObject = require("../../../decorators/error-guard.cjs");
const with_tailwind_styles_cjs_namespaceObject = require("../../../decorators/with-tailwind-styles.cjs");
const dom_utils_cjs_namespaceObject = require("../../../utils/dom-utils.cjs");
const close_cjs_namespaceObject = require("../../../images/close.cjs");
var close_cjs_default = /*#__PURE__*/ __webpack_require__.n(close_cjs_namespaceObject);
function _ts_decorate(decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) 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;
}
function _ts_metadata(k, v) {
    if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
}
class AtomicInsightUserActionsModal extends external_lit_namespaceObject.LitElement {
    disconnectedCallback() {
        super.disconnectedCallback();
        if (void 0 !== this.animationFrameId) window.cancelAnimationFrame(this.animationFrameId);
    }
    initialize() {}
    updated(changedProperties) {
        if (changedProperties.has('isOpen') && this.isOpen) this.onAnimationFrame();
    }
    render() {
        return (0, external_lit_namespaceObject.html)`
      ${(0, when_js_namespaceObject.when)(this.interfaceDimensions, ()=>(0, external_lit_namespaceObject.html)`
          <style>
            atomic-modal::part(backdrop) {
              top: ${this.interfaceDimensions.top}px;
              left: ${this.interfaceDimensions.left}px;
              width: ${this.interfaceDimensions.width}px;
              height: ${this.interfaceDimensions.height}px;
            }
          </style>
        `)}
      <atomic-modal
        .fullscreen=${true}
        .isOpen=${this.isOpen}
        .source=${this.openButton}
        .container=${this}
        .close=${()=>{
            this.isOpen = false;
        }}
        exportparts=${export_parts_cjs_namespaceObject.ATOMIC_MODAL_EXPORT_PARTS}
        .scope=${this.bindings.interfaceElement}
      >
        ${this.renderHeader()} ${this.renderBody()}
      </atomic-modal>
    `;
    }
    renderHeader() {
        return (0, external_lit_namespaceObject.html)`
      <div slot="header" class="contents">
        <div part="title" class="font-light truncate">
          ${this.bindings.i18n.t('user-actions')}
        </div>
        ${(0, button_cjs_namespaceObject.renderButton)({
            props: {
                style: 'text-transparent',
                class: 'grid place-items-center',
                part: 'close-button',
                onClick: ()=>{
                    this.isOpen = false;
                },
                ariaLabel: this.bindings.i18n.t('close')
            }
        })((0, external_lit_namespaceObject.html)`
          <atomic-icon
            part="close-icon"
            class="w-5 h-5"
            .icon=${close_cjs_default()}
          ></atomic-icon>
        `)}
      </div>
    `;
    }
    renderBody() {
        return (0, external_lit_namespaceObject.html)`
      <aside
        style="height: 100%"
        slot="body"
        class="flex flex-col w-full px-2"
        aria-label=${this.bindings.i18n.t('user-actions-content')}
      >
        <atomic-insight-user-actions-timeline
          .userId=${this.userId}
          .ticketCreationDateTime=${this.ticketCreationDateTime}
          .excludedCustomActions=${this.excludedCustomActions}
          class="flex-1"
        ></atomic-insight-user-actions-timeline>
      </aside>
    `;
    }
    onAnimationFrame() {
        if (!this.isOpen) {
            this.animationFrameId = void 0;
            return;
        }
        if (this.dimensionChanged()) this.updateDimensions();
        this.animationFrameId = window.requestAnimationFrame(()=>this.onAnimationFrame());
    }
    dimensionChanged() {
        if (!this.interfaceDimensions) return true;
        if (!this.bindings?.interfaceElement) return false;
        return !(0, dom_utils_cjs_namespaceObject.rectEquals)(this.interfaceDimensions, this.bindings.interfaceElement.getBoundingClientRect());
    }
    updateDimensions() {
        if (!this.bindings?.interfaceElement) return;
        this.interfaceDimensions = this.bindings.interfaceElement.getBoundingClientRect();
    }
    constructor(...args){
        super(...args), this.isOpen = false, this.excludedCustomActions = [];
    }
}
AtomicInsightUserActionsModal.styles = (0, external_lit_namespaceObject.css)`
    @reference '../../../utils/tailwind.global.tw.css';

    atomic-modal::part(body-wrapper),
    atomic-modal::part(footer-wrapper) {
      padding: 2px;
    }
  `;
_ts_decorate([
    (0, decorators_js_namespaceObject.state)(),
    _ts_metadata("design:type", "u" < typeof InsightBindings ? Object : InsightBindings)
], AtomicInsightUserActionsModal.prototype, "bindings", void 0);
_ts_decorate([
    (0, decorators_js_namespaceObject.state)(),
    _ts_metadata("design:type", "u" < typeof Error ? Object : Error)
], AtomicInsightUserActionsModal.prototype, "error", void 0);
_ts_decorate([
    (0, decorators_js_namespaceObject.state)(),
    _ts_metadata("design:type", "u" < typeof DOMRect ? Object : DOMRect)
], AtomicInsightUserActionsModal.prototype, "interfaceDimensions", void 0);
_ts_decorate([
    (0, decorators_js_namespaceObject.property)({
        type: Object,
        attribute: false
    }),
    _ts_metadata("design:type", "u" < typeof HTMLElement ? Object : HTMLElement)
], AtomicInsightUserActionsModal.prototype, "openButton", void 0);
_ts_decorate([
    (0, decorators_js_namespaceObject.property)({
        type: Boolean,
        reflect: true,
        converter: boolean_converter_cjs_namespaceObject.booleanConverter,
        attribute: 'is-open'
    })
], AtomicInsightUserActionsModal.prototype, "isOpen", void 0);
_ts_decorate([
    (0, decorators_js_namespaceObject.property)({
        type: String,
        attribute: 'user-id'
    }),
    _ts_metadata("design:type", String)
], AtomicInsightUserActionsModal.prototype, "userId", void 0);
_ts_decorate([
    (0, decorators_js_namespaceObject.property)({
        type: String,
        attribute: 'ticket-creation-date-time'
    }),
    _ts_metadata("design:type", String)
], AtomicInsightUserActionsModal.prototype, "ticketCreationDateTime", void 0);
_ts_decorate([
    (0, decorators_js_namespaceObject.property)({
        type: Array,
        attribute: 'excluded-custom-actions'
    }),
    _ts_metadata("design:type", Array)
], AtomicInsightUserActionsModal.prototype, "excludedCustomActions", void 0);
_ts_decorate([
    (0, error_guard_cjs_namespaceObject.errorGuard)(),
    (0, binding_guard_cjs_namespaceObject.bindingGuard)(),
    _ts_metadata("design:type", Function),
    _ts_metadata("design:paramtypes", []),
    _ts_metadata("design:returntype", void 0)
], AtomicInsightUserActionsModal.prototype, "render", null);
AtomicInsightUserActionsModal = _ts_decorate([
    (0, decorators_js_namespaceObject.customElement)('atomic-insight-user-actions-modal'),
    (0, bindings_cjs_namespaceObject.bindings)(),
    with_tailwind_styles_cjs_namespaceObject.withTailwindStyles
], AtomicInsightUserActionsModal);
exports.AtomicInsightUserActionsModal = __webpack_exports__.AtomicInsightUserActionsModal;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "AtomicInsightUserActionsModal"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
