import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
import "react";
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
import * as __WEBPACK_EXTERNAL_MODULE__defaultFieldNames_mjs__ from "./defaultFieldNames.mjs";
const ReadPretty = (props)=>{
    const { fieldNames = __WEBPACK_EXTERNAL_MODULE__defaultFieldNames_mjs__.defaultFieldNames } = props;
    const values = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.toArr)(props.value);
    const len = values.length;
    const field = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useField)();
    let dataSource = field.dataSource;
    const data = [];
    for (const item of values)if ('object' == typeof item) data.push(item);
    else {
        const curr = null == dataSource ? void 0 : dataSource.find((v)=>v[fieldNames.value] === item);
        dataSource = (null == curr ? void 0 : curr[fieldNames.children]) || [];
        data.push(curr || {
            label: item,
            value: item
        });
    }
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
        children: data.map((item, index)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("span", {
                children: [
                    'object' == typeof item ? item[fieldNames.label] : item,
                    len > index + 1 && ' / '
                ]
            }, index))
    });
};
export { ReadPretty };
