"use strict";

exports.__esModule = true;
exports.PickerContentProvider = PickerContentProvider;
var _react = require("@wix/bex-core/react");
var _providers = require("../../providers");
var _react2 = _interopRequireWildcard(require("react"));
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/PickerContent/PickerContentProvider.tsx";
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
function PickerContentProvider(props) {
  const {
    children,
    modalState: {
      fetchInitialProps
    }
  } = props;
  const container = (0, _react.useWixPatternsContainer)();
  const [initialProps] = (0, _react2.useState)(() => {
    var _fetchInitialProps$st;
    return {
      messages: (_fetchInitialProps$st = fetchInitialProps.status.value.data) == null ? void 0 : _fetchInitialProps$st.cairoMessages
    };
  });

  // avoid showing toasts under modal context
  // https://wix.slack.com/archives/C4MVDTET1/p1633861135370100
  const [wixPatternsContainerOverrides] = (0, _react2.useState)(() => ({
    showToast: () => ({
      remove: () => {}
    }),
    events: container.events,
    onNavigationModal: container.onNavigationModal
  }));
  return /*#__PURE__*/_react2.default.createElement(_react.WixPatternsInitialPropsProvider, {
    value: initialProps,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 44,
      columnNumber: 5
    }
  }, /*#__PURE__*/_react2.default.createElement(_react.WixPatternsContainerOverridesProvider, {
    value: wixPatternsContainerOverrides,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 45,
      columnNumber: 7
    }
  }, /*#__PURE__*/_react2.default.createElement(_providers.CairoProvider, {
    value: container,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 48,
      columnNumber: 9
    }
  }, children)));
}
//# sourceMappingURL=PickerContentProvider.js.map