import{br as e,a8 as t,aC as a,a as o,w as n,c4 as u,bv as l,u as i,n as s}from"./index-ip5gDR6L.js";import{i as r}from"./index-CHAf6FpU.js";function c(){if(!arguments.length)return[];var t=arguments[0];return e(t)?t:[t]}function d(e,{disabled:s,beforeFocus:c,afterFocus:d,beforeBlur:v,afterBlur:m}={}){const p=t(),{emit:f}=p,b=a(),g=o(!1),h=e=>{const t=!!l(c)&&c(e);i(s)||g.value||t||(g.value=!0,f("focus",e),null==d||d())},C=e=>{var t;const a=!!l(v)&&v(e);i(s)||e.relatedTarget&&(null==(t=b.value)?void 0:t.contains(e.relatedTarget))||a||(g.value=!1,f("blur",e),null==m||m())};return n([b,()=>i(s)],([e,t])=>{e&&(t?e.removeAttribute("tabindex"):e.setAttribute("tabindex","-1"))}),u(b,"focus",h,!0),u(b,"blur",C,!0),u(b,"click",t=>{var a,o;i(s)||r(t.target)||(null==(a=b.value)?void 0:a.contains(document.activeElement))&&b.value!==document.activeElement||null==(o=e.value)||o.focus()},!0),{isFocused:g,wrapperRef:b,handleFocus:h,handleBlur:C}}function v({afterComposition:e,emit:t}){const a=o(!1),n=e=>{var o;null==t||t("compositionupdate",e);const n=null==(o=e.target)?void 0:o.value,u=n[n.length-1]||"";a.value=!(e=>/([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(e))(u)},u=o=>{null==t||t("compositionend",o),a.value&&(a.value=!1,s(()=>e(o)))};return{isComposing:a,handleComposition:e=>{"compositionend"===e.type?u(e):n(e)},handleCompositionStart:e=>{null==t||t("compositionstart",e),a.value=!0},handleCompositionUpdate:n,handleCompositionEnd:u}}export{d as a,c,v as u};
