@mudlet/mudlet-web 0.4.5 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist-lib/analytics.d.ts +27 -0
- package/dist-lib/assets/fonts/Vera.woff2 +0 -0
- package/dist-lib/assets/fonts/VeraBI.woff2 +0 -0
- package/dist-lib/assets/fonts/VeraBd.woff2 +0 -0
- package/dist-lib/assets/fonts/VeraIt.woff2 +0 -0
- package/dist-lib/assets/mapParser.worker-DrVZ3wg_.js +9 -0
- package/dist-lib/backupImport-wt8r7JXI.js +233 -0
- package/dist-lib/branding.d.ts +111 -13
- package/dist-lib/db/sqliteClient.d.ts +195 -7
- package/dist-lib/hooks/useAutoReconnect.d.ts +61 -0
- package/dist-lib/hooks/useDocumentFullscreen.d.ts +23 -0
- package/dist-lib/hooks/useKeyboardShortcuts.d.ts +37 -0
- package/dist-lib/hooks/useRecordLastPlayed.d.ts +10 -0
- package/dist-lib/import/applyMudletProfile.d.ts +35 -9
- package/dist-lib/import/backupImport.d.ts +118 -0
- package/dist-lib/import/collectProfileExport.d.ts +33 -2
- package/dist-lib/import/defaultPackages.d.ts +57 -14
- package/dist-lib/import/defaults/CF-loader/CF-loader.mpackage +0 -0
- package/dist-lib/import/defaults/MedBootstrap/MedBootstrap.mpackage +0 -0
- package/dist-lib/import/defaults/deleteOldProfiles/deleteOldProfiles.mpackage +0 -0
- package/dist-lib/import/defaults/echo/echo.mpackage +0 -0
- package/dist-lib/import/defaults/enable-accessibility/enable-accessibility.mpackage +0 -0
- package/dist-lib/import/defaults/generic_mapper/generic_mapper.mpackage +0 -0
- package/dist-lib/import/defaults/gui-drop/gui-drop.mpackage +0 -0
- package/dist-lib/import/defaults/icesus-loader/icesus-loader.mpackage +0 -0
- package/dist-lib/import/defaults/mg-loader/mg-loader.mpackage +0 -0
- package/dist-lib/import/defaults/mudlet-base-ui/mudlet-base-ui.mpackage +0 -0
- package/dist-lib/import/defaults/mudlet-mapper.xml +1215 -389
- package/dist-lib/import/mudletControlChars.d.ts +14 -0
- package/dist-lib/import/mudletHost.d.ts +73 -10
- package/dist-lib/import/mudletLink.d.ts +53 -2
- package/dist-lib/import/mudletProfileExport.d.ts +38 -5
- package/dist-lib/import/mudletProfileImport.d.ts +110 -12
- package/dist-lib/import/mudletVariables.d.ts +4 -3
- package/dist-lib/import/mudletWriteback.d.ts +15 -1
- package/dist-lib/import/mudletXmlImport.d.ts +46 -0
- package/dist-lib/import/packageFonts.d.ts +33 -0
- package/dist-lib/import/packageInstaller.d.ts +111 -7
- package/dist-lib/import/qtProfileData.d.ts +10 -0
- package/dist-lib/import/remotePackageInstall.d.ts +23 -7
- package/dist-lib/import/zipEntries.d.ts +45 -0
- package/dist-lib/index.d.ts +7 -3
- package/dist-lib/index.js +50660 -29735
- package/dist-lib/logging/SessionLogger.d.ts +75 -15
- package/dist-lib/map/MapSelectionOverlay.d.ts +2 -2
- package/dist-lib/map/MapStore.d.ts +432 -59
- package/dist-lib/map/MudletHighlightOverlay.d.ts +2 -2
- package/dist-lib/map/{MudixMapReader.d.ts → MudletMapReader.d.ts} +2 -2
- package/dist-lib/map/areaGraph.d.ts +120 -0
- package/dist-lib/map/environmentKit.d.ts +36 -0
- package/dist-lib/map/labelPixmap.d.ts +90 -0
- package/dist-lib/map/mapImageExport.d.ts +36 -2
- package/dist-lib/map/mapStyle.d.ts +11 -0
- package/dist-lib/map/mapVersion.d.ts +66 -0
- package/dist-lib/map/pathfinding.d.ts +2 -2
- package/dist-lib/mud/CharLoginController.d.ts +230 -0
- package/dist-lib/mud/ItemIdSequence.d.ts +1 -1
- package/dist-lib/mud/MudSession.d.ts +279 -22
- package/dist-lib/mud/PatternEngine.d.ts +153 -14
- package/dist-lib/mud/aliases/AliasEngine.d.ts +55 -9
- package/dist-lib/mud/autoLogin.d.ts +59 -0
- package/dist-lib/mud/commandSplit.d.ts +9 -0
- package/dist-lib/mud/connection/LineAssembler.d.ts +38 -11
- package/dist-lib/mud/connection/MudClient.d.ts +291 -53
- package/dist-lib/mud/connection/SubnegotiationRepair.d.ts +24 -0
- package/dist-lib/mud/connection/TelnetNegotiator.d.ts +208 -68
- package/dist-lib/mud/connection/telnetDebug.d.ts +8 -8
- package/dist-lib/mud/events.d.ts +102 -23
- package/dist-lib/mud/games/bundledGames.d.ts +12 -7
- package/dist-lib/mud/games/gameLinks.d.ts +40 -0
- package/dist-lib/mud/games/icons/3Kingdoms.png +0 -0
- package/dist-lib/mud/games/icons/3Scapes.png +0 -0
- package/dist-lib/mud/games/icons/achaea.png +0 -0
- package/dist-lib/mud/games/icons/aetolia.png +0 -0
- package/dist-lib/mud/games/icons/banner_astaria.png +0 -0
- package/dist-lib/mud/games/icons/banner_darkmists.png +0 -0
- package/dist-lib/mud/games/icons/banner_dreamland.png +0 -0
- package/dist-lib/mud/games/icons/banner_petria.jpg +0 -0
- package/dist-lib/mud/games/icons/banner_ropmud.png +0 -0
- package/dist-lib/mud/games/icons/blackmud.png +0 -0
- package/dist-lib/mud/games/icons/carrionfields.png +0 -0
- package/dist-lib/mud/games/icons/dragonfire_icon.png +0 -0
- package/dist-lib/mud/games/icons/fed2-logo.png +0 -0
- package/dist-lib/mud/games/icons/icesus_480x120.png +0 -0
- package/dist-lib/mud/games/icons/imperian.png +0 -0
- package/dist-lib/mud/games/icons/infinity_480x120.png +0 -0
- package/dist-lib/mud/games/icons/lusternia.png +0 -0
- package/dist-lib/mud/games/icons/morgengrauen_480x120.png +0 -0
- package/dist-lib/mud/games/icons/mudlet-tutorial.png +0 -0
- package/dist-lib/mud/games/icons/phoenixmud_480x120.png +0 -0
- package/dist-lib/mud/games/icons/starmourn.png +0 -0
- package/dist-lib/mud/games/icons/voidmud_icon.png +0 -0
- package/dist-lib/mud/games/icons/wotmudicon.png +0 -0
- package/dist-lib/mud/games/websiteLinks.d.ts +21 -0
- package/dist-lib/mud/keybindings/KeyEngine.d.ts +110 -4
- package/dist-lib/mud/keybindings/browserReservedKeys.d.ts +2 -2
- package/dist-lib/mud/keybindings/keyEventTarget.d.ts +61 -0
- package/dist-lib/mud/keybindings/qtKeys.d.ts +91 -12
- package/dist-lib/mud/protocol/atcp.d.ts +19 -0
- package/dist-lib/mud/protocol/byteString.d.ts +24 -0
- package/dist-lib/mud/protocol/charLoginFlow.d.ts +243 -16
- package/dist-lib/mud/protocol/charset.d.ts +111 -46
- package/dist-lib/mud/protocol/codePages.d.ts +10 -0
- package/dist-lib/mud/protocol/constants.d.ts +17 -10
- package/dist-lib/mud/protocol/echo.d.ts +23 -27
- package/dist-lib/mud/protocol/gmcp.d.ts +36 -6
- package/dist-lib/mud/protocol/index.d.ts +3 -2
- package/dist-lib/mud/protocol/luaLiteral.d.ts +12 -0
- package/dist-lib/mud/protocol/mccp.d.ts +83 -1
- package/dist-lib/mud/protocol/mnes.d.ts +41 -58
- package/dist-lib/mud/protocol/msdp.d.ts +11 -4
- package/dist-lib/mud/protocol/msp.d.ts +3 -2
- package/dist-lib/mud/protocol/mssp.d.ts +9 -4
- package/dist-lib/mud/protocol/multiByte.d.ts +51 -0
- package/dist-lib/mud/protocol/multiByteEncode.d.ts +42 -0
- package/dist-lib/mud/protocol/mxp.d.ts +193 -14
- package/dist-lib/mud/protocol/oauthClientFlow.d.ts +128 -0
- package/dist-lib/mud/protocol/qtCodePages.generated.d.ts +1 -0
- package/dist-lib/mud/protocol/tlsCodes.d.ts +40 -3
- package/dist-lib/mud/replay/ReplayPlayer.d.ts +16 -1
- package/dist-lib/mud/replay/replayFormat.d.ts +29 -2
- package/dist-lib/mud/text/Console.d.ts +255 -49
- package/dist-lib/mud/text/FormatState.d.ts +137 -14
- package/dist-lib/mud/text/ansiEscapes.d.ts +32 -16
- package/dist-lib/mud/text/colorParsers.d.ts +14 -2
- package/dist-lib/mud/text/colorSpaceId.d.ts +2 -0
- package/dist-lib/mud/text/colors.d.ts +17 -10
- package/dist-lib/mud/text/controlCharacterMode.d.ts +1 -1
- package/dist-lib/mud/text/hyperlinkVisibility.d.ts +1 -1
- package/dist-lib/mud/text/lineBreak.d.ts +5 -0
- package/dist-lib/mud/text/serverWrap.d.ts +2 -2
- package/dist-lib/mud/text/textAnalyzer.d.ts +79 -0
- package/dist-lib/mud/text/unicodeRuns.d.ts +11 -0
- package/dist-lib/mud/text/unicodeTables.generated.d.ts +3 -0
- package/dist-lib/mud/text/wcwidth.d.ts +27 -22
- package/dist-lib/mud/timers/TimerEngine.d.ts +163 -11
- package/dist-lib/mud/timers/workerClock.d.ts +67 -0
- package/dist-lib/mud/triggers/TriggerEngine.d.ts +449 -47
- package/dist-lib/mud/triggers/legacyColorPatterns.d.ts +58 -0
- package/dist-lib/mud/triggers/pcre/Pcre2.d.ts +83 -1
- package/dist-lib/oauth-callback.html +94 -0
- package/dist-lib/pcre2Wasm.d.ts +54 -0
- package/dist-lib/pcre2Wasm.js +241 -0
- package/dist-lib/scripting/EngineHost.d.ts +54 -21
- package/dist-lib/scripting/IScriptingRuntime.d.ts +103 -27
- package/dist-lib/scripting/MxpFrameManager.d.ts +10 -1
- package/dist-lib/scripting/ScriptingAPI.d.ts +1039 -213
- package/dist-lib/scripting/ScriptingEngine.d.ts +753 -103
- package/dist-lib/scripting/StopwatchManager.d.ts +97 -36
- package/dist-lib/scripting/http/HttpService.d.ts +9 -1
- package/dist-lib/scripting/http/userUrl.d.ts +41 -0
- package/dist-lib/scripting/lua/LuaRuntime.d.ts +352 -77
- package/dist-lib/scripting/lua/argContracts.d.ts +71 -0
- package/dist-lib/scripting/lua/bindings/automation.d.ts +1 -1
- package/dist-lib/scripting/lua/bindings/commands.d.ts +13 -0
- package/dist-lib/scripting/lua/bindings/context.d.ts +20 -2
- package/dist-lib/scripting/lua/bindings/diagnostics.d.ts +1 -1
- package/dist-lib/scripting/lua/bindings/map.d.ts +1 -1
- package/dist-lib/scripting/lua/bindings/media.d.ts +2 -2
- package/dist-lib/scripting/lua/bindings/output.d.ts +1 -1
- package/dist-lib/scripting/lua/bindings/session.d.ts +2 -2
- package/dist-lib/scripting/lua/bindings/textEdit.d.ts +1 -1
- package/dist-lib/scripting/lua/bindings/userWindows.d.ts +1 -1
- package/dist-lib/scripting/lua/byteArmor.d.ts +36 -0
- package/dist-lib/scripting/lua/imageSize.d.ts +7 -0
- package/dist-lib/scripting/lua/rex.d.ts +4 -2
- package/dist-lib/scripting/lua/sqlRowEncoder.d.ts +6 -1
- package/dist-lib/scripting/lua/utf8CaseMap.d.ts +1 -0
- package/dist-lib/scripting/lua/utf8Patterns.d.ts +21 -1
- package/dist-lib/scripting/lua/wellFormedStrings.d.ts +40 -0
- package/dist-lib/scripting/lua/yajl.d.ts +43 -5
- package/dist-lib/scripting/profilesPresence.d.ts +20 -2
- package/dist-lib/scripting/vfs/ProfileVFS.d.ts +164 -10
- package/dist-lib/scripting/vfs/fsErrors.d.ts +28 -0
- package/dist-lib/scripting/vfs/idbCommit.d.ts +20 -0
- package/dist-lib/storage/appStore.d.ts +24 -9
- package/dist-lib/storage/hooks.d.ts +5 -1
- package/dist-lib/storage/index.d.ts +2 -2
- package/dist-lib/storage/mapStorage.d.ts +2 -0
- package/dist-lib/storage/persistentStorage.d.ts +3 -1
- package/dist-lib/storage/profileStorage.d.ts +15 -0
- package/dist-lib/storage/profileVfsData.d.ts +3 -3
- package/dist-lib/storage/schema.d.ts +521 -44
- package/dist-lib/storage/storageMigration.d.ts +82 -0
- package/dist-lib/storage-g5V1b-c1.js +2039 -0
- package/dist-lib/styles.css +1 -1
- package/dist-lib/ui/AboutModal.d.ts +1 -1
- package/dist-lib/ui/BrandLoginFields.d.ts +1 -1
- package/dist-lib/ui/BrowserSignInModal.d.ts +23 -0
- package/dist-lib/ui/CharLoginModal.d.ts +24 -15
- package/dist-lib/ui/CmdLineMenuRegistry.d.ts +14 -5
- package/dist-lib/ui/CommandBar.d.ts +8 -8
- package/dist-lib/ui/ConnectionFormModal.d.ts +25 -1
- package/dist-lib/ui/ConnectionScreen.d.ts +9 -1
- package/dist-lib/ui/GameLinkPrompt.d.ts +28 -0
- package/dist-lib/ui/HelpModal.d.ts +5 -1
- package/dist-lib/ui/MapSymbolUsageModal.d.ts +32 -0
- package/dist-lib/ui/MouseEventRegistry.d.ts +31 -4
- package/dist-lib/ui/NotepadModal.d.ts +22 -0
- package/dist-lib/ui/ResizableModal.d.ts +16 -1
- package/dist-lib/ui/SettingsModal.d.ts +10 -1
- package/dist-lib/ui/TlsAlertBanner.d.ts +3 -1
- package/dist-lib/ui/Toolbar.d.ts +22 -1
- package/dist-lib/ui/VaultManageButton.d.ts +20 -0
- package/dist-lib/ui/VaultModal.d.ts +5 -0
- package/dist-lib/ui/VaultUnlockPrompt.d.ts +15 -0
- package/dist-lib/ui/buttons/ButtonsBar.d.ts +3 -1
- package/dist-lib/ui/buttons/inactiveButtons.d.ts +25 -0
- package/dist-lib/ui/cmdline/CommandLineManager.d.ts +19 -0
- package/dist-lib/ui/cmdline/plainText.d.ts +16 -0
- package/dist-lib/ui/cmdline/subCommandLine.d.ts +78 -0
- package/dist-lib/ui/cmdline/useCmdLineSelection.d.ts +26 -0
- package/dist-lib/ui/cmdline/useSubCommandLineKeys.d.ts +33 -0
- package/dist-lib/ui/codemirror/lineParagraphMarks.d.ts +19 -0
- package/dist-lib/ui/codemirror/luaHover.d.ts +7 -0
- package/dist-lib/ui/codemirror/options.d.ts +33 -0
- package/dist-lib/ui/codemirror/theme.d.ts +29 -5
- package/dist-lib/ui/commands/addonCommands.d.ts +134 -0
- package/dist-lib/ui/commands/appShortcuts.d.ts +86 -0
- package/dist-lib/ui/commands/hostCommands.d.ts +88 -0
- package/dist-lib/ui/commands/keyMatch.d.ts +20 -0
- package/dist-lib/ui/commands/keySequence.d.ts +57 -0
- package/dist-lib/ui/components/ContextMenu.d.ts +21 -1
- package/dist-lib/ui/components/FontPicker.d.ts +5 -1
- package/dist-lib/ui/components/useModalFocus.d.ts +13 -1
- package/dist-lib/ui/helpTopics.d.ts +15 -0
- package/dist-lib/ui/labels/LabelManager.d.ts +172 -9
- package/dist-lib/ui/labels/LabelOverlay.d.ts +19 -0
- package/dist-lib/ui/labels/backgroundImageSize.d.ts +19 -0
- package/dist-lib/ui/labels/labelModel.d.ts +64 -0
- package/dist-lib/ui/labels/qColor.d.ts +13 -0
- package/dist-lib/ui/labels/qtCss.d.ts +12 -4
- package/dist-lib/ui/landmarks.d.ts +9 -0
- package/dist-lib/ui/launcher/ActionMenu.d.ts +19 -0
- package/dist-lib/ui/launcher/GameDetails.d.ts +21 -0
- package/dist-lib/ui/launcher/GameSection.d.ts +18 -0
- package/dist-lib/ui/launcher/LauncherSearch.d.ts +23 -0
- package/dist-lib/ui/launcher/ProfileArt.d.ts +20 -0
- package/dist-lib/ui/launcher/ProfileSection.d.ts +43 -0
- package/dist-lib/ui/launcher/launcherModel.d.ts +72 -0
- package/dist-lib/ui/layout/overlayLayerOrder.d.ts +2 -2
- package/dist-lib/ui/menu/MenuBar.d.ts +31 -0
- package/dist-lib/ui/menu/SplitButton.d.ts +39 -0
- package/dist-lib/ui/menu/anchoredPopup.d.ts +74 -0
- package/dist-lib/ui/menu/appMenus.d.ts +65 -0
- package/dist-lib/ui/menu/menuModel.d.ts +88 -0
- package/dist-lib/ui/menu/toolbarModel.d.ts +56 -0
- package/dist-lib/ui/notepad.d.ts +76 -0
- package/dist-lib/ui/openSignInPage.d.ts +14 -0
- package/dist-lib/ui/output/OutputContextMenu.d.ts +14 -1
- package/dist-lib/ui/output/OutputRenderer.d.ts +5 -0
- package/dist-lib/ui/output/OutputSearchBar.d.ts +5 -1
- package/dist-lib/ui/output/StickyOutputPanel.d.ts +17 -3
- package/dist-lib/ui/output/TextAnalyzerModal.d.ts +25 -0
- package/dist-lib/ui/output/caretMode.d.ts +3 -2
- package/dist-lib/ui/output/clearSplit.d.ts +11 -0
- package/dist-lib/ui/output/outputCopy.d.ts +41 -2
- package/dist-lib/ui/output/outputRows.d.ts +43 -0
- package/dist-lib/ui/output/selectionGesture.d.ts +35 -0
- package/dist-lib/ui/output/wordSelection.d.ts +33 -0
- package/dist-lib/ui/search/matcher.d.ts +14 -4
- package/dist-lib/ui/settings/SettingsShell.d.ts +91 -0
- package/dist-lib/ui/settings/ShortcutEditor.d.ts +13 -0
- package/dist-lib/ui/sound/SoundManager.d.ts +210 -44
- package/dist-lib/ui/sound/closedCaption.d.ts +4 -1
- package/dist-lib/ui/sound/mediaDirection.d.ts +35 -0
- package/dist-lib/ui/tabCompletion.d.ts +53 -0
- package/dist-lib/ui/textedit/TextEditManager.d.ts +11 -2
- package/dist-lib/ui/useOpenProfiles.d.ts +1 -1
- package/dist-lib/ui/useVaultSaver.d.ts +26 -0
- package/dist-lib/ui/video/VideoManager.d.ts +7 -0
- package/dist-lib/ui/windows/WindowManager.d.ts +452 -37
- package/dist-lib/ui/windows/panels/ScriptEditorPanel.d.ts +14 -0
- package/dist-lib/ui/windows/panels/ScriptSearch.d.ts +6 -1
- package/dist-lib/ui/windows/panels/TextPanel.d.ts +4 -1
- package/dist-lib/ui/windows/panels/VariablesView.d.ts +37 -7
- package/dist-lib/ui/windows/panels/WindowCmdLine.d.ts +4 -2
- package/dist-lib/ui/windows/panels/aliasLoop.d.ts +24 -0
- package/dist-lib/ui/windows/panels/editorClipboard.d.ts +45 -0
- package/dist-lib/ui/windows/panels/editorUndo.d.ts +79 -0
- package/dist-lib/ui/windows/panels/mapAreaChange.d.ts +10 -0
- package/dist-lib/utils/appShellCache.d.ts +25 -0
- package/dist-lib/utils/fontFamilyName.d.ts +13 -0
- package/dist-lib/utils/fontLoader.d.ts +31 -0
- package/dist-lib/utils/formatBytes.d.ts +4 -0
- package/dist-lib/utils/mustBeOneOf.d.ts +9 -0
- package/dist-lib/utils/profileLock.d.ts +1 -1
- package/dist-lib/utils/storedCredentials.d.ts +31 -0
- package/dist-lib/utils/systemTheme.d.ts +24 -0
- package/dist-lib/utils/timeZone.d.ts +10 -0
- package/dist-lib/vault/CredentialVault.d.ts +197 -0
- package/dist-lib/vault/deviceUnlock.d.ts +47 -0
- package/dist-lib/vault/passkeyPrf.d.ts +56 -0
- package/dist-lib/vault/useVault.d.ts +8 -0
- package/dist-lib/vault/vaultAccess.d.ts +80 -0
- package/dist-lib/vault/vaultCrypto.d.ts +56 -0
- package/dist-lib/vault/vaultHelpTopic.d.ts +9 -0
- package/dist-lib/vault/vaultRecord.d.ts +92 -0
- package/dist-lib/vfs-sw.js +220 -11
- package/dist-lib/vite.d.ts +1 -1
- package/dist-lib/vite.js +66 -43
- package/package.json +22 -14
- package/dist-lib/assets/mapParser.worker-t-3rd1zR.js +0 -9
- package/dist-lib/mud/connection/PingTracker.d.ts +0 -41
- package/dist-lib/ui/BundledGameGrid.d.ts +0 -21
- package/dist-lib/ui/ConnectionGrid.d.ts +0 -21
- package/dist-lib/ui/bufferWords.d.ts +0 -38
package/README.md
CHANGED
|
@@ -123,7 +123,7 @@ A deeper tour of the internals lives in [`CLAUDE.md`](./CLAUDE.md); the full Mud
|
|
|
123
123
|
|
|
124
124
|
Mudlet Web is also published as an npm library for shipping a **white-label client for one specific MUD** — your own name, login screen, theme, toolbar, and bundled Lua packages, without forking the repo. See [`docs/BRANDED_BUILDS.md`](docs/BRANDED_BUILDS.md) for the setup guide, or [embervale-web](https://github.com/Delwing/embervale-web) for a live example.
|
|
125
125
|
|
|
126
|
-
> The package is published as [`@mudlet/mudlet-web`](https://www.npmjs.com/package/@mudlet/mudlet-web). It was previously `@delwing/
|
|
126
|
+
> The package is published as [`@mudlet/mudlet-web`](https://www.npmjs.com/package/@mudlet/mudlet-web). It was previously `@delwing/Mudlet Web` (now deprecated) — the app root export was renamed `MudletApp` → `MudletWebApp` with the move.
|
|
127
127
|
|
|
128
128
|
## ⚠️ Limitations & known constraints
|
|
129
129
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The usage-analytics opt-out.
|
|
3
|
+
*
|
|
4
|
+
* The Matomo snippet in `index.html` runs before any module loads, so the
|
|
5
|
+
* opt-out cannot live in the Zustand store the way every other preference does
|
|
6
|
+
* — by the time `mudlet_v1` has been read and hydrated, the tracker has already
|
|
7
|
+
* fired. It gets its own localStorage key instead, written here and read by
|
|
8
|
+
* that inline script with a bare `localStorage.getItem`.
|
|
9
|
+
*
|
|
10
|
+
* Desktop gates its nearest equivalent behind an explicit Always / Ask each
|
|
11
|
+
* time / Never choice (`comboBox_crashReportPolicy`); the web build had no
|
|
12
|
+
* switch at all, which is what this fixes.
|
|
13
|
+
*
|
|
14
|
+
* Client-wide rather than per-profile: a page view is not attributable to a
|
|
15
|
+
* profile, and a player who does not want to be counted does not want to be
|
|
16
|
+
* counted on their other characters either.
|
|
17
|
+
*/
|
|
18
|
+
/** Also spelled literally in `index.html` — keep the two in step. */
|
|
19
|
+
export declare const ANALYTICS_OPT_OUT_KEY = "mudlet_analytics_opt_out";
|
|
20
|
+
/** True when the user has asked not to be counted. Defaults to false (counted),
|
|
21
|
+
* and answers false when storage is unavailable — matching what the inline
|
|
22
|
+
* script does, so the toggle never claims a state the tracker disagrees with. */
|
|
23
|
+
export declare function analyticsOptedOut(): boolean;
|
|
24
|
+
/** Takes effect on the next page load: the tracker for this one has already
|
|
25
|
+
* run, and Matomo offers no way to un-send a page view. The Settings row says
|
|
26
|
+
* so rather than implying otherwise. */
|
|
27
|
+
export declare function setAnalyticsOptedOut(optedOut: boolean): void;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},n={},r={};r.byteLength=d,r.toByteArray=p,r.fromByteArray=g;for(var i=[],a=[],o=typeof Uint8Array<`u`?Uint8Array:Array,s=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,c=0,l=s.length;c<l;++c)i[c]=s[c],a[s.charCodeAt(c)]=c;a[45]=62,a[95]=63;function u(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function d(e){var t=u(e),n=t[0],r=t[1];return(n+r)*3/4-r}function f(e,t,n){return(t+n)*3/4-n}function p(e){var t,n=u(e),r=n[0],i=n[1],s=new o(f(e,r,i)),c=0,l=i>0?r-4:r,d;for(d=0;d<l;d+=4)t=a[e.charCodeAt(d)]<<18|a[e.charCodeAt(d+1)]<<12|a[e.charCodeAt(d+2)]<<6|a[e.charCodeAt(d+3)],s[c++]=t>>16&255,s[c++]=t>>8&255,s[c++]=t&255;return i===2&&(t=a[e.charCodeAt(d)]<<2|a[e.charCodeAt(d+1)]>>4,s[c++]=t&255),i===1&&(t=a[e.charCodeAt(d)]<<10|a[e.charCodeAt(d+1)]<<4|a[e.charCodeAt(d+2)]>>2,s[c++]=t>>8&255,s[c++]=t&255),s}function m(e){return i[e>>18&63]+i[e>>12&63]+i[e>>6&63]+i[e&63]}function h(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(m(r));return i.join(``)}function g(e){for(var t,n=e.length,r=n%3,a=[],o=16383,s=0,c=n-r;s<c;s+=o)a.push(h(e,s,s+o>c?c:s+o));return r===1?(t=e[n-1],a.push(i[t>>2]+i[t<<4&63]+`==`)):r===2&&(t=(e[n-2]<<8)+e[n-1],a.push(i[t>>10]+i[t>>4&63]+i[t<<2&63]+`=`)),a.join(``)}var ee={}
|
|
2
|
+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
3
|
+
/*!
|
|
4
|
+
* The buffer module from node.js, for the browser.
|
|
5
|
+
*
|
|
6
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
7
|
+
* @license MIT
|
|
8
|
+
*/
|
|
9
|
+
;ee.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)},ee.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128},(function(e){let t=r,n=ee,i=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=d,e.SlowBuffer=ie,e.INSPECT_MAX_BYTES=50;let a=2147483647;e.kMaxLength=a;let{Uint8Array:o,ArrayBuffer:s,SharedArrayBuffer:c}=globalThis;d.TYPED_ARRAY_SUPPORT=l(),!d.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function l(){try{let e=new o(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,o.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.buffer}}),Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.byteOffset}});function u(e){if(e>a)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new o(e);return Object.setPrototypeOf(t,d.prototype),t}function d(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return h(e)}return f(e,t,n)}d.poolSize=8192;function f(e,t,n){if(typeof e==`string`)return g(e,t);if(s.isView(e))return v(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(B(e,s)||e&&B(e.buffer,s)||c!==void 0&&(B(e,c)||e&&B(e.buffer,c)))return te(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return d.from(r,t,n);let i=ne(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return d.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}d.from=function(e,t,n){return f(e,t,n)},Object.setPrototypeOf(d.prototype,o.prototype),Object.setPrototypeOf(d,o);function p(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function m(e,t,n){return p(e),e<=0||t===void 0?u(e):typeof n==`string`?u(e).fill(t,n):u(e).fill(t)}d.alloc=function(e,t,n){return m(e,t,n)};function h(e){return p(e),u(e<0?0:re(e)|0)}d.allocUnsafe=function(e){return h(e)},d.allocUnsafeSlow=function(e){return h(e)};function g(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!d.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=ae(e,t)|0,r=u(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function _(e){let t=e.length<0?0:re(e.length)|0,n=u(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function v(e){if(B(e,o)){let t=new o(e);return te(t.buffer,t.byteOffset,t.byteLength)}return _(e)}function te(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new o(e):n===void 0?new o(e,t):new o(e,t,n),Object.setPrototypeOf(r,d.prototype),r}function ne(e){if(d.isBuffer(e)){let t=re(e.length)|0,n=u(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||V(e.length)?u(0):_(e);if(e.type===`Buffer`&&Array.isArray(e.data))return _(e.data)}function re(e){if(e>=a)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+a.toString(16)+` bytes`);return e|0}function ie(e){return+e!=e&&(e=0),d.alloc(+e)}d.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==d.prototype},d.compare=function(e,t){if(B(e,o)&&(e=d.from(e,e.offset,e.byteLength)),B(t,o)&&(t=d.from(t,t.offset,t.byteLength)),!d.isBuffer(e)||!d.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},d.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},d.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return d.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=d.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(B(t,o))i+t.length>r.length?(d.isBuffer(t)||(t=d.from(t)),t.copy(r,i)):o.prototype.set.call(r,t,i);else if(d.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function ae(e,t){if(d.isBuffer(e))return e.length;if(s.isView(e)||B(e,s))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return F(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return R(e).length;default:if(i)return r?-1:F(e).length;t=(``+t).toLowerCase(),i=!0}}d.byteLength=ae;function oe(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return ge(this,t,n);case`utf8`:case`utf-8`:return fe(this,t,n);case`ascii`:return he(this,t,n);case`latin1`:case`binary`:return C(this,t,n);case`base64`:return de(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return w(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}d.prototype._isBuffer=!0;function y(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}d.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)y(this,t,t+1);return this},d.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},d.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},d.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?fe(this,0,e):oe.apply(this,arguments)},d.prototype.toLocaleString=d.prototype.toString,d.prototype.equals=function(e){if(!d.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e||d.compare(this,e)===0},d.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},i&&(d.prototype[i]=d.prototype.inspect),d.prototype.compare=function(e,t,n,r,i){if(B(e,o)&&(e=d.from(e,e.offset,e.byteLength)),!d.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let a=i-r,s=n-t,c=Math.min(a,s),l=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==u[e]){a=l[e],s=u[e];break}return a<s?-1:+(s<a)};function b(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,V(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof t==`string`&&(t=d.from(t,r)),d.isBuffer(t))return t.length===0?-1:x(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof o.prototype.indexOf==`function`?i?o.prototype.indexOf.call(e,t,n):o.prototype.lastIndexOf.call(e,t,n):x(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function x(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}d.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},d.prototype.indexOf=function(e,t,n){return b(this,e,t,n,!0)},d.prototype.lastIndexOf=function(e,t,n){return b(this,e,t,n,!1)};function se(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o;for(o=0;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(V(r))return o;e[n+o]=r}return o}function S(e,t,n,r){return z(F(t,e.length-n),e,n,r)}function ce(e,t,n,r){return z(I(t),e,n,r)}function le(e,t,n,r){return z(R(t),e,n,r)}function ue(e,t,n,r){return z(L(t,e.length-n),e,n,r)}d.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return se(this,e,t,n);case`utf8`:case`utf-8`:return S(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return ce(this,e,t,n);case`base64`:return le(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return ue(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},d.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function de(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function fe(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return me(r)}let pe=4096;function me(e){let t=e.length;if(t<=pe)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=pe));return n}function he(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function C(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function ge(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=Ce[e[r]];return i}function w(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}d.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,d.prototype),r};function T(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}d.prototype.readUintLE=d.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||T(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},d.prototype.readUintBE=d.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||T(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},d.prototype.readUint8=d.prototype.readUInt8=function(e,t){return e>>>=0,t||T(e,1,this.length),this[e]},d.prototype.readUint16LE=d.prototype.readUInt16LE=function(e,t){return e>>>=0,t||T(e,2,this.length),this[e]|this[e+1]<<8},d.prototype.readUint16BE=d.prototype.readUInt16BE=function(e,t){return e>>>=0,t||T(e,2,this.length),this[e]<<8|this[e+1]},d.prototype.readUint32LE=d.prototype.readUInt32LE=function(e,t){return e>>>=0,t||T(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},d.prototype.readUint32BE=d.prototype.readUInt32BE=function(e,t){return e>>>=0,t||T(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},d.prototype.readBigUInt64LE=H(function(e){e>>>=0,N(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&P(e,this.length-8);let r=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),d.prototype.readBigUInt64BE=H(function(e){e>>>=0,N(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&P(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),d.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||T(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},d.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||T(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},d.prototype.readInt8=function(e,t){return e>>>=0,t||T(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},d.prototype.readInt16LE=function(e,t){e>>>=0,t||T(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},d.prototype.readInt16BE=function(e,t){e>>>=0,t||T(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},d.prototype.readInt32LE=function(e,t){return e>>>=0,t||T(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},d.prototype.readInt32BE=function(e,t){return e>>>=0,t||T(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},d.prototype.readBigInt64LE=H(function(e){e>>>=0,N(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&P(e,this.length-8);let r=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),d.prototype.readBigInt64BE=H(function(e){e>>>=0,N(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&P(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)}),d.prototype.readFloatLE=function(e,t){return e>>>=0,t||T(e,4,this.length),n.read(this,e,!0,23,4)},d.prototype.readFloatBE=function(e,t){return e>>>=0,t||T(e,4,this.length),n.read(this,e,!1,23,4)},d.prototype.readDoubleLE=function(e,t){return e>>>=0,t||T(e,8,this.length),n.read(this,e,!0,52,8)},d.prototype.readDoubleBE=function(e,t){return e>>>=0,t||T(e,8,this.length),n.read(this,e,!1,52,8)};function E(e,t,n,r,i,a){if(!d.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}d.prototype.writeUintLE=d.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;E(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},d.prototype.writeUintBE=d.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;E(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},d.prototype.writeUint8=d.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||E(this,e,t,1,255,0),this[t]=e&255,t+1},d.prototype.writeUint16LE=d.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||E(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},d.prototype.writeUint16BE=d.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||E(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},d.prototype.writeUint32LE=d.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||E(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},d.prototype.writeUint32BE=d.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||E(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function D(e,t,n,r,i){M(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function _e(e,t,n,r,i){M(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}d.prototype.writeBigUInt64LE=H(function(e,t=0){return D(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),d.prototype.writeBigUInt64BE=H(function(e,t=0){return _e(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),d.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);E(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},d.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);E(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},d.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||E(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},d.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||E(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},d.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||E(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},d.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||E(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},d.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||E(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},d.prototype.writeBigInt64LE=H(function(e,t=0){return D(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),d.prototype.writeBigInt64BE=H(function(e,t=0){return _e(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function O(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function k(e,t,r,i,a){return t=+t,r>>>=0,a||O(e,t,r,4),n.write(e,t,r,i,23,4),r+4}d.prototype.writeFloatLE=function(e,t,n){return k(this,e,t,!0,n)},d.prototype.writeFloatBE=function(e,t,n){return k(this,e,t,!1,n)};function ve(e,t,r,i,a){return t=+t,r>>>=0,a||O(e,t,r,8),n.write(e,t,r,i,52,8),r+8}d.prototype.writeDoubleLE=function(e,t,n){return ve(this,e,t,!0,n)},d.prototype.writeDoubleBE=function(e,t,n){return ve(this,e,t,!1,n)},d.prototype.copy=function(e,t,n,r){if(!d.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof o.prototype.copyWithin==`function`?this.copyWithin(t,n,r):o.prototype.set.call(e,this.subarray(n,r),t),i},d.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!d.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=d.isBuffer(e)?e:d.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};let A={};function j(e,t,n){A[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}j(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),j(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),j(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=ye(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=ye(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function ye(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function be(e,t,n){N(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&P(t,e.length-(n+1))}function M(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new A.ERR_OUT_OF_RANGE(`value`,i,e)}be(r,i,a)}function N(e,t){if(typeof e!=`number`)throw new A.ERR_INVALID_ARG_TYPE(t,`number`,e)}function P(e,t,n){throw Math.floor(e)===e?t<0?new A.ERR_BUFFER_OUT_OF_BOUNDS:new A.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(N(e,n),new A.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}let xe=/[^+/0-9A-Za-z-_]/g;function Se(e){if(e=e.split(`=`)[0],e=e.trim().replace(xe,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function F(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function I(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function L(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function R(e){return t.toByteArray(Se(e))}function z(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function B(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function V(e){return e!==e}let Ce=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function H(e){return typeof BigInt>`u`?we:e}function we(){throw Error(`BigInt not supported`)}})(n),n.Buffer,n.Blob,n.BlobOptions;const _=n.Buffer;n.File,n.FileOptions,n.INSPECT_MAX_BYTES,n.SlowBuffer,n.TranscodeEncoding,n.atob,n.btoa,n.constants,n.isAscii,n.isUtf8,n.kMaxLength,n.kStringMaxLength,n.resolveObjectURL,n.transcode;function v(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function te(e){if(e instanceof Uint8Array)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(Array.isArray(e))return Uint8Array.from(e);throw TypeError(`Expected Uint8Array, ArrayBuffer, TypedArray, or number[]`)}const ne=new TextEncoder,re=new TextDecoder(`utf-8`);function ie(e){return ne.encode(e)}function ae(e){return re.decode(e)}function oe(e){let t=new Uint8Array(e.length*2),n=new DataView(t.buffer);for(let t=0;t<e.length;t++)n.setUint16(t*2,e.charCodeAt(t),!1);return t}function y(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=[];for(let r=0;r+1<e.byteLength;r+=2)n.push(t.getUint16(r,!1));let r=``,i=8192;for(let e=0;e<n.length;e+=i)r+=String.fromCharCode(...n.slice(e,e+i));return r}function b(e){let t=new Uint8Array(1);return new DataView(t.buffer).setInt8(0,e),t}function x(e){let t=new Uint8Array(2);return new DataView(t.buffer).setUint16(0,e&65535,!1),t}function se(e){let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!1),t}function S(e){let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e>>>0,!1),t}function ce(e){let t=new Uint8Array(8);return new DataView(t.buffer).setBigInt64(0,BigInt.asIntN(64,BigInt(e)),!1),t}function le(e){let t=new Uint8Array(8);return new DataView(t.buffer).setBigUint64(0,BigInt.asUintN(64,BigInt(e)),!1),t}function ue(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!1),t}var de=t({ReadBuffer:()=>fe}),fe=class{buffer;view;read_offset;constructor(e){this.buffer=te(e),this.view=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),this.read_offset=0}remaining(){return this.read_offset>=this.buffer.byteLength?null:this.buffer.subarray(this.read_offset)}readInt8(){let e=this.view.getInt8(this.read_offset);return this.read_offset+=1,e}readInt16BE(){let e=this.view.getInt16(this.read_offset,!1);return this.read_offset+=2,e}readUInt16BE(){let e=this.view.getUint16(this.read_offset,!1);return this.read_offset+=2,e}readInt32BE(){let e=this.view.getInt32(this.read_offset,!1);return this.read_offset+=4,e}readUInt32BE(){let e=this.view.getUint32(this.read_offset,!1);return this.read_offset+=4,e}readInt64BE(){let e=this.view.getBigInt64(this.read_offset,!1);return this.read_offset+=8,e}readUInt64BE(){let e=this.view.getBigUint64(this.read_offset,!1);return this.read_offset+=8,e}readDoubleBE(){let e=this.view.getFloat64(this.read_offset,!1);return this.read_offset+=8,e}slice(e){let t=this.buffer.subarray(this.read_offset,this.read_offset+e);return this.read_offset+=e,t}};function pe(e){return(typeof e==`string`?e:ae(e)).replace(`\0`,``)}function me(e){let t=e.getFullYear(),n=e.getMonth()+1,r=e.getDate(),i=Math.floor((14-n)/12),a=Math.floor(t+4800-i),o=n+12*i-3;return r+Math.floor((153*o+2)/5)+365*a+Math.floor(a/4)-Math.floor(a/100)+Math.floor(a/400)-32045}function he(e){let t=1461,n=4*(e+1401+Math.floor(Math.floor((4*e+274277)/146097)*3/4)+-38)+3,r=5*Math.floor(n%t/4)+2,i=Math.floor(r%153/5)+1,a=(Math.floor(r/153)+2)%12+1,o=Math.floor(n/t)-4716+Math.floor((14-a)/12);return new Date(o,a-1,i)}const C={INVALID:0,BOOL:1,INT:2,UINT:3,INT64:4,UINT64:5,DOUBLE:6,CHAR:7,MAP:8,LIST:9,STRING:10,STRINGLIST:11,BYTEARRAY:12,TIME:15,DATETIME:16,USERTYPE:127,SHORT:133};function ge(e){return e!=null&&typeof e.export==`function`?e.export():e}var w=class{__obj;static qtype;static types=new Map;constructor(e){this.__obj=e}static from(e,t=!1){let n=this;return e instanceof n&&!t||(e=ge(e),e instanceof n)?e:new n(e)}static read(e,t){throw Error(`${this.name}.read() is not implemented`)}};function T(e){return function(t){e!==void 0&&w.types.set(e,t),t.qtype=e}}var E=class extends w{static read(e){}toBuffer(){return new Uint8Array}};T(C.INVALID)(E);var D=class extends w{static read(e){return!!e.readInt8()}toBuffer(){return b(+!!this.__obj)}};T(C.BOOL)(D);var _e=class extends w{static read(e){return e.readInt16BE()}toBuffer(){return x(this.__obj)}};T(C.SHORT)(_e);var O=class extends w{static read(e){return e.readInt32BE()}toBuffer(){return se(this.__obj)}};T(C.INT)(O);var k=class extends w{static read(e){return e.readUInt32BE()}toBuffer(){return S(this.__obj)}};T(C.UINT)(k);var ve=class extends w{static read(e){return e.readInt64BE()}toBuffer(){return ce(this.__obj)}};T(C.INT64)(ve);var A=class extends w{static read(e){return e.readUInt64BE()}toBuffer(){return le(this.__obj)}};T(C.UINT64)(A);var j=class extends w{static read(e){return e.readDoubleBE()}toBuffer(){return ue(this.__obj)}};T(C.DOUBLE)(j);var ye=class extends w{constructor(e){if(super(e),typeof this.__obj!=`string`)throw Error(`${this.__obj} is not a string`);if(this.__obj.length!==1)throw Error(`${this.__obj} length must equal 1`)}static read(e){return y(e.slice(2))}toBuffer(){return oe(this.__obj)}};T(C.CHAR)(ye);var be=class extends k{};T(C.TIME)(be);var M=class extends w{static read(e){let t=k.read(e);return t===0||t===4294967295?null:e.slice(t)}toBuffer(){if(this.__obj===null)return S(4294967295);let e=typeof this.__obj==`string`?ie(this.__obj):te(this.__obj);return v([S(e.length),e])}};T(C.BYTEARRAY)(M);var N=class extends w{static read(e){let t=k.read(e);return t===0||t===4294967295?``:y(e.slice(t))}toBuffer(){if(this.__obj===null)return S(4294967295);let e=oe(typeof this.__obj==`number`?String(this.__obj):this.__obj);return v([S(e.length),e])}};T(C.STRING)(N);var P=class extends w{static read(e){let t=k.read(e),n=Array(t);for(let r=0;r<t;r++)n[r]=L.read(e);return n}static of(e){let t=typeof e==`string`?I.get(e):e,n=this;return class extends n{static from(e){return Array.isArray(e)&&(e=e.map(e=>ge(t.from(e)))),n.from(e)}}}toBuffer(){let e=[S(this.__obj.length)];for(let t of this.__obj)e.push(L.from(t).toBuffer());return v(e)}};T(C.LIST)(P);var xe=class extends w{static read(e){let t=k.read(e),n=Array(t);for(let r=0;r<t;r++)n[r]=N.read(e);return n}toBuffer(){let e=[S(this.__obj.length)];for(let t of this.__obj)e.push(N.from(t).toBuffer());return v(e)}};T(C.STRINGLIST)(xe);var Se=class extends w{static read(e){let t=k.read(e),n=k.read(e);D.read(e);let r=he(t);return r.setMilliseconds(n),r}toBuffer(){let e=this.__obj,t=(e.getTime()-e.getTimezoneOffset()*6e4)%864e5;return v([S(me(e)),S(t),D.from(e.getTimezoneOffset()===0).toBuffer()])}};T(C.DATETIME)(Se);var F=class extends w{static read(e){let t=k.read(e),n={};for(let r=0;r<t;r++){let t=N.read(e);n[t]=L.read(e)}return n}toBuffer(){let e=[];if(this.__obj instanceof Map){e.push(S(this.__obj.size));for(let[t,n]of this.__obj)e.push(N.from(t).toBuffer()),e.push(L.from(n).toBuffer())}else{let t=this.__obj?Object.keys(this.__obj):[];e.push(S(t.length));for(let n of t)e.push(N.from(n).toBuffer()),e.push(L.from(this.__obj[n]).toBuffer())}return v(e)}};T(C.MAP)(F);var I=class e extends w{name;static usertypes=new Map;constructor(e,t){super(t),this.name=e}static from(t){return t instanceof e?t:new this(t)}static createComplexUserType(t,n){let r=[];for(let t of n){let[n]=Object.keys(t),i={key:n,quserclass:void 0};if(typeof t[n]==`string`?(i.quserclassname=t[n],i.quserclass=e.usertypes.get(t[n])):i.quserclass=w.types.get(t[n]),!i.quserclass)throw Error(`Type ${t[n]} does not exists`);r.push(i)}return class extends e{constructor(e){super(t,e)}static read(e){let t={};for(let n of r)t[n.key]=n.quserclass.read(e,n.quserclassname);return t}toBuffer(e=!1){let t=[this._getNameBuffer(e)];for(let e of r)t.push(e.quserclass.from(this.__obj[e.key]).toBuffer(!0));return v(t)}}}static createUserType(t,n){if(Array.isArray(n))return e.createComplexUserType(t,n);let r=w.types.get(n);return class extends e{constructor(e){super(t,e)}static read(e){return r.read(e)}toBuffer(e=!1){return v([this._getNameBuffer(e),r.from(this.__obj).toBuffer(!0)])}}}static register(t,n){e.usertypes.set(t,e.createUserType(t,n))}static get(t){return e.usertypes.get(t)}static read(t,n){n||=pe(M.read(t)??new Uint8Array);let r=e.usertypes.get(n);if(!r)throw Error(`Unregistered usertype ${n}`);return r.read(t)}_getNameBuffer(e){if(!this.name)throw Error(`Abstract QUserType cannot be converted to a buffer`);return e?new Uint8Array:M.from(this.name).toBuffer()}toBuffer(t=!1){return v([this._getNameBuffer(t),e.usertypes.get(this.name).from(this.__obj).toBuffer(!0)])}};T(C.USERTYPE)(I);var L=class e extends w{static coerceNumbersClass=k;static coerceNumbersTo(t){let n=w.types.get(t);if(n===void 0)throw Error(`undefined type ${t}`);e.coerceNumbersClass=n}static read(e){let t=k.read(e);return D.read(e),w.types.get(t).read(e)}toBuffer(){let t=this.__obj===void 0||this.__obj===null,n=typeof this.__obj,r;if(this.__obj===void 0)r=E;else if(this.__obj instanceof I)r=I;else if(this.__obj instanceof e)throw Error(`Can't nest QVariant`);else r=this.__obj instanceof w?this.__obj.constructor:n===`string`?N:n===`bigint`?ve:n===`number`?e.coerceNumbersClass:n===`boolean`?D:this.__obj instanceof Date?Se:Array.isArray(this.__obj)?P:F;let i=[S(r.qtype),D.from(t).toBuffer()];return t||i.push(r.from(this.__obj).toBuffer()),v(i)}},R=class extends w{static read(e){return e.readInt8()}toBuffer(){return b(this.__obj)}},z=class extends w{static read(e){return e.readUInt16BE()}toBuffer(){return x(this.__obj)}},B=class extends w{static read(e){return{spec:R.read(e),alpha:z.read(e)>>8,r:z.read(e)>>8,g:z.read(e)>>8,b:z.read(e)>>8,pad:z.read(e)>>8}}toBuffer(){let e=this.__obj,t=[];return t.push(R.from(e.spec).toBuffer(!1)),t.push(z.from(e.alpha*257).toBuffer(!1)),t.push(z.from(e.r*257).toBuffer(!1)),t.push(z.from(e.g*257).toBuffer(!1)),t.push(z.from(e.b*257).toBuffer(!1)),t.push(z.from((e.pad??0)*257).toBuffer(!1)),v(t)}},V=class extends N{toBuffer(){return this.__obj===``?k.from(4294967295).toBuffer():super.toBuffer()}},Ce=class extends w{static read(e){let t=V.read(e),n=V.read(e),r=j.read(e),i=O.read(e),a=R.read(e),o=z.read(e);e.readInt8();let s=e.readInt8()>>>0,c=e.readInt8()>>>0,l=e.readUInt16BE(),u=e.readInt8()>>>0;return{family:t,style:n,pointSize:r,pixelSize:i,styleHint:a,styleStrategy:o,weight:s,fontBits:c,stretch:l,extendedFontBits:u,letterSpacing:O.read(e),wordSpacing:O.read(e),hintingPreference:e.readInt8()>>>0,capital:e.readInt8()>>>0,styleSetting:(c&1)!=0,underline:(c&2)!=0,overline:(c&64)!=0,strikeOut:(c&4)!=0,fixedPitch:(c&8)!=0,kerning:(c&16)!=0,styleOblique:(c&128)!=0,ignorePitch:(u&1)!=0,letterSpacingIsAbsolute:(u&2)!=0}}toBuffer(){let e=this.__obj;return v([V.from(e.family).toBuffer(),V.from(e.style).toBuffer(),j.from(e.pointSize).toBuffer(),O.from(e.pixelSize).toBuffer(),R.from(e.styleHint).toBuffer(),z.from(e.styleStrategy).toBuffer(),new Uint8Array(1),b(e.weight),b(e.fontBits),x(e.stretch),b(e.extendedFontBits),O.from(e.letterSpacing).toBuffer(),O.from(e.wordSpacing).toBuffer(),b(e.hintingPreference),b(e.capital)])}},H=class extends w{static read(e){return[j.read(e),j.read(e)]}toBuffer(){let[e,t]=this.__obj;return v([j.from(e).toBuffer(),j.from(t).toBuffer()])}},we=class extends w{static read(e){return[Math.fround(j.read(e)),Math.fround(j.read(e)),Math.fround(j.read(e))]}toBuffer(){let[e,t,n]=this.__obj;return v([j.from(e).toBuffer(),j.from(t).toBuffer(),j.from(n).toBuffer()])}},Te=class extends w{static read(e){k.read(e);let t=e.read_offset;if(e.readUInt32BE()!==2303741511)return e.read_offset-=4,``;for(;e.readUInt32BE()!==1229278788;)e.read_offset-=3;let n=e.read_offset;e.read_offset=t;let r=n-t;return e.slice(r+4)}toBuffer(){let e=this.__obj;return v([k.from(1).toBuffer(),e===``?new Uint8Array:e])}};const U={...C,POINT:25,FONT:64,PIXMAP:65,COLOR:67,VECTOR:84};let Ee=!1;function De(){Ee||(Ee=!0,T(U.POINT)(H),T(U.FONT)(Ce),T(U.PIXMAP)(Te),T(U.COLOR)(B),T(U.VECTOR)(we))}function Oe(e){return class extends w{static read(t){let n=O.read(t),r={};for(let i=0;i<n;i++){let n=O.read(t),i=O.read(t);r[i]=[];for(let a=0;a<n;a++)r[i].push(I.get(e).read(t))}return r}toBuffer(){let t=this.__obj,n=[];n.push(O.from(Object.keys(t).length).toBuffer());for(let r of Object.keys(t)){let i=parseInt(r);n.push(O.from(t[i].length).toBuffer()),n.push(O.from(i).toBuffer());for(let r of t[i])n.push(I.get(e).from(r).toBuffer(!0))}return v(n)}}}function ke(e){return class extends w{static read(t){let n={},r=O.read(t);for(let i=0;i<r;i++){let r=O.read(t);n[r]=I.get(e).read(t)}return n}toBuffer(){let t=this.__obj,n=[];n.push(O.from(Object.keys(t).length).toBuffer());for(let[r,i]of Object.entries(t).sort((e,t)=>parseInt(e[0])-parseInt(t[0])))n.push(O.from(parseInt(r)).toBuffer()),n.push(I.get(e).from(i).toBuffer(!0));return v(n)}}}function Ae(e){return class extends w{static read(t){let n={};for(;t.buffer.length>t.read_offset;){let r=O.read(t);n[r]=I.get(e).read(t)}return n}toBuffer(){let t=this.__obj,n=[];for(let[r,i]of Object.entries(t).reverse())n.push(O.from(parseInt(r)).toBuffer()),n.push(I.get(e).from(i).toBuffer(!0));return v(n)}}}let je=1e3;const W={},G={},Me={},Ne={};function K(e){return typeof e==`number`||!e.qtype?w.types.get(e):e}function Pe(e,t){return parseInt(e[0])===-1?-1:parseInt(t[0])===-1?1:parseInt(e[0])-parseInt(t[0])}function Fe(e,t){return class extends w{static read(n){let r={},i=k.read(n);for(let a=0;a<i;a++){let i=e.read(n),a=t.read(n);r[i]===void 0&&(r[i]=[]),r[i].push(a)}return r}toBuffer(){let n=[],r=this.__obj;if(r instanceof Map){n.push(k.from(r.size).toBuffer());for(let[i,a]of r)n.push(e.from(i).toBuffer()),n.push(t.from(a).toBuffer())}else{let i=0;for(let[a,o]of Object.entries(r).reverse())for(let r of o)i++,n.push(e.from(a).toBuffer()),n.push(t.from(r).toBuffer());n.unshift(k.from(i).toBuffer())}return v(n)}}}function Ie(e,t){return class extends w{static read(n){let r={},i=k.read(n);for(let a=0;a<i;a++){let i=e.read(n);r[i]=t.read(n)}return r}toBuffer(){let n=[],r=this.__obj;if(r instanceof Map){n.push(k.from(r.size).toBuffer());for(let[i,a]of r)n.push(e.from(i).toBuffer()),n.push(t.from(a).toBuffer())}else{let i=Object.entries(r);n.push(k.from(i.length).toBuffer());for(let[r,a]of i.sort(Pe))n.push(e.from(r).toBuffer()),n.push(t.from(a).toBuffer())}return v(n)}}}function Le(e){return class extends w{static read(t){let n=[],r=k.read(t);for(let i=0;i<r;i++)n.push(e.read(t));return n}toBuffer(){let t=[],n=this.__obj;t.push(k.from(n.length).toBuffer());for(let r of n)t.push(e.from(r).toBuffer());return v(t)}}}function Re(e,t){return class extends w{static read(n){return[e.read(n),t.read(n)]}toBuffer(){let n=this.__obj;return v([e.from(n[0]).toBuffer(),t.from(n[1]).toBuffer()])}}}function ze(e,t){let n=K(e),r=K(t),i=String(n),a=String(r);if(G[i]||(G[i]={}),!G[i][a]){let e=Fe(n,r),t=je++;T(t)(e),G[i][a]=t}return G[i][a]}function q(e,t,n){let r=K(e),i=K(t),a=String(r),o=String(i);if(W[a]||(W[a]={}),!W[a][o]){let e=Ie(r,i),t=je++;T(t)(e),W[a][o]=t}return W[a][o]}function J(e){let t=String(e);if(!Me[t]){let n=Le(e),r=je++;T(r)(n),Me[t]=r}return Me[t]}function Be(e,t){let n=`${e.name}#${t.name}`;if(!Ne[n]){let r=Re(e,t),i=je++;T(i)(r),Ne[n]=i}return Ne[n]}const Ve=new Map;function He(e){Ve.set(e.version,e)}function Ue(e){return Ve.get(e)}function We(){return[...Ve.keys()].sort((e,t)=>e-t)}const Ge=`system.fallback_symbol`,Ke=`system.fallback_mapSymbolFont`,qe=`system.fallback_mapSymbolFontFudgeFactor`,Je=`system.fallback_onlyUseMapSymbolFont`;function Ye(e,t){let n=e[t];return delete e[t],n}const Y={italic:1,underline:2,strikeOut:4,fixedPitch:8,oblique:128};function Xe(e,t){let n=e.split(`,`).slice(0,10);if(n.length<10)return;let[r,i,a,o,s,c,l,u,d]=n,f=Number(c)!==0,p=Number(c)===2,m=e=>Number(e)!==0,h=t.fontBits,g=(e,t)=>{h=t?h|e:h&~e};return g(Y.italic,f),g(Y.oblique,p),g(Y.underline,m(l)),g(Y.strikeOut,m(u)),g(Y.fixedPitch,m(d)),{...t,family:r,pointSize:Number(i),pixelSize:Number(a),styleHint:Number(o),weight:Number(s),fontBits:h,styleSetting:f,styleOblique:p,underline:m(l),strikeOut:m(u),fixedPitch:m(d)}}function Ze(e,t){let n=e.userData;if(!n)return;if(t>=19){delete n[Ge];return}let r=Ye(n,Ge);r&&(e.symbol=r)}function Qe(e,t){let n=e.mUserData;if(!n)return;if(t>=19){delete n[Ke],delete n[qe],delete n[Je];return}let r=Ye(n,Ke),i=Ye(n,qe),a=Ye(n,Je);if(r){let t=Xe(r,e.mapSymbolFont);t&&(e.mapSymbolFont=t)}i&&(e.mapFontFudgeFactor=Number(i)),a&&(e.useOnlyMapFont=a.toLowerCase()===`true`)}De();const $e={"dot line":3,"dash line":2,"dash dot line":4,"dash dot dot line":5},et={N:`n`,E:`e`,S:`s`,W:`w`,UP:`up`,DOWN:`down`,NE:`ne`,SE:`se`,SW:`sw`,NW:`nw`,IN:`in`,OUT:`out`};function tt(e){let t={};for(let n of Object.keys(e))t[et[n]??n]=e[n];return t}const nt={family:`Bitstream Vera Sans Mono`,style:``,pointSize:10,pixelSize:-1,styleHint:0,styleStrategy:0,weight:50,fontBits:0,stretch:0,extendedFontBits:0,letterSpacing:0,wordSpacing:0,hintingPreference:0,capital:0,styleSetting:!1,underline:!1,overline:!1,strikeOut:!1,fixedPitch:!0,kerning:!1,styleOblique:!1,ignorePitch:!1,letterSpacingIsAbsolute:!1};var rt=class extends w{static read(e){let t=e.readInt8();return t>32?String.fromCodePoint(t):``}toBuffer(){throw Error(`writing legacy Mudlet map versions is not supported`)}},it=class extends w{static read(e){let t=k.read(e),n=[];for(let r=0;r<t;r++)n.push(O.read(e));return n.length>=3?{spec:1,alpha:255,r:n[0],g:n[1],b:n[2],pad:0}:{spec:1,alpha:255,r:255,g:0,b:0,pad:0}}toBuffer(){throw Error(`writing legacy Mudlet map versions is not supported`)}},at=class extends w{static read(e){return $e[V.read(e)]??1}toBuffer(){throw Error(`writing legacy Mudlet map versions is not supported`)}},ot=class extends w{static read(e){return O.read(e),{}}toBuffer(){throw Error(`writing legacy Mudlet map versions is not supported`)}};const X={SYMBOL_BYTE:300,COLOR_INTLIST:301,STYLE_STRING:302,ROOM_ID:303};let st=!1;function ct(){st||(st=!0,T(X.SYMBOL_BYTE)(rt),T(X.COLOR_INTLIST)(it),T(X.STYLE_STRING)(at),T(X.ROOM_ID)(ot))}const lt={16:{hasMapUserData:!1,hasMapFont:!1,modernRoomIdHash:!1,modernArea:!1,stringSymbol:!1},17:{hasMapUserData:!0,hasMapFont:!1,modernRoomIdHash:!1,modernArea:!0,stringSymbol:!1},18:{hasMapUserData:!0,hasMapFont:!1,modernRoomIdHash:!0,modernArea:!0,stringSymbol:!1},19:{hasMapUserData:!0,hasMapFont:!0,modernRoomIdHash:!0,modernArea:!0,stringSymbol:!0}};function ut(e,t,n){if(t.hasMapUserData||(e.mUserData={}),t.hasMapFont||(e.mapSymbolFont={...nt},e.mapFontFudgeFactor=1,e.useOnlyMapFont=!1),Qe(e,n),!t.modernArea)for(let t of Object.values(e.areas)){let e=t;delete e.legacyForZUnused1,delete e.legacyForZUnused2,e.userData={}}}function dt(e,t,n){Ze(e,n),e.customLines=tt(e.customLines),e.customLinesArrow=tt(e.customLinesArrow),e.customLinesColor=tt(e.customLinesColor),e.customLinesStyle=tt(e.customLinesStyle)}function ft(e){let t=lt[e];if(!t)throw Error(`No legacy config for Mudlet map version ${e}`);ct();let n={MAP:`MudletMap@${e}`,HEADER:`MudletMapHeader@${e}`,AREA:`MudletArea@${e}`,ROOM:`MudletRoom@${e}`,LABEL:`MudletLabel@${e}`},r={LABELS:e*10,ROOMS:e*10+1,AREAS:e*10+2};T(r.LABELS)(Oe(n.LABEL)),T(r.ROOMS)(Ae(n.ROOM)),T(r.AREAS)(ke(n.AREA));let i=[{rooms:J(k)},{zLevels:J(O)},{mAreaExits:ze(O,Be(O,O))},{gridMode:U.BOOL},{max_x:U.INT},{max_y:U.INT},{max_z:U.INT},{min_x:U.INT},{min_y:U.INT},{min_z:U.INT},{span:U.VECTOR}];t.modernArea?i.push({xmaxForZ:q(O,O)},{ymaxForZ:q(O,O)},{xminForZ:q(O,O)},{yminForZ:q(O,O)}):i.push({xmaxForZ:q(O,O)},{ymaxForZ:q(O,O)},{legacyForZUnused1:q(O,O)},{xminForZ:q(O,O)},{yminForZ:q(O,O)},{legacyForZUnused2:q(O,O)}),i.push({pos:U.VECTOR},{isZone:U.BOOL},{zoneAreaRef:U.INT}),t.modernArea&&i.push({userData:q(V,V)}),I.register(n.AREA,i),I.register(n.ROOM,[{area:U.INT},{x:U.INT},{y:U.INT},{z:U.INT},{north:U.INT},{northeast:U.INT},{east:U.INT},{southeast:U.INT},{south:U.INT},{southwest:U.INT},{west:U.INT},{northwest:U.INT},{up:U.INT},{down:U.INT},{in:U.INT},{out:U.INT},{environment:U.INT},{weight:U.INT},{name:U.STRING},{isLocked:U.BOOL},{rawSpecialExits:ze(k,V)},{symbol:t.stringSymbol?U.STRING:X.SYMBOL_BYTE},{userData:q(V,V)},{customLines:q(V,J(H))},{customLinesArrow:q(V,D)},{customLinesColor:q(V,it)},{customLinesStyle:q(V,at)},{exitLocks:J(O)},{stubs:J(O)},{exitWeights:q(V,O)},{doors:q(V,O)}]),I.register(n.LABEL,[{id:U.INT},{pos:U.VECTOR},{dummy1:U.DOUBLE},{dummy2:U.DOUBLE},{size:Be(j,j)},{text:U.STRING},{fgColor:U.COLOR},{bgColor:U.COLOR},{pixMap:U.PIXMAP},{noScaling:U.BOOL},{showOnTop:U.BOOL}]);let a=[{version:U.INT},{envColors:q(O,O)},{areaNames:q(O,V,!0)},{mCustomEnvColors:q(O,B)},{mpRoomDbHashToRoomId:q(V,k)}];t.hasMapUserData&&a.push({mUserData:q(V,V)}),t.hasMapFont&&a.push({mapSymbolFont:U.FONT},{mapFontFudgeFactor:U.DOUBLE},{useOnlyMapFont:U.BOOL}),a.push({areas:r.AREAS}),a.push(t.modernRoomIdHash?{mRoomIdHash:q(V,O)}:{mRoomIdHash:X.ROOM_ID}),a.push({labels:r.LABELS}),I.register(n.HEADER,a),I.register(n.MAP,[...a,{rooms:r.ROOMS}]),He({version:e,read:r=>{let i=I.read(r,n.MAP);ut(i,t,e);for(let n of Object.values(i.rooms))dt(n,t,e);return i},write:()=>{throw Error(`Writing Mudlet map version ${e} is not supported (read-only). Mudlet only saves the latest format.`)},readHeader:r=>{let i=I.read(r,n.HEADER);return ut(i,t,e),i},readRoom:r=>{let i=O.read(r),a=I.get(n.ROOM).read(r);return dt(a,t,e),{id:i,room:a}}})}ft(16),ft(17),ft(18),ft(19),De();const Z={MAP:`MudletMap@20`,HEADER:`MudletMapHeader@20`,AREA:`MudletArea@20`,ROOM:`MudletRoom@20`,LABEL:`MudletLabel@20`},Q={LABELS:200,ROOMS:201,AREAS:202};T(Q.LABELS)(Oe(Z.LABEL)),T(Q.ROOMS)(Ae(Z.ROOM)),T(Q.AREAS)(ke(Z.AREA)),I.register(Z.AREA,[{rooms:J(k)},{zLevels:J(O)},{mAreaExits:ze(O,Be(O,O))},{gridMode:U.BOOL},{max_x:U.INT},{max_y:U.INT},{max_z:U.INT},{min_x:U.INT},{min_y:U.INT},{min_z:U.INT},{span:U.VECTOR},{xmaxForZ:q(O,O)},{ymaxForZ:q(O,O)},{xminForZ:q(O,O)},{yminForZ:q(O,O)},{pos:U.VECTOR},{isZone:U.BOOL},{zoneAreaRef:U.INT},{userData:q(V,V)}]),I.register(Z.ROOM,[{area:U.INT},{x:U.INT},{y:U.INT},{z:U.INT},{north:U.INT},{northeast:U.INT},{east:U.INT},{southeast:U.INT},{south:U.INT},{southwest:U.INT},{west:U.INT},{northwest:U.INT},{up:U.INT},{down:U.INT},{in:U.INT},{out:U.INT},{environment:U.INT},{weight:U.INT},{name:U.STRING},{isLocked:U.BOOL},{rawSpecialExits:ze(k,V)},{symbol:U.STRING},{userData:q(V,V)},{customLines:q(V,J(H))},{customLinesArrow:q(V,D)},{customLinesColor:q(V,B)},{customLinesStyle:q(V,k)},{exitLocks:J(O)},{stubs:J(O)},{exitWeights:q(V,O)},{doors:q(V,O)}]),I.register(Z.LABEL,[{id:U.INT},{pos:U.VECTOR},{dummy1:U.DOUBLE},{dummy2:U.DOUBLE},{size:Be(j,j)},{text:U.STRING},{fgColor:U.COLOR},{bgColor:U.COLOR},{pixMap:U.PIXMAP},{noScaling:U.BOOL},{showOnTop:U.BOOL}]);const pt=[{version:U.INT},{envColors:q(O,O)},{areaNames:q(O,V,!0)},{mCustomEnvColors:q(O,B)},{mpRoomDbHashToRoomId:q(V,k)},{mUserData:q(V,V)},{mapSymbolFont:U.FONT},{mapFontFudgeFactor:U.DOUBLE},{useOnlyMapFont:U.BOOL},{areas:Q.AREAS},{mRoomIdHash:q(V,O)},{labels:Q.LABELS}];I.register(Z.HEADER,pt),I.register(Z.MAP,[...pt,{rooms:Q.ROOMS}]),He({version:20,read:e=>{let t=I.read(e,Z.MAP);Qe(t,20);for(let e of Object.values(t.rooms))Ze(e,20);return t},write:e=>I.get(Z.MAP).from(e).toBuffer(!0),readHeader:e=>{let t=I.read(e,Z.HEADER);return Qe(t,20),t},readRoom:e=>{let t=O.read(e),n=I.get(Z.ROOM).read(e);return Ze(n,20),{id:t,room:n}}});const{ReadBuffer:mt}=de,ht=[`north`,`northeast`,`east`,`southeast`,`south`,`southwest`,`west`,`northwest`,`up`,`down`,`in`,`out`],gt={north:1,northeast:2,northwest:3,east:4,west:5,south:6,southeast:7,southwest:8,up:9,down:10,in:11,out:12};function _t(e){for(let t in e.areas)Object.hasOwn(e.areas,t)&&(e.areas[t].mAreaExits={});for(let t in e.rooms){if(!Object.hasOwn(e.rooms,t))continue;let n=Number(t),r=e.rooms[n],i=e.areas[r.area];if(!i)continue;let a=[];for(let t of ht){let n=r[t];if(!n||n<1)continue;let i=e.rooms[n];!i||i.area===r.area||a.push([n,gt[t]])}let o=r.mSpecialExits??{},s=Object.keys(o).sort();for(let t of s){let n=o[t];if(!n||n<1)continue;let i=e.rooms[n];!i||i.area===r.area||a.push([n,13])}a.length>0&&(i.mAreaExits[n]=a)}}function vt(e){for(let t in e.areas){if(!Object.hasOwn(e.areas,t))continue;let n=e.areas[t];n.xminForZ={},n.xmaxForZ={},n.yminForZ={},n.ymaxForZ={},n.zLevels=[];let r=!0;for(let t of n.rooms){let i=e.rooms[t];if(!i)continue;let a=i.x,o=-i.y,s=i.z;if(r){n.min_x=a,n.max_x=a,n.min_y=o,n.max_y=o,n.min_z=s,n.max_z=s,n.zLevels.push(s),n.xminForZ[s]=a,n.xmaxForZ[s]=a,n.yminForZ[s]=o,n.ymaxForZ[s]=o,r=!1;continue}n.zLevels.includes(s)||n.zLevels.push(s),(n.xminForZ[s]===void 0||a<n.xminForZ[s])&&(n.xminForZ[s]=a),a<n.min_x&&(n.min_x=a),(n.xmaxForZ[s]===void 0||a>n.xmaxForZ[s])&&(n.xmaxForZ[s]=a),a>n.max_x&&(n.max_x=a),(n.yminForZ[s]===void 0||o<n.yminForZ[s])&&(n.yminForZ[s]=o),o<n.min_y&&(n.min_y=o),o>n.max_y&&(n.max_y=o),(n.ymaxForZ[s]===void 0||o>n.ymaxForZ[s])&&(n.ymaxForZ[s]=o),s<n.min_z&&(n.min_z=s),s>n.max_z&&(n.max_z=s)}n.zLevels.length>1&&n.zLevels.sort((e,t)=>e-t)}}function yt(e){for(let t in e.mpRoomDbHashToRoomId){if(!Object.hasOwn(e.mpRoomDbHashToRoomId,t))continue;let n=e.mpRoomDbHashToRoomId[t],r=e.rooms[n];r&&(r.hash=t)}}function bt(e){e.mpRoomDbHashToRoomId={};for(let t in e.rooms){if(!Object.hasOwn(e.rooms,t))continue;let n=e.rooms[t].hash;if(typeof n!=`string`||n.length===0)continue;let r=Number(t);if(Object.hasOwn(e.mpRoomDbHashToRoomId,n)){let t=e.mpRoomDbHashToRoomId[n];console.warn(`[mudlet-map-binary-reader] duplicate room hash "${n}" on rooms ${t} and ${r}; last wins`)}e.mpRoomDbHashToRoomId[n]=r}}function xt(e){e.mSpecialExits={},e.mSpecialExitLocks=[];for(let t in e.rawSpecialExits)if(Object.hasOwn(e.rawSpecialExits,t))for(let n of e.rawSpecialExits[t])n.startsWith(`0`)?e.mSpecialExits[n.substring(1)]=parseInt(t):n.startsWith(`1`)?(e.mSpecialExits[n.substring(1)]=parseInt(t),e.mSpecialExitLocks.push(parseInt(t))):e.mSpecialExits[n]=parseInt(t)}function St(e){for(let t in e.rooms)Object.hasOwn(e.rooms,t)&&xt(e.rooms[t])}function Ct(e){for(let t in e.rooms){let n=e.rooms[t],r={};for(let e in n.mSpecialExits){if(!Object.hasOwn(n.mSpecialExits,e))continue;let t=n.mSpecialExits[e];r[t]===void 0&&(r[t]=[]);let i=n.mSpecialExitLocks.indexOf(t)>-1;r[t].push((i?`1`:`0`)+e)}n.rawSpecialExits=r}}function wt(e){return O.read(new mt(e))}function Tt(e){let t=wt(e),n=Ue(t);if(!n)throw Error(`Unsupported Mudlet map version ${t}. Supported version(s): ${We().join(`, `)}.`);let r=n.read(new mt(e));return St(r),yt(r),r}function Et(e,t,n){let r=wt(e),i=Ue(r);if(!i)throw Error(`Unsupported Mudlet map version ${r}. Supported version(s): ${We().join(`, `)}.`);let a=new mt(e),o=i.readHeader(a);for(n?.(o);a.read_offset<a.buffer.length;){let{id:e,room:n}=i.readRoom(a);xt(n),t(e,n)}return o}function Dt(e){let t=Ue(e.version);if(!t)throw Error(`Cannot write Mudlet map: unsupported version ${e.version}. Supported version(s): ${We().join(`, `)}.`);return Ct(e),_t(e),vt(e),bt(e),t.write(e)}const Ot=Tt,kt=Dt,At=Et;function jt(e){let t={};for(let[n,r]of Object.entries(e.labels??{}))t[Number(n)]=r.map(e=>{if(typeof e.pixMap!=`string`)return e;let t=_.from(e.pixMap,`base64`);return{...e,pixMap:Nt(t)?t:``}});return{...e,labels:t}}const Mt=[137,80,78,71,13,10,26,10],Nt=e=>e.length>Mt.length&&Mt.every((t,n)=>e[n]===t);(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let e=0;e<8;e++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function Pt(e){for(let t of Object.values(e??{}))for(let e of t){let t=e.pixMap;if(t&&typeof t!=`string`)try{e.pixMap=_.from(t).toString(`base64`)}catch{e.pixMap=``}}}const $=self;self.addEventListener(`message`,e=>{let t=e.data;try{if(t.kind===`serialize`){let e=kt(jt(t.map)),n=new ArrayBuffer(e.byteLength);new Uint8Array(n).set(e);let r={id:t.id,ok:!0,kind:`serialize`,bytes:n};$.postMessage(r,[n]);return}if(t.kind===`parseStream`){let e=[];At(_.from(t.buf),(n,r)=>{e.push([n,r]),e.length>=2e3&&($.postMessage({id:t.id,ok:!0,kind:`rooms`,rooms:e}),e=[])},e=>{Pt(e.labels);let n=0;for(let t of Object.values(e.areas??{}))n+=t.rooms?.length??0;$.postMessage({id:t.id,ok:!0,kind:`header`,header:e,totalRooms:n})}),e.length>0&&$.postMessage({id:t.id,ok:!0,kind:`rooms`,rooms:e}),$.postMessage({id:t.id,ok:!0,kind:`done`});return}let e=Ot(_.from(t.buf));Pt(e.labels);let n={id:t.id,ok:!0,kind:`parse`,map:e};$.postMessage(n)}catch(e){let n={id:t.id,ok:!1,error:e instanceof Error?e.message:String(e)};$.postMessage(n)}});
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { A as e, G as t, H as n, O as r, U as i, u as a, w as o } from "./storage-g5V1b-c1.js";
|
|
2
|
+
var s = ["mudix_v1", "mudlet_v1"], c = ["mudix_maps", "mudlet_maps"], l = ["mudix_logs", "mudlet_logs"], u = ["mudix_vfs_", "mudlet_vfs_"], d = ["mudix_folder_handles", "mudlet_folder_handles"];
|
|
3
|
+
function f(e) {
|
|
4
|
+
for (let t of s) {
|
|
5
|
+
let n = e.localStorage[t];
|
|
6
|
+
if (n) return n;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
function p(e, t, n) {
|
|
10
|
+
for (let r of t) {
|
|
11
|
+
let t = e.indexedDB[r]?.stores?.[n];
|
|
12
|
+
if (t) return t;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function m(e) {
|
|
16
|
+
return Object.keys(e.indexedDB).flatMap((e) => {
|
|
17
|
+
let t = u.find((t) => e.startsWith(t));
|
|
18
|
+
return t ? [{
|
|
19
|
+
name: e,
|
|
20
|
+
id: e.slice(t.length)
|
|
21
|
+
}] : [];
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function h(e) {
|
|
25
|
+
let t = atob(e), n = new Uint8Array(t.length);
|
|
26
|
+
for (let e = 0; e < t.length; e++) n[e] = t.charCodeAt(e);
|
|
27
|
+
return n;
|
|
28
|
+
}
|
|
29
|
+
function g(e) {
|
|
30
|
+
return typeof e == "object" && !!e && typeof e.$ == "string";
|
|
31
|
+
}
|
|
32
|
+
function _(e) {
|
|
33
|
+
if (Array.isArray(e)) return e.map(_);
|
|
34
|
+
if (!g(e)) {
|
|
35
|
+
if (typeof e == "object" && e) {
|
|
36
|
+
let t = {};
|
|
37
|
+
for (let [n, r] of Object.entries(e)) t[n] = _(r);
|
|
38
|
+
return t;
|
|
39
|
+
}
|
|
40
|
+
return e;
|
|
41
|
+
}
|
|
42
|
+
switch (e.$) {
|
|
43
|
+
case "ArrayBuffer": return h(String(e.v)).buffer;
|
|
44
|
+
case "View": {
|
|
45
|
+
let t = h(String(e.v));
|
|
46
|
+
if (!e.ctor || e.ctor === "Uint8Array") return t;
|
|
47
|
+
let n = globalThis[e.ctor];
|
|
48
|
+
return typeof n == "function" ? new n(t.buffer) : t;
|
|
49
|
+
}
|
|
50
|
+
case "Date": return new Date(String(e.v));
|
|
51
|
+
case "Map": return new Map(e.v.map(([e, t]) => [_(e), _(t)]));
|
|
52
|
+
case "Set": return new Set(e.v.map(_));
|
|
53
|
+
case "bigint": return BigInt(String(e.v));
|
|
54
|
+
case "number": return Number(e.v);
|
|
55
|
+
default: return;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function v(e) {
|
|
59
|
+
let t;
|
|
60
|
+
try {
|
|
61
|
+
t = JSON.parse(e);
|
|
62
|
+
} catch {
|
|
63
|
+
throw Error("That file is not valid JSON — pick the .json backup downloaded from the old address.");
|
|
64
|
+
}
|
|
65
|
+
if (typeof t != "object" || !t) throw Error("That file does not look like a Mudlet Web backup.");
|
|
66
|
+
let n = t;
|
|
67
|
+
if (n.format !== "mudlet-web-backup") throw Error("That file does not look like a Mudlet Web backup (no \"mudlet-web-backup\" marker).");
|
|
68
|
+
if (typeof n.version != "number" || n.version > 1) throw Error(`This backup is version ${String(n.version)}, which is newer than this client understands.`);
|
|
69
|
+
return {
|
|
70
|
+
format: n.format,
|
|
71
|
+
version: n.version,
|
|
72
|
+
createdAt: typeof n.createdAt == "string" ? n.createdAt : void 0,
|
|
73
|
+
origin: typeof n.origin == "string" ? n.origin : void 0,
|
|
74
|
+
localStorage: n.localStorage && typeof n.localStorage == "object" ? n.localStorage : {},
|
|
75
|
+
indexedDB: n.indexedDB && typeof n.indexedDB == "object" ? n.indexedDB : {},
|
|
76
|
+
skipped: Array.isArray(n.skipped) ? n.skipped : []
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function y(e) {
|
|
80
|
+
let t = f(e);
|
|
81
|
+
if (!t) return [];
|
|
82
|
+
try {
|
|
83
|
+
let e = JSON.parse(t)?.state?.connections;
|
|
84
|
+
return Array.isArray(e) ? e.filter((e) => e && typeof e.id == "string") : [];
|
|
85
|
+
} catch {
|
|
86
|
+
return [];
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function b(e) {
|
|
90
|
+
let t = f(e);
|
|
91
|
+
if (!t) return null;
|
|
92
|
+
try {
|
|
93
|
+
let e = JSON.parse(t)?.state?.client;
|
|
94
|
+
return e && typeof e == "object" ? e : null;
|
|
95
|
+
} catch {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function x(e) {
|
|
100
|
+
return m(e).map((e) => e.id);
|
|
101
|
+
}
|
|
102
|
+
function S(e, t) {
|
|
103
|
+
let n = p(e, c, "maps")?.records.find((e) => e.key === t);
|
|
104
|
+
if (!n) return null;
|
|
105
|
+
let r = _(n.value);
|
|
106
|
+
if (r instanceof ArrayBuffer) return r;
|
|
107
|
+
if (ArrayBuffer.isView(r)) {
|
|
108
|
+
let e = r;
|
|
109
|
+
return e.buffer.slice(e.byteOffset, e.byteOffset + e.byteLength);
|
|
110
|
+
}
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
function C(e, t) {
|
|
114
|
+
let n = p(e, l, "sessions");
|
|
115
|
+
return n ? n.records.map((e) => _(e.value)).filter((e) => e && e.connectionId === t) : [];
|
|
116
|
+
}
|
|
117
|
+
function w(e, t) {
|
|
118
|
+
let n = p(e, l, "entries");
|
|
119
|
+
return n ? n.records.map((e) => _(e.value)).filter((e) => e && t.has(e.sessionId)) : [];
|
|
120
|
+
}
|
|
121
|
+
function T(e) {
|
|
122
|
+
let t = y(e), n = new Set(t.map((e) => e.id)), r = t.map((e) => ({
|
|
123
|
+
id: e.id,
|
|
124
|
+
name: e.name || "Unnamed profile"
|
|
125
|
+
}));
|
|
126
|
+
for (let t of x(e)) n.has(t) || r.push({
|
|
127
|
+
id: t,
|
|
128
|
+
name: "Recovered profile"
|
|
129
|
+
});
|
|
130
|
+
let i = [];
|
|
131
|
+
(e.localStorage.mudix_vault_v1 || e.localStorage.mudlet_vault_v1) && i.push("Saved logins are not imported — passkeys are tied to the address they were created on. Re-enter and save them here."), p(e, l, "sessions") || i.push("This backup has no session logs in it (they are optional on the export side).");
|
|
132
|
+
for (let t of e.skipped ?? []) d.includes(t.where) && i.push("Linked local folders cannot be carried across addresses — re-link the folder after importing.");
|
|
133
|
+
let a = r.filter((t) => S(e, t.id) !== null).length, o = p(e, l, "sessions")?.records.length ?? 0;
|
|
134
|
+
return {
|
|
135
|
+
createdAt: e.createdAt ?? null,
|
|
136
|
+
origin: e.origin ?? null,
|
|
137
|
+
profiles: r,
|
|
138
|
+
maps: a,
|
|
139
|
+
logSessions: o,
|
|
140
|
+
warnings: i
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
async function E(e, t) {
|
|
144
|
+
if (typeof indexedDB > "u") throw Error("This browser has no IndexedDB, so profiles cannot be restored.");
|
|
145
|
+
let n = o(t), r = await new Promise((e, t) => {
|
|
146
|
+
let r = indexedDB.open(n, 1);
|
|
147
|
+
r.onupgradeneeded = () => {
|
|
148
|
+
let e = r.result;
|
|
149
|
+
e.objectStoreNames.contains(n) || e.createObjectStore(n);
|
|
150
|
+
}, r.onsuccess = () => e(r.result), r.onerror = () => t(r.error ?? /* @__PURE__ */ Error("could not open " + n)), r.onblocked = () => t(/* @__PURE__ */ Error("another tab is holding " + n + " open"));
|
|
151
|
+
});
|
|
152
|
+
try {
|
|
153
|
+
await new Promise((t, i) => {
|
|
154
|
+
let a = r.transaction(n, "readwrite"), o = a.objectStore(n);
|
|
155
|
+
for (let t of e.records) {
|
|
156
|
+
let e = _(t.value);
|
|
157
|
+
e !== void 0 && o.put(e, _(t.key));
|
|
158
|
+
}
|
|
159
|
+
a.oncomplete = () => t(), a.onerror = () => i(a.error), a.onabort = () => i(a.error ?? /* @__PURE__ */ Error("write aborted"));
|
|
160
|
+
});
|
|
161
|
+
} finally {
|
|
162
|
+
r.close();
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
function D(e, t, n, r) {
|
|
166
|
+
let i = t.find((t) => e.localStorage[t] !== void 0), a = i === void 0 ? void 0 : e.localStorage[i];
|
|
167
|
+
if (a !== void 0) try {
|
|
168
|
+
localStorage.setItem(n, a);
|
|
169
|
+
} catch {
|
|
170
|
+
r.push(`Could not restore ${n} — this browser refused the write.`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
async function O(o) {
|
|
174
|
+
let s = T(o), c = [...s.warnings], l = [], u = a.getState().connections.length > 0, d = new Map(y(o).map((e) => [e.id, e]));
|
|
175
|
+
for (let u of s.profiles) {
|
|
176
|
+
let s = d.get(u.id), f = s ? { ...s } : {
|
|
177
|
+
name: u.name,
|
|
178
|
+
mode: "mud",
|
|
179
|
+
host: "",
|
|
180
|
+
port: 23
|
|
181
|
+
};
|
|
182
|
+
delete f.id;
|
|
183
|
+
let p;
|
|
184
|
+
try {
|
|
185
|
+
p = a.getState().addConnection(f);
|
|
186
|
+
} catch (e) {
|
|
187
|
+
c.push(`${u.name}: could not be added — ${e instanceof Error ? e.message : String(e)}`);
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
let h = a.getState().connections.find((e) => e.id === p)?.name ?? u.name, g = m(o).find((e) => e.id === u.id)?.name, _ = g ? o.indexedDB[g]?.stores?.[g] : void 0;
|
|
191
|
+
if (_) try {
|
|
192
|
+
await E(_, p);
|
|
193
|
+
} catch (e) {
|
|
194
|
+
a.getState().removeConnection(p), c.push(`${u.name}: its files could not be restored — ${e instanceof Error ? e.message : String(e)}`);
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
else c.push(`${u.name}: the backup had no file data for it, so it arrives empty.`);
|
|
198
|
+
let v = S(o, u.id);
|
|
199
|
+
if (v) try {
|
|
200
|
+
await n(p, v);
|
|
201
|
+
} catch (e) {
|
|
202
|
+
c.push(`${u.name}: its map could not be restored — ${e instanceof Error ? e.message : String(e)}`);
|
|
203
|
+
}
|
|
204
|
+
let y = C(o, u.id);
|
|
205
|
+
if (y.length) try {
|
|
206
|
+
let e = new Set(y.map((e) => e.id));
|
|
207
|
+
for (let e of y) await t({
|
|
208
|
+
...e,
|
|
209
|
+
connectionId: p,
|
|
210
|
+
connectionName: h
|
|
211
|
+
});
|
|
212
|
+
let n = w(o, e).map((e) => {
|
|
213
|
+
let { id: t, ...n } = e;
|
|
214
|
+
return n;
|
|
215
|
+
});
|
|
216
|
+
n.length && await i(n);
|
|
217
|
+
} catch (e) {
|
|
218
|
+
c.push(`${u.name}: its logs could not be restored — ${e instanceof Error ? e.message : String(e)}`);
|
|
219
|
+
}
|
|
220
|
+
D(o, [`cmd.history.${u.id}`, e(u.id)], e(p), c), D(o, [`mudix_stopwatches_${u.id}`, r(u.id)], r(p), c), l.push({
|
|
221
|
+
id: p,
|
|
222
|
+
name: h
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
let f = b(o);
|
|
226
|
+
if (f && (u ? c.push("Client settings (theme, proxy, editor) were left as they are here — this browser already had profiles of its own.") : a.getState().patchClient(f)), !l.length && !s.profiles.length) throw Error("That backup holds no profiles.");
|
|
227
|
+
return {
|
|
228
|
+
imported: l,
|
|
229
|
+
warnings: c
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
//#endregion
|
|
233
|
+
export { O as importBackup, v as parseBackup };
|
package/dist-lib/branding.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { ComponentType, ReactNode } from 'react';
|
|
2
|
-
import type { ConnectionMode, MudConnection } from './storage/schema';
|
|
2
|
+
import type { ConnectionMode, MudConnection, ProfileSettings } from './storage/schema';
|
|
3
|
+
import type { TopMenu } from './ui/menu/menuModel';
|
|
4
|
+
import type { ToolbarItem } from './ui/menu/toolbarModel';
|
|
3
5
|
/**
|
|
4
6
|
* White-label branding for Mudlet Web builds. A branded client (a client
|
|
5
7
|
* shipped for one specific MUD) passes a `BrandConfig` to
|
|
@@ -24,6 +26,11 @@ export interface BrandMudTarget {
|
|
|
24
26
|
name?: string;
|
|
25
27
|
/** Seeded profiles dial automatically when opened. */
|
|
26
28
|
autoConnect?: boolean;
|
|
29
|
+
/** Seeded profiles come back on their own when a settled connection drops —
|
|
30
|
+
* Mudlet's "Reconnect automatically". Exposed here because branded mode
|
|
31
|
+
* never shows the connection editor: the brand config is the only place a
|
|
32
|
+
* managed profile's options can be set (see `ensureBrandProfile`). */
|
|
33
|
+
autoReconnect?: boolean;
|
|
27
34
|
}
|
|
28
35
|
/** A package bundled with the brand, installed on first profile open through
|
|
29
36
|
* the same pipeline as the stock defaults (see `ensureDefaultPackages`). */
|
|
@@ -68,9 +75,14 @@ export declare const STOCK_THEMES: {
|
|
|
68
75
|
label: string;
|
|
69
76
|
}[];
|
|
70
77
|
/** Ids of the stock toolbar buttons, for `BrandToolbarConfig.hide`.
|
|
71
|
-
* `connection` is
|
|
72
|
-
* `
|
|
73
|
-
|
|
78
|
+
* `connection` is Mudlet's Connect split button (Connect, with Disconnect and
|
|
79
|
+
* Close profile behind its arrow); `close` is the Close profile entry inside
|
|
80
|
+
* it, so hiding that one alone leaves the rest of the button. `mute` is the
|
|
81
|
+
* Mute split button, `record` toggles Mudlet-format replay recording.
|
|
82
|
+
*
|
|
83
|
+
* Every id also gates the matching menu-bar entry, so a brand that removed a
|
|
84
|
+
* feature does not find it again in a menu. */
|
|
85
|
+
export type StockToolbarButton = 'scripts' | 'files' | 'notepad' | 'map' | 'logs' | 'docs' | 'help' | 'reportBug' | 'settings' | 'record' | 'mute' | 'connection' | 'close';
|
|
74
86
|
/** What a brand toolbar button can do when clicked. */
|
|
75
87
|
export interface BrandToolbarContext {
|
|
76
88
|
connectionId: string;
|
|
@@ -91,13 +103,66 @@ export interface BrandToolbarButton {
|
|
|
91
103
|
onClick(ctx: BrandToolbarContext): void;
|
|
92
104
|
}
|
|
93
105
|
export interface BrandToolbarConfig {
|
|
94
|
-
/** Stock buttons to remove
|
|
106
|
+
/** Stock buttons to remove, applied before the transforms below see the
|
|
107
|
+
* list. A shorthand: `menuBar`/`buttonBar` can drop the same things, and
|
|
108
|
+
* anything else besides. */
|
|
95
109
|
hide?: StockToolbarButton[];
|
|
96
|
-
/** Brand buttons, appended after the stock app buttons.
|
|
110
|
+
/** Brand buttons, appended after the stock app buttons.
|
|
111
|
+
* @deprecated Use `commands` — it reaches the menu bar too, takes a
|
|
112
|
+
* shortcut, and can be enabled, checked and removed while running. */
|
|
97
113
|
buttons?: BrandToolbarButton[];
|
|
98
|
-
/**
|
|
99
|
-
*
|
|
114
|
+
/**
|
|
115
|
+
* Commands in `addCommand`'s own shape: they land on the toolbar, the menu
|
|
116
|
+
* bar or both, take a key sequence, and can be ticked or greyed out. These
|
|
117
|
+
* are the brand's opening set — the exported `commands` registry places and
|
|
118
|
+
* removes them at runtime.
|
|
119
|
+
*/
|
|
120
|
+
commands?: BrandCommand[];
|
|
121
|
+
/** Extra class on the menu row (`.mudlet-toolbar`). NOTE: the top bar is two
|
|
122
|
+
* rows now, wrapped in `.mudlet-topbar`, which carries the background and
|
|
123
|
+
* the bottom border — brand CSS written against the old single bar should
|
|
124
|
+
* move those rules to `.mudlet-topbar`. */
|
|
100
125
|
className?: string;
|
|
126
|
+
/**
|
|
127
|
+
* The menu bar: `false` to remove it, or a function to rebuild it.
|
|
128
|
+
*
|
|
129
|
+
* The function is handed the finished stock tree — the client's own menus,
|
|
130
|
+
* with `hide` applied and every package and host command already placed —
|
|
131
|
+
* and returns what to draw. Reorder, rename, nest, drop, or return
|
|
132
|
+
* something entirely your own; nothing downstream assumes a particular
|
|
133
|
+
* menu is still there.
|
|
134
|
+
*/
|
|
135
|
+
menuBar?: boolean | ((stock: TopMenu[], ctx: BrandToolbarContext) => TopMenu[]);
|
|
136
|
+
/**
|
|
137
|
+
* The button row, the same way: `false` to remove it, or a function handed
|
|
138
|
+
* the finished stock items to rebuild.
|
|
139
|
+
*
|
|
140
|
+
* Below the desktop breakpoint the row is the hamburger instead, and it
|
|
141
|
+
* draws whatever this returned — so a brand that reorders the row reorders
|
|
142
|
+
* the phone menu with it.
|
|
143
|
+
*/
|
|
144
|
+
buttonBar?: boolean | ((stock: ToolbarItem[], ctx: BrandToolbarContext) => ToolbarItem[]);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* A brand's command, in the shape `addCommand` uses. The one difference is the
|
|
148
|
+
* icon: a package names a file in its own directory, a brand passes a node, so
|
|
149
|
+
* an inline SVG needs no round trip through the VFS.
|
|
150
|
+
*/
|
|
151
|
+
export interface BrandCommand {
|
|
152
|
+
/** The brand's own id, for `commands.remove()` later. */
|
|
153
|
+
id: string;
|
|
154
|
+
name: string;
|
|
155
|
+
icon?: ReactNode;
|
|
156
|
+
tooltip?: string;
|
|
157
|
+
/** '/'-separated; the first segment names a top-level menu. */
|
|
158
|
+
menuPath?: string;
|
|
159
|
+
/** Qt-style key sequence, e.g. "Ctrl+Alt+K". */
|
|
160
|
+
shortcut?: string;
|
|
161
|
+
/** Absent means both bars. */
|
|
162
|
+
surfaces?: 'menu' | 'toolbar' | 'both';
|
|
163
|
+
enabled?: boolean;
|
|
164
|
+
checked?: boolean;
|
|
165
|
+
onClick(ctx: BrandToolbarContext): void;
|
|
101
166
|
}
|
|
102
167
|
/** Contract for a brand-supplied landing screen, rendered instead of the stock
|
|
103
168
|
* connection picker whenever no profile is open. */
|
|
@@ -154,13 +219,21 @@ export interface BrandConfig {
|
|
|
154
219
|
* mapper, chosen per game — see `stockDefaults`).
|
|
155
220
|
* - `[]` — nothing is preinstalled.
|
|
156
221
|
* - a list — exactly these, and none of the stock ones.
|
|
222
|
+
* - a function — handed the stock defaults this profile would get (already
|
|
223
|
+
* chosen per game), returns the exact list to install. Use it to drop or
|
|
224
|
+
* add to the stock set without vendoring it, e.g.
|
|
225
|
+
* `stock => stock.filter(p => p.name !== 'mudlet-base-ui')`.
|
|
226
|
+
* It is handed its own copy, so editing it is harmless, but keep it cheap
|
|
227
|
+
* and side-effect free: `isPackageRemovable` calls it once per package row
|
|
228
|
+
* on every render of the package list, there handing it *every* bundled
|
|
229
|
+
* default (both mappers, every game loader) rather than one game's pick.
|
|
157
230
|
*
|
|
158
231
|
* So a brand shipping its own mapper just lists it here and ours never
|
|
159
232
|
* appears; nothing arbitrates between them at install time, which is why the
|
|
160
233
|
* list is exact rather than additive (two mappers would both drive
|
|
161
234
|
* `centerview` off the same movement).
|
|
162
235
|
*/
|
|
163
|
-
packages?: BrandPackage[];
|
|
236
|
+
packages?: BrandPackage[] | ((stock: BrandPackage[]) => BrandPackage[]);
|
|
164
237
|
/** Brand-defined themes, offered in the picker alongside (or instead of)
|
|
165
238
|
* the stock ones. A theme reusing a stock id overrides it. */
|
|
166
239
|
themes?: BrandTheme[];
|
|
@@ -176,6 +249,28 @@ export interface BrandConfig {
|
|
|
176
249
|
toolbar?: BrandToolbarConfig;
|
|
177
250
|
/** Custom landing screen replacing the stock connection picker. */
|
|
178
251
|
Landing?: ComponentType<LandingProps>;
|
|
252
|
+
/** Profile settings a managed profile starts with, applied once when the
|
|
253
|
+
* profile is created (on first launch, or at first login in `'perLogin'`
|
|
254
|
+
* mode). The player's later changes in Settings stick: an existing
|
|
255
|
+
* profile is never re-patched, so editing this reaches new profiles only.
|
|
256
|
+
* `config` is the `setConfig` option bag (e.g. `versionInTTYPE`,
|
|
257
|
+
* `enableBlinkText`). */
|
|
258
|
+
profileDefaults?: Partial<ProfileSettings>;
|
|
259
|
+
/** Whether to ask the browser to exempt this origin's storage from
|
|
260
|
+
* eviction (`navigator.storage.persist()`) when a profile is opened or
|
|
261
|
+
* imported. Default `true`. Firefox shows that request as a permission
|
|
262
|
+
* prompt; set `false` to never make it — a brand that keeps its players'
|
|
263
|
+
* data server-side, or that doesn't want the prompt, opts out here. */
|
|
264
|
+
requestPersistentStorage?: boolean;
|
|
265
|
+
/** Where an OpenID provider sends the player back after a client-driven
|
|
266
|
+
* GMCP `Char.Login` browser sign-in. Default: `oauth-callback.html` beside
|
|
267
|
+
* the app, which the `Mudlet Web/vite` plugin emits into your build. Set
|
|
268
|
+
* this when your site serves that page somewhere else. It must be
|
|
269
|
+
* **same-origin** with the app (the page reports back over a
|
|
270
|
+
* `BroadcastChannel`) and run the shipped `oauth-callback.html`, and the
|
|
271
|
+
* game's provider must have this exact address registered for its
|
|
272
|
+
* `client_id`. Relative values resolve against the app's base URL. */
|
|
273
|
+
oauthRedirectUrl?: string;
|
|
179
274
|
}
|
|
180
275
|
export declare const DEFAULT_BRAND: BrandConfig;
|
|
181
276
|
/** Install the active brand. Called once by `MudletWebApp` before first render;
|
|
@@ -185,10 +280,6 @@ export declare function getBrand(): BrandConfig;
|
|
|
185
280
|
/** Whether the active brand pins a MUD — i.e. the client runs in branded mode
|
|
186
281
|
* (single profile, login-form landing, no persisted credentials). */
|
|
187
282
|
export declare function isBrandedMode(): boolean;
|
|
188
|
-
/** Whether the user may uninstall the named package. Only brand-bundled
|
|
189
|
-
* packages marked `removable: false` are locked; everything else — stock
|
|
190
|
-
* defaults included — is removable. */
|
|
191
|
-
export declare function isPackageRemovable(name: string): boolean;
|
|
192
283
|
/** Theme options for the settings picker: brand themes first (one overriding
|
|
193
284
|
* a stock id replaces it in place), narrowed and ordered by
|
|
194
285
|
* `availableThemes` when set. */
|
|
@@ -206,6 +297,13 @@ export declare function brandThemesCss(): string;
|
|
|
206
297
|
* pin one. Used to create the managed profile(s) in branded mode; `account`
|
|
207
298
|
* names a per-login profile (see `profileMode: 'perLogin'`). */
|
|
208
299
|
export declare function brandConnectionData(brand: BrandConfig, account?: string): Omit<MudConnection, 'id'> | null;
|
|
300
|
+
/** Create a managed profile from `seed` and apply the brand's
|
|
301
|
+
* `profileDefaults` to it. Returns the new connection id. The store actions
|
|
302
|
+
* are passed in so this module stays free of the store. */
|
|
303
|
+
export declare function addBrandProfile(brand: BrandConfig, seed: Omit<MudConnection, 'id'>, store: {
|
|
304
|
+
addConnection: (data: Omit<MudConnection, 'id'>) => string;
|
|
305
|
+
patchConnectionProfile: (connectionId: string, patch: Partial<ProfileSettings>) => void;
|
|
306
|
+
}): string;
|
|
209
307
|
/** The existing managed profile a login maps to, if any. In `'perLogin'` mode
|
|
210
308
|
* a non-empty `account` matches the profile named after it (trimmed,
|
|
211
309
|
* case-insensitive); otherwise — `'single'` mode, or no account entered —
|