text: !function(){"use strict";function t(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s=function(){function t(t,i){for(var s=0;s<i.length;s++){var e=i[s];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,e.key,e)}}return function(i,s,e){return s&&t(i.prototype,s),e&&t(i,e),i}}(),e=function(){function e(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t(this,e),i&&("DIV"===i.nodeName||"DIV"===i.tagName)){this.options={isOneWay:null,isDate:null,overlap:null,callbackFunction:null,min:null,max:null,start:null,end:null};var n=!1;s.isOneWay&&(s.isOneWay=!1,s.overlap=!0,s.start&&!s.end&&(s.end=s.start),s.start=null,n=!0),this.init(s),this.topics={start:[],moving:[],stop:[]},this.UI={slider:null,handleLeft:null,handleRight:null,fill:null};var o=document.createElement("div");o.className=n?"slider one-way":"slider",this.UI.slider=o;var a=document.createElement("div");a.className="handle handle-left";var l=document.createElement("div");l.className="slider-circle",a.appendChild(l),this.UI.handleLeft=a,this.UI.slider.appendChild(this.UI.handleLeft);var h=document.createElement("div");h.className="handle handle-right";var r=document.createElement("div");r.className="slider-circle",h.appendChild(r),this.UI.handleRight=h,this.UI.slider.appendChild(this.UI.handleRight);var d=document.createElement("div");d.className="slider-fill",this.UI.fill=d,this.UI.slider.appendChild(this.UI.fill),i.appendChild(this.UI.slider),this.UI.handleLeft.style.marginLeft="-"+a.offsetWidth/2+"px",this.UI.handleRight.style.marginRight="-"+h.offsetWidth/2+"px";var p={left:this.options.start,right:this.options.end};this.move.bind(this)(p,!0),this.startingHandler=this.starting.bind(this),this.UI.handleLeft.onmousedown=this.startingHandler,this.UI.handleLeft.ontouchstart=this.startingHandler,this.UI.handleRight.onmousedown=this.startingHandler,this.UI.handleRight.ontouchstart=this.startingHandler}}return s(e,[{key:"extend",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s={},e=void 0;for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&(s[e]=t[e]);for(e in i)Object.prototype.hasOwnProperty.call(i,e)&&(s[e]=i[e]);return s}},{key:"init",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options="object"===("undefined"==typeof t?"undefined":i(t))?this.extend(this.defaultOptions,t):this.defaultOptions,!this.options.start&&isNaN(this.options.start)&&(this.options.start=this.options.min),!this.options.end&&isNaN(this.options.end)&&(this.options.end=this.options.max),this.options.isDate?(this.options.max=new Date(this.options.max).valueOf(),this.options.min=new Date(this.options.min).valueOf(),this.options.max<this.options.min&&(this.options.min=this.options.max),"undefined"!=typeof this.options.start&&"undefined"!=typeof this.options.end&&this.options.start<=this.options.end&&new Date(this.options.start).valueOf()>=this.options.min&&new Date(this.options.end).valueOf()<=this.options.max?(this.options.start=new Date(this.options.start).valueOf(),this.options.end=new Date(this.options.end).valueOf()):(this.options.start=new Date(this.options.min).valueOf(),this.options.end=new Date(this.options.max).valueOf())):(this.options.max=parseFloat(this.options.max),this.options.min=parseFloat(this.options.min),this.options.max<this.options.min&&(this.options.min=this.options.max),"undefined"!=typeof this.options.start&&"undefined"!=typeof this.options.end&&this.options.start<=this.options.end&&this.options.start>=this.options.min&&this.options.end<=this.options.max?(this.options.start=parseFloat(this.options.start),this.options.end=parseFloat(this.options.end)):(this.options.start=this.options.min,this.options.end=this.options.max))}},{key:"getInfo",value:function(){var t={},i=this.options.max-this.options.min,s=this.UI.fill.style.left?parseFloat(this.UI.fill.style.left.replace("%","")):0,e=this.UI.fill.style.right?parseFloat(this.UI.fill.style.right.replace("%","")):0,n=100===s?this.options.max:this.options.min+s/100*i,o=100===e?this.options.min:this.options.max-e/100*i;return t=this.options.isDate?{left:new Date(n),right:new Date(o)}:{left:n,right:o},"function"==typeof this.options.callbackFunction&&(t.left=this._applyCallback_(t.left,this.options.callbackFunction),t.right=this._applyCallback_(t.right,this.options.callbackFunction)),t}},{key:"_applyCallback_",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;try{return i?i.call(void 0,t):null}catch(s){throw s}}},{key:"starting",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(t&&!this.isDisabled){var i=0,s=0;for(this.dragObj={},this.dragObj.elNode=t.target;!this.dragObj.elNode.classList.contains("handle");)this.dragObj.elNode=this.dragObj.elNode.parentNode;this.dragObj.dir=this.dragObj.elNode.classList.contains("handle-left")?"left":"right",i=("undefined"!=typeof t.clientX?t.clientX:t.touches[0].pageX)+(window.scrollX||window.pageXOffset),s=("undefined"!=typeof t.clientY?t.clientY:t.touches[0].pageY)+(window.scrollY||window.pageYOffset),this.dragObj.cursorStartX=i,this.dragObj.cursorStartY=s,this.dragObj.elStartLeft=parseFloat(this.dragObj.elNode.style.left),this.dragObj.elStartRight=parseFloat(this.dragObj.elNode.style.right),isNaN(this.dragObj.elStartLeft)&&(this.dragObj.elStartLeft=0),isNaN(this.dragObj.elStartRight)&&(this.dragObj.elStartRight=0),this.UI.handleLeft.classList.remove("ontop"),this.UI.handleRight.classList.remove("ontop"),this.dragObj.elNode.classList.add("ontop"),this.movingHandler=this.moving.bind(this),this.stopHandler=this.stop.bind(this),document.addEventListener("mousemove",this.movingHandler,!0),document.addEventListener("mouseup",this.stopHandler,!0),document.addEventListener("touchmove",this.movingHandler,!0),document.addEventListener("touchend",this.stopHandler,!0),this.stopDefault.bind(this)(t),this.UI.fill.classList.remove("slider-transition"),this.UI.handleLeft.classList.remove("slider-transition"),this.UI.handleRight.classList.remove("slider-transition"),this.publish("start",this.getInfo())}}},{key:"moving",value:function(t){var i=("undefined"!=typeof t.clientX?t.clientX:t.touches[0].pageX)+(window.scrollX||window.pageXOffset),s=this.UI.slider.offsetWidth,e=0;"left"===this.dragObj.dir?e=this.dragObj.elStartLeft+(i-this.dragObj.cursorStartX)/s*100:"right"===this.dragObj.dir&&(e=this.dragObj.elStartRight+(this.dragObj.cursorStartX-i)/s*100),0>e?e=0:e>100&&(e=100),e=Math.abs(e);var n=0;this.options.overlap||(n=this.UI.handleRight.offsetWidth/this.UI.slider.offsetWidth*100);var o=0;"left"===this.dragObj.dir?(o=100-n-this.UI.fill.style.right.replace("%",""),e>=o&&(e=o),this.dragObj.elNode.style.left=e+"%",this.UI.fill.style.left=e+"%"):(o=100-n-this.UI.fill.style.left.replace("%",""),e>=o&&(e=o),this.dragObj.elNode.style.right=e+"%",this.UI.fill.style.right=e+"%"),this.stopDefault.bind(this)(t),this.publish("moving",this.getInfo())}},{key:"stop",value:function(t){document.removeEventListener("mousemove",this.movingHandler,!0),document.removeEventListener("mouseup",this.stopHandler,!0),document.removeEventListener("touchmove",this.movingHandler,!0),document.removeEventListener("touchend",this.stopHandler,!0),this.stopDefault.bind(this)(t),this.publish("stop",this.getInfo())}},{key:"move",value:function(t,s){var e=t;this.UI.fill.classList.add("slider-transition"),this.UI.handleLeft.classList.add("slider-transition"),this.UI.handleRight.classList.add("slider-transition");var n=this.options.max-this.options.min;if("object"===("undefined"==typeof e?"undefined":i(e))){var o=!isNaN(parseFloat(e.left))&&isFinite(e.left),a=this.options.isDate&&!!e.left;if(a||o){e.left<this.options.min&&(e.left=this.options.min),e.left>this.options.max&&(e.left=this.options.max);var l=(e.left-this.options.min)/n*100;this.UI.handleLeft.style.left=l+"%",this.UI.fill.style.left=l+"%"}if(a=this.options.isDate&&!!e.right,o=!isNaN(parseFloat(e.right))&&isFinite(e.right),a||o){e.right<this.options.min&&(e.right=this.options.min),e.right>this.options.max&&(e.right=this.options.max);var h=(this.options.max-e.right)/n*100;this.UI.handleRight.style.right=h+"%",this.UI.fill.style.right=h+"%"}!this.options.overlap&&this.UI.handleLeft.offsetLeft+this.UI.handleLeft.offsetWidth>this.UI.handleRight.offsetLeft-1&&(this.UI.fill.style.left="0%",this.UI.fill.style.right="0%",this.UI.handleLeft.style.left="0%",this.UI.handleRight.style.right="0%")}else if(!isNaN(e)){e<this.options.min&&(e=this.options.min),e>this.options.max&&(e=this.options.max);var r=(e-this.options.min)/n*100;this.UI.handleLeft.style.left=r+"%",this.UI.fill.style.left="0%",this.UI.fill.style.right=100-r+"%"}s||this.publish("moving",this.getInfo())}},{key:"stopDefault",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;t&&t.preventDefault()}},{key:"disable",value:function(t){this.isDisabled=t,this.isDisabled?this.UI.slider.classList.add("slider-disabled"):this.UI.slider.classList.remove("slider-disabled")}},{key:"subscribe",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!t||!i)return{};if(!this.topics.hasOwnProperty.call(this.topics,t)||"string"!=typeof t||"function"!=typeof i)return{};var s=this.topics[t].push(i)-1;return{remove:function(){delete this.topics[t][s]}.bind(this)}}},{key:"publish",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;t&&i&&this.topics.hasOwnProperty.call(this.topics,t)&&"string"==typeof t&&this.topics[t].forEach(function(t){t(i)})}},{key:"defaultOptions",get:function(){return{isOneWay:!1,isDate:!1,overlap:!1,callbackFunction:null,min:0,max:100}}}]),e}();"undefined"!=typeof module&&"undefined"!=typeof module.exports?module.exports=e:window.Slider=e}();