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/BrowserExtensions.js
//{"name":"BrowserExtensions","version":"1.2.151","created":"2021-03-09T09:26:02.908Z"}
import e from"./ractive.js";import t from"./i18n.js";import{debugMode as s,serviceRequest as n,napiTracker as r}from"./napi.js";const o={v:3,t:[{t:7,e:"Page",a:{heading:[{t:2,x:{r:["nls"],s:'_0("bex")'}}],loading:[{t:2,r:"loading"}]},f:[{t:7,e:"div",a:{slot:"page-content"},f:[{t:7,e:"kin-view",f:[{t:7,e:"div",a:{slot:"description"},f:[{t:7,e:"p",a:{class:"kin_description__text"},f:[{t:7,e:"span",a:{class:"h3 g-margin-top--10 g-margin-bottom--10"},f:[{t:7,e:"span",a:{class:"bex_logo logo -brand -ameba -white g-margin-right--5"}}," ",{t:2,x:{r:["nls"],s:'_0("bex.aos.title")'}}]}," ",{t:2,x:{r:["nls"],s:'_0("bex.aos.desc")'}}]}]}," ",{t:7,e:"div",a:{slot:"view-content"},f:[{t:4,f:[{t:8,r:"ratings_and_users"}],n:50,r:"showUsersAndRatings"}," ",{t:7,e:"kin-table",f:[{t:7,e:"div",a:{slot:"table-body",class:"g-margin-top--40"},f:[{t:4,f:[{t:8,r:"partial_extension_row"}],n:52,r:"aosInBrowsers"}]}]}]}]}]}]}," ",{t:4,f:[{t:7,e:"Modal",a:{title:[{t:2,x:{r:["nls"],s:'_0("bex.errorRestoreModal.title")'}}]},f:[{t:7,e:"div",a:{class:"g-margin-bottom--20"},f:[{t:2,x:{r:["nls"],s:'_0("bex.sending.error")'}}]}," ",{t:4,f:[{t:7,e:"pre",a:{class:"color-critical -text g-margin-bottom--10"},f:["Debug error: ",{t:2,r:"errorModal"}]}],n:50,r:"DEBUG"}," ",{t:7,e:"div",a:{class:"modal__footer"},f:[{t:7,e:"button",a:{class:"btn -secondary"},v:{click:"Modal.close"},f:[{t:2,x:{r:["nls"],s:'_0("global.close")'}}]}]}]}],n:50,r:"errorModal"}," "],p:{partial_extension_row:[{t:7,e:"div",a:{role:"row",class:["kin_table__row ",{t:2,x:{r:["isBrowserInstalled"],s:'_0?"":"-disabled"'}}],"aria-rowindex":[{t:2,r:"@index"}]},f:[{t:7,e:"div",a:{class:"kin_table__name"},f:[{t:7,e:"i",a:{class:["bex_browser_icon svg -",{t:2,r:"./iconName"}]}}," ",{t:2,r:"./displayName"}]}," ",{t:7,e:"div",a:{class:"kin_table__end"},f:[{t:4,f:[{t:4,f:[{t:7,e:"Icon",a:{name:"tick",cssCls:"color-ok -text"}},"  ",{t:4,f:[{t:2,x:{r:["nls"],s:'_0("bex.installed")'}}],n:50,x:{r:["./browser"],s:'_0==="Edge"'}},{t:4,n:51,f:[{t:2,x:{r:["nls"],s:'_0("bex.enabled")'}}],x:{r:["./browser"],s:'_0==="Edge"'}}],n:50,r:"./isExtensionActive"},{t:4,n:51,f:[{t:7,e:"button",a:{class:"btn -small"},v:{click:{n:"openStoreExtension",d:[{t:2,r:"./browser"},",",{t:2,r:"./extensionName"}]}},f:[{t:2,x:{r:["nls"],s:'_0("bex.btn.enable")'}}]}],r:"./isExtensionActive"}],n:50,r:"./isExtensionInstalled"},{t:4,n:51,f:[{t:4,n:50,x:{r:["./isBrowserInstalled"],s:"!_0"},f:[{t:2,x:{r:["nls"],s:'_0("bex.browserNotInstalled")'}}]},{t:4,n:50,x:{r:["./isBrowserInstalled"],s:"_0"},f:[" ",{t:7,e:"button",a:{class:"btn -small"},v:{click:{n:"openStoreExtension",d:[{t:2,r:"./browser"},",",{t:2,r:"./extensionName"}]}},f:[{t:2,x:{r:["nls"],s:'_0("bex.btn.enable")'}}]}]}],r:"./isExtensionInstalled"}]}]}],ratings_and_users:[{t:7,e:"p",a:{class:"text g-margin-top--10"},f:[{t:7,e:"span",a:{class:"bex_stars"},f:[{t:7,e:"Icon",a:{name:"star",cssCls:"bex_unrated"}}," ",{t:7,e:"Icon",a:{name:"star",cssCls:"bex_unrated"}}," ",{t:7,e:"Icon",a:{name:"star",cssCls:"bex_unrated"}}," ",{t:7,e:"Icon",a:{name:"star",cssCls:"bex_unrated"}}," ",{t:7,e:"Icon",a:{name:"star",cssCls:"bex_unrated"}}]}," ",{t:7,e:"span",a:{class:"bex_stars -real"},f:[{t:7,e:"Icon",a:{name:"star",cssCls:"color-attention -text"}}," ",{t:7,e:"Icon",a:{name:"star color-attention -text"}}," ",{t:7,e:"Icon",a:{name:"star color-attention -text"}}," ",{t:7,e:"Icon",a:{name:"star color-attention -text"}}," ",{t:7,e:"Icon",a:{name:"star color-attention -text"}}]}]}," ",{t:7,e:"p",a:{class:"bex_ratings text g-margin-top--20"},f:[{t:2,x:{r:["nls","ratingsCountFormatted"],s:'_0("bex.ratings.count",_1)'}}," ",{t:7,e:"span",a:{class:"bex_separator"},f:["|"]}," ",{t:2,x:{r:["nls","usersCountFormatted"],s:'_0("bex.users.count",_1)'}}," ",{t:7,e:"kin-tooltip",f:[{t:7,e:"span",a:{slot:"tooltip-activator"},f:[{t:7,e:"kin-icon",a:{name:"icon-m-action-info",size:"16",class:"bex_tooltip_icon g-margin-left--5"}}]}," ",{t:7,e:"div",a:{slot:"tooltip"},f:[{t:2,x:{r:["nls"],s:'_0("bex.tooltip.caption")'}}]}]}]}]}};const a=function(a,i){return e.extend({template:o,css:".avs .kin_table__row:hover > div {\n  background: transparent;\n}\n.kin_table__row {\n  grid-template-columns: 50% 50%;\n}\n.kin_table__end {\n  padding-right: 15px !important;\n}\n.kin_table__row.-disabled {\n  opacity: 0.5;\n}\n.bex_logo {\n  margin-top: -5px;\n}\n.bex_unrated.icon {\n  opacity: 0.3;\n}\n.bex_stars {\n  font-size: 16px;\n  margin-top: -3px;\n  overflow: hidden;\n  position: absolute;\n  white-space: nowrap;\n}\n.bex_stars.-real {\n  width: 89px;\n}\n.bex_stars .bex_unrated {\n  opacity: 0.3;\n}\n.bex_ratings {\n  display: flex;\n  margin: 1px 0 0 105px;\n}\n.bex_ratings span.bex_separator {\n  display: inline-block;\n  margin: 0 15px;\n}\n.bex_browser_icon {\n  font-size: 40px;\n  margin-right: 15px;\n}\n.bex_tooltip_icon {\n  margin-top: 3px;\n}\n[dir='rtl'] .bex_ratings {\n  margin: 1px 105px 0;\n}\n[dir='rtl'] .bex_browser_icon {\n  margin-right: 0;\n  margin-left: 15px;\n}\n",data:function(){return{isChromeInstalled:!0,aosInBrowsers:[],errorModal:null,DEBUG:s.isEnabled(),usersCountFormatted:Intl.NumberFormat(t.locale).format(a),ratingsCountFormatted:Intl.NumberFormat(t.locale).format(i),showUsersAndRatings:a>0&&i>0,loading:!0}},oninit(){this.installedBrowsers=null,this.AOS_SUPPORTED_BROWSERS=["Chrome","Firefox","Opera","Edge","ChromiumEdge"],this.storeLinks={},this.interval=null,this._setListeners(),this._initData(),this._startPolling()},onteardown(){clearInterval(this.interval)},_setListeners(){this.on("openStoreExtension",this._openStoreExtension.bind(this)),this.on("Modal.close",(()=>this.set({errorModal:null})))},_initData(){Promise.all([n("app.settings.Get","avdef://config/GuiCache/AOSCHStoreLink"),n("app.settings.Get","avdef://config/GuiCache/AOSFFStoreLink"),n("app.settings.Get","avdef://config/GuiCache/AOSOPStoreLink"),n("app.settings.Get","avdef://config/GuiCache/AOSEDStoreLink"),n("app.settings.Get","avdef://config/GuiCache/AOSEDCEFStoreLink"),n("app.utils.GetInstalledBrowsers"),n("app.browserExtensions.GetDetails")]).then((e=>{this.storeLinks={aos:{Chrome:e[0],Firefox:e[1],Opera:e[2],Edge:e[3],ChromiumEdge:e[4]}},this.installedBrowsers=e[5]||{},this._setAosInBrowser(e[6]),this.set({loading:!1})})).catch((e=>{console.error("[BrowserExtensions] {index} initData failed",e),this.set({errorModal:"initData failed, error:"+JSON.stringify(e)})}))},_startPolling(){this.interval=setInterval((()=>{Promise.all([n("app.utils.GetInstalledBrowsers"),n("app.browserExtensions.GetDetails")]).then((e=>{this.installedBrowsers=e[0]||{},this._setAosInBrowser(e[1])})).catch((e=>{console.error("[BrowserExtensions] {index} error during polling",e),clearInterval(this.interval)}))}),5e3)},_setAosInBrowser(e){const t=e&&e.aos&&e.aos.browsers||{},s=this._mapExtensionInBrowsers({browsersExtension:t});this.set({aosInBrowsers:s})},_mapExtensionInBrowsers({browsersExtension:e,extensionName:t="aos",supportedBrowsers:s=this.AOS_SUPPORTED_BROWSERS}){let n=s.reduce(((s,n)=>{if(this.storeLinks[t]&&this.storeLinks[t][n]&&this.installedBrowsers&&this.installedBrowsers[n]){const r=e[n]||{},o=r.isInstalled||!1,a=r.isActive||!1,i=!0,l="ChromiumEdge"===n?"edge-chromium":n.toLowerCase(),d="ChromiumEdge"===n?"Edge":n;s.push({browser:n,iconName:l,displayName:d,isExtensionInstalled:o,isExtensionActive:a,extensionName:t,isBrowserInstalled:i})}return s}),[]);return 0===n.length&&(n=this._mapAllSupportedBrowsers({extensionName:t,supportedBrowsers:s})),this._filterEdges(n),n},_mapAllSupportedBrowsers:({extensionName:e,supportedBrowsers:t})=>t.map((t=>({browser:t,displayName:"ChromiumEdge"===t?"Edge":t,iconName:"ChromiumEdge"===t?"edge-chromium":t.toLowerCase(),isExtensionInstalled:!1,isExtensionActive:!1,extensionName:e,isBrowserInstalled:!1}))),_openStoreExtension(e,t,s){const o=this.storeLinks[s]&&this.storeLinks[s][t]||"";o?(r.event("Extensions","Click","AOS-"+t),n("app.system.OpenUrl",{url:o,browser:t})):(console.error("[BrowserExtensions] {index} store link not present, for browser:",t,"extension:",s),this.set({errorModal:"store link not present, for browser: "+t+" extension: "+s}))},_filterEdges(e){let t=-1,s=-1;e.forEach(((e,n)=>{t="Edge"===e.browser?n:t,s="ChromiumEdge"===e.browser?n:s})),t>-1&&s>-1&&e.splice(t,1)}})}(1e7,24e3);export default a;const i={name:"BrowserExtensions",version:"1.2.151",created:"2021-03-09T09:26:02.908Z"};export{i as metadata};