dotfiles/vesktop/vencordDist/vencordDesktopMain.js.map
2024-03-06 20:18:13 -06:00

8 lines
172 KiB
Plaintext

{
"version": 3,
"sources": ["../scripts/build/inject/react.mjs", "git-hash:~git-hash", "git-remote:~git-remote", "../src/utils/constants.ts", "../src/utils/IpcEvents.ts", "../src/main/utils/simpleGet.ts", "../src/main/updater/common.ts", "../src/main/updater/http.ts", "../src/main/index.ts", "../src/main/ipcMain.ts", "../src/main/updater/index.ts", "../src/main/ipcPlugins.ts", "import-natives:~pluginNatives", "../src/plugins/fixSpotifyEmbeds.desktop/native.ts", "../src/plugins/openInApp/native.ts", "../src/plugins/voiceMessages/native.ts", "../src/plugins/xsOverlay.desktop/native.ts", "../src/utils/debounce.ts", "../src/utils/Queue.ts", "include-file:~fileContent/monacoWin.html;base64", "../src/main/themes/index.ts", "../src/main/utils/constants.ts", "../src/main/utils/externalLinks.ts", "../src/main/utils/extensions.ts", "../node_modules/.pnpm/fflate@0.7.4/node_modules/fflate/esm/index.mjs", "../src/main/utils/crxToZip.ts"],
"sourcesContent": ["/*\n * Vencord, a modification for Discord's desktop app\n * Copyright (c) 2022 Vendicated and contributors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n*/\n\nexport const VencordFragment = /* #__PURE__*/ Symbol.for(\"react.fragment\");\nexport let VencordCreateElement =\n (...args) => (VencordCreateElement = Vencord.Webpack.Common.React.createElement)(...args);\n", "export default \"d73790e\"", "export default \"Vendicated/Vencord\"", "/*\n * Vencord, a modification for Discord's desktop app\n * Copyright (c) 2022 Vendicated and contributors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n*/\n\nimport gitHash from \"~git-hash\";\nimport gitRemote from \"~git-remote\";\n\nexport {\n gitHash,\n gitRemote\n};\n\nexport const WEBPACK_CHUNK = \"webpackChunkdiscord_app\";\nexport const REACT_GLOBAL = \"Vencord.Webpack.Common.React\";\nexport const VENCORD_USER_AGENT = `Vencord/${gitHash}${gitRemote ? ` (https://github.com/${gitRemote})` : \"\"}`;\nexport const SUPPORT_CHANNEL_ID = \"1026515880080842772\";\n\nexport interface Dev {\n name: string;\n id: bigint;\n badge?: boolean;\n}\n\n/**\n * If you made a plugin or substantial contribution, add yourself here.\n * This object is used for the plugin author list, as well as to add a contributor badge to your profile.\n * If you wish to stay fully anonymous, feel free to set ID to 0n.\n * If you are fine with attribution but don't want the badge, add badge: false\n */\nexport const Devs = /* #__PURE__*/ Object.freeze({\n Ven: {\n name: \"Vendicated\",\n id: 343383572805058560n\n },\n Arjix: {\n name: \"ArjixWasTaken\",\n id: 674710789138939916n\n },\n Cyn: {\n name: \"Cynosphere\",\n id: 150745989836308480n\n },\n Megu: {\n name: \"Megumin\",\n id: 545581357812678656n\n },\n botato: {\n name: \"botato\",\n id: 440990343899643943n\n },\n obscurity: {\n name: \"obscurity\",\n id: 336678828233588736n,\n },\n rushii: {\n name: \"rushii\",\n id: 295190422244950017n\n },\n Glitch: {\n name: \"Glitchy\",\n id: 269567451199569920n\n },\n Samu: {\n name: \"Samu\",\n id: 702973430449832038n,\n },\n Nyako: {\n name: \"nyako\",\n id: 118437263754395652n\n },\n MaiKokain: {\n name: \"Mai\",\n id: 722647978577363026n\n },\n echo: {\n name: \"ECHO\",\n id: 712639419785412668n\n },\n katlyn: {\n name: \"katlyn\",\n id: 250322741406859265n\n },\n nea: {\n name: \"nea\",\n id: 310702108997320705n,\n },\n Nuckyz: {\n name: \"Nuckyz\",\n id: 235834946571337729n\n },\n D3SOX: {\n name: \"D3SOX\",\n id: 201052085641281538n\n },\n Nickyux: {\n name: \"Nickyux\",\n id: 427146305651998721n\n },\n mantikafasi: {\n name: \"mantikafasi\",\n id: 287555395151593473n\n },\n Xinto: {\n name: \"Xinto\",\n id: 423915768191647755n\n },\n JacobTm: {\n name: \"Jacob.Tm\",\n id: 302872992097107991n\n },\n DustyAngel47: {\n name: \"DustyAngel47\",\n id: 714583473804935238n\n },\n BanTheNons: {\n name: \"BanTheNons\",\n id: 460478012794863637n\n },\n BigDuck: {\n name: \"BigDuck\",\n id: 1024588272623681609n\n },\n AverageReactEnjoyer: {\n name: \"Average React Enjoyer\",\n id: 1004904120056029256n\n },\n adryd: {\n name: \"adryd\",\n id: 0n\n },\n Tyman: {\n name: \"Tyman\",\n id: 487443883127472129n\n },\n afn: {\n name: \"afn\",\n id: 420043923822608384n\n },\n KraXen72: {\n name: \"KraXen72\",\n id: 379304073515499530n\n },\n kemo: {\n name: \"kemo\",\n id: 299693897859465228n\n },\n dzshn: {\n name: \"dzshn\",\n id: 310449948011528192n\n },\n Ducko: {\n name: \"Ducko\",\n id: 506482395269169153n\n },\n jewdev: {\n name: \"jewdev\",\n id: 222369866529636353n\n },\n Luna: {\n name: \"Luny\",\n id: 821472922140803112n\n },\n Vap: {\n name: \"Vap0r1ze\",\n id: 454072114492866560n\n },\n KingFish: {\n name: \"King Fish\",\n id: 499400512559382538n\n },\n Commandtechno: {\n name: \"Commandtechno\",\n id: 296776625432035328n,\n },\n TheSun: {\n name: \"ActuallyTheSun\",\n id: 406028027768733696n\n },\n axyie: {\n name: \"'ax\",\n id: 273562710745284628n,\n },\n pointy: {\n name: \"pointy\",\n id: 99914384989519872n\n },\n SammCheese: {\n name: \"Samm-Cheese\",\n id: 372148345894076416n\n },\n zt: {\n name: \"zt\",\n id: 289556910426816513n\n },\n captain: {\n name: \"Captain\",\n id: 347366054806159360n\n },\n nick: {\n name: \"nick\",\n id: 347884694408265729n,\n badge: false\n },\n whqwert: {\n name: \"whqwert\",\n id: 586239091520176128n\n },\n lewisakura: {\n name: \"lewisakura\",\n id: 96269247411400704n\n },\n RuiNtD: {\n name: \"RuiNtD\",\n id: 157917665162297344n\n },\n hunt: {\n name: \"hunt-g\",\n id: 222800179697287168n\n },\n cloudburst: {\n name: \"cloudburst\",\n id: 892128204150685769n\n },\n Aria: {\n name: \"Syncxv\",\n id: 549244932213309442n,\n },\n TheKodeToad: {\n name: \"TheKodeToad\",\n id: 706152404072267788n\n },\n LordElias: {\n name: \"LordElias\",\n id: 319460781567639554n\n },\n juby: {\n name: \"Juby210\",\n id: 324622488644616195n\n },\n Alyxia: {\n name: \"Alyxia Sother\",\n id: 952185386350829688n\n },\n Remty: {\n name: \"Remty\",\n id: 335055032204656642n\n },\n skyevg: {\n name: \"skyevg\",\n id: 1090310844283363348n\n },\n Dziurwa: {\n name: \"Dziurwa\",\n id: 1001086404203389018n\n },\n F53: {\n name: \"F53\",\n id: 280411966126948353n\n },\n AutumnVN: {\n name: \"AutumnVN\",\n id: 393694671383166998n\n },\n pylix: {\n name: \"pylix\",\n id: 492949202121261067n\n },\n Tyler: {\n name: \"\\\\\\\\GGTyler\\\\\\\\\",\n id: 143117463788191746n\n },\n RyanCaoDev: {\n name: \"RyanCaoDev\",\n id: 952235800110694471n,\n },\n Strencher: {\n name: \"Strencher\",\n id: 415849376598982656n\n },\n FieryFlames: {\n name: \"Fiery\",\n id: 890228870559698955n\n },\n KannaDev: {\n name: \"Kanna\",\n id: 317728561106518019n\n },\n carince: {\n name: \"carince\",\n id: 818323528755314698n\n },\n PandaNinjas: {\n name: \"PandaNinjas\",\n id: 455128749071925248n\n },\n CatNoir: {\n name: \"CatNoir\",\n id: 260371016348336128n\n },\n outfoxxed: {\n name: \"outfoxxed\",\n id: 837425748435796060n\n },\n UwUDev: {\n name: \"UwU\",\n id: 691413039156690994n,\n },\n amia: {\n name: \"amia\",\n id: 142007603549962240n\n },\n phil: {\n name: \"phil\",\n id: 305288513941667851n\n },\n ImLvna: {\n name: \"Luna <3\",\n id: 799319081723232267n\n },\n rad: {\n name: \"rad\",\n id: 610945092504780823n\n },\n AndrewDLO: {\n name: \"Andrew-DLO\",\n id: 434135504792059917n\n },\n HypedDomi: {\n name: \"HypedDomi\",\n id: 354191516979429376n\n },\n Rini: {\n name: \"Rini\",\n id: 1079479184478441643n\n },\n castdrian: {\n name: \"castdrian\",\n id: 224617799434108928n\n },\n Arrow: {\n name: \"arrow\",\n id: 958158495302176778n\n },\n bb010g: {\n name: \"bb010g\",\n id: 72791153467990016n,\n },\n Lumap: {\n name: \"lumap\",\n id: 635383782576357407n\n },\n Dolfies: {\n name: \"Dolfies\",\n id: 852892297661906993n,\n },\n RuukuLada: {\n name: \"RuukuLada\",\n id: 119705748346241027n,\n },\n blahajZip: {\n name: \"blahaj.zip\",\n id: 683954422241427471n,\n },\n archeruwu: {\n name: \"archer_uwu\",\n id: 160068695383736320n\n },\n ProffDea: {\n name: \"ProffDea\",\n id: 609329952180928513n\n },\n ant0n: {\n name: \"ant0n\",\n id: 145224646868860928n\n },\n philipbry: {\n name: \"philipbry\",\n id: 554994003318276106n\n },\n Korbo: {\n name: \"Korbo\",\n id: 455856406420258827n\n },\n maisymoe: {\n name: \"maisy\",\n id: 257109471589957632n,\n },\n Grzesiek11: {\n name: \"Grzesiek11\",\n id: 368475654662127616n,\n },\n} satisfies Record<string, Dev>);\n\n// iife so #__PURE__ works correctly\nexport const DevsById = /* #__PURE__*/ (() =>\n Object.freeze(Object.fromEntries(\n Object.entries(Devs)\n .filter(d => d[1].id !== 0n)\n .map(([_, v]) => [v.id, v] as const)\n ))\n)() as Record<string, Dev>;\n", "/*\n * Vencord, a modification for Discord's desktop app\n * Copyright (c) 2023 Vendicated and contributors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n*/\n\nexport const enum IpcEvents {\n QUICK_CSS_UPDATE = \"VencordQuickCssUpdate\",\n THEME_UPDATE = \"VencordThemeUpdate\",\n GET_QUICK_CSS = \"VencordGetQuickCss\",\n SET_QUICK_CSS = \"VencordSetQuickCss\",\n UPLOAD_THEME = \"VencordUploadTheme\",\n DELETE_THEME = \"VencordDeleteTheme\",\n GET_THEMES_DIR = \"VencordGetThemesDir\",\n GET_THEMES_LIST = \"VencordGetThemesList\",\n GET_THEME_DATA = \"VencordGetThemeData\",\n GET_THEME_SYSTEM_VALUES = \"VencordGetThemeSystemValues\",\n GET_SETTINGS_DIR = \"VencordGetSettingsDir\",\n GET_SETTINGS = \"VencordGetSettings\",\n SET_SETTINGS = \"VencordSetSettings\",\n OPEN_EXTERNAL = \"VencordOpenExternal\",\n OPEN_QUICKCSS = \"VencordOpenQuickCss\",\n GET_UPDATES = \"VencordGetUpdates\",\n GET_REPO = \"VencordGetRepo\",\n UPDATE = \"VencordUpdate\",\n BUILD = \"VencordBuild\",\n OPEN_MONACO_EDITOR = \"VencordOpenMonacoEditor\",\n\n GET_PLUGIN_IPC_METHOD_MAP = \"VencordGetPluginIpcMethodMap\",\n\n OPEN_IN_APP__RESOLVE_REDIRECT = \"VencordOIAResolveRedirect\",\n VOICE_MESSAGES_READ_RECORDING = \"VencordVMReadRecording\",\n}\n", "/*\n * Vencord, a modification for Discord's desktop app\n * Copyright (c) 2022 Vendicated and contributors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n*/\n\nimport https from \"https\";\n\nexport function get(url: string, options: https.RequestOptions = {}) {\n return new Promise<Buffer>((resolve, reject) => {\n https.get(url, options, res => {\n const { statusCode, statusMessage, headers } = res;\n if (statusCode! >= 400)\n return void reject(`${statusCode}: ${statusMessage} - ${url}`);\n if (statusCode! >= 300)\n return void resolve(get(headers.location!, options));\n\n const chunks = [] as Buffer[];\n res.on(\"error\", reject);\n\n res.on(\"data\", chunk => chunks.push(chunk));\n res.once(\"end\", () => resolve(Buffer.concat(chunks)));\n });\n });\n}\n", "/*\n * Vencord, a modification for Discord's desktop app\n * Copyright (c) 2022 Vendicated and contributors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n*/\n\nexport const VENCORD_FILES = [\n IS_DISCORD_DESKTOP ? \"patcher.js\" : \"vencordDesktopMain.js\",\n IS_DISCORD_DESKTOP ? \"preload.js\" : \"vencordDesktopPreload.js\",\n IS_DISCORD_DESKTOP ? \"renderer.js\" : \"vencordDesktopRenderer.js\",\n IS_DISCORD_DESKTOP ? \"renderer.css\" : \"vencordDesktopRenderer.css\",\n];\n\nexport function serializeErrors(func: (...args: any[]) => any) {\n return async function () {\n try {\n return {\n ok: true,\n value: await func(...arguments)\n };\n } catch (e: any) {\n return {\n ok: false,\n error: e instanceof Error ? {\n // prototypes get lost, so turn error into plain object\n ...e\n } : e\n };\n }\n };\n}\n", "/*\n * Vencord, a modification for Discord's desktop app\n * Copyright (c) 2022 Vendicated and contributors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n*/\n\nimport { VENCORD_USER_AGENT } from \"@utils/constants\";\nimport { IpcEvents } from \"@utils/IpcEvents\";\nimport { ipcMain } from \"electron\";\nimport { writeFile } from \"fs/promises\";\nimport { join } from \"path\";\n\nimport gitHash from \"~git-hash\";\nimport gitRemote from \"~git-remote\";\n\nimport { get } from \"../utils/simpleGet\";\nimport { serializeErrors, VENCORD_FILES } from \"./common\";\n\nconst API_BASE = `https://api.github.com/repos/${gitRemote}`;\nlet PendingUpdates = [] as [string, string][];\n\nasync function githubGet(endpoint: string) {\n return get(API_BASE + endpoint, {\n headers: {\n Accept: \"application/vnd.github+json\",\n // \"All API requests MUST include a valid User-Agent header.\n // Requests with no User-Agent header will be rejected.\"\n \"User-Agent\": VENCORD_USER_AGENT\n }\n });\n}\n\nasync function calculateGitChanges() {\n const isOutdated = await fetchUpdates();\n if (!isOutdated) return [];\n\n const res = await githubGet(`/compare/${gitHash}...HEAD`);\n\n const data = JSON.parse(res.toString(\"utf-8\"));\n return data.commits.map((c: any) => ({\n // github api only sends the long sha\n hash: c.sha.slice(0, 7),\n author: c.author.login,\n message: c.commit.message\n }));\n}\n\nasync function fetchUpdates() {\n const release = await githubGet(\"/releases/latest\");\n\n const data = JSON.parse(release.toString());\n const hash = data.name.slice(data.name.lastIndexOf(\" \") + 1);\n if (hash === gitHash)\n return false;\n\n data.assets.forEach(({ name, browser_download_url }) => {\n if (VENCORD_FILES.some(s => name.startsWith(s))) {\n PendingUpdates.push([name, browser_download_url]);\n }\n });\n return true;\n}\n\nasync function applyUpdates() {\n await Promise.all(PendingUpdates.map(\n async ([name, data]) => writeFile(\n join(__dirname, name),\n await get(data)\n )\n ));\n PendingUpdates = [];\n return true;\n}\n\nipcMain.handle(IpcEvents.GET_REPO, serializeErrors(() => `https://github.com/${gitRemote}`));\nipcMain.handle(IpcEvents.GET_UPDATES, serializeErrors(calculateGitChanges));\nipcMain.handle(IpcEvents.UPDATE, serializeErrors(fetchUpdates));\nipcMain.handle(IpcEvents.BUILD, serializeErrors(applyUpdates));\n", "/*\n * Vencord, a modification for Discord's desktop app\n * Copyright (c) 2023 Vendicated and contributors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n*/\n\nimport { app, protocol, session } from \"electron\";\nimport { join } from \"path\";\n\nimport { ensureSafePath, getSettings } from \"./ipcMain\";\nimport { IS_VANILLA, THEMES_DIR } from \"./utils/constants\";\nimport { installExt } from \"./utils/extensions\";\n\nif (IS_VESKTOP || !IS_VANILLA) {\n app.whenReady().then(() => {\n // Source Maps! Maybe there's a better way but since the renderer is executed\n // from a string I don't think any other form of sourcemaps would work\n protocol.registerFileProtocol(\"vencord\", ({ url: unsafeUrl }, cb) => {\n let url = unsafeUrl.slice(\"vencord://\".length);\n if (url.endsWith(\"/\")) url = url.slice(0, -1);\n if (url.startsWith(\"/themes/\")) {\n const theme = url.slice(\"/themes/\".length);\n const safeUrl = ensureSafePath(THEMES_DIR, theme);\n if (!safeUrl) {\n cb({ statusCode: 403 });\n return;\n }\n cb(safeUrl.replace(/\\?v=\\d+$/, \"\"));\n return;\n }\n switch (url) {\n case \"renderer.js.map\":\n case \"vencordDesktopRenderer.js.map\":\n case \"preload.js.map\":\n case \"vencordDesktopPreload.js.map\":\n case \"patcher.js.map\":\n case \"vencordDesktopMain.js.map\":\n cb(join(__dirname, url));\n break;\n default:\n cb({ statusCode: 403 });\n }\n });\n\n try {\n if (getSettings().enableReactDevtools)\n installExt(\"fmkadmapgofadopljbjfkapdkoienihi\")\n .then(() => console.info(\"[Vencord] Installed React Developer Tools\"))\n .catch(err => console.error(\"[Vencord] Failed to install React Developer Tools\", err));\n } catch { }\n\n\n const findHeader = (headers: Record<string, string[]>, headerName: Lowercase<string>) => {\n return Object.keys(headers).find(h => h.toLowerCase() === headerName);\n };\n\n // Remove CSP\n type PolicyResult = Record<string, string[]>;\n\n const parsePolicy = (policy: string): PolicyResult => {\n const result: PolicyResult = {};\n policy.split(\";\").forEach(directive => {\n const [directiveKey, ...directiveValue] = directive.trim().split(/\\s+/g);\n if (directiveKey && !Object.prototype.hasOwnProperty.call(result, directiveKey)) {\n result[directiveKey] = directiveValue;\n }\n });\n\n return result;\n };\n const stringifyPolicy = (policy: PolicyResult): string =>\n Object.entries(policy)\n .filter(([, values]) => values?.length)\n .map(directive => directive.flat().join(\" \"))\n .join(\"; \");\n\n const patchCsp = (headers: Record<string, string[]>) => {\n const header = findHeader(headers, \"content-security-policy\");\n\n if (header) {\n const csp = parsePolicy(headers[header][0]);\n\n for (const directive of [\"style-src\", \"connect-src\", \"img-src\", \"font-src\", \"media-src\", \"worker-src\"]) {\n csp[directive] ??= [];\n csp[directive].push(\"*\", \"blob:\", \"data:\", \"vencord:\", \"'unsafe-inline'\");\n }\n\n // TODO: Restrict this to only imported packages with fixed version.\n // Perhaps auto generate with esbuild\n csp[\"script-src\"] ??= [];\n csp[\"script-src\"].push(\"'unsafe-eval'\", \"https://unpkg.com\", \"https://cdnjs.cloudflare.com\");\n headers[header] = [stringifyPolicy(csp)];\n }\n };\n\n session.defaultSession.webRequest.onHeadersReceived(({ responseHeaders, resourceType }, cb) => {\n if (responseHeaders) {\n if (resourceType === \"mainFrame\")\n patchCsp(responseHeaders);\n\n // Fix hosts that don't properly set the css content type, such as\n // raw.githubusercontent.com\n if (resourceType === \"stylesheet\") {\n const header = findHeader(responseHeaders, \"content-type\");\n if (header)\n responseHeaders[header] = [\"text/css\"];\n }\n }\n\n cb({ cancel: false, responseHeaders });\n });\n\n // assign a noop to onHeadersReceived to prevent other mods from adding their own incompatible ones.\n // For instance, OpenAsar adds their own that doesn't fix content-type for stylesheets which makes it\n // impossible to load css from github raw despite our fix above\n session.defaultSession.webRequest.onHeadersReceived = () => { };\n });\n}\n\nif (IS_DISCORD_DESKTOP) {\n require(\"./patcher\");\n}\n", "/*\n * Vencord, a modification for Discord's desktop app\n * Copyright (c) 2022 Vendicated and contributors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n*/\n\nimport \"./updater\";\nimport \"./ipcPlugins\";\n\nimport { debounce } from \"@utils/debounce\";\nimport { IpcEvents } from \"@utils/IpcEvents\";\nimport { Queue } from \"@utils/Queue\";\nimport { BrowserWindow, ipcMain, shell, systemPreferences } from \"electron\";\nimport { mkdirSync, readFileSync, watch } from \"fs\";\nimport { open, readdir, readFile, writeFile } from \"fs/promises\";\nimport { join, normalize } from \"path\";\n\nimport monacoHtml from \"~fileContent/monacoWin.html;base64\";\n\nimport { getThemeInfo, stripBOM, UserThemeHeader } from \"./themes\";\nimport { ALLOWED_PROTOCOLS, QUICKCSS_PATH, SETTINGS_DIR, SETTINGS_FILE, THEMES_DIR } from \"./utils/constants\";\nimport { makeLinksOpenExternally } from \"./utils/externalLinks\";\n\nmkdirSync(SETTINGS_DIR, { recursive: true });\nmkdirSync(THEMES_DIR, { recursive: true });\n\nexport function ensureSafePath(basePath: string, path: string) {\n const normalizedBasePath = normalize(basePath);\n const newPath = join(basePath, path);\n const normalizedPath = normalize(newPath);\n return normalizedPath.startsWith(normalizedBasePath) ? normalizedPath : null;\n}\n\nfunction readCss() {\n return readFile(QUICKCSS_PATH, \"utf-8\").catch(() => \"\");\n}\n\nasync function listThemes(): Promise<UserThemeHeader[]> {\n const files = await readdir(THEMES_DIR).catch(() => []);\n\n const themeInfo: UserThemeHeader[] = [];\n\n for (const fileName of files) {\n if (!fileName.endsWith(\".css\")) continue;\n\n const data = await getThemeData(fileName).then(stripBOM).catch(() => null);\n if (data == null) continue;\n\n themeInfo.push(getThemeInfo(data, fileName));\n }\n\n return themeInfo;\n}\n\nfunction getThemeData(fileName: string) {\n fileName = fileName.replace(/\\?v=\\d+$/, \"\");\n const safePath = ensureSafePath(THEMES_DIR, fileName);\n if (!safePath) return Promise.reject(`Unsafe path ${fileName}`);\n return readFile(safePath, \"utf-8\");\n}\n\nexport function readSettings() {\n try {\n return readFileSync(SETTINGS_FILE, \"utf-8\");\n } catch {\n return \"{}\";\n }\n}\n\nexport function getSettings(): typeof import(\"@api/Settings\").Settings {\n try {\n return JSON.parse(readSettings());\n } catch {\n return {} as any;\n }\n}\n\nipcMain.handle(IpcEvents.OPEN_QUICKCSS, () => shell.openPath(QUICKCSS_PATH));\n\nipcMain.handle(IpcEvents.OPEN_EXTERNAL, (_, url) => {\n try {\n var { protocol } = new URL(url);\n } catch {\n throw \"Malformed URL\";\n }\n if (!ALLOWED_PROTOCOLS.includes(protocol))\n throw \"Disallowed protocol.\";\n\n shell.openExternal(url);\n});\n\nconst cssWriteQueue = new Queue();\nconst settingsWriteQueue = new Queue();\n\nipcMain.handle(IpcEvents.GET_QUICK_CSS, () => readCss());\nipcMain.handle(IpcEvents.SET_QUICK_CSS, (_, css) =>\n cssWriteQueue.push(() => writeFile(QUICKCSS_PATH, css))\n);\n\nipcMain.handle(IpcEvents.GET_THEMES_DIR, () => THEMES_DIR);\nipcMain.handle(IpcEvents.GET_THEMES_LIST, () => listThemes());\nipcMain.handle(IpcEvents.GET_THEME_DATA, (_, fileName) => getThemeData(fileName));\nipcMain.handle(IpcEvents.GET_THEME_SYSTEM_VALUES, () => ({\n // win & mac only\n \"os-accent-color\": `#${systemPreferences.getAccentColor?.() || \"\"}`\n}));\n\nipcMain.handle(IpcEvents.GET_SETTINGS_DIR, () => SETTINGS_DIR);\nipcMain.on(IpcEvents.GET_SETTINGS, e => e.returnValue = readSettings());\n\nipcMain.handle(IpcEvents.SET_SETTINGS, (_, s) => {\n settingsWriteQueue.push(() => writeFile(SETTINGS_FILE, s));\n});\n\n\nexport function initIpc(mainWindow: BrowserWindow) {\n open(QUICKCSS_PATH, \"a+\").then(fd => {\n fd.close();\n watch(QUICKCSS_PATH, { persistent: false }, debounce(async () => {\n mainWindow.webContents.postMessage(IpcEvents.QUICK_CSS_UPDATE, await readCss());\n }, 50));\n });\n\n watch(THEMES_DIR, { persistent: false }, debounce(() => {\n mainWindow.webContents.postMessage(IpcEvents.THEME_UPDATE, void 0);\n }));\n}\n\nipcMain.handle(IpcEvents.OPEN_MONACO_EDITOR, async () => {\n const win = new BrowserWindow({\n title: \"Vencord QuickCSS Editor\",\n autoHideMenuBar: true,\n darkTheme: true,\n webPreferences: {\n preload: join(__dirname, IS_DISCORD_DESKTOP ? \"preload.js\" : \"vencordDesktopPreload.js\"),\n contextIsolation: true,\n nodeIntegration: false,\n sandbox: false\n }\n });\n\n makeLinksOpenExternally(win);\n\n await win.loadURL(`data:text/html;base64,${monacoHtml}`);\n});\n", "/*\n * Vencord, a modification for Discord's desktop app\n * Copyright (c) 2022 Vendicated and contributors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n*/\n\nif (!IS_UPDATER_DISABLED)\n import(IS_STANDALONE ? \"./http\" : \"./git\");\n", "/*\n * Vencord, a modification for Discord's desktop app\n * Copyright (c) 2023 Vendicated and contributors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n*/\n\nimport { IpcEvents } from \"@utils/IpcEvents\";\nimport { ipcMain } from \"electron\";\n\nimport PluginNatives from \"~pluginNatives\";\n\nconst PluginIpcMappings = {} as Record<string, Record<string, string>>;\nexport type PluginIpcMappings = typeof PluginIpcMappings;\n\nfor (const [plugin, methods] of Object.entries(PluginNatives)) {\n const entries = Object.entries(methods);\n if (!entries.length) continue;\n\n const mappings = PluginIpcMappings[plugin] = {};\n\n for (const [methodName, method] of entries) {\n const key = `VencordPluginNative_${plugin}_${methodName}`;\n ipcMain.handle(key, method);\n mappings[methodName] = key;\n }\n}\n\nipcMain.on(IpcEvents.GET_PLUGIN_IPC_METHOD_MAP, e => {\n e.returnValue = PluginIpcMappings;\n});\n", "import * as p0 from \"./plugins/fixSpotifyEmbeds.desktop/native\";\nimport * as p1 from \"./plugins/openInApp/native\";\nimport * as p2 from \"./plugins/voiceMessages/native\";\nimport * as p3 from \"./plugins/xsOverlay.desktop/native\";\nexport default {\n\"FixSpotifyEmbeds\":p0,\n\"OpenInApp\":p1,\n\"VoiceMessages\":p2,\n\"XsOverlay\":p3,\n};", "/*\n * Vencord, a Discord client mod\n * Copyright (c) 2023 Vendicated and contributors\n * SPDX-License-Identifier: GPL-3.0-or-later\n */\n\nimport { app } from \"electron\";\nimport { getSettings } from \"main/ipcMain\";\n\napp.on(\"browser-window-created\", (_, win) => {\n win.webContents.on(\"frame-created\", (_, { frame }) => {\n frame.once(\"dom-ready\", () => {\n if (frame.url.startsWith(\"https://open.spotify.com/embed/\")) {\n const settings = getSettings().plugins?.FixSpotifyEmbeds;\n if (!settings?.enabled) return;\n\n frame.executeJavaScript(`\n const original = Audio.prototype.play;\n Audio.prototype.play = function() {\n this.volume = ${(settings.volume / 100) || 0.1};\n return original.apply(this, arguments);\n }\n `);\n }\n });\n });\n});\n", "/*\n * Vencord, a Discord client mod\n * Copyright (c) 2023 Vendicated and contributors\n * SPDX-License-Identifier: GPL-3.0-or-later\n */\n\nimport { IpcMainInvokeEvent } from \"electron\";\nimport { request } from \"https\";\n\n// These links don't support CORS, so this has to be native\nconst validRedirectUrls = /^https:\\/\\/(spotify\\.link|s\\.team)\\/.+$/;\n\nfunction getRedirect(url: string) {\n return new Promise<string>((resolve, reject) => {\n const req = request(new URL(url), { method: \"HEAD\" }, res => {\n resolve(\n res.headers.location\n ? getRedirect(res.headers.location)\n : url\n );\n });\n req.on(\"error\", reject);\n req.end();\n });\n}\n\nexport async function resolveRedirect(_: IpcMainInvokeEvent, url: string) {\n if (!validRedirectUrls.test(url)) return url;\n\n return getRedirect(url);\n}\n", "/*\n * Vencord, a Discord client mod\n * Copyright (c) 2023 Vendicated and contributors\n * SPDX-License-Identifier: GPL-3.0-or-later\n */\n\nimport { app } from \"electron\";\nimport { readFile } from \"fs/promises\";\nimport { basename, normalize } from \"path\";\n\nexport async function readRecording(_, filePath: string) {\n filePath = normalize(filePath);\n const filename = basename(filePath);\n const discordBaseDirWithTrailingSlash = normalize(app.getPath(\"userData\") + \"/\");\n console.log(filename, discordBaseDirWithTrailingSlash, filePath);\n if (filename !== \"recording.ogg\" || !filePath.startsWith(discordBaseDirWithTrailingSlash)) return null;\n\n try {\n const buf = await readFile(filePath);\n return new Uint8Array(buf.buffer);\n } catch {\n return null;\n }\n}\n", "/*\n * Vencord, a Discord client mod\n * Copyright (c) 2023 Vendicated and contributors\n * SPDX-License-Identifier: GPL-3.0-or-later\n */\n\nimport { createSocket, Socket } from \"dgram\";\n\nlet xsoSocket: Socket;\n\nexport function sendToOverlay(_, data: any) {\n data.icon = Buffer.from(data.icon).toString(\"base64\");\n const json = JSON.stringify(data);\n xsoSocket ??= createSocket(\"udp4\");\n xsoSocket.send(json, 42069, \"127.0.0.1\");\n}\n", "/*\n * Vencord, a modification for Discord's desktop app\n * Copyright (c) 2022 Vendicated and contributors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n*/\n\n/**\n * Returns a new function that will call the wrapped function\n * after the specified delay. If the function is called again\n * within the delay, the timer will be reset.\n * @param func The function to wrap\n * @param delay The delay in milliseconds\n */\nexport function debounce<T extends Function>(func: T, delay = 300): T {\n let timeout: NodeJS.Timeout;\n return function (...args: any[]) {\n clearTimeout(timeout);\n timeout = setTimeout(() => { func(...args); }, delay);\n } as any;\n}\n", "/*\n * Vencord, a modification for Discord's desktop app\n * Copyright (c) 2022 Vendicated and contributors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n*/\n\nimport { Promisable } from \"type-fest\";\n\n/**\n * A queue that can be used to run tasks consecutively.\n * Highly recommended for things like fetching data from Discord\n */\nexport class Queue {\n /**\n * @param maxSize The maximum amount of functions that can be queued at once.\n * If the queue is full, the oldest function will be removed.\n */\n constructor(public readonly maxSize = Infinity) { }\n\n private queue = [] as Array<() => Promisable<unknown>>;\n\n private promise?: Promise<any>;\n\n private next() {\n const func = this.queue.shift();\n if (func)\n this.promise = Promise.resolve()\n .then(func)\n .finally(() => this.next());\n else\n this.promise = undefined;\n }\n\n private run() {\n if (!this.promise)\n this.next();\n }\n\n /**\n * Append a task at the end of the queue. This task will be executed after all other tasks\n * If the queue exceeds the specified maxSize, the first task in queue will be removed.\n * @param func Task\n */\n push<T>(func: () => Promisable<T>) {\n if (this.size >= this.maxSize)\n this.queue.shift();\n\n this.queue.push(func);\n this.run();\n }\n\n /**\n * Prepend a task at the beginning of the queue. This task will be executed next\n * If the queue exceeds the specified maxSize, the last task in queue will be removed.\n * @param func Task\n */\n unshift<T>(func: () => Promisable<T>) {\n if (this.size >= this.maxSize)\n this.queue.pop();\n\n this.queue.unshift(func);\n this.run();\n }\n\n /**\n * The amount of tasks in the queue\n */\n get size() {\n return this.queue.length;\n }\n}\n", "export default \"PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KICAgIDxoZWFkPgogICAgICAgIDxtZXRhIGNoYXJzZXQ9InV0Zi04IiAvPgogICAgICAgIDx0aXRsZT5WZW5jb3JkIFF1aWNrQ1NTIEVkaXRvcjwvdGl0bGU+CiAgICAgICAgPGxpbmsKICAgICAgICAgICAgcmVsPSJzdHlsZXNoZWV0IgogICAgICAgICAgICBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9tb25hY28tZWRpdG9yLzAuNDAuMC9taW4vdnMvZWRpdG9yL2VkaXRvci5tYWluLm1pbi5jc3MiCiAgICAgICAgICAgIGludGVncml0eT0ic2hhNTEyLU1Pb1EwMmg4MGhrbGNjZkxyWEZZa0N6RytXVmpPUmZsT3A5WnA4ZGx0aWFSUCszNUxZbk80TEtPa2xSNjRvTUdmR2dKRExPOFdKcGtNMW81Z1pYWVpRPT0iCiAgICAgICAgICAgIGNyb3Nzb3JpZ2luPSJhbm9ueW1vdXMiCiAgICAgICAgICAgIHJlZmVycmVycG9saWN5PSJuby1yZWZlcnJlciIKICAgICAgICAvPgogICAgICAgIDxzdHlsZT4KICAgICAgICAgICAgaHRtbCwKICAgICAgICAgICAgYm9keSwKICAgICAgICAgICAgI2NvbnRhaW5lciB7CiAgICAgICAgICAgICAgICBwb3NpdGlvbjogYWJzb2x1dGU7CiAgICAgICAgICAgICAgICBsZWZ0OiAwOwogICAgICAgICAgICAgICAgdG9wOiAwOwogICAgICAgICAgICAgICAgd2lkdGg6IDEwMCU7CiAgICAgICAgICAgICAgICBoZWlnaHQ6IDEwMCU7CiAgICAgICAgICAgICAgICBtYXJnaW46IDA7CiAgICAgICAgICAgICAgICBwYWRkaW5nOiAwOwogICAgICAgICAgICAgICAgb3ZlcmZsb3c6IGhpZGRlbjsKICAgICAgICAgICAgfQogICAgICAgIDwvc3R5bGU+CiAgICA8L2hlYWQ+CgogICAgPGJvZHk+CiAgICAgICAgPGRpdiBpZD0iY29udGFpbmVyIj48L2Rpdj4KICAgICAgICA8c2NyaXB0CiAgICAgICAgICAgIHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvbW9uYWNvLWVkaXRvci8wLjQwLjAvbWluL3ZzL2xvYWRlci5taW4uanMiCiAgICAgICAgICAgIGludGVncml0eT0ic2hhNTEyLVF6TXBYZUNQY2lBSFA0d2JZbFYyUFlnclFjYUVrRFFVanprUFU0eG5qeVZTRDlUMzYvdWRhbXh0TkJxYjRxSzQvYk1RTVBaOGF5ckJlOWhyR2RCRmpRPT0iCiAgICAgICAgICAgIGNyb3Nzb3JpZ2luPSJhbm9ueW1vdXMiCiAgICAgICAgICAgIHJlZmVycmVycG9saWN5PSJuby1yZWZlcnJlciIKICAgICAgICA+PC9zY3JpcHQ+CgogICAgICAgIDxzY3JpcHQ+CiAgICAgICAgICAgIHJlcXVpcmUuY29uZmlnKHsKICAgICAgICAgICAgICAgIHBhdGhzOiB7CiAgICAgICAgICAgICAgICAgICAgdnM6ICJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9tb25hY28tZWRpdG9yLzAuNDAuMC9taW4vdnMiLAogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgfSk7CgogICAgICAgICAgICByZXF1aXJlKFsidnMvZWRpdG9yL2VkaXRvci5tYWluIl0sICgpID0+IHsKICAgICAgICAgICAgICAgIGdldEN1cnJlbnRDc3MoKS50aGVuKChjc3MpID0+IHsKICAgICAgICAgICAgICAgICAgICB2YXIgZWRpdG9yID0gbW9uYWNvLmVkaXRvci5jcmVhdGUoCiAgICAgICAgICAgICAgICAgICAgICAgIGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJjb250YWluZXIiKSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGNzcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAiY3NzIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoZW1lOiBnZXRUaGVtZSgpLAogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgKTsKICAgICAgICAgICAgICAgICAgICBlZGl0b3Iub25EaWRDaGFuZ2VNb2RlbENvbnRlbnQoKCkgPT4KICAgICAgICAgICAgICAgICAgICAgICAgc2V0Q3NzKGVkaXRvci5nZXRWYWx1ZSgpKQogICAgICAgICAgICAgICAgICAgICk7CiAgICAgICAgICAgICAgICAgICAgd2luZG93LmFkZEV2ZW50TGlzdGVuZXIoInJlc2l6ZSIsICgpID0+IHsKICAgICAgICAgICAgICAgICAgICAgICAgLy8gbWFrZSBtb25hY28gcmUtbGF5b3V0CiAgICAgICAgICAgICAgICAgICAgICAgIGVkaXRvci5sYXlvdXQoKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9KTsKICAgICAgICA8L3NjcmlwdD4KICAgIDwvYm9keT4KPC9odG1sPgo=\"", "/* eslint-disable simple-header/header */\n\n/*!\n * BetterDiscord addon meta parser\n * Copyright 2023 BetterDiscord contributors\n * Copyright 2023 Vendicated and Vencord contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst splitRegex = /[^\\S\\r\\n]*?\\r?(?:\\r\\n|\\n)[^\\S\\r\\n]*?\\*[^\\S\\r\\n]?/;\nconst escapedAtRegex = /^\\\\@/;\n\nexport interface UserThemeHeader {\n fileName: string;\n name: string;\n author: string;\n description: string;\n version?: string;\n license?: string;\n source?: string;\n website?: string;\n invite?: string;\n}\n\nfunction makeHeader(fileName: string, opts: Partial<UserThemeHeader> = {}): UserThemeHeader {\n return {\n fileName,\n name: opts.name ?? fileName.replace(/\\.css$/i, \"\"),\n author: opts.author ?? \"Unknown Author\",\n description: opts.description ?? \"A Discord Theme.\",\n version: opts.version,\n license: opts.license,\n source: opts.source,\n website: opts.website,\n invite: opts.invite\n };\n}\n\nexport function stripBOM(fileContent: string) {\n if (fileContent.charCodeAt(0) === 0xFEFF) {\n fileContent = fileContent.slice(1);\n }\n return fileContent;\n}\n\nexport function getThemeInfo(css: string, fileName: string): UserThemeHeader {\n if (!css) return makeHeader(fileName);\n\n const block = css.split(\"/**\", 2)?.[1]?.split(\"*/\", 1)?.[0];\n if (!block) return makeHeader(fileName);\n\n const header: Partial<UserThemeHeader> = {};\n let field = \"\";\n let accum = \"\";\n for (const line of block.split(splitRegex)) {\n if (line.length === 0) continue;\n if (line.charAt(0) === \"@\" && line.charAt(1) !== \" \") {\n header[field] = accum.trim();\n const l = line.indexOf(\" \");\n field = line.substring(1, l);\n accum = line.substring(l + 1);\n }\n else {\n accum += \" \" + line.replace(\"\\\\n\", \"\\n\").replace(escapedAtRegex, \"@\");\n }\n }\n header[field] = accum.trim();\n delete header[\"\"];\n return makeHeader(fileName, header);\n}\n", "/*\n * Vencord, a modification for Discord's desktop app\n * Copyright (c) 2022 Vendicated and contributors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n*/\n\nimport { app } from \"electron\";\nimport { join } from \"path\";\n\nexport const DATA_DIR = process.env.VENCORD_USER_DATA_DIR ?? (\n process.env.DISCORD_USER_DATA_DIR\n ? join(process.env.DISCORD_USER_DATA_DIR, \"..\", \"VencordData\")\n : join(app.getPath(\"userData\"), \"..\", \"Vencord\")\n);\nexport const SETTINGS_DIR = join(DATA_DIR, \"settings\");\nexport const THEMES_DIR = join(DATA_DIR, \"themes\");\nexport const QUICKCSS_PATH = join(SETTINGS_DIR, \"quickCss.css\");\nexport const SETTINGS_FILE = join(SETTINGS_DIR, \"settings.json\");\nexport const ALLOWED_PROTOCOLS = [\n \"https:\",\n \"http:\",\n \"steam:\",\n \"spotify:\",\n \"com.epicgames.launcher:\",\n];\n\nexport const IS_VANILLA = /* @__PURE__ */ process.argv.includes(\"--vanilla\");\n", "/*\n * Vencord, a modification for Discord's desktop app\n * Copyright (c) 2023 Vendicated and contributors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n*/\n\nimport { type BrowserWindow, shell } from \"electron\";\n\nexport function makeLinksOpenExternally(win: BrowserWindow) {\n win.webContents.setWindowOpenHandler(({ url }) => {\n switch (url) {\n case \"about:blank\":\n case \"https://discord.com/popout\":\n case \"https://ptb.discord.com/popout\":\n case \"https://canary.discord.com/popout\":\n return { action: \"allow\" };\n }\n\n try {\n var { protocol } = new URL(url);\n } catch {\n return { action: \"deny\" };\n }\n\n switch (protocol) {\n case \"http:\":\n case \"https:\":\n case \"mailto:\":\n case \"steam:\":\n case \"spotify:\":\n shell.openExternal(url);\n }\n\n return { action: \"deny\" };\n });\n}\n", "/*\n * Vencord, a modification for Discord's desktop app\n * Copyright (c) 2022 Vendicated and contributors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n*/\n\nimport { session } from \"electron\";\nimport { unzip } from \"fflate\";\nimport { constants as fsConstants } from \"fs\";\nimport { access, mkdir, rm, writeFile } from \"fs/promises\";\nimport { join } from \"path\";\n\nimport { DATA_DIR } from \"./constants\";\nimport { crxToZip } from \"./crxToZip\";\nimport { get } from \"./simpleGet\";\n\nconst extensionCacheDir = join(DATA_DIR, \"ExtensionCache\");\n\nasync function extract(data: Buffer, outDir: string) {\n await mkdir(outDir, { recursive: true });\n return new Promise<void>((resolve, reject) => {\n unzip(data, (err, files) => {\n if (err) return void reject(err);\n Promise.all(Object.keys(files).map(async f => {\n // Signature stuff\n // 'Cannot load extension with file or directory name\n // _metadata. Filenames starting with \"_\" are reserved for use by the system.';\n if (f.startsWith(\"_metadata/\")) return;\n\n if (f.endsWith(\"/\")) return void mkdir(join(outDir, f), { recursive: true });\n\n const pathElements = f.split(\"/\");\n const name = pathElements.pop()!;\n const directories = pathElements.join(\"/\");\n const dir = join(outDir, directories);\n\n if (directories) {\n await mkdir(dir, { recursive: true });\n }\n\n await writeFile(join(dir, name), files[f]);\n }))\n .then(() => resolve())\n .catch(err => {\n rm(outDir, { recursive: true, force: true });\n reject(err);\n });\n });\n });\n}\n\nexport async function installExt(id: string) {\n const extDir = join(extensionCacheDir, `${id}`);\n\n try {\n await access(extDir, fsConstants.F_OK);\n } catch (err) {\n const url = id === \"fmkadmapgofadopljbjfkapdkoienihi\"\n // React Devtools v4.25\n // v4.27 is broken in Electron, see https://github.com/facebook/react/issues/25843\n // Unfortunately, Google does not serve old versions, so this is the only way\n ? \"https://raw.githubusercontent.com/Vendicated/random-files/f6f550e4c58ac5f2012095a130406c2ab25b984d/fmkadmapgofadopljbjfkapdkoienihi.zip\"\n : `https://clients2.google.com/service/update2/crx?response=redirect&acceptformat=crx2,crx3&x=id%3D${id}%26uc&prodversion=32`;\n const buf = await get(url, {\n headers: {\n \"User-Agent\": \"Vencord (https://github.com/Vendicated/Vencord)\"\n }\n });\n await extract(crxToZip(buf), extDir).catch(console.error);\n }\n\n session.defaultSession.loadExtension(extDir);\n}\n", "import { createRequire } from 'module';\nvar require = createRequire('/');\n// DEFLATE is a complex format; to read this code, you should probably check the RFC first:\n// https://tools.ietf.org/html/rfc1951\n// You may also wish to take a look at the guide I made about this program:\n// https://gist.github.com/101arrowz/253f31eb5abc3d9275ab943003ffecad\n// Some of the following code is similar to that of UZIP.js:\n// https://github.com/photopea/UZIP.js\n// However, the vast majority of the codebase has diverged from UZIP.js to increase performance and reduce bundle size.\n// Sometimes 0 will appear where -1 would be more appropriate. This is because using a uint\n// is better for memory in most engines (I *think*).\n// Mediocre shim\nvar Worker;\nvar workerAdd = \";var __w=require('worker_threads');__w.parentPort.on('message',function(m){onmessage({data:m})}),postMessage=function(m,t){__w.parentPort.postMessage(m,t)},close=process.exit;self=global\";\ntry {\n Worker = require('worker_threads').Worker;\n}\ncatch (e) {\n}\nvar wk = Worker ? function (c, _, msg, transfer, cb) {\n var done = false;\n var w = new Worker(c + workerAdd, { eval: true })\n .on('error', function (e) { return cb(e, null); })\n .on('message', function (m) { return cb(null, m); })\n .on('exit', function (c) {\n if (c && !done)\n cb(new Error('exited with code ' + c), null);\n });\n w.postMessage(msg, transfer);\n w.terminate = function () {\n done = true;\n return Worker.prototype.terminate.call(w);\n };\n return w;\n} : function (_, __, ___, ____, cb) {\n setImmediate(function () { return cb(new Error('async operations unsupported - update to Node 12+ (or Node 10-11 with the --experimental-worker CLI flag)'), null); });\n var NOP = function () { };\n return {\n terminate: NOP,\n postMessage: NOP\n };\n};\n\n// aliases for shorter compressed code (most minifers don't do this)\nvar u8 = Uint8Array, u16 = Uint16Array, u32 = Uint32Array;\n// fixed length extra bits\nvar fleb = new u8([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, /* unused */ 0, 0, /* impossible */ 0]);\n// fixed distance extra bits\n// see fleb note\nvar fdeb = new u8([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, /* unused */ 0, 0]);\n// code length index map\nvar clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);\n// get base, reverse index map from extra bits\nvar freb = function (eb, start) {\n var b = new u16(31);\n for (var i = 0; i < 31; ++i) {\n b[i] = start += 1 << eb[i - 1];\n }\n // numbers here are at max 18 bits\n var r = new u32(b[30]);\n for (var i = 1; i < 30; ++i) {\n for (var j = b[i]; j < b[i + 1]; ++j) {\n r[j] = ((j - b[i]) << 5) | i;\n }\n }\n return [b, r];\n};\nvar _a = freb(fleb, 2), fl = _a[0], revfl = _a[1];\n// we can ignore the fact that the other numbers are wrong; they never happen anyway\nfl[28] = 258, revfl[258] = 28;\nvar _b = freb(fdeb, 0), fd = _b[0], revfd = _b[1];\n// map of value to reverse (assuming 16 bits)\nvar rev = new u16(32768);\nfor (var i = 0; i < 32768; ++i) {\n // reverse table algorithm from SO\n var x = ((i & 0xAAAA) >>> 1) | ((i & 0x5555) << 1);\n x = ((x & 0xCCCC) >>> 2) | ((x & 0x3333) << 2);\n x = ((x & 0xF0F0) >>> 4) | ((x & 0x0F0F) << 4);\n rev[i] = (((x & 0xFF00) >>> 8) | ((x & 0x00FF) << 8)) >>> 1;\n}\n// create huffman tree from u8 \"map\": index -> code length for code index\n// mb (max bits) must be at most 15\n// TODO: optimize/split up?\nvar hMap = (function (cd, mb, r) {\n var s = cd.length;\n // index\n var i = 0;\n // u16 \"map\": index -> # of codes with bit length = index\n var l = new u16(mb);\n // length of cd must be 288 (total # of codes)\n for (; i < s; ++i) {\n if (cd[i])\n ++l[cd[i] - 1];\n }\n // u16 \"map\": index -> minimum code for bit length = index\n var le = new u16(mb);\n for (i = 0; i < mb; ++i) {\n le[i] = (le[i - 1] + l[i - 1]) << 1;\n }\n var co;\n if (r) {\n // u16 \"map\": index -> number of actual bits, symbol for code\n co = new u16(1 << mb);\n // bits to remove for reverser\n var rvb = 15 - mb;\n for (i = 0; i < s; ++i) {\n // ignore 0 lengths\n if (cd[i]) {\n // num encoding both symbol and bits read\n var sv = (i << 4) | cd[i];\n // free bits\n var r_1 = mb - cd[i];\n // start value\n var v = le[cd[i] - 1]++ << r_1;\n // m is end value\n for (var m = v | ((1 << r_1) - 1); v <= m; ++v) {\n // every 16 bit value starting with the code yields the same result\n co[rev[v] >>> rvb] = sv;\n }\n }\n }\n }\n else {\n co = new u16(s);\n for (i = 0; i < s; ++i) {\n if (cd[i]) {\n co[i] = rev[le[cd[i] - 1]++] >>> (15 - cd[i]);\n }\n }\n }\n return co;\n});\n// fixed length tree\nvar flt = new u8(288);\nfor (var i = 0; i < 144; ++i)\n flt[i] = 8;\nfor (var i = 144; i < 256; ++i)\n flt[i] = 9;\nfor (var i = 256; i < 280; ++i)\n flt[i] = 7;\nfor (var i = 280; i < 288; ++i)\n flt[i] = 8;\n// fixed distance tree\nvar fdt = new u8(32);\nfor (var i = 0; i < 32; ++i)\n fdt[i] = 5;\n// fixed length map\nvar flm = /*#__PURE__*/ hMap(flt, 9, 0), flrm = /*#__PURE__*/ hMap(flt, 9, 1);\n// fixed distance map\nvar fdm = /*#__PURE__*/ hMap(fdt, 5, 0), fdrm = /*#__PURE__*/ hMap(fdt, 5, 1);\n// find max of array\nvar max = function (a) {\n var m = a[0];\n for (var i = 1; i < a.length; ++i) {\n if (a[i] > m)\n m = a[i];\n }\n return m;\n};\n// read d, starting at bit p and mask with m\nvar bits = function (d, p, m) {\n var o = (p / 8) | 0;\n return ((d[o] | (d[o + 1] << 8)) >> (p & 7)) & m;\n};\n// read d, starting at bit p continuing for at least 16 bits\nvar bits16 = function (d, p) {\n var o = (p / 8) | 0;\n return ((d[o] | (d[o + 1] << 8) | (d[o + 2] << 16)) >> (p & 7));\n};\n// get end of byte\nvar shft = function (p) { return ((p + 7) / 8) | 0; };\n// typed array slice - allows garbage collector to free original reference,\n// while being more compatible than .slice\nvar slc = function (v, s, e) {\n if (s == null || s < 0)\n s = 0;\n if (e == null || e > v.length)\n e = v.length;\n // can't use .constructor in case user-supplied\n var n = new (v.BYTES_PER_ELEMENT == 2 ? u16 : v.BYTES_PER_ELEMENT == 4 ? u32 : u8)(e - s);\n n.set(v.subarray(s, e));\n return n;\n};\n/**\n * Codes for errors generated within this library\n */\nexport var FlateErrorCode = {\n UnexpectedEOF: 0,\n InvalidBlockType: 1,\n InvalidLengthLiteral: 2,\n InvalidDistance: 3,\n StreamFinished: 4,\n NoStreamHandler: 5,\n InvalidHeader: 6,\n NoCallback: 7,\n InvalidUTF8: 8,\n ExtraFieldTooLong: 9,\n InvalidDate: 10,\n FilenameTooLong: 11,\n StreamFinishing: 12,\n InvalidZipData: 13,\n UnknownCompressionMethod: 14\n};\n// error codes\nvar ec = [\n 'unexpected EOF',\n 'invalid block type',\n 'invalid length/literal',\n 'invalid distance',\n 'stream finished',\n 'no stream handler',\n ,\n 'no callback',\n 'invalid UTF-8 data',\n 'extra field too long',\n 'date not in range 1980-2099',\n 'filename too long',\n 'stream finishing',\n 'invalid zip data'\n // determined by unknown compression method\n];\n;\nvar err = function (ind, msg, nt) {\n var e = new Error(msg || ec[ind]);\n e.code = ind;\n if (Error.captureStackTrace)\n Error.captureStackTrace(e, err);\n if (!nt)\n throw e;\n return e;\n};\n// expands raw DEFLATE data\nvar inflt = function (dat, buf, st) {\n // source length\n var sl = dat.length;\n if (!sl || (st && st.f && !st.l))\n return buf || new u8(0);\n // have to estimate size\n var noBuf = !buf || st;\n // no state\n var noSt = !st || st.i;\n if (!st)\n st = {};\n // Assumes roughly 33% compression ratio average\n if (!buf)\n buf = new u8(sl * 3);\n // ensure buffer can fit at least l elements\n var cbuf = function (l) {\n var bl = buf.length;\n // need to increase size to fit\n if (l > bl) {\n // Double or set to necessary, whichever is greater\n var nbuf = new u8(Math.max(bl * 2, l));\n nbuf.set(buf);\n buf = nbuf;\n }\n };\n // last chunk bitpos bytes\n var final = st.f || 0, pos = st.p || 0, bt = st.b || 0, lm = st.l, dm = st.d, lbt = st.m, dbt = st.n;\n // total bits\n var tbts = sl * 8;\n do {\n if (!lm) {\n // BFINAL - this is only 1 when last chunk is next\n final = bits(dat, pos, 1);\n // type: 0 = no compression, 1 = fixed huffman, 2 = dynamic huffman\n var type = bits(dat, pos + 1, 3);\n pos += 3;\n if (!type) {\n // go to end of byte boundary\n var s = shft(pos) + 4, l = dat[s - 4] | (dat[s - 3] << 8), t = s + l;\n if (t > sl) {\n if (noSt)\n err(0);\n break;\n }\n // ensure size\n if (noBuf)\n cbuf(bt + l);\n // Copy over uncompressed data\n buf.set(dat.subarray(s, t), bt);\n // Get new bitpos, update byte count\n st.b = bt += l, st.p = pos = t * 8, st.f = final;\n continue;\n }\n else if (type == 1)\n lm = flrm, dm = fdrm, lbt = 9, dbt = 5;\n else if (type == 2) {\n // literal lengths\n var hLit = bits(dat, pos, 31) + 257, hcLen = bits(dat, pos + 10, 15) + 4;\n var tl = hLit + bits(dat, pos + 5, 31) + 1;\n pos += 14;\n // length+distance tree\n var ldt = new u8(tl);\n // code length tree\n var clt = new u8(19);\n for (var i = 0; i < hcLen; ++i) {\n // use index map to get real code\n clt[clim[i]] = bits(dat, pos + i * 3, 7);\n }\n pos += hcLen * 3;\n // code lengths bits\n var clb = max(clt), clbmsk = (1 << clb) - 1;\n // code lengths map\n var clm = hMap(clt, clb, 1);\n for (var i = 0; i < tl;) {\n var r = clm[bits(dat, pos, clbmsk)];\n // bits read\n pos += r & 15;\n // symbol\n var s = r >>> 4;\n // code length to copy\n if (s < 16) {\n ldt[i++] = s;\n }\n else {\n // copy count\n var c = 0, n = 0;\n if (s == 16)\n n = 3 + bits(dat, pos, 3), pos += 2, c = ldt[i - 1];\n else if (s == 17)\n n = 3 + bits(dat, pos, 7), pos += 3;\n else if (s == 18)\n n = 11 + bits(dat, pos, 127), pos += 7;\n while (n--)\n ldt[i++] = c;\n }\n }\n // length tree distance tree\n var lt = ldt.subarray(0, hLit), dt = ldt.subarray(hLit);\n // max length bits\n lbt = max(lt);\n // max dist bits\n dbt = max(dt);\n lm = hMap(lt, lbt, 1);\n dm = hMap(dt, dbt, 1);\n }\n else\n err(1);\n if (pos > tbts) {\n if (noSt)\n err(0);\n break;\n }\n }\n // Make sure the buffer can hold this + the largest possible addition\n // Maximum chunk size (practically, theoretically infinite) is 2^17;\n if (noBuf)\n cbuf(bt + 131072);\n var lms = (1 << lbt) - 1, dms = (1 << dbt) - 1;\n var lpos = pos;\n for (;; lpos = pos) {\n // bits read, code\n var c = lm[bits16(dat, pos) & lms], sym = c >>> 4;\n pos += c & 15;\n if (pos > tbts) {\n if (noSt)\n err(0);\n break;\n }\n if (!c)\n err(2);\n if (sym < 256)\n buf[bt++] = sym;\n else if (sym == 256) {\n lpos = pos, lm = null;\n break;\n }\n else {\n var add = sym - 254;\n // no extra bits needed if less\n if (sym > 264) {\n // index\n var i = sym - 257, b = fleb[i];\n add = bits(dat, pos, (1 << b) - 1) + fl[i];\n pos += b;\n }\n // dist\n var d = dm[bits16(dat, pos) & dms], dsym = d >>> 4;\n if (!d)\n err(3);\n pos += d & 15;\n var dt = fd[dsym];\n if (dsym > 3) {\n var b = fdeb[dsym];\n dt += bits16(dat, pos) & ((1 << b) - 1), pos += b;\n }\n if (pos > tbts) {\n if (noSt)\n err(0);\n break;\n }\n if (noBuf)\n cbuf(bt + 131072);\n var end = bt + add;\n for (; bt < end; bt += 4) {\n buf[bt] = buf[bt - dt];\n buf[bt + 1] = buf[bt + 1 - dt];\n buf[bt + 2] = buf[bt + 2 - dt];\n buf[bt + 3] = buf[bt + 3 - dt];\n }\n bt = end;\n }\n }\n st.l = lm, st.p = lpos, st.b = bt, st.f = final;\n if (lm)\n final = 1, st.m = lbt, st.d = dm, st.n = dbt;\n } while (!final);\n return bt == buf.length ? buf : slc(buf, 0, bt);\n};\n// starting at p, write the minimum number of bits that can hold v to d\nvar wbits = function (d, p, v) {\n v <<= p & 7;\n var o = (p / 8) | 0;\n d[o] |= v;\n d[o + 1] |= v >>> 8;\n};\n// starting at p, write the minimum number of bits (>8) that can hold v to d\nvar wbits16 = function (d, p, v) {\n v <<= p & 7;\n var o = (p / 8) | 0;\n d[o] |= v;\n d[o + 1] |= v >>> 8;\n d[o + 2] |= v >>> 16;\n};\n// creates code lengths from a frequency table\nvar hTree = function (d, mb) {\n // Need extra info to make a tree\n var t = [];\n for (var i = 0; i < d.length; ++i) {\n if (d[i])\n t.push({ s: i, f: d[i] });\n }\n var s = t.length;\n var t2 = t.slice();\n if (!s)\n return [et, 0];\n if (s == 1) {\n var v = new u8(t[0].s + 1);\n v[t[0].s] = 1;\n return [v, 1];\n }\n t.sort(function (a, b) { return a.f - b.f; });\n // after i2 reaches last ind, will be stopped\n // freq must be greater than largest possible number of symbols\n t.push({ s: -1, f: 25001 });\n var l = t[0], r = t[1], i0 = 0, i1 = 1, i2 = 2;\n t[0] = { s: -1, f: l.f + r.f, l: l, r: r };\n // efficient algorithm from UZIP.js\n // i0 is lookbehind, i2 is lookahead - after processing two low-freq\n // symbols that combined have high freq, will start processing i2 (high-freq,\n // non-composite) symbols instead\n // see https://reddit.com/r/photopea/comments/ikekht/uzipjs_questions/\n while (i1 != s - 1) {\n l = t[t[i0].f < t[i2].f ? i0++ : i2++];\n r = t[i0 != i1 && t[i0].f < t[i2].f ? i0++ : i2++];\n t[i1++] = { s: -1, f: l.f + r.f, l: l, r: r };\n }\n var maxSym = t2[0].s;\n for (var i = 1; i < s; ++i) {\n if (t2[i].s > maxSym)\n maxSym = t2[i].s;\n }\n // code lengths\n var tr = new u16(maxSym + 1);\n // max bits in tree\n var mbt = ln(t[i1 - 1], tr, 0);\n if (mbt > mb) {\n // more algorithms from UZIP.js\n // TODO: find out how this code works (debt)\n // ind debt\n var i = 0, dt = 0;\n // left cost\n var lft = mbt - mb, cst = 1 << lft;\n t2.sort(function (a, b) { return tr[b.s] - tr[a.s] || a.f - b.f; });\n for (; i < s; ++i) {\n var i2_1 = t2[i].s;\n if (tr[i2_1] > mb) {\n dt += cst - (1 << (mbt - tr[i2_1]));\n tr[i2_1] = mb;\n }\n else\n break;\n }\n dt >>>= lft;\n while (dt > 0) {\n var i2_2 = t2[i].s;\n if (tr[i2_2] < mb)\n dt -= 1 << (mb - tr[i2_2]++ - 1);\n else\n ++i;\n }\n for (; i >= 0 && dt; --i) {\n var i2_3 = t2[i].s;\n if (tr[i2_3] == mb) {\n --tr[i2_3];\n ++dt;\n }\n }\n mbt = mb;\n }\n return [new u8(tr), mbt];\n};\n// get the max length and assign length codes\nvar ln = function (n, l, d) {\n return n.s == -1\n ? Math.max(ln(n.l, l, d + 1), ln(n.r, l, d + 1))\n : (l[n.s] = d);\n};\n// length codes generation\nvar lc = function (c) {\n var s = c.length;\n // Note that the semicolon was intentional\n while (s && !c[--s])\n ;\n var cl = new u16(++s);\n // ind num streak\n var cli = 0, cln = c[0], cls = 1;\n var w = function (v) { cl[cli++] = v; };\n for (var i = 1; i <= s; ++i) {\n if (c[i] == cln && i != s)\n ++cls;\n else {\n if (!cln && cls > 2) {\n for (; cls > 138; cls -= 138)\n w(32754);\n if (cls > 2) {\n w(cls > 10 ? ((cls - 11) << 5) | 28690 : ((cls - 3) << 5) | 12305);\n cls = 0;\n }\n }\n else if (cls > 3) {\n w(cln), --cls;\n for (; cls > 6; cls -= 6)\n w(8304);\n if (cls > 2)\n w(((cls - 3) << 5) | 8208), cls = 0;\n }\n while (cls--)\n w(cln);\n cls = 1;\n cln = c[i];\n }\n }\n return [cl.subarray(0, cli), s];\n};\n// calculate the length of output from tree, code lengths\nvar clen = function (cf, cl) {\n var l = 0;\n for (var i = 0; i < cl.length; ++i)\n l += cf[i] * cl[i];\n return l;\n};\n// writes a fixed block\n// returns the new bit pos\nvar wfblk = function (out, pos, dat) {\n // no need to write 00 as type: TypedArray defaults to 0\n var s = dat.length;\n var o = shft(pos + 2);\n out[o] = s & 255;\n out[o + 1] = s >>> 8;\n out[o + 2] = out[o] ^ 255;\n out[o + 3] = out[o + 1] ^ 255;\n for (var i = 0; i < s; ++i)\n out[o + i + 4] = dat[i];\n return (o + 4 + s) * 8;\n};\n// writes a block\nvar wblk = function (dat, out, final, syms, lf, df, eb, li, bs, bl, p) {\n wbits(out, p++, final);\n ++lf[256];\n var _a = hTree(lf, 15), dlt = _a[0], mlb = _a[1];\n var _b = hTree(df, 15), ddt = _b[0], mdb = _b[1];\n var _c = lc(dlt), lclt = _c[0], nlc = _c[1];\n var _d = lc(ddt), lcdt = _d[0], ndc = _d[1];\n var lcfreq = new u16(19);\n for (var i = 0; i < lclt.length; ++i)\n lcfreq[lclt[i] & 31]++;\n for (var i = 0; i < lcdt.length; ++i)\n lcfreq[lcdt[i] & 31]++;\n var _e = hTree(lcfreq, 7), lct = _e[0], mlcb = _e[1];\n var nlcc = 19;\n for (; nlcc > 4 && !lct[clim[nlcc - 1]]; --nlcc)\n ;\n var flen = (bl + 5) << 3;\n var ftlen = clen(lf, flt) + clen(df, fdt) + eb;\n var dtlen = clen(lf, dlt) + clen(df, ddt) + eb + 14 + 3 * nlcc + clen(lcfreq, lct) + (2 * lcfreq[16] + 3 * lcfreq[17] + 7 * lcfreq[18]);\n if (flen <= ftlen && flen <= dtlen)\n return wfblk(out, p, dat.subarray(bs, bs + bl));\n var lm, ll, dm, dl;\n wbits(out, p, 1 + (dtlen < ftlen)), p += 2;\n if (dtlen < ftlen) {\n lm = hMap(dlt, mlb, 0), ll = dlt, dm = hMap(ddt, mdb, 0), dl = ddt;\n var llm = hMap(lct, mlcb, 0);\n wbits(out, p, nlc - 257);\n wbits(out, p + 5, ndc - 1);\n wbits(out, p + 10, nlcc - 4);\n p += 14;\n for (var i = 0; i < nlcc; ++i)\n wbits(out, p + 3 * i, lct[clim[i]]);\n p += 3 * nlcc;\n var lcts = [lclt, lcdt];\n for (var it = 0; it < 2; ++it) {\n var clct = lcts[it];\n for (var i = 0; i < clct.length; ++i) {\n var len = clct[i] & 31;\n wbits(out, p, llm[len]), p += lct[len];\n if (len > 15)\n wbits(out, p, (clct[i] >>> 5) & 127), p += clct[i] >>> 12;\n }\n }\n }\n else {\n lm = flm, ll = flt, dm = fdm, dl = fdt;\n }\n for (var i = 0; i < li; ++i) {\n if (syms[i] > 255) {\n var len = (syms[i] >>> 18) & 31;\n wbits16(out, p, lm[len + 257]), p += ll[len + 257];\n if (len > 7)\n wbits(out, p, (syms[i] >>> 23) & 31), p += fleb[len];\n var dst = syms[i] & 31;\n wbits16(out, p, dm[dst]), p += dl[dst];\n if (dst > 3)\n wbits16(out, p, (syms[i] >>> 5) & 8191), p += fdeb[dst];\n }\n else {\n wbits16(out, p, lm[syms[i]]), p += ll[syms[i]];\n }\n }\n wbits16(out, p, lm[256]);\n return p + ll[256];\n};\n// deflate options (nice << 13) | chain\nvar deo = /*#__PURE__*/ new u32([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]);\n// empty\nvar et = /*#__PURE__*/ new u8(0);\n// compresses data into a raw DEFLATE buffer\nvar dflt = function (dat, lvl, plvl, pre, post, lst) {\n var s = dat.length;\n var o = new u8(pre + s + 5 * (1 + Math.ceil(s / 7000)) + post);\n // writing to this writes to the output buffer\n var w = o.subarray(pre, o.length - post);\n var pos = 0;\n if (!lvl || s < 8) {\n for (var i = 0; i <= s; i += 65535) {\n // end\n var e = i + 65535;\n if (e >= s) {\n // write final block\n w[pos >> 3] = lst;\n }\n pos = wfblk(w, pos + 1, dat.subarray(i, e));\n }\n }\n else {\n var opt = deo[lvl - 1];\n var n = opt >>> 13, c = opt & 8191;\n var msk_1 = (1 << plvl) - 1;\n // prev 2-byte val map curr 2-byte val map\n var prev = new u16(32768), head = new u16(msk_1 + 1);\n var bs1_1 = Math.ceil(plvl / 3), bs2_1 = 2 * bs1_1;\n var hsh = function (i) { return (dat[i] ^ (dat[i + 1] << bs1_1) ^ (dat[i + 2] << bs2_1)) & msk_1; };\n // 24576 is an arbitrary number of maximum symbols per block\n // 424 buffer for last block\n var syms = new u32(25000);\n // length/literal freq distance freq\n var lf = new u16(288), df = new u16(32);\n // l/lcnt exbits index l/lind waitdx bitpos\n var lc_1 = 0, eb = 0, i = 0, li = 0, wi = 0, bs = 0;\n for (; i < s; ++i) {\n // hash value\n // deopt when i > s - 3 - at end, deopt acceptable\n var hv = hsh(i);\n // index mod 32768 previous index mod\n var imod = i & 32767, pimod = head[hv];\n prev[imod] = pimod;\n head[hv] = imod;\n // We always should modify head and prev, but only add symbols if\n // this data is not yet processed (\"wait\" for wait index)\n if (wi <= i) {\n // bytes remaining\n var rem = s - i;\n if ((lc_1 > 7000 || li > 24576) && rem > 423) {\n pos = wblk(dat, w, 0, syms, lf, df, eb, li, bs, i - bs, pos);\n li = lc_1 = eb = 0, bs = i;\n for (var j = 0; j < 286; ++j)\n lf[j] = 0;\n for (var j = 0; j < 30; ++j)\n df[j] = 0;\n }\n // len dist chain\n var l = 2, d = 0, ch_1 = c, dif = (imod - pimod) & 32767;\n if (rem > 2 && hv == hsh(i - dif)) {\n var maxn = Math.min(n, rem) - 1;\n var maxd = Math.min(32767, i);\n // max possible length\n // not capped at dif because decompressors implement \"rolling\" index population\n var ml = Math.min(258, rem);\n while (dif <= maxd && --ch_1 && imod != pimod) {\n if (dat[i + l] == dat[i + l - dif]) {\n var nl = 0;\n for (; nl < ml && dat[i + nl] == dat[i + nl - dif]; ++nl)\n ;\n if (nl > l) {\n l = nl, d = dif;\n // break out early when we reach \"nice\" (we are satisfied enough)\n if (nl > maxn)\n break;\n // now, find the rarest 2-byte sequence within this\n // length of literals and search for that instead.\n // Much faster than just using the start\n var mmd = Math.min(dif, nl - 2);\n var md = 0;\n for (var j = 0; j < mmd; ++j) {\n var ti = (i - dif + j + 32768) & 32767;\n var pti = prev[ti];\n var cd = (ti - pti + 32768) & 32767;\n if (cd > md)\n md = cd, pimod = ti;\n }\n }\n }\n // check the previous match\n imod = pimod, pimod = prev[imod];\n dif += (imod - pimod + 32768) & 32767;\n }\n }\n // d will be nonzero only when a match was found\n if (d) {\n // store both dist and len data in one Uint32\n // Make sure this is recognized as a len/dist with 28th bit (2^28)\n syms[li++] = 268435456 | (revfl[l] << 18) | revfd[d];\n var lin = revfl[l] & 31, din = revfd[d] & 31;\n eb += fleb[lin] + fdeb[din];\n ++lf[257 + lin];\n ++df[din];\n wi = i + l;\n ++lc_1;\n }\n else {\n syms[li++] = dat[i];\n ++lf[dat[i]];\n }\n }\n }\n pos = wblk(dat, w, lst, syms, lf, df, eb, li, bs, i - bs, pos);\n // this is the easiest way to avoid needing to maintain state\n if (!lst && pos & 7)\n pos = wfblk(w, pos + 1, et);\n }\n return slc(o, 0, pre + shft(pos) + post);\n};\n// CRC32 table\nvar crct = /*#__PURE__*/ (function () {\n var t = new Int32Array(256);\n for (var i = 0; i < 256; ++i) {\n var c = i, k = 9;\n while (--k)\n c = ((c & 1) && -306674912) ^ (c >>> 1);\n t[i] = c;\n }\n return t;\n})();\n// CRC32\nvar crc = function () {\n var c = -1;\n return {\n p: function (d) {\n // closures have awful performance\n var cr = c;\n for (var i = 0; i < d.length; ++i)\n cr = crct[(cr & 255) ^ d[i]] ^ (cr >>> 8);\n c = cr;\n },\n d: function () { return ~c; }\n };\n};\n// Alder32\nvar adler = function () {\n var a = 1, b = 0;\n return {\n p: function (d) {\n // closures have awful performance\n var n = a, m = b;\n var l = d.length | 0;\n for (var i = 0; i != l;) {\n var e = Math.min(i + 2655, l);\n for (; i < e; ++i)\n m += n += d[i];\n n = (n & 65535) + 15 * (n >> 16), m = (m & 65535) + 15 * (m >> 16);\n }\n a = n, b = m;\n },\n d: function () {\n a %= 65521, b %= 65521;\n return (a & 255) << 24 | (a >>> 8) << 16 | (b & 255) << 8 | (b >>> 8);\n }\n };\n};\n;\n// deflate with opts\nvar dopt = function (dat, opt, pre, post, st) {\n return dflt(dat, opt.level == null ? 6 : opt.level, opt.mem == null ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : (12 + opt.mem), pre, post, !st);\n};\n// Walmart object spread\nvar mrg = function (a, b) {\n var o = {};\n for (var k in a)\n o[k] = a[k];\n for (var k in b)\n o[k] = b[k];\n return o;\n};\n// worker clone\n// This is possibly the craziest part of the entire codebase, despite how simple it may seem.\n// The only parameter to this function is a closure that returns an array of variables outside of the function scope.\n// We're going to try to figure out the variable names used in the closure as strings because that is crucial for workerization.\n// We will return an object mapping of true variable name to value (basically, the current scope as a JS object).\n// The reason we can't just use the original variable names is minifiers mangling the toplevel scope.\n// This took me three weeks to figure out how to do.\nvar wcln = function (fn, fnStr, td) {\n var dt = fn();\n var st = fn.toString();\n var ks = st.slice(st.indexOf('[') + 1, st.lastIndexOf(']')).replace(/\\s+/g, '').split(',');\n for (var i = 0; i < dt.length; ++i) {\n var v = dt[i], k = ks[i];\n if (typeof v == 'function') {\n fnStr += ';' + k + '=';\n var st_1 = v.toString();\n if (v.prototype) {\n // for global objects\n if (st_1.indexOf('[native code]') != -1) {\n var spInd = st_1.indexOf(' ', 8) + 1;\n fnStr += st_1.slice(spInd, st_1.indexOf('(', spInd));\n }\n else {\n fnStr += st_1;\n for (var t in v.prototype)\n fnStr += ';' + k + '.prototype.' + t + '=' + v.prototype[t].toString();\n }\n }\n else\n fnStr += st_1;\n }\n else\n td[k] = v;\n }\n return [fnStr, td];\n};\nvar ch = [];\n// clone bufs\nvar cbfs = function (v) {\n var tl = [];\n for (var k in v) {\n if (v[k].buffer) {\n tl.push((v[k] = new v[k].constructor(v[k])).buffer);\n }\n }\n return tl;\n};\n// use a worker to execute code\nvar wrkr = function (fns, init, id, cb) {\n var _a;\n if (!ch[id]) {\n var fnStr = '', td_1 = {}, m = fns.length - 1;\n for (var i = 0; i < m; ++i)\n _a = wcln(fns[i], fnStr, td_1), fnStr = _a[0], td_1 = _a[1];\n ch[id] = wcln(fns[m], fnStr, td_1);\n }\n var td = mrg({}, ch[id][1]);\n return wk(ch[id][0] + ';onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=' + init.toString() + '}', id, td, cbfs(td), cb);\n};\n// base async inflate fn\nvar bInflt = function () { return [u8, u16, u32, fleb, fdeb, clim, fl, fd, flrm, fdrm, rev, ec, hMap, max, bits, bits16, shft, slc, err, inflt, inflateSync, pbf, gu8]; };\nvar bDflt = function () { return [u8, u16, u32, fleb, fdeb, clim, revfl, revfd, flm, flt, fdm, fdt, rev, deo, et, hMap, wbits, wbits16, hTree, ln, lc, clen, wfblk, wblk, shft, slc, dflt, dopt, deflateSync, pbf]; };\n// gzip extra\nvar gze = function () { return [gzh, gzhl, wbytes, crc, crct]; };\n// gunzip extra\nvar guze = function () { return [gzs, gzl]; };\n// zlib extra\nvar zle = function () { return [zlh, wbytes, adler]; };\n// unzlib extra\nvar zule = function () { return [zlv]; };\n// post buf\nvar pbf = function (msg) { return postMessage(msg, [msg.buffer]); };\n// get u8\nvar gu8 = function (o) { return o && o.size && new u8(o.size); };\n// async helper\nvar cbify = function (dat, opts, fns, init, id, cb) {\n var w = wrkr(fns, init, id, function (err, dat) {\n w.terminate();\n cb(err, dat);\n });\n w.postMessage([dat, opts], opts.consume ? [dat.buffer] : []);\n return function () { w.terminate(); };\n};\n// auto stream\nvar astrm = function (strm) {\n strm.ondata = function (dat, final) { return postMessage([dat, final], [dat.buffer]); };\n return function (ev) { return strm.push(ev.data[0], ev.data[1]); };\n};\n// async stream attach\nvar astrmify = function (fns, strm, opts, init, id) {\n var t;\n var w = wrkr(fns, init, id, function (err, dat) {\n if (err)\n w.terminate(), strm.ondata.call(strm, err);\n else {\n if (dat[1])\n w.terminate();\n strm.ondata.call(strm, err, dat[0], dat[1]);\n }\n });\n w.postMessage(opts);\n strm.push = function (d, f) {\n if (!strm.ondata)\n err(5);\n if (t)\n strm.ondata(err(4, 0, 1), null, !!f);\n w.postMessage([d, t = f], [d.buffer]);\n };\n strm.terminate = function () { w.terminate(); };\n};\n// read 2 bytes\nvar b2 = function (d, b) { return d[b] | (d[b + 1] << 8); };\n// read 4 bytes\nvar b4 = function (d, b) { return (d[b] | (d[b + 1] << 8) | (d[b + 2] << 16) | (d[b + 3] << 24)) >>> 0; };\nvar b8 = function (d, b) { return b4(d, b) + (b4(d, b + 4) * 4294967296); };\n// write bytes\nvar wbytes = function (d, b, v) {\n for (; v; ++b)\n d[b] = v, v >>>= 8;\n};\n// gzip header\nvar gzh = function (c, o) {\n var fn = o.filename;\n c[0] = 31, c[1] = 139, c[2] = 8, c[8] = o.level < 2 ? 4 : o.level == 9 ? 2 : 0, c[9] = 3; // assume Unix\n if (o.mtime != 0)\n wbytes(c, 4, Math.floor(new Date(o.mtime || Date.now()) / 1000));\n if (fn) {\n c[3] = 8;\n for (var i = 0; i <= fn.length; ++i)\n c[i + 10] = fn.charCodeAt(i);\n }\n};\n// gzip footer: -8 to -4 = CRC, -4 to -0 is length\n// gzip start\nvar gzs = function (d) {\n if (d[0] != 31 || d[1] != 139 || d[2] != 8)\n err(6, 'invalid gzip data');\n var flg = d[3];\n var st = 10;\n if (flg & 4)\n st += d[10] | (d[11] << 8) + 2;\n for (var zs = (flg >> 3 & 1) + (flg >> 4 & 1); zs > 0; zs -= !d[st++])\n ;\n return st + (flg & 2);\n};\n// gzip length\nvar gzl = function (d) {\n var l = d.length;\n return ((d[l - 4] | d[l - 3] << 8 | d[l - 2] << 16) | (d[l - 1] << 24)) >>> 0;\n};\n// gzip header length\nvar gzhl = function (o) { return 10 + ((o.filename && (o.filename.length + 1)) || 0); };\n// zlib header\nvar zlh = function (c, o) {\n var lv = o.level, fl = lv == 0 ? 0 : lv < 6 ? 1 : lv == 9 ? 3 : 2;\n c[0] = 120, c[1] = (fl << 6) | (fl ? (32 - 2 * fl) : 1);\n};\n// zlib valid\nvar zlv = function (d) {\n if ((d[0] & 15) != 8 || (d[0] >>> 4) > 7 || ((d[0] << 8 | d[1]) % 31))\n err(6, 'invalid zlib data');\n if (d[1] & 32)\n err(6, 'invalid zlib data: preset dictionaries not supported');\n};\nfunction AsyncCmpStrm(opts, cb) {\n if (!cb && typeof opts == 'function')\n cb = opts, opts = {};\n this.ondata = cb;\n return opts;\n}\n// zlib footer: -4 to -0 is Adler32\n/**\n * Streaming DEFLATE compression\n */\nvar Deflate = /*#__PURE__*/ (function () {\n function Deflate(opts, cb) {\n if (!cb && typeof opts == 'function')\n cb = opts, opts = {};\n this.ondata = cb;\n this.o = opts || {};\n }\n Deflate.prototype.p = function (c, f) {\n this.ondata(dopt(c, this.o, 0, 0, !f), f);\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Deflate.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n if (this.d)\n err(4);\n this.d = final;\n this.p(chunk, final || false);\n };\n return Deflate;\n}());\nexport { Deflate };\n/**\n * Asynchronous streaming DEFLATE compression\n */\nvar AsyncDeflate = /*#__PURE__*/ (function () {\n function AsyncDeflate(opts, cb) {\n astrmify([\n bDflt,\n function () { return [astrm, Deflate]; }\n ], this, AsyncCmpStrm.call(this, opts, cb), function (ev) {\n var strm = new Deflate(ev.data);\n onmessage = astrm(strm);\n }, 6);\n }\n return AsyncDeflate;\n}());\nexport { AsyncDeflate };\nexport function deflate(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bDflt,\n ], function (ev) { return pbf(deflateSync(ev.data[0], ev.data[1])); }, 0, cb);\n}\n/**\n * Compresses data with DEFLATE without any wrapper\n * @param data The data to compress\n * @param opts The compression options\n * @returns The deflated version of the data\n */\nexport function deflateSync(data, opts) {\n return dopt(data, opts || {}, 0, 0);\n}\n/**\n * Streaming DEFLATE decompression\n */\nvar Inflate = /*#__PURE__*/ (function () {\n /**\n * Creates an inflation stream\n * @param cb The callback to call whenever data is inflated\n */\n function Inflate(cb) {\n this.s = {};\n this.p = new u8(0);\n this.ondata = cb;\n }\n Inflate.prototype.e = function (c) {\n if (!this.ondata)\n err(5);\n if (this.d)\n err(4);\n var l = this.p.length;\n var n = new u8(l + c.length);\n n.set(this.p), n.set(c, l), this.p = n;\n };\n Inflate.prototype.c = function (final) {\n this.d = this.s.i = final || false;\n var bts = this.s.b;\n var dt = inflt(this.p, this.o, this.s);\n this.ondata(slc(dt, bts, this.s.b), this.d);\n this.o = slc(dt, this.s.b - 32768), this.s.b = this.o.length;\n this.p = slc(this.p, (this.s.p / 8) | 0), this.s.p &= 7;\n };\n /**\n * Pushes a chunk to be inflated\n * @param chunk The chunk to push\n * @param final Whether this is the final chunk\n */\n Inflate.prototype.push = function (chunk, final) {\n this.e(chunk), this.c(final);\n };\n return Inflate;\n}());\nexport { Inflate };\n/**\n * Asynchronous streaming DEFLATE decompression\n */\nvar AsyncInflate = /*#__PURE__*/ (function () {\n /**\n * Creates an asynchronous inflation stream\n * @param cb The callback to call whenever data is deflated\n */\n function AsyncInflate(cb) {\n this.ondata = cb;\n astrmify([\n bInflt,\n function () { return [astrm, Inflate]; }\n ], this, 0, function () {\n var strm = new Inflate();\n onmessage = astrm(strm);\n }, 7);\n }\n return AsyncInflate;\n}());\nexport { AsyncInflate };\nexport function inflate(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bInflt\n ], function (ev) { return pbf(inflateSync(ev.data[0], gu8(ev.data[1]))); }, 1, cb);\n}\n/**\n * Expands DEFLATE data with no wrapper\n * @param data The data to decompress\n * @param out Where to write the data. Saves memory if you know the decompressed size and provide an output buffer of that length.\n * @returns The decompressed version of the data\n */\nexport function inflateSync(data, out) {\n return inflt(data, out);\n}\n// before you yell at me for not just using extends, my reason is that TS inheritance is hard to workerize.\n/**\n * Streaming GZIP compression\n */\nvar Gzip = /*#__PURE__*/ (function () {\n function Gzip(opts, cb) {\n this.c = crc();\n this.l = 0;\n this.v = 1;\n Deflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be GZIPped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Gzip.prototype.push = function (chunk, final) {\n Deflate.prototype.push.call(this, chunk, final);\n };\n Gzip.prototype.p = function (c, f) {\n this.c.p(c);\n this.l += c.length;\n var raw = dopt(c, this.o, this.v && gzhl(this.o), f && 8, !f);\n if (this.v)\n gzh(raw, this.o), this.v = 0;\n if (f)\n wbytes(raw, raw.length - 8, this.c.d()), wbytes(raw, raw.length - 4, this.l);\n this.ondata(raw, f);\n };\n return Gzip;\n}());\nexport { Gzip };\n/**\n * Asynchronous streaming GZIP compression\n */\nvar AsyncGzip = /*#__PURE__*/ (function () {\n function AsyncGzip(opts, cb) {\n astrmify([\n bDflt,\n gze,\n function () { return [astrm, Deflate, Gzip]; }\n ], this, AsyncCmpStrm.call(this, opts, cb), function (ev) {\n var strm = new Gzip(ev.data);\n onmessage = astrm(strm);\n }, 8);\n }\n return AsyncGzip;\n}());\nexport { AsyncGzip };\nexport function gzip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bDflt,\n gze,\n function () { return [gzipSync]; }\n ], function (ev) { return pbf(gzipSync(ev.data[0], ev.data[1])); }, 2, cb);\n}\n/**\n * Compresses data with GZIP\n * @param data The data to compress\n * @param opts The compression options\n * @returns The gzipped version of the data\n */\nexport function gzipSync(data, opts) {\n if (!opts)\n opts = {};\n var c = crc(), l = data.length;\n c.p(data);\n var d = dopt(data, opts, gzhl(opts), 8), s = d.length;\n return gzh(d, opts), wbytes(d, s - 8, c.d()), wbytes(d, s - 4, l), d;\n}\n/**\n * Streaming GZIP decompression\n */\nvar Gunzip = /*#__PURE__*/ (function () {\n /**\n * Creates a GUNZIP stream\n * @param cb The callback to call whenever data is inflated\n */\n function Gunzip(cb) {\n this.v = 1;\n Inflate.call(this, cb);\n }\n /**\n * Pushes a chunk to be GUNZIPped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Gunzip.prototype.push = function (chunk, final) {\n Inflate.prototype.e.call(this, chunk);\n if (this.v) {\n var s = this.p.length > 3 ? gzs(this.p) : 4;\n if (s >= this.p.length && !final)\n return;\n this.p = this.p.subarray(s), this.v = 0;\n }\n if (final) {\n if (this.p.length < 8)\n err(6, 'invalid gzip data');\n this.p = this.p.subarray(0, -8);\n }\n // necessary to prevent TS from using the closure value\n // This allows for workerization to function correctly\n Inflate.prototype.c.call(this, final);\n };\n return Gunzip;\n}());\nexport { Gunzip };\n/**\n * Asynchronous streaming GZIP decompression\n */\nvar AsyncGunzip = /*#__PURE__*/ (function () {\n /**\n * Creates an asynchronous GUNZIP stream\n * @param cb The callback to call whenever data is deflated\n */\n function AsyncGunzip(cb) {\n this.ondata = cb;\n astrmify([\n bInflt,\n guze,\n function () { return [astrm, Inflate, Gunzip]; }\n ], this, 0, function () {\n var strm = new Gunzip();\n onmessage = astrm(strm);\n }, 9);\n }\n return AsyncGunzip;\n}());\nexport { AsyncGunzip };\nexport function gunzip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bInflt,\n guze,\n function () { return [gunzipSync]; }\n ], function (ev) { return pbf(gunzipSync(ev.data[0])); }, 3, cb);\n}\n/**\n * Expands GZIP data\n * @param data The data to decompress\n * @param out Where to write the data. GZIP already encodes the output size, so providing this doesn't save memory.\n * @returns The decompressed version of the data\n */\nexport function gunzipSync(data, out) {\n return inflt(data.subarray(gzs(data), -8), out || new u8(gzl(data)));\n}\n/**\n * Streaming Zlib compression\n */\nvar Zlib = /*#__PURE__*/ (function () {\n function Zlib(opts, cb) {\n this.c = adler();\n this.v = 1;\n Deflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be zlibbed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Zlib.prototype.push = function (chunk, final) {\n Deflate.prototype.push.call(this, chunk, final);\n };\n Zlib.prototype.p = function (c, f) {\n this.c.p(c);\n var raw = dopt(c, this.o, this.v && 2, f && 4, !f);\n if (this.v)\n zlh(raw, this.o), this.v = 0;\n if (f)\n wbytes(raw, raw.length - 4, this.c.d());\n this.ondata(raw, f);\n };\n return Zlib;\n}());\nexport { Zlib };\n/**\n * Asynchronous streaming Zlib compression\n */\nvar AsyncZlib = /*#__PURE__*/ (function () {\n function AsyncZlib(opts, cb) {\n astrmify([\n bDflt,\n zle,\n function () { return [astrm, Deflate, Zlib]; }\n ], this, AsyncCmpStrm.call(this, opts, cb), function (ev) {\n var strm = new Zlib(ev.data);\n onmessage = astrm(strm);\n }, 10);\n }\n return AsyncZlib;\n}());\nexport { AsyncZlib };\nexport function zlib(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bDflt,\n zle,\n function () { return [zlibSync]; }\n ], function (ev) { return pbf(zlibSync(ev.data[0], ev.data[1])); }, 4, cb);\n}\n/**\n * Compress data with Zlib\n * @param data The data to compress\n * @param opts The compression options\n * @returns The zlib-compressed version of the data\n */\nexport function zlibSync(data, opts) {\n if (!opts)\n opts = {};\n var a = adler();\n a.p(data);\n var d = dopt(data, opts, 2, 4);\n return zlh(d, opts), wbytes(d, d.length - 4, a.d()), d;\n}\n/**\n * Streaming Zlib decompression\n */\nvar Unzlib = /*#__PURE__*/ (function () {\n /**\n * Creates a Zlib decompression stream\n * @param cb The callback to call whenever data is inflated\n */\n function Unzlib(cb) {\n this.v = 1;\n Inflate.call(this, cb);\n }\n /**\n * Pushes a chunk to be unzlibbed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Unzlib.prototype.push = function (chunk, final) {\n Inflate.prototype.e.call(this, chunk);\n if (this.v) {\n if (this.p.length < 2 && !final)\n return;\n this.p = this.p.subarray(2), this.v = 0;\n }\n if (final) {\n if (this.p.length < 4)\n err(6, 'invalid zlib data');\n this.p = this.p.subarray(0, -4);\n }\n // necessary to prevent TS from using the closure value\n // This allows for workerization to function correctly\n Inflate.prototype.c.call(this, final);\n };\n return Unzlib;\n}());\nexport { Unzlib };\n/**\n * Asynchronous streaming Zlib decompression\n */\nvar AsyncUnzlib = /*#__PURE__*/ (function () {\n /**\n * Creates an asynchronous Zlib decompression stream\n * @param cb The callback to call whenever data is deflated\n */\n function AsyncUnzlib(cb) {\n this.ondata = cb;\n astrmify([\n bInflt,\n zule,\n function () { return [astrm, Inflate, Unzlib]; }\n ], this, 0, function () {\n var strm = new Unzlib();\n onmessage = astrm(strm);\n }, 11);\n }\n return AsyncUnzlib;\n}());\nexport { AsyncUnzlib };\nexport function unzlib(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bInflt,\n zule,\n function () { return [unzlibSync]; }\n ], function (ev) { return pbf(unzlibSync(ev.data[0], gu8(ev.data[1]))); }, 5, cb);\n}\n/**\n * Expands Zlib data\n * @param data The data to decompress\n * @param out Where to write the data. Saves memory if you know the decompressed size and provide an output buffer of that length.\n * @returns The decompressed version of the data\n */\nexport function unzlibSync(data, out) {\n return inflt((zlv(data), data.subarray(2, -4)), out);\n}\n// Default algorithm for compression (used because having a known output size allows faster decompression)\nexport { gzip as compress, AsyncGzip as AsyncCompress };\n// Default algorithm for compression (used because having a known output size allows faster decompression)\nexport { gzipSync as compressSync, Gzip as Compress };\n/**\n * Streaming GZIP, Zlib, or raw DEFLATE decompression\n */\nvar Decompress = /*#__PURE__*/ (function () {\n /**\n * Creates a decompression stream\n * @param cb The callback to call whenever data is decompressed\n */\n function Decompress(cb) {\n this.G = Gunzip;\n this.I = Inflate;\n this.Z = Unzlib;\n this.ondata = cb;\n }\n /**\n * Pushes a chunk to be decompressed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Decompress.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n if (!this.s) {\n if (this.p && this.p.length) {\n var n = new u8(this.p.length + chunk.length);\n n.set(this.p), n.set(chunk, this.p.length);\n }\n else\n this.p = chunk;\n if (this.p.length > 2) {\n var _this_1 = this;\n var cb = function () { _this_1.ondata.apply(_this_1, arguments); };\n this.s = (this.p[0] == 31 && this.p[1] == 139 && this.p[2] == 8)\n ? new this.G(cb)\n : ((this.p[0] & 15) != 8 || (this.p[0] >> 4) > 7 || ((this.p[0] << 8 | this.p[1]) % 31))\n ? new this.I(cb)\n : new this.Z(cb);\n this.s.push(this.p, final);\n this.p = null;\n }\n }\n else\n this.s.push(chunk, final);\n };\n return Decompress;\n}());\nexport { Decompress };\n/**\n * Asynchronous streaming GZIP, Zlib, or raw DEFLATE decompression\n */\nvar AsyncDecompress = /*#__PURE__*/ (function () {\n /**\n * Creates an asynchronous decompression stream\n * @param cb The callback to call whenever data is decompressed\n */\n function AsyncDecompress(cb) {\n this.G = AsyncGunzip;\n this.I = AsyncInflate;\n this.Z = AsyncUnzlib;\n this.ondata = cb;\n }\n /**\n * Pushes a chunk to be decompressed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n AsyncDecompress.prototype.push = function (chunk, final) {\n Decompress.prototype.push.call(this, chunk, final);\n };\n return AsyncDecompress;\n}());\nexport { AsyncDecompress };\nexport function decompress(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return (data[0] == 31 && data[1] == 139 && data[2] == 8)\n ? gunzip(data, opts, cb)\n : ((data[0] & 15) != 8 || (data[0] >> 4) > 7 || ((data[0] << 8 | data[1]) % 31))\n ? inflate(data, opts, cb)\n : unzlib(data, opts, cb);\n}\n/**\n * Expands compressed GZIP, Zlib, or raw DEFLATE data, automatically detecting the format\n * @param data The data to decompress\n * @param out Where to write the data. Saves memory if you know the decompressed size and provide an output buffer of that length.\n * @returns The decompressed version of the data\n */\nexport function decompressSync(data, out) {\n return (data[0] == 31 && data[1] == 139 && data[2] == 8)\n ? gunzipSync(data, out)\n : ((data[0] & 15) != 8 || (data[0] >> 4) > 7 || ((data[0] << 8 | data[1]) % 31))\n ? inflateSync(data, out)\n : unzlibSync(data, out);\n}\n// flatten a directory structure\nvar fltn = function (d, p, t, o) {\n for (var k in d) {\n var val = d[k], n = p + k, op = o;\n if (Array.isArray(val))\n op = mrg(o, val[1]), val = val[0];\n if (val instanceof u8)\n t[n] = [val, op];\n else {\n t[n += '/'] = [new u8(0), op];\n fltn(val, n, t, o);\n }\n }\n};\n// text encoder\nvar te = typeof TextEncoder != 'undefined' && /*#__PURE__*/ new TextEncoder();\n// text decoder\nvar td = typeof TextDecoder != 'undefined' && /*#__PURE__*/ new TextDecoder();\n// text decoder stream\nvar tds = 0;\ntry {\n td.decode(et, { stream: true });\n tds = 1;\n}\ncatch (e) { }\n// decode UTF8\nvar dutf8 = function (d) {\n for (var r = '', i = 0;;) {\n var c = d[i++];\n var eb = (c > 127) + (c > 223) + (c > 239);\n if (i + eb > d.length)\n return [r, slc(d, i - 1)];\n if (!eb)\n r += String.fromCharCode(c);\n else if (eb == 3) {\n c = ((c & 15) << 18 | (d[i++] & 63) << 12 | (d[i++] & 63) << 6 | (d[i++] & 63)) - 65536,\n r += String.fromCharCode(55296 | (c >> 10), 56320 | (c & 1023));\n }\n else if (eb & 1)\n r += String.fromCharCode((c & 31) << 6 | (d[i++] & 63));\n else\n r += String.fromCharCode((c & 15) << 12 | (d[i++] & 63) << 6 | (d[i++] & 63));\n }\n};\n/**\n * Streaming UTF-8 decoding\n */\nvar DecodeUTF8 = /*#__PURE__*/ (function () {\n /**\n * Creates a UTF-8 decoding stream\n * @param cb The callback to call whenever data is decoded\n */\n function DecodeUTF8(cb) {\n this.ondata = cb;\n if (tds)\n this.t = new TextDecoder();\n else\n this.p = et;\n }\n /**\n * Pushes a chunk to be decoded from UTF-8 binary\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n DecodeUTF8.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n final = !!final;\n if (this.t) {\n this.ondata(this.t.decode(chunk, { stream: true }), final);\n if (final) {\n if (this.t.decode().length)\n err(8);\n this.t = null;\n }\n return;\n }\n if (!this.p)\n err(4);\n var dat = new u8(this.p.length + chunk.length);\n dat.set(this.p);\n dat.set(chunk, this.p.length);\n var _a = dutf8(dat), ch = _a[0], np = _a[1];\n if (final) {\n if (np.length)\n err(8);\n this.p = null;\n }\n else\n this.p = np;\n this.ondata(ch, final);\n };\n return DecodeUTF8;\n}());\nexport { DecodeUTF8 };\n/**\n * Streaming UTF-8 encoding\n */\nvar EncodeUTF8 = /*#__PURE__*/ (function () {\n /**\n * Creates a UTF-8 decoding stream\n * @param cb The callback to call whenever data is encoded\n */\n function EncodeUTF8(cb) {\n this.ondata = cb;\n }\n /**\n * Pushes a chunk to be encoded to UTF-8\n * @param chunk The string data to push\n * @param final Whether this is the last chunk\n */\n EncodeUTF8.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n if (this.d)\n err(4);\n this.ondata(strToU8(chunk), this.d = final || false);\n };\n return EncodeUTF8;\n}());\nexport { EncodeUTF8 };\n/**\n * Converts a string into a Uint8Array for use with compression/decompression methods\n * @param str The string to encode\n * @param latin1 Whether or not to interpret the data as Latin-1. This should\n * not need to be true unless decoding a binary string.\n * @returns The string encoded in UTF-8/Latin-1 binary\n */\nexport function strToU8(str, latin1) {\n if (latin1) {\n var ar_1 = new u8(str.length);\n for (var i = 0; i < str.length; ++i)\n ar_1[i] = str.charCodeAt(i);\n return ar_1;\n }\n if (te)\n return te.encode(str);\n var l = str.length;\n var ar = new u8(str.length + (str.length >> 1));\n var ai = 0;\n var w = function (v) { ar[ai++] = v; };\n for (var i = 0; i < l; ++i) {\n if (ai + 5 > ar.length) {\n var n = new u8(ai + 8 + ((l - i) << 1));\n n.set(ar);\n ar = n;\n }\n var c = str.charCodeAt(i);\n if (c < 128 || latin1)\n w(c);\n else if (c < 2048)\n w(192 | (c >> 6)), w(128 | (c & 63));\n else if (c > 55295 && c < 57344)\n c = 65536 + (c & 1023 << 10) | (str.charCodeAt(++i) & 1023),\n w(240 | (c >> 18)), w(128 | ((c >> 12) & 63)), w(128 | ((c >> 6) & 63)), w(128 | (c & 63));\n else\n w(224 | (c >> 12)), w(128 | ((c >> 6) & 63)), w(128 | (c & 63));\n }\n return slc(ar, 0, ai);\n}\n/**\n * Converts a Uint8Array to a string\n * @param dat The data to decode to string\n * @param latin1 Whether or not to interpret the data as Latin-1. This should\n * not need to be true unless encoding to binary string.\n * @returns The original UTF-8/Latin-1 string\n */\nexport function strFromU8(dat, latin1) {\n if (latin1) {\n var r = '';\n for (var i = 0; i < dat.length; i += 16384)\n r += String.fromCharCode.apply(null, dat.subarray(i, i + 16384));\n return r;\n }\n else if (td)\n return td.decode(dat);\n else {\n var _a = dutf8(dat), out = _a[0], ext = _a[1];\n if (ext.length)\n err(8);\n return out;\n }\n}\n;\n// deflate bit flag\nvar dbf = function (l) { return l == 1 ? 3 : l < 6 ? 2 : l == 9 ? 1 : 0; };\n// skip local zip header\nvar slzh = function (d, b) { return b + 30 + b2(d, b + 26) + b2(d, b + 28); };\n// read zip header\nvar zh = function (d, b, z) {\n var fnl = b2(d, b + 28), fn = strFromU8(d.subarray(b + 46, b + 46 + fnl), !(b2(d, b + 8) & 2048)), es = b + 46 + fnl, bs = b4(d, b + 20);\n var _a = z && bs == 4294967295 ? z64e(d, es) : [bs, b4(d, b + 24), b4(d, b + 42)], sc = _a[0], su = _a[1], off = _a[2];\n return [b2(d, b + 10), sc, su, fn, es + b2(d, b + 30) + b2(d, b + 32), off];\n};\n// read zip64 extra field\nvar z64e = function (d, b) {\n for (; b2(d, b) != 1; b += 4 + b2(d, b + 2))\n ;\n return [b8(d, b + 12), b8(d, b + 4), b8(d, b + 20)];\n};\n// extra field length\nvar exfl = function (ex) {\n var le = 0;\n if (ex) {\n for (var k in ex) {\n var l = ex[k].length;\n if (l > 65535)\n err(9);\n le += l + 4;\n }\n }\n return le;\n};\n// write zip header\nvar wzh = function (d, b, f, fn, u, c, ce, co) {\n var fl = fn.length, ex = f.extra, col = co && co.length;\n var exl = exfl(ex);\n wbytes(d, b, ce != null ? 0x2014B50 : 0x4034B50), b += 4;\n if (ce != null)\n d[b++] = 20, d[b++] = f.os;\n d[b] = 20, b += 2; // spec compliance? what's that?\n d[b++] = (f.flag << 1) | (c < 0 && 8), d[b++] = u && 8;\n d[b++] = f.compression & 255, d[b++] = f.compression >> 8;\n var dt = new Date(f.mtime == null ? Date.now() : f.mtime), y = dt.getFullYear() - 1980;\n if (y < 0 || y > 119)\n err(10);\n wbytes(d, b, (y << 25) | ((dt.getMonth() + 1) << 21) | (dt.getDate() << 16) | (dt.getHours() << 11) | (dt.getMinutes() << 5) | (dt.getSeconds() >>> 1)), b += 4;\n if (c != -1) {\n wbytes(d, b, f.crc);\n wbytes(d, b + 4, c < 0 ? -c - 2 : c);\n wbytes(d, b + 8, f.size);\n }\n wbytes(d, b + 12, fl);\n wbytes(d, b + 14, exl), b += 16;\n if (ce != null) {\n wbytes(d, b, col);\n wbytes(d, b + 6, f.attrs);\n wbytes(d, b + 10, ce), b += 14;\n }\n d.set(fn, b);\n b += fl;\n if (exl) {\n for (var k in ex) {\n var exf = ex[k], l = exf.length;\n wbytes(d, b, +k);\n wbytes(d, b + 2, l);\n d.set(exf, b + 4), b += 4 + l;\n }\n }\n if (col)\n d.set(co, b), b += col;\n return b;\n};\n// write zip footer (end of central directory)\nvar wzf = function (o, b, c, d, e) {\n wbytes(o, b, 0x6054B50); // skip disk\n wbytes(o, b + 8, c);\n wbytes(o, b + 10, c);\n wbytes(o, b + 12, d);\n wbytes(o, b + 16, e);\n};\n/**\n * A pass-through stream to keep data uncompressed in a ZIP archive.\n */\nvar ZipPassThrough = /*#__PURE__*/ (function () {\n /**\n * Creates a pass-through stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n */\n function ZipPassThrough(filename) {\n this.filename = filename;\n this.c = crc();\n this.size = 0;\n this.compression = 0;\n }\n /**\n * Processes a chunk and pushes to the output stream. You can override this\n * method in a subclass for custom behavior, but by default this passes\n * the data through. You must call this.ondata(err, chunk, final) at some\n * point in this method.\n * @param chunk The chunk to process\n * @param final Whether this is the last chunk\n */\n ZipPassThrough.prototype.process = function (chunk, final) {\n this.ondata(null, chunk, final);\n };\n /**\n * Pushes a chunk to be added. If you are subclassing this with a custom\n * compression algorithm, note that you must push data from the source\n * file only, pre-compression.\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n ZipPassThrough.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n this.c.p(chunk);\n this.size += chunk.length;\n if (final)\n this.crc = this.c.d();\n this.process(chunk, final || false);\n };\n return ZipPassThrough;\n}());\nexport { ZipPassThrough };\n// I don't extend because TypeScript extension adds 1kB of runtime bloat\n/**\n * Streaming DEFLATE compression for ZIP archives. Prefer using AsyncZipDeflate\n * for better performance\n */\nvar ZipDeflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n * @param opts The compression options\n */\n function ZipDeflate(filename, opts) {\n var _this_1 = this;\n if (!opts)\n opts = {};\n ZipPassThrough.call(this, filename);\n this.d = new Deflate(opts, function (dat, final) {\n _this_1.ondata(null, dat, final);\n });\n this.compression = 8;\n this.flag = dbf(opts.level);\n }\n ZipDeflate.prototype.process = function (chunk, final) {\n try {\n this.d.push(chunk, final);\n }\n catch (e) {\n this.ondata(e, null, final);\n }\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n ZipDeflate.prototype.push = function (chunk, final) {\n ZipPassThrough.prototype.push.call(this, chunk, final);\n };\n return ZipDeflate;\n}());\nexport { ZipDeflate };\n/**\n * Asynchronous streaming DEFLATE compression for ZIP archives\n */\nvar AsyncZipDeflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n * @param opts The compression options\n */\n function AsyncZipDeflate(filename, opts) {\n var _this_1 = this;\n if (!opts)\n opts = {};\n ZipPassThrough.call(this, filename);\n this.d = new AsyncDeflate(opts, function (err, dat, final) {\n _this_1.ondata(err, dat, final);\n });\n this.compression = 8;\n this.flag = dbf(opts.level);\n this.terminate = this.d.terminate;\n }\n AsyncZipDeflate.prototype.process = function (chunk, final) {\n this.d.push(chunk, final);\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n AsyncZipDeflate.prototype.push = function (chunk, final) {\n ZipPassThrough.prototype.push.call(this, chunk, final);\n };\n return AsyncZipDeflate;\n}());\nexport { AsyncZipDeflate };\n// TODO: Better tree shaking\n/**\n * A zippable archive to which files can incrementally be added\n */\nvar Zip = /*#__PURE__*/ (function () {\n /**\n * Creates an empty ZIP archive to which files can be added\n * @param cb The callback to call whenever data for the generated ZIP archive\n * is available\n */\n function Zip(cb) {\n this.ondata = cb;\n this.u = [];\n this.d = 1;\n }\n /**\n * Adds a file to the ZIP archive\n * @param file The file stream to add\n */\n Zip.prototype.add = function (file) {\n var _this_1 = this;\n if (!this.ondata)\n err(5);\n // finishing or finished\n if (this.d & 2)\n this.ondata(err(4 + (this.d & 1) * 8, 0, 1), null, false);\n else {\n var f = strToU8(file.filename), fl_1 = f.length;\n var com = file.comment, o = com && strToU8(com);\n var u = fl_1 != file.filename.length || (o && (com.length != o.length));\n var hl_1 = fl_1 + exfl(file.extra) + 30;\n if (fl_1 > 65535)\n this.ondata(err(11, 0, 1), null, false);\n var header = new u8(hl_1);\n wzh(header, 0, file, f, u, -1);\n var chks_1 = [header];\n var pAll_1 = function () {\n for (var _i = 0, chks_2 = chks_1; _i < chks_2.length; _i++) {\n var chk = chks_2[_i];\n _this_1.ondata(null, chk, false);\n }\n chks_1 = [];\n };\n var tr_1 = this.d;\n this.d = 0;\n var ind_1 = this.u.length;\n var uf_1 = mrg(file, {\n f: f,\n u: u,\n o: o,\n t: function () {\n if (file.terminate)\n file.terminate();\n },\n r: function () {\n pAll_1();\n if (tr_1) {\n var nxt = _this_1.u[ind_1 + 1];\n if (nxt)\n nxt.r();\n else\n _this_1.d = 1;\n }\n tr_1 = 1;\n }\n });\n var cl_1 = 0;\n file.ondata = function (err, dat, final) {\n if (err) {\n _this_1.ondata(err, dat, final);\n _this_1.terminate();\n }\n else {\n cl_1 += dat.length;\n chks_1.push(dat);\n if (final) {\n var dd = new u8(16);\n wbytes(dd, 0, 0x8074B50);\n wbytes(dd, 4, file.crc);\n wbytes(dd, 8, cl_1);\n wbytes(dd, 12, file.size);\n chks_1.push(dd);\n uf_1.c = cl_1, uf_1.b = hl_1 + cl_1 + 16, uf_1.crc = file.crc, uf_1.size = file.size;\n if (tr_1)\n uf_1.r();\n tr_1 = 1;\n }\n else if (tr_1)\n pAll_1();\n }\n };\n this.u.push(uf_1);\n }\n };\n /**\n * Ends the process of adding files and prepares to emit the final chunks.\n * This *must* be called after adding all desired files for the resulting\n * ZIP file to work properly.\n */\n Zip.prototype.end = function () {\n var _this_1 = this;\n if (this.d & 2) {\n this.ondata(err(4 + (this.d & 1) * 8, 0, 1), null, true);\n return;\n }\n if (this.d)\n this.e();\n else\n this.u.push({\n r: function () {\n if (!(_this_1.d & 1))\n return;\n _this_1.u.splice(-1, 1);\n _this_1.e();\n },\n t: function () { }\n });\n this.d = 3;\n };\n Zip.prototype.e = function () {\n var bt = 0, l = 0, tl = 0;\n for (var _i = 0, _a = this.u; _i < _a.length; _i++) {\n var f = _a[_i];\n tl += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0);\n }\n var out = new u8(tl + 22);\n for (var _b = 0, _c = this.u; _b < _c.length; _b++) {\n var f = _c[_b];\n wzh(out, bt, f, f.f, f.u, -f.c - 2, l, f.o);\n bt += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0), l += f.b;\n }\n wzf(out, bt, this.u.length, tl, l);\n this.ondata(null, out, true);\n this.d = 2;\n };\n /**\n * A method to terminate any internal workers used by the stream. Subsequent\n * calls to add() will fail.\n */\n Zip.prototype.terminate = function () {\n for (var _i = 0, _a = this.u; _i < _a.length; _i++) {\n var f = _a[_i];\n f.t();\n }\n this.d = 2;\n };\n return Zip;\n}());\nexport { Zip };\nexport function zip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n var r = {};\n fltn(data, '', r, opts);\n var k = Object.keys(r);\n var lft = k.length, o = 0, tot = 0;\n var slft = lft, files = new Array(lft);\n var term = [];\n var tAll = function () {\n for (var i = 0; i < term.length; ++i)\n term[i]();\n };\n var cbd = function (a, b) {\n mt(function () { cb(a, b); });\n };\n mt(function () { cbd = cb; });\n var cbf = function () {\n var out = new u8(tot + 22), oe = o, cdl = tot - o;\n tot = 0;\n for (var i = 0; i < slft; ++i) {\n var f = files[i];\n try {\n var l = f.c.length;\n wzh(out, tot, f, f.f, f.u, l);\n var badd = 30 + f.f.length + exfl(f.extra);\n var loc = tot + badd;\n out.set(f.c, loc);\n wzh(out, o, f, f.f, f.u, l, tot, f.m), o += 16 + badd + (f.m ? f.m.length : 0), tot = loc + l;\n }\n catch (e) {\n return cbd(e, null);\n }\n }\n wzf(out, o, files.length, cdl, oe);\n cbd(null, out);\n };\n if (!lft)\n cbf();\n var _loop_1 = function (i) {\n var fn = k[i];\n var _a = r[fn], file = _a[0], p = _a[1];\n var c = crc(), size = file.length;\n c.p(file);\n var f = strToU8(fn), s = f.length;\n var com = p.comment, m = com && strToU8(com), ms = m && m.length;\n var exl = exfl(p.extra);\n var compression = p.level == 0 ? 0 : 8;\n var cbl = function (e, d) {\n if (e) {\n tAll();\n cbd(e, null);\n }\n else {\n var l = d.length;\n files[i] = mrg(p, {\n size: size,\n crc: c.d(),\n c: d,\n f: f,\n m: m,\n u: s != fn.length || (m && (com.length != ms)),\n compression: compression\n });\n o += 30 + s + exl + l;\n tot += 76 + 2 * (s + exl) + (ms || 0) + l;\n if (!--lft)\n cbf();\n }\n };\n if (s > 65535)\n cbl(err(11, 0, 1), null);\n if (!compression)\n cbl(null, file);\n else if (size < 160000) {\n try {\n cbl(null, deflateSync(file, p));\n }\n catch (e) {\n cbl(e, null);\n }\n }\n else\n term.push(deflate(file, p, cbl));\n };\n // Cannot use lft because it can decrease\n for (var i = 0; i < slft; ++i) {\n _loop_1(i);\n }\n return tAll;\n}\n/**\n * Synchronously creates a ZIP file. Prefer using `zip` for better performance\n * with more than one file.\n * @param data The directory structure for the ZIP archive\n * @param opts The main options, merged with per-file options\n * @returns The generated ZIP archive\n */\nexport function zipSync(data, opts) {\n if (!opts)\n opts = {};\n var r = {};\n var files = [];\n fltn(data, '', r, opts);\n var o = 0;\n var tot = 0;\n for (var fn in r) {\n var _a = r[fn], file = _a[0], p = _a[1];\n var compression = p.level == 0 ? 0 : 8;\n var f = strToU8(fn), s = f.length;\n var com = p.comment, m = com && strToU8(com), ms = m && m.length;\n var exl = exfl(p.extra);\n if (s > 65535)\n err(11);\n var d = compression ? deflateSync(file, p) : file, l = d.length;\n var c = crc();\n c.p(file);\n files.push(mrg(p, {\n size: file.length,\n crc: c.d(),\n c: d,\n f: f,\n m: m,\n u: s != fn.length || (m && (com.length != ms)),\n o: o,\n compression: compression\n }));\n o += 30 + s + exl + l;\n tot += 76 + 2 * (s + exl) + (ms || 0) + l;\n }\n var out = new u8(tot + 22), oe = o, cdl = tot - o;\n for (var i = 0; i < files.length; ++i) {\n var f = files[i];\n wzh(out, f.o, f, f.f, f.u, f.c.length);\n var badd = 30 + f.f.length + exfl(f.extra);\n out.set(f.c, f.o + badd);\n wzh(out, o, f, f.f, f.u, f.c.length, f.o, f.m), o += 16 + badd + (f.m ? f.m.length : 0);\n }\n wzf(out, o, files.length, cdl, oe);\n return out;\n}\n/**\n * Streaming pass-through decompression for ZIP archives\n */\nvar UnzipPassThrough = /*#__PURE__*/ (function () {\n function UnzipPassThrough() {\n }\n UnzipPassThrough.prototype.push = function (data, final) {\n this.ondata(null, data, final);\n };\n UnzipPassThrough.compression = 0;\n return UnzipPassThrough;\n}());\nexport { UnzipPassThrough };\n/**\n * Streaming DEFLATE decompression for ZIP archives. Prefer AsyncZipInflate for\n * better performance.\n */\nvar UnzipInflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE decompression that can be used in ZIP archives\n */\n function UnzipInflate() {\n var _this_1 = this;\n this.i = new Inflate(function (dat, final) {\n _this_1.ondata(null, dat, final);\n });\n }\n UnzipInflate.prototype.push = function (data, final) {\n try {\n this.i.push(data, final);\n }\n catch (e) {\n this.ondata(e, null, final);\n }\n };\n UnzipInflate.compression = 8;\n return UnzipInflate;\n}());\nexport { UnzipInflate };\n/**\n * Asynchronous streaming DEFLATE decompression for ZIP archives\n */\nvar AsyncUnzipInflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE decompression that can be used in ZIP archives\n */\n function AsyncUnzipInflate(_, sz) {\n var _this_1 = this;\n if (sz < 320000) {\n this.i = new Inflate(function (dat, final) {\n _this_1.ondata(null, dat, final);\n });\n }\n else {\n this.i = new AsyncInflate(function (err, dat, final) {\n _this_1.ondata(err, dat, final);\n });\n this.terminate = this.i.terminate;\n }\n }\n AsyncUnzipInflate.prototype.push = function (data, final) {\n if (this.i.terminate)\n data = slc(data, 0);\n this.i.push(data, final);\n };\n AsyncUnzipInflate.compression = 8;\n return AsyncUnzipInflate;\n}());\nexport { AsyncUnzipInflate };\n/**\n * A ZIP archive decompression stream that emits files as they are discovered\n */\nvar Unzip = /*#__PURE__*/ (function () {\n /**\n * Creates a ZIP decompression stream\n * @param cb The callback to call whenever a file in the ZIP archive is found\n */\n function Unzip(cb) {\n this.onfile = cb;\n this.k = [];\n this.o = {\n 0: UnzipPassThrough\n };\n this.p = et;\n }\n /**\n * Pushes a chunk to be unzipped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Unzip.prototype.push = function (chunk, final) {\n var _this_1 = this;\n if (!this.onfile)\n err(5);\n if (!this.p)\n err(4);\n if (this.c > 0) {\n var len = Math.min(this.c, chunk.length);\n var toAdd = chunk.subarray(0, len);\n this.c -= len;\n if (this.d)\n this.d.push(toAdd, !this.c);\n else\n this.k[0].push(toAdd);\n chunk = chunk.subarray(len);\n if (chunk.length)\n return this.push(chunk, final);\n }\n else {\n var f = 0, i = 0, is = void 0, buf = void 0;\n if (!this.p.length)\n buf = chunk;\n else if (!chunk.length)\n buf = this.p;\n else {\n buf = new u8(this.p.length + chunk.length);\n buf.set(this.p), buf.set(chunk, this.p.length);\n }\n var l = buf.length, oc = this.c, add = oc && this.d;\n var _loop_2 = function () {\n var _a;\n var sig = b4(buf, i);\n if (sig == 0x4034B50) {\n f = 1, is = i;\n this_1.d = null;\n this_1.c = 0;\n var bf = b2(buf, i + 6), cmp_1 = b2(buf, i + 8), u = bf & 2048, dd = bf & 8, fnl = b2(buf, i + 26), es = b2(buf, i + 28);\n if (l > i + 30 + fnl + es) {\n var chks_3 = [];\n this_1.k.unshift(chks_3);\n f = 2;\n var sc_1 = b4(buf, i + 18), su_1 = b4(buf, i + 22);\n var fn_1 = strFromU8(buf.subarray(i + 30, i += 30 + fnl), !u);\n if (sc_1 == 4294967295) {\n _a = dd ? [-2] : z64e(buf, i), sc_1 = _a[0], su_1 = _a[1];\n }\n else if (dd)\n sc_1 = -1;\n i += es;\n this_1.c = sc_1;\n var d_1;\n var file_1 = {\n name: fn_1,\n compression: cmp_1,\n start: function () {\n if (!file_1.ondata)\n err(5);\n if (!sc_1)\n file_1.ondata(null, et, true);\n else {\n var ctr = _this_1.o[cmp_1];\n if (!ctr)\n file_1.ondata(err(14, 'unknown compression type ' + cmp_1, 1), null, false);\n d_1 = sc_1 < 0 ? new ctr(fn_1) : new ctr(fn_1, sc_1, su_1);\n d_1.ondata = function (err, dat, final) { file_1.ondata(err, dat, final); };\n for (var _i = 0, chks_4 = chks_3; _i < chks_4.length; _i++) {\n var dat = chks_4[_i];\n d_1.push(dat, false);\n }\n if (_this_1.k[0] == chks_3 && _this_1.c)\n _this_1.d = d_1;\n else\n d_1.push(et, true);\n }\n },\n terminate: function () {\n if (d_1 && d_1.terminate)\n d_1.terminate();\n }\n };\n if (sc_1 >= 0)\n file_1.size = sc_1, file_1.originalSize = su_1;\n this_1.onfile(file_1);\n }\n return \"break\";\n }\n else if (oc) {\n if (sig == 0x8074B50) {\n is = i += 12 + (oc == -2 && 8), f = 3, this_1.c = 0;\n return \"break\";\n }\n else if (sig == 0x2014B50) {\n is = i -= 4, f = 3, this_1.c = 0;\n return \"break\";\n }\n }\n };\n var this_1 = this;\n for (; i < l - 4; ++i) {\n var state_1 = _loop_2();\n if (state_1 === \"break\")\n break;\n }\n this.p = et;\n if (oc < 0) {\n var dat = f ? buf.subarray(0, is - 12 - (oc == -2 && 8) - (b4(buf, is - 16) == 0x8074B50 && 4)) : buf.subarray(0, i);\n if (add)\n add.push(dat, !!f);\n else\n this.k[+(f == 2)].push(dat);\n }\n if (f & 2)\n return this.push(buf.subarray(i), final);\n this.p = buf.subarray(i);\n }\n if (final) {\n if (this.c)\n err(13);\n this.p = null;\n }\n };\n /**\n * Registers a decoder with the stream, allowing for files compressed with\n * the compression type provided to be expanded correctly\n * @param decoder The decoder constructor\n */\n Unzip.prototype.register = function (decoder) {\n this.o[decoder.compression] = decoder;\n };\n return Unzip;\n}());\nexport { Unzip };\nvar mt = typeof queueMicrotask == 'function' ? queueMicrotask : typeof setTimeout == 'function' ? setTimeout : function (fn) { fn(); };\nexport function unzip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n var term = [];\n var tAll = function () {\n for (var i = 0; i < term.length; ++i)\n term[i]();\n };\n var files = {};\n var cbd = function (a, b) {\n mt(function () { cb(a, b); });\n };\n mt(function () { cbd = cb; });\n var e = data.length - 22;\n for (; b4(data, e) != 0x6054B50; --e) {\n if (!e || data.length - e > 65558) {\n cbd(err(13, 0, 1), null);\n return tAll;\n }\n }\n ;\n var lft = b2(data, e + 8);\n if (lft) {\n var c = lft;\n var o = b4(data, e + 16);\n var z = o == 4294967295 || c == 65535;\n if (z) {\n var ze = b4(data, e - 12);\n z = b4(data, ze) == 0x6064B50;\n if (z) {\n c = lft = b4(data, ze + 32);\n o = b4(data, ze + 48);\n }\n }\n var fltr = opts && opts.filter;\n var _loop_3 = function (i) {\n var _a = zh(data, o, z), c_1 = _a[0], sc = _a[1], su = _a[2], fn = _a[3], no = _a[4], off = _a[5], b = slzh(data, off);\n o = no;\n var cbl = function (e, d) {\n if (e) {\n tAll();\n cbd(e, null);\n }\n else {\n if (d)\n files[fn] = d;\n if (!--lft)\n cbd(null, files);\n }\n };\n if (!fltr || fltr({\n name: fn,\n size: sc,\n originalSize: su,\n compression: c_1\n })) {\n if (!c_1)\n cbl(null, slc(data, b, b + sc));\n else if (c_1 == 8) {\n var infl = data.subarray(b, b + sc);\n if (sc < 320000) {\n try {\n cbl(null, inflateSync(infl, new u8(su)));\n }\n catch (e) {\n cbl(e, null);\n }\n }\n else\n term.push(inflate(infl, { size: su }, cbl));\n }\n else\n cbl(err(14, 'unknown compression type ' + c_1, 1), null);\n }\n else\n cbl(null, null);\n };\n for (var i = 0; i < c; ++i) {\n _loop_3(i);\n }\n }\n else\n cbd(null, {});\n return tAll;\n}\n/**\n * Synchronously decompresses a ZIP archive. Prefer using `unzip` for better\n * performance with more than one file.\n * @param data The raw compressed ZIP file\n * @param opts The ZIP extraction options\n * @returns The decompressed files\n */\nexport function unzipSync(data, opts) {\n var files = {};\n var e = data.length - 22;\n for (; b4(data, e) != 0x6054B50; --e) {\n if (!e || data.length - e > 65558)\n err(13);\n }\n ;\n var c = b2(data, e + 8);\n if (!c)\n return {};\n var o = b4(data, e + 16);\n var z = o == 4294967295 || c == 65535;\n if (z) {\n var ze = b4(data, e - 12);\n z = b4(data, ze) == 0x6064B50;\n if (z) {\n c = b4(data, ze + 32);\n o = b4(data, ze + 48);\n }\n }\n var fltr = opts && opts.filter;\n for (var i = 0; i < c; ++i) {\n var _a = zh(data, o, z), c_2 = _a[0], sc = _a[1], su = _a[2], fn = _a[3], no = _a[4], off = _a[5], b = slzh(data, off);\n o = no;\n if (!fltr || fltr({\n name: fn,\n size: sc,\n originalSize: su,\n compression: c_2\n })) {\n if (!c_2)\n files[fn] = slc(data, b, b + sc);\n else if (c_2 == 8)\n files[fn] = inflateSync(data.subarray(b, b + sc), new u8(su));\n else\n err(14, 'unknown compression type ' + c_2);\n }\n }\n return files;\n}\n", "/* eslint-disable simple-header/header */\n\n/*!\n * crxToZip\n * Copyright (c) 2013 Rob Wu <rob@robwu.nl>\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n */\n\nexport function crxToZip(buf: Buffer) {\n function calcLength(a: number, b: number, c: number, d: number) {\n let length = 0;\n\n length += a << 0;\n length += b << 8;\n length += c << 16;\n length += d << 24 >>> 0;\n return length;\n }\n\n // 50 4b 03 04\n // This is actually a zip file\n if (buf[0] === 80 && buf[1] === 75 && buf[2] === 3 && buf[3] === 4) {\n return buf;\n }\n\n // 43 72 32 34 (Cr24)\n if (buf[0] !== 67 || buf[1] !== 114 || buf[2] !== 50 || buf[3] !== 52) {\n throw new Error(\"Invalid header: Does not start with Cr24\");\n }\n\n // 02 00 00 00\n // or\n // 03 00 00 00\n const isV3 = buf[4] === 3;\n const isV2 = buf[4] === 2;\n\n if ((!isV2 && !isV3) || buf[5] || buf[6] || buf[7]) {\n throw new Error(\"Unexpected crx format version number.\");\n }\n\n if (isV2) {\n const publicKeyLength = calcLength(buf[8], buf[9], buf[10], buf[11]);\n const signatureLength = calcLength(buf[12], buf[13], buf[14], buf[15]);\n\n // 16 = Magic number (4), CRX format version (4), lengths (2x4)\n const zipStartOffset = 16 + publicKeyLength + signatureLength;\n\n return buf.subarray(zipStartOffset, buf.length);\n }\n // v3 format has header size and then header\n const headerSize = calcLength(buf[8], buf[9], buf[10], buf[11]);\n const zipStartOffset = 12 + headerSize;\n\n return buf.subarray(zipStartOffset, buf.length);\n}\n"],
"mappings": ";;;;ukBAAA,IAAAA,EAAAC,EAAA,oBCAA,IAAOC,GAAPC,GAAAC,EAAA,KAAAC,IAAOH,GAAQ,YCAf,IAAOI,EAAPC,GAAAC,EAAA,KAAAC,I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YH,EAAQY,GAAQ,EAAE,EAE1C,QAAWN,IAAa,CAAC,YAAa,cAAe,UAAW,WAAY,YAAa,YAAY,EACjGO,EAAIP,KAAe,CAAC,EACpBO,EAAIP,GAAW,KAAK,IAAK,QAAS,QAAS,WAAY,iBAAiB,EAK5EO,EAAI,gBAAkB,CAAC,EACvBA,EAAI,cAAc,KAAK,gBAAiB,oBAAqB,8BAA8B,EAC3Fb,EAAQY,GAAU,CAACH,EAAgBI,CAAG,CAAC,CAC3C,CACJ,EAEA,UAAQ,eAAe,WAAW,kBAAkB,CAAC,CAAE,gBAAAC,EAAiB,aAAAC,CAAa,EAAGzB,IAAO,CAC3F,GAAIwB,IACIC,IAAiB,aACjBJ,EAASG,CAAe,EAIxBC,IAAiB,cAAc,CAC/B,IAAMH,EAASb,EAAWe,EAAiB,cAAc,EACrDF,IACAE,EAAgBF,GAAU,CAAC,UAAU,EAC7C,CAGJtB,EAAG,CAAE,OAAQ,GAAO,gBAAAwB,CAAgB,CAAC,CACzC,CAAC,EAKD,UAAQ,eAAe,WAAW,kBAAoB,IAAM,CAAE,CAClE,CAAC",
"names": ["init_react", "__esmMin", "git_hash_default", "init_git_hash", "__esmMin", "init_react", "git_remote_default", "init_git_remote", "__esmMin", "init_react", "VENCORD_USER_AGENT", "init_constants", "__esmMin", "init_react", "init_git_hash", "init_git_remote", "git_hash_default", "git_remote_default", "init_IpcEvents", "__esmMin", "init_react", "get", "url", "options", "resolve", "reject", "https", "res", "statusCode", "statusMessage", "headers", "chunks", "chunk", "import_https", "init_simpleGet", "__esmMin", "init_react", "serializeErrors", "func", "e", "VENCORD_FILES", "init_common", "__esmMin", "init_react", "http_exports", "githubGet", "endpoint", "get", "API_BASE", "VENCORD_USER_AGENT", "calculateGitChanges", "fetchUpdates", "res", "git_hash_default", "c", "release", "data", "name", "browser_download_url", "VENCORD_FILES", "s", "PendingUpdates", "applyUpdates", "import_electron", "import_promises", "import_path", "init_http", "__esmMin", "init_react", "init_constants", "init_IpcEvents", "init_git_hash", "init_git_remote", "init_simpleGet", "init_common", "git_remote_default", "serializeErrors", "init_react", "import_electron", "import_path", "init_react", "init_react", "init_react", "init_IpcEvents", "import_electron", "init_react", "native_exports", "init_react", "import_electron", "_", "win", "frame", "settings", "getSettings", "native_exports", "__export", "resolveRedirect", "init_react", "import_https", "validRedirectUrls", "getRedirect", "url", "resolve", "reject", "req", "res", "_", "native_exports", "__export", "readRecording", "init_react", "import_electron", "import_promises", "import_path", "_", "filePath", "filename", "discordBaseDirWithTrailingSlash", "buf", "native_exports", "__export", "sendToOverlay", "init_react", "import_dgram", "xsoSocket", "_", "data", "json", "pluginNatives_default", "native_exports", "PluginIpcMappings", "plugin", "methods", "pluginNatives_default", "entries", "mappings", "methodName", "method", "key", "init_react", "init_IpcEvents", "init_react", "Queue", "maxSize", "func", "import_electron", "import_fs", "import_promises", "import_path", "init_react", "monacoWin_default", "init_react", "splitRegex", "escapedAtRegex", "makeHeader", "fileName", "opts", "stripBOM", "fileContent", "getThemeInfo", "css", "block", "header", "field", "accum", "line", "l", "init_react", "import_electron", "import_path", "DATA_DIR", "SETTINGS_DIR", "THEMES_DIR", "QUICKCSS_PATH", "SETTINGS_FILE", "ALLOWED_PROTOCOLS", "init_react", "import_electron", "makeLinksOpenExternally", "win", "url", "protocol", "SETTINGS_DIR", "THEMES_DIR", "ensureSafePath", "basePath", "path", "normalizedBasePath", "newPath", "normalizedPath", "readCss", "QUICKCSS_PATH", "listThemes", "files", "themeInfo", "fileName", "data", "getThemeData", "stripBOM", "getThemeInfo", "safePath", "readSettings", "SETTINGS_FILE", "getSettings", "_", "url", "protocol", "ALLOWED_PROTOCOLS", "cssWriteQueue", "Queue", "settingsWriteQueue", "css", "s", "win", "makeLinksOpenExternally", "monacoWin_default", "init_react", "import_electron", "init_react", "import_module", "require", "Worker", "workerAdd", "wk", "c", "_", "msg", "transfer", "cb", "done", "w", "e", "m", "__", "___", "____", "NOP", "u8", "u16", "u32", "fleb", "fdeb", "clim", "freb", "eb", "start", "b", "i", "r", "j", "_a", "fl", "revfl", "_b", "fd", "revfd", "rev", "x", "hMap", "cd", "mb", "s", "l", "le", "co", "rvb", "sv", "r_1", "v", "flt", "fdt", "flrm", "hMap", "flt", "fdrm", "hMap", "fdt", "max", "a", "m", "i", "bits", "d", "p", "o", "bits16", "shft", "slc", "v", "s", "e", "n", "u16", "u32", "u8", "ec", "err", "ind", "msg", "nt", "e", "inflt", "dat", "buf", "st", "sl", "u8", "noBuf", "noSt", "cbuf", "l", "bl", "nbuf", "final", "pos", "bt", "lm", "dm", "lbt", "dbt", "tbts", "bits", "type", "flrm", "fdrm", "hLit", "hcLen", "tl", "ldt", "clt", "i", "clim", "clb", "max", "clbmsk", "clm", "hMap", "r", "s", "c", "n", "lt", "dt", "shft", "t", "lms", "dms", "lpos", "bits16", "sym", "add", "b", "fleb", "fl", "d", "dsym", "fd", "fdeb", "end", "slc", "et", "u8", "mrg", "a", "b", "o", "k", "wcln", "fn", "fnStr", "td", "dt", "st", "ks", "i", "v", "st_1", "spInd", "t", "ch", "cbfs", "tl", "wrkr", "fns", "init", "id", "cb", "_a", "td_1", "m", "wk", "bInflt", "u8", "u16", "u32", "fleb", "fdeb", "clim", "fl", "fd", "flrm", "fdrm", "rev", "ec", "hMap", "max", "bits", "bits16", "shft", "slc", "err", "inflt", "inflateSync", "pbf", "gu8", "pbf", "msg", "gu8", "o", "u8", "cbify", "dat", "opts", "fns", "init", "id", "cb", "w", "wrkr", "err", "b2", "d", "b", "b4", "b8", "inflate", "data", "opts", "cb", "err", "cbify", "bInflt", "ev", "pbf", "inflateSync", "gu8", "out", "inflt", "td", "tds", "et", "dutf8", "d", "r", "i", "c", "eb", "slc", "strFromU8", "dat", "latin1", "r", "i", "td", "_a", "dutf8", "out", "ext", "err", "slzh", "d", "b", "b2", "zh", "z", "fnl", "fn", "strFromU8", "es", "bs", "b4", "_a", "z64e", "sc", "su", "off", "b8", "mt", "fn", "unzip", "data", "opts", "cb", "err", "term", "tAll", "i", "files", "cbd", "a", "b", "e", "b4", "lft", "b2", "c", "o", "z", "ze", "fltr", "_loop_3", "_a", "zh", "c_1", "sc", "su", "no", "off", "slzh", "cbl", "d", "slc", "infl", "inflateSync", "u8", "inflate", "import_fs", "import_promises", "import_path", "init_react", "crxToZip", "buf", "calcLength", "b", "d", "length", "isV3", "isV2", "publicKeyLength", "signatureLength", "zipStartOffset", "init_simpleGet", "extensionCacheDir", "DATA_DIR", "extract", "data", "outDir", "resolve", "reject", "unzip", "err", "files", "f", "pathElements", "name", "directories", "dir", "installExt", "id", "extDir", "fsConstants", "url", "buf", "get", "crxToZip", "unsafeUrl", "cb", "url", "theme", "safeUrl", "ensureSafePath", "THEMES_DIR", "getSettings", "installExt", "err", "findHeader", "headers", "headerName", "h", "parsePolicy", "policy", "result", "directive", "directiveKey", "directiveValue", "stringifyPolicy", "values", "patchCsp", "header", "csp", "responseHeaders", "resourceType"]
}