import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils.js';
import { d as defineCustomElement$4 } from './snk-expression-group2.js';
import { d as defineCustomElement$3 } from './snk-expression-item2.js';
import { d as defineCustomElement$2 } from './snk-filter-field-search2.js';
import { d as defineCustomElement$1 } from './snk-filter-param-config2.js';

const snkFilterAssistentModeCss = ".sc-snk-filter-assistent-mode-h{display:flex;flex-direction:column;height:100%;--text-area--font-family:var(--font-pattern, Arial);--text-area__label--floating--top:var(--space--small, 6px);--snk-filter-assistent-mode__container--border-radius:var(--border--radius-medium, 12px);--snk-filter-assistent-mode__container--background:var(--background--medium, #f0f3f7);--snk-filter-assistent-mode__container--margin:var(--space--small, 6px) var(--space--medium, 12px)}.ez-box__container--external.sc-snk-filter-assistent-mode{height:100px;width:100%;overflow-y:auto;background-color:var(--snk-filter-assistent-mode__container--background);border-radius:var(--snk-filter-assistent-mode__container--border-radius)}.ez-box__container--internal.sc-snk-filter-assistent-mode{margin:var(--snk-filter-assistent-mode__container--margin)}.ez-box__container--title.sc-snk-filter-assistent-mode{display:block;user-select:none;font-family:var(--text-area--font-family);font-size:var(--text--extra-small);color:var(--title--primary);top:var(--text-area__label--floating--top)}.ez-box__container--expression.sc-snk-filter-assistent-mode{display:block;font-family:var(--text-area--font-family);font-size:var(--text--medium);color:var(--title--primary);top:var(--text-area__label--floating--top)}.snk-personalized-filter__expression-input--line.sc-snk-filter-assistent-mode{width:100%;height:2px;background-color:var(--snk-personalized-filter--background-color-line);margin-top:var(--snk-personalized-filter--margin-line);margin-bottom:var(--snk-personalized-filter--margin-line)}";

const SnkFilterAssistentMode = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.ezChangeFilter = createEvent(this, "ezChangeFilter", 7);
    this.filterAssistent = undefined;
    this.messagesBuilder = undefined;
    this.filterId = undefined;
    this.entityUri = undefined;
    this.application = undefined;
    this.isDefaultFilter = false;
  }
  getMessage(key, params) {
    return this.application.messagesBuilder.getMessage(key, params);
  }
  async handleFilterGroupChange() {
    const assistent = await this._mainExpressionGroup.getExpressionGroup();
    this.filterAssistent = Object.assign(Object.assign({}, this.filterAssistent), { assistent });
    this.filterAssistent.parameters = PersonalizedFilterUtils.buildVariableParameters(this.filterAssistent.assistent);
    this.filterAssistent.expression = PersonalizedFilterUtils.buildGroupExpression(this.filterAssistent.assistent);
    this.ezChangeFilter.emit(this.filterAssistent);
  }
  render() {
    var _a, _b;
    return (h(Host, null, h("div", { class: "ez-padding-top--small snk-personalized-filter__group" }, h("snk-expression-group", { ref: (el) => this._mainExpressionGroup = el, group: (_a = this.filterAssistent) === null || _a === void 0 ? void 0 : _a.assistent, messagesBuilder: this.messagesBuilder, onEzFilterGroupChange: this.handleFilterGroupChange.bind(this), filterId: this.filterId, entityURI: this.entityUri, isDefaultFilter: this.isDefaultFilter })), h("div", { class: "ez-margin-top--auto" }, h("div", { class: "snk-personalized-filter__expression-input--line" }), h("ez-collapsible-box", { label: this.getMessage("snkPersonalizedFilter.info.titleCollapsible"), headerSize: "medium", value: true }, h("div", { class: "ez-box" }, h("div", { class: "ez-box__container--external" }, h("div", { class: "ez-box__container--internal" }, h("span", { class: "ez-box__container--title" }, this.getMessage("snkPersonalizedFilter.info.labelExpression")), h("span", { class: "ez-box__container--expression" }, (_b = this.filterAssistent) === null || _b === void 0 ? void 0 : _b.expression))))))));
  }
  static get style() { return snkFilterAssistentModeCss; }
}, [2, "snk-filter-assistent-mode", {
    "filterAssistent": [1040],
    "messagesBuilder": [1040],
    "filterId": [1025, "filter-id"],
    "entityUri": [1025, "entity-uri"],
    "application": [1040],
    "isDefaultFilter": [4, "is-default-filter"]
  }]);
function defineCustomElement() {
  if (typeof customElements === "undefined") {
    return;
  }
  const components = ["snk-filter-assistent-mode", "snk-expression-group", "snk-expression-item", "snk-filter-field-search", "snk-filter-param-config"];
  components.forEach(tagName => { switch (tagName) {
    case "snk-filter-assistent-mode":
      if (!customElements.get(tagName)) {
        customElements.define(tagName, SnkFilterAssistentMode);
      }
      break;
    case "snk-expression-group":
      if (!customElements.get(tagName)) {
        defineCustomElement$4();
      }
      break;
    case "snk-expression-item":
      if (!customElements.get(tagName)) {
        defineCustomElement$3();
      }
      break;
    case "snk-filter-field-search":
      if (!customElements.get(tagName)) {
        defineCustomElement$2();
      }
      break;
    case "snk-filter-param-config":
      if (!customElements.get(tagName)) {
        defineCustomElement$1();
      }
      break;
  } });
}

export { SnkFilterAssistentMode as S, defineCustomElement as d };
