onerway-analytics 1.0.3 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +337 -237
- package/dist/bundle/index.js +82 -175
- package/dist/bundle/index.js.map +4 -4
- package/dist/core/analytics.d.ts +4 -5
- package/dist/core/analytics.d.ts.map +1 -1
- package/dist/core/analytics.js +33 -50
- package/dist/core/gtm-loader.d.ts +3 -0
- package/dist/core/gtm-loader.d.ts.map +1 -0
- package/dist/core/gtm-loader.js +38 -0
- package/dist/core/gtm-manager.d.ts +19 -0
- package/dist/core/gtm-manager.d.ts.map +1 -0
- package/dist/core/gtm-manager.js +39 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/types/index.d.ts +5 -13
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/core/analytics.js
CHANGED
|
@@ -5,10 +5,9 @@ import { StorageQueue } from './storage';
|
|
|
5
5
|
import { collectContext, collectMarketing } from './context-collector';
|
|
6
6
|
import { initAutoTrack } from './auto-track';
|
|
7
7
|
import { initErrorMonitor } from './error-monitor';
|
|
8
|
-
import {
|
|
8
|
+
import { initGTM } from './gtm-loader';
|
|
9
9
|
import { initPerformanceMonitor } from './performance-monitor';
|
|
10
|
-
import {
|
|
11
|
-
import { GAManager } from './ga-manager';
|
|
10
|
+
import { GTMManager } from './gtm-manager';
|
|
12
11
|
import { generateId, generateUUID, getTimestamp, isObject, isBrowser, getPageUrl, safeLocalStorageGet, safeLocalStorageSet, } from '../utils';
|
|
13
12
|
let globalBatchCounter = 0;
|
|
14
13
|
export class Analytics {
|
|
@@ -19,11 +18,8 @@ export class Analytics {
|
|
|
19
18
|
this.userProps = {};
|
|
20
19
|
this.initialized = false;
|
|
21
20
|
this.retrying = 0;
|
|
22
|
-
this.gaInitialized = false;
|
|
23
|
-
this.gaPendingQueue = [];
|
|
24
|
-
this.gaPendingIdentify = null;
|
|
25
21
|
this.unloadHandler = null;
|
|
26
|
-
this.
|
|
22
|
+
this.gtm = new GTMManager();
|
|
27
23
|
this.config = {
|
|
28
24
|
debug: false,
|
|
29
25
|
autoTrack: true,
|
|
@@ -40,6 +36,7 @@ export class Analytics {
|
|
|
40
36
|
this.clientType = DEFAULT_CONFIG.clientType;
|
|
41
37
|
this.batchPageId = this.generateBatchPageId();
|
|
42
38
|
this.sessionManager = new SessionManager(this.config.sessionTimeout);
|
|
39
|
+
this.sampled = this.resolveSampling();
|
|
43
40
|
if (isBrowser()) {
|
|
44
41
|
this.recoverFailedEvents();
|
|
45
42
|
}
|
|
@@ -53,30 +50,10 @@ export class Analytics {
|
|
|
53
50
|
if (isBrowser() && this.config.performance?.enabled !== false) {
|
|
54
51
|
initPerformanceMonitor(this, this.config.performance);
|
|
55
52
|
}
|
|
56
|
-
if (isBrowser() && this.config.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
this.log('GA4 initialized with measurementId:', this.config.ga?.measurementId);
|
|
61
|
-
// Set session-level attribution once — GA auto-associates with all events
|
|
62
|
-
setGAMarketing(collectMarketing());
|
|
63
|
-
if (this.gaPendingIdentify) {
|
|
64
|
-
setGAUserId(this.gaPendingIdentify.userId);
|
|
65
|
-
if (this.gaPendingIdentify.attributes) {
|
|
66
|
-
setGAUserProperties(this.gaPendingIdentify.attributes);
|
|
67
|
-
}
|
|
68
|
-
this.gaPendingIdentify = null;
|
|
69
|
-
}
|
|
70
|
-
for (const { eventName, properties, options } of this.gaPendingQueue) {
|
|
71
|
-
trackToGA(eventName, properties, options);
|
|
72
|
-
}
|
|
73
|
-
this.gaPendingQueue = [];
|
|
74
|
-
}).catch((error) => {
|
|
75
|
-
this.ga._destroy();
|
|
76
|
-
this.gaPendingIdentify = null;
|
|
77
|
-
this.gaPendingQueue = [];
|
|
78
|
-
this.log('Failed to initialize GA4:', error);
|
|
79
|
-
});
|
|
53
|
+
if (isBrowser() && this.config.gtm?.enabled) {
|
|
54
|
+
initGTM(this.config.gtm);
|
|
55
|
+
this.gtm._init(this.config.gtm.containerId, this.config.gtm.dataLayerName);
|
|
56
|
+
this.log('GTM initialized with containerId:', this.config.gtm.containerId);
|
|
80
57
|
}
|
|
81
58
|
this.initialized = true;
|
|
82
59
|
this.log('Analytics SDK initialized', {
|
|
@@ -93,20 +70,17 @@ export class Analytics {
|
|
|
93
70
|
this.log('Invalid event name');
|
|
94
71
|
return;
|
|
95
72
|
}
|
|
73
|
+
if (!this.sampled)
|
|
74
|
+
return;
|
|
96
75
|
const normalizedProps = properties && isObject(properties) ? properties : {};
|
|
97
76
|
const isKeyEvent = options?.keyEvent === true || this.isKeyEvent(eventName);
|
|
98
|
-
if (this.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
77
|
+
if (this.gtm.ready) {
|
|
78
|
+
this.gtm.track(eventName, {
|
|
79
|
+
...normalizedProps,
|
|
80
|
+
session_id: this.sessionManager.getSessionId(),
|
|
81
|
+
page_url: isBrowser() ? getPageUrl() : '',
|
|
102
82
|
referrer: isBrowser() ? document.referrer : '',
|
|
103
|
-
};
|
|
104
|
-
if (this.gaInitialized) {
|
|
105
|
-
trackToGA(eventName, normalizedProps, gaOptions);
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
this.gaPendingQueue.push({ eventName, properties: normalizedProps, options: gaOptions });
|
|
109
|
-
}
|
|
83
|
+
});
|
|
110
84
|
}
|
|
111
85
|
if (this.config.disableServer)
|
|
112
86
|
return;
|
|
@@ -136,15 +110,12 @@ export class Analytics {
|
|
|
136
110
|
if (attributes && isObject(attributes)) {
|
|
137
111
|
this.userProps = attributes;
|
|
138
112
|
}
|
|
139
|
-
if (this.
|
|
140
|
-
|
|
113
|
+
if (this.gtm.ready) {
|
|
114
|
+
this.gtm.setUserId(userId);
|
|
141
115
|
if (attributes && isObject(attributes)) {
|
|
142
|
-
|
|
116
|
+
this.gtm.setUserProperties(attributes);
|
|
143
117
|
}
|
|
144
118
|
}
|
|
145
|
-
else if (this.config.ga?.enabled) {
|
|
146
|
-
this.gaPendingIdentify = { userId, attributes };
|
|
147
|
-
}
|
|
148
119
|
this.log('User identified:', { userId, attributes });
|
|
149
120
|
if (wasAnonymous && this.buffer.length > 0) {
|
|
150
121
|
this.flushBuffer();
|
|
@@ -164,8 +135,8 @@ export class Analytics {
|
|
|
164
135
|
clearTimeout(this.bufferTimer);
|
|
165
136
|
this.bufferTimer = null;
|
|
166
137
|
}
|
|
167
|
-
if (this.
|
|
168
|
-
|
|
138
|
+
if (this.gtm.ready) {
|
|
139
|
+
this.gtm.setUserId(null);
|
|
169
140
|
}
|
|
170
141
|
this.log('Analytics reset');
|
|
171
142
|
}
|
|
@@ -190,6 +161,16 @@ export class Analytics {
|
|
|
190
161
|
console.log('[Analytics]', ...args);
|
|
191
162
|
}
|
|
192
163
|
}
|
|
164
|
+
resolveSampling() {
|
|
165
|
+
const rate = this.config.sampleRate ?? 1;
|
|
166
|
+
if (rate >= 1)
|
|
167
|
+
return true;
|
|
168
|
+
if (rate <= 0)
|
|
169
|
+
return false;
|
|
170
|
+
const decision = Math.random() < rate;
|
|
171
|
+
this.log(`Sampling decision: ${decision ? 'included' : 'excluded'} (sampleRate=${rate})`);
|
|
172
|
+
return decision;
|
|
173
|
+
}
|
|
193
174
|
getOrCreateClientId() {
|
|
194
175
|
if (!isBrowser())
|
|
195
176
|
return generateUUID();
|
|
@@ -331,6 +312,8 @@ export class Analytics {
|
|
|
331
312
|
recoverFailedEvents() {
|
|
332
313
|
if (this.config.disableServer)
|
|
333
314
|
return;
|
|
315
|
+
if (!this.sampled)
|
|
316
|
+
return;
|
|
334
317
|
const failedEvents = StorageQueue.recover();
|
|
335
318
|
if (failedEvents.length > 0) {
|
|
336
319
|
this.log(`Recovered ${failedEvents.length} failed events from storage`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gtm-loader.d.ts","sourceRoot":"","sources":["../../src/core/gtm-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,wBAAgB,OAAO,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAyC/C"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export function initGTM(config) {
|
|
2
|
+
if (!config.enabled || !config.containerId)
|
|
3
|
+
return;
|
|
4
|
+
if (typeof window === 'undefined')
|
|
5
|
+
return;
|
|
6
|
+
const dataLayerName = config.dataLayerName || 'dataLayer';
|
|
7
|
+
const w = window;
|
|
8
|
+
// Initialize dataLayer before the script loads so queued pushes are preserved
|
|
9
|
+
if (!Array.isArray(w[dataLayerName])) {
|
|
10
|
+
w[dataLayerName] = [];
|
|
11
|
+
}
|
|
12
|
+
w[dataLayerName].push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' });
|
|
13
|
+
// Inject <head> script if not already present
|
|
14
|
+
const existingScript = document.querySelector(`script[src*="googletagmanager.com/gtm.js?id=${config.containerId}"]`);
|
|
15
|
+
if (!existingScript) {
|
|
16
|
+
const dl = dataLayerName !== 'dataLayer' ? `&l=${encodeURIComponent(dataLayerName)}` : '';
|
|
17
|
+
const script = document.createElement('script');
|
|
18
|
+
script.async = true;
|
|
19
|
+
script.src = `https://www.googletagmanager.com/gtm.js?id=${config.containerId}${dl}`;
|
|
20
|
+
const firstScript = document.getElementsByTagName('script')[0];
|
|
21
|
+
firstScript.parentNode?.insertBefore(script, firstScript);
|
|
22
|
+
}
|
|
23
|
+
// Inject <body> noscript fallback if not already present
|
|
24
|
+
if (!document.querySelector(`noscript[data-gtm-id="${config.containerId}"]`)) {
|
|
25
|
+
const noscript = document.createElement('noscript');
|
|
26
|
+
noscript.setAttribute('data-gtm-id', config.containerId);
|
|
27
|
+
const iframe = document.createElement('iframe');
|
|
28
|
+
iframe.src = `https://www.googletagmanager.com/ns.html?id=${config.containerId}`;
|
|
29
|
+
iframe.height = '0';
|
|
30
|
+
iframe.width = '0';
|
|
31
|
+
iframe.style.display = 'none';
|
|
32
|
+
iframe.style.visibility = 'hidden';
|
|
33
|
+
noscript.appendChild(iframe);
|
|
34
|
+
if (document.body) {
|
|
35
|
+
document.body.insertBefore(noscript, document.body.firstChild);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface Window {
|
|
3
|
+
dataLayer: unknown[];
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
export declare class GTMManager {
|
|
7
|
+
private _initialized;
|
|
8
|
+
private _containerId;
|
|
9
|
+
private _dataLayerName;
|
|
10
|
+
get ready(): boolean;
|
|
11
|
+
get containerId(): string | undefined;
|
|
12
|
+
push(data: Record<string, unknown>): void;
|
|
13
|
+
track(eventName: string, properties?: Record<string, unknown>): void;
|
|
14
|
+
setUserId(userId: string | null): void;
|
|
15
|
+
setUserProperties(properties: Record<string, unknown>): void;
|
|
16
|
+
_init(containerId: string, dataLayerName?: string): void;
|
|
17
|
+
_destroy(): void;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=gtm-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gtm-manager.d.ts","sourceRoot":"","sources":["../../src/core/gtm-manager.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,SAAS,EAAE,OAAO,EAAE,CAAC;KACtB;CACF;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,YAAY,CAAqB;IACzC,OAAO,CAAC,cAAc,CAAe;IAErC,IAAI,KAAK,IAAI,OAAO,CAEnB;IAED,IAAI,WAAW,IAAI,MAAM,GAAG,SAAS,CAEpC;IAED,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IASzC,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAIpE,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAItC,iBAAiB,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAI5D,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,aAAa,SAAc,GAAG,IAAI;IAM7D,QAAQ,IAAI,IAAI;CAIjB"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export class GTMManager {
|
|
2
|
+
constructor() {
|
|
3
|
+
this._initialized = false;
|
|
4
|
+
this._dataLayerName = 'dataLayer';
|
|
5
|
+
}
|
|
6
|
+
get ready() {
|
|
7
|
+
return this._initialized && typeof window !== 'undefined';
|
|
8
|
+
}
|
|
9
|
+
get containerId() {
|
|
10
|
+
return this._containerId;
|
|
11
|
+
}
|
|
12
|
+
push(data) {
|
|
13
|
+
if (!this.ready)
|
|
14
|
+
return;
|
|
15
|
+
const w = window;
|
|
16
|
+
const dl = w[this._dataLayerName];
|
|
17
|
+
if (Array.isArray(dl)) {
|
|
18
|
+
dl.push(data);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
track(eventName, properties) {
|
|
22
|
+
this.push({ event: eventName, ...(properties || {}) });
|
|
23
|
+
}
|
|
24
|
+
setUserId(userId) {
|
|
25
|
+
this.push({ userId: userId ?? undefined });
|
|
26
|
+
}
|
|
27
|
+
setUserProperties(properties) {
|
|
28
|
+
this.push(properties);
|
|
29
|
+
}
|
|
30
|
+
_init(containerId, dataLayerName = 'dataLayer') {
|
|
31
|
+
this._containerId = containerId;
|
|
32
|
+
this._dataLayerName = dataLayerName;
|
|
33
|
+
this._initialized = true;
|
|
34
|
+
}
|
|
35
|
+
_destroy() {
|
|
36
|
+
this._initialized = false;
|
|
37
|
+
this._containerId = undefined;
|
|
38
|
+
}
|
|
39
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,11 +6,11 @@ export { initAutoTrack } from './core/auto-track';
|
|
|
6
6
|
export type { AutoTrackAPI } from './core/auto-track';
|
|
7
7
|
export { initErrorMonitor } from './core/error-monitor';
|
|
8
8
|
export type { ErrorMonitorAPI } from './core/error-monitor';
|
|
9
|
-
export {
|
|
9
|
+
export { GTMManager } from './core/gtm-manager';
|
|
10
10
|
export { initPerformanceMonitor } from './core/performance-monitor';
|
|
11
11
|
export type { PerformanceMonitorAPI } from './core/performance-monitor';
|
|
12
12
|
export { collectContext, collectMarketing } from './core/context-collector';
|
|
13
|
-
export type { AnalyticsConfig, AnalyticsPayload, EventPayload, EventProperties, EventContext, ContextPayload, MarketingPayload, BrowserInfo, OSInfo, TrackOptions, TrackEvent, QueueItem, UserProfile, Environment, PerformanceConfig,
|
|
13
|
+
export type { AnalyticsConfig, AnalyticsPayload, EventPayload, EventProperties, EventContext, ContextPayload, MarketingPayload, BrowserInfo, OSInfo, TrackOptions, TrackEvent, QueueItem, UserProfile, Environment, PerformanceConfig, GTMConfig, } from './types';
|
|
14
14
|
export { API_KEY_MAP, SDK_VERSION, DEFAULT_CONFIG, STORAGE_KEYS, } from './types';
|
|
15
15
|
export { generateUUID, generateId, getTimestamp, isObject, merge, detectBrowser, detectOS, getDeviceType, getScreenSize, getPageUrl, getReferrer, getHostname, getTimezone, getLanguage, getCountryFromLanguage, parseUTMParams, isBrowser, truncateText, } from './utils';
|
|
16
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CA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,SAAS,CAAC;AAEjB,OAAO,EACL,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,KAAK,EACL,aAAa,EACb,QAAQ,EACR,aAAa,EACb,aAAa,EACb,UAAU,EACV,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,EACX,sBAAsB,EACtB,cAAc,EACd,SAAS,EACT,YAAY,GACb,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ export { StorageQueue } from './core/storage';
|
|
|
4
4
|
export { SessionManager } from './core/session-manager';
|
|
5
5
|
export { initAutoTrack } from './core/auto-track';
|
|
6
6
|
export { initErrorMonitor } from './core/error-monitor';
|
|
7
|
-
export {
|
|
7
|
+
export { GTMManager } from './core/gtm-manager';
|
|
8
8
|
export { initPerformanceMonitor } from './core/performance-monitor';
|
|
9
9
|
export { collectContext, collectMarketing } from './core/context-collector';
|
|
10
10
|
export { API_KEY_MAP, SDK_VERSION, DEFAULT_CONFIG, STORAGE_KEYS, } from './types';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -77,19 +77,10 @@ export interface AnalyticsPayload {
|
|
|
77
77
|
export interface PerformanceConfig {
|
|
78
78
|
enabled?: boolean;
|
|
79
79
|
}
|
|
80
|
-
export
|
|
81
|
-
|
|
82
|
-
ad_storage?: 'granted' | 'denied';
|
|
83
|
-
analytics_storage?: 'granted' | 'denied';
|
|
84
|
-
ad_user_data?: 'granted' | 'denied';
|
|
85
|
-
ad_personalization?: 'granted' | 'denied';
|
|
86
|
-
[key: string]: unknown;
|
|
87
|
-
}
|
|
88
|
-
export interface GAConfig {
|
|
89
|
-
measurementId: string;
|
|
80
|
+
export interface GTMConfig {
|
|
81
|
+
containerId: string;
|
|
90
82
|
enabled: boolean;
|
|
91
|
-
|
|
92
|
-
debugMode?: boolean;
|
|
83
|
+
dataLayerName?: string;
|
|
93
84
|
}
|
|
94
85
|
export interface AnalyticsConfig {
|
|
95
86
|
appKey?: string;
|
|
@@ -108,8 +99,9 @@ export interface AnalyticsConfig {
|
|
|
108
99
|
sessionTimeout?: number;
|
|
109
100
|
autoTrackSelector?: string;
|
|
110
101
|
performance?: PerformanceConfig;
|
|
111
|
-
|
|
102
|
+
gtm?: GTMConfig;
|
|
112
103
|
disableServer?: boolean;
|
|
104
|
+
sampleRate?: number;
|
|
113
105
|
/** @deprecated use appKey instead */
|
|
114
106
|
appId?: string;
|
|
115
107
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,aAAa,GAAG,MAAM,GAAG,SAAS,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,YAAY,CAAC;AAE9G,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,WAAW,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,UAAU,C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