xscroll-master.min.js 62 KB

12
  1. !function(){var t={},e={},n={},i={},r={},o={},s={},c={},a={},u={},l={},h={},f={},d={},p={},g={},v={};t=function(t){function e(){}function n(t,n){var i;return Object.create?i=Object.create(t):(e.prototype=t,i=new e),i.constructor=n,i}function i(t,e){if(t){if(t.nodeType)return[t];var e=e&&e.nodeType?e:document;return t&&"string"==typeof t?e.querySelectorAll(t):void 0}}for(var r=/\\?\{([^{}]+)\}/g,o="",s=/^[\s\xa0]+|[\s\xa0]+$/g,c=String.prototype.trim,a=c?function(t){return null==t?o:c.call(t)}:function(t){return null==t?o:(t+"").replace(s,o)},u=0,l=function(t){var e=t.offsetTop;return null!=t.offsetParent&&(e+=l(t.offsetParent)),e},h=function(t){var e=t.offsetLeft;return null!=t.offsetParent&&(e+=h(t.offsetParent)),e},f=({isObject:function(t){return t===Object(t)},isArray:Array.isArray||function(t){return"[object Array]"==toString.call(t)},isEmpty:function(t){if(null==t)return!0;if(this.isArray(t)||this.isString(t))return 0===t.length;for(var e in t)if(this.has(t,e))return!1;return!0},mix:function(t,e,n){for(var i in e)t[i]=e[i];return t},extend:function(t,e,i,r){if(!e||!t)return t;var o,s=e.prototype;return o=n(s,t),t.prototype=this.mix(o,t.prototype),t.superclass=n(s,e),i&&this.mix(o,i),r&&this.mix(t,r),t},startsWith:function(t,e){return 0===t.lastIndexOf(e,0)},endsWith:function(t,e){var n=t.length-e.length;return n>=0&&t.indexOf(e,n)===n},trim:a,substitute:function(t,e,n){return"string"==typeof t&&e?t.replace(n||r,function(t,n){return"\\"===t.charAt(0)?t.slice(1):void 0===e[n]?o:e[n]}):t},vendor:function(){for(var t,e=document.createElement("div").style,n=["t","webkitT","MozT","msT","OT"],i=0,r=n.length;i<r;i++)if(t=n[i]+"ransform",t in e)return n[i].substr(0,n[i].length-1);return!1}(),prefixStyle:function(t){return this.vendor!==!1&&(""===this.vendor?t:this.vendor+t.charAt(0).toUpperCase()+t.substr(1))},hasClass:function(t,e){return t&&t.className&&e&&t.className.indexOf(e)!=-1},addClass:function(t,e){t&&e&&!this.hasClass(t,e)&&(t.className+=" "+e)},removeClass:function(t,e){t&&t.className&&e&&(t.className=t.className.replace(e,""))},remove:function(t){t&&t.parentNode&&t.parentNode.removeChild(t)},getOffsetTop:l,getOffsetLeft:h,findParentEl:function(t,e,n){var i=null,r=null,o=/^#/.test(e)?"id":/^\./.test(e)?"class":"tag",s=e.replace(/\.|#/g,"");if(n&&"string"==typeof n&&(n=document.querySelector(n)),n=n||document.body,t&&e){if("class"==o&&t.className&&t.className.match(s))return t;if("id"==o&&t.id&&a(t.id)==s)return t;if("tag"==o&&t.tagName.toLowerCase()==s)return t;for(;!i&&r!=n&&(r=t.parentNode);){if("class"==o&&r.className&&r.className.match(s)||"id"==o&&r.id&&a(r.id)==s||"tag"==o&&r.tagName&&r.tagName.toLowerCase()==s)return i=r;t=r}return null}},guid:function(t){var e=++u+"";return t?t+e:e},isAndroid:function(){return/Android /.test(window.navigator.appVersion)},isBadAndroid:function(){return/Android /.test(window.navigator.appVersion)&&!/Chrome\/\d/.test(window.navigator.appVersion)},px2Num:function(t){return Number(t.replace(/px/,""))},getNodes:i,getNode:function(t,e){var n=i(t,e);return n&&n[0]},stringifyStyle:function(t){var e="";for(var n in t)e+=[n,":",t[n],";"].join("");return e}}),d=["Arguments","Function","String","Number","Date","RegExp"],p=0;p<d.length;p++)f["is"+d[p]]=function(t){return toString.call(t)=="[object "+d[p]+"]"};return"object"==typeof module&&module.exports?t=f:f}(t),e=function(e){var n=t,i=function(t){var e,n=!1;return function(){return n?e:(n=!0,e=t.apply(this,arguments),t=null,e)}},r={on:function(t,e,n){if(!s(this,"on",t,[e,n])||!e)return this;this._events||(this._events={});var i=this._events[t]||(this._events[t]=[]);return i.push({callback:e,context:n,ctx:n||this}),this},once:function(t,e,n){if(!s(this,"once",t,[e,n])||!e)return this;var r=this,o=i(function(){r.off(t,o),e.apply(this,arguments)});return o._callback=e,this.on(t,o,n)},off:function(t,e,n){if(!this._events||!s(this,"off",t,[e,n]))return this;if(!t&&!e&&!n)return this._events=void 0,this;for(var i=t?[t]:Object.keys(this._events),r=0,o=i.length;r<o;r++){t=i[r];var c=this._events[t];if(c)if(e||n){for(var a=[],u=0,l=c.length;u<l;u++){var h=c[u];(e&&e!==h.callback&&e!==h.callback._callback||n&&n!==h.context)&&a.push(h)}a.length?this._events[t]=a:delete this._events[t]}else delete this._events[t]}return this},trigger:function(t){if(!this._events)return this;var e=Array.prototype.slice.call(arguments,1);if(!s(this,"trigger",t,e))return this;var n=this._events[t],i=this._events.all;return n&&c(n,e),i&&c(i,arguments),this},listenTo:function(t,e,i){var r=this._listeningTo||(this._listeningTo={}),o=t._listenId||(t._listenId=n.guid("l"));return r[o]=t,i||"object"!=typeof e||(i=this),t.on(e,i,this),this},listenToOnce:function(t,e,n){if("object"==typeof e){for(var r in e)this.listenToOnce(t,r,e[r]);return this}var o=i(function(){this.stopListening(t,e,o),n.apply(this,arguments)});return o._callback=n,this.listenTo(t,e,o)},stopListening:function(t,e,i){var r=this._listeningTo;if(!r)return this;var o=!e&&!i;i||"object"!=typeof e||(i=this),t&&((r={})[t._listenId]=t);for(var s in r)t=r[s],t.off(e,i,this),(o||n.isEmpty(t._events))&&delete this._listeningTo[s];return this}},o=/\s+/,s=function(t,e,n,i){if(!n)return!0;if("object"==typeof n){for(var r in n)t[e].apply(t,[r,n[r]].concat(i));return!1}if(o.test(n)){for(var s=n.split(o),c=0,a=s.length;c<a;c++)t[e].apply(t,[s[c]].concat(i));return!1}return!0},c=function(t,e){var n,i=-1,r=t.length,o=e[0],s=e[1],c=e[2];switch(e.length){case 0:for(;++i<r;)(n=t[i]).callback.call(n.ctx);return;case 1:for(;++i<r;)(n=t[i]).callback.call(n.ctx,o);return;case 2:for(;++i<r;)(n=t[i]).callback.call(n.ctx,o,s);return;case 3:for(;++i<r;)(n=t[i]).callback.call(n.ctx,o,s,c);return;default:for(;++i<r;)(n=t[i]).callback.apply(n.ctx,e);return}};return r.bind=r.on,r.unbind=r.off,"object"==typeof module&&module.exports?e=r:r}(e),n=function(n){var i=t,r=e,o=function(){};return i.mix(o.prototype,r),i.mix(o.prototype,{plug:function(t){var e=this;if(t&&t.pluginId){e.__plugins||(e.__plugins=[]);var n=e.getPlugin(t.pluginId);return n&&e.unplug(t.pluginId),t.pluginInitializer(e),e.__plugins.push(t),e}},unplug:function(t){var e=this;if(t&&e.__plugins){var n="string"==typeof t?e.getPlugin(t):t;n.pluginDestructor(e);for(var i=0,r=e.__plugins.length;i<r;i++)if(e.__plugins[i]==n)return e.__plugins.splice(i,1)}},getPlugin:function(t){var e=this,n=[];if(e.__plugins){for(var i=0,r=e.__plugins.length;i<r;i++)e.__plugins[i]&&e.__plugins[i].pluginId==t&&n.push(e.__plugins[i]);return n.length>1?n:n[0]||null}}}),"object"==typeof module&&module.exports?n=o:o}(n),i=function(t){var e={linear:[0,0,1,1],ease:[.25,.1,.25,1],"ease-in":[.42,0,1,1],"ease-out":[0,0,.58,1],"ease-in-out":[.42,0,.58,1],quadratic:[.33,.66,.66,1],circular:[.1,.57,.1,1],bounce:[.71,1.35,.47,1.41],format:function(t){if(t)return"string"==typeof t&&this[t]?this[t]instanceof Array?[" cubic-bezier(",this[t],") "].join(""):this[t]:t instanceof Array?[" cubic-bezier(",t,") "].join(""):t}};return"object"==typeof module&&module.exports?t=e:e}(i),r=function(e){function r(t,e,n,i,r){var o=function(e){var i=1-e;return 3*i*i*e*t+3*i*e*e*n+e*e*e},s=function(t){var n=1-t;return 3*n*n*t*e+3*n*t*t*i+t*t*t},c=function(e){var i=1-e;return 3*(2*(e-1)*e+i*i)*t+3*(-e*e*e+2*i*e)*n};return function(t){var e,n,i,a,u,l,h=t;for(i=h,l=0;l<8;l++){if(a=o(i)-h,Math.abs(a)<r)return s(i);if(u=c(i),Math.abs(u)<1e-6)break;i-=a/u}if(e=0,n=1,i=h,i<e)return s(e);if(i>n)return s(n);for(;e<n;){if(a=o(i),Math.abs(a-h)<r)return s(i);h>a?e=i:n=i,i=.5*(n-e)+e}return s(i)}}function o(t){var e=this;e.cfg=s.mix({easing:"linear"},t)}var s=t,c=n,a=i,u=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},l=["webkit","moz","ms","o"],h=window.cancelAnimationFrame;if(!h)for(var f=0;f<l.length;f++)(window[l[f]+"CancelAnimationFrame"]||window[l[f]+"CancelRequestAnimationFrame"])&&(h=window[l[f]+"CancelAnimationFrame"]||window[l[f]+"CancelRequestAnimationFrame"]);return h=h||window.clearTimeout,o.MIN_DURATION=1,s.extend(o,c,{reset:function(t){var e=this;s.mix(e.cfg,t),e.isfinished=!1,e.percent=0,e._stop=null},run:function(){var t=this,e=t.cfg.duration;if(e<=o.MIN_DURATION&&(t.isfinished=!0,t.trigger("run",{percent:1}),t.trigger("end",{percent:1})),!t.isfinished){t._hasFinishedPercent=t._stop&&t._stop.percent||0,t._stop=null,t.start=Date.now(),t.percent=0;var n=1e3/60/e/4,i=a[t.cfg.easing];t.easingFn=r(i[0],i[1],i[2],i[3],n),t._run()}},_run:function(){var t=this;h(t._raf),t._raf=u(function(){if(t.now=Date.now(),t.duration=t.now-t.start>=t.cfg.duration?t.cfg.duration:t.now-t.start,t.progress=t.easingFn(t.duration/t.cfg.duration),t.percent=t.duration/t.cfg.duration+t._hasFinishedPercent,t.percent>=1||t._stop){t.percent=t._stop&&t._stop.percent?t._stop.percent:1,t.duration=t._stop&&t._stop.duration?t._stop.duration:t.duration;var e={percent:t.percent};return t.trigger("stop",e),void(t.percent>=1&&(t.isfinished=!0,t.trigger("end",{percent:1})))}t.trigger("run",{percent:t.progress,originPercent:t.percent}),t._run()})},stop:function(){var t=this;t._stop={percent:t.percent,now:t.now},h(t._raf)}}),"object"==typeof module&&module.exports?e=o:o}(r),o=function(e){function o(t){return Math.round(1e5*parseFloat(t))/1e5}function s(){return{translateX:0,translateY:0,rotate:0,skewX:0,skewY:0,scaleX:1,scaleY:1}}function c(t){return t=t.split(/,/),t=Array.prototype.map.call(t,function(t){return o(t)})}function a(t){t=c(t);var e,n,i,r=t[0],s=t[1],a=t[2],u=t[3];return r*u-s*a?(e=Math.sqrt(r*r+s*s),i=(r*a+s*u)/(r*u-a*s),n=(r*u-s*a)/e,r*u<s*a&&(i=-i,e=-e)):e=n=i=0,{translateX:o(t[4]),translateY:o(t[5]),rotate:o(180*Math.atan2(s,r)/Math.PI),skewX:o(180*Math.atan(i)/Math.PI),skewY:0,scaleX:o(e),scaleY:o(n)}}function u(t){t=t.split(")");for(var e,n,i,r=p.trim,c=-1,u=t.length-1,l=s();++c<u;)switch(e=t[c].split("("),n=r(e[0]),i=e[1],n){case"translateX":case"translateY":case"scaleX":case"scaleY":l[n]=o(i);break;case"translate":case"translate3d":i=i.split(","),l.translateX=o(i[0]),l.translateY=o(i[1]||0);break;case"scale":i=i.split(","),l.scaleX=o(i[0]),l.scaleY=o(i[1]||i[0]);break;case"matrix":return a(i)}return l}function l(t,e){if(t&&e&&e.css){var n=this;n.cfg=e,n.el=t;var i=e.duration||0,r=e.easing||"ease";e.delay||0;return e.run&&(n.timer=n.timer||new g({duration:Math.round(i),easing:r}),n.timer.on("run",e.run)),n._bindEvt(),n}}function h(t,e){var n=u(t),i=u(e),r={};for(var o in i)r[o]={prevVal:n[o],newVal:i[o]};return r}function f(t,e,n,i,r){n=isNaN(Number(n))?0:Number(n);var o=(i-n)*r+n;d(t,e,o)}function d(t,e,n){switch(e){case"scrollTop":case"scrollLeft":t[e]=n;break;case"transform":t.style[y]=n;case"opacity":t.style[e]=n}}var p=t,g=r,v=i,m=n,y=p.prefixStyle("transform"),_=p.prefixStyle("transition"),x=(p.prefixStyle("transitionDuration"),p.prefixStyle("transformOrigin"),p.vendor?p.prefixStyle("transitionEnd"):"transitionend"),T=(p.vendor?["-",p.vendor,"-transform"].join(""):"transform","translateX({translateX}px) translateY({translateY}px) translateZ(0)"),C={transform:!0,opacity:!0,scrollTop:!0,scrollLeft:!0};return p.extend(l,m,{run:function(){var t=this,e=t.cfg,n=t.el,i=e.duration||0,r=e.easing||"ease",o=e.delay||0;if(t.__isTransitionEnd=!1,clearTimeout(t.__itv),t.timer&&t.timer.run(),i<=g.MIN_DURATION){for(var s in e.css)d(n,s,e.css[s]);return t.stop(),void t.__handlers.stop.call(t)}if(p.isBadAndroid()&&(e.useTransition=!1),e.useTransition){n.style[_]=p.substitute("all {duration}ms {easing} {delay}ms",{duration:Math.round(i),easing:v.format(r),delay:o});for(var s in e.css)d(n,s,e.css[s]);t.__itv=setTimeout(function(){t.__isTransitionEnd||(t.__isTransitionEnd=!0,t.trigger("transitionend"))},Number(i)+60)}else if(t.computeStyle=t.computeStyle||window.getComputedStyle(n),e.css.transform&&t.timer){t.transmap=h(t.computeStyle[y],e.css.transform);t.timer.off("run",t.__handlers.transRun),t.timer.on("run",t.__handlers.transRun,t),t.timer.off("end",t.__handlers.transRun),t.timer.on("end",t.__handlers.transRun,t)}return t},_transitionEndHandler:function(t){var e=this;e.stop(),e.__handlers.stop.call(e)},__handlers:{transRun:function(t){var e=this,n=e.transmap,i=e.el,r={};for(var o in n)r[o]=(n[o].newVal-n[o].prevVal)*t.percent+n[o].prevVal;var s=p.substitute(T+" scale({scaleX},{scaleY})",r);i.style[y]=s},stop:function(t){var e=this,n=e.cfg;n.end&&n.end({percent:1})}},_bindEvt:function(){var t=this,e=t.cfg,n=t.el;t.el.addEventListener(x,function(e){t.__isTransitionEnd=!0,e.target===e.currentTarget&&t.trigger("transitionend",e)}),t.on("transitionend",t._transitionEndHandler,t);var i=function(i){t.computeStyle=t.computeStyle||window.getComputedStyle(n);for(var r in e.css)/transform/.test(r)||f(t.el,r,t.computeStyle[r],e.css[r],i.percent)};t.timer&&t.timer.on("run",i),t.timer&&t.timer.on("stop",t.__handlers.stop,t)},stop:function(){var t=this;if(t.cfg.useTransition&&t.cfg.duration>g.MIN_DURATION){var e=window.getComputedStyle(this.el);for(var n in t.cfg.css)if(C[n]){var i=/transform/.test(n)?e[y]:e[n];d(t.el,n,p.substitute(T+" scale({scaleX},{scaleY})",u(i)))}t.el.style[_]="none"}return t.timer&&t.timer.stop()&&t.timer.reset(),t.computeStyle=null,t},reset:function(t){var e=this;return e.computeStyle=null,p.mix(e.cfg,t),this.timer&&e.timer.reset({duration:Math.round(e.cfg.duration),easing:e.cfg.easing}),e}}),"object"==typeof module&&module.exports?e=l:l}(o),s=function(t){function e(t,e,n){return setTimeout(c(t,n),e)}function n(t,e,n){return!!Array.isArray(t)&&(i(t,n[e],n),!0)}function i(t,e,n){var i;if(t)if(t.forEach)t.forEach(e,n);else if(void 0!==t.length)for(i=0;i<t.length;)e.call(n,t[i],i,t),i++;else for(i in t)t.hasOwnProperty(i)&&e.call(n,t[i],i,t)}function r(t,e,n){for(var i=Object.keys(e),r=0;r<i.length;)(!n||n&&void 0===t[i[r]])&&(t[i[r]]=e[i[r]]),r++;return t}function o(t,e){return r(t,e,!0)}function s(t,e,n){var i,o=e.prototype;i=t.prototype=Object.create(o),i.constructor=t,i._super=o,n&&r(i,n)}function c(t,e){return function(){return t.apply(e,arguments)}}function a(t,e){return typeof t==ct?t.apply(e?e[0]||void 0:void 0,e):t}function u(t,e){return void 0===t?e:t}function l(t,e,n){i(p(e),function(e){t.addEventListener(e,n,!1)})}function h(t,e,n){i(p(e),function(e){t.removeEventListener(e,n,!1)})}function f(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1}function d(t,e){return t.indexOf(e)>-1}function p(t){return t.trim().split(/\s+/g)}function g(t,e,n){if(t.indexOf&&!n)return t.indexOf(e);for(var i=0;i<t.length;){if(n&&t[i][n]==e||!n&&t[i]===e)return i;i++}return-1}function v(t){return Array.prototype.slice.call(t,0)}function m(t,e,n){for(var i=[],r=[],o=0;o<t.length;){var s=e?t[o][e]:t[o];g(r,s)<0&&i.push(t[o]),r[o]=s,o++}return n&&(i=e?i.sort(function(t,n){return t[e]>n[e]}):i.sort()),i}function y(t,e){for(var n,i,r=e[0].toUpperCase()+e.slice(1),o=0;o<ot.length;){if(n=ot[o],i=n?n+r:e,i in t)return i;o++}}function _(){return ht++}function x(t){var e=t.ownerDocument;return e.defaultView||e.parentWindow}function T(t,e){var n=this;this.manager=t,this.callback=e,this.element=t.element,this.target=t.options.inputTarget,this.domHandler=function(e){a(t.options.enable,[t])&&n.handler(e)},this.init()}function C(t){var e,n=t.options.inputClass;return new(e=n?n:pt?X:gt?D:dt?H:I)(t,b)}function b(t,e,n){var i=n.pointers.length,r=n.changedPointers.length,o=e&Tt&&i-r===0,s=e&(bt|Et)&&i-r===0;n.isFirst=!!o,n.isFinal=!!s,o&&(t.session={}),n.eventType=e,E(t,n),t.emit("hammer.input",n),t.recognize(n),t.session.prevInput=n}function E(t,e){var n=t.session,i=e.pointers,r=i.length;n.firstInput||(n.firstInput=w(e)),r>1&&!n.firstMultiple?n.firstMultiple=w(e):1===r&&(n.firstMultiple=!1);var o=n.firstInput,s=n.firstMultiple,c=s?s.center:o.center,a=e.center=N(i);e.timeStamp=lt(),e.deltaTime=e.timeStamp-o.timeStamp,e.angle=R(c,a),e.distance=Y(c,a),k(n,e),e.offsetDirection=O(e.deltaX,e.deltaY),e.scale=s?B(s.pointers,i):1,e.rotation=s?L(s.pointers,i):0,S(n,e);var u=t.element;f(e.srcEvent.target,u)&&(u=e.srcEvent.target),e.target=u}function k(t,e){var n=e.center,i=t.offsetDelta||{},r=t.prevDelta||{},o=t.prevInput||{};e.eventType!==Tt&&o.eventType!==bt||(r=t.prevDelta={x:o.deltaX||0,y:o.deltaY||0},i=t.offsetDelta={x:n.x,y:n.y}),e.deltaX=r.x+(n.x-i.x),e.deltaY=r.y+(n.y-i.y)}function S(t,e){var n,i,r,o,s=t.lastInterval||e,c=e.timeStamp-s.timeStamp;if(e.eventType!=Et&&(c>xt||void 0===s.velocity)){var a=s.deltaX-e.deltaX,u=s.deltaY-e.deltaY,l=A(c,a,u);i=l.x,r=l.y,n=ut(l.x)>ut(l.y)?l.x:l.y,o=O(a,u),t.lastInterval=e}else n=s.velocity,i=s.velocityX,r=s.velocityY,o=s.direction;e.velocity=n,e.velocityX=i,e.velocityY=r,e.direction=o}function w(t){for(var e=[],n=0;n<t.pointers.length;)e[n]={clientX:at(t.pointers[n].clientX),clientY:at(t.pointers[n].clientY)},n++;return{timeStamp:lt(),pointers:e,center:N(e),deltaX:t.deltaX,deltaY:t.deltaY}}function N(t){var e=t.length;if(1===e)return{x:at(t[0].clientX),y:at(t[0].clientY)};for(var n=0,i=0,r=0;r<e;)n+=t[r].clientX,i+=t[r].clientY,r++;return{x:at(n/e),y:at(i/e)}}function A(t,e,n){return{x:e/t||0,y:n/t||0}}function O(t,e){return t===e?kt:ut(t)>=ut(e)?t>0?St:wt:e>0?Nt:At}function Y(t,e,n){n||(n=Lt);var i=e[n[0]]-t[n[0]],r=e[n[1]]-t[n[1]];return Math.sqrt(i*i+r*r)}function R(t,e,n){n||(n=Lt);var i=e[n[0]]-t[n[0]],r=e[n[1]]-t[n[1]];return 180*Math.atan2(r,i)/Math.PI}function L(t,e){return R(e[1],e[0],Bt)-R(t[1],t[0],Bt)}function B(t,e){return Y(e[0],e[1],Bt)/Y(t[0],t[1],Bt)}function I(){this.evEl=Xt,this.evWin=Mt,this.allow=!0,this.pressed=!1,T.apply(this,arguments)}function X(){this.evEl=zt,this.evWin=Ht,T.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function M(){this.evTarget=Ut,this.evWin=jt,this.started=!1,T.apply(this,arguments)}function P(t,e){var n=v(t.touches),i=v(t.changedTouches);return e&(bt|Et)&&(n=m(n.concat(i),"identifier",!0)),[n,i]}function D(){this.evTarget=Wt,this.targetIds={},T.apply(this,arguments)}function z(t,e){var n=v(t.touches),i=this.targetIds;if(e&(Tt|Ct)&&1===n.length)return i[n[0].identifier]=!0,[n,n];var r,o,s=v(t.changedTouches),c=[],a=this.target;if(o=n.filter(function(t){return f(t.target,a)}),e===Tt)for(r=0;r<o.length;)i[o[r].identifier]=!0,r++;for(r=0;r<s.length;)i[s[r].identifier]&&c.push(s[r]),e&(bt|Et)&&delete i[s[r].identifier],r++;return c.length?[m(o.concat(c),"identifier",!0),c]:void 0}function H(){T.apply(this,arguments);var t=c(this.handler,this);this.touch=new D(this.manager,t),this.mouse=new I(this.manager,t)}function F(t,e){this.manager=t,this.set(e)}function U(t){if(d(t,$t))return $t;var e=d(t,Qt),n=d(t,te);return e&&n?Qt+" "+te:e||n?e?Qt:te:d(t,Jt)?Jt:Gt}function j(t){this.id=_(),this.manager=null,this.options=o(t||{},this.defaults),this.options.enable=u(this.options.enable,!0),this.state=ee,this.simultaneous={},this.requireFail=[]}function q(t){return t&se?"cancel":t&re?"end":t&ie?"move":t&ne?"start":""}function W(t){return t==At?"down":t==Nt?"up":t==St?"left":t==wt?"right":""}function Z(t,e){var n=e.manager;return n?n.get(t):t}function K(){j.apply(this,arguments)}function V(){K.apply(this,arguments),this.pX=null,this.pY=null}function G(){K.apply(this,arguments)}function J(){j.apply(this,arguments),this._timer=null,this._input=null}function $(){K.apply(this,arguments)}function Q(){K.apply(this,arguments)}function tt(){j.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function et(t,e){return e=e||{},e.recognizers=u(e.recognizers,et.defaults.preset),new nt(t,e)}function nt(t,e){e=e||{},this.options=o(e,et.defaults),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.element=t,this.input=C(this),this.touchAction=new F(this,this.options.touchAction),it(this,!0),i(e.recognizers,function(t){var e=this.add(new t[0](t[1]));t[2]&&e.recognizeWith(t[2]),t[3]&&e.requireFailure(t[3])},this)}function it(t,e){var n=t.element;i(t.options.cssProps,function(t,i){n.style[y(n.style,i)]=e?t:""})}function rt(t,e){var n=document.createEvent("Event");n.initEvent(t,!0,!0),n.gesture=e,e.target.dispatchEvent(n)}var ot=["","webkit","moz","MS","ms","o"],st=document.createElement("div"),ct="function",at=Math.round,ut=Math.abs,lt=Date.now,ht=1,ft=/mobile|tablet|ip(ad|hone|od)|android/i,dt="ontouchstart"in window,pt=void 0!==y(window,"PointerEvent"),gt=dt&&ft.test(navigator.userAgent),vt="touch",mt="pen",yt="mouse",_t="kinect",xt=25,Tt=1,Ct=2,bt=4,Et=8,kt=1,St=2,wt=4,Nt=8,At=16,Ot=St|wt,Yt=Nt|At,Rt=Ot|Yt,Lt=["x","y"],Bt=["clientX","clientY"];T.prototype={handler:function(){},init:function(){this.evEl&&l(this.element,this.evEl,this.domHandler),this.evTarget&&l(this.target,this.evTarget,this.domHandler),this.evWin&&l(x(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&h(this.element,this.evEl,this.domHandler),this.evTarget&&h(this.target,this.evTarget,this.domHandler),this.evWin&&h(x(this.element),this.evWin,this.domHandler)}};var It={mousedown:Tt,mousemove:Ct,mouseup:bt},Xt="mousedown",Mt="mousemove mouseup";s(I,T,{handler:function(t){var e=It[t.type];e&Tt&&0===t.button&&(this.pressed=!0),e&Ct&&1!==t.which&&(e=bt),this.pressed&&this.allow&&(e&bt&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:yt,srcEvent:t}))}});var Pt={pointerdown:Tt,pointermove:Ct,pointerup:bt,pointercancel:Et,pointerout:Et},Dt={2:vt,3:mt,4:yt,5:_t},zt="pointerdown",Ht="pointermove pointerup pointercancel";window.MSPointerEvent&&(zt="MSPointerDown",Ht="MSPointerMove MSPointerUp MSPointerCancel"),s(X,T,{handler:function(t){var e=this.store,n=!1,i=t.type.toLowerCase().replace("ms",""),r=Pt[i],o=Dt[t.pointerType]||t.pointerType,s=o==vt,c=g(e,t.pointerId,"pointerId");r&Tt&&(0===t.button||s)?c<0&&(e.push(t),c=e.length-1):r&(bt|Et)&&(n=!0),c<0||(e[c]=t,this.callback(this.manager,r,{pointers:e,changedPointers:[t],pointerType:o,srcEvent:t}),n&&e.splice(c,1))}});var Ft={touchstart:Tt,touchmove:Ct,touchend:bt,touchcancel:Et},Ut="touchstart",jt="touchstart touchmove touchend touchcancel";s(M,T,{handler:function(t){var e=Ft[t.type];if(e===Tt&&(this.started=!0),this.started){var n=P.call(this,t,e);e&(bt|Et)&&n[0].length-n[1].length===0&&(this.started=!1),this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:vt,srcEvent:t})}}});var qt={touchstart:Tt,touchmove:Ct,touchend:bt,touchcancel:Et},Wt="touchstart touchmove touchend touchcancel";s(D,T,{handler:function(t){var e=qt[t.type],n=z.call(this,t,e);n&&this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:vt,srcEvent:t})}}),s(H,T,{handler:function(t,e,n){var i=n.pointerType==vt,r=n.pointerType==yt;if(i)this.mouse.allow=!1;else if(r&&!this.mouse.allow)return;e&(bt|Et)&&(this.mouse.allow=!0),this.callback(t,e,n)},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var Zt=y(st.style,"touchAction"),Kt=void 0!==Zt,Vt="compute",Gt="auto",Jt="manipulation",$t="none",Qt="pan-x",te="pan-y";F.prototype={set:function(t){t==Vt&&(t=this.compute()),Kt&&(this.manager.element.style[Zt]=t),this.actions=t.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var t=[];return i(this.manager.recognizers,function(e){a(e.options.enable,[e])&&(t=t.concat(e.getTouchAction()))}),U(t.join(" "))},preventDefaults:function(t){if(!Kt){var e=t.srcEvent,n=t.offsetDirection;if(this.manager.session.prevented)return void e.preventDefault();var i=this.actions,r=d(i,$t),o=d(i,te),s=d(i,Qt);return r||o&&n&Ot||s&&n&Yt?this.preventSrc(e):void 0}},preventSrc:function(t){this.manager.session.prevented=!0,t.preventDefault()}};var ee=1,ne=2,ie=4,re=8,oe=re,se=16,ce=32;j.prototype={defaults:{},set:function(t){return r(this.options,t),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(t){if(n(t,"recognizeWith",this))return this;var e=this.simultaneous;return t=Z(t,this),e[t.id]||(e[t.id]=t,t.recognizeWith(this)),this},dropRecognizeWith:function(t){return n(t,"dropRecognizeWith",this)?this:(t=Z(t,this),delete this.simultaneous[t.id],this)},requireFailure:function(t){if(n(t,"requireFailure",this))return this;var e=this.requireFail;return t=Z(t,this),g(e,t)===-1&&(e.push(t),t.requireFailure(this)),this},dropRequireFailure:function(t){if(n(t,"dropRequireFailure",this))return this;t=Z(t,this);var e=g(this.requireFail,t);return e>-1&&this.requireFail.splice(e,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(t){return!!this.simultaneous[t.id]},emit:function(t){function e(e){n.manager.emit(n.options.event+(e?q(i):""),t)}var n=this,i=this.state;i<re&&e(!0),e(),i>=re&&e(!0)},tryEmit:function(t){return this.canEmit()?this.emit(t):void(this.state=ce)},canEmit:function(){for(var t=0;t<this.requireFail.length;){if(!(this.requireFail[t].state&(ce|ee)))return!1;t++}return!0},recognize:function(t){var e=r({},t);return a(this.options.enable,[this,e])?(this.state&(oe|se|ce)&&(this.state=ee),this.state=this.process(e),void(this.state&(ne|ie|re|se)&&this.tryEmit(e))):(this.reset(),void(this.state=ce))},process:function(t){},getTouchAction:function(){},reset:function(){}},s(K,j,{defaults:{pointers:1},attrTest:function(t){var e=this.options.pointers;return 0===e||t.pointers.length===e},process:function(t){var e=this.state,n=t.eventType,i=e&(ne|ie),r=this.attrTest(t);return i&&(n&Et||!r)?e|se:i||r?n&bt?e|re:e&ne?e|ie:ne:ce}}),s(V,K,{defaults:{event:"pan",threshold:10,pointers:1,direction:Rt},getTouchAction:function(){var t=this.options.direction,e=[];return t&Ot&&e.push(te),t&Yt&&e.push(Qt),e},directionTest:function(t){var e=this.options,n=!0,i=t.distance,r=t.direction,o=t.deltaX,s=t.deltaY;return r&e.direction||(e.direction&Ot?(r=0===o?kt:o<0?St:wt,n=o!=this.pX,i=Math.abs(t.deltaX)):(r=0===s?kt:s<0?Nt:At,n=s!=this.pY,i=Math.abs(t.deltaY))),t.direction=r,n&&i>e.threshold&&r&e.direction},attrTest:function(t){return K.prototype.attrTest.call(this,t)&&(this.state&ne||!(this.state&ne)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=W(t.direction);e&&this.manager.emit(this.options.event+e,t),this._super.emit.call(this,t)},reset:function(){}}),s(G,K,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[$t]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||this.state&ne)},emit:function(t){if(this._super.emit.call(this,t),1!==t.scale){var e=t.scale<1?"in":"out";this.manager.emit(this.options.event+e,t)}}}),s(J,j,{defaults:{event:"press",pointers:1,time:500,threshold:5},getTouchAction:function(){return[Gt]},process:function(t){var n=this.options,i=t.pointers.length===n.pointers,r=t.distance<n.threshold,o=t.deltaTime>n.time;if(this._input=t,!r||!i||t.eventType&(bt|Et)&&!o)this.reset();else if(t.eventType&Tt)this.reset(),this._timer=e(function(){this.state=oe,this.tryEmit()},n.time,this);else if(t.eventType&bt)return oe;return ce},reset:function(){clearTimeout(this._timer)},emit:function(t){this.state===oe&&(t&&t.eventType&bt?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=lt(),this.manager.emit(this.options.event,this._input)))}}),s($,K,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[$t]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||this.state&ne)}}),s(Q,K,{defaults:{event:"swipe",threshold:10,velocity:.65,direction:Ot|Yt,pointers:1},getTouchAction:function(){return V.prototype.getTouchAction.call(this)},attrTest:function(t){var e,n=this.options.direction;return n&(Ot|Yt)?e=t.velocity:n&Ot?e=t.velocityX:n&Yt&&(e=t.velocityY),this._super.attrTest.call(this,t)&&n&t.direction&&t.distance>this.options.threshold&&ut(e)>this.options.velocity&&t.eventType&bt},emit:function(t){var e=W(t.direction);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),s(tt,j,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:10,posThreshold:10},getTouchAction:function(){return[Jt]},process:function(t){var n=this.options,i=t.pointers.length===n.pointers,r=t.distance<n.threshold,o=t.deltaTime<n.time;if(this.reset(),t.eventType&Tt&&0===this.count)return this.failTimeout();if(r&&o&&i){if(t.eventType!=bt)return this.failTimeout();var s=!this.pTime||t.timeStamp-this.pTime<n.interval,c=!this.pCenter||Y(this.pCenter,t.center)<n.posThreshold;this.pTime=t.timeStamp,this.pCenter=t.center,c&&s?this.count+=1:this.count=1,this._input=t;var a=this.count%n.taps;if(0===a)return this.hasRequireFailures()?(this._timer=e(function(){this.state=oe,this.tryEmit()},n.interval,this),ne):oe}return ce},failTimeout:function(){return this._timer=e(function(){this.state=ce},this.options.interval,this),ce},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==oe&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),et.VERSION="2.0.4",et.defaults={domEvents:!1,touchAction:Vt,enable:!0,inputTarget:null,inputClass:null,preset:[[$,{enable:!1}],[G,{enable:!1},["rotate"]],[Q,{direction:Ot}],[V,{direction:Ot},["swipe"]],[tt],[tt,{event:"doubletap",taps:2},["tap"]],[J]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var ae=1,ue=2;return nt.prototype={set:function(t){return r(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},stop:function(t){this.session.stopped=t?ue:ae},recognize:function(t){var e=this.session;if(!e.stopped){this.touchAction.preventDefaults(t);var n,i=this.recognizers,r=e.curRecognizer;(!r||r&&r.state&oe)&&(r=e.curRecognizer=null);for(var o=0;o<i.length;)n=i[o],e.stopped===ue||r&&n!=r&&!n.canRecognizeWith(r)?n.reset():n.recognize(t),!r&&n.state&(ne|ie|re)&&(r=e.curRecognizer=n),o++}},get:function(t){if(t instanceof j)return t;for(var e=this.recognizers,n=0;n<e.length;n++)if(e[n].options.event==t)return e[n];return null},add:function(t){if(n(t,"add",this))return this;var e=this.get(t.options.event);return e&&this.remove(e),this.recognizers.push(t),t.manager=this,this.touchAction.update(),t},remove:function(t){if(n(t,"remove",this))return this;var e=this.recognizers;return t=this.get(t),e.splice(g(e,t),1),this.touchAction.update(),this},on:function(t,e){var n=this.handlers;return i(p(t),function(t){n[t]=n[t]||[],n[t].push(e)}),this},off:function(t,e){var n=this.handlers;return i(p(t),function(t){e?n[t].splice(g(n[t],e),1):delete n[t]}),this},emit:function(t,e){this.options.domEvents&&rt(t,e);var n=this.handlers[t]&&this.handlers[t].slice();if(n&&n.length){e.type=t,e.preventDefault=function(){e.srcEvent.preventDefault()};for(var i=0;i<n.length;)n[i](e),i++}},destroy:function(){this.element&&it(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},r(et,{INPUT_START:Tt,INPUT_MOVE:Ct,INPUT_END:bt,INPUT_CANCEL:Et,STATE_POSSIBLE:ee,STATE_BEGAN:ne,STATE_CHANGED:ie,STATE_ENDED:re,STATE_RECOGNIZED:oe,STATE_CANCELLED:se,STATE_FAILED:ce,DIRECTION_NONE:kt,DIRECTION_LEFT:St,DIRECTION_RIGHT:wt,DIRECTION_UP:Nt,DIRECTION_DOWN:At,DIRECTION_HORIZONTAL:Ot,DIRECTION_VERTICAL:Yt,DIRECTION_ALL:Rt,Manager:nt,Input:T,TouchAction:F,TouchInput:D,MouseInput:I,PointerEventInput:X,TouchMouseInput:H,SingleTouchInput:M,Recognizer:j,AttrRecognizer:K,Tap:tt,Pan:V,Swipe:Q,Pinch:G,Rotate:$,Press:J,on:l,off:h,each:i,merge:o,extend:r,inherit:s,bindFn:c,prefixed:y}),"object"==typeof module&&module.exports?t=et:et}(s),c=function(e){function n(t){this.cfg=i.mix({width:0,height:0},t),this.init()}var i=t;return i.mix(n.prototype,{init:function(){var t=this;t._xtop=0,t._xright=0,t._xleft=0,t._xbottom=0,t.refresh({width:t.cfg.width,height:t.cfg.height})},reset:function(){return this.resetTop(),this.resetLeft(),this.resetBottom(),this.resetRight(),this},resetTop:function(){return this._xtop=0,this.refresh(),this},resetLeft:function(){return this._xleft=0,this.refresh(),
  2. this},resetBottom:function(){return this._xbottom=0,this.refresh(),this},resetRight:function(){return this._xright=0,this.refresh(),this},expandTop:function(t){return this._xtop=t,this.refresh(),this},expandLeft:function(t){return this._xleft=t,this.refresh(),this},expandRight:function(t){return this._xright=t,this.refresh(),this},expandBottom:function(t){return this._xbottom=t,this.refresh(),this},refresh:function(t){return i.mix(this.cfg,t),this.top=this._xtop,this.left=this._xleft,this.bottom=(t&&t.height||this.cfg.height||0)-this._xbottom,this.right=(t&&t.width||this.cfg.width||0)-this._xright,this.width=this.right-this.left>0?this.right-this.left:0,this.height=this.bottom-this.top>0?this.bottom-this.top:0,this}}),"object"==typeof module&&module.exports?e=n:n}(c),a=function(e){var i=t,r=n,o=i.prefixStyle("transform"),s=function(t){var e=t.stickyElement,n=t.curStickyElement,r=t.xscroll,o=t._,s=r.getPlugin("infinite");if(s){s.userConfig.renderHook.call(self,e,n),e.setAttribute("xs-guid",n.guid),i.addClass(e,n.className);for(var c in n.style)"display"!=c&&"position"!=c&&(e.style[c]=c==o.height?n.style[c]+"px":n.style[c])}else{var a=n.getAttribute("style");e.innerHTML=n.innerHTML,e.className=n.className,a&&e.setAttribute("style",a)}},c=function(t){c.superclass.constructor.call(this,t),this.userConfig=i.mix({stickyRenderTo:void 0,forceSticky:!0,prefix:"xs-sticky-container",stickyRenderFunc:s,zoomType:"y"},t),this.init()};return i.extend(c,r,{init:function(){var t=this,e=t.userConfig;t.xscroll=e.xscroll,t.isY=!("y"!=e.zoomType);return t._={top:t.isY?"top":"left",left:t.isY?"left":"bottom",right:t.isY?"right":"top",height:t.isY?"height":"width",width:t.isY?"width":"height"},t.stickyRenderTo=i.getNode(e.stickyRenderTo),t._handlers=[],t},getStickiesPos:function(){for(var t=this,e=(t.xscroll,t.isInfinite),n=t.isY,r=t._,o=[],s=function(o){var s={};return e?(s[r.top]=n?o._top:o._left,s[r.height]=n?o._height:o._width):(s[r.top]=t.isY?i.getOffsetTop(o):i.getOffsetLeft(o),s[r.height]=t.isY?o.offsetHeight:o.offsetWidth),s},c=0;c<t.stickiesNum;c++){var a=s(t.stickyElements[c]);t._handlers[c]=t._handlers[c]||t.createStickyEl(),a.el=t._handlers[c],a.isRender=!1,o.push(a)}return o},getStickyElements:function(){var t=this,e=t.xscroll,n=(t.userConfig,t.isInfinite,e.getPlugin("infinite"));if(n){var r=[],o=n.__serializedData;for(var s in o){var c=o[s];c&&c.style&&"sticky"==c.style.position&&r.push(c)}return r}return i.getNodes(e.userConfig.stickyElements,e.content)},render:function(t){var e=this,n=e.userConfig,r=e.xscroll;e.isInfinite=!!r.getPlugin("infinite");var o=e._;if(e.stickyElements=e.getStickyElements(),e.stickiesNum=e.stickyElements&&e.stickyElements.length,e.stickiesNum){e.stickyRenderTo||(e.stickyRenderTo=document.createElement("div"),r.renderTo.appendChild(e.stickyRenderTo)),e.stickiesPos=e.getStickiesPos();var s=e.stickyRenderTo;s.style[o.top]=0,s.style[o.left]=0,s.style[o.right]=0,s.style.position=r.userConfig.useOriginScroll?"fixed":"absolute",i.addClass(e.stickyRenderTo,n.prefix),e.stickyHandler(t),e._bindEvt()}},createStickyEl:function(){var t=this,e=document.createElement("div");return e.style.display="none",i.addClass(e,"xs-sticky-handler"),t.stickyRenderTo.appendChild(e),e},_bindEvt:function(){var t=this,e=t.xscroll;e.on("scroll",t.stickyHandler,t)},stickyHandler:function(t){for(var e=this,n=e.xscroll,i=(e.userConfig,e.isY?n.getScrollTop():n.getScrollLeft()),r=e.stickiesPos,s=e._,c=[],a=0,u=r.length;a<u;a++){var l=r[a][s.top];i>l&&c.push(a)}if(!c.length)return e.stickyElement&&(e.stickyElement.style.display="none"),void(e.curStickyIndex=void 0);var h=Math.max.apply(null,c);if(e.curStickyIndex!=h||t){var f=e.curStickyIndex;e.curStickyIndex=h,e.curStickyElement=e.stickyElements[h],e.curStickyPos=r[h],e.stickyElement=e.curStickyPos.el;for(var a=0,u=r.length;a<u;a++)r[a].el.style.display="none";var d={stickyElement:e.stickyElement,curStickyIndex:e.curStickyIndex,prevStickyIndex:f,curStickyPos:e.curStickyPos,isRender:e.curStickyPos.isRender};n.trigger("beforestickychange",d),e._stickyRenderFunc(e),n.trigger("stickychange",d)}var p=0;if(e.stickiesPos[e.curStickyIndex+1]){var g=e.stickiesPos[e.curStickyIndex],v=e.stickiesPos[e.curStickyIndex+1];p=i+g[s.height]>v[s.top]&&i+g[s.height]<v[s.top]+g[s.height]?g[s.height]+i-v[s.top]:0}e.stickyElement.style[o]=e.isY?"translateY(-"+p+"px) translateZ(0)":"translateX(-"+p+"px) translateZ(0)"},_stickyRenderFunc:function(t){var e=this,n=e._,i=e.userConfig.stickyRenderFunc,r=e.curStickyPos.el;e.curStickyPos.isRender||(r.style[n.left]=0,r.style[n.right]=0,i&&i.call(e,t)),r.style.display="block",e.curStickyPos.isRender=!0},destroy:function(){var t=this;t.stickyElements=void 0,t.stickiesNum=void 0,t.stickiesPos=void 0,i.remove(t.stickyElement),t.stickyElement=void 0}}),"object"==typeof module&&module.exports?e=c:c}(a),u=function(e){var i=t,r=n,o=(i.prefixStyle("transform"),function(t){o.superclass.constructor.call(this,t),this.userConfig=i.mix({fixedRenderTo:void 0,fixedElements:".xs-fixed",prefix:"xs-fixed-container",zoomType:"y"},t),this.init()});return i.extend(o,r,{fixedElements:[],init:function(){var t=this,e=t.userConfig,n=t.xscroll=e.xscroll;t.xscrollConfig=n.userConfig;return t.isY=!("y"!=e.zoomType),t._=t.isY?{top:"top",height:"height",width:"width",offsetTop:"offsetTop"}:{top:"left",height:"width",width:"height",offsetTop:"offsetLeft"},t.fixedRenderTo=i.getNode(e.fixedRenderTo),t},render:function(){var t=this,e=t.xscroll;t.infinite=e.getPlugin("infinite"),t.fixedRenderTo||(t.fixedRenderTo=document.createElement("div"),e.renderTo.appendChild(t.fixedRenderTo)),i.addClass(t.fixedRenderTo,t.userConfig.prefix);for(var n=t.originalFixedElements=t.getFixedElements(),r=0,o=n.length;r<o;r++)t.renderFixedElement(n[r],r,t.fixedRenderTo);return t},getFixedElements:function(){var t=this,e=t.infinite,n=t.userConfig;if(e){var r=[];for(var o in e.__serializedData){var s=e.__serializedData[o];s&&s.style&&"fixed"==s.style.position&&r.push(s)}return r}return i.getNodes(n.fixedElements,t.xscroll.content)},renderFixedElement:function(t,e,n){var r=this,o=!0,s=r._,c=r.xscroll,a=(r.userConfig,r.xscrollConfig),u=a.useOriginScroll,l=r.infinite,h=r.fixedElements[e];r.fixedElements[e]||(o=!1,u&&!l?(t.style.position="fixed",t.style.display="block"):(h=document.createElement("div"),l?(h.setAttribute("style",i.stringifyStyle(i.mix(t.style,{display:"block",width:"100%"}))),h.style[s.top]=(t.style[s.top]>=0?t.style[s.top]:t._top)+"px",t.style[s.height]&&(h.style[s.height]=t.style[s.height]+"px"),l.userConfig.renderHook.call(r,h,t)):(h.style.display="block",h.style.position="absolute",h.style[s.width]="100%",h.innerHTML=t.innerHTML,h.className=t.className,h.setAttribute("style",t.getAttribute("style")),h.style[s.top]=t[s.offsetTop]+"px",t.style.display="none"),n.appendChild(h),r.fixedElements.push(h))),c.trigger("fixedchange",{fixedIndex:e,fixedElement:u?t:h,originalFixedElement:t,isRender:o})},destroy:function(){var t=this;t.fixedElements=void 0}}),"object"==typeof module&&module.exports?e=o:o}(u),l=function(e){function i(t){i.superclass.constructor.call(this),this.userConfig=t,this.init()}var r=t,o=n,l=c,h=s,f=a,d=u,p=500,g="ease",v=.1;return r.extend(i,o,{version:"3.0.13",init:function(){var t=this,e={preventDefault:!0,bounce:!0,boundryCheck:!0,useTransition:!0,gpuAcceleration:!0,BOUNDRY_CHECK_EASING:g,BOUNDRY_CHECK_DURATION:p,BOUNDRY_CHECK_ACCELERATION:v,useOriginScroll:!1,zoomType:"y",indicatorInsets:{top:3,bottom:3,left:3,right:3,width:3,spacing:5},container:".xs-container",content:".xs-content",stickyElements:".xs-sticky",fixedElements:".xs-fixed",touchAction:"auto"};t.guid=r.guid(),t.renderTo=r.getNode(t.userConfig.renderTo),t.__timers={};var n=JSON.parse(t.renderTo.getAttribute("xs-cfg")),i=t.userConfig=r.mix(r.mix(e,n),t.userConfig);return t.container=r.getNode(i.container,t.renderTo),t.content=r.getNode(i.content,t.renderTo),t.boundry=new l,t.boundry.refresh(),t},destroy:function(){var t=this;t.mc&&t.mc.destroy(),t.sticky&&t.sticky.destroy(),t.fixed&&t.fixed.destroy()},_initContainer:function(){},enableGPUAcceleration:function(){return this.userConfig.gpuAcceleration=!0,this},disableGPUAcceleration:function(){return this.userConfig.gpuAcceleration=!1,this},getScrollPos:function(){var t=this;return{scrollLeft:t.getScrollLeft(),scrollTop:t.getScrollTop()}},getScrollTop:function(){},getScrollLeft:function(){},scrollTo:function(t,e,n,i,r){var o=this,t=void 0===t||isNaN(t)?-o.getScrollLeft():t,e=void 0===e||isNaN(e)?-o.getScrollTop():e;o.scrollLeft(t,n,i,r),o.scrollTop(e,n,i,r)},scrollBy:function(t,e,n,i,r){this.scrollByX(t,n,i,r),this.scrollByY(e,n,i,r)},scrollLeftBy:function(t,e,n,i){this.scrollLeft(Number(t)+Number(this.getScrollLeft()),e,n,i)},scrollTopBy:function(t,e,n,i){this.scrollTop(Number(t)+Number(this.getScrollTop()),e,n,i)},scrollLeft:function(t,e,n,i){},scrollTop:function(t,e,n,i){},resetSize:function(){var t=this;if(t.container&&t.content){var e=t.userConfig,n=getComputedStyle(t.renderTo),i=(t.width=(e.width||t.renderTo.offsetWidth)-r.px2Num(n["padding-left"])-r.px2Num(n["padding-right"]),t.height=(e.height||t.renderTo.offsetHeight)-r.px2Num(n["padding-top"])-r.px2Num(n["padding-bottom"]),e.containerWidth||t.content.offsetWidth),o=e.containerHeight||t.content.offsetHeight;return t.containerWidth=i<t.width?t.width:i,t.containerHeight=o<t.height?t.height:o,t.boundry.refresh({width:t.width,height:t.height}),t}},render:function(){var t=this;return t.resetSize(),t.initSticky(),t.initFixed(),t.trigger("afterrender",{type:"afterrender"}),t._bindEvt(),t.initTouchAction(),t},initTouchAction:function(){var t=this;return t.mc.set({touchAction:t.userConfig.touchAction}),t},initFixed:function(){var t=this,e=t.userConfig;return t.fixed=t.fixed||new d({fixedElements:e.fixedElements,xscroll:t,fixedRenderTo:e.fixedRenderTo}),t.fixed.render(),t.resetSize(),t},initSticky:function(){var t=this,e=t.userConfig,n=t.sticky=t.sticky||new f({xscroll:t,zoomType:e.zoomType,stickyRenderTo:e.stickyRenderTo});n.render()},boundryCheck:function(){return this},boundryCheckX:function(){return this},boundryCheckY:function(){return this},_bindEvt:function(){var t=this;if(!t.___isEvtBind){t.___isEvtBind=!0;var e=t.mc=new h.Manager(t.renderTo),n=new h.Tap,i=new h.Pan;new h.Pinch;e.add([n,i]),t.mc.on("panstart pan panend pancancel pinchstart pinchmove pinchend pinchcancel pinchin pinchout",function(e){t.trigger(e.type,e)});for(var r=["touchstart","touchmove","touchend","touchcancel","mousedown"],o=0,s=r.length;o<s;o++)t.renderTo.addEventListener(r[o],function(e){t.trigger(e.type,e)});return t.mc.on("tap",function(e){1==e.tapCount?(e.type="tap",t.trigger(e.type,e)):2==e.tapCount&&(e.type="doubletap",t.trigger("doubletap",e))}),t}},_resetLockConfig:function(){},stop:function(){}}),"object"==typeof module&&module.exports?e=i:i}(l),h=function(e){var n=t,i=o,r=40,s=10,c=50,a=n.prefixStyle("transform"),u=n.vendor?["-",n.vendor,"-transform"].join(""):"transform",l=n.prefixStyle("transition"),h=(n.prefixStyle("borderRadius"),n.prefixStyle("transitionDuration"),function(t){this.userConfig=n.mix({MIN_BAR_SCROLLED_SIZE:s,MIN_BAR_SIZE:c,MAX_BOUNCE_DISTANCE:r,spacing:5},t),this.init(t.xscroll)});return n.mix(h.prototype,{init:function(t){var e=this;e.xscroll=t,e.type=e.userConfig.type,e.isY="y"==e.type,e.scrollTopOrLeft=e.isY?"scrollTop":"scrollLeft"},destroy:function(){var t=this;n.remove(t.scrollbar),t.xscroll.off("scroll",t._scrollHandler,t),t.xscroll.off("scrollend",t._scrollEndHandler,t)},render:function(){var t=this,e=t.xscroll,i=(e.boundry,t.xscroll.userConfig.indicatorInsets),r=e.userConfig.gpuAcceleration?" translateZ(0) ":"",o=r?u+":"+r+";":"",s="opacity:0;position:absolute;z-index:999;overflow:hidden;-webkit-border-radius:3px;-moz-border-radius:3px;-o-border-radius:3px;"+o;i._xright=i.right+i.spacing,i._xbottom=i.bottom+i.spacing;var c=t.isY?n.substitute("width:{width}px;bottom:{_xbottom}px;top:{top}px;right:{right}px;",i)+s:n.substitute("height:{width}px;left:{left}px;right:{_xright}px;bottom:{bottom}px;",i)+s;t.scrollbar||(t.scrollbar=document.createElement("div"),t.indicate=document.createElement("div"),e.renderTo.appendChild(t.scrollbar),t.scrollbar.appendChild(t.indicate)),t.scrollbar.style.cssText=c;var a=t.isY?"width:100%;":"height:100%;";t.indicate.style.cssText=a+"position:absolute;background:rgba(0,0,0,0.3);-webkit-border-radius:3px;-moz-border-radius:3px;-o-border-radius:3px;",t._update(),t.hide(0),t._bindEvt()},_update:function(t,e,n,i){var r=this,t=void 0===t?r.isY?r.xscroll.getScrollTop():r.xscroll.getScrollLeft():t,o=r.computeScrollBar(t),s=r.isY?"height":"width";r.indicate.style[s]=Math.round(o.size)+"px",e&&n?r.scrollTo(o.pos,e,n,i):r.moveTo(o.pos)},computeScrollBar:function(t){var e=this,n=(e.isY?"y":"x",e.userConfig.spacing),i=e.xscroll,r=i.boundry,o=e.userConfig,t=e.isY?Math.round(t)+r._xtop:Math.round(t)+r._xleft,s=o.MIN_BAR_SCROLLED_SIZE,c=o.MIN_BAR_SIZE,a=o.MAX_BOUNCE_DISTANCE;e.containerSize=e.isY?i.containerHeight+r._xtop+r._xbottom:e.xscroll.containerWidth+r._xright+r._xleft,e.size=e.isY?r.cfg.height:r.cfg.width,e.indicateSize=e.isY?r.cfg.height-2*n:r.cfg.width-2*n;var u=e.indicateSize,l=e.containerSize,h=u*t/l,f=Math.round(u*e.size/l),d=e.isY?i.getBoundryOutTop():i.getBoundryOutLeft(),p=e.isY?i.getBoundryOutBottom():i.getBoundryOutRight(),g=c-f>0?c-f:0;if(f=f<c?c:f,h=(u-g)*t/l,d>=0){var v=d/a;v=v>1?1:v,h=-v*(f-s)}if(p>=0){var v=p/a;v=v>1?1:v,h=v*(f-s)+u-f}return e.barPos=Math.round(h),{size:Math.round(f),pos:e.barPos}},scrollTo:function(t,e,n,r){var o=this;o.show();var s=o.xscroll.userConfig.gpuAcceleration?" translateZ(0) ":"",c={css:{transform:o.isY?"translateY("+t+"px)"+s:"translateX("+t+"px)"+s},duration:e,easing:n,useTransition:o.xscroll.userConfig.useTransition,end:r};o.__timer=o.__timer||new i(o.indicate,c),o.__timer.stop(),o.__timer.reset(c),o.__timer.run()},moveTo:function(t){var e=this;e.show();var n=e.xscroll.userConfig.gpuAcceleration?" translateZ(0) ":"";e.isY?e.indicate.style[a]="translateY("+t+"px) "+n:e.indicate.style[a]="translateX("+t+"px) "+n,e.indicate.style[l]=""},_scrollHandler:function(t){var e=this;return e._update(t[e.scrollTopOrLeft]),e},isBoundryOut:function(){var t=this;return t.isY?t.xscroll.isBoundryOutTop()||t.xscroll.isBoundryOutBottom():t.xscroll.isBoundryOutLeft()||t.xscroll.isBoundryOutRight()},_scrollEndHandler:function(t){var e=this;return e.isBoundryOut()||(e._update(t[e.scrollTopOrLeft]),e.hide()),e},_bindEvt:function(){var t=this;t.__isEvtBind||(t.__isEvtBind=!0,t.xscroll.on("scroll",t._scrollHandler,t),t.xscroll.on("scrollend",t._scrollEndHandler,t))},reset:function(){var t=this;t.pos=0,t._update()},hide:function(t,e,n){var i=this,t=t>=0?t:300,n=n>=0?n:100;i.scrollbar.style.opacity=0,i.scrollbar.style[l]=["opacity ",t,"ms "," ease-out ",n,"ms"].join("")},show:function(){var t=this;t.scrollbar.style.opacity=1,t.scrollbar.style[l]=""}}),"object"==typeof module&&module.exports?e=h:h}(h),f=function(e){var i=t,r=n,o=function(t){o.superclass.constructor.call(this,t),this.userConfig=i.mix({},t),this.init()};return i.extend(o,r,{init:function(){var t=this;t.xscroll=t.userConfig.xscroll},add:function(t,e){var n=this;if(e=i.extend({captureBounce:!1,stopPropagation:!0},e),n.__scrolls||(n.__scrolls={}),t.guid&&!n.__scrolls[t.guid])return t.parentscroll=n.xscroll,n._bind(t),n.__scrolls[t.guid]=t},remove:function(t){var e=this;if(t&&t.guid){var n=e.__scrolls[t.guid];n&&(n.parentscroll=null,e._unbind(t),n=null)}},get:function(t){return t?this.__scrolls[t]:this.__scrolls},_unbind:function(t){},_bind:function(t){var e=this,n=e.xscroll;n.renderTo.addEventListener("touchstart",function(){n._resetLockConfig()}),t.renderTo.addEventListener("touchstart",function(){t._resetLockConfig()}),n.on("panend",n._resetLockConfig),t.on("panend",t._resetLockConfig),t.on("panstart",function(e){if(!t.userConfig.lockY&&!n.userConfig.lockY){if(t.isBoundryOut())return void(n.userConfig.lockY=!0);16==e.direction&&t.getBoundryOutTop()>=0?t.userConfig.lockY=!0:8==e.direction&&t.getBoundryOutTop()>=0&&t.getBoundryOutBottom()<0&&(n.userConfig.lockY=!0),8==e.direction&&t.getBoundryOutBottom()>=0?t.userConfig.lockY=!0:16==e.direction&&t.getBoundryOutBottom()>=0&&t.getBoundryOutTop()<0&&(n.userConfig.lockY=!0),t.getBoundryOutTop()<0&&t.getBoundryOutBottom()<0&&(n.userConfig.lockY=!0)}if(!t.userConfig.lockX&&!n.userConfig.lockX){if(t.isBoundryOut())return void(n.userConfig.lockX=!0);4==e.direction&&t.getBoundryOutLeft()>=0?t.userConfig.lockX=!0:2==e.direction&&t.getBoundryOutLeft()>=0&&t.getBoundryOutRight()<0&&(n.userConfig.lockX=!0),2==e.direction&&t.getBoundryOutRight()>=0?t.userConfig.lockX=!0:4==e.direction&&t.getBoundryOutRight()>=0&&t.getBoundryOutLeft()<0&&(n.userConfig.lockX=!0),t.getBoundryOutLeft()<0&&t.getBoundryOutRight()<0&&(n.userConfig.lockX=!0)}!t.userConfig.lockX&&n.userConfig.lockX&&(2==e.direction||4==e.direction?n.userConfig.lockY=!0:t.userConfig.lockX=!0),!t.userConfig.lockY&&n.userConfig.lockY&&(8==e.direction||16==e.direction?n.userConfig.lockX=!0:t.userConfig.lockY=!0)})}}),"object"==typeof module&&module.exports?e=o:o}(f),d=function(e){function n(t){n.superclass.constructor.call(this,t)}var i=t,r=l,c=o,a=s,u=h,d=f,p=.382,g=5e-4,v=.03,m=i.prefixStyle("transformOrigin"),y=i.prefixStyle("transform");return i.extend(n,r,{init:function(){var t=this,e={preventDefault:!0,preventTouchMove:!0};return n.superclass.init.call(this),t.userConfig=i.mix(e,t.userConfig),t.SCROLL_ACCELERATION=t.userConfig.SCROLL_ACCELERATION||g,t.BOUNDRY_ACCELERATION=t.userConfig.BOUNDRY_ACCELERATION||v,t._initContainer(),t.resetSize(),t._setOverflowBehavior(),t.defaltConfig={lockY:t.userConfig.lockY,lockX:t.userConfig.lockX},t},destroy:function(){var t=this;n.superclass.destroy.call(this),t.renderTo.style.overflow="",t.renderTo.style.touchAction="",t.container.style.transform="",t.container.style.transformOrigin="",t.content.style.transform="",t.content.style.transformOrigin="",t.off("touchstart mousedown",t._ontouchstart),t.off("touchmove",t._ontouchmove),window.removeEventListener("resize",t.resizeHandler,t),t.destroyScrollBars()},_setOverflowBehavior:function(){var t=this,e=t.renderTo,n=getComputedStyle(e);return t.userConfig.lockX=void 0===t.userConfig.lockX?"hidden"==n["overflow-x"]||t.width==t.containerWidth:t.userConfig.lockX,t.userConfig.lockY=void 0===t.userConfig.lockY?"hidden"==n["overflow-y"]||t.height==t.containerHeight:t.userConfig.lockY,t.userConfig.scrollbarX=void 0===t.userConfig.scrollbarX?!t.userConfig.lockX:t.userConfig.scrollbarX,t.userConfig.scrollbarY=void 0===t.userConfig.scrollbarY?!t.userConfig.lockY:t.userConfig.scrollbarY,t},_resetLockConfig:function(){var t=this;return t.userConfig.lockX=t.defaltConfig.lockX,t.userConfig.lockY=t.defaltConfig.lockY,t},_initContainer:function(){var t=this;if(n.superclass._initContainer.call(t),!t.__isContainerInited&&t.container&&t.content)return t.container.style[m]="0 0",t.content.style[m]="0 0",t.translate(0,0),t.__isContainerInited=!0,t},getScrollTop:function(){var t=window.getComputedStyle(this.container)[y].match(/[-\d\.*\d*]+/g);return t?0===Math.round(t[5])?0:-Math.round(t[5]):0},getScrollLeft:function(){var t=window.getComputedStyle(this.content)[y].match(/[-\d\.*\d*]+/g);return t?0===Math.round(t[4])?0:-Math.round(t[4]):0},scrollLeft:function(t,e,n,i){if(!this.userConfig.lockX){var r=this.userConfig.gpuAcceleration?" translateZ(0) ":"";return this.x=void 0===t||isNaN(t)||0===t?0:-Math.round(t),this._animate("x","translateX("+this.x+"px) scale("+this.scale+")"+r,e,n,i),this}},scrollTop:function(t,e,n,i){if(!this.userConfig.lockY){var r=this.userConfig.gpuAcceleration?" translateZ(0) ":"";return this.y=void 0===t||isNaN(t)||0===t?0:-Math.round(t),this._animate("y","translateY("+this.y+"px) "+r,e,n,i),this}},translate:function(t,e,n){var i=this.userConfig.gpuAcceleration?" translateZ(0) ":"";return this.x=t||this.x||0,this.y=e||this.y||0,this.scale=n||this.scale||1,this.content.style[y]="translate("+this.x+"px,0px) scale("+this.scale+") "+i,this.container.style[y]="translate(0px,"+this.y+"px) "+i,this},_animate:function(t,e,n,i,r){var o=this,n=n||0,i=i||"quadratic",s="y"==t?o.container:o.content,a={css:{transform:e},duration:n,easing:i,run:function(t){o.trigger("scroll",{scrollTop:o.getScrollTop(),scrollLeft:o.getScrollLeft(),type:"scroll"})},useTransition:o.userConfig.useTransition,end:function(e){r&&r(),0!==o["_bounce"+t]&&void 0!==o["_bounce"+t]||"linear"==i||(o["isScrolling"+t.toUpperCase()]=!1,o["isRealScrolling"+t.toUpperCase()]=!1,o.trigger("scrollend",{type:"scrollend",scrollTop:o.getScrollTop(),scrollLeft:o.getScrollLeft(),zoomType:t,duration:n,easing:i}))}},u=o.__timers[t]=o.__timers[t]||new c(s,a);return u.stop(),u.reset(a),u.run(),o.trigger("scrollanimate",{type:"scrollanimate",scrollTop:-o.y,scrollLeft:-o.x,duration:n,easing:i,zoomType:t}),this},_ontap:function(t){var e=this;e.boundryCheck(),!e.isRealScrollingX&&!e.isRealScrollingY,e.isRealScrollingY=!1,e.isRealScrollingY=!1},_bindEvt:function(){n.superclass._bindEvt.call(this);var t=this;if(!t.__isEvtBind){t.__isEvtBind=!0;var e=new a.Pinch;return t.mc.add(e),t.on("touchstart mousedown",t._ontouchstart,t),t.on("touchmove",t._ontouchmove,t),t.on("tap",t._ontap,t),t.on("panstart",t._onpanstart,t),t.on("pan",t._onpan,t),t.on("panend",t._onpanend,t),t.resizeHandler=function(e){setTimeout(function(){t.resetSize(),t.boundryCheck(0),t.render()},100)},window.addEventListener("resize",t.resizeHandler,t),this}},_ontouchstart:function(t){var e=this;!/(SELECT|INPUT|TEXTAREA)/i.test(t.target.tagName)&&e.userConfig.preventDefault&&t.preventDefault(),e.stop()},_ontouchmove:function(t){this.userConfig.preventTouchMove&&t.preventDefault()},_onpanstart:function(t){this.userConfig.preventTouchMove&&t.preventDefault();var e=this,n=e.getScrollLeft(),i=e.getScrollTop();e.stop(),e.translate(-n,-i);var r=e.mc.get("pan").options.threshold;return e.thresholdY="8"==t.direction?r:"16"==t.direction?-r:0,e.thresholdX="2"==t.direction?r:"4"==t.direction?-r:0,e},_onpan:function(t){this.userConfig.preventTouchMove&&t.preventDefault();var e=this,n=e.boundry,i=e.userConfig,r=i.boundryCheck,o=i.bounce,s=e.__topstart||(e.__topstart=-e.getScrollTop()),c=e.__leftstart||(e.__leftstart=-e.getScrollLeft()),a=i.lockY?Number(s):Number(s)+(t.deltaY+e.thresholdY),u=i.lockX?Number(c):Number(c)+(t.deltaX+e.thresholdX),l=e.containerWidth,h=e.containerHeight;return r&&(a=a>n.top?o?(a-n.top)*p+n.top:n.top:a,a=a<n.bottom-h?o?a+(n.bottom-h-a)*p:n.bottom-h:a,u=u>n.left?o?(u-n.left)*p+n.left:n.left:u,u=u<n.right-l?o?u+(n.right-l-u)*p:n.right-l:u),e.translate(u,a),e.directionX="panleft"==t.type?"right":"panright"==t.type?"left":"",e.directionY="panup"==t.type?"down":"pandown"==t.type?"up":"",e.trigger("scroll",{scrollTop:-a,scrollLeft:-u,triggerType:"pan",type:"scroll"}),e},_onpanend:function(t){var e,n=this,i=(n.userConfig,n.computeScroll("x",t.velocityX)),r=n.computeScroll("y",t.velocityY),o=i?i.pos:0,s=r?r.pos:0;return i&&r&&"inside"==i.status&&"inside"==r.status&&i.duration&&r.duration&&(e=Math.max(i.duration,r.duration)),i&&n.scrollLeft(o,e||i.duration,i.easing,function(t){n.boundryCheckX()}),r&&n.scrollTop(s,e||r.duration,r.easing,function(t){n.boundryCheckY()}),n.directionX=t.velocityX<0?"left":"right",n.directionY=t.velocityY<0?"up":"down",n.__topstart=null,n.__leftstart=null,n},isBoundryOut:function(){return this.isBoundryOutLeft()||this.isBoundryOutRight()||this.isBoundryOutTop()||this.isBoundryOutBottom()},isBoundryOutLeft:function(){return this.getBoundryOutLeft()>0},isBoundryOutRight:function(){return this.getBoundryOutRight()>0},isBoundryOutTop:function(){return this.getBoundryOutTop()>0},isBoundryOutBottom:function(){return this.getBoundryOutBottom()>0},getBoundryOutTop:function(){return-this.boundry.top-this.getScrollTop()},getBoundryOutLeft:function(){return-this.boundry.left-this.getScrollLeft()},getBoundryOutBottom:function(){return this.boundry.bottom-this.containerHeight+this.getScrollTop()},getBoundryOutRight:function(){return this.boundry.right-this.containerWidth+this.getScrollLeft()},computeScroll:function(t,e){var n=this,i=n.userConfig,r=n.boundry,o="x"==t?n.getScrollLeft():n.getScrollTop(),s="x"==t?r.left:r.top,c="x"==t?r.right:r.bottom,a="x"==t?n.containerWidth:n.containerHeight,u=i.maxSpeed||2,l=i.boundryCheck,h=i.bounce,f={},d="inside";if(l){if("x"==t&&(n.isBoundryOutLeft()||n.isBoundryOutRight()))return void n.boundryCheckX();if("y"==t&&(n.isBoundryOutTop()||n.isBoundryOutBottom()))return void n.boundryCheckY()}if(!("x"==t&&n.userConfig.lockX||"y"==t&&n.userConfig.lockY)){e=e>u?u:e<-u?-u:e;var p=n.SCROLL_ACCELERATION*(e/(Math.abs(e)||1)),g=n.BOUNDRY_ACCELERATION,v=isNaN(e/p)?0:e/p,m=Number(o)+v*e/2;if(m<-s&&l){var y=-s-o,_=(Math.sqrt(-2*p*y+e*e)+e)/p,x=e-p*_,T=Math.abs(x/g),C=x/2*T;v=_+T,m=h?-s+C:-s,d="outside"}else if(m>a-c&&l){var y=c-a+o,_=(Math.sqrt(-2*p*y+e*e)-e)/p,x=e-p*_,T=Math.abs(x/g),C=x/2*T;v=_+T,m=h?a-c+C:a-c,d="outside"}if(!isNaN(m)&&!isNaN(v)){f.pos=m,f.duration=v,f.easing=Math.abs(e)>2?"circular":"quadratic",f.status=d;var b=t.toUpperCase();return n["isScrolling"+b]=!0,n["isRealScrolling"+b]=!0,f}}},boundryCheckX:function(t,e,n){var i=this;if(i.userConfig.boundryCheck&&("function"==typeof arguments[0]?(n=arguments[0],t=i.userConfig.BOUNDRY_CHECK_DURATION,e=i.userConfig.BOUNDRY_CHECK_EASING):(t=0===t?0:i.userConfig.BOUNDRY_CHECK_DURATION,e=e||i.userConfig.BOUNDRY_CHECK_EASING),i.userConfig.bounce&&!i.userConfig.lockX)){var r=i.boundry;return i.isBoundryOutLeft()?i.scrollLeft(-r.left,t,e,n):i.isBoundryOutRight()&&i.scrollLeft(i.containerWidth-r.right,t,e,n),i}},boundryCheckY:function(t,e,n){var i=this;if(i.userConfig.boundryCheck&&("function"==typeof arguments[0]?(n=arguments[0],t=i.userConfig.BOUNDRY_CHECK_DURATION,e=i.userConfig.BOUNDRY_CHECK_EASING):(t=0===t?0:i.userConfig.BOUNDRY_CHECK_DURATION,e=e||i.userConfig.BOUNDRY_CHECK_EASING),i.userConfig.boundryCheck&&!i.userConfig.lockY)){var r=i.boundry;return i.isBoundryOutTop()?i.scrollTop(-r.top,t,e,n):i.isBoundryOutBottom()&&i.scrollTop(i.containerHeight-r.bottom,t,e,n),i}},boundryCheck:function(t,e,n){return this.boundryCheckX(t,e,n),this.boundryCheckY(t,e,n),this},stop:function(){var t=this;if(t.__timers.x&&t.__timers.x.stop(),t.__timers.y&&t.__timers.y.stop(),t.isScrollingX||t.isScrollingY){var e=t.getScrollTop(),n=t.getScrollLeft();t.trigger("scrollend",{scrollTop:e,scrollLeft:n}),t.trigger("stop",{scrollTop:e,scrollLeft:n}),t.isScrollingX=!1,t.isScrollingY=!1}return t},render:function(){var t=this;return n.superclass.render.call(this),"static"==getComputedStyle(t.renderTo).position&&(t.renderTo.style.position="relative"),t.renderTo.style.overflow="hidden",t.initScrollBars(),t.initController(),t},initScrollBars:function(){var t=this;if(t.userConfig.boundryCheck){var e=t.userConfig.indicatorInsets;return t.userConfig.scrollbarX&&(t.scrollbarX=t.scrollbarX||new u({xscroll:t,type:"x",spacing:e.spacing}),t.scrollbarX.render(),t.scrollbarX._update(),t.scrollbarX.hide()),t.userConfig.scrollbarY&&(t.scrollbarY=t.scrollbarY||new u({xscroll:t,type:"y",spacing:e.spacing}),t.scrollbarY.render(),t.scrollbarY._update(),t.scrollbarY.hide()),t}},destroyScrollBars:function(){return this.scrollbarX&&this.scrollbarX.destroy(),this.scrollbarY&&this.scrollbarY.destroy(),this},initController:function(){var t=this;return t.controller=t.controller||new d({xscroll:t}),t},_unPreventHref:function(t){var e=i.findParentEl(t.target,"a",this.renderTo);if(e&&"a"==e.tagName.toLowerCase()){var n=e.getAttribute("data-xs-href");n&&e.setAttribute("href",n)}},_preventHref:function(t){var e=i.findParentEl(t.target,"a",this.renderTo);if(e&&"a"==e.tagName.toLowerCase()){var n=e.getAttribute("href");n&&e.setAttribute("href","javascript:void(0)"),n&&e.setAttribute("data-xs-href",n)}},_triggerClick:function(t){var e=t.target;if(!/(SELECT|INPUT|TEXTAREA)/i.test(e.tagName)){var n=document.createEvent("MouseEvents");n.initMouseEvent("click",!0,!0,t.view,1,e.screenX,e.screenY,e.clientX,e.clientY,t.ctrlKey,t.altKey,t.shiftKey,t.metaKey,0,null),e.dispatchEvent(n)}}}),"object"==typeof module&&module.exports?e=n:n}(d),p=function(e){function n(t){n.superclass.constructor.call(this,t)}var i=t,r=l,s=o;i.prefixStyle("transformOrigin");return i.extend(n,r,{init:function(){var t=this;n.superclass.init.call(this),t.resetSize()},getScrollTop:function(){return this.renderTo.scrollTop},getScrollLeft:function(){return this.renderTo.scrollLeft},scrollTop:function(t,e,n,i){var r=this,t=Math.round(t);if(!r.userConfig.lockY){var e=e||0,n=n||"quadratic",o={css:{scrollTop:t},duration:e,easing:n,run:function(t){r.trigger("scroll",{scrollTop:r.getScrollTop(),scrollLeft:r.getScrollLeft()})},useTransition:!1,end:i};r.__timers.y=r.__timers.y||new s(r.renderTo,o),r.__timers.y.stop(),r.__timers.y.reset(o),r.__timers.y.run()}},scrollLeft:function(t,e,n,i){var r=this,t=Math.round(t);if(!r.userConfig.lockX){var e=e||0,n=n||"quadratic",o={css:{scrollLeft:t},duration:e,easing:n,run:function(t){r.trigger("scroll",{scrollTop:r.getScrollTop(),scrollLeft:r.getScrollLeft()})},useTransition:!1,end:i};r.__timers.x=r.__timers.x||new s(r.renderTo,o),r.__timers.x.stop(),r.__timers.x.reset(o),r.__timers.x.run()}},_bindEvt:function(){n.superclass._bindEvt.call(this);var t=this;t.__isEvtBind||(t.__isEvtBind=!0,t.renderTo.addEventListener("scroll",function(e){t.trigger("scroll",{type:"scroll",scrollTop:t.getScrollTop(),scrollLeft:t.getScrollLeft()})},!1))}}),"object"==typeof module&&module.exports?e=n:n}(p),g=function(e){var i=t,c=n,a=r,u=o,l=s,h=d,f=p,g=function(t){var e=t&&t.useOriginScroll?f:h;return new e(t)};return g.Util=i,g.Base=c,g.Timer=a,g.Animate=u,g.Hammer=l,g.Plugins={},"object"==typeof module&&module.exports?e=g:window.XScroll=g}(g),v=function(e){var i=t,r=n,o=g,s=function(t){s.superclass.constructor.call(this,t),this.init(t)};return i.extend(s,r,{init:function(t){var e=this;return e.userConfig=i.mix({selector:".xscroll"},t),e},get:function(t){var e=this;if(t)for(var n=0,i=e.xscrolls.length;n<i;n++)if(e.xscrolls[n].renderTo.id===t)return e.xscrolls[n]},getElPos:function(){for(var t=this,e=[],n=document.querySelectorAll(t.userConfig.selector),i=0;i<n.length;i++){var r=n[i].querySelector(".xs-content");e.push({el:n[i],containerWidth:r.offsetWidth,containerHeight:r.offsetHeight,width:n[i].offsetWidth,height:n[i].offsetHeight})}return e},render:function(){var t=this,e=function(t,e){if(t&&e)for(var n=0,i=e.length;n<i;n++)if(e[n].renderTo===t)return e[n]},n=document.querySelectorAll(t.userConfig.selector),i=t.getElPos();for(var r in t.xscrolls)t.xscrolls[r].destroy();t.xscrolls=[];for(var r=0;r<n.length;r++)t.xscrolls.push(new o({renderTo:n[r],containerWidth:i[r].containerWidth,containerHeight:i[r].containerHeight,width:i[r].width,height:i[r].height}).render());for(var r=0,s=t.xscrolls.length;r<s;r++)for(var c=t.xscrolls[r].renderTo.querySelectorAll(t.userConfig.selector),a=0;a<c.length;a++){var u=e(c[a],t.xscrolls);u&&t.xscrolls[r].controller&&t.xscrolls[r].controller.add(u)}return t._bindEvt(),t},_bindEvt:function(){var t=this;window.addEventListener("resize",function(e){setTimeout(function(){for(var e=t.getElPos(),n=0,i=t.xscrolls.length;n<i;n++){var r=t.xscrolls[n];r.userConfig.containerWidth=e[n].containerWidth,r.userConfig.containerHeight=e[n].containerHeight,r.userConfig.width=e[n].width,r.userConfig.height=e[n].height,r.boundry.refresh({width:r.userConfig.width,height:r.userConfig.height}),r.boundryCheck(0),r.render()}},0)},t)}}),"object"==typeof module&&module.exports?e=s:window.XScrollMaster=s}(v)}();