import{computed as g}from"vue";const f="__rc_cascader_search_mark__",C=(t,l,{label:e})=>l.some(c=>String(c[e]).toLowerCase().includes(t.toLowerCase())),m=({path:t,fieldNames:l})=>t.map(e=>e[l.label]).join(" / "),R=(t,l,e,c,h,p)=>g(()=>{const{filter:_=C,render:b=m,limit:u=50,sort:o}=h.value,r=[];if(!t.value)return[];function d(i,s){i.forEach(n=>{if(!o&&u>0&&r.length>=u)return;const a=[...s,n],v=n[e.value.children];(!v||v.length===0||p.value)&&_(t.value,a,{label:e.value.label})&&r.push({...n,[e.value.label]:b({inputValue:t.value,path:a,prefixCls:c.value,fieldNames:e.value}),[f]:a}),v&&d(n[e.value.children],a)})}return d(l.value,[]),o&&r.sort((i,s)=>o(i[f],s[f],t.value,e.value)),u>0?r.slice(0,u):r});export{f as SEARCH_MARK,R as default};
