iobroker.proscenic 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +93 -0
  3. package/admin/i18n/de.json +9 -0
  4. package/admin/i18n/en.json +9 -0
  5. package/admin/i18n/es.json +9 -0
  6. package/admin/i18n/fr.json +9 -0
  7. package/admin/i18n/it.json +9 -0
  8. package/admin/i18n/nl.json +9 -0
  9. package/admin/i18n/pl.json +9 -0
  10. package/admin/i18n/pt.json +9 -0
  11. package/admin/i18n/ru.json +9 -0
  12. package/admin/i18n/uk.json +9 -0
  13. package/admin/i18n/zh-cn.json +9 -0
  14. package/admin/jsonConfig.json +85 -0
  15. package/admin/proscenic-m7-pro.png +0 -0
  16. package/admin/proscenic.png +0 -0
  17. package/build/domain/commands.js +129 -0
  18. package/build/domain/commands.js.map +7 -0
  19. package/build/domain/consumables.js +63 -0
  20. package/build/domain/consumables.js.map +7 -0
  21. package/build/domain/live-map.js +829 -0
  22. package/build/domain/live-map.js.map +7 -0
  23. package/build/domain/maintenance-message.js +128 -0
  24. package/build/domain/maintenance-message.js.map +7 -0
  25. package/build/domain/map.js +58 -0
  26. package/build/domain/map.js.map +7 -0
  27. package/build/domain/reconnect-policy.js +45 -0
  28. package/build/domain/reconnect-policy.js.map +7 -0
  29. package/build/domain/status.js +108 -0
  30. package/build/domain/status.js.map +7 -0
  31. package/build/main.js +529 -0
  32. package/build/main.js.map +7 -0
  33. package/build/objects/object-definitions.js +214 -0
  34. package/build/objects/object-definitions.js.map +7 -0
  35. package/build/objects/projector.js +231 -0
  36. package/build/objects/projector.js.map +7 -0
  37. package/build/protocol/crypto.js +81 -0
  38. package/build/protocol/crypto.js.map +7 -0
  39. package/build/protocol/gateway-client.js +136 -0
  40. package/build/protocol/gateway-client.js.map +7 -0
  41. package/build/protocol/rest-client.js +184 -0
  42. package/build/protocol/rest-client.js.map +7 -0
  43. package/build/protocol/types.js +17 -0
  44. package/build/protocol/types.js.map +7 -0
  45. package/io-package.json +125 -0
  46. package/package.json +80 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/domain/live-map.ts"],
4
+ "sourcesContent": ["import { deflateSync } from \"node:zlib\";\n\nexport interface RobotPose {\n\tpos: [number, number];\n\tphi?: number;\n}\n\nexport interface LiveMapImage {\n\tdataUrl: string;\n\twidth: number;\n\theight: number;\n\tareas: LiveMapRenderedArea[];\n\tposeCount: number;\n\trawPoseCount: number;\n\tpathLineSegments: number;\n\tskippedPathSegments: number;\n\trenderedForbiddenAreaCount: number;\n\trenderedRoomAreaCount: number;\n\torientation: \"flip-y\";\n\tdecompressedBytes: number;\n}\n\nexport type LiveMapAreaKind = \"forbidden\" | \"room\" | \"unknown\";\n\nexport interface LiveMapAreaMetadata {\n\tkey: string;\n\tkind: LiveMapAreaKind;\n\tsource: Record<string, unknown>;\n}\n\nexport interface LiveMapCoordinateMetadata {\n\tmapId?: number;\n\tarea?: LiveMapAreaMetadata[];\n\tchargeHandlePos?: [number, number];\n}\n\nexport interface LiveMapRenderedArea {\n\tkey: string;\n\tkind: LiveMapAreaKind;\n\tid?: number | string;\n\tlabel?: string;\n\tbounds?: {\n\t\tminX: number;\n\t\tminY: number;\n\t\tmaxX: number;\n\t\tmaxY: number;\n\t};\n}\n\ninterface MapSample {\n\tencoded: string;\n\twidth: number;\n\theight: number;\n\tresolution?: number;\n\txMin?: number;\n\tyMin?: number;\n\tareas: MapArea[];\n\tchargeHandlePos?: [number, number];\n}\n\ninterface MapArea {\n\tkey: string;\n\tvertices: Array<[number, number]>;\n\tkind: LiveMapAreaKind;\n\tsource: Record<string, unknown>;\n}\n\ntype Color = readonly [number, number, number];\n\nconst PNG_SIGNATURE = Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);\nconst CRC_TABLE = createCrcTable();\nconst MAX_LIVE_MAP_PIXELS = 512 * 512;\nconst MAX_LIVE_MAP_DATA_URL_BYTES = 256 * 1024;\nconst COLOR_UNKNOWN: Color = [184, 204, 216];\nconst COLOR_ROOM: Color = [255, 255, 255];\nconst COLOR_WALL: Color = [56, 130, 188];\nconst COLOR_OBSTACLE: Color = [82, 82, 82];\nconst COLOR_FORBIDDEN_AREA: Color = [209, 106, 133];\nconst COLOR_FORBIDDEN_OUTLINE: Color = [175, 68, 103];\nconst FORBIDDEN_AREA_ALPHA = 0.45;\nconst COLOR_ROOM_AREA: Color = [112, 125, 236];\nconst COLOR_ROOM_AREA_OUTLINE: Color = [68, 84, 210];\nconst ROOM_AREA_ALPHA = 0.3;\nconst COLOR_DOCK: Color = [92, 92, 92];\nconst COLOR_ROBOT: Color = [39, 139, 61];\nconst COLOR_PATH: Color = [126, 216, 96];\nconst COLOR_HEADING: Color = [20, 20, 20];\nconst MIN_PATH_SEGMENT_DISTANCE_SQUARED = 1.5 ** 2;\nconst MAX_PATH_SEGMENT_DISTANCE_SQUARED = 90 ** 2;\nconst ROUTED_PATH_PADDING_PIXELS = 24;\nconst MAX_ROUTED_PATH_CELLS = 20_000;\nconst PATH_LINE_RADIUS = 1;\n\nexport function extractRobotPose20001(data: unknown): RobotPose | undefined {\n\tconst record = getRecord(data);\n\tconst pos = parsePoint(record?.pos);\n\tif (!pos) {\n\t\treturn undefined;\n\t}\n\n\treturn {\n\t\tpos,\n\t\tphi: typeof record?.phi === \"number\" ? record.phi : undefined,\n\t};\n}\n\nexport function renderLiveMapImage20002(data: unknown, poses: readonly RobotPose[] = []): LiveMapImage | undefined {\n\tconst sample = parseMapSample(data);\n\tif (!sample) {\n\t\treturn undefined;\n\t}\n\n\tconst compressed = decodeMapPayload(sample.encoded);\n\tconst occupancy = decompressLz4Block(compressed, sample.width * sample.height);\n\tif (occupancy.length !== sample.width * sample.height) {\n\t\treturn undefined;\n\t}\n\n\tconst pixels = renderOccupancy(sample.width, sample.height, occupancy);\n\tconst coordinateMetadata = drawCoordinateMetadata(sample, pixels);\n\tconst runtime = drawRobotRuntime(sample, occupancy, pixels, poses);\n\n\tconst png = encodeRgbPng(sample.width, sample.height, pixels);\n\tconst dataUrl = `data:image/png;base64,${png.toString(\"base64\")}`;\n\tif (Buffer.byteLength(dataUrl, \"utf8\") > MAX_LIVE_MAP_DATA_URL_BYTES) {\n\t\treturn undefined;\n\t}\n\n\treturn {\n\t\tdataUrl,\n\t\twidth: sample.width,\n\t\theight: sample.height,\n\t\tareas: summarizeRenderedAreas(sample),\n\t\tposeCount: runtime.projectedPoseCount,\n\t\trawPoseCount: poses.length,\n\t\tpathLineSegments: runtime.pathLineSegments,\n\t\tskippedPathSegments: runtime.skippedPathSegments,\n\t\trenderedForbiddenAreaCount: coordinateMetadata.renderedForbiddenAreaCount,\n\t\trenderedRoomAreaCount: coordinateMetadata.renderedRoomAreaCount,\n\t\torientation: \"flip-y\",\n\t\tdecompressedBytes: occupancy.length,\n\t};\n}\n\nexport function extractLiveMapCoordinateMetadata20002(data: unknown): LiveMapCoordinateMetadata | undefined {\n\tconst record = getRecord(data);\n\tif (!record) {\n\t\treturn undefined;\n\t}\n\n\tconst metadata: LiveMapCoordinateMetadata = {};\n\tif (typeof record.mapId === \"number\") {\n\t\tmetadata.mapId = record.mapId;\n\t}\n\tconst areas = normalizeMapAreaMetadata(record.area);\n\tif (areas.length > 0) {\n\t\tmetadata.area = areas;\n\t}\n\n\tconst chargeHandlePos = parsePoint(record.chargeHandlePos);\n\tif (chargeHandlePos) {\n\t\tmetadata.chargeHandlePos = chargeHandlePos;\n\t}\n\n\treturn metadata.mapId !== undefined || metadata.area !== undefined || metadata.chargeHandlePos !== undefined\n\t\t? metadata\n\t\t: undefined;\n}\n\nexport function mergeLiveMapCoordinateMetadata20002(\n\tdata: unknown,\n\tmetadata: LiveMapCoordinateMetadata | undefined,\n): unknown {\n\tconst record = getRecord(data);\n\tif (!record || !metadata) {\n\t\treturn data;\n\t}\n\n\tif (metadata.mapId !== undefined && typeof record.mapId === \"number\" && metadata.mapId !== record.mapId) {\n\t\treturn data;\n\t}\n\n\tconst merged = { ...record };\n\tif (metadata.area && metadata.area.length > 0) {\n\t\tmerged.area = metadata.area.map(area => ({\n\t\t\t...area.source,\n\t\t\t__proscenicKind: area.kind,\n\t\t}));\n\t}\n\tif (metadata.chargeHandlePos && !parsePoint(record.chargeHandlePos)) {\n\t\tmerged.chargeHandlePos = metadata.chargeHandlePos;\n\t}\n\treturn merged;\n}\n\nexport function countLiveMapAreas20002(data: unknown): number {\n\tconst record = getRecord(data);\n\treturn Array.isArray(record?.area) ? record.area.length : 0;\n}\n\nexport function mergeLiveMapCoordinateMetadataCache(\n\tprevious: LiveMapCoordinateMetadata | undefined,\n\tnext: LiveMapCoordinateMetadata,\n): LiveMapCoordinateMetadata {\n\tconst sameMap = previous?.mapId === undefined || next.mapId === undefined || previous.mapId === next.mapId;\n\tconst previousAreas = sameMap ? (previous?.area ?? []) : [];\n\n\treturn {\n\t\tmapId: next.mapId ?? previous?.mapId,\n\t\tarea: mergeAreaMetadata(previousAreas, next.area ?? []),\n\t\tchargeHandlePos: next.chargeHandlePos ?? (sameMap ? previous?.chargeHandlePos : undefined),\n\t};\n}\n\nfunction parseMapSample(data: unknown): MapSample | undefined {\n\tconst record = getRecord(data);\n\tif (!record) {\n\t\treturn undefined;\n\t}\n\n\tconst encoded = record.map;\n\tconst width = record.width;\n\tconst height = record.height;\n\tif (typeof encoded !== \"string\" || typeof width !== \"number\" || typeof height !== \"number\") {\n\t\treturn undefined;\n\t}\n\tif (!Number.isSafeInteger(width) || !Number.isSafeInteger(height) || width <= 0 || height <= 0) {\n\t\treturn undefined;\n\t}\n\tif (width * height > MAX_LIVE_MAP_PIXELS) {\n\t\treturn undefined;\n\t}\n\n\treturn {\n\t\tencoded,\n\t\twidth,\n\t\theight,\n\t\tresolution: typeof record.resolution === \"number\" ? record.resolution : undefined,\n\t\txMin: typeof record.x_min === \"number\" ? record.x_min : undefined,\n\t\tyMin: typeof record.y_min === \"number\" ? record.y_min : undefined,\n\t\tareas: parseMapAreas(record.area),\n\t\tchargeHandlePos: parsePoint(record.chargeHandlePos),\n\t};\n}\n\nfunction renderOccupancy(width: number, height: number, occupancy: Buffer): Buffer {\n\tconst pixels = Buffer.alloc(width * height * 3);\n\tfor (let index = 0; index < occupancy.length; index++) {\n\t\tconst sourceX = index % width;\n\t\tconst sourceY = Math.floor(index / width);\n\t\tconst targetY = height - 1 - sourceY;\n\t\tconst value = occupancy[index];\n\t\tif (value === 0) {\n\t\t\tsetPixel(pixels, width, height, sourceX, targetY, COLOR_WALL);\n\t\t} else if (value === 127) {\n\t\t\tsetPixel(pixels, width, height, sourceX, targetY, COLOR_ROOM);\n\t\t} else if (value === 255) {\n\t\t\tsetPixel(pixels, width, height, sourceX, targetY, COLOR_UNKNOWN);\n\t\t} else {\n\t\t\tsetPixel(pixels, width, height, sourceX, targetY, value < 127 ? COLOR_OBSTACLE : COLOR_ROOM);\n\t\t}\n\t}\n\treturn pixels;\n}\n\nfunction drawCoordinateMetadata(\n\tsample: MapSample,\n\tpixels: Buffer,\n): { renderedForbiddenAreaCount: number; renderedRoomAreaCount: number } {\n\tlet renderedForbiddenAreaCount = 0;\n\tlet renderedRoomAreaCount = 0;\n\tfor (const area of sample.areas) {\n\t\tconst projected = area.vertices\n\t\t\t.map(vertex => projectRobotCoordinate(sample, vertex))\n\t\t\t.filter((vertex): vertex is [number, number] => vertex !== undefined);\n\t\tif (projected.length >= 3) {\n\t\t\tif (area.kind === \"room\") {\n\t\t\t\tfillPolygon(pixels, sample.width, sample.height, projected, COLOR_ROOM_AREA, ROOM_AREA_ALPHA);\n\t\t\t\tdrawPolygon(pixels, sample.width, sample.height, projected, COLOR_ROOM_AREA_OUTLINE);\n\t\t\t\trenderedRoomAreaCount += 1;\n\t\t\t} else {\n\t\t\t\tfillPolygon(pixels, sample.width, sample.height, projected, COLOR_FORBIDDEN_AREA, FORBIDDEN_AREA_ALPHA);\n\t\t\t\tdrawPolygon(pixels, sample.width, sample.height, projected, COLOR_FORBIDDEN_OUTLINE);\n\t\t\t\trenderedForbiddenAreaCount += 1;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (sample.chargeHandlePos) {\n\t\tconst charge = projectRobotCoordinate(sample, sample.chargeHandlePos);\n\t\tif (charge) {\n\t\t\tplotMarker(pixels, sample.width, sample.height, charge[0], charge[1], 5, COLOR_DOCK);\n\t\t}\n\t}\n\n\treturn { renderedForbiddenAreaCount, renderedRoomAreaCount };\n}\n\nfunction drawRobotRuntime(\n\tsample: MapSample,\n\toccupancy: Buffer,\n\tpixels: Buffer,\n\tposes: readonly RobotPose[],\n): { projectedPoseCount: number; pathLineSegments: number; skippedPathSegments: number } {\n\tconst projected = poses\n\t\t.map(pose => ({\n\t\t\tpoint: projectRobotCoordinate(sample, pose.pos),\n\t\t\tphi: pose.phi,\n\t\t}))\n\t\t.filter((pose): pose is { point: [number, number]; phi: number | undefined } => pose.point !== undefined);\n\n\tlet pathLineSegments = 0;\n\tlet skippedPathSegments = 0;\n\n\tfor (let index = 1; index < projected.length; index++) {\n\t\tconst previous = projected[index - 1].point;\n\t\tconst current = projected[index].point;\n\t\tconst segmentDistanceSquared = distanceSquared(previous, current);\n\t\tif (\n\t\t\tsegmentDistanceSquared >= MIN_PATH_SEGMENT_DISTANCE_SQUARED &&\n\t\t\tsegmentDistanceSquared <= MAX_PATH_SEGMENT_DISTANCE_SQUARED\n\t\t) {\n\t\t\tconst routedPath = findDrawablePath(sample, occupancy, previous, current);\n\t\t\tif (routedPath) {\n\t\t\t\tdrawAdaptivePathPolyline(sample, occupancy, pixels, sample.width, sample.height, routedPath);\n\t\t\t\tpathLineSegments += 1;\n\t\t\t} else {\n\t\t\t\tskippedPathSegments += 1;\n\t\t\t}\n\t\t} else {\n\t\t\tskippedPathSegments += 1;\n\t\t}\n\t}\n\n\tconst latest = projected.at(-1);\n\tif (!latest) {\n\t\treturn {\n\t\t\tprojectedPoseCount: 0,\n\t\t\tpathLineSegments,\n\t\t\tskippedPathSegments,\n\t\t};\n\t}\n\n\tplotMarker(pixels, sample.width, sample.height, latest.point[0], latest.point[1], 5, COLOR_ROBOT);\n\tif (latest.phi !== undefined) {\n\t\tconst angle = latest.phi / 1000;\n\t\tconst headingLength = 10;\n\t\tconst endX = Math.round(latest.point[0] + Math.cos(angle) * headingLength);\n\t\tconst endY = Math.round(latest.point[1] - Math.sin(angle) * headingLength);\n\t\tdrawLine(pixels, sample.width, sample.height, latest.point[0], latest.point[1], endX, endY, COLOR_HEADING);\n\t}\n\n\treturn {\n\t\tprojectedPoseCount: projected.length,\n\t\tpathLineSegments,\n\t\tskippedPathSegments,\n\t};\n}\n\nfunction drawAdaptivePathLine(\n\tpixels: Buffer,\n\twidth: number,\n\theight: number,\n\tx1: number,\n\ty1: number,\n\tx2: number,\n\ty2: number,\n\tcanDraw?: (x: number, y: number) => boolean,\n): void {\n\tdrawLineWithPixelColor(pixels, width, height, x1, y1, x2, y2, (x, y) =>\n\t\tcanDraw && !canDraw(x, y) ? undefined : COLOR_PATH,\n\t);\n\tdrawLineNeighbors(pixels, width, height, x1, y1, x2, y2, canDraw);\n}\n\nfunction drawAdaptivePathPolyline(\n\tsample: MapSample,\n\toccupancy: Buffer,\n\tpixels: Buffer,\n\twidth: number,\n\theight: number,\n\tpoints: readonly [number, number][],\n): void {\n\tconst canDraw = (x: number, y: number): boolean => isTraversableMapPixel(sample, occupancy, x, y);\n\tfor (let index = 1; index < points.length; index++) {\n\t\tconst [x1, y1] = points[index - 1];\n\t\tconst [x2, y2] = points[index];\n\t\tdrawAdaptivePathLine(pixels, width, height, x1, y1, x2, y2, canDraw);\n\t}\n}\n\nfunction findDrawablePath(\n\tsample: MapSample,\n\toccupancy: Buffer,\n\tstart: [number, number],\n\tend: [number, number],\n): Array<[number, number]> | undefined {\n\tif (isDirectPathTraversable(sample, occupancy, start, end)) {\n\t\treturn [start, end];\n\t}\n\n\treturn findRoutedPath(sample, occupancy, start, end);\n}\n\nfunction isDirectPathTraversable(\n\tsample: MapSample,\n\toccupancy: Buffer,\n\tstart: [number, number],\n\tend: [number, number],\n): boolean {\n\tlet traversedCells = 0;\n\tlet blockedCells = 0;\n\tforEachLinePoint(start[0], start[1], end[0], end[1], (x, y) => {\n\t\ttraversedCells += 1;\n\t\tif (!isTraversableMapPixel(sample, occupancy, x, y)) {\n\t\t\tblockedCells += 1;\n\t\t}\n\t});\n\treturn traversedCells > 0 && blockedCells === 0;\n}\n\nfunction findRoutedPath(\n\tsample: MapSample,\n\toccupancy: Buffer,\n\tstart: [number, number],\n\tend: [number, number],\n): Array<[number, number]> | undefined {\n\tconst routeStart = nearestTraversablePoint(sample, occupancy, start);\n\tconst routeEnd = nearestTraversablePoint(sample, occupancy, end);\n\tif (!routeStart || !routeEnd) {\n\t\treturn undefined;\n\t}\n\n\tconst minX = Math.max(0, Math.min(routeStart[0], routeEnd[0]) - ROUTED_PATH_PADDING_PIXELS);\n\tconst maxX = Math.min(sample.width - 1, Math.max(routeStart[0], routeEnd[0]) + ROUTED_PATH_PADDING_PIXELS);\n\tconst minY = Math.max(0, Math.min(routeStart[1], routeEnd[1]) - ROUTED_PATH_PADDING_PIXELS);\n\tconst maxY = Math.min(sample.height - 1, Math.max(routeStart[1], routeEnd[1]) + ROUTED_PATH_PADDING_PIXELS);\n\tconst searchWidth = maxX - minX + 1;\n\tconst searchHeight = maxY - minY + 1;\n\tif (searchWidth * searchHeight > MAX_ROUTED_PATH_CELLS) {\n\t\treturn undefined;\n\t}\n\n\tconst distance = new Map<number, number>();\n\tconst previous = new Map<number, number>();\n\tconst queue: Array<{ key: number; score: number }> = [];\n\tconst startKey = localPointKey(routeStart[0], routeStart[1], minX, minY, searchWidth);\n\tconst endKey = localPointKey(routeEnd[0], routeEnd[1], minX, minY, searchWidth);\n\tdistance.set(startKey, 0);\n\tqueue.push({ key: startKey, score: heuristic(routeStart, routeEnd) });\n\n\twhile (queue.length > 0) {\n\t\tqueue.sort((left, right) => left.score - right.score);\n\t\tconst current = queue.shift();\n\t\tif (!current) {\n\t\t\tbreak;\n\t\t}\n\t\tif (current.key === endKey) {\n\t\t\treturn restoreRoutedPath(previous, current.key, minX, minY, searchWidth);\n\t\t}\n\n\t\tconst [currentX, currentY] = pointFromLocalKey(current.key, minX, minY, searchWidth);\n\t\tconst currentDistance = distance.get(current.key) ?? Number.POSITIVE_INFINITY;\n\t\tfor (let dy = -1; dy <= 1; dy++) {\n\t\t\tfor (let dx = -1; dx <= 1; dx++) {\n\t\t\t\tif (dx === 0 && dy === 0) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst nextX = currentX + dx;\n\t\t\t\tconst nextY = currentY + dy;\n\t\t\t\tif (\n\t\t\t\t\tnextX < minX ||\n\t\t\t\t\tnextX > maxX ||\n\t\t\t\t\tnextY < minY ||\n\t\t\t\t\tnextY > maxY ||\n\t\t\t\t\t!isTraversableMapPixel(sample, occupancy, nextX, nextY)\n\t\t\t\t) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst nextKey = localPointKey(nextX, nextY, minX, minY, searchWidth);\n\t\t\t\tconst nextDistance = currentDistance + (dx !== 0 && dy !== 0 ? Math.SQRT2 : 1);\n\t\t\t\tif (nextDistance >= (distance.get(nextKey) ?? Number.POSITIVE_INFINITY)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tdistance.set(nextKey, nextDistance);\n\t\t\t\tprevious.set(nextKey, current.key);\n\t\t\t\tqueue.push({ key: nextKey, score: nextDistance + heuristic([nextX, nextY], routeEnd) });\n\t\t\t}\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\nfunction restoreRoutedPath(\n\tprevious: ReadonlyMap<number, number>,\n\tendKey: number,\n\tminX: number,\n\tminY: number,\n\twidth: number,\n): Array<[number, number]> {\n\tconst keys = [endKey];\n\tlet current = endKey;\n\twhile (previous.has(current)) {\n\t\tcurrent = previous.get(current) ?? current;\n\t\tkeys.push(current);\n\t}\n\treturn simplifyPath(keys.reverse().map(key => pointFromLocalKey(key, minX, minY, width)));\n}\n\nfunction simplifyPath(points: Array<[number, number]>): Array<[number, number]> {\n\tif (points.length <= 2) {\n\t\treturn points;\n\t}\n\tconst simplified: Array<[number, number]> = [points[0]];\n\tlet previousDirection: [number, number] | undefined;\n\tfor (let index = 1; index < points.length; index++) {\n\t\tconst direction: [number, number] = [\n\t\t\tMath.sign(points[index][0] - points[index - 1][0]),\n\t\t\tMath.sign(points[index][1] - points[index - 1][1]),\n\t\t];\n\t\tif (previousDirection && (direction[0] !== previousDirection[0] || direction[1] !== previousDirection[1])) {\n\t\t\tsimplified.push(points[index - 1]);\n\t\t}\n\t\tpreviousDirection = direction;\n\t}\n\tsimplified.push(points.at(-1) ?? points[0]);\n\treturn simplified;\n}\n\nfunction nearestTraversablePoint(\n\tsample: MapSample,\n\toccupancy: Buffer,\n\tpoint: [number, number],\n): [number, number] | undefined {\n\tif (isTraversableMapPixel(sample, occupancy, point[0], point[1])) {\n\t\treturn point;\n\t}\n\tfor (let radius = 1; radius <= 3; radius++) {\n\t\tfor (let y = point[1] - radius; y <= point[1] + radius; y++) {\n\t\t\tfor (let x = point[0] - radius; x <= point[0] + radius; x++) {\n\t\t\t\tif (isTraversableMapPixel(sample, occupancy, x, y)) {\n\t\t\t\t\treturn [x, y];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn undefined;\n}\n\nfunction isTraversableMapPixel(sample: MapSample, occupancy: Buffer, x: number, y: number): boolean {\n\tif (x < 0 || x >= sample.width || y < 0 || y >= sample.height) {\n\t\treturn false;\n\t}\n\tconst sourceY = sample.height - 1 - y;\n\tconst value = occupancy[sourceY * sample.width + x];\n\treturn value >= 127;\n}\n\nfunction localPointKey(x: number, y: number, minX: number, minY: number, width: number): number {\n\treturn (y - minY) * width + (x - minX);\n}\n\nfunction pointFromLocalKey(key: number, minX: number, minY: number, width: number): [number, number] {\n\treturn [minX + (key % width), minY + Math.floor(key / width)];\n}\n\nfunction heuristic(left: [number, number], right: [number, number]): number {\n\treturn Math.hypot(left[0] - right[0], left[1] - right[1]);\n}\n\nfunction drawLineNeighbors(\n\tpixels: Buffer,\n\twidth: number,\n\theight: number,\n\tx1: number,\n\ty1: number,\n\tx2: number,\n\ty2: number,\n\tcanDraw?: (x: number, y: number) => boolean,\n): void {\n\tfor (let dy = -PATH_LINE_RADIUS; dy <= PATH_LINE_RADIUS; dy++) {\n\t\tfor (let dx = -PATH_LINE_RADIUS; dx <= PATH_LINE_RADIUS; dx++) {\n\t\t\tif ((dx === 0 && dy === 0) || dx * dx + dy * dy > PATH_LINE_RADIUS * PATH_LINE_RADIUS) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tdrawLineWithPixelColor(pixels, width, height, x1 + dx, y1 + dy, x2 + dx, y2 + dy, (x, y) =>\n\t\t\t\tcanDraw && !canDraw(x, y) ? undefined : COLOR_PATH,\n\t\t\t);\n\t\t}\n\t}\n}\n\nfunction projectRobotCoordinate(sample: MapSample, point: [number, number]): [number, number] | undefined {\n\tif (sample.resolution === undefined || sample.xMin === undefined || sample.yMin === undefined) {\n\t\treturn undefined;\n\t}\n\n\tconst xMeters = point[0] / 1000;\n\tconst yMeters = point[1] / 1000;\n\tconst x = Math.round((xMeters - sample.xMin) / sample.resolution);\n\tconst y = sample.height - 1 - Math.round((yMeters - sample.yMin) / sample.resolution);\n\tif (x < 0 || x >= sample.width || y < 0 || y >= sample.height) {\n\t\treturn undefined;\n\t}\n\treturn [x, y];\n}\n\nfunction parseMapAreas(value: unknown): MapArea[] {\n\treturn normalizeMapAreaMetadata(value).map(area => ({\n\t\tkey: area.key,\n\t\tvertices: parseVertices(area.source.vertexs),\n\t\tkind: area.kind,\n\t\tsource: area.source,\n\t}));\n}\n\nfunction summarizeRenderedAreas(sample: MapSample): LiveMapRenderedArea[] {\n\treturn sample.areas.map(area => {\n\t\tconst projected = area.vertices\n\t\t\t.map(point => projectRobotCoordinate(sample, point))\n\t\t\t.filter((point): point is [number, number] => point !== undefined);\n\t\tconst id =\n\t\t\ttypeof area.source.id === \"number\" || typeof area.source.id === \"string\" ? area.source.id : undefined;\n\t\tconst label = firstUsefulLabel(area.source.tag, area.source.name);\n\n\t\treturn {\n\t\t\tkey: area.key,\n\t\t\tkind: area.kind,\n\t\t\t...(id !== undefined ? { id } : {}),\n\t\t\t...(label !== undefined ? { label } : {}),\n\t\t\t...(projected.length > 0 ? { bounds: boundsFor(projected) } : {}),\n\t\t};\n\t});\n}\n\nfunction firstUsefulLabel(...values: unknown[]): string | undefined {\n\tfor (const value of values) {\n\t\tif (typeof value === \"string\" && value.trim().length > 0) {\n\t\t\treturn value;\n\t\t}\n\t}\n\treturn undefined;\n}\n\nfunction boundsFor(points: readonly [number, number][]): LiveMapRenderedArea[\"bounds\"] {\n\tconst xs = points.map(([x]) => x);\n\tconst ys = points.map(([, y]) => y);\n\treturn {\n\t\tminX: Math.min(...xs),\n\t\tminY: Math.min(...ys),\n\t\tmaxX: Math.max(...xs),\n\t\tmaxY: Math.max(...ys),\n\t};\n}\n\nfunction normalizeMapAreaMetadata(value: unknown): LiveMapAreaMetadata[] {\n\tif (!Array.isArray(value)) {\n\t\treturn [];\n\t}\n\n\tconst candidates = value\n\t\t.map(entry => {\n\t\t\tconst record = getRecord(entry);\n\t\t\tif (!record) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tconst vertices = parseVertices(record.vertexs);\n\t\t\tif (vertices.length < 3) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tconst key = mapAreaKey(record, vertices);\n\t\t\tconst explicitKind = parseAreaKind(record.__proscenicKind);\n\t\t\treturn {\n\t\t\t\tkey,\n\t\t\t\texplicitKind,\n\t\t\t\tsource: record,\n\t\t\t};\n\t\t})\n\t\t.filter(\n\t\t\t(\n\t\t\t\tentry,\n\t\t\t): entry is {\n\t\t\t\tkey: string;\n\t\t\t\texplicitKind: LiveMapAreaKind | undefined;\n\t\t\t\tsource: Record<string, unknown>;\n\t\t\t} => entry !== undefined,\n\t\t);\n\n\tconst counts = new Map<string, number>();\n\tfor (const candidate of candidates) {\n\t\tcounts.set(candidate.key, (counts.get(candidate.key) ?? 0) + 1);\n\t}\n\n\tconst normalized = new Map<string, LiveMapAreaMetadata>();\n\tfor (const candidate of candidates) {\n\t\tconst kind =\n\t\t\tcandidate.explicitKind ??\n\t\t\t(counts.get(candidate.key) !== undefined && (counts.get(candidate.key) ?? 0) > 1\n\t\t\t\t? \"forbidden\"\n\t\t\t\t: candidates.length === 1\n\t\t\t\t\t? \"forbidden\"\n\t\t\t\t\t: \"room\");\n\t\tconst existing = normalized.get(candidate.key);\n\t\tconst next = {\n\t\t\tkey: candidate.key,\n\t\t\tkind,\n\t\t\tsource: withoutInternalAreaMetadata(candidate.source),\n\t\t};\n\t\tnormalized.set(candidate.key, existing ? mergeAreaMetadataEntry(existing, next) : next);\n\t}\n\n\treturn [...normalized.values()];\n}\n\nfunction mergeAreaMetadata(\n\tprevious: readonly LiveMapAreaMetadata[],\n\tnext: readonly LiveMapAreaMetadata[],\n): LiveMapAreaMetadata[] {\n\tconst merged = new Map<string, LiveMapAreaMetadata>();\n\tfor (const area of [...previous, ...next]) {\n\t\tconst existing = merged.get(area.key);\n\t\tmerged.set(area.key, existing ? mergeAreaMetadataEntry(existing, area) : area);\n\t}\n\treturn [...merged.values()];\n}\n\nfunction mergeAreaMetadataEntry(left: LiveMapAreaMetadata, right: LiveMapAreaMetadata): LiveMapAreaMetadata {\n\treturn {\n\t\tkey: right.key,\n\t\tkind: strongestAreaKind(left.kind, right.kind),\n\t\tsource: right.source,\n\t};\n}\n\nfunction strongestAreaKind(left: LiveMapAreaKind, right: LiveMapAreaKind): LiveMapAreaKind {\n\tif (left === \"forbidden\" || right === \"forbidden\") {\n\t\treturn \"forbidden\";\n\t}\n\tif (left === \"room\" || right === \"room\") {\n\t\treturn \"room\";\n\t}\n\treturn \"unknown\";\n}\n\nfunction parseAreaKind(value: unknown): LiveMapAreaKind | undefined {\n\treturn value === \"forbidden\" || value === \"room\" || value === \"unknown\" ? value : undefined;\n}\n\nfunction withoutInternalAreaMetadata(record: Record<string, unknown>): Record<string, unknown> {\n\tconst clone = { ...record };\n\tdelete clone.__proscenicKind;\n\treturn clone;\n}\n\nfunction parseVertices(value: unknown): Array<[number, number]> {\n\tif (!Array.isArray(value)) {\n\t\treturn [];\n\t}\n\treturn value.map(vertex => parsePoint(vertex)).filter((vertex): vertex is [number, number] => vertex !== undefined);\n}\n\nfunction mapAreaKey(record: Record<string, unknown>, vertices: readonly [number, number][]): string {\n\tconst id = record.id;\n\tif (typeof id === \"number\" || typeof id === \"string\") {\n\t\treturn `id:${String(id)}`;\n\t}\n\tconst xs = vertices.map(([x]) => x);\n\tconst ys = vertices.map(([, y]) => y);\n\treturn `shape:${vertices.length}:${Math.min(...xs)}:${Math.min(...ys)}:${Math.max(...xs)}:${Math.max(...ys)}`;\n}\n\nfunction parsePoint(value: unknown): [number, number] | undefined {\n\tif (Array.isArray(value) && value.length >= 2 && typeof value[0] === \"number\" && typeof value[1] === \"number\") {\n\t\treturn [value[0], value[1]];\n\t}\n\treturn undefined;\n}\n\nfunction getRecord(value: unknown): Record<string, unknown> | undefined {\n\treturn value !== null && typeof value === \"object\" && !Array.isArray(value)\n\t\t? (value as Record<string, unknown>)\n\t\t: undefined;\n}\n\nfunction decodeMapPayload(encodedMap: string): Buffer {\n\treturn Buffer.from(encodedMap.replace(/\\s/gu, \"+\"), \"base64\");\n}\n\nfunction decompressLz4Block(input: Buffer, maxOutputBytes: number): Buffer {\n\tconst output = Buffer.alloc(maxOutputBytes);\n\tlet inputOffset = 0;\n\tlet outputOffset = 0;\n\n\twhile (inputOffset < input.length) {\n\t\tconst token = input[inputOffset++];\n\t\tlet literalLength = token >> 4;\n\t\tif (literalLength === 15) {\n\t\t\tlet next: number;\n\t\t\tdo {\n\t\t\t\tif (inputOffset >= input.length) {\n\t\t\t\t\tthrow new Error(\"literal length overflow\");\n\t\t\t\t}\n\t\t\t\tnext = input[inputOffset++];\n\t\t\t\tliteralLength += next;\n\t\t\t} while (next === 255);\n\t\t}\n\n\t\tif (inputOffset + literalLength > input.length || outputOffset + literalLength > output.length) {\n\t\t\tthrow new Error(\"literal overrun\");\n\t\t}\n\t\tinput.copy(output, outputOffset, inputOffset, inputOffset + literalLength);\n\t\tinputOffset += literalLength;\n\t\toutputOffset += literalLength;\n\n\t\tif (inputOffset >= input.length) {\n\t\t\tbreak;\n\t\t}\n\t\tif (inputOffset + 2 > input.length) {\n\t\t\tthrow new Error(\"offset overrun\");\n\t\t}\n\t\tconst matchOffset = input[inputOffset] | (input[inputOffset + 1] << 8);\n\t\tinputOffset += 2;\n\t\tif (matchOffset === 0 || matchOffset > outputOffset) {\n\t\t\tthrow new Error(\"bad match offset\");\n\t\t}\n\n\t\tlet matchLength = token & 0x0f;\n\t\tif (matchLength === 15) {\n\t\t\tlet next: number;\n\t\t\tdo {\n\t\t\t\tif (inputOffset >= input.length) {\n\t\t\t\t\tthrow new Error(\"match length overflow\");\n\t\t\t\t}\n\t\t\t\tnext = input[inputOffset++];\n\t\t\t\tmatchLength += next;\n\t\t\t} while (next === 255);\n\t\t}\n\t\tmatchLength += 4;\n\t\tif (outputOffset + matchLength > output.length) {\n\t\t\tthrow new Error(\"match overrun\");\n\t\t}\n\t\tfor (let index = 0; index < matchLength; index++) {\n\t\t\toutput[outputOffset + index] = output[outputOffset - matchOffset + index];\n\t\t}\n\t\toutputOffset += matchLength;\n\t}\n\n\treturn output.subarray(0, outputOffset);\n}\n\nfunction fillPolygon(\n\tpixels: Buffer,\n\twidth: number,\n\theight: number,\n\tpolygon: Array<[number, number]>,\n\tcolor: Color,\n\talpha = 1,\n): void {\n\tconst minY = Math.max(0, Math.min(...polygon.map(([, y]) => y)));\n\tconst maxY = Math.min(height - 1, Math.max(...polygon.map(([, y]) => y)));\n\n\tfor (let y = minY; y <= maxY; y++) {\n\t\tconst intersections: number[] = [];\n\t\tfor (let index = 0; index < polygon.length; index++) {\n\t\t\tconst [x1, y1] = polygon[index];\n\t\t\tconst [x2, y2] = polygon[(index + 1) % polygon.length];\n\t\t\tif ((y1 <= y && y2 > y) || (y2 <= y && y1 > y)) {\n\t\t\t\tconst x = x1 + ((y - y1) * (x2 - x1)) / (y2 - y1);\n\t\t\t\tintersections.push(Math.round(x));\n\t\t\t}\n\t\t}\n\n\t\tintersections.sort((left, right) => left - right);\n\t\tfor (let index = 0; index + 1 < intersections.length; index += 2) {\n\t\t\tconst start = Math.max(0, intersections[index]);\n\t\t\tconst end = Math.min(width - 1, intersections[index + 1]);\n\t\t\tfor (let x = start; x <= end; x++) {\n\t\t\t\tblendPixel(pixels, width, height, x, y, color, alpha);\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction drawPolygon(\n\tpixels: Buffer,\n\twidth: number,\n\theight: number,\n\tpolygon: Array<[number, number]>,\n\tcolor: Color,\n): void {\n\tfor (let index = 0; index < polygon.length; index++) {\n\t\tconst [x1, y1] = polygon[index];\n\t\tconst [x2, y2] = polygon[(index + 1) % polygon.length];\n\t\tdrawLine(pixels, width, height, x1, y1, x2, y2, color);\n\t}\n}\n\nfunction drawLine(\n\tpixels: Buffer,\n\twidth: number,\n\theight: number,\n\tx1: number,\n\ty1: number,\n\tx2: number,\n\ty2: number,\n\tcolor: Color,\n): void {\n\tdrawLineWithPixelColor(pixels, width, height, x1, y1, x2, y2, () => color);\n}\n\nfunction forEachLinePoint(\n\tx1: number,\n\ty1: number,\n\tx2: number,\n\ty2: number,\n\tcallback: (x: number, y: number) => void,\n): void {\n\tconst dx = Math.abs(x2 - x1);\n\tconst sx = x1 < x2 ? 1 : -1;\n\tconst dy = -Math.abs(y2 - y1);\n\tconst sy = y1 < y2 ? 1 : -1;\n\tlet error = dx + dy;\n\tlet x = x1;\n\tlet y = y1;\n\n\twhile (true) {\n\t\tcallback(x, y);\n\t\tif (x === x2 && y === y2) {\n\t\t\tbreak;\n\t\t}\n\t\tconst error2 = 2 * error;\n\t\tif (error2 >= dy) {\n\t\t\terror += dy;\n\t\t\tx += sx;\n\t\t}\n\t\tif (error2 <= dx) {\n\t\t\terror += dx;\n\t\t\ty += sy;\n\t\t}\n\t}\n}\n\nfunction drawLineWithPixelColor(\n\tpixels: Buffer,\n\twidth: number,\n\theight: number,\n\tx1: number,\n\ty1: number,\n\tx2: number,\n\ty2: number,\n\tpickColor: (x: number, y: number) => Color | undefined,\n): void {\n\tconst dx = Math.abs(x2 - x1);\n\tconst sx = x1 < x2 ? 1 : -1;\n\tconst dy = -Math.abs(y2 - y1);\n\tconst sy = y1 < y2 ? 1 : -1;\n\tlet error = dx + dy;\n\tlet x = x1;\n\tlet y = y1;\n\n\twhile (true) {\n\t\tif (x >= 0 && x < width && y >= 0 && y < height) {\n\t\t\tconst color = pickColor(x, y);\n\t\t\tif (color) {\n\t\t\t\tsetPixel(pixels, width, height, x, y, color);\n\t\t\t}\n\t\t}\n\t\tif (x === x2 && y === y2) {\n\t\t\tbreak;\n\t\t}\n\t\tconst error2 = 2 * error;\n\t\tif (error2 >= dy) {\n\t\t\terror += dy;\n\t\t\tx += sx;\n\t\t}\n\t\tif (error2 <= dx) {\n\t\t\terror += dx;\n\t\t\ty += sy;\n\t\t}\n\t}\n}\n\nfunction plotMarker(\n\tpixels: Buffer,\n\twidth: number,\n\theight: number,\n\tx: number,\n\ty: number,\n\tradius: number,\n\tcolor: Color,\n): void {\n\tfor (let dy = -radius; dy <= radius; dy++) {\n\t\tfor (let dx = -radius; dx <= radius; dx++) {\n\t\t\tconst px = x + dx;\n\t\t\tconst py = y + dy;\n\t\t\tif (px >= 0 && px < width && py >= 0 && py < height && dx * dx + dy * dy <= radius * radius) {\n\t\t\t\tsetPixel(pixels, width, height, px, py, color);\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction setPixel(pixels: Buffer, width: number, height: number, x: number, y: number, color: Color): void {\n\tif (x < 0 || x >= width || y < 0 || y >= height) {\n\t\treturn;\n\t}\n\n\tconst offset = (y * width + x) * 3;\n\tpixels[offset] = color[0];\n\tpixels[offset + 1] = color[1];\n\tpixels[offset + 2] = color[2];\n}\n\nfunction blendPixel(\n\tpixels: Buffer,\n\twidth: number,\n\theight: number,\n\tx: number,\n\ty: number,\n\tcolor: Color,\n\talpha: number,\n): void {\n\tif (alpha >= 1) {\n\t\tsetPixel(pixels, width, height, x, y, color);\n\t\treturn;\n\t}\n\tif (x < 0 || x >= width || y < 0 || y >= height) {\n\t\treturn;\n\t}\n\n\tconst offset = (y * width + x) * 3;\n\tpixels[offset] = Math.round(pixels[offset] * (1 - alpha) + color[0] * alpha);\n\tpixels[offset + 1] = Math.round(pixels[offset + 1] * (1 - alpha) + color[1] * alpha);\n\tpixels[offset + 2] = Math.round(pixels[offset + 2] * (1 - alpha) + color[2] * alpha);\n}\n\nfunction distanceSquared(left: [number, number], right: [number, number]): number {\n\treturn (left[0] - right[0]) ** 2 + (left[1] - right[1]) ** 2;\n}\n\nfunction encodeRgbPng(width: number, height: number, pixels: Buffer): Buffer {\n\tif (pixels.length !== width * height * 3) {\n\t\tthrow new Error(`Expected ${width * height * 3} RGB pixels but received ${pixels.length}`);\n\t}\n\n\tconst header = Buffer.alloc(13);\n\theader.writeUInt32BE(width, 0);\n\theader.writeUInt32BE(height, 4);\n\theader[8] = 8;\n\theader[9] = 2;\n\n\tconst rowBytes = width * 3;\n\tconst scanlines = Buffer.alloc((rowBytes + 1) * height);\n\tfor (let y = 0; y < height; y++) {\n\t\tscanlines[y * (rowBytes + 1)] = 0;\n\t\tpixels.copy(scanlines, y * (rowBytes + 1) + 1, y * rowBytes, (y + 1) * rowBytes);\n\t}\n\n\treturn Buffer.concat([\n\t\tPNG_SIGNATURE,\n\t\tpngChunk(\"IHDR\", header),\n\t\tpngChunk(\"IDAT\", deflateSync(scanlines)),\n\t\tpngChunk(\"IEND\", Buffer.alloc(0)),\n\t]);\n}\n\nfunction pngChunk(type: string, data: Buffer): Buffer {\n\tconst typeBuffer = Buffer.from(type, \"ascii\");\n\tconst length = Buffer.alloc(4);\n\tlength.writeUInt32BE(data.length, 0);\n\tconst checksum = Buffer.alloc(4);\n\tchecksum.writeUInt32BE(crc32(Buffer.concat([typeBuffer, data])), 0);\n\treturn Buffer.concat([length, typeBuffer, data, checksum]);\n}\n\nfunction crc32(data: Buffer): number {\n\tlet crc = 0xffffffff;\n\tfor (const byte of data) {\n\t\tcrc = CRC_TABLE[(crc ^ byte) & 0xff] ^ (crc >>> 8);\n\t}\n\treturn (crc ^ 0xffffffff) >>> 0;\n}\n\nfunction createCrcTable(): readonly number[] {\n\treturn Array.from({ length: 256 }, (_, index) => {\n\t\tlet value = index;\n\t\tfor (let bit = 0; bit < 8; bit++) {\n\t\t\tvalue = value & 1 ? 0xedb88320 ^ (value >>> 1) : value >>> 1;\n\t\t}\n\t\treturn value >>> 0;\n\t});\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA4B;AAqE5B,MAAM,gBAAgB,OAAO,KAAK,CAAC,KAAM,IAAM,IAAM,IAAM,IAAM,IAAM,IAAM,EAAI,CAAC;AAClF,MAAM,YAAY,eAAe;AACjC,MAAM,sBAAsB,MAAM;AAClC,MAAM,8BAA8B,MAAM;AAC1C,MAAM,gBAAuB,CAAC,KAAK,KAAK,GAAG;AAC3C,MAAM,aAAoB,CAAC,KAAK,KAAK,GAAG;AACxC,MAAM,aAAoB,CAAC,IAAI,KAAK,GAAG;AACvC,MAAM,iBAAwB,CAAC,IAAI,IAAI,EAAE;AACzC,MAAM,uBAA8B,CAAC,KAAK,KAAK,GAAG;AAClD,MAAM,0BAAiC,CAAC,KAAK,IAAI,GAAG;AACpD,MAAM,uBAAuB;AAC7B,MAAM,kBAAyB,CAAC,KAAK,KAAK,GAAG;AAC7C,MAAM,0BAAiC,CAAC,IAAI,IAAI,GAAG;AACnD,MAAM,kBAAkB;AACxB,MAAM,aAAoB,CAAC,IAAI,IAAI,EAAE;AACrC,MAAM,cA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AK,GAAG,IAAI,WAAW,IAAI,KAAK,QAAQ;AAAA,EAChF;AAEA,SAAO,OAAO,OAAO;AAAA,IACpB;AAAA,IACA,SAAS,QAAQ,MAAM;AAAA,IACvB,SAAS,YAAQ,8BAAY,SAAS,CAAC;AAAA,IACvC,SAAS,QAAQ,OAAO,MAAM,CAAC,CAAC;AAAA,EACjC,CAAC;AACF;AAEA,SAAS,SAAS,MAAc,MAAsB;AACrD,QAAM,aAAa,OAAO,KAAK,MAAM,OAAO;AAC5C,QAAM,SAAS,OAAO,MAAM,CAAC;AAC7B,SAAO,cAAc,KAAK,QAAQ,CAAC;AACnC,QAAM,WAAW,OAAO,MAAM,CAAC;AAC/B,WAAS,cAAc,MAAM,OAAO,OAAO,CAAC,YAAY,IAAI,CAAC,CAAC,GAAG,CAAC;AAClE,SAAO,OAAO,OAAO,CAAC,QAAQ,YAAY,MAAM,QAAQ,CAAC;AAC1D;AAEA,SAAS,MAAM,MAAsB;AACpC,MAAI,MAAM;AACV,aAAW,QAAQ,MAAM;AACxB,UAAM,WAAW,MAAM,QAAQ,GAAI,IAAK,QAAQ;AAAA,EACjD;AACA,UAAQ,MAAM,gBAAgB;AAC/B;AAEA,SAAS,iBAAoC;AAC5C,SAAO,MAAM,KAAK,EAAE,QAAQ,IAAI,GAAG,CAAC,GAAG,UAAU;AAChD,QAAI,QAAQ;AACZ,aAAS,MAAM,GAAG,MAAM,GAAG,OAAO;AACjC,cAAQ,QAAQ,IAAI,aAAc,UAAU,IAAK,UAAU;AAAA,IAC5D;AACA,WAAO,UAAU;AAAA,EAClB,CAAC;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var maintenance_message_exports = {};
20
+ __export(maintenance_message_exports, {
21
+ normalizeMaintenanceHistory20003: () => normalizeMaintenanceHistory20003,
22
+ normalizeMaintenanceMessage20003: () => normalizeMaintenanceMessage20003
23
+ });
24
+ module.exports = __toCommonJS(maintenance_message_exports);
25
+ const MAX_TEXT_LENGTH = 200;
26
+ const MAX_HISTORY_ITEMS = 10;
27
+ function normalizeMaintenanceMessage20003(data) {
28
+ var _a, _b, _c, _d, _e;
29
+ if (data === null || typeof data !== "object" || Array.isArray(data)) {
30
+ return void 0;
31
+ }
32
+ const record = data;
33
+ const nestedMessage = dataRecord(record.msg);
34
+ const code = (_a = numberValue(record.code)) != null ? _a : numberValue(nestedMessage == null ? void 0 : nestedMessage.code);
35
+ const level = numberValue(record.level);
36
+ const title = textValue(record.title);
37
+ const message = (_c = (_b = textValue(nestedMessage == null ? void 0 : nestedMessage.message)) != null ? _b : textValue(record.msg)) != null ? _c : textValue(record.message);
38
+ const eventTime = (_e = (_d = dateValue(record.timestamp)) != null ? _d : dateValue(record.createdDate)) != null ? _e : dateValue(record.lastModifiedDate);
39
+ const details = JSON.stringify({
40
+ infoType: 20003,
41
+ ...code !== void 0 ? { code } : {},
42
+ ...level !== void 0 ? { level } : {},
43
+ ...title !== void 0 ? { title } : {},
44
+ ...message !== void 0 ? { message } : {},
45
+ ...eventTime !== void 0 ? { eventTime } : {}
46
+ });
47
+ if (code === void 0 && level === void 0 && title === void 0 && message === void 0 && eventTime === void 0) {
48
+ return void 0;
49
+ }
50
+ return {
51
+ ...code !== void 0 ? { code } : {},
52
+ ...level !== void 0 ? { level } : {},
53
+ ...title !== void 0 ? { title } : {},
54
+ ...message !== void 0 ? { message } : {},
55
+ ...eventTime !== void 0 ? { eventTime } : {},
56
+ details
57
+ };
58
+ }
59
+ function normalizeMaintenanceHistory20003(data) {
60
+ const record = dataRecord(data);
61
+ const content = Array.isArray(record == null ? void 0 : record.content) ? record.content : void 0;
62
+ if (!content) {
63
+ return void 0;
64
+ }
65
+ const messages = content.slice(0, MAX_HISTORY_ITEMS).map((entry) => normalizeMaintenanceMessage20003(entry)).filter((message) => message !== void 0);
66
+ if (messages.length === 0) {
67
+ return void 0;
68
+ }
69
+ return {
70
+ messages,
71
+ ...optionalNumber(record == null ? void 0 : record.totalElements, "totalElements"),
72
+ ...optionalNumber(record == null ? void 0 : record.totalPages, "totalPages"),
73
+ ...optionalNumber(record == null ? void 0 : record.number, "page"),
74
+ ...optionalNumber(record == null ? void 0 : record.size, "size")
75
+ };
76
+ }
77
+ function dataRecord(value) {
78
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
79
+ }
80
+ function numberValue(value) {
81
+ if (typeof value === "number" && Number.isFinite(value)) {
82
+ return value;
83
+ }
84
+ if (typeof value === "string" && /^\d+$/u.test(value.trim())) {
85
+ const parsed = Number.parseInt(value.trim(), 10);
86
+ return Number.isSafeInteger(parsed) ? parsed : void 0;
87
+ }
88
+ return void 0;
89
+ }
90
+ function textValue(value) {
91
+ if (typeof value !== "string") {
92
+ return void 0;
93
+ }
94
+ const trimmed = value.trim();
95
+ if (trimmed.length === 0) {
96
+ return void 0;
97
+ }
98
+ return redactText(trimmed).slice(0, MAX_TEXT_LENGTH);
99
+ }
100
+ function redactText(value) {
101
+ return value.replace(/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/gu, "<redacted-email>").replace(/\b\d{1,3}(?:\.\d{1,3}){3}(?::\d{1,5})?\b/gu, "<redacted-address>");
102
+ }
103
+ function dateValue(value) {
104
+ if (typeof value === "number" && Number.isFinite(value)) {
105
+ const millis = value > 1e10 ? value : value * 1e3;
106
+ const date = new Date(millis);
107
+ return Number.isFinite(date.getTime()) ? date.toISOString() : void 0;
108
+ }
109
+ if (typeof value === "string") {
110
+ const trimmed = value.trim();
111
+ if (trimmed.length === 0) {
112
+ return void 0;
113
+ }
114
+ const date = new Date(trimmed);
115
+ return Number.isFinite(date.getTime()) ? date.toISOString() : void 0;
116
+ }
117
+ return void 0;
118
+ }
119
+ function optionalNumber(value, key) {
120
+ const number = numberValue(value);
121
+ return number === void 0 ? {} : { [key]: number };
122
+ }
123
+ // Annotate the CommonJS export names for ESM import in node:
124
+ 0 && (module.exports = {
125
+ normalizeMaintenanceHistory20003,
126
+ normalizeMaintenanceMessage20003
127
+ });
128
+ //# sourceMappingURL=maintenance-message.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/domain/maintenance-message.ts"],
4
+ "sourcesContent": ["export interface MaintenanceMessage {\n\tcode?: number;\n\tlevel?: number;\n\ttitle?: string;\n\tmessage?: string;\n\teventTime?: string;\n\tdetails: string;\n}\n\nexport interface MaintenanceHistory {\n\tmessages: MaintenanceMessage[];\n\ttotalElements?: number;\n\ttotalPages?: number;\n\tpage?: number;\n\tsize?: number;\n}\n\nconst MAX_TEXT_LENGTH = 200;\nconst MAX_HISTORY_ITEMS = 10;\n\nexport function normalizeMaintenanceMessage20003(data: unknown): MaintenanceMessage | undefined {\n\tif (data === null || typeof data !== \"object\" || Array.isArray(data)) {\n\t\treturn undefined;\n\t}\n\n\tconst record = data as Record<string, unknown>;\n\tconst nestedMessage = dataRecord(record.msg);\n\tconst code = numberValue(record.code) ?? numberValue(nestedMessage?.code);\n\tconst level = numberValue(record.level);\n\tconst title = textValue(record.title);\n\tconst message = textValue(nestedMessage?.message) ?? textValue(record.msg) ?? textValue(record.message);\n\tconst eventTime =\n\t\tdateValue(record.timestamp) ?? dateValue(record.createdDate) ?? dateValue(record.lastModifiedDate);\n\tconst details = JSON.stringify({\n\t\tinfoType: 20003,\n\t\t...(code !== undefined ? { code } : {}),\n\t\t...(level !== undefined ? { level } : {}),\n\t\t...(title !== undefined ? { title } : {}),\n\t\t...(message !== undefined ? { message } : {}),\n\t\t...(eventTime !== undefined ? { eventTime } : {}),\n\t});\n\n\tif (\n\t\tcode === undefined &&\n\t\tlevel === undefined &&\n\t\ttitle === undefined &&\n\t\tmessage === undefined &&\n\t\teventTime === undefined\n\t) {\n\t\treturn undefined;\n\t}\n\n\treturn {\n\t\t...(code !== undefined ? { code } : {}),\n\t\t...(level !== undefined ? { level } : {}),\n\t\t...(title !== undefined ? { title } : {}),\n\t\t...(message !== undefined ? { message } : {}),\n\t\t...(eventTime !== undefined ? { eventTime } : {}),\n\t\tdetails,\n\t};\n}\n\nexport function normalizeMaintenanceHistory20003(data: unknown): MaintenanceHistory | undefined {\n\tconst record = dataRecord(data);\n\tconst content = Array.isArray(record?.content) ? record.content : undefined;\n\tif (!content) {\n\t\treturn undefined;\n\t}\n\n\tconst messages = content\n\t\t.slice(0, MAX_HISTORY_ITEMS)\n\t\t.map(entry => normalizeMaintenanceMessage20003(entry))\n\t\t.filter((message): message is MaintenanceMessage => message !== undefined);\n\n\tif (messages.length === 0) {\n\t\treturn undefined;\n\t}\n\n\treturn {\n\t\tmessages,\n\t\t...optionalNumber(record?.totalElements, \"totalElements\"),\n\t\t...optionalNumber(record?.totalPages, \"totalPages\"),\n\t\t...optionalNumber(record?.number, \"page\"),\n\t\t...optionalNumber(record?.size, \"size\"),\n\t};\n}\n\nfunction dataRecord(value: unknown): Record<string, unknown> | undefined {\n\treturn value !== null && typeof value === \"object\" && !Array.isArray(value)\n\t\t? (value as Record<string, unknown>)\n\t\t: undefined;\n}\n\nfunction numberValue(value: unknown): number | undefined {\n\tif (typeof value === \"number\" && Number.isFinite(value)) {\n\t\treturn value;\n\t}\n\tif (typeof value === \"string\" && /^\\d+$/u.test(value.trim())) {\n\t\tconst parsed = Number.parseInt(value.trim(), 10);\n\t\treturn Number.isSafeInteger(parsed) ? parsed : undefined;\n\t}\n\treturn undefined;\n}\n\nfunction textValue(value: unknown): string | undefined {\n\tif (typeof value !== \"string\") {\n\t\treturn undefined;\n\t}\n\tconst trimmed = value.trim();\n\tif (trimmed.length === 0) {\n\t\treturn undefined;\n\t}\n\treturn redactText(trimmed).slice(0, MAX_TEXT_LENGTH);\n}\n\nfunction redactText(value: string): string {\n\treturn value\n\t\t.replace(/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}/gu, \"<redacted-email>\")\n\t\t.replace(/\\b\\d{1,3}(?:\\.\\d{1,3}){3}(?::\\d{1,5})?\\b/gu, \"<redacted-address>\");\n}\n\nfunction dateValue(value: unknown): string | undefined {\n\tif (typeof value === \"number\" && Number.isFinite(value)) {\n\t\tconst millis = value > 10_000_000_000 ? value : value * 1_000;\n\t\tconst date = new Date(millis);\n\t\treturn Number.isFinite(date.getTime()) ? date.toISOString() : undefined;\n\t}\n\tif (typeof value === \"string\") {\n\t\tconst trimmed = value.trim();\n\t\tif (trimmed.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst date = new Date(trimmed);\n\t\treturn Number.isFinite(date.getTime()) ? date.toISOString() : undefined;\n\t}\n\treturn undefined;\n}\n\nfunction optionalNumber<T extends string>(value: unknown, key: T): Partial<Record<T, number>> {\n\tconst number = numberValue(value);\n\treturn number === undefined ? {} : ({ [key]: number } as Partial<Record<T, number>>);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBA,MAAM,kBAAkB;AACxB,MAAM,oBAAoB;AAEnB,SAAS,iCAAiC,MAA+C;AApBhG;AAqBC,MAAI,SAAS,QAAQ,OAAO,SAAS,YAAY,MAAM,QAAQ,IAAI,GAAG;AACrE,WAAO;AAAA,EACR;AAEA,QAAM,SAAS;AACf,QAAM,gBAA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,SAAS,KAAK,GAAG;AACxD,UAAM,SAAS,QAAQ,OAAiB,QAAQ,QAAQ;AACxD,UAAM,OAAO,IAAI,KAAK,MAAM;AAC5B,WAAO,OAAO,SAAS,KAAK,QAAQ,CAAC,IAAI,KAAK,YAAY,IAAI;AAAA,EAC/D;AACA,MAAI,OAAO,UAAU,UAAU;AAC9B,UAAM,UAAU,MAAM,KAAK;AAC3B,QAAI,QAAQ,WAAW,GAAG;AACzB,aAAO;AAAA,IACR;AACA,UAAM,OAAO,IAAI,KAAK,OAAO;AAC7B,WAAO,OAAO,SAAS,KAAK,QAAQ,CAAC,IAAI,KAAK,YAAY,IAAI;AAAA,EAC/D;AACA,SAAO;AACR;AAEA,SAAS,eAAiC,OAAgB,KAAoC;AAC7F,QAAM,SAAS,YAAY,KAAK;AAChC,SAAO,WAAW,SAAY,CAAC,IAAK,EAAE,CAAC,GAAG,GAAG,OAAO;AACrD;",
6
+ "names": []
7
+ }
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var map_exports = {};
20
+ __export(map_exports, {
21
+ normalizeMap20002: () => normalizeMap20002
22
+ });
23
+ module.exports = __toCommonJS(map_exports);
24
+ function normalizeMap20002(data) {
25
+ if (data === null || typeof data !== "object" || Array.isArray(data)) {
26
+ return void 0;
27
+ }
28
+ const record = data;
29
+ const metadata = {
30
+ available: typeof record.map === "string" && record.map.length > 0
31
+ };
32
+ copyNumber(record, metadata, "mapId", "mapId");
33
+ copyNumber(record, metadata, "pathId", "pathId");
34
+ copyNumber(record, metadata, "width", "width");
35
+ copyNumber(record, metadata, "height", "height");
36
+ copyNumber(record, metadata, "resolution", "resolution");
37
+ copyNumber(record, metadata, "lz4_len", "compressedBytes");
38
+ if (Array.isArray(record.area)) {
39
+ metadata.areaCount = record.area.length;
40
+ }
41
+ if (typeof record.map === "string") {
42
+ metadata.encodedBytes = Buffer.byteLength(record.map, "utf8");
43
+ }
44
+ return hasUsefulMapMetadata(metadata) ? metadata : void 0;
45
+ }
46
+ function hasUsefulMapMetadata(metadata) {
47
+ return metadata.available || metadata.mapId !== void 0 || metadata.pathId !== void 0 || metadata.width !== void 0 || metadata.height !== void 0 || metadata.resolution !== void 0 || metadata.areaCount !== void 0 || metadata.compressedBytes !== void 0 || metadata.encodedBytes !== void 0;
48
+ }
49
+ function copyNumber(source, target, sourceKey, targetKey) {
50
+ if (typeof source[sourceKey] === "number") {
51
+ Object.assign(target, { [targetKey]: source[sourceKey] });
52
+ }
53
+ }
54
+ // Annotate the CommonJS export names for ESM import in node:
55
+ 0 && (module.exports = {
56
+ normalizeMap20002
57
+ });
58
+ //# sourceMappingURL=map.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/domain/map.ts"],
4
+ "sourcesContent": ["export interface MapMetadata {\n\tavailable: boolean;\n\tmapId?: number;\n\tpathId?: number;\n\twidth?: number;\n\theight?: number;\n\tresolution?: number;\n\tareaCount?: number;\n\tcompressedBytes?: number;\n\tencodedBytes?: number;\n}\n\nexport function normalizeMap20002(data: unknown): MapMetadata | undefined {\n\tif (data === null || typeof data !== \"object\" || Array.isArray(data)) {\n\t\treturn undefined;\n\t}\n\n\tconst record = data as Record<string, unknown>;\n\tconst metadata: MapMetadata = {\n\t\tavailable: typeof record.map === \"string\" && record.map.length > 0,\n\t};\n\n\tcopyNumber(record, metadata, \"mapId\", \"mapId\");\n\tcopyNumber(record, metadata, \"pathId\", \"pathId\");\n\tcopyNumber(record, metadata, \"width\", \"width\");\n\tcopyNumber(record, metadata, \"height\", \"height\");\n\tcopyNumber(record, metadata, \"resolution\", \"resolution\");\n\tcopyNumber(record, metadata, \"lz4_len\", \"compressedBytes\");\n\n\tif (Array.isArray(record.area)) {\n\t\tmetadata.areaCount = record.area.length;\n\t}\n\tif (typeof record.map === \"string\") {\n\t\tmetadata.encodedBytes = Buffer.byteLength(record.map, \"utf8\");\n\t}\n\n\treturn hasUsefulMapMetadata(metadata) ? metadata : undefined;\n}\n\nfunction hasUsefulMapMetadata(metadata: MapMetadata): boolean {\n\treturn (\n\t\tmetadata.available ||\n\t\tmetadata.mapId !== undefined ||\n\t\tmetadata.pathId !== undefined ||\n\t\tmetadata.width !== undefined ||\n\t\tmetadata.height !== undefined ||\n\t\tmetadata.resolution !== undefined ||\n\t\tmetadata.areaCount !== undefined ||\n\t\tmetadata.compressedBytes !== undefined ||\n\t\tmetadata.encodedBytes !== undefined\n\t);\n}\n\nfunction copyNumber<T extends object>(\n\tsource: Record<string, unknown>,\n\ttarget: T,\n\tsourceKey: string,\n\ttargetKey: keyof T & string,\n): void {\n\tif (typeof source[sourceKey] === \"number\") {\n\t\tObject.assign(target, { [targetKey]: source[sourceKey] });\n\t}\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAYO,SAAS,kBAAkB,MAAwC;AACzE,MAAI,SAAS,QAAQ,OAAO,SAAS,YAAY,MAAM,QAAQ,IAAI,GAAG;AACrE,WAAO;AAAA,EACR;AAEA,QAAM,SAAS;AACf,QAAM,WAAwB;AAAA,IAC7B,WAAW,OAAO,OAAO,QAAQ,YAAY,OAAO,IAAI,SAAS;AAAA,EAClE;AAEA,aAAW,QAAQ,UAAU,SAAS,OAAO;AAC7C,aAAW,QAAQ,UAAU,UAAU,QAAQ;AAC/C,aAAW,QAAQ,UAAU,SAAS,OAAO;AAC7C,aAAW,QAAQ,UAAU,UAAU,QAAQ;AAC/C,aAAW,QAAQ,UAAU,cAAc,YAAY;AACvD,aAAW,QAAQ,UAAU,WAAW,iBAAiB;AAEzD,MAAI,MAAM,QAAQ,OAAO,IAAI,GAAG;AAC/B,aAAS,YAAY,OAAO,KAAK;AAAA,EAClC;AACA,MAAI,OAAO,OAAO,QAAQ,UAAU;AACnC,aAAS,eAAe,OAAO,WAAW,OAAO,KAAK,MAAM;AAAA,EAC7D;AAEA,SAAO,qBAAqB,QAAQ,IAAI,WAAW;AACpD;AAEA,SAAS,qBAAqB,UAAgC;AAC7D,SACC,SAAS,aACT,SAAS,UAAU,UACnB,SAAS,WAAW,UACpB,SAAS,UAAU,UACnB,SAAS,WAAW,UACpB,SAAS,eAAe,UACxB,SAAS,cAAc,UACvB,SAAS,oBAAoB,UAC7B,SAAS,iBAAiB;AAE5B;AAEA,SAAS,WACR,QACA,QACA,WACA,WACO;AACP,MAAI,OAAO,OAAO,SAAS,MAAM,UAAU;AAC1C,WAAO,OAAO,QAAQ,EAAE,CAAC,SAAS,GAAG,OAAO,SAAS,EAAE,CAAC;AAAA,EACzD;AACD;",
6
+ "names": []
7
+ }
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var reconnect_policy_exports = {};
20
+ __export(reconnect_policy_exports, {
21
+ DEFAULT_RECONNECT_DELAY_OPTIONS: () => DEFAULT_RECONNECT_DELAY_OPTIONS,
22
+ reconnectDelayMs: () => reconnectDelayMs
23
+ });
24
+ module.exports = __toCommonJS(reconnect_policy_exports);
25
+ const DEFAULT_RECONNECT_DELAY_OPTIONS = {
26
+ initialDelayMs: 5e3,
27
+ maxDelayMs: 6e4,
28
+ factor: 2
29
+ };
30
+ function reconnectDelayMs(attempt, options = DEFAULT_RECONNECT_DELAY_OPTIONS) {
31
+ if (!Number.isSafeInteger(attempt) || attempt < 1) {
32
+ throw new Error("Reconnect attempt must be a positive safe integer");
33
+ }
34
+ if (options.initialDelayMs < 1 || options.maxDelayMs < options.initialDelayMs || options.factor < 1) {
35
+ throw new Error("Invalid reconnect delay options");
36
+ }
37
+ const exponentialDelay = options.initialDelayMs * Math.pow(options.factor, attempt - 1);
38
+ return Math.min(exponentialDelay, options.maxDelayMs);
39
+ }
40
+ // Annotate the CommonJS export names for ESM import in node:
41
+ 0 && (module.exports = {
42
+ DEFAULT_RECONNECT_DELAY_OPTIONS,
43
+ reconnectDelayMs
44
+ });
45
+ //# sourceMappingURL=reconnect-policy.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/domain/reconnect-policy.ts"],
4
+ "sourcesContent": ["export interface ReconnectDelayOptions {\n\tinitialDelayMs: number;\n\tmaxDelayMs: number;\n\tfactor: number;\n}\n\nexport const DEFAULT_RECONNECT_DELAY_OPTIONS: ReconnectDelayOptions = {\n\tinitialDelayMs: 5_000,\n\tmaxDelayMs: 60_000,\n\tfactor: 2,\n};\n\nexport function reconnectDelayMs(\n\tattempt: number,\n\toptions: ReconnectDelayOptions = DEFAULT_RECONNECT_DELAY_OPTIONS,\n): number {\n\tif (!Number.isSafeInteger(attempt) || attempt < 1) {\n\t\tthrow new Error(\"Reconnect attempt must be a positive safe integer\");\n\t}\n\tif (options.initialDelayMs < 1 || options.maxDelayMs < options.initialDelayMs || options.factor < 1) {\n\t\tthrow new Error(\"Invalid reconnect delay options\");\n\t}\n\n\tconst exponentialDelay = options.initialDelayMs * Math.pow(options.factor, attempt - 1);\n\treturn Math.min(exponentialDelay, options.maxDelayMs);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMO,MAAM,kCAAyD;AAAA,EACrE,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,QAAQ;AACT;AAEO,SAAS,iBACf,SACA,UAAiC,iCACxB;AACT,MAAI,CAAC,OAAO,cAAc,OAAO,KAAK,UAAU,GAAG;AAClD,UAAM,IAAI,MAAM,mDAAmD;AAAA,EACpE;AACA,MAAI,QAAQ,iBAAiB,KAAK,QAAQ,aAAa,QAAQ,kBAAkB,QAAQ,SAAS,GAAG;AACpG,UAAM,IAAI,MAAM,iCAAiC;AAAA,EAClD;AAEA,QAAM,mBAAmB,QAAQ,iBAAiB,KAAK,IAAI,QAAQ,QAAQ,UAAU,CAAC;AACtF,SAAO,KAAK,IAAI,kBAAkB,QAAQ,UAAU;AACrD;",
6
+ "names": []
7
+ }
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var status_exports = {};
20
+ __export(status_exports, {
21
+ normalizeStatus20001: () => normalizeStatus20001
22
+ });
23
+ module.exports = __toCommonJS(status_exports);
24
+ function normalizeStatus20001(data) {
25
+ if (data === null || typeof data !== "object" || Array.isArray(data)) {
26
+ return void 0;
27
+ }
28
+ const record = data;
29
+ const status = {};
30
+ copyString(record, status, "mode", "mode");
31
+ copyString(record, status, "subMode", "subMode");
32
+ copyNumber(record, status, "cleanArea", "cleanArea");
33
+ copyNumber(record, status, "cleanTime", "cleanTime");
34
+ copyNumber(record, status, "allArea", "totalArea");
35
+ copyNumber(record, status, "allTime", "totalTime");
36
+ copyNumber(record, status, "elec", "batteryPercent");
37
+ copyNumber(record, status, "elecReal", "batteryRawPercent");
38
+ copyNumber(record, status, "water", "waterLevel");
39
+ copyNumber(record, status, "mop", "mopMode");
40
+ copyString(record, status, "workNoisy", "fanMode");
41
+ copyBoolean(record, status, "autoBoost", "autoBoost");
42
+ copyBoolean(record, status, "cleanComponents", "cleanComponents");
43
+ if (Array.isArray(record.errorState)) {
44
+ status.errorRawCount = record.errorState.length;
45
+ status.maintenanceWarningCount = record.errorState.length;
46
+ status.maintenanceWarning = record.errorState.length > 0;
47
+ status.maintenanceMessage = record.errorState.length > 0 ? "Maintenance warning reported by robot" : "";
48
+ status.maintenanceDetails = summarizeErrorState(record.errorState);
49
+ }
50
+ return Object.keys(status).length > 0 ? status : void 0;
51
+ }
52
+ function summarizeErrorState(errorState) {
53
+ if (errorState.length === 0) {
54
+ return "";
55
+ }
56
+ return JSON.stringify(
57
+ errorState.slice(0, 5).map((entry, index) => ({
58
+ index,
59
+ ...summarizeErrorEntry(entry)
60
+ }))
61
+ );
62
+ }
63
+ function summarizeErrorEntry(entry) {
64
+ if (entry === null || typeof entry !== "object" || Array.isArray(entry)) {
65
+ return {
66
+ type: typeof entry
67
+ };
68
+ }
69
+ const record = entry;
70
+ const keys = Object.keys(record).filter((key) => !isSensitiveDiagnosticKey(key)).sort();
71
+ const values = {};
72
+ for (const key of keys) {
73
+ const value = record[key];
74
+ if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
75
+ values[key] = typeof value === "string" ? redactDiagnosticString(value) : value;
76
+ }
77
+ }
78
+ return {
79
+ keys,
80
+ values
81
+ };
82
+ }
83
+ function isSensitiveDiagnosticKey(key) {
84
+ return /(?:sn|serial|token|password|pwd|username|email|map|pos|position|path|addr|ip|host)/iu.test(key);
85
+ }
86
+ function redactDiagnosticString(value) {
87
+ return value.replace(/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/gu, "<redacted-email>").replace(/\b\d{1,3}(?:\.\d{1,3}){3}(?::\d{1,5})?\b/gu, "<redacted-address>");
88
+ }
89
+ function copyNumber(source, target, sourceKey, targetKey) {
90
+ if (typeof source[sourceKey] === "number") {
91
+ Object.assign(target, { [targetKey]: source[sourceKey] });
92
+ }
93
+ }
94
+ function copyString(source, target, sourceKey, targetKey) {
95
+ if (typeof source[sourceKey] === "string") {
96
+ Object.assign(target, { [targetKey]: source[sourceKey] });
97
+ }
98
+ }
99
+ function copyBoolean(source, target, sourceKey, targetKey) {
100
+ if (typeof source[sourceKey] === "boolean") {
101
+ Object.assign(target, { [targetKey]: source[sourceKey] });
102
+ }
103
+ }
104
+ // Annotate the CommonJS export names for ESM import in node:
105
+ 0 && (module.exports = {
106
+ normalizeStatus20001
107
+ });
108
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/domain/status.ts"],
4
+ "sourcesContent": ["export interface RobotStatus {\n\tmode?: string;\n\tsubMode?: string;\n\tcleanArea?: number;\n\tcleanTime?: number;\n\ttotalArea?: number;\n\ttotalTime?: number;\n\tbatteryPercent?: number;\n\tbatteryRawPercent?: number;\n\twaterLevel?: number;\n\tmopMode?: number;\n\tfanMode?: string;\n\terrorRawCount?: number;\n\tmaintenanceWarning?: boolean;\n\tmaintenanceWarningCount?: number;\n\tmaintenanceMessage?: string;\n\tmaintenanceDetails?: string;\n\tautoBoost?: boolean;\n\tcleanComponents?: boolean;\n}\n\nexport function normalizeStatus20001(data: unknown): RobotStatus | undefined {\n\tif (data === null || typeof data !== \"object\" || Array.isArray(data)) {\n\t\treturn undefined;\n\t}\n\n\tconst record = data as Record<string, unknown>;\n\tconst status: RobotStatus = {};\n\n\tcopyString(record, status, \"mode\", \"mode\");\n\tcopyString(record, status, \"subMode\", \"subMode\");\n\tcopyNumber(record, status, \"cleanArea\", \"cleanArea\");\n\tcopyNumber(record, status, \"cleanTime\", \"cleanTime\");\n\tcopyNumber(record, status, \"allArea\", \"totalArea\");\n\tcopyNumber(record, status, \"allTime\", \"totalTime\");\n\tcopyNumber(record, status, \"elec\", \"batteryPercent\");\n\tcopyNumber(record, status, \"elecReal\", \"batteryRawPercent\");\n\tcopyNumber(record, status, \"water\", \"waterLevel\");\n\tcopyNumber(record, status, \"mop\", \"mopMode\");\n\tcopyString(record, status, \"workNoisy\", \"fanMode\");\n\tcopyBoolean(record, status, \"autoBoost\", \"autoBoost\");\n\tcopyBoolean(record, status, \"cleanComponents\", \"cleanComponents\");\n\n\tif (Array.isArray(record.errorState)) {\n\t\tstatus.errorRawCount = record.errorState.length;\n\t\tstatus.maintenanceWarningCount = record.errorState.length;\n\t\tstatus.maintenanceWarning = record.errorState.length > 0;\n\t\tstatus.maintenanceMessage = record.errorState.length > 0 ? \"Maintenance warning reported by robot\" : \"\";\n\t\tstatus.maintenanceDetails = summarizeErrorState(record.errorState);\n\t}\n\n\treturn Object.keys(status).length > 0 ? status : undefined;\n}\n\nfunction summarizeErrorState(errorState: unknown[]): string {\n\tif (errorState.length === 0) {\n\t\treturn \"\";\n\t}\n\n\treturn JSON.stringify(\n\t\terrorState.slice(0, 5).map((entry, index) => ({\n\t\t\tindex,\n\t\t\t...summarizeErrorEntry(entry),\n\t\t})),\n\t);\n}\n\nfunction summarizeErrorEntry(entry: unknown): Record<string, unknown> {\n\tif (entry === null || typeof entry !== \"object\" || Array.isArray(entry)) {\n\t\treturn {\n\t\t\ttype: typeof entry,\n\t\t};\n\t}\n\n\tconst record = entry as Record<string, unknown>;\n\tconst keys = Object.keys(record)\n\t\t.filter(key => !isSensitiveDiagnosticKey(key))\n\t\t.sort();\n\tconst values: Record<string, string | number | boolean | null> = {};\n\n\tfor (const key of keys) {\n\t\tconst value = record[key];\n\t\tif (value === null || typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\") {\n\t\t\tvalues[key] = typeof value === \"string\" ? redactDiagnosticString(value) : value;\n\t\t}\n\t}\n\n\treturn {\n\t\tkeys,\n\t\tvalues,\n\t};\n}\n\nfunction isSensitiveDiagnosticKey(key: string): boolean {\n\treturn /(?:sn|serial|token|password|pwd|username|email|map|pos|position|path|addr|ip|host)/iu.test(key);\n}\n\nfunction redactDiagnosticString(value: string): string {\n\treturn value\n\t\t.replace(/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}/gu, \"<redacted-email>\")\n\t\t.replace(/\\b\\d{1,3}(?:\\.\\d{1,3}){3}(?::\\d{1,5})?\\b/gu, \"<redacted-address>\");\n}\n\nfunction copyNumber<T extends object>(\n\tsource: Record<string, unknown>,\n\ttarget: T,\n\tsourceKey: string,\n\ttargetKey: keyof T & string,\n): void {\n\tif (typeof source[sourceKey] === \"number\") {\n\t\tObject.assign(target, { [targetKey]: source[sourceKey] });\n\t}\n}\n\nfunction copyString<T extends object>(\n\tsource: Record<string, unknown>,\n\ttarget: T,\n\tsourceKey: string,\n\ttargetKey: keyof T & string,\n): void {\n\tif (typeof source[sourceKey] === \"string\") {\n\t\tObject.assign(target, { [targetKey]: source[sourceKey] });\n\t}\n}\n\nfunction copyBoolean<T extends object>(\n\tsource: Record<string, unknown>,\n\ttarget: T,\n\tsourceKey: string,\n\ttargetKey: keyof T & string,\n): void {\n\tif (typeof source[sourceKey] === \"boolean\") {\n\t\tObject.assign(target, { [targetKey]: source[sourceKey] });\n\t}\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAqBO,SAAS,qBAAqB,MAAwC;AAC5E,MAAI,SAAS,QAAQ,OAAO,SAAS,YAAY,MAAM,QAAQ,IAAI,GAAG;AACrE,WAAO;AAAA,EACR;AAEA,QAAM,SAAS;AACf,QAAM,SAAsB,CAAC;AAE7B,aAAW,QAAQ,QAAQ,QAAQ,MAAM;AACzC,aAAW,QAAQ,QAAQ,WAAW,SAAS;AAC/C,aAAW,QAAQ,QAAQ,aAAa,WAAW;AACnD,aAAW,QAAQ,QAAQ,aAAa,WAAW;AACnD,aAAW,QAAQ,QAAQ,WAAW,WAAW;AACjD,aAAW,QAAQ,QAAQ,WAAW,WAAW;AACjD,aAAW,QAAQ,QAAQ,QAAQ,gBAAgB;AACnD,aAAW,QAAQ,QAAQ,YAAY,mBAAmB;AAC1D,aAAW,QAAQ,QAAQ,SAAS,YAAY;AAChD,aAAW,QAAQ,QAAQ,OAAO,SAAS;AAC3C,aAAW,QAAQ,QAAQ,aAAa,SAAS;AACjD,cAAY,QAAQ,QAAQ,aAAa,WAAW;AACpD,cAAY,QAAQ,QAAQ,mBAAmB,iBAAiB;AAEhE,MAAI,MAAM,QAAQ,OAAO,UAAU,GAAG;AACrC,WAAO,gBAAgB,OAAO,WAAW;AACzC,WAAO,0BAA0B,OAAO,WAAW;AACnD,WAAO,qBAAqB,OAAO,WAAW,SAAS;AACvD,WAAO,qBAAqB,OAAO,WAAW,SAAS,IAAI,0CAA0C;AACrG,WAAO,qBAAqB,oBAAoB,OAAO,UAAU;AAAA,EAClE;AAEA,SAAO,OAAO,KAAK,MAAM,EAAE,SAAS,IAAI,SAAS;AAClD;AAEA,SAAS,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