function oi(a,b,d,e,f,g){this.Init(a,b,d,e,f,g)}m("AdfInputSearchScrollManager",oi);r.v(oi);oi.ga=function(){this.kga="scroller";this.er="data-afr-scrollTop";this.Iga="af|inputSearch::suggestions-scroller";this.Jga="af|inputSearch::suggestions-status-message";this.QS="af_inputSearch.LABEL_FETCHING"};m("AdfInputSearchScrollManager.InitClass",oi.ga);
oi.prototype.Init=function(a,b,d,e,f,g){oi.h.Init.call(this);this.Sh=a;this.Sg=b;this.Sb=d;this.Qd=e;this.xF=f;this.Gx=g;this.yr=g.AP?g.AP:0;this.$F=I.la(a,R.Ftb);this.HX()};r.a("AdfInputSearchScrollManager.prototype.Init",{Init:oi.prototype.Init});
oi.prototype.release=function(){if(this.Qb){this.Sb.removeEventListener("scroll",this.hF);this.Qd.removeEventListener("wheel",this.ij);this.Qb.removeEventListener("scroll",this.QG);this.QG=this.ij=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.zr&&(this.Sb.removeEventListener("scroll",this.zr),this.zr=null);this.Sb.scrollTop=0;this.Sb.removeAttribute(oi.er)};
r.a("AdfInputSearchScrollManager.prototype.release",{release:oi.prototype.release});oi.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.jr);this.zr||(this.ZV()&&(this.release(),this.HX()),this.ZV()||this.noa(b,a))};r.a("AdfInputSearchScrollManager.prototype.updateCollection",{xQ:oi.prototype.xQ});
oi.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.yr>a.offsetTop||d};r.a("AdfInputSearchScrollManager.prototype.isElementHidden",{IP:oi.prototype.IP});oi.prototype.scrollIntoView=function(a,b){var d=this.Sb;d.scrollTop=b?a.offsetTop-d.offsetTop-this.yr:a.offsetTop+a.offsetHeight-d.offsetTop-d.clientHeight};r.a("AdfInputSearchScrollManager.prototype.scrollIntoView",{scrollIntoView:oi.prototype.scrollIntoView});
k=oi.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.Gx,!1,d,a),this.Qd.insertBefore(d,e))}else e=this.NF(),d=this.Cn(e)+1,d=this.xF(this.Sg,this.Gx,!1,d,a),this.Qd.appendChild(d)};k.PT=function(a){var b=this.lx(),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.hia=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.noa=function(a,b){this.PT(a);this.Qb.scrollTop=b};
k.tia=function(){var a=this.Sb.scrollTop,b=this.Sb.getAttribute(oi.er),b=b?b:0;this.Sb.setAttribute(oi.er,a);var d;this.bi&&a==this.bi.tY&&(d=this.bi.HZ,this.bi=null);if(null==d){d=this.Qd.querySelector("."+I.Sq);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.jr,0>a);this.hia(d)};k.CU=function(a,b){var d=A.c;this.yx?d.Ds(this.yx,150):this.yx=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.lx());if(b>this.Sg.wj||this.Qb&&a+this.Qb.offsetHeight==this.Qb.scrollHeight)b=this.Sg.wj-1;return b};
k.wka=function(a){return Math.round(a/this.lx())};k.mV=function(a){0>a?a=0:a>this.Sg.wj&&(a=this.Sg.wj-1);return document.getElementById(this.$F+a)};k.lx=function(){var a=this.Qd.children.length,a=0===this.yr?a:a-1;return(this.Qd.offsetHeight-this.yr)/a};k.tV=function(a){a=a?a:this.lx();return a*this.Sg.wj+this.yr+"px"};k.yla=function(){this.CU(this.zla)};k.zla=function(){this.yx=null;var a=this.Sb.getAttribute(oi.er),a=a?a:0,b=this.Sb.scrollTop;this.Sb.setAttribute(oi.er,b);a=b-a;0<a&&this.eF(this.wka(a))};
k.Ima=function(){this.yx=null;this.Mr.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.Gx,!0,b-R.jr/2),d=this.Qd.cloneNode(!1);d.appendChild(a);this.Sb.replaceChild(d,this.Qd);this.Qd.removeEventListener("wheel",this.ij);this.Qd=d;this.Qd.addEventListener("wheel",this.ij);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.xna=function(a){this.Qb.scrollTop+=-1*a.deltaY};k.jpa=function(a){function b(){0<d--&&f.Qb&&(f.Qb.scrollTop+=e,requestAnimationFrame(b))}var d=20,e=-1*a.deltaY*a.Xaa/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.Mr.style.display="block",this.CU(this.Ima))}};k.ZV=function(){return null==this.Qb};
k.HX=function(){if(q.b.Dd())this.zr=this.D(this.yla),this.Sb.addEventListener("scroll",this.zr);else if(this.Sb.clientHeight<this.Qd.offsetHeight&&this.Sg.length>R.jr){this.Sb.scrollTop=0;var a=A.c,b=a.H();this.Qb=document.createElement("div");this.Qb.setAttribute("id",I.la(this.Sh,oi.kga));C.w(this.Qb,b.getStyleClass(oi.Iga));var d=document.createElement("div");C.jm(d,"visibility: hidden");d.style.height=this.tV();this.Mr=document.createElement("div");C.w(this.Mr,b.getStyleClass(oi.Jga));this.Mr.textContent=
b.Z(oi.QS);this.Qb.appendChild(d);this.Sb.appendChild(this.Qb);this.Sb.appendChild(this.Mr);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.tia);this.ij=this.D(this.EW);this.QG=this.D(this.DN);this.Sb.addEventListener("scroll",this.hF);this.Qd.addEventListener("wheel",this.ij);this.Qb.addEventListener("scroll",this.QG);a={};a[qi.dE]=this.D(this.xna);a[qi.jK]=this.D(this.jpa);
b={};b[qi.MODE]=qi.VJ;this.Bg=new qi(this.Sb,a,b)}};