Server : Apache/2.4.43 (Win64) OpenSSL/1.1.1g PHP/7.4.6
System : Windows NT USER-PC 6.1 build 7601 (Windows 7 Professional Edition Service Pack 1) AMD64
User : User ( 0)
PHP Version : 7.4.6
Disable Function : NONE
Directory :  C:/Program Files/Avast Software/Avast/gui_resources/default_av/
Upload File :
Current Directory [ Writeable ] Root Directory [ Writeable ]


Current File : C:/Program Files/Avast Software/Avast/gui_resources/default_av/DoNotDisturb.js
//{"name":"DoNotDisturb","version":"1.2.285","created":"2021-03-09T09:25:43.513Z"}
import e from"./ractive.js";import{serviceRequest as t,napiTracker as s,eventer as i,windowApi as a}from"./napi.js";import{logger as n}from"./libs.js";import o from"./ractiveComponents.js";import{nls as l}from"./i18n.js";const d=e.extend({template:{v:3,t:[{t:7,e:"Modal",a:{title:[{t:3,x:{r:["nls"],s:'_0("doNotDisturb.rename.title")'}}],subtitle:[{t:2,r:"appToRename.path"}]},f:[{t:7,e:"div",a:{class:"form__row"},v:{click:"clearInputErrors"},f:[{t:7,e:"Input",a:{id:"changeAppName",innerValue:[{t:2,r:"newAppName"}],label:[{t:3,x:{r:["nls"],s:'_0("global.appName")'}}],type:"text",error:[{t:2,r:"inputError"}]}}]}," ",{t:7,e:"div",a:{class:"modal__actions"},f:[{t:7,e:"button",a:{"data-test":"dnd_confirmRenameApp",class:"btn"},v:{click:"rename"},f:[{t:3,x:{r:["nls"],s:'_0("global.rename")'}}]}]}]}]},data:()=>({appToRename:void 0,newAppName:"",inputError:!1}),oninit(){this.log=n.createLogger("doNotDisturb.renameAppModal");const e=this.get("appToRename.name");this.set("newAppName",e),this.on("Modal.close",(()=>{this.fire("closeModal")})),this.on("rename",(()=>{const e=this.get("newAppName");if(!e)return void this.set("inputError",!0);const s=this.get("appToRename");if(e!==s.name){const i=s;i.name=e,t("app.gameMode.SetGame",i).then((()=>{this.fire("appRenamed"),this.fire("closeModal")}))}else this.fire("closeModal")})),this.on("clearInputErrors",(()=>{this.set("inputError",!1)}))}}),p=e.extend({template:{v:3,t:[{t:4,f:[{t:7,e:"Modal",a:{title:[{t:3,x:{r:["nls","appsToRemove.length"],s:'_0("doNotDisturb.removeApps.title",_1)'}}],subtitle:[{t:3,x:{r:["nls","appsToRemove.length"],s:'_0("doNotDisturb.removeApps.subtitle",_1)'}}]},f:[{t:7,e:"div",a:{class:"modal__actions"},f:[{t:7,e:"button",a:{"data-test":"dnd_confirmRemoveApp",class:"btn"},v:{click:"remove"},f:[{t:3,x:{r:["nls"],s:'_0("global.remove")'}}]}," ",{t:7,e:"button",a:{"data-test":"dnd_closeModal",class:"btn -secondary g-margin-left--10"},v:{click:"Modal.close"},f:[{t:3,x:{r:["nls"],s:'_0("global.cancel")'}}]}]}]}],n:50,x:{r:["appsToRemove.length"],s:"_0>1"}},{t:4,n:51,f:[{t:7,e:"Modal",a:{title:[{t:3,x:{r:["nls","appsToRemove.0.name"],s:'_0("doNotDisturb.removeApp.title",_1)'}}],subtitle:[{t:3,x:{r:["nls"],s:'_0("doNotDisturb.remove.title")'}}]},f:[{t:7,e:"div",a:{class:"modal__actions"},f:[{t:7,e:"button",a:{"data-test":"dnd_confirmRemoveApp",class:"btn"},v:{click:"remove"},f:[{t:3,x:{r:["nls"],s:'_0("doNotDisturb.remove.confirm")'}}]}," ",{t:7,e:"button",a:{"data-test":"dnd_closeModal",class:"btn -secondary g-margin-left--10"},v:{click:"Modal.close"},f:[{t:3,x:{r:["nls"],s:'_0("doNotDisturb.remove.cancel")'}}]}]}]}],x:{r:["appsToRemove.length"],s:"_0>1"}}]},data:()=>({appsToRemove:[]}),oninit(){this.log=n.createLogger("doNotDisturb.removeAppsModal"),this.on("remove",(()=>{const e=this.get("appsToRemove").map((e=>t("app.gameMode.RemoveGame",e.path)));Promise.all(e).then((()=>{this.fire("appsRemoved"),this.fire("closeModal"),this.log.info("apps successfully removed")})).catch((e=>{this.log.error("error while executing app.gameMode.RemoveGame",JSON.stringify(e))}))})),this.on("Modal.close",(()=>{this.fire("closeModal")}))}}),r=1,c=e.extend({twoway:!1,template:{v:3,t:[{t:7,e:"kin-table",a:{datalength:[{t:2,r:"addedApps.length"}],selecteditems:[{t:2,r:"selectedAppsPaths.length"}]},f:[{t:7,e:"div",a:{slot:"table-header",role:"row",class:"dnd_table__header"},f:[{t:7,e:"input",v:{click:"selectAllApps"},a:{type:"checkbox",class:["checkbox ",{t:4,f:["-some-checked"],n:50,x:{r:["addedApps.length","selectedAppsPaths.length"],s:"_0!==_1&&_1>0"}}," ",{t:4,f:["-checked"],n:50,x:{r:["addedApps.length","selectedAppsPaths.length"],s:"_0===_1&&_1>0"}}],disabled:[{t:2,x:{r:["addedApps.length"],s:"_0===0"}}],checked:[{t:4,f:["true"],n:50,x:{r:["selectedAppsPaths.length"],s:"_0>0"}},{t:4,n:51,f:["false"],x:{r:["selectedAppsPaths.length"],s:"_0>0"}}],title:[{t:2,x:{r:["nls"],s:'_0("global.selectAllItems")'}}]}}," ",{t:7,e:"div"}," ",{t:7,e:"div",a:{role:"columnheader"},f:[{t:3,x:{r:["nls"],s:'_0("global.appName")'}}]}," ",{t:7,e:"div",a:{role:"columnheader"},f:[{t:3,x:{r:["nls"],s:'_0("global.location")'}}]}," ",{t:7,e:"div"}," ",{t:7,e:"div"}]}," ",{t:7,e:"div",a:{slot:"table-body"},f:[{t:4,f:[{t:7,e:"div",a:{role:"row",class:["kin_table__row -hoverable ",{t:2,x:{r:["runningAppPath","./path"],s:'_0&&_0===_1?"-selected dnd_running__app":""'}}," ",{t:2,x:{r:["runningAppPath","./path"],s:'_0&&_0!==_1?"-inactive":""'}}],"data-test":["table-row-",{t:2,r:"@index"}],"aria-rowindex":[{t:2,r:"@index"}]},f:[{t:7,e:"input",v:{click:{n:"selectApp",d:[{t:2,r:"."}]}},a:{type:"checkbox",class:"checkbox",checked:[{t:2,x:{r:["selectedAppsPaths","./path"],s:"_0.includes(_1)?true:false"}}],id:["dnd-item-",{t:2,r:"@index"}],title:[{t:2,x:{r:["nls"],s:'_0("global.selectItem")'}}," - ",{t:2,r:"./name"}]}}," ",{t:7,e:"div",a:{class:"kin_table__icon"},f:[{t:7,e:"ImgIcon",a:{src:["data:image/png;base64,",{t:2,r:"icon"}]}}," ",{t:4,f:[{t:7,e:"Icon",a:{cssCls:"color-ok -text dnd_playing",name:"run-small"}}],n:50,x:{r:["runningAppPath","./path"],s:"_0===_1"}}]}," ",{t:7,e:"div",a:{class:"kin_table__name"},f:[{t:7,e:"label",a:{for:["dns-item-",{t:2,r:"@index"}]},f:[{t:2,r:"./name"}]}]}," ",{t:7,e:"div",a:{dir:"ltr"},f:[{t:7,e:"p",a:{"data-test":"dnd_list__item-path",id:["path-tooltip-opener-",{t:2,r:"@index"}],class:"g-ellipsis"},f:[{t:2,r:"./path"}]}," ",{t:7,e:"Tooltip",a:{openerSelector:["#path-tooltip-opener-",{t:2,r:"@index"}],showOnEllipsis:"true",cssCls:"-link",position:"bottom",alignment:"left"},f:[{t:2,r:"./path"}]}]}," ",{t:4,f:[{t:7,e:"div",a:{class:"kin_table__end"},f:[{t:7,e:"label",a:{for:["dnd_list__item-switch_",{t:2,r:"@index"}],class:[{t:2,x:{r:["./enabled"],s:'_0?"color-ok":"color-critical"'}}," -text span -small g-margin-right--5"]},f:[{t:3,x:{r:["nls"],s:'_0("doNotDisturb.switch")'}}]}," ",{t:7,e:"Switch",a:{attr:["{id:'dnd_list__item-switch_",{t:2,r:"@index"},"', dataTest:'dnd_list__item-switch_",{t:2,r:"@index"},"'}"],checked:[{t:2,r:"./enabled"}],cssCls:"-tiny",title:[{t:2,r:"./name"}," - ",{t:2,x:{r:["./enabled","nls"],s:'_0?_1("global.turnOff"):_1("global.turnOn")'}}," ",{t:2,x:{r:["nls"],s:'_0("doNotDisturb.name")'}}]},v:{domClick:"toggleAppMode"}}]}," ",{t:7,e:"div",a:{class:"kin_table__actions"},f:[{t:7,e:"kin-dropdown",f:[{t:7,e:"span",a:{slot:"dropdown-activator"},f:[{t:7,e:"kin-button",a:{icononly:0,type:"blank",size:"small",class:["moreOptions-tooltip-",{t:2,r:"@index"}],title:[{t:2,x:{r:["nls"],s:'_0("global.moreOptions")'}}],"data-test":"kin_table-item-options"},f:[{t:7,e:"kin-icon",a:{name:"icon-s-controls-menu-more",size:"14"}}]}," ",{t:7,e:"Tooltip",a:{position:"top",alignment:"center",margin:"10"},f:[{t:3,x:{r:["nls"],s:'_0("global.moreOptions")'}}]}]}," ",{t:7,e:"kin-dropdown-item",a:{"data-test":["dnd_list__item-launch_",{t:2,r:"@index"}]},v:{click:{n:"runApp",d:[{t:2,r:"."}]}},f:[{t:3,x:{r:["nls"],s:'_0("global.launch")'}}]}," ",{t:7,e:"kin-dropdown-item",a:{"data-test":["dnd_list__item-rename_",{t:2,r:"@index"}]},v:{click:{n:"renameApp",d:[{t:2,r:"."}]}},f:[{t:3,x:{r:["nls"],s:'_0("global.rename")'}}]}," ",{t:7,e:"kin-dropdown-item",a:{"data-test":["dnd_list__item-remove_",{t:2,r:"@index"}]},v:{click:{n:"removeApp",d:[{t:2,r:"."}]}},f:[{t:3,x:{r:["nls"],s:'_0("global.remove")'}}]}," ",{t:7,e:"kin-dropdown-item",a:{type:"custom"},f:[{t:7,e:"label",a:{class:"tooltip-pseudo -left dnd_table__tooltip",title:[{t:3,x:{r:["nls"],s:'_0("doNotDisturb.menu.maxPerformance.tooltip")'}}]},f:[{t:7,e:"input",a:{type:"checkbox",class:"checkbox g-margin-right--5","data-test":["dnd_list__item-checkbox-maximizePerformance_",{t:2,r:"@index"}],checked:[{t:2,x:{r:["./category"],s:"_0===1"}}]},v:{click:{n:"maximizeAppPerformance",d:[{t:2,r:"."}]}}}," ",{t:3,x:{r:["nls"],s:'_0("doNotDisturb.menu.maxPerformance.label")'}}]}]}]}]}],n:50,x:{r:["runningAppPath","./path"],s:"_0!==_1"}},{t:4,n:51,f:[{t:7,e:"div",f:[{t:7,e:"div",a:{class:"dnd_table__running"},f:[{t:7,e:"div",f:[{t:7,e:"p",a:{class:"p"},f:[{t:3,x:{r:["nls"],s:'_0("doNotDisturb.running.title")'}}]}," ",{t:7,e:"p",a:{class:"-small p -secondary"},f:[{t:3,x:{r:["nls"],s:'_0("doNotDisturb.running.subtitle")'}}]}]}]}]}," ",{t:7,e:"div",f:[{t:7,e:"Icon",a:{cssCls:"g-font--24",name:"dnd-mode"}}]}],x:{r:["runningAppPath","./path"],s:"_0!==_1"}}]}],n:52,r:"addedApps"}]}," ",{t:7,e:"div",a:{slot:"table-empty-icon",class:"svg -empty-table"}}," ",{t:7,e:"div",a:{slot:"table-empty"},f:[{t:7,e:"p",f:[{t:3,x:{r:["nls"],s:'_0("doNotDisturb.empty.desc.1")'}}]}," ",{t:7,e:"p",f:[{t:3,x:{r:["nls"],s:'_0("doNotDisturb.empty.desc.2")'}}]}]}]}," ",{t:4,f:[{t:7,e:"RenameAppModal",a:{appToRename:[{t:2,r:"appToRename"}]}}],n:50,x:{r:["modalDialog"],s:'_0==="renameApp"'}},{t:4,f:[{t:7,e:"RemoveAppsModal",a:{appsToRemove:[{t:2,r:"appsToRemove"}]}}],n:50,x:{r:["modalDialog"],s:'_0==="removeApps"'}}]},components:{RenameAppModal:d,RemoveAppsModal:p},data:()=>({addedApps:[],selectedAppsPaths:[],modalDialog:void 0,appToRename:void 0,appsToRemove:[],runningAppPath:void 0}),oninit(){this._deselectAll=function(){this.get("selectedAppsPaths").length>0&&this._selectAllApps(!1)},this._deselectAllBind=this._deselectAll.bind(this),window.addEventListener("kin-deselectAll",this._deselectAllBind),this.listeners=[],this.log=n.createLogger("doNotDisturb.games"),this.initAddedApps(),this._addListeners(),this.on("selectAllApps",(e=>{this._selectAllApps(e.node.checked)})),this.on("toggleAppMode",((e,s)=>{const i=e.node.id.split("_").pop(),a=this.get("addedApps")[i],n={name:a.name,path:a.path,icon:a.icon,enabled:!s};t("app.gameMode.SetGame",n).then((()=>{this.initAddedApps()})).catch((()=>{this.initAddedApps()}))})),this.on("maximizeAppPerformance",((e,i)=>{i.category=1===i.category?2:1,s.event("DoNotDisturb",1===i.category?"Maximize perf checked":"Maximize perf unchecked",i.name),t("app.gameMode.SetGame",i).then((()=>{this.initAddedApps()})).catch((e=>{this.log.error("error while executing app.gameMode.SetGame",JSON.stringify(e))}))})),this.on("runApp",((e,i)=>{this.log.info("run app requested"),s.event("DoNotDisturb","Launch",i.name),t("app.gameMode.RunGame",i.path).then((()=>{this.log.info("game successfully run")})).catch((e=>{this.log.error("error while executing app.gameMode.RunGame",JSON.stringify(e))}))})),this.on("removeApp",((e,t)=>{this.log.info("remove app requested"),s.event("DoNotDisturb","Remove",t.name),this.set("appsToRemove",[t]),this.set("modalDialog","removeApps")})),this.on("removeApps",(()=>{this.log.info("remove multiple apps requested");const e=this.get("selectedAppsPaths"),t=this.get("addedApps").filter((t=>e.includes(t.path)));this.set("appsToRemove",t),this.set("modalDialog","removeApps")})),this.on("renameApp",((e,t)=>{this.log.info("remame app requested"),s.event("DoNotDisturb","Rename",t.name),this.set("appToRename",t),this.set("modalDialog","renameApp")})),this.on("selectApp",((e,t)=>{const s=this.get("selectedAppsPaths");e.node.checked?s.includes(t.path)||s.push(t.path):s.splice(s.indexOf(t.path),1),this.set("selectedAppsPaths",s),this.fire("selectedAppsPathsUpdate",s)})),this.on("RenameAppModal.appRenamed",(()=>{this.set("appToRename",void 0),this.initAddedApps()})),this.on("RemoveAppModal.appRemoved",(()=>{this._appRemovedCheckSelected(this.get("appToRemove")),this.set("appToRemove",void 0),this.initAddedApps()})),this.on("RemoveAppsModal.appsRemoved",(()=>{this._appsRemovedCheckSelected(),this.initAddedApps()})),this.on("*.closeModal",(()=>{this.set("modalDialog",void 0)}))},_appRemovedCheckSelected(e){const t=this.get("selectedAppsPaths");t.includes(e.path)&&(t.splice(t.indexOf(e.path),1),this.set("selectedAppsPaths",t),this.fire("selectedAppsPathsUpdate",t))},_appsRemovedCheckSelected(){this.set("selectedAppsPaths",[]),this.fire("selectedAppsPathsUpdate",[])},_selectAllApps(e){const t=this.get("addedApps");if(this.set("selectedAppsPaths",[]),e){const e=t.map((e=>e.path));this.set("selectedAppsPaths",e),this.fire("selectedAppsPathsUpdate",e)}else this.fire("selectedAppsPathsUpdate",[])},addNewApp(){this.set("modalDialog","selectNewApp")},initAddedApps(){this.log.info("polling addedApps"),t("app.gameMode.GetApps",{sort_by:r}).then((e=>{this.log.info("addedApps polled"),this.log.debug("addedApps: "+JSON.stringify(e)),this.merge("addedApps",e,{compare:"path"}),this.fire("loading",!1),this.fire("addedAppsUpdate",e)})).catch((e=>{this.log.error("error while executing app.gameMode.GetApps",e)}))},_setRunningApp(e){e&&e.path?(this.set("runningAppPath",e.path),setTimeout((()=>{const e=document.getElementsByClassName("dnd_running__app")[0],t=document.getElementById("dnd-scroll-cont");e&&t&&(t.scrollTop=e.offsetTop)}))):this.set("runningAppPath",void 0),this.update("addedApps")},_addListeners(){this.listeners.push(i.on("gameMode.onStatusChanged.GameModeStarted",(e=>{this._setRunningApp(e?e.game:void 0)}))),this.listeners.push(i.on("gameMode.onStatusChanged.GameModeStopped",(()=>{this._setRunningApp(void 0)}))),this.listeners.push(i.on("gameMode.onStatusChanged.GameDetected",(()=>{this.log.info("game change detected"),this.initAddedApps()}))),this.listeners.push(i.on("app.gameMode.GameRemoved",(()=>{this.log.info("game change removed"),this.initAddedApps()}))),this.listeners.push(i.on("gameMode.onStatusChanged.GameRemoved",(()=>{this.log.info("game change removed"),this.initAddedApps()})))},onteardown(){this.listeners.forEach((e=>{e()})),window.removeEventListener("kin-deselectAll",this._deselectAllBind),this._deselectAllBind=void 0}});const h=e.extend({template:{v:3,t:[{t:7,e:"Page",a:{heading:[{t:3,x:{r:["nls"],s:'_0("doNotDisturb.name")'}}],cssCls:"dnd",settingsUrl:"#Settings/DoNotDisturb",backHash:"#performance"},f:[{t:7,e:"div",a:{slot:"breadcrumbs"},f:[{t:7,e:"Crumbs",a:{section:"performance",customBreadcrumbs:0,moduleId:"gaming",moduleTranslationId:"doNotDisturb.name"}}]}," ",{t:7,e:"div",a:{slot:"page-content",class:"dnd"},f:[{t:7,e:"kin-view",a:{loading:[{t:2,r:"loading"}]},f:[{t:7,e:"div",a:{slot:"description"},f:[{t:7,e:"p",a:{class:"kin_description__text"},f:[{t:3,x:{r:["nls"],s:'_0("doNotDisturb.desc")'}}]}]}," ",{t:7,e:"div",a:{slot:"cta"},f:[{t:7,e:"kin-button",a:{"data-test":"dnd_addNewApp"},v:{click:"addNewApp"},f:[{t:3,x:{r:["nls"],s:'_0("doNotDisturb.addApp.btn")'}}]}]}," ",{t:7,e:"div",a:{slot:"view-content"},f:[{t:7,e:"AddedAppsList"}]}," ",{t:7,e:"div",a:{slot:"view-actions"},f:[{t:7,e:"div",a:{class:"kin_actions__left"},f:[{t:3,x:{r:["nls","selectedAppsPaths.length"],s:'_0("doNotDisturb.applicationsSelected",_1)'}}]}," ",{t:7,e:"div",f:[{t:7,e:"kin-button",a:{size:"small","data-test":"dnd_table_mainCTA"},v:{click:"removeApps"},f:[{t:2,x:{r:["nls","addedApps.length","selectedAppsPaths.length"],s:'_0(_1===_2?"global.removeAll":"global.removeSelected")'}}]}]}," ",{t:7,e:"div",a:{class:"kin_actions__right"},f:[{t:3,x:{r:["nls"],s:'_0("global.escToDeselect")'}}]}]}]}]}]}," ",{t:4,f:[{t:7,e:"SelectNewAppModal",a:{title:[{t:3,x:{r:["nls"],s:'_0("doNotDisturb.selectApp.title")'}}],desc:[{t:3,x:{r:["nls"],s:'_0("doNotDisturb.selectApp.subtitle")'}}],addedAppPaths:[{t:2,r:"addedAppPaths"}]}}],n:50,x:{r:["modalDialog"],s:'_0==="selectNewApp"'}}]},css:"[slot='table-header'],\n.kin_table__row {\n  grid-template-columns: 5% 22% 38% 30% 5%;\n}\n[slot='table-header'].-selected,\n.kin_table__row.-selected {\n  background-color: rgba(170,170,180,0.15);\n  border: 1px solid rgba(255,255,255,0.4);\n}\n[slot='table-header'] > div:first-of-type,\n.kin_table__row > div:first-of-type {\n  position: relative;\n}\n.dnd_table__tooltip {\n  white-space: nowrap;\n  cursor: pointer;\n}\n.dnd_table__tooltip input {\n  transform: none !important;\n  opacity: 1 !important;\n}\n.dnd_table__tooltip:after {\n  white-space: normal;\n  width: 30rem;\n}\n.dnd .dnd_table__icon {\n  font-size: 24px;\n}\n.dnd .-inactive {\n  pointer-events: none;\n}\n.dnd .dnd_hidden {\n  display: none;\n}\n.dnd .dnd_table__running {\n  display: flex;\n  justify-content: flex-end;\n  align-items: center;\n}\n.dnd .dnd_playing {\n  position: absolute;\n  font-size: 14px;\n  bottom: 0.5rem;\n  border-radius: 20px;\n  background-color: #fff;\n  width: 2rem;\n  height: 2rem;\n  line-height: 2rem;\n  text-align: center;\n  margin: 0 1.5rem;\n}\n",components:{AddedAppsList:c,SelectNewAppModal:o.InstalledApps},data:()=>({addedApps:[],selectedAppsPaths:[],modalDialog:void 0,loading:!0}),computed:{addedAppPaths:{get:function(){return this.get("addedApps").map((e=>e.path))},set:function(){}}},oninit(){this.listeners=[],this.addedAppsList=this.findComponent("AddedAppsList"),this.on("AddedAppsList.addedAppsUpdate",(e=>{this.set("addedApps",e)})),this.on("AddedAppsList.selectedAppsPathsUpdate",(e=>{this.set("selectedAppsPaths",e)})),this.on("AddedAppsList.loading",(e=>{this.set("loading",e)})),this.on("addNewApp",(()=>{this.set("modalDialog","selectNewApp"),s.event("DoNotDisturb","Add App modal open")})),this.on("SelectNewAppModal.appSelected",this.addApp.bind(this)),this.on("SelectNewAppModal.selectAppPath",(()=>{s.event("DoNotDisturb","Select path"),this.set("modalDialog",void 0)})),this.on("SelectNewAppModal.close",(()=>{this.set("modalDialog",void 0)})),this.on("removeApps",(()=>{const e=this.findComponent("AddedAppsList");e&&e.fire("removeApps")}))},addApp(e){s.event("DoNotDisturb","Add app",e.name),t("app.gameMode.SetGame",{name:e.name,path:e.path,icon:e.icon,enabled:!0,category:2,appType:e.appType,appUserModelId:e.appUserModelId}).then((()=>{this.addedAppsList.initAddedApps()}))},onteardown(){this.listeners.forEach((e=>e()))}}),m=n.createLogger("gaming.whitelist"),g={whitelistTitle:"doNotDisturb.settings.whitelist.title",whitelistDesc:"doNotDisturb.settings.whitelist.desc",whitelistAddApp:"doNotDisturb.settings.whitelist.addApp",whitelistConfirmRemove:"doNotDisturb.settings.whitelist.confirmRemove",whitelistCancelRemove:"doNotDisturb.settings.whitelist.cancelRemove",whitelistNoApps:"doNotDisturb.settings.whitelist.noApps",whitelistClose:"global.close",appListTitle:"doNotDisturb.settings.whitelist.appList.title"},u=e.extend({template:{v:3,t:[{t:7,e:"Modal",a:{title:[{t:3,x:{r:["nls","STRINGS.whitelistTitle"],s:"_0(_1)"}}],subtitle:[{t:3,x:{r:["nls","STRINGS.whitelistDesc"],s:"_0(_1)"}}],scrollable:0},f:[{t:7,e:"div",a:{class:"modal"},f:[{t:4,f:[{t:7,e:"kin-loading"}],n:50,x:{r:["ignoredApps"],s:"_0==null"}},{t:4,n:51,f:[{t:4,f:[{t:7,e:"table",a:{class:"table -small"},f:[{t:4,f:[{t:7,e:"tr",a:{class:["-hoverable ",{t:4,f:["-expanded -selected"],n:50,x:{r:["showRemoveConfirmationIndex","index"],s:"_0===_1"}}]},f:[{t:7,e:"td",f:[{t:2,r:"name"}]}," ",{t:7,e:"td",f:[{t:2,r:"filePath"}]}," ",{t:7,e:"td",a:{class:"table__delete"},f:[{t:7,e:"button",a:{class:"a",title:[{t:3,x:{r:["nls"],s:'_0("global.remove")'}}]},v:{click:"remove"},f:[{t:7,e:"kin-icon",a:{name:"icon-s-controls-bin",size:"16"}}]}]}]}," ",{t:4,f:[{t:7,e:"tr",f:[{t:7,e:"td",a:{colspan:"3",class:"table__last"},f:[{t:7,e:"button",a:{class:"btn -small -critical"},v:{click:"confirmRemove"},f:[{t:3,x:{r:["nls","STRINGS.whitelistConfirmRemove"],s:"_0(_1)"}}]}," ",{t:7,e:"button",a:{class:"btn -small -secondary"},v:{click:"cancelRemove"},f:[{t:3,x:{r:["nls","STRINGS.whitelistCancelRemove"],s:"_0(_1)"}}]}]}]}],n:50,x:{r:["showRemoveConfirmationIndex","index"],s:"_0===_1"}}],i:"index",r:"ignoredApps"}]}],n:50,r:"ignoredApps.length"},{t:4,n:51,f:[{t:3,x:{r:["nls","STRINGS.whitelistNoApps"],s:"_0(_1)"}}],r:"ignoredApps.length"}],x:{r:["ignoredApps"],s:"_0==null"}}]}," ",{t:7,e:"div",a:{class:"modal__footer"},f:[{t:7,e:"button",a:{class:"btn"},v:{click:"showAppList"},f:[{t:3,x:{r:["nls","STRINGS.whitelistAddApp"],s:"_0(_1)"}}]}," ",{t:7,e:"button",a:{class:"btn -secondary"},v:{click:"close"},f:[{t:3,x:{r:["nls","STRINGS.whitelistClose"],s:"_0(_1)"}}]}]}]}," ",{t:4,f:[{t:7,e:"InstalledApps",a:{title:[{t:3,x:{r:["nls","STRINGS.appListTitle"],s:"_0(_1)"}}],desc:[{t:3,x:{r:["nls","STRINGS.whitelistDesc"],s:"_0(_1)"}}],addedAppPaths:[{t:2,r:"ignoredAppPaths"}]}}],n:50,r:"showAppList"}]},components:{InstalledApps:o.InstalledApps},data:function(){return{STRINGS:g,ignoredApps:null,ignoredAppPaths:[],showRemoveConfirmationIndex:null,showAppList:!1}},oninit(){m.debug("oninit"),this.on("Modal.modalClose",(()=>{this.fire("close")})),this.on("InstalledApps.close",(()=>{i.emit("Settings.gaTrack","Whitelist","Close app list"),this.set("showAppList",!1)})),this.on("showAppList",(()=>{i.emit("Settings.gaTrack","Whitelist","Open app list"),this.set("showAppList",!0)})),this.on("InstalledApps.appSelected",(e=>{i.emit("Settings.gaTrack","Whitelist","Add app",e.name),this.setApp({name:e.name,filePath:e.path,ignore:!0})})),this.on("remove",(e=>{this.set("showRemoveConfirmationIndex",e.index.index)})),this.on("cancelRemove",(()=>{this.set("showRemoveConfirmationIndex",null)})),this.on("confirmRemove",(e=>{const t=this.get(e.keypath);i.emit("Settings.gaTrack","Whitelist","Remove app",t.name),t.ignore=!1,this.get("ignoredApps").splice(e.index.index,1),this.set("showRemoveConfirmationIndex",null),this.setApp(t)})),this.loadIgnoredApps()},loadIgnoredApps(){return t("app.gameMode.GetDdowIgnoreList").then((e=>{const t=e.filter((e=>e.ignore));this.set("ignoredApps",t),this.set("ignoredAppPaths",t.map((e=>e.filePath)))})).catch((e=>{m.error("loading ignored apps failed",e)}))},setApp(e){t("app.gameMode.SetDdowIgnoredApp",e).then(this.loadIgnoredApps.bind(this)).catch((t=>{m.error("setting app failed",e,t)}))}}),b=n.createLogger("gaming.settings"),_={title:"doNotDisturb.name",desc:"doNotDisturb.settings.desc",disableDrawOverWindow:"doNotDisturb.settings.disableDrawOverWindow",disableDrawOverWindowDesc:"doNotDisturb.settings.disableDrawOverWindow.desc",pauseAllAvInterruptions:"doNotDisturb.settings.pauseAllAvInterruptions",pauseAllAvInterruptionsDesc:"doNotDisturb.settings.pauseAllAvInterruptions.desc",pauseAllWindowsUpdates:"doNotDisturb.settings.pauseAllWindowsUpdates",pauseAllWindowsUpdatesDesc:"doNotDisturb.settings.pauseAllWindowsUpdates.desc",enableAutoDetections:"doNotDisturb.settings.enableAutoDetections",enableAutoDetectionsDesc:"doNotDisturb.settings.enableAutoDetections.desc",whitelistLinkLabel:"doNotDisturb.settings.whitelist.linkLabel"},A={disableDrawOverWindow:{path:"avcfg://settings/GamingMode/GameRule_BlockDistractions_Enabled",label:l(_.disableDrawOverWindow),desc:l(_.disableDrawOverWindowDesc),track:{subject:"Silence notifications from 3rd-party apps"},search:{title:_.disableDrawOverWindow,desc:_.disableDrawOverWindowDesc}},whitelistLink:{id:"dnd_settings_whitelistLink",label:l(_.whitelistLinkLabel),search:_.whitelistLinkLabel},pauseAllAvInterruptions:{path:"avcfg://settings/GamingMode/GameRule_NoAvastInterruptions_Enabled",label:l(_.pauseAllAvInterruptions),desc:l(_.pauseAllAvInterruptionsDesc),track:{subject:"Silence Avast notifications"},search:{title:_.pauseAllAvInterruptions,desc:_.pauseAllAvInterruptionsDesc}},pauseAllWindowsUpdates:{path:"avcfg://settings/GamingMode/GameRule_PauseAllUpdateTasks_Enabled",label:l(_.pauseAllWindowsUpdates),desc:l(_.pauseAllWindowsUpdatesDesc),track:{subject:"Pause Windows updates"},search:{title:_.pauseAllWindowsUpdates,desc:_.pauseAllWindowsUpdatesDesc}},enableAutoDetections:{path:"avcfg://settings/GamingMode/GameRule_AutoDetectNewApps_Enabled",label:l(_.enableAutoDetections),desc:l(_.enableAutoDetectionsDesc),track:{subject:"Automatically add new apps"},search:{title:_.enableAutoDetections,desc:_.enableAutoDetectionsDesc}}},f={title:_.title,desc:_.desc,items:A},v=e.extend({template:{v:3,t:[{t:7,e:"SettingsContainer",a:{component:[{t:2,r:"component"}],title:[{t:3,x:{r:["nls","STRINGS.title"],s:"_0(_1)"}}],desc:[{t:3,x:{r:["nls","STRINGS.desc"],s:"_0(_1)"}}],noEnable:"true"},f:[{t:7,e:"SettingsCheckbox",a:{property:[{t:2,r:"properties.disableDrawOverWindow"}]},f:[{t:7,e:"button",a:{class:"settings__indent a -small -secondary",id:[{t:2,r:"properties.whitelistLink.id"}],"data-test":"openWhitelist"},v:{click:"openWhitelist"},f:[{t:3,r:"properties.whitelistLink.label"}]}]}," ",{t:7,e:"SettingsCheckbox",a:{property:[{t:2,r:"properties.pauseAllAvInterruptions"}]}}," ",{t:7,e:"SettingsCheckbox",a:{property:[{t:2,r:"properties.pauseAllWindowsUpdates"}]}}," ",{t:7,e:"SettingsCheckbox",a:{property:[{t:2,r:"properties.enableAutoDetections"}]}}]}," ",{t:4,f:[{t:7,e:"Whitelist"}],n:50,r:"showWhitelist"}]},components:{Whitelist:u},data:()=>({STRINGS:_,component:"gaming",showWhitelist:!1,properties:A}),oninit(){b.debug("oninit"),this.on("openWhitelist",(()=>{i.emit("Settings.gaTrack","Whitelist","Open"),b.info("opening Notification Whitelist"),this.set("showWhitelist",!0)})),this.on("Whitelist.close",(()=>{i.emit("Settings.gaTrack","Whitelist","Close"),this.set("showWhitelist",!1)}))}}),x=[{path:"avcfg://settings/GamingMode/GameRule_MaximumPerformance_Enabled",label:"Maximum performance",type:"checkbox"},{path:"avcfg://settings/GamingMode/GameRule_DisableAvNotifications_Enabled",label:"Disable AV notifications",type:"checkbox"},{path:"avcfg://settings/GamingMode/GameRule_DisableDrawOverWindow_Enabled",label:"Disable draw over window",type:"checkbox"},{path:"avcfg://settings/GamingMode/GameRule_PauseWindowsUpdate_Enabled",label:"Pause Windows updates",type:"checkbox"},{path:"avcfg://settings/GamingMode/GameRule_PauseAvBackgroundTasks_Enabled",label:"Pause AV background tasks",type:"checkbox"},{path:"avcfg://settings/GamingMode/GameRule_PauseSystemBackgroundTasks_Enabled",label:"Pause system background tasks",type:"checkbox"},{path:"avcfg://settings/GamingMode/GameRule_SetHighPerformanceMode_Enabled",label:"Set high performance mode",type:"checkbox"},{path:"avcfg://settings/GamingMode/GameRule_SetHighPriority_Enabled",label:"Set high priority",type:"checkbox"},{path:"avcfg://settings/GamingMode/GameRule_DisableWinUpdateAutoReboot_Enabled",label:"Disable Windows update auto reboot",type:"checkbox"},{path:"avcfg://settings/GamingMode/GameRule_DisableWindowsNotifications_Enabled",label:"Disable Windows notifications",type:"checkbox"},{path:"avcfg://settings/GamingMode/GameRule_EnableAutoDetections_Enabled",label:"Enable auto detections",type:"checkbox"},{path:"avcfg://settings/GamingMode/GameRule_SetProcessAffinity_Enabled",label:"Set process affinity",type:"checkbox"},{path:"avcfg://settings/GamingMode/GameRule_MeasurePerformance_Enabled",label:"Measure performance",type:"checkbox"},{path:"avcfg://settings/GamingMode/GameRule_SuspendNongamingUserProcesses_Enabled",label:"Suspend Non-gaming user processes",type:"checkbox"},{path:"avcfg://settings/GamingMode/GameRule_SetCpuLimit_Enabled",label:"Set CPU limit",type:"checkbox"}],w=n.createLogger("doNotDisturb.toasters.gameAdded"),D=e.components.Toaster.extend({windowClose:a.close,asyncLoad:!0,gaTrack:s,data:function(){return{text:null,autoResize:!0}},oninit:function(){this._super(),this._game=void 0;const e=this.get("params.gamePath");w.info("oninit; gamePath: "+e),this.on("doAction",(function(){s.event("DoNotDisturb","Got It Button",this._game.name),a.close({reason:a.CLOSE_REASONS.navigateToOtherWindow})})),this.on("doAreaAction",(function(){w.info("opening game list"),s.event("DoNotDisturb","DND list click",this._game.name),t("app.windowManager.ShowMainWindow",{route:"DoNotDisturb"}).then((function(){a.close({reason:a.CLOSE_REASONS.navigateToOtherWindow})})).catch((function(e){w.error("opening dnd mode failed",e)}))})),t("app.gameMode.GetGame",e).then((e=>{w.info("game received"),this._game=e,s.event("DoNotDisturb","DND toaster opened",this._game.name),w.debug("game: "+JSON.stringify(e));const t='<img src="data:image/png;base64,'+e.icon+'" height="48" />'+"<br><br>"+('<div class="text">'+l("doNotDisturb.gameAddedToaster.title",e.name)+"</div>")+"<br>"+l("doNotDisturb.gameAddedToaster.desc")+"<br><br>";this.set("buttonLabel",l("global.gotIt")),this.set("text",t),this.set("loading",!1),this.ready()})).catch((e=>{w.error("getting game failed",e),a.close({reason:a.CLOSE_REASONS.error})}))}});export default h;export{D as gameAddedToaster,v as settings,x as settingsGeek,f as settingsSearchStrings};const k={name:"DoNotDisturb",version:"1.2.285",created:"2021-03-09T09:25:43.513Z"};export{k as metadata};