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/AntiRansomware.js
//{"name":"AntiRansomware","version":"1.2.327","created":"2021-03-10T09:11:34.824Z"}
import e from"./ractive.js";import{serviceRequest as t,eventer as s,napiTracker as o,windowApi as a}from"./napi.js";import{productModel as n,ipmService as i}from"./napiExtensions.js";import{logger as l,svelte3Adapter as r}from"./libs.js";import{modals as c}from"./ractiveComponents.js";import{nls as d}from"./i18n.js";import{svelteComponents as p}from"./Settings.js";var m=".arw_table__header,\n.arw_table__row {\n  grid-template-columns: 5% 25% 65% 5%;\n}\n.arw .arw_folder-tick-icon,\n[slot] .arw_folder-tick-icon {\n  position: absolute;\n  top: 22px;\n  left: 22px;\n}\n";const f=function(s){return e.extend({twoway:!1,template:s,css:m,data:()=>({protectedFolders:[],selectedFolders:[],modalDialog:void 0,lastFolderName:"",removeFolderName:void 0,loading:!0}),computed:{lastFolderNameTrimmed:function(){const e=this.get("lastFolderName");return e.slice(0,30)+(e.length>30?"...":"")}},oninit(){this.deselectAll=function(){this._selectAllFolders(!1)},this._deselectAllBind=this.deselectAll.bind(this),window.addEventListener("kin-deselectAll",this._deselectAllBind),this.observe("protectedFolders",(e=>{const t=e.map((e=>e.path)),s=this.get("selectedFolders").filter((e=>t.includes(e)));this.set("selectedFolders",s),this.fire("selectedFoldersCount",s.length),this.fire("protectedFoldersCount",e.length)})),this.on("addFolder",this.addFolder),this.on("askRemoveFolder",((e,t)=>{this.set({folderToRemove:t.path,lastFolderName:t.folderName,modalDialog:"removeFolder"})})),this.on("askRemoveSelectedFolders",(()=>{const e=this.get("selectedFolders");if(1===e.length){const t=e[0],s=this.get("protectedFolders").find((e=>t===e.path)).folderName;this.set({folderToRemove:t,lastFolderName:s,modalDialog:"removeFolder"})}else this.set("modalDialog","removeSelectedFolders")})),this.on("removeFolders",((e,t)=>{const s=this.get("protectedFolders").filter((e=>!t.includes(e.path)));this.set("protectedFolders",s),this._saveData(),this.closeModal()})),this.on("closeModal",this.closeModal),this.on("Modal.close",this.closeModal),this.on("selectAllFolders",(e=>{this._selectAllFolders(e.node.checked)})),this.on("selectFolder",((e,t)=>{const s=this.get("selectedFolders");e.node.checked?s.includes(t.path)||s.push(t.path):s.splice(s.indexOf(t.path),1),this.set("selectedFolders",s),this.fire("selectedFoldersCount",s.length)})),t("app.antiransomware.GetPaths").then((e=>{e&&"function"==typeof e.push||(e=[]),this.set("protectedFolders",e.map((e=>({path:e,folderName:this._getLastFolderName(e)})))),this.set("loading",!1)})).catch((e=>{console.log("error while reading protected folders. err:"+e)}))},_saveData(){const e=this.get("protectedFolders").map((e=>e.path));t("app.antiransomware.SetPaths",e).catch((e=>{console.log("error while setting protected folders. err:"+e)}))},_getLastFolderName(e){const t=e.split(/[\/|\\]/);let s="";do{s=t.pop()}while(s.length<1&&t.length>0);return s},addFolder(){return t("app.utils.SelectFolder").then((e=>{if(!e)return;const s={path:e.replace(/\"/g,""),folderName:""};s.folderName=this._getLastFolderName(s.path);const o=this.get("protectedFolders").reduce(((e,t)=>t.path===s.path?t:e),null);if(o)return this.set("lastFolderName",o.folderName),void this.set("modalDialog","alreadyProtected");t("app.antiransomware.CheckPath",s.path).then((e=>{if(!e)return void this.set("modalDialog","cannotAdd");const t=this.get("protectedFolders");t.push(s),this.set("protectedFolders",t),this._saveData()})).catch((e=>{console.log("error while checking new path, err:"+e)}))})).catch((e=>{console.log("error while executing app.utils.SelectFolder",e)}))},_selectAllFolders(e){const t=this.get("protectedFolders");if(e){const e=t.map((e=>e.path));this.set("selectedFolders",e),this.fire("selectedFoldersCount",e.length)}else this.set("selectedFolders",[]),this.fire("selectedFoldersCount",0)},closeModal(){this.set("modalDialog",void 0)},onteardown(){window.removeEventListener("kin-deselectAll",this._deselectAllBind),this._deselectAllBind=void 0}})}({v:3,t:[{t:7,e:"kin-table",a:{datalength:[{t:2,r:"protectedFolders.length"}],selecteditems:[{t:2,r:"selectedFolders.length"}],loading:[{t:2,r:"loading"}]},f:[{t:7,e:"div",a:{slot:"table-header",role:"row",class:"arw_table__header"},f:[{t:7,e:"input",v:{click:"selectAllFolders"},a:{type:"checkbox",class:["checkbox ",{t:4,f:["-some-checked"],n:50,x:{r:["protectedFolders.length","selectedFolders.length"],s:"_0!==_1&&_1>0"}}," ",{t:4,f:["-checked"],n:50,x:{r:["protectedFolders.length","selectedFolders.length"],s:"_0===_1&&_1>0"}}],disabled:[{t:2,x:{r:["protectedFolders.length"],s:"_0===0"}}],checked:[{t:2,x:{r:["selectedFolders.length"],s:"_0>0"}}],title:[{t:2,x:{r:["nls"],s:'_0("global.selectAllItems")'}}," - ",{t:2,x:{r:["nls"],s:'_0("antiransomware.protectedFolders.title")'}}]}}," ",{t:7,e:"div"}," ",{t:7,e:"div",a:{role:"columnheader"},f:[{t:3,x:{r:["nls"],s:'_0("antiransomware.protectedFolders.title")'}}]}," ",{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",a:{slot:"table-body"},f:[{t:4,f:[{t:7,e:"div",a:{role:"row",class:"arw_table__row kin_table__row","aria-rowindex":[{t:2,r:"@index"}],"data-test":["table-row-",{t:2,r:"@index"}]},f:[{t:7,e:"input",v:{click:{n:"selectFolder",d:[{t:2,r:"."}]}},a:{type:"checkbox",class:"checkbox",id:["folderName-",{t:2,r:"@index"}],checked:[{t:2,x:{r:["selectedFolders","./path"],s:"_0.includes(_1)"}}],title:[{t:2,x:{r:["nls"],s:'_0("global.selectItem")'}}]}}," ",{t:7,e:"div",a:{class:"kin_table__icon"},f:[{t:7,e:"kin-icon",a:{name:"icon-m-scan-folder",size:"24"}}," ",{t:7,e:"kin-icon",a:{name:"badge-ok",size:"16",class:"arw_folder-tick-icon"}}]}," ",{t:7,e:"div",a:{class:"kin_table__name",dir:"ltr"},f:[{t:7,e:"kin-tooltip",a:{ellipsis:"true","data-test":"kin_table-item-name"},f:[{t:7,e:"label",a:{for:["folderName-",{t:2,r:"@index"}],slot:"tooltip-activator"},f:[{t:2,r:"folderName"}]}," ",{t:7,e:"div",a:{slot:"tooltip"},f:[{t:2,r:"folderName"}]}]}]}," ",{t:7,e:"div",a:{dir:"ltr"},f:[{t:7,e:"kin-tooltip",a:{ellipsis:"true","data-test":"kin_table-item-description"},f:[{t:7,e:"div",a:{slot:"tooltip-activator"},f:[{t:2,r:"path"}]}," ",{t:7,e:"div",a:{slot:"tooltip"},f:[{t:2,r:"path"}]}]}]}," ",{t:7,e:"div",a:{class:"kin_table__actions"},f:[{t:4,f:[{t:7,e:"kin-tooltip",f:[{t:7,e:"div",a:{slot:"tooltip-activator"},f:[{t:7,e:"kin-button",v:{click:{n:"askRemoveFolder",d:[{t:2,r:"."}]}},a:{title:[{t:3,x:{r:["nls"],s:'_0("global.stopProtecting")'}}," - ",{t:2,r:"folderName"}],type:"blank","data-test":"requestDeleteConfirm",size:"small",icononly:0},f:[{t:7,e:"kin-icon",a:{name:"icon-s-controls-close",size:"10"}}]}]}," ",{t:7,e:"div",a:{slot:"tooltip",class:"g-nowrap"},f:[{t:3,x:{r:["nls"],s:'_0("global.stopProtecting")'}}]}]}],n:50,x:{r:["selectedFolders.length"],s:"_0===0"}}]}]}],n:52,r:"protectedFolders"}]}," ",{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("antiransomware.empty.desc.1")'}}]}," ",{t:7,e:"p",f:[{t:3,x:{r:["nls"],s:'_0("antiransomware.empty.desc.2")'}}]}]}]}," ",{t:4,f:[{t:4,f:[{t:7,e:"Modal",a:{cssCls:"nui_modal",autoClose:0,title:[{t:3,x:{r:["nls","lastFolderNameTrimmed"],s:'_0("antiransomware.alreadyProtected.title",_1)'}}]},f:[{t:7,e:"p",a:{class:"p"},f:[{t:3,x:{r:["nls"],s:'_0("antiransomware.alreadyProtected.desc")'}}]}," ",{t:7,e:"div",a:{class:"modal__actions"},f:[{t:7,e:"button",a:{class:"btn"},v:{click:"closeModal"},f:[{t:3,x:{r:["nls"],s:'_0("global.gotIt")'}}]}]}]}],n:50,x:{r:["modalDialog"],s:'_0==="alreadyProtected"'}},{t:4,n:51,f:[{t:4,n:50,x:{r:["modalDialog"],s:'_0==="cannotAdd"'},f:[{t:7,e:"Modal",a:{cssCls:"nui_modal",autoClose:0,title:[{t:3,x:{r:["nls"],s:'_0("antiransomware.cannotAdd.title")'}}]},f:[{t:7,e:"p",a:{class:"p"},f:[{t:3,x:{r:["nls"],s:'_0("antiransomware.cannotAdd.desc")'}}]}," ",{t:7,e:"div",a:{class:"modal__actions"},f:[{t:7,e:"button",a:{class:"btn -secondary"},v:{click:"closeModal"},f:[{t:3,x:{r:["nls"],s:'_0("global.close")'}}]}]}]}]},{t:4,n:50,x:{r:["modalDialog"],s:'(!(_0==="cannotAdd"))&&(_0==="removeFolder")'},f:[" ",{t:7,e:"Modal",a:{cssCls:"nui_modal",autoClose:0,title:[{t:3,x:{r:["nls","lastFolderNameTrimmed"],s:'_0("antiransomware.stopProtectingFolderName.title",_1)'}}]},f:[{t:7,e:"p",a:{class:"p"},f:[{t:3,x:{r:["nls"],s:'_0("antiransomware.stopProtectingFolder.desc")'}}]}," ",{t:7,e:"div",a:{class:"modal__actions"},f:[{t:7,e:"button",a:{class:"btn","data-test":"modal_confirm"},v:{click:{n:"removeFolders",d:[{t:2,x:{r:["folderToRemove"],s:"[_0]"}}]}},f:[{t:3,x:{r:["nls"],s:'_0("global.stopProtecting")'}}]}," ",{t:7,e:"button",a:{class:"btn -secondary"},v:{click:"closeModal"},f:[{t:3,x:{r:["nls"],s:'_0("antiransomware.keepProtected")'}}]}]}]}]},{t:4,n:50,x:{r:["modalDialog"],s:'(!(_0==="cannotAdd"))&&((!(_0==="removeFolder"))&&(_0==="removeSelectedFolders"))'},f:[" ",{t:7,e:"Modal",a:{cssCls:"nui_modal",autoClose:0,title:[{t:3,x:{r:["nls","selectedFolders.length"],s:'_0("antiransomware.stopProtectingFolders.title",_1)'}}]},f:[{t:7,e:"p",a:{class:"p"},f:[{t:3,x:{r:["nls","selectedFolders.length"],s:'_0("antiransomware.stopProtectingFolders.desc",_1)'}}]}," ",{t:7,e:"div",a:{class:"modal__actions"},f:[{t:7,e:"button",a:{class:"btn","data-test":"modal_confirm"},v:{click:{n:"removeFolders",d:[{t:2,r:"selectedFolders"}]}},f:[{t:3,x:{r:["nls"],s:'_0("global.stopProtecting")'}}]}," ",{t:7,e:"button",a:{class:"btn -secondary"},v:{click:"closeModal"},f:[{t:3,x:{r:["nls"],s:'_0("antiransomware.keepProtected")'}}]}]}]}]}],x:{r:["modalDialog"],s:'_0==="alreadyProtected"'}}],n:50,r:"modalDialog"}]}),h=e.extend({template:{v:3,t:[{t:7,e:"Page",a:{heading:[{t:3,x:{r:["nls"],s:'_0("antiransomware")'}}],cssCls:"arw",settingsUrl:"#Settings/AntiRansomware",inactive:[{t:2,x:{r:["ransomwareEnabled"],s:"!_0"}}],inactiveMsg:[{t:3,x:{r:["nls"],s:'_0("antiransomware.inactive.tooltip")'}}],backHash:"#security"},f:[{t:7,e:"div",a:{slot:"breadcrumbs"},f:[{t:7,e:"Crumbs",a:{customBreadcrumbs:["[{title: ",{t:3,x:{r:["nls"],s:'_0("security")'}},", url: '#security', section: true}, {title:'",{t:3,x:{r:["nls"],s:'_0("antiransomware")'}},"'}]"]}}]}," ",{t:7,e:"div",a:{slot:"controls"},f:[{t:7,e:"Switch",a:{attr:"{id:'antiransomware-switch'}",checked:[{t:2,r:"ransomwareEnabled"}],disabled:[{t:2,r:"enabledSwitchDisabled"}],preventToggle:"true",title:[{t:2,x:{r:["nls"],s:'_0("antiransomware")'}}],cssCls:[{t:4,f:["-waiting"],n:50,r:"enabledSwitchDisabled"}," ",{t:4,f:["animated"],n:50,r:"enabledSwitchDisabled"}]},v:{domClick:"toggleRswSwitch"}}]}," ",{t:7,e:"div",a:{slot:"page-content"},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("antiransomware.desc")'}}]}]}," ",{t:7,e:"div",a:{slot:"cta"},f:[{t:7,e:"kin-button",v:{click:"addFolder"},f:[{t:3,x:{r:["nls"],s:'_0("antiransomware.protectNewFolder")'}}]}]}," ",{t:7,e:"div",a:{slot:"view-content"},f:[{t:7,e:"ProtectedFolders"}]}," ",{t:7,e:"div",a:{slot:"view-actions"},f:[{t:7,e:"div",a:{class:"kin_actions__left"},f:[{t:3,x:{r:["nls","selectedFoldersCount"],s:'_0("antiransomware.foldersSelected",_1)'}}]}," ",{t:7,e:"div",f:[{t:7,e:"kin-button",a:{size:"small"},v:{click:"askRemoveSelectedFolders"},f:[{t:3,x:{r:["nls"],s:'_0("global.stopProtecting")'}}]}]}," ",{t:7,e:"div",a:{class:"kin_actions__right"},f:[{t:3,x:{r:["nls"],s:'_0("global.escToDeselect")'}}]}]}]}]}]}]},css:m,components:{ProtectedFolders:f},data:()=>({UPSELL_ANIMATION:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKoAAACqCAMAAAAKqCSwAAAAjVBMVEUAAACkr+eSptyRpNqNoNaOotaModePo9iRquaLn9SMoNWMoNWNodeYq9mPotaMoNWMoNWMoNWKn9SLoNWKn9SMoNWLn9WKntOLoNSMn9aPodaLn9SMn9SMoNaLn9SLn9SLn9SKn9SLn9WLn9SLn9SLn9SLn9SLn9SKn9SLn9SLn9SKntSLn9WLn9SKntRmBe3SAAAALnRSTlMABhAUNyktGQqBcE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baCcJA7SNnuoHCQAWjzqttgcBt0boI31Zug0gZQA/M949RmkrrjYGuR4DT24xZQncSwlxK+ig+fxIOFrGAr/XmKV7I4z7gvs/MGaKVTJCLGuDMCERtDJEelMoG5TGEmBXyRBj7L27gCxo1wkOO4L8b1UYgPqwzccSHmgxIgy4DktFEnCvJBVuuC3YagYwPq2IEgjsCJAzDjGoxYQ9ja4LbfBc/VH4LVELSHoI5NCIZq9K6qwRiC4Sbhgwj7mp8TGzwX4dqDYldBvMsg35WgD0uIpeWj0FuDD0AB23UJb+sGinUPk/UC3ISPoPQAnf4FZ1WqbgMQ/w3PBr7DSNY+y8cFPyMoQq4sxIcvaYtapwnhvqtw5l1A3c1NrG7vkqQzdToGnFI+gy9b8KSHlaygFw+24zlf5bk0SxPcoWTOu3ooOVTdPiRJ14r2XekIzVg6vC8txlKM6sTiisoNmDYOFI0B/jJE+UuFu/QV4bIAsynBaaYQNDFoL4PKS8DyLEg8GyaNhrgJzqWyMaG4lNQvS80E7LGUD6UKMk9DO5YisF63Wi9e/CG+AUVRmCG/LVFGAAAAAElFTkSuQmCC",ransomwareEnabled:n.isEnabled("ais_shl_rsw"),product:n.getProduct(),loading:!0,selectedFoldersCount:0}),oninit(){this.log=l.createLogger("antiransomware"),this.listeners=[],this.listeners.push(s.on("product.change.feature.ais_shl_rsw",(e=>{this.updateFeature(e)}))),this.updateFeature(),this.on("toggleRswSwitch",((e,t)=>{t?c.stopOptions().then((e=>this._toggleStatus(e.time))).catch((()=>{this.log.info("no stop option selected.. doing nothing")})):n.isPassiveMode()?c.passiveMode().then((()=>this._toggleStatus())):this._toggleStatus()})),this.on("Upsell.init",(()=>{o.event("Upsell","View")})),this.on("Upsell.buy",(()=>{i.openWindow(343)})),this.on("addFolder",(()=>{this.findComponent("ProtectedFolders").addFolder()})),this.on("askRemoveSelectedFolders",(()=>{this.findComponent("ProtectedFolders").fire("askRemoveSelectedFolders")})),this.on("ProtectedFolders.selectedFoldersCount",(e=>{this.set("selectedFoldersCount",e)}))},_toggleStatus:e=>n.toggleFeature("ais_shl_rsw",e).catch((e=>{console.error("Toggling ais_shl_rsw failed",e)})),updateFeature(e){if(this.set("enabledSwitchDisabled",!1),e)this.set({ransomwareEnabled:e.enabled,loading:!1});else{const e=n.getFeature("ais_shl_rsw");this.set({ransomwareEnabled:e.enabled,loading:!1})}},onteardown(){this.listeners.forEach((e=>e()))}}),u=l.createLogger("antiransomware.detectionDialog"),g=/[\/|\\]/g,w="block",x="allow",_="ignore";const b={error:{name:"icon-m-tools-ransomware"},ok:{name:"icon-s-status-check"}};function v(){}function F(e){return e()}function y(){return Object.create(null)}function k(e){e.forEach(F)}function A(e){return"function"==typeof e}function S(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function T(e,t){e.appendChild(t)}function N(e,t,s){e.insertBefore(t,s||null)}function C(e){e.parentNode.removeChild(e)}function E(e){return document.createElement(e)}function D(){return e=" ",document.createTextNode(e);var e}function M(e,t,s){null==s?e.removeAttribute(t):e.getAttribute(t)!==s&&e.setAttribute(t,s)}let P;function L(e){P=e}const $=[],j=[],R=[],U=[],B=Promise.resolve();let W=!1;function q(e){R.push(e)}let G=!1;const I=new Set;function O(){if(!G){G=!0;do{for(let e=0;e<$.length;e+=1){const t=$[e];L(t),Y(t.$$)}for(L(null),$.length=0;j.length;)j.pop()();for(let e=0;e<R.length;e+=1){const t=R[e];I.has(t)||(I.add(t),t())}R.length=0}while($.length);for(;U.length;)U.pop()();W=!1,G=!1,I.clear()}}function Y(e){if(null!==e.fragment){e.update(),k(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(q)}}const J=new Set;function V(e,t){e&&e.i&&(J.delete(e),e.i(t))}function K(e,t,s,o){if(e&&e.o){if(J.has(e))return;J.add(e),undefined.c.push((()=>{J.delete(e),o&&(s&&e.d(1),o())})),e.o(t)}}function Q(e){e&&e.c()}function z(e,t,s){const{fragment:o,on_mount:a,on_destroy:n,after_update:i}=e.$$;o&&o.m(t,s),q((()=>{const t=a.map(F).filter(A);n?n.push(...t):k(t),e.$$.on_mount=[]})),i.forEach(q)}function Z(e,t){const s=e.$$;null!==s.fragment&&(k(s.on_destroy),s.fragment&&s.fragment.d(t),s.on_destroy=s.fragment=null,s.ctx=[])}function H(e,t){-1===e.$$.dirty[0]&&($.push(e),W||(W=!0,B.then(O)),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function X(e,t,s,o,a,n,i=[-1]){const l=P;L(e);const r=t.props||{},c=e.$$={fragment:null,ctx:null,props:n,update:v,not_equal:a,bound:y(),on_mount:[],on_destroy:[],before_update:[],after_update:[],context:new Map(l?l.$$.context:[]),callbacks:y(),dirty:i,skip_bound:!1};let d=!1;if(c.ctx=s?s(e,r,((t,s,...o)=>{const n=o.length?o[0]:s;return c.ctx&&a(c.ctx[t],c.ctx[t]=n)&&(!c.skip_bound&&c.bound[t]&&c.bound[t](n),d&&H(e,t)),s})):[],c.update(),d=!0,k(c.before_update),c.fragment=!!o&&o(c.ctx),t.target){if(t.hydrate){const e=function(e){return Array.from(e.childNodes)}(t.target);c.fragment&&c.fragment.l(e),e.forEach(C)}else c.fragment&&c.fragment.c();t.intro&&V(e.$$.fragment),z(e,t.target,t.anchor),O()}L(l)}class ee{$destroy(){Z(this,1),this.$destroy=v}$on(e,t){const s=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return s.push(t),()=>{const e=s.indexOf(t);-1!==e&&s.splice(e,1)}}$set(e){var t;this.$$set&&(t=e,0!==Object.keys(t).length)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const te={title:"antiransomware",desc:"antiransomware.settings.desc",modeLabel:"antiransomware.settings.mode.label",smartMode:"antiransomware.settings.mode.smart.label",smartModeDesc:"antiransomware.settings.mode.smart.desc",strictMode:"antiransomware.settings.mode.strict.label",strictModeDesc:"antiransomware.settings.mode.strict.desc",trustedAppsTitle:"antiransomware.trustedApps.title",trustedAppsDesc:"antiransomware.trustedApps.desc",protectedFileTypesTitle:"antiransomware.settings.protectedFileTypes.title",fileTypesTitle:"antiransomware.settings.fileTypes",fileTypes:{music:"antiransomware.fileTypes.music",archive:"antiransomware.fileTypes.archive",database:"antiransomware.fileTypes.database",disc:"antiransomware.fileTypes.disc",document:"antiransomware.fileTypes.document",photo:"antiransomware.fileTypes.photo",video:"antiransomware.fileTypes.video"},customExtensions:"antiransomware.settings.customExtensions",customExtensionsPlaceholder:"antiransomware.settings.customExtensions.placeholder",customExtensionsDuplicates:"antiransomware.settings.customExtensions.duplicates",viewAllowedAndBlockedApps:"settings.viewAllowedAndBlockedApps"};function se(e){let t,s,o,a,n,i,l,r;return{c(){t=E("span"),s=E("kin-tooltip"),o=E("span"),o.innerHTML='<kin-icon name="icon-m-action-info" size="16"></kin-icon>',a=D(),n=E("span"),i=E("h4"),i.textContent=`${d(te.trustedAppsTitle)}`,l=D(),r=E("span"),r.textContent=`${d(te.trustedAppsDesc)}`,M(o,"slot","tooltip-activator"),M(i,"class","h4 -margins"),M(r,"class","p -secondary -small"),M(n,"slot","tooltip"),M(t,"class","settings__info")},m(e,c){N(e,t,c),T(t,s),T(s,o),T(s,a),T(s,n),T(n,i),T(n,l),T(n,r)},p:v,i:v,o:v,d(e){e&&C(t)}}}var oe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ae=/^\s+|\s+$/g,ne=/^[-+]0x[0-9a-f]+$/i,ie=/^0b[01]+$/i,le=/^0o[0-7]+$/i,re=parseInt,ce="object"==typeof oe&&oe&&oe.Object===Object&&oe,de="object"==typeof self&&self&&self.Object===Object&&self,pe=ce||de||Function("return this")(),me=Object.prototype.toString,fe=Math.max,he=Math.min,ue=function(){return pe.Date.now()};function ge(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function we(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==me.call(e)}(e))return NaN;if(ge(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ge(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(ae,"");var s=ie.test(e);return s||le.test(e)?re(e.slice(2),s?2:8):ne.test(e)?NaN:+e}var xe=function(e,t,s){var o,a,n,i,l,r,c=0,d=!1,p=!1,m=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function f(t){var s=o,n=a;return o=a=void 0,c=t,i=e.apply(n,s)}function h(e){return c=e,l=setTimeout(g,t),d?f(e):i}function u(e){var s=e-r;return void 0===r||s>=t||s<0||p&&e-c>=n}function g(){var e=ue();if(u(e))return w(e);l=setTimeout(g,function(e){var s=t-(e-r);return p?he(s,n-(e-c)):s}(e))}function w(e){return l=void 0,m&&o?f(e):(o=a=void 0,i)}function x(){var e=ue(),s=u(e);if(o=arguments,a=this,r=e,s){if(void 0===l)return h(r);if(p)return l=setTimeout(g,t),f(r)}return void 0===l&&(l=setTimeout(g,t)),i}return t=we(t)||0,ge(s)&&(d=!!s.leading,n=(p="maxWait"in s)?fe(we(s.maxWait)||0,t):n,m="trailing"in s?!!s.trailing:m),x.cancel=function(){void 0!==l&&clearTimeout(l),c=0,o=r=a=l=void 0},x.flush=function(){return void 0===l?i:w(ue())},x};const _e={music:{ext:["m3u","m4a","mp3","wma","ogg","wav"]},archive:{ext:["7z","rar","zip"]},database:{ext:["sqlite","sqlite3"]},disc:{ext:["iso","img","nrg","tc"]},document:{ext:["doc","docx","odt","rtf","wpd","wps","csv","key","pdf","pps","ppt","pptm","pptx","ps","psd","vcf","xlr","xls","xlsx","xlsm","xlsx","ods","odp","indd","dwg","dxf","kml","kmz","gpx","txt","cad","dwg","wmf"]},photo:{ext:["3fr","ari","arw","bay","bmp","cr2","crw","cxi","dcr","dng","eip","erf","fff","gif","iiq","j6i","k25","kdc","mef","mfw","mos","mrw","nef","nrw","orf","pef","png","raf","raw","rw2","rwl","rwz","sr2","srf","srw","x3f","jpg","jpeg","tga","tiff","tif","ai"]},video:{ext:["3g2","3gp","asf","avi","flv","m4v","mkv","mov","mp4","mpg","rm","swf","vob","wmv"]}},be=/[,|.|;| ]+/;let ve=[];const Fe=e.extend({template:{v:3,t:[{t:4,f:[{t:4,f:[{t:7,e:"p",a:{class:"p -small -secondary -margins g-margin-top--15"},f:[{t:3,x:{r:["nls","STRINGS.protectedFileTypesTitle"],s:"_0(_1)"}}]}],n:50,x:{r:["hideLabel"],s:"!_0"}}," ",{t:7,e:"table",a:{class:"table -compact g-margin-top--15"},f:[{t:7,e:"colgroup",f:[{t:7,e:"col",a:{width:"5%"}}," ",{t:7,e:"col",a:{width:"95%"}}]}," ",{t:7,e:"tr",f:[{t:7,e:"th",a:{colspan:"2"},f:[{t:3,x:{r:["nls","STRINGS.fileTypesTitle"],s:"_0(_1)"}}]}]}," ",{t:4,f:[{t:7,e:"tr",a:{class:"-hoverable"},f:[{t:7,e:"td",f:[{t:7,e:"input",a:{type:"checkbox",class:"checkbox",checked:[{t:2,r:"selected"}],id:["arw_",{t:2,r:"extName"}],"data-test":["arw_",{t:2,r:"extName"}]},v:{change:{n:"categoryCheckboxChanged",d:[{t:2,r:"extName"}]}}}]}," ",{t:7,e:"td",f:[{t:7,e:"label",a:{class:"checkbox__label -clickable",for:["arw_",{t:2,r:"extName"}],"data-test":["arw_",{t:2,r:"extName"},"-label"]},f:[{t:7,e:"kin-icon",a:{name:["icon-m-file-",{t:2,r:"extName"}],size:"20",class:"g-margin-right--10"}}," ",{t:3,x:{r:["nls","extName","STRINGS.fileTypes"],s:"_0(_2[_1])"}}," ",{t:7,e:"Tooltip",f:[{t:2,r:"strExtList"}]}]}]}]}],n:52,i:"extName",r:"allFileTypes"}]}," ",{t:7,e:"p",a:{class:"arw_custom-extensions p -small -secondary -margins g-margin-top--20"},f:[{t:3,x:{r:["nls","STRINGS.customExtensions"],s:"_0(_1)"}}]}," ",{t:7,e:"input",a:{id:"custom-extensions",class:"input -full -field",type:"text",placeholder:[{t:3,x:{r:["nls","STRINGS.customExtensionsPlaceholder"],s:"_0(_1)"}}],value:[{t:2,r:"customExtensions"}],spellcheck:"false"},v:{keypress:"customKeyPress",input:"checkExtensionsDuplicity",paste:"pasteCustomExtensions"}}," ",{t:7,e:"p",a:{class:"p -small color-ok -text g-margin-top--15"},m:[{t:4,f:['style="visibility: hidden"'],n:50,x:{r:["duplicateExtensions"],s:"!_0"}}],f:[{t:3,x:{r:["nls","STRINGS.customExtensionsDuplicates"],s:"_0(_1)"}}]}],n:50,x:{r:["loading"],s:"!_0"}}]},data:()=>({allFileTypes:_e,customExtensions:"",duplicateExtensions:!1,loading:!0,STRINGS:te,hideLabel:!1}),oninit(){this.on("categoryCheckboxChanged",(e=>{if(!e.context.selected){const t=e.context.strExtList.split(be),s=Array.from(new Set(this.get("customExtensions").split(be))),o=t.filter((e=>s.includes(e))),a=s.filter((e=>!o.includes(e)));this.set("customExtensions",a.join(", ")),this._checkExtensionsDuplicity()}})),this.on("customKeyPress",(e=>{const t=String.fromCharCode(e.original.charCode||e.original.which);if(new RegExp(/[\\|\/|:|\*|\?|"|<|>|\|]/).test(t))return e.original.preventDefault(),!1;this._checkExtensionsDuplicity()})),this.on("pasteCustomExtensions",(()=>!this._checkExtensionsDuplicity())),this.on("checkExtensionsDuplicity",(()=>{this._checkExtensionsDuplicity()})),t("app.antiransomware.GetExtensions").then((e=>{Array.isArray(e)||(e=[]),e=e.filter((e=>!e.includes("rswcat_")&&"_noExtensions"!==e));let s=this.get("allFileTypes");t("app.antiransomware.GetDefaultExtensions").then((t=>{if(t.length>0&&t[0].includes("rswcat_")){s={};let e="";t.forEach((t=>{t.includes("rswcat_")?e=t.replace("rswcat_",""):(void 0===s[e]&&(s[e]={ext:[]}),s[e].ext.push(t))})),void 0!==s.rswcat_custom&&delete s.rswcat_custom}this._selectFileCategories(s,e)})).catch((()=>{console.log("Get default extensions failed, used hardcoded one"),this._selectFileCategories(s,e)}))})),this.observe("allFileTypes",xe(this._saveData,1e3).bind(this),{init:!1})},onteardown(){this._saveData()},_selectFileCategories(e,t){for(const o in e){e[o].selected=!1,e[o].strExtList=e[o].ext.join(", ");let s=t.length;for(;s--;)if(-1!==e[o].ext.indexOf(t[s])){e[o].selected=!0;break}}this.set("allFileTypes",e),ve=function(){let t=[];for(const s in e)t=t.concat(e[s].ext);return t}();const s=t.filter((e=>!ve.includes(e)));this.set("customExtensions",s.join(", ")),this.set("duplicateExtensions",!1),this.set("loading",!1)},_checkExtensionsDuplicity:xe((function(){const e=this.get("customExtensions").split(be).filter((e=>ve.includes(e)));if(this.set("duplicateExtensions",e.length>0),e.length<1)return!1;const t=this.get("allFileTypes");let s=!1;for(const o in t){if(!0===t[o].selected)continue;let a=e.length;for(;a--;)if(-1!==t[o].ext.indexOf(e[a])){t[o].selected=!0,s=!0;break}}return s&&this.set("allFileTypes",t),!1}),300),_saveData:function(){let e=[];const s=this.get("allFileTypes");for(const t in s)s[t].selected&&e.push.apply(e,s[t].ext);if(this.get("customExtensions").length){const t=this.get("customExtensions").split(be);e=e.concat(t.filter((e=>!ve.includes(e))))}e.length||e.push("_noExtensions"),t("app.antiransomware.SetExtensions",e).catch((e=>{console.log("Unable to set extensions",e)}))}});function ye(e){let t,s,o,a;return{c(){t=E("div")},m(n,i){var l;N(n,t,i),o||(l=s=e[0].call(null,t),a=l&&A(l.destroy)?l.destroy:v,o=!0)},p:v,i:v,o:v,d(e){e&&C(t),o=!1,a()}}}function ke(e,t,s){let{hideLabel:o=null}=t;return e.$$set=e=>{"hideLabel"in e&&s(1,o=e.hideLabel)},[function(e,t){const s=r(Fe,{target:e,data:{hideLabel:o}});return{destroy:()=>s.$destroy()}},o]}class Ae extends ee{constructor(e){super(),X(this,e,ke,ye,S,{hideLabel:1})}}function Se(e){let t,s,o,a,n,i,l,r;return t=new e[1]({props:{property:Ne.mode}}),o=new e[2]({}),i=new Ae({}),{c(){Q(t.$$.fragment),s=D(),Q(o.$$.fragment),a=D(),n=E("div"),Q(i.$$.fragment),M(n,"id",l=Ne.protectedFileTypes.id+"__container")},m(e,l){z(t,e,l),N(e,s,l),z(o,e,l),N(e,a,l),N(e,n,l),z(i,n,null),r=!0},p:v,i(e){r||(V(t.$$.fragment,e),V(o.$$.fragment,e),V(i.$$.fragment,e),r=!0)},o(e){K(t.$$.fragment,e),K(o.$$.fragment,e),K(i.$$.fragment,e),r=!1},d(e){Z(t,e),e&&C(s),Z(o,e),e&&C(a),e&&C(n),Z(i)}}}function Te(e){let t,s;return t=new e[0]({props:{component:"ais_shl_rsw",ipmBuyElm:{IPM_BUY_ELM:343},title:d(te.title),desc:d(te.desc),stopOptions:e[3],$$slots:{default:[Se]},$$scope:{ctx:e}}}),{c(){Q(t.$$.fragment)},m(e,o){z(t,e,o),s=!0},p(e,[s]){const o={};16&s&&(o.$$scope={dirty:s,ctx:e}),t.$set(o)},i(e){s||(V(t.$$.fragment,e),s=!0)},o(e){K(t.$$.fragment,e),s=!1},d(e){Z(t,e)}}}const Ne={mode:{id:"antiransomware_settings_mode",label:d(te.modeLabel),options:[{label:d(te.smartMode),desc:d(te.smartModeDesc),descCompo:class extends ee{constructor(e){super(),X(this,e,null,se,S,{})}},value:1},{label:d(te.strictMode),desc:d(te.strictModeDesc),value:2}],load:()=>t("app.antiransomware.GetProtectionMode").then((e=>({locked:!1,value:e}))),change:e=>t("app.antiransomware.SetProtectionMode",e),search:{title:te.modeLabel,others:[te.smartMode,te.smartModeDesc,te.strictMode,te.strictModeDesc]}},protectedFileTypes:{id:"antiransomware_settings_protectedFileTypes",search:{title:te.protectedFileTypesTitle,others:[te.fileTypes.music,te.fileTypes.archive,te.fileTypes.database,te.fileTypes.disc,te.fileTypes.document,te.fileTypes.photo,te.fileTypes.video,te.customExtensions]}},allowedAndBlockedApps:{search:te.viewAllowedAndBlockedApps}},Ce={title:te.title,desc:te.desc,items:Ne};function Ee(e){const{Container:t,Radio:s,WhiteAndBlackList:o}=p;return[t,s,o,{}]}class De extends ee{constructor(e){super(),X(this,e,Ee,Te,S,{})}}const Me=function(s){return e.components.DetectionDialog.extend({windowClose:a.close,asyncLoad:!0,gaTrack:o,oninit:function(){this._super(),u.info("oninit"),this._data={},this.on("ignore",(()=>{this.storeUserChoice(_)})),this.loadData().then((()=>{this.set("config",this.getConfig()),window.setTimeout(this.ready.bind(this),0)}))},getConfig(){u.info("getConfig");const e={color:"red",icon:{name:s.error.name},title:d("antiransomware.weJustProtect.title"),text:d("antiransomware.weJustProtect.desc",this._data.actorName,this._data.fileName,this._data.protectedFolderName),actionText:d("antiransomware.whatToDo"),actions:[],details:this.getDetails(),status:{text:"-"}};return e.actions.push({label:d("antiransomware.blockDetectedApp"),labelTest:"dd_primary_btn_block",action:this.doUserAction.bind(this,w),status:{text:d("antiransomware.blocking")},shortcut:{code:"KeyB",ctrlKey:!0},minDuration:500}),e.actions.push({label:d("antiransomware.allowDetectedApp"),labelTest:"dd_secondary_btn_allow",action:this.doUserAction.bind(this,x),status:{text:d("antiransomware.allowing")},shortcut:{code:"KeyA",ctrlKey:!0},minDuration:500}),e},doUserAction(e){return u.info("doUserAction: action = "+e),this.storeUserChoice(e),t("app.antiransomware.GetExcludedFiles").then((s=>{const o=this._data.actorPath+"<block="+(e===x?"0":"1")+">";return s&&"function"==typeof s.push||(s=[]),s.push(o),t("app.antiransomware.SetExcludedFiles",s).then((()=>(a.broadcastEvent("settings.blockedAndAllowedApps.changed"),this.updateData().then((()=>e===x?this.getAllowedConfig():this.getBlockedConfig()))))).catch((e=>{u.error("setting excluded files failed",e)}))})).catch((e=>{u.error("getting excluded files failed",e)}))},getBlockedConfig(){return u.info("getting the blocked config"),{color:"green",icon:{name:s.ok.name},title:d("antiransomware.appBlocked.title"),text:d("antiransomware.appBlocked.desc",this._data.actorName,this._data.protectedFolderName),actionText:d("antiransomware.weAlwaysBlock"),actions:[{label:d("global.gotIt"),labelTest:"dd_primary_btn_got-it"}],details:this.getDetails(),status:{text:d("antiransomware.blocked"),actionText:null,actionTextGA:null,action:null}}},getAllowedConfig(){return u.info("getting the allowed config"),{color:"green",icon:{name:s.ok.name},title:d("antiransomware.appAllowed.title"),text:d("antiransomware.appAllowed.desc",this._data.actorName,this._data.protectedFolderName),actionText:d("antiransomware.weAlwaysAllow"),actions:[{label:d("global.gotIt"),labelTest:"dd_primary_btn_got-it"}],details:this.getDetails(),status:{text:d("antiransomware.allowed"),actionText:null,actionTextGA:null,action:null}}},loadData(){return u.info("loading data"),t("ransomwareDetection.GetStatus").then((e=>(u.info("data loaded"),this._data={filePath:e.file,fileName:e.file.split(g).pop(),actorPath:e.actor,actorName:e.actor.split(g).pop(),actedViaPath:e.actedVia},this.updateData()))).catch((e=>{u.error("getting status failed",e)}))},updateData(){return u.info("updating data"),this.getProtectedFolder().then((e=>{this._data.protectedFolderPath=e,this._data.protectedFolderName=this.getLastFolderName(e),u.info("data updated")}))},getDetails(){return u.info("getting details"),[{title:d("global.appName"),value:this._data.actorPath,testValue:"threatName"},{title:d("antiransomware.actedVia"),value:this._data.actedViaPath},{title:d("global.protectedFolder"),value:this._data.protectedFolderPath},{title:d("global.filePath"),value:this._data.filePath,testValue:"file"},{title:d("global.detectedBy"),value:d("antiransomware"),testValue:"detectedBy_RansomwareShield"}]},getProtectedFolder(){return u.info("getting the protected folder"),t("app.antiransomware.GetPaths").then((e=>{u.info("..paths received");const t=this._data.filePath.toLowerCase();let s="";if(e.forEach((e=>{-1!==t.indexOf(e.toLowerCase())&&e.length>s.length&&(s=e)})),u.info("protectedFolder = "+s),s)return s})).catch((e=>{u.error("getting paths failed",e)}))},getLastFolderName(e){const t=e&&e.split(g);let s="";if(t)for(;s.length<1&&t.length>0;)s=t.pop();return s},storeUserChoice(e){t("ransomwareDetection.UserChoice",e).catch((e=>{u.error("failed to store user choice",e)}))}})}(b);export default h;export{Me as detection,De as settings,Ce as settingsSearchStrings};const Pe={name:"AntiRansomware",version:"1.2.327",created:"2021-03-10T09:11:34.824Z"};export{Pe as metadata};