import{computed as j}from"vue";import{toArray as y}from"../utils/commonUtil.mjs";import{injectPropsWithOption as C}from"../utils/valueUtil.mjs";function p(o,u){return y(o).join("").toUpperCase().includes(u)}const g=(o,u,O,V,b)=>j(()=>{const t=O.value,f=b?.value,s=V?.value;if(!t||s===!1)return o.value;const{options:n,label:h,value:m}=u.value,l=[],d=typeof s=="function",i=t.toUpperCase(),a=d?s:(e,r)=>f?p(r[f],i):r[n]?p(r[h!=="children"?h:"label"],i):p(r[m],i),c=d?e=>C(e):e=>e;return o.value.forEach(e=>{if(e[n]){if(a(t,c(e)))l.push(e);else{const v=e[n].filter(F=>a(t,c(F)));v.length&&l.push({...e,[n]:v})}return}a(t,c(e))&&l.push(e)}),l});export{g as default};
