-
Notifications
You must be signed in to change notification settings - Fork 69
/
ml-min.js
2 lines (2 loc) · 52.2 KB
/
ml-min.js
1
2
!function(e,t){function n(){var t=o.getBoundingClientRect().width;t/l>540&&(t=540*l);var n=t/10;o.style.fontSize=n+"px",u.rem=e.rem=n}var i,r=e.document,o=r.documentElement,a=r.querySelector('meta[name="viewport"]'),s=r.querySelector('meta[name="flexible"]'),l=0,c=0,u=t.flexible||(t.flexible={});if(a){console.warn("将根据已有的meta标签来设置缩放比例");var f=a.getAttribute("content").match(/initial\-scale=([\d\.]+)/);f&&(c=parseFloat(f[1]),l=parseInt(1/c))}else if(s){var d=s.getAttribute("content");if(d){var p=d.match(/initial\-dpr=([\d\.]+)/),h=d.match(/maximum\-dpr=([\d\.]+)/);p&&(l=parseFloat(p[1]),c=parseFloat((1/l).toFixed(2))),h&&(l=parseFloat(h[1]),c=parseFloat((1/l).toFixed(2)))}}if(!l&&!c){var m=(e.navigator.appVersion.match(/android/gi),e.navigator.appVersion.match(/iphone/gi)),v=e.devicePixelRatio;l=m?v>=3&&(!l||l>=3)?3:v>=2&&(!l||l>=2)?2:1:1,c=1/l}if(o.setAttribute("data-dpr",l),!a)if(a=r.createElement("meta"),a.setAttribute("name","viewport"),a.setAttribute("content","initial-scale="+c+", maximum-scale="+c+", minimum-scale="+c+", user-scalable=no"),o.firstElementChild)o.firstElementChild.appendChild(a);else{var y=r.createElement("div");y.appendChild(a),r.write(y.innerHTML)}e.addEventListener("resize",function(){clearTimeout(i),i=setTimeout(n,300)},!1),e.addEventListener("pageshow",function(e){e.persisted&&(clearTimeout(i),i=setTimeout(n,300))},!1),"complete"===r.readyState?r.body.style.fontSize=12*l+"px":r.addEventListener("DOMContentLoaded",function(){r.body.style.fontSize=12*l+"px"},!1),n(),u.dpr=e.dpr=l,u.refreshRem=n,u.rem2px=function(e){var t=parseFloat(e)*this.rem;return"string"==typeof e&&e.match(/rem$/)&&(t+="px"),t},u.px2rem=function(e){var t=parseFloat(e)/this.rem;return"string"==typeof e&&e.match(/px$/)&&(t+="rem"),t}}(window,window.lib||(window.lib={})),function(e,t){var n,i,r=e.MutationObserver||e.WebKitMutationObserver;if(r){var o=[],a=new r(function(){var e=o.slice();o=[],e.forEach(function(e){e[0].call(e[1])})}),s=document.createElement("div");a.observe(s,{attributes:!0}),window.addEventListener("unload",function(){a.disconnect(),a=null}),n=function(e,t){o.push([e,t]),s.setAttribute("drainQueue","drainQueue")}}else n=function(e,t){setTimeout(function(){e.call(t)},1)};var l=function(e,t,n,i){return{enumerable:!!t,configurable:!0,writable:!0,value:e||function(){}}},c=function(e){return l(e,0,1,0)},u=function(e){return l(e,1)},f=function(e){if(void 0===e)return!1;try{var t=e.then;if("function"==typeof t)return!0}catch(n){}return!1},d=function(e){Error.call(this,e)};d.prototype=Object.create(Error.prototype);var p=function(){var e=[];return e.pump=function(t){n(function(){for(var n=e.length,i=0;n>i;)i++,e.shift()(t)})},e},h=function(e,t,i,r,o,a){var s=!1,l=this,c=function(e){n(function(){a("fulfilled"),r(e),t.pump(e)})},u=function(e){n(function(){a("rejected"),o(e),i.pump(e)})},d=function(e){return f(e)?void e.then(d,u):void c(e)},p=function(e){return function(t){s?"undefined"!=typeof console&&console.error("Cannot resolve a Promise multiple times."):(s=!0,e(t))}};this.resolve=p(d,"resolve"),this.fulfill=p(c,"fulfill"),this.reject=p(u,"reject"),this.cancel=function(){l.reject(new Error("Cancel"))},this.timeout=function(){l.reject(new Error("Timeout"))},a("pending")},i=function(e){var t,n,i=new p,r=new p,o="pending";Object.defineProperties(this,{_addAcceptCallback:c(function(e){i.push(e),"fulfilled"==o&&i.pump(t)}),_addRejectCallback:c(function(e){r.push(e),"rejected"==o&&r.pump(n)})});var a=new h(this,i,r,function(e){t=e},function(e){n=e},function(e){o=e});try{e&&e(a)}catch(s){a.reject(s),console.log(s)}},m=function(e){return"function"==typeof e},v=function(e,t,n){return m(e)?function(){try{var n=e.apply(null,arguments);t.resolve(n)}catch(i){t.reject(i),console.log(i)}}:t[n].bind(t)},y=function(e,t,n){return m(e)&&n._addAcceptCallback(e),m(t)&&n._addRejectCallback(t),n};i.prototype=Object.create(null,{then:u(function(e,t){var n=this;return new i(function(i){y(v(e,i,"resolve"),v(t,i,"reject"),n)})}),"catch":u(function(e){var t=this;return new i(function(n){y(null,v(e,n,"reject"),t)})})}),i.isThenable=f;var g=function(e){return Array.prototype.slice.call(e).map(i.resolve)};i.any=function(){var e=g(arguments);return new i(function(t){if(e.length){var n=!1,i=function(e){n||(n=!0,t.resolve(e))},r=function(e){n||(n=!0,t.reject(e))};e.forEach(function(e){e.then(i,r)})}else t.reject("No futures passed to Promise.any()")})},i.every=function(){var e=g(arguments);return new i(function(t){if(e.length){var n=new Array(e.length),i=0,r=function(r,o){i++,n[r]=o,i==e.length&&t.resolve(n)};e.forEach(function(e,n){e.then(r.bind(null,n),t.reject)})}else t.reject("No futures passed to Promise.every()")})},i.some=function(){var e=g(arguments);return new i(function(t){if(e.length){var n=0,i=function(){n++,n==e.length&&t.reject()};e.forEach(function(e){e.then(t.resolve,i)})}else t.reject("No futures passed to Promise.some()")})},i.fulfill=function(e){return new i(function(t){t.fulfill(e)})},i.resolve=function(e){return new i(function(t){t.resolve(e)})},i.reject=function(e){return new i(function(t){t.reject(e)})},i.deferred=function(){var e,t=new i(function(t){e=t}),n={};return["resolve","reject","fulfill","timeout","cancel"].forEach(function(t){n[t]=function(){e[t].apply(t,arguments)}}),n.promise=function(e){return e?(["then","catch"].forEach(function(n){e[n]=function(){return t[n].apply(t,arguments)}}),e):t},n},window.$&&!window.$.Deferred&&(window.$.Deferred=function(){var e=i.deferred();return e.resolveWith=function(e,t){this.resolve.apply(e,t)},e.rejectWith=function(e,t){this.reject.apply(e,t)},e}),t.promise=i}(window,window.lib||(window.lib={})),function(e,t){function n(e){e=e||"";var t=this,n={};if(e&&"string"==typeof e)for(var i=e.split("&"),r=0;r<i.length;r++){var o=i[r].split("=");n[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}else if("object"==typeof e)for(var a in e)n[a]=e[a];for(var a in n)!function(e){Object.defineProperty(t,e,{get:function(){return n[e]},set:function(t){n[e]=t},enumerable:!0})}(a);this.toString=function(){return Object.keys(n).sort().map(function(e){return encodeURIComponent(e)+"="+encodeURIComponent(n[e])}).join("&")}}function i(){function t(t){var n=r.createElement("a");n.href=t,n.style.cssText="display:none;",r.body.appendChild(n);var i;e.MouseEvent?i=new MouseEvent("click",{view:window,bubbles:!1,cancelable:!1}):(i=r.createEvent("HTMLEvents"),i.initEvent("click",!1,!1)),i?n.dispatchEvent(i):o.href=t}function i(e,t){var n=r.createEvent("HTMLEvents");if(n.initEvent(e,!1,!1),t)for(var i in t)n[i]=t[i];window.dispatchEvent(n)}function s(){this.exec=function(){i("navigation:push")}}function l(){this.exec=function(){i("navigation:pop")}}function c(){this.exec=function(){i("navigation:replace")}}function u(e,t){return e.name===t.name&&e.args.toString()===t.args.toString()}var f=this,d=[],p=!!a.state,h={},m="initial";d.exec=function(){d.length&&d.shift().exec()},this.push=function(e,r){var o={name:e,args:new n(r),id:h.state.id+1};if(!u(o,h.state)){m="push";var s=o.args.toString();if(p){var l="#"+o.name+(s?"?"+s:"");a.pushState({name:o.name,args:s,id:o.id},null,l),i("pushstate")}else{var l="#"+o.name+"["+o.id+"]"+(s?"?"+s:"");t(l)}}},this.pop=function(){h.state.id>1&&(m="pop",a.back())},this.replace=function(e,r){var o={name:e,args:new n(r),id:h.state.id};if(!u(o,h.state)){m="replace";var s=o.args.toString();if(p){var l="#"+o.name+(s?"?"+s:"");a.replaceState({name:o.name,args:s,id:o.id},null,l),i("replacestate")}else{var l="#"+o.name+"["+o.id+"]"+(s?"?"+s:"");t(l)}}};var v=!1;this.start=function(t){function i(){var e;if(p&&null!=a.state&&a.state!==!0)e={id:a.state.id,name:a.state.name,args:new n(a.state.args)};else{var t=o.hash,i=t.match(/#([^\[\]\?]+)(?:\[(\d+)\])?(?:\?(.*))?/)||["",u,1,y];e={name:i[1],id:parseInt(i[2]||1),args:new n(i[3]||"")}}return e}function r(){var e=i(),t=h.state;h.state=e,e.id<t.id?(m="pop",d.push(new l(e,e.id-t.id))):e.id===t.id?"replace"===f.action?d.push(new c(e)):console.error("请勿用location.hash或location.href来改变hash值"):(m="push",d.push(new s(e,e.id-t.id))),d.exec()}if(!v){v=!0;var u=t.defaultPath||"",y=t.defaultArgs||"";p&=!!t.useHistoryState,Object.defineProperty(this,"useHistoryState",{get:function(){return p}}),Object.defineProperty(this,"action",{get:function(){return m}}),Object.defineProperty(this,"state",{get:function(){return{id:h.state.id,name:h.state.name,args:h.state.args}}});var g=i();p?(e.addEventListener("pushstate",r,!1),e.addEventListener("popstate",r,!1),e.addEventListener("replacestate",r,!1)):e.addEventListener("hashchange",r,!1),h.state=g,d.push(new s(g)),d.exec()}}}{var r=e.document,o=e.location,a=e.history,s=e.navigator.userAgent;!!s.match(/Firefox/i),!!s.match(/IEMobile/i)}!a.state&&a.replaceState&&a.replaceState(!0,null);window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(e){setTimeout(e,1/60)};t.navigation=i}(window,window.lib||(window.lib={})),function(e){"use strict";function t(e,t){for(var n=e;n;){if(n.contains(t)||n==t)return n;n=n.parentNode}return null}function n(e,t,n){var i=l.createEvent("HTMLEvents");if(i.initEvent(t,!0,!0),"object"==typeof n)for(var r in n)i[r]=n[r];e.dispatchEvent(i)}function i(e,t,n,i,r,o,a,s){var l=Math.atan2(s-o,a-r)-Math.atan2(i-t,n-e),c=Math.sqrt((Math.pow(s-o,2)+Math.pow(a-r,2))/(Math.pow(i-t,2)+Math.pow(n-e,2))),u=[r-c*e*Math.cos(l)+c*t*Math.sin(l),o-c*t*Math.cos(l)-c*e*Math.sin(l)];return{rotate:l,scale:c,translate:u,matrix:[[c*Math.cos(l),-c*Math.sin(l),u[0]],[c*Math.sin(l),c*Math.cos(l),u[1]],[0,0,1]]}}function r(e){0===Object.keys(f).length&&(c.addEventListener("touchmove",o,!1),c.addEventListener("touchend",a,!1),c.addEventListener("touchcancel",s,!1));for(var i=0;i<e.changedTouches.length;i++){var r=e.changedTouches[i],l={};for(var d in r)l[d]=r[d];var p={startTouch:l,startTime:Date.now(),status:"tapping",element:e.srcElement||e.target,pressingHandler:setTimeout(function(t){return function(){"tapping"===p.status&&(p.status="pressing",n(t,"press",{touchEvent:e})),clearTimeout(p.pressingHandler),p.pressingHandler=null}}(e.srcElement||e.target),500)};f[r.identifier]=p}if(2==Object.keys(f).length){var h=[];for(var d in f)h.push(f[d].element);n(t(h[0],h[1]),"dualtouchstart",{touches:u.call(e.touches),touchEvent:e})}}function o(e){for(var r=0;r<e.changedTouches.length;r++){var o=e.changedTouches[r],a=f[o.identifier];if(!a)return;a.lastTouch||(a.lastTouch=a.startTouch),a.lastTime||(a.lastTime=a.startTime),a.velocityX||(a.velocityX=0),a.velocityY||(a.velocityY=0),a.duration||(a.duration=0);var s=Date.now()-a.lastTime,l=(o.clientX-a.lastTouch.clientX)/s,c=(o.clientY-a.lastTouch.clientY)/s,u=70;s>u&&(s=u),a.duration+s>u&&(a.duration=u-s),a.velocityX=(a.velocityX*a.duration+l*s)/(a.duration+s),a.velocityY=(a.velocityY*a.duration+c*s)/(a.duration+s),a.duration+=s,a.lastTouch={};for(var d in o)a.lastTouch[d]=o[d];a.lastTime=Date.now();var p=o.clientX-a.startTouch.clientX,h=o.clientY-a.startTouch.clientY,m=Math.sqrt(Math.pow(p,2)+Math.pow(h,2));("tapping"===a.status||"pressing"===a.status)&&m>10&&(a.status="panning",a.isVertical=!(Math.abs(p)>Math.abs(h)),n(a.element,"panstart",{touch:o,touchEvent:e,isVertical:a.isVertical}),n(a.element,(a.isVertical?"vertical":"horizontal")+"panstart",{touch:o,touchEvent:e})),"panning"===a.status&&(a.panTime=Date.now(),n(a.element,"pan",{displacementX:p,displacementY:h,touch:o,touchEvent:e,isVertical:a.isVertical}),a.isVertical?n(a.element,"verticalpan",{displacementY:h,touch:o,touchEvent:e}):n(a.element,"horizontalpan",{displacementX:p,touch:o,touchEvent:e}))}if(2==Object.keys(f).length){for(var v,y=[],g=[],w=[],r=0;r<e.touches.length;r++){var o=e.touches[r],a=f[o.identifier];y.push([a.startTouch.clientX,a.startTouch.clientY]),g.push([o.clientX,o.clientY])}for(var d in f)w.push(f[d].element);v=i(y[0][0],y[0][1],y[1][0],y[1][1],g[0][0],g[0][1],g[1][0],g[1][1]),n(t(w[0],w[1]),"dualtouch",{transform:v,touches:e.touches,touchEvent:e})}}function a(e){if(2==Object.keys(f).length){var i=[];for(var r in f)i.push(f[r].element);n(t(i[0],i[1]),"dualtouchend",{touches:u.call(e.touches),touchEvent:e})}for(var l=0;l<e.changedTouches.length;l++){var p=e.changedTouches[l],h=p.identifier,m=f[h];if(m){if(m.pressingHandler&&(clearTimeout(m.pressingHandler),m.pressingHandler=null),"tapping"===m.status&&(m.timestamp=Date.now(),n(m.element,"tap",{touch:p,touchEvent:e}),d&&m.timestamp-d.timestamp<300&&n(m.element,"doubletap",{touch:p,touchEvent:e}),d=m),"panning"===m.status){var v=Date.now(),y=v-m.startTime,g=((p.clientX-m.startTouch.clientX)/y,(p.clientY-m.startTouch.clientY)/y,p.clientX-m.startTouch.clientX),w=p.clientY-m.startTouch.clientY,b=Math.sqrt(m.velocityY*m.velocityY+m.velocityX*m.velocityX),x=b>.5&&v-m.lastTime<100,E={duration:y,isflick:x,velocityX:m.velocityX,velocityY:m.velocityY,displacementX:g,displacementY:w,touch:p,touchEvent:e,isVertical:m.isVertical};n(m.element,"panend",E),x&&(n(m.element,"flick",E),m.isVertical?n(m.element,"verticalflick",E):n(m.element,"horizontalflick",E))}"pressing"===m.status&&n(m.element,"pressend",{touch:p,touchEvent:e}),delete f[h]}}0===Object.keys(f).length&&(c.removeEventListener("touchmove",o,!1),c.removeEventListener("touchend",a,!1),c.removeEventListener("touchcancel",s,!1))}function s(e){if(2==Object.keys(f).length){var i=[];for(var r in f)i.push(f[r].element);n(t(i[0],i[1]),"dualtouchend",{touches:u.call(e.touches),touchEvent:e})}for(var l=0;l<e.changedTouches.length;l++){var d=e.changedTouches[l],p=d.identifier,h=f[p];h&&(h.pressingHandler&&(clearTimeout(h.pressingHandler),h.pressingHandler=null),"panning"===h.status&&n(h.element,"panend",{touch:d,touchEvent:e}),"pressing"===h.status&&n(h.element,"pressend",{touch:d,touchEvent:e}),delete f[p])}0===Object.keys(f).length&&(c.removeEventListener("touchmove",o,!1),c.removeEventListener("touchend",a,!1),c.removeEventListener("touchcancel",s,!1))}var l=e.document,c=l.documentElement,u=Array.prototype.slice,f={},d=null;c.addEventListener("touchstart",r,!1)}(window,window.lib||(window.lib={})),function(e,t){function n(e){if(this.v=e.v||0,this.a=e.a||0,"undefined"!=typeof e.t&&(this.t=e.t),"undefined"!=typeof e.s&&(this.s=e.s),"undefined"==typeof this.t)if("undefined"==typeof this.s)this.t=-this.v/this.a;else{var t=(Math.sqrt(this.v*this.v+2*this.a*this.s)-this.v)/this.a,n=(-Math.sqrt(this.v*this.v+2*this.a*this.s)-this.v)/this.a;this.t=Math.min(t,n)}"undefined"==typeof this.s&&(this.s=this.a*this.t*this.t/2+this.v*this.t),this.generateCubicBezier=function(){function e(e,t){return[[(e/3+(e+t)/3-e)/(t-e),(e*e/3+e*t*2/3-e*e)/(t*t-e*e)],[(t/3+(e+t)/3-e)/(t-e),(t*t/3+e*t*2/3-e*e)/(t*t-e*e)]]}return e(this.v/this.a,this.t+this.v/this.a)}}t.motion=n}(window,window.lib||(window.lib={})),function(e,t){function n(e){return setTimeout(e,s)}function i(e){clearTimeout(e)}function r(t){function n(){i=!0,a&&a.forEach(function(e){e&&e()})}var i=!1;Object.defineProperty(this,"isRequested",{get:function(){return i}});var o,a=[],s=!1;this.request=function(){if(!i){var r=arguments;return s=!1,o=l(function(){s||(t.apply(e,r),n())}),this}},this.cancel=function(){o&&(s=!0,c(o))},this.then=function(e){return i?e&&e():a.push(e),this},this.clone=function(){return new r(t)}}function o(e,n,i,o){"function"==typeof o&&(o={0:o});for(var a=e/s,l=1/a,c=[],u=Object.keys(o).map(function(e){return parseInt(e)}),f=0;a>f;f++){var d=u[0],p=l*f;if(null!=d&&100*p>=d){var h=o[""+d];h instanceof r||(h=new r(h)),c.push(h),u.shift()}else c.length&&c.push(c[c.length-1].clone())}var m;"string"==typeof n||n instanceof Array?t.cubicbezier?"string"==typeof n?t.cubicbezier[n]&&(m=t.cubicbezier[n]):n instanceof Array&&4===n.length&&(m=t.cubicbezier.apply(t.cubicbezier,n)):console.error("require lib.cubicbezier"):"function"==typeof n&&(m=n),m||console.error("unexcept timing function");var v,y=!1,g=0,w=0;this.play=function(){function e(){y=!1,b&&b()}function t(){var e=l*(w+1).toFixed(10);v=c[w],v.request(e.toFixed(10),n(e).toFixed(10)),v.then(function(){w++,r()})}function r(){y&&(w===c.length?e():t())}if(!y)return y=!0,g=setTimeout(function(){g=0,r()},!w&&i||0),this},this.stop=function(){return y?(y=!1,g&&(clearTimeout(g),g=0),v&&v.cancel(),this):void 0};var b;this.onend=function(e){b=e}}var a=60,s=1e3/a,l=window.requestAnimationFrame||window.msRequestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||n,c=window.cancelAnimationFrame||window.msCancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||i;(l===n||c===i)&&(l=n,c=i),t.animation=o,t.animation.Frame=r,t.animation.requestFrame=function(e){var t=new r(e);return t.request(),t}}(window,window.lib||(window.lib={})),function(e,t){function n(e,t,n,i){function r(e){return(3*u*e+2*f)*e+d}function o(e){return((u*e+f)*e+d)*e}function a(e){return((p*e+h)*e+m)*e}function s(e){for(var t,n,i=e,a=0;8>a;a++){if(n=o(i)-e,Math.abs(n)<c)return i;if(t=r(i),Math.abs(t)<c)break;i-=n/t}var s=1,l=0;for(i=e;s>l;){if(n=o(i)-e,Math.abs(n)<c)return i;n>0?s=i:l=i,i=(s+l)/2}return i}function l(e){return a(s(e))}var c=1e-6,u=3*e-3*n+1,f=3*n-6*e,d=3*e,p=3*t-3*i+1,h=3*i-6*t,m=3*t;return l}t.cubicbezier=n,t.cubicbezier.linear=n(0,0,1,1),t.cubicbezier.ease=n(.25,.1,.25,1),t.cubicbezier.easeIn=n(.42,0,1,1),t.cubicbezier.easeOut=n(0,0,.58,1),t.cubicbezier.easeInOut=n(.42,0,.58,1)}(window,window.lib||(window.lib={})),function(e,t){function n(){t.scroll.outputDebugLog&&console.debug.apply(console,arguments)}function i(e){var t=e.getBoundingClientRect();if(!t){t={},t.width=e.offsetWidth,t.height=e.offsetHeight,t.left=e.offsetLeft,t.top=e.offsetTop;for(var n=e.offsetParent;n;)t.left+=n.offsetLeft,t.top+=n.offsetTop,n=n.offsetParent;t.right=t.left+t.width,t.bottom=t.top+t.height}return t}function r(e){return 0-e.options[e.axis+"PaddingTop"]}function o(e){var t=i(e.element),n=i(e.viewport),o=r(e);if("y"===e.axis)var a=0-t.height+n.height;else var a=0-t.width+n.width;return Math.min(a+e.options[e.axis+"PaddingBottom"],o)}function a(e,t){return t>e.minScrollOffset?t-e.minScrollOffset:t<e.maxScrollOffset?t-e.maxScrollOffset:void 0}function s(e,t){return t>e.minScrollOffset?t=e.minScrollOffset:t<e.maxScrollOffset&&(t=e.maxScrollOffset),t}function l(e,t,i){n(e.element.scrollId,t,i);var r=h.createEvent("HTMLEvents");if(r.initEvent(t,!1,!0),r.scrollObj=e,i)for(var o in i)r[o]=i[o];e.element.dispatchEvent(r),e.viewport.dispatchEvent(r)}function c(e){var t,n={x:0,y:0},i=getComputedStyle(e.element)[T+"Transform"];return"none"!==i&&(t=i.match(/^matrix3d\((?:[-\d.]+,\s*){12}([-\d.]+),\s*([-\d.]+)(?:,\s*[-\d.]+){2}\)/)||i.match(/^matrix\((?:[-\d.]+,\s*){4}([-\d.]+),\s*([-\d.]+)\)$/))&&(n.x=parseFloat(t[1])||0,n.y=parseFloat(t[2])||0),n}function u(e,t){return e=parseFloat(e),t=parseFloat(t),0!=e&&(e+="px"),0!=t&&(t+="px"),O?"translate3d("+e+", "+t+", 0)":"translate("+e+", "+t+")"}function f(e,t,n){e.element.style[T+"Transition"]=""===t&&""===n?"":E+"transform "+t+" "+n+" 0s"}function d(e,t){var n=0,i=0;"object"==typeof t?(n=t.x,i=t.y):"y"===e.axis?i=t:n=t,e.element.style[T+"Transform"]=u(n,i)}function p(e,u){function p(e){return k||q?(e.preventDefault(),e.stopPropagation(),!1):!0}function h(e){k||q||setTimeout(function(){var t=document.createEvent("HTMLEvents");t.initEvent("niceclick",!0,!0),e.target.dispatchEvent(t)},300)}function m(e,n){z=null,clearTimeout(H),H=setTimeout(function(){z&&(z=null,t.animation.requestFrame(e))},n||400),z=e}function g(e){if(!C.enabled)return!1;if("undefined"!=typeof e.isVertical){if(!("y"===C.axis&&e.isVertical||"x"===C.axis&&!e.isVertical))return!1;e.stopPropagation()}return!0}function x(e){if(g(e))if(q&&M(),u.useFrameAnimation)A&&A.stop(),A=null;else{var t=c(C);d(C,t),f(C,"",""),z=null,clearTimeout(H)}}function E(e){if(g(e)){var n=c(C)[C.axis],i=a(C,n);if(i){var r=s(C,n);if(u.useFrameAnimation){var o=r-n;A=new t.animation(400,t.cubicbezier.ease,0,function(e,t){var i=(n+o*t).toFixed(2);d(C,i),l(C,"scrolling")}),A.onend(M),A.play()}else{var p=r.toFixed(0);f(C,"0.4s","ease"),d(C,p),m(M,400),t.animation.requestFrame(function(){q&&C.enabled&&(l(C,"scrolling"),t.animation.requestFrame(arguments.callee))})}i>0?l(C,"y"===C.axis?"pulldownend":"pullrightend"):0>i&&l(C,"y"===C.axis?"pullupend":"pullleftend")}else q&&M()}}function j(e){g(e)&&(C.transformOffset=c(C),C.minScrollOffset=r(C),C.maxScrollOffset=o(C),N=2.5,I=!0,q=!0,R=!1,l(C,"scrollstart"),X=e["displacement"+C.axis.toUpperCase()])}function O(e){if(g(e)){var t=e["displacement"+C.axis.toUpperCase()];if(Math.abs(t-X)<5)return void e.stopPropagation();X=t;var n=C.transformOffset[C.axis]+t;n>C.minScrollOffset?(n=C.minScrollOffset+(n-C.minScrollOffset)/N,N*=1.003):n<C.maxScrollOffset&&(n=C.maxScrollOffset-(C.maxScrollOffset-n)/N,N*=1.003),N>4&&(N=4);var i=a(C,n);i&&(l(C,i>0?"y"===C.axis?"pulldown":"pullright":"y"===C.axis?"pullup":"pullleft",{boundaryOffset:Math.abs(i)}),C.options.noBounce&&(n=s(C,n))),d(C,n.toFixed(2)),l(C,"scrolling")}}function S(e){g(e)&&e.isflick&&F(e)}function F(e){I=!0;var i,r,o,s,p,h,v,y,g,b,x,E,T,j,O,P,S;s=c(C)[C.axis];var F=a(C,s);if(!F){i=e["velocity"+C.axis.toUpperCase()];var k=2,L=.0015;u.inertia&&w[u.inertia]&&(k=w[u.inertia][0],L=w[u.inertia][1]),i>k&&(i=k),-k>i&&(i=-k),r=L*(i/Math.abs(i)),h=new t.motion({v:i,a:-r}),o=h.t,p=s+h.s;var z=a(C,p);if(z){n("惯性计算超出了边缘",z),v=i,y=r,z>0?(b=C.minScrollOffset,E=1):(b=C.maxScrollOffset,E=-1),x=new t.motion({v:E*v,a:-E*y,s:Math.abs(b-s)}),g=x.t;var H=x.generateCubicBezier();T=v-y*g,j=.03*(T/Math.abs(T)),S=new t.motion({v:T,a:-j}),O=S.t,P=b+S.s;{S.generateCubicBezier()}if(u.noBounce)if(n("没有回弹效果"),s!==b)if(u.useFrameAnimation){var N=b-s,X=t.cubicbezier(H[0][0],H[0][1],H[1][0],H[1][1]);A=new t.animation(g.toFixed(0),X,0,function(e,t){var n=s+N*t;c(C,n.toFixed(2)),l(C,"scrolling",{afterFlick:!0})}),A.onend(M),A.play()}else{var B=b.toFixed(0);f(C,(g/1e3).toFixed(2)+"s","cubic-bezier("+H+")"),d(C,B),m(M,1e3*(g/1e3).toFixed(2))}else M();else if(s!==P)if(n("惯性滚动","s="+P.toFixed(0),"t="+((g+O)/1e3).toFixed(2)),u.useFrameAnimation){var N=P-s,X=t.cubicbezier.easeOut;A=new t.animation((g+O).toFixed(0),X,0,function(e,t){var n=s+N*t;d(C,n.toFixed(2)),l(C,"scrolling",{afterFlick:!0})}),A.onend(function(){if(C.enabled){var e=b-P,n=t.cubicbezier.ease;A=new t.animation(400,n,0,function(t,n){var i=P+e*n;d(C,i.toFixed(2)),l(C,"scrolling",{afterFlick:!0})}),A.onend(M),A.play()}}),A.play()}else{var B=P.toFixed(0);f(C,((g+O)/1e3).toFixed(2)+"s","ease-out"),d(C,B),m(function(){if(C.enabled)if(n("惯性回弹","s="+b.toFixed(0),"t=400"),P!==b){var e=b.toFixed(0);f(C,"0.4s","ease"),d(C,e),m(M,400)}else M()},1e3*((g+O)/1e3).toFixed(2))}else M()}else{n("惯性计算没有超出边缘");var Y=h.generateCubicBezier();if(u.useFrameAnimation){var N=p-s,X=t.cubicbezier(Y[0][0],Y[0][1],Y[1][0],Y[1][1]);A=new t.animation(o.toFixed(0),X,0,function(e,t){var n=(s+N*t).toFixed(2);d(C,n),l(C,"scrolling",{afterFlick:!0})}),A.onend(M),A.play()}else{var B=p.toFixed(0);f(C,(o/1e3).toFixed(2)+"s","cubic-bezier("+Y+")"),d(C,B),m(M,1e3*(o/1e3).toFixed(2))}}R=!0,u.useFrameAnimation||t.animation.requestFrame(function(){q&&R&&C.enabled&&(l(C,"scrolling",{afterFlick:!0}),t.animation.requestFrame(arguments.callee))})}}function M(){C.enabled&&(I=!1,setTimeout(function(){!I&&q&&(q=!1,R=!1,u.useFrameAnimation?(A&&A.stop(),A=null):f(C,"",""),l(C,"scrollend"))},50))}var C=this;if(u=u||{},u.noBounce=!!u.noBounce,u.padding=u.padding||{},u.isPrevent=null==u.isPrevent?!0:!!u.isPrevent,u.isFixScrollendClick=null==u.isFixScrollendClick?!0:!!u.isFixScrollendClick,u.padding?(u.yPaddingTop=-u.padding.top||0,u.yPaddingBottom=-u.padding.bottom||0,u.xPaddingTop=-u.padding.left||0,u.xPaddingBottom=-u.padding.right||0):(u.yPaddingTop=0,u.yPaddingBottom=0,u.xPaddingTop=0,u.xPaddingBottom=0),u.direction=u.direction||"y",u.inertia=u.inertia||"normal",this.options=u,C.axis=u.direction,this.element=e,this.viewport=e.parentNode,this.plugins={},this.element.scrollId=setTimeout(function(){v[C.element.scrollId+""]=C},1),this.viewport.addEventListener("touchstart",x,!1),this.viewport.addEventListener("touchend",E,!1),this.viewport.addEventListener("touchcancel",E,!1),this.viewport.addEventListener("panstart",j,!1),this.viewport.addEventListener("pan",O,!1),this.viewport.addEventListener("panend",S,!1),u.isPrevent&&(this.viewport.addEventListener("touchstart",function(){P=!0},!1),C.viewport.addEventListener("touchend",function(){P=!1},!1)),u.isFixScrollendClick){var k,L;this.viewport.addEventListener("scrolling",function(){k=!0,L&&clearTimeout(L),L=setTimeout(function(){k=!1},400)},!1),this.viewport.addEventListener("click",p,!1),this.viewport.addEventListener("tap",h,!1)}if(u.useFrameAnimation){var A;Object.defineProperty(this,"animation",{get:function(){return A}})}else{var z,H=0;e.addEventListener(b?"transitionend":T+"TransitionEnd",function(e){if(z){var n=z;z=null,clearTimeout(H),t.animation.requestFrame(function(){n(e)})}},!1)}var N,q,R,I;Object.defineProperty(this,"isScrolling",{get:function(){return!!q}});var X,B={init:function(){return this.enable(),this.refresh(),this.scrollTo(0),this},enable:function(){return this.enabled=!0,this},disable:function(){var e=this.element;return this.enabled=!1,this.options.useFrameAnimation?A&&A.stop():t.animation.requestFrame(function(){e.style[T+"Transform"]=getComputedStyle(e)[T+"Transform"]}),this},getScrollWidth:function(){return i(this.element).width},getScrollHeight:function(){return i(this.element).height},getScrollLeft:function(){return-c(this).x-this.options.xPaddingTop},getScrollTop:function(){return-c(this).y-this.options.yPaddingTop},getMaxScrollLeft:function(){return-C.maxScrollOffset-this.options.xPaddingTop},getMaxScrollTop:function(){return-C.maxScrollOffset-this.options.yPaddingTop},getBoundaryOffset:function(){return Math.abs(a(this,c(this)[this.axis])||0)},refresh:function(){var e=this.element,t="y"===this.axis,n=t?"height":"width";if(null!=this.options[n])e.style[n]=this.options[n]+"px";else if(this.options.useElementRect)e.style[n]="auto",e.style[n]=i(e)[n]+"px";else if(e.childElementCount>0){var a,s,u=e.firstElementChild,f=e.lastElementChild;if(document.createRange&&!this.options.ignoreOverflow&&(a=document.createRange(),a.selectNodeContents(e),s=i(a)),s)e.style[n]=s[n]+"px";else{for(;u&&0===i(u)[n]&&u.nextElementSibling;)u=u.nextElementSibling;for(;f&&f!==u&&0===i(f)[n]&&f.previousElementSibling;)f=f.previousElementSibling;e.style[n]=i(f)[t?"bottom":"right"]-i(u)[t?"top":"left"]+"px"}}return this.transformOffset=c(this),this.minScrollOffset=r(this),this.maxScrollOffset=o(this),this.scrollTo(-this.transformOffset[this.axis]-this.options[this.axis+"PaddingTop"]),l(this,"contentrefresh"),this},offset:function(e){var t=i(this.element),n=i(e);if("y"===this.axis){var r={top:n.top-t.top-this.options.yPaddingTop,left:n.left-t.left,right:t.right-n.right,width:n.width,height:n.height};r.bottom=r.top+r.height}else{var r={top:n.top-t.top,bottom:t.bottom-n.bottom,left:n.left-t.left-this.options.xPaddingTop,width:n.width,height:n.height};r.right=r.left+r.width}return r},getRect:function(e){var t=i(this.viewport),n=i(e);if("y"===this.axis){var r={top:n.top-t.top,left:n.left-t.left,right:t.right-n.right,width:n.width,height:n.height};r.bottom=r.top+r.height}else{var r={top:n.top-t.top,bottom:t.bottom-n.bottom,left:n.left-t.left,width:n.width,height:n.height};r.right=r.left+r.width}return r},isInView:function(e){var t=this.getRect(this.viewport),n=this.getRect(e);return"y"===this.axis?t.top<n.bottom&&t.bottom>n.top:t.left<n.right&&t.right>n.left},scrollTo:function(e,n){{var i=this;this.element}if(e=-e-this.options[this.axis+"PaddingTop"],e=s(this,e),q=!0,n===!0)if(this.options.useFrameAnimation){var r=c(i)[this.axis],o=e-r;A=new t.animation(400,t.cubicbezier.ease,0,function(e,t){var n=(r+o*t).toFixed(2);d(i,n),l(i,"scrolling")}),A.onend(M),A.play()}else f(i,"0.4s","ease"),d(i,e),m(M,400),t.animation.requestFrame(function(){q&&i.enabled&&(l(i,"scrolling"),t.animation.requestFrame(arguments.callee))});else this.options.useFrameAnimation||f(i,"",""),d(i,e),M();return this},scrollToElement:function(e,t){var n=this.offset(e);return n=n["y"===this.axis?"top":"left"],this.scrollTo(n,t)},getViewWidth:function(){return i(this.viewport).width},getViewHeight:function(){return i(this.viewport).height},addPulldownHandler:function(e){var t=this;return this.element.addEventListener("pulldownend",function(n){t.disable(),e.call(t,n,function(){t.scrollTo(0,!0),t.refresh(),t.enable()})},!1),this},addPullupHandler:function(e){var t=this;return this.element.addEventListener("pullupend",function(n){t.disable(),e.call(t,n,function(){t.scrollTo(t.getScrollHeight(),!0),t.refresh(),t.enable()})},!1),this},addScrollstartHandler:function(e){var t=this;return this.element.addEventListener("scrollstart",function(n){e.call(t,n)},!1),this},addScrollingHandler:function(e){var t=this;return this.element.addEventListener("scrolling",function(n){e.call(t,n)},!1),this},addScrollendHandler:function(e){var t=this;return this.element.addEventListener("scrollend",function(n){e.call(t,n)},!1),this},addContentrenfreshHandler:function(e){var t=this;this.element.addEventListener("contentrefresh",function(n){e.call(t,n)},!1)},addEventListener:function(e,t,n){var i=this;this.element.addEventListener(e,function(e){t.call(i,e)},!!n)},removeEventListener:function(e,t){var n=this;this.element.removeEventListener(e,function(e){t.call(n,e)})},enablePlugin:function(e,t){var n=y[e];return n&&!this.plugins[e]&&(this.plugins[e]=!0,t=t||{},n.call(this,e,t)),this}};for(var Y in B)this[Y]=B[Y];delete B}var h=e.document,m=e.navigator.userAgent,v={},y={},g=e.dpr||(e.navigator.userAgent.match(/iPhone|iPad|iPod/)?document.documentElement.clientWidth/e.screen.availWidth:1),w={normal:[2*g,.0015*g],slow:[1.5*g,.003*g],veryslow:[1.5*g,.005*g]},b=!!m.match(/Firefox/i),x=!!m.match(/IEMobile/i),E=b?"-moz-":x?"-ms-":"-webkit-",T=b?"Moz":x?"ms":"webkit",j=x?"MSCSSMatrix":"WebKitCSSMatrix",O=!!b||j in e&&"m11"in new e[j],P=!1;h.addEventListener("touchmove",function(e){return P?(e.preventDefault(),!1):!0},!1),t.scroll=function(e,n){if(1===arguments.length&&!(arguments[0]instanceof HTMLElement))if(n=arguments[0],n.scrollElement)e=n.scrollElement;else{if(!n.scrollWrap)throw new Error("no scroll element");e=n.scrollWrap.firstElementChild}if(!e.parentNode)throw new Error("wrong dom tree");if(n&&n.direction&&["x","y"].indexOf(n.direction)<0)throw new Error("wrong direction");var i;return i=n.downgrade===!0&&t.scroll.downgrade?t.scroll.downgrade(e,n):e.scrollId?v[e.scrollId]:new p(e,n)},t.scroll.plugin=function(e,t){return t?(e=e.split(","),void e.forEach(function(e){y[e]=t})):y[e]}}(window,window.lib||(window.lib={})),function(e,t){function n(e,t){function n(){y||(y=!0,f=e.querySelector("canvas"),d=f.getContext("2d"),m=.13373158940994154,v=.06015722128359704);var t=f.getBoundingClientRect();(f.width!==t.width*g||f.height!==t.height*g)&&(f.width=t.width*g,f.height=t.height*g,p=t.width/2,h=p/15)}function i(){if("spin"===w){n();var e=0;lib.animation.requestFrame(function(){"spin"===w&&(d.clearRect(0,0,f.width,f.height),d.beginPath(),d.arc(p*g,p*g,(p-h)*g,-m-Math.PI/2-e,-m-Math.PI/2-100*v-e,!0),d.lineWidth=h*g,d.strokeStyle="#ff5000",d.stroke(),d.closePath(),e+=4*Math.PI/60,lib.animation.requestFrame(arguments.callee))})}}function a(e){"draw"===w&&(n(),e>100&&(e=100),d.clearRect(0,0,f.width*g,f.height*g),d.beginPath(),d.arc(p*g,p*g,(p-h)*g,-m-Math.PI/2,-m-Math.PI/2-v*e,!0),d.lineWidth=h*g,d.strokeStyle="#ff5000",d.stroke(),d.closePath())}function s(){var t=e.querySelector(".arrow");t.style.cssText="display: block"}function l(){var t=e.querySelector(".arrow");t.style[r+"Transform"]="scale(1)",t.style.opacity="1";var n=new lib.animation(400,lib.cubicbezier.easeIn,0,function(e,n){t.style[r+"Transform"]="scale("+(1-.5*n)+")",t.style.opacity=1-n+""});n.onend(function(){t.style.cssText="display:none"}),n.play()}var c=Date.now()+"-"+ ++o,u=document.createDocumentFragment();1!==arguments.length||arguments[0]instanceof HTMLElement||(t=arguments[0],e=null),e||(e=document.createElement("div"),u.appendChild(e)),t=t||{},e.setAttribute("data-ctrl-name","loading"),e.setAttribute("data-ctrl-id",c),e.innerHTML='<div><canvas></canvas><span class="arrow"></span></div><span class="text"></span>';
var f,d,p,h,m,v,y=!1,g=2;Object.defineProperty(this,"bgcolor",{get:function(){return e.style.backgroundColor},set:function(t){if("string"!=typeof t)throw new Error("Non expected value");e.style.backgroundColor=t}}),Object.defineProperty(this,"text",{get:function(){return e.querySelector(".text").textContent},set:function(t){if("string"!=typeof t)throw new Error("Non expected value");var n=e.querySelector("div"),i=e.querySelector(".text");t?(e.style[r+"BoxPack"]="",n.style.marginLeft="",i.style.display="block",i.textContent=t):(e.style[r+"BoxPack"]="center",n.style.marginLeft="0",i.style.display="none",i.textContent="")}});var w="";Object.defineProperty(this,"mode",{get:function(){return w},set:function(e){if(!e&&"string"!=typeof e&&["draw","spin"].indexOf(e)<0)throw new Error("Non expected value");w=e,"spin"===w?(x&&l(),i()):"draw"===w&&(s(),a(0))}});var b=0;Object.defineProperty(this,"per",{get:function(){return b},set:function(e){if("draw"!==w)throw new Error('only work under "draw" mode');if(!e&&"number"!=typeof e&&0>e&&e>100)throw new Error("Non expected value");a(e)}});var x="";Object.defineProperty(this,"arrowDirection",{get:function(){return x},set:function(t){if(!t&&"string"!=typeof t&&["up","down",""].indexOf(t)<0)throw new Error("Non expected value");x=t,e.querySelector(".arrow").className="arrow "+t}}),this.remove=function(){e.parentNode&&e.parentNode.removeChild(e)},this.element=e,this.root=u}var i=e.navigator.userAgent.match(/IEMobile\/([\d\.]+)/),r=i?"ms":"webkit",o=0;t.loading=n}(window,window.ctrl||(window.ctrl={})),function(e,t,n){function i(e,t){if("string"==typeof t)e.innerHTML=t;else if(t instanceof HTMLElement)e.innerHTML="",e.appendChild(t);else if(t instanceof Array||t instanceof NodeList){var n=d.createDocumentFragment();Array.prototype.slice.call(t).forEach(function(e){n.appendChild(e)}),e.appendChild(n)}}function r(e){var t,n={x:0,y:0},i=getComputedStyle(e)[y+"Transform"];return"none"!==i&&(t=i.match(/^matrix3d\((?:[-\d.]+,\s*){12}([-\d.]+),\s*([-\d.]+)(?:,\s*[-\d.]+){2}\)/)||i.match(/^matrix\((?:[-\d.]+,\s*){4}([-\d.]+),\s*([-\d.]+)\)$/))&&(n.x=parseFloat(t[1])||0,n.y=parseFloat(t[2])||0),n}function o(r,o){var p=this,h=Date.now()+"-"+ ++w;1!==arguments.length||arguments[0]instanceof HTMLElement||(o=arguments[0],r=null),o=o||{},r||(r=d.createElement("div"));var m=r.firstElementChild||d.createElement("div"),v=m.firstElementChild||d.createElement("div");m.parentNode||r.appendChild(m),v.parentNode||m.appendChild(v),r.setAttribute("data-ctrl-name","scrollview"),r.setAttribute("data-ctrl-id",h),r.setAttribute("data-direction","x"!==o.direction?"vertical":"horizontal"),m.className.indexOf("scroll-wrap")<0&&(m.className=m.className.split(" ").concat("scroll-wrap").join(" ").replace(/^\s+/,"")),v.className.indexOf("scroll-content")<0&&(v.className=v.className.split(" ").concat("scroll-content").join(" ").replace(/^\s+/,"")),o.scrollElement=v,o.scrollWrap=m;var y=new t.scroll(o);this.scrollWrap=m,this.scrollElement=v,this.scroll=y,this.root=this.element=r;for(var g in y)void function(e){"function"==typeof y[e]?p[e]=function(){return y[e].apply(y,arguments)}:Object.defineProperty(p,e,{get:function(){return y[e]},set:function(t){y[e]=t}})}(g);Object.defineProperty(this,"forceRepaint",{value:new a(this)}),Object.defineProperty(this,"fixed",{value:new s(this)}),Object.defineProperty(this,"lazyload",{value:new l(this)}),Object.defineProperty(this,"sticky",{value:new c(this)}),Object.defineProperty(this,"pullRefresh",{value:new u(this)}),function(){if("y"===y.axis){var t=e.dpr?60*e.dpr:60,i="下拉即可刷新...",r="正在刷新...",o=new n.loading;o.arrowDirection="down",o.mode="draw",o.text=i;var a=o.element;p.pullRefresh.element=a,p.pullRefresh.height=t,p.pullRefresh.processingHandler=function(e){"draw"!==o.mode&&(o.mode="draw"),o.text!==i&&(o.text=i),o.per=Math.round(e/t*100)},p.pullRefresh.refreshHandler=function(e){var t=!1;o.text=r,o.mode="spin",p.pullRefresh.handler&&p.pullRefresh.handler(function(){t||(t=!0,e())})}}}(),Object.defineProperty(this,"pullUpdate",{value:new f(this)}),function(){if("y"===y.axis){var t=e.dpr?60*e.dpr:60,i="上拉加载更多...",r="正在加载...",o=new n.loading;o.arrowDirection="up",o.mode="draw",o.text=i;var a=o.element;p.pullUpdate.element=a,p.pullUpdate.height=t,p.pullUpdate.processingHandler=function(e){"draw"!==o.mode&&(o.mode="draw"),o.text!==i&&(o.text=i),o.per=Math.round(e/t*100)},p.pullUpdate.updateHandler=function(e){var t=!1;o.text=r,o.mode="spin",p.pullUpdate.handler&&p.pullUpdate.handler(function(){t||(t=!0,e())})}}}(),Object.defineProperty(this,"content",{get:function(){return Array.prototype.slice.call(element.childNodes)},set:function(e){i(v,e)}})}function a(e){var t=e.scroll,n=d.createElement("div");n.className="force-repaint",n.style.cssText="position: absolute; top: 0; left: 0; width: 0; height: 0; font-size: 0; opacity: 1;",e.root.appendChild(n);var i=!1;Object.defineProperty(this,"enable",{get:function(){return i},set:function(e){i=e}},!1),Object.defineProperty(this,"element",{value:n}),t.addScrollingHandler(function(){i&&(n.style.opacity=Math.abs(parseInt(n.style.opacity)-1)+"")})}function s(e){var t,n,r,o,a=this,s=e.scroll,l=(d.createDocumentFragment(),!1);Object.defineProperty(a,"enable",{get:function(){return l},set:function(i){l=i,l?(t&&(t.parentNode||e.root.insertBefore(t,e.scrollWrap),t.style.display="block"),n&&(n.parentNode||e.root.appendChild(n),n.style.display="block"),r&&(r.parentNode||e.root.insertBefore(r,e.scrollWrap),r.style.display="block"),o&&(o.parentNode||e.root.appendChild(o),o.style.display="block")):(topFiexElement&&(t.style.display="none"),n&&(n.style.display="none"),r&&(r.style.display="none"),o&&(o.style.display="none"))}}),"y"===s.axis?(t=d.createElement("div"),t.className="top-fixed",t.style.cssText="left: 0; top: 0; width: 100%;",Object.defineProperty(a,"topElement",{get:function(){return t},set:function(e){i(t,e)}}),Object.defineProperty(a,"topOffset",{set:function(e){t.style.top=e+"px"}}),n=this.bottomFixedElement=d.createElement("div"),n.className="bottom-fxied",n.style.cssText="left: 0; bottom: 0; width: 100%;",Object.defineProperty(a,"bottomElement",{get:function(){return n},set:function(e){i(n,e)}}),Object.defineProperty(a,"bottomOffset",{set:function(e){n.style.top=e+"px"}})):(r=this.leftFixedElement=d.createElement("div"),r.className="left-fixed",r.style.cssText="top: 0; left: 0; height: 100%;",Object.defineProperty(a,"leftElement",{get:function(){return r},set:function(e){i(r,e)}}),Object.defineProperty(a,"leftOffset",{set:function(e){r.style.left=e+"px"}}),o=this.rightFixedElement=d.createElement("div"),o.className="right-fxied",o.style.cssText="top: 0; right: 0; height: 100%;",Object.defineProperty(a,"rightElement",{get:function(){return o},set:function(e){i(o,e)}}),Object.defineProperty(a,"rightOffset",{set:function(e){o.style.right=e+"px"}}))}function l(e){function n(){if(!d){if(d=!0,l>u&&c.length>0){var e=c.shift();u++;var t=new Image;t.onload=t.onreadystatechange=function(){f[e]!==!0&&(f[e].forEach(function(t){t&&t(e)}),f[e]=!0,u--),n()},t.src=e,n()}d=!1}}function i(e,t){return f[e]===!0?t(e):(f[e]?f[e].push(t):(f[e]=[t],c.push(e)),void n())}function r(){if(o){var e=Array.prototype.slice.call(s.element.querySelectorAll('.lazy, *[lazyload="true"]'));e.filter(function(e){return s.isInView(e)}).forEach(function(e){var t,n;"IMG"===e.tagName.toUpperCase()?(t=[e],n=[]):(t=Array.prototype.slice.call(e.querySelectorAll("img[data-src]")),n=Array.prototype.slice.call(e.querySelectorAll("*[data-image]")),e.hasAttribute("data-image")&&n.push(e)),t.forEach(function(e){var t=e.getAttribute("data-src");t&&(e.removeAttribute("data-src"),i(t,function(){e.src=t}))}),n.forEach(function(e){var t=e.getAttribute("data-image");t&&(e.removeAttribute("data-image"),i(t,function(){e.style.backgroundImage="url("+t+")"}))}),p&&p(e),e.className=e.className.split(" ").filter(function(e){return"lazy"!==e}).join(" "),e.removeAttribute("lazyload")})}}var o,a=this,s=e.scroll,l=4,c=[],u=0,f={},d=!1;Object.defineProperty(a,"enable",{get:function(){return o},set:function(e){o=e}});var p;Object.defineProperty(a,"handler",{get:function(){return p},set:function(e){p=e}});var h;Object.defineProperty(a,"realtime",{get:function(){return h},set:function(t){h=!!t,h&&(e.forceRepaint.enable=!0)}}),s.addScrollingHandler(function(){h&&r()}),s.addScrollendHandler(function(){r()}),s.addContentrenfreshHandler(function(){r()}),t.animation.requestFrame(function(){r()}),e.checkLazyload=r}function c(e){function t(){if(r&&(Array.prototype.slice.call(n.element.querySelectorAll('.sticky, *[sticky="true"]')).forEach(function(e){e.className=e.className.split(" ").filter(function(e){return"sticky"!==e}).join(" "),e.setAttribute("sticky","initialized");for(var t=n.offset(e),i=t.top,r=0;r<=o.length;r++)if(!o[r]||i<o[r].top){o.splice(r,0,{top:i,el:e,pined:e.firstElementChild});break}}),o.length)){for(var e="y"===n.axis?n.getScrollTop():n.getScrollLeft(),t=0;t<o.length&&!(e<o[t]["y"===n.axis?"top":"left"]);t++);for(j=t-1,j>-1&&(o[j].pined.parentNode&&o[j].pined.parentNode!==o[j].el||(i.innerHTML="",i.appendChild(o[j].pined))),j++;j<o.length;j++)o[j].pined.parentNode!==o[j].el&&o[j].el.appendChild(o[j].pined)}}var n=e.scroll,i=d.createElement("div");i.className="sticky",i.style.cssText="z-index:9; position: absolute; left: 0; top: 0;"+v+"transform: translateZ(9px);","y"===n.axis?i.style.width="100%":i.style.height="100%",Object.defineProperty(this,"offset",{set:function(e){"y"===n.axis?i.style.top=e+"px":i.style.left=e+"px"}});var r;Object.defineProperty(this,"enable",{get:function(){return r},set:function(e){r=!!e,r?(i.parentNode||n.viewport.appendChild(i),i.style.display="block"):i.style.display="none"}});var o=[];e.forceRepaint.enable=!0,n.addScrollingHandler(t),n.addScrollendHandler(t),e.checkSticky=t}function u(e){function n(e){var n=r(s)[a.axis],i=0-n,o=r(a.element)[a.axis],l=("y"===a.axis?u:c)-o,f=new t.animation(400,t.cubicbezier.ease,0,function(e,t){s.style[y+"Transform"]="translate"+a.axis.toUpperCase()+"("+(n+i*t)+"px) translateZ(9px)",a.element.style[y+"Transform"]="translate"+a.axis.toUpperCase()+"("+(o+l*t)+"px)"});f.onend(e),f.play()}function o(e){var n=r(s)[a.axis],i=-("y"===a.axis?u:c)-n,o=r(a.element)[a.axis],l=-o,f=new t.animation(400,t.cubicbezier.ease,0,function(e,t){s.style[y+"Transform"]="translate"+a.axis.toUpperCase()+"("+(n+i*t)+"px) translateZ(9px)",a.element.style[y+"Transform"]="translate"+a.axis.toUpperCase()+"("+(o+l*t)+"px)"});f.onend(e),f.play()}var a=e.scroll,s=d.createElement("div");s.className="refresh",s.style.cssText="display: none; position: absolute; top: 0; left: 0; width: 0; height: 0; "+v+"transform: translateZ(9px)","y"===a.axis?s.style.width="100%":s.style.height="100%";var l=!1;Object.defineProperty(this,"enable",{get:function(){return l},set:function(e){l=e,l?(s.parentNode||a.viewport.appendChild(s),s.style.display="block"):s.style.display="none"}}),Object.defineProperty(this,"element",{get:function(){return s},set:function(e){i(s,e)}}),Object.defineProperty(this,"offset",{set:function(e){"y"===a.axis?s.style.top=e+"px":s.style.left=e+"px"}});var c=0;Object.defineProperty(this,"width",{set:function(e){c=e,"x"===a.axis&&(s.style.width=c+"px",s.style[y+"Transform"]="translateX("+-c+"px) translateZ(9px)")}});var u=0;Object.defineProperty(this,"height",{set:function(e){u=e,"y"===a.axis&&(s.style.height=u+"px",s.style[y+"Transform"]="translateY("+-u+"px) translateZ(9px)")}});var f;Object.defineProperty(this,"processingHandler",{get:function(){return f},set:function(e){f=e}});var p;Object.defineProperty(this,"refreshHandler",{get:function(){return p},set:function(e){p=e}});var h;a.addScrollingHandler(function(){if(l&&!h){var e="y"===a.axis?a.getScrollTop():a.getScrollLeft();e=Math.min(e,0),s.style[y+"Transform"]="y"===a.axis?"translateY("+-(u+e)+"px) translateZ(9px)":"translateX("+-(c+e)+"px) translateZ(9px)",0>e&&f&&f(-e)}}),a.addEventListener("pulldownend",function(){if(l&&!h){h=!0;var e=a.getBoundaryOffset();e>("y"===a.axis?u:c)?(a.disable(),n(function(){p?p(function(){o(function(){a.refresh(),a.enable(),h=!1})}):o(function(){a.refresh(),a.enable(),h=!1})})):o(function(){h=!1})}},!1)}function f(e){var t=e.scroll,n=d.createElement("div");n.className="update",n.style.cssText="display: none; position: absolute; bottom: 0; right: 0; width: 0; height: 0; "+v+"transform: translateZ(9px)","y"===t.axis?n.style.width="100%":n.style.height="100%";var r=!1;Object.defineProperty(this,"enable",{get:function(){return r},set:function(e){r=e,r?(n.parentNode||t.viewport.appendChild(n),n.style.display="block"):n.style.display="none"}}),Object.defineProperty(this,"element",{get:function(){return n},set:function(e){i(n,e)}}),Object.defineProperty(this,"offset",{set:function(e){"y"===t.axis?n.style.bottom=e+"px":n.style.right=e+"px"}});var o=0;Object.defineProperty(this,"width",{set:function(e){o=e,"x"===t.axis&&(n.style.width=o+"px",n.style[y+"Transform"]="translateX("+o+"px) translateZ(9px)")}});var a=0;Object.defineProperty(this,"height",{set:function(e){a=e,"y"===t.axis&&(n.style.height=a+"px",n.style[y+"Transform"]="translateY("+a+"px) translateZ(9px)")}});var s;Object.defineProperty(this,"processingHandler",{get:function(){return s},set:function(e){s=e}});var l;Object.defineProperty(this,"updateHandler",{get:function(){return l},set:function(e){l=e}});var c;t.addScrollingHandler(function(){if(r){var e="y"===t.axis?t.getScrollTop():t.getScrollLeft(),i="y"===t.axis?t.getMaxScrollTop():t.getMaxScrollLeft();e=Math.max(e,i),n.style[y+"Transform"]="y"===t.axis?"translateY("+(i-e+a)+"px) translateZ(9px)":"translateX("+(i-e+o)+"px) translateZ(9px)",c||(e-i<.7*("y"===t.axis?a:o)?s&&s(e-i):l&&(c=!0,l(function(){n.style[y+"Transform"]="y"===t.axis?"translateY("+a+"px) translateZ(9px)":"translateX("+o+"px) translateZ(9px)",t.refresh(),c=!1})))}})}var d=e.document,p=e.navigator.userAgent,h=!!p.match(/Firefox/i),m=!!p.match(/IEMobile/i),v=h?"-moz-":m?"-ms-":"-webkit-",y=h?"Moz":m?"ms":"webkit",g=m?"MSCSSMatrix":"WebKitCSSMatrix",w=(!!h||g in e&&"m11"in new e[g],0);n.scrollview=o}(window,window.lib,window.ctrl||(window.ctrl={})),function(e,t,n){function i(){if(e.console&&e.console.debuggerMode){var t=e.console.debug||e.console.info;t.apply?t.apply(e.console,arguments):t(arguments)}}function r(){if(e.console&&e.console.debuggerMode){var t=e.console.error||e.console.info;t.apply?t.apply(e.console,arguments):t(arguments)}}function o(e,n){var i=this;this.name=e,this.async=function(e){return function(){var n=t.promise.deferred(),r=Array.prototype.slice.call(arguments);return r.push(function(){n.resolve()}),e.apply(i,r),n.promise()}},this.startup=this.async(function(e,t){t()}),this.show=this.async(function(e,t,n){n()}),this.hide=this.async(function(e,t){t()}),this.teardown=this.async(function(e,t){t()}),n&&n.call(this)}function a(e,n){function a(e){var n=s.createElement("div");n.className="view",n.setAttribute("id","view-"+e.id);var o,a=y[e.name];return o=a?t.promise.resolve(a):new t.promise(function(e){e.resolve(a)}),o.then(function(r){return i("success:load "+e.name+" page"),n.context=r,t.promise.resolve(r.startup(n))},function(){return i("failure:load "+e.name+" page"),t.promise.reject(!1)}).then(function(){return i("success:call startup on",{create:n}),t.promise.resolve(n)},function(e){return r("failure:call startup on",e.stack),t.promise.reject(n)})}function l(n,i){var r=e.getBoundingClientRect(),o=[];return n.style.width=r.width+"px",n.style.height=r.height+"px",e.appendChild(n),i?(o.push(new t.promise(function(e){n.style.display="block",n.style[f+"Transform"]="translateX("+r.width+"px) translateZ(1px)";var i=new t.animation(400,t.cubicbezier.ease,0,function(e,t){n.style[f+"Transform"]="translateX("+r.width*(1-t)+"px) translateZ(1px)"});i.onend(function(){n.style[f+"Transform"]="",e.resolve(n)}),i.play()})),o.push(new t.promise(function(e){i.style.opacity="1",i.style[f+"Transform"]="scale(1) translateZ(0)";var n=new t.animation(400,t.cubicbezier.ease,0,function(e,t){i.style[f+"Transform"]="scale("+(1-.1*t)+")",i.style.opacity=1-t+""});n.onend(function(){i.style[f+"Transform"]="",i.style.opacity="",i.style.display="none",e.resolve(i)}),n.play()}))):(n.style.display="block",o.push(t.promise.resolve(n))),t.promise.every.apply(t.promise,o)}function c(e){this.exec=function(){t.promise.every(a(e),b).then(function(e){var t=e[0],n=e[1];return i("begin:push animation for",{next:t,cur:n}),l(t,n)},function(e){return t.promise.reject(e)}).then(function(e){var n=e[0],o=e[1];v.push(n),i("end:push animation for",{next:n,cur:o});var a=o&&o.context.hide(o);b=t.promise.resolve(a).then(function(){return o&&i("success:call hide on",{cur:o}),t.promise.resolve(n.context.show(n,!1))},function(){return o&&r("failure:call hide on",{cur:o}),t.promise.reject(!1)}).then(function(){return i("success:call show on",{next:n}),t.promise.resolve(n)},function(){return r("failure:call show on",{next:n}),t.promise.reject(n)})},function(e){r("failure:when push animation",e.stack)})}}function u(n,i){n.parentNode||e.insertBefore(n,i);var r=e.getBoundingClientRect(),o=[];return o.push(new t.promise(function(e){n.style.opacity="0",n.style.display="block",n.style[f+"Transform"]="scale(0.9) translateZ(0)";var i=new t.animation(400,t.cubicbezier.ease,0,function(e,t){n.style[f+"Transform"]="scale("+(.9+.1*t)+") translateZ(0)",n.style.opacity=t+""});i.onend(function(){n.style[f+"Transform"]="",n.style.opacity="",e.resolve(n)}),i.play()})),o.push(new t.promise(function(n){i.style.display="block",i.style[f+"Transform"]="translateX(0) translateZ(1px)";var o=new t.animation(400,t.cubicbezier.ease,0,function(e,t){i.style[f+"Transform"]="translateX("+r.width*t+"px) translateZ(1px)"});o.onend(function(){i.style[f+"Transform"]="",e.removeChild(i),n.resolve(i)}),o.play()})),t.promise.every.apply(t.promise,o)}function p(e){this.exec=function(){var n;v.pop(),n=v.length?t.promise.resolve(v.pop()):a(e),t.promise.every(n,b).then(function(e){var t=e[0],n=e[1];return i("begin:pop animation for",{pre:t,cur:n}),u(t,n)},function(e){return t.promise.reject(e)}).then(function(e){var n=e[0],o=e[1];v.push(n),i("end:pop animation for",{pre:n,cur:o});var a=o&&o.context.hide(o);b=t.promise.resolve(a).then(function(){return i("success:call hide on",{cur:o}),t.promise.resolve(n.context.show(n,!1))},function(){return r("failure:call hide on",{cur:o}),t.promise.reject(!1)}).then(function(){return i("success:call show on",{pre:n}),t.promise.resolve(n)},function(){return r("failure:call show on",{pre:n}),t.promise.reject(n)})},function(e){r("failure:pop pop animation",e.stack)})}}function h(n,i){var r=e.getBoundingClientRect(),o=[];return n.style.width=r.width+"px",n.style.height=r.height+"px",e.appendChild(n),o.push(new t.promise(function(e){n.style.opacity="0",n.style.display="block",n.style[f+"Transform"]="translateZ(1px)";var i=new t.animation(400,t.cubicbezier.ease,0,function(e,t){n.style.opacity=t+""});i.onend(function(){n.style.opacity="",n.style[f+"Transform"]="",e.resolve(n)}),i.play()})),o.push(new t.promise(function(n){i.style.opacity="1",i.style[f+"Transform"]="scale(1) translateZ(0)";var r=new t.animation(400,t.cubicbezier.ease,0,function(e,t){i.style.opacity=1-t+"",i.style[f+"Transform"]="scale("+(1-.1*t)+")"});r.onend(function(){i.style.opacity="",i.style[f+"Transform"]="",e.removeChild(i),n.resolve(i)}),r.play()})),t.promise.every.apply(t.promise,o)}function m(e){this.exec=function(){v.pop(),t.promise.every(a(e),b).then(function(e){var t=e[0],n=e[1];return i("begin:replace animation for",{"new":t,cur:n}),h(t,n)},function(e){return t.promise.reject(e)}).then(function(e){var n=e[0],o=e[1];v.push(n),i("end:replace animation for",{"new":n,cur:o});var a=o&&o.context.hide(o);b=t.promise.resolve(a).then(function(){return o&&i("success:call hide on",{cur:o}),t.promise.resolve(n.context.show(n,!1))},function(){return o&&r("failure:call hide on",{cur:o}),t.promise.reject(!1)}).then(function(){return i("success:call show on",{"new":n}),t.promise.resolve(n)},function(){return r("failure:call show on",{"new":n}),t.promise.reject(n)})},function(e){r("failure:when replace animation",e.stack)})}}var v=[],y={},g=Date.now()+"-"+ ++d,w=document.createDocumentFragment();1!==arguments.length||arguments[0]instanceof HTMLElement||(n=arguments[0],e=null),e||(e=document.createElement("div"),w.appendChild(e)),n=n||{},e.setAttribute("data-ctrl-name","pageview"),e.setAttribute("data-ctrl-id",g),n.fullscreen&&(e.className="fullscreen");var b=t.promise.resolve();this.definePage=function(e,t){return y[e]=new o(e,t)},this.push=function(e,t,n){new c({name:e,args:t,id:n||Date.now()}).exec()},this.pop=function(e,t,n){new p({name:e,args:t,id:n||Date.now()}).exec()},this.replace=function(e,t,n){new m({name:e,args:t,id:n||Date.now()}).exec()},this.addEventListener=function(e,t){this.root.addEventListener(e,t,!1)},this.removeEventListener=function(e,t){this.root.removeEventListener(e,t,!1)},this.root=w,this.element=e}var s=e.document,l=e.navigator.userAgent,c=!!l.match(/Firefox/i),u=!!l.match(/IEMobile/i),f=c?"Moz":u?"ms":"webkit",d=0;n.pageview=a}(window,window.lib,window.ctrl||(window.ctrl={}));