import { _ as w, b5 as en, m as ue, a8 as tn, b6 as be, b7 as Ce, P as Ee, a as re, w as Ue, b8 as he, Y as nn, o as on, b as ln, K as Oe, n as an, aQ as sn, b9 as rn, ba as cn, bb as dn, i as un, g as fn, a5 as vn, I as hn, J as gn, bc as dt, M as yn } from "./index2.js";
import { createVNode as C, cloneVNode as Et, defineComponent as Ne, reactive as _e, ref as We, watch as ie, onUnmounted as Dt, onMounted as qe, onBeforeUnmount as rt, computed as E, shallowRef as L, toRaw as it, nextTick as Ae, onUpdated as Tt, watchEffect as Pe, provide as $t, inject as Nt, getCurrentInstance as pn, Transition as mn, withDirectives as bn, vShow as Sn, Fragment as xn } from "vue";
import { e as ut, h as Ge, i as Xe, j as Mt, b as Kn, f as kn, c as wn, d as ft, k as Cn, l as vt, u as En, p as lt, a as at, m as me, n as Dn, o as ht, q as we, r as Tn, g as $n } from "./index4.js";
import { p as Ot } from "./pickAttrs.js";
const Je = (e, t) => {
  let {
    height: n,
    offset: o,
    prefixCls: l,
    onInnerResize: c
  } = e, {
    slots: i
  } = t;
  var v;
  let S = {}, f = {
    display: "flex",
    flexDirection: "column"
  };
  return o !== void 0 && (S = {
    height: `${n}px`,
    position: "relative",
    overflow: "hidden"
  }, f = w(w({}, f), {
    transform: `translateY(${o}px)`,
    position: "absolute",
    left: 0,
    right: 0,
    top: 0
  })), C("div", {
    style: S
  }, [C(en, {
    onResize: (K) => {
      let {
        offsetHeight: x
      } = K;
      x && c && c();
    }
  }, {
    default: () => [C("div", {
      style: f,
      class: ue({
        [`${l}-holder-inner`]: l
      })
    }, [(v = i.default) === null || v === void 0 ? void 0 : v.call(i)])]
  })]);
};
Je.displayName = "Filter";
Je.inheritAttrs = !1;
Je.props = {
  prefixCls: String,
  /** Virtual filler height. Should be `count * itemMinHeight` */
  height: Number,
  /** Set offset of visible items. Should be the top of start item position */
  offset: Number,
  onInnerResize: Function
};
const Pt = (e, t) => {
  let {
    setRef: n
  } = e, {
    slots: o
  } = t;
  var l;
  const c = tn((l = o.default) === null || l === void 0 ? void 0 : l.call(o));
  return c && c.length ? Et(c[0], {
    ref: n
  }) : c;
};
Pt.props = {
  setRef: {
    type: Function,
    default: () => {
    }
  }
};
const Nn = 20;
function gt(e) {
  return "touches" in e ? e.touches[0].pageY : e.pageY;
}
const Mn = Ne({
  compatConfig: {
    MODE: 3
  },
  name: "ScrollBar",
  inheritAttrs: !1,
  props: {
    prefixCls: String,
    scrollTop: Number,
    scrollHeight: Number,
    height: Number,
    count: Number,
    onScroll: {
      type: Function
    },
    onStartMove: {
      type: Function
    },
    onStopMove: {
      type: Function
    }
  },
  setup() {
    return {
      moveRaf: null,
      scrollbarRef: ut(),
      thumbRef: ut(),
      visibleTimeout: null,
      state: _e({
        dragging: !1,
        pageY: null,
        startTop: null,
        visible: !1
      })
    };
  },
  watch: {
    scrollTop: {
      handler() {
        this.delayHidden();
      },
      flush: "post"
    }
  },
  mounted() {
    var e, t;
    (e = this.scrollbarRef.current) === null || e === void 0 || e.addEventListener("touchstart", this.onScrollbarTouchStart, Ce ? {
      passive: !1
    } : !1), (t = this.thumbRef.current) === null || t === void 0 || t.addEventListener("touchstart", this.onMouseDown, Ce ? {
      passive: !1
    } : !1);
  },
  beforeUnmount() {
    this.removeEvents(), clearTimeout(this.visibleTimeout);
  },
  methods: {
    delayHidden() {
      clearTimeout(this.visibleTimeout), this.state.visible = !0, this.visibleTimeout = setTimeout(() => {
        this.state.visible = !1;
      }, 2e3);
    },
    onScrollbarTouchStart(e) {
      e.preventDefault();
    },
    onContainerMouseDown(e) {
      e.stopPropagation(), e.preventDefault();
    },
    // ======================= Clean =======================
    patchEvents() {
      window.addEventListener("mousemove", this.onMouseMove), window.addEventListener("mouseup", this.onMouseUp), this.thumbRef.current.addEventListener("touchmove", this.onMouseMove, Ce ? {
        passive: !1
      } : !1), this.thumbRef.current.addEventListener("touchend", this.onMouseUp);
    },
    removeEvents() {
      window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("mouseup", this.onMouseUp), this.scrollbarRef.current.removeEventListener("touchstart", this.onScrollbarTouchStart, Ce ? {
        passive: !1
      } : !1), this.thumbRef.current && (this.thumbRef.current.removeEventListener("touchstart", this.onMouseDown, Ce ? {
        passive: !1
      } : !1), this.thumbRef.current.removeEventListener("touchmove", this.onMouseMove, Ce ? {
        passive: !1
      } : !1), this.thumbRef.current.removeEventListener("touchend", this.onMouseUp)), be.cancel(this.moveRaf);
    },
    // ======================= Thumb =======================
    onMouseDown(e) {
      const {
        onStartMove: t
      } = this.$props;
      w(this.state, {
        dragging: !0,
        pageY: gt(e),
        startTop: this.getTop()
      }), t(), this.patchEvents(), e.stopPropagation(), e.preventDefault();
    },
    onMouseMove(e) {
      const {
        dragging: t,
        pageY: n,
        startTop: o
      } = this.state, {
        onScroll: l
      } = this.$props;
      if (be.cancel(this.moveRaf), t) {
        const c = gt(e) - n, i = o + c, v = this.getEnableScrollRange(), S = this.getEnableHeightRange(), f = S ? i / S : 0, K = Math.ceil(f * v);
        this.moveRaf = be(() => {
          l(K);
        });
      }
    },
    onMouseUp() {
      const {
        onStopMove: e
      } = this.$props;
      this.state.dragging = !1, e(), this.removeEvents();
    },
    // ===================== Calculate =====================
    getSpinHeight() {
      const {
        height: e,
        scrollHeight: t
      } = this.$props;
      let n = e / t * 100;
      return n = Math.max(n, Nn), n = Math.min(n, e / 2), Math.floor(n);
    },
    getEnableScrollRange() {
      const {
        scrollHeight: e,
        height: t
      } = this.$props;
      return e - t || 0;
    },
    getEnableHeightRange() {
      const {
        height: e
      } = this.$props, t = this.getSpinHeight();
      return e - t || 0;
    },
    getTop() {
      const {
        scrollTop: e
      } = this.$props, t = this.getEnableScrollRange(), n = this.getEnableHeightRange();
      return e === 0 || t === 0 ? 0 : e / t * n;
    },
    // Not show scrollbar when height is large than scrollHeight
    showScroll() {
      const {
        height: e,
        scrollHeight: t
      } = this.$props;
      return t > e;
    }
  },
  render() {
    const {
      dragging: e,
      visible: t
    } = this.state, {
      prefixCls: n
    } = this.$props, o = this.getSpinHeight() + "px", l = this.getTop() + "px", c = this.showScroll(), i = c && t;
    return C("div", {
      ref: this.scrollbarRef,
      class: ue(`${n}-scrollbar`, {
        [`${n}-scrollbar-show`]: c
      }),
      style: {
        width: "8px",
        top: 0,
        bottom: 0,
        right: 0,
        position: "absolute",
        display: i ? void 0 : "none"
      },
      onMousedown: this.onContainerMouseDown,
      onMousemove: this.delayHidden
    }, [C("div", {
      ref: this.thumbRef,
      class: ue(`${n}-scrollbar-thumb`, {
        [`${n}-scrollbar-thumb-moving`]: e
      }),
      style: {
        width: "100%",
        height: o,
        top: l,
        left: 0,
        position: "absolute",
        background: "rgba(0, 0, 0, 0.5)",
        borderRadius: "99px",
        cursor: "pointer",
        userSelect: "none"
      },
      onMousedown: this.onMouseDown
    }, null)]);
  }
});
function On(e, t, n, o) {
  const l = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), i = We(Symbol("update"));
  ie(e, () => {
    i.value = Symbol("update");
  });
  let v;
  function S() {
    be.cancel(v);
  }
  function f() {
    S(), v = be(() => {
      l.forEach((x, m) => {
        if (x && x.offsetParent) {
          const {
            offsetHeight: D
          } = x;
          c.get(m) !== D && (i.value = Symbol("update"), c.set(m, x.offsetHeight));
        }
      });
    });
  }
  function K(x, m) {
    const D = t(x);
    l.get(D), m ? (l.set(D, m.$el || m), f()) : l.delete(D);
  }
  return Dt(() => {
    S();
  }), [K, f, c, i];
}
function Pn(e, t, n, o, l, c, i, v) {
  let S;
  return (f) => {
    if (f == null) {
      v();
      return;
    }
    be.cancel(S);
    const K = t.value, x = o.itemHeight;
    if (typeof f == "number")
      i(f);
    else if (f && typeof f == "object") {
      let m;
      const {
        align: D
      } = f;
      "index" in f ? {
        index: m
      } = f : m = K.findIndex((N) => l(N) === f.key);
      const {
        offset: j = 0
      } = f, y = (N, O) => {
        if (N < 0 || !e.value) return;
        const V = e.value.clientHeight;
        let T = !1, Y = O;
        if (V) {
          const B = O || D;
          let Q = 0, q = 0, A = 0;
          const G = Math.min(K.length, m);
          for (let U = 0; U <= G; U += 1) {
            const ee = l(K[U]);
            q = Q;
            const le = n.get(ee);
            A = q + (le === void 0 ? x : le), Q = A, U === m && le === void 0 && (T = !0);
          }
          const Z = e.value.scrollTop;
          let z = null;
          switch (B) {
            case "top":
              z = q - j;
              break;
            case "bottom":
              z = A - V + j;
              break;
            default: {
              const U = Z + V;
              q < Z ? Y = "top" : A > U && (Y = "bottom");
            }
          }
          z !== null && z !== Z && i(z);
        }
        S = be(() => {
          T && c(), y(N - 1, Y);
        }, 2);
      };
      y(5);
    }
  };
}
const In = typeof navigator == "object" && /Firefox/i.test(navigator.userAgent), It = (e, t) => {
  let n = !1, o = null;
  function l() {
    clearTimeout(o), n = !0, o = setTimeout(() => {
      n = !1;
    }, 50);
  }
  return function(c) {
    let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
    const v = (
      // Pass origin wheel when on the top
      c < 0 && e.value || // Pass origin wheel when on the bottom
      c > 0 && t.value
    );
    return i && v ? (clearTimeout(o), n = !1) : (!v || n) && l(), !n && v;
  };
};
function Ln(e, t, n, o) {
  let l = 0, c = null, i = null, v = !1;
  const S = It(t, n);
  function f(x) {
    if (!e.value) return;
    be.cancel(c);
    const {
      deltaY: m
    } = x;
    l += m, i = m, !S(m) && (In || x.preventDefault(), c = be(() => {
      o(l * (v ? 10 : 1)), l = 0;
    }));
  }
  function K(x) {
    e.value && (v = x.detail === i);
  }
  return [f, K];
}
const Hn = 14 / 15;
function Rn(e, t, n) {
  let o = !1, l = 0, c = null, i = null;
  const v = () => {
    c && (c.removeEventListener("touchmove", S), c.removeEventListener("touchend", f));
  }, S = (m) => {
    if (o) {
      const D = Math.ceil(m.touches[0].pageY);
      let j = l - D;
      l = D, n(j) && m.preventDefault(), clearInterval(i), i = setInterval(() => {
        j *= Hn, (!n(j, !0) || Math.abs(j) <= 0.1) && clearInterval(i);
      }, 16);
    }
  }, f = () => {
    o = !1, v();
  }, K = (m) => {
    v(), m.touches.length === 1 && !o && (o = !0, l = Math.ceil(m.touches[0].pageY), c = m.target, c.addEventListener("touchmove", S, {
      passive: !1
    }), c.addEventListener("touchend", f));
  }, x = () => {
  };
  qe(() => {
    document.addEventListener("touchmove", x, {
      passive: !1
    }), ie(e, (m) => {
      t.value.removeEventListener("touchstart", K), v(), clearInterval(i), m && t.value.addEventListener("touchstart", K, {
        passive: !1
      });
    }, {
      immediate: !0
    });
  }), rt(() => {
    document.removeEventListener("touchmove", x);
  });
}
var Fn = function(e, t) {
  var n = {};
  for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var l = 0, o = Object.getOwnPropertySymbols(e); l < o.length; l++)
    t.indexOf(o[l]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[l]) && (n[o[l]] = e[o[l]]);
  return n;
};
const An = [], _n = {
  overflowY: "auto",
  overflowAnchor: "none"
};
function Bn(e, t, n, o, l, c) {
  let {
    getKey: i
  } = c;
  return e.slice(t, n + 1).map((v, S) => {
    const f = t + S, K = l(v, f, {
      // style: status === 'MEASURE_START' ? { visibility: 'hidden' } : {},
    }), x = i(v);
    return C(Pt, {
      key: x,
      setRef: (m) => o(v, m)
    }, {
      default: () => [K]
    });
  });
}
const jn = Ne({
  compatConfig: {
    MODE: 3
  },
  name: "List",
  inheritAttrs: !1,
  props: {
    prefixCls: String,
    data: Ee.array,
    height: Number,
    itemHeight: Number,
    /** If not match virtual scroll condition, Set List still use height of container. */
    fullHeight: {
      type: Boolean,
      default: void 0
    },
    itemKey: {
      type: [String, Number, Function],
      required: !0
    },
    component: {
      type: [String, Object]
    },
    /** Set `false` will always use real scroll instead of virtual one */
    virtual: {
      type: Boolean,
      default: void 0
    },
    children: Function,
    onScroll: Function,
    onMousedown: Function,
    onMouseenter: Function,
    onVisibleChange: Function
  },
  setup(e, t) {
    let {
      expose: n
    } = t;
    const o = E(() => {
      const {
        height: h,
        itemHeight: b,
        virtual: H
      } = e;
      return !!(H !== !1 && h && b);
    }), l = E(() => {
      const {
        height: h,
        itemHeight: b,
        data: H
      } = e;
      return o.value && H && b * H.length > h;
    }), c = _e({
      scrollTop: 0,
      scrollMoving: !1
    }), i = E(() => e.data || An), v = L([]);
    ie(i, () => {
      v.value = it(i.value).slice();
    }, {
      immediate: !0
    });
    const S = L((h) => {
    });
    ie(() => e.itemKey, (h) => {
      typeof h == "function" ? S.value = h : S.value = (b) => b == null ? void 0 : b[h];
    }, {
      immediate: !0
    });
    const f = L(), K = L(), x = L(), m = (h) => S.value(h), D = {
      getKey: m
    };
    function j(h) {
      let b;
      typeof h == "function" ? b = h(c.scrollTop) : b = h;
      const H = Q(b);
      f.value && (f.value.scrollTop = H), c.scrollTop = H;
    }
    const [y, N, O, V] = On(v, m), T = _e({
      scrollHeight: void 0,
      start: 0,
      end: 0,
      offset: void 0
    }), Y = L(0);
    qe(() => {
      Ae(() => {
        var h;
        Y.value = ((h = K.value) === null || h === void 0 ? void 0 : h.offsetHeight) || 0;
      });
    }), Tt(() => {
      Ae(() => {
        var h;
        Y.value = ((h = K.value) === null || h === void 0 ? void 0 : h.offsetHeight) || 0;
      });
    }), ie([o, v], () => {
      o.value || w(T, {
        scrollHeight: void 0,
        start: 0,
        end: v.value.length - 1,
        offset: void 0
      });
    }, {
      immediate: !0
    }), ie([o, v, Y, l], () => {
      o.value && !l.value && w(T, {
        scrollHeight: Y.value,
        start: 0,
        end: v.value.length - 1,
        offset: void 0
      }), f.value && (c.scrollTop = f.value.scrollTop);
    }, {
      immediate: !0
    }), ie([l, o, () => c.scrollTop, v, V, () => e.height, Y], () => {
      if (!o.value || !l.value)
        return;
      let h = 0, b, H, X;
      const de = v.value.length, ge = v.value, ye = c.scrollTop, {
        itemHeight: xe,
        height: Me
      } = e, Ie = ye + Me;
      for (let pe = 0; pe < de; pe += 1) {
        const Le = ge[pe], He = m(Le);
        let Ke = O.get(He);
        Ke === void 0 && (Ke = xe);
        const De = h + Ke;
        b === void 0 && De >= ye && (b = pe, H = h), X === void 0 && De > Ie && (X = pe), h = De;
      }
      b === void 0 && (b = 0, H = 0, X = Math.ceil(Me / xe)), X === void 0 && (X = de - 1), X = Math.min(X + 1, de), w(T, {
        scrollHeight: h,
        start: b,
        end: X,
        offset: H
      });
    }, {
      immediate: !0
    });
    const B = E(() => T.scrollHeight - e.height);
    function Q(h) {
      let b = h;
      return Number.isNaN(B.value) || (b = Math.min(b, B.value)), b = Math.max(b, 0), b;
    }
    const q = E(() => c.scrollTop <= 0), A = E(() => c.scrollTop >= B.value), G = It(q, A);
    function Z(h) {
      j(h);
    }
    function z(h) {
      var b;
      const {
        scrollTop: H
      } = h.currentTarget;
      H !== c.scrollTop && j(H), (b = e.onScroll) === null || b === void 0 || b.call(e, h);
    }
    const [U, ee] = Ln(o, q, A, (h) => {
      j((b) => b + h);
    });
    Rn(o, f, (h, b) => G(h, b) ? !1 : (U({
      preventDefault() {
      },
      deltaY: h
    }), !0));
    function le(h) {
      o.value && h.preventDefault();
    }
    const se = () => {
      f.value && (f.value.removeEventListener("wheel", U, Ce ? {
        passive: !1
      } : !1), f.value.removeEventListener("DOMMouseScroll", ee), f.value.removeEventListener("MozMousePixelScroll", le));
    };
    Pe(() => {
      Ae(() => {
        f.value && (se(), f.value.addEventListener("wheel", U, Ce ? {
          passive: !1
        } : !1), f.value.addEventListener("DOMMouseScroll", ee), f.value.addEventListener("MozMousePixelScroll", le));
      });
    }), rt(() => {
      se();
    });
    const Se = Pn(f, v, O, e, m, N, j, () => {
      var h;
      (h = x.value) === null || h === void 0 || h.delayHidden();
    });
    n({
      scrollTo: Se
    });
    const ce = E(() => {
      let h = null;
      return e.height && (h = w({
        [e.fullHeight ? "height" : "maxHeight"]: e.height + "px"
      }, _n), o.value && (h.overflowY = "hidden", c.scrollMoving && (h.pointerEvents = "none"))), h;
    });
    return ie([() => T.start, () => T.end, v], () => {
      if (e.onVisibleChange) {
        const h = v.value.slice(T.start, T.end + 1);
        e.onVisibleChange(h, v.value);
      }
    }, {
      flush: "post"
    }), {
      state: c,
      mergedData: v,
      componentStyle: ce,
      onFallbackScroll: z,
      onScrollBar: Z,
      componentRef: f,
      useVirtual: o,
      calRes: T,
      collectHeight: N,
      setInstance: y,
      sharedConfig: D,
      scrollBarRef: x,
      fillerInnerRef: K,
      delayHideScrollBar: () => {
        var h;
        (h = x.value) === null || h === void 0 || h.delayHidden();
      }
    };
  },
  render() {
    const e = w(w({}, this.$props), this.$attrs), {
      prefixCls: t = "rc-virtual-list",
      height: n,
      itemHeight: o,
      // eslint-disable-next-line no-unused-vars
      fullHeight: l,
      data: c,
      itemKey: i,
      virtual: v,
      component: S = "div",
      onScroll: f,
      children: K = this.$slots.default,
      style: x,
      class: m
    } = e, D = Fn(e, ["prefixCls", "height", "itemHeight", "fullHeight", "data", "itemKey", "virtual", "component", "onScroll", "children", "style", "class"]), j = ue(t, m), {
      scrollTop: y
    } = this.state, {
      scrollHeight: N,
      offset: O,
      start: V,
      end: T
    } = this.calRes, {
      componentStyle: Y,
      onFallbackScroll: B,
      onScrollBar: Q,
      useVirtual: q,
      collectHeight: A,
      sharedConfig: G,
      setInstance: Z,
      mergedData: z,
      delayHideScrollBar: U
    } = this;
    return C("div", re({
      style: w(w({}, x), {
        position: "relative"
      }),
      class: j
    }, D), [C(S, {
      class: `${t}-holder`,
      style: Y,
      ref: "componentRef",
      onScroll: B,
      onMouseenter: U
    }, {
      default: () => [C(Je, {
        prefixCls: t,
        height: N,
        offset: O,
        onInnerResize: A,
        ref: "fillerInnerRef"
      }, {
        default: () => Bn(z, V, T, Z, K, G)
      })]
    }), q && C(Mn, {
      ref: "scrollBarRef",
      prefixCls: t,
      scrollTop: y,
      height: n,
      scrollHeight: N,
      count: z.length,
      onScroll: Q,
      onStartMove: () => {
        this.state.scrollMoving = !0;
      },
      onStopMove: () => {
        this.state.scrollMoving = !1;
      }
    }, null)]);
  }
}), Lt = Symbol("TreeContextKey"), Yn = Ne({
  compatConfig: {
    MODE: 3
  },
  name: "TreeContext",
  props: {
    value: {
      type: Object
    }
  },
  setup(e, t) {
    let {
      slots: n
    } = t;
    return $t(Lt, E(() => e.value)), () => {
      var o;
      return (o = n.default) === null || o === void 0 ? void 0 : o.call(n);
    };
  }
}), ct = () => Nt(Lt, E(() => ({}))), Ht = Symbol("KeysStateKey"), zn = (e) => {
  $t(Ht, e);
}, Rt = () => Nt(Ht, {
  expandedKeys: L([]),
  selectedKeys: L([]),
  loadedKeys: L([]),
  loadingKeys: L([]),
  checkedKeys: L([]),
  halfCheckedKeys: L([]),
  expandedKeysSet: E(() => /* @__PURE__ */ new Set()),
  selectedKeysSet: E(() => /* @__PURE__ */ new Set()),
  loadedKeysSet: E(() => /* @__PURE__ */ new Set()),
  loadingKeysSet: E(() => /* @__PURE__ */ new Set()),
  checkedKeysSet: E(() => /* @__PURE__ */ new Set()),
  halfCheckedKeysSet: E(() => /* @__PURE__ */ new Set()),
  flattenNodes: L([])
}), Vn = (e) => {
  let {
    prefixCls: t,
    level: n,
    isStart: o,
    isEnd: l
  } = e;
  const c = `${t}-indent-unit`, i = [];
  for (let v = 0; v < n; v += 1)
    i.push(C("span", {
      key: v,
      class: {
        [c]: !0,
        [`${c}-start`]: o[v],
        [`${c}-end`]: l[v]
      }
    }, null));
  return C("span", {
    "aria-hidden": "true",
    class: `${t}-indent`
  }, [i]);
}, Ft = {
  eventKey: [String, Number],
  prefixCls: String,
  // By parent
  // expanded: { type: Boolean, default: undefined },
  // selected: { type: Boolean, default: undefined },
  // checked: { type: Boolean, default: undefined },
  // loaded: { type: Boolean, default: undefined },
  // loading: { type: Boolean, default: undefined },
  // halfChecked: { type: Boolean, default: undefined },
  // dragOver: { type: Boolean, default: undefined },
  // dragOverGapTop: { type: Boolean, default: undefined },
  // dragOverGapBottom: { type: Boolean, default: undefined },
  // pos: String,
  title: Ee.any,
  /** New added in Tree for easy data access */
  data: {
    type: Object,
    default: void 0
  },
  parent: {
    type: Object,
    default: void 0
  },
  isStart: {
    type: Array
  },
  isEnd: {
    type: Array
  },
  active: {
    type: Boolean,
    default: void 0
  },
  onMousemove: {
    type: Function
  },
  // By user
  isLeaf: {
    type: Boolean,
    default: void 0
  },
  checkable: {
    type: Boolean,
    default: void 0
  },
  selectable: {
    type: Boolean,
    default: void 0
  },
  disabled: {
    type: Boolean,
    default: void 0
  },
  disableCheckbox: {
    type: Boolean,
    default: void 0
  },
  icon: Ee.any,
  switcherIcon: Ee.any,
  domRef: {
    type: Function
  }
}, Un = {
  prefixCls: {
    type: String
  },
  // data: { type: Array as PropType<FlattenNode[]> },
  motion: {
    type: Object
  },
  focusable: {
    type: Boolean
  },
  activeItem: {
    type: Object
  },
  focused: {
    type: Boolean
  },
  tabindex: {
    type: Number
  },
  checkable: {
    type: Boolean
  },
  selectable: {
    type: Boolean
  },
  disabled: {
    type: Boolean
  },
  // expandedKeys: { type: Array as PropType<Key[]> },
  // selectedKeys: { type: Array as PropType<Key[]> },
  // checkedKeys: { type: Array as PropType<Key[]> },
  // loadedKeys: { type: Array as PropType<Key[]> },
  // loadingKeys: { type: Array as PropType<Key[]> },
  // halfCheckedKeys: { type: Array as PropType<Key[]> },
  // keyEntities: { type: Object as PropType<Record<Key, DataEntity<DataNode>>> },
  // dragging: { type: Boolean as PropType<boolean> },
  // dragOverNodeKey: { type: [String, Number] as PropType<Key> },
  // dropPosition: { type: Number as PropType<number> },
  // Virtual list
  height: {
    type: Number
  },
  itemHeight: {
    type: Number
  },
  virtual: {
    type: Boolean
  },
  onScroll: {
    type: Function
  },
  onKeydown: {
    type: Function
  },
  onFocus: {
    type: Function
  },
  onBlur: {
    type: Function
  },
  onActiveChange: {
    type: Function
  },
  onContextmenu: {
    type: Function
  },
  onListChangeStart: {
    type: Function
  },
  onListChangeEnd: {
    type: Function
  }
}, Wn = () => ({
  prefixCls: String,
  focusable: {
    type: Boolean,
    default: void 0
  },
  activeKey: [Number, String],
  tabindex: Number,
  children: Ee.any,
  treeData: {
    type: Array
  },
  fieldNames: {
    type: Object
  },
  showLine: {
    type: [Boolean, Object],
    default: void 0
  },
  showIcon: {
    type: Boolean,
    default: void 0
  },
  icon: Ee.any,
  selectable: {
    type: Boolean,
    default: void 0
  },
  expandAction: [String, Boolean],
  disabled: {
    type: Boolean,
    default: void 0
  },
  multiple: {
    type: Boolean,
    default: void 0
  },
  checkable: {
    type: Boolean,
    default: void 0
  },
  checkStrictly: {
    type: Boolean,
    default: void 0
  },
  draggable: {
    type: [Function, Boolean]
  },
  defaultExpandParent: {
    type: Boolean,
    default: void 0
  },
  autoExpandParent: {
    type: Boolean,
    default: void 0
  },
  defaultExpandAll: {
    type: Boolean,
    default: void 0
  },
  defaultExpandedKeys: {
    type: Array
  },
  expandedKeys: {
    type: Array
  },
  defaultCheckedKeys: {
    type: Array
  },
  checkedKeys: {
    type: [Object, Array]
  },
  defaultSelectedKeys: {
    type: Array
  },
  selectedKeys: {
    type: Array
  },
  allowDrop: {
    type: Function
  },
  dropIndicatorRender: {
    type: Function
  },
  onFocus: {
    type: Function
  },
  onBlur: {
    type: Function
  },
  onKeydown: {
    type: Function
  },
  onContextmenu: {
    type: Function
  },
  onClick: {
    type: Function
  },
  onDblclick: {
    type: Function
  },
  onScroll: {
    type: Function
  },
  onExpand: {
    type: Function
  },
  onCheck: {
    type: Function
  },
  onSelect: {
    type: Function
  },
  onLoad: {
    type: Function
  },
  loadData: {
    type: Function
  },
  loadedKeys: {
    type: Array
  },
  onMouseenter: {
    type: Function
  },
  onMouseleave: {
    type: Function
  },
  onRightClick: {
    type: Function
  },
  onDragstart: {
    type: Function
  },
  onDragenter: {
    type: Function
  },
  onDragover: {
    type: Function
  },
  onDragleave: {
    type: Function
  },
  onDragend: {
    type: Function
  },
  onDrop: {
    type: Function
  },
  /**
   * Used for `rc-tree-select` only.
   * Do not use in your production code directly since this will be refactor.
   */
  onActiveChange: {
    type: Function
  },
  filterTreeNode: {
    type: Function
  },
  motion: Ee.any,
  switcherIcon: Ee.any,
  // Virtual List
  height: Number,
  itemHeight: Number,
  virtual: {
    type: Boolean,
    default: void 0
  },
  // direction for drag logic
  direction: {
    type: String
  },
  rootClassName: String,
  rootStyle: Object
});
var Gn = function(e, t) {
  var n = {};
  for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var l = 0, o = Object.getOwnPropertySymbols(e); l < o.length; l++)
    t.indexOf(o[l]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[l]) && (n[o[l]] = e[o[l]]);
  return n;
};
const yt = "open", pt = "close", Xn = "---", mt = Ne({
  compatConfig: {
    MODE: 3
  },
  name: "ATreeNode",
  inheritAttrs: !1,
  props: Ft,
  isTreeNode: 1,
  setup(e, t) {
    let {
      attrs: n,
      slots: o,
      expose: l
    } = t;
    Ue(!("slots" in e.data), `treeData slots is deprecated, please use ${Object.keys(e.data.slots || {}).map((a) => "`v-slot:" + a + "` ")}instead`);
    const c = L(!1), i = ct(), {
      expandedKeysSet: v,
      selectedKeysSet: S,
      loadedKeysSet: f,
      loadingKeysSet: K,
      checkedKeysSet: x,
      halfCheckedKeysSet: m
    } = Rt(), {
      dragOverNodeKey: D,
      dropPosition: j,
      keyEntities: y
    } = i.value, N = E(() => Ge(e.eventKey, {
      expandedKeysSet: v.value,
      selectedKeysSet: S.value,
      loadedKeysSet: f.value,
      loadingKeysSet: K.value,
      checkedKeysSet: x.value,
      halfCheckedKeysSet: m.value,
      dragOverNodeKey: D,
      dropPosition: j,
      keyEntities: y
    })), O = he(() => N.value.expanded), V = he(() => N.value.selected), T = he(() => N.value.checked), Y = he(() => N.value.loaded), B = he(() => N.value.loading), Q = he(() => N.value.halfChecked), q = he(() => N.value.dragOver), A = he(() => N.value.dragOverGapTop), G = he(() => N.value.dragOverGapBottom), Z = he(() => N.value.pos), z = L(), U = E(() => {
      const {
        eventKey: a
      } = e, {
        keyEntities: d
      } = i.value, {
        children: R
      } = d[a] || {};
      return !!(R || []).length;
    }), ee = E(() => {
      const {
        isLeaf: a
      } = e, {
        loadData: d
      } = i.value, R = U.value;
      return a === !1 ? !1 : a || !d && !R || d && Y.value && !R;
    }), le = E(() => ee.value ? null : O.value ? yt : pt), se = E(() => {
      const {
        disabled: a
      } = e, {
        disabled: d
      } = i.value;
      return !!(d || a);
    }), Se = E(() => {
      const {
        checkable: a
      } = e, {
        checkable: d
      } = i.value;
      return !d || a === !1 ? !1 : d;
    }), ce = E(() => {
      const {
        selectable: a
      } = e, {
        selectable: d
      } = i.value;
      return typeof a == "boolean" ? a : d;
    }), W = E(() => {
      const {
        data: a,
        active: d,
        checkable: R,
        disableCheckbox: J,
        disabled: te,
        selectable: ne
      } = e;
      return w(w({
        active: d,
        checkable: R,
        disableCheckbox: J,
        disabled: te,
        selectable: ne
      }, a), {
        dataRef: a,
        data: a,
        isLeaf: ee.value,
        checked: T.value,
        expanded: O.value,
        loading: B.value,
        selected: V.value,
        halfChecked: Q.value
      });
    }), h = pn(), b = E(() => {
      const {
        eventKey: a
      } = e, {
        keyEntities: d
      } = i.value, {
        parent: R
      } = d[a] || {};
      return w(w({}, Xe(w({}, e, N.value))), {
        parent: R
      });
    }), H = _e({
      eventData: b,
      eventKey: E(() => e.eventKey),
      selectHandle: z,
      pos: Z,
      key: h.vnode.key
    });
    l(H);
    const X = (a) => {
      const {
        onNodeDoubleClick: d
      } = i.value;
      d(a, b.value);
    }, de = (a) => {
      if (se.value) return;
      const {
        onNodeSelect: d
      } = i.value;
      a.preventDefault(), d(a, b.value);
    }, ge = (a) => {
      if (se.value) return;
      const {
        disableCheckbox: d
      } = e, {
        onNodeCheck: R
      } = i.value;
      if (!Se.value || d) return;
      a.preventDefault();
      const J = !T.value;
      R(a, b.value, J);
    }, ye = (a) => {
      const {
        onNodeClick: d
      } = i.value;
      d(a, b.value), ce.value ? de(a) : ge(a);
    }, xe = (a) => {
      const {
        onNodeMouseEnter: d
      } = i.value;
      d(a, b.value);
    }, Me = (a) => {
      const {
        onNodeMouseLeave: d
      } = i.value;
      d(a, b.value);
    }, Ie = (a) => {
      const {
        onNodeContextMenu: d
      } = i.value;
      d(a, b.value);
    }, pe = (a) => {
      const {
        onNodeDragStart: d
      } = i.value;
      a.stopPropagation(), c.value = !0, d(a, H);
      try {
        a.dataTransfer.setData("text/plain", "");
      } catch (R) {
      }
    }, Le = (a) => {
      const {
        onNodeDragEnter: d
      } = i.value;
      a.preventDefault(), a.stopPropagation(), d(a, H);
    }, He = (a) => {
      const {
        onNodeDragOver: d
      } = i.value;
      a.preventDefault(), a.stopPropagation(), d(a, H);
    }, Ke = (a) => {
      const {
        onNodeDragLeave: d
      } = i.value;
      a.stopPropagation(), d(a, H);
    }, De = (a) => {
      const {
        onNodeDragEnd: d
      } = i.value;
      a.stopPropagation(), c.value = !1, d(a, H);
    }, Qe = (a) => {
      const {
        onNodeDrop: d
      } = i.value;
      a.preventDefault(), a.stopPropagation(), c.value = !1, d(a, H);
    }, Be = (a) => {
      const {
        onNodeExpand: d
      } = i.value;
      B.value || d(a, b.value);
    }, je = () => {
      const {
        data: a
      } = e, {
        draggable: d
      } = i.value;
      return !!(d && (!d.nodeDraggable || d.nodeDraggable(a)));
    }, Ye = () => {
      const {
        draggable: a,
        prefixCls: d
      } = i.value;
      return a && (a != null && a.icon) ? C("span", {
        class: `${d}-draggable-icon`
      }, [a.icon]) : null;
    }, Ze = () => {
      var a, d, R;
      const {
        switcherIcon: J = o.switcherIcon || ((a = i.value.slots) === null || a === void 0 ? void 0 : a[(R = (d = e.data) === null || d === void 0 ? void 0 : d.slots) === null || R === void 0 ? void 0 : R.switcherIcon])
      } = e, {
        switcherIcon: te
      } = i.value, ne = J || te;
      return typeof ne == "function" ? ne(W.value) : ne;
    }, ze = () => {
      const {
        loadData: a,
        onNodeLoad: d
      } = i.value;
      B.value || a && O.value && !ee.value && !U.value && !Y.value && d(b.value);
    };
    qe(() => {
      ze();
    }), Tt(() => {
      ze();
    });
    const et = () => {
      const {
        prefixCls: a
      } = i.value, d = Ze();
      if (ee.value)
        return d !== !1 ? C("span", {
          class: ue(`${a}-switcher`, `${a}-switcher-noop`)
        }, [d]) : null;
      const R = ue(`${a}-switcher`, `${a}-switcher_${O.value ? yt : pt}`);
      return d !== !1 ? C("span", {
        onClick: Be,
        class: R
      }, [d]) : null;
    }, tt = () => {
      var a, d;
      const {
        disableCheckbox: R
      } = e, {
        prefixCls: J
      } = i.value, te = se.value;
      return Se.value ? C("span", {
        class: ue(`${J}-checkbox`, T.value && `${J}-checkbox-checked`, !T.value && Q.value && `${J}-checkbox-indeterminate`, (te || R) && `${J}-checkbox-disabled`),
        onClick: ge
      }, [(d = (a = i.value).customCheckable) === null || d === void 0 ? void 0 : d.call(a)]) : null;
    }, Ve = () => {
      const {
        prefixCls: a
      } = i.value;
      return C("span", {
        class: ue(`${a}-iconEle`, `${a}-icon__${le.value || "docu"}`, B.value && `${a}-icon_loading`)
      }, null);
    }, Te = () => {
      const {
        disabled: a,
        eventKey: d
      } = e, {
        draggable: R,
        dropLevelOffset: J,
        dropPosition: te,
        prefixCls: ne,
        indent: s,
        dropIndicatorRender: r,
        dragOverNodeKey: u,
        direction: p
      } = i.value;
      return !a && R !== !1 && u === d ? r({
        dropPosition: te,
        dropLevelOffset: J,
        indent: s,
        prefixCls: ne,
        direction: p
      }) : null;
    }, nt = () => {
      var a, d, R, J, te, ne;
      const {
        // title = slots.title ||
        //   context.value.slots?.[props.data?.slots?.title] ||
        //   context.value.slots?.title,
        // selected,
        icon: s = o.icon,
        // loading,
        data: r
      } = e, u = o.title || ((a = i.value.slots) === null || a === void 0 ? void 0 : a[(R = (d = e.data) === null || d === void 0 ? void 0 : d.slots) === null || R === void 0 ? void 0 : R.title]) || ((J = i.value.slots) === null || J === void 0 ? void 0 : J.title) || e.title, {
        prefixCls: p,
        showIcon: $,
        icon: k,
        loadData: g
        // slots: contextSlots,
      } = i.value, I = se.value, _ = `${p}-node-content-wrapper`;
      let M;
      if ($) {
        const oe = s || ((te = i.value.slots) === null || te === void 0 ? void 0 : te[(ne = r == null ? void 0 : r.slots) === null || ne === void 0 ? void 0 : ne.icon]) || k;
        M = oe ? C("span", {
          class: ue(`${p}-iconEle`, `${p}-icon__customize`)
        }, [typeof oe == "function" ? oe(W.value) : oe]) : Ve();
      } else g && B.value && (M = Ve());
      let P;
      typeof u == "function" ? P = u(W.value) : P = u, P = P === void 0 ? Xn : P;
      const F = C("span", {
        class: `${p}-title`
      }, [P]);
      return C("span", {
        ref: z,
        title: typeof u == "string" ? u : "",
        class: ue(`${_}`, `${_}-${le.value || "normal"}`, !I && (V.value || c.value) && `${p}-node-selected`),
        onMouseenter: xe,
        onMouseleave: Me,
        onContextmenu: Ie,
        onClick: ye,
        onDblclick: X
      }, [M, F, Te()]);
    };
    return () => {
      const a = w(w({}, e), n), {
        eventKey: d,
        isLeaf: R,
        isStart: J,
        isEnd: te,
        domRef: ne,
        active: s,
        data: r,
        onMousemove: u,
        selectable: p
      } = a, $ = Gn(a, ["eventKey", "isLeaf", "isStart", "isEnd", "domRef", "active", "data", "onMousemove", "selectable"]), {
        prefixCls: k,
        filterTreeNode: g,
        keyEntities: I,
        dropContainerKey: _,
        dropTargetKey: M,
        draggingNodeKey: P
      } = i.value, F = se.value, oe = Ot($, {
        aria: !0,
        data: !0
      }), {
        level: fe
      } = I[d] || {}, ve = te[te.length - 1], ae = je(), ke = !F && ae, Re = P === d, ot = p !== void 0 ? {
        "aria-selected": !!p
      } : void 0;
      return C("div", re(re({
        ref: ne,
        class: ue(n.class, `${k}-treenode`, {
          [`${k}-treenode-disabled`]: F,
          [`${k}-treenode-switcher-${O.value ? "open" : "close"}`]: !R,
          [`${k}-treenode-checkbox-checked`]: T.value,
          [`${k}-treenode-checkbox-indeterminate`]: Q.value,
          [`${k}-treenode-selected`]: V.value,
          [`${k}-treenode-loading`]: B.value,
          [`${k}-treenode-active`]: s,
          [`${k}-treenode-leaf-last`]: ve,
          [`${k}-treenode-draggable`]: ke,
          dragging: Re,
          "drop-target": M === d,
          "drop-container": _ === d,
          "drag-over": !F && q.value,
          "drag-over-gap-top": !F && A.value,
          "drag-over-gap-bottom": !F && G.value,
          "filter-node": g && g(b.value)
        }),
        style: n.style,
        draggable: ke,
        "aria-grabbed": Re,
        onDragstart: ke ? pe : void 0,
        onDragenter: ae ? Le : void 0,
        onDragover: ae ? He : void 0,
        onDragleave: ae ? Ke : void 0,
        onDrop: ae ? Qe : void 0,
        onDragend: ae ? De : void 0,
        onMousemove: u
      }, ot), oe), [C(Vn, {
        prefixCls: k,
        level: fe,
        isStart: J,
        isEnd: te
      }, null), Ye(), et(), tt(), nt()]);
    };
  }
});
var bt = function(e, t) {
  var n = {};
  for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var l = 0, o = Object.getOwnPropertySymbols(e); l < o.length; l++)
    t.indexOf(o[l]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[l]) && (n[o[l]] = e[o[l]]);
  return n;
};
const qn = Ne({
  compatConfig: {
    MODE: 3
  },
  name: "MotionTreeNode",
  inheritAttrs: !1,
  props: w(w({}, Ft), {
    active: Boolean,
    motion: Object,
    motionNodes: {
      type: Array
    },
    onMotionStart: Function,
    onMotionEnd: Function,
    motionType: String
  }),
  setup(e, t) {
    let {
      attrs: n,
      slots: o
    } = t;
    const l = L(!0), c = ct(), i = L(!1), v = E(() => e.motion ? e.motion : nn()), S = (f, K) => {
      var x, m, D, j;
      K === "appear" ? (m = (x = v.value) === null || x === void 0 ? void 0 : x.onAfterEnter) === null || m === void 0 || m.call(x, f) : K === "leave" && ((j = (D = v.value) === null || D === void 0 ? void 0 : D.onAfterLeave) === null || j === void 0 || j.call(D, f)), i.value || e.onMotionEnd(), i.value = !0;
    };
    return ie(() => e.motionNodes, () => {
      e.motionNodes && e.motionType === "hide" && l.value && Ae(() => {
        l.value = !1;
      });
    }, {
      immediate: !0,
      flush: "post"
    }), qe(() => {
      e.motionNodes && e.onMotionStart();
    }), rt(() => {
      e.motionNodes && S();
    }), () => {
      const {
        motion: f,
        motionNodes: K,
        motionType: x,
        active: m,
        eventKey: D
      } = e, j = bt(e, ["motion", "motionNodes", "motionType", "active", "eventKey"]);
      return K ? C(mn, re(re({}, v.value), {}, {
        appear: x === "show",
        onAfterAppear: (y) => S(y, "appear"),
        onAfterLeave: (y) => S(y, "leave")
      }), {
        default: () => [bn(C("div", {
          class: `${c.value.prefixCls}-treenode-motion`
        }, [K.map((y) => {
          const N = bt(y.data, []), {
            title: O,
            key: V,
            isStart: T,
            isEnd: Y
          } = y;
          return delete N.children, C(mt, re(re({}, N), {}, {
            title: O,
            active: m,
            data: y.data,
            key: V,
            eventKey: V,
            isStart: T,
            isEnd: Y
          }), o);
        })]), [[Sn, l.value]])]
      }) : C(mt, re(re({
        class: n.class,
        style: n.style
      }, j), {}, {
        active: m,
        eventKey: D
      }), o);
    };
  }
});
function Jn() {
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
  const n = e.length, o = t.length;
  if (Math.abs(n - o) !== 1)
    return {
      add: !1,
      key: null
    };
  function l(c, i) {
    const v = /* @__PURE__ */ new Map();
    c.forEach((f) => {
      v.set(f, !0);
    });
    const S = i.filter((f) => !v.has(f));
    return S.length === 1 ? S[0] : null;
  }
  return n < o ? {
    add: !0,
    key: l(e, t)
  } : {
    add: !1,
    key: l(t, e)
  };
}
function St(e, t, n) {
  const o = e.findIndex((i) => i.key === n), l = e[o + 1], c = t.findIndex((i) => i.key === n);
  if (l) {
    const i = t.findIndex((v) => v.key === l.key);
    return t.slice(c + 1, i);
  }
  return t.slice(c + 1);
}
var xt = function(e, t) {
  var n = {};
  for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var l = 0, o = Object.getOwnPropertySymbols(e); l < o.length; l++)
    t.indexOf(o[l]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[l]) && (n[o[l]] = e[o[l]]);
  return n;
};
const Kt = {
  width: 0,
  height: 0,
  display: "flex",
  overflow: "hidden",
  opacity: 0,
  border: 0,
  padding: 0,
  margin: 0
}, Qn = () => {
}, $e = `RC_TREE_MOTION_${Math.random()}`, st = {
  key: $e
}, At = {
  key: $e,
  level: 0,
  index: 0,
  pos: "0",
  node: st,
  nodes: [st]
}, kt = {
  parent: null,
  children: [],
  pos: At.pos,
  data: st,
  title: null,
  key: $e,
  /** Hold empty list here since we do not use it */
  isStart: [],
  isEnd: []
};
function wt(e, t, n, o) {
  return t === !1 || !n ? e : e.slice(0, Math.ceil(n / o) + 1);
}
function Ct(e) {
  const {
    key: t,
    pos: n
  } = e;
  return Mt(t, n);
}
function Zn(e) {
  let t = String(e.key), n = e;
  for (; n.parent; )
    n = n.parent, t = `${n.key} > ${t}`;
  return t;
}
const eo = Ne({
  compatConfig: {
    MODE: 3
  },
  name: "NodeList",
  inheritAttrs: !1,
  props: Un,
  setup(e, t) {
    let {
      expose: n,
      attrs: o
    } = t;
    const l = We(), c = We(), {
      expandedKeys: i,
      flattenNodes: v
    } = Rt();
    n({
      scrollTo: (y) => {
        l.value.scrollTo(y);
      },
      getIndentWidth: () => c.value.offsetWidth
    });
    const S = L(v.value), f = L([]), K = We(null);
    function x() {
      S.value = v.value, f.value = [], K.value = null, e.onListChangeEnd();
    }
    const m = ct();
    ie([() => i.value.slice(), v], (y, N) => {
      let [O, V] = y, [T, Y] = N;
      const B = Jn(T, O);
      if (B.key !== null) {
        const {
          virtual: Q,
          height: q,
          itemHeight: A
        } = e;
        if (B.add) {
          const G = Y.findIndex((U) => {
            let {
              key: ee
            } = U;
            return ee === B.key;
          }), Z = wt(St(Y, V, B.key), Q, q, A), z = Y.slice();
          z.splice(G + 1, 0, kt), S.value = z, f.value = Z, K.value = "show";
        } else {
          const G = V.findIndex((U) => {
            let {
              key: ee
            } = U;
            return ee === B.key;
          }), Z = wt(St(V, Y, B.key), Q, q, A), z = V.slice();
          z.splice(G + 1, 0, kt), S.value = z, f.value = Z, K.value = "hide";
        }
      } else Y !== V && (S.value = V);
    }), ie(() => m.value.dragging, (y) => {
      y || x();
    });
    const D = E(() => e.motion === void 0 ? S.value : v.value), j = () => {
      e.onActiveChange(null);
    };
    return () => {
      const y = w(w({}, e), o), {
        prefixCls: N,
        selectable: O,
        checkable: V,
        disabled: T,
        motion: Y,
        height: B,
        itemHeight: Q,
        virtual: q,
        focusable: A,
        activeItem: G,
        focused: Z,
        tabindex: z,
        onKeydown: U,
        onFocus: ee,
        onBlur: le,
        onListChangeStart: se,
        onListChangeEnd: Se
      } = y, ce = xt(y, ["prefixCls", "selectable", "checkable", "disabled", "motion", "height", "itemHeight", "virtual", "focusable", "activeItem", "focused", "tabindex", "onKeydown", "onFocus", "onBlur", "onListChangeStart", "onListChangeEnd"]);
      return C(xn, null, [Z && G && C("span", {
        style: Kt,
        "aria-live": "assertive"
      }, [Zn(G)]), C("div", null, [C("input", {
        style: Kt,
        disabled: A === !1 || T,
        tabindex: A !== !1 ? z : null,
        onKeydown: U,
        onFocus: ee,
        onBlur: le,
        value: "",
        onChange: Qn,
        "aria-label": "for screen reader"
      }, null)]), C("div", {
        class: `${N}-treenode`,
        "aria-hidden": !0,
        style: {
          position: "absolute",
          pointerEvents: "none",
          visibility: "hidden",
          height: 0,
          overflow: "hidden"
        }
      }, [C("div", {
        class: `${N}-indent`
      }, [C("div", {
        ref: c,
        class: `${N}-indent-unit`
      }, null)])]), C(jn, re(re({}, on(ce, ["onActiveChange"])), {}, {
        data: D.value,
        itemKey: Ct,
        height: B,
        fullHeight: !1,
        virtual: q,
        itemHeight: Q,
        prefixCls: `${N}-list`,
        ref: l,
        onVisibleChange: (W, h) => {
          const b = new Set(W);
          h.filter((X) => !b.has(X)).some((X) => Ct(X) === $e) && x();
        }
      }), {
        default: (W) => {
          const {
            pos: h
          } = W, b = xt(W.data, []), {
            title: H,
            key: X,
            isStart: de,
            isEnd: ge
          } = W, ye = Mt(X, h);
          return delete b.key, delete b.children, C(qn, re(re({}, b), {}, {
            eventKey: ye,
            title: H,
            active: !!G && X === G.key,
            data: W.data,
            isStart: de,
            isEnd: ge,
            motion: Y,
            motionNodes: X === $e ? f.value : null,
            motionType: K.value,
            onMotionStart: se,
            onMotionEnd: x,
            onMousemove: j
          }), null);
        }
      })]);
    };
  }
});
function to(e) {
  let {
    dropPosition: t,
    dropLevelOffset: n,
    indent: o
  } = e;
  const l = {
    pointerEvents: "none",
    position: "absolute",
    right: 0,
    backgroundColor: "red",
    height: "2px"
  };
  switch (t) {
    case -1:
      l.top = 0, l.left = `${-n * o}px`;
      break;
    case 1:
      l.bottom = 0, l.left = `${-n * o}px`;
      break;
    case 0:
      l.bottom = 0, l.left = `${o}`;
      break;
  }
  return C("div", {
    style: l
  }, null);
}
const no = 10, ho = Ne({
  compatConfig: {
    MODE: 3
  },
  name: "Tree",
  inheritAttrs: !1,
  props: ln(Wn(), {
    prefixCls: "vc-tree",
    showLine: !1,
    showIcon: !0,
    selectable: !0,
    multiple: !1,
    checkable: !1,
    disabled: !1,
    checkStrictly: !1,
    draggable: !1,
    expandAction: !1,
    defaultExpandParent: !0,
    autoExpandParent: !1,
    defaultExpandAll: !1,
    defaultExpandedKeys: [],
    defaultCheckedKeys: [],
    defaultSelectedKeys: [],
    dropIndicatorRender: to,
    allowDrop: () => !0
  }),
  setup(e, t) {
    let {
      attrs: n,
      slots: o,
      expose: l
    } = t;
    const c = L(!1);
    let i = {};
    const v = L(), S = L([]), f = L([]), K = L([]), x = L([]), m = L([]), D = L([]), j = {}, y = _e({
      draggingNodeKey: null,
      dragChildrenKeys: [],
      // dropTargetKey is the key of abstract-drop-node
      // the abstract-drop-node is the real drop node when drag and drop
      // not the DOM drag over node
      dropTargetKey: null,
      dropPosition: null,
      dropContainerKey: null,
      dropLevelOffset: null,
      dropTargetPos: null,
      dropAllowed: !0,
      // the abstract-drag-over-node
      // if mouse is on the bottom of top dom node or no the top of the bottom dom node
      // abstract-drag-over-node is the top node
      dragOverNodeKey: null
    }), N = L([]);
    ie([() => e.treeData, () => e.children], () => {
      N.value = e.treeData !== void 0 ? e.treeData.slice() : Kn(it(e.children));
    }, {
      immediate: !0,
      deep: !0
    });
    const O = L({}), V = L(!1), T = L(null), Y = L(!1), B = E(() => kn(e.fieldNames)), Q = L();
    let q = null, A = null, G = null;
    const Z = E(() => ({
      expandedKeysSet: z.value,
      selectedKeysSet: U.value,
      loadedKeysSet: ee.value,
      loadingKeysSet: le.value,
      checkedKeysSet: se.value,
      halfCheckedKeysSet: Se.value,
      dragOverNodeKey: y.dragOverNodeKey,
      dropPosition: y.dropPosition,
      keyEntities: O.value
    })), z = E(() => new Set(D.value)), U = E(() => new Set(S.value)), ee = E(() => new Set(x.value)), le = E(() => new Set(m.value)), se = E(() => new Set(f.value)), Se = E(() => new Set(K.value));
    Pe(() => {
      if (N.value) {
        const s = wn(N.value, {
          fieldNames: B.value
        });
        O.value = w({
          [$e]: At
        }, s.keyEntities);
      }
    });
    let ce = !1;
    ie(
      [() => e.expandedKeys, () => e.autoExpandParent, O],
      // eslint-disable-next-line @typescript-eslint/no-unused-vars
      (s, r) => {
        let [u, p] = s, [$, k] = r, g = D.value;
        if (e.expandedKeys !== void 0 || ce && p !== k)
          g = e.autoExpandParent || !ce && e.defaultExpandParent ? ft(e.expandedKeys, O.value) : e.expandedKeys;
        else if (!ce && e.defaultExpandAll) {
          const I = w({}, O.value);
          delete I[$e], g = Object.keys(I).map((_) => I[_].key);
        } else !ce && e.defaultExpandedKeys && (g = e.autoExpandParent || e.defaultExpandParent ? ft(e.defaultExpandedKeys, O.value) : e.defaultExpandedKeys);
        g && (D.value = g), ce = !0;
      },
      {
        immediate: !0
      }
    );
    const W = L([]);
    Pe(() => {
      W.value = Cn(N.value, D.value, B.value);
    }), Pe(() => {
      e.selectable && (e.selectedKeys !== void 0 ? S.value = vt(e.selectedKeys, e) : !ce && e.defaultSelectedKeys && (S.value = vt(e.defaultSelectedKeys, e)));
    });
    const {
      maxLevel: h,
      levelEntities: b
    } = En(O);
    Pe(() => {
      if (e.checkable) {
        let s;
        if (e.checkedKeys !== void 0 ? s = lt(e.checkedKeys) || {} : !ce && e.defaultCheckedKeys ? s = lt(e.defaultCheckedKeys) || {} : N.value && (s = lt(e.checkedKeys) || {
          checkedKeys: f.value,
          halfCheckedKeys: K.value
        }), s) {
          let {
            checkedKeys: r = [],
            halfCheckedKeys: u = []
          } = s;
          e.checkStrictly || ({
            checkedKeys: r,
            halfCheckedKeys: u
          } = at(r, !0, O.value, h.value, b.value)), f.value = r, K.value = u;
        }
      }
    }), Pe(() => {
      e.loadedKeys && (x.value = e.loadedKeys);
    });
    const H = () => {
      w(y, {
        dragOverNodeKey: null,
        dropPosition: null,
        dropLevelOffset: null,
        dropTargetKey: null,
        dropContainerKey: null,
        dropTargetPos: null,
        dropAllowed: !1
      });
    }, X = (s) => {
      Q.value.scrollTo(s);
    };
    ie(() => e.activeKey, () => {
      e.activeKey !== void 0 && (T.value = e.activeKey);
    }, {
      immediate: !0
    }), ie(T, (s) => {
      Ae(() => {
        s !== null && X({
          key: s
        });
      });
    }, {
      immediate: !0,
      flush: "post"
    });
    const de = (s) => {
      e.expandedKeys === void 0 && (D.value = s);
    }, ge = () => {
      y.draggingNodeKey !== null && w(y, {
        draggingNodeKey: null,
        dropPosition: null,
        dropContainerKey: null,
        dropTargetKey: null,
        dropLevelOffset: null,
        dropAllowed: !0,
        dragOverNodeKey: null
      }), q = null, G = null;
    }, ye = (s, r) => {
      const {
        onDragend: u
      } = e;
      y.dragOverNodeKey = null, ge(), u == null || u({
        event: s,
        node: r.eventData
      }), A = null;
    }, xe = (s) => {
      ye(s, null), window.removeEventListener("dragend", xe);
    }, Me = (s, r) => {
      const {
        onDragstart: u
      } = e, {
        eventKey: p,
        eventData: $
      } = r;
      A = r, q = {
        x: s.clientX,
        y: s.clientY
      };
      const k = me(D.value, p);
      y.draggingNodeKey = p, y.dragChildrenKeys = Dn(p, O.value), v.value = Q.value.getIndentWidth(), de(k), window.addEventListener("dragend", xe), u && u({
        event: s,
        node: $
      });
    }, Ie = (s, r) => {
      const {
        onDragenter: u,
        onExpand: p,
        allowDrop: $,
        direction: k
      } = e, {
        pos: g,
        eventKey: I
      } = r;
      if (G !== I && (G = I), !A) {
        H();
        return;
      }
      const {
        dropPosition: _,
        dropLevelOffset: M,
        dropTargetKey: P,
        dropContainerKey: F,
        dropTargetPos: oe,
        dropAllowed: fe,
        dragOverNodeKey: ve
      } = ht(s, A, r, v.value, q, $, W.value, O.value, z.value, k);
      if (
        // don't allow drop inside its children
        y.dragChildrenKeys.indexOf(P) !== -1 || // don't allow drop when drop is not allowed caculated by calcDropPosition
        !fe
      ) {
        H();
        return;
      }
      if (i || (i = {}), Object.keys(i).forEach((ae) => {
        clearTimeout(i[ae]);
      }), A.eventKey !== r.eventKey && (i[g] = window.setTimeout(() => {
        if (y.draggingNodeKey === null) return;
        let ae = D.value.slice();
        const ke = O.value[r.eventKey];
        ke && (ke.children || []).length && (ae = we(D.value, r.eventKey)), de(ae), p && p(ae, {
          node: r.eventData,
          expanded: !0,
          nativeEvent: s
        });
      }, 800)), A.eventKey === P && M === 0) {
        H();
        return;
      }
      w(y, {
        dragOverNodeKey: ve,
        dropPosition: _,
        dropLevelOffset: M,
        dropTargetKey: P,
        dropContainerKey: F,
        dropTargetPos: oe,
        dropAllowed: fe
      }), u && u({
        event: s,
        node: r.eventData,
        expandedKeys: D.value
      });
    }, pe = (s, r) => {
      const {
        onDragover: u,
        allowDrop: p,
        direction: $
      } = e;
      if (!A)
        return;
      const {
        dropPosition: k,
        dropLevelOffset: g,
        dropTargetKey: I,
        dropContainerKey: _,
        dropAllowed: M,
        dropTargetPos: P,
        dragOverNodeKey: F
      } = ht(s, A, r, v.value, q, p, W.value, O.value, z.value, $);
      y.dragChildrenKeys.indexOf(I) !== -1 || !M || (A.eventKey === I && g === 0 ? y.dropPosition === null && y.dropLevelOffset === null && y.dropTargetKey === null && y.dropContainerKey === null && y.dropTargetPos === null && y.dropAllowed === !1 && y.dragOverNodeKey === null || H() : k === y.dropPosition && g === y.dropLevelOffset && I === y.dropTargetKey && _ === y.dropContainerKey && P === y.dropTargetPos && M === y.dropAllowed && F === y.dragOverNodeKey || w(y, {
        dropPosition: k,
        dropLevelOffset: g,
        dropTargetKey: I,
        dropContainerKey: _,
        dropTargetPos: P,
        dropAllowed: M,
        dragOverNodeKey: F
      }), u && u({
        event: s,
        node: r.eventData
      }));
    }, Le = (s, r) => {
      G === r.eventKey && !s.currentTarget.contains(s.relatedTarget) && (H(), G = null);
      const {
        onDragleave: u
      } = e;
      u && u({
        event: s,
        node: r.eventData
      });
    }, He = function(s, r) {
      let u = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
      var p;
      const {
        dragChildrenKeys: $,
        dropPosition: k,
        dropTargetKey: g,
        dropTargetPos: I,
        dropAllowed: _
      } = y;
      if (!_) return;
      const {
        onDrop: M
      } = e;
      if (y.dragOverNodeKey = null, ge(), g === null) return;
      const P = w(w({}, Ge(g, it(Z.value))), {
        active: ((p = R.value) === null || p === void 0 ? void 0 : p.key) === g,
        data: O.value[g].node
      }), F = $.indexOf(g) !== -1;
      Ue(!F, "Can not drop to dragNode's children node. Maybe this is a bug of ant-design-vue. Please report an issue.");
      const oe = Tn(I), fe = {
        event: s,
        node: Xe(P),
        dragNode: A ? A.eventData : null,
        dragNodesKeys: [A.eventKey].concat($),
        dropToGap: k !== 0,
        dropPosition: k + Number(oe[oe.length - 1])
      };
      u || M == null || M(fe), A = null;
    }, Ke = (s, r) => {
      const {
        expanded: u,
        key: p
      } = r, $ = W.value.filter((g) => g.key === p)[0], k = Xe(w(w({}, Ge(p, Z.value)), {
        data: $.data
      }));
      de(u ? me(D.value, p) : we(D.value, p)), Te(s, k);
    }, De = (s, r) => {
      const {
        onClick: u,
        expandAction: p
      } = e;
      p === "click" && Ke(s, r), u && u(s, r);
    }, Qe = (s, r) => {
      const {
        onDblclick: u,
        expandAction: p
      } = e;
      (p === "doubleclick" || p === "dblclick") && Ke(s, r), u && u(s, r);
    }, Be = (s, r) => {
      let u = S.value;
      const {
        onSelect: p,
        multiple: $
      } = e, {
        selected: k
      } = r, g = r[B.value.key], I = !k;
      I ? $ ? u = we(u, g) : u = [g] : u = me(u, g);
      const _ = O.value, M = u.map((P) => {
        const F = _[P];
        return F ? F.node : null;
      }).filter((P) => P);
      e.selectedKeys === void 0 && (S.value = u), p && p(u, {
        event: "select",
        selected: I,
        node: r,
        selectedNodes: M,
        nativeEvent: s
      });
    }, je = (s, r, u) => {
      const {
        checkStrictly: p,
        onCheck: $
      } = e, k = r[B.value.key];
      let g;
      const I = {
        event: "check",
        node: r,
        checked: u,
        nativeEvent: s
      }, _ = O.value;
      if (p) {
        const M = u ? we(f.value, k) : me(f.value, k), P = me(K.value, k);
        g = {
          checked: M,
          halfChecked: P
        }, I.checkedNodes = M.map((F) => _[F]).filter((F) => F).map((F) => F.node), e.checkedKeys === void 0 && (f.value = M);
      } else {
        let {
          checkedKeys: M,
          halfCheckedKeys: P
        } = at([...f.value, k], !0, _, h.value, b.value);
        if (!u) {
          const F = new Set(M);
          F.delete(k), {
            checkedKeys: M,
            halfCheckedKeys: P
          } = at(Array.from(F), {
            checked: !1,
            halfCheckedKeys: P
          }, _, h.value, b.value);
        }
        g = M, I.checkedNodes = [], I.checkedNodesPositions = [], I.halfCheckedKeys = P, M.forEach((F) => {
          const oe = _[F];
          if (!oe) return;
          const {
            node: fe,
            pos: ve
          } = oe;
          I.checkedNodes.push(fe), I.checkedNodesPositions.push({
            node: fe,
            pos: ve
          });
        }), e.checkedKeys === void 0 && (f.value = M, K.value = P);
      }
      $ && $(g, I);
    }, Ye = (s) => {
      const r = s[B.value.key], u = new Promise((p, $) => {
        const {
          loadData: k,
          onLoad: g
        } = e;
        if (!k || ee.value.has(r) || le.value.has(r))
          return null;
        k(s).then(() => {
          const _ = we(x.value, r), M = me(m.value, r);
          g && g(_, {
            event: "load",
            node: s
          }), e.loadedKeys === void 0 && (x.value = _), m.value = M, p();
        }).catch((_) => {
          const M = me(m.value, r);
          if (m.value = M, j[r] = (j[r] || 0) + 1, j[r] >= no) {
            Ue(!1, "Retry for `loadData` many times but still failed. No more retry.");
            const P = we(x.value, r);
            e.loadedKeys === void 0 && (x.value = P), p();
          }
          $(_);
        }), m.value = we(m.value, r);
      });
      return u.catch(() => {
      }), u;
    }, Ze = (s, r) => {
      const {
        onMouseenter: u
      } = e;
      u && u({
        event: s,
        node: r
      });
    }, ze = (s, r) => {
      const {
        onMouseleave: u
      } = e;
      u && u({
        event: s,
        node: r
      });
    }, et = (s, r) => {
      const {
        onRightClick: u
      } = e;
      u && (s.preventDefault(), u({
        event: s,
        node: r
      }));
    }, tt = (s) => {
      const {
        onFocus: r
      } = e;
      V.value = !0, r && r(s);
    }, Ve = (s) => {
      const {
        onBlur: r
      } = e;
      V.value = !1, d(null), r && r(s);
    }, Te = (s, r) => {
      let u = D.value;
      const {
        onExpand: p,
        loadData: $
      } = e, {
        expanded: k
      } = r, g = r[B.value.key];
      if (Y.value)
        return;
      const I = u.indexOf(g), _ = !k;
      if (Ue(k && I !== -1 || !k && I === -1, "Expand state not sync with index check"), _ ? u = we(u, g) : u = me(u, g), de(u), p && p(u, {
        node: r,
        expanded: _,
        nativeEvent: s
      }), _ && $) {
        const M = Ye(r);
        M && M.then(() => {
        }).catch((P) => {
          const F = me(D.value, g);
          de(F), Promise.reject(P);
        });
      }
    }, nt = () => {
      Y.value = !0;
    }, a = () => {
      setTimeout(() => {
        Y.value = !1;
      });
    }, d = (s) => {
      const {
        onActiveChange: r
      } = e;
      T.value !== s && (e.activeKey !== void 0 && (T.value = s), s !== null && X({
        key: s
      }), r && r(s));
    }, R = E(() => T.value === null ? null : W.value.find((s) => {
      let {
        key: r
      } = s;
      return r === T.value;
    }) || null), J = (s) => {
      let r = W.value.findIndex((p) => {
        let {
          key: $
        } = p;
        return $ === T.value;
      });
      r === -1 && s < 0 && (r = W.value.length), r = (r + s + W.value.length) % W.value.length;
      const u = W.value[r];
      if (u) {
        const {
          key: p
        } = u;
        d(p);
      } else
        d(null);
    }, te = E(() => Xe(w(w({}, Ge(T.value, Z.value)), {
      data: R.value.data,
      active: !0
    }))), ne = (s) => {
      const {
        onKeydown: r,
        checkable: u,
        selectable: p
      } = e;
      switch (s.which) {
        case Oe.UP: {
          J(-1), s.preventDefault();
          break;
        }
        case Oe.DOWN: {
          J(1), s.preventDefault();
          break;
        }
      }
      const $ = R.value;
      if ($ && $.data) {
        const k = $.data.isLeaf === !1 || !!($.data.children || []).length, g = te.value;
        switch (s.which) {
          case Oe.LEFT: {
            k && z.value.has(T.value) ? Te({}, g) : $.parent && d($.parent.key), s.preventDefault();
            break;
          }
          case Oe.RIGHT: {
            k && !z.value.has(T.value) ? Te({}, g) : $.children && $.children.length && d($.children[0].key), s.preventDefault();
            break;
          }
          case Oe.ENTER:
          case Oe.SPACE: {
            u && !g.disabled && g.checkable !== !1 && !g.disableCheckbox ? je({}, g, !se.value.has(T.value)) : !u && p && !g.disabled && g.selectable !== !1 && Be({}, g);
            break;
          }
        }
      }
      r && r(s);
    };
    return l({
      onNodeExpand: Te,
      scrollTo: X,
      onKeydown: ne,
      selectedKeys: E(() => S.value),
      checkedKeys: E(() => f.value),
      halfCheckedKeys: E(() => K.value),
      loadedKeys: E(() => x.value),
      loadingKeys: E(() => m.value),
      expandedKeys: E(() => D.value)
    }), Dt(() => {
      window.removeEventListener("dragend", xe), c.value = !0;
    }), zn({
      expandedKeys: D,
      selectedKeys: S,
      loadedKeys: x,
      loadingKeys: m,
      checkedKeys: f,
      halfCheckedKeys: K,
      expandedKeysSet: z,
      selectedKeysSet: U,
      loadedKeysSet: ee,
      loadingKeysSet: le,
      checkedKeysSet: se,
      halfCheckedKeysSet: Se,
      flattenNodes: W
    }), () => {
      const {
        // focused,
        // flattenNodes,
        // keyEntities,
        draggingNodeKey: s,
        // activeKey,
        dropLevelOffset: r,
        dropContainerKey: u,
        dropTargetKey: p,
        dropPosition: $,
        dragOverNodeKey: k
        // indent,
      } = y, {
        prefixCls: g,
        showLine: I,
        focusable: _,
        tabindex: M = 0,
        selectable: P,
        showIcon: F,
        icon: oe = o.icon,
        switcherIcon: fe,
        draggable: ve,
        checkable: ae,
        checkStrictly: ke,
        disabled: Re,
        motion: ot,
        loadData: _t,
        filterTreeNode: Bt,
        height: jt,
        itemHeight: Yt,
        virtual: zt,
        dropIndicatorRender: Vt,
        onContextmenu: Ut,
        onScroll: Wt,
        direction: Gt,
        rootClassName: Xt,
        rootStyle: qt
      } = e, {
        class: Jt,
        style: Qt
      } = n, Zt = Ot(w(w({}, e), n), {
        aria: !0,
        data: !0
      });
      let Fe;
      return ve ? typeof ve == "object" ? Fe = ve : typeof ve == "function" ? Fe = {
        nodeDraggable: ve
      } : Fe = {} : Fe = !1, C(Yn, {
        value: {
          prefixCls: g,
          selectable: P,
          showIcon: F,
          icon: oe,
          switcherIcon: fe,
          draggable: Fe,
          draggingNodeKey: s,
          checkable: ae,
          customCheckable: o.checkable,
          checkStrictly: ke,
          disabled: Re,
          keyEntities: O.value,
          dropLevelOffset: r,
          dropContainerKey: u,
          dropTargetKey: p,
          dropPosition: $,
          dragOverNodeKey: k,
          dragging: s !== null,
          indent: v.value,
          direction: Gt,
          dropIndicatorRender: Vt,
          loadData: _t,
          filterTreeNode: Bt,
          onNodeClick: De,
          onNodeDoubleClick: Qe,
          onNodeExpand: Te,
          onNodeSelect: Be,
          onNodeCheck: je,
          onNodeLoad: Ye,
          onNodeMouseEnter: Ze,
          onNodeMouseLeave: ze,
          onNodeContextMenu: et,
          onNodeDragStart: Me,
          onNodeDragEnter: Ie,
          onNodeDragOver: pe,
          onNodeDragLeave: Le,
          onNodeDragEnd: ye,
          onNodeDrop: He,
          slots: o
        }
      }, {
        default: () => [C("div", {
          role: "tree",
          class: ue(g, Jt, Xt, {
            [`${g}-show-line`]: I,
            [`${g}-focused`]: V.value,
            [`${g}-active-focused`]: T.value !== null
          }),
          style: qt
        }, [C(eo, re({
          ref: Q,
          prefixCls: g,
          style: Qt,
          disabled: Re,
          selectable: P,
          checkable: !!ae,
          motion: ot,
          height: jt,
          itemHeight: Yt,
          virtual: zt,
          focusable: _,
          focused: V.value,
          tabindex: M,
          activeItem: R.value,
          onFocus: tt,
          onBlur: Ve,
          onKeydown: ne,
          onActiveChange: d,
          onListChangeStart: nt,
          onListChangeEnd: a,
          onContextmenu: Ut,
          onScroll: Wt
        }, Zt), null)])]
      });
    };
  }
});
function go(e, t, n, o, l) {
  const {
    isLeaf: c,
    expanded: i,
    loading: v
  } = n;
  let S = t;
  if (v)
    return C(an, {
      class: `${e}-switcher-loading-icon`
    }, null);
  let f;
  l && typeof l == "object" && (f = l.showLeafIcon);
  let K = null;
  const x = `${e}-switcher-icon`;
  return c ? l ? f && o ? o(n) : (typeof l == "object" && !f ? K = C("span", {
    class: `${e}-switcher-leaf-line`
  }, null) : K = C(sn, {
    class: `${e}-switcher-line-icon`
  }, null), K) : null : (K = C(rn, {
    class: x
  }, null), l && (K = i ? C(cn, {
    class: `${e}-switcher-line-icon`
  }, null) : C(dn, {
    class: `${e}-switcher-line-icon`
  }, null)), typeof t == "function" ? S = t(w(w({}, n), {
    defaultIcon: K,
    switcherCls: x
  })) : un(S) && (S = Et(S, {
    class: x
  })), S || K);
}
const oo = new yn("ant-tree-node-fx-do-not-use", {
  "0%": {
    opacity: 0
  },
  "100%": {
    opacity: 1
  }
}), lo = (e, t) => ({
  [`.${e}-switcher-icon`]: {
    display: "inline-block",
    fontSize: 10,
    verticalAlign: "baseline",
    svg: {
      transition: `transform ${t.motionDurationSlow}`
    }
  }
}), ao = (e, t) => ({
  [`.${e}-drop-indicator`]: {
    position: "absolute",
    // it should displayed over the following node
    zIndex: 1,
    height: 2,
    backgroundColor: t.colorPrimary,
    borderRadius: 1,
    pointerEvents: "none",
    "&:after": {
      position: "absolute",
      top: -3,
      insetInlineStart: -6,
      width: 8,
      height: 8,
      backgroundColor: "transparent",
      border: `${t.lineWidthBold}px solid ${t.colorPrimary}`,
      borderRadius: "50%",
      content: '""'
    }
  }
}), io = (e, t) => {
  const {
    treeCls: n,
    treeNodeCls: o,
    treeNodePadding: l,
    treeTitleHeight: c
  } = t, i = (c - t.fontSizeLG) / 2, v = t.paddingXS;
  return {
    [n]: w(w({}, gn(t)), {
      background: t.colorBgContainer,
      borderRadius: t.borderRadius,
      transition: `background-color ${t.motionDurationSlow}`,
      [`&${n}-rtl`]: {
        // >>> Switcher
        [`${n}-switcher`]: {
          "&_close": {
            [`${n}-switcher-icon`]: {
              svg: {
                transform: "rotate(90deg)"
              }
            }
          }
        }
      },
      [`&-focused:not(:hover):not(${n}-active-focused)`]: w({}, dt(t)),
      // =================== Virtual List ===================
      [`${n}-list-holder-inner`]: {
        alignItems: "flex-start"
      },
      [`&${n}-block-node`]: {
        [`${n}-list-holder-inner`]: {
          alignItems: "stretch",
          // >>> Title
          [`${n}-node-content-wrapper`]: {
            flex: "auto"
          },
          // >>> Drag
          [`${o}.dragging`]: {
            position: "relative",
            "&:after": {
              position: "absolute",
              top: 0,
              insetInlineEnd: 0,
              bottom: l,
              insetInlineStart: 0,
              border: `1px solid ${t.colorPrimary}`,
              opacity: 0,
              animationName: oo,
              animationDuration: t.motionDurationSlow,
              animationPlayState: "running",
              animationFillMode: "forwards",
              content: '""',
              pointerEvents: "none"
            }
          }
        }
      },
      // ===================== TreeNode =====================
      [`${o}`]: {
        display: "flex",
        alignItems: "flex-start",
        padding: `0 0 ${l}px 0`,
        outline: "none",
        "&-rtl": {
          direction: "rtl"
        },
        // Disabled
        "&-disabled": {
          // >>> Title
          [`${n}-node-content-wrapper`]: {
            color: t.colorTextDisabled,
            cursor: "not-allowed",
            "&:hover": {
              background: "transparent"
            }
          }
        },
        [`&-active ${n}-node-content-wrapper`]: w({}, dt(t)),
        [`&:not(${o}-disabled).filter-node ${n}-title`]: {
          color: "inherit",
          fontWeight: 500
        },
        "&-draggable": {
          [`${n}-draggable-icon`]: {
            width: c,
            lineHeight: `${c}px`,
            textAlign: "center",
            visibility: "visible",
            opacity: 0.2,
            transition: `opacity ${t.motionDurationSlow}`,
            [`${o}:hover &`]: {
              opacity: 0.45
            }
          },
          [`&${o}-disabled`]: {
            [`${n}-draggable-icon`]: {
              visibility: "hidden"
            }
          }
        }
      },
      // >>> Indent
      [`${n}-indent`]: {
        alignSelf: "stretch",
        whiteSpace: "nowrap",
        userSelect: "none",
        "&-unit": {
          display: "inline-block",
          width: c
        }
      },
      // >>> Drag Handler
      [`${n}-draggable-icon`]: {
        visibility: "hidden"
      },
      // >>> Switcher
      [`${n}-switcher`]: w(w({}, lo(e, t)), {
        position: "relative",
        flex: "none",
        alignSelf: "stretch",
        width: c,
        margin: 0,
        lineHeight: `${c}px`,
        textAlign: "center",
        cursor: "pointer",
        userSelect: "none",
        "&-noop": {
          cursor: "default"
        },
        "&_close": {
          [`${n}-switcher-icon`]: {
            svg: {
              transform: "rotate(-90deg)"
            }
          }
        },
        "&-loading-icon": {
          color: t.colorPrimary
        },
        "&-leaf-line": {
          position: "relative",
          zIndex: 1,
          display: "inline-block",
          width: "100%",
          height: "100%",
          // https://github.com/ant-design/ant-design/issues/31884
          "&:before": {
            position: "absolute",
            top: 0,
            insetInlineEnd: c / 2,
            bottom: -l,
            marginInlineStart: -1,
            borderInlineEnd: `1px solid ${t.colorBorder}`,
            content: '""'
          },
          "&:after": {
            position: "absolute",
            width: c / 2 * 0.8,
            height: c / 2,
            borderBottom: `1px solid ${t.colorBorder}`,
            content: '""'
          }
        }
      }),
      // >>> Checkbox
      [`${n}-checkbox`]: {
        top: "initial",
        marginInlineEnd: v,
        marginBlockStart: i
      },
      // >>> Title
      // add `${treeCls}-checkbox + span` to cover checkbox `${checkboxCls} + span`
      [`${n}-node-content-wrapper, ${n}-checkbox + span`]: {
        position: "relative",
        zIndex: "auto",
        minHeight: c,
        margin: 0,
        padding: `0 ${t.paddingXS / 2}px`,
        color: "inherit",
        lineHeight: `${c}px`,
        background: "transparent",
        borderRadius: t.borderRadius,
        cursor: "pointer",
        transition: `all ${t.motionDurationMid}, border 0s, line-height 0s, box-shadow 0s`,
        "&:hover": {
          backgroundColor: t.controlItemBgHover
        },
        [`&${n}-node-selected`]: {
          backgroundColor: t.controlItemBgActive
        },
        // Icon
        [`${n}-iconEle`]: {
          display: "inline-block",
          width: c,
          height: c,
          lineHeight: `${c}px`,
          textAlign: "center",
          verticalAlign: "top",
          "&:empty": {
            display: "none"
          }
        }
      },
      // https://github.com/ant-design/ant-design/issues/28217
      [`${n}-unselectable ${n}-node-content-wrapper:hover`]: {
        backgroundColor: "transparent"
      },
      // ==================== Draggable =====================
      [`${n}-node-content-wrapper`]: w({
        lineHeight: `${c}px`,
        userSelect: "none"
      }, ao(e, t)),
      [`${o}.drop-container`]: {
        "> [draggable]": {
          boxShadow: `0 0 0 2px ${t.colorPrimary}`
        }
      },
      // ==================== Show Line =====================
      "&-show-line": {
        // ================ Indent lines ================
        [`${n}-indent`]: {
          "&-unit": {
            position: "relative",
            height: "100%",
            "&:before": {
              position: "absolute",
              top: 0,
              insetInlineEnd: c / 2,
              bottom: -l,
              borderInlineEnd: `1px solid ${t.colorBorder}`,
              content: '""'
            },
            "&-end": {
              "&:before": {
                display: "none"
              }
            }
          }
        },
        // ============== Cover Background ==============
        [`${n}-switcher`]: {
          background: "transparent",
          "&-line-icon": {
            // https://github.com/ant-design/ant-design/issues/32813
            verticalAlign: "-0.15em"
          }
        }
      },
      [`${o}-leaf-last`]: {
        [`${n}-switcher`]: {
          "&-leaf-line": {
            "&:before": {
              top: "auto !important",
              bottom: "auto !important",
              height: `${c / 2}px !important`
            }
          }
        }
      }
    })
  };
}, so = (e) => {
  const {
    treeCls: t,
    treeNodeCls: n,
    treeNodePadding: o
  } = e;
  return {
    [`${t}${t}-directory`]: {
      // ================== TreeNode ==================
      [n]: {
        position: "relative",
        // Hover color
        "&:before": {
          position: "absolute",
          top: 0,
          insetInlineEnd: 0,
          bottom: o,
          insetInlineStart: 0,
          transition: `background-color ${e.motionDurationMid}`,
          content: '""',
          pointerEvents: "none"
        },
        "&:hover": {
          "&:before": {
            background: e.controlItemBgHover
          }
        },
        // Elements
        "> *": {
          zIndex: 1
        },
        // >>> Switcher
        [`${t}-switcher`]: {
          transition: `color ${e.motionDurationMid}`
        },
        // >>> Title
        [`${t}-node-content-wrapper`]: {
          borderRadius: 0,
          userSelect: "none",
          "&:hover": {
            background: "transparent"
          },
          [`&${t}-node-selected`]: {
            color: e.colorTextLightSolid,
            background: "transparent"
          }
        },
        // ============= Selected =============
        "&-selected": {
          "\n            &:hover::before,\n            &::before\n          ": {
            background: e.colorPrimary
          },
          // >>> Switcher
          [`${t}-switcher`]: {
            color: e.colorTextLightSolid
          },
          // >>> Title
          [`${t}-node-content-wrapper`]: {
            color: e.colorTextLightSolid,
            background: "transparent"
          }
        }
      }
    }
  };
}, ro = (e, t) => {
  const n = `.${e}`, o = `${n}-treenode`, l = t.paddingXS / 2, c = t.controlHeightSM, i = hn(t, {
    treeCls: n,
    treeNodeCls: o,
    treeNodePadding: l,
    treeTitleHeight: c
  });
  return [
    // Basic
    io(e, i),
    // Directory
    so(i)
  ];
}, yo = fn("Tree", (e, t) => {
  let {
    prefixCls: n
  } = t;
  return [{
    [e.componentCls]: $n(`${n}-checkbox`, e)
  }, ro(n, e), vn(e)];
});
export {
  ho as T,
  mt as V,
  ro as g,
  go as r,
  Wn as t,
  yo as u
};
