import BaseTab from"./basetab.js";import cardBuilder from"./../modules/cardbuilder/cardbuilder.js";import playbackManager from"./../modules/common/playback/playbackmanager.js";import focusManager from"./../modules/focusmanager.js";import layoutManager from"./../modules/layoutmanager.js";function fetchItems(query){let chapters=this.currentOptions.currentDisplayChapters||[];var totalItems=chapters.length;return query&&(chapters=chapters.slice(query.StartIndex||0),query.Limit)&&chapters.length>query.Limit&&(chapters.length=query.Limit),Promise.resolve({Items:chapters,TotalRecordCount:totalItems})}function getListOptions(items){return{renderer:cardBuilder,options:{shape:"autooverflow",fields:["Name","ChapterTime"],multiSelect:!1,contextMenu:!1,playedButton:!1,ratingButton:!1,action:"custom",playAction:"custom",enableUserData:!1,draggable:!1,cardClass:"videoOsd-itemstab-card videoOsd-itemstab-card-twoline",defaultShape:"backdrop",allowBottomPadding:!1,background:"black",textLinks:!1,enableFocusScaling:!1},virtualScrollLayout:"horizontal-grid"}}function onCardAction(e){e=e.detail.item;playbackManager.seek(e.StartPositionTicks||0),this.closeTab()}function ChaptersTab(view){BaseTab.apply(this,arguments)}Object.assign(ChaptersTab.prototype,BaseTab.prototype);let FocusScrollOffset="-padding-inline-start";function scrollToCurrent(instance,focus){var currentIndex=instance.getCurrentIndex();console.log("scrolling to chapter index: "+currentIndex),instance.itemsContainer.scrollToIndex(currentIndex,{offsetLeft:FocusScrollOffset},focus)}ChaptersTab.prototype.loadTemplate=function(){var view=this.view;return view.innerHTML=`