@camstack/addon-admin-ui 1.2.638 → 1.2.640

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 (107) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/assets/Addons-DdPzePEg.js +5 -0
  3. package/dist/assets/{AdminPage-_ITsYONa.js → AdminPage-Bx3Zddhd.js} +1 -1
  4. package/dist/assets/{AdminSectionedPage-Dj-OV5CA.js → AdminSectionedPage-NmuaR24u.js} +1 -1
  5. package/dist/assets/{AiProfiles-DyZj94wt.js → AiProfiles-DyP-rxts.js} +2 -2
  6. package/dist/assets/{BootstrapSettingsForm-BXzPZqWx.js → BootstrapSettingsForm-DcVyl956.js} +1 -1
  7. package/dist/assets/{Build-BhmtFpYr.js → Build-CFqeg7F5.js} +3 -3
  8. package/dist/assets/{Calendars-7GvrQigo.js → Calendars-DiTqm_9n.js} +1 -1
  9. package/dist/assets/{CameraGrids-Bb9wTIKp.js → CameraGrids-D9Me_qI5.js} +1 -1
  10. package/dist/assets/{Cluster-C-zIpXGP.js → Cluster-BgACH3Ob.js} +1 -1
  11. package/dist/assets/{CompositionBlockEditor-N5UMRfDt.js → CompositionBlockEditor-CPL8HxNy.js} +2 -2
  12. package/dist/assets/{CompositionEditorPage-CHhoRf0w.js → CompositionEditorPage-BjYhCEY8.js} +1 -1
  13. package/dist/assets/{Data-DNK8sdoy.js → Data-C6ouohrn.js} +2 -2
  14. package/dist/assets/DeviceDetail-gU6d3Mhf.js +2 -0
  15. package/dist/assets/{Devices-Btn-7OLF.js → Devices-BrD0HFbV.js} +1 -1
  16. package/dist/assets/{EmbedDevicePage-Bx1loP2O.js → EmbedDevicePage-DH_FMptC.js} +1 -1
  17. package/dist/assets/{EmbedPlayerPage-J9i3kCrj.js → EmbedPlayerPage-CSj7w6uE.js} +1 -1
  18. package/dist/assets/History-BB029srN.js +1 -0
  19. package/dist/assets/Identity-BPLJEabw.js +1 -0
  20. package/dist/assets/InstancesTable-HtGIceoE.js +1 -0
  21. package/dist/assets/IntegrationDetail-_bD7_xo4.js +1 -0
  22. package/dist/assets/{Integrations-D7TYxG9-.js → Integrations-BDXAnQ8J.js} +2 -2
  23. package/dist/assets/Integrations-meMKpbLv.js +1 -0
  24. package/dist/assets/{Library-DsZ1hTgf.js → Library-D4k0yMV-.js} +1 -1
  25. package/dist/assets/Locations-DgEyIQpA.js +3 -0
  26. package/dist/assets/{Logs-DXXtgKOb.js → Logs-3xRjA-vl.js} +1 -1
  27. package/dist/assets/{MaskShapeCanvas-C_kXMOhj.js → MaskShapeCanvas-DJ_OiP9l.js} +1 -1
  28. package/dist/assets/{MotionZonesSettings-CarcYpLx.js → MotionZonesSettings-BQdso6sG.js} +1 -1
  29. package/dist/assets/{MyAccess-D8NtdZSw.js → MyAccess-BKqT5pC4.js} +1 -1
  30. package/dist/assets/{Network-DhA7thGL.js → Network-BHofs-hD.js} +1 -1
  31. package/dist/assets/{NodeAddonsSettingsPanel-o9q4_Y7B.js → NodeAddonsSettingsPanel-DZ3CezzG.js} +2 -2
  32. package/dist/assets/{Notifications-BmZy88k1.js → Notifications-Cumkb_K2.js} +1 -1
  33. package/dist/assets/{Pipeline-CazRA6DH.js → Pipeline-ZF9MP80_.js} +1 -1
  34. package/dist/assets/{PrivacyMaskSettings-BCxCYZMd.js → PrivacyMaskSettings-DAG7B3VB.js} +1 -1
  35. package/dist/assets/Recordings-D2RSF9Rr.js +1 -0
  36. package/dist/assets/{RemoteGrid-CDLuEg4n.js → RemoteGrid-Dt4uIt1Z.js} +1 -1
  37. package/dist/assets/{ScanSubnetEditor-L1fLOCgh.js → ScanSubnetEditor-BHznnP7k.js} +1 -1
  38. package/dist/assets/{SceneMonitorEditor-C6ytHNuF.js → SceneMonitorEditor-Cx1CN3VF.js} +1 -1
  39. package/dist/assets/SessionsList-o9bd3BCc.js +2 -0
  40. package/dist/assets/{Showroom-BjwUl_qA.js → Showroom-BvsWJ2TJ.js} +1 -1
  41. package/dist/assets/StorageLocationsTable-fVPGOmdw.js +1 -0
  42. package/dist/assets/{System-KS6XUNN7.js → System-DYEcdvM2.js} +1 -1
  43. package/dist/assets/{Templates-BmQmXptV.js → Templates-DkkfRrhZ.js} +1 -1
  44. package/dist/assets/{Terminal-Rm3EaYyP.js → Terminal-XfuBHeK9.js} +5 -3
  45. package/dist/assets/{TrainingProviders-DHoX9yR2.js → TrainingProviders-DXyPXqoM.js} +1 -1
  46. package/dist/assets/{Viewer-XTh3fjp9.js → Viewer-5CsQbcga.js} +1 -1
  47. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-BezlQnHO.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-ZCcraxvZ.js} +1 -1
  48. package/dist/assets/{action-draft-DztPBE6P.js → action-draft-A6STHpB1.js} +1 -1
  49. package/dist/assets/{addon-icons-context-Bb2eBZv3.js → addon-icons-context-CMM6YhwC.js} +1 -1
  50. package/dist/assets/{ai-page.helpers-CaFgUuvz.js → ai-page.helpers-0Z4OXnZk.js} +1 -1
  51. package/dist/assets/{assignment-candidates-DbC-TLvF.js → assignment-candidates-GNFdnK9G.js} +1 -1
  52. package/dist/assets/{authed-media-C0rONCq5.js → authed-media-DPBqtwck.js} +1 -1
  53. package/dist/assets/{board-model-BvS324KY.js → board-model-DEAHfd9r.js} +1 -1
  54. package/dist/assets/client-C2CJWmle.js +921 -0
  55. package/dist/assets/{create-composition-B8s7rb7B.js → create-composition-KoNE2vVb.js} +2 -2
  56. package/dist/assets/device-detail-IHO84bFl.js +1 -0
  57. package/dist/assets/{device-integration-icon-D4lkKdpB.js → device-integration-icon-MNT8PaG0.js} +1 -1
  58. package/dist/assets/device-picker-model-oUoi1Gi_.js +1 -0
  59. package/dist/assets/dist-16WNSSme.js +921 -0
  60. package/dist/assets/{dist-AhzFc2N5.js → dist-B4YTGUII.js} +1 -1
  61. package/dist/assets/{format-DIfkCsNl.js → format-CJg95CNX.js} +1 -1
  62. package/dist/assets/{hostInit-Cc2xXBkZ.js → hostInit-BX1TY8uK.js} +1 -1
  63. package/dist/assets/{i18n-DmOCWVEq.js → i18n-O-Eprd0i.js} +1 -1
  64. package/dist/assets/{icons-B5aMnrp4.js → icons-PG_DZwvv.js} +1 -1
  65. package/dist/assets/index-CGFg_Y8i.js +4 -0
  66. package/dist/assets/index-Cy-qb6UR.css +2 -0
  67. package/dist/assets/{linked-devices-model-CCjfyGL1.js → linked-devices-model-C8kBgXMY.js} +1 -1
  68. package/dist/assets/{mf-entry-bootstrap-0-ff862d80.js → mf-entry-bootstrap-0-4df4eafb.js} +2 -2
  69. package/dist/assets/mount-oUoi1Gi_.js +1 -0
  70. package/dist/assets/{notification-rule-status-D1G2O8do.js → notification-rule-status-BPOiB8zG.js} +1 -1
  71. package/dist/assets/{player-overlays-BZByYYB8.js → player-overlays-DZpOTTfF.js} +1 -1
  72. package/dist/assets/remoteEntry-tdnduwBD.js +1 -0
  73. package/dist/assets/src-DVxPN5-G.js +169 -0
  74. package/dist/assets/{sso-popup-CBrgyqXr.js → sso-popup-DiEJ5hpi.js} +1 -1
  75. package/dist/assets/step-inspector-model-DigZxReg.js +1 -0
  76. package/dist/assets/{use-scenes-feed-3gS-l6TV.js → use-scenes-feed-CunxYflQ.js} +1 -1
  77. package/dist/assets/{use-stationary-objects-6FuPeLm0.js → use-stationary-objects-CsSUUOTV.js} +1 -1
  78. package/dist/assets/{useAdminDeviceRemoval-B-qCzajf.js → useAdminDeviceRemoval-ooKQPd3R.js} +1 -1
  79. package/dist/assets/useEventInvalidation-oUoi1Gi_.js +1 -0
  80. package/dist/assets/{useNodeUrlSelection-BSPl0vnb.js → useNodeUrlSelection-xlAbGKP_.js} +1 -1
  81. package/dist/assets/{useTemplateSave-DZcYOuHu.js → useTemplateSave-Dc5HV6VU.js} +1 -1
  82. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-ZzcWUaNn.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-t8Ik-bvG.js} +2 -2
  83. package/dist/index.html +10 -10
  84. package/dist/server/addon.js +43 -172
  85. package/package.json +2 -2
  86. package/dist/assets/Addons-BzsBtyAW.js +0 -5
  87. package/dist/assets/DeviceDetail-Cuc91kn4.js +0 -2
  88. package/dist/assets/History-BQ4O-B-t.js +0 -1
  89. package/dist/assets/Identity-BoO8xvI-.js +0 -1
  90. package/dist/assets/InstancesTable-VqqK1wvv.js +0 -1
  91. package/dist/assets/IntegrationDetail-Bs7hOHDO.js +0 -1
  92. package/dist/assets/Integrations-CqV8OqAX.js +0 -1
  93. package/dist/assets/Locations-DjKqQHFe.js +0 -3
  94. package/dist/assets/Recordings-Ci3f9TFU.js +0 -1
  95. package/dist/assets/SessionsList-Cep2xLCv.js +0 -2
  96. package/dist/assets/StorageLocationsTable-DQVW1xnr.js +0 -1
  97. package/dist/assets/client-mnldOm50.js +0 -921
  98. package/dist/assets/device-detail-sXpv_vUg.js +0 -1
  99. package/dist/assets/device-picker-model-CLxwtH6P.js +0 -1
  100. package/dist/assets/dist-jfEaRcCl.js +0 -921
  101. package/dist/assets/index-CcY1r6e1.css +0 -2
  102. package/dist/assets/index-D7Qm6t2n.js +0 -4
  103. package/dist/assets/mount-CLxwtH6P.js +0 -1
  104. package/dist/assets/remoteEntry-BFXSwA_z.js +0 -1
  105. package/dist/assets/src-DKRp5NPI.js +0 -169
  106. package/dist/assets/step-inspector-model-rtgdeDgk.js +0 -1
  107. package/dist/assets/useEventInvalidation-CLxwtH6P.js +0 -1
package/dist/index.html CHANGED
@@ -150,20 +150,20 @@
150
150
  })
151
151
  })()
152
152
  </script>
153
- <script type="module" crossorigin src="./assets/mf-entry-bootstrap-0-ff862d80.js"></script>
153
+ <script type="module" crossorigin src="./assets/mf-entry-bootstrap-0-4df4eafb.js"></script>
154
154
  <link rel="modulepreload" crossorigin href="./assets/chevron-down-CBb-F8DT.js">
155
155
  <link rel="modulepreload" crossorigin href="./assets/__vite-browser-external-BCAtXlNQ.js">
156
- <link rel="modulepreload" crossorigin href="./assets/client-mnldOm50.js">
157
- <link rel="modulepreload" crossorigin href="./assets/player-overlays-BZByYYB8.js">
158
- <link rel="modulepreload" crossorigin href="./assets/src-DKRp5NPI.js">
156
+ <link rel="modulepreload" crossorigin href="./assets/client-C2CJWmle.js">
157
+ <link rel="modulepreload" crossorigin href="./assets/player-overlays-DZpOTTfF.js">
158
+ <link rel="modulepreload" crossorigin href="./assets/src-DVxPN5-G.js">
159
159
  <link rel="modulepreload" crossorigin href="./assets/useTranslation-BJr-n0es.js">
160
- <link rel="modulepreload" crossorigin href="./assets/i18n-DmOCWVEq.js">
160
+ <link rel="modulepreload" crossorigin href="./assets/i18n-O-Eprd0i.js">
161
161
  <link rel="modulepreload" crossorigin href="./assets/video-BV-3O_ZC.js">
162
- <link rel="modulepreload" crossorigin href="./assets/mount-CLxwtH6P.js">
163
- <link rel="modulepreload" crossorigin href="./assets/addon-icons-context-Bb2eBZv3.js">
164
- <link rel="modulepreload" crossorigin href="./assets/sso-popup-CBrgyqXr.js">
165
- <link rel="stylesheet" crossorigin href="./assets/index-CcY1r6e1.css">
166
- <link rel="modulepreload" crossorigin href="./assets/hostInit-Cc2xXBkZ.js"><link rel="modulepreload" crossorigin href="./assets/index-D7Qm6t2n.js"><link rel="modulepreload" crossorigin href="./assets/remoteEntry-BFXSwA_z.js"><link rel="modulepreload" crossorigin href="./assets/_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-BezlQnHO.js"><link rel="modulepreload" crossorigin href="./assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js"><link rel="modulepreload" crossorigin href="./assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_client__loadShare__.js-8kv6pj9W.js"><link rel="modulepreload" crossorigin href="./assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.js-DzoL8nR8.js"><link rel="modulepreload" crossorigin href="./assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.js-BPba2g2p.js"><link rel="modulepreload" crossorigin href="./assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-ZBKFTPET.js"></head>
162
+ <link rel="modulepreload" crossorigin href="./assets/mount-oUoi1Gi_.js">
163
+ <link rel="modulepreload" crossorigin href="./assets/addon-icons-context-CMM6YhwC.js">
164
+ <link rel="modulepreload" crossorigin href="./assets/sso-popup-DiEJ5hpi.js">
165
+ <link rel="stylesheet" crossorigin href="./assets/index-Cy-qb6UR.css">
166
+ <link rel="modulepreload" crossorigin href="./assets/hostInit-BX1TY8uK.js"><link rel="modulepreload" crossorigin href="./assets/index-CGFg_Y8i.js"><link rel="modulepreload" crossorigin href="./assets/remoteEntry-tdnduwBD.js"><link rel="modulepreload" crossorigin href="./assets/_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-ZCcraxvZ.js"><link rel="modulepreload" crossorigin href="./assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js"><link rel="modulepreload" crossorigin href="./assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_client__loadShare__.js-8kv6pj9W.js"><link rel="modulepreload" crossorigin href="./assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.js-DzoL8nR8.js"><link rel="modulepreload" crossorigin href="./assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.js-BPba2g2p.js"><link rel="modulepreload" crossorigin href="./assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-ZBKFTPET.js"></head>
167
167
  <body>
168
168
  <div id="root"></div>
169
169
  <!-- Lock the app shell at 1x zoom. iOS Safari ignores `user-scalable=no`
@@ -803,7 +803,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
803
803
  return EventCategory;
804
804
  }({});
805
805
  //#endregion
806
- //#region ../types/dist/composed-stable-id-jnvhwGoH.mjs
806
+ //#region ../types/dist/composed-stable-id-DFNyOFzz.mjs
807
807
  /**
808
808
  import { errMsg } from '@camstack/types'
809
809
  * Extract a human-readable message from an unknown error value.
@@ -816,6 +816,7 @@ function errMsg(err) {
816
816
  }
817
817
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
818
818
  DeviceType["Camera"] = "camera";
819
+ /** Legacy stored value, read only by the hub-to-integration migrations; no live device carries it. */
819
820
  DeviceType["Hub"] = "hub";
820
821
  DeviceType["Light"] = "light";
821
822
  DeviceType["Siren"] = "siren";
@@ -5894,7 +5895,7 @@ var ZodIssueCode = {
5894
5895
  var ZodFirstPartyTypeKind;
5895
5896
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5896
5897
  //#endregion
5897
- //#region ../types/dist/sleep-Cw1uUXvl.mjs
5898
+ //#region ../types/dist/sleep-D_NpiLFP.mjs
5898
5899
  /**
5899
5900
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5900
5901
  * window to float samples (D455).
@@ -12950,10 +12951,6 @@ var CAMERA_CAP_VOCABULARY = {
12950
12951
  scope: "device",
12951
12952
  noun: t("Admin link", "Link di amministrazione")
12952
12953
  },
12953
- "device-discovery": {
12954
- scope: "device",
12955
- noun: t("Discovery", "Rilevamento dispositivi")
12956
- },
12957
12954
  "device-extension": {
12958
12955
  scope: "device",
12959
12956
  noun: t("Device extension", "Estensione del dispositivo")
@@ -14429,7 +14426,6 @@ var CAP_NAMES = Object.freeze([
14429
14426
  "device-admin-link",
14430
14427
  "device-adoption",
14431
14428
  "device-credentials",
14432
- "device-discovery",
14433
14429
  "device-export",
14434
14430
  "device-extension",
14435
14431
  "device-history",
@@ -15051,13 +15047,6 @@ Object.freeze({
15051
15047
  "valueType": "string"
15052
15048
  }
15053
15049
  ],
15054
- "device-discovery": [{
15055
- "path": "lastDiscoveryAt",
15056
- "valueType": "number"
15057
- }, {
15058
- "path": "lastError",
15059
- "valueType": "string"
15060
- }],
15061
15050
  "device-export": [
15062
15051
  {
15063
15052
  "path": "linkState",
@@ -16509,7 +16498,7 @@ Object.freeze({
16509
16498
  }
16510
16499
  });
16511
16500
  //#endregion
16512
- //#region ../types/dist/implemented-methods-OitwyO1Y.mjs
16501
+ //#region ../types/dist/implemented-methods-M5aguGon.mjs
16513
16502
  /**
16514
16503
  * The ffmpeg build every CamStack node downloads, per platform and arch.
16515
16504
  *
@@ -44212,7 +44201,7 @@ object({
44212
44201
  * is irrelevant; the array is treated as a set by consumers. */
44213
44202
  hiddenChildIds: array(number$1()).readonly()
44214
44203
  });
44215
- DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Light, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Cover, DeviceType.Lock, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Generic, method(object({
44204
+ DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Cover, DeviceType.Lock, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Generic, method(object({
44216
44205
  deviceId: number$1().int().nonnegative(),
44217
44206
  childDeviceId: number$1().int().nonnegative(),
44218
44207
  hidden: boolean()
@@ -48850,7 +48839,7 @@ DeviceType.MediaPlayer, optionalMethod(deviceOnly, _void(), {
48850
48839
  kind: "mutation",
48851
48840
  auth: "protected"
48852
48841
  });
48853
- DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.EventEmitter, 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.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Heater, DeviceType.Dryer, DeviceType.Gateway, DeviceType.HeatPump, DeviceType.Camera, DeviceType.Fan, DeviceType.Lock, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Gateway, DeviceType.Hub, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.MediaPlayer;
48842
+ DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.EventEmitter, 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.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Heater, DeviceType.Dryer, DeviceType.Gateway, DeviceType.HeatPump, DeviceType.Camera, DeviceType.Fan, DeviceType.Lock, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Gateway, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.MediaPlayer;
48854
48843
  var NUMBER = {
48855
48844
  kind: "fixed",
48856
48845
  result: ["number"]
@@ -50243,27 +50232,35 @@ var DeviceAdminLinkSchema = object({
50243
50232
  });
50244
50233
  method(object({ deviceId: number$1().int().nonnegative() }), DeviceAdminLinkSchema.nullable(), { auth: "admin" });
50245
50234
  /**
50246
- * device-discovery — device-scoped capability for parents that host /
50247
- * enumerate child devices (Reolink Hub / NVR, ONVIF gateway, future
50248
- * integrations). The parent advertises a list of discoverable children,
50249
- * and the operator promotes a subset to real devices via `adoptDevice`.
50250
- * Child lifecycle (kernel device create/remove, parent reference) is
50251
- * owned by the framework so a single shared `<DiscoveryPanel />` can
50252
- * drive any integration.
50253
- *
50254
- * Boundaries:
50255
- * - The cap exposes ENUMERATION + ADOPT/RELEASE only. The protocol
50256
- * used to discover children (CGI poll, mDNS, push from hub, ...)
50257
- * is the integration's business; results land in `runtimeState`
50258
- * so the panel can render without a fresh round-trip.
50259
- * - `childNativeId` is integration-defined and must be stable across
50260
- * reboots so re-discovery doesn't duplicate adopted children.
50261
- * - `adoptDevice` returns the new `deviceId` so the UI can navigate
50262
- * directly to the freshly-created child's settings page.
50263
- */
50264
- /**
50265
- * Status enum for a discovered device. Mirrors the Reolink simpleEvent
50266
- * lifecycle (`online` / `sleeping` / `offline`) — generic enough for
50235
+ * `device-adoption` — generic discovery + adoption surface,
50236
+ * system-scoped collection (one provider per integration addon), routed
50237
+ * by explicit `{ addonId }` on direct `deviceAdoption.*` calls — the same
50238
+ * pin model as `connection-test`. The admin UI keeps using
50239
+ * `deviceManager.adoption*` (which already threads `addonId`). The de-HA-ified
50240
+ * successor to `ha-discovery`:
50241
+ * keyed by `integrationId` (the addon resolves integrationId → broker
50242
+ * internally) rather than a connection-specific `brokerId`, and it
50243
+ * OWNS the shared `DiscoveredChildDevice` candidate type
50244
+ * (declared below) so a single shared adoption modal renders any integration's
50245
+ * candidate tree.
50246
+ *
50247
+ * UI flow (Integrations page → integration detail):
50248
+ * 1. `listCandidates({integrationId, page, pageSize, filter})` →
50249
+ * paginated candidate list, each row collapsed.
50250
+ * 2. User expands a row → `getCandidate({integrationId,
50251
+ * childNativeId})` returns the single candidate (with its nested
50252
+ * `children`) for the accordion render.
50253
+ * 3. User clicks "Adopt" on one or more candidates →
50254
+ * `adopt({integrationId, childNativeIds, perCandidate?})`
50255
+ * materialises one parent CamStack device per candidate plus its
50256
+ * accessory children. `perCandidate[childNativeId]` carries an
50257
+ * optional display-name override + a `hiddenChildIds` pre-hide set
50258
+ * (the parent's `accessories.hiddenChildIds` gates UI visibility).
50259
+ * 4. User clicks "Release" → `release({integrationId, camDeviceId})`
50260
+ * removes the parent + every child from the kernel registry.
50261
+ */
50262
+ /**
50263
+ * Status enum for a discovered device. Generic enough for
50267
50264
  * battery cams, awake cams, and unreachable cams alike.
50268
50265
  */
50269
50266
  var DiscoveredChildStatusSchema = _enum([
@@ -50280,12 +50277,12 @@ var DiscoveredChildDeviceSchema = lazy(() => object({
50280
50277
  /** DeviceType the child should be created with on adopt. */
50281
50278
  type: _enum(DeviceType),
50282
50279
  status: DiscoveredChildStatusSchema,
50283
- /** Free-form integration-specific metadata surfaced in the panel. */
50280
+ /** Free-form integration-specific metadata surfaced in the adoption modal. */
50284
50281
  metadata: object({
50285
50282
  model: string().optional(),
50286
50283
  serialNumber: string().optional(),
50287
50284
  uid: string().optional(),
50288
- /** Reolink: 0-based channel index inside the parent NVR/Hub. */
50285
+ /** Reolink: 0-based channel index inside the parent NVR. */
50289
50286
  rtspChannel: number$1().int().nonnegative().optional(),
50290
50287
  isBattery: boolean().optional(),
50291
50288
  isDoorbell: boolean().optional(),
@@ -50301,86 +50298,24 @@ var DiscoveredChildDeviceSchema = lazy(() => object({
50301
50298
  }).default({}),
50302
50299
  /**
50303
50300
  * `true` when the framework already created a child device for this
50304
- * `childNativeId` under the current parent. The panel uses it to
50301
+ * `childNativeId` under the current parent. The adoption modal uses it to
50305
50302
  * gate the Add/Remove button and surface the existing `deviceId`.
50306
50303
  */
50307
50304
  alreadyAdopted: boolean(),
50308
50305
  /** When `alreadyAdopted=true`, the framework-assigned child device id. */
50309
50306
  adoptedDeviceId: number$1().int().nonnegative().nullable(),
50310
- /** Capability names the candidate advertises — integrations populate, Hubs omit. */
50307
+ /** Capability names the candidate advertises — integrations populate, flat enumerations omit. */
50311
50308
  capabilities: array(string()).readonly().optional(),
50312
- /** Feature flags the candidate advertises — integrations populate, Hubs omit. */
50309
+ /** Feature flags the candidate advertises — integrations populate, flat enumerations omit. */
50313
50310
  features: array(string()).readonly().optional(),
50314
50311
  /** Upstream-system identity + rendering hints for the candidate. */
50315
50312
  sourceInfo: SourceInfoSchema.optional(),
50316
- /** Nested entity-children for accordion preview — integrations populate, Hubs omit. */
50313
+ /** Nested entity-children for accordion preview — integrations populate, flat enumerations omit. */
50317
50314
  children: array(DiscoveredChildDeviceSchema).readonly().optional(),
50318
50315
  /** `childNativeId` of the gateway candidate in the same list this device sits behind. */
50319
50316
  parentStableId: string().optional()
50320
50317
  }));
50321
50318
  /**
50322
- * Status block — populated by the integration after each
50323
- * `refreshDiscovery` (or push-driven update). The runtime-state slice
50324
- * is what the panel reads via the per-device proxy; `getStatus`
50325
- * returns the same payload via the codegen'd auto-injection.
50326
- */
50327
- var DeviceDiscoveryStatusSchema = object({
50328
- discovered: array(DiscoveredChildDeviceSchema),
50329
- /** Wall-clock ms of the last successful enumeration. */
50330
- lastDiscoveryAt: number$1().int().nonnegative().nullable(),
50331
- /** Last error surfaced from the source (rendered as a banner). */
50332
- lastError: string().nullable()
50333
- });
50334
- DeviceType.Hub, DeviceDiscoveryStatusSchema.extend({ lastFetchedAt: number$1().int().nonnegative() }), method(object({ deviceId: number$1().int().nonnegative() }), array(DiscoveredChildDeviceSchema).readonly()), method(object({ deviceId: number$1().int().nonnegative() }), array(DiscoveredChildDeviceSchema).readonly(), {
50335
- kind: "mutation",
50336
- auth: "admin"
50337
- }), method(object({
50338
- deviceId: number$1().int().nonnegative(),
50339
- childNativeId: string(),
50340
- /** Optional override for the child's display name. */
50341
- name: string().optional()
50342
- }), object({
50343
- deviceId: number$1().int().nonnegative(),
50344
- stableId: string()
50345
- }), {
50346
- kind: "mutation",
50347
- auth: "admin"
50348
- }), method(object({
50349
- deviceId: number$1().int().nonnegative(),
50350
- childDeviceId: number$1().int().nonnegative()
50351
- }), _void(), {
50352
- kind: "mutation",
50353
- auth: "admin"
50354
- });
50355
- /**
50356
- * `device-adoption` — generic discovery + adoption surface,
50357
- * system-scoped collection (one provider per integration addon), routed
50358
- * by explicit `{ addonId }` on direct `deviceAdoption.*` calls — the same
50359
- * pin model as `connection-test`. The admin UI keeps using
50360
- * `deviceManager.adoption*` (which already threads `addonId`). The de-HA-ified
50361
- * successor to `ha-discovery`:
50362
- * keyed by `integrationId` (the addon resolves integrationId → broker
50363
- * internally) rather than a connection-specific `brokerId`, and it
50364
- * REUSES the shared `DiscoveredChildDevice` candidate type from
50365
- * `device-discovery.cap.ts` so a single shared adoption panel renders
50366
- * any integration's candidate tree.
50367
- *
50368
- * UI flow (Integrations page → integration detail):
50369
- * 1. `listCandidates({integrationId, page, pageSize, filter})` →
50370
- * paginated candidate list, each row collapsed.
50371
- * 2. User expands a row → `getCandidate({integrationId,
50372
- * childNativeId})` returns the single candidate (with its nested
50373
- * `children`) for the accordion render.
50374
- * 3. User clicks "Adopt" on one or more candidates →
50375
- * `adopt({integrationId, childNativeIds, perCandidate?})`
50376
- * materialises one parent CamStack device per candidate plus its
50377
- * accessory children. `perCandidate[childNativeId]` carries an
50378
- * optional display-name override + a `hiddenChildIds` pre-hide set
50379
- * (the parent's `accessories.hiddenChildIds` gates UI visibility).
50380
- * 4. User clicks "Release" → `release({integrationId, camDeviceId})`
50381
- * removes the parent + every child from the kernel registry.
50382
- */
50383
- /**
50384
50319
  * Provider-declared discovery *granularity* filter (the keystone of the
50385
50320
  * single-entity-import design). A provider advertises which discovery
50386
50321
  * granularities it supports via `listCandidateFilters`; the operator picks
@@ -69554,7 +69489,7 @@ object({
69554
69489
  offSeconds: number$1().int(),
69555
69490
  lastFetchedAt: number$1()
69556
69491
  });
69557
- DeviceType.Gateway, DeviceType.Hub, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater;
69492
+ DeviceType.Gateway, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater;
69558
69493
  var deviceInput$1 = object({ deviceId: number$1().int().nonnegative() });
69559
69494
  systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "protected" }), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
69560
69495
  kind: "mutation",
@@ -82071,41 +82006,6 @@ Object.freeze({
82071
82006
  access: "create",
82072
82007
  role: "admin"
82073
82008
  },
82074
- "deviceDiscovery.adoptDevice": {
82075
- capName: "device-discovery",
82076
- capScope: "device",
82077
- addonId: null,
82078
- access: "create",
82079
- role: "admin"
82080
- },
82081
- "deviceDiscovery.getStatus": {
82082
- capName: "device-discovery",
82083
- capScope: "device",
82084
- addonId: null,
82085
- access: "view",
82086
- role: "viewer"
82087
- },
82088
- "deviceDiscovery.listDiscovered": {
82089
- capName: "device-discovery",
82090
- capScope: "device",
82091
- addonId: null,
82092
- access: "view",
82093
- role: "viewer"
82094
- },
82095
- "deviceDiscovery.refreshDiscovery": {
82096
- capName: "device-discovery",
82097
- capScope: "device",
82098
- addonId: null,
82099
- access: "create",
82100
- role: "admin"
82101
- },
82102
- "deviceDiscovery.releaseDevice": {
82103
- capName: "device-discovery",
82104
- capScope: "device",
82105
- addonId: null,
82106
- access: "create",
82107
- role: "admin"
82108
- },
82109
82009
  "deviceExport.applyDeviceSettingsPatch": {
82110
82010
  capName: "device-export",
82111
82011
  capScope: "system",
@@ -91163,35 +91063,6 @@ Object.freeze({
91163
91063
  form: "single",
91164
91064
  optional: false
91165
91065
  }],
91166
- "deviceDiscovery.adoptDevice": [{
91167
- name: "deviceId",
91168
- form: "single",
91169
- optional: false
91170
- }],
91171
- "deviceDiscovery.getStatus": [{
91172
- name: "deviceId",
91173
- form: "single",
91174
- optional: false
91175
- }],
91176
- "deviceDiscovery.listDiscovered": [{
91177
- name: "deviceId",
91178
- form: "single",
91179
- optional: false
91180
- }],
91181
- "deviceDiscovery.refreshDiscovery": [{
91182
- name: "deviceId",
91183
- form: "single",
91184
- optional: false
91185
- }],
91186
- "deviceDiscovery.releaseDevice": [{
91187
- name: "childDeviceId",
91188
- form: "single",
91189
- optional: false
91190
- }, {
91191
- name: "deviceId",
91192
- form: "single",
91193
- optional: false
91194
- }],
91195
91066
  "deviceExport.applyDeviceSettingsPatch": [{
91196
91067
  name: "deviceId",
91197
91068
  form: "single",
@@ -95216,7 +95087,7 @@ var AdminUIAddon = class extends BaseAddon {
95216
95087
  capability: adminUiCapability,
95217
95088
  provider: {
95218
95089
  getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
95219
- getVersion: async () => ({ version: "1.2.638" })
95090
+ getVersion: async () => ({ version: "1.2.640" })
95220
95091
  }
95221
95092
  }];
95222
95093
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-admin-ui",
3
- "version": "1.2.638",
3
+ "version": "1.2.640",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Admin UI — Vite frontend build and server-side addon",
@@ -50,7 +50,7 @@
50
50
  }
51
51
  ],
52
52
  "requires": {
53
- "server": ">=1.2.832"
53
+ "server": ">=1.2.834"
54
54
  }
55
55
  },
56
56
  "scripts": {
@@ -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{Bt as d,En as f,Kt as p,Ni as m,On as h,Q as g,Ri as _,St as v,Ti as y,Tr as b,Vi as x,Wn as S,Yt as C,ct as w,hn as T,kn as ee,li as te,ot as E,rr as D,ut as ne,zn as O}from"./player-overlays-BZByYYB8.js";import{Js as k}from"./client-mnldOm50.js";import{t as re}from"./chevron-down-CBb-F8DT.js";import{a as A,p as j}from"./video-BV-3O_ZC.js";import{$s as ie,Br as ae,Gc as oe,Hr as se,Ir as ce,Lr as le,Of as ue,Pt as M,Qi as de,Rr as fe,Sa as pe,Sn as me,Ti as he,Vr as N,Wt as ge,_a as P,aa as F,af as I,ar as _e,ba as L,cr as R,da as z,ea as B,fa as V,ga as ve,ha as ye,ia as be,jf as xe,ji as H,la as U,na as W,oa as Se,or as G,pa as Ce,ra as we,sa as K,sr as Te,ta as Ee,ua as De,ur as Oe,va as ke,xa as Ae,xn as je}from"./src-DKRp5NPI.js";import{t as q}from"./useTranslation-BJr-n0es.js";import"./mount-CLxwtH6P.js";import{Br as Me,Kr as Ne,Wr as Pe}from"./index-D7Qm6t2n.js";import{t as Fe}from"./AdminPage-_ITsYONa.js";import{i as Ie,r as Le,t as Re}from"./addon-kind-filter-CEGKkC1O.js";import{n as J,t as ze}from"./framework-packages-B0ugw-Ay.js";import{t as Y}from"./NodeAddonsSettingsPanel-o9q4_Y7B.js";import{n as X,r as Be,t as Ve}from"./useNodeUrlSelection-BSPl0vnb.js";function He(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 Ue={queued:{icon:y,bg:`bg-muted text-foreground-subtle`,labelKey:`addons.addonRowBadge.queued`},updating:{icon:b,bg:`bg-primary/10 text-primary`,labelKey:`addons.addonRowBadge.updating`,spin:!0},"done-pending-restart":{icon:O,bg:`bg-amber-500/10 text-amber-700`,labelKey:`addons.addonRowBadge.pendingRestart`},done:{icon:x,bg:`bg-success/10 text-success`,labelKey:`addons.addonRowBadge.done`},failed:{icon:A,bg:`bg-danger/10 text-danger`,labelKey:`addons.addonRowBadge.failed`}};function Z({item:e}){let{t:n}=q(),r=Ue[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 Q=new Set([`completed`,`failed`,`partially-failed`,`cancelled`]),We=new Set([`done`,`failed`,`skipped`]);function Ge(e){return!We.has(e.phase)&&!Q.has(e.jobState)}function Ke(e,t){let n=new Map,r=[...e].sort((e,t)=>e.createdAtMs-t.createdAtMs);for(let e of r){let r=Q.has(e.state);for(let i of e.tasks)r&&i.finishedAtMs!==null&&t-i.finishedAtMs>6e4||n.set(i.packageName,{jobId:e.jobId,packageName:i.packageName,phase:i.phase,fromVersion:i.fromVersion,toVersion:i.toVersion,error:i.error,jobState:e.state,finishedAtMs:i.finishedAtMs})}return n}function qe(){let{data:e}=De({activeOnly:!0},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data?.length??0)>0?3e3:!1}),{map:t}=xe(k.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 Ke([...n.values()],Date.now())},[e,t])}var Je={queued:{icon:y,cls:`bg-muted text-foreground-subtle`,labelKey:`addons.jobProgress.queued`},fetching:{icon:b,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.fetching`,spin:!0},staged:{icon:b,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.staged`,spin:!0},validating:{icon:b,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.validating`,spin:!0},applying:{icon:b,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.applying`,spin:!0},restarting:{icon:b,cls:`bg-amber-500/10 text-amber-600 dark:text-amber-400`,labelKey:`addons.jobProgress.restarting`,spin:!0},applied:{icon:b,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.finalizing`,spin:!0},done:{icon:x,cls:`bg-success/10 text-success`,labelKey:`addons.jobProgress.updated`},failed:{icon:A,cls:`bg-danger/10 text-danger`,labelKey:`addons.jobProgress.failed`},skipped:{icon:T,cls:`bg-muted text-foreground-subtle`,labelKey:`addons.jobProgress.skipped`}};function Ye({progress:e}){let{t:n}=q(),r=Je[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 Xe(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 Ze(e){let t=e.version===null?``:` ${e.version}`,n=e.isOnline?``:` (offline: removed when it reconnects)`;return`- ${e.nodeName}${t}${n}`}function Qe(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(Ze)];return n.length>0&&r.push(`Could not ask: ${n.join(`, `)} — not included.`),r.push(`This cannot be undone.`),r.join(`
2
- `)}function $e(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 et={uninstalled:`uninstalled`,"not-installed":`was not installed`,refused:`REFUSED`,failed:`FAILED`,"pending-reconnect":`offline — removed when it reconnects`};function tt(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)}: ${et[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 nt={},rt=3e4,it=`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 at({packageName:e,displayName:n,selectedNode:r,hideNodeAction:i,disabled:o}){let{t:s}=q(),c=l(),u=w(),d=E(),f=U(nt,{staleTime:rt}),p=f.data?.installations??[],m=(f.data?.unreachable??[]).map(e=>e.nodeId),h=Xe(p,e),g=e=>h.find(t=>t.nodeId===e)?.nodeName??(e===r.id?r.name:e),_=Ae({onSettled:()=>{c.invalidateQueries({queryKey:[[`addons`]]}),c.invalidateQueries({queryKey:[[`addonPages`]]}),c.invalidateQueries({queryKey:[[`capabilities`]]}),c.invalidateQueries({queryKey:[[`nodes`]]})}}),v=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:tt(e,g),variant:e.success?`default`:`danger`})},y=async t=>{try{await v(await _.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`})}},b=async()=>{let e=h.filter(e=>e.nodeId!==r.id);await u({title:s(`addons.addonUninstallControls.uninstallFrom`,`Uninstall {{displayName}} from {{name}}?`,{displayName:n,name:r.name}),message:$e(n,r.name,e),confirmLabel:s(`addons.addonUninstallControls.uninstall`,`Uninstall`),variant:`danger`})&&await y(r.isHub?{}:{nodeId:r.id})},x=async()=>{let t=(await f.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=Xe(t.installations,e);await u({title:s(`addons.addonUninstallControls.uninstallEverywhere`,`Uninstall {{displayName}} everywhere?`,{displayName:n}),message:Qe(n,r,t.unreachable.map(e=>e.nodeId)),confirmLabel:s(`addons.addonUninstallControls.uninstallFromNodeS`,`Uninstall from {{length}} node(s)`,{length:r.length}),variant:`danger`})&&await y({everywhere:!0})},S=_.isPending||o===!0;return t(`div`,{className:`flex items-center gap-1.5`,children:[i!==!0&&t(H,{variant:`unstyled`,type:`button`,onClick:e=>{e.stopPropagation(),b()},disabled:S,className:it,title:s(`addons.addonUninstallControls.uninstallFrom2`,`Uninstall from {{name}}`,{name:r.name}),children:[a(C,{className:`h-3 w-3`}),_.isPending?s(`addons.addonUninstallControls.removing`,`Removing...`):s(`addons.addonUninstallControls.uninstall`,`Uninstall`)]}),(h.length>1||i===!0||m.length>0)&&t(H,{variant:`unstyled`,type:`button`,onClick:e=>{e.stopPropagation(),x()},disabled:S,className:it,title:s(`addons.addonUninstallControls.uninstallFromEveryNodeThat`,`Uninstall from every node that has it`),children:[a(j,{className:`h-3 w-3`}),h.length>0?s(`addons.uninstallControls.everywhereCount`,{count:h.length}):s(`addons.uninstallControls.everywhere`)]})]})}function ot(e){return typeof e.deprecated==`string`&&e.deprecated.length>0}function st(e,t){return t?e:e.filter(e=>e.distTags.includes(`latest`)||!ot(e))}function ct(e){return e.length-st(e,!1).length}c();function lt({packageName:e,currentVersion:n,installSource:r,onInstall:i,onClose:o,onSelect:c,selectedVersion:l}){let{t:f}=q(),p=r===`upload`||r===`local`,[m,h]=s(!1),{data:g,isLoading:_,isError:y}=F({name:e}),S=g?st(g,m):[],C=g?ct(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:f(`addons.versionPicker.versions`,`Versions`)}),a(H,{variant:`unstyled`,type:`button`,onClick:o,className:`text-foreground-subtle hover:text-foreground`,children:a(v,{className:`h-3 w-3`})})]}),p&&t(`div`,{className:`flex items-start gap-2 px-3 py-2 border-b border-border bg-cyan-500/10 text-[10px]`,children:[a(d,{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:f(`addons.versionPicker.inPlace`,{kind:r===`upload`?f(`addons.versionPicker.uploadedCopy`,`Uploaded copy`):f(`addons.versionPicker.localCopy`,`Local copy`)})}),` `,a(Me,{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(b,{className:`h-3.5 w-3.5 animate-spin`}),f(`addons.versionPicker.loadingVersions`,`Loading versions...`)]}),y&&a(`div`,{className:`px-3 py-4 text-center text-[10px] text-danger`,children:f(`addons.versionPicker.registryError`,`Could not load versions from the registry.`)}),S.length>0&&a(`div`,{className:`max-h-64 overflow-auto divide-y divide-border`,children:S.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),d=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:f(`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)),ot(e)&&a(`span`,{className:`text-[9px] text-red-400 line-through`,children:f(`common.deprecated`)}),a(`span`,{className:`text-[9px] text-foreground-subtle shrink-0`,children:new Date(e.publishedAt).toLocaleDateString()})]});return c?t(H,{variant:`unstyled`,type:`button`,"aria-label":f(`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:[d,o?a(x,{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:[d,a(H,{variant:`unstyled`,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?f(`addons.versionPicker.reInstallFromNpm`,`Re-install {{version}} from npm`,{version:e.version}):f(`addons.versionPicker.install`,`Install {{version}}`,{version:e.version}),children:a(te,{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:f(`addons.versionPicker.noVersionsFound`,`No versions found`)}),C>0&&a(H,{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:m?f(`addons.versionPicker.hideOlder`,`Hide older versions`):f(`addons.versionPicker.showOlder`,`Show older versions ({{count}})`,{count:C})})]})}c();var ut=`device-export`;function dt(e){return e.capabilities.some(e=>(typeof e==`string`?e:e.name)===ut)}function ft(e){return e!==`local`&&e!==`upload`}function pt({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,f=e?`bg-indigo-500/20 text-indigo-700 dark:text-indigo-300`:`bg-purple-500/20 text-purple-700 dark:text-purple-300`,p=r&&i?g(`/api/addon-assets/${r}/${i}`):null,m=!!p&&!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?``:f}`,style:u,children:m?a(`img`,{src:p,alt:r,className:`h-4 w-4`,onError:()=>l(!0)}):a(e?D:S,{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`}),ft(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(d,{className:`h-2.5 w-2.5 text-white`})})]})}function mt({version:e,availableUpdate:n,selectedVersion:r,isUpdating:i,installSource:o,disabled:s,onUpdate:c,onOpenPicker:l,children:u}){let{t:d}=q();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(b,{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(H,{variant:`unstyled`,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(te,{className:`h-3 w-3`}),d(`addons.addonCard.update`,`Update`)]}),t(H,{variant:`unstyled`,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(re,{className:`h-3 w-3`})]}),u]})}return t(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[t(H,{variant:`unstyled`,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(re,{className:`h-3 w-3 opacity-50`})]}),u]})}function ht({addonId:e}){let t=l(),{data:n=`inherit`}=Ee({addonId:e}),r=P({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(H,{variant:`unstyled`,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 gt={id:`hub`,name:`Hub`,isHub:!0};function _t({addon:e,clusterStatus:n,hideVersion:r,availableUpdate:i,blockedUpdate:c,onUpdateServer:d,onUpdate:p,isUpdating:m,jobProgress:h,bundle:g,bulkItem:y,disabledByBulk:b,isSystem:x,selectedNode:S}){let{t:C}=q(),[w,T]=s(!1),[te,E]=s(!1),[ne,k]=s(null);o(()=>{k(null)},[i]);let j=ne??i,[ie,oe]=s(!1),[ue,M]=s(!1),[de,pe]=s(`logs`),P=l(),F=Pe(),{manifest:I}=e,_e=!g&&!I.protected&&I.removable!==!1,L=!!g,R=g?.displayName??I.name,z=g?.packageName??I.packageName,B=g?.version??I.packageVersion??I.version,V=g?.installSource??e.installSource,ve=g?g.bundle?.description??g.addons[0]?.manifest.description:I.description,be=Ce({onSuccess:()=>{P.invalidateQueries({queryKey:[[`addons`]]})}}),xe=Se({onSuccess:()=>{P.invalidateQueries({queryKey:[[`addons`]]}),P.invalidateQueries({queryKey:[[`addonPages`]]}),P.invalidateQueries({queryKey:[[`capabilities`]]}),P.invalidateQueries({queryKey:[[`integrations`]]})}}),U=ye({onSuccess:()=>{P.invalidateQueries({queryKey:[[`addons`]]}),P.invalidateQueries({queryKey:[[`alerts`]]})}}),W=e.health,G=W?.phase===`failed`&&!W.inGracePeriod,we=G&&W?.nextRetryAt&&!W.retrying,K=He(e.process);return t(`div`,{className:`rounded-md border bg-surface overflow-hidden ${G?`border-red-500/50`:`border-border`}`,children:[G&&W&&t(`div`,{className:`bg-danger/10 border-b border-danger/30 px-3 py-2 flex items-start gap-2`,children:[a(A,{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:C(`addons.addonCard.failedToLoad`,{attempt:W.retryCount})}),a(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:W.lastError?.message??C(`addons.addonCard.unknownError`,`Unknown error`)}),we&&W.nextRetryAt&&a(`div`,{className:`text-[10px] text-foreground-subtle mt-1`,children:C(`addons.addonCard.autoRetryAt`,{time:new Date(W.nextRetryAt).toLocaleTimeString()})})]}),t(H,{variant:`unstyled`,type:`button`,disabled:U.isPending||W.retrying,onClick:e=>{e.stopPropagation(),U.mutate({packageName:z})},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:C(`addons.addonCard.resetRetryCounterAndForce`,`Reset retry counter and force immediate reload`),children:[a(O,{className:`h-3 w-3 ${U.isPending||W.retrying?`animate-spin`:``}`}),C(`addons.addonCard.retryNow`,`Retry now`)]})]}),K!==null&&t(`div`,{className:`bg-danger/10 border-b border-danger/30 px-3 py-2 flex items-start gap-2`,children:[a(A,{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:C(`addons.addonCard.processProblem.${K.kind}`)}),K.reason!==void 0&&a(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:K.reason})]})]}),t(`div`,{className:`flex items-start gap-2.5 px-3 py-2`,children:[a(pt,{isBundle:L||!!I.components&&I.components.length>1,installSource:V,addonId:L?g.addons[0]?.manifest.id:I.id,iconPath:L?g.bundle?.icon??g.addons[0]?.manifest.icon:I.icon,color:L?g.addons[0]?.manifest.color:I.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:R}),!r&&a(mt,{version:B,availableUpdate:i,...j===void 0?{}:{selectedVersion:j},isUpdating:m,installSource:V,disabled:b,...p&&j!==void 0?{onUpdate:()=>p(j)}:{},onOpenPicker:()=>E(e=>!e),children:te&&a(lt,{packageName:z,currentVersion:B,...V?{installSource:V}:{},...i!==void 0&&j!==void 0?{selectedVersion:j,onSelect:e=>{k(e),E(!1)}}:{},onInstall:e=>{E(!1),xe.mutate({packageName:z,version:e})},onClose:()=>E(!1)})})]}),t(`div`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 mt-0.5`,children:[z!==R&&a(`span`,{className:`text-[10px] text-foreground-subtle font-mono truncate max-w-full`,children:z}),L&&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(D,{className:`h-3 w-3`}),g.addons.length]}),x&&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:C(`addons.addonCard.systemPackageUpdatingRestartsThe`,`System package — updating restarts the hub`),children:[a(O,{className:`h-3 w-3`}),C(`addons.addonCard.system`,`System`)]}),y!=null&&a(Z,{item:y}),c!==void 0&&a(he,{variant:`warning`,title:C(`addons.addonCard.updateHeldTitle`,{defaultValue:`{{latest}} is held until the server is {{required}} or newer`,latest:c.latestVersion,required:c.requiredServer}),children:C(`addons.addonCard.requiresServer`,{defaultValue:`requires server ≥ {{version}}`,version:c.requiredServer})}),c!==void 0&&d!==void 0&&a(H,{type:`button`,size:`sm`,variant:`secondary`,onClick:d,children:C(`clusterUpdate.updateServer`,`Update server`)}),h!=null&&a(Ye,{progress:h})]}),ve&&a(`p`,{className:`text-[10px] text-foreground-subtle mt-1 line-clamp-1`,children:ve}),!L&&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`?C(`addons.addonCard.forked`):C(`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`:K===null?`bg-gray-500/15 text-gray-400`:`bg-red-500/15 text-red-400`}`,children:e.process.state})]})]})]}),!L&&t(`div`,{className:`flex items-center gap-1 px-3 py-1 border-t border-border/50 bg-surface-hover/20`,children:[t(H,{variant:`unstyled`,type:`button`,onClick:e=>{e.stopPropagation(),be.mutate({addonId:I.id})},disabled:be.isPending||b,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(O,{className:`h-3 w-3 ${be.isPending?`animate-spin`:``}`}),C(`addons.addonCard.restart`,`Restart`)]}),t(H,{variant:`unstyled`,type:`button`,onClick:e=>{e.stopPropagation(),oe(e=>!e)},className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium border transition-colors ${ie?`border-primary/30 bg-primary/10 text-primary`:`border-border text-foreground-subtle hover:text-foreground hover:border-primary/30 hover:bg-primary/10`}`,children:[a(ee,{className:`h-3 w-3`}),C(`addons.addonCard.logs`,`Logs`)]}),!L&&t(H,{variant:`unstyled`,type:`button`,onClick:e=>{e.stopPropagation(),M(!0)},className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium border transition-colors ${ue?`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(f,{className:`h-3 w-3`}),C(`addons.addonCard.settings`,`Settings`)]}),a(`div`,{className:`flex-1`}),_e&&a(at,{packageName:I.packageName,displayName:I.name,selectedNode:S??gt,disabled:b})]}),n&&n.nodes.length>1&&!L&&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:C(`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:C(`addons.addonCard.outdated`)}),e.status===`offline`&&a(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-muted text-muted-foreground`,children:C(`common.offline`)}),e.synced&&e.status!==`offline`&&a(`span`,{className:`text-[9px] text-success`,children:C(`common.synced`)})]},e.nodeId))})]}),ie&&!L&&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(H,{variant:`unstyled`,type:`button`,onClick:()=>pe(`logs`),className:`px-2 py-0.5 transition-colors ${de===`logs`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:C(`addons.addonCard.logs`,`Logs`)}),a(H,{variant:`unstyled`,type:`button`,onClick:()=>pe(`events`),className:`px-2 py-0.5 border-l border-border transition-colors ${de===`events`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:C(`addons.addonCard.events`,`Events`)})]}),a(`div`,{className:`flex-1`}),a(H,{variant:`unstyled`,type:`button`,onClick:e=>{e.stopPropagation(),oe(!1)},className:`text-foreground-subtle hover:text-foreground`,children:a(v,{className:`h-3.5 w-3.5`})})]}),de===`logs`&&a(me,{addonId:I.id,maxHeight:`max-h-64`,showFilters:!1}),de===`events`&&a(je,{addonId:I.id,category:`addon.*`,maxHeight:`max-h-64`})]}),L&&t(u,{children:[a(H,{variant:`unstyled`,type:`button`,onClick:()=>T(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(w?_:re,{className:`h-3.5 w-3.5 text-foreground-subtle`})}),w&&a(`div`,{className:`border-t border-border px-2.5 py-1.5 space-y-1.5`,children:g.addons.map(e=>a(_t,{addon:e,hideVersion:!0},e.manifest.id))})]}),ue&&!L&&a(ce,{open:!0,onOpenChange:e=>!e&&M(!1),children:t(fe,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:[a(N,{children:t(se,{className:`flex items-center gap-2`,children:[a(f,{className:`h-4 w-4 text-primary`}),C(`addons.addonCard.settingsTitle`,{name:R})]})}),t(le,{className:`space-y-4`,children:[a(`div`,{className:`text-[10px] text-foreground-subtle mb-2`,children:C(`addons.addonCard.clusterWideSettingsOneValue`,`Cluster-wide settings — one value for every node. Per-node settings live under Cluster → the node → Settings.`)}),a(Y,{nodeId:null,addonIds:[I.id],level:`global`,fieldScope:`cluster`,emptyMessage:C(`addons.addonCard.thisAddonExposesNoCluster`,`This addon exposes no cluster-wide settings. Anything it can configure is per-node — open it from Cluster → the node → Settings.`)}),dt(I)&&t(`div`,{children:[a(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:C(`addons.addonCard.deviceExport`,`Device export`)}),a(ge,{addonId:I.id,onOpenDevice:e=>F(`/devices/${e}`)})]}),ft(V)&&t(`div`,{children:[a(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:C(`addons.addonCard.autoUpdate`,`Auto-Update`)}),a(ht,{addonId:I.id})]}),I.components&&I.components.length>0&&t(`div`,{children:[a(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:C(`addons.addonCard.components`,{count:I.components.length})}),a(`div`,{className:`flex flex-wrap gap-1`,children:I.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(ae,{children:a(H,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>M(!1),children:C(`common.close`,`Close`)})})]})})]})}c();var vt=`.tgz,.tar.gz,.zip`;function yt({onUploadSuccess:e}){let{t:r}=q(),[o,c]=s(!1),l=n(null),f=i(async t=>{c(!0);let n=new FormData;n.append(`file`,t);let r=localStorage.getItem(`camstack_admin_token`)??``;try{(await(await fetch(g(`/api/addons/upload`),{method:`POST`,headers:{Authorization:`Bearer ${r}`},body:n})).json()).success&&e()}finally{c(!1)}},[e]);return t(u,{children:[a(Oe,{ref:l,accept:vt,onChange:i(e=>{let t=e.target.files?.[0];t&&f(t),e.target.value=``},[f]),className:`hidden`}),t(H,{variant:`unstyled`,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(b,{className:`w-3.5 h-3.5 animate-spin`}):a(d,{className:`w-3.5 h-3.5`}),o?r(`addons.addonUploadZone.uploading`,`Uploading...`):r(`addons.addonUploadZone.upload`,`Upload`)]})]})}var bt=/```[^\n]*\n([\s\S]*?)```/g;function xt(e){let t=[],n=0;for(let r of e.matchAll(bt)){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 St(e){let t=e.trim();return t.startsWith(`https://`)||t.startsWith(`http://`)?t:null}function Ct(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?St(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 wt(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:Ct(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:Ct(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=Ct(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 Tt({markdown:e}){return a(`div`,{className:`text-xs text-foreground leading-relaxed`,children:xt(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:wt(e.body,`b${t}`)},`text-${t}`))})}c();function Et(e){return e.replace(/^@camstack\/(addon-)?/,``)}function Dt(e,t,n){let r=st(e,n);return r.some(e=>e.version===t)?r:[{version:t,distTags:[],deprecated:void 0},...r]}function Ot({pending:e,failed:n,body:r,missing:i}){let{t:o}=q();return e?t(`div`,{className:`flex items-center gap-2 py-6 text-xs text-foreground-subtle`,children:[a(b,{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(Tt,{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 kt({target:e,installing:n,installError:r,onClose:i,onInstall:o}){let{t:c}=q(),[l,u]=s(e.version),[d,f]=s(!1),p=F({name:e.name}),m=be({name:e.name,version:l}),h=p.data??[],g=ct(h),_=Dt(h,l,d),v=m.data;return a(ce,{open:!0,onOpenChange:e=>!e&&i(),children:t(fe,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:[a(N,{children:a(se,{children:c(`addons.installDialog.title`,`Install {{name}}`,{name:Et(e.name)})})}),t(le,{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(ne,{"aria-label":c(`addons.installDialog.version`,`Version`),value:l,options:_.map(e=>({value:e.version,label:ot(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(H,{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(_e,{defaultValue:`readme`,children:[t(Te,{children:[a(R,{value:`readme`,children:c(`addons.installDialog.readme`,`README`)}),a(R,{value:`changelog`,children:c(`addons.installDialog.changelog`,`CHANGELOG`)})]}),a(G,{value:`readme`,children:a(`div`,{className:`max-h-80 overflow-auto rounded-md border border-border bg-background p-3`,children:a(Ot,{pending:m.isPending,failed:m.isError,body:v?.readme,missing:c(`addons.installDialog.missingReadme`,`This package has no README.`)})})}),a(G,{value:`changelog`,children:a(`div`,{className:`max-h-80 overflow-auto rounded-md border border-border bg-background p-3`,children:a(Ot,{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(ae,{children:[a(H,{type:`button`,variant:`outline`,size:`sm`,onClick:i,children:c(`common.cancel`,`Cancel`)}),a(H,{type:`button`,size:`sm`,disabled:n||l.length===0,onClick:()=>o(e.name,l),children:n?a(b,{className:`h-3.5 w-3.5 animate-spin`}):c(`addons.installDialog.install`,`Install`)})]})]})})}function At(e,t){let n=new Map;for(let r of e){if(r.isHub||r.onHub||J(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 jt({selectedNode:e}){let{t:n}=q(),{data:r}=U(nt,{staleTime:rt});if(r===void 0)return null;let i=At(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(p,{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(at,{packageName:n.packageName,displayName:n.packageName,selectedNode:e,hideNodeAction:e.isHub})]},n.packageName))]})}function Mt({addon:e,installing:n,onInstall:r}){let{t:i}=q();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(he,{variant:`success`,icon:a(x,{className:`h-3 w-3`}),children:e.installedVersion??i(`system.capabilityCatalog.installed`,`Installed`)}):t(H,{size:`sm`,onClick:()=>r(e),disabled:n,className:`shrink-0`,children:[n?a(b,{className:`h-3 w-3 animate-spin`}):a(te,{className:`h-3 w-3`}),i(`system.capabilityCatalog.install`,`Install`)]})]})}function Nt({capability:e,installing:n,onInstall:r}){let{t:i}=q(),{data:o,isPending:s,isError:c}=ve({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(b,{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(Mt,{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 Pt(e){return e===`npm`||e===`dev`?e:null}var Ft=`rounded-full border border-primary bg-primary/10 px-2 py-0.5 text-[10px] text-foreground`,It=`rounded-full border border-border px-2 py-0.5 text-[10px] text-foreground-muted hover:bg-surface-hover`,Lt=[{seconds:900,label:`15m`},{seconds:3600,label:`1h`},{seconds:21600,label:`6h`},{seconds:43200,label:`12h`},{seconds:86400,label:`24h`}],Rt={id:`hub`,name:`Hub`,isHub:!0,isOnline:!0};function zt(e,t){let n=e??`hub-only`;return n===`any-node`?!0:n===`hub-only`?t:!t}function Bt(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 Ht(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 Ut({addons:c,clusterStatus:u,selectedNode:d,onRefresh:f,listPhase:p}){let{t:g}=q(),_=l(),[v,y]=s(``),[x,S]=s(!1),C=e(v),[T,ee]=s(!1),E=n(null);o(()=>{if(!T)return;let e=e=>{E.current&&!E.current.contains(e.target)&&ee(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[T]);let{data:D}=z({nodeId:d.id}),k=r(()=>{let e=new Map;for(let t of D??[])t.blockedBy===void 0&&e.set(t.name,t.latestVersion);return e},[D]),re=r(()=>{let e=new Map;for(let t of D??[]){let n=t.blockedBy?.find(e=>e.kind===`server-too-old`);n!==void 0&&e.set(t.name,{latestVersion:t.latestVersion,requiredServer:n.required})}return e},[D]),A=r(()=>(D??[]).filter(e=>!e.isSystem&&e.blockedBy===void 0).length,[D]),[j,ae]=s(()=>new Set),[oe,se]=s(()=>new Map),ce=i(e=>{ae(t=>new Set(t).add(e))},[]),le=i(e=>{ae(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[]),ue=i((e,t)=>{se(n=>new Map(n).set(e,t))},[]),M=i(e=>{se(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),fe=pe({onMutate:e=>{ce(e.name),M(e.name)},onSuccess:(e,t)=>{le(t.name);let n=e;if(n&&n.success===!1){ue(t.name,n.error??`Update failed (no error message returned by server)`);return}_.invalidateQueries({queryKey:[[`addons`]]}),_.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]})},onError:(e,t)=>{le(t.name),ue(t.name,e instanceof Error?e.message:String(e))}}),me=qe(),he=n(new Set);o(()=>{let e=new Set;for(let[t,n]of me)Ge(n)&&e.add(t);let t=[...he.current].some(t=>!e.has(t));he.current=e,t&&(_.invalidateQueries({queryKey:[[`addons`]]}),_.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]}))},[me,_]);let{data:N}=W(void 0),ge=de({onSuccess:()=>{_.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),P=ke({onSuccess:()=>{_.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),{data:F,isFetching:_e}=ve({query:C||void 0},{enabled:T}),R=L(),{data:B}=we(void 0),V=B?.requestedAt,[ye,be]=s(null),[xe,U]=s(!1);o(()=>{if(B?.kind===`framework-bulk-update`&&B.requestedAt!==ye){be(B.requestedAt),U(!0);let e=window.setTimeout(()=>U(!1),6e3);return()=>window.clearTimeout(e)}},[V,ye,B]),w();let G=i(async()=>{let e=(D??[]).filter(e=>!e.isSystem&&e.blockedBy===void 0);if(e.length!==0){if(!d.isHub){for(let t of e)await fe.mutateAsync({name:t.name,version:t.latestVersion,nodeId:d.id});return}await R.mutateAsync({kind:`update`,targets:e.map(e=>({name:e.name,version:e.latestVersion})),nodeIds:[d.id]})}},[D,d.id,d.isHub,R,fe]),[Ce,K]=s(null),[Te,Ee]=s(null),De=e=>{Ee(null),K(e)},Oe=Se({onSuccess:()=>{K(null),Ee(null),_.invalidateQueries({queryKey:[[`addons`]]}),_.invalidateQueries({queryKey:[[`addonPages`]]}),_.invalidateQueries({queryKey:[[`capabilities`]]}),_.invalidateQueries({queryKey:[[`integrations`]]})},onError:e=>{Ee(e instanceof Error?e.message:`Install failed`)}}),[Ae,je]=s(`type`),[Me,Pe]=s(()=>typeof window>`u`?`grouped`:window.localStorage.getItem(`camstack.addons.viewMode`)===`flat`?`flat`:`grouped`),Fe=e=>{Pe(e),typeof window<`u`&&window.localStorage.setItem(`camstack.addons.viewMode`,e)},[J,Y]=Ne(),X=J.get(`capability`),Ve=J.get(`updatable`)===`1`,Ue=J.get(`error`)===`1`,Z=Pt(J.get(`source`)),Q=Ie(J.get(Re))===`integration`,{data:We}=ie(void 0,{enabled:Q}),Ke=r(()=>We===void 0?null:new Set(We.map(e=>e.addonId)),[We]),Je=i(e=>{let t=new URLSearchParams(J);e?t.set(Re,`integration`):t.delete(Re),Y(t,{replace:!0})},[J,Y]),Ye=i(e=>{let t=new URLSearchParams(J);e?t.set(`updatable`,`1`):t.delete(`updatable`),Y(t,{replace:!0})},[J,Y]),Xe=i(e=>{let t=new URLSearchParams(J);e?t.set(`error`,`1`):t.delete(`error`),Y(t,{replace:!0})},[J,Y]),Ze=i(e=>{let t=new URLSearchParams(J);e===null?t.delete(`source`):t.set(`source`,e),Y(t,{replace:!0})},[J,Y]),Qe=r(()=>c.filter(e=>He(e.process)!==null).length,[c]),$e=r(()=>{let e=c.filter(e=>!ze(e.manifest.packageName));return d.isHub||(e=e.filter(e=>zt(e.placement,d.isHub))),X&&(e=e.filter(e=>(e.manifest.capabilities??[]).some(e=>(typeof e==`string`?e:e.name)===X))),Q&&(e=[...Le(e,Ke)]),Ve&&(e=e.filter(e=>{let t=e.manifest.packageName;return t!==void 0&&k.has(t)})),Z!==null&&(e=e.filter(e=>Bt(e.installSource)===Z)),Ue&&(e=e.filter(e=>He(e.process)!==null)),e},[c,d.isHub,X,Ve,Z,Ue,Q,Ke,k]),et=()=>{let e=new URLSearchParams(J);e.delete(`capability`),Y(e,{replace:!0})},tt=Me===`flat`?$e:Ht($e),nt=r(()=>{let e=[...tt];switch(Ae){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},[tt,Ae]);return t(`div`,{className:`space-y-3`,children:[a(Be,{open:x,onOpenChange:S}),[...oe.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:g(`systemPage.addons.updateFailed`,{name:e})}),a(`div`,{className:`text-foreground-subtle font-mono`,children:n})]}),a(H,{variant:`unstyled`,type:`button`,onClick:()=>M(e),className:`text-foreground-subtle hover:text-foreground text-[10px]`,children:g(`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:g(`admin.system.addons.sort`,`Sort:`)}),t(ne,{wrapperClassName:`inline-block w-auto`,value:Ae,onChange:e=>je(e.target.value),children:[a(`option`,{value:`type`,children:g(`admin.system.addons.bundlesFirst`,`Bundles first`)}),a(`option`,{value:`name`,children:g(`admin.system.addons.name`,`Name`)}),a(`option`,{value:`source`,children:g(`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:g(`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(H,{variant:`unstyled`,type:`button`,onClick:()=>Fe(e),className:`px-2 py-1 transition-colors capitalize ${Me===e?`bg-primary/10 text-primary`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`}`,title:e===`grouped`?g(`admin.system.addons.groupMultiAddonPackagesInto`,`Group multi-addon packages into a bundle card`):g(`admin.system.addons.showEveryAddonAsIts`,`Show every addon as its own card`),children:e},e))})]}),d.isHub&&t(`div`,{className:`flex items-center gap-1.5`,children:[a(O,{className:`h-3 w-3 text-foreground-subtle`}),a(`span`,{className:`text-[10px] text-foreground-subtle`,children:g(`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(H,{variant:`unstyled`,type:`button`,onClick:()=>ge.mutate({channel:e}),disabled:ge.isPending,className:`px-2 py-1 transition-colors capitalize ${N?.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&&t(`div`,{className:`flex items-center gap-1.5`,children:[a(`span`,{className:`text-[10px] text-foreground-subtle`,children:g(`admin.system.addons.checkEvery`,`Check every:`)}),a(ne,{wrapperClassName:`inline-block w-auto`,className:`font-medium text-foreground-subtle`,value:N?.updateCheckIntervalSeconds??21600,disabled:P.isPending||N===void 0,onChange:e=>{N!==void 0&&P.mutate({channel:N.channel,updateCheckIntervalSeconds:Number(e.target.value)})},children:Lt.map(e=>a(`option`,{value:e.seconds,children:e.label},e.seconds))})]}),A>0&&t(H,{variant:`unstyled`,type:`button`,onClick:()=>void G(),disabled:R.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:[R.isPending?a(b,{className:`w-3 h-3 animate-spin`}):a(te,{className:`w-3 h-3`}),R.isPending?g(`admin.system.addons.updating`,`Updating…`):g(`admin.system.addons.updateAll`,`Update All ({{nonSystemUpdateCount}})`,{nonSystemUpdateCount:A})]})]}),t(`div`,{className:`flex flex-wrap items-center gap-1.5`,role:`group`,"aria-label":g(`admin.system.addons.filterInstalledAddons`,`Filter installed addons`),children:[a(`span`,{className:`text-[10px] text-foreground-subtle`,children:g(`admin.system.addons.filter`,`Filter:`)}),[{id:`integrations`,label:g(`admin.system.addons.integrations`,`Integrations`),pressed:Q,toggle:()=>Je(!Q)},{id:`updatable`,label:g(`admin.system.addons.updatable`,`Updatable`),pressed:Ve,toggle:()=>Ye(!Ve)},{id:`error`,label:g(`admin.system.addons.inError`,`In error ({{count}})`,{count:Qe}),pressed:Ue,toggle:()=>Xe(!Ue)},{id:`npm`,label:`npm`,pressed:Z===`npm`,toggle:()=>Ze(Z===`npm`?null:`npm`)},{id:`dev`,label:g(`admin.system.addons.dev`,`Dev`),pressed:Z===`dev`,toggle:()=>Ze(Z===`dev`?null:`dev`)}].map(e=>a(H,{variant:`unstyled`,type:`button`,"aria-pressed":e.pressed,onClick:e.toggle,className:e.pressed?Ft:It,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:E,children:[a(I,{type:`text`,searchHotkey:!0,value:v,onChange:e=>{y(e.target.value),ee(!0)},onFocus:()=>ee(!0),placeholder:g(`admin.system.addons.searchAddonsOnNpm`,`Search addons on npm...`),"aria-label":g(`admin.system.addons.searchAddonsOnNpm2`,`Search addons on npm`),disabled:R.isPending,leftSlot:a(h,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),rightSlot:_e?a(b,{className:`h-3 w-3 animate-spin`}):void 0}),T&&F&&F.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:[F.length>0&&a(`div`,{className:`px-3 py-1.5 text-[10px] uppercase tracking-wide text-foreground-subtle border-b border-border`,children:g(`systemPage.addons.npmResults`,{count:F.length})}),F&&F.length>0&&a(`div`,{className:`max-h-72 overflow-auto divide-y divide-border`,children:F.map(e=>a(Mt,{addon:e,installing:Oe.isPending,onInstall:e=>De({name:e.name,version:e.version,description:e.description})},e.name))})]})]}),a(yt,{onUploadSuccess:()=>{_.invalidateQueries({queryKey:[[`addons`]]}),f()}})]}),X&&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:g(`admin.system.addons.filteringByCapability`,`Filtering by capability:`)}),a(`span`,{className:`font-mono text-primary font-semibold`,children:X}),a(H,{variant:`unstyled`,type:`button`,onClick:et,className:`ml-auto text-xs text-foreground-subtle hover:text-foreground underline`,children:g(`admin.system.addons.clear`,`Clear`)})]}),X&&a(Nt,{capability:X,installing:Oe.isPending,onInstall:e=>De({name:e.name,version:e.version,description:e.description})}),X&&$e.length>0&&a(`h2`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:g(`admin.system.addons.installed`,`Installed`)}),xe&&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 max-w-sm pointer-events-auto`,children:[a(m,{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:g(`admin.system.addons.bulkUpdateCompleted`,`Bulk update completed`)}),a(`div`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:g(`admin.system.addons.systemPackagesUpdatedHubRestarted`,`System packages updated — hub restarted successfully.`)})]})]}),p===`pending`&&t(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[a(b,{className:`h-3 w-3 animate-spin`}),g(`admin.system.addons.loadingInstalled`,`Loading installed addons…`)]}),p===`error`&&a(`div`,{className:`text-xs text-danger`,children:g(`admin.system.addons.failedToLoadAddons`,`Failed to load addons`)}),p===`ready`&&$e.length===0&&a(`div`,{className:`text-xs text-foreground-subtle`,children:c.length===0?g(`admin.system.addons.noAddonsInstalled`,`No addons installed`):X?g(`admin.system.addons.noInstalledAddonDeclaresThe`,`No installed addon declares the "{{capabilityFilter}}" capability. Any addon you can install appears under "Available to install" above.`,{capabilityFilter:X}):g(`admin.system.addons.noAddonsCompatibleWithPlacement`,`No addons compatible with {{name}} (placement filter active)`,{name:d.name})}),a(`div`,{className:`space-y-1.5`,children:p===`ready`&&nt.map(e=>{let t=$(e)?e.bundle.packageName:e.manifest.packageName,n=k.get(t),r=re.get(t),i=$(e)?e.representative:e,o=n?e=>fe.mutate({name:t,version:e,nodeId:d.id}):void 0,s=me.get(t)??null,c=s!==null&&Ge(s);return a(_t,{addon:i,clusterStatus:u?.[i.manifest.id],bundle:$(e)?e.bundle:void 0,availableUpdate:n,...r===void 0?{}:{blockedUpdate:r},...r===void 0?{}:{onUpdateServer:()=>S(!0)},isUpdating:j.has(t)||c,jobProgress:s,onUpdate:o,disabledByBulk:R.isPending,selectedNode:d},$(e)?t:e.manifest.id)})}),Ce!==null&&a(kt,{target:Ce,installing:Oe.isPending,installError:Te,onClose:()=>K(null),onInstall:(e,t)=>Oe.mutate({packageName:e,version:t})})]})}function Wt(){let{t:e}=q(),r=l(),{data:i}=oe(void 0),{nodes:s}=ue(),{selection:c,selectNode:u,requestedNodeId:d}=Ve(s.length>0?s:[Rt]),f=c.node??Rt,p=f.id,m=s.length>0?c.staleNodeId:null,{data:h,isLoading:g,isError:_}=K({nodeId:p}),v=B(),y=V(),b=v.isPending||y.isPending,x=async()=>{await v.mutateAsync({nodeId:p}),await y.mutateAsync(),r.invalidateQueries({queryKey:[[`addons`]]})},S=n(v);S.current=v;let C=n(d??`hub`);o(()=>{S.current.mutate({nodeId:C.current})},[]);let w=(h??[]).map(Vt).filter(e=>e!==null);return t(Fe,{children:[t(`div`,{className:`flex items-center justify-between gap-2 flex-wrap`,children:[a(M,{selectedNodeId:p,onSelect:u}),t(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[!g&&!_&&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:w.length})}),t(H,{variant:`unstyled`,type:`button`,onClick:()=>void x(),disabled:b,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(O,{className:`w-3 h-3 ${b?`animate-spin`:``}`}),e(`admin.system.addons.checkForUpdates`,`Check for updates`)]})]})]}),a(X,{staleNodeId:m,shownNodeName:f.name}),a(jt,{selectedNode:f}),a(Ut,{addons:w,clusterStatus:i,selectedNode:f,onRefresh:()=>void x(),listPhase:g?`pending`:_?`error`:`ready`})]})}export{Wt as AddonsPage};