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