-
Notifications
You must be signed in to change notification settings - Fork 107
/
Copy pathui-scroll.min.js
2 lines (2 loc) · 21.4 KB
/
ui-scroll.min.js
1
2
!function(n){var r={};function i(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.m=n,i.c=r,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(n,r,function(e){return t[e]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=1)}([,function(e,t,n){"use strict";function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw o}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}n.r(t);var r=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,r;return t=e,(n=[{key:"registerFor",value:function(n){var h,r,p,m;function t(e,t,n){var r=e[0],i=g({top:["scrollTop","pageYOffset","scrollLeft"],left:["scrollLeft","pageXOffset","scrollTop"]}[t],3),o=i[0],a=i[1],s=i[2],u=void 0!==n;return m(r)?u?r.scrollTo(e[s].call(e),n):a in r?r[a]:r.document.documentElement[o]:(u&&(r[o]=n),r[o])}function i(e,t,n){var r,i=function(e,t){var n,r,i,o,a,s,u,l,c,f;if(m(e))return{base:n=document.documentElement[{height:"clientHeight",width:"clientWidth"}[t]],padding:0,border:0,margin:0};var d=g({width:[e.offsetWidth,"Left","Right"],height:[e.offsetHeight,"Top","Bottom"]}[t],3);return n=d[0],u=d[1],l=d[2],s=p(e),c=h(e,s["padding"+u])||0,f=h(e,s["padding"+l])||0,r=h(e,s["border"+u+"Width"])||0,i=h(e,s["border"+l+"Width"])||0,o=s["margin"+u],a=s["margin"+l],{base:n,padding:c+f,border:r+i,margin:(h(e,o)||0)+(h(e,a)||0)}}(e,t);return 0<i.base?{base:i.base-i.padding-i.border,outer:i.base,outerfull:i.base+i.margin}[n]:(((r=p(e)[t])<0||null===r)&&(r=e.style[t]||0),{base:(r=parseFloat(r)||0)-i.padding-i.border,outer:r,outerfull:r+i.padding+i.border+i.margin}[n])}return r=angular.element.prototype.css,n.prototype.css=function(e,t){var n=this[0];if(n&&3!==n.nodeType&&8!==n.nodeType&&n.style)return r.call(this,e,t)},m=function(e){return e&&e.document&&e.location&&e.alert&&e.setInterval},h=window.getComputedStyle?(p=function(e){return window.getComputedStyle(e,null)},function(e,t){return parseFloat(t)}):(p=function(e){return e.currentStyle},function(e,t){var n,r,i,o,a;return new RegExp("^("+/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source+")(?!px)[a-z%]+$","i").test(t)?(n=(a=e.style).left,o=(i=e.runtimeStyle)&&i.left,i&&(i.left=a.left),a.left=t,r=a.pixelLeft,a.left=n,o&&(i.left=o),r):parseFloat(t)}),angular.forEach({before:function(e){var t,n,r,i,o,a;if(n=this[0],(t=(o=this.parent()).contents())[0]===n)return o.prepend(e);for(r=i=1,a=t.length-1;1<=a?i<=a:a<=i;r=1<=a?++i:--i)if(t[r]===n)return void angular.element(t[r-1]).after(e);throw new Error("invalid DOM structure "+n.outerHTML)},height:function(e){return this,void 0!==e?(angular.isNumber(e)&&(e+="px"),r.call(this,"height",e)):i(this[0],"height","base")},outerHeight:function(e){return i(this[0],"height",e?"outerfull":"outer")},outerWidth:function(e){return i(this[0],"width",e?"outerfull":"outer")},offset:function(e){var t,n,r={top:0,left:0},i=this[0],o=i&&i.ownerDocument;if(arguments.length){if(void 0===e)return this;throw new Error("offset setter method is not implemented")}if(o)return t=o.documentElement,null!=i.getBoundingClientRect&&(r=i.getBoundingClientRect()),n=o.defaultView||o.parentWindow,{top:r.top+(n.pageYOffset||t.scrollTop)-(t.clientTop||0),left:r.left+(n.pageXOffset||t.scrollLeft)-(t.clientLeft||0)}},scrollTop:function(e){return t(this,"top",e)},scrollLeft:function(e){return t(this,"left",e)}},function(e,t){if(!n.prototype[t])return n.prototype[t]=e})}}])&&i(t.prototype,n),r&&i(t,r),e}();function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var s="ng-ui-scroll-hide",Q=function(){function n(e,t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),this.$animate=e.has&&e.has("$animate")?e.get("$animate"):null,this.isAngularVersionLessThen1_3=1===angular.version.major&&angular.version.minor<3,this.$q=t}return a(n,null,[{key:"addCSSRules",value:function(){var t,e="."+s,n="display: none",r=document.styleSheets[0];try{t=r.cssRules.length}catch(e){t=0}"insertRule"in r?r.insertRule(e+"{"+n+"}",t):"addRule"in r&&r.addRule(e,n,t)}}]),a(n,[{key:"hideElement",value:function(e){e.element.addClass(s)}},{key:"showElement",value:function(e){e.element.removeClass(s)}},{key:"insertElement",value:function(e,t){return t.after(e),[]}},{key:"removeElement",value:function(e){return e.element.remove(),e.scope.$destroy(),[]}},{key:"insertElementAnimated",value:function(e,t){if(!this.$animate)return this.insertElement(e,t);if(this.isAngularVersionLessThen1_3){var n=this.$q.defer();return this.$animate.enter(e,null,t,function(){return n.resolve()}),[n.promise]}return[this.$animate.enter(e,null,t)]}},{key:"removeElementAnimated",value:function(e){if(!this.$animate)return this.removeElement(e);if(this.isAngularVersionLessThen1_3){var t=this.$q.defer();return this.$animate.leave(e.element,function(){return e.scope.$destroy(),t.resolve()}),[t.promise]}return[this.$animate.leave(e.element).then(function(){return e.scope.$destroy()})]}}]),n}();function X(r,e,t){var i=Object.create(Array.prototype);return angular.extend(i,{size:e,reset:function(e){i.remove(0,i.length),i.eof=!1,i.bof=!1,i.first=e,i.next=e,i.minIndex=e,i.maxIndex=e,i.minIndexUser=null,i.maxIndexUser=null},append:function(e){e.forEach(function(e){++i.next,i.insert("append",e)}),i.maxIndex=i.eof?i.next-1:Math.max(i.next-1,i.maxIndex)},prepend:function(e){e.reverse().forEach(function(e){--i.first,i.insert("prepend",e)}),i.minIndex=i.bof?i.minIndex=i.first:Math.min(i.first,i.minIndex)},insert:function(e,t,n){var r={item:t};if(e%1==0)r.op="insert",i.splice(e,0,r),n?i.first--:i.next++;else switch(r.op=e){case"append":i.push(r);break;case"prepend":i.unshift(r)}},remove:function(e,t){if(angular.isNumber(e)){for(var n=e;n<t;n++)r.removeElement(i[n]);return i.splice(e,t-e)}return i.splice(i.indexOf(e),1),"isTop"===e._op&&i.first===this.getAbsMinIndex()?this.incrementMinIndex():this.decrementMaxIndex(),"isTop"===e._op?i.first++:i.next--,i.length||(i.first=1,i.next=1),r.removeElementAnimated(e)},incrementMinIndex:function(){if(null!==i.minIndexUser){if(i.minIndex>i.minIndexUser)return void i.minIndexUser++;i.minIndex===i.minIndexUser&&i.minIndexUser++}i.minIndex++},decrementMaxIndex:function(){null!==i.maxIndexUser&&i.maxIndex<=i.maxIndexUser&&i.maxIndexUser--,i.maxIndex--},getAbsMinIndex:function(){return null!==i.minIndexUser?Math.min(i.minIndexUser,i.minIndex):i.minIndex},getAbsMaxIndex:function(){return null!==i.maxIndexUser?Math.max(i.maxIndexUser,i.maxIndex):i.maxIndex},effectiveHeight:function(e){if(!e.length)return 0;var t=Number.MAX_VALUE,n=Number.NEGATIVE_INFINITY;return e.forEach(function(e){e.element[0].offsetParent&&(t=Math.min(t,e.element.offset().top),n=Math.max(n,e.element.offset().top+e.element.outerHeight(!0)))}),Math.max(0,n-t)}}),i.reset(t),i}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function c(e,t,n){return t&&l(e.prototype,t),n&&l(e,n),e}var f=function(){function e(){u(this,e)}return c(e,[{key:"add",value:function(e){for(var t=this.length-1;0<=t;t--)if(this[t].index===e.scope.$index)return void(this[t].height=this.rowHeight||e.element.outerHeight());this.push({index:e.scope.$index,height:this.rowHeight||e.element.outerHeight()}),this.sort(function(e,t){return e.index<t.index?-1:e.index>t.index?1:0})}},{key:"remove",value:function(e,t){for(var n=e%1==0?e:e.scope.$index,r=e%1==0?t:"isTop"===e._op,i=this.length-1;0<=i;i--)if(this[i].index===n){this.splice(i,1);break}if(!r)for(var o=this.length-1;0<=o;o--)this[o].index>n&&this[o].index--}},{key:"clear",value:function(){this.length=0}}]),e}();function d(){var e=[];return e.push.apply(e,arguments),Object.setPrototypeOf(e,d.prototype),e}d.prototype=Object.create(Array.prototype),Object.getOwnPropertyNames(f.prototype).forEach(function(e){return d.prototype[e]=f.prototype[e]});var p=function(){function n(e,t){u(this,n),this.element=function(e){if(e.nodeType!==Node.ELEMENT_NODE)throw new Error("ui-scroll directive requires an Element node for templating the view");var t;switch(e.tagName.toLowerCase()){case"dl":throw new Error("ui-scroll directive does not support <".concat(e.tagName,"> as a repeating tag: ").concat(e.outerHTML));case"tr":t=angular.element("<table><tr><td><div></div></td></tr></table>").find("tr");break;case"li":t=angular.element("<li></li>");break;default:t=angular.element("<div></div>")}return t}(e),this.cache=new d,this.cache.rowHeight=t}return c(n,[{key:"height",value:function(){return this.element.height.apply(this.element,arguments)}}]),n}();function Y(n,c,t,e,r,i,f){var d=null,h=null,o=e&&e.viewport?e.viewport:angular.element(window),a=e&&e.container?e.container:void 0,s=e&&e.scope?e.scope:r;function u(){return o.outerHeight()*i}return o.css({"overflow-anchor":"none","overflow-y":"auto",display:"block"}),angular.extend(o,{getScope:function(){return s},createPaddingElements:function(e){d=new p(e,f),h=new p(e,f),t.before(d.element),t.after(h.element),d.height(0),h.height(0)},applyContainerStyle:function(){return!a||(a!==o&&o.css("height",window.getComputedStyle(a[0]).height),0<o.height())},bottomDataPos:function(){var e=o[0].scrollHeight;return(e=null!=e?e:o[0].document.documentElement.scrollHeight)-h.height()},topDataPos:function(){return d.height()},bottomVisiblePos:function(){return o.scrollTop()+o.outerHeight()},topVisiblePos:function(){return o.scrollTop()},insertElement:function(e,t){return n.insertElement(e,t||d.element)},insertElementAnimated:function(e,t){return n.insertElementAnimated(e,t||d.element)},shouldLoadBottom:function(){return!c.eof&&o.bottomDataPos()<o.bottomVisiblePos()+u()},clipBottom:function(){for(var e=0,t=0,n=0,r=o.bottomDataPos()-o.bottomVisiblePos()-u(),i=c.length-1;0<=i&&!(r<t+(n=f||c[i].element.outerHeight(!0)));i--)h.cache.add(c[i]),t+=n,e++;0<e&&(c.eof=!1,c.remove(c.length-e,c.length),c.next-=e,o.adjustPaddings())},shouldLoadTop:function(){return!c.bof&&o.topDataPos()>o.topVisiblePos()-u()},clipTop:function(){for(var e=0,t=0,n=0,r=o.topVisiblePos()-o.topDataPos()-u(),i=0;i<c.length&&!(r<t+(n=f||c[i].element.outerHeight(!0)));i++)d.cache.add(c[i]),t+=n,e++;0<e&&(d.height(d.height()+t),c.bof=!1,c.remove(0,e),c.first+=e)},adjustPaddings:function(){if(c.length){var e=c.reduce(function(e,t){return e+(f||t.element.outerHeight(!0))},0),t=0,n=0;d.cache.forEach(function(e){e.index<c.first&&(t+=e.height,n++)});var r=0,i=0;h.cache.forEach(function(e){e.index>=c.next&&(r+=e.height,i++)});var o=(e+t+r)/(n+i+c.length),a=null!==c.minIndexUser&&c.minIndex>c.minIndexUser,s=null!==c.maxIndexUser&&c.maxIndex<c.maxIndexUser,u=a?(c.minIndex-c.minIndexUser)*o:0,l=s?(c.maxIndexUser-c.maxIndex)*o:0;d.height(t+u),h.height(r+l)}},onAfterMinIndexSet:function(e){if(null!==c.minIndexUser&&c.minIndex>c.minIndexUser){var t=d.height()-e;for(o.scrollTop(o.scrollTop()+t);0<(t-=o.scrollTop());)h.height(h.height()+t),o.scrollTop(o.scrollTop()+t)}},onAfterPrepend:function(e){if(e.prepended.length){var t=c.effectiveHeight(e.prepended),n=d.height()-t;0<=n?d.height(n):(d.height(0),o.scrollTop(o.scrollTop()-n))}},resetTopPadding:function(){d.height(0),d.cache.clear()},resetBottomPadding:function(){h.height(0),h.cache.clear()},removeCacheItem:function(e,t){d.cache.remove(e,t),h.cache.remove(e,t)},removeItem:function(e){return this.removeCacheItem(e),c.remove(e)}}),o}function h(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var J=function(){function u(e,t,n,r,i,o,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),this.$parse=t,this.$attr=n,this.viewport=r,this.buffer=i,this.doAdjust=o,this.reload=a,this.isLoading=!1,this.disabled=!1;var s=r.getScope();this.startScope=s.$parent?s:e,this.publicContext={},this.assignAdapter(n.adapter),this.generatePublicContext()}var e,t,n;return e=u,(t=[{key:"assignAdapter",value:function(t){if(t&&(t=t.replace(/^\s+|\s+$/gm,""))){var e;try{this.$parse(t).assign(this.startScope,{}),e=this.$parse(t)(this.startScope)}catch(e){throw e.message="Angular ui-scroll Adapter assignment exception.\n"+"Can't parse \"".concat(t,'" expression.\n')+e.message,e}angular.extend(e,this.publicContext),this.publicContext=e}}},{key:"generatePublicContext",value:function(){for(var i=this,e=["reload","applyUpdates","append","prepend","isBOF","isEOF","isEmpty"],t=e.length-1;0<=t;t--)this.publicContext[e[t]]=this[e[t]].bind(this);for(var o=["isLoading","topVisible","topVisibleElement","topVisibleScope","bottomVisible","bottomVisibleElement","bottomVisibleScope"],n=function(t){var n=void 0,r=i.$attr[o[t]];Object.defineProperty(i,o[t],{get:function(){return n},set:function(e){n=e,i.publicContext[o[t]]=e,r&&i.$parse(r).assign(i.startScope,e)}})},r=o.length-1;0<=r;r--)n(r);Object.defineProperty(this.publicContext,"disabled",{get:function(){return i.disabled},set:function(e){return(i.disabled=e)?null:i.doAdjust()}})}},{key:"loading",value:function(e){this.isLoading=e}},{key:"isBOF",value:function(){return this.buffer.bof}},{key:"isEOF",value:function(){return this.buffer.eof}},{key:"isEmpty",value:function(){return!this.buffer.length}},{key:"append",value:function(e){this.buffer.append(e),this.doAdjust(),this.viewport.clipTop(),this.viewport.clipBottom()}},{key:"prepend",value:function(e){this.buffer.prepend(e),this.doAdjust(),this.viewport.clipTop(),this.viewport.clipBottom()}},{key:"applyUpdates",value:function(e,t){"function"==typeof e?this.applyUpdatesFunc(e):this.applyUpdatesIndex(e,t),this.doAdjust()}},{key:"applyUpdatesFunc",value:function(t){var n=this;this.buffer.slice(0).forEach(function(e){n.applyUpdate(e,t(e.item,e.scope,e.element))})}},{key:"applyUpdatesIndex",value:function(e,t){if(e%1!=0)throw new Error("applyUpdates - "+e+" is not a valid index (should be an integer)");var n=e-this.buffer.first;0<=n&&n<this.buffer.length?this.applyUpdate(this.buffer[n],t):e>=this.buffer.getAbsMinIndex()&&e<=this.buffer.getAbsMaxIndex()&&angular.isArray(t)&&!t.length&&(this.viewport.removeCacheItem(e,e===this.buffer.minIndex),e===this.buffer.getAbsMinIndex()?this.buffer.incrementMinIndex():this.buffer.decrementMaxIndex())}},{key:"applyUpdate",value:function(t,e){var n=this;if(angular.isArray(e)){var r=this.buffer.indexOf(t);e.reverse().some(function(e){return e===t.item})||(t.op="remove",0!==r||e.length||(t._op="isTop")),e.forEach(function(e){e===t.item?r--:n.buffer.insert(r+1,e,-1===r)})}}},{key:"calculateProperties",value:function(){for(var e=null,t=0,n=!1,r=!1,i=this.buffer.length,o=0;o<i;o++){var a=this.buffer[o],s=a.element.offset().top;if(e!==s){var u=a.element.outerHeight(!0),l=this.viewport.topDataPos()+t+u;!n&&l>this.viewport.topVisiblePos()&&(n=!0,this.topVisible=a.item,this.topVisibleElement=a.element,this.topVisibleScope=a.scope),!r&&(l>=this.viewport.bottomVisiblePos()||o===i-1&&this.isEOF())&&(r=!0,this.bottomVisible=a.item,this.bottomVisibleElement=a.element,this.bottomVisibleScope=a.scope),t+=u}if(e=s,n&&r)break}}}])&&h(e.prototype,t),n&&h(e,n),u}();angular.module("ui.scroll",[]).constant("JQLiteExtras",r).run(["JQLiteExtras",function(e){!window.jQuery&&(new e).registerFor(angular.element),Q.addCSSRules()}]).directive("uiScrollViewport",function(){return{restrict:"A",controller:["$scope","$element",function(e,t){var n=this;return this.container=t,this.viewport=t,this.scope=e,angular.forEach(t.children(),function(e){"tbody"===e.tagName.toLowerCase()&&(n.viewport=angular.element(e))}),this}]}}).directive("uiScroll",["$log","$injector","$rootScope","$timeout","$interval","$q","$parse",function(e,D,F,R,W,z,q){return{require:["?^uiScrollViewport"],restrict:"A",transclude:"element",priority:1e3,terminal:!0,link:function(i,e,t,n,a){var r=t.uiScroll.match(/^\s*(\w+)\s+in\s+([(\w|\$)\.]+)\s*$/);if(!r)throw new Error("Expected uiScroll in form of '_item_ in _datasource_' but got '"+t.uiScroll+"'");function o(e,t,n){return n||(e=null===e?t:Math.floor(e)),isNaN(e)?t:e}function s(e,t,n){var r=q(e)(i);return o(r,t,n)}var u=null,l=r[1],c=r[2],f=n[0],d=Math.max(3,s(t.bufferSize,10)),h=Math.max(.3,s(t.padding,.5,!0)),p=s(t.startIndex,1),m=s(t.rowheight,null,!1),g=0,v=[],b=new Q(D,z),x=new X(b,d,p),y=new Y(b,x,e,f,F,h,m),w=new J(i,q,t,y,x,L,function(){y.resetTopPadding(),y.resetBottomPadding(),arguments.length&&(p=o(arguments[0],1,!1));x.reset(p),$(u,"minIndex"),$(u,"maxIndex"),L()});f&&(f.adapter=w);var I=function(){return"[object Object]"===Object.prototype.toString.call(u)&&"function"==typeof u.get};if(u=q(c)(i),!I()&&(u=D.get(c),!I()))throw new Error(c+" is not a valid datasource");var E=[];function $(e,t){var n;angular.isNumber(e[t])&&(n=e[t],angular.isNumber(n)&&(E=E.filter(function(e){return e.id!==t})).push({id:t,run:function(){return e[t]=n}}))}function P(n,r,i){var o,e=Object.getOwnPropertyDescriptor(n,r);e&&(e.set||e.get)||($(n,r),Object.defineProperty(n,r,{set:function(e){if(o=e,!v.length||x.length){x[i]=e;var t=y.topDataPos();y.adjustPaddings(),"minIndex"===r&&y.onAfterMinIndexSet(t)}else $(n,r)},get:function(){return o}}))}P(u,"minIndex","minIndexUser"),P(u,"maxIndex","maxIndexUser");var T=2!==u.get.length?function(e){return u.get(x.next,d,e)}:function(e){u.get({index:x.next,append:x.length?x[x.length-1].item:void 0,count:d},e)},S=2!==u.get.length?function(e){return u.get(x.first-d,d,e)}:function(e){u.get({index:x.first-d,prepend:x.length?x[0].item:void 0,count:d},e)};function k(e){return e&&e!==g||i.$$destroyed}function A(){y.unbind("resize",N),y.unbind("scroll",N)}function O(e){return!!m||e.element.height()&&e.element[0].offsetParent}function j(e,t){U(e,t,y.insertElement),O(e)||(e.unregisterVisibilityWatcher=e.scope.$watch(function(){O(e)&&(x.forEach(function(e){"function"==typeof e.unregisterVisibilityWatcher&&(e.unregisterVisibilityWatcher(),delete e.unregisterVisibilityWatcher)}),v.length||R(function(){return L()}))})),b.hideElement(e)}function U(n,e,r){var i=null,o=0<e?x[e-1].element:void 0;if(a(function(e,t){i=r(e,o),n.element=e,(n.scope=t)[l]=n.item}),w.transform){var t=n.scope.uiScrollTdInitializer;t&&t.linking?w.transform(n.scope,n.element):n.scope.uiScrollTdInitializer={onLink:function(){return w.transform(n.scope,n.element)},scope:n.scope}}return i}function M(e,t){t.animated.length?z.all(t.animated).then(function(){y.adjustPaddings(),L(e)}):y.adjustPaddings()}function V(e,t){y.shouldLoadBottom()?(!t||0<x.effectiveHeight(t.inserted))&&1===v.push(!0)&&(w.loading(!0),_(e)):y.shouldLoadTop()&&(!t||0<x.effectiveHeight(t.prepended)||v[0])&&1===v.push(!1)&&(w.loading(!0),_(e))}function C(){var e=function(){var n=[],r=[],i=[],o=[];x.forEach(function(e,t){switch(e.op){case"prepend":r.unshift(e);break;case"append":j(e,t),e.op="none",o.push(e);break;case"insert":n=n.concat(U(e,t,y.insertElementAnimated)),e.op="none",o.push(e);break;case"remove":i.push(e)}}),i.forEach(function(e){return n=n.concat(y.removeItem(e))}),r.length&&r.forEach(function(e){j(e),e.op="none"});return x.forEach(function(e,t){return e.scope.$index=x.first+t}),{prepended:r,removed:i,inserted:o,animated:n}}();return m||!i.$$phase&&!F.$$phase&&i.$digest(),e.inserted.forEach(function(e){return b.showElement(e)}),e.prepended.forEach(function(e){return b.showElement(e)}),e}function L(e){e||(v=[],e=++g);var t=C();k(e)||(M(e,t),V(e),v.length||w.calculateProperties())}function H(e){var t=C();y.onAfterPrepend(t),k(e)||(M(e,t),E.forEach(function(e){return e.run()}),E=[],V(e,t),v.shift(),v.length?_(e):(w.loading(!1),y.bind("resize",N),y.bind("scroll",N),w.calculateProperties()))}function _(t){v[0]?x.length&&!y.shouldLoadBottom()?H(t):T(function(e){k(t)||(e.length<d&&(x.eof=!0),0<e.length&&(y.clipTop(),x.append(e)),H(t))}):x.length&&!y.shouldLoadTop()?H(t):S(function(e){k(t)||(e.length<d&&(x.bof=!0),0<e.length&&(x.length&&y.clipBottom(),x.prepend(e)),H(t))})}function N(){F.$$phase||w.isLoading||w.disabled||(V(g),v.length?A():(w.calculateProperties(),m||!i.$$phase&&i.$digest()))}function B(e){if(!w.disabled){var t=y[0].scrollTop,n=y[0].scrollHeight-y[0].clientHeight;(0===t&&!x.bof||t===n&&!x.eof)&&e.preventDefault()}}a(function(e,t){y.createPaddingElements(e[0]),t.$destroy(),e.remove()}),i.$on("$destroy",function(){A(),y.unbind("mousewheel",B)}),y.bind("mousewheel",B),function(){var e=0;if(y.applyContainerStyle())L();else var t=W(function(){if(e++,y.applyContainerStyle()&&(W.cancel(t),L()),500<=50*e)throw W.cancel(t),Error("ui-scroll directive requires a viewport with non-zero height in ".concat(500,"ms"))},50)}()}}}])}]);
//# sourceMappingURL=ui-scroll.min.js.map