import{d as v,m as h,g as S,r as n,h as g,i as x,o as w,b as y,f as a,j as k,k as R,v as b,l as V,n as f,u as $,t as p}from"./Dih1Xbo1.js";const M={relative:"",flex:"~ items-center gap2"},_={relative:"","w-full":""},D=v({inheritAttrs:!1,__name:"InputWithSuffix",props:h({placeholderSuffix:{default:".md"},hideSuffixRegex:{default:"\\."}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(r,{expose:d}){const i=r,s=S(r,"modelValue"),t=n(),l=n(),o=n({});g(s,()=>{if(!l.value)return{};if(i.hideSuffixRegex&&new RegExp(i.hideSuffixRegex).test(s.value)){o.value={display:"none"};return}o.value={left:`${l.value.offsetWidth}px`}},{flush:"post"});function c(){t.value&&t.value.focus()}return d({focus:c}),(e,u)=>(w(),x("div",M,[y(e.$slots,"before"),a("div",_,[k(a("input",R(e.$attrs,{ref_key:"inputRef",ref:t,"onUpdate:modelValue":u[0]||(u[0]=m=>s.value=m)}),null,16),[[b,s.value]]),a("span",{class:f([e.$attrs.class,"absolute op50 pointer-events-none select-none w-auto!"]),style:V($(o))},p(e.placeholderSuffix),7),a("span",{ref_key:"fakeSpan",ref:l,class:f([e.$attrs.class,"absolute whitespace-nowrap w-auto! left-0 invisible"])},p(s.value.replaceAll(" "," ")),3)])]))}});export{D as _};
