//{"name":"core","version":"1.3.1604","created":"2025-05-28T06:30:53.270Z"}
import*as e from"./svelteInternal.js";import{onMount as t,onDestroy as n,mount as i}from"./svelteInternal.js";import{serviceRequest as s,moduleManager as a,windowApi as r,napiTracker as o,debugMode as l,eventer as c}from"./napi.js";import{productModel as d,napiUtils as p,tierService as u,passwordService as g,abTests as m,ipmService as f,settingsService as v,setupService as h}from"./napiExtensions.js";import b,{nls as w}from"./i18n.js";import{fileLogging as _,nitroObjectSetup as y,tabNavigation as S,selectAll as C}from"./plugins.js";import{stringUtils as x,debounce as k,deepExtend as A}from"./libs.js";import E from"./napiAdapter.js";import{modals as R,Titlebar as T,OfflinePage as L}from"./svelteComponents.js";function I(){return s("app.utils.getModulesList").then((e=>{const t=[],n=/^locale-/;return Object.keys(e).forEach((e=>{n.test(e)&&t.push(e.replace(n,""))})),t}))}function P(){const e=document.head.querySelector("title");e&&(e.textContent=(d.getBrand()||"Avast").toUpperCase())}!function(e,t){void 0===t&&(t={});var n=t.insertAt;if("undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===n&&i.firstChild?i.insertBefore(s,i.firstChild):i.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}("\n\t.pre.svelte-1ufimrt {\n\t\tfont-family: var(--font);\n\t\tfont-size: var(--font-size);\n\t\tposition: absolute;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\ttop: 0;\n\t\tright: 0;\n\t\tbottom: 0;\n\t\tleft: 0;\n\t\tbackground: var(--app-bg);\n\t\tbackground-attachment: fixed;\n\t\ttext-align: center;\n\t\tdisplay: flex;\n\t\tflex-flow: column;\n\t\talign-items: center;\n\t\tjustify-content: center;\n\t\tborder-radius: var(--app-radius);\n\t}\n\n\t.pre_center.svelte-1ufimrt {\n\t\tmin-height: 22rem;\n\t}\n");const D={moduleMap:{},plugins:{},brand:null,whiteLabelingPossible:!1,protectedAreaDefs:{}};var M=e.template('<p class="g-font--bold">Restarting application ...</p>'),U=e.template('<p class="g-font--bold">Restarting application failed.</p> <p>Try <button class="a">restarting your computer</button>.</p>',1),j=e.template('<div class="pre svelte-1ufimrt"><div class="pre_center svelte-1ufimrt"><h1 class="h1">We encountered an error</h1> <p class="g-margin-bottom--2x">Please restart your application to try again.</p> <div><button class="a">Restart application</button></div> <!> <div class="g-margin-top--2x"><kin-button>Close</kin-button></div></div></div>',2),N=e.template('<h1 class="h1">Sorry, our screen didn\'t load</h1> <p>But don’t worry, we’re still protecting you.</p> <p>A quick refresh should fix the problem.</p> <br><br> <kin-button>Refresh this screen</kin-button>',3),F=e.template("<p><strong>Repairing...</strong></p>"),q=e.template("<p><strong>Repair failed</strong></p>"),z=e.template('<h1 class="h1">Hmm... Let\'s try a restart instead</h1> <p>Sorry, that refresh didn\'t work, but you\'re still protected.</p> <p>Try restarting your computer, or <button class="a">repair your installation</button>.</p> <!> <br><br> <kin-button>Exit</kin-button>',3),B=e.template('<div class="pre svelte-1ufimrt"><div class="pre_center svelte-1ufimrt"><!></div></div>'),W=e.template("<kin-loading></kin-loading>",2),$=e.template('<div id="app"><!></div>');function V(w,A){e.push(A,!1),window.NAPI=E;const T=Promise.all([a.init({moduleMap:D.moduleMap}),d.init()]),L=r.getUrlParams(),V=L.view,H=V&&"default"!==V?" ["+V+"]":"",O="",G="repairing",Z="error",J="",K="restarting",Q="error",X=[],Y=window.app.info?.engine?.version,ee=p.compareVersions(Y||"",">=","1.3.0")&&Boolean(window.app.info?.windowEffects?.roundedCorners);document.querySelector("head title").textContent+=H;let te=e.mutable_source(!0),ne=e.mutable_source(!1),ie=e.mutable_source(!1),se=e.mutable_source(!1),ae=e.mutable_source(),re=e.mutable_source(!0),oe=e.mutable_source(O),le=e.mutable_source(J);function ce(){return m.getTests().then((e=>Object.values(e).reduce(((e,t)=>t?(e.length>0&&!e.endsWith(";")&&(e+=";"),e+=t):e),"")))}function de(){return f.getParams(["p_lid"]).then((e=>e.p_lid)).catch((()=>null))}function pe(){e.set(oe,G),h.repair().catch((t=>{console.error("Repair Setup failed:",t),e.set(oe,Z)}))}function ue(){e.set(le,K),function(){const t=e.get(se)?Promise.resolve():s("av.service.StartService",{name:"antivirus",restart:!1});return Promise.all([s("av.service.StartService",{name:"tools",restart:!1}),t]).then((()=>new Promise(((t,n)=>{let i=0;const s=setInterval((()=>{d.update().then((()=>{e.set(ie,d.serviceUnavailable()),e.set(se,d.toolServiceUnavailable()),e.get(ie)||e.get(se)?(i+=1e3,i>=15e3&&(clearInterval(s),n("Service didn't start in timeout"))):(clearInterval(s),t())}))}),1e3)}))))}().then((()=>{r.reload()})).catch((t=>{console.error("Restarting service failed:",t),e.set(le,Q)}))}function ge(){R.restart()}t((async function(){try{await T,await u.init(),d.getProduct()&&document.body.classList.add(d.getProduct()),d.getStatus()&&document.body.classList.add("status-"+d.getStatus()),d.getProductInfo().isBeta&&document.body.classList.add("-is-beta"),function(){const e=document.querySelector("#mainCss");a.exists("mainSprite")&&e.insertAdjacentHTML("beforebegin",'<link id="mainSprite" rel="stylesheet" href="./mainSprite.css" type="text/css" />')}(),P(),await Promise.all([_(),y(),S(),C(),...Object.values(D.plugins).map((e=>e()))]),await async function(){const[e,t,n,i]=await Promise.all([I(),ce(),de(),!!D.whiteLabelingPossible&&d.isCobranded().then((e=>2===e))]);return b.init({lng:d.getUserConfig().language,lngList:e,rawAbTests:t,regionalLng:n,cobranded:i})}(),await g.init(D.protectedAreaDefs),await function(){const t=x.decapitalize(L.module)||"mainLayout",n=D.moduleMap[t];if("mainLayout"!==t){const e="string"==typeof n?n:t;o.view(e+"_"+V)}return a.importModule(t,V).then((t=>{const n=["ui.opm.slider.open","ui.opm.modal.open"];if(i(t,{target:e.get(ae)}).handlesWindowInit||n.includes(L.eventName)){const e=n.includes(L.eventName)?6e4:7e3;setTimeout((()=>{r.isInitialized()||(console.debug("[Core] WindowApi not initialized, closing window after:",e,"ms"),r.close())}),e)}else r.init({wait:!0});e.set(te,!1)}))}(),function(){if(L.eventName){let e;try{e=JSON.parse(L.eventArgs)}catch{e=L.eventArgs}setTimeout((()=>{c.emitEvent(L.eventName,e),window.history.replaceState(null,"",window.location.href.replace(/eventName=[0-9a-zA-Z.]*&?/,"&"))}),0)}}(),function(){const e=()=>{localStorage.removeItem("dwmLang")},t=()=>{let e=d.getUserConfig().language;if(e===localStorage.getItem("dwmLang"))return;localStorage.setItem("dwmLang",e);const t=e.split("-");t.length>1&&(e=t[0]+"-"+t[1].toUpperCase()),s("app.dwm.DoRequest",{endpoint:"/v1/command/update-settings",payload:{language:e}}).catch((e=>{console.error("DWM - failed to set language",e)}))};v.getValue("avdef://config/GuiCache/EnableDarkWeb").then((n=>{"1"===n&&(t(),c.on("app.lif.account.logged_in",(()=>{e(),t()})),c.on("app.lif.account.logged_out",(()=>{e(),v.set("avcfg://settings/common/DWMEmailsEntered",0)})),c.on("app.lic.account_logged_in",(()=>{e(),t()})),c.on("app.lic.account_logged_out",(()=>{e(),v.set("avcfg://settings/common/DWMEmailsEntered",0)})))})).catch((e=>{}))}(),function(){const e=k((e=>{e?.new_license&&e?.old_license&&Object.entries(e.new_license).every((([t,n])=>n===e.old_license[t]))||r.reload()}),1e3);X.push(c.on("public.lic.license_changed",e)),X.push(c.on("public.lic.account_changed",e))}(),localStorage.removeItem("loadErrorTryAgain")}catch(t){console.error("Initializing core failed",t),d.update(!1).catch((()=>{})).then((()=>{e.set(ie,d.serviceUnavailable()),e.set(se,d.toolServiceUnavailable())})),e.set(ne,!0),localStorage.getItem("loadErrorTryAgain")&&e.set(re,!1),localStorage.setItem("loadErrorTryAgain","1"),o.view(`UILoadFailed.avStatus:${d.getStatus()}.firstTime${e.get(re)}`),"toaster"===L.windowType?!l.isEnabled()&&r.close():r.init()}})),n((()=>{for(;X.length;)X.pop()()})),console.log("app.info",window.app.info),ee&&document.body.classList.add("-rounded-corners"),D.brand&&document.body.classList.add(D.brand),document.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState?document.body.classList.add("-hidden"):document.body.classList.remove("-hidden")})),e.init();var me=$(),fe=e.child(me),ve=t=>{var n=j(),i=e.child(n),s=e.sibling(e.child(i),4),a=e.child(s);e.reset(s);var o=e.sibling(s,2),l=t=>{var n=M();e.append(t,n)},c=(t,n)=>{var i=t=>{var n=U(),i=e.sibling(e.first_child(n),2),s=e.sibling(e.child(i));e.next(),e.reset(i),e.event("click",s,ge),e.append(t,n)};e.if(t,(t=>{e.get(le)===Q&&t(i)}),n)};e.if(o,(t=>{e.get(le)===K?t(l):t(c,!1)}));var d=e.sibling(o,2),p=e.child(d);e.set_custom_element_data(p,"type","secondary"),e.reset(d),e.reset(i),e.reset(n),e.event("click",a,ue),e.event("click",p,(()=>r.close())),e.append(t,n)},he=(t,n)=>{var i=t=>{var n=B(),i=e.child(n),s=e.child(i),a=t=>{var n=N(),i=e.sibling(e.first_child(n),9);e.set_custom_element_data(i,"type","secondary"),e.event("click",i,(()=>r.reload())),e.append(t,n)},o=t=>{var n=z(),i=e.sibling(e.first_child(n),4),s=e.sibling(e.child(i));e.next(),e.reset(i);var a=e.sibling(i,2),o=t=>{var n=F();e.append(t,n)},l=(t,n)=>{var i=t=>{var n=q();e.append(t,n)};e.if(t,(t=>{e.get(oe)===Z&&t(i)}),n)};e.if(a,(t=>{e.get(oe)===G?t(o):t(l,!1)}));var c=e.sibling(a,5);e.set_custom_element_data(c,"type","secondary"),e.event("click",s,pe),e.event("click",c,(()=>r.close())),e.append(t,n)};e.if(s,(t=>{e.get(re)?t(a):t(o,!1)})),e.reset(i),e.reset(n),e.append(t,n)},s=(t,n)=>{var i=t=>{var n=W();e.set_custom_element_data(n,"fullscreen","true"),e.append(t,n)};e.if(t,(t=>{e.get(te)&&t(i)}),n)};e.if(t,(t=>{e.get(ne)?t(i):t(s,!1)}),n)};e.if(fe,(t=>{e.get(ie)||e.get(se)||e.get(le)===K?t(ve):t(he,!1)})),e.reset(me),e.bind_this(me,(t=>e.set(ae,t)),(()=>e.get(ae))),e.append(w,me),e.pop()}const H={moduleMap:{}};var O=e.template('<div class="nui_debug__frame -ipm-window"><div class="nui_debug__frame__detail g-ellipsis"> </div></div>'),G=e.template("<!> <!>",1);function Z(i,s){e.push(s,!0);const o=r.getUrlParams(),l=o.product||d.getBrand(),p=o.title&&x.stripHtml(o.title)||l.charAt(0).toUpperCase()+l.slice(1),u=[c.on("window.nonClientArea.onControlsChanged",(t=>e.set(g,t.controls,!0))),c.on("mainLayout.titleBar.showProgress",(t=>e.set(m,void 0===t.percentage?-1:t.percentage,!0))),c.on("mainLayout.titleBar.hideProgress",(()=>e.set(m,!1)))];let g=e.state(e.proxy(o.controls||"close")),m=e.state(!1),f=e.state(!1),h=e.state(void 0),w=e.state(void 0),_=e.state(!1),y=e.derived((()=>e.get(g).includes("minimize"))),S=e.derived((()=>e.get(g).includes("close")));e.user_effect((()=>{e.get(_)&&e.get(w)&&r.init()})),t((()=>{!async function(){const[t]=await Promise.all([I(),a.init({moduleMap:H.moduleMap}),d.init()]);await b.init({lng:d.getUserConfig().language,lngList:t}),e.set(_,!0)}(),async function(){const t=await v.getValue("avdef://config/GuiCache/ShowTitlebarVersions");e.set(f,1===parseInt(t)),e.get(f)&&await async function(){const t=await r.getWindowId();e.set(h,t.startsWith("https://ipm")?"IPM: "+t.split("p_elm=").pop().split("&")[0]:t,!0)}()}(),async function(){if(!o.controls){const t=await v.getValue("avdef://config/common/IPM_ShowMinimize");1===parseInt(t)&&e.set(g,"minimize,close")}}(),r.setTitle(p+" (Titlebar)")})),n((()=>{for(;u.length;)u.pop()()}));var C=G(),k=e.first_child(C),A=t=>{T(t,{onElem:t=>e.set(w,t,!0),title:p,product:l,get minimizeEnabled(){return e.get(y)},get closeEnabled(){return e.get(S)},get showProgress(){return e.get(m)}})};e.if(k,(t=>{e.get(_)&&t(A)}));var E=e.sibling(k,2),R=t=>{var n=O(),i=e.child(n),s=e.child(i,!0);e.reset(i),e.reset(n),e.template_effect((()=>e.set_text(s,e.get(h)))),e.append(t,n)};e.if(E,(t=>{e.get(f)&&t(R)})),e.append(i,C),e.pop()}const J={feedback:"feedbackForm",performanceGaming:"doNotDisturb",cleanupPp:"tuneup",securityNetwork:"network",securitySecureDNS:"secureDns",secureDNS:"secureDns"},K=A({},J,{privacyAntiTrack:"antiTrack",performanceDriverUpdater:"driverUpdater"});A({},J,{scans:{hashRedirect:e=>{if("scans"===e)return"securityAntivirus"}}}),A({},J,{"tuneup.detailSleepMode":"programDeactivator.detailProgramDeactivator","secureLine.detailprivacy":"secureLine.detailVPN",firewall:{hashRedirect:e=>"firewall"===e?"firewall.detailFirewall":"firewall/nets/issue"===e?"firewall.detailFirewall/issue":void 0},scans:{hashRedirect:e=>{if("scans"===e||/^scans\/scanHistory$/i.test(e))return"scans.detailScans"}},driverUpdater:{hashRedirect:e=>{if("driverUpdater"===e)return"driverUpdater.detailDriverUpdater"}},virusChest:{hashRedirect:e=>{if("virusChest"===e)return"virusChest.detailVirusChest"}},settings:{routeRedirect:e=>"settings/exceptions"===e?"settings/openTab/exceptions":"settings/update"===e?"update":"settings/troubleshooting"===e?"settings/openTab/troubleshooting":void 0}}),A({},J,{scans:{routeRedirect:e=>{if(/^scans\/scanHistory$/i.test(e))return"securityHistory";const t=e.match(/^scans\/scanHistory\/(.*)$/i);return t?`scans/scan/${t[1]}`:void 0}}}),A({},J,{virusChest:{hashRedirect:e=>{if("virusChest"===e)return"shields/openTab/virusChest"}},scans:{hashRedirect:e=>{if("scans"===e)return"protection"}},settings:{routeRedirect:e=>{if("settings/exceptions"===e)return"shields/openTab/exclusions"}}});const Q=["AntiRansomwareShield","Firewall","RemoteAccessShield"],X={ui:new RegExp("^#"),settings:new RegExp("^#settings","i"),protection_settings:new RegExp("^#settings/shields","i"),scan:new RegExp("^#scans","i"),scan_settings:new RegExp("^#settings/scans|^#scans/customScans/({.*}|new)/settings","i"),update:new RegExp("^#(settings/)?update","i"),chest:new RegExp("^#(settings/)?virusChest","i"),firewall:new RegExp("^#(settings/)?firewall","i")},Y={settings:{"app.settings.Set":e=>{if("avcfg://settings/***TaskGUID***/SchedulerEnabled"===e?.name&&"{D93EF81A-B92F-27FE-AF54-9278EA8BF910}"===e?.objectId&&1==e.value)return!1;const t="string"==typeof e?e:e?.name;return![/^avcfg:\/\/settings\/ipm\/.*$/,"avcfg://settings/***TaskGUID***/TempShutDownMachine",/^avcfg:\/\/settings\/common\/DWM/,"avcfg://settings/Common/MigrationFlow"].some((e=>"string"==typeof e?e===t:e.test(t)))},"app.antiransomware.SetProtectionMode":()=>!0,"app.antiransomware.SetPaths":()=>!0,"app.antiransomware.SetExtensions":()=>!0},imex:{"app.imexsettings.export":()=>!0,"app.imexsettings.import":()=>!0},firewall:{"app.fwserv.device_block_remove":()=>!0,"app.fwserv.mac_block_remove":()=>!0,"app.fwserv.ResetSettings":()=>!0,"app.fwserv.set_net_profile_full":()=>!0,"app.fwserv.unblock_network":()=>!0,"app.firewall.SetAppSimpleRule":()=>!0,"app.firewall.SetPacketRules":()=>!0},chest:{"app.virusChest.Add":()=>!0,"app.virusChest.Delete":()=>!0,"app.virusChest.Extract":()=>!0,"app.virusChest.Restore":()=>!0}},ee=A({},Y);Object.assign(ee.settings,{"app.features.Stop":e=>function(e,t){let n=!1;e.featureId&&(n=t.includes(e.featureId));!n&&e.features?.length&&(n=e.features.some((e=>t.includes(e))));return n}(e,Q),...Y.firewall});const te={protectedHashDefs:X,protectedRequestDefs:Y},ne={setTheme(){let e;e||(e=v.getValue("avcfg://settings/Common/UITheme").catch((()=>!1)));const t=v.getValue("avdef://config/GuiCache/ThemeTweaks").catch((()=>""));return Promise.allSettled([e,t]).then((([e,t])=>{const n=e.value;let i=t.value;if(i){i=i.replace(/;/g,";\n");const e=document.createElement("style");e.setAttribute("type","text/css");const t=document.createTextNode(`:root {\n${i}\n}`);e.appendChild(t),document.head&&document.head.appendChild(e)}if(!n)return;const s=a.getModuleDefs();s["mainCss_"+n]&&document.querySelector("#mainCss").setAttribute("href","/mainCss_"+n+".css"),s["mainFont_"+n]&&document.querySelector("#mainFont").setAttribute("href","/mainFont_"+n+".css"),s["mainSprite_"+n]&&document.querySelector("#mainSprite").setAttribute("href","/mainSprite_"+n+".css"),s["mainLayoutCss_"+n]&&document.querySelector("#mainLayoutCss").setAttribute("href","/mainLayoutCss_"+n+".css"),document.querySelector("body").classList.add("-is-"+n+"-style")}))}},ie=!1;var se,ae=e.template("<kin-button> </kin-button> <kin-button> </kin-button>",3),re=e.template("<div><!></div>");function oe(t,n){e.push(n,!1);let i=e.mutable_source(!1),a=e.mutable_source();function r(){s("window.reload")}d.init().then((()=>I().then((e=>b.init({lng:d.getUserConfig().language,lngList:e}))))).then(P).then((()=>{e.set(a,!!d.isAvira()&&"icon-xl-offline"),e.set(i,!0),window?.ext?.preventClose&&(window.ext.preventClose=!1)})),e.init();var o=e.comment(),l=e.first_child(o),c=t=>{var n=re();let i;var o=e.child(n);L(o,{standalone:!0,get illustration(){return ie},get customIcon(){return e.get(a)},$$slots:{"offline-cta":(t,n)=>{var i=ae(),a=e.first_child(i);e.set_class(a,1,"g-margin-right--1x"),e.set_custom_element_data(a,"size","large");var o=e.child(a,!0);e.reset(a);var l=e.sibling(a,2);e.set_custom_element_data(l,"size","large"),e.set_custom_element_data(l,"type","secondary");var c=e.child(l,!0);e.reset(l),e.template_effect(((t,n)=>{e.set_text(o,t),e.set_text(c,n)}),[()=>w("global.tryAgain"),()=>w("global.cancel")],e.derived_safe_equal),e.event("click",a,r),e.event("click",l,(()=>s("window.close"))),e.append(t,i)}}}),e.reset(n),e.template_effect((t=>i=e.set_class(n,1,"sve_offline-page__wrap",null,i,t)),[()=>({"-blade":ie})],e.derived_safe_equal),e.append(t,n)};e.if(l,(t=>{e.get(i)&&t(c)})),e.append(t,o),e.pop()}se={moduleMap:K,brand:"avast",plugins:ne,protectedAreaDefs:te},Object.assign(D,se),function(e){Object.assign(H,e)}({moduleMap:K});export{oe as OfflineIpm,Z as Titlebar,V as default};const le={name:"core",version:"1.3.1604",created:"2025-05-28T06:30:53.270Z"};export{le as metadata};
