@camstack/addon-admin-ui 1.2.655 → 1.2.657

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 (118) hide show
  1. package/CHANGELOG.md +12 -1
  2. package/dist/assets/Addons-Box3Zccu.js +5 -0
  3. package/dist/assets/{AdminPage-aLHp47jf.js → AdminPage-Q2-TrrvF.js} +1 -1
  4. package/dist/assets/{AdminSectionedPage-DC99_NYO.js → AdminSectionedPage-CzrpTekp.js} +1 -1
  5. package/dist/assets/AiProfiles-D-w5C5-l.js +3 -0
  6. package/dist/assets/{BootstrapSettingsForm-DujO7xd3.js → BootstrapSettingsForm-5uFD2Kof.js} +1 -1
  7. package/dist/assets/Build-qZQh3hjA.js +40 -0
  8. package/dist/assets/{Calendars-B21A2j3J.js → Calendars-DTutQb1E.js} +1 -1
  9. package/dist/assets/{CameraGrids-CXNpT_B8.js → CameraGrids-CUWb60X0.js} +1 -1
  10. package/dist/assets/Cluster-BJAuetBc.js +1 -0
  11. package/dist/assets/CompositionBlockEditor-BIhcgdoy.js +2 -0
  12. package/dist/assets/{CompositionEditorPage-D4mYMm-K.js → CompositionEditorPage-BiVpjRJl.js} +1 -1
  13. package/dist/assets/Data-BXhy6eL_.js +2 -0
  14. package/dist/assets/DeviceDetail-DdYnzePf.js +2 -0
  15. package/dist/assets/{Devices-DcZIXngR.js → Devices-B_bfY38s.js} +1 -1
  16. package/dist/assets/{EmbedDevicePage-NUKM9Y94.js → EmbedDevicePage-Cla-SVQD.js} +1 -1
  17. package/dist/assets/{EmbedPlayerPage-CzDEkeN3.js → EmbedPlayerPage-Xu57zxFg.js} +1 -1
  18. package/dist/assets/History-DD6D7Dcs.js +1 -0
  19. package/dist/assets/Identity-BeB3iubj.js +1 -0
  20. package/dist/assets/InstancesTable-8uEgcvVT.js +1 -0
  21. package/dist/assets/IntegrationDetail-BiOcgnb_.js +1 -0
  22. package/dist/assets/IntegrationWizard-5b0NkY3q.js +1 -0
  23. package/dist/assets/Integrations-BYkq5Tnd.js +1 -0
  24. package/dist/assets/{Integrations-B0sKe_MX.js → Integrations-DDXj6LGa.js} +2 -2
  25. package/dist/assets/Library-C4HdgygP.js +1 -0
  26. package/dist/assets/Locations-0P70Sc0f.js +3 -0
  27. package/dist/assets/{Logs-DyUEl7-W.js → Logs-Cyf77THP.js} +1 -1
  28. package/dist/assets/{MaskShapeCanvas-D4W6rB-U.js → MaskShapeCanvas-Bhery5rL.js} +1 -1
  29. package/dist/assets/{MotionZonesSettings-CI3yCbis.js → MotionZonesSettings-fls_8Lz_.js} +1 -1
  30. package/dist/assets/MyAccess-Bdg6M_F2.js +2 -0
  31. package/dist/assets/Network--k6YX0uT.js +1 -0
  32. package/dist/assets/{NodeAddonsSettingsPanel-DyAkVlR3.js → NodeAddonsSettingsPanel-Dw5WZxWi.js} +2 -2
  33. package/dist/assets/Notifications-CfesJVtl.js +1 -0
  34. package/dist/assets/Pipeline-Cxfq3bsX.js +1 -0
  35. package/dist/assets/{PrivacyMaskSettings-C4UU_fXQ.js → PrivacyMaskSettings-PI4833pX.js} +1 -1
  36. package/dist/assets/Recordings-Bz1UQb_D.js +1 -0
  37. package/dist/assets/{RemoteGrid-Bsj2x0GN.js → RemoteGrid-Dn8HJQJ3.js} +1 -1
  38. package/dist/assets/{ScanSubnetEditor-83bxeuIV.js → ScanSubnetEditor-Cvg2WXEI.js} +1 -1
  39. package/dist/assets/{SceneMonitorEditor-OVXtamOi.js → SceneMonitorEditor-BZZ1tdKf.js} +1 -1
  40. package/dist/assets/SessionsList-ByWStI3D.js +2 -0
  41. package/dist/assets/{Showroom-JytwI7ts.js → Showroom-BVvEli5J.js} +1 -1
  42. package/dist/assets/StorageLocationsTable-CFaMMEmA.js +1 -0
  43. package/dist/assets/System-BMSl-son.js +1 -0
  44. package/dist/assets/{Templates-Cu0Zx0WB.js → Templates-BNH1PKWe.js} +1 -1
  45. package/dist/assets/{Terminal-D2wG4YSv.js → Terminal-D-YiG_GF.js} +3 -3
  46. package/dist/assets/{TrainingProviders-BKBWflor.js → TrainingProviders-B05YjzG6.js} +1 -1
  47. package/dist/assets/{Viewer-rKCQt8Pi.js → Viewer-CZf7qfrj.js} +1 -1
  48. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-rv5WZowx.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-GHnft27q.js} +1 -1
  49. package/dist/assets/{action-draft-BpL552GS.js → action-draft-Bb_X9uYG.js} +1 -1
  50. package/dist/assets/{assignment-candidates-BK42JAzD.js → assignment-candidates-DoS5Oo9-.js} +1 -1
  51. package/dist/assets/{authed-media-CdfUt51r.js → authed-media-1DN21xGd.js} +1 -1
  52. package/dist/assets/client-pLjIfKNS.js +1115 -0
  53. package/dist/assets/{command-vocab-B_sqDpAc.js → command-vocab-NMgNFbpU.js} +1 -1
  54. package/dist/assets/create-composition-51F9Gq1x.js +1 -0
  55. package/dist/assets/device-detail-BYVgg4Sb.js +1 -0
  56. package/dist/assets/{device-integration-icon-BLg5i-Lj.js → device-integration-icon-C2zPAE71.js} +1 -1
  57. package/dist/assets/device-picker-model-BzsLEmb0.js +1 -0
  58. package/dist/assets/dist-BnTBW9NE.js +1115 -0
  59. package/dist/assets/{dist-BonRqxy_.js → dist-CuuA5imx.js} +1 -1
  60. package/dist/assets/{hostInit-Bgo3XaDt.js → hostInit-7x1ImdlS.js} +1 -1
  61. package/dist/assets/icons-BRDBUY0_.js +1 -0
  62. package/dist/assets/index-BV01fYDf.js +4 -0
  63. package/dist/assets/{linked-devices-model-4oBb-ZIa.js → linked-devices-model-CuRYYWQ_.js} +1 -1
  64. package/dist/assets/{mf-entry-bootstrap-0-b3c36c58.js → mf-entry-bootstrap-0-43e13f36.js} +2 -2
  65. package/dist/assets/mount-BzsLEmb0.js +1 -0
  66. package/dist/assets/player-overlays-DuG5kk5Q.js +1 -0
  67. package/dist/assets/remoteEntry-np1Yaemy.js +1 -0
  68. package/dist/assets/src-DOkmPL4F.js +263 -0
  69. package/dist/assets/{step-inspector-model-CQ4ZhPOo.js → step-inspector-model-fxfNSZXN.js} +1 -1
  70. package/dist/assets/{use-scenes-feed-DZp1AHrK.js → use-scenes-feed-DocR9cuP.js} +1 -1
  71. package/dist/assets/{use-stationary-objects-B_EMLFx7.js → use-stationary-objects-Dss1BqcD.js} +1 -1
  72. package/dist/assets/{useAdminDeviceRemoval-BGavriCa.js → useAdminDeviceRemoval-60EAneS8.js} +1 -1
  73. package/dist/assets/useEventInvalidation-BzsLEmb0.js +1 -0
  74. package/dist/assets/{useNodeUrlSelection-DnHxOtlP.js → useNodeUrlSelection-lmVrEsaf.js} +1 -1
  75. package/dist/assets/useTemplateSave-Bsglwi-7.js +1 -0
  76. package/dist/assets/{user-x-CWkN-ZKP.js → user-x-BcmVBo8D.js} +1 -1
  77. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-922VMW57.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-Cwr9lrJE.js} +2 -2
  78. package/dist/index.html +6 -6
  79. package/dist/server/addon.js +82 -14
  80. package/package.json +2 -2
  81. package/dist/assets/Addons-DyJCfk3K.js +0 -5
  82. package/dist/assets/AiProfiles-7TjJU7gH.js +0 -3
  83. package/dist/assets/Build-5EPZNJc_.js +0 -40
  84. package/dist/assets/Cluster-DpgPRLih.js +0 -1
  85. package/dist/assets/CompositionBlockEditor-GDw9wpyC.js +0 -2
  86. package/dist/assets/Data-BTlEa5yB.js +0 -2
  87. package/dist/assets/DeviceDetail-CNtpEA24.js +0 -2
  88. package/dist/assets/History-Co3N1ECB.js +0 -1
  89. package/dist/assets/Identity-Cb_y_j4v.js +0 -1
  90. package/dist/assets/InstancesTable-DZHp204O.js +0 -1
  91. package/dist/assets/IntegrationDetail-oeZTeQnA.js +0 -1
  92. package/dist/assets/IntegrationWizard-BZ2-i83L.js +0 -1
  93. package/dist/assets/Integrations-D9FcrJXz.js +0 -1
  94. package/dist/assets/Library-BqYimbZR.js +0 -1
  95. package/dist/assets/Locations-9q72GJxA.js +0 -3
  96. package/dist/assets/MyAccess-CCWVg8X1.js +0 -2
  97. package/dist/assets/Network-ChHr4jPK.js +0 -1
  98. package/dist/assets/Notifications-CxxZDBll.js +0 -1
  99. package/dist/assets/Pipeline-Bsh224Sd.js +0 -1
  100. package/dist/assets/Recordings-DEvP3Bfl.js +0 -1
  101. package/dist/assets/SessionsList-DPfHCju_.js +0 -2
  102. package/dist/assets/StorageLocationsTable-D0-iwXJt.js +0 -1
  103. package/dist/assets/System-CfB4TfTX.js +0 -1
  104. package/dist/assets/circle-arrow-up-5n0C9Hkd.js +0 -1
  105. package/dist/assets/client-BD4NsqEN.js +0 -1115
  106. package/dist/assets/create-composition-CtkD_L5c.js +0 -1
  107. package/dist/assets/device-detail-DNqKt0La.js +0 -1
  108. package/dist/assets/device-picker-model-Du6UAsiy.js +0 -1
  109. package/dist/assets/dist-BK12oHz3.js +0 -1115
  110. package/dist/assets/icons-BiHuBwzY.js +0 -1
  111. package/dist/assets/index-C_D8eRsf.js +0 -4
  112. package/dist/assets/mount-Du6UAsiy.js +0 -1
  113. package/dist/assets/player-overlays-Bs9A8fez.js +0 -1
  114. package/dist/assets/remoteEntry-BFByx-0h.js +0 -1
  115. package/dist/assets/src-CNcEcLrI.js +0 -263
  116. package/dist/assets/useEventInvalidation-Du6UAsiy.js +0 -1
  117. package/dist/assets/useTemplateSave-CT5IvdL4.js +0 -1
  118. package/dist/assets/user-round-CXEgJIXU.js +0 -1
@@ -55667,6 +55667,15 @@ var HeroTextSchema = object({
55667
55667
  it: string()
55668
55668
  });
55669
55669
  /**
55670
+ * What a device that has not reported says in place of its value: an empty "—",
55671
+ * never a word like "Unknown" and never a 0 (D393). The card stays its normal
55672
+ * self; only the value is empty.
55673
+ */
55674
+ var NOT_REPORTED = {
55675
+ en: "—",
55676
+ it: "—"
55677
+ };
55678
+ /**
55670
55679
  * The ONE measurement a simple sensor shows (card wave, phase 1).
55671
55680
  *
55672
55681
  * A sensor that measures a single quantity (a temperature, a humidity, a power,
@@ -55783,6 +55792,62 @@ function textMeasurement(text, since) {
55783
55792
  historyKey: null
55784
55793
  };
55785
55794
  }
55795
+ /** What each quantity draws beside its value, reported or not. */
55796
+ var QUANTITY_FACE = {
55797
+ temperature: {
55798
+ icon: "thermometer",
55799
+ unit: "°C",
55800
+ sinceKind: "updated",
55801
+ historyKey: "cap:temperature-sensor.temperature"
55802
+ },
55803
+ humidity: {
55804
+ icon: "droplets",
55805
+ unit: "%",
55806
+ sinceKind: "updated",
55807
+ historyKey: "cap:humidity-sensor.humidity"
55808
+ },
55809
+ power: {
55810
+ icon: "zap",
55811
+ unit: "W",
55812
+ sinceKind: "updated",
55813
+ historyKey: "cap:power-meter.power"
55814
+ },
55815
+ contact: {
55816
+ icon: null,
55817
+ unit: null,
55818
+ sinceKind: "changed",
55819
+ historyKey: null
55820
+ },
55821
+ text: {
55822
+ icon: null,
55823
+ unit: null,
55824
+ sinceKind: "updated",
55825
+ historyKey: null
55826
+ }
55827
+ };
55828
+ /**
55829
+ * The measurement of a sensor that has not reported yet: its normal card with
55830
+ * an empty "—" value and its unit — never a placeholder, never a 0 (D393). The
55831
+ * reading is `null` (nothing to format), the scene does not move, and nothing
55832
+ * claims a moment.
55833
+ */
55834
+ function emptyMeasurement(quantity) {
55835
+ const face = QUANTITY_FACE[quantity];
55836
+ return {
55837
+ quantity,
55838
+ reading: null,
55839
+ icon: face.icon,
55840
+ value: NOT_REPORTED,
55841
+ unit: face.unit,
55842
+ band: null,
55843
+ level: null,
55844
+ word: NOT_REPORTED,
55845
+ tone: "muted",
55846
+ since: null,
55847
+ sinceKind: face.sinceKind,
55848
+ historyKey: face.historyKey
55849
+ };
55850
+ }
55786
55851
  /** The scene as the model carries it. `null` = the device did not say (never a guess). */
55787
55852
  var HeroSceneSchema = object({
55788
55853
  id: _enum([
@@ -78847,7 +78912,7 @@ var lockContribution = contribution("lock-control", LockControlStatusSchema, (sl
78847
78912
  const state = slice?.state ?? null;
78848
78913
  const words = state === null ? null : LOCK_WORDS[state];
78849
78914
  const since = slice === void 0 ? null : elapsedText(slice.lastChangedAt, ctx.now);
78850
- const title = words?.title ?? t("Unknown", "Sconosciuto");
78915
+ const title = words?.title ?? NOT_REPORTED;
78851
78916
  return {
78852
78917
  reading: reading("lock-control", words?.state ?? "unknown", false, words?.title),
78853
78918
  rows: [row$1("lock", state === "locked" || state === "locking" ? "lock" : "lock-open", joinText([title, since]), lockControls(state, ctx.features.includes(DeviceFeature.LockOpen)))],
@@ -78939,7 +79004,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
78939
79004
  const modes = slice === void 0 ? ALARM_MODES : slice.availableModes;
78940
79005
  return {
78941
79006
  reading: reading("alarm-panel", words?.state ?? "unknown", false, words?.title),
78942
- rows: [row$1("alarm", state === "triggered" ? "shield-alert" : state === "disarmed" ? "shield-off" : "shield-check", joinText([words?.title ?? t("Unknown", "Sconosciuto"), since]), alarmControls(state, modes, slice?.requiresCode ?? false))],
79007
+ rows: [row$1("alarm", state === "triggered" ? "shield-alert" : state === "disarmed" ? "shield-off" : "shield-check", joinText([words?.title ?? NOT_REPORTED, since]), alarmControls(state, modes, slice?.requiresCode ?? false))],
78943
79008
  ...since === null || words === null ? {} : { facts: [fact("since", "clock", since, state === "triggered" ? "danger" : "muted")] },
78944
79009
  ...words === null ? {} : { tiles: {
78945
79010
  left: [{
@@ -78970,7 +79035,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
78970
79035
  return {
78971
79036
  reading: reading("automation-control", state, false, title),
78972
79037
  rows: [row$1("automation", "workflow", joinText([
78973
- title ?? t("Unknown", "Sconosciuto"),
79038
+ title ?? NOT_REPORTED,
78974
79039
  last === null ? null : t(`Ran ${last.en}`, `Eseguita ${last.it}`),
78975
79040
  slice?.lastError == null ? null : t(slice.lastError, slice.lastError)
78976
79041
  ]), [asAction(run), toggle])],
@@ -78986,7 +79051,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
78986
79051
  return {
78987
79052
  reading: reading("script-runner", state, false, title),
78988
79053
  rows: [row$1("script", "scroll-text", joinText([
78989
- title ?? t("Unknown", "Sconosciuto"),
79054
+ title ?? NOT_REPORTED,
78990
79055
  last === null ? null : t(`Ran ${last.en}`, `Eseguito ${last.it}`),
78991
79056
  slice?.lastError == null ? null : t(slice.lastError, slice.lastError)
78992
79057
  ]), [asAction(control)])],
@@ -78995,7 +79060,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
78995
79060
  }),
78996
79061
  "do-not-disturb": contribution("do-not-disturb", DoNotDisturbStatusSchema, (slice) => {
78997
79062
  const on = slice?.enabled ?? null;
78998
- return { rows: [row$1("do-not-disturb", "bell-off", on === null ? t("Unknown", "Sconosciuto") : on ? t("Do not disturb on", "Non disturbare attivo") : t("Do not disturb off", "Non disturbare spento"), [{
79063
+ return { rows: [row$1("do-not-disturb", "bell-off", on === null ? NOT_REPORTED : on ? t("Do not disturb on", "Non disturbare attivo") : t("Do not disturb off", "Non disturbare spento"), [{
78999
79064
  kind: "toggle",
79000
79065
  id: "do-not-disturb.toggle",
79001
79066
  label: t("Do not disturb", "Non disturbare"),
@@ -79013,7 +79078,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
79013
79078
  * is absent from the facts, never a zero (D393).
79014
79079
  */
79015
79080
  var has$3 = (ctx, f) => ctx.features.includes(f);
79016
- var unknownText = t("Unknown", "Sconosciuto");
79081
+ var unknownText = NOT_REPORTED;
79017
79082
  var pct$2 = (n) => t(`${Math.round(n)}%`, `${Math.round(n)}%`);
79018
79083
  var unit = (n) => Math.min(1, Math.max(0, n / 100));
79019
79084
  /** Battery as a fact, unless the device is also bound to the `battery` cap (it already says so). */
@@ -80419,13 +80484,13 @@ function sensorFragment(value, id, icon, en, it, text) {
80419
80484
  tiles: { right: [tile$1(en, it, text)] }
80420
80485
  };
80421
80486
  }
80422
- var temperatureContribution = contribution("temperature-sensor", TemperatureSensorStatusSchema, (slice) => measured(sensorFragment(slice?.temperature ?? null, "temperature", "thermometer", "Temperature", "Temperatura", formatDegrees(slice?.temperature ?? 0)), slice?.temperature == null ? void 0 : temperatureMeasurement(slice.temperature, slice.lastFetchedAt)));
80423
- var humidityContribution = contribution("humidity-sensor", HumiditySensorStatusSchema, (slice) => measured(sensorFragment(slice?.humidity ?? null, "humidity", "droplets", "Humidity", "Umidità", `${Math.round(slice?.humidity ?? 0)}%`), slice?.humidity == null ? void 0 : humidityMeasurement(slice.humidity, slice.lastFetchedAt)));
80487
+ var temperatureContribution = contribution("temperature-sensor", TemperatureSensorStatusSchema, (slice) => measured(sensorFragment(slice?.temperature ?? null, "temperature", "thermometer", "Temperature", "Temperatura", formatDegrees(slice?.temperature ?? 0)), slice?.temperature == null ? emptyMeasurement("temperature") : temperatureMeasurement(slice.temperature, slice.lastFetchedAt)));
80488
+ var humidityContribution = contribution("humidity-sensor", HumiditySensorStatusSchema, (slice) => measured(sensorFragment(slice?.humidity ?? null, "humidity", "droplets", "Humidity", "Umidità", `${Math.round(slice?.humidity ?? 0)}%`), slice?.humidity == null ? emptyMeasurement("humidity") : humidityMeasurement(slice.humidity, slice.lastFetchedAt)));
80424
80489
  var pressureContribution = contribution("pressure-sensor", PressureSensorStatusSchema, (slice) => sensorFragment(slice?.pressure ?? null, "pressure", "gauge", "Pressure", "Pressione", `${Math.round(slice?.pressure ?? 0)} hPa`));
80425
80490
  var illuminanceContribution = contribution("ambient-light-sensor", AmbientLightSensorStatusSchema, (slice) => sensorFragment(slice?.illuminance ?? null, "illuminance", "sun", "Light", "Luce", `${Math.round(slice?.illuminance ?? 0)} lx`));
80426
80491
  var numericContribution = contribution("numeric-sensor", NumericSensorStatusSchema, (slice) => sensorFragment(slice?.value ?? null, "reading", "gauge", "Value", "Valore", String(Number((slice?.value ?? 0).toFixed(2)))));
80427
80492
  var enumContribution = contribution("enum-sensor", EnumSensorStatusSchema, (slice) => {
80428
- if (slice === void 0 || slice.value === "") return { reading: reading("sensor", "unknown") };
80493
+ if (slice === void 0 || slice.value === "") return measured({ reading: reading("sensor", "unknown") }, emptyMeasurement("text"));
80429
80494
  if (slice.timestamp === true) return { reading: reading("sensor", "on") };
80430
80495
  return measured(sensorFragment(slice.value, "reading", "gauge", "State", "Stato", slice.value), textMeasurement(slice.value, slice.lastFetchedAt));
80431
80496
  });
@@ -80549,7 +80614,7 @@ function circuitControl(circuit) {
80549
80614
  return picker(`heat-pump.${circuit.id}.mode`, t("Mode", "Modalità"), circuit.operationMode, method, args);
80550
80615
  }
80551
80616
  /** A circuit with no reading is still a row: it shows that nothing is known, not nothing. */
80552
- var UNKNOWN_STATUS = same("—");
80617
+ var UNKNOWN_STATUS = NOT_REPORTED;
80553
80618
  function circuitRow(circuit) {
80554
80619
  const control = circuitControl(circuit);
80555
80620
  const status = thermalStatusText(circuit.targetTemp, circuit.currentTemp) ?? UNKNOWN_STATUS;
@@ -80773,9 +80838,8 @@ function look(icon, tone, background, animation) {
80773
80838
  animation
80774
80839
  };
80775
80840
  }
80776
- /** A state a device is in whatever it is: unreachable, or silent. Identical for every look. */
80841
+ /** Unreachable: identical for every look. */
80777
80842
  var OFFLINE = look("wifi-off", "muted", "plain", "none");
80778
- var UNKNOWN = look("circle-question-mark", "muted", "plain", "none");
80779
80843
  var ALERT = look("triangle-alert", "danger", "alert-wash", "pulse");
80780
80844
  function lookOf(spec) {
80781
80845
  const at = (s) => look(spec.icon, s[0], s[1], s[2]);
@@ -80787,7 +80851,7 @@ function lookOf(spec) {
80787
80851
  standby: at(spec.standby),
80788
80852
  alert: spec.alert ?? ALERT,
80789
80853
  offline: OFFLINE,
80790
- unknown: UNKNOWN
80854
+ unknown: look(spec.icon, "muted", "plain", "none")
80791
80855
  };
80792
80856
  }
80793
80857
  var MUTED = [
@@ -91852,6 +91916,10 @@ function offered(received) {
91852
91916
  };
91853
91917
  }
91854
91918
  offered(HA_AS), withheld(HOMEKIT_REASON), withheld(ALEXA_REASON), withheld(GOOGLE_REASON), withheld(MATTER_REASON);
91919
+ DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Climate, DeviceType.HeatPump, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway;
91920
+ DeviceRole.Siren, DeviceRole.Floodlight, DeviceRole.Spotlight, DeviceRole.PirSensor, DeviceRole.Chime, DeviceRole.Autotrack, DeviceRole.Nightvision, DeviceRole.PrivacyMask, DeviceRole.Doorbell, DeviceRole.CoverBlind, DeviceRole.CoverShutter, DeviceRole.CoverAwning, DeviceRole.CoverCurtain, DeviceRole.CoverGarage, DeviceRole.CoverGate, DeviceRole.CoverDoor, DeviceRole.CoverWindow, DeviceRole.BinaryHelper, DeviceRole.Outlet, DeviceRole.SwitchHeater, DeviceRole.SwitchFan, DeviceRole.SwitchLight, DeviceRole.ClimateAc, DeviceRole.ClimateThermostat, DeviceRole.ClimateFloor, DeviceRole.ClimateRadiator, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit, DeviceRole.MotionSensor, DeviceRole.ContactSensor, DeviceRole.LeakSensor, DeviceRole.SmokeSensor, DeviceRole.COSensor, DeviceRole.GasSensor, DeviceRole.TamperSensor, DeviceRole.VibrationSensor, DeviceRole.ConnectivitySensor, DeviceRole.SoundSensor, DeviceRole.BinarySensor, DeviceRole.TemperatureSensor, DeviceRole.HumiditySensor, DeviceRole.AmbientLightSensor, DeviceRole.PressureSensor, DeviceRole.WindSensor, DeviceRole.RainSensor, DeviceRole.UvSensor, DeviceRole.SolarRadiationSensor, DeviceRole.SoilMoistureSensor, DeviceRole.PowerSensor, DeviceRole.EnergySensor, DeviceRole.VoltageSensor, DeviceRole.CurrentSensor, DeviceRole.AirQualitySensor, DeviceRole.BatterySensor, DeviceRole.NumericSensor, DeviceRole.EnumSensor, DeviceRole.DateTimeSensor, DeviceRole.GenericSensor, DeviceRole.NumericControl, DeviceRole.SelectControl, DeviceRole.TextControl, DeviceRole.DateTimeControl, DeviceRole.MobilePushNotifier, DeviceRole.MessagingNotifier, DeviceRole.EmailNotifier, DeviceRole.GenericNotifier, DeviceRole.IrTransmitter;
91921
+ new Set(Object.values(DeviceType));
91922
+ new Set(Object.values(DeviceRole));
91855
91923
  Object.freeze({
91856
91924
  "accessories.getStatus": [{
91857
91925
  name: "deviceId",
@@ -96339,7 +96407,7 @@ var AdminUIAddon = class extends BaseAddon {
96339
96407
  capability: adminUiCapability,
96340
96408
  provider: {
96341
96409
  getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
96342
- getVersion: async () => ({ version: "1.2.655" })
96410
+ getVersion: async () => ({ version: "1.2.657" })
96343
96411
  }
96344
96412
  }];
96345
96413
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-admin-ui",
3
- "version": "1.2.655",
3
+ "version": "1.2.657",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Admin UI — Vite frontend build and server-side addon",
@@ -50,7 +50,7 @@
50
50
  }
51
51
  ],
52
52
  "requires": {
53
- "server": ">=1.2.852"
53
+ "server": ">=1.2.854"
54
54
  }
55
55
  },
56
56
  "scripts": {
@@ -1,5 +0,0 @@
1
- import{B as e,C as t,J as n,K as r,R as i,S as a,V as o,Y as s,et as c,o as l,x as u}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Ai as d,Fn as f,Gi as p,Ht as m,In as h,Ji as g,Jt as _,Mn as v,Q as y,Qt as b,Ri as x,St as S,Wn as C,Yn as w,ct as T,jr as E,lr as ee,mi as te,ot as ne,ut as D,xn as O}from"./player-overlays-Bs9A8fez.js";import{uc as k}from"./client-BD4NsqEN.js";import{t as re}from"./chevron-down-CBb-F8DT.js";import{d as A,i as ie}from"./terminal-BSZfUawf.js";import{$i as ae,Bc as oe,Gr as se,Jd as ce,Kr as le,Ks as ue,Qi as de,Rf as j,Tn as fe,Vf as M,Xi as N,Xr as pe,Yi as P,Yr as me,Zi as F,Zr as he,_a as ge,_r as I,aa as _e,ca as L,cr as R,da as ve,dr as z,ea as B,fa as V,ff as ye,ga as be,ha as H,ia as U,if as W,it as xe,lr as G,mt as Se,na as Ce,oa as we,pa as Te,qi as Ee,qr as De,sa as Oe,ta as ke,ua as K,ur as Ae,wn as je}from"./src-CNcEcLrI.js";import{t as q}from"./useTranslation-BJr-n0es.js";import"./mount-Du6UAsiy.js";import{Kr as Me,Qr as Ne,Xr as Pe}from"./index-C_D8eRsf.js";import{t as Fe}from"./AdminPage-aLHp47jf.js";import{i as Ie,r as Le,t as Re}from"./addon-kind-filter-CEGKkC1O.js";import{n as J,t as ze}from"./framework-packages-B0ugw-Ay.js";import{t as Y}from"./NodeAddonsSettingsPanel-DyAkVlR3.js";import{n as X,r as Be,t as Ve}from"./useNodeUrlSelection-DnHxOtlP.js";function He(e){if(e===void 0)return null;switch(e.state){case`failed`:case`refused`:case`missing`:case`crashed`:return{kind:e.state,...e.reason===void 0?{}:{reason:e.reason}};default:return null}}c();var Ue={queued:{icon:d,bg:`bg-muted text-foreground-subtle`,labelKey:`addons.addonRowBadge.queued`},updating:{icon:E,bg:`bg-primary/10 text-primary`,labelKey:`addons.addonRowBadge.updating`,spin:!0},"done-pending-restart":{icon:C,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:ie,bg:`bg-danger/10 text-danger`,labelKey:`addons.addonRowBadge.failed`}};function Z({item:e}){let{t:n}=q(),r=Ue[e.status],i=r.icon;return t(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded ${r.bg}`,title:e.error,children:[a(i,{className:`w-2.5 h-2.5 ${r.spin?`animate-spin`:``}`}),n(r.labelKey)]})}var Q=new Set([`completed`,`failed`,`partially-failed`,`cancelled`]),We=new Set([`done`,`failed`,`skipped`]);function Ge(e){return!We.has(e.phase)&&!Q.has(e.jobState)}function Ke(e,t){let n=new Map,r=[...e].sort((e,t)=>e.createdAtMs-t.createdAtMs);for(let e of r){let r=Q.has(e.state);for(let i of e.tasks)r&&i.finishedAtMs!==null&&t-i.finishedAtMs>6e4||n.set(i.packageName,{jobId:e.jobId,packageName:i.packageName,phase:i.phase,fromVersion:i.fromVersion,toVersion:i.toVersion,error:i.error,jobState:e.state,finishedAtMs:i.finishedAtMs})}return n}function qe(){let{data:e}=_e({activeOnly:!0},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data?.length??0)>0?3e3:!1}),{map:t}=M(k.AddonsJobProgress,e=>e.job.jobId);return r(()=>{let n=new Map;for(let t of e??[])n.set(t.jobId,t);for(let[e,r]of t)n.set(e,r.job);return Ke([...n.values()],Date.now())},[e,t])}var Je={queued:{icon:d,cls:`bg-muted text-foreground-subtle`,labelKey:`addons.jobProgress.queued`},fetching:{icon:E,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.fetching`,spin:!0},staged:{icon:E,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.staged`,spin:!0},validating:{icon:E,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.validating`,spin:!0},applying:{icon:E,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.applying`,spin:!0},restarting:{icon:E,cls:`bg-amber-500/10 text-amber-600 dark:text-amber-400`,labelKey:`addons.jobProgress.restarting`,spin:!0},applied:{icon:E,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:ie,cls:`bg-danger/10 text-danger`,labelKey:`addons.jobProgress.failed`},skipped:{icon:O,cls:`bg-muted text-foreground-subtle`,labelKey:`addons.jobProgress.skipped`}};function Ye({progress:e}){let{t:n}=q(),r=Je[e.phase],i=r.icon,o=e.error??`${e.packageName}: ${e.fromVersion??`?`} → ${e.toVersion}`;return t(`span`,{"data-testid":`addon-job-progress`,className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded shrink-0 ${r.cls}`,title:o,children:[a(i,{className:`w-2.5 h-2.5 ${r.spin?`animate-spin`:``}`}),n(r.labelKey),t(`span`,{className:`font-mono`,children:[`→ `,e.toVersion]})]})}function Xe(e,t){return e.filter(e=>e.packageName===t).slice().sort((e,t)=>e.isHub===t.isHub?e.nodeName.localeCompare(t.nodeName):e.isHub?-1:1)}function Ze(e){let t=e.version===null?``:` ${e.version}`,n=e.isOnline?``:` (offline: removed when it reconnects)`;return`- ${e.nodeName}${t}${n}`}function Qe(e,t,n){let r=[`${e} will be uninstalled from ${t.length} node(s). Its runners stop, its capabilities are deregistered and its code is deleted:`,...t.map(Ze)];return n.length>0&&r.push(`Could not ask: ${n.join(`, `)} — not included.`),r.push(`This cannot be undone.`),r.join(`
2
- `)}function $e(e,t,n){let r=[`${e} will be uninstalled from ${t}: its runners stop and its code is deleted.`];return n.length>0&&r.push(`It stays installed on: ${n.map(e=>e.nodeName).join(`, `)}. Use "Everywhere" to remove it from every node.`),r.push(`This cannot be undone.`),r.join(`
3
- `)}var et={uninstalled:`uninstalled`,"not-installed":`was not installed`,refused:`REFUSED`,failed:`FAILED`,"pending-reconnect":`offline — removed when it reconnects`};function tt(e,t){let n=[];for(let r of e.results){let e=r.runnersStopped.length>0?` (stopped ${r.runnersStopped.join(`, `)})`:``;n.push(`${t(r.nodeId)}: ${et[r.outcome]}${e}`),r.error!==void 0&&n.push(` ${r.error}`);for(let e of r.warnings)n.push(` ${e}`)}return n.join(`
4
- `)}var nt={},rt=3e4,it=`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border border-border text-foreground-subtle hover:text-red-400 hover:border-red-500/30 hover:bg-red-500/10 disabled:opacity-50 transition-colors`;function at({packageName:e,displayName:n,selectedNode:r,hideNodeAction:i,disabled:o}){let{t:s}=q(),c=l(),u=T(),d=ne(),f=U(nt,{staleTime:rt}),p=f.data?.installations??[],m=(f.data?.unreachable??[]).map(e=>e.nodeId),h=Xe(p,e),g=e=>h.find(t=>t.nodeId===e)?.nodeName??(e===r.id?r.name:e),_=be({onSettled:()=>{c.invalidateQueries({queryKey:[[`addons`]]}),c.invalidateQueries({queryKey:[[`addonPages`]]}),c.invalidateQueries({queryKey:[[`capabilities`]]}),c.invalidateQueries({queryKey:[[`nodes`]]})}}),v=async e=>{await d({title:e.success?s(`addons.addonUninstallControls.uninstalled`,`{{displayName}} uninstalled`,{displayName:n}):s(`addons.addonUninstallControls.notEveryNodeWasCleaned`,`{{displayName}}: not every node was cleaned`,{displayName:n}),message:tt(e,g),variant:e.success?`default`:`danger`})},y=async t=>{try{await v(await _.mutateAsync({packageName:e,...t}))}catch(e){await d({title:s(`addons.addonUninstallControls.uninstallFailed`,`Uninstall {{displayName}} failed`,{displayName:n}),message:e instanceof Error?e.message:String(e),variant:`danger`})}},x=async()=>{let e=h.filter(e=>e.nodeId!==r.id);await u({title:s(`addons.addonUninstallControls.uninstallFrom`,`Uninstall {{displayName}} from {{name}}?`,{displayName:n,name:r.name}),message:$e(n,r.name,e),confirmLabel:s(`addons.addonUninstallControls.uninstall`,`Uninstall`),variant:`danger`})&&await y(r.isHub?{}:{nodeId:r.id})},S=async()=>{let t=(await f.refetch()).data;if(t===void 0){await d({title:s(`addons.addonUninstallControls.cannotListTheNodes`,`Cannot list the nodes`),message:s(`addons.addonUninstallControls.theHubDidNotAnswer`,`The hub did not answer which nodes have this package — nothing was removed.`),variant:`danger`});return}let r=Xe(t.installations,e);await u({title:s(`addons.addonUninstallControls.uninstallEverywhere`,`Uninstall {{displayName}} everywhere?`,{displayName:n}),message:Qe(n,r,t.unreachable.map(e=>e.nodeId)),confirmLabel:s(`addons.addonUninstallControls.uninstallFromNodeS`,`Uninstall from {{length}} node(s)`,{length:r.length}),variant:`danger`})&&await y({everywhere:!0})},C=_.isPending||o===!0;return t(`div`,{className:`flex items-center gap-1.5`,children:[i!==!0&&t(W,{variant:`unstyled`,type:`button`,onClick:e=>{e.stopPropagation(),x()},disabled:C,className:it,title:s(`addons.addonUninstallControls.uninstallFrom2`,`Uninstall from {{name}}`,{name:r.name}),children:[a(b,{className:`h-3 w-3`}),_.isPending?s(`addons.addonUninstallControls.removing`,`Removing...`):s(`addons.addonUninstallControls.uninstall`,`Uninstall`)]}),(h.length>1||i===!0||m.length>0)&&t(W,{variant:`unstyled`,type:`button`,onClick:e=>{e.stopPropagation(),S()},disabled:C,className:it,title:s(`addons.addonUninstallControls.uninstallFromEveryNodeThat`,`Uninstall from every node that has it`),children:[a(A,{className:`h-3 w-3`}),h.length>0?s(`addons.uninstallControls.everywhereCount`,{count:h.length}):s(`addons.uninstallControls.everywhere`)]})]})}function ot(e){return typeof e.deprecated==`string`&&e.deprecated.length>0}function st(e,t){return t?e:e.filter(e=>e.distTags.includes(`latest`)||!ot(e))}function ct(e){return e.length-st(e,!1).length}c();function lt({packageName:e,currentVersion:n,installSource:r,onInstall:i,onClose:o,onSelect:c,selectedVersion:l}){let{t:d}=q(),f=r===`upload`||r===`local`,[p,h]=s(!1),{data:_,isLoading:v,isError:y}=B({name:e}),b=_?st(_,p):[],x=_?ct(_):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(W,{variant:`unstyled`,type:`button`,onClick:o,className:`text-foreground-subtle hover:text-foreground`,children:a(S,{className:`h-3 w-3`})})]}),f&&t(`div`,{className:`flex items-start gap-2 px-3 py-2 border-b border-border bg-cyan-500/10 text-[10px]`,children:[a(m,{className:`h-3 w-3 mt-0.5 text-cyan-500 shrink-0`}),t(`div`,{className:`text-cyan-700 dark:text-cyan-200`,children:[a(`span`,{className:`font-semibold`,children:d(`addons.versionPicker.inPlace`,{kind:r===`upload`?d(`addons.versionPicker.uploadedCopy`,`Uploaded copy`):d(`addons.versionPicker.localCopy`,`Local copy`)})}),` `,a(Me,{i18nKey:`addons.versionPicker.reinstall`,values:{version:n},components:{mono:a(`span`,{className:`font-mono`})}})]})]}),v&&t(`div`,{className:`flex items-center justify-center gap-2 py-6 text-[10px] text-foreground-subtle`,children:[a(E,{className:`h-3.5 w-3.5 animate-spin`}),d(`addons.versionPicker.loadingVersions`,`Loading versions...`)]}),y&&a(`div`,{className:`px-3 py-4 text-center text-[10px] text-danger`,children:d(`addons.versionPicker.registryError`,`Could not load versions from the registry.`)}),b.length>0&&a(`div`,{className:`max-h-64 overflow-auto divide-y divide-border`,children:b.map(e=>{let r=e.version===n,o=c!==void 0&&e.version===l,s=/-(alpha|beta|rc|dev|canary|next)/i.test(e.version),f=t(u,{children:[a(`span`,{className:`font-mono flex-1 text-left ${r?`text-primary font-semibold`:s?`text-amber-400`:`text-foreground`}`,children:e.version}),r&&a(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium bg-primary/10 text-primary`,children:d(`common.current`)}),e.distTags.map(e=>a(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${e===`latest`?`bg-emerald-500/15 text-emerald-400`:e===`beta`?`bg-amber-500/15 text-amber-400`:`bg-gray-500/15 text-gray-400`}`,children:e},e)),ot(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(W,{variant:`unstyled`,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(W,{variant:`unstyled`,type:`button`,onClick:()=>i(e.version),className:`shrink-0 rounded p-0.5 hover:bg-primary/20 text-foreground-subtle hover:text-primary transition-colors`,title:r?d(`addons.versionPicker.reInstallFromNpm`,`Re-install {{version}} from npm`,{version:e.version}):d(`addons.versionPicker.install`,`Install {{version}}`,{version:e.version}),children:a(te,{className:`h-3 w-3`})})]},e.version)})}),!v&&!y&&_&&_.length===0&&a(`div`,{className:`py-4 text-center text-[10px] text-foreground-subtle`,children:d(`addons.versionPicker.noVersionsFound`,`No versions found`)}),x>0&&a(W,{type:`button`,variant:`ghost`,size:`sm`,className:`h-auto w-full justify-start rounded-none border-t border-border px-3 py-2 text-left text-[10px] font-normal text-foreground-subtle`,onClick:()=>h(e=>!e),children:p?d(`addons.versionPicker.hideOlder`,`Hide older versions`):d(`addons.versionPicker.showOlder`,`Show older versions ({{count}})`,{count:x})})]})}c();var ut=`device-export`;function dt(e){return e.capabilities.some(e=>(typeof e==`string`?e:e.name)===ut)}function ft(e){return e!==`local`&&e!==`upload`}function pt({isBundle:e,installSource:n,addonId:r,iconPath:i,color:o}){let[c,l]=s(!1),u=o?{backgroundColor:`${o.startsWith(`#`)?o:`#${o}`}26`}:void 0,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?y(`/api/addon-assets/${r}/${i}`):null,p=!!f&&!c;return t(`div`,{className:`relative flex-shrink-0`,children:[a(`div`,{className:`h-8 w-8 rounded-md flex items-center justify-center ${u?``:d}`,style:u,children:p?a(`img`,{src:f,alt:r,className:`h-4 w-4`,onError:()=>l(!0)}):a(e?ee:w,{className:`h-3.5 w-3.5`})}),n===`local`&&a(`span`,{className:`absolute -top-1.5 -left-1.5 text-[7px] font-bold leading-none bg-orange-500 text-white px-1 py-0.5 rounded -rotate-12 shadow-sm`,children:`DEV`}),ft(n)&&a(`span`,{className:`absolute -top-1 -left-1 w-4 h-4 rounded bg-[#cb3837] flex items-center justify-center -rotate-12 shadow-sm`,children:a(`svg`,{viewBox:`0 0 780 250`,className:`w-[11px] h-[11px]`,children:a(`path`,{fill:`#fff`,d:`M240 250h100V50h100v200h340V0H0v250z`})})}),n===`upload`&&a(`span`,{className:`absolute -top-1.5 -left-1.5 flex items-center justify-center h-4 w-4 rounded bg-cyan-500 -rotate-12 shadow-sm`,children:a(m,{className:`h-2.5 w-2.5 text-white`})})]})}function mt({version:e,availableUpdate:n,selectedVersion:r,isUpdating:i,installSource:o,disabled:s,onUpdate:c,onOpenPicker:l,children:u}){let{t:d}=q();if(i)return t(`span`,{className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium border border-blue-500/30 bg-blue-500/10 text-blue-400 shrink-0`,children:[a(E,{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(W,{variant:`unstyled`,type:`button`,onClick:e=>{e.stopPropagation(),c()},disabled:s,className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-semibold border border-blue-500/30 bg-blue-500/10 text-blue-400 hover:bg-blue-500/20 disabled:opacity-50 disabled:cursor-not-allowed transition-colors`,title:d(`addons.addonCard.updateTo`,`Update to {{target}}`,{target:i}),children:[a(te,{className:`h-3 w-3`}),d(`addons.addonCard.update`,`Update`)]}),t(W,{variant:`unstyled`,type:`button`,onClick:e=>{e.stopPropagation(),l()},disabled:s,"aria-label":d(`addons.addonCard.selectVersionToInstall`,`Select version to install`),title:d(`addons.addonCard.installedUpdateAvailableSelectedTap`,`Installed {{version}} — update available. Selected {{target}}; tap to choose another version.`,{version:e,target:i}),className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-bold font-mono border border-amber-500/40 bg-amber-500/15 text-amber-500 hover:bg-amber-500/25 animate-pulse disabled:opacity-50 disabled:cursor-not-allowed transition-colors`,children:[a(`span`,{className:`font-normal opacity-70`,children:e}),a(`span`,{className:`font-normal opacity-70`,children:`→`}),i,a(re,{className:`h-3 w-3`})]}),u]})}return t(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[t(W,{variant:`unstyled`,type:`button`,onClick:e=>{e.stopPropagation(),l()},disabled:s,className:[`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-bold font-mono border transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,o===`local`?`border-orange-500/30 bg-orange-500/10 text-orange-400 hover:bg-orange-500/20`:`border-emerald-500/30 bg-emerald-500/10 text-emerald-400 hover:bg-emerald-500/20`].join(` `),title:d(`addons.addonCard.versionTapToViewAll`,`Version {{version}} — tap to view all versions`,{version:e}),children:[e,a(re,{className:`h-3 w-3 opacity-50`})]}),u]})}function ht({addonId:e}){let t=l(),{data:n=`inherit`}=N({addonId:e}),r=V({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(W,{variant:`unstyled`,type:`button`,onClick:n=>{n.stopPropagation(),r.mutate({addonId:e,channel:t})},disabled:r.isPending,className:`px-2.5 py-1 transition-colors capitalize ${n===t?t===`inherit`?`bg-gray-700/50 text-gray-700 dark:text-gray-300`:t===`off`?`bg-gray-700 text-gray-700 dark:text-gray-300`:t===`latest`?`bg-blue-500/20 text-blue-400`:`bg-amber-500/20 text-amber-400`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`} ${t===`inherit`?``:`border-l border-border`}`,children:t},t))})}var gt={id:`hub`,name:`Hub`,isHub:!0};function _t({addon:e,clusterStatus:n,hideVersion:r,availableUpdate:i,blockedUpdate:c,onUpdateServer:d,onUpdate:f,isUpdating:m,jobProgress:g,bundle:_,bulkItem:y,disabledByBulk:b,isSystem:x,selectedNode:w}){let{t:T}=q(),[E,te]=s(!1),[ne,D]=s(!1),[O,k]=s(null);o(()=>{k(null)},[i]);let A=O??i,[ae,oe]=s(!1),[ue,de]=s(!1),[j,M]=s(`logs`),N=l(),P=Pe(),{manifest:F}=e,ge=!_&&!F.protected&&F.removable!==!1,I=!!_,_e=_?.displayName??F.name,R=_?.packageName??F.packageName,ve=_?.version??F.packageVersion??F.version,z=_?.installSource??e.installSource,B=_?_.bundle?.description??_.addons[0]?.manifest.description:F.description,V=L({onSuccess:()=>{N.invalidateQueries({queryKey:[[`addons`]]})}}),ye=ke({onSuccess:()=>{N.invalidateQueries({queryKey:[[`addons`]]}),N.invalidateQueries({queryKey:[[`addonPages`]]}),N.invalidateQueries({queryKey:[[`capabilities`]]}),N.invalidateQueries({queryKey:[[`integrations`]]})}}),be=K({onSuccess:()=>{N.invalidateQueries({queryKey:[[`addons`]]}),N.invalidateQueries({queryKey:[[`alerts`]]})}}),H=e.health,U=H?.phase===`failed`&&!H.inGracePeriod,xe=U&&H?.nextRetryAt&&!H.retrying,G=He(e.process);return t(`div`,{className:`rounded-md border bg-surface overflow-hidden ${U?`border-red-500/50`:`border-border`}`,children:[U&&H&&t(`div`,{className:`bg-danger/10 border-b border-danger/30 px-3 py-2 flex items-start gap-2`,children:[a(ie,{className:`h-4 w-4 text-danger shrink-0 mt-0.5`}),t(`div`,{className:`flex-1 min-w-0`,children:[a(`div`,{className:`text-xs font-semibold text-danger`,children:T(`addons.addonCard.failedToLoad`,{attempt:H.retryCount})}),a(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:H.lastError?.message??T(`addons.addonCard.unknownError`,`Unknown error`)}),xe&&H.nextRetryAt&&a(`div`,{className:`text-[10px] text-foreground-subtle mt-1`,children:T(`addons.addonCard.autoRetryAt`,{time:new Date(H.nextRetryAt).toLocaleTimeString()})})]}),t(W,{variant:`unstyled`,type:`button`,disabled:be.isPending||H.retrying,onClick:e=>{e.stopPropagation(),be.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:T(`addons.addonCard.resetRetryCounterAndForce`,`Reset retry counter and force immediate reload`),children:[a(C,{className:`h-3 w-3 ${be.isPending||H.retrying?`animate-spin`:``}`}),T(`addons.addonCard.retryNow`,`Retry now`)]})]}),G!==null&&t(`div`,{className:`bg-danger/10 border-b border-danger/30 px-3 py-2 flex items-start gap-2`,children:[a(ie,{className:`h-4 w-4 text-danger shrink-0 mt-0.5`}),t(`div`,{className:`flex-1 min-w-0`,children:[a(`div`,{className:`text-xs font-semibold text-danger`,children:T(`addons.addonCard.processProblem.${G.kind}`)}),G.reason!==void 0&&a(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:G.reason})]})]}),t(`div`,{className:`flex items-start gap-2.5 px-3 py-2`,children:[a(pt,{isBundle:I||!!F.components&&F.components.length>1,installSource:z,addonId:I?_.addons[0]?.manifest.id:F.id,iconPath:I?_.bundle?.icon??_.addons[0]?.manifest.icon:F.icon,color:I?_.addons[0]?.manifest.color:F.color}),t(`div`,{className:`flex-1 min-w-0`,children:[t(`div`,{className:`flex items-start justify-between gap-2`,children:[a(`span`,{className:`text-xs font-semibold text-foreground truncate min-w-0`,children:_e}),!r&&a(mt,{version:ve,availableUpdate:i,...A===void 0?{}:{selectedVersion:A},isUpdating:m,installSource:z,disabled:b,...f&&A!==void 0?{onUpdate:()=>f(A)}:{},onOpenPicker:()=>D(e=>!e),children:ne&&a(lt,{packageName:R,currentVersion:ve,...z?{installSource:z}:{},...i!==void 0&&A!==void 0?{selectedVersion:A,onSelect:e=>{k(e),D(!1)}}:{},onInstall:e=>{D(!1),ye.mutate({packageName:R,version:e})},onClose:()=>D(!1)})})]}),t(`div`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 mt-0.5`,children:[R!==_e&&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(ee,{className:`h-3 w-3`}),_.addons.length]}),x&&t(`span`,{className:`text-[10px] rounded-full bg-amber-500/15 text-amber-700 dark:text-amber-300 px-2 py-0.5 font-medium shrink-0 inline-flex items-center gap-1`,title:T(`addons.addonCard.systemPackageUpdatingRestartsThe`,`System package — updating restarts the hub`),children:[a(C,{className:`h-3 w-3`}),T(`addons.addonCard.system`,`System`)]}),y!=null&&a(Z,{item:y}),c!==void 0&&a(ce,{variant:`warning`,title:T(`addons.addonCard.updateHeldTitle`,{defaultValue:`{{latest}} is held until the server is {{required}} or newer`,latest:c.latestVersion,required:c.requiredServer}),children:T(`addons.addonCard.requiresServer`,{defaultValue:`requires server ≥ {{version}}`,version:c.requiredServer})}),c!==void 0&&d!==void 0&&a(W,{type:`button`,size:`sm`,variant:`secondary`,onClick:d,children:T(`clusterUpdate.updateServer`,`Update server`)}),g!=null&&a(Ye,{progress:g})]}),B&&a(`p`,{className:`text-[10px] text-foreground-subtle mt-1 line-clamp-1`,children:B}),!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`?T(`addons.addonCard.forked`):T(`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`:G===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(W,{variant:`unstyled`,type:`button`,onClick:e=>{e.stopPropagation(),V.mutate({addonId:F.id})},disabled:V.isPending||b,className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium border border-border text-foreground-subtle hover:text-blue-400 hover:border-blue-500/30 hover:bg-blue-500/10 disabled:opacity-50 transition-colors`,children:[a(C,{className:`h-3 w-3 ${V.isPending?`animate-spin`:``}`}),T(`addons.addonCard.restart`,`Restart`)]}),t(W,{variant:`unstyled`,type:`button`,onClick:e=>{e.stopPropagation(),oe(e=>!e)},className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium border transition-colors ${ae?`border-primary/30 bg-primary/10 text-primary`:`border-border text-foreground-subtle hover:text-foreground hover:border-primary/30 hover:bg-primary/10`}`,children:[a(h,{className:`h-3 w-3`}),T(`addons.addonCard.logs`,`Logs`)]}),!I&&t(W,{variant:`unstyled`,type:`button`,onClick:e=>{e.stopPropagation(),de(!0)},className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium border transition-colors ${ue?`border-primary/30 bg-primary/10 text-primary`:`border-border text-foreground-subtle hover:text-foreground hover:border-primary/30 hover:bg-primary/10`}`,children:[a(v,{className:`h-3 w-3`}),T(`addons.addonCard.settings`,`Settings`)]}),a(`div`,{className:`flex-1`}),ge&&a(at,{packageName:F.packageName,displayName:F.name,selectedNode:w??gt,disabled:b})]}),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:T(`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:T(`addons.addonCard.outdated`)}),e.status===`offline`&&a(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-muted text-muted-foreground`,children:T(`common.offline`)}),e.synced&&e.status!==`offline`&&a(`span`,{className:`text-[9px] text-success`,children:T(`common.synced`)})]},e.nodeId))})]}),ae&&!I&&t(`div`,{className:`border-t border-border`,children:[t(`div`,{className:`flex items-center px-3 py-0.5 bg-surface-hover/20 border-b border-border/50`,children:[t(`div`,{className:`flex rounded border border-border overflow-hidden text-[9px]`,children:[a(W,{variant:`unstyled`,type:`button`,onClick:()=>M(`logs`),className:`px-2 py-0.5 transition-colors ${j===`logs`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:T(`addons.addonCard.logs`,`Logs`)}),a(W,{variant:`unstyled`,type:`button`,onClick:()=>M(`events`),className:`px-2 py-0.5 border-l border-border transition-colors ${j===`events`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:T(`addons.addonCard.events`,`Events`)})]}),a(`div`,{className:`flex-1`}),a(W,{variant:`unstyled`,type:`button`,onClick:e=>{e.stopPropagation(),oe(!1)},className:`text-foreground-subtle hover:text-foreground`,children:a(S,{className:`h-3.5 w-3.5`})})]}),j===`logs`&&a(fe,{addonId:F.id,maxHeight:`max-h-64`,showFilters:!1}),j===`events`&&a(je,{addonId:F.id,category:`addon.*`,maxHeight:`max-h-64`})]}),I&&t(u,{children:[a(W,{variant:`unstyled`,type:`button`,onClick:()=>te(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(E?p:re,{className:`h-3.5 w-3.5 text-foreground-subtle`})}),E&&a(`div`,{className:`border-t border-border px-2.5 py-1.5 space-y-1.5`,children:_.addons.map(e=>a(_t,{addon:e,hideVersion:!0},e.manifest.id))})]}),ue&&!I&&a(se,{open:!0,onOpenChange:e=>!e&&de(!1),children:t(De,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:[a(pe,{children:t(he,{className:`flex items-center gap-2`,children:[a(v,{className:`h-4 w-4 text-primary`}),T(`addons.addonCard.settingsTitle`,{name:_e})]})}),t(le,{className:`space-y-4`,children:[a(`div`,{className:`text-[10px] text-foreground-subtle mb-2`,children:T(`addons.addonCard.clusterWideSettingsOneValue`,`Cluster-wide settings — one value for every node. Per-node settings live under Cluster → the node → Settings.`)}),a(Y,{nodeId:null,addonIds:[F.id],level:`global`,fieldScope:`cluster`,emptyMessage:T(`addons.addonCard.thisAddonExposesNoCluster`,`This addon exposes no cluster-wide settings. Anything it can configure is per-node — open it from Cluster → the node → Settings.`)}),dt(F)&&t(`div`,{children:[a(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:T(`addons.addonCard.deviceExport`,`Device export`)}),a(Se,{addonId:F.id,onOpenDevice:e=>P(`/devices/${e}`)})]}),ft(z)&&t(`div`,{children:[a(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:T(`addons.addonCard.autoUpdate`,`Auto-Update`)}),a(ht,{addonId:F.id})]}),F.components&&F.components.length>0&&t(`div`,{children:[a(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:T(`addons.addonCard.components`,{count:F.components.length})}),a(`div`,{className:`flex flex-wrap gap-1`,children:F.components.map(e=>a(`span`,{className:`text-[10px] rounded bg-background border border-border px-1.5 py-0.5 text-foreground-subtle font-mono`,children:e},e))})]})]}),a(me,{children:a(W,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>de(!1),children:T(`common.close`,`Close`)})})]})})]})}c();var vt=`.tgz,.tar.gz,.zip`;function yt({onUploadSuccess:e}){let{t:r}=q(),[o,c]=s(!1),l=n(null),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(y(`/api/addons/upload`),{method:`POST`,headers:{Authorization:`Bearer ${r}`},body:n})).json()).success&&e()}finally{c(!1)}},[e]);return t(u,{children:[a(I,{ref:l,accept:vt,onChange:i(e=>{let t=e.target.files?.[0];t&&d(t),e.target.value=``},[d]),className:`hidden`}),t(W,{variant:`unstyled`,type:`button`,onClick:()=>l.current?.click(),disabled:o,className:`flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,children:[o?a(E,{className:`w-3.5 h-3.5 animate-spin`}):a(m,{className:`w-3.5 h-3.5`}),o?r(`addons.addonUploadZone.uploading`,`Uploading...`):r(`addons.addonUploadZone.upload`,`Upload`)]})]})}var bt=/```[^\n]*\n([\s\S]*?)```/g;function xt(e){let t=[],n=0;for(let r of e.matchAll(bt)){let i=r.index??0;i>n&&t.push({kind:`text`,body:e.slice(n,i)}),t.push({kind:`code`,body:r[1]??``}),n=i+r[0].length}return n<e.length&&t.push({kind:`text`,body:e.slice(n)}),t}function St(e){let t=e.trim();return t.startsWith(`https://`)||t.startsWith(`http://`)?t:null}function Ct(e,t){let n=[],r=/(\*\*[^*]+\*\*|`[^`]+`|\[[^\]]+\]\([^)]+\))/g,i=0,o=0;for(let s of e.matchAll(r)){let r=s.index??0;r>i&&n.push(e.slice(i,r));let c=s[0],l=`${t}-${o}`;if(o+=1,c.startsWith(`**`))n.push(a(`strong`,{children:c.slice(2,-2)},l));else if(c.startsWith("`"))n.push(a(`code`,{className:`font-mono text-[0.9em]`,children:c.slice(1,-1)},l));else{let e=/^\[([^\]]+)\]\(([^)]+)\)$/.exec(c),t=e?.[1]??c,r=e?St(e[2]??``):null;n.push(r?a(`a`,{href:r,target:`_blank`,rel:`noreferrer noopener`,className:`text-primary underline`,children:t},l):a(`span`,{children:t},l))}i=r+c.length}return i<e.length&&n.push(e.slice(i)),n}function wt(e,t){let n=e.split(`
5
- `),r=[],i=[],o=[],s=0,c=()=>{if(i.length===0)return;let e=i.join(` `).trim();i=[],e.length!==0&&(r.push(a(`p`,{className:`mb-2 last:mb-0`,children:Ct(e,`${t}-p-${s}`)},`${t}-p-${s}`)),s+=1)},l=()=>{if(o.length===0)return;let e=o;o=[],r.push(a(`ul`,{className:`mb-2 list-disc pl-4 last:mb-0`,children:e.map((e,n)=>a(`li`,{children:Ct(e,`${t}-li-${s}-${n}`)},`${t}-li-${s}-${n}`))},`${t}-ul-${s}`)),s+=1};for(let e of n){let n=/^(#{1,3})\s+(.*)$/.exec(e),u=/^\s*[-*]\s+(.*)$/.exec(e);if(n){c(),l();let e=n[1]?.length??1,i=Ct(n[2]??``,`${t}-h-${s}`),o=e===1?`text-sm font-semibold mb-2`:`text-xs font-semibold mb-1.5 mt-2`;r.push(a(e===1?`h3`:`h4`,{className:o,children:i},`${t}-h-${s}`)),s+=1;continue}if(u){c(),o=[...o,u[1]??``];continue}if(e.trim().length===0){c(),l();continue}l(),i=[...i,e.trim()]}return c(),l(),r}function Tt({markdown:e}){return a(`div`,{className:`text-xs text-foreground leading-relaxed`,children:xt(e).map((e,t)=>e.kind===`code`?a(`pre`,{className:`mb-2 overflow-auto rounded-md bg-surface-hover p-2 font-mono text-[10px] last:mb-0`,children:e.body.replace(/\n$/,``)},`code-${t}`):a(`div`,{children:wt(e.body,`b${t}`)},`text-${t}`))})}c();function Et(e){return e.replace(/^@camstack\/(addon-)?/,``)}function Dt(e,t,n){let r=st(e,n);return r.some(e=>e.version===t)?r:[{version:t,distTags:[],deprecated:void 0},...r]}function Ot({pending:e,failed:n,body:r,missing:i}){let{t:o}=q();return e?t(`div`,{className:`flex items-center gap-2 py-6 text-xs text-foreground-subtle`,children:[a(E,{className:`h-3.5 w-3.5 animate-spin`}),o(`addons.installDialog.loadingDocument`,`Loading…`)]}):n||r===void 0?a(`p`,{className:`py-4 text-xs text-danger`,children:o(`addons.installDialog.couldNotLoadDocument`,`Could not load this file from the registry.`)}):r.status===`ok`&&r.markdown!==void 0?a(Tt,{markdown:r.markdown}):r.status===`error`?a(`p`,{className:`py-4 text-xs text-danger`,children:o(`addons.installDialog.documentError`,`Could not load this file. {{message}}`,{message:r.message??``})}):a(`p`,{className:`py-4 text-xs text-foreground-subtle`,children:i})}function kt({target:e,installing:n,installError:r,onClose:i,onInstall:o}){let{t:c}=q(),[l,u]=s(e.version),[d,f]=s(!1),p=B({name:e.name}),m=ae({name:e.name,version:l}),h=p.data??[],g=ct(h),_=Dt(h,l,d),v=m.data;return a(se,{open:!0,onOpenChange:e=>!e&&i(),children:t(De,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:[a(pe,{children:a(he,{children:c(`addons.installDialog.title`,`Install {{name}}`,{name:Et(e.name)})})}),t(le,{className:`space-y-3`,children:[a(`p`,{className:`font-mono text-[10px] text-foreground-subtle`,children:e.name}),e.description.length>0&&a(`p`,{className:`text-xs text-foreground`,children:e.description}),t(`div`,{className:`space-y-1.5`,children:[a(`span`,{className:`text-[10px] text-foreground-subtle`,children:c(`addons.installDialog.version`,`Version`)}),a(D,{"aria-label":c(`addons.installDialog.version`,`Version`),value:l,options:_.map(e=>({value:e.version,label:ot(e)?c(`addons.installDialog.deprecatedVersion`,`{{version}} (deprecated)`,{version:e.version}):e.version})),onChange:e=>u(e.target.value)}),p.isError&&a(`p`,{className:`text-[10px] text-danger`,children:c(`addons.versionPicker.registryError`,`Could not load versions from the registry.`)}),g>0&&a(W,{type:`button`,variant:`ghost`,size:`sm`,className:`h-auto justify-start px-0 text-[10px] font-normal text-foreground-subtle underline`,onClick:()=>f(e=>!e),children:d?c(`addons.versionPicker.hideOlder`,`Hide older versions`):c(`addons.versionPicker.showOlder`,`Show older versions ({{count}})`,{count:g})})]}),t(R,{defaultValue:`readme`,children:[t(Ae,{children:[a(z,{value:`readme`,children:c(`addons.installDialog.readme`,`README`)}),a(z,{value:`changelog`,children:c(`addons.installDialog.changelog`,`CHANGELOG`)})]}),a(G,{value:`readme`,children:a(`div`,{className:`max-h-80 overflow-auto rounded-md border border-border bg-background p-3`,children:a(Ot,{pending:m.isPending,failed:m.isError,body:v?.readme,missing:c(`addons.installDialog.missingReadme`,`This package has no README.`)})})}),a(G,{value:`changelog`,children:a(`div`,{className:`max-h-80 overflow-auto rounded-md border border-border bg-background p-3`,children:a(Ot,{pending:m.isPending,failed:m.isError,body:v?.changelog,missing:c(`addons.installDialog.missingChangelog`,`This package has no CHANGELOG.`)})})})]}),r!=null&&r.length>0&&a(`p`,{className:`text-xs text-danger`,children:r})]}),t(me,{children:[a(W,{type:`button`,variant:`outline`,size:`sm`,onClick:i,children:c(`common.cancel`,`Cancel`)}),a(W,{type:`button`,size:`sm`,disabled:n||l.length===0,onClick:()=>o(e.name,l),children:n?a(E,{className:`h-3.5 w-3.5 animate-spin`}):c(`addons.installDialog.install`,`Install`)})]})]})})}function At(e,t){let n=new Map;for(let r of e){if(r.isHub||r.onHub||J(r.packageName)||!t.isHub&&r.nodeId!==t.id)continue;let e=n.get(r.packageName)??[];e.push(r),n.set(r.packageName,e)}return[...n].map(([e,t])=>({packageName:e,rows:t})).sort((e,t)=>e.packageName.localeCompare(t.packageName))}function jt({selectedNode:e}){let{t:n}=q(),{data:r}=U(nt,{staleTime:rt});if(r===void 0)return null;let i=At(r.installations,e),o=r.unreachable.filter(t=>e.isHub||t.nodeId===e.id);return i.length===0&&o.length===0?null:t(`div`,{className:`rounded-lg border border-warning/30 bg-warning/5 px-3 py-2.5 space-y-2`,children:[t(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold text-foreground`,children:[a(_,{className:`h-3.5 w-3.5 text-warning`}),e.isHub?n(`addons.nodeOnlyPackagesPanel.installedOnAgentsButNot`,`Installed on agents but not on the hub`):n(`addons.nodeOnlyPackagesPanel.installedOnButNotOn`,`Installed on {{name}} but not on the hub`,{name:e.name})]}),o.length>0&&a(`div`,{className:`text-[10px] text-foreground-subtle`,children:n(`addons.nodeOnlyPackagesPanel.unreachable`,{nodes:o.map(e=>e.nodeId).join(`, `)})}),i.map(n=>t(`div`,{className:`flex items-center justify-between gap-3 flex-wrap rounded-md border border-border bg-surface px-3 py-2`,children:[t(`div`,{className:`min-w-0`,children:[a(`div`,{className:`text-xs font-mono text-foreground break-all`,children:n.packageName}),a(`div`,{className:`text-[10px] text-foreground-subtle`,children:n.rows.map(e=>`${e.nodeName}${e.version===null?``:` ${e.version}`}${e.isOnline?``:` (offline)`}`).join(` · `)})]}),a(at,{packageName:n.packageName,displayName:n.packageName,selectedNode:e,hideNodeAction:e.isHub})]},n.packageName))]})}function Mt({addon:e,installing:n,onInstall:r}){let{t:i}=q();return t(`div`,{className:`flex items-center gap-3 px-3 py-2 hover:bg-surface-hover transition-colors`,children:[a(`div`,{className:`w-6 h-6 rounded-md bg-primary/10 flex items-center justify-center text-primary text-[9px] font-bold shrink-0`,children:e.name.replace(`@camstack/addon-`,``).charAt(0).toUpperCase()}),t(`div`,{className:`flex-1 min-w-0`,children:[t(`div`,{className:`flex items-baseline gap-2 min-w-0`,children:[a(`span`,{className:`text-[11px] font-semibold break-words`,children:e.name.replace(/^@camstack\/(addon-)?/,``)}),t(`span`,{className:`text-[10px] text-foreground-subtle shrink-0`,children:[`v`,e.version]})]}),a(`div`,{className:`font-mono text-[9px] text-foreground-subtle/80 truncate`,children:e.name}),e.description&&a(`div`,{className:`text-[10px] text-foreground-subtle truncate`,children:e.description})]}),e.installed?a(ce,{variant:`success`,icon:a(g,{className:`h-3 w-3`}),children:e.installedVersion??i(`system.capabilityCatalog.installed`,`Installed`)}):t(W,{size:`sm`,onClick:()=>r(e),disabled:n,className:`shrink-0`,children:[n?a(E,{className:`h-3 w-3 animate-spin`}):a(te,{className:`h-3 w-3`}),i(`system.capabilityCatalog.install`,`Install`)]})]})}function Nt({capability:e,installing:n,onInstall:r}){let{t:i}=q(),{data:o,isPending:s,isError:c}=ve({capability:e}),l;if(c)l=a(`div`,{className:`px-3 py-2 text-xs text-danger`,children:i(`system.capabilityCatalog.couldNotSearchTheNpm`,`Could not search the npm catalog right now. Try again in a moment.`)});else if(s||o===void 0)l=t(`div`,{className:`flex items-center gap-2 px-3 py-2 text-xs text-foreground-subtle`,children:[a(E,{className:`h-3 w-3 animate-spin`}),i(`system.capabilityCatalog.searchingTheNpmCatalog`,`Searching the npm catalog…`)]});else{let t=o.filter(e=>!e.installed);l=t.length===0?a(`div`,{className:`px-3 py-2 text-xs text-foreground-subtle`,children:o.length===0?i(`system.capabilityCatalog.noPublishedAddonDeclaresThe`,`No published addon declares the "{{capability}}" capability.`,{capability:e}):i(`system.capabilityCatalog.everyPublishedAddonThatDeclares`,`Every published addon that declares "{{capability}}" is already installed.`,{capability:e})}):a(`div`,{className:`divide-y divide-border`,children:t.map(e=>a(Mt,{addon:e,installing:n,onInstall:r},e.name))})}return t(`section`,{className:`rounded-md border border-border bg-surface overflow-hidden`,"aria-label":i(`system.capabilityCatalog.availableToInstall`,`Available to install`),children:[a(`h2`,{className:`px-3 py-1.5 text-[10px] uppercase tracking-wide text-foreground-subtle border-b border-border`,children:i(`system.capabilityCatalog.availableToInstall`,`Available to install`)}),l]})}c();function Pt(e){return e===`npm`||e===`dev`?e:null}var Ft=`rounded-full border border-primary bg-primary/10 px-2 py-0.5 text-[10px] text-foreground`,It=`rounded-full border border-border px-2 py-0.5 text-[10px] text-foreground-muted hover:bg-surface-hover`,Lt=[{seconds:900,label:`15m`},{seconds:3600,label:`1h`},{seconds:21600,label:`6h`},{seconds:43200,label:`12h`},{seconds:86400,label:`24h`}],Rt={id:`hub`,name:`Hub`,isHub:!0,isOnline:!0};function zt(e,t){let n=e??`hub-only`;return n===`any-node`?!0:n===`hub-only`?t:!t}function Bt(e){return e===`local`?`dev`:`npm`}function Vt(e){let t=e;if(!t?.manifest)return null;let n={...t.manifest,name:t.manifest.name??t.manifest.id,version:t.manifest.version??`0.0.0`,capabilities:t.manifest.capabilities??[]},r=t.process,i=r?{pid:r.pid,mode:r.mode===`forked`?`forked`:`in-process`,state:r.state??`unknown`,...r.reason===void 0?{}:{reason:r.reason}}:void 0,a=t.health,o=t.declaration?.execution,s=t.manifest.execution,c=o?.placement??s?.placement;return{manifest:n,enabled:!0,source:t.source,installSource:t.installSource,installedOn:[],...i?{process:i}:{},hasBackup:t.hasBackup,...a?{health:a}:{},...c?{placement:c}:{}}}function Ht(e){let t=new Map,n=[];for(let r of e){let e=r.manifest.packageName;if(!e){n.push(r);continue}let i=t.get(e);if(i)i.addons.push(r);else{let n=r.manifest.bundle,i={packageName:e,displayName:n?.displayName??r.manifest.packageDisplayName??r.manifest.name,version:r.manifest.packageVersion,addons:[r],...r.installSource===void 0?{}:{installSource:r.installSource},...n===void 0?{}:{bundle:n}};t.set(e,i)}}let r=[];for(let e of t.values())e.bundle!==void 0||e.addons.length>=2?r.push({bundle:e,representative:e.addons[0]}):r.push(e.addons[0]);return r.push(...n),r}function $(e){return`bundle`in e}function Ut({addons:c,clusterStatus:u,selectedNode:d,onRefresh:p,listPhase:m}){let{t:h}=q(),g=l(),[_,v]=s(``),[y,b]=s(!1),S=e(_),[w,ee]=s(!1),ne=n(null);o(()=>{if(!w)return;let e=e=>{ne.current&&!ne.current.contains(e.target)&&ee(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[w]);let{data:O}=we({nodeId:d.id}),k=r(()=>{let e=new Map;for(let t of O??[])t.blockedBy===void 0&&e.set(t.name,t.latestVersion);return e},[O]),re=r(()=>{let e=new Map;for(let t of O??[]){let n=t.blockedBy?.find(e=>e.kind===`server-too-old`);n!==void 0&&e.set(t.name,{latestVersion:t.latestVersion,requiredServer:n.required})}return e},[O]),A=r(()=>(O??[]).filter(e=>!e.isSystem&&e.blockedBy===void 0).length,[O]),[ie,ae]=s(()=>new Set),[oe,se]=s(()=>new Map),ce=i(e=>{ae(t=>new Set(t).add(e))},[]),le=i(e=>{ae(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[]),j=i((e,t)=>{se(n=>new Map(n).set(e,t))},[]),fe=i(e=>{se(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),M=ge({onMutate:e=>{ce(e.name),fe(e.name)},onSuccess:(e,t)=>{le(t.name);let n=e;if(n&&n.success===!1){j(t.name,n.error??`Update failed (no error message returned by server)`);return}g.invalidateQueries({queryKey:[[`addons`]]}),g.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]})},onError:(e,t)=>{le(t.name),j(t.name,e instanceof Error?e.message:String(e))}}),N=qe(),pe=n(new Set);o(()=>{let e=new Set;for(let[t,n]of N)Ge(n)&&e.add(t);let t=[...pe.current].some(t=>!e.has(t));pe.current=e,t&&(g.invalidateQueries({queryKey:[[`addons`]]}),g.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]}))},[N,g]);let{data:P}=F(void 0),me=Ee({onSuccess:()=>{g.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),he=Te({onSuccess:()=>{g.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),{data:I,isFetching:_e}=ve({query:S||void 0},{enabled:w}),L=H(),{data:R}=de(void 0),z=R?.requestedAt,[B,V]=s(null),[be,U]=s(!1);o(()=>{if(R?.kind===`framework-bulk-update`&&R.requestedAt!==B){V(R.requestedAt),U(!0);let e=window.setTimeout(()=>U(!1),6e3);return()=>window.clearTimeout(e)}},[z,B,R]),T();let xe=i(async()=>{let e=(O??[]).filter(e=>!e.isSystem&&e.blockedBy===void 0);if(e.length!==0){if(!d.isHub){for(let t of e)await M.mutateAsync({name:t.name,version:t.latestVersion,nodeId:d.id});return}await L.mutateAsync({kind:`update`,targets:e.map(e=>({name:e.name,version:e.latestVersion})),nodeIds:[d.id]})}},[O,d.id,d.isHub,L,M]),[G,Se]=s(null),[Ce,De]=s(null),Oe=e=>{De(null),Se(e)},K=ke({onSuccess:()=>{Se(null),De(null),g.invalidateQueries({queryKey:[[`addons`]]}),g.invalidateQueries({queryKey:[[`addonPages`]]}),g.invalidateQueries({queryKey:[[`capabilities`]]}),g.invalidateQueries({queryKey:[[`integrations`]]})},onError:e=>{De(e instanceof Error?e.message:`Install failed`)}}),[Ae,je]=s(`type`),[Me,Pe]=s(()=>typeof window>`u`?`grouped`:window.localStorage.getItem(`camstack.addons.viewMode`)===`flat`?`flat`:`grouped`),Fe=e=>{Pe(e),typeof window<`u`&&window.localStorage.setItem(`camstack.addons.viewMode`,e)},[J,Y]=Ne(),X=J.get(`capability`),Ve=J.get(`updatable`)===`1`,Ue=J.get(`error`)===`1`,Z=Pt(J.get(`source`)),Q=Ie(J.get(Re))===`integration`,{data:We}=ue(void 0,{enabled:Q}),Ke=r(()=>We===void 0?null:new Set(We.map(e=>e.addonId)),[We]),Je=i(e=>{let t=new URLSearchParams(J);e?t.set(Re,`integration`):t.delete(Re),Y(t,{replace:!0})},[J,Y]),Ye=i(e=>{let t=new URLSearchParams(J);e?t.set(`updatable`,`1`):t.delete(`updatable`),Y(t,{replace:!0})},[J,Y]),Xe=i(e=>{let t=new URLSearchParams(J);e?t.set(`error`,`1`):t.delete(`error`),Y(t,{replace:!0})},[J,Y]),Ze=i(e=>{let t=new URLSearchParams(J);e===null?t.delete(`source`):t.set(`source`,e),Y(t,{replace:!0})},[J,Y]),Qe=r(()=>c.filter(e=>He(e.process)!==null).length,[c]),$e=r(()=>{let e=c.filter(e=>!ze(e.manifest.packageName));return d.isHub||(e=e.filter(e=>zt(e.placement,d.isHub))),X&&(e=e.filter(e=>(e.manifest.capabilities??[]).some(e=>(typeof e==`string`?e:e.name)===X))),Q&&(e=[...Le(e,Ke)]),Ve&&(e=e.filter(e=>{let t=e.manifest.packageName;return t!==void 0&&k.has(t)})),Z!==null&&(e=e.filter(e=>Bt(e.installSource)===Z)),Ue&&(e=e.filter(e=>He(e.process)!==null)),e},[c,d.isHub,X,Ve,Z,Ue,Q,Ke,k]),et=()=>{let e=new URLSearchParams(J);e.delete(`capability`),Y(e,{replace:!0})},tt=Me===`flat`?$e:Ht($e),nt=r(()=>{let e=[...tt];switch(Ae){case`type`:e.sort((e,t)=>{let n=+!$(e),r=+!$(t);if(n!==r)return n-r;let i=$(e)?e.bundle.displayName:e.manifest.name,a=$(t)?t.bundle.displayName:t.manifest.name;return i.localeCompare(a)});break;case`name`:e.sort((e,t)=>{let n=$(e)?e.bundle.displayName:e.manifest.name,r=$(t)?t.bundle.displayName:t.manifest.name;return n.localeCompare(r)});break;case`source`:e.sort((e,t)=>{let n=$(e)?e.bundle.installSource??``:e.installSource??``,r=$(t)?t.bundle.installSource??``:t.installSource??``;return n.localeCompare(r)});break}return e},[tt,Ae]);return t(`div`,{className:`space-y-3`,children:[a(Be,{open:y,onOpenChange:b}),[...oe.entries()].map(([e,n])=>a(`div`,{className:`rounded-md border border-danger/30 bg-danger/5 px-2.5 py-1.5 text-[11px]`,children:t(`div`,{className:`flex items-start justify-between gap-3`,children:[t(`div`,{className:`space-y-0.5`,children:[a(`div`,{className:`font-medium text-danger`,children:h(`systemPage.addons.updateFailed`,{name:e})}),a(`div`,{className:`text-foreground-subtle font-mono`,children:n})]}),a(W,{variant:`unstyled`,type:`button`,onClick:()=>fe(e),className:`text-foreground-subtle hover:text-foreground text-[10px]`,children:h(`common.dismiss`)})]})},e)),t(`div`,{className:`flex items-center gap-x-2 gap-y-1.5 flex-wrap`,children:[t(`div`,{className:`flex items-center gap-1.5`,children:[a(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`admin.system.addons.sort`,`Sort:`)}),t(D,{wrapperClassName:`inline-block w-auto`,value:Ae,onChange:e=>je(e.target.value),children:[a(`option`,{value:`type`,children:h(`admin.system.addons.bundlesFirst`,`Bundles first`)}),a(`option`,{value:`name`,children:h(`admin.system.addons.name`,`Name`)}),a(`option`,{value:`source`,children:h(`admin.system.addons.installSource`,`Install source`)})]})]}),t(`div`,{className:`flex items-center gap-1.5`,children:[a(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`admin.system.addons.view`,`View:`)}),a(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`grouped`,`flat`].map(e=>a(W,{variant:`unstyled`,type:`button`,onClick:()=>Fe(e),className:`px-2 py-1 transition-colors capitalize ${Me===e?`bg-primary/10 text-primary`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`}`,title:e===`grouped`?h(`admin.system.addons.groupMultiAddonPackagesInto`,`Group multi-addon packages into a bundle card`):h(`admin.system.addons.showEveryAddonAsIts`,`Show every addon as its own card`),children:e},e))})]}),d.isHub&&t(`div`,{className:`flex items-center gap-1.5`,children:[a(C,{className:`h-3 w-3 text-foreground-subtle`}),a(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`admin.system.addons.autoUpdate`,`Auto-Update:`)}),a(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`off`,`latest`,`beta`].map(e=>a(W,{variant:`unstyled`,type:`button`,onClick:()=>me.mutate({channel:e}),disabled:me.isPending,className:`px-2 py-1 transition-colors capitalize ${P?.channel===e?e===`off`?`bg-gray-700 text-gray-200`:e===`latest`?`bg-blue-500/20 text-blue-400`:`bg-amber-500/20 text-amber-400`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`} ${e===`off`?``:`border-l border-border`}`,children:e},e))})]}),d.isHub&&t(`div`,{className:`flex items-center gap-1.5`,children:[a(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`admin.system.addons.checkEvery`,`Check every:`)}),a(D,{wrapperClassName:`inline-block w-auto`,className:`font-medium text-foreground-subtle`,value:P?.updateCheckIntervalSeconds??21600,disabled:he.isPending||P===void 0,onChange:e=>{P!==void 0&&he.mutate({channel:P.channel,updateCheckIntervalSeconds:Number(e.target.value)})},children:Lt.map(e=>a(`option`,{value:e.seconds,children:e.label},e.seconds))})]}),A>0&&t(W,{variant:`unstyled`,type:`button`,onClick:()=>void xe(),disabled:L.isPending,className:`flex items-center gap-1 px-2 py-1 text-[11px] rounded-md bg-blue-500/10 text-blue-400 hover:bg-blue-500/20 border border-blue-500/30 disabled:opacity-50 transition-colors font-medium`,children:[L.isPending?a(E,{className:`w-3 h-3 animate-spin`}):a(te,{className:`w-3 h-3`}),L.isPending?h(`admin.system.addons.updating`,`Updating…`):h(`admin.system.addons.updateAll`,`Update All ({{nonSystemUpdateCount}})`,{nonSystemUpdateCount:A})]})]}),t(`div`,{className:`flex flex-wrap items-center gap-1.5`,role:`group`,"aria-label":h(`admin.system.addons.filterInstalledAddons`,`Filter installed addons`),children:[a(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`admin.system.addons.filter`,`Filter:`)}),[{id:`integrations`,label:h(`admin.system.addons.integrations`,`Integrations`),pressed:Q,toggle:()=>Je(!Q)},{id:`updatable`,label:h(`admin.system.addons.updatable`,`Updatable`),pressed:Ve,toggle:()=>Ye(!Ve)},{id:`error`,label:h(`admin.system.addons.inError`,`In error ({{count}})`,{count:Qe}),pressed:Ue,toggle:()=>Xe(!Ue)},{id:`npm`,label:`npm`,pressed:Z===`npm`,toggle:()=>Ze(Z===`npm`?null:`npm`)},{id:`dev`,label:h(`admin.system.addons.dev`,`Dev`),pressed:Z===`dev`,toggle:()=>Ze(Z===`dev`?null:`dev`)}].map(e=>a(W,{variant:`unstyled`,type:`button`,"aria-pressed":e.pressed,onClick:e.toggle,className:e.pressed?Ft:It,children:e.label},e.id))]}),t(`div`,{className:`flex flex-col gap-1.5 sm:flex-row sm:items-center sm:gap-2`,children:[t(`div`,{className:`relative flex-1 min-w-0 sm:min-w-[200px]`,ref:ne,children:[a(ye,{type:`text`,searchHotkey:!0,value:_,onChange:e=>{v(e.target.value),ee(!0)},onFocus:()=>ee(!0),placeholder:h(`admin.system.addons.searchAddonsOnNpm`,`Search addons on npm...`),"aria-label":h(`admin.system.addons.searchAddonsOnNpm2`,`Search addons on npm`),disabled:L.isPending,leftSlot:a(f,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),rightSlot:_e?a(E,{className:`h-3 w-3 animate-spin`}):void 0}),w&&I&&I.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:[I.length>0&&a(`div`,{className:`px-3 py-1.5 text-[10px] uppercase tracking-wide text-foreground-subtle border-b border-border`,children:h(`systemPage.addons.npmResults`,{count:I.length})}),I&&I.length>0&&a(`div`,{className:`max-h-72 overflow-auto divide-y divide-border`,children:I.map(e=>a(Mt,{addon:e,installing:K.isPending,onInstall:e=>Oe({name:e.name,version:e.version,description:e.description})},e.name))})]})]}),a(yt,{onUploadSuccess:()=>{g.invalidateQueries({queryKey:[[`addons`]]}),p()}})]}),X&&t(`div`,{className:`flex items-center gap-2 px-2.5 py-1.5 rounded-md bg-primary/10 border border-primary/30 text-xs`,children:[a(`span`,{className:`text-foreground-subtle`,children:h(`admin.system.addons.filteringByCapability`,`Filtering by capability:`)}),a(`span`,{className:`font-mono text-primary font-semibold`,children:X}),a(W,{variant:`unstyled`,type:`button`,onClick:et,className:`ml-auto text-xs text-foreground-subtle hover:text-foreground underline`,children:h(`admin.system.addons.clear`,`Clear`)})]}),X&&a(Nt,{capability:X,installing:K.isPending,onInstall:e=>Oe({name:e.name,version:e.version,description:e.description})}),X&&$e.length>0&&a(`h2`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:h(`admin.system.addons.installed`,`Installed`)}),be&&t(`div`,{className:`fixed top-[calc(env(safe-area-inset-top)+1rem)] right-[calc(env(safe-area-inset-right)+1rem)] z-50 flex items-start gap-2 px-3 py-2.5 rounded-md border border-green-500/30 bg-green-500/10 shadow-lg max-w-sm pointer-events-auto`,children:[a(x,{className:`w-4 h-4 shrink-0 mt-0.5 text-green-400`}),t(`div`,{children:[a(`div`,{className:`text-[11px] font-semibold text-foreground`,children:h(`admin.system.addons.bulkUpdateCompleted`,`Bulk update completed`)}),a(`div`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:h(`admin.system.addons.systemPackagesUpdatedHubRestarted`,`System packages updated — hub restarted successfully.`)})]})]}),m===`pending`&&t(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[a(E,{className:`h-3 w-3 animate-spin`}),h(`admin.system.addons.loadingInstalled`,`Loading installed addons…`)]}),m===`error`&&a(`div`,{className:`text-xs text-danger`,children:h(`admin.system.addons.failedToLoadAddons`,`Failed to load addons`)}),m===`ready`&&$e.length===0&&a(`div`,{className:`text-xs text-foreground-subtle`,children:c.length===0?h(`admin.system.addons.noAddonsInstalled`,`No addons installed`):X?h(`admin.system.addons.noInstalledAddonDeclaresThe`,`No installed addon declares the "{{capabilityFilter}}" capability. Any addon you can install appears under "Available to install" above.`,{capabilityFilter:X}):h(`admin.system.addons.noAddonsCompatibleWithPlacement`,`No addons compatible with {{name}} (placement filter active)`,{name:d.name})}),a(`div`,{className:`space-y-1.5`,children:m===`ready`&&nt.map(e=>{let t=$(e)?e.bundle.packageName:e.manifest.packageName,n=k.get(t),r=re.get(t),i=$(e)?e.representative:e,o=n?e=>M.mutate({name:t,version:e,nodeId:d.id}):void 0,s=N.get(t)??null,c=s!==null&&Ge(s);return a(_t,{addon:i,clusterStatus:u?.[i.manifest.id],bundle:$(e)?e.bundle:void 0,availableUpdate:n,...r===void 0?{}:{blockedUpdate:r},...r===void 0?{}:{onUpdateServer:()=>b(!0)},isUpdating:ie.has(t)||c,jobProgress:s,onUpdate:o,disabledByBulk:L.isPending,selectedNode:d},$(e)?t:e.manifest.id)})}),G!==null&&a(kt,{target:G,installing:K.isPending,installError:Ce,onClose:()=>Se(null),onInstall:(e,t)=>K.mutate({packageName:e,version:t})})]})}function Wt(){let{t:e}=q(),r=l(),{data:i}=oe(void 0),{nodes:s}=j(),{selection:c,selectNode:u,requestedNodeId:d}=Ve(s.length>0?s:[Rt]),f=c.node??Rt,p=f.id,m=s.length>0?c.staleNodeId:null,{data:h,isLoading:g,isError:_}=Ce({nodeId:p}),v=P(),y=Oe(),b=v.isPending||y.isPending,x=async()=>{await v.mutateAsync({nodeId:p}),await y.mutateAsync(),r.invalidateQueries({queryKey:[[`addons`]]})},S=n(v);S.current=v;let w=n(d??`hub`);o(()=>{S.current.mutate({nodeId:w.current})},[]);let T=(h??[]).map(Vt).filter(e=>e!==null);return t(Fe,{children:[t(`div`,{className:`flex items-center justify-between gap-2 flex-wrap`,children:[a(xe,{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:T.length})}),t(W,{variant:`unstyled`,type:`button`,onClick:()=>void x(),disabled:b,className:`inline-flex items-center gap-1 px-2 py-1 text-[11px] rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,title:e(`admin.system.addons.reFetchAddonsCheckNpm`,`Re-fetch addons + check npm for new versions`),children:[a(C,{className:`w-3 h-3 ${b?`animate-spin`:``}`}),e(`admin.system.addons.checkForUpdates`,`Check for updates`)]})]})]}),a(X,{staleNodeId:m,shownNodeName:f.name}),a(jt,{selectedNode:f}),a(Ut,{addons:T,clusterStatus:i,selectedNode:f,onRefresh:()=>void x(),listPhase:g?`pending`:_?`error`:`ready`})]})}export{Wt as AddonsPage};
@@ -1,3 +0,0 @@
1
- import{C as e,J as t,K as n,R as r,S as i,V as a,Y as o,a as s,et as c,o as l,t 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{$i as d,$r as f,D as p,Fn as m,G as h,L as g,Pn as _,Q as v,Qt as y,St as b,aa as x,dn as S,gn as C,gt as w,jr as T,mi as E,ut as D}from"./player-overlays-Bs9A8fez.js";import{ci as O}from"./client-BD4NsqEN.js";import{n as k,t as A}from"./send-D_NAoo3n.js";import{t as j}from"./message-square-plus-_aGccjyj.js";import{Jd as M,Kd as N,Kn as P,Lf as F,Mi as I,U as ee,Wn as L,Yd as R,ff as te,if as z,ji as ne,mi as re,ot as B,pf as ie,qn as V,si as H,yr as ae,zo as U}from"./src-CNcEcLrI.js";import{t as W}from"./i18n-EpyjWJGh.js";import{t as G}from"./useTranslation-BJr-n0es.js";import"./mount-Du6UAsiy.js";import{Qr as oe,X as K,x as q}from"./index-C_D8eRsf.js";import{t as J}from"./AdminSectionedPage-DC99_NYO.js";import{t as se}from"./AdminPage-aLHp47jf.js";import{t as ce}from"./InstancesTable-DZHp204O.js";import{a as le,c as ue,d as de,f as fe,i as pe,l as Y,n as me,o as he,p as ge,r as _e,s as X,t as ve,u as ye}from"./ai-page.helpers-DLFlpj3G.js";c();function be(){let{t}=G(),n=w(),r=I({functionCap:`llm`}).data??[],a=s({queryKey:me,queryFn:()=>n.trpcClient.llm.getDefaults.query({})}),o=u({mutationFn:e=>n.trpcClient.llm.setDefault.mutate({selector:{purpose:e.purpose},profileId:e.profileId}),onSuccess:()=>{a.refetch()}}),c=e=>(a.data??[]).find(t=>`purpose`in t.selector&&t.selector.purpose===e)?.profileId??``,l=e=>e===`vision`?t(`ai.defaultVision`,`Default vision profile`):t(`ai.defaultText`,`Default text profile`);return i(L,{headingId:`ai-profiles-defaults`,title:t(`ai.defaultsTitle`,`Defaults`),children:i(`div`,{className:`${p} grid gap-4 sm:grid-cols-2`,children:_e.map(({purpose:n,visionOnly:a})=>{let s=a?r.filter(Y):r,u=c(n),d=r.find(e=>e.id===u);return e(`div`,{children:[i(ae,{className:`mb-1 block`,htmlFor:`llm-default-${n}`,children:l(n)}),i(D,{id:`llm-default-${n}`,"aria-label":l(n),value:u,onChange:e=>o.mutate({purpose:n,profileId:e.target.value===``?null:e.target.value}),options:[{value:``,label:t(`ai.none`,`None`)},...u!==``&&!s.some(e=>e.id===u)?[{value:u,label:d?.name??u}]:[],...s.map(e=>({value:e.id,label:X(e)===``?e.name:`${e.name} · ${X(e)}`}))]}),u!==``&&d===void 0&&i(`p`,{className:`mt-1 text-xs text-danger`,children:t(`ai.defaultMissing`,`This default names a profile that no longer exists.`)}),d!==void 0&&!d.enabled&&i(`p`,{className:`mt-1 text-xs text-warning`,children:t(`ai.defaultDisabled`,`This default profile is disabled — callers resolve to no profile.`)}),o.error!=null&&i(`p`,{className:`mt-1 text-xs text-danger`,children:String(o.error)})]},n)})})})}var xe=2e3;function Z(e){return W.t(`system.aiModelPicker.sizeGb`,{value:(e/1e9).toFixed(2)})}function Se(e){return e===null?``:e.model.kind===`catalog`?`catalog:${e.model.catalogId}`:e.model.kind===`path`?`node:${e.modelId}`:`custom`}function Ce({nodeId:t,value:r,onChange:a}){let{t:c}=G(),l=w(),[d,f]=o(``),[p,h]=o(null),[g,_]=o(!1),v=s({queryKey:ve,queryFn:()=>l.trpcClient.llm.listModelCatalog.query({})}),y=s({queryKey:[`llm`,`listNodeModels`,t],queryFn:()=>l.trpcClient.llm.listNodeModels.query({nodeId:t})}),b=u({mutationFn:e=>l.trpcClient.llm.resolveModelRef.mutate(e),onSuccess:e=>{h(e),_(!1),e.ok&&a({model:e.model,modelId:e.label,supportsVision:e.purpose===`vision`})}}),x=u({mutationFn:e=>l.trpcClient.llm.installModel.mutate({nodeId:t,model:e}),onSuccess:()=>{_(!0),y.refetch()}}),S=s({queryKey:pe,enabled:x.isPending,refetchInterval:x.isPending?xe:!1,queryFn:()=>l.trpcClient.llm.listRuntimeNodes.query({})}).data?.find(e=>e.nodeId===t)?.status?.download,C=n(()=>{let e=(v.data??[]).map(e=>({value:`catalog:${e.id}`,label:`${e.label} · ${e.quantization} · ${Z(e.sizeBytes)}`})),n=(y.data??[]).filter(e=>e.catalogId===void 0&&e.path!==void 0).map(e=>({value:`node:${e.file}`,label:c(`ai.onNode`,`{{file}} · {{size}} · on {{node}}`,{file:e.file,size:Z(e.sizeBytes),node:t})})),r=p?.ok===!0?[{value:`custom`,label:`${p.label} · ${Z(p.totalBytes)}`}]:[];return[{value:``,label:c(`ai.selectModel`,`Select a model…`)},...e,...n,...r]},[v.data,y.data,p,t,c]),O=e=>{if(e===``){a(null);return}if(e===`custom`){if(p?.ok!==!0)return;a({model:p.model,modelId:p.label,supportsVision:p.purpose===`vision`});return}if(e.startsWith(`catalog:`)){let t=e.slice(8),n=v.data?.find(e=>e.id===t);a({model:{kind:`catalog`,catalogId:t},modelId:t,supportsVision:n?.purpose===`vision`});return}let t=e.slice(5),n=y.data?.find(e=>e.file===t);n?.path!==void 0&&a({model:{kind:`path`,path:n.path},modelId:t,supportsVision:!1})},k=e=>{d.trim()!==``&&b.mutate({ref:d.trim(),...e===void 0?{}:{maxBytes:e}})};return e(`div`,{className:`space-y-3`,children:[i(B,{label:c(`ai.model`,`Model`),required:!0,children:i(D,{id:`ai-model`,"aria-label":c(`ai.model`,`Model`),value:Se(r),options:C,onChange:e=>O(e.target.value)})}),i(B,{label:c(`ai.hfTitle`,`Add a model from Hugging Face`),description:c(`ai.hfHint`,`Paste a GGUF file URL, or type org/repo — add :QUANT (e.g. unsloth/Qwen3.6-35B-A3B-GGUF:UD-Q4_K_M) when the repo publishes more than one quantization.`),children:e(`div`,{className:`flex gap-2`,children:[i(te,{"aria-label":c(`ai.hfTitle`,`Add a model from Hugging Face`),value:d,onChange:e=>f(e.target.value),placeholder:c(`system.aiModelPicker.unslothQwen3635bA3b`,`unsloth/Qwen3.6-35B-A3B-GGUF:UD-Q4_K_M`),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),k())}}),e(z,{size:`sm`,variant:`secondary`,type:`button`,disabled:d.trim()===``||b.isPending,onClick:()=>k(),children:[b.isPending?i(T,{className:`h-3.5 w-3.5 animate-spin`}):i(m,{className:`h-3.5 w-3.5`}),c(`ai.hfCheck`,`Check`)]})]})}),b.isError&&i(N,{message:b.error instanceof Error?b.error.message:c(`common.error`,`Error`)}),p?.ok===!1&&i(N,{message:p.message,action:e(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(p.candidates??[]).map(e=>i(z,{size:`sm`,variant:`outline`,type:`button`,onClick:()=>{let t=`${d.trim().split(`:`)[0]??``}:${e}`;f(t),b.mutate({ref:t})},children:e},e)),p.requiredBytes!==void 0&&i(z,{size:`sm`,variant:`secondary`,type:`button`,onClick:()=>k(p.requiredBytes),children:c(`ai.hfOverride`,`Install anyway ({{size}})`,{size:Z(p.requiredBytes)})})]})}),p?.ok===!0&&e(`div`,{className:`space-y-2 rounded-md border border-border bg-surface p-2.5`,children:[e(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[i(`span`,{className:`text-[11px] font-medium text-foreground`,children:p.label}),i(M,{variant:p.purpose===`vision`?`info`:`default`,children:p.purpose}),i(M,{variant:`default`,children:Z(p.totalBytes)})]}),p.extraFilenames.length>0&&i(`p`,{className:`text-[10px] text-foreground-subtle`,children:c(`ai.hfExtras`,`Also downloads: {{files}}`,{files:p.extraFilenames.join(`, `)})}),e(`div`,{className:`flex items-center gap-2`,children:[e(z,{size:`sm`,type:`button`,disabled:x.isPending||g,onClick:()=>x.mutate(p.model),children:[x.isPending?i(T,{className:`h-3.5 w-3.5 animate-spin`}):i(E,{className:`h-3.5 w-3.5`}),g?c(`ai.hfInstalled`,`Downloaded`):c(`ai.hfInstall`,`Download to {{node}}`,{node:t})]}),S!==void 0&&i(`span`,{className:`text-[10px] text-foreground-subtle`,children:S.phase===`verifying`?c(`ai.hfVerifying`,`verifying {{file}}…`,{file:S.file}):c(`ai.hfDownloading`,`{{file}} ({{index}}/{{count}}) — {{done}}{{total}}`,{file:S.file,index:S.fileIndex,count:S.fileCount,done:Z(S.downloadedBytes),total:S.totalBytes===void 0?``:` / ${Z(S.totalBytes)}`})})]}),x.isError&&i(N,{message:x.error instanceof Error?x.error.message:c(`common.error`,`Error`)})]})]})}function we({value:t,onChange:n}){let{t:r}=G(),a=w(),o=s({queryKey:pe,queryFn:()=>a.trpcClient.llm.listRuntimeNodes.query({})});return e(`div`,{children:[i(`div`,{className:`mb-1 text-[11px] font-medium text-foreground`,children:r(`ai.appleNode`,`Mac that runs it`)}),o.isPending&&e(`div`,{className:`flex items-center gap-1.5 text-[11px] text-foreground-subtle`,children:[i(T,{className:`h-3.5 w-3.5 animate-spin`}),r(`ai.appleAsking`,`Asking the nodes…`)]}),o.isError&&i(`p`,{className:`text-[11px] text-danger`,children:o.error instanceof Error?o.error.message:r(`ai.runtimesFailed`,`Failed to read runtime nodes`)}),o.isSuccess&&o.data.length===0&&i(`p`,{className:`text-[11px] text-foreground-subtle`,children:r(`ai.noRuntimes`,`No node advertises the llm-runtime capability.`)}),o.isSuccess&&o.data.length>0&&i(`div`,{role:`radiogroup`,className:`space-y-1.5`,children:o.data.map(a=>{let o=he(a),s=o.nodeId===t;return e(z,{variant:`unstyled`,type:`button`,role:`radio`,"aria-checked":s,disabled:!o.selectable&&!s,onClick:()=>n(o.nodeId),className:`flex w-full items-center justify-between gap-2 rounded-md border px-3 py-2 text-left text-xs transition-colors disabled:cursor-not-allowed disabled:opacity-60 ${s?`border-primary bg-primary/10`:`border-border bg-surface hover:bg-surface-hover`}`,children:[e(`span`,{className:`min-w-0`,children:[i(`span`,{className:`block font-medium text-foreground`,children:o.nodeId}),o.detail!==null&&i(`span`,{className:`block truncate text-[10px] text-foreground-subtle`,children:o.detail})]}),i(M,{variant:o.tone,children:r(o.labelKey,o.labelDefault)})]},o.nodeId)})}),i(`p`,{className:`mt-1.5 text-[10px] leading-relaxed text-foreground-subtle`,children:r(`ai.appleHint`,`Text only for now — notification titles and summaries. Apple refuses prompts framed as surveillance; when it does, the next profile in the chain answers instead.`)})]})}function Te(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:null}function Ee({providerConfig:e,onProviderConfigChange:t}){return i(we,{value:Te(e,`nodeId`),onChange:n=>t({...e,nodeId:n})})}function De({providerConfig:e,onProviderConfigChange:t,model:n,onModelChange:r}){let a=O.safeParse(e.model),o=a.success?{model:a.data,modelId:n.id,supportsVision:n.supportsVision}:null;return i(Ce,{nodeId:Te(e,`nodeId`)??`hub`,value:o,onChange:n=>{if(n===null){let{model:n,...i}=e;t(i),r({id:``,supportsVision:!1});return}t({...e,model:n.model}),r({id:n.modelId,supportsVision:n.supportsVision})}})}var Oe=new Map([[`ai/apple-node`,Ee],[`ai/managed-model`,De]]);function ke(e){return Oe.get(e)??null}c();function Q(e,t){let n=e[t];return typeof n==`string`?n:``}function Ae({row:a}){let{t:c}=G(),d=w(),f=l(),p=s({queryKey:n(()=>[K,a.addonId,`ai-lead`,a.id],[a]),queryFn:async()=>{let e=d.trpcClient.integrationInstances,[t,n]=await Promise.all([e.describe.query({addonId:a.addonId}),e.getInstance.query({addonId:a.addonId,id:a.id})]);return{description:t,instance:n}}}),[m,h]=o({}),g=t({}),_=t(!1),v=u({mutationFn:e=>d.trpcClient.integrationInstances.updateInstance.mutate({addonId:a.addonId,id:a.id,values:e}),onSuccess:async()=>{await f.invalidateQueries({queryKey:[K]}),await f.invalidateQueries({queryKey:[ne]}),h({})}}),y=r(e=>{g.current={...g.current,...e},h(t=>({...t,...e})),!_.current&&(_.current=!0,queueMicrotask(()=>{let e=g.current;g.current={},_.current=!1,v.mutate(e)}))},[v]),b=p.data?.description.kinds?.find(e=>e.id===a.kindId),x=p.data?.instance?.formValues,S=n(()=>({...x,...m}),[x,m]),C=b?.widgets??[],E=C.some(e=>e.placement===`model`),O=n(()=>({...Q(S,`nodeId`)===``?{}:{nodeId:Q(S,`nodeId`)},...typeof S.modelRef==`object`&&S.modelRef!==null?{model:S.modelRef}:{}}),[S]),k={id:Q(S,`model`),supportsVision:S.supportsVision===!0},A=u({mutationFn:()=>d.trpcClient.llm.listModels.mutate({addonId:a.addonId,kind:a.kindId??``,profileId:a.id})});if(p.isPending)return null;if(p.isError)return i(N,{variant:`warning`,message:p.error.message});let j=A.data?.ok===!0?A.data.models:[],M=A.data?.ok===!1?A.data:null,P=e=>{let t=j.find(t=>t.id===e);y({model:e,...t?.features?.vision===void 0?{}:{supportsVision:t.features.vision}})};return e(`div`,{className:`space-y-3`,"data-testid":`ai-profile-lead`,children:[C.map(({id:e})=>{let t=ke(e);return t===null?i(N,{variant:`warning`,message:c(`ai.unknownWidget`,`This provider needs an editor part this build does not have ({{id}}).`,{id:e})},e):i(t,{providerConfig:O,onProviderConfigChange:e=>y({...Q(e,`nodeId`)===Q(O,`nodeId`)?{}:{nodeId:Q(e,`nodeId`)},...e.model!==void 0&&e.model!==O.model?{modelRef:e.model}:{}}),model:k,onModelChange:e=>y({model:e.id,supportsVision:e.supportsVision})},e)}),!E&&e(B,{label:c(`ai.model`,`Model`),children:[e(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e(z,{size:`sm`,variant:`secondary`,type:`button`,disabled:A.isPending,onClick:()=>A.mutate(),children:[A.isPending?i(T,{className:`h-3.5 w-3.5 animate-spin`}):null,c(`ai.loadModels`,`Load models`)]}),j.length>0&&i(D,{"aria-label":c(`ai.model`,`Model`),value:k.id,onChange:e=>P(e.target.value),options:[...j.some(e=>e.id===k.id)||k.id===``?[]:[{value:k.id,label:k.id}],...j.map(e=>({value:e.id,label:e.label??e.id}))]})]}),M!==null&&i(`p`,{className:`mt-1 text-xs text-danger`,children:M.message}),A.isError&&i(`p`,{className:`mt-1 text-xs text-danger`,children:A.error.message})]}),v.isError&&i(N,{variant:`warning`,message:v.error.message})]})}c();var je=5e3;function Me(e){return W.t(`system.aiRuntimes.sizeGb`,{value:(e/1e9).toFixed(1)})}function Ne(){let{t}=G(),r=w(),a=s({queryKey:pe,refetchInterval:je,queryFn:()=>r.trpcClient.llm.listRuntimeNodes.query({})}),o=n(()=>[{key:`node`,header:t(`ai.colNode`,`Node`),render:e=>i(`span`,{className:`font-medium text-foreground`,children:e.nodeId})},{key:`state`,header:t(`ai.colState`,`State`),nowrap:!0,render:n=>e(`span`,{className:`flex items-center gap-1.5`,children:[i(M,{variant:ge(n),children:t(fe(n))}),n.status?.downloadProgress!==void 0&&i(M,{variant:`info`,children:`${String(Math.round(n.status.downloadProgress*100))}%`})]})},{key:`model`,header:t(`ai.colModel`,`Model`),render:e=>i(`span`,{className:`text-foreground`,children:e.status?.modelId??`—`})},{key:`disk`,header:t(`ai.colDisk`,`On disk`),align:`right`,nowrap:!0,render:e=>i(`span`,{className:`tabular-nums text-foreground-muted`,children:e.disk===void 0?`—`:Me(e.disk.modelsBytes)})},{key:`features`,header:t(`ai.colFeature`,`Feature`),render:n=>{let r=de(n);if(r.length===0)return i(`span`,{className:`text-foreground-subtle`,children:`—`});let a=r.flatMap(e=>e.detail===null?[]:[e.detail]);return e(`span`,{className:`flex flex-col items-start gap-0.5`,children:[i(`span`,{className:`flex flex-wrap gap-1`,children:r.map(e=>i(M,{variant:e.tone,children:t(e.labelKey)},e.id))}),a.length>0&&i(`span`,{className:`text-foreground-subtle`,children:a.join(` · `)})]})}},{key:`error`,header:t(`ai.colError`,`Error`),render:e=>e.error===void 0?i(`span`,{className:`text-foreground-subtle`,children:`—`}):i(`span`,{className:`text-danger`,children:e.error})}],[t]),c=a.data??[];return i(L,{headingId:`ai-runtimes-list`,title:t(`ai.runtimesList`,`Nodes`),children:a.isPending?e(`div`,{className:`${p} space-y-2`,"data-testid":`ai-runtimes-loading`,children:[i(R,{className:`h-8 w-full`}),i(R,{className:`h-8 w-full`})]}):a.isError?i(`div`,{className:p,children:i(N,{title:t(`ai.runtimesFailed`,`Failed to read runtime nodes`),message:a.error instanceof Error?a.error.message:t(`common.error`,`Error`),onRetry:()=>void a.refetch()})}):c.length===0?i(H,{icon:_,title:t(`ai.noRuntimesTitle`,`No runtime nodes`),description:t(`ai.noRuntimes`,`No node advertises the llm-runtime capability.`)}):i(P,{columns:o,rows:c,rowKey:e=>e.nodeId,minWidthPx:760,bordered:!1,maxBodyHeight:V})})}var Pe=v(`/addon/ai/test-chat`),Fe=v(`/addon/ai/test-chat/chats`),Ie=6e5;function Le(e){let t=e.firstTokenTimeoutMs;if(!(typeof t!=`number`||!Number.isFinite(t)||t<=0))return Math.min(Math.round(t),Ie)}function Re(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ze(e){if(!Re(e))return null;let t=e.kind;return t!==`snapshot`&&t!==`track`||typeof e.mimeType!=`string`||typeof e.sizeBytes!=`number`?null:{kind:t,mimeType:e.mimeType,sizeBytes:e.sizeBytes,...typeof e.mediaKind==`string`?{mediaKind:e.mediaKind}:{},...typeof e.capturedAt==`number`?{capturedAt:e.capturedAt}:{},...typeof e.thumbnailBase64==`string`?{thumbnailBase64:e.thumbnailBase64}:{}}}var Be=[`resolving-image`,`connecting`,`first-token-wait`,`streaming`];function Ve(e){let t;try{t=JSON.parse(e)}catch{return null}if(!Re(t))return null;switch(t.kind){case`status`:{let e=Be.find(e=>e===t.phase);return e===void 0?null:{kind:`status`,phase:e}}case`meta`:return typeof t.profileName!=`string`||typeof t.model!=`string`?null:{kind:`meta`,profileName:t.profileName,model:t.model,mediaSent:ze(t.mediaSent),streamed:t.streamed===!0,firstTokenTimeoutMs:typeof t.firstTokenTimeoutMs==`number`?t.firstTokenTimeoutMs:0};case`token`:return typeof t.text==`string`?{kind:`token`,text:t.text}:null;case`done`:return{kind:`done`,inputTokens:typeof t.inputTokens==`number`?t.inputTokens:0,outputTokens:typeof t.outputTokens==`number`?t.outputTokens:0,latencyMs:typeof t.latencyMs==`number`?t.latencyMs:0,truncated:t.truncated===!0,...typeof t.conversationId==`string`?{conversationId:t.conversationId}:{}};case`error`:return{kind:`error`,code:typeof t.code==`string`?t.code:`adapter-error`,message:typeof t.message==`string`?t.message:W.t(`helpers.aiTestChat.providerError`)};default:return null}}async function*He(e){let t=e.getReader(),n=new TextDecoder,r=``;try{for(;;){let{done:e,value:i}=await t.read();if(e)break;r+=n.decode(i,{stream:!0});let a=r.indexOf(`
2
- `);for(;a>=0;){let e=r.slice(0,a).trim();if(r=r.slice(a+1),e.length>0){let t=Ve(e);t!==null&&(yield t)}a=r.indexOf(`
3
- `)}}let e=r.trim();if(e.length>0){let t=Ve(e);t!==null&&(yield t)}}finally{t.releaseLock()}}function Ue(e){return e.filter(e=>e.failed!==!0&&e.content.length>0).map(e=>({role:e.role,content:e.content}))}function We(e){return e.thumbnailBase64===void 0||e.thumbnailBase64.length===0?null:`data:${e.mimeType};base64,${e.thumbnailBase64}`}function Ge(e){return e.messages.map((t,n)=>{let r=t.mediaSent??void 0;return{id:`${e.id}-${String(n)}`,role:t.role,content:t.content,...t.attachment===void 0?{}:{attachmentRef:t.attachment,attachmentKind:t.attachment.kind},...r===void 0?{}:{attachment:r}}})}function Ke(e){let t=e.sizeBytes<1024*1024?`${(e.sizeBytes/1024).toFixed(0)} KB`:`${(e.sizeBytes/(1024*1024)).toFixed(1)} MB`,n=[e.kind===`snapshot`?`camera snapshot`:`track best-shot`,t];return e.mediaKind!==void 0&&n.push(e.mediaKind),e.capturedAt!==void 0&&n.push(new Date(e.capturedAt).toLocaleTimeString()),n.join(` · `)}function qe(e,t){switch(e){case`resolving-image`:return W.t(`helpers.aiTestChat.phaseImage`);case`connecting`:return W.t(`helpers.aiTestChat.phaseConnecting`);case`first-token-wait`:return t>0?W.t(`helpers.aiTestChat.phaseWaitUpTo`,{seconds:Math.round(t/1e3)}):W.t(`helpers.aiTestChat.phaseWait`);case`streaming`:return W.t(`helpers.aiTestChat.phaseAnswering`)}}c();var Je=[`pipelineAnalytics`,`listRecentTracks`,`ai-test`],Ye=360*60*1e3,Xe=40,Ze=160,$={phase:`connecting`,firstTokenTimeoutMs:0,text:``,mediaSent:null};function Qe(){let{t:s}=G();w();let[c,l]=o(``),[u,f]=o(``),[m,h]=o(``),[_,v]=o([]),[C,T]=o(null),[E,O]=o(`none`),[k,M]=o(`throwaway`),[P,F]=o(null),[R,ne]=o([]),[re,B]=o(null),[V,H]=o(null),U=t(null);a(()=>()=>U.current?.abort(),[]);let W=r(async()=>{let e=await fetch(Fe,{credentials:`same-origin`});e.ok&&ne((await e.json()).chats??[])},[]);a(()=>{k===`persistent`&&W()},[k,W]);let oe=I({functionCap:`llm`}),K=n(()=>(oe.data??[]).filter(e=>e.enabled),[oe.data]),q=K.find(e=>e.id===c)??null,J=V!==null,se=r(async(e,t)=>{let n=new AbortController;U.current=n,B(null);let r=Le(q===null?{}:ye(q));H({...$,firstTokenTimeoutMs:r??0});let i=``,a=null,o,l=null,d=null,f;try{let s=await fetch(Pe,{method:`POST`,headers:{"content-type":`application/json`},credentials:`same-origin`,signal:n.signal,body:JSON.stringify({profileId:c,messages:e,...u.trim()===``?{}:{system:u.trim()},...t===void 0?{}:{attachment:t},...r===void 0?{}:{firstTokenTimeoutMs:r},...k===`persistent`?{persist:!0,...P===null?{}:{conversationId:P}}:{}})});if(!s.ok||s.body===null){let e=await s.text().catch(()=>``);throw Error(e.length>0?e:`HTTP ${String(s.status)}`)}for await(let e of He(s.body))switch(e.kind){case`status`:H(t=>({...t??$,phase:e.phase}));break;case`meta`:a=e.mediaSent,o=e.model,H(t=>({...t??$,firstTokenTimeoutMs:e.firstTokenTimeoutMs,mediaSent:e.mediaSent}));break;case`token`:i+=e.text,H(e=>({...e??$,text:i}));break;case`done`:d={outputTokens:e.outputTokens,latencyMs:e.latencyMs},f=e.conversationId;break;case`error`:l=`${e.code}: ${e.message}`;break}}catch(e){n.signal.aborted||B(e instanceof Error?e.message:s(`common.error`,`Error`))}finally{U.current=null,H(null)}f!==void 0&&(F(f),W());let p=n.signal.aborted&&i.length>0;l===null&&i.length===0&&!p||v(e=>[...e,{id:`a-${String(Date.now())}`,role:`assistant`,content:l??i,...l===null?{}:{failed:!0},...a===null?{}:{attachment:a},...o!==void 0&&l===null?{model:o}:{},...d===null?{}:d}])},[k,P,q,c,W,u,s]),ce=r(()=>{let e=m.trim();if(e===``||c===``||J)return;let t={id:`u-${String(Date.now())}`,role:`user`,content:e,...C===null?{}:{attachmentLabel:C.label,attachmentKind:C.ref.kind}},n=[..._,t];v(n),h(``);let r=C?.ref;T(null),O(`none`),se(k===`persistent`&&P!==null?[{role:`user`,content:e}]:Ue(n),r)},[k,P,m,C,c,se,J,_]),le=()=>U.current?.abort(),ue=()=>{U.current?.abort(),v([]),T(null),h(``),B(null),H(null),F(null)},de=async e=>{U.current?.abort();let t=await fetch(`${Fe}/${e}`,{credentials:`same-origin`});if(!t.ok)return;let n=await t.json();F(e),v(Ge(n)),H(null),B(null)};return e(`div`,{className:g,children:[i(L,{headingId:`ai-test-setup`,title:s(`ai.testSetup`,`Setup`),children:e(`div`,{className:`${p} space-y-3`,children:[e(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[e(`div`,{children:[i(ae,{className:`mb-1 block`,htmlFor:`ai-test-profile`,children:s(`ai.profile`,`Profile`)}),i(D,{id:`ai-test-profile`,value:c,onChange:e=>l(e.target.value),options:[{value:``,label:s(`ai.selectProfile`,`Select a profile…`)},...K.map(e=>({value:e.id,label:`${e.name} · ${X(e)}${Y(e)?` · vision`:``}`}))]}),K.length===0&&!oe.isLoading&&i(`p`,{className:`mt-1 text-xs text-foreground-subtle`,children:s(`ai.noEnabledProfiles`,`No enabled profile. Add one on the Profiles tab.`)})]}),e(`div`,{children:[i(ae,{className:`mb-1 block`,htmlFor:`ai-test-system`,children:s(`ai.systemPrompt`,`System prompt (optional)`)}),i(te,{id:`ai-test-system`,value:u,onChange:e=>f(e.target.value),placeholder:s(`ai.systemPlaceholder`,`Answer in one short sentence.`)})]})]}),i(ee,{label:s(`ai.chatMode`,`Conversation mode`),value:k,options:[{value:`throwaway`,label:s(`ai.throwawayMode`,`Throwaway`)},{value:`persistent`,label:s(`ai.saveConversation`,`Save conversation`)}],onChange:e=>{M(e),e===`throwaway`&&F(null)}}),k===`persistent`&&e(`div`,{className:`space-y-2`,children:[i(`p`,{className:`text-xs text-foreground-subtle`,children:s(`ai.testSubtitlePersistent`,`Conversations are saved for you and can be reopened. Throwaway mode is still available.`)}),e(z,{size:`sm`,variant:`secondary`,type:`button`,onClick:ue,children:[i(j,{className:`h-3.5 w-3.5`}),s(`ai.newChat`,`New chat`)]}),R.length>0&&i(`div`,{className:`max-h-36 divide-y divide-border overflow-y-auto rounded-md border border-border`,children:R.map(e=>i(`button`,{type:`button`,onClick:()=>void de(e.id),className:`flex w-full px-2.5 py-1.5 text-left text-xs hover:bg-surface-hover ${e.id===P?`bg-primary/10`:``}`,children:i(`span`,{className:`min-w-0 flex-1 truncate text-foreground`,children:e.title})},e.id))})]}),i(`p`,{className:`text-xs text-foreground-subtle`,children:s(`ai.streamNote`,`The answer streams as the model produces it. A cold model can take a while to load — the status line says which phase it is in.`)}),q!==null&&!Y(q)&&i(`p`,{className:`text-xs text-warning`,children:s(`ai.notVision`,`This profile is not vision-capable — an attached image will be refused before anything is read.`)})]})}),re!==null&&i(N,{title:s(`ai.chatFailed`,`The test call failed`),message:re}),e(L,{headingId:`ai-test-conversation`,title:s(`ai.testConversation`,`Conversation`),actions:e(z,{size:`sm`,variant:`ghost`,type:`button`,disabled:_.length===0&&C===null,onClick:ue,children:[i(y,{className:`h-3.5 w-3.5`}),s(`ai.clearChat`,`Clear`)]}),children:[i($e,{turns:_,live:V}),e(`div`,{className:`${p} space-y-2 border-t border-border`,children:[C!==null&&e(`div`,{className:`flex items-center gap-2 rounded-md border border-border bg-background px-2.5 py-1.5`,children:[C.ref.kind===`snapshot`?i(d,{className:`h-3.5 w-3.5 text-foreground-subtle`}):i(x,{className:`h-3.5 w-3.5 text-foreground-subtle`}),i(`span`,{className:`min-w-0 flex-1 truncate text-xs text-foreground`,children:C.label}),i(ie,{size:`sm`,variant:`ghost`,type:`button`,icon:b,"aria-label":s(`ai.removeAttachment`,`Remove attachment`),onClick:()=>T(null)})]}),e(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e(z,{size:`sm`,variant:E===`snapshot`?`primary`:`outline`,type:`button`,onClick:()=>O(E===`snapshot`?`none`:`snapshot`),children:[i(d,{className:`h-3.5 w-3.5`}),s(`ai.attachSnapshot`,`Camera snapshot`)]}),e(z,{size:`sm`,variant:E===`track`?`primary`:`outline`,type:`button`,onClick:()=>O(E===`track`?`none`:`track`),children:[i(x,{className:`h-3.5 w-3.5`}),s(`ai.attachTrack`,`Recent track`)]})]}),E===`snapshot`&&i(nt,{onPick:(e,t)=>{T({ref:{kind:`snapshot`,deviceId:e.id},label:s(`ai.snapshotOf`,`Snapshot of {{name}}`,{name:t})}),O(`none`)}}),E===`track`&&i(it,{onPick:(e,t)=>{T({ref:{kind:`track`,trackId:e.trackId,deviceId:e.deviceId},label:s(`ai.trackOf`,`{{class}} on {{name}}`,{class:e.label??e.className,name:t})}),O(`none`)}}),e(`div`,{className:`flex items-center gap-2`,children:[i(te,{value:m,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),ce())},placeholder:s(`ai.messagePlaceholder`,`Ask the model something…`),"aria-label":s(`ai.message`,`Message`)}),J?e(z,{size:`sm`,variant:`secondary`,type:`button`,onClick:le,children:[i(S,{className:`h-3.5 w-3.5`}),s(`ai.stop`,`Stop`)]}):e(z,{size:`sm`,type:`button`,disabled:m.trim()===``||c===``,onClick:ce,children:[i(A,{className:`h-3.5 w-3.5`}),s(`ai.send`,`Send`)]})]})]})]})]})}function $e({turns:t,live:n}){let{t:r}=G();return t.length===0&&n===null?i(H,{icon:k,title:r(`ai.chatEmptyTitle`,`No messages yet`),description:r(`ai.chatEmpty`,`Pick a profile, optionally attach a camera snapshot or a recent track, and send a message. Nothing here is saved.`)}):e(`div`,{className:`max-h-[50vh] space-y-2 overflow-y-auto ${p}`,children:[t.map(e=>i(et,{turn:e},e.id)),n!==null&&e(`div`,{className:`space-y-1`,children:[n.mediaSent!==null&&i(tt,{attachment:n.mediaSent}),n.text.length>0&&i(et,{turn:{id:`live`,role:`assistant`,content:n.text},streaming:!0}),e(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[i(T,{className:`h-3.5 w-3.5 animate-spin`}),qe(n.phase,n.firstTokenTimeoutMs)]})]})]})}function et({turn:t,streaming:n=!1}){let{t:r}=G(),a=t.role===`user`,o=t.failed===!0?`border-danger/40 bg-danger/10`:`border-border bg-surface`;return i(`div`,{className:`flex ${a?`justify-end`:`justify-start`}`,children:e(`div`,{className:`max-w-[85%] rounded-lg border px-3 py-2 ${a?`border-primary/40 bg-primary/10`:o}`,children:[e(`p`,{className:`whitespace-pre-wrap break-words text-xs text-foreground`,children:[t.content,n&&i(`span`,{className:`ml-0.5 animate-pulse text-primary`,children:`▌`})]}),t.attachment!==void 0&&i(tt,{attachment:t.attachment}),t.attachmentLabel!==void 0&&e(`p`,{className:`mt-1 flex items-center gap-1 text-[10px] text-foreground-subtle`,children:[t.attachmentKind===`track`?i(x,{className:`h-3 w-3`}):i(d,{className:`h-3 w-3`}),t.attachmentLabel]}),t.attachment!==void 0&&e(`p`,{className:`mt-1 flex items-center gap-1 text-[10px] text-foreground-subtle`,children:[t.attachment.kind===`snapshot`?i(d,{className:`h-3 w-3`}):i(x,{className:`h-3 w-3`}),Ke(t.attachment)]}),t.model!==void 0&&i(`p`,{className:`mt-1 text-[10px] text-foreground-subtle`,children:r(`system.aiTestChat.tokMs`,`{{model}} · {{value2}} tok · {{value3}} ms`,{model:t.model,value2:String(t.outputTokens??0),value3:String(t.latencyMs??0)})})]})})}function tt({attachment:e}){let{t}=G(),n=We(e);return n===null?null:i(`img`,{src:n,alt:t(`system.aiTestChat.sentToTheModel`,`sent to the model`),className:`mt-1 max-h-32 rounded-md border border-border object-contain`})}function nt({onPick:e}){let{t}=G(),n=U({isCamera:!0,projection:`slim`}),r=(n.data??[]).filter(e=>!e.disabled);return n.isLoading?i(T,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):r.length===0?i(`p`,{className:`text-[11px] text-foreground-subtle`,children:t(`ai.noCameras`,`No camera found.`)}):i(`div`,{className:`grid max-h-56 grid-cols-2 gap-2 overflow-y-auto sm:grid-cols-4`,children:r.map(t=>i(rt,{device:t,onPick:e},t.id))})}function rt({device:t,onPick:n}){let{t:r}=G(),a=re(t,`compact`),{src:o}=h(t.id,{width:Ze});return e(`button`,{type:`button`,onClick:()=>n(t,a),className:`overflow-hidden rounded-md border border-border bg-surface text-left transition-colors hover:border-primary/50`,children:[i(`span`,{className:`block aspect-video w-full bg-background-elevated`,children:o!==null&&i(`img`,{src:o,alt:``,className:`h-full w-full object-cover`,loading:`lazy`})}),e(`span`,{className:`flex items-center gap-1 px-2 py-1`,children:[!t.online&&i(M,{variant:`warning`,children:r(`common.off`)}),i(`span`,{className:`truncate text-[10px] text-foreground`,children:a})]})]})}function it({onPick:t}){let{t:r}=G(),a=w(),o=U({isCamera:!0,projection:`slim`}),c=n(()=>(o.data??[]).map(e=>e.id),[o.data]),l=n(()=>{let e=new Map;for(let t of o.data??[])e.set(t.id,t.name);return e},[o.data]),u=s({queryKey:[...Je,c.length],enabled:c.length>0,queryFn:()=>a.trpcClient.pipelineAnalytics.listRecentTracks.query({deviceIds:[...c],since:Date.now()-Ye,limit:Xe,projection:`slim`})});if(o.isLoading||u.isLoading)return i(T,{className:`h-4 w-4 animate-spin text-foreground-subtle`});let d=u.data?.tracks??[];return d.length===0?i(`p`,{className:`text-[11px] text-foreground-subtle`,children:r(`ai.noTracks`,`No track in the last 6 hours.`)}):i(`div`,{className:`max-h-56 divide-y divide-border overflow-y-auto rounded-md border border-border`,children:d.map(n=>e(`button`,{type:`button`,onClick:()=>t(n,l.get(n.deviceId)??String(n.deviceId)),className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-[11px] hover:bg-surface-hover`,children:[i(x,{className:`h-3.5 w-3.5 shrink-0 text-foreground-subtle`}),i(`span`,{className:`min-w-0 flex-1 truncate text-foreground`,children:n.label??n.className}),i(`span`,{className:`shrink-0 text-foreground-subtle`,children:l.get(n.deviceId)??n.deviceId}),i(`span`,{className:`shrink-0 text-foreground-subtle`,children:new Date(n.lastSeen).toLocaleTimeString()})]},n.trackId))})}c();var at=1440*60*1e3,ot=[1,7,30,90];function st(){let{t}=G(),r=w(),[a,c]=o(7),l=n(()=>{let e=new Date;return e.setHours(0,0,0,0),e.getTime()-(a-1)*at},[a]),u=I({functionCap:`llm`}),d=s({queryKey:[...le,a],queryFn:()=>r.trpcClient.llm.getUsage.query({since:l})}),m=n(()=>{let e=new Map;for(let t of u.data??[])e.set(t.id,t.name);return e},[u.data]),h=n(()=>[{key:`day`,header:t(`ai.colDay`,`Day`),nowrap:!0,render:e=>i(`span`,{className:`tabular-nums`,children:e.day})},{key:`consumer`,header:t(`ai.colConsumer`,`Consumer`),nowrap:!0,render:e=>i(`span`,{className:`text-foreground`,children:e.consumer})},{key:`profile`,header:t(`ai.colProfile`,`Profile`),render:e=>i(`span`,{className:`text-foreground`,children:m.get(e.profileId)??e.profileId})},{key:`calls`,header:t(`ai.colCalls`,`Calls`),align:`right`,nowrap:!0,render:e=>i(`span`,{className:`tabular-nums`,children:String(e.calls)})},{key:`okErr`,header:t(`ai.colOkErr`,`OK / err`),align:`right`,nowrap:!0,render:e=>i(`span`,{className:`tabular-nums ${e.errorCalls>0?`text-danger`:``}`,children:`${String(e.okCalls)} / ${String(e.errorCalls)}`})},{key:`tokens`,header:t(`ai.colTokens`,`In / out tok`),align:`right`,nowrap:!0,render:e=>i(`span`,{className:`tabular-nums`,children:`${String(e.inputTokens)} / ${String(e.outputTokens)}`})},{key:`latency`,header:t(`ai.colAvgMs`,`Avg ms`),align:`right`,nowrap:!0,render:e=>i(`span`,{className:`tabular-nums`,children:String(Math.round(e.avgLatencyMs))})}],[m,t]),g=d.data??[],_=i(`div`,{className:`w-36`,children:i(D,{"aria-label":t(`ai.window`,`Window`),value:String(a),options:ot.map(e=>({value:String(e),label:t(`ai.lastDays`,`Last {{days}} days`,{days:e})})),onChange:e=>c(Number(e.target.value))})});return i(L,{headingId:`ai-usage-list`,title:t(`ai.usageList`,`Rollup`),actions:_,children:d.isPending?e(`div`,{className:`${p} space-y-2`,"data-testid":`ai-usage-loading`,children:[i(R,{className:`h-8 w-full`}),i(R,{className:`h-8 w-full`}),i(R,{className:`h-8 w-full`})]}):d.isError?i(`div`,{className:p,children:i(N,{title:t(`ai.usageFailed`,`Failed to read usage`),message:d.error instanceof Error?d.error.message:t(`common.error`,`Error`),onRetry:()=>void d.refetch()})}):g.length===0?i(H,{icon:f,title:t(`ai.noUsage`,`No AI calls in this window.`)}):i(P,{columns:h,rows:g,rowKey:e=>`${e.day}|${e.consumer}|${e.profileId}`,minWidthPx:720,bordered:!1,maxBodyHeight:V})})}c();var ct=`llm`,lt=[`profiles`,`runtimes`,`usage`,`test`],ut=[`instance`,`instance-new`];function dt(e){return lt.some(t=>t===e)}function ft(){let{t:e}=G(),t=F(ct),[n]=oe(),r=q(`/system/ai`,{t:e,isAdmin:!0})??{icon:C,title:e(`system.ai`,`AI`)};if(t!==`present`)return i(se,{icon:r.icon,title:r.title,children:i(gt,{presence:t})});let a=n.get(`tab`),o=dt(a)?a:`profiles`,s={profiles:e(`ai.profilesSubtitle`,`One row = one usable model endpoint. The defaults below decide who answers when a feature names no profile.`),runtimes:e(`ai.runtimesSubtitle`,`Nodes advertising the llm-runtime capability: what each has loaded, what it is downloading, and how much model data sits on its disk.`),usage:e(`ai.usageSubtitle`,`Server-side rollup per day, consumer and profile — never raw call rows. Errors are counted, so a profile that always fails is visible here before a feature reports it.`),test:e(`ai.testSubtitle`,`A throwaway conversation with one profile. Attach a live camera snapshot or a recent track to check the model can actually read a picture. Nothing is saved — only the usage row.`)};return i(J,{icon:r.icon,title:r.title,subtitle:s[o],defaultSection:`profiles`,sectionsLabel:`${r.title} sections`,sections:[{id:`profiles`,label:e(`ai.tabProfiles`,`Profiles`),content:i(ht,{}),ownedParams:ut},{id:`runtimes`,label:e(`ai.tabRuntimes`,`Runtimes`),content:i(Ne,{})},{id:`usage`,label:e(`ai.tabUsage`,`Usage`),content:i(st,{})},{id:`test`,label:e(`ai.tabTest`,`Test`),content:i(Qe,{})}]})}function pt(e,t,n){let r=e.kind===`instance`?t.get(e.id):void 0;return r===void 0?void 0:n(r)}function mt(e,t){let n=t=>pt(t,e,X)??``,r=t=>pt(t,e,Y)??!1,a=t=>pt(t,e,ue)??``;return[{key:`model`,header:t(`ai.colModel`,`Model`),sortValue:n,render:e=>i(`span`,{className:`font-mono text-xs text-foreground-muted`,children:n(e)||`—`})},{key:`vision`,header:t(`ai.colVision`,`Vision`),sortValue:e=>+!!r(e),render:e=>r(e)?i(M,{variant:`info`,children:t(`ai.vision`,`vision`)}):null},{key:`node`,header:t(`ai.colNode`,`Node`),sortValue:a,render:e=>i(`span`,{className:`text-xs text-foreground-muted`,children:a(e)||`—`})}]}function ht(){let{t}=G(),r=I({functionCap:ct}),a=n(()=>new Map((r.data??[]).map(e=>[e.id,e])),[r.data]),o=n(()=>mt(a,t),[a,t]);return e(`div`,{className:g,children:[i(be,{}),i(ce,{functionCap:ct,icon:C,title:t(`ai.profilesList`,`Profiles`),subtitle:t(`ai.profilesTableSubtitle`,`Each profile is one model endpoint; switch one off to keep it without using it.`),emptyTitle:t(`ai.noProfilesTitle`,`No AI profiles yet`),emptyDescription:t(`ai.noProfilesDescription`,`Add a profile to give features a model to talk to.`),addLabel:t(`ai.addProfile`,`Add profile`),extraColumns:o,lead:e=>i(Ae,{row:e})})]})}function gt({presence:t}){let{t:n}=G();return t===`pending`?e(`div`,{className:`space-y-3`,"data-testid":`ai-presence-pending`,children:[i(R,{className:`h-8 w-64`}),i(R,{className:`h-40 w-full`})]}):t===`unknown`?i(N,{title:n(`ai.presenceUnknownTitle`,`Could not check whether AI is installed`),message:n(`ai.presenceUnknown`,`The hub did not answer the capability check. Reload the page to try again.`)}):i(H,{icon:C,title:n(`ai.absentTitle`,`AI is not installed`),description:n(`ai.absentDescription`,`Install the AI addon from System → Addons to add model profiles.`)})}export{ft as AiProfilesPage,ft as default};