import{I as e,It as t,Q as n,S as r,T as i,Wt as a,a as o,bt as s,cn as c,j as l,k as u,m as d,mt as f,rn as p,t as m,w as h,x as g}from"./_plugin-vue_export-helper-BVhEvvHC.js";import{At as _,Un as v,Vn as y,ar as b}from"./src-CD6Jsigc.js";e(),s(),a(),o();var x={key:0,class:`absolute right-8 text-muted-foreground text-sm pointer-events-none flex items-center justify-center h-full px-2`},S={class:`absolute right-0 top-0 h-full flex flex-col border-l border-border overflow-hidden`},C=m(l({__name:`NumberInput`,props:{modelValue:{},min:{},max:{},step:{default:1},disabled:{type:Boolean},class:{},suffix:{},id:{},size:{default:`sm`}},emits:[`update:modelValue`,`commit`,`focus`,`blur`,`escape`],setup(e,{emit:a}){let o=e,s=a,l=g({get:()=>o.modelValue,set:e=>s(`update:modelValue`,e)});function m(e){let t=!!(e&&e.shiftKey),n=!!(e&&e.ctrlKey);return t&&n?50:t?5:n?10:1}function C(e){if(!e||!(e instanceof MouseEvent))return;let t=e.target||e.currentTarget;for(;t&&t.tagName!==`BUTTON`;)t=t.parentElement;t?.blur?.()}function w(e){if(o.disabled)return;e&&(e.preventDefault(),e.stopPropagation());let t=Number(o.modelValue)||0,n=m(e),r=t+o.step*n;o.max!==void 0&&r>o.max&&(r=o.max),o.min!==void 0&&r<o.min&&(r=o.min),s(`update:modelValue`,r),s(`commit`),C(e)}function T(e){if(o.disabled)return;e&&(e.preventDefault(),e.stopPropagation());let t=Number(o.modelValue)||0,n=m(e),r=t-o.step*n;o.min!==void 0&&r<o.min&&(r=o.min),o.max!==void 0&&r>o.max&&(r=o.max),s(`update:modelValue`,r),s(`commit`),C(e)}function E(e){let t=e.key;t===`ArrowUp`?(e.preventDefault(),e.stopPropagation(),w(e)):t===`ArrowDown`?(e.preventDefault(),e.stopPropagation(),T(e)):t===`PageUp`?(e.preventDefault(),e.stopPropagation(),w(e)):t===`PageDown`?(e.preventDefault(),e.stopPropagation(),T(e)):t===`Enter`?s(`commit`):t===`Escape`&&(e.preventDefault(),e.stopPropagation(),s(`escape`))}function D(){s(`commit`),s(`blur`)}function O(){s(`focus`)}return(a,s)=>(n(),i(`div`,{class:p([`relative flex items-center`,o.class])},[u(t(_),{id:e.id,type:`number`,modelValue:l.value,"onUpdate:modelValue":s[0]||=e=>l.value=e,min:e.min,max:e.max,step:e.step,disabled:e.disabled,class:p([`hide-spinners pr-8`,o.size===`sm`?`h-7 text-xs`:``]),onKeydown:E,onFocus:O,onBlur:D},null,8,[`id`,`modelValue`,`min`,`max`,`step`,`disabled`,`class`]),e.suffix?(n(),i(`div`,x,c(e.suffix),1)):h(``,!0),r(`div`,S,[u(t(b),{onMousedown:s[1]||=d(()=>{},[`prevent`]),type:`button`,variant:`ghost`,size:`icon`,class:`h-1/2 w-6 rounded-none rounded-tr-md px-0 py-0 hover:bg-accent hover:text-accent-foreground`,disabled:e.disabled||e.max!==void 0&&(Number(o.modelValue)||0)>=e.max,onClick:s[2]||=e=>w(e)},{default:f(()=>[u(t(y),{class:`h-3 w-3`})]),_:1},8,[`disabled`]),u(t(b),{onMousedown:s[3]||=d(()=>{},[`prevent`]),type:`button`,variant:`ghost`,size:`icon`,class:`h-1/2 w-6 rounded-none rounded-br-md px-0 py-0 border-t border-border hover:bg-accent hover:text-accent-foreground`,disabled:e.disabled||e.min!==void 0&&(Number(o.modelValue)||0)<=e.min,onClick:s[4]||=e=>T(e)},{default:f(()=>[u(t(v),{class:`h-3 w-3`})]),_:1},8,[`disabled`])])],2))}}),[[`__scopeId`,`data-v-61db2114`]]);export{C as t};