@easyling/sanity-connector 0.0.1 → 0.0.2-rc.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 (242) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/package.json +18 -12
  3. package/dist/actions/bulkTranslate.d.ts +0 -7
  4. package/dist/actions/bulkTranslate.d.ts.map +0 -1
  5. package/dist/actions/bulkTranslate.js +0 -543
  6. package/dist/actions/bulkTranslate.js.map +0 -1
  7. package/dist/actions/manageDNTFields.d.ts +0 -12
  8. package/dist/actions/manageDNTFields.d.ts.map +0 -1
  9. package/dist/actions/manageDNTFields.js +0 -100
  10. package/dist/actions/manageDNTFields.js.map +0 -1
  11. package/dist/actions/translateDocument.d.ts +0 -7
  12. package/dist/actions/translateDocument.d.ts.map +0 -1
  13. package/dist/actions/translateDocument.js +0 -256
  14. package/dist/actions/translateDocument.js.map +0 -1
  15. package/dist/components/RadioWithDefault.d.ts +0 -17
  16. package/dist/components/RadioWithDefault.d.ts.map +0 -1
  17. package/dist/components/RadioWithDefault.js +0 -29
  18. package/dist/components/RadioWithDefault.js.map +0 -1
  19. package/dist/components/auth/AuthNavbar.d.ts +0 -18
  20. package/dist/components/auth/AuthNavbar.d.ts.map +0 -1
  21. package/dist/components/auth/AuthNavbar.js +0 -15
  22. package/dist/components/auth/AuthNavbar.js.map +0 -1
  23. package/dist/components/auth/AuthStatus.d.ts +0 -27
  24. package/dist/components/auth/AuthStatus.d.ts.map +0 -1
  25. package/dist/components/auth/AuthStatus.js +0 -82
  26. package/dist/components/auth/AuthStatus.js.map +0 -1
  27. package/dist/components/auth/AuthStatusWrapper.d.ts +0 -15
  28. package/dist/components/auth/AuthStatusWrapper.d.ts.map +0 -1
  29. package/dist/components/auth/AuthStatusWrapper.js +0 -39
  30. package/dist/components/auth/AuthStatusWrapper.js.map +0 -1
  31. package/dist/components/auth/MigrationPrompt.d.ts +0 -20
  32. package/dist/components/auth/MigrationPrompt.d.ts.map +0 -1
  33. package/dist/components/auth/MigrationPrompt.js +0 -16
  34. package/dist/components/auth/MigrationPrompt.js.map +0 -1
  35. package/dist/components/auth/MigrationPromptWrapper.d.ts +0 -14
  36. package/dist/components/auth/MigrationPromptWrapper.d.ts.map +0 -1
  37. package/dist/components/auth/MigrationPromptWrapper.js +0 -16
  38. package/dist/components/auth/MigrationPromptWrapper.js.map +0 -1
  39. package/dist/components/auth/OAuthCallback.d.ts +0 -20
  40. package/dist/components/auth/OAuthCallback.d.ts.map +0 -1
  41. package/dist/components/auth/OAuthCallback.js +0 -12
  42. package/dist/components/auth/OAuthCallback.js.map +0 -1
  43. package/dist/components/auth/index.d.ts +0 -15
  44. package/dist/components/auth/index.d.ts.map +0 -1
  45. package/dist/components/auth/index.js +0 -12
  46. package/dist/components/auth/index.js.map +0 -1
  47. package/dist/components/config/LocaleConfigTool.d.ts +0 -17
  48. package/dist/components/config/LocaleConfigTool.d.ts.map +0 -1
  49. package/dist/components/config/LocaleConfigTool.js +0 -186
  50. package/dist/components/config/LocaleConfigTool.js.map +0 -1
  51. package/dist/components/config/LocaleConfigToolWrapper.d.ts +0 -13
  52. package/dist/components/config/LocaleConfigToolWrapper.d.ts.map +0 -1
  53. package/dist/components/config/LocaleConfigToolWrapper.js +0 -26
  54. package/dist/components/config/LocaleConfigToolWrapper.js.map +0 -1
  55. package/dist/components/config/OAuthConfig.d.ts +0 -26
  56. package/dist/components/config/OAuthConfig.d.ts.map +0 -1
  57. package/dist/components/config/OAuthConfig.js +0 -152
  58. package/dist/components/config/OAuthConfig.js.map +0 -1
  59. package/dist/components/config/OAuthConfigWrapper.d.ts +0 -13
  60. package/dist/components/config/OAuthConfigWrapper.d.ts.map +0 -1
  61. package/dist/components/config/OAuthConfigWrapper.js +0 -41
  62. package/dist/components/config/OAuthConfigWrapper.js.map +0 -1
  63. package/dist/components/config/PasswordInput.d.ts +0 -14
  64. package/dist/components/config/PasswordInput.d.ts.map +0 -1
  65. package/dist/components/config/PasswordInput.js +0 -23
  66. package/dist/components/config/PasswordInput.js.map +0 -1
  67. package/dist/components/config/index.d.ts +0 -9
  68. package/dist/components/config/index.d.ts.map +0 -1
  69. package/dist/components/config/index.js +0 -8
  70. package/dist/components/config/index.js.map +0 -1
  71. package/dist/components/config/localeConfigToolDefinition.d.ts +0 -13
  72. package/dist/components/config/localeConfigToolDefinition.d.ts.map +0 -1
  73. package/dist/components/config/localeConfigToolDefinition.js +0 -19
  74. package/dist/components/config/localeConfigToolDefinition.js.map +0 -1
  75. package/dist/components/config/oauthConfigToolDefinition.d.ts +0 -13
  76. package/dist/components/config/oauthConfigToolDefinition.d.ts.map +0 -1
  77. package/dist/components/config/oauthConfigToolDefinition.js +0 -19
  78. package/dist/components/config/oauthConfigToolDefinition.js.map +0 -1
  79. package/dist/components/dialogs/ConfirmationDialog.d.ts +0 -21
  80. package/dist/components/dialogs/ConfirmationDialog.d.ts.map +0 -1
  81. package/dist/components/dialogs/ConfirmationDialog.js +0 -28
  82. package/dist/components/dialogs/ConfirmationDialog.js.map +0 -1
  83. package/dist/components/dialogs/ErrorDialog.d.ts +0 -21
  84. package/dist/components/dialogs/ErrorDialog.d.ts.map +0 -1
  85. package/dist/components/dialogs/ErrorDialog.js +0 -28
  86. package/dist/components/dialogs/ErrorDialog.js.map +0 -1
  87. package/dist/components/dialogs/LocaleSelectionDialog.d.ts +0 -41
  88. package/dist/components/dialogs/LocaleSelectionDialog.d.ts.map +0 -1
  89. package/dist/components/dialogs/LocaleSelectionDialog.js +0 -117
  90. package/dist/components/dialogs/LocaleSelectionDialog.js.map +0 -1
  91. package/dist/components/dialogs/SuccessDialog.d.ts +0 -19
  92. package/dist/components/dialogs/SuccessDialog.d.ts.map +0 -1
  93. package/dist/components/dialogs/SuccessDialog.js +0 -37
  94. package/dist/components/dialogs/SuccessDialog.js.map +0 -1
  95. package/dist/components/dialogs/index.d.ts +0 -12
  96. package/dist/components/dialogs/index.d.ts.map +0 -1
  97. package/dist/components/dialogs/index.js +0 -8
  98. package/dist/components/dialogs/index.js.map +0 -1
  99. package/dist/components/dnt/DNTFieldBadge.d.ts +0 -16
  100. package/dist/components/dnt/DNTFieldBadge.d.ts.map +0 -1
  101. package/dist/components/dnt/DNTFieldBadge.js +0 -56
  102. package/dist/components/dnt/DNTFieldBadge.js.map +0 -1
  103. package/dist/components/dnt/DNTFieldComponent.d.ts +0 -17
  104. package/dist/components/dnt/DNTFieldComponent.d.ts.map +0 -1
  105. package/dist/components/dnt/DNTFieldComponent.js +0 -21
  106. package/dist/components/dnt/DNTFieldComponent.js.map +0 -1
  107. package/dist/components/dnt/DNTFieldInput.d.ts +0 -14
  108. package/dist/components/dnt/DNTFieldInput.d.ts.map +0 -1
  109. package/dist/components/dnt/DNTFieldInput.js +0 -76
  110. package/dist/components/dnt/DNTFieldInput.js.map +0 -1
  111. package/dist/components/dnt/index.d.ts +0 -7
  112. package/dist/components/dnt/index.d.ts.map +0 -1
  113. package/dist/components/dnt/index.js +0 -7
  114. package/dist/components/dnt/index.js.map +0 -1
  115. package/dist/config/index.d.ts +0 -6
  116. package/dist/config/index.d.ts.map +0 -1
  117. package/dist/config/index.js +0 -6
  118. package/dist/config/index.js.map +0 -1
  119. package/dist/config/pluginConfig.d.ts +0 -163
  120. package/dist/config/pluginConfig.d.ts.map +0 -1
  121. package/dist/config/pluginConfig.js +0 -548
  122. package/dist/config/pluginConfig.js.map +0 -1
  123. package/dist/index.d.ts +0 -12
  124. package/dist/index.d.ts.map +0 -1
  125. package/dist/index.js +0 -12
  126. package/dist/index.js.map +0 -1
  127. package/dist/plugin.d.ts +0 -3
  128. package/dist/plugin.d.ts.map +0 -1
  129. package/dist/plugin.js +0 -137
  130. package/dist/plugin.js.map +0 -1
  131. package/dist/services/authStateManager.d.ts +0 -94
  132. package/dist/services/authStateManager.d.ts.map +0 -1
  133. package/dist/services/authStateManager.js +0 -208
  134. package/dist/services/authStateManager.js.map +0 -1
  135. package/dist/services/contentExtractor.d.ts +0 -95
  136. package/dist/services/contentExtractor.d.ts.map +0 -1
  137. package/dist/services/contentExtractor.js +0 -516
  138. package/dist/services/contentExtractor.js.map +0 -1
  139. package/dist/services/dialogService.d.ts +0 -96
  140. package/dist/services/dialogService.d.ts.map +0 -1
  141. package/dist/services/dialogService.js +0 -244
  142. package/dist/services/dialogService.js.map +0 -1
  143. package/dist/services/dntServiceManager.d.ts +0 -44
  144. package/dist/services/dntServiceManager.d.ts.map +0 -1
  145. package/dist/services/dntServiceManager.js +0 -74
  146. package/dist/services/dntServiceManager.js.map +0 -1
  147. package/dist/services/dntStorageAdapter.d.ts +0 -73
  148. package/dist/services/dntStorageAdapter.d.ts.map +0 -1
  149. package/dist/services/dntStorageAdapter.js +0 -192
  150. package/dist/services/dntStorageAdapter.js.map +0 -1
  151. package/dist/services/documentCreationService.d.ts +0 -139
  152. package/dist/services/documentCreationService.d.ts.map +0 -1
  153. package/dist/services/documentCreationService.js +0 -938
  154. package/dist/services/documentCreationService.js.map +0 -1
  155. package/dist/services/localeService.d.ts +0 -160
  156. package/dist/services/localeService.d.ts.map +0 -1
  157. package/dist/services/localeService.js +0 -300
  158. package/dist/services/localeService.js.map +0 -1
  159. package/dist/services/localeStorageAdapter.d.ts +0 -42
  160. package/dist/services/localeStorageAdapter.d.ts.map +0 -1
  161. package/dist/services/localeStorageAdapter.js +0 -107
  162. package/dist/services/localeStorageAdapter.js.map +0 -1
  163. package/dist/services/oauthConfigStorage.d.ts +0 -46
  164. package/dist/services/oauthConfigStorage.d.ts.map +0 -1
  165. package/dist/services/oauthConfigStorage.js +0 -122
  166. package/dist/services/oauthConfigStorage.js.map +0 -1
  167. package/dist/services/oauthService.d.ts +0 -48
  168. package/dist/services/oauthService.d.ts.map +0 -1
  169. package/dist/services/oauthService.js +0 -71
  170. package/dist/services/oauthService.js.map +0 -1
  171. package/dist/services/oauthServiceManager.d.ts +0 -189
  172. package/dist/services/oauthServiceManager.d.ts.map +0 -1
  173. package/dist/services/oauthServiceManager.js +0 -380
  174. package/dist/services/oauthServiceManager.js.map +0 -1
  175. package/dist/services/tokenStorage.d.ts +0 -54
  176. package/dist/services/tokenStorage.d.ts.map +0 -1
  177. package/dist/services/tokenStorage.js +0 -140
  178. package/dist/services/tokenStorage.js.map +0 -1
  179. package/dist/services/translationService.d.ts +0 -374
  180. package/dist/services/translationService.d.ts.map +0 -1
  181. package/dist/services/translationService.js +0 -687
  182. package/dist/services/translationService.js.map +0 -1
  183. package/dist/services/unifiedConfigStorage.d.ts +0 -124
  184. package/dist/services/unifiedConfigStorage.d.ts.map +0 -1
  185. package/dist/services/unifiedConfigStorage.js +0 -304
  186. package/dist/services/unifiedConfigStorage.js.map +0 -1
  187. package/dist/test-utils.d.ts +0 -9
  188. package/dist/test-utils.d.ts.map +0 -1
  189. package/dist/test-utils.js +0 -13
  190. package/dist/test-utils.js.map +0 -1
  191. package/dist/types/dialog.d.ts +0 -107
  192. package/dist/types/dialog.d.ts.map +0 -1
  193. package/dist/types/dialog.js +0 -6
  194. package/dist/types/dialog.js.map +0 -1
  195. package/dist/types/dnt.d.ts +0 -84
  196. package/dist/types/dnt.d.ts.map +0 -1
  197. package/dist/types/dnt.js +0 -5
  198. package/dist/types/dnt.js.map +0 -1
  199. package/dist/types/index.d.ts +0 -12
  200. package/dist/types/index.d.ts.map +0 -1
  201. package/dist/types/index.js +0 -6
  202. package/dist/types/index.js.map +0 -1
  203. package/dist/types/locale.d.ts +0 -116
  204. package/dist/types/locale.d.ts.map +0 -1
  205. package/dist/types/locale.js +0 -189
  206. package/dist/types/locale.js.map +0 -1
  207. package/dist/types/oauth.d.ts +0 -90
  208. package/dist/types/oauth.d.ts.map +0 -1
  209. package/dist/types/oauth.js +0 -62
  210. package/dist/types/oauth.js.map +0 -1
  211. package/dist/types/pluginConfig.d.ts +0 -45
  212. package/dist/types/pluginConfig.d.ts.map +0 -1
  213. package/dist/types/pluginConfig.js +0 -6
  214. package/dist/types/pluginConfig.js.map +0 -1
  215. package/dist/types/translation.d.ts +0 -122
  216. package/dist/types/translation.d.ts.map +0 -1
  217. package/dist/types/translation.js +0 -6
  218. package/dist/types/translation.js.map +0 -1
  219. package/dist/utils/htmlFormatter.d.ts +0 -66
  220. package/dist/utils/htmlFormatter.d.ts.map +0 -1
  221. package/dist/utils/htmlFormatter.js +0 -191
  222. package/dist/utils/htmlFormatter.js.map +0 -1
  223. package/dist/utils/index.d.ts +0 -15
  224. package/dist/utils/index.d.ts.map +0 -1
  225. package/dist/utils/index.js +0 -16
  226. package/dist/utils/index.js.map +0 -1
  227. package/dist/utils/logger.d.ts +0 -105
  228. package/dist/utils/logger.d.ts.map +0 -1
  229. package/dist/utils/logger.js +0 -229
  230. package/dist/utils/logger.js.map +0 -1
  231. package/dist/utils/oauthErrorFeedback.d.ts +0 -76
  232. package/dist/utils/oauthErrorFeedback.d.ts.map +0 -1
  233. package/dist/utils/oauthErrorFeedback.js +0 -134
  234. package/dist/utils/oauthErrorFeedback.js.map +0 -1
  235. package/dist/utils/oauthLogger.d.ts +0 -176
  236. package/dist/utils/oauthLogger.d.ts.map +0 -1
  237. package/dist/utils/oauthLogger.js +0 -282
  238. package/dist/utils/oauthLogger.js.map +0 -1
  239. package/dist/utils/validator.d.ts +0 -67
  240. package/dist/utils/validator.d.ts.map +0 -1
  241. package/dist/utils/validator.js +0 -390
  242. package/dist/utils/validator.js.map +0 -1
@@ -1,244 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- /**
3
- * Dialog management service with React state management
4
- * Requirements: 3.1, 3.2, 3.5, 3.6, 3.7
5
- *
6
- * Centralized dialog management with queue support for multiple simultaneous dialogs
7
- */
8
- import { createContext, useContext, useState, useCallback } from 'react';
9
- import { ConfirmationDialog } from '../components/dialogs/ConfirmationDialog';
10
- import { SuccessDialog } from '../components/dialogs/SuccessDialog';
11
- import { ErrorDialog } from '../components/dialogs/ErrorDialog';
12
- import { LocaleSelectionDialog } from '../components/dialogs/LocaleSelectionDialog';
13
- /**
14
- * Dialog context for React components
15
- */
16
- const DialogContext = createContext(null);
17
- /**
18
- * Hook to access dialog service from React components
19
- */
20
- export const useDialogService = () => {
21
- const context = useContext(DialogContext);
22
- if (!context) {
23
- throw new Error('useDialogService must be used within a DialogProvider');
24
- }
25
- return context;
26
- };
27
- /**
28
- * Dialog Provider Component
29
- * Manages dialog state and queue for the entire application
30
- */
31
- export const DialogProvider = ({ children }) => {
32
- const [currentDialog, setCurrentDialog] = useState(null);
33
- const [dialogQueue, setDialogQueue] = useState([]);
34
- /**
35
- * Process the next dialog in the queue
36
- */
37
- const processNextDialog = useCallback(() => {
38
- setDialogQueue((queue) => {
39
- if (queue.length === 0) {
40
- setCurrentDialog(null);
41
- return queue;
42
- }
43
- const [next, ...rest] = queue;
44
- setCurrentDialog(next);
45
- return rest;
46
- });
47
- }, []);
48
- /**
49
- * Add a dialog to the queue
50
- */
51
- const enqueueDialog = useCallback((type, options) => {
52
- return new Promise((resolve, reject) => {
53
- const dialogItem = {
54
- id: `dialog-${Date.now()}-${Math.random()}`,
55
- type,
56
- options,
57
- resolve: resolve,
58
- reject,
59
- };
60
- setDialogQueue((queue) => {
61
- // If no current dialog, show immediately
62
- if (!currentDialog && queue.length === 0) {
63
- setCurrentDialog(dialogItem);
64
- return [];
65
- }
66
- // Otherwise add to queue
67
- return [...queue, dialogItem];
68
- });
69
- });
70
- }, [currentDialog]);
71
- /**
72
- * Close the current dialog and process next in queue
73
- */
74
- const closeCurrentDialog = useCallback((result) => {
75
- if (currentDialog?.resolve) {
76
- currentDialog.resolve(result);
77
- }
78
- processNextDialog();
79
- }, [currentDialog, processNextDialog]);
80
- /**
81
- * Show a confirmation dialog
82
- */
83
- const showConfirmation = useCallback((options) => {
84
- return enqueueDialog('confirmation', options);
85
- }, [enqueueDialog]);
86
- /**
87
- * Show a locale selection dialog
88
- */
89
- const showLocaleSelection = useCallback((options) => {
90
- return enqueueDialog('localeSelection', options);
91
- }, [enqueueDialog]);
92
- /**
93
- * Show a success dialog (non-blocking)
94
- */
95
- const showSuccess = useCallback((options) => {
96
- enqueueDialog('success', options).catch(() => {
97
- // Success dialogs don't reject
98
- });
99
- }, [enqueueDialog]);
100
- /**
101
- * Show an error dialog
102
- */
103
- const showError = useCallback((options) => {
104
- return enqueueDialog('error', options);
105
- }, [enqueueDialog]);
106
- /**
107
- * Close all dialogs and clear the queue
108
- */
109
- const closeAll = useCallback(() => {
110
- // Reject all pending dialogs
111
- if (currentDialog?.reject) {
112
- currentDialog.reject(new Error('Dialog closed'));
113
- }
114
- dialogQueue.forEach((dialog) => {
115
- if (dialog.reject) {
116
- dialog.reject(new Error('Dialog closed'));
117
- }
118
- });
119
- setCurrentDialog(null);
120
- setDialogQueue([]);
121
- }, [currentDialog, dialogQueue]);
122
- /**
123
- * Handle confirmation dialog actions
124
- */
125
- const handleConfirmationConfirm = useCallback(() => {
126
- closeCurrentDialog(true);
127
- }, [closeCurrentDialog]);
128
- const handleConfirmationCancel = useCallback(() => {
129
- closeCurrentDialog(false);
130
- }, [closeCurrentDialog]);
131
- /**
132
- * Handle locale selection dialog actions
133
- */
134
- const handleLocaleSelectionConfirm = useCallback((selectedLocales, creationMode) => {
135
- // Convert to LocaleSelectionResult
136
- const result = {
137
- locales: selectedLocales,
138
- creationMode
139
- };
140
- closeCurrentDialog(result);
141
- }, [closeCurrentDialog]);
142
- const handleLocaleSelectionCancel = useCallback(() => {
143
- closeCurrentDialog({ locales: [] });
144
- }, [closeCurrentDialog]);
145
- /**
146
- * Handle success dialog close
147
- */
148
- const handleSuccessClose = useCallback(() => {
149
- closeCurrentDialog(true);
150
- }, [closeCurrentDialog]);
151
- /**
152
- * Handle error dialog actions
153
- */
154
- const handleErrorClose = useCallback(() => {
155
- closeCurrentDialog(false);
156
- }, [closeCurrentDialog]);
157
- const handleErrorRetry = useCallback(() => {
158
- closeCurrentDialog(true);
159
- }, [closeCurrentDialog]);
160
- const contextValue = {
161
- currentDialog,
162
- dialogQueue,
163
- showConfirmation,
164
- showLocaleSelection,
165
- showSuccess,
166
- showError,
167
- closeAll,
168
- };
169
- return (_jsxs(DialogContext.Provider, { value: contextValue, children: [children, currentDialog?.type === 'confirmation' && (_jsx(ConfirmationDialog, { open: true, ...currentDialog.options, onConfirm: handleConfirmationConfirm, onCancel: handleConfirmationCancel })), currentDialog?.type === 'localeSelection' && (_jsx(LocaleSelectionDialog, { open: true, ...currentDialog.options, onConfirm: handleLocaleSelectionConfirm, onCancel: handleLocaleSelectionCancel })), currentDialog?.type === 'success' && (_jsx(SuccessDialog, { open: true, ...currentDialog.options, onClose: handleSuccessClose })), currentDialog?.type === 'error' && (_jsx(ErrorDialog, { open: true, ...currentDialog.options, onClose: handleErrorClose, onRetry: currentDialog.options.showRetry ? handleErrorRetry : undefined }))] }));
170
- };
171
- /**
172
- * Singleton DialogService class for non-React contexts
173
- * Note: This requires the DialogProvider to be mounted in the React tree
174
- */
175
- export class DialogService {
176
- constructor() {
177
- this.contextRef = null;
178
- }
179
- /**
180
- * Get singleton instance
181
- */
182
- static getInstance() {
183
- if (!DialogService.instance) {
184
- DialogService.instance = new DialogService();
185
- }
186
- return DialogService.instance;
187
- }
188
- /**
189
- * Set the context reference (called by DialogProvider)
190
- */
191
- setContext(context) {
192
- this.contextRef = context;
193
- }
194
- /**
195
- * Show a confirmation dialog
196
- */
197
- async showConfirmation(options) {
198
- if (!this.contextRef) {
199
- throw new Error('DialogService not initialized. Ensure DialogProvider is mounted.');
200
- }
201
- return this.contextRef.showConfirmation(options);
202
- }
203
- /**
204
- * Show a locale selection dialog
205
- */
206
- async showLocaleSelection(options) {
207
- if (!this.contextRef) {
208
- throw new Error('DialogService not initialized. Ensure DialogProvider is mounted.');
209
- }
210
- return this.contextRef.showLocaleSelection(options);
211
- }
212
- /**
213
- * Show a success notification
214
- */
215
- showSuccess(options) {
216
- if (!this.contextRef) {
217
- throw new Error('DialogService not initialized. Ensure DialogProvider is mounted.');
218
- }
219
- this.contextRef.showSuccess(options);
220
- }
221
- /**
222
- * Show an error dialog
223
- */
224
- async showError(options) {
225
- if (!this.contextRef) {
226
- throw new Error('DialogService not initialized. Ensure DialogProvider is mounted.');
227
- }
228
- return this.contextRef.showError(options);
229
- }
230
- /**
231
- * Close all open dialogs
232
- */
233
- closeAll() {
234
- if (!this.contextRef) {
235
- throw new Error('DialogService not initialized. Ensure DialogProvider is mounted.');
236
- }
237
- this.contextRef.closeAll();
238
- }
239
- }
240
- /**
241
- * Export singleton instance for convenience
242
- */
243
- export const dialogService = DialogService.getInstance();
244
- //# sourceMappingURL=dialogService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dialogService.js","sourceRoot":"","sources":["../../src/services/dialogService.tsx"],"names":[],"mappings":";AAAA;;;;;GAKG;AAEH,OAAc,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAa,MAAM,OAAO,CAAC;AAS3F,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAwCpF;;GAEG;AACH,MAAM,aAAa,GAAG,aAAa,CAA4B,IAAI,CAAC,CAAC;AAErE;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAuB,EAAE;IACvD,MAAM,OAAO,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;IAC1C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AASF;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAkC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC5E,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAyB,IAAI,CAAC,CAAC;IAC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,KAAK,CAAC,kEAAkE,CAAC,CAAC;QACtF,CAAC;QACD,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;IAED;;OAEG;IACI,QAAQ;QACb,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;QACtF,CAAC;QACD,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;IAC7B,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAC,WAAW,EAAE,CAAC"}
@@ -1,44 +0,0 @@
1
- /**
2
- * DNT Service Manager
3
- *
4
- * Provides singleton access to DNTStorageAdapter with proper initialization.
5
- * Similar to OAuthServiceManager pattern.
6
- */
7
- import { SanityClient } from 'sanity';
8
- import { DNTStorageAdapter } from './dntStorageAdapter';
9
- /**
10
- * Singleton manager for DNT storage services
11
- */
12
- export declare class DNTServiceManager {
13
- private static instance;
14
- private dntStorage;
15
- private client;
16
- private constructor();
17
- /**
18
- * Get or create the singleton instance
19
- */
20
- static getInstance(client?: SanityClient): DNTServiceManager;
21
- /**
22
- * Initialize the service with a Sanity client
23
- */
24
- initialize(client: SanityClient): void;
25
- /**
26
- * Get the DNT storage adapter
27
- * Throws if not initialized
28
- */
29
- getDNTStorage(): DNTStorageAdapter;
30
- /**
31
- * Check if the service is initialized
32
- */
33
- isInitialized(): boolean;
34
- /**
35
- * Reset the singleton instance (useful for testing)
36
- */
37
- static reset(): void;
38
- }
39
- /**
40
- * Convenience function to get DNT storage adapter
41
- * Throws if service is not initialized
42
- */
43
- export declare function getDNTStorage(): DNTStorageAdapter;
44
- //# sourceMappingURL=dntServiceManager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dntServiceManager.d.ts","sourceRoot":"","sources":["../../src/services/dntServiceManager.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD;;GAEG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAkC;IACzD,OAAO,CAAC,UAAU,CAAkC;IACpD,OAAO,CAAC,MAAM,CAA6B;IAE3C,OAAO;IAIP;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,iBAAiB;IAY5D;;OAEG;IACH,UAAU,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;IAatC;;;OAGG;IACH,aAAa,IAAI,iBAAiB;IAOlC;;OAEG;IACH,aAAa,IAAI,OAAO;IAIxB;;OAEG;IACH,MAAM,CAAC,KAAK,IAAI,IAAI;CAGrB;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,iBAAiB,CAEjD"}
@@ -1,74 +0,0 @@
1
- /**
2
- * DNT Service Manager
3
- *
4
- * Provides singleton access to DNTStorageAdapter with proper initialization.
5
- * Similar to OAuthServiceManager pattern.
6
- */
7
- import { DNTStorageAdapter } from './dntStorageAdapter';
8
- import { UnifiedConfigStorage } from './unifiedConfigStorage';
9
- /**
10
- * Singleton manager for DNT storage services
11
- */
12
- export class DNTServiceManager {
13
- constructor() {
14
- this.dntStorage = null;
15
- this.client = null;
16
- // Private constructor for singleton
17
- }
18
- /**
19
- * Get or create the singleton instance
20
- */
21
- static getInstance(client) {
22
- if (!DNTServiceManager.instance) {
23
- DNTServiceManager.instance = new DNTServiceManager();
24
- }
25
- if (client && !DNTServiceManager.instance.client) {
26
- DNTServiceManager.instance.initialize(client);
27
- }
28
- return DNTServiceManager.instance;
29
- }
30
- /**
31
- * Initialize the service with a Sanity client
32
- */
33
- initialize(client) {
34
- if (this.client && this.dntStorage) {
35
- // Already initialized
36
- return;
37
- }
38
- this.client = client;
39
- const unifiedStorage = new UnifiedConfigStorage(client);
40
- this.dntStorage = new DNTStorageAdapter(unifiedStorage);
41
- console.log('DNT Service Manager initialized');
42
- }
43
- /**
44
- * Get the DNT storage adapter
45
- * Throws if not initialized
46
- */
47
- getDNTStorage() {
48
- if (!this.dntStorage) {
49
- throw new Error('DNT Service Manager not initialized. Call initialize() with a SanityClient first.');
50
- }
51
- return this.dntStorage;
52
- }
53
- /**
54
- * Check if the service is initialized
55
- */
56
- isInitialized() {
57
- return this.dntStorage !== null;
58
- }
59
- /**
60
- * Reset the singleton instance (useful for testing)
61
- */
62
- static reset() {
63
- DNTServiceManager.instance = null;
64
- }
65
- }
66
- DNTServiceManager.instance = null;
67
- /**
68
- * Convenience function to get DNT storage adapter
69
- * Throws if service is not initialized
70
- */
71
- export function getDNTStorage() {
72
- return DNTServiceManager.getInstance().getDNTStorage();
73
- }
74
- //# sourceMappingURL=dntServiceManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dntServiceManager.js","sourceRoot":"","sources":["../../src/services/dntServiceManager.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAK5B;QAHQ,eAAU,GAA6B,IAAI,CAAC;QAC5C,WAAM,GAAwB,IAAI,CAAC;QAGzC,oCAAoC;IACtC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,MAAqB;QACtC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC;YAChC,iBAAiB,CAAC,QAAQ,GAAG,IAAI,iBAAiB,EAAE,CAAC;QACvD,CAAC;QAED,IAAI,MAAM,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YACjD,iBAAiB,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAChD,CAAC;QAED,OAAO,iBAAiB,CAAC,QAAQ,CAAC;IACpC,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,MAAoB;QAC7B,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACnC,sBAAsB;YACtB,OAAO;QACT,CAAC;QAED,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,MAAM,cAAc,GAAG,IAAI,oBAAoB,CAAC,MAAM,CAAC,CAAC;QACxD,IAAI,CAAC,UAAU,GAAG,IAAI,iBAAiB,CAAC,cAAc,CAAC,CAAC;QAExD,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;IACjD,CAAC;IAED;;;OAGG;IACH,aAAa;QACX,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,mFAAmF,CAAC,CAAC;QACvG,CAAC;QACD,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,aAAa;QACX,OAAO,IAAI,CAAC,UAAU,KAAK,IAAI,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,KAAK;QACV,iBAAiB,CAAC,QAAQ,GAAG,IAAI,CAAC;IACpC,CAAC;;AA9Dc,0BAAQ,GAA6B,IAAI,AAAjC,CAAkC;AAiE3D;;;GAGG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,iBAAiB,CAAC,WAAW,EAAE,CAAC,aAAa,EAAE,CAAC;AACzD,CAAC"}
@@ -1,73 +0,0 @@
1
- /**
2
- * DNT (Do Not Translate) preferences storage adapter
3
- *
4
- * Now uses document-type-based storage in the unified configuration.
5
- * When you mark a field as DNT for any document of a type (e.g., 'product'),
6
- * it applies to ALL documents of that type.
7
- *
8
- * This replaces the old per-document localStorage approach with centralized
9
- * configuration stored in Sanity.
10
- */
11
- import { DNTPreferences, DNTStorage } from '../types/dnt';
12
- import { UnifiedConfigStorage } from './unifiedConfigStorage';
13
- /**
14
- * DNT Storage Adapter using unified configuration
15
- */
16
- export declare class DNTStorageAdapter implements DNTStorage {
17
- private configStorage;
18
- constructor(configStorage: UnifiedConfigStorage);
19
- /**
20
- * Get DNT field configuration for a document type
21
- */
22
- getFieldsForType(documentType: string): Promise<Record<string, boolean>>;
23
- /**
24
- * Set DNT status for a specific field in a document type
25
- */
26
- setFieldDNT(documentType: string, fieldPath: string, dnt: boolean): Promise<void>;
27
- /**
28
- * Toggle DNT status for a field in a document type
29
- */
30
- toggleFieldDNT(documentType: string, fieldPath: string): Promise<boolean>;
31
- /**
32
- * Get DNT status for a specific field in a document type
33
- */
34
- getFieldDNT(documentType: string, fieldPath: string): Promise<boolean>;
35
- /**
36
- * Clear all DNT fields for a document type
37
- */
38
- clearFieldsForType(documentType: string): Promise<void>;
39
- /**
40
- * Get all DNT configurations (all document types)
41
- */
42
- getAllDNTFields(): Promise<Record<string, Record<string, boolean>>>;
43
- /**
44
- * @deprecated Use getFieldsForType instead. This method now uses document type, not document ID.
45
- * Get DNT preferences - now based on document type, not individual document ID
46
- */
47
- getPreferences(documentId: string): Promise<DNTPreferences | null>;
48
- /**
49
- * @deprecated Use setFieldDNT instead
50
- */
51
- savePreferences(preferences: DNTPreferences): Promise<void>;
52
- /**
53
- * @deprecated Use clearFieldsForType instead
54
- */
55
- clearPreferences(documentId: string): Promise<void>;
56
- }
57
- /**
58
- * Legacy DNT Storage Adapter using localStorage (deprecated)
59
- * Kept for migration purposes only
60
- * @deprecated Use DNTStorageAdapter with UnifiedConfigStorage instead
61
- */
62
- export declare class LegacyDNTStorageAdapter {
63
- private static readonly STORAGE_KEY_PREFIX;
64
- private getStorageKey;
65
- getPreferences(documentId: string): Promise<DNTPreferences | null>;
66
- savePreferences(preferences: DNTPreferences): Promise<void>;
67
- clearPreferences(documentId: string): Promise<void>;
68
- /**
69
- * Migrate legacy localStorage preferences to unified configuration
70
- */
71
- migrateToUnified(configStorage: UnifiedConfigStorage, documentId: string, documentType: string): Promise<void>;
72
- }
73
- //# sourceMappingUR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M,GAAG,OAAO,CAAC,IAAI,CAAC;CAK1D;AAED;;;;GAIG;AACH,qBAAa,uBAAuB;IAClC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAA6B;IAEvE,OAAO,CAAC,aAAa;IAIf,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAgBlE,eAAe,CAAC,WAAW,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAe3D,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUzD;;OAEG;IACG,gBAAgB,CACpB,aAAa,EAAE,oBAAoB,EACnC,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC;CAkBjB"}
@@ -1,192 +0,0 @@
1
- /**
2
- * DNT (Do Not Translate) preferences storage adapter
3
- *
4
- * Now uses document-type-based storage in the unified configuration.
5
- * When you mark a field as DNT for any document of a type (e.g., 'product'),
6
- * it applies to ALL documents of that type.
7
- *
8
- * This replaces the old per-document localStorage approach with centralized
9
- * configuration stored in Sanity.
10
- */
11
- /**
12
- * DNT Storage Adapter using unified configuration
13
- */
14
- export class DNTStorageAdapter {
15
- constructor(configStorage) {
16
- this.configStorage = configStorage;
17
- }
18
- /**
19
- * Get DNT field configuration for a document type
20
- */
21
- async getFieldsForType(documentType) {
22
- try {
23
- return await this.configStorage.getDNTFieldsForType(documentType);
24
- }
25
- catch (error) {
26
- console.error(`Failed to get DNT fields for type ${documentType}:`, error);
27
- return {};
28
- }
29
- }
30
- /**
31
- * Set DNT status for a specific field in a document type
32
- */
33
- async setFieldDNT(documentType, fieldPath, dnt) {
34
- try {
35
- await this.configStorage.setDNTField(documentType, fieldPath, dnt);
36
- console.log(`Set DNT=${dnt} for ${documentType}.${fieldPath} (applies to all ${documentType} documents)`);
37
- }
38
- catch (error) {
39
- console.error(`Failed to set DNT for ${documentType}.${fieldPath}:`, error);
40
- throw error;
41
- }
42
- }
43
- /**
44
- * Toggle DNT status for a field in a document type
45
- */
46
- async toggleFieldDNT(documentType, fieldPath) {
47
- try {
48
- const newStatus = await this.configStorage.toggleDNTField(documentType, fieldPath);
49
- console.log(`Toggled DNT to ${newStatus} for ${documentType}.${fieldPath} (applies to all ${documentType} documents)`);
50
- return newStatus;
51
- }
52
- catch (error) {
53
- console.error(`Failed to toggle DNT for ${documentType}.${fieldPath}:`, error);
54
- throw error;
55
- }
56
- }
57
- /**
58
- * Get DNT status for a specific field in a document type
59
- */
60
- async getFieldDNT(documentType, fieldPath) {
61
- try {
62
- return await this.configStorage.getDNTFieldStatus(documentType, fieldPath);
63
- }
64
- catch (error) {
65
- console.error(`Failed to get DNT status for ${documentType}.${fieldPath}:`, error);
66
- return false;
67
- }
68
- }
69
- /**
70
- * Clear all DNT fields for a document type
71
- */
72
- async clearFieldsForType(documentType) {
73
- try {
74
- await this.configStorage.clearDNTFieldsForType(documentType);
75
- console.log(`Cleared all DNT fields for type ${documentType}`);
76
- }
77
- catch (error) {
78
- console.error(`Failed to clear DNT fields for type ${documentType}:`, error);
79
- throw error;
80
- }
81
- }
82
- /**
83
- * Get all DNT configurations (all document types)
84
- */
85
- async getAllDNTFields() {
86
- try {
87
- return await this.configStorage.getAllDNTFields();
88
- }
89
- catch (error) {
90
- console.error('Failed to get all DNT fields:', error);
91
- return {};
92
- }
93
- }
94
- // Legacy methods for backward compatibility with existing code
95
- /**
96
- * @deprecated Use getFieldsForType instead. This method now uses document type, not document ID.
97
- * Get DNT preferences - now based on document type, not individual document ID
98
- */
99
- async getPreferences(documentId) {
100
- // For backward compatibility, we need to extract the document type from somewhere
101
- // This is a transitional method and should be updated in calling code
102
- console.warn('getPreferences(documentId) is deprecated. Use getFieldsForType(documentType) instead.');
103
- // Since we don't have the document type here, we can't provide accurate data
104
- // Calling code should be updated to use the new methods
105
- return null;
106
- }
107
- /**
108
- * @deprecated Use setFieldDNT instead
109
- */
110
- async savePreferences(preferences) {
111
- console.warn('savePreferences is deprecated. Use setFieldDNT instead.');
112
- // Migrate to new format: set each field for the document type
113
- for (const [fieldPath, dnt] of Object.entries(preferences.fields)) {
114
- await this.setFieldDNT(preferences.documentType, fieldPath, dnt);
115
- }
116
- }
117
- /**
118
- * @deprecated Use clearFieldsForType instead
119
- */
120
- async clearPreferences(documentId) {
121
- console.warn('clearPreferences(documentId) is deprecated. Use clearFieldsForType(documentType) instead.');
122
- // Cannot clear without knowing document type
123
- // Calling code should be updated
124
- }
125
- }
126
- /**
127
- * Legacy DNT Storage Adapter using localStorage (deprecated)
128
- * Kept for migration purposes only
129
- * @deprecated Use DNTStorageAdapter with UnifiedConfigStorage instead
130
- */
131
- export class LegacyDNTStorageAdapter {
132
- getStorageKey(documentId) {
133
- return `${LegacyDNTStorageAdapter.STORAGE_KEY_PREFIX}${documentId}`;
134
- }
135
- async getPreferences(documentId) {
136
- try {
137
- const key = this.getStorageKey(documentId);
138
- const stored = localStorage.getItem(key);
139
- if (!stored) {
140
- return null;
141
- }
142
- return JSON.parse(stored);
143
- }
144
- catch (error) {
145
- console.error(`Failed to get legacy DNT preferences for ${documentId}:`, error);
146
- return null;
147
- }
148
- }
149
- async savePreferences(preferences) {
150
- try {
151
- const key = this.getStorageKey(preferences.documentId);
152
- const toStore = {
153
- ...preferences,
154
- updatedAt: new Date().toISOString()
155
- };
156
- localStorage.setItem(key, JSON.stringify(toStore));
157
- }
158
- catch (error) {
159
- console.error(`Failed to save legacy DNT preferences:`, error);
160
- throw error;
161
- }
162
- }
163
- async clearPreferences(documentId) {
164
- try {
165
- const key = this.getStorageKey(documentId);
166
- localStorage.removeItem(key);
167
- }
168
- catch (error) {
169
- console.error(`Failed to clear legacy DNT preferences:`, error);
170
- throw error;
171
- }
172
- }
173
- /**
174
- * Migrate legacy localStorage preferences to unified configuration
175
- */
176
- async migrateToUnified(configStorage, documentId, documentType) {
177
- const preferences = await this.getPreferences(documentId);
178
- if (!preferences) {
179
- return;
180
- }
181
- console.log(`Migrating DNT preferences for ${documentId} (${documentType}) to unified config...`);
182
- // Migrate each field to the document-type-based storage
183
- for (const [fieldPath, dnt] of Object.entries(preferences.fields)) {
184
- await configStorage.setDNTField(documentType, fieldPath, dnt);
185
- }
186
- // Clear the legacy localStorage entry
187
- await this.clearPreferences(documentId);
188
- console.log(`Migration complete for ${documentId}`);
189
- }
190
- }
191
- LegacyDNTStorageAdapter.STORAGE_KEY_PREFIX = 'sanity-translation-dnt-';
192
- //# sourceMappingURL=dntStorageAdapter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dntStorageAdapter.js","sourceRoot":"","sources":["../../src/services/dntStorageAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAG5B,YAAY,aAAmC;QAC7C,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,gBAAgB,CAAC,YAAoB;QACzC,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC;QACpE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,qCAAqC,YAAY,GAAG,EAAE,KAAK,CAAC,CAAC;YAC3E,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW,CAAC,YAAoB,EAAE,SAAiB,EAAE,GAAY;QACrE,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,YAAY,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;YACnE,OAAO,CAAC,GAAG,CAAC,WAAW,GAAG,QAAQ,YAAY,IAAI,SAAS,oBAAoB,YAAY,aAAa,CAAC,CAAC;QAC5G,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC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