@camstack/addon-admin-ui 1.1.55 → 1.1.56
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/dist/assets/{AddLocationWizard-DKMFqTvZ.js → AddLocationWizard-BS_sw-yb.js} +1 -1
- package/dist/assets/{AddonCollectionPage-B7r7RnCS.js → AddonCollectionPage-B83rtm_P.js} +1 -1
- package/dist/assets/Addons-CVIk8bKA.js +1 -0
- package/dist/assets/{AdminTabs-DsU1olLw.js → AdminTabs-CGgxIyjn.js} +1 -1
- package/dist/assets/{AiProfiles-DbcBYG7x.js → AiProfiles-BiwHduY5.js} +1 -1
- package/dist/assets/{BrokerForm-Bof3-RsO.js → BrokerForm-Ce54Djz4.js} +1 -1
- package/dist/assets/{Capabilities-CpM6R2iG.js → Capabilities-B5IxdwuN.js} +1 -1
- package/dist/assets/{CapabilityBadges-CrG_Gpq2.js → CapabilityBadges-3XeZhtSI.js} +1 -1
- package/dist/assets/Cluster-D8rUWJST.js +1 -0
- package/dist/assets/ClusterRecordingTab-DX9aLngj.js +1 -0
- package/dist/assets/{Dashboard-BLwnF4KK.js → Dashboard-BblDjLKn.js} +1 -1
- package/dist/assets/Data-CdLaMkIJ.js +1 -0
- package/dist/assets/DetectionIntelligence-D6i0W6kk.js +1 -0
- package/dist/assets/DeviceDetail-BYfQe_30.js +2 -0
- package/dist/assets/{Devices-1MpXBj6n.js → Devices-x_UPdIGK.js} +1 -1
- package/dist/assets/EmbedPlayerPage-Buxyv9Ar.js +1 -0
- package/dist/assets/Events-CDDnJ01Z.js +1 -0
- package/dist/assets/{FormBuilder-1_hLh6UD.js → FormBuilder-iTpxBqBc.js} +1 -1
- package/dist/assets/{Identity-DIIHY4_I.js → Identity-DH41lSfX.js} +1 -1
- package/dist/assets/IntegrationDetail-CR5AD5vO.js +1 -0
- package/dist/assets/{Integrations-uUU6I8AA.js → Integrations-BDJ1xxLY.js} +1 -1
- package/dist/assets/{Integrations-D2UQlymQ.js → Integrations-CV1KBLOI.js} +1 -1
- package/dist/assets/{Logs-DklB9pQr.js → Logs-ErbjBqie.js} +1 -1
- package/dist/assets/{MotionZonesSettings-Cv4ArwMh.js → MotionZonesSettings-BMPiTO3l.js} +1 -1
- package/dist/assets/{MyAccess-DreWB3nL.js → MyAccess-DTt40JO0.js} +1 -1
- package/dist/assets/Network-CyPbysr8.js +1 -0
- package/dist/assets/{NodeAddonsSettingsPanel-adQJWpFA.js → NodeAddonsSettingsPanel-CFXh9ESA.js} +1 -1
- package/dist/assets/{NotificationTargets-BqY-ixcT.js → NotificationTargets-Dgs05HjS.js} +1 -1
- package/dist/assets/Pipeline-Dsx-nB1p.js +1 -0
- package/dist/assets/{Plates-BDN77UjR.js → Plates-B_BVouJR.js} +1 -1
- package/dist/assets/{PrivacyMaskSettings-DtvQVzUm.js → PrivacyMaskSettings-DSSEqXHi.js} +1 -1
- package/dist/assets/{ProviderIcon-BvqTmUAe.js → ProviderIcon-BeZnXEB7.js} +1 -1
- package/dist/assets/Recordings-H8TXnxuf.js +1 -0
- package/dist/assets/ScanNetworkModal-C_pd8W_5.js +1 -0
- package/dist/assets/{Settings-Bal6O--f.js → Settings-Cg4clEYW.js} +1 -1
- package/dist/assets/{Showroom-CRdx2BE1.js → Showroom-DQuD1mwE.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-ByenDxWa.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DqSIGxiA.js} +1 -1
- package/dist/assets/{build-cluster-graph-DGTSGb1I.js → build-cluster-graph-D36_rlRB.js} +1 -1
- package/dist/assets/circle-check-big-DOCODmhZ.js +1 -0
- package/dist/assets/clock-D2H-Andr.js +1 -0
- package/dist/assets/{schemas-DSTjX9zr.js → compat-CbwIzIXq.js} +1 -1
- package/dist/assets/{copy-BFZ5D4BJ.js → copy-DAnlpNmN.js} +1 -1
- package/dist/assets/{debounced-invalidate-B_KsAVGD.js → debounced-invalidate-DkqNPsSh.js} +1 -1
- package/dist/assets/{dist-CqgNHN-E.js → dist-Ck-SkmF_.js} +1 -1
- package/dist/assets/dist-DZmXEoJH.js +7 -0
- package/dist/assets/{download-5vnInJfp.js → download-CTO2YqfN.js} +1 -1
- package/dist/assets/{face-bbox-VcgOLkvN.js → face-bbox-Ctmu8UoI.js} +1 -1
- package/dist/assets/{hostInit-BKkxJ9TG.js → hostInit-DRnXHdHY.js} +1 -1
- package/dist/assets/{index-Cmln2hC6.css → index-9438rY3p.css} +1 -1
- package/dist/assets/index-BVO5AjpN.js +4 -0
- package/dist/assets/{key-round-76xRX3g6.js → key-round-DY-W0ctm.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-4ee9f7b7.js → mf-entry-bootstrap-0-64545043.js} +2 -2
- package/dist/assets/{pencil-Gs6QSg5F.js → pencil-fohpLhWe.js} +1 -1
- package/dist/assets/{player-overlays-DArwlTAt.js → player-overlays-CDSEY_-X.js} +1 -1
- package/dist/assets/plus-CWmuK222.js +1 -0
- package/dist/assets/{radio-B4tiKZeo.js → radio-CCbXLtig.js} +1 -1
- package/dist/assets/{refresh-cw-dvjeQnSv.js → refresh-cw-7j7eJ_7S.js} +1 -1
- package/dist/assets/remoteEntry-BB2jugOV.js +1 -0
- package/dist/assets/{rotate-ccw-CdvaSzic.js → rotate-ccw-DVTmMtl2.js} +1 -1
- package/dist/assets/rotate-cw-Dl9N7lTh.js +1 -0
- package/dist/assets/search-DvkKd5B0.js +1 -0
- package/dist/assets/{send-Cn2E54X0.js → send-CyaRM2HU.js} +1 -1
- package/dist/assets/{server-Cgdp4E__.js → server-BxecI2el.js} +1 -1
- package/dist/assets/square-CzYy8xOt.js +1 -0
- package/dist/assets/{square-check-big-j_FMW3NH.js → square-check-big-BsYa2Tzh.js} +1 -1
- package/dist/assets/src-DNVzx9ag.js +7 -0
- package/dist/assets/src-P2A2VEVG.js +67 -0
- package/dist/assets/{upload-BkHF_KcS.js → upload-CYB5H427.js} +1 -1
- package/dist/assets/{useDevice-CNEnCHst.js → useDevice-BskeVR-e.js} +1 -1
- package/dist/assets/{useEventInvalidation-zuVyeFVc.js → useEventInvalidation-DtNYz-2H.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BktxCRjD.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DtiKhSUE.js} +2 -2
- package/dist/assets/{wifi-CaslRhpX.js → wifi-D9-_VL0_.js} +1 -1
- package/dist/assets/{zap-1sJN7Bvb.js → zap-WiUYl_aC.js} +1 -1
- package/dist/index.html +7 -7
- package/dist/server/addon.js +193 -5
- package/package.json +1 -1
- package/dist/assets/Addons-DjQMioo-.js +0 -1
- package/dist/assets/Cluster-DGYFlvd-.js +0 -1
- package/dist/assets/Data-mjlU3tOI.js +0 -1
- package/dist/assets/DetectionIntelligence-BF7VOXIn.js +0 -1
- package/dist/assets/DeviceDetail-DHxFHQzX.js +0 -2
- package/dist/assets/EmbedPlayerPage-BG2XDJsy.js +0 -1
- package/dist/assets/Events-cycfxpUn.js +0 -1
- package/dist/assets/IntegrationDetail-ByT41Y57.js +0 -1
- package/dist/assets/Network-WAC7AOhT.js +0 -1
- package/dist/assets/Pipeline-8ill1YGg.js +0 -1
- package/dist/assets/ScanNetworkModal-7FD7LPU3.js +0 -1
- package/dist/assets/circle-check-big-CxoqUJ4a.js +0 -1
- package/dist/assets/clock-ByHlQpk3.js +0 -1
- package/dist/assets/dist-DcJZn370.js +0 -7
- package/dist/assets/film-FBIr-9R4.js +0 -1
- package/dist/assets/index-B0VBnS5H.js +0 -4
- package/dist/assets/plus-ByGzrFiA.js +0 -1
- package/dist/assets/remoteEntry-BOwRpCPu.js +0 -1
- package/dist/assets/rotate-cw-QbVLxhT1.js +0 -1
- package/dist/assets/search-BWa4jUVz.js +0 -1
- package/dist/assets/square-B8uQd9s9.js +0 -1
- package/dist/assets/src-7HDrFEPH.js +0 -7
- package/dist/assets/src-BhRH3dxa.js +0 -67
package/dist/server/addon.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
|
-
//#region ../types/dist/event-category-
|
|
3
|
+
//#region ../types/dist/event-category-D4HJq7Mw.mjs
|
|
4
4
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
5
5
|
EventCategory["SystemBoot"] = "system.boot";
|
|
6
6
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -153,6 +153,11 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
153
153
|
/** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
|
|
154
154
|
* thumb is a scrub gap the recorder's keyframe backfill covers. */
|
|
155
155
|
EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
|
|
156
|
+
/** Export render progress (0–100). Telemetry (D8): a lost tick is a stale
|
|
157
|
+
* progress bar the client reconciles via `recordingExport.getExport`. */
|
|
158
|
+
EventCategory["RecordingExportProgress"] = "recording.export.progress";
|
|
159
|
+
EventCategory["RecordingExportCompleted"] = "recording.export.completed";
|
|
160
|
+
EventCategory["RecordingExportFailed"] = "recording.export.failed";
|
|
156
161
|
EventCategory["DetectionEvent"] = "detection.event";
|
|
157
162
|
EventCategory["SessionTrackNew"] = "session.track.new";
|
|
158
163
|
EventCategory["SessionTrackExpired"] = "session.track.expired";
|
|
@@ -442,6 +447,25 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
442
447
|
*/
|
|
443
448
|
EventCategory["PipelineAnalyticsStationaryChanged"] = "pipeline-analytics.stationary-changed";
|
|
444
449
|
/**
|
|
450
|
+
* Fired by `addon-post-analysis` when a package-drop is confirmed inside
|
|
451
|
+
* a package zone — a newly-appeared stationary object of a package class
|
|
452
|
+
* that cleared the class / zone / dwell / size gates. Payload:
|
|
453
|
+
* `PipelineAnalyticsPackageDeliveredPayload` carrying `{ deviceId,
|
|
454
|
+
* entryId, className, zoneIds, keyFrameMediaKey?, bbox, timestamp }`.
|
|
455
|
+
* Telemetry (D8): the durable record is the `package-events` store row;
|
|
456
|
+
* this bus topic drives notifier rules + live UI. See
|
|
457
|
+
* docs/superpowers/specs/2026-07-17-package-zones-design.md §5.1.
|
|
458
|
+
*/
|
|
459
|
+
EventCategory["PipelineAnalyticsPackageDelivered"] = "pipeline-analytics.package-delivered";
|
|
460
|
+
/**
|
|
461
|
+
* Fired by `addon-post-analysis` when a previously-delivered package
|
|
462
|
+
* leaves its zone (the stationary entry departed — moved or swept).
|
|
463
|
+
* Payload: `PipelineAnalyticsPackagePickedUpPayload` carrying
|
|
464
|
+
* `{ deviceId, entryId, deliveredEventId, className, timestamp }`.
|
|
465
|
+
* Telemetry (D8). See package-zones-design §5.2.
|
|
466
|
+
*/
|
|
467
|
+
EventCategory["PipelineAnalyticsPackagePickedUp"] = "pipeline-analytics.package-picked-up";
|
|
468
|
+
/**
|
|
445
469
|
* Fired by `addon-post-analysis` whenever a gallery face row changes:
|
|
446
470
|
* `kind:'buffered'` a new detected face was persisted, `'assigned'` /
|
|
447
471
|
* `'unassigned'` its identity link changed, `'deleted'` the row was
|
|
@@ -5180,6 +5204,25 @@ function _instanceof(cls, params = {}) {
|
|
|
5180
5204
|
};
|
|
5181
5205
|
return inst;
|
|
5182
5206
|
}
|
|
5207
|
+
//#endregion
|
|
5208
|
+
//#region ../../node_modules/zod/v4/classic/compat.js
|
|
5209
|
+
/** @deprecated Use the raw string literal codes instead, e.g. "invalid_type". */
|
|
5210
|
+
var ZodIssueCode = {
|
|
5211
|
+
invalid_type: "invalid_type",
|
|
5212
|
+
too_big: "too_big",
|
|
5213
|
+
too_small: "too_small",
|
|
5214
|
+
invalid_format: "invalid_format",
|
|
5215
|
+
not_multiple_of: "not_multiple_of",
|
|
5216
|
+
unrecognized_keys: "unrecognized_keys",
|
|
5217
|
+
invalid_union: "invalid_union",
|
|
5218
|
+
invalid_key: "invalid_key",
|
|
5219
|
+
invalid_element: "invalid_element",
|
|
5220
|
+
invalid_value: "invalid_value",
|
|
5221
|
+
custom: "custom"
|
|
5222
|
+
};
|
|
5223
|
+
/** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
|
|
5224
|
+
var ZodFirstPartyTypeKind;
|
|
5225
|
+
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5183
5226
|
Object.fromEntries([
|
|
5184
5227
|
{
|
|
5185
5228
|
id: "overview",
|
|
@@ -12544,7 +12587,11 @@ array(ZoneRuleSchema).readonly();
|
|
|
12544
12587
|
* Extend the enum here when a new gating consumer comes online (audio
|
|
12545
12588
|
* gating, alert filtering, …) — no other surface needs to change.
|
|
12546
12589
|
*/
|
|
12547
|
-
var ZoneRuleStageEnum = _enum([
|
|
12590
|
+
var ZoneRuleStageEnum = _enum([
|
|
12591
|
+
"motion",
|
|
12592
|
+
"detection",
|
|
12593
|
+
"package"
|
|
12594
|
+
]);
|
|
12548
12595
|
DeviceType.Camera, method(object({
|
|
12549
12596
|
deviceId: number(),
|
|
12550
12597
|
stage: ZoneRuleStageEnum
|
|
@@ -12557,7 +12604,8 @@ DeviceType.Camera, method(object({
|
|
|
12557
12604
|
auth: "admin"
|
|
12558
12605
|
}), object({
|
|
12559
12606
|
motion: array(ZoneRuleSchema).readonly(),
|
|
12560
|
-
detection: array(ZoneRuleSchema).readonly()
|
|
12607
|
+
detection: array(ZoneRuleSchema).readonly(),
|
|
12608
|
+
package: array(ZoneRuleSchema).readonly()
|
|
12561
12609
|
});
|
|
12562
12610
|
var ProviderStatusSchema = object({
|
|
12563
12611
|
connected: boolean(),
|
|
@@ -15740,6 +15788,7 @@ var EventKindIconSchema = _enum([
|
|
|
15740
15788
|
"smoke",
|
|
15741
15789
|
"water",
|
|
15742
15790
|
"button",
|
|
15791
|
+
"package",
|
|
15743
15792
|
"generic"
|
|
15744
15793
|
]);
|
|
15745
15794
|
var EventKindCategorySchema = _enum([
|
|
@@ -15747,7 +15796,8 @@ var EventKindCategorySchema = _enum([
|
|
|
15747
15796
|
"audio",
|
|
15748
15797
|
"detection",
|
|
15749
15798
|
"sensor",
|
|
15750
|
-
"custom"
|
|
15799
|
+
"custom",
|
|
15800
|
+
"package"
|
|
15751
15801
|
]);
|
|
15752
15802
|
var EventKindDescriptorSchema = object({
|
|
15753
15803
|
/** Stable kind id (e.g. 'motion', 'person', 'contact'). */
|
|
@@ -19393,6 +19443,108 @@ method(object({
|
|
|
19393
19443
|
auth: "admin"
|
|
19394
19444
|
});
|
|
19395
19445
|
/**
|
|
19446
|
+
* `recordingExport` cap — render a footage time range into a single downloadable
|
|
19447
|
+
* MP4 (regular / accelerated / decelerated / timelapse, ± audio), kept for a
|
|
19448
|
+
* bounded lifetime with a durable history, auto-expiry, and optional
|
|
19449
|
+
* delete-after-download.
|
|
19450
|
+
*
|
|
19451
|
+
* Like `recording` this is a `scope:'system', mode:'singleton'` cap: the
|
|
19452
|
+
* recorder self-gates so exactly ONE node (the designated `recordingNodeId`,
|
|
19453
|
+
* default `hub`) registers it. Device-scoped methods carry `deviceId` in their
|
|
19454
|
+
* input and dispatch to that single provider; the render runs on the node that
|
|
19455
|
+
* owns the footage (no cross-node segment transfer). Download rides the
|
|
19456
|
+
* framework addon data-plane. State persists in a DurableState blob (NOT
|
|
19457
|
+
* SQLite); history rows survive file deletion for audit.
|
|
19458
|
+
*/
|
|
19459
|
+
/** Playback-speed multiplier for the render (1 = realtime). */
|
|
19460
|
+
var ExportSpeedSchema = number().min(.25).max(32);
|
|
19461
|
+
/** Timelapse cadence — sample one source frame per `everyMs`, output at `outputFps`. */
|
|
19462
|
+
var ExportTimelapseSchema = object({
|
|
19463
|
+
everyMs: number().int().positive(),
|
|
19464
|
+
outputFps: number().int().min(1).max(60).optional()
|
|
19465
|
+
});
|
|
19466
|
+
/**
|
|
19467
|
+
* Render options. `speed` and `timelapse` are mutually exclusive. `includeAudio`
|
|
19468
|
+
* is honoured only for a realtime-ish speed (0.5–2×); timelapse is always
|
|
19469
|
+
* silent. `maxLifeMs` bounds how long the finished file is kept;
|
|
19470
|
+
* `deleteAfterDownload` removes it shortly after the first complete download.
|
|
19471
|
+
*/
|
|
19472
|
+
var ExportOptionsSchema = object({
|
|
19473
|
+
speed: ExportSpeedSchema.optional(),
|
|
19474
|
+
timelapse: ExportTimelapseSchema.optional(),
|
|
19475
|
+
includeAudio: boolean(),
|
|
19476
|
+
maxLifeMs: number().int().positive(),
|
|
19477
|
+
deleteAfterDownload: boolean(),
|
|
19478
|
+
title: string().max(200).optional()
|
|
19479
|
+
}).superRefine((v, ctx) => {
|
|
19480
|
+
if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
|
|
19481
|
+
code: ZodIssueCode.custom,
|
|
19482
|
+
message: "speed and timelapse are mutually exclusive",
|
|
19483
|
+
path: ["timelapse"]
|
|
19484
|
+
});
|
|
19485
|
+
});
|
|
19486
|
+
var ExportStateSchema = _enum([
|
|
19487
|
+
"queued",
|
|
19488
|
+
"rendering",
|
|
19489
|
+
"ready",
|
|
19490
|
+
"failed",
|
|
19491
|
+
"expired",
|
|
19492
|
+
"deleted"
|
|
19493
|
+
]);
|
|
19494
|
+
/** One export job / history row. */
|
|
19495
|
+
var ExportRecordSchema = object({
|
|
19496
|
+
id: string(),
|
|
19497
|
+
deviceId: number(),
|
|
19498
|
+
profile: string(),
|
|
19499
|
+
fromMs: number(),
|
|
19500
|
+
toMs: number(),
|
|
19501
|
+
options: ExportOptionsSchema,
|
|
19502
|
+
state: ExportStateSchema,
|
|
19503
|
+
/** 0–100 while rendering; null otherwise. */
|
|
19504
|
+
progressPct: number().nullable(),
|
|
19505
|
+
/** File size once ready; null before. */
|
|
19506
|
+
fileBytes: number().nullable(),
|
|
19507
|
+
expiresAt: number(),
|
|
19508
|
+
deleteAfterDownload: boolean(),
|
|
19509
|
+
/** Epoch of the first complete download; null until then. */
|
|
19510
|
+
downloadedAt: number().nullable(),
|
|
19511
|
+
createdAt: number(),
|
|
19512
|
+
/** User id/name that requested the export. */
|
|
19513
|
+
createdBy: string(),
|
|
19514
|
+
/** Failure reason when state is 'failed'; null otherwise. */
|
|
19515
|
+
error: string().nullable()
|
|
19516
|
+
});
|
|
19517
|
+
/** Candidate download URLs (LAN first, then operator extra hosts). */
|
|
19518
|
+
var ExportDownloadSchema = object({
|
|
19519
|
+
url: string(),
|
|
19520
|
+
endpoints: array(string())
|
|
19521
|
+
});
|
|
19522
|
+
method(object({
|
|
19523
|
+
deviceId: number(),
|
|
19524
|
+
profile: string(),
|
|
19525
|
+
fromMs: number(),
|
|
19526
|
+
toMs: number(),
|
|
19527
|
+
options: ExportOptionsSchema
|
|
19528
|
+
}), ExportRecordSchema, {
|
|
19529
|
+
kind: "mutation",
|
|
19530
|
+
auth: "protected"
|
|
19531
|
+
}), method(object({ deviceId: number().optional() }), array(ExportRecordSchema), {
|
|
19532
|
+
kind: "query",
|
|
19533
|
+
auth: "protected"
|
|
19534
|
+
}), method(object({ exportId: string() }), ExportRecordSchema, {
|
|
19535
|
+
kind: "query",
|
|
19536
|
+
auth: "protected"
|
|
19537
|
+
}), method(object({ exportId: string() }), ExportRecordSchema, {
|
|
19538
|
+
kind: "mutation",
|
|
19539
|
+
auth: "protected"
|
|
19540
|
+
}), method(object({ exportId: string() }), ExportRecordSchema, {
|
|
19541
|
+
kind: "mutation",
|
|
19542
|
+
auth: "protected"
|
|
19543
|
+
}), method(object({ exportId: string() }), ExportDownloadSchema, {
|
|
19544
|
+
kind: "query",
|
|
19545
|
+
auth: "protected"
|
|
19546
|
+
});
|
|
19547
|
+
/**
|
|
19396
19548
|
* One publishable camera stream as its OWNING PROVIDER describes it — the same
|
|
19397
19549
|
* payload the (legacy) push `streamBroker.publishCameraStream` carried, minus
|
|
19398
19550
|
* `deviceId`.
|
|
@@ -23316,6 +23468,42 @@ Object.freeze({
|
|
|
23316
23468
|
addonId: null,
|
|
23317
23469
|
access: "create"
|
|
23318
23470
|
},
|
|
23471
|
+
"recordingExport.cancelExport": {
|
|
23472
|
+
capName: "recordingExport",
|
|
23473
|
+
capScope: "system",
|
|
23474
|
+
addonId: null,
|
|
23475
|
+
access: "create"
|
|
23476
|
+
},
|
|
23477
|
+
"recordingExport.createExport": {
|
|
23478
|
+
capName: "recordingExport",
|
|
23479
|
+
capScope: "system",
|
|
23480
|
+
addonId: null,
|
|
23481
|
+
access: "create"
|
|
23482
|
+
},
|
|
23483
|
+
"recordingExport.deleteExport": {
|
|
23484
|
+
capName: "recordingExport",
|
|
23485
|
+
capScope: "system",
|
|
23486
|
+
addonId: null,
|
|
23487
|
+
access: "delete"
|
|
23488
|
+
},
|
|
23489
|
+
"recordingExport.getDownloadUrl": {
|
|
23490
|
+
capName: "recordingExport",
|
|
23491
|
+
capScope: "system",
|
|
23492
|
+
addonId: null,
|
|
23493
|
+
access: "view"
|
|
23494
|
+
},
|
|
23495
|
+
"recordingExport.getExport": {
|
|
23496
|
+
capName: "recordingExport",
|
|
23497
|
+
capScope: "system",
|
|
23498
|
+
addonId: null,
|
|
23499
|
+
access: "view"
|
|
23500
|
+
},
|
|
23501
|
+
"recordingExport.listExports": {
|
|
23502
|
+
capName: "recordingExport",
|
|
23503
|
+
capScope: "system",
|
|
23504
|
+
addonId: null,
|
|
23505
|
+
access: "view"
|
|
23506
|
+
},
|
|
23319
23507
|
"sceneMonitor.captureReference": {
|
|
23320
23508
|
capName: "scene-monitor",
|
|
23321
23509
|
capScope: "device",
|
|
@@ -24493,7 +24681,7 @@ var AdminUIAddon = class extends BaseAddon {
|
|
|
24493
24681
|
capability: adminUiCapability,
|
|
24494
24682
|
provider: {
|
|
24495
24683
|
getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
|
|
24496
|
-
getVersion: async () => ({ version: "1.1.
|
|
24684
|
+
getVersion: async () => ({ version: "1.1.56" })
|
|
24497
24685
|
}
|
|
24498
24686
|
}];
|
|
24499
24687
|
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{At as e,Ct as t,Dt as n,Et as r,Nr as i,Oa as a,Sa as o,St as s,Ta as c,Tt as l,_t as u,bt as d,dt as f,ft as p,g as m,gt as h,ht as g,jt as _,kt as v,m as y,mt as ee,pt as te,v as ne,vt as b,xt as re,zr as x}from"./src-BhRH3dxa.js";import{I as S,K as C,Q as w,R as ie,S as T,W as E,b as D,o as O,q as k,x as A,z as j}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{H as ae}from"./src-7HDrFEPH.js";import{p as oe}from"./player-overlays-DArwlTAt.js";import{t as M}from"./clock-ByHlQpk3.js";import{t as N}from"./download-5vnInJfp.js";import{t as se}from"./plus-ByGzrFiA.js";import{t as P}from"./refresh-cw-dvjeQnSv.js";import{t as ce}from"./search-BWa4jUVz.js";import{t as F}from"./upload-BkHF_KcS.js";import{F as I,G as le,I as L,S as R,U as z,g as B,i as V,j as H,m as ue,p as U,q as de,s as W}from"./index-B0VBnS5H.js";import{t as G}from"./AdminPage-BwmGKnRf.js";import{t as fe}from"./NodeAddonsSettingsPanel-adQJWpFA.js";var pe=z(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),me=z(`octagon-alert`,[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z`,key:`1fd625`}]]),he=z(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),K=z(`skip-forward`,[[`polygon`,{points:`5 4 15 12 5 20 5 4`,key:`16p6eg`}],[`line`,{x1:`19`,x2:`19`,y1:`5`,y2:`19`,key:`futhcm`}]]);w();var q=new Set([`completed`,`failed`,`partially-failed`,`cancelled`]),J=new Set([`done`,`failed`,`skipped`]);function Y(e){return!J.has(e.phase)&&!q.has(e.jobState)}function ge(e,t){let n=new Map,r=[...e].sort((e,t)=>e.createdAtMs-t.createdAtMs);for(let e of r){let r=q.has(e.state);for(let i of e.tasks)r&&i.finishedAtMs!==null&&t-i.finishedAtMs>6e4||n.set(i.packageName,{jobId:e.jobId,packageName:i.packageName,phase:i.phase,fromVersion:i.fromVersion,toVersion:i.toVersion,error:i.error,jobState:e.state,finishedAtMs:i.finishedAtMs})}return n}function _e(){let{data:e}=d({activeOnly:!0},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data?.length??0)>0?3e3:!1}),{map:t}=a(ae.AddonsJobProgress,e=>e.job.jobId);return E(()=>{let n=new Map;for(let t of e??[])n.set(t.jobId,t);for(let[e,r]of t)n.set(e,r.job);return ge([...n.values()],Date.now())},[e,t])}var X={queued:{icon:M,cls:`bg-muted text-foreground-subtle`,label:`queued`},fetching:{icon:R,cls:`bg-primary/10 text-primary`,label:`fetching`,spin:!0},staged:{icon:R,cls:`bg-primary/10 text-primary`,label:`staged`,spin:!0},validating:{icon:R,cls:`bg-primary/10 text-primary`,label:`validating`,spin:!0},applying:{icon:R,cls:`bg-primary/10 text-primary`,label:`applying`,spin:!0},restarting:{icon:R,cls:`bg-amber-500/10 text-amber-600 dark:text-amber-400`,label:`restarting`,spin:!0},applied:{icon:R,cls:`bg-primary/10 text-primary`,label:`finalizing`,spin:!0},done:{icon:L,cls:`bg-success/10 text-success`,label:`updated`},failed:{icon:me,cls:`bg-danger/10 text-danger`,label:`failed`},skipped:{icon:K,cls:`bg-muted text-foreground-subtle`,label:`skipped`}};function ve({progress:e}){let t=X[e.phase],n=t.icon,r=e.error??`${e.packageName}: ${e.fromVersion??`?`} → ${e.toVersion}`;return T(`span`,{"data-testid":`addon-job-progress`,className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded shrink-0 ${t.cls}`,title:r,children:[A(n,{className:`w-2.5 h-2.5 ${t.spin?`animate-spin`:``}`}),t.label,T(`span`,{className:`font-mono`,children:[`→ `,e.toVersion]})]})}function ye({packageName:e,currentVersion:t,installSource:n,onInstall:r,onClose:i,onSelect:a,selectedVersion:o}){let s=n===`upload`||n===`local`,{data:c,isLoading:l}=h({name:e});return T(`div`,{className:`fixed z-50 w-72 rounded-lg border border-border bg-surface shadow-xl overflow-hidden`,style:{top:`auto`,bottom:`auto`},ref:e=>{if(!e)return;let t=e.parentElement?.getBoundingClientRect();if(!t)return;let n=window.innerHeight-t.bottom,r=t.top;n<280&&r>n?(e.style.bottom=`${window.innerHeight-t.top+4}px`,e.style.top=`auto`):(e.style.top=`${t.bottom+4}px`,e.style.bottom=`auto`),e.style.right=`${window.innerWidth-t.right}px`},onClick:e=>e.stopPropagation(),children:[T(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[A(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle font-medium`,children:`Versions`}),A(`button`,{type:`button`,onClick:i,className:`text-foreground-subtle hover:text-foreground`,children:A(V,{className:`h-3 w-3`})})]}),s&&T(`div`,{className:`flex items-start gap-2 px-3 py-2 border-b border-border bg-cyan-500/10 text-[10px]`,children:[A(F,{className:`h-3 w-3 mt-0.5 text-cyan-500 shrink-0`}),T(`div`,{className:`text-cyan-700 dark:text-cyan-200`,children:[T(`span`,{className:`font-semibold`,children:[n===`upload`?`Uploaded copy`:`Local copy`,` in place.`]}),` `,`Re-install `,A(`span`,{className:`font-mono`,children:t}),` from npm to track upstream releases again.`]})]}),l&&T(`div`,{className:`flex items-center justify-center gap-2 py-6 text-[10px] text-foreground-subtle`,children:[A(R,{className:`h-3.5 w-3.5 animate-spin`}),`Loading versions...`]}),c&&A(`div`,{className:`max-h-64 overflow-auto divide-y divide-border`,children:c.map(e=>{let n=e.version===t,i=a!==void 0&&e.version===o,c=/-(alpha|beta|rc|dev|canary|next)/i.test(e.version),l=T(D,{children:[A(`span`,{className:`font-mono flex-1 text-left ${n?`text-primary font-semibold`:c?`text-amber-400`:`text-foreground`}`,children:e.version}),n&&A(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium bg-primary/10 text-primary`,children:`current`}),e.distTags.map(e=>A(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${e===`latest`?`bg-emerald-500/15 text-emerald-400`:e===`beta`?`bg-amber-500/15 text-amber-400`:`bg-gray-500/15 text-gray-400`}`,children:e},e)),e.deprecated&&A(`span`,{className:`text-[9px] text-red-400 line-through`,children:`deprecated`}),A(`span`,{className:`text-[9px] text-foreground-subtle shrink-0`,children:new Date(e.publishedAt).toLocaleDateString()})]});return a?T(`button`,{type:`button`,"aria-label":`Select ${e.version}`,onClick:()=>a(e.version),className:`w-full flex items-center gap-2 px-3 py-2 text-[11px] ${i?`bg-primary/5`:`hover:bg-surface-hover`} transition-colors`,children:[l,i?A(L,{className:`h-3 w-3 text-primary shrink-0`}):A(`span`,{className:`w-3 shrink-0`})]},e.version):T(`div`,{className:`flex items-center gap-2 px-3 py-2 text-[11px] ${n?`bg-primary/5`:`hover:bg-surface-hover`} transition-colors`,children:[l,n&&!s?A(L,{className:`h-3 w-3 text-primary shrink-0`}):A(`button`,{type:`button`,onClick:()=>r(e.version),className:`shrink-0 rounded p-0.5 hover:bg-primary/20 text-foreground-subtle hover:text-primary transition-colors`,title:n?`Re-install ${e.version} from npm`:`Install ${e.version}`,children:A(N,{className:`h-3 w-3`})})]},e.version)})}),c&&c.length===0&&A(`div`,{className:`py-4 text-center text-[10px] text-foreground-subtle`,children:`No versions found`})]})}var be={queued:{icon:M,bg:`bg-muted text-foreground-subtle`,label:`queued`},updating:{icon:R,bg:`bg-primary/10 text-primary`,label:`updating`,spin:!0},"done-pending-restart":{icon:P,bg:`bg-amber-500/10 text-amber-700`,label:`pending restart`},done:{icon:L,bg:`bg-success/10 text-success`,label:`done`},failed:{icon:me,bg:`bg-danger/10 text-danger`,label:`failed`}};function xe({item:e}){let t=be[e.status],n=t.icon;return T(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded ${t.bg}`,title:e.error,children:[A(n,{className:`w-2.5 h-2.5 ${t.spin?`animate-spin`:``}`}),t.label]})}w();var Z=`device-export`;function Se(e){return e.capabilities.some(e=>(typeof e==`string`?e:e.name)===Z)}function Ce({isBundle:e,installSource:t,addonId:n,iconPath:r,color:i}){let[a,o]=k(!1),s=i?{backgroundColor:`${i.startsWith(`#`)?i:`#${i}`}26`}:void 0,c=e?`bg-indigo-500/20 text-indigo-700 dark:text-indigo-300`:`bg-purple-500/20 text-purple-700 dark:text-purple-300`,l=n&&r?`/api/addon-assets/${n}/${r}`:null,u=!!l&&!a;return T(`div`,{className:`relative flex-shrink-0`,children:[A(`div`,{className:`h-9 w-9 rounded-lg flex items-center justify-center ${s?``:c}`,style:s,children:u?A(`img`,{src:l,alt:n,className:`h-5 w-5`,onError:()=>o(!0)}):A(e?he:B,{className:`h-4 w-4`})}),t===`local`&&A(`span`,{className:`absolute -top-1.5 -left-1.5 text-[7px] font-bold leading-none bg-orange-500 text-white px-1 py-0.5 rounded -rotate-12 shadow-sm`,children:`DEV`}),t===`npm`&&A(`span`,{className:`absolute -top-1 -left-1 w-4 h-4 rounded bg-[#cb3837] flex items-center justify-center -rotate-12 shadow-sm`,children:A(`svg`,{viewBox:`0 0 780 250`,className:`w-[11px] h-[11px]`,children:A(`path`,{fill:`#fff`,d:`M240 250h100V50h100v200h340V0H0v250z`})})}),t===`upload`&&A(`span`,{className:`absolute -top-1.5 -left-1.5 flex items-center justify-center h-4 w-4 rounded bg-cyan-500 -rotate-12 shadow-sm`,children:A(F,{className:`h-2.5 w-2.5 text-white`})})]})}function we({version:e,availableUpdate:t,selectedVersion:n,isUpdating:r,installSource:i,disabled:a,onUpdate:o,onOpenPicker:s,children:c}){if(r)return T(`span`,{className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border border-blue-500/30 bg-blue-500/10 text-blue-400 shrink-0`,children:[A(R,{className:`h-3 w-3 animate-spin`}),`Updating…`]});if(t){let r=n??t;return T(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[o&&T(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),o()},disabled:a,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-semibold border border-blue-500/30 bg-blue-500/10 text-blue-400 hover:bg-blue-500/20 disabled:opacity-50 disabled:cursor-not-allowed transition-colors`,title:`Update to ${r}`,children:[A(N,{className:`h-3 w-3`}),`Update`]}),T(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),s()},disabled:a,"aria-label":`Select version to install`,title:`Installed ${e} — update available. Selected ${r}; tap to choose another version.`,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-bold font-mono border border-amber-500/40 bg-amber-500/15 text-amber-500 hover:bg-amber-500/25 animate-pulse disabled:opacity-50 disabled:cursor-not-allowed transition-colors`,children:[A(`span`,{className:`font-normal opacity-70`,children:e}),A(`span`,{className:`font-normal opacity-70`,children:`→`}),r,A(I,{className:`h-3 w-3`})]}),c]})}return T(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[T(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),s()},disabled:a,className:[`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-bold font-mono border transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,i===`local`?`border-orange-500/30 bg-orange-500/10 text-orange-400 hover:bg-orange-500/20`:`border-emerald-500/30 bg-emerald-500/10 text-emerald-400 hover:bg-emerald-500/20`].join(` `),title:`Version ${e} — tap to view all versions`,children:[e,A(I,{className:`h-3 w-3 opacity-50`})]}),c]})}function Te({addonId:e}){let t=O(),{data:r=`inherit`}=te({addonId:e}),i=n({onSuccess:()=>{t.invalidateQueries({queryKey:[[`addons`,`getAddonAutoUpdate`]]})}});return A(`div`,{className:`flex rounded-lg border border-border overflow-hidden text-[10px] font-medium`,children:[`inherit`,`off`,`latest`,`beta`].map(t=>A(`button`,{type:`button`,onClick:n=>{n.stopPropagation(),i.mutate({addonId:e,channel:t})},disabled:i.isPending,className:`px-2.5 py-1 transition-colors capitalize ${r===t?t===`inherit`?`bg-gray-700/50 text-gray-700 dark:text-gray-300`:t===`off`?`bg-gray-700 text-gray-700 dark:text-gray-300`:t===`latest`?`bg-blue-500/20 text-blue-400`:`bg-amber-500/20 text-amber-400`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`} ${t===`inherit`?``:`border-l border-border`}`,children:t},t))})}function Ee({addon:n,agents:r=[],clusterStatus:i,hideVersion:a,availableUpdate:s,onUpdate:c,isUpdating:d,jobProgress:f,bundle:p,bulkItem:h,disabledByBulk:g,isSystem:_}){let[v,ee]=k(!1),[te,b]=k(!1),[re,x]=k(!1),[S,C]=k(null);j(()=>{C(null)},[s]);let w=S??s,[ie,E]=k(!1),[ae,M]=k(!1),[N,ce]=k(`logs`),F=O(),L=oe(),R=le(),z=o(),{manifest:B}=n,H=n.installedOn??[],de=!p&&!B.protected&&B.removable!==!1,G=!!p,K=p?.displayName??B.name,q=p?.packageName??B.packageName,J=p?.version??B.packageVersion??B.version,Y=p?.installSource??n.installSource,ge=p?p.bundle?.description??p.addons[0]?.manifest.description:B.description,_e=e({onSuccess:()=>{F.invalidateQueries({queryKey:[[`addons`]]}),F.invalidateQueries({queryKey:[[`addonPages`]]}),F.invalidateQueries({queryKey:[[`capabilities`]]})}}),X=t({onSuccess:()=>{F.invalidateQueries({queryKey:[[`addons`]]})}}),be=u({onSuccess:()=>{F.invalidateQueries({queryKey:[[`addons`]]}),F.invalidateQueries({queryKey:[[`addonPages`]]}),F.invalidateQueries({queryKey:[[`capabilities`]]}),F.invalidateQueries({queryKey:[[`integrations`]]})}}),Z=l({onSuccess:()=>{F.invalidateQueries({queryKey:[[`addons`]]}),F.invalidateQueries({queryKey:[[`alerts`]]})}}),Q=n.health,De=Q?.phase===`failed`&&!Q.inGracePeriod,Oe=De&&Q?.nextRetryAt&&!Q.retrying;return T(`div`,{className:`rounded-lg border bg-surface overflow-hidden ${De?`border-red-500/50`:`border-border`}`,children:[De&&Q&&T(`div`,{className:`bg-danger/10 border-b border-danger/30 px-4 py-2.5 flex items-start gap-2.5`,children:[A(me,{className:`h-4 w-4 text-danger shrink-0 mt-0.5`}),T(`div`,{className:`flex-1 min-w-0`,children:[T(`div`,{className:`text-xs font-semibold text-danger`,children:[`Failed to load (attempt #`,Q.retryCount,`)`]}),A(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:Q.lastError?.message??`Unknown error`}),Oe&&Q.nextRetryAt&&T(`div`,{className:`text-[10px] text-foreground-subtle mt-1`,children:[`Auto-retry at `,new Date(Q.nextRetryAt).toLocaleTimeString()]})]}),T(`button`,{type:`button`,disabled:Z.isPending||Q.retrying,onClick:e=>{e.stopPropagation(),Z.mutate({packageName:q})},className:`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-[11px] font-semibold border border-red-400/40 bg-red-400/10 text-red-700 dark:text-red-300 hover:bg-red-400/20 disabled:opacity-50 disabled:cursor-not-allowed transition-colors shrink-0`,title:`Reset retry counter and force immediate reload`,children:[A(P,{className:`h-3 w-3 ${Z.isPending||Q.retrying?`animate-spin`:``}`}),`Retry now`]})]}),T(`div`,{className:`flex items-start gap-3 px-4 py-3`,children:[A(Ce,{isBundle:G||!!B.components&&B.components.length>1,installSource:Y,addonId:G?p.addons[0]?.manifest.id:B.id,iconPath:G?p.bundle?.icon??p.addons[0]?.manifest.icon:B.icon,color:G?p.addons[0]?.manifest.color:B.color}),T(`div`,{className:`flex-1 min-w-0`,children:[T(`div`,{className:`flex items-start justify-between gap-2`,children:[A(`span`,{className:`text-sm font-semibold text-foreground truncate min-w-0`,children:K}),!a&&A(we,{version:J,availableUpdate:s,...w===void 0?{}:{selectedVersion:w},isUpdating:d,installSource:Y,disabled:g,...c&&w!==void 0?{onUpdate:()=>c(w)}:{},onOpenPicker:()=>x(e=>!e),children:re&&A(ye,{packageName:q,currentVersion:J,...Y?{installSource:Y}:{},...s!==void 0&&w!==void 0?{selectedVersion:w,onSelect:e=>{C(e),x(!1)}}:{},onInstall:e=>{x(!1),be.mutate({packageName:q,version:e})},onClose:()=>x(!1)})})]}),T(`div`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 mt-0.5`,children:[q!==K&&A(`span`,{className:`text-[10px] text-foreground-subtle font-mono truncate max-w-full`,children:q}),G&&T(`span`,{className:`text-[10px] rounded-full bg-primary/10 text-primary px-2 py-0.5 font-medium shrink-0 inline-flex items-center gap-1`,children:[A(he,{className:`h-3 w-3`}),p.addons.length]}),_&&T(`span`,{className:`text-[10px] rounded-full bg-amber-500/15 text-amber-700 dark:text-amber-300 px-2 py-0.5 font-medium shrink-0 inline-flex items-center gap-1`,title:`System package — updating restarts the hub`,children:[A(P,{className:`h-3 w-3`}),`System`]}),h!=null&&A(xe,{item:h}),f!=null&&A(ve,{progress:f})]}),ge&&A(`p`,{className:`text-[10px] text-foreground-subtle mt-1 line-clamp-1`,children:ge}),!G&&n.process&&T(`div`,{className:`flex flex-wrap items-center gap-1.5 mt-1`,children:[A(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${n.process.mode===`forked`?`bg-blue-500/15 text-blue-400`:`bg-gray-500/15 text-gray-400`}`,children:n.process.mode===`forked`?`forked`:`in-process`}),n.process.pid!=null&&T(`span`,{className:`text-[9px] font-mono text-foreground-subtle`,children:[`PID `,n.process.pid]}),A(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${n.process.state===`running`?`bg-emerald-500/15 text-emerald-400`:n.process.state===`crashed`||n.process.state===`failed`?`bg-red-500/15 text-red-400`:`bg-gray-500/15 text-gray-400`}`,children:n.process.state})]})]})]}),!G&&T(`div`,{className:`flex items-center gap-1 px-4 py-1.5 border-t border-border/50 bg-surface-hover/20`,children:[T(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),X.mutate({addonId:B.id})},disabled:X.isPending||g,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border border-border text-foreground-subtle hover:text-blue-400 hover:border-blue-500/30 hover:bg-blue-500/10 disabled:opacity-50 transition-colors`,children:[A(P,{className:`h-3 w-3 ${X.isPending?`animate-spin`:``}`}),`Restart`]}),T(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),E(e=>!e)},className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border transition-colors ${ie?`border-primary/30 bg-primary/10 text-primary`:`border-border text-foreground-subtle hover:text-foreground hover:border-primary/30 hover:bg-primary/10`}`,children:[A(ue,{className:`h-3 w-3`}),`Logs`]}),!G&&T(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),M(!0)},className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border transition-colors ${ae?`border-primary/30 bg-primary/10 text-primary`:`border-border text-foreground-subtle hover:text-foreground hover:border-primary/30 hover:bg-primary/10`}`,children:[A(U,{className:`h-3 w-3`}),`Settings`]}),A(`div`,{className:`flex-1`}),de&&T(`button`,{type:`button`,onClick:async e=>{e.stopPropagation(),await z({title:`Uninstall ${B.name}?`,message:`This will remove the addon package and all its data. This action cannot be undone.`,confirmLabel:`Uninstall`,variant:`danger`})&&_e.mutate({packageName:B.packageName})},disabled:_e.isPending||g,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border border-border text-foreground-subtle hover:text-red-400 hover:border-red-500/30 hover:bg-red-500/10 disabled:opacity-50 transition-colors`,children:[A(W,{className:`h-3 w-3`}),_e.isPending?`Removing...`:`Uninstall`]})]}),i&&i.nodes.length>1&&!G&&T(`div`,{className:`border-t border-border px-4 py-2 bg-muted/10`,children:[A(`div`,{className:`text-[10px] font-medium text-foreground-subtle mb-1.5`,children:`Cluster Deployment`}),A(`div`,{className:`space-y-1`,children:i.nodes.map(e=>T(`div`,{className:`flex items-center gap-2 text-[10px]`,children:[A(`div`,{className:`h-1.5 w-1.5 rounded-full shrink-0 ${e.status===`offline`?`bg-muted-foreground/30`:e.synced?`bg-success`:`bg-amber-500`}`}),A(`span`,{className:`font-medium text-foreground min-w-[60px]`,children:e.name}),A(`span`,{className:`font-mono text-foreground-subtle`,children:e.version}),!e.synced&&e.status!==`offline`&&A(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-amber-500/10 text-amber-400 border border-amber-500/20`,children:`outdated`}),e.status===`offline`&&A(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-muted text-muted-foreground`,children:`offline`}),e.synced&&e.status!==`offline`&&A(`span`,{className:`text-[9px] text-success`,children:`synced`})]},e.nodeId))})]}),ie&&!G&&T(`div`,{className:`border-t border-border`,children:[T(`div`,{className:`flex items-center px-4 py-1 bg-surface-hover/20 border-b border-border/50`,children:[T(`div`,{className:`flex rounded border border-border overflow-hidden text-[9px]`,children:[A(`button`,{type:`button`,onClick:()=>ce(`logs`),className:`px-2 py-0.5 transition-colors ${N===`logs`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:`Logs`}),A(`button`,{type:`button`,onClick:()=>ce(`events`),className:`px-2 py-0.5 border-l border-border transition-colors ${N===`events`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:`Events`})]}),A(`div`,{className:`flex-1`}),A(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),E(!1)},className:`text-foreground-subtle hover:text-foreground`,children:A(V,{className:`h-3.5 w-3.5`})})]}),N===`logs`&&A(m,{addonId:B.id,maxHeight:`max-h-64`,showFilters:!1}),N===`events`&&A(y,{addonId:B.id,category:`addon.*`,maxHeight:`max-h-64`})]}),G&&T(D,{children:[A(`button`,{type:`button`,onClick:()=>ee(e=>!e),className:`w-full flex items-center justify-center border-t border-border py-1 hover:bg-surface-hover/50 transition-colors`,children:A(v?pe:I,{className:`h-3.5 w-3.5 text-foreground-subtle`})}),v&&A(`div`,{className:`border-t border-border px-3 py-2 space-y-2`,children:p.addons.map(e=>A(Ee,{addon:e,agents:r,hideVersion:!0},e.manifest.id))})]}),ae&&!G&&A(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4`,onClick:()=>M(!1),children:T(`div`,{className:`w-full max-w-lg max-h-[80vh] rounded-xl border border-border bg-surface shadow-2xl flex flex-col overflow-hidden`,onClick:e=>e.stopPropagation(),children:[T(`div`,{className:`flex items-center justify-between px-5 py-3 border-b border-border flex-shrink-0`,children:[T(`div`,{className:`flex items-center gap-2`,children:[A(U,{className:`h-4 w-4 text-primary`}),T(`h2`,{className:`text-sm font-semibold text-foreground`,children:[K,` Settings`]})]}),A(`button`,{onClick:()=>M(!1),className:`text-foreground-subtle hover:text-foreground transition-colors p-1 rounded`,children:A(V,{className:`h-4 w-4`})})]}),T(`div`,{className:`flex-1 overflow-y-auto px-5 py-4 space-y-4`,children:[A(fe,{nodeId:`hub`,addonIds:[B.id],level:`global`}),Se(B)&&T(`div`,{children:[A(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Device export`}),A(ne,{addonId:B.id,trpc:L.trpcClient,onOpenDevice:e=>R(`/devices/${e}`)})]}),Y===`npm`&&T(`div`,{children:[A(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Auto-Update`}),A(Te,{addonId:B.id})]}),B.components&&B.components.length>0&&T(`div`,{children:[T(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:[`Components (`,B.components.length,`)`]}),A(`div`,{className:`flex flex-wrap gap-1`,children:B.components.map(e=>A(`span`,{className:`text-[10px] rounded bg-background border border-border px-1.5 py-0.5 text-foreground-subtle font-mono`,children:e},e))})]}),r.length>=2&&T(`div`,{children:[A(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Installed on`}),T(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[H.length===0&&A(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Hub (local)`}),H.map(e=>A(`span`,{className:`rounded-full bg-surface-hover border border-border px-2 py-0.5 text-[10px] text-foreground-subtle`,children:e},e)),T(`div`,{className:`relative`,children:[T(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),b(e=>!e)},className:`inline-flex items-center gap-1 rounded-full border border-dashed border-border px-2 py-0.5 text-[10px] text-foreground-subtle hover:text-foreground hover:border-primary transition-colors`,title:`Install on more agents`,children:[A(se,{className:`h-3 w-3`}),`Add agent`]}),te&&T(`div`,{className:`absolute left-0 top-full mt-1 z-10 min-w-[160px] rounded-md border border-border bg-surface shadow-lg overflow-hidden`,children:[r.filter(e=>!e.isHub&&!H.includes(e.name)).map(e=>A(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),b(!1)},className:`w-full text-left px-3 py-1.5 text-[10px] text-foreground hover:bg-surface-hover transition-colors`,children:e.name},e.id)),r.filter(e=>!e.isHub&&!H.includes(e.name)).length===0&&A(`div`,{className:`px-3 py-1.5 text-[10px] text-foreground-subtle`,children:`No available agents`})]})]})]})]})]}),A(`div`,{className:`flex items-center justify-end px-5 py-3 border-t border-border flex-shrink-0`,children:A(`button`,{type:`button`,onClick:()=>M(!1),className:`rounded-lg border border-border px-3 py-1.5 text-xs font-medium text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,children:`Close`})})]})})]})}w();var Q=`.tgz,.tar.gz,.zip`;function De({onUploadSuccess:e}){let[t,n]=k(!1),r=C(null),i=S(async t=>{n(!0);let r=new FormData;r.append(`file`,t);let i=localStorage.getItem(`camstack_admin_token`)??``;try{(await(await fetch(`/api/addons/upload`,{method:`POST`,headers:{Authorization:`Bearer ${i}`},body:r})).json()).success&&e()}finally{n(!1)}},[e]);return T(D,{children:[A(`input`,{ref:r,type:`file`,accept:Q,onChange:S(e=>{let t=e.target.files?.[0];t&&i(t),e.target.value=``},[i]),className:`hidden`}),T(`button`,{type:`button`,onClick:()=>r.current?.click(),disabled:t,className:`flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,children:[t?A(R,{className:`w-3.5 h-3.5 animate-spin`}):A(F,{className:`w-3.5 h-3.5`}),t?`Uploading...`:`Upload`]})]})}w();var Oe=new Set([`@camstack/system`,`@camstack/types`,`@camstack/sdk`,`@camstack/shm-ring`,`@camstack/ui-library`]);function ke(e){return e!==void 0&&Oe.has(e)}function Ae(e,t){let n=e??`hub-only`;return n===`any-node`?!0:n===`hub-only`?t:!t}function je(e){let t=e;if(!t?.manifest)return null;let n={...t.manifest,name:t.manifest.name??t.manifest.id,version:t.manifest.version??`0.0.0`,capabilities:t.manifest.capabilities??[]},r=t.process,i=r?{pid:r.pid,mode:r.mode===`forked`?`forked`:`in-process`,state:r.state??`unknown`}:void 0,a=t.health,o=t.declaration?.execution,s=t.manifest.execution,c=o?.placement??s?.placement;return{manifest:n,enabled:!0,source:t.source,installSource:t.installSource,installedOn:[],...i?{process:i}:{},hasBackup:t.hasBackup,...a?{health:a}:{},...c?{placement:c}:{}}}function Me(e){let t=new Map,n=[];for(let r of e){let e=r.manifest.packageName;if(!e){n.push(r);continue}let i=t.get(e);if(i)i.addons.push(r);else{let n=r.manifest.bundle,i={packageName:e,displayName:n?.displayName??r.manifest.packageDisplayName??r.manifest.name,version:r.manifest.packageVersion,addons:[r],...r.installSource===void 0?{}:{installSource:r.installSource},...n===void 0?{}:{bundle:n}};t.set(e,i)}}let r=[];for(let e of t.values())e.bundle!==void 0||e.addons.length>=2?r.push({bundle:e,representative:e.addons[0]}):r.push(e.addons[0]);return r.push(...n),r}function $(e){return`bundle`in e}function Ne({addons:e,clusterStatus:t,selectedNode:n,onRefresh:i,isRefreshing:a}){let s=O(),[c,l]=k(``),d=ie(c),[p,m]=k(!1),h=C(null);j(()=>{if(!p)return;let e=e=>{h.current&&!h.current.contains(e.target)&&m(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[p]);let{data:y}=re({nodeId:n.id}),te=E(()=>{let e=new Map;for(let t of y??[])e.set(t.name,t.latestVersion);return e},[y]),ne=E(()=>(y??[]).filter(e=>!e.isSystem).length,[y]),[b,x]=k(()=>new Set),[w,D]=k(()=>new Map),ae=S(e=>{x(t=>new Set(t).add(e))},[]),oe=S(e=>{x(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[]),M=S((e,t)=>{D(n=>new Map(n).set(e,t))},[]),se=S(e=>{D(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),F=_({onMutate:e=>{ae(e.name),se(e.name)},onSuccess:(e,t)=>{oe(t.name);let n=e;if(n&&n.success===!1){M(t.name,n.error??`Update failed (no error message returned by server)`);return}s.invalidateQueries({queryKey:[[`addons`]]}),s.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]})},onError:(e,t)=>{oe(t.name),M(t.name,e instanceof Error?e.message:String(e))}}),I=_e(),le=C(new Set);j(()=>{let e=new Set;for(let[t,n]of I)Y(n)&&e.add(t);let t=[...le.current].some(t=>!e.has(t));le.current=e,t&&(s.invalidateQueries({queryKey:[[`addons`]]}),s.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]}))},[I,s]);let{data:z}=ee(void 0),B=f({onSuccess:()=>{s.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),{data:V,isFetching:ue}=r({query:d||void 0},{enabled:p}),U=v(),{data:W}=g(void 0),G=W?.requestedAt,[fe,pe]=k(null),[me,he]=k(!1);j(()=>{if(W?.kind===`framework-bulk-update`&&W.requestedAt!==fe){pe(W.requestedAt),he(!0);let e=window.setTimeout(()=>he(!1),6e3);return()=>window.clearTimeout(e)}},[G,fe,W]),o();let K=S(async()=>{let e=(y??[]).filter(e=>!e.isSystem);e.length!==0&&await U.mutateAsync({kind:`update`,targets:e.map(e=>({name:e.name,version:e.latestVersion})),nodeIds:[n.id]})},[y,n.id,U]),q=u({onSuccess:()=>{s.invalidateQueries({queryKey:[[`addons`]]}),s.invalidateQueries({queryKey:[[`addonPages`]]}),s.invalidateQueries({queryKey:[[`capabilities`]]}),s.invalidateQueries({queryKey:[[`integrations`]]})}}),[J,ge]=k(`type`),[X,ve]=k(()=>typeof window>`u`?`grouped`:window.localStorage.getItem(`camstack.addons.viewMode`)===`flat`?`flat`:`grouped`),ye=e=>{ve(e),typeof window<`u`&&window.localStorage.setItem(`camstack.addons.viewMode`,e)},[be,xe]=de(),Z=be.get(`capability`),Se=E(()=>{let t=e.filter(e=>!ke(e.manifest.packageName));return n.isHub||(t=t.filter(e=>Ae(e.placement,n.isHub))),Z&&(t=t.filter(e=>(e.manifest.capabilities??[]).some(e=>(typeof e==`string`?e:e.name)===Z))),t},[e,n.isHub,Z]),Ce=()=>{let e=new URLSearchParams(be);e.delete(`capability`),xe(e,{replace:!0})},we=X===`flat`?Se:Me(Se),Te=E(()=>{let e=[...we];switch(J){case`type`:e.sort((e,t)=>{let n=+!$(e),r=+!$(t);if(n!==r)return n-r;let i=$(e)?e.bundle.displayName:e.manifest.name,a=$(t)?t.bundle.displayName:t.manifest.name;return i.localeCompare(a)});break;case`name`:e.sort((e,t)=>{let n=$(e)?e.bundle.displayName:e.manifest.name,r=$(t)?t.bundle.displayName:t.manifest.name;return n.localeCompare(r)});break;case`source`:e.sort((e,t)=>{let n=$(e)?e.bundle.installSource??``:e.installSource??``,r=$(t)?t.bundle.installSource??``:t.installSource??``;return n.localeCompare(r)});break}return e},[we,J]);return T(`div`,{className:`space-y-4`,children:[[...w.entries()].map(([e,t])=>A(`div`,{className:`rounded-md border border-danger/30 bg-danger/5 px-3 py-2 text-[11px]`,children:T(`div`,{className:`flex items-start justify-between gap-3`,children:[T(`div`,{className:`space-y-0.5`,children:[T(`div`,{className:`font-medium text-danger`,children:[`Failed to update `,e]}),A(`div`,{className:`text-foreground-subtle font-mono`,children:t})]}),A(`button`,{type:`button`,onClick:()=>se(e),className:`text-foreground-subtle hover:text-foreground text-[10px]`,children:`dismiss`})]})},e)),T(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[T(`div`,{className:`flex items-center gap-1.5`,children:[A(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Sort:`}),T(`select`,{value:J,onChange:e=>ge(e.target.value),className:`rounded-md border border-border bg-surface px-2 py-1.5 text-[11px] text-foreground focus:outline-none focus:border-primary/50`,children:[A(`option`,{value:`type`,children:`Bundles first`}),A(`option`,{value:`name`,children:`Name`}),A(`option`,{value:`source`,children:`Install source`})]})]}),T(`div`,{className:`flex items-center gap-1.5`,children:[A(`span`,{className:`text-[10px] text-foreground-subtle`,children:`View:`}),A(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`grouped`,`flat`].map(e=>A(`button`,{type:`button`,onClick:()=>ye(e),className:`px-2.5 py-1.5 transition-colors capitalize ${X===e?`bg-primary/10 text-primary`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`}`,title:e===`grouped`?`Group multi-addon packages into a bundle card`:`Show every addon as its own card`,children:e},e))})]}),n.isHub&&T(`div`,{className:`flex items-center gap-1.5`,children:[A(P,{className:`h-3 w-3 text-foreground-subtle`}),A(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Auto-Update:`}),A(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`off`,`latest`,`beta`].map(e=>A(`button`,{type:`button`,onClick:()=>B.mutate({channel:e}),disabled:B.isPending,className:`px-2.5 py-1.5 transition-colors capitalize ${z?.channel===e?e===`off`?`bg-gray-700 text-gray-200`:e===`latest`?`bg-blue-500/20 text-blue-400`:`bg-amber-500/20 text-amber-400`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`} ${e===`off`?``:`border-l border-border`}`,children:e},e))})]}),ne>0&&T(`button`,{type:`button`,onClick:()=>void K(),disabled:U.isPending,className:`flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] rounded-md bg-blue-500/10 text-blue-400 hover:bg-blue-500/20 border border-blue-500/30 disabled:opacity-50 transition-colors font-medium`,children:[U.isPending?A(R,{className:`w-3 h-3 animate-spin`}):A(N,{className:`w-3 h-3`}),U.isPending?`Updating…`:`Update All (${ne})`]}),T(`button`,{type:`button`,onClick:i,disabled:a||U.isPending,className:`flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,children:[A(P,{className:`w-3 h-3 ${a?`animate-spin`:``}`}),`Refresh`]})]}),T(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3`,children:[T(`div`,{className:`relative flex-1 min-w-0 sm:min-w-[200px]`,ref:h,children:[A(ce,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-foreground-subtle`}),A(`input`,{type:`text`,value:c,onChange:e=>{l(e.target.value),m(!0)},onFocus:()=>m(!0),placeholder:`Search addons on npm...`,disabled:U.isPending,className:`w-full rounded-lg border border-border bg-background pl-9 pr-3 py-2 text-xs text-foreground placeholder:text-foreground-subtle focus:outline-none focus:ring-1 focus:ring-primary disabled:opacity-50 disabled:cursor-not-allowed`}),ue&&A(R,{className:`absolute right-2.5 top-1/2 -translate-y-1/2 h-3 w-3 text-foreground-subtle animate-spin`}),p&&V&&V.length>0&&T(`div`,{className:`absolute left-0 right-0 top-full mt-1 z-40 rounded-lg border border-border bg-surface shadow-xl overflow-hidden`,children:[V.length>0&&T(`div`,{className:`px-3 py-1.5 text-[10px] uppercase tracking-wide text-foreground-subtle border-b border-border`,children:[`npm results (`,V.length,`)`]}),V&&V.length>0&&A(`div`,{className:`max-h-72 overflow-auto divide-y divide-border`,children:V.map(e=>T(`div`,{className:`flex items-center gap-3 px-3 py-2 hover:bg-surface-hover transition-colors`,children:[A(`div`,{className:`w-6 h-6 rounded-md bg-primary/10 flex items-center justify-center text-primary text-[9px] font-bold shrink-0`,children:e.name.replace(`@camstack/addon-`,``).charAt(0).toUpperCase()}),T(`div`,{className:`flex-1 min-w-0`,children:[T(`div`,{className:`flex items-baseline gap-2 min-w-0`,children:[A(`span`,{className:`text-[11px] font-semibold break-words`,children:e.name.replace(/^@camstack\/(addon-)?/,``)}),T(`span`,{className:`text-[10px] text-foreground-subtle shrink-0`,children:[`v`,e.version]})]}),A(`div`,{className:`font-mono text-[9px] text-foreground-subtle/80 truncate`,children:e.name}),e.description&&A(`div`,{className:`text-[10px] text-foreground-subtle truncate`,children:e.description})]}),e.installed?T(`span`,{className:`inline-flex items-center gap-1 px-2 py-1 text-[10px] font-medium rounded-md border border-emerald-500/30 bg-emerald-500/10 text-emerald-400 shrink-0`,children:[A(L,{className:`h-3 w-3`}),e.installedVersion??`Installed`]}):T(`button`,{type:`button`,onClick:()=>q.mutate({packageName:e.name}),disabled:q.isPending,className:`inline-flex items-center gap-1 px-2 py-1 text-[10px] font-medium rounded-md bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors shrink-0`,children:[q.isPending?A(R,{className:`h-3 w-3 animate-spin`}):A(N,{className:`h-3 w-3`}),`Install`]})]},e.name))})]})]}),A(De,{onUploadSuccess:()=>{s.invalidateQueries({queryKey:[[`addons`]]}),i()}})]}),Z&&T(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg bg-primary/10 border border-primary/30 text-sm`,children:[A(`span`,{className:`text-foreground-subtle`,children:`Filtering by capability:`}),A(`span`,{className:`font-mono text-primary font-semibold`,children:Z}),A(`button`,{type:`button`,onClick:Ce,className:`ml-auto text-xs text-foreground-subtle hover:text-foreground underline`,children:`Clear`})]}),me&&T(`div`,{className:`fixed top-4 right-4 z-50 flex items-start gap-2 px-3 py-2.5 rounded-md border border-green-500/30 bg-green-500/10 shadow-lg backdrop-blur-sm max-w-sm pointer-events-auto`,children:[A(H,{className:`w-4 h-4 shrink-0 mt-0.5 text-green-400`}),T(`div`,{children:[A(`div`,{className:`text-[11px] font-semibold text-foreground`,children:`Bulk update completed`}),A(`div`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:`System packages updated — hub restarted successfully.`})]})]}),Se.length===0&&A(`div`,{className:`text-xs text-foreground-subtle`,children:e.length===0?`No addons installed`:Z?`No installed addons declare the "${Z}" capability. Browse the npm catalog above to find a compatible addon.`:`No addons compatible with ${n.name} (placement filter active)`}),A(`div`,{className:`space-y-2`,children:Te.map(e=>{let r=$(e)?e.bundle.packageName:e.manifest.packageName,i=te.get(r),a=$(e)?e.representative:e,o=i?e=>F.mutate({name:r,version:e,nodeId:n.id}):void 0,s=I.get(r)??null,c=s!==null&&Y(s);return A(Ee,{addon:a,clusterStatus:t?.[a.manifest.id],bundle:$(e)?e.bundle:void 0,availableUpdate:i,isUpdating:b.has(r)||c,jobProgress:s,onUpdate:o,disabledByBulk:U.isPending},$(e)?r:e.manifest.id)})})]})}function Pe(){let e=O(),{data:t,isLoading:n,isError:r}=b(),{data:a}=i(void 0),{data:o}=x(void 0,{refetchInterval:1e4}),l=E(()=>{let e=new Map;e.set(`hub`,{id:`hub`,name:`Hub`,isHub:!0});for(let t of o??[]){let n=String(t.id??``);n&&e.set(n,{id:n,name:String(t.name??n),isHub:!!t.isHub})}return[...e.values()]},[o]),[u,d]=k(`hub`),f=l.find(e=>e.id===u)??l[0],m=p(),h=s(),g=m.isPending||h.isPending,_=async()=>{await m.mutateAsync({nodeId:u}),await h.mutateAsync(),e.invalidateQueries({queryKey:[[`addons`]]})},v=C(m);v.current=m,j(()=>{v.current.mutate({nodeId:`hub`})},[]);let y=(t??[]).map(je).filter(e=>e!==null);return T(G,{children:[T(`div`,{className:`flex items-center justify-between gap-3 flex-wrap`,children:[A(c,{selectedNodeId:u,onSelect:d}),T(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[!n&&!r&&T(`span`,{className:`text-[10px] rounded-full bg-primary/10 text-primary px-2 py-0.5 font-medium`,children:[y.length,` installed`]}),T(`button`,{type:`button`,onClick:()=>void _(),disabled:g,className:`inline-flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,title:`Re-fetch addons + check npm for new versions`,children:[A(P,{className:`w-3 h-3 ${g?`animate-spin`:``}`}),`Check for updates`]})]})]}),!f.isHub&&T(`div`,{className:`rounded-md border border-warning/30 bg-warning/5 px-3 py-2 text-[11px] text-foreground-subtle`,children:[`Showing only addons compatible with`,` `,A(`span`,{className:`font-medium text-foreground`,children:f.name}),` — agents only run`,` `,A(`code`,{className:`font-mono`,children:`agent-only`}),` and`,` `,A(`code`,{className:`font-mono`,children:`any-node`}),` addons. Install / uninstall is hub-driven; agents auto-sync from the hub.`]}),n&&A(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading…`}),r&&A(`div`,{className:`text-xs text-danger`,children:`Failed to load addons`}),!n&&!r&&A(Ne,{addons:y,clusterStatus:a,selectedNode:f,onRefresh:()=>void _(),isRefreshing:g})]})}export{Pe as AddonsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Br as e,Ci as t,Da as n,Dr as r,Fr as i,Gi as a,Ha as o,Ir as s,Ki as c,Lr as l,Or as u,Pr as d,Rr as f,Sa as p,Ua as m,Ui as h,Va as g,Wa as _,Wi as v,ci as y,g as b,ka as x,m as S,qi as C,zr as w}from"./src-BhRH3dxa.js";import{I as T,K as E,Q as D,S as O,W as k,o as A,q as j,x as M,z as N}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{p as P}from"./player-overlays-DArwlTAt.js";import{t as ee}from"./pencil-Gs6QSg5F.js";import{t as te}from"./radio-B4tiKZeo.js";import{t as F}from"./refresh-cw-dvjeQnSv.js";import{t as I}from"./rotate-cw-QbVLxhT1.js";import{t as L}from"./server-Cgdp4E__.js";import{t as R}from"./upload-BkHF_KcS.js";import{A as ne,F as re,I as ie,N as ae,S as z,U as B,i as oe,m as V,o as H,s as U,t as W,z as G}from"./index-B0VBnS5H.js";import{n as K,t as q}from"./build-cluster-graph-DGTSGb1I.js";import{t as J}from"./format-size-CO9d3C3-.js";import{t as se}from"./NodeAddonsSettingsPanel-adQJWpFA.js";var Y=B(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),ce=B(`git-fork`,[[`circle`,{cx:`12`,cy:`18`,r:`3`,key:`1mpf1b`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`path`,{d:`M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9`,key:`1uq4wg`}],[`path`,{d:`M12 12v3`,key:`158kv8`}]]),le=B(`hard-drive-download`,[[`path`,{d:`M12 2v8`,key:`1q4o3n`}],[`path`,{d:`m16 6-4 4-4-4`,key:`6wukr`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,key:`w68u3i`}],[`path`,{d:`M6 18h.01`,key:`uhywen`}],[`path`,{d:`M10 18h.01`,key:`h775k`}]]),ue=B(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),de=B(`memory-stick`,[[`path`,{d:`M6 19v-3`,key:`1nvgqn`}],[`path`,{d:`M10 19v-3`,key:`iu8nkm`}],[`path`,{d:`M14 19v-3`,key:`kcehxu`}],[`path`,{d:`M18 19v-3`,key:`1vh91z`}],[`path`,{d:`M8 11V9`,key:`63erz4`}],[`path`,{d:`M16 11V9`,key:`fru6f3`}],[`path`,{d:`M12 11V9`,key:`ha00sb`}],[`path`,{d:`M2 15h20`,key:`16ne18`}],[`path`,{d:`M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z`,key:`lhddv3`}]]),X=B(`skull`,[[`path`,{d:`m12.5 17-.5-1-.5 1h1z`,key:`3me087`}],[`path`,{d:`M15 22a1 1 0 0 0 1-1v-1a2 2 0 0 0 1.56-3.25 8 8 0 1 0-11.12 0A2 2 0 0 0 8 20v1a1 1 0 0 0 1 1z`,key:`1o5pge`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}]]),fe=B(`table-2`,[[`path`,{d:`M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18`,key:`gugj83`}]]);D();function pe(e){let t=new FormData;return t.append(`file`,e.file,e.file.name),t.append(`nodeId`,e.nodeId),e.addonId&&t.append(`addonId`,e.addonId),new Promise((n,r)=>{let i=new XMLHttpRequest;i.open(`POST`,`/api/addons/upload`),e.token&&i.setRequestHeader(`Authorization`,`Bearer ${e.token}`),i.upload.addEventListener(`progress`,t=>{t.lengthComputable&&e.onProgress(Math.round(t.loaded/t.total*100))}),i.addEventListener(`load`,()=>{let e;try{e=JSON.parse(i.responseText)}catch{r(Error(`HTTP ${i.status}`));return}i.status>=200&&i.status<300?n(e):r(Error(e.error??`HTTP ${i.status}`))}),i.addEventListener(`error`,()=>r(Error(`Network error during upload`))),i.addEventListener(`abort`,()=>r(Error(`Upload aborted`))),i.send(t)})}function me({nodeId:t,addons:n,isHub:r}){let i=A(),a=p(),[o,c]=j(null),[l,u]=j(null),[f,m]=j(!1),[h,g]=j(null),[_,v]=j(0),y=E(null),b=s(),x=e(),S=d({nodeId:t}),C=S.data??[],w=new Map(n.map(e=>[e.id,e.capabilities])),T=C.length>0?C.map(e=>({id:e.id,status:e.status,capabilities:w.get(e.id)??[],version:e.version,packageName:e.packageName})):n.map(e=>({id:e.id,status:e.status,capabilities:e.capabilities,version:void 0,packageName:void 0})),D=()=>{i.invalidateQueries({queryKey:[[`nodes`,`topology`]]}),S.refetch()},k=async e=>{c(e);try{await b.mutateAsync({nodeId:t,addonId:e}),D()}catch(e){console.error(`Failed to restart addon:`,e)}finally{c(null)}},N=async e=>{if(await a({title:`Uninstall addon`,message:`Remove "${e}" from ${t}? The addon directory will be deleted on disk.`,confirmLabel:`Uninstall`,variant:`danger`})){u(e);try{await x.mutateAsync({nodeId:t,addonId:e}),D()}catch(e){console.error(`Failed to uninstall addon:`,e)}finally{u(null)}}},P=O(`div`,{className:`flex items-center gap-2 mb-2`,children:[M(`input`,{ref:y,type:`file`,accept:`.tgz,.tar.gz`,className:`hidden`,onChange:async e=>{let n=e.target.files?.[0];if(n){e.target.value=``,g(null),m(!0),v(0);try{await pe({file:n,nodeId:t,token:localStorage.getItem(`camstack_admin_token`),onProgress:v}),D()}catch(e){g(e instanceof Error?e.message:String(e))}finally{m(!1),v(0)}}}}),O(`button`,{onClick:()=>y.current?.click(),disabled:f,className:`inline-flex items-center gap-1.5 rounded-md border border-border px-2.5 py-1 text-[11px] font-medium text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50`,children:[f?M(z,{className:`h-3 w-3 animate-spin`}):M(R,{className:`h-3 w-3`}),f?`Uploading… ${_}%`:`Upload addon (.tgz)`]}),f&&M(`div`,{className:`flex-1 h-1 rounded-full bg-muted overflow-hidden max-w-[140px]`,children:M(`div`,{className:`h-full bg-primary transition-all`,style:{width:`${_}%`}})}),h&&M(`span`,{className:`text-[10px] text-destructive`,children:h})]});return T.length===0?O(`div`,{children:[P,M(`div`,{className:`py-4 text-xs text-muted-foreground text-center`,children:S.isLoading?`Loading addons…`:`No addons on this node`})]}):O(`div`,{children:[P,O(`table`,{className:`w-full text-xs`,children:[M(`thead`,{children:O(`tr`,{className:`text-muted-foreground text-left`,children:[M(`th`,{className:`py-2 font-medium`,children:`Addon`}),M(`th`,{className:`py-2 font-medium`,children:`Version`}),M(`th`,{className:`py-2 font-medium`,children:`Capabilities`}),M(`th`,{className:`py-2 font-medium`,children:`Status`}),M(`th`,{className:`py-2 font-medium w-16`})]})}),M(`tbody`,{children:T.map(e=>O(`tr`,{className:`border-t border-border/50`,children:[O(`td`,{className:`py-2 font-medium`,children:[M(`div`,{children:e.id}),e.packageName&&M(`div`,{className:`text-[9px] text-muted-foreground`,children:e.packageName})]}),M(`td`,{className:`py-2 text-muted-foreground`,children:e.version??`—`}),M(`td`,{className:`py-2`,children:M(`div`,{className:`flex flex-wrap gap-1`,children:e.capabilities.length>0?e.capabilities.map(e=>M(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-blue-500/10 text-blue-400`,children:e},e)):M(`span`,{className:`text-muted-foreground`,children:`—`})})}),M(`td`,{className:`py-2`,children:M(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full ${e.status===`running`?`bg-success/10 text-success`:e.status===`error`?`bg-destructive/10 text-destructive`:`bg-muted text-muted-foreground`}`,children:e.status})}),M(`td`,{className:`py-2`,children:O(`div`,{className:`flex items-center gap-1 justify-end`,children:[M(`button`,{onClick:()=>k(e.id),disabled:o===e.id||l===e.id,className:`p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50`,title:`Restart ${e.id}`,children:M(I,{className:`h-3 w-3 ${o===e.id?`animate-spin`:``}`})}),M(`button`,{onClick:()=>N(e.id),disabled:o===e.id||l===e.id,className:`p-1 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors disabled:opacity-50`,title:`Uninstall ${e.id}`,children:l===e.id?M(z,{className:`h-3 w-3 animate-spin`}):M(U,{className:`h-3 w-3`})})]})})]},e.id))})]})]})}D();function he(e){if(e<60)return`${e}s`;let t=Math.floor(e/60);if(t<60)return`${t}m`;let n=Math.floor(t/60);return n<24?`${n}h ${t%60}m`:`${Math.floor(n/24)}d ${n%24}h`}function ge({state:e}){return M(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full ${e===`running`?`bg-success/10 text-success`:e===`crashed`||e===`failed`?`bg-destructive/10 text-destructive`:`bg-muted text-muted-foreground`}`,children:e})}var _e=[`trace`,`debug`,`info`,`warn`,`error`];function ve({proc:e,nodeId:t,defaultExpanded:n,activePanel:r,onTogglePanel:i}){let a=e.services??[],c=a.length===1,[u,d]=j(c||n),[p,h]=j(null),[v,y]=j(`info`),x=e.name.includes(`(core)`),C=s(),w=l(),T=f(),E=async e=>{h(e);try{await C.mutateAsync({nodeId:t,addonId:e})}catch(e){console.error(`Failed to restart addon:`,e)}finally{h(null)}},D=async()=>{h(e.name);try{await w.mutateAsync({nodeId:t,processName:e.name})}catch(e){console.error(`Failed to restart process:`,e)}finally{h(null)}},k=async n=>{let r=`${t}/${e.name}`;try{await T.mutateAsync({nodeId:r,level:n}),y(n)}catch(e){console.error(`Failed to set log level:`,e)}};return O(`div`,{className:`border border-border/50 rounded-lg overflow-hidden`,children:[O(`div`,{role:c?void 0:`button`,tabIndex:c?void 0:0,onClick:c?void 0:()=>d(!u),onKeyDown:c?void 0:e=>{(e.key===`Enter`||e.key===` `)&&d(!u)},className:`flex items-center gap-2 w-full px-3 py-2 bg-muted/20 transition-colors text-left select-none ${c?``:`hover:bg-muted/40 cursor-pointer`}`,children:[c?M(`span`,{className:`h-3 w-3 shrink-0`}):M(u?re:ae,{className:`h-3 w-3 text-muted-foreground shrink-0`}),x?M(L,{className:`h-3.5 w-3.5 text-primary shrink-0`}):M(G,{className:`h-3.5 w-3.5 text-amber-500 shrink-0`}),M(`span`,{className:`text-xs font-semibold flex-1`,children:e.name}),O(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:[`PID `,e.pid]}),M(ge,{state:e.state}),O(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:[e.cpuPercent,`% CPU`]}),M(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:J(e.memoryRss)}),M(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:he(e.uptimeSeconds)}),!x&&O(`div`,{className:`flex items-center gap-1`,onClick:e=>e.stopPropagation(),children:[O(g,{children:[M(_,{className:`text-[9px] px-1.5 py-0.5 rounded border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors font-mono`,title:`Set log level`,children:v}),M(o,{align:`end`,className:`min-w-[70px] py-0.5`,children:_e.map(e=>M(m,{onClick:()=>k(e),className:`h-auto px-2 py-1 text-[10px] font-mono ${e===v?`text-primary font-semibold`:``}`,children:e},e))})]}),M(`button`,{onClick:D,disabled:p===e.name,className:`p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50`,title:`Restart process`,children:M(I,{className:`h-3 w-3 ${p===e.name?`animate-spin`:``}`})})]})]}),u&&a.length>0&&M(`div`,{className:`divide-y divide-border/30`,children:a.map(e=>O(`div`,{children:[O(`div`,{className:`flex items-center gap-2 px-3 py-1.5 pl-9 hover:bg-muted/10 transition-colors`,children:[M(`div`,{className:`h-1.5 w-1.5 rounded-full shrink-0 ${e.status===`running`?`bg-success`:`bg-muted-foreground/30`}`}),M(`span`,{className:`text-xs font-medium flex-1 min-w-0 truncate`,children:e.addonId}),e.capabilities.length>0&&O(`div`,{className:`flex gap-1 flex-shrink-0`,children:[e.capabilities.slice(0,3).map(e=>M(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-blue-500/10 text-blue-400 truncate max-w-[80px]`,children:e},e)),e.capabilities.length>3&&O(`span`,{className:`text-[9px] text-muted-foreground`,children:[`+`,e.capabilities.length-3]})]}),O(`div`,{className:`flex items-center gap-1 shrink-0`,children:[M(`button`,{onClick:()=>i(e.addonId,`logs`),className:`p-0.5 rounded transition-colors ${r?.addonId===e.addonId&&r.type===`logs`?`bg-primary/10 text-primary`:`hover:bg-muted text-muted-foreground hover:text-foreground`}`,title:`Show logs for ${e.addonId}`,children:M(V,{className:`h-3 w-3`})}),M(`button`,{onClick:()=>i(e.addonId,`events`),className:`p-0.5 rounded transition-colors ${r?.addonId===e.addonId&&r.type===`events`?`bg-primary/10 text-primary`:`hover:bg-muted text-muted-foreground hover:text-foreground`}`,title:`Show events for ${e.addonId}`,children:M(te,{className:`h-3 w-3`})}),M(`button`,{onClick:()=>E(e.addonId),disabled:p===e.addonId,className:`p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50`,title:`Restart ${e.addonId}`,children:M(I,{className:`h-3 w-3 ${p===e.addonId?`animate-spin`:``}`})})]})]}),r?.addonId===e.addonId&&r.type===`logs`&&M(`div`,{className:`border-t border-border/40 bg-muted/5`,children:M(b,{addonId:e.addonId,agentId:t,maxHeight:`max-h-48`,showFilters:!1,onClose:()=>i(e.addonId,`logs`)})}),r?.addonId===e.addonId&&r.type===`events`&&M(`div`,{className:`border-t border-border/40 bg-muted/5`,children:M(S,{addonId:e.addonId,category:`addon.*`,maxHeight:`max-h-48`,onClose:()=>i(e.addonId,`events`)})})]},e.addonId))}),u&&a.length===0&&M(`div`,{className:`px-3 py-2 pl-9 text-[10px] text-muted-foreground`,children:`No services`})]})}function ye({nodeId:e,processes:t}){let[n,r]=j(null),i=(e,t)=>{r(n=>n?.addonId===e&&n.type===t?null:{addonId:e,type:t})};return t.length===0?M(`div`,{className:`py-4 text-xs text-muted-foreground text-center`,children:`No processes on this node`}):M(`div`,{className:`space-y-2 py-1`,children:t.map((t,r)=>M(ve,{proc:t,nodeId:e,defaultExpanded:r===0,activePanel:n,onTogglePanel:i},t.name))})}D();function be(e){return e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m ${e%60}s`:e<86400?`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`:`${Math.floor(e/86400)}d ${Math.floor(e%86400/3600)}h`}function xe(e,t=80){return e.length<=t?e:`…${e.slice(e.length-t+1)}`}function Se({nodeId:e}){let t=A(),i=p(),[a,o]=j(`all`),s=n(`metrics.node-processes-snapshot`,t=>t.nodeId===e),{data:c}=u({nodeId:e}),l=s?.processes??c,d=k(()=>l?[...l]:[],[l]),f=k(()=>a===`ghost`?d.filter(e=>e.classification===`ghost`):d,[d,a]),m=k(()=>{let e=d.filter(e=>e.classification===`ghost`),t=new Map;for(let n of e)t.has(n.ppid)||t.set(n.ppid,[]),t.get(n.ppid).push(n);return[...t.entries()].filter(([,e])=>e.length>1).map(([e,t])=>({ppid:e,children:t})).toSorted((e,t)=>t.children.length-e.children.length)},[d]),h=r({onSettled:()=>{t.invalidateQueries({queryKey:[[`metricsProvider`,`listNodeProcesses`]]})}}),g=k(()=>{let e=new Map;for(let t of d)e.set(t.pid,t.classification);return e},[d]),_=async(t,n)=>{if(t.classification===`root`||t.classification===`system`)return;let r=t.classification===`ghost`?`ghost`:t.addonId??`process`,a=n?`SIGKILL`:`SIGTERM`;await i({title:`Send ${a}?`,message:`Target pid ${t.pid} (${r}) on node ${e}.`,confirmLabel:`Send ${a}`,variant:`danger`})&&h.mutate({nodeId:e,pid:t.pid,force:n})},v=async(t,n)=>{try{await h.mutateAsync({nodeId:e,pid:t,force:n})}catch{}},y=async n=>{let r=g.get(n.ppid);if(r===`root`||r===`system`){await i({title:`Cannot kill protected ancestor`,message:r===`root`?`pid ${n.ppid} is the current node supervisor. Restart the node via the cluster page instead.`:`pid ${n.ppid} is a system ancestor (concurrently / vite / npm wrapper). Killing it would tear down the dev tree.`,confirmLabel:`OK`,cancelLabel:`Close`,variant:`warning`});return}await i({title:`Kill ghost parent + ${n.children.length} child(ren)?`,message:`SIGKILL parent pid ${n.ppid} and SIGTERM ${n.children.length} ghost child(ren) on node ${e}.`,confirmLabel:`Kill all`,variant:`danger`})&&(await Promise.all([v(n.ppid,!0),...n.children.map(e=>v(e.pid,!1))]),t.invalidateQueries({queryKey:[[`metricsProvider`,`listNodeProcesses`]]}))},b=async()=>{let n=d.filter(e=>e.classification===`ghost`);n.length!==0&&await i({title:`Kill all ${n.length} ghost process(es)?`,message:`SIGKILL ${n.length} ghost process(es) on node ${e}. This is irreversible.`,confirmLabel:`Kill all`,variant:`danger`})&&(await Promise.all(n.map(e=>v(e.pid,!0))),t.invalidateQueries({queryKey:[[`metricsProvider`,`listNodeProcesses`]]}))},x=d.filter(e=>e.classification===`ghost`).length,S=d.filter(e=>e.classification===`managed`).length,C=d.filter(e=>e.classification===`root`).length,w=d.filter(e=>e.classification===`system`).length;return O(`div`,{className:`space-y-4`,children:[O(`div`,{className:`flex items-start justify-between gap-4`,children:[O(`p`,{className:`text-[11px] text-foreground-subtle`,children:[`ps`," scan + kernel `$process.list` cross-reference. Ghosts = camstack-shaped commands with no managed binding (usually orphaned to ppid=1). Refreshes every 10s."]}),O(`button`,{type:`button`,onClick:()=>t.invalidateQueries({queryKey:[[`metricsProvider`,`listNodeProcesses`]]}),className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-[11px] text-foreground hover:bg-surface-hover`,children:[M(F,{className:`h-3 w-3`}),` Refresh`]})]}),O(`div`,{className:`grid grid-cols-4 gap-3`,children:[O(`div`,{className:`rounded-lg border border-border p-3`,children:[M(`div`,{className:`text-[10px] uppercase tracking-wider text-foreground-subtle`,children:`Root`}),M(`div`,{className:`text-xl font-semibold text-foreground`,children:C})]}),O(`div`,{className:`rounded-lg border border-border p-3`,children:[M(`div`,{className:`text-[10px] uppercase tracking-wider text-foreground-subtle`,children:`Managed`}),M(`div`,{className:`text-xl font-semibold text-foreground`,children:S})]}),O(`div`,{className:`rounded-lg border border-border p-3`,children:[M(`div`,{className:`text-[10px] uppercase tracking-wider text-foreground-subtle`,children:`System`}),M(`div`,{className:`text-xl font-semibold text-foreground`,children:w})]}),O(`div`,{className:`rounded-lg border p-3 ${x>0?`border-destructive/40 bg-destructive/5`:`border-border`}`,children:[O(`div`,{className:`text-[10px] uppercase tracking-wider text-foreground-subtle flex items-center gap-1`,children:[x>0&&M(X,{className:`h-3 w-3 text-destructive`}),` Ghosts`]}),M(`div`,{className:`text-xl font-semibold ${x>0?`text-destructive`:`text-foreground`}`,children:x})]})]}),m.length>0&&O(`div`,{className:`rounded-lg border border-amber-500/40 bg-amber-500/5 p-3`,children:[O(`div`,{className:`flex items-center gap-1 text-[11px] font-semibold text-amber-400 mb-2`,children:[M(H,{className:`h-3 w-3`}),` Recurring ghost parents (`,m.length,`)`]}),M(`div`,{className:`space-y-1.5`,children:m.map(e=>O(`div`,{className:`text-[11px] text-foreground flex items-center justify-between gap-2`,children:[O(`div`,{className:`flex items-center gap-2`,children:[O(`span`,{className:`font-mono text-foreground-subtle`,children:[`ppid `,e.ppid]}),O(`span`,{children:[`→ `,e.children.length,` ghost(s)`]})]}),O(`button`,{type:`button`,disabled:h.isPending,onClick:()=>{y(e)},className:`inline-flex items-center gap-1 rounded border border-amber-500/40 bg-amber-500/10 px-2 py-0.5 text-[10px] text-amber-400 hover:bg-amber-500/20 disabled:opacity-30`,children:[M(X,{className:`h-3 w-3`}),` Kill parent + `,e.children.length]})]},e.ppid))})]}),O(`div`,{className:`flex items-center justify-between gap-2 text-[11px]`,children:[O(`div`,{className:`flex items-center gap-2`,children:[M(`span`,{className:`text-foreground-subtle`,children:`Filter:`}),O(`button`,{type:`button`,className:`px-2 py-0.5 rounded ${a===`all`?`bg-primary text-primary-foreground`:`border border-border text-foreground hover:bg-surface-hover`}`,onClick:()=>o(`all`),children:[`All (`,d.length,`)`]}),O(`button`,{type:`button`,className:`px-2 py-0.5 rounded ${a===`ghost`?`bg-destructive text-destructive-foreground`:`border border-border text-foreground hover:bg-surface-hover`}`,onClick:()=>o(`ghost`),children:[`Ghost only (`,x,`)`]})]}),x>0&&O(`button`,{type:`button`,disabled:h.isPending,onClick:()=>{b()},className:`inline-flex items-center gap-1 rounded border border-destructive/40 bg-destructive/10 px-2 py-1 text-[11px] font-medium text-destructive hover:bg-destructive/20 disabled:opacity-30`,children:[M(X,{className:`h-3 w-3`}),` Kill all `,x,` ghost(s)`]})]}),M(`div`,{className:`rounded-lg border border-border overflow-x-auto`,children:O(`table`,{className:`w-full text-xs`,children:[M(`thead`,{className:`bg-surface`,children:O(`tr`,{className:`text-foreground-subtle text-[10px] uppercase tracking-wider`,children:[M(`th`,{className:`text-left px-3 py-2`,children:`Class`}),M(`th`,{className:`text-right px-3 py-2`,children:`PID`}),M(`th`,{className:`text-right px-3 py-2`,children:`PPID`}),M(`th`,{className:`text-left px-3 py-2`,children:`Addon`}),M(`th`,{className:`text-left px-3 py-2`,children:`Command`}),M(`th`,{className:`text-right px-3 py-2`,children:`CPU%`}),M(`th`,{className:`text-right px-3 py-2`,children:`RSS`}),M(`th`,{className:`text-right px-3 py-2`,children:`Uptime`}),M(`th`,{className:`w-44`})]})}),O(`tbody`,{children:[f.length===0&&M(`tr`,{children:M(`td`,{colSpan:9,className:`px-3 py-4 text-center text-foreground-subtle text-[11px]`,children:a===`ghost`?`No ghost processes detected.`:`Scanning…`})}),f.map(e=>O(`tr`,{className:`border-t border-border ${e.classification===`ghost`?`bg-destructive/5`:``}`,children:[M(`td`,{className:`px-3 py-2`,children:M(`span`,{className:`inline-block rounded-full px-1.5 py-0.5 text-[10px] font-medium ${e.classification===`ghost`?`bg-destructive/20 text-destructive`:e.classification===`root`?`bg-sky-500/20 text-sky-400`:e.classification===`system`?`bg-foreground-subtle/20 text-foreground-subtle`:`bg-success/20 text-success`}`,children:e.classification})}),M(`td`,{className:`px-3 py-2 text-right font-mono text-foreground`,children:e.pid}),O(`td`,{className:`px-3 py-2 text-right font-mono text-foreground-subtle`,children:[e.ppid,e.orphaned?` ⚠`:``]}),M(`td`,{className:`px-3 py-2 text-foreground-subtle text-[11px]`,children:e.addonId??`—`}),M(`td`,{className:`px-3 py-2 font-mono text-[10px] text-foreground-subtle break-all`,children:xe(e.command)}),M(`td`,{className:`px-3 py-2 text-right text-foreground`,children:e.cpuPercent.toFixed(1)}),M(`td`,{className:`px-3 py-2 text-right text-foreground`,children:J(e.memoryRssBytes)}),M(`td`,{className:`px-3 py-2 text-right text-foreground-subtle`,children:be(e.uptimeSec)}),M(`td`,{className:`px-3 py-2 text-right`,children:O(`div`,{className:`inline-flex gap-1`,children:[O(`button`,{type:`button`,disabled:h.isPending||e.classification===`root`||e.classification===`system`,onClick:()=>{_(e,!1)},title:`SIGTERM`,className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded border border-border text-[10px] text-foreground hover:bg-surface-hover disabled:opacity-30`,children:[M(U,{className:`h-3 w-3`}),` Term`]}),O(`button`,{type:`button`,disabled:h.isPending||e.classification===`root`||e.classification===`system`,onClick:()=>{_(e,!0)},title:`SIGKILL`,className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded border border-destructive/30 text-[10px] text-destructive hover:bg-destructive/10 disabled:opacity-30`,children:[M(X,{className:`h-3 w-3`}),` Kill`]})]})})]},e.pid))]})]})}),h.isError&&O(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-[11px] text-destructive`,children:[`Kill failed:`,` `,h.error instanceof Error?h.error.message:`unknown`]})]})}function Z({nodeId:e,addonIds:t}){return t.length===0?M(`div`,{className:`py-4 text-xs text-muted-foreground text-center`,children:`No addons on this node`}):M(`div`,{className:`w-full py-2`,children:M(se,{nodeId:e,addonIds:t,level:`global`})})}D();function Ce({nodeId:e,addons:n}){let r=A(),{data:i,isLoading:a}=y({nodeId:e}),o=k(()=>{let e=new Map;for(let t of n)for(let n of t.capabilities){let r=e.get(n)??[];r.push(t.id),e.set(n,r)}return[...e.entries()].toSorted(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({capName:e,providers:t}))},[n]),s=t({onSuccess:()=>{r.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getCapabilityBindings`]]})}});return o.length===0?M(`div`,{className:`py-4 text-xs text-muted-foreground text-center`,children:`No capabilities on this node`}):O(`table`,{className:`w-full text-xs`,children:[M(`thead`,{children:O(`tr`,{className:`text-muted-foreground text-left`,children:[M(`th`,{className:`py-2 font-medium w-1/2`,children:`Capability`}),M(`th`,{className:`py-2 font-medium`,children:`Bound provider`})]})}),M(`tbody`,{children:o.map(({capName:t,providers:n})=>{let r=i?.[t]??n[0]??``,o=n.length===1;return O(`tr`,{className:`border-t border-border/50`,children:[M(`td`,{className:`py-2 font-medium`,children:t}),M(`td`,{className:`py-2`,children:M(`select`,{value:r,onChange:n=>s.mutate({nodeId:e,capName:t,addonId:n.target.value}),disabled:o||s.isPending||a,className:`w-full rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary disabled:opacity-60`,title:o?`Only one provider installed — choice becomes available once a second addon registers this capability`:void 0,children:n.map(e=>M(`option`,{value:e,children:e},e))})})]},t)})})]})}D();function we(e){if(e==null)return`—`;let t=Math.floor(e/1e3),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60);return n>0?`${n}d ${r}h ${i}m`:r>0?`${r}h ${i}m`:`${i}m`}function Te(e){let[t,n]=j(!1),[r,a]=j(e.name),o=A(),s=i({onSuccess:()=>{o.invalidateQueries({queryKey:[[`nodes`,`topology`]]})}}),c=(e.localIps??[]).filter(e=>!e.includes(`:`)),l=(e.localIps??[]).filter(e=>e.includes(`:`)),u=async()=>{if(!r.trim()||r===e.name){n(!1);return}try{await s.mutateAsync({nodeId:e.nodeId,name:r.trim()}),n(!1)}catch(e){console.error(`Rename failed:`,e)}},d=[[`Node ID`,M(`span`,{className:`font-mono text-xs`,children:e.nodeId})],[`Display Name`,t?O(`div`,{className:`flex items-center gap-1.5`,children:[M(`input`,{type:`text`,className:`flex-1 px-2 py-0.5 text-xs border border-border rounded bg-background focus:outline-none focus:ring-1 focus:ring-primary`,value:r,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&u(),e.key===`Escape`&&n(!1)},disabled:s.isPending,autoFocus:!0}),M(`button`,{onClick:()=>void u(),disabled:s.isPending,className:`p-0.5 text-success hover:bg-success/10 rounded`,title:`Save`,children:M(ie,{className:`h-3.5 w-3.5`})}),M(`button`,{onClick:()=>n(!1),className:`p-0.5 text-muted-foreground hover:bg-muted rounded`,title:`Cancel`,children:M(oe,{className:`h-3.5 w-3.5`})})]}):O(`div`,{className:`flex items-center gap-1.5`,children:[M(`span`,{className:`text-xs`,children:e.name}),!e.isHub&&M(`button`,{onClick:()=>{a(e.name),n(!0)},className:`p-0.5 text-muted-foreground hover:text-primary rounded`,title:`Rename`,children:M(ee,{className:`h-3 w-3`})})]})],[`Hostname`,M(`span`,{className:`text-xs`,children:e.hostname})],[`Role`,e.isHub?M(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-primary/10 text-primary font-medium`,children:`Hub`}):M(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground font-medium`,children:`Agent`})],[`Root Package`,e.rootPackage?O(`span`,{className:`font-mono text-xs`,children:[e.rootPackage.name,`@`,e.rootPackage.version]}):M(`span`,{className:`text-xs text-muted-foreground`,children:`—`})],[`Platform`,O(`span`,{className:`text-xs`,children:[e.platform,` / `,e.arch]})],[`CPU`,O(`span`,{className:`text-xs`,children:[e.cpuModel??`—`,` (`,e.cpuCores,` cores)`]})],[`Memory`,M(`span`,{className:`text-xs`,children:e.memoryMB>0?`${(e.memoryMB/1024).toFixed(1)} GB`:`—`})],[`Uptime`,M(`span`,{className:`text-xs`,children:we(e.uptime)})],[`Engines`,e.engines.length>0?M(`div`,{className:`flex flex-wrap gap-1`,children:e.engines.map(e=>M(`span`,{className:`text-[9px] px-1.5 py-0.5 rounded-full bg-purple-500/10 text-purple-400 font-medium`,children:e},e))}):M(`span`,{className:`text-xs text-muted-foreground`,children:`—`})]];return c.length>0&&d.push([`IPv4`,M(`div`,{className:`flex flex-wrap gap-1.5`,children:c.map((e,t)=>M(`span`,{className:`font-mono text-xs px-1.5 py-0.5 rounded bg-muted`,children:e},`${e}-${t}`))})]),l.length>0&&d.push([`IPv6`,M(`div`,{className:`flex flex-wrap gap-1.5`,children:l.map((e,t)=>M(`span`,{className:`font-mono text-[10px] px-1.5 py-0.5 rounded bg-muted truncate max-w-[280px]`,title:e,children:e},`${e}-${t}`))})]),M(`div`,{className:`py-2`,children:M(`table`,{className:`w-full text-sm`,children:M(`tbody`,{children:d.map(([e,t],n)=>O(`tr`,{className:n%2==0?`bg-muted/20`:``,children:[M(`td`,{className:`py-1.5 px-2 text-xs font-medium text-muted-foreground w-28 align-top whitespace-nowrap`,children:e}),M(`td`,{className:`py-1.5 px-2`,children:t})]},e))})})})}D();var Ee=[[`serverManagement`,`getServerPackageStatus`]];function Q({label:e,tone:t}){return M(`span`,{className:`inline-flex items-center rounded px-2 py-0.5 text-[11px] font-medium ${{neutral:`bg-surface-muted text-foreground-subtle`,ok:`bg-emerald-500/15 text-emerald-500`,info:`bg-sky-500/15 text-sky-500`,warn:`bg-amber-500/15 text-amber-500`,error:`bg-red-500/15 text-red-500`}[t]}`,children:e})}function $({label:e,value:t}){return O(`div`,{className:`flex items-center justify-between gap-4 text-sm`,children:[M(`span`,{className:`text-foreground-subtle`,children:e}),M(`span`,{className:`font-mono text-foreground`,children:t??`—`})]})}function De({node:e}){let{t}=W(),n=A(),r=p(),[i,o]=j(!1),s=e.isHub?void 0:{nodeId:e.id},l=a(s,{refetchInterval:1e4,enabled:e.isOnline,retry:1}),u=l.data??null,d=T(()=>{n.invalidateQueries({queryKey:Ee})},[n]),f=v({onSettled:d}),m=h({onSettled:d}),g=C({onSettled:d}),_=c({onSettled:d}),y=T(async()=>{u?.latestVersion!=null&&await r({title:t(`serverManagement.confirmUpdateTitle`,`Update node root package`),message:t(`serverManagement.confirmUpdateBody`,`Install {{pkg}}@{{version}} on node "{{node}}" and restart it to apply. The new version boots on probation: if it fails to reach ready, the node automatically rolls back to the current version. Requires an always-relaunching supervisor (Docker restart policy "unless-stopped" or "always"), otherwise the node stays down after exiting to apply.`,{pkg:u.packageName,version:u.latestVersion,node:e.name}),confirmLabel:t(`serverManagement.confirmUpdateAction`,`Update & restart`)})&&(await m.mutateAsync({version:u.latestVersion,...s})).restarting&&o(!0)},[m,r,e.name,s,u,t]),b=T(async()=>{u?.previousVersion!=null&&await r({title:t(`serverManagement.confirmRollbackTitle`,`Roll back node root package`),message:t(`serverManagement.confirmRollbackBody`,`Restart node "{{node}}" on the previous version ({{version}})?`,{node:e.name,version:u.previousVersion}),confirmLabel:t(`serverManagement.confirmRollbackAction`,`Roll back & restart`)})&&(await g.mutateAsync(s)).restarting&&o(!0)},[r,e.name,g,s,u,t]),x=T(async()=>{await r({title:t(`serverManagement.confirmRestartTitle`,`Restart node`),message:t(`serverManagement.confirmRestartBody`,`Restart node "{{node}}" now? The process exits and its supervisor relaunches it on the same version. In-flight requests to this node are dropped.`,{node:e.name}),confirmLabel:t(`serverManagement.confirmRestartAction`,`Restart`),variant:`warning`})&&(await _.mutateAsync(s)).restarting&&o(!0)},[r,e.name,_,s,t]),S=()=>{switch(u?.bootMode){case`data-root`:return{label:t(`serverManagement.bootDataRoot`,`runtime-updatable`),tone:`ok`};case`workspace`:return{label:t(`serverManagement.bootWorkspace`,`dev workspace`),tone:`info`};default:return{label:t(`serverManagement.bootBaked`,`baked image seed`),tone:`neutral`}}},w=()=>{if(u==null)return null;if(u.rolledBack!=null)return{label:t(`serverManagement.stateRolledBack`,`rolled back (update failed)`),tone:`error`};switch(u.updateState){case`checking`:return{label:t(`serverManagement.stateChecking`,`checking…`),tone:`info`};case`staging`:return{label:t(`serverManagement.stateStaging`,`updating…`),tone:`info`};case`pending-restart`:return{label:t(`serverManagement.statePending`,`restart pending`),tone:`warn`};case`awaiting-confirmation`:return{label:t(`serverManagement.stateAwaitingConfirmation`,`awaiting confirmation`),tone:`warn`};default:return u.updateAvailable?{label:t(`serverManagement.stateUpdateAvailable`,`update available`),tone:`warn`}:{label:t(`serverManagement.stateUpToDate`,`up to date`),tone:`ok`}}},E=u?.bootMode===`workspace`,D=e.isOnline&&u!=null&&!E&&u.updateAvailable&&u.updateState===`idle`&&!m.isPending,k=e.isOnline&&u!=null&&!E&&u.previousVersion!=null&&u.updateState===`idle`&&!g.isPending,N=e.isOnline&&u!=null&&u.updateState===`idle`&&!_.isPending,P=e.isOnline?w():null;return O(`div`,{className:`space-y-4 py-2`,children:[O(`div`,{className:`flex items-center justify-between gap-3`,children:[O(`div`,{className:`flex items-center gap-2 min-w-0`,children:[M(`span`,{className:`font-mono text-xs text-foreground-subtle truncate`,children:u?.packageName??e.rootPackage?.name??(e.isHub?`@camstack/server`:`@camstack/agent`)}),e.isOnline&&u!=null&&M(Q,{...S()})]}),P!=null&&M(Q,{...P})]}),!e.isOnline&&M($,{label:t(`serverManagement.lastReportedVersion`,`Last reported version`),value:e.rootPackage?.version??null}),e.isOnline&&l.isLoading&&O(`div`,{className:`flex items-center gap-2 text-sm text-foreground-subtle`,children:[M(z,{className:`h-4 w-4 animate-spin`}),t(`common.loading`,`Loading…`)]}),e.isOnline&&l.isError&&O(`div`,{className:`space-y-1.5`,children:[M(`p`,{className:`text-sm text-red-500`,children:t(`serverManagement.loadError`,`Could not load the node root-package status.`)}),e.rootPackage!=null&&M($,{label:t(`serverManagement.lastReportedVersion`,`Last reported version`),value:e.rootPackage.version})]}),e.isOnline&&u!=null&&O(`div`,{className:`space-y-1.5`,children:[M($,{label:t(`serverManagement.runningVersion`,`Running version`),value:u.runningVersion}),M($,{label:t(`serverManagement.latestVersion`,`Latest on registry`),value:u.latestVersion}),M($,{label:t(`serverManagement.previousVersion`,`Previous (rollback target)`),value:u.previousVersion}),M($,{label:t(`serverManagement.seedVersion`,`Image seed version`),value:u.seedVersion}),M($,{label:t(`serverManagement.nodeRuntimeVersion`,`Node.js runtime`),value:u.nodeRuntimeVersion}),u.pendingVersion!=null&&M($,{label:t(`serverManagement.pendingVersion`,`Staged (applies on restart)`),value:u.pendingVersion})]}),e.isOnline&&u?.updateState===`awaiting-confirmation`&&M(`div`,{className:`rounded border border-amber-500/30 bg-amber-500/10 p-2.5 text-xs text-amber-500`,children:t(`serverManagement.awaitingConfirmationWarning`,`This node restarted onto {{version}} and is confirming boot health — avoid restarting it now. Update and rollback are temporarily unavailable until the probation boot confirms; a manual restart during this window would auto-roll-back the update.`,{version:u.pendingVersion??u.runningVersion??``})}),e.isOnline&&u?.stateFileCorrupt===!0&&M(`div`,{className:`rounded border border-amber-500/30 bg-amber-500/10 p-2.5 text-xs text-amber-500`,children:t(`serverManagement.stateCorruptWarning`,`The server-root state file on this node is corrupt — it booted from the baked seed and any installed data-directory versions are being ignored. Applying an update will rewrite the state file.`)}),e.isOnline&&u?.rolledBack!=null&&M(`div`,{className:`rounded border border-red-500/30 bg-red-500/10 p-2.5 text-xs text-red-400`,children:t(`serverManagement.rolledBackDetail`,`Update to {{from}} failed and was rolled back to {{to}}: {{reason}}`,{from:u.rolledBack.fromVersion,to:u.rolledBack.toVersion??t(`serverManagement.bakedSeed`,`the baked seed`),reason:u.rolledBack.reason})}),e.isOnline&&E&&M(`p`,{className:`text-xs text-foreground-subtle`,children:t(`serverManagement.workspaceNote`,`Development workspace detected — runtime updates are disabled (the dev loop resolves code from the workspace).`)}),i&&O(`div`,{className:`flex items-center gap-2 text-sm text-amber-500`,children:[M(z,{className:`h-4 w-4 animate-spin`}),t(`serverManagement.nodeRestarting`,`The node is restarting to apply the change…`)]}),e.isOnline&&O(`div`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:[O(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded border border-border px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-surface-muted disabled:opacity-50`,disabled:f.isPending||u?.updateState===`staging`,onClick:()=>f.mutate(s),children:[f.isPending?M(z,{className:`h-3.5 w-3.5 animate-spin`}):M(F,{className:`h-3.5 w-3.5`}),t(`serverManagement.checkForUpdate`,`Check for update`)]}),D&&O(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded bg-primary px-2.5 py-1.5 text-xs font-medium text-primary-foreground hover:opacity-90 disabled:opacity-50`,onClick:()=>void y(),children:[m.isPending?M(z,{className:`h-3.5 w-3.5 animate-spin`}):M(Y,{className:`h-3.5 w-3.5`}),t(`serverManagement.updateTo`,`Update to {{version}}`,{version:u?.latestVersion??``})]}),k&&O(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded border border-amber-500/40 px-2.5 py-1.5 text-xs font-medium text-amber-500 hover:bg-amber-500/10 disabled:opacity-50`,onClick:()=>void b(),children:[g.isPending?M(z,{className:`h-3.5 w-3.5 animate-spin`}):M(ue,{className:`h-3.5 w-3.5`}),t(`serverManagement.rollback`,`Roll back to {{version}}`,{version:u?.previousVersion??``})]}),O(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded border border-border px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-surface-muted disabled:opacity-50`,disabled:!N,onClick:()=>void x(),children:[_.isPending?M(z,{className:`h-3.5 w-3.5 animate-spin`}):M(I,{className:`h-3.5 w-3.5`}),t(`serverManagement.restart`,`Restart`)]})]}),e.isOnline&&u?.lastCheckedAtMs!=null&&O(`p`,{className:`flex items-center gap-1.5 text-[11px] text-foreground-subtle`,children:[M(le,{className:`h-3 w-3`}),t(`serverManagement.lastChecked`,`Last checked: {{when}}`,{when:new Date(u.lastCheckedAtMs).toLocaleString()})]})]})}D();function Oe({node:e}){let t=P(),[n,r]=j(`info`),[i,a]=j(!1),o=e.processes??[],s=e.addons.map(e=>e.id),c=async()=>{if(!i){a(!0);try{await Promise.allSettled([t.trpcClient.pipelineOrchestrator.removeAgentSettings.mutate({agentNodeId:e.id}),t.trpcClient.clusterNodes.forgetNode.mutate({nodeId:e.id})])}finally{a(!1)}}};return e.isOnline?O(`div`,{className:`border border-border rounded-xl overflow-hidden`,children:[O(`div`,{className:`flex items-center gap-3 px-4 py-3 bg-muted/30 border-b border-border`,children:[M(`div`,{className:`w-2.5 h-2.5 rounded-full bg-success`}),M(`span`,{className:`text-sm font-semibold`,children:e.name}),O(`span`,{className:`text-xs text-muted-foreground`,children:[e.cpuModel??e.platform,` ·`,` `,e.memoryMB>0?`${Math.round(e.memoryMB/1024)}GB`:``,` · `,e.arch]}),e.engines.map(e=>M(`span`,{className:`text-[9px] px-1.5 py-0.5 rounded-full bg-purple-500/10 text-purple-400 font-medium`,children:e},e)),O(`div`,{className:`ml-auto flex gap-3 text-xs text-muted-foreground`,children:[O(`span`,{className:`flex items-center gap-1`,children:[M(ne,{className:`h-3 w-3`}),` `,e.cpuPercent,`%`]}),O(`span`,{className:`flex items-center gap-1`,children:[M(de,{className:`h-3 w-3`}),` `,e.memoryPercent,`%`]})]})]}),M(`div`,{className:`flex border-b border-border px-4`,children:[`info`,`addons`,`forks`,`processes`,`settings`,`capabilities`].map(t=>M(`button`,{onClick:()=>r(t),className:`px-3 py-2 text-xs font-medium border-b-2 transition-colors ${n===t?`border-primary text-primary`:`border-transparent text-muted-foreground hover:text-foreground`}`,children:t===`info`?`General`:t===`addons`?`Addons (${e.addons.length})`:t===`forks`?`Forks (${o.length})`:t===`processes`?`Processes`:t===`settings`?`Settings`:`Capabilities`},t))}),O(`div`,{className:`px-4 py-2`,children:[n===`info`&&O(`div`,{className:`space-y-3`,children:[M(Te,{nodeId:e.id,name:e.name,hostname:e.hostname,platform:e.platform,arch:e.arch,cpuModel:e.cpuModel,cpuCores:e.cpuCores,memoryMB:e.memoryMB,engines:e.engines,isHub:e.isHub,uptime:e.uptime,localIps:e.localIps,rootPackage:e.rootPackage}),M(`div`,{className:`border-t border-border pt-1`,children:M(De,{node:{id:e.id,name:e.name,isHub:e.isHub,isOnline:e.isOnline,rootPackage:e.rootPackage??null}})})]}),n===`addons`&&M(me,{nodeId:e.id,addons:e.addons,isHub:e.isHub}),n===`forks`&&M(ye,{nodeId:e.id,processes:o}),n===`processes`&&M(Se,{nodeId:e.id}),n===`settings`&&M(Z,{nodeId:e.id,addonIds:s}),n===`capabilities`&&M(Ce,{nodeId:e.id,addons:e.addons})]})]}):O(`div`,{className:`border border-border rounded-xl overflow-hidden opacity-60`,children:[O(`div`,{className:`flex items-center gap-3 px-4 py-3 bg-muted/30`,children:[M(`div`,{className:`w-2.5 h-2.5 rounded-full bg-destructive`}),M(`span`,{className:`text-sm font-semibold`,children:e.name}),O(`span`,{className:`text-xs text-muted-foreground`,children:[e.cpuModel??e.platform,` ·`,` `,e.memoryMB>0?`${Math.round(e.memoryMB/1024)}GB`:``,` · `,e.arch]}),e.engines.map(e=>M(`span`,{className:`text-[9px] px-1.5 py-0.5 rounded-full bg-purple-500/10 text-purple-400 font-medium`,children:e},e)),e.rootPackage&&O(`span`,{className:`text-[10px] font-mono px-1.5 py-0.5 rounded bg-muted text-muted-foreground`,children:[e.rootPackage.name,`@`,e.rootPackage.version]}),M(`span`,{className:`ml-auto text-xs px-2 py-0.5 rounded-full bg-destructive/10 text-destructive`,children:`offline`})]}),O(`div`,{className:`flex items-center justify-between gap-3 px-4 py-3`,children:[O(`span`,{className:`text-xs text-muted-foreground`,children:[e.lastSeen?`Last seen ${new Date(e.lastSeen).toLocaleString()} — `:``,e.addons.length,` addon`,e.addons.length===1?``:`s`,` assigned; will resume when node reconnects`]}),O(`button`,{type:`button`,onClick:()=>void c(),disabled:i,title:`Forget this node — removes its saved history and pipeline assignments`,className:`flex items-center gap-1 text-xs px-2 py-1 rounded-md border border-border text-muted-foreground hover:text-destructive hover:border-destructive/50 disabled:opacity-50 transition-colors`,children:[M(U,{className:`h-3 w-3`}),i?`Forgetting…`:`Forget node`]})]})]})}D();function ke({nodes:e,focusNodeId:t,focusNonce:n}){let r=[...e].toSorted((e,t)=>e.isHub?-1:t.isHub?1:e.isOnline&&!t.isOnline?-1:!e.isOnline&&t.isOnline?1:e.name.localeCompare(t.name)),i=E(null);return N(()=>{if(!t)return;let e=i.current?.querySelector(`#node-card-${CSS.escape(t)}`);e&&e.scrollIntoView({behavior:`smooth`,block:`start`})},[t,n]),M(`div`,{ref:i,className:`flex flex-col gap-4`,children:r.map(e=>M(`div`,{id:`node-card-${e.id}`,children:M(Oe,{node:e})},e.id))})}D();function Ae(e){let[t,n]=j(()=>typeof window<`u`?window.matchMedia(e).matches:!1);return N(()=>{let t=window.matchMedia(e),r=e=>n(e.matches);return t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}function je(){let{data:e,isLoading:t}=w(void 0,{staleTime:1/0}),[n,r]=j(null);return x(`cluster.topology-snapshot`,e=>{let t=e.data?.nodes;Array.isArray(t)&&r(t)}),{nodes:k(()=>n??e??[],[n,e]),isLoading:t&&!n}}function Me(){let{t:e}=W(),t=p(),[n,r]=j(`table`),[i,a]=j(void 0),[o,s]=j(0),c=Ae(`(max-width: 767px)`),l=c&&n===`graph`?`table`:n,{nodes:u,isLoading:d}=je(),f=k(()=>q(u),[u]),m=k(()=>u.filter(e=>e.isOnline),[u]),g=m.length,_=u.filter(e=>!e.isOnline).length,v=h(),[y,b]=j(!1),x=T(async()=>{let n=[...m].sort((e,t)=>e.isHub===t.isHub?0:e.isHub?1:-1);if(await t({title:e(`serverManagement.confirmUpdateAllTitle`,`Update all nodes`),message:e(`serverManagement.confirmUpdateAllBody`,`Sequentially update every online node to its latest published version — agents first, the hub last. Each node installs its root package (only if newer than what it runs) and restarts on probation with automatic rollback; already-current nodes are skipped. The hub restarts last, so this page will reconnect afterwards.`),confirmLabel:e(`serverManagement.confirmUpdateAllAction`,`Update all & restart`),variant:`warning`})){b(!0);try{for(let e of n)try{await v.mutateAsync(e.isHub?{}:{nodeId:e.id})}catch{}}finally{b(!1)}}},[v,t,m,e]),S=T(e=>{r(`table`),a(e),s(e=>e+1)},[]),C=(e,t,i)=>O(`button`,{onClick:()=>r(e),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-colors ${n===e?`bg-primary text-primary-foreground`:`text-muted-foreground hover:text-foreground`}`,children:[M(i,{className:`h-3.5 w-3.5`}),t]});return O(`div`,{className:`flex flex-col h-full gap-4 p-4`,children:[O(`div`,{className:`flex items-center justify-between gap-2 flex-wrap`,children:[O(`div`,{className:`flex items-center gap-2`,children:[g>0&&O(`span`,{className:`text-xs px-2 py-0.5 rounded-full bg-success/10 text-success`,children:[g,` online`]}),_>0&&O(`span`,{className:`text-xs px-2 py-0.5 rounded-full bg-destructive/10 text-destructive`,children:[_,` offline`]})]}),O(`div`,{className:`flex items-center gap-2`,children:[g>1&&O(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:opacity-90 disabled:opacity-50`,disabled:y,title:e(`serverManagement.updateAllHint`,`Sequenced agents-first, hub-last — up-to-date nodes are skipped.`),onClick:()=>void x(),children:[y?M(z,{className:`h-3.5 w-3.5 animate-spin`}):M(Y,{className:`h-3.5 w-3.5`}),e(`serverManagement.updateAll`,`Update all nodes`)]}),O(`div`,{className:`flex gap-0.5 p-1 rounded-lg bg-muted`,children:[C(`table`,`Table`,fe),!c&&C(`graph`,`Graph`,ce)]})]})]}),d?M(`div`,{className:`flex items-center justify-center flex-1 text-muted-foreground`,children:`Loading cluster topology...`}):l===`graph`?M(K,{graph:f,onOpenNodeDetail:S}):M(`div`,{className:`flex-1 overflow-auto`,children:M(ke,{nodes:u,focusNodeId:i,focusNonce:o})})]})}export{Me as ClusterPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Bt as e,Gt as t,Ht as n,Ji as r,Kt as i,Oa as a,Qi as o,Sa as s,Ut as c,Vt as l,Wt as u,Xi as d,Yi as f,qt as p,wt as m,zt as h}from"./src-BhRH3dxa.js";import{I as g,Q as _,S as v,W as y,b,o as x,q as S,x as C,z as w}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{H as T}from"./src-7HDrFEPH.js";import{t as E}from"./download-5vnInJfp.js";import{i as D,n as O,r as k,t as A}from"./AddLocationWizard-DKMFqTvZ.js";import{t as j}from"./plus-ByGzrFiA.js";import{t as M}from"./rotate-cw-QbVLxhT1.js";import{F as N,N as P,S as F,U as I,V as ee,i as L,s as R}from"./index-B0VBnS5H.js";import{t as z}from"./AdminPage-BwmGKnRf.js";import{n as te}from"./authed-media-XfBD4Ma-.js";import{t as B}from"./format-size-CO9d3C3-.js";import{t as V}from"./AdminTabs-DsU1olLw.js";var H=I(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),ne=I(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),U=I(`calendar-clock`,[[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M17.5 17.5 16 16.3V14`,key:`akvzfd`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]);_();function W(){let e=x(),t=s(),{data:n,isLoading:i,isError:a}=d({}),c=f(),l=y(()=>c.data??[],[c.data]),[u,p]=S(null),[m,h]=S(null),g=r({onSuccess:()=>{e.invalidateQueries({queryKey:[[`storage`,`listLocations`]]})}}),_=o({onSuccess:()=>{e.invalidateQueries({queryKey:[[`storage`,`listLocations`]]})}}),b=e=>{e.isDefault||_.mutate({id:e.id,type:e.type,providerId:e.providerId,displayName:e.displayName,config:e.config,isDefault:!0})},w=async e=>{if(e.isDefault){await t({title:`Cannot delete default location`,message:`"${e.displayName}" is the default for type "${e.type}". Mark another location as default first, then delete this one.`,confirmLabel:`OK`,variant:`warning`});return}await t({title:`Delete location "${e.displayName}"?`,message:`This removes the location record. Files on disk are not deleted; the underlying directory or remote path stays untouched.`,confirmLabel:`Delete`,variant:`danger`})&&g.mutate({id:e.id})},T=y(()=>{let e=new Map;for(let t of n??[]){let n=e.get(t.type);n?n.push(t):e.set(t.type,[t])}return e},[n]),E=i||c.isLoading,D=a||c.isError;return v(z,{children:[E&&C(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading locations…`}),D&&C(`div`,{className:`text-xs text-danger`,children:`Failed to load storage locations.`}),!E&&!D&&v(`div`,{className:`space-y-3`,children:[l.length===0&&C(`div`,{className:`rounded-lg border border-border bg-surface px-3 py-4 text-center text-[11px] text-foreground-subtle italic`,children:`No storage locations declared by any installed addon.`}),l.map(e=>C(k,{type:e.id,displayName:e.displayName,description:e.description,cardinality:e.cardinality,locations:T.get(e.id)??[],onAdd:e=>p(e),onEdit:e=>h(e),onDelete:e=>{w(e)},onSetDefault:e=>b(e)},e.id))]}),u!==null&&C(A,{initialType:u,onClose:()=>p(null),onCreated:()=>{e.invalidateQueries({queryKey:[[`storage`,`listLocations`]]}),p(null)}}),m!==null&&C(O,{location:m,onClose:()=>h(null),onSaved:()=>{e.invalidateQueries({queryKey:[[`storage`,`listLocations`]]}),h(null)}})]})}_();var G=[[`backup`,`listDestinations`]],K=[`backup`,`listArchives`];function q({destinationId:e,restoreSupported:t,onOpenRestoreWizard:n}){let r=x(),i=s(),{data:a,isLoading:o,isError:c}=l({destinationId:e}),u=a??[],d=h({onSuccess:()=>{r.invalidateQueries({queryKey:[[...K]]}),r.invalidateQueries({queryKey:G})}}),f=g(async t=>{await i({title:`Delete this archive?`,message:`Permanently deletes "${t.label??t.id}" and frees ${B(t.sizeBytes)}.`,confirmLabel:`Delete`,variant:`danger`})&&d.mutate({destinationId:e,backupId:t.id})},[i,e,d]),[p,m]=S(null),_=g(async t=>{m(t.id);try{let n=await te(J(e,t.id)),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${t.label??t.id}.tar.gz`,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(r)}finally{m(null)}},[e]),b=y(()=>[...u].toSorted((e,t)=>t.createdAt-e.createdAt),[u]);return o?C(`div`,{className:`text-xs text-foreground-subtle animate-pulse py-2`,children:`Loading archives…`}):c?C(`div`,{className:`text-xs text-danger py-2`,children:`Failed to read manifest for this destination`}):b.length===0?C(`div`,{className:`text-xs text-foreground-subtle italic py-2`,children:`No archives at this destination yet.`}):C(`div`,{className:`rounded border border-border bg-surface overflow-x-auto`,children:v(`table`,{className:`w-full text-xs min-w-[640px]`,children:[C(`thead`,{children:v(`tr`,{className:`text-foreground-subtle bg-background/30`,children:[C(`th`,{className:`text-left px-3 py-1.5 font-medium`,children:`When`}),C(`th`,{className:`text-left px-3 py-1.5 font-medium`,children:`Label`}),C(`th`,{className:`text-left px-3 py-1.5 font-medium`,children:`Includes`}),C(`th`,{className:`text-right px-3 py-1.5 font-medium`,children:`Size`}),C(`th`,{className:`text-right px-3 py-1.5 font-medium w-52`,children:`Actions`})]})}),C(`tbody`,{children:b.map(r=>v(`tr`,{className:`border-t border-border hover:bg-primary/5`,children:[C(`td`,{className:`px-3 py-1.5 text-foreground tabular-nums`,children:Y(r.createdAt)}),C(`td`,{className:`px-3 py-1.5 text-foreground`,children:r.label??C(`span`,{className:`text-foreground-subtle italic`,children:`—`})}),C(`td`,{className:`px-3 py-1.5 text-foreground-subtle`,children:r.locations.join(`, `)}),C(`td`,{className:`px-3 py-1.5 text-foreground text-right tabular-nums`,children:B(r.sizeBytes)}),C(`td`,{className:`px-3 py-1.5`,children:v(`div`,{className:`flex items-center justify-end gap-1`,children:[v(`button`,{onClick:()=>{_(r)},disabled:p===r.id,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-foreground-subtle hover:text-foreground hover:bg-primary/10 disabled:opacity-50`,title:`Download archive`,children:[p===r.id?C(F,{className:`h-3 w-3 animate-spin`}):C(E,{className:`h-3 w-3`}),`Download`]}),t&&n&&v(`button`,{onClick:()=>n({destinationId:e,archiveId:r.id}),className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-primary hover:bg-primary/10`,title:`Restore from this archive`,children:[C(M,{className:`h-3 w-3`}),`Restore`]}),C(`button`,{onClick:()=>{f(r)},disabled:d.isPending,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger hover:bg-danger/10 disabled:opacity-50`,title:`Delete archive`,children:d.isPending?C(F,{className:`h-3 w-3 animate-spin`}):C(R,{className:`h-3 w-3`})})]})})]},r.id))})]})})}function J(e,t){return`/api/backup/download/${encodeURIComponent(e)}/${encodeURIComponent(t)}`}function Y(e){return new Date(e).toLocaleString(void 0,{day:`2-digit`,month:`short`,year:`numeric`,hour:`2-digit`,minute:`2-digit`})}_();var X=[{id:`manual`,label:`Manual only`,cron:``},{id:`hourly`,label:`Every hour`,cron:`0 * * * *`,description:`On the hour`},{id:`every-3h`,label:`Every 3 hours`,cron:`0 */3 * * *`,description:`00:00, 03:00, 06:00, 09:00 …`},{id:`every-6h`,label:`Every 6 hours`,cron:`0 */6 * * *`,description:`00:00, 06:00, 12:00, 18:00`},{id:`daily-3am`,label:`Daily at 03:00`,cron:`0 3 * * *`,description:`Every night at 3 AM`},{id:`weekly-sun`,label:`Weekly Sunday 03:00`,cron:`0 3 * * 0`,description:`Sunday morning at 3 AM`}];function Z(e){let t=e.trim();for(let e of X)if(e.cron===t)return e.id;return`custom`}function re({value:e,onChange:t,previewCount:n=5,disabled:r=!1}){let i=Z(e),[a,o]=S(i===`custom`);w(()=>{i!==`custom`&&o(!1)},[i]);let s=oe(e,250),c=u({cron:s,count:n},{enabled:s.trim().length>0}),l=c.data??null,d=e=>{o(!1),t(e.cron)},f=a||i===`custom`;return v(`div`,{className:`space-y-3`,children:[v(`div`,{className:`space-y-1`,children:[C(`div`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Schedule preset`}),v(`div`,{className:`flex flex-wrap gap-1.5`,children:[X.map(e=>C(`button`,{type:`button`,onClick:()=>d(e),disabled:r,className:`rounded border px-2 py-1 text-[11px] transition-colors disabled:opacity-50 `+(!a&&i===e.id?`border-primary bg-primary/10 text-primary`:`border-border bg-background text-foreground-subtle hover:bg-primary/5 hover:text-foreground`),title:e.description??e.label,children:e.label},e.id)),C(`button`,{type:`button`,onClick:()=>{o(!0),e.trim().length===0&&t(`0 3 * * *`)},disabled:r,className:`rounded border px-2 py-1 text-[11px] transition-colors disabled:opacity-50 `+(f?`border-primary bg-primary/10 text-primary`:`border-border bg-background text-foreground-subtle hover:bg-primary/5 hover:text-foreground`),children:`Custom…`})]})]}),f&&v(`div`,{className:`space-y-1`,children:[C(`div`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Cron expression (5-field POSIX)`}),C(`input`,{type:`text`,value:e,onChange:e=>t(e.target.value),disabled:r,placeholder:`0 3 * * *`,spellCheck:!1,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs font-mono text-foreground placeholder:text-foreground-subtle focus:outline-none focus:ring-1 focus:ring-primary`}),v(`p`,{className:`text-[10px] text-foreground-subtle`,children:[`Format: `,C(`span`,{className:`font-mono`,children:`minute hour day-of-month month day-of-week`}),` · all times server-local`]})]}),C(ie,{cron:s,preview:l,loading:c.isFetching})]})}function ie({cron:e,preview:t,loading:n}){return n&&t===null?v(`div`,{className:`flex items-center gap-2 rounded border border-border bg-background/40 px-3 py-2 text-[11px] text-foreground-subtle`,children:[C(F,{className:`h-3 w-3 animate-spin`}),`Validating…`]}):t===null?null:t.ok?t.nextRuns.length===0?C(`div`,{className:`rounded border border-border bg-background/40 px-3 py-2 text-[11px] text-foreground-subtle`,children:`No future runs match this expression.`}):v(`div`,{className:`space-y-1`,children:[C(`div`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Next runs`}),C(`ul`,{className:`rounded border border-border bg-background/40 divide-y divide-border`,children:t.nextRuns.map((e,t)=>v(`li`,{className:`flex items-center justify-between px-3 py-1.5 text-[11px]`,children:[C(`span`,{className:`text-foreground tabular-nums`,children:new Date(e).toLocaleString()}),C(`span`,{className:`text-foreground-subtle text-[10px] tabular-nums`,children:ae(e)})]},`${e}-${t}`))})]}):C(`div`,{className:`rounded border border-danger/40 bg-danger/10 px-3 py-2 text-[11px] text-danger`,children:t.error??`Invalid cron expression`})}function ae(e){let t=e-Date.now();if(t<=0)return`now`;let n=Math.floor(t/1e3);if(n<60)return`in ${n}s`;let r=Math.floor(n/60);if(r<60)return`in ${r}m`;let i=Math.floor(r/60);return i<24?`in ${i}h`:`in ${Math.floor(i/24)}d`}function oe(e,t){let[n,r]=S(e),i=y(()=>e,[e]);return w(()=>{let e=setTimeout(()=>r(i),t);return()=>clearTimeout(e)},[i,t]),n}_();var se=[[`backup`,`listDestinations`]];function ce({onCreateAt:e,onOpenRestoreWizard:t}){let{data:r,isLoading:i,isError:a}=n(),o=r??[],[s,c]=S(null),l=e=>{c(t=>t===e?null:e)},u=fe();return i?C(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading destinations…`}):a?C(`div`,{className:`text-xs text-danger`,children:`Failed to load destinations`}):o.length===0?C(`div`,{className:`rounded-lg border border-border bg-surface px-4 py-8 text-center`,children:C(`p`,{className:`text-xs text-foreground-subtle`,children:"No `backups`-typed storage locations registered. Add one in Settings → Storage to begin."})}):C(`div`,{className:`rounded-lg border border-border bg-surface overflow-x-auto`,children:v(`table`,{className:`w-full text-xs min-w-[720px]`,children:[C(`thead`,{children:v(`tr`,{className:`text-foreground-subtle border-b border-border bg-background/40`,children:[C(`th`,{className:`text-left px-3 py-2 font-medium w-6`}),C(`th`,{className:`text-left px-3 py-2 font-medium`,children:`Destination`}),C(`th`,{className:`text-left px-3 py-2 font-medium w-20`,children:`Enabled`}),C(`th`,{className:`text-left px-3 py-2 font-medium w-28`,children:`Retention`}),C(`th`,{className:`text-left px-3 py-2 font-medium w-56`,children:`Schedule`}),C(`th`,{className:`text-left px-3 py-2 font-medium w-44`,children:`Last success`}),C(`th`,{className:`text-right px-3 py-2 font-medium w-44`,children:`Actions`})]})}),C(`tbody`,{children:o.map(n=>{let r=u.get(n.id);return C(Q,{row:n,isOpen:s===n.id,onToggle:()=>l(n.id),onCreateAt:e,liveLastSuccessAt:r?.at,liveLastSuccessSizeBytes:r?.sizeBytes,...t?{onOpenRestoreWizard:t}:{}},n.id)})})]})})}function Q({row:e,isOpen:t,onToggle:n,onCreateAt:r,onOpenRestoreWizard:i,liveLastSuccessAt:a,liveLastSuccessSizeBytes:o}){let s=x(),c=p({onSuccess:()=>{s.invalidateQueries({queryKey:se})}}),[l,u]=S(String(e.retentionCount));w(()=>{u(String(e.retentionCount))},[e.retentionCount]);let[d,f]=S(!1),m=g(t=>{c.mutate({locationId:e.id,enabled:t,retentionCount:e.retentionCount,...e.label===void 0?{}:{label:e.label},...e.cron===void 0?{}:{cron:e.cron}})},[c,e.id,e.retentionCount,e.label,e.cron]),h=g(()=>{let t=Number.parseInt(l,10);if(Number.isNaN(t)||t<1){u(String(e.retentionCount));return}t!==e.retentionCount&&c.mutate({locationId:e.id,enabled:e.enabled,retentionCount:t,...e.label===void 0?{}:{label:e.label},...e.cron===void 0?{}:{cron:e.cron}})},[c,l,e.id,e.enabled,e.retentionCount,e.label,e.cron]),_=g(t=>{c.mutate({locationId:e.id,enabled:e.enabled,retentionCount:e.retentionCount,...e.label===void 0?{}:{label:e.label},cron:t},{onSuccess:()=>{f(!1)}})},[c,e.id,e.enabled,e.retentionCount,e.label]);return v(b,{children:[v(`tr`,{className:`border-t border-border first:border-t-0 hover:bg-primary/5`,children:[C(`td`,{className:`px-2 py-2`,children:C(`button`,{onClick:n,className:`inline-flex items-center justify-center rounded p-1 text-foreground-subtle hover:bg-primary/10 hover:text-foreground`,title:t?`Hide archives`:`Show archives`,children:C(t?N:P,{className:`h-3.5 w-3.5`})})}),C(`td`,{className:`px-3 py-2`,children:v(`button`,{onClick:n,className:`text-left hover:underline focus:outline-none`,title:`View archives`,children:[C(`div`,{className:`text-foreground font-medium`,children:e.displayName}),v(`div`,{className:`flex items-center gap-1.5 mt-0.5`,children:[C(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle bg-background border border-border rounded px-1.5 py-0.5`,children:e.kind}),C(`span`,{className:`text-[10px] text-foreground-subtle font-mono`,children:e.id})]})]})}),C(`td`,{className:`px-3 py-2`,children:C(`label`,{className:`inline-flex items-center cursor-pointer`,children:C(`input`,{type:`checkbox`,className:`accent-primary`,checked:e.enabled,disabled:c.isPending,onChange:e=>m(e.target.checked)})})}),C(`td`,{className:`px-3 py-2`,children:C(`input`,{type:`number`,min:1,max:1e3,value:l,disabled:c.isPending,onChange:e=>u(e.target.value),onBlur:h,onKeyDown:t=>{t.key===`Enter`&&t.target.blur(),t.key===`Escape`&&u(String(e.retentionCount))},className:`w-16 rounded border border-border bg-background px-2 py-1 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`})}),C(`td`,{className:`px-3 py-2`,children:C(le,{cron:e.cron,nextRunAt:e.nextRunAt,onEdit:()=>f(!0),disabled:c.isPending})}),C(`td`,{className:`px-3 py-2 text-foreground-subtle`,children:(()=>{let t=pe(a,e.lastSuccessAt),n=t===a?o:e.lastSuccessSizeBytes;return t===void 0?C(`span`,{className:`italic`,children:`Never`}):C(me,{at:t,sizeBytes:n})})()}),C(`td`,{className:`px-3 py-2`,children:C(`div`,{className:`flex items-center justify-end gap-1.5`,children:e.triggerSupported&&v(`button`,{onClick:()=>r(e),className:`inline-flex items-center gap-1 rounded bg-primary px-2 py-1 text-[11px] font-medium text-primary-foreground hover:bg-primary/90`,children:[C(j,{className:`h-3 w-3`}),`Create here`]})})})]}),t&&C(`tr`,{className:`border-t border-border bg-background/30`,children:C(`td`,{colSpan:7,className:`px-4 py-3`,children:C(q,{destinationId:e.id,restoreSupported:e.restoreSupported,...i?{onOpenRestoreWizard:i}:{}})})}),d&&C(de,{destinationName:e.displayName,currentCron:e.cron??``,onSave:_,onClose:()=>f(!1),saving:c.isPending,saveError:c.error instanceof Error?c.error.message:null})]})}function le({cron:e,nextRunAt:t,onEdit:n,disabled:r}){let i=typeof e==`string`&&e.trim().length>0;return v(`button`,{type:`button`,onClick:n,disabled:r,className:`group flex flex-col items-start gap-0.5 text-left rounded px-1.5 py-1 -mx-1.5 hover:bg-primary/5 disabled:opacity-50`,title:`Edit schedule`,children:[v(`div`,{className:`flex items-center gap-1.5`,children:[C(U,{className:`h-3 w-3 text-foreground-subtle group-hover:text-foreground`}),C(`span`,{className:i?`font-mono text-foreground`:`italic text-foreground-subtle`,children:i?e:`Manual`})]}),i&&t!==void 0&&v(`span`,{className:`text-[10px] text-foreground-subtle tabular-nums`,children:[`next `,ue(t)]})]})}function ue(e){let t=e-Date.now();if(t<=0)return`imminent`;let n=Math.floor(t/1e3);if(n<60)return`in ${n}s`;let r=Math.floor(n/60);if(r<60)return`in ${r}m`;let i=Math.floor(r/60);return i<24?`in ${i}h`:`in ${Math.floor(i/24)}d`}function de({destinationName:e,currentCron:t,onSave:n,onClose:r,saving:i,saveError:a}){let[o,s]=S(t);return C(`tr`,{children:C(`td`,{colSpan:7,className:`p-0`,children:C(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm`,onClick:r,children:v(`div`,{className:`w-full max-w-lg rounded-xl border border-border bg-surface shadow-2xl`,onClick:e=>e.stopPropagation(),children:[v(`div`,{className:`flex items-start justify-between border-b border-border px-4 py-3`,children:[v(`div`,{className:`space-y-0.5`,children:[C(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Schedule`}),v(`p`,{className:`text-xs text-foreground-subtle`,children:[`→ `,e]})]}),C(`button`,{onClick:r,className:`text-foreground-subtle hover:text-foreground`,title:`Close`,children:C(L,{className:`h-4 w-4`})})]}),v(`div`,{className:`p-4`,children:[C(re,{value:o,onChange:s,disabled:i}),a!==null&&C(`div`,{className:`mt-3 rounded border border-danger/40 bg-danger/10 px-3 py-2 text-[11px] text-danger`,children:a})]}),v(`div`,{className:`flex justify-end gap-2 border-t border-border px-4 py-3`,children:[C(`button`,{onClick:r,disabled:i,className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground disabled:opacity-50`,children:`Cancel`}),C(`button`,{onClick:()=>n(o.trim()),disabled:i||o.trim()===t.trim(),className:`inline-flex items-center gap-1.5 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:i?`Saving…`:`Save`})]})]})})})})}function fe(){let{map:e}=a(T.BackupCompleted,e=>e.destinationId);return y(()=>{let t=new Map;for(let[n,r]of e)t.set(n,{at:Date.now(),sizeBytes:r.sizeMB*1024*1024});return t},[e])}function pe(e,t){return e===void 0?t:t===void 0||e>t?e:t}function me({at:e,sizeBytes:t}){let n=he(e);return v(`span`,{title:y(()=>new Date(e).toLocaleString(),[e]),className:`text-foreground tabular-nums`,children:[n,t!==void 0&&v(`span`,{className:`ml-1 text-foreground-subtle`,children:[`· `,B(t)]})]})}function he(e){let[,t]=S(0);return w(()=>{let e=setInterval(()=>t(e=>e+1),3e4);return()=>clearInterval(e)},[]),ge(e)}function ge(e){let t=Math.max(0,Date.now()-e),n=Math.floor(t/1e3);if(n<60)return`${n}s ago`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);if(i<24)return`${i}h ago`;let a=Math.floor(i/24);if(a<30)return`${a}d ago`;let o=Math.floor(a/30);return o<12?`${o}mo ago`:`${Math.floor(a/365)}y ago`}_();var _e=[[`backup`,`list`]];function ve({initialDestinationId:r,initialArchiveId:i,onClose:a,onScheduled:o}){let s=x(),[c,u]=S(r&&i?2:1),[d,f]=S(r),[p,m]=S(i),[h,g]=S(new Set),{data:_}=n(),b=_??[],{data:T,isLoading:E}=l({destinationId:d??``},{enabled:!!d}),D=T??[];w(()=>{if(d!==void 0)return;let e=b.filter(e=>e.restoreSupported);e.length===1&&f(e[0].id)},[d,b]);let{data:O}=e({destinationId:d??``,backupId:p??``},{enabled:!!d&&!!p}),k=y(()=>O?.locations??[],[O]);w(()=>{k.length!==0&&g(e=>e.size===0?new Set(k):e)},[k]);let A=t({onSuccess:()=>{s.invalidateQueries({queryKey:_e}),o(),a()}}),j=e=>{g(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},N=!!d&&!!p,P=h.size>0,I=N&&P&&!A.isPending,R=()=>{!d||!p||A.mutate({destinationId:d,backupId:p,locations:[...h]})};return C(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm`,onClick:a,children:v(`div`,{className:`w-full max-w-md rounded-xl border border-border bg-surface shadow-2xl`,onClick:e=>e.stopPropagation(),children:[v(`div`,{className:`flex items-start justify-between border-b border-border px-4 py-3`,children:[v(`div`,{className:`space-y-0.5`,children:[C(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Restore Backup`}),v(`p`,{className:`text-xs text-foreground-subtle`,children:[`Step `,c,` of 3 —`,` `,c===1?`pick source`:c===2?`pick locations`:`confirm`]})]}),C(`button`,{onClick:a,className:`text-foreground-subtle hover:text-foreground`,children:C(L,{className:`h-4 w-4`})})]}),c===1&&C(ye,{destinations:b,destinationId:d,onPickDestination:e=>{f(e),m(void 0),g(new Set)},archives:D,archivesLoading:E,archiveId:p,onPickArchive:m}),c===2&&C(be,{locations:k,picked:h,onToggle:j}),c===3&&C(xe,{destinationName:b.find(e=>e.id===d)?.displayName??d??``,archive:D.find(e=>e.id===p),picked:[...h]}),v(`div`,{className:`flex justify-between gap-2 border-t border-border px-4 py-3`,children:[C(`div`,{children:c>1&&v(`button`,{onClick:()=>u(e=>e===3?2:1),className:`inline-flex items-center gap-1 rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:[C(ee,{className:`h-3 w-3`}),`Back`]})}),v(`div`,{className:`flex items-center gap-2`,children:[C(`button`,{onClick:a,className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:`Cancel`}),c<3?v(`button`,{disabled:c===1&&!N||c===2&&!P,onClick:()=>u(e=>e===1?2:3),className:`inline-flex items-center gap-1 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:[`Next`,C(ne,{className:`h-3 w-3`})]}):v(`button`,{onClick:R,disabled:!I,className:`inline-flex items-center gap-1.5 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:[A.isPending?C(F,{className:`h-3.5 w-3.5 animate-spin`}):C(M,{className:`h-3.5 w-3.5`}),`Schedule Restore`]})]})]})]})})}function ye({destinations:e,destinationId:t,onPickDestination:n,archives:r,archivesLoading:i,archiveId:a,onPickArchive:o}){let s=e.filter(e=>e.restoreSupported);return v(`div`,{className:`p-4 space-y-3`,children:[v(`div`,{className:`space-y-1.5`,children:[C(`label`,{className:`text-[10px] text-foreground-subtle uppercase tracking-wide`,children:`Destination`}),v(`select`,{value:t??``,onChange:e=>n(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`,children:[C(`option`,{value:``,disabled:!0,children:`Select destination…`}),s.map(e=>v(`option`,{value:e.id,children:[e.displayName,` (`,e.kind,`)`]},e.id))]})]}),v(`div`,{className:`space-y-1.5`,children:[C(`label`,{className:`text-[10px] text-foreground-subtle uppercase tracking-wide`,children:`Archive`}),!t&&C(`div`,{className:`text-xs text-foreground-subtle italic`,children:`Pick a destination first.`}),t&&i&&C(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Reading archives…`}),t&&!i&&r.length===0&&C(`div`,{className:`text-xs text-foreground-subtle italic`,children:`No archives available at this destination.`}),t&&r.length>0&&C(`div`,{className:`rounded border border-border bg-background divide-y divide-border max-h-64 overflow-y-auto`,children:r.map(e=>{let t=a===e.id;return v(`label`,{className:`flex items-center justify-between px-3 py-2 text-xs cursor-pointer ${t?`bg-primary/10`:`hover:bg-primary/5`}`,children:[v(`div`,{className:`flex items-center gap-2`,children:[C(`input`,{type:`radio`,name:`archive`,checked:t,onChange:()=>o(e.id),className:`accent-primary`}),v(`div`,{children:[C(`div`,{className:`font-medium text-foreground`,children:e.label??e.id}),C(`div`,{className:`text-[10px] text-foreground-subtle`,children:new Date(e.createdAt).toLocaleString()})]})]}),C(`span`,{className:`text-[10px] text-foreground-subtle tabular-nums`,children:B(e.sizeBytes)})]},e.id)})})]})]})}function be({locations:e,picked:t,onToggle:n}){return e.length===0?C(`div`,{className:`p-4`,children:C(`div`,{className:`text-xs text-foreground-subtle`,children:`Loading archive manifest… If this persists, the archive may predate manifests — restoring will apply everything in the tarball.`})}):v(`div`,{className:`p-4 space-y-3`,children:[C(`div`,{className:`rounded border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-[11px] text-amber-700 dark:text-amber-300`,children:`Selected entries will overwrite live data on the next server restart. Unchecked entries stay current.`}),v(`div`,{className:`space-y-1.5`,children:[C(`label`,{className:`text-[10px] text-foreground-subtle uppercase tracking-wide`,children:`Apply`}),C(`div`,{className:`rounded border border-border bg-background divide-y divide-border max-h-64 overflow-y-auto`,children:e.map(e=>v(`label`,{className:`flex items-center gap-2 px-3 py-2 text-xs hover:bg-primary/5 cursor-pointer`,children:[C(`input`,{type:`checkbox`,checked:t.has(e),onChange:()=>n(e),className:`accent-primary`}),C(`span`,{className:`font-mono text-foreground`,children:e}),C(`span`,{className:`ml-auto text-[10px] text-foreground-subtle`,children:Ce(e)})]},e))})]})]})}function xe({destinationName:e,archive:t,picked:n}){return v(`div`,{className:`p-4 space-y-3 text-xs`,children:[C(`div`,{className:`rounded border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-amber-700 dark:text-amber-300`,children:`Restore is applied at next server boot. Active connections will drop when you restart.`}),v(`dl`,{className:`space-y-1.5`,children:[C($,{term:`Destination`,value:e}),C($,{term:`Archive`,value:t?.label??t?.id??`—`}),t&&C($,{term:`Created`,value:`${new Date(t.createdAt).toLocaleString()} · ${B(t.sizeBytes)}`}),C($,{term:`Locations`,value:n.length>0?n.join(`, `):`— (full archive)`})]})]})}function $({term:e,value:t}){return v(`div`,{className:`flex justify-between gap-3`,children:[C(`dt`,{className:`text-foreground-subtle`,children:e}),C(`dd`,{className:`text-foreground font-mono text-right truncate`,children:t})]})}var Se={db:`Database`,addons:`Addon configs`,"addons-data":`Addon data`,tls:`TLS certificates`,cache:`Cache`,data:`Top-level data`};function Ce(e){return Se[e]??``}_();var we=[[`backup`,`list`]],Te=[[`backup`,`listLocations`]];function Ee(){let e=x(),t=s(),n=i({onSuccess:()=>{e.invalidateQueries({queryKey:we}),e.invalidateQueries({queryKey:[[`backup`,`listDestinations`]]}),e.invalidateQueries({queryKey:[[`backup`,`listArchives`]]})}}),r=m(),[a,o]=S(null),{data:l}=c(void 0,{enabled:a!==null,retry:1}),[u,d]=S(null),[f,p]=S(!1),[h,g]=S(!1),[_,y]=S(!1),b=async()=>{await t({title:`Restart server now?`,message:`Active connections will drop and the apply-backup hook will run before boot.`,confirmLabel:`Restart`,variant:`warning`})&&r.mutate({confirm:!0})};return v(z,{children:[v(`div`,{className:`flex items-center justify-end gap-2 flex-wrap`,children:[v(`button`,{onClick:()=>p(!0),className:`inline-flex items-center gap-1.5 rounded-lg bg-surface border border-border px-3 py-1.5 text-xs font-medium text-foreground hover:bg-primary/5 hover:border-primary/30`,children:[C(M,{className:`h-3.5 w-3.5`}),`Restore…`]}),v(`button`,{onClick:()=>y(!0),className:`inline-flex items-center gap-1.5 rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90`,children:[C(j,{className:`h-3.5 w-3.5`}),`Add destination`]})]}),h&&C(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2.5 text-xs text-amber-700 dark:text-amber-300`,children:v(`div`,{className:`flex items-center justify-between gap-3`,children:[v(`div`,{className:`flex items-center gap-2`,children:[C(M,{className:`h-3.5 w-3.5`}),C(`span`,{children:`Restore scheduled. Restart the server to apply.`})]}),v(`button`,{onClick:()=>{b()},disabled:r.isPending,className:`inline-flex items-center gap-1.5 rounded bg-amber-500/20 px-2 py-1 font-medium text-amber-800 dark:text-amber-200 hover:bg-amber-500/30 disabled:opacity-50`,children:[r.isPending?C(F,{className:`h-3.5 w-3.5 animate-spin`}):C(M,{className:`h-3.5 w-3.5`}),`Restart Now`]})]})}),C(ce,{onCreateAt:e=>o(e),onOpenRestoreWizard:e=>d(e)}),a&&C(De,{destination:a,locations:l,onClose:()=>o(null),onSubmit:(t,r)=>{n.mutate({destinations:[a.id],locations:t,label:r||void 0},{onSuccess:()=>{o(null),e.invalidateQueries({queryKey:Te})}})},submitting:n.isPending}),(u||f)&&C(ve,{...u?{initialDestinationId:u.destinationId,initialArchiveId:u.archiveId}:{},onClose:()=>{d(null),p(!1)},onScheduled:()=>g(!0)}),_&&C(A,{initialType:`backups`,onClose:()=>y(!1),onCreated:()=>{y(!1),e.invalidateQueries({queryKey:[[`backup`,`listDestinations`]]})}})]})}function De({destination:e,locations:t,onClose:n,onSubmit:r,submitting:i}){let a=(t??[]).filter(e=>e.present),[o,s]=S(``),[c,l]=S(null),u=c??new Set(a.map(e=>e.name)),d=e=>{l(t=>{let n=new Set(t??a.map(e=>e.name));return n.has(e)?n.delete(e):n.add(e),n})};return C(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm`,onClick:n,children:v(`div`,{className:`w-full max-w-md rounded-xl border border-border bg-surface shadow-2xl`,onClick:e=>e.stopPropagation(),children:[v(`div`,{className:`flex items-start justify-between border-b border-border px-4 py-3`,children:[v(`div`,{className:`space-y-0.5`,children:[C(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Create Backup`}),v(`p`,{className:`text-xs text-foreground-subtle`,children:[`→ `,e.displayName]})]}),C(`button`,{onClick:n,className:`text-foreground-subtle hover:text-foreground`,children:C(L,{className:`h-4 w-4`})})]}),v(`div`,{className:`p-4 space-y-3`,children:[v(`div`,{className:`space-y-1`,children:[C(`label`,{className:`text-[10px] text-foreground-subtle uppercase tracking-wide`,children:`Label (optional)`}),C(`input`,{type:`text`,value:o,onChange:e=>s(e.target.value),placeholder:`pre-upgrade`,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground placeholder:text-foreground-subtle focus:outline-none focus:ring-1 focus:ring-primary`})]}),v(`div`,{className:`space-y-1.5`,children:[C(`label`,{className:`text-[10px] text-foreground-subtle uppercase tracking-wide`,children:`Include`}),v(`div`,{className:`rounded border border-border bg-background divide-y divide-border max-h-64 overflow-y-auto`,children:[t===void 0&&v(`div`,{className:`flex items-center gap-2 px-3 py-2 text-xs text-foreground-subtle`,children:[C(F,{className:`h-3.5 w-3.5 animate-spin`}),`Calculating sizes…`]}),t!==void 0&&a.length===0&&C(`div`,{className:`px-3 py-2 text-xs text-foreground-subtle italic`,children:`Nothing to back up.`}),a.map(e=>v(`label`,{className:`flex items-center justify-between px-3 py-2 text-xs hover:bg-primary/5 cursor-pointer`,children:[v(`div`,{className:`flex items-center gap-2`,children:[C(`input`,{type:`checkbox`,checked:u.has(e.name),onChange:()=>d(e.name),className:`accent-primary`}),C(`span`,{className:`font-mono text-foreground`,children:e.name})]}),v(`div`,{className:`text-[10px] text-foreground-subtle tabular-nums`,children:[B(e.sizeBytes),` · `,e.fileCount,` files`]})]},e.name))]})]})]}),v(`div`,{className:`flex justify-end gap-2 border-t border-border px-4 py-3`,children:[C(`button`,{onClick:n,className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:`Cancel`}),v(`button`,{onClick:()=>r(Array.from(u),o.trim()),disabled:i||t===void 0||u.size===0,className:`inline-flex items-center gap-1.5 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:[i?C(F,{className:`h-3.5 w-3.5 animate-spin`}):C(H,{className:`h-3.5 w-3.5`}),i?`Creating…`:`Create`]})]})]})})}function Oe(){return C(`div`,{className:`flex flex-col p-4`,children:C(V,{tabs:[{id:`storage`,label:`Storage`,icon:D,content:C(W,{})},{id:`backup`,label:`Backup`,icon:H,content:C(Ee,{})}]})})}export{Oe as DataPage};
|