"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.isPanelNestingTableSupported = void 0;
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
/*
 * Returns true if the schema supports nesting a table inside a panel (panel_c1 variant),
 * AND the `platform_editor_nest_table_in_panel` experiment is enabled.
 *
 * ```typescript
 * const supportsTableInPanel = isPanelNestingTableSupported(state.schema);
 * ```
 */
var isPanelNestingTableSupported = exports.isPanelNestingTableSupported = function isPanelNestingTableSupported(schema) {
  var _panel_c1$contentMatc;
  var _schema$nodes = schema.nodes,
    table = _schema$nodes.table,
    panel_c1 = _schema$nodes.panel_c1;
  if (!table || !panel_c1) {
    return false;
  }

  // Confirm the PM schema actually allows table inside panel_c1
  var panelC1CanContainTable = ((_panel_c1$contentMatc = panel_c1.contentMatch.matchType(table)) === null || _panel_c1$contentMatc === void 0 ? void 0 : _panel_c1$contentMatc.validEnd) === true;
  return panelC1CanContainTable && (0, _expValEquals.expValEquals)('platform_editor_nest_table_in_panel', 'isEnabled', true);
};