File "redux.jquery.nouislider.min.js"

Full Path: /home/siazco/grocery.siazco.se/wp-content/plugins/kapee-extensions/inc/admin/redux-core/assets/js/vendor/nouislider/redux.jquery.nouislider.min.js
File size: 10.44 KB
MIME-type: text/plain
Charset: utf-8

/*! $.noUiSlider
 @version 5.0.0
 @author Leon Gersen https://twitter.com/LeonGersen
 @license WTFPL http://www.wtfpl.net/about/
 @documentation http://refreshless.com/nouislider/
*/
!function(t){"use strict";var e="reduxNoUiSlider";if(t.zepto&&!t.fn.removeData)throw new ReferenceError("Zepto is loaded without the data module.");t.fn[e]=function(a,n){var r=t(document),o=t("body"),i=".nui",s=t.fn.val,d=["noUi-base","noUi-origin","noUi-handle","noUi-input","noUi-active","noUi-state-tap","noUi-target","-lower","-upper","noUi-connect","noUi-horizontal","noUi-vertical","noUi-background","noUi-stacking","noUi-block","noUi-state-blocked","noUi-ltr","noUi-rtl","noUi-dragable","noUi-extended","noUi-state-drag"],l=window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"};function c(t,e){return 100*e/(t[1]-t[0])}function u(e){return e instanceof t||t.zepto&&t.zepto.isZ(e)}function f(t){return!isNaN(parseFloat(t))&&isFinite(t)}function h(e,a){Array.isArray(e)||(e=[e]),t.each(e,function(){"function"==typeof this&&this.call(a)})}function p(t,e){return Math.round(t/e)*e}function g(t,e){return parseFloat(t.toFixed(e))}function v(e,a,n,r){var o=r.target;return e=e.replace(/\s/g,i+" ")+i,a.on(e,function(e){var a=o.attr("disabled");if(a=!(null==a),o.hasClass("noUi-state-tap")||a)return!1;n(function(e){e.preventDefault();var a,n,r=0===e.type.indexOf("touch"),o=0===e.type.indexOf("mouse"),i=0===e.type.indexOf("pointer"),s=e;return 0===e.type.indexOf("MSPointer")&&(i=!0),e.originalEvent&&(e=e.originalEvent),r&&(a=e.changedTouches[0].pageX,n=e.changedTouches[0].pageY),(o||i)&&(i||void 0!==window.pageXOffset||(window.pageXOffset=document.documentElement.scrollLeft,window.pageYOffset=document.documentElement.scrollTop),a=e.clientX+window.pageXOffset,n=e.clientY+window.pageYOffset),t.extend(s,{pointX:a,pointY:n,cursor:o})}(e),r,o.data("base").data("options"))})}function b(e){var a=this.target;if(void 0===e)return this.element.data("value");!0===e?e=this.element.data("value"):this.element.data("value",e),void 0!==e&&t.each(this.elements,function(){"function"==typeof this?this.call(a,e):this[0][this[1]](e)})}function m(e,a,n){if(u(a)){var r=[],o=e.data("target");return e.data("options").direction&&(n=n?0:1),a.each(function(){t(this).on("change"+i,function(e,a){return function(){var n=[null,null];n[a]=t(this).val(),e.val(n,!0)}}(o,n)),r.push([t(this),"val"])}),r}return"string"==typeof a&&(a=[t('<input type="hidden" name="'+a+'">').appendTo(e).addClass(d[3]).on("change",function(t){t.stopPropagation()}),"val"]),[a]}function w(e,a,n){var r=[];return t.each(n.to[a],function(t){r=r.concat(m(e,n.to[a][t],a))}),{element:e,elements:r,target:e.data("target"),val:b}}function y(t,e){var a,n=t.data("options");e=g(e,7),t.data("target").removeClass(d[14]),t.css(n.style,e+"%").data("pct",e),t.is(":first-child")&&t.toggleClass(d[13],e>50),n.direction&&(e=100-e),t.data("store").val(function(t,e){return t=t.toFixed(e.decimals),0===parseFloat(t)&&(t=t.replace("-0","0")),t.replace(".",e.serialization.mark)}((a=n.range,e*(a[1]-a[0])/100+a[0]),n))}function C(t,e){var a=t.data("base"),n=a.data("options"),r=a.data("handles"),o=0,i=100;return!!f(e)&&(n.step&&(e=p(e,n.step)),r.length>1&&(t[0]!==r[0][0]?o=g(r[0].data("pct")+n.margin,7):i=g(r[1].data("pct")-n.margin,7)),(e=Math.min(Math.max(e,o),i<0?100:i))===t.data("pct")?[o||!1,100!==i&&i]:(y(t,e),!0))}function U(t,e,a,n){t.addClass(d[5]),setTimeout(function(){t.removeClass(d[5])},300),C(e,a),h(n,t.data("target")),t.data("target").trigger("change")}function x(e,a,n){var r,o,i,s,l=a.handles,c=e[a.point]-a.start[a.point];if(c=100*c/a.size,1===l.length){if(!0!==(r=C(l[0],a.positions[0]+c)))return void(t.inArray(l[0].data("pct"),r)>=0&&(o=a.base,i=!n.margin,(s=o.data("target")).hasClass(d[14])||(i||(s.addClass(d[15]),setTimeout(function(){s.removeClass(d[15])},450)),s.addClass(d[14]),h(o.data("options").block,s))))}else{var u,f,g,v;if(n.step&&(c=p(c,n.step)),u=g=a.positions[0]+c,f=v=a.positions[1]+c,u<0?(f+=-1*u,u=0):f>100&&(u-=f-100,f=100),g<0&&!u&&!l[0].data("pct"))return;if(100===f&&v>100&&100===l[1].data("pct"))return;y(l[0],u),y(l[1],f)}h(n.slide,a.target)}function k(t,e,a){1===e.handles.length&&e.handles[0].data("grab").removeClass(d[4]),t.cursor&&o.css("cursor","").off(i),r.off(i),e.target.removeClass(d[14]+" "+d[20]).trigger("change"),h(a.set,e.target)}function z(e,a,n){1===a.handles.length&&a.handles[0].data("grab").addClass(d[4]),e.stopPropagation(),v(l.move,r,x,{start:e,base:a.base,target:a.target,handles:a.handles,positions:[a.handles[0].data("pct"),a.handles[a.handles.length-1].data("pct")],point:n.orientation?"pointY":"pointX",size:n.orientation?a.base.height():a.base.width()}),v(l.end,r,k,{target:a.target,handles:a.handles}),e.cursor&&(o.css("cursor",t(e.target).css("cursor")),a.handles.length>1&&a.target.addClass(d[20]),o.on("selectstart"+i,function(){return!1}))}function F(t,e,a){var n,r,o,i,s=e.base;t.stopPropagation(),a.orientation?(o=t.pointY,i=s.height()):(o=t.pointX,i=s.width()),n=function(t,e,a){if(1===t.length)return t[0];var n=t[0].offset()[a]+t[1].offset()[a];return t[e<n/2?0:1]}(s.data("handles"),o,a.style),r=100*(o-s.offset()[a.style])/i,U(s,n,r,[a.slide,a.set])}function E(t,e,a){var n,r,o=e.base.data("handles");n=(r=(r=a.orientation?t.pointY:t.pointX)<e.base.offset()[a.style])?0:100,r=r?0:o.length-1,U(e.base,o[r],n,[a.slide,a.set])}return t.fn.val=function(){return this.hasClass(d[6])?arguments.length?function(e,a){return Array.isArray(e)||(e=[e]),this.each(function(){var n,r,o,i,s=t(this).data("base"),d=Array.prototype.slice.call(s.data("handles"),0),l=s.data("options");for(d.length>1&&(d[2]=d[0]),l.direction&&e.reverse(),r=0;r<d.length;r++)null!=(n=e[r%2])&&("string"==typeof n&&(n=n.replace(",",".")),o=l.range,i=parseFloat(n),n=c(o,o[0]<0?i+Math.abs(o[0]):i-o[0]),l.direction&&(n=100-n),!0!==C(d[r],n)&&d[r].data("store").val(!0),!0===a&&h(l.set,t(this)))})}.apply(this,arguments):function(){var e=t(this).data("base"),a=[];return t.each(e.data("handles"),function(){a.push(t(this).data("store").val())}),1===a.length?a[0]:e.data("options").direction?a.reverse():a}.apply(this):s.apply(this,arguments)},(n?function(a){return this.each(function(){var n,r,o=t(this).val()||!1,s=t(this).data("options"),l=t.extend({},s,a);!1!==o&&(n=t(this),r=[[n,""]],t.each(n.data("base").data("handles"),function(){r=r.concat(t(this).data("store").elements)}),t.each(r,function(){this.length>1&&this[0].off(i)}),n.removeClass(d.join(" ")),n.empty().removeData("base options")),a&&(t(this)[e](l),!1!==o&&l.start===s.start&&t(this).val(o))})}:function(a){return this.data("options",t.extend(!0,{},a)),(a=t.extend({handles:2,margin:0,connect:!1,direction:"ltr",behaviour:"tap",orientation:"horizontal"},a)).serialization=a.serialization||{},function(a,n){function r(t){return 2===t.length&&!(!f((t=[parseFloat(t[0]),parseFloat(t[1])])[0])||!f(t[1]))&&!(t[1]<t[0])&&t}var o=function(t,e){switch(t){case 1:case.1:case.01:case.001:case 1e-4:case 1e-5:t=t.toString().split("."),e.decimals="1"===t[0]?0:t[1].length;break;case void 0:e.decimals=2;break;default:return!1}return!0},i=function(t,e,a){if(!t)return e[a].mark=".",!0;switch(t){case".":case",":return!0;default:return!1}},s=function(e,a,n){function r(t){return u(t)||"string"==typeof t||"function"==typeof t||!1===t||u(t[0])&&"function"==typeof t[0][t[1]]}if(e){var o,i;for(d=[[],[]],r(s=e)?d[0].push(s):t.each(s,function(t,e){t>1||(r(e)?d[t].push(e):d[t]=d[t].concat(e))}),e=d,a.direction&&e[1].length&&e.reverse(),o=0;o<a.handles;o++)for(i=0;i<e[o].length;i++){if(!r(e[o][i]))return!1;e[o][i]||e[o].splice(i,1)}a[n].to=e}else a[n].to=[[],[]];var s,d;return!0},d={handles:{r:!0,t:function(t){return 1===(t=parseInt(t,10))||2===t}},range:{r:!0,t:function(t,e,a){return e[a]=r(t),e[a]&&e[a][0]!==e[a][1]}},start:{r:!0,t:function(t,e,a){return 1===e.handles?(Array.isArray(t)&&(t=t[0]),t=parseFloat(t),e.start=[t],f(t)):(e[a]=r(t),!!e[a])}},connect:{r:!0,t:function(t,e,a){if("lower"===t)e[a]=1;else if("upper"===t)e[a]=2;else if(!0===t)e[a]=3;else{if(!1!==t)return!1;e[a]=0}return!0}},orientation:{t:function(t,e,a){switch(t){case"horizontal":e[a]=0;break;case"vertical":e[a]=1;break;default:return!1}return!0}},margin:{r:!0,t:function(t,e,a){return t=parseFloat(t),e[a]=c(e.range,t),f(t)}},direction:{r:!0,t:function(t,e,a){switch(t){case"ltr":e[a]=0;break;case"rtl":e[a]=1,e.connect=[0,2,1,3][e.connect];break;default:return!1}return!0}},behaviour:{r:!0,t:function(t,e,a){return e[a]={tap:t!==(t=t.replace("tap","")),extend:t!==(t=t.replace("extend","")),drag:t!==(t=t.replace("drag","")),fixed:t!==(t=t.replace("fixed",""))},!t.replace("none","").replace(/\-/g,"")}},serialization:{r:!0,t:function(t,e,a){return s(t.to,e,a)&&o(t.resolution,e)&&i(t.mark,e,a)}},slide:{t:function(t){return"function"==typeof t}},set:{t:function(t){return"function"==typeof t}},block:{t:function(t){return"function"==typeof t}},step:{t:function(t,e,a){return t=parseFloat(t),e[a]=c(e.range,t),f(t)}}};t.each(d,function(t,r){var o=a[t],i=void 0!==o;if(r.r&&!i||i&&!r.t(o,a,t))throw console&&console.log&&console.group&&(console.group("Invalid noUiSlider initialisation:"),console.log("Option:\t",t),console.log("Value:\t",o),console.log("Slider(s):\t",n),console.groupEnd()),new RangeError(e)})}(a,this),a.style=a.orientation?"top":"left",this.each(function(){var e,n,r,o=t(this),i=[],s=t("<div/>").appendTo(o);if(o.data("base"))throw new Error("Slider was already initialized.");for(o.data("base",s).addClass([d[6],d[16+a.direction],d[10+a.orientation]].join(" ")),e=0;e<a.handles;e++)(r=t("<div><div/></div>").appendTo(s)).addClass(d[1]),r.children().addClass([d[2],d[2]+d[7+a.direction+(a.direction?-1*e:e)]].join(" ")),r.data({base:s,target:o,options:a,grab:r.children(),pct:-1}).attr("data-style",a.style),r.data({store:w(r,e,a.serialization)}),i.push(r);switch(a.connect){case 1:o.addClass(d[9]),i[0].addClass(d[12]);break;case 3:i[1].addClass(d[12]);case 2:i[0].addClass(d[9]);case 0:o.addClass(d[12])}if(s.addClass(d[0]).data({target:o,options:a,handles:i}),o.val(a.start),!a.behaviour.fixed)for(e=0;e<i.length;e++)v(l.start,i[e].children(),z,{base:s,target:o,handles:[i[e]]});a.behaviour.tap&&v(l.start,s,F,{base:s,target:o}),a.behaviour.extend&&(o.addClass(d[19]),a.behaviour.tap&&v(l.start,o,E,{base:s,target:o})),a.behaviour.drag&&(n=s.find("."+d[9]).addClass(d[18]),a.behaviour.fixed&&(n=n.add(s.children().not(n).data("grab"))),v(l.start,n,z,{base:s,target:o,handles:i}))})}).call(this,a)}}(window.jQuery||window.Zepto);