@mentra/miniapp 0.3.0-beta.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 (277) hide show
  1. package/README.md +259 -0
  2. package/dist/background/index.d.ts +60 -0
  3. package/dist/background/index.d.ts.map +1 -0
  4. package/dist/background/index.js +25 -0
  5. package/dist/background/index.js.map +1 -0
  6. package/dist/background/register.d.ts +38 -0
  7. package/dist/background/register.d.ts.map +1 -0
  8. package/dist/background/register.js +75 -0
  9. package/dist/background/register.js.map +1 -0
  10. package/dist/dev-reload.d.ts +21 -0
  11. package/dist/dev-reload.d.ts.map +1 -0
  12. package/dist/dev-reload.js +62 -0
  13. package/dist/dev-reload.js.map +1 -0
  14. package/dist/envelope.d.ts +23 -0
  15. package/dist/envelope.d.ts.map +1 -0
  16. package/dist/envelope.js +47 -0
  17. package/dist/envelope.js.map +1 -0
  18. package/dist/globals.d.ts +54 -0
  19. package/dist/globals.d.ts.map +1 -0
  20. package/dist/globals.js +12 -0
  21. package/dist/globals.js.map +1 -0
  22. package/dist/index.d.ts +59 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +31 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/modules/actions.d.ts +54 -0
  27. package/dist/modules/actions.d.ts.map +1 -0
  28. package/dist/modules/actions.js +122 -0
  29. package/dist/modules/actions.js.map +1 -0
  30. package/dist/modules/auth.d.ts +25 -0
  31. package/dist/modules/auth.d.ts.map +1 -0
  32. package/dist/modules/auth.js +52 -0
  33. package/dist/modules/auth.js.map +1 -0
  34. package/dist/modules/base64.d.ts +16 -0
  35. package/dist/modules/base64.d.ts.map +1 -0
  36. package/dist/modules/base64.js +92 -0
  37. package/dist/modules/base64.js.map +1 -0
  38. package/dist/modules/blob.d.ts +161 -0
  39. package/dist/modules/blob.d.ts.map +1 -0
  40. package/dist/modules/blob.js +277 -0
  41. package/dist/modules/blob.js.map +1 -0
  42. package/dist/modules/camera.d.ts +170 -0
  43. package/dist/modules/camera.d.ts.map +1 -0
  44. package/dist/modules/camera.js +116 -0
  45. package/dist/modules/camera.js.map +1 -0
  46. package/dist/modules/cloud.d.ts +34 -0
  47. package/dist/modules/cloud.d.ts.map +1 -0
  48. package/dist/modules/cloud.js +70 -0
  49. package/dist/modules/cloud.js.map +1 -0
  50. package/dist/modules/dashboard.d.ts +16 -0
  51. package/dist/modules/dashboard.d.ts.map +1 -0
  52. package/dist/modules/dashboard.js +27 -0
  53. package/dist/modules/dashboard.js.map +1 -0
  54. package/dist/modules/display.d.ts +106 -0
  55. package/dist/modules/display.d.ts.map +1 -0
  56. package/dist/modules/display.js +57 -0
  57. package/dist/modules/display.js.map +1 -0
  58. package/dist/modules/events.d.ts +160 -0
  59. package/dist/modules/events.d.ts.map +1 -0
  60. package/dist/modules/events.js +168 -0
  61. package/dist/modules/events.js.map +1 -0
  62. package/dist/modules/glasses.d.ts +28 -0
  63. package/dist/modules/glasses.d.ts.map +1 -0
  64. package/dist/modules/glasses.js +39 -0
  65. package/dist/modules/glasses.js.map +1 -0
  66. package/dist/modules/heading.d.ts +16 -0
  67. package/dist/modules/heading.d.ts.map +1 -0
  68. package/dist/modules/heading.js +20 -0
  69. package/dist/modules/heading.js.map +1 -0
  70. package/dist/modules/imu.d.ts +31 -0
  71. package/dist/modules/imu.d.ts.map +1 -0
  72. package/dist/modules/imu.js +40 -0
  73. package/dist/modules/imu.js.map +1 -0
  74. package/dist/modules/input.d.ts +34 -0
  75. package/dist/modules/input.d.ts.map +1 -0
  76. package/dist/modules/input.js +50 -0
  77. package/dist/modules/input.js.map +1 -0
  78. package/dist/modules/led.d.ts +35 -0
  79. package/dist/modules/led.d.ts.map +1 -0
  80. package/dist/modules/led.js +39 -0
  81. package/dist/modules/led.js.map +1 -0
  82. package/dist/modules/location.d.ts +27 -0
  83. package/dist/modules/location.d.ts.map +1 -0
  84. package/dist/modules/location.js +35 -0
  85. package/dist/modules/location.js.map +1 -0
  86. package/dist/modules/mic.d.ts +44 -0
  87. package/dist/modules/mic.d.ts.map +1 -0
  88. package/dist/modules/mic.js +67 -0
  89. package/dist/modules/mic.js.map +1 -0
  90. package/dist/modules/miniapps.d.ts +72 -0
  91. package/dist/modules/miniapps.d.ts.map +1 -0
  92. package/dist/modules/miniapps.js +48 -0
  93. package/dist/modules/miniapps.js.map +1 -0
  94. package/dist/modules/navigation.d.ts +326 -0
  95. package/dist/modules/navigation.d.ts.map +1 -0
  96. package/dist/modules/navigation.js +386 -0
  97. package/dist/modules/navigation.js.map +1 -0
  98. package/dist/modules/permissions.d.ts +58 -0
  99. package/dist/modules/permissions.d.ts.map +1 -0
  100. package/dist/modules/permissions.js +66 -0
  101. package/dist/modules/permissions.js.map +1 -0
  102. package/dist/modules/phone.d.ts +95 -0
  103. package/dist/modules/phone.d.ts.map +1 -0
  104. package/dist/modules/phone.js +110 -0
  105. package/dist/modules/phone.js.map +1 -0
  106. package/dist/modules/pivots/engine.d.ts +169 -0
  107. package/dist/modules/pivots/engine.d.ts.map +1 -0
  108. package/dist/modules/pivots/engine.js +779 -0
  109. package/dist/modules/pivots/engine.js.map +1 -0
  110. package/dist/modules/pivots/geometry.d.ts +84 -0
  111. package/dist/modules/pivots/geometry.d.ts.map +1 -0
  112. package/dist/modules/pivots/geometry.js +371 -0
  113. package/dist/modules/pivots/geometry.js.map +1 -0
  114. package/dist/modules/pivots/instructions.d.ts +139 -0
  115. package/dist/modules/pivots/instructions.d.ts.map +1 -0
  116. package/dist/modules/pivots/instructions.js +280 -0
  117. package/dist/modules/pivots/instructions.js.map +1 -0
  118. package/dist/modules/speaker.d.ts +169 -0
  119. package/dist/modules/speaker.d.ts.map +1 -0
  120. package/dist/modules/speaker.js +251 -0
  121. package/dist/modules/speaker.js.map +1 -0
  122. package/dist/modules/storage.d.ts +50 -0
  123. package/dist/modules/storage.d.ts.map +1 -0
  124. package/dist/modules/storage.js +99 -0
  125. package/dist/modules/storage.js.map +1 -0
  126. package/dist/modules/stream.d.ts +129 -0
  127. package/dist/modules/stream.d.ts.map +1 -0
  128. package/dist/modules/stream.js +52 -0
  129. package/dist/modules/stream.js.map +1 -0
  130. package/dist/modules/system.d.ts +45 -0
  131. package/dist/modules/system.d.ts.map +1 -0
  132. package/dist/modules/system.js +42 -0
  133. package/dist/modules/system.js.map +1 -0
  134. package/dist/modules/transcription.d.ts +75 -0
  135. package/dist/modules/transcription.d.ts.map +1 -0
  136. package/dist/modules/transcription.js +106 -0
  137. package/dist/modules/transcription.js.map +1 -0
  138. package/dist/modules/translation.d.ts +59 -0
  139. package/dist/modules/translation.d.ts.map +1 -0
  140. package/dist/modules/translation.js +119 -0
  141. package/dist/modules/translation.js.map +1 -0
  142. package/dist/modules/ui.d.ts +186 -0
  143. package/dist/modules/ui.d.ts.map +1 -0
  144. package/dist/modules/ui.js +293 -0
  145. package/dist/modules/ui.js.map +1 -0
  146. package/dist/protocol.d.ts +299 -0
  147. package/dist/protocol.d.ts.map +1 -0
  148. package/dist/protocol.js +325 -0
  149. package/dist/protocol.js.map +1 -0
  150. package/dist/react/MentraProvider.d.ts +33 -0
  151. package/dist/react/MentraProvider.d.ts.map +1 -0
  152. package/dist/react/MentraProvider.js +15 -0
  153. package/dist/react/MentraProvider.js.map +1 -0
  154. package/dist/react/MiniappHeader.d.ts +44 -0
  155. package/dist/react/MiniappHeader.d.ts.map +1 -0
  156. package/dist/react/MiniappHeader.js +32 -0
  157. package/dist/react/MiniappHeader.js.map +1 -0
  158. package/dist/react/index.d.ts +13 -0
  159. package/dist/react/index.d.ts.map +1 -0
  160. package/dist/react/index.js +9 -0
  161. package/dist/react/index.js.map +1 -0
  162. package/dist/react/useCapabilities.d.ts +26 -0
  163. package/dist/react/useCapabilities.d.ts.map +1 -0
  164. package/dist/react/useCapabilities.js +27 -0
  165. package/dist/react/useCapabilities.js.map +1 -0
  166. package/dist/react/useCapsuleHeaderStyle.d.ts +27 -0
  167. package/dist/react/useCapsuleHeaderStyle.d.ts.map +1 -0
  168. package/dist/react/useCapsuleHeaderStyle.js +36 -0
  169. package/dist/react/useCapsuleHeaderStyle.js.map +1 -0
  170. package/dist/react/useColorScheme.d.ts +18 -0
  171. package/dist/react/useColorScheme.d.ts.map +1 -0
  172. package/dist/react/useColorScheme.js +24 -0
  173. package/dist/react/useColorScheme.js.map +1 -0
  174. package/dist/react/useConnected.d.ts +17 -0
  175. package/dist/react/useConnected.d.ts.map +1 -0
  176. package/dist/react/useConnected.js +39 -0
  177. package/dist/react/useConnected.js.map +1 -0
  178. package/dist/react/useRpc.d.ts +29 -0
  179. package/dist/react/useRpc.d.ts.map +1 -0
  180. package/dist/react/useRpc.js +82 -0
  181. package/dist/react/useRpc.js.map +1 -0
  182. package/dist/react/useSafeArea.d.ts +21 -0
  183. package/dist/react/useSafeArea.d.ts.map +1 -0
  184. package/dist/react/useSafeArea.js +22 -0
  185. package/dist/react/useSafeArea.js.map +1 -0
  186. package/dist/session.d.ts +312 -0
  187. package/dist/session.d.ts.map +1 -0
  188. package/dist/session.js +653 -0
  189. package/dist/session.js.map +1 -0
  190. package/dist/sub-path-types.test-d.d.ts +28 -0
  191. package/dist/sub-path-types.test-d.d.ts.map +1 -0
  192. package/dist/sub-path-types.test-d.js +37 -0
  193. package/dist/sub-path-types.test-d.js.map +1 -0
  194. package/dist/transport/auto.d.ts +35 -0
  195. package/dist/transport/auto.d.ts.map +1 -0
  196. package/dist/transport/auto.js +125 -0
  197. package/dist/transport/auto.js.map +1 -0
  198. package/dist/transport/dispatch.d.ts +43 -0
  199. package/dist/transport/dispatch.d.ts.map +1 -0
  200. package/dist/transport/dispatch.js +91 -0
  201. package/dist/transport/dispatch.js.map +1 -0
  202. package/dist/transport/local-socket.d.ts +28 -0
  203. package/dist/transport/local-socket.d.ts.map +1 -0
  204. package/dist/transport/local-socket.js +80 -0
  205. package/dist/transport/local-socket.js.map +1 -0
  206. package/dist/transport/mock.d.ts +54 -0
  207. package/dist/transport/mock.d.ts.map +1 -0
  208. package/dist/transport/mock.js +207 -0
  209. package/dist/transport/mock.js.map +1 -0
  210. package/dist/transport/postmessage.d.ts +36 -0
  211. package/dist/transport/postmessage.d.ts.map +1 -0
  212. package/dist/transport/postmessage.js +78 -0
  213. package/dist/transport/postmessage.js.map +1 -0
  214. package/dist/transport/types.d.ts +25 -0
  215. package/dist/transport/types.d.ts.map +1 -0
  216. package/dist/transport/types.js +11 -0
  217. package/dist/transport/types.js.map +1 -0
  218. package/dist/ui/index.d.ts +98 -0
  219. package/dist/ui/index.d.ts.map +1 -0
  220. package/dist/ui/index.js +32 -0
  221. package/dist/ui/index.js.map +1 -0
  222. package/package.json +84 -0
  223. package/src/background/index.ts +152 -0
  224. package/src/background/register.ts +85 -0
  225. package/src/dev-reload.ts +60 -0
  226. package/src/envelope.ts +54 -0
  227. package/src/globals.ts +62 -0
  228. package/src/index.ts +171 -0
  229. package/src/modules/actions.ts +156 -0
  230. package/src/modules/auth.ts +68 -0
  231. package/src/modules/base64.ts +87 -0
  232. package/src/modules/blob.ts +341 -0
  233. package/src/modules/camera.ts +242 -0
  234. package/src/modules/cloud.ts +94 -0
  235. package/src/modules/dashboard.ts +31 -0
  236. package/src/modules/display.ts +122 -0
  237. package/src/modules/events.ts +291 -0
  238. package/src/modules/glasses.ts +44 -0
  239. package/src/modules/heading.ts +23 -0
  240. package/src/modules/imu.ts +44 -0
  241. package/src/modules/input.ts +71 -0
  242. package/src/modules/led.ts +61 -0
  243. package/src/modules/location.ts +39 -0
  244. package/src/modules/mic.ts +74 -0
  245. package/src/modules/miniapps.ts +90 -0
  246. package/src/modules/navigation.ts +670 -0
  247. package/src/modules/permissions.ts +84 -0
  248. package/src/modules/phone.ts +155 -0
  249. package/src/modules/pivots/engine.ts +863 -0
  250. package/src/modules/pivots/geometry.ts +409 -0
  251. package/src/modules/pivots/instructions.ts +343 -0
  252. package/src/modules/speaker.ts +335 -0
  253. package/src/modules/storage.ts +109 -0
  254. package/src/modules/stream.ts +163 -0
  255. package/src/modules/system.ts +76 -0
  256. package/src/modules/transcription.ts +145 -0
  257. package/src/modules/translation.ts +149 -0
  258. package/src/modules/ui.ts +498 -0
  259. package/src/protocol.ts +378 -0
  260. package/src/react/MentraProvider.tsx +50 -0
  261. package/src/react/MiniappHeader.tsx +122 -0
  262. package/src/react/index.ts +12 -0
  263. package/src/react/useCapabilities.ts +29 -0
  264. package/src/react/useCapsuleHeaderStyle.ts +54 -0
  265. package/src/react/useColorScheme.ts +26 -0
  266. package/src/react/useConnected.ts +47 -0
  267. package/src/react/useRpc.ts +106 -0
  268. package/src/react/useSafeArea.ts +40 -0
  269. package/src/session.ts +886 -0
  270. package/src/sub-path-types.test-d.ts +49 -0
  271. package/src/transport/auto.ts +143 -0
  272. package/src/transport/dispatch.ts +106 -0
  273. package/src/transport/local-socket.ts +93 -0
  274. package/src/transport/mock.ts +251 -0
  275. package/src/transport/postmessage.ts +95 -0
  276. package/src/transport/types.ts +26 -0
  277. package/src/ui/index.ts +122 -0
@@ -0,0 +1,161 @@
1
+ /**
2
+ * @fileoverview BlobModule — phone-local persistent BINARY storage, keyed and
3
+ * scoped to (userId, packageName). The binary sibling of `session.storage`:
4
+ * where storage holds small strings, blob holds arbitrary bytes (PDFs, EPUBs,
5
+ * audio, video, model files, caches) as files on the phone.
6
+ *
7
+ * It deliberately mirrors `session.storage`'s shape — `set` / `get` / `delete` /
8
+ * `keys` / `has` / `clear` — so it's instantly familiar, plus the things files
9
+ * (and not strings) need:
10
+ * - `setFromUrl(key, url)` — the host downloads a URL straight to disk
11
+ * (like the web Cache API's `cache.add`, iOS `URLSession` download task, or
12
+ * Android `DownloadManager`). Bytes never cross the bridge.
13
+ * - `importFile()` — opens the OS file picker and stores the chosen file.
14
+ * Bytes never cross the bridge.
15
+ * - `share(key)` — hands the file to the OS share sheet.
16
+ * - `createWriteStream` / `createReadStream` — for streaming huge payloads
17
+ * (named like Node's `fs.createWriteStream`).
18
+ *
19
+ * BACKGROUND-ONLY. Binary doesn't belong in the WebView. A blob's `uri` is a
20
+ * `file://` path in the app's private storage — fine for `session.speaker.play`,
21
+ * `blob.share`, or another host capability, but a WebView generally can't load
22
+ * it directly (route rendering through a host viewer for now).
23
+ *
24
+ * Transfer model: the bridge moves JSON strings through a per-miniapp JS engine
25
+ * (JSC/QuickJS) with a watchdog, so in-JS writes/reads are CHUNKED (≤ ~1 MB raw
26
+ * per call). Prefer `setFromUrl` / `importFile` when you can — they keep the
27
+ * bytes entirely host-side.
28
+ */
29
+ import { MiniappSession } from "../session";
30
+ /** Metadata for one stored blob. `uri` is a `file://` path. */
31
+ export interface BlobMeta {
32
+ /** The key it's stored under (caller-chosen). */
33
+ key: string;
34
+ /** Optional display/file name (e.g. the original filename for an import). */
35
+ name?: string;
36
+ /** MIME type, e.g. "application/pdf". */
37
+ mimeType: string;
38
+ /** Size on disk in bytes. */
39
+ bytes: number;
40
+ /** Epoch ms first written. */
41
+ createdAt: number;
42
+ /** Epoch ms last written. */
43
+ updatedAt: number;
44
+ /** Content md5 (lowercase hex), computed host-side (skipped for very large blobs). */
45
+ md5?: string;
46
+ /** `file://` URI. Feed to `session.speaker.play`, `blob.share`, etc. */
47
+ uri: string;
48
+ /** App-defined metadata persisted with the blob. */
49
+ meta?: Record<string, string | number | boolean>;
50
+ }
51
+ export interface BlobSetOptions {
52
+ /** Default "application/octet-stream". */
53
+ mimeType?: string;
54
+ name?: string;
55
+ meta?: Record<string, string | number | boolean>;
56
+ }
57
+ export interface BlobSetFromUrlOptions extends BlobSetOptions {
58
+ /** Request headers (e.g. an Authorization token) for the download. */
59
+ headers?: Record<string, string>;
60
+ }
61
+ export interface BlobImportOptions {
62
+ /** Key to store under. Default: a generated key. */
63
+ key?: string;
64
+ /** Restrict the picker to a MIME type, e.g. "application/pdf". */
65
+ mimeType?: string;
66
+ meta?: Record<string, string | number | boolean>;
67
+ }
68
+ /** Raw bytes per chunked write. ~1 MB raw → ~1.34 MB base64, under the watchdog. */
69
+ export declare const BLOB_WRITE_CHUNK_BYTES: number;
70
+ /** Max bytes `bytes()` will buffer before throwing — read large blobs as a stream. */
71
+ export declare const BLOB_READ_ALL_MAX_BYTES: number;
72
+ /**
73
+ * Streaming writer (`fs.createWriteStream`-like). Call `write`/`writeBase64` as
74
+ * many times as you like (each is auto-split into bridge-safe chunks), then
75
+ * `close()` to publish, or `abort()` to discard the partial blob.
76
+ */
77
+ export declare class BlobWriter {
78
+ private readonly session;
79
+ readonly key: string;
80
+ private settled;
81
+ constructor(session: MiniappSession, key: string);
82
+ /** Append raw bytes. Auto-chunked. */
83
+ write(chunk: Uint8Array | ArrayBuffer): Promise<void>;
84
+ /** Append already-base64-encoded bytes (e.g. straight from `mic.onAudioChunk`). */
85
+ writeBase64(b64: string): Promise<void>;
86
+ /**
87
+ * Overwrite bytes at a fixed offset within the not-yet-closed blob (a seek
88
+ * write). Must stay within already-written bytes; does not grow the blob.
89
+ * Advanced — used e.g. to patch a container header on finalize.
90
+ */
91
+ writeAt(offset: number, chunk: Uint8Array | ArrayBuffer): Promise<void>;
92
+ /** Finalize and return the blob's metadata. Optional `meta` merges into the record. */
93
+ close(meta?: Record<string, string | number | boolean>): Promise<BlobMeta>;
94
+ /** Discard the partial blob. Idempotent. */
95
+ abort(): Promise<void>;
96
+ private assertOpen;
97
+ private send;
98
+ }
99
+ /** Streaming reader (`fs.createReadStream`-like). */
100
+ export declare class BlobReader {
101
+ private readonly session;
102
+ readonly handle: string;
103
+ readonly meta: BlobMeta;
104
+ private closed;
105
+ constructor(session: MiniappSession, handle: string, meta: BlobMeta);
106
+ /** Read up to `maxBytes` (default one chunk). `done` is true at end of file. */
107
+ read(maxBytes?: number): Promise<{
108
+ bytes: Uint8Array;
109
+ done: boolean;
110
+ }>;
111
+ close(): Promise<void>;
112
+ }
113
+ export declare class BlobModule {
114
+ private readonly session;
115
+ constructor(session: MiniappSession);
116
+ /** Store bytes under `key`. `data` may be a Uint8Array/ArrayBuffer or a base64 string. */
117
+ set(key: string, data: Uint8Array | ArrayBuffer | string, opts?: BlobSetOptions): Promise<BlobMeta>;
118
+ /**
119
+ * Download `url` straight into a blob under `key`, host-side. The bytes never
120
+ * cross the bridge (like the web Cache API's `cache.add`). `opts.headers` lets
121
+ * you pass auth. Resolves to the stored blob's metadata.
122
+ */
123
+ setFromUrl(key: string, url: string, opts?: BlobSetFromUrlOptions): Promise<BlobMeta>;
124
+ /**
125
+ * Open the OS file picker and store the chosen file as a blob, host-side.
126
+ * Resolves to the blob's metadata, or `null` if the user cancelled.
127
+ */
128
+ importFile(opts?: BlobImportOptions): Promise<BlobMeta | null>;
129
+ /** Open a streaming writer for `key` (for large/streamed payloads). */
130
+ createWriteStream(key: string, opts?: BlobSetOptions): Promise<BlobWriter>;
131
+ /** Metadata (incl. the `file://` uri) for `key`, or null if absent. */
132
+ get(key: string): Promise<BlobMeta | null>;
133
+ /** Alias of `get` — the file-stat verb. */
134
+ stat(key: string): Promise<BlobMeta | null>;
135
+ /** True iff a blob is stored under `key`. */
136
+ has(key: string): Promise<boolean>;
137
+ /** Every key this miniapp has stored, newest first. */
138
+ keys(): Promise<string[]>;
139
+ /** Every blob this miniapp owns, newest first. */
140
+ list(): Promise<BlobMeta[]>;
141
+ /** Open a streaming reader. Prefer `get(key).uri` when you just need to play/share it. */
142
+ createReadStream(key: string): Promise<BlobReader>;
143
+ /** Read a whole blob into memory as bytes, or null if absent. Throws past the cap — stream big ones. */
144
+ bytes(key: string): Promise<Uint8Array | null>;
145
+ /** Per-app usage + the quota ceiling, in bytes. */
146
+ usage(): Promise<{
147
+ bytes: number;
148
+ count: number;
149
+ quotaBytes: number;
150
+ }>;
151
+ /** Delete the blob under `key`. No-op if absent. */
152
+ delete(key: string): Promise<void>;
153
+ /** Delete every blob this miniapp owns. */
154
+ clear(): Promise<void>;
155
+ /** Share the blob via the OS share sheet (host shares from disk — no bytes cross the bridge). */
156
+ share(key: string): Promise<{
157
+ success: boolean;
158
+ cancelled?: boolean;
159
+ }>;
160
+ }
161
+ //# sourceMappingURL=blob.d.ts.map
@@ -0,0 +1 @@
1
+ {"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,mDAAmD;IACnD,KAAK,IAAI,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAC,CAAC;IAMpE,oDAAoD;IAC9C,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxC,2CAA2C;IACrC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B,iGAAiG;IAC3F,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;QAAC,OAAO,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,CAAA;KAAC,CAAC;CAO3E"}
@@ -0,0 +1,277 @@
1
+ /**
2
+ * @fileoverview BlobModule — phone-local persistent BINARY storage, keyed and
3
+ * scoped to (userId, packageName). The binary sibling of `session.storage`:
4
+ * where storage holds small strings, blob holds arbitrary bytes (PDFs, EPUBs,
5
+ * audio, video, model files, caches) as files on the phone.
6
+ *
7
+ * It deliberately mirrors `session.storage`'s shape — `set` / `get` / `delete` /
8
+ * `keys` / `has` / `clear` — so it's instantly familiar, plus the things files
9
+ * (and not strings) need:
10
+ * - `setFromUrl(key, url)` — the host downloads a URL straight to disk
11
+ * (like the web Cache API's `cache.add`, iOS `URLSession` download task, or
12
+ * Android `DownloadManager`). Bytes never cross the bridge.
13
+ * - `importFile()` — opens the OS file picker and stores the chosen file.
14
+ * Bytes never cross the bridge.
15
+ * - `share(key)` — hands the file to the OS share sheet.
16
+ * - `createWriteStream` / `createReadStream` — for streaming huge payloads
17
+ * (named like Node's `fs.createWriteStream`).
18
+ *
19
+ * BACKGROUND-ONLY. Binary doesn't belong in the WebView. A blob's `uri` is a
20
+ * `file://` path in the app's private storage — fine for `session.speaker.play`,
21
+ * `blob.share`, or another host capability, but a WebView generally can't load
22
+ * it directly (route rendering through a host viewer for now).
23
+ *
24
+ * Transfer model: the bridge moves JSON strings through a per-miniapp JS engine
25
+ * (JSC/QuickJS) with a watchdog, so in-JS writes/reads are CHUNKED (≤ ~1 MB raw
26
+ * per call). Prefer `setFromUrl` / `importFile` when you can — they keep the
27
+ * bytes entirely host-side.
28
+ */
29
+ import { MiniappRequestType } from "../protocol";
30
+ import { base64ToBytes, bytesToBase64, toUint8Array } from "./base64";
31
+ /** Raw bytes per chunked write. ~1 MB raw → ~1.34 MB base64, under the watchdog. */
32
+ export const BLOB_WRITE_CHUNK_BYTES = 1024 * 1024;
33
+ const BLOB_WRITE_CHUNK_B64 = Math.floor(BLOB_WRITE_CHUNK_BYTES / 3) * 4;
34
+ /** Max bytes `bytes()` will buffer before throwing — read large blobs as a stream. */
35
+ export const BLOB_READ_ALL_MAX_BYTES = 32 * 1024 * 1024;
36
+ /**
37
+ * Streaming writer (`fs.createWriteStream`-like). Call `write`/`writeBase64` as
38
+ * many times as you like (each is auto-split into bridge-safe chunks), then
39
+ * `close()` to publish, or `abort()` to discard the partial blob.
40
+ */
41
+ export class BlobWriter {
42
+ constructor(session, key) {
43
+ this.session = session;
44
+ this.key = key;
45
+ this.settled = false;
46
+ }
47
+ /** Append raw bytes. Auto-chunked. */
48
+ async write(chunk) {
49
+ this.assertOpen();
50
+ const bytes = toUint8Array(chunk);
51
+ for (let off = 0; off < bytes.length; off += BLOB_WRITE_CHUNK_BYTES) {
52
+ await this.send(bytesToBase64(bytes.subarray(off, off + BLOB_WRITE_CHUNK_BYTES)));
53
+ }
54
+ }
55
+ /** Append already-base64-encoded bytes (e.g. straight from `mic.onAudioChunk`). */
56
+ async writeBase64(b64) {
57
+ this.assertOpen();
58
+ // Slice on 4-char boundaries so each chunk is whole base64 groups.
59
+ for (let off = 0; off < b64.length; off += BLOB_WRITE_CHUNK_B64) {
60
+ await this.send(b64.slice(off, off + BLOB_WRITE_CHUNK_B64));
61
+ }
62
+ }
63
+ /**
64
+ * Overwrite bytes at a fixed offset within the not-yet-closed blob (a seek
65
+ * write). Must stay within already-written bytes; does not grow the blob.
66
+ * Advanced — used e.g. to patch a container header on finalize.
67
+ */
68
+ async writeAt(offset, chunk) {
69
+ this.assertOpen();
70
+ await this.session.sendRequest({
71
+ type: MiniappRequestType.BLOB_WRITE,
72
+ key: this.key,
73
+ offset,
74
+ base64: bytesToBase64(toUint8Array(chunk)),
75
+ });
76
+ }
77
+ /** Finalize and return the blob's metadata. Optional `meta` merges into the record. */
78
+ async close(meta) {
79
+ this.assertOpen();
80
+ this.settled = true;
81
+ return this.session.sendRequest({ type: MiniappRequestType.BLOB_COMMIT, key: this.key, meta });
82
+ }
83
+ /** Discard the partial blob. Idempotent. */
84
+ async abort() {
85
+ if (this.settled)
86
+ return;
87
+ this.settled = true;
88
+ await this.session.sendRequest({ type: MiniappRequestType.BLOB_ABORT, key: this.key });
89
+ }
90
+ assertOpen() {
91
+ if (this.settled)
92
+ throw new Error("BlobWriter is already closed/aborted");
93
+ }
94
+ send(base64) {
95
+ return this.session.sendRequest({
96
+ type: MiniappRequestType.BLOB_WRITE,
97
+ key: this.key,
98
+ base64,
99
+ });
100
+ }
101
+ }
102
+ /** Streaming reader (`fs.createReadStream`-like). */
103
+ export class BlobReader {
104
+ constructor(session, handle, meta) {
105
+ this.session = session;
106
+ this.handle = handle;
107
+ this.meta = meta;
108
+ this.closed = false;
109
+ }
110
+ /** Read up to `maxBytes` (default one chunk). `done` is true at end of file. */
111
+ async read(maxBytes = BLOB_WRITE_CHUNK_BYTES) {
112
+ if (this.closed)
113
+ throw new Error("BlobReader is closed");
114
+ const res = await this.session.sendRequest({
115
+ type: MiniappRequestType.BLOB_READ,
116
+ handle: this.handle,
117
+ maxBytes,
118
+ });
119
+ return { bytes: base64ToBytes(res?.base64 ?? ""), done: !!res?.done };
120
+ }
121
+ async close() {
122
+ if (this.closed)
123
+ return;
124
+ this.closed = true;
125
+ await this.session.sendRequest({ type: MiniappRequestType.BLOB_CLOSE_READ, handle: this.handle });
126
+ }
127
+ }
128
+ export class BlobModule {
129
+ constructor(session) {
130
+ this.session = session;
131
+ }
132
+ // ── write ────────────────────────────────────────────────────────────────
133
+ /** Store bytes under `key`. `data` may be a Uint8Array/ArrayBuffer or a base64 string. */
134
+ async set(key, data, opts = {}) {
135
+ const writer = await this.createWriteStream(key, opts);
136
+ try {
137
+ if (typeof data === "string")
138
+ await writer.writeBase64(data);
139
+ else
140
+ await writer.write(data);
141
+ return await writer.close();
142
+ }
143
+ catch (err) {
144
+ await writer.abort().catch(() => { });
145
+ throw err;
146
+ }
147
+ }
148
+ /**
149
+ * Download `url` straight into a blob under `key`, host-side. The bytes never
150
+ * cross the bridge (like the web Cache API's `cache.add`). `opts.headers` lets
151
+ * you pass auth. Resolves to the stored blob's metadata.
152
+ */
153
+ setFromUrl(key, url, opts = {}) {
154
+ return this.session.sendRequest({
155
+ type: MiniappRequestType.BLOB_SET_FROM_URL,
156
+ key,
157
+ url,
158
+ mimeType: opts.mimeType,
159
+ name: opts.name,
160
+ headers: opts.headers,
161
+ meta: opts.meta,
162
+ });
163
+ }
164
+ /**
165
+ * Open the OS file picker and store the chosen file as a blob, host-side.
166
+ * Resolves to the blob's metadata, or `null` if the user cancelled.
167
+ */
168
+ importFile(opts = {}) {
169
+ return this.session.sendRequest({
170
+ type: MiniappRequestType.BLOB_IMPORT,
171
+ key: opts.key,
172
+ mimeType: opts.mimeType,
173
+ meta: opts.meta,
174
+ });
175
+ }
176
+ /** Open a streaming writer for `key` (for large/streamed payloads). */
177
+ async createWriteStream(key, opts = {}) {
178
+ const res = await this.session.sendRequest({
179
+ type: MiniappRequestType.BLOB_CREATE,
180
+ key,
181
+ mimeType: opts.mimeType,
182
+ name: opts.name,
183
+ meta: opts.meta,
184
+ });
185
+ return new BlobWriter(this.session, res.key);
186
+ }
187
+ // ── read ─────────────────────────────────────────────────────────────────
188
+ /** Metadata (incl. the `file://` uri) for `key`, or null if absent. */
189
+ get(key) {
190
+ return this.session.sendRequest({ type: MiniappRequestType.BLOB_GET, key });
191
+ }
192
+ /** Alias of `get` — the file-stat verb. */
193
+ stat(key) {
194
+ return this.get(key);
195
+ }
196
+ /** True iff a blob is stored under `key`. */
197
+ async has(key) {
198
+ return (await this.get(key)) !== null;
199
+ }
200
+ /** Every key this miniapp has stored, newest first. */
201
+ async keys() {
202
+ return (await this.list()).map((m) => m.key);
203
+ }
204
+ /** Every blob this miniapp owns, newest first. */
205
+ async list() {
206
+ const res = await this.session.sendRequest({ type: MiniappRequestType.BLOB_LIST });
207
+ return res?.blobs ?? [];
208
+ }
209
+ /** Open a streaming reader. Prefer `get(key).uri` when you just need to play/share it. */
210
+ async createReadStream(key) {
211
+ const res = await this.session.sendRequest({
212
+ type: MiniappRequestType.BLOB_OPEN_READ,
213
+ key,
214
+ });
215
+ return new BlobReader(this.session, res.handle, res.meta);
216
+ }
217
+ /** Read a whole blob into memory as bytes, or null if absent. Throws past the cap — stream big ones. */
218
+ async bytes(key) {
219
+ let reader;
220
+ try {
221
+ reader = await this.createReadStream(key);
222
+ }
223
+ catch {
224
+ return null;
225
+ }
226
+ const parts = [];
227
+ let total = 0;
228
+ try {
229
+ for (;;) {
230
+ const { bytes, done } = await reader.read();
231
+ if (bytes.length) {
232
+ total += bytes.length;
233
+ if (total > BLOB_READ_ALL_MAX_BYTES) {
234
+ throw new Error(`Blob "${key}" exceeds the in-memory read cap — stream it with createReadStream()`);
235
+ }
236
+ parts.push(bytes);
237
+ }
238
+ if (done)
239
+ break;
240
+ }
241
+ }
242
+ finally {
243
+ await reader.close().catch(() => { });
244
+ }
245
+ const out = new Uint8Array(total);
246
+ let at = 0;
247
+ for (const p of parts) {
248
+ out.set(p, at);
249
+ at += p.length;
250
+ }
251
+ return out;
252
+ }
253
+ // ── manage ───────────────────────────────────────────────────────────────
254
+ /** Per-app usage + the quota ceiling, in bytes. */
255
+ usage() {
256
+ return this.session.sendRequest({
257
+ type: MiniappRequestType.BLOB_USAGE,
258
+ });
259
+ }
260
+ /** Delete the blob under `key`. No-op if absent. */
261
+ async delete(key) {
262
+ await this.session.sendRequest({ type: MiniappRequestType.BLOB_DELETE, key });
263
+ }
264
+ /** Delete every blob this miniapp owns. */
265
+ async clear() {
266
+ await this.session.sendRequest({ type: MiniappRequestType.BLOB_CLEAR });
267
+ }
268
+ /** Share the blob via the OS share sheet (host shares from disk — no bytes cross the bridge). */
269
+ async share(key) {
270
+ const res = await this.session.sendRequest({
271
+ type: MiniappRequestType.BLOB_SHARE,
272
+ key,
273
+ });
274
+ return res ?? { success: false };
275
+ }
276
+ }
277
+ //# sourceMappingURL=blob.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blob.js","sourceRoot":"","sources":["../../src/modules/blob.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAC,kBAAkB,EAAC,MAAM,aAAa,CAAA;AAE9C,OAAO,EAAC,aAAa,EAAE,aAAa,EAAE,YAAY,EAAC,MAAM,UAAU,CAAA;AA4CnE,oFAAoF;AACpF,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,GAAG,IAAI,CAAA;AACjD,MAAM,oBAAoB,GAAG,IAAI,CAAC,KAAK,CAAC,sBAAsB,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;AACvE,sFAAsF;AACtF,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAA;AAEvD;;;;GAIG;AACH,MAAM,OAAO,UAAU;IAGrB,YACmB,OAAuB,EAC/B,GAAW;QADH,YAAO,GAAP,OAAO,CAAgB;QAC/B,QAAG,GAAH,GAAG,CAAQ;QAJd,YAAO,GAAG,KAAK,CAAA;IAKpB,CAAC;IAEJ,sCAAsC;IACtC,KAAK,CAAC,KAAK,CAAC,KAA+B;QACzC,IAAI,CAAC,UAAU,EAAE,CAAA;QACjB,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,CAAA;QACjC,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,KAAK,CAAC,MAAM,EAAE,GAAG,I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AK,EAAC,CAAA;IAChC,CAAC;CACF"}
@@ -0,0 +1,170 @@
1
+ /**
2
+ * @fileoverview CameraModule — glasses camera control and photo capture.
3
+ */
4
+ import { MiniappSession } from "../session";
5
+ export type CameraRoiPosition = "center" | "bottom" | "top";
6
+ export type CameraFovPreset = "narrow" | "standard" | "wide";
7
+ export type CameraFovRequest = {
8
+ /** Horizontal FOV, degrees. */
9
+ fov: number;
10
+ /** Crop/region position: center, bottom, or top. Defaults to center. */
11
+ roiPosition?: CameraRoiPosition;
12
+ } | {
13
+ /** Named FOV preset. Presets use center ROI. */
14
+ preset: CameraFovPreset;
15
+ };
16
+ export type SetCameraFovOptions = CameraFovRequest;
17
+ export interface CameraFovResult {
18
+ requestId: string;
19
+ fov: number;
20
+ roiPosition: CameraRoiPosition;
21
+ timestamp: number;
22
+ }
23
+ export interface TakePhotoOptions {
24
+ size?: "low" | "medium" | "high" | "max";
25
+ /** Capture at maximum source quality and optimize BLE delivery for readable text. */
26
+ mode?: "photo" | "text";
27
+ compress?: "none" | "low" | "medium" | "high";
28
+ sound?: boolean;
29
+ saveToGallery?: boolean;
30
+ /**
31
+ * Manual shutter / exposure time in nanoseconds. Omit (or pass undefined)
32
+ * to let the glasses auto-expose. Honored only on cameras that support
33
+ * manual exposure; ignored otherwise.
34
+ */
35
+ exposureTimeNs?: number;
36
+ /** Sensor ISO for this capture only. Only used when `exposureTimeNs` enables manual exposure. */
37
+ iso?: number | null;
38
+ /** After AE convergence, divide the metered exposure by this factor (scan mode). */
39
+ aeExposureDivisor?: number;
40
+ /** Cap ISO after AE metering (scan mode). */
41
+ isoCap?: number;
42
+ /** Request per-capture noise reduction. Sent on the wire; glasses may log `not_implemented`. */
43
+ noiseReduction?: boolean;
44
+ /** Request per-capture edge enhancement. Sent on the wire; glasses may log `not_implemented`. */
45
+ edgeEnhancement?: boolean;
46
+ /** Multi-frame noise reduction preference. */
47
+ mfnr?: boolean;
48
+ /** Zero-shutter-lag preference. */
49
+ zsl?: boolean;
50
+ /** ISP digital gain hint. */
51
+ ispDigitalGain?: number;
52
+ /** ISP analog gain hint. */
53
+ ispAnalogGain?: string;
54
+ /**
55
+ * Override the SDK's default 60s request timeout for this capture only.
56
+ * Leave unset for a normal user-triggered capture (the full 60s ceiling is
57
+ * appropriate there). Callers that speculatively fire a capture and may
58
+ * abandon it if the result isn't needed (e.g. a short-lived non-visual
59
+ * assistant turn racing a capture against a ~1s latency cap) should pass a
60
+ * short value here so the abandoned `takePhoto()` promise settles quickly
61
+ * instead of sitting on the default 60s ceiling.
62
+ */
63
+ timeoutMs?: number;
64
+ }
65
+ export interface PhotoTaken {
66
+ /** Request id that correlates ASG status, upload, and phone/cloud logs. */
67
+ requestId: string;
68
+ photoUrl: string;
69
+ mimeType: string;
70
+ size: number;
71
+ }
72
+ export interface WarmUpCameraOptions {
73
+ size?: "low" | "medium" | "high" | "max";
74
+ /** Match the upcoming capture mode so warm-up and capture share one ASG camera session. */
75
+ mode?: "photo" | "text";
76
+ exposureTimeNs?: number;
77
+ /** Ready-state hold in milliseconds. Defaults to 15 seconds and is capped at 60 seconds. */
78
+ durationMs?: number;
79
+ }
80
+ export interface StartVideoRecordingOptions {
81
+ /** Video width in pixels. Omit to use the device's saved button-video default. */
82
+ width?: number;
83
+ /** Video height in pixels. Omit to use the device's saved button-video default. */
84
+ height?: number;
85
+ /**
86
+ * Frames per second. Lower frame rates keep the glasses cooler and produce
87
+ * smaller files — useful for long recordings where smooth motion isn't needed.
88
+ * Omit to use the device default.
89
+ */
90
+ fps?: number;
91
+ /** Play start/stop capture sounds. Defaults to true. */
92
+ sound?: boolean;
93
+ /** Keep the recording on the glasses after it finishes. Defaults to false. */
94
+ save?: boolean;
95
+ }
96
+ export interface VideoRecordingStarted {
97
+ /** Identifier for this recording session; pass to {@link stopVideoRecording}. */
98
+ recordingId: string;
99
+ }
100
+ export interface StopVideoRecordingOptions {
101
+ /**
102
+ * Upload the finished recording to this URL with a multipart POST (the file is
103
+ * the `video` part). The glasses upload it directly. Omit to keep the recording
104
+ * on the glasses instead.
105
+ */
106
+ uploadUrl?: string;
107
+ /** Bearer token sent as the `Authorization` header on the upload, if your endpoint needs one. */
108
+ uploadAuthToken?: string;
109
+ }
110
+ export declare class CameraModule {
111
+ private readonly session;
112
+ constructor(session: MiniappSession);
113
+ /** True iff `CAMERA` is declared in the miniapp's manifest. */
114
+ get hasPermission(): boolean;
115
+ /**
116
+ * Apply a session-owned camera FOV/ROI override on the glasses.
117
+ *
118
+ * Resolves after the ASG client reports that the setting was applied to camera
119
+ * hardware after the restart cooldown. The host restores the prior override or persistent base
120
+ * when this miniapp closes. Requires CAMERA permission declared in miniapp.json.
121
+ */
122
+ setFov(request: CameraFovRequest): Promise<CameraFovResult>;
123
+ /**
124
+ * Take a photo via the glasses camera. Returns a URL to the captured image.
125
+ * Requires CAMERA permission declared in miniapp.json.
126
+ *
127
+ * The photo is uploaded to cloud storage; the returned URL is a short-TTL
128
+ * (~30 minute) signed download URL. If the glasses don't have a camera,
129
+ * the phone-side handler rejects with an error. Check
130
+ * `session.capabilities.hasCamera` before calling.
131
+ */
132
+ takePhoto(options?: TakePhotoOptions): Promise<PhotoTaken>;
133
+ /**
134
+ * Pre-warm the glasses camera so the next takePhoto() is near-instant.
135
+ * The camera stays warm for ~durationMs (default 15s, maximum 60s); call warmUp() again to
136
+ * extend it. Warm with the same `size` you'll capture with — a mismatched size
137
+ * forces the camera to reconfigure and loses the speedup. Requires CAMERA
138
+ * permission in miniapp.json. Resolves once the camera reports ready. The host automatically
139
+ * releases this miniapp's request-owned lease when the miniapp closes.
140
+ *
141
+ * Warm-ups are serialized: only one runs at a time and none may start while a
142
+ * photo is being captured. If the camera is busy (a capture is in flight, or
143
+ * another warm-up is still opening) this rejects with `camera_busy` — retry
144
+ * shortly, or just call takePhoto() (it works regardless, only slower). The
145
+ * normal warmUp() → takePhoto() sequence never hits this.
146
+ */
147
+ warmUp(options?: WarmUpCameraOptions): Promise<void>;
148
+ /**
149
+ * Start recording video on the glasses camera. Returns a `recordingId` to pass
150
+ * to {@link stopVideoRecording} after the glasses report that recording
151
+ * started. Requires CAMERA permission declared in miniapp.json. Check
152
+ * `session.capabilities.hasCamera` before calling.
153
+ *
154
+ * Resolution and frame rate are optional — omit them to use the device's saved
155
+ * button-video settings. Lowering `fps` (e.g. to 5) keeps the glasses cooler
156
+ * during long recordings.
157
+ */
158
+ startVideoRecording(options?: StartVideoRecordingOptions): Promise<VideoRecordingStarted>;
159
+ /**
160
+ * Stop an in-progress video recording started with {@link startVideoRecording}.
161
+ *
162
+ * By default the recording stays on the glasses. Pass `uploadUrl` to have the
163
+ * glasses upload the finished clip to your own endpoint.
164
+ *
165
+ * @param recordingId The id returned from `startVideoRecording`.
166
+ * @param options Optional upload destination for the finished recording.
167
+ */
168
+ stopVideoRecording(recordingId: string, options?: StopVideoRecordingOptions): Promise<void>;
169
+ }
170
+ //# sourceMappingURL=camera.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"camera.d.ts","sourceRoot":"","sources":["../../src/modules/camera.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAA;AAEzC,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,CAAA;AAC3D,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAA;AAE5D,MAAM,MAAM,gBAAgB,GACxB;IACE,+BAA+B;IAC/B,GAAG,EAAE,MAAM,CAAA;IACX,wEAAwE;IACxE,WAAW,CAAC,EAAE,iBAAiB,CAAA;CAChC,GACD;IACE,gDAAgD;IAChD,MAAM,EAAE,eAAe,CAAA;CACxB,CAAA;AAEL,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,CAAA;AAElD,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAA;IACjB,GAAG,EAAE,MAAM,CAAA;IACX,WAAW,EAAE,iBAAiB,CAAA;IAC9B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