"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.NestedTableNodeStateBIReporter = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _bexCore = require("@wix/bex-core");
var _bi = require("@wix/bex-core/bi");
const withoutDefaults = (0, _bexCore.withoutIrrelevant)();
class NestedTableNodeStateBIReporter {
  constructor(_state) {
    (0, _defineProperty2.default)(this, "state", void 0);
    (0, _defineProperty2.default)(this, "reportExpandCollapse", () => {
      const {
        state
      } = this;
      const {
        parent,
        parentNode,
        node: {
          _expanded
        }
      } = state;
      const {
        nestedTable: {
          bi,
          toolbar
        }
      } = state;
      if (parent == null || parentNode == null) {
        return;
      }
      bi.reportBi(withoutDefaults(_bi.cairoNestedTableCollapseAndExpand)({
        ...toolbar._commonDynamicBiParams(),
        clickType: _expanded ? 'Expand' : 'Collapse',
        itemId: parent.id,
        itemIndex: state._rowNum,
        currentLevel: parentNode.childrenDepth,
        numLevels: state.nestedTable.levels.length
      }));
    });
    this.state = _state;
  }
}
exports.NestedTableNodeStateBIReporter = NestedTableNodeStateBIReporter;
//# sourceMappingURL=NestedTableNodeStateBIReporter.js.map