import { r as registerInstance, i as forceUpdate, h, f as Host, g as getElement, e as createEvent } from './index-04f73a26.js';
import { Action, StringUtils, KeyboardManager, ObjectUtils, ApplicationContext } from '@sankhyalabs/core';
import { S as SnkDynaformGuidesViewer, a as SnkFormConfigManager } from './snk-dynaform-guides-view-72e03441.js';
import { buildFormMetadata, FormMetadata, buildFormConfigFromDataUnit } from '@sankhyalabs/ezui/dist/collection/utils/form';
import { S as SnkMessageBuilder } from './DataFetcher-5ed0a377.js';
import './ISave-5b46d691.js';
import { P as PresentationMode } from './index-b40568ff.js';
import '@sankhyalabs/ezui/dist/collection/utils/constants';
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
import './dataunit-fetcher-3b1ca96e.js';
import './filter-item-type.enum-d45e026f.js';
import { U as UserConfigType } from './form-config-fetcher-1c81efc4.js';
import { V as VIEW_MODE, a as TAB_NAMES, G as GROUP_NAMES } from './constants-7b422de0.js';
import { T as TaskbarElement } from './taskbar-elements-63651ca7.js';
import { buildFieldSearch, SHORTCUT_SEARCH_FIELD, ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
import { S as SimpleTaskbarProcessor, D as DEFAULT_TASKBAR_BUTTONS, g as getTopTaskBarId } from './taskbarUtils-6652208b.js';
import { b as buildGuides, a as buildChildrenGuides, c as buildCustomGuides, d as buildGuidesMap, g as getFieldsToSave, u as updateTabInFieldsFromGroupList, e as buildNewGuideName } from './FormConfigHelper-9c7790b3.js';
import './ConfigStorage-32841866.js';
import './PrintUtils-3e4ff0f5.js';
import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
import '@sankhyalabs/core/dist/utils/SortingUtils';
import './ResourceIDUtils-a114189a.js';
import './index-ea250be6.js';

const snkDynaformDetailViewCss = ".sc-snk-dynaform-detail-view-h{display:flex;row-gap:24px;flex-direction:column;width:100%;height:100%;overflow:hidden}.level-path.sc-snk-dynaform-detail-view{color:var(--color--title-primary, #2B3A54);font-weight:var(--text-weight--medium, 400);padding-right:3px}.grid-container.sc-snk-dynaform-detail-view{min-height:100px;height:100%;width:100%;display:flex;flex-wrap:wrap;text-decoration:none;border-radius:var(--border--radius-medium);background-color:var(--color--gray-70, #FFFFFF);border:1px solid var(--color--petroleum-100, #C8CCD3)}.detail-header.sc-snk-dynaform-detail-view{padding-bottom:0}snk-data-unit.sc-snk-dynaform-detail-view{flex:1;gap:var(--space--12, 12px);display:flex;flex-direction:column}snk-grid.sc-snk-dynaform-detail-view{height:100%;--snk-grid-margin:0px;--snk-grid-box-shadow:none}.form-and-detail-container.sc-snk-dynaform-detail-view{display:flex;flex-direction:column;height:100%;width:100%;overflow:auto;padding:var(--space--12, 12px)}.ez-tabselector-internal.sc-snk-dynaform-detail-view{margin:var(--space--8, 8px) 0}.selected-record-header.sc-snk-dynaform-detail-view{display:flex;align-items:center;flex-wrap:wrap;gap:var(--space--8, 8px) var(--space--12, 12px);padding:var(--space--12, 12px) var(--space--16, 16px);margin-bottom:var(--space--12, 12px);background:var(--color--gray-80, #F9F9F9);border-radius:var(--border--radius-12, 12px);font-family:var(--font--pattern);border:1px solid var(--color--petroleum-100, #C8CCD3);border-left:4px solid var(--color--ocean-green-500, #00B07E)}.selected-record-header--message.sc-snk-dynaform-detail-view{border-left-color:var(--color--primary, #007EFF)}.selected-record-header__message.sc-snk-dynaform-detail-view{font-size:var(--font-size--default, 14px);font-weight:var(--font-weight--medium, 500);color:var(--color--title-primary, #2B3A54)}.selected-record-header__chip.sc-snk-dynaform-detail-view{display:inline-flex;flex-direction:row;align-items:center;gap:var(--space--4, 4px);min-width:0}.selected-record-header__label.sc-snk-dynaform-detail-view{font-size:var(--font-size--xs, 11px);font-weight:var(--font-weight--medium, 500);text-transform:uppercase;letter-spacing:0.04em;color:var(--color--text-secondary, #6E7A8A)}.selected-record-header__value.sc-snk-dynaform-detail-view{font-size:var(--font-size--md, 15px);font-weight:var(--font-weight--semibold, 600);color:var(--color--ocean-green-1000, #00281D);line-height:1.2;word-break:break-word}.selected-record-header__separator.sc-snk-dynaform-detail-view{display:inline-block;align-self:stretch;width:1px;background:var(--color--petroleum-100, #C8CCD3);margin:0 var(--space--4, 4px)}";

var __rest = (undefined && undefined.__rest) || function (s, e) {
  var t = {};
  for (var p in s)
    if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
      t[p] = s[p];
  if (s != null && typeof Object.getOwnPropertySymbols === "function")
    for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
      if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
        t[p[i]] = s[p[i]];
    }
  return t;
};
const SnkDynaformDetailView = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this._taskbarProcessor = new SimpleTaskbarProcessor(DEFAULT_TASKBAR_BUTTONS);
    this._currentView = 0;
    this.attachmentRegisterKey = undefined;
    this._fieldToGetFocus = undefined;
    this._hasToCreateFieldSearch = true;
    this._selectedSheet = undefined;
    this._selectedUITab = undefined;
    this._internalErrorTabs = new Set();
    this._selectedRecordPKDisplay = undefined;
    this.formConfigManager = undefined;
    this.dataUnitName = undefined;
    this.resourceID = undefined;
    this.entityName = undefined;
    this.label = undefined;
    this.dataUnit = undefined;
    this.selectedForm = undefined;
    this.dataState = undefined;
    this.messagesBuilder = undefined;
    this.canEdit = true;
    this.taskbarCustomContainerId = undefined;
    this.customEditors = undefined;
    this.customRenders = undefined;
    this.presentationMode = PresentationMode.SECONDARY;
  }
  observeDataUnit(newDataUnit, oldDataUnit) {
    newDataUnit === null || newDataUnit === void 0 ? void 0 : newDataUnit.subscribe(this.dataUnitActionHandler.bind(this));
    oldDataUnit === null || oldDataUnit === void 0 ? void 0 : oldDataUnit.unsubscribe(this.dataUnitActionHandler);
  }
  observerDataState(newValue, oldValue) {
    const openInsertion = !(oldValue === null || oldValue === void 0 ? void 0 : oldValue.insertionMode) && (newValue === null || newValue === void 0 ? void 0 : newValue.insertionMode);
    const closeInsertion = (oldValue === null || oldValue === void 0 ? void 0 : oldValue.insertionMode) && !(newValue === null || newValue === void 0 ? void 0 : newValue.insertionMode);
    if (openInsertion || closeInsertion) {
      this.loadMetadata();
    }
    if (this._formMetadata == undefined) {
      return;
    }
    if (!this.selectedSheetIsDetail()) {
      if (openInsertion) {
        setTimeout(() => {
          this.changeViewMode(VIEW_MODE.FORM);
        }, 0);
      }
      if (closeInsertion) {
        this.changeViewMode(VIEW_MODE.GRID);
      }
    }
  }
  /**
  * Muda o modo de visualização do componente entre VIEW_MODE.GRID e VIEW_MODE.FORM
  * @param mode - Novo modo que o componente deve ser apresentado.
  */
  async changeViewMode(mode) {
    if (!this._viewStack) {
      return;
    }
    this._viewStack.show(mode);
    this._currentView = mode;
  }
  /**
   * Abre o configurador de grid.
   */
  async configGrid() {
    if (this._snkGrid) {
      this._snkGrid.showConfig();
    }
  }
  async showUp() {
    if (this._snkFormView) {
      this._snkFormView.showUp();
    }
    if (this._snkGrid) {
      this._snkGrid.scrollIntoView({ behavior: "smooth", block: "start" });
    }
  }
  /**
   * Registra um editor customizado para campos da grade e formulário.
   */
  async addCustomEditor(fieldName, customEditor) {
    var _a, _b;
    const detailContext = this.normalizeDataUnitName();
    (_a = this._snkGrid) === null || _a === void 0 ? void 0 : _a.addCustomEditor(fieldName, customEditor, detailContext);
    (_b = this._snkFormView) === null || _b === void 0 ? void 0 : _b.addCustomEditor(fieldName, customEditor, detailContext);
  }
  async observerPropsCustomEditor(newValue) {
    for (const fieldName in newValue) {
      await this.addCustomEditor(fieldName, newValue[fieldName]);
    }
  }
  /**
   * Registra um render customizado para colunas da grid.
   */
  async addGridCustomRender(fieldName, customRender) {
    var _a;
    const detailContext = this.normalizeDataUnitName();
    await ((_a = this._snkGrid) === null || _a === void 0 ? void 0 : _a.addGridCustomRender(fieldName, customRender, detailContext));
  }
  onContentCardChanged(evt) {
    SnkDynaformGuidesViewer.updateContentCard(evt.detail.formName, evt.detail.cardConfig, evt.detail.propertyChanged, this.formConfigManager).then(() => forceUpdate(this));
    evt.stopPropagation();
  }
  async observeCustomRenders(newValue) {
    for (const field in newValue) {
      const customRender = newValue[field];
      await this.addGridCustomRender(field, customRender);
    }
  }
  loadMetadata() {
    if (!this.dataUnit || !this.formConfigManager) {
      return;
    }
    if (!this.formConfigManager.isLoaded) {
      return;
    }
    const formConfig = this.formConfigManager.getConfig(this.dataUnit);
    this._formMetadata = buildFormMetadata(formConfig == undefined || formConfig.fields.length === 0 ? undefined : formConfig, this.dataUnit, true);
    this.initSelectedSheet();
  }
  initSelectedSheet() {
    if (!this._formMetadata) {
      return;
    }
    const sheets = this._formMetadata.getAllSheets();
    if (!sheets || sheets.size === 0) {
      this._selectedSheet = undefined;
      return;
    }
    const mainSheet = sheets.get(SnkDynaformDetailView.MAIN_TAB);
    const firstUITab = mainSheet === null || mainSheet === void 0 ? void 0 : mainSheet.fields.map((f) => { var _a; return (_a = f.props) === null || _a === void 0 ? void 0 : _a.UITabName; }).find((name) => !!name);
    if (!this._selectedUITab && !firstUITab) {
      this._selectedUITab = SnkDynaformDetailView.MAIN_TAB;
    }
    if (!this._selectedUITab && firstUITab) {
      this._selectedUITab = firstUITab;
    }
    this._selectedSheet = mainSheet;
  }
  dataUnitReadyHandler(evt) {
    this.dataUnit = evt.detail;
    this.loadMetadata();
  }
  getFormFields() {
    var _a, _b, _c;
    const mainSheet = (_b = (_a = this._formMetadata) === null || _a === void 0 ? void 0 : _a.getAllSheets()) === null || _b === void 0 ? void 0 : _b.get(SnkDynaformDetailView.MAIN_TAB);
    const allMainFields = (_c = mainSheet === null || mainSheet === void 0 ? void 0 : mainSheet.fields) !== null && _c !== void 0 ? _c : [];
    return allMainFields.filter((field) => { var _a; return ((_a = field.props) === null || _a === void 0 ? void 0 : _a.UITabName) === SnkDynaformDetailView.MAIN_TAB; });
  }
  removeUiTabName(fields) {
    return fields.map((field) => {
      var _a;
      if (!((_a = field.props) === null || _a === void 0 ? void 0 : _a.UITabName))
        return field;
      const _b = field.props, restProps = __rest(_b, ["UITabName"]);
      return Object.assign(Object.assign({}, field), { props: restProps });
    });
  }
  getUITabFields() {
    var _a, _b, _c;
    if (!this._selectedUITab)
      return [];
    const mainSheet = (_b = (_a = this._formMetadata) === null || _a === void 0 ? void 0 : _a.getAllSheets()) === null || _b === void 0 ? void 0 : _b.get(SnkDynaformDetailView.MAIN_TAB);
    const allMainFields = (_c = mainSheet === null || mainSheet === void 0 ? void 0 : mainSheet.fields) !== null && _c !== void 0 ? _c : [];
    if (this._selectedUITab === SnkDynaformDetailView.MAIN_TAB) {
      return this.removeUiTabName(allMainFields.filter((field) => { var _a; return !((_a = field.props) === null || _a === void 0 ? void 0 : _a.UITabName); }));
    }
    return this.removeUiTabName(allMainFields.filter((field) => { var _a; return ((_a = field.props) === null || _a === void 0 ? void 0 : _a.UITabName) === this._selectedUITab; }));
  }
  hasMultipleSheets() {
    return true;
  }
  selectedSheetIsDetail() {
    return !!this._selectedSheet && FormMetadata.getDetailName(this._selectedSheet.name) != undefined;
  }
  isSheetDisabled(sheet) {
    var _a;
    if (FormMetadata.getDetailName(sheet.name) == undefined) {
      return false;
    }
    const currentRecord = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getSelectedRecord();
    if (!currentRecord || !this.dataUnit) {
      return true;
    }
    return this.dataUnit.isNewRecord(currentRecord.__record__id__) || this.dataUnit.isMultipleEdition;
  }
  buildInternalTabItems() {
    var _a, _b, _c;
    if (!this._formMetadata) {
      return [];
    }
    const sheets = Array.from(this._formMetadata.getAllSheets().values());
    const mainTab = sheets.find((tab) => tab.name === SnkDynaformDetailView.MAIN_TAB);
    const distinctUITabs = [
      ...new Set(((_a = mainTab === null || mainTab === void 0 ? void 0 : mainTab.fields) !== null && _a !== void 0 ? _a : [])
        .map((field) => { var _a; return (_a = field.props) === null || _a === void 0 ? void 0 : _a.UITabName; })
        .filter((name) => !!name)),
    ];
    if (!distinctUITabs.length) {
      distinctUITabs.push(SnkDynaformDetailView.MAIN_TAB);
    }
    const mainLabel = (_c = (_b = this._formMetadata.getAllSheets().get(SnkDynaformDetailView.MAIN_TAB)) === null || _b === void 0 ? void 0 : _b.label) !== null && _c !== void 0 ? _c : SnkDynaformDetailView.MAIN_TAB;
    const uiTabItems = distinctUITabs.map((tabName, index) => ({
      label: tabName === SnkDynaformDetailView.MAIN_TAB ? mainLabel : tabName,
      tabKey: tabName,
      index,
    }));
    const detailSheets = sheets.filter((sheet) => sheet.name !== SnkDynaformDetailView.MAIN_TAB);
    const sheetItems = detailSheets.map((sheet, index) => ({
      tabKey: sheet.name,
      label: sheet.label,
      index: index + distinctUITabs.length,
      disabled: this.isSheetDisabled(sheet),
      rightIcon: this._internalErrorTabs.has(sheet.name) ? 'alert-circle-inverted' : undefined,
    }));
    return [...uiTabItems, ...sheetItems];
  }
  onInternalTabChange(tab) {
    var _a;
    const allSheets = (_a = this._formMetadata) === null || _a === void 0 ? void 0 : _a.getAllSheets();
    const matchedSheet = allSheets === null || allSheets === void 0 ? void 0 : allSheets.get(tab.tabKey);
    if (matchedSheet && tab.tabKey !== SnkDynaformDetailView.MAIN_TAB) {
      if (this.isSheetDisabled(matchedSheet)) {
        return;
      }
      this._selectedSheet = matchedSheet;
      this._selectedUITab = undefined;
      return;
    }
    this._selectedUITab = tab.tabKey;
    const mainSheet = allSheets === null || allSheets === void 0 ? void 0 : allSheets.get(SnkDynaformDetailView.MAIN_TAB);
    if (mainSheet) {
      this._selectedSheet = mainSheet;
    }
  }
  executeActionHandler(evt) {
    var _a;
    if (evt.detail === TaskbarElement.GRID_MODE) {
      this.changeViewMode(VIEW_MODE.GRID);
      evt.stopPropagation();
    }
    if (evt.detail === TaskbarElement.UPDATE_MULTIPLE && this.dataUnit) {
      this.dataUnit.isMultipleEdition = true;
      this.changeViewMode(VIEW_MODE.FORM);
      evt.stopPropagation();
    }
    if (evt.detail === TaskbarElement.FORM_MODE || evt.detail === TaskbarElement.UPDATE || evt.detail === TaskbarElement.INSERT) {
      this.changeViewMode(VIEW_MODE.FORM);
      evt.stopPropagation();
    }
    if (evt.detail === TaskbarElement.ATTACH) {
      (_a = this._snkAttach) === null || _a === void 0 ? void 0 : _a.open();
      evt.stopPropagation();
    }
  }
  async getAttachmentRegisterKey() {
    if (!this._snkDataUnit) {
      return;
    }
    const recordCriteria = await this._snkDataUnit.getSelectedRecordsIDsInfo();
    const joinedPrimaryKeys = recordCriteria.map(({ value }) => value).join('_');
    return joinedPrimaryKeys;
  }
  async handleDataStateChange({ detail: dataState }) {
    var _a;
    this.dataState = dataState;
    if (dataState.selectedRecord !== undefined && this._snkDataUnit) {
      this.attachmentRegisterKey = (_a = await this.getAttachmentRegisterKey()) !== null && _a !== void 0 ? _a : undefined;
    }
    this._selectedRecordPKDisplay = this.buildSelectedRecordPKDisplay();
  }
  buildSelectedRecordPKDisplay() {
    var _a, _b, _c, _d, _e, _f, _g;
    if (!this.dataUnit) {
      return undefined;
    }
    if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.insertionMode) {
      const message = (_b = this.messagesBuilder) === null || _b === void 0 ? void 0 : _b.getMessage("snkCrud.newRecord");
      return message ? { message } : undefined;
    }
    const selectedRecord = this.dataUnit.getSelectedRecord();
    if (!selectedRecord) {
      return undefined;
    }
    const items = [];
    const fields = (_d = (_c = this.dataUnit.metadata) === null || _c === void 0 ? void 0 : _c.fields) !== null && _d !== void 0 ? _d : [];
    for (const field of fields) {
      if (((_e = field.properties) === null || _e === void 0 ? void 0 : _e.isPrimaryKey) !== "true") {
        continue;
      }
      const rawValue = selectedRecord[field.name];
      const value = (_f = rawValue === null || rawValue === void 0 ? void 0 : rawValue.value) !== null && _f !== void 0 ? _f : rawValue;
      if (value === undefined || value === null || value === "") {
        continue;
      }
      items.push({ label: (_g = field.label) !== null && _g !== void 0 ? _g : field.name, value: String(value) });
    }
    return items.length ? { items } : undefined;
  }
  renderSelectedRecordHeader() {
    var _a;
    if (!this.label && !this._selectedRecordPKDisplay) {
      return undefined;
    }
    const display = this._selectedRecordPKDisplay;
    if (!display) {
      return undefined;
    }
    if (display.message) {
      return (h("div", { class: "selected-record-header selected-record-header--message" }, h("span", { class: "selected-record-header__message" }, display.message)));
    }
    if (!((_a = display.items) === null || _a === void 0 ? void 0 : _a.length)) {
      return undefined;
    }
    return (h("div", { class: "selected-record-header", role: "group" }, display.items.map((item, index) => [
      index > 0 && h("span", { class: "selected-record-header__separator", "aria-hidden": "true" }),
      h("div", { class: "selected-record-header__chip" }, h("span", { class: "selected-record-header__label" }, item.label, ":"), h("span", { class: "selected-record-header__value" }, item.value))
    ])));
  }
  componentWillLoad() {
    var _a;
    this._configName = `dynaform.${this.entityName}`;
    this.formConfigManager = new SnkFormConfigManager(this._configName, (_a = this.resourceID) !== null && _a !== void 0 ? _a : '', () => this.loadMetadata(), this.dataUnit);
    this.formConfigManager.loadConfig();
    if (this.messagesBuilder == undefined) {
      this.messagesBuilder = new SnkMessageBuilder(this.entityName);
    }
  }
  componentWillRender() {
    this.initializeTaskbarProcessor();
  }
  initializeTaskbarProcessor() {
    if (!this.dataState) {
      return;
    }
    const detailTaskbarManager = this.buildDetailTaskbarManager();
    const topTaskbarId = getTopTaskBarId(this.dataState, this.presentationMode);
    this._taskbarProcessor.process(topTaskbarId, detailTaskbarManager, this.dataState, [], []);
  }
  buildDetailTaskbarManager() {
    const EDITION_MODE_BUTTONS = [
      TaskbarElement.CANCEL,
      TaskbarElement.SAVE,
    ];
    const currentView = this._currentView;
    return {
      getButtons: (taskbarID, dataState, defaultButtons) => {
        var _a, _b, _c;
        if (!taskbarID) {
          return [];
        }
        const isInEditionMode = (dataState === null || dataState === void 0 ? void 0 : dataState.insertionMode) || (dataState === null || dataState === void 0 ? void 0 : dataState.isDirty);
        if (isInEditionMode) {
          return EDITION_MODE_BUTTONS;
        }
        let buttons = [...defaultButtons];
        if (currentView === VIEW_MODE.FORM) {
          const indexFormMode = buttons.indexOf(TaskbarElement.FORM_MODE);
          if (indexFormMode > -1) {
            buttons = [
              ...buttons.slice(0, indexFormMode),
              TaskbarElement.GRID_MODE,
              ...buttons.slice(indexFormMode + 1),
            ];
          }
        }
        if (((_c = (_b = (_a = dataState === null || dataState === void 0 ? void 0 : dataState.selectionInfo) === null || _a === void 0 ? void 0 : _a.records) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0) > 1) {
          const indexUpdate = buttons.indexOf(TaskbarElement.UPDATE);
          if (indexUpdate > -1) {
            buttons = [
              ...buttons.slice(0, indexUpdate),
              TaskbarElement.UPDATE_MULTIPLE,
              ...buttons.slice(indexUpdate + 1),
            ];
          }
        }
        return buttons;
      },
      isEnabled: (_, dataState, buttonName, originalValue) => {
        if (!dataState) {
          return originalValue;
        }
        const hasSelectedRecord = dataState.selectedRecord !== undefined;
        const buttonsRequiringSelection = [
          TaskbarElement.UPDATE,
          TaskbarElement.REMOVE,
          TaskbarElement.ATTACH,
          TaskbarElement.CLONE,
        ];
        if (!hasSelectedRecord && buttonsRequiringSelection.includes(buttonName)) {
          return false;
        }
        if (buttonName === TaskbarElement.PREVIOUS && !dataState.hasPrevious) {
          return false;
        }
        if (buttonName === TaskbarElement.NEXT && !dataState.hasNext) {
          return false;
        }
        if (buttonName === TaskbarElement.INSERT && dataState.insertionMode) {
          return false;
        }
        return originalValue;
      },
    };
  }
  async componentDidLoad() {
    if (this.customEditors) {
      await this.observerPropsCustomEditor(this.customEditors);
    }
    if (this.customRenders) {
      await this.observeCustomRenders(this.customRenders);
    }
    this.initKeyboardManager();
  }
  disconnectedCallback() {
    var _a;
    (_a = this._keyboardManager) === null || _a === void 0 ? void 0 : _a.unbindAllShortcutKeys();
  }
  async dataUnitActionHandler(action) {
    var _a;
    if (action.type === Action.FIELD_INVALIDATED) {
      const sheetName = this.findSheetOfField((_a = action.payload) === null || _a === void 0 ? void 0 : _a.fieldName);
      if (sheetName) {
        this._internalErrorTabs = new Set([...this._internalErrorTabs, sheetName]);
      }
    }
  }
  findSheetOfField(fieldName) {
    var _a;
    if (!fieldName || !this._formMetadata) {
      return undefined;
    }
    const sheets = this._formMetadata.getAllSheets();
    for (const [sheetName, sheet] of sheets) {
      if ((_a = sheet.fields) === null || _a === void 0 ? void 0 : _a.some((f) => f.name === fieldName)) {
        return sheetName;
      }
    }
    return undefined;
  }
  normalizeDataUnitName() {
    var _a, _b;
    return (_b = (_a = this.dataUnitName) === null || _a === void 0 ? void 0 : _a.replace(/\//g, '>')) !== null && _b !== void 0 ? _b : '';
  }
  getSettingsListForm() {
    var _a, _b;
    const hardList = [{
        value: StringUtils.generateUUID(),
        label: (_b = (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage("snkCrud.findColumn", undefined)) !== null && _b !== void 0 ? _b : "",
        disableCloseOnSelect: true,
        eagerInitialize: true,
        itemBuilder: (_, item) => this.getFieldsSearch(item)
      }];
    return hardList;
  }
  getFieldsSearch(item) {
    var _a;
    if (this._fieldSearch === undefined || this._hasToCreateFieldSearch) {
      this._hasToCreateFieldSearch = false;
      this._fieldSearch = buildFieldSearch(item, ({ argument }) => this.fieldsOptionLoader(argument), (option) => this.onSelectField(option));
    }
    return (_a = this._fieldSearch) !== null && _a !== void 0 ? _a : document.createElement('div');
  }
  fieldsOptionLoader(argument) {
    const searchTerm = argument === null || argument === void 0 ? void 0 : argument.toLowerCase();
    const allFields = this.getFormFields().map(field => { var _a; return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(field.name); });
    const filteredFields = allFields.filter(field => {
      var _a, _b;
      if (!field) {
        return;
      }
      return ((_a = field.name) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchTerm)) ||
        ((_b = field.label) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(searchTerm));
    });
    const options = filteredFields.map((field) => {
      if (!field) {
        return;
      }
      return ({ value: field.name, label: field.label });
    });
    return Promise.resolve(options);
  }
  onSelectField(option) {
    if (option == undefined) {
      return;
    }
    this._fieldToGetFocus = option.value;
  }
  clearFieldToFocusHandler() {
    this._fieldToGetFocus = undefined;
  }
  getColumnSearch(item) {
    var _a;
    if (this._columnSearch !== undefined) {
      return this._columnSearch;
    }
    this._columnSearch = buildFieldSearch(item, ({ argument }) => new Promise(accept => {
      var _a;
      (_a = this._snkGrid) === null || _a === void 0 ? void 0 : _a.filterColumns(argument).then((columns) => {
        accept(columns
          .filter(column => !column.hidden)
          .map(column => ({ label: column.label, value: column.name })));
      });
    }), (option) => {
      var _a;
      if (option != undefined) {
        (_a = this._snkGrid) === null || _a === void 0 ? void 0 : _a.locateColumn(option.value);
      }
    });
    return (_a = this._columnSearch) !== null && _a !== void 0 ? _a : document.createElement('div');
  }
  buildTaskbarCustomActionsList() {
    return [this.buildSearchColumnTaskbarAction()];
  }
  buildSearchColumnTaskbarAction() {
    var _a, _b;
    return {
      value: StringUtils.generateUUID(),
      label: (_b = (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage('snkGrid.findColumn', {})) !== null && _b !== void 0 ? _b : "",
      disableCloseOnSelect: true,
      eagerInitialize: true,
      itemBuilder: (_, item) => { var _a; return (_a = this.getColumnSearch(item)) !== null && _a !== void 0 ? _a : document.createElement('div'); },
    };
  }
  async initKeyboardManager() {
    var _a;
    this._keyboardManager = new KeyboardManager({ propagate: false, element: this._element });
    this._keyboardManager.bind(SHORTCUT_SEARCH_FIELD, async () => {
      var _a;
      await ((_a = this._snkFormView) === null || _a === void 0 ? void 0 : _a.showSearchField());
    }, { description: (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage("snkSimpleCrud.findFields"), element: this._element });
  }
  renderTabSelector() {
    var _a;
    if (!this.hasMultipleSheets()) {
      return undefined;
    }
    const selectedKey = (_a = this._selectedUITab) !== null && _a !== void 0 ? _a : (this._selectedSheet && this._selectedSheet.name !== SnkDynaformDetailView.MAIN_TAB
      ? this._selectedSheet.name
      : undefined);
    return (h("ez-tabselector", { class: "ez-tabselector-internal", tabs: this.buildInternalTabItems(), selectedTab: selectedKey, onEzChange: (evt) => this.onInternalTabChange(evt.detail) }));
  }
  renderUITabForm() {
    if (!this._selectedUITab) {
      return undefined;
    }
    const fields = this.getUITabFields();
    if (fields.length === 0) {
      return undefined;
    }
    return (h("snk-dynaform-form-view", { key: `uitab_${this._selectedUITab}`, name: `${SnkDynaformDetailView.MAIN_TAB}__${this._selectedUITab}`, formMetadata: this._formMetadata, dataUnit: this.dataUnit, fields: fields, fieldToFocus: this._fieldToGetFocus, label: this._selectedUITab, onSnkRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this), fieldSearch: this._fieldSearch }));
  }
  renderSubDetail() {
    if (!this._selectedSheet || this._selectedSheet.name === SnkDynaformDetailView.MAIN_TAB) {
      return undefined;
    }
    const childEntityName = FormMetadata.getDetailName(this._selectedSheet.name);
    if (!childEntityName) {
      return undefined;
    }
    return (h("snk-dynaform-detail-view", { key: `sub_${this.dataUnitName}_${this._selectedSheet.name}`, dataUnitName: `${this.dataUnitName}/${childEntityName}`, entityName: childEntityName, label: this._selectedSheet.label, resourceID: this.resourceID, canEdit: this.canEdit, messagesBuilder: this.messagesBuilder, customEditors: this.customEditors, customRenders: this.customRenders, presentationMode: this.presentationMode, taskbarCustomContainerId: this.taskbarCustomContainerId }));
  }
  renderViewStack() {
    var _a, _b;
    return (h("ez-view-stack", { ref: (ref) => this._viewStack = ref }, h("stack-item", { class: "ez-size-width--full ez-size-height--full" }, h("snk-grid", { class: "ez-size-width--full ez-size-height--full", ref: (ref) => {
        if (ref)
          this._snkGrid = ref;
      }, configName: this._configName, messagesBuilder: this.messagesBuilder, onGridDoubleClick: () => this.changeViewMode(VIEW_MODE.FORM), onActionClick: (evt) => this.executeActionHandler(evt), presentationMode: this.presentationMode, canEdit: this.canEdit, isDetail: true, taskbarCustomContainerId: this.taskbarCustomContainerId, gridHeaderCustomSlotId: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS", topTaskbarCustomSlotId: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS", outlineMode: true, enableGridInsert: true, autoLoad: true, multipleEditionEnabled: true, multipleSelection: true, hideHeader: true, hideGridTaskbar: true })), h("stack-item", { class: "ez-size-width--full ez-size-height--full grid-container" }, h("div", { class: "form-and-detail-container" }, h("snk-dynaform-form-view", { ref: (ref) => {
        if (ref)
          this._snkFormView = ref;
      }, name: SnkDynaformDetailView.MAIN_TAB, formMetadata: this._formMetadata, dataUnit: this.dataUnit, fields: this.getFormFields(), fieldToFocus: this._fieldToGetFocus, label: this.label, onSnkRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this), fieldSearch: this._fieldSearch }, this.renderSelectedRecordHeader()), this.renderTabSelector(), this.renderUITabForm(), this.renderSubDetail())), h("snk-attach", { ref: (ref) => this._snkAttach = ref, registerKey: (_a = this.attachmentRegisterKey) !== null && _a !== void 0 ? _a : '', messagesBuilder: this.messagesBuilder, entityName: (_b = this.entityName) !== null && _b !== void 0 ? _b : '' })));
  }
  render() {
    return (h(Host, null, h("snk-data-unit", { ref: (el) => {
        if (el)
          this._snkDataUnit = el;
      }, dataUnitName: `${this.dataUnitName}`, onDataUnitReady: evt => this.dataUnitReadyHandler(evt), entityName: this.entityName, onDataStateChange: this.handleDataStateChange.bind(this), ignoreSaveMessage: this._currentView === VIEW_MODE.GRID, messagesBuilder: this.messagesBuilder, configName: this._configName }, h("snk-taskbar", { key: "detailViewTaskbar", class: "form-taskbar", "data-element-id": "detail_top", configName: this._configName, messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, primaryButton: "INSERT", overflowStrategy: "hiddenItems", alignRigth: true, sizeButtons: 'small', presentationMode: this.presentationMode, onActionClick: evt => this.executeActionHandler(evt), dataUnit: this.dataUnit, resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: "DETAIL_TASKBAR_CUSTOM_ELEMENTS", actionsSettingsList: this.getSettingsListForm(), customActionsList: this.buildTaskbarCustomActionsList() }, h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" })), this.renderViewStack())));
  }
  get _element() { return getElement(this); }
  static get watchers() { return {
    "dataUnit": ["observeDataUnit"],
    "dataState": ["observerDataState"],
    "customEditors": ["observerPropsCustomEditor"],
    "customRenders": ["observeCustomRenders"]
  }; }
};
SnkDynaformDetailView.MAIN_TAB = "__main";
SnkDynaformDetailView.style = snkDynaformDetailViewCss;

const snkDynaformFormConfigCss = ".sc-snk-dynaform-form-config-h{display:flex;flex-direction:column;height:100vh;width:100%;font-family:var(--font-pattern, \"Roboto\");background:white;color:#2b3a54;--snk-form-config-container-height:calc(100vh - 95px);outline:none}.form-config-body.sc-snk-dynaform-form-config{height:var(--snk-form-config-container-height);overflow:hidden;padding-top:var(--space--12, 12px)}.form-config-layout.sc-snk-dynaform-form-config{display:flex;flex-direction:row;height:100%;gap:20px;align-items:stretch}.main-editing-area.sc-snk-dynaform-form-config{display:flex;flex-direction:column;flex:1;min-width:0;height:100%;overflow:hidden;gap:12px}.main-editing-area.sc-snk-dynaform-form-config>fields-layout.sc-snk-dynaform-form-config{flex:1;min-height:0;overflow:hidden}.guide-header.sc-snk-dynaform-form-config{display:flex;width:100%;padding-bottom:12px;border-bottom:1px solid #dce0e8;height:30px;font-weight:500;font-size:16px}";

const SnkDynaformFormConfig = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.configClose = createEvent(this, "configClose", 7);
    this.configChange = createEvent(this, "configChange", 7);
    this.guidesMap = new Map();
    this.availableFields = [];
    this.guidesList = [];
    this.groupsList = [];
    this.selectedGuide = undefined;
    this._formConfig = {};
    this.configOptions = [];
    this.originalConfigSelected = undefined;
    this.configSelected = undefined;
    this.hasChanges = false;
    this.optionConfigChanged = false;
    this.dataUnit = undefined;
    this.configManager = undefined;
    this.ignoreReadOnlyFormFields = undefined;
    this.messagesBuilder = undefined;
    this.customGuidesConfig = [];
  }
  handleFieldConfigChanged() {
    this.hasChanges = true;
  }
  async handleFormConfigOptionSelected({ detail }) {
    this.configSelected = detail;
    await this.loadConfigByUser();
    this.selectedGuide = undefined;
    this.optionConfigChanged = !ObjectUtils.equals(this.configSelected, this.originalConfigSelected);
    if (this.configSelected.origin === UserConfigType.DEFAULT) {
      this.hasChanges = false;
    }
  }
  async handleAddFieldToGuide({ detail: fieldItem }) {
    var _a;
    if (!this.selectedGuide) {
      this.showNoGuideSelectedDialog();
      return;
    }
    if (this.selectedGuide.isCustom || this.selectedGuide.isDetail) {
      this.showCanNotAddFieldToGuideDialog();
      return;
    }
    this.availableFields = [...this.availableFields.filter(f => f.name !== fieldItem.name)];
    await ((_a = this.refFieldsLayout) === null || _a === void 0 ? void 0 : _a.addFieldToLayout(fieldItem));
  }
  async handleSetFieldAsAvailable({ detail }) {
    const hasField = this.availableFields.some(f => f.name === detail.name);
    if (hasField)
      return;
    this.availableFields = [...this.availableFields, detail];
  }
  async handleRemoveFieldFromAvailable({ detail }) {
    this.availableFields = this.availableFields.filter(f => f.name !== detail.name);
  }
  observeSelectedGuide(guide) {
    var _a;
    const guideGroups = (_a = this.guidesMap.get(guide === null || guide === void 0 ? void 0 : guide.name)) !== null && _a !== void 0 ? _a : [];
    this.groupsList = [...guideGroups];
  }
  observeConfigManager() {
    this.loadFormConfig();
  }
  showNoGuideSelectedDialog() {
    const title = this.getMessage('snkFormConfig.noGuideSelected.title');
    const message = this.getMessage('snkFormConfig.noGuideSelected.message');
    ApplicationUtils.alert(title, message);
  }
  showCanNotAddFieldToGuideDialog() {
    const title = this.getMessage('snkFormConfig.canNotAddFieldToGuide.title');
    const message = this.getMessage('snkFormConfig.canNotAddFieldToGuide.message');
    ApplicationUtils.alert(title, message);
  }
  /**
   * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
   * através de um pequeno modulo na estrutura da aplicação:
   * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
   * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-form.msg.ts"
   */
  getMessage(key, params) {
    return this.messagesBuilder.getMessage(key, params);
  }
  async initializeUserConfig() {
    if (this.configManager == undefined)
      return;
    try {
      const userConfig = await this.configManager.fetchUserAvailableConfigs();
      this.configOptions = userConfig;
      const isDefault = this._formConfig != undefined ? this._formConfig.defaultConfiguration : true;
      const origin = (isDefault ? UserConfigType.DEFAULT : UserConfigType.USER);
      this.configSelected = userConfig === null || userConfig === void 0 ? void 0 : userConfig.find((config) => config.origin === origin);
      this.originalConfigSelected = userConfig === null || userConfig === void 0 ? void 0 : userConfig.find((config) => config.origin === origin);
    }
    catch (error) {
      console.error(this.getMessage('snkFormConfig.errors.failFetchUserConfig'));
      console.error(error);
    }
  }
  async loadConfigByUser() {
    if (!this.configManager || !this.configSelected)
      return;
    if (this.isConfigDefaultSelected()) {
      await this.handleLoadDefaultConfig();
    }
    else {
      this.loadFormConfig();
    }
  }
  async handleLoadDefaultConfig() {
    const defaultConfig = await this.configManager.fetchDefaultConfig();
    if (defaultConfig) {
      this.loadFormConfig(defaultConfig);
      return;
    }
    const emptyConfig = this.configManager.getEmptyConfig();
    if (emptyConfig) {
      this.loadFormConfig(emptyConfig);
    }
  }
  isConfigDefaultSelected() {
    return this.configSelected.origin === UserConfigType.DEFAULT;
  }
  loadFormConfig(config) {
    this._formConfig = config ? config : this.getConfig();
    this.loadGuides();
    this.initializeAvailableFields();
  }
  initializeAvailableFields() {
    var _a;
    if (((_a = this._formConfig) === null || _a === void 0 ? void 0 : _a.fields) == undefined)
      return;
    const fieldsFormConfig = [...this._formConfig.fields];
    const fieldsMetadata = this.dataUnit.metadata.fields;
    this.availableFields = fieldsMetadata.filter(({ name: fieldName, visible: fieldVisible, properties }) => {
      const hasCfg = fieldsFormConfig.some(({ name: fieldFormName }) => fieldFormName === fieldName);
      /**
       * Quando a visibilidade de um campo é alterada pelo dataunit, mas o desenvolvedor deseja que o mesmo continue
       * sendo apresentado no configurador, precisamos fazer essa tratativa, verificando se o campo não tem configuração
       */
      if (!hasCfg && properties.visibleOnConfig === true && !fieldVisible)
        return properties.visibleOnConfig;
      return fieldVisible === true && hasCfg === false;
    });
  }
  getInitialOrder(guidesList) {
    var _a, _b;
    if (Array.isArray((_a = this._formConfig) === null || _a === void 0 ? void 0 : _a.tabs)) {
      return (_b = this._formConfig.tabs) === null || _b === void 0 ? void 0 : _b.length;
    }
    if (guidesList.length > 0) {
      return Math.max(...guidesList.map(g => g.order));
    }
    return 0;
  }
  loadGuides() {
    var _a;
    this.guidesList = [];
    this.guidesList.push(...buildGuides(this._formConfig, this.getMessage('snkFormConfig.form.mainArea')));
    this.guidesList.push(...buildChildrenGuides(this.dataUnit, this.getInitialOrder(this.guidesList), this.guidesList));
    this.guidesList.push(...buildCustomGuides(this.customGuidesConfig, this.guidesList));
    this.guidesMap = buildGuidesMap((_a = this._formConfig) === null || _a === void 0 ? void 0 : _a.fields, this.guidesList, this.dataUnit, this.getMessage('snkFormConfig.form.tabGeneral'));
  }
  getConfig() {
    let config = this.configManager.getConfig(this.dataUnit, false);
    if (config.fields && config.fields.length === 0) {
      config = undefined;
    }
    if (config == undefined) {
      config = buildFormConfigFromDataUnit(this.dataUnit);
    }
    return ObjectUtils.copy(config);
  }
  handleSelectGuide({ detail: selectedGuide }) {
    this.selectedGuide = selectedGuide;
  }
  handleLayoutChanged({ detail: newGroupList }) {
    this.hasChanges = true;
    this.groupsList = [...newGroupList];
    this.guidesMap.set(this.selectedGuide.name, [...newGroupList]);
  }
  getIsDefaultConfig() {
    var _a;
    const optionSelected = (_a = this.configSelected) === null || _a === void 0 ? void 0 : _a.origin;
    return optionSelected === UserConfigType.DEFAULT
      && this.optionConfigChanged === true
      && this.hasChanges === false;
  }
  getTabsToSave() {
    return this.guidesList.map(tab => {
      return {
        name: tab.name,
        label: tab.name === TAB_NAMES.main ? tab.name : tab.label,
        order: tab.name === TAB_NAMES.main ? 0 : tab.order,
        visible: tab.visible,
      };
    });
  }
  async handleSaveConfig() {
    var _a;
    const savedConfig = await this.configManager.saveConfig(this.buildConfigToSave());
    this.configSelected = (_a = this.configOptions) === null || _a === void 0 ? void 0 : _a.find((config) => {
      return config.origin === (this.hasChanges ? UserConfigType.USER : UserConfigType.DEFAULT);
    });
    this.originalConfigSelected = this.configSelected;
    this.hasChanges = false;
    this.optionConfigChanged = false;
    ApplicationUtils.info(this.getMessage('snkFormConfig.info.successfullyConfigSaved'), { iconName: 'check' });
    this.configChange.emit(savedConfig);
  }
  buildConfigToSave() {
    if (this.getIsDefaultConfig()) {
      const formConfig = this._formConfig;
      formConfig.defaultConfiguration = true;
      return formConfig;
    }
    const formConfig = ObjectUtils.copy(this._formConfig);
    formConfig.tabs = this.getTabsToSave();
    formConfig.fields = getFieldsToSave(this.guidesMap);
    formConfig.defaultConfiguration = false;
    return formConfig;
  }
  handleAvailableFieldListChanged({ detail: updatedList }) {
    this.availableFields = [...updatedList];
  }
  handleSetFieldListAsAvailable({ detail: updatedList }) {
    this.availableFields = [...this.availableFields, ...updatedList];
  }
  handleGuideDeleted({ detail: guide }) {
    var _a, _b;
    const guideName = guide.name;
    const guideGroups = (_a = this.guidesMap.get(guideName)) !== null && _a !== void 0 ? _a : [];
    const fieldsToAvailable = [];
    guideGroups.forEach(group => fieldsToAvailable.push(...group.fields));
    this.availableFields = [...this.availableFields, ...fieldsToAvailable];
    this.guidesList = [...this.guidesList.filter(g => g.name !== guideName)];
    this.guidesMap.delete(guideName);
    if (((_b = this.selectedGuide) === null || _b === void 0 ? void 0 : _b.name) === guideName) {
      this.selectedGuide = undefined;
    }
    this.hasChanges = true;
  }
  handleGuideListChanged({ detail: updatedList }) {
    this.hasChanges = true;
    this.guidesList = [...updatedList];
  }
  handleGuideRenamed({ detail: updatedName }) {
    var _a;
    const guideGroups = (_a = this.guidesMap.get(this.selectedGuide.name)) !== null && _a !== void 0 ? _a : [];
    const updatedGroups = updateTabInFieldsFromGroupList(guideGroups, updatedName);
    this.guidesMap.delete(this.selectedGuide.name);
    this.guidesMap.set(updatedName, updatedGroups);
    const updatedGuide = {
      name: updatedName,
      label: updatedName,
      visible: this.selectedGuide.visible,
      order: this.selectedGuide.order,
    };
    this.guidesList = [...this.guidesList.map(guide => (guide.name === this.selectedGuide.name) ? updatedGuide : guide)];
    this.groupsList = [...updatedGroups];
    this.selectedGuide = updatedGuide;
    this.hasChanges = true;
  }
  handleCreateNewGuide() {
    const newGuideName = buildNewGuideName(this.guidesList, this.getMessage.bind(this));
    const newGuide = {
      name: newGuideName,
      label: newGuideName,
      visible: true,
      order: this.guidesList.length + 1,
    };
    const newGuideFixedGroup = {
      name: GROUP_NAMES.noGroup,
      fields: [],
    };
    this.guidesList = [...this.guidesList, newGuide];
    this.guidesMap.set(newGuideName, [newGuideFixedGroup]);
    this.selectedGuide = newGuide;
    this.hasChanges = true;
  }
  getGuideNames() {
    return [
      ...this.guidesList.map(g => g.name.toLowerCase()),
      this.getMessage('snkFormConfig.form.mainArea').toLowerCase(),
    ];
  }
  async componentWillRender() {
    if (this.messagesBuilder == undefined) {
      const application = ApplicationContext.getContextValue('__SNK__APPLICATION__');
      this.messagesBuilder = application.messagesBuilder;
    }
  }
  async componentWillLoad() {
    this.loadFormConfig();
    await this.initializeUserConfig();
  }
  render() {
    return (h(Host, null, h("snk-dynaform-config-header", { configOptions: this.configOptions, selectedConfig: this.configSelected, messagesBuilder: this.messagesBuilder, hasChanges: this.hasChanges, optionConfigChanged: this.optionConfigChanged, onConfigClose: () => this.configClose.emit(), onSaveConfig: async () => await this.handleSaveConfig() }), h("div", { class: "form-config-body" }, h("div", { class: "form-config-layout" }, h("snk-dynaform-fields-selector", { dataUnit: this.dataUnit, availableFields: this.availableFields, onFieldListChanged: this.handleAvailableFieldListChanged.bind(this), messagesBuilder: this.messagesBuilder }), h("div", { class: "main-editing-area" }, h("snk-dynaform-guides-configurator", { messagesBuilder: this.messagesBuilder, guidesList: this.guidesList, selectedGuide: this.selectedGuide, onGuideSelected: this.handleSelectGuide.bind(this), onGuideListChanged: this.handleGuideListChanged.bind(this), onCreateNewGuide: this.handleCreateNewGuide.bind(this), onGuideDeleted: this.handleGuideDeleted.bind(this) }), h("snk-dynaform-fields-layout", { ref: ref => this.refFieldsLayout = ref, selectedGuide: this.selectedGuide, guideNames: this.getGuideNames(), groupsList: this.groupsList, messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, onGuideRenamed: this.handleGuideRenamed.bind(this), onLayoutChanged: this.handleLayoutChanged.bind(this), onSetFieldListAsAvailable: this.handleSetFieldListAsAvailable.bind(this) }))))));
  }
  static get watchers() { return {
    "selectedGuide": ["observeSelectedGuide"],
    "configManager": ["observeConfigManager"]
  }; }
};
SnkDynaformFormConfig.style = snkDynaformFormConfigCss;

export { SnkDynaformDetailView as snk_dynaform_detail_view, SnkDynaformFormConfig as snk_dynaform_form_config };
