@camstack/addon-admin-ui 1.2.459 → 1.2.461

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 (152) hide show
  1. package/dist/assets/{AddonAssetIcon-BJEJ1k08.js → AddonAssetIcon-CmEqgzfX.js} +1 -1
  2. package/dist/assets/Addons-CVkkdf3V.js +4 -0
  3. package/dist/assets/{AdminPage-COkr2pSl.js → AdminPage-N36spL8r.js} +1 -1
  4. package/dist/assets/{AdminSectionedPage-DacqZ038.js → AdminSectionedPage-B4DO1cch.js} +1 -1
  5. package/dist/assets/AiProfiles-Dm1A5qaJ.js +3 -0
  6. package/dist/assets/BrokerForm-BDBUNSWe.js +1 -0
  7. package/dist/assets/Build-Btk8hgSX.js +40 -0
  8. package/dist/assets/Calendars-C4GvODYM.js +1 -0
  9. package/dist/assets/{Cluster-9x8btsN4.js → Cluster-CUaBA2On.js} +1 -1
  10. package/dist/assets/CompositionEditor-Kq2kEnnh.js +1 -0
  11. package/dist/assets/CompositionEditorPage-D89-6PCw.js +1 -0
  12. package/dist/assets/Data-B49CFnpf.js +2 -0
  13. package/dist/assets/DeviceDetail-BPyZ6uyd.js +2 -0
  14. package/dist/assets/DeviceDoActionFields-zsHf4EON.js +1 -0
  15. package/dist/assets/Devices-DHWIbLrr.js +1 -0
  16. package/dist/assets/{EmbedPlayerPage-yV8Ghwca.js → EmbedPlayerPage-C3Riyl8J.js} +1 -1
  17. package/dist/assets/History-g1qlGuSi.js +1 -0
  18. package/dist/assets/Identity-DWlP85j-.js +1 -0
  19. package/dist/assets/IntegrationDetail-y7qRdb6V.js +1 -0
  20. package/dist/assets/IntegrationHub-D4VoDe9W.js +1 -0
  21. package/dist/assets/Integrations-ByoGCmDg.js +1 -0
  22. package/dist/assets/Integrations-YNiehsXN.js +1 -0
  23. package/dist/assets/Library-BF596aV_.js +1 -0
  24. package/dist/assets/Locations-CWErnyPW.js +3 -0
  25. package/dist/assets/{Logs--6yOXDdG.js → Logs-CQcRBcxc.js} +1 -1
  26. package/dist/assets/{MaskShapeCanvas-BFRANocL.js → MaskShapeCanvas-CBe03CMO.js} +1 -1
  27. package/dist/assets/{MotionZonesSettings-DAR1lGRc.js → MotionZonesSettings-Ci1jf-Mm.js} +1 -1
  28. package/dist/assets/MyAccess-DUFCQyd0.js +2 -0
  29. package/dist/assets/Network-CfC1bac2.js +1 -0
  30. package/dist/assets/NodeAddonsSettingsPanel-CxfoWry5.js +1 -0
  31. package/dist/assets/Notifications-BqYoqEfY.js +1 -0
  32. package/dist/assets/Pipeline-D8nt-Y81.js +1 -0
  33. package/dist/assets/{PrivacyMaskSettings-CFjaiNPa.js → PrivacyMaskSettings-DSh1TEIJ.js} +1 -1
  34. package/dist/assets/Recordings-D2QgV6gh.js +1 -0
  35. package/dist/assets/ScanNetworkModal-Ba_B2lf-.js +1 -0
  36. package/dist/assets/{SceneMonitorEditor-CtObZ92A.js → SceneMonitorEditor-Dn0NH3UY.js} +1 -1
  37. package/dist/assets/SessionsList-Bik0vNoP.js +2 -0
  38. package/dist/assets/Showroom-BFwRdZBU.js +1 -0
  39. package/dist/assets/System-DSqTdlP0.js +1 -0
  40. package/dist/assets/{Terminal-CfhgVSfX.js → Terminal-DviYZMzd.js} +3 -3
  41. package/dist/assets/{Viewer-DOy7SpD5.js → Viewer-BqGWuKOT.js} +1 -1
  42. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-FGBBI8DM.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-C-OpByVg.js} +1 -1
  43. package/dist/assets/{addon-icons-context-zSgVMYOT.js → addon-icons-context-Dk7L05cY.js} +1 -1
  44. package/dist/assets/{archive-CCdQLR92.js → archive-S-zO_vQF.js} +1 -1
  45. package/dist/assets/{authed-media-BnRlGkoA.js → authed-media-Cpc0v-lW.js} +1 -1
  46. package/dist/assets/{bell-off-CqtliYfE.js → bell-off-B0BNkY5Q.js} +1 -1
  47. package/dist/assets/{board-model-DcXa88Au.js → board-model-BLL_cD-z.js} +1 -1
  48. package/dist/assets/{boxes-DQn7OALq.js → boxes-B89A109J.js} +1 -1
  49. package/dist/assets/circle-slash-DtOy5nTT.js +1 -0
  50. package/dist/assets/client-B741nZQJ.js +358 -0
  51. package/dist/assets/{cloud-upload-Ds0DBFF4.js → cloud-upload-EnqEFlW5.js} +1 -1
  52. package/dist/assets/crop-BM88jjat.js +1 -0
  53. package/dist/assets/device-integration-icon-DpIPAgxb.js +1 -0
  54. package/dist/assets/device-picker-model-BIknMBUl.js +1 -0
  55. package/dist/assets/{dist-DGtsAF0e.js → dist-CnH0kuMY.js} +1 -1
  56. package/dist/assets/dist-xq0sTO1C.js +358 -0
  57. package/dist/assets/{eraser-CBhjXP5B.js → eraser-CTiJOqJH.js} +1 -1
  58. package/dist/assets/format-3n872UoD.js +1 -0
  59. package/dist/assets/{hard-drive-download-Bbqt0BU7.js → hard-drive-download-B-xmEXyG.js} +1 -1
  60. package/dist/assets/{hostInit-DYH0aGPp.js → hostInit-CGuLmCP7.js} +1 -1
  61. package/dist/assets/i18n-SRLxy4I7.js +1 -0
  62. package/dist/assets/{icons-CIAj8beD.js → icons-D1XGgPoq.js} +1 -1
  63. package/dist/assets/index-Av4-A8rY.js +4 -0
  64. package/dist/assets/index-DhkrLRVh.css +2 -0
  65. package/dist/assets/{key-BrmsyfQ2.js → key-BEqu-lXr.js} +1 -1
  66. package/dist/assets/{key-round-DupHhW0i.js → key-round-Bx5_IMpS.js} +1 -1
  67. package/dist/assets/{layers-jV4_DPMS.js → layers-Dl1ZfXjR.js} +1 -1
  68. package/dist/assets/linked-devices-model-7z16tmo3.js +1 -0
  69. package/dist/assets/{list-ordered-DOEvj-y0.js → list-ordered-Dgp6etRJ.js} +1 -1
  70. package/dist/assets/location-owned-usage-bGdU9_ER.js +1 -0
  71. package/dist/assets/{log-in-CcPfrqgr.js → log-in-D8cVgea3.js} +1 -1
  72. package/dist/assets/{memory-stick-q_w6rp-t.js → memory-stick-9OcSMd1G.js} +1 -1
  73. package/dist/assets/{message-square-plus-9n6eNHhb.js → message-square-plus-C4vA4iYJ.js} +1 -1
  74. package/dist/assets/{mf-entry-bootstrap-0-44ebd2c3.js → mf-entry-bootstrap-0-6251002a.js} +2 -2
  75. package/dist/assets/{mic-off-D8Z3zvJC.js → mic-off-3EqpKDCs.js} +1 -1
  76. package/dist/assets/{monitor-off-ChiwdYm2.js → monitor-off-BnrglR7J.js} +1 -1
  77. package/dist/assets/{monitor-smartphone-5A2YPeJg.js → monitor-smartphone-CjzyjUlp.js} +1 -1
  78. package/dist/assets/mount-BIknMBUl.js +1 -0
  79. package/dist/assets/{player-overlays-B2uKzPiF.js → player-overlays-C2qGnksg.js} +1 -1
  80. package/dist/assets/{recycle-lkNup4GK.js → recycle-tvZPZI99.js} +1 -1
  81. package/dist/assets/remoteEntry-C-4WYf0M.js +1 -0
  82. package/dist/assets/{scan-eye-CJpdZenM.js → scan-eye-6_8sPy1t.js} +1 -1
  83. package/dist/assets/{scissors-v8FUfmH0.js → scissors-BYLfeqTv.js} +1 -1
  84. package/dist/assets/{search-x-CJx173bU.js → search-x-CLjmzP4o.js} +1 -1
  85. package/dist/assets/{send-XYAWcADm.js → send-CcDHb3r4.js} +1 -1
  86. package/dist/assets/{settings-2-Bgu4fxha.js → settings-2-G-7M0you.js} +1 -1
  87. package/dist/assets/{speaker-ofUzLdUT.js → speaker-CaxICJfu.js} +1 -1
  88. package/dist/assets/src-D1steZEF.js +67 -0
  89. package/dist/assets/step-inspector-model-p9HUQGve.js +1 -0
  90. package/dist/assets/{timer-reset-D-5iU9l-.js → timer-reset-D0SmO8M1.js} +1 -1
  91. package/dist/assets/{ungroup-DD3pb37b.js → ungroup-BjWmPSAJ.js} +1 -1
  92. package/dist/assets/{unlink-xgj0DHXA.js → unlink-8CYYb6J2.js} +1 -1
  93. package/dist/assets/{usb-COQJ7FVk.js → usb-vxNmd1OO.js} +1 -1
  94. package/dist/assets/{use-scenes-feed-Cr8WJGCC.js → use-scenes-feed-BepTQeVo.js} +1 -1
  95. package/dist/assets/{use-stationary-objects-kiH5Q2gT.js → use-stationary-objects-Dnn6yNrY.js} +1 -1
  96. package/dist/assets/useEventInvalidation-BIknMBUl.js +1 -0
  97. package/dist/assets/useNodeUrlSelection-i_Uu58Pu.js +1 -0
  98. package/dist/assets/user-round-DD5YK-sO.js +1 -0
  99. package/dist/assets/{user-x-CBuwxTd8.js → user-x-_Ch_VgmF.js} +1 -1
  100. package/dist/assets/{video-CCbgIO_h.js → video-CnGFIENR.js} +1 -1
  101. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-CxTajz7L.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-sNr_TQNF.js} +2 -2
  102. package/dist/index.html +10 -11
  103. package/dist/server/addon.js +190 -91
  104. package/package.json +1 -1
  105. package/dist/assets/Addons-DHanUVT2.js +0 -4
  106. package/dist/assets/AiProfiles-00eup-gf.js +0 -3
  107. package/dist/assets/BrokerForm-BZXEvLK0.js +0 -1
  108. package/dist/assets/Build-C-5lgbq3.js +0 -40
  109. package/dist/assets/Calendars-BkpP1D2U.js +0 -1
  110. package/dist/assets/CompositionEditor-r0DF2l8O.js +0 -1
  111. package/dist/assets/CompositionEditorPage-ZgZUzIco.js +0 -1
  112. package/dist/assets/Data-CRUK3PE2.js +0 -2
  113. package/dist/assets/DeviceDetail-B-WDYuF4.js +0 -2
  114. package/dist/assets/DeviceDoActionFields-B6h8uYuA.js +0 -1
  115. package/dist/assets/Devices--JO66DyO.js +0 -1
  116. package/dist/assets/History-BwlSzH55.js +0 -1
  117. package/dist/assets/Identity-BWhaEMdv.js +0 -1
  118. package/dist/assets/IntegrationDetail-CQTl55bJ.js +0 -1
  119. package/dist/assets/IntegrationHub-1t9XtENg.js +0 -1
  120. package/dist/assets/Integrations-BsHioywX.js +0 -1
  121. package/dist/assets/Integrations-DAZG8yCP.js +0 -1
  122. package/dist/assets/Library-I8I-H4B0.js +0 -1
  123. package/dist/assets/Locations-DpID1z6R.js +0 -3
  124. package/dist/assets/MyAccess-BlPaAQNJ.js +0 -2
  125. package/dist/assets/Network-68PrEWb3.js +0 -1
  126. package/dist/assets/NodeAddonsSettingsPanel-BU9D0unj.js +0 -1
  127. package/dist/assets/Notifications-BHMdjbhb.js +0 -1
  128. package/dist/assets/Pipeline-BntRM_Gg.js +0 -1
  129. package/dist/assets/Recordings-B0PFCiE6.js +0 -1
  130. package/dist/assets/ScanNetworkModal-KVlo34E_.js +0 -1
  131. package/dist/assets/SessionsList-BqQzJQzH.js +0 -2
  132. package/dist/assets/Showroom-BpbWCBms.js +0 -1
  133. package/dist/assets/System-Bi2UJjp7.js +0 -1
  134. package/dist/assets/circle-slash-BqXxDfpK.js +0 -1
  135. package/dist/assets/client-DUabg_ow.js +0 -358
  136. package/dist/assets/crop-Cfvx74Ee.js +0 -1
  137. package/dist/assets/device-integration-icon-Bb8AOXEF.js +0 -1
  138. package/dist/assets/device-picker-model-BtgtDdnV.js +0 -1
  139. package/dist/assets/dist-BgJn1_Ws.js +0 -358
  140. package/dist/assets/i18n-aZ2iCAl5.js +0 -1
  141. package/dist/assets/index-DKfAHLRf.js +0 -4
  142. package/dist/assets/index-I9On1g0c.css +0 -2
  143. package/dist/assets/linked-devices-model-Wflvd004.js +0 -1
  144. package/dist/assets/location-owned-usage-D3Zl9d5o.js +0 -1
  145. package/dist/assets/mount-BtgtDdnV.js +0 -1
  146. package/dist/assets/notification-schedule-field-BGziM8ff.js +0 -1
  147. package/dist/assets/remoteEntry-DwoMnkvg.js +0 -1
  148. package/dist/assets/src-N0x0aMoc.js +0 -67
  149. package/dist/assets/step-inspector-model-C7JCmVfz.js +0 -1
  150. package/dist/assets/useEventInvalidation-BtgtDdnV.js +0 -1
  151. package/dist/assets/useNodeUrlSelection-DpqDFKVD.js +0 -1
  152. package/dist/assets/user-round-Dy1LJO0f.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-fDPduoeC.mjs
3
+ //#region ../types/dist/event-category-Ceif8n-v.mjs
4
4
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
5
5
  EventCategory["SystemBoot"] = "system.boot";
6
6
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -472,6 +472,10 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
472
472
  * on the device detail page.
473
473
  */
474
474
  EventCategory["DoorbellOnPressed"] = "doorbell.onPressed";
475
+ /** Mirrors `runningStateCapability.events.onStarted`. */
476
+ EventCategory["RunningStarted"] = "running.started";
477
+ /** Mirrors `runningStateCapability.events.onFinished`. */
478
+ EventCategory["RunningFinished"] = "running.finished";
475
479
  /**
476
480
  * Cap event fired by every device that registers the `event-emitter`
477
481
  * capability. Mirrors `eventEmitterCapability.events.onEvent`. Carries
@@ -5431,7 +5435,7 @@ var ZodIssueCode = {
5431
5435
  var ZodFirstPartyTypeKind;
5432
5436
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5433
5437
  //#endregion
5434
- //#region ../types/dist/sleep-CHIEEJkY.mjs
5438
+ //#region ../types/dist/sleep-CYfIZzGv.mjs
5435
5439
  /**
5436
5440
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5437
5441
  * window to float samples (D455).
@@ -5770,7 +5774,7 @@ Object.fromEntries([
5770
5774
  * `hydrateSchema` to skip the `value` injection for structural-only fields.
5771
5775
  */
5772
5776
  function isValuelessField(field) {
5773
- return field.type === "separator" || field.type === "info" || field.type === "qr-code" || field.type === "button" || field.type === "object-array" || field.type === "widget" || field.type === "addon-action-button" || field.type === "device-action-button";
5777
+ return field.type === "separator" || field.type === "info" || field.type === "qr-code" || field.type === "button" || field.type === "object-array" || field.type === "widget" || field.type === "addon-action-button" || field.type === "device-action-button" || field.type === "account-sign-in" || field.type === "secret-presence";
5774
5778
  }
5775
5779
  function hydrateSchema(schema, values, options = {}) {
5776
5780
  return {
@@ -8749,7 +8753,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
8749
8753
  return DeviceRole;
8750
8754
  }({});
8751
8755
  //#endregion
8752
- //#region ../types/dist/composition-CB6PMT9p.mjs
8756
+ //#region ../types/dist/composition-BJ8iAZb3.mjs
8753
8757
  /**
8754
8758
  * The ffmpeg build every CamStack node downloads, per platform and arch.
8755
8759
  *
@@ -8809,7 +8813,7 @@ portable("linux64"), portable("linuxarm64"), portable("macarm64"), portable("mac
8809
8813
  * ONE table for everyone who asks "is this device HIGH?": the
8810
8814
  * recorder's `RecordingTriggers.sensorDeviceIds` trigger, the post-analysis
8811
8815
  * sensor markers, the orchestrator's camera-sensors bridge and
8812
- * the sources of a composite doorbell (`doorbellFeatureSources`, D671).
8816
+ * the sources of a pulse (`compilePulseOverride`, D936).
8813
8817
  * A second copy would diverge at the first cap added, and the symptom — "the
8814
8818
  * sensor rings the doorbell but does not record" — is exactly D62.
8815
8819
  *
@@ -9050,6 +9054,20 @@ var table = {
9050
9054
  apply: () => {
9051
9055
  throw new ExpressionEvalError("count: stateful evaluation context is required");
9052
9056
  }
9057
+ },
9058
+ dwell: {
9059
+ minArgs: 3,
9060
+ maxArgs: 3,
9061
+ apply: () => {
9062
+ throw new ExpressionEvalError("dwell: stateful evaluation context is required");
9063
+ }
9064
+ },
9065
+ latchedAt: {
9066
+ minArgs: 1,
9067
+ maxArgs: 1,
9068
+ apply: () => {
9069
+ throw new ExpressionEvalError("latchedAt: stateful evaluation context is required");
9070
+ }
9053
9071
  }
9054
9072
  };
9055
9073
  Object.freeze(Object.assign(Object.create(null), table));
@@ -15893,7 +15911,15 @@ Object.freeze({
15893
15911
  kind: "fixed",
15894
15912
  result: ["number", "null"]
15895
15913
  },
15896
- count: NUMBER
15914
+ count: NUMBER,
15915
+ dwell: {
15916
+ kind: "fixed",
15917
+ result: ["boolean", "null"]
15918
+ },
15919
+ latchedAt: {
15920
+ kind: "fixed",
15921
+ result: ["number", "null"]
15922
+ }
15897
15923
  });
15898
15924
  `${COMPOSED_DEVICE_STABLE_ID_PREFIX}`;
15899
15925
  /**
@@ -42087,9 +42113,6 @@ var NcSystemEventKindSchema = _enum([
42087
42113
  "device-battery-normal",
42088
42114
  "device-consumable-low",
42089
42115
  "device-consumable-normal",
42090
- "device-tank-low",
42091
- "device-tank-full",
42092
- "device-tank-normal",
42093
42116
  "stream-online",
42094
42117
  "stream-offline",
42095
42118
  "node-online",
@@ -42136,13 +42159,14 @@ var NcSystemEventKindSchema = _enum([
42136
42159
  "camera-enabled"
42137
42160
  ]);
42138
42161
  /** The legacy tail of {@link NcSystemEventKindSchema} — see its docblock. */
42139
- var NC_LEGACY_SYSTEM_EVENT_KINDS = new Set([
42162
+ var NC_LEGACY_SYSTEM_EVENT_KINDS = [
42140
42163
  "camera-online",
42141
42164
  "camera-offline",
42142
42165
  "camera-disabled",
42143
42166
  "camera-enabled"
42144
- ]);
42145
- NcSystemEventKindSchema.options.filter((kind) => !NC_LEGACY_SYSTEM_EVENT_KINDS.has(kind));
42167
+ ];
42168
+ var NC_LEGACY_SYSTEM_EVENT_KIND_SET = new Set(NC_LEGACY_SYSTEM_EVENT_KINDS);
42169
+ NcSystemEventKindSchema.options.filter((kind) => !NC_LEGACY_SYSTEM_EVENT_KIND_SET.has(kind));
42146
42170
  /**
42147
42171
  * The panel's transitions, as ONE list.
42148
42172
  *
@@ -43261,18 +43285,11 @@ var NcRuleSchema = NcRuleInputSchema.extend({
43261
43285
  */
43262
43286
  disabledTargetIds: array(string()).default([])
43263
43287
  });
43264
- /**
43265
- * The state-summary SECTIONS (D647 / D698 / D708): the D637 kind groups that
43266
- * report a still-true state. `addons` is the crash-looped addons only and
43267
- * `addon-updates` the addons that are behind (D708 split them). `backups-exports` and `alarm` are not sections — a completed
43268
- * job is not an open state, and the alarm stays instant.
43269
- */
43270
43288
  var NcStateSummarySectionIdSchema = _enum([
43271
43289
  "device-state",
43272
43290
  "streams",
43273
43291
  "battery",
43274
43292
  "consumables",
43275
- "tanks",
43276
43293
  "detection-blind",
43277
43294
  "nodes",
43278
43295
  "addons",
@@ -53636,7 +53653,8 @@ var BatteryStatusSchema = object({
53636
53653
  */
53637
53654
  binary: boolean().optional()
53638
53655
  });
53639
- DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, method(object({
53656
+ DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat;
53657
+ method(object({
53640
53658
  deviceId: number(),
53641
53659
  /** Bound on the wait. Sensible range 3000–10000ms. */
53642
53660
  timeoutMs: number().int().min(500).max(3e4).default(8e3)
@@ -54345,6 +54363,7 @@ var ConsumablesStatusSchema = object({
54345
54363
  })),
54346
54364
  lastChangedAt: number()
54347
54365
  });
54366
+ Object.values(DeviceType), [...ConsumableRemainingUnitSchema.options], [...ConsumableStatusSchema.options], [...ConsumableKindSchema.options], [...ConsumableFormSchema.options];
54348
54367
  Object.values(DeviceType), method(object({
54349
54368
  deviceId: number().int().nonnegative(),
54350
54369
  key: string().min(1)
@@ -54816,6 +54835,7 @@ DeviceType.Dishwasher, method(object({
54816
54835
  kind: "mutation",
54817
54836
  auth: "protected"
54818
54837
  }), method(object({ deviceId: DeviceIdSchema }), DishwasherOptionsSchema, { auth: "protected" });
54838
+ DeviceType.Camera;
54819
54839
  object({
54820
54840
  /** Ms epoch of the last press. null = never observed since this provider started. */
54821
54841
  lastPressedAt: number().nullable(),
@@ -56608,6 +56628,7 @@ authKey: string().optional() }), object({
56608
56628
  /** Human-readable error when `ok: false`. */
56609
56629
  error: string().optional()
56610
56630
  }), { kind: "mutation" });
56631
+ DeviceType.Camera;
56611
56632
  object({
56612
56633
  detected: boolean(),
56613
56634
  /** Ms epoch of the last detected-true observation. Null if never detected. */
@@ -58671,6 +58692,24 @@ DeviceType.Camera, method(object({ deviceId: number() }), PtzAutotrackStatusSche
58671
58692
  deviceId: number(),
58672
58693
  status: PtzAutotrackStatusSchema
58673
58694
  });
58695
+ var RunningStateSourceSchema = _enum(["native", "assigned"]);
58696
+ object({
58697
+ /** null = unknown — never coerced to false (D393). */
58698
+ running: boolean().nullable(),
58699
+ /** Epoch ms the current boolean began; null while `running` is null. */
58700
+ since: number().nullable(),
58701
+ source: RunningStateSourceSchema,
58702
+ phase: string().nullable(),
58703
+ /** null until a reading has been published (D393). */
58704
+ lastFetchedAt: number().nullable()
58705
+ });
58706
+ object({
58707
+ deviceId: number(),
58708
+ since: number().nullable(),
58709
+ phase: string().nullable()
58710
+ });
58711
+ Object.values(DeviceType);
58712
+ DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder;
58674
58713
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
58675
58714
  kind: "mutation",
58676
58715
  auth: "admin"
@@ -69965,6 +70004,13 @@ Object.freeze({
69965
70004
  access: "create",
69966
70005
  role: "admin"
69967
70006
  },
70007
+ "runningState.getStatus": {
70008
+ capName: "running-state",
70009
+ capScope: "device",
70010
+ addonId: null,
70011
+ access: "view",
70012
+ role: "viewer"
70013
+ },
69968
70014
  "sceneMonitor.captureReference": {
69969
70015
  capName: "scene-monitor",
69970
70016
  capScope: "device",
@@ -74679,6 +74725,32 @@ var APPLIANCE_CAP_VOCABULARY = {
74679
74725
  }],
74680
74726
  events: { onSent: { notOperatorFacing: "a delivery receipt of a send this system made — not a fact about the world" } }
74681
74727
  },
74728
+ "running-state": {
74729
+ scope: "device",
74730
+ noun: t("Running", "In funzione"),
74731
+ state: [{
74732
+ kind: "boolean",
74733
+ field: "running",
74734
+ label: t("Running", "In funzione"),
74735
+ whenTrue: t("When {device} starts", "Quando {device} inizia"),
74736
+ whenFalse: t("When {device} finishes", "Quando {device} finisce"),
74737
+ icon: "play"
74738
+ }],
74739
+ events: {
74740
+ onStarted: {
74741
+ category: EventCategory.RunningStarted,
74742
+ label: t("Started running", "Ha iniziato a funzionare"),
74743
+ phrase: t("When {device} starts running", "Quando {device} inizia a funzionare"),
74744
+ icon: "play"
74745
+ },
74746
+ onFinished: {
74747
+ category: EventCategory.RunningFinished,
74748
+ label: t("Finished", "Ha finito"),
74749
+ phrase: t("When {device} finishes", "Quando {device} finisce"),
74750
+ icon: "square"
74751
+ }
74752
+ }
74753
+ },
74682
74754
  update: {
74683
74755
  scope: "device",
74684
74756
  noun: t("Firmware update", "Aggiornamento firmware"),
@@ -78219,6 +78291,11 @@ Object.freeze({
78219
78291
  form: "single",
78220
78292
  optional: true
78221
78293
  }],
78294
+ "runningState.getStatus": [{
78295
+ name: "deviceId",
78296
+ form: "single",
78297
+ optional: false
78298
+ }],
78222
78299
  "sceneMonitor.captureReference": [{
78223
78300
  name: "deviceId",
78224
78301
  form: "single",
@@ -78717,6 +78794,96 @@ Object.freeze({
78717
78794
  "smtp-provider": "email"
78718
78795
  });
78719
78796
  DeviceType.Camera;
78797
+ DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.Dishwasher, DeviceType.Camera, DeviceType.Camera, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder;
78798
+ /**
78799
+ * A saved Customize assignment (D936). The schema is the type: callers use
78800
+ * `z.infer`, they do not restate the shape.
78801
+ */
78802
+ var OverrideSourceSchema = object({
78803
+ addonId: string().min(1),
78804
+ stableId: string().min(1),
78805
+ cap: string().min(1),
78806
+ fieldPath: string().min(1)
78807
+ });
78808
+ var CustomizeTransformDraftSchema = discriminatedUnion("kind", [
78809
+ object({ kind: literal("identity") }),
78810
+ object({ kind: literal("invert") }),
78811
+ object({
78812
+ kind: literal("threshold"),
78813
+ comparison: _enum(["gte", "lte"]),
78814
+ threshold: number(),
78815
+ startDwellMs: number().nonnegative(),
78816
+ stopDwellMs: number().nonnegative()
78817
+ }),
78818
+ object({
78819
+ kind: literal("linear"),
78820
+ scale: number(),
78821
+ offset: number(),
78822
+ clampMin: number().optional(),
78823
+ clampMax: number().optional()
78824
+ }),
78825
+ object({
78826
+ kind: literal("enum-map"),
78827
+ mapping: record(string(), string().nullable())
78828
+ }),
78829
+ object({ kind: literal("number") })
78830
+ ]);
78831
+ var ScalarOverrideDraftSchema = object({
78832
+ kind: literal("scalar"),
78833
+ cap: string().min(1),
78834
+ targetId: string().min(1),
78835
+ source: OverrideSourceSchema,
78836
+ transform: CustomizeTransformDraftSchema
78837
+ });
78838
+ var KeyedArrayOverrideDraftSchema = object({
78839
+ kind: literal("keyedArray"),
78840
+ cap: string().min(1),
78841
+ targetId: string().min(1),
78842
+ key: string().min(1),
78843
+ label: string().min(1),
78844
+ fieldPath: string().min(1),
78845
+ source: OverrideSourceSchema,
78846
+ transform: CustomizeTransformDraftSchema
78847
+ });
78848
+ var PulseOverrideDraftSchema = object({
78849
+ kind: literal("pulse"),
78850
+ cap: string().min(1),
78851
+ targetId: string().min(1),
78852
+ enabled: boolean(),
78853
+ debounceMs: number().nonnegative(),
78854
+ sources: array(OverrideSourceSchema).min(1)
78855
+ });
78856
+ var SpanSourceDraftSchema = OverrideSourceSchema.extend({ mode: _enum([
78857
+ "in-addition",
78858
+ "confirm",
78859
+ "replace"
78860
+ ]).optional() });
78861
+ discriminatedUnion("kind", [
78862
+ ScalarOverrideDraftSchema,
78863
+ KeyedArrayOverrideDraftSchema,
78864
+ PulseOverrideDraftSchema,
78865
+ object({
78866
+ kind: literal("span"),
78867
+ cap: string().min(1),
78868
+ targetId: string().min(1),
78869
+ timeoutMs: number().nonnegative(),
78870
+ cooldownMs: number().nonnegative().optional(),
78871
+ sources: array(SpanSourceDraftSchema)
78872
+ })
78873
+ ]);
78874
+ object({
78875
+ targetId: string().min(1),
78876
+ configured: boolean(),
78877
+ source: _enum(["native", "assigned"]),
78878
+ state: _enum([
78879
+ "active",
78880
+ "stale",
78881
+ "released",
78882
+ "unavailable"
78883
+ ]),
78884
+ reason: string().nullable()
78885
+ });
78886
+ String.raw`rose\(active(\d+), changed(\d+), (\d+(?:\.\d+)?)\)`;
78720
78887
  var G711_SCALE_CORRECTION_DB = {
78721
78888
  PCMU: 20 * Math.log10(4),
78722
78889
  PCMA: 20 * Math.log10(8)
@@ -78769,40 +78936,7 @@ var NC_AUDIO_DEFAULTS = {
78769
78936
  samplingSeconds: 10
78770
78937
  };
78771
78938
  new Set(["devices", "classes"]);
78772
- /**
78773
- * WHICH narrowing filter speaks about WHICH system-event kind — one predicate,
78774
- * consumed by the rule ENGINE and by every rule EDITOR.
78775
- *
78776
- * ── The failure this file exists for ───────────────────────────────────────
78777
- * `NcSystemEventConditionSchema` carries four optional narrowing lists
78778
- * (`deviceIds`, `deviceTypes`, `nodeIds`, `packageNames`) beside a required
78779
- * `kinds` gate. They are not four filters over one vocabulary: each belongs to
78780
- * a FAMILY of kinds and is meaningless outside it. A node going away has no
78781
- * device type; a completed export has no package; `stream-offline` deliberately
78782
- * carries no device type at all (a stream belongs to a camera by construction).
78783
- *
78784
- * The engine applied all four to every kind, so a filter from one family failed
78785
- * a kind from another family CLOSED. The operator's live rule "Eventi di
78786
- * sistema" selected eleven kinds and set `deviceTypes: ['camera']` — the only
78787
- * way to say "only my cameras" about the two liveness kinds — and NINE of the
78788
- * eleven silently stopped being deliverable. Four days of history contained
78789
- * `device-online` and `device-offline` and nothing else, across a window in
78790
- * which agents were restarted and addons were updated.
78791
- *
78792
- * Both editors already computed this scoping, to decide which filter boxes to
78793
- * render; the cap's own docblock already promised it ("Narrow a `device-*` kind
78794
- * to these device TYPES"). Only the engine disagreed, and it disagreed in the
78795
- * destructive direction. So the rule is stated ONCE, here, and the engine and
78796
- * the editors are readers of it rather than three independent authors.
78797
- *
78798
- * ── The direction ─────────────────────────────────────────────────────────
78799
- * Out of family ⇒ the filter is IGNORED, never fail-closed. An editor that
78800
- * hides a box has already told the operator this filter does not speak about
78801
- * these kinds, so honouring it as an exclusion contradicts the only
78802
- * explanation the operator was ever given. Inside its family the filter still
78803
- * narrows, and still fails CLOSED on a subject that cannot produce the identity
78804
- * it tests (a device the mirror cannot name is not evidence of a camera).
78805
- */
78939
+ new Set(NC_LEGACY_SYSTEM_EVENT_KINDS);
78806
78940
  /**
78807
78941
  * Every filter, for the callers that must cover all of them (guards, tests).
78808
78942
  *
@@ -78828,9 +78962,6 @@ new Map(Object.entries({
78828
78962
  "device-battery-normal": "device-events",
78829
78963
  "device-consumable-low": "device-events",
78830
78964
  "device-consumable-normal": "device-events",
78831
- "device-tank-low": "device-events",
78832
- "device-tank-full": "device-events",
78833
- "device-tank-normal": "device-events",
78834
78965
  "stream-online": "device-events",
78835
78966
  "stream-offline": "device-events",
78836
78967
  "detection-blind": "device-events",
@@ -78907,16 +79038,6 @@ var NC_SYSTEM_EVENT_KIND_GROUP_SPECS = [
78907
79038
  label: "Consumables",
78908
79039
  kinds: ["device-consumable-low", "device-consumable-normal"]
78909
79040
  },
78910
- {
78911
- id: "tanks",
78912
- family: "device-events",
78913
- label: "Tanks",
78914
- kinds: [
78915
- "device-tank-low",
78916
- "device-tank-full",
78917
- "device-tank-normal"
78918
- ]
78919
- },
78920
79041
  {
78921
79042
  id: "detection-blind",
78922
79043
  family: "device-events",
@@ -79074,11 +79195,6 @@ var RULE_BODY_ONLY = ["body"];
79074
79195
  var RULE_TEXT = ["title", "body"];
79075
79196
  var BATTERY = ["device-battery-low", "device-battery-normal"];
79076
79197
  var CONSUMABLE = ["device-consumable-low", "device-consumable-normal"];
79077
- var TANK = [
79078
- "device-tank-low",
79079
- "device-tank-full",
79080
- "device-tank-normal"
79081
- ];
79082
79198
  var ALERT_EPISODE = [
79083
79199
  "alert-critical",
79084
79200
  "alert-error",
@@ -79110,7 +79226,6 @@ var DEVICE_EVENTS = [
79110
79226
  "device-enabled",
79111
79227
  ...BATTERY,
79112
79228
  ...CONSUMABLE,
79113
- ...TANK,
79114
79229
  "stream-online",
79115
79230
  "stream-offline",
79116
79231
  "detection-blind",
@@ -79156,12 +79271,6 @@ var STATE_SUMMARY_SECTION_VARS = [
79156
79271
  example: "Robot — filter 10 %",
79157
79272
  kinds: CONSUMABLE
79158
79273
  },
79159
- {
79160
- name: "summaryTanks",
79161
- label: "Summary: tanks",
79162
- example: "Robot — clean water low",
79163
- kinds: TANK
79164
- },
79165
79274
  {
79166
79275
  name: "summaryDetection",
79167
79276
  label: "Summary: cameras detecting nothing",
@@ -79277,8 +79386,7 @@ var STATE_SUMMARY_VARS = [
79277
79386
  ([...RULE_TEXT], [...COMBINED_ALARM]),
79278
79387
  ([...RULE_TEXT], [...DEVICE_EVENTS]),
79279
79388
  ([...RULE_TEXT], [...BATTERY, ...CONSUMABLE]),
79280
- ([...RULE_TEXT], [...CONSUMABLE, ...TANK]),
79281
- ([...RULE_TEXT], [...TANK]),
79389
+ ([...RULE_TEXT], [...CONSUMABLE]),
79282
79390
  [...RULE_TEXT],
79283
79391
  ([...RULE_TEXT], [...UPDATES, ...ALERT_EPISODE]),
79284
79392
  ([...RULE_TEXT], [...UPDATES, ...ALERT_EPISODE]),
@@ -79382,15 +79490,6 @@ new Map([
79382
79490
  snapshotLabel: "Consumables low now",
79383
79491
  snapshotSection: "consumables"
79384
79492
  },
79385
- {
79386
- id: "tanks",
79387
- family: "device-events",
79388
- label: "Tanks (low or full / back to normal)",
79389
- bad: ["device-tank-low", "device-tank-full"],
79390
- recovery: ["device-tank-normal"],
79391
- snapshotLabel: "Tanks low or full now",
79392
- snapshotSection: "tanks"
79393
- },
79394
79493
  {
79395
79494
  id: "motion-noise",
79396
79495
  family: "device-events",
@@ -79997,7 +80096,7 @@ var AdminUIAddon = class extends BaseAddon {
79997
80096
  capability: adminUiCapability,
79998
80097
  provider: {
79999
80098
  getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
80000
- getVersion: async () => ({ version: "1.2.459" })
80099
+ getVersion: async () => ({ version: "1.2.461" })
80001
80100
  }
80002
80101
  }];
80003
80102
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-admin-ui",
3
- "version": "1.2.459",
3
+ "version": "1.2.461",
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{It as d,Nt as f,Ot as p,Q as m,Rn as h,Si as g,Tn as _,Wr as v,ai as y,bn as b,dt as x,fn as S,kn as C,or as w,pi as ee,pn as te,tn as T,un as E,vi as ne,xi as re}from"./player-overlays-B2uKzPiF.js";import{Xi as D}from"./client-DUabg_ow.js";import{i as O,l as ie}from"./video-CCbgIO_h.js";import{$n as ae,Ar as k,Ct as oe,Jt as se,Ju as ce,Nu as le,Ps as A,Qn as ue,Qr as de,Rr as j,Yt as M,Zu as N,_i as fe,ai as pe,bi as P,ci as F,di as I,ei as L,er as R,fi as me,gi as z,hi as B,hr as he,ii as ge,ir as _e,kr as V,li as H,mi as ve,mt as U,ni as ye,nr as be,oi as W,ri as xe,rr as Se,ti as G,ui as Ce,xi as we,yi as K}from"./src-N0x0aMoc.js";import{t as q}from"./useTranslation-D3Is_4B6.js";import"./mount-BtgtDdnV.js";import{Z as J,et as Y,nt as Te}from"./index-DKfAHLRf.js";import{t as X}from"./AdminPage-COkr2pSl.js";import{t as Ee}from"./NodeAddonsSettingsPanel-BU9D0unj.js";import{n as Z,t as De}from"./useNodeUrlSelection-DpqDFKVD.js";function Oe(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 ke={queued:{icon:y,bg:`bg-muted text-foreground-subtle`,labelKey:`addons.addonRowBadge.queued`},updating:{icon:w,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:g,bg:`bg-success/10 text-success`,labelKey:`addons.addonRowBadge.done`},failed:{icon:O,bg:`bg-danger/10 text-danger`,labelKey:`addons.addonRowBadge.failed`}};function Ae({item:e}){let{t}=q(),n=ke[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 je=new Set([`completed`,`failed`,`partially-failed`,`cancelled`]),Q=new Set([`done`,`failed`,`skipped`]);function Me(e){return!Q.has(e.phase)&&!je.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=je.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}=N(D.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:y,cls:`bg-muted text-foreground-subtle`,labelKey:`addons.jobProgress.queued`},fetching:{icon:w,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.fetching`,spin:!0},staged:{icon:w,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.staged`,spin:!0},validating:{icon:w,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.validating`,spin:!0},applying:{icon:w,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.applying`,spin:!0},restarting:{icon:w,cls:`bg-amber-500/10 text-amber-600 dark:text-amber-400`,labelKey:`addons.jobProgress.restarting`,spin:!0},applied:{icon:w,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.finalizing`,spin:!0},done:{icon:g,cls:`bg-success/10 text-success`,labelKey:`addons.jobProgress.updated`},failed:{icon:O,cls:`bg-danger/10 text-danger`,labelKey:`addons.jobProgress.failed`},skipped:{icon:T,cls:`bg-muted text-foreground-subtle`,labelKey:`addons.jobProgress.skipped`}};function Ie({progress:e}){let{t}=q(),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}=q(),c=s(),u=k(),f=V(),p=F(Ue,{staleTime:We}),m=p.data?.installations??[],h=(p.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=P({onSettled:()=>{c.invalidateQueries({queryKey:[[`addons`]]}),c.invalidateQueries({queryKey:[[`addonPages`]]}),c.invalidateQueries({queryKey:[[`capabilities`]]}),c.invalidateQueries({queryKey:[[`nodes`]]})}}),y=async e=>{await f({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 f({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 p.refetch()).data;if(n===void 0){await f({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(d,{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(ie,{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}=q(),d=n===`upload`||n===`local`,{data:f,isLoading:m}=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`})})]}),d&&a(`div`,{className:`flex items-start gap-2 px-3 py-2 border-b border-border bg-cyan-500/10 text-[10px]`,children:[l(p,{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(J,{i18nKey:`addons.versionPicker.reinstall`,values:{version:t},components:{mono:l(`span`,{className:`font-mono`})}})]})]}),m&&a(`div`,{className:`flex items-center justify-center gap-2 py-6 text-[10px] text-foreground-subtle`,children:[l(w,{className:`h-3.5 w-3.5 animate-spin`}),u(`addons.versionPicker.loadingVersions`,`Loading versions...`)]}),f&&l(`div`,{className:`max-h-64 overflow-auto divide-y divide-border`,children:f.map(e=>{let n=e.version===t,i=s!==void 0&&e.version===c,d=/-(alpha|beta|rc|dev|canary|next)/i.test(e.version),f=a(o,{children:[l(`span`,{className:`font-mono flex-1 text-left ${n?`text-primary font-semibold`:d?`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:[f,i?l(g,{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:[f,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(v,{className:`h-3 w-3`})})]},e.version)})}),f&&f.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?m(`/api/addon-assets/${n}/${i}`):null,g=!!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:g?l(`img`,{src:f,alt:n,className:`h-4 w-4`,onError:()=>c(!0)}):l(e?h:_,{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(p,{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}=q();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(w,{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(v,{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(re,{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(re,{className:`h-3 w-3 opacity-50`})]}),u]})}function $e({addonId:e}){let t=s(),{data:n=`inherit`}=G({addonId:e}),r=z({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:g,disabledByBulk:_,isSystem:v,selectedNode:y}){let{t:S}=q(),[w,ee]=r(!1),[T,D]=r(!1),[ie,k]=r(!1),[ce,le]=r(null);t(()=>{le(null)},[u]);let A=ce??u,[de,j]=r(!1),[N,fe]=r(!1),[P,F]=r(`logs`),I=s(),L=Y(),{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,ye=m?.version??z.packageVersion??z.version,W=m?.installSource??e.installSource,xe=m?m.bundle?.description??m.addons[0]?.manifest.description:z.description,G=me({onSuccess:()=>{I.invalidateQueries({queryKey:[[`addons`]]})}}),Ce=pe({onSuccess:()=>{I.invalidateQueries({queryKey:[[`addons`]]}),I.invalidateQueries({queryKey:[[`addonPages`]]}),I.invalidateQueries({queryKey:[[`capabilities`]]}),I.invalidateQueries({queryKey:[[`integrations`]]})}}),we=ve({onSuccess:()=>{I.invalidateQueries({queryKey:[[`addons`]]}),I.invalidateQueries({queryKey:[[`alerts`]]})}}),K=e.health,J=K?.phase===`failed`&&!K.inGracePeriod,Te=J&&K?.nextRetryAt&&!K.retrying,X=Oe(e.process);return a(`div`,{className:`rounded-md border bg-surface overflow-hidden ${J?`border-red-500/50`:`border-border`}`,children:[J&&K&&a(`div`,{className:`bg-danger/10 border-b border-danger/30 px-3 py-2 flex items-start gap-2`,children:[l(O,{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:S(`addons.addonCard.failedToLoad`,{attempt:K.retryCount})}),l(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:K.lastError?.message??S(`addons.addonCard.unknownError`,`Unknown error`)}),Te&&K.nextRetryAt&&l(`div`,{className:`text-[10px] text-foreground-subtle mt-1`,children:S(`addons.addonCard.autoRetryAt`,{time:new Date(K.nextRetryAt).toLocaleTimeString()})})]}),a(`button`,{type:`button`,disabled:we.isPending||K.retrying,onClick:e=>{e.stopPropagation(),we.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:S(`addons.addonCard.resetRetryCounterAndForce`,`Reset retry counter and force immediate reload`),children:[l(b,{className:`h-3 w-3 ${we.isPending||K.retrying?`animate-spin`:``}`}),S(`addons.addonCard.retryNow`,`Retry now`)]})]}),X!==null&&a(`div`,{className:`bg-danger/10 border-b border-danger/30 px-3 py-2 flex items-start gap-2`,children:[l(O,{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:S(`addons.addonCard.processProblem.${X.kind}`)}),X.reason!==void 0&&l(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:X.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:W,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:ye,availableUpdate:u,...A===void 0?{}:{selectedVersion:A},isUpdating:f,installSource:W,disabled:_,...d&&A!==void 0?{onUpdate:()=>d(A)}:{},onOpenPicker:()=>k(e=>!e),children:ie&&l(qe,{packageName:U,currentVersion:ye,...W?{installSource:W}:{},...u!==void 0&&A!==void 0?{selectedVersion:A,onSelect:e=>{le(e),k(!1)}}:{},onInstall:e=>{k(!1),Ce.mutate({packageName:U,version:e})},onClose:()=>k(!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(h,{className:`h-3 w-3`}),m.addons.length]}),v&&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:S(`addons.addonCard.systemPackageUpdatingRestartsThe`,`System package — updating restarts the hub`),children:[l(b,{className:`h-3 w-3`}),S(`addons.addonCard.system`,`System`)]}),g!=null&&l(Ae,{item:g}),p!=null&&l(Ie,{progress:p})]}),xe&&l(`p`,{className:`text-[10px] text-foreground-subtle mt-1 line-clamp-1`,children:xe}),!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`?S(`addons.addonCard.forked`):S(`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`:X===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(),G.mutate({addonId:z.id})},disabled:G.isPending||_,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 ${G.isPending?`animate-spin`:``}`}),S(`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 ${de?`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`}),S(`addons.addonCard.logs`,`Logs`)]}),!V&&a(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),fe(!0)},className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium border transition-colors ${N?`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(E,{className:`h-3 w-3`}),S(`addons.addonCard.settings`,`Settings`)]}),l(`div`,{className:`flex-1`}),ge&&l(Ke,{packageName:z.packageName,displayName:z.name,selectedNode:y??et,disabled:_})]}),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:S(`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:S(`addons.addonCard.outdated`)}),e.status===`offline`&&l(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-muted text-muted-foreground`,children:S(`common.offline`)}),e.synced&&e.status!==`offline`&&l(`span`,{className:`text-[9px] text-success`,children:S(`common.synced`)})]},e.nodeId))})]}),de&&!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:S(`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:S(`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(se,{addonId:z.id,category:`addon.*`,maxHeight:`max-h-64`})]}),V&&a(o,{children:[l(`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:l(w?ne:re,{className:`h-3.5 w-3.5 text-foreground-subtle`})}),w&&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))})]}),N&&!V&&l(ue,{open:!0,onOpenChange:e=>!e&&fe(!1),children:a(R,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:[l(Se,{children:a(_e,{className:`flex items-center gap-2`,children:[l(E,{className:`h-4 w-4 text-primary`}),S(`addons.addonCard.settingsTitle`,{name:H})]})}),a(ae,{className:`space-y-4`,children:[l(`div`,{className:`text-[10px] text-foreground-subtle mb-2`,children:S(`addons.addonCard.clusterWideSettingsOneValue`,`Cluster-wide settings — one value for every node. Per-node settings live under Cluster → the node → Settings.`)}),l(Ee,{nodeId:null,addonIds:[z.id],level:`global`,fieldScope:`cluster`,emptyMessage:S(`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:S(`addons.addonCard.deviceExport`,`Device export`)}),l(oe,{addonId:z.id,onOpenDevice:e=>L(`/devices/${e}`)})]}),Xe(W)&&a(`div`,{children:[l(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:S(`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:S(`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:S(`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:S(`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(),D(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:S(`addons.addonCard.installOnMoreAgents`,`Install on more agents`),children:[l(C,{className:`h-3 w-3`}),S(`addons.addonCard.addAgent`,`Add agent`)]}),T&&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(),D(!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:S(`addons.addonCard.noAvailableAgents`,`No available agents`)})]})]})]})]})]}),l(be,{children:l(he,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>fe(!1),children:S(`common.close`,`Close`)})})]})})]})}e();var nt=`.tgz,.tar.gz,.zip`;function rt({onUploadSuccess:e}){let{t}=q(),[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(m(`/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(w,{className:`w-3.5 h-3.5 animate-spin`}):l(p,{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}=q(),{data:n}=F(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(f,{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}=q();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(j,{variant:`success`,icon:l(g,{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(w,{className:`h-3 w-3 animate-spin`}):l(v,{className:`h-3 w-3`}),r(`system.capabilityCatalog.install`,`Install`)]})]})}function ct({capability:e,installing:t,onInstall:n}){let{t:r}=q(),{data:i,isPending:o,isError:s}=B({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(w,{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:f,isRefreshing:p}){let{t:m}=q(),h=s(),[g,_]=r(``),y=u(g),[x,C]=r(!1),te=c(null);t(()=>{if(!x)return;let e=e=>{te.current&&!te.current.contains(e.target)&&C(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[x]);let{data:T}=Ce({nodeId:d.id}),E=n(()=>{let e=new Map;for(let t of T??[])e.set(t.name,t.latestVersion);return e},[T]),ne=n(()=>(T??[]).filter(e=>!e.isSystem).length,[T]),[re,D]=r(()=>new Set),[O,ie]=r(()=>new Map),ae=i(e=>{D(t=>new Set(t).add(e))},[]),oe=i(e=>{D(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[]),se=i((e,t)=>{ie(n=>new Map(n).set(e,t))},[]),ce=i(e=>{ie(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),A=we({onMutate:e=>{ae(e.name),ce(e.name)},onSuccess:(e,t)=>{oe(t.name);let n=e;if(n&&n.success===!1){se(t.name,n.error??`Update failed (no error message returned by server)`);return}h.invalidateQueries({queryKey:[[`addons`]]}),h.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]})},onError:(e,t)=>{oe(t.name),se(t.name,e instanceof Error?e.message:String(e))}}),ue=Pe(),j=c(new Set);t(()=>{let e=new Set;for(let[t,n]of ue)Me(n)&&e.add(t);let t=[...j.current].some(t=>!e.has(t));j.current=e,t&&(h.invalidateQueries({queryKey:[[`addons`]]}),h.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]}))},[ue,h]);let{data:M}=ye(void 0),N=de({onSuccess:()=>{h.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),P=fe({onSuccess:()=>{h.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),{data:F,isFetching:I}=B({query:y||void 0},{enabled:x}),L=K(),{data:R}=xe(void 0),me=R?.requestedAt,[z,he]=r(null),[ge,_e]=r(!1);t(()=>{if(R?.kind===`framework-bulk-update`&&R.requestedAt!==z){he(R.requestedAt),_e(!0);let e=window.setTimeout(()=>_e(!1),6e3);return()=>window.clearTimeout(e)}},[me,z,R]),k();let V=i(async()=>{let e=(T??[]).filter(e=>!e.isSystem);if(e.length!==0){if(!d.isHub){for(let t of e)await A.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]})}},[T,d.id,d.isHub,L,A]),H=pe({onSuccess:()=>{h.invalidateQueries({queryKey:[[`addons`]]}),h.invalidateQueries({queryKey:[[`addonPages`]]}),h.invalidateQueries({queryKey:[[`capabilities`]]}),h.invalidateQueries({queryKey:[[`integrations`]]})}}),[ve,U]=r(`type`),[be,W]=r(()=>typeof window>`u`?`grouped`:window.localStorage.getItem(`camstack.addons.viewMode`)===`flat`?`flat`:`grouped`),Se=e=>{W(e),typeof window<`u`&&window.localStorage.setItem(`camstack.addons.viewMode`,e)},[G,J]=Te(),Y=G.get(`capability`),X=G.get(`updatable`)===`1`,Ee=G.get(`error`)===`1`,Z=lt(G.get(`source`)),De=i(e=>{let t=new URLSearchParams(G);e?t.set(`updatable`,`1`):t.delete(`updatable`),J(t,{replace:!0})},[G,J]),ke=i(e=>{let t=new URLSearchParams(G);e?t.set(`error`,`1`):t.delete(`error`),J(t,{replace:!0})},[G,J]),Ae=i(e=>{let t=new URLSearchParams(G);e===null?t.delete(`source`):t.set(`source`,e),J(t,{replace:!0})},[G,J]),je=n(()=>e.filter(e=>Oe(e.process)!==null).length,[e]),Q=n(()=>{let t=e.filter(e=>!mt(e.manifest.packageName));return d.isHub||(t=t.filter(e=>gt(e.placement,d.isHub))),Y&&(t=t.filter(e=>(e.manifest.capabilities??[]).some(e=>(typeof e==`string`?e:e.name)===Y))),X&&(t=t.filter(e=>{let t=e.manifest.packageName;return t!==void 0&&E.has(t)})),Z!==null&&(t=t.filter(e=>_t(e.installSource)===Z)),Ee&&(t=t.filter(e=>Oe(e.process)!==null)),t},[e,d.isHub,Y,X,Z,Ee,E]),Ne=()=>{let e=new URLSearchParams(G);e.delete(`capability`),J(e,{replace:!0})},Fe=be===`flat`?Q:yt(Q),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:[[...O.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:m(`systemPage.addons.updateFailed`,{name:e})}),l(`div`,{className:`text-foreground-subtle font-mono`,children:t})]}),l(`button`,{type:`button`,onClick:()=>ce(e),className:`text-foreground-subtle hover:text-foreground text-[10px]`,children:m(`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:m(`admin.system.addons.sort`,`Sort:`)}),a(`select`,{value:ve,onChange:e=>U(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:m(`admin.system.addons.bundlesFirst`,`Bundles first`)}),l(`option`,{value:`name`,children:m(`admin.system.addons.name`,`Name`)}),l(`option`,{value:`source`,children:m(`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:m(`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:()=>Se(e),className:`px-2 py-1 transition-colors capitalize ${be===e?`bg-primary/10 text-primary`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`}`,title:e===`grouped`?m(`admin.system.addons.groupMultiAddonPackagesInto`,`Group multi-addon packages into a bundle card`):m(`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:m(`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:m(`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))})]}),ne>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(w,{className:`w-3 h-3 animate-spin`}):l(v,{className:`w-3 h-3`}),L.isPending?m(`admin.system.addons.updating`,`Updating…`):m(`admin.system.addons.updateAll`,`Update All ({{nonSystemUpdateCount}})`,{nonSystemUpdateCount:ne})]}),a(`button`,{type:`button`,onClick:f,disabled:p||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 ${p?`animate-spin`:``}`}),m(`common.refresh`,`Refresh`)]})]}),a(`div`,{className:`flex flex-wrap items-center gap-1.5`,role:`group`,"aria-label":m(`admin.system.addons.filterInstalledAddons`,`Filter installed addons`),children:[l(`span`,{className:`text-[10px] text-foreground-subtle`,children:m(`admin.system.addons.filter`,`Filter:`)}),[{id:`updatable`,label:m(`admin.system.addons.updatable`,`Updatable`),pressed:X,toggle:()=>De(!X)},{id:`error`,label:m(`admin.system.addons.inError`,`In error ({{count}})`,{count:je}),pressed:Ee,toggle:()=>ke(!Ee)},{id:`npm`,label:`npm`,pressed:Z===`npm`,toggle:()=>Ae(Z===`npm`?null:`npm`)},{id:`dev`,label:m(`admin.system.addons.dev`,`Dev`),pressed:Z===`dev`,toggle:()=>Ae(Z===`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:te,children:[l(le,{type:`text`,value:g,onChange:e=>{_(e.target.value),C(!0)},onFocus:()=>C(!0),placeholder:m(`admin.system.addons.searchAddonsOnNpm`,`Search addons on npm...`),"aria-label":m(`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(w,{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:m(`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:()=>{h.invalidateQueries({queryKey:[[`addons`]]}),f()}})]}),Y&&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:m(`admin.system.addons.filteringByCapability`,`Filtering by capability:`)}),l(`span`,{className:`font-mono text-primary font-semibold`,children:Y}),l(`button`,{type:`button`,onClick:Ne,className:`ml-auto text-xs text-foreground-subtle hover:text-foreground underline`,children:m(`admin.system.addons.clear`,`Clear`)})]}),Y&&l(ct,{capability:Y,installing:H.isPending,onInstall:e=>H.mutate({packageName:e})}),Y&&Q.length>0&&l(`h2`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:m(`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(ee,{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:m(`admin.system.addons.bulkUpdateCompleted`,`Bulk update completed`)}),l(`div`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:m(`admin.system.addons.systemPackagesUpdatedHubRestarted`,`System packages updated — hub restarted successfully.`)})]})]}),Q.length===0&&l(`div`,{className:`text-xs text-foreground-subtle`,children:e.length===0?m(`admin.system.addons.noAddonsInstalled`,`No addons installed`):Y?m(`admin.system.addons.noInstalledAddonDeclaresThe`,`No installed addon declares the "{{capabilityFilter}}" capability. Any addon you can install appears under "Available to install" above.`,{capabilityFilter:Y}):m(`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=E.get(t),r=$(e)?e.representative:e,i=n?e=>A.mutate({name:t,version:e,nodeId:d.id}):void 0,a=ue.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:re.has(t)||s,jobProgress:a,onUpdate:i,disabledByBulk:L.isPending,selectedNode:d},$(e)?t:e.manifest.id)})})]})}function xt(){let{t:e}=q(),n=s(),{data:r}=A(void 0),{nodes:i}=ce(),{selection:o,selectNode:u,requestedNodeId:d}=De(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=L(),y=I(),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 ee=(h??[]).map(vt).filter(e=>e!==null);return a(X,{children:[a(`div`,{className:`flex items-center justify-between gap-2 flex-wrap`,children:[l(U,{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:ee.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(Z,{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:ee,clusterStatus:r,selectedNode:f,onRefresh:()=>void S(),isRefreshing:x})]})}export{xt as AddonsPage};