@camstack/addon-admin-ui 1.2.485 → 1.2.487

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 (137) hide show
  1. package/dist/assets/{AddonAssetIcon-3vq-0y-v.js → AddonAssetIcon-C_RF_2Yp.js} +1 -1
  2. package/dist/assets/Addons-kSjXhQba.js +5 -0
  3. package/dist/assets/{AdminPage-QmLz5qjj.js → AdminPage-Qn0NDZXK.js} +1 -1
  4. package/dist/assets/{AdminSectionedPage-D9jBOpIg.js → AdminSectionedPage-xGVLV1j3.js} +1 -1
  5. package/dist/assets/AiProfiles-C7RRiZ-Y.js +3 -0
  6. package/dist/assets/{BrokerForm-D8mkRSYS.js → BrokerForm-pprTt8-v.js} +1 -1
  7. package/dist/assets/Build-BhxXDEVz.js +40 -0
  8. package/dist/assets/{Calendars-Beo-YqjO.js → Calendars-v8J_zj4w.js} +1 -1
  9. package/dist/assets/{Cluster-B-_bS1Yq.js → Cluster-dhAPfJv6.js} +1 -1
  10. package/dist/assets/{CompositionBlockEditor-iMNTwm3C.js → CompositionBlockEditor-BK2Or4Pz.js} +1 -1
  11. package/dist/assets/{CompositionEditorPage-BED3S8xk.js → CompositionEditorPage-CTPdWS1m.js} +1 -1
  12. package/dist/assets/Data-CPdzZaQ6.js +2 -0
  13. package/dist/assets/DeviceDetail-DGJeLN9c.js +2 -0
  14. package/dist/assets/{DeviceDoActionFields-BJfHVs6x.js → DeviceDoActionFields-OU-F7_Md.js} +1 -1
  15. package/dist/assets/{Devices-_2nQ8QL2.js → Devices-C9LPgFce.js} +1 -1
  16. package/dist/assets/{EmbedPlayerPage-D6aNp4TG.js → EmbedPlayerPage-8ilkZLox.js} +1 -1
  17. package/dist/assets/HelperWizard-Dq94Geed.js +2 -0
  18. package/dist/assets/History-CTyWzxbJ.js +1 -0
  19. package/dist/assets/Identity-DOSuuL8C.js +1 -0
  20. package/dist/assets/IntegrationDetail-Bj2o8Gyl.js +1 -0
  21. package/dist/assets/{IntegrationHub-D5yLfTfh.js → IntegrationHub-D-BT1i-q.js} +1 -1
  22. package/dist/assets/Integrations-CKR4hJyA.js +1 -0
  23. package/dist/assets/{Integrations-C_kA-dpe.js → Integrations-Dn8CFiTq.js} +1 -1
  24. package/dist/assets/{Library-Bx344878.js → Library-DzwP0Wnj.js} +1 -1
  25. package/dist/assets/{Locations-Do1Y0voR.js → Locations-BYPw-b2Z.js} +2 -2
  26. package/dist/assets/{Logs-svtt17dH.js → Logs-BlImwaLa.js} +1 -1
  27. package/dist/assets/{MaskShapeCanvas-CzHUGkc7.js → MaskShapeCanvas-Cs9lGzkk.js} +1 -1
  28. package/dist/assets/{MotionZonesSettings-sCDWBSMu.js → MotionZonesSettings-5ocz0RHa.js} +1 -1
  29. package/dist/assets/{MyAccess-C3MmE-Hf.js → MyAccess-VP7h9O7-.js} +1 -1
  30. package/dist/assets/Network-Bla9sJtL.js +1 -0
  31. package/dist/assets/{NodeAddonsSettingsPanel-DUUGVGQU.js → NodeAddonsSettingsPanel-AvBI4Evv.js} +1 -1
  32. package/dist/assets/Notifications-H77YTWdJ.js +1 -0
  33. package/dist/assets/Pipeline-pHUqWRzY.js +1 -0
  34. package/dist/assets/{PrivacyMaskSettings-DH3PZaEy.js → PrivacyMaskSettings-UQH7zTTO.js} +1 -1
  35. package/dist/assets/Recordings-BDCMjtre.js +1 -0
  36. package/dist/assets/{ScanNetworkModal-PQbiE2mC.js → ScanNetworkModal-B59m4nHs.js} +1 -1
  37. package/dist/assets/{SceneMonitorEditor-CLWf6Z9-.js → SceneMonitorEditor-PrBW7EMG.js} +1 -1
  38. package/dist/assets/SessionsList-CSJK-M1F.js +2 -0
  39. package/dist/assets/{Showroom-BOzjtIAL.js → Showroom-mL9KRe6u.js} +1 -1
  40. package/dist/assets/System-CW6fpBto.js +1 -0
  41. package/dist/assets/{Terminal-B2SRyo3p.js → Terminal-CLB_5tnQ.js} +5 -5
  42. package/dist/assets/{Viewer-CTvuCeo6.js → Viewer-CVsr_E-j.js} +1 -1
  43. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DAW63rZZ.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-CK4gM4oq.js} +1 -1
  44. package/dist/assets/{addon-icons-context-Bzdujcmt.js → addon-icons-context-BKk0-b-B.js} +1 -1
  45. package/dist/assets/{archive-dvL2Bchb.js → archive-BR503Bgl.js} +1 -1
  46. package/dist/assets/{assignment-candidates-D1rkNXjX.js → assignment-candidates-Bt36QoWU.js} +1 -1
  47. package/dist/assets/{authed-media-B6hJJcft.js → authed-media-B5-BZoAQ.js} +1 -1
  48. package/dist/assets/{bell-off-C3flB_OF.js → bell-off-3JXpdmf4.js} +1 -1
  49. package/dist/assets/{board-model-BJ20DSDr.js → board-model-B0Q2QBXn.js} +1 -1
  50. package/dist/assets/{boxes-BiMbpzNh.js → boxes-0Xg4N6GT.js} +1 -1
  51. package/dist/assets/circle-slash-bfqjP0sy.js +1 -0
  52. package/dist/assets/client-CgAb3Nw-.js +358 -0
  53. package/dist/assets/{cloud-upload-CAJgV_u1.js → cloud-upload-BgVc9mNQ.js} +1 -1
  54. package/dist/assets/crop-DYBE_kWG.js +1 -0
  55. package/dist/assets/{device-integration-icon-Csh9ZCwn.js → device-integration-icon-CxktyXD5.js} +1 -1
  56. package/dist/assets/device-picker-model-DF4u2b9z.js +1 -0
  57. package/dist/assets/{dist-CPp8d_RN.js → dist-BCJVDfA5.js} +1 -1
  58. package/dist/assets/dist-BJ8kdWPh.js +358 -0
  59. package/dist/assets/{eraser-BL6nSeLQ.js → eraser-xkgMNpsn.js} +1 -1
  60. package/dist/assets/{format-Cl0i0-3O.js → format-6k9X14Bz.js} +1 -1
  61. package/dist/assets/{hard-drive-download-ysGKYLwW.js → hard-drive-download-CUmPIudl.js} +1 -1
  62. package/dist/assets/{hostInit-CDPK_pyj.js → hostInit-DcyTvfcE.js} +1 -1
  63. package/dist/assets/i18n-Zscg3Dkf.js +1 -0
  64. package/dist/assets/icons-D7uD703E.js +1 -0
  65. package/dist/assets/index-Cgn0pmzp.js +4 -0
  66. package/dist/assets/{key-xS-HUgNI.js → key-VxuVSDcq.js} +1 -1
  67. package/dist/assets/{key-round-BDT5O9Ed.js → key-round-DOAkaBGK.js} +1 -1
  68. package/dist/assets/{layers-BeRWYCde.js → layers-hN2OAslg.js} +1 -1
  69. package/dist/assets/{linked-devices-model-zOoasg7W.js → linked-devices-model-m3azqStw.js} +1 -1
  70. package/dist/assets/{list-ordered-DKzGLPr6.js → list-ordered-B7_m7mQG.js} +1 -1
  71. package/dist/assets/{location-owned-usage-CWUx1diZ.js → location-owned-usage-D-K-peZa.js} +1 -1
  72. package/dist/assets/{log-in-53JDrQ-P.js → log-in-CyzfmKrH.js} +1 -1
  73. package/dist/assets/{memory-stick-B9PVELyF.js → memory-stick-Bh-D1JrM.js} +1 -1
  74. package/dist/assets/{message-square-plus-B32IU45x.js → message-square-plus-Jq5Qx-ZG.js} +1 -1
  75. package/dist/assets/{mf-entry-bootstrap-0-40dc4d62.js → mf-entry-bootstrap-0-01ed437f.js} +2 -2
  76. package/dist/assets/{mic-off-B0w-1GrV.js → mic-off-HMWnEzre.js} +1 -1
  77. package/dist/assets/{monitor-off-Cz2SxBVE.js → monitor-off-jWwMgNhA.js} +1 -1
  78. package/dist/assets/{monitor-smartphone-Cqk6Z8Hg.js → monitor-smartphone-CR32s5N4.js} +1 -1
  79. package/dist/assets/mount-DF4u2b9z.js +1 -0
  80. package/dist/assets/{player-overlays-Cs6l33cj.js → player-overlays-BT3xIHAn.js} +1 -1
  81. package/dist/assets/{recycle-DpB4QxbX.js → recycle-DZmrkdVl.js} +1 -1
  82. package/dist/assets/remoteEntry-HwnLQWmW.js +1 -0
  83. package/dist/assets/{scan-eye-DcYrgFOu.js → scan-eye-B5rZ7zGT.js} +1 -1
  84. package/dist/assets/{scissors-_j_D3ONm.js → scissors-DwAZ3q7Q.js} +1 -1
  85. package/dist/assets/{search-x-9dPd-b95.js → search-x-B-oRfcQP.js} +1 -1
  86. package/dist/assets/{send-D42ODbS7.js → send-ZjS8CwTz.js} +1 -1
  87. package/dist/assets/{settings-2-zgGmo4c8.js → settings-2-5VaXifkQ.js} +1 -1
  88. package/dist/assets/sigma-Do3DgNJ1.js +1 -0
  89. package/dist/assets/{speaker-DIPHxIQ6.js → speaker-TZvdN1cH.js} +1 -1
  90. package/dist/assets/src-DX_JbsFG.js +67 -0
  91. package/dist/assets/{step-inspector-model-DTr-lHt_.js → step-inspector-model-Cge4IaLZ.js} +1 -1
  92. package/dist/assets/{table-2-lftK0wHb.js → table-2-Dqcebk-T.js} +1 -1
  93. package/dist/assets/{timer-reset-catAE_r9.js → timer-reset-y8kv-UE8.js} +1 -1
  94. package/dist/assets/{ungroup-BKImeHER.js → ungroup-Cy8_Al2f.js} +1 -1
  95. package/dist/assets/{unlink-Behl018w.js → unlink-Db_gKOzw.js} +1 -1
  96. package/dist/assets/{usb-D5kzB8kq.js → usb-B0VgCbP1.js} +1 -1
  97. package/dist/assets/{use-scenes-feed-CGDnep25.js → use-scenes-feed-BX2r5CSu.js} +1 -1
  98. package/dist/assets/{use-stationary-objects-D_R5OahX.js → use-stationary-objects-B6gvXwen.js} +1 -1
  99. package/dist/assets/useEventInvalidation-DF4u2b9z.js +1 -0
  100. package/dist/assets/{useNodeUrlSelection-nYjP8xK4.js → useNodeUrlSelection-cuUDxmhY.js} +1 -1
  101. package/dist/assets/user-round-84cYKzbg.js +1 -0
  102. package/dist/assets/{user-x-COQ6vhb4.js → user-x-CgHtIGhf.js} +1 -1
  103. package/dist/assets/{video-Byw3ItoR.js → video-DYC_GW17.js} +1 -1
  104. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-CsFmgfi4.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-HxO7Tlud.js} +2 -2
  105. package/dist/index.html +9 -9
  106. package/dist/server/addon.js +244 -25
  107. package/package.json +1 -1
  108. package/dist/assets/Addons-CW_V36k4.js +0 -5
  109. package/dist/assets/AiProfiles-CP5xqeEk.js +0 -3
  110. package/dist/assets/Build-DVpLjguC.js +0 -40
  111. package/dist/assets/Data-CP80sADS.js +0 -2
  112. package/dist/assets/DeviceDetail-DEfKCzwe.js +0 -2
  113. package/dist/assets/HelperWizard-2-iOB1DP.js +0 -2
  114. package/dist/assets/History-DU5KjafA.js +0 -1
  115. package/dist/assets/Identity-Bx1SUu2F.js +0 -1
  116. package/dist/assets/IntegrationDetail-BtGF0XsO.js +0 -1
  117. package/dist/assets/Integrations-nsyVrgEK.js +0 -1
  118. package/dist/assets/Network-D3RwGDhy.js +0 -1
  119. package/dist/assets/Notifications-CProzw2o.js +0 -1
  120. package/dist/assets/Pipeline-kOwhFjIj.js +0 -1
  121. package/dist/assets/Recordings-CUmSLBG6.js +0 -1
  122. package/dist/assets/SessionsList-BNTGQ-KG.js +0 -2
  123. package/dist/assets/System-DrbzraIN.js +0 -1
  124. package/dist/assets/chart-column-BMpUb2lF.js +0 -1
  125. package/dist/assets/circle-slash-B8Tjloe5.js +0 -1
  126. package/dist/assets/client-Ct1F5MoE.js +0 -358
  127. package/dist/assets/crop-CS-td_0y.js +0 -1
  128. package/dist/assets/device-picker-model-P-UzQOB7.js +0 -1
  129. package/dist/assets/dist-B89wGMMB.js +0 -358
  130. package/dist/assets/i18n-sTui-nG3.js +0 -1
  131. package/dist/assets/icons-B7uNvSe0.js +0 -1
  132. package/dist/assets/index-Dow2-3ZC.js +0 -4
  133. package/dist/assets/mount-P-UzQOB7.js +0 -1
  134. package/dist/assets/remoteEntry-BGbchE1L.js +0 -1
  135. package/dist/assets/src-DFzrn-CX.js +0 -67
  136. package/dist/assets/useEventInvalidation-P-UzQOB7.js +0 -1
  137. package/dist/assets/user-round-BJVl6LX9.js +0 -1
@@ -5443,7 +5443,7 @@ var ZodIssueCode = {
5443
5443
  var ZodFirstPartyTypeKind;
5444
5444
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5445
5445
  //#endregion
5446
- //#region ../types/dist/sleep-0sD_LHLI.mjs
5446
+ //#region ../types/dist/sleep--jXS9hWo.mjs
5447
5447
  /**
5448
5448
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5449
5449
  * window to float samples (D455).
@@ -8583,6 +8583,7 @@ var CAP_NAMES = Object.freeze([
8583
8583
  "filesystem-browse",
8584
8584
  "flood",
8585
8585
  "gas",
8586
+ "group-active",
8586
8587
  "group-commands",
8587
8588
  "group-status",
8588
8589
  "heating-valve",
@@ -9404,6 +9405,10 @@ Object.freeze({
9404
9405
  "path": "detected",
9405
9406
  "valueType": "boolean"
9406
9407
  }],
9408
+ "group-active": [{
9409
+ "path": "active",
9410
+ "valueType": "boolean"
9411
+ }],
9407
9412
  "group-status": [
9408
9413
  {
9409
9414
  "path": "included",
@@ -10759,7 +10764,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
10759
10764
  return DeviceRole;
10760
10765
  }({});
10761
10766
  //#endregion
10762
- //#region ../types/dist/composition-CpETZ4HL.mjs
10767
+ //#region ../types/dist/composition-Bb8iwHEJ.mjs
10763
10768
  /**
10764
10769
  * The ffmpeg build every CamStack node downloads, per platform and arch.
10765
10770
  *
@@ -11074,6 +11079,13 @@ var table = {
11074
11079
  apply: () => {
11075
11080
  throw new ExpressionEvalError("latchedAt: stateful evaluation context is required");
11076
11081
  }
11082
+ },
11083
+ schmitt: {
11084
+ minArgs: 3,
11085
+ maxArgs: 5,
11086
+ apply: () => {
11087
+ throw new ExpressionEvalError("schmitt: stateful evaluation context is required");
11088
+ }
11077
11089
  }
11078
11090
  };
11079
11091
  Object.freeze(Object.assign(Object.create(null), table));
@@ -11584,7 +11596,7 @@ var RESET_PERIODS = [
11584
11596
  5 * MINUTE_MS;
11585
11597
  24 * HOUR_MS, 2 * DAY_MS, 7 * DAY_MS, 30 * DAY_MS;
11586
11598
  7 * DAY_MS, 30 * DAY_MS, 365 * DAY_MS;
11587
- var StatisticWindowSchema = discriminatedUnion("kind", [object({
11599
+ var rollingWindowObject = object({
11588
11600
  kind: literal("rolling"),
11589
11601
  span: _enum(ROLLING_SPANS),
11590
11602
  customMinutes: number().int().min(5).optional()
@@ -11601,7 +11613,9 @@ var StatisticWindowSchema = discriminatedUnion("kind", [object({
11601
11613
  path: ["customMinutes"],
11602
11614
  input: payload.value
11603
11615
  });
11604
- }), object({
11616
+ });
11617
+ var RollingWindowSchema = rollingWindowObject;
11618
+ var StatisticWindowSchema = discriminatedUnion("kind", [rollingWindowObject, object({
11605
11619
  kind: literal("calendar"),
11606
11620
  period: _enum(CALENDAR_PERIODS)
11607
11621
  })]);
@@ -11631,7 +11645,13 @@ var GROUP_TEMPLATE_IDS = [
11631
11645
  "occupancy",
11632
11646
  "binary",
11633
11647
  "switch",
11634
- "light"
11648
+ "light",
11649
+ "fan",
11650
+ "cover",
11651
+ "valve",
11652
+ "lock",
11653
+ "media-player",
11654
+ "climate"
11635
11655
  ];
11636
11656
  var NUMERIC_AGGREGATES = [
11637
11657
  "mean",
@@ -11690,6 +11710,42 @@ var HelperSpecSchema = discriminatedUnion("kind", [
11690
11710
  reset: _enum(RESET_PERIODS),
11691
11711
  output: _enum(["energy", "meter"]),
11692
11712
  source: HelperMemberSchema
11713
+ }),
11714
+ object({
11715
+ kind: literal("threshold"),
11716
+ source: HelperMemberSchema,
11717
+ high: number(),
11718
+ low: number(),
11719
+ onForMs: number().int().nonnegative(),
11720
+ offForMs: number().int().nonnegative()
11721
+ }),
11722
+ object({
11723
+ kind: literal("arithmetic"),
11724
+ op: _enum([
11725
+ "sum",
11726
+ "difference",
11727
+ "ratio"
11728
+ ]),
11729
+ inputs: array(HelperMemberSchema).min(2).max(64)
11730
+ }),
11731
+ object({
11732
+ kind: literal("expression"),
11733
+ expr: string().min(1),
11734
+ inputs: array(object({
11735
+ name: string().min(1),
11736
+ member: HelperMemberSchema
11737
+ })).min(1).max(64),
11738
+ output: _enum(["number", "boolean"])
11739
+ }),
11740
+ object({
11741
+ kind: literal("derivative"),
11742
+ window: RollingWindowSchema,
11743
+ per: _enum([
11744
+ "second",
11745
+ "minute",
11746
+ "hour"
11747
+ ]),
11748
+ source: HelperMemberSchema
11693
11749
  })
11694
11750
  ]);
11695
11751
  /** A composed device's stableId is this prefix plus the block id. */
@@ -11752,6 +11808,12 @@ var CompositionFieldSourceSchema = discriminatedUnion("kind", [
11752
11808
  "all"
11753
11809
  ]),
11754
11810
  reads: array(CompositionFieldReadSchema).min(1).max(64),
11811
+ /**
11812
+ * Set when the reads are an enum state, not a yes/no: the listed states
11813
+ * count as active (a cover is `open`). A state outside the list is inactive;
11814
+ * a read that is not a state at all is left out. Only `any` / `all` use it.
11815
+ */
11816
+ activeWhen: array(string().min(1)).min(1).optional(),
11755
11817
  /** `value` is the reading; the others are the member counts. */
11756
11818
  publish: _enum([
11757
11819
  "value",
@@ -18178,13 +18240,17 @@ Object.freeze({
18178
18240
  latchedAt: {
18179
18241
  kind: "fixed",
18180
18242
  result: ["number", "null"]
18243
+ },
18244
+ schmitt: {
18245
+ kind: "fixed",
18246
+ result: ["boolean", "null"]
18181
18247
  }
18182
18248
  });
18183
18249
  /**
18184
18250
  * One catalog row per base reading a group helper can build (D944 §3).
18185
18251
  * Data, not a form default written into the block.
18186
18252
  */
18187
- var NOW$1 = {
18253
+ var NOW$2 = {
18188
18254
  fieldPath: "lastFetchedAt",
18189
18255
  expr: "now"
18190
18256
  };
@@ -18198,6 +18264,8 @@ function numeric(input) {
18198
18264
  family: "numeric",
18199
18265
  deviceType: DeviceType.Sensor,
18200
18266
  memberDeviceType: DeviceType.Sensor,
18267
+ memberDeviceTypes: [DeviceType.Sensor],
18268
+ activeWhen: void 0,
18201
18269
  commandCaps: [],
18202
18270
  baseUnit: baseUnitOf(input.quantity),
18203
18271
  aggregates: NUMERIC_AGGREGATES,
@@ -18213,6 +18281,8 @@ function binary(input) {
18213
18281
  family: "binary",
18214
18282
  deviceType: DeviceType.Sensor,
18215
18283
  memberDeviceType: DeviceType.Sensor,
18284
+ memberDeviceTypes: [DeviceType.Sensor],
18285
+ activeWhen: void 0,
18216
18286
  commandCaps: [],
18217
18287
  quantity: "none",
18218
18288
  baseUnit: void 0,
@@ -18230,7 +18300,7 @@ var GROUP_TEMPLATES = [
18230
18300
  quantity: "temperature",
18231
18301
  defaultAggregate: "mean",
18232
18302
  empty: "null",
18233
- companions: [NOW$1]
18303
+ companions: [NOW$2]
18234
18304
  }),
18235
18305
  numeric({
18236
18306
  id: "humidity",
@@ -18241,7 +18311,7 @@ var GROUP_TEMPLATES = [
18241
18311
  quantity: "humidity",
18242
18312
  defaultAggregate: "mean",
18243
18313
  empty: "null",
18244
- companions: [NOW$1]
18314
+ companions: [NOW$2]
18245
18315
  }),
18246
18316
  numeric({
18247
18317
  id: "pressure",
@@ -18252,7 +18322,7 @@ var GROUP_TEMPLATES = [
18252
18322
  quantity: "pressure",
18253
18323
  defaultAggregate: "mean",
18254
18324
  empty: "null",
18255
- companions: [NOW$1]
18325
+ companions: [NOW$2]
18256
18326
  }),
18257
18327
  numeric({
18258
18328
  id: "illuminance",
@@ -18263,7 +18333,7 @@ var GROUP_TEMPLATES = [
18263
18333
  quantity: "illuminance",
18264
18334
  defaultAggregate: "mean",
18265
18335
  empty: "null",
18266
- companions: [NOW$1]
18336
+ companions: [NOW$2]
18267
18337
  }),
18268
18338
  numeric({
18269
18339
  id: "power",
@@ -18274,7 +18344,7 @@ var GROUP_TEMPLATES = [
18274
18344
  quantity: "power",
18275
18345
  defaultAggregate: "sum",
18276
18346
  empty: "omit",
18277
- companions: [NOW$1]
18347
+ companions: [NOW$2]
18278
18348
  }),
18279
18349
  numeric({
18280
18350
  id: "energy",
@@ -18285,7 +18355,7 @@ var GROUP_TEMPLATES = [
18285
18355
  quantity: "energy",
18286
18356
  defaultAggregate: "sum",
18287
18357
  empty: "omit",
18288
- companions: [NOW$1]
18358
+ companions: [NOW$2]
18289
18359
  }),
18290
18360
  numeric({
18291
18361
  id: "battery",
@@ -18320,7 +18390,7 @@ var GROUP_TEMPLATES = [
18320
18390
  quantity: "device",
18321
18391
  defaultAggregate: "mean",
18322
18392
  empty: "null",
18323
- companions: [NOW$1]
18393
+ companions: [NOW$2]
18324
18394
  }),
18325
18395
  binary({
18326
18396
  id: "motion",
@@ -18414,6 +18484,11 @@ var GROUP_TEMPLATES = [
18414
18484
  summary: "On when at least one switch is on, or when all of them are. Offline and unknown members are left out of that decision, never read as off, and still receive the command.",
18415
18485
  deviceType: DeviceType.Switch,
18416
18486
  outputCap: "switch",
18487
+ outputField: "on",
18488
+ member: {
18489
+ cap: "switch",
18490
+ fieldPath: "on"
18491
+ },
18417
18492
  commandCaps: ["switch"]
18418
18493
  }),
18419
18494
  actuator({
@@ -18421,29 +18496,130 @@ var GROUP_TEMPLATES = [
18421
18496
  summary: "On when at least one light is on, or when all of them are. Brightness and colour are offered only when every member has them. A command is not sent to a member that lacks it.",
18422
18497
  deviceType: DeviceType.Light,
18423
18498
  outputCap: "switch",
18499
+ outputField: "on",
18500
+ member: {
18501
+ cap: "switch",
18502
+ fieldPath: "on"
18503
+ },
18424
18504
  commandCaps: [
18425
18505
  "switch",
18426
18506
  "brightness",
18427
18507
  "color"
18428
18508
  ]
18509
+ }),
18510
+ actuator({
18511
+ id: "fan",
18512
+ summary: "On when at least one fan is on, or when all of them are. Speed, preset, direction and oscillation are offered only when every fan has them. A command is not sent to a fan that lacks it.",
18513
+ deviceType: DeviceType.Fan,
18514
+ outputCap: "switch",
18515
+ outputField: "on",
18516
+ member: {
18517
+ cap: "switch",
18518
+ fieldPath: "on"
18519
+ },
18520
+ commandCaps: ["switch", "fan-control"]
18521
+ }),
18522
+ actuator({
18523
+ id: "cover",
18524
+ summary: "Open when at least one cover is open or part-open, or only when all of them are. Position and tilt are offered only when every cover has them. A cover that reports nothing is left out, never read as closed.",
18525
+ deviceType: DeviceType.Cover,
18526
+ outputCap: "group-active",
18527
+ outputField: "active",
18528
+ member: {
18529
+ cap: "cover",
18530
+ fieldPath: "state"
18531
+ },
18532
+ activeWhen: [
18533
+ "open",
18534
+ "opening",
18535
+ "stopped"
18536
+ ],
18537
+ commandCaps: ["cover"]
18538
+ }),
18539
+ actuator({
18540
+ id: "valve",
18541
+ summary: "Open when at least one valve is open or part-open, or only when all of them are. Position is offered only when every valve has it. A valve that reports nothing is left out, never read as closed.",
18542
+ deviceType: DeviceType.Valve,
18543
+ outputCap: "group-active",
18544
+ outputField: "active",
18545
+ member: {
18546
+ cap: "valve",
18547
+ fieldPath: "state"
18548
+ },
18549
+ activeWhen: [
18550
+ "open",
18551
+ "opening",
18552
+ "stopped"
18553
+ ],
18554
+ commandCaps: ["valve"]
18555
+ }),
18556
+ actuator({
18557
+ id: "lock",
18558
+ summary: "Locked when at least one lock is locked, or only when all of them are. A jammed or moving lock is not locked. Locking is one tap; unlocking the group needs a confirmation every time, and nothing is sent without it.",
18559
+ deviceType: DeviceType.Lock,
18560
+ outputCap: "group-active",
18561
+ outputField: "active",
18562
+ member: {
18563
+ cap: "lock-control",
18564
+ fieldPath: "state"
18565
+ },
18566
+ activeWhen: ["locked"],
18567
+ commandCaps: ["lock-control"]
18568
+ }),
18569
+ actuator({
18570
+ id: "media-player",
18571
+ summary: "Playing when at least one player is playing, or only when all of them are. Volume is offered only when every player has it. A player that reports nothing is left out, never read as stopped.",
18572
+ deviceType: DeviceType.MediaPlayer,
18573
+ outputCap: "group-active",
18574
+ outputField: "active",
18575
+ member: {
18576
+ cap: "media-player",
18577
+ fieldPath: "state"
18578
+ },
18579
+ activeWhen: ["playing", "buffering"],
18580
+ commandCaps: ["media-player"]
18581
+ }),
18582
+ actuator({
18583
+ id: "climate",
18584
+ summary: "Running when at least one thermostat or air conditioner is not off, or only when all of them are. Target temperature and fan are offered only when every device has them. A device that reports nothing is left out, never read as off.",
18585
+ deviceType: DeviceType.Thermostat,
18586
+ memberDeviceTypes: [DeviceType.Thermostat, DeviceType.Climate],
18587
+ outputCap: "group-active",
18588
+ outputField: "active",
18589
+ member: {
18590
+ cap: "climate-control",
18591
+ fieldPath: "mode"
18592
+ },
18593
+ activeWhen: [
18594
+ "heat",
18595
+ "cool",
18596
+ "auto",
18597
+ "heat_cool",
18598
+ "fan_only",
18599
+ "dry"
18600
+ ],
18601
+ commandCaps: ["climate-control"]
18429
18602
  })
18430
18603
  ];
18431
18604
  function actuator(input) {
18432
18605
  return {
18433
- ...input,
18606
+ id: input.id,
18607
+ summary: input.summary,
18608
+ deviceType: input.deviceType,
18609
+ outputCap: input.outputCap,
18610
+ outputField: input.outputField,
18611
+ commandCaps: input.commandCaps,
18434
18612
  family: "actuator",
18435
18613
  role: void 0,
18436
18614
  memberDeviceType: input.deviceType,
18437
- outputField: "on",
18615
+ memberDeviceTypes: input.memberDeviceTypes ?? [input.deviceType],
18616
+ activeWhen: input.activeWhen,
18438
18617
  quantity: "none",
18439
18618
  baseUnit: void 0,
18440
18619
  aggregates: BINARY_AGGREGATES,
18441
18620
  defaultAggregate: "any",
18442
18621
  empty: "offline",
18443
- accept: [{
18444
- cap: "switch",
18445
- fieldPath: "on"
18446
- }],
18622
+ accept: [input.member],
18447
18623
  companions: [CHANGED]
18448
18624
  };
18449
18625
  }
@@ -46107,7 +46283,20 @@ var NcRuleInputSchema = object({
46107
46283
  * save by the hub's grouping guard). `.optional()`, never `.default()`: the addon cap
46108
46284
  * path does not run Zod defaults.
46109
46285
  */
46110
- groupingSec: number().int().min(5).max(60).optional()
46286
+ groupingSec: number().int().min(5).max(60).optional(),
46287
+ /**
46288
+ * ASK ME TO CONFIRM DETECTIONS (#243): a DETECTION notification of this rule
46289
+ * carries "Correct" / "Wrong" buttons (and, where the channel has room, a
46290
+ * "Wrong, it is a <class>" choice). A tap marks the track for retraining, the
46291
+ * same mark the Library writes, and records whose notification it was and
46292
+ * when. A channel with no buttons gets the same two choices as links.
46293
+ *
46294
+ * `.optional()`, never `.default()` (a Zod default does not run on the addon
46295
+ * cap path): absent and `false` both mean off, which is what every rule
46296
+ * authored before this field meant. An editor turns it off by writing
46297
+ * `false`, so it needs no `clear` key.
46298
+ */
46299
+ askVerdict: boolean().optional()
46111
46300
  });
46112
46301
  /**
46113
46302
  * Partial patch for `updateRule` — any subset of the input fields, plus the
@@ -58308,7 +58497,13 @@ results: array(object({
58308
58497
  /** Ms epoch of the attempt. */
58309
58498
  at: number()
58310
58499
  })) });
58311
- DeviceType.Switch, DeviceType.Light;
58500
+ DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Cover, DeviceType.Valve, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.Thermostat, DeviceType.Climate;
58501
+ object({
58502
+ active: boolean().meta({ label: "Active" }),
58503
+ /** Ms epoch when the slice was last updated. */
58504
+ lastChangedAt: number()
58505
+ });
58506
+ DeviceType.Cover, DeviceType.Valve, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.Climate, DeviceType.Thermostat;
58312
58507
  object({
58313
58508
  /** Members whose current value entered the aggregate. */
58314
58509
  included: number().int().nonnegative().meta(readingMeta("count", {
@@ -58326,7 +58521,7 @@ object({
58326
58521
  label: "Members"
58327
58522
  }))
58328
58523
  });
58329
- DeviceType.Sensor, DeviceType.Switch, DeviceType.Light;
58524
+ DeviceType.Sensor, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Cover, DeviceType.Valve, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.Thermostat, DeviceType.Climate;
58330
58525
  object({
58331
58526
  /** Radiator valve opening 0 (closed) .. 100 (open). Null = not yet known. */
58332
58527
  position: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
@@ -59233,7 +59428,14 @@ DeviceType.Lock, method(object({
59233
59428
  auth: "protected"
59234
59429
  }), method(object({
59235
59430
  deviceId: number().int().nonnegative(),
59236
- code: string().min(1).optional()
59431
+ code: string().min(1).optional(),
59432
+ /**
59433
+ * Honoured by a helper lock GROUP only (D944): unlocking several doors
59434
+ * with one call is refused unless the caller says it was confirmed. A
59435
+ * single lock ignores it. The refusal lives in the callee, so no
59436
+ * automation or API caller reaches the doors by skipping a dialog.
59437
+ */
59438
+ confirm: boolean().optional()
59237
59439
  }), _void(), {
59238
59440
  kind: "mutation",
59239
59441
  auth: "protected"
@@ -63649,7 +63851,7 @@ object({
63649
63851
  /** Ms epoch of the last state change. Useful for UI "X minutes ago". */
63650
63852
  lastChangedAt: number()
63651
63853
  });
63652
- DeviceType.Switch, DeviceType.Siren, DeviceType.Light, method(object({
63854
+ DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, method(object({
63653
63855
  deviceId: number(),
63654
63856
  on: boolean()
63655
63857
  }), _void(), {
@@ -65341,6 +65543,7 @@ method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" })
65341
65543
  kind: "mutation",
65342
65544
  auth: "admin"
65343
65545
  });
65546
+ DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.ValvePositionable, DeviceFeature.MediaPlayerVolume, DeviceFeature.ClimateFanMode;
65344
65547
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
65345
65548
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Camera, DeviceType.Camera, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder;
65346
65549
  String.raw`rose\(active(\d+), changed(\d+), (\d+(?:\.\d+)?)\)`;
@@ -68618,6 +68821,13 @@ Object.freeze({
68618
68821
  access: "view",
68619
68822
  role: "viewer"
68620
68823
  },
68824
+ "groupActive.getStatus": {
68825
+ capName: "group-active",
68826
+ capScope: "device",
68827
+ addonId: null,
68828
+ access: "view",
68829
+ role: "viewer"
68830
+ },
68621
68831
  "groupCommands.getStatus": {
68622
68832
  capName: "group-commands",
68623
68833
  capScope: "device",
@@ -78493,6 +78703,10 @@ var SENSOR_CAP_VOCABULARY = {
78493
78703
  icon: "flame"
78494
78704
  }]
78495
78705
  },
78706
+ "group-active": {
78707
+ scope: "device",
78708
+ noun: t("Group state", "Stato del gruppo")
78709
+ },
78496
78710
  "group-commands": {
78497
78711
  scope: "device",
78498
78712
  noun: t("Group command", "Comando di gruppo")
@@ -80039,6 +80253,11 @@ Object.freeze({
80039
80253
  form: "single",
80040
80254
  optional: false
80041
80255
  }],
80256
+ "groupActive.getStatus": [{
80257
+ name: "deviceId",
80258
+ form: "single",
80259
+ optional: false
80260
+ }],
80042
80261
  "groupCommands.getStatus": [{
80043
80262
  name: "deviceId",
80044
80263
  form: "single",
@@ -83185,7 +83404,7 @@ var AdminUIAddon = class extends BaseAddon {
83185
83404
  capability: adminUiCapability,
83186
83405
  provider: {
83187
83406
  getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
83188
- getVersion: async () => ({ version: "1.2.485" })
83407
+ getVersion: async () => ({ version: "1.2.487" })
83189
83408
  }
83190
83409
  }];
83191
83410
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-admin-ui",
3
- "version": "1.2.485",
3
+ "version": "1.2.487",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Admin UI — Vite frontend build and server-side addon",
@@ -1,5 +0,0 @@
1
- import{B as e,C as t,J as n,K as r,R as i,S as a,V as o,Y as s,et as c,o as l,x as u}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Ci as d,En as f,Gr as p,Lt as m,Pt as h,Q as g,Si as _,dn as v,dt as y,kt as b,mi as x,mn as S,nn as C,oi as w,pn as ee,sr as T,xn as E,yi as te,zn as ne}from"./player-overlays-Cs6l33cj.js";import{Ga as re}from"./client-Ct1F5MoE.js";import{i as D,l as ie}from"./video-Byw3ItoR.js";import{Ai as O,Bi as ae,Bn as k,Ci as oe,Di as A,Ei as j,Fi as M,Gi as N,Hn as P,Ii as se,Mi as F,Ni as ce,Od as I,Oi as L,Ot as le,Pi as R,Qr as ue,Ri as z,Td as B,Ti as de,Ui as fe,Vi as pe,Vn as V,Wi as H,Zr as U,_r as me,ei as W,en as he,fr as ge,gr as G,id as _e,ki as ve,lc as K,ld as ye,mr as be,pr as q,si as xe,tn as Se,vr as Ce,wi as we,xi as Te,yt as Ee,zi as De,zn as J}from"./src-DFzrn-CX.js";import{t as Y}from"./useTranslation-BJr-n0es.js";import"./mount-P-UzQOB7.js";import{hr as Oe,lr as X,pr as Z}from"./index-Dow2-3ZC.js";import{t as ke}from"./AdminPage-QmLz5qjj.js";import{t as Ae}from"./NodeAddonsSettingsPanel-DUUGVGQU.js";import{n as Q,t as je}from"./useNodeUrlSelection-nYjP8xK4.js";function Me(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 Ne={queued:{icon:w,bg:`bg-muted text-foreground-subtle`,labelKey:`addons.addonRowBadge.queued`},updating:{icon:T,bg:`bg-primary/10 text-primary`,labelKey:`addons.addonRowBadge.updating`,spin:!0},"done-pending-restart":{icon:E,bg:`bg-amber-500/10 text-amber-700`,labelKey:`addons.addonRowBadge.pendingRestart`},done:{icon:d,bg:`bg-success/10 text-success`,labelKey:`addons.addonRowBadge.done`},failed:{icon:D,bg:`bg-danger/10 text-danger`,labelKey:`addons.addonRowBadge.failed`}};function Pe({item:e}){let{t:n}=Y(),r=Ne[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 Fe=new Set([`completed`,`failed`,`partially-failed`,`cancelled`]),Ie=new Set([`done`,`failed`,`skipped`]);function Le(e){return!Ie.has(e.phase)&&!Fe.has(e.jobState)}function Re(e,t){let n=new Map,r=[...e].sort((e,t)=>e.createdAtMs-t.createdAtMs);for(let e of r){let r=Fe.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 ze(){let{data:e}=ce({activeOnly:!0},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data?.length??0)>0?3e3:!1}),{map:t}=I(re.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 Re([...n.values()],Date.now())},[e,t])}var Be={queued:{icon:w,cls:`bg-muted text-foreground-subtle`,labelKey:`addons.jobProgress.queued`},fetching:{icon:T,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.fetching`,spin:!0},staged:{icon:T,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.staged`,spin:!0},validating:{icon:T,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.validating`,spin:!0},applying:{icon:T,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.applying`,spin:!0},restarting:{icon:T,cls:`bg-amber-500/10 text-amber-600 dark:text-amber-400`,labelKey:`addons.jobProgress.restarting`,spin:!0},applied:{icon:T,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.finalizing`,spin:!0},done:{icon:d,cls:`bg-success/10 text-success`,labelKey:`addons.jobProgress.updated`},failed:{icon:D,cls:`bg-danger/10 text-danger`,labelKey:`addons.jobProgress.failed`},skipped:{icon:C,cls:`bg-muted text-foreground-subtle`,labelKey:`addons.jobProgress.skipped`}};function Ve({progress:e}){let{t:n}=Y(),r=Be[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 He(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 Ue(e){let t=e.version===null?``:` ${e.version}`,n=e.isOnline?``:` (offline: removed when it reconnects)`;return`- ${e.nodeName}${t}${n}`}function We(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(Ue)];return n.length>0&&r.push(`Could not ask: ${n.join(`, `)} — not included.`),r.push(`This cannot be undone.`),r.join(`
2
- `)}function Ge(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 Ke={uninstalled:`uninstalled`,"not-installed":`was not installed`,refused:`REFUSED`,failed:`FAILED`,"pending-reconnect":`offline — removed when it reconnects`};function qe(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)}: ${Ke[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 Je={},Ye=3e4,Xe=`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 Ze({packageName:e,displayName:n,selectedNode:r,hideNodeAction:i,disabled:o}){let{t:s}=Y(),c=l(),u=ue(),d=U(),f=F(Je,{staleTime:Ye}),p=f.data?.installations??[],h=(f.data?.unreachable??[]).map(e=>e.nodeId),g=He(p,e),_=e=>g.find(t=>t.nodeId===e)?.nodeName??(e===r.id?r.name:e),v=H({onSettled:()=>{c.invalidateQueries({queryKey:[[`addons`]]}),c.invalidateQueries({queryKey:[[`addonPages`]]}),c.invalidateQueries({queryKey:[[`capabilities`]]}),c.invalidateQueries({queryKey:[[`nodes`]]})}}),y=async e=>{await d({title:e.success?s(`addons.addonUninstallControls.uninstalled`,`{{displayName}} uninstalled`,{displayName:n}):s(`addons.addonUninstallControls.notEveryNodeWasCleaned`,`{{displayName}}: not every node was cleaned`,{displayName:n}),message:qe(e,_),variant:e.success?`default`:`danger`})},b=async t=>{try{await y(await v.mutateAsync({packageName:e,...t}))}catch(e){await d({title:s(`addons.addonUninstallControls.uninstallFailed`,`Uninstall {{displayName}} failed`,{displayName:n}),message:e instanceof Error?e.message:String(e),variant:`danger`})}},x=async()=>{let e=g.filter(e=>e.nodeId!==r.id);await u({title:s(`addons.addonUninstallControls.uninstallFrom`,`Uninstall {{displayName}} from {{name}}?`,{displayName:n,name:r.name}),message:Ge(n,r.name,e),confirmLabel:s(`addons.addonUninstallControls.uninstall`,`Uninstall`),variant:`danger`})&&await b(r.isHub?{}:{nodeId:r.id})},S=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=He(t.installations,e);await u({title:s(`addons.addonUninstallControls.uninstallEverywhere`,`Uninstall {{displayName}} everywhere?`,{displayName:n}),message:We(n,r,t.unreachable.map(e=>e.nodeId)),confirmLabel:s(`addons.addonUninstallControls.uninstallFromNodeS`,`Uninstall from {{length}} node(s)`,{length:r.length}),variant:`danger`})&&await b({everywhere:!0})},C=v.isPending||o===!0;return t(`div`,{className:`flex items-center gap-1.5`,children:[i!==!0&&t(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),x()},disabled:C,className:Xe,title:s(`addons.addonUninstallControls.uninstallFrom2`,`Uninstall from {{name}}`,{name:r.name}),children:[a(m,{className:`h-3 w-3`}),v.isPending?s(`addons.addonUninstallControls.removing`,`Removing...`):s(`addons.addonUninstallControls.uninstall`,`Uninstall`)]}),(g.length>1||i===!0||h.length>0)&&t(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),S()},disabled:C,className:Xe,title:s(`addons.addonUninstallControls.uninstallFromEveryNodeThat`,`Uninstall from every node that has it`),children:[a(ie,{className:`h-3 w-3`}),g.length>0?s(`addons.uninstallControls.everywhereCount`,{count:g.length}):s(`addons.uninstallControls.everywhere`)]})]})}function Qe(e){return typeof e.deprecated==`string`&&e.deprecated.length>0}function $e(e,t){return t?e:e.filter(e=>e.distTags.includes(`latest`)||!Qe(e))}function et(e){return e.length-$e(e,!1).length}c();function tt({packageName:e,currentVersion:n,installSource:r,onInstall:i,onClose:o,onSelect:c,selectedVersion:l}){let{t:f}=Y(),m=r===`upload`||r===`local`,[h,g]=s(!1),{data:_,isLoading:v,isError:x}=L({name:e}),S=_?$e(_,h):[],C=_?et(_):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(`button`,{type:`button`,onClick:o,className:`text-foreground-subtle hover:text-foreground`,children:a(y,{className:`h-3 w-3`})})]}),m&&t(`div`,{className:`flex items-start gap-2 px-3 py-2 border-b border-border bg-cyan-500/10 text-[10px]`,children:[a(b,{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(X,{i18nKey:`addons.versionPicker.reinstall`,values:{version:n},components:{mono:a(`span`,{className:`font-mono`})}})]})]}),v&&t(`div`,{className:`flex items-center justify-center gap-2 py-6 text-[10px] text-foreground-subtle`,children:[a(T,{className:`h-3.5 w-3.5 animate-spin`}),f(`addons.versionPicker.loadingVersions`,`Loading versions...`)]}),x&&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),m=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)),Qe(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(`button`,{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:[m,o?a(d,{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:[m,a(`button`,{type:`button`,onClick:()=>i(e.version),className:`shrink-0 rounded p-0.5 hover:bg-primary/20 text-foreground-subtle hover:text-primary transition-colors`,title:r?f(`addons.versionPicker.reInstallFromNpm`,`Re-install {{version}} from npm`,{version:e.version}):f(`addons.versionPicker.install`,`Install {{version}}`,{version:e.version}),children:a(p,{className:`h-3 w-3`})})]},e.version)})}),!v&&!x&&_&&_.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(W,{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:()=>g(e=>!e),children:h?f(`addons.versionPicker.hideOlder`,`Hide older versions`):f(`addons.versionPicker.showOlder`,`Show older versions ({{count}})`,{count:C})})]})}c();var nt=`device-export`;function rt(e){return e.capabilities.some(e=>(typeof e==`string`?e:e.name)===nt)}function it(e){return e!==`local`&&e!==`upload`}function at({isBundle:e,installSource:n,addonId:r,iconPath:i,color:o}){let[c,l]=s(!1),u=o?{backgroundColor:`${o.startsWith(`#`)?o:`#${o}`}26`}:void 0,d=e?`bg-indigo-500/20 text-indigo-700 dark:text-indigo-300`:`bg-purple-500/20 text-purple-700 dark:text-purple-300`,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?``:d}`,style:u,children:m?a(`img`,{src:p,alt:r,className:`h-4 w-4`,onError:()=>l(!0)}):a(e?ne:f,{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`}),it(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(b,{className:`h-2.5 w-2.5 text-white`})})]})}function ot({version:e,availableUpdate:n,selectedVersion:r,isUpdating:i,installSource:o,disabled:s,onUpdate:c,onOpenPicker:l,children:u}){let{t:d}=Y();if(i)return t(`span`,{className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium border border-blue-500/30 bg-blue-500/10 text-blue-400 shrink-0`,children:[a(T,{className:`h-3 w-3 animate-spin`}),d(`addons.addonCard.updating`,`Updating…`)]});if(n){let i=r??n;return t(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[c&&t(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),c()},disabled:s,className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-semibold border border-blue-500/30 bg-blue-500/10 text-blue-400 hover:bg-blue-500/20 disabled:opacity-50 disabled:cursor-not-allowed transition-colors`,title:d(`addons.addonCard.updateTo`,`Update to {{target}}`,{target:i}),children:[a(p,{className:`h-3 w-3`}),d(`addons.addonCard.update`,`Update`)]}),t(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),l()},disabled:s,"aria-label":d(`addons.addonCard.selectVersionToInstall`,`Select version to install`),title:d(`addons.addonCard.installedUpdateAvailableSelectedTap`,`Installed {{version}} — update available. Selected {{target}}; tap to choose another version.`,{version:e,target:i}),className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-bold font-mono border border-amber-500/40 bg-amber-500/15 text-amber-500 hover:bg-amber-500/25 animate-pulse disabled:opacity-50 disabled:cursor-not-allowed transition-colors`,children:[a(`span`,{className:`font-normal opacity-70`,children:e}),a(`span`,{className:`font-normal opacity-70`,children:`→`}),i,a(_,{className:`h-3 w-3`})]}),u]})}return t(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[t(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),l()},disabled:s,className:[`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-bold font-mono border transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,o===`local`?`border-orange-500/30 bg-orange-500/10 text-orange-400 hover:bg-orange-500/20`:`border-emerald-500/30 bg-emerald-500/10 text-emerald-400 hover:bg-emerald-500/20`].join(` `),title:d(`addons.addonCard.versionTapToViewAll`,`Version {{version}} — tap to view all versions`,{version:e}),children:[e,a(_,{className:`h-3 w-3 opacity-50`})]}),u]})}function st({addonId:e}){let t=l(),{data:n=`inherit`}=we({addonId:e}),r=ae({onSuccess:()=>{t.invalidateQueries({queryKey:[[`addons`,`getAddonAutoUpdate`]]})}});return a(`div`,{className:`flex rounded-lg border border-border overflow-hidden text-[10px] font-medium`,children:[`inherit`,`off`,`latest`,`beta`].map(t=>a(`button`,{type:`button`,onClick:n=>{n.stopPropagation(),r.mutate({addonId:e,channel:t})},disabled:r.isPending,className:`px-2.5 py-1 transition-colors capitalize ${n===t?t===`inherit`?`bg-gray-700/50 text-gray-700 dark:text-gray-300`:t===`off`?`bg-gray-700 text-gray-700 dark:text-gray-300`:t===`latest`?`bg-blue-500/20 text-blue-400`:`bg-amber-500/20 text-amber-400`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`} ${t===`inherit`?``:`border-l border-border`}`,children:t},t))})}var ct={id:`hub`,name:`Hub`,isHub:!0};function lt({addon:e,clusterStatus:n,hideVersion:r,availableUpdate:i,onUpdate:c,isUpdating:d,jobProgress:f,bundle:p,bulkItem:m,disabledByBulk:h,isSystem:g,selectedNode:b}){let{t:x}=Y(),[C,w]=s(!1),[ee,T]=s(!1),[re,ie]=s(null);o(()=>{ie(null)},[i]);let O=re??i,[ae,k]=s(!1),[oe,A]=s(!1),[j,M]=s(`logs`),N=l(),P=Z(),{manifest:F}=e,ce=!p&&!F.protected&&F.removable!==!1,I=!!p,L=p?.displayName??F.name,R=p?.packageName??F.packageName,ue=p?.version??F.packageVersion??F.version,B=p?.installSource??e.installSource,de=p?p.bundle?.description??p.addons[0]?.manifest.description:F.description,fe=se({onSuccess:()=>{N.invalidateQueries({queryKey:[[`addons`]]})}}),pe=ve({onSuccess:()=>{N.invalidateQueries({queryKey:[[`addons`]]}),N.invalidateQueries({queryKey:[[`addonPages`]]}),N.invalidateQueries({queryKey:[[`capabilities`]]}),N.invalidateQueries({queryKey:[[`integrations`]]})}}),V=z({onSuccess:()=>{N.invalidateQueries({queryKey:[[`addons`]]}),N.invalidateQueries({queryKey:[[`alerts`]]})}}),H=e.health,U=H?.phase===`failed`&&!H.inGracePeriod,_e=U&&H?.nextRetryAt&&!H.retrying,K=Me(e.process);return t(`div`,{className:`rounded-md border bg-surface overflow-hidden ${U?`border-red-500/50`:`border-border`}`,children:[U&&H&&t(`div`,{className:`bg-danger/10 border-b border-danger/30 px-3 py-2 flex items-start gap-2`,children:[a(D,{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:x(`addons.addonCard.failedToLoad`,{attempt:H.retryCount})}),a(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:H.lastError?.message??x(`addons.addonCard.unknownError`,`Unknown error`)}),_e&&H.nextRetryAt&&a(`div`,{className:`text-[10px] text-foreground-subtle mt-1`,children:x(`addons.addonCard.autoRetryAt`,{time:new Date(H.nextRetryAt).toLocaleTimeString()})})]}),t(`button`,{type:`button`,disabled:V.isPending||H.retrying,onClick:e=>{e.stopPropagation(),V.mutate({packageName:R})},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:x(`addons.addonCard.resetRetryCounterAndForce`,`Reset retry counter and force immediate reload`),children:[a(E,{className:`h-3 w-3 ${V.isPending||H.retrying?`animate-spin`:``}`}),x(`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(D,{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:x(`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(at,{isBundle:I||!!F.components&&F.components.length>1,installSource:B,addonId:I?p.addons[0]?.manifest.id:F.id,iconPath:I?p.bundle?.icon??p.addons[0]?.manifest.icon:F.icon,color:I?p.addons[0]?.manifest.color:F.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:L}),!r&&a(ot,{version:ue,availableUpdate:i,...O===void 0?{}:{selectedVersion:O},isUpdating:d,installSource:B,disabled:h,...c&&O!==void 0?{onUpdate:()=>c(O)}:{},onOpenPicker:()=>T(e=>!e),children:ee&&a(tt,{packageName:R,currentVersion:ue,...B?{installSource:B}:{},...i!==void 0&&O!==void 0?{selectedVersion:O,onSelect:e=>{ie(e),T(!1)}}:{},onInstall:e=>{T(!1),pe.mutate({packageName:R,version:e})},onClose:()=>T(!1)})})]}),t(`div`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 mt-0.5`,children:[R!==L&&a(`span`,{className:`text-[10px] text-foreground-subtle font-mono truncate max-w-full`,children:R}),I&&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(ne,{className:`h-3 w-3`}),p.addons.length]}),g&&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:x(`addons.addonCard.systemPackageUpdatingRestartsThe`,`System package — updating restarts the hub`),children:[a(E,{className:`h-3 w-3`}),x(`addons.addonCard.system`,`System`)]}),m!=null&&a(Pe,{item:m}),f!=null&&a(Ve,{progress:f})]}),de&&a(`p`,{className:`text-[10px] text-foreground-subtle mt-1 line-clamp-1`,children:de}),!I&&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`?x(`addons.addonCard.forked`):x(`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})]})]})]}),!I&&t(`div`,{className:`flex items-center gap-1 px-3 py-1 border-t border-border/50 bg-surface-hover/20`,children:[t(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),fe.mutate({addonId:F.id})},disabled:fe.isPending||h,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(E,{className:`h-3 w-3 ${fe.isPending?`animate-spin`:``}`}),x(`addons.addonCard.restart`,`Restart`)]}),t(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),k(e=>!e)},className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium border transition-colors ${ae?`border-primary/30 bg-primary/10 text-primary`:`border-border text-foreground-subtle hover:text-foreground hover:border-primary/30 hover:bg-primary/10`}`,children:[a(S,{className:`h-3 w-3`}),x(`addons.addonCard.logs`,`Logs`)]}),!I&&t(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),A(!0)},className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium border transition-colors ${oe?`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(v,{className:`h-3 w-3`}),x(`addons.addonCard.settings`,`Settings`)]}),a(`div`,{className:`flex-1`}),ce&&a(Ze,{packageName:F.packageName,displayName:F.name,selectedNode:b??ct,disabled:h})]}),n&&n.nodes.length>1&&!I&&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:x(`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:x(`addons.addonCard.outdated`)}),e.status===`offline`&&a(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-muted text-muted-foreground`,children:x(`common.offline`)}),e.synced&&e.status!==`offline`&&a(`span`,{className:`text-[9px] text-success`,children:x(`common.synced`)})]},e.nodeId))})]}),ae&&!I&&t(`div`,{className:`border-t border-border`,children:[t(`div`,{className:`flex items-center px-3 py-0.5 bg-surface-hover/20 border-b border-border/50`,children:[t(`div`,{className:`flex rounded border border-border overflow-hidden text-[9px]`,children:[a(`button`,{type:`button`,onClick:()=>M(`logs`),className:`px-2 py-0.5 transition-colors ${j===`logs`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:x(`addons.addonCard.logs`,`Logs`)}),a(`button`,{type:`button`,onClick:()=>M(`events`),className:`px-2 py-0.5 border-l border-border transition-colors ${j===`events`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:x(`addons.addonCard.events`,`Events`)})]}),a(`div`,{className:`flex-1`}),a(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),k(!1)},className:`text-foreground-subtle hover:text-foreground`,children:a(y,{className:`h-3.5 w-3.5`})})]}),j===`logs`&&a(Se,{addonId:F.id,maxHeight:`max-h-64`,showFilters:!1}),j===`events`&&a(he,{addonId:F.id,category:`addon.*`,maxHeight:`max-h-64`})]}),I&&t(u,{children:[a(`button`,{type:`button`,onClick:()=>w(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(C?te:_,{className:`h-3.5 w-3.5 text-foreground-subtle`})}),C&&a(`div`,{className:`border-t border-border px-2.5 py-1.5 space-y-1.5`,children:p.addons.map(e=>a(lt,{addon:e,hideVersion:!0},e.manifest.id))})]}),oe&&!I&&a(ge,{open:!0,onOpenChange:e=>!e&&A(!1),children:t(be,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:[a(me,{children:t(Ce,{className:`flex items-center gap-2`,children:[a(v,{className:`h-4 w-4 text-primary`}),x(`addons.addonCard.settingsTitle`,{name:L})]})}),t(q,{className:`space-y-4`,children:[a(`div`,{className:`text-[10px] text-foreground-subtle mb-2`,children:x(`addons.addonCard.clusterWideSettingsOneValue`,`Cluster-wide settings — one value for every node. Per-node settings live under Cluster → the node → Settings.`)}),a(Ae,{nodeId:null,addonIds:[F.id],level:`global`,fieldScope:`cluster`,emptyMessage:x(`addons.addonCard.thisAddonExposesNoCluster`,`This addon exposes no cluster-wide settings. Anything it can configure is per-node — open it from Cluster → the node → Settings.`)}),rt(F)&&t(`div`,{children:[a(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:x(`addons.addonCard.deviceExport`,`Device export`)}),a(le,{addonId:F.id,onOpenDevice:e=>P(`/devices/${e}`)})]}),it(B)&&t(`div`,{children:[a(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:x(`addons.addonCard.autoUpdate`,`Auto-Update`)}),a(st,{addonId:F.id})]}),F.components&&F.components.length>0&&t(`div`,{children:[a(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:x(`addons.addonCard.components`,{count:F.components.length})}),a(`div`,{className:`flex flex-wrap gap-1`,children:F.components.map(e=>a(`span`,{className:`text-[10px] rounded bg-background border border-border px-1.5 py-0.5 text-foreground-subtle font-mono`,children:e},e))})]})]}),a(G,{children:a(W,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>A(!1),children:x(`common.close`,`Close`)})})]})})]})}c();var ut=`.tgz,.tar.gz,.zip`;function dt({onUploadSuccess:e}){let{t:r}=Y(),[o,c]=s(!1),l=n(null),d=i(async t=>{c(!0);let n=new FormData;n.append(`file`,t);let r=localStorage.getItem(`camstack_admin_token`)??``;try{(await(await fetch(g(`/api/addons/upload`),{method:`POST`,headers:{Authorization:`Bearer ${r}`},body:n})).json()).success&&e()}finally{c(!1)}},[e]);return t(u,{children:[a(`input`,{ref:l,type:`file`,accept:ut,onChange:i(e=>{let t=e.target.files?.[0];t&&d(t),e.target.value=``},[d]),className:`hidden`}),t(`button`,{type:`button`,onClick:()=>l.current?.click(),disabled:o,className:`flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,children:[o?a(T,{className:`w-3.5 h-3.5 animate-spin`}):a(b,{className:`w-3.5 h-3.5`}),o?r(`addons.addonUploadZone.uploading`,`Uploading...`):r(`addons.addonUploadZone.upload`,`Upload`)]})]})}var ft=/```[^\n]*\n([\s\S]*?)```/g;function pt(e){let t=[],n=0;for(let r of e.matchAll(ft)){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 mt(e){let t=e.trim();return t.startsWith(`https://`)||t.startsWith(`http://`)?t:null}function ht(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?mt(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 gt(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:ht(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:ht(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=ht(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 _t({markdown:e}){return a(`div`,{className:`text-xs text-foreground leading-relaxed`,children:pt(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:gt(e.body,`b${t}`)},`text-${t}`))})}c();function vt(e){return e.replace(/^@camstack\/(addon-)?/,``)}function yt(e,t,n){let r=$e(e,n);return r.some(e=>e.version===t)?r:[{version:t,distTags:[],deprecated:void 0},...r]}function bt({pending:e,failed:n,body:r,missing:i}){let{t:o}=Y();return e?t(`div`,{className:`flex items-center gap-2 py-6 text-xs text-foreground-subtle`,children:[a(T,{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(_t,{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 xt({target:e,installing:n,installError:r,onClose:i,onInstall:o}){let{t:c}=Y(),[l,u]=s(e.version),[d,f]=s(!1),p=L({name:e.name}),m=A({name:e.name,version:l}),h=p.data??[],g=et(h),_=yt(h,l,d),v=m.data;return a(ge,{open:!0,onOpenChange:e=>!e&&i(),children:t(be,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:[a(me,{children:a(Ce,{children:c(`addons.installDialog.title`,`Install {{name}}`,{name:vt(e.name)})})}),t(q,{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(_e,{"aria-label":c(`addons.installDialog.version`,`Version`),value:l,options:_.map(e=>({value:e.version,label:Qe(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(W,{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(J,{defaultValue:`readme`,children:[t(V,{children:[a(P,{value:`readme`,children:c(`addons.installDialog.readme`,`README`)}),a(P,{value:`changelog`,children:c(`addons.installDialog.changelog`,`CHANGELOG`)})]}),a(k,{value:`readme`,children:a(`div`,{className:`max-h-80 overflow-auto rounded-md border border-border bg-background p-3`,children:a(bt,{pending:m.isPending,failed:m.isError,body:v?.readme,missing:c(`addons.installDialog.missingReadme`,`This package has no README.`)})})}),a(k,{value:`changelog`,children:a(`div`,{className:`max-h-80 overflow-auto rounded-md border border-border bg-background p-3`,children:a(bt,{pending:m.isPending,failed:m.isError,body:v?.changelog,missing:c(`addons.installDialog.missingChangelog`,`This package has no CHANGELOG.`)})})})]}),r!=null&&r.length>0&&a(`p`,{className:`text-xs text-danger`,children:r})]}),t(G,{children:[a(W,{type:`button`,variant:`outline`,size:`sm`,onClick:i,children:c(`common.cancel`,`Cancel`)}),a(W,{type:`button`,size:`sm`,disabled:n||l.length===0,onClick:()=>o(e.name,l),children:n?a(T,{className:`h-3.5 w-3.5 animate-spin`}):c(`addons.installDialog.install`,`Install`)})]})]})})}var St=new Set([`@camstack/system`,`@camstack/types`,`@camstack/sdk`,`@camstack/ui-library`,`@camstack/addon-agent-ui`]);function Ct(e,t){let n=new Map;for(let r of e){if(r.isHub||r.onHub||St.has(r.packageName)||!t.isHub&&r.nodeId!==t.id)continue;let e=n.get(r.packageName)??[];e.push(r),n.set(r.packageName,e)}return[...n].map(([e,t])=>({packageName:e,rows:t})).sort((e,t)=>e.packageName.localeCompare(t.packageName))}function wt({selectedNode:e}){let{t:n}=Y(),{data:r}=F(Je,{staleTime:Ye});if(r===void 0)return null;let i=Ct(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(h,{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(Ze,{packageName:n.packageName,displayName:n.packageName,selectedNode:e,hideNodeAction:e.isHub})]},n.packageName))]})}function Tt({addon:e,installing:n,onInstall:r}){let{t:i}=Y();return t(`div`,{className:`flex items-center gap-3 px-3 py-2 hover:bg-surface-hover transition-colors`,children:[a(`div`,{className:`w-6 h-6 rounded-md bg-primary/10 flex items-center justify-center text-primary text-[9px] font-bold shrink-0`,children:e.name.replace(`@camstack/addon-`,``).charAt(0).toUpperCase()}),t(`div`,{className:`flex-1 min-w-0`,children:[t(`div`,{className:`flex items-baseline gap-2 min-w-0`,children:[a(`span`,{className:`text-[11px] font-semibold break-words`,children:e.name.replace(/^@camstack\/(addon-)?/,``)}),t(`span`,{className:`text-[10px] text-foreground-subtle shrink-0`,children:[`v`,e.version]})]}),a(`div`,{className:`font-mono text-[9px] text-foreground-subtle/80 truncate`,children:e.name}),e.description&&a(`div`,{className:`text-[10px] text-foreground-subtle truncate`,children:e.description})]}),e.installed?a(xe,{variant:`success`,icon:a(d,{className:`h-3 w-3`}),children:e.installedVersion??i(`system.capabilityCatalog.installed`,`Installed`)}):t(W,{size:`sm`,onClick:()=>r(e),disabled:n,className:`shrink-0`,children:[n?a(T,{className:`h-3 w-3 animate-spin`}):a(p,{className:`h-3 w-3`}),i(`system.capabilityCatalog.install`,`Install`)]})]})}function Et({capability:e,installing:n,onInstall:r}){let{t:i}=Y(),{data:o,isPending:s,isError:c}=De({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(T,{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(Tt,{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 Dt(e){return e===`npm`||e===`dev`?e:null}var Ot=`rounded-full border border-primary bg-primary/10 px-2 py-0.5 text-[10px] text-foreground`,kt=`rounded-full border border-border px-2 py-0.5 text-[10px] text-foreground-muted hover:bg-surface-hover`,At=[{seconds:900,label:`15m`},{seconds:3600,label:`1h`},{seconds:21600,label:`6h`},{seconds:43200,label:`12h`},{seconds:86400,label:`24h`}],jt=new Set([`@camstack/system`,`@camstack/types`,`@camstack/sdk`,`@camstack/shm-ring`,`@camstack/ui-library`]);function Mt(e){return e!==void 0&&jt.has(e)}var Nt={id:`hub`,name:`Hub`,isHub:!0,isOnline:!0};function Pt(e,t){let n=e??`hub-only`;return n===`any-node`?!0:n===`hub-only`?t:!t}function Ft(e){return e===`local`?`dev`:`npm`}function It(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 Lt(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 Rt({addons:c,clusterStatus:u,selectedNode:d,onRefresh:f,listPhase:m}){let{t:h}=Y(),g=l(),[_,v]=s(``),y=e(_),[b,S]=s(!1),C=n(null);o(()=>{if(!b)return;let e=e=>{C.current&&!C.current.contains(e.target)&&S(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[b]);let{data:w}=R({nodeId:d.id}),te=r(()=>{let e=new Map;for(let t of w??[])e.set(t.name,t.latestVersion);return e},[w]),ne=r(()=>(w??[]).filter(e=>!e.isSystem).length,[w]),[re,D]=s(()=>new Set),[ie,O]=s(()=>new Map),ae=i(e=>{D(t=>new Set(t).add(e))},[]),k=i(e=>{D(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[]),oe=i((e,t)=>{O(n=>new Map(n).set(e,t))},[]),A=i(e=>{O(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),M=N({onMutate:e=>{ae(e.name),A(e.name)},onSuccess:(e,t)=>{k(t.name);let n=e;if(n&&n.success===!1){oe(t.name,n.error??`Update failed (no error message returned by server)`);return}g.invalidateQueries({queryKey:[[`addons`]]}),g.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]})},onError:(e,t)=>{k(t.name),oe(t.name,e instanceof Error?e.message:String(e))}}),P=ze(),se=n(new Set);o(()=>{let e=new Set;for(let[t,n]of P)Le(n)&&e.add(t);let t=[...se.current].some(t=>!e.has(t));se.current=e,t&&(g.invalidateQueries({queryKey:[[`addons`]]}),g.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]}))},[P,g]);let{data:F}=de(void 0),ce=Te({onSuccess:()=>{g.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),I=pe({onSuccess:()=>{g.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),{data:L,isFetching:le}=De({query:y||void 0},{enabled:b}),z=fe(),{data:B}=j(void 0),V=B?.requestedAt,[H,U]=s(null),[me,W]=s(!1);o(()=>{if(B?.kind===`framework-bulk-update`&&B.requestedAt!==H){U(B.requestedAt),W(!0);let e=window.setTimeout(()=>W(!1),6e3);return()=>window.clearTimeout(e)}},[V,H,B]),ue();let he=i(async()=>{let e=(w??[]).filter(e=>!e.isSystem);if(e.length!==0){if(!d.isHub){for(let t of e)await M.mutateAsync({name:t.name,version:t.latestVersion,nodeId:d.id});return}await z.mutateAsync({kind:`update`,targets:e.map(e=>({name:e.name,version:e.latestVersion})),nodeIds:[d.id]})}},[w,d.id,d.isHub,z,M]),[ge,G]=s(null),[_e,K]=s(null),be=e=>{K(null),G(e)},q=ve({onSuccess:()=>{G(null),K(null),g.invalidateQueries({queryKey:[[`addons`]]}),g.invalidateQueries({queryKey:[[`addonPages`]]}),g.invalidateQueries({queryKey:[[`capabilities`]]}),g.invalidateQueries({queryKey:[[`integrations`]]})},onError:e=>{K(e instanceof Error?e.message:`Install failed`)}}),[xe,Se]=s(`type`),[Ce,we]=s(()=>typeof window>`u`?`grouped`:window.localStorage.getItem(`camstack.addons.viewMode`)===`flat`?`flat`:`grouped`),Ee=e=>{we(e),typeof window<`u`&&window.localStorage.setItem(`camstack.addons.viewMode`,e)},[J,X]=Oe(),Z=J.get(`capability`),ke=J.get(`updatable`)===`1`,Ae=J.get(`error`)===`1`,Q=Dt(J.get(`source`)),je=i(e=>{let t=new URLSearchParams(J);e?t.set(`updatable`,`1`):t.delete(`updatable`),X(t,{replace:!0})},[J,X]),Ne=i(e=>{let t=new URLSearchParams(J);e?t.set(`error`,`1`):t.delete(`error`),X(t,{replace:!0})},[J,X]),Pe=i(e=>{let t=new URLSearchParams(J);e===null?t.delete(`source`):t.set(`source`,e),X(t,{replace:!0})},[J,X]),Fe=r(()=>c.filter(e=>Me(e.process)!==null).length,[c]),Ie=r(()=>{let e=c.filter(e=>!Mt(e.manifest.packageName));return d.isHub||(e=e.filter(e=>Pt(e.placement,d.isHub))),Z&&(e=e.filter(e=>(e.manifest.capabilities??[]).some(e=>(typeof e==`string`?e:e.name)===Z))),ke&&(e=e.filter(e=>{let t=e.manifest.packageName;return t!==void 0&&te.has(t)})),Q!==null&&(e=e.filter(e=>Ft(e.installSource)===Q)),Ae&&(e=e.filter(e=>Me(e.process)!==null)),e},[c,d.isHub,Z,ke,Q,Ae,te]),Re=()=>{let e=new URLSearchParams(J);e.delete(`capability`),X(e,{replace:!0})},Be=Ce===`flat`?Ie:Lt(Ie),Ve=r(()=>{let e=[...Be];switch(xe){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},[Be,xe]);return t(`div`,{className:`space-y-3`,children:[[...ie.entries()].map(([e,n])=>a(`div`,{className:`rounded-md border border-danger/30 bg-danger/5 px-2.5 py-1.5 text-[11px]`,children:t(`div`,{className:`flex items-start justify-between gap-3`,children:[t(`div`,{className:`space-y-0.5`,children:[a(`div`,{className:`font-medium text-danger`,children:h(`systemPage.addons.updateFailed`,{name:e})}),a(`div`,{className:`text-foreground-subtle font-mono`,children:n})]}),a(`button`,{type:`button`,onClick:()=>A(e),className:`text-foreground-subtle hover:text-foreground text-[10px]`,children:h(`common.dismiss`)})]})},e)),t(`div`,{className:`flex items-center gap-x-2 gap-y-1.5 flex-wrap`,children:[t(`div`,{className:`flex items-center gap-1.5`,children:[a(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`admin.system.addons.sort`,`Sort:`)}),t(`select`,{value:xe,onChange:e=>Se(e.target.value),className:`rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground focus:outline-none focus:border-primary/50`,children:[a(`option`,{value:`type`,children:h(`admin.system.addons.bundlesFirst`,`Bundles first`)}),a(`option`,{value:`name`,children:h(`admin.system.addons.name`,`Name`)}),a(`option`,{value:`source`,children:h(`admin.system.addons.installSource`,`Install source`)})]})]}),t(`div`,{className:`flex items-center gap-1.5`,children:[a(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`admin.system.addons.view`,`View:`)}),a(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`grouped`,`flat`].map(e=>a(`button`,{type:`button`,onClick:()=>Ee(e),className:`px-2 py-1 transition-colors capitalize ${Ce===e?`bg-primary/10 text-primary`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`}`,title:e===`grouped`?h(`admin.system.addons.groupMultiAddonPackagesInto`,`Group multi-addon packages into a bundle card`):h(`admin.system.addons.showEveryAddonAsIts`,`Show every addon as its own card`),children:e},e))})]}),d.isHub&&t(`div`,{className:`flex items-center gap-1.5`,children:[a(E,{className:`h-3 w-3 text-foreground-subtle`}),a(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`admin.system.addons.autoUpdate`,`Auto-Update:`)}),a(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`off`,`latest`,`beta`].map(e=>a(`button`,{type:`button`,onClick:()=>ce.mutate({channel:e}),disabled:ce.isPending,className:`px-2 py-1 transition-colors capitalize ${F?.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:h(`admin.system.addons.checkEvery`,`Check every:`)}),a(`select`,{className:`rounded-md border border-border bg-transparent px-1.5 py-1 text-[10px] font-medium text-foreground-subtle`,value:F?.updateCheckIntervalSeconds??21600,disabled:I.isPending||F===void 0,onChange:e=>{F!==void 0&&I.mutate({channel:F.channel,updateCheckIntervalSeconds:Number(e.target.value)})},children:At.map(e=>a(`option`,{value:e.seconds,children:e.label},e.seconds))})]}),ne>0&&t(`button`,{type:`button`,onClick:()=>void he(),disabled:z.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:[z.isPending?a(T,{className:`w-3 h-3 animate-spin`}):a(p,{className:`w-3 h-3`}),z.isPending?h(`admin.system.addons.updating`,`Updating…`):h(`admin.system.addons.updateAll`,`Update All ({{nonSystemUpdateCount}})`,{nonSystemUpdateCount:ne})]})]}),t(`div`,{className:`flex flex-wrap items-center gap-1.5`,role:`group`,"aria-label":h(`admin.system.addons.filterInstalledAddons`,`Filter installed addons`),children:[a(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`admin.system.addons.filter`,`Filter:`)}),[{id:`updatable`,label:h(`admin.system.addons.updatable`,`Updatable`),pressed:ke,toggle:()=>je(!ke)},{id:`error`,label:h(`admin.system.addons.inError`,`In error ({{count}})`,{count:Fe}),pressed:Ae,toggle:()=>Ne(!Ae)},{id:`npm`,label:`npm`,pressed:Q===`npm`,toggle:()=>Pe(Q===`npm`?null:`npm`)},{id:`dev`,label:h(`admin.system.addons.dev`,`Dev`),pressed:Q===`dev`,toggle:()=>Pe(Q===`dev`?null:`dev`)}].map(e=>a(`button`,{type:`button`,"aria-pressed":e.pressed,onClick:e.toggle,className:e.pressed?Ot:kt,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:C,children:[a(ye,{type:`text`,value:_,onChange:e=>{v(e.target.value),S(!0)},onFocus:()=>S(!0),placeholder:h(`admin.system.addons.searchAddonsOnNpm`,`Search addons on npm...`),"aria-label":h(`admin.system.addons.searchAddonsOnNpm2`,`Search addons on npm`),disabled:z.isPending,leftSlot:a(ee,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),rightSlot:le?a(T,{className:`h-3 w-3 animate-spin`}):void 0}),b&&L&&L.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:[L.length>0&&a(`div`,{className:`px-3 py-1.5 text-[10px] uppercase tracking-wide text-foreground-subtle border-b border-border`,children:h(`systemPage.addons.npmResults`,{count:L.length})}),L&&L.length>0&&a(`div`,{className:`max-h-72 overflow-auto divide-y divide-border`,children:L.map(e=>a(Tt,{addon:e,installing:q.isPending,onInstall:e=>be({name:e.name,version:e.version,description:e.description})},e.name))})]})]}),a(dt,{onUploadSuccess:()=>{g.invalidateQueries({queryKey:[[`addons`]]}),f()}})]}),Z&&t(`div`,{className:`flex items-center gap-2 px-2.5 py-1.5 rounded-md bg-primary/10 border border-primary/30 text-xs`,children:[a(`span`,{className:`text-foreground-subtle`,children:h(`admin.system.addons.filteringByCapability`,`Filtering by capability:`)}),a(`span`,{className:`font-mono text-primary font-semibold`,children:Z}),a(`button`,{type:`button`,onClick:Re,className:`ml-auto text-xs text-foreground-subtle hover:text-foreground underline`,children:h(`admin.system.addons.clear`,`Clear`)})]}),Z&&a(Et,{capability:Z,installing:q.isPending,onInstall:e=>be({name:e.name,version:e.version,description:e.description})}),Z&&Ie.length>0&&a(`h2`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:h(`admin.system.addons.installed`,`Installed`)}),me&&t(`div`,{className:`fixed top-[calc(env(safe-area-inset-top)+1rem)] right-[calc(env(safe-area-inset-right)+1rem)] z-50 flex items-start gap-2 px-3 py-2.5 rounded-md border border-green-500/30 bg-green-500/10 shadow-lg backdrop-blur-sm max-w-sm pointer-events-auto`,children:[a(x,{className:`w-4 h-4 shrink-0 mt-0.5 text-green-400`}),t(`div`,{children:[a(`div`,{className:`text-[11px] font-semibold text-foreground`,children:h(`admin.system.addons.bulkUpdateCompleted`,`Bulk update completed`)}),a(`div`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:h(`admin.system.addons.systemPackagesUpdatedHubRestarted`,`System packages updated — hub restarted successfully.`)})]})]}),m===`pending`&&t(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[a(T,{className:`h-3 w-3 animate-spin`}),h(`admin.system.addons.loadingInstalled`,`Loading installed addons…`)]}),m===`error`&&a(`div`,{className:`text-xs text-danger`,children:h(`admin.system.addons.failedToLoadAddons`,`Failed to load addons`)}),m===`ready`&&Ie.length===0&&a(`div`,{className:`text-xs text-foreground-subtle`,children:c.length===0?h(`admin.system.addons.noAddonsInstalled`,`No addons installed`):Z?h(`admin.system.addons.noInstalledAddonDeclaresThe`,`No installed addon declares the "{{capabilityFilter}}" capability. Any addon you can install appears under "Available to install" above.`,{capabilityFilter:Z}):h(`admin.system.addons.noAddonsCompatibleWithPlacement`,`No addons compatible with {{name}} (placement filter active)`,{name:d.name})}),a(`div`,{className:`space-y-1.5`,children:m===`ready`&&Ve.map(e=>{let t=$(e)?e.bundle.packageName:e.manifest.packageName,n=te.get(t),r=$(e)?e.representative:e,i=n?e=>M.mutate({name:t,version:e,nodeId:d.id}):void 0,o=P.get(t)??null,s=o!==null&&Le(o);return a(lt,{addon:r,clusterStatus:u?.[r.manifest.id],bundle:$(e)?e.bundle:void 0,availableUpdate:n,isUpdating:re.has(t)||s,jobProgress:o,onUpdate:i,disabledByBulk:z.isPending,selectedNode:d},$(e)?t:e.manifest.id)})}),ge!==null&&a(xt,{target:ge,installing:q.isPending,installError:_e,onClose:()=>G(null),onInstall:(e,t)=>q.mutate({packageName:e,version:t})})]})}function zt(){let{t:e}=Y(),r=l(),{data:i}=K(void 0),{nodes:s}=B(),{selection:c,selectNode:u,requestedNodeId:d}=je(s.length>0?s:[Nt]),f=c.node??Nt,p=f.id,m=s.length>0?c.staleNodeId:null,{data:h,isLoading:g,isError:_}=O({nodeId:p}),v=oe(),y=M(),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(It).filter(e=>e!==null);return t(ke,{children:[t(`div`,{className:`flex items-center justify-between gap-2 flex-wrap`,children:[a(Ee,{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(`button`,{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(E,{className:`w-3 h-3 ${b?`animate-spin`:``}`}),e(`admin.system.addons.checkForUpdates`,`Check for updates`)]})]})]}),a(Q,{staleNodeId:m,shownNodeName:f.name}),a(wt,{selectedNode:f}),a(Rt,{addons:w,clusterStatus:i,selectedNode:f,onRefresh:()=>void x(),listPhase:g?`pending`:_?`error`:`ready`})]})}export{zt as AddonsPage};