@camstack/addon-admin-ui 1.2.517 → 1.2.519

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 (142) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/assets/{AddonAssetIcon-DaAStKC8.js → AddonAssetIcon-Do54wTZ7.js} +1 -1
  3. package/dist/assets/Addons-6_-wfXxF.js +5 -0
  4. package/dist/assets/{AdminPage-CgFhd3My.js → AdminPage-BmoKOToB.js} +1 -1
  5. package/dist/assets/{AdminSectionedPage-C9702pKD.js → AdminSectionedPage-BVRb5Xx_.js} +1 -1
  6. package/dist/assets/{AiProfiles-CZMD4KM-.js → AiProfiles-BDvnR_4v.js} +2 -2
  7. package/dist/assets/{BrokerEditorDialog-BCtpOmtb.js → BrokerEditorDialog-BGzqj_xB.js} +1 -1
  8. package/dist/assets/Build-Bt7G7Fl-.js +40 -0
  9. package/dist/assets/{Calendars-CvhWz72R.js → Calendars-0sdMS0h-.js} +1 -1
  10. package/dist/assets/Cluster-C8z_ezr0.js +1 -0
  11. package/dist/assets/ComposedDeviceEditDialog-DMHHX26S.js +1 -0
  12. package/dist/assets/CompositionBlockEditor-BN_Knc98.js +2 -0
  13. package/dist/assets/{CompositionEditorPage-CZQd9oj4.js → CompositionEditorPage-jHRMkJAB.js} +1 -1
  14. package/dist/assets/Data-BLCk3bRU.js +2 -0
  15. package/dist/assets/DeviceDetail-WuonpcW1.js +2 -0
  16. package/dist/assets/DeviceDoActionFields-QuNvGYh2.js +1 -0
  17. package/dist/assets/{Devices-60E3KVab.js → Devices-uoz9LDSC.js} +1 -1
  18. package/dist/assets/{EmbedPlayerPage-BCjssXwM.js → EmbedPlayerPage-B-NlJHwD.js} +1 -1
  19. package/dist/assets/{History-QHsS9OSz.js → History-Dvaf0xT6.js} +1 -1
  20. package/dist/assets/Identity-DfU1qxG7.js +1 -0
  21. package/dist/assets/IntegrationDetail-CRMLO8el.js +1 -0
  22. package/dist/assets/{IntegrationHub-YFOb5Q5f.js → IntegrationHub-BWv5Fg0o.js} +1 -1
  23. package/dist/assets/Integrations-BzA5bIzc.js +1 -0
  24. package/dist/assets/{Integrations-CAGCgM4m.js → Integrations-D76PKsKH.js} +1 -1
  25. package/dist/assets/{Library-CDBh4UY7.js → Library-CGtKaxY5.js} +1 -1
  26. package/dist/assets/Locations-6OyPx_9Z.js +3 -0
  27. package/dist/assets/{Logs-BzR8S8Az.js → Logs-73QHCsO8.js} +1 -1
  28. package/dist/assets/{MaskShapeCanvas-v1VFSWGn.js → MaskShapeCanvas-B599Qff8.js} +1 -1
  29. package/dist/assets/{MotionZonesSettings-sNv6UeyN.js → MotionZonesSettings-kGwQFrli.js} +1 -1
  30. package/dist/assets/{MyAccess-d7f5aurQ.js → MyAccess-aAaXYWh8.js} +1 -1
  31. package/dist/assets/Network-81XYmJI_.js +1 -0
  32. package/dist/assets/{NodeAddonsSettingsPanel-Dul-TVez.js → NodeAddonsSettingsPanel-4ZIViPki.js} +1 -1
  33. package/dist/assets/Notifications-C3Q-zMJT.js +1 -0
  34. package/dist/assets/Pipeline-BU1kCg0o.js +1 -0
  35. package/dist/assets/{PrivacyMaskSettings-BOFfKtZS.js → PrivacyMaskSettings-D3OKCG5L.js} +1 -1
  36. package/dist/assets/Recordings-X80n4tx4.js +1 -0
  37. package/dist/assets/{RemoteGrid-DwD_77yd.js → RemoteGrid-BC7RcI7j.js} +1 -1
  38. package/dist/assets/{ScanNetworkModal-DfCSNZP7.js → ScanNetworkModal-B-q8sfOu.js} +1 -1
  39. package/dist/assets/{SceneMonitorEditor-CYSd3nvA.js → SceneMonitorEditor-BWwBdarY.js} +1 -1
  40. package/dist/assets/SessionsList-BTc6C0Y8.js +2 -0
  41. package/dist/assets/{Showroom-BW0s66nO.js → Showroom-GvVEKdMA.js} +1 -1
  42. package/dist/assets/{System-lEmnBarz.js → System-8ayhyG8M.js} +1 -1
  43. package/dist/assets/{Templates-oi3TGvJ_.js → Templates-DIMuzzu_.js} +1 -1
  44. package/dist/assets/{Terminal-DSohGtV9.js → Terminal-CwX9MQHx.js} +3 -3
  45. package/dist/assets/{Viewer-B6FpTku6.js → Viewer-BzxcMFB5.js} +1 -1
  46. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DqPNLVRX.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DvIAWVsR.js} +1 -1
  47. package/dist/assets/{addon-icons-context-BAMZN6v3.js → addon-icons-context-D-3KCr36.js} +1 -1
  48. package/dist/assets/{archive-CQSA3no9.js → archive-sIPC64K9.js} +1 -1
  49. package/dist/assets/{assignment-candidates-CX47iOH5.js → assignment-candidates-C_UoiwJK.js} +1 -1
  50. package/dist/assets/{authed-media-Bk6ZG2lV.js → authed-media-BE3neYoh.js} +1 -1
  51. package/dist/assets/{bell-off-ByVFjmad.js → bell-off-DBYFNI8u.js} +1 -1
  52. package/dist/assets/{board-model-Cij0wyiz.js → board-model-CeWFKx9n.js} +1 -1
  53. package/dist/assets/{boxes-B8shBGyA.js → boxes-5j10egHw.js} +1 -1
  54. package/dist/assets/circle-slash-VFJ46qWN.js +1 -0
  55. package/dist/assets/client-BmfSvq-t.js +674 -0
  56. package/dist/assets/{cloud-upload-knnOuFf0.js → cloud-upload-CUkN17bl.js} +1 -1
  57. package/dist/assets/crop-DwwjG8X9.js +1 -0
  58. package/dist/assets/{device-integration-icon-CXZW9un_.js → device-integration-icon-BOTb2lo-.js} +1 -1
  59. package/dist/assets/device-picker-model-C2rxDYB3.js +1 -0
  60. package/dist/assets/dist-CGa31Bpn.js +674 -0
  61. package/dist/assets/{dist-DWGbpqHP.js → dist-dCyhYCji.js} +1 -1
  62. package/dist/assets/{file-up-DsJKDfNx.js → file-up-DF9281zn.js} +1 -1
  63. package/dist/assets/format-Ctn7h3o7.js +1 -0
  64. package/dist/assets/{hard-drive-download-3fltBasv.js → hard-drive-download-YoDQjZ6G.js} +1 -1
  65. package/dist/assets/{hostInit-Djg3zVjo.js → hostInit-BqZN7ExA.js} +1 -1
  66. package/dist/assets/i18n-CWf2gqjI.js +1 -0
  67. package/dist/assets/{icons-yMzKblPs.js → icons-CUtj9rug.js} +1 -1
  68. package/dist/assets/{index-Dvd8RKBK.js → index-3I8aJwfA.js} +3 -3
  69. package/dist/assets/{index-DrGgMc78.css → index-C0TfYmoA.css} +1 -1
  70. package/dist/assets/{key-DCYw0FNE.js → key-BpA5yjS5.js} +1 -1
  71. package/dist/assets/{key-round-CTD-QhVl.js → key-round-BbwlZYgP.js} +1 -1
  72. package/dist/assets/{layers-7Ihtoyz5.js → layers-Bxrx5612.js} +1 -1
  73. package/dist/assets/{linked-devices-model-n5gH_HKu.js → linked-devices-model-4X2JNgtv.js} +1 -1
  74. package/dist/assets/{list-ordered-oYfsQM3w.js → list-ordered-BQZRweJv.js} +1 -1
  75. package/dist/assets/{location-owned-usage-CT1Figq_.js → location-owned-usage-exyIAC5r.js} +1 -1
  76. package/dist/assets/{log-in-BzAjDKMU.js → log-in-BFtLVkKt.js} +1 -1
  77. package/dist/assets/{memory-stick-XgJPnz3h.js → memory-stick-65f0Nh--.js} +1 -1
  78. package/dist/assets/{message-square-plus-DObXI5UO.js → message-square-plus-Cz97-8Ea.js} +1 -1
  79. package/dist/assets/{mf-entry-bootstrap-0-8ecb92b3.js → mf-entry-bootstrap-0-4f81b329.js} +2 -2
  80. package/dist/assets/{mic-off-CFZpIFfk.js → mic-off-C90AfhxH.js} +1 -1
  81. package/dist/assets/{monitor-off-610T_Gdj.js → monitor-off-Kj0KouMn.js} +1 -1
  82. package/dist/assets/{monitor-smartphone-Dn0zJRqy.js → monitor-smartphone-dJjQFha0.js} +1 -1
  83. package/dist/assets/mount-C2rxDYB3.js +1 -0
  84. package/dist/assets/{player-overlays-CJHEGkWA.js → player-overlays-Cl9fdVyE.js} +1 -1
  85. package/dist/assets/{recycle-BDhcl0YV.js → recycle-B_n3HNql.js} +1 -1
  86. package/dist/assets/remoteEntry-Bgu2wj6M.js +1 -0
  87. package/dist/assets/{ruler-DRBBjPda.js → ruler-DFksgfFc.js} +1 -1
  88. package/dist/assets/{scan-eye-Cq1A21Jj.js → scan-eye-Dcs85qj4.js} +1 -1
  89. package/dist/assets/{scissors-_YyUi2Wc.js → scissors-DpVQCMjY.js} +1 -1
  90. package/dist/assets/{search-x-0cpMKp48.js → search-x-BUboqisx.js} +1 -1
  91. package/dist/assets/{send-BPU5cRG9.js → send-i8_gi4Wv.js} +1 -1
  92. package/dist/assets/{settings-2-L8TMaIKQ.js → settings-2-BuOeZPiK.js} +1 -1
  93. package/dist/assets/{shapes-DJVtgjGZ.js → shapes-DGstG7DR.js} +1 -1
  94. package/dist/assets/{sigma-DPXOWC0b.js → sigma-B0KIxXLC.js} +1 -1
  95. package/dist/assets/{speaker-CokRNflr.js → speaker-C7Ctczma.js} +1 -1
  96. package/dist/assets/src-Cjqv1L1_.js +67 -0
  97. package/dist/assets/{step-inspector-model-8FwvV-vd.js → step-inspector-model-CSluC3K5.js} +1 -1
  98. package/dist/assets/{table-2-DBJuUbJh.js → table-2-Bi2N6ehZ.js} +1 -1
  99. package/dist/assets/{timer-reset-D9k5wmF9.js → timer-reset-C-DbgYsd.js} +1 -1
  100. package/dist/assets/{unlink-Bs2RzKEu.js → unlink-DOrqvhrS.js} +1 -1
  101. package/dist/assets/{usb-BjhR3doW.js → usb-D21IcPqp.js} +1 -1
  102. package/dist/assets/use-device-bound-caps-DUbLU0h-.js +1 -0
  103. package/dist/assets/{use-scenes-feed-CT1HkH56.js → use-scenes-feed-Cc_FfCf0.js} +1 -1
  104. package/dist/assets/{use-stationary-objects-HuzwOvOv.js → use-stationary-objects-C9cIQpEH.js} +1 -1
  105. package/dist/assets/useEventInvalidation-C2rxDYB3.js +1 -0
  106. package/dist/assets/{useNodeUrlSelection-B82QsLnx.js → useNodeUrlSelection-BmuHzJCe.js} +1 -1
  107. package/dist/assets/user-round-CCHLAyrG.js +1 -0
  108. package/dist/assets/{user-x-lD1eMNGr.js → user-x-dk19_EsK.js} +1 -1
  109. package/dist/assets/{variable-f5kvdTkN.js → variable-jCYthbGt.js} +1 -1
  110. package/dist/assets/{video-DNdx4dbt.js → video-BbvU47vV.js} +1 -1
  111. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BwnfAs-v.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DOT_MvML.js} +2 -2
  112. package/dist/index.html +10 -10
  113. package/dist/server/addon.js +90 -7
  114. package/package.json +1 -1
  115. package/dist/assets/Addons-Do9U7LcM.js +0 -5
  116. package/dist/assets/Build-BgRIdgDr.js +0 -40
  117. package/dist/assets/Cluster-GaxjV7h4.js +0 -1
  118. package/dist/assets/ComposedDeviceEditDialog-B1R5Dm6Q.js +0 -1
  119. package/dist/assets/CompositionBlockEditor-CKIEoswd.js +0 -2
  120. package/dist/assets/Data-CZij0oVZ.js +0 -2
  121. package/dist/assets/DeviceDetail-DIqK-Pxm.js +0 -2
  122. package/dist/assets/DeviceDoActionFields-DAsmzytT.js +0 -1
  123. package/dist/assets/Identity-Ck9bdqfT.js +0 -1
  124. package/dist/assets/IntegrationDetail-Cggj8UuG.js +0 -1
  125. package/dist/assets/Integrations-CM_r2esc.js +0 -1
  126. package/dist/assets/Locations-C5J-xGpv.js +0 -3
  127. package/dist/assets/Network-D5kLXsF4.js +0 -1
  128. package/dist/assets/Notifications-BCXKW0H1.js +0 -1
  129. package/dist/assets/Pipeline-DQ0gg-q3.js +0 -1
  130. package/dist/assets/Recordings-CSEh6SKS.js +0 -1
  131. package/dist/assets/SessionsList-e-yTK3Ce.js +0 -2
  132. package/dist/assets/circle-slash-CYJP5692.js +0 -1
  133. package/dist/assets/client-B3Uh4h4a.js +0 -674
  134. package/dist/assets/crop-CO-cCOHc.js +0 -1
  135. package/dist/assets/device-picker-model-CLwbjCLX.js +0 -1
  136. package/dist/assets/dist-2sWhwHC7.js +0 -674
  137. package/dist/assets/i18n-qDGVD_PF.js +0 -1
  138. package/dist/assets/mount-CLwbjCLX.js +0 -1
  139. package/dist/assets/remoteEntry-BkNPWH4W.js +0 -1
  140. package/dist/assets/src-CzDAA2fz.js +0 -67
  141. package/dist/assets/useEventInvalidation-CLwbjCLX.js +0 -1
  142. package/dist/assets/user-round-reErwwaE.js +0 -1
@@ -54151,11 +54151,13 @@ var ImageContractSchema = object({
54151
54151
  * The shell verdict (see {@link WrapperKindSchema}) with the proofs that
54152
54152
  * produced it.
54153
54153
  *
54154
- * There is deliberately NO `canSelfUpdate` and no apply action: a wrapper
54155
- * update is an ANNOUNCEMENT. The notification body carries the exact command
54156
- * for a `docker` shell and says the app restarts into the new build for
54157
- * `electron`, and that sentence is chosen from `kind` alone — a boolean
54158
- * nothing reads is the defect this repo keeps paying for.
54154
+ * There is deliberately NO `canSelfUpdate` boolean: a wrapper update is an
54155
+ * ANNOUNCEMENT. The notification body carries the exact command for a `docker`
54156
+ * shell and says the app restarts into the new build for `electron`, and that
54157
+ * sentence is chosen from `kind` alone — a boolean nothing reads is the defect
54158
+ * this repo keeps paying for. The one shell that CAN be acted on is the
54159
+ * Electron app, and only through `installDesktopUpdate` (see
54160
+ * {@link DesktopAppStatusSchema} for what the node reads from the app first).
54159
54161
  */
54160
54162
  var WrapperIdentitySchema = object({
54161
54163
  kind: _enum([
@@ -54203,6 +54205,49 @@ var ServerRollbackInfoSchema = object({
54203
54205
  reason: string()
54204
54206
  });
54205
54207
  /**
54208
+ * What the native desktop app (Electron) that hosts this node says about
54209
+ * itself, read from `<dataDir>/server-root/desktop-app-state.json` (ADR-0971).
54210
+ * Absent on the status = no desktop app, or it never wrote the file.
54211
+ *
54212
+ * `stale` is the honest answer to an app that stopped writing (closed, hung,
54213
+ * crashed): the update facts are then the LAST ones known, not current ones,
54214
+ * and a consumer must not read `update.available: false` from a stale record
54215
+ * as "no update". `stateAtMs` is when the app last wrote.
54216
+ */
54217
+ var DesktopAppStatusSchema = object({
54218
+ /** The Electron app's own version (not the node closure's). */
54219
+ version: string(),
54220
+ update: object({
54221
+ available: boolean(),
54222
+ /** The new build is downloaded and `installDesktopUpdate` can apply it. */
54223
+ downloaded: boolean(),
54224
+ version: string().nullable(),
54225
+ checking: boolean(),
54226
+ /** Why the app's last update check produced no answer; `null` when it did. */
54227
+ error: string().nullable()
54228
+ }),
54229
+ stateAtMs: number(),
54230
+ stale: boolean()
54231
+ });
54232
+ /**
54233
+ * Why `installDesktopUpdate` did nothing. Stable names a UI maps to a sentence:
54234
+ * - `not-electron` — this node does not run inside the desktop app.
54235
+ * - `no-app-state` — the app never published its state (or the file is unreadable).
54236
+ * - `app-state-stale` — the app stopped writing; it is probably not running.
54237
+ * - `not-downloaded` — no update is downloaded yet; nothing to install.
54238
+ */
54239
+ var InstallDesktopUpdateReasonSchema = _enum([
54240
+ "not-electron",
54241
+ "no-app-state",
54242
+ "app-state-stale",
54243
+ "not-downloaded"
54244
+ ]);
54245
+ var InstallDesktopUpdateResultSchema = object({
54246
+ accepted: boolean(),
54247
+ /** Non-null exactly when `accepted` is false. */
54248
+ reason: InstallDesktopUpdateReasonSchema.nullable()
54249
+ });
54250
+ /**
54206
54251
  * The runner boot check (D877): the runners this node PLANNED (hub: one per
54207
54252
  * `resolveRunnerId` over its forked addons; agent: the runners its process
54208
54253
  * service holds, because only the hub plans) against the states the process
@@ -54306,7 +54351,12 @@ var ServerPackageStatusSchema = object({
54306
54351
  * on a provider that predates it. Absent is "not checked yet", never "all
54307
54352
  * well": a consumer that needs the answer treats it as pending.
54308
54353
  */
54309
- runners: RunnerBootCheckSchema.optional()
54354
+ runners: RunnerBootCheckSchema.optional(),
54355
+ /**
54356
+ * The desktop app hosting this node (see {@link DesktopAppStatusSchema}).
54357
+ * Optional for version skew AND because most nodes have no desktop app.
54358
+ */
54359
+ desktopApp: DesktopAppStatusSchema.optional()
54310
54360
  });
54311
54361
  var ServerUpdateCheckResultSchema = object({
54312
54362
  packageName: string(),
@@ -54389,6 +54439,12 @@ var ServerUpdateActionResultSchema = object({
54389
54439
  */
54390
54440
  blockers: array(UpdateBlockerSchema).optional()
54391
54441
  });
54442
+ var LaunchOverridesSchema = object({
54443
+ /** The persisted heap ceiling in MB, or `null` when none is set. */
54444
+ heapMb: number().int().nullable() });
54445
+ var SetLaunchOverridesResultSchema = LaunchOverridesSchema.extend({
54446
+ /** Always true: the override is read at launch, not by the running process. */
54447
+ restartRequired: boolean() });
54392
54448
  method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
54393
54449
  kind: "mutation",
54394
54450
  auth: "admin"
@@ -54405,12 +54461,18 @@ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), S
54405
54461
  kind: "mutation",
54406
54462
  auth: "admin",
54407
54463
  timeoutMs: 16 * 6e4
54464
+ }), method(_void(), InstallDesktopUpdateResultSchema, {
54465
+ kind: "mutation",
54466
+ auth: "admin"
54408
54467
  }), method(_void(), ServerUpdateActionResultSchema, {
54409
54468
  kind: "mutation",
54410
54469
  auth: "admin"
54411
54470
  }), method(_void(), ServerUpdateActionResultSchema, {
54412
54471
  kind: "mutation",
54413
54472
  auth: "admin"
54473
+ }), method(_void(), LaunchOverridesSchema, { auth: "admin" }), method(object({ heapMb: number().int().min(512).max(65536).nullable() }), SetLaunchOverridesResultSchema, {
54474
+ kind: "mutation",
54475
+ auth: "admin"
54414
54476
  });
54415
54477
  /**
54416
54478
  * `smtp-provider` — pluggable email delivery surface.
@@ -74746,6 +74808,13 @@ Object.freeze({
74746
74808
  access: "create",
74747
74809
  role: "admin"
74748
74810
  },
74811
+ "serverManagement.getLaunchOverrides": {
74812
+ capName: "server-management",
74813
+ capScope: "system",
74814
+ addonId: null,
74815
+ access: "view",
74816
+ role: "admin"
74817
+ },
74749
74818
  "serverManagement.getServerPackageStatus": {
74750
74819
  capName: "server-management",
74751
74820
  capScope: "system",
@@ -74753,6 +74822,13 @@ Object.freeze({
74753
74822
  access: "view",
74754
74823
  role: "admin"
74755
74824
  },
74825
+ "serverManagement.installDesktopUpdate": {
74826
+ capName: "server-management",
74827
+ capScope: "system",
74828
+ addonId: null,
74829
+ access: "create",
74830
+ role: "admin"
74831
+ },
74756
74832
  "serverManagement.restartServer": {
74757
74833
  capName: "server-management",
74758
74834
  capScope: "system",
@@ -74767,6 +74843,13 @@ Object.freeze({
74767
74843
  access: "create",
74768
74844
  role: "admin"
74769
74845
  },
74846
+ "serverManagement.setLaunchOverrides": {
74847
+ capName: "server-management",
74848
+ capScope: "system",
74849
+ addonId: null,
74850
+ access: "create",
74851
+ role: "admin"
74852
+ },
74770
74853
  "settingsStore.aggregate": {
74771
74854
  capName: "settings-store",
74772
74855
  capScope: "system",
@@ -85115,7 +85198,7 @@ var AdminUIAddon = class extends BaseAddon {
85115
85198
  capability: adminUiCapability,
85116
85199
  provider: {
85117
85200
  getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
85118
- getVersion: async () => ({ version: "1.2.517" })
85201
+ getVersion: async () => ({ version: "1.2.519" })
85119
85202
  }
85120
85203
  }];
85121
85204
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-admin-ui",
3
- "version": "1.2.517",
3
+ "version": "1.2.519",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Admin UI — Vite frontend build and server-side addon",
@@ -1,5 +0,0 @@
1
- import{B as e,C as t,J as n,K as r,R as i,S as a,V as o,Y as s,et as c,o as l,x as u}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{En as d,Ht as f,Oi as p,Pt as m,Q as h,Ti as g,Wn as _,Zr as v,bi as y,fi as b,fr as x,gn as S,gt as C,jn as w,ki as T,ot as E,sn as ee,st as D,vn as te,yn as ne,zt as re}from"./player-overlays-CJHEGkWA.js";import{So as O}from"./client-B3Uh4h4a.js";import{i as ie,u as k}from"./video-DNdx4dbt.js";import{$d as ae,$i as A,Ad as oe,Ai as j,Fi as se,Gi as ce,Gn as M,Hi as N,Ii as P,Ji as le,Kn as F,Li as I,Mi as L,Ni as R,Pi as z,Qi as ue,Ri as de,Sc as B,Sr as fe,Td as V,Ui as pe,Un as H,Vi as U,Wi as me,Wn as W,Xd as he,Xi as ge,Yi as _e,_r as ve,an as ye,br as G,bt as be,ci as xe,ea as Se,ei as K,gr as q,in as Ce,kt as we,qi as Te,vr as Ee,xr as De,zi as J}from"./src-CzDAA2fz.js";import{t as Y}from"./useTranslation-BJr-n0es.js";import"./mount-CLwbjCLX.js";import{_r as X,pr as Z,yr as Oe}from"./index-Dvd8RKBK.js";import{t as ke}from"./AdminPage-CgFhd3My.js";import{t as Ae}from"./NodeAddonsSettingsPanel-Dul-TVez.js";import{t as je}from"./framework-packages-B7oma9J4.js";import{n as Q,t as Me}from"./useNodeUrlSelection-B82QsLnx.js";function Ne(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}}c();var Pe={queued:{icon:b,bg:`bg-muted text-foreground-subtle`,labelKey:`addons.addonRowBadge.queued`},updating:{icon:x,bg:`bg-primary/10 text-primary`,labelKey:`addons.addonRowBadge.updating`,spin:!0},"done-pending-restart":{icon:d,bg:`bg-amber-500/10 text-amber-700`,labelKey:`addons.addonRowBadge.pendingRestart`},done:{icon:T,bg:`bg-success/10 text-success`,labelKey:`addons.addonRowBadge.done`},failed:{icon:ie,bg:`bg-danger/10 text-danger`,labelKey:`addons.addonRowBadge.failed`}};function Fe({item:e}){let{t:n}=Y(),r=Pe[e.status],i=r.icon;return t(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded ${r.bg}`,title:e.error,children:[a(i,{className:`w-2.5 h-2.5 ${r.spin?`animate-spin`:``}`}),n(r.labelKey)]})}var Ie=new Set([`completed`,`failed`,`partially-failed`,`cancelled`]),Le=new Set([`done`,`failed`,`skipped`]);function Re(e){return!Le.has(e.phase)&&!Ie.has(e.jobState)}function ze(e,t){let n=new Map,r=[...e].sort((e,t)=>e.createdAtMs-t.createdAtMs);for(let e of r){let r=Ie.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 Be(){let{data:e}=N({activeOnly:!0},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data?.length??0)>0?3e3:!1}),{map:t}=ae(O.AddonsJobProgress,e=>e.job.jobId);return r(()=>{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 ze([...n.values()],Date.now())},[e,t])}var Ve={queued:{icon:b,cls:`bg-muted text-foreground-subtle`,labelKey:`addons.jobProgress.queued`},fetching:{icon:x,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.fetching`,spin:!0},staged:{icon:x,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.staged`,spin:!0},validating:{icon:x,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.validating`,spin:!0},applying:{icon:x,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.applying`,spin:!0},restarting:{icon:x,cls:`bg-amber-500/10 text-amber-600 dark:text-amber-400`,labelKey:`addons.jobProgress.restarting`,spin:!0},applied:{icon:x,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.finalizing`,spin:!0},done:{icon:T,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 He({progress:e}){let{t:n}=Y(),r=Ve[e.phase],i=r.icon,o=e.error??`${e.packageName}: ${e.fromVersion??`?`} → ${e.toVersion}`;return t(`span`,{"data-testid":`addon-job-progress`,className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded shrink-0 ${r.cls}`,title:o,children:[a(i,{className:`w-2.5 h-2.5 ${r.spin?`animate-spin`:``}`}),n(r.labelKey),t(`span`,{className:`font-mono`,children:[`→ `,e.toVersion]})]})}function Ue(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 We(e){let t=e.version===null?``:` ${e.version}`,n=e.isOnline?``:` (offline: removed when it reconnects)`;return`- ${e.nodeName}${t}${n}`}function Ge(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(We)];return n.length>0&&r.push(`Could not ask: ${n.join(`, `)} — not included.`),r.push(`This cannot be undone.`),r.join(`
2
- `)}function Ke(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 qe={uninstalled:`uninstalled`,"not-installed":`was not installed`,refused:`REFUSED`,failed:`FAILED`,"pending-reconnect":`offline — removed when it reconnects`};function Je(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)}: ${qe[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 Ye={},Xe=3e4,Ze=`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 Qe({packageName:e,displayName:n,selectedNode:r,hideNodeAction:i,disabled:o}){let{t:s}=Y(),c=l(),u=D(),d=E(),p=U(Ye,{staleTime:Xe}),m=p.data?.installations??[],h=(p.data?.unreachable??[]).map(e=>e.nodeId),g=Ue(m,e),_=e=>g.find(t=>t.nodeId===e)?.nodeName??(e===r.id?r.name:e),v=A({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?s(`addons.addonUninstallControls.uninstalled`,`{{displayName}} uninstalled`,{displayName:n}):s(`addons.addonUninstallControls.notEveryNodeWasCleaned`,`{{displayName}}: not every node was cleaned`,{displayName:n}),message:Je(e,_),variant:e.success?`default`:`danger`})},b=async t=>{try{await y(await v.mutateAsync({packageName:e,...t}))}catch(e){await d({title:s(`addons.addonUninstallControls.uninstallFailed`,`Uninstall {{displayName}} failed`,{displayName:n}),message:e instanceof Error?e.message:String(e),variant:`danger`})}},x=async()=>{let e=g.filter(e=>e.nodeId!==r.id);await u({title:s(`addons.addonUninstallControls.uninstallFrom`,`Uninstall {{displayName}} from {{name}}?`,{displayName:n,name:r.name}),message:Ke(n,r.name,e),confirmLabel:s(`addons.addonUninstallControls.uninstall`,`Uninstall`),variant:`danger`})&&await b(r.isHub?{}:{nodeId:r.id})},S=async()=>{let t=(await p.refetch()).data;if(t===void 0){await d({title:s(`addons.addonUninstallControls.cannotListTheNodes`,`Cannot list the nodes`),message:s(`addons.addonUninstallControls.theHubDidNotAnswer`,`The hub did not answer which nodes have this package — nothing was removed.`),variant:`danger`});return}let r=Ue(t.installations,e);await u({title:s(`addons.addonUninstallControls.uninstallEverywhere`,`Uninstall {{displayName}} everywhere?`,{displayName:n}),message:Ge(n,r,t.unreachable.map(e=>e.nodeId)),confirmLabel:s(`addons.addonUninstallControls.uninstallFromNodeS`,`Uninstall from {{length}} node(s)`,{length:r.length}),variant:`danger`})&&await b({everywhere:!0})},C=v.isPending||o===!0;return t(`div`,{className:`flex items-center gap-1.5`,children:[i!==!0&&t(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),x()},disabled:C,className:Ze,title:s(`addons.addonUninstallControls.uninstallFrom2`,`Uninstall from {{name}}`,{name:r.name}),children:[a(f,{className:`h-3 w-3`}),v.isPending?s(`addons.addonUninstallControls.removing`,`Removing...`):s(`addons.addonUninstallControls.uninstall`,`Uninstall`)]}),(g.length>1||i===!0||h.length>0)&&t(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),S()},disabled:C,className:Ze,title:s(`addons.addonUninstallControls.uninstallFromEveryNodeThat`,`Uninstall from every node that has it`),children:[a(k,{className:`h-3 w-3`}),g.length>0?s(`addons.uninstallControls.everywhereCount`,{count:g.length}):s(`addons.uninstallControls.everywhere`)]})]})}function $e(e){return typeof e.deprecated==`string`&&e.deprecated.length>0}function et(e,t){return t?e:e.filter(e=>e.distTags.includes(`latest`)||!$e(e))}function tt(e){return e.length-et(e,!1).length}c();function nt({packageName:e,currentVersion:n,installSource:r,onInstall:i,onClose:o,onSelect:c,selectedVersion:l}){let{t:d}=Y(),f=r===`upload`||r===`local`,[p,h]=s(!1),{data:g,isLoading:_,isError:y}=I({name:e}),b=g?et(g,p):[],S=g?tt(g):0;return t(`div`,{className:`fixed z-50 w-72 rounded-lg border border-border bg-surface shadow-xl overflow-hidden`,style:{top:`auto`,bottom:`auto`},ref:e=>{if(!e)return;let t=e.parentElement?.getBoundingClientRect();if(!t)return;let n=window.innerHeight-t.bottom,r=t.top;n<280&&r>n?(e.style.bottom=`${window.innerHeight-t.top+4}px`,e.style.top=`auto`):(e.style.top=`${t.bottom+4}px`,e.style.bottom=`auto`),e.style.right=`${window.innerWidth-t.right}px`},onClick:e=>e.stopPropagation(),children:[t(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[a(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle font-medium`,children:d(`addons.versionPicker.versions`,`Versions`)}),a(`button`,{type:`button`,onClick:o,className:`text-foreground-subtle hover:text-foreground`,children:a(C,{className:`h-3 w-3`})})]}),f&&t(`div`,{className:`flex items-start gap-2 px-3 py-2 border-b border-border bg-cyan-500/10 text-[10px]`,children:[a(m,{className:`h-3 w-3 mt-0.5 text-cyan-500 shrink-0`}),t(`div`,{className:`text-cyan-700 dark:text-cyan-200`,children:[a(`span`,{className:`font-semibold`,children:d(`addons.versionPicker.inPlace`,{kind:r===`upload`?d(`addons.versionPicker.uploadedCopy`,`Uploaded copy`):d(`addons.versionPicker.localCopy`,`Local copy`)})}),` `,a(Z,{i18nKey:`addons.versionPicker.reinstall`,values:{version:n},components:{mono:a(`span`,{className:`font-mono`})}})]})]}),_&&t(`div`,{className:`flex items-center justify-center gap-2 py-6 text-[10px] text-foreground-subtle`,children:[a(x,{className:`h-3.5 w-3.5 animate-spin`}),d(`addons.versionPicker.loadingVersions`,`Loading versions...`)]}),y&&a(`div`,{className:`px-3 py-4 text-center text-[10px] text-danger`,children:d(`addons.versionPicker.registryError`,`Could not load versions from the registry.`)}),b.length>0&&a(`div`,{className:`max-h-64 overflow-auto divide-y divide-border`,children:b.map(e=>{let r=e.version===n,o=c!==void 0&&e.version===l,s=/-(alpha|beta|rc|dev|canary|next)/i.test(e.version),f=t(u,{children:[a(`span`,{className:`font-mono flex-1 text-left ${r?`text-primary font-semibold`:s?`text-amber-400`:`text-foreground`}`,children:e.version}),r&&a(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium bg-primary/10 text-primary`,children:d(`common.current`)}),e.distTags.map(e=>a(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${e===`latest`?`bg-emerald-500/15 text-emerald-400`:e===`beta`?`bg-amber-500/15 text-amber-400`:`bg-gray-500/15 text-gray-400`}`,children:e},e)),$e(e)&&a(`span`,{className:`text-[9px] text-red-400 line-through`,children:d(`common.deprecated`)}),a(`span`,{className:`text-[9px] text-foreground-subtle shrink-0`,children:new Date(e.publishedAt).toLocaleDateString()})]});return c?t(`button`,{type:`button`,"aria-label":d(`addons.versionPicker.select`,`Select {{version}}`,{version:e.version}),onClick:()=>c(e.version),className:`w-full flex items-center gap-2 px-3 py-2 text-[11px] ${o?`bg-primary/5`:`hover:bg-surface-hover`} transition-colors`,children:[f,o?a(T,{className:`h-3 w-3 text-primary shrink-0`}):a(`span`,{className:`w-3 shrink-0`})]},e.version):t(`div`,{className:`flex items-center gap-2 px-3 py-2 text-[11px] ${r?`bg-primary/5`:`hover:bg-surface-hover`} transition-colors`,children:[f,a(`button`,{type:`button`,onClick:()=>i(e.version),className:`shrink-0 rounded p-0.5 hover:bg-primary/20 text-foreground-subtle hover:text-primary transition-colors`,title:r?d(`addons.versionPicker.reInstallFromNpm`,`Re-install {{version}} from npm`,{version:e.version}):d(`addons.versionPicker.install`,`Install {{version}}`,{version:e.version}),children:a(v,{className:`h-3 w-3`})})]},e.version)})}),!_&&!y&&g&&g.length===0&&a(`div`,{className:`py-4 text-center text-[10px] text-foreground-subtle`,children:d(`addons.versionPicker.noVersionsFound`,`No versions found`)}),S>0&&a(K,{type:`button`,variant:`ghost`,size:`sm`,className:`h-auto w-full justify-start rounded-none border-t border-border px-3 py-2 text-left text-[10px] font-normal text-foreground-subtle`,onClick:()=>h(e=>!e),children:p?d(`addons.versionPicker.hideOlder`,`Hide older versions`):d(`addons.versionPicker.showOlder`,`Show older versions ({{count}})`,{count:S})})]})}c();var rt=`device-export`;function it(e){return e.capabilities.some(e=>(typeof e==`string`?e:e.name)===rt)}function at(e){return e!==`local`&&e!==`upload`}function ot({isBundle:e,installSource:n,addonId:r,iconPath:i,color:o}){let[c,l]=s(!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=r&&i?h(`/api/addon-assets/${r}/${i}`):null,p=!!f&&!c;return t(`div`,{className:`relative flex-shrink-0`,children:[a(`div`,{className:`h-8 w-8 rounded-md flex items-center justify-center ${u?``:d}`,style:u,children:p?a(`img`,{src:f,alt:r,className:`h-4 w-4`,onError:()=>l(!0)}):a(e?_:w,{className:`h-3.5 w-3.5`})}),n===`local`&&a(`span`,{className:`absolute -top-1.5 -left-1.5 text-[7px] font-bold leading-none bg-orange-500 text-white px-1 py-0.5 rounded -rotate-12 shadow-sm`,children:`DEV`}),at(n)&&a(`span`,{className:`absolute -top-1 -left-1 w-4 h-4 rounded bg-[#cb3837] flex items-center justify-center -rotate-12 shadow-sm`,children:a(`svg`,{viewBox:`0 0 780 250`,className:`w-[11px] h-[11px]`,children:a(`path`,{fill:`#fff`,d:`M240 250h100V50h100v200h340V0H0v250z`})})}),n===`upload`&&a(`span`,{className:`absolute -top-1.5 -left-1.5 flex items-center justify-center h-4 w-4 rounded bg-cyan-500 -rotate-12 shadow-sm`,children:a(m,{className:`h-2.5 w-2.5 text-white`})})]})}function st({version:e,availableUpdate:n,selectedVersion:r,isUpdating:i,installSource:o,disabled:s,onUpdate:c,onOpenPicker:l,children:u}){let{t:d}=Y();if(i)return t(`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:[a(x,{className:`h-3 w-3 animate-spin`}),d(`addons.addonCard.updating`,`Updating…`)]});if(n){let i=r??n;return t(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[c&&t(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),c()},disabled:s,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:i}),children:[a(v,{className:`h-3 w-3`}),d(`addons.addonCard.update`,`Update`)]}),t(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),l()},disabled:s,"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:i}),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:[a(`span`,{className:`font-normal opacity-70`,children:e}),a(`span`,{className:`font-normal opacity-70`,children:`→`}),i,a(p,{className:`h-3 w-3`})]}),u]})}return t(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[t(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),l()},disabled:s,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`,o===`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,a(p,{className:`h-3 w-3 opacity-50`})]}),u]})}function ct({addonId:e}){let t=l(),{data:n=`inherit`}=R({addonId:e}),r=_e({onSuccess:()=>{t.invalidateQueries({queryKey:[[`addons`,`getAddonAutoUpdate`]]})}});return a(`div`,{className:`flex rounded-lg border border-border overflow-hidden text-[10px] font-medium`,children:[`inherit`,`off`,`latest`,`beta`].map(t=>a(`button`,{type:`button`,onClick:n=>{n.stopPropagation(),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 lt={id:`hub`,name:`Hub`,isHub:!0};function ut({addon:e,clusterStatus:n,hideVersion:r,availableUpdate:i,onUpdate:c,isUpdating:f,jobProgress:m,bundle:h,bulkItem:v,disabledByBulk:y,isSystem:b,selectedNode:x}){let{t:w}=Y(),[T,E]=s(!1),[ee,D]=s(!1),[te,re]=s(null);o(()=>{re(null)},[i]);let O=te??i,[k,ae]=s(!1),[A,oe]=s(!1),[j,se]=s(`logs`),M=l(),N=X(),{manifest:P}=e,le=!h&&!P.protected&&P.removable!==!1,F=!!h,I=h?.displayName??P.name,L=h?.packageName??P.packageName,R=h?.version??P.packageVersion??P.version,z=h?.installSource??e.installSource,ue=h?h.bundle?.description??h.addons[0]?.manifest.description:P.description,B=ce({onSuccess:()=>{M.invalidateQueries({queryKey:[[`addons`]]})}}),V=de({onSuccess:()=>{M.invalidateQueries({queryKey:[[`addons`]]}),M.invalidateQueries({queryKey:[[`addonPages`]]}),M.invalidateQueries({queryKey:[[`capabilities`]]}),M.invalidateQueries({queryKey:[[`integrations`]]})}}),pe=Te({onSuccess:()=>{M.invalidateQueries({queryKey:[[`addons`]]}),M.invalidateQueries({queryKey:[[`alerts`]]})}}),H=e.health,U=H?.phase===`failed`&&!H.inGracePeriod,me=U&&H?.nextRetryAt&&!H.retrying,W=Ne(e.process);return t(`div`,{className:`rounded-md border bg-surface overflow-hidden ${U?`border-red-500/50`:`border-border`}`,children:[U&&H&&t(`div`,{className:`bg-danger/10 border-b border-danger/30 px-3 py-2 flex items-start gap-2`,children:[a(ie,{className:`h-4 w-4 text-danger shrink-0 mt-0.5`}),t(`div`,{className:`flex-1 min-w-0`,children:[a(`div`,{className:`text-xs font-semibold text-danger`,children:w(`addons.addonCard.failedToLoad`,{attempt:H.retryCount})}),a(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:H.lastError?.message??w(`addons.addonCard.unknownError`,`Unknown error`)}),me&&H.nextRetryAt&&a(`div`,{className:`text-[10px] text-foreground-subtle mt-1`,children:w(`addons.addonCard.autoRetryAt`,{time:new Date(H.nextRetryAt).toLocaleTimeString()})})]}),t(`button`,{type:`button`,disabled:pe.isPending||H.retrying,onClick:e=>{e.stopPropagation(),pe.mutate({packageName:L})},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:[a(d,{className:`h-3 w-3 ${pe.isPending||H.retrying?`animate-spin`:``}`}),w(`addons.addonCard.retryNow`,`Retry now`)]})]}),W!==null&&t(`div`,{className:`bg-danger/10 border-b border-danger/30 px-3 py-2 flex items-start gap-2`,children:[a(ie,{className:`h-4 w-4 text-danger shrink-0 mt-0.5`}),t(`div`,{className:`flex-1 min-w-0`,children:[a(`div`,{className:`text-xs font-semibold text-danger`,children:w(`addons.addonCard.processProblem.${W.kind}`)}),W.reason!==void 0&&a(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:W.reason})]})]}),t(`div`,{className:`flex items-start gap-2.5 px-3 py-2`,children:[a(ot,{isBundle:F||!!P.components&&P.components.length>1,installSource:z,addonId:F?h.addons[0]?.manifest.id:P.id,iconPath:F?h.bundle?.icon??h.addons[0]?.manifest.icon:P.icon,color:F?h.addons[0]?.manifest.color:P.color}),t(`div`,{className:`flex-1 min-w-0`,children:[t(`div`,{className:`flex items-start justify-between gap-2`,children:[a(`span`,{className:`text-xs font-semibold text-foreground truncate min-w-0`,children:I}),!r&&a(st,{version:R,availableUpdate:i,...O===void 0?{}:{selectedVersion:O},isUpdating:f,installSource:z,disabled:y,...c&&O!==void 0?{onUpdate:()=>c(O)}:{},onOpenPicker:()=>D(e=>!e),children:ee&&a(nt,{packageName:L,currentVersion:R,...z?{installSource:z}:{},...i!==void 0&&O!==void 0?{selectedVersion:O,onSelect:e=>{re(e),D(!1)}}:{},onInstall:e=>{D(!1),V.mutate({packageName:L,version:e})},onClose:()=>D(!1)})})]}),t(`div`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 mt-0.5`,children:[L!==I&&a(`span`,{className:`text-[10px] text-foreground-subtle font-mono truncate max-w-full`,children:L}),F&&t(`span`,{className:`text-[10px] rounded-full bg-primary/10 text-primary px-2 py-0.5 font-medium shrink-0 inline-flex items-center gap-1`,children:[a(_,{className:`h-3 w-3`}),h.addons.length]}),b&&t(`span`,{className:`text-[10px] rounded-full bg-amber-500/15 text-amber-700 dark:text-amber-300 px-2 py-0.5 font-medium shrink-0 inline-flex items-center gap-1`,title:w(`addons.addonCard.systemPackageUpdatingRestartsThe`,`System package — updating restarts the hub`),children:[a(d,{className:`h-3 w-3`}),w(`addons.addonCard.system`,`System`)]}),v!=null&&a(Fe,{item:v}),m!=null&&a(He,{progress:m})]}),ue&&a(`p`,{className:`text-[10px] text-foreground-subtle mt-1 line-clamp-1`,children:ue}),!F&&e.process&&t(`div`,{className:`flex flex-wrap items-center gap-1.5 mt-1`,children:[a(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${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&&t(`span`,{className:`text-[9px] font-mono text-foreground-subtle`,children:[`PID `,e.process.pid]}),a(`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`:W===null?`bg-gray-500/15 text-gray-400`:`bg-red-500/15 text-red-400`}`,children:e.process.state})]})]})]}),!F&&t(`div`,{className:`flex items-center gap-1 px-3 py-1 border-t border-border/50 bg-surface-hover/20`,children:[t(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),B.mutate({addonId:P.id})},disabled:B.isPending||y,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:[a(d,{className:`h-3 w-3 ${B.isPending?`animate-spin`:``}`}),w(`addons.addonCard.restart`,`Restart`)]}),t(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),ae(e=>!e)},className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium border transition-colors ${k?`border-primary/30 bg-primary/10 text-primary`:`border-border text-foreground-subtle hover:text-foreground hover:border-primary/30 hover:bg-primary/10`}`,children:[a(ne,{className:`h-3 w-3`}),w(`addons.addonCard.logs`,`Logs`)]}),!F&&t(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),oe(!0)},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:[a(S,{className:`h-3 w-3`}),w(`addons.addonCard.settings`,`Settings`)]}),a(`div`,{className:`flex-1`}),le&&a(Qe,{packageName:P.packageName,displayName:P.name,selectedNode:x??lt,disabled:y})]}),n&&n.nodes.length>1&&!F&&t(`div`,{className:`border-t border-border px-3 py-1.5 bg-muted/10`,children:[a(`div`,{className:`text-[10px] font-medium text-foreground-subtle mb-1.5`,children:w(`addons.addonCard.clusterDeployment`,`Cluster Deployment`)}),a(`div`,{className:`space-y-1`,children:n.nodes.map(e=>t(`div`,{className:`flex items-center gap-2 text-[10px]`,children:[a(`div`,{className:`h-1.5 w-1.5 rounded-full shrink-0 ${e.status===`offline`?`bg-muted-foreground/30`:e.synced?`bg-success`:`bg-amber-500`}`}),a(`span`,{className:`font-medium text-foreground min-w-[60px]`,children:e.name}),a(`span`,{className:`font-mono text-foreground-subtle`,children:e.version}),!e.synced&&e.status!==`offline`&&a(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-amber-500/10 text-amber-400 border border-amber-500/20`,children:w(`addons.addonCard.outdated`)}),e.status===`offline`&&a(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-muted text-muted-foreground`,children:w(`common.offline`)}),e.synced&&e.status!==`offline`&&a(`span`,{className:`text-[9px] text-success`,children:w(`common.synced`)})]},e.nodeId))})]}),k&&!F&&t(`div`,{className:`border-t border-border`,children:[t(`div`,{className:`flex items-center px-3 py-0.5 bg-surface-hover/20 border-b border-border/50`,children:[t(`div`,{className:`flex rounded border border-border overflow-hidden text-[9px]`,children:[a(`button`,{type:`button`,onClick:()=>se(`logs`),className:`px-2 py-0.5 transition-colors ${j===`logs`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:w(`addons.addonCard.logs`,`Logs`)}),a(`button`,{type:`button`,onClick:()=>se(`events`),className:`px-2 py-0.5 border-l border-border transition-colors ${j===`events`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:w(`addons.addonCard.events`,`Events`)})]}),a(`div`,{className:`flex-1`}),a(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),ae(!1)},className:`text-foreground-subtle hover:text-foreground`,children:a(C,{className:`h-3.5 w-3.5`})})]}),j===`logs`&&a(ye,{addonId:P.id,maxHeight:`max-h-64`,showFilters:!1}),j===`events`&&a(Ce,{addonId:P.id,category:`addon.*`,maxHeight:`max-h-64`})]}),F&&t(u,{children:[a(`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:a(T?g:p,{className:`h-3.5 w-3.5 text-foreground-subtle`})}),T&&a(`div`,{className:`border-t border-border px-2.5 py-1.5 space-y-1.5`,children:h.addons.map(e=>a(ut,{addon:e,hideVersion:!0},e.manifest.id))})]}),A&&!F&&a(q,{open:!0,onOpenChange:e=>!e&&oe(!1),children:t(Ee,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:[a(De,{children:t(fe,{className:`flex items-center gap-2`,children:[a(S,{className:`h-4 w-4 text-primary`}),w(`addons.addonCard.settingsTitle`,{name:I})]})}),t(ve,{className:`space-y-4`,children:[a(`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.`)}),a(Ae,{nodeId:null,addonIds:[P.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.`)}),it(P)&&t(`div`,{children:[a(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:w(`addons.addonCard.deviceExport`,`Device export`)}),a(we,{addonId:P.id,onOpenDevice:e=>N(`/devices/${e}`)})]}),at(z)&&t(`div`,{children:[a(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:w(`addons.addonCard.autoUpdate`,`Auto-Update`)}),a(ct,{addonId:P.id})]}),P.components&&P.components.length>0&&t(`div`,{children:[a(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:w(`addons.addonCard.components`,{count:P.components.length})}),a(`div`,{className:`flex flex-wrap gap-1`,children:P.components.map(e=>a(`span`,{className:`text-[10px] rounded bg-background border border-border px-1.5 py-0.5 text-foreground-subtle font-mono`,children:e},e))})]})]}),a(G,{children:a(K,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>oe(!1),children:w(`common.close`,`Close`)})})]})})]})}c();var dt=`.tgz,.tar.gz,.zip`;function ft({onUploadSuccess:e}){let{t:r}=Y(),[o,c]=s(!1),l=n(null),d=i(async t=>{c(!0);let n=new FormData;n.append(`file`,t);let r=localStorage.getItem(`camstack_admin_token`)??``;try{(await(await fetch(h(`/api/addons/upload`),{method:`POST`,headers:{Authorization:`Bearer ${r}`},body:n})).json()).success&&e()}finally{c(!1)}},[e]);return t(u,{children:[a(`input`,{ref:l,type:`file`,accept:dt,onChange:i(e=>{let t=e.target.files?.[0];t&&d(t),e.target.value=``},[d]),className:`hidden`}),t(`button`,{type:`button`,onClick:()=>l.current?.click(),disabled:o,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:[o?a(x,{className:`w-3.5 h-3.5 animate-spin`}):a(m,{className:`w-3.5 h-3.5`}),o?r(`addons.addonUploadZone.uploading`,`Uploading...`):r(`addons.addonUploadZone.upload`,`Upload`)]})]})}var pt=/```[^\n]*\n([\s\S]*?)```/g;function mt(e){let t=[],n=0;for(let r of e.matchAll(pt)){let i=r.index??0;i>n&&t.push({kind:`text`,body:e.slice(n,i)}),t.push({kind:`code`,body:r[1]??``}),n=i+r[0].length}return n<e.length&&t.push({kind:`text`,body:e.slice(n)}),t}function ht(e){let t=e.trim();return t.startsWith(`https://`)||t.startsWith(`http://`)?t:null}function gt(e,t){let n=[],r=/(\*\*[^*]+\*\*|`[^`]+`|\[[^\]]+\]\([^)]+\))/g,i=0,o=0;for(let s of e.matchAll(r)){let r=s.index??0;r>i&&n.push(e.slice(i,r));let c=s[0],l=`${t}-${o}`;if(o+=1,c.startsWith(`**`))n.push(a(`strong`,{children:c.slice(2,-2)},l));else if(c.startsWith("`"))n.push(a(`code`,{className:`font-mono text-[0.9em]`,children:c.slice(1,-1)},l));else{let e=/^\[([^\]]+)\]\(([^)]+)\)$/.exec(c),t=e?.[1]??c,r=e?ht(e[2]??``):null;n.push(r?a(`a`,{href:r,target:`_blank`,rel:`noreferrer noopener`,className:`text-primary underline`,children:t},l):a(`span`,{children:t},l))}i=r+c.length}return i<e.length&&n.push(e.slice(i)),n}function _t(e,t){let n=e.split(`
5
- `),r=[],i=[],o=[],s=0,c=()=>{if(i.length===0)return;let e=i.join(` `).trim();i=[],e.length!==0&&(r.push(a(`p`,{className:`mb-2 last:mb-0`,children:gt(e,`${t}-p-${s}`)},`${t}-p-${s}`)),s+=1)},l=()=>{if(o.length===0)return;let e=o;o=[],r.push(a(`ul`,{className:`mb-2 list-disc pl-4 last:mb-0`,children:e.map((e,n)=>a(`li`,{children:gt(e,`${t}-li-${s}-${n}`)},`${t}-li-${s}-${n}`))},`${t}-ul-${s}`)),s+=1};for(let e of n){let n=/^(#{1,3})\s+(.*)$/.exec(e),u=/^\s*[-*]\s+(.*)$/.exec(e);if(n){c(),l();let e=n[1]?.length??1,i=gt(n[2]??``,`${t}-h-${s}`),o=e===1?`text-sm font-semibold mb-2`:`text-xs font-semibold mb-1.5 mt-2`;r.push(a(e===1?`h3`:`h4`,{className:o,children:i},`${t}-h-${s}`)),s+=1;continue}if(u){c(),o=[...o,u[1]??``];continue}if(e.trim().length===0){c(),l();continue}l(),i=[...i,e.trim()]}return c(),l(),r}function vt({markdown:e}){return a(`div`,{className:`text-xs text-foreground leading-relaxed`,children:mt(e).map((e,t)=>e.kind===`code`?a(`pre`,{className:`mb-2 overflow-auto rounded-md bg-surface-hover p-2 font-mono text-[10px] last:mb-0`,children:e.body.replace(/\n$/,``)},`code-${t}`):a(`div`,{children:_t(e.body,`b${t}`)},`text-${t}`))})}c();function yt(e){return e.replace(/^@camstack\/(addon-)?/,``)}function bt(e,t,n){let r=et(e,n);return r.some(e=>e.version===t)?r:[{version:t,distTags:[],deprecated:void 0},...r]}function xt({pending:e,failed:n,body:r,missing:i}){let{t:o}=Y();return e?t(`div`,{className:`flex items-center gap-2 py-6 text-xs text-foreground-subtle`,children:[a(x,{className:`h-3.5 w-3.5 animate-spin`}),o(`addons.installDialog.loadingDocument`,`Loading…`)]}):n||r===void 0?a(`p`,{className:`py-4 text-xs text-danger`,children:o(`addons.installDialog.couldNotLoadDocument`,`Could not load this file from the registry.`)}):r.status===`ok`&&r.markdown!==void 0?a(vt,{markdown:r.markdown}):r.status===`error`?a(`p`,{className:`py-4 text-xs text-danger`,children:o(`addons.installDialog.documentError`,`Could not load this file. {{message}}`,{message:r.message??``})}):a(`p`,{className:`py-4 text-xs text-foreground-subtle`,children:i})}function St({target:e,installing:n,installError:r,onClose:i,onInstall:o}){let{t:c}=Y(),[l,u]=s(e.version),[d,f]=s(!1),p=I({name:e.name}),m=P({name:e.name,version:l}),h=p.data??[],g=tt(h),_=bt(h,l,d),v=m.data;return a(q,{open:!0,onOpenChange:e=>!e&&i(),children:t(Ee,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:[a(De,{children:a(fe,{children:c(`addons.installDialog.title`,`Install {{name}}`,{name:yt(e.name)})})}),t(ve,{className:`space-y-3`,children:[a(`p`,{className:`font-mono text-[10px] text-foreground-subtle`,children:e.name}),e.description.length>0&&a(`p`,{className:`text-xs text-foreground`,children:e.description}),t(`div`,{className:`space-y-1.5`,children:[a(`span`,{className:`text-[10px] text-foreground-subtle`,children:c(`addons.installDialog.version`,`Version`)}),a(V,{"aria-label":c(`addons.installDialog.version`,`Version`),value:l,options:_.map(e=>({value:e.version,label:$e(e)?c(`addons.installDialog.deprecatedVersion`,`{{version}} (deprecated)`,{version:e.version}):e.version})),onChange:e=>u(e.target.value)}),p.isError&&a(`p`,{className:`text-[10px] text-danger`,children:c(`addons.versionPicker.registryError`,`Could not load versions from the registry.`)}),g>0&&a(K,{type:`button`,variant:`ghost`,size:`sm`,className:`h-auto justify-start px-0 text-[10px] font-normal text-foreground-subtle underline`,onClick:()=>f(e=>!e),children:d?c(`addons.versionPicker.hideOlder`,`Hide older versions`):c(`addons.versionPicker.showOlder`,`Show older versions ({{count}})`,{count:g})})]}),t(H,{defaultValue:`readme`,children:[t(M,{children:[a(F,{value:`readme`,children:c(`addons.installDialog.readme`,`README`)}),a(F,{value:`changelog`,children:c(`addons.installDialog.changelog`,`CHANGELOG`)})]}),a(W,{value:`readme`,children:a(`div`,{className:`max-h-80 overflow-auto rounded-md border border-border bg-background p-3`,children:a(xt,{pending:m.isPending,failed:m.isError,body:v?.readme,missing:c(`addons.installDialog.missingReadme`,`This package has no README.`)})})}),a(W,{value:`changelog`,children:a(`div`,{className:`max-h-80 overflow-auto rounded-md border border-border bg-background p-3`,children:a(xt,{pending:m.isPending,failed:m.isError,body:v?.changelog,missing:c(`addons.installDialog.missingChangelog`,`This package has no CHANGELOG.`)})})})]}),r!=null&&r.length>0&&a(`p`,{className:`text-xs text-danger`,children:r})]}),t(G,{children:[a(K,{type:`button`,variant:`outline`,size:`sm`,onClick:i,children:c(`common.cancel`,`Cancel`)}),a(K,{type:`button`,size:`sm`,disabled:n||l.length===0,onClick:()=>o(e.name,l),children:n?a(x,{className:`h-3.5 w-3.5 animate-spin`}):c(`addons.installDialog.install`,`Install`)})]})]})})}var Ct=new Set([`@camstack/system`,`@camstack/types`,`@camstack/sdk`,`@camstack/ui-library`,`@camstack/addon-agent-ui`]);function wt(e,t){let n=new Map;for(let r of e){if(r.isHub||r.onHub||Ct.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 Tt({selectedNode:e}){let{t:n}=Y(),{data:r}=U(Ye,{staleTime:Xe});if(r===void 0)return null;let i=wt(r.installations,e),o=r.unreachable.filter(t=>e.isHub||t.nodeId===e.id);return i.length===0&&o.length===0?null:t(`div`,{className:`rounded-lg border border-warning/30 bg-warning/5 px-3 py-2.5 space-y-2`,children:[t(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold text-foreground`,children:[a(re,{className:`h-3.5 w-3.5 text-warning`}),e.isHub?n(`addons.nodeOnlyPackagesPanel.installedOnAgentsButNot`,`Installed on agents but not on the hub`):n(`addons.nodeOnlyPackagesPanel.installedOnButNotOn`,`Installed on {{name}} but not on the hub`,{name:e.name})]}),o.length>0&&a(`div`,{className:`text-[10px] text-foreground-subtle`,children:n(`addons.nodeOnlyPackagesPanel.unreachable`,{nodes:o.map(e=>e.nodeId).join(`, `)})}),i.map(n=>t(`div`,{className:`flex items-center justify-between gap-3 flex-wrap rounded-md border border-border bg-surface px-3 py-2`,children:[t(`div`,{className:`min-w-0`,children:[a(`div`,{className:`text-xs font-mono text-foreground break-all`,children:n.packageName}),a(`div`,{className:`text-[10px] text-foreground-subtle`,children:n.rows.map(e=>`${e.nodeName}${e.version===null?``:` ${e.version}`}${e.isOnline?``:` (offline)`}`).join(` · `)})]}),a(Qe,{packageName:n.packageName,displayName:n.packageName,selectedNode:e,hideNodeAction:e.isHub})]},n.packageName))]})}function Et({addon:e,installing:n,onInstall:r}){let{t:i}=Y();return t(`div`,{className:`flex items-center gap-3 px-3 py-2 hover:bg-surface-hover transition-colors`,children:[a(`div`,{className:`w-6 h-6 rounded-md bg-primary/10 flex items-center justify-center text-primary text-[9px] font-bold shrink-0`,children:e.name.replace(`@camstack/addon-`,``).charAt(0).toUpperCase()}),t(`div`,{className:`flex-1 min-w-0`,children:[t(`div`,{className:`flex items-baseline gap-2 min-w-0`,children:[a(`span`,{className:`text-[11px] font-semibold break-words`,children:e.name.replace(/^@camstack\/(addon-)?/,``)}),t(`span`,{className:`text-[10px] text-foreground-subtle shrink-0`,children:[`v`,e.version]})]}),a(`div`,{className:`font-mono text-[9px] text-foreground-subtle/80 truncate`,children:e.name}),e.description&&a(`div`,{className:`text-[10px] text-foreground-subtle truncate`,children:e.description})]}),e.installed?a(xe,{variant:`success`,icon:a(T,{className:`h-3 w-3`}),children:e.installedVersion??i(`system.capabilityCatalog.installed`,`Installed`)}):t(K,{size:`sm`,onClick:()=>r(e),disabled:n,className:`shrink-0`,children:[n?a(x,{className:`h-3 w-3 animate-spin`}):a(v,{className:`h-3 w-3`}),i(`system.capabilityCatalog.install`,`Install`)]})]})}function Dt({capability:e,installing:n,onInstall:r}){let{t:i}=Y(),{data:o,isPending:s,isError:c}=le({capability:e}),l;if(c)l=a(`div`,{className:`px-3 py-2 text-xs text-danger`,children:i(`system.capabilityCatalog.couldNotSearchTheNpm`,`Could not search the npm catalog right now. Try again in a moment.`)});else if(s||o===void 0)l=t(`div`,{className:`flex items-center gap-2 px-3 py-2 text-xs text-foreground-subtle`,children:[a(x,{className:`h-3 w-3 animate-spin`}),i(`system.capabilityCatalog.searchingTheNpmCatalog`,`Searching the npm catalog…`)]});else{let t=o.filter(e=>!e.installed);l=t.length===0?a(`div`,{className:`px-3 py-2 text-xs text-foreground-subtle`,children:o.length===0?i(`system.capabilityCatalog.noPublishedAddonDeclaresThe`,`No published addon declares the "{{capability}}" capability.`,{capability:e}):i(`system.capabilityCatalog.everyPublishedAddonThatDeclares`,`Every published addon that declares "{{capability}}" is already installed.`,{capability:e})}):a(`div`,{className:`divide-y divide-border`,children:t.map(e=>a(Et,{addon:e,installing:n,onInstall:r},e.name))})}return t(`section`,{className:`rounded-md border border-border bg-surface overflow-hidden`,"aria-label":i(`system.capabilityCatalog.availableToInstall`,`Available to install`),children:[a(`h2`,{className:`px-3 py-1.5 text-[10px] uppercase tracking-wide text-foreground-subtle border-b border-border`,children:i(`system.capabilityCatalog.availableToInstall`,`Available to install`)}),l]})}c();function Ot(e){return e===`npm`||e===`dev`?e:null}var kt=`rounded-full border border-primary bg-primary/10 px-2 py-0.5 text-[10px] text-foreground`,At=`rounded-full border border-border px-2 py-0.5 text-[10px] text-foreground-muted hover:bg-surface-hover`,jt=[{seconds:900,label:`15m`},{seconds:3600,label:`1h`},{seconds:21600,label:`6h`},{seconds:43200,label:`12h`},{seconds:86400,label:`24h`}],Mt={id:`hub`,name:`Hub`,isHub:!0,isOnline:!0};function Nt(e,t){let n=e??`hub-only`;return n===`any-node`?!0:n===`hub-only`?t:!t}function Pt(e){return e===`local`?`dev`:`npm`}function Ft(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 It(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 Lt({addons:c,clusterStatus:u,selectedNode:f,onRefresh:p,listPhase:m}){let{t:h}=Y(),g=l(),[_,b]=s(``),S=e(_),[C,w]=s(!1),T=n(null);o(()=>{if(!C)return;let e=e=>{T.current&&!T.current.contains(e.target)&&w(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[C]);let{data:E}=pe({nodeId:f.id}),ee=r(()=>{let e=new Map;for(let t of E??[])e.set(t.name,t.latestVersion);return e},[E]),ne=r(()=>(E??[]).filter(e=>!e.isSystem).length,[E]),[re,O]=s(()=>new Set),[ie,k]=s(()=>new Map),ae=i(e=>{O(t=>new Set(t).add(e))},[]),A=i(e=>{O(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[]),ce=i((e,t)=>{k(n=>new Map(n).set(e,t))},[]),M=i(e=>{k(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),N=Se({onMutate:e=>{ae(e.name),M(e.name)},onSuccess:(e,t)=>{A(t.name);let n=e;if(n&&n.success===!1){ce(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)=>{A(t.name),ce(t.name,e instanceof Error?e.message:String(e))}}),P=Be(),F=n(new Set);o(()=>{let e=new Set;for(let[t,n]of P)Re(n)&&e.add(t);let t=[...F.current].some(t=>!e.has(t));F.current=e,t&&(g.invalidateQueries({queryKey:[[`addons`]]}),g.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]}))},[P,g]);let{data:I}=z(void 0),L=j({onSuccess:()=>{g.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),R=ge({onSuccess:()=>{g.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),{data:B,isFetching:fe}=le({query:S||void 0},{enabled:C}),V=ue(),{data:H}=se(void 0),U=H?.requestedAt,[me,W]=s(null),[he,_e]=s(!1);o(()=>{if(H?.kind===`framework-bulk-update`&&H.requestedAt!==me){W(H.requestedAt),_e(!0);let e=window.setTimeout(()=>_e(!1),6e3);return()=>window.clearTimeout(e)}},[U,me,H]),D();let ve=i(async()=>{let e=(E??[]).filter(e=>!e.isSystem);if(e.length!==0){if(!f.isHub){for(let t of e)await N.mutateAsync({name:t.name,version:t.latestVersion,nodeId:f.id});return}await V.mutateAsync({kind:`update`,targets:e.map(e=>({name:e.name,version:e.latestVersion})),nodeIds:[f.id]})}},[E,f.id,f.isHub,V,N]),[ye,G]=s(null),[be,xe]=s(null),K=e=>{xe(null),G(e)},q=de({onSuccess:()=>{G(null),xe(null),g.invalidateQueries({queryKey:[[`addons`]]}),g.invalidateQueries({queryKey:[[`addonPages`]]}),g.invalidateQueries({queryKey:[[`capabilities`]]}),g.invalidateQueries({queryKey:[[`integrations`]]})},onError:e=>{xe(e instanceof Error?e.message:`Install failed`)}}),[Ce,we]=s(`type`),[Te,Ee]=s(()=>typeof window>`u`?`grouped`:window.localStorage.getItem(`camstack.addons.viewMode`)===`flat`?`flat`:`grouped`),De=e=>{Ee(e),typeof window<`u`&&window.localStorage.setItem(`camstack.addons.viewMode`,e)},[J,X]=Oe(),Z=J.get(`capability`),ke=J.get(`updatable`)===`1`,Ae=J.get(`error`)===`1`,Q=Ot(J.get(`source`)),Me=i(e=>{let t=new URLSearchParams(J);e?t.set(`updatable`,`1`):t.delete(`updatable`),X(t,{replace:!0})},[J,X]),Pe=i(e=>{let t=new URLSearchParams(J);e?t.set(`error`,`1`):t.delete(`error`),X(t,{replace:!0})},[J,X]),Fe=i(e=>{let t=new URLSearchParams(J);e===null?t.delete(`source`):t.set(`source`,e),X(t,{replace:!0})},[J,X]),Ie=r(()=>c.filter(e=>Ne(e.process)!==null).length,[c]),Le=r(()=>{let e=c.filter(e=>!je(e.manifest.packageName));return f.isHub||(e=e.filter(e=>Nt(e.placement,f.isHub))),Z&&(e=e.filter(e=>(e.manifest.capabilities??[]).some(e=>(typeof e==`string`?e:e.name)===Z))),ke&&(e=e.filter(e=>{let t=e.manifest.packageName;return t!==void 0&&ee.has(t)})),Q!==null&&(e=e.filter(e=>Pt(e.installSource)===Q)),Ae&&(e=e.filter(e=>Ne(e.process)!==null)),e},[c,f.isHub,Z,ke,Q,Ae,ee]),ze=()=>{let e=new URLSearchParams(J);e.delete(`capability`),X(e,{replace:!0})},Ve=Te===`flat`?Le:It(Le),He=r(()=>{let e=[...Ve];switch(Ce){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},[Ve,Ce]);return t(`div`,{className:`space-y-3`,children:[[...ie.entries()].map(([e,n])=>a(`div`,{className:`rounded-md border border-danger/30 bg-danger/5 px-2.5 py-1.5 text-[11px]`,children:t(`div`,{className:`flex items-start justify-between gap-3`,children:[t(`div`,{className:`space-y-0.5`,children:[a(`div`,{className:`font-medium text-danger`,children:h(`systemPage.addons.updateFailed`,{name:e})}),a(`div`,{className:`text-foreground-subtle font-mono`,children:n})]}),a(`button`,{type:`button`,onClick:()=>M(e),className:`text-foreground-subtle hover:text-foreground text-[10px]`,children:h(`common.dismiss`)})]})},e)),t(`div`,{className:`flex items-center gap-x-2 gap-y-1.5 flex-wrap`,children:[t(`div`,{className:`flex items-center gap-1.5`,children:[a(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`admin.system.addons.sort`,`Sort:`)}),t(`select`,{value:Ce,onChange:e=>we(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:[a(`option`,{value:`type`,children:h(`admin.system.addons.bundlesFirst`,`Bundles first`)}),a(`option`,{value:`name`,children:h(`admin.system.addons.name`,`Name`)}),a(`option`,{value:`source`,children:h(`admin.system.addons.installSource`,`Install source`)})]})]}),t(`div`,{className:`flex items-center gap-1.5`,children:[a(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`admin.system.addons.view`,`View:`)}),a(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`grouped`,`flat`].map(e=>a(`button`,{type:`button`,onClick:()=>De(e),className:`px-2 py-1 transition-colors capitalize ${Te===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))})]}),f.isHub&&t(`div`,{className:`flex items-center gap-1.5`,children:[a(d,{className:`h-3 w-3 text-foreground-subtle`}),a(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`admin.system.addons.autoUpdate`,`Auto-Update:`)}),a(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`off`,`latest`,`beta`].map(e=>a(`button`,{type:`button`,onClick:()=>L.mutate({channel:e}),disabled:L.isPending,className:`px-2 py-1 transition-colors capitalize ${I?.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))})]}),f.isHub&&t(`div`,{className:`flex items-center gap-1.5`,children:[a(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`admin.system.addons.checkEvery`,`Check every:`)}),a(`select`,{className:`rounded-md border border-border bg-transparent px-1.5 py-1 text-[10px] font-medium text-foreground-subtle`,value:I?.updateCheckIntervalSeconds??21600,disabled:R.isPending||I===void 0,onChange:e=>{I!==void 0&&R.mutate({channel:I.channel,updateCheckIntervalSeconds:Number(e.target.value)})},children:jt.map(e=>a(`option`,{value:e.seconds,children:e.label},e.seconds))})]}),ne>0&&t(`button`,{type:`button`,onClick:()=>void ve(),disabled:V.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:[V.isPending?a(x,{className:`w-3 h-3 animate-spin`}):a(v,{className:`w-3 h-3`}),V.isPending?h(`admin.system.addons.updating`,`Updating…`):h(`admin.system.addons.updateAll`,`Update All ({{nonSystemUpdateCount}})`,{nonSystemUpdateCount:ne})]})]}),t(`div`,{className:`flex flex-wrap items-center gap-1.5`,role:`group`,"aria-label":h(`admin.system.addons.filterInstalledAddons`,`Filter installed addons`),children:[a(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`admin.system.addons.filter`,`Filter:`)}),[{id:`updatable`,label:h(`admin.system.addons.updatable`,`Updatable`),pressed:ke,toggle:()=>Me(!ke)},{id:`error`,label:h(`admin.system.addons.inError`,`In error ({{count}})`,{count:Ie}),pressed:Ae,toggle:()=>Pe(!Ae)},{id:`npm`,label:`npm`,pressed:Q===`npm`,toggle:()=>Fe(Q===`npm`?null:`npm`)},{id:`dev`,label:h(`admin.system.addons.dev`,`Dev`),pressed:Q===`dev`,toggle:()=>Fe(Q===`dev`?null:`dev`)}].map(e=>a(`button`,{type:`button`,"aria-pressed":e.pressed,onClick:e.toggle,className:e.pressed?kt:At,children:e.label},e.id))]}),t(`div`,{className:`flex flex-col gap-1.5 sm:flex-row sm:items-center sm:gap-2`,children:[t(`div`,{className:`relative flex-1 min-w-0 sm:min-w-[200px]`,ref:T,children:[a(oe,{type:`text`,searchHotkey:!0,value:_,onChange:e=>{b(e.target.value),w(!0)},onFocus:()=>w(!0),placeholder:h(`admin.system.addons.searchAddonsOnNpm`,`Search addons on npm...`),"aria-label":h(`admin.system.addons.searchAddonsOnNpm2`,`Search addons on npm`),disabled:V.isPending,leftSlot:a(te,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),rightSlot:fe?a(x,{className:`h-3 w-3 animate-spin`}):void 0}),C&&B&&B.length>0&&t(`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:[B.length>0&&a(`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:B.length})}),B&&B.length>0&&a(`div`,{className:`max-h-72 overflow-auto divide-y divide-border`,children:B.map(e=>a(Et,{addon:e,installing:q.isPending,onInstall:e=>K({name:e.name,version:e.version,description:e.description})},e.name))})]})]}),a(ft,{onUploadSuccess:()=>{g.invalidateQueries({queryKey:[[`addons`]]}),p()}})]}),Z&&t(`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:[a(`span`,{className:`text-foreground-subtle`,children:h(`admin.system.addons.filteringByCapability`,`Filtering by capability:`)}),a(`span`,{className:`font-mono text-primary font-semibold`,children:Z}),a(`button`,{type:`button`,onClick:ze,className:`ml-auto text-xs text-foreground-subtle hover:text-foreground underline`,children:h(`admin.system.addons.clear`,`Clear`)})]}),Z&&a(Dt,{capability:Z,installing:q.isPending,onInstall:e=>K({name:e.name,version:e.version,description:e.description})}),Z&&Le.length>0&&a(`h2`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:h(`admin.system.addons.installed`,`Installed`)}),he&&t(`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:[a(y,{className:`w-4 h-4 shrink-0 mt-0.5 text-green-400`}),t(`div`,{children:[a(`div`,{className:`text-[11px] font-semibold text-foreground`,children:h(`admin.system.addons.bulkUpdateCompleted`,`Bulk update completed`)}),a(`div`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:h(`admin.system.addons.systemPackagesUpdatedHubRestarted`,`System packages updated — hub restarted successfully.`)})]})]}),m===`pending`&&t(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[a(x,{className:`h-3 w-3 animate-spin`}),h(`admin.system.addons.loadingInstalled`,`Loading installed addons…`)]}),m===`error`&&a(`div`,{className:`text-xs text-danger`,children:h(`admin.system.addons.failedToLoadAddons`,`Failed to load addons`)}),m===`ready`&&Le.length===0&&a(`div`,{className:`text-xs text-foreground-subtle`,children:c.length===0?h(`admin.system.addons.noAddonsInstalled`,`No addons installed`):Z?h(`admin.system.addons.noInstalledAddonDeclaresThe`,`No installed addon declares the "{{capabilityFilter}}" capability. Any addon you can install appears under "Available to install" above.`,{capabilityFilter:Z}):h(`admin.system.addons.noAddonsCompatibleWithPlacement`,`No addons compatible with {{name}} (placement filter active)`,{name:f.name})}),a(`div`,{className:`space-y-1.5`,children:m===`ready`&&He.map(e=>{let t=$(e)?e.bundle.packageName:e.manifest.packageName,n=ee.get(t),r=$(e)?e.representative:e,i=n?e=>N.mutate({name:t,version:e,nodeId:f.id}):void 0,o=P.get(t)??null,s=o!==null&&Re(o);return a(ut,{addon:r,clusterStatus:u?.[r.manifest.id],bundle:$(e)?e.bundle:void 0,availableUpdate:n,isUpdating:re.has(t)||s,jobProgress:o,onUpdate:i,disabledByBulk:V.isPending,selectedNode:f},$(e)?t:e.manifest.id)})}),ye!==null&&a(St,{target:ye,installing:q.isPending,installError:be,onClose:()=>G(null),onInstall:(e,t)=>q.mutate({packageName:e,version:t})})]})}function Rt(){let{t:e}=Y(),r=l(),{data:i}=B(void 0),{nodes:s}=he(),{selection:c,selectNode:u,requestedNodeId:f}=Me(s.length>0?s:[Mt]),p=c.node??Mt,m=p.id,h=s.length>0?c.staleNodeId:null,{data:g,isLoading:_,isError:v}=J({nodeId:m}),y=L(),b=me(),x=y.isPending||b.isPending,S=async()=>{await y.mutateAsync({nodeId:m}),await b.mutateAsync(),r.invalidateQueries({queryKey:[[`addons`]]})},C=n(y);C.current=y;let w=n(f??`hub`);o(()=>{C.current.mutate({nodeId:w.current})},[]);let T=(g??[]).map(Ft).filter(e=>e!==null);return t(ke,{children:[t(`div`,{className:`flex items-center justify-between gap-2 flex-wrap`,children:[a(be,{selectedNodeId:m,onSelect:u}),t(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[!_&&!v&&a(`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})}),t(`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:[a(d,{className:`w-3 h-3 ${x?`animate-spin`:``}`}),e(`admin.system.addons.checkForUpdates`,`Check for updates`)]})]})]}),a(Q,{staleNodeId:h,shownNodeName:p.name}),a(Tt,{selectedNode:p}),a(Lt,{addons:T,clusterStatus:i,selectedNode:p,onRefresh:()=>void S(),listPhase:_?`pending`:v?`error`:`ready`})]})}export{Rt as AddonsPage};