healcode-client 1.0.6 → 1.0.7
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 +139 -184
- package/dist/index.d.mts +4 -8
- package/dist/index.d.ts +4 -8
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/bin/healcode.js
CHANGED
|
@@ -10,6 +10,8 @@ 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
|
+
|
|
13
15
|
// Load URLs from config
|
|
14
16
|
let urlsConfig = { backendUrl: 'https://www.healdcode.somee.com', agentUrl: 'https://www.healdcode.somee.com' };
|
|
15
17
|
try {
|
|
@@ -31,165 +33,97 @@ program
|
|
|
31
33
|
.description('HealCode CLI - Automatic error detection and fix generation')
|
|
32
34
|
.version('1.0.0');
|
|
33
35
|
|
|
34
|
-
// Detect project type
|
|
35
|
-
function
|
|
36
|
+
// Detect project type and find public folder
|
|
37
|
+
function findPublicFolder() {
|
|
36
38
|
const cwd = process.cwd();
|
|
37
39
|
|
|
38
|
-
//
|
|
40
|
+
// Angular: src/ folder (assets get copied to dist)
|
|
39
41
|
if (fs.existsSync(path.join(cwd, 'angular.json'))) {
|
|
40
|
-
|
|
42
|
+
const publicPath = path.join(cwd, 'public');
|
|
43
|
+
if (fs.existsSync(publicPath)) return publicPath;
|
|
44
|
+
// Fallback to src for older Angular
|
|
45
|
+
return path.join(cwd, 'src');
|
|
41
46
|
}
|
|
42
47
|
|
|
43
|
-
//
|
|
44
|
-
const
|
|
45
|
-
if (fs.existsSync(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return 'vue';
|
|
52
|
-
}
|
|
53
|
-
if (pkg.dependencies?.next || pkg.devDependencies?.next) {
|
|
54
|
-
return 'nextjs';
|
|
55
|
-
}
|
|
48
|
+
// React/Vue: public/ folder
|
|
49
|
+
const publicPath = path.join(cwd, 'public');
|
|
50
|
+
if (fs.existsSync(publicPath)) return publicPath;
|
|
51
|
+
|
|
52
|
+
// Vite: public/ or root
|
|
53
|
+
if (fs.existsSync(path.join(cwd, 'vite.config.js')) || fs.existsSync(path.join(cwd, 'vite.config.ts'))) {
|
|
54
|
+
if (fs.existsSync(publicPath)) return publicPath;
|
|
55
|
+
return cwd;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
// Generic: try public, then root
|
|
59
|
+
if (fs.existsSync(publicPath)) return publicPath;
|
|
60
|
+
|
|
61
|
+
return cwd;
|
|
59
62
|
}
|
|
60
63
|
|
|
61
|
-
// Find
|
|
62
|
-
function
|
|
64
|
+
// Find main entry file
|
|
65
|
+
function findMainFile() {
|
|
63
66
|
const cwd = process.cwd();
|
|
64
67
|
const possiblePaths = [
|
|
65
|
-
path.join(cwd, 'src', '
|
|
66
|
-
path.join(cwd, '
|
|
67
|
-
path.join(cwd, 'index.
|
|
68
|
+
path.join(cwd, 'src', 'main.ts'), // Angular/Vue
|
|
69
|
+
path.join(cwd, 'src', 'main.js'),
|
|
70
|
+
path.join(cwd, 'src', 'index.tsx'), // React
|
|
71
|
+
path.join(cwd, 'src', 'index.ts'),
|
|
72
|
+
path.join(cwd, 'src', 'index.js'),
|
|
73
|
+
path.join(cwd, 'src', 'App.tsx'),
|
|
74
|
+
path.join(cwd, 'src', 'App.ts'),
|
|
75
|
+
path.join(cwd, 'src', 'App.js'),
|
|
76
|
+
path.join(cwd, 'index.js'),
|
|
77
|
+
path.join(cwd, 'index.ts'),
|
|
68
78
|
];
|
|
69
79
|
|
|
70
80
|
for (const p of possiblePaths) {
|
|
71
|
-
if (fs.existsSync(p))
|
|
72
|
-
return p;
|
|
73
|
-
}
|
|
81
|
+
if (fs.existsSync(p)) return p;
|
|
74
82
|
}
|
|
75
83
|
return null;
|
|
76
84
|
}
|
|
77
85
|
|
|
78
|
-
//
|
|
79
|
-
function
|
|
80
|
-
|
|
81
|
-
<!-- HealCode Error Tracking -->
|
|
82
|
-
<script>
|
|
83
|
-
(function(){
|
|
84
|
-
var config = ${JSON.stringify(config)};
|
|
85
|
-
if (!config.enabled) return;
|
|
86
|
+
// Inject import into main file
|
|
87
|
+
function injectImport(mainPath) {
|
|
88
|
+
let content = fs.readFileSync(mainPath, 'utf-8');
|
|
86
89
|
|
|
87
|
-
|
|
88
|
-
if (
|
|
89
|
-
|
|
90
|
+
// Check if already imported
|
|
91
|
+
if (content.includes('healcode-client')) {
|
|
92
|
+
return { success: false, reason: 'already_imported' };
|
|
90
93
|
}
|
|
91
94
|
|
|
92
|
-
|
|
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
|
-
}
|
|
95
|
+
const importStatement = "import { initFromConfig } from 'healcode-client';\ninitFromConfig();\n";
|
|
104
96
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
97
|
+
// Add import at the top (after other imports if possible)
|
|
98
|
+
const lines = content.split('\n');
|
|
99
|
+
let lastImportIndex = -1;
|
|
109
100
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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(){});
|
|
101
|
+
for (let i = 0; i < lines.length; i++) {
|
|
102
|
+
if (lines[i].trim().startsWith('import ')) {
|
|
103
|
+
lastImportIndex = i;
|
|
104
|
+
}
|
|
134
105
|
}
|
|
135
106
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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
|
-
};
|
|
107
|
+
if (lastImportIndex >= 0) {
|
|
108
|
+
lines.splice(lastImportIndex + 1, 0, '', importStatement);
|
|
109
|
+
} else {
|
|
110
|
+
lines.unshift(importStatement);
|
|
154
111
|
}
|
|
155
112
|
|
|
156
|
-
|
|
157
|
-
|
|
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>`;
|
|
113
|
+
fs.writeFileSync(mainPath, lines.join('\n'));
|
|
114
|
+
return { success: true };
|
|
168
115
|
}
|
|
169
116
|
|
|
170
|
-
//
|
|
171
|
-
function
|
|
172
|
-
let
|
|
173
|
-
|
|
174
|
-
// Check if already injected
|
|
175
|
-
if (html.includes('HealCode Error Tracking')) {
|
|
176
|
-
return { success: false, reason: 'already_injected' };
|
|
177
|
-
}
|
|
117
|
+
// Remove import from main file
|
|
118
|
+
function removeImport(mainPath) {
|
|
119
|
+
let content = fs.readFileSync(mainPath, 'utf-8');
|
|
178
120
|
|
|
179
|
-
|
|
121
|
+
// Remove healcode import and init
|
|
122
|
+
content = content.replace(/import\s*{\s*initFromConfig\s*}\s*from\s*['"]healcode-client['"];\s*/g, '');
|
|
123
|
+
content = content.replace(/initFromConfig\(\);\s*/g, '');
|
|
124
|
+
content = content.replace(/\n\n\n+/g, '\n\n'); // Clean up extra newlines
|
|
180
125
|
|
|
181
|
-
|
|
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 };
|
|
126
|
+
fs.writeFileSync(mainPath, content);
|
|
193
127
|
}
|
|
194
128
|
|
|
195
129
|
program
|
|
@@ -198,9 +132,6 @@ program
|
|
|
198
132
|
.action(async () => {
|
|
199
133
|
console.log(chalk.green.bold('\n🩺 HealCode Setup\n'));
|
|
200
134
|
|
|
201
|
-
const projectType = detectProjectType();
|
|
202
|
-
console.log(chalk.gray(` Detected: ${projectType} project\n`));
|
|
203
|
-
|
|
204
135
|
const { token } = await inquirer.prompt([
|
|
205
136
|
{
|
|
206
137
|
type: 'input',
|
|
@@ -221,8 +152,6 @@ program
|
|
|
221
152
|
// Validate token with API
|
|
222
153
|
console.log(chalk.yellow('\n⏳ Validating token...'));
|
|
223
154
|
|
|
224
|
-
let projectName = 'Unknown';
|
|
225
|
-
|
|
226
155
|
try {
|
|
227
156
|
const response = await fetch(`${BACKEND_URL}/api/tokens/validate`, {
|
|
228
157
|
method: 'POST',
|
|
@@ -239,8 +168,7 @@ program
|
|
|
239
168
|
}
|
|
240
169
|
|
|
241
170
|
console.log(chalk.green('✅ Token validated successfully!'));
|
|
242
|
-
|
|
243
|
-
console.log(chalk.gray(` Project: ${projectName}`));
|
|
171
|
+
console.log(chalk.gray(` Project: ${result.projectId}`));
|
|
244
172
|
|
|
245
173
|
} catch (error) {
|
|
246
174
|
console.log(chalk.red('\n❌ Could not validate token. Check your internet connection.'));
|
|
@@ -259,68 +187,61 @@ program
|
|
|
259
187
|
},
|
|
260
188
|
};
|
|
261
189
|
|
|
262
|
-
//
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
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'));
|
|
190
|
+
// Save config to public folder
|
|
191
|
+
const publicFolder = findPublicFolder();
|
|
192
|
+
const configPath = path.join(publicFolder, CONFIG_FILE_NAME);
|
|
193
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
194
|
+
console.log(chalk.green(`\n✅ Config saved to ${path.relative(process.cwd(), configPath)}`));
|
|
195
|
+
|
|
196
|
+
// Inject import into main file
|
|
197
|
+
const mainPath = findMainFile();
|
|
198
|
+
if (mainPath) {
|
|
199
|
+
const result = injectImport(mainPath);
|
|
200
|
+
if (result.success) {
|
|
201
|
+
console.log(chalk.green(`✅ Import added to ${path.relative(process.cwd(), mainPath)}`));
|
|
202
|
+
} else if (result.reason === 'already_imported') {
|
|
203
|
+
console.log(chalk.gray(` Import already exists in ${path.relative(process.cwd(), mainPath)}`));
|
|
280
204
|
}
|
|
281
|
-
|
|
205
|
+
} else {
|
|
206
|
+
console.log(chalk.yellow('\n⚠️ Could not find main entry file.'));
|
|
207
|
+
console.log(chalk.gray(' Add this to your main file manually:'));
|
|
208
|
+
console.log(chalk.cyan(" import { initFromConfig } from 'healcode-client';"));
|
|
209
|
+
console.log(chalk.cyan(' initFromConfig();'));
|
|
282
210
|
}
|
|
283
211
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
// Add to .gitignore (the config is now embedded, but keep this for reference)
|
|
212
|
+
// Add config to .gitignore
|
|
287
213
|
const gitignorePath = path.join(process.cwd(), '.gitignore');
|
|
288
214
|
if (fs.existsSync(gitignorePath)) {
|
|
289
215
|
const gitignore = fs.readFileSync(gitignorePath, 'utf-8');
|
|
290
|
-
if (!gitignore.includes(
|
|
291
|
-
fs.appendFileSync(gitignorePath,
|
|
216
|
+
if (!gitignore.includes(CONFIG_FILE_NAME)) {
|
|
217
|
+
fs.appendFileSync(gitignorePath, `\n# HealCode\n${CONFIG_FILE_NAME}\n`);
|
|
218
|
+
console.log(chalk.gray(` Added ${CONFIG_FILE_NAME} to .gitignore`));
|
|
292
219
|
}
|
|
293
220
|
}
|
|
294
221
|
|
|
295
222
|
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'));
|
|
298
223
|
});
|
|
299
224
|
|
|
300
225
|
program
|
|
301
226
|
.command('remove')
|
|
302
227
|
.description('Remove HealCode from your project')
|
|
303
228
|
.action(() => {
|
|
304
|
-
|
|
229
|
+
// Remove config file
|
|
230
|
+
const publicFolder = findPublicFolder();
|
|
231
|
+
const configPath = path.join(publicFolder, CONFIG_FILE_NAME);
|
|
305
232
|
|
|
306
|
-
if (
|
|
307
|
-
|
|
308
|
-
|
|
233
|
+
if (fs.existsSync(configPath)) {
|
|
234
|
+
fs.unlinkSync(configPath);
|
|
235
|
+
console.log(chalk.green(`\n✅ Removed ${path.relative(process.cwd(), configPath)}`));
|
|
309
236
|
}
|
|
310
237
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
if (!regex.test(html)) {
|
|
317
|
-
console.log(chalk.yellow('\n⚠️ HealCode is not installed in this project.\n'));
|
|
318
|
-
return;
|
|
238
|
+
// Remove import from main file
|
|
239
|
+
const mainPath = findMainFile();
|
|
240
|
+
if (mainPath && fs.readFileSync(mainPath, 'utf-8').includes('healcode-client')) {
|
|
241
|
+
removeImport(mainPath);
|
|
242
|
+
console.log(chalk.green(`✅ Removed import from ${path.relative(process.cwd(), mainPath)}`));
|
|
319
243
|
}
|
|
320
244
|
|
|
321
|
-
html = html.replace(regex, '');
|
|
322
|
-
fs.writeFileSync(indexPath, html);
|
|
323
|
-
|
|
324
245
|
console.log(chalk.green('\n✅ HealCode removed successfully.\n'));
|
|
325
246
|
});
|
|
326
247
|
|
|
@@ -328,22 +249,56 @@ program
|
|
|
328
249
|
.command('status')
|
|
329
250
|
.description('Check HealCode installation status')
|
|
330
251
|
.action(() => {
|
|
331
|
-
const
|
|
252
|
+
const publicFolder = findPublicFolder();
|
|
253
|
+
const configPath = path.join(publicFolder, CONFIG_FILE_NAME);
|
|
332
254
|
|
|
333
|
-
if (
|
|
334
|
-
|
|
255
|
+
if (fs.existsSync(configPath)) {
|
|
256
|
+
const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
257
|
+
console.log(chalk.green.bold('\n🩺 HealCode Status: Installed ✅\n'));
|
|
258
|
+
console.log(chalk.white(` Token: ${config.token.substring(0, 15)}...`));
|
|
259
|
+
console.log(chalk.white(` Enabled: ${config.enabled !== false ? '✅' : '❌'}`));
|
|
260
|
+
console.log(chalk.gray(` Config: ${path.relative(process.cwd(), configPath)}\n`));
|
|
261
|
+
} else {
|
|
262
|
+
console.log(chalk.yellow('\n⚠️ HealCode is not installed.'));
|
|
263
|
+
console.log(chalk.gray(' Run `npx healcode init` to set up.\n'));
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
program
|
|
268
|
+
.command('disable')
|
|
269
|
+
.description('Disable HealCode error tracking')
|
|
270
|
+
.action(() => {
|
|
271
|
+
const publicFolder = findPublicFolder();
|
|
272
|
+
const configPath = path.join(publicFolder, CONFIG_FILE_NAME);
|
|
273
|
+
|
|
274
|
+
if (!fs.existsSync(configPath)) {
|
|
275
|
+
console.log(chalk.yellow('\n⚠️ HealCode is not installed.\n'));
|
|
335
276
|
return;
|
|
336
277
|
}
|
|
337
278
|
|
|
338
|
-
const
|
|
279
|
+
const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
280
|
+
config.enabled = false;
|
|
281
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
282
|
+
console.log(chalk.yellow('\n⏸️ HealCode tracking disabled.\n'));
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
program
|
|
286
|
+
.command('enable')
|
|
287
|
+
.description('Enable HealCode error tracking')
|
|
288
|
+
.action(() => {
|
|
289
|
+
const publicFolder = findPublicFolder();
|
|
290
|
+
const configPath = path.join(publicFolder, CONFIG_FILE_NAME);
|
|
339
291
|
|
|
340
|
-
if (
|
|
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 {
|
|
292
|
+
if (!fs.existsSync(configPath)) {
|
|
344
293
|
console.log(chalk.yellow('\n⚠️ HealCode is not installed.'));
|
|
345
294
|
console.log(chalk.gray(' Run `npx healcode init` to set up.\n'));
|
|
295
|
+
return;
|
|
346
296
|
}
|
|
297
|
+
|
|
298
|
+
const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
299
|
+
config.enabled = true;
|
|
300
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
301
|
+
console.log(chalk.green('\n▶️ HealCode tracking enabled.\n'));
|
|
347
302
|
});
|
|
348
303
|
|
|
349
304
|
program.parse();
|
package/dist/index.d.mts
CHANGED
|
@@ -55,12 +55,8 @@ declare class HealCode {
|
|
|
55
55
|
isEnabled(): boolean;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
declare
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
declare function loadConfig(): HealCodeFileConfig | null;
|
|
64
|
-
declare function initFromConfig(): HealCode | null;
|
|
58
|
+
declare function loadConfigAsync(): Promise<HealCodeFileConfig | null>;
|
|
59
|
+
declare function initFromConfigAsync(): Promise<HealCode | null>;
|
|
60
|
+
declare function initFromConfig(): void;
|
|
65
61
|
|
|
66
|
-
export { HealCode, type HealCodeConfig, type HealCodeFileConfig, initFromConfig,
|
|
62
|
+
export { HealCode, type HealCodeConfig, type HealCodeFileConfig, initFromConfig, initFromConfigAsync, loadConfigAsync };
|
package/dist/index.d.ts
CHANGED
|
@@ -55,12 +55,8 @@ declare class HealCode {
|
|
|
55
55
|
isEnabled(): boolean;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
declare
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
declare function loadConfig(): HealCodeFileConfig | null;
|
|
64
|
-
declare function initFromConfig(): HealCode | null;
|
|
58
|
+
declare function loadConfigAsync(): Promise<HealCodeFileConfig | null>;
|
|
59
|
+
declare function initFromConfigAsync(): Promise<HealCode | null>;
|
|
60
|
+
declare function initFromConfig(): void;
|
|
65
61
|
|
|
66
|
-
export { HealCode, type HealCodeConfig, type HealCodeFileConfig, initFromConfig,
|
|
62
|
+
export { HealCode, type HealCodeConfig, type HealCodeFileConfig, initFromConfig, initFromConfigAsync, loadConfigAsync };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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});
|
|
1
|
+
'use strict';const a0_0x32ae5a=a0_0x4509;(function(_0x4ad1dd,_0x3a4c54){const _0x4db6ab=a0_0x4509,_0x5e0e37=_0x4ad1dd();while(!![]){try{const _0xcf97=parseInt(_0x4db6ab(0x17b))/0x1+-parseInt(_0x4db6ab(0x192))/0x2*(-parseInt(_0x4db6ab(0x17c))/0x3)+-parseInt(_0x4db6ab(0x136))/0x4+parseInt(_0x4db6ab(0x172))/0x5*(parseInt(_0x4db6ab(0x17f))/0x6)+parseInt(_0x4db6ab(0x132))/0x7+-parseInt(_0x4db6ab(0x13d))/0x8+parseInt(_0x4db6ab(0x18d))/0x9;if(_0xcf97===_0x3a4c54)break;else _0x5e0e37['push'](_0x5e0e37['shift']());}catch(_0x2e0d09){_0x5e0e37['push'](_0x5e0e37['shift']());}}}(a0_0x2c9e,0x3f015));var l=Object[a0_0x32ae5a(0x162)],h=Object[a0_0x32ae5a(0x193)],g=Object[a0_0x32ae5a(0x14c)],C=Object[a0_0x32ae5a(0x15d)][a0_0x32ae5a(0x146)],m=(_0x84db43,_0x29e9bb)=>{const _0x1ad7c6=a0_0x32ae5a,_0x5b6e54={'bRvGC':function(_0x420250,_0x258503,_0x3a45f0,_0x2678ea){return _0x420250(_0x258503,_0x3a45f0,_0x2678ea);}};for(var _0xc5b999 in _0x29e9bb)_0x5b6e54[_0x1ad7c6(0x153)](l,_0x84db43,_0xc5b999,{'get':_0x29e9bb[_0xc5b999],'enumerable':!0x0});},b=(_0x13e69a,_0x1338d0,_0x5e6d41,_0x2286c7)=>{const _0x1732f2=a0_0x32ae5a,_0x49607d={'QnbRf':function(_0x3bd3c7,_0x8c237a){return _0x3bd3c7==_0x8c237a;},'BKeIB':_0x1732f2(0x14b),'geLBc':'function','QglaK':function(_0x5f58b3,_0x35aa22){return _0x5f58b3(_0x35aa22);},'onXXR':function(_0x4be3fd,_0x591011){return _0x4be3fd!==_0x591011;},'lJpGT':function(_0x12efd9,_0x442361,_0x315047,_0x2cec75){return _0x12efd9(_0x442361,_0x315047,_0x2cec75);}};if(_0x1338d0&&_0x49607d[_0x1732f2(0x19d)](typeof _0x1338d0,_0x49607d[_0x1732f2(0x15c)])||typeof _0x1338d0==_0x49607d[_0x1732f2(0x176)]){for(let _0x1b168b of _0x49607d['QglaK'](g,_0x1338d0))!C[_0x1732f2(0x152)](_0x13e69a,_0x1b168b)&&_0x49607d[_0x1732f2(0x12b)](_0x1b168b,_0x5e6d41)&&_0x49607d[_0x1732f2(0x186)](l,_0x13e69a,_0x1b168b,{'get':()=>_0x1338d0[_0x1b168b],'enumerable':!(_0x2286c7=h(_0x1338d0,_0x1b168b))||_0x2286c7[_0x1732f2(0x147)]});}return _0x13e69a;},w=_0x1d361a=>b(l({},a0_0x32ae5a(0x157),{'value':!0x0}),_0x1d361a),v={};function a0_0x2c9e(){const _0x58d488=['C3rYAw5NAwz5','BePWr1q','Bg9N','zgvSzxrL','tKfuu2i','y2fWDhvYzunVBNnVBgvfCNjVCNm','tu5hA0e','r3LKsM0','mtqXmtq2mxPMzwfzqW','ywrKrxzLBNrmAxn0zw5LCG','B2zMBgLUzq','yMDHuxG','zw5HyMXLza','ntm1mde0yK1hA053','z2v0t3DUuhjVCgvYDhLezxnJCMLWDg9Y','y29UzMLN','C3rHy2S','C2v0rw5HyMXLza','Bwf4qNjLywrJCNvTyNm','C2v0DxbjBNrLCMfJDgLVBKXPC3rLBMvYCW','Aw50zxjJzxb0v2LUzg93rxjYB3jZ','qu50rhq','y2XPy2S','Aw50zxjJzxb0q29UC29Szq','uw5IuMy','Aw5PDgLHBgL6zwq','tMLYyKy','q29UBMvJDgLVBIbYzxn0B3jLza','zxjYB3i','l2fWAs9SB2DZlW','zxHWB3j0CW','DgfYz2v0','y2fWDhvYzvvUAgfUzgXLzfjLAMvJDgLVBNm','B25ywfi','BNjTBKu','q2XPy2TLzcbVBIa','y2fWDhvYzq','vw5RBM93BIbLCNjVCG','B25SAw5L','yNjLywrJCNvTyNm','mJi0mJGWmgj4DKvlza','ywrKqNjLywrJCNvTyG','ChvZAa','w0HLywXdB2rLxsbgywLSzwqGDg8GCMvWB3j0igvYCM9YoG','mtq5mJm5mNjiCvburG','Dg9ju09tDhjPBMC','vw5Oyw5KBgvKifjLAMvJDgLVBJOG','B251BMHHBMrSzwrYzwPLy3rPB24','ywrK','DgHLBG','C3rYAw5N','mJK4nZeZnLj3vw92AG','tKvAC3K','B3b0Aw9UCW','x19OzwfSy29Kzv9F','vKXdCKO','yw9lt3e','AM1iqMy','DwKUy2XPy2S','CMvWBgfJzq','AgfZt3DUuhjVCgvYDhK','zw51BwvYywjSzq','C3H5rhe','igf0ia','sMjuEgu','B2jQzwn0','z2v0t3DUuhjVCgvYDhLoyw1LCW','DgLiAfC','C2v0Dxbozxr3B3jRtgLZDgvUzxjZ','yxbWBhK','BhnNqMq','C2vUza','y2fSBa','yLj2r0m','BwfW','AgfZ','Ahr0Chm6lY9WCMvWywLKlxrYAwjHBc1PBNzPDgvKlwvUzY50CNLJBg91zgzSyxjLlMnVBq','x19LC01VzhvSzq','y2XHC3noyw1L','C2HPzNq','Dg9Rzw4','w0HLywXdB2rLxsbozxr3B3jRigvYCM9YoG','qKTLsui','ChjVDg90ExbL','uLnuBM8','w0HLywXdB2rLxsbgywLSzwqGDg8GAw5PDgLHBgL6zq','l2fWAs9SB2DZ','AhjLzG','zgvMAw5LuhjVCgvYDhK','ue9tva','q29UBMvJDgLVBIbSB3n0','z2vUzxjHDgviyxnO','EufPDfy','vhvrvwi','Aw5PDa','zw5KCg9PBNq','sNPszLi','q1Lbr3y','DxnLCKfNzw50','Dg9tDhjPBMC','Aw50zxjJzxb0vw5Oyw5KBgvKuMvQzwn0Aw9UCW','DffABMG','w0HLywXdB2rLxsbjBML0AwfSAxPLzcbZDwnJzxnZzNvSBhK','EwPVs0u','ntq4ntbWCK14uMq','Bg9JyxrPB24','Bg5Yzeq','DvzUwNy','z2vmqMm','w0HLywXdB2rLxsbfCNjVCIbYzxbVCNrLzcbZDwnJzxnZzNvSBhK','zw5KC1DPDgG','u2DjAvi','r3rMwM0','mti4mtGZAM5uC3ry','m1PyuNv1wq','D2fYBG','B01ds0S','nZjpzvH4twS','AM9PBG','yMvMB3jLu2vUza','AxnfBMfIBgvK','C2vUDeHHC2HLCW','tfbnqLu'];a0_0x2c9e=function(){return _0x58d488;};return a0_0x2c9e();}m(v,{'HealCode':()=>s,'initFromConfig':()=>f,'initFromConfigAsync':()=>u,'loadConfigAsync':()=>c}),module[a0_0x32ae5a(0x128)]=w(v);var p=a0_0x32ae5a(0x156),y=p+a0_0x32ae5a(0x127),H=0x14,s=class{constructor(_0x166ba0){const _0x14ad80=a0_0x32ae5a,_0x28d49a={'CbyWY':function(_0x1b75d6,_0x4b8dd8){return _0x1b75d6!==_0x4b8dd8;}};this[_0x14ad80(0x131)]=[],this[_0x14ad80(0x183)]=new Set(),this[_0x14ad80(0x19e)]=!0x1,(this[_0x14ad80(0x194)]={'token':_0x166ba0[_0x14ad80(0x15a)],'endpoint':_0x166ba0[_0x14ad80(0x169)]||y,'enabled':_0x28d49a['CbyWY'](_0x166ba0[_0x14ad80(0x191)],!0x1),'captureConsoleErrors':_0x166ba0['captureConsoleErrors']!==!0x1,'captureUnhandledRejections':_0x28d49a['CbyWY'](_0x166ba0['captureUnhandledRejections'],!0x1),'maxBreadcrumbs':_0x166ba0[_0x14ad80(0x197)]||H,'beforeSend':_0x166ba0[_0x14ad80(0x181)]},this[_0x14ad80(0x194)][_0x14ad80(0x191)]&&typeof window<'u'&&this['init']());}[a0_0x32ae5a(0x168)](){const _0x56c2a6=a0_0x32ae5a;this['initialized']||(this[_0x56c2a6(0x19e)]=!0x0,this[_0x56c2a6(0x14e)](),this[_0x56c2a6(0x198)](),this[_0x56c2a6(0x194)][_0x56c2a6(0x18a)]&&this['interceptConsole'](),this[_0x56c2a6(0x199)](),this[_0x56c2a6(0x194)][_0x56c2a6(0x12a)]&&this['interceptUnhandledRejections'](),console[_0x56c2a6(0x187)](_0x56c2a6(0x170)));}['setupNetworkListeners'](){const _0xfe73ef=a0_0x32ae5a,_0x55a4f2={'GydJm':'online','lnrdD':_0xfe73ef(0x18f)};window[_0xfe73ef(0x18e)](_0x55a4f2[_0xfe73ef(0x18c)],()=>this[_0xfe73ef(0x133)]('network','Connection\x20restored',{'status':_0xfe73ef(0x130)})),window['addEventListener'](_0x55a4f2[_0xfe73ef(0x174)],()=>this[_0xfe73ef(0x133)]('network',_0xfe73ef(0x164),{'status':_0xfe73ef(0x18f)}));}[a0_0x32ae5a(0x198)](){const _0x5276ff=a0_0x32ae5a,_0x5aa089={'MNGkA':function(_0xd3db7d,_0x58b0e1){return _0xd3db7d!==_0x58b0e1;},'JzRfR':_0x5276ff(0x14a),'GtfZm':_0x5276ff(0x144)};document[_0x5276ff(0x18e)](_0x5276ff(0x19b),_0x4a51b2=>{const _0x561c05=_0x5276ff;if(_0x5aa089[_0x561c05(0x18b)](_0x5aa089[_0x561c05(0x16a)],_0x561c05(0x14a)))_0x5234b5['addEventListener'](_0x561c05(0x130),()=>this[_0x561c05(0x133)]('network',_0x561c05(0x125),{'status':_0x561c05(0x130)})),_0x813e3b[_0x561c05(0x18e)](_0x561c05(0x18f),()=>this[_0x561c05(0x133)]('network',_0x561c05(0x164),{'status':_0x561c05(0x18f)}));else{let _0x48b1cd=_0x4a51b2[_0x561c05(0x129)];this[_0x561c05(0x133)](_0x5aa089[_0x561c05(0x17a)],_0x561c05(0x12d)+_0x48b1cd['tagName'],{'id':_0x48b1cd['id']||void 0x0,'className':_0x48b1cd[_0x561c05(0x158)]||void 0x0,'text':_0x48b1cd['innerText']?.['substring'](0x0,0x32)||void 0x0});}},!0x0);}[a0_0x32ae5a(0x19c)](){const _0x39263f=a0_0x32ae5a,_0x2e00e1={'tiHhW':'error'};let _0x1ecd91=console[_0x39263f(0x126)];console[_0x39263f(0x126)]=(..._0x317a24)=>{const _0x1dbdf3=_0x39263f;let _0x326c7e=_0x317a24[_0x1dbdf3(0x154)](_0x308d85=>typeof _0x308d85==_0x1dbdf3(0x14b)?JSON[_0x1dbdf3(0x185)](_0x308d85):String(_0x308d85))[_0x1dbdf3(0x180)]('\x20');this[_0x1dbdf3(0x12e)](_0x2e00e1[_0x1dbdf3(0x14d)],_0x326c7e),_0x1ecd91[_0x1dbdf3(0x14f)](console,_0x317a24);};}[a0_0x32ae5a(0x199)](){const _0x2079e8=a0_0x32ae5a,_0x4121e5={'uVnZv':function(_0x224194,_0xe29fdc){return _0x224194==_0xe29fdc;},'dtmOk':_0x2079e8(0x13c),'vMnQR':_0x2079e8(0x12f),'SgIiR':_0x2079e8(0x126)};window['onerror']=(_0x159590,_0x8ea311,_0x1f8c1c,_0x198025,_0x397112)=>{const _0x4633ab=_0x2079e8;let _0x39d3fc=_0x4121e5[_0x4633ab(0x175)](typeof _0x159590,_0x4121e5['dtmOk'])?_0x159590:_0x4121e5['vMnQR'];this[_0x4633ab(0x12e)](_0x4121e5[_0x4633ab(0x179)],_0x39d3fc+_0x4633ab(0x149)+_0x8ea311+':'+_0x1f8c1c+':'+_0x198025,_0x397112?.[_0x4633ab(0x195)]);};}[a0_0x32ae5a(0x16e)](){const _0x52bc93=a0_0x32ae5a,_0x53af86={'oMCKK':_0x52bc93(0x126)};window[_0x52bc93(0x139)]=_0x2bb9fd=>{const _0x2ebe2b=_0x52bc93;this['capture'](_0x53af86[_0x2ebe2b(0x17e)],_0x2ebe2b(0x138)+_0x2bb9fd['reason']);};}['addBreadcrumb'](_0x513a0a,_0x5bf7dc,_0x4e1117){const _0xca776=a0_0x32ae5a,_0x3acd87={'yKQEF':function(_0x43616d,_0x243880){return _0x43616d>_0x243880;}};let _0x2d594e={'type':_0x513a0a,'message':_0x5bf7dc,'timestamp':new Date()['toISOString'](),'data':_0x4e1117};this['breadcrumbs'][_0xca776(0x134)](_0x2d594e),_0x3acd87['yKQEF'](this[_0xca776(0x131)]['length'],this[_0xca776(0x194)][_0xca776(0x197)])&&this[_0xca776(0x131)][_0xca776(0x159)]();}[a0_0x32ae5a(0x12e)](_0x51124b,_0x1cdef8,_0x1696c4){const _0x30ead8=a0_0x32ae5a,_0x58ec5c={'yjoKE':function(_0xb9d2f5,_0xf40fa0,_0x51502d){return _0xb9d2f5(_0xf40fa0,_0x51502d);},'bgaQx':function(_0x382738,_0x506635){return _0x382738*_0x506635;},'jmHBf':_0x30ead8(0x18f)};if(!this['config']['enabled'])return;let _0x353dad=this['generateHash'](_0x1cdef8,_0x1696c4);if(this[_0x30ead8(0x183)][_0x30ead8(0x155)](_0x353dad))return;this['sentHashes'][_0x30ead8(0x13a)](_0x353dad),_0x58ec5c[_0x30ead8(0x171)](setTimeout,()=>this[_0x30ead8(0x183)][_0x30ead8(0x188)](_0x353dad),_0x58ec5c[_0x30ead8(0x190)](0x12c,0x3e8));let _0x497192={'token':this[_0x30ead8(0x194)][_0x30ead8(0x15a)],'message':_0x1cdef8,'stacktrace':_0x1696c4,'url':window[_0x30ead8(0x173)][_0x30ead8(0x161)],'level':_0x51124b,'userAgent':navigator[_0x30ead8(0x16c)],'networkStatus':navigator['onLine']?_0x30ead8(0x130):_0x58ec5c[_0x30ead8(0x143)],'breadcrumbs':[...this[_0x30ead8(0x131)]],'timestamp':new Date()[_0x30ead8(0x137)]()};this[_0x30ead8(0x194)][_0x30ead8(0x181)]&&(_0x497192=this['config'][_0x30ead8(0x181)](_0x497192),!_0x497192)||this[_0x30ead8(0x151)](_0x497192);}[a0_0x32ae5a(0x165)](_0x25433e,_0x484490){const _0x24f279=a0_0x32ae5a,_0x4f4d71={'LPMBU':function(_0x1ef7a3,_0x54b512){return _0x1ef7a3+_0x54b512;},'fQZuv':function(_0x43780c,_0xaf597){return _0x43780c||_0xaf597;},'jzYsD':function(_0x435122,_0x152e66){return _0x435122<_0x152e66;},'CYAGv':function(_0x217da7,_0x22e4ba){return _0x217da7-_0x22e4ba;},'RvoYp':function(_0x7ffecc,_0x36182f){return _0x7ffecc&_0x36182f;}};let _0x2c82df=_0x4f4d71[_0x24f279(0x184)](_0x25433e,_0x4f4d71['fQZuv'](_0x484490,'')),_0x555884=0x0;for(let _0x47644a=0x0;_0x4f4d71['jzYsD'](_0x47644a,_0x2c82df['length']);_0x47644a++){if('ZWhRN'!=='ZWhRN')_0x4dfd34&&(_0x23ebf6[_0x24f279(0x140)]=_0x475529);else{let _0x368024=_0x2c82df['charCodeAt'](_0x47644a);_0x555884=_0x4f4d71[_0x24f279(0x184)](_0x4f4d71[_0x24f279(0x16b)](_0x555884<<0x5,_0x555884),_0x368024),_0x555884=_0x4f4d71['RvoYp'](_0x555884,_0x555884);}}return _0x555884[_0x24f279(0x16d)]();}async['send'](_0x48525f){const _0x3022c5=a0_0x32ae5a,_0x220f1b={'sxyDq':_0x3022c5(0x127),'VLCrJ':_0x3022c5(0x160),'RSTno':function(_0x385979,_0x9abbaa){return _0x385979+_0x9abbaa;},'nrmnE':function(_0x565b85,_0x4f8a20,_0x401d77){return _0x565b85(_0x4f8a20,_0x401d77);},'rNNbq':_0x3022c5(0x163),'lsgBd':'application/json','tQZnh':_0x3022c5(0x177),'PnJKf':_0x3022c5(0x135),'ANtDt':_0x3022c5(0x15b)};try{let _0x3766a5=this[_0x3022c5(0x194)][_0x3022c5(0x169)];!_0x3766a5[_0x3022c5(0x178)](_0x220f1b[_0x3022c5(0x148)])&&!_0x3766a5[_0x3022c5(0x178)](_0x220f1b[_0x3022c5(0x141)])&&(_0x3766a5=_0x220f1b[_0x3022c5(0x15e)](_0x3766a5[_0x3022c5(0x145)](/\/$/,''),_0x220f1b[_0x3022c5(0x148)]));let _0x50b804=await _0x220f1b[_0x3022c5(0x12c)](fetch,_0x3766a5,{'method':_0x220f1b['rNNbq'],'headers':{'Content-Type':_0x220f1b[_0x3022c5(0x150)],'X-HealCode-Token':this[_0x3022c5(0x194)][_0x3022c5(0x15a)]},'body':JSON['stringify'](_0x48525f),'keepalive':!0x0});_0x50b804['ok']?console[_0x3022c5(0x187)](_0x220f1b[_0x3022c5(0x16f)]):console[_0x3022c5(0x17d)](_0x220f1b['PnJKf'],_0x50b804['status']);}catch(_0x4e12e0){console[_0x3022c5(0x17d)](_0x220f1b[_0x3022c5(0x19a)],_0x4e12e0);}}[a0_0x32ae5a(0x196)](_0x1922b3){const _0x41a84d=a0_0x32ae5a;this[_0x41a84d(0x194)][_0x41a84d(0x191)]=_0x1922b3;}[a0_0x32ae5a(0x182)](){const _0x57d3d0=a0_0x32ae5a;return this[_0x57d3d0(0x194)][_0x57d3d0(0x191)];}},a=null;async function c(){const _0x3c0d0d=a0_0x32ae5a,_0x3a60fd={'NirbF':function(_0x4422a9,_0x2bd484){return _0x4422a9!==_0x2bd484;},'NEZsy':'yAitV','NATSb':function(_0x19288b,_0x1378ba){return _0x19288b(_0x1378ba);}};if(a)return a;try{if(_0x3a60fd[_0x3c0d0d(0x19f)](_0x3c0d0d(0x166),_0x3a60fd[_0x3c0d0d(0x13e)]))return this[_0x3c0d0d(0x194)][_0x3c0d0d(0x191)];else{let _0x5d13f5=await _0x3a60fd[_0x3c0d0d(0x189)](fetch,'/healcode.config.json');if(_0x5d13f5['ok'])return a=await _0x5d13f5['json'](),a;}}catch{}return null;}function a0_0x4509(_0x4f0429,_0x545cc4){_0x4f0429=_0x4f0429-0x125;const _0x2c9e62=a0_0x2c9e();let _0x4509d7=_0x2c9e62[_0x4f0429];if(a0_0x4509['hXUmEu']===undefined){var _0x5f3537=function(_0xff918c){const _0xb8f111='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x47466f='',_0x338af8='';for(let _0x107ff0=0x0,_0x2f2397,_0x29bfed,_0x2397cc=0x0;_0x29bfed=_0xff918c['charAt'](_0x2397cc++);~_0x29bfed&&(_0x2f2397=_0x107ff0%0x4?_0x2f2397*0x40+_0x29bfed:_0x29bfed,_0x107ff0++%0x4)?_0x47466f+=String['fromCharCode'](0xff&_0x2f2397>>(-0x2*_0x107ff0&0x6)):0x0){_0x29bfed=_0xb8f111['indexOf'](_0x29bfed);}for(let _0xc70b90=0x0,_0x26eeaf=_0x47466f['length'];_0xc70b90<_0x26eeaf;_0xc70b90++){_0x338af8+='%'+('00'+_0x47466f['charCodeAt'](_0xc70b90)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x338af8);};a0_0x4509['faJvOb']=_0x5f3537,a0_0x4509['wWCxSl']={},a0_0x4509['hXUmEu']=!![];}const _0x6dc12d=_0x2c9e62[0x0],_0xb5ec6f=_0x4f0429+_0x6dc12d,_0x2f1fe2=a0_0x4509['wWCxSl'][_0xb5ec6f];return!_0x2f1fe2?(_0x4509d7=a0_0x4509['faJvOb'](_0x4509d7),a0_0x4509['wWCxSl'][_0xb5ec6f]=_0x4509d7):_0x4509d7=_0x2f1fe2,_0x4509d7;}async function u(){const _0x3676e7=a0_0x32ae5a,_0x5d7158={'TuQUb':function(_0x516182){return _0x516182();},'qoxJm':'[HealCode]\x20No\x20config\x20found.\x20Run\x20`npx\x20healcode\x20init`\x20to\x20set\x20up.'};let _0x46d4cd=await _0x5d7158[_0x3676e7(0x167)](c);if(!_0x46d4cd)return console[_0x3676e7(0x17d)](_0x5d7158['qoxJm']),null;let _0x2766d4={'token':_0x46d4cd[_0x3676e7(0x15a)],'endpoint':_0x46d4cd['endpoint'],'enabled':_0x46d4cd[_0x3676e7(0x191)],'captureConsoleErrors':_0x46d4cd[_0x3676e7(0x13f)]?.[_0x3676e7(0x18a)],'captureUnhandledRejections':_0x46d4cd[_0x3676e7(0x13f)]?.[_0x3676e7(0x12a)],'maxBreadcrumbs':_0x46d4cd[_0x3676e7(0x13f)]?.[_0x3676e7(0x197)]};return new s(_0x2766d4);}function f(){const _0x2aa1a2=a0_0x32ae5a,_0x2c5f87={'zUsOH':function(_0x29cc35,_0x1d0945){return _0x29cc35>_0x1d0945;},'aoKOq':function(_0x3b559f){return _0x3b559f();}};_0x2c5f87['zUsOH'](typeof window,'u')||_0x2c5f87[_0x2aa1a2(0x142)](u)[_0x2aa1a2(0x13b)](_0x59e06b=>{const _0x33de77=_0x2aa1a2;_0x59e06b&&(window[_0x33de77(0x140)]=_0x59e06b);})['catch'](()=>{const _0x25271f=_0x2aa1a2;console[_0x25271f(0x17d)](_0x25271f(0x15f));});}0x0&&(module['exports']={'HealCode':HealCode,'initFromConfig':initFromConfig,'initFromConfigAsync':initFromConfigAsync,'loadConfigAsync':loadConfigAsync});
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var l="https://prepaid-tribal-invited-eng.trycloudflare.com";var p=l+"/api/logs/",f=20,s=class{constructor(e){this.breadcrumbs=[];this.sentHashes=new Set;this.initialized=!1;this.config={token:e.token,endpoint:e.endpoint||p,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 r=n.map(t=>typeof t=="object"?JSON.stringify(t):String(t)).join(" ");this.capture("error",r),e.apply(console,n)}}interceptWindowErrors(){window.onerror=(e,n,r,t,i)=>{let d=typeof e=="string"?e:"Unknown error";this.capture("error",`${d} at ${n}:${r}:${t}`,i?.stack)}}interceptUnhandledRejections(){window.onunhandledrejection=e=>{this.capture("error",`Unhandled Rejection: ${e.reason}`)}}addBreadcrumb(e,n,r){let t={type:e,message:n,timestamp:new Date().toISOString(),data:r};this.breadcrumbs.push(t),this.breadcrumbs.length>this.config.maxBreadcrumbs&&this.breadcrumbs.shift()}capture(e,n,r){if(!this.config.enabled)return;let t=this.generateHash(n,r);if(this.sentHashes.has(t))return;this.sentHashes.add(t),setTimeout(()=>this.sentHashes.delete(t),300*1e3);let i={token:this.config.token,message:n,stacktrace:r,url:window.location.href,level:e,userAgent:navigator.userAgent,networkStatus:navigator.onLine?"online":"offline",breadcrumbs:[...this.breadcrumbs],timestamp:new Date().toISOString()};this.config.beforeSend&&(i=this.config.beforeSend(i),!i)||this.send(i)}generateHash(e,n){let r=e+(n||""),t=0;for(let i=0;i<r.length;i++){let d=r.charCodeAt(i);t=(t<<5)-t+d,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 r=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-HealCode-Token":this.config.token},body:JSON.stringify(e),keepalive:!0});r.ok?console.log("[HealCode] Error reported successfully"):console.warn("[HealCode] Failed to report error:",r.status)}catch(n){console.warn("[HealCode] Network error:",n)}}setEnabled(e){this.config.enabled=e}isEnabled(){return this.config.enabled}};var a=null;async function c(){if(a)return a;try{let o=await fetch("/healcode.config.json");if(o.ok)return a=await o.json(),a}catch{}return null}async function u(){let o=await c();if(!o)return console.warn("[HealCode] No config found. Run `npx healcode init` to set up."),null;let e={token:o.token,endpoint:o.endpoint,enabled:o.enabled,captureConsoleErrors:o.options?.captureConsoleErrors,captureUnhandledRejections:o.options?.captureUnhandledRejections,maxBreadcrumbs:o.options?.maxBreadcrumbs};return new s(e)}function h(){typeof window>"u"||u().then(o=>{o&&(window.__healcode__=o)}).catch(()=>{console.warn("[HealCode] Failed to initialize")})}export{s as HealCode,h as initFromConfig,u as initFromConfigAsync,c as loadConfigAsync};
|