import{cloneElement as e}from"../../_util/vnode.mjs";import{useInjectCascader as t}from"../context.mjs";import{isLeaf as n,toPathKey as r}from"../utils/commonUtil.mjs";import{SEARCH_MARK as i}from"../hooks/useSearchOptions.mjs";import a from"./Checkbox.mjs";import{createVNode as o}from"vue";var s=`__cascader_fix_label__`;function c({prefixCls:s,multiple:c,options:l,activeValue:u,prevValuePath:d,onToggleOpen:f,onSelect:p,onActive:m,checkedSet:h,halfCheckedSet:g,loadingKeys:_,isSelectable:v}){let y=`${s}-menu`,b=`${s}-menu-item`,{fieldNames:x,changeOnSelect:S,expandTrigger:C,expandIcon:w,loadingIcon:T,dropdownMenuColumnStyle:E,customSlots:D}=t(),O=w.value??D.value.expandIcon?.(),k=T.value??D.value.loadingIcon?.(),A=C.value===`hover`;return o(`ul`,{class:y,role:`menu`},[l.map(t=>{let{disabled:l}=t,y=t[i],C=t.__cascader_fix_label__??t[x.value.label],w=t[x.value.value],T=n(t,x.value),D=y?y.map(e=>e[x.value.value]):[...d,w],j=r(D),M=_.includes(j),N=h.has(j),P=g.has(j),F=()=>{!l&&(!A||!T)&&m(D)},I=()=>{v(t)&&p(D,T)},L;return typeof t.title==`string`?L=t.title:typeof C==`string`&&(L=C),o(`li`,{key:j,class:[b,{[`${b}-expand`]:!T,[`${b}-active`]:u===w,[`${b}-disabled`]:l,[`${b}-loading`]:M}],style:E.value,role:`menuitemcheckbox`,title:L,"aria-checked":N,"data-path-key":j,onClick:()=>{F(),(!c||T)&&I()},onDblclick:()=>{S.value&&f(!1)},onMouseenter:()=>{A&&F()},onMousedown:e=>{e.preventDefault()}},[c&&o(a,{prefixCls:`${s}-checkbox`,checked:N,halfChecked:P,disabled:l,onClick:e=>{e.stopPropagation(),I()}},null),o(`div`,{class:`${b}-content`},[C]),!M&&O&&!T&&o(`div`,{class:`${b}-expand-icon`},[e(O)]),M&&k&&o(`div`,{class:`${b}-loading-icon`},[e(k)])])})])}c.props=[`prefixCls`,`multiple`,`options`,`activeValue`,`prevValuePath`,`onToggleOpen`,`onSelect`,`onActive`,`checkedSet`,`halfCheckedSet`,`loadingKeys`,`isSelectable`],c.displayName=`Column`,c.inheritAttrs=!1;export{s as FIX_LABEL,c as default};