@oxyhq/services 5.16.35 → 5.16.37

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 (232) hide show
  1. package/README.md +8 -26
  2. package/lib/commonjs/core/OxyServices.base.js.map +1 -1
  3. package/lib/commonjs/core/mixins/OxyServices.user.js.map +1 -1
  4. package/lib/commonjs/core/mixins/OxyServices.utility.js.map +1 -1
  5. package/lib/commonjs/crypto/README.md +142 -0
  6. package/lib/commonjs/crypto/core.js +147 -0
  7. package/lib/commonjs/crypto/core.js.map +1 -0
  8. package/lib/commonjs/crypto/index.js +16 -0
  9. package/lib/commonjs/crypto/index.js.map +1 -1
  10. package/lib/commonjs/crypto/keyManager.js +19 -22
  11. package/lib/commonjs/crypto/keyManager.js.map +1 -1
  12. package/lib/commonjs/crypto/signatureService.js +116 -28
  13. package/lib/commonjs/crypto/signatureService.js.map +1 -1
  14. package/lib/commonjs/index.js +0 -12
  15. package/lib/commonjs/index.js.map +1 -1
  16. package/lib/commonjs/models/interfaces.js +10 -11
  17. package/lib/commonjs/models/interfaces.js.map +1 -1
  18. package/lib/commonjs/node/index.js +10 -1
  19. package/lib/commonjs/node/index.js.map +1 -1
  20. package/lib/commonjs/node/signatureService.js +107 -0
  21. package/lib/commonjs/node/signatureService.js.map +1 -0
  22. package/lib/commonjs/ui/context/OxyContext.js +23 -0
  23. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  24. package/lib/commonjs/ui/context/hooks/useAuthOperations.js +29 -2
  25. package/lib/commonjs/ui/context/hooks/useAuthOperations.js.map +1 -1
  26. package/lib/commonjs/ui/context/hooks/useLanguageManagement.js.map +1 -1
  27. package/lib/commonjs/ui/hooks/useLanguageManagement.js.map +1 -1
  28. package/lib/commonjs/ui/hooks/useSessionManagement.js.map +1 -1
  29. package/lib/commonjs/ui/index.js +0 -2
  30. package/lib/commonjs/ui/index.js.map +1 -1
  31. package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
  32. package/lib/commonjs/ui/screens/OxyAuthScreen.js +11 -2
  33. package/lib/commonjs/ui/screens/OxyAuthScreen.js.map +1 -1
  34. package/lib/module/core/OxyServices.base.js.map +1 -1
  35. package/lib/module/core/mixins/OxyServices.user.js.map +1 -1
  36. package/lib/module/core/mixins/OxyServices.utility.js.map +1 -1
  37. package/lib/module/crypto/README.md +142 -0
  38. package/lib/module/crypto/core.js +133 -0
  39. package/lib/module/crypto/core.js.map +1 -0
  40. package/lib/module/crypto/index.js +3 -9
  41. package/lib/module/crypto/index.js.map +1 -1
  42. package/lib/module/crypto/keyManager.js +19 -22
  43. package/lib/module/crypto/keyManager.js.map +1 -1
  44. package/lib/module/crypto/signatureService.js +113 -23
  45. package/lib/module/crypto/signatureService.js.map +1 -1
  46. package/lib/module/index.js +0 -2
  47. package/lib/module/index.js.map +1 -1
  48. package/lib/module/models/interfaces.js +10 -11
  49. package/lib/module/models/interfaces.js.map +1 -1
  50. package/lib/module/node/index.js +3 -0
  51. package/lib/module/node/index.js.map +1 -1
  52. package/lib/module/node/signatureService.js +101 -0
  53. package/lib/module/node/signatureService.js.map +1 -0
  54. package/lib/module/ui/context/OxyContext.js +23 -0
  55. package/lib/module/ui/context/OxyContext.js.map +1 -1
  56. package/lib/module/ui/context/hooks/useAuthOperations.js +29 -2
  57. package/lib/module/ui/context/hooks/useAuthOperations.js.map +1 -1
  58. package/lib/module/ui/context/hooks/useLanguageManagement.js.map +1 -1
  59. package/lib/module/ui/hooks/useLanguageManagement.js.map +1 -1
  60. package/lib/module/ui/hooks/useSessionManagement.js.map +1 -1
  61. package/lib/module/ui/index.js +0 -1
  62. package/lib/module/ui/index.js.map +1 -1
  63. package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
  64. package/lib/module/ui/screens/OxyAuthScreen.js +11 -2
  65. package/lib/module/ui/screens/OxyAuthScreen.js.map +1 -1
  66. package/lib/typescript/core/OxyServices.base.d.ts.map +1 -1
  67. package/lib/typescript/core/mixins/OxyServices.analytics.d.ts.map +1 -1
  68. package/lib/typescript/core/mixins/OxyServices.assets.d.ts.map +1 -1
  69. package/lib/typescript/core/mixins/OxyServices.auth.d.ts +1 -1
  70. package/lib/typescript/core/mixins/OxyServices.auth.d.ts.map +1 -1
  71. package/lib/typescript/core/mixins/OxyServices.developer.d.ts.map +1 -1
  72. package/lib/typescript/core/mixins/OxyServices.devices.d.ts.map +1 -1
  73. package/lib/typescript/core/mixins/OxyServices.karma.d.ts.map +1 -1
  74. package/lib/typescript/core/mixins/OxyServices.language.d.ts.map +1 -1
  75. package/lib/typescript/core/mixins/OxyServices.location.d.ts.map +1 -1
  76. package/lib/typescript/core/mixins/OxyServices.payment.d.ts.map +1 -1
  77. package/lib/typescript/core/mixins/OxyServices.privacy.d.ts.map +1 -1
  78. package/lib/typescript/core/mixins/OxyServices.security.d.ts.map +1 -1
  79. package/lib/typescript/core/mixins/OxyServices.user.d.ts +1 -2
  80. package/lib/typescript/core/mixins/OxyServices.user.d.ts.map +1 -1
  81. package/lib/typescript/core/mixins/OxyServices.utility.d.ts.map +1 -1
  82. package/lib/typescript/core/mixins/index.d.ts +13 -13
  83. package/lib/typescript/core/mixins/index.d.ts.map +1 -1
  84. package/lib/typescript/core/services/SessionService.d.ts +1 -1
  85. package/lib/typescript/core/services/SessionService.d.ts.map +1 -1
  86. package/lib/typescript/crypto/core.d.ts +56 -0
  87. package/lib/typescript/crypto/core.d.ts.map +1 -0
  88. package/lib/typescript/crypto/index.d.ts +1 -9
  89. package/lib/typescript/crypto/index.d.ts.map +1 -1
  90. package/lib/typescript/crypto/keyManager.d.ts +13 -1
  91. package/lib/typescript/crypto/keyManager.d.ts.map +1 -1
  92. package/lib/typescript/crypto/signatureService.d.ts +15 -9
  93. package/lib/typescript/crypto/signatureService.d.ts.map +1 -1
  94. package/lib/typescript/index.d.ts +1 -2
  95. package/lib/typescript/index.d.ts.map +1 -1
  96. package/lib/typescript/models/interfaces.d.ts +68 -15
  97. package/lib/typescript/models/interfaces.d.ts.map +1 -1
  98. package/lib/typescript/node/index.d.ts +1 -0
  99. package/lib/typescript/node/index.d.ts.map +1 -1
  100. package/lib/typescript/node/signatureService.d.ts +55 -0
  101. package/lib/typescript/node/signatureService.d.ts.map +1 -0
  102. package/lib/typescript/ui/context/OxyContext.d.ts +1 -2
  103. package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
  104. package/lib/typescript/ui/context/hooks/useAuthOperations.d.ts +1 -2
  105. package/lib/typescript/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
  106. package/lib/typescript/ui/context/hooks/useLanguageManagement.d.ts +1 -2
  107. package/lib/typescript/ui/context/hooks/useLanguageManagement.d.ts.map +1 -1
  108. package/lib/typescript/ui/hooks/mutations/useAccountMutations.d.ts +1 -1
  109. package/lib/typescript/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
  110. package/lib/typescript/ui/hooks/queries/useAccountQueries.d.ts +1 -1
  111. package/lib/typescript/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
  112. package/lib/typescript/ui/hooks/useLanguageManagement.d.ts +1 -2
  113. package/lib/typescript/ui/hooks/useLanguageManagement.d.ts.map +1 -1
  114. package/lib/typescript/ui/hooks/useSessionManagement.d.ts +1 -2
  115. package/lib/typescript/ui/hooks/useSessionManagement.d.ts.map +1 -1
  116. package/lib/typescript/ui/index.d.ts +1 -1
  117. package/lib/typescript/ui/index.d.ts.map +1 -1
  118. package/lib/typescript/ui/screens/OxyAuthScreen.d.ts.map +1 -1
  119. package/lib/typescript/ui/stores/authStore.d.ts +1 -1
  120. package/lib/typescript/ui/stores/authStore.d.ts.map +1 -1
  121. package/lib/typescript/ui/utils/avatarUtils.d.ts +1 -1
  122. package/lib/typescript/ui/utils/avatarUtils.d.ts.map +1 -1
  123. package/package.json +6 -1
  124. package/src/core/OxyServices.base.ts +1 -2
  125. package/src/core/mixins/OxyServices.auth.ts +1 -1
  126. package/src/core/mixins/OxyServices.user.ts +1 -2
  127. package/src/core/mixins/OxyServices.utility.ts +1 -2
  128. package/src/core/services/SessionService.ts +1 -1
  129. package/src/crypto/README.md +142 -0
  130. package/src/crypto/__tests__/core.test.ts +203 -0
  131. package/src/crypto/core.ts +142 -0
  132. package/src/crypto/index.ts +3 -10
  133. package/src/crypto/keyManager.ts +25 -21
  134. package/src/crypto/signatureService.ts +137 -36
  135. package/src/index.ts +2 -3
  136. package/src/models/interfaces.ts +73 -21
  137. package/src/node/index.ts +3 -0
  138. package/src/node/signatureService.ts +126 -0
  139. package/src/ui/context/OxyContext.tsx +26 -2
  140. package/src/ui/context/hooks/useAuthOperations.ts +33 -4
  141. package/src/ui/context/hooks/useLanguageManagement.ts +1 -2
  142. package/src/ui/hooks/auth/index.ts +2 -0
  143. package/src/ui/hooks/mutations/useAccountMutations.ts +1 -1
  144. package/src/ui/hooks/mutations/useServicesMutations.ts +1 -1
  145. package/src/ui/hooks/queries/useAccountQueries.ts +1 -1
  146. package/src/ui/hooks/useLanguageManagement.ts +1 -2
  147. package/src/ui/hooks/useSessionManagement.ts +1 -2
  148. package/src/ui/index.ts +1 -2
  149. package/src/ui/screens/AccountSettingsScreen.tsx +6 -6
  150. package/src/ui/screens/AccountSwitcherScreen.tsx +1 -1
  151. package/src/ui/screens/OxyAuthScreen.tsx +11 -2
  152. package/src/ui/screens/ProfileScreen.tsx +1 -1
  153. package/src/ui/stores/authStore.ts +1 -1
  154. package/src/ui/types/navigation.ts +1 -1
  155. package/src/ui/utils/avatarUtils.ts +1 -1
  156. package/lib/commonjs/core/services/AuthService.js +0 -156
  157. package/lib/commonjs/core/services/AuthService.js.map +0 -1
  158. package/lib/commonjs/core/services/SessionTransportService.js +0 -64
  159. package/lib/commonjs/core/services/SessionTransportService.js.map +0 -1
  160. package/lib/commonjs/core/services/UserService.js +0 -123
  161. package/lib/commonjs/core/services/UserService.js.map +0 -1
  162. package/lib/commonjs/core/services/index.js +0 -34
  163. package/lib/commonjs/core/services/index.js.map +0 -1
  164. package/lib/commonjs/shared/crypto/messageBuilders.js +0 -79
  165. package/lib/commonjs/shared/crypto/messageBuilders.js.map +0 -1
  166. package/lib/commonjs/shared/crypto/platform.js +0 -118
  167. package/lib/commonjs/shared/crypto/platform.js.map +0 -1
  168. package/lib/commonjs/shared/crypto/signature.js +0 -191
  169. package/lib/commonjs/shared/crypto/signature.js.map +0 -1
  170. package/lib/commonjs/shared/index.js +0 -94
  171. package/lib/commonjs/shared/index.js.map +0 -1
  172. package/lib/commonjs/shared/models/index.js +0 -2
  173. package/lib/commonjs/shared/models/index.js.map +0 -1
  174. package/lib/commonjs/shared/transport/index.js +0 -260
  175. package/lib/commonjs/shared/transport/index.js.map +0 -1
  176. package/lib/commonjs/shared/utils/index.js +0 -82
  177. package/lib/commonjs/shared/utils/index.js.map +0 -1
  178. package/lib/module/core/services/AuthService.js +0 -151
  179. package/lib/module/core/services/AuthService.js.map +0 -1
  180. package/lib/module/core/services/SessionTransportService.js +0 -59
  181. package/lib/module/core/services/SessionTransportService.js.map +0 -1
  182. package/lib/module/core/services/UserService.js +0 -118
  183. package/lib/module/core/services/UserService.js.map +0 -1
  184. package/lib/module/core/services/index.js +0 -16
  185. package/lib/module/core/services/index.js.map +0 -1
  186. package/lib/module/shared/crypto/messageBuilders.js +0 -70
  187. package/lib/module/shared/crypto/messageBuilders.js.map +0 -1
  188. package/lib/module/shared/crypto/platform.js +0 -112
  189. package/lib/module/shared/crypto/platform.js.map +0 -1
  190. package/lib/module/shared/crypto/signature.js +0 -186
  191. package/lib/module/shared/crypto/signature.js.map +0 -1
  192. package/lib/module/shared/index.js +0 -30
  193. package/lib/module/shared/index.js.map +0 -1
  194. package/lib/module/shared/models/index.js +0 -2
  195. package/lib/module/shared/models/index.js.map +0 -1
  196. package/lib/module/shared/transport/index.js +0 -254
  197. package/lib/module/shared/transport/index.js.map +0 -1
  198. package/lib/module/shared/utils/index.js +0 -74
  199. package/lib/module/shared/utils/index.js.map +0 -1
  200. package/lib/typescript/core/services/AuthService.d.ts +0 -50
  201. package/lib/typescript/core/services/AuthService.d.ts.map +0 -1
  202. package/lib/typescript/core/services/SessionTransportService.d.ts +0 -31
  203. package/lib/typescript/core/services/SessionTransportService.d.ts.map +0 -1
  204. package/lib/typescript/core/services/UserService.d.ts +0 -39
  205. package/lib/typescript/core/services/UserService.d.ts.map +0 -1
  206. package/lib/typescript/core/services/index.d.ts +0 -13
  207. package/lib/typescript/core/services/index.d.ts.map +0 -1
  208. package/lib/typescript/shared/crypto/messageBuilders.d.ts +0 -38
  209. package/lib/typescript/shared/crypto/messageBuilders.d.ts.map +0 -1
  210. package/lib/typescript/shared/crypto/platform.d.ts +0 -54
  211. package/lib/typescript/shared/crypto/platform.d.ts.map +0 -1
  212. package/lib/typescript/shared/crypto/signature.d.ts +0 -72
  213. package/lib/typescript/shared/crypto/signature.d.ts.map +0 -1
  214. package/lib/typescript/shared/index.d.ts +0 -20
  215. package/lib/typescript/shared/index.d.ts.map +0 -1
  216. package/lib/typescript/shared/models/index.d.ts +0 -163
  217. package/lib/typescript/shared/models/index.d.ts.map +0 -1
  218. package/lib/typescript/shared/transport/index.d.ts +0 -73
  219. package/lib/typescript/shared/transport/index.d.ts.map +0 -1
  220. package/lib/typescript/shared/utils/index.d.ts +0 -28
  221. package/lib/typescript/shared/utils/index.d.ts.map +0 -1
  222. package/src/core/services/AuthService.ts +0 -153
  223. package/src/core/services/SessionTransportService.ts +0 -69
  224. package/src/core/services/UserService.ts +0 -125
  225. package/src/core/services/index.ts +0 -14
  226. package/src/shared/crypto/messageBuilders.ts +0 -89
  227. package/src/shared/crypto/platform.ts +0 -140
  228. package/src/shared/crypto/signature.ts +0 -235
  229. package/src/shared/index.ts +0 -28
  230. package/src/shared/models/index.ts +0 -173
  231. package/src/shared/transport/index.ts +0 -349
  232. package/src/shared/utils/index.ts +0 -73
@@ -1,254 +0,0 @@
1
- "use strict";
2
-
3
- /**
4
- * Transport Abstraction
5
- *
6
- * Unified transport layer for WebSocket, SSE, and polling.
7
- * Provides automatic fallback and unified configuration.
8
- */
9
-
10
- /**
11
- * Transport Interface
12
- * All transport implementations must implement this
13
- */
14
-
15
- /**
16
- * Transport Factory
17
- * Creates the appropriate transport based on availability and configuration
18
- */
19
- export class TransportFactory {
20
- /**
21
- * Create a transport with automatic fallback
22
- * Tries WebSocket first, then SSE, then polling
23
- */
24
- static async create(config, callbacks) {
25
- // Try WebSocket first (best for real-time)
26
- if (await this.isWebSocketAvailable()) {
27
- try {
28
- return new WebSocketTransport(config, callbacks);
29
- } catch (error) {
30
- // Fall through to SSE
31
- }
32
- }
33
-
34
- // Try SSE second (good for one-way updates)
35
- if (await this.isSSEAvailable()) {
36
- try {
37
- return new SSETransport(config, callbacks);
38
- } catch (error) {
39
- // Fall through to polling
40
- }
41
- }
42
-
43
- // Fall back to polling (always available)
44
- return new PollingTransport(config, callbacks);
45
- }
46
-
47
- /**
48
- * Check if WebSocket is available
49
- */
50
- static async isWebSocketAvailable() {
51
- // WebSocket is available in browsers and Node.js with socket.io-client
52
- return typeof window !== 'undefined' || typeof process !== 'undefined';
53
- }
54
-
55
- /**
56
- * Check if SSE is available
57
- */
58
- static async isSSEAvailable() {
59
- // SSE is available in browsers via EventSource
60
- // In Node.js, would need a polyfill or library
61
- return typeof EventSource !== 'undefined' || typeof window !== 'undefined' && 'EventSource' in window;
62
- }
63
- }
64
-
65
- /**
66
- * WebSocket Transport Implementation
67
- * Uses socket.io-client for WebSocket connections
68
- */
69
- class WebSocketTransport {
70
- socket = null;
71
- connected = false;
72
- constructor(config, callbacks) {
73
- this.config = config;
74
- this.callbacks = callbacks;
75
- }
76
- async connect() {
77
- // Dynamic import to avoid bundling socket.io-client if not needed
78
- let io;
79
- try {
80
- io = (await import('socket.io-client')).default;
81
- } catch (error) {
82
- throw new Error('socket.io-client is required for WebSocket transport. Install it as a dependency.');
83
- }
84
- const url = this.config.namespace ? `${this.config.baseURL}/${this.config.namespace}` : this.config.baseURL;
85
- const socketOptions = {
86
- transports: ['websocket', 'polling'],
87
- reconnection: true,
88
- reconnectionAttempts: this.config.reconnectAttempts ?? 3,
89
- reconnectionDelay: this.config.reconnectDelay ?? 1000
90
- };
91
- if (this.config.accessToken) {
92
- socketOptions.auth = {
93
- token: this.config.accessToken
94
- };
95
- }
96
- this.socket = io(url, socketOptions);
97
- this.socket.on('connect', () => {
98
- this.connected = true;
99
- if (this.config.sessionToken) {
100
- this.socket.emit('join', this.config.sessionToken);
101
- }
102
- this.callbacks.onConnect?.();
103
- });
104
- this.socket.on('auth_update', payload => {
105
- this.callbacks.onUpdate?.(payload);
106
- });
107
- this.socket.on('connect_error', error => {
108
- this.callbacks.onError?.(error);
109
- });
110
- this.socket.on('disconnect', () => {
111
- this.connected = false;
112
- this.callbacks.onDisconnect?.();
113
- });
114
- }
115
- disconnect() {
116
- if (this.socket) {
117
- this.socket.disconnect();
118
- this.socket = null;
119
- this.connected = false;
120
- }
121
- }
122
- isConnected() {
123
- return this.connected && this.socket?.connected === true;
124
- }
125
- getType() {
126
- return 'websocket';
127
- }
128
- }
129
-
130
- /**
131
- * SSE Transport Implementation
132
- * Uses EventSource for Server-Sent Events
133
- */
134
- class SSETransport {
135
- eventSource = null;
136
- connected = false;
137
- constructor(config, callbacks) {
138
- this.config = config;
139
- this.callbacks = callbacks;
140
- }
141
- async connect() {
142
- if (typeof EventSource === 'undefined') {
143
- throw new Error('EventSource is not available in this environment');
144
- }
145
- const url = this.config.sessionToken ? `${this.config.baseURL}/auth/session/stream/${this.config.sessionToken}` : `${this.config.baseURL}/auth/session/stream`;
146
- this.eventSource = new EventSource(url);
147
- this.eventSource.onopen = () => {
148
- this.connected = true;
149
- this.callbacks.onConnect?.();
150
- };
151
- this.eventSource.onmessage = event => {
152
- try {
153
- const update = JSON.parse(event.data);
154
- this.callbacks.onUpdate?.(update);
155
- } catch (error) {
156
- this.callbacks.onError?.(error);
157
- }
158
- };
159
- this.eventSource.onerror = error => {
160
- this.callbacks.onError?.(new Error('SSE connection error'));
161
- };
162
- }
163
- disconnect() {
164
- if (this.eventSource) {
165
- this.eventSource.close();
166
- this.eventSource = null;
167
- this.connected = false;
168
- }
169
- }
170
- isConnected() {
171
- return this.connected && this.eventSource?.readyState === EventSource.OPEN;
172
- }
173
- getType() {
174
- return 'sse';
175
- }
176
- }
177
-
178
- /**
179
- * Polling Transport Implementation
180
- * Uses HTTP polling as fallback
181
- */
182
- class PollingTransport {
183
- intervalId = null;
184
- connected = false;
185
- abortController = null;
186
- constructor(config, callbacks) {
187
- this.config = config;
188
- this.callbacks = callbacks;
189
- }
190
- async connect() {
191
- this.connected = true;
192
- this.callbacks.onConnect?.();
193
- const poll = async () => {
194
- if (!this.config.sessionToken) {
195
- return;
196
- }
197
- try {
198
- this.abortController = new AbortController();
199
- const response = await fetch(`${this.config.baseURL}/api/auth/session/status/${this.config.sessionToken}`, {
200
- signal: this.abortController.signal,
201
- headers: this.config.accessToken ? {
202
- Authorization: `Bearer ${this.config.accessToken}`
203
- } : {}
204
- });
205
- if (!response.ok) {
206
- throw new Error(`Polling failed: ${response.statusText}`);
207
- }
208
- const data = await response.json();
209
- if (data.authorized && data.sessionId) {
210
- this.callbacks.onUpdate?.({
211
- status: 'authorized',
212
- sessionId: data.sessionId,
213
- publicKey: data.publicKey
214
- });
215
- } else if (data.status === 'expired') {
216
- this.callbacks.onUpdate?.({
217
- status: 'expired'
218
- });
219
- } else if (data.status === 'cancelled') {
220
- this.callbacks.onUpdate?.({
221
- status: 'cancelled'
222
- });
223
- }
224
- } catch (error) {
225
- if (error instanceof Error && error.name !== 'AbortError') {
226
- this.callbacks.onError?.(error);
227
- }
228
- }
229
- };
230
-
231
- // Poll immediately, then at intervals
232
- await poll();
233
- this.intervalId = setInterval(poll, this.config.pollingInterval ?? 3000);
234
- }
235
- disconnect() {
236
- if (this.intervalId) {
237
- clearInterval(this.intervalId);
238
- this.intervalId = null;
239
- }
240
- if (this.abortController) {
241
- this.abortController.abort();
242
- this.abortController = null;
243
- }
244
- this.connected = false;
245
- this.callbacks.onDisconnect?.();
246
- }
247
- isConnected() {
248
- return this.connected && this.intervalId !== null;
249
- }
250
- getType() {
251
- return 'polling';
252
- }
253
- }
254
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["TransportFactory","create","config","callbacks","isWebSocketAvailable","WebSocketTransport","error","isSSEAvailable","SSETransport","PollingTransport","window","process","EventSource","socket","connected","constructor","connect","io","default","Error","url","namespace","baseURL","socketOptions","transports","reconnection","reconnectionAttempts","reconnectAttempts","reconnectionDelay","reconnectDelay","accessToken","auth","token","on","sessionToken","emit","onConnect","payload","onUpdate","onError","onDisconnect","disconnect","isConnected","getType","eventSource","onopen","onmessage","event","update","JSON","parse","data","onerror","close","readyState","OPEN","intervalId","abortController","poll","AbortController","response","fetch","signal","headers","Authorization","ok","statusText","json","authorized","sessionId","status","publicKey","name","setInterval","pollingInterval","clearInterval","abort"],"sourceRoot":"../../../../src","sources":["shared/transport/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;;AA+BA;AACA;AACA;AACA;;AAuBA;AACA;AACA;AACA;AACA,OAAO,MAAMA,gBAAgB,CAAC;EAC5B;AACF;AACA;AACA;EACE,aAAaC,MAAMA,CACjBC,MAAuB,EACvBC,SAA6B,EACT;IACpB;IACA,IAAI,MAAM,IAAI,CAACC,oBAAoB,CAAC,CAAC,EAAE;MACrC,IAAI;QACF,OAAO,IAAIC,kBAAkB,CAACH,MAAM,EAAEC,SAAS,CAAC;MAClD,CAAC,CAAC,OAAOG,KAAK,EAAE;QACd;MAAA;IAEJ;;IAEA;IACA,IAAI,MAAM,IAAI,CAACC,cAAc,CAAC,CAAC,EAAE;MAC/B,IAAI;QACF,OAAO,IAAIC,YAAY,CAACN,MAAM,EAAEC,SAAS,CAAC;MAC5C,CAAC,CAAC,OAAOG,KAAK,EAAE;QACd;MAAA;IAEJ;;IAEA;IACA,OAAO,IAAIG,gBAAgB,CAACP,MAAM,EAAEC,SAAS,CAAC;EAChD;;EAEA;AACF;AACA;EACE,aAAqB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CAACwE,eAAe,IAAI,IACjC,CAAC;EACH;EAEAjC,UAAUA,CAAA,EAAS;IACjB,IAAI,IAAI,CAACe,UAAU,EAAE;MACnBmB,aAAa,CAAC,IAAI,CAACnB,UAAU,CAAC;MAC9B,IAAI,CAACA,UAAU,GAAG,IAAI;IACxB;IACA,IAAI,IAAI,CAACC,eAAe,EAAE;MACxB,IAAI,CAACA,eAAe,CAACmB,KAAK,CAAC,CAAC;MAC5B,IAAI,CAACnB,eAAe,GAAG,IAAI;IAC7B;IACA,IAAI,CAAC3C,SAAS,GAAG,KAAK;IACtB,IAAI,CAACX,SAAS,CAACqC,YAAY,GAAG,CAAC;EACjC;EAEAE,WAAWA,CAAA,EAAY;IACrB,OAAO,IAAI,CAAC5B,SAAS,IAAI,IAAI,CAAC0C,UAAU,KAAK,IAAI;EACnD;EAEAb,OAAOA,CAAA,EAAkB;IACvB,OAAO,SAAS;EAClB;AACF","ignoreList":[]}
@@ -1,74 +0,0 @@
1
- "use strict";
2
-
3
- /**
4
- * Shared Utilities
5
- *
6
- * Common utility functions used across Accounts, Services SDK, and API packages.
7
- */
8
-
9
- /**
10
- * Get a shortened display version of a public key
11
- * Format: first 8 chars ... last 8 chars
12
- */
13
- export function shortenPublicKey(publicKey) {
14
- if (publicKey.length <= 16) return publicKey;
15
- return `${publicKey.slice(0, 8)}...${publicKey.slice(-8)}`;
16
- }
17
-
18
- /**
19
- * Generate a secure random session token
20
- * Uses crypto.randomBytes (Node) or Web Crypto API (Browser/RN)
21
- */
22
- export async function generateSessionToken(size = 32) {
23
- // Use platform-appropriate random bytes
24
- if (typeof window !== 'undefined' && window.crypto) {
25
- // Web platform
26
- const array = new Uint8Array(size);
27
- window.crypto.getRandomValues(array);
28
- return Array.from(array, byte => byte.toString(16).padStart(2, '0')).join('');
29
- }
30
- if (typeof process !== 'undefined' && process.versions?.node) {
31
- // Node.js platform
32
- // eslint-disable-next-line @typescript-eslint/no-implied-eval
33
- const getCrypto = new Function('return require("crypto")');
34
- const crypto = getCrypto();
35
- return crypto.randomBytes(size).toString('hex');
36
- }
37
-
38
- // React Native - will be handled by platform adapter
39
- // For now, throw an error if we can't determine platform
40
- throw new Error('Unable to generate session token: no crypto implementation available');
41
- }
42
-
43
- /**
44
- * Generate a session token synchronously (Node.js only)
45
- */
46
- export function generateSessionTokenSync(size = 32) {
47
- if (typeof process === 'undefined' || !process.versions?.node) {
48
- throw new Error('generateSessionTokenSync can only be used in Node.js');
49
- }
50
-
51
- // eslint-disable-next-line @typescript-eslint/no-implied-eval
52
- const getCrypto = new Function('return require("crypto")');
53
- const crypto = getCrypto();
54
- return crypto.randomBytes(size).toString('hex');
55
- }
56
-
57
- /**
58
- * Convert bytes to hex string
59
- */
60
- export function bytesToHex(bytes) {
61
- return Array.from(bytes, byte => byte.toString(16).padStart(2, '0')).join('');
62
- }
63
-
64
- /**
65
- * Convert hex string to bytes
66
- */
67
- export function hexToBytes(hex) {
68
- const bytes = new Uint8Array(hex.length / 2);
69
- for (let i = 0; i < hex.length; i += 2) {
70
- bytes[i / 2] = parseInt(hex.substr(i, 2), 16);
71
- }
72
- return bytes;
73
- }
74
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["shortenPublicKey","publicKey","length","slice","generateSessionToken","size","window","crypto","array","Uint8Array","getRandomValues","Array","from","byte","toString","padStart","join","process","versions","node","getCrypto","Function","randomBytes","Error","generateSessionTokenSync","bytesToHex","bytes","hexToBytes","hex","i","parseInt","substr"],"sourceRoot":"../../../../src","sources":["shared/utils/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASA,gBAAgBA,CAACC,SAAiB,EAAU;EAC1D,IAAIA,SAAS,CAACC,MAAM,IAAI,EAAE,EAAE,OAAOD,SAAS;EAC5C,OAAO,GAAGA,SAAS,CAACE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,MAAMF,SAAS,CAACE,KAAK,CAAC,CAAC,CAAC,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AK,CAAC;AACjD;;AAEA;AACA;AACA;AACA,OAAO,SAASW,UAAUA,CAACC,KAAiB,EAAU;EACpD,OAAOf,KAAK,CAACC,IAAI,CAACc,KAAK,EAAEb,IAAI,IAAIA,IAAI,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAACC,IAAI,CAAC,EAAE,CAAC;AAC/E;;AAEA;AACA;AACA;AACA,OAAO,SAASW,UAAUA,CAACC,GAAW,EAAc;EAClD,MAAMF,KAAK,GAAG,IAAIjB,UAAU,CAACmB,GAAG,CAAC1B,MAAM,GAAG,CAAC,CAAC;EAC5C,KAAK,IAAI2B,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,GAAG,CAAC1B,MAAM,EAAE2B,CAAC,IAAI,CAAC,EAAE;IACtCH,KAAK,CAACG,CAAC,GAAG,CAAC,CAAC,GAAGC,QAAQ,CAACF,GAAG,CAACG,MAAM,CAACF,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;EAC/C;EACA,OAAOH,KAAK;AACd","ignoreList":[]}
@@ -1,50 +0,0 @@
1
- /**
2
- * Auth Service
3
- *
4
- * Handles authentication operations:
5
- * - Challenge retrieval
6
- * - Signing orchestration (delegated to Accounts/KeyManager)
7
- * - Session verification
8
- * - Access token retrieval
9
- * - Registration
10
- */
11
- import type { OxyConfig } from '../../models/interfaces';
12
- import type { User, LoginResponse, ChallengePayload } from '../../shared';
13
- export interface PublicKeyCheckResponse {
14
- registered: boolean;
15
- message: string;
16
- }
17
- export declare class AuthService {
18
- private httpService;
19
- constructor(config: OxyConfig);
20
- /**
21
- * Check if a public key is registered on the server
22
- */
23
- checkPublicKeyRegistered(publicKey: string): Promise<PublicKeyCheckResponse>;
24
- /**
25
- * Request an authentication challenge
26
- */
27
- requestChallenge(publicKey: string): Promise<ChallengePayload>;
28
- /**
29
- * Verify a challenge and authenticate (creates session)
30
- * This orchestrates signing via SignatureService (which uses KeyManager)
31
- */
32
- verifyChallenge(challenge: string): Promise<LoginResponse>;
33
- /**
34
- * Register a new identity with the server
35
- */
36
- register(publicKey: string, signature: string, timestamp: number, username?: string, email?: string): Promise<User>;
37
- /**
38
- * Register using current identity (signs automatically)
39
- */
40
- registerCurrentIdentity(username?: string, email?: string): Promise<User>;
41
- /**
42
- * Get user by public key
43
- */
44
- getUserByPublicKey(publicKey: string): Promise<User>;
45
- /**
46
- * Get user by session ID
47
- */
48
- getUserBySession(sessionId: string): Promise<User>;
49
- }
50
- //# sourceMappingURL=AuthService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AuthService.d.ts","sourceRoot":"","sources":["../../../../src/core/services/AuthService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAI1E,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,WAAW,CAAc;gBAErB,MAAM,EAAE,SAAS;IAI7B;;OAEG;IACG,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAalF;;OAEG;IACG,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAapE;;;OAGG;IACG,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAsBhE;;OAEG;IACG,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBzH;;OAEG;IACG,uBAAuB,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAS/E;;OAEG;IACG,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAa1D;;OAEG;IACG,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAYzD"}
@@ -1,31 +0,0 @@
1
- /**
2
- * Session Transport Service
3
- *
4
- * Uses shared transport abstraction for WebSocket/SSE/polling
5
- * Provides unified interface for session status updates
6
- */
7
- import type { OxyConfig } from '../../models/interfaces';
8
- import { type TransportCallbacks } from '../../shared';
9
- export declare class SessionTransportService {
10
- private transport;
11
- private config;
12
- constructor(config: OxyConfig);
13
- /**
14
- * Connect to session status updates
15
- * Automatically chooses best available transport (WebSocket > SSE > Polling)
16
- */
17
- connect(sessionToken: string, callbacks: TransportCallbacks): Promise<void>;
18
- /**
19
- * Disconnect from session updates
20
- */
21
- disconnect(): void;
22
- /**
23
- * Check if currently connected
24
- */
25
- isConnected(): boolean;
26
- /**
27
- * Get the transport type being used
28
- */
29
- getTransportType(): string;
30
- }
31
- //# sourceMappingURL=SessionTransportService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SessionTransportService.d.ts","sourceRoot":"","sources":["../../../../src/core/services/SessionTransportService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAGL,KAAK,kBAAkB,EAExB,MAAM,cAAc,CAAC;AAEtB,qBAAa,uBAAuB;IAClC,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,MAAM,CAAY;gBAEd,MAAM,EAAE,SAAS;IAI7B;;;OAGG;IACG,OAAO,CACX,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,kBAAkB,GAC5B,OAAO,CAAC,IAAI,CAAC;IAchB;;OAEG;IACH,UAAU,IAAI,IAAI;IAOlB;;OAEG;IACH,WAAW,IAAI,OAAO;IAItB;;OAEG;IACH,gBAAgB,IAAI,MAAM;CAG3B"}
@@ -1,39 +0,0 @@
1
- /**
2
- * User Service
3
- *
4
- * Handles user profile operations (no key handling):
5
- * - Profile fetch/update
6
- * - Profile search
7
- * - User recommendations
8
- */
9
- import type { OxyConfig } from '../../models/interfaces';
10
- import type { User, SearchProfilesResponse } from '../../shared';
11
- export interface PaginationParams {
12
- limit?: number;
13
- offset?: number;
14
- }
15
- export declare class UserService {
16
- private httpService;
17
- constructor(config: OxyConfig);
18
- /**
19
- * Get user profile by ID
20
- */
21
- getUserById(userId: string): Promise<User>;
22
- /**
23
- * Get profile by username
24
- */
25
- getProfileByUsername(username: string): Promise<User>;
26
- /**
27
- * Search user profiles
28
- */
29
- searchProfiles(query: string, pagination?: PaginationParams): Promise<SearchProfilesResponse>;
30
- /**
31
- * Get profile recommendations
32
- */
33
- getProfileRecommendations(): Promise<User[]>;
34
- /**
35
- * Update user profile
36
- */
37
- updateProfile(updates: Partial<User>): Promise<User>;
38
- }
39
- //# sourceMappingURL=UserService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UserService.d.ts","sourceRoot":"","sources":["../../../../src/core/services/UserService.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,sBAAsB,EAAkB,MAAM,cAAc,CAAC;AAGjF,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,WAAW,CAAc;gBAErB,MAAM,EAAE,SAAS;IAI7B;;OAEG;IACG,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAahD;;OAEG;IACG,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAa3D;;OAEG;IACG,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAgCnG;;OAEG;IACG,yBAAyB,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;IAalD;;OAEG;IACG,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAY3D"}
@@ -1,13 +0,0 @@
1
- /**
2
- * Focused Services
3
- *
4
- * Single-responsibility services replacing the mixin pattern:
5
- * - AuthService: Authentication, challenges, registration
6
- * - SessionService: Session management (already exists)
7
- * - UserService: User profile operations
8
- */
9
- export { AuthService } from './AuthService';
10
- export { sessionService } from './SessionService';
11
- export { UserService } from './UserService';
12
- export { tokenService } from './TokenService';
13
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/services/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
@@ -1,38 +0,0 @@
1
- /**
2
- * Canonical Message Builders
3
- *
4
- * Creates standardized, canonical message formats for signing.
5
- * These formats are used consistently across Accounts, Services SDK, and API.
6
- */
7
- import type { AuthChallengeResponse } from '../models/index';
8
- /**
9
- * Build authentication message for challenge-response
10
- * Format: auth:{publicKey}:{challenge}:{timestamp}
11
- */
12
- export declare function buildAuthMessage(publicKey: string, challenge: string, timestamp: number): string;
13
- /**
14
- * Build registration message
15
- * Format: oxy:register:{publicKey}:{timestamp}
16
- */
17
- export declare function buildRegistrationMessage(publicKey: string, timestamp: number): string;
18
- /**
19
- * Build request signing message
20
- * Format: request:{publicKey}:{timestamp}:{canonicalData}
21
- */
22
- export declare function buildRequestMessage(publicKey: string, timestamp: number, data: Record<string, unknown>): string;
23
- /**
24
- * Create canonical data representation for signing
25
- * Sorts keys and creates a consistent string representation
26
- */
27
- export declare function canonicalizeData(data: Record<string, unknown>): string;
28
- /**
29
- * Build auth challenge response payload
30
- * Helper to construct the signed challenge response
31
- */
32
- export declare function buildAuthChallengeResponse(publicKey: string, challenge: string, signature: string, timestamp: number): AuthChallengeResponse;
33
- /**
34
- * Validate timestamp freshness
35
- * Ensures signed messages are not too old
36
- */
37
- export declare function isTimestampFresh(timestamp: number, maxAgeMs?: number): boolean;
38
- //# sourceMappingURL=messageBuilders.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"messageBuilders.d.ts","sourceRoot":"","sources":["../../../../src/shared/crypto/messageBuilders.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAiB,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE5E;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,MAAM,CAER;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,MAAM,CAER;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,MAAM,CAOR;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAItE;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,qBAAqB,CAOvB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,EACjB,QAAQ,GAAE,MAAsB,GAC/B,OAAO,CAGT"}
@@ -1,54 +0,0 @@
1
- /**
2
- * Platform Detection and Adapters
3
- *
4
- * Provides environment detection and platform-specific crypto adapters
5
- * to support Node.js, React Native, and Web environments.
6
- */
7
- /**
8
- * Platform types
9
- */
10
- export type Platform = 'node' | 'react-native' | 'web';
11
- /**
12
- * Platform detection utilities
13
- */
14
- export declare const PlatformDetector: {
15
- /**
16
- * Detect current platform
17
- */
18
- detect(): Platform;
19
- /**
20
- * Check if running in Node.js
21
- */
22
- isNode(): boolean;
23
- /**
24
- * Check if running in React Native
25
- */
26
- isReactNative(): boolean;
27
- /**
28
- * Check if running in Web browser
29
- */
30
- isWeb(): boolean;
31
- };
32
- /**
33
- * Crypto adapter interface
34
- * Platform-specific implementations must implement this interface
35
- */
36
- export interface CryptoAdapter {
37
- /**
38
- * Generate random bytes
39
- */
40
- randomBytes(size: number): Promise<Uint8Array>;
41
- /**
42
- * Compute SHA-256 hash
43
- */
44
- sha256(message: string): Promise<string>;
45
- /**
46
- * Synchronous SHA-256 hash (Node.js only)
47
- */
48
- sha256Sync?(message: string): string;
49
- }
50
- /**
51
- * Get the appropriate crypto adapter for the current platform
52
- */
53
- export declare function getCryptoAdapter(): Promise<CryptoAdapter>;
54
- //# sourceMappingURL=platform.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../../../src/shared/crypto/platform.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,cAAc,GAAG,KAAK,CAAC;AAEvD;;GAEG;AACH,eAAO,MAAM,gBAAgB;IAC3B;;OAEG;cACO,QAAQ;IAUlB;;OAEG;cACO,OAAO;IAIjB;;OAEG;qBACc,OAAO;IAIxB;;OAEG;aACM,OAAO;CAGjB,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAE/C;;OAEG;IACH,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEzC;;OAEG;IACH,UAAU,CAAC,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;CACtC;AAED;;GAEG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,aAAa,CAAC,CA+D/D"}