@camstack/addon-admin-ui 1.1.55 → 1.1.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/dist/assets/{AddLocationWizard-DKMFqTvZ.js → AddLocationWizard-DH1wlM9N.js} +1 -1
  2. package/dist/assets/{AddonCollectionPage-B7r7RnCS.js → AddonCollectionPage-gxmNQdYf.js} +1 -1
  3. package/dist/assets/Addons-Be4CVuvJ.js +1 -0
  4. package/dist/assets/{AdminTabs-DsU1olLw.js → AdminTabs-64haXSm8.js} +1 -1
  5. package/dist/assets/{AiProfiles-DbcBYG7x.js → AiProfiles-lT3bBnEd.js} +1 -1
  6. package/dist/assets/{BrokerForm-Bof3-RsO.js → BrokerForm-CZUCzvy_.js} +1 -1
  7. package/dist/assets/{Capabilities-CpM6R2iG.js → Capabilities-DUB8wW7w.js} +1 -1
  8. package/dist/assets/{CapabilityBadges-CrG_Gpq2.js → CapabilityBadges-U24jV_WE.js} +1 -1
  9. package/dist/assets/Cluster-Bxxn3HqZ.js +1 -0
  10. package/dist/assets/ClusterRecordingTab-CDJWutAl.js +1 -0
  11. package/dist/assets/{Dashboard-BLwnF4KK.js → Dashboard-CbHaQer3.js} +1 -1
  12. package/dist/assets/Data-BFaoxXrd.js +1 -0
  13. package/dist/assets/DetectionIntelligence-DLUsO5v8.js +1 -0
  14. package/dist/assets/DeviceDetail-BEb0V9yJ.js +2 -0
  15. package/dist/assets/{Devices-1MpXBj6n.js → Devices-DNl54HUl.js} +1 -1
  16. package/dist/assets/EmbedPlayerPage-DZ-C5bEy.js +1 -0
  17. package/dist/assets/Events-BlNjN0KW.js +1 -0
  18. package/dist/assets/{FormBuilder-1_hLh6UD.js → FormBuilder-CJkx2iwL.js} +1 -1
  19. package/dist/assets/Identity-BCh6oPue.js +1 -0
  20. package/dist/assets/IntegrationDetail-C_qtX56l.js +1 -0
  21. package/dist/assets/{Integrations-D2UQlymQ.js → Integrations-BDwXdSy2.js} +1 -1
  22. package/dist/assets/{Integrations-uUU6I8AA.js → Integrations-C4Fhw2Kw.js} +1 -1
  23. package/dist/assets/{Logs-DklB9pQr.js → Logs-D0CulDHV.js} +1 -1
  24. package/dist/assets/{MotionZonesSettings-Cv4ArwMh.js → MotionZonesSettings-BZw2TDN9.js} +1 -1
  25. package/dist/assets/{MyAccess-DreWB3nL.js → MyAccess-D8IdACgd.js} +1 -1
  26. package/dist/assets/{Network-WAC7AOhT.js → Network-B5TmDUnp.js} +1 -1
  27. package/dist/assets/{NodeAddonsSettingsPanel-adQJWpFA.js → NodeAddonsSettingsPanel-C3zABIO-.js} +1 -1
  28. package/dist/assets/{NotificationTargets-BqY-ixcT.js → NotificationTargets-DcFuhDqZ.js} +1 -1
  29. package/dist/assets/Pipeline-D3EKV42x.js +1 -0
  30. package/dist/assets/{Plates-BDN77UjR.js → Plates-c6NUMI7y.js} +1 -1
  31. package/dist/assets/{PrivacyMaskSettings-DtvQVzUm.js → PrivacyMaskSettings-eInalxMC.js} +1 -1
  32. package/dist/assets/{ProviderIcon-BvqTmUAe.js → ProviderIcon-DATRMz_4.js} +1 -1
  33. package/dist/assets/Recordings-BGuRRQDk.js +1 -0
  34. package/dist/assets/ScanNetworkModal-BCgaSgkz.js +1 -0
  35. package/dist/assets/{Settings-Bal6O--f.js → Settings-BfPc5iI3.js} +1 -1
  36. package/dist/assets/{Showroom-CRdx2BE1.js → Showroom-BmVwl5hS.js} +1 -1
  37. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-ByenDxWa.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DN_gpCZX.js} +1 -1
  38. package/dist/assets/{build-cluster-graph-DGTSGb1I.js → build-cluster-graph-BogKchI7.js} +2 -2
  39. package/dist/assets/circle-check-big-C_b3omdN.js +1 -0
  40. package/dist/assets/clock-B7aZhS6D.js +1 -0
  41. package/dist/assets/{schemas-DSTjX9zr.js → compat-CbwIzIXq.js} +1 -1
  42. package/dist/assets/{copy-BFZ5D4BJ.js → copy-Btgalvzu.js} +1 -1
  43. package/dist/assets/{debounced-invalidate-B_KsAVGD.js → debounced-invalidate-BqE6Y6Cb.js} +1 -1
  44. package/dist/assets/dist-CeDr-VKi.js +7 -0
  45. package/dist/assets/{dist-CqgNHN-E.js → dist-D6gYz5eb.js} +1 -1
  46. package/dist/assets/{download-5vnInJfp.js → download-3MyUU9xN.js} +1 -1
  47. package/dist/assets/{face-bbox-VcgOLkvN.js → face-bbox-DaP1CzYT.js} +1 -1
  48. package/dist/assets/{hostInit-BKkxJ9TG.js → hostInit-GN_uwc3e.js} +1 -1
  49. package/dist/assets/{index-Cmln2hC6.css → index-9438rY3p.css} +1 -1
  50. package/dist/assets/index-CWSgkLh-.js +4 -0
  51. package/dist/assets/{key-round-76xRX3g6.js → key-round-DpPTl6y7.js} +1 -1
  52. package/dist/assets/{mf-entry-bootstrap-0-4ee9f7b7.js → mf-entry-bootstrap-0-fd1d728a.js} +2 -2
  53. package/dist/assets/{pencil-Gs6QSg5F.js → pencil-CN8dLhGr.js} +1 -1
  54. package/dist/assets/{player-overlays-DArwlTAt.js → player-overlays-D5hi-tM5.js} +1 -1
  55. package/dist/assets/plus-BQmF7mQK.js +1 -0
  56. package/dist/assets/{radio-B4tiKZeo.js → radio-Byqiemme.js} +1 -1
  57. package/dist/assets/{refresh-cw-dvjeQnSv.js → refresh-cw-C3Kqp48w.js} +1 -1
  58. package/dist/assets/remoteEntry-C9o3ROsQ.js +1 -0
  59. package/dist/assets/{rotate-ccw-CdvaSzic.js → rotate-ccw-C_ZoPS5E.js} +1 -1
  60. package/dist/assets/rotate-cw-C2Olcfdi.js +1 -0
  61. package/dist/assets/search-BEneuVmL.js +1 -0
  62. package/dist/assets/{send-Cn2E54X0.js → send-SktyBExi.js} +1 -1
  63. package/dist/assets/{server-Cgdp4E__.js → server-DCfbXoOB.js} +1 -1
  64. package/dist/assets/square-Dvd0pOn9.js +1 -0
  65. package/dist/assets/{square-check-big-j_FMW3NH.js → square-check-big-BID2eFDb.js} +1 -1
  66. package/dist/assets/src-BFcFmkR9.js +67 -0
  67. package/dist/assets/src-t4LDC_AO.js +7 -0
  68. package/dist/assets/{upload-BkHF_KcS.js → upload-D7qGw-ta.js} +1 -1
  69. package/dist/assets/{useDevice-CNEnCHst.js → useDevice-6M3fnopa.js} +1 -1
  70. package/dist/assets/{useEventInvalidation-zuVyeFVc.js → useEventInvalidation-CHCtNbeW.js} +1 -1
  71. 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_-DS3hFa8s.js} +2 -2
  72. package/dist/assets/{wifi-CaslRhpX.js → wifi-xf1SEAla.js} +1 -1
  73. package/dist/assets/{zap-1sJN7Bvb.js → zap-BrvxTYmV.js} +1 -1
  74. package/dist/index.html +7 -7
  75. package/dist/server/addon.js +337 -6
  76. package/package.json +1 -1
  77. package/dist/assets/Addons-DjQMioo-.js +0 -1
  78. package/dist/assets/Cluster-DGYFlvd-.js +0 -1
  79. package/dist/assets/Data-mjlU3tOI.js +0 -1
  80. package/dist/assets/DetectionIntelligence-BF7VOXIn.js +0 -1
  81. package/dist/assets/DeviceDetail-DHxFHQzX.js +0 -2
  82. package/dist/assets/EmbedPlayerPage-BG2XDJsy.js +0 -1
  83. package/dist/assets/Events-cycfxpUn.js +0 -1
  84. package/dist/assets/Identity-DIIHY4_I.js +0 -1
  85. package/dist/assets/IntegrationDetail-ByT41Y57.js +0 -1
  86. package/dist/assets/Pipeline-8ill1YGg.js +0 -1
  87. package/dist/assets/ScanNetworkModal-7FD7LPU3.js +0 -1
  88. package/dist/assets/circle-check-big-CxoqUJ4a.js +0 -1
  89. package/dist/assets/clock-ByHlQpk3.js +0 -1
  90. package/dist/assets/dist-DcJZn370.js +0 -7
  91. package/dist/assets/film-FBIr-9R4.js +0 -1
  92. package/dist/assets/index-B0VBnS5H.js +0 -4
  93. package/dist/assets/plus-ByGzrFiA.js +0 -1
  94. package/dist/assets/remoteEntry-BOwRpCPu.js +0 -1
  95. package/dist/assets/rotate-cw-QbVLxhT1.js +0 -1
  96. package/dist/assets/search-BWa4jUVz.js +0 -1
  97. package/dist/assets/square-B8uQd9s9.js +0 -1
  98. package/dist/assets/src-7HDrFEPH.js +0 -7
  99. package/dist/assets/src-BhRH3dxa.js +0 -67
@@ -1,6 +1,6 @@
1
1
  import path from "node:path";
2
2
  import { fileURLToPath } from "node:url";
3
- //#region ../types/dist/event-category-H4AVePnn.mjs
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",
@@ -7295,6 +7338,62 @@ var RecordingConfigSchema = object({
7295
7338
  scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7296
7339
  });
7297
7340
  /**
7341
+ * Ops-log — the durable, append-only operations audit shared by the
7342
+ * recordings and events management surfaces.
7343
+ *
7344
+ * ONE row shape is reused for both domains so a single "Activity" view can
7345
+ * merge the recorder's DurableState ring (recordings ops-log) and the
7346
+ * pipeline-analytics SQLite collection (events ops-log). Each row records a
7347
+ * management operation, WHY it ran (reason), and its measurable effect
7348
+ * (itemsAffected + bytesReclaimed). Writes are best-effort — a failed log must
7349
+ * never fail the operation it records.
7350
+ */
7351
+ /** Which management domain the operation belongs to. */
7352
+ var OpsLogDomainSchema = _enum(["recording", "events"]);
7353
+ /** The kind of management operation performed. */
7354
+ var OpsLogOpSchema = _enum([
7355
+ "prune",
7356
+ "manual-delete",
7357
+ "rescan",
7358
+ "retention-run"
7359
+ ]);
7360
+ /** Why the operation ran. */
7361
+ var OpsLogReasonSchema = _enum([
7362
+ "retention",
7363
+ "quota",
7364
+ "manual",
7365
+ "operator"
7366
+ ]);
7367
+ /** One audit row, shared verbatim by both domains. */
7368
+ var OpsLogEntrySchema = object({
7369
+ /** Unique row id. */
7370
+ id: string(),
7371
+ /** Epoch ms the operation completed. */
7372
+ at: number(),
7373
+ domain: OpsLogDomainSchema,
7374
+ op: OpsLogOpSchema,
7375
+ reason: OpsLogReasonSchema,
7376
+ /** The camera the op targeted; null for a cluster/global op. */
7377
+ deviceId: number().nullable(),
7378
+ /** Node that performed the op (the log carries nodeId — no cross-node aggregation). */
7379
+ nodeId: string(),
7380
+ /** Buckets / rows deleted (op-specific unit). */
7381
+ itemsAffected: number(),
7382
+ /** Bytes reclaimed by the op (0 when not measurable). */
7383
+ bytesReclaimed: number(),
7384
+ /** Free-text detail (e.g. "floor moved to <ts>"); null when none. */
7385
+ detail: string().nullable(),
7386
+ /** Who/what triggered the op. */
7387
+ actor: string()
7388
+ });
7389
+ /** Shared query input for the per-domain `listOpsLog` cap methods. */
7390
+ var OpsLogQueryInputSchema = object({
7391
+ /** Restrict to a single camera; omit for every row. */
7392
+ deviceId: number().optional(),
7393
+ /** Max rows returned, newest-first. */
7394
+ limit: number().int().min(1).max(1e3).optional()
7395
+ });
7396
+ /**
7298
7397
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
7299
7398
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
7300
7399
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -12544,7 +12643,11 @@ array(ZoneRuleSchema).readonly();
12544
12643
  * Extend the enum here when a new gating consumer comes online (audio
12545
12644
  * gating, alert filtering, …) — no other surface needs to change.
12546
12645
  */
12547
- var ZoneRuleStageEnum = _enum(["motion", "detection"]);
12646
+ var ZoneRuleStageEnum = _enum([
12647
+ "motion",
12648
+ "detection",
12649
+ "package"
12650
+ ]);
12548
12651
  DeviceType.Camera, method(object({
12549
12652
  deviceId: number(),
12550
12653
  stage: ZoneRuleStageEnum
@@ -12557,7 +12660,8 @@ DeviceType.Camera, method(object({
12557
12660
  auth: "admin"
12558
12661
  }), object({
12559
12662
  motion: array(ZoneRuleSchema).readonly(),
12560
- detection: array(ZoneRuleSchema).readonly()
12663
+ detection: array(ZoneRuleSchema).readonly(),
12664
+ package: array(ZoneRuleSchema).readonly()
12561
12665
  });
12562
12666
  var ProviderStatusSchema = object({
12563
12667
  connected: boolean(),
@@ -15740,6 +15844,7 @@ var EventKindIconSchema = _enum([
15740
15844
  "smoke",
15741
15845
  "water",
15742
15846
  "button",
15847
+ "package",
15743
15848
  "generic"
15744
15849
  ]);
15745
15850
  var EventKindCategorySchema = _enum([
@@ -15747,7 +15852,8 @@ var EventKindCategorySchema = _enum([
15747
15852
  "audio",
15748
15853
  "detection",
15749
15854
  "sensor",
15750
- "custom"
15855
+ "custom",
15856
+ "package"
15751
15857
  ]);
15752
15858
  var EventKindDescriptorSchema = object({
15753
15859
  /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
@@ -16088,6 +16194,26 @@ var TrackCascadeCountsSchema = object({
16088
16194
  /** Per-track CLIP search vectors removed (best-effort). */
16089
16195
  embeddings: number().int()
16090
16196
  });
16197
+ /** Event-store footprint for one camera. */
16198
+ var EventStoreDeviceFootprintSchema = object({
16199
+ deviceId: number(),
16200
+ /** Persisted event rows (motion + object + audio) for the camera. */
16201
+ rows: number().int(),
16202
+ /** Event-owned media bytes on disk for the camera. */
16203
+ bytes: number().int()
16204
+ });
16205
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
16206
+ var EventStoreFootprintSchema = object({
16207
+ totalRows: number().int(),
16208
+ totalBytes: number().int(),
16209
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
16210
+ });
16211
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
16212
+ var EventPruneCountsSchema = object({
16213
+ motion: number().int(),
16214
+ object: number().int(),
16215
+ audio: number().int()
16216
+ });
16091
16217
  DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
16092
16218
  deviceId: number(),
16093
16219
  trackId: string()
@@ -16151,6 +16277,21 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16151
16277
  }), {
16152
16278
  kind: "mutation",
16153
16279
  auth: "admin"
16280
+ }), method(object({}), EventStoreFootprintSchema, {
16281
+ kind: "query",
16282
+ auth: "admin"
16283
+ }), method(object({
16284
+ olderThanMs: number(),
16285
+ reason: OpsLogReasonSchema.optional()
16286
+ }), EventPruneCountsSchema, {
16287
+ kind: "mutation",
16288
+ auth: "admin"
16289
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
16290
+ kind: "mutation",
16291
+ auth: "admin"
16292
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
16293
+ kind: "query",
16294
+ auth: "admin"
16154
16295
  }), method(object({
16155
16296
  eventId: string(),
16156
16297
  kind: MediaFileKindEnum.optional()
@@ -19384,13 +19525,131 @@ method(object({
19384
19525
  }), method(object({ deviceId: number() }), RecordingStatusSchema, {
19385
19526
  kind: "mutation",
19386
19527
  auth: "admin"
19387
- }), method(object({ deviceId: number() }), object({
19528
+ }), method(object({
19529
+ deviceId: number(),
19530
+ reason: OpsLogReasonSchema.optional()
19531
+ }), object({
19388
19532
  floorMs: number().nullable(),
19389
19533
  deletedBuckets: number().int(),
19390
19534
  reclaimedBytes: number().int()
19391
19535
  }), {
19392
19536
  kind: "mutation",
19393
19537
  auth: "admin"
19538
+ }), method(object({
19539
+ deviceId: number(),
19540
+ fromMs: number().optional(),
19541
+ toMs: number().optional()
19542
+ }), object({
19543
+ deletedBuckets: number().int(),
19544
+ reclaimedBytes: number().int()
19545
+ }), {
19546
+ kind: "mutation",
19547
+ auth: "admin"
19548
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
19549
+ kind: "query",
19550
+ auth: "admin"
19551
+ });
19552
+ /**
19553
+ * `recordingExport` cap — render a footage time range into a single downloadable
19554
+ * MP4 (regular / accelerated / decelerated / timelapse, ± audio), kept for a
19555
+ * bounded lifetime with a durable history, auto-expiry, and optional
19556
+ * delete-after-download.
19557
+ *
19558
+ * Like `recording` this is a `scope:'system', mode:'singleton'` cap: the
19559
+ * recorder self-gates so exactly ONE node (the designated `recordingNodeId`,
19560
+ * default `hub`) registers it. Device-scoped methods carry `deviceId` in their
19561
+ * input and dispatch to that single provider; the render runs on the node that
19562
+ * owns the footage (no cross-node segment transfer). Download rides the
19563
+ * framework addon data-plane. State persists in a DurableState blob (NOT
19564
+ * SQLite); history rows survive file deletion for audit.
19565
+ */
19566
+ /** Playback-speed multiplier for the render (1 = realtime). */
19567
+ var ExportSpeedSchema = number().min(.25).max(32);
19568
+ /** Timelapse cadence — sample one source frame per `everyMs`, output at `outputFps`. */
19569
+ var ExportTimelapseSchema = object({
19570
+ everyMs: number().int().positive(),
19571
+ outputFps: number().int().min(1).max(60).optional()
19572
+ });
19573
+ /**
19574
+ * Render options. `speed` and `timelapse` are mutually exclusive. `includeAudio`
19575
+ * is honoured only for a realtime-ish speed (0.5–2×); timelapse is always
19576
+ * silent. `maxLifeMs` bounds how long the finished file is kept;
19577
+ * `deleteAfterDownload` removes it shortly after the first complete download.
19578
+ */
19579
+ var ExportOptionsSchema = object({
19580
+ speed: ExportSpeedSchema.optional(),
19581
+ timelapse: ExportTimelapseSchema.optional(),
19582
+ includeAudio: boolean(),
19583
+ maxLifeMs: number().int().positive(),
19584
+ deleteAfterDownload: boolean(),
19585
+ title: string().max(200).optional()
19586
+ }).superRefine((v, ctx) => {
19587
+ if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
19588
+ code: ZodIssueCode.custom,
19589
+ message: "speed and timelapse are mutually exclusive",
19590
+ path: ["timelapse"]
19591
+ });
19592
+ });
19593
+ var ExportStateSchema = _enum([
19594
+ "queued",
19595
+ "rendering",
19596
+ "ready",
19597
+ "failed",
19598
+ "expired",
19599
+ "deleted"
19600
+ ]);
19601
+ /** One export job / history row. */
19602
+ var ExportRecordSchema = object({
19603
+ id: string(),
19604
+ deviceId: number(),
19605
+ profile: string(),
19606
+ fromMs: number(),
19607
+ toMs: number(),
19608
+ options: ExportOptionsSchema,
19609
+ state: ExportStateSchema,
19610
+ /** 0–100 while rendering; null otherwise. */
19611
+ progressPct: number().nullable(),
19612
+ /** File size once ready; null before. */
19613
+ fileBytes: number().nullable(),
19614
+ expiresAt: number(),
19615
+ deleteAfterDownload: boolean(),
19616
+ /** Epoch of the first complete download; null until then. */
19617
+ downloadedAt: number().nullable(),
19618
+ createdAt: number(),
19619
+ /** User id/name that requested the export. */
19620
+ createdBy: string(),
19621
+ /** Failure reason when state is 'failed'; null otherwise. */
19622
+ error: string().nullable()
19623
+ });
19624
+ /** Candidate download URLs (LAN first, then operator extra hosts). */
19625
+ var ExportDownloadSchema = object({
19626
+ url: string(),
19627
+ endpoints: array(string())
19628
+ });
19629
+ method(object({
19630
+ deviceId: number(),
19631
+ profile: string(),
19632
+ fromMs: number(),
19633
+ toMs: number(),
19634
+ options: ExportOptionsSchema
19635
+ }), ExportRecordSchema, {
19636
+ kind: "mutation",
19637
+ auth: "protected"
19638
+ }), method(object({ deviceId: number().optional() }), array(ExportRecordSchema), {
19639
+ kind: "query",
19640
+ auth: "protected"
19641
+ }), method(object({ exportId: string() }), ExportRecordSchema, {
19642
+ kind: "query",
19643
+ auth: "protected"
19644
+ }), method(object({ exportId: string() }), ExportRecordSchema, {
19645
+ kind: "mutation",
19646
+ auth: "protected"
19647
+ }), method(object({ exportId: string() }), ExportRecordSchema, {
19648
+ kind: "mutation",
19649
+ auth: "protected"
19650
+ }), method(object({ exportId: string() }), ExportDownloadSchema, {
19651
+ kind: "query",
19652
+ auth: "protected"
19394
19653
  });
19395
19654
  /**
19396
19655
  * One publishable camera stream as its OWNING PROVIDER describes it — the same
@@ -22410,6 +22669,12 @@ Object.freeze({
22410
22669
  addonId: null,
22411
22670
  access: "delete"
22412
22671
  },
22672
+ "pipelineAnalytics.deleteDeviceEvents": {
22673
+ capName: "pipeline-analytics",
22674
+ capScope: "device",
22675
+ addonId: null,
22676
+ access: "delete"
22677
+ },
22413
22678
  "pipelineAnalytics.deleteTracks": {
22414
22679
  capName: "pipeline-analytics",
22415
22680
  capScope: "device",
@@ -22440,6 +22705,12 @@ Object.freeze({
22440
22705
  addonId: null,
22441
22706
  access: "view"
22442
22707
  },
22708
+ "pipelineAnalytics.getEventStoreFootprint": {
22709
+ capName: "pipeline-analytics",
22710
+ capScope: "device",
22711
+ addonId: null,
22712
+ access: "view"
22713
+ },
22443
22714
  "pipelineAnalytics.getKeyEvents": {
22444
22715
  capName: "pipeline-analytics",
22445
22716
  capScope: "device",
@@ -22482,6 +22753,12 @@ Object.freeze({
22482
22753
  addonId: null,
22483
22754
  access: "view"
22484
22755
  },
22756
+ "pipelineAnalytics.listOpsLog": {
22757
+ capName: "pipeline-analytics",
22758
+ capScope: "device",
22759
+ addonId: null,
22760
+ access: "view"
22761
+ },
22485
22762
  "pipelineAnalytics.listRecentTracks": {
22486
22763
  capName: "pipeline-analytics",
22487
22764
  capScope: "device",
@@ -22494,6 +22771,12 @@ Object.freeze({
22494
22771
  addonId: null,
22495
22772
  access: "view"
22496
22773
  },
22774
+ "pipelineAnalytics.pruneEvents": {
22775
+ capName: "pipeline-analytics",
22776
+ capScope: "device",
22777
+ addonId: null,
22778
+ access: "create"
22779
+ },
22497
22780
  "pipelineAnalytics.pruneEventsBefore": {
22498
22781
  capName: "pipeline-analytics",
22499
22782
  capScope: "device",
@@ -23256,6 +23539,12 @@ Object.freeze({
23256
23539
  addonId: null,
23257
23540
  access: "create"
23258
23541
  },
23542
+ "recording.deleteFootprint": {
23543
+ capName: "recording",
23544
+ capScope: "system",
23545
+ addonId: null,
23546
+ access: "delete"
23547
+ },
23259
23548
  "recording.getAvailability": {
23260
23549
  capName: "recording",
23261
23550
  capScope: "system",
@@ -23286,6 +23575,12 @@ Object.freeze({
23286
23575
  addonId: null,
23287
23576
  access: "view"
23288
23577
  },
23578
+ "recording.listOpsLog": {
23579
+ capName: "recording",
23580
+ capScope: "system",
23581
+ addonId: null,
23582
+ access: "view"
23583
+ },
23289
23584
  "recording.locateSegment": {
23290
23585
  capName: "recording",
23291
23586
  capScope: "system",
@@ -23316,6 +23611,42 @@ Object.freeze({
23316
23611
  addonId: null,
23317
23612
  access: "create"
23318
23613
  },
23614
+ "recordingExport.cancelExport": {
23615
+ capName: "recordingExport",
23616
+ capScope: "system",
23617
+ addonId: null,
23618
+ access: "create"
23619
+ },
23620
+ "recordingExport.createExport": {
23621
+ capName: "recordingExport",
23622
+ capScope: "system",
23623
+ addonId: null,
23624
+ access: "create"
23625
+ },
23626
+ "recordingExport.deleteExport": {
23627
+ capName: "recordingExport",
23628
+ capScope: "system",
23629
+ addonId: null,
23630
+ access: "delete"
23631
+ },
23632
+ "recordingExport.getDownloadUrl": {
23633
+ capName: "recordingExport",
23634
+ capScope: "system",
23635
+ addonId: null,
23636
+ access: "view"
23637
+ },
23638
+ "recordingExport.getExport": {
23639
+ capName: "recordingExport",
23640
+ capScope: "system",
23641
+ addonId: null,
23642
+ access: "view"
23643
+ },
23644
+ "recordingExport.listExports": {
23645
+ capName: "recordingExport",
23646
+ capScope: "system",
23647
+ addonId: null,
23648
+ access: "view"
23649
+ },
23319
23650
  "sceneMonitor.captureReference": {
23320
23651
  capName: "scene-monitor",
23321
23652
  capScope: "device",
@@ -24493,7 +24824,7 @@ var AdminUIAddon = class extends BaseAddon {
24493
24824
  capability: adminUiCapability,
24494
24825
  provider: {
24495
24826
  getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
24496
- getVersion: async () => ({ version: "1.1.55" })
24827
+ getVersion: async () => ({ version: "1.1.57" })
24497
24828
  }
24498
24829
  }];
24499
24830
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-admin-ui",
3
- "version": "1.1.55",
3
+ "version": "1.1.57",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "CamStack Admin UI — Vite frontend build and server-side addon",
@@ -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};