import { __exports as _ } from "../../../../_virtual/with-selector.production.min.es.js";
import O from "react";
import { __require as R } from "../../shim/index.es.js";
/**
 * @license React
 * use-sync-external-store-shim/with-selector.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var S;
function z() {
  if (S)
    return _;
  S = 1;
  var c = O, q = R();
  function x(e, u) {
    return e === u && (e !== 0 || 1 / e === 1 / u) || e !== e && u !== u;
  }
  var V = typeof Object.is == "function" ? Object.is : x, y = q.useSyncExternalStore, E = c.useRef, W = c.useEffect, j = c.useMemo, w = c.useDebugValue;
  return _.useSyncExternalStoreWithSelector = function(e, u, s, v, o) {
    var t = E(null);
    if (t.current === null) {
      var n = { hasValue: !1, value: null };
      t.current = n;
    } else
      n = t.current;
    t = j(function() {
      function m(r) {
        if (!d) {
          if (d = !0, a = r, r = v(r), o !== void 0 && n.hasValue) {
            var i = n.value;
            if (o(i, r))
              return f = i;
          }
          return f = r;
        }
        if (i = f, V(a, r))
          return i;
        var p = v(r);
        return o !== void 0 && o(i, p) ? i : (a = r, f = p);
      }
      var d = !1, a, f, h = s === void 0 ? null : s;
      return [function() {
        return m(u());
      }, h === null ? void 0 : function() {
        return m(h());
      }];
    }, [u, s, v, o]);
    var l = y(e, t[0], t[1]);
    return W(function() {
      n.hasValue = !0, n.value = l;
    }, [l]), w(l), l;
  }, _;
}
export {
  z as __require
};
//# sourceMappingURL=with-selector.production.min.es.js.map
