@journium/js 1.0.7 → 1.1.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.
package/README.md CHANGED
@@ -4,243 +4,108 @@
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-blue.svg)](https://www.typescriptlang.org/)
6
6
 
7
- **The official Journium JavaScript SDK for web browsers**
7
+ The official Journium JavaScript SDK for web browsers. Track events, pageviews, and user interactions with ease.
8
8
 
9
- Track events, pageviews, and user interactions with ease. Perfect for SPAs, vanilla JavaScript apps, and any web application.
9
+ ---
10
10
 
11
- ## Installation
11
+ ## Getting Started
12
12
 
13
- ### npm
14
- ```bash
15
- npm install @journium/js
16
- ```
13
+ Learn how to use Journium to power your application:
17
14
 
18
- ### pnpm
19
- ```bash
20
- pnpm add @journium/js
21
- ```
15
+ - [Quick Start Guide](https://journium.app/docs/js)
16
+ - [Concepts](https://journium.app/docs/js/concepts)
17
+ - [SDK Reference](https://journium.app/docs/js)
18
+
19
+ ### Prerequisites
20
+ - Modern browser (ES2017+)
21
+ - An existing Journium application. [Create your account for free](https://dashboard.journium.app/sign-up?utm_source=github&utm_medium=journium_js).
22
+
23
+ ## Installation Option 1: Via package manager
22
24
 
23
- ### yarn
24
25
  ```bash
25
- yarn add @journium/js
26
+ npm install @journium/js
26
27
  ```
27
28
 
28
- ## Basic Setup
29
-
30
- ### Initialize Journium
31
- Initialize the Journium SDK with your publishable key to start tracking events.
29
+ ## Usage
32
30
 
33
31
  ```javascript
34
32
  import { init } from '@journium/js';
35
33
 
36
34
  const journium = init({
37
- publishableKey: 'your-journium-publishable-key'
35
+ publishableKey: "your-publishable-key"
38
36
  });
39
37
  ```
40
38
 
41
- ### Track a Custom Event
42
- Track user actions and business events with custom properties.
39
+ For more detailed examples and configuration options, visit the [Journium documentation](https://journium.app/docs/js/).
43
40
 
44
- ```javascript
45
- journium.track('button_clicked', {
46
- button_name: 'signup',
47
- page: 'homepage',
48
- user_type: 'visitor'
49
- });
50
- ```
41
+ ## Installation Option 2: Adding the JavaScript snippet to your HTML
51
42
 
52
- ### Identify a User
53
- Identify users when they log in or sign up to connect their actions across sessions.
43
+ For websites without module bundlers (Shopify, WordPress, static HTML), use the CDN version with a single global `journium` object.
54
44
 
55
- ```javascript
56
- journium.identify('user_12345', {
57
- name: 'John Doe',
58
- email: 'john@example.com',
59
- plan: 'premium'
60
- });
61
- ```
45
+ ### Script Tag
62
46
 
63
- ### Reset User Identity
64
- Reset user identity when they log out to ensure privacy and accurate tracking.
47
+ ```html
48
+ <script>
49
+ !function(j,o,u,r,n,i,u,m){
50
+ if(!o.__JV){
51
+ window.journium=o;
52
+ o._q=[];
53
+ o._i=null;
54
+ o.init=function(c,n){o._i=[c,n]};
55
+ var methods="track identify reset capturePageview startAutocapture stopAutocapture flush getEffectiveOptions onOptionsChange destroy".split(" ");
56
+ for(var k=0;k<methods.length;k++){
57
+ !function(method){
58
+ o[method]=function(){o._q.push([method].concat(Array.prototype.slice.call(arguments)));return o}
59
+ }(methods[k])
60
+ }
61
+ o.__JV=1;
62
+ (m=j.createElement("script")).type="text/javascript";
63
+ m.async=!0;
64
+ m.src="https://cdn.jsdelivr.net/npm/@journium/js@1/dist/journium.min.js";
65
+ m.onerror=function(){console.warn("Journium: Failed to load SDK from CDN")};
66
+ (i=j.getElementsByTagName("script")[0]).parentNode.insertBefore(m,i);
67
+ }
68
+ }(document,window.journium||[]);
65
69
 
66
- ```javascript
67
- journium.reset();
70
+ journium.init({
71
+ publishableKey: 'YOUR_PUBLISHABLE_KEY'
72
+ });
73
+ </script>
68
74
  ```
69
75
 
70
- ## Advanced Setup
71
-
72
- You can override default configurations:
76
+ ### Usage Examples
73
77
 
74
78
  ```javascript
75
- import { init } from '@journium/js';
76
-
77
- const journium = init({
78
- publishableKey: 'your-journium-publishable-key',
79
- apiHost: 'https://your-custom-instance.com', // Optional: defaults to 'https://events.journium.app'
80
- options: {
81
- debug: true, // Enable debug logging
82
- flushAt: 10, // Send events after N events
83
- flushInterval: 5000, // Send events every N milliseconds
84
- sessionTimeout: 1800000, // Session timeout (30 minutes)
85
- autoTrackPageviews: true, // Track pageview events (default: true)
86
- autocapture: { // Configure automatic event capture
87
- captureClicks: true, // Track click events
88
- captureFormSubmits: true, // Track form submissions
89
- captureFormChanges: false, // Track form field changes
90
- ignoreClasses: ['no-track'], // CSS classes to ignore
91
- ignoreElements: ['input[type="password"]'] // Elements to ignore
92
- }
93
- }
79
+ // Track events
80
+ journium.track('page_view', { page: 'home' });
81
+ journium.track('button_click', { button: 'signup' });
82
+
83
+ // Identify users
84
+ journium.identify('user123', {
85
+ email: 'user@example.com',
86
+ plan: 'pro'
94
87
  });
95
-
96
- // Start automatic event capture
97
- journium.startAutocapture();
98
88
  ```
99
89
 
100
- ## API Reference
101
-
102
- ### Functions
103
-
104
- #### `init(config: JourniumConfig)`
105
- Initializes and returns a new JourniumAnalytics instance.
106
-
107
- **Parameters:**
108
- - `config: JourniumConfig` - Configuration object for Journium
109
- - `publishableKey: string` - Your Journium publishable key (required)
110
- - `apiHost?: string` - Custom API endpoint (optional, defaults to 'https://events.journium.app')
111
- - `options?: JourniumLocalOptions` - Local configuration options (optional)
90
+ ## Other SDKs
112
91
 
113
- **Returns:** `JourniumAnalytics` - Analytics instance for tracking events
92
+ - [@journium/nextjs](https://www.npmjs.com/package/@journium/nextjs) - Next.js SDK
93
+ - [@journium/react](https://www.npmjs.com/package/@journium/react) - React SDK
114
94
 
115
- ### JourniumAnalytics Instance Methods
95
+ ## Support
116
96
 
117
- #### `track(event: string, properties?: Record<string, unknown>): void`
118
- Tracks custom events with optional properties.
97
+ Need help? Reach out to us:
119
98
 
120
- **Parameters:**
121
- - `event: string` - Event name to track
122
- - `properties?: Record<string, unknown>` - Optional event properties
99
+ - 📖 Join our official community [Discord server](https://journium.app/discord)
100
+ - 🐛 [Issue Tracker](https://github.com/journium/journium-js/issues)
123
101
 
124
- #### `identify(distinctId: string, attributes?: Record<string, unknown>): void`
125
- Identifies a user and associates future events with their identity.
102
+ ## Contributing
126
103
 
127
- **Parameters:**
128
- - `distinctId: string` - Unique user identifier
129
- - `attributes?: Record<string, unknown>` - Optional user attributes
104
+ We're open to all community contributions! If you'd like to contribute in any way, please read [our contribution guidelines](https://github.com/journium/journium-js/blob/main/CONTRIBUTING.md) and [code of conduct](https://github.com/journium/journium-js/blob/main/CODE_OF_CONDUCT.md).
130
105
 
131
- #### `reset(): void`
132
- Resets user identity, typically called on logout.
133
106
 
134
- **Returns:** `void`
107
+ ## License
135
108
 
136
- #### `capturePageview(properties?: Record<string, unknown>): void`
137
- Manually captures pageview events.
109
+ This project is licensed under the **MIT license**.
138
110
 
139
- **Parameters:**
140
- - `properties?: Record<string, unknown>` - Optional pageview properties
141
-
142
- #### `startAutocapture(): void`
143
- Starts automatic event capture for clicks, form interactions, and pageviews.
144
-
145
- **Returns:** `void`
146
-
147
- **Note:** Autocapture behavior is configured during initialization via the `autocapture` option.
148
-
149
- #### `stopAutocapture(): void`
150
- Stops automatic event capture.
151
-
152
- **Returns:** `void`
153
-
154
- #### `flush(): Promise<void>`
155
- Manually sends all queued events to the server immediately.
156
-
157
- **Returns:** `Promise<void>` - Promise that resolves when events are sent
158
-
159
- #### `destroy(): void`
160
- Cleans up the SDK, stops all tracking, and sends remaining events.
161
-
162
- **Returns:** `void`
163
-
164
- #### `getEffectiveOptions(): JourniumLocalOptions`
165
- Returns the effective configuration options (merged local and remote options).
166
-
167
- **Returns:** `JourniumLocalOptions` - Current effective configuration
168
-
169
- ### Types
170
-
171
- #### `JourniumConfig`
172
- Configuration object for initializing Journium.
173
-
174
- ```typescript
175
- interface JourniumConfig {
176
- publishableKey: string;
177
- apiHost?: string;
178
- options?: JourniumLocalOptions;
179
- }
180
- ```
181
-
182
- #### `JourniumLocalOptions`
183
- Local configuration options that can be set on the client.
184
-
185
- ```typescript
186
- interface JourniumLocalOptions {
187
- debug?: boolean; // Enable debug logging
188
- flushAt?: number; // Number of events before auto-flush
189
- flushInterval?: number; // Flush interval in milliseconds
190
- autocapture?: boolean | AutocaptureOptions; // Auto-capture configuration
191
- autoTrackPageviews?: boolean; // Automatic pageview tracking
192
- sessionTimeout?: number; // Session timeout in milliseconds
193
- sampling?: {
194
- enabled?: boolean;
195
- rate?: number;
196
- };
197
- features?: {
198
- enableGeolocation?: boolean;
199
- enableSessionRecording?: boolean;
200
- enablePerformanceTracking?: boolean;
201
- };
202
- }
203
- ```
204
-
205
- #### `AutocaptureOptions`
206
- Configuration for automatic event capture.
207
-
208
- ```typescript
209
- interface AutocaptureOptions {
210
- captureClicks?: boolean; // Capture click events
211
- captureFormSubmits?: boolean; // Capture form submissions
212
- captureFormChanges?: boolean; // Capture form field changes
213
- captureTextSelection?: boolean; // Capture text selection events
214
- ignoreClasses?: string[]; // CSS classes to ignore
215
- ignoreElements?: string[]; // HTML elements to ignore
216
- captureContentText?: boolean; // Capture element text content
217
- }
218
- ```
219
-
220
- ### Browser Support
221
-
222
- - ✅ Modern browsers (ES2017+)
223
- - ✅ Chrome 60+
224
- - ✅ Firefox 55+
225
- - ✅ Safari 11+
226
- - ✅ Edge 79+
227
-
228
- ### Bundle Formats
229
-
230
- The package includes multiple build formats:
231
-
232
- - **ESM**: `dist/index.esm.js` - For modern bundlers (webpack, Vite, Rollup)
233
- - **CommonJS**: `dist/index.cjs` - For Node.js environments
234
- - **UMD**: `dist/index.umd.js` - For browser `<script>` tags
235
-
236
- #### UMD Usage
237
-
238
- ```html
239
- <script src="node_modules/@journium/js/dist/index.umd.js"></script>
240
- <script>
241
- const analytics = window.JourniumAnalytics.init({
242
- publishableKey: 'your-publishable-key'
243
- });
244
- analytics.track('page_loaded');
245
- </script>
246
- ```
111
+ See [LICENSE](https://github.com/journium/journium-js/blob/main/LICENSE) for more information.
@@ -14,6 +14,11 @@ export declare class JourniumAnalytics {
14
14
  capturePageview(properties?: Record<string, unknown>): void;
15
15
  startAutocapture(): void;
16
16
  stopAutocapture(): void;
17
+ /**
18
+ * Automatically start autocapture if enabled in options
19
+ * Handles both initial options and empty options during remote-first initialization
20
+ */
21
+ private startAutocaptureIfEnabled;
17
22
  /**
18
23
  * Handle effective options change (e.g., when remote options are fetched)
19
24
  */
@@ -29,7 +34,6 @@ export declare class JourniumAnalytics {
29
34
  export declare const init: (config: JourniumConfig) => JourniumAnalytics;
30
35
  declare const _default: {
31
36
  init: (config: JourniumConfig) => JourniumAnalytics;
32
- JourniumAnalytics: typeof JourniumAnalytics;
33
37
  };
34
38
  export default _default;
35
39
  //# sourceMappingURL=JourniumAnalytics.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"JourniumAnalytics.d.ts","sourceRoot":"","sources":["../src/JourniumAnalytics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAsB,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAK1F,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,kBAAkB,CAAkB;IAC5C,OAAO,CAAC,wBAAwB,CAAC,CAAa;gBAElC,MAAM,EAAE,cAAc;IAiBlC,OAAO,CAAC,yBAAyB;IAiBjC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAIhE,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAIxE,KAAK,IAAI,IAAI;IAIb,eAAe,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAI3D,gBAAgB,IAAI,IAAI;IAqBxB,e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AEG;IACH,OAAO,CAAC,mBAAmB;IA6BrB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B,mBAAmB;IAInB;;OAEG;IACH,eAAe,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,IAAI,GAAG,MAAM,IAAI;IAI9E,OAAO,IAAI,IAAI;CAQhB;AAED,eAAO,MAAM,IAAI,GAAI,QAAQ,cAAc,KAAG,iBAE7C,CAAC;;mBAF2B,cAAc,KAAG,iBAAiB;;AAI/D,wBAAwB"}
@@ -3,22 +3,24 @@ export declare class JourniumClient {
3
3
  private config;
4
4
  private effectiveOptions;
5
5
  private queue;
6
+ private stagedEvents;
6
7
  private flushTimer;
7
- private initialized;
8
+ private initializationComplete;
9
+ private initializationFailed;
8
10
  private identityManager;
9
11
  private optionsStorageKey;
10
12
  private optionsChangeCallbacks;
11
13
  constructor(config: JourniumConfig);
12
14
  private loadCachedOptions;
13
15
  private saveCachedOptions;
14
- private initializeSync;
15
- private fetchRemoteOptionsAsync;
16
- private fetchAndCacheRemoteOptions;
16
+ private initializeAsync;
17
+ private fetchRemoteOptionsWithRetry;
17
18
  /**
18
19
  * Register a callback to be notified when effective options change (e.g., when remote options are fetched)
19
20
  */
20
21
  onOptionsChange(callback: (options: JourniumLocalOptions) => void): () => void;
21
22
  private notifyOptionsChange;
23
+ private processStagedEvents;
22
24
  private startFlushTimer;
23
25
  private sendEvents;
24
26
  identify(distinctId: string, attributes?: Record<string, unknown>): void;
@@ -1 +1 @@
1
- {"version":3,"file":"JourniumClient.d.ts","sourceRoot":"","sources":["../src/JourniumClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,cAAc,EAAE,oBAAoB,EAAyG,MAAM,gBAAgB,CAAC;AAE5L,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,gBAAgB,CAAwB;IAChD,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,UAAU,CAA+C;IAC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U;IACnC,OAAO,CAAC,sBAAsB,CAA2D;gBAE7E,MAAM,EAAE,cAAc;IAiClC,OAAO,CAAC,iBAAiB;IAczB,OAAO,CAAC,iBAAiB;YAYX,eAAe;YAyEf,2BAA2B;IAiDzC;;OAEG;IACH,eAAe,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,IAAI,GAAG,MAAM,IAAI;IAQ9E,OAAO,CAAC,mBAAmB;IAU3B,OAAO,CAAC,mBAAmB;IA0C3B,OAAO,CAAC,eAAe;YAYT,UAAU;IA0BxB,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,IAAI;IAqB5E,KAAK,IAAI,IAAI;IAab,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,IAAI;IA2D9D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAoB5B,OAAO,IAAI,IAAI;IAQf,mBAAmB,IAAI,oBAAoB;CAG5C"}
@@ -11,7 +11,7 @@ export declare class PageviewTracker {
11
11
  * Start automatic autocapture for pageviews
12
12
  * @returns void
13
13
  */
14
- startAutocapture(): void;
14
+ startAutoPageviewTracking(): void;
15
15
  /**
16
16
  * Stop automatic autocapture for pageviews
17
17
  * @returns void
@@ -1 +1 @@
1
- {"version":3,"file":"PageviewTracker.d.ts","sourceRoot":"","sources":["../src/PageviewTracker.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,iBAAiB,CAAgD;IACzE,OAAO,CAAC,oBAAoB,CAAmD;IAC/E,OAAO,CAAC,eAAe,CAA6B;gBAExC,MAAM,EAAE,cAAc;IAIlC,eAAe,CAAC,gBAAgB,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,IAAI;IAkBrE;;;OAGG;IACH,gBAAgB,IAAI,IAAI;IA0BxB;;;OAGG;IACH,eAAe,IAAI,IAAI;CAmBxB"}
1
+ {"version":3,"file":"PageviewTracker.d.ts","sourceRoot":"","sources":["../src/PageviewTracker.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,iBAAiB,CAAgD;IACzE,OAAO,CAAC,oBAAoB,CAAmD;IAC/E,OAAO,CAAC,eAAe,CAA6B;gBAExC,MAAM,EAAE,cAAc;IAIlC,eAAe,CAAC,gBAAgB,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,IAAI;IAkBrE;;;OAGG;IACH,yBAAyB,IAAI,IAAI;IA0BjC;;;OAGG;IACH,eAAe,IAAI,IAAI;CAmBxB"}
package/dist/cdn.d.ts ADDED
@@ -0,0 +1,40 @@
1
+ /**
2
+ * CDN Entry Point for Journium Analytics
3
+ * This file provides global browser integration for script snippet usage
4
+ * Features: auto method stubbing, error handling, improved queue processing
5
+ */
6
+ import { init } from './index';
7
+ type JourniumAnalyticsInstance = ReturnType<typeof init>;
8
+ interface JourniumSnippetQueue {
9
+ _q?: any[][];
10
+ _i?: [any, string?];
11
+ __JV?: boolean;
12
+ _error?: Error | null;
13
+ _retry?: boolean;
14
+ [key: string]: any;
15
+ }
16
+ interface GlobalJournium {
17
+ init: (config: any, instanceName?: string) => JourniumAnalyticsInstance;
18
+ track?: (event: string, properties?: any) => void;
19
+ identify?: (distinctId: string, attributes?: any) => void;
20
+ reset?: () => void;
21
+ capturePageview?: (properties?: any) => void;
22
+ startAutocapture?: () => void;
23
+ stopAutocapture?: () => void;
24
+ flush?: () => Promise<void>;
25
+ getEffectiveOptions?: () => any;
26
+ onOptionsChange?: (callback: (options: any) => void) => () => void;
27
+ destroy?: () => void;
28
+ [key: string]: any;
29
+ }
30
+ declare global {
31
+ interface Window {
32
+ journium?: JourniumSnippetQueue | GlobalJournium;
33
+ }
34
+ }
35
+ export { init };
36
+ declare const _default: {
37
+ init: (config: import("@journium/core").JourniumConfig) => import("./JourniumAnalytics").JourniumAnalytics;
38
+ };
39
+ export default _default;
40
+ //# sourceMappingURL=cdn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cdn.d.ts","sourceRoot":"","sources":["../src/cdn.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG/B,KAAK,yBAAyB,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC;AASzD,UAAU,oBAAoB;IAC5B,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC;IACb,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAGD,UAAU,cAAc;IACtB,IAAI,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,yBAAyB,CAAC;IACxE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAClD,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAC1D,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;IACnB,eAAe,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC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