function g(e){const{selectionStart:t}=e;return e.value.slice(0,t)}function h(e,t=""){return(Array.isArray(t)?t:[t]).reduce((c,r)=>{const o=e.lastIndexOf(r);return o>c.location?{location:o,prefix:r}:c},{location:-1,prefix:""})}function u(e){return(e||"").toLowerCase()}function f(e,t,i){const c=e[0];if(!c||c===i)return e;let r=e;const o=t.length;for(let n=0;n<o;n+=1)if(u(r[n])!==u(t[n])){r=r.slice(n);break}else n===o-1&&(r=r.slice(o));return r}function x(e,t){const{measureLocation:i,prefix:c,targetText:r,selectionStart:o,split:n}=t;let s=e.slice(0,i);s[s.length-n.length]===n&&(s=s.slice(0,s.length-n.length)),s&&(s=`${s}${n}`);let l=f(e.slice(o),r.slice(o-i-c.length),n);l.slice(0,n.length)===n&&(l=l.slice(n.length));const a=`${s}${c}${r}${n}`;return{text:`${a}${l}`,selectionLocation:a.length}}function d(e,t){e.setSelectionRange(t,t),e.blur(),e.focus()}function L(e,t){const{split:i}=t;return!i||!e.includes(i)}function $(e,{value:t=""}){const i=e.toLowerCase();return t.toLowerCase().includes(i)}export{$ as filterOption,g as getBeforeSelectionText,h as getLastMeasureIndex,x as replaceWithMeasure,d as setInputSelection,L as validateSearch};
