'use strict';

var tslib_es6 = require('./tslib.es6-cjs.js');
var React = require('react');
var classnames = require('classnames');
var buttonRenderAdapter = require('./buttonRenderAdapter-cjs.js');
var ComboboxChipRemove$1 = require('./ComboboxChipRemove-cjs.js');
var Separator = require('./Separator-cjs.js');

var styles = {"label":"qWsLxPjCBI8-","inputGroup":"EySvIEsW9Q4-","trigger":"F94vaco3HkM-","clear":"IYgNfHHPVFY-","input":"L-KgsoDZ360-","icon":"KBJi5F0wWc0-","positioner":"qfx6EynKdsk-","popup":"LOetsPPEwOk-","list":"TCtrYZwnZYo-","empty":"M166bxiQs88-","item":"Cm53I7O4mMw-","row":"jvrxEbmYGpM-","itemIndicator":"GwotZ3R-quw-","group":"u5M1OKpKSWw-","separator":"mpkTjdLrAUI-","groupLabel":"_6UKKWI-irfo-","backdrop":"UnM-udfURI4-","arrow":"RZ4T5-BjTDY-","chips":"pkc7PhhfCuk-","chip":"fdKYm3GTKwk-","chipRemove":"vzuaMzxA96M-","spinning":"bk68oghmmqo-"};

// Matches var(--space-smaller). Base UI expects this offset as a pixel number.
const POSITIONER_SIDE_OFFSET = 4;
function mergeClassName(baseClassName, className) {
    if (typeof className === "function") {
        return state => classnames(baseClassName, className(state));
    }
    return classnames(baseClassName, className);
}
function ComboboxRoot(props) {
    return React.createElement(ComboboxChipRemove$1.ComboboxRoot, Object.assign({}, props));
}
function ComboboxLabel(_a) {
    var { className } = _a, labelProps = tslib_es6.__rest(_a, ["className"]);
    return (React.createElement(ComboboxChipRemove$1.ComboboxLabel, Object.assign({}, labelProps, { className: mergeClassName(styles.label, className) })));
}
function ComboboxValue(props) {
    return React.createElement(ComboboxChipRemove$1.ComboboxValue, Object.assign({}, props));
}
function ComboboxInput(_a) {
    var { className } = _a, inputProps = tslib_es6.__rest(_a, ["className"]);
    return (React.createElement(ComboboxChipRemove$1.ComboboxInput, Object.assign({}, inputProps, { className: mergeClassName(styles.input, className) })));
}
function ComboboxInputGroup(_a) {
    var { className } = _a, inputGroupProps = tslib_es6.__rest(_a, ["className"]);
    return (React.createElement(ComboboxChipRemove$1.ComboboxInputGroup, Object.assign({}, inputGroupProps, { className: mergeClassName(styles.inputGroup, className) })));
}
function ComboboxTrigger(_a) {
    var { className, render } = _a, triggerProps = tslib_es6.__rest(_a, ["className", "render"]);
    return (React.createElement(ComboboxChipRemove$1.ComboboxTrigger, Object.assign({}, triggerProps, { render: resolveComboboxTriggerRender(render), className: render ? className : mergeClassName(styles.trigger, className) })));
}
function resolveComboboxTriggerRender(render) {
    if (!render) {
        return render;
    }
    if (typeof render === "function") {
        return (props, state) => {
            const renderedElement = render(buttonRenderAdapter.normalizeBaseUiButtonProps(props), state);
            return buttonRenderAdapter.isAtlantisButtonRenderTarget(renderedElement)
                ? buttonRenderAdapter.stripNativeTypeFromButtonRenderTarget(renderedElement)
                : renderedElement;
        };
    }
    return buttonRenderAdapter.isAtlantisButtonRenderTarget(render)
        ? buttonRenderAdapter.renderAtlantisButtonTarget(render)
        : render;
}
function ComboboxList(_a) {
    var { className } = _a, listProps = tslib_es6.__rest(_a, ["className"]);
    return (React.createElement(ComboboxChipRemove$1.ComboboxList, Object.assign({}, listProps, { className: mergeClassName(styles.list, className) })));
}
function ComboboxStatus(props) {
    return React.createElement(ComboboxChipRemove$1.ComboboxStatus, Object.assign({}, props));
}
function ComboboxPortal(props) {
    return React.createElement(ComboboxChipRemove$1.ComboboxPortal, Object.assign({}, props));
}
function ComboboxBackdrop(_a) {
    var { className } = _a, backdropProps = tslib_es6.__rest(_a, ["className"]);
    return (React.createElement(ComboboxChipRemove$1.ComboboxBackdrop, Object.assign({}, backdropProps, { className: mergeClassName(styles.backdrop, className) })));
}
function ComboboxPositioner(_a) {
    var { className, sideOffset = POSITIONER_SIDE_OFFSET } = _a, positionerProps = tslib_es6.__rest(_a, ["className", "sideOffset"]);
    return (React.createElement(ComboboxChipRemove$1.ComboboxPositioner, Object.assign({}, positionerProps, { sideOffset: sideOffset, className: mergeClassName(styles.positioner, className) })));
}
function ComboboxPopup(_a) {
    var { className } = _a, popupProps = tslib_es6.__rest(_a, ["className"]);
    return (React.createElement(ComboboxChipRemove$1.ComboboxPopup, Object.assign({}, popupProps, { className: mergeClassName(styles.popup, className) })));
}
function ComboboxArrow(_a) {
    var { className } = _a, arrowProps = tslib_es6.__rest(_a, ["className"]);
    return (React.createElement(ComboboxChipRemove$1.ComboboxArrow, Object.assign({}, arrowProps, { className: mergeClassName(styles.arrow, className) })));
}
function ComboboxIcon(_a) {
    var { className } = _a, iconProps = tslib_es6.__rest(_a, ["className"]);
    return (React.createElement(ComboboxChipRemove$1.ComboboxIcon, Object.assign({}, iconProps, { className: mergeClassName(styles.icon, className) })));
}
function ComboboxGroup(_a) {
    var { className } = _a, groupProps = tslib_es6.__rest(_a, ["className"]);
    return (React.createElement(ComboboxChipRemove$1.ComboboxGroup, Object.assign({}, groupProps, { className: mergeClassName(styles.group, className) })));
}
function ComboboxGroupLabel(_a) {
    var { className } = _a, groupLabelProps = tslib_es6.__rest(_a, ["className"]);
    return (React.createElement(ComboboxChipRemove$1.ComboboxGroupLabel, Object.assign({}, groupLabelProps, { className: mergeClassName(styles.groupLabel, className) })));
}
function ComboboxItem(_a) {
    var { className } = _a, itemProps = tslib_es6.__rest(_a, ["className"]);
    return (React.createElement(ComboboxChipRemove$1.ComboboxItem, Object.assign({}, itemProps, { className: mergeClassName(styles.item, className) })));
}
function ComboboxItemIndicator(_a) {
    var { className } = _a, itemIndicatorProps = tslib_es6.__rest(_a, ["className"]);
    return (React.createElement(ComboboxChipRemove$1.ComboboxItemIndicator, Object.assign({}, itemIndicatorProps, { className: mergeClassName(styles.itemIndicator, className) })));
}
function ComboboxChips(_a) {
    var { className } = _a, chipsProps = tslib_es6.__rest(_a, ["className"]);
    return (React.createElement(ComboboxChipRemove$1.ComboboxChips, Object.assign({}, chipsProps, { className: mergeClassName(styles.chips, className) })));
}
function ComboboxChip(_a) {
    var { className } = _a, chipProps = tslib_es6.__rest(_a, ["className"]);
    return (React.createElement(ComboboxChipRemove$1.ComboboxChip, Object.assign({}, chipProps, { className: mergeClassName(styles.chip, className) })));
}
function ComboboxChipRemove(_a) {
    var { className } = _a, chipRemoveProps = tslib_es6.__rest(_a, ["className"]);
    return (React.createElement(ComboboxChipRemove$1.ComboboxChipRemove, Object.assign({}, chipRemoveProps, { className: mergeClassName(styles.chipRemove, className) })));
}
function ComboboxRow(_a) {
    var { className } = _a, rowProps = tslib_es6.__rest(_a, ["className"]);
    return (React.createElement(ComboboxChipRemove$1.ComboboxRow, Object.assign({}, rowProps, { className: mergeClassName(styles.row, className) })));
}
function ComboboxCollection(props) {
    return React.createElement(ComboboxChipRemove$1.ComboboxCollection, Object.assign({}, props));
}
function ComboboxEmpty(_a) {
    var { className } = _a, emptyProps = tslib_es6.__rest(_a, ["className"]);
    return (React.createElement(ComboboxChipRemove$1.ComboboxEmpty, Object.assign({}, emptyProps, { className: mergeClassName(styles.empty, className) })));
}
function ComboboxClear(_a) {
    var { className } = _a, clearProps = tslib_es6.__rest(_a, ["className"]);
    return (React.createElement(ComboboxChipRemove$1.ComboboxClear, Object.assign({}, clearProps, { className: mergeClassName(styles.clear, className) })));
}
function ComboboxSeparator(_a) {
    var { className } = _a, separatorProps = tslib_es6.__rest(_a, ["className"]);
    return (React.createElement(Separator.Separator, Object.assign({}, separatorProps, { className: mergeClassName(styles.separator, className) })));
}
const useFilter = ComboboxChipRemove$1.useComboboxFilter;
const useFilteredItems = ComboboxChipRemove$1.useFilteredItems;

var ComboboxPrimitive = /*#__PURE__*/Object.freeze({
  __proto__: null,
  Arrow: ComboboxArrow,
  Backdrop: ComboboxBackdrop,
  Chip: ComboboxChip,
  ChipRemove: ComboboxChipRemove,
  Chips: ComboboxChips,
  Clear: ComboboxClear,
  Collection: ComboboxCollection,
  Empty: ComboboxEmpty,
  Group: ComboboxGroup,
  GroupLabel: ComboboxGroupLabel,
  Icon: ComboboxIcon,
  Input: ComboboxInput,
  InputGroup: ComboboxInputGroup,
  Item: ComboboxItem,
  ItemIndicator: ComboboxItemIndicator,
  Label: ComboboxLabel,
  List: ComboboxList,
  Popup: ComboboxPopup,
  Portal: ComboboxPortal,
  Positioner: ComboboxPositioner,
  Root: ComboboxRoot,
  Row: ComboboxRow,
  Separator: ComboboxSeparator,
  Status: ComboboxStatus,
  Trigger: ComboboxTrigger,
  Value: ComboboxValue,
  useFilter: useFilter,
  useFilteredItems: useFilteredItems
});

exports.ComboboxPrimitive = ComboboxPrimitive;
