@camstack/addon-admin-ui 1.2.451 → 1.2.452

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 (123) hide show
  1. package/dist/assets/{AddonAssetIcon-tSDKYL0K.js → AddonAssetIcon-oAD7HtOX.js} +1 -1
  2. package/dist/assets/Addons-CrYWbUTm.js +4 -0
  3. package/dist/assets/{AdminPage-Bc7EcIQy.js → AdminPage-zTp0nTe3.js} +1 -1
  4. package/dist/assets/{AdminSectionedPage-DorUtSBh.js → AdminSectionedPage-BJn9Df5z.js} +1 -1
  5. package/dist/assets/{AiProfiles-BdYyzFcG.js → AiProfiles-DxIrm9et.js} +2 -2
  6. package/dist/assets/{BrokerForm-Deefp6zP.js → BrokerForm-ZRNTZhIC.js} +1 -1
  7. package/dist/assets/{Build-D_QB0Yce.js → Build-B9eaG5VJ.js} +4 -4
  8. package/dist/assets/{Calendars-BTBqj3kw.js → Calendars-CN2Uhrr5.js} +1 -1
  9. package/dist/assets/{Cluster-qRWUra5C.js → Cluster-BVH4REKi.js} +1 -1
  10. package/dist/assets/{ClusterStepModel-CYnyPKcf.js → ClusterStepModel-yDdJgqvR.js} +1 -1
  11. package/dist/assets/{CompositionEditor-sCKYBpl2.js → CompositionEditor-rMOoN5F5.js} +1 -1
  12. package/dist/assets/{CompositionEditorPage-DzUj_31l.js → CompositionEditorPage-BcSVmFyA.js} +1 -1
  13. package/dist/assets/Data-Dnv7ZfVU.js +2 -0
  14. package/dist/assets/{DeviceDetail-BLnowNRs.js → DeviceDetail-BS5RiGba.js} +2 -2
  15. package/dist/assets/{DeviceDoActionFields-Bffr6IHD.js → DeviceDoActionFields-HRtr_KQg.js} +1 -1
  16. package/dist/assets/{Devices-IJKvm0BP.js → Devices-Bk161POt.js} +1 -1
  17. package/dist/assets/{EmbedPlayerPage-B1o6udpz.js → EmbedPlayerPage-BgVIezZy.js} +1 -1
  18. package/dist/assets/History-FSdRNye9.js +1 -0
  19. package/dist/assets/Identity-C5B6BRyt.js +1 -0
  20. package/dist/assets/IntegrationDetail-SiZK5uRr.js +1 -0
  21. package/dist/assets/{IntegrationHub-Bf4b3i_q.js → IntegrationHub-DHPnaPMA.js} +1 -1
  22. package/dist/assets/Integrations-BkA1KEAY.js +1 -0
  23. package/dist/assets/{Integrations-nFhMQF34.js → Integrations-TxhwCTGP.js} +1 -1
  24. package/dist/assets/{Library-A6WfMhER.js → Library-B9pCHVnZ.js} +1 -1
  25. package/dist/assets/Locations-DW1r5qeE.js +3 -0
  26. package/dist/assets/{Logs-C9J8k6c9.js → Logs-C2BtNaAN.js} +1 -1
  27. package/dist/assets/{MaskShapeCanvas-v8FP28QJ.js → MaskShapeCanvas-CmVqJpmm.js} +1 -1
  28. package/dist/assets/{MotionZonesSettings-Bqg-ZAEs.js → MotionZonesSettings-Cc9tuHmU.js} +1 -1
  29. package/dist/assets/{MyAccess-uX46IK3F.js → MyAccess-C66AWIxq.js} +1 -1
  30. package/dist/assets/{Network-BR-HvAds.js → Network-C9aktmZ0.js} +1 -1
  31. package/dist/assets/{NodeAddonsSettingsPanel-BNTQVCjk.js → NodeAddonsSettingsPanel-BoUIpXuk.js} +1 -1
  32. package/dist/assets/{Notifications-BtCeEFJT.js → Notifications-WCuwxXPI.js} +1 -1
  33. package/dist/assets/{PrivacyMaskSettings-DqyBAWCW.js → PrivacyMaskSettings-CbTGMxxg.js} +1 -1
  34. package/dist/assets/Recordings-VqcEhUuW.js +1 -0
  35. package/dist/assets/{ScanNetworkModal-DzMITtJ8.js → ScanNetworkModal-DjUqTV95.js} +1 -1
  36. package/dist/assets/{SceneMonitorEditor-365WT-vj.js → SceneMonitorEditor-DgEzjukw.js} +1 -1
  37. package/dist/assets/SessionsList-D20NZop0.js +2 -0
  38. package/dist/assets/{Showroom-Ch7an15I.js → Showroom-By5Alv0c.js} +1 -1
  39. package/dist/assets/{System-XW10dOJr.js → System-gRnT7E7Q.js} +1 -1
  40. package/dist/assets/{Terminal-CmDRhqrR.js → Terminal-BOEgbYdP.js} +1 -1
  41. package/dist/assets/{Viewer-2oJvYupj.js → Viewer-l-gmBOag.js} +1 -1
  42. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-BvyGb9Bo.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-B0S-_aNb.js} +1 -1
  43. package/dist/assets/{addon-icons-context-Nt5kiIqp.js → addon-icons-context-By6Bm4dX.js} +1 -1
  44. package/dist/assets/{archive-BpVlUMGc.js → archive-CvBthkSB.js} +1 -1
  45. package/dist/assets/{authed-media-CRjjClqw.js → authed-media-o-FqDLbM.js} +1 -1
  46. package/dist/assets/{bell-off-DFWiqigj.js → bell-off-CCvUR5bf.js} +1 -1
  47. package/dist/assets/{board-model-CbfKyLZU.js → board-model-5X7MvWDr.js} +1 -1
  48. package/dist/assets/{boxes-DEZFxpEo.js → boxes-DavjA3V9.js} +1 -1
  49. package/dist/assets/circle-slash-DRfwudv-.js +1 -0
  50. package/dist/assets/client-BXQKDTPp.js +358 -0
  51. package/dist/assets/{cloud-upload-DJX2vjB1.js → cloud-upload-C578qLMo.js} +1 -1
  52. package/dist/assets/crop-DQvSi9nJ.js +1 -0
  53. package/dist/assets/{device-integration-icon-eQMV6gf2.js → device-integration-icon-DTjMxRNo.js} +1 -1
  54. package/dist/assets/device-picker-model-BSSsMgr9.js +1 -0
  55. package/dist/assets/{dist-C44xoxcH.js → dist-DSzxTTFP.js} +1 -1
  56. package/dist/assets/dist-OkV6Go5s.js +358 -0
  57. package/dist/assets/{eraser-BJtJIM79.js → eraser-Bl0TnhZD.js} +1 -1
  58. package/dist/assets/{hard-drive-download-BgY0ewC_.js → hard-drive-download-UeIlWgu6.js} +1 -1
  59. package/dist/assets/{hostInit-BxKKf6O5.js → hostInit-CLS9MdiJ.js} +1 -1
  60. package/dist/assets/i18n-DY7WWkr4.js +1 -0
  61. package/dist/assets/{icons-B7PsYODJ.js → icons-BhEG_9gQ.js} +1 -1
  62. package/dist/assets/{index-B-H1mfMz.js → index-3cHe507L.js} +3 -3
  63. package/dist/assets/{key-Rj556V_5.js → key-B984Bc2m.js} +1 -1
  64. package/dist/assets/{key-round-JtuAp3H5.js → key-round-CLUCf0cS.js} +1 -1
  65. package/dist/assets/{layers-arFC7gbL.js → layers-ClpK9rfN.js} +1 -1
  66. package/dist/assets/{linked-devices-model-Bwz1L9wp.js → linked-devices-model-CbMqjEVT.js} +1 -1
  67. package/dist/assets/{list-ordered-Dam1ZKMc.js → list-ordered-CNNBtODg.js} +1 -1
  68. package/dist/assets/{location-owned-usage-DwnxDZWp.js → location-owned-usage-BOBNcPTd.js} +1 -1
  69. package/dist/assets/{log-in-lVU3BPjL.js → log-in-B0mVo25m.js} +1 -1
  70. package/dist/assets/{memory-stick-Cttq5WM5.js → memory-stick-C2MHfvSi.js} +1 -1
  71. package/dist/assets/{message-square-plus-CaNw_hMf.js → message-square-plus-B8ozbbSm.js} +1 -1
  72. package/dist/assets/{mf-entry-bootstrap-0-ab6954b6.js → mf-entry-bootstrap-0-4e5a0dd7.js} +2 -2
  73. package/dist/assets/{mic-off-it4ki4Jh.js → mic-off-BDRWnndC.js} +1 -1
  74. package/dist/assets/{monitor-off-oHRvN7aD.js → monitor-off-AiaGZyF4.js} +1 -1
  75. package/dist/assets/{monitor-smartphone-CjCMg9jw.js → monitor-smartphone-LZNwDWQS.js} +1 -1
  76. package/dist/assets/mount-BSSsMgr9.js +1 -0
  77. package/dist/assets/notification-schedule-field-DVnPcnI2.js +1 -0
  78. package/dist/assets/{player-overlays-BQ-CPD3k.js → player-overlays-BqM7cQxx.js} +1 -1
  79. package/dist/assets/{recycle-DLgVUrk1.js → recycle-CzMG7f6v.js} +1 -1
  80. package/dist/assets/remoteEntry-DIfLCm9V.js +1 -0
  81. package/dist/assets/{scan-eye-D3WSpR2M.js → scan-eye-DV8G0O69.js} +1 -1
  82. package/dist/assets/{scissors-CfXjajAo.js → scissors-CXyYzi3_.js} +1 -1
  83. package/dist/assets/{search-x-DrZuvHV8.js → search-x-D8hftA1U.js} +1 -1
  84. package/dist/assets/{send-BGZ680If.js → send-kdp5RlxT.js} +1 -1
  85. package/dist/assets/{settings-2-WgIC2cEC.js → settings-2-KSeFExfQ.js} +1 -1
  86. package/dist/assets/{speaker-DIrTXPXW.js → speaker-UjYWgc-l.js} +1 -1
  87. package/dist/assets/src-BGCK3zCb.js +67 -0
  88. package/dist/assets/{timer-reset-Ba4-n5gG.js → timer-reset-BFiLVvIL.js} +1 -1
  89. package/dist/assets/{ungroup-DjxNnRiT.js → ungroup-ZMQs0G6z.js} +1 -1
  90. package/dist/assets/{unlink-Cy4eOOGb.js → unlink-pzv8jDBR.js} +1 -1
  91. package/dist/assets/{usb-Crnw8Rqe.js → usb-DwKyPwkP.js} +1 -1
  92. package/dist/assets/{use-scenes-feed-CqavtElt.js → use-scenes-feed-DBhnjGJG.js} +1 -1
  93. package/dist/assets/{use-stationary-objects-CuD-UCH8.js → use-stationary-objects-D2Hh0fkb.js} +1 -1
  94. package/dist/assets/useEventInvalidation-BSSsMgr9.js +1 -0
  95. package/dist/assets/{useNodeUrlSelection-ChFCBb4B.js → useNodeUrlSelection-Bk5QjgEc.js} +1 -1
  96. package/dist/assets/user-round-pGZtSaR6.js +1 -0
  97. package/dist/assets/{user-x-BDmcZv0z.js → user-x-B3X1pnMb.js} +1 -1
  98. package/dist/assets/{video-JjHo3xW3.js → video-B8eQiZoX.js} +1 -1
  99. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-3LGiNBfi.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DMzkBEt2.js} +2 -2
  100. package/dist/index.html +10 -10
  101. package/dist/server/addon.js +115 -62
  102. package/package.json +1 -1
  103. package/dist/assets/Addons-ofsCoJ4Y.js +0 -4
  104. package/dist/assets/Data-BJuJfR0P.js +0 -2
  105. package/dist/assets/History-su2kJ1JJ.js +0 -1
  106. package/dist/assets/Identity-8srCiX2b.js +0 -1
  107. package/dist/assets/IntegrationDetail-CHtQ-0tZ.js +0 -1
  108. package/dist/assets/Integrations-Cnq7Q1qn.js +0 -1
  109. package/dist/assets/Locations-Dl_YxXoD.js +0 -3
  110. package/dist/assets/Recordings-arOpg17X.js +0 -1
  111. package/dist/assets/SessionsList-CAYqZ393.js +0 -2
  112. package/dist/assets/circle-slash-BvDvmSoU.js +0 -1
  113. package/dist/assets/client-C7mYZlqO.js +0 -358
  114. package/dist/assets/crop-BLfw1NQy.js +0 -1
  115. package/dist/assets/device-picker-model-B7n7uzAw.js +0 -1
  116. package/dist/assets/dist-4Z3hLAqT.js +0 -358
  117. package/dist/assets/i18n-CiEPJn04.js +0 -1
  118. package/dist/assets/mount-B7n7uzAw.js +0 -1
  119. package/dist/assets/notification-schedule-field-DkO0-1Tm.js +0 -1
  120. package/dist/assets/remoteEntry-5tiapUFy.js +0 -1
  121. package/dist/assets/src-DP8JO4HZ.js +0 -67
  122. package/dist/assets/useEventInvalidation-B7n7uzAw.js +0 -1
  123. package/dist/assets/user-round-7xIjUD30.js +0 -1
@@ -1,6 +1,6 @@
1
1
  import path from "node:path";
2
2
  import { fileURLToPath } from "node:url";
3
- //#region ../types/dist/event-category-7pZEBmVg.mjs
3
+ //#region ../types/dist/event-category-BfJwUd2S.mjs
4
4
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
5
5
  EventCategory["SystemBoot"] = "system.boot";
6
6
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -317,6 +317,15 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
317
317
  */
318
318
  EventCategory["PipelineDetectionBlind"] = "pipeline.detection-blind";
319
319
  /**
320
+ * A camera's motion source has fired constantly with no subject for an hour
321
+ * (motion duty or session count over the bar, zero detections) — it is not
322
+ * blind, its motion zones or sensitivity want tuning (D907). Paired with
323
+ * {@link PipelineMotionCalm}.
324
+ */
325
+ EventCategory["PipelineMotionNoisy"] = "pipeline.motion-noisy";
326
+ /** The recovery edge of {@link PipelineMotionNoisy}: the motion fell back, or a detection arrived. */
327
+ EventCategory["PipelineMotionCalm"] = "pipeline.motion-calm";
328
+ /**
320
329
  * Per-camera pipeline config was mutated by the orchestrator
321
330
  * (3-level settings change via `setAgentAddonDefaults` /
322
331
  * `setCameraStepToggle` / `setCameraPipelineForAgent` or a
@@ -5423,7 +5432,7 @@ var ZodIssueCode = {
5423
5432
  var ZodFirstPartyTypeKind;
5424
5433
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5425
5434
  //#endregion
5426
- //#region ../types/dist/sleep-CueztlR1.mjs
5435
+ //#region ../types/dist/sleep-DJFUfKvA.mjs
5427
5436
  /**
5428
5437
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5429
5438
  * window to float samples (D455).
@@ -7885,7 +7894,7 @@ var EntryDescriptorSchema = object({
7885
7894
  /** JSON Schema of the entry body; `secret: true` marks a password field. */
7886
7895
  fields: record(string(), unknown())
7887
7896
  }).strict();
7888
- /** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
7897
+ /** What crosses the wire from an addon: JSON only, no Zod. An unknown key is refused. */
7889
7898
  var RecordKindDeclarationSchema = object({
7890
7899
  database: _enum(RECORD_DATABASES).default("settings"),
7891
7900
  class: _enum(RECORD_CLASSES),
@@ -7904,14 +7913,6 @@ var RecordKindDeclarationSchema = object({
7904
7913
  secretPaths: array(string().min(1)).default([]),
7905
7914
  /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
7906
7915
  secretArrayKeys: record(string(), string()).default({}),
7907
- /**
7908
- * RETIRED (D900): the legacy table a kind adopted from during the records
7909
- * migration. Nothing declares it any more and nothing reads it; the schema
7910
- * still ACCEPTS it because the catalog rows the migration wrote carry it
7911
- * (an orphaned kind is never redeclared) and an addon built before the
7912
- * removal still sends it. Never set it.
7913
- */
7914
- adoptsFrom: string().min(1).optional(),
7915
7916
  /** Kinds that must agree through `transact` sit in one file under one family name. */
7916
7917
  transactFamily: string().min(1).optional(),
7917
7918
  entry: EntryDescriptorSchema.optional()
@@ -12593,17 +12594,6 @@ object({
12593
12594
  createdAt: number(),
12594
12595
  updatedAt: number()
12595
12596
  });
12596
- object({
12597
- id: string(),
12598
- label: string(),
12599
- isAdmin: boolean().default(false),
12600
- allowedProviders: AllowedProviderSchema,
12601
- allowedDevices: AllowedDevicesSchema,
12602
- tokenHash: string(),
12603
- tokenPrefix: string(),
12604
- createdAt: number(),
12605
- lastUsedAt: number().optional()
12606
- });
12607
12597
  object({
12608
12598
  id: string(),
12609
12599
  userId: string(),
@@ -16479,16 +16469,36 @@ var RecordKindStateSchema = _enum([
16479
16469
  var DeclareKindResultSchema = object({
16480
16470
  kindId: number().int(),
16481
16471
  state: RecordKindStateSchema,
16482
- createdIndexes: array(string()),
16483
- /**
16484
- * RETIRED (D900): always `null`. It carried the records-migration boot guard;
16485
- * it stays on the wire, null, because an addon built before the removal reads
16486
- * an ABSENT field as "adoption pending" and refuses to start.
16487
- */
16488
- adoptionPending: _null()
16472
+ createdIndexes: array(string())
16489
16473
  });
16490
16474
  /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
16491
16475
  var SecretRefsList = array(string());
16476
+ /**
16477
+ * One op of a `transact`: the single-row writes, each on a kind of the caller.
16478
+ * All ops of one call share ONE database file and ONE `transactFamily`.
16479
+ */
16480
+ var RecordTransactOpSchema = discriminatedUnion("op", [
16481
+ object({
16482
+ op: literal("put"),
16483
+ kind: RecordKindNameSchema,
16484
+ record: RecordInputSchema,
16485
+ ifRev: number().int().min(0).optional()
16486
+ }),
16487
+ object({
16488
+ op: literal("patch"),
16489
+ kind: RecordKindNameSchema,
16490
+ id: RecordIdSchema,
16491
+ data: RecordBodySchema,
16492
+ at: number().int().nullable().optional(),
16493
+ expiresAt: number().int().nullable().optional(),
16494
+ ifRev: number().int().min(1).optional()
16495
+ }),
16496
+ object({
16497
+ op: literal("delete"),
16498
+ kind: RecordKindNameSchema,
16499
+ id: RecordIdSchema
16500
+ })
16501
+ ]);
16492
16502
  var RecordSecretRefsSchema = record(string(), record(string(), string()));
16493
16503
  method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
16494
16504
  kind: "mutation",
@@ -16595,6 +16605,16 @@ method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema)
16595
16605
  }), {
16596
16606
  kind: "mutation",
16597
16607
  auth: "admin"
16608
+ }), method(object({ ops: array(RecordTransactOpSchema).min(1).max(RECORD_BATCH_MAX) }), object({
16609
+ results: array(object({
16610
+ rev: number().int().nullable(),
16611
+ deleted: boolean()
16612
+ })),
16613
+ releasedRefs: SecretRefsList,
16614
+ secretRefs: SecretRefsList
16615
+ }), {
16616
+ kind: "mutation",
16617
+ auth: "admin"
16598
16618
  }), method(object({
16599
16619
  deviceId: number().int(),
16600
16620
  kinds: array(RecordKindNameSchema).optional()
@@ -41953,9 +41973,13 @@ var NcSystemEventKindSchema = _enum([
41953
41973
  "node-updating",
41954
41974
  "node-inference-unavailable",
41955
41975
  "detection-blind",
41976
+ "motion-noisy",
41977
+ "motion-calm",
41956
41978
  "recording-stalled",
41957
41979
  "recording-healthy",
41958
41980
  "recording-degraded",
41981
+ "device-attention-required",
41982
+ "device-attention-resolved",
41959
41983
  "storage-location-low",
41960
41984
  "storage-location-critical",
41961
41985
  "storage-location-ok",
@@ -54412,6 +54436,16 @@ object({
54412
54436
  powerState: string().nullable(),
54413
54437
  saltLevel: DishwasherConsumableLevelSchema.nullable(),
54414
54438
  rinseAidLevel: DishwasherConsumableLevelSchema.nullable(),
54439
+ /**
54440
+ * True while the appliance asks for its filter to be cleaned (smart-filter, filter-system or
54441
+ * combined care-and-filter reminder raised); false when every such reminder reads clear; null
54442
+ * when none is reported. A cleared reminder is not an unknown one.
54443
+ */
54444
+ filterCleaningDue: boolean().nullable(),
54445
+ /** True while the machine-care (descaling / cleaning-program) reminder is raised; false when clear; null when not reported. */
54446
+ machineCareDue: boolean().nullable(),
54447
+ /** Program runs left before the machine-care reminder is due; null when the appliance does not say. */
54448
+ machineCareRemainingRuns: number().int().nonnegative().nullable(),
54415
54449
  /** Option states: null when the appliance does not expose the option or has not said. */
54416
54450
  halfLoad: boolean().nullable(),
54417
54451
  hygienePlus: boolean().nullable(),
@@ -61029,16 +61063,6 @@ var UpdateUserInputSchema = object({
61029
61063
  allowedDevices: record(string(), union([array(string()), literal("*")])).optional(),
61030
61064
  scopes: array(TokenScopeSchema).optional()
61031
61065
  });
61032
- var ApiKeySummarySchema = object({
61033
- id: string(),
61034
- label: string(),
61035
- isAdmin: boolean().default(false),
61036
- allowedProviders: union([array(string()), literal("*")]).optional(),
61037
- allowedDevices: record(string(), union([array(string()), literal("*")])).optional(),
61038
- tokenPrefix: string(),
61039
- createdAt: number(),
61040
- lastUsedAt: number().optional()
61041
- });
61042
61066
  var OauthSessionSummarySchema = object({
61043
61067
  id: string(),
61044
61068
  userId: string(),
@@ -61060,8 +61084,7 @@ var TotpStatusSchema = object({
61060
61084
  confirmedAt: number().nullable()
61061
61085
  });
61062
61086
  /**
61063
- * user-management — singleton capability for user accounts and the
61064
- * legacy API-key rows.
61087
+ * user-management — singleton capability for user accounts.
61065
61088
  *
61066
61089
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
61067
61090
  * — the subset check on `setUserScopes` is moot
@@ -61117,10 +61140,6 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
61117
61140
  }), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
61118
61141
  kind: "mutation",
61119
61142
  access: "view"
61120
- }), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
61121
- kind: "mutation",
61122
- auth: "admin",
61123
- access: "delete"
61124
61143
  }), method(object({ userId: string() }), TotpSetupResultSchema, {
61125
61144
  kind: "mutation",
61126
61145
  auth: "admin",
@@ -68633,6 +68652,12 @@ Object.freeze({
68633
68652
  addonId: null,
68634
68653
  access: "view"
68635
68654
  },
68655
+ "records.transact": {
68656
+ capName: "records",
68657
+ capScope: "system",
68658
+ addonId: null,
68659
+ access: "create"
68660
+ },
68636
68661
  "sceneMonitor.captureReference": {
68637
68662
  capName: "scene-monitor",
68638
68663
  capScope: "device",
@@ -69965,12 +69990,6 @@ Object.freeze({
69965
69990
  addonId: null,
69966
69991
  access: "view"
69967
69992
  },
69968
- "userManagement.listApiKeys": {
69969
- capName: "user-management",
69970
- capScope: "system",
69971
- addonId: null,
69972
- access: "view"
69973
- },
69974
69993
  "userManagement.listExternalIdentities": {
69975
69994
  capName: "user-management",
69976
69995
  capScope: "system",
@@ -70025,12 +70044,6 @@ Object.freeze({
70025
70044
  addonId: null,
70026
70045
  access: "create"
70027
70046
  },
70028
- "userManagement.revokeApiKey": {
70029
- capName: "user-management",
70030
- capScope: "system",
70031
- addonId: null,
70032
- access: "delete"
70033
- },
70034
70047
  "userManagement.revokeOauthSession": {
70035
70048
  capName: "user-management",
70036
70049
  capScope: "system",
@@ -73395,9 +73408,13 @@ new Map(Object.entries({
73395
73408
  "stream-online": "device-events",
73396
73409
  "stream-offline": "device-events",
73397
73410
  "detection-blind": "device-events",
73411
+ "motion-noisy": "device-events",
73412
+ "motion-calm": "device-events",
73398
73413
  "recording-stalled": "device-events",
73399
73414
  "recording-healthy": "device-events",
73400
73415
  "recording-degraded": "device-events",
73416
+ "device-attention-required": "device-events",
73417
+ "device-attention-resolved": "device-events",
73401
73418
  "node-online": "system",
73402
73419
  "node-offline": "system",
73403
73420
  "node-restarting": "system",
@@ -73480,6 +73497,12 @@ var NC_SYSTEM_EVENT_KIND_GROUP_SPECS = [
73480
73497
  label: "Detecting nothing",
73481
73498
  kinds: ["detection-blind"]
73482
73499
  },
73500
+ {
73501
+ id: "motion-noise",
73502
+ family: "device-events",
73503
+ label: "Motion without a subject",
73504
+ kinds: ["motion-noisy", "motion-calm"]
73505
+ },
73483
73506
  {
73484
73507
  id: "recording",
73485
73508
  family: "device-events",
@@ -73490,6 +73513,12 @@ var NC_SYSTEM_EVENT_KIND_GROUP_SPECS = [
73490
73513
  "recording-degraded"
73491
73514
  ]
73492
73515
  },
73516
+ {
73517
+ id: "device-attention",
73518
+ family: "device-events",
73519
+ label: "Needs attention",
73520
+ kinds: ["device-attention-required", "device-attention-resolved"]
73521
+ },
73493
73522
  {
73494
73523
  id: "nodes",
73495
73524
  family: "system",
@@ -73629,6 +73658,7 @@ var ALERT_EPISODE = [
73629
73658
  "alert-error",
73630
73659
  "alert-critical-resolved"
73631
73660
  ];
73661
+ var DEVICE_ATTENTION = ["device-attention-required", "device-attention-resolved"];
73632
73662
  var UPDATES = [
73633
73663
  "addon-update-available",
73634
73664
  "server-update-available",
@@ -73658,9 +73688,12 @@ var DEVICE_EVENTS = [
73658
73688
  "stream-online",
73659
73689
  "stream-offline",
73660
73690
  "detection-blind",
73691
+ "motion-noisy",
73692
+ "motion-calm",
73661
73693
  "recording-stalled",
73662
73694
  "recording-healthy",
73663
73695
  "recording-degraded",
73696
+ ...DEVICE_ATTENTION,
73664
73697
  ...ALARM
73665
73698
  ];
73666
73699
  /** Every kind a summary may speak about — the two summarisable families. */
@@ -73828,7 +73861,9 @@ var STATE_SUMMARY_VARS = [
73828
73861
  [...RULE_TEXT],
73829
73862
  [...RULE_TEXT],
73830
73863
  [...RULE_TEXT],
73831
- ([...RULE_TEXT], [...ALERT_EPISODE]),
73864
+ [...RULE_TEXT],
73865
+ [...RULE_TEXT],
73866
+ ([...RULE_TEXT], [...DEVICE_ATTENTION, ...ALERT_EPISODE]),
73832
73867
  [...RULE_TEXT],
73833
73868
  [...RULE_TEXT],
73834
73869
  [...RULE_TEXT],
@@ -73850,11 +73885,11 @@ var STATE_SUMMARY_VARS = [
73850
73885
  [...RULE_TEXT],
73851
73886
  [...RULE_TEXT],
73852
73887
  [...RULE_TEXT],
73888
+ ([...RULE_TEXT], [...DEVICE_ATTENTION, ...ALERT_EPISODE]),
73853
73889
  ([...RULE_TEXT], [...ALERT_EPISODE]),
73890
+ ([...RULE_TEXT], [...DEVICE_ATTENTION, ...ALERT_EPISODE]),
73854
73891
  ([...RULE_TEXT], [...ALERT_EPISODE]),
73855
- ([...RULE_TEXT], [...ALERT_EPISODE]),
73856
- ([...RULE_TEXT], [...ALERT_EPISODE]),
73857
- ([...RULE_TEXT], [...ALERT_EPISODE]),
73892
+ ([...RULE_TEXT], [...DEVICE_ATTENTION, ...ALERT_EPISODE]),
73858
73893
  [...RULE_TEXT],
73859
73894
  [...RULE_TEXT],
73860
73895
  [...RULE_TEXT],
@@ -73930,6 +73965,15 @@ new Map([
73930
73965
  snapshotLabel: "Tanks low or full now",
73931
73966
  snapshotSection: "tanks"
73932
73967
  },
73968
+ {
73969
+ id: "motion-noise",
73970
+ family: "device-events",
73971
+ label: "Motion without a subject (constant / calm again)",
73972
+ bad: ["motion-noisy"],
73973
+ recovery: ["motion-calm"],
73974
+ snapshotLabel: "Cameras with constant motion now",
73975
+ snapshotSection: null
73976
+ },
73933
73977
  {
73934
73978
  id: "recording-health",
73935
73979
  family: "device-events",
@@ -73939,6 +73983,15 @@ new Map([
73939
73983
  snapshotLabel: "Recordings stalled now",
73940
73984
  snapshotSection: null
73941
73985
  },
73986
+ {
73987
+ id: "device-attention",
73988
+ family: "device-events",
73989
+ label: "Device needs attention (raised / resolved)",
73990
+ bad: ["device-attention-required"],
73991
+ recovery: ["device-attention-resolved"],
73992
+ snapshotLabel: "Devices needing attention now",
73993
+ snapshotSection: null
73994
+ },
73942
73995
  {
73943
73996
  id: "node-connectivity",
73944
73997
  family: "system",
@@ -74514,7 +74567,7 @@ var AdminUIAddon = class extends BaseAddon {
74514
74567
  capability: adminUiCapability,
74515
74568
  provider: {
74516
74569
  getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
74517
- getVersion: async () => ({ version: "1.2.451" })
74570
+ getVersion: async () => ({ version: "1.2.452" })
74518
74571
  }
74519
74572
  }];
74520
74573
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-admin-ui",
3
- "version": "1.2.451",
3
+ "version": "1.2.452",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Admin UI — Vite frontend build and server-side addon",
@@ -1,4 +0,0 @@
1
- import{$ as e,B as t,G as n,J as r,L as i,S as a,b as o,o as s,q as c,x as l,z as u}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEHpkaJP.js";import{Ci as d,Gr as f,It as p,Nt as m,Ot as h,Q as g,Rn as _,Si as v,Tn as y,bn as b,dt as x,fn as S,kn as C,mi as w,oi as T,or as E,pn as D,tn as ee,un as te,yi as ne}from"./player-overlays-BQ-CPD3k.js";import{Xi as re}from"./client-C7mYZlqO.js";import{i as ie,l as ae}from"./video-JjHo3xW3.js";import{$n as oe,Ar as O,Ms as se,Mu as ce,Qn as le,Qr as k,Rr as A,Tt as ue,Xt as de,Xu as j,Zt as M,_i as fe,ai as pe,bi as N,ci as P,di as F,ei as I,er as L,fi as R,gi as me,hi as z,hr as he,ht as B,ii as ge,ir as _e,kr as V,li as H,mi as ve,ni as U,nr as ye,oi as W,qu as G,ri as be,rr as xe,ti as K,ui as Se,xi as Ce,yi as q}from"./src-DP8JO4HZ.js";import{t as J}from"./useTranslation-D3Is_4B6.js";import"./mount-B7n7uzAw.js";import{Z as Y,et as X,nt as we}from"./index-B-H1mfMz.js";import{t as Z}from"./AdminPage-Bc7EcIQy.js";import{t as Te}from"./NodeAddonsSettingsPanel-BNTQVCjk.js";import{n as Q,t as Ee}from"./useNodeUrlSelection-ChFCBb4B.js";function De(e){if(e===void 0)return null;switch(e.state){case`failed`:case`refused`:case`missing`:case`crashed`:return{kind:e.state,...e.reason===void 0?{}:{reason:e.reason}};default:return null}}e();var Oe={queued:{icon:T,bg:`bg-muted text-foreground-subtle`,labelKey:`addons.addonRowBadge.queued`},updating:{icon:E,bg:`bg-primary/10 text-primary`,labelKey:`addons.addonRowBadge.updating`,spin:!0},"done-pending-restart":{icon:b,bg:`bg-amber-500/10 text-amber-700`,labelKey:`addons.addonRowBadge.pendingRestart`},done:{icon:d,bg:`bg-success/10 text-success`,labelKey:`addons.addonRowBadge.done`},failed:{icon:ie,bg:`bg-danger/10 text-danger`,labelKey:`addons.addonRowBadge.failed`}};function ke({item:e}){let{t}=J(),n=Oe[e.status],r=n.icon;return a(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded ${n.bg}`,title:e.error,children:[l(r,{className:`w-2.5 h-2.5 ${n.spin?`animate-spin`:``}`}),t(n.labelKey)]})}var Ae=new Set([`completed`,`failed`,`partially-failed`,`cancelled`]),je=new Set([`done`,`failed`,`skipped`]);function Me(e){return!je.has(e.phase)&&!Ae.has(e.jobState)}function Ne(e,t){let n=new Map,r=[...e].sort((e,t)=>e.createdAtMs-t.createdAtMs);for(let e of r){let r=Ae.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 Pe(){let{data:e}=H({activeOnly:!0},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data?.length??0)>0?3e3:!1}),{map:t}=j(re.AddonsJobProgress,e=>e.job.jobId);return n(()=>{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 Ne([...n.values()],Date.now())},[e,t])}var Fe={queued:{icon:T,cls:`bg-muted text-foreground-subtle`,labelKey:`addons.jobProgress.queued`},fetching:{icon:E,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.fetching`,spin:!0},staged:{icon:E,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.staged`,spin:!0},validating:{icon:E,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.validating`,spin:!0},applying:{icon:E,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.applying`,spin:!0},restarting:{icon:E,cls:`bg-amber-500/10 text-amber-600 dark:text-amber-400`,labelKey:`addons.jobProgress.restarting`,spin:!0},applied:{icon:E,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.finalizing`,spin:!0},done:{icon:d,cls:`bg-success/10 text-success`,labelKey:`addons.jobProgress.updated`},failed:{icon:ie,cls:`bg-danger/10 text-danger`,labelKey:`addons.jobProgress.failed`},skipped:{icon:ee,cls:`bg-muted text-foreground-subtle`,labelKey:`addons.jobProgress.skipped`}};function Ie({progress:e}){let{t}=J(),n=Fe[e.phase],r=n.icon,i=e.error??`${e.packageName}: ${e.fromVersion??`?`} → ${e.toVersion}`;return a(`span`,{"data-testid":`addon-job-progress`,className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded shrink-0 ${n.cls}`,title:i,children:[l(r,{className:`w-2.5 h-2.5 ${n.spin?`animate-spin`:``}`}),t(n.labelKey),a(`span`,{className:`font-mono`,children:[`→ `,e.toVersion]})]})}function Le(e,t){return e.filter(e=>e.packageName===t).slice().sort((e,t)=>e.isHub===t.isHub?e.nodeName.localeCompare(t.nodeName):e.isHub?-1:1)}function Re(e){let t=e.version===null?``:` ${e.version}`,n=e.isOnline?``:` (offline: removed when it reconnects)`;return`- ${e.nodeName}${t}${n}`}function ze(e,t,n){let r=[`${e} will be uninstalled from ${t.length} node(s). Its runners stop, its capabilities are deregistered and its code is deleted:`,...t.map(Re)];return n.length>0&&r.push(`Could not ask: ${n.join(`, `)} — not included.`),r.push(`This cannot be undone.`),r.join(`
2
- `)}function Be(e,t,n){let r=[`${e} will be uninstalled from ${t}: its runners stop and its code is deleted.`];return n.length>0&&r.push(`It stays installed on: ${n.map(e=>e.nodeName).join(`, `)}. Use "Everywhere" to remove it from every node.`),r.push(`This cannot be undone.`),r.join(`
3
- `)}var Ve={uninstalled:`uninstalled`,"not-installed":`was not installed`,refused:`REFUSED`,failed:`FAILED`,"pending-reconnect":`offline — removed when it reconnects`};function He(e,t){let n=[];for(let r of e.results){let e=r.runnersStopped.length>0?` (stopped ${r.runnersStopped.join(`, `)})`:``;n.push(`${t(r.nodeId)}: ${Ve[r.outcome]}${e}`),r.error!==void 0&&n.push(` ${r.error}`);for(let e of r.warnings)n.push(` ${e}`)}return n.join(`
4
- `)}var Ue={},We=3e4,Ge=`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`;function Ke({packageName:e,displayName:t,selectedNode:n,hideNodeAction:r,disabled:i}){let{t:o}=J(),c=s(),u=O(),d=V(),f=P(Ue,{staleTime:We}),m=f.data?.installations??[],h=(f.data?.unreachable??[]).map(e=>e.nodeId),g=Le(m,e),_=e=>g.find(t=>t.nodeId===e)?.nodeName??(e===n.id?n.name:e),v=N({onSettled:()=>{c.invalidateQueries({queryKey:[[`addons`]]}),c.invalidateQueries({queryKey:[[`addonPages`]]}),c.invalidateQueries({queryKey:[[`capabilities`]]}),c.invalidateQueries({queryKey:[[`nodes`]]})}}),y=async e=>{await d({title:e.success?o(`addons.addonUninstallControls.uninstalled`,`{{displayName}} uninstalled`,{displayName:t}):o(`addons.addonUninstallControls.notEveryNodeWasCleaned`,`{{displayName}}: not every node was cleaned`,{displayName:t}),message:He(e,_),variant:e.success?`default`:`danger`})},b=async n=>{try{await y(await v.mutateAsync({packageName:e,...n}))}catch(e){await d({title:o(`addons.addonUninstallControls.uninstallFailed`,`Uninstall {{displayName}} failed`,{displayName:t}),message:e instanceof Error?e.message:String(e),variant:`danger`})}},x=async()=>{let e=g.filter(e=>e.nodeId!==n.id);await u({title:o(`addons.addonUninstallControls.uninstallFrom`,`Uninstall {{displayName}} from {{name}}?`,{displayName:t,name:n.name}),message:Be(t,n.name,e),confirmLabel:o(`addons.addonUninstallControls.uninstall`,`Uninstall`),variant:`danger`})&&await b(n.isHub?{}:{nodeId:n.id})},S=async()=>{let n=(await f.refetch()).data;if(n===void 0){await d({title:o(`addons.addonUninstallControls.cannotListTheNodes`,`Cannot list the nodes`),message:o(`addons.addonUninstallControls.theHubDidNotAnswer`,`The hub did not answer which nodes have this package — nothing was removed.`),variant:`danger`});return}let r=Le(n.installations,e);await u({title:o(`addons.addonUninstallControls.uninstallEverywhere`,`Uninstall {{displayName}} everywhere?`,{displayName:t}),message:ze(t,r,n.unreachable.map(e=>e.nodeId)),confirmLabel:o(`addons.addonUninstallControls.uninstallFromNodeS`,`Uninstall from {{length}} node(s)`,{length:r.length}),variant:`danger`})&&await b({everywhere:!0})},C=v.isPending||i===!0;return a(`div`,{className:`flex items-center gap-1.5`,children:[r!==!0&&a(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),x()},disabled:C,className:Ge,title:o(`addons.addonUninstallControls.uninstallFrom2`,`Uninstall from {{name}}`,{name:n.name}),children:[l(p,{className:`h-3 w-3`}),v.isPending?o(`addons.addonUninstallControls.removing`,`Removing...`):o(`addons.addonUninstallControls.uninstall`,`Uninstall`)]}),(g.length>1||r===!0||h.length>0)&&a(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),S()},disabled:C,className:Ge,title:o(`addons.addonUninstallControls.uninstallFromEveryNodeThat`,`Uninstall from every node that has it`),children:[l(ae,{className:`h-3 w-3`}),g.length>0?o(`addons.uninstallControls.everywhereCount`,{count:g.length}):o(`addons.uninstallControls.everywhere`)]})]})}function qe({packageName:e,currentVersion:t,installSource:n,onInstall:r,onClose:i,onSelect:s,selectedVersion:c}){let{t:u}=J(),p=n===`upload`||n===`local`,{data:m,isLoading:g}=ge({name:e});return a(`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:[a(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[l(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle font-medium`,children:u(`addons.versionPicker.versions`,`Versions`)}),l(`button`,{type:`button`,onClick:i,className:`text-foreground-subtle hover:text-foreground`,children:l(x,{className:`h-3 w-3`})})]}),p&&a(`div`,{className:`flex items-start gap-2 px-3 py-2 border-b border-border bg-cyan-500/10 text-[10px]`,children:[l(h,{className:`h-3 w-3 mt-0.5 text-cyan-500 shrink-0`}),a(`div`,{className:`text-cyan-700 dark:text-cyan-200`,children:[l(`span`,{className:`font-semibold`,children:u(`addons.versionPicker.inPlace`,{kind:n===`upload`?u(`addons.versionPicker.uploadedCopy`,`Uploaded copy`):u(`addons.versionPicker.localCopy`,`Local copy`)})}),` `,l(Y,{i18nKey:`addons.versionPicker.reinstall`,values:{version:t},components:{mono:l(`span`,{className:`font-mono`})}})]})]}),g&&a(`div`,{className:`flex items-center justify-center gap-2 py-6 text-[10px] text-foreground-subtle`,children:[l(E,{className:`h-3.5 w-3.5 animate-spin`}),u(`addons.versionPicker.loadingVersions`,`Loading versions...`)]}),m&&l(`div`,{className:`max-h-64 overflow-auto divide-y divide-border`,children:m.map(e=>{let n=e.version===t,i=s!==void 0&&e.version===c,p=/-(alpha|beta|rc|dev|canary|next)/i.test(e.version),m=a(o,{children:[l(`span`,{className:`font-mono flex-1 text-left ${n?`text-primary font-semibold`:p?`text-amber-400`:`text-foreground`}`,children:e.version}),n&&l(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium bg-primary/10 text-primary`,children:u(`common.current`)}),e.distTags.map(e=>l(`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&&l(`span`,{className:`text-[9px] text-red-400 line-through`,children:u(`common.deprecated`)}),l(`span`,{className:`text-[9px] text-foreground-subtle shrink-0`,children:new Date(e.publishedAt).toLocaleDateString()})]});return s?a(`button`,{type:`button`,"aria-label":u(`addons.versionPicker.select`,`Select {{version}}`,{version:e.version}),onClick:()=>s(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:[m,i?l(d,{className:`h-3 w-3 text-primary shrink-0`}):l(`span`,{className:`w-3 shrink-0`})]},e.version):a(`div`,{className:`flex items-center gap-2 px-3 py-2 text-[11px] ${n?`bg-primary/5`:`hover:bg-surface-hover`} transition-colors`,children:[m,l(`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?u(`addons.versionPicker.reInstallFromNpm`,`Re-install {{version}} from npm`,{version:e.version}):u(`addons.versionPicker.install`,`Install {{version}}`,{version:e.version}),children:l(f,{className:`h-3 w-3`})})]},e.version)})}),m&&m.length===0&&l(`div`,{className:`py-4 text-center text-[10px] text-foreground-subtle`,children:u(`addons.versionPicker.noVersionsFound`,`No versions found`)})]})}e();var Je=`device-export`;function Ye(e){return e.capabilities.some(e=>(typeof e==`string`?e:e.name)===Je)}function Xe(e){return e!==`local`&&e!==`upload`}function Ze({isBundle:e,installSource:t,addonId:n,iconPath:i,color:o}){let[s,c]=r(!1),u=o?{backgroundColor:`${o.startsWith(`#`)?o:`#${o}`}26`}:void 0,d=e?`bg-indigo-500/20 text-indigo-700 dark:text-indigo-300`:`bg-purple-500/20 text-purple-700 dark:text-purple-300`,f=n&&i?g(`/api/addon-assets/${n}/${i}`):null,p=!!f&&!s;return a(`div`,{className:`relative flex-shrink-0`,children:[l(`div`,{className:`h-8 w-8 rounded-md flex items-center justify-center ${u?``:d}`,style:u,children:p?l(`img`,{src:f,alt:n,className:`h-4 w-4`,onError:()=>c(!0)}):l(e?_:y,{className:`h-3.5 w-3.5`})}),t===`local`&&l(`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`}),Xe(t)&&l(`span`,{className:`absolute -top-1 -left-1 w-4 h-4 rounded bg-[#cb3837] flex items-center justify-center -rotate-12 shadow-sm`,children:l(`svg`,{viewBox:`0 0 780 250`,className:`w-[11px] h-[11px]`,children:l(`path`,{fill:`#fff`,d:`M240 250h100V50h100v200h340V0H0v250z`})})}),t===`upload`&&l(`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:l(h,{className:`h-2.5 w-2.5 text-white`})})]})}function Qe({version:e,availableUpdate:t,selectedVersion:n,isUpdating:r,installSource:i,disabled:o,onUpdate:s,onOpenPicker:c,children:u}){let{t:d}=J();if(r)return a(`span`,{className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium border border-blue-500/30 bg-blue-500/10 text-blue-400 shrink-0`,children:[l(E,{className:`h-3 w-3 animate-spin`}),d(`addons.addonCard.updating`,`Updating…`)]});if(t){let r=n??t;return a(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[s&&a(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),s()},disabled:o,className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 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:d(`addons.addonCard.updateTo`,`Update to {{target}}`,{target:r}),children:[l(f,{className:`h-3 w-3`}),d(`addons.addonCard.update`,`Update`)]}),a(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),c()},disabled:o,"aria-label":d(`addons.addonCard.selectVersionToInstall`,`Select version to install`),title:d(`addons.addonCard.installedUpdateAvailableSelectedTap`,`Installed {{version}} — update available. Selected {{target}}; tap to choose another version.`,{version:e,target:r}),className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 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:[l(`span`,{className:`font-normal opacity-70`,children:e}),l(`span`,{className:`font-normal opacity-70`,children:`→`}),r,l(v,{className:`h-3 w-3`})]}),u]})}return a(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[a(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),c()},disabled:o,className:[`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 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:d(`addons.addonCard.versionTapToViewAll`,`Version {{version}} — tap to view all versions`,{version:e}),children:[e,l(v,{className:`h-3 w-3 opacity-50`})]}),u]})}function $e({addonId:e}){let t=s(),{data:n=`inherit`}=K({addonId:e}),r=me({onSuccess:()=>{t.invalidateQueries({queryKey:[[`addons`,`getAddonAutoUpdate`]]})}});return l(`div`,{className:`flex rounded-lg border border-border overflow-hidden text-[10px] font-medium`,children:[`inherit`,`off`,`latest`,`beta`].map(t=>l(`button`,{type:`button`,onClick:n=>{n.stopPropagation(),r.mutate({addonId:e,channel:t})},disabled:r.isPending,className:`px-2.5 py-1 transition-colors capitalize ${n===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))})}var et={id:`hub`,name:`Hub`,isHub:!0};function tt({addon:e,agents:n=[],clusterStatus:i,hideVersion:c,availableUpdate:u,onUpdate:d,isUpdating:f,jobProgress:p,bundle:m,bulkItem:h,disabledByBulk:g,isSystem:y,selectedNode:S}){let{t:w}=J(),[T,E]=r(!1),[ee,re]=r(!1),[ae,O]=r(!1),[se,ce]=r(null);t(()=>{ce(null)},[u]);let k=se??u,[A,j]=r(!1),[fe,N]=r(!1),[P,F]=r(`logs`),I=s(),me=X(),{manifest:z}=e,B=e.installedOn??[],ge=!m&&!z.protected&&z.removable!==!1,V=!!m,H=m?.displayName??z.name,U=m?.packageName??z.packageName,W=m?.version??z.packageVersion??z.version,G=m?.installSource??e.installSource,be=m?m.bundle?.description??m.addons[0]?.manifest.description:z.description,K=R({onSuccess:()=>{I.invalidateQueries({queryKey:[[`addons`]]})}}),Se=pe({onSuccess:()=>{I.invalidateQueries({queryKey:[[`addons`]]}),I.invalidateQueries({queryKey:[[`addonPages`]]}),I.invalidateQueries({queryKey:[[`capabilities`]]}),I.invalidateQueries({queryKey:[[`integrations`]]})}}),Ce=ve({onSuccess:()=>{I.invalidateQueries({queryKey:[[`addons`]]}),I.invalidateQueries({queryKey:[[`alerts`]]})}}),q=e.health,Y=q?.phase===`failed`&&!q.inGracePeriod,we=Y&&q?.nextRetryAt&&!q.retrying,Z=De(e.process);return a(`div`,{className:`rounded-md border bg-surface overflow-hidden ${Y?`border-red-500/50`:`border-border`}`,children:[Y&&q&&a(`div`,{className:`bg-danger/10 border-b border-danger/30 px-3 py-2 flex items-start gap-2`,children:[l(ie,{className:`h-4 w-4 text-danger shrink-0 mt-0.5`}),a(`div`,{className:`flex-1 min-w-0`,children:[l(`div`,{className:`text-xs font-semibold text-danger`,children:w(`addons.addonCard.failedToLoad`,{attempt:q.retryCount})}),l(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:q.lastError?.message??w(`addons.addonCard.unknownError`,`Unknown error`)}),we&&q.nextRetryAt&&l(`div`,{className:`text-[10px] text-foreground-subtle mt-1`,children:w(`addons.addonCard.autoRetryAt`,{time:new Date(q.nextRetryAt).toLocaleTimeString()})})]}),a(`button`,{type:`button`,disabled:Ce.isPending||q.retrying,onClick:e=>{e.stopPropagation(),Ce.mutate({packageName:U})},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:w(`addons.addonCard.resetRetryCounterAndForce`,`Reset retry counter and force immediate reload`),children:[l(b,{className:`h-3 w-3 ${Ce.isPending||q.retrying?`animate-spin`:``}`}),w(`addons.addonCard.retryNow`,`Retry now`)]})]}),Z!==null&&a(`div`,{className:`bg-danger/10 border-b border-danger/30 px-3 py-2 flex items-start gap-2`,children:[l(ie,{className:`h-4 w-4 text-danger shrink-0 mt-0.5`}),a(`div`,{className:`flex-1 min-w-0`,children:[l(`div`,{className:`text-xs font-semibold text-danger`,children:w(`addons.addonCard.processProblem.${Z.kind}`)}),Z.reason!==void 0&&l(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:Z.reason})]})]}),a(`div`,{className:`flex items-start gap-2.5 px-3 py-2`,children:[l(Ze,{isBundle:V||!!z.components&&z.components.length>1,installSource:G,addonId:V?m.addons[0]?.manifest.id:z.id,iconPath:V?m.bundle?.icon??m.addons[0]?.manifest.icon:z.icon,color:V?m.addons[0]?.manifest.color:z.color}),a(`div`,{className:`flex-1 min-w-0`,children:[a(`div`,{className:`flex items-start justify-between gap-2`,children:[l(`span`,{className:`text-xs font-semibold text-foreground truncate min-w-0`,children:H}),!c&&l(Qe,{version:W,availableUpdate:u,...k===void 0?{}:{selectedVersion:k},isUpdating:f,installSource:G,disabled:g,...d&&k!==void 0?{onUpdate:()=>d(k)}:{},onOpenPicker:()=>O(e=>!e),children:ae&&l(qe,{packageName:U,currentVersion:W,...G?{installSource:G}:{},...u!==void 0&&k!==void 0?{selectedVersion:k,onSelect:e=>{ce(e),O(!1)}}:{},onInstall:e=>{O(!1),Se.mutate({packageName:U,version:e})},onClose:()=>O(!1)})})]}),a(`div`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 mt-0.5`,children:[U!==H&&l(`span`,{className:`text-[10px] text-foreground-subtle font-mono truncate max-w-full`,children:U}),V&&a(`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:[l(_,{className:`h-3 w-3`}),m.addons.length]}),y&&a(`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:w(`addons.addonCard.systemPackageUpdatingRestartsThe`,`System package — updating restarts the hub`),children:[l(b,{className:`h-3 w-3`}),w(`addons.addonCard.system`,`System`)]}),h!=null&&l(ke,{item:h}),p!=null&&l(Ie,{progress:p})]}),be&&l(`p`,{className:`text-[10px] text-foreground-subtle mt-1 line-clamp-1`,children:be}),!V&&e.process&&a(`div`,{className:`flex flex-wrap items-center gap-1.5 mt-1`,children:[l(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${e.process.mode===`forked`?`bg-blue-500/15 text-blue-400`:`bg-gray-500/15 text-gray-400`}`,children:e.process.mode===`forked`?w(`addons.addonCard.forked`):w(`addons.addonCard.inProcess`)}),e.process.pid!=null&&a(`span`,{className:`text-[9px] font-mono text-foreground-subtle`,children:[`PID `,e.process.pid]}),l(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${e.process.state===`running`?`bg-emerald-500/15 text-emerald-400`:Z===null?`bg-gray-500/15 text-gray-400`:`bg-red-500/15 text-red-400`}`,children:e.process.state})]})]})]}),!V&&a(`div`,{className:`flex items-center gap-1 px-3 py-1 border-t border-border/50 bg-surface-hover/20`,children:[a(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),K.mutate({addonId:z.id})},disabled:K.isPending||g,className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 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:[l(b,{className:`h-3 w-3 ${K.isPending?`animate-spin`:``}`}),w(`addons.addonCard.restart`,`Restart`)]}),a(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),j(e=>!e)},className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium border transition-colors ${A?`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:[l(D,{className:`h-3 w-3`}),w(`addons.addonCard.logs`,`Logs`)]}),!V&&a(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),N(!0)},className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium border transition-colors ${fe?`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:[l(te,{className:`h-3 w-3`}),w(`addons.addonCard.settings`,`Settings`)]}),l(`div`,{className:`flex-1`}),ge&&l(Ke,{packageName:z.packageName,displayName:z.name,selectedNode:S??et,disabled:g})]}),i&&i.nodes.length>1&&!V&&a(`div`,{className:`border-t border-border px-3 py-1.5 bg-muted/10`,children:[l(`div`,{className:`text-[10px] font-medium text-foreground-subtle mb-1.5`,children:w(`addons.addonCard.clusterDeployment`,`Cluster Deployment`)}),l(`div`,{className:`space-y-1`,children:i.nodes.map(e=>a(`div`,{className:`flex items-center gap-2 text-[10px]`,children:[l(`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`}`}),l(`span`,{className:`font-medium text-foreground min-w-[60px]`,children:e.name}),l(`span`,{className:`font-mono text-foreground-subtle`,children:e.version}),!e.synced&&e.status!==`offline`&&l(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-amber-500/10 text-amber-400 border border-amber-500/20`,children:w(`addons.addonCard.outdated`)}),e.status===`offline`&&l(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-muted text-muted-foreground`,children:w(`common.offline`)}),e.synced&&e.status!==`offline`&&l(`span`,{className:`text-[9px] text-success`,children:w(`common.synced`)})]},e.nodeId))})]}),A&&!V&&a(`div`,{className:`border-t border-border`,children:[a(`div`,{className:`flex items-center px-3 py-0.5 bg-surface-hover/20 border-b border-border/50`,children:[a(`div`,{className:`flex rounded border border-border overflow-hidden text-[9px]`,children:[l(`button`,{type:`button`,onClick:()=>F(`logs`),className:`px-2 py-0.5 transition-colors ${P===`logs`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:w(`addons.addonCard.logs`,`Logs`)}),l(`button`,{type:`button`,onClick:()=>F(`events`),className:`px-2 py-0.5 border-l border-border transition-colors ${P===`events`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:w(`addons.addonCard.events`,`Events`)})]}),l(`div`,{className:`flex-1`}),l(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),j(!1)},className:`text-foreground-subtle hover:text-foreground`,children:l(x,{className:`h-3.5 w-3.5`})})]}),P===`logs`&&l(M,{addonId:z.id,maxHeight:`max-h-64`,showFilters:!1}),P===`events`&&l(de,{addonId:z.id,category:`addon.*`,maxHeight:`max-h-64`})]}),V&&a(o,{children:[l(`button`,{type:`button`,onClick:()=>E(e=>!e),className:`w-full flex items-center justify-center border-t border-border py-1 hover:bg-surface-hover/50 transition-colors`,children:l(T?ne:v,{className:`h-3.5 w-3.5 text-foreground-subtle`})}),T&&l(`div`,{className:`border-t border-border px-2.5 py-1.5 space-y-1.5`,children:m.addons.map(e=>l(tt,{addon:e,agents:n,hideVersion:!0},e.manifest.id))})]}),fe&&!V&&l(le,{open:!0,onOpenChange:e=>!e&&N(!1),children:a(L,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:[l(xe,{children:a(_e,{className:`flex items-center gap-2`,children:[l(te,{className:`h-4 w-4 text-primary`}),w(`addons.addonCard.settingsTitle`,{name:H})]})}),a(oe,{className:`space-y-4`,children:[l(`div`,{className:`text-[10px] text-foreground-subtle mb-2`,children:w(`addons.addonCard.clusterWideSettingsOneValue`,`Cluster-wide settings — one value for every node. Per-node settings live under Cluster → the node → Settings.`)}),l(Te,{nodeId:null,addonIds:[z.id],level:`global`,fieldScope:`cluster`,emptyMessage:w(`addons.addonCard.thisAddonExposesNoCluster`,`This addon exposes no cluster-wide settings. Anything it can configure is per-node — open it from Cluster → the node → Settings.`)}),Ye(z)&&a(`div`,{children:[l(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:w(`addons.addonCard.deviceExport`,`Device export`)}),l(ue,{addonId:z.id,onOpenDevice:e=>me(`/devices/${e}`)})]}),Xe(G)&&a(`div`,{children:[l(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:w(`addons.addonCard.autoUpdate`,`Auto-Update`)}),l($e,{addonId:z.id})]}),z.components&&z.components.length>0&&a(`div`,{children:[l(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:w(`addons.addonCard.components`,{count:z.components.length})}),l(`div`,{className:`flex flex-wrap gap-1`,children:z.components.map(e=>l(`span`,{className:`text-[10px] rounded bg-background border border-border px-1.5 py-0.5 text-foreground-subtle font-mono`,children:e},e))})]}),n.length>=2&&a(`div`,{children:[l(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:w(`addons.addonCard.installedOn`,`Installed on`)}),a(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[B.length===0&&l(`span`,{className:`text-[10px] text-foreground-subtle`,children:w(`addons.addonCard.hubLocal`,`Hub (local)`)}),B.map(e=>l(`span`,{className:`rounded-full bg-surface-hover border border-border px-2 py-0.5 text-[10px] text-foreground-subtle`,children:e},e)),a(`div`,{className:`relative`,children:[a(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),re(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:w(`addons.addonCard.installOnMoreAgents`,`Install on more agents`),children:[l(C,{className:`h-3 w-3`}),w(`addons.addonCard.addAgent`,`Add agent`)]}),ee&&a(`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:[n.filter(e=>!e.isHub&&!B.includes(e.name)).map(e=>l(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),re(!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)),n.filter(e=>!e.isHub&&!B.includes(e.name)).length===0&&l(`div`,{className:`px-3 py-1.5 text-[10px] text-foreground-subtle`,children:w(`addons.addonCard.noAvailableAgents`,`No available agents`)})]})]})]})]})]}),l(ye,{children:l(he,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>N(!1),children:w(`common.close`,`Close`)})})]})})]})}e();var nt=`.tgz,.tar.gz,.zip`;function rt({onUploadSuccess:e}){let{t}=J(),[n,s]=r(!1),u=c(null),d=i(async t=>{s(!0);let n=new FormData;n.append(`file`,t);let r=localStorage.getItem(`camstack_admin_token`)??``;try{(await(await fetch(g(`/api/addons/upload`),{method:`POST`,headers:{Authorization:`Bearer ${r}`},body:n})).json()).success&&e()}finally{s(!1)}},[e]);return a(o,{children:[l(`input`,{ref:u,type:`file`,accept:nt,onChange:i(e=>{let t=e.target.files?.[0];t&&d(t),e.target.value=``},[d]),className:`hidden`}),a(`button`,{type:`button`,onClick:()=>u.current?.click(),disabled:n,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:[n?l(E,{className:`w-3.5 h-3.5 animate-spin`}):l(h,{className:`w-3.5 h-3.5`}),n?t(`addons.addonUploadZone.uploading`,`Uploading...`):t(`addons.addonUploadZone.upload`,`Upload`)]})]})}var it=new Set([`@camstack/system`,`@camstack/types`,`@camstack/sdk`,`@camstack/ui-library`,`@camstack/addon-agent-ui`]);function at(e,t){let n=new Map;for(let r of e){if(r.isHub||r.onHub||it.has(r.packageName)||!t.isHub&&r.nodeId!==t.id)continue;let e=n.get(r.packageName)??[];e.push(r),n.set(r.packageName,e)}return[...n].map(([e,t])=>({packageName:e,rows:t})).sort((e,t)=>e.packageName.localeCompare(t.packageName))}function ot({selectedNode:e}){let{t}=J(),{data:n}=P(Ue,{staleTime:We});if(n===void 0)return null;let r=at(n.installations,e),i=n.unreachable.filter(t=>e.isHub||t.nodeId===e.id);return r.length===0&&i.length===0?null:a(`div`,{className:`rounded-lg border border-warning/30 bg-warning/5 px-3 py-2.5 space-y-2`,children:[a(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold text-foreground`,children:[l(m,{className:`h-3.5 w-3.5 text-warning`}),e.isHub?t(`addons.nodeOnlyPackagesPanel.installedOnAgentsButNot`,`Installed on agents but not on the hub`):t(`addons.nodeOnlyPackagesPanel.installedOnButNotOn`,`Installed on {{name}} but not on the hub`,{name:e.name})]}),i.length>0&&l(`div`,{className:`text-[10px] text-foreground-subtle`,children:t(`addons.nodeOnlyPackagesPanel.unreachable`,{nodes:i.map(e=>e.nodeId).join(`, `)})}),r.map(t=>a(`div`,{className:`flex items-center justify-between gap-3 flex-wrap rounded-md border border-border bg-surface px-3 py-2`,children:[a(`div`,{className:`min-w-0`,children:[l(`div`,{className:`text-xs font-mono text-foreground break-all`,children:t.packageName}),l(`div`,{className:`text-[10px] text-foreground-subtle`,children:t.rows.map(e=>`${e.nodeName}${e.version===null?``:` ${e.version}`}${e.isOnline?``:` (offline)`}`).join(` · `)})]}),l(Ke,{packageName:t.packageName,displayName:t.packageName,selectedNode:e,hideNodeAction:e.isHub})]},t.packageName))]})}function st({addon:e,installing:t,onInstall:n}){let{t:r}=J();return a(`div`,{className:`flex items-center gap-3 px-3 py-2 hover:bg-surface-hover transition-colors`,children:[l(`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()}),a(`div`,{className:`flex-1 min-w-0`,children:[a(`div`,{className:`flex items-baseline gap-2 min-w-0`,children:[l(`span`,{className:`text-[11px] font-semibold break-words`,children:e.name.replace(/^@camstack\/(addon-)?/,``)}),a(`span`,{className:`text-[10px] text-foreground-subtle shrink-0`,children:[`v`,e.version]})]}),l(`div`,{className:`font-mono text-[9px] text-foreground-subtle/80 truncate`,children:e.name}),e.description&&l(`div`,{className:`text-[10px] text-foreground-subtle truncate`,children:e.description})]}),e.installed?l(A,{variant:`success`,icon:l(d,{className:`h-3 w-3`}),children:e.installedVersion??r(`system.capabilityCatalog.installed`,`Installed`)}):a(he,{size:`sm`,onClick:()=>n(e.name),disabled:t,className:`shrink-0`,children:[t?l(E,{className:`h-3 w-3 animate-spin`}):l(f,{className:`h-3 w-3`}),r(`system.capabilityCatalog.install`,`Install`)]})]})}function ct({capability:e,installing:t,onInstall:n}){let{t:r}=J(),{data:i,isPending:o,isError:s}=z({capability:e}),c;if(s)c=l(`div`,{className:`px-3 py-2 text-xs text-danger`,children:r(`system.capabilityCatalog.couldNotSearchTheNpm`,`Could not search the npm catalog right now. Try again in a moment.`)});else if(o||i===void 0)c=a(`div`,{className:`flex items-center gap-2 px-3 py-2 text-xs text-foreground-subtle`,children:[l(E,{className:`h-3 w-3 animate-spin`}),r(`system.capabilityCatalog.searchingTheNpmCatalog`,`Searching the npm catalog…`)]});else{let a=i.filter(e=>!e.installed);c=a.length===0?l(`div`,{className:`px-3 py-2 text-xs text-foreground-subtle`,children:i.length===0?r(`system.capabilityCatalog.noPublishedAddonDeclaresThe`,`No published addon declares the "{{capability}}" capability.`,{capability:e}):r(`system.capabilityCatalog.everyPublishedAddonThatDeclares`,`Every published addon that declares "{{capability}}" is already installed.`,{capability:e})}):l(`div`,{className:`divide-y divide-border`,children:a.map(e=>l(st,{addon:e,installing:t,onInstall:n},e.name))})}return a(`section`,{className:`rounded-md border border-border bg-surface overflow-hidden`,"aria-label":r(`system.capabilityCatalog.availableToInstall`,`Available to install`),children:[l(`h2`,{className:`px-3 py-1.5 text-[10px] uppercase tracking-wide text-foreground-subtle border-b border-border`,children:r(`system.capabilityCatalog.availableToInstall`,`Available to install`)}),c]})}e();function lt(e){return e===`npm`||e===`dev`?e:null}var ut=`rounded-full border border-primary bg-primary/10 px-2 py-0.5 text-[10px] text-foreground`,dt=`rounded-full border border-border px-2 py-0.5 text-[10px] text-foreground-muted hover:bg-surface-hover`,ft=[{seconds:900,label:`15m`},{seconds:3600,label:`1h`},{seconds:21600,label:`6h`},{seconds:43200,label:`12h`},{seconds:86400,label:`24h`}],pt=new Set([`@camstack/system`,`@camstack/types`,`@camstack/sdk`,`@camstack/shm-ring`,`@camstack/ui-library`]);function mt(e){return e!==void 0&&pt.has(e)}var ht={id:`hub`,name:`Hub`,isHub:!0,isOnline:!0};function gt(e,t){let n=e??`hub-only`;return n===`any-node`?!0:n===`hub-only`?t:!t}function _t(e){return e===`local`?`dev`:`npm`}function vt(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`,...r.reason===void 0?{}:{reason:r.reason}}: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 yt(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 bt({addons:e,clusterStatus:o,selectedNode:d,onRefresh:p,isRefreshing:m}){let{t:h}=J(),g=s(),[_,v]=r(``),y=u(_),[x,C]=r(!1),T=c(null);t(()=>{if(!x)return;let e=e=>{T.current&&!T.current.contains(e.target)&&C(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[x]);let{data:D}=Se({nodeId:d.id}),ee=n(()=>{let e=new Map;for(let t of D??[])e.set(t.name,t.latestVersion);return e},[D]),te=n(()=>(D??[]).filter(e=>!e.isSystem).length,[D]),[ne,re]=r(()=>new Set),[ie,ae]=r(()=>new Map),oe=i(e=>{re(t=>new Set(t).add(e))},[]),se=i(e=>{re(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[]),le=i((e,t)=>{ae(n=>new Map(n).set(e,t))},[]),A=i(e=>{ae(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),ue=Ce({onMutate:e=>{oe(e.name),A(e.name)},onSuccess:(e,t)=>{se(t.name);let n=e;if(n&&n.success===!1){le(t.name,n.error??`Update failed (no error message returned by server)`);return}g.invalidateQueries({queryKey:[[`addons`]]}),g.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]})},onError:(e,t)=>{se(t.name),le(t.name,e instanceof Error?e.message:String(e))}}),de=Pe(),j=c(new Set);t(()=>{let e=new Set;for(let[t,n]of de)Me(n)&&e.add(t);let t=[...j.current].some(t=>!e.has(t));j.current=e,t&&(g.invalidateQueries({queryKey:[[`addons`]]}),g.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]}))},[de,g]);let{data:M}=U(void 0),N=k({onSuccess:()=>{g.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),P=fe({onSuccess:()=>{g.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),{data:F,isFetching:I}=z({query:y||void 0},{enabled:x}),L=q(),{data:R}=be(void 0),me=R?.requestedAt,[he,B]=r(null),[ge,_e]=r(!1);t(()=>{if(R?.kind===`framework-bulk-update`&&R.requestedAt!==he){B(R.requestedAt),_e(!0);let e=window.setTimeout(()=>_e(!1),6e3);return()=>window.clearTimeout(e)}},[me,he,R]),O();let V=i(async()=>{let e=(D??[]).filter(e=>!e.isSystem);if(e.length!==0){if(!d.isHub){for(let t of e)await ue.mutateAsync({name:t.name,version:t.latestVersion,nodeId:d.id});return}await L.mutateAsync({kind:`update`,targets:e.map(e=>({name:e.name,version:e.latestVersion})),nodeIds:[d.id]})}},[D,d.id,d.isHub,L,ue]),H=pe({onSuccess:()=>{g.invalidateQueries({queryKey:[[`addons`]]}),g.invalidateQueries({queryKey:[[`addonPages`]]}),g.invalidateQueries({queryKey:[[`capabilities`]]}),g.invalidateQueries({queryKey:[[`integrations`]]})}}),[ve,ye]=r(`type`),[W,G]=r(()=>typeof window>`u`?`grouped`:window.localStorage.getItem(`camstack.addons.viewMode`)===`flat`?`flat`:`grouped`),xe=e=>{G(e),typeof window<`u`&&window.localStorage.setItem(`camstack.addons.viewMode`,e)},[K,Y]=we(),X=K.get(`capability`),Z=K.get(`updatable`)===`1`,Te=K.get(`error`)===`1`,Q=lt(K.get(`source`)),Ee=i(e=>{let t=new URLSearchParams(K);e?t.set(`updatable`,`1`):t.delete(`updatable`),Y(t,{replace:!0})},[K,Y]),Oe=i(e=>{let t=new URLSearchParams(K);e?t.set(`error`,`1`):t.delete(`error`),Y(t,{replace:!0})},[K,Y]),ke=i(e=>{let t=new URLSearchParams(K);e===null?t.delete(`source`):t.set(`source`,e),Y(t,{replace:!0})},[K,Y]),Ae=n(()=>e.filter(e=>De(e.process)!==null).length,[e]),je=n(()=>{let t=e.filter(e=>!mt(e.manifest.packageName));return d.isHub||(t=t.filter(e=>gt(e.placement,d.isHub))),X&&(t=t.filter(e=>(e.manifest.capabilities??[]).some(e=>(typeof e==`string`?e:e.name)===X))),Z&&(t=t.filter(e=>{let t=e.manifest.packageName;return t!==void 0&&ee.has(t)})),Q!==null&&(t=t.filter(e=>_t(e.installSource)===Q)),Te&&(t=t.filter(e=>De(e.process)!==null)),t},[e,d.isHub,X,Z,Q,Te,ee]),Ne=()=>{let e=new URLSearchParams(K);e.delete(`capability`),Y(e,{replace:!0})},Fe=W===`flat`?je:yt(je),Ie=n(()=>{let e=[...Fe];switch(ve){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},[Fe,ve]);return a(`div`,{className:`space-y-3`,children:[[...ie.entries()].map(([e,t])=>l(`div`,{className:`rounded-md border border-danger/30 bg-danger/5 px-2.5 py-1.5 text-[11px]`,children:a(`div`,{className:`flex items-start justify-between gap-3`,children:[a(`div`,{className:`space-y-0.5`,children:[l(`div`,{className:`font-medium text-danger`,children:h(`systemPage.addons.updateFailed`,{name:e})}),l(`div`,{className:`text-foreground-subtle font-mono`,children:t})]}),l(`button`,{type:`button`,onClick:()=>A(e),className:`text-foreground-subtle hover:text-foreground text-[10px]`,children:h(`common.dismiss`)})]})},e)),a(`div`,{className:`flex items-center gap-x-2 gap-y-1.5 flex-wrap`,children:[a(`div`,{className:`flex items-center gap-1.5`,children:[l(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`admin.system.addons.sort`,`Sort:`)}),a(`select`,{value:ve,onChange:e=>ye(e.target.value),className:`rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground focus:outline-none focus:border-primary/50`,children:[l(`option`,{value:`type`,children:h(`admin.system.addons.bundlesFirst`,`Bundles first`)}),l(`option`,{value:`name`,children:h(`admin.system.addons.name`,`Name`)}),l(`option`,{value:`source`,children:h(`admin.system.addons.installSource`,`Install source`)})]})]}),a(`div`,{className:`flex items-center gap-1.5`,children:[l(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`admin.system.addons.view`,`View:`)}),l(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`grouped`,`flat`].map(e=>l(`button`,{type:`button`,onClick:()=>xe(e),className:`px-2 py-1 transition-colors capitalize ${W===e?`bg-primary/10 text-primary`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`}`,title:e===`grouped`?h(`admin.system.addons.groupMultiAddonPackagesInto`,`Group multi-addon packages into a bundle card`):h(`admin.system.addons.showEveryAddonAsIts`,`Show every addon as its own card`),children:e},e))})]}),d.isHub&&a(`div`,{className:`flex items-center gap-1.5`,children:[l(b,{className:`h-3 w-3 text-foreground-subtle`}),l(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`admin.system.addons.autoUpdate`,`Auto-Update:`)}),l(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`off`,`latest`,`beta`].map(e=>l(`button`,{type:`button`,onClick:()=>N.mutate({channel:e}),disabled:N.isPending,className:`px-2 py-1 transition-colors capitalize ${M?.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))})]}),d.isHub&&a(`div`,{className:`flex items-center gap-1.5`,children:[l(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`admin.system.addons.checkEvery`,`Check every:`)}),l(`select`,{className:`rounded-md border border-border bg-transparent px-1.5 py-1 text-[10px] font-medium text-foreground-subtle`,value:M?.updateCheckIntervalSeconds??21600,disabled:P.isPending||M===void 0,onChange:e=>{M!==void 0&&P.mutate({channel:M.channel,updateCheckIntervalSeconds:Number(e.target.value)})},children:ft.map(e=>l(`option`,{value:e.seconds,children:e.label},e.seconds))})]}),te>0&&a(`button`,{type:`button`,onClick:()=>void V(),disabled:L.isPending,className:`flex items-center gap-1 px-2 py-1 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:[L.isPending?l(E,{className:`w-3 h-3 animate-spin`}):l(f,{className:`w-3 h-3`}),L.isPending?h(`admin.system.addons.updating`,`Updating…`):h(`admin.system.addons.updateAll`,`Update All ({{nonSystemUpdateCount}})`,{nonSystemUpdateCount:te})]}),a(`button`,{type:`button`,onClick:p,disabled:m||L.isPending,className:`flex items-center gap-1 px-2 py-1 text-[11px] rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,children:[l(b,{className:`w-3 h-3 ${m?`animate-spin`:``}`}),h(`common.refresh`,`Refresh`)]})]}),a(`div`,{className:`flex flex-wrap items-center gap-1.5`,role:`group`,"aria-label":h(`admin.system.addons.filterInstalledAddons`,`Filter installed addons`),children:[l(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`admin.system.addons.filter`,`Filter:`)}),[{id:`updatable`,label:h(`admin.system.addons.updatable`,`Updatable`),pressed:Z,toggle:()=>Ee(!Z)},{id:`error`,label:h(`admin.system.addons.inError`,`In error ({{count}})`,{count:Ae}),pressed:Te,toggle:()=>Oe(!Te)},{id:`npm`,label:`npm`,pressed:Q===`npm`,toggle:()=>ke(Q===`npm`?null:`npm`)},{id:`dev`,label:h(`admin.system.addons.dev`,`Dev`),pressed:Q===`dev`,toggle:()=>ke(Q===`dev`?null:`dev`)}].map(e=>l(`button`,{type:`button`,"aria-pressed":e.pressed,onClick:e.toggle,className:e.pressed?ut:dt,children:e.label},e.id))]}),a(`div`,{className:`flex flex-col gap-1.5 sm:flex-row sm:items-center sm:gap-2`,children:[a(`div`,{className:`relative flex-1 min-w-0 sm:min-w-[200px]`,ref:T,children:[l(ce,{type:`text`,value:_,onChange:e=>{v(e.target.value),C(!0)},onFocus:()=>C(!0),placeholder:h(`admin.system.addons.searchAddonsOnNpm`,`Search addons on npm...`),"aria-label":h(`admin.system.addons.searchAddonsOnNpm2`,`Search addons on npm`),disabled:L.isPending,leftSlot:l(S,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),rightSlot:I?l(E,{className:`h-3 w-3 animate-spin`}):void 0}),x&&F&&F.length>0&&a(`div`,{className:`absolute left-0 right-0 top-full mt-1 z-40 rounded-md border border-border bg-surface shadow-xl overflow-hidden`,children:[F.length>0&&l(`div`,{className:`px-3 py-1.5 text-[10px] uppercase tracking-wide text-foreground-subtle border-b border-border`,children:h(`systemPage.addons.npmResults`,{count:F.length})}),F&&F.length>0&&l(`div`,{className:`max-h-72 overflow-auto divide-y divide-border`,children:F.map(e=>l(st,{addon:e,installing:H.isPending,onInstall:e=>H.mutate({packageName:e})},e.name))})]})]}),l(rt,{onUploadSuccess:()=>{g.invalidateQueries({queryKey:[[`addons`]]}),p()}})]}),X&&a(`div`,{className:`flex items-center gap-2 px-2.5 py-1.5 rounded-md bg-primary/10 border border-primary/30 text-xs`,children:[l(`span`,{className:`text-foreground-subtle`,children:h(`admin.system.addons.filteringByCapability`,`Filtering by capability:`)}),l(`span`,{className:`font-mono text-primary font-semibold`,children:X}),l(`button`,{type:`button`,onClick:Ne,className:`ml-auto text-xs text-foreground-subtle hover:text-foreground underline`,children:h(`admin.system.addons.clear`,`Clear`)})]}),X&&l(ct,{capability:X,installing:H.isPending,onInstall:e=>H.mutate({packageName:e})}),X&&je.length>0&&l(`h2`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:h(`admin.system.addons.installed`,`Installed`)}),ge&&a(`div`,{className:`fixed top-[calc(env(safe-area-inset-top)+1rem)] right-[calc(env(safe-area-inset-right)+1rem)] 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:[l(w,{className:`w-4 h-4 shrink-0 mt-0.5 text-green-400`}),a(`div`,{children:[l(`div`,{className:`text-[11px] font-semibold text-foreground`,children:h(`admin.system.addons.bulkUpdateCompleted`,`Bulk update completed`)}),l(`div`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:h(`admin.system.addons.systemPackagesUpdatedHubRestarted`,`System packages updated — hub restarted successfully.`)})]})]}),je.length===0&&l(`div`,{className:`text-xs text-foreground-subtle`,children:e.length===0?h(`admin.system.addons.noAddonsInstalled`,`No addons installed`):X?h(`admin.system.addons.noInstalledAddonDeclaresThe`,`No installed addon declares the "{{capabilityFilter}}" capability. Any addon you can install appears under "Available to install" above.`,{capabilityFilter:X}):h(`admin.system.addons.noAddonsCompatibleWithPlacement`,`No addons compatible with {{name}} (placement filter active)`,{name:d.name})}),l(`div`,{className:`space-y-1.5`,children:Ie.map(e=>{let t=$(e)?e.bundle.packageName:e.manifest.packageName,n=ee.get(t),r=$(e)?e.representative:e,i=n?e=>ue.mutate({name:t,version:e,nodeId:d.id}):void 0,a=de.get(t)??null,s=a!==null&&Me(a);return l(tt,{addon:r,clusterStatus:o?.[r.manifest.id],bundle:$(e)?e.bundle:void 0,availableUpdate:n,isUpdating:ne.has(t)||s,jobProgress:a,onUpdate:i,disabledByBulk:L.isPending,selectedNode:d},$(e)?t:e.manifest.id)})})]})}function xt(){let{t:e}=J(),n=s(),{data:r}=se(void 0),{nodes:i}=G(),{selection:o,selectNode:u,requestedNodeId:d}=Ee(i.length>0?i:[ht]),f=o.node??ht,p=f.id,m=i.length>0?o.staleNodeId:null,{data:h,isLoading:g,isError:_}=W({nodeId:p}),v=I(),y=F(),x=v.isPending||y.isPending,S=async()=>{await v.mutateAsync({nodeId:p}),await y.mutateAsync(),n.invalidateQueries({queryKey:[[`addons`]]})},C=c(v);C.current=v;let w=c(d??`hub`);t(()=>{C.current.mutate({nodeId:w.current})},[]);let T=(h??[]).map(vt).filter(e=>e!==null);return a(Z,{children:[a(`div`,{className:`flex items-center justify-between gap-2 flex-wrap`,children:[l(B,{selectedNodeId:p,onSelect:u}),a(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[!g&&!_&&l(`span`,{className:`text-[10px] rounded-full bg-primary/10 text-primary px-2 py-0.5 font-medium`,children:e(`systemPage.addons.installedCount`,{count:T.length})}),a(`button`,{type:`button`,onClick:()=>void S(),disabled:x,className:`inline-flex items-center gap-1 px-2 py-1 text-[11px] rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,title:e(`admin.system.addons.reFetchAddonsCheckNpm`,`Re-fetch addons + check npm for new versions`),children:[l(b,{className:`w-3 h-3 ${x?`animate-spin`:``}`}),e(`admin.system.addons.checkForUpdates`,`Check for updates`)]})]})]}),l(Q,{staleNodeId:m,shownNodeName:f.name}),l(ot,{selectedNode:f}),g&&l(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:e(`common.loading`,`Loading…`)}),_&&l(`div`,{className:`text-xs text-danger`,children:e(`admin.system.addons.failedToLoadAddons`,`Failed to load addons`)}),!g&&!_&&l(bt,{addons:T,clusterStatus:r,selectedNode:f,onRefresh:()=>void S(),isRefreshing:x})]})}export{xt as AddonsPage};