/*
@license
dhtmlxScheduler v.5.1.6 Stardard

This software is covered by GPL license. You also can obtain Commercial or Enterprise license to use it in non-GPL project - please contact sales@dhtmlx.com. Usage without proper license is prohibited.

(c) Dinamenta, UAB.
*/
!function(){function e(){a=!1,scheduler.callEvent("onAfterSchedulerResize",[]),a=!0}scheduler.config.container_autoresize=!0,scheduler.config.month_day_min_height=90,scheduler.config.min_grid_size=25,scheduler.config.min_map_size=400;var t=scheduler._pre_render_events,a=!0,i=0,n=0;scheduler._pre_render_events=function(e,r){if(!scheduler.config.container_autoresize||!a)return t.apply(this,arguments);var l=this.xy.bar_height,o=this._colsS.heights,d=this._colsS.heights=[0,0,0,0,0,0,0],s=this._els.dhx_cal_data[0];
if(e=this._table_view?this._pre_render_events_table(e,r):this._pre_render_events_line(e,r),this._table_view)if(r)this._colsS.heights=o;else{var _=s.firstChild;if(_.rows){for(var c=0;c<_.rows.length;c++){if(d[c]++,d[c]*l>this._colsS.height-this.xy.month_head_height){var u=_.rows[c].cells,h=this._colsS.height-this.xy.month_head_height;1*this.config.max_month_events!==this.config.max_month_events||d[c]<=this.config.max_month_events?h=d[c]*l:(this.config.max_month_events+1)*l>this._colsS.height-this.xy.month_head_height&&(h=(this.config.max_month_events+1)*l);
for(var p=0;p<u.length;p++)u[p].childNodes[1].style.height=h+"px";d[c]=(d[c-1]||0)+u[0].offsetHeight}d[c]=(d[c-1]||0)+_.rows[c].cells[0].offsetHeight}d.unshift(0),_.parentNode.offsetHeight<_.parentNode.scrollHeight&&!_._h_fix}else if(e.length||"visible"!=this._els.dhx_multi_day[0].style.visibility||(d[0]=-1),e.length||-1==d[0]){var v=(_.parentNode.childNodes,(d[0]+1)*l+1);n!=v+1&&(this._obj.style.height=i-n+v-1+"px"),v+="px",s.style.top=this._els.dhx_cal_navline[0].offsetHeight+this._els.dhx_cal_header[0].offsetHeight+parseInt(v,10)+"px",
s.style.height=this._obj.offsetHeight-parseInt(s.style.top,10)-(this.xy.margin_top||0)+"px";var m=this._els.dhx_multi_day[0];m.style.height=v,m.style.visibility=-1==d[0]?"hidden":"visible",m=this._els.dhx_multi_day[1],m.style.height=v,m.style.visibility=-1==d[0]?"hidden":"visible",m.className=d[0]?"dhx_multi_day_icon":"dhx_multi_day_icon_small",this._dy_shift=(d[0]+1)*l,d[0]=0}}return e};var r=["dhx_cal_navline","dhx_cal_header","dhx_multi_day","dhx_cal_data"],l=function(e){i=0;for(var t=0;t<r.length;t++){
var a=r[t],l=scheduler._els[a]?scheduler._els[a][0]:null,o=0;switch(a){case"dhx_cal_navline":case"dhx_cal_header":o=parseInt(l.style.height,10);break;case"dhx_multi_day":o=l?l.offsetHeight-1:0,n=o;break;case"dhx_cal_data":var d=scheduler.getState().mode;if(o=l.childNodes[1]&&"month"!=d?l.childNodes[1].offsetHeight:Math.max(l.offsetHeight-1,l.scrollHeight),"month"==d){if(scheduler.config.month_day_min_height&&!e){var s=l.getElementsByTagName("tr").length;o=s*scheduler.config.month_day_min_height}e&&(l.style.height=o+"px");
}else if("year"==d)o=190*scheduler.config.year_y;else if("agenda"==d){if(o=0,l.childNodes&&l.childNodes.length)for(var _=0;_<l.childNodes.length;_++)o+=l.childNodes[_].offsetHeight;o+2<scheduler.config.min_grid_size?o=scheduler.config.min_grid_size:o+=2}else if("week_agenda"==d){for(var c,u,h=scheduler.xy.week_agenda_scale_height+scheduler.config.min_grid_size,p=0;p<l.childNodes.length;p++){u=l.childNodes[p];for(var _=0;_<u.childNodes.length;_++){for(var v=0,m=u.childNodes[_].childNodes[1],b=0;b<m.childNodes.length;b++)v+=m.childNodes[b].offsetHeight;
c=v+scheduler.xy.week_agenda_scale_height,c=1!=p||2!=_&&3!=_?c:2*c,c>h&&(h=c)}}o=3*h}else if("map"==d){o=0;for(var g=l.querySelectorAll(".dhx_map_line"),_=0;_<g.length;_++)o+=g[_].offsetHeight;o+2<scheduler.config.min_map_size?o=scheduler.config.min_map_size:o+=2}else if(scheduler._gridView)if(o=0,l.childNodes[1].childNodes[0].childNodes&&l.childNodes[1].childNodes[0].childNodes.length){for(var g=l.childNodes[1].childNodes[0].childNodes[0].childNodes,_=0;_<g.length;_++)o+=g[_].offsetHeight;o+=2,o<scheduler.config.min_grid_size&&(o=scheduler.config.min_grid_size);
}else o=scheduler.config.min_grid_size;if(scheduler.matrix&&scheduler.matrix[d]){if(e)o+=0,l.style.height=o+"px";else{o=0;for(var x=scheduler.matrix[d],y=x.y_unit,f=0;f<y.length;f++)o+=x._section_height[y[f].key]}o-=1}("day"==d||"week"==d||scheduler._props&&scheduler._props[d])&&(o+=2)}o+=1,i+=o}scheduler._obj.style.height=i+"px",e||scheduler.updateView()},o=function(){if(!scheduler.config.container_autoresize||!a)return!0;var t=scheduler.getState().mode;if(!t)return!0;var i=document.documentElement.scrollTop;
if(l(),scheduler.matrix&&scheduler.matrix[t]||"month"==t){var n=window.requestAnimationFrame||window.setTimeout;n(function(){l(!0),document.documentElement.scrollTop=i,e()},1)}else e()};scheduler.attachEvent("onBeforeViewChange",function(){var e=scheduler.config.container_autoresize;if(scheduler.xy.$original_scroll_width||(scheduler.xy.$original_scroll_width=scheduler.xy.scroll_width),scheduler.xy.scroll_width=e?0:scheduler.xy.$original_scroll_width,scheduler.matrix)for(var t in scheduler.matrix){
var a=scheduler.matrix[t];a.$original_section_autoheight||(a.$original_section_autoheight=a.section_autoheight),e?a.section_autoheight=!1:a.section_autoheight=a.$original_section_autoheight}return!0}),scheduler.attachEvent("onViewChange",o),scheduler.attachEvent("onXLE",o),scheduler.attachEvent("onEventChanged",o),scheduler.attachEvent("onEventCreated",o),scheduler.attachEvent("onEventAdded",o),scheduler.attachEvent("onEventDeleted",o),scheduler.attachEvent("onAfterSchedulerResize",o),scheduler.attachEvent("onClearAll",o),
scheduler.attachEvent("onBeforeExpand",function(){return a=!1,!0}),scheduler.attachEvent("onBeforeCollapse",function(){return a=!0,!0})}();
//# sourceMappingURL=../sources/ext/dhtmlxscheduler_container_autoresize.js.map