text: var __create = Object.create;
  var __defProp = Object.defineProperty;
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  var __getOwnPropNames = Object.getOwnPropertyNames;
  var __getProtoOf = Object.getPrototypeOf;
  var __hasOwnProp = Object.prototype.hasOwnProperty;
  var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
  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 key2 of __getOwnPropNames(module2))
        if (!__hasOwnProp.call(target, key2) && key2 !== "default")
          __defProp(target, key2, { get: () => module2[key2], enumerable: !(desc = __getOwnPropDesc(module2, key2)) || 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, {
    PortalContext: () => PortalContext,
    defaultContextValue: () => defaultContextValue
  });
  var import_react = __toModule(require("react"));
  var import_globalScope = __toModule(require("../../lib/globalScope"));
  const key = Symbol.for("@sanity/ui/context/portal");
  const elementKey = Symbol.for("@sanity/ui/context/portal/element");
  import_globalScope.globalScope[elementKey] = null;
  const defaultContextValue = {
    version: 0,
    boundaryElement: null,
    get element() {
      if (typeof window === "undefined") {
        return null;
      }
      if (import_globalScope.globalScope[elementKey]) {
        return import_globalScope.globalScope[elementKey];
      }
      import_globalScope.globalScope[elementKey] = document.createElement("div");
      import_globalScope.globalScope[elementKey].setAttribute("data-portal", "");
      document.body.appendChild(import_globalScope.globalScope[elementKey]);
      return import_globalScope.globalScope[elementKey];
    }
  };
  import_globalScope.globalScope[key] = import_globalScope.globalScope[key] || (0, import_react.createContext)(defaultContextValue);
  const PortalContext = import_globalScope.globalScope[key];
  