"use strict";
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 __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// packages/components/src/slot-fill/index.tsx
var slot_fill_exports = {};
__export(slot_fill_exports, {
  Fill: () => Fill,
  Provider: () => Provider,
  Slot: () => Slot,
  UnforwardedSlot: () => UnforwardedSlot,
  createSlotFill: () => createSlotFill,
  useSlot: () => import_use_slot.default,
  useSlotFills: () => import_use_slot_fills.default
});
module.exports = __toCommonJS(slot_fill_exports);
var import_element = require("@wordpress/element");
var import_fill = __toESM(require("./fill.cjs"), 1);
var import_slot = __toESM(require("./slot.cjs"), 1);
var import_fill2 = __toESM(require("./bubbles-virtually/fill.cjs"), 1);
var import_slot2 = __toESM(require("./bubbles-virtually/slot.cjs"), 1);
var import_slot_fill_provider = __toESM(require("./bubbles-virtually/slot-fill-provider.cjs"), 1);
var import_provider = __toESM(require("./provider.cjs"), 1);
var import_slot_fill_context = __toESM(require("./bubbles-virtually/slot-fill-context.cjs"), 1);
var import_jsx_runtime = require("react/jsx-runtime");
var import_use_slot = __toESM(require("./bubbles-virtually/use-slot.cjs"), 1);
var import_use_slot_fills = __toESM(require("./bubbles-virtually/use-slot-fills.cjs"), 1);
function Fill(props) {
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
    children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_fill.default, {
      ...props
    }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_fill2.default, {
      ...props
    })]
  });
}
function UnforwardedSlot(props, ref) {
  const {
    bubblesVirtually,
    ...restProps
  } = props;
  if (bubblesVirtually) {
    return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_slot2.default, {
      ...restProps,
      ref
    });
  }
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_slot.default, {
    ...restProps
  });
}
var Slot = (0, import_element.forwardRef)(UnforwardedSlot);
function Provider({
  children,
  passthrough = false
}) {
  const parent = (0, import_element.useContext)(import_slot_fill_context.default);
  if (!parent.isDefault && passthrough) {
    return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
      children
    });
  }
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_provider.default, {
    children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_slot_fill_provider.default, {
      children
    })
  });
}
Provider.displayName = "SlotFillProvider";
function createSlotFill(key) {
  const baseName = typeof key === "symbol" ? key.description : key;
  const FillComponent = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Fill, {
    name: key,
    ...props
  });
  FillComponent.displayName = `${baseName}Fill`;
  const SlotComponent = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Slot, {
    name: key,
    ...props
  });
  SlotComponent.displayName = `${baseName}Slot`;
  SlotComponent.__unstableName = key;
  return {
    name: key,
    Fill: FillComponent,
    Slot: SlotComponent
  };
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  Fill,
  Provider,
  Slot,
  UnforwardedSlot,
  createSlotFill,
  useSlot,
  useSlotFills
});
//# sourceMappingURL=index.cjs.map
