import{C as e,Dt as t,I as n,It as r,O as i,Q as a,S as o,T as s,Wt as c,a as l,bt as u,cn as d,j as f,k as p,lt as m,mt as h,ot as g,p as _,rn as v,tt as y,w as b,x}from"./_plugin-vue_export-helper-BVhEvvHC.js";import{At as S,Nt as C}from"./src-CD6Jsigc.js";import{t as w}from"./ChevronDownIcon-DodQi470.js";n();function T(e,t){return a(),s(`svg`,{width:`15`,height:`15`,viewBox:`0 0 15 15`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},[o(`path`,{"fill-rule":`evenodd`,"clip-rule":`evenodd`,d:`M3.13523 8.84197C3.3241 9.04343 3.64052 9.05363 3.84197 8.86477L7.5 5.43536L11.158 8.86477C11.3595 9.05363 11.6759 9.04343 11.8648 8.84197C12.0536 8.64051 12.0434 8.32409 11.842 8.13523L7.84197 4.38523C7.64964 4.20492 7.35036 4.20492 7.15803 4.38523L3.15803 8.13523C2.95657 8.32409 2.94637 8.64051 3.13523 8.84197Z`,fill:`currentColor`})])}n(),c(),u(),l();var E={class:`flex flex-col gap-2`},D={key:1,class:`relative flex flex-row gap-6 z-1`},O={key:0,class:`absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground`},k={class:`absolute inset-y-0 right-0 flex flex-row items-stretch`},A={key:0,class:`flex items-center pl-1.5 pr-1 text-sm text-muted-foreground select-none`},j={class:`flex flex-col border-l border-border`},M=[`disabled`],N=[`disabled`],P=f({__name:`NumberValueInput`,props:{title:{default:()=>void 0},unit:{default:``},value:{default:0},min:{default:()=>void 0},max:{default:()=>void 0},step:{default:1},ariaLabel:{default:()=>void 0},id:{default:()=>void 0},allowEmpty:{type:Boolean,default:!1},placeholder:{default:()=>void 0}},emits:[`update:value`],setup(n,{emit:c}){let l=t(n.value===null?``:n.value.toString()),u=c,f=g(),P=x(()=>n.id??f);m(()=>n.value,e=>{if(e===null){l.value!==``&&(l.value=``);return}parseFloat(l.value)!==e&&(l.value=e.toString())});function F(e){return n.min!==void 0&&e<n.min?n.min:n.max!==void 0&&e>n.max?n.max:e}function I(){if(n.allowEmpty&&l.value.trim()===``){u(`update:value`,null);return}let e=parseFloat(l.value);if(!isNaN(e)){let t=F(e);l.value=t.toString(),u(`update:value`,t);return}l.value=n.value===null?``:n.value.toString()}let L=x(()=>n.max!==void 0&&n.value!==null&&n.value>=n.max),R=x(()=>n.min!==void 0&&n.value!==null&&n.value<=n.min);function z(e){let t=parseFloat(l.value),r=F((isNaN(t)?(n.value??n.min??0)-e*n.step:t)+e*n.step);l.value=r.toString(),u(`update:value`,r)}return(t,c)=>(a(),s(`div`,E,[n.title?(a(),e(r(C),{key:0,for:P.value,class:`font-normal text-text`},{default:h(()=>[i(d(n.title),1)]),_:1},8,[`for`])):b(``,!0),l.value===void 0?b(``,!0):(a(),s(`div`,D,[p(r(S),{class:v([`w-full pr-10`,`[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`,{"pl-9":t.$slots.icon,"pl-3":!t.$slots.icon}]),id:P.value,modelValue:l.value,"onUpdate:modelValue":c[0]||=e=>l.value=e,onBlur:c[1]||=e=>I(),onKeyup:c[2]||=_(e=>I(),[`enter`]),type:`number`,min:n.min,max:n.max,step:n.step,"aria-label":n.ariaLabel,placeholder:n.placeholder},null,8,[`class`,`id`,`modelValue`,`min`,`max`,`step`,`aria-label`,`placeholder`]),t.$slots.icon?(a(),s(`div`,O,[y(t.$slots,`icon`)])):b(``,!0),o(`div`,k,[n.unit===``?b(``,!0):(a(),s(`span`,A,d(n.unit),1)),o(`div`,j,[o(`button`,{type:`button`,onClick:c[3]||=e=>z(1),disabled:L.value,class:`flex flex-1 items-center justify-center w-6 text-muted-foreground hover:text-text hover:bg-accent transition-colors rounded-tr-md focus-visible:outline-none disabled:pointer-events-none disabled:opacity-40`},[p(r(T),{class:`h-3 w-3`})],8,M),c[5]||=o(`div`,{class:`border-t border-border`},null,-1),o(`button`,{type:`button`,onClick:c[4]||=e=>z(-1),disabled:R.value,class:`flex flex-1 items-center justify-center w-6 text-muted-foreground hover:text-text hover:bg-accent transition-colors rounded-br-md focus-visible:outline-none disabled:pointer-events-none disabled:opacity-40`},[p(r(w),{class:`h-3 w-3`})],8,N)])])]))]))}});export{P as t};