"use strict";
var __webpack_require__ = {};
(()=>{
    __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__, {
    AtomicExternal: ()=>AtomicExternal
});
const context_namespaceObject = require("@lit/context");
const external_lit_namespaceObject = require("lit");
const decorators_js_namespaceObject = require("lit/decorators.js");
const bindings_context_cjs_namespaceObject = require("../../common/context/bindings-context.cjs");
const error_guard_cjs_namespaceObject = require("../../../decorators/error-guard.cjs");
const children_update_complete_mixin_cjs_namespaceObject = require("../../../mixins/children-update-complete-mixin.cjs");
const event_utils_cjs_namespaceObject = require("../../../utils/event-utils.cjs");
const init_queue_cjs_namespaceObject = require("../../../utils/init-queue.cjs");
const initialization_common_utils_cjs_namespaceObject = require("../../../utils/initialization-common-utils.cjs");
function _check_private_redeclaration(obj, privateCollection) {
    if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
}
function _class_apply_descriptor_get(receiver, descriptor) {
    if (descriptor.get) return descriptor.get.call(receiver);
    return descriptor.value;
}
function _class_extract_field_descriptor(receiver, privateMap, action) {
    if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance");
    return privateMap.get(receiver);
}
function _class_private_field_get(receiver, privateMap) {
    var descriptor = _class_extract_field_descriptor(receiver, privateMap, "get");
    return _class_apply_descriptor_get(receiver, descriptor);
}
function _class_private_field_init(obj, privateMap, value) {
    _check_private_redeclaration(obj, privateMap);
    privateMap.set(obj, value);
}
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);
}
var _interface = /*#__PURE__*/ new WeakMap();
class AtomicExternal extends (0, children_update_complete_mixin_cjs_namespaceObject.ChildrenUpdateCompleteMixin)(external_lit_namespaceObject.LitElement) {
    async connectedCallback() {
        super.connectedCallback();
        await this.getUpdateComplete();
        this.addEventListener('atomic/initializeComponent', this.handleInitialization);
        this.addEventListener('atomic/scrollToTop', this.handleScrollToTop);
        _class_private_field_get(this, _interface)?.addEventListener('atomic/parentReady', this.handleParentReady);
        if ((0, init_queue_cjs_namespaceObject.isParentReady)(_class_private_field_get(this, _interface))) (0, init_queue_cjs_namespaceObject.markParentAsReady)(this);
    }
    disconnectedCallback() {
        super.disconnectedCallback();
        this.removeEventListener('atomic/initializeComponent', this.handleInitialization);
        this.removeEventListener('atomic/scrollToTop', this.handleScrollToTop);
        _class_private_field_get(this, _interface)?.removeEventListener('atomic/parentReady', this.handleParentReady);
    }
    render() {
        return (0, external_lit_namespaceObject.html)`<slot></slot>`;
    }
    constructor(...args){
        super(...args), _class_private_field_init(this, _interface, {
            get: get_interface,
            set: void 0
        }), this.selector = 'atomic-search-interface', this.bindings = {}, this.handleInitialization = (event)=>{
            event.preventDefault();
            event.stopPropagation();
            _class_private_field_get(this, _interface)?.dispatchEvent((0, event_utils_cjs_namespaceObject.buildCustomEvent)(initialization_common_utils_cjs_namespaceObject.initializeEventName, event.detail));
        }, this.handleScrollToTop = (event)=>{
            event.preventDefault();
            event.stopPropagation();
            _class_private_field_get(this, _interface)?.dispatchEvent((0, event_utils_cjs_namespaceObject.buildCustomEvent)('atomic/scrollToTop', event.detail));
        }, this.handleParentReady = (event)=>{
            if (event.target === this.boundInterface) {
                this.bindings = _class_private_field_get(this, _interface)?.bindings;
                (0, init_queue_cjs_namespaceObject.markParentAsReady)(this);
            }
        };
    }
}
function get_interface() {
    if (!this.boundInterface) {
        this.boundInterface = document.querySelector(this.selector) ?? void 0;
        if (!this.boundInterface) {
            const error = new Error(`Cannot find interface element with selector "${this.selector}"`);
            this.error = error;
            return;
        }
    }
    return this.boundInterface;
}
_ts_decorate([
    (0, decorators_js_namespaceObject.property)({
        type: String,
        reflect: true
    })
], AtomicExternal.prototype, "selector", void 0);
_ts_decorate([
    (0, decorators_js_namespaceObject.property)({
        attribute: false
    }),
    _ts_metadata("design:type", "u" < typeof AtomicInterface ? Object : AtomicInterface)
], AtomicExternal.prototype, "boundInterface", void 0);
_ts_decorate([
    (0, decorators_js_namespaceObject.state)(),
    (0, context_namespaceObject.provide)({
        context: bindings_context_cjs_namespaceObject.bindingsContext
    }),
    _ts_metadata("design:type", "u" < typeof AnyBindings ? Object : AnyBindings)
], AtomicExternal.prototype, "bindings", void 0);
_ts_decorate([
    (0, decorators_js_namespaceObject.state)(),
    _ts_metadata("design:type", "u" < typeof Error ? Object : Error)
], AtomicExternal.prototype, "error", void 0);
_ts_decorate([
    (0, error_guard_cjs_namespaceObject.errorGuard)(),
    _ts_metadata("design:type", Function),
    _ts_metadata("design:paramtypes", []),
    _ts_metadata("design:returntype", void 0)
], AtomicExternal.prototype, "render", null);
AtomicExternal = _ts_decorate([
    (0, decorators_js_namespaceObject.customElement)('atomic-external')
], AtomicExternal);
exports.AtomicExternal = __webpack_exports__.AtomicExternal;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "AtomicExternal"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
