"use strict";

exports.__esModule = true;
exports.useTableCollection = void 0;
var _react = require("@wix/bex-core/react");
var _state = require("../state");
var _useOptionalCachedState = require("./useOptionalCachedState");
const useTableCollection = config => {
  var _config$aiAssistant;
  const container = (0, _react.useWixPatternsContainer)();
  const createCollection = (0, _react.useCreateCollection)();
  const state = (0, _useOptionalCachedState.useOptionalCachedState)(() => {
    return new _state.TableState({
      collection: createCollection(config),
      container
    });
  });
  (_config$aiAssistant = config.aiAssistant) == null || _config$aiAssistant.useAiAssistant({
    collection: state.collection,
    loadingRowState: state.loadingRowState
  });
  return state;
};
exports.useTableCollection = useTableCollection;
//# sourceMappingURL=useTableCollection.js.map