import{o as e,t}from"./vue.runtime.esm-BGP6PPFT.js";import{a as n,i as r,l as i,n as a,r as o,s,t as c}from"./_plugin-vue2_normalizer-Vm4EDAeQ.js";import{$ as l,Ct as u,Fn as d,Jt as f,Y as p,q as m,t as h}from"./lib-DqsS17DW.js";import{P as g}from"./index-DzPaEMae.js";h(),e();var _=class extends t{inputValue;resetValue;label;rules;disabled;locked;loading;min;max;overridable;step;form;onValue(e){this.hasFocus||(this.currentValue=e.toString())}onCurrentValue(e){let t=+e;Number.isNaN(t)||(this.checkOverride(t),this.sliderValue=t)}onSliderValue(e){this.hasFocus||(this.currentValue=e.toString()),this.$emit(`input`,e)}onLocked(e){this.internalLocked=e}onMax(){this.checkOverride(this.sliderValue)}currentValue=``;sliderValue=0;internalLocked=!1;internalMax=0;overridden=!1;hasFocus=!1;get textRules(){let e=[...this.rules||[],this.$rules.required,this.$rules.numberValid,this.$rules.numberGreaterThanOrEqual(this.min)];return this.overridable||e.push(this.$rules.numberLessThanOrEqual(this.max)),e}checkOverride(e){e>this.max&&this.overridable?(this.overridden=!0,this.internalMax=e):(this.overridden=!1,this.internalMax=this.max)}submitValue(e){this.form.validate()&&(this.currentValue=e.toString(),this.internalLocked=this.locked,this.$emit(`submit`,e))}handleReset(){this.resetValue!==void 0&&(this.$emit(`change`,this.resetValue),this.submitValue(this.resetValue))}handleFocus(e){this.hasFocus=!0,e.target instanceof HTMLInputElement&&e.target.select()}handleBlur(){this.hasFocus&&=(this.$emit(`change`,this.currentValue),this.currentValue=this.inputValue.toString(),!1)}handleSubmit(e){this.submitValue(e)}handleStart(e){this.hasFocus=!1,this.$emit(`start`,e)}handleEnd(e){this.$emit(`end`,e)}handleChange(e){this.$emit(`change`,e),this.submitValue(e)}created(){this.currentValue=this.inputValue.toString(),this.sliderValue=this.inputValue,this.internalLocked=this.locked,this.internalMax=this.max}};a([r({type:Number,required:!0})],_.prototype,`inputValue`,void 0),a([s({type:Number})],_.prototype,`resetValue`,void 0),a([s({type:String,required:!0})],_.prototype,`label`,void 0),a([s({type:Array})],_.prototype,`rules`,void 0),a([s({type:Boolean})],_.prototype,`disabled`,void 0),a([s({type:Boolean})],_.prototype,`locked`,void 0),a([s({type:Boolean})],_.prototype,`loading`,void 0),a([s({type:Number,default:0})],_.prototype,`min`,void 0),a([s({type:Number,default:100})],_.prototype,`max`,void 0),a([s({type:Boolean})],_.prototype,`overridable`,void 0),a([s({type:Number,default:1})],_.prototype,`step`,void 0),a([n(`form`)],_.prototype,`form`,void 0),a([o(`value`)],_.prototype,`onValue`,null),a([o(`currentValue`)],_.prototype,`onCurrentValue`,null),a([o(`sliderValue`)],_.prototype,`onSliderValue`,null),a([o(`locked`)],_.prototype,`onLocked`,null),a([o(`max`)],_.prototype,`onMax`,null),_=a([i({inheritAttrs:!1})],_);var v=c(_,function(){var e=this,t=e._self._c;return e._self._setupProxy,t(l,{ref:`form`,staticClass:`flex`,on:{submit:function(e){e.preventDefault()}}},[t(m,{attrs:{"no-gutters":``}},[t(p,{directives:[{name:`safe-html`,rawName:`v-safe-html`,value:e.label,expression:`label`}],staticClass:`text-body-1`,class:{"text--disabled":e.disabled},attrs:{cols:`12`,sm:`5`,"align-self":`center`}}),t(p,[t(f,e._b({staticClass:`v-input--text-right`,attrs:{rules:e.textRules,disabled:e.disabled||e.loading,step:e.step,type:`number`,dense:``,"single-line":``,outlined:``,"hide-details":``},on:{focus:e.handleFocus,blur:e.handleBlur,keyup:function(t){return!t.type.indexOf(`key`)&&e._k(t.keyCode,`enter`,13,t.key,`Enter`)||t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:e.handleSubmit(+e.currentValue)}},scopedSlots:e._u([{key:`prepend`,fn:function(){return[e.resetValue===void 0?e._e():t(g,{staticStyle:{"margin-top":`-4px`},attrs:{disabled:e.disabled||e.loading,icon:``,small:``},on:{click:e.handleReset}},[t(d,{attrs:{small:``}},[e._v(` $reset `)])],1)]},proxy:!0}]),model:{value:e.currentValue,callback:function(t){e.currentValue=t},expression:`currentValue`}},`v-text-field`,e.$attrs,!1))],1)],1),t(u,{attrs:{min:e.min,max:e.internalMax,step:e.step,disabled:e.disabled||e.loading||e.internalLocked||e.overridden,dense:``,"hide-details":``},on:{start:e.handleStart,end:e.handleEnd,change:e.handleChange},scopedSlots:e._u([{key:`prepend`,fn:function(){return[e.locked?t(g,{attrs:{icon:``,small:``,disabled:e.disabled||e.loading||e.overridden},on:{click:function(t){e.internalLocked=!e.internalLocked}}},[t(d,{attrs:{small:``}},[e._v(` `+e._s(e.internalLocked?`$lock`:`$lockReset`)+` `)])],1):e._e()]},proxy:!0}]),model:{value:e.sliderValue,callback:function(t){e.sliderValue=t},expression:`sliderValue`}})],1)},[],!1,null,null,null,null).exports;export{v as t};