"use strict";

exports.__esModule = true;
exports.useCreatePickerStandalone = useCreatePickerStandalone;
exports.usePickerStandalone = usePickerStandalone;
var _react = require("react");
var _state = require("../../state");
var _react2 = require("@wix/bex-core/react");
function useCreatePickerStandalone() {
  const {
    window,
    errorMonitor,
    createBILogger
  } = (0, _react2.useWixPatternsContainer)();
  const containerOverrides = (0, _react2.useWixPatternsContainerOverrides)();
  const createCollection = (0, _react2.useCreateCollection)();
  return (0, _react.useCallback)(config => {
    const {
      noItemsAvailableDestinationUrl,
      initialSelect,
      logoType = 'wix',
      defaultDestinationUrl,
      urlSegmentPropertyMap,
      events,
      shouldFilterNotAffectTotalCount,
      ...collectionConfig
    } = config;
    const collection = createCollection({
      persistQueryToUrl: true,
      ...collectionConfig,
      events
    });
    return new _state.PickerStandaloneState({
      collection,
      noItemsAvailableDestinationUrl,
      initialSelect,
      defaultDestinationUrl,
      urlSegmentPropertyMap,
      window: containerOverrides.window ?? window,
      errorMonitor,
      logoType,
      shouldFilterNotAffectTotalCount,
      events,
      createBILogger
    });
  }, []);
}
function usePickerStandalone(config) {
  const createPickerStandalone = useCreatePickerStandalone();
  const [state] = (0, _react.useState)(() => createPickerStandalone(config));
  return state;
}
//# sourceMappingURL=usePickerStandalone.js.map