')+'
'+'
')+function(dayOfWeek){for(var date=new Date;0
")+(''+getDisplayTime(a.StartHour)+" - "+getDisplayTime(a.EndHour)+"
"))+""+('
');return index++,itemHtml+="
"}).join(""),page.querySelector(".accessScheduleList").innerHTML=html}function saveUser(user,page){user.Policy.MaxParentalRating=page.querySelector(".selectMaxParentalRating").value||null,user.Policy.IsTagBlockingModeInclusive="include"===page.querySelector(".selectTagMode").value,user.Policy.AllowTagOrRating="any"===page.querySelector(".selectMultiRestrictionMode").value,user.Policy.BlockUnratedItems=Array.prototype.filter.call(page.querySelectorAll(".chkUnratedItem"),function(i){return i.checked}).map(function(i){return i.getAttribute("data-itemtype")}),user.Policy.AccessSchedules=getSchedulesFromPage(page),user.Policy.BlockedTags=function(page){return Array.prototype.map.call(page.querySelectorAll(".blockedTag"),function(elem){return elem.getAttribute("data-tag")})}(page),ApiClient.updateUserPolicy(user.Id,user.Policy).then(function(){_loading.default.hide(),_formhelper.default.handleConfigurationSavedResponse()})}function getDisplayTime(hours){var minutes=0,pct=hours%1;return pct&&(minutes=parseInt(60*pct)),_datetime.default.getDisplayTime(new Date(2e3,1,1,hours,minutes,0,0))}function getSchedulesFromPage(page){return Array.prototype.map.call(page.querySelectorAll(".liSchedule"),function(elem){return{DayOfWeek:elem.getAttribute("data-day"),StartHour:elem.getAttribute("data-start"),EndHour:elem.getAttribute("data-end")}})}function showBlockedTagPopup(instance,page){var options;options={label:_globalize.default.translate("LabelTag")},Emby.importModule("./modules/prompt/prompt.js").then(function(prompt){return prompt(options)}).then(function(value){var tags=instance.tags;-1===tags.indexOf(value)&&(tags.push(value),loadBlockedTags(page,tags))})}function onValueChange(){var view=this.view,selectMaxParentalRating=view.querySelector(".selectMaxParentalRating"),selectTagMode=(selectMaxParentalRating.value?view.querySelector(".blockUnratedItems").classList.remove("hide"):view.querySelector(".blockUnratedItems").classList.add("hide"),view.querySelector(".selectTagMode"));selectMaxParentalRating.value&&"include"===selectTagMode.value?view.querySelector(".fldMultiRestrictionMode").classList.remove("hide"):view.querySelector(".fldMultiRestrictionMode").classList.add("hide")}function ParentalControlTab(view,params,options){_basetab.default.apply(this,arguments),this.apiClient=ApiClient,view.addEventListener("change",onValueChange.bind(this));var instance=this;view.querySelector(".btnAddSchedule").addEventListener("click",function(){var page,schedule,index;page=view,schedule={},index=-1,_accessschedule.default.show({schedule:schedule=schedule||{}}).then(function(updatedSchedule){var schedules=getSchedulesFromPage(page);schedules[index=-1===index?schedules.length:index]=updatedSchedule,renderAccessSchedule(page,schedules)})}),view.querySelector(".btnAddBlockedTag").addEventListener("click",function(){showBlockedTagPopup(instance,view)}),view.querySelector(".blockedTags").addEventListener("click",function(e){var tag,e=e.target.closest(".btnDeleteTag");e&&(tag=e.getAttribute("data-tag"),instance.tags=instance.tags.filter(function(t){return t!==tag}),loadBlockedTags(view,instance.tags))}),view.querySelector(".accessScheduleList").addEventListener("click",function(e){e=e.target.closest(".btnDeleteAccessScheduleItem");e&&!function(instance,page,index){(instance=instance.schedules).splice(index,1),renderAccessSchedule(page,instance)}(instance,view,parseInt(e.getAttribute("data-index")))}),view.querySelector(".userParentalControlForm").addEventListener("submit",function(e){var page=this.view,userId=(_loading.default.show(),params.userId);return ApiClient.getUser(userId,!1).then(function(result){saveUser(result,page)}),e.preventDefault(),e.stopPropagation(),!1}.bind(this));for(var btns=view.querySelectorAll(".userEditTabButton"),i=0,length=btns.length;i