"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.transformSliceNestedExpandToExpand = void 0;
var _model = require("@atlaskit/editor-prosemirror/model");
var _slice = require("../utils/slice");
var transformSliceNestedExpandToExpand = exports.transformSliceNestedExpandToExpand = function transformSliceNestedExpandToExpand(slice, schema) {
  var _schema$nodes = schema.nodes,
    expand = _schema$nodes.expand,
    nestedExpand = _schema$nodes.nestedExpand;
  var children = [];
  (0, _slice.mapChildren)(slice.content, function (node) {
    if (node.type === nestedExpand) {
      children.push(expand.createChecked(node.attrs, node.content, node.marks));
    } else {
      children.push(node);
    }
  });
  return new _model.Slice(_model.Fragment.fromArray(children), slice.openStart, slice.openEnd);
};