healcode-client 1.0.5 → 1.0.6

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/bin/healcode.js CHANGED
@@ -10,8 +10,6 @@ import { fileURLToPath } from 'url';
10
10
  const __filename = fileURLToPath(import.meta.url);
11
11
  const __dirname = path.dirname(__filename);
12
12
 
13
- const CONFIG_FILE_NAME = 'healcode.config.json';
14
-
15
13
  // Load URLs from config
16
14
  let urlsConfig = { backendUrl: 'https://www.healdcode.somee.com', agentUrl: 'https://www.healdcode.somee.com' };
17
15
  try {
@@ -33,12 +31,176 @@ program
33
31
  .description('HealCode CLI - Automatic error detection and fix generation')
34
32
  .version('1.0.0');
35
33
 
34
+ // Detect project type
35
+ function detectProjectType() {
36
+ const cwd = process.cwd();
37
+
38
+ // Check for Angular
39
+ if (fs.existsSync(path.join(cwd, 'angular.json'))) {
40
+ return 'angular';
41
+ }
42
+
43
+ // Check for React (Create React App or Vite)
44
+ const packageJson = path.join(cwd, 'package.json');
45
+ if (fs.existsSync(packageJson)) {
46
+ const pkg = JSON.parse(fs.readFileSync(packageJson, 'utf-8'));
47
+ if (pkg.dependencies?.react || pkg.devDependencies?.react) {
48
+ return 'react';
49
+ }
50
+ if (pkg.dependencies?.vue || pkg.devDependencies?.vue) {
51
+ return 'vue';
52
+ }
53
+ if (pkg.dependencies?.next || pkg.devDependencies?.next) {
54
+ return 'nextjs';
55
+ }
56
+ }
57
+
58
+ return 'generic';
59
+ }
60
+
61
+ // Find index.html
62
+ function findIndexHtml() {
63
+ const cwd = process.cwd();
64
+ const possiblePaths = [
65
+ path.join(cwd, 'src', 'index.html'), // Angular
66
+ path.join(cwd, 'public', 'index.html'), // React/Vue
67
+ path.join(cwd, 'index.html'), // Vite/Generic
68
+ ];
69
+
70
+ for (const p of possiblePaths) {
71
+ if (fs.existsSync(p)) {
72
+ return p;
73
+ }
74
+ }
75
+ return null;
76
+ }
77
+
78
+ // Generate the inline script
79
+ function generateInlineScript(config) {
80
+ return `
81
+ <!-- HealCode Error Tracking -->
82
+ <script>
83
+ (function(){
84
+ var config = ${JSON.stringify(config)};
85
+ if (!config.enabled) return;
86
+
87
+ var endpoint = config.endpoint || '${AGENT_URL}';
88
+ if (!endpoint.endsWith('/api/logs/')) {
89
+ endpoint = endpoint.replace(/\\/$/, '') + '/api/logs/';
90
+ }
91
+
92
+ var breadcrumbs = [];
93
+ var sentHashes = {};
94
+ var maxBreadcrumbs = config.options?.maxBreadcrumbs || 20;
95
+
96
+ function hash(str) {
97
+ var h = 0;
98
+ for (var i = 0; i < str.length; i++) {
99
+ h = ((h << 5) - h) + str.charCodeAt(i);
100
+ h = h & h;
101
+ }
102
+ return h.toString();
103
+ }
104
+
105
+ function addBreadcrumb(type, message, data) {
106
+ breadcrumbs.push({ type: type, message: message, timestamp: new Date().toISOString(), data: data });
107
+ if (breadcrumbs.length > maxBreadcrumbs) breadcrumbs.shift();
108
+ }
109
+
110
+ function send(level, message, stack) {
111
+ var h = hash(message + (stack || ''));
112
+ if (sentHashes[h]) return;
113
+ sentHashes[h] = true;
114
+ setTimeout(function() { delete sentHashes[h]; }, 300000);
115
+
116
+ var payload = {
117
+ token: config.token,
118
+ message: message,
119
+ stacktrace: stack,
120
+ url: window.location.href,
121
+ level: level,
122
+ userAgent: navigator.userAgent,
123
+ networkStatus: navigator.onLine ? 'online' : 'offline',
124
+ breadcrumbs: breadcrumbs.slice(),
125
+ timestamp: new Date().toISOString()
126
+ };
127
+
128
+ fetch(endpoint, {
129
+ method: 'POST',
130
+ headers: { 'Content-Type': 'application/json', 'X-HealCode-Token': config.token },
131
+ body: JSON.stringify(payload),
132
+ keepalive: true
133
+ }).catch(function(){});
134
+ }
135
+
136
+ // Capture errors
137
+ window.onerror = function(msg, src, line, col, err) {
138
+ send('error', msg + ' at ' + src + ':' + line + ':' + col, err?.stack);
139
+ };
140
+
141
+ window.onunhandledrejection = function(e) {
142
+ send('error', 'Unhandled Rejection: ' + e.reason);
143
+ };
144
+
145
+ if (config.options?.captureConsoleErrors !== false) {
146
+ var origError = console.error;
147
+ console.error = function() {
148
+ var msg = Array.prototype.slice.call(arguments).map(function(a) {
149
+ return typeof a === 'object' ? JSON.stringify(a) : String(a);
150
+ }).join(' ');
151
+ send('error', msg);
152
+ origError.apply(console, arguments);
153
+ };
154
+ }
155
+
156
+ // Breadcrumbs
157
+ document.addEventListener('click', function(e) {
158
+ var t = e.target;
159
+ addBreadcrumb('ui.click', 'Clicked ' + t.tagName, { id: t.id, class: t.className });
160
+ }, true);
161
+
162
+ window.addEventListener('online', function() { addBreadcrumb('network', 'Online'); });
163
+ window.addEventListener('offline', function() { addBreadcrumb('network', 'Offline'); });
164
+
165
+ console.log('[HealCode] Initialized');
166
+ })();
167
+ </script>`;
168
+ }
169
+
170
+ // Inject script into index.html
171
+ function injectScript(indexPath, config) {
172
+ let html = fs.readFileSync(indexPath, 'utf-8');
173
+
174
+ // Check if already injected
175
+ if (html.includes('HealCode Error Tracking')) {
176
+ return { success: false, reason: 'already_injected' };
177
+ }
178
+
179
+ const script = generateInlineScript(config);
180
+
181
+ // Inject before </head>
182
+ if (html.includes('</head>')) {
183
+ html = html.replace('</head>', script + '\n</head>');
184
+ } else if (html.includes('<body')) {
185
+ // Inject at start of body
186
+ html = html.replace(/<body[^>]*>/, (match) => match + '\n' + script);
187
+ } else {
188
+ return { success: false, reason: 'no_injection_point' };
189
+ }
190
+
191
+ fs.writeFileSync(indexPath, html);
192
+ return { success: true };
193
+ }
194
+
36
195
  program
37
196
  .command('init')
38
197
  .description('Initialize HealCode in your project')
39
198
  .action(async () => {
40
199
  console.log(chalk.green.bold('\n🩺 HealCode Setup\n'));
41
200
 
201
+ const projectType = detectProjectType();
202
+ console.log(chalk.gray(` Detected: ${projectType} project\n`));
203
+
42
204
  const { token } = await inquirer.prompt([
43
205
  {
44
206
  type: 'input',
@@ -59,7 +221,7 @@ program
59
221
  // Validate token with API
60
222
  console.log(chalk.yellow('\n⏳ Validating token...'));
61
223
 
62
- let remoteConfig = null;
224
+ let projectName = 'Unknown';
63
225
 
64
226
  try {
65
227
  const response = await fetch(`${BACKEND_URL}/api/tokens/validate`, {
@@ -77,135 +239,111 @@ program
77
239
  }
78
240
 
79
241
  console.log(chalk.green('✅ Token validated successfully!'));
80
- console.log(chalk.gray(` Project: ${result.projectId}`));
81
-
82
- if (result.configuration) {
83
- remoteConfig = result.configuration;
84
- console.log(chalk.green('✅ Configuration loaded from Dashboard.'));
85
- }
242
+ projectName = result.projectId || 'Unknown';
243
+ console.log(chalk.gray(` Project: ${projectName}`));
86
244
 
87
245
  } catch (error) {
88
- console.log(chalk.yellow('\n⚠️ Could not validate token (API unreachable). Proceeding with manual setup...'));
246
+ console.log(chalk.red('\nCould not validate token. Check your internet connection.'));
247
+ process.exit(1);
89
248
  }
90
249
 
91
- let options = {};
92
-
93
- if (remoteConfig) {
94
- options = remoteConfig;
95
- } else {
96
- options = await inquirer.prompt([
97
- {
98
- type: 'confirm',
99
- name: 'captureConsoleErrors',
100
- message: 'Capture console.error calls?',
101
- default: true,
102
- },
103
- {
104
- type: 'confirm',
105
- name: 'captureUnhandledRejections',
106
- message: 'Capture unhandled promise rejections?',
107
- default: true,
108
- },
109
- ]);
110
- }
111
-
112
- // Create config file
250
+ // Create config
113
251
  const config = {
114
252
  token: token,
115
253
  endpoint: AGENT_URL,
116
254
  enabled: true,
117
255
  options: {
118
- captureConsoleErrors: options.captureConsoleErrors !== false,
119
- captureUnhandledRejections: options.captureUnhandledRejections !== false,
256
+ captureConsoleErrors: true,
257
+ captureUnhandledRejections: true,
120
258
  maxBreadcrumbs: 20,
121
259
  },
122
260
  };
123
261
 
124
- const configPath = path.join(process.cwd(), CONFIG_FILE_NAME);
125
- fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
126
-
127
- console.log(chalk.green(`\n✅ Config saved to ${CONFIG_FILE_NAME}`));
262
+ // Find and inject into index.html
263
+ console.log(chalk.yellow('\n⏳ Injecting HealCode script...'));
264
+
265
+ const indexPath = findIndexHtml();
266
+
267
+ if (!indexPath) {
268
+ console.log(chalk.red('\n❌ Could not find index.html'));
269
+ console.log(chalk.gray(' Looked in: src/index.html, public/index.html, index.html'));
270
+ process.exit(1);
271
+ }
128
272
 
129
- // Show usage instructions
130
- console.log(chalk.cyan('\n📖 Usage:\n'));
131
- console.log(chalk.white(' // In your main entry file (e.g., main.ts, index.js)'));
132
- console.log(chalk.gray(" import { initFromConfig } from 'healcode-client';"));
133
- console.log(chalk.gray(' initFromConfig();\n'));
273
+ const result = injectScript(indexPath, config);
274
+
275
+ if (!result.success) {
276
+ if (result.reason === 'already_injected') {
277
+ console.log(chalk.yellow('\n⚠️ HealCode is already installed in this project.'));
278
+ } else {
279
+ console.log(chalk.red('\n❌ Could not inject script into index.html'));
280
+ }
281
+ process.exit(1);
282
+ }
134
283
 
135
- console.log(chalk.white(' // Or with manual configuration:'));
136
- console.log(chalk.gray(" import { HealCode } from 'healcode-client';"));
137
- console.log(chalk.gray(` const healcode = new HealCode({ token: '${token.substring(0, 10)}...' });\n`));
284
+ console.log(chalk.green(`✅ Script injected into ${path.relative(process.cwd(), indexPath)}`));
138
285
 
139
- // Add to .gitignore
286
+ // Add to .gitignore (the config is now embedded, but keep this for reference)
140
287
  const gitignorePath = path.join(process.cwd(), '.gitignore');
141
288
  if (fs.existsSync(gitignorePath)) {
142
289
  const gitignore = fs.readFileSync(gitignorePath, 'utf-8');
143
- if (!gitignore.includes(CONFIG_FILE_NAME)) {
144
- fs.appendFileSync(gitignorePath, `\n# HealCode\n${CONFIG_FILE_NAME}\n`);
145
- console.log(chalk.gray(`Added ${CONFIG_FILE_NAME} to .gitignore`));
290
+ if (!gitignore.includes('healcode.config.json')) {
291
+ fs.appendFileSync(gitignorePath, '\n# HealCode\nhealcode.config.json\n');
146
292
  }
147
293
  }
148
294
 
149
- console.log(chalk.green.bold('\n🎉 HealCode is ready! Errors will be automatically tracked and fixed.\n'));
295
+ console.log(chalk.green.bold('\n🎉 HealCode installed successfully!\n'));
296
+ console.log(chalk.gray(' Errors will be automatically captured and sent to HealCode.'));
297
+ console.log(chalk.gray(' No code changes required.\n'));
150
298
  });
151
299
 
152
300
  program
153
- .command('status')
154
- .description('Check HealCode configuration status')
301
+ .command('remove')
302
+ .description('Remove HealCode from your project')
155
303
  .action(() => {
156
- const configPath = path.join(process.cwd(), CONFIG_FILE_NAME);
157
-
158
- if (!fs.existsSync(configPath)) {
159
- console.log(chalk.yellow('\n⚠️ No HealCode configuration found.'));
160
- console.log(chalk.gray('Run `npx healcode init` to set up.\n'));
304
+ const indexPath = findIndexHtml();
305
+
306
+ if (!indexPath) {
307
+ console.log(chalk.yellow('\n⚠️ Could not find index.html\n'));
161
308
  return;
162
309
  }
163
310
 
164
- try {
165
- const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
166
- console.log(chalk.green.bold('\n🩺 HealCode Status\n'));
167
- console.log(chalk.white(` Token: ${config.token.substring(0, 15)}...`));
168
- console.log(chalk.white(` Endpoint: ${config.endpoint || AGENT_URL}`));
169
- console.log(chalk.white(` Enabled: ${config.enabled !== false ? '✅' : '❌'}`));
170
- console.log('');
171
- } catch (error) {
172
- console.log(chalk.red('\n❌ Failed to read configuration file.\n'));
173
- }
174
- });
175
-
176
- program
177
- .command('disable')
178
- .description('Disable HealCode error tracking')
179
- .action(() => {
180
- const configPath = path.join(process.cwd(), CONFIG_FILE_NAME);
181
-
182
- if (!fs.existsSync(configPath)) {
183
- console.log(chalk.yellow('\n⚠️ No HealCode configuration found.\n'));
311
+ let html = fs.readFileSync(indexPath, 'utf-8');
312
+
313
+ // Remove HealCode script block
314
+ const regex = /\n?<!-- HealCode Error Tracking -->[\s\S]*?<\/script>/g;
315
+
316
+ if (!regex.test(html)) {
317
+ console.log(chalk.yellow('\n⚠️ HealCode is not installed in this project.\n'));
184
318
  return;
185
319
  }
186
320
 
187
- const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
188
- config.enabled = false;
189
- fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
190
- console.log(chalk.yellow('\n⏸️ HealCode tracking disabled.\n'));
321
+ html = html.replace(regex, '');
322
+ fs.writeFileSync(indexPath, html);
323
+
324
+ console.log(chalk.green('\nHealCode removed successfully.\n'));
191
325
  });
192
326
 
193
327
  program
194
- .command('enable')
195
- .description('Enable HealCode error tracking')
328
+ .command('status')
329
+ .description('Check HealCode installation status')
196
330
  .action(() => {
197
- const configPath = path.join(process.cwd(), CONFIG_FILE_NAME);
198
-
199
- if (!fs.existsSync(configPath)) {
200
- console.log(chalk.yellow('\n⚠️ No HealCode configuration found.'));
201
- console.log(chalk.gray('Run `npx healcode init` to set up.\n'));
331
+ const indexPath = findIndexHtml();
332
+
333
+ if (!indexPath) {
334
+ console.log(chalk.yellow('\n⚠️ Could not find index.html\n'));
202
335
  return;
203
336
  }
204
337
 
205
- const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
206
- config.enabled = true;
207
- fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
208
- console.log(chalk.green('\n▶️ HealCode tracking enabled.\n'));
338
+ const html = fs.readFileSync(indexPath, 'utf-8');
339
+
340
+ if (html.includes('HealCode Error Tracking')) {
341
+ console.log(chalk.green.bold('\n🩺 HealCode Status: Installed ✅\n'));
342
+ console.log(chalk.gray(` Location: ${path.relative(process.cwd(), indexPath)}\n`));
343
+ } else {
344
+ console.log(chalk.yellow('\n⚠️ HealCode is not installed.'));
345
+ console.log(chalk.gray(' Run `npx healcode init` to set up.\n'));
346
+ }
209
347
  });
210
348
 
211
349
  program.parse();
package/dist/index.d.mts CHANGED
@@ -55,7 +55,12 @@ declare class HealCode {
55
55
  isEnabled(): boolean;
56
56
  }
57
57
 
58
- declare function loadConfig(configPath?: string): HealCodeFileConfig | null;
59
- declare function initFromConfig(configPath?: string): HealCode | null;
58
+ declare global {
59
+ interface Window {
60
+ __HEALCODE_CONFIG__?: HealCodeFileConfig;
61
+ }
62
+ }
63
+ declare function loadConfig(): HealCodeFileConfig | null;
64
+ declare function initFromConfig(): HealCode | null;
60
65
 
61
66
  export { HealCode, type HealCodeConfig, type HealCodeFileConfig, initFromConfig, loadConfig };
package/dist/index.d.ts CHANGED
@@ -55,7 +55,12 @@ declare class HealCode {
55
55
  isEnabled(): boolean;
56
56
  }
57
57
 
58
- declare function loadConfig(configPath?: string): HealCodeFileConfig | null;
59
- declare function initFromConfig(configPath?: string): HealCode | null;
58
+ declare global {
59
+ interface Window {
60
+ __HEALCODE_CONFIG__?: HealCodeFileConfig;
61
+ }
62
+ }
63
+ declare function loadConfig(): HealCodeFileConfig | null;
64
+ declare function initFromConfig(): HealCode | null;
60
65
 
61
66
  export { HealCode, type HealCodeConfig, type HealCodeFileConfig, initFromConfig, loadConfig };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- 'use strict';const a0_0x177ba2=a0_0x2c2d;(function(_0x1baf4b,_0xe6882b){const _0xcb8c71=a0_0x2c2d,_0x546d19=_0x1baf4b();while(!![]){try{const _0x4f38d9=parseInt(_0xcb8c71(0x21d))/0x1+parseInt(_0xcb8c71(0x199))/0x2*(parseInt(_0xcb8c71(0x208))/0x3)+parseInt(_0xcb8c71(0x1e6))/0x4*(parseInt(_0xcb8c71(0x21c))/0x5)+-parseInt(_0xcb8c71(0x1ad))/0x6+parseInt(_0xcb8c71(0x1df))/0x7*(-parseInt(_0xcb8c71(0x1b8))/0x8)+-parseInt(_0xcb8c71(0x216))/0x9*(parseInt(_0xcb8c71(0x19e))/0xa)+parseInt(_0xcb8c71(0x1bd))/0xb;if(_0x4f38d9===_0xe6882b)break;else _0x546d19['push'](_0x546d19['shift']());}catch(_0x69989c){_0x546d19['push'](_0x546d19['shift']());}}}(a0_0x12c5,0x37cfc));var C=Object[a0_0x177ba2(0x20b)],l=Object[a0_0x177ba2(0x1f5)],m=Object[a0_0x177ba2(0x20f)],b=Object[a0_0x177ba2(0x1cc)],w=Object[a0_0x177ba2(0x1b3)],H=Object[a0_0x177ba2(0x1ea)][a0_0x177ba2(0x1fb)],v=(_0x5db003,_0x4e2299)=>{const _0x3d0fa0={'RVoAk':function(_0x1b0def,_0x37c99e,_0x56ae87,_0x1d0951){return _0x1b0def(_0x37c99e,_0x56ae87,_0x1d0951);}};for(var _0x55ed3c in _0x4e2299)_0x3d0fa0['RVoAk'](l,_0x5db003,_0x55ed3c,{'get':_0x4e2299[_0x55ed3c],'enumerable':!0x0});},u=(_0x30fc2e,_0x518409,_0x1f87d0,_0x5a3553)=>{const _0x13d66c=a0_0x177ba2,_0x5ed660={'UsJgt':_0x13d66c(0x1b0),'JzXiR':function(_0x185855,_0x37655e){return _0x185855==_0x37655e;},'DGdfX':'function','mTwoG':function(_0x3bb30e,_0x17bd6e){return _0x3bb30e(_0x17bd6e);},'HQnMe':function(_0x26eb9a,_0xf87dbe){return _0x26eb9a!==_0xf87dbe;},'OWHVT':function(_0x5b07dc,_0x8d7301,_0x3e4d80,_0x4e2629){return _0x5b07dc(_0x8d7301,_0x3e4d80,_0x4e2629);},'wSrCH':function(_0x475de5,_0x4237c2,_0x53f611){return _0x475de5(_0x4237c2,_0x53f611);}};if(_0x518409&&typeof _0x518409==_0x5ed660[_0x13d66c(0x1cb)]||_0x5ed660[_0x13d66c(0x1de)](typeof _0x518409,_0x5ed660[_0x13d66c(0x1c5)])){for(let _0x2e4bdd of _0x5ed660['mTwoG'](b,_0x518409))!H[_0x13d66c(0x203)](_0x30fc2e,_0x2e4bdd)&&_0x5ed660['HQnMe'](_0x2e4bdd,_0x1f87d0)&&_0x5ed660[_0x13d66c(0x194)](l,_0x30fc2e,_0x2e4bdd,{'get':()=>_0x518409[_0x2e4bdd],'enumerable':!(_0x5a3553=_0x5ed660[_0x13d66c(0x1ac)](m,_0x518409,_0x2e4bdd))||_0x5a3553[_0x13d66c(0x1c6)]});}return _0x30fc2e;},f=(_0x3fefe2,_0x3f41b9,_0x5c1691)=>(_0x5c1691=_0x3fefe2!=null?C(w(_0x3fefe2)):{},u(_0x3f41b9||!_0x3fefe2||!_0x3fefe2[a0_0x177ba2(0x20a)]?l(_0x5c1691,'default',{'value':_0x3fefe2,'enumerable':!0x0}):_0x5c1691,_0x3fefe2)),y=_0x5c9222=>u(l({},a0_0x177ba2(0x20a),{'value':!0x0}),_0x5c9222),N={};function a0_0x12c5(){const _0x25a6a4=['yw5LtgS','B25LCNjVCG','u3jzwMu','zNLcCKu','Aw1mwu4','Dg9tDhjPBMC','Aw5PDa','CvbZwKq','Aw5PDgLHBgL6zwq','Aw50zxjJzxb0q29UC29Szq','y2fWDhvYzunVBNnVBgvfCNjVCNm','AgfZ','sNPyAvi','mtr3vuTvzxO','w0HLywXdB2rLxsbozxr3B3jRigvYCM9YoG','DxrMltG','DNvRq3e','igf0ia','rNPPyLe','Aw5UzxjuzxH0','ndm2wM5RvNbe','w0HLywXdB2rLxsbgywLSzwqGDg8GBg9HzcbJB25MAwC6','B3b0Aw9UCW','B3vTCMu','ChjVDg90ExbL','yKPdr1e','C2v0rw5HyMXLza','CeHlAMi','zw5HyMXLza','CeLoD3y','w0HLywXdB2rLxsbgywLSzwqGDg8GCMvWB3j0igvYCM9YoG','sfnTs1C','Dg9Rzw4','CgfYC2u','Bwf4qNjLywrJCNvTyNm','zgvMAw5LuhjVCgvYDhK','B25mAw5L','vwzpwLC','ywrKqNjLywrJCNvTyG','z2vUzxjHDgviyxnO','zgvSzxrL','AgfZt3DUuhjVCgvYDhK','zxHPC3rZu3LUyW','q2XPy2TLzcbVBIa','l2fWAs9SB2DZlW','Aw50zxjJzxb0vw5Oyw5KBgvKuMvQzwn0Aw9UCW','y2fWDhvYzvvUAgfUzgXLzfjLAMvJDgLVBNm','sLfxC1q','ChvZAa','y2fSBa','Cgf0Aa','B25SAw5L','CMvyzwy','ywrKrxzLBNrmAxn0zw5LCG','mJDpEhDpCum','B251BMHHBMrSzwrYzwPLy3rPB24','x19LC01VzhvSzq','y3jLyxrL','y2fWDhvYzq','vw5RBM93BIbLCNjVCG','Aw50zxjJzxb0v2LUzg93rxjYB3jZ','z2v0t3DUuhjVCgvYDhLezxnJCMLWDg9Y','w0HLywXdB2rLxsbfCNjVCIbYzxbVCNrLzcbZDwnJzxnZzNvSBhK','yxbWBgLJyxrPB24VANnVBG','y29UzMLN','AxnfBMfIBgvK','BMv0D29YAW','y2XHC3noyw1L','nZiWuLvnv3bg','l2fWAs9SB2DZ','yw5dBe4','C2v0DxbjBNrLCMfJDgLVBKXPC3rLBMvYCW','C2v0Dxbozxr3B3jRtgLZDgvUzxjZ','AgvHBgnVzguUy29UzMLNlMPZB24','nJiYmgjzt2zbua','ntG5ntfgs2zXzhG','yNjLywrJCNvTyNm','w0HLywXdB2rLxsbjBML0AwfSAxPLzcbZDwnJzxnZzNvSBhK','AhjLzG','t1DivLq','C3rYAw5NAwz5','DgfNtMfTzq','zw5KC1DPDgG','C3rHy2S','ndC2mNndrLvNrG','weHwy0y','B2zMBgLUzq','r1DozfC','uNHwDgS','ntmWnJbkD0Lxr1e','C2vUDeHHC2HLCW','v2fOEKi','DwKUy2XPy2S','CMvHC29U','BLndt24','EMnAwe8','BwfW','C3jkwu0','y2HHCKnVzgvbDa','yxbWBhK','DgfYz2v0','BgvUz3rO','zxjYB3i','D1nYq0G','mti2mZeWmNnZB05Qsa','C3rYAw5N','yMX0uxK','B2jQzwn0','DejJwuK','Bg9JyxrPB24','z2v0uhjVDg90ExbLt2y','AM9PBG','qNvJrxa','rfPgzMm','uLL4rvG','mtq1otu0nenbDfnoqW','vxLSCNK','yMvMB3jLu2vUza','yNHsvvi','zxHWB3j0CW','mteXmZC2mJfKC0HxAvu','vw5Oyw5KBgvKifjLAMvJDgLVBJOG','tMndtNC','ywrK','suP4Cgi','zgLYBMfTzq','BLPOquy','zw5KCg9PBNq','reDKzLG','zw51BwvYywjSzq','C3vIC3rYAw5N','Bg9N','y3DK','D2fYBG','vxnkz3q','z2v0t3DUuhjVCgvYDhLoyw1LCW','C2HPzNq','q29UBMvJDgLVBIbSB3n0','CMvWBgfJzq','vvfcCM4','ugjwvM0'];a0_0x12c5=function(){return _0x25a6a4;};return a0_0x12c5();}v(N,{'HealCode':()=>s,'initFromConfig':()=>h,'loadConfig':()=>p}),module[a0_0x177ba2(0x1bc)]=y(N);var g='https://prepaid-tribal-invited-eng.trycloudflare.com',E=g+a0_0x177ba2(0x1fe),x=0x14,s=class{constructor(_0x3d3ae3){const _0x285598=a0_0x177ba2,_0x2a98e5={'vukCq':function(_0x51effd,_0x3b9aba){return _0x51effd!==_0x3b9aba;},'Uylry':function(_0x3833a9,_0x4db9a5){return _0x3833a9<_0x4db9a5;}};this['breadcrumbs']=[],this[_0x285598(0x19f)]=new Set(),this['initialized']=!0x1,(this[_0x285598(0x212)]={'token':_0x3d3ae3[_0x285598(0x1f2)],'endpoint':_0x3d3ae3['endpoint']||E,'enabled':_0x2a98e5[_0x285598(0x1e2)](_0x3d3ae3[_0x285598(0x1ee)],!0x1),'captureConsoleErrors':_0x2a98e5[_0x285598(0x1e2)](_0x3d3ae3['captureConsoleErrors'],!0x1),'captureUnhandledRejections':_0x2a98e5[_0x285598(0x1e2)](_0x3d3ae3[_0x285598(0x200)],!0x1),'maxBreadcrumbs':_0x3d3ae3['maxBreadcrumbs']||x,'beforeSend':_0x3d3ae3[_0x285598(0x1ba)]},this[_0x285598(0x212)][_0x285598(0x1ee)]&&_0x2a98e5[_0x285598(0x1b9)](typeof window,'u')&&this[_0x285598(0x1d8)]());}[a0_0x177ba2(0x1d8)](){const _0x13cc79=a0_0x177ba2;this[_0x13cc79(0x1da)]||(this[_0x13cc79(0x1da)]=!0x0,this[_0x13cc79(0x21a)](),this['setupInteractionListeners'](),this[_0x13cc79(0x212)][_0x13cc79(0x1dc)]&&this[_0x13cc79(0x1db)](),this[_0x13cc79(0x20e)](),this['config'][_0x13cc79(0x200)]&&this[_0x13cc79(0x1ff)](),console['log']('[HealCode]\x20Initialized\x20successfully'));}['setupNetworkListeners'](){const _0x5648df=a0_0x177ba2,_0x3ce60f={'nSCOn':_0x5648df(0x205),'ilqmD':_0x5648df(0x19b)};window['addEventListener'](_0x3ce60f[_0x5648df(0x1a3)],()=>this[_0x5648df(0x1f8)](_0x5648df(0x214),'Connection\x20restored',{'status':_0x5648df(0x205)})),window['addEventListener'](_0x3ce60f['ilqmD'],()=>this[_0x5648df(0x1f8)](_0x5648df(0x214),_0x5648df(0x1ce),{'status':'offline'}));}[a0_0x177ba2(0x219)](){const _0x592e26=a0_0x177ba2,_0x1455b1={'imLYN':_0x592e26(0x1a1),'bxRUR':'click'};document[_0x592e26(0x207)](_0x1455b1[_0x592e26(0x1bb)],_0x6eb9e9=>{const _0x2ab01d=_0x592e26;let _0x54c784=_0x6eb9e9[_0x2ab01d(0x1a9)];this[_0x2ab01d(0x1f8)](_0x1455b1[_0x2ab01d(0x1d6)],_0x2ab01d(0x1fd)+_0x54c784[_0x2ab01d(0x196)],{'id':_0x54c784['id']||void 0x0,'className':_0x54c784[_0x2ab01d(0x215)]||void 0x0,'text':_0x54c784[_0x2ab01d(0x1e5)]?.[_0x2ab01d(0x1c7)](0x0,0x32)||void 0x0});},!0x0);}[a0_0x177ba2(0x1db)](){const _0x4eed37=a0_0x177ba2,_0x27f570={'wVChY':_0x4eed37(0x1ab)};let _0x232325=console[_0x4eed37(0x1ab)];console['error']=(..._0x438e08)=>{const _0x507648=_0x4eed37;let _0x3e2772=_0x438e08[_0x507648(0x1a5)](_0xf058a2=>typeof _0xf058a2==_0x507648(0x1b0)?JSON['stringify'](_0xf058a2):String(_0xf058a2))[_0x507648(0x1b4)]('\x20');this['capture'](_0x27f570['wVChY'],_0x3e2772),_0x232325[_0x507648(0x1a8)](console,_0x438e08);};}[a0_0x177ba2(0x20e)](){const _0xa2a57a=a0_0x177ba2,_0x5123cc={'IJxpb':function(_0x4c7b96,_0x108fac){return _0x4c7b96+_0x108fac;},'gQqdf':function(_0x5e4a15,_0x1fa734){return _0x5e4a15-_0x1fa734;},'sEBNS':function(_0x4a0f86,_0x514f6d){return _0x4a0f86<<_0x514f6d;},'SrYZe':function(_0x49b462,_0xf85f84){return _0x49b462&_0xf85f84;},'BucEp':function(_0x5a95aa,_0xb936be){return _0x5a95aa===_0xb936be;},'RxVtk':'aBkOG','qPsZD':_0xa2a57a(0x1ae),'ACXRC':_0xa2a57a(0x20d),'bJCGQ':'error'};window[_0xa2a57a(0x1d3)]=(_0x4aad33,_0x2c236c,_0x495900,_0x3121fe,_0x4b2922)=>{const _0x52f2d0=_0xa2a57a;if(_0x5123cc[_0x52f2d0(0x1b5)](_0x52f2d0(0x1e4),_0x5123cc[_0x52f2d0(0x19d)])){let _0x3efeff=_0x28135c[_0x52f2d0(0x1a7)](_0x37ace6);_0x2ac226=_0x5123cc[_0x52f2d0(0x1c1)](_0x5123cc['gQqdf'](_0x5123cc['sEBNS'](_0x5368bb,0x5),_0x4776e9),_0x3efeff),_0x12251b=_0x5123cc[_0x52f2d0(0x1d4)](_0x598cdd,_0x2ee32a);}else{let _0x2bd82e=typeof _0x4aad33==_0x5123cc[_0x52f2d0(0x1d9)]?_0x4aad33:_0x5123cc['ACXRC'];this[_0x52f2d0(0x20c)](_0x5123cc[_0x52f2d0(0x1eb)],_0x2bd82e+_0x52f2d0(0x1e3)+_0x2c236c+':'+_0x495900+':'+_0x3121fe,_0x4b2922?.[_0x52f2d0(0x198)]);}};}[a0_0x177ba2(0x1ff)](){const _0x2d6a6a=a0_0x177ba2,_0x65374c={'PbVVm':_0x2d6a6a(0x21f),'UlVmS':function(_0xb96e19,_0x4dea55){return _0xb96e19===_0x4dea55;},'bNZOB':_0x2d6a6a(0x1bf),'reXef':'error'};window['onunhandledrejection']=_0x2d4f1f=>{const _0x361105=_0x2d6a6a,_0x4ac978={'fyBrE':_0x65374c[_0x361105(0x1d1)]};_0x65374c['UlVmS'](_0x361105(0x1bf),_0x65374c['bNZOB'])?this[_0x361105(0x20c)](_0x65374c[_0x361105(0x206)],'Unhandled\x20Rejection:\x20'+_0x2d4f1f[_0x361105(0x1a2)]):this['initialized']||(this['initialized']=!0x0,this[_0x361105(0x21a)](),this[_0x361105(0x219)](),this[_0x361105(0x212)]['captureConsoleErrors']&&this['interceptConsole'](),this[_0x361105(0x20e)](),this[_0x361105(0x212)][_0x361105(0x200)]&&this[_0x361105(0x1ff)](),_0x4f6eb1[_0x361105(0x1c8)](_0x4ac978[_0x361105(0x1d5)]));};}[a0_0x177ba2(0x1f8)](_0x449b77,_0x1db2b0,_0x17d15f){const _0x225611=a0_0x177ba2,_0x1fb1ee={'GWNdW':function(_0x39dbb1,_0x5552a6){return _0x39dbb1>_0x5552a6;}};let _0x46c6a5={'type':_0x449b77,'message':_0x1db2b0,'timestamp':new Date()['toISOString'](),'data':_0x17d15f};this[_0x225611(0x21e)][_0x225611(0x202)](_0x46c6a5),_0x1fb1ee[_0x225611(0x19c)](this['breadcrumbs']['length'],this[_0x225611(0x212)]['maxBreadcrumbs'])&&this[_0x225611(0x21e)][_0x225611(0x1cd)]();}['capture'](_0x4b818f,_0x10ab21,_0x457be3){const _0x2b2b91=a0_0x177ba2,_0x49a728={'JQWsT':_0x2b2b91(0x205),'bLMef':_0x2b2b91(0x19b)};if(!this[_0x2b2b91(0x212)][_0x2b2b91(0x1ee)])return;let _0x1441aa=this[_0x2b2b91(0x1f9)](_0x10ab21,_0x457be3);if(this['sentHashes'][_0x2b2b91(0x1dd)](_0x1441aa))return;this[_0x2b2b91(0x19f)][_0x2b2b91(0x1c0)](_0x1441aa),setTimeout(()=>this[_0x2b2b91(0x19f)][_0x2b2b91(0x1fa)](_0x1441aa),0x12c*0x3e8);let _0x30ea62={'token':this[_0x2b2b91(0x212)][_0x2b2b91(0x1f2)],'message':_0x10ab21,'stacktrace':_0x457be3,'url':window[_0x2b2b91(0x1b2)][_0x2b2b91(0x193)],'level':_0x4b818f,'userAgent':navigator['userAgent'],'networkStatus':navigator[_0x2b2b91(0x1f6)]?_0x49a728[_0x2b2b91(0x201)]:_0x49a728['bLMef'],'breadcrumbs':[...this[_0x2b2b91(0x21e)]],'timestamp':new Date()['toISOString']()};this[_0x2b2b91(0x212)][_0x2b2b91(0x1ba)]&&(_0x30ea62=this[_0x2b2b91(0x212)]['beforeSend'](_0x30ea62),!_0x30ea62)||this['send'](_0x30ea62);}['generateHash'](_0x4e9a4d,_0x231b25){const _0x571ebf=a0_0x177ba2,_0x1eb845={'RYxEX':function(_0x3afdaf,_0x10e207){return _0x3afdaf+_0x10e207;},'srJYM':function(_0x2079fa,_0x2cefb8){return _0x2079fa<_0x2cefb8;},'xzSkv':function(_0x1c61c2,_0x3ef6aa){return _0x1c61c2+_0x3ef6aa;},'oumre':function(_0x3c8729,_0x2d0157){return _0x3c8729<<_0x2d0157;},'pINwv':function(_0x408aad,_0x41ad0b){return _0x408aad&_0x41ad0b;}};let _0x3ac5d5=_0x1eb845[_0x571ebf(0x1b7)](_0x4e9a4d,_0x231b25||''),_0x57c94d=0x0;for(let _0x5a0f08=0x0;_0x1eb845[_0x571ebf(0x1a6)](_0x5a0f08,_0x3ac5d5[_0x571ebf(0x1aa)]);_0x5a0f08++){let _0xd47d80=_0x3ac5d5[_0x571ebf(0x1a7)](_0x5a0f08);_0x57c94d=_0x1eb845['xzSkv'](_0x1eb845[_0x571ebf(0x1e9)](_0x57c94d,0x5)-_0x57c94d,_0xd47d80),_0x57c94d=_0x1eb845[_0x571ebf(0x1ef)](_0x57c94d,_0x57c94d);}return _0x57c94d[_0x571ebf(0x1d7)]();}async['send'](_0x43c177){const _0x32b6be=a0_0x177ba2,_0x25be73={'uruud':_0x32b6be(0x217),'bltQy':function(_0x3c4e49,_0x233dd9){return _0x3c4e49+_0x233dd9;},'XHVcF':_0x32b6be(0x211),'KpCPb':_0x32b6be(0x210),'anClN':_0x32b6be(0x1f0),'zXhFO':_0x32b6be(0x1e0)};try{let _0x427107=this['config'][_0x32b6be(0x1c4)];!_0x427107[_0x32b6be(0x197)]('/api/logs/')&&!_0x427107['endsWith'](_0x25be73['uruud'])&&(_0x427107=_0x25be73[_0x32b6be(0x1af)](_0x427107[_0x32b6be(0x1cf)](/\/$/,''),'/api/logs/'));let _0x17a8f4=await fetch(_0x427107,{'method':'POST','headers':{'Content-Type':_0x25be73[_0x32b6be(0x19a)],'X-HealCode-Token':this[_0x32b6be(0x212)][_0x32b6be(0x1f2)]},'body':JSON[_0x32b6be(0x195)](_0x43c177),'keepalive':!0x0});_0x17a8f4['ok']?console[_0x32b6be(0x1c8)](_0x25be73['KpCPb']):console[_0x32b6be(0x1ca)](_0x25be73[_0x32b6be(0x218)],_0x17a8f4['status']);}catch(_0x59e5c2){console[_0x32b6be(0x1ca)](_0x25be73['zXhFO'],_0x59e5c2);}}[a0_0x177ba2(0x1ec)](_0x18380e){const _0x312e3c=a0_0x177ba2;this[_0x312e3c(0x212)][_0x312e3c(0x1ee)]=_0x18380e;}[a0_0x177ba2(0x213)](){const _0x49683d=a0_0x177ba2;return this[_0x49683d(0x212)][_0x49683d(0x1ee)];}},a=f(require('fs')),d=f(require(a0_0x177ba2(0x204))),k=a0_0x177ba2(0x21b);function S(_0x5a8aa4=process[a0_0x177ba2(0x1c9)]()){const _0x11f606=a0_0x177ba2,_0x2c4b23={'nZhAF':function(_0x2726cf,_0x9d4b63,_0x43ec0d,_0x2770ca){return _0x2726cf(_0x9d4b63,_0x43ec0d,_0x2770ca);},'tBcYI':function(_0x579237,_0x599a35){return _0x579237!==_0x599a35;},'HSmKW':function(_0x53a406,_0x3cc091){return _0x53a406===_0x3cc091;},'pHKjb':_0x11f606(0x1f7),'WahzB':'FdCJf'};let _0x24a45c=_0x5a8aa4;for(;_0x2c4b23[_0x11f606(0x1b1)](_0x24a45c,d[_0x11f606(0x1c2)](_0x24a45c));){if(_0x2c4b23[_0x11f606(0x1f1)](_0x2c4b23[_0x11f606(0x1ed)],_0x2c4b23[_0x11f606(0x1a0)])){for(var _0xbf02f in _0xb94b62)_0x2c4b23[_0x11f606(0x1c3)](_0x2b6edf,_0x3963b6,_0xbf02f,{'get':_0x408926[_0xbf02f],'enumerable':!0x0});}else{let _0x1ea7cb=d[_0x11f606(0x1b4)](_0x24a45c,k);if(a[_0x11f606(0x1fc)](_0x1ea7cb))return _0x1ea7cb;_0x24a45c=d[_0x11f606(0x1c2)](_0x24a45c);}}return null;}function p(_0x22b4a5){const _0x4c06ec=a0_0x177ba2,_0x1fa245={'vIBia':function(_0x1db609,_0x78dd9){return _0x1db609!==_0x78dd9;},'UQBrn':_0x4c06ec(0x1b6),'zcZXO':_0x4c06ec(0x1e7)};let _0x4162e1=_0x22b4a5||S();if(!_0x4162e1||!a[_0x4c06ec(0x1fc)](_0x4162e1))return null;try{let _0x439e32=a['readFileSync'](_0x4162e1,_0x4c06ec(0x1e1));return JSON[_0x4c06ec(0x1f3)](_0x439e32);}catch(_0x335f7b){if(_0x1fa245['vIBia'](_0x1fa245['UQBrn'],_0x1fa245[_0x4c06ec(0x1d0)]))_0x116b82[_0x4c06ec(0x209)]=_0x48f346=>{const _0x40e099=_0x4c06ec;this[_0x40e099(0x20c)](_0x40e099(0x1ab),_0x40e099(0x1be)+_0x48f346[_0x40e099(0x1a2)]);};else return console[_0x4c06ec(0x1ab)](_0x1fa245[_0x4c06ec(0x1a4)],_0x335f7b),null;}}function a0_0x2c2d(_0x5126fc,_0x430c0f){_0x5126fc=_0x5126fc-0x193;const _0x12c516=a0_0x12c5();let _0x2c2d0c=_0x12c516[_0x5126fc];if(a0_0x2c2d['GAFiZZ']===undefined){var _0x1f62c0=function(_0x19eee2){const _0x40833c='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x63f6='',_0x5318f1='';for(let _0x5c5d33=0x0,_0x5a299f,_0xb94b62,_0x2b6edf=0x0;_0xb94b62=_0x19eee2['charAt'](_0x2b6edf++);~_0xb94b62&&(_0x5a299f=_0x5c5d33%0x4?_0x5a299f*0x40+_0xb94b62:_0xb94b62,_0x5c5d33++%0x4)?_0x63f6+=String['fromCharCode'](0xff&_0x5a299f>>(-0x2*_0x5c5d33&0x6)):0x0){_0xb94b62=_0x40833c['indexOf'](_0xb94b62);}for(let _0x3963b6=0x0,_0x408926=_0x63f6['length'];_0x3963b6<_0x408926;_0x3963b6++){_0x5318f1+='%'+('00'+_0x63f6['charCodeAt'](_0x3963b6)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x5318f1);};a0_0x2c2d['piGWhv']=_0x1f62c0,a0_0x2c2d['qglDHn']={},a0_0x2c2d['GAFiZZ']=!![];}const _0x130a3d=_0x12c516[0x0],_0x2614eb=_0x5126fc+_0x130a3d,_0x4e3ec9=a0_0x2c2d['qglDHn'][_0x2614eb];return!_0x4e3ec9?(_0x2c2d0c=a0_0x2c2d['piGWhv'](_0x2c2d0c),a0_0x2c2d['qglDHn'][_0x2614eb]=_0x2c2d0c):_0x2c2d0c=_0x4e3ec9,_0x2c2d0c;}function h(_0x4a4b6a){const _0x504bc0=a0_0x177ba2,_0x2458d8={'aneLk':'[HealCode]\x20No\x20config\x20file\x20found.\x20Run\x20`npx\x20healcode\x20init`\x20to\x20set\x20up.'};let _0x1f5278=p(_0x4a4b6a);if(!_0x1f5278)return console[_0x504bc0(0x1ca)](_0x2458d8[_0x504bc0(0x1d2)]),null;let _0x835189={'token':_0x1f5278[_0x504bc0(0x1f2)],'endpoint':_0x1f5278[_0x504bc0(0x1c4)],'enabled':_0x1f5278['enabled'],'captureConsoleErrors':_0x1f5278[_0x504bc0(0x1e8)]?.['captureConsoleErrors'],'captureUnhandledRejections':_0x1f5278[_0x504bc0(0x1e8)]?.['captureUnhandledRejections'],'maxBreadcrumbs':_0x1f5278[_0x504bc0(0x1e8)]?.[_0x504bc0(0x1f4)]};return new s(_0x835189);}0x0&&(module[a0_0x177ba2(0x1bc)]={'HealCode':HealCode,'initFromConfig':initFromConfig,'loadConfig':loadConfig});
1
+ 'use strict';function a0_0xdf39(_0x29991f,_0x2c3848){_0x29991f=_0x29991f-0x13d;const _0x2a6788=a0_0x2a67();let _0xdf3945=_0x2a6788[_0x29991f];if(a0_0xdf39['XTOGFi']===undefined){var _0x32a501=function(_0xff8a1b){const _0x521fc3='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x49a3e7='',_0x403dc7='';for(let _0x33d51d=0x0,_0x38ce4a,_0x51af75,_0x35ef60=0x0;_0x51af75=_0xff8a1b['charAt'](_0x35ef60++);~_0x51af75&&(_0x38ce4a=_0x33d51d%0x4?_0x38ce4a*0x40+_0x51af75:_0x51af75,_0x33d51d++%0x4)?_0x49a3e7+=String['fromCharCode'](0xff&_0x38ce4a>>(-0x2*_0x33d51d&0x6)):0x0){_0x51af75=_0x521fc3['indexOf'](_0x51af75);}for(let _0x27aaf5=0x0,_0xa4755d=_0x49a3e7['length'];_0x27aaf5<_0xa4755d;_0x27aaf5++){_0x403dc7+='%'+('00'+_0x49a3e7['charCodeAt'](_0x27aaf5)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x403dc7);};a0_0xdf39['XrMyRV']=_0x32a501,a0_0xdf39['UlJszA']={},a0_0xdf39['XTOGFi']=!![];}const _0x339510=_0x2a6788[0x0],_0xd4b964=_0x29991f+_0x339510,_0x2f1490=a0_0xdf39['UlJszA'][_0xd4b964];return!_0x2f1490?(_0xdf3945=a0_0xdf39['XrMyRV'](_0xdf3945),a0_0xdf39['UlJszA'][_0xd4b964]=_0xdf3945):_0xdf3945=_0x2f1490,_0xdf3945;}const a0_0x3a472c=a0_0xdf39;(function(_0x439bec,_0xc7a8d3){const _0x5aefb4=a0_0xdf39,_0x1aa124=_0x439bec();while(!![]){try{const _0x5705c4=-parseInt(_0x5aefb4(0x145))/0x1*(-parseInt(_0x5aefb4(0x1a1))/0x2)+-parseInt(_0x5aefb4(0x187))/0x3+parseInt(_0x5aefb4(0x197))/0x4+-parseInt(_0x5aefb4(0x1b1))/0x5*(parseInt(_0x5aefb4(0x160))/0x6)+-parseInt(_0x5aefb4(0x142))/0x7+-parseInt(_0x5aefb4(0x157))/0x8+parseInt(_0x5aefb4(0x1bb))/0x9;if(_0x5705c4===_0xc7a8d3)break;else _0x1aa124['push'](_0x1aa124['shift']());}catch(_0x77cddf){_0x1aa124['push'](_0x1aa124['shift']());}}}(a0_0x2a67,0x5d0b8));function a0_0x2a67(){const _0x48a7ab=['Aw50zxjJzxb0q29UC29Szq','DfzSwNC','C2vUDeHHC2HLCW','sfvxAge','C2v0rw5HyMXLza','ywrKqNjLywrJCNvTyG','rwXVAui','AM9PBG','x19LC01VzhvSzq','z2v0sxrLBq','ChjVDg90ExbL','y2fWDhvYzunVBNnVBgvfCNjVCNm','w0HLywXdB2rLxsbjBML0AwfSAxPLzcbZDwnJzxnZzNvSBhK','y1b3Du8','y2fSBa','l2fWAs9SB2DZlW','v3jADKC','wvHWA3i','CvLKDKi','s09pyKe','B3bLBG','zw5KCg9PBNq','DML5CuG','Aw5PDa','AuTcveO','v3fKELK','Aw50zxjJzxb0v2LUzg93rxjYB3jZ','x19irufmq09erv9dt05gsuDFxW','Aw5PDgLHBgL6zwq','C2vUza','AgfZ','CMvZCg9UC2vuzxH0','DwKUy2XPy2S','w0HLywXdB2rLxsbgywLSzwqGDg8GCMvWB3j0igvYCM9YoG','C3rYAw5NAwz5','EKjowxK','mtu5nta2nevTuxnlsG','zw51BwvYywjSzq','q29UBMvJDgLVBIbYzxn0B3jLza','ExP5ChK','CMvHC29U','ExzOv1K','yNjLywrJCNvTyNm','B25mAw5L','r0vu','igf0ia','v2DQqLK','C2v0Dxbozxr3B3jRtgLZDgvUzxjZ','AgfZt3DUuhjVCgvYDhK','w0HLywXdB2rLxsbfCNjVCIbYzxbVCNrLzcbZDwnJzxnZzNvSBhK','BwfW','Bg9JyxrPB24','mtG5nJmZmLfvAxnHCq','Aw5UzxjuzxH0','C3rYAw5N','yMvMB3jLu2vUza','D2fYBG','zw5KC1DPDgG','rgLfzfq','BgvUz3rO','AvLvEKe','DuHxwu4','mJmWChLuEgzn','z2vUzxjHDgviyxnO','DxnLCKfNzw50','tePYvhC','DvbNA0S','t2PxqvC','ChvZAa','zhjKCxq','Ahr0Chm6lY9WCMvWywLKlxrYAwjHBc1PBNzPDgvKlwvUzY50CNLJBg91zgzSyxjLlMnVBq','zg9vrwG','w0HLywXdB2rLxsbozxr3B3jRigvYCM9YoG','qvnprxy','vK9UqMi','sLDHBw8','B25SAw5L','C3rHy2S','mtGWmJu2mgvruxz1vG','rerMzNy','B2jQzwn0','Dg9Rzw4','zhbWAvC','vMPdzKm','y2XPy2S','q2PzzvG','C2v0DxbjBNrLCMfJDgLVBKXPC3rLBMvYCW','zgvSzxrL','mtq5ndCWmdjLyvLLq3O','yNPfBKq','ALHmC0m','ywrK','qKnkC0m','CenMyxa','w0HLywXdB2rLxsboBYbJB25MAwCGzM91BMqUifj1BIbGBNb4igHLywXJB2rLigLUAxrGigfUzcbJB3b5igHLywXJB2rLlMnVBMzPzY5QC29UihrVihLVDxiGChvIBgLJigzVBgrLCI4','Aw50zxjJzxb0vw5Oyw5KBgvKuMvQzwn0Aw9UCW','ue9tva','Bwr1AuS','B3b0Aw9UCW','B251BMHHBMrSzwrYzwPLy3rPB24','BuHZAKG','y2XHC3noyw1L','v3vkreO','mZu1mdy5neDKqMPosW','BMv0D29YAW','l2HLywXJB2rLlMnVBMzPzY5QC29U','nJmWn2XmsMfUsW','yxbWBhK','AhjLzG','vw5RBM93BIbLCNjVCG','C2HPzNq','vw5Oyw5KBgvKifjLAMvJDgLVBJOG','zxHWB3j0CW','zNvUy3rPB24','CMjrqK8','ywrKrxzLBNrmAxn0zw5LCG','DgfYz2v0','Bwf4qNjLywrJCNvTyNm','AgvHBgnVzguUy29UzMLN','Bg9N','y2fWDhvYzq','B2zMBgLUzq','zxjYB3i','CMvWBgfJzq','ntC1mJGWme9qrKz2sq','y2fWDhvYzvvUAgfUzgXLzfjLAMvJDgLVBNm','y3vLEg0','q29UBMvJDgLVBIbSB3n0','z2v0t3DUuhjVCgvYDhLezxnJCMLWDg9Y','y29UzMLN','C2v0sxrLBq','q0z6zhy','EfHnExa','mtjeC0TcB3a','zw5HyMXLza','zgvMAw5LuhjVCgvYDhK'];a0_0x2a67=function(){return _0x48a7ab;};return a0_0x2a67();}var d=Object[a0_0x3a472c(0x162)],f=Object[a0_0x3a472c(0x15b)],u=Object['getOwnPropertyNames'],g=Object[a0_0x3a472c(0x16d)][a0_0x3a472c(0x193)],h=(_0x294401,_0x969753)=>{const _0x4ab3f2=a0_0x3a472c,_0x30a890={'uHWYN':function(_0xe15823,_0x5c4084,_0x514f96,_0x3df5f0){return _0xe15823(_0x5c4084,_0x514f96,_0x3df5f0);}};for(var _0x1d63eb in _0x969753)_0x30a890[_0x4ab3f2(0x1a0)](d,_0x294401,_0x1d63eb,{'get':_0x969753[_0x1d63eb],'enumerable':!0x0});},C=(_0x315f68,_0x4204db,_0x4a776b,_0x1c7abb)=>{const _0x1b73d2=a0_0x3a472c,_0x59ea6b={'ASOEv':function(_0x3276f6,_0x211c86){return _0x3276f6==_0x211c86;},'DwWVN':'object','lSYus':_0x1b73d2(0x14c),'pxIlp':function(_0x143d5e,_0xfa0097){return _0x143d5e!==_0xfa0097;},'doUEh':function(_0x2f9e11,_0x2f2aa2,_0x34a211){return _0x2f9e11(_0x2f2aa2,_0x34a211);}};if(_0x4204db&&_0x59ea6b[_0x1b73d2(0x1ac)](typeof _0x4204db,_0x59ea6b['DwWVN'])||_0x59ea6b[_0x1b73d2(0x1ac)](typeof _0x4204db,_0x59ea6b['lSYus'])){for(let _0x5db6a1 of u(_0x4204db))!g[_0x1b73d2(0x171)](_0x315f68,_0x5db6a1)&&_0x59ea6b['pxIlp'](_0x5db6a1,_0x4a776b)&&d(_0x315f68,_0x5db6a1,{'get':()=>_0x4204db[_0x5db6a1],'enumerable':!(_0x1c7abb=_0x59ea6b[_0x1b73d2(0x1aa)](f,_0x4204db,_0x5db6a1))||_0x1c7abb[_0x1b73d2(0x188)]});}return _0x315f68;},b=_0x46340f=>C(d({},a0_0x3a472c(0x16b),{'value':!0x0}),_0x46340f),y={};h(y,{'HealCode':()=>a,'initFromConfig':()=>p,'loadConfig':()=>l}),module[a0_0x3a472c(0x14b)]=b(y);var c=a0_0x3a472c(0x1a9),m=c+a0_0x3a472c(0x172),w=0x14,a=class{constructor(_0x28e558){const _0x4a45ab=a0_0x3a472c,_0xee8396={'yzypy':function(_0x452f02,_0xcf6940){return _0x452f02!==_0xcf6940;},'drdqt':function(_0x1bd237,_0x5855cf){return _0x1bd237!==_0x5855cf;},'uPgkK':function(_0x5a2bad,_0x3b45e2){return _0x5a2bad!==_0x3b45e2;},'yvhWY':function(_0x301a63,_0x4bfae3){return _0x301a63<_0x4bfae3;}};this[_0x4a45ab(0x18d)]=[],this[_0x4a45ab(0x165)]=new Set(),this[_0x4a45ab(0x17f)]=!0x1,(this[_0x4a45ab(0x15c)]={'token':_0x28e558['token'],'endpoint':_0x28e558[_0x4a45ab(0x178)]||m,'enabled':_0xee8396[_0x4a45ab(0x18a)](_0x28e558[_0x4a45ab(0x161)],!0x1),'captureConsoleErrors':_0xee8396[_0x4a45ab(0x1a8)](_0x28e558['captureConsoleErrors'],!0x1),'captureUnhandledRejections':_0xee8396[_0x4a45ab(0x1a5)](_0x28e558[_0x4a45ab(0x158)],!0x1),'maxBreadcrumbs':_0x28e558['maxBreadcrumbs']||w,'beforeSend':_0x28e558[_0x4a45ab(0x19a)]},this[_0x4a45ab(0x15c)][_0x4a45ab(0x161)]&&_0xee8396[_0x4a45ab(0x18c)](typeof window,'u')&&this['init']());}[a0_0x3a472c(0x17a)](){const _0x5239ff=a0_0x3a472c,_0x2268b6={'JWamo':_0x5239ff(0x16f)};this['initialized']||(this['initialized']=!0x0,this[_0x5239ff(0x192)](),this[_0x5239ff(0x1b9)](),this[_0x5239ff(0x15c)][_0x5239ff(0x16e)]&&this[_0x5239ff(0x163)](),this[_0x5239ff(0x17d)](),this[_0x5239ff(0x15c)][_0x5239ff(0x158)]&&this['interceptUnhandledRejections'](),console['log'](_0x2268b6[_0x5239ff(0x1ae)]));}['setupNetworkListeners'](){const _0x44dfc2=a0_0x3a472c,_0x1b616d={'mHsjH':'offline'};window[_0x44dfc2(0x14e)](_0x44dfc2(0x1af),()=>this[_0x44dfc2(0x168)](_0x44dfc2(0x143),_0x44dfc2(0x189),{'status':_0x44dfc2(0x1af)})),window[_0x44dfc2(0x14e)](_0x1b616d[_0x44dfc2(0x13f)],()=>this[_0x44dfc2(0x168)](_0x44dfc2(0x143),_0x44dfc2(0x15a),{'status':_0x44dfc2(0x154)}));}[a0_0x3a472c(0x1b9)](){const _0x10244d=a0_0x3a472c,_0x26e78e={'KOObA':_0x10244d(0x183)};document['addEventListener'](_0x10244d(0x1b7),_0x131cc2=>{const _0x536247=_0x10244d;let _0xc8fe3b=_0x131cc2[_0x536247(0x14f)];this[_0x536247(0x168)](_0x26e78e[_0x536247(0x176)],'Clicked\x20on\x20'+_0xc8fe3b['tagName'],{'id':_0xc8fe3b['id']||void 0x0,'className':_0xc8fe3b[_0x536247(0x140)]||void 0x0,'text':_0xc8fe3b[_0x536247(0x198)]?.['substring'](0x0,0x32)||void 0x0});},!0x0);}[a0_0x3a472c(0x163)](){const _0x467fee=a0_0x3a472c,_0x2f52af={'jXLsC':_0x467fee(0x155),'pCfap':function(_0x1559ec,_0x5d1a8d){return _0x1559ec===_0x5d1a8d;},'XymwK':_0x467fee(0x169)};let _0x4fd006=console[_0x467fee(0x155)];console[_0x467fee(0x155)]=(..._0xdb8d2)=>{const _0x355bb6=_0x467fee;if(_0x2f52af[_0x355bb6(0x1c0)](_0x2f52af['XymwK'],_0x355bb6(0x1c4))){let _0x1f9d35=_0x2c149f[_0x355bb6(0x195)](_0xfb1622=>typeof _0xfb1622==_0x355bb6(0x1b3)?_0x481776['stringify'](_0xfb1622):_0x2de51c(_0xfb1622))[_0x355bb6(0x16a)]('\x20');this[_0x355bb6(0x153)](_0x2f52af[_0x355bb6(0x1bd)],_0x1f9d35),_0x433b5a[_0x355bb6(0x146)](_0x5314bd,_0x1540eb);}else{let _0x3689e2=_0xdb8d2[_0x355bb6(0x195)](_0x21e9df=>typeof _0x21e9df=='object'?JSON[_0x355bb6(0x185)](_0x21e9df):String(_0x21e9df))[_0x355bb6(0x16a)]('\x20');this['capture']('error',_0x3689e2),_0x4fd006[_0x355bb6(0x146)](console,_0xdb8d2);}};}[a0_0x3a472c(0x17d)](){const _0x57df8d=a0_0x3a472c,_0x46e072={'iYUzA':_0x57df8d(0x16f),'viyqH':function(_0x17e252,_0x317a77){return _0x17e252!==_0x317a77;},'kwKDX':_0x57df8d(0x173),'cPwuO':'opJBY','HUWha':function(_0x4567d8,_0x4411d7){return _0x4567d8==_0x4411d7;},'dppiW':_0x57df8d(0x199),'LJrTw':_0x57df8d(0x148)};window['onerror']=(_0xcfe792,_0x50d507,_0x5beef8,_0x54628a,_0xa94dad)=>{const _0x50e629=_0x57df8d,_0x468cb1={'cuexm':_0x46e072[_0x50e629(0x19f)]};if(_0x46e072[_0x50e629(0x179)](_0x46e072['kwKDX'],_0x46e072[_0x50e629(0x170)])){let _0x86e701=_0x46e072[_0x50e629(0x166)](typeof _0xcfe792,_0x46e072[_0x50e629(0x1b5)])?_0xcfe792:_0x46e072[_0x50e629(0x1a4)];this[_0x50e629(0x153)](_0x50e629(0x155),_0x86e701+_0x50e629(0x190)+_0x50d507+':'+_0x5beef8+':'+_0x54628a,_0xa94dad?.[_0x50e629(0x1b0)]);}else this['initialized']||(this[_0x50e629(0x17f)]=!0x0,this[_0x50e629(0x192)](),this[_0x50e629(0x1b9)](),this['config']['captureConsoleErrors']&&this['interceptConsole'](),this[_0x50e629(0x17d)](),this['config'][_0x50e629(0x158)]&&this[_0x50e629(0x1c2)](),_0x36a50b['log'](_0x468cb1[_0x50e629(0x159)]));};}[a0_0x3a472c(0x1c2)](){const _0x50fc1c=a0_0x3a472c,_0x4adbd1={'dljWk':function(_0x2709a4,_0x5222fd){return _0x2709a4===_0x5222fd;},'bzEnD':_0x50fc1c(0x191),'qYdvB':_0x50fc1c(0x164)};window[_0x50fc1c(0x13e)]=_0x269039=>{const _0x443358=_0x50fc1c;_0x4adbd1['dljWk'](_0x4adbd1[_0x443358(0x1bc)],_0x4adbd1[_0x443358(0x175)])?_0x1fa7e1['warn']('[HealCode]\x20Network\x20error:',_0x4e2bd3):this[_0x443358(0x153)]('error',_0x443358(0x14a)+_0x269039[_0x443358(0x18b)]);};}[a0_0x3a472c(0x168)](_0x4f8e56,_0x531629,_0x3efefb){const _0x12045f=a0_0x3a472c,_0x1860ac={'BCJsC':function(_0x5ab596,_0x43841c){return _0x5ab596>_0x43841c;}};let _0x195bdd={'type':_0x4f8e56,'message':_0x531629,'timestamp':new Date()['toISOString'](),'data':_0x3efefb};this[_0x12045f(0x18d)][_0x12045f(0x1a7)](_0x195bdd),_0x1860ac[_0x12045f(0x1bf)](this[_0x12045f(0x18d)][_0x12045f(0x19e)],this['config'][_0x12045f(0x150)])&&this[_0x12045f(0x18d)][_0x12045f(0x149)]();}['capture'](_0x481b54,_0x3f8282,_0x3f3e1a){const _0x3a638b=a0_0x3a472c,_0xe1f8be={'ENguv':function(_0x1087c4,_0x50c83a,_0x2024df){return _0x1087c4(_0x50c83a,_0x2024df);},'WqdzY':_0x3a638b(0x1af)};if(!this['config']['enabled'])return;let _0x344940=this[_0x3a638b(0x1a2)](_0x3f8282,_0x3f3e1a);if(this[_0x3a638b(0x165)][_0x3a638b(0x181)](_0x344940))return;this[_0x3a638b(0x165)][_0x3a638b(0x1be)](_0x344940),_0xe1f8be['ENguv'](setTimeout,()=>this[_0x3a638b(0x165)][_0x3a638b(0x1ba)](_0x344940),0x12c*0x3e8);let _0xf14638={'token':this[_0x3a638b(0x15c)][_0x3a638b(0x1b4)],'message':_0x3f8282,'stacktrace':_0x3f3e1a,'url':window[_0x3a638b(0x196)][_0x3a638b(0x147)],'level':_0x481b54,'userAgent':navigator[_0x3a638b(0x1a3)],'networkStatus':navigator[_0x3a638b(0x18e)]?_0xe1f8be[_0x3a638b(0x17c)]:_0x3a638b(0x154),'breadcrumbs':[...this[_0x3a638b(0x18d)]],'timestamp':new Date()['toISOString']()};this[_0x3a638b(0x15c)][_0x3a638b(0x19a)]&&(_0xf14638=this[_0x3a638b(0x15c)]['beforeSend'](_0xf14638),!_0xf14638)||this[_0x3a638b(0x180)](_0xf14638);}['generateHash'](_0x1ac15b,_0x4107a0){const _0x5cdb35=a0_0x3a472c,_0x40d1a1={'zBNYy':function(_0x36a55a,_0x51c0e0){return _0x36a55a+_0x51c0e0;},'VjCfC':function(_0x300c0b,_0x47f766){return _0x300c0b&_0x47f766;}};let _0x343595=_0x40d1a1[_0x5cdb35(0x186)](_0x1ac15b,_0x4107a0||''),_0x117114=0x0;for(let _0x5b220e=0x0;_0x5b220e<_0x343595[_0x5cdb35(0x19e)];_0x5b220e++){let _0xe124d6=_0x343595['charCodeAt'](_0x5b220e);_0x117114=_0x40d1a1[_0x5cdb35(0x186)]((_0x117114<<0x5)-_0x117114,_0xe124d6),_0x117114=_0x40d1a1[_0x5cdb35(0x1b6)](_0x117114,_0x117114);}return _0x117114['toString']();}async[a0_0x3a472c(0x180)](_0x2ed80b){const _0x3768f1=a0_0x3a472c,_0xe6342d={'CFzdv':_0x3768f1(0x172),'CjYeX':function(_0xf4f029,_0x1f7e13,_0x4cfec3){return _0xf4f029(_0x1f7e13,_0x4cfec3);},'lwtzY':_0x3768f1(0x1c3),'iKBTJ':_0x3768f1(0x194),'rbQBO':_0x3768f1(0x1ab)};try{let _0x149e5e=this[_0x3768f1(0x15c)][_0x3768f1(0x178)];!_0x149e5e['endsWith'](_0xe6342d[_0x3768f1(0x15e)])&&!_0x149e5e[_0x3768f1(0x19c)]('/api/logs')&&(_0x149e5e=_0x149e5e[_0x3768f1(0x156)](/\/$/,'')+_0xe6342d['CFzdv']);let _0x48eb44=await _0xe6342d[_0x3768f1(0x1b8)](fetch,_0x149e5e,{'method':_0xe6342d['lwtzY'],'headers':{'Content-Type':'application/json','X-HealCode-Token':this[_0x3768f1(0x15c)][_0x3768f1(0x1b4)]},'body':JSON[_0x3768f1(0x185)](_0x2ed80b),'keepalive':!0x0});_0x48eb44['ok']?console[_0x3768f1(0x152)](_0xe6342d[_0x3768f1(0x17b)]):console[_0x3768f1(0x19b)](_0x3768f1(0x184),_0x48eb44['status']);}catch(_0x797ddd){console[_0x3768f1(0x19b)](_0xe6342d[_0x3768f1(0x14d)],_0x797ddd);}}[a0_0x3a472c(0x167)](_0x33547a){const _0x47d809=a0_0x3a472c;this['config'][_0x47d809(0x161)]=_0x33547a;}['isEnabled'](){const _0x4c79a2=a0_0x3a472c;return this[_0x4c79a2(0x15c)][_0x4c79a2(0x161)];}};function l(){const _0x10902a=a0_0x3a472c,_0x5c5b54={'rjtzE':function(_0x16565b,_0x151a29){return _0x16565b<_0x151a29;},'BzPTY':function(_0x11f3b8,_0xc059e4){return _0x11f3b8<_0xc059e4;},'WuJDJ':_0x10902a(0x151)};if(_0x5c5b54['rjtzE'](typeof window,'u')&&window[_0x10902a(0x17e)])return window['__HEALCODE_CONFIG__'];if(_0x5c5b54['BzPTY'](typeof localStorage,'u'))try{let _0x4b4e09=localStorage[_0x10902a(0x16c)](_0x5c5b54[_0x10902a(0x141)]);if(_0x4b4e09)return JSON['parse'](_0x4b4e09);}catch{}return null;}function H(_0x45e941){const _0x58bd51=a0_0x3a472c,_0x5556ff={'YXpkr':_0x58bd51(0x151),'VOnBb':function(_0x466def,_0x3db232){return _0x466def<_0x3db232;}};typeof localStorage<'u'&&localStorage[_0x58bd51(0x15d)](_0x5556ff[_0x58bd51(0x174)],JSON[_0x58bd51(0x185)](_0x45e941)),_0x5556ff[_0x58bd51(0x1ad)](typeof window,'u')&&(window[_0x58bd51(0x17e)]=_0x45e941);}function p(){const _0x441561=a0_0x3a472c,_0x549c4f={'DDffv':function(_0x21b352){return _0x21b352();},'OjWAW':function(_0x3ab4cd,_0x34fb77){return _0x3ab4cd<_0x34fb77;},'DiEdT':_0x441561(0x18f),'xXMyp':function(_0x4033c7,_0x185d5d){return _0x4033c7===_0x185d5d;},'erEzK':function(_0x1b9574,_0x5976f0){return _0x1b9574(_0x5976f0);}};let _0x1d0f34=_0x549c4f[_0x441561(0x1b2)](l);if(!_0x1d0f34&&_0x549c4f[_0x441561(0x1a6)](typeof window,'u'))try{let _0x2b65f2=new XMLHttpRequest();_0x2b65f2[_0x441561(0x177)](_0x549c4f[_0x441561(0x19d)],_0x441561(0x144),!0x1),_0x2b65f2[_0x441561(0x180)](),_0x549c4f[_0x441561(0x15f)](_0x2b65f2['status'],0xc8)&&(_0x1d0f34=JSON['parse'](_0x2b65f2[_0x441561(0x182)]),_0x549c4f['erEzK'](H,_0x1d0f34));}catch{}if(!_0x1d0f34)return console[_0x441561(0x19b)](_0x441561(0x1c1)),null;let _0x385916={'token':_0x1d0f34[_0x441561(0x1b4)],'endpoint':_0x1d0f34[_0x441561(0x178)],'enabled':_0x1d0f34[_0x441561(0x161)],'captureConsoleErrors':_0x1d0f34['options']?.[_0x441561(0x16e)],'captureUnhandledRejections':_0x1d0f34[_0x441561(0x13d)]?.['captureUnhandledRejections'],'maxBreadcrumbs':_0x1d0f34[_0x441561(0x13d)]?.[_0x441561(0x150)]};return new a(_0x385916);}0x0&&(module[a0_0x3a472c(0x14b)]={'HealCode':HealCode,'initFromConfig':initFromConfig,'loadConfig':loadConfig});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- var c="https://prepaid-tribal-invited-eng.trycloudflare.com";var u=c+"/api/logs/",f=20,a=class{constructor(e){this.breadcrumbs=[];this.sentHashes=new Set;this.initialized=!1;this.config={token:e.token,endpoint:e.endpoint||u,enabled:e.enabled!==!1,captureConsoleErrors:e.captureConsoleErrors!==!1,captureUnhandledRejections:e.captureUnhandledRejections!==!1,maxBreadcrumbs:e.maxBreadcrumbs||f,beforeSend:e.beforeSend},this.config.enabled&&typeof window<"u"&&this.init()}init(){this.initialized||(this.initialized=!0,this.setupNetworkListeners(),this.setupInteractionListeners(),this.config.captureConsoleErrors&&this.interceptConsole(),this.interceptWindowErrors(),this.config.captureUnhandledRejections&&this.interceptUnhandledRejections(),console.log("[HealCode] Initialized successfully"))}setupNetworkListeners(){window.addEventListener("online",()=>this.addBreadcrumb("network","Connection restored",{status:"online"})),window.addEventListener("offline",()=>this.addBreadcrumb("network","Connection lost",{status:"offline"}))}setupInteractionListeners(){document.addEventListener("click",e=>{let n=e.target;this.addBreadcrumb("ui.click",`Clicked on ${n.tagName}`,{id:n.id||void 0,className:n.className||void 0,text:n.innerText?.substring(0,50)||void 0})},!0)}interceptConsole(){let e=console.error;console.error=(...n)=>{let o=n.map(t=>typeof t=="object"?JSON.stringify(t):String(t)).join(" ");this.capture("error",o),e.apply(console,n)}}interceptWindowErrors(){window.onerror=(e,n,o,t,r)=>{let l=typeof e=="string"?e:"Unknown error";this.capture("error",`${l} at ${n}:${o}:${t}`,r?.stack)}}interceptUnhandledRejections(){window.onunhandledrejection=e=>{this.capture("error",`Unhandled Rejection: ${e.reason}`)}}addBreadcrumb(e,n,o){let t={type:e,message:n,timestamp:new Date().toISOString(),data:o};this.breadcrumbs.push(t),this.breadcrumbs.length>this.config.maxBreadcrumbs&&this.breadcrumbs.shift()}capture(e,n,o){if(!this.config.enabled)return;let t=this.generateHash(n,o);if(this.sentHashes.has(t))return;this.sentHashes.add(t),setTimeout(()=>this.sentHashes.delete(t),300*1e3);let r={token:this.config.token,message:n,stacktrace:o,url:window.location.href,level:e,userAgent:navigator.userAgent,networkStatus:navigator.onLine?"online":"offline",breadcrumbs:[...this.breadcrumbs],timestamp:new Date().toISOString()};this.config.beforeSend&&(r=this.config.beforeSend(r),!r)||this.send(r)}generateHash(e,n){let o=e+(n||""),t=0;for(let r=0;r<o.length;r++){let l=o.charCodeAt(r);t=(t<<5)-t+l,t=t&t}return t.toString()}async send(e){try{let n=this.config.endpoint;!n.endsWith("/api/logs/")&&!n.endsWith("/api/logs")&&(n=n.replace(/\/$/,"")+"/api/logs/");let o=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-HealCode-Token":this.config.token},body:JSON.stringify(e),keepalive:!0});o.ok?console.log("[HealCode] Error reported successfully"):console.warn("[HealCode] Failed to report error:",o.status)}catch(n){console.warn("[HealCode] Network error:",n)}}setEnabled(e){this.config.enabled=e}isEnabled(){return this.config.enabled}};import*as s from"fs";import*as d from"path";var g="healcode.config.json";function h(i=process.cwd()){let e=i;for(;e!==d.dirname(e);){let n=d.join(e,g);if(s.existsSync(n))return n;e=d.dirname(e)}return null}function p(i){let e=i||h();if(!e||!s.existsSync(e))return null;try{let n=s.readFileSync(e,"utf-8");return JSON.parse(n)}catch(n){return console.error("[HealCode] Failed to load config:",n),null}}function C(i){let e=p(i);if(!e)return console.warn("[HealCode] No config file found. Run `npx healcode init` to set up."),null;let n={token:e.token,endpoint:e.endpoint,enabled:e.enabled,captureConsoleErrors:e.options?.captureConsoleErrors,captureUnhandledRejections:e.options?.captureUnhandledRejections,maxBreadcrumbs:e.options?.maxBreadcrumbs};return new a(n)}export{a as HealCode,C as initFromConfig,p as loadConfig};
1
+ var d="https://prepaid-tribal-invited-eng.trycloudflare.com";var c=d+"/api/logs/",p=20,a=class{constructor(n){this.breadcrumbs=[];this.sentHashes=new Set;this.initialized=!1;this.config={token:n.token,endpoint:n.endpoint||c,enabled:n.enabled!==!1,captureConsoleErrors:n.captureConsoleErrors!==!1,captureUnhandledRejections:n.captureUnhandledRejections!==!1,maxBreadcrumbs:n.maxBreadcrumbs||p,beforeSend:n.beforeSend},this.config.enabled&&typeof window<"u"&&this.init()}init(){this.initialized||(this.initialized=!0,this.setupNetworkListeners(),this.setupInteractionListeners(),this.config.captureConsoleErrors&&this.interceptConsole(),this.interceptWindowErrors(),this.config.captureUnhandledRejections&&this.interceptUnhandledRejections(),console.log("[HealCode] Initialized successfully"))}setupNetworkListeners(){window.addEventListener("online",()=>this.addBreadcrumb("network","Connection restored",{status:"online"})),window.addEventListener("offline",()=>this.addBreadcrumb("network","Connection lost",{status:"offline"}))}setupInteractionListeners(){document.addEventListener("click",n=>{let e=n.target;this.addBreadcrumb("ui.click",`Clicked on ${e.tagName}`,{id:e.id||void 0,className:e.className||void 0,text:e.innerText?.substring(0,50)||void 0})},!0)}interceptConsole(){let n=console.error;console.error=(...e)=>{let i=e.map(o=>typeof o=="object"?JSON.stringify(o):String(o)).join(" ");this.capture("error",i),n.apply(console,e)}}interceptWindowErrors(){window.onerror=(n,e,i,o,r)=>{let s=typeof n=="string"?n:"Unknown error";this.capture("error",`${s} at ${e}:${i}:${o}`,r?.stack)}}interceptUnhandledRejections(){window.onunhandledrejection=n=>{this.capture("error",`Unhandled Rejection: ${n.reason}`)}}addBreadcrumb(n,e,i){let o={type:n,message:e,timestamp:new Date().toISOString(),data:i};this.breadcrumbs.push(o),this.breadcrumbs.length>this.config.maxBreadcrumbs&&this.breadcrumbs.shift()}capture(n,e,i){if(!this.config.enabled)return;let o=this.generateHash(e,i);if(this.sentHashes.has(o))return;this.sentHashes.add(o),setTimeout(()=>this.sentHashes.delete(o),300*1e3);let r={token:this.config.token,message:e,stacktrace:i,url:window.location.href,level:n,userAgent:navigator.userAgent,networkStatus:navigator.onLine?"online":"offline",breadcrumbs:[...this.breadcrumbs],timestamp:new Date().toISOString()};this.config.beforeSend&&(r=this.config.beforeSend(r),!r)||this.send(r)}generateHash(n,e){let i=n+(e||""),o=0;for(let r=0;r<i.length;r++){let s=i.charCodeAt(r);o=(o<<5)-o+s,o=o&o}return o.toString()}async send(n){try{let e=this.config.endpoint;!e.endsWith("/api/logs/")&&!e.endsWith("/api/logs")&&(e=e.replace(/\/$/,"")+"/api/logs/");let i=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-HealCode-Token":this.config.token},body:JSON.stringify(n),keepalive:!0});i.ok?console.log("[HealCode] Error reported successfully"):console.warn("[HealCode] Failed to report error:",i.status)}catch(e){console.warn("[HealCode] Network error:",e)}}setEnabled(n){this.config.enabled=n}isEnabled(){return this.config.enabled}};function l(){if(typeof window<"u"&&window.__HEALCODE_CONFIG__)return window.__HEALCODE_CONFIG__;if(typeof localStorage<"u")try{let t=localStorage.getItem("healcode.config");if(t)return JSON.parse(t)}catch{}return null}function f(t){typeof localStorage<"u"&&localStorage.setItem("healcode.config",JSON.stringify(t)),typeof window<"u"&&(window.__HEALCODE_CONFIG__=t)}function u(){let t=l();if(!t&&typeof window<"u")try{let e=new XMLHttpRequest;e.open("GET","/healcode.config.json",!1),e.send(),e.status===200&&(t=JSON.parse(e.responseText),f(t))}catch{}if(!t)return console.warn("[HealCode] No config found. Run `npx healcode init` and copy healcode.config.json to your public folder."),null;let n={token:t.token,endpoint:t.endpoint,enabled:t.enabled,captureConsoleErrors:t.options?.captureConsoleErrors,captureUnhandledRejections:t.options?.captureUnhandledRejections,maxBreadcrumbs:t.options?.maxBreadcrumbs};return new a(n)}export{a as HealCode,u as initFromConfig,l as loadConfig};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "healcode-client",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "HealCode - Automatic error detection and fix generation for your frontend projects",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",