@camstack/addon-admin-ui 1.2.482 → 1.2.484

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/dist/assets/{AddonAssetIcon-5z0Vljts.js → AddonAssetIcon-3vq-0y-v.js} +1 -1
  2. package/dist/assets/Addons-Bk1BZHnK.js +5 -0
  3. package/dist/assets/{AdminPage-BGeHUp9l.js → AdminPage-QmLz5qjj.js} +1 -1
  4. package/dist/assets/{AdminSectionedPage-DDyHO_ip.js → AdminSectionedPage-DYCbg6TR.js} +1 -1
  5. package/dist/assets/AiProfiles-ZWSpLyRc.js +3 -0
  6. package/dist/assets/{BrokerForm-B2kpU1t2.js → BrokerForm-C0PFW-8b.js} +1 -1
  7. package/dist/assets/Build-Dnm_I3D9.js +40 -0
  8. package/dist/assets/{Calendars-iNmeiE9F.js → Calendars-DvjofwPU.js} +1 -1
  9. package/dist/assets/{Cluster-VomkBaK2.js → Cluster-CrfYNPnJ.js} +1 -1
  10. package/dist/assets/{CompositionBlockEditor-BkEr_zwe.js → CompositionBlockEditor-BcDYEyOm.js} +1 -1
  11. package/dist/assets/{CompositionEditorPage-DbJxXBa9.js → CompositionEditorPage-DpKcmhYi.js} +1 -1
  12. package/dist/assets/Data-BqyCS1VW.js +2 -0
  13. package/dist/assets/DeviceDetail-DfLnQGqY.js +2 -0
  14. package/dist/assets/{DeviceDoActionFields-CLGT6wrU.js → DeviceDoActionFields-CJj4-67I.js} +1 -1
  15. package/dist/assets/{Devices-CeNeFo6w.js → Devices-DQnrgH0r.js} +1 -1
  16. package/dist/assets/{EmbedPlayerPage-DhPeEblh.js → EmbedPlayerPage-D6aNp4TG.js} +1 -1
  17. package/dist/assets/HelperWizard-BM-npSft.js +2 -0
  18. package/dist/assets/History-DZ_p9s8N.js +1 -0
  19. package/dist/assets/Identity-B-pYFi7F.js +1 -0
  20. package/dist/assets/IntegrationDetail-CvtkeTns.js +1 -0
  21. package/dist/assets/{IntegrationHub-C0mqR6_4.js → IntegrationHub-Crv-Ut8D.js} +1 -1
  22. package/dist/assets/Integrations-BpVqgjFG.js +1 -0
  23. package/dist/assets/Integrations-tTRZOlex.js +1 -0
  24. package/dist/assets/Library-BFFl1PFs.js +1 -0
  25. package/dist/assets/Locations-sD9PMtF8.js +3 -0
  26. package/dist/assets/{Logs-Bdustfdg.js → Logs-ByKgDjzR.js} +1 -1
  27. package/dist/assets/{MaskShapeCanvas-Tcd9Y5RA.js → MaskShapeCanvas-CzHUGkc7.js} +1 -1
  28. package/dist/assets/{MotionZonesSettings-CRoT6tmj.js → MotionZonesSettings-sCDWBSMu.js} +1 -1
  29. package/dist/assets/MyAccess-_FlzEnLb.js +2 -0
  30. package/dist/assets/Network-U-uppn3V.js +1 -0
  31. package/dist/assets/NodeAddonsSettingsPanel-DOuw1uWS.js +1 -0
  32. package/dist/assets/Notifications-AkbB0Ya7.js +1 -0
  33. package/dist/assets/Pipeline-CMwJb0kX.js +1 -0
  34. package/dist/assets/{PrivacyMaskSettings-D5ozyRW7.js → PrivacyMaskSettings-DH3PZaEy.js} +1 -1
  35. package/dist/assets/Recordings-BJVAQK7Q.js +1 -0
  36. package/dist/assets/{ScanNetworkModal-tiMZttK7.js → ScanNetworkModal-qjbQd1Q4.js} +1 -1
  37. package/dist/assets/{SceneMonitorEditor-CrwhZjau.js → SceneMonitorEditor-CLWf6Z9-.js} +1 -1
  38. package/dist/assets/SessionsList-DSaSTSfg.js +2 -0
  39. package/dist/assets/{Showroom-BuzmfCLW.js → Showroom-yf_2TnT8.js} +1 -1
  40. package/dist/assets/System-BKoiOnT6.js +1 -0
  41. package/dist/assets/{Terminal-BxmZLjAl.js → Terminal-CGMRAh-D.js} +3 -3
  42. package/dist/assets/{Viewer-DKhlTfCg.js → Viewer-CTvuCeo6.js} +1 -1
  43. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-ChRFbBue.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DAW63rZZ.js} +1 -1
  44. package/dist/assets/{addon-icons-context-DY_rAsap.js → addon-icons-context-Bzdujcmt.js} +1 -1
  45. package/dist/assets/{archive-W1ZaOIy6.js → archive-dvL2Bchb.js} +1 -1
  46. package/dist/assets/{assignment-candidates-BpQXQnWA.js → assignment-candidates-Zc8Nwi6m.js} +1 -1
  47. package/dist/assets/{authed-media-vxjhgNZq.js → authed-media-B6hJJcft.js} +1 -1
  48. package/dist/assets/{bell-off-BpuHdEmA.js → bell-off-C3flB_OF.js} +1 -1
  49. package/dist/assets/{board-model-BpmGz42d.js → board-model-h3RS4HY8.js} +1 -1
  50. package/dist/assets/{boxes-BP6lUc_5.js → boxes-BiMbpzNh.js} +1 -1
  51. package/dist/assets/chart-column-BMpUb2lF.js +1 -0
  52. package/dist/assets/circle-slash-B8Tjloe5.js +1 -0
  53. package/dist/assets/client-Ct1F5MoE.js +358 -0
  54. package/dist/assets/{cloud-upload-ARBEZ-Y1.js → cloud-upload-CAJgV_u1.js} +1 -1
  55. package/dist/assets/crop-CS-td_0y.js +1 -0
  56. package/dist/assets/{device-integration-icon-CPDmGsoD.js → device-integration-icon-DukkUZAm.js} +1 -1
  57. package/dist/assets/device-picker-model-P-UzQOB7.js +1 -0
  58. package/dist/assets/dist-B89wGMMB.js +358 -0
  59. package/dist/assets/{dist-B2eSaq-o.js → dist-CPp8d_RN.js} +1 -1
  60. package/dist/assets/{eraser-C0EhIwNf.js → eraser-BL6nSeLQ.js} +1 -1
  61. package/dist/assets/{format-D4oZ2Oti.js → format-ChtZgmyh.js} +1 -1
  62. package/dist/assets/{hard-drive-download-CrDu4V4S.js → hard-drive-download-ysGKYLwW.js} +1 -1
  63. package/dist/assets/{hostInit-DVizgo6V.js → hostInit-CDPK_pyj.js} +1 -1
  64. package/dist/assets/i18n-DJ4egBMY.js +1 -0
  65. package/dist/assets/icons-B7uNvSe0.js +1 -0
  66. package/dist/assets/index-hKEeWkm1.js +4 -0
  67. package/dist/assets/{key-round-Dh6fcJDV.js → key-round-BDT5O9Ed.js} +1 -1
  68. package/dist/assets/{key-BSKPngWG.js → key-xS-HUgNI.js} +1 -1
  69. package/dist/assets/{layers-khG7TS-L.js → layers-BeRWYCde.js} +1 -1
  70. package/dist/assets/{linked-devices-model-Cnqr55pr.js → linked-devices-model-DOZONZiM.js} +1 -1
  71. package/dist/assets/{list-ordered-B5DA6_oa.js → list-ordered-DKzGLPr6.js} +1 -1
  72. package/dist/assets/location-owned-usage-BxmUSyXj.js +1 -0
  73. package/dist/assets/{log-in-CoYLZEi7.js → log-in-53JDrQ-P.js} +1 -1
  74. package/dist/assets/{memory-stick-MOirwg5Y.js → memory-stick-B9PVELyF.js} +1 -1
  75. package/dist/assets/{message-square-plus-CEVi2ZAP.js → message-square-plus-B32IU45x.js} +1 -1
  76. package/dist/assets/{mf-entry-bootstrap-0-be603f7b.js → mf-entry-bootstrap-0-65d35510.js} +2 -2
  77. package/dist/assets/{mic-off-Cilr4Bli.js → mic-off-B0w-1GrV.js} +1 -1
  78. package/dist/assets/{monitor-off-DLVIYtnd.js → monitor-off-Cz2SxBVE.js} +1 -1
  79. package/dist/assets/{monitor-smartphone-TMWTIuue.js → monitor-smartphone-Cqk6Z8Hg.js} +1 -1
  80. package/dist/assets/mount-P-UzQOB7.js +1 -0
  81. package/dist/assets/{player-overlays-By2E2OWX.js → player-overlays-Cs6l33cj.js} +1 -1
  82. package/dist/assets/{recycle-DSYCQWpK.js → recycle-DpB4QxbX.js} +1 -1
  83. package/dist/assets/remoteEntry-BGbchE1L.js +1 -0
  84. package/dist/assets/{scan-eye-qMn599c3.js → scan-eye-DcYrgFOu.js} +1 -1
  85. package/dist/assets/{scissors-DzKs5SeF.js → scissors-_j_D3ONm.js} +1 -1
  86. package/dist/assets/{search-x-0pY78yhl.js → search-x-9dPd-b95.js} +1 -1
  87. package/dist/assets/{send-x-DGZeSf.js → send-D42ODbS7.js} +1 -1
  88. package/dist/assets/{settings-2-CBTEttT3.js → settings-2-zgGmo4c8.js} +1 -1
  89. package/dist/assets/{speaker-EkvC7jK4.js → speaker-DIPHxIQ6.js} +1 -1
  90. package/dist/assets/src-DFzrn-CX.js +67 -0
  91. package/dist/assets/{step-inspector-model-BvwTAgYG.js → step-inspector-model-CS79liRv.js} +1 -1
  92. package/dist/assets/{table-2-Ctei20ip.js → table-2-lftK0wHb.js} +1 -1
  93. package/dist/assets/{timer-reset-CVElL395.js → timer-reset-catAE_r9.js} +1 -1
  94. package/dist/assets/{ungroup-B8d2LiRM.js → ungroup-BKImeHER.js} +1 -1
  95. package/dist/assets/{unlink-DcYhq2lS.js → unlink-Behl018w.js} +1 -1
  96. package/dist/assets/{usb-hziv0KIU.js → usb-D5kzB8kq.js} +1 -1
  97. package/dist/assets/{use-scenes-feed-16-Xn-4f.js → use-scenes-feed-CGDnep25.js} +1 -1
  98. package/dist/assets/{use-stationary-objects-Dfi4P7en.js → use-stationary-objects-D_R5OahX.js} +1 -1
  99. package/dist/assets/useEventInvalidation-P-UzQOB7.js +1 -0
  100. package/dist/assets/{useNodeUrlSelection-C6820-b7.js → useNodeUrlSelection-PBAYjRo5.js} +1 -1
  101. package/dist/assets/user-round-BJVl6LX9.js +1 -0
  102. package/dist/assets/{user-x-B7WeA-ce.js → user-x-COQ6vhb4.js} +1 -1
  103. package/dist/assets/{video-DKRf0Ic4.js → video-Byw3ItoR.js} +1 -1
  104. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-D6C0Wijv.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-CsFmgfi4.js} +2 -2
  105. package/dist/index.html +9 -9
  106. package/dist/server/addon.js +274 -29
  107. package/package.json +1 -1
  108. package/dist/assets/Addons-CZCGnQMQ.js +0 -5
  109. package/dist/assets/AiProfiles--zkaLy_B.js +0 -3
  110. package/dist/assets/Build-rWgY-SZM.js +0 -40
  111. package/dist/assets/Data-CCEKKeDE.js +0 -2
  112. package/dist/assets/DeviceDetail-D9LiDoGw.js +0 -2
  113. package/dist/assets/HelperWizard-Uk1HvQ9Z.js +0 -2
  114. package/dist/assets/History-BSXemVAg.js +0 -1
  115. package/dist/assets/Identity-DUUQUaLn.js +0 -1
  116. package/dist/assets/IntegrationDetail-Cg5a23zE.js +0 -1
  117. package/dist/assets/Integrations-B7G_Cpwv.js +0 -1
  118. package/dist/assets/Integrations-J8r1M--P.js +0 -1
  119. package/dist/assets/Library-B32BJFM3.js +0 -1
  120. package/dist/assets/Locations-qBrWJ5eA.js +0 -3
  121. package/dist/assets/MyAccess-BkcUaVmh.js +0 -2
  122. package/dist/assets/Network-BrDFqhC5.js +0 -1
  123. package/dist/assets/NodeAddonsSettingsPanel-DsSbHT51.js +0 -1
  124. package/dist/assets/Notifications-BPK2WNL-.js +0 -1
  125. package/dist/assets/Pipeline-CNlBiPEC.js +0 -1
  126. package/dist/assets/Recordings-BrCuLKqt.js +0 -1
  127. package/dist/assets/SessionsList-fLonifFr.js +0 -2
  128. package/dist/assets/System-B5axMnbq.js +0 -1
  129. package/dist/assets/circle-slash-C9MZOlOA.js +0 -1
  130. package/dist/assets/client-COfGFdJB.js +0 -358
  131. package/dist/assets/crop-CcnscEEp.js +0 -1
  132. package/dist/assets/device-picker-model-Z8NhIJHV.js +0 -1
  133. package/dist/assets/dist-Cwk0eIEi.js +0 -358
  134. package/dist/assets/i18n-DRa6-1Ye.js +0 -1
  135. package/dist/assets/icons-DanAyxOR.js +0 -1
  136. package/dist/assets/index-BO95XcLa.js +0 -4
  137. package/dist/assets/location-owned-usage-pJJy4BTC.js +0 -1
  138. package/dist/assets/mount-Z8NhIJHV.js +0 -1
  139. package/dist/assets/remoteEntry-ClU628tf.js +0 -1
  140. package/dist/assets/src-BZ8j9Q2T.js +0 -67
  141. package/dist/assets/useEventInvalidation-Z8NhIJHV.js +0 -1
  142. package/dist/assets/user-round-BrkQjamf.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-bykKrTgu.mjs
5446
+ //#region ../types/dist/sleep-0sD_LHLI.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).
@@ -8605,6 +8605,7 @@ var CAP_NAMES = Object.freeze([
8605
8605
  "login-method",
8606
8606
  "media-player",
8607
8607
  "mesh-network",
8608
+ "meter",
8608
8609
  "metrics-provider",
8609
8610
  "model-convert",
8610
8611
  "model-distributor",
@@ -9662,6 +9663,10 @@ Object.freeze({
9662
9663
  ]
9663
9664
  }
9664
9665
  ],
9666
+ "meter": [{
9667
+ "path": "value",
9668
+ "valueType": "number"
9669
+ }],
9665
9670
  "motion": [
9666
9671
  {
9667
9672
  "path": "detected",
@@ -10405,7 +10410,7 @@ object({
10405
10410
  params: record(string(), union([string(), number()])).optional()
10406
10411
  });
10407
10412
  //#endregion
10408
- //#region ../types/dist/err-msg-BXKzRBwg.mjs
10413
+ //#region ../types/dist/err-msg-DIorGYeC.mjs
10409
10414
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
10410
10415
  DeviceType["Camera"] = "camera";
10411
10416
  DeviceType["Hub"] = "hub";
@@ -10499,8 +10504,14 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
10499
10504
  DeviceType["PetFeeder"] = "pet-feeder";
10500
10505
  /** Built-in dishwasher — program lifecycle, door / remote-start gates,
10501
10506
  * salt and rinse-aid levels. Installed with the `dishwasher` cap.
10502
- * Sources: native Bosch Home Connect, reusable by similar integrations. */
10507
+ * Sources: native Bosch Home Connect, reusable by similar integrations.
10508
+ * A plug-built dishwasher carries running-state and power instead. */
10503
10509
  DeviceType["Dishwasher"] = "dishwasher";
10510
+ /** Washing machine. A plug-built one is running while its power stays
10511
+ * above a threshold. No program cap — that surface is the dishwasher's. */
10512
+ DeviceType["Washer"] = "washer";
10513
+ /** Tumble dryer. Same plug-built running surface as {@link Washer}. */
10514
+ DeviceType["Dryer"] = "dryer";
10504
10515
  return DeviceType;
10505
10516
  }({});
10506
10517
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -10748,7 +10759,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
10748
10759
  return DeviceRole;
10749
10760
  }({});
10750
10761
  //#endregion
10751
- //#region ../types/dist/composition-OhpuespA.mjs
10762
+ //#region ../types/dist/composition-CpETZ4HL.mjs
10752
10763
  /**
10753
10764
  * The ffmpeg build every CamStack node downloads, per platform and arch.
10754
10765
  *
@@ -11504,6 +11515,97 @@ function validateExpressionSource(src) {
11504
11515
  return null;
11505
11516
  }
11506
11517
  /**
11518
+ * One power reading becomes a washer, dryer or dishwasher (D944 helper).
11519
+ *
11520
+ * Standby of the control board is under 5 W; a motor or a heater is far
11521
+ * above that, so 5 W is the line. A door lock or a short pump spike is not
11522
+ * a cycle, so running starts only after 30 s above the line.
11523
+ *
11524
+ * A wash, dry or dishwasher pause (soak, heat-wait, heater off between
11525
+ * bursts) lasts several minutes. Ending the cycle on the first dip would
11526
+ * report "finished" in the middle of the program, so the stop dwell is
11527
+ * 10 minutes on every type. The number is stored per type so one machine
11528
+ * can move later without moving the others.
11529
+ */
11530
+ var APPLIANCE_TEMPLATE_ID = "appliance";
11531
+ var APPLIANCE_KINDS = [
11532
+ "washer",
11533
+ "dryer",
11534
+ "dishwasher"
11535
+ ];
11536
+ DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher;
11537
+ /**
11538
+ * Statistics and integrals over a history read (D944).
11539
+ *
11540
+ * Pure: the same points always give the same answer, so a restart recomputes
11541
+ * rather than trusting a buffer. A gauge mean is time-weighted (value × ms),
11542
+ * never the mean of the samples. A hole with no held value is not integrated
11543
+ * as zero. A truncated read is not published.
11544
+ */
11545
+ var STATISTIC_STATS = [
11546
+ "min",
11547
+ "max",
11548
+ "mean",
11549
+ "sum",
11550
+ "count",
11551
+ "change"
11552
+ ];
11553
+ /**
11554
+ * The range a statistics or integral helper asks history for (D944).
11555
+ *
11556
+ * Calendar edges are the hub's timezone, never UTC midnight: a day is 23, 24
11557
+ * or 25 hours across a DST change. A tier is eligible only when its retention
11558
+ * is strictly longer than the longest that range can be. Forever qualifies.
11559
+ * Equal to a tier's retention is a refusal, not a short answer.
11560
+ */
11561
+ var MINUTE_MS = 6e4;
11562
+ var HOUR_MS = 60 * MINUTE_MS;
11563
+ var DAY_MS = 24 * HOUR_MS;
11564
+ var ROLLING_SPANS = [
11565
+ "1h",
11566
+ "24h",
11567
+ "2d",
11568
+ "7d",
11569
+ "30d",
11570
+ "custom"
11571
+ ];
11572
+ var CALENDAR_PERIODS = [
11573
+ "today",
11574
+ "yesterday",
11575
+ "this-week",
11576
+ "this-month"
11577
+ ];
11578
+ var RESET_PERIODS = [
11579
+ "never",
11580
+ "daily",
11581
+ "weekly",
11582
+ "monthly"
11583
+ ];
11584
+ 5 * MINUTE_MS;
11585
+ 24 * HOUR_MS, 2 * DAY_MS, 7 * DAY_MS, 30 * DAY_MS;
11586
+ 7 * DAY_MS, 30 * DAY_MS, 365 * DAY_MS;
11587
+ var StatisticWindowSchema = discriminatedUnion("kind", [object({
11588
+ kind: literal("rolling"),
11589
+ span: _enum(ROLLING_SPANS),
11590
+ customMinutes: number().int().min(5).optional()
11591
+ }).check((payload) => {
11592
+ if (payload.value.span === "custom" && payload.value.customMinutes === void 0) payload.issues.push({
11593
+ code: "custom",
11594
+ message: "a custom range needs a duration in minutes",
11595
+ path: ["customMinutes"],
11596
+ input: payload.value
11597
+ });
11598
+ if (payload.value.span !== "custom" && payload.value.customMinutes !== void 0) payload.issues.push({
11599
+ code: "custom",
11600
+ message: "only a custom range carries a duration",
11601
+ path: ["customMinutes"],
11602
+ input: payload.value
11603
+ });
11604
+ }), object({
11605
+ kind: literal("calendar"),
11606
+ period: _enum(CALENDAR_PERIODS)
11607
+ })]);
11608
+ /**
11507
11609
  * A composition source identity: `(addonId, stableId)`, never a numeric device
11508
11610
  * id. Split out so helper schemas can name it without a cycle through
11509
11611
  * `composition.ts` (D659).
@@ -11559,14 +11661,37 @@ var HelperMemberSchema = object({
11559
11661
  cap: string().min(1),
11560
11662
  fieldPath: string().min(1)
11561
11663
  });
11562
- var HelperSpecSchema = discriminatedUnion("kind", [object({
11563
- kind: literal("group"),
11564
- templateId: GroupTemplateIdSchema,
11565
- aggregate: AggregateReducerSchema,
11566
- members: array(HelperMemberSchema).min(1).max(64),
11567
- /** Actuator groups only. Readings leave this unset. */
11568
- active: ActiveCriterionSchema.optional()
11569
- })]);
11664
+ var HelperSpecSchema = discriminatedUnion("kind", [
11665
+ object({
11666
+ kind: literal("group"),
11667
+ templateId: GroupTemplateIdSchema,
11668
+ aggregate: AggregateReducerSchema,
11669
+ members: array(HelperMemberSchema).min(1).max(64),
11670
+ /** Actuator groups only. Readings leave this unset. */
11671
+ active: ActiveCriterionSchema.optional()
11672
+ }),
11673
+ object({
11674
+ kind: literal("appliance"),
11675
+ templateId: literal(APPLIANCE_TEMPLATE_ID),
11676
+ appliance: _enum(APPLIANCE_KINDS),
11677
+ thresholdWatts: number().positive(),
11678
+ startDwellMs: number().int().nonnegative(),
11679
+ stopDwellMs: number().int().nonnegative(),
11680
+ member: HelperMemberSchema
11681
+ }),
11682
+ object({
11683
+ kind: literal("statistic"),
11684
+ stat: _enum(STATISTIC_STATS),
11685
+ window: StatisticWindowSchema,
11686
+ source: HelperMemberSchema
11687
+ }),
11688
+ object({
11689
+ kind: literal("integral"),
11690
+ reset: _enum(RESET_PERIODS),
11691
+ output: _enum(["energy", "meter"]),
11692
+ source: HelperMemberSchema
11693
+ })
11694
+ ]);
11570
11695
  /** A composed device's stableId is this prefix plus the block id. */
11571
11696
  var COMPOSED_DEVICE_STABLE_ID_PREFIX = "composed-";
11572
11697
  /** Longest snippet a `code` source may carry (slice 4). */
@@ -11640,6 +11765,26 @@ var CompositionFieldSourceSchema = discriminatedUnion("kind", [
11640
11765
  "omit",
11641
11766
  "offline"
11642
11767
  ])
11768
+ }),
11769
+ object({
11770
+ kind: literal("series"),
11771
+ read: CompositionFieldReadSchema,
11772
+ /** `value` is the statistic or the integral. The others are the gap counts. */
11773
+ publish: _enum([
11774
+ "value",
11775
+ "included",
11776
+ "excluded",
11777
+ "total"
11778
+ ]),
11779
+ /**
11780
+ * What an unanswered `value` does. Counts ignore this. `offline` leaves the
11781
+ * device unseeded until history answers, so a restart cannot publish 0.
11782
+ */
11783
+ empty: _enum([
11784
+ "null",
11785
+ "omit",
11786
+ "offline"
11787
+ ])
11643
11788
  })
11644
11789
  ]);
11645
11790
  var CompositionCommandTargetSchema = discriminatedUnion("kind", [object({
@@ -17798,7 +17943,8 @@ var CompositionProblemSchema = object({
17798
17943
  "native-capability-replace",
17799
17944
  "mixed-quantity",
17800
17945
  "helper-mismatch",
17801
- "member-constraint"
17946
+ "member-constraint",
17947
+ "retention"
17802
17948
  ]),
17803
17949
  path: string(),
17804
17950
  message: string()
@@ -18038,7 +18184,7 @@ Object.freeze({
18038
18184
  * One catalog row per base reading a group helper can build (D944 §3).
18039
18185
  * Data, not a form default written into the block.
18040
18186
  */
18041
- var NOW = {
18187
+ var NOW$1 = {
18042
18188
  fieldPath: "lastFetchedAt",
18043
18189
  expr: "now"
18044
18190
  };
@@ -18084,7 +18230,7 @@ var GROUP_TEMPLATES = [
18084
18230
  quantity: "temperature",
18085
18231
  defaultAggregate: "mean",
18086
18232
  empty: "null",
18087
- companions: [NOW]
18233
+ companions: [NOW$1]
18088
18234
  }),
18089
18235
  numeric({
18090
18236
  id: "humidity",
@@ -18095,7 +18241,7 @@ var GROUP_TEMPLATES = [
18095
18241
  quantity: "humidity",
18096
18242
  defaultAggregate: "mean",
18097
18243
  empty: "null",
18098
- companions: [NOW]
18244
+ companions: [NOW$1]
18099
18245
  }),
18100
18246
  numeric({
18101
18247
  id: "pressure",
@@ -18106,7 +18252,7 @@ var GROUP_TEMPLATES = [
18106
18252
  quantity: "pressure",
18107
18253
  defaultAggregate: "mean",
18108
18254
  empty: "null",
18109
- companions: [NOW]
18255
+ companions: [NOW$1]
18110
18256
  }),
18111
18257
  numeric({
18112
18258
  id: "illuminance",
@@ -18117,7 +18263,7 @@ var GROUP_TEMPLATES = [
18117
18263
  quantity: "illuminance",
18118
18264
  defaultAggregate: "mean",
18119
18265
  empty: "null",
18120
- companions: [NOW]
18266
+ companions: [NOW$1]
18121
18267
  }),
18122
18268
  numeric({
18123
18269
  id: "power",
@@ -18128,7 +18274,7 @@ var GROUP_TEMPLATES = [
18128
18274
  quantity: "power",
18129
18275
  defaultAggregate: "sum",
18130
18276
  empty: "omit",
18131
- companions: [NOW]
18277
+ companions: [NOW$1]
18132
18278
  }),
18133
18279
  numeric({
18134
18280
  id: "energy",
@@ -18139,7 +18285,7 @@ var GROUP_TEMPLATES = [
18139
18285
  quantity: "energy",
18140
18286
  defaultAggregate: "sum",
18141
18287
  empty: "omit",
18142
- companions: [NOW]
18288
+ companions: [NOW$1]
18143
18289
  }),
18144
18290
  numeric({
18145
18291
  id: "battery",
@@ -18174,7 +18320,7 @@ var GROUP_TEMPLATES = [
18174
18320
  quantity: "device",
18175
18321
  defaultAggregate: "mean",
18176
18322
  empty: "null",
18177
- companions: [NOW]
18323
+ companions: [NOW$1]
18178
18324
  }),
18179
18325
  binary({
18180
18326
  id: "motion",
@@ -18303,6 +18449,7 @@ function actuator(input) {
18303
18449
  }
18304
18450
  new Map(GROUP_TEMPLATES.map((template) => [template.id, template]));
18305
18451
  DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
18452
+ DeviceType.Camera;
18306
18453
  `${COMPOSED_DEVICE_STABLE_ID_PREFIX}`;
18307
18454
  /**
18308
18455
  * What a composition may BUILD on a device type (G2, D676): the caps a new
@@ -59094,6 +59241,11 @@ DeviceType.Lock, method(object({
59094
59241
  kind: "mutation",
59095
59242
  auth: "protected"
59096
59243
  });
59244
+ object({
59245
+ value: number().nullable().meta(readingMeta("device", { label: "Total" })),
59246
+ lastFetchedAt: number()
59247
+ });
59248
+ DeviceType.Sensor;
59097
59249
  /**
59098
59250
  * Media-player cap. Models HA `media_player.*` (Sonos, Chromecast,
59099
59251
  * Apple TV, Spotify, Roku, generic OTT receivers, …) on
@@ -61011,7 +61163,7 @@ object({
61011
61163
  /** Ms epoch when the slice was last updated. */
61012
61164
  lastFetchedAt: number()
61013
61165
  });
61014
- DeviceType.Sensor;
61166
+ DeviceType.Sensor, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher;
61015
61167
  /**
61016
61168
  * Presence cap. Models HA `person.*` and `device_tracker.*` entities
61017
61169
  * on `DeviceType.Presence`. Read-only — no setters: presence is
@@ -61458,7 +61610,7 @@ object({
61458
61610
  phase: string().nullable()
61459
61611
  });
61460
61612
  Object.values(DeviceType);
61461
- DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder;
61613
+ DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder;
61462
61614
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
61463
61615
  kind: "mutation",
61464
61616
  auth: "admin"
@@ -65190,7 +65342,7 @@ method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" })
65190
65342
  auth: "admin"
65191
65343
  });
65192
65344
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
65193
- DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.Dishwasher, DeviceType.Camera, DeviceType.Camera, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder;
65345
+ 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;
65194
65346
  String.raw`rose\(active(\d+), changed(\d+), (\d+(?:\.\d+)?)\)`;
65195
65347
  DeviceRole.BinarySensor, DeviceRole.MotionSensor;
65196
65348
  new Set(CAP_NAMES);
@@ -65243,7 +65395,7 @@ var AccessoryKind = {
65243
65395
  PrivacyMask: DeviceRole.PrivacyMask
65244
65396
  };
65245
65397
  AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
65246
- DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.Dishwasher;
65398
+ DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, 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;
65247
65399
  new Set(Object.values(DeviceType));
65248
65400
  Object.freeze({
65249
65401
  "accessories.getStatus": {
@@ -69432,6 +69584,13 @@ Object.freeze({
69432
69584
  access: "create",
69433
69585
  role: "admin"
69434
69586
  },
69587
+ "meter.getStatus": {
69588
+ capName: "meter",
69589
+ capScope: "device",
69590
+ addonId: null,
69591
+ access: "view",
69592
+ role: "viewer"
69593
+ },
69435
69594
  "metricsProvider.collectSnapshot": {
69436
69595
  capName: "metrics-provider",
69437
69596
  capScope: "system",
@@ -77530,7 +77689,39 @@ var APPLIANCE_CAP_VOCABULARY = {
77530
77689
  phrase: t("When {device} finishes", "Quando {device} finisce"),
77531
77690
  icon: "square"
77532
77691
  }
77533
- }
77692
+ },
77693
+ overrides: { byType: {
77694
+ [DeviceType.Washer]: {
77695
+ state: { running: {
77696
+ whenTrue: t("When the washing machine starts", "Quando la lavatrice inizia"),
77697
+ whenFalse: t("When the washing machine has finished", "Quando la lavatrice ha finito")
77698
+ } },
77699
+ events: {
77700
+ onStarted: { phrase: t("When the washing machine starts", "Quando la lavatrice inizia") },
77701
+ onFinished: { phrase: t("When the washing machine has finished", "Quando la lavatrice ha finito") }
77702
+ }
77703
+ },
77704
+ [DeviceType.Dryer]: {
77705
+ state: { running: {
77706
+ whenTrue: t("When the dryer starts", "Quando l'asciugatrice inizia"),
77707
+ whenFalse: t("When the dryer has finished", "Quando l'asciugatrice ha finito")
77708
+ } },
77709
+ events: {
77710
+ onStarted: { phrase: t("When the dryer starts", "Quando l'asciugatrice inizia") },
77711
+ onFinished: { phrase: t("When the dryer has finished", "Quando l'asciugatrice ha finito") }
77712
+ }
77713
+ },
77714
+ [DeviceType.Dishwasher]: {
77715
+ state: { running: {
77716
+ whenTrue: t("When the dishwasher starts", "Quando la lavastoviglie inizia"),
77717
+ whenFalse: t("When the dishwasher has finished", "Quando la lavastoviglie ha finito")
77718
+ } },
77719
+ events: {
77720
+ onStarted: { phrase: t("When the dishwasher starts", "Quando la lavastoviglie inizia") },
77721
+ onFinished: { phrase: t("When the dishwasher has finished", "Quando la lavastoviglie ha finito") }
77722
+ }
77723
+ }
77724
+ } }
77534
77725
  },
77535
77726
  update: {
77536
77727
  scope: "device",
@@ -78358,6 +78549,17 @@ var SENSOR_CAP_VOCABULARY = {
78358
78549
  }],
78359
78550
  events: { onMotionChanged: { notOperatorFacing: "the `detected` state trigger phrases both edges, from the mirror that survives a dropped event (D49)" } }
78360
78551
  },
78552
+ meter: {
78553
+ scope: "device",
78554
+ noun: t("Meter", "Contatore"),
78555
+ state: [{
78556
+ kind: "numeric",
78557
+ field: "value",
78558
+ quantity: t("the total", "il totale"),
78559
+ label: t("Total", "Totale"),
78560
+ icon: "gauge"
78561
+ }]
78562
+ },
78361
78563
  "numeric-sensor": {
78362
78564
  scope: "device",
78363
78565
  noun: t("Sensor", "Sensore"),
@@ -78830,8 +79032,47 @@ function projectAction(cap, action) {
78830
79032
  };
78831
79033
  }
78832
79034
  Object.entries(CAP_VOCABULARY_BY_NAME).flatMap(([cap, entry]) => entry.scope === "device" ? (entry.actions ?? []).map((a) => projectAction(cap, a)) : []);
78833
- 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;
79035
+ 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;
78834
79036
  DeviceFeature.BatteryOperated;
79037
+ DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher;
79038
+ var HA_AS = "a power sensor (device_class power). Home Assistant has no laundry domain. running-state stays unexported until a null reading can be published as unavailable.";
79039
+ var HOMEKIT_REASON = "HomeKit has no laundry-appliance service. The export tab would pair an accessory with nothing on it: running-state is withheld until a null reading can be unavailable, and power is not a HomeKit service this export honours.";
79040
+ var ALEXA_REASON = "Alexa has no laundry category in this export, and neither power nor running has an Alexa interface.";
79041
+ var GOOGLE_REASON = "Google WASHER, DRYER and DISHWASHER require RunCycle. A power threshold is not that trait, and this export does not publish RunCycle.";
79042
+ var MATTER_REASON = "No Matter export is built. The closest device types are Laundry Washer (0x0073) and Laundry Dryer (0x0074); a power threshold is not the Laundry Washer Mode cluster.";
79043
+ function withheld(reason) {
79044
+ return {
79045
+ [DeviceType.Washer]: {
79046
+ exported: false,
79047
+ reason
79048
+ },
79049
+ [DeviceType.Dryer]: {
79050
+ exported: false,
79051
+ reason
79052
+ },
79053
+ [DeviceType.Dishwasher]: {
79054
+ exported: false,
79055
+ reason
79056
+ }
79057
+ };
79058
+ }
79059
+ function offered(received) {
79060
+ return {
79061
+ [DeviceType.Washer]: {
79062
+ exported: true,
79063
+ as: received
79064
+ },
79065
+ [DeviceType.Dryer]: {
79066
+ exported: true,
79067
+ as: received
79068
+ },
79069
+ [DeviceType.Dishwasher]: {
79070
+ exported: true,
79071
+ as: received
79072
+ }
79073
+ };
79074
+ }
79075
+ offered(HA_AS), withheld(HOMEKIT_REASON), withheld(ALEXA_REASON), withheld(GOOGLE_REASON), withheld(MATTER_REASON);
78835
79076
  Object.freeze({
78836
79077
  "accessories.getStatus": [{
78837
79078
  name: "deviceId",
@@ -80008,6 +80249,11 @@ Object.freeze({
80008
80249
  form: "single",
80009
80250
  optional: false
80010
80251
  }],
80252
+ "meter.getStatus": [{
80253
+ name: "deviceId",
80254
+ form: "single",
80255
+ optional: false
80256
+ }],
80011
80257
  "motion.getStatus": [{
80012
80258
  name: "deviceId",
80013
80259
  form: "single",
@@ -81615,7 +81861,6 @@ Object.freeze({
81615
81861
  "network-access": "ingress",
81616
81862
  "smtp-provider": "email"
81617
81863
  });
81618
- DeviceType.Camera;
81619
81864
  /**
81620
81865
  * A saved Customize assignment (D936). The schema is the type: callers use
81621
81866
  * `z.infer`, they do not restate the shape.
@@ -82940,7 +83185,7 @@ var AdminUIAddon = class extends BaseAddon {
82940
83185
  capability: adminUiCapability,
82941
83186
  provider: {
82942
83187
  getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
82943
- getVersion: async () => ({ version: "1.2.482" })
83188
+ getVersion: async () => ({ version: "1.2.484" })
82944
83189
  }
82945
83190
  }];
82946
83191
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-admin-ui",
3
- "version": "1.2.482",
3
+ "version": "1.2.484",
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{It as d,Nt as f,Ot as p,Q as m,Rn as h,Si as g,Tn as _,Wr as v,ai as y,bn as b,dt as x,fn as S,or as C,pi as ee,pn as w,tn as T,un as E,vi as te,xi as ne}from"./player-overlays-By2E2OWX.js";import{Pa as re}from"./client-COfGFdJB.js";import{i as D,l as ie}from"./video-DKRf0Ic4.js";import{$r as O,Ai as ae,Bn as oe,Di as k,Ei as se,Fi as ce,Hn as A,Ii as j,Kr as M,Li as N,Mi as le,Ni as P,Oi as F,Si as ue,Ti as I,Un as L,Ur as R,Vn as z,Wr as B,Xu as V,_d as de,_i as fe,_r as pe,bd as me,bi as H,bt as U,gi as he,hi as W,hr as G,ji as ge,kt as _e,mr as K,nn as ve,pi as ye,pr as q,tc as be,td as xe,tn as Se,vi as Ce,vr as we,wi as Te,xi as Ee,yi as De,yr as J}from"./src-BZ8j9Q2T.js";import{t as Y}from"./useTranslation-BJr-n0es.js";import"./mount-Z8NhIJHV.js";import{gr as Oe,mr as X,ur as Z}from"./index-BO95XcLa.js";import{t as ke}from"./AdminPage-BGeHUp9l.js";import{t as Ae}from"./NodeAddonsSettingsPanel-DsSbHT51.js";import{n as Q,t as je}from"./useNodeUrlSelection-C6820-b7.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:y,bg:`bg-muted text-foreground-subtle`,labelKey:`addons.addonRowBadge.queued`},updating:{icon:C,bg:`bg-primary/10 text-primary`,labelKey:`addons.addonRowBadge.updating`,spin:!0},"done-pending-restart":{icon:b,bg:`bg-amber-500/10 text-amber-700`,labelKey:`addons.addonRowBadge.pendingRestart`},done:{icon:g,bg:`bg-success/10 text-success`,labelKey:`addons.addonRowBadge.done`},failed:{icon: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}=I({activeOnly:!0},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data?.length??0)>0?3e3:!1}),{map:t}=me(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:y,cls:`bg-muted text-foreground-subtle`,labelKey:`addons.jobProgress.queued`},fetching:{icon:C,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.fetching`,spin:!0},staged:{icon:C,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.staged`,spin:!0},validating:{icon:C,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.validating`,spin:!0},applying:{icon:C,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.applying`,spin:!0},restarting:{icon:C,cls:`bg-amber-500/10 text-amber-600 dark:text-amber-400`,labelKey:`addons.jobProgress.restarting`,spin:!0},applied:{icon:C,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.finalizing`,spin:!0},done:{icon:g,cls:`bg-success/10 text-success`,labelKey:`addons.jobProgress.updated`},failed:{icon:D,cls:`bg-danger/10 text-danger`,labelKey:`addons.jobProgress.failed`},skipped:{icon:T,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=B(),f=R(),p=Te(Je,{staleTime:Ye}),m=p.data?.installations??[],h=(p.data?.unreachable??[]).map(e=>e.nodeId),g=He(m,e),_=e=>g.find(t=>t.nodeId===e)?.nodeName??(e===r.id?r.name:e),v=j({onSettled:()=>{c.invalidateQueries({queryKey:[[`addons`]]}),c.invalidateQueries({queryKey:[[`addonPages`]]}),c.invalidateQueries({queryKey:[[`capabilities`]]}),c.invalidateQueries({queryKey:[[`nodes`]]})}}),y=async e=>{await f({title:e.success?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 f({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 p.refetch()).data;if(t===void 0){await f({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(d,{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:d}=Y(),f=r===`upload`||r===`local`,[m,h]=s(!1),{data:_,isLoading:y,isError:b}=H({name:e}),S=_?$e(_,m):[],ee=_?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:d(`addons.versionPicker.versions`,`Versions`)}),a(`button`,{type:`button`,onClick:o,className:`text-foreground-subtle hover:text-foreground`,children:a(x,{className:`h-3 w-3`})})]}),f&&t(`div`,{className:`flex items-start gap-2 px-3 py-2 border-b border-border bg-cyan-500/10 text-[10px]`,children:[a(p,{className:`h-3 w-3 mt-0.5 text-cyan-500 shrink-0`}),t(`div`,{className:`text-cyan-700 dark:text-cyan-200`,children:[a(`span`,{className:`font-semibold`,children:d(`addons.versionPicker.inPlace`,{kind:r===`upload`?d(`addons.versionPicker.uploadedCopy`,`Uploaded copy`):d(`addons.versionPicker.localCopy`,`Local copy`)})}),` `,a(Z,{i18nKey:`addons.versionPicker.reinstall`,values:{version:n},components:{mono:a(`span`,{className:`font-mono`})}})]})]}),y&&t(`div`,{className:`flex items-center justify-center gap-2 py-6 text-[10px] text-foreground-subtle`,children:[a(C,{className:`h-3.5 w-3.5 animate-spin`}),d(`addons.versionPicker.loadingVersions`,`Loading versions...`)]}),b&&a(`div`,{className:`px-3 py-4 text-center text-[10px] text-danger`,children:d(`addons.versionPicker.registryError`,`Could not load versions from the registry.`)}),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),f=t(u,{children:[a(`span`,{className:`font-mono flex-1 text-left ${r?`text-primary font-semibold`:s?`text-amber-400`:`text-foreground`}`,children:e.version}),r&&a(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium bg-primary/10 text-primary`,children:d(`common.current`)}),e.distTags.map(e=>a(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${e===`latest`?`bg-emerald-500/15 text-emerald-400`:e===`beta`?`bg-amber-500/15 text-amber-400`:`bg-gray-500/15 text-gray-400`}`,children:e},e)),Qe(e)&&a(`span`,{className:`text-[9px] text-red-400 line-through`,children:d(`common.deprecated`)}),a(`span`,{className:`text-[9px] text-foreground-subtle shrink-0`,children:new Date(e.publishedAt).toLocaleDateString()})]});return c?t(`button`,{type:`button`,"aria-label":d(`addons.versionPicker.select`,`Select {{version}}`,{version:e.version}),onClick:()=>c(e.version),className:`w-full flex items-center gap-2 px-3 py-2 text-[11px] ${o?`bg-primary/5`:`hover:bg-surface-hover`} transition-colors`,children:[f,o?a(g,{className:`h-3 w-3 text-primary shrink-0`}):a(`span`,{className:`w-3 shrink-0`})]},e.version):t(`div`,{className:`flex items-center gap-2 px-3 py-2 text-[11px] ${r?`bg-primary/5`:`hover:bg-surface-hover`} transition-colors`,children:[f,a(`button`,{type:`button`,onClick:()=>i(e.version),className:`shrink-0 rounded p-0.5 hover:bg-primary/20 text-foreground-subtle hover:text-primary transition-colors`,title:r?d(`addons.versionPicker.reInstallFromNpm`,`Re-install {{version}} from npm`,{version:e.version}):d(`addons.versionPicker.install`,`Install {{version}}`,{version:e.version}),children:a(v,{className:`h-3 w-3`})})]},e.version)})}),!y&&!b&&_&&_.length===0&&a(`div`,{className:`py-4 text-center text-[10px] text-foreground-subtle`,children:d(`addons.versionPicker.noVersionsFound`,`No versions found`)}),ee>0&&a(M,{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?d(`addons.versionPicker.hideOlder`,`Hide older versions`):d(`addons.versionPicker.showOlder`,`Show older versions ({{count}})`,{count:ee})})]})}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`,f=r&&i?m(`/api/addon-assets/${r}/${i}`):null,g=!!f&&!c;return t(`div`,{className:`relative flex-shrink-0`,children:[a(`div`,{className:`h-8 w-8 rounded-md flex items-center justify-center ${u?``:d}`,style:u,children:g?a(`img`,{src:f,alt:r,className:`h-4 w-4`,onError:()=>l(!0)}):a(e?h:_,{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(p,{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(C,{className:`h-3 w-3 animate-spin`}),d(`addons.addonCard.updating`,`Updating…`)]});if(n){let i=r??n;return t(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[c&&t(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),c()},disabled:s,className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-semibold border border-blue-500/30 bg-blue-500/10 text-blue-400 hover:bg-blue-500/20 disabled:opacity-50 disabled:cursor-not-allowed transition-colors`,title:d(`addons.addonCard.updateTo`,`Update to {{target}}`,{target:i}),children:[a(v,{className:`h-3 w-3`}),d(`addons.addonCard.update`,`Update`)]}),t(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),l()},disabled:s,"aria-label":d(`addons.addonCard.selectVersionToInstall`,`Select version to install`),title:d(`addons.addonCard.installedUpdateAvailableSelectedTap`,`Installed {{version}} — update available. Selected {{target}}; tap to choose another version.`,{version:e,target:i}),className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-bold font-mono border border-amber-500/40 bg-amber-500/15 text-amber-500 hover:bg-amber-500/25 animate-pulse disabled:opacity-50 disabled:cursor-not-allowed transition-colors`,children:[a(`span`,{className:`font-normal opacity-70`,children:e}),a(`span`,{className:`font-normal opacity-70`,children:`→`}),i,a(ne,{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(ne,{className:`h-3 w-3 opacity-50`})]}),u]})}function st({addonId:e}){let t=l(),{data:n=`inherit`}=he({addonId:e}),r=le({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:g,isSystem:_,selectedNode:v}){let{t:y}=Y(),[S,C]=s(!1),[ee,T]=s(!1),[re,ie]=s(null);o(()=>{ie(null)},[i]);let O=re??i,[oe,k]=s(!1),[se,ce]=s(!1),[A,j]=s(`logs`),N=l(),le=X(),{manifest:P}=e,ue=!p&&!P.protected&&P.removable!==!1,I=!!p,L=p?.displayName??P.name,R=p?.packageName??P.packageName,z=p?.version??P.packageVersion??P.version,B=p?.installSource??e.installSource,V=p?p.bundle?.description??p.addons[0]?.manifest.description:P.description,de=F({onSuccess:()=>{N.invalidateQueries({queryKey:[[`addons`]]})}}),fe=Ee({onSuccess:()=>{N.invalidateQueries({queryKey:[[`addons`]]}),N.invalidateQueries({queryKey:[[`addonPages`]]}),N.invalidateQueries({queryKey:[[`capabilities`]]}),N.invalidateQueries({queryKey:[[`integrations`]]})}}),me=ae({onSuccess:()=>{N.invalidateQueries({queryKey:[[`addons`]]}),N.invalidateQueries({queryKey:[[`alerts`]]})}}),H=e.health,U=H?.phase===`failed`&&!H.inGracePeriod,he=U&&H?.nextRetryAt&&!H.retrying,W=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:y(`addons.addonCard.failedToLoad`,{attempt:H.retryCount})}),a(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:H.lastError?.message??y(`addons.addonCard.unknownError`,`Unknown error`)}),he&&H.nextRetryAt&&a(`div`,{className:`text-[10px] text-foreground-subtle mt-1`,children:y(`addons.addonCard.autoRetryAt`,{time:new Date(H.nextRetryAt).toLocaleTimeString()})})]}),t(`button`,{type:`button`,disabled:me.isPending||H.retrying,onClick:e=>{e.stopPropagation(),me.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:y(`addons.addonCard.resetRetryCounterAndForce`,`Reset retry counter and force immediate reload`),children:[a(b,{className:`h-3 w-3 ${me.isPending||H.retrying?`animate-spin`:``}`}),y(`addons.addonCard.retryNow`,`Retry now`)]})]}),W!==null&&t(`div`,{className:`bg-danger/10 border-b border-danger/30 px-3 py-2 flex items-start gap-2`,children:[a(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:y(`addons.addonCard.processProblem.${W.kind}`)}),W.reason!==void 0&&a(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:W.reason})]})]}),t(`div`,{className:`flex items-start gap-2.5 px-3 py-2`,children:[a(at,{isBundle:I||!!P.components&&P.components.length>1,installSource:B,addonId:I?p.addons[0]?.manifest.id:P.id,iconPath:I?p.bundle?.icon??p.addons[0]?.manifest.icon:P.icon,color:I?p.addons[0]?.manifest.color:P.color}),t(`div`,{className:`flex-1 min-w-0`,children:[t(`div`,{className:`flex items-start justify-between gap-2`,children:[a(`span`,{className:`text-xs font-semibold text-foreground truncate min-w-0`,children:L}),!r&&a(ot,{version:z,availableUpdate:i,...O===void 0?{}:{selectedVersion:O},isUpdating:d,installSource:B,disabled:g,...c&&O!==void 0?{onUpdate:()=>c(O)}:{},onOpenPicker:()=>T(e=>!e),children:ee&&a(tt,{packageName:R,currentVersion:z,...B?{installSource:B}:{},...i!==void 0&&O!==void 0?{selectedVersion:O,onSelect:e=>{ie(e),T(!1)}}:{},onInstall:e=>{T(!1),fe.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(h,{className:`h-3 w-3`}),p.addons.length]}),_&&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:y(`addons.addonCard.systemPackageUpdatingRestartsThe`,`System package — updating restarts the hub`),children:[a(b,{className:`h-3 w-3`}),y(`addons.addonCard.system`,`System`)]}),m!=null&&a(Pe,{item:m}),f!=null&&a(Ve,{progress:f})]}),V&&a(`p`,{className:`text-[10px] text-foreground-subtle mt-1 line-clamp-1`,children:V}),!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`?y(`addons.addonCard.forked`):y(`addons.addonCard.inProcess`)}),e.process.pid!=null&&t(`span`,{className:`text-[9px] font-mono text-foreground-subtle`,children:[`PID `,e.process.pid]}),a(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${e.process.state===`running`?`bg-emerald-500/15 text-emerald-400`:W===null?`bg-gray-500/15 text-gray-400`:`bg-red-500/15 text-red-400`}`,children:e.process.state})]})]})]}),!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(),de.mutate({addonId:P.id})},disabled:de.isPending||g,className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium border border-border text-foreground-subtle hover:text-blue-400 hover:border-blue-500/30 hover:bg-blue-500/10 disabled:opacity-50 transition-colors`,children:[a(b,{className:`h-3 w-3 ${de.isPending?`animate-spin`:``}`}),y(`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 ${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(w,{className:`h-3 w-3`}),y(`addons.addonCard.logs`,`Logs`)]}),!I&&t(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),ce(!0)},className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium border transition-colors ${se?`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(E,{className:`h-3 w-3`}),y(`addons.addonCard.settings`,`Settings`)]}),a(`div`,{className:`flex-1`}),ue&&a(Ze,{packageName:P.packageName,displayName:P.name,selectedNode:v??ct,disabled:g})]}),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:y(`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:y(`addons.addonCard.outdated`)}),e.status===`offline`&&a(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-muted text-muted-foreground`,children:y(`common.offline`)}),e.synced&&e.status!==`offline`&&a(`span`,{className:`text-[9px] text-success`,children:y(`common.synced`)})]},e.nodeId))})]}),oe&&!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:()=>j(`logs`),className:`px-2 py-0.5 transition-colors ${A===`logs`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:y(`addons.addonCard.logs`,`Logs`)}),a(`button`,{type:`button`,onClick:()=>j(`events`),className:`px-2 py-0.5 border-l border-border transition-colors ${A===`events`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:y(`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(x,{className:`h-3.5 w-3.5`})})]}),A===`logs`&&a(ve,{addonId:P.id,maxHeight:`max-h-64`,showFilters:!1}),A===`events`&&a(Se,{addonId:P.id,category:`addon.*`,maxHeight:`max-h-64`})]}),I&&t(u,{children:[a(`button`,{type:`button`,onClick:()=>C(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(S?te:ne,{className:`h-3.5 w-3.5 text-foreground-subtle`})}),S&&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))})]}),se&&!I&&a(q,{open:!0,onOpenChange:e=>!e&&ce(!1),children:t(G,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:[a(we,{children:t(J,{className:`flex items-center gap-2`,children:[a(E,{className:`h-4 w-4 text-primary`}),y(`addons.addonCard.settingsTitle`,{name:L})]})}),t(K,{className:`space-y-4`,children:[a(`div`,{className:`text-[10px] text-foreground-subtle mb-2`,children:y(`addons.addonCard.clusterWideSettingsOneValue`,`Cluster-wide settings — one value for every node. Per-node settings live under Cluster → the node → Settings.`)}),a(Ae,{nodeId:null,addonIds:[P.id],level:`global`,fieldScope:`cluster`,emptyMessage:y(`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(P)&&t(`div`,{children:[a(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:y(`addons.addonCard.deviceExport`,`Device export`)}),a(_e,{addonId:P.id,onOpenDevice:e=>le(`/devices/${e}`)})]}),it(B)&&t(`div`,{children:[a(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:y(`addons.addonCard.autoUpdate`,`Auto-Update`)}),a(st,{addonId:P.id})]}),P.components&&P.components.length>0&&t(`div`,{children:[a(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:y(`addons.addonCard.components`,{count:P.components.length})}),a(`div`,{className:`flex flex-wrap gap-1`,children:P.components.map(e=>a(`span`,{className:`text-[10px] rounded bg-background border border-border px-1.5 py-0.5 text-foreground-subtle font-mono`,children:e},e))})]})]}),a(pe,{children:a(M,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>ce(!1),children:y(`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(m(`/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(C,{className:`w-3.5 h-3.5 animate-spin`}):a(p,{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(C,{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=H({name:e.name}),m=De({name:e.name,version:l}),h=p.data??[],g=et(h),_=yt(h,l,d),v=m.data;return a(q,{open:!0,onOpenChange:e=>!e&&i(),children:t(G,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:[a(we,{children:a(J,{children:c(`addons.installDialog.title`,`Install {{name}}`,{name:vt(e.name)})})}),t(K,{className:`space-y-3`,children:[a(`p`,{className:`font-mono text-[10px] text-foreground-subtle`,children:e.name}),e.description.length>0&&a(`p`,{className:`text-xs text-foreground`,children:e.description}),t(`div`,{className:`space-y-1.5`,children:[a(`span`,{className:`text-[10px] text-foreground-subtle`,children:c(`addons.installDialog.version`,`Version`)}),a(V,{"aria-label":c(`addons.installDialog.version`,`Version`),value:l,options:_.map(e=>({value:e.version,label: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(M,{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(oe,{defaultValue:`readme`,children:[t(A,{children:[a(L,{value:`readme`,children:c(`addons.installDialog.readme`,`README`)}),a(L,{value:`changelog`,children:c(`addons.installDialog.changelog`,`CHANGELOG`)})]}),a(z,{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(z,{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(pe,{children:[a(M,{type:`button`,variant:`outline`,size:`sm`,onClick:i,children:c(`common.cancel`,`Cancel`)}),a(M,{type:`button`,size:`sm`,disabled:n||l.length===0,onClick:()=>o(e.name,l),children:n?a(C,{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}=Te(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(f,{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(O,{variant:`success`,icon:a(g,{className:`h-3 w-3`}),children:e.installedVersion??i(`system.capabilityCatalog.installed`,`Installed`)}):t(M,{size:`sm`,onClick:()=>r(e),disabled:n,className:`shrink-0`,children:[n?a(C,{className:`h-3 w-3 animate-spin`}):a(v,{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}=ge({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(C,{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:p}){let{t:m}=Y(),h=l(),[g,_]=s(``),y=e(g),[x,w]=s(!1),T=n(null);o(()=>{if(!x)return;let e=e=>{T.current&&!T.current.contains(e.target)&&w(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[x]);let{data:E}=se({nodeId:d.id}),te=r(()=>{let e=new Map;for(let t of E??[])e.set(t.name,t.latestVersion);return e},[E]),ne=r(()=>(E??[]).filter(e=>!e.isSystem).length,[E]),[re,D]=s(()=>new Set),[ie,O]=s(()=>new Map),ae=i(e=>{D(t=>new Set(t).add(e))},[]),oe=i(e=>{D(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[]),k=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})},[]),j=N({onMutate:e=>{ae(e.name),A(e.name)},onSuccess:(e,t)=>{oe(t.name);let n=e;if(n&&n.success===!1){k(t.name,n.error??`Update failed (no error message returned by server)`);return}h.invalidateQueries({queryKey:[[`addons`]]}),h.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]})},onError:(e,t)=>{oe(t.name),k(t.name,e instanceof Error?e.message:String(e))}}),M=ze(),le=n(new Set);o(()=>{let e=new Set;for(let[t,n]of M)Le(n)&&e.add(t);let t=[...le.current].some(t=>!e.has(t));le.current=e,t&&(h.invalidateQueries({queryKey:[[`addons`]]}),h.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]}))},[M,h]);let{data:F}=fe(void 0),ue=ye({onSuccess:()=>{h.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),I=P({onSuccess:()=>{h.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),{data:L,isFetching:R}=ge({query:y||void 0},{enabled:x}),z=ce(),{data:V}=Ce(void 0),de=V?.requestedAt,[pe,me]=s(null),[H,U]=s(!1);o(()=>{if(V?.kind===`framework-bulk-update`&&V.requestedAt!==pe){me(V.requestedAt),U(!0);let e=window.setTimeout(()=>U(!1),6e3);return()=>window.clearTimeout(e)}},[de,pe,V]),B();let he=i(async()=>{let e=(E??[]).filter(e=>!e.isSystem);if(e.length!==0){if(!d.isHub){for(let t of e)await j.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]})}},[E,d.id,d.isHub,z,j]),[W,G]=s(null),[_e,K]=s(null),ve=e=>{K(null),G(e)},q=Ee({onSuccess:()=>{G(null),K(null),h.invalidateQueries({queryKey:[[`addons`]]}),h.invalidateQueries({queryKey:[[`addonPages`]]}),h.invalidateQueries({queryKey:[[`capabilities`]]}),h.invalidateQueries({queryKey:[[`integrations`]]})},onError:e=>{K(e instanceof Error?e.message:`Install failed`)}}),[be,Se]=s(`type`),[we,Te]=s(()=>typeof window>`u`?`grouped`:window.localStorage.getItem(`camstack.addons.viewMode`)===`flat`?`flat`:`grouped`),De=e=>{Te(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=we===`flat`?Ie:Lt(Ie),Ve=r(()=>{let e=[...Be];switch(be){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,be]);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:m(`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:m(`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:m(`admin.system.addons.sort`,`Sort:`)}),t(`select`,{value:be,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:m(`admin.system.addons.bundlesFirst`,`Bundles first`)}),a(`option`,{value:`name`,children:m(`admin.system.addons.name`,`Name`)}),a(`option`,{value:`source`,children:m(`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:m(`admin.system.addons.view`,`View:`)}),a(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`grouped`,`flat`].map(e=>a(`button`,{type:`button`,onClick:()=>De(e),className:`px-2 py-1 transition-colors capitalize ${we===e?`bg-primary/10 text-primary`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`}`,title:e===`grouped`?m(`admin.system.addons.groupMultiAddonPackagesInto`,`Group multi-addon packages into a bundle card`):m(`admin.system.addons.showEveryAddonAsIts`,`Show every addon as its own card`),children:e},e))})]}),d.isHub&&t(`div`,{className:`flex items-center gap-1.5`,children:[a(b,{className:`h-3 w-3 text-foreground-subtle`}),a(`span`,{className:`text-[10px] text-foreground-subtle`,children:m(`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:()=>ue.mutate({channel:e}),disabled:ue.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:m(`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(C,{className:`w-3 h-3 animate-spin`}):a(v,{className:`w-3 h-3`}),z.isPending?m(`admin.system.addons.updating`,`Updating…`):m(`admin.system.addons.updateAll`,`Update All ({{nonSystemUpdateCount}})`,{nonSystemUpdateCount:ne})]})]}),t(`div`,{className:`flex flex-wrap items-center gap-1.5`,role:`group`,"aria-label":m(`admin.system.addons.filterInstalledAddons`,`Filter installed addons`),children:[a(`span`,{className:`text-[10px] text-foreground-subtle`,children:m(`admin.system.addons.filter`,`Filter:`)}),[{id:`updatable`,label:m(`admin.system.addons.updatable`,`Updatable`),pressed:ke,toggle:()=>je(!ke)},{id:`error`,label:m(`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:m(`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:T,children:[a(xe,{type:`text`,value:g,onChange:e=>{_(e.target.value),w(!0)},onFocus:()=>w(!0),placeholder:m(`admin.system.addons.searchAddonsOnNpm`,`Search addons on npm...`),"aria-label":m(`admin.system.addons.searchAddonsOnNpm2`,`Search addons on npm`),disabled:z.isPending,leftSlot:a(S,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),rightSlot:R?a(C,{className:`h-3 w-3 animate-spin`}):void 0}),x&&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:m(`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=>ve({name:e.name,version:e.version,description:e.description})},e.name))})]})]}),a(dt,{onUploadSuccess:()=>{h.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:m(`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:m(`admin.system.addons.clear`,`Clear`)})]}),Z&&a(Et,{capability:Z,installing:q.isPending,onInstall:e=>ve({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:m(`admin.system.addons.installed`,`Installed`)}),H&&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(ee,{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:m(`admin.system.addons.bulkUpdateCompleted`,`Bulk update completed`)}),a(`div`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:m(`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(C,{className:`h-3 w-3 animate-spin`}),m(`admin.system.addons.loadingInstalled`,`Loading installed addons…`)]}),p===`error`&&a(`div`,{className:`text-xs text-danger`,children:m(`admin.system.addons.failedToLoadAddons`,`Failed to load addons`)}),p===`ready`&&Ie.length===0&&a(`div`,{className:`text-xs text-foreground-subtle`,children:c.length===0?m(`admin.system.addons.noAddonsInstalled`,`No addons installed`):Z?m(`admin.system.addons.noInstalledAddonDeclaresThe`,`No installed addon declares the "{{capabilityFilter}}" capability. Any addon you can install appears under "Available to install" above.`,{capabilityFilter:Z}):m(`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`&&Ve.map(e=>{let t=$(e)?e.bundle.packageName:e.manifest.packageName,n=te.get(t),r=$(e)?e.representative:e,i=n?e=>j.mutate({name:t,version:e,nodeId:d.id}):void 0,o=M.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)})}),W!==null&&a(xt,{target:W,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}=be(void 0),{nodes:s}=de(),{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:_}=ue({nodeId:p}),v=W(),y=k(),x=v.isPending||y.isPending,S=async()=>{await v.mutateAsync({nodeId:p}),await y.mutateAsync(),r.invalidateQueries({queryKey:[[`addons`]]})},C=n(v);C.current=v;let ee=n(d??`hub`);o(()=>{C.current.mutate({nodeId:ee.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(U,{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 S(),disabled:x,className:`inline-flex items-center gap-1 px-2 py-1 text-[11px] rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,title:e(`admin.system.addons.reFetchAddonsCheckNpm`,`Re-fetch addons + check npm for new versions`),children:[a(b,{className:`w-3 h-3 ${x?`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 S(),listPhase:g?`pending`:_?`error`:`ready`})]})}export{zt as AddonsPage};