import{o as e,t}from"./vue.runtime.esm-uXCn7sOw.js";import{i as n,n as r,o as i,t as a}from"./_plugin-vue2_normalizer-BwvlkTga.js";import{$ as o,Ct as s,Fn as c,Jt as l,Y as u,q as d,t as f}from"./lib-BPv9EiKI.js";import{n as p,t as m}from"./Watch-BsFMHUzZ.js";import{t as h}from"./VModel-EJJ5Ow2-.js";import{t as g}from"./AppBtn-CrmEnE1u.js";f(),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}};r([h({type:Number,required:!0})],_.prototype,`inputValue`,void 0),r([n({type:Number})],_.prototype,`resetValue`,void 0),r([n({type:String,required:!0})],_.prototype,`label`,void 0),r([n({type:Array})],_.prototype,`rules`,void 0),r([n({type:Boolean})],_.prototype,`disabled`,void 0),r([n({type:Boolean})],_.prototype,`locked`,void 0),r([n({type:Boolean})],_.prototype,`loading`,void 0),r([n({type:Number,default:0})],_.prototype,`min`,void 0),r([n({type:Number,default:100})],_.prototype,`max`,void 0),r([n({type:Boolean})],_.prototype,`overridable`,void 0),r([n({type:Number,default:1})],_.prototype,`step`,void 0),r([p(`form`)],_.prototype,`form`,void 0),r([m(`value`)],_.prototype,`onValue`,null),r([m(`currentValue`)],_.prototype,`onCurrentValue`,null),r([m(`sliderValue`)],_.prototype,`onSliderValue`,null),r([m(`locked`)],_.prototype,`onLocked`,null),r([m(`max`)],_.prototype,`onMax`,null),_=r([i({inheritAttrs:!1})],_);var v=a(_,function(){var e=this,t=e._self._c;return e._self._setupProxy,t(o,{ref:`form`,staticClass:`flex`,on:{submit:function(e){e.preventDefault()}}},[t(d,{attrs:{"no-gutters":``}},[t(u,{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(u,[t(l,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(c,{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(s,{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(c,{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};