apm-optima 1.0.4 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -23
- package/dashboard-out/404/index.html +1 -1
- package/dashboard-out/404.html +1 -1
- package/dashboard-out/__next.__PAGE__.txt +4 -4
- package/dashboard-out/__next._full.txt +17 -17
- package/dashboard-out/__next._head.txt +4 -4
- package/dashboard-out/__next._index.txt +10 -10
- package/dashboard-out/__next._tree.txt +2 -2
- package/dashboard-out/_next/static/chunks/{2xjcsu4pgp14_.js → 062oipeclh9bq.js} +1 -1
- package/dashboard-out/_next/static/chunks/0ncbimuip0-o7.css +3 -0
- package/dashboard-out/_next/static/chunks/0xtgenoch3q77.js +1 -0
- package/dashboard-out/_next/static/chunks/1xln1-s87x5yp.js +27 -0
- package/dashboard-out/_not-found/__next._full.txt +15 -15
- package/dashboard-out/_not-found/__next._head.txt +4 -4
- package/dashboard-out/_not-found/__next._index.txt +10 -10
- package/dashboard-out/_not-found/__next._not-found.__PAGE__.txt +2 -2
- package/dashboard-out/_not-found/__next._not-found.txt +3 -3
- package/dashboard-out/_not-found/__next._tree.txt +2 -2
- package/dashboard-out/_not-found/index.html +1 -1
- package/dashboard-out/_not-found/index.txt +15 -15
- package/dashboard-out/index.html +1 -1
- package/dashboard-out/index.txt +17 -17
- package/dist/adapters/session-export.handler.d.ts +4 -0
- package/dist/adapters/session-export.handler.js +29 -0
- package/dist/adapters/socket.options.d.ts +3 -0
- package/dist/adapters/socket.options.js +16 -0
- package/dist/config/config.manager.d.ts +80 -3
- package/dist/config/config.manager.js +269 -89
- package/dist/config/config.types.d.ts +89 -13
- package/dist/core/delivery/buckets-request.d.ts +2 -0
- package/dist/core/delivery/buckets-request.js +18 -0
- package/dist/core/delivery/index.d.ts +1 -0
- package/dist/core/delivery/index.js +1 -0
- package/dist/core/delivery/metrics.publisher.d.ts +23 -10
- package/dist/core/delivery/metrics.publisher.js +22 -22
- package/dist/core/delivery/websocket.events.d.ts +14 -3
- package/dist/core/delivery/websocket.events.js +13 -2
- package/dist/core/domain/correlation.types.d.ts +37 -0
- package/dist/core/domain/correlation.types.js +2 -0
- package/dist/core/domain/dashboard.types.d.ts +16 -69
- package/dist/core/domain/dashboard.types.js +29 -0
- package/dist/core/domain/endpoints.types.d.ts +3 -0
- package/dist/core/domain/event.types.d.ts +14 -0
- package/dist/core/domain/event.types.js +2 -0
- package/dist/core/domain/incident.types.d.ts +50 -0
- package/dist/core/domain/incident.types.js +2 -0
- package/dist/core/domain/index.d.ts +5 -0
- package/dist/core/domain/index.js +5 -0
- package/dist/core/domain/live-bucket.types.d.ts +86 -0
- package/dist/core/domain/live-bucket.types.js +2 -0
- package/dist/core/domain/metrics.types.d.ts +41 -11
- package/dist/core/domain/session.types.d.ts +93 -0
- package/dist/core/domain/session.types.js +2 -0
- package/dist/core/domain/telemetry.types.d.ts +1 -0
- package/dist/core/organizers/event.manager.d.ts +19 -0
- package/dist/core/organizers/event.manager.js +73 -0
- package/dist/core/organizers/index.d.ts +2 -0
- package/dist/core/organizers/index.js +18 -0
- package/dist/core/organizers/interval.manager.d.ts +18 -0
- package/dist/core/organizers/interval.manager.js +54 -0
- package/dist/core/storage/index.d.ts +1 -0
- package/dist/core/storage/index.js +1 -0
- package/dist/core/storage/local.repository.d.ts +12 -12
- package/dist/core/storage/local.repository.js +38 -38
- package/dist/core/storage/persistence/persistence-writer.d.ts +48 -0
- package/dist/core/storage/persistence/persistence-writer.js +191 -0
- package/dist/core/storage/persistence/segment-index.d.ts +27 -0
- package/dist/core/storage/persistence/segment-index.js +206 -0
- package/dist/core/storage/persistence/session-registry.d.ts +28 -0
- package/dist/core/storage/persistence/session-registry.js +127 -0
- package/dist/core/storage/persistence/session-summary.d.ts +3 -0
- package/dist/core/storage/persistence/session-summary.js +112 -0
- package/dist/core/storage/persistence.layer.d.ts +69 -0
- package/dist/core/storage/persistence.layer.js +404 -0
- package/dist/core/storage/runtime/anomaly-detector.d.ts +11 -0
- package/dist/core/storage/runtime/anomaly-detector.js +42 -0
- package/dist/core/storage/stores/analytics.store.d.ts +5 -5
- package/dist/core/storage/stores/analytics.store.js +39 -12
- package/dist/core/storage/stores/bucket-metric.d.ts +85 -0
- package/dist/core/storage/stores/bucket-metric.js +168 -0
- package/dist/core/storage/stores/bucket-view.d.ts +44 -0
- package/dist/core/storage/stores/bucket-view.js +63 -0
- package/dist/core/storage/stores/bucket.store.d.ts +39 -36
- package/dist/core/storage/stores/bucket.store.js +112 -60
- package/dist/core/storage/stores/dashboard.store.d.ts +11 -4
- package/dist/core/storage/stores/dashboard.store.js +179 -47
- package/dist/core/storage/stores/endpoint.store.d.ts +1 -0
- package/dist/core/storage/stores/endpoint.store.js +21 -5
- package/dist/core/storage/stores/index.d.ts +0 -7
- package/dist/core/storage/stores/index.js +0 -7
- package/dist/core/storage/stores/metrics.store.d.ts +1 -1
- package/dist/core/storage/stores/metrics.store.js +1 -0
- package/dist/core/storage/stores/runtime.store.d.ts +77 -0
- package/dist/core/storage/stores/runtime.store.js +222 -0
- package/dist/core/storage/utility/common.d.ts +1 -0
- package/dist/core/storage/utility/common.js +11 -0
- package/dist/core/storage/utility/file-buffer.d.ts +31 -0
- package/dist/core/storage/utility/file-buffer.js +238 -0
- package/dist/core/storage/utility/histogram.d.ts +1 -2
- package/dist/core/storage/utility/histogram.js +1 -2
- package/dist/core/storage/utility/index.d.ts +2 -0
- package/dist/core/storage/utility/index.js +2 -0
- package/dist/core/storage/utility/persistence-files.d.ts +3 -0
- package/dist/core/storage/utility/persistence-files.js +34 -0
- package/dist/core/storage/utility/persistence-writer.d.ts +39 -0
- package/dist/core/storage/utility/persistence-writer.js +183 -0
- package/dist/core/storage/utility/session-export.d.ts +3 -0
- package/dist/core/storage/utility/session-export.js +31 -0
- package/dist/core/storage/utility/session-registry.d.ts +21 -0
- package/dist/core/storage/utility/session-registry.js +91 -0
- package/dist/core/storage/utility/session-window.d.ts +8 -0
- package/dist/core/storage/utility/session-window.js +43 -0
- package/dist/core/telemetry/analytics.service.d.ts +18 -0
- package/dist/core/telemetry/analytics.service.js +100 -0
- package/dist/core/telemetry/collector.service.d.ts +17 -15
- package/dist/core/telemetry/collector.service.js +23 -80
- package/dist/core/telemetry/correlation.service.d.ts +57 -9
- package/dist/core/telemetry/correlation.service.js +246 -54
- package/dist/core/telemetry/dashboard-live.service.d.ts +10 -0
- package/dist/core/telemetry/dashboard-live.service.js +110 -0
- package/dist/core/telemetry/dashboard.service.d.ts +20 -0
- package/dist/core/telemetry/dashboard.service.js +140 -0
- package/dist/core/telemetry/incident.service.d.ts +71 -0
- package/dist/core/telemetry/incident.service.js +239 -0
- package/dist/core/telemetry/logger.d.ts +4 -0
- package/dist/core/telemetry/logger.js +5 -2
- package/dist/core/telemetry/runtime.service.d.ts +14 -0
- package/dist/core/telemetry/runtime.service.js +56 -0
- package/dist/core/telemetry/telemetry-query.service.d.ts +82 -0
- package/dist/core/telemetry/telemetry-query.service.js +231 -0
- package/dist/core/telemetry/telemetry.service.d.ts +10 -4
- package/dist/core/telemetry/telemetry.service.js +60 -10
- package/dist/core/telemetry/utility/correlation-analysis.d.ts +9 -0
- package/dist/core/telemetry/utility/correlation-analysis.js +143 -0
- package/dist/core/telemetry/utility/correlation-finding.d.ts +70 -0
- package/dist/core/telemetry/utility/correlation-finding.js +41 -0
- package/dist/core/telemetry/utility/correlation-input.d.ts +59 -0
- package/dist/core/telemetry/utility/correlation-input.js +139 -0
- package/dist/core/telemetry/utility/correlation-replay.d.ts +24 -0
- package/dist/core/telemetry/utility/correlation-replay.js +46 -0
- package/dist/core/utility/correlation.analysis.d.ts +9 -0
- package/dist/core/utility/correlation.analysis.js +144 -0
- package/dist/core/utility/statistics.d.ts +65 -0
- package/dist/core/utility/statistics.js +141 -0
- package/dist/express/index.d.ts +1 -1
- package/dist/express/index.js +7 -5
- package/dist/express/metrics-websocket.adapter.d.ts +8 -2
- package/dist/express/metrics-websocket.adapter.js +52 -17
- package/dist/express/metrics.adapter.d.ts +1 -0
- package/dist/express/metrics.adapter.js +8 -1
- package/dist/express/metrics.bootstrap.d.ts +6 -1
- package/dist/express/metrics.bootstrap.js +48 -22
- package/dist/express/metrics.dashboard.d.ts +2 -1
- package/dist/express/metrics.dashboard.js +4 -1
- package/dist/express/metrics.middleware.d.ts +2 -1
- package/dist/express/metrics.middleware.js +23 -20
- package/dist/nest/metrics-websocket.adapter.d.ts +19 -3
- package/dist/nest/metrics-websocket.adapter.js +101 -21
- package/dist/nest/metrics.adapter.d.ts +4 -1
- package/dist/nest/metrics.adapter.js +24 -1
- package/dist/nest/metrics.bootstrap.service.d.ts +7 -3
- package/dist/nest/metrics.bootstrap.service.js +56 -21
- package/dist/nest/metrics.interceptor.d.ts +3 -3
- package/dist/nest/metrics.interceptor.js +11 -8
- package/dist/nest/metrics.module.d.ts +3 -0
- package/dist/nest/metrics.module.js +27 -9
- package/dist/runtime/index.d.ts +32 -0
- package/dist/runtime/index.js +104 -0
- package/dist/simulation/simulation.d.ts +5 -16
- package/dist/simulation/simulation.js +5 -8
- package/package.json +2 -1
- package/dashboard-out/_next/static/chunks/20t9qbodfrw_z.js +0 -3
- package/dashboard-out/_next/static/chunks/23soo6qkun-yv.js +0 -1
- package/dashboard-out/_next/static/chunks/3xoopocxi2vi8.css +0 -3
- /package/dashboard-out/_next/static/{u8vU2V6fhASeGVCpWU3eW → 17egwqgk36_DSRF55LJZG}/_buildManifest.js +0 -0
- /package/dashboard-out/_next/static/{u8vU2V6fhASeGVCpWU3eW → 17egwqgk36_DSRF55LJZG}/_clientMiddlewareManifest.js +0 -0
- /package/dashboard-out/_next/static/{u8vU2V6fhASeGVCpWU3eW → 17egwqgk36_DSRF55LJZG}/_ssgManifest.js +0 -0
|
@@ -5,6 +5,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
8
14
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
15
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
16
|
};
|
|
@@ -19,36 +25,49 @@ const metrics_interceptor_1 = require("./metrics.interceptor");
|
|
|
19
25
|
const metrics_adapter_1 = require("./metrics.adapter");
|
|
20
26
|
const metrics_websocket_adapter_1 = require("./metrics-websocket.adapter");
|
|
21
27
|
const metrics_bootstrap_service_1 = require("./metrics.bootstrap.service");
|
|
22
|
-
const telemetry_service_1 = __importDefault(require("../core/telemetry/telemetry.service"));
|
|
23
28
|
const config_1 = require("../config");
|
|
24
29
|
const fs_1 = __importDefault(require("fs"));
|
|
25
30
|
const logger_1 = __importDefault(require("../core/telemetry/logger"));
|
|
31
|
+
const runtime_1 = require("../runtime");
|
|
32
|
+
const session_export_handler_1 = require("../adapters/session-export.handler");
|
|
26
33
|
let MetricsModule = MetricsModule_1 = class MetricsModule {
|
|
34
|
+
dependencies;
|
|
35
|
+
constructor(dependencies) {
|
|
36
|
+
this.dependencies = dependencies;
|
|
37
|
+
}
|
|
27
38
|
static forRoot(options) {
|
|
28
39
|
config_1.ConfigManager.getInstance().initialize(options);
|
|
40
|
+
const dependencies = (0, runtime_1.createOptimaRuntime)(config_1.ConfigManager.getInstance().get());
|
|
29
41
|
return {
|
|
30
42
|
module: MetricsModule_1,
|
|
31
43
|
providers: [
|
|
32
44
|
{
|
|
33
45
|
provide: 'METRICS_CONFIG',
|
|
34
46
|
useValue: config_1.ConfigManager.getInstance().get(),
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
provide: 'OPTIMA_RUNTIME_DEPENDENCIES',
|
|
50
|
+
useValue: dependencies,
|
|
35
51
|
}
|
|
36
52
|
],
|
|
37
53
|
exports: ['METRICS_CONFIG'],
|
|
38
54
|
};
|
|
39
55
|
}
|
|
40
56
|
configure(consumer) {
|
|
41
|
-
const config =
|
|
42
|
-
if (config.
|
|
57
|
+
const config = this.dependencies.config;
|
|
58
|
+
if (config.dashboard === false) {
|
|
43
59
|
return;
|
|
44
60
|
}
|
|
45
|
-
const dashboardRoute = config.
|
|
61
|
+
const dashboardRoute = config.dashboard.path;
|
|
46
62
|
const dashboardDir = path_1.default.join(__dirname, '../../dashboard-out');
|
|
47
63
|
const indexHtmlPath = path_1.default.join(dashboardDir, 'index.html');
|
|
48
64
|
if (!fs_1.default.existsSync(indexHtmlPath)) {
|
|
49
65
|
logger_1.default.error(`Dashboard not found at ${indexHtmlPath}. Please build the dashboard first.`);
|
|
50
66
|
return;
|
|
51
67
|
}
|
|
68
|
+
consumer
|
|
69
|
+
.apply((0, session_export_handler_1.createSessionExportHandler)(this.dependencies.persistence))
|
|
70
|
+
.forRoutes({ path: (0, session_export_handler_1.sessionExportRoute)(dashboardRoute), method: common_1.RequestMethod.GET });
|
|
52
71
|
consumer
|
|
53
72
|
.apply(express_1.default.static(dashboardDir), (req, res, next) => {
|
|
54
73
|
// SPA Fallback
|
|
@@ -65,7 +84,6 @@ exports.MetricsModule = MetricsModule = MetricsModule_1 = __decorate([
|
|
|
65
84
|
(0, common_1.Global)(),
|
|
66
85
|
(0, common_1.Module)({
|
|
67
86
|
providers: [
|
|
68
|
-
telemetry_service_1.default,
|
|
69
87
|
metrics_adapter_1.NestAdapter,
|
|
70
88
|
metrics_websocket_adapter_1.NestWebSocketAdapter,
|
|
71
89
|
metrics_bootstrap_service_1.MetricsBootstrapService,
|
|
@@ -74,8 +92,8 @@ exports.MetricsModule = MetricsModule = MetricsModule_1 = __decorate([
|
|
|
74
92
|
useClass: metrics_interceptor_1.MetricsInterceptor
|
|
75
93
|
},
|
|
76
94
|
],
|
|
77
|
-
exports: [
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
95
|
+
exports: ['METRICS_CONFIG', 'OPTIMA_RUNTIME_DEPENDENCIES'],
|
|
96
|
+
}),
|
|
97
|
+
__param(0, (0, common_1.Inject)('OPTIMA_RUNTIME_DEPENDENCIES')),
|
|
98
|
+
__metadata("design:paramtypes", [Object])
|
|
81
99
|
], MetricsModule);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type ReadonlyConfig } from '../config';
|
|
2
|
+
import { LocalRepository, PersistenceRepository } from '../core/storage';
|
|
3
|
+
import { CollectorService } from '../core/telemetry/collector.service';
|
|
4
|
+
import { CorrelationService } from '../core/telemetry/correlation.service';
|
|
5
|
+
import { TelemetryService } from '../core/telemetry/telemetry.service';
|
|
6
|
+
import { DashboardService } from "../core/telemetry/dashboard.service";
|
|
7
|
+
import { AnalyticsService } from '../core/telemetry/analytics.service';
|
|
8
|
+
import { RuntimeService } from '../core/telemetry/runtime.service';
|
|
9
|
+
import { TelemetryQueryService } from '../core/telemetry/telemetry-query.service';
|
|
10
|
+
import { IncidentService } from '../core/telemetry/incident.service';
|
|
11
|
+
export interface OptimaRuntimeDependencies {
|
|
12
|
+
config: ReadonlyConfig;
|
|
13
|
+
storage: LocalRepository;
|
|
14
|
+
persistence: PersistenceRepository;
|
|
15
|
+
queries: TelemetryQueryService;
|
|
16
|
+
dashboard: DashboardService;
|
|
17
|
+
analytics: AnalyticsService;
|
|
18
|
+
runtime: RuntimeService;
|
|
19
|
+
collector: CollectorService;
|
|
20
|
+
correlation: CorrelationService;
|
|
21
|
+
incidents: IncidentService;
|
|
22
|
+
telemetry: TelemetryService;
|
|
23
|
+
}
|
|
24
|
+
export declare function createOptimaRuntime(config: ReadonlyConfig): OptimaRuntimeDependencies;
|
|
25
|
+
export interface ShutdownSteps {
|
|
26
|
+
stopIntake?: () => void | Promise<void>;
|
|
27
|
+
stopProducers: () => void;
|
|
28
|
+
emitShutdownEvent?: () => Promise<void>;
|
|
29
|
+
closeTransport?: () => void | Promise<void>;
|
|
30
|
+
drainTimeoutMs?: number;
|
|
31
|
+
}
|
|
32
|
+
export declare function shutdownOptimaRuntime(deps: OptimaRuntimeDependencies, steps: ShutdownSteps): Promise<void>;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createOptimaRuntime = createOptimaRuntime;
|
|
7
|
+
exports.shutdownOptimaRuntime = shutdownOptimaRuntime;
|
|
8
|
+
const config_1 = require("../config");
|
|
9
|
+
const storage_1 = require("../core/storage");
|
|
10
|
+
const collector_service_1 = require("../core/telemetry/collector.service");
|
|
11
|
+
const correlation_service_1 = require("../core/telemetry/correlation.service");
|
|
12
|
+
const telemetry_service_1 = require("../core/telemetry/telemetry.service");
|
|
13
|
+
const dashboard_service_1 = require("../core/telemetry/dashboard.service");
|
|
14
|
+
const analytics_service_1 = require("../core/telemetry/analytics.service");
|
|
15
|
+
const runtime_service_1 = require("../core/telemetry/runtime.service");
|
|
16
|
+
const telemetry_query_service_1 = require("../core/telemetry/telemetry-query.service");
|
|
17
|
+
const logger_1 = __importDefault(require("../core/telemetry/logger"));
|
|
18
|
+
const incident_service_1 = require("../core/telemetry/incident.service");
|
|
19
|
+
const organizers_1 = require("../core/organizers");
|
|
20
|
+
function createOptimaRuntime(config) {
|
|
21
|
+
logger_1.default.configure({ consoleLog: config.logging.consoleLog });
|
|
22
|
+
const dashboardSettings = config.dashboard === false ? config_1.DEFAULT_CONFIG.dashboard : config.dashboard;
|
|
23
|
+
const persistence = new storage_1.PersistenceRepository(config);
|
|
24
|
+
const storage = new storage_1.LocalRepository(persistence, config);
|
|
25
|
+
const queries = new telemetry_query_service_1.TelemetryQueryService({
|
|
26
|
+
committed: persistence.bucketSource,
|
|
27
|
+
live: {
|
|
28
|
+
snapshot: () => storage.bucket.getHistory().map(bucket => ({
|
|
29
|
+
bucket,
|
|
30
|
+
committed: storage.bucket.isCommitted(bucket.sequence)
|
|
31
|
+
})),
|
|
32
|
+
},
|
|
33
|
+
currentSessionId: () => persistence.sessionId
|
|
34
|
+
});
|
|
35
|
+
persistence.attachQueryService(queries);
|
|
36
|
+
const dashboard = new dashboard_service_1.DashboardService(queries, () => persistence.sessionId, {
|
|
37
|
+
liveWindow: dashboardSettings.liveWindow,
|
|
38
|
+
backfillLimit: dashboardSettings.backfillLimit,
|
|
39
|
+
maxBackfillAgeMs: dashboardSettings.maxBackfillAgeMs,
|
|
40
|
+
});
|
|
41
|
+
const analytics = new analytics_service_1.AnalyticsService(queries, config);
|
|
42
|
+
const runtime = new runtime_service_1.RuntimeService(storage, config);
|
|
43
|
+
const collector = new collector_service_1.CollectorService(storage, dashboard, analytics, runtime, config);
|
|
44
|
+
const correlation = new correlation_service_1.CorrelationService({
|
|
45
|
+
queries,
|
|
46
|
+
finding: {
|
|
47
|
+
save: f => persistence.saveCorrelationFinding(f),
|
|
48
|
+
find: id => persistence.findCorrelationFinding(id),
|
|
49
|
+
get durable() { return persistence.isEnabled; },
|
|
50
|
+
},
|
|
51
|
+
identity: { sessionId: () => persistence.sessionId, instanceId: storage.bucket.instanceId },
|
|
52
|
+
}, {
|
|
53
|
+
...config.correlation,
|
|
54
|
+
analysisIntervalMs: config.collection.bucketIntervalMs,
|
|
55
|
+
});
|
|
56
|
+
const incidents = new incident_service_1.IncidentService({
|
|
57
|
+
queries,
|
|
58
|
+
sessionId: () => persistence.sessionId,
|
|
59
|
+
durable: () => persistence.isEnabled,
|
|
60
|
+
related: metric => correlation.relatedFindings(metric),
|
|
61
|
+
emit: event => organizers_1.ApplicationEventManager.instance?.emit(event),
|
|
62
|
+
}, {
|
|
63
|
+
...config.incidents,
|
|
64
|
+
p95LatencyMs: config.thresholds.slowLatencyMs,
|
|
65
|
+
eventLoopLagMs: config.thresholds.eventLoopLagMs,
|
|
66
|
+
});
|
|
67
|
+
const telemetry = new telemetry_service_1.TelemetryService(storage, config);
|
|
68
|
+
return {
|
|
69
|
+
config,
|
|
70
|
+
storage,
|
|
71
|
+
persistence,
|
|
72
|
+
queries,
|
|
73
|
+
collector,
|
|
74
|
+
dashboard,
|
|
75
|
+
analytics,
|
|
76
|
+
runtime,
|
|
77
|
+
correlation,
|
|
78
|
+
incidents,
|
|
79
|
+
telemetry
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
async function shutdownOptimaRuntime(deps, steps) {
|
|
83
|
+
const run = async (label, fn) => {
|
|
84
|
+
try {
|
|
85
|
+
await fn();
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
logger_1.default.error(`Shutdown step "${label}" failed:`, err);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
await run('stop intake', () => steps.stopIntake?.());
|
|
92
|
+
const persistenceSettings = deps.config.persistence === false ? config_1.DEFAULT_CONFIG.persistence : deps.config.persistence;
|
|
93
|
+
const drainTimeoutMs = steps.drainTimeoutMs ?? persistenceSettings.shutdownDrainTimeoutMs;
|
|
94
|
+
const drained = await deps.telemetry.whenDrained(drainTimeoutMs);
|
|
95
|
+
if (!drained) {
|
|
96
|
+
logger_1.default.error(`Shutdown: ${deps.telemetry.inFlightCount} request(s) still in flight after ${drainTimeoutMs}ms; closing anyway.`);
|
|
97
|
+
}
|
|
98
|
+
await run('stop producers', () => steps.stopProducers());
|
|
99
|
+
await run('close last interval', () => deps.storage.closeLastInterval());
|
|
100
|
+
await run('emit shutdown event', () => steps.emitShutdownEvent?.());
|
|
101
|
+
await run('persistence shutdown', () => deps.persistence.shutdown());
|
|
102
|
+
await run('dispose runtime collectors', () => deps.storage.dispose());
|
|
103
|
+
await run('close transport', () => steps.closeTransport?.());
|
|
104
|
+
}
|
|
@@ -1,23 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { LocalRepository } from "../core/storage/local.repository";
|
|
2
2
|
export declare class TrafficSimulator {
|
|
3
3
|
private readonly repository;
|
|
4
4
|
private timer?;
|
|
5
5
|
private running;
|
|
6
|
-
constructor(repository
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
readonly health: import("../core/storage").HealthStore;
|
|
11
|
-
readonly bucket: import("../core/storage").BucketStore;
|
|
12
|
-
readonly dashboard: import("../core/storage").DashboardStore;
|
|
13
|
-
readonly analytics: import("../core/storage").AnalyticsStore;
|
|
14
|
-
readonly system: import("../core/storage").SystemStore;
|
|
15
|
-
record(request: TelemetryRequest): void;
|
|
16
|
-
tick(): void;
|
|
17
|
-
});
|
|
18
|
-
start(options?: {
|
|
19
|
-
intervalMs?: number;
|
|
20
|
-
requestsPerTick?: number;
|
|
6
|
+
constructor(repository: LocalRepository);
|
|
7
|
+
start(options: {
|
|
8
|
+
intervalMs: number;
|
|
9
|
+
requestsPerTick: number;
|
|
21
10
|
}): void;
|
|
22
11
|
stop(): void;
|
|
23
12
|
isRunning(): boolean;
|
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.TrafficSimulator = void 0;
|
|
7
|
-
const local_repository_1 = require("../core/storage/local.repository");
|
|
8
7
|
const config_1 = require("./config");
|
|
9
8
|
const scenarios_1 = require("./scenarios");
|
|
10
9
|
const journey_1 = require("./journey");
|
|
@@ -116,7 +115,7 @@ class TrafficSimulator {
|
|
|
116
115
|
repository;
|
|
117
116
|
timer;
|
|
118
117
|
running = false;
|
|
119
|
-
constructor(repository
|
|
118
|
+
constructor(repository) {
|
|
120
119
|
this.repository = repository;
|
|
121
120
|
}
|
|
122
121
|
start(options) {
|
|
@@ -124,20 +123,18 @@ class TrafficSimulator {
|
|
|
124
123
|
return;
|
|
125
124
|
}
|
|
126
125
|
this.running = true;
|
|
127
|
-
const interval = options
|
|
128
|
-
const baseRequests = options
|
|
126
|
+
const interval = options.intervalMs;
|
|
127
|
+
const baseRequests = options.requestsPerTick;
|
|
129
128
|
logger_1.default.debug("Traffic simulation started!");
|
|
130
129
|
this.timer = setInterval(() => {
|
|
131
130
|
if (IS_STABLE) {
|
|
132
|
-
|
|
133
|
-
this.repository.record(request);
|
|
131
|
+
this.repository.record({ ...createStableRequest(), origin: 'synthetic' });
|
|
134
132
|
}
|
|
135
133
|
else {
|
|
136
134
|
const multiplier = scenarios_1.scenario.trafficMultiplier;
|
|
137
135
|
const amount = Math.floor(baseRequests * multiplier);
|
|
138
136
|
for (let i = 0; i < amount; i++) {
|
|
139
|
-
|
|
140
|
-
this.repository.record(request);
|
|
137
|
+
this.repository.record({ ...createRequest(), origin: 'synthetic' });
|
|
141
138
|
}
|
|
142
139
|
}
|
|
143
140
|
}, interval);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apm-optima",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"publishConfig": {
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
],
|
|
41
41
|
"scripts": {
|
|
42
42
|
"build": "tsc",
|
|
43
|
+
"prepublishOnly": "npm run build",
|
|
43
44
|
"test": "jest"
|
|
44
45
|
},
|
|
45
46
|
"peerDependencies": {
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,84789,t=>{"use strict";var e=t.i(71645);t.s(["useSize",0,function(t="graph-root",s=40,r=40){let[i,n]=e.default.useState({width:s,height:r}),[o,a]=e.default.useState(!1);return e.default.useEffect(()=>{let e,s,r=()=>{let e=document.getElementById(t);if(!e)return;let s=Math.round(e.getBoundingClientRect().width),r=Math.round(e.getBoundingClientRect().height);n(t=>t.width===s&&t.height===r?t:{width:s,height:r})};a(!0),window.addEventListener("resize",r);let i=document.getElementById(t);return"u">typeof ResizeObserver&&i&&(s=new ResizeObserver(r)).observe(i),e=window.requestAnimationFrame(r),()=>{window.removeEventListener("resize",r),s?.disconnect(),e&&window.cancelAnimationFrame(e)}},[t]),{...i,isHydrated:o}}])},17508,t=>{"use strict";var e=t.i(43476);let s={top:5,right:5,bottom:5,left:25};t.s(["DEFAULT_PADDING",0,s,"default",0,function({isHydrated:t,chartWidth:r,chartHeight:i,minY:n=0,maxY:o=1,rows:a=5,cols:h=16,xAxisLabels:l,yAxisLabels:c,padding:u,renderLegend:p,children:d}){let f={...s,...u},g=r-f.left-f.right,m=i-f.top-f.bottom;return(0,e.jsxs)("div",{id:"graph-wrapper",className:"relative w-full h-full p-4 pb-8",children:[p&&(0,e.jsx)("div",{className:"flex flex-wrap justify-end gap-2 text-xs text-brand-50",children:p()}),(0,e.jsx)("div",{id:"graph-root",className:"relative w-full h-full max-h-[300px]",children:t&&(0,e.jsxs)("svg",{className:"w-full h-full overflow-visible",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"none",children:[function(){let t=[];for(let s=0;s<=a;s++){let h,l=s/a,u=i-f.bottom-l*m;if(c&&void 0!==c[s])h=c[s];else{let t=n+l*(o-n);h=Number.isInteger(t)?t.toString():t.toFixed(2)}t.push((0,e.jsxs)("g",{children:[(0,e.jsx)("text",{x:f.left-8,y:u+3,textAnchor:"end",fill:"var(--color-accent-soft)",fontSize:"10px",fontWeight:"500",className:"select-none pointer-events-none",children:h}),(0,e.jsx)("line",{x1:f.left,y1:u,x2:r-f.right,y2:u,stroke:"var(--variant-5)",strokeOpacity:"0.15",strokeWidth:"1"})]},`y-grid-${s}`))}for(let s=0;s<h;s++){let r=h>1?s/(h-1):0,n=f.left+r*g;t.push((0,e.jsxs)("g",{children:[l?.[s]&&(0,e.jsx)("text",{x:n,y:i-f.bottom+16,textAnchor:"middle",fill:"var(--color-accent-soft)",fontSize:"10px",fontWeight:"500",className:"select-none pointer-events-none",children:l[s]}),(0,e.jsx)("line",{x1:n,y1:f.top,x2:n,y2:i-f.bottom,stroke:"var(--variant-5)",strokeOpacity:"0.15",strokeWidth:"1"})]},`x-grid-${s}`))}return t}(),d]})})]})}])},12656,t=>{"use strict";var e=t.i(43476),s=t.i(17508),r=t.i(84789);t.s(["default",0,function({data:t,binCount:i=10,padding:n=s.DEFAULT_PADDING,barColor:o="#3b82f6",label:a="Histogram"}){let{width:h,height:l,isHydrated:c}=(0,r.useSize)();if(!t||0===t.length)return null;let u=h-n.left-n.right,p=l-n.top-n.bottom,d=Math.min(...t),f=Math.max(...t),g=(f===d?1:f-d)/i,m=Array.from({length:i},(t,e)=>({x0:d+e*g,x1:d+(e+1)*g,count:0}));t.forEach(t=>{let e=Math.min(Math.floor((t-d)/g),i-1);m[e]&&(m[e].count+=1)});let y=Math.max(...m.map(t=>t.count)),v=0===y?1:y,x=Array.from({length:6},(t,e)=>Math.round(e/5*v).toString()),b=Array.from({length:i+1},(t,e)=>{let s=d+e*g;return Number.isInteger(s)?s.toString():s.toFixed(1)}),_=u/i;return(0,e.jsx)(s.default,{isHydrated:c,chartWidth:h,chartHeight:l,xAxisLabels:b,yAxisLabels:x,rows:5,cols:i,padding:n,renderLegend:()=>(0,e.jsx)(e.Fragment,{children:(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("div",{className:"w-3 h-3 rounded-sm",style:{backgroundColor:o}}),(0,e.jsx)("span",{children:a})]})}),children:m.map((t,s)=>{let r=n.left+s*_+1,i=Math.max(0,_-2),a=t.count/v*p,h=l-n.bottom-a;return(0,e.jsxs)("g",{className:"group",children:[(0,e.jsx)("rect",{x:r,y:h,width:i,height:a,fill:o,fillOpacity:"0.85",rx:"2",className:"pointer-events-auto cursor-pointer transition-all duration-150 group-hover:fill-opacity-100"}),(0,e.jsx)("title",{children:`Range: ${t.x0.toFixed(1)} - ${t.x1.toFixed(1)}
|
|
2
|
-
Count: ${t.count}`})]},`bin-${s}`)})})}])},71034,t=>{"use strict";var e=t.i(43476),s=t.i(17508),r=t.i(84789);t.s(["default",0,function({categories:t,data:i,padding:n=s.DEFAULT_PADDING,defaultColor:o="#3b82f6"}){let{width:a,height:h,isHydrated:l}=(0,r.useSize)();if(!t||0===t.length||!i||0===i.length)return null;let c=a-n.left-n.right,u=h-n.top-n.bottom,p=i.flatMap(t=>t.values),d=Math.max(...p,0),f=Math.min(...p,0),g=(0===d?1:d)-f,m=Array.from({length:6},(t,e)=>{let s=f+e/5*g;return Number.isInteger(s)?s.toString():s.toFixed(1)}),y=t.length,v=c/y,x=.8*v,b=i.length,_=Math.max(1,(x-2*(b-1))/b);return(0,e.jsx)(s.default,{isHydrated:l,chartWidth:a,chartHeight:h,xAxisLabels:t,yAxisLabels:m,rows:5,cols:y,padding:n,renderLegend:()=>(0,e.jsx)(e.Fragment,{children:i.map((t,s)=>(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("div",{className:"w-3 h-3 rounded-sm",style:{backgroundColor:t.color||o}}),(0,e.jsx)("span",{children:t.label})]},`legend-${s}`))}),children:t.map((t,s)=>{let r=n.left+s*v+(v-x)/2;return(0,e.jsx)("g",{children:i.map((i,a)=>{let l=i.values[s]??0,c=i.color||o,p=(l-f)/g*u,d=h-n.bottom-p;return(0,e.jsx)("rect",{x:r+a*(_+2),y:d,width:_,height:Math.max(0,p),fill:c,fillOpacity:"0.85",rx:"3",className:"pointer-events-auto cursor-pointer transition-all duration-150 hover:fill-opacity-100",children:(0,e.jsx)("title",{children:`${t} (${i.label}): ${l}`})},`bar-${s}-${a}`)})},`category-${s}`)})})}])},55803,t=>{"use strict";var e=t.i(43476),s=t.i(17508),r=t.i(84789);t.s(["default",0,function({data:t,padding:i=s.DEFAULT_PADDING,defaultColor:n="#3b82f6",defaultType:o="solid",withDots:a=!0}){let{width:h,height:l,isHydrated:c}=(0,r.useSize)();if(!t||0===t.length)return null;let u=h-i.left-i.right,p=l-i.top-i.bottom,d=l-i.bottom,f=t.flatMap(t=>t.points.map(t=>t.y)),g=Math.min(...f),m=Math.max(...f),y=g===m?g-1:g,v=(g===m?m+1:m)-y;t.reduce((t,e)=>e.points.length>t.length?e.points:t,[]);let x=t[0].points.length/5+1,b=Array.from({length:x},(t,e)=>`${5*e}`),_=Array.from({length:5},(t,e)=>{let s=y+e/4*v;return Number.isInteger(s)?s.toString():s.toFixed(1)}),w=t.flatMap(t=>t.points.map(t=>t.x)),k=Math.min(...w),A=Math.max(...w)-k||1;return(0,e.jsxs)(s.default,{isHydrated:c,chartWidth:h,chartHeight:l,xAxisLabels:b,yAxisLabels:_,rows:4,cols:x,padding:i,renderLegend:()=>(0,e.jsx)(e.Fragment,{children:t.map((t,s)=>(0,e.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,e.jsx)("div",{className:"w-4 h-4 rounded",style:{backgroundColor:t.color||n}}),(0,e.jsx)("span",{children:t.label||`Series ${s+1}`})]},`legend-${s}`))}),children:[(0,e.jsx)("defs",{children:t.map((t,s)=>{let r=t.color||n;return(0,e.jsxs)("linearGradient",{id:`area-gradient-${s}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,e.jsx)("stop",{offset:"0%",stopColor:r,stopOpacity:"0.35"}),(0,e.jsx)("stop",{offset:"100%",stopColor:r,stopOpacity:"0.0"})]},`fill-grad-${s}`)})}),t.map((t,s)=>{var r;let h,c,f,g=((r=t.points).length,h=r.map(t=>{let e=(t.x-k)/A,s=i.left+e*u,r=(t.y-y)/v;return{x:s,y:l-i.bottom-r*p,raw:t}}),c=[],f=[],h.forEach(t=>{t?f.push(t):f.length>0&&(c.push(f),f=[])}),f.length>0&&c.push(f),c),m=t.color||n,x=t.type||o,b=t.fillArea??!0;return(0,e.jsx)("g",{children:g.map((t,r)=>{if(0===t.length)return null;let i=t.map(t=>`${t.x},${t.y}`).join(" "),n=t[0].x,o=t[t.length-1].x,h=[`M ${n},${d}`,...t.map(t=>`L ${t.x},${t.y}`),`L ${o},${d}`,"Z"].join(" ");return(0,e.jsxs)("g",{children:[b&&t.length>1&&(0,e.jsx)("path",{d:h,fill:`url(#area-gradient-${s})`,stroke:"none"}),t.length>1?(0,e.jsx)("polyline",{fill:"none",stroke:m,strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:"dashed"===x?"6,6":void 0,points:i}):null,a&&t.map((t,s)=>(0,e.jsx)("circle",{cx:t.x,cy:t.y,r:"4",className:"fill-brand-900 stroke-2 pointer-events-auto cursor-pointer",stroke:m,children:(0,e.jsx)("title",{children:`X: ${t.raw.x}, Y: ${t.raw.y}`})},`point-${r}-${s}`))]},`segment-${r}`)})},`series-${s}`)})]})}])},3203,t=>{"use strict";var e=t.i(43476),s=t.i(17508),r=t.i(84789);t.s(["default",0,function({data:t,padding:i=s.DEFAULT_PADDING,defaultColor:n="#3b82f6",defaultRadius:o=4}){let{width:a,height:h,isHydrated:l}=(0,r.useSize)();if(!t||0===t.length||t.every(t=>0===t.points.length))return null;let c=a-i.left-i.right,u=h-i.top-i.bottom,p=t.flatMap(t=>t.points.map(t=>t.y)),d=Math.min(...p),f=Math.max(...p),g=d===f?d-1:d,m=(d===f?f+1:f)-g,y=t.flatMap(t=>t.points.map(t=>t.x)),v=Math.min(...y),x=Math.max(...y),b=v===x?v-1:v,_=(v===x?x+1:x)-b,w=Array.from({length:6},(t,e)=>{let s=g+e/5*m;return Number.isInteger(s)?s.toString():s.toFixed(1)}),k=Array.from({length:6},(t,e)=>{let s=b+e/5*_;return Number.isInteger(s)?s.toString():s.toFixed(1)});return(0,e.jsx)(s.default,{isHydrated:l,chartWidth:a,chartHeight:h,xAxisLabels:k,yAxisLabels:w,rows:5,cols:5,padding:i,renderLegend:()=>(0,e.jsx)(e.Fragment,{children:t.map((t,s)=>(0,e.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,e.jsx)("div",{className:"w-4 h-4 rounded",style:{backgroundColor:t.color||n}}),(0,e.jsx)("span",{children:t.label||`Series ${s+1}`})]},`legend-${s}`))}),children:t.map((t,s)=>{let r=t.points.map(t=>{let e=(t.x-b)/_,s=i.left+e*c,r=(t.y-g)/m;return{x:s,y:h-i.bottom-r*u,raw:t}}),a=t.color||n,l=t.radius||o;return(0,e.jsx)("g",{children:r.map((t,r)=>(0,e.jsx)("circle",{cx:t.x,cy:t.y,r:l,fill:a,fillOpacity:"0.75",stroke:a,strokeWidth:"1.5",className:"pointer-events-auto cursor-pointer transition-all duration-150 hover:r-6 hover:fill-opacity-100",children:(0,e.jsx)("title",{children:`X: ${t.raw.x}, Y: ${t.raw.y}`})},`point-${s}-${r}`))},`scatter-series-${s}`)})})}])},20530,t=>{"use strict";var e=t.i(43476),s=t.i(17508),r=t.i(84789);t.s(["default",0,function({xAxisLabels:t,yAxisLabels:i,data:n,padding:o=s.DEFAULT_PADDING,minColor:a="#1e293b",maxColor:h="#10b981"}){let{width:l,height:c,isHydrated:u}=(0,r.useSize)();if(!t.length||!i.length||!n.length)return null;let p=l-o.left-o.right,d=c-o.top-o.bottom,f=n.map(t=>t.value),g=Math.min(...f),m=Math.max(...f),y=g===m?g-1:g,v=g===m?m+1:m,x=v-y,b=t.length,_=i.length,w=Math.max(0,p/b-2),k=Math.max(0,d/_-2),A=new Map;return n.forEach(t=>A.set(`${t.x}:${t.y}`,t.value)),(0,e.jsx)(s.default,{isHydrated:u,chartWidth:l,chartHeight:c,xAxisLabels:t,yAxisLabels:i,rows:_,cols:b,padding:o,renderLegend:()=>(0,e.jsx)("div",{className:"flex flex-col space-y-1",children:(0,e.jsxs)("div",{className:"flex items-center space-x-2 text-xs font-medium text-gray-400",children:[(0,e.jsx)("span",{children:y}),(0,e.jsx)("div",{className:"w-32 h-3 shadow-inner rounded",style:{background:`linear-gradient(to right, ${a}, ${h})`}}),(0,e.jsx)("span",{children:v})]})}),children:i.map((s,r)=>{let i=o.top+d/_*r+1;return t.map((t,n)=>{let l,c,u,d,f,g,m,v,_,E,S=o.left+p/b*n+1,T=A.get(`${t}:${s}`)??y,C=Math.max(0,Math.min(1,(T-y)/x)),N=(c=(l=t=>parseInt(t.replace("#",""),16))(a)>>16&255,u=l(a)>>8&255,d=255&l(a),f=l(h)>>16&255,g=l(h)>>8&255,m=255&l(h),v=Math.round(c+C*(f-c)),_=Math.round(u+C*(g-u)),E=Math.round(d+C*(m-d)),`rgb(${v}, ${_}, ${E})`);return(0,e.jsx)("g",{children:(0,e.jsx)("rect",{x:S,y:i,width:w,height:k,fill:N,rx:"3",className:"pointer-events-auto cursor-pointer transition-all duration-150 hover:stroke-2 hover:stroke-white/50",children:(0,e.jsx)("title",{children:`${t}, ${s}
|
|
3
|
-
Value: ${T}`})})},`cell-${n}-${r}`)})})})}])},44802,t=>{"use strict";var e=t.i(43476),s=t.i(84789);function r(t,e,s,r){let i=r*Math.PI/180;return{x:t+s*Math.cos(i),y:e+s*Math.sin(i)}}function i(t,e,s,i,n){let o=n-i==360?n-.001:n,a=r(t,e,s,o),h=r(t,e,s,i),l=o-i<=180?"0":"1";return["M",a.x,a.y,"A",s,s,0,l,0,h.x,h.y].join(" ")}t.s(["default",0,function({current:t,from:r,to:n,variant:o="half",safeAreas:a=[],title:h,unit:l="",progressColor:c="#3b82f6"}){let{width:u,height:p,isHydrated:d}=(0,s.useSize)();if(n<=r)return null;let f="full"===o,g=f?-90:180,m=f?360:180,y=g+m,v=(u||200)/2,x=f?(p||200)/2:.65*(p||200),b=Math.min(v,x)-24,_=b-16,w=(Math.min(Math.max(t,r),n)-r)/(n-r),k=g+w*m;return(0,e.jsx)("div",{className:"relative w-full h-full p-4 flex flex-col items-center justify-center",children:d&&(0,e.jsxs)("svg",{className:"w-full h-full overflow-visible",viewBox:`0 0 ${u} ${p}`,children:[(0,e.jsx)("path",{d:i(v,x,b,g,y),fill:"none",stroke:"#1e293b",strokeWidth:12,strokeLinecap:"round"}),a.map((t,s)=>{let o=Math.min(Math.max(t.from,r),n),a=Math.min(Math.max(t.to,r),n),h=g+(o-r)/(n-r)*m,l=g+(a-r)/(n-r)*m;return h>=l?null:(0,e.jsx)("path",{d:i(v,x,b,h,l),fill:"none",stroke:t.color,strokeWidth:12,opacity:"0.85",strokeLinecap:"round",children:(0,e.jsx)("title",{children:`${t.label||"Limit Zone"}: ${t.from} - ${t.to}`})},`threshold-${s}`)}),(0,e.jsx)("path",{d:i(v,x,_,g,y),fill:"none",stroke:"#0f172a",strokeWidth:10,strokeLinecap:f?"butt":"round"}),w>0&&(0,e.jsx)("path",{d:i(v,x,_,g,k),fill:"none",stroke:c,strokeWidth:10,strokeLinecap:"round",className:"transition-all duration-300 ease-out"}),(0,e.jsxs)("g",{transform:`translate(${v}, ${f?x:x-10})`,children:[(0,e.jsxs)("text",{x:"0",y:"0",textAnchor:"middle",fill:"#ffffff",fontSize:"24px",fontWeight:"700",dominantBaseline:"central",children:[t,(0,e.jsx)("tspan",{fontSize:"13px",fill:"#9ca3af",dx:"2",children:l})]}),h&&(0,e.jsx)("text",{x:"0",y:"26",textAnchor:"middle",fill:"#9ca3af",fontSize:"11px",fontWeight:"500",children:h})]})]})})}])},49645,96780,47808,56820,84703,92432,9958,63637,t=>{"use strict";var e=t.i(43476);t.s(["default",0,function(t){return(0,e.jsx)("svg",{className:"w-6 h-6 text-gray-800 dark:text-white","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",viewBox:"0 0 24 24",...t,children:(0,e.jsx)("path",{fillRule:"evenodd",d:"M17 10v1.126c.367.095.714.24 1.032.428l.796-.797 1.415 1.415-.797.796c.188.318.333.665.428 1.032H21v2h-1.126c-.095.367-.24.714-.428 1.032l.797.796-1.415 1.415-.796-.797a3.979 3.979 0 0 1-1.032.428V20h-2v-1.126a3.977 3.977 0 0 1-1.032-.428l-.796.797-1.415-1.415.797-.796A3.975 3.975 0 0 1 12.126 16H11v-2h1.126c.095-.367.24-.714.428-1.032l-.797-.796 1.415-1.415.796.797A3.977 3.977 0 0 1 15 11.126V10h2Zm.406 3.578.016.016c.354.358.574.85.578 1.392v.028a2 2 0 0 1-3.409 1.406l-.01-.012a2 2 0 0 1 2.826-2.83ZM5 8a4 4 0 1 1 7.938.703 7.029 7.029 0 0 0-3.235 3.235A4 4 0 0 1 5 8Zm4.29 5H7a4 4 0 0 0-4 4v1a2 2 0 0 0 2 2h6.101A6.979 6.979 0 0 1 9 15c0-.695.101-1.366.29-2Z",clipRule:"evenodd"})})}],96780),t.s(["default",0,function(t){return(0,e.jsxs)("svg",{className:"w-6 h-6 text-gray-800 dark:text-white","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",viewBox:"0 0 24 24",...t,children:[(0,e.jsx)("path",{d:"M3 4.92857C3 3.90506 3.80497 3 4.88889 3H19.1111C20.195 3 21 3.90506 21 4.92857V13h-3v-2c0-.5523-.4477-1-1-1h-4c-.5523 0-1 .4477-1 1v2H3V4.92857ZM3 15v1.0714C3 17.0949 3.80497 18 4.88889 18h3.47608L7.2318 19.3598c-.35356.4243-.29624 1.0548.12804 1.4084.42428.3536 1.05484.2962 1.40841-.128L10.9684 18h2.0632l2.2002 2.6402c.3535.4242.9841.4816 1.4084.128.4242-.3536.4816-.9841.128-1.4084L15.635 18h3.4761C20.195 18 21 17.0949 21 16.0714V15H3Z"}),(0,e.jsx)("path",{d:"M16 12v1h-2v-1h2Z"})]})}],47808),t.s(["default",0,function(t){return(0,e.jsx)("svg",{className:"w-6 h-6 text-gray-800 dark:text-white","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",viewBox:"0 0 24 24",...t,children:(0,e.jsx)("path",{fillRule:"evenodd",d:"M9 7V2.221a2 2 0 0 0-.5.365L4.586 6.5a2 2 0 0 0-.365.5H9Zm2 0V2h7a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V9h5a2 2 0 0 0 2-2Zm-1 9a1 1 0 1 0-2 0v2a1 1 0 1 0 2 0v-2Zm2-5a1 1 0 0 1 1 1v6a1 1 0 1 1-2 0v-6a1 1 0 0 1 1-1Zm4 4a1 1 0 1 0-2 0v3a1 1 0 1 0 2 0v-3Z",clipRule:"evenodd"})})}],56820),t.s(["default",0,function(t){return(0,e.jsx)("svg",{className:"w-6 h-6 text-gray-800 dark:text-white","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",viewBox:"0 0 24 24",...t,children:(0,e.jsx)("path",{d:"m7.4 3.736 3.43 3.429A5.046 5.046 0 0 1 12.133 7c.356.01.71.06 1.056.147l3.41-3.412a2.32 2.32 0 0 1 .451-.344A9.89 9.89 0 0 0 12.268 2a10.022 10.022 0 0 0-5.322 1.392c.165.095.318.211.454.344Zm11.451 1.54-.127-.127a.5.5 0 0 0-.706 0l-2.932 2.932c.03.023.05.054.078.077.237.194.454.41.651.645.033.038.077.067.11.107l2.926-2.927a.5.5 0 0 0 0-.707Zm-2.931 9.81c-.025.03-.058.052-.082.082a4.97 4.97 0 0 1-.633.639c-.04.036-.072.083-.115.117l2.927 2.927a.5.5 0 0 0 .707 0l.127-.127a.5.5 0 0 0 0-.707l-2.932-2.931Zm-1.443-4.763a3.037 3.037 0 0 0-1.383-1.1l-.012-.007a2.956 2.956 0 0 0-1-.213H12a2.964 2.964 0 0 0-2.122.893c-.285.29-.509.634-.657 1.013l-.009.016a2.96 2.96 0 0 0-.21 1 2.99 2.99 0 0 0 .488 1.716l.032.04a3.04 3.04 0 0 0 1.384 1.1l.012.007c.319.129.657.2 1 .213.393.015.784-.05 1.15-.192.012-.005.021-.013.033-.018a3.01 3.01 0 0 0 1.676-1.7v-.007a2.89 2.89 0 0 0 0-2.207 2.868 2.868 0 0 0-.27-.515c-.007-.012-.02-.025-.03-.039Zm6.137-3.373a2.53 2.53 0 0 1-.349.447l-3.426 3.426c.112.428.166.869.161 1.311a4.954 4.954 0 0 1-.148 1.054l3.413 3.412c.133.134.249.283.347.444A9.88 9.88 0 0 0 22 12.269a9.913 9.913 0 0 0-1.386-5.319ZM16.6 20.264l-3.42-3.421c-.386.1-.782.152-1.18.157h-.135c-.356-.01-.71-.06-1.056-.147L7.4 20.265a2.503 2.503 0 0 1-.444.347A9.884 9.884 0 0 0 11.732 22H12a9.9 9.9 0 0 0 5.044-1.388 2.515 2.515 0 0 1-.444-.348ZM3.735 16.6l3.426-3.426a4.608 4.608 0 0 1-.013-2.367L3.735 7.4a2.508 2.508 0 0 1-.349-.447 9.889 9.889 0 0 0 0 10.1 2.48 2.48 0 0 1 .35-.453Zm5.101-.758a4.959 4.959 0 0 1-.65-.645c-.034-.038-.078-.067-.11-.107L5.15 18.017a.5.5 0 0 0 0 .707l.127.127a.5.5 0 0 0 .706 0l2.932-2.933c-.029-.018-.049-.053-.078-.076Zm-.755-6.928c.03-.037.07-.063.1-.1.183-.22.383-.423.6-.609.046-.04.081-.092.128-.13L5.983 5.149a.5.5 0 0 0-.707 0l-.127.127a.5.5 0 0 0 0 .707l2.932 2.931Z"})})}],84703),t.s(["default",0,function(t){return(0,e.jsx)("svg",{className:"w-6 h-6 text-gray-800 dark:text-white","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",viewBox:"0 0 24 24",...t,children:(0,e.jsx)("path",{fillRule:"evenodd",d:"M2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Zm9.008-3.018a1.502 1.502 0 0 1 2.522 1.159v.024a1.44 1.44 0 0 1-1.493 1.418 1 1 0 0 0-1.037.999V14a1 1 0 1 0 2 0v-.539a3.44 3.44 0 0 0 2.529-3.256 3.502 3.502 0 0 0-7-.255 1 1 0 0 0 2 .076c.014-.398.187-.774.48-1.044Zm.982 7.026a1 1 0 1 0 0 2H12a1 1 0 1 0 0-2h-.01Z",clipRule:"evenodd"})})}],92432),t.s(["default",0,function(t){return(0,e.jsx)("svg",{className:"w-6 h-6 text-gray-800 dark:text-white","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",viewBox:"0 0 24 24",...t,children:(0,e.jsx)("path",{fillRule:"evenodd",d:"M13 3a1 1 0 1 0-2 0v2a1 1 0 1 0 2 0V3ZM6.343 4.929A1 1 0 0 0 4.93 6.343l1.414 1.414a1 1 0 0 0 1.414-1.414L6.343 4.929Zm12.728 1.414a1 1 0 0 0-1.414-1.414l-1.414 1.414a1 1 0 0 0 1.414 1.414l1.414-1.414ZM12 7a5 5 0 1 0 0 10 5 5 0 0 0 0-10Zm-9 4a1 1 0 1 0 0 2h2a1 1 0 1 0 0-2H3Zm16 0a1 1 0 1 0 0 2h2a1 1 0 1 0 0-2h-2ZM7.757 17.657a1 1 0 1 0-1.414-1.414l-1.414 1.414a1 1 0 1 0 1.414 1.414l1.414-1.414Zm9.9-1.414a1 1 0 0 0-1.414 1.414l1.414 1.414a1 1 0 0 0 1.414-1.414l-1.414-1.414ZM13 19a1 1 0 1 0-2 0v2a1 1 0 1 0 2 0v-2Z",clipRule:"evenodd"})})}],9958),t.s(["default",0,function(t){return(0,e.jsx)("svg",{className:"w-6 h-6 text-gray-800 dark:text-white","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",viewBox:"0 0 24 24",...t,children:(0,e.jsx)("path",{fillRule:"evenodd",d:"M11.675 2.015a.998.998 0 0 0-.403.011C6.09 2.4 2 6.722 2 12c0 5.523 4.477 10 10 10 4.356 0 8.058-2.784 9.43-6.667a1 1 0 0 0-1.02-1.33c-.08.006-.105.005-.127.005h-.001l-.028-.002A5.227 5.227 0 0 0 20 14a8 8 0 0 1-8-8c0-.952.121-1.752.404-2.558a.996.996 0 0 0 .096-.428V3a1 1 0 0 0-.825-.985Z",clipRule:"evenodd"})})}],63637),t.s([],49645)},69507,25516,t=>{"use strict";var e=t.i(43476);let s=({size:t=64,color:s="#FFFFFF",className:r="",...i})=>(0,e.jsxs)("svg",{width:t,height:t,viewBox:"0 0 200 200",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:r,...i,children:[(0,e.jsx)("circle",{cx:"100",cy:"100",r:"75",stroke:s,strokeWidth:"7",strokeOpacity:"0.25"}),(0,e.jsx)("path",{d:"M 45 135 A 65 65 0 1 1 155 135",stroke:s,strokeWidth:"10",strokeLinecap:"round"}),(0,e.jsx)("circle",{cx:"50",cy:"130",r:"4",fill:s}),(0,e.jsx)("circle",{cx:"100",cy:"42",r:"4",fill:s}),(0,e.jsx)("circle",{cx:"150",cy:"130",r:"4",fill:s}),(0,e.jsx)("rect",{x:"78",y:"130",width:"7",height:"18",rx:"3.5",fill:s,fillOpacity:"0.5"}),(0,e.jsx)("rect",{x:"92",y:"118",width:"7",height:"30",rx:"3.5",fill:s,fillOpacity:"0.9"}),(0,e.jsx)("rect",{x:"106",y:"124",width:"7",height:"24",rx:"3.5",fill:s,fillOpacity:"0.6"}),(0,e.jsx)("path",{d:"M 100 100 L 132 68",stroke:s,strokeWidth:"8",strokeLinecap:"round"}),(0,e.jsx)("circle",{cx:"100",cy:"100",r:"8",fill:s})]});t.s(["default",0,s],25516),t.s(["default",0,({text:t="Loading..."})=>(0,e.jsxs)("div",{className:"flex items-center justify-center h-screen w-screen flex-col",children:[(0,e.jsxs)("div",{className:"flex items-center justify-center w-20 h-20 mb-4",children:[(0,e.jsx)("div",{className:"w-20 h-20 absolute rounded-full border-2 border-accent-soft animate-spin border-t-accent"}),(0,e.jsx)(s,{size:60,color:"var(--color-foreground)"})]}),(0,e.jsx)("p",{className:"text-lg",children:t})]})],69507)},11350,t=>{"use strict";let e,s,r;var i,n,o,a=t.i(43476),h=t.i(71645);let l=Object.create(null);l.open="0",l.close="1",l.ping="2",l.pong="3",l.message="4",l.upgrade="5",l.noop="6";let c=Object.create(null);Object.keys(l).forEach(t=>{c[l[t]]=t});let u={type:"error",data:"parser error"},p="function"==typeof Blob||"u">typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),d="function"==typeof ArrayBuffer,f=t=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,g=({type:t,data:e},s,r)=>{if(p&&e instanceof Blob)if(s)return r(e);else return m(e,r);if(d&&(e instanceof ArrayBuffer||f(e)))if(s)return r(e);else return m(new Blob([e]),r);return r(l[t]+(e||""))},m=(t,e)=>{let s=new FileReader;return s.onload=function(){e("b"+(s.result.split(",")[1]||""))},s.readAsDataURL(t)};function y(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",x="u"<typeof Uint8Array?[]:new Uint8Array(256);for(let t=0;t<v.length;t++)x[v.charCodeAt(t)]=t;let b="function"==typeof ArrayBuffer,_=(t,e)=>{if("string"!=typeof t)return{type:"message",data:k(t,e)};let s=t.charAt(0);return"b"===s?{type:"message",data:w(t.substring(1),e)}:c[s]?t.length>1?{type:c[s],data:t.substring(1)}:{type:c[s]}:u},w=(t,e)=>b?k((t=>{let e=.75*t.length,s=t.length,r,i=0,n,o,a,h;"="===t[t.length-1]&&(e--,"="===t[t.length-2]&&e--);let l=new ArrayBuffer(e),c=new Uint8Array(l);for(r=0;r<s;r+=4)n=x[t.charCodeAt(r)],o=x[t.charCodeAt(r+1)],a=x[t.charCodeAt(r+2)],h=x[t.charCodeAt(r+3)],c[i++]=n<<2|o>>4,c[i++]=(15&o)<<4|a>>2,c[i++]=(3&a)<<6|63&h;return l})(t),e):{base64:!0,data:t},k=(t,e)=>"blob"===e?t instanceof Blob?t:new Blob([t]):t instanceof ArrayBuffer?t:t.buffer;function A(t){return t.reduce((t,e)=>t+e.length,0)}function E(t,e){if(t[0].length===e)return t.shift();let s=new Uint8Array(e),r=0;for(let i=0;i<e;i++)s[i]=t[0][r++],r===t[0].length&&(t.shift(),r=0);return t.length&&r<t[0].length&&(t[0]=t[0].slice(r)),s}function S(t){if(t){var e=t;for(var s in S.prototype)e[s]=S.prototype[s];return e}}S.prototype.on=S.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},S.prototype.once=function(t,e){function s(){this.off(t,s),e.apply(this,arguments)}return s.fn=e,this.on(t,s),this},S.prototype.off=S.prototype.removeListener=S.prototype.removeAllListeners=S.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var s,r=this._callbacks["$"+t];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var i=0;i<r.length;i++)if((s=r[i])===e||s.fn===e){r.splice(i,1);break}return 0===r.length&&delete this._callbacks["$"+t],this},S.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=Array(arguments.length-1),s=this._callbacks["$"+t],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(s){s=s.slice(0);for(var r=0,i=s.length;r<i;++r)s[r].apply(this,e)}return this},S.prototype.emitReserved=S.prototype.emit,S.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},S.prototype.hasListeners=function(t){return!!this.listeners(t).length};let T="function"==typeof Promise&&"function"==typeof Promise.resolve?t=>Promise.resolve().then(t):(t,e)=>e(t,0),C="u">typeof self?self:"u">typeof window?window:Function("return this")();function N(t,...e){return e.reduce((e,s)=>(t.hasOwnProperty(s)&&(e[s]=t[s]),e),{})}let j=C.setTimeout,O=C.clearTimeout;function R(t,e){e.useNativeTimers?(t.setTimeoutFn=j.bind(C),t.clearTimeoutFn=O.bind(C)):(t.setTimeoutFn=C.setTimeout.bind(C),t.clearTimeoutFn=C.clearTimeout.bind(C))}function L(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class B extends Error{constructor(t,e,s){super(t),this.description=e,this.context=s,this.type="TransportError"}}class M extends S{constructor(t){super(),this.writable=!1,R(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,e,s){return super.emitReserved("error",new B(t,e,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return("opening"===this.readyState||"open"===this.readyState)&&(this.doClose(),this.onClose()),this}send(t){"open"===this.readyState&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){let e=_(t,this.socket.binaryType);this.onPacket(e)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,e={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(e)}_hostname(){let t=this.opts.hostname;return -1===t.indexOf(":")?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&443!==Number(this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(t){let e=function(t){let e="";for(let s in t)t.hasOwnProperty(s)&&(e.length&&(e+="&"),e+=encodeURIComponent(s)+"="+encodeURIComponent(t[s]));return e}(t);return e.length?"?"+e:""}}class D extends M{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";let e=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let t=0;this._polling&&(t++,this.once("pollComplete",function(){--t||e()})),this.writable||(t++,this.once("drain",function(){--t||e()}))}else e()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){let e=t=>{if("opening"===this.readyState&&"open"===t.type&&this.onOpen(),"close"===t.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(t)};((t,e)=>{let s=t.split("\x1e"),r=[];for(let t=0;t<s.length;t++){let i=_(s[t],e);if(r.push(i),"error"===i.type)break}return r})(t,this.socket.binaryType).forEach(e),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this._poll())}doClose(){let t=()=>{this.write([{type:"close"}])};"open"===this.readyState?t():this.once("open",t)}write(t){var e;let s,r,i;this.writable=!1,e=t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})},r=Array(s=t.length),i=0,t.forEach((t,n)=>{g(t,!1,t=>{r[n]=t,++i===s&&e(r.join("\x1e"))})})}uri(){let t=this.opts.secure?"https":"http",e=this.query||{};return!1!==this.opts.timestampRequests&&(e[this.opts.timestampParam]=L()),this.supportsBinary||e.sid||(e.b64=1),this.createUri(t,e)}}let P=!1;try{P="u">typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(t){}let q=P;function $(){}class I extends D{constructor(t){if(super(t),"u">typeof location){const e="https:"===location.protocol;let s=location.port;s||(s=e?"443":"80"),this.xd="u">typeof location&&t.hostname!==location.hostname||s!==t.port}}doWrite(t,e){let s=this.request({method:"POST",data:t});s.on("success",e),s.on("error",(t,e)=>{this.onError("xhr post error",t,e)})}doPoll(){let t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(t,e)=>{this.onError("xhr poll error",t,e)}),this.pollXhr=t}}class F extends S{constructor(t,e,s){super(),this.createRequest=t,R(this,s),this._opts=s,this._method=s.method||"GET",this._uri=e,this._data=void 0!==s.data?s.data:null,this._create()}_create(){var t;let e=N(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this._opts.xd;let s=this._xhr=this.createRequest(e);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders)for(let t in s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0),this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(t)&&s.setRequestHeader(t,this._opts.extraHeaders[t])}catch(t){}if("POST"===this._method)try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{s.setRequestHeader("Accept","*/*")}catch(t){}null==(t=this._opts.cookieJar)||t.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var t;3===s.readyState&&(null==(t=this._opts.cookieJar)||t.parseCookies(s.getResponseHeader("set-cookie"))),4===s.readyState&&(200===s.status||1223===s.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof s.status?s.status:0)},0))},s.send(this._data)}catch(t){this.setTimeoutFn(()=>{this._onError(t)},0);return}"u">typeof document&&(this._index=F.requestsCount++,F.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=$,t)try{this._xhr.abort()}catch(t){}"u">typeof document&&delete F.requests[this._index],this._xhr=null}}_onLoad(){let t=this._xhr.responseText;null!==t&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}function U(){for(let t in F.requests)F.requests.hasOwnProperty(t)&&F.requests[t].abort()}F.requestsCount=0,F.requests={},"u">typeof document&&("function"==typeof attachEvent?attachEvent("onunload",U):"function"==typeof addEventListener&&addEventListener("onpagehide"in C?"pagehide":"unload",U,!1));let H=(r=V({xdomain:!1}))&&null!==r.responseType;function V(t){let e=t.xdomain;try{if("u">typeof XMLHttpRequest&&(!e||q))return new XMLHttpRequest}catch(t){}if(!e)try{return new C[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch(t){}}let W="u">typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class z extends M{get name(){return"websocket"}doOpen(){let t=this.uri(),e=this.opts.protocols,s=W?{}:N(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,e,s)}catch(t){return this.emitReserved("error",t)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let e=0;e<t.length;e++){let s=t[e],r=e===t.length-1;g(s,this.supportsBinary,t=>{try{this.doWrite(s,t)}catch(t){}r&&T(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let t=this.opts.secure?"wss":"ws",e=this.query||{};return this.opts.timestampRequests&&(e[this.opts.timestampParam]=L()),this.supportsBinary||(e.b64=1),this.createUri(t,e)}}let Z=C.WebSocket||C.MozWebSocket,Y={websocket:class extends z{createSocket(t,e,s){return W?new Z(t,e,s):e?new Z(t,e):new Z(t)}doWrite(t,e){this.ws.send(e)}},webtransport:class extends M{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{var r,i;let n,o,a,h,l=(r=Number.MAX_SAFE_INTEGER,i=this.socket.binaryType,s||(s=new TextDecoder),n=[],o=0,a=-1,h=!1,new TransformStream({transform(t,e){for(n.push(t);;){if(0===o){if(1>A(n))break;let t=E(n,1);h=(128&t[0])==128,o=(a=127&t[0])<126?3:126===a?1:2}else if(1===o){if(2>A(n))break;let t=E(n,2);a=new DataView(t.buffer,t.byteOffset,t.length).getUint16(0),o=3}else if(2===o){if(8>A(n))break;let t=E(n,8),s=new DataView(t.buffer,t.byteOffset,t.length),r=s.getUint32(0);if(r>2097151){e.enqueue(u);break}a=0x100000000*r+s.getUint32(4),o=3}else{if(A(n)<a)break;let t=E(n,a);e.enqueue(_(h?t:s.decode(t),i)),o=0}if(0===a||a>r){e.enqueue(u);break}}}})),c=t.readable.pipeThrough(l).getReader(),m=new TransformStream({transform(t,s){var r;r=e=>{let r,i=e.length;if(i<126)new DataView((r=new Uint8Array(1)).buffer).setUint8(0,i);else if(i<65536){let t=new DataView((r=new Uint8Array(3)).buffer);t.setUint8(0,126),t.setUint16(1,i)}else{let t=new DataView((r=new Uint8Array(9)).buffer);t.setUint8(0,127),t.setBigUint64(1,BigInt(i))}t.data&&"string"!=typeof t.data&&(r[0]|=128),s.enqueue(r),s.enqueue(e)},p&&t.data instanceof Blob?t.data.arrayBuffer().then(y).then(r):d&&(t.data instanceof ArrayBuffer||f(t.data))?r(y(t.data)):g(t,!1,t=>{e||(e=new TextEncoder),r(e.encode(t))})}});m.readable.pipeTo(t.writable),this._writer=m.writable.getWriter();let v=()=>{c.read().then(({done:t,value:e})=>{t||(this.onPacket(e),v())}).catch(t=>{})};v();let x={type:"open"};this.query.sid&&(x.data=`{"sid":"${this.query.sid}"}`),this._writer.write(x).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let e=0;e<t.length;e++){let s=t[e],r=e===t.length-1;this._writer.write(s).then(()=>{r&&T(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;null==(t=this._transport)||t.close()}},polling:class extends I{constructor(t){super(t);const e=t&&t.forceBase64;this.supportsBinary=H&&!e}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new F(V,this.uri(),t)}}},K=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,G=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Q(t){var e,s;let r,i;if(t.length>8e3)throw"URI too long";let n=t,o=t.indexOf("["),a=t.indexOf("]");-1!=o&&-1!=a&&(t=t.substring(0,o)+t.substring(o,a).replace(/:/g,";")+t.substring(a,t.length));let h=K.exec(t||""),l={},c=14;for(;c--;)l[G[c]]=h[c]||"";return -1!=o&&-1!=a&&(l.source=n,l.host=l.host.substring(1,l.host.length-1).replace(/;/g,":"),l.authority=l.authority.replace("[","").replace("]","").replace(/;/g,":"),l.ipv6uri=!0),r=(e=l.path).replace(/\/{2,9}/g,"/").split("/"),("/"==e.slice(0,1)||0===e.length)&&r.splice(0,1),"/"==e.slice(-1)&&r.splice(r.length-1,1),l.pathNames=r,s=l.query,i={},s.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(t,e,s){e&&(i[e]=s)}),l.queryKey=i,l}let J="function"==typeof addEventListener&&"function"==typeof removeEventListener,X=[];J&&addEventListener("offline",()=>{X.forEach(t=>t())},!1);class tt extends S{constructor(t,e){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&"object"==typeof t&&(e=t,t=null),t){const s=Q(t);e.hostname=s.host,e.secure="https"===s.protocol||"wss"===s.protocol,e.port=s.port,s.query&&(e.query=s.query)}else e.host&&(e.hostname=Q(e.host).host);R(this,e),this.secure=null!=e.secure?e.secure:"u">typeof location&&"https:"===location.protocol,e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.hostname=e.hostname||("u">typeof location?location.hostname:"localhost"),this.port=e.port||("u">typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},e.transports.forEach(t=>{let e=t.prototype.name;this.transports.push(e),this._transportsByName[e]=t}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},e),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(t){let e={},s=t.split("&");for(let t=0,r=s.length;t<r;t++){let r=s[t].split("=");e[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return e}(this.opts.query)),J&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},X.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){let e=Object.assign({},this.opts.query);e.EIO=4,e.transport=t,this.id&&(e.sid=this.id);let s=Object.assign({},this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](s)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);let t=this.opts.rememberUpgrade&&tt.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";let e=this.createTransport(t);e.open(),this.setTransport(e)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",t=>this._onClose("transport close",t))}onOpen(){this.readyState="open",tt.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let e=Error("server error");e.code=t.data,this._onError(e);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data)}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let e=0;e<this.writeBuffer.length;e++){let s=this.writeBuffer[e].data;if(s&&(t+="string"==typeof s?function(t){let e=0,s=0;for(let r=0,i=t.length;r<i;r++)(e=t.charCodeAt(r))<128?s+=1:e<2048?s+=2:e<55296||e>=57344?s+=3:(r++,s+=4);return s}(s):Math.ceil(1.33*(s.byteLength||s.size))),e>0&&t>this._maxPayload)return this.writeBuffer.slice(0,e);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,T(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,e,s){return this._sendPacket("message",t,e,s),this}send(t,e,s){return this._sendPacket("message",t,e,s),this}_sendPacket(t,e,s,r){if("function"==typeof e&&(r=e,e=void 0),"function"==typeof s&&(r=s,s=null),"closing"===this.readyState||"closed"===this.readyState)return;(s=s||{}).compress=!1!==s.compress;let i={type:t,data:e,options:s};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}close(){let t=()=>{this._onClose("forced close"),this.transport.close()},e=()=>{this.off("upgrade",e),this.off("upgradeError",e),t()},s=()=>{this.once("upgrade",e),this.once("upgradeError",e)};return("opening"===this.readyState||"open"===this.readyState)&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():t()}):this.upgrading?s():t()),this}_onError(t){if(tt.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),J&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let t=X.indexOf(this._offlineEventListener);-1!==t&&X.splice(t,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,e),this.writeBuffer=[],this._prevBufferLen=0}}}tt.protocol=4;class te extends tt{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let e=this.createTransport(t),s=!1;tt.priorWebsocketSuccess=!1;let r=()=>{s||(e.send([{type:"ping",data:"probe"}]),e.once("packet",t=>{if(!s)if("pong"===t.type&&"probe"===t.data){if(this.upgrading=!0,this.emitReserved("upgrading",e),!e)return;tt.priorWebsocketSuccess="websocket"===e.name,this.transport.pause(()=>{s||"closed"!==this.readyState&&(l(),this.setTransport(e),e.send([{type:"upgrade"}]),this.emitReserved("upgrade",e),e=null,this.upgrading=!1,this.flush())})}else{let t=Error("probe error");t.transport=e.name,this.emitReserved("upgradeError",t)}}))};function i(){s||(s=!0,l(),e.close(),e=null)}let n=t=>{let s=Error("probe error: "+t);s.transport=e.name,i(),this.emitReserved("upgradeError",s)};function o(){n("transport closed")}function a(){n("socket closed")}function h(t){e&&t.name!==e.name&&i()}let l=()=>{e.removeListener("open",r),e.removeListener("error",n),e.removeListener("close",o),this.off("close",a),this.off("upgrading",h)};e.once("open",r),e.once("error",n),e.once("close",o),this.once("close",a),this.once("upgrading",h),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==t?this.setTimeoutFn(()=>{s||e.open()},200):e.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){let e=[];for(let s=0;s<t.length;s++)~this.transports.indexOf(t[s])&&e.push(t[s]);return e}}class ts extends te{constructor(t,e={}){const s="object"==typeof t,r=s?{...t}:{...e};(!r.transports||r.transports&&"string"==typeof r.transports[0])&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(t=>Y[t]).filter(t=>!!t)),super(s?r:t,r)}}ts.protocol;let tr="function"==typeof ArrayBuffer,ti=Object.prototype.toString,tn="function"==typeof Blob||"u">typeof Blob&&"[object BlobConstructor]"===ti.call(Blob),to="function"==typeof File||"u">typeof File&&"[object FileConstructor]"===ti.call(File);function ta(t){return tr&&(t instanceof ArrayBuffer||("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer))||tn&&t instanceof Blob||to&&t instanceof File}let th=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];(i=o||(o={}))[i.CONNECT=0]="CONNECT",i[i.DISCONNECT=1]="DISCONNECT",i[i.EVENT=2]="EVENT",i[i.ACK=3]="ACK",i[i.CONNECT_ERROR=4]="CONNECT_ERROR",i[i.BINARY_EVENT=5]="BINARY_EVENT",i[i.BINARY_ACK=6]="BINARY_ACK";class tl extends S{constructor(t){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},"function"==typeof t?{reviver:t}:t)}add(t){let e;if("string"==typeof t){if(this.reconstructor)throw Error("got plaintext data when reconstructing a packet");let s=(e=this.decodeString(t)).type===o.BINARY_EVENT;s||e.type===o.BINARY_ACK?(e.type=s?o.EVENT:o.ACK,this.reconstructor=new tc(e)):super.emitReserved("decoded",e)}else if(ta(t)||t.base64)if(this.reconstructor)(e=this.reconstructor.takeBinaryData(t))&&(this.reconstructor=null,super.emitReserved("decoded",e));else throw Error("got binary data when not reconstructing a packet");else throw Error("Unknown type: "+t)}decodeString(t){let e=0,s={type:Number(t.charAt(0))};if(void 0===o[s.type])throw Error("unknown packet type "+s.type);if(s.type===o.BINARY_EVENT||s.type===o.BINARY_ACK){let r=e+1;for(;"-"!==t.charAt(++e)&&e!=t.length;);let i=t.substring(r,e);if(i!=Number(i)||"-"!==t.charAt(e))throw Error("Illegal attachments");let n=Number(i);if(!tu(n)||n<1)throw Error("Illegal attachments");if(n>this.opts.maxAttachments)throw Error("too many attachments");s.attachments=n}if("/"===t.charAt(e+1)){let r=e+1;for(;++e&&","!==t.charAt(e)&&e!==t.length;);s.nsp=t.substring(r,e)}else s.nsp="/";let r=t.charAt(e+1);if(""!==r&&Number(r)==r){let r=e+1;for(;++e;){let s=t.charAt(e);if(null==s||Number(s)!=s){--e;break}if(e===t.length)break}s.id=Number(t.substring(r,e+1))}if(t.charAt(++e)){let r=this.tryParse(t.substr(e));if(tl.isPayloadValid(s.type,r))s.data=r;else throw Error("invalid payload")}return s}tryParse(t){try{return JSON.parse(t,this.opts.reviver)}catch(t){return!1}}static isPayloadValid(t,e){switch(t){case o.CONNECT:return tp(e);case o.DISCONNECT:return void 0===e;case o.CONNECT_ERROR:return"string"==typeof e||tp(e);case o.EVENT:case o.BINARY_EVENT:return Array.isArray(e)&&("number"==typeof e[0]||"string"==typeof e[0]&&-1===th.indexOf(e[0]));case o.ACK:case o.BINARY_ACK:return Array.isArray(e)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class tc{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){var e,s;let t=(e=this.reconPack,s=this.buffers,e.data=function t(e,s){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<s.length)return s[e.num];throw Error("illegal attachments")}if(Array.isArray(e))for(let r=0;r<e.length;r++)e[r]=t(e[r],s);else if("object"==typeof e)for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(e[r]=t(e[r],s));return e}(e.data,s),delete e.attachments,e);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}let tu=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t};function tp(t){return"[object Object]"===Object.prototype.toString.call(t)}function td(t,e,s){return t.on(e,s),function(){t.off(e,s)}}t.s(["Decoder",0,tl,"Encoder",0,class{constructor(t){this.replacer=t}encode(t){return(t.type===o.EVENT||t.type===o.ACK)&&function t(e,s){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let s=0,r=e.length;s<r;s++)if(t(e[s]))return!0;return!1}if(ta(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1==arguments.length)return t(e.toJSON(),!0);for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&t(e[s]))return!0;return!1}(t)?this.encodeAsBinary({type:t.type===o.EVENT?o.BINARY_EVENT:o.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let e=""+t.type;return(t.type===o.BINARY_EVENT||t.type===o.BINARY_ACK)&&(e+=t.attachments+"-"),t.nsp&&"/"!==t.nsp&&(e+=t.nsp+","),null!=t.id&&(e+=t.id),null!=t.data&&(e+=JSON.stringify(t.data,this.replacer)),e}encodeAsBinary(t){let e,s,r=(e=[],s=t.data,t.data=function t(e,s,r){if(!e)return e;if(ta(e)){let t={_placeholder:!0,num:s.length};return s.push(e),t}if(Array.isArray(e)){let r=Array(e.length);for(let i=0;i<e.length;i++)r[i]=t(e[i],s);return r}if("object"==typeof e&&!(e instanceof Date)){if(e.toJSON&&"function"==typeof e.toJSON&&!r)return t(e.toJSON(),s,!0);let i={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i[r]=t(e[r],s));return i}return e}(s,e),t.attachments=e.length,{packet:t,buffers:e}),i=this.encodeAsString(r.packet),n=r.buffers;return n.unshift(i),n}},"PacketType",0,o,"isPacketValid",0,function(t){var e;return"string"==typeof t.nsp&&(void 0===(e=t.id)||tu(e))&&function(t,e){switch(t){case o.CONNECT:return void 0===e||tp(e);case o.DISCONNECT:return void 0===e;case o.EVENT:return Array.isArray(e)&&("number"==typeof e[0]||"string"==typeof e[0]&&-1===th.indexOf(e[0]));case o.ACK:return Array.isArray(e);case o.CONNECT_ERROR:return"string"==typeof e||tp(e);default:return!1}}(t.type,t.data)},"protocol",0,5],51890);let tf=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class tg extends S{constructor(t,e,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=e,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let t=this.io;this.subs=[td(t,"open",this.onopen.bind(this)),td(t,"packet",this.onpacket.bind(this)),td(t,"error",this.onerror.bind(this)),td(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...e){var s,r,i;if(tf.hasOwnProperty(t))throw Error('"'+t.toString()+'" is a reserved event name');if(e.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(e),this;let n={type:o.EVENT,data:e};if(n.options={},n.options.compress=!1!==this.flags.compress,"function"==typeof e[e.length-1]){let t=this.ids++,s=e.pop();this._registerAckCallback(t,s),n.id=t}let a=null==(r=null==(s=this.io.engine)?void 0:s.transport)?void 0:r.writable,h=this.connected&&!(null==(i=this.io.engine)?void 0:i._hasPingExpired());return this.flags.volatile&&!a||(h?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(t,e){var s;let r=null!=(s=this.flags.timeout)?s:this._opts.ackTimeout;if(void 0===r){this.acks[t]=e;return}let i=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let e=0;e<this.sendBuffer.length;e++)this.sendBuffer[e].id===t&&this.sendBuffer.splice(e,1);e.call(this,Error("operation has timed out"))},r),n=(...t)=>{this.io.clearTimeoutFn(i),e.apply(this,t)};n.withError=!0,this.acks[t]=n}emitWithAck(t,...e){return new Promise((s,r)=>{let i=(t,e)=>t?r(t):s(e);i.withError=!0,e.push(i),this.emit(t,...e)})}_addToQueue(t){let e;"function"==typeof t[t.length-1]&&(e=t.pop());let s={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((t,...r)=>(this._queue[0],null!==t?s.tryCount>this._opts.retries&&(this._queue.shift(),e&&e(t)):(this._queue.shift(),e&&e(null,...r)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||0===this._queue.length)return;let e=this._queue[0];(!e.pending||t)&&(e.pending=!0,e.tryCount++,this.flags=e.flags,this.emit.apply(this,e.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){"function"==typeof this.auth?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:o.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,e){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,e),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(e=>String(e.id)===t)){let e=this.acks[t];delete this.acks[t],e.withError&&e.call(this,Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case o.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case o.EVENT:case o.BINARY_EVENT:this.onevent(t);break;case o.ACK:case o.BINARY_ACK:this.onack(t);break;case o.DISCONNECT:this.ondisconnect();break;case o.CONNECT_ERROR:this.destroy();let e=Error(t.data.message);e.data=t.data.data,this.emitReserved("connect_error",e)}}onevent(t){let e=t.data||[];null!=t.id&&e.push(this.ack(t.id)),this.connected?this.emitEvent(e):this.receiveBuffer.push(Object.freeze(e))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length)for(let e of this._anyListeners.slice())e.apply(this,t);super.emit.apply(this,t),this._pid&&t.length&&"string"==typeof t[t.length-1]&&(this._lastOffset=t[t.length-1])}ack(t){let e=this,s=!1;return function(...r){s||(s=!0,e.packet({type:o.ACK,id:t,data:r}))}}onack(t){let e=this.acks[t.id];"function"==typeof e&&(delete this.acks[t.id],e.withError&&t.data.unshift(null),e.apply(this,t.data))}onconnect(t,e){this.id=t,this.recovered=e&&this._pid===e,this._pid=e,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:o.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){let e=this._anyListeners;for(let s=0;s<e.length;s++)if(t===e[s]){e.splice(s,1);break}}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){let e=this._anyOutgoingListeners;for(let s=0;s<e.length;s++)if(t===e[s]){e.splice(s,1);break}}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length)for(let e of this._anyOutgoingListeners.slice())e.apply(this,t.data)}}var tm=t.i(51890);function ty(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}ty.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),s=Math.floor(e*this.jitter*t);t=(1&Math.floor(10*e))==0?t-s:t+s}return 0|Math.min(t,this.max)},ty.prototype.reset=function(){this.attempts=0},ty.prototype.setMin=function(t){this.ms=t},ty.prototype.setMax=function(t){this.max=t},ty.prototype.setJitter=function(t){this.jitter=t};class tv extends S{constructor(t,e){var s;super(),this.nsps={},this.subs=[],t&&"object"==typeof t&&(e=t,t=void 0),(e=e||{}).path=e.path||"/socket.io",this.opts=e,R(this,e),this.reconnection(!1!==e.reconnection),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor(null!=(s=e.randomizationFactor)?s:.5),this.backoff=new ty({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==e.timeout?2e4:e.timeout),this._readyState="closed",this.uri=t;const r=e.parser||tm;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=!1!==e.autoConnect,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return void 0===t?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var e;return void 0===t?this._reconnectionDelay:(this._reconnectionDelay=t,null==(e=this.backoff)||e.setMin(t),this)}randomizationFactor(t){var e;return void 0===t?this._randomizationFactor:(this._randomizationFactor=t,null==(e=this.backoff)||e.setJitter(t),this)}reconnectionDelayMax(t){var e;return void 0===t?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,null==(e=this.backoff)||e.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new ts(this.uri,this.opts);let e=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;let r=td(e,"open",function(){s.onopen(),t&&t()}),i=e=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",e),t?t(e):this.maybeReconnectOnOpen()},n=td(e,"error",i);if(!1!==this._timeout){let t=this._timeout,s=this.setTimeoutFn(()=>{r(),i(Error("timeout")),e.close()},t);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}return this.subs.push(r),this.subs.push(n),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let t=this.engine;this.subs.push(td(t,"ping",this.onping.bind(this)),td(t,"data",this.ondata.bind(this)),td(t,"error",this.onerror.bind(this)),td(t,"close",this.onclose.bind(this)),td(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(t){this.onclose("parse error",t)}}ondecoded(t){T(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,e){let s=this.nsps[t];return s?this._autoConnect&&!s.active&&s.connect():(s=new tg(this,t,e),this.nsps[t]=s),s}_destroy(t){for(let t of Object.keys(this.nsps))if(this.nsps[t].active)return;this._close()}_packet(t){let e=this.encoder.encode(t);for(let s=0;s<e.length;s++)this.engine.write(e[s],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,e){var s;this.cleanup(),null==(s=this.engine)||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,e),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let e=this.backoff.duration();this._reconnecting=!0;let s=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),t.skipReconnect||t.open(e=>{e?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",e)):t.onreconnect()}))},e);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){let t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}let tx={};function tb(t,e){let s;"object"==typeof t&&(e=t,t=void 0);let r=function(t,e="",s){let r=t;s=s||"u">typeof location&&location,null==t&&(t=s.protocol+"//"+s.host),"string"==typeof t&&("/"===t.charAt(0)&&(t="/"===t.charAt(1)?s.protocol+t:s.host+t),/^(https?|wss?):\/\//.test(t)||(t=void 0!==s?s.protocol+"//"+t:"https://"+t),r=Q(t)),!r.port&&(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";let i=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+e,r.href=r.protocol+"://"+i+(s&&s.port===r.port?"":":"+r.port),r}(t,(e=e||{}).path||"/socket.io"),i=r.source,n=r.id,o=r.path,a=tx[n]&&o in tx[n].nsps;return e.forceNew||e["force new connection"]||!1===e.multiplex||a?s=new tv(i,e):(tx[n]||(tx[n]=new tv(i,e)),s=tx[n]),r.query&&!e.query&&(e.query=r.queryKey),s.socket(r.path,e)}Object.assign(tb,{Manager:tv,Socket:tg,io:tb,connect:tb});var t_=t.i(69507);let tw=h.default.createContext(null);var tk=((n={}).REQUEST_CONFIGURATION="request-configuration",n.RESPONSE_CONFIGURATION="response-configuration",n.REQUEST_SYSTEM_DATA="request-system-data",n.RESPONSE_SYSTEM_DATA="response-system-data",n.REQUEST_DASHBOARD_DATA="request-dashboard-data",n.RESPONSE_DASHBOARD_DATA="response-dashboard-data",n.REQUEST_ANALYTICS_DATA="request-analytics-data",n.RESPONSE_ANALYTICS_DATA="response-analytics-data",n.REQUEST_HEALTH_DATA="request-health-data",n.RESPONSE_HEALTH_DATA="response-health-data",n);t.s(["ConnectionProvider",0,function({children:t}){let[e,s]=h.default.useState(!1),[r,i]=h.default.useState(!1),[n,o]=h.default.useState(null),l=h.default.useRef(null);function c(t,e){l.current?.on(t,e)}function u(t,e){l.current?.emit(t,e)}return h.default.useEffect(()=>{if(!r&&!e)return l.current&&(l.current.disconnect(),l.current=null),s(!1),i(!0),l.current=tb("http://localhost:3000",{transports:["websocket"],reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:1e3,reconnectionDelayMax:5e3,autoConnect:!0,timeout:2e4}),l.current.on("connect",()=>{s(!0),i(!1)}),l.current.on("disconnect",()=>{s(!1),l.current=null}),c("response-configuration",t=>{o(t)}),u("request-configuration",null),()=>{l.current?.disconnect(),l.current=null,s(!1),i(!1)}},[]),(0,a.jsx)(tw.Provider,{value:{isConnected:e,isConnecting:r,registerEventListener:c,unregisterEventListener:function(t,e){l.current?.off(t,e)},emit:u,configuration:n},children:r?(0,a.jsx)(t_.default,{text:"Connecting..."}):t})},"WebSocketEvents",()=>tk,"useConnection",0,function(){let t=h.default.useContext(tw);if(!t)throw Error("useConnection must be used within a ConnectionProvider");return t}],11350)},65327,t=>{"use strict";var e=t.i(43476),s=t.i(71645),r=t.i(11350);let i=(t,e)=>parseFloat((Math.random()*(e-t)+t).toFixed(2)),n=(t,e,s)=>Array.from({length:t},()=>i(e,s)),o=s.default.createContext(null);t.s(["MetricsProvider",0,function({children:t}){let{isConnected:a,registerEventListener:h,emit:l}=(0,r.useConnection)(),[c,u]=s.default.useState({systemStatus:{connectionStatus:"ONLINE",healthStatus:"HEALTHY",webSocketStatus:"DISCONNECTED"},systemInfo:{nodeVersion:"v0.0.0",uptime:800,env:"development"},dashboard:{current:{rps:i(200,34e4),latency:i(100,500),errorRate:i(0,.1),eventLoopLag:i(0,100),heapUsage:i(50,200),heapSize:i(100,500)},history:{rps:n(30,50,200),latency:n(30,100,500),errorRate:n(30,0,.1),eventLoopLag:n(30,0,100),heapUsage:n(30,50,200),heapSize:n(30,100,500),rssMemory:n(30,0,1e3),totalHeap:n(30,0,1e3),p95:n(30,0,100),p99:n(30,0,100)},impactEndpoints:[{method:"GET",route:"/api/v1/users",rps:i(50,200),p95:i(100,500),p99:i(0,100),errorRate:i(0,.1),status:"OK",requestCount:i(1e3,5e3),averageLatency:i(100,500)},{method:"POST",route:"/api/v1/orders",rps:i(50,200),p95:i(100,500),p99:i(0,100),errorRate:i(0,.1),status:"OK",requestCount:i(1e3,5e3),averageLatency:i(100,500)}],alerts:[{title:"High error rate detected",timestamp:new Date().toISOString(),severity:"warning"},{title:"Latency spike detected",timestamp:new Date().toISOString(),severity:"critical"},{title:"New endpoint added",timestamp:new Date().toISOString(),severity:"info"},{title:"Server memory usage high",timestamp:new Date().toISOString(),severity:"advisory"}],charts:{throughput:{rps:n(30,50,200),errorClient:n(30,0,100),errorServer:n(30,0,100),totalCount:i(1e3,5e3)},percentiles:{p50:n(30,0,100),p95:n(30,0,100),p99:n(30,0,100),totalCount:i(1e3,5e3)},runtimePerformance:{heapUsage:n(30,50,200),heapSize:n(30,100,500),lag:n(30,0,100),totalCount:i(1e3,5e3)}}},analytics:{summary:{totalEndpoints:i(10,50),healthyEndpoints:i(5,25),slowEndpoints:i(0,5),slowEndpointsThreshold:parseFloat(i(100,500).toFixed(0)),errorEndpoints:i(0,5)},latencyDistribution:[{endpoint:"endpoint1",p50:i(0,100),p95:i(0,100),p99:i(0,100)},{endpoint:"endpoint2",p50:i(0,100),p95:i(0,100),p99:i(0,100)},{endpoint:"endpoint3",p50:i(0,100),p95:i(0,100),p99:i(0,100)}],requestVolume:[],history:[],endpointsTable:{data:[{method:"endpoint1",route:"/api/v1/endpoint1",rps:i(0,100),p95:i(0,100),p99:i(0,100),errorRate:i(0,100),status:"healthy",requestCount:i(1e3,8e3),averageLatency:i(0,100)},{method:"endpoint2",route:"/api/v1/endpoint2",rps:i(0,100),p95:i(0,100),p99:i(0,100),errorRate:i(0,100),status:"healthy",requestCount:i(0,1e3),averageLatency:i(0,100)}],pagination:{page:1,pageSize:10,perPageCount:2,totalCount:2}}},health:{cpu:{usageRate:12.5,numberOfCores:8,perCoreUsage:n(30,0,100),userUsage:12.5,systemUsage:40,idleUsage:47.5},memory:{heapUsage:i(0,1e3),heapSize:1e3,rssMemory:i(0,16e3),rssMemoryTotal:16e3,externalMemory:i(0,1e3)},eventLoop:{lag:i(0,200),threshold:200},handles:{activeHandles:i(0,100),activeHandlesTimers:i(0,100),activeHandlesSockets:i(0,100),activeLibuvHandles:i(0,100),timers:i(0,100),fileDescriptors:i(0,100)},garbageCollection:{gcCount:i(0,100),gcTime:i(0,1e3),gcPauseAverage:i(0,100),minorGC:{runCount:i(0,100),averageTime:i(0,100)},majorGC:{runCount:i(0,100),averageTime:i(0,100)},incrementalGC:{runCount:i(0,100),averageTime:i(0,100)},heapSpaces:[],gcTotals:{totalPauseTime:i(0,1e3),freedMemory:i(0,1e3),promotions:i(0,100),tenuredSize:i(0,100)}},runtime:{pid:i(1e3,1e4),platform:"linux",nodeVersion:"14.15.0",v8Version:"8.1.381.32",libuvVersion:"1.40.0",openSSLVersion:"1.1.1j",threadPoolSize:i(1,16),activeThreads:i(1,16),startup:{bootstrapTime:i(0,1e3),requiredModules:i(0,100)}},history:{eventLoopLag:n(30,0,100),memoryBreakdown:{usedHeap:n(30,0,1e3),totalHeap:n(30,0,1e3),rssMemory:n(30,0,1e3)}}}}),[p,d]=s.default.useState({method:"ALL",status:"ALL"});return s.default.useEffect(()=>{if(a)try{h(r.WebSocketEvents.RESPONSE_SYSTEM_DATA,t=>{u(e=>({...e,systemInfo:t}))}),h(r.WebSocketEvents.RESPONSE_DASHBOARD_DATA,t=>{u(e=>({...e,dashboard:t}))}),h(r.WebSocketEvents.RESPONSE_ANALYTICS_DATA,t=>{u(e=>({...e,analytics:t}))}),h(r.WebSocketEvents.RESPONSE_HEALTH_DATA,t=>{u(e=>({...e,health:t}))}),l(r.WebSocketEvents.REQUEST_SYSTEM_DATA,null),l(r.WebSocketEvents.REQUEST_DASHBOARD_DATA,null),l(r.WebSocketEvents.REQUEST_ANALYTICS_DATA,p),l(r.WebSocketEvents.REQUEST_HEALTH_DATA,null)}catch(t){console.error("Error fetching system status:",t)}},[a]),(0,e.jsx)(o.Provider,{value:{data:c},children:t})},"useMetrics",0,function(){let t=s.default.useContext(o);if(!t)throw Error("useMetrics must be used within a MetricsProvider");return t}],65327)},52446,t=>{"use strict";var e=t.i(43476),s=t.i(71645),r=t.i(69507);let i=s.default.createContext(null);t.s(["GateProvider",0,function({children:t}){let[n,o]=s.default.useState("/"),[a,h]=s.default.useState(!1),[l,c]=s.default.useState("Loading...");return s.default.useEffect(()=>{let t=()=>{o(window.location.hash.replace("#","")||"/")};return t(),window.addEventListener("hashchange",t),()=>window.removeEventListener("hashchange",t)},[]),(0,e.jsx)(i.Provider,{value:{activeTab:n,displayLoadingGate:function(t){c(t||"Loading..."),h(!0)},clearLoadingGate:function(){h(!1),c("Loading...")}},children:(0,e.jsx)("html",{lang:"sr",children:(0,e.jsx)("body",{className:"flex min-h-screen text-brand-50 antialiased",children:a?(0,e.jsx)(r.default,{text:l}):t})})})},"useGate",0,function(){let t=s.default.useContext(i);if(!t)throw Error("useGate must be used within a GateProvider");return t}])}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,42775,e=>{"use strict";var t=e.i(43476),s=e.i(84789);function a({data:e}){let r,{width:l,height:o,isHydrated:i}=(0,s.useSize)("line-showcase"),n=0===(r=Math.max(...e.points.map(e=>e.y)))?1:r,c=n+(n-0)*.1,d=0-(n-0)*.1,x=e.points.map(e=>({x:e.x,y:(e.y-d)/(c-d)*.5})),u=x.map((e,t)=>{let s=t/(x.length-1)*l,a=o-e.y*o;return`${s},${a}`}).join(" ");return(0,t.jsx)("div",{className:"w-full h-16 rounded-md",id:"line-showcase",children:i&&(0,t.jsx)("svg",{className:"w-full h-full",children:(0,t.jsx)("polyline",{fill:"none",stroke:e.color,strokeWidth:"2",points:u})})})}var r=e.i(71645),l=e.i(74080);function o({children:e,content:s}){let[a,i]=(0,r.useState)(!1),[n,c]=(0,r.useState)({top:0,bottom:0,left:0,arrowX:"50%"}),[d,x]=(0,r.useState)(!1),u=(0,r.useRef)(null),m=(0,r.useRef)(null);(0,r.useEffect)(()=>(x(!0),()=>x(!1)),[]);let p=()=>{if(!u.current)return;let e=u.current.getBoundingClientRect(),t=e.left+e.width/2,s=m.current?m.current.offsetWidth:200,a=m.current?m.current.offsetHeight:44,r=t-s/2;r<12?r=12:r+s>window.innerWidth-12&&(r=window.innerWidth-s-12);let l=t-r;c({top:e.top+window.scrollY-a-8,bottom:e.bottom+window.scrollY+8,left:r+window.scrollX,arrowX:`${l}px`})};(0,r.useEffect)(()=>{if(a){p();let e=setTimeout(p,0);return window.addEventListener("scroll",p),window.addEventListener("resize",p),()=>{clearTimeout(e),window.removeEventListener("scroll",p),window.removeEventListener("resize",p)}}},[a]);let h=()=>i(!0),f=()=>i(!1);return(0,t.jsxs)(t.Fragment,{children:[r.default.cloneElement(e,{ref:t=>{u.current=t;let{ref:s}=e;"function"==typeof s?s(t):s&&(s.current=t)},onMouseEnter:h,onMouseLeave:f,onFocus:h,onBlur:f}),a&&d&&(0,l.createPortal)((0,t.jsxs)("div",{ref:m,style:{position:"absolute",top:`${n.bottom}px`,left:`${n.left}px`},className:"z-[9999] pointer-events-none bg-black text-white text-xs px-3 py-2 rounded shadow-xl max-w-[220px] break-words text-center leading-relaxed",children:[(0,t.jsx)("div",{style:{left:n.arrowX},className:"absolute bottom-full -translate-x-1/2 w-2 h-2 rotate-45 bg-black -mb-1"}),s]}),document.body)]})}e.i(49645);var i=e.i(92432),i=i;function n({title:e,timestamp:s,isFolded:a,onToggle:r,tooltip:l}){return(0,t.jsxs)("div",{className:"flex items-center justify-between mb-1 cursor-pointer p-2 border-b-1 border-accent-soft",onClick:r,children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-accent",children:e}),(0,t.jsx)("p",{className:"text-xs text-accent-soft",children:s}),l&&(0,t.jsx)(o,{content:l,children:(0,t.jsx)(i.default,{className:"w-4 h-4 text-accent cursor-pointer"})})]})}function c({header:e,children:s,padding:a}){let[l,o]=r.default.useState(!1);return(0,t.jsxs)("div",{className:"bg-[var(--variant-1)] border border-[var(--variant-3)] rounded-md animate-fade-in",children:[e&&(0,t.jsx)(n,{title:e.title,timestamp:e.description||"",isFolded:l,onToggle:()=>{o(!l)},tooltip:e.tooltip}),(0,t.jsx)("div",{className:`justify-between ${a?"p-3":""}`,children:!l&&s})]})}var i=i;function d({children:e,header:s}){return(0,t.jsx)(c,{header:s,padding:!0,children:e})}function x({title:e,value:s,unit:a="",color:r="accent",tooltip:l}){let n="number"==typeof s?s.toFixed(2):s;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-accent",children:e}),l&&(0,t.jsx)(o,{content:l,children:(0,t.jsx)(i.default,{className:"w-4 h-4 text-accent cursor-pointer"})})]}),(0,t.jsxs)("p",{className:"text-2xl font-bold",style:r?{color:r}:void 0,children:[n,a&&(0,t.jsxs)("span",{className:"text-sm text-gray-400",children:[" ",a]})]})]})}function u({variant:e="default",values:s}){return"default"===e?(0,t.jsx)("div",{className:"mt-2 mb-2 space-y-1",children:s&&Object.entries(s).map(([e,s])=>(0,t.jsxs)("div",{className:"flex justify-between text-sm text-accent-soft",children:[(0,t.jsxs)("p",{className:"text-sm text-accent-soft",children:[e,":"]}),(0,t.jsx)("span",{children:s})]},e))}):(0,t.jsx)(t.Fragment,{children:s&&Object.entries(s).map(([e,s])=>(0,t.jsxs)("div",{className:"flex flex-row justify-between h-full",children:[(0,t.jsx)("span",{className:"text-[10px] text-foreground uppercase tracking-wider font-semibold block mb-1",children:e}),(0,t.jsx)("span",{className:"text-[10px] text-foreground-soft uppercase tracking-wider font-semibold block mb-1 ml-2",children:s})]},e))})}let m=e=>null==e?"0":e>=1e3?(e/1e3).toFixed(1).replace(/\.0$/,"")+"k":e>=1e6?(e/1e6).toFixed(1).replace(/\.0$/,"")+"m":e.toString();function p({data:e}){return(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-4",children:[(0,t.jsxs)(d,{children:[(0,t.jsx)(x,{title:"CURRENT RPS",value:m(e.current.rps),unit:"req/s",color:"var(--chart-6)",tooltip:"The number of HTTP requests processed by the server during the last measurement interval. Higher values indicate increased traffic."}),(0,t.jsx)(a,{data:{points:e.history.rps.map((e,t)=>({x:t,y:e})),color:"var(--chart-6)",type:"solid"}})]}),(0,t.jsxs)(d,{children:[(0,t.jsx)(x,{title:"AVG LATENCY",value:e.current.latency,unit:"ms",color:"var(--chart-2)",tooltip:"Average response time of all processed requests. Shows how long users wait for server responses."}),(0,t.jsx)(a,{data:{points:e.history.latency.map((e,t)=>({x:t,y:e})),color:"var(--chart-2)",type:"solid"}})]}),(0,t.jsxs)(d,{children:[(0,t.jsx)(x,{title:"ERROR RATE",value:e.current.errorRate,unit:"%",color:"var(--chart-5)",tooltip:"Percentage of requests that failed with an HTTP error response. Includes client errors (4xx) and server errors (5xx)."}),(0,t.jsx)(a,{data:{points:e.history.errorRate.map((e,t)=>({x:t,y:e})),color:"var(--chart-5)",type:"solid"}})]}),(0,t.jsxs)(d,{children:[(0,t.jsx)(x,{title:"EVENT LOOP LAG",value:e.current.eventLoopLag,unit:"ms",color:"var(--chart-4)",tooltip:"Delay between scheduled Node.js tasks and their actual execution time. High values indicate that the server is blocked by CPU-heavy operations or synchronous code."}),(0,t.jsx)(a,{data:{points:e.history.eventLoopLag.map((e,t)=>({x:t,y:e})),color:"var(--chart-4)",type:"solid"}})]}),(0,t.jsxs)(d,{children:[(0,t.jsx)(x,{title:"HEAP USAGE",value:e.current.heapUsage,color:"var(--chart-1)",unit:"MB",tooltip:"Current JavaScript heap memory usage compared to the allocated heap limit."}),(0,t.jsx)(a,{data:{points:e.history.heapUsage.map((e,t)=>({x:t,y:e})),color:"var(--chart-1)",type:"solid"}})]})]})}e.i(17508);var h=e.i(12656),f=e.i(71034),g=e.i(55803);e.i(3203),e.i(20530),e.i(44802);var v=g;function j({data:e}){return(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4",children:[(0,t.jsx)(c,{header:{title:"Throughput",description:"Requests per second",tooltip:"The number of HTTP requests processed by the server during the last measurement interval. Higher values indicate increased traffic."},children:(0,t.jsx)(v.default,{data:[{points:e.history.rps.map((e,t)=>({x:t,y:e})),color:"var(--chart-6)",type:"solid",label:"RPS"},{points:e.charts.throughput.errorClient.map((e,t)=>({x:t,y:e})),color:"var(--chart-4)",type:"dashed",label:"Client Errors (4xx)"},{points:e.charts.throughput.errorServer.map((e,t)=>({x:t,y:e})),color:"var(--chart-5)",type:"dashed",label:"Server Errors (5xx)"}],withDots:!1})}),(0,t.jsx)(c,{header:{title:"Latency",description:"Response time percentiles",tooltip:"Percentile response times. Shows how fast most users experience the system. Example: 50% of users waited less than 30ms, 95% waited less than 100ms, and 99% waited less than 200ms."},children:(0,t.jsx)(v.default,{data:[{points:e.charts.percentiles.p50.map((e,t)=>({x:t,y:e})),color:"var(--chart-1)",type:"dashed",label:"P50 ms",fillArea:!1},{points:e.charts.percentiles.p95.map((e,t)=>({x:t,y:e})),color:"var(--chart-2)",type:"dashed",label:"P95 ms",fillArea:!1},{points:e.charts.percentiles.p99.map((e,t)=>({x:t,y:e})),color:"var(--chart-4)",type:"dashed",label:"P99 ms",fillArea:!1}],withDots:!1})}),(0,t.jsx)(c,{header:{title:"Memory Usage",description:"Heap memory usage and size",tooltip:"Current JavaScript heap memory usage compared to the allocated heap limit."},children:(0,t.jsx)(v.default,{data:[{points:e.charts.runtimePerformance.heapUsage.map((e,t)=>({x:t,y:e})),color:"var(--chart-1)",type:"solid",label:"heapUsed",fillArea:!1},{points:e.charts.runtimePerformance.heapSize.map((e,t)=>({x:t,y:e})),color:"var(--chart-2)",type:"dashed",label:"heapTotal"}],withDots:!1})}),(0,t.jsx)(c,{header:{title:"Event Loop Lag",description:"Event loop lag over time",tooltip:"Delay between scheduled Node.js tasks and their actual execution time. High values indicate that the server is blocked by CPU-heavy operations or synchronous code."},children:(0,t.jsx)(v.default,{data:[{points:e.charts.runtimePerformance.lag.map((e,t)=>({x:t,y:e})),color:"var(--chart-4)",type:"solid",label:"lag",fillArea:!1}],withDots:!1})})]})}function b({title:e,timestamp:s,type:a}){return(0,t.jsxs)("div",{className:`flex flex-col items-left justify-between p-2 border-l-3 ${function(e){switch(e){case"info":return"border-[var(--chart-6)]";case"advisory":return"border-[var(--chart-3)]";case"warning":return"border-[var(--chart-4)]";case"critical":return"border-[var(--chart-5)]";default:return"border-[var(--chart-1)]"}}(a)} m-2`,children:[(0,t.jsx)("p",{className:"text-sm text-foreground",children:e}),(0,t.jsxs)("p",{className:"text-xs text-accent-soft",children:[s," * ",a]})]})}function y({columns:e,data:s}){return(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"min-w-full divide-y divide-border",children:[(0,t.jsx)("thead",{children:(0,t.jsx)("tr",{children:e.map((e,s)=>(0,t.jsx)("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-accent-soft uppercase tracking-wider",children:e},s))})}),(0,t.jsx)("tbody",{className:"divide-y divide-border",children:s.map((s,a)=>(0,t.jsx)("tr",{children:e.map((e,a)=>(0,t.jsx)("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-accent-soft",children:s[e]},a))},a))})]})})}function w({data:e}){return(0,t.jsx)(c,{header:{title:"Live Alerts",description:"Stream"},children:e.map((e,s)=>(0,t.jsx)(b,{title:e.title,timestamp:e.timestamp,type:e.severity},s))})}function N({data:e}){let s=e.map(e=>({METHOD:e.method,ROUTE:e.route,RPS:e.rps,P95:`${e.p95?.toFixed(2)} ms`,"ERR%":`${e.errorRate?.toFixed(2)} %`,STATUS:e.status}));return(0,t.jsx)(c,{header:{title:"Top routes by Impact",description:"Volume"},children:(0,t.jsx)(y,{columns:["METHOD","ROUTE","RPS","P95","ERR%","STATUS"],data:s})})}function T({data:e}){return(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-4 mt-4",children:[(0,t.jsx)("div",{className:"col-span-3 md:col-span-3",children:(0,t.jsx)(N,{data:e.impactEndpoints})}),(0,t.jsx)("div",{className:"col-span-2 md:col-span-2",children:(0,t.jsx)(w,{data:e.alerts})})]})}var S=e.i(65327);function C(){let{data:e}=(0,S.useMetrics)(),{dashboard:s}=e;return(0,t.jsxs)("div",{className:"p-6",children:[(0,t.jsx)(p,{data:s}),(0,t.jsx)(j,{data:s}),(0,t.jsx)(T,{data:s})]})}function E({data:e}){let[s,a]=r.default.useState(0),l=e.latencyDistribution.slice(5*s,(s+1)*5);return(0,t.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-6",children:(0,t.jsxs)(c,{header:{title:"Latency Distribution",description:"P50 * P95 * P99"},children:[(0,t.jsx)(f.default,{categories:l.map(e=>e.endpoint),data:[{label:"P50",values:l.map(e=>e.p50),color:"var(--chart-3)"},{label:"P95",values:l.map(e=>e.p95),color:"var(--chart-4)"},{label:"P99",values:l.map(e=>e.p99),color:"var(--chart-5)"}]}),(0,t.jsxs)("div",{className:"flex justify-center gap-2 mb-2",children:[(0,t.jsx)("button",{className:"px-2 bg-background text-foreground rounded disabled:opacity-50",onClick:()=>a(e=>Math.max(e-1,0)),disabled:0===s,children:"<"}),(0,t.jsx)("button",{className:"px-2 bg-background text-foreground rounded disabled:opacity-50",onClick:()=>a(e=>e+1),disabled:(s+1)*5>=e.latencyDistribution.length,children:">"})]})]})})}function P({data:e}){return(0,t.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[(0,t.jsx)(d,{children:(0,t.jsx)(x,{title:"Total Endpoints",value:e.summary.totalEndpoints,tooltip:"The total number of unique API endpoints that have been accessed by clients."})}),(0,t.jsx)(d,{children:(0,t.jsx)(x,{title:"Healthy Endpoints",value:e.summary.healthyEndpoints,color:"var(--chart-3)",tooltip:"The number of API endpoints that are currently healthy and responding successfully to client requests."})}),(0,t.jsx)(d,{children:(0,t.jsx)(x,{title:`Slow Endpoints (>${e.summary.slowEndpointsThreshold}ms)`,value:e.summary.slowEndpoints,color:"var(--chart-4)",tooltip:`The number of API endpoints that have an average response time exceeding ${e.summary.slowEndpointsThreshold} milliseconds.`})}),(0,t.jsx)(d,{children:(0,t.jsx)(x,{title:"High Error Rate",value:e.summary.errorEndpoints,color:"var(--chart-5)",tooltip:"The number of API endpoints that are currently experiencing a high error rate, indicating potential issues with the server or application."})})]})}function L({settings:e,onChange:s}){return(0,t.jsx)(c,{padding:!0,children:(0,t.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:flex lg:flex-row gap-4 items-end w-full",children:[(0,t.jsx)("div",{className:"w-full sm:col-span-2 lg:flex-1",children:(0,t.jsx)("input",{type:"text",placeholder:"Search...",className:"w-full bg-background text-foreground px-3 py-2 rounded-md border border-border focus:outline-none focus:border-accent text-sm"})}),(0,t.jsxs)("div",{className:"flex flex-col w-full lg:w-40",children:[(0,t.jsx)("span",{className:"text-[10px] font-bold text-accent-soft tracking-wider mb-1 uppercase",children:"METHOD"}),(0,t.jsx)("select",{className:"w-full bg-background text-foreground px-3 py-2 rounded-md border border-border focus:outline-none focus:border-accent text-sm cursor-pointer",onChange:e=>s&&s({method:e.target.value}),children:["ALL","GET","POST","PUT","DELETE"].map(e=>(0,t.jsx)("option",{value:e,children:e},e))})]}),(0,t.jsxs)("div",{className:"flex flex-col w-full lg:w-40",children:[(0,t.jsx)("span",{className:"text-[10px] font-bold text-accent-soft tracking-wider mb-1 uppercase",children:"STATUS"}),(0,t.jsx)("select",{className:"w-full bg-background text-foreground px-3 py-2 rounded-md border border-border focus:outline-none focus:border-accent text-sm cursor-pointer",onChange:e=>s&&s({status:e.target.value}),children:["ALL","2xx","4xx","5xx"].map(e=>(0,t.jsx)("option",{value:e,children:e},e))})]})]})})}function M({data:e}){return(0,t.jsx)(c,{padding:!0,children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"min-w-full divide-y divide-border",children:[(0,t.jsx)("thead",{children:(0,t.jsx)("tr",{children:["#","Method","Route","Req Count","Avg Latency","P95","P99","Error Percentage"].map(e=>(0,t.jsx)("th",{className:"px-6 py-3 text-left text-xs font-medium text-accent-soft uppercase tracking-wider",children:e},e))})}),(0,t.jsx)("tbody",{className:"divide-y divide-border",children:e.data.map((e,s)=>(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-accent-soft",children:s+1}),(0,t.jsx)("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-accent-soft",children:e.method}),(0,t.jsx)("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-accent-soft",children:e.route}),(0,t.jsx)("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-accent-soft",children:m(e.requestCount)}),(0,t.jsxs)("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-accent-soft",children:[e.averageLatency?.toFixed(2)," ms"]}),(0,t.jsxs)("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-accent-soft",children:[e.p95?.toFixed(2)," ms"]}),(0,t.jsxs)("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-accent-soft",children:[e.p99?.toFixed(2)," ms"]}),(0,t.jsxs)("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-accent-soft",children:[e.errorRate?.toFixed(2),"%"]})]},s))})]})})})}function k({data:e}){let s=e.pagination.page,a=[s-2,s-1,s,s+1,s+2].filter(t=>t>0&&t<=e.pagination.totalCount/e.pagination.perPageCount);return(0,t.jsxs)("div",{className:"flex justify-between items-center mt-4",children:[(0,t.jsxs)("span",{className:"text-sm text-accent-soft",children:["Showing ",e.data.length," of ",e.pagination.totalCount," entries"]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)("button",{className:"bg-card text-foreground px-3 py-1 rounded-md",children:"Previous"}),a.map(e=>(0,t.jsx)("button",{className:`bg-card text-foreground px-3 py-1 rounded-md ${e===s?"bg-[#3B82F6]":""}`,children:e},e)),(0,t.jsx)("button",{className:"bg-card text-foreground px-3 py-1 rounded-md",children:"Next"})]})]})}function R({data:e,filters:s,onFilterChange:a}){return(0,t.jsxs)("div",{className:"flex flex-col gap-4 pt-4 md:mt-0 md:col-span-2",children:[(0,t.jsx)(L,{settings:s,onChange:a}),(0,t.jsx)(M,{data:e.endpointsTable}),(0,t.jsx)(k,{data:e.endpointsTable})]})}function A(){let{data:e}=(0,S.useMetrics)(),{analytics:s}=e;return(0,t.jsxs)("div",{className:"p-6",children:[(0,t.jsx)(P,{data:s}),(0,t.jsx)(E,{data:s}),(0,t.jsx)(R,{data:s,filters:{method:"ALL",status:"ALL"},onFilterChange:e=>{console.log("Filter settings changed:",e)}})]})}function $({data:e,maxValue:s,color:a="var(--chart-6)"}){if(!e||0===e.length||e.every(e=>0===e.value))return null;let r=s??e.reduce((e,t)=>e+t.value,0);return(0,t.jsx)("div",{className:"w-full bg-[var(--variant-3)] rounded-full h-[10px] flex overflow-hidden",children:e.map((e,s)=>{let l=e.value/r*100;return l<=0?null:(0,t.jsx)("div",{className:"h-full transition-all duration-500 ease-in-out",style:{width:`${l}%`,backgroundColor:e.color||a},title:`${e.label}: ${e.value}`},s)})})}function U({data:e}){let s=[{label:"RSS Memory",value:`${e.memory.rssMemory.toFixed(2)} MB`,sublabel:`/ ${e.memory.rssMemoryTotal.toFixed(2)} MB total`,color:"var(--chart-1)"},{label:"External Memory",value:`${e.memory.externalMemory.toFixed(2)} MB`,sublabel:"native C++ objects",color:"var(--chart-2)"},{label:"GC Pause Average",value:`${e.garbageCollection.gcPauseAverage.toFixed(2)} ms`,sublabel:"milliseconds",color:"var(--chart-3)"},{label:"Active Handles",value:`${e.handles.activeHandles}`,sublabel:`timers: ${e.handles.activeHandlesTimers} * sockets: ${e.handles.activeHandlesSockets}`,color:"var(--chart-4)"}];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,t.jsxs)(d,{children:[(0,t.jsx)(x,{title:"CPU Usage",value:e.cpu.usageRate,unit:"%",color:"[var(--chart-6)]"}),(0,t.jsx)($,{data:[{label:"User",value:e.cpu.userUsage,color:"var(--chart-5)"},{label:"System",value:e.cpu.systemUsage,color:"var(--chart-1)"}],maxValue:100}),(0,t.jsx)(u,{values:{"Number of Cores":e.cpu.numberOfCores.toString(),"User Usage":`${e.cpu.userUsage.toFixed(2)}%`,"System Usage":`${e.cpu.systemUsage.toFixed(2)}%`,"Idle Usage":`${e.cpu.idleUsage.toFixed(2)}%`}})]}),(0,t.jsxs)(d,{children:[(0,t.jsx)(x,{title:"Heap Usage",value:e.memory.heapUsage,unit:"MB",color:"[var(--chart-2)]"}),(0,t.jsx)($,{data:[{label:"Heap Usage",value:e.memory.heapUsage,color:"var(--chart-2)"}],maxValue:e.memory.heapSize}),(0,t.jsx)(u,{values:{"Heap Size":`${e.memory.heapSize.toFixed(2)} MB`,"External Memory":`${e.memory.externalMemory.toFixed(2)} MB`}}),(0,t.jsx)($,{data:[{label:"RSS Memory",value:e.memory.rssMemory,color:"var(--chart-5)"}],maxValue:e.memory.rssMemoryTotal}),(0,t.jsx)(u,{values:{"RSS Memory":`${e.memory.rssMemory.toFixed(2)} MB`,"RSS Memory Total":`${e.memory.rssMemoryTotal.toFixed(2)} MB`}})]}),(0,t.jsxs)(d,{children:[(0,t.jsx)(x,{title:"Event Loop Lag",value:e.eventLoop.lag,unit:"ms",color:"[var(--chart-4)]"}),(0,t.jsx)($,{data:[{label:"Event Loop Lag",value:e.eventLoop.lag,color:"var(--chart-4)"}],maxValue:e.eventLoop.threshold}),(0,t.jsx)(u,{values:{Threshold:`${e.eventLoop.threshold} ms`}})]})]}),(0,t.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mt-4",children:s.map((e,s)=>(0,t.jsxs)(c,{padding:!0,children:[(0,t.jsx)("h2",{className:"text-lg font-semibold text-foreground mb-2",children:e.label}),(0,t.jsx)("p",{className:`text-2xl font-bold text-[${e.color}] mb-1`,children:e.value}),(0,t.jsx)("div",{className:"flex justify-between text-sm text-accent-soft",children:(0,t.jsx)("span",{children:e.sublabel})})]},s))})]})}var v=g;function F({data:e}){return(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4",children:[(0,t.jsx)(c,{header:{title:"Event Loop Lag",description:"Event loop lag over time",tooltip:"The event loop lag indicates how long it takes for the Node.js event loop to process events. A higher lag may indicate that the server is under heavy load or that there are blocking operations."},children:(0,t.jsx)(v.default,{data:[{label:"Event Loop Lag",points:e.history.eventLoopLag.map((e,t)=>({x:t,y:e})),color:"var(--chart-3)",type:"solid",fillArea:!1}],withDots:!1})}),(0,t.jsx)(c,{header:{title:"Heap Memory Usage",description:"Heap memory usage over time",tooltip:"Heap memory is the memory used by the JavaScript engine to store objects, strings, and other data. This graph shows the amount of heap memory used over time."},children:(0,t.jsx)(v.default,{data:[{label:"Used",points:e.history.memoryBreakdown.usedHeap.map((e,t)=>({x:t,y:e})),color:"var(--chart-3)",type:"solid",fillArea:!1},{label:"Total",points:e.history.memoryBreakdown.totalHeap.map((e,t)=>({x:t,y:e})),color:"var(--chart-2)",type:"dashed",fillArea:!1},{label:"RSS",points:e.history.memoryBreakdown.rssMemory.map((e,t)=>({x:t,y:e})),color:"var(--chart-4)",type:"solid",fillArea:!1}],withDots:!1})})]})}function H({type:e="horizontal"}){return(0,t.jsx)("div",{className:`w-full ${"horizontal"===e?"h-px my-2":"h-full w-px mx-2"} bg-gray-300 dark:bg-gray-700`})}function B({title:e,value:s}){return(0,t.jsxs)("div",{className:"flex flex-row justify-between h-full",children:[(0,t.jsx)("span",{className:"text-[10px] text-foreground uppercase tracking-wider font-semibold block mb-1",children:e}),(0,t.jsx)("span",{className:"text-[10px] text-foreground-soft uppercase tracking-wider font-semibold block mb-1 ml-2",children:s})]})}function D({data:e}){let s=[["PID",e.runtime.pid],["Platform",e.runtime.platform],["NODE.JS",e.runtime.nodeVersion],["V8 ENGINE",e.runtime.v8Version],["LIBUV",e.runtime.libuvVersion],["OPENSSL",e.runtime.openSSLVersion]];return(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mt-4",children:[(0,t.jsx)(d,{header:{title:"CPU Per Core Utilization"},children:(0,t.jsx)(h.default,{data:e.cpu.perCoreUsage,binCount:e.cpu.perCoreUsage.length,label:"CPU Usage (%)"})}),(0,t.jsxs)(d,{header:{title:"Garbage Collection"},children:[(0,t.jsx)(u,{variant:"accent",values:{"Minor GC (SCAVENGE)":`Run Count: ${e.garbageCollection.minorGC.runCount} Total Time: ${e.garbageCollection.minorGC.averageTime.toFixed(2)} ms`,"Major GC (MARK_SWEEP)":`Run Count: ${e.garbageCollection.majorGC.runCount} Total Time: ${e.garbageCollection.majorGC.averageTime.toFixed(2)} ms`,"Incremental GC (INCREMENTAL_MARKING)":`Run Count: ${e.garbageCollection.incrementalGC.runCount} Total Time: ${e.garbageCollection.incrementalGC.averageTime.toFixed(2)} ms`}}),(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4",children:[(0,t.jsx)(c,{padding:!0,children:(0,t.jsxs)("div",{className:"flex flex-col justify-between h-full",children:[(0,t.jsx)("p",{className:"text-[10px] text-accent-soft uppercase tracking-wider font-semibold block",children:"HEAP SPACES"}),e.garbageCollection.heapSpaces.map((e,s)=>(0,t.jsx)(B,{title:e.label,value:`${e.used.toFixed(2)} MB`},s))]})}),(0,t.jsx)(c,{padding:!0,children:(0,t.jsxs)("div",{className:"flex flex-col justify-between h-full",children:[(0,t.jsx)("p",{className:"text-[10px] text-accent-soft uppercase tracking-wider font-semibold block",children:"GC TOTALS"}),(0,t.jsx)(u,{variant:"accent",values:{"Total Pause":`${e.garbageCollection.gcTotals.totalPauseTime.toFixed(2)} ms`,"Freed Memory":`${e.garbageCollection.gcTotals.freedMemory.toFixed(2)} MB`,Promotions:`${e.garbageCollection.gcTotals.promotions}`,"Tenured Size":`${e.garbageCollection.gcTotals.tenuredSize.toFixed(2)} MB`}})]})})]})})]}),(0,t.jsxs)(d,{header:{title:"Process & Runtime Info"},children:[(0,t.jsx)("div",{className:"grid grid-cols-3 md:grid-cols-2 gap-4",children:s.map(([e,s],a)=>(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-[10px] text-accent-soft uppercase tracking-wider font-semibold block",children:e}),(0,t.jsx)("p",{className:"text-sm text-foreground",children:s})]},a))}),(0,t.jsx)(H,{}),(0,t.jsx)("p",{className:"text-[10px] text-accent-soft uppercase tracking-wider font-semibold block",children:"ACTIVE LIBUV HANDLES"}),(0,t.jsxs)("div",{className:"flex flex-row justify-between text-sm text-accent-soft",children:[(0,t.jsx)("p",{children:"TCP sockets:"}),(0,t.jsx)("span",{children:e.handles.activeLibuvHandles})]}),(0,t.jsxs)("div",{className:"flex flex-row justify-between text-sm text-accent-soft",children:[(0,t.jsx)("p",{children:"Timers:"}),(0,t.jsx)("span",{children:e.handles.timers})]}),(0,t.jsxs)("div",{className:"flex flex-row justify-between text-sm text-accent-soft",children:[(0,t.jsx)("p",{children:"File descriptors:"}),(0,t.jsx)("span",{children:e.handles.fileDescriptors})]}),(0,t.jsx)(H,{}),(0,t.jsx)("p",{className:"text-[10px] text-accent-soft uppercase tracking-wider font-semibold block",children:"THREAD POOL (UV_THREADPOOL_SIZE)"}),(0,t.jsxs)("div",{className:"flex flex-row justify-between text-sm text-accent-soft",children:[(0,t.jsx)("p",{children:"Size:"}),(0,t.jsx)("span",{children:e.runtime.threadPoolSize})]}),(0,t.jsxs)("div",{className:"flex flex-row justify-between text-sm text-accent-soft",children:[(0,t.jsx)("p",{children:"Active Threads:"}),(0,t.jsx)("span",{children:e.runtime.activeThreads})]}),(0,t.jsx)(H,{}),(0,t.jsx)("p",{className:"text-[10px] text-accent-soft uppercase tracking-wider font-semibold block",children:"STARTUP TIME"}),(0,t.jsxs)("div",{className:"flex flex-row justify-between text-sm text-accent-soft",children:[(0,t.jsx)("p",{children:"Bootstrap:"}),(0,t.jsxs)("span",{children:[e.runtime.startup.bootstrapTime.toFixed(2)," ms"]})]}),(0,t.jsxs)("div",{className:"flex flex-row justify-between text-sm text-accent-soft",children:[(0,t.jsx)("p",{children:"Requires:"}),(0,t.jsxs)("span",{children:[e.runtime.startup.requiredModules," modules"]})]})]})]})}function O(){let{data:e}=(0,S.useMetrics)(),{health:s}=e;return(0,t.jsxs)("div",{className:"p-6",children:[(0,t.jsx)(U,{data:s}),(0,t.jsx)(F,{data:s}),(0,t.jsx)(D,{data:s})]})}var z=e.i(52446),G=e.i(11350);function I(){let{configuration:e}=(0,G.useConnection)(),s=`[${(e?.excludePaths||[]).join("], [")}]`,a=e=>"boolean"==typeof e?e?"true":"false":e?.toString()||"";return(0,t.jsxs)("div",{className:"flex flex-col gap-4 m-4",children:[(0,t.jsx)(d,{header:{title:"Main"},children:(0,t.jsx)(u,{variant:"default",values:{dashboardPath:a(e?.dashboardPath),excludedPaths:a(s),tickIntervalMs:a(e?.tickIntervalMs),consoleLog:a(e?.consoleLog),ringBufferSize:a(e?.ringBufferSize),alertBufferSize:a(e?.alertBufferSize)}})}),(0,t.jsx)(d,{header:{title:"Simulation"},children:e?.simulation!==!1?(0,t.jsx)(u,{variant:"default",values:{intervalMs:a(e?.simulation.intervalMs),requestsPerTick:a(e?.simulation.requestsPerTick)}}):(0,t.jsx)("p",{children:"No simulation configured"})}),(0,t.jsx)(d,{header:{title:"Publisher"},children:(0,t.jsx)(u,{variant:"default",values:{intervalMs:a(e?.publisher.intervalMs),slowLatencyThresholdMs:a(e?.publisher.slowLatencyThresholdMs),eventLoopLagThresholdMs:a(e?.publisher.eventLoopLagThresholdMs),eventLoopResolutionMs:a(e?.publisher.eventLoopResolutionMs)}})})]})}e.s(["default",0,function(){let{activeTab:e}=(0,z.useGate)();return(0,t.jsxs)(t.Fragment,{children:["/"===e&&(0,t.jsx)(C,{}),"/analytics"===e&&(0,t.jsx)(A,{}),"/health"===e&&(0,t.jsx)(O,{}),"/configuration"===e&&(0,t.jsx)(I,{})]})}],42775)}]);
|