@incodetech/tri-sdk 0.1.0 → 0.1.2-dev-20260528

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 (65) hide show
  1. package/dist/bundle-analysis.html +4950 -0
  2. package/dist/chunks/index-BAwek9Id.cjs +489 -0
  3. package/dist/chunks/index-BAwek9Id.cjs.map +1 -0
  4. package/dist/chunks/index-BBnHO5vA.js +477 -0
  5. package/dist/chunks/index-BBnHO5vA.js.map +1 -0
  6. package/dist/chunks/index-BMVAKptw.cjs +432 -0
  7. package/dist/chunks/index-BMVAKptw.cjs.map +1 -0
  8. package/dist/chunks/index-BYO0AI0T.js +420 -0
  9. package/dist/chunks/index-BYO0AI0T.js.map +1 -0
  10. package/dist/chunks/index-B_sPgtA6.cjs +489 -0
  11. package/dist/chunks/index-B_sPgtA6.cjs.map +1 -0
  12. package/dist/chunks/index-BlclLEsV.js +420 -0
  13. package/dist/chunks/index-BlclLEsV.js.map +1 -0
  14. package/dist/chunks/index-BxmW7qox.cjs +432 -0
  15. package/dist/chunks/index-BxmW7qox.cjs.map +1 -0
  16. package/dist/chunks/index-CECrIW-A.js +420 -0
  17. package/dist/chunks/index-CECrIW-A.js.map +1 -0
  18. package/dist/chunks/index-CKUPedC4.cjs +432 -0
  19. package/dist/chunks/index-CKUPedC4.cjs.map +1 -0
  20. package/dist/chunks/index-DUZ-lBzx.js +477 -0
  21. package/dist/chunks/index-DUZ-lBzx.js.map +1 -0
  22. package/dist/chunks/index-NNGWKwfy.js +420 -0
  23. package/dist/chunks/index-NNGWKwfy.js.map +1 -0
  24. package/dist/chunks/index-SQXEe_Yi.cjs +432 -0
  25. package/dist/chunks/index-SQXEe_Yi.cjs.map +1 -0
  26. package/dist/chunks/index-kx-dpbK_.cjs +432 -0
  27. package/dist/chunks/index-kx-dpbK_.cjs.map +1 -0
  28. package/dist/chunks/index-uSwsY9-F.js +420 -0
  29. package/dist/chunks/index-uSwsY9-F.js.map +1 -0
  30. package/dist/chunks/start-B4n8DLY_.cjs +5554 -0
  31. package/dist/chunks/start-B4n8DLY_.cjs.map +1 -0
  32. package/dist/chunks/start-BnvikGDT.cjs +5059 -0
  33. package/dist/chunks/start-BnvikGDT.cjs.map +1 -0
  34. package/dist/chunks/start-CJOOPw78.cjs +5554 -0
  35. package/dist/chunks/start-CJOOPw78.cjs.map +1 -0
  36. package/dist/chunks/start-CMqC8j2A.cjs +5561 -0
  37. package/dist/chunks/start-CMqC8j2A.cjs.map +1 -0
  38. package/dist/chunks/start-CkLlbFOM.cjs +5554 -0
  39. package/dist/chunks/start-CkLlbFOM.cjs.map +1 -0
  40. package/dist/chunks/start-CrKx_Alk.js +5552 -0
  41. package/dist/chunks/start-CrKx_Alk.js.map +1 -0
  42. package/dist/chunks/start-CwAEBqvW.js +5057 -0
  43. package/dist/chunks/start-CwAEBqvW.js.map +1 -0
  44. package/dist/chunks/start-CymdUpX5.js +5060 -0
  45. package/dist/chunks/start-CymdUpX5.js.map +1 -0
  46. package/dist/chunks/start-DTFRIfeO.js +5552 -0
  47. package/dist/chunks/start-DTFRIfeO.js.map +1 -0
  48. package/dist/chunks/start-Dpgr8IbP.js +5559 -0
  49. package/dist/chunks/start-Dpgr8IbP.js.map +1 -0
  50. package/dist/chunks/start-Dtnxf7k4.cjs +5554 -0
  51. package/dist/chunks/start-Dtnxf7k4.cjs.map +1 -0
  52. package/dist/chunks/start-DwQtOigF.cjs +5062 -0
  53. package/dist/chunks/start-DwQtOigF.cjs.map +1 -0
  54. package/dist/chunks/start-MKWGpbIO.js +5552 -0
  55. package/dist/chunks/start-MKWGpbIO.js.map +1 -0
  56. package/dist/chunks/start-y4ZhvkRa.js +5552 -0
  57. package/dist/chunks/start-y4ZhvkRa.js.map +1 -0
  58. package/dist/index.d.ts +166 -37
  59. package/dist/tri.cjs.js +2 -5467
  60. package/dist/tri.cjs.js.map +1 -1
  61. package/dist/tri.esm.js +1 -5470
  62. package/dist/tri.esm.js.map +1 -1
  63. package/dist/tri.umd.js +2567 -2500
  64. package/dist/tri.umd.js.map +1 -1
  65. package/package.json +5 -7
@@ -0,0 +1,432 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * @module lib/logger
5
+ *
6
+ * @description
7
+ * Singleton logger for the TRI SDK. This is the **only** sanctioned site for
8
+ * `console.*` calls inside `packages/core`. All other modules must import and
9
+ * use the exported `logger` instance rather than calling `console` directly.
10
+ *
11
+ * ### Debug gating
12
+ * Non-fatal methods (`warn`, `error`, `info`) are no-ops when `DEBUG` is
13
+ * `false`. Set `logger.DEBUG = true` — typically driven by the `debug` field
14
+ * in `TRIConfig` — to activate them. No string concatenation happens in the
15
+ * fast path (early return before any allocation).
16
+ *
17
+ * `fatal` always emits regardless of `DEBUG`; use it only for messages that
18
+ * must surface in production (hard misconfigurations, blocked environments).
19
+ *
20
+ * ### Message format
21
+ * `[prefix] message` — prefix is wrapped in square brackets and prepended to
22
+ * the message with a single space. Extra `args` are forwarded to the underlying
23
+ * `console.*` method unchanged so error objects and context values render with
24
+ * full browser-console expansion.
25
+ */
26
+ const SDK_PREFIX = 'TRI';
27
+ class Logger {
28
+ constructor() {
29
+ this.debugValue = false;
30
+ }
31
+ /** Returns the singleton Logger instance. */
32
+ static get instance() {
33
+ if (!Logger.singleton) {
34
+ Logger.singleton = new Logger();
35
+ }
36
+ return Logger.singleton;
37
+ }
38
+ /** Exposed read-only view of the current debug state. */
39
+ get _DEBUG() {
40
+ return this.debugValue;
41
+ }
42
+ get DEBUG() {
43
+ return this.debugValue;
44
+ }
45
+ set DEBUG(value) {
46
+ this.debugValue = value;
47
+ }
48
+ /** @inheritdoc LoggerInterface.warn */
49
+ warn(prefix, message, ...args) {
50
+ if (!this.debugValue)
51
+ return;
52
+ this._log('warn', prefix, message, ...args);
53
+ }
54
+ /** @inheritdoc LoggerInterface.error */
55
+ error(prefix, message, ...args) {
56
+ if (!this.debugValue)
57
+ return;
58
+ this._log('error', prefix, message, ...args);
59
+ }
60
+ /** @inheritdoc LoggerInterface.info */
61
+ info(prefix, message, ...args) {
62
+ if (!this.debugValue)
63
+ return;
64
+ this._log('info', prefix, message, ...args);
65
+ }
66
+ /** @inheritdoc LoggerInterface.fatal */
67
+ fatal(level, prefix, message, ...args) {
68
+ this._log(level, prefix, message, ...args);
69
+ }
70
+ _log(level, prefix, message, ...args) {
71
+ const modulePrefix = prefix ? `[${prefix}]` : '';
72
+ console[level](`[${SDK_PREFIX}]${modulePrefix} ${message}`, ...args);
73
+ }
74
+ }
75
+ /** Singleton logger instance. Import and use this throughout `packages/core`. */
76
+ const logger = Logger.instance;
77
+
78
+ /**
79
+ * @module sdk/internal/env
80
+ *
81
+ * @description
82
+ * Environment constants and URL resolver for the SDK preflight. This module
83
+ * is part of the **static bundle** — it imports only primitive types and the
84
+ * logger singleton, so it carries no collector-factory cost.
85
+ *
86
+ * Anything that must run before the lazy chunk loads (e.g. `sdk.ts` deciding
87
+ * whether to even fetch the bundle) should import from here rather than from
88
+ * the full `sdk/constants` module.
89
+ *
90
+ * @internal
91
+ */
92
+ /** How long (ms) to wait for a dynamic `import()` before giving up. */
93
+ const DYNAMIC_IMPORT_TIMEOUT_MS = 10000;
94
+ /** Default value for the `debug` flag when the host omits it. */
95
+ const DEFAULT_DEBUG = false;
96
+ /** Default `apiVersion` string when the host omits it. */
97
+ const DEFAULT_API_VERSION = '1.0';
98
+ /**
99
+ * Lookup from a `TriEnv` value to its corresponding base API URL.
100
+ * Entries with an empty string are **not yet provisioned**; hosts attempting
101
+ * to use them will receive a fatal error at SDK start.
102
+ */
103
+ const ENV_TO_BASE_API_URL_LOOKUP = {
104
+ STAGE_K8S: 'https://falcon-ingest-k8s.stage.incodetest.com',
105
+ SAAS: 'http://localhost:8080',
106
+ STAGE: '',
107
+ DEMO: '',
108
+ DEMO_K8S: ''
109
+ };
110
+ /**
111
+ * All known `TriEnv` keys (including those not yet provisioned with a URL).
112
+ * Used to distinguish a typo/unsupported env from a known-but-unprovisioned one.
113
+ */
114
+ const SUPPORTED_ENVS = Object.keys(ENV_TO_BASE_API_URL_LOOKUP);
115
+ /**
116
+ * Base API URLs that are fully provisioned and accepted at SDK start.
117
+ * Derived from `ENV_TO_BASE_API_URL_LOOKUP` by filtering empty strings.
118
+ */
119
+ const SUPPORTED_API_URLS = Object.values(ENV_TO_BASE_API_URL_LOOKUP).filter(Boolean);
120
+ /**
121
+ * Resolves a `TriEnv` value to its base API URL.
122
+ *
123
+ * Returns `undefined` (and logs a fatal) when:
124
+ * - the env is not a known `TriEnv` key, or
125
+ * - the env is known but not yet provisioned (empty URL).
126
+ */
127
+ function resolveBaseApiURLFromEnv(env) {
128
+ if (!SUPPORTED_ENVS.includes(env)) {
129
+ logger.fatal('error', 'SDK', 'Provided environment is not supported:', env, 'Supported environments are:', SUPPORTED_ENVS.join(', '));
130
+ return undefined;
131
+ }
132
+ const url = ENV_TO_BASE_API_URL_LOOKUP[env];
133
+ if (!url) {
134
+ logger.fatal('error', 'SDK', `env "${env}" is not yet provisioned with a base URL.`);
135
+ return undefined;
136
+ }
137
+ return url;
138
+ }
139
+
140
+ /**
141
+ * @module sdk/internal/preflight-config
142
+ *
143
+ * @description
144
+ * Lightweight config validator that runs in the **static bundle** before the
145
+ * lazy chunk is ever fetched. Its only job is to extract the three values
146
+ * needed for the collection-status preflight check (`apiKey`, `baseApiURL`,
147
+ * `debug`) and return them — or log a fatal and return `null` when the host
148
+ * config is unusable.
149
+ *
150
+ * The full `resolveTRIConfig` function (in `sdk/helpers.ts`) performs a
151
+ * superset of this validation and lives in the lazy chunk. This module exists
152
+ * solely to keep the static bundle free of `COLLECTORS_CONFIG` and every
153
+ * transitively-imported collector factory.
154
+ *
155
+ * @internal
156
+ */
157
+ /**
158
+ * Extracts and validates the preflight-critical fields from the host-supplied
159
+ * config. Returns `null` (with a fatal log) when any required field is missing
160
+ * or the resolved URL is not provisioned.
161
+ */
162
+ function resolvePreflightConfig(config) {
163
+ if (!config?.apiKey) {
164
+ logger.fatal('error', 'SDK', 'apiKey is required.');
165
+ return null;
166
+ }
167
+ let baseApiURL;
168
+ if (config.apiURL) {
169
+ if (!SUPPORTED_API_URLS.includes(config.apiURL)) {
170
+ logger.fatal('error', 'SDK', 'Provided apiURL is not supported:', config.apiURL, 'Supported API URLs are:', SUPPORTED_API_URLS.join(', '));
171
+ return null;
172
+ }
173
+ baseApiURL = config.apiURL;
174
+ }
175
+ else if (config.env) {
176
+ baseApiURL = resolveBaseApiURLFromEnv(config.env);
177
+ }
178
+ if (!baseApiURL) {
179
+ logger.fatal('error', 'SDK', "Couldn't initialise SDK — neither apiURL nor env were provided, or the provided value has no provisioned URL.");
180
+ return null;
181
+ }
182
+ return {
183
+ apiKey: config.apiKey,
184
+ baseApiURL,
185
+ debug: config.debug ?? DEFAULT_DEBUG,
186
+ };
187
+ }
188
+
189
+ // Pin timer globals at module evaluation time — same hazard model as `_fetch` in
190
+ // lib/http/http.ts. Host APM SDKs and instrumentation libraries routinely wrap
191
+ // setTimeout; capturing the originals ensures our HTTP timeout and retry timers
192
+ // are immune to those patches.
193
+ const _setTimeout = globalThis.setTimeout.bind(globalThis);
194
+ const _clearTimeout = globalThis.clearTimeout.bind(globalThis);
195
+ function safeSync(fn, finallyFn) {
196
+ try {
197
+ return fn();
198
+ }
199
+ catch (error) {
200
+ logger.warn('utils', 'safeSync swallowed error:', error);
201
+ }
202
+ finally {
203
+ }
204
+ }
205
+ async function safeAsync(fn) {
206
+ try {
207
+ return await fn();
208
+ }
209
+ catch (error) {
210
+ logger.warn('utils', 'safeAsync swallowed error:', error);
211
+ }
212
+ }
213
+ function safeListener(fn) {
214
+ return (event) => safeSync(() => fn(event));
215
+ }
216
+ function safeTimer(fn) {
217
+ return (...args) => {
218
+ try {
219
+ fn(...args);
220
+ }
221
+ catch (error) {
222
+ logger.warn('utils', 'safeTimer swallowed error:', error);
223
+ }
224
+ };
225
+ }
226
+ function safeSetTimeout(fn, delay) {
227
+ return _setTimeout(safeTimer(fn), delay);
228
+ }
229
+ function safeClearTimeout(id) {
230
+ if (id === null)
231
+ return;
232
+ try {
233
+ _clearTimeout(id);
234
+ }
235
+ catch (error) {
236
+ logger.warn('utils', 'safeClearTimeout swallowed error:', error);
237
+ }
238
+ }
239
+
240
+ /**
241
+ * Singleton entry-point for the TRI SDK.
242
+ *
243
+ * Obtain the instance via `TRI.instance`; the constructor is private.
244
+ *
245
+ * ### Life-cycle states
246
+ * The instance moves through three states:
247
+ * - `'idle'` — not started, or fully stopped.
248
+ * - `'starting'` — `start()` has been called; preflight and lazy bundle load in progress.
249
+ * - `'started'` — all managers are running and `reportEvent()` is active.
250
+ *
251
+ * ### Never throws
252
+ * All public methods are fire-and-forget. Errors are logged via `logger` and
253
+ * swallowed so the host application is never disrupted.
254
+ *
255
+ * ### Bundle split
256
+ * Only the preflight config validator and collection-status check live in the
257
+ * static bundle. The full manager wiring (`internal/start.ts`) is dynamically
258
+ * imported only when the backend confirms collection is enabled, keeping the
259
+ * initial page-load cost minimal.
260
+ */
261
+ let TRI$1 = class TRI {
262
+ constructor() {
263
+ /**
264
+ * Monotonically-increasing counter incremented by every `start()` and
265
+ * `stop()` call. Each in-flight `runStart` captures its own generation value
266
+ * and bails out after every `await` if the counter has moved on, preventing
267
+ * orphaned manager instances from being installed after a concurrent stop.
268
+ */
269
+ this.startGeneration = 0;
270
+ this.startState = 'idle';
271
+ // All manager fields are set after the lazy chunk loads successfully.
272
+ this.falconServiceManager = null;
273
+ this.activityManager = null;
274
+ this.transportManager = null;
275
+ this.tabManager = null;
276
+ this.lifecycleManager = null;
277
+ this.collectorManager = null;
278
+ this.eventReportManager = null;
279
+ }
280
+ static get instance() {
281
+ if (!TRI._instance) {
282
+ TRI._instance = new TRI();
283
+ }
284
+ return TRI._instance;
285
+ }
286
+ /**
287
+ * @description Starts the TRI SDK. Fire-and-forget and idempotent — a second
288
+ * call while the SDK is starting or already started is a no-op. Checks the
289
+ * backend `/collection-status` endpoint and only loads the full manager bundle
290
+ * when collection is enabled. Safe to call in SSR environments; if `document`
291
+ * is unavailable the function logs a fatal and returns without throwing.
292
+ */
293
+ start(config) {
294
+ if (this.startState !== 'idle') {
295
+ logger.warn('Start', 'start() called more than once — ignoring.');
296
+ return;
297
+ }
298
+ this.startState = 'starting';
299
+ const generation = ++this.startGeneration;
300
+ void this.runStart(config, generation);
301
+ }
302
+ /**
303
+ * @description Stops all collectors, flushes pending events, and tears down
304
+ * every manager. Safe to call more than once. After `stop()`, `start()` may be
305
+ * called again with a fresh config. Any in-flight `start()` is cancelled at
306
+ * the next async checkpoint.
307
+ */
308
+ stop() {
309
+ ++this.startGeneration;
310
+ this.startState = 'idle';
311
+ this.lifecycleManager?.stop();
312
+ this.lifecycleManager = null;
313
+ this.activityManager?.stop();
314
+ this.activityManager = null;
315
+ this.transportManager?.stop();
316
+ this.transportManager = null;
317
+ this.tabManager?.stop();
318
+ this.tabManager = null;
319
+ this.collectorManager?.stop();
320
+ this.collectorManager = null;
321
+ this.eventReportManager?.stop();
322
+ this.eventReportManager = null;
323
+ this.falconServiceManager = null;
324
+ logger.DEBUG = DEFAULT_DEBUG;
325
+ }
326
+ /**
327
+ * @description Reports a host-defined event to the TRI backend. Fire-and-forget —
328
+ * never throws and never returns a promise the host must handle. Drops the
329
+ * event silently (with a dev warning) if called before `start` completes.
330
+ */
331
+ reportEvent(name, metadata) {
332
+ if (this.shouldEarlyEscapeReport()) {
333
+ return;
334
+ }
335
+ void safeAsync(() => this.eventReportManager.report(name, metadata));
336
+ }
337
+ async runStart(config, generation) {
338
+ if (typeof document === 'undefined') {
339
+ logger.fatal('error', 'Start', 'start() called in a non-browser environment. The SDK will not start.');
340
+ this.startState = 'idle';
341
+ return;
342
+ }
343
+ // resolvePreflightConfig runs entirely in the static bundle — no collector
344
+ // factories are loaded at this point.
345
+ const preflight = resolvePreflightConfig(config);
346
+ if (!preflight) {
347
+ this.startState = 'idle';
348
+ return;
349
+ }
350
+ // Bail if stop() or a concurrent start() invalidated this run.
351
+ if (this.startGeneration !== generation) {
352
+ return;
353
+ }
354
+ // Flip DEBUG only after the SDK is confirmed to start.
355
+ logger.DEBUG = preflight.debug;
356
+ // Dynamically import the lazy chunk with a hard timeout so a slow/dead
357
+ // CDN does not hang the host application indefinitely.
358
+ let startModule;
359
+ try {
360
+ startModule = await Promise.race([
361
+ Promise.resolve().then(function () { return require('./start-CkLlbFOM.cjs'); }),
362
+ new Promise((_, reject) => setTimeout(() => reject(new Error('dynamic import timed out')), DYNAMIC_IMPORT_TIMEOUT_MS))
363
+ ]);
364
+ }
365
+ catch (error) {
366
+ logger.error('Start', 'Failed to load manager bundle:', error);
367
+ if (this.startGeneration === generation) {
368
+ this.startState = 'idle';
369
+ }
370
+ return;
371
+ }
372
+ if (this.startGeneration !== generation) {
373
+ return;
374
+ }
375
+ // The lazy chunk receives the raw config and runs the full resolver internally.
376
+ const managers = await startModule.start(config);
377
+ if (this.startGeneration !== generation) {
378
+ // A concurrent stop() (or new start()) raced us — discard what we built.
379
+ if (managers) {
380
+ managers.lifecycleManager?.stop();
381
+ managers.tabManager?.stop();
382
+ managers.transportManager?.stop();
383
+ void managers.activityManager?.stop();
384
+ }
385
+ return;
386
+ }
387
+ if (!managers) {
388
+ // internal/start.ts already logged the reason.
389
+ this.startState = 'idle';
390
+ return;
391
+ }
392
+ this.falconServiceManager = managers.falconServiceManager;
393
+ this.activityManager = managers.activityManager;
394
+ this.transportManager = managers.transportManager;
395
+ this.tabManager = managers.tabManager;
396
+ this.lifecycleManager = managers.lifecycleManager;
397
+ this.collectorManager = managers.collectorManager;
398
+ this.eventReportManager = managers.eventReportManager;
399
+ this.startState = 'started';
400
+ }
401
+ /**
402
+ * Returns `true` (and logs a dev warning) when `reportEvent()` should be a
403
+ * no-op. Guards against calling before the SDK is fully started, or when
404
+ * the `eventReportManager` is unexpectedly absent.
405
+ */
406
+ shouldEarlyEscapeReport() {
407
+ if (this.startState !== 'started') {
408
+ logger.warn('ReportEvent', 'reportEvent() called before start() completed.');
409
+ return true;
410
+ }
411
+ if (!this.eventReportManager) {
412
+ logger.warn('ReportEvent', 'eventReportManager not available.');
413
+ return true;
414
+ }
415
+ return false;
416
+ }
417
+ };
418
+
419
+ const TRI = TRI$1.instance;
420
+
421
+ exports.DEFAULT_API_VERSION = DEFAULT_API_VERSION;
422
+ exports.DEFAULT_DEBUG = DEFAULT_DEBUG;
423
+ exports.SUPPORTED_API_URLS = SUPPORTED_API_URLS;
424
+ exports.TRI = TRI;
425
+ exports.logger = logger;
426
+ exports.resolveBaseApiURLFromEnv = resolveBaseApiURLFromEnv;
427
+ exports.safeAsync = safeAsync;
428
+ exports.safeClearTimeout = safeClearTimeout;
429
+ exports.safeListener = safeListener;
430
+ exports.safeSetTimeout = safeSetTimeout;
431
+ exports.safeSync = safeSync;
432
+ //# sourceMappingURL=index-BMVAKptw.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-BMVAKptw.cjs","sources":["../../src/lib/logger/logger.ts","../../src/sdk/internal/env.ts","../../src/sdk/internal/preflight-config.ts","../../src/utils/fire-and-forget.ts","../../src/sdk/sdk.ts","../../src/index.ts"],"sourcesContent":[null,null,null,null,null,null],"names":["TRIClass"],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;;;;AAsBG;AAKH,MAAM,UAAU,GAAG,KAAK;MAEX,MAAM,CAAA;AAKjB,IAAA,WAAA,GAAA;QAFQ,IAAA,CAAA,UAAU,GAAY,KAAK;IAEZ;;AAGhB,IAAA,WAAW,QAAQ,GAAA;AACxB,QAAA,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;AACrB,YAAA,MAAM,CAAC,SAAS,GAAG,IAAI,MAAM,EAAE;QACjC;QACA,OAAO,MAAM,CAAC,SAAS;IACzB;;AAGA,IAAA,IAAI,MAAM,GAAA;QACR,OAAO,IAAI,CAAC,UAAU;IACxB;AAEA,IAAA,IAAI,KAAK,GAAA;QACP,OAAO,IAAI,CAAC,UAAU;IACxB;IAEA,IAAI,KAAK,CAAC,KAAc,EAAA;AACtB,QAAA,IAAI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