@mudlet/mudlet-web 0.5.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (301) hide show
  1. package/README.md +1 -1
  2. package/dist-lib/analytics.d.ts +27 -0
  3. package/dist-lib/assets/fonts/Vera.woff2 +0 -0
  4. package/dist-lib/assets/fonts/VeraBI.woff2 +0 -0
  5. package/dist-lib/assets/fonts/VeraBd.woff2 +0 -0
  6. package/dist-lib/assets/fonts/VeraIt.woff2 +0 -0
  7. package/dist-lib/assets/mapParser.worker-DrVZ3wg_.js +9 -0
  8. package/dist-lib/backupImport-wt8r7JXI.js +233 -0
  9. package/dist-lib/branding.d.ts +111 -13
  10. package/dist-lib/db/sqliteClient.d.ts +195 -7
  11. package/dist-lib/hooks/useAutoReconnect.d.ts +61 -0
  12. package/dist-lib/hooks/useDocumentFullscreen.d.ts +23 -0
  13. package/dist-lib/hooks/useKeyboardShortcuts.d.ts +37 -0
  14. package/dist-lib/hooks/useRecordLastPlayed.d.ts +10 -0
  15. package/dist-lib/import/applyMudletProfile.d.ts +35 -9
  16. package/dist-lib/import/backupImport.d.ts +118 -0
  17. package/dist-lib/import/collectProfileExport.d.ts +33 -2
  18. package/dist-lib/import/defaultPackages.d.ts +57 -14
  19. package/dist-lib/import/defaults/CF-loader/CF-loader.mpackage +0 -0
  20. package/dist-lib/import/defaults/MedBootstrap/MedBootstrap.mpackage +0 -0
  21. package/dist-lib/import/defaults/deleteOldProfiles/deleteOldProfiles.mpackage +0 -0
  22. package/dist-lib/import/defaults/echo/echo.mpackage +0 -0
  23. package/dist-lib/import/defaults/enable-accessibility/enable-accessibility.mpackage +0 -0
  24. package/dist-lib/import/defaults/generic_mapper/generic_mapper.mpackage +0 -0
  25. package/dist-lib/import/defaults/gui-drop/gui-drop.mpackage +0 -0
  26. package/dist-lib/import/defaults/icesus-loader/icesus-loader.mpackage +0 -0
  27. package/dist-lib/import/defaults/mg-loader/mg-loader.mpackage +0 -0
  28. package/dist-lib/import/defaults/mudlet-base-ui/mudlet-base-ui.mpackage +0 -0
  29. package/dist-lib/import/defaults/mudlet-mapper.xml +1215 -389
  30. package/dist-lib/import/mudletControlChars.d.ts +14 -0
  31. package/dist-lib/import/mudletHost.d.ts +73 -10
  32. package/dist-lib/import/mudletLink.d.ts +53 -2
  33. package/dist-lib/import/mudletProfileExport.d.ts +38 -5
  34. package/dist-lib/import/mudletProfileImport.d.ts +110 -12
  35. package/dist-lib/import/mudletVariables.d.ts +4 -3
  36. package/dist-lib/import/mudletWriteback.d.ts +15 -1
  37. package/dist-lib/import/mudletXmlImport.d.ts +46 -0
  38. package/dist-lib/import/packageFonts.d.ts +33 -0
  39. package/dist-lib/import/packageInstaller.d.ts +111 -7
  40. package/dist-lib/import/qtProfileData.d.ts +10 -0
  41. package/dist-lib/import/remotePackageInstall.d.ts +23 -7
  42. package/dist-lib/import/zipEntries.d.ts +45 -0
  43. package/dist-lib/index.d.ts +7 -3
  44. package/dist-lib/index.js +50508 -29836
  45. package/dist-lib/logging/SessionLogger.d.ts +75 -15
  46. package/dist-lib/map/MapSelectionOverlay.d.ts +2 -2
  47. package/dist-lib/map/MapStore.d.ts +387 -60
  48. package/dist-lib/map/MudletHighlightOverlay.d.ts +2 -2
  49. package/dist-lib/map/{MudixMapReader.d.ts → MudletMapReader.d.ts} +2 -2
  50. package/dist-lib/map/areaGraph.d.ts +120 -0
  51. package/dist-lib/map/environmentKit.d.ts +36 -0
  52. package/dist-lib/map/labelPixmap.d.ts +90 -0
  53. package/dist-lib/map/mapImageExport.d.ts +36 -2
  54. package/dist-lib/map/mapStyle.d.ts +11 -0
  55. package/dist-lib/map/mapVersion.d.ts +66 -0
  56. package/dist-lib/map/pathfinding.d.ts +2 -2
  57. package/dist-lib/mud/CharLoginController.d.ts +230 -0
  58. package/dist-lib/mud/ItemIdSequence.d.ts +1 -1
  59. package/dist-lib/mud/MudSession.d.ts +279 -22
  60. package/dist-lib/mud/PatternEngine.d.ts +153 -14
  61. package/dist-lib/mud/aliases/AliasEngine.d.ts +55 -9
  62. package/dist-lib/mud/autoLogin.d.ts +59 -0
  63. package/dist-lib/mud/commandSplit.d.ts +9 -0
  64. package/dist-lib/mud/connection/LineAssembler.d.ts +38 -11
  65. package/dist-lib/mud/connection/MudClient.d.ts +291 -53
  66. package/dist-lib/mud/connection/SubnegotiationRepair.d.ts +24 -0
  67. package/dist-lib/mud/connection/TelnetNegotiator.d.ts +208 -68
  68. package/dist-lib/mud/connection/telnetDebug.d.ts +8 -8
  69. package/dist-lib/mud/events.d.ts +102 -23
  70. package/dist-lib/mud/games/bundledGames.d.ts +12 -7
  71. package/dist-lib/mud/games/gameLinks.d.ts +40 -0
  72. package/dist-lib/mud/games/icons/3Kingdoms.png +0 -0
  73. package/dist-lib/mud/games/icons/3Scapes.png +0 -0
  74. package/dist-lib/mud/games/icons/achaea.png +0 -0
  75. package/dist-lib/mud/games/icons/aetolia.png +0 -0
  76. package/dist-lib/mud/games/icons/banner_astaria.png +0 -0
  77. package/dist-lib/mud/games/icons/banner_darkmists.png +0 -0
  78. package/dist-lib/mud/games/icons/banner_dreamland.png +0 -0
  79. package/dist-lib/mud/games/icons/banner_petria.jpg +0 -0
  80. package/dist-lib/mud/games/icons/banner_ropmud.png +0 -0
  81. package/dist-lib/mud/games/icons/blackmud.png +0 -0
  82. package/dist-lib/mud/games/icons/carrionfields.png +0 -0
  83. package/dist-lib/mud/games/icons/dragonfire_icon.png +0 -0
  84. package/dist-lib/mud/games/icons/fed2-logo.png +0 -0
  85. package/dist-lib/mud/games/icons/icesus_480x120.png +0 -0
  86. package/dist-lib/mud/games/icons/imperian.png +0 -0
  87. package/dist-lib/mud/games/icons/infinity_480x120.png +0 -0
  88. package/dist-lib/mud/games/icons/lusternia.png +0 -0
  89. package/dist-lib/mud/games/icons/morgengrauen_480x120.png +0 -0
  90. package/dist-lib/mud/games/icons/mudlet-tutorial.png +0 -0
  91. package/dist-lib/mud/games/icons/phoenixmud_480x120.png +0 -0
  92. package/dist-lib/mud/games/icons/starmourn.png +0 -0
  93. package/dist-lib/mud/games/icons/voidmud_icon.png +0 -0
  94. package/dist-lib/mud/games/icons/wotmudicon.png +0 -0
  95. package/dist-lib/mud/games/websiteLinks.d.ts +21 -0
  96. package/dist-lib/mud/keybindings/KeyEngine.d.ts +110 -4
  97. package/dist-lib/mud/keybindings/browserReservedKeys.d.ts +2 -2
  98. package/dist-lib/mud/keybindings/keyEventTarget.d.ts +61 -0
  99. package/dist-lib/mud/keybindings/qtKeys.d.ts +91 -12
  100. package/dist-lib/mud/protocol/atcp.d.ts +19 -0
  101. package/dist-lib/mud/protocol/byteString.d.ts +24 -0
  102. package/dist-lib/mud/protocol/charLoginFlow.d.ts +243 -16
  103. package/dist-lib/mud/protocol/charset.d.ts +111 -46
  104. package/dist-lib/mud/protocol/codePages.d.ts +10 -0
  105. package/dist-lib/mud/protocol/constants.d.ts +17 -10
  106. package/dist-lib/mud/protocol/echo.d.ts +23 -27
  107. package/dist-lib/mud/protocol/gmcp.d.ts +36 -6
  108. package/dist-lib/mud/protocol/index.d.ts +3 -2
  109. package/dist-lib/mud/protocol/luaLiteral.d.ts +12 -0
  110. package/dist-lib/mud/protocol/mccp.d.ts +83 -1
  111. package/dist-lib/mud/protocol/mnes.d.ts +41 -58
  112. package/dist-lib/mud/protocol/msdp.d.ts +11 -4
  113. package/dist-lib/mud/protocol/msp.d.ts +3 -2
  114. package/dist-lib/mud/protocol/mssp.d.ts +9 -4
  115. package/dist-lib/mud/protocol/multiByte.d.ts +51 -0
  116. package/dist-lib/mud/protocol/multiByteEncode.d.ts +42 -0
  117. package/dist-lib/mud/protocol/mxp.d.ts +193 -14
  118. package/dist-lib/mud/protocol/oauthClientFlow.d.ts +128 -0
  119. package/dist-lib/mud/protocol/qtCodePages.generated.d.ts +1 -0
  120. package/dist-lib/mud/protocol/tlsCodes.d.ts +40 -3
  121. package/dist-lib/mud/replay/ReplayPlayer.d.ts +16 -1
  122. package/dist-lib/mud/replay/replayFormat.d.ts +29 -2
  123. package/dist-lib/mud/text/Console.d.ts +255 -49
  124. package/dist-lib/mud/text/FormatState.d.ts +137 -14
  125. package/dist-lib/mud/text/ansiEscapes.d.ts +32 -16
  126. package/dist-lib/mud/text/colorParsers.d.ts +14 -2
  127. package/dist-lib/mud/text/colorSpaceId.d.ts +2 -0
  128. package/dist-lib/mud/text/colors.d.ts +17 -10
  129. package/dist-lib/mud/text/controlCharacterMode.d.ts +1 -1
  130. package/dist-lib/mud/text/hyperlinkVisibility.d.ts +1 -1
  131. package/dist-lib/mud/text/lineBreak.d.ts +5 -0
  132. package/dist-lib/mud/text/serverWrap.d.ts +2 -2
  133. package/dist-lib/mud/text/textAnalyzer.d.ts +79 -0
  134. package/dist-lib/mud/text/unicodeRuns.d.ts +11 -0
  135. package/dist-lib/mud/text/unicodeTables.generated.d.ts +3 -0
  136. package/dist-lib/mud/text/wcwidth.d.ts +27 -22
  137. package/dist-lib/mud/timers/TimerEngine.d.ts +163 -11
  138. package/dist-lib/mud/timers/workerClock.d.ts +67 -0
  139. package/dist-lib/mud/triggers/TriggerEngine.d.ts +449 -47
  140. package/dist-lib/mud/triggers/legacyColorPatterns.d.ts +58 -0
  141. package/dist-lib/mud/triggers/pcre/Pcre2.d.ts +83 -1
  142. package/dist-lib/oauth-callback.html +94 -0
  143. package/dist-lib/pcre2Wasm.d.ts +54 -0
  144. package/dist-lib/pcre2Wasm.js +241 -0
  145. package/dist-lib/scripting/EngineHost.d.ts +45 -21
  146. package/dist-lib/scripting/IScriptingRuntime.d.ts +103 -27
  147. package/dist-lib/scripting/MxpFrameManager.d.ts +10 -1
  148. package/dist-lib/scripting/ScriptingAPI.d.ts +1030 -213
  149. package/dist-lib/scripting/ScriptingEngine.d.ts +727 -106
  150. package/dist-lib/scripting/StopwatchManager.d.ts +97 -36
  151. package/dist-lib/scripting/http/HttpService.d.ts +9 -1
  152. package/dist-lib/scripting/http/userUrl.d.ts +41 -0
  153. package/dist-lib/scripting/lua/LuaRuntime.d.ts +352 -77
  154. package/dist-lib/scripting/lua/argContracts.d.ts +71 -0
  155. package/dist-lib/scripting/lua/bindings/automation.d.ts +1 -1
  156. package/dist-lib/scripting/lua/bindings/commands.d.ts +13 -0
  157. package/dist-lib/scripting/lua/bindings/context.d.ts +20 -2
  158. package/dist-lib/scripting/lua/bindings/diagnostics.d.ts +1 -1
  159. package/dist-lib/scripting/lua/bindings/map.d.ts +1 -1
  160. package/dist-lib/scripting/lua/bindings/media.d.ts +2 -2
  161. package/dist-lib/scripting/lua/bindings/output.d.ts +1 -1
  162. package/dist-lib/scripting/lua/bindings/session.d.ts +2 -2
  163. package/dist-lib/scripting/lua/bindings/textEdit.d.ts +1 -1
  164. package/dist-lib/scripting/lua/bindings/userWindows.d.ts +1 -1
  165. package/dist-lib/scripting/lua/byteArmor.d.ts +36 -0
  166. package/dist-lib/scripting/lua/imageSize.d.ts +7 -0
  167. package/dist-lib/scripting/lua/rex.d.ts +4 -2
  168. package/dist-lib/scripting/lua/sqlRowEncoder.d.ts +6 -1
  169. package/dist-lib/scripting/lua/utf8CaseMap.d.ts +1 -0
  170. package/dist-lib/scripting/lua/utf8Patterns.d.ts +21 -1
  171. package/dist-lib/scripting/lua/wellFormedStrings.d.ts +40 -0
  172. package/dist-lib/scripting/lua/yajl.d.ts +43 -5
  173. package/dist-lib/scripting/profilesPresence.d.ts +20 -2
  174. package/dist-lib/scripting/vfs/ProfileVFS.d.ts +164 -10
  175. package/dist-lib/scripting/vfs/fsErrors.d.ts +28 -0
  176. package/dist-lib/scripting/vfs/idbCommit.d.ts +20 -0
  177. package/dist-lib/storage/appStore.d.ts +24 -9
  178. package/dist-lib/storage/hooks.d.ts +5 -1
  179. package/dist-lib/storage/index.d.ts +2 -2
  180. package/dist-lib/storage/mapStorage.d.ts +2 -0
  181. package/dist-lib/storage/persistentStorage.d.ts +3 -1
  182. package/dist-lib/storage/profileStorage.d.ts +15 -0
  183. package/dist-lib/storage/profileVfsData.d.ts +3 -3
  184. package/dist-lib/storage/schema.d.ts +512 -40
  185. package/dist-lib/storage/storageMigration.d.ts +82 -0
  186. package/dist-lib/storage-g5V1b-c1.js +2039 -0
  187. package/dist-lib/styles.css +1 -1
  188. package/dist-lib/ui/AboutModal.d.ts +1 -1
  189. package/dist-lib/ui/BrandLoginFields.d.ts +1 -1
  190. package/dist-lib/ui/BrowserSignInModal.d.ts +23 -0
  191. package/dist-lib/ui/CmdLineMenuRegistry.d.ts +14 -5
  192. package/dist-lib/ui/CommandBar.d.ts +8 -8
  193. package/dist-lib/ui/ConnectionFormModal.d.ts +20 -1
  194. package/dist-lib/ui/ConnectionScreen.d.ts +9 -1
  195. package/dist-lib/ui/GameLinkPrompt.d.ts +28 -0
  196. package/dist-lib/ui/HelpModal.d.ts +5 -1
  197. package/dist-lib/ui/MapSymbolUsageModal.d.ts +32 -0
  198. package/dist-lib/ui/MouseEventRegistry.d.ts +31 -4
  199. package/dist-lib/ui/NotepadModal.d.ts +22 -0
  200. package/dist-lib/ui/ResizableModal.d.ts +16 -1
  201. package/dist-lib/ui/SettingsModal.d.ts +10 -1
  202. package/dist-lib/ui/TlsAlertBanner.d.ts +3 -1
  203. package/dist-lib/ui/Toolbar.d.ts +22 -1
  204. package/dist-lib/ui/VaultManageButton.d.ts +10 -5
  205. package/dist-lib/ui/VaultModal.d.ts +3 -0
  206. package/dist-lib/ui/buttons/ButtonsBar.d.ts +3 -1
  207. package/dist-lib/ui/buttons/inactiveButtons.d.ts +25 -0
  208. package/dist-lib/ui/cmdline/CommandLineManager.d.ts +19 -0
  209. package/dist-lib/ui/cmdline/plainText.d.ts +16 -0
  210. package/dist-lib/ui/cmdline/subCommandLine.d.ts +78 -0
  211. package/dist-lib/ui/cmdline/useCmdLineSelection.d.ts +26 -0
  212. package/dist-lib/ui/cmdline/useSubCommandLineKeys.d.ts +33 -0
  213. package/dist-lib/ui/codemirror/lineParagraphMarks.d.ts +19 -0
  214. package/dist-lib/ui/codemirror/luaHover.d.ts +7 -0
  215. package/dist-lib/ui/codemirror/options.d.ts +33 -0
  216. package/dist-lib/ui/codemirror/theme.d.ts +29 -5
  217. package/dist-lib/ui/commands/addonCommands.d.ts +134 -0
  218. package/dist-lib/ui/commands/appShortcuts.d.ts +86 -0
  219. package/dist-lib/ui/commands/hostCommands.d.ts +88 -0
  220. package/dist-lib/ui/commands/keyMatch.d.ts +20 -0
  221. package/dist-lib/ui/commands/keySequence.d.ts +57 -0
  222. package/dist-lib/ui/components/ContextMenu.d.ts +21 -1
  223. package/dist-lib/ui/components/FontPicker.d.ts +5 -1
  224. package/dist-lib/ui/components/useModalFocus.d.ts +13 -1
  225. package/dist-lib/ui/helpTopics.d.ts +15 -0
  226. package/dist-lib/ui/labels/LabelManager.d.ts +172 -9
  227. package/dist-lib/ui/labels/LabelOverlay.d.ts +19 -0
  228. package/dist-lib/ui/labels/backgroundImageSize.d.ts +19 -0
  229. package/dist-lib/ui/labels/labelModel.d.ts +64 -0
  230. package/dist-lib/ui/labels/qColor.d.ts +13 -0
  231. package/dist-lib/ui/labels/qtCss.d.ts +12 -4
  232. package/dist-lib/ui/landmarks.d.ts +9 -0
  233. package/dist-lib/ui/launcher/ActionMenu.d.ts +19 -0
  234. package/dist-lib/ui/launcher/GameDetails.d.ts +21 -0
  235. package/dist-lib/ui/launcher/GameSection.d.ts +18 -0
  236. package/dist-lib/ui/launcher/LauncherSearch.d.ts +23 -0
  237. package/dist-lib/ui/launcher/ProfileArt.d.ts +20 -0
  238. package/dist-lib/ui/launcher/ProfileSection.d.ts +43 -0
  239. package/dist-lib/ui/launcher/launcherModel.d.ts +72 -0
  240. package/dist-lib/ui/layout/overlayLayerOrder.d.ts +2 -2
  241. package/dist-lib/ui/menu/MenuBar.d.ts +31 -0
  242. package/dist-lib/ui/menu/SplitButton.d.ts +39 -0
  243. package/dist-lib/ui/menu/anchoredPopup.d.ts +74 -0
  244. package/dist-lib/ui/menu/appMenus.d.ts +65 -0
  245. package/dist-lib/ui/menu/menuModel.d.ts +88 -0
  246. package/dist-lib/ui/menu/toolbarModel.d.ts +56 -0
  247. package/dist-lib/ui/notepad.d.ts +76 -0
  248. package/dist-lib/ui/openSignInPage.d.ts +14 -0
  249. package/dist-lib/ui/output/OutputContextMenu.d.ts +14 -1
  250. package/dist-lib/ui/output/OutputRenderer.d.ts +5 -0
  251. package/dist-lib/ui/output/OutputSearchBar.d.ts +5 -1
  252. package/dist-lib/ui/output/StickyOutputPanel.d.ts +17 -3
  253. package/dist-lib/ui/output/TextAnalyzerModal.d.ts +25 -0
  254. package/dist-lib/ui/output/caretMode.d.ts +3 -2
  255. package/dist-lib/ui/output/clearSplit.d.ts +11 -0
  256. package/dist-lib/ui/output/outputCopy.d.ts +41 -2
  257. package/dist-lib/ui/output/outputRows.d.ts +43 -0
  258. package/dist-lib/ui/output/selectionGesture.d.ts +35 -0
  259. package/dist-lib/ui/output/wordSelection.d.ts +33 -0
  260. package/dist-lib/ui/search/matcher.d.ts +14 -4
  261. package/dist-lib/ui/settings/SettingsShell.d.ts +91 -0
  262. package/dist-lib/ui/settings/ShortcutEditor.d.ts +13 -0
  263. package/dist-lib/ui/sound/SoundManager.d.ts +210 -44
  264. package/dist-lib/ui/sound/closedCaption.d.ts +4 -1
  265. package/dist-lib/ui/sound/mediaDirection.d.ts +35 -0
  266. package/dist-lib/ui/tabCompletion.d.ts +53 -0
  267. package/dist-lib/ui/textedit/TextEditManager.d.ts +11 -2
  268. package/dist-lib/ui/useOpenProfiles.d.ts +1 -1
  269. package/dist-lib/ui/video/VideoManager.d.ts +7 -0
  270. package/dist-lib/ui/windows/WindowManager.d.ts +452 -37
  271. package/dist-lib/ui/windows/panels/ScriptEditorPanel.d.ts +14 -0
  272. package/dist-lib/ui/windows/panels/ScriptSearch.d.ts +6 -1
  273. package/dist-lib/ui/windows/panels/TextPanel.d.ts +4 -1
  274. package/dist-lib/ui/windows/panels/VariablesView.d.ts +37 -7
  275. package/dist-lib/ui/windows/panels/WindowCmdLine.d.ts +4 -2
  276. package/dist-lib/ui/windows/panels/aliasLoop.d.ts +24 -0
  277. package/dist-lib/ui/windows/panels/editorClipboard.d.ts +45 -0
  278. package/dist-lib/ui/windows/panels/editorUndo.d.ts +79 -0
  279. package/dist-lib/ui/windows/panels/mapAreaChange.d.ts +10 -0
  280. package/dist-lib/utils/appShellCache.d.ts +25 -0
  281. package/dist-lib/utils/fontFamilyName.d.ts +13 -0
  282. package/dist-lib/utils/fontLoader.d.ts +31 -0
  283. package/dist-lib/utils/formatBytes.d.ts +4 -0
  284. package/dist-lib/utils/mustBeOneOf.d.ts +9 -0
  285. package/dist-lib/utils/profileLock.d.ts +1 -1
  286. package/dist-lib/utils/systemTheme.d.ts +24 -0
  287. package/dist-lib/utils/timeZone.d.ts +10 -0
  288. package/dist-lib/vault/CredentialVault.d.ts +51 -5
  289. package/dist-lib/vault/deviceUnlock.d.ts +47 -0
  290. package/dist-lib/vault/vaultAccess.d.ts +24 -2
  291. package/dist-lib/vault/vaultHelpTopic.d.ts +9 -0
  292. package/dist-lib/vault/vaultRecord.d.ts +33 -1
  293. package/dist-lib/vfs-sw.js +220 -11
  294. package/dist-lib/vite.d.ts +1 -1
  295. package/dist-lib/vite.js +66 -43
  296. package/package.json +23 -15
  297. package/dist-lib/assets/mapParser.worker-t-3rd1zR.js +0 -9
  298. package/dist-lib/mud/connection/PingTracker.d.ts +0 -41
  299. package/dist-lib/ui/BundledGameGrid.d.ts +0 -21
  300. package/dist-lib/ui/ConnectionGrid.d.ts +0 -21
  301. package/dist-lib/ui/bufferWords.d.ts +0 -38
@@ -6,56 +6,35 @@ import { CLIENT_NAME, CLIENT_VERSION, TERMINAL_TYPE } from "../../version";
6
6
  * distinction structurally: a name followed by VALUE is defined (and, with
7
7
  * nothing after the VALUE, defined-but-empty), while a name followed by the
8
8
  * next marker or IAC with no VALUE at all is undefined. That is how a variable
9
- * the client deliberately does not supply is answered — see
10
- * {@link MNES_UNMAINTAINED}. */
9
+ * the client does not supply is answered. */
11
10
  export interface MnesVar {
12
11
  name: string;
13
12
  value: string | null;
14
13
  }
15
- /** Result of parsing an `IAC SB NEW-ENVIRON SEND … IAC SE` request body. */
16
- export interface MnesRequest {
17
- /** True when the body is a well-formed SEND command (the only request kind
18
- * a client answers). */
19
- isSend: boolean;
20
- /** Variable names the server explicitly asked for, in request order. Empty
21
- * means a bare SEND — the server wants every variable we report. */
22
- requested: string[];
23
- }
24
- /**
25
- * Parse an `IAC SB NEW-ENVIRON SEND …` request. `subneg` is the subnegotiation
26
- * body with the leading option code (39) still attached (matching how the
27
- * telnet option parser hands bodies to the other protocol streams). The byte
28
- * after the option code is the command; for a server→client request it's SEND.
29
- * After SEND comes an optional list of `VAR <name>` / `USERVAR <name>` entries,
30
- * each name running until the next marker (ESC-escaped bytes pass through).
31
- * A bare SEND with no entries — or only empty names — means "send everything".
32
- */
33
- export declare function parseMnesRequest(subneg: string): MnesRequest;
34
14
  /**
35
15
  * Frame an `IAC SB NEW-ENVIRON IS <marker> <name> VALUE <value> … IAC SE` reply
36
16
  * for the given variables. The returned string is a Latin-1 byte-string ready
37
- * for sendBytes (names/values are ASCII; control bytes are escaped per RFC
38
- * 1572). `marker` selects how each variable name is tagged: `NEW_ENVIRON_VAR`
39
- * (the default — MNES frames every variable as a standard VAR) or
40
- * `NEW_ENVIRON_USERVAR` (plain NEW-ENVIRON frames its client-defined variables
41
- * as USERVAR, matching Mudlet). The two never mix within one reply because the
42
- * client reports a single coherent set per negotiated mode.
17
+ * for sendRaw. `marker` selects how each variable name is tagged:
18
+ * `NEW_ENVIRON_VAR` (the default — MNES frames every variable as a standard
19
+ * VAR) or `NEW_ENVIRON_USERVAR`. An empty list frames an empty IS.
43
20
  */
44
21
  export declare function encodeMnesIs(vars: ReadonlyArray<MnesVar>, marker?: string): string;
45
22
  /** Live client state the NEW-ENVIRON variable set is derived from. Everything
46
23
  * here is something the server can't know on its own — the negotiated encoding,
47
- * the transport's TLS status, the output window's wrap column. */
24
+ * the profile's wrap column, the advertising preferences. */
48
25
  export interface NewEnvironState {
49
26
  /** The active byte→char codec label as reported for the CHARSET variable,
50
27
  * e.g. "UTF-8" or "LATIN-1". */
51
28
  charset: string;
52
29
  /** Whether the live encoding is UTF-8 (drives the UTF-8 capability flag). */
53
30
  utf8: boolean;
54
- /** Whether the link to the game server is TLS-encrypted. True for a direct
55
- * `wss://` connection; false in proxy mode (plaintext upstream telnet). */
56
- tls: boolean;
57
- /** Output window wrap column, or 0 when the grid hasn't been measured yet. */
58
- wrapColumns: number;
31
+ /** Whether the MTTS bitvector carries the MNES bit — Mudlet sets it when the
32
+ * profile has both MNES and NEW-ENVIRON enabled. Defaults to false. */
33
+ mnes?: boolean;
34
+ /** The main console's wrap column — Mudlet's `Host::mWrapAt`, reported as
35
+ * WORD_WRAP. Not the window's column count: a server wrapping to this
36
+ * value produces lines the client then shows unbroken. */
37
+ wordWrap: number;
59
38
  /** Whether the client is advertising screen-reader use (MTTS SCREEN READER
60
39
  * bit, NEW-ENVIRON SCREEN_READER var) — `setConfig("advertiseScreenReader", …)`.
61
40
  * Defaults to false (matching Mudlet's opt-in behaviour). */
@@ -79,34 +58,38 @@ export { CLIENT_NAME, CLIENT_VERSION, TERMINAL_TYPE };
79
58
  * always present; when `extended` is true the broader NEW-ENVIRON capability
80
59
  * set is appended (mirroring Mudlet's `getNewEnvironDataMap`): terminal
81
60
  * capabilities (ANSI, 256_COLORS, TRUECOLOR, UTF-8), transport/security (TLS),
82
- * and layout/accessibility hints (WORD_WRAP, SCREEN_READER). Capabilities mudix
61
+ * and layout/accessibility hints (WORD_WRAP, SCREEN_READER). Capabilities Mudlet Web
83
62
  * doesn't implement are reported honestly as "0" rather than omitted, so a
84
- * server gets a definite answer instead of inferring absence. The caller frames
85
- * the result with VAR (MNES) or USERVAR (NEW-ENVIRON) via encodeMnesIs.
63
+ * server gets a definite answer instead of inferring absence.
64
+ *
65
+ * TLS is "1" always: like the MTTS SSL bit (see computeMtts) it is Mudlet's
66
+ * compiled-in capability, not the state of this link.
86
67
  */
87
68
  export declare function buildNewEnvironVars(state: NewEnvironState, extended: boolean): MnesVar[];
88
- /** MNES names the standard defines that mudix deliberately does not supply.
89
- * They are still *known*, so a server that asks for one is told it is
90
- * undefined rather than left with silence — Mudlet's `isMNESVariable` lists
91
- * IPADDRESS alongside the five it reports, and answers it with a name and no
92
- * VALUE. (A browser tab has no way to learn its own address, and the client is
93
- * not the right party to guess: the server already sees the peer address.) */
94
- export declare const MNES_UNMAINTAINED: ReadonlyArray<string>;
69
+ /** The names MNES defines — Mudlet's `isMNESVariable`. IPADDRESS is among
70
+ * them though no client supplies it (a browser tab cannot learn its own
71
+ * address, and the server already sees the peer), so a request for it is
72
+ * answered "undefined" rather than ignored. */
73
+ export declare const MNES_VARIABLES: ReadonlyArray<string>;
95
74
  /**
96
- * Pick which of the client's `available` variables to report in response to a
97
- * parsed request, mirroring Mudlet's `sendIsMNESValues` /
98
- * `sendIsNewEnvironValues`:
75
+ * Answer a plain NEW-ENVIRON `SEND` the way Mudlet's
76
+ * `cTelnet::sendIsNewEnvironValues` does — one IS reply, possibly empty, or
77
+ * null when the body is not a SEND. Every variable in `available` is a USERVAR
78
+ * (Mudlet defines no VAR of its own while SYSTEMTYPE and USER are opt-in), so:
99
79
  *
100
- * - A bare SEND (no names) asks for everything, and gets it.
101
- * - Named variables come back in request order, each either with its value or
102
- * — for a name in `undefinedNames` — as undefined (no VALUE).
103
- * - A name that is neither is left out entirely.
104
- *
105
- * A request naming only names we do not report therefore selects **nothing**.
106
- * It used to fall back to sending everything on the reasoning that the server
107
- * still learns who we are, but that answers a question nobody asked: a server
108
- * probing for one specific variable gets an unsolicited dump of the whole set,
109
- * which is not what Mudlet does and not what the request meant. The caller
110
- * decides what an empty selection is framed as.
80
+ * - a bare SEND lists them all, in key order;
81
+ * - `USERVAR` with no name lists them all, `VAR` with no name lists none;
82
+ * - `USERVAR <name>` gets its value; `VAR <name>` for one of ours, or either
83
+ * marker with a name we do not define, is echoed back with no VALUE —
84
+ * RFC 1572's "undefined" — rather than dropped.
85
+ */
86
+ export declare function newEnvironIsReply(subneg: string, available: ReadonlyArray<MnesVar>): string | null;
87
+ /**
88
+ * Answer an MNES `SEND` the way Mudlet's `cTelnet::sendIsMNESValues` does, or
89
+ * null when the body is not a SEND. Only VAR separates names here. Each named
90
+ * MNES variable gets an IS reply of its own (IPADDRESS as undefined), a name
91
+ * MNES does not define gets nothing, and a request that ends without a name — a
92
+ * bare SEND, or a trailing empty VAR — is answered with every variable in one
93
+ * reply, after any per-name replies.
111
94
  */
112
- export declare function selectMnesVars(request: MnesRequest, available: ReadonlyArray<MnesVar>, undefinedNames?: ReadonlyArray<string>): MnesVar[];
95
+ export declare function mnesIsReplies(subneg: string, available: ReadonlyArray<MnesVar>): string[] | null;
@@ -1,9 +1,11 @@
1
1
  /**
2
2
  * Frame a Mudlet-style `sendMSDP(variable, ...values)` call as an MSDP
3
3
  * subnegotiation: `IAC SB MSDP MSDP_VAR <variable> [MSDP_VAL <value>]... IAC SE`.
4
- * The returned string is a Latin-1 byte-string ready for sendBytes.
4
+ * The returned string is a Latin-1 byte-string ready for sendBytes. `encode`
5
+ * turns text into the game's bytes — the session's encoding, as desktop
6
+ * writes them; UTF-8 for a caller with no session.
5
7
  */
6
- export declare function encodeMsdp(variable: string, values: string[]): string;
8
+ export declare function encodeMsdp(variable: string, values: string[], encode?: (text: string) => string): string;
7
9
  export interface MsdpEnvelope {
8
10
  /** Top-level MSDP variable name (e.g. "HEALTH", "ROOM"). */
9
11
  path: string;
@@ -12,8 +14,13 @@ export interface MsdpEnvelope {
12
14
  }
13
15
  export interface MsdpStreamOptions {
14
16
  onEnvelope: (payload: MsdpEnvelope) => void;
17
+ /** Byte-string to text under the session's game encoding. Defaults to
18
+ * UTF-8. */
19
+ decode?: (bytes: string) => string;
15
20
  }
16
21
  /** Mirror of createGmcpStream for MSDP subnegotiations. The handler receives a
17
22
  * subnegotiation body whose first byte is the MSDP option code (69); each
18
- * top-level variable is emitted as its own envelope. */
19
- export declare const createMsdpStream: ({ onEnvelope }: MsdpStreamOptions) => (data: string) => void;
23
+ * top-level variable is emitted as its own envelope. A variable the parser
24
+ * dropped as malformed yields no envelope at all, so no arrival event fires
25
+ * for data the game never finished sending. */
26
+ export declare const createMsdpStream: ({ onEnvelope, decode }: MsdpStreamOptions) => (data: string) => void;
@@ -20,8 +20,9 @@ export interface MspCommand {
20
20
  type?: string;
21
21
  }
22
22
  /**
23
- * Stateful MSP parser. Feed each post-telnet-strip chunk through `feed()` and
24
- * render the returned `text` instead of the raw input. Parsed commands are
23
+ * Stateful MSP parser. `feed()` parses `!!SOUND(...)` / `!!MUSIC(...)` tags out
24
+ * of text a script hands to `receiveMSP()` — game text itself is never parsed,
25
+ * as in Mudlet — returning the remaining `text`. Parsed commands are
25
26
  * delivered as `commands`. The parser holds back a partial tag (`!!SOUND(...`
26
27
  * with no closing `)` yet) until the next chunk supplies the rest, so tags
27
28
  * split across WebSocket frames still parse correctly.
@@ -12,14 +12,19 @@ export interface MsspEnvelope {
12
12
  * `MSSP_VAR <name> MSSP_VAL <value>` pairs; names/values are scalar byte runs
13
13
  * terminated by the next control byte. Tolerant of truncation and stray bytes.
14
14
  *
15
- * Mirrors Mudlet's TLuaInterpreter::parseMSSP: scalar string values, and a
16
- * variable with extra `MSSP_VAL` runs keeps only its first value.
15
+ * Mirrors Mudlet's TLuaInterpreter::parseMSSP: scalar string values, a
16
+ * variable with no `MSSP_VAL` is skipped, and a variable with extra `MSSP_VAL`
17
+ * runs keeps only its first value.
17
18
  */
18
- export declare function parseMssp(body: string): MsspEnvelope[];
19
+ export declare function parseMssp(body: string, decode?: (bytes: string) => string): MsspEnvelope[];
19
20
  export interface MsspStreamOptions {
20
21
  onEnvelope: (payload: MsspEnvelope) => void;
22
+ /** Byte-string to text under the session's game encoding. Defaults to
23
+ * UTF-8, which is what a session that negotiated nothing else is reading
24
+ * anyway. */
25
+ decode?: (bytes: string) => string;
21
26
  }
22
27
  /** Mirror of createMsdpStream for MSSP subnegotiations. The handler receives a
23
28
  * subnegotiation body whose first byte is the MSSP option code (70); each
24
29
  * variable is emitted as its own envelope. */
25
- export declare const createMsspStream: ({ onEnvelope }: MsspStreamOptions) => (data: string) => void;
30
+ export declare const createMsspStream: ({ onEnvelope, decode }: MsspStreamOptions) => (data: string) => void;
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Sequence framing for the East Asian multi-byte encodings.
3
+ *
4
+ * The browser can decode GBK, GB18030, Big5, EUC-KR, Shift_JIS and EUC-JP, and this module leans on
5
+ * it to do so — the character tables are enormous and there is no reason to
6
+ * carry a second copy. What it does NOT borrow is the browser's error recovery,
7
+ * because that differs from Mudlet's in ways a MUD player would see:
8
+ *
9
+ * - **How much a bad sequence eats.** Both now put a trail byte that cannot
10
+ * belong to the sequence back onto the stream (`C4 20 5A` under GBK renders
11
+ * as `<?> Z`), but Mudlet consumes a trail that is merely out of range with
12
+ * its lead, and frames GB18030's four-byte form its own way.
13
+ * - **Which bytes count as valid at all.** The two disagree on GBK 0x80, which
14
+ * WHATWG maps to a euro sign and Mudlet rejects, and on EUC-KR 0x7F, which
15
+ * WHATWG passes through as DEL and Mudlet rejects.
16
+ *
17
+ * So the framing here decides where each sequence starts and ends and whether
18
+ * it is valid, using the ranges from `TBuffer::processGBSequence`,
19
+ * `processBig5Sequence` and `processEUC_KRSequence`; a valid sequence is then
20
+ * handed to the browser to map, and an invalid one becomes exactly one
21
+ * replacement character however many bytes it consumed.
22
+ *
23
+ * Input and output are byte-strings (one char per byte), as everywhere else on
24
+ * the inbound path.
25
+ */
26
+ /** The encodings this module frames. UTF-8 is multi-byte too but the browser's
27
+ * handling of it already matches, and it is far too hot a path to re-frame. */
28
+ export type MultiByteLabel = 'gbk' | 'gb18030' | 'big5' | 'euc-kr' | 'shift_jis' | 'euc-jp';
29
+ export declare const MULTI_BYTE_FRAMED: ReadonlySet<string>;
30
+ export declare function isMultiByteFramed(label: string): label is MultiByteLabel;
31
+ export interface FramedDecode {
32
+ /** What the complete sequences in the input decoded to. */
33
+ text: string;
34
+ /** Bytes of a sequence that ran off the end of the input, for the caller to
35
+ * put back in front of the next chunk. Empty unless the input was cut
36
+ * mid-sequence. */
37
+ pending: string;
38
+ }
39
+ /**
40
+ * Decode `byteString` under `label`, framing each sequence the way Mudlet does.
41
+ * Any trailing incomplete sequence comes back as `pending` rather than being
42
+ * decoded or dropped.
43
+ *
44
+ * Some games restyle the right half of a full-width character between its two
45
+ * bytes. Mudlet holds the lead byte over the SGR and decodes the pair whole
46
+ * once its trail arrives, the character keeping the colour it started in; so
47
+ * here the character comes out first and the SGR after it, which the line
48
+ * parser then reads the same way. Any other sequence, or a byte that cannot be
49
+ * the trail, ends the character as a replacement mark in front of it.
50
+ */
51
+ export declare function decodeMultiByte(byteString: string, label: MultiByteLabel): FramedDecode;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Char → bytes for the East Asian multi-byte encodings, the outgoing half of
3
+ * multiByte.ts.
4
+ *
5
+ * The browser decodes GBK, GB18030, Big5 and EUC-KR but will not encode them —
6
+ * TextEncoder writes UTF-8 and nothing else. So the encode tables are built by
7
+ * running every sequence the encoding defines through the browser's own
8
+ * decoder and inverting the result, exactly as the single-byte tables in
9
+ * charset.ts are. That keeps the two directions in agreement by construction
10
+ * and spares carrying a second copy of tables the browser already has.
11
+ *
12
+ * Which sequences get enumerated follows the inbound framing in multiByte.ts
13
+ * (Mudlet's TBuffer ranges), so nothing is written that this client would not
14
+ * itself read back:
15
+ *
16
+ * - **GBK / GB18030**: every lead 0x81–0xFE with every trail 0x40–0xFE bar
17
+ * 0x7F. GB18030 adds its four-byte form — the BMP part enumerated like the
18
+ * pairs, the supplementary planes computed, since they are a straight line.
19
+ * The single byte 0x80, which WHATWG's GBK reads as a euro sign and Mudlet
20
+ * rejects, is never written; € goes out as its pair, A2 E3.
21
+ * - **Big5**: leads 0xA1–0xFE with trails 0x40–0x7E and 0xA1–0xFE. The HKSCS
22
+ * leads below 0xA1 are only written for BIG5-HKSCS; a plain Big5 game has
23
+ * no reading for them, so there a character found only there is unencodable
24
+ * and the send path warns about it. Where one character has two codes, the
25
+ * first wins (as in the WHATWG Big5 encoder, with the same six exceptions
26
+ * that take the last) — but see buildTable for HKSCS's order.
27
+ * - **EUC-KR**: leads and trails 0xA1–0xFE — KS X 1001, which is all Mudlet's
28
+ * framing accepts. The browser's decoder also reads the wider UHC (CP949)
29
+ * range, but a game that declared EUC-KR is not promised to.
30
+ *
31
+ * Output is a byte-string (one char per byte), as the socket layer expects.
32
+ */
33
+ export type MultiByteEncoding = 'gbk' | 'gb18030' | 'big5' | 'big5-hkscs' | 'euc-kr' | 'shift_jis' | 'euc-jp';
34
+ /**
35
+ * The bytes (as a byte-string) that write the single code point `ch` in
36
+ * `encoding`, or null when it has none. ASCII is written as itself. Null also
37
+ * when the browser cannot decode the encoding at all, since then there is no
38
+ * table to build.
39
+ */
40
+ export declare function encodeMultiByteChar(ch: string, encoding: MultiByteEncoding): string | null;
41
+ /** Whether the browser can supply the tables for `encoding` at all. */
42
+ export declare function canBuildMultiByteEncoder(encoding: MultiByteEncoding): boolean;
@@ -8,8 +8,10 @@ export interface MxpLink {
8
8
  start: number;
9
9
  /** End offset into the line's plain text (exclusive). */
10
10
  end: number;
11
- /** `url` → open in a browser tab; `command` → send to the MUD. */
12
- kind: "command" | "url";
11
+ /** `url` → open in a browser tab; `command` → send to the MUD;
12
+ * `prompt` → write it to the command line and leave it there for the
13
+ * player to edit and submit (a SEND carrying the PROMPT flag). */
14
+ kind: "command" | "url" | "prompt";
13
15
  /** The single command or URL fired on left-click. */
14
16
  payload: string;
15
17
  /** Tooltip / title text. */
@@ -20,6 +22,9 @@ export interface MxpLink {
20
22
  cmds: string[];
21
23
  hints: string[];
22
24
  };
25
+ /** The link's id in the parser's link store; a click asks
26
+ * {@link MxpParser.isLinkLive} with it whether an `<EXPIRE>` retired it. */
27
+ id: number;
23
28
  }
24
29
  /** A `<FRAME>` window-lifecycle command the parser surfaces to the session.
25
30
  * The parser is session-free, so it only reports the request; the consumer
@@ -77,13 +82,36 @@ export interface MxpLineResult {
77
82
  * SoundManager path as MSP. Omitted when none. */
78
83
  sounds?: MspCommand[];
79
84
  }
85
+ /** Cap on a held partial escape sequence. Beyond this it was never a real one,
86
+ * so it is dropped rather than swallowing the rest of the stream. */
87
+ /** Whether an `<A>` may open `href`. The game chooses the address, so only
88
+ * web and mail schemes reach the opener, as other schemes (`file:`, a
89
+ * program's own like `steam:`, `javascript:`) can launch local programs or run
90
+ * in this page; a scheme-less address opens nothing
91
+ * (TMxpLinkTagHandler::actionFor). */
92
+ export declare function mxpLinkOpens(href: string): boolean;
93
+ /** The address an `<A>` to `href` opens, or `""` when it opens nothing (see
94
+ * {@link mxpLinkOpens}). A mail address keeps only its recipients and its
95
+ * `subject` and `body` fields: mail clients attach the local files an
96
+ * `attach`/`attachment` field names, and the game chose them. The fragment
97
+ * goes with the rest, so `#?attachment=` cannot smuggle one past the check
98
+ * (TMxpLinkTagHandler::openableAddress). */
99
+ export declare function mxpOpenableAddress(href: string): string;
80
100
  export declare class MxpParser {
81
101
  private readonly opts;
82
102
  private elements;
103
+ /** The custom elements whose definitions are running right now, innermost
104
+ * last — TMxpCustomElementTagHandler's `mElementsBeingExpanded`. See
105
+ * {@link mayExpand}. */
106
+ private readonly expanding;
83
107
  private entities;
84
108
  private lineMode;
109
+ /** Mudlet's mMXP_DEFAULT — the mode a newline returns to. Null is OPEN,
110
+ * the initial default. */
85
111
  private lockedMode;
86
- private tempSecure;
112
+ /** TMxpProcessor's mModeBeforeTempSecure: what an `ESC[4z` line goes back
113
+ * to once its one tag is read. */
114
+ private modeBeforeTempSecure;
87
115
  private stack;
88
116
  /** Active MXP `<COLOR>`/`<FONT>` fg/bg overrides, innermost last. While
89
117
  * non-empty, the top entry's colours are painted over whatever the ANSI
@@ -105,6 +133,20 @@ export declare class MxpParser {
105
133
  /** OSC 8 preset definitions seen this session (shared with the ANSI path
106
134
  * when the engine supplies a registry). */
107
135
  private presets;
136
+ /** Set while Force MXP is on: a secure default then holds against a lock
137
+ * to OPEN or LOCKED, the game's `ESC[5z`/`ESC[7z` and the open start a
138
+ * switch-on asks for included — Mudlet's shouldLockModeToSecure. */
139
+ private forcedSecure;
140
+ /** Id of the newest link; ids are never reused, so a click on a link long
141
+ * gone from the store still finds nothing rather than someone else's. */
142
+ private linkSeq;
143
+ /** The newest link and the Lua its click runs — what a custom element's
144
+ * `mxp.<element>.actions` reports (TLinkStore::getCurrentLinks). Emptied
145
+ * when an `<EXPIRE>` retires it. */
146
+ private currentLink;
147
+ /** Every link made with an `EXPIRE` name, oldest first: the name while it
148
+ * is live, null once an `<EXPIRE>` has retired it. */
149
+ private expiringLinks;
108
150
  private fmt;
109
151
  private out;
110
152
  private run;
@@ -124,20 +166,45 @@ export declare class MxpParser {
124
166
  presets?: HyperlinkPresetRegistry;
125
167
  /** Fired whenever a server-defined custom element is used, with the
126
168
  * tag's attributes resolved the way Mudlet resolves them (see
127
- * {@link elementEventAttrs}). Backs the Lua `mxp` table. */
128
- onElementEvent?: (name: string, attrs: Record<string, string>) => void;
169
+ * {@link elementEventAttrs}). Backs the Lua `mxp` table. `body` is
170
+ * carried by the tags that wrap text and act on it — a `<SEND>` reports
171
+ * the text it wrapped and the commands its click would run. */
172
+ onElementEvent?: (name: string, attrs: Record<string, string>, body?: {
173
+ text: string;
174
+ actions: string[];
175
+ }) => void;
176
+ /** Carry out a `<FRAME>` as it is read, answering whether it could be:
177
+ * false leaves the tag in the line as text, which is what a game sees
178
+ * when it names a frame that is not open or a name that is not a plain
179
+ * word. Without this the commands are collected into the result for a
180
+ * caller to run afterwards, which cannot report a refusal in time. */
181
+ onFrame?: (frame: MxpFrameCommand) => boolean;
182
+ /** Whether a frame of this name is open for a `<DEST>` to write into.
183
+ * Text sent to one that is not stays where it was, in the main line
184
+ * (Mudlet leaves it in the line it was building when the frame has no
185
+ * sink). Without this every `<DEST>` is redirected and the caller
186
+ * decides afterwards. */
187
+ hasFrame?: (name: string) => boolean;
129
188
  /** Columns the main window wraps at — how wide `<HR>` draws its rule.
130
189
  * Mudlet's `TMxpClient::getWrapWidth`, whose own fallback is 80. */
131
190
  wrapWidth?: () => number;
132
191
  });
133
192
  /**
134
- * Lock the parser to secure line mode (or release the lock). Mudlet does
135
- * this whenever the MXP processor is forced on without an option-91
136
- * handshake (ctelnet.cpp: MXP_MODE_CODE_LOCK_SECURE): such servers are
137
- * IRE-style and never send mode switches, they just use secure tags — and
138
- * without the lock every definition tag would be ignored as unsafe.
193
+ * Whether Force MXP is on — TMxpMudlet::shouldLockModeToSecure, read live.
194
+ * While it is, a secure default holds against any lock to OPEN or LOCKED,
195
+ * the game's `ESC[5z`/`7z` included. It changes no mode by itself: forcing
196
+ * the processor on is what locks it secure ({@link applyMode} with 6), and
197
+ * that secure default outlives the box being unticked.
139
198
  */
140
- lockSecureMode(locked: boolean): void;
199
+ setForceLock(on: boolean): void;
200
+ /** Apply mode code `n` (TMxpProcessor::setMode) from the client's side:
201
+ * 6 when the processor is forced on or auto-enabled, 5 each time the game
202
+ * switches MXP on, which starts it in open mode. */
203
+ applyMode(n: number): void;
204
+ /** Whether a link is still there to click: false once an `<EXPIRE>` has
205
+ * retired the name it was made with (TLinkStore::expireLinks), when a
206
+ * click on it runs nothing. */
207
+ isLinkLive(id: number): boolean;
141
208
  /** Clear all cross-line state. Called on (re)connect so a new session starts
142
209
  * with no leftover definitions, open tags, or modes. */
143
210
  reset(): void;
@@ -152,16 +219,88 @@ export declare class MxpParser {
152
219
  * mode that capture ended on, and the next real tag would be discarded as
153
220
  * unsafe. */
154
221
  parseLine(rawLine: string, baseSnapshot?: FormatStateSnapshot, fromServer?: boolean): MxpLineResult;
222
+ /**
223
+ * The styling MXP tags still hold open: the colour of the innermost open
224
+ * `<COLOR>`/`<FONT>`, and bold, italic, underline and strikeout while a tag
225
+ * of that kind is open. Desktop keeps these in TMxpMudlet, apart from the
226
+ * ANSI pen, and TBuffer paints them on every character it writes — whether
227
+ * or not MXP is still on, so a game that turns MXP off with a tag left open
228
+ * goes on showing it until MXP is reset. Undefined when nothing is open.
229
+ */
230
+ openStyle(): FormatStateSnapshot | undefined;
155
231
  private effectiveMode;
156
232
  private resetTransientMode;
233
+ /** Take off the styling open tags put on — bold, italic, underline,
234
+ * strikeout and colour — when the mode moves away from OPEN, the way
235
+ * Mudlet's resetTextProperties drops its counters and colour stacks.
236
+ * Links and variables are left running: that call does not touch them. */
237
+ private closeOpenModeTags;
238
+ /** Add text to the line. `markup` marks text that is markup put back —
239
+ * a tag that could not be acted on, shown as what it was — which the
240
+ * links open around it do not count as the text they wrap (Mudlet inserts
241
+ * such a tag straight into the line, past the handlers' handleContent). */
157
242
  private appendText;
243
+ /** `CSI n C` (cursor forward): n spaces painted in the background colour,
244
+ * as TBuffer writes them (see cursorForwardCount). They go straight into
245
+ * the line, past any open link's content, the way Mudlet appends them to
246
+ * mMudLine without the MXP handlers seeing them. */
247
+ private appendCursorForward;
158
248
  private flushRun;
159
249
  private parseFragment;
160
250
  private applyLineMode;
251
+ /** The style id a game named with `<VERSION styleId>`, stamped onto every
252
+ * later VERSION answer. Nothing takes it back off — an empty attribute is
253
+ * dropped by the parser before it gets here, so `<VERSION "">` is just a
254
+ * bare VERSION — and it lasts as long as the session that set it. */
255
+ private mxpStyle;
161
256
  private closeAllTags;
257
+ /** `mapValue`, when given, is applied to every attribute once the tag has
258
+ * been read — how a custom element's values reach the tags of its
259
+ * definition. Filling them in before the read would let a value with a
260
+ * quote in it end the attribute it was put in and write attributes of its
261
+ * own. */
162
262
  private handleTag;
263
+ /** A tag the current line mode does not allow is shown to the player as
264
+ * the text it literally is, brackets and all — Mudlet re-inserts the raw
265
+ * tag content the same way (HANDLER_INSERT_ENTITY_SYS). Swallowing it
266
+ * instead would hide half a game's output on an OPEN line and leave the
267
+ * other half — the text the tag wrapped — with no explanation. */
268
+ private showAsText;
269
+ private isKnownTag;
270
+ /** Whether Mudlet would recognise a tag (its trimmed raw text) as MXP —
271
+ * the definitions it lists in allMxpTags, or a known element, open or
272
+ * closing. What it does not recognise it rejects as text before the
273
+ * temp-secure mode is spent. */
274
+ private isRecognisedTag;
163
275
  private openAllowed;
164
276
  private handleOpenTag;
277
+ /** Hand a finished `<SEND>` to Lua the way Mudlet does: the `mxp.send`
278
+ * table and an `mxp.send` event, carrying the tag's attributes, the text it
279
+ * wrapped, and the Lua each of its commands would run — `send(…)`, or
280
+ * `printCmdLine(…)` for a PROMPT, the command quoted by
281
+ * {@link quoteLuaLiteral}. Queued on the closing tag because
282
+ * until then the caption is not known, and the caption is what `&text;`
283
+ * resolves to in every one of those (TMxpMudlet::setCaptionForSendEvent).
284
+ *
285
+ * A script reads this to act on a link the game drew — to relabel it, to
286
+ * run something of its own alongside it, or to count what a shop offered.
287
+ * The command list is reported whole even where the click can only fire
288
+ * the first of them. */
289
+ private reportSend;
290
+ /** `<SUPPORT>` asks what this client can do. Bare, it lists everything;
291
+ * named, it answers about exactly what was asked, in the order it was asked
292
+ * — `element` for the whole element and its attributes, `element.attribute`
293
+ * for one of them, `element.*` for the whole element again, and a leading
294
+ * minus for anything not here. A game reads this to decide which of its
295
+ * markup to send, so answering about something we do not do would cost it
296
+ * the fallback it has for clients that lack it. */
297
+ private answerSupport;
298
+ /** `<VERSION>` asks who this client is; `<VERSION styleId>` instead names a
299
+ * style the game wants its answers stamped with from then on, and is not
300
+ * answered at all. MXP=1.0 is the protocol version we speak; CLIENT and
301
+ * VERSION are our own identity (see src/version.ts). Unquoted, as Mudlet
302
+ * sends it — a game's parser may be no more than a split on spaces. */
303
+ private answerVersion;
165
304
  /** `<FRAME name [action] [internal|external|floating] [left|top|width|height]
166
305
  * [scrolling] [title]>` — record a window create/close request for the
167
306
  * consumer. NAME is the first positional or the NAME attribute; valueless
@@ -169,8 +308,10 @@ export declare class MxpParser {
169
308
  private handleFrameTag;
170
309
  /** `<DEST name [eol] [eof]>` — start redirecting enclosed text into `name`.
171
310
  * NAME is the NAME attribute or the first non-flag positional. Persists
172
- * until `</DEST>` (or end of line). A nameless DEST is ignored so its text
173
- * renders inline, matching Mudlet (setMxpDestination fails → not handled). */
311
+ * until `</DEST>` (or end of line). A nameless DEST is a tag Mudlet cannot
312
+ * act on, and is shown as text; one naming a frame that is not open is
313
+ * taken out, but its text stays in the line it was part of — Mudlet keeps
314
+ * building the main line when the destination has no sink to flush to. */
174
315
  private handleDestTag;
175
316
  /** `<SOUND fname [V=vol] [L=loops] [P=priority] [T=type] [U=url]>` and
176
317
  * `<MUSIC fname [V=vol] [L=loops] [C=continue] [T=type] [U=url]>` — MXP's
@@ -185,14 +326,52 @@ export declare class MxpParser {
185
326
  private openFormat;
186
327
  private openColor;
187
328
  private openLink;
329
+ /** The Lua each of a link's commands runs, `&text;` filled with `text`
330
+ * before the command is quoted, so nothing the game wrote in either can
331
+ * end the string it is put in (TMxpSendTagHandler::actionFor). */
332
+ private linkActions;
333
+ /** Record a new link as the newest — TLinkStore::addLinks. */
334
+ private storeLink;
335
+ /** `<EXPIRE name>`: the links made with that name stop working, and if the
336
+ * newest is one of them there is no newest link left to report
337
+ * (TLinkStore::expireLinks removes them from the store outright). */
338
+ private expireLinks;
339
+ /** Replace `&name;` with the game's entity of that name, or a built-in
340
+ * one; anything that names neither is left as it was (TEntityResolver's
341
+ * interpolate) — which is what keeps `&text;` for the close to fill. */
342
+ private interpolateEntities;
188
343
  private openVar;
189
344
  private handleCloseTag;
345
+ /** TMxpCustomElementTagHandler::mayExpand: a game can define an element
346
+ * that expands to itself, directly or through other elements, or a chain
347
+ * of elements long enough to exhaust the stack. An element already being
348
+ * expanded, or one past {@link MAX_ELEMENT_EXPANSION_DEPTH} of them, is
349
+ * handled without running its definition. */
350
+ private mayExpand;
190
351
  private finalizeTag;
352
+ /** A `<!…>` definition. False when it is not one Mudlet can act on — an
353
+ * element with nothing after its name, an entity with no name — which is
354
+ * then shown as the text it is. */
191
355
  private handleDefinition;
192
356
  private defineElement;
193
357
  private defineEntity;
194
358
  private expandElement;
195
- private substituteTemplate;
359
+ /** `&att;` → the value the tag gave that attribute, by name or by the
360
+ * position the definition declared it at, else its default; anything else
361
+ * is left alone for the entity pass (TMxpCustomElementTagHandler's
362
+ * mapAttributes). */
363
+ private elementValues;
364
+ /** Run a definition's markup. Its tags are read first and filled in after,
365
+ * attribute by attribute, so a value cannot rewrite the tag it lands in:
366
+ * a quote in it stays in the value. The text between them is filled in
367
+ * and read as the game's own. Per the MXP spec a definition holds only
368
+ * opening tags, so a closing tag in one is skipped, as
369
+ * TMxpCustomElementTagHandler::handleStartTag skips it — `'<B>x</B>'`
370
+ * leaves its element bold until the element itself is closed. */
371
+ private runTemplate;
372
+ /** What `&ent;` stands for, or null when it names nothing. A game's
373
+ * entities are kept under their lowercased names, as Mudlet's
374
+ * registerEntity keeps them. */
196
375
  private decodeEntity;
197
376
  }
198
377
  /** Split a parsed MXP line into one entry per *visual* line. MXP `<BR>` tags