@mudlet/mudlet-web 0.5.0 → 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.
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 +22 -14
  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
@@ -1,4 +1,6 @@
1
- import type { TriggerNode } from '../../storage/schema';
1
+ import type { TriggerNode, TriggerPattern } from '../../storage/schema';
2
+ import { ItemIdSequence } from '../ItemIdSequence';
3
+ import type { RgbColor } from '../text/FormatState';
2
4
  export type { TriggerNode };
3
5
  type Capture = string | undefined;
4
6
  type TempFn = (matches: Capture[], spans?: {
@@ -30,11 +32,47 @@ export type TriggerMatch = {
30
32
  captures: Capture[];
31
33
  matchedText: string;
32
34
  multimatches?: Capture[][];
35
+ /** Named captures per multimatches row, aligned with it. */
36
+ multiNamedGroups?: (Record<string, string> | undefined)[];
33
37
  namedGroups?: Record<string, string>;
34
38
  captureSpans?: CaptureSpan[];
35
39
  namedSpans?: Record<string, CaptureSpan>;
36
40
  matchStart?: number;
41
+ groupCount?: number;
42
+ /** See MatchResult.wholeMatchSkipped. */
43
+ wholeMatchSkipped?: boolean[];
44
+ /** See MatchResult.positionsInCurrentColumns. */
45
+ positionsInCurrentColumns?: boolean;
46
+ /** No capture groups were set for this fire: the script's `matches` is
47
+ * left empty rather than built from `matchedText`/`captures`. True for a
48
+ * Lua-function or prompt match and for a fire-length (stay-open) line,
49
+ * which desktop runs through a bare `execute()`. */
50
+ captureless?: boolean;
37
51
  };
52
+ /**
53
+ * A colorizer trigger's stored colour (`mFgColor`/`mBgColor`) as desktop reads
54
+ * it: QColor::fromString, so a colour name, `#rgb`, `#aarrggbb` and the 9- and
55
+ * 12-digit forms paint as well as `#rrggbb` does. Null for a string QColor
56
+ * calls invalid, which leaves that side of the text as it was.
57
+ */
58
+ export declare function highlightColor(spec: string): RgbColor | null;
59
+ /**
60
+ * What a trigger's built-in highlight paints, given the `matches` list its
61
+ * script is handed (whole match first) and the spans the engine reported.
62
+ *
63
+ * Mudlet walks the whole flattened capture list — {whole, groups…} per
64
+ * occurrence — and paints each entry EXCEPT the whole-match ones, but only when
65
+ * there is more than one entry to choose from: `position %
66
+ * numberOfCaptureGroups != 1`, 1-based, in TTrigger::processRegexMatch. With one
67
+ * entry per occurrence the modulus is 1 and nothing is skipped, which is what
68
+ * makes a match-all substring paint all of its hits. A capture-less match
69
+ * (empty `matches`) paints nothing. `span` is absent only for a matcher that
70
+ * reports no position, which the caller falls back to finding by text.
71
+ */
72
+ export declare function highlightTargets(matches: readonly Capture[], matchStart: number | undefined, captureSpans: readonly CaptureSpan[] | undefined, groupCount: number | undefined, wholeMatchSkipped?: readonly boolean[]): {
73
+ text: string;
74
+ span?: CaptureSpan;
75
+ }[];
38
76
  /** The lineage a trigger created mid-pass belongs to, and how many generations
39
77
  * deep it sits in it. Absent on a trigger that was not created while a line was
40
78
  * being processed. See TriggerEngine.addedWhileProcessing. */
@@ -44,15 +82,69 @@ interface SameLineChain {
44
82
  }
45
83
  /** What a caller can tell the engine about a temp trigger beyond its pattern. */
46
84
  export interface TempOptions {
47
- /** As the runaway report names it. Mudlet uses the trigger's id when the
48
- * call carried no name of its own. */
85
+ /** The id to file it under, drawn by the caller from the profile's shared
86
+ * sequence. The engine draws its own when absent. */
87
+ id?: number;
88
+ /** As exists()/killTrigger() and the runaway report know it. Mudlet uses
89
+ * the trigger's id when the call carried no name of its own. */
49
90
  name?: string;
50
91
  onStopped?: () => void;
92
+ /** See TempEntryBase.onFree. */
93
+ onFree?: () => void;
94
+ /** See TempEntryBase.uncompiled. */
95
+ uncompiled?: boolean;
96
+ /** A further condition the line has to meet once the pattern matched —
97
+ * a colour trigger's colour, which the engine cannot see. A line that
98
+ * fails it is a line the trigger did NOT match, so a stay-open window
99
+ * (keepFiring) still fires on it. */
100
+ accept?: () => boolean;
51
101
  }
102
+ /**
103
+ * Why `pattern` will not compile, in the words of desktop's
104
+ * perlRegexCompileError (TLuaInterpreterMudletObjects.cpp) — `regex pattern
105
+ * "<p>" failed to compile at offset <n>: <reason>` — or null when it compiles.
106
+ * The creators (tempRegexTrigger, tempAlias, ...) refuse such a pattern rather
107
+ * than make an item that can never match. `forTrigger` drops the newlines
108
+ * first, as TTrigger::setRegexCodeList does before compiling (an alias keeps
109
+ * them). The offset is reported in UTF-8 bytes, as desktop's 8-bit PCRE2 does;
110
+ * the build here counts UTF-16 units past the prepended verbs. Null too while
111
+ * PCRE is still loading: nothing can be judged yet, and the engine reports a
112
+ * bad pattern once it compiles it.
113
+ */
114
+ export declare function perlRegexCompileError(pattern: string, forTrigger: boolean): string | null;
115
+ /**
116
+ * Why a perl pattern will not compile, as PCRE2 words it — or null when it
117
+ * does, or while PCRE is still loading and nothing can be said. Compiled as
118
+ * the engines compile triggers and aliases, `(*UTF)(*UCP)` included.
119
+ */
120
+ export declare function perlPatternError(pattern: string): string | null;
121
+ /** What is wrong with a colour pattern, in TTrigger::setRegexCodeList's two
122
+ * cases: it asks for no colour at all, or for one no palette has. */
123
+ export declare function colorPatternProblem(text: string): 'noColors' | 'noMatch' | null;
52
124
  export declare class TriggerEngine {
125
+ /** Every temporary trigger, by the id the script was handed — the
126
+ * temporary half of desktop's one mTriggerMap. Insertion order is
127
+ * creation order (Map), which is id order too. */
53
128
  private readonly temp;
54
- /** Key for this engine's own temp map — see PatternEngine.nextInternalId. */
55
- private nextInternalId;
129
+ /** The same entries by their tree key (`temp:<id>`). */
130
+ private readonly tempByKey;
131
+ /** Temp trigger ids, shared with every other engine in the profile — see
132
+ * ItemIdSequence. A bare engine (unit tests) draws from its own. */
133
+ private idSeq;
134
+ setIdSequence(seq: ItemIdSequence): void;
135
+ /** The store's trigger list and blocked set as the last loadPerm was given
136
+ * them, so a complex temp trigger can be compiled into the same tree
137
+ * without the store being involved. */
138
+ private storeItems;
139
+ private storeBlocked;
140
+ /** Whether loadPerm has run (PCRE is ready by then): a complex temp trigger
141
+ * made before it is compiled by that first load instead. */
142
+ private permLoaded;
143
+ /** Tree keys of freed temp triggers that had permanent children: the owner
144
+ * of the store removes those subtrees (see takeOrphanedParents). */
145
+ private orphanedParents;
146
+ /** Called when a temp trigger with permanent children has been freed. */
147
+ private onOrphans;
56
148
  private inProcessTemp;
57
149
  private permCompiled;
58
150
  private allById;
@@ -76,21 +168,79 @@ export declare class TriggerEngine {
76
168
  private lastRunawayReportAt;
77
169
  private cache;
78
170
  private lineCounter;
79
- private readonly chainOpenUntil;
171
+ /** What the line being walked has established so far — see PassState. A
172
+ * nested pass (a trigger calling feedTriggers) has its own, and the outer
173
+ * one's is put back when it returns. */
174
+ private pass;
80
175
  private hasChildren;
176
+ /**
177
+ * IDs whose OWN switch is on (and that can be active at all). An
178
+ * ancestor's state is not folded in: desktop checks each trigger's
179
+ * `isActive()` once, when its parent's `match()` reaches it, so a parent
180
+ * disabled by one of its children's scripts still hands the line to the
181
+ * rest of them (see PassState.active).
182
+ *
183
+ * Enabled-ness is checked on each node as the walk reaches it, rather than
184
+ * by leaving disabled triggers out of the processing list, so a trigger
185
+ * switched on by another trigger's script gets a look at the same line
186
+ * (mudlet-web#156). Filtering the list instead meant the enable was only
187
+ * visible from the NEXT line, because the pass walks a snapshot.
188
+ */
189
+ private selfEnabledIds;
190
+ /** What the last {@link loadPerm} was told cannot be active (code that will
191
+ * not compile), so {@link updateEnabled} keeps them out too. */
192
+ private blocked;
193
+ /** Triggers with a pattern that failed to compile, as of the last loadPerm. */
194
+ private invalidPatterns;
81
195
  private andStates;
82
- /** Triggers still firing on their own after completing, and the match they
83
- * re-report while they do. See the fire-length branch in matchPermEntryOnce. */
196
+ /** Triggers still firing on their own after completing (or after
197
+ * setTriggerStayOpen), and how many more lines they do it for. See
198
+ * applyFireLength. */
84
199
  private keepFiring;
200
+ /**
201
+ * The stay-open state a single-line match left its trigger in, to be put
202
+ * back once that match's script has run. Desktop runs a single-line
203
+ * trigger's script from inside the pattern test and only then assigns
204
+ * `mKeepFiring = mStayOpen` (src/TTrigger.cpp:995-999), so a trigger that
205
+ * calls setTriggerStayOpen on ITSELF has the call overwritten and does not
206
+ * keep firing; opening another trigger's window is unaffected. Mudlet Web
207
+ * does the bookkeeping before the script runs, so {@link execPerm} restores
208
+ * it afterwards (mudlet-web#238).
209
+ */
210
+ private readonly stayOpenAfterScript;
211
+ /** How many times {@link setStayOpen} has been called on each trigger —
212
+ * desktop's `mStayOpenSetsByScript`. A script that sets its own trigger's
213
+ * window while it runs has the last word over the fire length its match
214
+ * would otherwise put back. */
215
+ private readonly stayOpenSets;
85
216
  private filterActiveText;
86
- /** Every offering a filter makes to its children this line: one per
87
- * capture group, or the whole match when it has none. See openChain. */
217
+ /** Every offering a filter makes to its children this line — see openChain.
218
+ * Empty means "matched, but there is nothing to hand down", which on
219
+ * desktop keeps the children out of the line entirely. */
88
220
  private filterCaptures;
221
+ /** The line each filter's offering in {@link filterCaptures} was made for.
222
+ * A filter only stands between its children and the line on the line it
223
+ * MATCHED: when the chain is merely being held open by the fire length,
224
+ * desktop reaches the children from the `mKeepFiring` branch of
225
+ * `TTrigger::match` (src/TTrigger.cpp:1083-1093), which passes the
226
+ * unfiltered haystack straight down. Without this the children kept
227
+ * matching against a capture from an earlier line (mudlet-web#160). */
228
+ private filterOfferLine;
89
229
  private filterActiveOffset;
230
+ /** Filters whose offerings this line are in the line's current columns
231
+ * rather than the ones it arrived with: a colour filter's, and any filter
232
+ * under one (TTrigger::filter's positionsInCurrentColumns). */
233
+ private filterCurrentColumns;
90
234
  /** Resolves once PCRE wasm is initialized and patterns can be compiled. */
91
235
  static ready(): Promise<void>;
92
- /** Number of live session-scoped temp triggers (Mudlet `getProfileStats` temp count). */
236
+ /** Temp triggers in the tree — killed ones too, until the deferred cleanup
237
+ * frees them: desktop's getProfileStats walks the live root list
238
+ * unfiltered (Host::assembleReport), so a killed trigger still counts
239
+ * until doCleanup() deletes it. */
93
240
  get tempCount(): number;
241
+ /** Patterns the temp triggers carry, for getProfileStats' pattern tally: one
242
+ * per simple temp trigger, a complex one's own list. */
243
+ get tempPatternCount(): number;
94
244
  /**
95
245
  * Register a temp trigger. `kind` selects the match strategy:
96
246
  * - `'regex'` — PCRE, same syntax as permanent triggers (Mudlet
@@ -109,22 +259,153 @@ export declare class TriggerEngine {
109
259
  * `tempExactMatchTrigger`). Callback receives `[line]`.
110
260
  * - `'prompt'` — fires on every line the server flags as a prompt
111
261
  * (Mudlet `tempPromptTrigger`); `pattern` is ignored.
112
- * Callback receives `[line]`.
113
- * Invalid regex patterns return a no-op disposer so callers don't need
114
- * to special-case compile failures.
262
+ * Callback receives `[]` — match_prompt sets no
263
+ * capture groups.
264
+ * - `'none'` — never fires: the trigger an empty pattern makes once
265
+ * Mudlet has compacted the blank away.
266
+ * An invalid regex still makes the trigger — numbered, findable, killable —
267
+ * but one that never fires, as desktop leaves a trigger whose pattern
268
+ * failed to compile in place. Returns a disposer that removes it at once.
115
269
  */
116
- addTemp(pattern: string, fn: TempFn, kind?: 'regex' | 'substring' | 'startOfLine' | 'exactMatch' | 'prompt', opts?: TempOptions): () => void;
270
+ addTemp(pattern: string, fn: TempFn, kind?: 'regex' | 'substring' | 'startOfLine' | 'exactMatch' | 'prompt' | 'none', opts?: TempOptions): () => void;
271
+ /** {@link addTemp}, handing back the trigger's id rather than a disposer. */
272
+ createTemp(pattern: string, fn: TempFn, kind?: 'regex' | 'substring' | 'startOfLine' | 'exactMatch' | 'prompt' | 'none', opts?: TempOptions): number;
117
273
  /**
118
274
  * Mudlet `tempLineTrigger(from, howMany, fn)`. A position-based trigger with
119
275
  * no pattern: it fires `fn([lineText])` on `howMany` consecutive lines,
120
- * starting `from` lines ahead (`from = 1` → the next line). It self-expires
121
- * after the last fire. When created from within a handler, the line on which
122
- * it was created is skipped (see `inProcessTemp`/`skipFirst`) so `from`
123
- * counts from the next line in every creation context. Returns a disposer
124
- * for early cancellation.
276
+ * after skipping `from` of them (`from = 0` → the first line it sees). It
277
+ * self-expires after the last fire. Returns a disposer for early
278
+ * cancellation.
279
+ */
280
+ addTempLine(from: number, howMany: number, fn: TempFn, opts?: TempOptions): () => void;
281
+ /** {@link addTempLine}, handing back the trigger's id. */
282
+ createTempLine(from: number, howMany: number, fn: TempFn, opts?: TempOptions): number;
283
+ /**
284
+ * Mudlet `tempComplexRegexTrigger`: a temporary trigger with everything a
285
+ * permanent one can have — an AND chain across lines, a filter, a fire
286
+ * length, a line delta, colour patterns, a highlight. It is compiled and
287
+ * walked exactly like a permanent trigger, from a node the engine holds
288
+ * itself rather than one in the store, and fires through the same `exec`
289
+ * the permanent ones do (its `code` is the caller's dispatch stub).
290
+ * `node.id` and `parentId` are the engine's to set.
291
+ */
292
+ createTempComplex(node: Omit<TriggerNode, 'id' | 'parentId' | 'enabled'>, opts?: TempOptions): number;
293
+ private tempBase;
294
+ private insertTemp;
295
+ /** Rebuild the compiled tree from the store's last list plus the complex
296
+ * temp triggers — after one of those came or went. */
297
+ private recompile;
298
+ /**
299
+ * Take a temp trigger out of the tree now. Its permanent children, if it
300
+ * has any, are left orphaned in the store for its owner to remove (see
301
+ * {@link takeOrphanedParents}); until then nothing reaches them.
302
+ */
303
+ removeTemp(id: number): void;
304
+ private release;
305
+ /**
306
+ * Mudlet `killTrigger` on a temp trigger: it stops firing at once — for the
307
+ * rest of the line being walked too — and is queued for the deferred
308
+ * cleanup (TriggerUnit::markCleanup), which frees it with its whole subtree.
309
+ * False for an unknown id or one already waiting to be freed.
310
+ */
311
+ killTemp(id: number): boolean;
312
+ /** Mudlet `killTrigger(name)` for the temporaries: the newest live temp
313
+ * trigger carrying the name (TriggerUnit::killTrigger walks the lookup
314
+ * table, newest first, skipping permanent items and corpses). */
315
+ killTempByName(name: string): boolean;
316
+ /**
317
+ * Free every temp trigger killed since the last call — desktop's
318
+ * TriggerUnit::doCleanup, which runs once no line is being processed.
319
+ * The engine runs it itself as the outermost pass ends; the owner runs it
320
+ * at the other points desktop does (after a batch, after a timer).
321
+ */
322
+ reapKilled(): void;
323
+ /** The tree keys of freed temp triggers that had permanent children, since
324
+ * the last call. Their owner removes those subtrees from the store, as
325
+ * desktop's ~TTrigger deletes its children with it. */
326
+ takeOrphanedParents(): string[];
327
+ /** Told when {@link takeOrphanedParents} has something to hand over. */
328
+ setOrphanListener(fn: (() => void) | null): void;
329
+ /** Whether a temp trigger with this id is in the tree, killed or not. */
330
+ hasTemp(id: number): boolean;
331
+ /** Whether a temp trigger with this id is in the tree and not killed — what
332
+ * exists() counts (TriggerUnit::pendingDeletion). */
333
+ hasLiveTemp(id: number): boolean;
334
+ /** Whether a live temp trigger is switched on and able to fire — isActive(). */
335
+ tempIsActive(id: number): boolean;
336
+ /** A live temp trigger's name, or null. */
337
+ tempName(id: number): string | null;
338
+ /** A temp trigger's patterns (its node's), or null for an unknown id. */
339
+ tempPatterns(id: number): TriggerPattern[] | null;
340
+ /** Live temp trigger ids, ascending, whose name passes `test`. */
341
+ liveTempIds(test: (name: string) => boolean): number[];
342
+ /**
343
+ * The newest temp trigger carrying `name` — desktop's findTrigger, a
344
+ * QMultiMap lookup whose newest entry comes first. `includeDead` keeps one
345
+ * waiting for cleanup in the running, as findTrigger does (perm* parent
346
+ * resolution); killTrigger and friends skip it.
347
+ */
348
+ newestTempByName(name: string, includeDead: boolean): number | null;
349
+ /** enableTrigger/disableTrigger on a temp trigger by id. False for an
350
+ * unknown id or a killed one — re-enabling a corpse would resurrect it. */
351
+ setTempEnabled(id: number, enabled: boolean): boolean;
352
+ /** Whether the temp trigger behind a tree key can let a line through: in
353
+ * the tree, not killed, switched on, compiled. False for a freed one. */
354
+ private tempKeyActive;
355
+ /** `isActive()` of a tree node as the walk reads it: a temp trigger's own
356
+ * state, or a permanent trigger's switch (see selfEnabledIds). */
357
+ private isSelfEnabled;
358
+ /**
359
+ * Give the profile's saved triggers their place in the firing order without
360
+ * compiling them. Desktop builds every permanent trigger from the profile
361
+ * XML before any script runs, so a temp trigger a script creates at load
362
+ * time sorts after them. Triggers can't be compiled here until PCRE is
363
+ * ready — which is after the scripts have run — so the engine calls this
364
+ * first and the later {@link loadPerm} reuses the seqs reserved here.
125
365
  */
126
- addTempLine(from: number, howMany: number, fn: TempFn): () => void;
127
- loadPerm(items: TriggerNode[]): void;
366
+ reserveOrder(items: readonly {
367
+ id: string;
368
+ }[]): void;
369
+ /**
370
+ * Mudlet `TriggerUnit::reorderTriggersAfterPackageImport`, which
371
+ * `Host::installPackage` runs after every install: every temporary root
372
+ * trigger is moved to the end of the root list, keeping its order among
373
+ * the temporaries, so the permanent ones — the profile's own and the
374
+ * package's — fire ahead of them all. `items` is the permanent tree as the
375
+ * install left it, so the package's new triggers take their place before
376
+ * the temporaries are moved behind them.
377
+ */
378
+ reorderAfterPackageImport(items: TriggerNode[]): void;
379
+ /**
380
+ * `blocked`: triggers whose code (or a Lua-function pattern) will not
381
+ * compile. Those and every trigger with a pattern PCRE rejects are
382
+ * inactive, as desktop's `Tree::isActive` wants `state()` — they never
383
+ * match, so their children are never looked at either.
384
+ */
385
+ loadPerm(storeItems: TriggerNode[], blocked?: ReadonlySet<string>): void;
386
+ /** Whether a line is being walked right now. `updateEnabled` is only worth
387
+ * its cost inside one — outside, the store's own coalesced reload lands
388
+ * before the next line arrives. */
389
+ get isProcessing(): boolean;
390
+ /**
391
+ * Refresh which triggers count as enabled, without recompiling anything.
392
+ *
393
+ * `enableTrigger`/`disableTrigger` write to the store, and the reload that
394
+ * carries the change into the engine is coalesced onto a microtask — which
395
+ * lands after the line that called it has finished. Desktop reads the flag
396
+ * live inside its tree walk, so a trigger enabled by another trigger's
397
+ * script fires on the SAME line (mudlet-web#156). This is that read: the
398
+ * caller hands over the current node list the moment it changes the flag,
399
+ * and the pass in flight sees it when it reaches the node. loadPerm
400
+ * recomputes the same set from scratch a moment later.
401
+ */
402
+ updateEnabled(items: TriggerNode[]): void;
403
+ /** Triggers whose own switch is on and that can be active at all — see
404
+ * {@link selfEnabledIds}. */
405
+ private buildEnabledIds;
406
+ /** Whether the permanent trigger `id` has a pattern that failed to compile
407
+ * and so cannot be active. */
408
+ hasInvalidPattern(id: string): boolean;
128
409
  /** Fresh compile for an item not present in the cache. Returns a CachedEntry
129
410
  * with `compiled: null` when no patterns produced a usable matcher — that
130
411
  * negative result is cached so we don't retry on every loadPerm. */
@@ -139,6 +420,9 @@ export declare class TriggerEngine {
139
420
  * triggers delete themselves (and dirty the unified order) when spent. */
140
421
  private fireTempEntry;
141
422
  private fireTempEntryInner;
423
+ /** The match half of {@link fireTempEntryInner}: true when the pattern
424
+ * matched and the callback has already run. */
425
+ private fireTempEntryMatch;
142
426
  matchPerm(line: string, isPrompt?: boolean): TriggerMatch[];
143
427
  /**
144
428
  * Match one permanent compiled entry against `line`, appending any matches
@@ -147,9 +431,34 @@ export declare class TriggerEngine {
147
431
  * shared across all entries processed for that line.
148
432
  */
149
433
  private matchPermEntry;
150
- /** The nearest filter ancestor of `item`, or null when it has none. */
151
- private innermostFilterId;
434
+ /**
435
+ * The filter ancestor whose offering `item` matches against on this line:
436
+ * the innermost one that MATCHED it. A filter merely holding the chain open
437
+ * with its fire length is passed over — desktop reaches its children from
438
+ * the `mKeepFiring` branch of `TTrigger::match` (src/TTrigger.cpp:1090-1093),
439
+ * which hands them the haystack it was itself given, so what they see is the
440
+ * next filter further out or, failing that, the whole line (mudlet-web#160).
441
+ */
442
+ private activeFilterId;
152
443
  private matchPermEntryOnce;
444
+ /**
445
+ * Mudlet's `mKeepFiring`: a fire length ("Keep firing the script for this
446
+ * many more lines, after the trigger or chain has matched") keeps a trigger
447
+ * going once it has matched.
448
+ *
449
+ * Desktop arms it from BOTH arms of `TTrigger::match` — the single-line
450
+ * branch at `src/TTrigger.cpp:995-999`
451
+ * (`if (!mIsMultiline) { if (ret) { conditionMet = true; mKeepFiring =
452
+ * mStayOpen; break; } }`) and the multiline completion at
453
+ * `src/TTrigger.cpp:1016` — and spends it one line at a time at
454
+ * `src/TTrigger.cpp:1083-1090`, where only a childless trigger re-runs its
455
+ * own script; one with children is holding the chain open FOR them.
456
+ *
457
+ * Mudlet Web used to arm it only in the AND branch, so fire length was inert on
458
+ * single-line (OR) triggers even though the editor offers the field in both
459
+ * modes (mudlet-web#61). Sharing the bookkeeping here keeps the two in step.
460
+ */
461
+ private applyFireLength;
153
462
  /**
154
463
  * Mudlet-faithful single pass: walk the one ordered list of permanent and
155
464
  * temporary triggers (see the ordering notes on the fields) and, for each
@@ -179,7 +488,10 @@ export declare class TriggerEngine {
179
488
  * behalf, and reading the child's own (always empty) lineage instead would
180
489
  * start a fresh one every round — which never deepens and so never trips.
181
490
  */
182
- notePermCreated(node: TriggerNode, root: TriggerNode): void;
491
+ notePermCreated(node: TriggerNode): void;
492
+ /** The lineage recorded against a root: a temp trigger's own, or the one
493
+ * a permanent root was given as something under it was created. */
494
+ private lineageOfRoot;
183
495
  /** Join the lineage of the trigger whose script is running, a generation on;
184
496
  * or start one when that script predates the line. */
185
497
  private nextSameLineChain;
@@ -211,14 +523,38 @@ export declare class TriggerEngine {
211
523
  /** Where the runaway report is printed. ScriptingEngine wires this to the
212
524
  * main console; unset (tests, teardown) the report is dropped. */
213
525
  setRunawayReporter(fn: ((text: string) => void) | null): void;
526
+ /** Paints a trigger's built-in highlight. See {@link setHighlighter}. */
527
+ private highlighter;
528
+ /**
529
+ * How a multiline (AND) trigger's highlight is painted. Desktop paints it
530
+ * per CONDITION, on the line each pattern matches and at the moment it
531
+ * matches (the `mIsColorizerTrigger` block every match_* runs before
532
+ * `updateMultistates`), whether or not the state ever completes — the
533
+ * completed fire carries no single match to paint, which is why Mudlet Web
534
+ * painted nothing. ScriptingEngine wires this to the same painter the
535
+ * single-line path uses; the match handed over is the condition's own.
536
+ */
537
+ setHighlighter(fn: ((match: TriggerMatch) => void) | null): void;
214
538
  /** How the engine switches off a permanent trigger it stopped. */
215
539
  setPermDisabler(fn: ((nodeId: string) => void) | null): void;
540
+ /**
541
+ * Where a pattern that failed to compile is reported. ScriptingEngine wires
542
+ * this to the error log (the Errors tab), tagged with the owning trigger so
543
+ * the row gets a jump-to-source button; unset (tests, teardown) the report
544
+ * is dropped. `source` is absent for temporary triggers, which have no node.
545
+ */
546
+ setCompileErrorReporter(fn: ((message: string, source?: {
547
+ id: string;
548
+ name: string;
549
+ }) => void) | null): void;
216
550
  /** Rebuild the merged, path-sorted processing list from the current
217
551
  * permanent entries and temporary triggers. Called lazily from process()
218
552
  * when either source changed. */
219
553
  private rebuildOrder;
220
554
  /** The registration-seq path from the root ancestor down to `item`. */
221
555
  private permPath;
556
+ /** A node's registration seq: a temp trigger's own, or a permanent one's. */
557
+ private seqOf;
222
558
  setLuaEval(fn: ((code: string, line: string) => boolean) | null): void;
223
559
  /**
224
560
  * Wire the buffer-aware colour check used by `colorTrigger` patterns. The
@@ -231,7 +567,13 @@ export declare class TriggerEngine {
231
567
  setColorMatcher(fn: ((fg: number, bg: number, window: {
232
568
  start: number;
233
569
  length: number;
234
- } | null) => boolean) | null): void;
570
+ } | null) => {
571
+ text: string;
572
+ start: number;
573
+ }[]) | null): void;
574
+ /** Wire how a stretch of the line in its arrived columns is found where it
575
+ * is now — see {@link spanNowRef}. */
576
+ setSpanMapper(fn: ((span: CaptureSpan) => CaptureSpan) | null): void;
235
577
  destroy(): void;
236
578
  /**
237
579
  * Advance every state an AND trigger has in flight against this line, and
@@ -243,41 +585,95 @@ export declare class TriggerEngine {
243
585
  * state let the newer one overwrite the older, so only one ever fired.
244
586
  */
245
587
  private processAndTrigger;
588
+ /** What condition `i` of an AND trigger makes of the line being processed:
589
+ * tested once per line while {@link processAndTrigger} holds the cache. */
590
+ private andTest;
591
+ /**
592
+ * Desktop's per-line pattern loop for a multiline trigger, run only to
593
+ * decide what its highlight paints (TTrigger::match, multiline branch):
594
+ * patterns are tried in order, and the walk stops at the first one that
595
+ * fails once it is past the furthest condition any state is waiting on.
596
+ * Every pattern that matches on the way is painted then and there — on its
597
+ * own line, before any script, whether or not a state needs it or ever
598
+ * completes. A line spacer counts as a match (match_line_spacer returns
599
+ * true). `highest` is each state's TMatchState::nextCondition, which for a
600
+ * state still counting down a spacer is the spacer itself.
601
+ */
602
+ private paintAndConditions;
603
+ private advanceAndTrigger;
246
604
  /** Carry one in-flight state as far through the remaining conditions as this
247
605
  * line takes it. Several can be satisfied by the same line. */
248
606
  private advanceAndState;
607
+ /** A line spacer holds a `multimatches` row of its own, as every other
608
+ * condition does, so the rows after it keep the index of the pattern they
609
+ * belong to. The row is EMPTY — TTrigger::match_line_spacer pushes an
610
+ * empty capture list — not one holding an empty string. */
611
+ private pushSpacerRow;
249
612
  /** The match a completed AND state reports: every line's captures, in order,
250
613
  * as `multimatches`. */
251
614
  private andMatch;
252
615
  /**
253
- * Record a chain-head match: open the chain for `fireLength` more lines and,
254
- * if the trigger is also a filter, stash the captured/matched text so
255
- * descendants see it as their effective input.
616
+ * Record a chain-head match: let this line through to its children (the
617
+ * fire length keeps it open on later ones — see applyFireLength) and, if
618
+ * the trigger is also a filter, work out what it offers its children on
619
+ * this line and stash that as their effective input.
256
620
  */
257
621
  private openChain;
258
622
  /**
259
- * Mudlet `setTriggerStayOpen(name, lines)`: keep the named chain head(s)
260
- * open for `lines` more lines of input, starting from the line currently
261
- * being processed. This is transient runtime state — it mutates only the
262
- * `chainOpenUntil` window, never the persisted `fireLength` on the node, so
263
- * the trigger's stored definition is untouched and the override expires
264
- * naturally as input scrolls past.
623
+ * Mudlet `setTriggerStayOpen(name, lines)`: keep the named trigger(s) open
624
+ * for `lines` more lines of input, starting from the line currently being
625
+ * processed. This is transient runtime state — it mutates only the runtime
626
+ * windows, never the persisted `fireLength` on the node, so the trigger's
627
+ * stored definition is untouched and the override expires naturally as
628
+ * input scrolls past.
265
629
  *
266
- * `matchPerm` post-increments `lineCounter`, so during a trigger's script
267
- * the line just matched is `lineCounter - 1`; the window math then mirrors
268
- * `openChain` exactly. Negative counts clamp to 0 (open for the current
269
- * line only). `ids` are resolved by name by the caller.
630
+ * Desktop writes one counter, `mKeepFiring`, and it does two jobs at once
631
+ * (src/TriggerUnit.cpp:455, spent at src/TTrigger.cpp:1083-1093): the
632
+ * trigger FIRES on each of those lines whether or not its pattern is in
633
+ * them, and its children get a look at them. Mudlet Web keeps the same
634
+ * single counter (`keepFiring`, spent in applyFireLength), so both jobs
635
+ * share one span. Arming only the chain left a stay-open trigger silent
636
+ * on the lines it was opened for (upstream Trigger_spec, "large plain-text
637
+ * trigger sets").
638
+ *
639
+ * The count is spent on the lines the trigger is next reached on. When
640
+ * the call comes from the script of a trigger walked BEFORE the target on
641
+ * this line, that includes this line: desktop decrements `mKeepFiring` as
642
+ * soon as the walk reaches the target, so `setTriggerStayOpen(t, 2)` covers
643
+ * this line and the next — not this line and two more (mudlet-web#262).
644
+ * When the target has already been walked past (it sorts earlier, or the
645
+ * call came from outside a pass), the window is the next `lines` lines.
646
+ *
647
+ * Negative counts clamp to 0, which closes the window. `ids` are resolved
648
+ * by name by the caller.
270
649
  */
271
650
  setStayOpen(ids: string[], lines: number): void;
272
651
  /**
273
- * Returns the effective line to match against for `item`.
274
- * If a filter-trigger ancestor has active filter text, that text is used instead.
275
- * Innermost filter wins.
652
+ * Mudlet `setTriggerStayOpen(name, lines)` for a TEMPORARY trigger, which is
653
+ * addressed by the string form of its id — startTempTrigger names every temp
654
+ * after its own id, and setTriggerStayOpen searches the same name table the
655
+ * permanent ones live in. Returns whether anything answered to the name.
656
+ *
657
+ * The counter it sets is `mKeepFiring`: the trigger fires on that many more
658
+ * lines whether or not its pattern is in them. That is a different thing
659
+ * from the chain window {@link setStayOpen} writes, which only decides
660
+ * whether a trigger's CHILDREN get a look at the line.
661
+ */
662
+ setTempStayOpen(name: string, lines: number): boolean;
663
+ /**
664
+ * The line `item` matches against: the offering of the innermost filter
665
+ * ancestor that matched THIS line, or the whole line when no filter is
666
+ * standing in front of it. See activeFilterId.
276
667
  */
277
668
  private getEffectiveLine;
669
+ /** Whether `item` is offered a filter's capture in the line's current
670
+ * columns this line — see {@link filterCurrentColumns}. */
671
+ private inCurrentColumns;
672
+ /** See {@link spanNowRef}. */
673
+ private spanNow;
278
674
  /** The offset within the ORIGINAL line at which `item`'s effective (filtered)
279
- * input begins — 0 unless it sits under a filter ancestor. Mirrors
280
- * getEffectiveLine: the innermost filter ancestor's recorded offset. */
675
+ * input begins — 0 unless a filter ancestor is standing in front of it on
676
+ * this line. Mirrors getEffectiveLine. */
281
677
  private getEffectiveOffset;
282
678
  /** Return a copy of `r` with every span (matchStart, captureSpans, namedSpans)
283
679
  * shifted by `offset` — used to re-base a filtered descendant's spans onto
@@ -285,12 +681,18 @@ export declare class TriggerEngine {
285
681
  * Zero-length (unmatched-group) placeholders keep length 0. */
286
682
  private shiftResultSpans;
287
683
  /**
288
- * A trigger is chain-accessible if every patterned ancestor has an open
289
- * chain (matched within the last fireLength lines, inclusive of the current
290
- * line). Pattern-less ancestors (pure folders) always grant access. This
684
+ * Whether desktop's recursive walk would hand `item` this line at all: every
685
+ * ancestor was active when the walk reached it, and every patterned one let
686
+ * the line through (it matched, or is spending its fire length on it).
687
+ * Pattern-less ancestors (pure folders) let every line through. This
291
688
  * applies regardless of whether the ancestor is a folder or a leaf with its
292
689
  * own script — Mudlet treats any patterned trigger with children as a chain
293
690
  * head.
691
+ *
692
+ * Both facts come from {@link PassState}, as the walk recorded them on its
693
+ * way past the ancestor, not from the ancestor's state now: a script that
694
+ * disables its own chain head or folder leaves the remaining children with
695
+ * the line, as desktop's children loop is already under way.
294
696
  */
295
697
  private isChainAccessible;
296
698
  private computeDepth;