import { defineComponent as C, computed as w, unref as f, openBlock as r, createElementBlock as d, toDisplayString as h, createBlock as B, withCtx as x, Fragment as b, renderList as v } from "vue";
import { Space as N } from "@aplus-frontend/antdv";
import { isArray as S } from "lodash-unified";
const T = {
  key: 0
}, M = /* @__PURE__ */ C({
  name: "ApFieldCascaderRead",
  __name: "read",
  props: {
    mode: {
      default: "read"
    },
    class: {},
    style: {},
    emptyText: {
      default: "--"
    },
    customReadMode: {},
    multiple: {
      type: Boolean
    },
    size: {},
    bordered: {
      type: Boolean
    },
    placement: {},
    suffixIcon: {},
    status: {},
    options: {},
    popupClassName: {},
    dropdownClassName: {},
    "onUpdate:value": {},
    variant: {},
    value: {},
    children: {},
    onMouseenter: {},
    onMouseleave: {},
    tabindex: {},
    onClick: {},
    onFocus: {},
    onBlur: {},
    onChange: {},
    onKeydown: {},
    onKeyup: {},
    onMousedown: {},
    open: {
      type: Boolean
    },
    animation: {},
    direction: {},
    disabled: {
      type: Boolean
    },
    prefixCls: {},
    id: {},
    autofocus: {
      type: Boolean
    },
    getPopupContainer: {},
    dropdownMatchSelectWidth: {
      type: [Number, Boolean]
    },
    placeholder: {},
    loading: {
      type: Boolean
    },
    defaultValue: {},
    prefix: {},
    clearIcon: {},
    allowClear: {
      type: Boolean
    },
    getInputElement: {},
    getRawInputElement: {},
    fieldNames: {},
    searchValue: {},
    onSearch: {},
    maxCount: {},
    showSearch: {
      type: [Boolean, Object]
    },
    tagRender: {},
    optionLabelRender: {},
    notFoundContent: {},
    onClear: {},
    choiceTransitionName: {},
    defaultOpen: {
      type: Boolean
    },
    onDropdownVisibleChange: {},
    maxTagTextLength: {},
    maxTagCount: {},
    maxTagPlaceholder: {},
    removeIcon: {},
    transitionName: {},
    dropdownStyle: {},
    dropdownRender: {},
    dropdownAlign: {},
    showAction: {},
    onPopupScroll: {},
    onInputKeyDown: {},
    onPopupVisibleChange: {},
    popupStyle: {},
    popupPlacement: {},
    popupVisible: {
      type: Boolean
    },
    expandIcon: {},
    changeOnSelect: {
      type: Boolean
    },
    displayRender: {},
    showCheckedStrategy: {},
    expandTrigger: {},
    dropdownPrefixCls: {},
    dropdownMenuColumnStyle: {},
    loadingIcon: {},
    request: {},
    lazy: {
      type: Boolean
    },
    params: {},
    loadData: {
      type: Boolean
    }
  },
  setup(i) {
    const t = i, u = w(() => {
      const o = f(t.value);
      if (!o?.length) return [];
      const c = t.fieldNames?.label || "label", p = t.fieldNames?.value || "value";
      function a(s, e) {
        const n = [];
        for (const l of s || []) {
          if (e.find((g) => g === l[p]) && n.push(l[c]), n.length === e.length)
            return n;
          l.children?.length && n.push(...a(l.children, e));
        }
        return n;
      }
      const m = [], y = S(o[0]) ? o : [o];
      for (const s of y) {
        const e = a(t.options, s);
        e.length && m.push(e);
      }
      return m;
    });
    return (o, c) => u.value.length ? (r(), B(f(N), {
      key: 1,
      size: 4
    }, {
      default: x(() => [(r(!0), d(b, null, v(u.value, (p, a) => (r(), d("span", {
        key: a
      }, h(p.join(", ")), 1))), 128))]),
      _: 1
    })) : (r(), d("span", T, h(i.emptyText), 1));
  }
});
export {
  M as default
};
