import { jsx } from "react/jsx-runtime";
import "react";
import { ObjectFieldComponent, observer, useField } from "@tachybase/schema";
import { RemoveConditionContext } from "./context.mjs";
import { FilterGroup } from "./FilterGroup.mjs";
import { FilterItem } from "./FilterItem.mjs";
const FilterItems = observer((props)=>{
    var _field_value;
    const field = useField();
    return /*#__PURE__*/ jsx("div", {
        children: null == field ? void 0 : null == (_field_value = field.value) ? void 0 : _field_value.filter(Boolean).map((item, index)=>/*#__PURE__*/ jsx(RemoveConditionContext.Provider, {
                value: ()=>field.remove(index),
                children: /*#__PURE__*/ jsx(ObjectFieldComponent, {
                    name: index,
                    component: [
                        item.$and || item.$or ? FilterGroup : FilterItem
                    ]
                })
            }, index))
    });
}, {
    displayName: 'FilterItems'
});
export { FilterItems };
