text: var __create = Object.create;
  var __defProp = Object.defineProperty;
  var __defProps = Object.defineProperties;
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
  var __getOwnPropNames = Object.getOwnPropertyNames;
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
  var __getProtoOf = Object.getPrototypeOf;
  var __hasOwnProp = Object.prototype.hasOwnProperty;
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  var __spreadValues = (a, b) => {
    for (var prop in b || (b = {}))
      if (__hasOwnProp.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    if (__getOwnPropSymbols)
      for (var prop of __getOwnPropSymbols(b)) {
        if (__propIsEnum.call(b, prop))
          __defNormalProp(a, prop, b[prop]);
      }
    return a;
  };
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
  var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
  var __objRest = (source, exclude) => {
    var target = {};
    for (var prop in source)
      if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
        target[prop] = source[prop];
    if (source != null && __getOwnPropSymbols)
      for (var prop of __getOwnPropSymbols(source)) {
        if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
          target[prop] = source[prop];
      }
    return target;
  };
  var __export = (target, all) => {
    __markAsModule(target);
    for (var name in all)
      __defProp(target, name, { get: all[name], enumerable: true });
  };
  var __reExport = (target, module2, desc) => {
    if (module2 && typeof module2 === "object" || typeof module2 === "function") {
      for (let key of __getOwnPropNames(module2))
        if (!__hasOwnProp.call(target, key) && key !== "default")
          __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
    }
    return target;
  };
  var __toModule = (module2) => {
    return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
  };
  __export(exports, {
    ElementQuery: () => ElementQuery
  });
  var import_react = __toModule(require("react"));
  var import_hooks = __toModule(require("../../hooks"));
  var import_theme = __toModule(require("../../theme"));
  var import_resizeObserver = __toModule(require("../resizeObserver"));
  var import_helpers = __toModule(require("./helpers"));
  const ElementQuery = (0, import_react.forwardRef)(function ElementQuery2(props, ref) {
    const theme = (0, import_theme.useTheme)();
    const _a = props, { children, media = theme.sanity.media } = _a, restProps = __objRest(_a, ["children", "media"]);
    const [width, setWidth] = (0, import_react.useState)(() => window.innerWidth);
    const forwardedRef = (0, import_hooks.useForwardedRef)(ref);
    const [element, setElement] = (0, import_react.useState)(null);
    (0, import_react.useEffect)(() => {
      if (!element)
        return;
      const handleResizeEntries = (entries) => {
        setWidth(entries[0].contentRect.width);
      };
      const ro = new import_resizeObserver.ResizeObserver(handleResizeEntries);
      ro.observe(element);
      return () => ro.disconnect();
    }, [element]);
    const max = (0, import_react.useMemo)(() => (0, import_helpers.findMaxBreakpoints)(media, width), [media, width]);
    const min = (0, import_react.useMemo)(() => (0, import_helpers.findMinBreakpoints)(media, width), [media, width]);
    const setRef = (0, import_react.useCallback)((el) => {
      forwardedRef.current = el;
      setElement(el);
    }, [forwardedRef]);
    return /* @__PURE__ */ import_react.default.createElement("div", __spreadProps(__spreadValues({
      "data-ui": "ElementQuery"
    }, restProps), {
      "data-eq-max": max.length ? max.join(" ") : void 0,
      "data-eq-min": min.length ? min.join(" ") : void 0,
      ref: setRef
    }), children);
  });
  