@illgrenoble/webx-client 1.10.6 → 1.12.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 (65) hide show
  1. package/README.md +3 -1
  2. package/dist/GuacamoleKeyboard.js +1551 -0
  3. package/dist/WebXClient.d.ts +1 -1
  4. package/dist/WebXClient.js +1 -11
  5. package/dist/WebXClient.js.map +1 -1
  6. package/dist/common/WebXImageBlenderFunc.d.ts +26 -0
  7. package/dist/common/WebXSubImage.d.ts +50 -0
  8. package/dist/common/WebXWindowProperties.d.ts +44 -0
  9. package/dist/common/index.d.ts +3 -0
  10. package/dist/display/WebXCursor.d.ts +5 -17
  11. package/dist/display/WebXCursor.js +22 -33
  12. package/dist/display/WebXCursor.js.map +1 -1
  13. package/dist/display/WebXCursorFactory.d.ts +2 -2
  14. package/dist/display/WebXDisplay.d.ts +24 -10
  15. package/dist/display/WebXDisplay.js +94 -12
  16. package/dist/display/WebXDisplay.js.map +1 -1
  17. package/dist/display/WebXDisplayOverlay.d.ts +10 -0
  18. package/dist/display/WebXDisplayOverlay.js +31 -0
  19. package/dist/display/WebXDisplayOverlay.js.map +1 -0
  20. package/dist/display/WebXTexture.d.ts +6 -0
  21. package/dist/display/WebXTextureFunc.d.ts +3 -0
  22. package/dist/display/WebXWindow.d.ts +4 -4
  23. package/dist/display/WebXWindow.js +12 -9
  24. package/dist/display/WebXWindow.js.map +1 -1
  25. package/dist/display/WebXWindowImageFactory.d.ts +31 -0
  26. package/dist/display/index.d.ts +0 -6
  27. package/dist/index.d.ts +2 -0
  28. package/dist/message/WebXCursorImageMessage.d.ts +3 -3
  29. package/dist/message/WebXImageMessage.d.ts +4 -4
  30. package/dist/message/WebXMessage.d.ts +13 -1
  31. package/dist/message/WebXShapeMessage.d.ts +3 -3
  32. package/dist/message/WebXSubImagesMessage.d.ts +1 -1
  33. package/dist/message/WebXWindowsMessage.d.ts +1 -1
  34. package/dist/renderer/WebXAlphaStencilBlender.d.ts +30 -0
  35. package/dist/renderer/WebXAlphaStencilBlender.js +136 -0
  36. package/dist/renderer/WebXAlphaStencilBlender.js.map +1 -0
  37. package/dist/renderer/WebXCanvasRenderer.d.ts +91 -0
  38. package/dist/renderer/WebXCanvasRenderer.js +190 -0
  39. package/dist/renderer/WebXCanvasRenderer.js.map +1 -0
  40. package/dist/renderer/WebXImageBlender.d.ts +30 -0
  41. package/dist/renderer/WebXImageBlenderFunc.d.ts +8 -0
  42. package/dist/renderer/WebXImageBlenderWorker.d.ts +1 -0
  43. package/dist/renderer/WebXWindowCanvas.d.ts +133 -0
  44. package/dist/renderer/WebXWindowCanvas.js +312 -0
  45. package/dist/renderer/WebXWindowCanvas.js.map +1 -0
  46. package/dist/renderer/index.d.ts +3 -0
  47. package/dist/renderer/index.js +20 -0
  48. package/dist/renderer/index.js.map +1 -0
  49. package/dist/texture/WebXTexture.d.ts +18 -0
  50. package/dist/texture/WebXTextureFactory.d.ts +23 -0
  51. package/dist/texture/WebXTextureFunc.d.ts +3 -0
  52. package/dist/texture/index.d.ts +3 -0
  53. package/dist/transport/WebXBinarySerializer.d.ts +13 -8
  54. package/dist/transport/WebXMessageBuffer.d.ts +4 -0
  55. package/dist/transport/WebXMessageDecoder.d.ts +2 -5
  56. package/dist/transport/WebXMessageDecoderWorker.d.ts +1 -0
  57. package/dist/transport/WebXMessageFunc.d.ts +22 -0
  58. package/dist/transport/index.d.ts +0 -2
  59. package/dist/tunnel/WebXTunnel.d.ts +5 -2
  60. package/dist/tunnel/WebXWebSocketTunnel.d.ts +2 -4
  61. package/dist/webx-client.cjs +5391 -0
  62. package/dist/webx-client.cjs.map +1 -0
  63. package/dist/webx-client.esm.js +5322 -0
  64. package/dist/webx-client.esm.js.map +1 -0
  65. package/package.json +11 -9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webx-client.cjs","sources":["../src/common/WebXWindowProperties.ts","../src/common/WebXSubImage.ts","../src/common/WebXImageBlenderFunc.ts","../src/display/WebXMaterial.ts","../src/WebXEngine.ts","../src/texture/WebXTexture.ts","../src/texture/WebXTextureFactory.ts","../src/texture/WebXTextureFunc.ts","../src/display/WebXWindow.ts","../src/display/WebXCursor.ts","../src/renderer/WebXWindowCanvas.ts","../src/renderer/WebXImageBlender.ts","../src/renderer/WebXCanvasRenderer.ts","../src/display/WebXDisplayOverlay.ts","../src/message/WebXMessage.ts","../src/message/WebXMessageType.ts","../src/message/WebXScreenMessage.ts","../src/message/WebXWindowsMessage.ts","../src/message/WebXImageMessage.ts","../src/message/WebXSubImagesMessage.ts","../src/message/WebXMouseMessage.ts","../src/message/WebXCursorImageMessage.ts","../src/message/WebXPingMessage.ts","../src/message/WebXQualityMessage.ts","../src/message/WebXClipboardMessage.ts","../src/message/WebXConnectionMessage.ts","../src/message/WebXNopMessage.ts","../src/message/WebXShapeMessage.ts","../src/display/WebXDisplay.ts","../src/input/WebXKeyboard.ts","../src/input/mouse/WebXMouseState.ts","../src/input/WebXMouse.ts","../src/instruction/WebXInstruction.ts","../src/instruction/WebXInstructionResponse.ts","../src/instruction/WebXInstructionType.ts","../src/instruction/WebXConnectInstruction.ts","../src/instruction/WebXScreenInstruction.ts","../src/instruction/WebXWindowsInstruction.ts","../src/instruction/WebXImageInstruction.ts","../src/instruction/WebXMouseInstruction.ts","../src/instruction/WebXKeyboardInstruction.ts","../src/instruction/WebXCursorImageInstruction.ts","../src/instruction/WebXQualityInstruction.ts","../src/instruction/WebXPongInstruction.ts","../src/instruction/WebXDataAckInstruction.ts","../src/instruction/WebXClipboardInstruction.ts","../src/instruction/WebXShapeInstruction.ts","../src/tracer/WebXInstructionHandler.ts","../src/tracer/WebXMessageHandler.ts","../src/tracer/WebXStatsHandler.ts","../src/utils/WebXColorGenerator.ts","../src/utils/WebXVersion.ts","../src/tracer/WebXDebugImageMessageHandler.ts","../src/transport/WebXInstructionBuffer.ts","../src/transport/WebXMessageBuffer.ts","../src/transport/WebXInstructionEncoder.ts","../src/transport/WebXMessageDecoder.ts","../src/transport/WebXMessageFunc.ts","../src/transport/WebXBinarySerializer.ts","../src/tunnel/WebXTunnel.ts","../src/tunnel/WebXWebSocketTunnel.ts","../src/display/WebXCursorFactory.ts","../src/display/WebXWindowImageFactory.ts","../src/WebXConnectionHandler.ts","../src/WebXClient.ts"],"sourcesContent":["/**\n * Represents the properties of a WebX window.\n *\n * These properties define the position, size, and ID of a window in the WebX display.\n */\nexport class WebXWindowProperties {\n /**\n * The unique identifier of the window.\n */\n public readonly id: number;\n\n /**\n * The x-coordinate of the window.\n */\n public readonly x: number;\n\n /**\n * The y-coordinate of the window.\n */\n public readonly y: number;\n\n /**\n * The width of the window.\n */\n public readonly width: number;\n\n /**\n * The height of the window.\n */\n public readonly height: number;\n\n /**\n * Indicates whether the window is shaped (non rectangular).\n */\n public readonly shaped: boolean;\n\n /**\n * Creates a new instance of WebXWindowProperties.\n *\n * @param properties The properties of the window, including position, size, and ID.\n */\n constructor(properties: { id: number; x: number; y: number; width: number; height: number, shaped: boolean }) {\n this.id = properties.id;\n this.x = properties.x;\n this.y = properties.y;\n this.width = properties.width;\n this.height = properties.height;\n this.shaped = properties.shaped || false;\n }\n}\n","import {WebXTexture} from \"../texture\";\n\n/**\n * Represents a sub-image within a WebX window.\n *\n * A sub-image is a portion of a window's texture that can be updated independently.\n */\nexport class WebXSubImage {\n /**\n * The x-coordinate of the sub-image within the window.\n */\n public readonly x: number;\n\n /**\n * The y-coordinate of the sub-image within the window.\n */\n public readonly y: number;\n\n /**\n * The width of the sub-image.\n */\n public readonly width: number;\n\n /**\n * The height of the sub-image.\n */\n public readonly height: number;\n\n /**\n * The depth of the sub-image (e.g., 24-bit or 32-bit).\n */\n public readonly depth: number;\n\n /**\n * The color map texture of the sub-image.\n */\n public readonly colorMap: WebXTexture;\n\n /**\n * The alpha map texture of the sub-image.\n */\n public readonly alphaMap: WebXTexture;\n\n /**\n * Creates a new instance of WebXSubImage.\n *\n * @param properties The properties of the sub-image, including position, size, and textures.\n */\n constructor(properties: {\n x: number;\n y: number;\n width: number;\n height: number;\n depth: number;\n colorMap: WebXTexture;\n alphaMap: WebXTexture;\n }) {\n this.x = properties.x;\n this.y = properties.y;\n this.width = properties.width;\n this.height = properties.height;\n this.depth = properties.depth;\n this.colorMap = properties.colorMap;\n this.alphaMap = properties.alphaMap;\n }\n}\n","\n/**\n * The Alpha and stencil buffer blending function. The alpha buffer contains alpha data in the\n * green channel. The stencil buffer is a black and white image: only pixels with a stencil value > 127 are to be rendered\n * @param colorData the color data array\n * @param alphaData the alpha data array\n * @param stencilData the stencil data array\n */\nexport const alphaAndStencilBlend = (colorData: Uint8ClampedArray, alphaData: Uint8ClampedArray, stencilData: Uint8ClampedArray) => {\n if (alphaData && stencilData) {\n for (let i = 0; i < colorData.length; i += 4) {\n if (stencilData[i] < 128) {\n colorData[i + 3] = 0;\n\n } else {\n colorData[i + 3] = alphaData[i + 1];\n }\n }\n\n } else if (alphaData) {\n for (let i = 0; i < colorData.length; i += 4) {\n colorData[i + 3] = alphaData[i + 1];\n }\n\n } else if (stencilData) {\n for (let i = 0; i < colorData.length; i += 4) {\n colorData[i + 3] = stencilData[i] < 128 ? 0 : colorData[i + 3];\n }\n }\n}\n\n/**\n * The Alpha buffer blending function. The alpha buffer contains alpha data in the\n * green channel.\n * @param colorData the color data array\n * @param alphaData the alpha data array\n */\nexport const alphaBufferBlend = (colorData: Uint8ClampedArray, alphaData: Uint8ClampedArray) => {\n for (let i = 0; i < colorData.length; i += 4) {\n colorData[i + 3] = alphaData[i + 1];\n }\n}\n\n/**\n * The Alpha image blending function. The alpha image contains alpha image data\n * @param colorImage the color image array\n * @param alphaImage the alpha image\n */\nexport const colorAndAlphaBlendImageToImageData = (colorImage: ImageBitmap | HTMLImageElement, alphaImage: ImageBitmap | HTMLImageElement): ImageData => {\n\n const width = colorImage.width;\n const height = colorImage.height;\n\n // Create temporary canvas and context for image drawing\n const canvas = new OffscreenCanvas(width, height);\n\n const context = canvas.getContext('2d', {willReadFrequently: true});\n context.drawImage(colorImage, 0, 0);\n const colorImageData = context.getImageData(0, 0, width, height);\n\n context.drawImage(alphaImage, 0, 0);\n const alphaImageData = context.getImageData(0, 0, width, height);\n\n alphaBufferBlend(colorImageData.data, alphaImageData.data);\n\n return colorImageData;\n}\n\n/**\n * Draws an image to a canvas to obtain the raw image data\n * @param image the image\n */\nexport const imageToImageData = (image: ImageBitmap | HTMLImageElement): ImageData => {\n if (image) {\n const width = image.width;\n const height = image.height;\n\n // Create temporary canvas and context for image drawing\n const canvas = new OffscreenCanvas(width, height);\n\n const context = canvas.getContext('2d', {willReadFrequently: true});\n context.drawImage(image, 0, 0);\n return context.getImageData(0, 0, width, height);\n }\n\n return null;\n}\n","import {BackSide, Color, Matrix3, ShaderMaterial, Texture} from 'three';\n\n\n\nconst vertexShader = `\n#ifdef USE_MAP\nuniform mat3 mapTransform;\nvarying vec2 vMapUv;\n#endif\n\n#ifdef USE_ALPHAMAP\nuniform mat3 alphaMapTransform;\nvarying vec2 vAlphaMapUv;\n#endif\n\n#ifdef USE_STENCILMAP\nvarying vec2 vStencilMapUv;\n#endif\n\nvoid main() {\n#ifdef USE_MAP\n vMapUv = (mapTransform * vec3(uv, 1)).xy;\n#endif\n\n#ifdef USE_ALPHAMAP\n vAlphaMapUv = (alphaMapTransform * vec3(uv, 1)).xy;\n#endif\n\n#ifdef USE_STENCILMAP\n vStencilMapUv = uv;\n#endif\n\n gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.0);\n}\n`;\n\nconst fragmentShader = `\nuniform vec3 diffuse;\nuniform float opacity;\n\n#ifdef USE_MAP\nuniform sampler2D map;\nvarying vec2 vMapUv;\n#endif\n\n#ifdef USE_ALPHAMAP\nuniform sampler2D alphaMap;\nvarying vec2 vAlphaMapUv;\n#endif\n\n#ifdef USE_STENCILMAP\nuniform sampler2D stencilMap;\nvarying vec2 vStencilMapUv;\n#endif\n\nvoid main() {\n vec4 diffuseColor = vec4(diffuse, opacity);\n\n#ifdef USE_STENCILMAP\n vec4 stencil = texture2D(stencilMap, vStencilMapUv);\n if (stencil.r < 0.5) {\n discard;\n }\n#endif\n\n#ifdef USE_MAP\n vec4 sampledDiffuseColor = texture2D(map, vMapUv);\n diffuseColor *= sampledDiffuseColor;\n#endif\n\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D(alphaMap, vAlphaMapUv).g;\n#endif\n\n gl_FragColor = diffuseColor;\n gl_FragColor = linearToOutputTexel( gl_FragColor );\n}\n`;\n\nexport class WebXMaterial extends ShaderMaterial {\n\n get map(): Texture {\n return this.uniforms.map.value;\n }\n\n set map(value: Texture) {\n this.uniforms.map.value = value;\n }\n\n get alphaMap(): Texture {\n return this.uniforms.alphaMap.value;\n }\n\n set alphaMap(value: Texture) {\n this.uniforms.alphaMap.value = value;\n }\n\n get stencilMap(): Texture {\n return this.uniforms.stencilMap.value;\n }\n\n set stencilMap(value: Texture) {\n this.uniforms.stencilMap.value = value;\n if (value) {\n this.defines.USE_STENCILMAP = '';\n } else {\n delete this.defines.USE_STENCILMAP;\n }\n }\n\n get color(): Color {\n return this.uniforms.diffuse.value;\n }\n\n set color(value: Color) {\n this.uniforms.diffuse.value.copy(value);\n }\n\n constructor(params?: any) {\n super({\n uniforms: {\n map: { value: null },\n alphaMap: { value: null },\n stencilMap: { value: null },\n mapTransform: { value: new Matrix3() },\n alphaMapTransform: { value: new Matrix3() },\n diffuse: { value: new Color(0xffffff) },\n opacity: { value: 1.0 },\n },\n vertexShader,\n fragmentShader,\n transparent: true,\n depthTest: true,\n side: BackSide,\n });\n\n if (params && params.color) {\n this.color.set(params.color);\n }\n }\n\n onBeforeRender(): void {\n if (this.map && this.map.matrixAutoUpdate) {\n this.map.updateMatrix();\n this.uniforms.mapTransform.value.copy(this.map.matrix);\n }\n\n if (this.alphaMap && this.alphaMap.matrixAutoUpdate) {\n this.alphaMap.updateMatrix();\n this.uniforms.alphaMapTransform.value.copy(this.alphaMap.matrix);\n }\n }\n\n}\n","import {WebXVersion} from \"./utils\";\n\nexport class WebXEngine {\n\n public static version: WebXVersion;\n\n}\n","\nexport const SRGBColorSpace = 'srgb';\nexport const LinearSRGBColorSpace = 'srgb-linear';\n\nexport class WebXTexture {\n image: ImageBitmap | HTMLImageElement;\n data: Uint8ClampedArray;\n colorSpace: string;\n flipY: boolean;\n width: number;\n height: number;\n\n constructor(data: {image?: ImageBitmap | HTMLImageElement, data?: Uint8ClampedArray, width?: number, height?: number}) {\n this.image = data.image ? data.image : null;\n this.data = data.data;\n this.width = data.image ? data.image.width : data.width;\n this.height = data.image ? data.image.height : data.height;\n this.colorSpace = SRGBColorSpace\n this.flipY = false;\n }\n\n isTransferable(): boolean {\n return (this.image && this.image instanceof ImageBitmap) || (this.data != null);\n }\n\n get transferable(): Transferable {\n if (this.image && this.image instanceof ImageBitmap) {\n return this.image;\n } else if (this.data) {\n return this.data.buffer;\n }\n return null;\n }\n}\n\n","import {WebXTexture} from \"./WebXTexture\";\n\n/**\n * Factory class for creating textures for WebX windows from image data.\n */\nexport class WebXTextureFactory {\n\n constructor() {}\n\n /**\n * Creates a texture from raw image data.\n *\n * @param imageData The raw image data as a Uint8Array.\n * @param mimetype The MIME type of the image data (e.g., \"image/png\").\n * @param colorSpace The color space of the image data (e.g., \"srgb\").\n * @returns A promise that resolves to the created texture.\n */\n public async createTextureFromArray(imageData: Uint8Array, mimetype: string, colorSpace: string): Promise<WebXTexture> {\n if (imageData != null && imageData.byteLength > 0) {\n const blob = new Blob([imageData], { type: mimetype });\n const texture = await this.createTextureFromBlob(blob);\n\n\n texture.flipY = false;\n texture.colorSpace = colorSpace;\n\n return texture;\n\n } else {\n return null;\n }\n }\n\n /**\n * Creates a texture from a Blob object.\n *\n * @param blob The Blob object containing the image data.\n * @returns A promise that resolves to the created texture.\n */\n public createTextureFromBlob(blob: Blob): Promise<WebXTexture> {\n // not supported by all of the browsers at the moment\n // https://caniuse.com/createimagebitmap\n if (typeof createImageBitmap === 'function') {\n return new Promise<WebXTexture>((resolve, reject) => {\n createImageBitmap(blob)\n .then(bitmap => {\n const texture = new WebXTexture({image: bitmap});\n\n resolve(texture);\n })\n .catch(error => {\n console.warn(`Failed to create texture using createImageBitmap from binary data: ${error}`);\n reject(error);\n });\n });\n\n } else {\n return new Promise<WebXTexture>((resolve, reject) => {\n // fall back to the standard way of creating an image\n const url = URL.createObjectURL(blob);\n const image: HTMLImageElement = new Image();\n image.onload = () => {\n URL.revokeObjectURL(url);\n\n const texture = new WebXTexture({image});\n\n resolve(texture);\n };\n\n image.onerror = (error) => {\n console.warn(`Failed to create texture from binary data: ${error}`);\n reject(error);\n }\n\n image.src = url;\n });\n }\n }\n}\n","import * as THREE from 'three';\nimport {WebXTexture} from \"./WebXTexture\";\nimport {LinearFilter} from \"three\";\n\nexport const toThreeTexture = (texture: WebXTexture): THREE.Texture => {\n if (texture) {\n const threeTexture = texture.data ? new THREE.DataTexture(texture.data, texture.width, texture.height) : new THREE.Texture(texture.image);\n threeTexture.needsUpdate = true;\n threeTexture.flipY = texture.flipY;\n threeTexture.colorSpace = texture.colorSpace;\n threeTexture.minFilter = LinearFilter;\n\n return threeTexture;\n }\n\n return null;\n}\n","import * as THREE from 'three';\nimport { WebXMaterial } from './WebXMaterial';\nimport { Texture, LinearFilter } from 'three';\nimport {WebXEngine} from \"../WebXEngine\";\nimport {WebXWindowImageFactory} from \"./WebXWindowImageFactory\";\nimport {toThreeTexture} from \"../texture\";\n\n/**\n * Represents a window in the WebX display.\n *\n * This class manages the rendering of a single window, including its position,\n * size, and texture updates.\n */\nexport class WebXWindow {\n public static WINDOW_REFRESH_TIME_MS = 5000;\n private static _PLANE_GEOMETRY: THREE.PlaneGeometry = new THREE.PlaneGeometry(1.0, 1.0, 2, 2);\n private static _COLOR_INDEX = 0;\n\n private readonly _windowImageFactory: WebXWindowImageFactory;\n private readonly _colorIndex: number;\n private readonly _id: number;\n private readonly _material: WebXMaterial;\n private readonly _mesh: THREE.Mesh;\n private _depth: number;\n\n private _x: number;\n private _y: number;\n private _z: number;\n private _width: number = 1;\n private _height: number = 1;\n private _shaped: boolean = false;\n private _loaded: boolean = false;\n\n private _windowRefreshTimeout: number = null;\n\n /**\n * Gets the THREE.js mesh representing the window.\n *\n * @returns The window mesh.\n */\n public get mesh(): THREE.Mesh {\n return this._mesh;\n }\n\n /**\n * Gets the color index of the window.\n *\n * @returns The color index as a number.\n */\n get colorIndex(): number {\n return this._colorIndex;\n }\n\n /**\n * Gets the unique ID of the window.\n *\n * @returns The window ID as a number.\n */\n public get id(): number {\n return this._id;\n }\n\n /**\n * Gets the visibility status of the window.\n *\n * @returns True if the window is visible, false otherwise.\n */\n public get visible(): boolean {\n return this._material.visible;\n }\n\n /**\n * Sets the visibility status of the window.\n *\n * @param visible True to make the window visible, false to hide it.\n */\n private set visible(visible: boolean) {\n if (this._material.visible !== visible) {\n this._material.visible = visible;\n }\n }\n\n\n /**\n * Gets whether the window has been loaded with its initial texture.\n */\n get loaded(): boolean {\n return this._loaded;\n }\n\n /**\n * Gets the color map texture of the window.\n *\n * @returns The color map as a Texture.\n */\n public get colorMap(): Texture {\n return this._material.map;\n }\n\n /**\n * Sets the color map texture of the window.\n *\n * @param colorMap The new color map as a Texture.\n */\n private set colorMap(colorMap: Texture) {\n this._material.map = colorMap;\n }\n\n /**\n * Gets the alpha map texture of the window.\n *\n * @returns The alpha map as a Texture.\n */\n get alphaMap(): Texture {\n return this._material.alphaMap;\n }\n\n /**\n * Sets the alpha map texture of the window.\n *\n * @param alphaMap The new alpha map as a Texture.\n */\n private set alphaMap(alphaMap: Texture) {\n this._material.alphaMap = alphaMap;\n }\n\n /**\n * Gets the stencil map texture of the window.\n *\n * @returns The stencil map as a Texture.\n */\n get stencilMap(): Texture {\n return this._material.stencilMap;\n }\n\n /**\n * Sets the stencil map texture of the window.\n *\n * @param stencilMap The new stencil map as a Texture.\n */\n private set stencilMap(stencilMap: Texture) {\n this._material.stencilMap = stencilMap;\n }\n\n /**\n * Checks if the color map is valid.\n *\n * @returns True if the color map is valid, false otherwise.\n */\n public get colorMapValid(): boolean {\n return this.colorMap != null && this.colorMap.image.width === this._width && this.colorMap.image.height === this._height;\n }\n\n /**\n * Gets the depth of the window.\n *\n * @returns The depth as a number.\n */\n public get depth(): number {\n return this._depth;\n }\n\n /**\n * Gets the x-coordinate of the window.\n *\n * @returns The x-coordinate as a number.\n */\n get x(): number {\n return this._x;\n }\n\n /**\n * Sets the x-coordinate of the window.\n *\n * @param value The new x-coordinate as a number.\n */\n public set x(value: number) {\n this._x = value;\n this._updatePosition();\n }\n\n /**\n * Gets the y-coordinate of the window.\n *\n * @returns The y-coordinate as a number.\n */\n get y(): number {\n return this._y;\n }\n\n /**\n * Sets the y-coordinate of the window.\n *\n * @param value The new y-coordinate as a number.\n */\n public set y(value: number) {\n this._y = value;\n this._updatePosition();\n }\n\n /**\n * Gets the z-index of the window.\n *\n * @returns The z-index as a number.\n */\n get z(): number {\n return this._z;\n }\n\n /**\n * Sets the z-index of the window.\n *\n * @param value The new z-index as a number.\n */\n public set z(value: number) {\n this._z = value;\n this._updatePosition();\n }\n\n /**\n * Gets the width of the window.\n *\n * @returns The width as a number.\n */\n get width(): number {\n return this._width;\n }\n\n /**\n * Sets the width of the window.\n *\n * @param value The new width as a number.\n */\n public set width(value: number) {\n this._width = value;\n this._updateScale();\n this._updatePosition();\n }\n\n /**\n * Gets the height of the window.\n *\n * @returns The height as a number.\n */\n get height(): number {\n return this._height;\n }\n\n /**\n * Sets the height of the window.\n *\n * @param value The new height as a number.\n */\n public set height(value: number) {\n this._height = value;\n this._updateScale();\n this._updatePosition();\n }\n\n /**\n * Gets whether the window is shaped (has a stencil map).\n *\n * @return True if the window is shaped, false otherwise.\n */\n get shaped(): boolean {\n return this._shaped;\n }\n\n /**\n * Sets whether the window is shaped (has a stencil map).\n * @param value True to indicate the window is shaped, false otherwise.\n */\n set shaped(value: boolean) {\n this._shaped = value;\n if (!value) {\n this.updateStencilTexture(null);\n }\n }\n\n /**\n * Creates a new instance of WebXWindow.\n *\n * @param configuration The properties of the window, such as position and size.\n * @param windowImageFactory The factory used to create textures for the window.\n */\n constructor(configuration: { id: number; x: number; y: number; z: number; width: number; height: number; shaped: boolean }, windowImageFactory: WebXWindowImageFactory) {\n this._windowImageFactory = windowImageFactory;\n this._colorIndex = WebXWindow._COLOR_INDEX++;\n\n // this._material = new THREE.MeshBasicMaterial({ transparent: true });\n // this._material.side = THREE.BackSide;\n this._material = new WebXMaterial();\n\n // Wait for texture before rendering the window\n this.visible = false;\n\n const { id, x, y, z, width, height, shaped } = configuration;\n this._id = id;\n this._mesh = new THREE.Mesh(WebXWindow._PLANE_GEOMETRY, this._material);\n this._mesh.onBeforeRender = () => this._material.onBeforeRender();\n\n this._x = x;\n this._y = y;\n this._z = z;\n this._width = width;\n this._height = height;\n this._shaped = shaped && WebXEngine.version.versionNumber >= 1.4;\n this._updateScale();\n this._updatePosition();\n }\n\n /**\n * Loads the window image from the texture factory.\n */\n private async loadWindowImage(): Promise<void> {\n const response = await this._windowImageFactory.getWindowTexture(this._id);\n if (response) {\n this.updateTexture(response.depth, toThreeTexture(response.colorMap), toThreeTexture(response.alphaMap), true);\n }\n }\n\n /**\n * Loads the window shape (stencil map) from the texture factory.\n */\n private async loadWindowShape(): Promise<void> {\n const response = await this._windowImageFactory.getWindowStencilTexture(this._id);\n if (response) {\n this.updateStencilTexture(toThreeTexture(response.stencilMap));\n } else {\n this._shaped = false;\n this.visible = this.colorMap != null;\n }\n }\n\n /**\n * Loads the window image and shape (if needed) from the texture factory.\n */\n public async loadWindowImageAndShape(): Promise<void> {\n if (this._shaped) {\n const imagePromise = this.loadWindowImage();\n const shapePromise = this.loadWindowShape();\n await Promise.all([imagePromise, shapePromise]);\n\n } else {\n await this.loadWindowImage();\n }\n this._loaded = true;\n }\n\n /**\n * Updates the position and size of the window.\n *\n * @param x The x-coordinate of the window.\n * @param y The y-coordinate of the window.\n * @param z The z-index of the window.\n * @param width The width of the window.\n * @param height The height of the window.\n */\n public setRectangle(x: number, y: number, z: number, width: number, height: number): void {\n this._x = x;\n this._y = y;\n this._z = z;\n this._width = width;\n this._height = height;\n\n if (this.colorMap) {\n this.colorMap.repeat.set(this._width / this.colorMap.image.width, this._height / this.colorMap.image.height);\n\n if (this.alphaMap) {\n this.alphaMap.repeat.set(this._width / this.alphaMap.image.width, this._height / this.alphaMap.image.height);\n }\n\n // Force reload of image of dimensions differ\n if (this.colorMap.image.width !== this._width || this.colorMap.image.height !== this._height) {\n this.loadWindowImageAndShape();\n }\n }\n\n this._updateScale();\n this._updatePosition();\n }\n\n /**\n * Updates the textures of the window with new image data.\n *\n * @param depth The depth of the image.\n * @param colorMap The color texture.\n * @param alphaMap The alpha texture.\n * @param isFullWindow Whether to force an update of the textures.\n */\n public updateTexture(depth: number, colorMap: Texture, alphaMap: Texture, isFullWindow: boolean): void {\n // Ignore null color maps (engine unable to get the window image\n if (colorMap == null) {\n return;\n }\n\n const hasColorMapStart = this.colorMap != null;\n const hasAlphaMapStart = this.alphaMap != null;\n\n this._depth = depth;\n\n // Dispose of previous texture\n if (colorMap != this.colorMap) {\n this._disposeColorMap();\n this.colorMap = colorMap;\n }\n\n this.colorMap.repeat.set(this._width / this.colorMap.image.width, this._height / this.colorMap.image.height);\n this.visible = (!this._shaped || this.stencilMap != null);\n\n // Only update alpha if it has been sent\n if (alphaMap) {\n if (alphaMap != this.alphaMap) {\n this._disposeAlphaMap();\n this.alphaMap = alphaMap;\n }\n this.alphaMap.repeat.set(this._width / this.alphaMap.image.width, this._height / this.alphaMap.image.height);\n\n } else if (depth == 24) {\n this._disposeAlphaMap();\n }\n\n this._material.transparent = (this.alphaMap != null || depth === 32);\n\n const hasColorMapEnd = this.colorMap != null;\n const hasAlphaMapEnd = this.alphaMap != null;\n\n // Recompile the material if map usage changes\n if (hasColorMapStart != hasColorMapEnd || hasAlphaMapStart != hasAlphaMapEnd) {\n this._material.needsUpdate = true;\n }\n\n // Request a window update if it's not a full window\n if (!isFullWindow) {\n if (this._windowRefreshTimeout) {\n clearTimeout(this._windowRefreshTimeout);\n this._windowRefreshTimeout = null;\n }\n this._windowRefreshTimeout = window.setTimeout(() => {\n this._windowRefreshTimeout = null;\n this.loadWindowImage().then();\n }, WebXWindow.WINDOW_REFRESH_TIME_MS);\n }\n }\n\n /**\n * Updates the stencil map texture of the window with new image data.\n *\n * @param stencilMap The stencil map texture.\n */\n public updateStencilTexture(stencilMap: Texture): void {\n // Dispose of previous texture\n const oldShaped = this._shaped;\n if (stencilMap != this.stencilMap) {\n this._disposeStencilMap();\n this.stencilMap = stencilMap;\n }\n\n if (stencilMap) {\n stencilMap.minFilter = LinearFilter;\n this.visible = this.colorMap != null;\n this._shaped = true;\n\n } else {\n this._shaped = false;\n }\n\n // Recompile the material if needed\n if (oldShaped !== this._shaped) {\n this._material.needsUpdate = true;\n }\n }\n\n /**\n * Updates the scale of the window mesh based on its width and height.\n */\n private _updateScale(): void {\n this._mesh.scale.set(this._width, this._height, 1);\n }\n\n /**\n * Updates the position of the window mesh based on its x, y, and z coordinates.\n */\n private _updatePosition(): void {\n this._mesh.position.set(this._x + 0.5 * this._width, this._y + 0.5 * this._height, this._z);\n }\n\n /**\n * Disposes of the resources used by the window.\n */\n dispose(): void {\n this._disposeColorMap();\n this._disposeAlphaMap();\n this._disposeStencilMap();\n this._material.dispose();\n if (this._windowRefreshTimeout) {\n clearTimeout(this._windowRefreshTimeout);\n this._windowRefreshTimeout = null;\n }\n }\n\n /**\n * Disposes of the color map texture, releasing its resources.\n */\n private _disposeColorMap(): void {\n if (this.colorMap) {\n this.colorMap.dispose();\n this.colorMap = null;\n }\n }\n\n /**\n * Disposes of the alpha map texture, releasing its resources.\n */\n private _disposeAlphaMap(): void {\n if (this.alphaMap) {\n this.alphaMap.dispose();\n this.alphaMap = null;\n }\n }\n\n /**\n * Disposes of the stencil map texture, releasing its resources.\n */\n private _disposeStencilMap(): void {\n if (this.stencilMap) {\n this.stencilMap.dispose();\n this.stencilMap = null;\n }\n }\n}\n","import { WebXCursorFactory } from './WebXCursorFactory';\nimport {WebXTexture} from \"../texture\";\n\n/**\n * Represents the cursor in the WebX display.\n *\n * This class manages the cursor's position, appearance, and updates based on\n * the cursor ID and coordinates provided by the WebX Engine.\n */\nexport class WebXCursor {\n private _cursorId: number;\n private _texture: WebXTexture;\n\n private readonly _canvas: HTMLCanvasElement;\n private readonly _context: CanvasRenderingContext2D;\n\n private _x: number = -1;\n private _y: number = -1;\n private _xHot: number = 0;\n private _yHot: number = 0;\n private _width: number = 1;\n private _height: number = 1;\n\n /**\n * Gets the HTML Canvas containing the cursor image.\n *\n * @returns The cursor canvas.\n */\n get canvas(): HTMLCanvasElement {\n return this._canvas;\n }\n\n /**\n * Gets the cursor ID.\n *\n * @returns The cursor ID.\n */\n public get cursorId(): number {\n return this._cursorId;\n }\n\n /**\n * Sets the x-coordinate of the cursor.\n *\n * @param value The x-coordinate.\n */\n public set x(value: number) {\n this._x = value;\n this._updatePosition();\n }\n\n /**\n * Sets the y-coordinate of the cursor.\n *\n * @param value The y-coordinate.\n */\n public set y(value: number) {\n this._y = value;\n this._updatePosition();\n }\n\n /**\n * Creates a new instance of WebXCursor.\n *\n * @param _cursorFactory The factory used to create cursor textures.\n */\n constructor(private _cursorFactory: WebXCursorFactory) {\n this._canvas = document.createElement('canvas');\n this._canvas.id = 'webx-cursor';\n this._canvas.style.position = 'absolute';\n this._canvas.style.pointerEvents = 'none';\n this._context = this._canvas.getContext('2d');\n\n this.setPosition(-1, -1);\n this.setCursorId(0);\n }\n\n /**\n * Sets the position of the cursor.\n *\n * @param x The x-coordinate of the cursor.\n * @param y The y-coordinate of the cursor.\n */\n public setPosition(x: number, y: number): void {\n this._x = x;\n this._y = y;\n\n this._updatePosition();\n }\n\n /**\n * Updates the cursor's position and appearance based on the given cursor ID and coordinates.\n *\n * @param cursorId The ID of the cursor to display.\n */\n public setCursorId(cursorId: number): void {\n if (this._cursorId === cursorId) {\n return;\n }\n\n this._cursorId = cursorId;\n this._cursorFactory.getCursor(cursorId).then(cursorData => {\n const cursor = cursorData.cursor;\n\n if (this._x < 0 || this._y < 0) {\n this.setPosition(cursorData.x, cursorData.y);\n }\n\n this._updateCursor(cursor.xHot, cursor.yHot, cursor.cursorId, cursor.texture);\n });\n }\n\n /**\n * Updates the mouse cursor, appearance, and texture.\n *\n * @param xHot The x-coordinate of the cursor's hotspot.\n * @param yHot The y-coordinate of the cursor's hotspot.\n * @param cursorId The ID of the cursor to display.\n * @param texture The texture of the cursor.\n */\n private _updateCursor(xHot: number, yHot: number, cursorId: number, texture: WebXTexture): void {\n this._xHot = xHot;\n this._yHot = yHot;\n this._cursorId = cursorId;\n\n if (texture != null && texture.image != null) {\n this._width = texture.image.width;\n this._height = texture.image.height;\n // console.log(`WebXCursor ${cursorId}: ${xHot}, ${yHot}, ${this._width}, ${this._height}`);\n\n this._canvas.style.width = `${this._width}px`;\n this._canvas.style.height = `${this._height}px`;\n this._canvas.width = this._width;\n this._canvas.height = this._height;\n\n // Draw the texture onto the canvas\n this._texture = texture;\n this._context.clearRect(0, 0, this._width, this._height);\n this._context.drawImage(this._texture.image, 0, 0, this._width, this._height);\n }\n }\n\n /**\n * Updates the position of the cursor mesh based on its coordinates and hotspot.\n */\n private _updatePosition(): void {\n this._canvas.style.left = `${this._x - this._xHot}px`;\n this._canvas.style.top = `${this._y - this._yHot}px`;\n }\n}\n","import {DataTexture, Mesh, MeshBasicMaterial, Texture, TextureImageData, Vector2} from \"three\";\nimport {WebXMaterial} from \"../display/WebXMaterial\";\nimport {WebXImageBlender} from \"./WebXImageBlender\";\n\ntype RegionUpdate = {\n srcColorMap: Texture;\n dstColorMap: Texture;\n srcAlphaMap: Texture;\n dstAlphaMap: Texture;\n width: number;\n height: number;\n dstPosition: Vector2\n}\n\n/**\n * The `WebXWindowCanvas` class holds the graphical elements necessary for rendering\n * a specific window in the desktop environment. HTML Canvases are used for rendering image data. Window image data\n * is received in the form of color, alpha and stencil buffers. These are blended to produce the final window image.\n */\nexport class WebXWindowCanvas {\n\n private readonly _canvas: HTMLCanvasElement;\n private _context: CanvasRenderingContext2D;\n\n private _stencilData: ImageData;\n\n private _x: number = 0;\n private _y: number = 0;\n private _zIndex: number = 0;\n private _width: number = 0;\n private _height: number = 0;\n\n private _colorMap: Texture;\n private _alphaMap: Texture;\n private _stencilMap: Texture;\n\n private _regionUpdates: RegionUpdate[] = [];\n\n /**\n * Gets the unique ID of the associated mesh.\n */\n get id(): number {\n return this._mesh.id;\n }\n\n /**\n * Returns the window canvas\n */\n get canvas(): HTMLCanvasElement {\n return this._canvas;\n }\n\n /**\n * Returns the left-hand x coordinate of the window\n */\n get x(): number {\n return this._x;\n }\n\n /**\n * Returns the top y coordinate of the window\n */\n get y(): number {\n return this._y;\n }\n\n /**\n * Returns the zIndex of the window\n */\n get zIndex(): number {\n return this._zIndex;\n }\n\n /**\n * Returns the width of the window\n */\n get width(): number {\n return this._width;\n }\n\n /**\n * Returns the height of the window\n */\n get height(): number {\n return this._height;\n }\n\n /**\n * Initializes a new `WebXWindowCanvas` for the given window Mesh and Material. The Mesh and Material contains all graphical information\n * necessary to render a window (namely window position, size and z-order), the Mesh Material contains the graphical information (color, alpha and stencil data).\n * @param _mesh - The `Mesh` object representing the window.\n * @param _imageBlender - The image blender instance.\n */\n constructor(private readonly _mesh: Mesh,\n private readonly _imageBlender: WebXImageBlender) {\n this._canvas = this.createElementNS('canvas') as HTMLCanvasElement;\n this._canvas.id = `webx-window-${this.id}`;\n this._canvas.style.position = 'absolute';\n this._canvas.style.pointerEvents = 'none';\n this._canvas.style.top = '0';\n this._canvas.style.left = '0';\n this._canvas.style.overflow = 'hidden';\n\n this._context = this._canvas.getContext('2d');\n\n this.updateGeometry();\n this.updateCanvas();\n }\n\n /**\n * Updates the geometry of the window canvas based on the mesh's properties if any changes are needed.\n */\n public updateGeometry() {\n const width = this._mesh.scale.x;\n const height = this._mesh.scale.y;\n const x = this._mesh.position.x - 0.5 * width;\n const y = this._mesh.position.y - 0.5 * height;\n const zIndex = this._mesh.position.z;\n\n if (x !== this._x || y !== this._y) {\n this._canvas.style.top = `${y}px`;\n this._canvas.style.left = `${x}px`;\n this._x = x;\n this._y = y;\n }\n\n if (width !== this._width || height !== this._height) {\n // this._canvas.style.width = `${width}px`;\n // this._canvas.style.height = `${height}px`;\n\n this._width = width;\n this._height = height;\n }\n\n if (zIndex !== this._zIndex) {\n this._canvas.style.zIndex = `${this._mesh.position.z}`;\n this._zIndex = zIndex;\n }\n }\n\n /**\n * Updates the canvas content using the material textures (color, alpha and stencil buffers)\n * if any changes have occurred.\n */\n public async updateCanvas() {\n if (this._mesh.material instanceof WebXMaterial || this._mesh.material instanceof MeshBasicMaterial) {\n const material = this._mesh.material as WebXMaterial | MeshBasicMaterial;\n\n // Handle the stencil map\n this.updateStencilMap(material);\n\n if (material.map?.image) {\n\n // Check for new color map and/or alpha map\n const updateCanvas = material.map != this._colorMap || material.alphaMap != this._alphaMap;\n if (updateCanvas) {\n this._colorMap = material.map;\n this._alphaMap = material.alphaMap;\n\n const colorImage = material.map.image;\n\n const width = colorImage.width;\n const height = colorImage.height;\n\n if (this.isValidAlphaMap(material.alphaMap) || this._stencilMap != null) {\n const blendedImageData = await this.blendAlphaAndStencil(material.map, material.alphaMap, 0, 0);\n this.resizeCanvas(width, height);\n this._context.putImageData(blendedImageData, 0, 0);\n\n } else {\n this.resizeCanvas(width, height);\n if (material.map instanceof DataTexture) {\n const imageData = this.dataTextureToImageData(colorImage);\n this._context.putImageData(imageData, 0, 0);\n\n } else {\n this._context.clearRect(0, 0, width, height);\n this._context.drawImage(colorImage, 0, 0, width, height);\n }\n }\n }\n\n // Apply any regional updates\n await this.handleRegionUpdates();\n\n } else {\n if (this._colorMap) {\n this._colorMap = null;\n this._alphaMap = null;\n this._regionUpdates = [];\n this._context.clearRect(0, 0, this._canvas.width, this._canvas.height);\n }\n }\n }\n }\n\n /**\n * Adds a region update to the canvas taking into account the color, alpha and stencil buffers. Here we store a simple\n * array of all the updates necessary for this frame. The updates are taken into account in the next rendering request of the window\n * (and are only applied if the destination buffers have not been replaced).\n * @param srcColorMap - The source color texture.\n * @param dstColorMap - The destination color texture.\n * @param srcAlphaMap - The source alpha texture.\n * @param dstAlphaMap - The destination alpha texture.\n * @param width - The width of the region to update.\n * @param height - The height of the region to update.\n * @param dstPosition - The destination position of the region.\n */\n public addRegionUpdate(srcColorMap: Texture, dstColorMap: Texture, srcAlphaMap: Texture, dstAlphaMap: Texture, width: number, height: number, dstPosition: Vector2) {\n this._regionUpdates.push({\n srcColorMap,\n dstColorMap,\n srcAlphaMap,\n dstAlphaMap,\n width,\n height,\n dstPosition,\n });\n }\n\n private resizeCanvas(width: number, height: number): void {\n if (this._canvas.width !== width || this._canvas.height !== height) {\n this._canvas.width = width;\n this._canvas.height = height;\n this._canvas.style.width = `${width}px`;\n this._canvas.style.height = `${height}px`;\n }\n }\n\n /**\n * Handles all pending region updates for the canvas. The different buffers (color, alpha and stencil) are blended (in a web\n * worker if available) and then re-rendered into the main canvas of the window. If the window has only a color buffer then this\n * is rendered immediately into the main canvas.\n */\n private async handleRegionUpdates(): Promise<void> {\n for (const region of this._regionUpdates) {\n if (region.dstColorMap === this._colorMap && region.dstAlphaMap === this._alphaMap) {\n const { srcColorMap, srcAlphaMap, width, height, dstPosition } = region;\n\n const colorImage = srcColorMap.image;\n if (srcAlphaMap || this._stencilData) {\n const blendedImageData = await this.blendAlphaAndStencil(srcColorMap, srcAlphaMap, dstPosition.x, dstPosition.y);\n if (blendedImageData) {\n this._context.putImageData(blendedImageData, dstPosition.x, dstPosition.y);\n }\n\n } else {\n if (srcColorMap instanceof DataTexture) {\n const imageData = this.dataTextureToImageData(colorImage);\n this._context.putImageData(imageData, dstPosition.x, dstPosition.y);\n\n } else {\n this._context.drawImage(colorImage, 0, 0, width, height, dstPosition.x, dstPosition.y, width, height) ;\n }\n }\n }\n }\n\n this._regionUpdates = [];\n }\n\n /**\n * Checks if the provided alpha map is valid for the canvas (dimensions are equal).\n * @param alphaMap - The alpha texture to validate.\n * @returns `true` if the alpha map is valid, otherwise `false`.\n */\n private isValidAlphaMap(alphaMap: Texture): boolean {\n if (alphaMap) {\n const width = alphaMap.image.width;\n const height = alphaMap.image.height;\n return width === this._canvas.width && height === this._canvas.height;\n }\n return false;\n }\n\n /**\n * Updates the stencil map for the window if it exists in the material and has changed.\n * @param material - The material of the associated mesh.\n */\n private updateStencilMap(material: WebXMaterial | MeshBasicMaterial) {\n // Get stencil map if it exists, remove it if no longer needed\n if (material instanceof WebXMaterial && material.stencilMap) {\n if (material.stencilMap != this._stencilMap) {\n this._stencilMap = material.stencilMap;\n const stencilImage = this._stencilMap.image;\n const {width, height} = stencilImage;\n\n // Check for already converted image data\n if (this._stencilMap instanceof DataTexture) {\n this._stencilData = this.dataTextureToImageData(stencilImage);\n\n } else {\n // Create canvas and context for stencil Image\n const stencilCanvas = this.createElementNS('canvas') as HTMLCanvasElement;\n stencilCanvas.width = width;\n stencilCanvas.height = height;\n\n const stencilContext = stencilCanvas.getContext('2d', { willReadFrequently: true });\n stencilContext.drawImage(stencilImage, 0, 0);\n this._stencilData = stencilContext.getImageData(0, 0, width, height);\n }\n }\n\n } else {\n if (this._stencilMap) {\n this._stencilMap = null;\n this._stencilData = null;\n }\n }\n }\n\n /**\n * Prepares temporary canvases to renderer the image data (jpeg format) into raw pixmaps. The pixmap data for the different\n * images is sent to the blender for processing.\n * @param colorMap - The color texture.\n * @param alphaMap - The alpha texture.\n * @param dstX - The destination X position.\n * @param dstY - The destination Y position.\n * @returns A promise that resolves to the blended `ImageData`.\n */\n private async blendAlphaAndStencil(colorMap: Texture, alphaMap: Texture, dstX: number, dstY: number): Promise<ImageData> {\n const colorImageData = (colorMap instanceof DataTexture) ? this.dataTextureToImageData(colorMap.image) : this.getImageData(colorMap.image);\n const alphaImageData = alphaMap == null ? null : (alphaMap instanceof DataTexture) ? this.dataTextureToImageData(alphaMap.image) : this.getImageData(alphaMap.image);\n const stencilImageData = this._stencilData == null ? null : this.getStencilDataRegion(dstX, dstY, colorImageData.width, colorImageData.height);\n\n const blendedImageData = (alphaImageData || stencilImageData) ? await this._imageBlender.blendAlphaAndStencil(colorImageData, alphaImageData, stencilImageData) : colorImageData;\n\n return blendedImageData;\n }\n\n /**\n * Creates an HTML element with the specified namespace.\n * @param name - The name of the element to create.\n * @returns The created `HTMLElement`.\n */\n private createElementNS(name: string): HTMLElement {\n return document.createElementNS('http://www.w3.org/1999/xhtml', name);\n }\n\n /**\n * Generates ImageData from an image (ImageBitmap | HTMLImageElement) by creating a temporary canvas\n * and drawing the image onto it. The raw image data is then read from the canvas.\n * @param image the image to convert to ImageData\n */\n private getImageData(image: ImageBitmap | HTMLImageElement): ImageData {\n const canvas = this.createElementNS('canvas') as HTMLCanvasElement;\n canvas.width = image.width;\n canvas.height = image.height;\n\n const context = canvas.getContext('2d');\n context.drawImage(image, 0, 0);\n return context.getImageData(0, 0, image.width, image.height);\n }\n\n /**\n * Converts raw image data from TextureImageData into an ImageData object. Ensures that the raw data is a Uin8ClampedArray\n * @param textureData the raw image data from a TextureData\n */\n private dataTextureToImageData(textureData: TextureImageData): ImageData {\n // Ensure that the texture data is of a valid size\n if (textureData.data.byteLength > 0) {\n const data = textureData.data instanceof Uint8ClampedArray ? textureData.data : new Uint8ClampedArray(textureData.data.buffer);\n return new ImageData(data, textureData.width, textureData.height);\n }\n return new ImageData(new Uint8ClampedArray(4), 1, 1);\n }\n\n /**\n * Returns a region of the stencil data as a new ImageData object\n * @param x the x position of the region\n * @param y the y position of the region\n * @param width the width of the region\n * @param height the height of the region\n */\n private getStencilDataRegion(x: number, y: number, width: number, height: number): ImageData {\n const src = this._stencilData.data;\n const srcWidth = this._stencilData.width;\n const dst = new Uint8ClampedArray(width * height * 4);\n\n for (let row = 0; row < height; row++) {\n const srcStart = ((y + row) * srcWidth + x) * 4;\n const dstStart = row * width * 4;\n dst.set(src.subarray(srcStart, srcStart + width * 4), dstStart);\n }\n return new ImageData(dst, width, height);\n }\n}\n","import {alphaAndStencilBlend} from \"../common\";\nimport WebXImageBlenderWorker from \"web-worker:./WebXImageBlenderWorker\";\n\n/**\n * The `WebXAlphaStencilBlender` class handles blending of alpha and stencil data\n * for rendering purposes. It uses a Web Worker for asynchronous processing.\n */\nexport class WebXImageBlender {\n private readonly _worker: Worker;\n private _pending = new Map<number, (imageData: ImageData) => void>();\n private _nextId = 1;\n\n /**\n * Initializes the `WebXAlphaStencilBlender` and sets up the Web Worker (if web-workers present on the client).\n * The web worker is initialised from the worker/blending functions above. Each blending request is assigned an id.\n * The data is passed to the web worker along with the Id. The web worker returns the Id with blended data so that the\n * calling promise can be resolved.\n */\n constructor() {\n if (typeof Worker !== 'undefined') {\n this._worker = new WebXImageBlenderWorker();\n\n this._worker.onmessage = (e) => {\n const { id, colorBuffer, width, height } = e.data;\n const callback = this._pending.get(id);\n if (!callback) return;\n this._pending.delete(id);\n\n // Recreate ImageData from transferred buffer\n const blendedData = new Uint8ClampedArray(colorBuffer);\n const blendedImageData = new ImageData(blendedData, width, height);\n\n callback(blendedImageData);\n };\n }\n }\n\n /**\n * Blends alpha and stencil data asynchronously.\n * Main entry point to blend the different buffers. If a web-worker is available on the client then the data is prepared to transfer\n * to the worker. Otherwise the standard blending function is called immediately.\n * @param colorImageData - The color image data.\n * @param alphaImageData - The alpha image data.\n * @param stencilImageData - The stencil image data.\n * @returns A promise that resolves to the blended `ImageData`.\n */\n public async blendAlphaAndStencil(colorImageData: ImageData, alphaImageData: ImageData, stencilImageData: ImageData): Promise<ImageData> {\n return new Promise((resolve) => {\n if (this._worker) {\n const id = this._nextId++;\n this._pending.set(id, resolve);\n\n const width = colorImageData.width;\n const height = colorImageData.height;\n\n const colorBuffer = colorImageData.data.buffer;\n let alphaBuffer = null;\n let stencilBuffer = null;\n\n const transfers = [colorBuffer];\n\n if (alphaImageData) {\n alphaBuffer = alphaImageData.data.buffer;\n transfers.push(alphaBuffer)\n }\n if (stencilImageData) {\n stencilBuffer = stencilImageData.data.buffer;\n transfers.push(stencilBuffer)\n }\n\n this._worker.postMessage(\n { id, colorBuffer, alphaBuffer, stencilBuffer, width, height },\n transfers\n );\n\n } else {\n alphaAndStencilBlend(colorImageData.data, alphaImageData?.data, stencilImageData?.data);\n resolve(colorImageData);\n }\n });\n }\n\n /**\n * Terminates the Web Worker and clears pending tasks.\n */\n public terminate() {\n this._worker.terminate();\n this._pending.clear();\n }\n}\n","import {Camera, Color, ColorRepresentation, Mesh, Object3D, Texture, Vector2} from 'three';\nimport {WebXWindowCanvas} from './WebXWindowCanvas';\nimport {WebXImageBlender} from './WebXImageBlender';\nimport {Blob} from \"buffer\";\n\n/**\n * The `WebXCanvasRenderer` class is responsible for rendering a desktop-like environment\n * using HTML elements. It integrates with the Three.js library using 3D objects (meshes, materials, textures)\n * to hold the graphical data used to render the windows.\n */\nexport class WebXCanvasRenderer {\n\n private _width: number;\n private _height: number;\n private _desktopContainer: HTMLElement;\n private _desktop: HTMLElement;\n private _clearColor: Color = new Color(0, 0, 0);\n private readonly _imageBlender: WebXImageBlender;\n\n private _windowCanvases: Map<number, WebXWindowCanvas> = new Map();\n\n /**\n * Gets the root DOM element of the renderer.\n * @returns The root DOM element.\n */\n get domElement(): HTMLElement {\n return this._desktopContainer;\n }\n\n /**\n * Initializes the `WebXCanvasRenderer` by creating the main desktop container\n * and initializing the alpha stencil blender.\n */\n constructor() {\n this.createMainElement();\n this._imageBlender = new WebXImageBlender();\n }\n\n /**\n * Sets the size of the desktop container.\n * @param width - The width of the desktop in pixels.\n * @param height - The height of the desktop in pixels.\n * @param unused - An optional unused parameter.\n */\n public setSize(width: number, height: number, unused?: boolean) {\n this._width = width;\n this._height = height;\n this._desktop.style.width = `${width}px`;\n this._desktop.style.height = `${height}px`;\n }\n\n /**\n * Sets the background color of the desktop.\n * @param color - The color to set, represented as a `ColorRepresentation`.\n */\n public setClearColor(color: ColorRepresentation) {\n this._clearColor.set(color);\n this._desktop.style.backgroundColor = `#${this._clearColor.getHexString()}`;\n }\n\n /**\n * Renders the scene: updates the window element positions, sizes and z-orders and updates\n * the graphical content of the windows. Any windows that are no longer in the scene have their\n * graphical elements removed from the dom.\n * @param scene - The root `Object3D` containing the scene to render.\n * @param camera - The `Camera` used for rendering (currently unused).\n */\n public render(scene: Object3D, camera: Camera) {\n if (scene.children.length > 0) {\n const screen = scene.children[0];\n const activeWindowIds = new Set();\n\n for (const object of screen.children) {\n if (object instanceof Mesh && object.visible) {\n if (!this._windowCanvases.has(object.id)) {\n this.createWindowCanvas(object);\n }\n const windowCanvas = this._windowCanvases.get(object.id);\n windowCanvas.updateGeometry();\n windowCanvas.updateCanvas();\n\n activeWindowIds.add(object.id);\n }\n }\n\n // Remove defunct windows\n for (const [windowId, windowCanvas] of this._windowCanvases.entries()) {\n if (!activeWindowIds.has(windowId)) {\n this.removeWindowCanvas(windowCanvas);\n }\n }\n\n } else if (this._windowCanvases.size > 0) {\n // Remove all windows\n for (const [_, windowCanvas] of this._windowCanvases.entries()) {\n this.removeWindowCanvas(windowCanvas);\n }\n }\n }\n\n /**\n * Generates a screenshot of the current windows. Each window canvas is rendered onto a global\n * desktop canvas. The main canvas is then converted into a blob with the specified image type and quality\n * @param type The type of the screenshot (e.g., 'image/png').\n * @param quality The quality of the screenshot (0 to 1).\n */\n public createScreenshot(type: string, quality: number): Promise<Blob> {\n return new Promise<Blob>((resolve, reject) => {\n try {\n const screenshotCanvas = this.createElementNS('canvas') as HTMLCanvasElement;\n screenshotCanvas.width = this._width;\n screenshotCanvas.height = this._height;\n const context = screenshotCanvas.getContext('2d');\n\n // Ensure that the background is set correctly\n context.fillStyle = `#${this._clearColor.getHexString()}`;\n context.fillRect(0, 0, this._width, this._height);\n\n // Painters algorithm: Order the windows from back to front and draw the window canvas into the screenshot\n Array.from(this._windowCanvases.values()).sort((a, b) => a.zIndex - b.zIndex).forEach(window => {\n context.drawImage(window.canvas, window.x, window.y);\n })\n\n // Convert to specified image type and return the blob\n screenshotCanvas.toBlob((blob: Blob) => {\n resolve(blob);\n }, type, quality)\n\n } catch (error) {\n reject(error);\n }\n });\n }\n\n /**\n * Disposes of the renderer by removing all window canvases and terminating\n * the alpha stencil blender (and its web worker if present).\n */\n public dispose() {\n // Remove all windows\n for (const [_, windowCanvas] of this._windowCanvases.entries()) {\n this.removeWindowCanvas(windowCanvas);\n }\n\n // Terminate the blended web worker if present\n this._imageBlender.terminate();\n }\n\n /**\n * Updates a specific region of a window canvas from the color and alpha data sent from the server. The updates are stored in the window\n * and handled at the next render request.\n * @param meshId - The ID of the mesh associated with the window canvas.\n * @param srcColorMap - The source color texture.\n * @param dstColorMap - The destination color texture.\n * @param srcAlphaMap - The source alpha texture.\n * @param dstAlphaMap - The destination alpha texture.\n * @param width - The width of the region to update.\n * @param height - The height of the region to update.\n * @param dstPosition - The destination position of the region.\n */\n public updateWindowRegion(meshId: number, srcColorMap: Texture, dstColorMap: Texture, srcAlphaMap: Texture, dstAlphaMap: Texture, width: number, height: number, dstPosition: Vector2) {\n const windowCanvas = this._windowCanvases.get(meshId);\n if (windowCanvas) {\n windowCanvas.addRegionUpdate(srcColorMap, dstColorMap, srcAlphaMap, dstAlphaMap, width, height, dstPosition);\n }\n }\n\n /**\n * Creates the main desktop container element and initializes its styles.\n */\n private createMainElement() {\n const desktopContainer = this.createElementNS('div');\n desktopContainer.id = 'webx-desktop-container';\n desktopContainer.style.display = 'block';\n desktopContainer.style.position = 'relative';\n desktopContainer.style.overflow = 'hidden';\n\n const desktop = document.createElement('div');\n desktop.id = 'webx-desktop';\n desktopContainer.style.position = 'absolute';\n desktopContainer.style.transformOrigin = 'top left';\n desktopContainer.appendChild(desktop);\n\n this._desktopContainer = desktopContainer;\n this._desktop = desktop;\n }\n\n /**\n * Creates a new window canvas for the given mesh and adds it to the desktop.\n * @param mesh - The `Mesh` object representing the window.\n */\n private createWindowCanvas(mesh: Mesh) {\n const windowCanvas = new WebXWindowCanvas(mesh, this._imageBlender);\n this._desktop.appendChild(windowCanvas.canvas);\n this._windowCanvases.set(mesh.id, windowCanvas);\n }\n\n /**\n * Removes a window canvas from the desktop and cleans up its resources.\n * @param windowCanvas - The `WebXWindowCanvas` to remove.\n */\n private removeWindowCanvas(windowCanvas: WebXWindowCanvas) {\n this._desktop.removeChild(windowCanvas.canvas);\n this._windowCanvases.delete(windowCanvas.id);\n }\n\n /**\n * Creates an HTML element with the specified namespace.\n * @param name - The name of the element to create.\n * @returns The created `HTMLElement`.\n */\n private createElementNS(name: string): HTMLElement {\n return document.createElementNS('http://www.w3.org/1999/xhtml', name);\n }\n}\n","import {WebXCursor} from \"./WebXCursor\";\n\nexport class WebXDisplayOverlay {\n\n private readonly _overlayElement: HTMLElement;\n\n get overlayElement(): HTMLElement {\n return this._overlayElement;\n }\n\n set visible(visible: boolean) {\n this._overlayElement.style.visibility = visible ? 'visible' : 'hidden';\n }\n\n constructor(private _cursor: WebXCursor) {\n this._overlayElement = this._createDisplayOverlayElement();\n this._overlayElement.appendChild(this._cursor.canvas);\n }\n\n public update(): void {\n }\n\n private _createDisplayOverlayElement(): HTMLElement {\n const element = document.createElement('div');\n element.id = 'webx-overlay';\n element.style.position = 'absolute';\n element.style.width = '100%';\n element.style.height = '100%';\n element.style.zIndex = '999';\n element.style.visibility = 'hidden';\n element.style.overflow = 'clip';\n\n return element;\n }\n\n}\n","import { WebXMessageType } from './WebXMessageType';\n\n/**\n * Base class for all WebX messages.\n *\n * Messages are data structures received from the WebX Engine, containing\n * information about the state of the remote desktop or responses to instructions.\n */\nexport abstract class WebXMessage {\n /**\n * The type of the message.\n */\n public readonly type: WebXMessageType;\n\n /**\n * The ID of the command associated with this message.\n */\n public readonly commandId: number;\n\n /**\n * Used to globally set function of web worker when decoding messages\n */\n private static _convertToImageDataInWorker: boolean = false;\n\n /**\n * Constructs a new WebXMessage.\n *\n * @param type The type of the message.\n * @param commandId The ID of the command associated with this message.\n */\n protected constructor(type: WebXMessageType, commandId: number = 0) {\n this.type = type;\n this.commandId = commandId;\n }\n\n /**\n * Get the flag to determine if images should be converted to image data in a worker\n */\n public static get convertToImageDataInWorker() {\n return WebXMessage._convertToImageDataInWorker;\n }\n\n /**\n * Set the flag to specify whether images should be converted to image data in a worker\n */\n public static set convertToImageDataInWorker(value: boolean) {\n WebXMessage._convertToImageDataInWorker = value;\n }\n}\n","/**\n * Enum representing the types of WebX messages.\n *\n * These types are used to categorize messages received from the WebX Engine.\n */\nexport enum WebXMessageType {\n\n /**\n * Message indicating no operation.\n */\n NOP = 0,\n\n /**\n * Message indicating a connection event (handled by the WebX Relay).\n */\n CONNECTION = 1,\n\n /**\n * Message containing information about visible windows.\n */\n WINDOWS = 2,\n\n /**\n * Message containing image data for a window.\n */\n IMAGE = 3,\n\n /**\n * Message containing screen information.\n */\n SCREEN = 4,\n\n /**\n * Message containing sub-image data for a window.\n */\n SUBIMAGES = 5,\n\n /**\n * Message containing mouse state updates.\n */\n MOUSE = 6,\n\n /**\n * Message containing cursor image data.\n */\n CURSOR_IMAGE = 7,\n\n /**\n * Ping message for connection health checks.\n */\n PING = 8,\n\n /**\n * Message indicating a disconnection event (handled by the WebX Relay).\n */\n DISCONNECT = 9,\n\n /**\n * Message containing quality-related information.\n */\n QUALITY = 10,\n\n /**\n * Message containing current clipboard content.\n */\n CLIPBOARD = 11,\n\n /**\n * Message containing window shape information (stencil image).\n */\n SHAPE = 12,\n}\n","import { WebXMessage } from './WebXMessage';\nimport { WebXMessageType } from './WebXMessageType';\nimport {WebXVersion} from \"../utils\";\n\n/**\n * Represents a message containing screen information.\n *\n * This message is received from the WebX Engine and contains details about\n * the screen size.\n */\nexport class WebXScreenMessage extends WebXMessage {\n /**\n * The size of the screen.\n */\n public readonly screenSize: { width: number; height: number };\n\n\n /**\n * The maximum quality index for the display\n */\n public readonly maxQualityIndex: number;\n\n /**\n * The version of the WebX Engine.\n */\n public readonly engineVersion: WebXVersion;\n\n /**\n * Constructs a new WebXScreenMessage.\n *\n * @param screenSize The size of the screen.\n * @param maxQualityIndex The maximum quality index for the display.\n * @param engineVersion The version of the WebX Engine.\n * @param commandId The ID of the command associated with this message.\n */\n constructor(screenSize: { width: number; height: number }, maxQualityIndex:number, engineVersion: WebXVersion, commandId: number) {\n super(WebXMessageType.SCREEN, commandId);\n this.screenSize = screenSize;\n this.maxQualityIndex = maxQualityIndex;\n this.engineVersion = engineVersion;\n }\n}\n","import { WebXMessage } from './WebXMessage';\nimport { WebXMessageType } from './WebXMessageType';\nimport { WebXWindowProperties } from '../common';\n\n/**\n * Represents a message containing information about visible windows.\n *\n * This message is received from the WebX Engine and contains details about\n * all currently visible windows.\n */\nexport class WebXWindowsMessage extends WebXMessage {\n /**\n * The list of visible windows.\n */\n public readonly windows: Array<WebXWindowProperties>;\n\n /**\n * Constructs a new WebXWindowsMessage.\n *\n * @param windows The list of visible windows.\n * @param commandId The ID of the command associated with this message.\n */\n constructor(windows: Array<WebXWindowProperties>, commandId: number) {\n super(WebXMessageType.WINDOWS, commandId);\n this.windows = windows;\n }\n}\n","import { WebXMessage } from './WebXMessage';\nimport { WebXMessageType } from './WebXMessageType';\nimport {WebXTexture} from \"../texture\";\n\n/**\n * Represents a message containing image data for a window.\n *\n * This message is received from the WebX Engine and contains the color and\n * alpha textures for a specific window.\n */\nexport class WebXImageMessage extends WebXMessage {\n /**\n * The ID of the window associated with this image.\n */\n public readonly windowId: number;\n\n /**\n * The depth of the image (e.g., 24-bit or 32-bit).\n */\n public readonly depth: number;\n\n /**\n * The color texture of the image.\n */\n public readonly colorMap: WebXTexture;\n\n /**\n * The alpha texture of the image.\n */\n public readonly alphaMap: WebXTexture;\n\n /**\n * The size of the image.\n */\n public readonly size: number;\n\n /**\n * Constructs a new WebXImageMessage.\n *\n * @param windowId The ID of the window.\n * @param depth The depth of the image.\n * @param colorMap The color texture.\n * @param alphaMap The alpha texture.\n * @param commandId The ID of the command associated with this message.\n * @param size The size of the image.\n */\n constructor(windowId: number, depth: number, colorMap: WebXTexture, alphaMap: WebXTexture, commandId: number, size: number) {\n super(WebXMessageType.IMAGE, commandId);\n this.windowId = windowId;\n this.depth = depth;\n this.colorMap = colorMap;\n this.alphaMap = alphaMap;\n this.size = size;\n }\n}\n","import { WebXMessage } from './WebXMessage';\nimport { WebXMessageType } from './WebXMessageType';\nimport { WebXSubImage } from '../common';\n\n/**\n * Represents a message containing sub-image data for a window.\n *\n * This message is received from the WebX Engine and contains a list of\n * sub-images that should be updated.\n */\nexport class WebXSubImagesMessage extends WebXMessage {\n /**\n * The ID of the window associated with these sub-images.\n */\n public readonly windowId: number;\n\n /**\n * The list of sub-images.\n */\n public readonly subImages: Array<WebXSubImage>;\n\n /**\n * The size of the message in bytes.\n */\n public readonly size: number;\n\n /**\n * Constructs a new WebXSubImagesMessage.\n *\n * @param windowId The ID of the window.\n * @param subImages The list of sub-images.\n * @param commandId The ID of the command associated with this message.\n * @param size The size of the message in bytes.\n */\n constructor(windowId: number, subImages: Array<WebXSubImage>, commandId: number, size: number) {\n super(WebXMessageType.SUBIMAGES, commandId);\n this.windowId = windowId;\n this.subImages = subImages;\n this.size = size;\n }\n}\n","import { WebXMessage } from './WebXMessage';\nimport { WebXMessageType } from './WebXMessageType';\n\n/**\n * Represents a message containing mouse state updates.\n * \n * This message is received from the WebX Engine and contains details about\n * the mouse position and cursor ID.\n */\nexport class WebXMouseMessage extends WebXMessage {\n /**\n * The x-coordinate of the mouse pointer.\n */\n public readonly x: number;\n\n /**\n * The y-coordinate of the mouse pointer.\n */\n public readonly y: number;\n\n /**\n * The ID of the cursor associated with the mouse pointer.\n */\n public readonly cursorId: number;\n\n /**\n * Constructs a new WebXMouseMessage.\n * \n * @param x The x-coordinate of the mouse pointer.\n * @param y The y-coordinate of the mouse pointer.\n * @param cursorId The ID of the cursor.\n * @param commandId The ID of the command associated with this message.\n */\n constructor(x: number, y: number, cursorId: number, commandId: number) {\n super(WebXMessageType.MOUSE, commandId);\n this.x = x;\n this.y = y;\n this.cursorId = cursorId;\n }\n}\n","import { WebXMessage } from './WebXMessage';\nimport { WebXMessageType } from './WebXMessageType';\nimport {WebXTexture} from \"../texture\";\n\n/**\n * Represents a message containing cursor image data.\n *\n * This message is received from the WebX Engine and contains details about\n * the cursor's appearance, including its texture and hotspot coordinates.\n */\nexport class WebXCursorImageMessage extends WebXMessage {\n /**\n * The ID of the cursor associated with this message.\n */\n public readonly cursorId: number;\n\n /**\n * The x-coordinate of the cursor's hotspot.\n */\n public readonly xHot: number;\n\n /**\n * The y-coordinate of the cursor's hotspot.\n */\n public readonly yHot: number;\n\n /**\n * The texture of the cursor.\n */\n public readonly texture: WebXTexture;\n\n /**\n * The x-coordinate of the cursor's position.\n */\n public readonly x: number;\n\n /**\n * The y-coordinate of the cursor's position.\n */\n public readonly y: number;\n\n /**\n * Constructs a new WebXCursorImageMessage.\n *\n * @param cursorId The ID of the cursor.\n * @param xHot The x-coordinate of the cursor's hotspot.\n * @param yHot The y-coordinate of the cursor's hotspot.\n * @param texture The texture of the cursor.\n * @param x The x-coordinate of the cursor's position.\n * @param y The y-coordinate of the cursor's position.\n * @param commandId The ID of the command associated with this message.\n */\n constructor(x: number, y: number, xHot: number, yHot: number, cursorId: number, texture: WebXTexture, commandId: number) {\n super(WebXMessageType.CURSOR_IMAGE, commandId);\n this.x = x;\n this.y = y;\n this.xHot = xHot;\n this.yHot = yHot;\n this.cursorId = cursorId;\n this.texture = texture;\n }\n}\n","import { WebXMessage } from './WebXMessage';\nimport { WebXMessageType } from './WebXMessageType';\n\n/**\n * Represents a ping message for connection health checks.\n * \n * This message is sent by the WebX Engine to ensure the connection is active. The client responds with \n * an WebXPongInstruction.\n */\nexport class WebXPingMessage extends WebXMessage {\n /**\n * Constructs a new WebXPingMessage.\n */\n constructor() {\n super(WebXMessageType.PING);\n }\n}\n","import { WebXMessage } from './WebXMessage';\nimport { WebXMessageType } from './WebXMessageType';\n\n/**\n * Represents a message containing quality-related information.\n * \n * This message is received from the WebX Engine and contains details about\n * the quality settings.\n */\nexport class WebXQualityMessage extends WebXMessage {\n /**\n * The quality index.\n */\n public readonly index: number;\n\n /**\n * The frames per second (FPS) for image rendering.\n */\n public readonly imageFPS: number;\n\n /**\n * The quality level for RGB data.\n */\n public readonly rgbQuality: number;\n\n /**\n * The quality level for alpha data.\n */\n public readonly alphaQuality: number;\n\n /**\n * The maximum bandwidth in Mbps for window image updates.\n */\n public readonly maxMbps: number;\n\n /**\n * Constructs a new WebXQualityMessage.\n * \n * @param index The quality index.\n * @param imageFPS The frames per second for image rendering.\n * @param rgbQuality The quality level for RGB data.\n * @param alphaQuality The quality level for alpha data.\n * @param maxMbps The maximum bandwidth in Mbps.\n */\n constructor(index: number, imageFPS: number, rgbQuality: number, alphaQuality: number, maxMbps: number) {\n super(WebXMessageType.QUALITY);\n this.index = index;\n this.imageFPS = imageFPS;\n this.rgbQuality = rgbQuality;\n this.alphaQuality = alphaQuality;\n this.maxMbps = maxMbps;\n }\n}\n","import { WebXMessage } from './WebXMessage';\nimport { WebXMessageType } from './WebXMessageType';\n\n/**\n * Represents a message containing clipboard content.\n *\n * This message is received from the WebX Engine and contains the clipboard content in the X11 server.\n */\nexport class WebXClipboardMessage extends WebXMessage {\n\n /**\n * The content of the clipboard.\n * @private\n */\n public readonly clipboardContent: string;\n\n /**\n * Constructs a new WebXClipboardMessage.\n *\n * @param clipboardContent The content of the clipboard.\n */\n constructor(clipboardContent: string) {\n super(WebXMessageType.CLIPBOARD);\n this.clipboardContent = clipboardContent;\n }\n}\n","import { WebXMessage } from './WebXMessage';\nimport { WebXMessageType } from './WebXMessageType';\n\n/**\n * Represents a message indicating a connection to the WebX Engine.\n *\n * This message is sent when a connection is established.\n */\nexport class WebXConnectionMessage extends WebXMessage {\n\n public readonly isStarting: boolean;\n\n /**\n * Constructs a new WebXConnectionMessage.\n */\n constructor(isStarting: boolean) {\n super(WebXMessageType.CONNECTION);\n this.isStarting = isStarting;\n }\n}\n","import { WebXMessage } from './WebXMessage';\nimport { WebXMessageType } from './WebXMessageType';\n\n/**\n * Represents a no-operation message: has no effect.\n */\nexport class WebXNopMessage extends WebXMessage {\n\n /**\n * Constructs a new WebXNopMessage.\n */\n constructor() {\n super(WebXMessageType.NOP);\n }\n}\n","import { WebXMessage } from './WebXMessage';\nimport { WebXMessageType } from './WebXMessageType';\nimport {WebXTexture} from \"../texture\";\n\n/**\n * Represents a message containing image data for a window.\n *\n * This message is received from the WebX Engine and contains the color and\n * alpha textures for a specific window.\n */\nexport class WebXShapeMessage extends WebXMessage {\n /**\n * The ID of the window associated with this image.\n */\n public readonly windowId: number;\n\n /**\n * The stencil texture of the window.\n */\n public readonly stencilMap: WebXTexture;\n\n /**\n * The size of the image.\n */\n public readonly size: number;\n\n /**\n * Constructs a new WebXImageMessage.\n *\n * @param windowId The ID of the window.\n * @param stencilMap The stencil texture.\n * @param commandId The ID of the command associated with this message.\n * @param size The size of the image.\n */\n constructor(windowId: number, stencilMap: WebXTexture, commandId: number, size: number) {\n super(WebXMessageType.SHAPE, commandId);\n this.windowId = windowId;\n this.stencilMap = stencilMap;\n this.size = size;\n }\n}\n","import * as THREE from 'three';\nimport {OrthographicCamera, Vector3} from 'three';\nimport { WebXWindow } from './WebXWindow';\nimport { WebXSubImage, WebXWindowProperties } from '../common';\nimport { WebXCursor } from './WebXCursor';\nimport { WebXCursorFactory } from './WebXCursorFactory';\nimport {WebXCanvasRenderer} from '../renderer';\nimport {Blob} from \"buffer\";\nimport {WebXDisplayOverlay} from \"./WebXDisplayOverlay\";\nimport {WebXWindowImageFactory} from \"./WebXWindowImageFactory\";\nimport {toThreeTexture, WebXTexture} from \"../texture\";\nimport {WebXMessage} from \"../message\";\n\ntype WebGLInfo = {\n available: boolean;\n vendor?: string;\n renderer?: string;\n isSoftware?: boolean;\n};\n\n/**\n * Manages the rendering of the WebX remote desktop using WebGL.\n *\n * This class handles the creation and management of the WebGL scene, including\n * windows, cursor, and scaling. It provides methods to update the display\n * and interact with the rendered elements.\n */\nexport class WebXDisplay {\n\n private readonly _scene: THREE.Scene;\n private readonly _camera: THREE.OrthographicCamera;\n private readonly _renderer: THREE.WebGLRenderer | WebXCanvasRenderer;\n private readonly _screen: THREE.Object3D;\n\n private readonly _screenWidth: number;\n private readonly _screenHeight: number;\n\n private readonly _windowImageFactory: WebXWindowImageFactory;\n\n private readonly _containerElement: HTMLElement;\n\n private _windows: WebXWindow[] = [];\n\n private _cursor: WebXCursor;\n\n private _scale: number = 1;\n\n private _displayElement: HTMLElement;\n\n private _boundsElement: HTMLElement;\n\n private _displayOverlay: WebXDisplayOverlay;\n\n private _disposed = false;\n\n private _sceneDirty = false;\n\n private _disableStencil = false;\n\n /**\n * Gets the WebGL renderer used for rendering the display.\n *\n * @returns The WebGLRenderer instance.\n */\n public get renderer(): THREE.WebGLRenderer | WebXCanvasRenderer {\n return this._renderer;\n }\n\n /**\n * Gets the width of the screen.\n *\n * @returns The screen width in pixels.\n */\n public get screenWidth(): number {\n return this._screenWidth;\n }\n\n /**\n * Gets the height of the screen.\n *\n * @returns The screen height in pixels.\n */\n public get screenHeight(): number {\n return this._screenHeight;\n }\n\n /**\n * Gets the HTML container element for the display.\n *\n * @returns The container HTMLElement.\n */\n public get containerElement(): HTMLElement {\n return this._containerElement;\n }\n\n /**\n * Gets the current scale factor of the display.\n *\n * @returns The scale factor as a number.\n */\n public get scale(): number {\n return this._scale;\n }\n\n /**\n * Gets the Three.js scene used for rendering.\n *\n * @returns The Scene instance.\n */\n public get scene(): THREE.Scene {\n return this._scene;\n }\n\n /**\n * Gets the Three.js camera used for rendering.\n *\n * @returns the Camera instance\n */\n get camera(): OrthographicCamera {\n return this._camera;\n }\n\n /**\n * Returns when the scene is dirty and needs to be re-rendered.\n * @return true if the scene is dirty, false otherwise\n */\n get sceneDirty(): boolean {\n return this._sceneDirty;\n }\n\n /**\n * Explicitly sets the scene dirty flag to indicate that the scene needs to be re-rendered.\n * @param value the scene dirty value\n */\n set sceneDirty(value: boolean) {\n this._sceneDirty = value;\n }\n\n /**\n * Creates a new instance of WebXDisplay.\n *\n * @param containerElement The HTML element to render the display.\n * @param screenWidth The width of the screen.\n * @param screenHeight The height of the screen.\n * @param windowImageFactory The factory used for obtaining window images.\n * @param cursorFactory The cursor factory used for managing cursors.\n */\n constructor(containerElement: HTMLElement, screenWidth: number, screenHeight: number, windowImageFactory: WebXWindowImageFactory, cursorFactory: WebXCursorFactory) {\n this._containerElement = containerElement;\n this._screenWidth = screenWidth;\n this._screenHeight = screenHeight;\n this._windowImageFactory = windowImageFactory;\n this._cursor = new WebXCursor(cursorFactory);\n this._displayOverlay = new WebXDisplayOverlay(this._cursor);\n\n this._scene = new THREE.Scene();\n this._screen = new THREE.Object3D();\n\n // Add dummy mesh to the scene otherwise the texture updates don't appear to have the correct state and aren't applied correctly\n const dummy = new THREE.Mesh(\n new THREE.PlaneGeometry(1.0, 1.0, 2, 2),\n new THREE.MeshBasicMaterial({ map: new THREE.DataTexture(new Uint8ClampedArray(4), 1, 1), side: THREE.BackSide, transparent: true }));\n dummy.position.set(0, 0, 999);\n this._screen.add(dummy);\n\n this._camera = new THREE.OrthographicCamera(0, screenWidth, 0, screenHeight, 0.1, 10000);\n this._camera.position.z = 1000;\n this._camera.lookAt(new Vector3(0, 0, 0));\n\n const webglInfo = this._detectWebGL2();\n\n const url = new URL(window.location.href);\n const params = url.searchParams;\n const forceCanvas = params.get(\"webx-canvas\") === 'true';\n this._disableStencil = params.get(\"webx-stencil\") === 'false';\n\n if (webglInfo.available && !webglInfo.isSoftware && !forceCanvas) {\n this._renderer = new THREE.WebGLRenderer();\n\n } else {\n console.log(`WebGL2 Info: available = ${webglInfo.available}, isSoftware = ${webglInfo.isSoftware}, vendor = ${webglInfo.vendor}, renderer = ${webglInfo.renderer}`);\n if (forceCanvas) {\n console.log(`Canvas Renderer enabled through request param`);\n\n } else {\n console.log(`Falling back to Canvas Renderer`);\n }\n this._renderer = new WebXCanvasRenderer();\n WebXMessage.convertToImageDataInWorker = true;\n }\n\n this._renderer.setSize(screenWidth, screenHeight, false);\n\n const backgroundColor = window.getComputedStyle(this._containerElement).backgroundColor;\n this._renderer.setClearColor(backgroundColor);\n\n this._render();\n this._bindListeners();\n\n // initial size\n this.resize();\n\n this._renderer.render(this._scene, this._camera);\n }\n\n /**\n * Displays the screen by adding it to the scene.\n */\n showScreen(): void {\n this._scene.add(this._screen);\n this._displayOverlay.visible = true;\n this._sceneDirty = true;\n }\n\n /**\n * Hides the screen by removing it from the scene.\n */\n hideScreen(): void {\n this._scene.remove(this._screen);\n this._displayOverlay.visible = false;\n this._sceneDirty = true;\n }\n\n /**\n * Disposes of all resources used by the display.\n *\n * This includes removing windows, clearing elements, and releasing WebGL resources.\n */\n dispose(): void {\n this.hideScreen();\n\n for (const window of this._windows) {\n this._screen.remove(window.mesh);\n window.dispose();\n }\n\n this._clearElements();\n\n this._renderer.dispose();\n\n this._disposed = true;\n }\n\n /**\n * Animates the display by continuously rendering the scene.\n *\n * This method uses `requestAnimationFrame` to update the display at regular intervals.\n */\n animate(): void {\n if (!this._disposed) {\n requestAnimationFrame(() => {\n this.animate();\n });\n\n this._displayOverlay.update();\n\n if (this._sceneDirty) {\n this._sceneDirty = false;\n this.render();\n }\n }\n }\n\n /**\n * Renders the display by updating the WebGL context.\n */\n render(): void {\n this._renderer.render(this._scene, this._camera);\n }\n\n /**\n * Creates a screenshot of the current desktop with the specified image type and quality\n * @param type The type of the screenshot (e.g., 'image/png').\n * @param quality The quality of the screenshot (0 to 1).\n */\n async createScreenshot(type: string, quality: number): Promise<Blob> {\n if (this._renderer instanceof WebXCanvasRenderer) {\n return this._renderer.createScreenshot(type, quality);\n\n } else {\n const renderer = this._renderer as THREE.WebGLRenderer;\n return new Promise<Blob>((resolve, reject) => {\n try {\n this.render();\n renderer.domElement.toBlob((blob: Blob) => {\n resolve(blob);\n }, type, quality)\n\n } catch (error) {\n reject(error);\n }\n });\n }\n }\n\n /**\n * Adds a new window to the display.\n *\n * @param window The WebXWindow instance to add.\n */\n addWindow(window: WebXWindow): void {\n if (this._windows.find(existingWindow => existingWindow.id === window.id) == null) {\n this._windows.push(window);\n this._screen.add(window.mesh);\n this._sceneDirty = true;\n }\n }\n\n /**\n * Removes a window from the display.\n *\n * @param window The WebXWindow instance to remove.\n */\n removeWindow(window: WebXWindow): void {\n if (this._windows.find(existingWindow => existingWindow.id === window.id) != null) {\n this._windows = this._windows.filter(existingWindow => existingWindow.id !== window.id);\n window.dispose();\n this._screen.remove(window.mesh);\n this._sceneDirty = true;\n }\n }\n\n /**\n * Updates the display with the given windows.\n *\n * @param windows The list of windows to update.\n * @returns A promise that resolves when all windows are updated.\n */\n updateWindows(windows: Array<WebXWindowProperties>): Promise<void> {\n return new Promise((resolve) => {\n // Get windows to remove\n const deadWindows = this._windows.filter(existingWindow => windows.find(window => window.id === existingWindow.id) == null);\n\n // Remove windows that no longer exist\n deadWindows.forEach(deadWindow => this.removeWindow(deadWindow));\n\n let hasNewWindows = false;\n // Update and add windows\n windows.forEach((window, index) => {\n let webXWindow = this.getWindow(window.id);\n if (webXWindow == null) {\n hasNewWindows = true;\n\n // Add a new window\n webXWindow = new WebXWindow({\n id: window.id,\n x: window.x,\n y: window.y,\n z: index,\n width: window.width,\n height: window.height,\n shaped: window.shaped && !this._disableStencil,\n }, this._windowImageFactory);\n\n this.addWindow(webXWindow);\n\n webXWindow.loadWindowImageAndShape()\n .then(() => {\n // When all windows have been loaded then callback. This is only really needed for the startup\n if (this.checkAllLoaded(windows.map(window => window.id))) {\n resolve();\n }\n })\n\n } else {\n // Update window\n webXWindow.shaped = window.shaped && !this._disableStencil;\n webXWindow.setRectangle(window.x, window.y, index, window.width, window.height);\n }\n });\n\n if (!hasNewWindows) {\n resolve();\n }\n })\n }\n\n /**\n * Checks if all specified windows have been loaded.\n *\n * @param windowIds The list of window IDs to check.\n * @returns True if all windows are loaded, false otherwise.\n */\n checkAllLoaded(windowIds: number[]): boolean {\n const allLoaded = windowIds\n .map(id => this.getWindow(id))\n .filter(window => window != null)\n .map(window => window.loaded)\n .reduce((allLoaded, loaded) => allLoaded && loaded, true);\n\n return allLoaded;\n }\n\n /**\n * Updates the texture of a window with new image data.\n *\n * @param windowId The ID of the window to update.\n * @param depth The depth of the image.\n * @param colorMap The color texture.\n * @param alphaMap The alpha texture.\n */\n updateImage(windowId: number, depth: number, colorMap: WebXTexture, alphaMap: WebXTexture): void {\n const window: WebXWindow = this.getWindow(windowId);\n if (window != null && !(colorMap == null && alphaMap == null)) {\n window.updateTexture(depth, toThreeTexture(colorMap), toThreeTexture(alphaMap), true);\n this._sceneDirty = true;\n }\n }\n\n /**\n * Updates sub-images of a window with new image data.\n *\n * @param windowId The ID of the window to update.\n * @param subImages The list of sub-images to update.\n */\n updateSubImages(windowId: number, subImages: WebXSubImage[]): void {\n const window: WebXWindow = this.getWindow(windowId);\n if (window != null && window.colorMapValid) {\n const colorMap = window.colorMap;\n const alphaMap = window.alphaMap;\n for(let i= 0; i< subImages.length; i++) {\n const subImage = subImages[i];\n if (this._renderer instanceof WebXCanvasRenderer) {\n this._renderer.updateWindowRegion(window.mesh.id, toThreeTexture(subImage.colorMap), colorMap, toThreeTexture(subImage.alphaMap), alphaMap, subImage.width, subImage.height, new THREE.Vector2(subImage.x, subImage.y));\n\n } else {\n if (colorMap && subImage.colorMap) {\n this._renderer.copyTextureToTexture(toThreeTexture(subImage.colorMap), colorMap, null, new THREE.Vector2(subImage.x, subImage.y));\n }\n if (alphaMap && subImage.alphaMap) {\n this._renderer.copyTextureToTexture(toThreeTexture(subImage.alphaMap), alphaMap, null, new THREE.Vector2(subImage.x, subImage.y));\n }\n }\n\n }\n window.updateTexture(window.depth, colorMap, alphaMap, false);\n this._sceneDirty = true;\n }\n }\n\n /**\n * Updates the texture of a window stencil map with.\n *\n * @param windowId The ID of the window to update.\n * @param stencilMap The stencil texture.\n */\n updateShape(windowId: number, stencilMap: WebXTexture): void {\n if (this._disableStencil) {\n return;\n }\n const window: WebXWindow = this.getWindow(windowId);\n if (window != null && stencilMap != null) {\n window.updateStencilTexture(toThreeTexture(stencilMap));\n this._sceneDirty = true;\n }\n }\n\n /**\n * Updates the mouse cursor on the display.\n *\n * @param cursorId The ID of the cursor to display.\n */\n setMouseCursor(cursorId: number): void {\n this._cursor.setCursorId(cursorId);\n }\n\n /**\n * Updates the mouse position without changing the cursor.\n *\n * @param x The x-coordinate of the mouse.\n * @param y The y-coordinate of the mouse.\n */\n setMousePosition(x: number, y: number): void {\n this._cursor.setPosition(x, y);\n }\n\n /**\n * Retrieves a window by its ID.\n *\n * @param id The ID of the window to retrieve.\n * @returns The WebXWindow instance, or undefined if not found.\n */\n getWindow(id: number): WebXWindow {\n return this._windows.find(window => window.id === id);\n }\n\n /**\n * Sets the scale of the display.\n *\n * @param scale The scale factor (between 0 and 1).\n */\n setScale(scale: number): void {\n this._scale = scale;\n this._sceneDirty = true;\n }\n\n /**\n * Automatically scales the display to fit its container.\n */\n autoScale(): void {\n const container = this._containerElement;\n const { clientWidth, clientHeight } = container;\n const { screenWidth, screenHeight } = this;\n this._scale = Math.min(clientWidth / screenWidth, clientHeight / screenHeight);\n this._sceneDirty = true;\n }\n\n /**\n * Resizes the display to fit its container.\n *\n * @param scale Optional scale factor. If not provided, the display will auto-scale.\n */\n resize(scale?: number): void {\n const element = this._boundsElement;\n if (scale) {\n this.setScale(scale);\n } else {\n this.autoScale();\n }\n element.style.transform = `scale(${this._scale},${this._scale})`;\n }\n\n /**\n * Clears all child elements from the container element.\n */\n private _clearElements(): void {\n while (this._containerElement.firstChild) {\n this._containerElement.removeChild(this._containerElement.firstChild);\n }\n }\n\n /**\n * Creates the main display element and sets its dimensions.\n *\n * @returns The created HTML element.\n */\n private _createDisplayElement(): HTMLElement {\n const element = document.createElement('div');\n element.style.width = `${this._screenWidth}px`;\n element.style.height = `${this._screenHeight}px`;\n\n element.appendChild(this._displayOverlay.overlayElement);\n\n element.appendChild(this._renderer.domElement);\n return element;\n }\n\n /**\n * Creates the bounding element for the display.\n *\n * @returns The created HTML element.\n */\n private _createDisplayBoundingElement(): HTMLElement {\n const element = document.createElement('div');\n element.appendChild(this._displayElement);\n return element;\n }\n\n /**\n * Renders the display by appending the display and bounding elements to the container.\n */\n private _render(): void {\n this._clearElements();\n this._displayElement = this._createDisplayElement();\n this._boundsElement = this._createDisplayBoundingElement();\n this._containerElement.appendChild(this._boundsElement);\n }\n\n /**\n * Binds event listeners for resizing and other interactions.\n */\n private _bindListeners(): void {\n this.resize = this.resize.bind(this);\n }\n\n /**\n * Returns details about the availability and type of WebGL2 rendering\n */\n private _detectWebGL2(): WebGLInfo {\n const canvas = document.createElement(\"canvas\");\n const gl = canvas.getContext(\"webgl2\");\n if (!gl) {\n return { available: false };\n }\n\n const renderer = gl.getParameter(gl.RENDERER);\n const vendor = gl.getParameter(gl.VENDOR);\n let unmaskedRenderer: string = null;\n let unmaskedVendor: string = null;\n\n const ext = gl.getExtension(\"WEBGL_debug_renderer_info\");\n if (ext) {\n unmaskedRenderer = gl.getParameter(ext.UNMASKED_RENDERER_WEBGL);\n unmaskedVendor = gl.getParameter(ext.UNMASKED_VENDOR_WEBGL);\n }\n\n const rendererStr = (unmaskedRenderer || renderer || \"\").toLowerCase();\n const isSoftware = /swiftshader|llvmpipe|basic render|software/i.test(rendererStr);\n\n return { available: true, vendor: unmaskedVendor || vendor, renderer: unmaskedRenderer || renderer, isSoftware };\n }\n}\n","const Guacamole = require('./GuacamoleKeyboard');\n\n/**\n * Represents the keyboard input device in the WebX client.\n *\n * This class handles keyboard events, such as key presses and releases,\n * and provides methods to interact with the keyboard state.\n */\nexport class WebXKeyboard {\n\n private _keyboard: Guacamole.Keyboard;\n\n public set onKeyDown(onKeyDown: (key: any) => void) {\n this._keyboard.onkeydown = onKeyDown;\n }\n\n public set onKeyUp(onKeyUp: (key: any) => void) {\n this._keyboard.onkeyup = onKeyUp;\n }\n\n /**\n * Constructs a new WebXKeyboard instance.\n * This creates a Guacamole.Keyboard instance and attaches event listeners.\n *\n * @param element The HTML element to attach the keyboard events to.\n */\n constructor(element: HTMLElement | Document) {\n this._keyboard = new Guacamole.Keyboard(element);\n }\n\n /**\n * Disposes of the keyboard instance and removes event listeners.\n */\n public dispose(): void {\n this._keyboard.onkeydown = null;\n this._keyboard.onkeyup = null;\n this._keyboard.dispose();\n }\n\n /**\n * Resets the keyboard state.\n * This clears any pressed keys and resets the keyboard to its initial state.\n */\n public reset(): void {\n this._keyboard.reset();\n }\n\n}\n","export class WebXMouseState {\n /**\n * The current X position of the mouse pointer\n */\n private _x: number;\n\n /**\n * The current Y position of the mouse poinrter\n */\n private _y: number;\n\n /**\n * Whether the left mouse button is currently pressed.\n */\n private _left: boolean;\n\n /**\n * Whether the middle mouse button is currently pressed.\n */\n private _middle: boolean;\n\n /**\n * Whether the right mouse button is currently pressed.\n */\n private _right: boolean;\n\n /**\n * Whether the up mouse button is currently pressed. This is the fourth\n * mouse button, associated with upward scrolling of the mouse scroll\n * wheel.\n */\n private _up: boolean;\n\n /**\n * Whether the down mouse button is currently pressed. This is the fifth\n * mouse button, associated with downward scrolling of the mouse scroll\n * wheel.\n */\n private _down: boolean;\n\n /**\n * Whether the shift button is currently pressed.\n */\n private _shift: boolean;\n\n /**\n * Whether the ctrl button is currently pressed.\n */\n private _ctrl: boolean;\n\n /**\n * Whether the alt button is currently pressed.\n */\n private _alt: boolean;\n\n /**\n * Gets the current X position of the mouse pointer.\n *\n * @returns The X-coordinate as a number.\n */\n public get x(): number {\n return this._x;\n }\n\n /**\n * Sets the current X position of the mouse pointer.\n *\n * @param value The new X-coordinate as a number.\n */\n public set x(value: number) {\n this._x = value;\n }\n\n /**\n * Gets the current Y position of the mouse pointer.\n *\n * @returns The Y-coordinate as a number.\n */\n public get y(): number {\n return this._y;\n }\n\n /**\n * Sets the current Y position of the mouse pointer.\n *\n * @param value The new Y-coordinate as a number.\n */\n public set y(value: number) {\n this._y = value;\n }\n\n /**\n * Gets whether the left mouse button is currently pressed.\n *\n * @returns True if the left button is pressed, false otherwise.\n */\n public get left(): boolean {\n return this._left;\n }\n\n /**\n * Sets whether the left mouse button is currently pressed.\n *\n * @param value True to indicate the left button is pressed, false otherwise.\n */\n public set left(value: boolean) {\n this._left = value;\n }\n\n /**\n * Gets whether the middle mouse button is currently pressed.\n *\n * @returns True if the middle button is pressed, false otherwise.\n */\n public get middle(): boolean {\n return this._middle;\n }\n\n /**\n * Sets whether the middle mouse button is currently pressed.\n *\n * @param value True to indicate the middle button is pressed, false otherwise.\n */\n public set middle(value: boolean) {\n this._middle = value;\n }\n\n /**\n * Gets whether the right mouse button is currently pressed.\n *\n * @returns True if the right button is pressed, false otherwise.\n */\n public get right(): boolean {\n return this._right;\n }\n\n /**\n * Sets whether the right mouse button is currently pressed.\n *\n * @param value True to indicate the right button is pressed, false otherwise.\n */\n public set right(value: boolean) {\n this._right = value;\n }\n\n /**\n * Gets whether the up mouse button (scroll up) is currently pressed.\n *\n * @returns True if the up button is pressed, false otherwise.\n */\n public get up(): boolean {\n return this._up;\n }\n\n /**\n * Sets whether the up mouse button (scroll up) is currently pressed.\n *\n * @param value True to indicate the up button is pressed, false otherwise.\n */\n public set up(value: boolean) {\n this._up = value;\n }\n\n /**\n * Gets whether the down mouse button (scroll down) is currently pressed.\n *\n * @returns True if the down button is pressed, false otherwise.\n */\n public get down(): boolean {\n return this._down;\n }\n\n /**\n * Sets whether the down mouse button (scroll down) is currently pressed.\n *\n * @param value True to indicate the down button is pressed, false otherwise.\n */\n public set down(value: boolean) {\n this._down = value;\n }\n\n /**\n * Gets whether the shift key is currently pressed.\n *\n * @returns True if the shift key is pressed, false otherwise.\n */\n public get shift(): boolean {\n return this._shift;\n }\n\n /**\n * Sets whether the shift key is currently pressed.\n *\n * @param value True to indicate the shift key is pressed, false otherwise.\n */\n public set shift(value: boolean) {\n this._shift = value;\n }\n\n /**\n * Gets whether the ctrl key is currently pressed.\n *\n * @returns True if the ctrl key is pressed, false otherwise.\n */\n public get ctrl(): boolean {\n return this._ctrl;\n }\n\n /**\n * Sets whether the ctrl key is currently pressed.\n *\n * @param value True to indicate the ctrl key is pressed, false otherwise.\n */\n public set ctrl(value: boolean) {\n this._ctrl = value;\n }\n\n /**\n * Gets whether the alt key is currently pressed.\n *\n * @returns True if the alt key is pressed, false otherwise.\n */\n public get alt(): boolean {\n return this._alt;\n }\n\n /**\n * Sets whether the alt key is currently pressed.\n *\n * @param value True to indicate the alt key is pressed, false otherwise.\n */\n public set alt(value: boolean) {\n this._alt = value;\n }\n\n /**\n * Create a new mouse state instance\n * @param state the mouse state\n */\n constructor(state: { x: number; y: number; left: boolean; middle: boolean; right: boolean; up: boolean; down: boolean }) {\n const { x, y, left, middle, right, up, down } = state;\n this._x = x;\n this._y = y;\n this._left = left;\n this._middle = middle;\n this._right = right;\n this._up = up;\n this._down = down;\n }\n\n /**\n * Releases all mouse buttons by setting their states to false.\n */\n public releaseButtons(): void {\n this._left = false;\n this._middle = false;\n this._right = false;\n }\n\n /**\n * Generates a bitmask representing the current state of mouse buttons and modifiers.\n *\n * @returns A number representing the button mask.\n */\n public getButtonMask(): number {\n let mask = 0;\n mask |= this._left ? 1 << 8 : 0;\n mask |= this._middle ? 1 << 9 : 0;\n mask |= this._right ? 1 << 10 : 0;\n mask |= this._up ? 1 << 11 : 0;\n mask |= this._down ? 1 << 12 : 0;\n mask |= this._shift ? 1 << 0 : 0;\n mask |= this._ctrl ? 1 << 2 : 0;\n mask |= this._alt ? 1 << 3 : 0;\n return mask;\n }\n\n public clone(): WebXMouseState {\n return new WebXMouseState({\n x: this._x,\n y: this._y,\n left: this._left,\n middle: this._middle,\n right: this._right,\n up: this._up,\n down: this._down\n });\n }\n\n}\n","import { WebXMouseState } from './mouse';\n\nexport class WebXMouse {\n /**\n * The current mouse state. The properties of this state are updated when\n * mouse events fire. This state object is also passed in as a parameter to\n * the handler of any mouse events.\n */\n private _currentState: WebXMouseState;\n\n private _contextMenuHandler = this._handleContextMenu.bind(this);\n private _mouseMoveHandler = this._handleMouseMove.bind(this);\n private _mouseDownHandler = this._handleMouseDown.bind(this);\n private _mouseUpHandler = this._handleMouseUp.bind(this);\n private _mouseOutHandler = this._handleMouseOut.bind(this);\n private _mouseWheelHandler = this._handleMouseWheel.bind(this);\n\n /**\n * Provides cross-browser mouse events for a given element\n * @param _element The element to use to provide mouse events\n */\n constructor(private _element: HTMLElement) {\n this._bindListeners();\n this._createDefaultState();\n }\n\n /**\n * Called when the client is disposed: removes any bound listeners\n */\n dispose(): void {\n this._unbindListeners();\n }\n\n /**\n * Cancel an event\n * @param event the event to cancel\n */\n private _cancelEvent(event: Event): void {\n event.stopPropagation();\n if (event.preventDefault) {\n event.preventDefault();\n }\n event.returnValue = false;\n }\n\n /**\n * Bind the mouse listeners to the given element\n */\n private _bindListeners(): void {\n const element = this._element;\n element.addEventListener('contextmenu', this._contextMenuHandler, false);\n element.addEventListener('mousemove', this._mouseMoveHandler);\n element.addEventListener('mousedown', this._mouseDownHandler);\n element.addEventListener('mouseup', this._mouseUpHandler);\n element.addEventListener('mouseout', this._mouseOutHandler);\n ['DOMMouseScroll', 'mousewheel', 'wheel'].forEach(listener => {\n element.addEventListener(listener, this._mouseWheelHandler, { passive: false });\n });\n this.reset = this.reset.bind(this);\n }\n\n /**\n * Unbinds the mouse listeners\n */\n private _unbindListeners(): void {\n const element = this._element;\n element.removeEventListener('contextmenu', this._contextMenuHandler, false);\n element.removeEventListener('mousemove', this._mouseMoveHandler);\n element.removeEventListener('mousedown', this._mouseDownHandler);\n element.removeEventListener('mouseup', this._mouseUpHandler);\n element.removeEventListener('mouseout', this._mouseOutHandler);\n ['DOMMouseScroll', 'mousewheel', 'wheel'].forEach(listener => {\n element.removeEventListener(listener, this._mouseWheelHandler);\n });\n this.reset = this.reset.bind(this);\n }\n\n /**\n * Creates the default state\n */\n private _createDefaultState(): void {\n this._currentState = new WebXMouseState({\n x: 0,\n y: 0,\n left: false,\n middle: false,\n right: false,\n up: false,\n down: false\n });\n }\n\n /**\n * Process mouse up event\n * @param event the mouse event\n */\n private _handleMouseUp(event: MouseEvent): void {\n switch (event.button) {\n case 0:\n this._currentState.left = false;\n break;\n case 1:\n this._currentState.middle = false;\n break;\n case 2:\n this._currentState.right = false;\n break;\n }\n this._notifyMouseUp();\n }\n\n /**\n * Process mouse down event\n * @param event the mouse event\n */\n private _handleMouseDown(event: MouseEvent): void {\n this._cancelEvent(event);\n switch (event.button) {\n case 0:\n this._currentState.left = true;\n break;\n case 1:\n this._currentState.middle = true;\n break;\n case 2:\n this._currentState.right = true;\n break;\n }\n this._notifyMouseDown();\n }\n\n /**\n * Process mouse wheel event\n * @param event the mouse event\n */\n private _handleMouseWheel(event: WheelEvent): void {\n if (event.deltaY < 0) {\n this._currentState.up = true;\n this._notifyMouseDown();\n\n this._currentState.up = false;\n this._notifyMouseUp();\n }\n\n if (event.deltaY > 0) {\n this._currentState.down = true;\n this._notifyMouseDown();\n\n this._currentState.down = false;\n this._notifyMouseUp();\n }\n this._cancelEvent(event);\n }\n\n /**\n * Process mouse out event\n */\n private _handleMouseOut(): void {\n // reset all buttons\n this._currentState.releaseButtons();\n this._notifyMouseOut();\n }\n\n /**\n * Process the mouse move event\n * @param event the mouse event\n */\n private _handleMouseMove(event: MouseEvent): void {\n this._cancelEvent(event);\n // get the container wrapping the display canvas element\n const bounds = this._element.firstElementChild.getBoundingClientRect();\n this._currentState.x = event.clientX - bounds.left;\n this._currentState.y = event.clientY - bounds.top;\n this._notifyMouseMove();\n }\n\n /**\n * Resets the mouse state\n */\n public reset(): void {\n this._currentState.releaseButtons();\n }\n /**\n * Process the context menu event\n * Block context menu so right-click gets sent properly\n * @param event the mouse event\n */\n private _handleContextMenu(event: MouseEvent): void {\n this._cancelEvent(event);\n }\n\n /**\n * Notify listener of the mouse move event\n * @Note: Sends a clone of the current state to avoid mutating the state\n */\n private _notifyMouseMove(): void {\n this.onMouseMove(this._currentState.clone());\n }\n\n /**\n * Notify listener of the mouse up event\n * @Note: Sends a clone of the current state to avoid mutating the state\n */\n private _notifyMouseUp(): void {\n this.onMouseUp(this._currentState.clone());\n }\n\n /**\n * Notify listener of the mouse down event\n * @Note: Sends a clone of the current state to avoid mutating the state\n */\n private _notifyMouseDown(): void {\n this.onMouseDown(this._currentState.clone());\n }\n\n /**\n * Notify listener of the mouse out event\n * @Note: Sends a clone of the current state to avoid mutating the state\n */\n private _notifyMouseOut(): void {\n this.onMouseOut(this._currentState.clone());\n }\n\n /**\n * Fired whenever the user moves the mouse\n * @param mouseState the current mouse state\n */\n onMouseMove(mouseState: WebXMouseState): void { }\n\n /**\n * Fired whenever a mouse button is effectively pressed. This can happen\n * as part of a \"click\" gesture initiated by the user by tapping one\n * or more fingers over the touchpad element, as part of a \"scroll\"\n * gesture initiated by dragging two fingers up or down, etc.\n *\n * @param mouseState the current mouse state\n */\n onMouseDown(mouseState: WebXMouseState): void { }\n\n /**\n * Fired whenever a mouse button is effectively released. This can happen\n * as part of a \"click\" gesture initiated by the user by tapping one\n * or more fingers over the touchpad element, as part of a \"scroll\"\n * gesture initiated by dragging two fingers up or down, etc.\n * @param mouseState the current mouse state\n */\n onMouseUp(mouseState: WebXMouseState): void { }\n\n /**\n * Fired whenever the mouse leaves the boundaries of the element associated\n * with this mouse\n *\n * @param mouseState the current mouse state\n */\n onMouseOut(mouseState: WebXMouseState): void { }\n\n}\n","import { WebXInstructionType } from './WebXInstructionType';\n\n/**\n * Base class for all WebX instructions.\n * \n * Instructions are either commands sent to the WebX Engine to perform specific actions or responses to messages from the engine.\n * Commands include connecting the engine, requesting window layout, handling input, requesting window image data.\n * Responses include acknowledging received data or ping messages.\n */\nexport abstract class WebXInstruction {\n private static _INSTRUCTION_COUNTER = 1;\n \n /**\n * The unique ID of the instruction.\n */\n public readonly id: number;\n \n /**\n * Indicates whether the instruction is synchronous or asynchronous.\n */\n public synchronous = false;\n\n /**\n * The type of the instruction.\n */\n public readonly type: WebXInstructionType;\n\n /**\n * Constructs a new WebXInstruction.\n * \n * @param type The type of the instruction.\n */\n constructor(type: WebXInstructionType) {\n this.id = WebXInstruction._INSTRUCTION_COUNTER++;\n this.type = type;\n }\n}\n","import { WebXInstruction } from './WebXInstruction';\n\n/**\n * Represents a response to a WebX instruction.\n * \n * This class encapsulates the result of executing an instruction, including\n * any data returned by the WebX Engine.\n */\nexport class WebXInstructionResponse<T> {\n /**\n * The ID of the instruction that this response corresponds to.\n */\n public readonly instructionId: number;\n\n /**\n * The data returned by the WebX Engine in response to the instruction.\n */\n public readonly data: any;\n\n /**\n * The callback to be invoked when a response is received.\n */\n private _onResponseReceived: (message: T) => void;\n\n /**\n * The callback to be invoked when an error occurs.\n */\n private _onError: (error: Error) => void;\n\n /**\n * The timeout duration in milliseconds.\n */\n private _timeoutMs: number;\n\n /**\n * The ID of the timeout.\n */\n private readonly _timeoutId: number = 0;\n\n /**\n * Constructs a new WebXInstructionResponse.\n * \n * @param instruction The WebX instruction associated with this response.\n * @param timeoutMs The timeout duration in milliseconds.\n */\n constructor(instruction: WebXInstruction, timeoutMs?: number) {\n this.instructionId = instruction.id;\n this.data = null;\n\n if (timeoutMs) {\n this._timeoutMs = timeoutMs;\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this._timeoutId = setTimeout(() => {\n this.reject('Request failed due to timeout');\n }, this._timeoutMs);\n }\n }\n\n /**\n * Registers a callback to be invoked when a response is received.\n * \n * @param onResponseReceived The callback to be invoked.\n * @returns The current instance of WebXInstructionResponse.\n */\n then(onResponseReceived: (message: T) => void): WebXInstructionResponse<T> {\n this._onResponseReceived = onResponseReceived;\n return this;\n }\n\n /**\n * Registers a callback to be invoked when an error occurs.\n * \n * @param onError The callback to be invoked.\n * @returns The current instance of WebXInstructionResponse.\n */\n catch(onError: (error: Error) => void): WebXInstructionResponse<T> {\n this._onError = onError;\n return this;\n }\n\n /**\n * Resolves the response with the provided message.\n * \n * @param message The response message.\n */\n resolve(message: T): void {\n if (this._timeoutId > 0) {\n clearTimeout(this._timeoutId);\n }\n if (this._onResponseReceived != null) {\n this._onResponseReceived(message);\n }\n }\n\n /**\n * Rejects the response with the provided error message.\n * \n * @param error The error message.\n */\n reject(error: string): void {\n if (this._onError) {\n this._onError(new Error(error));\n }\n }\n}\n","/**\n * Enum representing the types of WebX instructions.\n *\n * These types are used to categorize instructions sent to the WebX Engine.\n */\nexport enum WebXInstructionType {\n\n /**\n * Instruction to connect to the WebX Engine.\n */\n CONNECT = 1,\n\n /**\n * Instruction to request visible window layout.\n */\n WINDOWS = 2,\n\n /**\n * Instruction to request window image data.\n */\n IMAGE = 3,\n\n /**\n * Instruction to request the screen settings.\n */\n SCREEN = 4,\n\n /**\n * Instruction to send a mouse event.\n */\n MOUSE = 5,\n\n /**\n * Instruction to send a keyboard event.\n */\n KEYBOARD = 6,\n\n /**\n * Instruction to request the cursor image.\n */\n CURSOR_IMAGE = 7,\n\n /**\n * Instruction to set the quality index.\n */\n QUALITY = 8,\n\n /**\n * Instruction to respond to a ping message.\n */\n PONG = 9,\n\n /**\n * Instruction to acknowledge data.\n */\n DATA_ACK = 10,\n\n /**\n * Instruction to send clipboard data to the WebX Engine.\n */\n CLIPBOARD = 11,\n\n /**\n * Instruction to request the window shape image (stencil image).\n */\n SHAPE = 12,\n}\n\nexport namespace WebXInstructionType {\n /**\n * Converts a string representation of a WebX instruction type to its corresponding enum value.\n * @param value the string representation of the instruction type.\n * @returns the corresponding WebXInstructionType enum value.\n */\n export function fromString(value: string): WebXInstructionType {\n switch (value) {\n case 'CONNECT':\n return WebXInstructionType.CONNECT;\n case 'WINDOWS':\n return WebXInstructionType.WINDOWS;\n case 'IMAGE':\n return WebXInstructionType.IMAGE;\n case 'SCREEN':\n return WebXInstructionType.SCREEN;\n case 'MOUSE':\n return WebXInstructionType.MOUSE;\n case 'KEYBOARD':\n return WebXInstructionType.KEYBOARD;\n case 'CURSOR_IMAGE':\n return WebXInstructionType.CURSOR_IMAGE;\n case 'QUALITY':\n return WebXInstructionType.QUALITY;\n case 'PONG':\n return WebXInstructionType.PONG;\n case 'DATA_ACK':\n return WebXInstructionType.DATA_ACK;\n case 'CLIPBOARD':\n return WebXInstructionType.CLIPBOARD;\n case 'SHAPE':\n return WebXInstructionType.SHAPE;\n }\n }\n}\n","import { WebXInstruction } from './WebXInstruction';\nimport { WebXInstructionType } from './WebXInstructionType';\n\n/**\n * Represents an instruction to establish a connection with the WebX Engine.\n * \n * This instruction is used to initiate the connection process and send any\n * necessary connection parameters.\n */\nexport class WebXConnectInstruction extends WebXInstruction {\n /**\n * The connection parameters to be sent with the instruction.\n */\n public readonly parameters: any;\n\n /**\n * Constructs a new WebXConnectInstruction.\n * \n * @param parameters The connection parameters.\n */\n constructor(parameters: any) {\n super(WebXInstructionType.CONNECT);\n this.parameters = parameters;\n }\n}\n","import { WebXInstruction } from './WebXInstruction';\nimport { WebXInstructionType } from './WebXInstructionType';\n\n/**\n * Represents an instruction to request screen information from the WebX Engine.\n * \n * This instruction is used to retrieve the screen size.\n */\nexport class WebXScreenInstruction extends WebXInstruction {\n /**\n * Constructs a new WebXScreenInstruction.\n */\n constructor() {\n super(WebXInstructionType.SCREEN);\n }\n}\n","import { WebXInstruction } from './WebXInstruction';\nimport { WebXInstructionType } from './WebXInstructionType';\n\n/**\n * Represents an instruction to request the list of visible windows.\n * \n * This instruction is used to fetch information about all currently visible\n * windows from the WebX Engine.\n */\nexport class WebXWindowsInstruction extends WebXInstruction {\n /**\n * Constructs a new WebXWindowsInstruction.\n */\n constructor() {\n super(WebXInstructionType.WINDOWS);\n }\n}\n","import { WebXInstruction } from './WebXInstruction';\nimport { WebXInstructionType } from './WebXInstructionType';\n\n/**\n * Represents an instruction to request an image for a specific window.\n * \n * This instruction is used to fetch the image data for a window from the WebX Engine.\n */\nexport class WebXImageInstruction extends WebXInstruction {\n /**\n * The ID of the window for which the image is requested.\n */\n public readonly windowId: number;\n\n /**\n * Constructs a new WebXImageInstruction.\n * \n * @param windowId The ID of the window.\n */\n constructor(windowId: number) {\n super(WebXInstructionType.IMAGE);\n this.windowId = windowId;\n }\n}\n","import { WebXInstruction } from './WebXInstruction';\nimport { WebXInstructionType } from './WebXInstructionType';\n\n/**\n * Represents an instruction to update the mouse state in the WebX Engine.\n * \n * This instruction is used to send mouse movement or button state changes to the WebX Engine.\n */\nexport class WebXMouseInstruction extends WebXInstruction {\n /**\n * The x-coordinate of the mouse pointer.\n */\n public readonly x: number;\n\n /**\n * The y-coordinate of the mouse pointer.\n */\n public readonly y: number;\n\n /**\n * The button mask representing the state of mouse buttons.\n */\n public readonly buttonMask: number;\n\n /**\n * Constructs a new WebXMouseInstruction.\n * \n * @param x The x-coordinate of the mouse pointer.\n * @param y The y-coordinate of the mouse pointer.\n * @param buttonMask The button mask representing the state of mouse buttons.\n */\n constructor(x: number, y: number, buttonMask: number) {\n super(WebXInstructionType.MOUSE);\n this.x = x;\n this.y = y;\n this.buttonMask = buttonMask;\n }\n}\n","import { WebXInstruction } from './WebXInstruction';\nimport { WebXInstructionType } from './WebXInstructionType';\n\n/**\n * Represents an instruction to update the keyboard state in the WebX Engine.\n * \n * This instruction is used to send key press or release events to the WebX Engine.\n */\nexport class WebXKeyboardInstruction extends WebXInstruction {\n /**\n * The key code of the key being pressed or released.\n */\n public readonly key: number;\n\n /**\n * Whether the key is being pressed (true) or released (false).\n */\n public readonly pressed: boolean;\n\n /**\n * Constructs a new WebXKeyboardInstruction.\n * \n * @param key The key code of the key being pressed or released.\n * @param pressed Whether the key is being pressed (true) or released (false).\n */\n constructor(key: number, pressed: boolean) {\n super(WebXInstructionType.KEYBOARD);\n this.key = key;\n this.pressed = pressed;\n }\n}\n","import { WebXInstruction } from './WebXInstruction';\nimport { WebXInstructionType } from './WebXInstructionType';\n\n/**\n * Represents an instruction to request a cursor image.\n * \n * This instruction is used to fetch the cursor image data from the WebX Engine.\n */\nexport class WebXCursorImageInstruction extends WebXInstruction {\n /**\n * The ID of the cursor for which the image is requested.\n */\n public readonly cursorId: number;\n\n /**\n * Constructs a new WebXCursorImageInstruction.\n * \n * @param cursorId The ID of the cursor.\n */\n constructor(cursorId: number) {\n super(WebXInstructionType.CURSOR_IMAGE);\n this.cursorId = cursorId;\n }\n}\n","import { WebXInstruction } from './WebXInstruction';\nimport { WebXInstructionType } from './WebXInstructionType';\n\n/**\n * Represents an instruction to set the quality index in the WebX client.\n * \n * This instruction is used to adjust the quality of the remote desktop display.\n * The quality index determines the quality of the images and the refresh rate of the windows.\n */\nexport class WebXQualityInstruction extends WebXInstruction {\n /**\n * The quality index to set.\n */\n public readonly qualityIndex: number;\n\n /**\n * Constructs a new WebXQualityInstruction.\n * \n * @param qualityIndex The quality index to set.\n */\n constructor(qualityIndex: number) {\n super(WebXInstructionType.QUALITY);\n this.qualityIndex = qualityIndex;\n }\n}\n","import { WebXInstruction } from './WebXInstruction';\nimport { WebXInstructionType } from './WebXInstructionType';\n\n/**\n * Represents an instruction to respond to a ping from the WebX Engine.\n * \n * This instruction is used to acknowledge a ping and maintain the connection.\n */\nexport class WebXPongInstruction extends WebXInstruction {\n /**\n * The timestamp in milliseconds (copied from the message from the engine).\n */\n public readonly timestampMs: Uint8Array;\n\n /**\n * Constructs a new WebXPongInstruction.\n * \n * @param timestampMs The timestamp in milliseconds.\n */\n constructor(timestampMs: Uint8Array) {\n super(WebXInstructionType.PONG);\n this.timestampMs = timestampMs;\n }\n}\n","import { WebXInstruction } from './WebXInstruction';\nimport { WebXInstructionType } from './WebXInstructionType';\n\n/**\n * Represents an instruction to acknowledge received data.\n * \n * This instruction is used to notify the WebX Engine that a specific amount\n * of data has been successfully received.\n */\nexport class WebXDataAckInstruction extends WebXInstruction {\n /**\n * The timestamp in milliseconds: timestamp originates from the message containing the sent the data (ie timestamp of\n * the WebX Engine).\n */\n public readonly timestampMs: Uint8Array;\n\n /**\n * The length of the data.\n */\n public readonly dataLength: number;\n\n /**\n * Constructs a new WebXDataAckInstruction.\n * \n * @param timestampMs The timestamp in milliseconds.\n * @param dataLength The length of the data.\n */\n constructor(timestampMs: Uint8Array, dataLength: number) {\n super(WebXInstructionType.DATA_ACK);\n this.timestampMs = timestampMs;\n this.dataLength = dataLength;\n }\n}\n","import { WebXInstruction } from './WebXInstruction';\nimport { WebXInstructionType } from './WebXInstructionType';\n\n/**\n * Represents an instruction to send clipboard data to the WebX Engine.\n *\n * This instruction is used to notify the WebX Engine that clipboard data has been set.\n */\nexport class WebXClipboardInstruction extends WebXInstruction {\n\n /**\n * The clipboard content.\n */\n public readonly clipboardContent: string;\n\n /**\n * Constructs a new WebXClipboardInstruction.\n *\n * @param clipboardContent The clipboard content.\n */\n constructor(clipboardContent: string) {\n super(WebXInstructionType.CLIPBOARD);\n this.clipboardContent = clipboardContent;\n }\n}\n","import { WebXInstruction } from './WebXInstruction';\nimport { WebXInstructionType } from './WebXInstructionType';\n\n/**\n * Represents an instruction to request a shape image for a specific window (stencil image).\n *\n * This instruction is used to fetch the stencil image data for a window from the WebX Engine.\n */\nexport class WebXShapeInstruction extends WebXInstruction {\n /**\n * The ID of the window for which the image is requested.\n */\n public readonly windowId: number;\n\n /**\n * Constructs a new WebXImageInstruction.\n *\n * @param windowId The ID of the window.\n */\n constructor(windowId: number) {\n super(WebXInstructionType.SHAPE);\n this.windowId = windowId;\n }\n}\n","import { WebXInstruction } from '../instruction';\n\n/**\n * Interface for handling WebX instructions.\n * \n * Implementations of this interface are responsible for processing WebX instructions\n * and providing a mechanism to clean up resources when no longer needed.\n */\nexport abstract class WebXInstructionHandler {\n /**\n * Processes a WebX instruction.\n * \n * @param instruction The WebX instruction to process.\n */\n abstract handle(instruction: WebXInstruction): void;\n\n /**\n * Cleans up resources associated with the handler.\n * \n * This method should be called when the handler is no longer needed.\n */\n abstract destroy(): void;\n}\n","import { WebXMessage } from '../message';\n\n/**\n * Abstract class for handling WebX messages.\n * \n * Implementations of this class are responsible for processing WebX messages\n * and providing a mechanism to clean up resources when no longer needed.\n */\nexport abstract class WebXMessageHandler {\n /**\n * Processes a WebX message.\n * \n * @param message The WebX message to process.\n */\n abstract handle(message: WebXMessage): void;\n\n /**\n * Cleans up resources associated with the handler.\n * \n * This method should be called when the handler is no longer needed.\n */\n abstract destroy(): void;\n}\n","/**\n * Interface for handling WebX statistics.\n * \n * Implementations of this interface are responsible for processing WebX statistics\n * and providing a mechanism to clean up resources when no longer needed.\n */\nexport abstract class WebXStatsHandler {\n /**\n * Processes WebX statistics.\n * \n * @param stats The WebX statistics to process.\n */\n abstract handle(stats: { received: number; sent: number }): void;\n\n /**\n * Cleans up resources associated with the handler.\n * \n * This method should be called when the handler is no longer needed.\n */\n abstract destroy(): void;\n}\n","/**\n * Utility class for generating colors.\n *\n * This class provides methods to generate random colors or retrieve colors\n * from a predefined palette based on an index.\n */\nexport class WebXColorGenerator {\n\n private static _COLOURS = [\n '#FF6633', '#FFB399', '#FF33FF', '#FFFF99', '#00B3E6',\n '#E6B333', '#3366E6', '#999966', '#99FF99', '#B34D4D',\n '#80B300', '#809900', '#E6B3B3', '#6680B3', '#66991A',\n '#FF99E6', '#CCFF1A', '#FF1A66', '#E6331A', '#33FFCC',\n '#66994D', '#B366CC', '#4D8000', '#B33300', '#CC80CC',\n '#66664D', '#991AFF', '#E666FF', '#4DB3FF', '#1AB399',\n '#E666B3', '#33991A', '#CC9999', '#B3B31A', '#00E680',\n '#4D8066', '#809980', '#E6FF80', '#1AFF33', '#999933',\n '#FF3380', '#CCCC00', '#66E64D', '#4D80CC', '#9900B3',\n '#E64D66', '#4DB380', '#FF4D4D', '#99E6E6', '#6666FF'\n ]\n\n /**\n * Generates a random color from the predefined palette.\n *\n * @returns A random color as a hexadecimal string.\n */\n public static randomColour(): string {\n const index = Math.floor(Math.random() * WebXColorGenerator._COLOURS.length);\n return WebXColorGenerator._COLOURS[index];\n }\n\n /**\n * Retrieves a color from the predefined palette based on the given index.\n *\n * If the index exceeds the palette size, it wraps around using modulo.\n *\n * @param index The index of the color to retrieve.\n * @returns The color as a hexadecimal string.\n */\n public static indexedColour(index: number): string {\n index = index % WebXColorGenerator._COLOURS.length;\n return WebXColorGenerator._COLOURS[index];\n }\n}\n","/**\n * WebXVersion class\n * Encapsulates a version number in the format of major.minor.patch\n */\nexport class WebXVersion {\n\n /**\n * The major version number.\n */\n public readonly major: number;\n\n /**\n * The minor version number.\n */\n public readonly minor: number;\n\n /**\n * The patch version number.\n */\n public readonly patch: number;\n\n /**\n * The version string.\n */\n public readonly version: string;\n\n /**\n * The version major.minor as a number\n */\n public readonly versionNumber: number;\n\n /**\n * Constructs a new WebXVersion object.\n *\n * @param major The major version number.\n * @param minor The minor version number.\n * @param patch The patch version number.\n */\n constructor(major: number = 0, minor: number = 0, patch: number = 0) {\n this.major = major;\n this.minor = minor;\n this.patch = patch;\n this.version = `${major}.${minor}.${patch}`;\n this.versionNumber = parseFloat(`${major}.${minor}`);\n }\n}\n","import { Object3D, Scene, PlaneGeometry, MeshBasicMaterial, BackSide, Mesh } from 'three';\nimport { Tween, Group, Easing } from '@tweenjs/tween.js';\nimport { WebXColorGenerator } from \"../utils\";\nimport { WebXDisplay } from \"../display\";\nimport { WebXImageMessage, WebXMessage, WebXMessageType, WebXSubImagesMessage } from \"../message\";\nimport { WebXMessageHandler } from \"./WebXMessageHandler\";\nimport { WebXHandler } from \"./WebXHandler\";\n\n/**\n * Handles debug image messages for the WebX client.\n * This class is responsible for rendering debug images in a 3D scene\n * and managing their lifecycle.\n */\nexport class WebXDebugImageMessageHandler extends WebXMessageHandler implements WebXHandler {\n\n /**\n * Geometry used for creating debug image planes.\n */\n private static _PLANE_GEOMETRY: PlaneGeometry = new PlaneGeometry(1.0, 1.0, 2, 2);\n\n private _scene: Scene;\n private _debugLayer: Object3D = new Object3D();\n private _currentZ = 0;\n private _disposed = false;\n private _tweenGroup = new Group();\n\n /**\n * Constructs a new WebXDebugImageMessageHandler.\n * @param _display The WebX display instance used for rendering.\n */\n constructor(private _display: WebXDisplay) {\n super();\n this._debugLayer.position.set(0, 0, 999);\n this._scene = this._display.scene;\n this._scene.add(this._debugLayer);\n\n this._animate();\n }\n\n /**\n * Creates a mesh for rendering a debug image.\n * @param x The x-coordinate of the mesh.\n * @param y The y-coordinate of the mesh.\n * @param width The width of the mesh.\n * @param height The height of the mesh.\n * @param colour The color of the mesh.\n */\n private _createMesh(x: number, y: number, width: number, height: number, colour: string): void {\n const material = new MeshBasicMaterial({ color: colour, opacity: 0.8, transparent: true });\n material.side = BackSide;\n\n const mesh = new Mesh(WebXDebugImageMessageHandler._PLANE_GEOMETRY, material);\n mesh.position.set(x + width / 2, y + height / 2, this._currentZ);\n mesh.scale.set(width, height, 1);\n this._currentZ += 0.0001;\n this._debugLayer.add(mesh);\n\n new Tween(material, this._tweenGroup)\n .to({ opacity: 0.0 }, 500)\n .easing(Easing.Quadratic.Out)\n .onComplete(() => this._debugLayer.remove(mesh))\n .onUpdate(() => this._display.sceneDirty = true)\n .start();\n }\n\n /**\n * Handles an incoming WebX message.\n * @param message The WebX message to handle.\n */\n handle(message: WebXMessage): void {\n\n if (message.type === WebXMessageType.IMAGE) {\n const imageMessage = message as WebXImageMessage;\n const window = this._display.getWindow(imageMessage.windowId);\n const { width, height } = imageMessage.colorMap.image;\n\n this._createMesh(window.x, window.y, width, height, WebXColorGenerator.indexedColour(window.colorIndex));\n\n } else if (message.type === WebXMessageType.SUBIMAGES) {\n const subImageMessage = message as WebXSubImagesMessage;\n const window = this._display.getWindow(subImageMessage.windowId);\n\n subImageMessage.subImages.forEach(subImage => {\n this._createMesh(window.x + subImage.x, window.y + subImage.y, subImage.width, subImage.height, WebXColorGenerator.indexedColour(window.colorIndex));\n });\n }\n }\n\n /**\n * Cleans up resources used by this handler.\n */\n destroy(): void {\n this._disposed = true;\n\n this._debugLayer.children.forEach((child: Mesh) => {\n const material = child.material as MeshBasicMaterial;\n material.dispose();\n });\n\n this._debugLayer.clear();\n this._debugLayer.removeFromParent();\n }\n\n /**\n * Animates the debug layer.\n */\n private _animate(): void {\n if (!this._disposed) {\n requestAnimationFrame((time) => {\n this._tweenGroup.update(time);\n this._animate();\n });\n }\n }\n\n}\n","import { WebXInstruction } from '../instruction';\n\n/**\n * Represents a buffer for encoding and decoding WebX instructions.\n *\n * This class provides methods to write and read data in a structured format\n * for communication with the WebX Engine.\n */\nexport class WebXInstructionBuffer {\n\n private readonly _buffer: ArrayBuffer;\n private _offset: number;\n\n /**\n * Creates a new instance of WebXInstructionBuffer.\n *\n * @param instruction The WebX instruction.\n * @param length The length of the buffer in bytes.\n */\n constructor(instruction: WebXInstruction, length: number) {\n // 16 for sessionID place holder (set by the relay), 4 for the clientId (set by the relay) and 8 for the instruction type and id, 4 padding\n // Maintain 8 bit alignment to ensure long values can be written without additional padding\n const headerSize = 32;\n this._buffer = new ArrayBuffer(length + headerSize);\n\n this._offset = 20;\n\n // add the header\n if (instruction.synchronous) {\n this.putUInt32(0x80000000 | instruction.type);\n } else {\n this.putUInt32(instruction.type);\n }\n this.putUInt32(instruction.id);\n\n // Padding to make up 32 bytes (maintaining 8 bit alignment)\n this.putUInt32(0);\n }\n\n private _getNextOffset(sizeOfData: number): number {\n // Ensure alignment\n const padding = this._offset % sizeOfData > 0 ? sizeOfData - (this._offset % sizeOfData) : 0;\n const position = this._offset + padding;\n\n this._offset += sizeOfData + padding;\n\n return position;\n }\n\n /**\n * Write a signed 32 bit integer to the buffer\n * @param value the value to write\n */\n public putInt32(value: number): WebXInstructionBuffer {\n const offset = this._getNextOffset(4);\n const typedArray = new Int32Array(this._buffer, offset, 1);\n typedArray[0] = value;\n return this;\n }\n\n /**\n * Write an unsigned 8 bit integer to the buffer\n * @param value the value to write\n */\n public putUInt8(value: number): WebXInstructionBuffer {\n const offset = this._getNextOffset(1);\n const typedArray = new Uint8Array(this._buffer, offset, 1);\n typedArray[0] = value;\n return this;\n }\n\n /**\n * Write an unsigned 32 bit integer to the buffer\n * @param value the value to write\n */\n putUInt32(value: number): WebXInstructionBuffer {\n const offset = this._getNextOffset(4);\n const typedArray = new Uint32Array(this._buffer, offset, 1);\n typedArray[0] = value;\n return this;\n }\n\n /**\n * Write an array of unsigned 8 bit integers to the buffer\n * @param array the array to write\n * @param length the length of the array\n */\n putUInt8Array(array: Uint8Array, length: number): WebXInstructionBuffer {\n const offset = this._getNextOffset(8);\n const typedArray = new Uint8Array(this._buffer, offset, length);\n typedArray.set(array);\n return this;\n }\n\n /**\n * Write a string to the buffer\n * @param value the value to write\n */\n public putString(value: string): WebXInstructionBuffer {\n for (let i = 0; i < value.length; i++) {\n this.putUInt8(value.charCodeAt(i));\n }\n return this;\n }\n\n /**\n * Write a boolean to the buffer\n * @param value the value to write\n */\n public putBoolean(value: boolean): WebXInstructionBuffer {\n this.putUInt32(value === true ? 0xff : 0x00);\n return this;\n }\n\n /**\n * Get the array buffer\n * @returns the array buffer\n */\n public buffer(): ArrayBuffer {\n return this._buffer;\n }\n\n}\n","/**\n * Represents a buffer for encoding and decoding WebX messages.\n *\n * This class provides methods to write and read data in a structured format\n * for communication with the WebX Engine.\n */\nexport class WebXMessageBuffer {\n /**\n * The length of the message header in bytes.\n */\n public static readonly MESSAGE_HEADER_LENGTH = 48;\n\n /**\n * The timestamp in milliseconds when the message was created.\n */\n public readonly timestampMs: Uint8Array;\n\n /**\n * The type ID of the message.\n */\n public readonly messageTypeId: number;\n\n /**\n * The unique ID of the message.\n */\n public readonly messageId: number;\n\n /**\n * The total length of the buffer in bytes.\n */\n public readonly bufferLength: number;\n\n /**\n * Gets the current read offset\n */\n public get readOffset(): number {\n return this._readOffset;\n }\n\n /**\n * Returns the raw ArrayBuffer object\n */\n get buffer(): ArrayBuffer {\n return this._buffer;\n }\n\n private _readOffset: number = 24;\n private _encoder: TextDecoder = new TextDecoder('utf-8');\n\n\n\n /**\n * Creates a new instance of WebXMessageBuffer.\n *\n * @param _buffer The buffer to read from.\n */\n constructor(private _buffer: ArrayBuffer) {\n this._readOffset = 24; // Session Id (16) and client index mask (8)\n this.timestampMs = this.getUint8Array(8);\n this.messageTypeId = this.getUint32();\n this.messageId = this.getUint32();\n this.bufferLength = this.getUint32();\n this._readOffset = WebXMessageBuffer.MESSAGE_HEADER_LENGTH;\n }\n\n /**\n * Reads a 32-bit signed integer from the buffer.\n *\n * @returns The read value.\n */\n public getInt32(): number {\n const offset = this._getNextReadOffset(4);\n const typedArray = new Int32Array(this._buffer, offset, 1);\n return typedArray[0];\n }\n\n /**\n * Reads a 32-bit unsigned integer from the buffer.\n *\n * @returns The read value.\n */\n public getUint32(): number {\n const offset = this._getNextReadOffset(4);\n const typedArray = new Uint32Array(this._buffer, offset, 1);\n return typedArray[0];\n }\n\n /**\n * Reads a 32-bit floating point number from the buffer.\n *\n * @returns The read value.\n */\n public getFloat(): number {\n const offset = this._getNextReadOffset(4);\n const typedArray = new Float32Array(this._buffer, offset, 1);\n return typedArray[0];\n }\n\n /**\n * Reads a Uint8Array from the buffer.\n *\n * @param length The length of the array to read.\n * @returns The read Uint8Array.\n */\n public getUint8Array(length: number): Uint8Array {\n const typedArray = new Uint8Array(this._buffer, this._readOffset, length);\n this._readOffset += length;\n return typedArray;\n }\n\n /**\n * Reads a string from the buffer.\n *\n * @param length The length of the string to read.\n * @returns The read string.\n */\n public getString(length: number): string {\n const array = new Uint8Array(this._buffer, this._readOffset, length);\n this._readOffset += length;\n return this._encoder.decode(array);\n }\n\n /**\n * Calculates the next read offset, ensuring alignment.\n *\n * @param sizeOfData The size of the data to read.\n * @returns The next read offset.\n */\n private _getNextReadOffset(sizeOfData: number): number {\n // Ensure alignment\n const padding = this._readOffset % sizeOfData > 0 ? sizeOfData - (this._readOffset % sizeOfData) : 0;\n const position = this._readOffset + padding;\n\n this._readOffset += sizeOfData + padding;\n\n return position;\n }\n}\n","import {\n WebXConnectInstruction,\n WebXCursorImageInstruction,\n WebXImageInstruction,\n WebXInstruction,\n WebXInstructionType,\n WebXKeyboardInstruction,\n WebXMouseInstruction,\n WebXScreenInstruction,\n WebXWindowsInstruction,\n WebXQualityInstruction,\n WebXPongInstruction,\n WebXDataAckInstruction,\n WebXClipboardInstruction,\n WebXShapeInstruction,\n} from '../instruction';\nimport {WebXInstructionBuffer} from \"./WebXInstructionBuffer\";\n\n/**\n * Encodes WebX instructions into a format suitable for transmission.\n * This class handles various instruction types and ensures they are\n * serialized correctly.\n */\nexport class WebXInstructionEncoder {\n\n /**\n * Convert the given instruction to an array buffer ready to be sent along the wire\n * @param instruction the instruction to encode\n * @returns The encoded instruction as an ArrayBuffer.\n */\n public encode(instruction: WebXInstruction): ArrayBuffer {\n if (instruction.type === WebXInstructionType.MOUSE) {\n return this._createMouseInstruction(instruction as WebXMouseInstruction);\n\n } else if (instruction.type === WebXInstructionType.KEYBOARD) {\n return this._createKeyboardInstruction(instruction as WebXKeyboardInstruction);\n\n } else if (instruction.type === WebXInstructionType.CURSOR_IMAGE) {\n return this._createCursorImageInstruction(instruction as WebXCursorImageInstruction);\n\n } else if (instruction.type === WebXInstructionType.IMAGE) {\n return this._createImageInstruction(instruction as WebXImageInstruction);\n\n } else if (instruction.type === WebXInstructionType.CONNECT) {\n return this._createConnectInstruction(instruction as WebXConnectInstruction);\n\n } else if (instruction.type === WebXInstructionType.SCREEN) {\n return this._createScreenInstruction(instruction as WebXScreenInstruction);\n\n } else if (instruction.type === WebXInstructionType.WINDOWS) {\n return this._createWindowsInstruction(instruction as WebXWindowsInstruction);\n\n } else if (instruction.type === WebXInstructionType.QUALITY) {\n return this._createQualityInstruction(instruction as WebXQualityInstruction);\n\n } else if (instruction.type === WebXInstructionType.PONG) {\n return this._createPongInstruction(instruction as WebXPongInstruction);\n\n } else if (instruction.type === WebXInstructionType.DATA_ACK) {\n return this._createDataAckInstruction(instruction as WebXDataAckInstruction);\n\n } else if (instruction.type === WebXInstructionType.CLIPBOARD) {\n return this._createClipboardInstruction(instruction as WebXClipboardInstruction);\n\n } else if (instruction.type === WebXInstructionType.SHAPE) {\n return this._createShapeInstruction(instruction as WebXShapeInstruction);\n }\n return null;\n }\n\n /**\n * Create a new mouse instruction\n * @param instruction the mouse instruction to encode\n * Structure:\n * Header: 32 bytes\n * sessionId: 16 bytes\n * clientId:4 bytes\n * type: 4 bytes\n * id: 4 bytes\n * padding: 4 bytes\n * Content: 4 bytes\n * x: 4 bytes\n * y: 4 bytes\n * buttonMask: 4 bytes\n */\n private _createMouseInstruction(instruction: WebXMouseInstruction): ArrayBuffer {\n const encoder = new WebXInstructionBuffer(instruction, 12);\n return encoder\n // write the contents\n .putInt32(instruction.x)\n .putInt32(instruction.y)\n .putUInt32(instruction.buttonMask)\n .buffer();\n }\n\n /**\n * Create a new cursor image instruction\n * @param instruction the cursor image instruction to encode\n * Structure:\n * Header: 32 bytes\n * sessionId: 16 bytes\n * clientId:4 bytes\n * type: 4 bytes\n * id: 4 bytes\n * padding: 4 bytes\n * Content: 4 bytes\n * cursorId: 4 bytes\n */\n private _createCursorImageInstruction(instruction: WebXCursorImageInstruction): ArrayBuffer {\n const encoder = new WebXInstructionBuffer(instruction, 4);\n return encoder\n // write the contents\n .putInt32(instruction.cursorId)\n .buffer();\n }\n\n /**\n * Create a new image instruction\n * @param instruction the image instruction to encode\n * Structure:\n * Header: 32 bytes\n * sessionId: 16 bytes\n * clientId:4 bytes\n * type: 4 bytes\n * id: 4 bytes\n * padding: 4 bytes\n * Content: 4 bytes\n * windowId: 4 bytes\n */\n private _createImageInstruction(instruction: WebXImageInstruction): ArrayBuffer {\n const encoder = new WebXInstructionBuffer(instruction, 4);\n return encoder\n // write the contents\n .putUInt32(instruction.windowId)\n .buffer();\n }\n\n /**\n * Create a keyboard instruction\n * @param instruction the keyboard instruction to encode\n * Structure:\n * Header: 32 bytes\n * sessionId: 16 bytes\n * clientId: 4 bytes\n * type: 4 bytes\n * id: 4 bytes\n * padding: 4 bytes\n * Content: 8 bytes\n * key (the keyboard key code): 4 bytes\n * pressed: 4 bytes\n */\n private _createKeyboardInstruction(instruction: WebXKeyboardInstruction): ArrayBuffer {\n const encoder = new WebXInstructionBuffer(instruction, 8);\n return encoder\n // write the contents\n .putUInt32(instruction.key)\n .putBoolean(instruction.pressed)\n .buffer();\n }\n\n /**\n * Create a screen instruction\n * @param instruction the screen instruction to encode\n * Structure:\n * Header: 32 bytes\n * sessionId: 16 bytes\n * clientId: 4 bytes\n * type: 4 bytes\n * id: 4 bytes\n * padding: 4 bytes\n */\n private _createScreenInstruction(instruction: WebXScreenInstruction): ArrayBuffer {\n const encoder = new WebXInstructionBuffer(instruction, 0);\n return encoder.buffer();\n }\n\n /**\n * Create a windows instruction\n * Structure:\n * Header: 32 bytes\n * sessionId: 16 bytes\n * clientId: 4 bytes\n * type: 4 bytes\n * id: 4 bytes\n * padding: 4 bytes\n * @param instruction the windows instruction to encode\n */\n private _createWindowsInstruction(instruction: WebXWindowsInstruction): ArrayBuffer {\n const encoder = new WebXInstructionBuffer(instruction, 0);\n return encoder.buffer();\n }\n\n /**\n * Create a connect instruction\n * @param instruction the connect instruction to encode\n * Structure:\n * Header: 32 bytes\n * sessionId: 16 bytes\n * clientId: 4 bytes\n * type: 4 bytes\n * id: 4 bytes\n * padding: 4 bytes\n */\n private _createConnectInstruction(instruction: WebXConnectInstruction): ArrayBuffer {\n const encoder = new WebXInstructionBuffer(instruction, 0);\n return encoder.buffer();\n }\n\n\n /**\n * Create a new quality instruction\n * @param instruction the quality instruction to encode\n * Structure:\n * Header: 32 bytes\n * sessionId: 16 bytes\n * clientId: 4 bytes\n * type: 4 bytes\n * id: 4 bytes\n * padding: 4 bytes\n * Content: 4 bytes\n * qualityIndex: 4 bytes\n */\n private _createQualityInstruction(instruction: WebXQualityInstruction): ArrayBuffer {\n const encoder = new WebXInstructionBuffer(instruction, 4);\n return encoder\n // write the contents\n .putUInt32(instruction.qualityIndex)\n .buffer();\n }\n\n /**\n * Create a new pong instruction\n * @param instruction the pong instruction to encode\n * Structure:\n * Header: 32 bytes\n * sessionId: 16 bytes\n * clientId: 4 bytes\n * type: 4 bytes\n * id: 4 bytes\n * padding: 4 bytes\n * Content: 8 bytes\n * timestampMs: 8 bytes\n */\n private _createPongInstruction(instruction: WebXPongInstruction): ArrayBuffer {\n const encoder = new WebXInstructionBuffer(instruction, 8);\n return encoder\n // write the contents\n .putUInt8Array(instruction.timestampMs, 8)\n .buffer();\n }\n\n /**\n * Create a new data ack instruction\n * @param instruction the data ack instruction to encode\n * Structure:\n * Header: 32 bytes\n * sessionId: 16 bytes\n * clientId: 4 bytes\n * type: 4 bytes\n * id: 4 bytes\n * padding: 4 bytes\n * Content: 8 bytes\n * timestampMs: 8 bytes\n * dataLength: 4 bytes\n */\n private _createDataAckInstruction(instruction: WebXDataAckInstruction): ArrayBuffer {\n const encoder = new WebXInstructionBuffer(instruction, 12);\n return encoder\n // write the contents\n .putUInt8Array(instruction.timestampMs, 8)\n .putUInt32(instruction.dataLength)\n .buffer();\n }\n\n /**\n * Create a new clipboard instruction\n * @param instruction the clipboard instruction to encode\n * Structure:\n * Header: 32 bytes\n * sessionId: 16 bytes\n * clientId: 4 bytes\n * type: 4 bytes\n * id: 4 bytes\n * padding: 4 bytes\n * Content:\n * clipboardContentLength: 4 bytes\n * clipboardContent: N bytes\n */\n private _createClipboardInstruction(instruction: WebXClipboardInstruction): ArrayBuffer {\n const length = 4 + instruction.clipboardContent.length;\n const encoder = new WebXInstructionBuffer(instruction, length);\n return encoder\n // write the contents\n .putUInt32(instruction.clipboardContent.length)\n .putString(instruction.clipboardContent)\n .buffer();\n }\n\n /**\n * Create a new shape instruction\n * @param instruction the shape instruction to encode\n * Structure:\n * Header: 32 bytes\n * sessionId: 16 bytes\n * clientId: 4 bytes\n * type: 4 bytes\n * id: 4 bytes\n * padding: 4 bytes\n * Content: 4 bytes\n * windowId: 4 bytes\n */\n private _createShapeInstruction(instruction: WebXShapeInstruction): ArrayBuffer {\n const encoder = new WebXInstructionBuffer(instruction, 4);\n return encoder\n // write the contents\n .putUInt32(instruction.windowId)\n .buffer();\n }\n\n}\n","import {\n WebXCursorImageMessage,\n WebXImageMessage,\n WebXMessage,\n WebXMessageType,\n WebXMouseMessage,\n WebXScreenMessage,\n WebXSubImagesMessage,\n WebXWindowsMessage,\n WebXPingMessage,\n WebXQualityMessage,\n WebXClipboardMessage,\n WebXConnectionMessage,\n WebXNopMessage,\n WebXShapeMessage,\n} from '../message';\nimport { WebXSubImage, WebXWindowProperties } from '../common';\nimport {LinearSRGBColorSpace, SRGBColorSpace, WebXTextureFactory} from '../texture';\nimport { WebXMessageBuffer } from './WebXMessageBuffer';\nimport {WebXVersion} from \"../utils\";\nimport {WebXEngine} from \"../WebXEngine\";\n\n/**\n * Decodes binary messages received from the WebX Engine into WebXMessage objects.\n * This class handles various message types and converts them into their respective\n * WebXMessage implementations.\n */\nexport class WebXMessageDecoder {\n\n private readonly _textureFactory: WebXTextureFactory = new WebXTextureFactory();\n\n /**\n * Creates a new instance of WebXMessageDecoder.\n */\n constructor() {}\n\n /**\n * Decodes a binary message buffer into a WebXMessage object.\n *\n * @param buffer The binary message buffer to decode.\n * @returns A promise that resolves to the decoded WebXMessage.\n */\n decode(buffer: WebXMessageBuffer): Promise<WebXMessage> {\n const { messageTypeId } = buffer;\n\n if (messageTypeId === WebXMessageType.NOP) {\n return this._createNopMessage();\n\n } else if (messageTypeId === WebXMessageType.CONNECTION) {\n return this._createConnectionMessage(buffer);\n\n } else if (messageTypeId === WebXMessageType.SCREEN) {\n return this._createScreenMessage(buffer);\n\n } else if (messageTypeId === WebXMessageType.WINDOWS) {\n return this._createWindowsMessage(buffer);\n\n } else if (messageTypeId === WebXMessageType.IMAGE) {\n return this._createImageMessage(buffer);\n\n } else if (messageTypeId === WebXMessageType.SUBIMAGES) {\n return this._createSubImagesMessage(buffer);\n\n } else if (messageTypeId === WebXMessageType.MOUSE) {\n return this._createMouseMessage(buffer);\n\n } else if (messageTypeId === WebXMessageType.CURSOR_IMAGE) {\n return this._createCursorImageMessage(buffer);\n\n } else if (messageTypeId === WebXMessageType.PING) {\n return this._createPingMessage();\n\n } else if (messageTypeId === WebXMessageType.QUALITY) {\n return this._createQualityMessage(buffer);\n\n } else if (messageTypeId === WebXMessageType.CLIPBOARD) {\n return this._createClipboardMessage(buffer);\n\n } else if (messageTypeId === WebXMessageType.SHAPE) {\n return this._createShapeMessage(buffer);\n }\n\n console.error(`Failed to decode message with typeId ${messageTypeId}`);\n }\n\n /**\n * Determines the MIME type of an image based on its type string.\n *\n * @param imageType The image type string (e.g., 'jpg', 'png').\n * @returns The corresponding MIME type.\n */\n private _determineMimeType(imageType: string): string {\n if (imageType.substr(0, 3) === 'jpg') {\n return 'image/jpeg';\n } else if (imageType.substr(0, 3) === 'png') {\n return 'image/png';\n }\n return 'image/bmp';\n }\n\n /**\n * Creates a WebXNopMessage, which is used for no-operation messages.\n */\n private async _createNopMessage(): Promise<WebXMessage> {\n return new WebXNopMessage();\n }\n\n /**\n * Creates a WebXConnectionMessage, which is used for connection-related messages.\n */\n private async _createConnectionMessage(buffer: WebXMessageBuffer): Promise<WebXMessage> {\n const isStarting: number = buffer.getUint32();\n\n return new WebXConnectionMessage(isStarting > 0);\n }\n\n /**\n * Decodes a buffer into a WebXImageMessage.\n *\n * @param buffer The binary message buffer to decode.\n * @returns A promise that resolves to a WebXImageMessage.\n */\n private _createImageMessage(buffer: WebXMessageBuffer): Promise<WebXImageMessage> {\n return new Promise<WebXImageMessage>((resolve) => {\n const commandId: number = buffer.getUint32();\n const windowId = buffer.getUint32();\n const depth = buffer.getUint32();\n const imageType = buffer.getString(4);\n const mimetype = this._determineMimeType(imageType);\n const colorDataSize = buffer.getUint32();\n const alphaDataSize = buffer.getUint32();\n const colorData: Uint8Array = buffer.getUint8Array(colorDataSize);\n const alphaData: Uint8Array = buffer.getUint8Array(alphaDataSize);\n\n const colorMapPromise = this._textureFactory.createTextureFromArray(colorData, mimetype, SRGBColorSpace);\n const alphaMapPromise = this._textureFactory.createTextureFromArray(alphaData, mimetype, LinearSRGBColorSpace);\n\n Promise.all([colorMapPromise, alphaMapPromise])\n .then(([colorMap, alphaMap]) => {\n resolve(new WebXImageMessage(windowId, depth, colorMap, alphaMap, commandId, buffer.bufferLength));\n });\n });\n }\n\n /**\n * Decodes a buffer into a WebXSubImagesMessage containing multiple sub-images.\n *\n * @param buffer The binary message buffer to decode.\n * @returns A promise that resolves to a WebXSubImagesMessage.\n */\n private _createSubImagesMessage(buffer: WebXMessageBuffer): Promise<WebXSubImagesMessage> {\n return new Promise<WebXSubImagesMessage>((resolve) => {\n const commandId: number = buffer.getUint32();\n const windowId = buffer.getUint32();\n const imagePromises = new Array<Promise<WebXSubImage>>();\n const numberOfSubImages = buffer.getUint32();\n for (let i = 0; i < numberOfSubImages; i++) {\n const x = buffer.getInt32();\n const y = buffer.getInt32();\n const width = buffer.getInt32();\n const height = buffer.getInt32();\n const depth = buffer.getUint32();\n const imageType = buffer.getString(4);\n const mimetype = this._determineMimeType(imageType);\n const colorDataSize = buffer.getUint32();\n const alphaDataSize = buffer.getUint32();\n const colorData: Uint8Array = buffer.getUint8Array(colorDataSize);\n const alphaData: Uint8Array = buffer.getUint8Array(alphaDataSize);\n\n const imagePromise = new Promise<WebXSubImage>((innerResolve, innerReject) => {\n const colorMapPromise = this._textureFactory.createTextureFromArray(colorData, mimetype, SRGBColorSpace);\n const alphaMapPromise = this._textureFactory.createTextureFromArray(alphaData, mimetype, LinearSRGBColorSpace);\n\n Promise.all([colorMapPromise, alphaMapPromise])\n .then(([colorMap, alphaMap]) => {\n innerResolve(new WebXSubImage({ x, y, width, height, depth, colorMap, alphaMap }));\n })\n .catch(innerReject);\n });\n imagePromises.push(imagePromise);\n }\n\n Promise.all(imagePromises).then((webXSubImages: WebXSubImage[]) => {\n resolve(new WebXSubImagesMessage(windowId, webXSubImages, commandId, buffer.bufferLength));\n });\n\n });\n }\n\n /**\n * Decodes a buffer into a WebXMouseMessage, which contains mouse position and cursor ID.\n *\n * @param buffer The binary message buffer to decode.\n * @returns A promise that resolves to a WebXMouseMessage.\n */\n private async _createMouseMessage(buffer: WebXMessageBuffer): Promise<WebXMouseMessage> {\n const commandId: number = buffer.getUint32();\n const x = buffer.getInt32();\n const y = buffer.getInt32();\n const cursorId = buffer.getUint32();\n return new WebXMouseMessage(x, y, cursorId, commandId);\n }\n\n /**\n * Decodes a buffer into a WebXWindowsMessage, which contains information about multiple windows.\n *\n * @param buffer The binary message buffer to decode.\n * @returns A promise that resolves to a WebXWindowsMessage.\n */\n private async _createWindowsMessage(buffer: WebXMessageBuffer): Promise<WebXWindowsMessage> {\n const commandId: number = buffer.getUint32();\n const numberOfWindows: number = buffer.getUint32();\n const windowData: Array<{ id: number, x: number, y: number, width: number, height: number, shaped: boolean}> = new Array<{ id: number, x: number, y: number, width: number, height: number, shaped: boolean }>();\n for (let i = 0; i < numberOfWindows; i++) {\n const windowId = buffer.getUint32();\n const x = buffer.getInt32();\n const y = buffer.getInt32();\n const width = buffer.getInt32();\n const height = buffer.getInt32();\n\n windowData.push({ id: windowId, x: x, y: y, width: width, height: height, shaped: false });\n }\n\n // Update from webx-engine 1.4.0: inclusion of list of windows that have shapes (require stencil buffer)\n if (WebXEngine.version.versionNumber >= 1.4 && buffer.bufferLength - buffer.readOffset >= 4) {\n const numberOfShapedWindows: number = buffer.getUint32();\n for (let i = 0; i < numberOfShapedWindows; i++) {\n const windowId = buffer.getUint32();\n windowData.find(window => window.id === windowId).shaped = true;\n }\n }\n\n return new WebXWindowsMessage(windowData.map(data => new WebXWindowProperties(data)), commandId);\n }\n\n /**\n * Decodes a buffer into a WebXCursorImageMessage, which contains cursor image data.\n *\n * @param buffer The binary message buffer to decode.\n * @returns A promise that resolves to a WebXCursorImageMessage.\n */\n private async _createCursorImageMessage(buffer: WebXMessageBuffer): Promise<WebXCursorImageMessage> {\n const commandId: number = buffer.getUint32();\n const x = buffer.getInt32();\n const y = buffer.getInt32();\n const xHot = buffer.getInt32();\n const yHot = buffer.getInt32();\n const cursorId = buffer.getUint32();\n const imageDataSize = buffer.getUint32();\n const imageData: Uint8Array = buffer.getUint8Array(imageDataSize);\n\n try {\n const texture = await this._textureFactory.createTextureFromArray(imageData, 'image/png', SRGBColorSpace);\n return new WebXCursorImageMessage(x, y, xHot, yHot, cursorId, texture, commandId);\n\n } catch (error) {\n console.error(`Failed to get texture for cursor image: ${error}`);\n }\n }\n\n /**\n * Decodes a buffer into a WebXScreenMessage, which contains screen dimensions.\n *\n * @param buffer The binary message buffer to decode.\n * @returns A promise that resolves to a WebXScreenMessage.\n */\n private async _createScreenMessage(buffer: WebXMessageBuffer): Promise<WebXScreenMessage> {\n const commandId: number = buffer.getUint32();\n const screenWidth: number = buffer.getInt32();\n const screenHeight: number = buffer.getInt32();\n let maxQualityIndex = 10;\n // Read the maxQualityIndex if the buffer contains it\n if (buffer.bufferLength - buffer.readOffset >= 4) {\n maxQualityIndex = buffer.getInt32();\n }\n // Read the engine version values if the buffer contains it\n let majorVersion = 0;\n let minorVersion = 0;\n let patchVersion = 0;\n if (buffer.bufferLength - buffer.readOffset >= 12) {\n majorVersion = buffer.getUint32();\n minorVersion = buffer.getUint32();\n patchVersion = buffer.getUint32();\n }\n WebXEngine.version = new WebXVersion(majorVersion, minorVersion, patchVersion);\n\n return new WebXScreenMessage({ width: screenWidth, height: screenHeight }, maxQualityIndex, new WebXVersion(majorVersion, minorVersion, patchVersion), commandId);\n }\n\n /**\n * Creates a WebXPingMessage, which is used for pinging purposes.\n *\n * @returns A promise that resolves to a WebXPingMessage.\n */\n private async _createPingMessage(): Promise<WebXPingMessage> {\n return new WebXPingMessage();\n }\n\n /**\n * Decodes a buffer into a WebXQualityMessage, which contains quality metrics.\n *\n * @param buffer The binary message buffer to decode.\n * @returns A promise that resolves to a WebXQualityMessage.\n */\n private async _createQualityMessage(buffer: WebXMessageBuffer): Promise<WebXQualityMessage> {\n const index: number = buffer.getUint32();\n const imageFPS: number = buffer.getFloat();\n const rgbQuality: number = buffer.getFloat();\n const alphaQuality: number = buffer.getFloat();\n const maxMbps: number = buffer.getFloat();\n return new WebXQualityMessage(index, imageFPS, rgbQuality, alphaQuality, maxMbps);\n }\n\n /**\n * Decodes a buffer into a WebXClipboardMessage, which contains X11 clipboard content.\n *\n * @param buffer The binary message buffer to decode.\n * @returns A promise that resolves to a WebXClipboardMessage.\n */\n private async _createClipboardMessage(buffer: WebXMessageBuffer): Promise<WebXClipboardMessage> {\n const clipboardContentSize: number = buffer.getUint32();\n const clipboardContent: string = buffer.getString(clipboardContentSize);\n return new WebXClipboardMessage(clipboardContent);\n }\n\n /**\n * Decodes a buffer into a WebXShapeMessage.\n *\n * @param buffer The binary message buffer to decode.\n * @returns A promise that resolves to a WebXShapeMessage.\n */\n private _createShapeMessage(buffer: WebXMessageBuffer): Promise<WebXShapeMessage> {\n return new Promise<WebXShapeMessage>((resolve) => {\n const commandId: number = buffer.getUint32();\n const windowId = buffer.getUint32();\n const imageType = buffer.getString(4);\n const mimetype = this._determineMimeType(imageType);\n const stencilDataSize = buffer.getUint32();\n const stencilData: Uint8Array = buffer.getUint8Array(stencilDataSize);\n\n this._textureFactory.createTextureFromArray(stencilData, mimetype, LinearSRGBColorSpace).then(stencilMap => {\n resolve(new WebXShapeMessage(windowId, stencilMap, commandId, buffer.bufferLength))\n })\n });\n }\n\n}\n","import {\n WebXCursorImageMessage,\n WebXImageMessage,\n WebXMessage,\n WebXMessageType,\n WebXMouseMessage,\n WebXScreenMessage,\n WebXSubImagesMessage,\n WebXWindowsMessage,\n WebXPingMessage,\n WebXQualityMessage,\n WebXClipboardMessage,\n WebXConnectionMessage,\n WebXNopMessage,\n WebXShapeMessage,\n} from '../message';\nimport {WebXMessageBuffer} from \"./WebXMessageBuffer\";\n\n/**\n * Recasts an object (received from a web workder) into a concrete WebXMessage class\n * @param object the message data\n * @returns a concrete WebXMessage instance\n */\nexport const recastWebXMessage = (object: any): WebXMessage => {\n let message: WebXMessage;\n if (object) {\n if (object.type === WebXMessageType.NOP) {\n message = Object.create(WebXNopMessage.prototype);\n } else if (object.type === WebXMessageType.CONNECTION) {\n message = Object.create(WebXConnectionMessage.prototype);\n } else if (object.type === WebXMessageType.SCREEN) {\n message = Object.create(WebXScreenMessage.prototype);\n } else if (object.type === WebXMessageType.WINDOWS) {\n message = Object.create(WebXWindowsMessage.prototype);\n } else if (object.type === WebXMessageType.IMAGE) {\n message = Object.create(WebXImageMessage.prototype);\n } else if (object.type === WebXMessageType.SUBIMAGES) {\n message = Object.create(WebXSubImagesMessage.prototype);\n } else if (object.type === WebXMessageType.MOUSE) {\n message = Object.create(WebXMouseMessage.prototype);\n } else if (object.type === WebXMessageType.CURSOR_IMAGE) {\n message = Object.create(WebXCursorImageMessage.prototype);\n } else if (object.type === WebXMessageType.PING) {\n message = Object.create(WebXPingMessage.prototype);\n } else if (object.type === WebXMessageType.QUALITY) {\n message = Object.create(WebXQualityMessage.prototype);\n } else if (object.type === WebXMessageType.CLIPBOARD) {\n message = Object.create(WebXClipboardMessage.prototype);\n } else if (object.type === WebXMessageType.SHAPE) {\n message = Object.create(WebXShapeMessage.prototype);\n }\n\n if (message) {\n Object.assign(message, object);\n }\n\n }\n return message;\n}\n\n/**\n * Returns all image types that should be processed in the web worker: essentially all with\n * image data\n * @param messageBuffer the raw message buffer\n * @return true if the message should be decoded by a web worker\n */\nexport const isWorkerMessage = (messageBuffer: WebXMessageBuffer): boolean => {\n const messageType = messageBuffer.messageTypeId;\n switch (messageType) {\n case WebXMessageType.IMAGE:\n case WebXMessageType.SUBIMAGES:\n case WebXMessageType.SHAPE:\n return true;\n default:\n return false;\n }\n}\n\n/**\n * Returns all elements of the message that can be transferred from the web worker (releasing ownership and\n * avoiding copying).\n * @param message the webx message\n * @return an array of transferable objects\n */\nexport const getMessageTransfers = (message: WebXMessage): Transferable[] => {\n const transfers: Transferable[] = [];\n\n if (message) {\n const messageType = message.type;\n if (messageType == WebXMessageType.IMAGE) {\n const imageMessage = message as WebXImageMessage;\n if (imageMessage.colorMap && imageMessage.colorMap.isTransferable()) {\n transfers.push(imageMessage.colorMap.transferable);\n }\n if (imageMessage.alphaMap && imageMessage.alphaMap.isTransferable()) {\n transfers.push(imageMessage.alphaMap.transferable);\n }\n\n } else if (messageType == WebXMessageType.SUBIMAGES) {\n const subImageMessage = message as WebXSubImagesMessage;\n for (const subImage of subImageMessage.subImages) {\n if (subImage.colorMap && subImage.colorMap.isTransferable()) {\n transfers.push(subImage.colorMap.transferable);\n }\n if (subImage.alphaMap && subImage.alphaMap.isTransferable()) {\n transfers.push(subImage.alphaMap.transferable);\n }\n }\n\n } else if (messageType == WebXMessageType.SHAPE) {\n const shapeMessage = message as WebXShapeMessage;\n if (shapeMessage.stencilMap && shapeMessage.stencilMap.isTransferable()) {\n transfers.push(shapeMessage.stencilMap.transferable);\n }\n }\n }\n\n return transfers;\n}\n","import { WebXInstruction } from '../instruction';\nimport { WebXMessage } from '../message';\nimport { WebXInstructionEncoder } from \"./WebXInstructionEncoder\";\nimport {WebXMessageDecoder} from \"./WebXMessageDecoder\";\nimport {isWorkerMessage, recastWebXMessage} from \"./WebXMessageFunc\";\nimport { WebXMessageBuffer } from \"./WebXMessageBuffer\";\nimport WebXMessageDecoderWorker from \"web-worker:./WebXMessageDecoderWorker\";\n\n/**\n * Serializes and deserializes WebX instructions and messages.\n */\nexport class WebXBinarySerializer {\n\n private readonly _instructionEncoder: WebXInstructionEncoder;\n private readonly _messageDecoder: WebXMessageDecoder;\n\n private readonly _worker: Worker;\n private _pending = new Map<number, (message: WebXMessage) => void>();\n private _nextId = 1;\n\n /**\n * Creates a new instance of WebXBinarySerializer.\n */\n constructor() {\n this._instructionEncoder = new WebXInstructionEncoder();\n this._messageDecoder = new WebXMessageDecoder();\n if (typeof Worker !== 'undefined') {\n this._worker = new WebXMessageDecoderWorker();\n\n this._worker.onmessage = (e) => {\n const { id, message, error } = e.data;\n const callback = this._pending.get(id);\n this._pending.delete(id);\n\n if (error) {\n console.error(error);\n\n } else if (callback) {\n const webxMessage = recastWebXMessage(message);\n callback(webxMessage);\n }\n };\n }\n }\n\n /**\n * Terminates the Web Worker and clears pending tasks.\n */\n public terminate() {\n this._worker.terminate();\n this._pending.clear();\n }\n\n /**\n * Serializes a WebXInstruction into a binary ArrayBuffer.\n *\n * @param instruction The instruction to serialize.\n * @returns The serialized ArrayBuffer.\n */\n serializeInstruction(instruction: WebXInstruction): ArrayBuffer {\n // return instruction.toJsonString();\n const encoded = this._instructionEncoder.encode(instruction);\n if (encoded == null) {\n console.warn('Could not serialize instruction: Unknown type');\n }\n return encoded;\n }\n\n /**\n * Deserializes a binary message buffer into a WebXMessage object. A web worker is used if available\n * and the message should be decoded in a separate thread.\n *\n * @param messageBuffer The binary message buffer to deserialize.\n * @returns A promise that resolves to the deserialized WebXMessage.\n */\n async deserializeMessage(messageBuffer: WebXMessageBuffer): Promise<WebXMessage> {\n if (this._worker && isWorkerMessage(messageBuffer)) {\n return new Promise((resolve) => {\n const id = this._nextId++;\n this._pending.set(id, resolve);\n\n const transfers = [messageBuffer.buffer];\n\n this._worker.postMessage(\n { id, buffer: messageBuffer.buffer, convertToImageData: WebXMessage.convertToImageDataInWorker },\n transfers\n );\n\n });\n\n } else {\n try {\n const message = await this._messageDecoder.decode(messageBuffer);\n if (message == null) {\n console.error(`Failed to decode message data`);\n }\n return message;\n\n } catch (error) {\n console.error(`Caught error decoding message data: ${error.message}`);\n }\n }\n }\n\n}\n","import {WebXDataAckInstruction, WebXInstruction, WebXInstructionResponse, WebXPongInstruction} from '../instruction';\nimport {WebXMessage, WebXMessageType} from '../message';\nimport { WebXBinarySerializer, WebXMessageBuffer } from '../transport';\n\n/**\n * Represents a communication tunnel between the WebX client and the WebX Engine.\n *\n * This class handles sending and receiving data, managing the connection state,\n * and processing responses from the WebX Engine.\n */\nexport abstract class WebXTunnel {\n private static readonly MIN_BUFFER_LENGTH_FOR_ACK = 32768;\n\n protected _serializer: WebXBinarySerializer = new WebXBinarySerializer();\n\n private _instructionResponses: Map<number, WebXInstructionResponse<any>> = new Map<number, WebXInstructionResponse<any>>();\n\n protected constructor() {\n }\n\n /**\n * Establishes a connection to the WebX Engine.\n *\n * @param data The data required to establish the connection.\n * @returns A promise that resolves when the connection is successfully established.\n */\n abstract connect(data: any): Promise<Event>;\n\n /**\n * Closes the connection to the WebX Engine.\n */\n abstract disconnect(): void;\n\n /**\n * Terminates the Web Worker and clears pending tasks.\n */\n public terminate() {\n this._serializer.terminate();\n }\n\n /**\n * Sends data to the WebX Engine.\n *\n * @param data The data to send.\n */\n abstract send(data: ArrayBuffer): void;\n\n /**\n * Checks if the tunnel is currently connected.\n *\n * @returns True if the tunnel is connected, false otherwise.\n */\n abstract isConnected(): boolean;\n\n /**\n * Sends an instruction to the WebX Engine.\n *\n * @param command The instruction to send.\n */\n sendInstruction(command: WebXInstruction): void {\n // console.log(`Sending command: `, command);\n const message = this._serializer.serializeInstruction(command);\n this.send(message);\n }\n\n /**\n * Sends a request to the WebX Engine and waits for a response.\n *\n * @param command The request to send.\n * @param timeout The timeout in milliseconds to wait for a response.\n * @returns A promise that resolves with the response from the WebX Engine.\n */\n sendRequest(command: WebXInstruction, timeout?: number): Promise<WebXMessage> {\n // console.log(`Sending request: `, command);\n command.synchronous = true;\n timeout = timeout || 10000;\n const response = new WebXInstructionResponse<WebXMessage>(command, timeout);\n this._instructionResponses.set(command.id, response);\n return new Promise((resolve, reject) => {\n const message = this._serializer.serializeInstruction(command);\n this.send(message);\n response\n .then(resolve)\n .catch((error: Error) => {\n this._instructionResponses.delete(command.id);\n reject(error);\n });\n });\n }\n\n /**\n * Handles incoming messages from the WebX Engine.\n *\n * @param data The received data.\n */\n protected async onMessage(data: ArrayBuffer): Promise<void> {\n if (data.byteLength === 0) {\n console.warn('Got a zero length message');\n return null;\n } else if (data.byteLength < WebXMessageBuffer.MESSAGE_HEADER_LENGTH) {\n console.warn('Message does not contain a valid header');\n return null;\n }\n\n const buffer = new WebXMessageBuffer(data);\n\n this._handleCriticalMessages(buffer);\n\n this.handleReceivedBytes(data);\n\n const message = await this._serializer.deserializeMessage(buffer);\n if (message != null) {\n\n // Handle any blocking requests\n if (message.commandId != null && this._instructionResponses.get(message.commandId) != null) {\n const instructionResponse = this._instructionResponses.get(message.commandId);\n this._instructionResponses.delete(message.commandId);\n instructionResponse.resolve(message);\n\n } else {\n // Send async message\n this.handleMessage(message);\n }\n }\n }\n\n /**\n * Handles a received message from the WebX Engine.\n *\n * @param message The received message.\n */\n handleMessage(message: WebXMessage): void {\n throw new Error('Method not implemented.');\n }\n\n /**\n * Handles received bytes from the WebX Engine.\n *\n * @param data The received data.\n */\n handleReceivedBytes(data: ArrayBuffer): void {\n throw new Error('Method not implemented.');\n }\n\n /**\n * Handles sent bytes to the WebX Engine.\n *\n * @param data The sent data.\n */\n handleSentBytes(data: ArrayBuffer): void {\n throw new Error('Method not implemented');\n }\n\n /**\n * Handles the close event of the connection.\n *\n * @param event The close event.\n */\n handleClose(event: CloseEvent): void {\n // Clear all pending instruction responses\n this._instructionResponses.forEach((response: WebXInstructionResponse<WebXMessage>) => {\n response.reject('Tunnel closed');\n });\n this.onClosed();\n }\n\n /**\n * Called when the connection is closed.\n */\n onClosed(): void {\n console.log(`Websocket closed`);\n }\n\n /**\n * Handles critical messages such as PING and data acknowledgments.\n *\n * @param buffer The message buffer.\n */\n private _handleCriticalMessages(buffer: WebXMessageBuffer): void {\n if (buffer.messageTypeId == WebXMessageType.PING) {\n // Reply immediately with a pong\n this.sendInstruction(new WebXPongInstruction(buffer.timestampMs));\n\n } else if (buffer.messageTypeId == WebXMessageType.SUBIMAGES || buffer.messageTypeId == WebXMessageType.IMAGE) {\n // Reply immediately with a data ack (if size greater than cutoff)\n if (buffer.bufferLength > WebXTunnel.MIN_BUFFER_LENGTH_FOR_ACK) {\n this.sendInstruction(new WebXDataAckInstruction(buffer.timestampMs, buffer.bufferLength));\n }\n }\n }\n\n}\n","import { WebXTunnel } from './WebXTunnel';\n\n/**\n * Represents a WebSocket-based implementation of the WebX communication tunnel.\n *\n * This class manages the WebSocket connection to the WebX Engine, handles\n * sending and receiving data, and processes events related to the connection.\n */\nexport class WebXWebSocketTunnel extends WebXTunnel {\n private readonly _url: string;\n private _socket: WebSocket;\n private readonly _connectionOptions: any;\n private _socketOpen = false;\n\n constructor(url: string, options: any = {}) {\n super();\n this._connectionOptions = options;\n\n // Ensure that the URL is a valid WebSocket URL for older browsers\n if (url.substring(0, 3) !== \"ws:\" && url.substring(0, 4) !== \"wss:\") {\n const location = window.location;\n const protocol = location.protocol === 'https:' ? 'wss:' : 'ws:';\n const hostname = location.hostname;\n const port = location.port ? `:${location.port}` : '';\n\n if (url.substring(0, 1) === \"/\")\n url = `${protocol}//${hostname}${port}${url}`;\n\n else {\n url = `${protocol}//${hostname}${port}/${url}`;\n }\n }\n\n this._url = url;\n }\n\n getSocket(): WebSocket {\n return this._socket;\n }\n\n /**\n * Sends data to the WebX Engine over the WebSocket connection.\n *\n * @param data The data to send.\n */\n send(data: ArrayBuffer): void {\n if (this._socket != null) {\n this._socket.send(data);\n this.handleSentBytes(data);\n }\n }\n\n /**\n * Establishes a WebSocket connection to the WebX Engine.\n *\n * @param data The connection options.\n * @returns A promise that resolves when the connection is successfully established.\n */\n connect(data: any): Promise<Event> {\n const options = {...this._connectionOptions, ...data};\n const parameters = new URLSearchParams(options);\n const url = `${this._url}?${parameters}`;\n\n return new Promise((resolve, reject) => {\n this._socket = new WebSocket(url);\n this._socket.binaryType = 'arraybuffer';\n this._socket.onopen = () => {\n this._socketOpen = true;\n resolve(null);\n };\n this._socket.onerror = (event: Event) => reject(event);\n this._socket.onclose = this.handleClose.bind(this);\n this._socket.onmessage = (aMessage: any) => this.onMessage(aMessage.data);\n });\n }\n\n /**\n * Closes the WebSocket connection to the WebX Engine.\n */\n disconnect(): void {\n if (this._socket) {\n this._socketOpen = false;\n this._socket.close()\n this._socket = null;\n }\n }\n\n /**\n * Checks if the WebSocket connection is currently open.\n *\n * @returns True if the WebSocket is open, false otherwise.\n */\n isConnected(): boolean {\n return this._socketOpen;\n }\n}\n","import { WebXTunnel } from '../tunnel';\nimport {WebXCursorImageMessage} from '../message';\nimport {WebXCursorImageInstruction} from '../instruction';\nimport {WebXTexture} from \"../texture\";\n\n/**\n * Interface representing cursor data.\n */\nexport interface WebXCursorData {\n xHot: number;\n yHot: number;\n cursorId: number;\n texture: WebXTexture;\n}\n\n/**\n * Factory class for creating and managing cursor textures.\n *\n * This class retrieves cursor textures based on cursor IDs and caches them\n * for reuse.\n */\nexport class WebXCursorFactory {\n private _cursorMap: Map<number, WebXCursorData> = new Map();\n\n constructor(private _tunnel: WebXTunnel) {}\n\n /**\n * Retrieves the cursor texture for the given cursor ID.\n *\n * If the cursor texture is not already cached, it will be fetched and cached\n * for future use.\n *\n * @param cursorId The ID of the cursor to retrieve.\n * @returns A promise that resolves to the cursor texture and its dimensions.\n */\n public async getCursor(cursorId: number): Promise<{x?: number; y?: number; cursor: WebXCursorData}> {\n const cursorData = this._cursorMap.get(cursorId);\n if (cursorData != null) {\n return { cursor: cursorData };\n\n } else {\n const response = await this._tunnel.sendRequest(new WebXCursorImageInstruction(cursorId)) as WebXCursorImageMessage;\n\n const newCursorData = {\n xHot: response.xHot,\n yHot: response.yHot,\n cursorId: response.cursorId,\n texture: response.texture\n }\n\n this._cursorMap.set(response.cursorId, newCursorData);\n\n return {\n x: response.x,\n y: response.y,\n cursor: newCursorData\n };\n }\n }\n}\n","import {WebXTunnel} from '../tunnel';\nimport {WebXImageInstruction, WebXShapeInstruction} from '../instruction';\nimport {WebXImageMessage, WebXShapeMessage} from '../message';\nimport {WebXTexture} from \"../texture\";\n\n/**\n * Factory class for request textures for WebX windows.\n *\n * This class retrieves textures from the WebX Engine\n */\nexport class WebXWindowImageFactory {\n\n constructor(private _tunnel: WebXTunnel) {}\n\n /**\n * Retrieves the textures (colorMap and alphaMap) for a specific window ID from the WebX Engine.\n *\n * @param windowId The ID of the window to retrieve the texture for.\n * @returns A promise that resolves to the textures and associated data.\n */\n public async getWindowTexture(windowId: number): Promise<{ depth: number; colorMap: WebXTexture; alphaMap: WebXTexture }> {\n try {\n const response = await this._tunnel.sendRequest(new WebXImageInstruction(windowId)) as WebXImageMessage;\n return {\n depth: response.depth,\n colorMap: response.colorMap,\n alphaMap: response.alphaMap,\n };\n\n } catch (err) {\n console.warn('Failed to get texture: ' + err);\n }\n }\n\n /**\n * Retrieves the stencil textures for a specific window ID from the WebX Engine.\n *\n * @param windowId The ID of the window to retrieve the texture for.\n * @returns A promise that resolves to the stencil texture\n */\n public async getWindowStencilTexture(windowId: number): Promise<{ stencilMap: WebXTexture }> {\n try {\n const response = await this._tunnel.sendRequest(new WebXShapeInstruction(windowId)) as WebXShapeMessage;\n return {\n stencilMap: response.stencilMap,\n };\n\n } catch (err) {\n console.warn('Failed to get stencil texture: ' + err);\n return null;\n }\n }\n}\n","export enum WebXConnectionStatus {\n STARTING, // Indicates the connection is starting\n RUNNING, // Indicates the connection is running\n}\n\nexport class WebXConnectionHandler {\n private _connected = false;\n private _timeout: number;\n private _timeoutMs: number;\n private _connectionCallback: () => void = () => {};\n private _connectionError: () => void = () => {};\n private _connectionStatusCallback: (status: number) => void = () => {};\n\n /**\n * Handles the connection process.\n * Sets up a timeout and resolves or rejects the promise based on connection status.\n *\n * @param timeoutMs Timeout duration in milliseconds.\n * @param connectionStatusCallback Callback to handle connection status updates.\n * @returns A promise that resolves when connected or rejects on timeout.\n */\n public onConnected(timeoutMs: number, connectionStatusCallback: (status: WebXConnectionStatus) => void): Promise<void> {\n this._timeoutMs = timeoutMs || 10000; // Default timeout is 10 seconds\n this._connectionStatusCallback = connectionStatusCallback;\n\n return new Promise<void>((resolve, reject) => {\n if (this._connected) {\n // If already connected, resolve immediately\n resolve();\n } else {\n // Set up callbacks for connection success and error\n this._connectionCallback = () => {\n window.clearTimeout(this._timeout);\n this._timeout = null;\n resolve();\n };\n\n this._connectionError = () => {\n this._timeout = null;\n reject(new Error(\"Connection timed out\"));\n };\n\n this._createTimer();\n }\n });\n }\n\n /**\n * Updates the connection status.\n * Calls the appropriate status callback based on whether the connection is starting or running.\n *\n * @param isStarting Indicates if the connection is starting.\n */\n public setConnected(isStarting: boolean): void {\n if (isStarting) {\n // Notify that the connection is starting\n this._connectionStatusCallback(WebXConnectionStatus.STARTING);\n } else {\n // Mark the connection as established\n this._connected = true;\n this._connectionStatusCallback(WebXConnectionStatus.RUNNING);\n this._connectionCallback();\n }\n }\n\n /**\n * Resets the connection timeout timer.\n * Clears the existing timer and starts a new one.\n */\n public resetTimer(): void {\n if (this._timeout) {\n window.clearTimeout(this._timeout);\n this._timeout = null;\n this._createTimer();\n }\n }\n\n /**\n * Cleans up resources.\n * Clears the timeout if it exists.\n */\n public dispose(): void {\n if (this._timeout) {\n window.clearTimeout(this._timeout);\n }\n }\n\n /**\n * Creates a timeout timer.\n * Calls the connection error callback if the timer expires.\n */\n private _createTimer(): void {\n this._timeout = window.setTimeout(() => {\n this._connectionError();\n }, this._timeoutMs);\n }\n}\n","import {WebXTunnel} from './tunnel';\nimport {\n WebXClipboardInstruction,\n WebXInstruction,\n WebXKeyboardInstruction,\n WebXMouseInstruction,\n WebXQualityInstruction,\n WebXScreenInstruction,\n WebXWindowsInstruction,\n} from './instruction';\nimport {\n WebXClipboardMessage, WebXConnectionMessage,\n WebXImageMessage,\n WebXMessage,\n WebXMessageType,\n WebXMouseMessage,\n WebXScreenMessage,\n WebXShapeMessage,\n WebXSubImagesMessage,\n WebXWindowsMessage,\n} from './message';\nimport {WebXCursorFactory} from './display/WebXCursorFactory';\nimport {WebXDisplay} from './display';\nimport {WebXWindowImageFactory} from './display/WebXWindowImageFactory';\nimport {WebXKeyboard, WebXMouse, WebXMouseState} from './input';\nimport {\n WebXDebugImageMessageHandler,\n WebXHandler,\n WebXInstructionHandler,\n WebXMessageHandler,\n WebXStatsHandler\n} from './tracer';\nimport {Blob} from \"buffer\";\nimport {WebXEngine} from \"./WebXEngine\";\nimport {WebXConnectionHandler} from \"./WebXConnectionHandler\";\nconst {version} = require('../package.json');\n\n\n/**\n * Configuration options for the WebXClient.\n */\nexport interface WebXClientConfig {\n useDefaultMouseAdapter?: boolean;\n useDefaultKeyboardAdapter?: boolean;\n waitForConnectionWithTimeout?: number;\n connectionStatusCallback?: (status: number) => void;\n}\n\n/**\n * The main client class for interacting with the WebX Engine.\n *\n * This class provides methods to connect to the WebX Engine, manage the display,\n * handle user input (mouse and keyboard), and send/receive instructions and messages.\n */\nexport class WebXClient {\n\n private readonly _windowImageFactory: WebXWindowImageFactory;\n private readonly _cursorFactory: WebXCursorFactory;\n\n private _tracers: Map<string, WebXHandler> = new Map();\n private _onCloseCallback: () => void;\n\n private _display: WebXDisplay;\n private _mouse: WebXMouse;\n private _keyboard: WebXKeyboard;\n\n private _clipboardHandler = (clipboardContent: string) => {};\n private _connectionHandler = new WebXConnectionHandler();\n private _maxQualityIndex: number = 10;\n\n /**\n * Gets the WebXTunnel instance used for communication with the WebX Engine.\n */\n get tunnel(): WebXTunnel {\n return this._tunnel;\n }\n\n /**\n * Gets the map of registered tracer handlers.\n */\n get tracers(): Map<string, WebXHandler> {\n return this._tracers;\n }\n\n /**\n * Gets the WebXDisplay instance used for rendering the display.\n */\n get display(): WebXDisplay {\n return this._display;\n }\n\n /**\n * Gets the WebXMouse instance used for handling mouse input.\n */\n get mouse(): WebXMouse {\n return this._mouse;\n }\n\n /**\n * Gets the WebXKeyboard instance used for handling keyboard input.\n */\n get keyboard(): WebXKeyboard {\n return this._keyboard;\n }\n\n /**\n * Handles notification that clipboard data that has been received from the server.\n * @param handler the handler when clipboard data is received from the server\n */\n set clipboardHandler(handler: (clipboardContent: string) => void) {\n this._clipboardHandler = handler;\n }\n\n /**\n * Gets the max quality index of the display.\n */\n get maxQualityIndex(): number {\n return this._maxQualityIndex;\n }\n\n /**\n * Creates a new instance of the WebXClient.\n *\n * @param _tunnel The WebXTunnel instance used for communication with the WebX Engine.\n */\n constructor(private _tunnel: WebXTunnel) {\n this._windowImageFactory = new WebXWindowImageFactory(this._tunnel);\n this._cursorFactory = new WebXCursorFactory(this._tunnel);\n }\n\n /**\n * Connects to the WebX Engine and initializes the communication tunnel.\n *\n * @param onCloseCallback Callback function to execute when the connection is closed.\n * @param data Additional data to send during the connection process.\n */\n async connect(onCloseCallback: () => void, data: any): Promise<void> {\n this._onCloseCallback = onCloseCallback;\n this._tunnel.handleMessage = this._handleMessage.bind(this);\n this._tunnel.handleReceivedBytes = this._handleReceivedBytes.bind(this);\n this._tunnel.handleSentBytes = this._handleSentBytes.bind(this);\n this._tunnel.onClosed = this._onTunnelClosed.bind(this);\n\n await this._tunnel.connect({...data, 'client-version': version});\n }\n\n /**\n * Disconnects from the WebX Engine and cleans up resources.\n */\n disconnect(): void {\n this._tunnel.disconnect();\n this._tunnel.terminate();\n }\n\n /**\n * Initializes the WebX display and input devices.\n *\n * @param containerElement The HTML element to render the display.\n * @param config Optional configuration for the WebX client.\n * @returns A promise that resolves to the initialized WebXDisplay instance.\n */\n async initialise(containerElement: HTMLElement, config?: WebXClientConfig): Promise<WebXDisplay> {\n try {\n config = {...{useDefaultMouseAdapter: true, useDefaultKeyboardAdapter: true, waitForConnectionWithTimeout: 10000, connectionStatusCallback: () => {} }, ...config};\n const { useDefaultMouseAdapter, useDefaultKeyboardAdapter, waitForConnectionWithTimeout, connectionStatusCallback } = config;\n\n // Wait for connection (requires webx-relay >= 1.2.0)\n if (waitForConnectionWithTimeout > 0) {\n await this._connectionHandler.onConnected(waitForConnectionWithTimeout, connectionStatusCallback);\n }\n\n // Request 1. : Get screen size\n const screenMessage = await this._getScreenMessage();\n const { width, height } = screenMessage.screenSize;\n this._maxQualityIndex = screenMessage.maxQualityIndex;\n WebXEngine.version = screenMessage.engineVersion;\n\n // Initialise the display\n this._display = this.createDisplay(containerElement, width, height);\n\n // Request 2. : Get visible windows\n // Sec request for visible windows\n const windowsMessage = await this._sendRequest(new WebXWindowsInstruction()) as WebXWindowsMessage;\n\n // Requests 3. - N : Initialise all windows and wait for them to be visible (requests for window images)\n await this._display.updateWindows(windowsMessage.windows);\n this._display.showScreen();\n\n // Create mouse and add listeners\n if (useDefaultMouseAdapter) {\n this._mouse = this.createMouse(containerElement);\n this._addMouseListeners();\n }\n\n // Create keyboard and add listeners\n if (useDefaultKeyboardAdapter) {\n this._keyboard = this.createKeyboard(document.body);\n this._addKeyboardListeners();\n }\n\n return this._display;\n\n } catch (error) {\n this._dispose();\n\n throw new Error(`Failed to initialise display: ${error.message}`);\n }\n }\n\n /**\n * Creates a new WebXDisplay instance.\n *\n * @param containerElement The HTML element to render the display.\n * @param screenWidth The width of the screen.\n * @param screenHeight The height of the screen.\n * @returns The created WebXDisplay instance.\n */\n createDisplay(containerElement: HTMLElement, screenWidth: number, screenHeight: number): WebXDisplay {\n return new WebXDisplay(containerElement, screenWidth, screenHeight, this._windowImageFactory, this._cursorFactory);\n }\n\n /**\n * Create a new mouse and bind it to an element\n * @param element the element to attach the mouse to\n */\n createMouse(element: HTMLElement): WebXMouse {\n return new WebXMouse(element);\n }\n\n /**\n * Create a new keyboard and bind it to an element\n * @param element the element to attach the keyboard to\n */\n createKeyboard(element: HTMLElement | Document): WebXKeyboard {\n return new WebXKeyboard(element);\n }\n\n /**\n * Sends a mouse event to the WebX Engine.\n *\n * @param mouseState The state of the mouse to send in the event.\n */\n sendMouse(mouseState: WebXMouseState): void {\n this._display.setMousePosition(mouseState.x, mouseState.y);\n this._sendInstruction(new WebXMouseInstruction(mouseState.x, mouseState.y, mouseState.getButtonMask()));\n }\n\n /**\n * Sends a key event to the WebX Engine.\n *\n * @param key The key code to send.\n * @param pressed Whether the key is pressed (true) or released (false).\n */\n sendKeyEvent(key: number, pressed: boolean): void {\n this._sendInstruction(new WebXKeyboardInstruction(key, pressed));\n }\n\n /**\n * Sends a key down event\n * @param key {number} the key to send\n */\n sendKeyDown(key: number): void {\n this.sendKeyEvent(key, true);\n }\n\n /**\n * Sends a key up event\n * @param key {number} the key to send\n */\n sendKeyUp(key: number): void {\n this.sendKeyEvent(key, false);\n }\n\n\n /**\n * Sends the clipboard content to the WebX Engine.\n * @param clipboardContent the current clipboard content\n */\n sendClipboardContent(clipboardContent: string): void {\n this._sendInstruction(new WebXClipboardInstruction(clipboardContent));\n }\n\n /**\n * Registers a new tracer handler.\n *\n * @param name The unique name of the tracer.\n * @param handler The tracer handler instance.\n */\n registerTracer(name: string, handler: WebXHandler): void {\n this._tracers.set(name, handler);\n }\n\n createDebugImageMessageHandler(): WebXDebugImageMessageHandler {\n if (this._display) {\n return new WebXDebugImageMessageHandler(this._display);\n }\n console.log('Cannot create DebugImageMessageHandler as display is null');\n return null;\n }\n\n /**\n * Resets the input devices (mouse and keyboard).\n */\n resetInputs(): void {\n if (this._mouse) {\n this._mouse.reset();\n }\n\n if (this._keyboard) {\n this._keyboard.reset();\n }\n }\n\n /**\n * Resizes the WebX display to fit the container.\n */\n resizeDisplay(): void {\n if (this._display) {\n this._display.resize();\n }\n }\n\n /**\n * Unregisters a tracer handler.\n *\n * @param name The name of the tracer to unregister.\n */\n unregisterTracer(name: string): void {\n const tracer = this._tracers.get(name);\n if (tracer) {\n // perform cleanup\n tracer.destroy();\n this._tracers.delete(name);\n }\n }\n\n /**\n * Sets the quality index for the WebX Engine.\n *\n * @param qualityIndex The quality index to set.\n */\n setQualityIndex(qualityIndex: number): void {\n const qualityInstruction = new WebXQualityInstruction(qualityIndex);\n this._sendInstruction(qualityInstruction);\n }\n\n /**\n * Creates a screenshot of the current display.\n * @param type The type of the screenshot (e.g., 'image/png').\n * @param quality The quality of the screenshot (0 to 1).\n *\n * @returns A promise that resolves to image data in Blob form.\n */\n async createScreenshot(type: string, quality: number): Promise<Blob> {\n return this.display.createScreenshot(type, quality);\n }\n\n /**\n * Retrieves the screen message from the WebX Engine.\n *\n * This method attempts to get the screen message, retrying up to 3 times\n * if the initial attempts fail.\n *\n * @returns A promise that resolves to the WebXScreenMessage.\n */\n private async _getScreenMessage(): Promise<WebXScreenMessage> {\n // Perform retries on the first instruction (client can sometimes be activated before the server connection$\n // has been fully made (difficult to judge when the webx-engine subscribes to the webx-relay instruction publisher\n let retry = 0;\n while (retry < 3) {\n try {\n return await this._sendRequest(new WebXScreenInstruction(), 5000) as WebXScreenMessage;\n\n } catch (error) {\n retry++;\n console.log(`Failed to initialise screen size at attempt ${retry}/3...`)\n\n if (retry == 3 || !this._tunnel.isConnected()) {\n throw new Error(`unable to get screen size: ${error.message}`);\n }\n }\n }\n }\n\n /**\n * Sends an instruction to the WebX Engine.\n *\n * This method sends the provided instruction to the WebX Engine if the tunnel\n * is connected.\n *\n * @param command The instruction to send.\n */\n private _sendInstruction(command: WebXInstruction): void {\n if (this._tunnel.isConnected()) {\n this._tunnel.sendInstruction(command);\n this._tracers.forEach((value) => {\n if (value instanceof WebXInstructionHandler) {\n value.handle(command);\n }\n });\n }\n }\n\n /**\n * Sends a request to the WebX Engine and returns the response.\n *\n * This method sends the provided request to the WebX Engine and returns a promise\n * that resolves to the response message.\n *\n * @param command The request to send.\n * @param timeout Optional timeout for the request.\n * @returns A promise that resolves to the WebXMessage.\n */\n private _sendRequest(command: WebXInstruction, timeout?: number): Promise<WebXMessage> {\n if (this._tunnel.isConnected()) {\n return this._tunnel.sendRequest(command, timeout);\n }\n }\n\n /**\n * Handles incoming messages from the WebX Engine.\n *\n * This method processes messages received from the WebX Engine and takes\n * appropriate actions based on the message type.\n *\n * @param message The received message.\n */\n private _handleMessage(message: WebXMessage): void {\n if (message.type === WebXMessageType.CONNECTION) {\n const connectionMessage = message as WebXConnectionMessage;\n\n this._connectionHandler.setConnected(connectionMessage.isStarting);\n return;\n\n } else if (message.type === WebXMessageType.NOP) {\n this._connectionHandler.resetTimer();\n }\n\n if (!this._display) {\n return;\n }\n\n if (message.type === WebXMessageType.WINDOWS) {\n const windows = (message as WebXWindowsMessage).windows;\n this._display.updateWindows(windows);\n\n } else if (message.type === WebXMessageType.IMAGE) {\n const imageMessage = message as WebXImageMessage;\n // console.log(`Updating image ${windowId} [${texture.image.width}, ${texture.image.height}]\\n`);\n this._display.updateImage(imageMessage.windowId, imageMessage.depth, imageMessage.colorMap, imageMessage.alphaMap);\n\n } else if (message.type === WebXMessageType.SUBIMAGES) {\n const subImagesMessage = message as WebXSubImagesMessage;\n // console.log(`Updating sub images ${windowId}\\n`);\n this._display.updateSubImages(subImagesMessage.windowId, subImagesMessage.subImages);\n\n } else if (message.type === WebXMessageType.SHAPE) {\n const shapeMessage = message as WebXShapeMessage;\n // console.log(`Updating shape for ${shapeMessage.windowId}\\n`);\n this._display.updateShape(shapeMessage.windowId, shapeMessage.stencilMap);\n\n } else if (message.type === WebXMessageType.MOUSE) {\n const mouseMessage = message as WebXMouseMessage;\n if (mouseMessage.x > 0 && mouseMessage.y > 0) {\n this._display.setMousePosition(mouseMessage.x, mouseMessage.y);\n }\n this._display.setMouseCursor(mouseMessage.cursorId);\n\n } else if (message.type === WebXMessageType.CLIPBOARD) {\n const clipboardMessage = message as WebXClipboardMessage;\n this._clipboardHandler(clipboardMessage.clipboardContent);\n }\n\n this._tracers.forEach((value) => {\n if (value instanceof WebXMessageHandler) {\n value.handle(message);\n }\n });\n }\n\n /**\n * Handles received bytes from the WebX Engine.\n *\n * This method processes the received bytes and updates the tracers with the\n * received data.\n *\n * @param data The received data as an ArrayBuffer.\n */\n private _handleReceivedBytes(data: ArrayBuffer): void {\n this._tracers.forEach((value) => {\n if (value instanceof WebXStatsHandler) {\n value.handle({ received: data.byteLength, sent: 0 });\n }\n });\n }\n\n /**\n * Handles sent bytes to the WebX Engine.\n *\n * This method processes the sent bytes and updates the tracers with the\n * sent data.\n *\n * @param data The sent data as an ArrayBuffer.\n */\n private _handleSentBytes(data: ArrayBuffer): void {\n this._tracers.forEach((value) => {\n if (value instanceof WebXStatsHandler) {\n value.handle({ received: 0, sent: data.byteLength });\n }\n });\n }\n\n /**\n * Handles the quality of the connection to the WebX Engine.\n *\n * This method processes the quality data and updates the tracers with the\n * quality information.\n *\n * @param data The quality data as an ArrayBuffer.\n */\n private _handleQuality(data: ArrayBuffer): void {\n this._tracers.forEach((value) => {\n if (value instanceof WebXStatsHandler) {\n value.handle({ received: 0, sent: data.byteLength });\n }\n });\n }\n\n /**\n * Handles the tunnel closed event.\n *\n * This method performs cleanup and executes the onCloseCallback when the\n * tunnel is closed.\n */\n private _onTunnelClosed(): void {\n this._dispose();\n\n if (this._onCloseCallback) {\n this._onCloseCallback();\n }\n }\n\n /**\n * Disposes of the WebX client resources.\n *\n * This method cleans up the display, mouse, and keyboard resources.\n */\n private _dispose(): void {\n this._connectionHandler.dispose();\n if (this._display) {\n this._display.dispose();\n }\n if (this._mouse) {\n this._mouse.dispose();\n }\n if (this._keyboard) {\n this._keyboard.dispose();\n }\n }\n\n /**\n * Adds mouse event listeners to the WebX client.\n *\n * This method sets up the mouse event listeners for mouse move, mouse out,\n * mouse down, and mouse up events.\n */\n private _addMouseListeners(): void {\n this._mouse.onMouseMove = this._mouse.onMouseOut = (mouseState: WebXMouseState) => {\n const scale = this._display.scale;\n mouseState.x = mouseState.x / scale;\n mouseState.y = mouseState.y / scale;\n this.sendMouse(mouseState);\n };\n\n this._mouse.onMouseDown = this._mouse.onMouseUp = (mouseState: WebXMouseState) => {\n const scale = this._display.scale;\n mouseState.x = mouseState.x / scale;\n mouseState.y = mouseState.y / scale;\n this.sendMouse(mouseState);\n };\n }\n\n /**\n * Adds keyboard event listeners to the WebX client.\n *\n * This method sets up the keyboard event listeners for key down and key up events.\n */\n private _addKeyboardListeners(): void {\n this._keyboard.onKeyDown = key => {\n this.sendKeyDown(key);\n };\n\n this._keyboard.onKeyUp = key => {\n this.sendKeyUp(key);\n };\n }\n}\n"],"names":["ShaderMaterial","Matrix3","Color","BackSide","THREE","LinearFilter","MeshBasicMaterial","DataTexture","WebXImageBlenderWorker","Mesh","WebXMessageType","Vector3","WebXInstructionType","Object3D","Group","Tween","Easing","PlaneGeometry","WebXMessageDecoderWorker","WebXConnectionStatus"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;AAIG;MACU,oBAAoB,CAAA;AA+B/B;;;;AAIG;AACH,IAAA,WAAA,CAAY,UAAgG,EAAA;AAC1G,QAAA,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE;AACvB,QAAA,IAAI,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC;AACrB,QAAA,IAAI,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC;AACrB,QAAA,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK;AAC7B,QAAA,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM;QAC/B,IAAI,CAAC,MAAM,GAAG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