System.register([],function(_export,_context){"use strict";var t,a,n,o,e,s,u,h,c,l;return{setters:[],execute:function execute(){t=function t(_t,a){return Math.max(0,Math.min(a,_t.width))/_t.width*100;},a=function a(t,_a){var n=_a.minValue+t/100*(_a.maxValue-_a.minValue);return _a.maxValue-_a.minValue<1?parseFloat(n.toFixed(2)):Math.floor(n);},_export("v",n=function n(t,a){return(t-a.minValue)/(a.maxValue-a.minValue)*100;}),_export("h",o=function o(n,_o,e){var s=n.clientX-_o.left,u=t(_o,s);e.value=a(u,e),e.emit("nile-change",{value:e.value}),e.buttonOne.style.left="".concat(u,"%"),e.completed.style.width="".concat(u,"%");}),_export("a",e=function e(n,o,_e){var s=n.clientX-o.left,u=t(o,s);_e.rangeOneValue=a(u,_e),_e.rangeOneValue=Math.min(_e.rangeOneValue,_e.rangeTwoValue),_e.emit("nile-button-first-change",{value:_e.rangeOneValue}),_e.rangeTwoValue>_e.rangeOneValue&&(_e.buttonOne.style.left="".concat(u,"%"));}),_export("b",s=function s(n,o,e){var s=n.clientX-o.left,u=t(o,s);e.rangeTwoValue=a(u,e),e.rangeTwoValue=Math.max(e.rangeTwoValue,e.rangeOneValue),e.emit("nile-button-last-change",{value:e.rangeTwoValue}),e.rangeTwoValue>e.rangeOneValue&&(e.buttonTwo.style.left="".concat(u,"%"));}),_export("g",u=function u(t){var _t$buttonOne,_t$buttonTwo;t.range=t.renderRoot.querySelector(".range"),t.buttonOne=t.renderRoot.querySelector(".range-button"),t.buttonTwo=t.renderRoot.querySelector(".range-button-two"),t.completed=t.renderRoot.querySelector(".range-completed"),t.range.addEventListener("mousedown",t.onMouseDown),(_t$buttonOne=t.buttonOne)!==null&&_t$buttonOne!==void 0&&_t$buttonOne.addEventListener("mousedown",function(){t.activeThumb="one",h(t);}),(_t$buttonTwo=t.buttonTwo)===null||_t$buttonTwo===void 0?void 0:_t$buttonTwo.addEventListener("mousedown",function(){t.activeThumb="two",h(t);});}),_export("c",h=function h(t){window.addEventListener("mousemove",t.onMouseMove),window.addEventListener("mouseup",t.onMouseUp);}),_export("r",c=function c(t){window.removeEventListener("mousemove",t.onMouseMove),window.removeEventListener("mouseup",t.onMouseUp);}),_export("d",l=function l(t,a){if(Math.abs(t-a.rangeOneValue)<=Math.abs(t-a.rangeTwoValue)){var _n=Math.min(t,a.rangeTwoValue);a.rangeOneValue=a.checkValueValidity(_n,a.minValue,a.maxValue);}else{var _n2=Math.max(t,a.rangeOneValue);a.rangeTwoValue=a.checkValueValidity(_n2,a.minValue,a.maxValue);}var o=n(a.rangeOneValue,a),e=n(a.rangeTwoValue,a);a.buttonOne.style.left="".concat(o,"%"),a.buttonTwo.style.left="".concat(e,"%");var s=Math.min(o,e),u=Math.abs(e-o);a.completed.style.left="".concat(s,"%"),a.completed.style.width="".concat(u,"%"),a.emit("nile-button-first-change",{value:a.rangeOneValue}),a.emit("nile-button-last-change",{value:a.rangeTwoValue});});}};});
//# sourceMappingURL=nile-slider.utils.cjs.js.map
