define(["exports","./basetab.js","./../modules/cardbuilder/cardbuilder.js","./../modules/emby-apiclient/connectionmanager.js","./../modules/common/itemmanager/itemmanager.js","./../modules/common/globalize.js","./../modules/common/appsettings.js"],function(_exports,_basetab,_cardbuilder,_connectionmanager,_itemmanager,_globalize,_appsettings){function onCardAction(e){var e=e.detail.item,apiClient=_connectionmanager.default.getApiClient(e);apiClient.getItem(apiClient.getCurrentUserId(),e.Id).then(function(item){return options={html:item.Overview||"",confirmButton:!1,title:_itemmanager.default.getDisplayName(item),centerText:!1,confirmText:_globalize.default.translate("Close"),item:item},Emby.importModule("./modules/common/dialogs/alert.js").then(function(alert){return alert(options)});var options})}function PeopleTab(view){_basetab.default.apply(this,arguments)}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,Object.assign(PeopleTab.prototype,_basetab.default.prototype),PeopleTab.prototype.loadTemplate=function(){var view=this.view;return view.innerHTML='\n                    <div is="emby-scroller" data-mousewheel="false" data-focusscroll="true" class="padded-top-focusscale padded-bottom-focusscale">\n                        <div is="emby-itemscontainer" data-focusabletype="nearest" class="focusable focuscontainer-x scrollSlider itemsContainer videoosd-padded-left videoosd-padded-right" data-virtualscrolllayout="horizontal-grid"></div>\n                    </div>\n',this.itemsContainer=view.querySelector(".itemsContainer"),this.itemsContainer.fetchData=function(query){var item=this.currentOptions.displayItem,serverId=item.ServerId,totalRecordCount=(item=(item.People||[]).map(function(p){return(p=Object.assign({},p)).ServerId=serverId,"Person"!==p.Type&&(p.PersonType=p.Type,p.Type="Person"),p})).length;return query&&(item=item.slice(query.StartIndex||0),query.Limit)&&item.length>query.Limit&&(item.length=query.Limit),Promise.resolve({Items:item,TotalRecordCount:totalRecordCount})}.bind(this),this.itemsContainer.getListOptions=function(items){return{renderer:_cardbuilder.default,options:{shape:"portrait",cardLayout:!1,centerText:!0,sideFooter:!1,fields:["Name","PersonRole"],cardFooterAside:!1,showPersonRoleOrType:!0,multiSelect:!1,coverImage:!0,draggable:!1,contextMenu:!1,playedButton:!1,ratingButton:!1,cardClass:"videoOsd-itemstab-card videoOsd-itemstab-card-twoline",action:_appsettings.default.enableVideoUnderUI()?null:"custom",enableUserData:!1,allowBottomPadding:!1,textLinks:!1,imageClass:null,enableFocusScaling:!1},virtualScrollLayout:"horizontal-grid"}}.bind(this),this.itemsContainer.addEventListener("action-null",onCardAction.bind(this)),Promise.resolve()},PeopleTab.prototype.onResume=function(options){var instance=this;return _basetab.default.prototype.onResume.apply(this,arguments).then(function(){var optionsWithoutRefresh=Object.assign(Object.assign({},options),{refresh:!1});return instance.itemsContainer.resume(optionsWithoutRefresh).then(function(){options.refresh&&instance.refreshItem()})})},PeopleTab.prototype.refreshItem=function(){_basetab.default.prototype.refreshItem.apply(this,arguments),this.itemsContainer.refreshItems()},PeopleTab.prototype.onPause=function(){_basetab.default.prototype.onPause.apply(this,arguments),this.itemsContainer.pause()},PeopleTab.prototype.destroy=function(){_basetab.default.prototype.destroy.apply(this,arguments),this.itemsContainer=null};_exports.default=PeopleTab});