import{c as r,W as R,a as k}from"./chunk-ChHTQ4Sk.js";import{r as o,j as i}from"./chunk-CF7PZJR8.js";var y=k(["flex","gap-md","items-center","rounded-uk-sm","overflow-hidden","bg-bg-secondary"],{variants:{state:{default:["hover:bg-bg-secondary/80","has-[input:focus]:bg-bg-secondary"],disabled:["disabled:cursor-not-allowed","bg-bg-quaternary","text-text-secondary"],error:["hover:bg-danger-primary/10","bg-danger-primary/20"]},size:{sm:["h-6","text-uk-sm","rounded-[10px]","[&_.input-slot>svg:not([class*='size-'])]:size-3","px-sm"],md:["h-8","text-uk-md","rounded-[11px]","[&_.input-slot>svg:not([class*='size-'])]:size-4","px-md"],lg:["h-9","text-uk-lg","rounded-[12px]","[&_.input-slot>svg:not([class*='size-'])]:size-5","px-lg"]}},defaultVariants:{state:"default",size:"md"}}),I=o.forwardRef(function({style:e,className:s,side:n,children:a,disabled:d,state:f,size:m,type:l,inputClassName:x,...b},h){const c=o.useRef(null);return i.jsxs("div",{style:e,"data-input":!0,className:r(y({size:m,state:d?"disabled":f}),s),onClick:v=>{const p=v.target;if(p.closest("input, button, a"))return;const t=c.current;if(!t)return;const g=p.closest(`
            .input-slot[data-side='right'],
            .input-slot:not([data-side='right']) ~ .input-slot:not([data-side='left'])
          `)?t.value.length:0;requestAnimationFrame(()=>{try{t.setSelectionRange(g,g)}catch{}t.focus()})},children:[i.jsx("input",{spellCheck:"false",...b,type:l,"data-side":n,disabled:d,name:l??"text",ref:R(c,h),className:r(["w-full","h-full","outline-none","data-[side=right]:text-right","data-[side=center]:text-center","[input[type=number]]:font-number-input","[&::-webkit-inner-spin-button]:appearance-none","[&::-webkit-outer-spin-button]:appearance-none","disabled:cursor-not-allowed"],x)}),a]})}),S=o.forwardRef(function({className:u,children:e,side:s="left",...n},a){return i.jsx("div",{"data-side":s,...n,ref:a,className:r(["input-slot","cursor-text","shrink-0","order-[0]","text-text-tertiary","data-[side=left]:-order-1"],u),children:e})});export{I,S as a};
