"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.GridSectionsSectionState = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _state = require("../../state");
var _mobx = require("mobx");
class GridSectionsSectionState {
  constructor(params) {
    (0, _defineProperty2.default)(this, "gridBase", void 0);
    (0, _defineProperty2.default)(this, "gridSections", void 0);
    (0, _defineProperty2.default)(this, "sectionDescriptor", void 0);
    this.gridSections = params.gridSections;
    this.sectionDescriptor = params.sectionDescriptor;
    const {
      imagePlacement,
      draggable,
      layoutType
    } = params;
    const {
      toolbar
    } = this.gridSections;
    this.gridBase = new _state.GridBaseState({
      container: toolbar.container,
      toolbar: toolbar,
      collection: toolbar.collection,
      sizePreset: imagePlacement ? _state.gridSizePresets[imagePlacement] : _state.topGridSizePreset,
      range: params.sectionDescriptor.range,
      parentState: this.gridSections.parentState,
      layoutType,
      draggable
    });
    (0, _mobx.makeObservable)(this, {
      isLast: _mobx.computed
    });
  }
  get isLast() {
    var _sections;
    const {
      sectionDescriptor: {
        section
      },
      gridSections: {
        sections
      }
    } = this;
    return ((_sections = sections[sections.length - 1]) == null ? void 0 : _sections.section.id) === section.id;
  }
}
exports.GridSectionsSectionState = GridSectionsSectionState;
//# sourceMappingURL=GridSectionsSectionState.js.map