define(["datetime","listView","loading"],function(datetime,listView,loading){"use strict";function isSameDay(date1,date2){return date1.toDateString()===date2.toDateString()}function renderPrograms(page,result){for(var html="",currentItems=[],currentStartDate=null,i=0,length=result.Items.length;i<length;i++){var item=result.Items[i],itemStartDate=datetime.parseISO8601Date(item.StartDate);currentStartDate&&isSameDay(currentStartDate,itemStartDate)||(currentItems.length&&(html+='<div class="verticalSection verticalDetailSection">',html+='<h2 class="sectionTitle padded-left">'+datetime.toLocaleDateString(currentStartDate,{weekday:"long",month:"long",day:"numeric"})+"</h2>",html+='<div is="emby-itemscontainer" class="vertical-list padded-left padded-right">'+listView.getListViewHtml({items:currentItems,enableUserDataButtons:!1,showParentTitle:!0,image:!1,showProgramTime:!0,mediaInfo:!1,parentTitleWithTitle:!0})+"</div></div>"),currentStartDate=itemStartDate,currentItems=[]),currentItems.push(item)}page.querySelector("#childrenContent").innerHTML=html}function loadPrograms(page,channelId){ApiClient.getLiveTvPrograms({ChannelIds:channelId,UserId:Dashboard.getCurrentUserId(),HasAired:!1,SortBy:"StartDate",EnableTotalRecordCount:!1,EnableImages:!1,ImageTypeLimit:0,EnableUserData:!1}).then(function(result){renderPrograms(page,result),loading.hide()})}return{renderPrograms:loadPrograms}});