function ii(a,b,d,e,f,g){this.Init(a,b,d,e,f,g)}m("AdfInputSearchScrollManager",ii);r.v(ii);ii.ga=function(){this.iga="scroller";this.dr="data-afr-scrollTop";this.Gga="af|inputSearch::suggestions-scroller";this.Hga="af|inputSearch::suggestions-status-message";this.QS="af_inputSearch.LABEL_FETCHING"};m("AdfInputSearchScrollManager.InitClass",ii.ga);
ii.prototype.Init=function(a,b,d,e,f,g){ii.h.Init.call(this);this.Sh=a;this.Sg=b;this.Sb=d;this.Qd=e;this.xF=f;this.Fx=g;this.xr=g.AP?g.AP:0;this.$F=I.la(a,R.Ftb);this.HX()};r.a("AdfInputSearchScrollManager.prototype.Init",{Init:ii.prototype.Init});
ii.prototype.release=function(){if(this.Qb){this.Sb.removeEventListener("scroll",this.hF);this.Qd.removeEventListener("wheel",this.hj);this.Qb.removeEventListener("scroll",this.QG);this.QG=this.hj=this.hF=null;var a=A.c.Ka().La()?"padding-left":"padding-right",b=this.Sb.style;b.removeProperty(a);b.removeProperty("overflow");this.Bg.release();this.Bg=null}else this.yr&&(this.Sb.removeEventListener("scroll",this.yr),this.yr=null);this.Sb.scrollTop=0;this.Sb.removeAttribute(ii.dr)};
r.a("AdfInputSearchScrollManager.prototype.release",{release:ii.prototype.release});ii.prototype.xQ=function(a){this.Sg=a;a=this.Qb?this.Qb.scrollTop:this.Sb.scrollTop;var b=this.OF(a);100>this.Cn(this.NF())-b&&this.eF(R.ir);this.yr||(this.ZV()&&(this.release(),this.HX()),this.ZV()||this.koa(b,a))};r.a("AdfInputSearchScrollManager.prototype.updateCollection",{xQ:ii.prototype.xQ});
ii.prototype.IP=function(a){var b=this.Sb,d=b.scrollTop+b.offsetTop+b.offsetHeight<a.offsetTop+a.offsetHeight;return b.scrollTop+b.offsetTop+this.xr>a.offsetTop||d};r.a("AdfInputSearchScrollManager.prototype.isElementHidden",{IP:ii.prototype.IP});ii.prototype.scrollIntoView=function(a,b){var d=this.Sb;d.scrollTop=b?a.offsetTop-d.offsetTop-this.xr:a.offsetTop+a.offsetHeight-d.offsetTop-d.clientHeight};r.a("AdfInputSearchScrollManager.prototype.scrollIntoView",{scrollIntoView:ii.prototype.scrollIntoView});
k=ii.prototype;k.eF=function(a,b){u.Da(a);var d;if(b){var e=this.pV(),f=this.Cn(e);0>=f||(d=f-a,0>d&&(d=0,a=f),d=this.xF(this.Sg,this.Fx,!1,d,a),this.Qd.insertBefore(d,e))}else e=this.NF(),d=this.Cn(e)+1,d=this.xF(this.Sg,this.Fx,!1,d,a),this.Qd.appendChild(d)};k.PT=function(a){var b=this.kx(),d=this.tV(b);this.Qb.firstChild.style.height=d;v.l.fine("Total height of the scroller adjusted to ",d);this.Rn=a*b;this.Rn=0>this.Rn?0:Math.round(this.Rn)};
k.fia=function(a){v.l.fine("Adjusting the scroll position to item index ",a);this.PT(a);v.l.fine("Scroll top adjusted to ",this.Rn);this.Qb.scrollTop=this.Rn};k.koa=function(a,b){this.PT(a);this.Qb.scrollTop=b};
k.ria=function(){var a=this.Sb.scrollTop,b=this.Sb.getAttribute(ii.dr),b=b?b:0;this.Sb.setAttribute(ii.dr,a);var d;this.bi&&a==this.bi.tY&&(d=this.bi.HZ,this.bi=null);if(null==d){d=this.Qd.querySelector("."+I.Rq);if(!d)return;d=this.Cn(d)}u.assert(null!=d);v.l.fine("Scrolled into view of element with index ",d);a-=b;100>(0<a?this.Cn(this.NF())-d:d-this.Cn(this.pV()))&&this.eF(R.ir,0>a);this.fia(d)};k.CU=function(a,b){var d=A.c;this.xx?d.Cs(this.xx,150):this.xx=d.ta(this,a,b,150,{isSynchronized:!0})};
k.Cn=function(a){u.u(a);return parseInt(a.id.substring(this.$F.length))};k.aW=function(a){return(a=a.getAttribute("id"))&&0===a.indexOf(this.$F)};k.pV=function(){for(var a=this.Qd.firstElementChild;!this.aW(a);)a=a.nextElementSibling;return a};k.NF=function(){for(var a=this.Qd.lastElementChild;!this.aW(a);)a=a.previousElementSibling;return a};k.OF=function(a){var b=Math.round(a/this.kx());if(b>this.Sg.vj||this.Qb&&a+this.Qb.offsetHeight==this.Qb.scrollHeight)b=this.Sg.vj-1;return b};
k.tka=function(a){return Math.round(a/this.kx())};k.mV=function(a){0>a?a=0:a>this.Sg.vj&&(a=this.Sg.vj-1);return document.getElementById(this.$F+a)};k.kx=function(){var a=this.Qd.children.length,a=0===this.xr?a:a-1;return(this.Qd.offsetHeight-this.xr)/a};k.tV=function(a){a=a?a:this.kx();return a*this.Sg.vj+this.xr+"px"};k.vla=function(){this.CU(this.wla)};k.wla=function(){this.xx=null;var a=this.Sb.getAttribute(ii.dr),a=a?a:0,b=this.Sb.scrollTop;this.Sb.setAttribute(ii.dr,b);a=b-a;0<a&&this.eF(this.tka(a))};
k.Fma=function(){this.xx=null;this.Lr.style.display="none";if(0!=this.Qd.offsetHeight){var a=this.Qb.scrollTop,b=this.OF(a);v.l.fine("Long Jump, the item index is ",b,", derived from the scroll top ",a);var a=this.xF(this.Sg,this.Fx,!0,b-R.ir/2),d=this.Qd.cloneNode(!1);d.appendChild(a);this.Sb.replaceChild(d,this.Qd);this.Qd.removeEventListener("wheel",this.hj);this.Qd=d;this.Qd.addEventListener("wheel",this.hj);if(a=this.mV(b))this.bi={},this.bi.HZ=b,this.scrollIntoView(a,!0),this.bi.tY=this.Sb.scrollTop}};
k.EW=function(a){q.b.Ea(a);v.l.fine("Mouse wheel triggered with deltaY ",a.deltaY);this.Qb.scrollTop+=a.deltaY};k.una=function(a){this.Qb.scrollTop+=-1*a.deltaY};k.fpa=function(a){function b(){0<d--&&f.Qb&&(f.Qb.scrollTop+=e,requestAnimationFrame(b))}var d=20,e=-1*a.deltaY*a.Vaa/d,f=this;requestAnimationFrame(b)};
k.DN=function(){var a=this.Qb.scrollTop;if(a!=this.Rn){var b=this.OF(a),d=this.mV(b);d?(v.l.fine("Small scroll, the item index is ",b,", derived from the scroll top ",a,". The corresponding element is ",d.id),this.bi={},this.bi.HZ=b,this.scrollIntoView(d,!0),this.bi.tY=this.Sb.scrollTop):(this.Lr.style.display="block",this.CU(this.Fma))}};k.ZV=function(){return null==this.Qb};
k.HX=function(){if(q.b.Dd())this.yr=this.D(this.vla),this.Sb.addEventListener("scroll",this.yr);else if(this.Sb.clientHeight<this.Qd.offsetHeight&&this.Sg.length>R.ir){this.Sb.scrollTop=0;var a=A.c,b=a.H();this.Qb=document.createElement("div");this.Qb.setAttribute("id",I.la(this.Sh,ii.iga));C.w(this.Qb,b.getStyleClass(ii.Gga));var d=document.createElement("div");C.jm(d,"visibility: hidden");d.style.height=this.tV();this.Lr=document.createElement("div");C.w(this.Lr,b.getStyleClass(ii.Hga));this.Lr.textContent=
b.Z(ii.QS);this.Qb.appendChild(d);this.Sb.appendChild(this.Qb);this.Sb.appendChild(this.Lr);a=a.Ka().La()?"padding-left":"padding-right";b=this.Sb.style;b.setProperty(a,this.Qb.offsetWidth-this.Qb.clientWidth+"px");b.setProperty("overflow","hidden");this.hF=this.D(this.ria);this.hj=this.D(this.EW);this.QG=this.D(this.DN);this.Sb.addEventListener("scroll",this.hF);this.Qd.addEventListener("wheel",this.hj);this.Qb.addEventListener("scroll",this.QG);a={};a[oi.dE]=this.D(this.una);a[oi.jK]=this.D(this.fpa);
b={};b[oi.MODE]=oi.VJ;this.Bg=new oi(this.Sb,a,b)}};