@mentra/engine 0.1.0-beta.0 → 0.1.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (355) hide show
  1. package/README.md +42 -1
  2. package/build/engine.d.ts +11 -3
  3. package/build/engine.d.ts.map +1 -1
  4. package/build/engine.js +7 -2
  5. package/build/engine.js.map +1 -1
  6. package/build/facades/dev.d.ts.map +1 -1
  7. package/build/facades/dev.js +9 -5
  8. package/build/facades/dev.js.map +1 -1
  9. package/build/facades/gallery.js +1 -1
  10. package/build/facades/gallery.js.map +1 -1
  11. package/build/facades/glasses.d.ts +1 -0
  12. package/build/facades/glasses.d.ts.map +1 -1
  13. package/build/facades/glasses.js +19 -4
  14. package/build/facades/glasses.js.map +1 -1
  15. package/build/facades/glassesSettings.d.ts.map +1 -1
  16. package/build/facades/glassesSettings.js +1 -0
  17. package/build/facades/glassesSettings.js.map +1 -1
  18. package/build/facades/miniapps.d.ts +4 -0
  19. package/build/facades/miniapps.d.ts.map +1 -1
  20. package/build/facades/miniapps.js +5 -0
  21. package/build/facades/miniapps.js.map +1 -1
  22. package/build/facades/ota.d.ts +11 -2
  23. package/build/facades/ota.d.ts.map +1 -1
  24. package/build/facades/ota.js +19 -4
  25. package/build/facades/ota.js.map +1 -1
  26. package/build/facades/pairing.d.ts +4 -0
  27. package/build/facades/pairing.d.ts.map +1 -1
  28. package/build/facades/pairing.js +10 -8
  29. package/build/facades/pairing.js.map +1 -1
  30. package/build/facades/phoneNotifications.d.ts +0 -4
  31. package/build/facades/phoneNotifications.d.ts.map +1 -1
  32. package/build/facades/phoneNotifications.js +4 -14
  33. package/build/facades/phoneNotifications.js.map +1 -1
  34. package/build/index.d.ts +6 -3
  35. package/build/index.d.ts.map +1 -1
  36. package/build/index.js +4 -2
  37. package/build/index.js.map +1 -1
  38. package/build/internal.d.ts +2 -2
  39. package/build/internal.d.ts.map +1 -1
  40. package/build/internal.js +1 -1
  41. package/build/internal.js.map +1 -1
  42. package/build/react/MentraLiveOtaFlow.d.ts +38 -0
  43. package/build/react/MentraLiveOtaFlow.d.ts.map +1 -0
  44. package/build/react/MentraLiveOtaFlow.js +528 -0
  45. package/build/react/MentraLiveOtaFlow.js.map +1 -0
  46. package/build/react/index.d.ts +2 -0
  47. package/build/react/index.d.ts.map +1 -0
  48. package/build/react/index.js +2 -0
  49. package/build/react/index.js.map +1 -0
  50. package/build/react/useEngineSnapshot.d.ts +2 -0
  51. package/build/react/useEngineSnapshot.d.ts.map +1 -0
  52. package/build/react/useEngineSnapshot.js +14 -0
  53. package/build/react/useEngineSnapshot.js.map +1 -0
  54. package/build/runtime/bootstrap.d.ts +24 -1
  55. package/build/runtime/bootstrap.d.ts.map +1 -1
  56. package/build/runtime/bootstrap.js +17 -0
  57. package/build/runtime/bootstrap.js.map +1 -1
  58. package/build/runtime/scanQrSeam.d.ts +7 -0
  59. package/build/runtime/scanQrSeam.d.ts.map +1 -0
  60. package/build/runtime/scanQrSeam.js +16 -0
  61. package/build/runtime/scanQrSeam.js.map +1 -0
  62. package/build/services/AppRegistry.d.ts +18 -8
  63. package/build/services/AppRegistry.d.ts.map +1 -1
  64. package/build/services/AppRegistry.js +44 -45
  65. package/build/services/AppRegistry.js.map +1 -1
  66. package/build/services/AudioCloudUplink.d.ts +9 -3
  67. package/build/services/AudioCloudUplink.d.ts.map +1 -1
  68. package/build/services/AudioCloudUplink.js +9 -3
  69. package/build/services/AudioCloudUplink.js.map +1 -1
  70. package/build/services/AudioPlaybackService.d.ts +9 -1
  71. package/build/services/AudioPlaybackService.d.ts.map +1 -1
  72. package/build/services/AudioPlaybackService.js +77 -32
  73. package/build/services/AudioPlaybackService.js.map +1 -1
  74. package/build/services/BlobStore.d.ts +2 -1
  75. package/build/services/BlobStore.d.ts.map +1 -1
  76. package/build/services/BlobStore.js +17 -9
  77. package/build/services/BlobStore.js.map +1 -1
  78. package/build/services/CloudAudioSubscriptionSync.d.ts.map +1 -1
  79. package/build/services/CloudAudioSubscriptionSync.js +13 -1
  80. package/build/services/CloudAudioSubscriptionSync.js.map +1 -1
  81. package/build/services/CloudClientService.d.ts +15 -0
  82. package/build/services/CloudClientService.d.ts.map +1 -1
  83. package/build/services/CloudClientService.js +75 -0
  84. package/build/services/CloudClientService.js.map +1 -1
  85. package/build/services/ForegroundLocationPermission.d.ts +13 -0
  86. package/build/services/ForegroundLocationPermission.d.ts.map +1 -0
  87. package/build/services/ForegroundLocationPermission.js +12 -0
  88. package/build/services/ForegroundLocationPermission.js.map +1 -0
  89. package/build/services/GlassesSettingsSync.d.ts.map +1 -1
  90. package/build/services/GlassesSettingsSync.js +9 -3
  91. package/build/services/GlassesSettingsSync.js.map +1 -1
  92. package/build/services/GlassesStatusProjection.d.ts +2 -1
  93. package/build/services/GlassesStatusProjection.d.ts.map +1 -1
  94. package/build/services/GlassesStatusProjection.js +15 -8
  95. package/build/services/GlassesStatusProjection.js.map +1 -1
  96. package/build/services/HotspotOtaTransport.d.ts +29 -0
  97. package/build/services/HotspotOtaTransport.d.ts.map +1 -0
  98. package/build/services/HotspotOtaTransport.js +146 -0
  99. package/build/services/HotspotOtaTransport.js.map +1 -0
  100. package/build/services/HotspotShutdown.d.ts +17 -0
  101. package/build/services/HotspotShutdown.d.ts.map +1 -0
  102. package/build/services/HotspotShutdown.js +29 -0
  103. package/build/services/HotspotShutdown.js.map +1 -0
  104. package/build/services/LocalDisplayManager.d.ts +15 -0
  105. package/build/services/LocalDisplayManager.d.ts.map +1 -1
  106. package/build/services/LocalDisplayManager.js +106 -20
  107. package/build/services/LocalDisplayManager.js.map +1 -1
  108. package/build/services/LocalMiniappRuntime.d.ts +67 -1
  109. package/build/services/LocalMiniappRuntime.d.ts.map +1 -1
  110. package/build/services/LocalMiniappRuntime.js +486 -126
  111. package/build/services/LocalMiniappRuntime.js.map +1 -1
  112. package/build/services/LocalMiniappStorage.d.ts +32 -0
  113. package/build/services/LocalMiniappStorage.d.ts.map +1 -0
  114. package/build/services/LocalMiniappStorage.js +66 -0
  115. package/build/services/LocalMiniappStorage.js.map +1 -0
  116. package/build/services/LocalMiniappUserIdentity.d.ts +20 -0
  117. package/build/services/LocalMiniappUserIdentity.d.ts.map +1 -0
  118. package/build/services/LocalMiniappUserIdentity.js +43 -0
  119. package/build/services/LocalMiniappUserIdentity.js.map +1 -0
  120. package/build/services/MicStateCoordinator.d.ts +42 -1
  121. package/build/services/MicStateCoordinator.d.ts.map +1 -1
  122. package/build/services/MicStateCoordinator.js +141 -3
  123. package/build/services/MicStateCoordinator.js.map +1 -1
  124. package/build/services/MiniappLauncher.d.ts.map +1 -1
  125. package/build/services/MiniappLauncher.js +23 -3
  126. package/build/services/MiniappLauncher.js.map +1 -1
  127. package/build/services/MiniappLiveness.d.ts +12 -0
  128. package/build/services/MiniappLiveness.d.ts.map +1 -0
  129. package/build/services/MiniappLiveness.js +16 -0
  130. package/build/services/MiniappLiveness.js.map +1 -0
  131. package/build/services/OtaArtifactDownloader.d.ts +65 -0
  132. package/build/services/OtaArtifactDownloader.d.ts.map +1 -0
  133. package/build/services/OtaArtifactDownloader.js +226 -0
  134. package/build/services/OtaArtifactDownloader.js.map +1 -0
  135. package/build/services/OtaAutoChain.d.ts +34 -0
  136. package/build/services/OtaAutoChain.d.ts.map +1 -0
  137. package/build/services/OtaAutoChain.js +83 -0
  138. package/build/services/OtaAutoChain.js.map +1 -0
  139. package/build/services/OtaErrorMapping.d.ts +18 -0
  140. package/build/services/OtaErrorMapping.d.ts.map +1 -0
  141. package/build/services/OtaErrorMapping.js +63 -0
  142. package/build/services/OtaErrorMapping.js.map +1 -0
  143. package/build/services/OtaInstallCoordinator.d.ts +94 -14
  144. package/build/services/OtaInstallCoordinator.d.ts.map +1 -1
  145. package/build/services/OtaInstallCoordinator.js +574 -130
  146. package/build/services/OtaInstallCoordinator.js.map +1 -1
  147. package/build/services/OtaService.d.ts.map +1 -1
  148. package/build/services/OtaService.js +8 -1
  149. package/build/services/OtaService.js.map +1 -1
  150. package/build/services/OtaUpdateCheckService.d.ts +38 -3
  151. package/build/services/OtaUpdateCheckService.d.ts.map +1 -1
  152. package/build/services/OtaUpdateCheckService.js +142 -22
  153. package/build/services/OtaUpdateCheckService.js.map +1 -1
  154. package/build/services/PhoneCalendarService.d.ts.map +1 -1
  155. package/build/services/PhoneCalendarService.js +22 -1
  156. package/build/services/PhoneCalendarService.js.map +1 -1
  157. package/build/services/PhoneCameraFovCoordinator.d.ts +2 -0
  158. package/build/services/PhoneCameraFovCoordinator.d.ts.map +1 -1
  159. package/build/services/PhoneCameraFovCoordinator.js +14 -0
  160. package/build/services/PhoneCameraFovCoordinator.js.map +1 -1
  161. package/build/services/PhoneNotificationsSync.d.ts.map +1 -1
  162. package/build/services/PhoneNotificationsSync.js +12 -10
  163. package/build/services/PhoneNotificationsSync.js.map +1 -1
  164. package/build/services/PhonePhotoCoordinator.d.ts +10 -3
  165. package/build/services/PhonePhotoCoordinator.d.ts.map +1 -1
  166. package/build/services/PhonePhotoCoordinator.js +21 -3
  167. package/build/services/PhonePhotoCoordinator.js.map +1 -1
  168. package/build/services/PhoneStreamCoordinator.d.ts +8 -1
  169. package/build/services/PhoneStreamCoordinator.d.ts.map +1 -1
  170. package/build/services/PhoneStreamCoordinator.js +125 -13
  171. package/build/services/PhoneStreamCoordinator.js.map +1 -1
  172. package/build/services/PhoneVideoCoordinator.d.ts +2 -0
  173. package/build/services/PhoneVideoCoordinator.d.ts.map +1 -1
  174. package/build/services/PhoneVideoCoordinator.js +10 -0
  175. package/build/services/PhoneVideoCoordinator.js.map +1 -1
  176. package/build/services/SceneRenderer.d.ts.map +1 -1
  177. package/build/services/SceneRenderer.js +15 -0
  178. package/build/services/SceneRenderer.js.map +1 -1
  179. package/build/services/SupportProfileSync.d.ts +22 -0
  180. package/build/services/SupportProfileSync.d.ts.map +1 -0
  181. package/build/services/SupportProfileSync.js +213 -0
  182. package/build/services/SupportProfileSync.js.map +1 -0
  183. package/build/services/TtsTextSanitizer.d.ts +5 -0
  184. package/build/services/TtsTextSanitizer.d.ts.map +1 -0
  185. package/build/services/TtsTextSanitizer.js +61 -0
  186. package/build/services/TtsTextSanitizer.js.map +1 -0
  187. package/build/services/WifiAdbRequest.d.ts +17 -0
  188. package/build/services/WifiAdbRequest.d.ts.map +1 -0
  189. package/build/services/WifiAdbRequest.js +35 -0
  190. package/build/services/WifiAdbRequest.js.map +1 -0
  191. package/build/services/asg/asgCameraApi.d.ts +3 -0
  192. package/build/services/asg/asgCameraApi.d.ts.map +1 -1
  193. package/build/services/asg/asgCameraApi.js +72 -2
  194. package/build/services/asg/asgCameraApi.js.map +1 -1
  195. package/build/services/asg/gallerySyncService.d.ts.map +1 -1
  196. package/build/services/asg/gallerySyncService.js +26 -14
  197. package/build/services/asg/gallerySyncService.js.map +1 -1
  198. package/build/services/asg/localNetworkTransport.d.ts +2 -2
  199. package/build/services/asg/localNetworkTransport.d.ts.map +1 -1
  200. package/build/services/asg/localNetworkTransport.js +6 -6
  201. package/build/services/asg/localNetworkTransport.js.map +1 -1
  202. package/build/services/audioPlaybackAssets.d.ts +8 -0
  203. package/build/services/audioPlaybackAssets.d.ts.map +1 -0
  204. package/build/services/audioPlaybackAssets.js +7 -0
  205. package/build/services/audioPlaybackAssets.js.map +1 -0
  206. package/build/services/glassesClockSync.js +2 -2
  207. package/build/services/glassesClockSync.js.map +1 -1
  208. package/build/services/manifestActions.d.ts +7 -0
  209. package/build/services/manifestActions.d.ts.map +1 -0
  210. package/build/services/manifestActions.js +25 -0
  211. package/build/services/manifestActions.js.map +1 -0
  212. package/build/services/otaDisplayState.d.ts +22 -11
  213. package/build/services/otaDisplayState.d.ts.map +1 -1
  214. package/build/services/otaDisplayState.js +36 -14
  215. package/build/services/otaDisplayState.js.map +1 -1
  216. package/build/services/otaInstallPolicy.d.ts +15 -3
  217. package/build/services/otaInstallPolicy.d.ts.map +1 -1
  218. package/build/services/otaInstallPolicy.js +24 -3
  219. package/build/services/otaInstallPolicy.js.map +1 -1
  220. package/build/services/otaManifestUrl.d.ts +2 -0
  221. package/build/services/otaManifestUrl.d.ts.map +1 -0
  222. package/build/services/{asgOtaVersionUrl.js → otaManifestUrl.js} +15 -5
  223. package/build/services/otaManifestUrl.js.map +1 -0
  224. package/build/services/slimStreamStatus.d.ts +11 -0
  225. package/build/services/slimStreamStatus.d.ts.map +1 -1
  226. package/build/services/slimStreamStatus.js +14 -4
  227. package/build/services/slimStreamStatus.js.map +1 -1
  228. package/build/stores/apps.d.ts.map +1 -1
  229. package/build/stores/apps.js +11 -0
  230. package/build/stores/apps.js.map +1 -1
  231. package/build/stores/bluetoothSettingKeys.d.ts.map +1 -1
  232. package/build/stores/bluetoothSettingKeys.js +2 -0
  233. package/build/stores/bluetoothSettingKeys.js.map +1 -1
  234. package/build/stores/gallerySync.d.ts +2 -0
  235. package/build/stores/gallerySync.d.ts.map +1 -1
  236. package/build/stores/gallerySync.js +2 -0
  237. package/build/stores/gallerySync.js.map +1 -1
  238. package/build/stores/glasses.d.ts.map +1 -1
  239. package/build/stores/glasses.js +3 -0
  240. package/build/stores/glasses.js.map +1 -1
  241. package/build/stores/settings.d.ts +17 -0
  242. package/build/stores/settings.d.ts.map +1 -1
  243. package/build/stores/settings.js +152 -19
  244. package/build/stores/settings.js.map +1 -1
  245. package/build/types/applet.d.ts +2 -0
  246. package/build/types/applet.d.ts.map +1 -1
  247. package/build/types/applet.js.map +1 -1
  248. package/build/types/enums.d.ts +1 -0
  249. package/build/types/enums.d.ts.map +1 -1
  250. package/build/types/enums.js +1 -0
  251. package/build/types/enums.js.map +1 -1
  252. package/build/types/hardware.d.ts +1 -0
  253. package/build/types/hardware.d.ts.map +1 -1
  254. package/build/types/hardware.js +14 -0
  255. package/build/types/hardware.js.map +1 -1
  256. package/build/utils/configuredDevHost.d.ts +6 -0
  257. package/build/utils/configuredDevHost.d.ts.map +1 -0
  258. package/build/utils/configuredDevHost.js +19 -0
  259. package/build/utils/configuredDevHost.js.map +1 -0
  260. package/build/utils/devMiniappLaunch.d.ts +19 -8
  261. package/build/utils/devMiniappLaunch.d.ts.map +1 -1
  262. package/build/utils/devMiniappLaunch.js +144 -21
  263. package/build/utils/devMiniappLaunch.js.map +1 -1
  264. package/build/utils/diagnosticContext.d.ts.map +1 -1
  265. package/build/utils/diagnosticContext.js +15 -17
  266. package/build/utils/diagnosticContext.js.map +1 -1
  267. package/build/utils/hardware/hardware.d.ts.map +1 -1
  268. package/build/utils/hardware/hardware.js +7 -3
  269. package/build/utils/hardware/hardware.js.map +1 -1
  270. package/build/utils/miniappDiagnostics.d.ts +64 -0
  271. package/build/utils/miniappDiagnostics.d.ts.map +1 -0
  272. package/build/utils/miniappDiagnostics.js +173 -0
  273. package/build/utils/miniappDiagnostics.js.map +1 -0
  274. package/build/utils/timers/timers.d.ts.map +1 -1
  275. package/build/utils/timers/timers.js +55 -18
  276. package/build/utils/timers/timers.js.map +1 -1
  277. package/package.json +27 -18
  278. package/src/assets/silence.wav +0 -0
  279. package/src/engine.ts +7 -2
  280. package/src/facades/dev.ts +9 -5
  281. package/src/facades/gallery.ts +1 -1
  282. package/src/facades/glasses.ts +17 -4
  283. package/src/facades/glassesSettings.ts +5 -0
  284. package/src/facades/miniapps.ts +7 -0
  285. package/src/facades/ota.ts +19 -4
  286. package/src/facades/pairing.ts +11 -7
  287. package/src/facades/phoneNotifications.ts +4 -13
  288. package/src/index.ts +26 -2
  289. package/src/internal.ts +2 -1
  290. package/src/react/MentraLiveOtaFlow.tsx +856 -0
  291. package/src/react/index.ts +7 -0
  292. package/src/react/useEngineSnapshot.ts +16 -0
  293. package/src/runtime/bootstrap.ts +33 -1
  294. package/src/runtime/scanQrSeam.ts +20 -0
  295. package/src/services/AppRegistry.ts +72 -48
  296. package/src/services/AudioCloudUplink.ts +9 -3
  297. package/src/services/AudioPlaybackService.ts +94 -34
  298. package/src/services/BlobStore.ts +22 -9
  299. package/src/services/CloudAudioSubscriptionSync.ts +13 -1
  300. package/src/services/CloudClientService.ts +74 -0
  301. package/src/services/ForegroundLocationPermission.ts +24 -0
  302. package/src/services/GlassesSettingsSync.ts +9 -3
  303. package/src/services/GlassesStatusProjection.ts +16 -8
  304. package/src/services/HotspotOtaTransport.ts +184 -0
  305. package/src/services/HotspotShutdown.ts +41 -0
  306. package/src/services/LocalDisplayManager.ts +112 -21
  307. package/src/services/LocalMiniappRuntime.ts +576 -130
  308. package/src/services/LocalMiniappStorage.ts +82 -0
  309. package/src/services/LocalMiniappUserIdentity.ts +46 -0
  310. package/src/services/MicStateCoordinator.ts +169 -4
  311. package/src/services/MiniappLauncher.ts +30 -3
  312. package/src/services/MiniappLiveness.ts +24 -0
  313. package/src/services/OtaArtifactDownloader.ts +312 -0
  314. package/src/services/OtaAutoChain.ts +106 -0
  315. package/src/services/OtaErrorMapping.ts +80 -0
  316. package/src/services/OtaInstallCoordinator.ts +645 -143
  317. package/src/services/OtaService.ts +11 -5
  318. package/src/services/OtaUpdateCheckService.ts +180 -20
  319. package/src/services/PhoneCalendarService.ts +27 -4
  320. package/src/services/PhoneCameraFovCoordinator.ts +15 -0
  321. package/src/services/PhoneNotificationsSync.ts +12 -10
  322. package/src/services/PhonePhotoCoordinator.ts +33 -7
  323. package/src/services/PhoneStreamCoordinator.ts +139 -25
  324. package/src/services/PhoneVideoCoordinator.ts +11 -0
  325. package/src/services/SceneRenderer.ts +16 -0
  326. package/src/services/SupportProfileSync.ts +218 -0
  327. package/src/services/TtsTextSanitizer.ts +66 -0
  328. package/src/services/WifiAdbRequest.ts +53 -0
  329. package/src/services/asg/asgCameraApi.ts +99 -8
  330. package/src/services/asg/gallerySyncService.ts +28 -19
  331. package/src/services/asg/localNetworkTransport.ts +7 -11
  332. package/src/services/audioPlaybackAssets.ts +8 -0
  333. package/src/services/glassesClockSync.ts +2 -2
  334. package/src/services/manifestActions.ts +30 -0
  335. package/src/services/otaDisplayState.ts +57 -16
  336. package/src/services/otaInstallPolicy.ts +29 -3
  337. package/src/services/{asgOtaVersionUrl.ts → otaManifestUrl.ts} +16 -4
  338. package/src/services/slimStreamStatus.ts +16 -5
  339. package/src/stores/apps.ts +12 -0
  340. package/src/stores/bluetoothSettingKeys.ts +2 -0
  341. package/src/stores/gallerySync.ts +4 -0
  342. package/src/stores/glasses.ts +3 -0
  343. package/src/stores/settings.ts +174 -21
  344. package/src/types/applet.ts +2 -0
  345. package/src/types/enums.ts +2 -1
  346. package/src/types/hardware.ts +17 -0
  347. package/src/utils/configuredDevHost.ts +17 -0
  348. package/src/utils/devMiniappLaunch.ts +151 -23
  349. package/src/utils/diagnosticContext.ts +17 -17
  350. package/src/utils/hardware/hardware.ts +7 -9
  351. package/src/utils/miniappDiagnostics.ts +226 -0
  352. package/src/utils/timers/timers.ts +57 -21
  353. package/build/services/asgOtaVersionUrl.d.ts +0 -2
  354. package/build/services/asgOtaVersionUrl.d.ts.map +0 -1
  355. package/build/services/asgOtaVersionUrl.js.map +0 -1
@@ -12,6 +12,7 @@
12
12
  */
13
13
  import displayProcessor from "./DisplayProcessor";
14
14
  import BluetoothSdk from "@mentra/bluetooth-sdk/internal";
15
+ import { useDisplayStore } from "../stores/display";
15
16
  import { SETTINGS, useSettingsStore } from "../stores/settings";
16
17
  import { useGlassesStore } from "../stores/glasses";
17
18
  import { DeviceTypes, getModelCapabilities } from "../types";
@@ -227,6 +228,20 @@ class SceneRenderer {
227
228
  void Promise.resolve(BluetoothSdk.displayEvent({ view: frame.view, scene: frame })).catch((err) => {
228
229
  console.error(`${LOG_TAG}: native scene send failed:`, err);
229
230
  });
231
+ // Keep the phone-side glasses mirror on the same frame as native. Legacy
232
+ // layouts update this store in LocalDisplayManager.sendToNative; scene
233
+ // frames bypass that method, so without an explicit write every
234
+ // positioning device (including G2) leaves the mirror blank/stale.
235
+ const caps = this.currentCapabilities();
236
+ useDisplayStore.getState().setDisplayEvent({
237
+ view: frame.view,
238
+ layout: {
239
+ layoutType: "scene",
240
+ width: caps?.width,
241
+ height: caps?.height,
242
+ elements: frame.elements,
243
+ },
244
+ });
230
245
  }
231
246
  catch (err) {
232
247
  console.error(`${LOG_TAG}: native scene send failed:`, err);
@@ -1 +1 @@
1
- {"version":3,"file":"SceneRenderer.js","sourceRoot":"","sources":["../../src/services/SceneRenderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,gBAAgB,MAAM,oBAAoB,CAAA;AACjD,OAAO,YAAY,MAAM,gCAAgC,CAAA;AACzD,OAAO,EAAC,QAAQ,EAAE,gBAAgB,EAAC,MAAM,oBAAoB,CAAA;AAC7D,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAC,WAAW,EAAE,oBAAoB,EAAC,MAAM,UAAU,CAAA;AAC1D,OAAO,EACL,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,UAAU,GAMX,MAAM,wBAAwB,CAAA;AAE/B,MAAM,OAAO,GAAG,gBAAgB,CAAA;AAahC,MAAM,aAAa;IACT,MAAM,CAAC,QAAQ,GAAyB,IAAI,CAAA;IAC5C,KAAK,GAAG,IAAI,UAAU,EAAE,CAAA;IAEzB,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC;YAC5B,aAAa,CAAC,QAAQ,GAAG,IAAI,aAAa,EAAE,CAAA;QAC9C,CAAC;QACD,OAAO,aAAa,CAAC,QAAQ,CAAA;IAC/B,CAAC;IAED,8EAA8E;IAC9E,eAAe;IACf,8EAA8E;IAE9E;;;OAGG;IACI,mBAAmB;QACxB,wEAAwE;QACxE,+CAA+C;QAC/C,MAAM,KAAK,GACR,gBAAgB,CAAC,QAAQ,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,gBAAgB,CAAC,GAAG,CAAwB;YAC5F,eAAe,CAAC,QAAQ,EAAE,CAAC,WAAkC,CAAA;QAChE,MAAM,OAAO,GAAG,oBAAoB,CAAC,CAAC,KAAK,IAAI,WAAW,CAAC,IAAI,CAAgB,CAAC,EAAE,OAAO,CAAA;QACzF,IAAI,CAAC,OAAO;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AAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;IAC1C,CAAC;;AAGH,MAAM,aAAa,GAAG,aAAa,CAAC,WAAW,EAAE,CAAA;AACjD,eAAe,aAAa,CAAA;AAC5B,OAAO,EAAC,aAAa,EAAC,CAAA","sourcesContent":["/**\n * SceneRenderer — the device-aware boundary of the scene display pipeline.\n *\n * LocalDisplayManager owns WHO may draw (arbitration/boot/expiry); this service\n * owns WHAT gets sent for a scene: capabilities lookup, legacy-layout→scene\n * conversion (sugar and old bundles ride the same pipeline), process → diff →\n * SceneFrame emission, retained-scene replay, and the degrade branch for\n * devices that can't position elements.\n *\n * Everything device-specific here is DATA (capability fields, display profile);\n * the code paths are generic. Spec: notes/miniapp-display-render-implementation-spec.md\n */\n\nimport displayProcessor from \"./DisplayProcessor\"\nimport BluetoothSdk from \"@mentra/bluetooth-sdk/internal\"\nimport {SETTINGS, useSettingsStore} from \"../stores/settings\"\nimport {useGlassesStore} from \"../stores/glasses\"\nimport {DeviceTypes, getModelCapabilities} from \"../types\"\nimport {\n degradeScene,\n diffScene,\n processScene,\n SceneStore,\n type FrameElement,\n type SceneBreakMode,\n type SceneDisplayCapabilities,\n type SceneElementInput,\n type SceneFrame,\n} from \"../utils/display/scene\"\n\nconst LOG_TAG = \"SCENE_RENDERER\"\n\n/** Legacy layout shape (matches DisplayPayload.layout). */\nexport type LegacyLayout = {layoutType: string; [key: string]: unknown}\n\nexport type SceneEmitResult =\n /** A SceneFrame went to native. */\n | {kind: \"scene\"; degraded: boolean; dropped: string[]}\n /** Degrade path: caller routes this legacy layout through the existing pipeline (null layout ⇒ clear). */\n | {kind: \"legacy\"; layout: LegacyLayout | null; degraded: boolean; dropped: string[]}\n /** No display capabilities on the connected device. */\n | {kind: \"no-display\"}\n\nclass SceneRenderer {\n private static instance: SceneRenderer | null = null\n private store = new SceneStore()\n\n public static getInstance(): SceneRenderer {\n if (!SceneRenderer.instance) {\n SceneRenderer.instance = new SceneRenderer()\n }\n return SceneRenderer.instance\n }\n\n // ===========================================================================\n // Capabilities\n // ===========================================================================\n\n /**\n * Scene capabilities of the currently-selected device, or null when it has no\n * display block. Read on demand — same model source the CONNECT_ACK uses.\n */\n public currentCapabilities(): SceneDisplayCapabilities | null {\n // dev read these via the (since-removed) settings/glassesStatus runtime\n // hooks; engine reads its own stores directly.\n const model =\n (useSettingsStore.getState().getSetting(SETTINGS.default_wearable.key) as string | undefined) ??\n (useGlassesStore.getState().deviceModel as string | undefined)\n const display = getModelCapabilities((model ?? DeviceTypes.NONE) as DeviceTypes)?.display\n if (!display) return null\n return {\n width: display.width ?? display.resolution?.width ?? displayProcessor.getProfile().displayWidthPx,\n height: display.height ?? display.resolution?.height ?? displayProcessor.getProfile().displayHeightPx ?? 288,\n canPosition: display.canPosition === true,\n maxTextElements: display.maxTextElements ?? 6,\n maxImageElements: display.maxImageElements ?? 0,\n maxImagePx: display.maxImagePx,\n shapes: display.shapes ?? [],\n intensityLevels: display.intensityLevels ?? 2,\n partialUpdate: display.partialUpdate ?? false,\n }\n }\n\n // ===========================================================================\n // Legacy layout → scene conversion (sugar + old bundles on the scene path)\n // ===========================================================================\n\n /**\n * Convert a legacy layout into scene elements for a positioning device.\n * Returns null for layouts that must stay on the legacy path (dashboard_card,\n * clear_view, unknown types). Sugar semantics: full-canvas / split boxes.\n */\n public convertLegacyLayout(layout: LegacyLayout, caps: SceneDisplayCapabilities): SceneElementInput[] | null {\n const W = caps.width\n const H = caps.height\n const breakMode = layout.breakMode as SceneBreakMode | undefined\n\n switch (layout.layoutType) {\n case \"text_wall\":\n return [\n {\n type: \"text\",\n id: \"sugar:wall\",\n box: {x: 0, y: 0, w: W, h: H},\n text: String(layout.text ?? \"\"),\n ...(breakMode ? {style: {breakMode}} : {}),\n },\n ]\n case \"double_text_wall\": {\n const half = Math.floor(W / 2)\n return [\n {\n type: \"text\",\n id: \"sugar:left\",\n box: {x: 0, y: 0, w: half, h: H},\n text: String(layout.topText ?? \"\"),\n ...(breakMode ? {style: {breakMode}} : {}),\n },\n {\n type: \"text\",\n id: \"sugar:right\",\n box: {x: half, y: 0, w: W - half, h: H},\n text: String(layout.bottomText ?? \"\"),\n ...(breakMode ? {style: {breakMode}} : {}),\n },\n ]\n }\n case \"reference_card\": {\n const titleH = Math.max(24, Math.floor(H / 5))\n return [\n {type: \"text\", id: \"sugar:title\", box: {x: 0, y: 0, w: W, h: titleH}, text: String(layout.title ?? \"\")},\n {\n type: \"text\",\n id: \"sugar:body\",\n box: {x: 0, y: titleH, w: W, h: H - titleH},\n text: String(layout.text ?? \"\"),\n ...(breakMode ? {style: {breakMode}} : {}),\n },\n ]\n }\n case \"bitmap_view\": {\n // Dimensionless legacy bitmaps historically landed in the device's\n // default ~200×100 container (G2 seeded 200×100 at 188,44) — NOT the\n // full canvas, which would tile a small image across the whole frame.\n const w = (layout.width as number | undefined) ?? Math.min(200, W)\n const h = (layout.height as number | undefined) ?? Math.min(100, H)\n return [\n {\n type: \"image\",\n id: \"sugar:bmp\",\n box: {\n x: (layout.x as number | undefined) ?? Math.max(0, Math.round((W - w) / 2)),\n y: (layout.y as number | undefined) ?? Math.max(0, Math.round((H - h) / 4)),\n w,\n h,\n },\n data: String(layout.data ?? \"\"),\n },\n ]\n }\n case \"positioned_text\": {\n const border = (layout.borderWidth as number | undefined) ?? 0\n const radius = (layout.borderRadius as number | undefined) ?? 0\n return [\n {\n type: \"text\",\n id: \"sugar:pos\",\n box: {\n x: (layout.x as number | undefined) ?? 0,\n y: (layout.y as number | undefined) ?? 0,\n w: (layout.width as number | undefined) ?? W,\n h: (layout.height as number | undefined) ?? H,\n },\n text: String(layout.text ?? \"\"),\n ...(border || radius ? {style: {border, radius}} : {}),\n },\n ]\n }\n default:\n return null\n }\n }\n\n // ===========================================================================\n // Emit\n // ===========================================================================\n\n /**\n * Process + diff + send a scene for (app, view). On non-positioning devices\n * this returns the degraded legacy layout instead — the caller routes it\n * through the existing DisplayProcessor path (which wraps it, keeping G1/Z100\n * output byte-identical to today).\n */\n public emitScene(appId: string, view: \"main\" | \"dashboard\", elements: SceneElementInput[]): SceneEmitResult {\n const caps = this.currentCapabilities()\n if (!caps) return {kind: \"no-display\"}\n\n if (!caps.canPosition) {\n const {layout, degraded, dropped} = degradeScene(elements)\n return {kind: \"legacy\", layout, degraded, dropped}\n }\n\n const processed = processScene(elements, caps, displayProcessor.getProfile())\n // A stale baseline means the glasses were cleared since the last commit —\n // diff from empty so everything repaints (the retained frame stays valid\n // as the replay source only).\n const prevFrame = this.store.isBaselineStale(appId, view) ? [] : this.store.lastFrame(appId, view)\n const {elements: diffed, removed} = diffScene(\n prevFrame,\n processed.elements,\n this.store.nextSyntheticId(appId, view),\n )\n this.store.commit(appId, view, diffed)\n\n const frame: SceneFrame = {\n appId,\n view,\n sceneEpoch: this.store.currentEpoch(appId, view),\n elements: diffed,\n removed,\n }\n this.sendFrame(frame)\n return {kind: \"scene\", degraded: processed.degraded, dropped: processed.dropped}\n }\n\n /**\n * Re-emit an app's retained scene (reconnect / arbitration restore). Replay\n * is always create-based — the device rebuilds from scratch (spec §4).\n * Returns false when nothing is retained.\n */\n public replayApp(appId: string, view: \"main\" | \"dashboard\"): boolean {\n const frame = this.store.buildReplayFrame(appId, view)\n if (!frame) return false\n this.sendFrame(frame)\n return true\n }\n\n /** Forget an app's retained scenes (app stop). */\n public clearApp(appId: string): void {\n this.store.clear(appId)\n }\n\n /**\n * Reset the diff baseline for (app, view) without touching the device.\n * Used when a legacy layout bypasses the scene path (clear_view /\n * dashboard_card / unknown layoutTypes go to native raw): after that, the\n * retained frame no longer matches the glasses, so the next render() must\n * diff from empty — otherwise \"unchanged\" elements would be skipped and\n * never repainted.\n */\n public resetBaseline(appId: string, view: \"main\" | \"dashboard\"): void {\n this.store.commit(appId, view, [])\n }\n\n /**\n * A system-level clear wiped the view (durationMs expiry, unmount fallback,\n * boot-window expiry): mark every app's baseline for that view stale. Unlike\n * resetBaseline this KEEPS the retained frames — they remain the\n * restore-as-replay source; only incremental diffing restarts from empty.\n */\n public markViewStale(view: \"main\" | \"dashboard\"): void {\n this.store.markViewStale(view)\n }\n\n private sendFrame(frame: SceneFrame): void {\n try {\n // sendDisplayEvent hook -> direct BluetoothSdk.displayEvent (the exact\n // wiring the deleted MantleManager hook provided).\n void Promise.resolve(BluetoothSdk.displayEvent({view: frame.view, scene: frame})).catch((err) => {\n console.error(`${LOG_TAG}: native scene send failed:`, err)\n })\n } catch (err) {\n console.error(`${LOG_TAG}: native scene send failed:`, err)\n }\n }\n\n // ===========================================================================\n // Test hooks\n // ===========================================================================\n\n public _resetForTest(): void {\n this.store.clearAll()\n }\n\n public _lastFrameForTest(appId: string, view: string): FrameElement[] {\n return this.store.lastFrame(appId, view)\n }\n}\n\nconst sceneRenderer = SceneRenderer.getInstance()\nexport default sceneRenderer\nexport {SceneRenderer}\n"]}
1
+ {"version":3,"file":"SceneRenderer.js","sourceRoot":"","sources":["../../src/services/SceneRenderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,gBAAgB,MAAM,oBAAoB,CAAA;AACjD,OAAO,YAAY,MAAM,gCAAgC,CAAA;AACzD,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAC,QAAQ,EAAE,gBAAgB,EAAC,MAAM,oBAAoB,CAAA;AAC7D,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAC,WAAW,EAAE,oBAAoB,EAAC,MAAM,UAAU,CAAA;AAC1D,OAAO,EACL,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,UAAU,GAMX,MAAM,wBAAwB,CAAA;AAE/B,MAAM,OAAO,GAAG,gBAAgB,CAAA;AAahC,MAAM,aAAa;IACT,MAAM,CAAC,QAAQ,GAAyB,IAAI,CAAA;IAC5C,KAAK,GAAG,IAAI,UAAU,EAAE,CAAA;IAEzB,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,aA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AC,YAAY,CAAC,EAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;gBAC9F,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,6BAA6B,EAAE,GAAG,CAAC,CAAA;YAC7D,CAAC,CAAC,CAAA;YAEF,yEAAyE;YACzE,uEAAuE;YACvE,gEAAgE;YAChE,mEAAmE;YACnE,MAAM,IAAI,GAAG,IAAI,CAAC,mBAAmB,EAAE,CAAA;YACvC,eAAe,CAAC,QAAQ,EAAE,CAAC,eAAe,CAAC;gBACzC,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,MAAM,EAAE;oBACN,UAAU,EAAE,OAAO;oBACnB,KAAK,EAAE,IAAI,EAAE,KAAK;oBAClB,MAAM,EAAE,IAAI,EAAE,MAAM;oBACpB,QAAQ,EAAE,KAAK,CAAC,QAAQ;iBACzB;aACF,CAAC,CAAA;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,6BAA6B,EAAE,GAAG,CAAC,CAAA;QAC7D,CAAC;IACH,CAAC;IAED,8EAA8E;IAC9E,aAAa;IACb,8EAA8E;IAEvE,aAAa;QAClB,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAA;IACvB,CAAC;IAEM,iBAAiB,CAAC,KAAa,EAAE,IAAY;QAClD,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;IAC1C,CAAC;;AAGH,MAAM,aAAa,GAAG,aAAa,CAAC,WAAW,EAAE,CAAA;AACjD,eAAe,aAAa,CAAA;AAC5B,OAAO,EAAC,aAAa,EAAC,CAAA","sourcesContent":["/**\n * SceneRenderer — the device-aware boundary of the scene display pipeline.\n *\n * LocalDisplayManager owns WHO may draw (arbitration/boot/expiry); this service\n * owns WHAT gets sent for a scene: capabilities lookup, legacy-layout→scene\n * conversion (sugar and old bundles ride the same pipeline), process → diff →\n * SceneFrame emission, retained-scene replay, and the degrade branch for\n * devices that can't position elements.\n *\n * Everything device-specific here is DATA (capability fields, display profile);\n * the code paths are generic. Spec: notes/miniapp-display-render-implementation-spec.md\n */\n\nimport displayProcessor from \"./DisplayProcessor\"\nimport BluetoothSdk from \"@mentra/bluetooth-sdk/internal\"\nimport {useDisplayStore} from \"../stores/display\"\nimport {SETTINGS, useSettingsStore} from \"../stores/settings\"\nimport {useGlassesStore} from \"../stores/glasses\"\nimport {DeviceTypes, getModelCapabilities} from \"../types\"\nimport {\n degradeScene,\n diffScene,\n processScene,\n SceneStore,\n type FrameElement,\n type SceneBreakMode,\n type SceneDisplayCapabilities,\n type SceneElementInput,\n type SceneFrame,\n} from \"../utils/display/scene\"\n\nconst LOG_TAG = \"SCENE_RENDERER\"\n\n/** Legacy layout shape (matches DisplayPayload.layout). */\nexport type LegacyLayout = {layoutType: string; [key: string]: unknown}\n\nexport type SceneEmitResult =\n /** A SceneFrame went to native. */\n | {kind: \"scene\"; degraded: boolean; dropped: string[]}\n /** Degrade path: caller routes this legacy layout through the existing pipeline (null layout ⇒ clear). */\n | {kind: \"legacy\"; layout: LegacyLayout | null; degraded: boolean; dropped: string[]}\n /** No display capabilities on the connected device. */\n | {kind: \"no-display\"}\n\nclass SceneRenderer {\n private static instance: SceneRenderer | null = null\n private store = new SceneStore()\n\n public static getInstance(): SceneRenderer {\n if (!SceneRenderer.instance) {\n SceneRenderer.instance = new SceneRenderer()\n }\n return SceneRenderer.instance\n }\n\n // ===========================================================================\n // Capabilities\n // ===========================================================================\n\n /**\n * Scene capabilities of the currently-selected device, or null when it has no\n * display block. Read on demand — same model source the CONNECT_ACK uses.\n */\n public currentCapabilities(): SceneDisplayCapabilities | null {\n // dev read these via the (since-removed) settings/glassesStatus runtime\n // hooks; engine reads its own stores directly.\n const model =\n (useSettingsStore.getState().getSetting(SETTINGS.default_wearable.key) as string | undefined) ??\n (useGlassesStore.getState().deviceModel as string | undefined)\n const display = getModelCapabilities((model ?? DeviceTypes.NONE) as DeviceTypes)?.display\n if (!display) return null\n return {\n width: display.width ?? display.resolution?.width ?? displayProcessor.getProfile().displayWidthPx,\n height: display.height ?? display.resolution?.height ?? displayProcessor.getProfile().displayHeightPx ?? 288,\n canPosition: display.canPosition === true,\n maxTextElements: display.maxTextElements ?? 6,\n maxImageElements: display.maxImageElements ?? 0,\n maxImagePx: display.maxImagePx,\n shapes: display.shapes ?? [],\n intensityLevels: display.intensityLevels ?? 2,\n partialUpdate: display.partialUpdate ?? false,\n }\n }\n\n // ===========================================================================\n // Legacy layout → scene conversion (sugar + old bundles on the scene path)\n // ===========================================================================\n\n /**\n * Convert a legacy layout into scene elements for a positioning device.\n * Returns null for layouts that must stay on the legacy path (dashboard_card,\n * clear_view, unknown types). Sugar semantics: full-canvas / split boxes.\n */\n public convertLegacyLayout(layout: LegacyLayout, caps: SceneDisplayCapabilities): SceneElementInput[] | null {\n const W = caps.width\n const H = caps.height\n const breakMode = layout.breakMode as SceneBreakMode | undefined\n\n switch (layout.layoutType) {\n case \"text_wall\":\n return [\n {\n type: \"text\",\n id: \"sugar:wall\",\n box: {x: 0, y: 0, w: W, h: H},\n text: String(layout.text ?? \"\"),\n ...(breakMode ? {style: {breakMode}} : {}),\n },\n ]\n case \"double_text_wall\": {\n const half = Math.floor(W / 2)\n return [\n {\n type: \"text\",\n id: \"sugar:left\",\n box: {x: 0, y: 0, w: half, h: H},\n text: String(layout.topText ?? \"\"),\n ...(breakMode ? {style: {breakMode}} : {}),\n },\n {\n type: \"text\",\n id: \"sugar:right\",\n box: {x: half, y: 0, w: W - half, h: H},\n text: String(layout.bottomText ?? \"\"),\n ...(breakMode ? {style: {breakMode}} : {}),\n },\n ]\n }\n case \"reference_card\": {\n const titleH = Math.max(24, Math.floor(H / 5))\n return [\n {type: \"text\", id: \"sugar:title\", box: {x: 0, y: 0, w: W, h: titleH}, text: String(layout.title ?? \"\")},\n {\n type: \"text\",\n id: \"sugar:body\",\n box: {x: 0, y: titleH, w: W, h: H - titleH},\n text: String(layout.text ?? \"\"),\n ...(breakMode ? {style: {breakMode}} : {}),\n },\n ]\n }\n case \"bitmap_view\": {\n // Dimensionless legacy bitmaps historically landed in the device's\n // default ~200×100 container (G2 seeded 200×100 at 188,44) — NOT the\n // full canvas, which would tile a small image across the whole frame.\n const w = (layout.width as number | undefined) ?? Math.min(200, W)\n const h = (layout.height as number | undefined) ?? Math.min(100, H)\n return [\n {\n type: \"image\",\n id: \"sugar:bmp\",\n box: {\n x: (layout.x as number | undefined) ?? Math.max(0, Math.round((W - w) / 2)),\n y: (layout.y as number | undefined) ?? Math.max(0, Math.round((H - h) / 4)),\n w,\n h,\n },\n data: String(layout.data ?? \"\"),\n },\n ]\n }\n case \"positioned_text\": {\n const border = (layout.borderWidth as number | undefined) ?? 0\n const radius = (layout.borderRadius as number | undefined) ?? 0\n return [\n {\n type: \"text\",\n id: \"sugar:pos\",\n box: {\n x: (layout.x as number | undefined) ?? 0,\n y: (layout.y as number | undefined) ?? 0,\n w: (layout.width as number | undefined) ?? W,\n h: (layout.height as number | undefined) ?? H,\n },\n text: String(layout.text ?? \"\"),\n ...(border || radius ? {style: {border, radius}} : {}),\n },\n ]\n }\n default:\n return null\n }\n }\n\n // ===========================================================================\n // Emit\n // ===========================================================================\n\n /**\n * Process + diff + send a scene for (app, view). On non-positioning devices\n * this returns the degraded legacy layout instead — the caller routes it\n * through the existing DisplayProcessor path (which wraps it, keeping G1/Z100\n * output byte-identical to today).\n */\n public emitScene(appId: string, view: \"main\" | \"dashboard\", elements: SceneElementInput[]): SceneEmitResult {\n const caps = this.currentCapabilities()\n if (!caps) return {kind: \"no-display\"}\n\n if (!caps.canPosition) {\n const {layout, degraded, dropped} = degradeScene(elements)\n return {kind: \"legacy\", layout, degraded, dropped}\n }\n\n const processed = processScene(elements, caps, displayProcessor.getProfile())\n // A stale baseline means the glasses were cleared since the last commit —\n // diff from empty so everything repaints (the retained frame stays valid\n // as the replay source only).\n const prevFrame = this.store.isBaselineStale(appId, view) ? [] : this.store.lastFrame(appId, view)\n const {elements: diffed, removed} = diffScene(\n prevFrame,\n processed.elements,\n this.store.nextSyntheticId(appId, view),\n )\n this.store.commit(appId, view, diffed)\n\n const frame: SceneFrame = {\n appId,\n view,\n sceneEpoch: this.store.currentEpoch(appId, view),\n elements: diffed,\n removed,\n }\n this.sendFrame(frame)\n return {kind: \"scene\", degraded: processed.degraded, dropped: processed.dropped}\n }\n\n /**\n * Re-emit an app's retained scene (reconnect / arbitration restore). Replay\n * is always create-based — the device rebuilds from scratch (spec §4).\n * Returns false when nothing is retained.\n */\n public replayApp(appId: string, view: \"main\" | \"dashboard\"): boolean {\n const frame = this.store.buildReplayFrame(appId, view)\n if (!frame) return false\n this.sendFrame(frame)\n return true\n }\n\n /** Forget an app's retained scenes (app stop). */\n public clearApp(appId: string): void {\n this.store.clear(appId)\n }\n\n /**\n * Reset the diff baseline for (app, view) without touching the device.\n * Used when a legacy layout bypasses the scene path (clear_view /\n * dashboard_card / unknown layoutTypes go to native raw): after that, the\n * retained frame no longer matches the glasses, so the next render() must\n * diff from empty — otherwise \"unchanged\" elements would be skipped and\n * never repainted.\n */\n public resetBaseline(appId: string, view: \"main\" | \"dashboard\"): void {\n this.store.commit(appId, view, [])\n }\n\n /**\n * A system-level clear wiped the view (durationMs expiry, unmount fallback,\n * boot-window expiry): mark every app's baseline for that view stale. Unlike\n * resetBaseline this KEEPS the retained frames — they remain the\n * restore-as-replay source; only incremental diffing restarts from empty.\n */\n public markViewStale(view: \"main\" | \"dashboard\"): void {\n this.store.markViewStale(view)\n }\n\n private sendFrame(frame: SceneFrame): void {\n try {\n // sendDisplayEvent hook -> direct BluetoothSdk.displayEvent (the exact\n // wiring the deleted MantleManager hook provided).\n void Promise.resolve(BluetoothSdk.displayEvent({view: frame.view, scene: frame})).catch((err) => {\n console.error(`${LOG_TAG}: native scene send failed:`, err)\n })\n\n // Keep the phone-side glasses mirror on the same frame as native. Legacy\n // layouts update this store in LocalDisplayManager.sendToNative; scene\n // frames bypass that method, so without an explicit write every\n // positioning device (including G2) leaves the mirror blank/stale.\n const caps = this.currentCapabilities()\n useDisplayStore.getState().setDisplayEvent({\n view: frame.view,\n layout: {\n layoutType: \"scene\",\n width: caps?.width,\n height: caps?.height,\n elements: frame.elements,\n },\n })\n } catch (err) {\n console.error(`${LOG_TAG}: native scene send failed:`, err)\n }\n }\n\n // ===========================================================================\n // Test hooks\n // ===========================================================================\n\n public _resetForTest(): void {\n this.store.clearAll()\n }\n\n public _lastFrameForTest(appId: string, view: string): FrameElement[] {\n return this.store.lastFrame(appId, view)\n }\n}\n\nconst sceneRenderer = SceneRenderer.getInstance()\nexport default sceneRenderer\nexport {SceneRenderer}\n"]}
@@ -0,0 +1,22 @@
1
+ import type { SupportStateInput } from "@mentra/cloud-client";
2
+ /**
3
+ * Keep Cloud V2's canonical support snapshot current without creating an event
4
+ * stream from noisy store updates. Only the explicitly selected fields below
5
+ * leave the phone; Wi-Fi, Bluetooth addresses, location and diagnostics do not.
6
+ */
7
+ export declare function startSupportProfileSync(): void;
8
+ export declare function stopSupportProfileSync(): void;
9
+ export declare function retryDelayForSupportProfileResult(result: {
10
+ status: "accepted" | "deduplicated" | "stale";
11
+ }): number | null;
12
+ /**
13
+ * Support freshness is not worth an aggressive retry loop. A snapshot the
14
+ * server keeps rejecting (skewed clock, deleted account, signed-out host)
15
+ * backs off exponentially until it converges on the heartbeat cadence.
16
+ */
17
+ export declare function retryDelayForSendFailure(consecutiveFailures: number): number;
18
+ export declare function buildSnapshot(observedAt?: Date): SupportStateInput;
19
+ /** Record only normalized connection failures; arbitrary exception messages never leave the phone. */
20
+ export declare function recordSupportProfileConnectionFailure(error: unknown, stage: string): void;
21
+ export declare function snapshotFingerprint(snapshot: SupportStateInput): string;
22
+ //# sourceMappingURL=SupportProfileSync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SupportProfileSync.d.ts","sourceRoot":"","sources":["../../src/services/SupportProfileSync.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,sBAAsB,CAAA;AAwB3D;;;;GAIG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAO9C;AAED,wBAAgB,sBAAsB,IAAI,IAAI,CAgB7C;AA+ED,wBAAgB,iCAAiC,CAAC,MAAM,EAAE;IACxD,MAAM,EAAE,UAAU,GAAG,cAAc,GAAG,OAAO,CAAA;CAC9C,GAAG,MAAM,GAAG,IAAI,CAGhB;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,mBAAmB,EAAE,MAAM,GAAG,MAAM,CAE5E;AAED,wBAAgB,aAAa,CAAC,UAAU,OAAa,GAAG,iBAAiB,CAoCxE;AAED,sGAAsG;AACtG,wBAAgB,qCAAqC,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAiBzF;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM,CAEvE"}
@@ -0,0 +1,213 @@
1
+ import Constants from "expo-constants";
2
+ import * as Device from "expo-device";
3
+ import { Platform } from "react-native";
4
+ import { useGlassesStore } from "../stores/glasses";
5
+ import { BgTimer } from "../utils/timers";
6
+ import { cloudClientService } from "./CloudClientService";
7
+ const ENGINE_VERSION = require("../../package.json").version;
8
+ const BLUETOOTH_SDK_VERSION = require("@mentra/bluetooth-sdk/package.json").version;
9
+ const DEBOUNCE_MS = 2_000;
10
+ const RETRY_MS = 30_000;
11
+ const HEARTBEAT_MS = 6 * 60 * 60_000;
12
+ let unsubscribe = null;
13
+ let debounceTimer = null;
14
+ let retryTimer = null;
15
+ let heartbeatTimer = null;
16
+ let lastSentFingerprint = null;
17
+ let queuedFingerprint = null;
18
+ let sendingGeneration = null;
19
+ let syncGeneration = 0;
20
+ let consecutiveSendFailures = 0;
21
+ let lastFailure = null;
22
+ let lastConnectionState = null;
23
+ /**
24
+ * Keep Cloud V2's canonical support snapshot current without creating an event
25
+ * stream from noisy store updates. Only the explicitly selected fields below
26
+ * leave the phone; Wi-Fi, Bluetooth addresses, location and diagnostics do not.
27
+ */
28
+ export function startSupportProfileSync() {
29
+ if (unsubscribe)
30
+ return;
31
+ const generation = ++syncGeneration;
32
+ lastConnectionState = useGlassesStore.getState().connection.state;
33
+ unsubscribe = useGlassesStore.subscribe(() => handleGlassesStoreChange(generation));
34
+ heartbeatTimer = BgTimer.setInterval(() => void sendCurrentSnapshot(true, generation), HEARTBEAT_MS);
35
+ void sendCurrentSnapshot(true, generation);
36
+ }
37
+ export function stopSupportProfileSync() {
38
+ syncGeneration += 1;
39
+ unsubscribe?.();
40
+ unsubscribe = null;
41
+ if (debounceTimer !== null)
42
+ BgTimer.clearTimeout(debounceTimer);
43
+ if (retryTimer !== null)
44
+ BgTimer.clearTimeout(retryTimer);
45
+ if (heartbeatTimer !== null)
46
+ BgTimer.clearInterval(heartbeatTimer);
47
+ debounceTimer = null;
48
+ retryTimer = null;
49
+ heartbeatTimer = null;
50
+ lastSentFingerprint = null;
51
+ queuedFingerprint = null;
52
+ sendingGeneration = null;
53
+ consecutiveSendFailures = 0;
54
+ lastFailure = null;
55
+ lastConnectionState = null;
56
+ }
57
+ function handleGlassesStoreChange(generation) {
58
+ if (!unsubscribe || generation !== syncGeneration)
59
+ return;
60
+ const connectionState = useGlassesStore.getState().connection.state;
61
+ if (connectionState === "connected" && lastConnectionState !== "connected")
62
+ lastFailure = null;
63
+ lastConnectionState = connectionState;
64
+ scheduleMeaningfulUpdate(generation);
65
+ }
66
+ function scheduleMeaningfulUpdate(generation = syncGeneration) {
67
+ if (!unsubscribe || generation !== syncGeneration)
68
+ return;
69
+ const fingerprint = snapshotFingerprint(buildSnapshot());
70
+ if (fingerprint === lastSentFingerprint)
71
+ return;
72
+ queuedFingerprint = fingerprint;
73
+ armDebounce(generation);
74
+ }
75
+ function armDebounce(generation) {
76
+ if (debounceTimer !== null)
77
+ BgTimer.clearTimeout(debounceTimer);
78
+ debounceTimer = BgTimer.setTimeout(() => {
79
+ debounceTimer = null;
80
+ void sendCurrentSnapshot(false, generation);
81
+ }, DEBOUNCE_MS);
82
+ }
83
+ async function sendCurrentSnapshot(force, generation = syncGeneration) {
84
+ if (!unsubscribe || generation !== syncGeneration)
85
+ return;
86
+ if (sendingGeneration === generation) {
87
+ const fingerprint = snapshotFingerprint(buildSnapshot());
88
+ if (fingerprint !== lastSentFingerprint)
89
+ queuedFingerprint = fingerprint;
90
+ return;
91
+ }
92
+ const snapshot = buildSnapshot();
93
+ const fingerprint = snapshotFingerprint(snapshot);
94
+ if (!force && fingerprint === lastSentFingerprint)
95
+ return;
96
+ sendingGeneration = generation;
97
+ let retryDelayMs = null;
98
+ try {
99
+ const result = await cloudClientService.core.supportProfile.update(snapshot);
100
+ if (generation !== syncGeneration || !unsubscribe)
101
+ return;
102
+ consecutiveSendFailures = 0;
103
+ retryDelayMs = retryDelayForSupportProfileResult(result);
104
+ if (retryDelayMs === null) {
105
+ lastSentFingerprint = fingerprint;
106
+ if (queuedFingerprint === fingerprint)
107
+ queuedFingerprint = null;
108
+ if (retryTimer !== null)
109
+ BgTimer.clearTimeout(retryTimer);
110
+ retryTimer = null;
111
+ }
112
+ }
113
+ catch (error) {
114
+ if (generation !== syncGeneration || !unsubscribe)
115
+ return;
116
+ consecutiveSendFailures += 1;
117
+ retryDelayMs = retryDelayForSendFailure(consecutiveSendFailures);
118
+ console.warn(`supportProfile: Cloud V2 update failed (retry in ${Math.round(retryDelayMs / 1_000)}s):`, error instanceof Error ? error.message : error);
119
+ }
120
+ finally {
121
+ const generationIsActive = generation === syncGeneration && sendingGeneration === generation && Boolean(unsubscribe);
122
+ if (generationIsActive) {
123
+ sendingGeneration = null;
124
+ if (retryDelayMs !== null) {
125
+ if (retryTimer !== null)
126
+ BgTimer.clearTimeout(retryTimer);
127
+ retryTimer = BgTimer.setTimeout(() => {
128
+ retryTimer = null;
129
+ void sendCurrentSnapshot(true, generation);
130
+ }, retryDelayMs);
131
+ }
132
+ else {
133
+ const currentFingerprint = snapshotFingerprint(buildSnapshot());
134
+ if (currentFingerprint !== lastSentFingerprint) {
135
+ queuedFingerprint = currentFingerprint;
136
+ if (retryTimer === null)
137
+ armDebounce(generation);
138
+ }
139
+ }
140
+ }
141
+ }
142
+ }
143
+ export function retryDelayForSupportProfileResult(result) {
144
+ if (result.status === "accepted" || result.status === "deduplicated")
145
+ return null;
146
+ return RETRY_MS;
147
+ }
148
+ /**
149
+ * Support freshness is not worth an aggressive retry loop. A snapshot the
150
+ * server keeps rejecting (skewed clock, deleted account, signed-out host)
151
+ * backs off exponentially until it converges on the heartbeat cadence.
152
+ */
153
+ export function retryDelayForSendFailure(consecutiveFailures) {
154
+ return Math.min(HEARTBEAT_MS, RETRY_MS * 2 ** Math.min(Math.max(consecutiveFailures, 1) - 1, 10));
155
+ }
156
+ export function buildSnapshot(observedAt = new Date()) {
157
+ const glasses = useGlassesStore.getState();
158
+ const device = {
159
+ hardwareId: optional(glasses.serialNumber),
160
+ model: optional(glasses.deviceModel),
161
+ androidVersion: optional(glasses.androidVersion),
162
+ firmwareVersion: optional(glasses.firmwareVersion),
163
+ mtkFirmwareVersion: optional(glasses.mtkFirmwareVersion),
164
+ besFirmwareVersion: optional(glasses.besFirmwareVersion),
165
+ appVersion: optional(glasses.appVersion),
166
+ buildNumber: optional(glasses.buildNumber),
167
+ };
168
+ const hasDevice = Object.values(device).some(Boolean);
169
+ const constants = Constants;
170
+ return {
171
+ observedAt: observedAt.toISOString(),
172
+ host: {
173
+ appVersion: optional(constants.nativeAppVersion ?? Constants.expoConfig?.version),
174
+ appBuild: optional(constants.nativeBuildVersion),
175
+ engineVersion: optional(ENGINE_VERSION),
176
+ bluetoothSdkVersion: optional(BLUETOOTH_SDK_VERSION),
177
+ phonePlatform: Platform.OS === "ios" || Platform.OS === "android" ? Platform.OS : "unknown",
178
+ phoneModel: optional(Device.modelName),
179
+ phoneOsVersion: optional(Platform.OS === "android"
180
+ ? String(Platform.constants?.Release ?? Platform.Version)
181
+ : String(Platform.Version)),
182
+ connectionState: glasses.connection.state,
183
+ ...(lastFailure ? { failureCode: lastFailure.code, failureStage: lastFailure.stage } : {}),
184
+ },
185
+ ...(hasDevice ? { device } : {}),
186
+ };
187
+ }
188
+ /** Record only normalized connection failures; arbitrary exception messages never leave the phone. */
189
+ export function recordSupportProfileConnectionFailure(error, stage) {
190
+ const rawCode = typeof error === "object" && error && "code" in error ? String(error.code ?? "") : "";
191
+ const message = error instanceof Error ? `${error.name} ${error.message}`.toLowerCase() : "";
192
+ const code = /^[a-zA-Z0-9_.-]{1,64}$/.test(rawCode)
193
+ ? rawCode.toLowerCase()
194
+ : message.includes("permission")
195
+ ? "permission_denied"
196
+ : message.includes("bluetooth") && (message.includes("off") || message.includes("unavailable"))
197
+ ? "bluetooth_unavailable"
198
+ : message.includes("not found") || message.includes("no default")
199
+ ? "device_not_found"
200
+ : message.includes("timeout")
201
+ ? "connect_timeout"
202
+ : "connect_failed";
203
+ lastFailure = { code, stage: stage.replace(/[^a-zA-Z0-9_.-]/g, "_").slice(0, 64) };
204
+ scheduleMeaningfulUpdate();
205
+ }
206
+ export function snapshotFingerprint(snapshot) {
207
+ return JSON.stringify({ host: snapshot.host, device: snapshot.device });
208
+ }
209
+ function optional(value) {
210
+ const trimmed = value?.trim();
211
+ return trimmed ? trimmed.slice(0, 128) : undefined;
212
+ }
213
+ //# sourceMappingURL=SupportProfileSync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SupportProfileSync.js","sourceRoot":"","sources":["../../src/services/SupportProfileSync.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAA;AACtC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAA;AAGrC,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAA;AACjD,OAAO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,OAAO,IAAI,CAAC,SAAS,CAAC,EAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAC,CAAC,CAAA;AACvE,CAAC;AAED,SAAS,QAAQ,CAAC,KAAgC;IAChD,MAAM,OAAO,GAAG,KAAK,EAAE,IAAI,EAAE,CAAA;IAC7B,OAAO,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AACpD,CAAC","sourcesContent":["import Constants from \"expo-constants\"\nimport * as Device from \"expo-device\"\nimport {Platform} from \"react-native\"\nimport type {SupportStateInput} from \"@mentra/cloud-client\"\n\nimport {useGlassesStore} from \"../stores/glasses\"\nimport {BgTimer} from \"../utils/timers\"\nimport {cloudClientService} from \"./CloudClientService\"\n\nconst ENGINE_VERSION = (require(\"../../package.json\") as {version?: string}).version\nconst BLUETOOTH_SDK_VERSION = (require(\"@mentra/bluetooth-sdk/package.json\") as {version?: string}).version\nconst DEBOUNCE_MS = 2_000\nconst RETRY_MS = 30_000\nconst HEARTBEAT_MS = 6 * 60 * 60_000\n\nlet unsubscribe: (() => void) | null = null\nlet debounceTimer: number | null = null\nlet retryTimer: number | null = null\nlet heartbeatTimer: number | null = null\nlet lastSentFingerprint: string | null = null\nlet queuedFingerprint: string | null = null\nlet sendingGeneration: number | null = null\nlet syncGeneration = 0\nlet consecutiveSendFailures = 0\nlet lastFailure: {code: string; stage: string} | null = null\nlet lastConnectionState: string | null = null\n\n/**\n * Keep Cloud V2's canonical support snapshot current without creating an event\n * stream from noisy store updates. Only the explicitly selected fields below\n * leave the phone; Wi-Fi, Bluetooth addresses, location and diagnostics do not.\n */\nexport function startSupportProfileSync(): void {\n if (unsubscribe) return\n const generation = ++syncGeneration\n lastConnectionState = useGlassesStore.getState().connection.state\n unsubscribe = useGlassesStore.subscribe(() => handleGlassesStoreChange(generation))\n heartbeatTimer = BgTimer.setInterval(() => void sendCurrentSnapshot(true, generation), HEARTBEAT_MS)\n void sendCurrentSnapshot(true, generation)\n}\n\nexport function stopSupportProfileSync(): void {\n syncGeneration += 1\n unsubscribe?.()\n unsubscribe = null\n if (debounceTimer !== null) BgTimer.clearTimeout(debounceTimer)\n if (retryTimer !== null) BgTimer.clearTimeout(retryTimer)\n if (heartbeatTimer !== null) BgTimer.clearInterval(heartbeatTimer)\n debounceTimer = null\n retryTimer = null\n heartbeatTimer = null\n lastSentFingerprint = null\n queuedFingerprint = null\n sendingGeneration = null\n consecutiveSendFailures = 0\n lastFailure = null\n lastConnectionState = null\n}\n\nfunction handleGlassesStoreChange(generation: number): void {\n if (!unsubscribe || generation !== syncGeneration) return\n const connectionState = useGlassesStore.getState().connection.state\n if (connectionState === \"connected\" && lastConnectionState !== \"connected\") lastFailure = null\n lastConnectionState = connectionState\n scheduleMeaningfulUpdate(generation)\n}\n\nfunction scheduleMeaningfulUpdate(generation = syncGeneration): void {\n if (!unsubscribe || generation !== syncGeneration) return\n const fingerprint = snapshotFingerprint(buildSnapshot())\n if (fingerprint === lastSentFingerprint) return\n queuedFingerprint = fingerprint\n armDebounce(generation)\n}\n\nfunction armDebounce(generation: number): void {\n if (debounceTimer !== null) BgTimer.clearTimeout(debounceTimer)\n debounceTimer = BgTimer.setTimeout(() => {\n debounceTimer = null\n void sendCurrentSnapshot(false, generation)\n }, DEBOUNCE_MS)\n}\n\nasync function sendCurrentSnapshot(force: boolean, generation = syncGeneration): Promise<void> {\n if (!unsubscribe || generation !== syncGeneration) return\n if (sendingGeneration === generation) {\n const fingerprint = snapshotFingerprint(buildSnapshot())\n if (fingerprint !== lastSentFingerprint) queuedFingerprint = fingerprint\n return\n }\n const snapshot = buildSnapshot()\n const fingerprint = snapshotFingerprint(snapshot)\n if (!force && fingerprint === lastSentFingerprint) return\n\n sendingGeneration = generation\n let retryDelayMs: number | null = null\n try {\n const result = await cloudClientService.core.supportProfile.update(snapshot)\n if (generation !== syncGeneration || !unsubscribe) return\n consecutiveSendFailures = 0\n retryDelayMs = retryDelayForSupportProfileResult(result)\n if (retryDelayMs === null) {\n lastSentFingerprint = fingerprint\n if (queuedFingerprint === fingerprint) queuedFingerprint = null\n if (retryTimer !== null) BgTimer.clearTimeout(retryTimer)\n retryTimer = null\n }\n } catch (error) {\n if (generation !== syncGeneration || !unsubscribe) return\n consecutiveSendFailures += 1\n retryDelayMs = retryDelayForSendFailure(consecutiveSendFailures)\n console.warn(\n `supportProfile: Cloud V2 update failed (retry in ${Math.round(retryDelayMs / 1_000)}s):`,\n error instanceof Error ? error.message : error,\n )\n } finally {\n const generationIsActive = generation === syncGeneration && sendingGeneration === generation && Boolean(unsubscribe)\n if (generationIsActive) {\n sendingGeneration = null\n if (retryDelayMs !== null) {\n if (retryTimer !== null) BgTimer.clearTimeout(retryTimer)\n retryTimer = BgTimer.setTimeout(() => {\n retryTimer = null\n void sendCurrentSnapshot(true, generation)\n }, retryDelayMs)\n } else {\n const currentFingerprint = snapshotFingerprint(buildSnapshot())\n if (currentFingerprint !== lastSentFingerprint) {\n queuedFingerprint = currentFingerprint\n if (retryTimer === null) armDebounce(generation)\n }\n }\n }\n }\n}\n\nexport function retryDelayForSupportProfileResult(result: {\n status: \"accepted\" | \"deduplicated\" | \"stale\"\n}): number | null {\n if (result.status === \"accepted\" || result.status === \"deduplicated\") return null\n return RETRY_MS\n}\n\n/**\n * Support freshness is not worth an aggressive retry loop. A snapshot the\n * server keeps rejecting (skewed clock, deleted account, signed-out host)\n * backs off exponentially until it converges on the heartbeat cadence.\n */\nexport function retryDelayForSendFailure(consecutiveFailures: number): number {\n return Math.min(HEARTBEAT_MS, RETRY_MS * 2 ** Math.min(Math.max(consecutiveFailures, 1) - 1, 10))\n}\n\nexport function buildSnapshot(observedAt = new Date()): SupportStateInput {\n const glasses = useGlassesStore.getState()\n const device = {\n hardwareId: optional(glasses.serialNumber),\n model: optional(glasses.deviceModel),\n androidVersion: optional(glasses.androidVersion),\n firmwareVersion: optional(glasses.firmwareVersion),\n mtkFirmwareVersion: optional(glasses.mtkFirmwareVersion),\n besFirmwareVersion: optional(glasses.besFirmwareVersion),\n appVersion: optional(glasses.appVersion),\n buildNumber: optional(glasses.buildNumber),\n }\n const hasDevice = Object.values(device).some(Boolean)\n const constants = Constants as typeof Constants & {\n nativeAppVersion?: string | null\n nativeBuildVersion?: string | null\n }\n return {\n observedAt: observedAt.toISOString(),\n host: {\n appVersion: optional(constants.nativeAppVersion ?? Constants.expoConfig?.version),\n appBuild: optional(constants.nativeBuildVersion),\n engineVersion: optional(ENGINE_VERSION),\n bluetoothSdkVersion: optional(BLUETOOTH_SDK_VERSION),\n phonePlatform: Platform.OS === \"ios\" || Platform.OS === \"android\" ? Platform.OS : \"unknown\",\n phoneModel: optional(Device.modelName),\n phoneOsVersion: optional(\n Platform.OS === \"android\"\n ? String((Platform.constants as {Release?: string} | undefined)?.Release ?? Platform.Version)\n : String(Platform.Version),\n ),\n connectionState: glasses.connection.state,\n ...(lastFailure ? {failureCode: lastFailure.code, failureStage: lastFailure.stage} : {}),\n },\n ...(hasDevice ? {device} : {}),\n }\n}\n\n/** Record only normalized connection failures; arbitrary exception messages never leave the phone. */\nexport function recordSupportProfileConnectionFailure(error: unknown, stage: string): void {\n const rawCode =\n typeof error === \"object\" && error && \"code\" in error ? String((error as {code?: unknown}).code ?? \"\") : \"\"\n const message = error instanceof Error ? `${error.name} ${error.message}`.toLowerCase() : \"\"\n const code = /^[a-zA-Z0-9_.-]{1,64}$/.test(rawCode)\n ? rawCode.toLowerCase()\n : message.includes(\"permission\")\n ? \"permission_denied\"\n : message.includes(\"bluetooth\") && (message.includes(\"off\") || message.includes(\"unavailable\"))\n ? \"bluetooth_unavailable\"\n : message.includes(\"not found\") || message.includes(\"no default\")\n ? \"device_not_found\"\n : message.includes(\"timeout\")\n ? \"connect_timeout\"\n : \"connect_failed\"\n lastFailure = {code, stage: stage.replace(/[^a-zA-Z0-9_.-]/g, \"_\").slice(0, 64)}\n scheduleMeaningfulUpdate()\n}\n\nexport function snapshotFingerprint(snapshot: SupportStateInput): string {\n return JSON.stringify({host: snapshot.host, device: snapshot.device})\n}\n\nfunction optional(value: string | null | undefined): string | undefined {\n const trimmed = value?.trim()\n return trimmed ? trimmed.slice(0, 128) : undefined\n}\n"]}
@@ -0,0 +1,5 @@
1
+ /** Convert display-oriented text into plain words before TTS synthesis. */
2
+ export declare function sanitizeTtsText(text: string): string;
3
+ /** Prepare an already-trimmed sentence list while preserving the exact-text opt-out. */
4
+ export declare function prepareTtsSentences(sentences: string[], enableSanitization?: boolean): string[];
5
+ //# sourceMappingURL=TtsTextSanitizer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TtsTextSanitizer.d.ts","sourceRoot":"","sources":["../../src/services/TtsTextSanitizer.ts"],"names":[],"mappings":"AAQA,2EAA2E;AAC3E,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAmCpD;AAED,wFAAwF;AACxF,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,kBAAkB,UAAO,GAAG,MAAM,EAAE,CAkB5F"}
@@ -0,0 +1,61 @@
1
+ const HTML_ENTITIES = {
2
+ "&amp;": "&",
3
+ "&lt;": "<",
4
+ "&gt;": ">",
5
+ "&quot;": '"',
6
+ "&#39;": "'",
7
+ };
8
+ /** Convert display-oriented text into plain words before TTS synthesis. */
9
+ export function sanitizeTtsText(text) {
10
+ let speech = text.replace(/&(amp|lt|gt|quot|#39);/gi, (entity) => HTML_ENTITIES[entity.toLowerCase()] ?? entity);
11
+ speech = speech
12
+ .replace(/<say-as\b[^>]*>(.*?)<\/say-as>/gis, "$1")
13
+ .replace(/<\/?[a-z][a-z0-9-]*(?:\s[^<>]*?)?\s*\/?>/gi, " ")
14
+ .replace(/\[([^\]]+)]\([^)]+\)/g, "$1")
15
+ .replace(/`([^`]*)`/g, "$1")
16
+ .replace(/(-?\d+(?:[.,]\d+)?)\s*(?:°\s*f\b|℉)/gi, "$1 degrees Fahrenheit")
17
+ .replace(/(-?\d+(?:[.,]\d+)?)\s*(?:°\s*c\b|℃)/gi, "$1 degrees Celsius")
18
+ .replace(/(-?\d+(?:[.,]\d+)?)\s*°/g, "$1 degrees")
19
+ .replace(/<=/g, " less than or equal to ")
20
+ .replace(/>=/g, " greater than or equal to ")
21
+ .replace(/</g, " less than ")
22
+ .replace(/>/g, " greater than ")
23
+ .replace(/[[\]{}()]/g, " ")
24
+ .replace(/(degrees Fahrenheit)\s+(-?\d+(?:[.,]\d+)? degrees Celsius)\b/gi, "$1 or $2")
25
+ .replace(/(degrees Celsius)\s+(-?\d+(?:[.,]\d+)? degrees Fahrenheit)\b/gi, "$1 or $2")
26
+ .replace(/&/g, " and ")
27
+ .replace(/\+/g, " plus ")
28
+ .replace(/=/g, " equals ")
29
+ .replace(/#/g, " hash ")
30
+ .replace(/@/g, " at ")
31
+ .replace(/%/g, " percent ")
32
+ .replace(/\\/g, " backslash ")
33
+ .replace(/\//g, (slash, offset, source) => {
34
+ const numericSeparator = /\d/.test(source[offset - 1] ?? "") && /\d/.test(source[offset + 1] ?? "");
35
+ return numericSeparator ? slash : " slash ";
36
+ })
37
+ .replace(/\*/g, " star ");
38
+ return speech
39
+ .replace(/\s+([,.;:!?])/g, "$1")
40
+ .replace(/\s+/g, " ")
41
+ .trim();
42
+ }
43
+ /** Prepare an already-trimmed sentence list while preserving the exact-text opt-out. */
44
+ export function prepareTtsSentences(sentences, enableSanitization = true) {
45
+ if (!enableSanitization)
46
+ return sentences;
47
+ const sanitized = sentences.map((sentence) => sanitizeTtsText(sentence)).filter(Boolean);
48
+ return sanitized.map((sentence, index) => {
49
+ const previous = sanitized[index - 1];
50
+ if (!previous)
51
+ return sentence;
52
+ const followsFahrenheit = /degrees Fahrenheit[,.;:!?]?$/i.test(previous);
53
+ const followsCelsius = /degrees Celsius[,.;:!?]?$/i.test(previous);
54
+ const startsWithFahrenheit = /^-?\d+(?:[.,]\d+)? degrees Fahrenheit\b/i.test(sentence);
55
+ const startsWithCelsius = /^-?\d+(?:[.,]\d+)? degrees Celsius\b/i.test(sentence);
56
+ return (followsFahrenheit && startsWithCelsius) || (followsCelsius && startsWithFahrenheit)
57
+ ? `or ${sentence}`
58
+ : sentence;
59
+ });
60
+ }
61
+ //# sourceMappingURL=TtsTextSanitizer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TtsTextSanitizer.js","sourceRoot":"","sources":["../../src/services/TtsTextSanitizer.ts"],"names":[],"mappings":"AAAA,MAAM,aAAa,GAA2B;IAC5C,OAAO,EAAE,GAAG;IACZ,MAAM,EAAE,GAAG;IACX,MAAM,EAAE,GAAG;IACX,QAAQ,EAAE,GAAG;IACb,OAAO,EAAE,GAAG;CACb,CAAA;AAED,2EAA2E;AAC3E,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,IAAI,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,0BAA0B,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,IAAI,MAAM,CAAC,CAAA;IAEhH,MAAM,GAAG,MAAM;SACZ,OAAO,CAAC,mCAAmC,EAAE,IAAI,CAAC;SAClD,OAAO,CAAC,4CAA4C,EAAE,GAAG,CAAC;SAC1D,OAAO,CAAC,uBAAuB,EAAE,IAAI,CAAC;SACtC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC;SAC3B,OAAO,CAAC,uCAAuC,EAAE,uBAAuB,CAAC;SACzE,OAAO,CAAC,uCAAuC,EAAE,oBAAoB,CAAC;SACtE,OAAO,CAAC,0BAA0B,EAAE,YAAY,CAAC;SACjD,OAAO,CAAC,KAAK,EAAE,yBAAyB,CAAC;SACzC,OAAO,CAAC,KAAK,EAAE,4BAA4B,CAAC;SAC5C,OAAO,CAAC,IAAI,EAAE,aAAa,CAAC;SAC5B,OAAO,CAAC,IAAI,EAAE,gBAAgB,CAAC;SAC/B,OAAO,CAAC,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AO,CAAC,CAAA;IAExF,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE;QACvC,MAAM,QAAQ,GAAG,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC,CAAA;QACrC,IAAI,CAAC,QAAQ;YAAE,OAAO,QAAQ,CAAA;QAE9B,MAAM,iBAAiB,GAAG,+BAA+B,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACxE,MAAM,cAAc,GAAG,4BAA4B,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAClE,MAAM,oBAAoB,GAAG,0CAA0C,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACtF,MAAM,iBAAiB,GAAG,uCAAuC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAEhF,OAAO,CAAC,iBAAiB,IAAI,iBAAiB,CAAC,IAAI,CAAC,cAAc,IAAI,oBAAoB,CAAC;YACzF,CAAC,CAAC,MAAM,QAAQ,EAAE;YAClB,CAAC,CAAC,QAAQ,CAAA;IACd,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["const HTML_ENTITIES: Record<string, string> = {\n \"&amp;\": \"&\",\n \"&lt;\": \"<\",\n \"&gt;\": \">\",\n \"&quot;\": '\"',\n \"&#39;\": \"'\",\n}\n\n/** Convert display-oriented text into plain words before TTS synthesis. */\nexport function sanitizeTtsText(text: string): string {\n let speech = text.replace(/&(amp|lt|gt|quot|#39);/gi, (entity) => HTML_ENTITIES[entity.toLowerCase()] ?? entity)\n\n speech = speech\n .replace(/<say-as\\b[^>]*>(.*?)<\\/say-as>/gis, \"$1\")\n .replace(/<\\/?[a-z][a-z0-9-]*(?:\\s[^<>]*?)?\\s*\\/?>/gi, \" \")\n .replace(/\\[([^\\]]+)]\\([^)]+\\)/g, \"$1\")\n .replace(/`([^`]*)`/g, \"$1\")\n .replace(/(-?\\d+(?:[.,]\\d+)?)\\s*(?:°\\s*f\\b|℉)/gi, \"$1 degrees Fahrenheit\")\n .replace(/(-?\\d+(?:[.,]\\d+)?)\\s*(?:°\\s*c\\b|℃)/gi, \"$1 degrees Celsius\")\n .replace(/(-?\\d+(?:[.,]\\d+)?)\\s*°/g, \"$1 degrees\")\n .replace(/<=/g, \" less than or equal to \")\n .replace(/>=/g, \" greater than or equal to \")\n .replace(/</g, \" less than \")\n .replace(/>/g, \" greater than \")\n .replace(/[[\\]{}()]/g, \" \")\n .replace(/(degrees Fahrenheit)\\s+(-?\\d+(?:[.,]\\d+)? degrees Celsius)\\b/gi, \"$1 or $2\")\n .replace(/(degrees Celsius)\\s+(-?\\d+(?:[.,]\\d+)? degrees Fahrenheit)\\b/gi, \"$1 or $2\")\n .replace(/&/g, \" and \")\n .replace(/\\+/g, \" plus \")\n .replace(/=/g, \" equals \")\n .replace(/#/g, \" hash \")\n .replace(/@/g, \" at \")\n .replace(/%/g, \" percent \")\n .replace(/\\\\/g, \" backslash \")\n .replace(/\\//g, (slash, offset, source) => {\n const numericSeparator = /\\d/.test(source[offset - 1] ?? \"\") && /\\d/.test(source[offset + 1] ?? \"\")\n return numericSeparator ? slash : \" slash \"\n })\n .replace(/\\*/g, \" star \")\n\n return speech\n .replace(/\\s+([,.;:!?])/g, \"$1\")\n .replace(/\\s+/g, \" \")\n .trim()\n}\n\n/** Prepare an already-trimmed sentence list while preserving the exact-text opt-out. */\nexport function prepareTtsSentences(sentences: string[], enableSanitization = true): string[] {\n if (!enableSanitization) return sentences\n\n const sanitized = sentences.map((sentence) => sanitizeTtsText(sentence)).filter(Boolean)\n\n return sanitized.map((sentence, index) => {\n const previous = sanitized[index - 1]\n if (!previous) return sentence\n\n const followsFahrenheit = /degrees Fahrenheit[,.;:!?]?$/i.test(previous)\n const followsCelsius = /degrees Celsius[,.;:!?]?$/i.test(previous)\n const startsWithFahrenheit = /^-?\\d+(?:[.,]\\d+)? degrees Fahrenheit\\b/i.test(sentence)\n const startsWithCelsius = /^-?\\d+(?:[.,]\\d+)? degrees Celsius\\b/i.test(sentence)\n\n return (followsFahrenheit && startsWithCelsius) || (followsCelsius && startsWithFahrenheit)\n ? `or ${sentence}`\n : sentence\n })\n}\n"]}
@@ -0,0 +1,17 @@
1
+ export interface WifiAdbRequestDependencies {
2
+ isSystemPackage: (packageName: string) => boolean;
3
+ setWifiAdbState: (enabled: boolean) => Promise<void>;
4
+ }
5
+ export type WifiAdbRequestErrorCode = "NOT_PERMITTED" | "INVALID_ARGUMENT" | "INTERNAL";
6
+ export type WifiAdbRequestResult = {
7
+ ok: true;
8
+ } | {
9
+ ok: false;
10
+ error: {
11
+ code: WifiAdbRequestErrorCode;
12
+ message: string;
13
+ };
14
+ };
15
+ /** Apply the SYSTEM-only Wi-Fi ADB policy before calling the native SDK. */
16
+ export declare function handleWifiAdbRequest(packageName: string, payload: Record<string, unknown>, dependencies: WifiAdbRequestDependencies): Promise<WifiAdbRequestResult>;
17
+ //# sourceMappingURL=WifiAdbRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WifiAdbRequest.d.ts","sourceRoot":"","sources":["../../src/services/WifiAdbRequest.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,0BAA0B;IACzC,eAAe,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAA;IACjD,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACrD;AAED,MAAM,MAAM,uBAAuB,GAAG,eAAe,GAAG,kBAAkB,GAAG,UAAU,CAAA;AAEvF,MAAM,MAAM,oBAAoB,GAC5B;IAAC,EAAE,EAAE,IAAI,CAAA;CAAC,GACV;IACE,EAAE,EAAE,KAAK,CAAA;IACT,KAAK,EAAE;QAAC,IAAI,EAAE,uBAAuB,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAC,CAAA;CACxD,CAAA;AAEL,4EAA4E;AAC5E,wBAAsB,oBAAoB,CACxC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,YAAY,EAAE,0BAA0B,GACvC,OAAO,CAAC,oBAAoB,CAAC,CAiC/B"}
@@ -0,0 +1,35 @@
1
+ /** Apply the SYSTEM-only Wi-Fi ADB policy before calling the native SDK. */
2
+ export async function handleWifiAdbRequest(packageName, payload, dependencies) {
3
+ if (!dependencies.isSystemPackage(packageName)) {
4
+ return {
5
+ ok: false,
6
+ error: {
7
+ code: "NOT_PERMITTED",
8
+ message: "setWifiAdbState is restricted to system apps",
9
+ },
10
+ };
11
+ }
12
+ if (typeof payload.enabled !== "boolean") {
13
+ return {
14
+ ok: false,
15
+ error: {
16
+ code: "INVALID_ARGUMENT",
17
+ message: "enabled must be a boolean",
18
+ },
19
+ };
20
+ }
21
+ try {
22
+ await dependencies.setWifiAdbState(payload.enabled);
23
+ return { ok: true };
24
+ }
25
+ catch (error) {
26
+ return {
27
+ ok: false,
28
+ error: {
29
+ code: "INTERNAL",
30
+ message: error instanceof Error ? error.message : "Wi-Fi ADB error",
31
+ },
32
+ };
33
+ }
34
+ }
35
+ //# sourceMappingURL=WifiAdbRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WifiAdbRequest.js","sourceRoot":"","sources":["../../src/services/WifiAdbRequest.ts"],"names":[],"mappings":"AAcA,4EAA4E;AAC5E,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,WAAmB,EACnB,OAAgC,EAChC,YAAwC;IAExC,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,WAAW,CAAC,EAAE,CAAC;QAC/C,OAAO;YACL,EAAE,EAAE,KAAK;YACT,KAAK,EAAE;gBACL,IAAI,EAAE,eAAe;gBACrB,OAAO,EAAE,8CAA8C;aACxD;SACF,CAAA;IACH,CAAC;IAED,IAAI,OAAO,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QACzC,OAAO;YACL,EAAE,EAAE,KAAK;YACT,KAAK,EAAE;gBACL,IAAI,EAAE,kBAAkB;gBACxB,OAAO,EAAE,2BAA2B;aACrC;SACF,CAAA;IACH,CAAC;IAED,IAAI,CAAC;QACH,MAAM,YAAY,CAAC,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QACnD,OAAO,EAAC,EAAE,EAAE,IAAI,EAAC,CAAA;IACnB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,EAAE,EAAE,KAAK;YACT,KAAK,EAAE;gBACL,IAAI,EAAE,UAAU;gBAChB,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,iBAAiB;aACpE;SACF,CAAA;IACH,CAAC;AACH,CAAC","sourcesContent":["export interface WifiAdbRequestDependencies {\n isSystemPackage: (packageName: string) => boolean\n setWifiAdbState: (enabled: boolean) => Promise<void>\n}\n\nexport type WifiAdbRequestErrorCode = \"NOT_PERMITTED\" | \"INVALID_ARGUMENT\" | \"INTERNAL\"\n\nexport type WifiAdbRequestResult =\n | {ok: true}\n | {\n ok: false\n error: {code: WifiAdbRequestErrorCode; message: string}\n }\n\n/** Apply the SYSTEM-only Wi-Fi ADB policy before calling the native SDK. */\nexport async function handleWifiAdbRequest(\n packageName: string,\n payload: Record<string, unknown>,\n dependencies: WifiAdbRequestDependencies,\n): Promise<WifiAdbRequestResult> {\n if (!dependencies.isSystemPackage(packageName)) {\n return {\n ok: false,\n error: {\n code: \"NOT_PERMITTED\",\n message: \"setWifiAdbState is restricted to system apps\",\n },\n }\n }\n\n if (typeof payload.enabled !== \"boolean\") {\n return {\n ok: false,\n error: {\n code: \"INVALID_ARGUMENT\",\n message: \"enabled must be a boolean\",\n },\n }\n }\n\n try {\n await dependencies.setWifiAdbState(payload.enabled)\n return {ok: true}\n } catch (error) {\n return {\n ok: false,\n error: {\n code: \"INTERNAL\",\n message: error instanceof Error ? error.message : \"Wi-Fi ADB error\",\n },\n }\n }\n}\n"]}
@@ -172,9 +172,12 @@ export declare class AsgCameraApiClient {
172
172
  primaryPath: string;
173
173
  bracketPaths: string[];
174
174
  sidecarPath?: string;
175
+ thumbnailPath?: string;
175
176
  }>;
176
177
  /** Previous direct-to-final implementation kept for binary-source compatibility only. */
177
178
  private downloadCaptureLegacyUnsafe;
179
+ /** Download an on-demand video thumbnail while the source capture is still on the glasses. */
180
+ private downloadVideoThumbnail;
178
181
  /**
179
182
  * Delete files from server
180
183
  */
@@ -1 +1 @@
1
- {"version":3,"file":"asgCameraApi.d.ts","sourceRoot":"","sources":["../../../src/services/asg/asgCameraApi.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAC,SAAS,EAAE,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,cAAc,EAAC,MAAM,iBAAiB,CAAA;AAStG,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAA;IACnB,eAAe,EAAE,OAAO,CAAA;IACxB,sBAAsB,EAAE,OAAO,CAAA;IAC/B,IAAI,EAAE,OAAO,CAAA;IACb,MAAM,EAAE,OAAO,CAAA;IACf,iBAAiB,EAAE,OAAO,CAAA;IAC1B,cAAc,EAAE,OAAO,CAAA;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,yBAAyB,CAAC,EAAE,MAAM,CAAA;IAClC,sBAAsB,CAAC,EAAE,MAAM,CAAA;CAChC;AAED,KAAK,kBAAkB,GAAG;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE;QACJ,WAAW,EAAE,CAAC,CAAA;QACd,QAAQ,EAAE,YAAY,EAAE,CAAA;QACxB,QAAQ,EAAE,OAAO,CAAA;QACjB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QAC3B,WAAW,EAAE,MAAM,CAAA;QACnB,WAAW,EAAE,MAAM,CAAA;KACpB,CAAA;CACF,CAAA;AAED,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,IAAI,CAAQ;IACpB,OAAO,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