@overlayed/app 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import{createRequire as e}from"node:module";import{Type as t,scope as n,type as r}from"arktype";import i from"mitt";import a,{createWriteStream as o,existsSync as s,mkdirSync as c,readdirSync as l,unlinkSync as u,writeFileSync as d}from"fs";import{ensureFileSync as f}from"fs-extra";import p,{join as m}from"path";import*as h from"node:path";import g,{basename as _,resolve as ee}from"node:path";import v from"picocolors";import te from"events";import*as y from"node:fs";import{copyFileSync as ne,createReadStream as re,existsSync as b,mkdirSync as ie,readFileSync as ae,readdirSync as oe,writeFileSync as se}from"node:fs";import"glob";import"jiti";import ce from"xior";import x from"fs/promises";import le from"jszip";import{createHash as ue}from"node:crypto";import*as de from"node:fs/promises";import{BrowserWindow as fe,app as S}from"electron";import*as C from"node:os";import pe from"systeminformation";import{Provider as me,autoUpdater as w}from"electron-updater";import"electron-updater/out/providers/Provider";var he=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);function ge(e){return e}function T(e){return e?Array.isArray(e)?e:[e]:[]}function _e(e){return typeof e==`string`&&/^01[0-9A-HJKMNP-TV-Z]{24}$/.test(e)}var ve=class{data=[];constructor(){}get size(){return this.data.length}add(e){this.data.push(e)}next(){return this.data.shift()}clear(){this.data.length=0}*flush(){for(;this.size>0;){let e=this.next();e&&(yield e)}}},E=class{emitter;constructor(){this.emitter=i()}on(e,t){T(e).forEach(e=>{this.emitter.on(e,t)})}off(e,t){T(e).forEach(e=>{this.emitter.off(e,t)})}emit(e,t){T(e).forEach(e=>{this.emitter.emit(e,t)})}removeAllListeners(){this.emitter.all.clear()}},ye=class{listeners;constructor(){this.listeners=new Map}on(e,t){T(e).forEach(e=>{let n=this.listeners.get(e)||new Set;n.add(t),this.listeners.set(e,n)})}off(e,t){T(e).forEach(e=>{let n=this.listeners.get(e);n&&n.delete(t)})}async emit(e,...t){let n=T(e).flatMap(e=>{let t=this.listeners.get(e)||new Set,n=this.listeners.get(`*`)||new Set;return[...Array.from(t),...Array.from(n)]});return n.length===0?[]:await Promise.all(n.map(async n=>{try{let e=n(...t);return e instanceof Promise?await e:e}catch(t){console.error(`Error in event listener for ${String(e)}:`,t);return}}))}removeAllListeners(){this.listeners.clear()}};function D(e,...t){return class extends e{static _instance;static getInstance(){return this._instance||=new e(...t),this._instance}static clearInstance(){this._instance=void 0}}}const O=D(class extends E{destroy(){this.removeAllListeners()}fatal(e,t,n){this.emit(`fatal`,{code:t,message:e,data:n,timestamp:Date.now()})}error(e,t,n){this.emit(`error`,{code:t,message:e,data:n,timestamp:Date.now()})}warn(e,t,n){this.emit(`warning`,{code:t,message:e,data:n,timestamp:Date.now()})}});var k=class{data;_schema;_defaultValue;_path;constructor(e){let{schema:t,default:n,path:r}=e;this._schema=t,this._defaultValue=n,this._path=r}set(e){let t=this._schema[`~standard`].validate(e);if(t instanceof Promise)throw Error(`StructuredConfigFile does not support async validation`);if(t.issues){this.reportInvalidConfigFile(t.issues);return}this.data=this.onBeforeSave(e),this.save(e)}get(e={}){return this.data?this.data:this.load(e)}getKey(e,t={}){return this.get(t)[e]}save(e){let t=this.onBeforeSave(e);try{f(this.getFilePath()),a.writeFileSync(this.getFilePath(),JSON.stringify(t,void 0,2))}catch{return}return this.data=t}load(e={}){let{createIfMissing:t=!0}=e;if(!this.fileExists(this.getFilePath())||!this.canReadWriteFile(this.getFilePath())){t&&this.save(this._defaultValue);let e=this.onAfterLoad(this._defaultValue);return t&&(this.data=e),e}try{let e=a.readFileSync(this.getFilePath(),`utf8`),t=this.onAfterLoad(this.parseStoredData(e));return this.data=t,t}catch{return this.data=this._defaultValue}}onBeforeSave(e){return e}onAfterLoad(e){return e}getFilePath(){return this._path}parseStoredData(e){try{let t=r(`string.json.parse`).to(`object`)(e);if(t instanceof r.errors)return this._defaultValue;let n=this._schema[`~standard`].validate(t);if(n instanceof Promise)throw Error(`StructuredConfigFile does not support async validation`);return n.issues?this.migrate(t,this._defaultValue):this.migrate(n.value,this._defaultValue)}catch{return this._defaultValue}}canReadWriteFile(e){try{return a.accessSync(e,a.constants.R_OK|a.constants.W_OK),!0}catch{return!1}}fileExists(e){try{return a.accessSync(e,a.constants.F_OK),!0}catch{return!1}}migrate(e,t){let n={...e};for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(r in e?e[r]!==null&&t[r]!==null&&typeof e[r]==`object`&&typeof t[r]==`object`&&!Array.isArray(e[r])&&!Array.isArray(t[r])?n[r]=this.migrate(e[r],t[r]):Array.isArray(t[r])&&(n[r]=e[r]):n[r]=t[r]);return n}reportInvalidConfigFile(e){O.getInstance().error(`Invalid config file`,`INVALID_CONFIG_FILE`,{issues:e.map(e=>e.message),filePath:this._path,data:this.data})}};function be(e,t,n){return typeof e!=`object`||!e?String(e):e instanceof Error?JSON.stringify(e,(e,t)=>{if(t instanceof Error){let e={};for(let n of Object.getOwnPropertyNames(t))e[n]=t[n];return e}return t},n):e instanceof Map?JSON.stringify(Object.fromEntries(e.entries()),t,n):e instanceof Set?JSON.stringify(Array.from(e),t,n):JSON.stringify(e,t,n)}const xe=/\x1b\[[0-9;]*m/g;function Se(e){return e.replace(xe,``)}var Ce=class e extends E{stream;logPath;baseFileName;currentDate;rotationCheckInterval;isRotating=!1;constructor(e,t){super(),this.logPath=e,this.baseFileName=t.replace(`.log`,``),this.currentDate=this.getDateString(new Date),this.ensureLogDirectory(),this.ensureLogFile(),this.stream=this.createStream(),this.rotationCheckInterval=this.startRotationCheck(),this.cleanupOldLogs()}static scope(t,n){return new e(t,n)}log(...e){this.write(`info`,...e)}error(...e){this.write(`error`,...e)}warn(...e){this.write(`warn`,...e)}info(...e){this.write(`info`,...e)}debug(...e){this.write(`debug`,...e)}async close(){clearInterval(this.rotationCheckInterval),await new Promise(e=>{this.stream.end(()=>e())})}getCurrentFileName(){return this.getFileName(this.currentDate)}static getMessageElements(e,...t){let n=new Date;return{timestamp:n.toISOString().replace(`T`,` `).replace(/\.\d+Z$/,``)+`.${n.getUTCMilliseconds().toString().padStart(3,`0`)}`,level:e,message:t.map(e=>be(e)).join(` `)}}getFileName(e){return`${this.baseFileName}-${e}.log`}ensureLogDirectory(){try{c(this.logPath,{recursive:!0})}catch(e){throw console.error(`Failed to create log directory ${this.logPath}:`,e),e}}ensureLogFile(){let e=m(this.logPath,this.getFileName(this.currentDate));if(!s(e))try{d(e,``,`utf8`)}catch(t){throw console.error(`Failed to create log file ${e}:`,t),t}}getDateString(e){return`${e.getUTCFullYear()}-${(e.getUTCMonth()+1).toString().padStart(2,`0`)}-${e.getUTCDate().toString().padStart(2,`0`)}`}createStream(){return o(m(this.logPath,this.getFileName(this.currentDate)),{flags:`a`,encoding:`utf8`})}async rotateLogs(){if(this.isRotating)return;this.isRotating=!0;let e=this.getDateString(new Date);e!==this.currentDate&&await new Promise(t=>{this.stream.end(()=>{this.currentDate=e,this.stream=this.createStream(),this.cleanupOldLogs(),t()})}),this.isRotating=!1}startRotationCheck(){return setInterval(()=>this.rotateLogs(),6e4)}cleanupOldLogs(){let e=l(this.logPath),t=new Date,n=new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()-7));e.filter(e=>e.startsWith(this.baseFileName)&&e.endsWith(`.log`)).filter(e=>{let[t,r,i]=e.replace(`${this.baseFileName}-`,``).replace(`.log`,``).split(`-`).map(Number);return new Date(Date.UTC(t,r-1,i))<=n}).forEach(e=>{try{u(m(this.logPath,e))}catch(t){console.error(`Failed to delete old log file ${e}:`,t)}})}ensureStreamValid(){if(!this.stream.writable||this.stream.destroyed)try{this.stream=this.createStream()}catch(e){this.emit(`error`,e instanceof Error?e:Error(String(e)))}}write(t,...n){let{timestamp:r,message:i}=e.getMessageElements(t,...n),a=`[${r}] [${t}] ${Se(i)}\n`;this.ensureStreamValid(),this.stream.write(a,e=>{if(e)if(e.code===`ERR_STREAM_WRITE_AFTER_END`||!this.stream.writable)try{this.stream=this.createStream(),this.stream.write(a,e=>{e?this.emit(`error`,e):this.emit(`write`,a)})}catch(e){this.emit(`error`,e instanceof Error?e:Error(String(e)))}else this.emit(`error`,e);else this.emit(`write`,a)})}};const A=()=>g.join(process.env.APPDATA??``,`overlayed`),we=()=>g.join(A(),`logs`),Te=e=>g.join(A(),`apps`,e),Ee=e=>g.join(Te(e),`logs`),De=()=>g.join(A(),`meta.json`);var Oe=class{fileLogger;path;appId;messageQueue=new ve;fileName;_debug=!1;silent=!1;constructor(e){this.fileName=e}init(e,t=!1,n=!1){this.appId=e,this._debug=t,this.silent=n,this.path=Ee(e),this.fileLogger=new Ce(this.path,this.fileName),this.messageQueue.flush().forEach(e=>{this.fileLogger?.[e.type](...e.args)})}scope(e){if(!this.appId||!this.path)throw Error(`Logger not initialized`);let t=v.cyan(`[${e}]`);return{scope:e=>this.scope(e),error:(...e)=>this.error(t,...e),warn:(...e)=>this.warn(t,...e),info:(...e)=>this.info(t,...e),log:(...e)=>this.log(t,...e),debug:(...e)=>this.debug(t,...e)}}error(...e){this.handle(`error`,...e)}warn(...e){this.handle(`warn`,...e)}info(...e){this.handle(`log`,...e)}debug(...e){this._debug&&this.handle(`debug`,...e)}log(...e){this.handle(`log`,...e)}handle(e,...t){this.logToConsole(e,...t),this.fileLogger?this.fileLogger[e](...t):this.messageQueue.add({type:e,args:t})}logToConsole(e,...t){let n={error:v.red,warn:v.yellow,debug:v.blue,log:v.white};if(this.silent&&!this._debug)return;let{timestamp:r,message:i}=Ce.getMessageElements(e,...t),a=console[e],o=n[e];a(`${v.gray(r)} ${o(i)}`)}};const j=D(Oe,`overlayed.log`);var ke=class extends te{blob;chunkSizeMb;maxConcurrent;shouldStop=!1;constructor(e,t){super(),this.blob=e,this.chunkSizeMb=t.chunkSizeMb,this.maxConcurrent=t.maxConcurrent??3}get totalChunks(){return Math.ceil(this.blob.size/(this.chunkSizeMb*1024*1024))}async chunk(e){let t=this.chunkSizeMb*1024*1024,n=this.totalChunks;if(n===0)return;let r=new Map,i=new Set,a=new Set,o=[];for(let e=0;e<n;e++)o.push(e);let s=async n=>{let s=n*t,c=Math.min(s+t,this.blob.size),l=this.blob.slice(s,c);try{await e(l,n),a.add(n),this.emit(`chunkComplete`,n),i.delete(n)}catch(e){let t=r.get(n)||0;t<5?(r.set(n,t+1),await new Promise(e=>setTimeout(e,(t+1)*1e3)),o.push(n)):(a.add(n),this.emit(`error`,e),this.shouldStop=!0,i.delete(n))}},c=[],l=async()=>{for(;(o.length>0||i.size>0)&&!this.shouldStop;){if(o.length===0){await new Promise(e=>setTimeout(e,10));continue}let e=o.shift();a.has(e)||i.has(e)||(i.add(e),await s(e))}};for(let e=0;e<this.maxConcurrent;e++)c.push(l());await Promise.all(c)}};function Ae(e,t){let{recursive:n}=je(t);return b(e)?n?Me(e).map(t=>[e,t]):oe(e).map(t=>[e,t]):[]}function je(e){return{recursive:e?.recursive??!0}}function Me(e){return oe(e,{withFileTypes:!0}).flatMap(t=>{let n=g.join(e,t.name);return t.isDirectory()?Me(n):[n]})}function Ne(e){return Pe(e),e}function Pe(e){if(!_e(e.applicationId))throw Error(`Invalid applicationId, must be a valid ULID.`)}function Fe(e,t){let n=t?.cwd??process.cwd(),r=h.join(n,`.overlayed`);y.existsSync(r)||y.mkdirSync(r,{recursive:!0});let i={application:{id:e.id,name:e.name,slug:e.slug,siteUrl:e.siteUrl},release:{id:null,channel:`local`,version:`0.0.0`}},a=h.join(r,`meta.json`);return y.writeFileSync(a,JSON.stringify(i,null,2)),i}const{PipeEventServer:Ie,PipeEventClient:Le,PipeEventBase:Re,ProcessMonitor:ze,Process:Be,HardwareInterface:Ve}=e(import.meta.url)(`@overlayed/app/dist/native-interface/build/overlayed_native_interface_x64.node`),He=D(class extends E{server=null;_hasConnection=!1;pipeId;get hasConnection(){return this._hasConnection}constructor(e){super(),this.pipeId=e,this.init()}destroy(){this.server&&=(this._hasConnection=!1,this.server?.removeAllListeners(),null)}init(){this.server=new Ie(this.pipeId,{clientCount:1,access:1}),this.server.on(`event`,e=>{try{let t=JSON.parse(e);this.emit(`data`,[t])}catch(e){this.emit(`error`,e)}}),this.server.on(`connected`,()=>{this._hasConnection=!0,this.emit(`connected`,void 0)}),this.server.on(`disconnected`,()=>{this._hasConnection=!1,this.emit(`disconnected`,void 0)})}},`overlayed-event-server`),{RenderInterface:Ue,renderHookPath:We}=e(import.meta.url)(`@overlayed/app/dist/render-interface/build/overlayed_render_interface_x64.node`);let Ge=function(e){return e[e.LeftButton=1]=`LeftButton`,e[e.RightButton=2]=`RightButton`,e[e.Cancel=3]=`Cancel`,e[e.MiddleButton=4]=`MiddleButton`,e[e.ExtraButton1=5]=`ExtraButton1`,e[e.ExtraButton2=6]=`ExtraButton2`,e[e.Back=8]=`Back`,e[e.Tab=9]=`Tab`,e[e.Clear=12]=`Clear`,e[e.Return=13]=`Return`,e[e.Shift=16]=`Shift`,e[e.Control=17]=`Control`,e[e.Menu=18]=`Menu`,e[e.Pause=19]=`Pause`,e[e.CapsLock=20]=`CapsLock`,e[e.Kana=21]=`Kana`,e[e.Hangeul=21]=`Hangeul`,e[e.Hangul=21]=`Hangul`,e[e.Junja=23]=`Junja`,e[e.Final=24]=`Final`,e[e.Hanja=25]=`Hanja`,e[e.Kanji=25]=`Kanji`,e[e.Escape=27]=`Escape`,e[e.Convert=28]=`Convert`,e[e.NonConvert=29]=`NonConvert`,e[e.Accept=30]=`Accept`,e[e.ModeChange=31]=`ModeChange`,e[e.Space=32]=`Space`,e[e.Prior=33]=`Prior`,e[e.Next=34]=`Next`,e[e.End=35]=`End`,e[e.Home=36]=`Home`,e[e.Left=37]=`Left`,e[e.Up=38]=`Up`,e[e.Right=39]=`Right`,e[e.Down=40]=`Down`,e[e.Select=41]=`Select`,e[e.Print=42]=`Print`,e[e.Execute=43]=`Execute`,e[e.Snapshot=44]=`Snapshot`,e[e.Insert=45]=`Insert`,e[e.Delete=46]=`Delete`,e[e.Help=47]=`Help`,e[e.N0=48]=`N0`,e[e.N1=49]=`N1`,e[e.N2=50]=`N2`,e[e.N3=51]=`N3`,e[e.N4=52]=`N4`,e[e.N5=53]=`N5`,e[e.N6=54]=`N6`,e[e.N7=55]=`N7`,e[e.N8=56]=`N8`,e[e.N9=57]=`N9`,e[e.A=65]=`A`,e[e.B=66]=`B`,e[e.C=67]=`C`,e[e.D=68]=`D`,e[e.E=69]=`E`,e[e.F=70]=`F`,e[e.G=71]=`G`,e[e.H=72]=`H`,e[e.I=73]=`I`,e[e.J=74]=`J`,e[e.K=75]=`K`,e[e.L=76]=`L`,e[e.M=77]=`M`,e[e.N=78]=`N`,e[e.O=79]=`O`,e[e.P=80]=`P`,e[e.Q=81]=`Q`,e[e.R=82]=`R`,e[e.S=83]=`S`,e[e.T=84]=`T`,e[e.U=85]=`U`,e[e.V=86]=`V`,e[e.W=87]=`W`,e[e.X=88]=`X`,e[e.Y=89]=`Y`,e[e.Z=90]=`Z`,e[e.LeftWindows=91]=`LeftWindows`,e[e.RightWindows=92]=`RightWindows`,e[e.Application=93]=`Application`,e[e.Sleep=95]=`Sleep`,e[e.Numpad0=96]=`Numpad0`,e[e.Numpad1=97]=`Numpad1`,e[e.Numpad2=98]=`Numpad2`,e[e.Numpad3=99]=`Numpad3`,e[e.Numpad4=100]=`Numpad4`,e[e.Numpad5=101]=`Numpad5`,e[e.Numpad6=102]=`Numpad6`,e[e.Numpad7=103]=`Numpad7`,e[e.Numpad8=104]=`Numpad8`,e[e.Numpad9=105]=`Numpad9`,e[e.Multiply=106]=`Multiply`,e[e.Add=107]=`Add`,e[e.Separator=108]=`Separator`,e[e.Subtract=109]=`Subtract`,e[e.Decimal=110]=`Decimal`,e[e.Divide=111]=`Divide`,e[e.F1=112]=`F1`,e[e.F2=113]=`F2`,e[e.F3=114]=`F3`,e[e.F4=115]=`F4`,e[e.F5=116]=`F5`,e[e.F6=117]=`F6`,e[e.F7=118]=`F7`,e[e.F8=119]=`F8`,e[e.F9=120]=`F9`,e[e.F10=121]=`F10`,e[e.F11=122]=`F11`,e[e.F12=123]=`F12`,e[e.F13=124]=`F13`,e[e.F14=125]=`F14`,e[e.F15=126]=`F15`,e[e.F16=127]=`F16`,e[e.F17=128]=`F17`,e[e.F18=129]=`F18`,e[e.F19=130]=`F19`,e[e.F20=131]=`F20`,e[e.F21=132]=`F21`,e[e.F22=133]=`F22`,e[e.F23=134]=`F23`,e[e.F24=135]=`F24`,e[e.NumLock=144]=`NumLock`,e[e.ScrollLock=145]=`ScrollLock`,e[e.NEC_Equal=146]=`NEC_Equal`,e[e.Fujitsu_Jisho=146]=`Fujitsu_Jisho`,e[e.Fujitsu_Masshou=147]=`Fujitsu_Masshou`,e[e.Fujitsu_Touroku=148]=`Fujitsu_Touroku`,e[e.Fujitsu_Loya=149]=`Fujitsu_Loya`,e[e.Fujitsu_Roya=150]=`Fujitsu_Roya`,e[e.LeftShift=160]=`LeftShift`,e[e.RightShift=161]=`RightShift`,e[e.LeftControl=162]=`LeftControl`,e[e.RightControl=163]=`RightControl`,e[e.LeftMenu=164]=`LeftMenu`,e[e.RightMenu=165]=`RightMenu`,e[e.BrowserBack=166]=`BrowserBack`,e[e.BrowserForward=167]=`BrowserForward`,e[e.BrowserRefresh=168]=`BrowserRefresh`,e[e.BrowserStop=169]=`BrowserStop`,e[e.BrowserSearch=170]=`BrowserSearch`,e[e.BrowserFavorites=171]=`BrowserFavorites`,e[e.BrowserHome=172]=`BrowserHome`,e[e.VolumeMute=173]=`VolumeMute`,e[e.VolumeDown=174]=`VolumeDown`,e[e.VolumeUp=175]=`VolumeUp`,e[e.MediaNextTrack=176]=`MediaNextTrack`,e[e.MediaPrevTrack=177]=`MediaPrevTrack`,e[e.MediaStop=178]=`MediaStop`,e[e.MediaPlayPause=179]=`MediaPlayPause`,e[e.LaunchMail=180]=`LaunchMail`,e[e.LaunchMediaSelect=181]=`LaunchMediaSelect`,e[e.LaunchApplication1=182]=`LaunchApplication1`,e[e.LaunchApplication2=183]=`LaunchApplication2`,e[e.OEM1=186]=`OEM1`,e[e.OEMPlus=187]=`OEMPlus`,e[e.OEMComma=188]=`OEMComma`,e[e.OEMMinus=189]=`OEMMinus`,e[e.OEMPeriod=190]=`OEMPeriod`,e[e.OEM2=191]=`OEM2`,e[e.OEM3=192]=`OEM3`,e[e.OEM4=219]=`OEM4`,e[e.OEM5=220]=`OEM5`,e[e.OEM6=221]=`OEM6`,e[e.OEM7=222]=`OEM7`,e[e.OEM8=223]=`OEM8`,e[e.OEMAX=225]=`OEMAX`,e[e.OEM102=226]=`OEM102`,e[e.ICOHelp=227]=`ICOHelp`,e[e.ICO00=228]=`ICO00`,e[e.ProcessKey=229]=`ProcessKey`,e[e.ICOClear=230]=`ICOClear`,e[e.Packet=231]=`Packet`,e[e.OEMReset=233]=`OEMReset`,e[e.OEMJump=234]=`OEMJump`,e[e.OEMPA1=235]=`OEMPA1`,e[e.OEMPA2=236]=`OEMPA2`,e[e.OEMPA3=237]=`OEMPA3`,e[e.OEMWSCtrl=238]=`OEMWSCtrl`,e[e.OEMCUSel=239]=`OEMCUSel`,e[e.OEMATTN=240]=`OEMATTN`,e[e.OEMFinish=241]=`OEMFinish`,e[e.OEMCopy=242]=`OEMCopy`,e[e.OEMAuto=243]=`OEMAuto`,e[e.OEMENLW=244]=`OEMENLW`,e[e.OEMBackTab=245]=`OEMBackTab`,e[e.ATTN=246]=`ATTN`,e[e.CRSel=247]=`CRSel`,e[e.EXSel=248]=`EXSel`,e[e.EREOF=249]=`EREOF`,e[e.Play=250]=`Play`,e[e.Zoom=251]=`Zoom`,e[e.Noname=252]=`Noname`,e[e.PA1=253]=`PA1`,e[e.OEMClear=254]=`OEMClear`,e}({});const M=r({game:`string`,type:`string`,creation_time:`number`}).and({game:`'siege' | 'tft'`}),Ke=M.and({type:`'logged_in'`,content:{account_id:`string`}}),qe=M.and({type:`'module_loaded'`,content:{game_version:`string`,process_hash:`string`}}),Je=M.and({type:`'module_unloaded'`}),Ye=M.and({type:`'unsupported_game_version'`,content:{game_version:`string`,process_hash:`string`}}),Xe=n({"#event1":`logged_in | module_loaded | module_unloaded | unsupported_game_version`,event:`event1`,logged_in:Ke,module_loaded:qe,module_unloaded:Je,unsupported_game_version:Ye}).export(),Ze=Object.keys(Xe).filter(e=>e!==`event`);function Qe(){return{key:`universal`,events:Xe}}var $e=class{options=null;logger;initialized=!1;constructor(e){this.logger=j.getInstance().scope(e)}init(e){this.logger.log(`Initializing`),this.options=e||null,this.initialized=!0}destroy(){this.logger.log(`Destroying`),this.initialized=!1}},N=class extends E{options=null;logger;initialized=!1;constructor(e){super(),this.logger=j.getInstance().scope(e)}init(e){this.logger.log(`Initializing`),this.options=e||null,this.initialized=!0}destroy(){this.logger.log(`Destroying`),this.initialized=!1,this.removeAllListeners()}},et=class extends ye{options=null;logger;initialized=!1;constructor(e){super(),this.logger=j.getInstance().scope(e)}init(e){this.logger.log(`Initializing`),this.options=e||null,this.initialized=!0}destroy(){this.logger.log(`Destroying`),this.initialized=!1,this.removeAllListeners()}};const P=ce.create({baseURL:`https://api.overlayed.gg`,headers:{Accept:`application/json`,"Accept-Encoding":`gzip, deflate, br`}});let tt;function nt(e){tt=e}let rt;function it(e){rt=e}function at(e){return`overlayed/app (${Object.entries(e).map(([e,t])=>`${e}=${t}`).join(`, `)})`}P.interceptors.request.use(e=>{let t=tt?.();e.headers??={},t&&(e.headers[`X-Api-Key`]=t);let n=rt?.();return n&&(e.headers[`User-Agent`]=at(n)),e});function ot(e,t){if(t<=0)throw Error(`Chunk size must be greater than 0`);if(e.length===0)return[];let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}function st(e){return e}function ct(e){return e?t=>(e(t),t):st}const lt=ct();function ut(e){return P.get(`/v1/public/applications/${e}`)}function dt(e,t){return P.get(`/v1/public/applications/${e}/releases/check`,{params:t})}function ft(e,t){let n=new FormData;return n.append(`file`,new Blob([t.file],{type:`application/zip`}),`logs.zip`),n.append(`data`,JSON.stringify(t.data)),P.post(`/v1/public/applications/${e}/feedbacks`,n)}function pt(e,t){return P.get(`/v1/public/applications/${e}/notices`,{params:t})}const F=ct();function mt(e,t){return P.get(`/v1/public/modules/${e}/release`,{params:{cortex_user_id:t}})}function ht(e,t,n){return P.post(`/v1/public/modules/${e}/releases/${t}/download`,n)}async function gt(e,t){if(e.method!==`GET`)throw Error(`Unsupported presigned request method: ${e.method}`);let n=await fetch(e.url,{method:e.method,headers:e.headers,signal:t?.signal});if(!n.ok){let e=await _t(n);throw Error(`Presigned download failed (${n.status} ${n.statusText})${e?`: ${e}`:``}`)}let r=await n.arrayBuffer();return new Uint8Array(r)}async function _t(e){try{let t=(await e.text()).trim();if(t.length===0)return;let n=2048;return t.length>n?`${t.slice(0,n)}…`:t}catch{return}}function vt(){return P.get(`/v1/public/raven/config`)}function yt(e,t){return P.get(`/v1/public/raven/games/${e}/builds/${t}`)}function bt(e,t){return P.post(`/v1/public/raven/games/${e}/builds/upload`,null,{params:t})}function xt(e,t){let n=new FormData;return n.append(`file`,t.chunk),P.patch(`/v1/public/raven/games/${e}/builds/upload`,n,{params:t})}function St(e){let t=Date.now(),n=ot(e.messages.map(e=>Ct(t,e)),50),r=Promise.all(n.map(async t=>P.post(`/v1/public/cortex/events`,{...e,messages:t})));return r.catch(e=>{let t=e?.response?.data||e?.message||e;console.error(`Failed to submit cortex events`,t)}),r}function Ct(e,t){let n=e-t.created_at.getTime(),r=Math.max(0,Math.floor(n/1e3));return{properties:t.properties,type:t.type,seconds_offset:r}}function wt(e){return e instanceof Error&&(e.name===`XiorError`||e.name===`XiorTimeoutError`)}function Tt(e){return!!(e&&`kind`in e.data&&`message`in e.data)}const{PipeEventServer:Et,PipeEventClient:Dt,PipeEventBase:Ot,ProcessMonitor:kt,Process:At,HardwareInterface:jt}=e(import.meta.url)(`@overlayed/app/dist/native-interface/build/overlayed_native_interface_x64.node`);function Mt(e=[]){return g.normalize(g.join(Te(global.OVERLAYED.APPLICATION_ID),...e))}const Nt=r({game:`string`,type:`string`,creation_time:`number`}),I=new k({path:De(),schema:r({userId:`string | undefined`,sessionId:`string | undefined`,sessionLastUsed:`number | undefined`,accessToken:`string | undefined`,"debug?":{"ri_disabled?":`boolean`,"gm_disabled?":`boolean`}}),default:{userId:void 0,sessionId:void 0,sessionLastUsed:void 0,accessToken:void 0}});function Pt(){let{debug:e}=I.get();return e?{ri_disabled:e.ri_disabled??!1,gm_disabled:e.gm_disabled??!1}:{ri_disabled:!1,gm_disabled:!1}}function L(){let e=I.get().userId;if(e)return e;let t=Lt();return I.set({...I.get(),userId:t}),t}function Ft(){let e=I.get();if(e.sessionId&&typeof e.sessionLastUsed==`number`&&Date.now()-e.sessionLastUsed<=300*1e3)return e.sessionId;let t=crypto.randomUUID();return I.set({...e,sessionId:t,sessionLastUsed:Date.now()}),t}function It(){try{let e=I.get();I.set({...e,sessionLastUsed:Date.now()})}catch(e){j.getInstance().log(`Failed to update sessionLastUsed`,e)}}function R(){return I.get().accessToken}function z(e){try{let t=I.get();I.set({...t,accessToken:e??void 0})}catch(e){j.getInstance().log(`Failed to set accessToken`,e)}}function Lt(){try{return jt.generateUniqueIdentifier()}catch{return crypto.randomUUID()}}const B=D(class extends N{UPDATE_CHECK_INTERVAL_MS=1e3*60*5;targetDir;updateInterval;constructor(){super(`NativeModuleManager`),this.targetDir=g.join(A(),`resources`),this.logger.log(`Target directory`,this.targetDir)}async initWithDlls(e){super.init(),await x.mkdir(this.targetDir,{recursive:!0}),await this.checkForUpdates(e),clearInterval(this.updateInterval),this.updateInterval=setInterval(()=>this.checkForUpdates(e),this.UPDATE_CHECK_INTERVAL_MS)}destroy(){this.updateInterval&&=(clearInterval(this.updateInterval),void 0),super.destroy()}async getDllFile(e){let t=await this.getCurrentBuildInfo(e);if(!t){this.logger.error(`No build found for module`,{moduleId:e});return}let n=this.getBuildPath(e,t.buildId);if(!b(n)){this.logger.error(`No build file found for module`,{moduleId:e});return}let r=g.join(n,t.buildFileName);if(!b(r)){this.logger.error(`No DLL file found for module`,{moduleId:e});return}return r}async getCurrentBuildInfo(e){try{let t=g.join(this.targetDir,e,`build.json`),n=await x.readFile(t,`utf-8`);return JSON.parse(n)}catch{return null}}getModulePath(e){return g.join(this.targetDir,e)}getBuildPath(e,t){return g.join(this.getModulePath(e),t)}async checkForUpdates(e){this.logger.log(`Checking for updates`);let t=L();if(!t){this.logger.error(`Failed to resolve cortex user id`);return}this.logger.log(`Cortex User ID`,t);for(let n of e)try{let{data:e}=await mt(n,t);this.logger.log(`Release`,e);let r=(await this.getCurrentBuildInfo(n))?.buildId||null;this.logger.log(`${n} > Performing update check. current: ${r}, requested: ${e.build_id}`),e.build_id!==r||await this.isDownloadCorrupted(this.getBuildPath(n,e.build_id),e)?(this.logger.log(`${n} > Update found. current: ${r}, requested: ${e.build_id}`),this.logger.log(`${n} > Downloading and extracting DLLs`),await this.downloadAndExtractDll(n,e),this.logger.log(`${n} > Cleaning up other builds`),await this.cleanupExistingBuilds(n,e.build_id),this.emit(`dllUpdated`,{moduleId:n,buildId:e.build_id,releaseId:e.release_id})):this.logger.log(`${n} > No update found`)}catch(e){this.logger.error(`${n} > Error checking/updating`,e)}}async downloadAndExtractDll(e,t){this.logger.log(`${e} > Requesting download for build ${t.build_id}`);let n=L();if(!n){this.logger.error(`Failed to resolve cortex user id`);return}let{data:r}=await ht(e,t.release_id,{download_token:t.download_token,cortex_user_id:n});this.logger.log(`${e} > Downloading DLLs for build ${t.build_id}`);let i=await gt(r,{signal:AbortSignal.timeout(1e3*60*5)});this.logger.log(`${e} > Downloaded zip file for build ${t.build_id}`);let a=this.getBuildPath(e,t.build_id);await x.mkdir(a,{recursive:!0});let o=new le;await o.loadAsync(i);let s=Object.keys(o.files).map(e=>({name:e,file:o.files[e]})).filter(({file:e})=>!e.dir);if(s.length!==1){this.logger.error(`${e} > Zip must contain exactly 1 file, got ${s.length}`);return}let c=s[0],l=g.basename(c.name),u=g.normalize(l),d=g.isAbsolute(u),f=u.startsWith(`..`)||u.includes(`..${g.sep}`);if(l===``||l===`.`||l===`..`){this.logger.error(`${e} > Zip contained an invalid file name: ${c.name}`);return}if(!l.toLowerCase().endsWith(`.dll`)){this.logger.error(`${e} > Zip contained a non-dll file: ${c.name}`);return}if(d||f){this.logger.error(`${e} > Zip entry path is unsafe: ${c.name}`);return}let p=g.join(a,u),m=await c.file.async(`nodebuffer`);await x.writeFile(p,m),this.logger.log(`${e} > Extracted 1 file to ${p}`);let h={buildId:t.build_id,buildFileName:t.build_file_name},_=g.join(this.getModulePath(e),`build.json`);await x.writeFile(_,JSON.stringify(h),`utf-8`),this.logger.log(`${e} > Saved buildId to file: ${t.build_id}`)}async cleanupExistingBuilds(e,t){let n=this.getModulePath(e),r=this.getBuildPath(e,t),i=await x.readdir(n,{withFileTypes:!0});for(let t of i)t.isDirectory()&&g.join(n,t.name)!==r&&(await x.rm(g.join(n,t.name),{recursive:!0,force:!0}),this.logger.log(`${e} > Cleaned up build: ${t.name}`))}async hasPathAccess(e){try{return await x.access(e,x.constants.F_OK),!0}catch{return!1}}async isDownloadCorrupted(e,t){if(!await this.hasPathAccess(e))return this.logger.error(`Download is corrupted. Path does not exist: ${e}`),!0;let n=t.build_file_name,r=g.join(e,n);if(!b(r))return this.logger.error(`Download is corrupted. Build file not found: ${r}`),!0;if(t.build_hash){let e=await x.readFile(r),i=ue(`sha256`).update(e).digest(`hex`);if(i.toLowerCase()!==t.build_hash.toLowerCase())return this.logger.error(`Download is corrupted. Build file hash mismatch: ${n} ${i.toLowerCase()} !== ${t.build_hash.toLowerCase()}`),!0}return!1}}),V=D(class extends N{REFETCH_INTERVAL=1e3*60*5;FAILED_REFETCH_INTERVAL=1e3*30;_ravenConfig;_executableToGameMap=new Map;_executablesArray=[];_refetchIntervalHandler=null;_failedRefetchTimeoutHandler=null;constructor(){super(`RavenManager`)}init(){super.init(),this.fetchRavenConfig(),this._refetchIntervalHandler=setInterval(()=>{this._failedRefetchTimeoutHandler&&=(clearTimeout(this._failedRefetchTimeoutHandler),null),this.fetchRavenConfig()},this.REFETCH_INTERVAL)}getExecutableData(e){return this._executableToGameMap.get(e.toLowerCase())??null}get executables(){return this._executablesArray}get executablesMap(){return this._executableToGameMap}destroy(){this._refetchIntervalHandler&&clearInterval(this._refetchIntervalHandler),this._failedRefetchTimeoutHandler&&clearTimeout(this._failedRefetchTimeoutHandler),B.getInstance().destroy(),super.destroy()}async fetchRavenConfig(){try{this._ravenConfig={games:(await vt()).data.games},this.resetState();let e=new Set;for(let t of this._ravenConfig.games){for(let e of t.executables){let n=e.toLowerCase();this._executableToGameMap.set(n,t),this._executablesArray.push(n)}t.modules.forEach(t=>e.add(t))}await B.getInstance().initWithDlls(Array.from(e)),this.logger.log(`Raven updated, monitoring ${this._executableToGameMap.size} executables`),this.emit(`executablesUpdated`,{executables:this.executables,map:this._executableToGameMap})}catch(e){this.logger.error(`Failed to fetch Raven config`,e),this._failedRefetchTimeoutHandler=setTimeout(()=>this.fetchRavenConfig(),this.FAILED_REFETCH_INTERVAL)}}resetState(){this._executableToGameMap.clear(),this._executablesArray=[]}}),H=D(class extends N{_processMonitor;_processes=new Map;boundOnRavenManagerExecutablesUpdated=this.onRavenManagerExecutablesUpdated.bind(this);constructor(){super(`ProcessManager`),this._processMonitor=new kt}get hasAnyActiveProcesses(){return this.activeProcesses.length>0}get activeProcesses(){return Array.from(this._processes.values()).flat().filter(e=>!e.destroyedAt)}init(){super.init(),V.getInstance().on(`executablesUpdated`,this.boundOnRavenManagerExecutablesUpdated),this._processMonitor.on(`create`,e=>{this.logger.log(`Process created`,e),this.addProcess(e),this.logger.log(`Active Process Count: ${this._processes.size}`),this.emit(`create`,{process:e})}),this._processMonitor.on(`destroy`,e=>{this.logger.log(`Process destroyed`,e),this.deleteProcess(e),this.logger.log(`Active Process Count: ${this._processes.size}`),this.emit(`destroy`,{process:e})})}destroy(){V.getInstance().off(`executablesUpdated`,this.boundOnRavenManagerExecutablesUpdated),this._processes.clear(),this._processMonitor.removeAllListeners(),super.destroy()}isProcessRunning(e){return this._processes.get(e)?.some(e=>!e.destroyedAt)??!1}onRavenManagerExecutablesUpdated(e){this.logger.log(`Monitoring ${e.executables.length} processes`),e.executables.forEach(e=>{this._processMonitor.isProcessRegistered(e)||this._processMonitor.registerProcess(e)})}addProcess(e){if(!e.name)return;let t=this._processes.get(e.name);if(!t){this._processes.set(e.name,[e]);return}this._processes.set(e.name,t.concat(e))}deleteProcess(e){if(!e.name)return;let t=this._processes.get(e.name)?.filter(t=>t.id!==e.id)??[];t.length===0?this._processes.delete(e.name):this._processes.set(e.name,t)}});var Rt=class{_instance;_resolution;boundOnResolutionChanged=this.onResolutionChanged.bind(this);constructor(e){this._instance=e,this._resolution={width:0,height:0},this._instance.on(`resolution`,this.boundOnResolutionChanged)}destroy(){this._instance.off(`resolution`,this.boundOnResolutionChanged)}get instance(){return this._instance}get resolution(){return this._resolution}onResolutionChanged(e,t){this._resolution={width:e,height:t}}};const U=D(class{interfaces={};constructor(){}createInterface(e){return this.interfaces[e]||(this.interfaces[e]=new Rt(new Ue(e,{access:1}))),this.interfaces[e]}getInterface(e){return this.interfaces[e]?this.interfaces[e]:this.createInterface(e)}}),W=D(class{options;eventQueue;meta=null;enabled=!0;constructor(e){this.options=this.resolveOptions(e),this.eventQueue=new ve,this.setupFlushInterval()}track(e,t){this.enabled&&this.eventQueue.add({type:e,properties:t,created_at:new Date})}flush(){if(!this.enabled)return[];let e=Array.from(this.eventQueue.flush()).concat({type:`ping`,properties:{},created_at:new Date});if(!this.meta)throw Error(`Tried to flush Cortex events before meta was set`);try{St({...this.meta,messages:e})}catch{}return e}setupFlushInterval(){this.enabled&&setInterval(()=>{this.flush()},this.options.batchIntervalSeconds*1e3)}resolveOptions(e){return{batchIntervalSeconds:e?.batchIntervalSeconds??15}}}),zt=e(import.meta.url),Bt=zt.resolve(`@overlayed/app/dist/render-interface/build/overlayed_render_hook_x64.dll`),Vt=zt.resolve(`@overlayed/app/dist/render-interface/build/overlayed_render_hook_x86.dll`),Ht=zt.resolve(`@overlayed/app/dist/native-interface/build/overlayed_native_interface_x64.node`),G=D(class extends et{boundOnProcessCreate=this.onProcessCreate.bind(this);boundOnProcessDestroy=this.onProcessDestroy.bind(this);subscribedGames=new Set;_activeReadyRavenGames={};get isInGame(){return Object.keys(this._activeReadyRavenGames).length>0}constructor(){super(`GameLaunchManager`)}setSubscribedGames(e){this.subscribedGames=new Set(e)}getActiveGames(){return Object.keys(this._activeReadyRavenGames)}init(){super.init(),U.getInstance().createInterface(`OGG_SIEGE`),H.getInstance().on(`create`,this.boundOnProcessCreate),H.getInstance().on(`destroy`,this.boundOnProcessDestroy)}destroy(){H.getInstance().off(`create`,this.boundOnProcessCreate),H.getInstance().off(`destroy`,this.boundOnProcessDestroy),super.destroy()}on(e,t){super.on(e,t);let n=T(e);if(!(n.includes(`gameReady`)||n.includes(`*`))||Object.keys(this._activeReadyRavenGames).length===0)return;let r=t;for(let e of Object.values(this._activeReadyRavenGames))this.logger.log(`Late calling gameReady callback for game`,e.game),r(e)}async onProcessCreate({process:e}){let t=this.getRavenGame(e);if(!t)return;if(this.subscribedGames.size===0){this.logger.warn(`No subscribed games, skipping`);return}if(W.getInstance().track(`game_launch`,{game:t.identifier}),!this.subscribedGames.has(t.identifier)&&!this.subscribedGames.has(`*`))return;let n=new AbortController;if(await this.emit(`gameLaunch`,{game:t.identifier,reject:()=>n.abort()}),n.signal.aborted)return;let r=At.currentProcess;if(this.logger.log(`Game Launched`,t),this.logger.log(`Process is elevated: `,e.isElevated),this.logger.log(`Current process is elevated: `,r.isElevated),e.isElevated&&!r.isElevated){O.getInstance().fatal(`Game is elevated but the App is not`,`ELEVATION_MISMATCH`,{appElevated:!!r.isElevated,gameElevated:!!e.isElevated}),this.logger.log(`Game elevated but App is not`,{appElevated:r.isElevated,gameElevated:e.isElevated});return}let{ri_disabled:i,gm_disabled:a}=Pt(),o=!1;!i&&t.has_render_support&&t.allow_dll_injections?o=await this.injectRenderInterface(e):this.logger.log(`Skipping render interface injection`,{has_render_support:t.has_render_support,allow_dll_injections:t.allow_dll_injections,ri_disabled:i}),!a&&t.allow_dll_injections?await this.injectGameModules(t,e):this.logger.log(`Skipping game module(s) injection`,{allow_dll_injections:t.allow_dll_injections,gm_disabled:a});let s={game:t.identifier,inGameRenderingSupported:o};this._activeReadyRavenGames[t.identifier]=s,this.logger.debug(`Active ready raven games`,Object.keys(this._activeReadyRavenGames).join(`, `)),this.logger.log(`Game Ready`),this.emit(`gameReadyInternal`,{ravenGame:t,process:e}),this.emit(`gameReady`,s),W.getInstance().track(`game_ready`,{game:t.identifier})}copyDll(e){let t=g.basename(e),n=ee(e),r=g.join(A(),`resources`),i=g.join(r,t);this.logger.info(`Copying`,n,`to`,i);try{b(r)||ie(r,{recursive:!0}),se(i,ae(n)),ne(n,i)}catch(e){return e.code===`EBUSY`?i:(this.logger.error(`Failed to copy`,e),this.logger.error(`Failed to copy`,{originalPath:n,targetPath:i}),!1)}return i}async injectRenderInterface(e){this.logger.log(`Injecting render interface`,{is32Bit:e.is32Bit,process:e});let t=e.is32Bit?Vt:Bt;this.logger.log(`Render hook path`,t);let n=this.copyDll(t);if(!n)return this.logger.error(`Failed to copy render hook DLL`,{renderHookPath:t}),!1;let r=g.join(g.dirname(Ht));if(!b(r))return this.logger.error(`Failed to find injector path`,{injectorPath:r}),!1;this.logger.log(`Resolved injector path`,r);try{return this.logger.log(`Injecting render interface`,n),await e.injectDll(n,r),this.logger.log(`Render Interface Injection Successful`,n),!0}catch(e){return this.logger.error(`Render Interface Injection Failed`,e),this.logger.error(`Render Interface Injection Failed`,{renderHookPathCopied:n}),!1}}async injectGameModules(e,t){let n=g.join(g.dirname(Ht));if(!b(n)){this.logger.error(`Failed to find injector path`,{injectorPath:n});return}this.logger.log(`Resolved injector path`,n);for(let r of e.modules){let e=await B.getInstance().getDllFile(r);if(!e){this.logger.error(`No DLL file found for module`,{moduleId:r});continue}try{this.logger.log(`Injecting game module`,e),await t.injectDll(e,n),this.logger.log(`Injection Successful`,e)}catch(t){this.logger.error(`Injection Failed`,{dllFile:e},t)}}}onProcessDestroy({process:e}){let t=this.getRavenGame(e);t&&(delete this._activeReadyRavenGames[t.identifier],this.logger.debug(`Active ready raven games`,Object.keys(this._activeReadyRavenGames).join(`, `)),this.emit(`gameCloseInternal`,{ravenGame:t,process:e}),this.emit(`gameClose`,{game:t.identifier}),W.getInstance().track(`game_close`,{game:t.identifier}))}getRavenGame(e){if(!e.name)return;let t=V.getInstance().getExecutableData(e.name);if(!t){this.logger.error(`No raven game found for process`,{process:e});return}return t}}),Ut=D(class extends $e{boundOnGameLaunch=this.onGameLaunch.bind(this);constructor(){super(`GameBuildManager`)}init(){super.init(),G.getInstance().on(`gameReadyInternal`,this.boundOnGameLaunch)}destroy(){G.getInstance().off(`gameReadyInternal`,this.boundOnGameLaunch),super.destroy()}async onGameLaunch(...e){let[{ravenGame:t,process:n}]=e;if(!n.path||!n.name){this.logger.error(`Process path or name not found, could not check for build hash`,void 0,n);return}let r=ae(n.path),i=ue(`sha256`).update(r).digest(`hex`);this.logger.log(`Process Path`,n.path),this.logger.log(`Process Name`,n.name),this.logger.log(`Build Hash`,i);let a=!1;try{a=(await yt(t.identifier,i)).data.upload}catch(e){this.logger.error(`Error checking game build hash`,e);return}if(!a){this.logger.log(`Build hash already exists, skipping upload`);return}let o=new le;o.file(n.name,r);let s=await o.generateAsync({type:`blob`});try{this.logger.log(`Uploading build (size: `,s.size,` bytes)`);let e=new ke(s,{chunkSizeMb:25,maxConcurrent:1}),n=await bt(t.identifier,{build_hash:i,chunk_count:e.totalChunks,file_size_bytes:s.size});await e.chunk(async(e,r)=>{this.logger.log(`Uploading chunk`,r),await xt(t.identifier,{chunk:e,build_hash:i,chunk_index:r,upload_token:n.data.upload_token})}),this.logger.log(`Build uploaded successfully`)}catch(e){wt(e)?Tt(e.response)?this.logger.error(`Error uploading build hash, api error`,e):this.logger.error(`Error uploading build hash, request error`,e):this.logger.error(`Error uploading build hash, unknown error`,e)}}}),Wt=D(class extends $e{constructor(){super(`CampaignManager`)}async check(e){let t=g.join(Te(e),`utm_code.txt`);try{let e=(await de.readFile(t,`utf-8`)).trim();e&&(this.logger.log(`UTM campaign code found`,e),W.getInstance().track(`utm_attribution`,{campaign_code:e}),W.getInstance().flush())}catch{}}}),Gt=new k({path:p.normalize(`${process.env.APPDATA||process.env.HOME||`.`}/.overlayed/config.json`),default:void 0,schema:n({Account:r({email:`string`,apiKey:`string`})}).type({currentAccount:`Account | undefined`,accounts:`Account[]`}).or(`undefined`)});function K(e,t){return`${e}:${t}`}function Kt(e,t,n){return e.reduce((e,r)=>{let i=r.key;return e[i]={on(e,n){let r=K(i,e),a=t.get(r)??new Set;a.add(n),t.set(r,a)},onAny(e){let n=K(i,`*`),r=t.get(n)??new Set;r.add(e),t.set(n,r)},off(e,n){let r=K(i,e),a=t.get(r);a&&(a.delete(n),a.size===0&&t.delete(r))},offAny(e){let n=K(i,`*`),r=t.get(n);r&&(r.delete(e),r.size===0&&t.delete(n))},readyForGameEvents:()=>{n.emit(`flushEvents`,i)}},e},{})}function qt(){let e=O.getInstance(),t=G.getInstance();return{on:(n,r)=>{switch(n){case`fatal`:e.on(`fatal`,r);break;case`error`:e.on(`error`,r);break;case`warning`:e.on(`warning`,r);break;case`gameLaunch`:t.on(`gameLaunch`,r);break;case`gameClose`:t.on(`gameClose`,r);break;case`gameReady`:t.on(`gameReady`,r);break;default:throw Error(`Event type not implemented ${n}`,{cause:[n,r]})}},off:(n,r)=>{switch(n){case`fatal`:e.off(`fatal`,r);break;case`error`:e.off(`error`,r);break;case`warning`:e.off(`warning`,r);break;case`gameLaunch`:t.off(`gameLaunch`,r);break;case`gameClose`:t.off(`gameClose`,r);break;case`gameReady`:t.off(`gameReady`,r);break;default:throw Error(`Event type not implemented ${n}`,{cause:[n,r]})}}}}var q=function(e){return e[e.LeftButton=1]=`LeftButton`,e[e.RightButton=2]=`RightButton`,e[e.Cancel=3]=`Cancel`,e[e.MiddleButton=4]=`MiddleButton`,e[e.ExtraButton1=5]=`ExtraButton1`,e[e.ExtraButton2=6]=`ExtraButton2`,e[e.Back=8]=`Back`,e[e.Tab=9]=`Tab`,e[e.Clear=12]=`Clear`,e[e.Return=13]=`Return`,e[e.Shift=16]=`Shift`,e[e.Control=17]=`Control`,e[e.Menu=18]=`Menu`,e[e.Pause=19]=`Pause`,e[e.CapsLock=20]=`CapsLock`,e[e.Kana=21]=`Kana`,e[e.Hangeul=21]=`Hangeul`,e[e.Hangul=21]=`Hangul`,e[e.Junja=23]=`Junja`,e[e.Final=24]=`Final`,e[e.Hanja=25]=`Hanja`,e[e.Kanji=25]=`Kanji`,e[e.Escape=27]=`Escape`,e[e.Convert=28]=`Convert`,e[e.NonConvert=29]=`NonConvert`,e[e.Accept=30]=`Accept`,e[e.ModeChange=31]=`ModeChange`,e[e.Space=32]=`Space`,e[e.Prior=33]=`Prior`,e[e.Next=34]=`Next`,e[e.End=35]=`End`,e[e.Home=36]=`Home`,e[e.Left=37]=`Left`,e[e.Up=38]=`Up`,e[e.Right=39]=`Right`,e[e.Down=40]=`Down`,e[e.Select=41]=`Select`,e[e.Print=42]=`Print`,e[e.Execute=43]=`Execute`,e[e.Snapshot=44]=`Snapshot`,e[e.Insert=45]=`Insert`,e[e.Delete=46]=`Delete`,e[e.Help=47]=`Help`,e[e.N0=48]=`N0`,e[e.N1=49]=`N1`,e[e.N2=50]=`N2`,e[e.N3=51]=`N3`,e[e.N4=52]=`N4`,e[e.N5=53]=`N5`,e[e.N6=54]=`N6`,e[e.N7=55]=`N7`,e[e.N8=56]=`N8`,e[e.N9=57]=`N9`,e[e.A=65]=`A`,e[e.B=66]=`B`,e[e.C=67]=`C`,e[e.D=68]=`D`,e[e.E=69]=`E`,e[e.F=70]=`F`,e[e.G=71]=`G`,e[e.H=72]=`H`,e[e.I=73]=`I`,e[e.J=74]=`J`,e[e.K=75]=`K`,e[e.L=76]=`L`,e[e.M=77]=`M`,e[e.N=78]=`N`,e[e.O=79]=`O`,e[e.P=80]=`P`,e[e.Q=81]=`Q`,e[e.R=82]=`R`,e[e.S=83]=`S`,e[e.T=84]=`T`,e[e.U=85]=`U`,e[e.V=86]=`V`,e[e.W=87]=`W`,e[e.X=88]=`X`,e[e.Y=89]=`Y`,e[e.Z=90]=`Z`,e[e.LeftWindows=91]=`LeftWindows`,e[e.RightWindows=92]=`RightWindows`,e[e.Application=93]=`Application`,e[e.Sleep=95]=`Sleep`,e[e.Numpad0=96]=`Numpad0`,e[e.Numpad1=97]=`Numpad1`,e[e.Numpad2=98]=`Numpad2`,e[e.Numpad3=99]=`Numpad3`,e[e.Numpad4=100]=`Numpad4`,e[e.Numpad5=101]=`Numpad5`,e[e.Numpad6=102]=`Numpad6`,e[e.Numpad7=103]=`Numpad7`,e[e.Numpad8=104]=`Numpad8`,e[e.Numpad9=105]=`Numpad9`,e[e.Multiply=106]=`Multiply`,e[e.Add=107]=`Add`,e[e.Separator=108]=`Separator`,e[e.Subtract=109]=`Subtract`,e[e.Decimal=110]=`Decimal`,e[e.Divide=111]=`Divide`,e[e.F1=112]=`F1`,e[e.F2=113]=`F2`,e[e.F3=114]=`F3`,e[e.F4=115]=`F4`,e[e.F5=116]=`F5`,e[e.F6=117]=`F6`,e[e.F7=118]=`F7`,e[e.F8=119]=`F8`,e[e.F9=120]=`F9`,e[e.F10=121]=`F10`,e[e.F11=122]=`F11`,e[e.F12=123]=`F12`,e[e.F13=124]=`F13`,e[e.F14=125]=`F14`,e[e.F15=126]=`F15`,e[e.F16=127]=`F16`,e[e.F17=128]=`F17`,e[e.F18=129]=`F18`,e[e.F19=130]=`F19`,e[e.F20=131]=`F20`,e[e.F21=132]=`F21`,e[e.F22=133]=`F22`,e[e.F23=134]=`F23`,e[e.F24=135]=`F24`,e[e.NumLock=144]=`NumLock`,e[e.ScrollLock=145]=`ScrollLock`,e[e.NEC_Equal=146]=`NEC_Equal`,e[e.Fujitsu_Jisho=146]=`Fujitsu_Jisho`,e[e.Fujitsu_Masshou=147]=`Fujitsu_Masshou`,e[e.Fujitsu_Touroku=148]=`Fujitsu_Touroku`,e[e.Fujitsu_Loya=149]=`Fujitsu_Loya`,e[e.Fujitsu_Roya=150]=`Fujitsu_Roya`,e[e.LeftShift=160]=`LeftShift`,e[e.RightShift=161]=`RightShift`,e[e.LeftControl=162]=`LeftControl`,e[e.RightControl=163]=`RightControl`,e[e.LeftMenu=164]=`LeftMenu`,e[e.RightMenu=165]=`RightMenu`,e[e.BrowserBack=166]=`BrowserBack`,e[e.BrowserForward=167]=`BrowserForward`,e[e.BrowserRefresh=168]=`BrowserRefresh`,e[e.BrowserStop=169]=`BrowserStop`,e[e.BrowserSearch=170]=`BrowserSearch`,e[e.BrowserFavorites=171]=`BrowserFavorites`,e[e.BrowserHome=172]=`BrowserHome`,e[e.VolumeMute=173]=`VolumeMute`,e[e.VolumeDown=174]=`VolumeDown`,e[e.VolumeUp=175]=`VolumeUp`,e[e.MediaNextTrack=176]=`MediaNextTrack`,e[e.MediaPrevTrack=177]=`MediaPrevTrack`,e[e.MediaStop=178]=`MediaStop`,e[e.MediaPlayPause=179]=`MediaPlayPause`,e[e.LaunchMail=180]=`LaunchMail`,e[e.LaunchMediaSelect=181]=`LaunchMediaSelect`,e[e.LaunchApplication1=182]=`LaunchApplication1`,e[e.LaunchApplication2=183]=`LaunchApplication2`,e[e.OEM1=186]=`OEM1`,e[e.OEMPlus=187]=`OEMPlus`,e[e.OEMComma=188]=`OEMComma`,e[e.OEMMinus=189]=`OEMMinus`,e[e.OEMPeriod=190]=`OEMPeriod`,e[e.OEM2=191]=`OEM2`,e[e.OEM3=192]=`OEM3`,e[e.OEM4=219]=`OEM4`,e[e.OEM5=220]=`OEM5`,e[e.OEM6=221]=`OEM6`,e[e.OEM7=222]=`OEM7`,e[e.OEM8=223]=`OEM8`,e[e.OEMAX=225]=`OEMAX`,e[e.OEM102=226]=`OEM102`,e[e.ICOHelp=227]=`ICOHelp`,e[e.ICO00=228]=`ICO00`,e[e.ProcessKey=229]=`ProcessKey`,e[e.ICOClear=230]=`ICOClear`,e[e.Packet=231]=`Packet`,e[e.OEMReset=233]=`OEMReset`,e[e.OEMJump=234]=`OEMJump`,e[e.OEMPA1=235]=`OEMPA1`,e[e.OEMPA2=236]=`OEMPA2`,e[e.OEMPA3=237]=`OEMPA3`,e[e.OEMWSCtrl=238]=`OEMWSCtrl`,e[e.OEMCUSel=239]=`OEMCUSel`,e[e.OEMATTN=240]=`OEMATTN`,e[e.OEMFinish=241]=`OEMFinish`,e[e.OEMCopy=242]=`OEMCopy`,e[e.OEMAuto=243]=`OEMAuto`,e[e.OEMENLW=244]=`OEMENLW`,e[e.OEMBackTab=245]=`OEMBackTab`,e[e.ATTN=246]=`ATTN`,e[e.CRSel=247]=`CRSel`,e[e.EXSel=248]=`EXSel`,e[e.EREOF=249]=`EREOF`,e[e.Play=250]=`Play`,e[e.Zoom=251]=`Zoom`,e[e.Noname=252]=`Noname`,e[e.PA1=253]=`PA1`,e[e.OEMClear=254]=`OEMClear`,e}(q||{});const Jt=new Map([[q.LeftButton,`LeftButton`],[q.RightButton,`RightButton`],[q.Cancel,`Cancel`],[q.MiddleButton,`MiddleButton`],[q.ExtraButton1,`ExtraButton1`],[q.ExtraButton2,`ExtraButton2`],[q.Back,`Backspace`],[q.Tab,`Tab`],[q.Clear,`Clear`],[q.Return,`Enter`],[q.Shift,`ShiftLeft`],[q.Control,`ControlLeft`],[q.Menu,`AltLeft`],[q.Pause,`Pause`],[q.CapsLock,`CapsLock`],[q.Kana,`KanaMode`],[q.Junja,`JunjaMode`],[q.Final,`Finalize`],[q.Hanja,`HanjaMode`],[q.Escape,`Escape`],[q.Convert,`Convert`],[q.NonConvert,`NonConvert`],[q.Accept,`Accept`],[q.ModeChange,`ModeChange`],[q.Space,`Space`],[q.Prior,`PageUp`],[q.Next,`PageDown`],[q.End,`End`],[q.Home,`Home`],[q.Left,`ArrowLeft`],[q.Up,`ArrowUp`],[q.Right,`ArrowRight`],[q.Down,`ArrowDown`],[q.Select,`Select`],[q.Print,`PrintScreen`],[q.Execute,`Execute`],[q.Snapshot,`Snapshot`],[q.Insert,`Insert`],[q.Delete,`Delete`],[q.Help,`Help`],[q.N0,`Digit0`],[q.N1,`Digit1`],[q.N2,`Digit2`],[q.N3,`Digit3`],[q.N4,`Digit4`],[q.N5,`Digit5`],[q.N6,`Digit6`],[q.N7,`Digit7`],[q.N8,`Digit8`],[q.N9,`Digit9`],[q.A,`KeyA`],[q.B,`KeyB`],[q.C,`KeyC`],[q.D,`KeyD`],[q.E,`KeyE`],[q.F,`KeyF`],[q.G,`KeyG`],[q.H,`KeyH`],[q.I,`KeyI`],[q.J,`KeyJ`],[q.K,`KeyK`],[q.L,`KeyL`],[q.M,`KeyM`],[q.N,`KeyN`],[q.O,`KeyO`],[q.P,`KeyP`],[q.Q,`KeyQ`],[q.R,`KeyR`],[q.S,`KeyS`],[q.T,`KeyT`],[q.U,`KeyU`],[q.V,`KeyV`],[q.W,`KeyW`],[q.X,`KeyX`],[q.Y,`KeyY`],[q.Z,`KeyZ`],[q.LeftWindows,`MetaLeft`],[q.RightWindows,`MetaRight`],[q.Application,`ContextMenu`],[q.Sleep,`Sleep`],[q.Numpad0,`Numpad0`],[q.Numpad1,`Numpad1`],[q.Numpad2,`Numpad2`],[q.Numpad3,`Numpad3`],[q.Numpad4,`Numpad4`],[q.Numpad5,`Numpad5`],[q.Numpad6,`Numpad6`],[q.Numpad7,`Numpad7`],[q.Numpad8,`Numpad8`],[q.Numpad9,`Numpad9`],[q.Multiply,`NumpadMultiply`],[q.Add,`NumpadAdd`],[q.Separator,`NumpadSeparator`],[q.Subtract,`NumpadSubtract`],[q.Decimal,`NumpadDecimal`],[q.Divide,`NumpadDivide`],[q.F1,`F1`],[q.F2,`F2`],[q.F3,`F3`],[q.F4,`F4`],[q.F5,`F5`],[q.F6,`F6`],[q.F7,`F7`],[q.F8,`F8`],[q.F9,`F9`],[q.F10,`F10`],[q.F11,`F11`],[q.F12,`F12`],[q.F13,`F13`],[q.F14,`F14`],[q.F15,`F15`],[q.F16,`F16`],[q.F17,`F17`],[q.F18,`F18`],[q.F19,`F19`],[q.F20,`F20`],[q.F21,`F21`],[q.F22,`F22`],[q.F23,`F23`],[q.F24,`F24`],[q.NumLock,`NumLock`],[q.ScrollLock,`ScrollLock`],[q.NEC_Equal,`NEC_Equal`],[q.Fujitsu_Masshou,`Fujitsu_Masshou`],[q.Fujitsu_Touroku,`Fujitsu_Touroku`],[q.Fujitsu_Loya,`Fujitsu_Loya`],[q.Fujitsu_Roya,`Fujitsu_Roya`],[q.LeftShift,`ShiftLeft`],[q.RightShift,`ShiftRight`],[q.LeftControl,`ControlLeft`],[q.RightControl,`ControlRight`],[q.LeftMenu,`AltLeft`],[q.RightMenu,`AltRight`],[q.BrowserBack,`BrowserBack`],[q.BrowserForward,`BrowserForward`],[q.BrowserRefresh,`BrowserRefresh`],[q.BrowserStop,`BrowserStop`],[q.BrowserSearch,`BrowserSearch`],[q.BrowserFavorites,`BrowserFavorites`],[q.BrowserHome,`BrowserHome`],[q.VolumeMute,`VolumeMute`],[q.VolumeDown,`VolumeDown`],[q.VolumeUp,`VolumeUp`],[q.MediaNextTrack,`MediaTrackNext`],[q.MediaPrevTrack,`MediaTrackPrevious`],[q.MediaStop,`MediaStop`],[q.MediaPlayPause,`MediaPlayPause`],[q.LaunchMail,`LaunchMail`],[q.LaunchMediaSelect,`LaunchMediaSelect`],[q.LaunchApplication1,`LaunchApplication1`],[q.LaunchApplication2,`LaunchApplication2`],[q.OEM1,`OEM_1`],[q.OEMPlus,`Equal`],[q.OEMComma,`Comma`],[q.OEMMinus,`Minus`],[q.OEMPeriod,`Period`],[q.OEM2,`Slash`],[q.OEM3,`Backquote`],[q.OEM4,`BracketLeft`],[q.OEM5,`Backslash`],[q.OEM6,`BracketRight`],[q.OEM7,`Quote`],[q.OEM8,`IntlRo`],[q.OEMAX,`OEM_AX`],[q.OEM102,`IntlBackslash`],[q.ICOHelp,`ICO_HELP`],[q.ICO00,`ICO_00`],[q.ProcessKey,`Process`],[q.ICOClear,`ICO_CLEAR`],[q.Packet,`Packet`],[q.OEMReset,`OEM_Reset`],[q.OEMJump,`OEM_Jump`],[q.OEMPA1,`OEM_PA1`],[q.OEMPA2,`OEM_PA2`],[q.OEMPA3,`OEM_PA3`],[q.OEMWSCtrl,`OEM_WS_Ctrl`],[q.OEMCUSel,`OEM_CU_Sel`],[q.OEMATTN,`OEM_ATTN`],[q.OEMFinish,`OEM_Finish`],[q.OEMCopy,`OEM_Copy`],[q.OEMAuto,`OEM_Auto`],[q.OEMENLW,`OEM_ENLW`],[q.OEMBackTab,`BackTab`],[q.ATTN,`ATTN`],[q.CRSel,`CRSel`],[q.EXSel,`EXSel`],[q.EREOF,`EREOF`],[q.Play,`MediaPlay`],[q.Zoom,`Zoom`],[q.Noname,`Noname`],[q.PA1,`PA1`],[q.OEMClear,`OEM_Clear`]]),Yt=new Map(Jt.entries().map(([e,t])=>[t,e])),Xt=r({"[string]":{keys:`string[]`,mode:r(`'toggle' | 'hold'`).pipe(e=>e??`toggle`)}});var Zt=class extends N{preferencesKeybindToCallbacks=new Map;pressedKeys=new Set;activeKeybinds=new Set;triggeredToggleKeybinds=new Set;boundHandleKeyboardFocus=this.handleKeyboardFocus.bind(this);boundHandleKeyDown=this.handleKeyDown.bind(this);boundHandleKeyUp=this.handleKeyUp.bind(this);keybindsFile;keybindListeningPaused=!1;constructor(e){super(`KeybindManager`),this.keybindsFile=new k({path:Mt([`keybinds.json`]),schema:Xt,default:e})}init(){super.init();let e=U.getInstance().getInterface(`OGG_SIEGE`);e.instance.on(`keyboardFocus`,this.boundHandleKeyboardFocus),e.instance.on(`keyDown`,this.boundHandleKeyDown),e.instance.on(`keyUp`,this.boundHandleKeyUp)}async onKeybindToggled(e,t){let n=this.preferencesKeybindToCallbacks.get(e)??{toggle:[],down:[],up:[]};n.toggle.push(t),this.preferencesKeybindToCallbacks.set(e,n)}async onKeybindDown(e,t){let n=this.preferencesKeybindToCallbacks.get(e)??{toggle:[],down:[],up:[]};n.down.push(t),this.preferencesKeybindToCallbacks.set(e,n)}async onKeybindUp(e,t){let n=this.preferencesKeybindToCallbacks.get(e)??{toggle:[],down:[],up:[]};n.up.push(t),this.preferencesKeybindToCallbacks.set(e,n)}async updateKeybind(e,t){this.keybindsFile.set({[e]:t})}async updateKeybinds(e){let t=Object.fromEntries(Object.entries(e).filter(([e,t])=>t!==void 0));this.keybindsFile.set({...this.keybindsFile.get(),...t})}getConfig(){return this.keybindsFile.get()}destroy(){let e=U.getInstance().getInterface(`OGG_SIEGE`);e.instance.off(`keyboardFocus`,this.boundHandleKeyboardFocus),e.instance.off(`keyDown`,this.boundHandleKeyDown),e.instance.off(`keyUp`,this.boundHandleKeyUp),super.destroy()}handleKeyDown(e){if(this.keybindListeningPaused)return;let t=Jt.get(e.key);if(!t){this.logger.error(`Unknown key down`,e);return}this.pressedKeys.add(t),this.checkKeybindings()}handleKeyboardFocus(){this.pressedKeys.clear(),this.activeKeybinds.clear(),this.triggeredToggleKeybinds.clear()}async handleKeyUp(e){if(this.keybindListeningPaused)return;let t=Jt.get(e.key);if(!t)return;this.pressedKeys.delete(t);let n=this.keybindsFile.get();for(let[e]of this.preferencesKeybindToCallbacks.entries())n[e].keys.includes(t)&&this.triggeredToggleKeybinds.delete(e);this.checkKeybindUps()}async checkKeybindUps(){let e=this.keybindsFile.get();for(let[t,n]of this.preferencesKeybindToCallbacks.entries()){if(!n.up||n.up.length===0)continue;let r=e[t];if(this.activeKeybinds.has(t)&&r.keys.some(e=>!this.pressedKeys.has(e))){this.activeKeybinds.delete(t);for(let e of n.up)e();this.logger.log(`Keybind up triggered`,this.getKeybindToString(r))}}}async checkKeybindings(){let e=this.keybindsFile.get();for(let[t,n]of this.preferencesKeybindToCallbacks.entries()){let r=e[t];if(r.keys.length===this.pressedKeys.size&&r.keys.every(e=>Yt.has(e)?this.pressedKeys.has(e):!1)){this.triggerKeybind(r,n,t);return}}for(let[t,n]of this.preferencesKeybindToCallbacks.entries()){let r=e[t];r.keys.every(e=>Yt.has(e)?this.pressedKeys.has(e):(this.logger.error(`Unknown key`,e,r),!1))&&this.triggerKeybind(r,n,t)}}triggerKeybind(e,t,n){let r=e.mode;if(r===`toggle`&&t.toggle&&t.toggle.length>0&&!this.triggeredToggleKeybinds.has(n)){let r;for(let e of t.toggle){let t=e();typeof t==`string`&&r===void 0&&(r=t)}this.triggeredToggleKeybinds.add(n),this.logger.log(r?`Keybind pressed rejected: ${r}`:`Keybind pressed accepted`,this.getKeybindToString(e))}if(r===`hold`&&t.down&&t.down.length>0&&!this.activeKeybinds.has(n)){let r;for(let e of t.down){let t=e();if(typeof t==`string`){r=t;break}}r?this.logger.log(`Keybind down rejected: ${r}`,this.getKeybindToString(e)):(this.activeKeybinds.add(n),this.logger.log(`Keybind down accepted`,this.getKeybindToString(e)))}}getKeybindToString(e){return`(${e.keys.join(`+`)}${e.mode?` ${e.mode}`:``})`}};function Qt(e){let t=new Zt(e),n={};for(let r in e)n[r]={on:(e,n)=>{switch(e){case`down`:t.onKeybindDown(r,n);break;case`up`:t.onKeybindUp(r,n);break;case`toggle`:t.onKeybindToggled(r,n);break;default:throw Error(`Event type not implemented ${e}`,{cause:[e,n]})}}};let r={...n,getConfig:()=>t.getConfig(),pauseKeybindListening:()=>{t.keybindListeningPaused=!0},resumeKeybindListening:()=>{t.keybindListeningPaused=!1},updateKeybind:(e,n)=>{t.updateKeybind(e,n)},updateKeybinds:e=>{t.updateKeybinds(e)}};return t.init(),S.on(`quit`,()=>{t.destroy()}),r}function J(){return U.getInstance().getInterface(`OGG_SIEGE`)}function $t(){let e=G.getInstance(),t=O.getInstance(),n=W.getInstance();if(!S.isPackaged){j.getInstance().info(`Cortex is disabled in development`),n.enabled=!1;return}try{n.meta=en()}catch(e){j.getInstance().error(`Failed to setup cortex`,e);return}e.on([`gameReady`,`gameClose`],()=>{n.meta||=en(),n.meta.in_game=e.isInGame}),t.on(`fatal`,e=>{n.track(`fatal`,{message:e.message,code:e.code,data:JSON.stringify(e.data)})}),t.on(`error`,e=>{n.track(`error`,{code:e.code,message:e.message,data:JSON.stringify(e.data)})}),t.on(`warning`,e=>{n.track(`warning`,{message:e.message,code:e.code,data:JSON.stringify(e.data)})})}function en(){if(!global.OVERLAYED_META.release.id)throw Error(`Release ID is required`);return{app_id:global.OVERLAYED.APPLICATION_ID,user_id:L(),release_id:global.OVERLAYED_META.release.id,app_channel:global.OVERLAYED.APP_BUILD_CHANNEL,app_version:global.OVERLAYED.APP_VERSION,package_version:global.OVERLAYED.PACKAGE_VERSION,frontend_version:global.OVERLAYED.FRONTEND_VERSION,frontend_release_id:global.OVERLAYED.FRONTEND_RELEASE_ID,session_id:global.OVERLAYED.sessionId,in_game:!1}}const Y=D(class extends N{CHECK_INTERVAL=1e3*60*15;RETRY_INTERVAL=1e3*15;_updateCheckInterval=null;_latestCheckResponse=null;_activeCheckResponse=null;initialReleaseId=null;get manualUpdatesEnabled(){return this.options?.manualUpdates??!1}get activeReleaseId(){return this._activeCheckResponse?.release_id??this.initialReleaseId}constructor(){super(`SiteManager`)}init(e){super.init(e),e?.manualUpdates&&this.enableManualUpdates()}destroy(){super.destroy(),this._updateCheckInterval&&=(clearInterval(this._updateCheckInterval),null)}allowSiteUpdateOnNextLoad(){if(!this.options?.manualUpdates){this.logger.warn(`allowSiteUpdateOnNextLoad called but manual updates are disabled`);return}if(!this._latestCheckResponse){this.logger.warn(`allowSiteUpdateOnNextLoad called but no update has been checked yet`);return}if(this._activeCheckResponse?.release_id===this._latestCheckResponse.release_id){this.logger.warn(`allowSiteUpdateOnNextLoad called but theres no update available`);return}this._activeCheckResponse=this._latestCheckResponse,W.getInstance().track(`site_update_applied`,{version:this._latestCheckResponse.version,release_id:this._latestCheckResponse.release_id}),this.setFrontendCortexMeta(this._latestCheckResponse.release_id,this._latestCheckResponse.version)}setFrontendCortexMeta(e,t){let n=W.getInstance();n.meta||=en(),e&&(global.OVERLAYED.FRONTEND_RELEASE_ID=e,n.meta.frontend_release_id=e),t&&(global.OVERLAYED.FRONTEND_VERSION=t,n.meta.frontend_version=t),e&&t&&n.track(`frontend_version_changed`,{version:t,release_id:e})}enableManualUpdates(){this.logger.log(`Enabling manual site updates`),this.checkForUpdates(),this._updateCheckInterval=setInterval(()=>{this.checkForUpdates(!0)},this.CHECK_INTERVAL)}async checkForUpdates(e=!1){let t=global.OVERLAYED_META?.application?.siteUrl;if(!t){this.logger.log(`No siteUrl configured, skipping check`);return}W.getInstance().track(`site_check_for_update`,{});try{let n=new URL(`/check`,t).toString();this.logger.log(`Checking site URL`,n);let r={"Overlayed-User-Agent":at({package_version:global.OVERLAYED.PACKAGE_VERSION,application_id:global.OVERLAYED.APPLICATION_ID,application_version:global.OVERLAYED.APP_VERSION}),"Overlayed-Cortex-User-Id":global.OVERLAYED_RUNTIME.userId},i=R();i&&(r[`Overlayed-Access-Token`]=i);let a=global.OVERLAYED_META.release.channelId;a&&(r[`Overlayed-Channel-Id`]=a);let o=await fetch(n,{headers:r});if(!o.ok){this.logger.warn(`Site check failed with status`,o.status),W.getInstance().track(`site_check_error`,{status:o.status}),e&&this.scheduleRetry();return}let s=await o.json();if(this.logger.log(`Site check response`,s),!s.release_id){this.logger.error(`Site check response missing release_id`);return}if(!this._latestCheckResponse){this._latestCheckResponse=s;return}return this._latestCheckResponse.release_id===s.release_id?void 0:(this.logger.log(`New site version detected`,s),this._latestCheckResponse=s,W.getInstance().track(`site_update_ready`,{version:s.version,release_id:s.release_id}),this.emit(`siteUpdateReady`,{releaseId:s.release_id,version:s.version}),s)}catch(e){let t=e instanceof Error?e.message:String(e);W.getInstance().track(`site_check_error`,{message:t}),this.logger.error(`Site check failed`,{error:e,message:t}),this.scheduleRetry()}}scheduleRetry(){setTimeout(()=>{this.checkForUpdates()},this.RETRY_INTERVAL)}}),tn=D(Oe,`windows.log`);let nn;function rn(){return nn||(nn=class e extends global.OVERLAYED.electron.BrowserWindow{static session=void 0;constructor(t){let n=e.resolveCustomOptions(t);super(n)}static resolveCustomOptions(t){let n=global.OVERLAYED_META,r=global.OVERLAYED_RUNTIME;return{...t,webPreferences:{...t.webPreferences,session:e.getSession(),additionalArguments:[...t.webPreferences?.additionalArguments||[],...global.OVERLAYED.electron.app.isPackaged?[]:[`--overlayed-meta=${JSON.stringify(n)}`],`--overlayed-runtime=${JSON.stringify(r)}`]}}}static getSession(){if(!global.OVERLAYED_META?.application?.siteUrl)return;if(e.session)return e.session;e.session=global.OVERLAYED.electron.session.fromPartition(`persist:overlayed-${global.OVERLAYED.APPLICATION_ID}`);let t=Y.getInstance(),n=at({package_version:global.OVERLAYED.PACKAGE_VERSION,application_id:global.OVERLAYED.APPLICATION_ID,application_version:global.OVERLAYED.APP_VERSION}),r={urls:[global.OVERLAYED_META.application.siteUrl+`/*`]},i=global.OVERLAYED_RUNTIME.userId;return e.session.webRequest.onBeforeSendHeaders(r,(e,r)=>{let a=R();a&&(e.requestHeaders[`Overlayed-Access-Token`]=a);let o=global.OVERLAYED_META.release.channelId;o&&(e.requestHeaders[`Overlayed-Channel-Id`]=o),t.manualUpdatesEnabled&&t.activeReleaseId&&(e.requestHeaders[`Overlayed-Release-Id`]=t.activeReleaseId),e.requestHeaders[`Overlayed-Cortex-User-Id`]=i,e.requestHeaders[`Overlayed-User-Agent`]=n,r({requestHeaders:e.requestHeaders})}),t.manualUpdatesEnabled&&e.session.webRequest.onHeadersReceived(r,(e,n)=>{if(t.initialReleaseId){n(e);return}let r=e.responseHeaders?.[`Overlayed-Release-Id`]?.[0];r&&(t.initialReleaseId=F(r));let i=e.responseHeaders?.[`Overlayed-Release-Version`]?.[0];t.setFrontendCortexMeta(r,i),n(e)}),e.session}},nn)}function an(){function e(e,t){let n=tn.getInstance();return e.once(`closed`,()=>{e.isDestroyed()||W.getInstance().track(`window_closed`,{url:e.webContents.getURL(),in_game:t})}),e.on(`unresponsive`,()=>{e.isDestroyed()||W.getInstance().track(`window_unresponsive`,{url:e.webContents.getURL(),in_game:t})}),e.webContents.on(`console-message`,(t,r,i,a,o)=>{let s=e.isDestroyed()?`destroyed`:e.webContents.getURL();n[r===3?`error`:r===2?`warn`:`log`](`[${s}] [${o}:${a}] ${i}`)}),W.getInstance().track(`window_created`,{url:e.webContents.getURL(),in_game:t}),e}return{getProductionSiteUrl:()=>{let e=global.OVERLAYED_META.application.siteUrl;return URL.canParse(e)?new URL(e):new URL(`https://default.overlayedapps.com`)},createWindow:t=>e(new(rn())(t),!1),createInGameWindow:t=>{let n=rn();return e(J().instance.newWindowInternal(n,t),!0)},on:(e,t)=>J().instance.on(e,t),off:(e,t)=>J().instance.off(e,t),once:(e,t)=>J().instance.once(e,t),addListener:(e,t)=>J().instance.addListener(e,t),removeListener:(e,t)=>J().instance.removeListener(e,t),removeAllListeners:()=>J().instance.removeAllListeners(),prependListener:(e,t)=>J().instance.prependListener(e,t),prependOnceListener:(e,t)=>J().instance.prependOnceListener(e,t),getActiveGameInfo:()=>{let e=J(),t=He.getInstance();return{resolution:e.resolution,isConnected:t.hasConnection}}}}const on=D(class extends $e{renderInterface;globalCursorOverrideCount=new Set;globalMouseBlockCount=new Set;globalKeyboardBlockCount=new Set;keyInputBlocks={};constructor(e){super(`OverridesManager`),this.renderInterface=U.getInstance().getInterface(e)}scope(e){return{setGlobalCursorOverride:t=>this.setGlobalCursorOverride(e,t),setGlobalMouseBlock:t=>this.setGlobalMouseBlock(e,t),setGlobalKeyboardBlock:t=>this.setGlobalKeyboardBlock(e,t),setKeyInputBlock:(t,n)=>this.setKeyInputBlock(e,t,n)}}setGlobalCursorOverride(e,t){t?this.globalCursorOverrideCount.add(e):this.globalCursorOverrideCount.delete(e),t&&this.globalCursorOverrideCount.size===1?this.renderInterface.instance.setGlobalCursorOverride(!0):!t&&this.globalCursorOverrideCount.size===0&&this.renderInterface.instance.setGlobalCursorOverride(!1)}setGlobalMouseBlock(e,t){t?this.globalMouseBlockCount.add(e):this.globalMouseBlockCount.delete(e),t&&this.globalMouseBlockCount.size===1?this.renderInterface.instance.setGlobalMouseBlock(!0):!t&&this.globalMouseBlockCount.size===0&&this.renderInterface.instance.setGlobalMouseBlock(!1)}setGlobalKeyboardBlock(e,t){t?this.globalKeyboardBlockCount.add(e):this.globalKeyboardBlockCount.delete(e),t&&this.globalKeyboardBlockCount.size===1?this.renderInterface.instance.setGlobalKeyboardBlock(!0):!t&&this.globalKeyboardBlockCount.size===0&&this.renderInterface.instance.setGlobalKeyboardBlock(!1)}setKeyInputBlock(e,t,n){this.keyInputBlocks[t]||(this.keyInputBlocks[t]=new Set),n?this.keyInputBlocks[t].add(e):this.keyInputBlocks[t].delete(e),n&&this.keyInputBlocks[t].size===1?this.renderInterface.instance.setKeyInputBlock(t,!0):!n&&this.keyInputBlocks[t].size===0&&this.renderInterface.instance.setKeyInputBlock(t,!1)}},`OGG_SIEGE`);function sn(){return{scope:e=>on.getInstance().scope(e),raw:{setGlobalMouseBlock:e=>J().instance.setGlobalMouseBlock(e),setGlobalKeyboardBlock:e=>J().instance.setGlobalKeyboardBlock(e),setGlobalCursorOverride:e=>J().instance.setGlobalCursorOverride(e),setKeyInputBlock:(e,t)=>J().instance.setKeyInputBlock(e,t),getGlobalMouseBlock:()=>J().instance.getGlobalMouseBlock(),getGlobalKeyboardBlock:()=>J().instance.getGlobalKeyboardBlock(),getGlobalCursorOverride:()=>J().instance.getGlobalCursorOverride(),getKeyInputBlock:e=>J().instance.getKeyInputBlock(e)}}}function cn(){return{track:(e,t)=>{W.getInstance().track(`custom__${String(e)}`,t)}}}var ln=he(((e,t)=>{var n=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),r=n((e,t)=>{var n=new Set([`mouseDown`,`mouseUp`,`pointerDown`,`pointerUp`]),r=new WeakSet;function i(e,t,{allowHosts:i}={}){let{shell:a}=t;if(r.has(e))return;r.add(e);let o=e.webContents;function s(e){return!!(!c(e)||i?.includes(e.host))}function c(e){return new URL(o.getURL()).origin!==e.origin}let l=0;function u(){l=Date.now()}function d(){let e=Date.now()-l,t=e<150;return t||console.warn(`was not recently active`,e),t}if(process.platform===`win32`)for(let t of Object.values({KEYDOWN:256,LBUTTONUP:514,MBUTTONUP:520,RBUTTONUP:517,XBUTTONUP:524,TOUCH:576}))e.hookWindowMessage(t,u);o.on(`input-event`,(e,t)=>{n.has(t.type)&&u()}),o.on(`will-navigate`,(e,t)=>{let n=e.url||t;if(console.log(`will-navigate`,n),!n)return;let r=new URL(n);if(!s(r)){if(!d()){console.log(`blocked navigation`,n),e.preventDefault();return}c(r)&&(console.log(`external navigation`,n),e.preventDefault(),a.openExternal(n))}}),o.session.on(`will-download`,(e,t)=>{let n=t.getURL();/^blob:/.test(n)||e.preventDefault()}),o.setWindowOpenHandler(e=>{console.log(`window-open`,e.url);let{url:t}=e,n=new URL(t);if(!s(n))return d()?(c(n)&&a.openExternal(e.url),{action:`deny`}):(console.log(`blocked navigation`,t),{action:`deny`})})}t.exports=i}),i=n((e,t)=>{var n=new Set([`Mozilla`,`AppleWebKit`,`Chrome`,`Safari`,`Gecko`,`Firefox`,`OPR`,`Edg`,`Version`,`Mobile`,`curl`,`PostmanRuntime`]);async function r(e,t,r){let{webContents:i}=e,a=await i.executeJavaScript(`navigator.userAgent`);a=a.match(/[^\/]+\/[^\s]+( \([^\)]+\))?/g).map(e=>e.trim()).filter(e=>{let[t]=e.split(`/`,1);return n.has(t)}).join(` `),i.setUserAgent(a),t.app.userAgentFallback=a}t.exports=r}),a=r(),o=i();function s(e,t,n={}){a(e,t,n.linkHandler),o(e,t,n.userAgent)}t.exports={setupRevUtils:s,setupLinkHandler:a,setUserAgent:o}}))();function un(){return{registerWindow:e=>{(0,ln.setupRevUtils)(e,global.OVERLAYED.electron)}}}function dn(e){let{silent:t=!1,additionalFiles:n}=e??{},r=Ee(global.OVERLAYED.APPLICATION_ID),i=Ae(r,{recursive:!0}),a=we(),o=Ae(a,{recursive:!0});t||(j.getInstance().info(`Logs path: `,r),j.getInstance().info(`Overlayed logs path: `,a));let s=new le;return[...i,...o].forEach(([e,n])=>{t||j.getInstance().info(`Zipping: `,n);let r=re(n),i=_(n);s.file(i,r,{compression:`DEFLATE`})}),n&&Object.entries(n).forEach(([e,n])=>{t||j.getInstance().info(`Zipping extra file: `,e),s.file(e,n,{compression:`DEFLATE`})}),s}async function fn(e,t,n){let r=global.OVERLAYED_META.release.id?F(global.OVERLAYED_META.release.id):void 0,i=L();return ft(global.OVERLAYED.APPLICATION_ID,{file:Buffer.from(n,`base64`),data:{release_id:r,type:e,cortex_user_id:i,...t}}).then(n=>(pn({feedback_id:n.data.id,type:e,email:t.email,description:t.message}),j.getInstance().info(`Feedback submitted`,n),n.data.id)).catch(e=>{console.error(JSON.stringify(e,null,2)),j.getInstance().error(`Failed to submit feedback`,e)})}async function pn(e){try{let t=await fetch(`https://api.stats.cc/v2/overlay/contact`,{method:`POST`,body:JSON.stringify(e),redirect:`follow`,headers:{"Content-Type":`application/json`}});if(!t.ok){j.getInstance().error(`OLD - Failed to submit feedback`,await t.json());return}}catch(e){j.getInstance().error(`OLD - Failed to submit feedback`,e);return}}function mn(e){let t=new Oe(`app.log`);return t.init(global.OVERLAYED.APPLICATION_ID,e.debug),{scope:e=>t.scope(e),info:e=>t.info(e),warn:e=>t.warn(e),error:e=>t.error(e),debug:e=>t.debug(e),submitFeedback:async(e,t,n)=>{let r=global.OVERLAYED_META.release.id?F(global.OVERLAYED_META.release.id):void 0;return r&&S.isPackaged&&W.getInstance().track(e===`bug_report`?`bug_report_submitted`:`suggestion_submitted`,{release_id:r}),await fn(e,t,await dn(n).generateAsync({type:`base64`}))},getLogsZip:e=>dn(e)}}const hn=1e3;function gn(e,t,n,i,a){let o=He.getInstance(),s=j.getInstance().scope(`SetupPipeServer`);s.log(`Initializing`);function c(e,t){let r=n.get(t);if(!r)n.set(t,[e]);else{if(r.length>=hn){O.getInstance().warn(`Event buffer full, removing oldest event`,`EVENT_BUFFER_FULL`,{summary:`Event buffer overflow for module ${t}. Buffer size: ${r.length}, max: ${hn}`});return}r.push(e)}}function l(n){s.info(n);let i=Nt(n);if(i instanceof r.errors){W.getInstance().track(`invalid_game_event`,{}),O.getInstance().warn(`Invalid event`,`INVALID_EVENT`,{summary:i.summary});return}let o=Ze.includes(i.type),l=e.modules.find(e=>e.key===`universal`),u=o?l:e.modules.find(e=>e.key===i.game);if(!u){s.warn(`Invalid module`,{module:o?`universal`:i.game});return}let d=u.events.event,f=d(n);if(f instanceof r.errors){if(`type`in f.byPath)return;s.warn(`Invalid event`,{summary:f.summary}),W.getInstance().track(`invalid_game_event`,{game:i.game,type:i.type,summary:f.summary}),O.getInstance().warn(`Invalid event`,`INVALID_EVENT`,{summary:f.summary});return}if(!a[u.key]){c(f,u.key);return}if(f.type===`unsupported_game_version`){let{content:e}=f;W.getInstance().track(`unsupported_game_version`,{game:f.game,hash:e.process_hash,version:e.game_version})}let p=K(u.key,f.type),m=K(u.key,`*`),h=t.get(p),g=t.get(m),_=[...Array.from(h??[]),...Array.from(g??[])];if(_.length===0){s.info(`No handlers found for event`,{event:f});return}_.forEach(e=>{e(f)})}return i.on(`flushEvents`,e=>{if(a[e])return;a[e]=!0;let t=n.get(e);t&&(j.getInstance().info(`Flushing ${t.length} events for module ${e}`),t.forEach(e=>l(e)),n.delete(e))}),o.on(`data`,e=>e.forEach(l)),o.on(`error`,e=>{s.error(`Pipe server error`,e),O.getInstance().error(`Pipe server error`,`PIPE_SERVER_ERROR`,{error:e})}),o.on(`connected`,()=>{s.log(`Pipe server connected`)}),o.on(`disconnected`,()=>{s.log(`Pipe server disconnected`)}),o}function _n(){let e=Y.getInstance();return{on:(t,n)=>{e.on(t,n)},off:(t,n)=>{e.off(t,n)},allowSiteUpdateOnNextLoad:()=>{e.allowSiteUpdateOnNextLoad()}}}const vn=r({dismissedNotices:ge(r.string).array()}),yn=D(class extends N{NOTICE_FETCH_INTERVAL=1e3*60*5;MAX_DISMISSED_NOTICES=100;_noticeFetchInterval=null;_notices=[];_noticesFile;_boundOnGameReady=this.onGameReady.bind(this);get notices(){let e=this._noticesFile.get().dismissedNotices;return this._notices.filter(t=>!e.includes(t.id))}constructor(){super(`NoticeManager`),this._noticesFile=this.getNoticesFile(),this._noticesFile.load(),this.fetchNotices(),this.setupNoticeInterval(),G.getInstance().on(`gameReady`,this._boundOnGameReady)}destroy(){this._noticeFetchInterval&&=(clearInterval(this._noticeFetchInterval),null),G.getInstance().off(`gameReady`,this._boundOnGameReady),super.destroy()}dismissNotice(e){let t=this._notices.find(t=>t.id===e);if(!t||!t.dismissible)return;let n=this._noticesFile.get().dismissedNotices;n.unshift(e),this._noticesFile.set({dismissedNotices:n.slice(0,this.MAX_DISMISSED_NOTICES)}),this.emitNoticesUpdated()}onGameReady(){this.fetchNotices()}setupNoticeInterval(){this._noticeFetchInterval=setInterval(()=>{this.fetchNotices()},this.NOTICE_FETCH_INTERVAL)}getNoticesFile(){return new k({path:Mt([`notices.json`]),schema:vn,default:{dismissedNotices:[]}})}async fetchNotices(){let e=G.getInstance().getActiveGames();try{let{data:t}=await pt(global.OVERLAYED.APPLICATION_ID,{release_id:global.OVERLAYED_META.release.id?F(global.OVERLAYED_META.release.id):void 0,channel:global.OVERLAYED_META.release.channel,version:global.OVERLAYED_META.release.version,games:e});this._notices=t,this.emitNoticesUpdated()}catch(e){this.logger.error(`Failed to fetch notices`,e)}}emitNoticesUpdated(){this.emit(`noticesUpdated`,{notices:this.notices})}});function bn(){let e=yn.getInstance();return{on:(t,n)=>{e.on(t,n)},off:(t,n)=>{e.off(t,n)},dismissNotice:t=>{e.dismissNotice(t)},getNotices:()=>e.notices}}var xn=class extends me{logger=j.getInstance().scope(`OverlayedProvider`);constructor(e,t,n){super(n),this.options=e,this.updater=t}async getLatestVersion(){try{let e=await dt(this.options.application_id,{release_id:this.options.release_id,cortex_user_id:this.options.cortex_user_id,access_token:this.options.access_token,requested_channel:this.options.requested_channel});return this.logger.log(`checkApplicationRelease response`,e.data),W.getInstance().track(`update_release_check_success`,{version:e.data.release.version,channel:e.data.release.channel,fallback:!!e.data.fallback}),e.data.fallback&&this.logger.warn(`Update fallback detected, switching to default channel`),{path:``,sha512:e.data.download_hash??``,version:`${e.data.release.version}-${e.data.release.channel}`,releaseName:e.data.release.id,releaseDate:e.data.release.created_at,files:[{url:e.data.download_url,sha512:e.data.download_hash??``}]}}catch(e){let t=e instanceof Error?e.stack||e.message:String(e);throw W.getInstance().track(`update_release_check_error`,{message:t}),Error(`Unable to find the latest version (${this.options.release_id}), please ensure release exists. ${t}`)}}resolveFiles(e){return[{info:e.files[0],url:new URL(e.files[0].url)}]}};function Sn(e){return{provider:`custom`,updateProvider:xn,...e}}const X=D(class extends N{DEFAULT_CHANNEL=`public`;TOKEN_REFRESH_INTERVAL=1e3*60*15;accessTokenFetcher=void 0;_tokenRefreshInterval=null;_downloadStarted=!1;constructor(){super(`UpdateManager`)}init(){super.init(),this.registerListenerForwarders(),this.setupTokenRefreshInterval(),w.disableDifferentialDownload=!0}destroy(){w.removeAllListeners(),this._tokenRefreshInterval&&=(clearInterval(this._tokenRefreshInterval),null),super.destroy()}setupTokenRefreshInterval(){this._tokenRefreshInterval=setInterval(()=>{this.checkAndRefreshToken()},this.TOKEN_REFRESH_INTERVAL)}async checkAndRefreshToken(){let e=global.OVERLAYED_META.release.channel;e!==this.DEFAULT_CHANNEL&&(this.logger.log(`Refreshing access token for channel`,e),await this.setAndGetLatestAccessToken(e))}async checkForUpdates(e){this.logger.log(`Starting checkForUpdates`);let t=e??global.OVERLAYED_META.release.channel;return W.getInstance().track(`check_for_update`,{channel:t}),this._downloadStarted=!1,await this.setAndGetLatestAccessToken(t),e?(w.allowDowngrade=!0,w.channel=e,this.setFeedUrl({requestedChannel:e})):(w.allowDowngrade=!1,w.channel=global.OVERLAYED_META.release.channel,this.setFeedUrl({})),this.logger.log(`Checking for updates`),w.checkForUpdates()}async switchChannel(e){return this.logger.log(`Switching channel`,e),W.getInstance().track(`update_channel_switch`,{from_channel:global.OVERLAYED_META.release.channel,to_channel:e}),this._downloadStarted=!1,await this.setAndGetLatestAccessToken(e),w.allowDowngrade=!0,w.channel=e,this.setFeedUrl({requestedChannel:e}),w.checkForUpdates()}quitAndInstall(e,t){this.logger.log(`quitAndInstall`,{isSilent:e,isForceRunAfter:t});let[n,r]=this.canUpdate();if(!n)throw this.logger.warn(`Cannot update`,{denialReason:r}),W.getInstance().track(`update_install_blocked`,{reason:r}),Error(r);return this.logger.log(`Quitting and installing`),W.getInstance().track(`update_install`,{}),w.quitAndInstall(e,t)}canUpdate(){return G.getInstance().isInGame?[!1,`User is in game`]:[!0,null]}downloadUpdate(e){return w.downloadUpdate(e)}setAccessTokenFetcher(e){this.accessTokenFetcher=e}async setAndGetLatestAccessToken(e){if(this.logger.log(`Fetching new token`),!this.accessTokenFetcher)return this.logger.warn(`accessTokenFetcher is not set, private channels will not work.`),z(null),null;if(this.logger.log(`Setting and getting latest access token for channel`,e),e===this.DEFAULT_CHANNEL)return this.logger.log(`Default channel, skipping`),z(null),null;if(e!==global.OVERLAYED_META.release.channel)return this.forceFetchNewAccessToken(e);this.logger.log(`Access token exists, checking expiration`);let t=R();if(t){let e=this.getAccessTokenExpirationDate(t);if(!e)this.logger.log(`Invalid token, setting to null`),z(null);else if(e.getTime()>=Date.now()+300*1e3)return this.logger.log(`Token is not expired, using it.`),t}return this.forceFetchNewAccessToken(e)}async forceFetchNewAccessToken(e){this.accessTokenFetcher||this.logger.warn(`accessTokenFetcher is not set [2], private channels will not work.`);try{let t=await this.accessTokenFetcher?.(e)??null;this.logger.log(`New token fetched`,t?.slice(0,5)+`...`);let n=R();if(t==null||n===t){W.getInstance().track(`update_token_invalid`,{channel:e}),this.emit(`authTokenInvalid`,{}),z(null);return}return z(t),t}catch(e){let t=e instanceof Error?e.message:String(e);return W.getInstance().track(`update_token_fetch_error`,{message:t}),this.logger.error(`Error fetching new token`,{error:e,message:t}),z(null),null}}setFeedUrl(e){if(!global.OVERLAYED_META.release.id){this.logger.warn(`Tried to set feed URL in development mode`);return}w.setFeedURL(Sn({application_id:global.OVERLAYED.APPLICATION_ID,release_id:global.OVERLAYED_META.release.id,cortex_user_id:global.OVERLAYED_RUNTIME.userId,access_token:R(),requested_channel:e.requestedChannel}))}registerListenerForwarders(){w.on(`checking-for-update`,()=>{this.logger.info(`Checking for updates`),this.emit(`checkingForUpdates`,{})}),w.on(`download-progress`,e=>{this._downloadStarted||(this._downloadStarted=!0,W.getInstance().track(`update_download_started`,{version:w.currentVersion?.version??``})),this.emit(`downloadProgress`,{info:e});let t=`Download speed: ${e.bytesPerSecond} - Downloaded ${e.percent}%`;t+=` (${e.transferred}/${e.total})`,this.logger.log(t)}),w.on(`error`,(e,t)=>{this.logger.error(`Error`,e,t),W.getInstance().track(`update_download_error`,{message:t??e.message}),this.emit(`error`,{error:e,message:t})}),w.on(`update-not-available`,e=>{this.logger.info(`Update not available`,e),W.getInstance().track(`update_not_available`,{version:e.version}),this.emit(`updateNotAvailable`,{info:e})}),w.on(`update-available`,e=>{this.logger.info(`Update available`,e),W.getInstance().track(`update_available`,{version:e.version,channel:w.channel??``}),this.emit(`updateAvailable`,{info:e})}),w.on(`update-downloaded`,e=>{this.logger.info(`Update downloaded`,e),W.getInstance().track(`update_download_complete`,{version:e.version}),this.emit(`updateDownloaded`,{event:e})}),w.on(`update-cancelled`,e=>{this.logger.info(`Update cancelled`,e),W.getInstance().track(`update_cancelled`,{version:e.version}),this.emit(`updateCancelled`,{info:e})})}getAccessTokenExpirationDate(e){try{let t=e.split(`.`)[1];if(!t)return null;let n=atob(t.replace(/-/g,`+`).replace(/_/g,`/`)),r=JSON.parse(n);return r.exp?new Date(r.exp*1e3):null}catch{return null}}});function Cn(){let e=X.getInstance();return{site:_n(),on:(t,n)=>{e.on(t,n)},off:(t,n)=>{e.off(t,n)},setAccessTokenFetcher:t=>e.setAccessTokenFetcher(t),checkForUpdates:()=>e.checkForUpdates(),switchChannel:t=>e.checkForUpdates(t),quitAndInstall:(t,n)=>e.quitAndInstall(t,n),canUpdate:()=>e.canUpdate(),downloadUpdate:t=>e.downloadUpdate(t)}}function wn(){return{getChannel:()=>global.OVERLAYED_META.release.channel,getVersion:()=>global.OVERLAYED_META.release.version,getReleaseId:()=>global.OVERLAYED_META.release.id}}let Z=!1,Tn={},Q,En=new E,$;function Dn(e){kn(e);let t=On(e),{init:n=!0,debug:r=!1,silent:i=!0}=t;if(An(e),j.getInstance().init(e.applicationId,r,i),tn.getInstance().init(e.applicationId,r,!0),Nn(lt(e.applicationId),!1).catch(()=>{}),Z)return Q;function a(){if(Z){j.getInstance().warn(`Overlayed already initialized`);return}$t();let e=Gt.get({createIfMissing:!1})?.currentAccount;e&&nt(()=>e.apiKey);let n=new Map,r=new Map,i=Cn(),o=Kt(t.modules,n,En),s=qt(),c=Qt(t.keybinds),l=an(),u=sn(),d=un(),f=cn(),p=mn(t),m=bn(),h=wn();j.getInstance().log(`Overlayed initialized`),jn(t),gn(t,n,r,En,Tn),Z=!0,Q={...o,...s,ads:d,keybinds:c,windows:l,input:u,cortex:f,hasAnyActiveProcesses:()=>H.getInstance().hasAnyActiveProcesses,hasAnyActiveGames:()=>G.getInstance().isInGame,init:a,log:p,initialized:Z,notices:m,updater:i,application:h},Q.universal.on(`logged_in`,e=>{W.getInstance().track(`account_id`,{account_id:e.content.account_id,game:e.game})})}return n?(a(),Q):new Proxy({init:a},{get:(e,t)=>{if(t!==`init`&&!Z)throw Error(`overlayed was called before initialized: ${t}`);return t===`init`?e[t]:Q[t]}})}function On(e){return{...e,modules:[...e.modules,Qe()]}}global.OVERLAYED=new Proxy({},{get:()=>{throw Error(`function overlayed was not called`)}});function kn(e){if(!_e(e.applicationId))throw Error(`Invalid applicationId, must be a valid ULID.`)}function An(e){let t=Mn(),n=`1.0.0`,r=lt(e.applicationId);function i(){return{package_version:n,application_id:r,application_version:t?.release.version??`0.0.0`}}if(j.getInstance().log(`ua object`,i()),it(()=>i()),t===null){Nn(r,!0);return}global.OVERLAYED={APPLICATION_ID:r,APP_BUILD_CHANNEL:t.release.channel,APP_VERSION:t.release.version,PACKAGE_VERSION:n,FRONTEND_VERSION:`0.0.0`,sessionId:Ft(),electron:e.electron},global.OVERLAYED_META=t,global.OVERLAYED_RUNTIME={userId:L()},j.getInstance().log(`meta`,t)}function jn(e){j.getInstance().warn(`Bootstrapping`);let t=e.universal?[`*`]:e.modules.map(e=>e.key);G.getInstance().setSubscribedGames(t),j.getInstance().warn(`Initializing update manager`),X.getInstance().init(),j.getInstance().warn(`Initialized update manager`),Y.getInstance().init({manualUpdates:e.site?.manualUpdates??!1}),Ut.getInstance().init(),G.getInstance().init(),H.getInstance().init(),V.getInstance().init(),W.getInstance().track(`start`,{}),Wt.getInstance().check(e.applicationId);try{$&&clearInterval($),$=setInterval(()=>{try{It()}catch{}},3e4),$.unref()}catch(e){j.getInstance().log(`failed to start sessionLastUsed interval`,e)}async function n(){let e={};e.os=C.platform().trim(),e.os_version=process.getSystemVersion().trim(),e.architecture=C.arch().trim();let t=C.cpus();t.length>0?(e.cpu=t[0].model.trim(),e.cpu_cores=t.length,e.cpu_speed=t[0].speed):j.getInstance().warn(`Failed to collect CPU info`);let n=await pe.graphics();j.getInstance().info(`GPU info`,n);let r=n.controllers.sort((e,t)=>(t.vram??0)-(e.vram??0))[0];r?(e.gpu=r.model.trim(),e.gpu_memory=r.vram??0):j.getInstance().warn(`Failed to find primary GPU`),e.display_count=n.displays.length;let i=n.displays.find(e=>e.main)??n.displays[0];i?(e.primary_display_resolution_x=i.resolutionX??void 0,e.primary_display_resolution_y=i.resolutionY??void 0,e.primary_display_refresh_rate=i.currentRefreshRate??void 0):j.getInstance().warn(`Failed to find main display`),e.ram=process.getSystemMemoryInfo().total;let a=C.homedir(),o=await de.statfs(a);return o&&`blocks`in o&&`bsize`in o&&`bavail`in o?(e.disk=o.blocks*o.bsize,e.disk_free=o.bavail*o.bsize):j.getInstance().warn(`Failed to collect disk info`),j.getInstance().log(`Retrieved system information`,e),e}S.on(`ready`,()=>{n().then(e=>{W.getInstance().track(`system_info`,e)}).catch(e=>{j.getInstance().log(`Failed to retrieve system information`,e)})}),S.on(`quit`,()=>{W.getInstance().track(`electron_quit`,{}),Pn()}),process.on(`exit`,()=>{W.getInstance().track(`exit`,{}),Pn()})}function Mn(){if(S.isPackaged)try{let e=h.join(process.resourcesPath,`meta.json`);return JSON.parse(y.readFileSync(e,`utf-8`))}catch(e){throw Error(`Failed to read application metadata from resources/meta.json`,{cause:e})}else{let e=h.join(process.cwd(),`.overlayed`,`meta.json`);return y.existsSync(e)?JSON.parse(y.readFileSync(e,`utf-8`)):null}}async function Nn(e,t=!1){if(!S.isPackaged)try{j.getInstance().log(`Fetching application metadata from API...`);let n=Fe({...(await ut(e)).data,siteUrl:``});t&&(j.getInstance().log(v.yellowBright(`Uninitialized development environment detected. Created .overlayed folder. In the future, run ${v.bold(`overlayed init`)} to do so. \n\nThe process will now exit to load the cached metadata.\n\n${v.italic(`Note: This will never happen in a packaged application, and will only happen once in local development so long as the .overlayed folder exists.`)}`)),process.exit(0)),global.OVERLAYED_META=n}catch(e){j.getInstance().error(`Failed to fetch application meta`,e),t&&(console.error(`
1
+ import{createRequire as e}from"node:module";import{Type as t,scope as n,type as r}from"arktype";import i from"mitt";import a,{createWriteStream as o,existsSync as s,mkdirSync as c,readdirSync as l,unlinkSync as u,writeFileSync as d}from"fs";import{ensureFileSync as f}from"fs-extra";import p,{join as m}from"path";import*as h from"node:path";import g,{basename as _,resolve as ee}from"node:path";import v from"picocolors";import te from"events";import*as y from"node:fs";import{copyFileSync as ne,createReadStream as re,existsSync as b,mkdirSync as ie,readFileSync as ae,readdirSync as oe,writeFileSync as se}from"node:fs";import"glob";import"jiti";import ce from"xior";import x from"fs/promises";import le from"jszip";import{createHash as ue}from"node:crypto";import*as de from"node:fs/promises";import{BrowserWindow as fe,app as S}from"electron";import*as C from"node:os";import pe from"systeminformation";import{Provider as me,autoUpdater as w}from"electron-updater";import"electron-updater/out/providers/Provider";var he=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);function ge(e){return e}function T(e){return e?Array.isArray(e)?e:[e]:[]}function _e(e){return typeof e==`string`&&/^01[0-9A-HJKMNP-TV-Z]{24}$/.test(e)}var ve=class{data=[];constructor(){}get size(){return this.data.length}add(e){this.data.push(e)}next(){return this.data.shift()}clear(){this.data.length=0}*flush(){for(;this.size>0;){let e=this.next();e&&(yield e)}}},E=class{emitter;constructor(){this.emitter=i()}on(e,t){T(e).forEach(e=>{this.emitter.on(e,t)})}off(e,t){T(e).forEach(e=>{this.emitter.off(e,t)})}emit(e,t){T(e).forEach(e=>{this.emitter.emit(e,t)})}removeAllListeners(){this.emitter.all.clear()}},ye=class{listeners;constructor(){this.listeners=new Map}on(e,t){T(e).forEach(e=>{let n=this.listeners.get(e)||new Set;n.add(t),this.listeners.set(e,n)})}off(e,t){T(e).forEach(e=>{let n=this.listeners.get(e);n&&n.delete(t)})}async emit(e,...t){let n=T(e).flatMap(e=>{let t=this.listeners.get(e)||new Set,n=this.listeners.get(`*`)||new Set;return[...Array.from(t),...Array.from(n)]});return n.length===0?[]:await Promise.all(n.map(async n=>{try{let e=n(...t);return e instanceof Promise?await e:e}catch(t){console.error(`Error in event listener for ${String(e)}:`,t);return}}))}removeAllListeners(){this.listeners.clear()}};function D(e,...t){return class extends e{static _instance;static getInstance(){return this._instance||=new e(...t),this._instance}static clearInstance(){this._instance=void 0}}}const O=D(class extends E{destroy(){this.removeAllListeners()}fatal(e,t,n){this.emit(`fatal`,{code:t,message:e,data:n,timestamp:Date.now()})}error(e,t,n){this.emit(`error`,{code:t,message:e,data:n,timestamp:Date.now()})}warn(e,t,n){this.emit(`warning`,{code:t,message:e,data:n,timestamp:Date.now()})}});var k=class{data;_schema;_defaultValue;_path;constructor(e){let{schema:t,default:n,path:r}=e;this._schema=t,this._defaultValue=n,this._path=r}set(e){let t=this._schema[`~standard`].validate(e);if(t instanceof Promise)throw Error(`StructuredConfigFile does not support async validation`);if(t.issues){this.reportInvalidConfigFile(t.issues);return}this.data=this.onBeforeSave(e),this.save(e)}get(e={}){return this.data?this.data:this.load(e)}getKey(e,t={}){return this.get(t)[e]}save(e){let t=this.onBeforeSave(e);try{f(this.getFilePath()),a.writeFileSync(this.getFilePath(),JSON.stringify(t,void 0,2))}catch{return}return this.data=t}load(e={}){let{createIfMissing:t=!0}=e;if(!this.fileExists(this.getFilePath())||!this.canReadWriteFile(this.getFilePath())){t&&this.save(this._defaultValue);let e=this.onAfterLoad(this._defaultValue);return t&&(this.data=e),e}try{let e=a.readFileSync(this.getFilePath(),`utf8`),t=this.onAfterLoad(this.parseStoredData(e));return this.data=t,t}catch{return this.data=this._defaultValue}}onBeforeSave(e){return e}onAfterLoad(e){return e}getFilePath(){return this._path}parseStoredData(e){try{let t=r(`string.json.parse`).to(`object`)(e);if(t instanceof r.errors)return this._defaultValue;let n=this._schema[`~standard`].validate(t);if(n instanceof Promise)throw Error(`StructuredConfigFile does not support async validation`);return n.issues?this.migrate(t,this._defaultValue):this.migrate(n.value,this._defaultValue)}catch{return this._defaultValue}}canReadWriteFile(e){try{return a.accessSync(e,a.constants.R_OK|a.constants.W_OK),!0}catch{return!1}}fileExists(e){try{return a.accessSync(e,a.constants.F_OK),!0}catch{return!1}}migrate(e,t){let n={...e};for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(r in e?e[r]!==null&&t[r]!==null&&typeof e[r]==`object`&&typeof t[r]==`object`&&!Array.isArray(e[r])&&!Array.isArray(t[r])?n[r]=this.migrate(e[r],t[r]):Array.isArray(t[r])&&(n[r]=e[r]):n[r]=t[r]);return n}reportInvalidConfigFile(e){O.getInstance().error(`Invalid config file`,`INVALID_CONFIG_FILE`,{issues:e.map(e=>e.message),filePath:this._path,data:this.data})}};function be(e,t,n){return typeof e!=`object`||!e?String(e):e instanceof Error?JSON.stringify(e,(e,t)=>{if(t instanceof Error){let e={};for(let n of Object.getOwnPropertyNames(t))e[n]=t[n];return e}return t},n):e instanceof Map?JSON.stringify(Object.fromEntries(e.entries()),t,n):e instanceof Set?JSON.stringify(Array.from(e),t,n):JSON.stringify(e,t,n)}const xe=/\x1b\[[0-9;]*m/g;function Se(e){return e.replace(xe,``)}var Ce=class e extends E{stream;logPath;baseFileName;currentDate;rotationCheckInterval;isRotating=!1;constructor(e,t){super(),this.logPath=e,this.baseFileName=t.replace(`.log`,``),this.currentDate=this.getDateString(new Date),this.ensureLogDirectory(),this.ensureLogFile(),this.stream=this.createStream(),this.rotationCheckInterval=this.startRotationCheck(),this.cleanupOldLogs()}static scope(t,n){return new e(t,n)}log(...e){this.write(`info`,...e)}error(...e){this.write(`error`,...e)}warn(...e){this.write(`warn`,...e)}info(...e){this.write(`info`,...e)}debug(...e){this.write(`debug`,...e)}async close(){clearInterval(this.rotationCheckInterval),await new Promise(e=>{this.stream.end(()=>e())})}getCurrentFileName(){return this.getFileName(this.currentDate)}static getMessageElements(e,...t){let n=new Date;return{timestamp:n.toISOString().replace(`T`,` `).replace(/\.\d+Z$/,``)+`.${n.getUTCMilliseconds().toString().padStart(3,`0`)}`,level:e,message:t.map(e=>be(e)).join(` `)}}getFileName(e){return`${this.baseFileName}-${e}.log`}ensureLogDirectory(){try{c(this.logPath,{recursive:!0})}catch(e){throw console.error(`Failed to create log directory ${this.logPath}:`,e),e}}ensureLogFile(){let e=m(this.logPath,this.getFileName(this.currentDate));if(!s(e))try{d(e,``,`utf8`)}catch(t){throw console.error(`Failed to create log file ${e}:`,t),t}}getDateString(e){return`${e.getUTCFullYear()}-${(e.getUTCMonth()+1).toString().padStart(2,`0`)}-${e.getUTCDate().toString().padStart(2,`0`)}`}createStream(){return o(m(this.logPath,this.getFileName(this.currentDate)),{flags:`a`,encoding:`utf8`})}async rotateLogs(){if(this.isRotating)return;this.isRotating=!0;let e=this.getDateString(new Date);e!==this.currentDate&&await new Promise(t=>{this.stream.end(()=>{this.currentDate=e,this.stream=this.createStream(),this.cleanupOldLogs(),t()})}),this.isRotating=!1}startRotationCheck(){return setInterval(()=>this.rotateLogs(),6e4)}cleanupOldLogs(){let e=l(this.logPath),t=new Date,n=new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()-7));e.filter(e=>e.startsWith(this.baseFileName)&&e.endsWith(`.log`)).filter(e=>{let[t,r,i]=e.replace(`${this.baseFileName}-`,``).replace(`.log`,``).split(`-`).map(Number);return new Date(Date.UTC(t,r-1,i))<=n}).forEach(e=>{try{u(m(this.logPath,e))}catch(t){console.error(`Failed to delete old log file ${e}:`,t)}})}ensureStreamValid(){if(!this.stream.writable||this.stream.destroyed)try{this.stream=this.createStream()}catch(e){this.emit(`error`,e instanceof Error?e:Error(String(e)))}}write(t,...n){let{timestamp:r,message:i}=e.getMessageElements(t,...n),a=`[${r}] [${t}] ${Se(i)}\n`;this.ensureStreamValid(),this.stream.write(a,e=>{if(e)if(e.code===`ERR_STREAM_WRITE_AFTER_END`||!this.stream.writable)try{this.stream=this.createStream(),this.stream.write(a,e=>{e?this.emit(`error`,e):this.emit(`write`,a)})}catch(e){this.emit(`error`,e instanceof Error?e:Error(String(e)))}else this.emit(`error`,e);else this.emit(`write`,a)})}};const A=()=>g.join(process.env.APPDATA??``,`overlayed`),we=()=>g.join(A(),`logs`),Te=e=>g.join(A(),`apps`,e),Ee=e=>g.join(Te(e),`logs`),De=()=>g.join(A(),`meta.json`);var Oe=class{fileLogger;path;appId;messageQueue=new ve;fileName;_debug=!1;silent=!1;constructor(e){this.fileName=e}init(e,t=!1,n=!1){this.appId=e,this._debug=t,this.silent=n,this.path=Ee(e),this.fileLogger=new Ce(this.path,this.fileName),this.messageQueue.flush().forEach(e=>{this.fileLogger?.[e.type](...e.args)})}scope(e){if(!this.appId||!this.path)throw Error(`Logger not initialized`);let t=v.cyan(`[${e}]`);return{scope:e=>this.scope(e),error:(...e)=>this.error(t,...e),warn:(...e)=>this.warn(t,...e),info:(...e)=>this.info(t,...e),log:(...e)=>this.log(t,...e),debug:(...e)=>this.debug(t,...e)}}error(...e){this.handle(`error`,...e)}warn(...e){this.handle(`warn`,...e)}info(...e){this.handle(`log`,...e)}debug(...e){this._debug&&this.handle(`debug`,...e)}log(...e){this.handle(`log`,...e)}handle(e,...t){this.logToConsole(e,...t),this.fileLogger?this.fileLogger[e](...t):this.messageQueue.add({type:e,args:t})}logToConsole(e,...t){let n={error:v.red,warn:v.yellow,debug:v.blue,log:v.white};if(this.silent&&!this._debug)return;let{timestamp:r,message:i}=Ce.getMessageElements(e,...t),a=console[e],o=n[e];a(`${v.gray(r)} ${o(i)}`)}};const j=D(Oe,`overlayed.log`);var ke=class extends te{blob;chunkSizeMb;maxConcurrent;shouldStop=!1;constructor(e,t){super(),this.blob=e,this.chunkSizeMb=t.chunkSizeMb,this.maxConcurrent=t.maxConcurrent??3}get totalChunks(){return Math.ceil(this.blob.size/(this.chunkSizeMb*1024*1024))}async chunk(e){let t=this.chunkSizeMb*1024*1024,n=this.totalChunks;if(n===0)return;let r=new Map,i=new Set,a=new Set,o=[];for(let e=0;e<n;e++)o.push(e);let s=async n=>{let s=n*t,c=Math.min(s+t,this.blob.size),l=this.blob.slice(s,c);try{await e(l,n),a.add(n),this.emit(`chunkComplete`,n),i.delete(n)}catch(e){let t=r.get(n)||0;t<5?(r.set(n,t+1),await new Promise(e=>setTimeout(e,(t+1)*1e3)),o.push(n)):(a.add(n),this.emit(`error`,e),this.shouldStop=!0,i.delete(n))}},c=[],l=async()=>{for(;(o.length>0||i.size>0)&&!this.shouldStop;){if(o.length===0){await new Promise(e=>setTimeout(e,10));continue}let e=o.shift();a.has(e)||i.has(e)||(i.add(e),await s(e))}};for(let e=0;e<this.maxConcurrent;e++)c.push(l());await Promise.all(c)}};function Ae(e,t){let{recursive:n}=je(t);return b(e)?n?Me(e).map(t=>[e,t]):oe(e).map(t=>[e,t]):[]}function je(e){return{recursive:e?.recursive??!0}}function Me(e){return oe(e,{withFileTypes:!0}).flatMap(t=>{let n=g.join(e,t.name);return t.isDirectory()?Me(n):[n]})}function Ne(e){return Pe(e),e}function Pe(e){if(!_e(e.applicationId))throw Error(`Invalid applicationId, must be a valid ULID.`)}function Fe(e,t){let n=t?.cwd??process.cwd(),r=h.join(n,`.overlayed`);y.existsSync(r)||y.mkdirSync(r,{recursive:!0});let i={application:{id:e.id,name:e.name,slug:e.slug,siteUrl:e.siteUrl},release:{id:null,channel:`local`,version:`0.0.0`}},a=h.join(r,`meta.json`);return y.writeFileSync(a,JSON.stringify(i,null,2)),i}const{PipeEventServer:Ie,PipeEventClient:Le,PipeEventBase:Re,ProcessMonitor:ze,Process:Be,HardwareInterface:Ve}=e(import.meta.url)(`@overlayed/app/dist/native-interface/build/overlayed_native_interface_x64.node`),He=D(class extends E{server=null;_hasConnection=!1;pipeId;get hasConnection(){return this._hasConnection}constructor(e){super(),this.pipeId=e,this.init()}destroy(){this.server&&=(this._hasConnection=!1,this.server?.removeAllListeners(),null)}init(){this.server=new Ie(this.pipeId,{clientCount:1,access:1}),this.server.on(`event`,e=>{try{let t=JSON.parse(e);this.emit(`data`,[t])}catch(e){this.emit(`error`,e)}}),this.server.on(`connected`,()=>{this._hasConnection=!0,this.emit(`connected`,void 0)}),this.server.on(`disconnected`,()=>{this._hasConnection=!1,this.emit(`disconnected`,void 0)})}},`overlayed-event-server`),{RenderInterface:Ue,renderHookPath:We}=e(import.meta.url)(`@overlayed/app/dist/render-interface/build/overlayed_render_interface_x64.node`);let Ge=function(e){return e[e.LeftButton=1]=`LeftButton`,e[e.RightButton=2]=`RightButton`,e[e.Cancel=3]=`Cancel`,e[e.MiddleButton=4]=`MiddleButton`,e[e.ExtraButton1=5]=`ExtraButton1`,e[e.ExtraButton2=6]=`ExtraButton2`,e[e.Back=8]=`Back`,e[e.Tab=9]=`Tab`,e[e.Clear=12]=`Clear`,e[e.Return=13]=`Return`,e[e.Shift=16]=`Shift`,e[e.Control=17]=`Control`,e[e.Menu=18]=`Menu`,e[e.Pause=19]=`Pause`,e[e.CapsLock=20]=`CapsLock`,e[e.Kana=21]=`Kana`,e[e.Hangeul=21]=`Hangeul`,e[e.Hangul=21]=`Hangul`,e[e.Junja=23]=`Junja`,e[e.Final=24]=`Final`,e[e.Hanja=25]=`Hanja`,e[e.Kanji=25]=`Kanji`,e[e.Escape=27]=`Escape`,e[e.Convert=28]=`Convert`,e[e.NonConvert=29]=`NonConvert`,e[e.Accept=30]=`Accept`,e[e.ModeChange=31]=`ModeChange`,e[e.Space=32]=`Space`,e[e.Prior=33]=`Prior`,e[e.Next=34]=`Next`,e[e.End=35]=`End`,e[e.Home=36]=`Home`,e[e.Left=37]=`Left`,e[e.Up=38]=`Up`,e[e.Right=39]=`Right`,e[e.Down=40]=`Down`,e[e.Select=41]=`Select`,e[e.Print=42]=`Print`,e[e.Execute=43]=`Execute`,e[e.Snapshot=44]=`Snapshot`,e[e.Insert=45]=`Insert`,e[e.Delete=46]=`Delete`,e[e.Help=47]=`Help`,e[e.N0=48]=`N0`,e[e.N1=49]=`N1`,e[e.N2=50]=`N2`,e[e.N3=51]=`N3`,e[e.N4=52]=`N4`,e[e.N5=53]=`N5`,e[e.N6=54]=`N6`,e[e.N7=55]=`N7`,e[e.N8=56]=`N8`,e[e.N9=57]=`N9`,e[e.A=65]=`A`,e[e.B=66]=`B`,e[e.C=67]=`C`,e[e.D=68]=`D`,e[e.E=69]=`E`,e[e.F=70]=`F`,e[e.G=71]=`G`,e[e.H=72]=`H`,e[e.I=73]=`I`,e[e.J=74]=`J`,e[e.K=75]=`K`,e[e.L=76]=`L`,e[e.M=77]=`M`,e[e.N=78]=`N`,e[e.O=79]=`O`,e[e.P=80]=`P`,e[e.Q=81]=`Q`,e[e.R=82]=`R`,e[e.S=83]=`S`,e[e.T=84]=`T`,e[e.U=85]=`U`,e[e.V=86]=`V`,e[e.W=87]=`W`,e[e.X=88]=`X`,e[e.Y=89]=`Y`,e[e.Z=90]=`Z`,e[e.LeftWindows=91]=`LeftWindows`,e[e.RightWindows=92]=`RightWindows`,e[e.Application=93]=`Application`,e[e.Sleep=95]=`Sleep`,e[e.Numpad0=96]=`Numpad0`,e[e.Numpad1=97]=`Numpad1`,e[e.Numpad2=98]=`Numpad2`,e[e.Numpad3=99]=`Numpad3`,e[e.Numpad4=100]=`Numpad4`,e[e.Numpad5=101]=`Numpad5`,e[e.Numpad6=102]=`Numpad6`,e[e.Numpad7=103]=`Numpad7`,e[e.Numpad8=104]=`Numpad8`,e[e.Numpad9=105]=`Numpad9`,e[e.Multiply=106]=`Multiply`,e[e.Add=107]=`Add`,e[e.Separator=108]=`Separator`,e[e.Subtract=109]=`Subtract`,e[e.Decimal=110]=`Decimal`,e[e.Divide=111]=`Divide`,e[e.F1=112]=`F1`,e[e.F2=113]=`F2`,e[e.F3=114]=`F3`,e[e.F4=115]=`F4`,e[e.F5=116]=`F5`,e[e.F6=117]=`F6`,e[e.F7=118]=`F7`,e[e.F8=119]=`F8`,e[e.F9=120]=`F9`,e[e.F10=121]=`F10`,e[e.F11=122]=`F11`,e[e.F12=123]=`F12`,e[e.F13=124]=`F13`,e[e.F14=125]=`F14`,e[e.F15=126]=`F15`,e[e.F16=127]=`F16`,e[e.F17=128]=`F17`,e[e.F18=129]=`F18`,e[e.F19=130]=`F19`,e[e.F20=131]=`F20`,e[e.F21=132]=`F21`,e[e.F22=133]=`F22`,e[e.F23=134]=`F23`,e[e.F24=135]=`F24`,e[e.NumLock=144]=`NumLock`,e[e.ScrollLock=145]=`ScrollLock`,e[e.NEC_Equal=146]=`NEC_Equal`,e[e.Fujitsu_Jisho=146]=`Fujitsu_Jisho`,e[e.Fujitsu_Masshou=147]=`Fujitsu_Masshou`,e[e.Fujitsu_Touroku=148]=`Fujitsu_Touroku`,e[e.Fujitsu_Loya=149]=`Fujitsu_Loya`,e[e.Fujitsu_Roya=150]=`Fujitsu_Roya`,e[e.LeftShift=160]=`LeftShift`,e[e.RightShift=161]=`RightShift`,e[e.LeftControl=162]=`LeftControl`,e[e.RightControl=163]=`RightControl`,e[e.LeftMenu=164]=`LeftMenu`,e[e.RightMenu=165]=`RightMenu`,e[e.BrowserBack=166]=`BrowserBack`,e[e.BrowserForward=167]=`BrowserForward`,e[e.BrowserRefresh=168]=`BrowserRefresh`,e[e.BrowserStop=169]=`BrowserStop`,e[e.BrowserSearch=170]=`BrowserSearch`,e[e.BrowserFavorites=171]=`BrowserFavorites`,e[e.BrowserHome=172]=`BrowserHome`,e[e.VolumeMute=173]=`VolumeMute`,e[e.VolumeDown=174]=`VolumeDown`,e[e.VolumeUp=175]=`VolumeUp`,e[e.MediaNextTrack=176]=`MediaNextTrack`,e[e.MediaPrevTrack=177]=`MediaPrevTrack`,e[e.MediaStop=178]=`MediaStop`,e[e.MediaPlayPause=179]=`MediaPlayPause`,e[e.LaunchMail=180]=`LaunchMail`,e[e.LaunchMediaSelect=181]=`LaunchMediaSelect`,e[e.LaunchApplication1=182]=`LaunchApplication1`,e[e.LaunchApplication2=183]=`LaunchApplication2`,e[e.OEM1=186]=`OEM1`,e[e.OEMPlus=187]=`OEMPlus`,e[e.OEMComma=188]=`OEMComma`,e[e.OEMMinus=189]=`OEMMinus`,e[e.OEMPeriod=190]=`OEMPeriod`,e[e.OEM2=191]=`OEM2`,e[e.OEM3=192]=`OEM3`,e[e.OEM4=219]=`OEM4`,e[e.OEM5=220]=`OEM5`,e[e.OEM6=221]=`OEM6`,e[e.OEM7=222]=`OEM7`,e[e.OEM8=223]=`OEM8`,e[e.OEMAX=225]=`OEMAX`,e[e.OEM102=226]=`OEM102`,e[e.ICOHelp=227]=`ICOHelp`,e[e.ICO00=228]=`ICO00`,e[e.ProcessKey=229]=`ProcessKey`,e[e.ICOClear=230]=`ICOClear`,e[e.Packet=231]=`Packet`,e[e.OEMReset=233]=`OEMReset`,e[e.OEMJump=234]=`OEMJump`,e[e.OEMPA1=235]=`OEMPA1`,e[e.OEMPA2=236]=`OEMPA2`,e[e.OEMPA3=237]=`OEMPA3`,e[e.OEMWSCtrl=238]=`OEMWSCtrl`,e[e.OEMCUSel=239]=`OEMCUSel`,e[e.OEMATTN=240]=`OEMATTN`,e[e.OEMFinish=241]=`OEMFinish`,e[e.OEMCopy=242]=`OEMCopy`,e[e.OEMAuto=243]=`OEMAuto`,e[e.OEMENLW=244]=`OEMENLW`,e[e.OEMBackTab=245]=`OEMBackTab`,e[e.ATTN=246]=`ATTN`,e[e.CRSel=247]=`CRSel`,e[e.EXSel=248]=`EXSel`,e[e.EREOF=249]=`EREOF`,e[e.Play=250]=`Play`,e[e.Zoom=251]=`Zoom`,e[e.Noname=252]=`Noname`,e[e.PA1=253]=`PA1`,e[e.OEMClear=254]=`OEMClear`,e}({});const M=r({game:`string`,type:`string`,creation_time:`number`}).and({game:`'siege' | 'tft'`}),Ke=M.and({type:`'logged_in'`,content:{account_id:`string`}}),qe=M.and({type:`'module_loaded'`,content:{game_version:`string`,process_hash:`string`}}),Je=M.and({type:`'module_unloaded'`}),Ye=M.and({type:`'unsupported_game_version'`,content:{game_version:`string`,process_hash:`string`}}),Xe=n({"#event1":`logged_in | module_loaded | module_unloaded | unsupported_game_version`,event:`event1`,logged_in:Ke,module_loaded:qe,module_unloaded:Je,unsupported_game_version:Ye}).export(),Ze=Object.keys(Xe).filter(e=>e!==`event`);function Qe(){return{key:`universal`,events:Xe}}var $e=class{options=null;logger;initialized=!1;constructor(e){this.logger=j.getInstance().scope(e)}init(e){this.logger.log(`Initializing`),this.options=e||null,this.initialized=!0}destroy(){this.logger.log(`Destroying`),this.initialized=!1}},N=class extends E{options=null;logger;initialized=!1;constructor(e){super(),this.logger=j.getInstance().scope(e)}init(e){this.logger.log(`Initializing`),this.options=e||null,this.initialized=!0}destroy(){this.logger.log(`Destroying`),this.initialized=!1,this.removeAllListeners()}},et=class extends ye{options=null;logger;initialized=!1;constructor(e){super(),this.logger=j.getInstance().scope(e)}init(e){this.logger.log(`Initializing`),this.options=e||null,this.initialized=!0}destroy(){this.logger.log(`Destroying`),this.initialized=!1,this.removeAllListeners()}};const P=ce.create({baseURL:`https://api.overlayed.gg`,headers:{Accept:`application/json`,"Accept-Encoding":`gzip, deflate, br`}});let tt;function nt(e){tt=e}let rt;function it(e){rt=e}function at(e){return`overlayed/app (${Object.entries(e).map(([e,t])=>`${e}=${t}`).join(`, `)})`}P.interceptors.request.use(e=>{let t=tt?.();e.headers??={},t&&(e.headers[`X-Api-Key`]=t);let n=rt?.();return n&&(e.headers[`User-Agent`]=at(n)),e});function ot(e,t){if(t<=0)throw Error(`Chunk size must be greater than 0`);if(e.length===0)return[];let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}function st(e){return e}function ct(e){return e?t=>(e(t),t):st}const lt=ct();function ut(e){return P.get(`/v1/public/applications/${e}`)}function dt(e,t){return P.get(`/v1/public/applications/${e}/releases/check`,{params:t})}function ft(e,t){let n=new FormData;return n.append(`file`,new Blob([t.file],{type:`application/zip`}),`logs.zip`),n.append(`data`,JSON.stringify(t.data)),P.post(`/v1/public/applications/${e}/feedbacks`,n)}function pt(e,t){return P.get(`/v1/public/applications/${e}/notices`,{params:t})}const F=ct();function mt(e,t){return P.get(`/v1/public/modules/${e}/release`,{params:{cortex_user_id:t}})}function ht(e,t,n){return P.post(`/v1/public/modules/${e}/releases/${t}/download`,n)}async function gt(e,t){if(e.method!==`GET`)throw Error(`Unsupported presigned request method: ${e.method}`);let n=await fetch(e.url,{method:e.method,headers:e.headers,signal:t?.signal});if(!n.ok){let e=await _t(n);throw Error(`Presigned download failed (${n.status} ${n.statusText})${e?`: ${e}`:``}`)}let r=await n.arrayBuffer();return new Uint8Array(r)}async function _t(e){try{let t=(await e.text()).trim();if(t.length===0)return;let n=2048;return t.length>n?`${t.slice(0,n)}…`:t}catch{return}}function vt(){return P.get(`/v1/public/raven/config`)}function yt(e,t){return P.get(`/v1/public/raven/games/${e}/builds/${t}`)}function bt(e,t){return P.post(`/v1/public/raven/games/${e}/builds/upload`,null,{params:t})}function xt(e,t){let n=new FormData;return n.append(`file`,t.chunk),P.patch(`/v1/public/raven/games/${e}/builds/upload`,n,{params:t})}function St(e){let t=Date.now(),n=ot(e.messages.map(e=>Ct(t,e)),50),r=Promise.all(n.map(async t=>P.post(`/v1/public/cortex/events`,{...e,messages:t})));return r.catch(e=>{let t=e?.response?.data||e?.message||e;console.error(`Failed to submit cortex events`,t)}),r}function Ct(e,t){let n=e-t.created_at.getTime(),r=Math.max(0,Math.floor(n/1e3));return{properties:t.properties,type:t.type,seconds_offset:r}}function wt(e){return e instanceof Error&&(e.name===`XiorError`||e.name===`XiorTimeoutError`)}function Tt(e){return!!(e&&`kind`in e.data&&`message`in e.data)}const{PipeEventServer:Et,PipeEventClient:Dt,PipeEventBase:Ot,ProcessMonitor:kt,Process:At,HardwareInterface:jt}=e(import.meta.url)(`@overlayed/app/dist/native-interface/build/overlayed_native_interface_x64.node`);function Mt(e=[]){return g.normalize(g.join(Te(global.OVERLAYED.APPLICATION_ID),...e))}const Nt=r({game:`string`,type:`string`,creation_time:`number`}),I=new k({path:De(),schema:r({userId:`string | undefined`,sessionId:`string | undefined`,sessionLastUsed:`number | undefined`,accessToken:`string | undefined`,"debug?":{"ri_disabled?":`boolean`,"gm_disabled?":`boolean`}}),default:{userId:void 0,sessionId:void 0,sessionLastUsed:void 0,accessToken:void 0}});function Pt(){let{debug:e}=I.get();return e?{ri_disabled:e.ri_disabled??!1,gm_disabled:e.gm_disabled??!1}:{ri_disabled:!1,gm_disabled:!1}}function L(){let e=I.get().userId;if(e)return e;let t=Lt();return I.set({...I.get(),userId:t}),t}function Ft(){let e=I.get();if(e.sessionId&&typeof e.sessionLastUsed==`number`&&Date.now()-e.sessionLastUsed<=300*1e3)return e.sessionId;let t=crypto.randomUUID();return I.set({...e,sessionId:t,sessionLastUsed:Date.now()}),t}function It(){try{let e=I.get();I.set({...e,sessionLastUsed:Date.now()})}catch(e){j.getInstance().log(`Failed to update sessionLastUsed`,e)}}function R(){return I.get().accessToken}function z(e){try{let t=I.get();I.set({...t,accessToken:e??void 0})}catch(e){j.getInstance().log(`Failed to set accessToken`,e)}}function Lt(){try{return jt.generateUniqueIdentifier()}catch{return crypto.randomUUID()}}const B=D(class extends N{UPDATE_CHECK_INTERVAL_MS=1e3*60*5;targetDir;updateInterval;constructor(){super(`NativeModuleManager`),this.targetDir=g.join(A(),`resources`),this.logger.log(`Target directory`,this.targetDir)}async initWithDlls(e){super.init(),await x.mkdir(this.targetDir,{recursive:!0}),await this.checkForUpdates(e),clearInterval(this.updateInterval),this.updateInterval=setInterval(()=>this.checkForUpdates(e),this.UPDATE_CHECK_INTERVAL_MS)}destroy(){this.updateInterval&&=(clearInterval(this.updateInterval),void 0),super.destroy()}async getDllFile(e){let t=await this.getCurrentBuildInfo(e);if(!t){this.logger.error(`No build found for module`,{moduleId:e});return}let n=this.getBuildPath(e,t.buildId);if(!b(n)){this.logger.error(`No build file found for module`,{moduleId:e});return}let r=g.join(n,t.buildFileName);if(!b(r)){this.logger.error(`No DLL file found for module`,{moduleId:e});return}return r}async getCurrentBuildInfo(e){try{let t=g.join(this.targetDir,e,`build.json`),n=await x.readFile(t,`utf-8`);return JSON.parse(n)}catch{return null}}getModulePath(e){return g.join(this.targetDir,e)}getBuildPath(e,t){return g.join(this.getModulePath(e),t)}async checkForUpdates(e){this.logger.log(`Checking for updates`);let t=L();if(!t){this.logger.error(`Failed to resolve cortex user id`);return}this.logger.log(`Cortex User ID`,t);for(let n of e)try{let{data:e}=await mt(n,t);this.logger.log(`Release`,e);let r=(await this.getCurrentBuildInfo(n))?.buildId||null;this.logger.log(`${n} > Performing update check. current: ${r}, requested: ${e.build_id}`),e.build_id!==r||await this.isDownloadCorrupted(this.getBuildPath(n,e.build_id),e)?(this.logger.log(`${n} > Update found. current: ${r}, requested: ${e.build_id}`),this.logger.log(`${n} > Downloading and extracting DLLs`),await this.downloadAndExtractDll(n,e),this.logger.log(`${n} > Cleaning up other builds`),await this.cleanupExistingBuilds(n,e.build_id),this.emit(`dllUpdated`,{moduleId:n,buildId:e.build_id,releaseId:e.release_id})):this.logger.log(`${n} > No update found`)}catch(e){this.logger.error(`${n} > Error checking/updating`,e)}}async downloadAndExtractDll(e,t){this.logger.log(`${e} > Requesting download for build ${t.build_id}`);let n=L();if(!n){this.logger.error(`Failed to resolve cortex user id`);return}let{data:r}=await ht(e,t.release_id,{download_token:t.download_token,cortex_user_id:n});this.logger.log(`${e} > Downloading DLLs for build ${t.build_id}`);let i=await gt(r,{signal:AbortSignal.timeout(1e3*60*5)});this.logger.log(`${e} > Downloaded zip file for build ${t.build_id}`);let a=this.getBuildPath(e,t.build_id);await x.mkdir(a,{recursive:!0});let o=new le;await o.loadAsync(i);let s=Object.keys(o.files).map(e=>({name:e,file:o.files[e]})).filter(({file:e})=>!e.dir);if(s.length!==1){this.logger.error(`${e} > Zip must contain exactly 1 file, got ${s.length}`);return}let c=s[0],l=g.basename(c.name),u=g.normalize(l),d=g.isAbsolute(u),f=u.startsWith(`..`)||u.includes(`..${g.sep}`);if(l===``||l===`.`||l===`..`){this.logger.error(`${e} > Zip contained an invalid file name: ${c.name}`);return}if(!l.toLowerCase().endsWith(`.dll`)){this.logger.error(`${e} > Zip contained a non-dll file: ${c.name}`);return}if(d||f){this.logger.error(`${e} > Zip entry path is unsafe: ${c.name}`);return}let p=g.join(a,u),m=await c.file.async(`nodebuffer`);await x.writeFile(p,m),this.logger.log(`${e} > Extracted 1 file to ${p}`);let h={buildId:t.build_id,buildFileName:t.build_file_name},_=g.join(this.getModulePath(e),`build.json`);await x.writeFile(_,JSON.stringify(h),`utf-8`),this.logger.log(`${e} > Saved buildId to file: ${t.build_id}`)}async cleanupExistingBuilds(e,t){let n=this.getModulePath(e),r=this.getBuildPath(e,t),i=await x.readdir(n,{withFileTypes:!0});for(let t of i)t.isDirectory()&&g.join(n,t.name)!==r&&(await x.rm(g.join(n,t.name),{recursive:!0,force:!0}),this.logger.log(`${e} > Cleaned up build: ${t.name}`))}async hasPathAccess(e){try{return await x.access(e,x.constants.F_OK),!0}catch{return!1}}async isDownloadCorrupted(e,t){if(!await this.hasPathAccess(e))return this.logger.error(`Download is corrupted. Path does not exist: ${e}`),!0;let n=t.build_file_name,r=g.join(e,n);if(!b(r))return this.logger.error(`Download is corrupted. Build file not found: ${r}`),!0;if(t.build_hash){let e=await x.readFile(r),i=ue(`sha256`).update(e).digest(`hex`);if(i.toLowerCase()!==t.build_hash.toLowerCase())return this.logger.error(`Download is corrupted. Build file hash mismatch: ${n} ${i.toLowerCase()} !== ${t.build_hash.toLowerCase()}`),!0}return!1}}),V=D(class extends N{REFETCH_INTERVAL=1e3*60*5;FAILED_REFETCH_INTERVAL=1e3*30;_ravenConfig;_executableToGameMap=new Map;_executablesArray=[];_refetchIntervalHandler=null;_failedRefetchTimeoutHandler=null;constructor(){super(`RavenManager`)}init(){super.init(),this.fetchRavenConfig(),this._refetchIntervalHandler=setInterval(()=>{this._failedRefetchTimeoutHandler&&=(clearTimeout(this._failedRefetchTimeoutHandler),null),this.fetchRavenConfig()},this.REFETCH_INTERVAL)}getExecutableData(e){return this._executableToGameMap.get(e.toLowerCase())??null}get executables(){return this._executablesArray}get executablesMap(){return this._executableToGameMap}destroy(){this._refetchIntervalHandler&&clearInterval(this._refetchIntervalHandler),this._failedRefetchTimeoutHandler&&clearTimeout(this._failedRefetchTimeoutHandler),B.getInstance().destroy(),super.destroy()}async fetchRavenConfig(){try{this._ravenConfig={games:(await vt()).data.games},this.resetState();let e=new Set;for(let t of this._ravenConfig.games){for(let e of t.executables){let n=e.toLowerCase();this._executableToGameMap.set(n,t),this._executablesArray.push(n)}t.modules.forEach(t=>e.add(t))}await B.getInstance().initWithDlls(Array.from(e)),this.logger.log(`Raven updated, monitoring ${this._executableToGameMap.size} executables`),this.emit(`executablesUpdated`,{executables:this.executables,map:this._executableToGameMap})}catch(e){this.logger.error(`Failed to fetch Raven config`,e),this._failedRefetchTimeoutHandler=setTimeout(()=>this.fetchRavenConfig(),this.FAILED_REFETCH_INTERVAL)}}resetState(){this._executableToGameMap.clear(),this._executablesArray=[]}}),H=D(class extends N{_processMonitor;_processes=new Map;boundOnRavenManagerExecutablesUpdated=this.onRavenManagerExecutablesUpdated.bind(this);constructor(){super(`ProcessManager`),this._processMonitor=new kt}get hasAnyActiveProcesses(){return this.activeProcesses.length>0}get activeProcesses(){return Array.from(this._processes.values()).flat().filter(e=>!e.destroyedAt)}init(){super.init(),V.getInstance().on(`executablesUpdated`,this.boundOnRavenManagerExecutablesUpdated),this._processMonitor.on(`create`,e=>{this.logger.log(`Process created`,e),this.addProcess(e),this.logger.log(`Active Process Count: ${this._processes.size}`),this.emit(`create`,{process:e})}),this._processMonitor.on(`destroy`,e=>{this.logger.log(`Process destroyed`,e),this.deleteProcess(e),this.logger.log(`Active Process Count: ${this._processes.size}`),this.emit(`destroy`,{process:e})})}destroy(){V.getInstance().off(`executablesUpdated`,this.boundOnRavenManagerExecutablesUpdated),this._processes.clear(),this._processMonitor.removeAllListeners(),super.destroy()}isProcessRunning(e){return this._processes.get(e)?.some(e=>!e.destroyedAt)??!1}onRavenManagerExecutablesUpdated(e){this.logger.log(`Monitoring ${e.executables.length} processes`),e.executables.forEach(e=>{this._processMonitor.isProcessRegistered(e)||this._processMonitor.registerProcess(e)})}addProcess(e){if(!e.name)return;let t=this._processes.get(e.name);if(!t){this._processes.set(e.name,[e]);return}this._processes.set(e.name,t.concat(e))}deleteProcess(e){if(!e.name)return;let t=this._processes.get(e.name)?.filter(t=>t.id!==e.id)??[];t.length===0?this._processes.delete(e.name):this._processes.set(e.name,t)}});var Rt=class{_instance;_resolution;boundOnResolutionChanged=this.onResolutionChanged.bind(this);constructor(e){this._instance=e,this._resolution={width:0,height:0},this._instance.on(`resolution`,this.boundOnResolutionChanged)}destroy(){this._instance.off(`resolution`,this.boundOnResolutionChanged)}get instance(){return this._instance}get resolution(){return this._resolution}onResolutionChanged(e,t){this._resolution={width:e,height:t}}};const U=D(class{interfaces={};constructor(){}createInterface(e){return this.interfaces[e]||(this.interfaces[e]=new Rt(new Ue(e,{access:1}))),this.interfaces[e]}getInterface(e){return this.interfaces[e]?this.interfaces[e]:this.createInterface(e)}}),W=D(class{options;eventQueue;meta=null;enabled=!0;constructor(e){this.options=this.resolveOptions(e),this.eventQueue=new ve,this.setupFlushInterval()}track(e,t){this.enabled&&this.eventQueue.add({type:e,properties:t,created_at:new Date})}flush(){if(!this.enabled)return[];let e=Array.from(this.eventQueue.flush()).concat({type:`ping`,properties:{},created_at:new Date});if(!this.meta)throw Error(`Tried to flush Cortex events before meta was set`);try{St({...this.meta,messages:e})}catch{}return e}setupFlushInterval(){this.enabled&&setInterval(()=>{this.flush()},this.options.batchIntervalSeconds*1e3)}resolveOptions(e){return{batchIntervalSeconds:e?.batchIntervalSeconds??15}}}),zt=e(import.meta.url),Bt=zt.resolve(`@overlayed/app/dist/render-interface/build/overlayed_render_hook_x64.dll`),Vt=zt.resolve(`@overlayed/app/dist/render-interface/build/overlayed_render_hook_x86.dll`),Ht=zt.resolve(`@overlayed/app/dist/native-interface/build/overlayed_native_interface_x64.node`),G=D(class extends et{boundOnProcessCreate=this.onProcessCreate.bind(this);boundOnProcessDestroy=this.onProcessDestroy.bind(this);subscribedGames=new Set;_activeReadyRavenGames={};get isInGame(){return Object.keys(this._activeReadyRavenGames).length>0}constructor(){super(`GameLaunchManager`)}setSubscribedGames(e){this.subscribedGames=new Set(e)}getActiveGames(){return Object.keys(this._activeReadyRavenGames)}init(){super.init(),U.getInstance().createInterface(`OGG_SIEGE`),H.getInstance().on(`create`,this.boundOnProcessCreate),H.getInstance().on(`destroy`,this.boundOnProcessDestroy)}destroy(){H.getInstance().off(`create`,this.boundOnProcessCreate),H.getInstance().off(`destroy`,this.boundOnProcessDestroy),super.destroy()}on(e,t){super.on(e,t);let n=T(e);if(!(n.includes(`gameReady`)||n.includes(`*`))||Object.keys(this._activeReadyRavenGames).length===0)return;let r=t;for(let e of Object.values(this._activeReadyRavenGames))this.logger.log(`Late calling gameReady callback for game`,e.game),r(e)}async onProcessCreate({process:e}){let t=this.getRavenGame(e);if(!t)return;if(this.subscribedGames.size===0){this.logger.warn(`No subscribed games, skipping`);return}if(W.getInstance().track(`game_launch`,{game:t.identifier}),!this.subscribedGames.has(t.identifier)&&!this.subscribedGames.has(`*`))return;let n=new AbortController;if(await this.emit(`gameLaunch`,{game:t.identifier,reject:()=>n.abort()}),n.signal.aborted)return;let r=At.currentProcess;if(this.logger.log(`Game Launched`,t),this.logger.log(`Process is elevated: `,e.isElevated),this.logger.log(`Current process is elevated: `,r.isElevated),e.isElevated&&!r.isElevated){O.getInstance().fatal(`Game is elevated but the App is not`,`ELEVATION_MISMATCH`,{appElevated:!!r.isElevated,gameElevated:!!e.isElevated}),this.logger.log(`Game elevated but App is not`,{appElevated:r.isElevated,gameElevated:e.isElevated});return}let{ri_disabled:i,gm_disabled:a}=Pt(),o=!1;!i&&t.has_render_support&&t.allow_dll_injections?o=await this.injectRenderInterface(e):this.logger.log(`Skipping render interface injection`,{has_render_support:t.has_render_support,allow_dll_injections:t.allow_dll_injections,ri_disabled:i}),!a&&t.allow_dll_injections?await this.injectGameModules(t,e):this.logger.log(`Skipping game module(s) injection`,{allow_dll_injections:t.allow_dll_injections,gm_disabled:a});let s={game:t.identifier,inGameRenderingSupported:o};this._activeReadyRavenGames[t.identifier]=s,this.logger.debug(`Active ready raven games`,Object.keys(this._activeReadyRavenGames).join(`, `)),this.logger.log(`Game Ready`),this.emit(`gameReadyInternal`,{ravenGame:t,process:e}),this.emit(`gameReady`,s),W.getInstance().track(`game_ready`,{game:t.identifier})}copyDll(e){let t=g.basename(e),n=ee(e),r=g.join(A(),`resources`),i=g.join(r,t);this.logger.info(`Copying`,n,`to`,i);try{b(r)||ie(r,{recursive:!0}),se(i,ae(n)),ne(n,i)}catch(e){return e.code===`EBUSY`?i:(this.logger.error(`Failed to copy`,e),this.logger.error(`Failed to copy`,{originalPath:n,targetPath:i}),!1)}return i}async injectRenderInterface(e){this.logger.log(`Injecting render interface`,{is32Bit:e.is32Bit,process:e});let t=e.is32Bit?Vt:Bt;this.logger.log(`Render hook path`,t);let n=this.copyDll(t);if(!n)return this.logger.error(`Failed to copy render hook DLL`,{renderHookPath:t}),!1;let r=g.join(g.dirname(Ht));if(!b(r))return this.logger.error(`Failed to find injector path`,{injectorPath:r}),!1;this.logger.log(`Resolved injector path`,r);try{return this.logger.log(`Injecting render interface`,n),await e.injectDll(n,r),this.logger.log(`Render Interface Injection Successful`,n),!0}catch(e){return this.logger.error(`Render Interface Injection Failed`,e),this.logger.error(`Render Interface Injection Failed`,{renderHookPathCopied:n}),!1}}async injectGameModules(e,t){let n=g.join(g.dirname(Ht));if(!b(n)){this.logger.error(`Failed to find injector path`,{injectorPath:n});return}this.logger.log(`Resolved injector path`,n);for(let r of e.modules){let e=await B.getInstance().getDllFile(r);if(!e){this.logger.error(`No DLL file found for module`,{moduleId:r});continue}try{this.logger.log(`Injecting game module`,e),await t.injectDll(e,n),this.logger.log(`Injection Successful`,e)}catch(t){this.logger.error(`Injection Failed`,{dllFile:e},t)}}}onProcessDestroy({process:e}){let t=this.getRavenGame(e);t&&(delete this._activeReadyRavenGames[t.identifier],this.logger.debug(`Active ready raven games`,Object.keys(this._activeReadyRavenGames).join(`, `)),this.emit(`gameCloseInternal`,{ravenGame:t,process:e}),this.emit(`gameClose`,{game:t.identifier}),W.getInstance().track(`game_close`,{game:t.identifier}))}getRavenGame(e){if(!e.name)return;let t=V.getInstance().getExecutableData(e.name);if(!t){this.logger.error(`No raven game found for process`,{process:e});return}return t}}),Ut=D(class extends $e{boundOnGameLaunch=this.onGameLaunch.bind(this);constructor(){super(`GameBuildManager`)}init(){super.init(),G.getInstance().on(`gameReadyInternal`,this.boundOnGameLaunch)}destroy(){G.getInstance().off(`gameReadyInternal`,this.boundOnGameLaunch),super.destroy()}async onGameLaunch(...e){let[{ravenGame:t,process:n}]=e;if(!n.path||!n.name){this.logger.error(`Process path or name not found, could not check for build hash`,void 0,n);return}let r=ae(n.path),i=ue(`sha256`).update(r).digest(`hex`);this.logger.log(`Process Path`,n.path),this.logger.log(`Process Name`,n.name),this.logger.log(`Build Hash`,i);let a=!1;try{a=(await yt(t.identifier,i)).data.upload}catch(e){this.logger.error(`Error checking game build hash`,e);return}if(!a){this.logger.log(`Build hash already exists, skipping upload`);return}let o=new le;o.file(n.name,r);let s=await o.generateAsync({type:`blob`});try{this.logger.log(`Uploading build (size: `,s.size,` bytes)`);let e=new ke(s,{chunkSizeMb:25,maxConcurrent:1}),n=await bt(t.identifier,{build_hash:i,chunk_count:e.totalChunks,file_size_bytes:s.size});await e.chunk(async(e,r)=>{this.logger.log(`Uploading chunk`,r),await xt(t.identifier,{chunk:e,build_hash:i,chunk_index:r,upload_token:n.data.upload_token})}),this.logger.log(`Build uploaded successfully`)}catch(e){wt(e)?Tt(e.response)?this.logger.error(`Error uploading build hash, api error`,e):this.logger.error(`Error uploading build hash, request error`,e):this.logger.error(`Error uploading build hash, unknown error`,e)}}}),Wt=D(class extends $e{constructor(){super(`CampaignManager`)}async check(e){let t=g.join(Te(e),`campaign_code.txt`);try{let e=(await de.readFile(t,`utf-8`)).trim();e&&(this.logger.log(`UTM campaign code found`,e),W.getInstance().track(`utm_attribution`,{campaign_code:e}),W.getInstance().flush())}catch{}}}),Gt=new k({path:p.normalize(`${process.env.APPDATA||process.env.HOME||`.`}/.overlayed/config.json`),default:void 0,schema:n({Account:r({email:`string`,apiKey:`string`})}).type({currentAccount:`Account | undefined`,accounts:`Account[]`}).or(`undefined`)});function K(e,t){return`${e}:${t}`}function Kt(e,t,n){return e.reduce((e,r)=>{let i=r.key;return e[i]={on(e,n){let r=K(i,e),a=t.get(r)??new Set;a.add(n),t.set(r,a)},onAny(e){let n=K(i,`*`),r=t.get(n)??new Set;r.add(e),t.set(n,r)},off(e,n){let r=K(i,e),a=t.get(r);a&&(a.delete(n),a.size===0&&t.delete(r))},offAny(e){let n=K(i,`*`),r=t.get(n);r&&(r.delete(e),r.size===0&&t.delete(n))},readyForGameEvents:()=>{n.emit(`flushEvents`,i)}},e},{})}function qt(){let e=O.getInstance(),t=G.getInstance();return{on:(n,r)=>{switch(n){case`fatal`:e.on(`fatal`,r);break;case`error`:e.on(`error`,r);break;case`warning`:e.on(`warning`,r);break;case`gameLaunch`:t.on(`gameLaunch`,r);break;case`gameClose`:t.on(`gameClose`,r);break;case`gameReady`:t.on(`gameReady`,r);break;default:throw Error(`Event type not implemented ${n}`,{cause:[n,r]})}},off:(n,r)=>{switch(n){case`fatal`:e.off(`fatal`,r);break;case`error`:e.off(`error`,r);break;case`warning`:e.off(`warning`,r);break;case`gameLaunch`:t.off(`gameLaunch`,r);break;case`gameClose`:t.off(`gameClose`,r);break;case`gameReady`:t.off(`gameReady`,r);break;default:throw Error(`Event type not implemented ${n}`,{cause:[n,r]})}}}}var q=function(e){return e[e.LeftButton=1]=`LeftButton`,e[e.RightButton=2]=`RightButton`,e[e.Cancel=3]=`Cancel`,e[e.MiddleButton=4]=`MiddleButton`,e[e.ExtraButton1=5]=`ExtraButton1`,e[e.ExtraButton2=6]=`ExtraButton2`,e[e.Back=8]=`Back`,e[e.Tab=9]=`Tab`,e[e.Clear=12]=`Clear`,e[e.Return=13]=`Return`,e[e.Shift=16]=`Shift`,e[e.Control=17]=`Control`,e[e.Menu=18]=`Menu`,e[e.Pause=19]=`Pause`,e[e.CapsLock=20]=`CapsLock`,e[e.Kana=21]=`Kana`,e[e.Hangeul=21]=`Hangeul`,e[e.Hangul=21]=`Hangul`,e[e.Junja=23]=`Junja`,e[e.Final=24]=`Final`,e[e.Hanja=25]=`Hanja`,e[e.Kanji=25]=`Kanji`,e[e.Escape=27]=`Escape`,e[e.Convert=28]=`Convert`,e[e.NonConvert=29]=`NonConvert`,e[e.Accept=30]=`Accept`,e[e.ModeChange=31]=`ModeChange`,e[e.Space=32]=`Space`,e[e.Prior=33]=`Prior`,e[e.Next=34]=`Next`,e[e.End=35]=`End`,e[e.Home=36]=`Home`,e[e.Left=37]=`Left`,e[e.Up=38]=`Up`,e[e.Right=39]=`Right`,e[e.Down=40]=`Down`,e[e.Select=41]=`Select`,e[e.Print=42]=`Print`,e[e.Execute=43]=`Execute`,e[e.Snapshot=44]=`Snapshot`,e[e.Insert=45]=`Insert`,e[e.Delete=46]=`Delete`,e[e.Help=47]=`Help`,e[e.N0=48]=`N0`,e[e.N1=49]=`N1`,e[e.N2=50]=`N2`,e[e.N3=51]=`N3`,e[e.N4=52]=`N4`,e[e.N5=53]=`N5`,e[e.N6=54]=`N6`,e[e.N7=55]=`N7`,e[e.N8=56]=`N8`,e[e.N9=57]=`N9`,e[e.A=65]=`A`,e[e.B=66]=`B`,e[e.C=67]=`C`,e[e.D=68]=`D`,e[e.E=69]=`E`,e[e.F=70]=`F`,e[e.G=71]=`G`,e[e.H=72]=`H`,e[e.I=73]=`I`,e[e.J=74]=`J`,e[e.K=75]=`K`,e[e.L=76]=`L`,e[e.M=77]=`M`,e[e.N=78]=`N`,e[e.O=79]=`O`,e[e.P=80]=`P`,e[e.Q=81]=`Q`,e[e.R=82]=`R`,e[e.S=83]=`S`,e[e.T=84]=`T`,e[e.U=85]=`U`,e[e.V=86]=`V`,e[e.W=87]=`W`,e[e.X=88]=`X`,e[e.Y=89]=`Y`,e[e.Z=90]=`Z`,e[e.LeftWindows=91]=`LeftWindows`,e[e.RightWindows=92]=`RightWindows`,e[e.Application=93]=`Application`,e[e.Sleep=95]=`Sleep`,e[e.Numpad0=96]=`Numpad0`,e[e.Numpad1=97]=`Numpad1`,e[e.Numpad2=98]=`Numpad2`,e[e.Numpad3=99]=`Numpad3`,e[e.Numpad4=100]=`Numpad4`,e[e.Numpad5=101]=`Numpad5`,e[e.Numpad6=102]=`Numpad6`,e[e.Numpad7=103]=`Numpad7`,e[e.Numpad8=104]=`Numpad8`,e[e.Numpad9=105]=`Numpad9`,e[e.Multiply=106]=`Multiply`,e[e.Add=107]=`Add`,e[e.Separator=108]=`Separator`,e[e.Subtract=109]=`Subtract`,e[e.Decimal=110]=`Decimal`,e[e.Divide=111]=`Divide`,e[e.F1=112]=`F1`,e[e.F2=113]=`F2`,e[e.F3=114]=`F3`,e[e.F4=115]=`F4`,e[e.F5=116]=`F5`,e[e.F6=117]=`F6`,e[e.F7=118]=`F7`,e[e.F8=119]=`F8`,e[e.F9=120]=`F9`,e[e.F10=121]=`F10`,e[e.F11=122]=`F11`,e[e.F12=123]=`F12`,e[e.F13=124]=`F13`,e[e.F14=125]=`F14`,e[e.F15=126]=`F15`,e[e.F16=127]=`F16`,e[e.F17=128]=`F17`,e[e.F18=129]=`F18`,e[e.F19=130]=`F19`,e[e.F20=131]=`F20`,e[e.F21=132]=`F21`,e[e.F22=133]=`F22`,e[e.F23=134]=`F23`,e[e.F24=135]=`F24`,e[e.NumLock=144]=`NumLock`,e[e.ScrollLock=145]=`ScrollLock`,e[e.NEC_Equal=146]=`NEC_Equal`,e[e.Fujitsu_Jisho=146]=`Fujitsu_Jisho`,e[e.Fujitsu_Masshou=147]=`Fujitsu_Masshou`,e[e.Fujitsu_Touroku=148]=`Fujitsu_Touroku`,e[e.Fujitsu_Loya=149]=`Fujitsu_Loya`,e[e.Fujitsu_Roya=150]=`Fujitsu_Roya`,e[e.LeftShift=160]=`LeftShift`,e[e.RightShift=161]=`RightShift`,e[e.LeftControl=162]=`LeftControl`,e[e.RightControl=163]=`RightControl`,e[e.LeftMenu=164]=`LeftMenu`,e[e.RightMenu=165]=`RightMenu`,e[e.BrowserBack=166]=`BrowserBack`,e[e.BrowserForward=167]=`BrowserForward`,e[e.BrowserRefresh=168]=`BrowserRefresh`,e[e.BrowserStop=169]=`BrowserStop`,e[e.BrowserSearch=170]=`BrowserSearch`,e[e.BrowserFavorites=171]=`BrowserFavorites`,e[e.BrowserHome=172]=`BrowserHome`,e[e.VolumeMute=173]=`VolumeMute`,e[e.VolumeDown=174]=`VolumeDown`,e[e.VolumeUp=175]=`VolumeUp`,e[e.MediaNextTrack=176]=`MediaNextTrack`,e[e.MediaPrevTrack=177]=`MediaPrevTrack`,e[e.MediaStop=178]=`MediaStop`,e[e.MediaPlayPause=179]=`MediaPlayPause`,e[e.LaunchMail=180]=`LaunchMail`,e[e.LaunchMediaSelect=181]=`LaunchMediaSelect`,e[e.LaunchApplication1=182]=`LaunchApplication1`,e[e.LaunchApplication2=183]=`LaunchApplication2`,e[e.OEM1=186]=`OEM1`,e[e.OEMPlus=187]=`OEMPlus`,e[e.OEMComma=188]=`OEMComma`,e[e.OEMMinus=189]=`OEMMinus`,e[e.OEMPeriod=190]=`OEMPeriod`,e[e.OEM2=191]=`OEM2`,e[e.OEM3=192]=`OEM3`,e[e.OEM4=219]=`OEM4`,e[e.OEM5=220]=`OEM5`,e[e.OEM6=221]=`OEM6`,e[e.OEM7=222]=`OEM7`,e[e.OEM8=223]=`OEM8`,e[e.OEMAX=225]=`OEMAX`,e[e.OEM102=226]=`OEM102`,e[e.ICOHelp=227]=`ICOHelp`,e[e.ICO00=228]=`ICO00`,e[e.ProcessKey=229]=`ProcessKey`,e[e.ICOClear=230]=`ICOClear`,e[e.Packet=231]=`Packet`,e[e.OEMReset=233]=`OEMReset`,e[e.OEMJump=234]=`OEMJump`,e[e.OEMPA1=235]=`OEMPA1`,e[e.OEMPA2=236]=`OEMPA2`,e[e.OEMPA3=237]=`OEMPA3`,e[e.OEMWSCtrl=238]=`OEMWSCtrl`,e[e.OEMCUSel=239]=`OEMCUSel`,e[e.OEMATTN=240]=`OEMATTN`,e[e.OEMFinish=241]=`OEMFinish`,e[e.OEMCopy=242]=`OEMCopy`,e[e.OEMAuto=243]=`OEMAuto`,e[e.OEMENLW=244]=`OEMENLW`,e[e.OEMBackTab=245]=`OEMBackTab`,e[e.ATTN=246]=`ATTN`,e[e.CRSel=247]=`CRSel`,e[e.EXSel=248]=`EXSel`,e[e.EREOF=249]=`EREOF`,e[e.Play=250]=`Play`,e[e.Zoom=251]=`Zoom`,e[e.Noname=252]=`Noname`,e[e.PA1=253]=`PA1`,e[e.OEMClear=254]=`OEMClear`,e}(q||{});const Jt=new Map([[q.LeftButton,`LeftButton`],[q.RightButton,`RightButton`],[q.Cancel,`Cancel`],[q.MiddleButton,`MiddleButton`],[q.ExtraButton1,`ExtraButton1`],[q.ExtraButton2,`ExtraButton2`],[q.Back,`Backspace`],[q.Tab,`Tab`],[q.Clear,`Clear`],[q.Return,`Enter`],[q.Shift,`ShiftLeft`],[q.Control,`ControlLeft`],[q.Menu,`AltLeft`],[q.Pause,`Pause`],[q.CapsLock,`CapsLock`],[q.Kana,`KanaMode`],[q.Junja,`JunjaMode`],[q.Final,`Finalize`],[q.Hanja,`HanjaMode`],[q.Escape,`Escape`],[q.Convert,`Convert`],[q.NonConvert,`NonConvert`],[q.Accept,`Accept`],[q.ModeChange,`ModeChange`],[q.Space,`Space`],[q.Prior,`PageUp`],[q.Next,`PageDown`],[q.End,`End`],[q.Home,`Home`],[q.Left,`ArrowLeft`],[q.Up,`ArrowUp`],[q.Right,`ArrowRight`],[q.Down,`ArrowDown`],[q.Select,`Select`],[q.Print,`PrintScreen`],[q.Execute,`Execute`],[q.Snapshot,`Snapshot`],[q.Insert,`Insert`],[q.Delete,`Delete`],[q.Help,`Help`],[q.N0,`Digit0`],[q.N1,`Digit1`],[q.N2,`Digit2`],[q.N3,`Digit3`],[q.N4,`Digit4`],[q.N5,`Digit5`],[q.N6,`Digit6`],[q.N7,`Digit7`],[q.N8,`Digit8`],[q.N9,`Digit9`],[q.A,`KeyA`],[q.B,`KeyB`],[q.C,`KeyC`],[q.D,`KeyD`],[q.E,`KeyE`],[q.F,`KeyF`],[q.G,`KeyG`],[q.H,`KeyH`],[q.I,`KeyI`],[q.J,`KeyJ`],[q.K,`KeyK`],[q.L,`KeyL`],[q.M,`KeyM`],[q.N,`KeyN`],[q.O,`KeyO`],[q.P,`KeyP`],[q.Q,`KeyQ`],[q.R,`KeyR`],[q.S,`KeyS`],[q.T,`KeyT`],[q.U,`KeyU`],[q.V,`KeyV`],[q.W,`KeyW`],[q.X,`KeyX`],[q.Y,`KeyY`],[q.Z,`KeyZ`],[q.LeftWindows,`MetaLeft`],[q.RightWindows,`MetaRight`],[q.Application,`ContextMenu`],[q.Sleep,`Sleep`],[q.Numpad0,`Numpad0`],[q.Numpad1,`Numpad1`],[q.Numpad2,`Numpad2`],[q.Numpad3,`Numpad3`],[q.Numpad4,`Numpad4`],[q.Numpad5,`Numpad5`],[q.Numpad6,`Numpad6`],[q.Numpad7,`Numpad7`],[q.Numpad8,`Numpad8`],[q.Numpad9,`Numpad9`],[q.Multiply,`NumpadMultiply`],[q.Add,`NumpadAdd`],[q.Separator,`NumpadSeparator`],[q.Subtract,`NumpadSubtract`],[q.Decimal,`NumpadDecimal`],[q.Divide,`NumpadDivide`],[q.F1,`F1`],[q.F2,`F2`],[q.F3,`F3`],[q.F4,`F4`],[q.F5,`F5`],[q.F6,`F6`],[q.F7,`F7`],[q.F8,`F8`],[q.F9,`F9`],[q.F10,`F10`],[q.F11,`F11`],[q.F12,`F12`],[q.F13,`F13`],[q.F14,`F14`],[q.F15,`F15`],[q.F16,`F16`],[q.F17,`F17`],[q.F18,`F18`],[q.F19,`F19`],[q.F20,`F20`],[q.F21,`F21`],[q.F22,`F22`],[q.F23,`F23`],[q.F24,`F24`],[q.NumLock,`NumLock`],[q.ScrollLock,`ScrollLock`],[q.NEC_Equal,`NEC_Equal`],[q.Fujitsu_Masshou,`Fujitsu_Masshou`],[q.Fujitsu_Touroku,`Fujitsu_Touroku`],[q.Fujitsu_Loya,`Fujitsu_Loya`],[q.Fujitsu_Roya,`Fujitsu_Roya`],[q.LeftShift,`ShiftLeft`],[q.RightShift,`ShiftRight`],[q.LeftControl,`ControlLeft`],[q.RightControl,`ControlRight`],[q.LeftMenu,`AltLeft`],[q.RightMenu,`AltRight`],[q.BrowserBack,`BrowserBack`],[q.BrowserForward,`BrowserForward`],[q.BrowserRefresh,`BrowserRefresh`],[q.BrowserStop,`BrowserStop`],[q.BrowserSearch,`BrowserSearch`],[q.BrowserFavorites,`BrowserFavorites`],[q.BrowserHome,`BrowserHome`],[q.VolumeMute,`VolumeMute`],[q.VolumeDown,`VolumeDown`],[q.VolumeUp,`VolumeUp`],[q.MediaNextTrack,`MediaTrackNext`],[q.MediaPrevTrack,`MediaTrackPrevious`],[q.MediaStop,`MediaStop`],[q.MediaPlayPause,`MediaPlayPause`],[q.LaunchMail,`LaunchMail`],[q.LaunchMediaSelect,`LaunchMediaSelect`],[q.LaunchApplication1,`LaunchApplication1`],[q.LaunchApplication2,`LaunchApplication2`],[q.OEM1,`OEM_1`],[q.OEMPlus,`Equal`],[q.OEMComma,`Comma`],[q.OEMMinus,`Minus`],[q.OEMPeriod,`Period`],[q.OEM2,`Slash`],[q.OEM3,`Backquote`],[q.OEM4,`BracketLeft`],[q.OEM5,`Backslash`],[q.OEM6,`BracketRight`],[q.OEM7,`Quote`],[q.OEM8,`IntlRo`],[q.OEMAX,`OEM_AX`],[q.OEM102,`IntlBackslash`],[q.ICOHelp,`ICO_HELP`],[q.ICO00,`ICO_00`],[q.ProcessKey,`Process`],[q.ICOClear,`ICO_CLEAR`],[q.Packet,`Packet`],[q.OEMReset,`OEM_Reset`],[q.OEMJump,`OEM_Jump`],[q.OEMPA1,`OEM_PA1`],[q.OEMPA2,`OEM_PA2`],[q.OEMPA3,`OEM_PA3`],[q.OEMWSCtrl,`OEM_WS_Ctrl`],[q.OEMCUSel,`OEM_CU_Sel`],[q.OEMATTN,`OEM_ATTN`],[q.OEMFinish,`OEM_Finish`],[q.OEMCopy,`OEM_Copy`],[q.OEMAuto,`OEM_Auto`],[q.OEMENLW,`OEM_ENLW`],[q.OEMBackTab,`BackTab`],[q.ATTN,`ATTN`],[q.CRSel,`CRSel`],[q.EXSel,`EXSel`],[q.EREOF,`EREOF`],[q.Play,`MediaPlay`],[q.Zoom,`Zoom`],[q.Noname,`Noname`],[q.PA1,`PA1`],[q.OEMClear,`OEM_Clear`]]),Yt=new Map(Jt.entries().map(([e,t])=>[t,e])),Xt=r({"[string]":{keys:`string[]`,mode:r(`'toggle' | 'hold'`).pipe(e=>e??`toggle`)}});var Zt=class extends N{preferencesKeybindToCallbacks=new Map;pressedKeys=new Set;activeKeybinds=new Set;triggeredToggleKeybinds=new Set;boundHandleKeyboardFocus=this.handleKeyboardFocus.bind(this);boundHandleKeyDown=this.handleKeyDown.bind(this);boundHandleKeyUp=this.handleKeyUp.bind(this);keybindsFile;keybindListeningPaused=!1;constructor(e){super(`KeybindManager`),this.keybindsFile=new k({path:Mt([`keybinds.json`]),schema:Xt,default:e})}init(){super.init();let e=U.getInstance().getInterface(`OGG_SIEGE`);e.instance.on(`keyboardFocus`,this.boundHandleKeyboardFocus),e.instance.on(`keyDown`,this.boundHandleKeyDown),e.instance.on(`keyUp`,this.boundHandleKeyUp)}async onKeybindToggled(e,t){let n=this.preferencesKeybindToCallbacks.get(e)??{toggle:[],down:[],up:[]};n.toggle.push(t),this.preferencesKeybindToCallbacks.set(e,n)}async onKeybindDown(e,t){let n=this.preferencesKeybindToCallbacks.get(e)??{toggle:[],down:[],up:[]};n.down.push(t),this.preferencesKeybindToCallbacks.set(e,n)}async onKeybindUp(e,t){let n=this.preferencesKeybindToCallbacks.get(e)??{toggle:[],down:[],up:[]};n.up.push(t),this.preferencesKeybindToCallbacks.set(e,n)}async updateKeybind(e,t){this.keybindsFile.set({[e]:t})}async updateKeybinds(e){let t=Object.fromEntries(Object.entries(e).filter(([e,t])=>t!==void 0));this.keybindsFile.set({...this.keybindsFile.get(),...t})}getConfig(){return this.keybindsFile.get()}destroy(){let e=U.getInstance().getInterface(`OGG_SIEGE`);e.instance.off(`keyboardFocus`,this.boundHandleKeyboardFocus),e.instance.off(`keyDown`,this.boundHandleKeyDown),e.instance.off(`keyUp`,this.boundHandleKeyUp),super.destroy()}handleKeyDown(e){if(this.keybindListeningPaused)return;let t=Jt.get(e.key);if(!t){this.logger.error(`Unknown key down`,e);return}this.pressedKeys.add(t),this.checkKeybindings()}handleKeyboardFocus(){this.pressedKeys.clear(),this.activeKeybinds.clear(),this.triggeredToggleKeybinds.clear()}async handleKeyUp(e){if(this.keybindListeningPaused)return;let t=Jt.get(e.key);if(!t)return;this.pressedKeys.delete(t);let n=this.keybindsFile.get();for(let[e]of this.preferencesKeybindToCallbacks.entries())n[e].keys.includes(t)&&this.triggeredToggleKeybinds.delete(e);this.checkKeybindUps()}async checkKeybindUps(){let e=this.keybindsFile.get();for(let[t,n]of this.preferencesKeybindToCallbacks.entries()){if(!n.up||n.up.length===0)continue;let r=e[t];if(this.activeKeybinds.has(t)&&r.keys.some(e=>!this.pressedKeys.has(e))){this.activeKeybinds.delete(t);for(let e of n.up)e();this.logger.log(`Keybind up triggered`,this.getKeybindToString(r))}}}async checkKeybindings(){let e=this.keybindsFile.get();for(let[t,n]of this.preferencesKeybindToCallbacks.entries()){let r=e[t];if(r.keys.length===this.pressedKeys.size&&r.keys.every(e=>Yt.has(e)?this.pressedKeys.has(e):!1)){this.triggerKeybind(r,n,t);return}}for(let[t,n]of this.preferencesKeybindToCallbacks.entries()){let r=e[t];r.keys.every(e=>Yt.has(e)?this.pressedKeys.has(e):(this.logger.error(`Unknown key`,e,r),!1))&&this.triggerKeybind(r,n,t)}}triggerKeybind(e,t,n){let r=e.mode;if(r===`toggle`&&t.toggle&&t.toggle.length>0&&!this.triggeredToggleKeybinds.has(n)){let r;for(let e of t.toggle){let t=e();typeof t==`string`&&r===void 0&&(r=t)}this.triggeredToggleKeybinds.add(n),this.logger.log(r?`Keybind pressed rejected: ${r}`:`Keybind pressed accepted`,this.getKeybindToString(e))}if(r===`hold`&&t.down&&t.down.length>0&&!this.activeKeybinds.has(n)){let r;for(let e of t.down){let t=e();if(typeof t==`string`){r=t;break}}r?this.logger.log(`Keybind down rejected: ${r}`,this.getKeybindToString(e)):(this.activeKeybinds.add(n),this.logger.log(`Keybind down accepted`,this.getKeybindToString(e)))}}getKeybindToString(e){return`(${e.keys.join(`+`)}${e.mode?` ${e.mode}`:``})`}};function Qt(e){let t=new Zt(e),n={};for(let r in e)n[r]={on:(e,n)=>{switch(e){case`down`:t.onKeybindDown(r,n);break;case`up`:t.onKeybindUp(r,n);break;case`toggle`:t.onKeybindToggled(r,n);break;default:throw Error(`Event type not implemented ${e}`,{cause:[e,n]})}}};let r={...n,getConfig:()=>t.getConfig(),pauseKeybindListening:()=>{t.keybindListeningPaused=!0},resumeKeybindListening:()=>{t.keybindListeningPaused=!1},updateKeybind:(e,n)=>{t.updateKeybind(e,n)},updateKeybinds:e=>{t.updateKeybinds(e)}};return t.init(),S.on(`quit`,()=>{t.destroy()}),r}function J(){return U.getInstance().getInterface(`OGG_SIEGE`)}function $t(){let e=G.getInstance(),t=O.getInstance(),n=W.getInstance();if(!S.isPackaged){j.getInstance().info(`Cortex is disabled in development`),n.enabled=!1;return}try{n.meta=en()}catch(e){j.getInstance().error(`Failed to setup cortex`,e);return}e.on([`gameReady`,`gameClose`],()=>{n.meta||=en(),n.meta.in_game=e.isInGame}),t.on(`fatal`,e=>{n.track(`fatal`,{message:e.message,code:e.code,data:JSON.stringify(e.data)})}),t.on(`error`,e=>{n.track(`error`,{code:e.code,message:e.message,data:JSON.stringify(e.data)})}),t.on(`warning`,e=>{n.track(`warning`,{message:e.message,code:e.code,data:JSON.stringify(e.data)})})}function en(){if(!global.OVERLAYED_META.release.id)throw Error(`Release ID is required`);return{app_id:global.OVERLAYED.APPLICATION_ID,user_id:L(),release_id:global.OVERLAYED_META.release.id,app_channel:global.OVERLAYED.APP_BUILD_CHANNEL,app_version:global.OVERLAYED.APP_VERSION,package_version:global.OVERLAYED.PACKAGE_VERSION,frontend_version:global.OVERLAYED.FRONTEND_VERSION,frontend_release_id:global.OVERLAYED.FRONTEND_RELEASE_ID,session_id:global.OVERLAYED.sessionId,in_game:!1}}const Y=D(class extends N{CHECK_INTERVAL=1e3*60*15;RETRY_INTERVAL=1e3*15;_updateCheckInterval=null;_latestCheckResponse=null;_activeCheckResponse=null;initialReleaseId=null;get manualUpdatesEnabled(){return this.options?.manualUpdates??!1}get activeReleaseId(){return this._activeCheckResponse?.release_id??this.initialReleaseId}constructor(){super(`SiteManager`)}init(e){super.init(e),e?.manualUpdates&&this.enableManualUpdates()}destroy(){super.destroy(),this._updateCheckInterval&&=(clearInterval(this._updateCheckInterval),null)}allowSiteUpdateOnNextLoad(){if(!this.options?.manualUpdates){this.logger.warn(`allowSiteUpdateOnNextLoad called but manual updates are disabled`);return}if(!this._latestCheckResponse){this.logger.warn(`allowSiteUpdateOnNextLoad called but no update has been checked yet`);return}if(this._activeCheckResponse?.release_id===this._latestCheckResponse.release_id){this.logger.warn(`allowSiteUpdateOnNextLoad called but theres no update available`);return}this._activeCheckResponse=this._latestCheckResponse,W.getInstance().track(`site_update_applied`,{version:this._latestCheckResponse.version,release_id:this._latestCheckResponse.release_id}),this.setFrontendCortexMeta(this._latestCheckResponse.release_id,this._latestCheckResponse.version)}setFrontendCortexMeta(e,t){let n=W.getInstance();n.meta||=en(),e&&(global.OVERLAYED.FRONTEND_RELEASE_ID=e,n.meta.frontend_release_id=e),t&&(global.OVERLAYED.FRONTEND_VERSION=t,n.meta.frontend_version=t),e&&t&&n.track(`frontend_version_changed`,{version:t,release_id:e})}enableManualUpdates(){this.logger.log(`Enabling manual site updates`),this.checkForUpdates(),this._updateCheckInterval=setInterval(()=>{this.checkForUpdates(!0)},this.CHECK_INTERVAL)}async checkForUpdates(e=!1){let t=global.OVERLAYED_META?.application?.siteUrl;if(!t){this.logger.log(`No siteUrl configured, skipping check`);return}W.getInstance().track(`site_check_for_update`,{});try{let n=new URL(`/check`,t).toString();this.logger.log(`Checking site URL`,n);let r={"Overlayed-User-Agent":at({package_version:global.OVERLAYED.PACKAGE_VERSION,application_id:global.OVERLAYED.APPLICATION_ID,application_version:global.OVERLAYED.APP_VERSION}),"Overlayed-Cortex-User-Id":global.OVERLAYED_RUNTIME.userId},i=R();i&&(r[`Overlayed-Access-Token`]=i);let a=global.OVERLAYED_META.release.channelId;a&&(r[`Overlayed-Channel-Id`]=a);let o=await fetch(n,{headers:r});if(!o.ok){this.logger.warn(`Site check failed with status`,o.status),W.getInstance().track(`site_check_error`,{status:o.status}),e&&this.scheduleRetry();return}let s=await o.json();if(this.logger.log(`Site check response`,s),!s.release_id){this.logger.error(`Site check response missing release_id`);return}if(!this._latestCheckResponse){this._latestCheckResponse=s;return}return this._latestCheckResponse.release_id===s.release_id?void 0:(this.logger.log(`New site version detected`,s),this._latestCheckResponse=s,W.getInstance().track(`site_update_ready`,{version:s.version,release_id:s.release_id}),this.emit(`siteUpdateReady`,{releaseId:s.release_id,version:s.version}),s)}catch(e){let t=e instanceof Error?e.message:String(e);W.getInstance().track(`site_check_error`,{message:t}),this.logger.error(`Site check failed`,{error:e,message:t}),this.scheduleRetry()}}scheduleRetry(){setTimeout(()=>{this.checkForUpdates()},this.RETRY_INTERVAL)}}),tn=D(Oe,`windows.log`);let nn;function rn(){return nn||(nn=class e extends global.OVERLAYED.electron.BrowserWindow{static session=void 0;constructor(t){let n=e.resolveCustomOptions(t);super(n)}static resolveCustomOptions(t){let n=global.OVERLAYED_META,r=global.OVERLAYED_RUNTIME;return{...t,webPreferences:{...t.webPreferences,session:e.getSession(),additionalArguments:[...t.webPreferences?.additionalArguments||[],...global.OVERLAYED.electron.app.isPackaged?[]:[`--overlayed-meta=${JSON.stringify(n)}`],`--overlayed-runtime=${JSON.stringify(r)}`]}}}static getSession(){if(!global.OVERLAYED_META?.application?.siteUrl)return;if(e.session)return e.session;e.session=global.OVERLAYED.electron.session.fromPartition(`persist:overlayed-${global.OVERLAYED.APPLICATION_ID}`);let t=Y.getInstance(),n=at({package_version:global.OVERLAYED.PACKAGE_VERSION,application_id:global.OVERLAYED.APPLICATION_ID,application_version:global.OVERLAYED.APP_VERSION}),r={urls:[global.OVERLAYED_META.application.siteUrl+`/*`]},i=global.OVERLAYED_RUNTIME.userId;return e.session.webRequest.onBeforeSendHeaders(r,(e,r)=>{let a=R();a&&(e.requestHeaders[`Overlayed-Access-Token`]=a);let o=global.OVERLAYED_META.release.channelId;o&&(e.requestHeaders[`Overlayed-Channel-Id`]=o),t.manualUpdatesEnabled&&t.activeReleaseId&&(e.requestHeaders[`Overlayed-Release-Id`]=t.activeReleaseId),e.requestHeaders[`Overlayed-Cortex-User-Id`]=i,e.requestHeaders[`Overlayed-User-Agent`]=n,r({requestHeaders:e.requestHeaders})}),t.manualUpdatesEnabled&&e.session.webRequest.onHeadersReceived(r,(e,n)=>{if(t.initialReleaseId){n(e);return}let r=e.responseHeaders?.[`Overlayed-Release-Id`]?.[0];r&&(t.initialReleaseId=F(r));let i=e.responseHeaders?.[`Overlayed-Release-Version`]?.[0];t.setFrontendCortexMeta(r,i),n(e)}),e.session}},nn)}function an(){function e(e,t){let n=tn.getInstance();return e.once(`closed`,()=>{e.isDestroyed()||W.getInstance().track(`window_closed`,{url:e.webContents.getURL(),in_game:t})}),e.on(`unresponsive`,()=>{e.isDestroyed()||W.getInstance().track(`window_unresponsive`,{url:e.webContents.getURL(),in_game:t})}),e.webContents.on(`console-message`,(t,r,i,a,o)=>{let s=e.isDestroyed()?`destroyed`:e.webContents.getURL();n[r===3?`error`:r===2?`warn`:`log`](`[${s}] [${o}:${a}] ${i}`)}),W.getInstance().track(`window_created`,{url:e.webContents.getURL(),in_game:t}),e}return{getProductionSiteUrl:()=>{let e=global.OVERLAYED_META.application.siteUrl;return URL.canParse(e)?new URL(e):new URL(`https://default.overlayedapps.com`)},createWindow:t=>e(new(rn())(t),!1),createInGameWindow:t=>{let n=rn();return e(J().instance.newWindowInternal(n,t),!0)},on:(e,t)=>J().instance.on(e,t),off:(e,t)=>J().instance.off(e,t),once:(e,t)=>J().instance.once(e,t),addListener:(e,t)=>J().instance.addListener(e,t),removeListener:(e,t)=>J().instance.removeListener(e,t),removeAllListeners:()=>J().instance.removeAllListeners(),prependListener:(e,t)=>J().instance.prependListener(e,t),prependOnceListener:(e,t)=>J().instance.prependOnceListener(e,t),getActiveGameInfo:()=>{let e=J(),t=He.getInstance();return{resolution:e.resolution,isConnected:t.hasConnection}}}}const on=D(class extends $e{renderInterface;globalCursorOverrideCount=new Set;globalMouseBlockCount=new Set;globalKeyboardBlockCount=new Set;keyInputBlocks={};constructor(e){super(`OverridesManager`),this.renderInterface=U.getInstance().getInterface(e)}scope(e){return{setGlobalCursorOverride:t=>this.setGlobalCursorOverride(e,t),setGlobalMouseBlock:t=>this.setGlobalMouseBlock(e,t),setGlobalKeyboardBlock:t=>this.setGlobalKeyboardBlock(e,t),setKeyInputBlock:(t,n)=>this.setKeyInputBlock(e,t,n)}}setGlobalCursorOverride(e,t){t?this.globalCursorOverrideCount.add(e):this.globalCursorOverrideCount.delete(e),t&&this.globalCursorOverrideCount.size===1?this.renderInterface.instance.setGlobalCursorOverride(!0):!t&&this.globalCursorOverrideCount.size===0&&this.renderInterface.instance.setGlobalCursorOverride(!1)}setGlobalMouseBlock(e,t){t?this.globalMouseBlockCount.add(e):this.globalMouseBlockCount.delete(e),t&&this.globalMouseBlockCount.size===1?this.renderInterface.instance.setGlobalMouseBlock(!0):!t&&this.globalMouseBlockCount.size===0&&this.renderInterface.instance.setGlobalMouseBlock(!1)}setGlobalKeyboardBlock(e,t){t?this.globalKeyboardBlockCount.add(e):this.globalKeyboardBlockCount.delete(e),t&&this.globalKeyboardBlockCount.size===1?this.renderInterface.instance.setGlobalKeyboardBlock(!0):!t&&this.globalKeyboardBlockCount.size===0&&this.renderInterface.instance.setGlobalKeyboardBlock(!1)}setKeyInputBlock(e,t,n){this.keyInputBlocks[t]||(this.keyInputBlocks[t]=new Set),n?this.keyInputBlocks[t].add(e):this.keyInputBlocks[t].delete(e),n&&this.keyInputBlocks[t].size===1?this.renderInterface.instance.setKeyInputBlock(t,!0):!n&&this.keyInputBlocks[t].size===0&&this.renderInterface.instance.setKeyInputBlock(t,!1)}},`OGG_SIEGE`);function sn(){return{scope:e=>on.getInstance().scope(e),raw:{setGlobalMouseBlock:e=>J().instance.setGlobalMouseBlock(e),setGlobalKeyboardBlock:e=>J().instance.setGlobalKeyboardBlock(e),setGlobalCursorOverride:e=>J().instance.setGlobalCursorOverride(e),setKeyInputBlock:(e,t)=>J().instance.setKeyInputBlock(e,t),getGlobalMouseBlock:()=>J().instance.getGlobalMouseBlock(),getGlobalKeyboardBlock:()=>J().instance.getGlobalKeyboardBlock(),getGlobalCursorOverride:()=>J().instance.getGlobalCursorOverride(),getKeyInputBlock:e=>J().instance.getKeyInputBlock(e)}}}function cn(){return{track:(e,t)=>{W.getInstance().track(`custom__${String(e)}`,t)}}}var ln=he(((e,t)=>{var n=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),r=n((e,t)=>{var n=new Set([`mouseDown`,`mouseUp`,`pointerDown`,`pointerUp`]),r=new WeakSet;function i(e,t,{allowHosts:i}={}){let{shell:a}=t;if(r.has(e))return;r.add(e);let o=e.webContents;function s(e){return!!(!c(e)||i?.includes(e.host))}function c(e){return new URL(o.getURL()).origin!==e.origin}let l=0;function u(){l=Date.now()}function d(){let e=Date.now()-l,t=e<150;return t||console.warn(`was not recently active`,e),t}if(process.platform===`win32`)for(let t of Object.values({KEYDOWN:256,LBUTTONUP:514,MBUTTONUP:520,RBUTTONUP:517,XBUTTONUP:524,TOUCH:576}))e.hookWindowMessage(t,u);o.on(`input-event`,(e,t)=>{n.has(t.type)&&u()}),o.on(`will-navigate`,(e,t)=>{let n=e.url||t;if(console.log(`will-navigate`,n),!n)return;let r=new URL(n);if(!s(r)){if(!d()){console.log(`blocked navigation`,n),e.preventDefault();return}c(r)&&(console.log(`external navigation`,n),e.preventDefault(),a.openExternal(n))}}),o.session.on(`will-download`,(e,t)=>{let n=t.getURL();/^blob:/.test(n)||e.preventDefault()}),o.setWindowOpenHandler(e=>{console.log(`window-open`,e.url);let{url:t}=e,n=new URL(t);if(!s(n))return d()?(c(n)&&a.openExternal(e.url),{action:`deny`}):(console.log(`blocked navigation`,t),{action:`deny`})})}t.exports=i}),i=n((e,t)=>{var n=new Set([`Mozilla`,`AppleWebKit`,`Chrome`,`Safari`,`Gecko`,`Firefox`,`OPR`,`Edg`,`Version`,`Mobile`,`curl`,`PostmanRuntime`]);async function r(e,t,r){let{webContents:i}=e,a=await i.executeJavaScript(`navigator.userAgent`);a=a.match(/[^\/]+\/[^\s]+( \([^\)]+\))?/g).map(e=>e.trim()).filter(e=>{let[t]=e.split(`/`,1);return n.has(t)}).join(` `),i.setUserAgent(a),t.app.userAgentFallback=a}t.exports=r}),a=r(),o=i();function s(e,t,n={}){a(e,t,n.linkHandler),o(e,t,n.userAgent)}t.exports={setupRevUtils:s,setupLinkHandler:a,setUserAgent:o}}))();function un(){return{registerWindow:e=>{(0,ln.setupRevUtils)(e,global.OVERLAYED.electron)}}}function dn(e){let{silent:t=!1,additionalFiles:n}=e??{},r=Ee(global.OVERLAYED.APPLICATION_ID),i=Ae(r,{recursive:!0}),a=we(),o=Ae(a,{recursive:!0});t||(j.getInstance().info(`Logs path: `,r),j.getInstance().info(`Overlayed logs path: `,a));let s=new le;return[...i,...o].forEach(([e,n])=>{t||j.getInstance().info(`Zipping: `,n);let r=re(n),i=_(n);s.file(i,r,{compression:`DEFLATE`})}),n&&Object.entries(n).forEach(([e,n])=>{t||j.getInstance().info(`Zipping extra file: `,e),s.file(e,n,{compression:`DEFLATE`})}),s}async function fn(e,t,n){let r=global.OVERLAYED_META.release.id?F(global.OVERLAYED_META.release.id):void 0,i=L();return ft(global.OVERLAYED.APPLICATION_ID,{file:Buffer.from(n,`base64`),data:{release_id:r,type:e,cortex_user_id:i,...t}}).then(n=>(pn({feedback_id:n.data.id,type:e,email:t.email,description:t.message}),j.getInstance().info(`Feedback submitted`,n),n.data.id)).catch(e=>{console.error(JSON.stringify(e,null,2)),j.getInstance().error(`Failed to submit feedback`,e)})}async function pn(e){try{let t=await fetch(`https://api.stats.cc/v2/overlay/contact`,{method:`POST`,body:JSON.stringify(e),redirect:`follow`,headers:{"Content-Type":`application/json`}});if(!t.ok){j.getInstance().error(`OLD - Failed to submit feedback`,await t.json());return}}catch(e){j.getInstance().error(`OLD - Failed to submit feedback`,e);return}}function mn(e){let t=new Oe(`app.log`);return t.init(global.OVERLAYED.APPLICATION_ID,e.debug),{scope:e=>t.scope(e),info:e=>t.info(e),warn:e=>t.warn(e),error:e=>t.error(e),debug:e=>t.debug(e),submitFeedback:async(e,t,n)=>{let r=global.OVERLAYED_META.release.id?F(global.OVERLAYED_META.release.id):void 0;return r&&S.isPackaged&&W.getInstance().track(e===`bug_report`?`bug_report_submitted`:`suggestion_submitted`,{release_id:r}),await fn(e,t,await dn(n).generateAsync({type:`base64`}))},getLogsZip:e=>dn(e)}}const hn=1e3;function gn(e,t,n,i,a){let o=He.getInstance(),s=j.getInstance().scope(`SetupPipeServer`);s.log(`Initializing`);function c(e,t){let r=n.get(t);if(!r)n.set(t,[e]);else{if(r.length>=hn){O.getInstance().warn(`Event buffer full, removing oldest event`,`EVENT_BUFFER_FULL`,{summary:`Event buffer overflow for module ${t}. Buffer size: ${r.length}, max: ${hn}`});return}r.push(e)}}function l(n){s.info(n);let i=Nt(n);if(i instanceof r.errors){W.getInstance().track(`invalid_game_event`,{}),O.getInstance().warn(`Invalid event`,`INVALID_EVENT`,{summary:i.summary});return}let o=Ze.includes(i.type),l=e.modules.find(e=>e.key===`universal`),u=o?l:e.modules.find(e=>e.key===i.game);if(!u){s.warn(`Invalid module`,{module:o?`universal`:i.game});return}let d=u.events.event,f=d(n);if(f instanceof r.errors){if(`type`in f.byPath)return;s.warn(`Invalid event`,{summary:f.summary}),W.getInstance().track(`invalid_game_event`,{game:i.game,type:i.type,summary:f.summary}),O.getInstance().warn(`Invalid event`,`INVALID_EVENT`,{summary:f.summary});return}if(!a[u.key]){c(f,u.key);return}if(f.type===`unsupported_game_version`){let{content:e}=f;W.getInstance().track(`unsupported_game_version`,{game:f.game,hash:e.process_hash,version:e.game_version})}let p=K(u.key,f.type),m=K(u.key,`*`),h=t.get(p),g=t.get(m),_=[...Array.from(h??[]),...Array.from(g??[])];if(_.length===0){s.info(`No handlers found for event`,{event:f});return}_.forEach(e=>{e(f)})}return i.on(`flushEvents`,e=>{if(a[e])return;a[e]=!0;let t=n.get(e);t&&(j.getInstance().info(`Flushing ${t.length} events for module ${e}`),t.forEach(e=>l(e)),n.delete(e))}),o.on(`data`,e=>e.forEach(l)),o.on(`error`,e=>{s.error(`Pipe server error`,e),O.getInstance().error(`Pipe server error`,`PIPE_SERVER_ERROR`,{error:e})}),o.on(`connected`,()=>{s.log(`Pipe server connected`)}),o.on(`disconnected`,()=>{s.log(`Pipe server disconnected`)}),o}function _n(){let e=Y.getInstance();return{on:(t,n)=>{e.on(t,n)},off:(t,n)=>{e.off(t,n)},allowSiteUpdateOnNextLoad:()=>{e.allowSiteUpdateOnNextLoad()}}}const vn=r({dismissedNotices:ge(r.string).array()}),yn=D(class extends N{NOTICE_FETCH_INTERVAL=1e3*60*5;MAX_DISMISSED_NOTICES=100;_noticeFetchInterval=null;_notices=[];_noticesFile;_boundOnGameReady=this.onGameReady.bind(this);get notices(){let e=this._noticesFile.get().dismissedNotices;return this._notices.filter(t=>!e.includes(t.id))}constructor(){super(`NoticeManager`),this._noticesFile=this.getNoticesFile(),this._noticesFile.load(),this.fetchNotices(),this.setupNoticeInterval(),G.getInstance().on(`gameReady`,this._boundOnGameReady)}destroy(){this._noticeFetchInterval&&=(clearInterval(this._noticeFetchInterval),null),G.getInstance().off(`gameReady`,this._boundOnGameReady),super.destroy()}dismissNotice(e){let t=this._notices.find(t=>t.id===e);if(!t||!t.dismissible)return;let n=this._noticesFile.get().dismissedNotices;n.unshift(e),this._noticesFile.set({dismissedNotices:n.slice(0,this.MAX_DISMISSED_NOTICES)}),this.emitNoticesUpdated()}onGameReady(){this.fetchNotices()}setupNoticeInterval(){this._noticeFetchInterval=setInterval(()=>{this.fetchNotices()},this.NOTICE_FETCH_INTERVAL)}getNoticesFile(){return new k({path:Mt([`notices.json`]),schema:vn,default:{dismissedNotices:[]}})}async fetchNotices(){let e=G.getInstance().getActiveGames();try{let{data:t}=await pt(global.OVERLAYED.APPLICATION_ID,{release_id:global.OVERLAYED_META.release.id?F(global.OVERLAYED_META.release.id):void 0,channel:global.OVERLAYED_META.release.channel,version:global.OVERLAYED_META.release.version,games:e});this._notices=t,this.emitNoticesUpdated()}catch(e){this.logger.error(`Failed to fetch notices`,e)}}emitNoticesUpdated(){this.emit(`noticesUpdated`,{notices:this.notices})}});function bn(){let e=yn.getInstance();return{on:(t,n)=>{e.on(t,n)},off:(t,n)=>{e.off(t,n)},dismissNotice:t=>{e.dismissNotice(t)},getNotices:()=>e.notices}}var xn=class extends me{logger=j.getInstance().scope(`OverlayedProvider`);constructor(e,t,n){super(n),this.options=e,this.updater=t}async getLatestVersion(){try{let e=await dt(this.options.application_id,{release_id:this.options.release_id,cortex_user_id:this.options.cortex_user_id,access_token:this.options.access_token,requested_channel:this.options.requested_channel});return this.logger.log(`checkApplicationRelease response`,e.data),W.getInstance().track(`update_release_check_success`,{version:e.data.release.version,channel:e.data.release.channel,fallback:!!e.data.fallback}),e.data.fallback&&this.logger.warn(`Update fallback detected, switching to default channel`),{path:``,sha512:e.data.download_hash??``,version:`${e.data.release.version}-${e.data.release.channel}`,releaseName:e.data.release.id,releaseDate:e.data.release.created_at,files:[{url:e.data.download_url,sha512:e.data.download_hash??``}]}}catch(e){let t=e instanceof Error?e.stack||e.message:String(e);throw W.getInstance().track(`update_release_check_error`,{message:t}),Error(`Unable to find the latest version (${this.options.release_id}), please ensure release exists. ${t}`)}}resolveFiles(e){return[{info:e.files[0],url:new URL(e.files[0].url)}]}};function Sn(e){return{provider:`custom`,updateProvider:xn,...e}}const X=D(class extends N{DEFAULT_CHANNEL=`public`;TOKEN_REFRESH_INTERVAL=1e3*60*15;accessTokenFetcher=void 0;_tokenRefreshInterval=null;_downloadStarted=!1;constructor(){super(`UpdateManager`)}init(){super.init(),this.registerListenerForwarders(),this.setupTokenRefreshInterval(),w.disableDifferentialDownload=!0}destroy(){w.removeAllListeners(),this._tokenRefreshInterval&&=(clearInterval(this._tokenRefreshInterval),null),super.destroy()}setupTokenRefreshInterval(){this._tokenRefreshInterval=setInterval(()=>{this.checkAndRefreshToken()},this.TOKEN_REFRESH_INTERVAL)}async checkAndRefreshToken(){let e=global.OVERLAYED_META.release.channel;e!==this.DEFAULT_CHANNEL&&(this.logger.log(`Refreshing access token for channel`,e),await this.setAndGetLatestAccessToken(e))}async checkForUpdates(e){this.logger.log(`Starting checkForUpdates`);let t=e??global.OVERLAYED_META.release.channel;return W.getInstance().track(`check_for_update`,{channel:t}),this._downloadStarted=!1,await this.setAndGetLatestAccessToken(t),e?(w.allowDowngrade=!0,w.channel=e,this.setFeedUrl({requestedChannel:e})):(w.allowDowngrade=!1,w.channel=global.OVERLAYED_META.release.channel,this.setFeedUrl({})),this.logger.log(`Checking for updates`),w.checkForUpdates()}async switchChannel(e){return this.logger.log(`Switching channel`,e),W.getInstance().track(`update_channel_switch`,{from_channel:global.OVERLAYED_META.release.channel,to_channel:e}),this._downloadStarted=!1,await this.setAndGetLatestAccessToken(e),w.allowDowngrade=!0,w.channel=e,this.setFeedUrl({requestedChannel:e}),w.checkForUpdates()}quitAndInstall(e,t){this.logger.log(`quitAndInstall`,{isSilent:e,isForceRunAfter:t});let[n,r]=this.canUpdate();if(!n)throw this.logger.warn(`Cannot update`,{denialReason:r}),W.getInstance().track(`update_install_blocked`,{reason:r}),Error(r);return this.logger.log(`Quitting and installing`),W.getInstance().track(`update_install`,{}),w.quitAndInstall(e,t)}canUpdate(){return G.getInstance().isInGame?[!1,`User is in game`]:[!0,null]}downloadUpdate(e){return w.downloadUpdate(e)}setAccessTokenFetcher(e){this.accessTokenFetcher=e}async setAndGetLatestAccessToken(e){if(this.logger.log(`Fetching new token`),!this.accessTokenFetcher)return this.logger.warn(`accessTokenFetcher is not set, private channels will not work.`),z(null),null;if(this.logger.log(`Setting and getting latest access token for channel`,e),e===this.DEFAULT_CHANNEL)return this.logger.log(`Default channel, skipping`),z(null),null;if(e!==global.OVERLAYED_META.release.channel)return this.forceFetchNewAccessToken(e);this.logger.log(`Access token exists, checking expiration`);let t=R();if(t){let e=this.getAccessTokenExpirationDate(t);if(!e)this.logger.log(`Invalid token, setting to null`),z(null);else if(e.getTime()>=Date.now()+300*1e3)return this.logger.log(`Token is not expired, using it.`),t}return this.forceFetchNewAccessToken(e)}async forceFetchNewAccessToken(e){this.accessTokenFetcher||this.logger.warn(`accessTokenFetcher is not set [2], private channels will not work.`);try{let t=await this.accessTokenFetcher?.(e)??null;this.logger.log(`New token fetched`,t?.slice(0,5)+`...`);let n=R();if(t==null||n===t){W.getInstance().track(`update_token_invalid`,{channel:e}),this.emit(`authTokenInvalid`,{}),z(null);return}return z(t),t}catch(e){let t=e instanceof Error?e.message:String(e);return W.getInstance().track(`update_token_fetch_error`,{message:t}),this.logger.error(`Error fetching new token`,{error:e,message:t}),z(null),null}}setFeedUrl(e){if(!global.OVERLAYED_META.release.id){this.logger.warn(`Tried to set feed URL in development mode`);return}w.setFeedURL(Sn({application_id:global.OVERLAYED.APPLICATION_ID,release_id:global.OVERLAYED_META.release.id,cortex_user_id:global.OVERLAYED_RUNTIME.userId,access_token:R(),requested_channel:e.requestedChannel}))}registerListenerForwarders(){w.on(`checking-for-update`,()=>{this.logger.info(`Checking for updates`),this.emit(`checkingForUpdates`,{})}),w.on(`download-progress`,e=>{this._downloadStarted||(this._downloadStarted=!0,W.getInstance().track(`update_download_started`,{version:w.currentVersion?.version??``})),this.emit(`downloadProgress`,{info:e});let t=`Download speed: ${e.bytesPerSecond} - Downloaded ${e.percent}%`;t+=` (${e.transferred}/${e.total})`,this.logger.log(t)}),w.on(`error`,(e,t)=>{this.logger.error(`Error`,e,t),W.getInstance().track(`update_download_error`,{message:t??e.message}),this.emit(`error`,{error:e,message:t})}),w.on(`update-not-available`,e=>{this.logger.info(`Update not available`,e),W.getInstance().track(`update_not_available`,{version:e.version}),this.emit(`updateNotAvailable`,{info:e})}),w.on(`update-available`,e=>{this.logger.info(`Update available`,e),W.getInstance().track(`update_available`,{version:e.version,channel:w.channel??``}),this.emit(`updateAvailable`,{info:e})}),w.on(`update-downloaded`,e=>{this.logger.info(`Update downloaded`,e),W.getInstance().track(`update_download_complete`,{version:e.version}),this.emit(`updateDownloaded`,{event:e})}),w.on(`update-cancelled`,e=>{this.logger.info(`Update cancelled`,e),W.getInstance().track(`update_cancelled`,{version:e.version}),this.emit(`updateCancelled`,{info:e})})}getAccessTokenExpirationDate(e){try{let t=e.split(`.`)[1];if(!t)return null;let n=atob(t.replace(/-/g,`+`).replace(/_/g,`/`)),r=JSON.parse(n);return r.exp?new Date(r.exp*1e3):null}catch{return null}}});function Cn(){let e=X.getInstance();return{site:_n(),on:(t,n)=>{e.on(t,n)},off:(t,n)=>{e.off(t,n)},setAccessTokenFetcher:t=>e.setAccessTokenFetcher(t),checkForUpdates:()=>e.checkForUpdates(),switchChannel:t=>e.checkForUpdates(t),quitAndInstall:(t,n)=>e.quitAndInstall(t,n),canUpdate:()=>e.canUpdate(),downloadUpdate:t=>e.downloadUpdate(t)}}function wn(){return{getChannel:()=>global.OVERLAYED_META.release.channel,getVersion:()=>global.OVERLAYED_META.release.version,getReleaseId:()=>global.OVERLAYED_META.release.id}}let Z=!1,Tn={},Q,En=new E,$;function Dn(e){kn(e);let t=On(e),{init:n=!0,debug:r=!1,silent:i=!0}=t;if(An(e),j.getInstance().init(e.applicationId,r,i),tn.getInstance().init(e.applicationId,r,!0),Nn(lt(e.applicationId),!1).catch(()=>{}),Z)return Q;function a(){if(Z){j.getInstance().warn(`Overlayed already initialized`);return}$t();let e=Gt.get({createIfMissing:!1})?.currentAccount;e&&nt(()=>e.apiKey);let n=new Map,r=new Map,i=Cn(),o=Kt(t.modules,n,En),s=qt(),c=Qt(t.keybinds),l=an(),u=sn(),d=un(),f=cn(),p=mn(t),m=bn(),h=wn();j.getInstance().log(`Overlayed initialized`),jn(t),gn(t,n,r,En,Tn),Z=!0,Q={...o,...s,ads:d,keybinds:c,windows:l,input:u,cortex:f,hasAnyActiveProcesses:()=>H.getInstance().hasAnyActiveProcesses,hasAnyActiveGames:()=>G.getInstance().isInGame,init:a,log:p,initialized:Z,notices:m,updater:i,application:h},Q.universal.on(`logged_in`,e=>{W.getInstance().track(`account_id`,{account_id:e.content.account_id,game:e.game})})}return n?(a(),Q):new Proxy({init:a},{get:(e,t)=>{if(t!==`init`&&!Z)throw Error(`overlayed was called before initialized: ${t}`);return t===`init`?e[t]:Q[t]}})}function On(e){return{...e,modules:[...e.modules,Qe()]}}global.OVERLAYED=new Proxy({},{get:()=>{throw Error(`function overlayed was not called`)}});function kn(e){if(!_e(e.applicationId))throw Error(`Invalid applicationId, must be a valid ULID.`)}function An(e){let t=Mn(),n=`1.0.1`,r=lt(e.applicationId);function i(){return{package_version:n,application_id:r,application_version:t?.release.version??`0.0.0`}}if(j.getInstance().log(`ua object`,i()),it(()=>i()),t===null){Nn(r,!0);return}global.OVERLAYED={APPLICATION_ID:r,APP_BUILD_CHANNEL:t.release.channel,APP_VERSION:t.release.version,PACKAGE_VERSION:n,FRONTEND_VERSION:`0.0.0`,sessionId:Ft(),electron:e.electron},global.OVERLAYED_META=t,global.OVERLAYED_RUNTIME={userId:L()},j.getInstance().log(`meta`,t)}function jn(e){j.getInstance().warn(`Bootstrapping`);let t=e.universal?[`*`]:e.modules.map(e=>e.key);G.getInstance().setSubscribedGames(t),j.getInstance().warn(`Initializing update manager`),X.getInstance().init(),j.getInstance().warn(`Initialized update manager`),Y.getInstance().init({manualUpdates:e.site?.manualUpdates??!1}),Ut.getInstance().init(),G.getInstance().init(),H.getInstance().init(),V.getInstance().init(),W.getInstance().track(`start`,{}),Wt.getInstance().check(e.applicationId);try{$&&clearInterval($),$=setInterval(()=>{try{It()}catch{}},3e4),$.unref()}catch(e){j.getInstance().log(`failed to start sessionLastUsed interval`,e)}async function n(){let e={};e.os=C.platform().trim(),e.os_version=process.getSystemVersion().trim(),e.architecture=C.arch().trim();let t=C.cpus();t.length>0?(e.cpu=t[0].model.trim(),e.cpu_cores=t.length,e.cpu_speed=t[0].speed):j.getInstance().warn(`Failed to collect CPU info`);let n=await pe.graphics();j.getInstance().info(`GPU info`,n);let r=n.controllers.sort((e,t)=>(t.vram??0)-(e.vram??0))[0];r?(e.gpu=r.model.trim(),e.gpu_memory=r.vram??0):j.getInstance().warn(`Failed to find primary GPU`),e.display_count=n.displays.length;let i=n.displays.find(e=>e.main)??n.displays[0];i?(e.primary_display_resolution_x=i.resolutionX??void 0,e.primary_display_resolution_y=i.resolutionY??void 0,e.primary_display_refresh_rate=i.currentRefreshRate??void 0):j.getInstance().warn(`Failed to find main display`),e.ram=process.getSystemMemoryInfo().total;let a=C.homedir(),o=await de.statfs(a);return o&&`blocks`in o&&`bsize`in o&&`bavail`in o?(e.disk=o.blocks*o.bsize,e.disk_free=o.bavail*o.bsize):j.getInstance().warn(`Failed to collect disk info`),j.getInstance().log(`Retrieved system information`,e),e}S.on(`ready`,()=>{n().then(e=>{W.getInstance().track(`system_info`,e)}).catch(e=>{j.getInstance().log(`Failed to retrieve system information`,e)})}),S.on(`quit`,()=>{W.getInstance().track(`electron_quit`,{}),Pn()}),process.on(`exit`,()=>{W.getInstance().track(`exit`,{}),Pn()})}function Mn(){if(S.isPackaged)try{let e=h.join(process.resourcesPath,`meta.json`);return JSON.parse(y.readFileSync(e,`utf-8`))}catch(e){throw Error(`Failed to read application metadata from resources/meta.json`,{cause:e})}else{let e=h.join(process.cwd(),`.overlayed`,`meta.json`);return y.existsSync(e)?JSON.parse(y.readFileSync(e,`utf-8`)):null}}async function Nn(e,t=!1){if(!S.isPackaged)try{j.getInstance().log(`Fetching application metadata from API...`);let n=Fe({...(await ut(e)).data,siteUrl:``});t&&(j.getInstance().log(v.yellowBright(`Uninitialized development environment detected. Created .overlayed folder. In the future, run ${v.bold(`overlayed init`)} to do so. \n\nThe process will now exit to load the cached metadata.\n\n${v.italic(`Note: This will never happen in a packaged application, and will only happen once in local development so long as the .overlayed folder exists.`)}`)),process.exit(0)),global.OVERLAYED_META=n}catch(e){j.getInstance().error(`Failed to fetch application meta`,e),t&&(console.error(`
2
2
  Failed to fetch application metadata. Please ensure you're authenticated with 'overlayed login'.
3
3
  `),process.exit(1))}}async function Pn(){try{It()}catch{}try{$&&clearInterval($),$=void 0}catch{}await W.getInstance().flush(),V.getInstance().destroy(),G.getInstance().destroy(),Ut.getInstance().destroy(),H.getInstance().destroy(),U.getInstance().getInterface(`OGG_SIEGE`).destroy(),He.getInstance().destroy(),O.getInstance().destroy(),X.getInstance().destroy(),Y.getInstance().destroy()}export{Ue as RenderInterface,Ge as VirtualKey,Ne as defineConfig,Dn as overlayed};
package/dist/siege.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as arktype2 from "arktype";
1
+ import * as arktype0 from "arktype";
2
2
  import { Type } from "arktype";
3
3
  import * as arktype_internal_variants_string_ts0 from "arktype/internal/variants/string.ts";
4
4
  import * as arktype_internal_variants_number_ts0 from "arktype/internal/variants/number.ts";
@@ -618,7 +618,7 @@ declare const SIEGE_TIME_OF_DAY_LABELS: Record<SiegeTimeOfDay, string>;
618
618
  //#region src/module.d.ts
619
619
  declare function module(): {
620
620
  readonly key: "siege";
621
- readonly events: arktype2.Module<{
621
+ readonly events: arktype0.Module<{
622
622
  event: {
623
623
  game: "siege";
624
624
  type: "started_queuing";
@@ -665,11 +665,11 @@ declare function module(): {
665
665
  segment_size: number;
666
666
  segment_index: number;
667
667
  team_0: {
668
- role: "attacker" | "defender" | "both" | "invalid" | (string & {});
668
+ role: "invalid" | (string & {}) | "attacker" | "defender" | "both";
669
669
  state: SiegeRoundState;
670
670
  };
671
671
  team_1: {
672
- role: "attacker" | "defender" | "both" | "invalid" | (string & {});
672
+ role: "invalid" | (string & {}) | "attacker" | "defender" | "both";
673
673
  state: SiegeRoundState;
674
674
  };
675
675
  }[];
@@ -701,7 +701,7 @@ declare function module(): {
701
701
  content: {
702
702
  team: 0 | 1;
703
703
  index: number;
704
- side: "attacker" | "defender" | "both" | "invalid" | (string & {});
704
+ side: "invalid" | (string & {}) | "attacker" | "defender" | "both";
705
705
  };
706
706
  } | {
707
707
  game: "siege";
@@ -710,7 +710,7 @@ declare function module(): {
710
710
  content: {
711
711
  team: 0 | 1;
712
712
  index: number;
713
- side: "attacker" | "defender" | "both" | "invalid" | (string & {});
713
+ side: "invalid" | (string & {}) | "attacker" | "defender" | "both";
714
714
  operator_name: {
715
715
  id: SiegeOperatorNameId;
716
716
  value: string;
@@ -735,11 +735,11 @@ declare function module(): {
735
735
  segment_size: number;
736
736
  segment_index: number;
737
737
  team_0: {
738
- role: "attacker" | "defender" | "both" | "invalid" | (string & {});
738
+ role: "invalid" | (string & {}) | "attacker" | "defender" | "both";
739
739
  state: SiegeRoundState;
740
740
  };
741
741
  team_1: {
742
- role: "attacker" | "defender" | "both" | "invalid" | (string & {});
742
+ role: "invalid" | (string & {}) | "attacker" | "defender" | "both";
743
743
  state: SiegeRoundState;
744
744
  };
745
745
  };
@@ -750,8 +750,8 @@ declare function module(): {
750
750
  remaining_health: number;
751
751
  pre_damage_health: number;
752
752
  max_health: number;
753
- damage_type: "unknown" | "invalid" | (string & {}) | "bullet" | "melee" | "explosive" | "falling" | "regeneration" | "debris" | "projectile" | "downed" | "gas" | "thermal_explosion" | "melee_gadget" | "barbed_wire" | "electric" | "reinforcement" | "frag" | "paralyzed" | "emp" | "break" | "cleanup" | "interrogation" | "melee-finisher" | "toxic" | "toxic-explosion" | "pneumatic" | "body-contact" | "contact-explosion" | "flash" | "parasite-spike" | "laser" | "concussion" | "blowtorch" | "taser-shield" | "reverse-friendly-fire" | "self-destroyed" | "area-control" | "fire" | "breach-kick" | "break-wall" | "blade-mine" | "melee-pushback" | "supressive-fire" | "gas-pipe-fire";
754
- damage_team_type: "unknown" | "invalid" | (string & {}) | "enemy" | "friendly";
753
+ damage_type: "invalid" | "unknown" | (string & {}) | "downed" | "bullet" | "melee" | "explosive" | "falling" | "regeneration" | "debris" | "projectile" | "gas" | "thermal_explosion" | "melee_gadget" | "barbed_wire" | "electric" | "reinforcement" | "frag" | "paralyzed" | "emp" | "break" | "cleanup" | "interrogation" | "melee-finisher" | "toxic" | "toxic-explosion" | "pneumatic" | "body-contact" | "contact-explosion" | "flash" | "parasite-spike" | "laser" | "concussion" | "blowtorch" | "taser-shield" | "reverse-friendly-fire" | "self-destroyed" | "area-control" | "fire" | "breach-kick" | "break-wall" | "blade-mine" | "melee-pushback" | "supressive-fire" | "gas-pipe-fire";
754
+ damage_team_type: "invalid" | "unknown" | (string & {}) | "enemy" | "friendly";
755
755
  damage_hit_zone: "invalid" | (string & {}) | "head" | "left_upper_arm" | "right_upper_arm" | "left_forearm" | "right_forearm" | "left_hand" | "right_hand" | "upper_torso" | "lower_torso" | "crotch" | "left_thigh" | "right_thigh" | "left_calf" | "right_calf" | "left_foot" | "right_foot" | "neck" | "clothing";
756
756
  damage_source_id: SiegeDamageSourceId | null;
757
757
  damage_item_id: SiegeItemObjectId | null;
@@ -761,7 +761,7 @@ declare function module(): {
761
761
  players: {
762
762
  player_id: SiegePlayerId;
763
763
  final_health: number;
764
- final_life_state: (string & {}) | "downed" | "normal" | "overhealed" | "low_health" | "dead" | "respawning";
764
+ final_life_state: (string & {}) | "normal" | "overhealed" | "low_health" | "downed" | "dead" | "respawning";
765
765
  operator_name: {
766
766
  id: SiegeOperatorNameId;
767
767
  value: string;
@@ -773,7 +773,7 @@ declare function module(): {
773
773
  type: "phase_changed";
774
774
  creation_time: number;
775
775
  content: {
776
- phase: "invalid" | (string & {}) | "intro" | "planning" | "prep" | "action" | "results" | "first";
776
+ phase: "intro" | "planning" | "prep" | "action" | "results" | "invalid" | "first" | (string & {});
777
777
  };
778
778
  } | ((In: {
779
779
  game: "siege";
@@ -788,7 +788,7 @@ declare function module(): {
788
788
  is_enemy: boolean;
789
789
  is_squad_member: boolean;
790
790
  is_local_player: boolean;
791
- side: "attacker" | "defender" | "both" | "invalid" | (string & {});
791
+ side: "invalid" | (string & {}) | "attacker" | "defender" | "both";
792
792
  team: 0 | 1;
793
793
  platform: "invalid" | (string & {}) | "pc" | "xbox" | "playstation";
794
794
  is_privacy_username: boolean;
@@ -802,12 +802,12 @@ declare function module(): {
802
802
  game_mode_actions: number;
803
803
  score: number;
804
804
  };
805
- life_state: (string & {}) | "downed" | "normal" | "overhealed" | "low_health" | "dead" | "respawning";
805
+ life_state: (string & {}) | "normal" | "overhealed" | "low_health" | "downed" | "dead" | "respawning";
806
806
  ping: number;
807
807
  };
808
- }) => arktype2.Out<{
808
+ }) => arktype0.Out<{
809
809
  content: {
810
- starting_side: "attacker" | "defender" | "both" | "invalid" | (string & {});
810
+ starting_side: "invalid" | (string & {}) | "attacker" | "defender" | "both";
811
811
  player_id: SiegePlayerId;
812
812
  username: string;
813
813
  pc_username: string | null;
@@ -816,7 +816,7 @@ declare function module(): {
816
816
  is_enemy: boolean;
817
817
  is_squad_member: boolean;
818
818
  is_local_player: boolean;
819
- side: "attacker" | "defender" | "both" | "invalid" | (string & {});
819
+ side: "invalid" | (string & {}) | "attacker" | "defender" | "both";
820
820
  team: 0 | 1;
821
821
  platform: "invalid" | (string & {}) | "pc" | "xbox" | "playstation";
822
822
  is_privacy_username: boolean;
@@ -830,7 +830,7 @@ declare function module(): {
830
830
  game_mode_actions: number;
831
831
  score: number;
832
832
  };
833
- life_state: (string & {}) | "downed" | "normal" | "overhealed" | "low_health" | "dead" | "respawning";
833
+ life_state: (string & {}) | "normal" | "overhealed" | "low_health" | "downed" | "dead" | "respawning";
834
834
  ping: number;
835
835
  };
836
836
  game: "siege";
@@ -868,7 +868,7 @@ declare function module(): {
868
868
  creation_time: number;
869
869
  content: {
870
870
  player_id: SiegePlayerId;
871
- side: "attacker" | "defender" | "both" | "invalid" | (string & {});
871
+ side: "invalid" | (string & {}) | "attacker" | "defender" | "both";
872
872
  };
873
873
  } | {
874
874
  game: "siege";
@@ -953,7 +953,7 @@ declare function module(): {
953
953
  creation_time: number;
954
954
  content: {
955
955
  player_id: SiegePlayerId;
956
- life_state: (string & {}) | "downed" | "normal" | "overhealed" | "low_health" | "dead" | "respawning";
956
+ life_state: (string & {}) | "normal" | "overhealed" | "low_health" | "downed" | "dead" | "respawning";
957
957
  };
958
958
  } | {
959
959
  game: "siege";
@@ -1037,11 +1037,11 @@ declare function module(): {
1037
1037
  segment_size: number;
1038
1038
  segment_index: number;
1039
1039
  team_0: {
1040
- role: "attacker" | "defender" | "both" | "invalid" | (string & {});
1040
+ role: "invalid" | (string & {}) | "attacker" | "defender" | "both";
1041
1041
  state: SiegeRoundState;
1042
1042
  };
1043
1043
  team_1: {
1044
- role: "attacker" | "defender" | "both" | "invalid" | (string & {});
1044
+ role: "invalid" | (string & {}) | "attacker" | "defender" | "both";
1045
1045
  state: SiegeRoundState;
1046
1046
  };
1047
1047
  }[];
@@ -1076,7 +1076,7 @@ declare function module(): {
1076
1076
  content: {
1077
1077
  team: 0 | 1;
1078
1078
  index: number;
1079
- side: "attacker" | "defender" | "both" | "invalid" | (string & {});
1079
+ side: "invalid" | (string & {}) | "attacker" | "defender" | "both";
1080
1080
  };
1081
1081
  };
1082
1082
  operator_banned: {
@@ -1086,7 +1086,7 @@ declare function module(): {
1086
1086
  content: {
1087
1087
  team: 0 | 1;
1088
1088
  index: number;
1089
- side: "attacker" | "defender" | "both" | "invalid" | (string & {});
1089
+ side: "invalid" | (string & {}) | "attacker" | "defender" | "both";
1090
1090
  operator_name: {
1091
1091
  id: SiegeOperatorNameId;
1092
1092
  value: string;
@@ -1113,11 +1113,11 @@ declare function module(): {
1113
1113
  segment_size: number;
1114
1114
  segment_index: number;
1115
1115
  team_0: {
1116
- role: "attacker" | "defender" | "both" | "invalid" | (string & {});
1116
+ role: "invalid" | (string & {}) | "attacker" | "defender" | "both";
1117
1117
  state: SiegeRoundState;
1118
1118
  };
1119
1119
  team_1: {
1120
- role: "attacker" | "defender" | "both" | "invalid" | (string & {});
1120
+ role: "invalid" | (string & {}) | "attacker" | "defender" | "both";
1121
1121
  state: SiegeRoundState;
1122
1122
  };
1123
1123
  };
@@ -1128,8 +1128,8 @@ declare function module(): {
1128
1128
  remaining_health: number;
1129
1129
  pre_damage_health: number;
1130
1130
  max_health: number;
1131
- damage_type: "unknown" | "invalid" | (string & {}) | "bullet" | "melee" | "explosive" | "falling" | "regeneration" | "debris" | "projectile" | "downed" | "gas" | "thermal_explosion" | "melee_gadget" | "barbed_wire" | "electric" | "reinforcement" | "frag" | "paralyzed" | "emp" | "break" | "cleanup" | "interrogation" | "melee-finisher" | "toxic" | "toxic-explosion" | "pneumatic" | "body-contact" | "contact-explosion" | "flash" | "parasite-spike" | "laser" | "concussion" | "blowtorch" | "taser-shield" | "reverse-friendly-fire" | "self-destroyed" | "area-control" | "fire" | "breach-kick" | "break-wall" | "blade-mine" | "melee-pushback" | "supressive-fire" | "gas-pipe-fire";
1132
- damage_team_type: "unknown" | "invalid" | (string & {}) | "enemy" | "friendly";
1131
+ damage_type: "invalid" | "unknown" | (string & {}) | "downed" | "bullet" | "melee" | "explosive" | "falling" | "regeneration" | "debris" | "projectile" | "gas" | "thermal_explosion" | "melee_gadget" | "barbed_wire" | "electric" | "reinforcement" | "frag" | "paralyzed" | "emp" | "break" | "cleanup" | "interrogation" | "melee-finisher" | "toxic" | "toxic-explosion" | "pneumatic" | "body-contact" | "contact-explosion" | "flash" | "parasite-spike" | "laser" | "concussion" | "blowtorch" | "taser-shield" | "reverse-friendly-fire" | "self-destroyed" | "area-control" | "fire" | "breach-kick" | "break-wall" | "blade-mine" | "melee-pushback" | "supressive-fire" | "gas-pipe-fire";
1132
+ damage_team_type: "invalid" | "unknown" | (string & {}) | "enemy" | "friendly";
1133
1133
  damage_hit_zone: "invalid" | (string & {}) | "head" | "left_upper_arm" | "right_upper_arm" | "left_forearm" | "right_forearm" | "left_hand" | "right_hand" | "upper_torso" | "lower_torso" | "crotch" | "left_thigh" | "right_thigh" | "left_calf" | "right_calf" | "left_foot" | "right_foot" | "neck" | "clothing";
1134
1134
  damage_source_id: SiegeDamageSourceId | null;
1135
1135
  damage_item_id: SiegeItemObjectId | null;
@@ -1139,7 +1139,7 @@ declare function module(): {
1139
1139
  players: {
1140
1140
  player_id: SiegePlayerId;
1141
1141
  final_health: number;
1142
- final_life_state: (string & {}) | "downed" | "normal" | "overhealed" | "low_health" | "dead" | "respawning";
1142
+ final_life_state: (string & {}) | "normal" | "overhealed" | "low_health" | "downed" | "dead" | "respawning";
1143
1143
  operator_name: {
1144
1144
  id: SiegeOperatorNameId;
1145
1145
  value: string;
@@ -1152,7 +1152,7 @@ declare function module(): {
1152
1152
  type: "phase_changed";
1153
1153
  creation_time: number;
1154
1154
  content: {
1155
- phase: "invalid" | (string & {}) | "intro" | "planning" | "prep" | "action" | "results" | "first";
1155
+ phase: "intro" | "planning" | "prep" | "action" | "results" | "invalid" | "first" | (string & {});
1156
1156
  };
1157
1157
  };
1158
1158
  player_joined: (In: {
@@ -1168,7 +1168,7 @@ declare function module(): {
1168
1168
  is_enemy: boolean;
1169
1169
  is_squad_member: boolean;
1170
1170
  is_local_player: boolean;
1171
- side: "attacker" | "defender" | "both" | "invalid" | (string & {});
1171
+ side: "invalid" | (string & {}) | "attacker" | "defender" | "both";
1172
1172
  team: 0 | 1;
1173
1173
  platform: "invalid" | (string & {}) | "pc" | "xbox" | "playstation";
1174
1174
  is_privacy_username: boolean;
@@ -1182,12 +1182,12 @@ declare function module(): {
1182
1182
  game_mode_actions: number;
1183
1183
  score: number;
1184
1184
  };
1185
- life_state: (string & {}) | "downed" | "normal" | "overhealed" | "low_health" | "dead" | "respawning";
1185
+ life_state: (string & {}) | "normal" | "overhealed" | "low_health" | "downed" | "dead" | "respawning";
1186
1186
  ping: number;
1187
1187
  };
1188
- }) => arktype2.Out<{
1188
+ }) => arktype0.Out<{
1189
1189
  content: {
1190
- starting_side: "attacker" | "defender" | "both" | "invalid" | (string & {});
1190
+ starting_side: "invalid" | (string & {}) | "attacker" | "defender" | "both";
1191
1191
  player_id: SiegePlayerId;
1192
1192
  username: string;
1193
1193
  pc_username: string | null;
@@ -1196,7 +1196,7 @@ declare function module(): {
1196
1196
  is_enemy: boolean;
1197
1197
  is_squad_member: boolean;
1198
1198
  is_local_player: boolean;
1199
- side: "attacker" | "defender" | "both" | "invalid" | (string & {});
1199
+ side: "invalid" | (string & {}) | "attacker" | "defender" | "both";
1200
1200
  team: 0 | 1;
1201
1201
  platform: "invalid" | (string & {}) | "pc" | "xbox" | "playstation";
1202
1202
  is_privacy_username: boolean;
@@ -1210,7 +1210,7 @@ declare function module(): {
1210
1210
  game_mode_actions: number;
1211
1211
  score: number;
1212
1212
  };
1213
- life_state: (string & {}) | "downed" | "normal" | "overhealed" | "low_health" | "dead" | "respawning";
1213
+ life_state: (string & {}) | "normal" | "overhealed" | "low_health" | "downed" | "dead" | "respawning";
1214
1214
  ping: number;
1215
1215
  };
1216
1216
  game: "siege";
@@ -1252,7 +1252,7 @@ declare function module(): {
1252
1252
  creation_time: number;
1253
1253
  content: {
1254
1254
  player_id: SiegePlayerId;
1255
- side: "attacker" | "defender" | "both" | "invalid" | (string & {});
1255
+ side: "invalid" | (string & {}) | "attacker" | "defender" | "both";
1256
1256
  };
1257
1257
  };
1258
1258
  player_score_changed: {
@@ -1348,7 +1348,7 @@ declare function module(): {
1348
1348
  creation_time: number;
1349
1349
  content: {
1350
1350
  player_id: SiegePlayerId;
1351
- life_state: (string & {}) | "downed" | "normal" | "overhealed" | "low_health" | "dead" | "respawning";
1351
+ life_state: (string & {}) | "normal" | "overhealed" | "low_health" | "downed" | "dead" | "respawning";
1352
1352
  };
1353
1353
  };
1354
1354
  player_died: {
@@ -1434,8 +1434,8 @@ declare const PlayerDamageDataSchema: arktype_internal_variants_object_ts0.Objec
1434
1434
  remaining_health: number;
1435
1435
  pre_damage_health: number;
1436
1436
  max_health: number;
1437
- damage_type: "unknown" | "invalid" | (string & {}) | "bullet" | "melee" | "explosive" | "falling" | "regeneration" | "debris" | "projectile" | "downed" | "gas" | "thermal_explosion" | "melee_gadget" | "barbed_wire" | "electric" | "reinforcement" | "frag" | "paralyzed" | "emp" | "break" | "cleanup" | "interrogation" | "melee-finisher" | "toxic" | "toxic-explosion" | "pneumatic" | "body-contact" | "contact-explosion" | "flash" | "parasite-spike" | "laser" | "concussion" | "blowtorch" | "taser-shield" | "reverse-friendly-fire" | "self-destroyed" | "area-control" | "fire" | "breach-kick" | "break-wall" | "blade-mine" | "melee-pushback" | "supressive-fire" | "gas-pipe-fire";
1438
- damage_team_type: "unknown" | "invalid" | (string & {}) | "enemy" | "friendly";
1437
+ damage_type: "invalid" | "unknown" | (string & {}) | "downed" | "bullet" | "melee" | "explosive" | "falling" | "regeneration" | "debris" | "projectile" | "gas" | "thermal_explosion" | "melee_gadget" | "barbed_wire" | "electric" | "reinforcement" | "frag" | "paralyzed" | "emp" | "break" | "cleanup" | "interrogation" | "melee-finisher" | "toxic" | "toxic-explosion" | "pneumatic" | "body-contact" | "contact-explosion" | "flash" | "parasite-spike" | "laser" | "concussion" | "blowtorch" | "taser-shield" | "reverse-friendly-fire" | "self-destroyed" | "area-control" | "fire" | "breach-kick" | "break-wall" | "blade-mine" | "melee-pushback" | "supressive-fire" | "gas-pipe-fire";
1438
+ damage_team_type: "invalid" | "unknown" | (string & {}) | "enemy" | "friendly";
1439
1439
  damage_hit_zone: "invalid" | (string & {}) | "head" | "left_upper_arm" | "right_upper_arm" | "left_forearm" | "right_forearm" | "left_hand" | "right_hand" | "upper_torso" | "lower_torso" | "crotch" | "left_thigh" | "right_thigh" | "left_calf" | "right_calf" | "left_foot" | "right_foot" | "neck" | "clothing";
1440
1440
  damage_source_id: SiegeDamageSourceId | null;
1441
1441
  damage_item_id: SiegeItemObjectId | null;
@@ -1449,11 +1449,11 @@ declare const MatchRoundDataSchema: arktype_internal_variants_object_ts0.ObjectT
1449
1449
  segment_size: number;
1450
1450
  segment_index: number;
1451
1451
  team_0: {
1452
- role: "attacker" | "defender" | "both" | "invalid" | (string & {});
1452
+ role: "invalid" | (string & {}) | "attacker" | "defender" | "both";
1453
1453
  state: SiegeRoundState;
1454
1454
  };
1455
1455
  team_1: {
1456
- role: "attacker" | "defender" | "both" | "invalid" | (string & {});
1456
+ role: "invalid" | (string & {}) | "attacker" | "defender" | "both";
1457
1457
  state: SiegeRoundState;
1458
1458
  };
1459
1459
  }, {}>;
@@ -1472,7 +1472,7 @@ type MapData = typeof MapDataSchema.infer;
1472
1472
  declare const RoundEndPlayerDataSchema: arktype_internal_variants_object_ts0.ObjectType<{
1473
1473
  player_id: SiegePlayerId;
1474
1474
  final_health: number;
1475
- final_life_state: (string & {}) | "downed" | "normal" | "overhealed" | "low_health" | "dead" | "respawning";
1475
+ final_life_state: (string & {}) | "normal" | "overhealed" | "low_health" | "downed" | "dead" | "respawning";
1476
1476
  operator_name: {
1477
1477
  id: SiegeOperatorNameId;
1478
1478
  value: string;
@@ -1486,11 +1486,11 @@ declare const RoundEndDataSchema: arktype_internal_variants_object_ts0.ObjectTyp
1486
1486
  segment_size: number;
1487
1487
  segment_index: number;
1488
1488
  team_0: {
1489
- role: "attacker" | "defender" | "both" | "invalid" | (string & {});
1489
+ role: "invalid" | (string & {}) | "attacker" | "defender" | "both";
1490
1490
  state: SiegeRoundState;
1491
1491
  };
1492
1492
  team_1: {
1493
- role: "attacker" | "defender" | "both" | "invalid" | (string & {});
1493
+ role: "invalid" | (string & {}) | "attacker" | "defender" | "both";
1494
1494
  state: SiegeRoundState;
1495
1495
  };
1496
1496
  };
@@ -1501,8 +1501,8 @@ declare const RoundEndDataSchema: arktype_internal_variants_object_ts0.ObjectTyp
1501
1501
  remaining_health: number;
1502
1502
  pre_damage_health: number;
1503
1503
  max_health: number;
1504
- damage_type: "unknown" | "invalid" | (string & {}) | "bullet" | "melee" | "explosive" | "falling" | "regeneration" | "debris" | "projectile" | "downed" | "gas" | "thermal_explosion" | "melee_gadget" | "barbed_wire" | "electric" | "reinforcement" | "frag" | "paralyzed" | "emp" | "break" | "cleanup" | "interrogation" | "melee-finisher" | "toxic" | "toxic-explosion" | "pneumatic" | "body-contact" | "contact-explosion" | "flash" | "parasite-spike" | "laser" | "concussion" | "blowtorch" | "taser-shield" | "reverse-friendly-fire" | "self-destroyed" | "area-control" | "fire" | "breach-kick" | "break-wall" | "blade-mine" | "melee-pushback" | "supressive-fire" | "gas-pipe-fire";
1505
- damage_team_type: "unknown" | "invalid" | (string & {}) | "enemy" | "friendly";
1504
+ damage_type: "invalid" | "unknown" | (string & {}) | "downed" | "bullet" | "melee" | "explosive" | "falling" | "regeneration" | "debris" | "projectile" | "gas" | "thermal_explosion" | "melee_gadget" | "barbed_wire" | "electric" | "reinforcement" | "frag" | "paralyzed" | "emp" | "break" | "cleanup" | "interrogation" | "melee-finisher" | "toxic" | "toxic-explosion" | "pneumatic" | "body-contact" | "contact-explosion" | "flash" | "parasite-spike" | "laser" | "concussion" | "blowtorch" | "taser-shield" | "reverse-friendly-fire" | "self-destroyed" | "area-control" | "fire" | "breach-kick" | "break-wall" | "blade-mine" | "melee-pushback" | "supressive-fire" | "gas-pipe-fire";
1505
+ damage_team_type: "invalid" | "unknown" | (string & {}) | "enemy" | "friendly";
1506
1506
  damage_hit_zone: "invalid" | (string & {}) | "head" | "left_upper_arm" | "right_upper_arm" | "left_forearm" | "right_forearm" | "left_hand" | "right_hand" | "upper_torso" | "lower_torso" | "crotch" | "left_thigh" | "right_thigh" | "left_calf" | "right_calf" | "left_foot" | "right_foot" | "neck" | "clothing";
1507
1507
  damage_source_id: SiegeDamageSourceId | null;
1508
1508
  damage_item_id: SiegeItemObjectId | null;
@@ -1512,7 +1512,7 @@ declare const RoundEndDataSchema: arktype_internal_variants_object_ts0.ObjectTyp
1512
1512
  players: {
1513
1513
  player_id: SiegePlayerId;
1514
1514
  final_health: number;
1515
- final_life_state: (string & {}) | "downed" | "normal" | "overhealed" | "low_health" | "dead" | "respawning";
1515
+ final_life_state: (string & {}) | "normal" | "overhealed" | "low_health" | "downed" | "dead" | "respawning";
1516
1516
  operator_name: {
1517
1517
  id: SiegeOperatorNameId;
1518
1518
  value: string;
@@ -1552,11 +1552,11 @@ declare const MatchStarted: arktype_internal_variants_object_ts0.ObjectType<{
1552
1552
  segment_size: number;
1553
1553
  segment_index: number;
1554
1554
  team_0: {
1555
- role: "attacker" | "defender" | "both" | "invalid" | (string & {});
1555
+ role: "invalid" | (string & {}) | "attacker" | "defender" | "both";
1556
1556
  state: SiegeRoundState;
1557
1557
  };
1558
1558
  team_1: {
1559
- role: "attacker" | "defender" | "both" | "invalid" | (string & {});
1559
+ role: "invalid" | (string & {}) | "attacker" | "defender" | "both";
1560
1560
  state: SiegeRoundState;
1561
1561
  };
1562
1562
  }[];
@@ -1624,7 +1624,7 @@ declare const OperatorBanVotingStarted: arktype_internal_variants_object_ts0.Obj
1624
1624
  content: {
1625
1625
  team: 0 | 1;
1626
1626
  index: number;
1627
- side: "attacker" | "defender" | "both" | "invalid" | (string & {});
1627
+ side: "invalid" | (string & {}) | "attacker" | "defender" | "both";
1628
1628
  };
1629
1629
  }, {}>;
1630
1630
  type OperatorBanVotingStartedEvent = typeof OperatorBanVotingStarted.infer;
@@ -1637,7 +1637,7 @@ declare const OperatorBanned: arktype_internal_variants_object_ts0.ObjectType<{
1637
1637
  content: {
1638
1638
  team: 0 | 1;
1639
1639
  index: number;
1640
- side: "attacker" | "defender" | "both" | "invalid" | (string & {});
1640
+ side: "invalid" | (string & {}) | "attacker" | "defender" | "both";
1641
1641
  operator_name: {
1642
1642
  id: SiegeOperatorNameId;
1643
1643
  value: string;
@@ -1670,11 +1670,11 @@ declare const RoundEnded: arktype_internal_variants_object_ts0.ObjectType<{
1670
1670
  segment_size: number;
1671
1671
  segment_index: number;
1672
1672
  team_0: {
1673
- role: "attacker" | "defender" | "both" | "invalid" | (string & {});
1673
+ role: "invalid" | (string & {}) | "attacker" | "defender" | "both";
1674
1674
  state: SiegeRoundState;
1675
1675
  };
1676
1676
  team_1: {
1677
- role: "attacker" | "defender" | "both" | "invalid" | (string & {});
1677
+ role: "invalid" | (string & {}) | "attacker" | "defender" | "both";
1678
1678
  state: SiegeRoundState;
1679
1679
  };
1680
1680
  };
@@ -1685,8 +1685,8 @@ declare const RoundEnded: arktype_internal_variants_object_ts0.ObjectType<{
1685
1685
  remaining_health: number;
1686
1686
  pre_damage_health: number;
1687
1687
  max_health: number;
1688
- damage_type: "unknown" | "invalid" | (string & {}) | "bullet" | "melee" | "explosive" | "falling" | "regeneration" | "debris" | "projectile" | "downed" | "gas" | "thermal_explosion" | "melee_gadget" | "barbed_wire" | "electric" | "reinforcement" | "frag" | "paralyzed" | "emp" | "break" | "cleanup" | "interrogation" | "melee-finisher" | "toxic" | "toxic-explosion" | "pneumatic" | "body-contact" | "contact-explosion" | "flash" | "parasite-spike" | "laser" | "concussion" | "blowtorch" | "taser-shield" | "reverse-friendly-fire" | "self-destroyed" | "area-control" | "fire" | "breach-kick" | "break-wall" | "blade-mine" | "melee-pushback" | "supressive-fire" | "gas-pipe-fire";
1689
- damage_team_type: "unknown" | "invalid" | (string & {}) | "enemy" | "friendly";
1688
+ damage_type: "invalid" | "unknown" | (string & {}) | "downed" | "bullet" | "melee" | "explosive" | "falling" | "regeneration" | "debris" | "projectile" | "gas" | "thermal_explosion" | "melee_gadget" | "barbed_wire" | "electric" | "reinforcement" | "frag" | "paralyzed" | "emp" | "break" | "cleanup" | "interrogation" | "melee-finisher" | "toxic" | "toxic-explosion" | "pneumatic" | "body-contact" | "contact-explosion" | "flash" | "parasite-spike" | "laser" | "concussion" | "blowtorch" | "taser-shield" | "reverse-friendly-fire" | "self-destroyed" | "area-control" | "fire" | "breach-kick" | "break-wall" | "blade-mine" | "melee-pushback" | "supressive-fire" | "gas-pipe-fire";
1689
+ damage_team_type: "invalid" | "unknown" | (string & {}) | "enemy" | "friendly";
1690
1690
  damage_hit_zone: "invalid" | (string & {}) | "head" | "left_upper_arm" | "right_upper_arm" | "left_forearm" | "right_forearm" | "left_hand" | "right_hand" | "upper_torso" | "lower_torso" | "crotch" | "left_thigh" | "right_thigh" | "left_calf" | "right_calf" | "left_foot" | "right_foot" | "neck" | "clothing";
1691
1691
  damage_source_id: SiegeDamageSourceId | null;
1692
1692
  damage_item_id: SiegeItemObjectId | null;
@@ -1696,7 +1696,7 @@ declare const RoundEnded: arktype_internal_variants_object_ts0.ObjectType<{
1696
1696
  players: {
1697
1697
  player_id: SiegePlayerId;
1698
1698
  final_health: number;
1699
- final_life_state: (string & {}) | "downed" | "normal" | "overhealed" | "low_health" | "dead" | "respawning";
1699
+ final_life_state: (string & {}) | "normal" | "overhealed" | "low_health" | "downed" | "dead" | "respawning";
1700
1700
  operator_name: {
1701
1701
  id: SiegeOperatorNameId;
1702
1702
  value: string;
@@ -1712,7 +1712,7 @@ declare const PhaseChanged: arktype_internal_variants_object_ts0.ObjectType<{
1712
1712
  type: "phase_changed";
1713
1713
  creation_time: number;
1714
1714
  content: {
1715
- phase: "invalid" | (string & {}) | "intro" | "planning" | "prep" | "action" | "results" | "first";
1715
+ phase: "intro" | "planning" | "prep" | "action" | "results" | "invalid" | "first" | (string & {});
1716
1716
  };
1717
1717
  }, {}>;
1718
1718
  type PhaseChangedEvent = typeof PhaseChanged.infer;
@@ -1731,7 +1731,7 @@ declare const PlayerJoined: arktype_internal_variants_object_ts0.ObjectType<(In:
1731
1731
  is_enemy: boolean;
1732
1732
  is_squad_member: boolean;
1733
1733
  is_local_player: boolean;
1734
- side: "attacker" | "defender" | "both" | "invalid" | (string & {});
1734
+ side: "invalid" | (string & {}) | "attacker" | "defender" | "both";
1735
1735
  team: 0 | 1;
1736
1736
  platform: "invalid" | (string & {}) | "pc" | "xbox" | "playstation";
1737
1737
  is_privacy_username: boolean;
@@ -1745,12 +1745,12 @@ declare const PlayerJoined: arktype_internal_variants_object_ts0.ObjectType<(In:
1745
1745
  game_mode_actions: number;
1746
1746
  score: number;
1747
1747
  };
1748
- life_state: (string & {}) | "downed" | "normal" | "overhealed" | "low_health" | "dead" | "respawning";
1748
+ life_state: (string & {}) | "normal" | "overhealed" | "low_health" | "downed" | "dead" | "respawning";
1749
1749
  ping: number;
1750
1750
  };
1751
- }) => arktype2.Out<{
1751
+ }) => arktype0.Out<{
1752
1752
  content: {
1753
- starting_side: "attacker" | "defender" | "both" | "invalid" | (string & {});
1753
+ starting_side: "invalid" | (string & {}) | "attacker" | "defender" | "both";
1754
1754
  player_id: SiegePlayerId;
1755
1755
  username: string;
1756
1756
  pc_username: string | null;
@@ -1759,7 +1759,7 @@ declare const PlayerJoined: arktype_internal_variants_object_ts0.ObjectType<(In:
1759
1759
  is_enemy: boolean;
1760
1760
  is_squad_member: boolean;
1761
1761
  is_local_player: boolean;
1762
- side: "attacker" | "defender" | "both" | "invalid" | (string & {});
1762
+ side: "invalid" | (string & {}) | "attacker" | "defender" | "both";
1763
1763
  team: 0 | 1;
1764
1764
  platform: "invalid" | (string & {}) | "pc" | "xbox" | "playstation";
1765
1765
  is_privacy_username: boolean;
@@ -1773,7 +1773,7 @@ declare const PlayerJoined: arktype_internal_variants_object_ts0.ObjectType<(In:
1773
1773
  game_mode_actions: number;
1774
1774
  score: number;
1775
1775
  };
1776
- life_state: (string & {}) | "downed" | "normal" | "overhealed" | "low_health" | "dead" | "respawning";
1776
+ life_state: (string & {}) | "normal" | "overhealed" | "low_health" | "downed" | "dead" | "respawning";
1777
1777
  ping: number;
1778
1778
  };
1779
1779
  game: "siege";
@@ -1827,7 +1827,7 @@ declare const PlayerSideChanged: arktype_internal_variants_object_ts0.ObjectType
1827
1827
  creation_time: number;
1828
1828
  content: {
1829
1829
  player_id: SiegePlayerId;
1830
- side: "attacker" | "defender" | "both" | "invalid" | (string & {});
1830
+ side: "invalid" | (string & {}) | "attacker" | "defender" | "both";
1831
1831
  };
1832
1832
  }, {}>;
1833
1833
  type PlayerSideChangedEvent = typeof PlayerSideChanged.infer;
@@ -1956,7 +1956,7 @@ declare const PlayerLifeStateChanged: arktype_internal_variants_object_ts0.Objec
1956
1956
  creation_time: number;
1957
1957
  content: {
1958
1958
  player_id: SiegePlayerId;
1959
- life_state: (string & {}) | "downed" | "normal" | "overhealed" | "low_health" | "dead" | "respawning";
1959
+ life_state: (string & {}) | "normal" | "overhealed" | "low_health" | "downed" | "dead" | "respawning";
1960
1960
  };
1961
1961
  }, {}>;
1962
1962
  type PlayerLifeStateChangedEvent = typeof PlayerLifeStateChanged.infer;
@@ -2011,7 +2011,7 @@ declare const PlayerTeamChanged: arktype_internal_variants_object_ts0.ObjectType
2011
2011
  type PlayerTeamChangedEvent = typeof PlayerTeamChanged.infer;
2012
2012
  //#endregion
2013
2013
  //#region src/events/index.d.ts
2014
- declare const siegeEvents: arktype2.Module<{
2014
+ declare const siegeEvents: arktype0.Module<{
2015
2015
  event: {
2016
2016
  game: "siege";
2017
2017
  type: "started_queuing";
@@ -2058,11 +2058,11 @@ declare const siegeEvents: arktype2.Module<{
2058
2058
  segment_size: number;
2059
2059
  segment_index: number;
2060
2060
  team_0: {
2061
- role: "attacker" | "defender" | "both" | "invalid" | (string & {});
2061
+ role: "invalid" | (string & {}) | "attacker" | "defender" | "both";
2062
2062
  state: SiegeRoundState;
2063
2063
  };
2064
2064
  team_1: {
2065
- role: "attacker" | "defender" | "both" | "invalid" | (string & {});
2065
+ role: "invalid" | (string & {}) | "attacker" | "defender" | "both";
2066
2066
  state: SiegeRoundState;
2067
2067
  };
2068
2068
  }[];
@@ -2094,7 +2094,7 @@ declare const siegeEvents: arktype2.Module<{
2094
2094
  content: {
2095
2095
  team: 0 | 1;
2096
2096
  index: number;
2097
- side: "attacker" | "defender" | "both" | "invalid" | (string & {});
2097
+ side: "invalid" | (string & {}) | "attacker" | "defender" | "both";
2098
2098
  };
2099
2099
  } | {
2100
2100
  game: "siege";
@@ -2103,7 +2103,7 @@ declare const siegeEvents: arktype2.Module<{
2103
2103
  content: {
2104
2104
  team: 0 | 1;
2105
2105
  index: number;
2106
- side: "attacker" | "defender" | "both" | "invalid" | (string & {});
2106
+ side: "invalid" | (string & {}) | "attacker" | "defender" | "both";
2107
2107
  operator_name: {
2108
2108
  id: SiegeOperatorNameId;
2109
2109
  value: string;
@@ -2128,11 +2128,11 @@ declare const siegeEvents: arktype2.Module<{
2128
2128
  segment_size: number;
2129
2129
  segment_index: number;
2130
2130
  team_0: {
2131
- role: "attacker" | "defender" | "both" | "invalid" | (string & {});
2131
+ role: "invalid" | (string & {}) | "attacker" | "defender" | "both";
2132
2132
  state: SiegeRoundState;
2133
2133
  };
2134
2134
  team_1: {
2135
- role: "attacker" | "defender" | "both" | "invalid" | (string & {});
2135
+ role: "invalid" | (string & {}) | "attacker" | "defender" | "both";
2136
2136
  state: SiegeRoundState;
2137
2137
  };
2138
2138
  };
@@ -2143,8 +2143,8 @@ declare const siegeEvents: arktype2.Module<{
2143
2143
  remaining_health: number;
2144
2144
  pre_damage_health: number;
2145
2145
  max_health: number;
2146
- damage_type: "unknown" | "invalid" | (string & {}) | "bullet" | "melee" | "explosive" | "falling" | "regeneration" | "debris" | "projectile" | "downed" | "gas" | "thermal_explosion" | "melee_gadget" | "barbed_wire" | "electric" | "reinforcement" | "frag" | "paralyzed" | "emp" | "break" | "cleanup" | "interrogation" | "melee-finisher" | "toxic" | "toxic-explosion" | "pneumatic" | "body-contact" | "contact-explosion" | "flash" | "parasite-spike" | "laser" | "concussion" | "blowtorch" | "taser-shield" | "reverse-friendly-fire" | "self-destroyed" | "area-control" | "fire" | "breach-kick" | "break-wall" | "blade-mine" | "melee-pushback" | "supressive-fire" | "gas-pipe-fire";
2147
- damage_team_type: "unknown" | "invalid" | (string & {}) | "enemy" | "friendly";
2146
+ damage_type: "invalid" | "unknown" | (string & {}) | "downed" | "bullet" | "melee" | "explosive" | "falling" | "regeneration" | "debris" | "projectile" | "gas" | "thermal_explosion" | "melee_gadget" | "barbed_wire" | "electric" | "reinforcement" | "frag" | "paralyzed" | "emp" | "break" | "cleanup" | "interrogation" | "melee-finisher" | "toxic" | "toxic-explosion" | "pneumatic" | "body-contact" | "contact-explosion" | "flash" | "parasite-spike" | "laser" | "concussion" | "blowtorch" | "taser-shield" | "reverse-friendly-fire" | "self-destroyed" | "area-control" | "fire" | "breach-kick" | "break-wall" | "blade-mine" | "melee-pushback" | "supressive-fire" | "gas-pipe-fire";
2147
+ damage_team_type: "invalid" | "unknown" | (string & {}) | "enemy" | "friendly";
2148
2148
  damage_hit_zone: "invalid" | (string & {}) | "head" | "left_upper_arm" | "right_upper_arm" | "left_forearm" | "right_forearm" | "left_hand" | "right_hand" | "upper_torso" | "lower_torso" | "crotch" | "left_thigh" | "right_thigh" | "left_calf" | "right_calf" | "left_foot" | "right_foot" | "neck" | "clothing";
2149
2149
  damage_source_id: SiegeDamageSourceId | null;
2150
2150
  damage_item_id: SiegeItemObjectId | null;
@@ -2154,7 +2154,7 @@ declare const siegeEvents: arktype2.Module<{
2154
2154
  players: {
2155
2155
  player_id: SiegePlayerId;
2156
2156
  final_health: number;
2157
- final_life_state: (string & {}) | "downed" | "normal" | "overhealed" | "low_health" | "dead" | "respawning";
2157
+ final_life_state: (string & {}) | "normal" | "overhealed" | "low_health" | "downed" | "dead" | "respawning";
2158
2158
  operator_name: {
2159
2159
  id: SiegeOperatorNameId;
2160
2160
  value: string;
@@ -2166,7 +2166,7 @@ declare const siegeEvents: arktype2.Module<{
2166
2166
  type: "phase_changed";
2167
2167
  creation_time: number;
2168
2168
  content: {
2169
- phase: "invalid" | (string & {}) | "intro" | "planning" | "prep" | "action" | "results" | "first";
2169
+ phase: "intro" | "planning" | "prep" | "action" | "results" | "invalid" | "first" | (string & {});
2170
2170
  };
2171
2171
  } | ((In: {
2172
2172
  game: "siege";
@@ -2181,7 +2181,7 @@ declare const siegeEvents: arktype2.Module<{
2181
2181
  is_enemy: boolean;
2182
2182
  is_squad_member: boolean;
2183
2183
  is_local_player: boolean;
2184
- side: "attacker" | "defender" | "both" | "invalid" | (string & {});
2184
+ side: "invalid" | (string & {}) | "attacker" | "defender" | "both";
2185
2185
  team: 0 | 1;
2186
2186
  platform: "invalid" | (string & {}) | "pc" | "xbox" | "playstation";
2187
2187
  is_privacy_username: boolean;
@@ -2195,12 +2195,12 @@ declare const siegeEvents: arktype2.Module<{
2195
2195
  game_mode_actions: number;
2196
2196
  score: number;
2197
2197
  };
2198
- life_state: (string & {}) | "downed" | "normal" | "overhealed" | "low_health" | "dead" | "respawning";
2198
+ life_state: (string & {}) | "normal" | "overhealed" | "low_health" | "downed" | "dead" | "respawning";
2199
2199
  ping: number;
2200
2200
  };
2201
- }) => arktype2.Out<{
2201
+ }) => arktype0.Out<{
2202
2202
  content: {
2203
- starting_side: "attacker" | "defender" | "both" | "invalid" | (string & {});
2203
+ starting_side: "invalid" | (string & {}) | "attacker" | "defender" | "both";
2204
2204
  player_id: SiegePlayerId;
2205
2205
  username: string;
2206
2206
  pc_username: string | null;
@@ -2209,7 +2209,7 @@ declare const siegeEvents: arktype2.Module<{
2209
2209
  is_enemy: boolean;
2210
2210
  is_squad_member: boolean;
2211
2211
  is_local_player: boolean;
2212
- side: "attacker" | "defender" | "both" | "invalid" | (string & {});
2212
+ side: "invalid" | (string & {}) | "attacker" | "defender" | "both";
2213
2213
  team: 0 | 1;
2214
2214
  platform: "invalid" | (string & {}) | "pc" | "xbox" | "playstation";
2215
2215
  is_privacy_username: boolean;
@@ -2223,7 +2223,7 @@ declare const siegeEvents: arktype2.Module<{
2223
2223
  game_mode_actions: number;
2224
2224
  score: number;
2225
2225
  };
2226
- life_state: (string & {}) | "downed" | "normal" | "overhealed" | "low_health" | "dead" | "respawning";
2226
+ life_state: (string & {}) | "normal" | "overhealed" | "low_health" | "downed" | "dead" | "respawning";
2227
2227
  ping: number;
2228
2228
  };
2229
2229
  game: "siege";
@@ -2261,7 +2261,7 @@ declare const siegeEvents: arktype2.Module<{
2261
2261
  creation_time: number;
2262
2262
  content: {
2263
2263
  player_id: SiegePlayerId;
2264
- side: "attacker" | "defender" | "both" | "invalid" | (string & {});
2264
+ side: "invalid" | (string & {}) | "attacker" | "defender" | "both";
2265
2265
  };
2266
2266
  } | {
2267
2267
  game: "siege";
@@ -2346,7 +2346,7 @@ declare const siegeEvents: arktype2.Module<{
2346
2346
  creation_time: number;
2347
2347
  content: {
2348
2348
  player_id: SiegePlayerId;
2349
- life_state: (string & {}) | "downed" | "normal" | "overhealed" | "low_health" | "dead" | "respawning";
2349
+ life_state: (string & {}) | "normal" | "overhealed" | "low_health" | "downed" | "dead" | "respawning";
2350
2350
  };
2351
2351
  } | {
2352
2352
  game: "siege";
@@ -2430,11 +2430,11 @@ declare const siegeEvents: arktype2.Module<{
2430
2430
  segment_size: number;
2431
2431
  segment_index: number;
2432
2432
  team_0: {
2433
- role: "attacker" | "defender" | "both" | "invalid" | (string & {});
2433
+ role: "invalid" | (string & {}) | "attacker" | "defender" | "both";
2434
2434
  state: SiegeRoundState;
2435
2435
  };
2436
2436
  team_1: {
2437
- role: "attacker" | "defender" | "both" | "invalid" | (string & {});
2437
+ role: "invalid" | (string & {}) | "attacker" | "defender" | "both";
2438
2438
  state: SiegeRoundState;
2439
2439
  };
2440
2440
  }[];
@@ -2469,7 +2469,7 @@ declare const siegeEvents: arktype2.Module<{
2469
2469
  content: {
2470
2470
  team: 0 | 1;
2471
2471
  index: number;
2472
- side: "attacker" | "defender" | "both" | "invalid" | (string & {});
2472
+ side: "invalid" | (string & {}) | "attacker" | "defender" | "both";
2473
2473
  };
2474
2474
  };
2475
2475
  operator_banned: {
@@ -2479,7 +2479,7 @@ declare const siegeEvents: arktype2.Module<{
2479
2479
  content: {
2480
2480
  team: 0 | 1;
2481
2481
  index: number;
2482
- side: "attacker" | "defender" | "both" | "invalid" | (string & {});
2482
+ side: "invalid" | (string & {}) | "attacker" | "defender" | "both";
2483
2483
  operator_name: {
2484
2484
  id: SiegeOperatorNameId;
2485
2485
  value: string;
@@ -2506,11 +2506,11 @@ declare const siegeEvents: arktype2.Module<{
2506
2506
  segment_size: number;
2507
2507
  segment_index: number;
2508
2508
  team_0: {
2509
- role: "attacker" | "defender" | "both" | "invalid" | (string & {});
2509
+ role: "invalid" | (string & {}) | "attacker" | "defender" | "both";
2510
2510
  state: SiegeRoundState;
2511
2511
  };
2512
2512
  team_1: {
2513
- role: "attacker" | "defender" | "both" | "invalid" | (string & {});
2513
+ role: "invalid" | (string & {}) | "attacker" | "defender" | "both";
2514
2514
  state: SiegeRoundState;
2515
2515
  };
2516
2516
  };
@@ -2521,8 +2521,8 @@ declare const siegeEvents: arktype2.Module<{
2521
2521
  remaining_health: number;
2522
2522
  pre_damage_health: number;
2523
2523
  max_health: number;
2524
- damage_type: "unknown" | "invalid" | (string & {}) | "bullet" | "melee" | "explosive" | "falling" | "regeneration" | "debris" | "projectile" | "downed" | "gas" | "thermal_explosion" | "melee_gadget" | "barbed_wire" | "electric" | "reinforcement" | "frag" | "paralyzed" | "emp" | "break" | "cleanup" | "interrogation" | "melee-finisher" | "toxic" | "toxic-explosion" | "pneumatic" | "body-contact" | "contact-explosion" | "flash" | "parasite-spike" | "laser" | "concussion" | "blowtorch" | "taser-shield" | "reverse-friendly-fire" | "self-destroyed" | "area-control" | "fire" | "breach-kick" | "break-wall" | "blade-mine" | "melee-pushback" | "supressive-fire" | "gas-pipe-fire";
2525
- damage_team_type: "unknown" | "invalid" | (string & {}) | "enemy" | "friendly";
2524
+ damage_type: "invalid" | "unknown" | (string & {}) | "downed" | "bullet" | "melee" | "explosive" | "falling" | "regeneration" | "debris" | "projectile" | "gas" | "thermal_explosion" | "melee_gadget" | "barbed_wire" | "electric" | "reinforcement" | "frag" | "paralyzed" | "emp" | "break" | "cleanup" | "interrogation" | "melee-finisher" | "toxic" | "toxic-explosion" | "pneumatic" | "body-contact" | "contact-explosion" | "flash" | "parasite-spike" | "laser" | "concussion" | "blowtorch" | "taser-shield" | "reverse-friendly-fire" | "self-destroyed" | "area-control" | "fire" | "breach-kick" | "break-wall" | "blade-mine" | "melee-pushback" | "supressive-fire" | "gas-pipe-fire";
2525
+ damage_team_type: "invalid" | "unknown" | (string & {}) | "enemy" | "friendly";
2526
2526
  damage_hit_zone: "invalid" | (string & {}) | "head" | "left_upper_arm" | "right_upper_arm" | "left_forearm" | "right_forearm" | "left_hand" | "right_hand" | "upper_torso" | "lower_torso" | "crotch" | "left_thigh" | "right_thigh" | "left_calf" | "right_calf" | "left_foot" | "right_foot" | "neck" | "clothing";
2527
2527
  damage_source_id: SiegeDamageSourceId | null;
2528
2528
  damage_item_id: SiegeItemObjectId | null;
@@ -2532,7 +2532,7 @@ declare const siegeEvents: arktype2.Module<{
2532
2532
  players: {
2533
2533
  player_id: SiegePlayerId;
2534
2534
  final_health: number;
2535
- final_life_state: (string & {}) | "downed" | "normal" | "overhealed" | "low_health" | "dead" | "respawning";
2535
+ final_life_state: (string & {}) | "normal" | "overhealed" | "low_health" | "downed" | "dead" | "respawning";
2536
2536
  operator_name: {
2537
2537
  id: SiegeOperatorNameId;
2538
2538
  value: string;
@@ -2545,7 +2545,7 @@ declare const siegeEvents: arktype2.Module<{
2545
2545
  type: "phase_changed";
2546
2546
  creation_time: number;
2547
2547
  content: {
2548
- phase: "invalid" | (string & {}) | "intro" | "planning" | "prep" | "action" | "results" | "first";
2548
+ phase: "intro" | "planning" | "prep" | "action" | "results" | "invalid" | "first" | (string & {});
2549
2549
  };
2550
2550
  };
2551
2551
  player_joined: (In: {
@@ -2561,7 +2561,7 @@ declare const siegeEvents: arktype2.Module<{
2561
2561
  is_enemy: boolean;
2562
2562
  is_squad_member: boolean;
2563
2563
  is_local_player: boolean;
2564
- side: "attacker" | "defender" | "both" | "invalid" | (string & {});
2564
+ side: "invalid" | (string & {}) | "attacker" | "defender" | "both";
2565
2565
  team: 0 | 1;
2566
2566
  platform: "invalid" | (string & {}) | "pc" | "xbox" | "playstation";
2567
2567
  is_privacy_username: boolean;
@@ -2575,12 +2575,12 @@ declare const siegeEvents: arktype2.Module<{
2575
2575
  game_mode_actions: number;
2576
2576
  score: number;
2577
2577
  };
2578
- life_state: (string & {}) | "downed" | "normal" | "overhealed" | "low_health" | "dead" | "respawning";
2578
+ life_state: (string & {}) | "normal" | "overhealed" | "low_health" | "downed" | "dead" | "respawning";
2579
2579
  ping: number;
2580
2580
  };
2581
- }) => arktype2.Out<{
2581
+ }) => arktype0.Out<{
2582
2582
  content: {
2583
- starting_side: "attacker" | "defender" | "both" | "invalid" | (string & {});
2583
+ starting_side: "invalid" | (string & {}) | "attacker" | "defender" | "both";
2584
2584
  player_id: SiegePlayerId;
2585
2585
  username: string;
2586
2586
  pc_username: string | null;
@@ -2589,7 +2589,7 @@ declare const siegeEvents: arktype2.Module<{
2589
2589
  is_enemy: boolean;
2590
2590
  is_squad_member: boolean;
2591
2591
  is_local_player: boolean;
2592
- side: "attacker" | "defender" | "both" | "invalid" | (string & {});
2592
+ side: "invalid" | (string & {}) | "attacker" | "defender" | "both";
2593
2593
  team: 0 | 1;
2594
2594
  platform: "invalid" | (string & {}) | "pc" | "xbox" | "playstation";
2595
2595
  is_privacy_username: boolean;
@@ -2603,7 +2603,7 @@ declare const siegeEvents: arktype2.Module<{
2603
2603
  game_mode_actions: number;
2604
2604
  score: number;
2605
2605
  };
2606
- life_state: (string & {}) | "downed" | "normal" | "overhealed" | "low_health" | "dead" | "respawning";
2606
+ life_state: (string & {}) | "normal" | "overhealed" | "low_health" | "downed" | "dead" | "respawning";
2607
2607
  ping: number;
2608
2608
  };
2609
2609
  game: "siege";
@@ -2645,7 +2645,7 @@ declare const siegeEvents: arktype2.Module<{
2645
2645
  creation_time: number;
2646
2646
  content: {
2647
2647
  player_id: SiegePlayerId;
2648
- side: "attacker" | "defender" | "both" | "invalid" | (string & {});
2648
+ side: "invalid" | (string & {}) | "attacker" | "defender" | "both";
2649
2649
  };
2650
2650
  };
2651
2651
  player_score_changed: {
@@ -2741,7 +2741,7 @@ declare const siegeEvents: arktype2.Module<{
2741
2741
  creation_time: number;
2742
2742
  content: {
2743
2743
  player_id: SiegePlayerId;
2744
- life_state: (string & {}) | "downed" | "normal" | "overhealed" | "low_health" | "dead" | "respawning";
2744
+ life_state: (string & {}) | "normal" | "overhealed" | "low_health" | "downed" | "dead" | "respawning";
2745
2745
  };
2746
2746
  };
2747
2747
  player_died: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@overlayed/app",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Overlayed app",
5
5
  "keywords": [
6
6
  "typescript"
@@ -81,13 +81,13 @@
81
81
  "vitest": "^3.2.4",
82
82
  "@overlayed/api": "0.0.5",
83
83
  "@overlayed/cortex-client": "0.0.5",
84
- "@overlayed/events": "0.0.4",
85
84
  "@overlayed/native-managers": "0.0.4",
86
85
  "@overlayed/shared-node": "0.0.4",
86
+ "@overlayed/events": "0.0.4",
87
87
  "@overlayed/siege": "0.0.5",
88
88
  "@overlayed/universal": "0.0.0",
89
- "@overlayed/utils": "0.0.4",
90
- "@overlayed/utils-node": "0.0.4"
89
+ "@overlayed/utils-node": "0.0.4",
90
+ "@overlayed/utils": "0.0.4"
91
91
  },
92
92
  "peerDependencies": {
93
93
  "electron": "33.3.0"