@swf2es/player-hosts 0.0.0-stage → 0.1.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 (405) hide show
  1. package/LICENSE +202 -0
  2. package/LICENSE.third-party +759 -0
  3. package/README.md +43 -2
  4. package/dist/indexeddb.d.ts +27 -0
  5. package/dist/indexeddb.d.ts.map +1 -0
  6. package/dist/indexeddb.js +170 -0
  7. package/dist/indexeddb.js.map +1 -0
  8. package/dist/node-worker.d.ts +2 -0
  9. package/dist/node-worker.d.ts.map +1 -0
  10. package/dist/node-worker.js +12 -0
  11. package/dist/node-worker.js.map +1 -0
  12. package/dist/node.d.ts +8 -0
  13. package/dist/node.d.ts.map +1 -0
  14. package/dist/node.js +43 -0
  15. package/dist/node.js.map +1 -0
  16. package/dist/precompiled.d.ts +31 -0
  17. package/dist/precompiled.d.ts.map +1 -0
  18. package/dist/precompiled.js +125 -0
  19. package/dist/precompiled.js.map +1 -0
  20. package/dist/stage3d.d.ts +13 -0
  21. package/dist/stage3d.d.ts.map +1 -0
  22. package/dist/stage3d.js +61 -0
  23. package/dist/stage3d.js.map +1 -0
  24. package/dist/thread/codegen/codegen.js +308 -0
  25. package/dist/thread/codegen/index.js +405 -0
  26. package/dist/thread/format/abc-names.js +126 -0
  27. package/dist/thread/format/actions.js +222 -0
  28. package/dist/thread/format/air-descriptor.js +63 -0
  29. package/dist/thread/format/api-versions.js +22 -0
  30. package/dist/thread/format/bitmap.js +199 -0
  31. package/dist/thread/format/button.js +60 -0
  32. package/dist/thread/format/compression.js +200 -0
  33. package/dist/thread/format/display.js +305 -0
  34. package/dist/thread/format/filters.js +136 -0
  35. package/dist/thread/format/font.js +168 -0
  36. package/dist/thread/format/index.js +26 -0
  37. package/dist/thread/format/pbj.js +484 -0
  38. package/dist/thread/format/shape.js +411 -0
  39. package/dist/thread/format/sound.js +91 -0
  40. package/dist/thread/format/swf.js +163 -0
  41. package/dist/thread/format/tags.js +58 -0
  42. package/dist/thread/format/text.js +135 -0
  43. package/dist/thread/format/zip.js +91 -0
  44. package/dist/thread/native/audio/binary.js +3 -0
  45. package/dist/thread/native/audio/index.js +72 -0
  46. package/dist/thread/native/base64.js +9 -0
  47. package/dist/thread/native/compress/binary.js +3 -0
  48. package/dist/thread/native/compress/index.js +145 -0
  49. package/dist/thread/native/instance.js +49 -0
  50. package/dist/thread/native/mp3/binary.js +3 -0
  51. package/dist/thread/native/mp3/index.js +48 -0
  52. package/dist/thread/native/render/binary.js +3 -0
  53. package/dist/thread/native/render/bitmap-kernel.js +591 -0
  54. package/dist/thread/native/render/draw-kernel.js +204 -0
  55. package/dist/thread/native/render/dxt-encoder.js +94 -0
  56. package/dist/thread/native/render/index.js +10 -0
  57. package/dist/thread/native/render/lines.js +122 -0
  58. package/dist/thread/native/render/module.js +26 -0
  59. package/dist/thread/native/render/pixel-ops.js +235 -0
  60. package/dist/thread/native/render/tessellator.js +250 -0
  61. package/dist/thread/player/avm1/amf.js +507 -0
  62. package/dist/thread/player/avm1/avm1.js +1304 -0
  63. package/dist/thread/player/avm1/bindings.js +214 -0
  64. package/dist/thread/player/avm1/classes.js +75 -0
  65. package/dist/thread/player/avm1/clips.js +229 -0
  66. package/dist/thread/player/avm1/compile.js +140 -0
  67. package/dist/thread/player/avm1/external.js +79 -0
  68. package/dist/thread/player/avm1/focus.js +278 -0
  69. package/dist/thread/player/avm1/globals/BitmapData.js +542 -0
  70. package/dist/thread/player/avm1/globals/Button.js +31 -0
  71. package/dist/thread/player/avm1/globals/Color.js +115 -0
  72. package/dist/thread/player/avm1/globals/ExternalInterface.js +310 -0
  73. package/dist/thread/player/avm1/globals/FileReference.js +217 -0
  74. package/dist/thread/player/avm1/globals/Key.js +60 -0
  75. package/dist/thread/player/avm1/globals/LoadVars.js +208 -0
  76. package/dist/thread/player/avm1/globals/LocalConnection.js +92 -0
  77. package/dist/thread/player/avm1/globals/MovieClip.js +1070 -0
  78. package/dist/thread/player/avm1/globals/MovieClipLoader.js +90 -0
  79. package/dist/thread/player/avm1/globals/NetConnection.js +261 -0
  80. package/dist/thread/player/avm1/globals/PrintJob.js +37 -0
  81. package/dist/thread/player/avm1/globals/Selection.js +62 -0
  82. package/dist/thread/player/avm1/globals/SharedObject.js +245 -0
  83. package/dist/thread/player/avm1/globals/Sound.js +238 -0
  84. package/dist/thread/player/avm1/globals/Stage.js +12 -0
  85. package/dist/thread/player/avm1/globals/StyleSheet.js +205 -0
  86. package/dist/thread/player/avm1/globals/TextField.js +396 -0
  87. package/dist/thread/player/avm1/globals/TextFormat.js +194 -0
  88. package/dist/thread/player/avm1/globals/TextSnapshot.js +88 -0
  89. package/dist/thread/player/avm1/globals/XML.js +396 -0
  90. package/dist/thread/player/avm1/globals/XMLNode.js +413 -0
  91. package/dist/thread/player/avm1/globals/XMLSocket.js +205 -0
  92. package/dist/thread/player/avm1/globals/drawing.js +202 -0
  93. package/dist/thread/player/avm1/globals/filters.js +635 -0
  94. package/dist/thread/player/avm1/globals/geom.js +600 -0
  95. package/dist/thread/player/avm1/input.js +483 -0
  96. package/dist/thread/player/avm1/keyboard.js +113 -0
  97. package/dist/thread/player/avm1/loads.js +352 -0
  98. package/dist/thread/player/avm1/net.js +219 -0
  99. package/dist/thread/player/avm1/paths.js +104 -0
  100. package/dist/thread/player/avm1/pointer.js +512 -0
  101. package/dist/thread/player/avm1/queue.js +303 -0
  102. package/dist/thread/player/avm1/sound.js +106 -0
  103. package/dist/thread/player/avm1/swf.js +141 -0
  104. package/dist/thread/player/avm1/timers.js +113 -0
  105. package/dist/thread/player/bitmap/bitmap.js +627 -0
  106. package/dist/thread/player/bitmap/draw.js +68 -0
  107. package/dist/thread/player/bitmap/dxt.js +11 -0
  108. package/dist/thread/player/bitmap/filters.js +656 -0
  109. package/dist/thread/player/bitmap/images.js +240 -0
  110. package/dist/thread/player/bitmap/kernel.js +65 -0
  111. package/dist/thread/player/bitmap/ops.js +1239 -0
  112. package/dist/thread/player/bitmap/pixel-bender.js +911 -0
  113. package/dist/thread/player/bitmap/png.js +139 -0
  114. package/dist/thread/player/bitmap/turbulence.js +89 -0
  115. package/dist/thread/player/clock.js +182 -0
  116. package/dist/thread/player/display/bitmapobject.js +25 -0
  117. package/dist/thread/player/display/bounds.js +520 -0
  118. package/dist/thread/player/display/buttonobject.js +305 -0
  119. package/dist/thread/player/display/color.js +40 -0
  120. package/dist/thread/player/display/container.js +150 -0
  121. package/dist/thread/player/display/display.js +14 -0
  122. package/dist/thread/player/display/displayobject.js +664 -0
  123. package/dist/thread/player/display/drawing.js +613 -0
  124. package/dist/thread/player/display/filters.js +285 -0
  125. package/dist/thread/player/display/geometry.js +189 -0
  126. package/dist/thread/player/display/gradients.js +117 -0
  127. package/dist/thread/player/display/graphicsdata.js +592 -0
  128. package/dist/thread/player/display/instantiate.js +71 -0
  129. package/dist/thread/player/display/matrix3d.js +373 -0
  130. package/dist/thread/player/display/morph.js +226 -0
  131. package/dist/thread/player/display/movieclip.js +680 -0
  132. package/dist/thread/player/display/perspective.js +193 -0
  133. package/dist/thread/player/display/scale9.js +236 -0
  134. package/dist/thread/player/display/shapeobject.js +131 -0
  135. package/dist/thread/player/display/shapes.js +407 -0
  136. package/dist/thread/player/display/textobjects.js +222 -0
  137. package/dist/thread/player/display/timeline.js +471 -0
  138. package/dist/thread/player/display/value-lists.js +40 -0
  139. package/dist/thread/player/display/videoobject.js +6 -0
  140. package/dist/thread/player/display/walk.js +127 -0
  141. package/dist/thread/player/files.js +334 -0
  142. package/dist/thread/player/hosts.js +207 -0
  143. package/dist/thread/player/input/avm1.js +82 -0
  144. package/dist/thread/player/input/context-menu.js +63 -0
  145. package/dist/thread/player/input/keyboard.js +458 -0
  146. package/dist/thread/player/input/pointer.js +863 -0
  147. package/dist/thread/player/input/text-editor.js +319 -0
  148. package/dist/thread/player/input/touch.js +209 -0
  149. package/dist/thread/player/localconnection.js +90 -0
  150. package/dist/thread/player/media/audio.js +376 -0
  151. package/dist/thread/player/media/dynamic-sound.js +90 -0
  152. package/dist/thread/player/media/extract.js +135 -0
  153. package/dist/thread/player/media/mp3.js +152 -0
  154. package/dist/thread/player/media/sounds.js +507 -0
  155. package/dist/thread/player/media/streaming-audio.js +133 -0
  156. package/dist/thread/player/player.js +616 -0
  157. package/dist/thread/player/playerglobal/air/net/WebSocket.js +250 -0
  158. package/dist/thread/player/playerglobal/air-library.js +8 -0
  159. package/dist/thread/player/playerglobal/flash/accessibility/Accessibility.js +21 -0
  160. package/dist/thread/player/playerglobal/flash/crypto/generateRandomBytes.js +32 -0
  161. package/dist/thread/player/playerglobal/flash/data/EncryptedLocalStore.js +61 -0
  162. package/dist/thread/player/playerglobal/flash/desktop/Clipboard.js +173 -0
  163. package/dist/thread/player/playerglobal/flash/desktop/NativeApplication.js +179 -0
  164. package/dist/thread/player/playerglobal/flash/display/AVM1Movie.js +19 -0
  165. package/dist/thread/player/playerglobal/flash/display/Bitmap.js +58 -0
  166. package/dist/thread/player/playerglobal/flash/display/BitmapData.js +633 -0
  167. package/dist/thread/player/playerglobal/flash/display/DisplayObject.js +614 -0
  168. package/dist/thread/player/playerglobal/flash/display/DisplayObjectContainer.js +224 -0
  169. package/dist/thread/player/playerglobal/flash/display/Graphics.js +345 -0
  170. package/dist/thread/player/playerglobal/flash/display/InteractiveObject.js +87 -0
  171. package/dist/thread/player/playerglobal/flash/display/Loader.js +79 -0
  172. package/dist/thread/player/playerglobal/flash/display/LoaderInfo.js +128 -0
  173. package/dist/thread/player/playerglobal/flash/display/MovieClip.js +194 -0
  174. package/dist/thread/player/playerglobal/flash/display/NativeWindow.js +245 -0
  175. package/dist/thread/player/playerglobal/flash/display/Shader.js +26 -0
  176. package/dist/thread/player/playerglobal/flash/display/ShaderData.js +85 -0
  177. package/dist/thread/player/playerglobal/flash/display/ShaderInput.js +64 -0
  178. package/dist/thread/player/playerglobal/flash/display/ShaderJob.js +181 -0
  179. package/dist/thread/player/playerglobal/flash/display/ShaderParameter.js +23 -0
  180. package/dist/thread/player/playerglobal/flash/display/Shape.js +13 -0
  181. package/dist/thread/player/playerglobal/flash/display/SimpleButton.js +103 -0
  182. package/dist/thread/player/playerglobal/flash/display/Sprite.js +84 -0
  183. package/dist/thread/player/playerglobal/flash/display/Stage.js +231 -0
  184. package/dist/thread/player/playerglobal/flash/display/Stage3D.js +54 -0
  185. package/dist/thread/player/playerglobal/flash/display/shaders.js +228 -0
  186. package/dist/thread/player/playerglobal/flash/events/Event.js +58 -0
  187. package/dist/thread/player/playerglobal/flash/events/EventDispatcher.js +103 -0
  188. package/dist/thread/player/playerglobal/flash/events/GestureEvent.js +34 -0
  189. package/dist/thread/player/playerglobal/flash/events/HTTPStatusEvent.js +8 -0
  190. package/dist/thread/player/playerglobal/flash/events/KeyboardEvent.js +51 -0
  191. package/dist/thread/player/playerglobal/flash/events/MouseEvent.js +59 -0
  192. package/dist/thread/player/playerglobal/flash/events/PressAndTapGestureEvent.js +30 -0
  193. package/dist/thread/player/playerglobal/flash/events/TimerEvent.js +16 -0
  194. package/dist/thread/player/playerglobal/flash/events/TouchEvent.js +45 -0
  195. package/dist/thread/player/playerglobal/flash/external/ExternalInterface.js +73 -0
  196. package/dist/thread/player/playerglobal/flash/filesystem/File.js +340 -0
  197. package/dist/thread/player/playerglobal/flash/filesystem/FileStream.js +453 -0
  198. package/dist/thread/player/playerglobal/flash/filesystem/paths.js +156 -0
  199. package/dist/thread/player/playerglobal/flash/filesystem/writes.js +143 -0
  200. package/dist/thread/player/playerglobal/flash/filters/BevelFilter.js +4 -0
  201. package/dist/thread/player/playerglobal/flash/filters/BitmapFilter.js +205 -0
  202. package/dist/thread/player/playerglobal/flash/filters/BlurFilter.js +4 -0
  203. package/dist/thread/player/playerglobal/flash/filters/ColorMatrixFilter.js +11 -0
  204. package/dist/thread/player/playerglobal/flash/filters/ConvolutionFilter.js +26 -0
  205. package/dist/thread/player/playerglobal/flash/filters/DisplacementMapFilter.js +51 -0
  206. package/dist/thread/player/playerglobal/flash/filters/DropShadowFilter.js +4 -0
  207. package/dist/thread/player/playerglobal/flash/filters/GlowFilter.js +4 -0
  208. package/dist/thread/player/playerglobal/flash/filters/GradientBevelFilter.js +4 -0
  209. package/dist/thread/player/playerglobal/flash/filters/GradientGlowFilter.js +4 -0
  210. package/dist/thread/player/playerglobal/flash/filters/ShaderFilter.js +53 -0
  211. package/dist/thread/player/playerglobal/flash/geom/Matrix3D.js +361 -0
  212. package/dist/thread/player/playerglobal/flash/geom/PerspectiveProjection.js +122 -0
  213. package/dist/thread/player/playerglobal/flash/geom/Transform.js +245 -0
  214. package/dist/thread/player/playerglobal/flash/geom/Utils3D.js +85 -0
  215. package/dist/thread/player/playerglobal/flash/globalization/Collator.js +149 -0
  216. package/dist/thread/player/playerglobal/flash/globalization/CurrencyFormatter.js +272 -0
  217. package/dist/thread/player/playerglobal/flash/globalization/CurrencyParseResult.js +21 -0
  218. package/dist/thread/player/playerglobal/flash/globalization/DateTimeFormatter.js +463 -0
  219. package/dist/thread/player/playerglobal/flash/globalization/LocaleID.js +144 -0
  220. package/dist/thread/player/playerglobal/flash/globalization/NumberFormatter.js +444 -0
  221. package/dist/thread/player/playerglobal/flash/globalization/NumberParseResult.js +22 -0
  222. package/dist/thread/player/playerglobal/flash/globalization/StringTools.js +59 -0
  223. package/dist/thread/player/playerglobal/flash/globalization/locale.js +190 -0
  224. package/dist/thread/player/playerglobal/flash/media/Camera.js +89 -0
  225. package/dist/thread/player/playerglobal/flash/media/Microphone.js +126 -0
  226. package/dist/thread/player/playerglobal/flash/media/Sound.js +543 -0
  227. package/dist/thread/player/playerglobal/flash/media/SoundMixer.js +74 -0
  228. package/dist/thread/player/playerglobal/flash/media/SoundTransform.js +40 -0
  229. package/dist/thread/player/playerglobal/flash/media/Video.js +43 -0
  230. package/dist/thread/player/playerglobal/flash/net/FileFilter.js +27 -0
  231. package/dist/thread/player/playerglobal/flash/net/FileReference.js +197 -0
  232. package/dist/thread/player/playerglobal/flash/net/LocalConnection.js +167 -0
  233. package/dist/thread/player/playerglobal/flash/net/NetConnection.js +155 -0
  234. package/dist/thread/player/playerglobal/flash/net/SharedObject.js +299 -0
  235. package/dist/thread/player/playerglobal/flash/net/Socket.js +282 -0
  236. package/dist/thread/player/playerglobal/flash/net/URLRequest.js +93 -0
  237. package/dist/thread/player/playerglobal/flash/net/URLStream.js +146 -0
  238. package/dist/thread/player/playerglobal/flash/net/XMLSocket.js +14 -0
  239. package/dist/thread/player/playerglobal/flash/net/local-modern.js +142 -0
  240. package/dist/thread/player/playerglobal/flash/net/local-values.js +217 -0
  241. package/dist/thread/player/playerglobal/flash/net/navigateToURL.js +29 -0
  242. package/dist/thread/player/playerglobal/flash/profiler/Telemetry.js +25 -0
  243. package/dist/thread/player/playerglobal/flash/sensors/Accelerometer.js +12 -0
  244. package/dist/thread/player/playerglobal/flash/system/ApplicationDomain.js +69 -0
  245. package/dist/thread/player/playerglobal/flash/system/Capabilities.js +163 -0
  246. package/dist/thread/player/playerglobal/flash/system/FSCommandHost.js +17 -0
  247. package/dist/thread/player/playerglobal/flash/system/Security.js +46 -0
  248. package/dist/thread/player/playerglobal/flash/system/SecurityDomain.js +21 -0
  249. package/dist/thread/player/playerglobal/flash/system/System.js +73 -0
  250. package/dist/thread/player/playerglobal/flash/system/Worker.js +112 -0
  251. package/dist/thread/player/playerglobal/flash/text/Font.js +95 -0
  252. package/dist/thread/player/playerglobal/flash/text/StaticText.js +16 -0
  253. package/dist/thread/player/playerglobal/flash/text/StyleSheet.js +65 -0
  254. package/dist/thread/player/playerglobal/flash/text/TextField.js +707 -0
  255. package/dist/thread/player/playerglobal/flash/text/TextRenderer.js +77 -0
  256. package/dist/thread/player/playerglobal/flash/text/engine/FontDescription.js +141 -0
  257. package/dist/thread/player/playerglobal/flash/text/engine/TabStop.js +46 -0
  258. package/dist/thread/player/playerglobal/flash/trace/Trace.js +17 -0
  259. package/dist/thread/player/playerglobal/flash/ui/ContextMenu.js +17 -0
  260. package/dist/thread/player/playerglobal/flash/ui/GameInput.js +19 -0
  261. package/dist/thread/player/playerglobal/flash/ui/Keyboard.js +27 -0
  262. package/dist/thread/player/playerglobal/flash/ui/Mouse.js +127 -0
  263. package/dist/thread/player/playerglobal/flash/ui/Multitouch.js +46 -0
  264. package/dist/thread/player/playerglobal/flash/utils/ByteArray.js +155 -0
  265. package/dist/thread/player/playerglobal/flash/utils/Timer.js +25 -0
  266. package/dist/thread/player/playerglobal/flash/xml/XMLDocument.js +74 -0
  267. package/dist/thread/player/playerglobal/index.js +224 -0
  268. package/dist/thread/player/playerglobal/libraries.js +10 -0
  269. package/dist/thread/player/playerglobal/playerglobal-library.js +22 -0
  270. package/dist/thread/player/playerglobal/toplevel.js +122 -0
  271. package/dist/thread/player/scripting/clipboard.js +146 -0
  272. package/dist/thread/player/scripting/code.js +900 -0
  273. package/dist/thread/player/scripting/evaluate.js +144 -0
  274. package/dist/thread/player/scripting/events.js +172 -0
  275. package/dist/thread/player/scripting/handover.js +182 -0
  276. package/dist/thread/player/scripting/lazy.js +38 -0
  277. package/dist/thread/player/scripting/lifecycle.js +272 -0
  278. package/dist/thread/player/scripting/loads.js +860 -0
  279. package/dist/thread/player/scripting/sha256.js +95 -0
  280. package/dist/thread/player/scripting/symbols.js +348 -0
  281. package/dist/thread/player/scripting/timers.js +434 -0
  282. package/dist/thread/player/scripting/workers.js +923 -0
  283. package/dist/thread/player/scripting.js +1018 -0
  284. package/dist/thread/player/stage.js +4 -0
  285. package/dist/thread/player/text/csm.js +113 -0
  286. package/dist/thread/player/text/css.js +167 -0
  287. package/dist/thread/player/text/fonts.js +97 -0
  288. package/dist/thread/player/text/layout.js +393 -0
  289. package/dist/thread/player/text/static.js +109 -0
  290. package/dist/thread/player/text/text.js +431 -0
  291. package/dist/thread/player/workers/thread.js +159 -0
  292. package/dist/thread/player/workers/wire.js +198 -0
  293. package/dist/thread/player-hosts/web-worker.js +19 -0
  294. package/dist/thread/runtime/avm1/activation.js +89 -0
  295. package/dist/thread/runtime/avm1/case.js +249 -0
  296. package/dist/thread/runtime/avm1/clips.js +334 -0
  297. package/dist/thread/runtime/avm1/control.js +280 -0
  298. package/dist/thread/runtime/avm1/errors.js +50 -0
  299. package/dist/thread/runtime/avm1/functions.js +249 -0
  300. package/dist/thread/runtime/avm1/globals/array.js +549 -0
  301. package/dist/thread/runtime/avm1/globals/broadcaster.js +131 -0
  302. package/dist/thread/runtime/avm1/globals/date.js +436 -0
  303. package/dist/thread/runtime/avm1/globals/global.js +344 -0
  304. package/dist/thread/runtime/avm1/globals/math.js +139 -0
  305. package/dist/thread/runtime/avm1/globals/number.js +93 -0
  306. package/dist/thread/runtime/avm1/globals/string.js +201 -0
  307. package/dist/thread/runtime/avm1/globals/timers.js +129 -0
  308. package/dist/thread/runtime/avm1/host.js +5 -0
  309. package/dist/thread/runtime/avm1/index.js +14 -0
  310. package/dist/thread/runtime/avm1/inheritance.js +132 -0
  311. package/dist/thread/runtime/avm1/numbers.js +298 -0
  312. package/dist/thread/runtime/avm1/objects.js +896 -0
  313. package/dist/thread/runtime/avm1/operators.js +170 -0
  314. package/dist/thread/runtime/avm1/realm.js +529 -0
  315. package/dist/thread/runtime/avm1/runtime.js +882 -0
  316. package/dist/thread/runtime/avm1/scope.js +385 -0
  317. package/dist/thread/runtime/avm1/urls.js +180 -0
  318. package/dist/thread/runtime/avm1/values.js +97 -0
  319. package/dist/thread/runtime/avm2/amf-classes.js +66 -0
  320. package/dist/thread/runtime/avm2/amf.js +801 -0
  321. package/dist/thread/runtime/avm2/array-conversion.js +100 -0
  322. package/dist/thread/runtime/avm2/builtin-library.js +21 -0
  323. package/dist/thread/runtime/avm2/cache-fill.js +86 -0
  324. package/dist/thread/runtime/avm2/classes.js +211 -0
  325. package/dist/thread/runtime/avm2/definitions.js +69 -0
  326. package/dist/thread/runtime/avm2/descriptors.js +5 -0
  327. package/dist/thread/runtime/avm2/dictionary-keys.js +295 -0
  328. package/dist/thread/runtime/avm2/domain-memory.js +75 -0
  329. package/dist/thread/runtime/avm2/domain.js +280 -0
  330. package/dist/thread/runtime/avm2/dynamic-properties.js +182 -0
  331. package/dist/thread/runtime/avm2/enumeration.js +393 -0
  332. package/dist/thread/runtime/avm2/errors.js +45 -0
  333. package/dist/thread/runtime/avm2/float-library.js +66 -0
  334. package/dist/thread/runtime/avm2/float.js +26 -0
  335. package/dist/thread/runtime/avm2/hooks.js +19 -0
  336. package/dist/thread/runtime/avm2/index.js +38 -0
  337. package/dist/thread/runtime/avm2/messages.js +177 -0
  338. package/dist/thread/runtime/avm2/method-factories.js +95 -0
  339. package/dist/thread/runtime/avm2/modules.js +105 -0
  340. package/dist/thread/runtime/avm2/names.js +248 -0
  341. package/dist/thread/runtime/avm2/natives/aliases.js +47 -0
  342. package/dist/thread/runtime/avm2/natives/array.js +390 -0
  343. package/dist/thread/runtime/avm2/natives/bytearray.js +1227 -0
  344. package/dist/thread/runtime/avm2/natives/case.js +88 -0
  345. package/dist/thread/runtime/avm2/natives/concurrent.js +199 -0
  346. package/dist/thread/runtime/avm2/natives/date.js +581 -0
  347. package/dist/thread/runtime/avm2/natives/define.js +130 -0
  348. package/dist/thread/runtime/avm2/natives/describe.js +351 -0
  349. package/dist/thread/runtime/avm2/natives/dictionary.js +12 -0
  350. package/dist/thread/runtime/avm2/natives/float-vector.js +81 -0
  351. package/dist/thread/runtime/avm2/natives/float.js +96 -0
  352. package/dist/thread/runtime/avm2/natives/index.js +64 -0
  353. package/dist/thread/runtime/avm2/natives/json.js +514 -0
  354. package/dist/thread/runtime/avm2/natives/number.js +162 -0
  355. package/dist/thread/runtime/avm2/natives/object.js +237 -0
  356. package/dist/thread/runtime/avm2/natives/proxy.js +75 -0
  357. package/dist/thread/runtime/avm2/natives/regexp.js +485 -0
  358. package/dist/thread/runtime/avm2/natives/shell-workers.js +404 -0
  359. package/dist/thread/runtime/avm2/natives/shell.js +557 -0
  360. package/dist/thread/runtime/avm2/natives/sort.js +377 -0
  361. package/dist/thread/runtime/avm2/natives/string.js +132 -0
  362. package/dist/thread/runtime/avm2/natives/sync.js +821 -0
  363. package/dist/thread/runtime/avm2/natives/toplevel.js +139 -0
  364. package/dist/thread/runtime/avm2/natives/vector-elements.js +46 -0
  365. package/dist/thread/runtime/avm2/natives/vector.js +406 -0
  366. package/dist/thread/runtime/avm2/natives/xml/access.js +633 -0
  367. package/dist/thread/runtime/avm2/natives/xml/build.js +291 -0
  368. package/dist/thread/runtime/avm2/natives/xml/chars.js +112 -0
  369. package/dist/thread/runtime/avm2/natives/xml/escape.js +38 -0
  370. package/dist/thread/runtime/avm2/natives/xml/names.js +204 -0
  371. package/dist/thread/runtime/avm2/natives/xml/node.js +272 -0
  372. package/dist/thread/runtime/avm2/natives/xml/operators.js +69 -0
  373. package/dist/thread/runtime/avm2/natives/xml/parser.js +356 -0
  374. package/dist/thread/runtime/avm2/natives/xml/strings.js +191 -0
  375. package/dist/thread/runtime/avm2/natives/xml/values.js +122 -0
  376. package/dist/thread/runtime/avm2/natives/xml/xml.js +645 -0
  377. package/dist/thread/runtime/avm2/number-strings.js +110 -0
  378. package/dist/thread/runtime/avm2/numbers.js +558 -0
  379. package/dist/thread/runtime/avm2/options.js +16 -0
  380. package/dist/thread/runtime/avm2/player-messages.js +550 -0
  381. package/dist/thread/runtime/avm2/property-cache.js +135 -0
  382. package/dist/thread/runtime/avm2/runtime.js +2644 -0
  383. package/dist/thread/runtime/avm2/traits.js +509 -0
  384. package/dist/thread/runtime/index.js +7 -0
  385. package/dist/web-worker.d.ts +2 -0
  386. package/dist/web-worker.d.ts.map +1 -0
  387. package/dist/web-worker.js +20 -0
  388. package/dist/web-worker.js.map +1 -0
  389. package/dist/websocket.d.ts +4 -0
  390. package/dist/websocket.d.ts.map +1 -0
  391. package/dist/websocket.js +27 -0
  392. package/dist/websocket.js.map +1 -0
  393. package/dist/workers.d.ts +35 -0
  394. package/dist/workers.d.ts.map +1 -0
  395. package/dist/workers.js +171 -0
  396. package/dist/workers.js.map +1 -0
  397. package/package.json +62 -3
  398. package/src/indexeddb.ts +227 -0
  399. package/src/node-worker.ts +13 -0
  400. package/src/node.ts +49 -0
  401. package/src/precompiled.ts +166 -0
  402. package/src/stage3d.ts +76 -0
  403. package/src/web-worker.ts +24 -0
  404. package/src/websocket.ts +32 -0
  405. package/src/workers.ts +255 -0
@@ -0,0 +1,198 @@
1
+ const NUMBER = 0;
2
+ const TRUE = 1;
3
+ const FALSE = 2;
4
+ const STRING = 3;
5
+ const NULL = 4;
6
+ const AMF = 5;
7
+ const BYTES = 6;
8
+ const SHARED = 7;
9
+ const CHANNEL = 8;
10
+ const MUTEX = 9;
11
+ const CONDITION = 10;
12
+ const encoder = new TextEncoder();
13
+ const decoder = new TextDecoder();
14
+ function tagged(tag, length) {
15
+ const out = new Uint8Array(1 + length);
16
+ out[0] = tag;
17
+ return { out, view: new DataView(out.buffer) };
18
+ }
19
+ function withBytes(tag, bytes) {
20
+ const { out } = tagged(tag, bytes.length);
21
+ out.set(bytes, 1);
22
+ return out;
23
+ }
24
+ export function pack(wire) {
25
+ switch (wire.kind) {
26
+ case "value": {
27
+ const v = wire.value;
28
+ if (v === null) {
29
+ return tagged(NULL, 0).out;
30
+ }
31
+ if (typeof v === "boolean") {
32
+ return tagged(v ? TRUE : FALSE, 0).out;
33
+ }
34
+ if (typeof v === "string") {
35
+ return withBytes(STRING, encoder.encode(v));
36
+ }
37
+ const { out, view } = tagged(NUMBER, 8);
38
+ view.setFloat64(1, v, true);
39
+ return out;
40
+ }
41
+ case "amf":
42
+ return withBytes(AMF, wire.bytes);
43
+ case "bytes":
44
+ return withBytes(BYTES, wire.bytes);
45
+ case "shared": {
46
+ const { out, view } = tagged(SHARED, 8);
47
+ view.setFloat64(1, wire.memory.id, true);
48
+ return out;
49
+ }
50
+ case "channel": {
51
+ const { out, view } = tagged(CHANNEL, 20);
52
+ view.setFloat64(1, wire.channel.id, true);
53
+ view.setInt32(9, wire.channel.sender, true);
54
+ view.setInt32(13, wire.channel.receiver, true);
55
+ view.setInt32(17, wire.channel.queue, true);
56
+ return out;
57
+ }
58
+ case "sync": {
59
+ const { out, view } = tagged(wire.ref.kind === "mutex" ? MUTEX : CONDITION, 4);
60
+ view.setInt32(1, wire.ref.address, true);
61
+ return out;
62
+ }
63
+ }
64
+ }
65
+ export function unpack(bytes) {
66
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
67
+ const rest = () => bytes.slice(1);
68
+ switch (bytes[0]) {
69
+ case NUMBER:
70
+ return { kind: "value", value: view.getFloat64(1, true) };
71
+ case TRUE:
72
+ case FALSE:
73
+ return { kind: "value", value: bytes[0] === TRUE };
74
+ case STRING:
75
+ return { kind: "value", value: decoder.decode(bytes.subarray(1)) };
76
+ case NULL:
77
+ return { kind: "value", value: null };
78
+ case AMF:
79
+ return { kind: "amf", bytes: rest() };
80
+ case BYTES:
81
+ return { kind: "bytes", bytes: rest() };
82
+ case SHARED:
83
+ return { kind: "shared", id: view.getFloat64(1, true) };
84
+ case CHANNEL: {
85
+ const channel = {
86
+ id: view.getFloat64(1, true),
87
+ sender: view.getInt32(9, true),
88
+ receiver: view.getInt32(13, true),
89
+ queue: view.getInt32(17, true),
90
+ };
91
+ return { kind: "channel", channel };
92
+ }
93
+ default:
94
+ return {
95
+ kind: "sync",
96
+ ref: { kind: bytes[0] === MUTEX ? "mutex" : "condition", address: view.getInt32(1, true) },
97
+ };
98
+ }
99
+ }
100
+ export function packTable(entries) {
101
+ const parts = [];
102
+ for (const e of entries) {
103
+ const key = e.key === null ? null : encoder.encode(e.key);
104
+ const head = new DataView(new ArrayBuffer(16));
105
+ head.setInt32(0, e.worker, true);
106
+ head.setInt32(4, key === null ? -1 : key.length, true);
107
+ head.setInt32(8, e.token, true);
108
+ head.setUint32(12, e.value.length, true);
109
+ parts.push(new Uint8Array(head.buffer), key ?? new Uint8Array(0), e.value);
110
+ }
111
+ const out = new Uint8Array(parts.reduce((n, p) => n + p.length, 0));
112
+ let at = 0;
113
+ for (const p of parts) {
114
+ out.set(p, at);
115
+ at += p.length;
116
+ }
117
+ return out;
118
+ }
119
+ export function unpackTable(bytes) {
120
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
121
+ const entries = [];
122
+ let at = 0;
123
+ while (at < bytes.length) {
124
+ const worker = view.getInt32(at, true);
125
+ const keyLength = view.getInt32(at + 4, true);
126
+ const token = view.getInt32(at + 8, true);
127
+ const valueLength = view.getUint32(at + 12, true);
128
+ at += 16;
129
+ const key = keyLength < 0 ? null : decoder.decode(bytes.subarray(at, at + keyLength));
130
+ at += Math.max(keyLength, 0);
131
+ entries.push({ worker, key, token, value: bytes.slice(at, at + valueLength) });
132
+ at += valueLength;
133
+ }
134
+ return entries;
135
+ }
136
+ const START = 0;
137
+ const END = 1;
138
+ export function packEnd(id, creator) {
139
+ const out = new DataView(new ArrayBuffer(9));
140
+ out.setUint8(0, END);
141
+ out.setInt32(1, id, true);
142
+ out.setInt32(5, creator, true);
143
+ return new Uint8Array(out.buffer);
144
+ }
145
+ export function unpackRequest(bytes) {
146
+ if (bytes[0] === END) {
147
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
148
+ return { type: "end", id: view.getInt32(1, true), creator: view.getInt32(5, true) };
149
+ }
150
+ return { type: "start", job: unpackJob(bytes.subarray(1)) };
151
+ }
152
+ export function packJob(id, creator, swf, shared) {
153
+ const head = new DataView(new ArrayBuffer(16));
154
+ head.setInt32(0, id, true);
155
+ head.setInt32(4, creator, true);
156
+ head.setUint32(8, swf.length, true);
157
+ head.setUint32(12, shared.length, true);
158
+ const parts = [new Uint8Array([START]), new Uint8Array(head.buffer), swf];
159
+ for (const p of shared) {
160
+ const key = p.key === null ? null : encoder.encode(p.key);
161
+ const value = pack(p.value);
162
+ const entry = new DataView(new ArrayBuffer(12));
163
+ entry.setInt32(0, p.worker, true);
164
+ entry.setInt32(4, key === null ? -1 : key.length, true);
165
+ entry.setUint32(8, value.length, true);
166
+ parts.push(new Uint8Array(entry.buffer), key ?? new Uint8Array(0), value);
167
+ }
168
+ const out = new Uint8Array(parts.reduce((n, p) => n + p.length, 0));
169
+ let at = 0;
170
+ for (const p of parts) {
171
+ out.set(p, at);
172
+ at += p.length;
173
+ }
174
+ return out;
175
+ }
176
+ function unpackJob(bytes) {
177
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
178
+ const swfLength = view.getUint32(8, true);
179
+ const count = view.getUint32(12, true);
180
+ let at = 16 + swfLength;
181
+ const shared = [];
182
+ for (let i = 0; i < count; i++) {
183
+ const worker = view.getInt32(at, true);
184
+ const keyLength = view.getInt32(at + 4, true);
185
+ const valueLength = view.getUint32(at + 8, true);
186
+ at += 12;
187
+ const key = keyLength < 0 ? null : decoder.decode(bytes.subarray(at, at + keyLength));
188
+ at += Math.max(keyLength, 0);
189
+ shared.push({ worker, key, value: unpack(bytes.slice(at, at + valueLength)) });
190
+ at += valueLength;
191
+ }
192
+ return {
193
+ id: view.getInt32(0, true),
194
+ creator: view.getInt32(4, true),
195
+ swf: bytes.slice(16, 16 + swfLength),
196
+ shared,
197
+ };
198
+ }
@@ -0,0 +1,19 @@
1
+ // A Web Worker running one background flash.system.Worker (workers.ts).
2
+ import { runWorkerThread } from "../player/workers/thread.js";
3
+ // The DOM's types, not a worker's, are this package's: its global scope as a worker sees it.
4
+ const scope = globalThis;
5
+ runWorkerThread({
6
+ post: (message) => scope.postMessage(message),
7
+ listen: (receive) => {
8
+ scope.onmessage = (event) => {
9
+ // The host's first message: answered, it tells the host that what it
10
+ // posts reaches this worker, which it then counts on while the page's
11
+ // thread is blocked (workers.ts).
12
+ if (event.data?.type === "ping") {
13
+ scope.postMessage({ type: "ready" });
14
+ return;
15
+ }
16
+ receive(event.data);
17
+ };
18
+ },
19
+ });
@@ -0,0 +1,89 @@
1
+ /** A function's `arguments`, made as its activation object is first asked for it. */
2
+ export const PENDING_Arguments = 1;
3
+ /** A function's `super`, likewise. */
4
+ export const PENDING_Super = 2;
5
+ /**
6
+ * What a region runs in: the operand stack, the constant pool, the target
7
+ * and the host. Flash has one operand stack, not one an activation: every
8
+ * activation of a frame's actions shares the frame's, which the player
9
+ * empties between frames, and a function's shares its caller's.
10
+ */
11
+ export class Activation {
12
+ st;
13
+ pool;
14
+ base;
15
+ host;
16
+ realm;
17
+ scope;
18
+ self;
19
+ clip;
20
+ /** The block's regions, which DefineFunction makes functions of. */
21
+ code = [];
22
+ /** The function running, null in a block: `arguments.callee`, and its callees' caller. */
23
+ callee = null;
24
+ /** The function that called it, null from a block: `arguments.caller`. */
25
+ caller = null;
26
+ /** The arguments it was called with. */
27
+ args = NO_ARGS;
28
+ /** How far up `this`'s prototypes the function was found, which `super` starts from. */
29
+ depth = 0;
30
+ /** The `this` it was called with, which `super` is made of. */
31
+ receiver = undefined;
32
+ /** What of `arguments` and `super` its activation object has yet to make (PENDING_ bits). */
33
+ pending = 0;
34
+ /** The movie's four global registers. */
35
+ g;
36
+ /** What its Withs and Trys hold while control stays in their bodies (control.ts), the latest last. */
37
+ held = null;
38
+ /** What the region returns where control goes to its exit through a Try (control.ts). */
39
+ ret = undefined;
40
+ /**
41
+ * The realm's count of removals as this last looked at its clip, which a
42
+ * call may have removed only where the count moved on; none at first.
43
+ */
44
+ removals;
45
+ /** The register a catch just took a value into, -1 for none, and the value, which the region sets. */
46
+ into = -1;
47
+ thrown = undefined;
48
+ /**
49
+ * The clip timeline actions act on, which SetTarget changes; null where
50
+ * a SetTarget found none, where they do nothing.
51
+ */
52
+ target;
53
+ constructor(
54
+ /** The operand stack, the frame's. */
55
+ st,
56
+ /** The constant pool the region reads where the compiler cannot tell which: see V.constantPool. */
57
+ pool,
58
+ /** The clip whose code runs, the target a SetTarget of "" gives back. */
59
+ base, host, realm,
60
+ /** The scope chain, searched from here down to `_global`. */
61
+ scope,
62
+ /** `this`. */
63
+ self,
64
+ /**
65
+ * The target's AVM1 object, the root's where SetTarget found none: a
66
+ * function called by name without an object takes it as `this`.
67
+ */
68
+ clip) {
69
+ this.st = st;
70
+ this.pool = pool;
71
+ this.base = base;
72
+ this.host = host;
73
+ this.realm = realm;
74
+ this.scope = scope;
75
+ this.self = self;
76
+ this.clip = clip;
77
+ this.target = base;
78
+ this.g = realm.registers;
79
+ this.removals = -1;
80
+ }
81
+ get global() {
82
+ return this.realm.global;
83
+ }
84
+ /** `arguments` or `super`, made on the activation object `o` as it is first asked for. */
85
+ local(o, name, version) {
86
+ return this.realm.pendingLocal(this, o, name, version);
87
+ }
88
+ }
89
+ const NO_ARGS = [];
@@ -0,0 +1,249 @@
1
+ // Flash's lower and upper case of a UTF-16 code unit: the lower case AVM1
2
+ // folds names by up to SWF 6, and String's toLowerCase and toUpperCase.
3
+ // An old Unicode's simple mappings, one code unit to one, without
4
+ // JavaScript's later letters (Cherokee, Glagolitic, Coptic, Latin
5
+ // Extended-C and -D...), with İ to i, Georgian capitals to Mkhedruli and
6
+ // U+03A2 to ς, and back, ß and ʼn left as they are. Measured in adl: every
7
+ // code unit through String's toLowerCase and toUpperCase, and each lower
8
+ // case mapping through names.
9
+ /** Runs of mappings: their first code unit, how many, what each adds, and the step between them. */
10
+ const LOWER = [
11
+ [0x0041, 26, 32, 1],
12
+ [0x00c0, 23, 32, 1],
13
+ [0x00d8, 7, 32, 1],
14
+ [0x0100, 24, 1, 2],
15
+ [0x0130, 1, -199, 1],
16
+ [0x0132, 3, 1, 2],
17
+ [0x0139, 8, 1, 2],
18
+ [0x014a, 23, 1, 2],
19
+ [0x0178, 1, -121, 1],
20
+ [0x0179, 3, 1, 2],
21
+ [0x0181, 1, 210, 1],
22
+ [0x0182, 2, 1, 2],
23
+ [0x0186, 1, 206, 1],
24
+ [0x0187, 1, 1, 1],
25
+ [0x0189, 2, 205, 1],
26
+ [0x018b, 1, 1, 1],
27
+ [0x018e, 1, 79, 1],
28
+ [0x018f, 1, 202, 1],
29
+ [0x0190, 1, 203, 1],
30
+ [0x0191, 1, 1, 1],
31
+ [0x0193, 1, 205, 1],
32
+ [0x0194, 1, 207, 1],
33
+ [0x0196, 1, 211, 1],
34
+ [0x0197, 1, 209, 1],
35
+ [0x0198, 1, 1, 1],
36
+ [0x019c, 1, 211, 1],
37
+ [0x019d, 1, 213, 1],
38
+ [0x019f, 1, 214, 1],
39
+ [0x01a0, 3, 1, 2],
40
+ [0x01a6, 1, 218, 1],
41
+ [0x01a7, 1, 1, 1],
42
+ [0x01a9, 1, 218, 1],
43
+ [0x01ac, 1, 1, 1],
44
+ [0x01ae, 1, 218, 1],
45
+ [0x01af, 1, 1, 1],
46
+ [0x01b1, 2, 217, 1],
47
+ [0x01b3, 2, 1, 2],
48
+ [0x01b7, 1, 219, 1],
49
+ [0x01b8, 1, 1, 1],
50
+ [0x01bc, 1, 1, 1],
51
+ [0x01c4, 1, 2, 1],
52
+ [0x01c5, 1, 1, 1],
53
+ [0x01c7, 1, 2, 1],
54
+ [0x01c8, 1, 1, 1],
55
+ [0x01ca, 1, 2, 1],
56
+ [0x01cb, 9, 1, 2],
57
+ [0x01de, 9, 1, 2],
58
+ [0x01f1, 1, 2, 1],
59
+ [0x01f2, 2, 1, 2],
60
+ [0x01f6, 1, -97, 1],
61
+ [0x01f7, 1, -56, 1],
62
+ [0x01f8, 20, 1, 2],
63
+ [0x0222, 9, 1, 2],
64
+ [0x0386, 1, 38, 1],
65
+ [0x0388, 3, 37, 1],
66
+ [0x038c, 1, 64, 1],
67
+ [0x038e, 2, 63, 1],
68
+ [0x0391, 27, 32, 1],
69
+ [0x03d8, 12, 1, 2],
70
+ [0x03f4, 1, -60, 1],
71
+ [0x0400, 16, 80, 1],
72
+ [0x0410, 32, 32, 1],
73
+ [0x0460, 17, 1, 2],
74
+ [0x048a, 27, 1, 2],
75
+ [0x04c1, 2, 1, 2],
76
+ [0x04c7, 1, 1, 1],
77
+ [0x04cb, 1, 1, 1],
78
+ [0x04d0, 21, 1, 2],
79
+ [0x0531, 38, 48, 1],
80
+ [0x10a0, 38, 48, 1],
81
+ [0x1e00, 75, 1, 2],
82
+ [0x1ea0, 45, 1, 2],
83
+ [0x1f08, 8, -8, 1],
84
+ [0x1f18, 6, -8, 1],
85
+ [0x1f28, 8, -8, 1],
86
+ [0x1f38, 8, -8, 1],
87
+ [0x1f48, 6, -8, 1],
88
+ [0x1f59, 4, -8, 2],
89
+ [0x1f68, 8, -8, 1],
90
+ [0x1f88, 8, -8, 1],
91
+ [0x1f98, 8, -8, 1],
92
+ [0x1fa8, 8, -8, 1],
93
+ [0x1fb8, 2, -8, 1],
94
+ [0x1fba, 2, -74, 1],
95
+ [0x1fbc, 1, -9, 1],
96
+ [0x1fc8, 4, -86, 1],
97
+ [0x1fcc, 1, -9, 1],
98
+ [0x1fd8, 2, -8, 1],
99
+ [0x1fda, 2, -100, 1],
100
+ [0x1fe8, 2, -8, 1],
101
+ [0x1fea, 2, -112, 1],
102
+ [0x1fec, 1, -7, 1],
103
+ [0x1ff8, 2, -128, 1],
104
+ [0x1ffa, 2, -126, 1],
105
+ [0x1ffc, 1, -9, 1],
106
+ [0x2126, 1, -7517, 1],
107
+ [0x212a, 1, -8383, 1],
108
+ [0x212b, 1, -8262, 1],
109
+ [0x2160, 16, 16, 1],
110
+ [0x24b6, 26, 26, 1],
111
+ [0xff21, 26, 32, 1],
112
+ ];
113
+ /** The upper case's runs, as the lower case's. */
114
+ const UPPER = [
115
+ [0x0061, 26, -32, 1],
116
+ [0x00e0, 23, -32, 1],
117
+ [0x00f8, 7, -32, 1],
118
+ [0x00ff, 1, 121, 1],
119
+ [0x0101, 24, -1, 2],
120
+ [0x0131, 1, -232, 1],
121
+ [0x0133, 3, -1, 2],
122
+ [0x013a, 8, -1, 2],
123
+ [0x014b, 23, -1, 2],
124
+ [0x017a, 3, -1, 2],
125
+ [0x017f, 1, -300, 1],
126
+ [0x0183, 2, -1, 2],
127
+ [0x0188, 1, -1, 1],
128
+ [0x018c, 1, -1, 1],
129
+ [0x0192, 1, -1, 1],
130
+ [0x0195, 1, 97, 1],
131
+ [0x0199, 1, -1, 1],
132
+ [0x01a1, 3, -1, 2],
133
+ [0x01a8, 1, -1, 1],
134
+ [0x01ad, 1, -1, 1],
135
+ [0x01b0, 1, -1, 1],
136
+ [0x01b4, 2, -1, 2],
137
+ [0x01b9, 1, -1, 1],
138
+ [0x01bd, 1, -1, 1],
139
+ [0x01bf, 1, 56, 1],
140
+ [0x01c5, 1, -1, 1],
141
+ [0x01c6, 1, -2, 1],
142
+ [0x01c8, 1, -1, 1],
143
+ [0x01c9, 1, -2, 1],
144
+ [0x01cb, 1, -1, 1],
145
+ [0x01cc, 1, -2, 1],
146
+ [0x01ce, 8, -1, 2],
147
+ [0x01dd, 1, -79, 1],
148
+ [0x01df, 9, -1, 2],
149
+ [0x01f2, 1, -1, 1],
150
+ [0x01f3, 1, -2, 1],
151
+ [0x01f5, 1, -1, 1],
152
+ [0x01f9, 20, -1, 2],
153
+ [0x0223, 9, -1, 2],
154
+ [0x0253, 1, -210, 1],
155
+ [0x0254, 1, -206, 1],
156
+ [0x0256, 2, -205, 1],
157
+ [0x0259, 1, -202, 1],
158
+ [0x025b, 1, -203, 1],
159
+ [0x0260, 1, -205, 1],
160
+ [0x0263, 1, -207, 1],
161
+ [0x0268, 1, -209, 1],
162
+ [0x0269, 1, -211, 1],
163
+ [0x026f, 1, -211, 1],
164
+ [0x0272, 1, -213, 1],
165
+ [0x0275, 1, -214, 1],
166
+ [0x0280, 1, -218, 1],
167
+ [0x0283, 1, -218, 1],
168
+ [0x0288, 1, -218, 1],
169
+ [0x028a, 2, -217, 1],
170
+ [0x0292, 1, -219, 1],
171
+ [0x0345, 1, 84, 1],
172
+ [0x03ac, 1, -38, 1],
173
+ [0x03ad, 3, -37, 1],
174
+ [0x03b1, 27, -32, 1],
175
+ [0x03cc, 1, -64, 1],
176
+ [0x03cd, 2, -63, 1],
177
+ [0x03d0, 1, -62, 1],
178
+ [0x03d1, 1, -57, 1],
179
+ [0x03d5, 1, -47, 1],
180
+ [0x03d6, 1, -54, 1],
181
+ [0x03d9, 12, -1, 2],
182
+ [0x03f0, 1, -86, 1],
183
+ [0x03f1, 1, -80, 1],
184
+ [0x03f2, 1, -79, 1],
185
+ [0x03f5, 1, -96, 1],
186
+ [0x0430, 32, -32, 1],
187
+ [0x0450, 16, -80, 1],
188
+ [0x0461, 17, -1, 2],
189
+ [0x048b, 27, -1, 2],
190
+ [0x04c2, 2, -1, 2],
191
+ [0x04c8, 1, -1, 1],
192
+ [0x04cc, 1, -1, 1],
193
+ [0x04d1, 21, -1, 2],
194
+ [0x0561, 38, -48, 1],
195
+ [0x1e01, 75, -1, 2],
196
+ [0x1e9b, 1, -59, 1],
197
+ [0x1ea1, 45, -1, 2],
198
+ [0x1f00, 8, 8, 1],
199
+ [0x1f10, 6, 8, 1],
200
+ [0x1f20, 8, 8, 1],
201
+ [0x1f30, 8, 8, 1],
202
+ [0x1f40, 6, 8, 1],
203
+ [0x1f51, 4, 8, 2],
204
+ [0x1f60, 8, 8, 1],
205
+ [0x1f70, 2, 74, 1],
206
+ [0x1f72, 4, 86, 1],
207
+ [0x1f76, 2, 100, 1],
208
+ [0x1f78, 2, 128, 1],
209
+ [0x1f7a, 2, 112, 1],
210
+ [0x1f7c, 2, 126, 1],
211
+ [0x1f80, 8, 8, 1],
212
+ [0x1f90, 8, 8, 1],
213
+ [0x1fa0, 8, 8, 1],
214
+ [0x1fb0, 2, 8, 1],
215
+ [0x1fb3, 1, 9, 1],
216
+ [0x1fbe, 1, -7205, 1],
217
+ [0x1fc3, 1, 9, 1],
218
+ [0x1fd0, 2, 8, 1],
219
+ [0x1fe0, 2, 8, 1],
220
+ [0x1fe5, 1, 7, 1],
221
+ [0x1ff3, 1, 9, 1],
222
+ [0x2170, 16, -16, 1],
223
+ [0x24d0, 26, -26, 1],
224
+ [0xff41, 26, -32, 1],
225
+ ];
226
+ /** A table of every code unit's mapping, made as it is first needed. */
227
+ function table(runs) {
228
+ const t = new Uint16Array(0x10000);
229
+ for (let i = 0; i < t.length; i++) {
230
+ t[i] = i;
231
+ }
232
+ for (const [start, count, delta, step] of runs) {
233
+ for (let i = 0; i < count; i++) {
234
+ const u = start + i * step;
235
+ t[u] = u + delta;
236
+ }
237
+ }
238
+ return t;
239
+ }
240
+ let lower = null;
241
+ let upper = null;
242
+ export function lowerCase(c) {
243
+ lower ??= table(LOWER);
244
+ return lower[c];
245
+ }
246
+ export function upperCase(c) {
247
+ upper ??= table(UPPER);
248
+ return upper[c];
249
+ }