import { proxyCustomElement, HTMLElement, createEvent, forceUpdate, h } from '@stencil/core/internal/client';
import { UserInterface, DataType, StringUtils, ObjectUtils, ApplicationContext } from '@sankhyalabs/core';
import { T as TAB_NAMES, G as GROUP_NAMES, D as DEFAULT_TYPE, a as VARS_BY_TYPE, b as TAGS_BY_TYPE } from './constants.js';
import { getConvertedValue } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
import { CheckMode } from '@sankhyalabs/ezui/dist/collection/utils';

const iconMap = new Map([
  [UserInterface.DATE, 'calendar'],
  [UserInterface.DATETIME, 'calendar-clock'],
  [UserInterface.ELAPSEDTIME, 'timer-outline'],
  [UserInterface.TIME, 'timer-outline'],
  [UserInterface.DECIMALNUMBER, 'number'],
  [UserInterface.INTEGERNUMBER, 'number'],
  [UserInterface.FILE, 'zip'],
  [UserInterface.IMAGE, 'pdf'],
  [UserInterface.HTML, 'tag_code'],
  [UserInterface.SEARCH, 'search'],
  [UserInterface.SEARCHPLUS, 'search'],
  [UserInterface.OPTIONSELECTOR, 'list'],
  [UserInterface.CHECKBOX, 'list'],
  [UserInterface.SWITCH, 'boolean'],
  [UserInterface.PASSWORD, 'eye-off'],
]);
const ID_AVAILABLE_FIELDS = 'container-available-fields';
var SORTABLE_PATH;
(function (SORTABLE_PATH) {
  SORTABLE_PATH["FROM"] = "from";
  SORTABLE_PATH["TO"] = "to";
})(SORTABLE_PATH || (SORTABLE_PATH = {}));
function getFieldsStructure(evt, path, group, tab) {
  var _a;
  const htmlStructure = (_a = evt === null || evt === void 0 ? void 0 : evt[path]) === null || _a === void 0 ? void 0 : _a.children;
  if (!htmlStructure)
    return [];
  return Array.from(htmlStructure).map(({ fieldConfig }) => {
    return Object.assign(Object.assign({}, fieldConfig), { group, tab });
  });
}
function updateTabInFieldsFromGroupList(guideGroups, updatedName) {
  return guideGroups.map(group => {
    return Object.assign(Object.assign({}, group), { fields: group.fields.map(field => (Object.assign(Object.assign({}, field), { tab: updatedName }))) });
  });
}
function getValidatedFieldValue(fieldValue, dataUnit, fieldName) {
  var _a;
  if (fieldValue == undefined || !dataUnit || !fieldName)
    return;
  const dataType = (_a = dataUnit.getField(fieldName)) === null || _a === void 0 ? void 0 : _a.dataType;
  if (dataType == undefined)
    return;
  if ((fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.waitmessage) !== undefined)
    return undefined;
  const isNonObjectValue = dataType !== DataType.OBJECT &&
    dataType !== DataType.DATE &&
    typeof fieldValue === 'object';
  const processedValue = isNonObjectValue ? fieldValue.value : fieldValue;
  return dataType === DataType.OBJECT
    ? JSON.stringify(processedValue)
    : processedValue;
}
function getEnabledByProperty(attribName, propertyName, fieldDescriptor) {
  if (!fieldDescriptor)
    return true;
  const fieldProperties = fieldDescriptor.properties || {};
  const fromAttribName = fieldDescriptor[attribName] !== true;
  return fieldProperties.hasOwnProperty(propertyName)
    ? fieldProperties[propertyName] !== 'S'
    : fromAttribName;
}
function getValueByProperty(property, fieldDescriptor, defaultValue) {
  if (fieldDescriptor && fieldDescriptor[property] === true) {
    return true;
  }
  return defaultValue;
}
function getIconName(userInterface) {
  return iconMap.get(userInterface) || 'text';
}
function buildNewGuideName(guidesList, getMessage) {
  var _a, _b;
  const newGuideText = getMessage('snkFormConfig.form.newGuide');
  const qtdWithNewGuideName = (_b = (_a = guidesList.filter(g => g.name.includes(newGuideText))) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
  return qtdWithNewGuideName === 0 ? newGuideText : `${newGuideText} (${qtdWithNewGuideName})`;
}
function getFieldsToSave(guidesMap) {
  const fieldsToSave = [];
  guidesMap.forEach(groups => {
    groups.forEach(({ fields }) => {
      fields === null || fields === void 0 ? void 0 : fields.forEach((fieldConfig) => {
        fieldsToSave.push(buildFieldToSave(fieldConfig));
      });
    });
  });
  return fieldsToSave;
}
function buildGuidesMap(rawFields, tabs, dataUnit, generalTab) {
  const fields = handleFieldsTabNames(rawFields);
  const guidesMap = initGuidesMap(tabs);
  if (!(fields === null || fields === void 0 ? void 0 : fields.length))
    return;
  for (let guideName of guidesMap.keys()) {
    const fieldsFromGuide = getFieldsFromGuide(fields, guideName, generalTab);
    const fieldsByGroupMap = getGroupsFromGuide(fieldsFromGuide, dataUnit, generalTab);
    const groupsList = parserGroupMapIntoList(fieldsByGroupMap);
    guidesMap.set(guideName, groupsList);
  }
  return guidesMap;
}
function buildGuides(config, mainArea) {
  let tabs = config.tabs ? [...config.tabs] : buildTabsFromFields(config === null || config === void 0 ? void 0 : config.fields);
  tabs = getPossibleGuides(tabs);
  tabs = initializeTabsNames(tabs);
  return handleMainTab(tabs, mainArea);
}
function buildChildrenGuides(dataUnit, initialOrderIndex = 0, guidesList) {
  var _a;
  if (!dataUnit || !dataUnit.metadata) {
    return [];
  }
  const children = ((_a = dataUnit.metadata) === null || _a === void 0 ? void 0 : _a.children) || [];
  const childrenWithNoGuide = [];
  for (const child of children) {
    const guideOnConfig = guidesList.find(guide => child.label === guide.label);
    if (guideOnConfig) {
      guideOnConfig.isCustom = true;
      continue;
    }
    childrenWithNoGuide.push({
      label: child.label,
      name: child.name,
      visible: true,
      isCustom: true,
      order: initialOrderIndex++,
    });
  }
  return childrenWithNoGuide;
}
function handleFieldsTabNames(allFields) {
  // Campos que não fazem parte de nenhuma aba ou da aba "Geral", devem ser movidos para a aba __main.
  return allFields.map(field => {
    const tabName = field.tab;
    return Object.assign(Object.assign({}, field), { tab: (!tabName || tabName === TAB_NAMES.general) ? TAB_NAMES.main : field.tab });
  });
}
function initializeTabsNames(tabs) {
  return tabs.map((tab) => {
    return Object.assign(Object.assign({}, tab), { name: tab.name ? tab.name : tab.label });
  });
}
function handleMainTab(tabs, mainTabName) {
  const mainTab = { name: TAB_NAMES.main, label: mainTabName, visible: true };
  const hasTabMain = tabs.some((tab) => tab.name === TAB_NAMES.main);
  if (hasTabMain) {
    tabs = tabs.map(tab => tab.name === TAB_NAMES.main ? mainTab : tab);
  }
  else {
    tabs.unshift(mainTab);
  }
  return tabs;
}
function getPossibleGuides(tabs) {
  //O usuário não pode criar uma guia com o nome "Geral".
  // Nesses casos, precisamos mover os campos dessa guia, para a guia __main.
  return [...tabs.filter(tab => tab.label !== TAB_NAMES.general)];
}
function initGuidesMap(tabs) {
  const map = new Map();
  let possibleGuides = getPossibleGuides(tabs);
  possibleGuides.forEach(tab => {
    map.set(tab.name, []);
  });
  return map;
}
function handleFieldLabel(field, fieldDescriptor) {
  if (!field.label) {
    field.label = fieldDescriptor.label;
  }
}
function handleFieldTab(field, generalTabName) {
  if (!field.tab) {
    field.tab = generalTabName;
  }
}
function handleFieldGroup(field) {
  if (!field.group) {
    field.group = GROUP_NAMES.noGroup;
  }
}
function isVisibleOnConfig(fieldDescriptor) {
  var _a;
  /**
   * Quando um campo é ocultado pelo dev, mas queremos manter ele na config precisamos fazer essa tratativa.
   */
  return ((_a = fieldDescriptor === null || fieldDescriptor === void 0 ? void 0 : fieldDescriptor.properties) === null || _a === void 0 ? void 0 : _a.visibleOnConfig) === true && (fieldDescriptor === null || fieldDescriptor === void 0 ? void 0 : fieldDescriptor.visible) === false;
}
function getGroupsFromGuide(fieldsFromGuide, dataUnit, generalTabName) {
  const groupsMap = new Map();
  groupsMap.set(GROUP_NAMES.noGroup, []);
  for (let field of fieldsFromGuide) {
    const fieldDescriptor = dataUnit.getField(field.name);
    if (!(fieldDescriptor === null || fieldDescriptor === void 0 ? void 0 : fieldDescriptor.visible) && !isVisibleOnConfig(fieldDescriptor))
      continue;
    handleFieldLabel(field, fieldDescriptor);
    handleFieldTab(field, generalTabName);
    handleFieldGroup(field);
    if (groupsMap.has(field.group)) {
      groupsMap.get(field.group).push(field);
    }
    else {
      groupsMap.set(field.group, [field]);
    }
  }
  return groupsMap;
}
function getFieldsFromGuide(fields, guideName, generalTabName) {
  return fields.filter(field => {
    const fieldTab = getTabName(field.tab, generalTabName);
    return fieldTab === guideName;
  });
}
function getTabName(tab, generalTabName) {
  var _a;
  if (typeof tab === 'string')
    return tab;
  return (_a = tab === null || tab === void 0 ? void 0 : tab.label) !== null && _a !== void 0 ? _a : generalTabName;
}
function parserGroupMapIntoList(groupsMap) {
  const groupsList = [];
  for (let groupName of groupsMap.keys()) {
    groupsList.push({ name: groupName, fields: groupsMap.get(groupName) });
  }
  return groupsList;
}
function canAddTab(tab, guideList) {
  return tab && !(guideList.map(g => g.name).includes(tab));
}
function buildTabsFromFields(fields) {
  const guideList = [];
  let order = 1;
  fields === null || fields === void 0 ? void 0 : fields.forEach((field) => {
    const tab = field.tab;
    if (canAddTab(tab, guideList)) {
      guideList.push({ name: tab, label: tab, visible: true, order });
      order = order + 1;
    }
  });
  return guideList;
}
function buildFieldToSave(fieldConfig) {
  const fieldToSave = {
    cleanOnCopy: fieldConfig.cleanOnCopy || false,
    group: fieldConfig.group === GROUP_NAMES.noGroup ? undefined : fieldConfig.group,
    label: fieldConfig.label,
    name: fieldConfig.name,
    required: fieldConfig.required,
    readOnly: fieldConfig.readOnly,
    tab: fieldConfig.tab,
  };
  if (fieldConfig.defaultValue != undefined) {
    if (fieldConfig.defaultValue.type == undefined) {
      fieldToSave.defaultValue = {
        type: DEFAULT_TYPE.fixed,
        value: fieldConfig.defaultValue,
      };
    }
    else {
      fieldToSave.defaultValue = fieldConfig.defaultValue;
    }
  }
  return fieldToSave;
}

const fieldConfigCss = ".field-config-container.sc-field-config{font-family:'Roboto';color:#2b3a54;display:flex;flex-direction:column;gap:10px;width:330px;justify-content:space-between}.header.sc-field-config{display:flex;font-weight:500;font-size:16px}.actions.sc-field-config{display:flex;align-items:flex-end;justify-content:flex-end;gap:12px}";

const FieldConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.fieldConfigChanged = createEvent(this, "fieldConfigChanged", 7);
    this.fieldLabel = undefined;
    this.fieldLabelErrorMessage = undefined;
    this.fieldDefaultValue = undefined;
    this.fieldCleanOnCopy = undefined;
    this.fieldRequired = undefined;
    this.fieldReadOnly = undefined;
    this._defaultType = undefined;
    this.dataUnit = undefined;
    this.fieldConfig = undefined;
    this.fieldDescriptor = undefined;
    this.messagesBuilder = undefined;
  }
  observeFieldLabel() {
    if (this.validateFieldLabel) {
      this.fieldLabelErrorMessage = undefined;
    }
  }
  async show(_anchorElement) {
    this._popoupElement.opened = true;
    this.initializeValues();
    forceUpdate(this);
  }
  validateFieldLabel() {
    var _a;
    if ((_a = this.fieldLabel) === null || _a === void 0 ? void 0 : _a.trim())
      return true;
    this.applyErrorMessage();
    return false;
  }
  getMessage(key, params) {
    return this.messagesBuilder.getMessage(key, params);
  }
  isAllowDefault() {
    var _a;
    const allowDefault = (_a = this.fieldDescriptor.properties) === null || _a === void 0 ? void 0 : _a.allowDefault;
    if (allowDefault == undefined) {
      return true;
    }
    return allowDefault === 'true';
  }
  enabledValueDefault() {
    var _a, _b, _c;
    const allowDefault = (_a = this.fieldDescriptor.properties) === null || _a === void 0 ? void 0 : _a.allowDefault;
    const hasVariableVar = (VARS_BY_TYPE.UserInterface.hasOwnProperty((_b = this.fieldDescriptor) === null || _b === void 0 ? void 0 : _b.userInterface)
      || ((_c = this.fieldDescriptor) === null || _c === void 0 ? void 0 : _c.userInterface) === UserInterface.SEARCH);
    return hasVariableVar && (allowDefault == undefined || allowDefault === 'true');
  }
  getDefaultType() {
    var _a, _b;
    return (_b = (_a = this.fieldDefaultValue) === null || _a === void 0 ? void 0 : _a.type) !== null && _b !== void 0 ? _b : DEFAULT_TYPE.fixed;
  }
  emitFieldChanged() {
    this.fieldConfigChanged.emit(this.fieldConfig);
  }
  handleLabelChanged({ detail }) {
    this.fieldLabel = detail;
  }
  handleDefaultTypeChanged({ detail }) {
    const optionSelected = detail.value;
    if (optionSelected == undefined)
      return;
    this._defaultType = optionSelected;
    this.fieldDefaultValue = { type: this._defaultType };
  }
  handleDefaultValueChanged({ detail }) {
    this.fieldDefaultValue.value = detail === null || detail === void 0 ? void 0 : detail.value;
  }
  onChangeDefaultValue(fieldValue) {
    this.fieldDefaultValue.value = getValidatedFieldValue(fieldValue, this.dataUnit, this.fieldConfig.name);
  }
  handleClearDuplicateChanged({ detail }) {
    this.fieldCleanOnCopy = detail;
  }
  handleRequiredChanged({ detail }) {
    this.fieldRequired = detail;
  }
  handleReadOnlyChanged({ detail }) {
    this.fieldReadOnly = detail;
  }
  loadDefaultValue() {
    var _a;
    if ((_a = this.fieldConfig.defaultValue) === null || _a === void 0 ? void 0 : _a.type) {
      this._defaultType = this.fieldConfig.defaultValue.type;
      return;
    }
    this._defaultType = DEFAULT_TYPE.fixed;
    this.fieldConfig.defaultValue = { type: this._defaultType };
  }
  buildOptions() {
    let interfaceField = this.fieldDescriptor.userInterface;
    if (interfaceField === UserInterface.SEARCH) {
      interfaceField = UserInterface.INTEGERNUMBER;
    }
    return VARS_BY_TYPE.UserInterface[interfaceField];
  }
  renderDefaultValueEditor() {
    if (this._defaultType === DEFAULT_TYPE.variable) {
      return (h("ez-combo-box", { label: this.getMessage('snkConfigOptions.label.valueDefault'), enabled: this.isAllowDefault(), onEzChange: (e) => this.handleDefaultValueChanged(e), value: this.fieldDefaultValue.value, options: this.buildOptions() }));
    }
    return this.fieldDescriptor.userInterface &&
      this.buildFieldDefaultValueElement();
  }
  buildFieldDefaultValueElement() {
    var _a;
    const { userInterface, properties, dataType } = this.fieldDescriptor;
    const allowDefault = properties === null || properties === void 0 ? void 0 : properties.allowDefault;
    let value;
    let enabled = StringUtils.getBooleanValue(allowDefault, !this.fieldReadOnly);
    if (userInterface === UserInterface.FILE) {
      enabled = false;
    }
    if (enabled) {
      value = (_a = this.fieldDefaultValue) === null || _a === void 0 ? void 0 : _a.value;
      if (value != undefined) {
        value = getConvertedValue(dataType, value);
      }
    }
    const configField = {
      value,
      enabled,
      label: this.fieldConfig.label,
      name: this.fieldConfig.name,
      required: this.fieldRequired,
      userInterface,
    };
    switch (userInterface) {
      case UserInterface.SWITCH:
        return this.buildInputDefault(configField, undefined, CheckMode.SWITCH);
      case UserInterface.CHECKBOX:
        return this.buildInputDefault(configField, undefined, CheckMode.REGULAR);
      case UserInterface.OPTIONSELECTOR:
      case UserInterface.DECIMALNUMBER:
        return this.buildInputDefault(configField, properties);
      default:
        return this.buildInputDefault(configField);
    }
  }
  buildInputDefault({ value, enabled, label, name, required, userInterface }, properties = undefined, mode = undefined) {
    let options;
    let precision = 0;
    let prettyPrecision = 0;
    const TagName = userInterface == undefined || TAGS_BY_TYPE[userInterface] == undefined
      ? TAGS_BY_TYPE.DEFAULT
      : TAGS_BY_TYPE[userInterface];
    if (userInterface === UserInterface.OPTIONSELECTOR) {
      const prop = properties === null || properties === void 0 ? void 0 : properties.options;
      if (typeof prop === 'string') {
        const parsed = ObjectUtils.stringToObject(prop);
        options = Object.keys(parsed).map(key => {
          return { value: key, label: parsed[key] };
        });
      }
      else {
        options = prop;
      }
    }
    else if (userInterface === UserInterface.DECIMALNUMBER) {
      precision = Number((properties === null || properties === void 0 ? void 0 : properties.precision) || 2);
      prettyPrecision = Number((properties === null || properties === void 0 ? void 0 : properties.prettyPrecision) || precision);
    }
    return h(TagName, Object.assign({ value: value, enabled: enabled, label: label, "data-field-name": name, key: name, onEzChange: (evt) => this.onChangeDefaultValue(evt === null || evt === void 0 ? void 0 : evt.detail) }, (this.getConditionalAttributes(userInterface, required, options, precision, prettyPrecision, mode))));
  }
  getConditionalAttributes(userInterface, required, options, precision, prettyPrecision, mode) {
    const useSearchPlus = userInterface == UserInterface.SEARCHPLUS;
    switch (userInterface) {
      case UserInterface.SEARCH:
      case UserInterface.SEARCHPLUS:
        return {
          suppressEmptyOption: required,
          optionLoader: (searchArgument) => this.onSearchDefaultValue(searchArgument, { useSearchPlus }),
        };
      case UserInterface.OPTIONSELECTOR:
        return {
          suppressEmptyOption: required,
          options,
        };
      case UserInterface.CHECKBOX:
      case UserInterface.SWITCH:
        return {
          mode,
        };
      case UserInterface.INTEGERNUMBER:
      case UserInterface.DECIMALNUMBER:
        return {
          precision,
          prettyPrecision,
          onEzStartChange: (evt) => this.onChangeDefaultValue(evt === null || evt === void 0 ? void 0 : evt.detail),
        };
      case UserInterface.DATE:
      case UserInterface.DATETIME:
      case UserInterface.TIME:
        return {
          onEzStartChange: (evt) => this.onChangeDefaultValue(evt === null || evt === void 0 ? void 0 : evt.detail),
        };
      default:
        return {};
    }
  }
  onSearchDefaultValue(searchArgument, ctxOptions) {
    if (this._application && this.fieldConfig) {
      return this._application.executeSearch(searchArgument, this.fieldConfig.name, this.dataUnit, ctxOptions);
    }
  }
  initializeValues() {
    this.fieldLabel = this.fieldConfig.label;
    this.fieldDefaultValue = this.fieldConfig.defaultValue;
    this.fieldRequired = this.fieldConfig.required;
    this.fieldReadOnly = this.fieldConfig.readOnly;
    this.fieldCleanOnCopy = this.fieldConfig.cleanOnCopy;
  }
  handleApplyChanges() {
    if (!this.validateFieldLabel())
      return;
    this.fieldConfig.label = this.fieldLabel;
    this.fieldConfig.defaultValue = this.fieldDefaultValue;
    this.fieldConfig.required = this.fieldRequired;
    this.fieldConfig.readOnly = this.fieldReadOnly;
    this.fieldConfig.cleanOnCopy = this.fieldCleanOnCopy;
    this.emitFieldChanged();
    this._popoupElement.opened = false;
  }
  applyErrorMessage() {
    this.fieldLabelErrorMessage = `${this.getMessage('snkConfigOptions.validation.requiredField')} ${this.getMessage('snkConfigOptions.label.nameField')}`;
  }
  handleDiscardChanges() {
    this.initializeValues();
    this._popoupElement.opened = false;
  }
  componentWillLoad() {
    this.loadDefaultValue();
    this._application = ApplicationContext.getContextValue('__SNK__APPLICATION__');
  }
  render() {
    return (h("ez-popup", { heightMode: 'auto', size: 'auto', "ez-title": this.getMessage('snkConfigOptions.fieldConfig.title'), onEzClosePopup: () => this.handleDiscardChanges(), ref: ref => this._popoupElement = ref }, h("div", { class: 'field-config-container' }, h("ez-text-input", { label: this.getMessage('snkConfigOptions.label.nameField'), value: this.fieldLabel, errorMessage: this.fieldLabelErrorMessage, hasInvalid: !!this.fieldLabelErrorMessage, onEzChange: (e) => this.handleLabelChanged(e) }), h("ez-combo-box", { label: this.getMessage('snkConfigOptions.label.typeValueDefault'), suppressEmptyOption: true, enabled: this.enabledValueDefault(), onEzChange: (e) => this.handleDefaultTypeChanged(e), value: this.getDefaultType() }, h("option", { value: DEFAULT_TYPE.fixed }, this.getMessage('snkConfigOptions.options.valueFixed')), h("option", { value: DEFAULT_TYPE.variable }, this.getMessage('snkConfigOptions.options.variable'))), this.renderDefaultValueEditor(), h("ez-check", { label: this.getMessage('snkConfigOptions.label.clearDuplicate'), value: this.fieldCleanOnCopy, onEzChange: (e) => this.handleClearDuplicateChanged(e) }), h("ez-check", { label: this.getMessage('snkConfigOptions.label.requiredField'), enabled: getEnabledByProperty('required', 'systemRequired', this.fieldDescriptor), value: getValueByProperty('required', this.fieldDescriptor, this.fieldRequired), onEzChange: (e) => this.handleRequiredChanged(e) }), h("ez-check", { label: this.getMessage('snkConfigOptions.label.protectedField'), enabled: getEnabledByProperty('readOnly', 'systemReadOnly', this.fieldDescriptor), value: getValueByProperty('readOnly', this.fieldDescriptor, this.fieldReadOnly), onEzChange: (e) => this.handleReadOnlyChanged(e) }), h("div", { class: 'actions' }, h("ez-button", { label: this.getMessage('snkConfigOptions.fieldConfig.buttons.cancel'), onClick: () => this.handleDiscardChanges() }), h("ez-button", { label: this.getMessage('snkConfigOptions.fieldConfig.buttons.confirm'), class: "ez-button--primary", onClick: () => this.handleApplyChanges() })))));
  }
  static get watchers() { return {
    "fieldLabel": ["observeFieldLabel"]
  }; }
  static get style() { return fieldConfigCss; }
}, [2, "field-config", {
    "dataUnit": [16],
    "fieldConfig": [1544, "field-config"],
    "fieldDescriptor": [16],
    "messagesBuilder": [1040],
    "fieldLabel": [32],
    "fieldLabelErrorMessage": [32],
    "fieldDefaultValue": [32],
    "fieldCleanOnCopy": [32],
    "fieldRequired": [32],
    "fieldReadOnly": [32],
    "_defaultType": [32],
    "show": [64]
  }]);
function defineCustomElement() {
  if (typeof customElements === "undefined") {
    return;
  }
  const components = ["field-config"];
  components.forEach(tagName => { switch (tagName) {
    case "field-config":
      if (!customElements.get(tagName)) {
        customElements.define(tagName, FieldConfig);
      }
      break;
  } });
}

export { FieldConfig as F, ID_AVAILABLE_FIELDS as I, SORTABLE_PATH as S, getFieldsStructure as a, buildGuides as b, buildChildrenGuides as c, defineCustomElement as d, buildGuidesMap as e, getFieldsToSave as f, getIconName as g, buildNewGuideName as h, updateTabInFieldsFromGroupList as u };
