@camstack/addon-admin-ui 1.2.84 → 1.2.86

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 (111) hide show
  1. package/dist/assets/{AddLocationWizard-CNcGS2EP.js → AddLocationWizard-CVvsaNYx.js} +1 -1
  2. package/dist/assets/{AddonCollectionPage-SG0XXnDN.js → AddonCollectionPage-JA8tzL7q.js} +1 -1
  3. package/dist/assets/Addons-BOYMP0uf.js +1 -0
  4. package/dist/assets/{AdminTabs-Bml9sY2f.js → AdminTabs-B-UL_iuP.js} +1 -1
  5. package/dist/assets/{AiProfiles-Bkve7K-d.js → AiProfiles-DI31JvyZ.js} +1 -1
  6. package/dist/assets/{BrokerForm-CBVRdxmh.js → BrokerForm-CFTyH54D.js} +1 -1
  7. package/dist/assets/{Build-NxtOO0V2.js → Build-BP0Mx9FT.js} +4 -4
  8. package/dist/assets/{Capabilities-BROK90Se.js → Capabilities-BvxWbN6u.js} +1 -1
  9. package/dist/assets/{CapabilityBadges-CUituID7.js → CapabilityBadges-DjOvNnpp.js} +1 -1
  10. package/dist/assets/{Cluster-BrFa4n0G.js → Cluster-CsEHMgVp.js} +1 -1
  11. package/dist/assets/{Data-G9jbwfOG.js → Data-Bt2o6J7H.js} +1 -1
  12. package/dist/assets/DetectionIntelligence-CeunXPtW.js +1 -0
  13. package/dist/assets/{DeviceAggregateSection-SWBVkQZo.js → DeviceAggregateSection-DLNzCtMs.js} +1 -1
  14. package/dist/assets/DeviceDetail-DCh8ydpY.js +2 -0
  15. package/dist/assets/{Devices-LRxw3I54.js → Devices-fMM-N9UK.js} +1 -1
  16. package/dist/assets/{EmbedPlayerPage-kAcRRhLT.js → EmbedPlayerPage-D8LRITOt.js} +1 -1
  17. package/dist/assets/{Events-D5RYcT1o.js → Events-Drj6ybP0.js} +1 -1
  18. package/dist/assets/{FormBuilder-D5TM9i1v.js → FormBuilder-ChyOUw_O.js} +1 -1
  19. package/dist/assets/{Identity-BRBs5jpM.js → Identity-kjnupMGz.js} +1 -1
  20. package/dist/assets/{IntegrationDetail-Bi2LK7OU.js → IntegrationDetail-683FxnPV.js} +1 -1
  21. package/dist/assets/{Integrations-qkldKVTw.js → Integrations-BAa7Hx8I.js} +1 -1
  22. package/dist/assets/{Integrations-DGLN-Oxt.js → Integrations-Bvz5KiZt.js} +1 -1
  23. package/dist/assets/{Logs-gPb8NR8H.js → Logs-CPMTc4WW.js} +1 -1
  24. package/dist/assets/{MotionZonesSettings-DshKL17j.js → MotionZonesSettings-DhO5kuER.js} +1 -1
  25. package/dist/assets/{MyAccess-X5GKXeQP.js → MyAccess-C5kfikXk.js} +1 -1
  26. package/dist/assets/{Network-D6gOeprQ.js → Network-DBtVDYGt.js} +1 -1
  27. package/dist/assets/{NodeAddonsSettingsPanel-DQFTkg1Y.js → NodeAddonsSettingsPanel-BdP5wGIu.js} +1 -1
  28. package/dist/assets/NodeInferenceDevices-CubcmlvI.js +1 -0
  29. package/dist/assets/Notifications-DBH3QGle.js +1 -0
  30. package/dist/assets/Pipeline-DgZbCwcO.js +1 -0
  31. package/dist/assets/{Plates-ffuMaQFQ.js → Plates-DiVTWUKg.js} +1 -1
  32. package/dist/assets/{PrivacyMaskSettings-MMzNNe4D.js → PrivacyMaskSettings-zKU6VZ4G.js} +1 -1
  33. package/dist/assets/{ProviderIcon-DYBwyw9a.js → ProviderIcon-JxmOoO_O.js} +1 -1
  34. package/dist/assets/Recordings-DTGdM6Ip.js +1 -0
  35. package/dist/assets/{ScanNetworkModal-loGcDZBw.js → ScanNetworkModal-DkqUu2Xc.js} +1 -1
  36. package/dist/assets/{SceneMonitorEditor-8DCu2vt2.js → SceneMonitorEditor-DZucoVrl.js} +1 -1
  37. package/dist/assets/{Scenes-0XwrxsM3.js → Scenes-DMSYbhd1.js} +1 -1
  38. package/dist/assets/{Settings-ZUSTjvUu.js → Settings-olnTIAze.js} +1 -1
  39. package/dist/assets/{Showroom-6YL7UJbf.js → Showroom-CdPGD4R4.js} +1 -1
  40. package/dist/assets/{Terminal-ykCkur7X.js → Terminal-Ck0I64eZ.js} +3 -3
  41. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-CmZvmCxO.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-BpY1fOVD.js} +1 -1
  42. package/dist/assets/{_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.js-DN3UpM8E.js → _virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.js-DX7sYWrs.js} +1 -1
  43. package/dist/assets/{bell-ring-B2rpaFtk.js → bell-ring-BgQsFN7F.js} +1 -1
  44. package/dist/assets/{boxes-DFTZfyUt.js → boxes-BnOBLNz5.js} +1 -1
  45. package/dist/assets/{build-cluster-graph-CLTUpmuN.js → build-cluster-graph-BwHdP82z.js} +1 -1
  46. package/dist/assets/circle-check-big-FvfSWrhR.js +1 -0
  47. package/dist/assets/{circle-x-BBjSRoMP.js → circle-x-DAqnOyA6.js} +1 -1
  48. package/dist/assets/clock-BpmU9WHJ.js +1 -0
  49. package/dist/assets/{copy-DWZC1oTP.js → copy-Dl5E5of_.js} +1 -1
  50. package/dist/assets/{debounced-invalidate-CwLD5Weo.js → debounced-invalidate-BIRVvqvY.js} +1 -1
  51. package/dist/assets/dist-C2l22cSJ.js +349 -0
  52. package/dist/assets/{dist-Do647wcg.js → dist-CUfLXJC3.js} +1 -1
  53. package/dist/assets/{download-CxGsHyPn.js → download-AfoMEWCf.js} +1 -1
  54. package/dist/assets/{face-bbox-BBED_iSc.js → face-bbox-BFT7iMc1.js} +1 -1
  55. package/dist/assets/{hard-drive-mR1KIPtt.js → hard-drive-C9zTEogy.js} +1 -1
  56. package/dist/assets/{hostInit-COJyRwPi.js → hostInit-Cw_l9Xfz.js} +1 -1
  57. package/dist/assets/{index-BppWvbJe.css → index-DM8saR4E.css} +1 -1
  58. package/dist/assets/index-vZPXzSPK.js +4 -0
  59. package/dist/assets/{key-round-Ds9BFc7u.js → key-round-sF-8oSo7.js} +1 -1
  60. package/dist/assets/{mf-entry-bootstrap-0-a5a42ace.js → mf-entry-bootstrap-0-8f39d7c2.js} +2 -2
  61. package/dist/assets/{pencil-LYk12AGI.js → pencil-DsWgW1cM.js} +1 -1
  62. package/dist/assets/play-BkPr3HPj.js +1 -0
  63. package/dist/assets/{player-overlays-BDAoS5mj.js → player-overlays-BGbLKvcn.js} +1 -1
  64. package/dist/assets/plus-zSkh3oEn.js +1 -0
  65. package/dist/assets/power-C4yi0usE.js +1 -0
  66. package/dist/assets/{radio-DOknapBC.js → radio-CWn4dw9L.js} +1 -1
  67. package/dist/assets/{refresh-cw-aVMqVAXK.js → refresh-cw-Cly4MRhi.js} +1 -1
  68. package/dist/assets/remoteEntry-BwhR6qpk.js +1 -0
  69. package/dist/assets/rotate-ccw-D0bM0VXI.js +1 -0
  70. package/dist/assets/rotate-cw-CNTEn7nJ.js +1 -0
  71. package/dist/assets/search-Bq3ZLayo.js +1 -0
  72. package/dist/assets/{send-CStKcKMW.js → send-yaKZ1tHd.js} +1 -1
  73. package/dist/assets/{server-DpQquxi2.js → server-CLOtA1S4.js} +1 -1
  74. package/dist/assets/square-BlSn3fsr.js +1 -0
  75. package/dist/assets/{square-check-big-D_32NB3x.js → square-check-big-DsiPGDCA.js} +1 -1
  76. package/dist/assets/src-Buv5KpAz.js +67 -0
  77. package/dist/assets/src-CQVcBp6b.js +349 -0
  78. package/dist/assets/{star-CnMUDmNT.js → star-fUCw1hyi.js} +1 -1
  79. package/dist/assets/{undo-2-Bu9cI3K3.js → undo-2-DXcExZt9.js} +1 -1
  80. package/dist/assets/{upload-DITj7pmV.js → upload-CLT-rIe6.js} +1 -1
  81. package/dist/assets/{use-scenes-feed-ClYTNH65.js → use-scenes-feed-CvesyXw2.js} +1 -1
  82. package/dist/assets/useEventInvalidation-B-Cb5-ry.js +1 -0
  83. package/dist/assets/{video-D3MA7ngK.js → video-CFtTGKiz.js} +1 -1
  84. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-PnuvqzUU.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BwIIU_83.js} +2 -2
  85. package/dist/assets/{wifi-CmMg3Cu0.js → wifi-Glpx3AkR.js} +1 -1
  86. package/dist/assets/{zap-H6dvIirs.js → zap-aTn3GS-l.js} +1 -1
  87. package/dist/index.html +6 -6
  88. package/dist/server/addon.js +174 -11
  89. package/package.json +1 -1
  90. package/dist/assets/Addons-i2kGOrOA.js +0 -1
  91. package/dist/assets/DetectionIntelligence-DiGPeWhN.js +0 -1
  92. package/dist/assets/DeviceDetail-O6xEze8u.js +0 -2
  93. package/dist/assets/NodeInferenceDevices-Dp-l4FwP.js +0 -1
  94. package/dist/assets/Notifications-D1d2Q-ix.js +0 -1
  95. package/dist/assets/Pipeline-DcVa4THx.js +0 -1
  96. package/dist/assets/Recordings-C8wX8f22.js +0 -1
  97. package/dist/assets/circle-check-big-BBxWSiDJ.js +0 -1
  98. package/dist/assets/clock-6MQBaiID.js +0 -1
  99. package/dist/assets/dist-DHSKR8rX.js +0 -345
  100. package/dist/assets/index-D8DOnspM.js +0 -4
  101. package/dist/assets/play-BSZQjLkZ.js +0 -1
  102. package/dist/assets/plus-DpCA4f3I.js +0 -1
  103. package/dist/assets/power-VPCWTEZu.js +0 -1
  104. package/dist/assets/remoteEntry-DBWzSJRP.js +0 -1
  105. package/dist/assets/rotate-ccw-D7VfDBtK.js +0 -1
  106. package/dist/assets/rotate-cw-1XMucssR.js +0 -1
  107. package/dist/assets/search-CcmIbGXi.js +0 -1
  108. package/dist/assets/square-BeUYnpBQ.js +0 -1
  109. package/dist/assets/src-B4-xc1-S.js +0 -345
  110. package/dist/assets/src-BHAm1a2j.js +0 -67
  111. package/dist/assets/useEventInvalidation-CYexmqD-.js +0 -1
@@ -7560,7 +7560,7 @@ var RecordingBandSchema = object({
7560
7560
  postBufferSec: number().min(0).optional()
7561
7561
  });
7562
7562
  ({
7563
- preBufferSec: 10,
7563
+ preBufferSec: 15,
7564
7564
  postBufferSec: 30
7565
7565
  }).postBufferSec * 1e3;
7566
7566
  /**
@@ -16059,7 +16059,7 @@ var TrackEnvelopeSchema = object({
16059
16059
  * `snapshots[]` references — megabytes across a page of tracks. `slim`
16060
16060
  * keeps every scalar the list surfaces actually render (ids, class(es),
16061
16061
  * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
16062
- * zonesVisited, bestEventId, envelope, hasFace, hasRider) and returns `positions` /
16062
+ * zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
16063
16063
  * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
16064
16064
  * `getTrack`. Mirrors the event-store `projection` convention
16065
16065
  * (`getObjectEvents` et al.).
@@ -16354,6 +16354,35 @@ var TrackSchema = object({
16354
16354
  */
16355
16355
  hasFace: boolean().optional(),
16356
16356
  /**
16357
+ * This track has a face row IN THE GALLERY: a crop **and** an embedding — a
16358
+ * face an operator could ASSIGN to an identity.
16359
+ *
16360
+ * The STRICT twin of {@link hasFace}, and the pair only earns its keep
16361
+ * because the two disagree. `hasFace` is stamped at the TOP of the face
16362
+ * branch, before every gate, and means no more than "a face detector produced
16363
+ * a face detail". This one is stamped at the single moment the gallery row
16364
+ * LANDS — after `FaceRecognizer.onTrackEnd` successfully persists it, i.e.
16365
+ * past the embedding-magnitude verdict, the `minFacePx` detection gate, the
16366
+ * candidate gate, the imageless-track drop (no crop was ever captured) and
16367
+ * the crop-store drop. Everything between the detector and that insert can
16368
+ * legitimately refuse the face, so a flag written any earlier promises the
16369
+ * operator something to assign and delivers nothing.
16370
+ *
16371
+ * **Independent of recognition.** A face collected but never auto-matched is
16372
+ * still assignable — it is in fact the face an operator most wants to reach —
16373
+ * so this is NOT gated on `recognizedIdentityId`. Recognition lands in
16374
+ * `subLabel`; this says only that the raw material exists.
16375
+ *
16376
+ * **Set once, never cleared.** A track that produced a gallery row produced
16377
+ * one; deleting the row later is the gallery's business, not this flag's.
16378
+ *
16379
+ * **Absent ≠ false**, the same rule as {@link hasFace}: every row written
16380
+ * before the column omits it, and so does every server that predates the
16381
+ * field. A consumer must test `=== true` and render nothing otherwise —
16382
+ * never infer "no assignable face".
16383
+ */
16384
+ hasEmbeddedFace: boolean().optional(),
16385
+ /**
16357
16386
  * This subject CONTAINS a folded rider — a person the rider-pairing step
16358
16387
  * ([D34](../decisions/adr-0034.md)) removed from the frame BEFORE the tracker,
16359
16388
  * so the passage is tracked once and as a VEHICLE.
@@ -17709,6 +17738,26 @@ var DetailResultSchema = object({
17709
17738
  * the consuming gate treats as accept — never as reject.
17710
17739
  */
17711
17740
  embeddingMagnitude: number().optional(),
17741
+ /**
17742
+ * Model that produced `embedding` — the SAME contract `labelModelId` has for
17743
+ * `label`, and for the same reason: the producing node is the only side that
17744
+ * knows which model actually ran, and re-deriving it downstream is exactly
17745
+ * the inference this model exists to forbid.
17746
+ *
17747
+ * Additive and optional, so a runner that predates it degrades to
17748
+ * "unmeasurable" rather than to a wrong answer — the consumer falls back to
17749
+ * its previous assumption instead of refusing.
17750
+ *
17751
+ * Its absence was not cosmetic. `FaceRecognizer` needs the probe's model id
17752
+ * to use `face-matcher`'s same-model gate (`sample.modelId !== probe.modelId`);
17753
+ * with nothing on the wire it took the id from the GALLERY, so the gate
17754
+ * compared the gallery against itself and could never fire. That turned the
17755
+ * one guard protecting the face feature space into a tautology, and it is
17756
+ * why swapping `face-embedding`'s model would NOT have stranded the enrolled
17757
+ * gallery as the catalog comment predicts — it would have scored the new
17758
+ * model's vectors against the old model's samples in one cosine space.
17759
+ */
17760
+ embeddingModelId: string().optional(),
17712
17761
  label: string().optional(),
17713
17762
  /**
17714
17763
  * The tier `label` occupies, copied VERBATIM from the producing step's
@@ -18584,6 +18633,12 @@ var CameraStatusSchema = object({
18584
18633
  /** Unix timestamp (ms) when this snapshot was composed server-side. */
18585
18634
  fetchedAt: number()
18586
18635
  });
18636
+ var InferenceDeviceExclusionReasonSchema = _enum([
18637
+ "disabled",
18638
+ "unavailable",
18639
+ "cannot-host-camera-root",
18640
+ "accelerator-preferred"
18641
+ ]);
18587
18642
  var NodeInferenceDeviceSchema = object({
18588
18643
  /** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
18589
18644
  key: string(),
@@ -18614,7 +18669,17 @@ var NodeInferenceDeviceSchema = object({
18614
18669
  * available per format; this is the stored selection that becomes the
18615
18670
  * default for EVERY camera landing on this accelerator.
18616
18671
  */
18617
- steps: record(string(), DeviceStepConfigSchema).optional()
18672
+ steps: record(string(), DeviceStepConfigSchema).optional(),
18673
+ /**
18674
+ * `null` when the device IS a camera-root candidate on this node; otherwise
18675
+ * the reason the dispatcher drops it. Computed by the SAME
18676
+ * `resolveInferenceDeviceEligibility` the dispatcher runs, so this view can
18677
+ * never disagree with the election — deriving it in the UI from
18678
+ * `enabled`/`available` would silently miss `cannot-host-camera-root` (needs
18679
+ * the node's model catalog) and `accelerator-preferred` (needs the node-wide
18680
+ * "an accelerator is serving" predicate).
18681
+ */
18682
+ exclusion: InferenceDeviceExclusionReasonSchema.nullable()
18618
18683
  });
18619
18684
  var NodeInferenceDevicesSchema = object({
18620
18685
  nodeId: string(),
@@ -19119,6 +19184,7 @@ DeviceType.Camera, method(object({
19119
19184
  isBattery: boolean(),
19120
19185
  reason: _enum([
19121
19186
  "disabled",
19187
+ "offline",
19122
19188
  "sleeping",
19123
19189
  "unreachable",
19124
19190
  "waking"
@@ -19164,9 +19230,17 @@ targets: array(object({
19164
19230
  sleeping: boolean(),
19165
19231
  /** Current device state rendered over the cached frame. State images
19166
19232
  * remain authoritative even when their photographic background is
19167
- * old; null means the link must carry a current camera frame. */
19233
+ * old; null means the link must carry a current camera frame.
19234
+ *
19235
+ * **This is the ONLY source a surface may derive an inactive tile
19236
+ * from.** A client that reads a device's `online`/`disabled` flags and
19237
+ * draws its own verdict will disagree with the pixels it is painting
19238
+ * — the frame comes from here, and so must the sentence over it
19239
+ * (D190). Pair with `ageMs` for the age of the photograph behind the
19240
+ * state. */
19168
19241
  stateReason: _enum([
19169
19242
  "disabled",
19243
+ "offline",
19170
19244
  "sleeping",
19171
19245
  "unreachable",
19172
19246
  "waking"
@@ -22363,7 +22437,12 @@ var ListResultSchema = object({
22363
22437
  probedAt: number()
22364
22438
  });
22365
22439
  var PreferredSchema = LocalInterfaceSchema.nullable();
22366
- var GetConnectionEndpointsResultSchema = object({ endpoints: array(object({
22440
+ /**
22441
+ * Candidate base URL for the SDK to race on connect. Order matters —
22442
+ * the SDK should attempt these top-to-bottom with a short per-candidate
22443
+ * timeout (e.g. 1500ms) and cache the winner for the session.
22444
+ */
22445
+ var ConnectionEndpointSchema = object({
22367
22446
  /** Operator-facing label (e.g. "LAN — en0", "Public tunnel"). */
22368
22447
  label: string(),
22369
22448
  /** Fully-formed base URL with scheme + host + port. */
@@ -22406,7 +22485,42 @@ var GetConnectionEndpointsResultSchema = object({ endpoints: array(object({
22406
22485
  * ordering between polls.
22407
22486
  */
22408
22487
  priority: number()
22409
- })).readonly() });
22488
+ });
22489
+ /**
22490
+ * Where the advertised local port came from. Ordered most → least
22491
+ * authoritative, and the whole point of returning it: a client must be able to
22492
+ * tell a FACT about the hub's socket from an echo of its own guess.
22493
+ */
22494
+ var LocalPortSourceEnum = _enum([
22495
+ "server-config",
22496
+ "server-env",
22497
+ "caller-hint",
22498
+ "default"
22499
+ ]);
22500
+ /** The port every LAN/loopback `baseUrl` in the same result was built with. */
22501
+ var AdvertisedLocalPortSchema = object({
22502
+ port: number().int().min(1).max(65535),
22503
+ source: LocalPortSourceEnum
22504
+ });
22505
+ var GetConnectionEndpointsResultSchema = object({
22506
+ endpoints: array(ConnectionEndpointSchema).readonly(),
22507
+ /**
22508
+ * The port the hub built the LAN/loopback URLs with, and where that number
22509
+ * came from.
22510
+ *
22511
+ * Returned rather than merely applied, because "the URL is right" and "the
22512
+ * client can KNOW the URL is right" are different properties. A client that
22513
+ * only sees a corrected URL cannot distinguish a hub that fixed the port from
22514
+ * a hub that echoed the port the client sent, so it cannot decide whether to
22515
+ * race the candidate or discard it. With `source` it can: anything but
22516
+ * `caller-hint` is the hub's own socket.
22517
+ *
22518
+ * Absent on hubs predating this field — a client that finds it missing is
22519
+ * talking to an echoing hub and must degrade exactly as it does for
22520
+ * `caller-hint`.
22521
+ */
22522
+ localPort: AdvertisedLocalPortSchema
22523
+ });
22410
22524
  /**
22411
22525
  * The chosen outbound endpoint for notification artifacts. `baseUrl: null` =
22412
22526
  * AUTO (resolved from the candidate ranking at send time); `resolved` reports
@@ -22427,8 +22541,13 @@ var AllowedAddressesSchema = object({
22427
22541
  */
22428
22542
  addresses: array(string()).readonly() });
22429
22543
  method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(object({
22430
- /** Local hub HTTP port to use in base URLs. */
22431
- port: number().int().min(1).max(65535),
22544
+ /**
22545
+ * LEGACY HINT — do not send from new code. Kept optional so clients
22546
+ * written against the echoing contract keep working; the hub uses it
22547
+ * only when it cannot read its own port, and says so via
22548
+ * `localPort.source === 'caller-hint'`.
22549
+ */
22550
+ port: number().int().min(1).max(65535).optional(),
22432
22551
  /** Include `http(s)://127.0.0.1:<port>` as the lowest-priority
22433
22552
  * candidate. Default `true`. */
22434
22553
  includeLoopback: boolean().optional(),
@@ -33585,6 +33704,39 @@ TimelapseRuleInputSchema.extend({
33585
33704
  createdAt: number(),
33586
33705
  updatedAt: number()
33587
33706
  });
33707
+ Object.freeze(Object.fromEntries([{
33708
+ stepId: "face-embedding",
33709
+ label: "Face recognition model",
33710
+ defaultModelId: "arcface-r100",
33711
+ indexName: "the enrolled face gallery",
33712
+ options: [
33713
+ {
33714
+ id: "arcface-r100",
33715
+ label: "ArcFace (ResNet34)"
33716
+ },
33717
+ {
33718
+ id: "auraface-r100",
33719
+ label: "AuraFace R100"
33720
+ },
33721
+ {
33722
+ id: "inception-resnet-v1",
33723
+ label: "Inception ResNet V1"
33724
+ }
33725
+ ]
33726
+ }, {
33727
+ stepId: "clip-embedding",
33728
+ label: "Semantic search model",
33729
+ defaultModelId: "mobileclip-s1",
33730
+ indexName: "the object semantic-search index",
33731
+ options: [{
33732
+ id: "mobileclip-s1",
33733
+ label: "MobileCLIP S1"
33734
+ }, {
33735
+ id: "mobileclip-s2",
33736
+ label: "MobileCLIP S2"
33737
+ }]
33738
+ }].map((s) => [s.stepId, s.defaultModelId])));
33739
+ string().min(1);
33588
33740
  object({
33589
33741
  /**
33590
33742
  * Fraction of the box's own size added on EACH side before cutting.
@@ -33605,10 +33757,21 @@ object({
33605
33757
  */
33606
33758
  square: boolean()
33607
33759
  });
33608
- ({
33760
+ /**
33761
+ * The convention in force when nobody has configured one — byte-for-byte the
33762
+ * behaviour of the pre-unification LIVE path (`DETAIL_CROP_PADDING_RATIO`).
33763
+ */
33764
+ var DEFAULT_DETAIL_CROP_CONVENTION = {
33609
33765
  paddingRatio: .15,
33610
33766
  square: false
33611
- }).paddingRatio;
33767
+ };
33768
+ Object.freeze({
33769
+ x: 0,
33770
+ y: 0,
33771
+ w: 1,
33772
+ h: 1
33773
+ });
33774
+ DEFAULT_DETAIL_CROP_CONVENTION.paddingRatio;
33612
33775
  /**
33613
33776
  * WHICH delivered frames the decode worker retains a native copy of.
33614
33777
  *
@@ -33742,7 +33905,7 @@ var AdminUIAddon = class extends BaseAddon {
33742
33905
  capability: adminUiCapability,
33743
33906
  provider: {
33744
33907
  getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
33745
- getVersion: async () => ({ version: "1.2.84" })
33908
+ getVersion: async () => ({ version: "1.2.86" })
33746
33909
  }
33747
33910
  }];
33748
33911
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-admin-ui",
3
- "version": "1.2.84",
3
+ "version": "1.2.86",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Admin UI — Vite frontend build and server-side addon",
@@ -1 +0,0 @@
1
- import{I as e,K as t,Q as n,R as r,S as i,W as a,b as o,o as s,q as c,x as l,z as u}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{Z as d}from"./player-overlays-BDAoS5mj.js";import{An as f,As as p,Bn as m,C as h,Cn as g,En as _,Fn as v,Gi as ee,In as y,J as b,K as x,Nn as S,On as C,Pn as te,Rn as ne,Sn as re,Tn as ie,Zi as w,bn as ae,g as oe,jn as se,kn as T,ln as ce,wn as E,xn as D,yn as le,zn as ue}from"./src-BHAm1a2j.js";import{Pt as O}from"./src-B4-xc1-S.js";import{t as k}from"./clock-6MQBaiID.js";import{t as A}from"./download-CxGsHyPn.js";import{t as de}from"./plus-DpCA4f3I.js";import{t as j}from"./refresh-cw-aVMqVAXK.js";import{t as M}from"./search-CcmIbGXi.js";import{t as N}from"./upload-DITj7pmV.js";import{C as P,J as F,K as I,P as L,R,X as z,_ as fe,i as B,m as V,p as pe,s as H,z as U}from"./index-D8DOnspM.js";import{t as W}from"./AdminPage-CCD07UMs.js";import{t as me}from"./NodeAddonsSettingsPanel-DQFTkg1Y.js";var he=I(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),ge=I(`octagon-alert`,[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z`,key:`1fd625`}]]),_e=I(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),G=I(`skip-forward`,[[`polygon`,{points:`5 4 15 12 5 20 5 4`,key:`16p6eg`}],[`line`,{x1:`19`,x2:`19`,y1:`5`,y2:`19`,key:`futhcm`}]]);n();var K=new Set([`completed`,`failed`,`partially-failed`,`cancelled`]),q=new Set([`done`,`failed`,`skipped`]);function ve(e){return!q.has(e.phase)&&!K.has(e.jobState)}function J(e,t){let n=new Map,r=[...e].sort((e,t)=>e.createdAtMs-t.createdAtMs);for(let e of r){let r=K.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 ye(){let{data:e}=C({activeOnly:!0},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data?.length??0)>0?3e3:!1}),{map:t}=p(O.AddonsJobProgress,e=>e.job.jobId);return a(()=>{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 J([...n.values()],Date.now())},[e,t])}var be={queued:{icon:k,cls:`bg-muted text-foreground-subtle`,label:`queued`},fetching:{icon:P,cls:`bg-primary/10 text-primary`,label:`fetching`,spin:!0},staged:{icon:P,cls:`bg-primary/10 text-primary`,label:`staged`,spin:!0},validating:{icon:P,cls:`bg-primary/10 text-primary`,label:`validating`,spin:!0},applying:{icon:P,cls:`bg-primary/10 text-primary`,label:`applying`,spin:!0},restarting:{icon:P,cls:`bg-amber-500/10 text-amber-600 dark:text-amber-400`,label:`restarting`,spin:!0},applied:{icon:P,cls:`bg-primary/10 text-primary`,label:`finalizing`,spin:!0},done:{icon:U,cls:`bg-success/10 text-success`,label:`updated`},failed:{icon:ge,cls:`bg-danger/10 text-danger`,label:`failed`},skipped:{icon:G,cls:`bg-muted text-foreground-subtle`,label:`skipped`}};function xe({progress:e}){let t=be[e.phase],n=t.icon,r=e.error??`${e.packageName}: ${e.fromVersion??`?`} → ${e.toVersion}`;return i(`span`,{"data-testid":`addon-job-progress`,className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded shrink-0 ${t.cls}`,title:r,children:[l(n,{className:`w-2.5 h-2.5 ${t.spin?`animate-spin`:``}`}),t.label,i(`span`,{className:`font-mono`,children:[`→ `,e.toVersion]})]})}function Se({packageName:e,currentVersion:t,installSource:n,onInstall:r,onClose:a,onSelect:s,selectedVersion:c}){let u=n===`upload`||n===`local`,{data:d,isLoading:f}=E({name:e});return i(`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:[i(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[l(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle font-medium`,children:`Versions`}),l(`button`,{type:`button`,onClick:a,className:`text-foreground-subtle hover:text-foreground`,children:l(B,{className:`h-3 w-3`})})]}),u&&i(`div`,{className:`flex items-start gap-2 px-3 py-2 border-b border-border bg-cyan-500/10 text-[10px]`,children:[l(N,{className:`h-3 w-3 mt-0.5 text-cyan-500 shrink-0`}),i(`div`,{className:`text-cyan-700 dark:text-cyan-200`,children:[i(`span`,{className:`font-semibold`,children:[n===`upload`?`Uploaded copy`:`Local copy`,` in place.`]}),` `,`Re-install `,l(`span`,{className:`font-mono`,children:t}),` from npm to track upstream releases again.`]})]}),f&&i(`div`,{className:`flex items-center justify-center gap-2 py-6 text-[10px] text-foreground-subtle`,children:[l(P,{className:`h-3.5 w-3.5 animate-spin`}),`Loading versions...`]}),d&&l(`div`,{className:`max-h-64 overflow-auto divide-y divide-border`,children:d.map(e=>{let n=e.version===t,a=s!==void 0&&e.version===c,d=/-(alpha|beta|rc|dev|canary|next)/i.test(e.version),f=i(o,{children:[l(`span`,{className:`font-mono flex-1 text-left ${n?`text-primary font-semibold`:d?`text-amber-400`:`text-foreground`}`,children:e.version}),n&&l(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium bg-primary/10 text-primary`,children:`current`}),e.distTags.map(e=>l(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${e===`latest`?`bg-emerald-500/15 text-emerald-400`:e===`beta`?`bg-amber-500/15 text-amber-400`:`bg-gray-500/15 text-gray-400`}`,children:e},e)),e.deprecated&&l(`span`,{className:`text-[9px] text-red-400 line-through`,children:`deprecated`}),l(`span`,{className:`text-[9px] text-foreground-subtle shrink-0`,children:new Date(e.publishedAt).toLocaleDateString()})]});return s?i(`button`,{type:`button`,"aria-label":`Select ${e.version}`,onClick:()=>s(e.version),className:`w-full flex items-center gap-2 px-3 py-2 text-[11px] ${a?`bg-primary/5`:`hover:bg-surface-hover`} transition-colors`,children:[f,a?l(U,{className:`h-3 w-3 text-primary shrink-0`}):l(`span`,{className:`w-3 shrink-0`})]},e.version):i(`div`,{className:`flex items-center gap-2 px-3 py-2 text-[11px] ${n?`bg-primary/5`:`hover:bg-surface-hover`} transition-colors`,children:[f,n&&!u?l(U,{className:`h-3 w-3 text-primary shrink-0`}):l(`button`,{type:`button`,onClick:()=>r(e.version),className:`shrink-0 rounded p-0.5 hover:bg-primary/20 text-foreground-subtle hover:text-primary transition-colors`,title:n?`Re-install ${e.version} from npm`:`Install ${e.version}`,children:l(A,{className:`h-3 w-3`})})]},e.version)})}),d&&d.length===0&&l(`div`,{className:`py-4 text-center text-[10px] text-foreground-subtle`,children:`No versions found`})]})}var Y={queued:{icon:k,bg:`bg-muted text-foreground-subtle`,label:`queued`},updating:{icon:P,bg:`bg-primary/10 text-primary`,label:`updating`,spin:!0},"done-pending-restart":{icon:j,bg:`bg-amber-500/10 text-amber-700`,label:`pending restart`},done:{icon:U,bg:`bg-success/10 text-success`,label:`done`},failed:{icon:ge,bg:`bg-danger/10 text-danger`,label:`failed`}};function Ce({item:e}){let t=Y[e.status],n=t.icon;return i(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded ${t.bg}`,title:e.error,children:[l(n,{className:`w-2.5 h-2.5 ${t.spin?`animate-spin`:``}`}),t.label]})}n();var X=`device-export`;function Z(e){return e.capabilities.some(e=>(typeof e==`string`?e:e.name)===X)}function we({isBundle:e,installSource:t,addonId:n,iconPath:r,color:a}){let[o,s]=c(!1),u=a?{backgroundColor:`${a.startsWith(`#`)?a:`#${a}`}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=n&&r?`/api/addon-assets/${n}/${r}`:null,p=!!f&&!o;return i(`div`,{className:`relative flex-shrink-0`,children:[l(`div`,{className:`h-9 w-9 rounded-lg flex items-center justify-center ${u?``:d}`,style:u,children:p?l(`img`,{src:f,alt:n,className:`h-5 w-5`,onError:()=>s(!0)}):l(e?_e:fe,{className:`h-4 w-4`})}),t===`local`&&l(`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`}),t===`npm`&&l(`span`,{className:`absolute -top-1 -left-1 w-4 h-4 rounded bg-[#cb3837] flex items-center justify-center -rotate-12 shadow-sm`,children:l(`svg`,{viewBox:`0 0 780 250`,className:`w-[11px] h-[11px]`,children:l(`path`,{fill:`#fff`,d:`M240 250h100V50h100v200h340V0H0v250z`})})}),t===`upload`&&l(`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:l(N,{className:`h-2.5 w-2.5 text-white`})})]})}function Te({version:e,availableUpdate:t,selectedVersion:n,isUpdating:r,installSource:a,disabled:o,onUpdate:s,onOpenPicker:c,children:u}){if(r)return i(`span`,{className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border border-blue-500/30 bg-blue-500/10 text-blue-400 shrink-0`,children:[l(P,{className:`h-3 w-3 animate-spin`}),`Updating…`]});if(t){let r=n??t;return i(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[s&&i(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),s()},disabled:o,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 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:`Update to ${r}`,children:[l(A,{className:`h-3 w-3`}),`Update`]}),i(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),c()},disabled:o,"aria-label":`Select version to install`,title:`Installed ${e} — update available. Selected ${r}; tap to choose another version.`,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 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:[l(`span`,{className:`font-normal opacity-70`,children:e}),l(`span`,{className:`font-normal opacity-70`,children:`→`}),r,l(R,{className:`h-3 w-3`})]}),u]})}return i(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[i(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),c()},disabled:o,className:[`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-bold font-mono border transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,a===`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:`Version ${e} — tap to view all versions`,children:[e,l(R,{className:`h-3 w-3 opacity-50`})]}),u]})}function Ee({addonId:e}){let t=s(),{data:n=`inherit`}=D({addonId:e}),r=v({onSuccess:()=>{t.invalidateQueries({queryKey:[[`addons`,`getAddonAutoUpdate`]]})}});return l(`div`,{className:`flex rounded-lg border border-border overflow-hidden text-[10px] font-medium`,children:[`inherit`,`off`,`latest`,`beta`].map(t=>l(`button`,{type:`button`,onClick:n=>{n.stopPropagation(),r.mutate({addonId:e,channel:t})},disabled:r.isPending,className:`px-2.5 py-1 transition-colors capitalize ${n===t?t===`inherit`?`bg-gray-700/50 text-gray-700 dark:text-gray-300`:t===`off`?`bg-gray-700 text-gray-700 dark:text-gray-300`:t===`latest`?`bg-blue-500/20 text-blue-400`:`bg-amber-500/20 text-amber-400`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`} ${t===`inherit`?``:`border-l border-border`}`,children:t},t))})}function De({addon:e,agents:t=[],clusterStatus:n,hideVersion:r,availableUpdate:a,onUpdate:f,isUpdating:p,jobProgress:m,bundle:g,bulkItem:_,disabledByBulk:v,isSystem:ee}){let[y,C]=c(!1),[te,ne]=c(!1),[re,w]=c(!1),[ae,oe]=c(null);u(()=>{oe(null)},[a]);let T=ae??a,[E,D]=c(!1),[le,O]=c(!1),[k,A]=c(`logs`),M=s(),N=d(),P=F(),I=ce(),{manifest:L}=e,z=e.installedOn??[],fe=!g&&!L.protected&&L.removable!==!1,U=!!g,W=g?.displayName??L.name,G=g?.packageName??L.packageName,K=g?.version??L.packageVersion??L.version,q=g?.installSource??e.installSource,ve=g?g.bundle?.description??g.addons[0]?.manifest.description:L.description,J=ue({onSuccess:()=>{M.invalidateQueries({queryKey:[[`addons`]]}),M.invalidateQueries({queryKey:[[`addonPages`]]}),M.invalidateQueries({queryKey:[[`capabilities`]]})}}),ye=se({onSuccess:()=>{M.invalidateQueries({queryKey:[[`addons`]]})}}),be=ie({onSuccess:()=>{M.invalidateQueries({queryKey:[[`addons`]]}),M.invalidateQueries({queryKey:[[`addonPages`]]}),M.invalidateQueries({queryKey:[[`capabilities`]]}),M.invalidateQueries({queryKey:[[`integrations`]]})}}),Y=S({onSuccess:()=>{M.invalidateQueries({queryKey:[[`addons`]]}),M.invalidateQueries({queryKey:[[`alerts`]]})}}),X=e.health,Q=X?.phase===`failed`&&!X.inGracePeriod,Oe=Q&&X?.nextRetryAt&&!X.retrying;return i(`div`,{className:`rounded-lg border bg-surface overflow-hidden ${Q?`border-red-500/50`:`border-border`}`,children:[Q&&X&&i(`div`,{className:`bg-danger/10 border-b border-danger/30 px-4 py-2.5 flex items-start gap-2.5`,children:[l(ge,{className:`h-4 w-4 text-danger shrink-0 mt-0.5`}),i(`div`,{className:`flex-1 min-w-0`,children:[i(`div`,{className:`text-xs font-semibold text-danger`,children:[`Failed to load (attempt #`,X.retryCount,`)`]}),l(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:X.lastError?.message??`Unknown error`}),Oe&&X.nextRetryAt&&i(`div`,{className:`text-[10px] text-foreground-subtle mt-1`,children:[`Auto-retry at `,new Date(X.nextRetryAt).toLocaleTimeString()]})]}),i(`button`,{type:`button`,disabled:Y.isPending||X.retrying,onClick:e=>{e.stopPropagation(),Y.mutate({packageName:G})},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:`Reset retry counter and force immediate reload`,children:[l(j,{className:`h-3 w-3 ${Y.isPending||X.retrying?`animate-spin`:``}`}),`Retry now`]})]}),i(`div`,{className:`flex items-start gap-3 px-4 py-3`,children:[l(we,{isBundle:U||!!L.components&&L.components.length>1,installSource:q,addonId:U?g.addons[0]?.manifest.id:L.id,iconPath:U?g.bundle?.icon??g.addons[0]?.manifest.icon:L.icon,color:U?g.addons[0]?.manifest.color:L.color}),i(`div`,{className:`flex-1 min-w-0`,children:[i(`div`,{className:`flex items-start justify-between gap-2`,children:[l(`span`,{className:`text-sm font-semibold text-foreground truncate min-w-0`,children:W}),!r&&l(Te,{version:K,availableUpdate:a,...T===void 0?{}:{selectedVersion:T},isUpdating:p,installSource:q,disabled:v,...f&&T!==void 0?{onUpdate:()=>f(T)}:{},onOpenPicker:()=>w(e=>!e),children:re&&l(Se,{packageName:G,currentVersion:K,...q?{installSource:q}:{},...a!==void 0&&T!==void 0?{selectedVersion:T,onSelect:e=>{oe(e),w(!1)}}:{},onInstall:e=>{w(!1),be.mutate({packageName:G,version:e})},onClose:()=>w(!1)})})]}),i(`div`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 mt-0.5`,children:[G!==W&&l(`span`,{className:`text-[10px] text-foreground-subtle font-mono truncate max-w-full`,children:G}),U&&i(`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:[l(_e,{className:`h-3 w-3`}),g.addons.length]}),ee&&i(`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:`System package — updating restarts the hub`,children:[l(j,{className:`h-3 w-3`}),`System`]}),_!=null&&l(Ce,{item:_}),m!=null&&l(xe,{progress:m})]}),ve&&l(`p`,{className:`text-[10px] text-foreground-subtle mt-1 line-clamp-1`,children:ve}),!U&&e.process&&i(`div`,{className:`flex flex-wrap items-center gap-1.5 mt-1`,children:[l(`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`?`forked`:`in-process`}),e.process.pid!=null&&i(`span`,{className:`text-[9px] font-mono text-foreground-subtle`,children:[`PID `,e.process.pid]}),l(`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`:e.process.state===`crashed`||e.process.state===`failed`?`bg-red-500/15 text-red-400`:`bg-gray-500/15 text-gray-400`}`,children:e.process.state})]})]})]}),!U&&i(`div`,{className:`flex items-center gap-1 px-4 py-1.5 border-t border-border/50 bg-surface-hover/20`,children:[i(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),ye.mutate({addonId:L.id})},disabled:ye.isPending||v,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 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:[l(j,{className:`h-3 w-3 ${ye.isPending?`animate-spin`:``}`}),`Restart`]}),i(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),D(e=>!e)},className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border transition-colors ${E?`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:[l(V,{className:`h-3 w-3`}),`Logs`]}),!U&&i(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),O(!0)},className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border transition-colors ${le?`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:[l(pe,{className:`h-3 w-3`}),`Settings`]}),l(`div`,{className:`flex-1`}),fe&&i(`button`,{type:`button`,onClick:async e=>{e.stopPropagation(),await I({title:`Uninstall ${L.name}?`,message:`This will remove the addon package and all its data. This action cannot be undone.`,confirmLabel:`Uninstall`,variant:`danger`})&&J.mutate({packageName:L.packageName})},disabled:J.isPending||v,className:`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`,children:[l(H,{className:`h-3 w-3`}),J.isPending?`Removing...`:`Uninstall`]})]}),n&&n.nodes.length>1&&!U&&i(`div`,{className:`border-t border-border px-4 py-2 bg-muted/10`,children:[l(`div`,{className:`text-[10px] font-medium text-foreground-subtle mb-1.5`,children:`Cluster Deployment`}),l(`div`,{className:`space-y-1`,children:n.nodes.map(e=>i(`div`,{className:`flex items-center gap-2 text-[10px]`,children:[l(`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`}`}),l(`span`,{className:`font-medium text-foreground min-w-[60px]`,children:e.name}),l(`span`,{className:`font-mono text-foreground-subtle`,children:e.version}),!e.synced&&e.status!==`offline`&&l(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-amber-500/10 text-amber-400 border border-amber-500/20`,children:`outdated`}),e.status===`offline`&&l(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-muted text-muted-foreground`,children:`offline`}),e.synced&&e.status!==`offline`&&l(`span`,{className:`text-[9px] text-success`,children:`synced`})]},e.nodeId))})]}),E&&!U&&i(`div`,{className:`border-t border-border`,children:[i(`div`,{className:`flex items-center px-4 py-1 bg-surface-hover/20 border-b border-border/50`,children:[i(`div`,{className:`flex rounded border border-border overflow-hidden text-[9px]`,children:[l(`button`,{type:`button`,onClick:()=>A(`logs`),className:`px-2 py-0.5 transition-colors ${k===`logs`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:`Logs`}),l(`button`,{type:`button`,onClick:()=>A(`events`),className:`px-2 py-0.5 border-l border-border transition-colors ${k===`events`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:`Events`})]}),l(`div`,{className:`flex-1`}),l(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),D(!1)},className:`text-foreground-subtle hover:text-foreground`,children:l(B,{className:`h-3.5 w-3.5`})})]}),k===`logs`&&l(b,{addonId:L.id,maxHeight:`max-h-64`,showFilters:!1}),k===`events`&&l(x,{addonId:L.id,category:`addon.*`,maxHeight:`max-h-64`})]}),U&&i(o,{children:[l(`button`,{type:`button`,onClick:()=>C(e=>!e),className:`w-full flex items-center justify-center border-t border-border py-1 hover:bg-surface-hover/50 transition-colors`,children:l(y?he:R,{className:`h-3.5 w-3.5 text-foreground-subtle`})}),y&&l(`div`,{className:`border-t border-border px-3 py-2 space-y-2`,children:g.addons.map(e=>l(De,{addon:e,agents:t,hideVersion:!0},e.manifest.id))})]}),le&&!U&&l(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4`,onClick:()=>O(!1),children:i(`div`,{className:`w-full max-w-lg max-h-[80vh] rounded-xl border border-border bg-surface shadow-2xl flex flex-col overflow-hidden`,onClick:e=>e.stopPropagation(),children:[i(`div`,{className:`flex items-center justify-between px-5 py-3 border-b border-border flex-shrink-0`,children:[i(`div`,{className:`flex items-center gap-2`,children:[l(pe,{className:`h-4 w-4 text-primary`}),i(`h2`,{className:`text-sm font-semibold text-foreground`,children:[W,` Settings`]})]}),l(`button`,{onClick:()=>O(!1),className:`text-foreground-subtle hover:text-foreground transition-colors p-1 rounded`,children:l(B,{className:`h-4 w-4`})})]}),i(`div`,{className:`flex-1 overflow-y-auto px-5 py-4 space-y-4`,children:[l(me,{nodeId:`hub`,addonIds:[L.id],level:`global`}),Z(L)&&i(`div`,{children:[l(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Device export`}),l(h,{addonId:L.id,trpc:N.trpcClient,onOpenDevice:e=>P(`/devices/${e}`)})]}),q===`npm`&&i(`div`,{children:[l(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Auto-Update`}),l(Ee,{addonId:L.id})]}),L.components&&L.components.length>0&&i(`div`,{children:[i(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:[`Components (`,L.components.length,`)`]}),l(`div`,{className:`flex flex-wrap gap-1`,children:L.components.map(e=>l(`span`,{className:`text-[10px] rounded bg-background border border-border px-1.5 py-0.5 text-foreground-subtle font-mono`,children:e},e))})]}),t.length>=2&&i(`div`,{children:[l(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Installed on`}),i(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[z.length===0&&l(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Hub (local)`}),z.map(e=>l(`span`,{className:`rounded-full bg-surface-hover border border-border px-2 py-0.5 text-[10px] text-foreground-subtle`,children:e},e)),i(`div`,{className:`relative`,children:[i(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),ne(e=>!e)},className:`inline-flex items-center gap-1 rounded-full border border-dashed border-border px-2 py-0.5 text-[10px] text-foreground-subtle hover:text-foreground hover:border-primary transition-colors`,title:`Install on more agents`,children:[l(de,{className:`h-3 w-3`}),`Add agent`]}),te&&i(`div`,{className:`absolute left-0 top-full mt-1 z-10 min-w-[160px] rounded-md border border-border bg-surface shadow-lg overflow-hidden`,children:[t.filter(e=>!e.isHub&&!z.includes(e.name)).map(e=>l(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),ne(!1)},className:`w-full text-left px-3 py-1.5 text-[10px] text-foreground hover:bg-surface-hover transition-colors`,children:e.name},e.id)),t.filter(e=>!e.isHub&&!z.includes(e.name)).length===0&&l(`div`,{className:`px-3 py-1.5 text-[10px] text-foreground-subtle`,children:`No available agents`})]})]})]})]})]}),l(`div`,{className:`flex items-center justify-end px-5 py-3 border-t border-border flex-shrink-0`,children:l(`button`,{type:`button`,onClick:()=>O(!1),className:`rounded-lg border border-border px-3 py-1.5 text-xs font-medium text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,children:`Close`})})]})})]})}n();var Q=`.tgz,.tar.gz,.zip`;function Oe({onUploadSuccess:n}){let[r,a]=c(!1),s=t(null),u=e(async e=>{a(!0);let t=new FormData;t.append(`file`,e);let r=localStorage.getItem(`camstack_admin_token`)??``;try{(await(await fetch(`/api/addons/upload`,{method:`POST`,headers:{Authorization:`Bearer ${r}`},body:t})).json()).success&&n()}finally{a(!1)}},[n]);return i(o,{children:[l(`input`,{ref:s,type:`file`,accept:Q,onChange:e(e=>{let t=e.target.files?.[0];t&&u(t),e.target.value=``},[u]),className:`hidden`}),i(`button`,{type:`button`,onClick:()=>s.current?.click(),disabled:r,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:[r?l(P,{className:`w-3.5 h-3.5 animate-spin`}):l(N,{className:`w-3.5 h-3.5`}),r?`Uploading...`:`Upload`]})]})}n();var ke=[{seconds:900,label:`15m`},{seconds:3600,label:`1h`},{seconds:21600,label:`6h`},{seconds:43200,label:`12h`},{seconds:86400,label:`24h`}],Ae=new Set([`@camstack/system`,`@camstack/types`,`@camstack/sdk`,`@camstack/shm-ring`,`@camstack/ui-library`]);function je(e){return e!==void 0&&Ae.has(e)}function Me(e,t){let n=e??`hub-only`;return n===`any-node`?!0:n===`hub-only`?t:!t}function Ne(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`}: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 Pe(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 Fe({addons:n,clusterStatus:o,selectedNode:d,onRefresh:f,isRefreshing:p}){let h=s(),[_,v]=c(``),ee=r(_),[b,x]=c(!1),S=t(null);u(()=>{if(!b)return;let e=e=>{S.current&&!S.current.contains(e.target)&&x(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[b]);let{data:C}=T({nodeId:d.id}),w=a(()=>{let e=new Map;for(let t of C??[])e.set(t.name,t.latestVersion);return e},[C]),ae=a(()=>(C??[]).filter(e=>!e.isSystem).length,[C]),[oe,se]=c(()=>new Set),[E,D]=c(()=>new Map),ue=e(e=>{se(t=>new Set(t).add(e))},[]),O=e(e=>{se(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[]),k=e((e,t)=>{D(n=>new Map(n).set(e,t))},[]),de=e(e=>{D(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),N=m({onMutate:e=>{ue(e.name),de(e.name)},onSuccess:(e,t)=>{O(t.name);let n=e;if(n&&n.success===!1){k(t.name,n.error??`Update failed (no error message returned by server)`);return}h.invalidateQueries({queryKey:[[`addons`]]}),h.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]})},onError:(e,t)=>{O(t.name),k(t.name,e instanceof Error?e.message:String(e))}}),F=ye(),I=t(new Set);u(()=>{let e=new Set;for(let[t,n]of F)ve(n)&&e.add(t);let t=[...I.current].some(t=>!e.has(t));I.current=e,t&&(h.invalidateQueries({queryKey:[[`addons`]]}),h.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]}))},[F,h]);let{data:R}=re(void 0),fe=le({onSuccess:()=>{h.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),B=y({onSuccess:()=>{h.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),{data:V,isFetching:pe}=te({query:ee||void 0},{enabled:b}),H=ne(),{data:W}=g(void 0),me=W?.requestedAt,[he,ge]=c(null),[_e,G]=c(!1);u(()=>{if(W?.kind===`framework-bulk-update`&&W.requestedAt!==he){ge(W.requestedAt),G(!0);let e=window.setTimeout(()=>G(!1),6e3);return()=>window.clearTimeout(e)}},[me,he,W]),ce();let K=e(async()=>{let e=(C??[]).filter(e=>!e.isSystem);if(e.length!==0){if(!d.isHub){for(let t of e)await N.mutateAsync({name:t.name,version:t.latestVersion,nodeId:d.id});return}await H.mutateAsync({kind:`update`,targets:e.map(e=>({name:e.name,version:e.latestVersion})),nodeIds:[d.id]})}},[C,d.id,d.isHub,H,N]),q=ie({onSuccess:()=>{h.invalidateQueries({queryKey:[[`addons`]]}),h.invalidateQueries({queryKey:[[`addonPages`]]}),h.invalidateQueries({queryKey:[[`capabilities`]]}),h.invalidateQueries({queryKey:[[`integrations`]]})}}),[J,be]=c(`type`),[xe,Se]=c(()=>typeof window>`u`?`grouped`:window.localStorage.getItem(`camstack.addons.viewMode`)===`flat`?`flat`:`grouped`),Y=e=>{Se(e),typeof window<`u`&&window.localStorage.setItem(`camstack.addons.viewMode`,e)},[Ce,X]=z(),Z=Ce.get(`capability`),we=a(()=>{let e=n.filter(e=>!je(e.manifest.packageName));return d.isHub||(e=e.filter(e=>Me(e.placement,d.isHub))),Z&&(e=e.filter(e=>(e.manifest.capabilities??[]).some(e=>(typeof e==`string`?e:e.name)===Z))),e},[n,d.isHub,Z]),Te=()=>{let e=new URLSearchParams(Ce);e.delete(`capability`),X(e,{replace:!0})},Ee=xe===`flat`?we:Pe(we),Q=a(()=>{let e=[...Ee];switch(J){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},[Ee,J]);return i(`div`,{className:`space-y-4`,children:[[...E.entries()].map(([e,t])=>l(`div`,{className:`rounded-md border border-danger/30 bg-danger/5 px-3 py-2 text-[11px]`,children:i(`div`,{className:`flex items-start justify-between gap-3`,children:[i(`div`,{className:`space-y-0.5`,children:[i(`div`,{className:`font-medium text-danger`,children:[`Failed to update `,e]}),l(`div`,{className:`text-foreground-subtle font-mono`,children:t})]}),l(`button`,{type:`button`,onClick:()=>de(e),className:`text-foreground-subtle hover:text-foreground text-[10px]`,children:`dismiss`})]})},e)),i(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[i(`div`,{className:`flex items-center gap-1.5`,children:[l(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Sort:`}),i(`select`,{value:J,onChange:e=>be(e.target.value),className:`rounded-md border border-border bg-surface px-2 py-1.5 text-[11px] text-foreground focus:outline-none focus:border-primary/50`,children:[l(`option`,{value:`type`,children:`Bundles first`}),l(`option`,{value:`name`,children:`Name`}),l(`option`,{value:`source`,children:`Install source`})]})]}),i(`div`,{className:`flex items-center gap-1.5`,children:[l(`span`,{className:`text-[10px] text-foreground-subtle`,children:`View:`}),l(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`grouped`,`flat`].map(e=>l(`button`,{type:`button`,onClick:()=>Y(e),className:`px-2.5 py-1.5 transition-colors capitalize ${xe===e?`bg-primary/10 text-primary`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`}`,title:e===`grouped`?`Group multi-addon packages into a bundle card`:`Show every addon as its own card`,children:e},e))})]}),d.isHub&&i(`div`,{className:`flex items-center gap-1.5`,children:[l(j,{className:`h-3 w-3 text-foreground-subtle`}),l(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Auto-Update:`}),l(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`off`,`latest`,`beta`].map(e=>l(`button`,{type:`button`,onClick:()=>fe.mutate({channel:e}),disabled:fe.isPending,className:`px-2.5 py-1.5 transition-colors capitalize ${R?.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&&i(`div`,{className:`flex items-center gap-1.5`,children:[l(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Check every:`}),l(`select`,{className:`rounded-md border border-border bg-transparent px-1.5 py-1 text-[10px] font-medium text-foreground-subtle`,value:R?.updateCheckIntervalSeconds??21600,disabled:B.isPending||R===void 0,onChange:e=>{R!==void 0&&B.mutate({channel:R.channel,updateCheckIntervalSeconds:Number(e.target.value)})},children:ke.map(e=>l(`option`,{value:e.seconds,children:e.label},e.seconds))})]}),ae>0&&i(`button`,{type:`button`,onClick:()=>void K(),disabled:H.isPending,className:`flex items-center gap-1.5 px-2.5 py-1.5 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:[H.isPending?l(P,{className:`w-3 h-3 animate-spin`}):l(A,{className:`w-3 h-3`}),H.isPending?`Updating…`:`Update All (${ae})`]}),i(`button`,{type:`button`,onClick:f,disabled:p||H.isPending,className:`flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,children:[l(j,{className:`w-3 h-3 ${p?`animate-spin`:``}`}),`Refresh`]})]}),i(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3`,children:[i(`div`,{className:`relative flex-1 min-w-0 sm:min-w-[200px]`,ref:S,children:[l(M,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-foreground-subtle`}),l(`input`,{type:`text`,value:_,onChange:e=>{v(e.target.value),x(!0)},onFocus:()=>x(!0),placeholder:`Search addons on npm...`,disabled:H.isPending,className:`w-full rounded-lg border border-border bg-background pl-9 pr-3 py-2 text-xs text-foreground placeholder:text-foreground-subtle focus:outline-none focus:ring-1 focus:ring-primary disabled:opacity-50 disabled:cursor-not-allowed`}),pe&&l(P,{className:`absolute right-2.5 top-1/2 -translate-y-1/2 h-3 w-3 text-foreground-subtle animate-spin`}),b&&V&&V.length>0&&i(`div`,{className:`absolute left-0 right-0 top-full mt-1 z-40 rounded-lg border border-border bg-surface shadow-xl overflow-hidden`,children:[V.length>0&&i(`div`,{className:`px-3 py-1.5 text-[10px] uppercase tracking-wide text-foreground-subtle border-b border-border`,children:[`npm results (`,V.length,`)`]}),V&&V.length>0&&l(`div`,{className:`max-h-72 overflow-auto divide-y divide-border`,children:V.map(e=>i(`div`,{className:`flex items-center gap-3 px-3 py-2 hover:bg-surface-hover transition-colors`,children:[l(`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()}),i(`div`,{className:`flex-1 min-w-0`,children:[i(`div`,{className:`flex items-baseline gap-2 min-w-0`,children:[l(`span`,{className:`text-[11px] font-semibold break-words`,children:e.name.replace(/^@camstack\/(addon-)?/,``)}),i(`span`,{className:`text-[10px] text-foreground-subtle shrink-0`,children:[`v`,e.version]})]}),l(`div`,{className:`font-mono text-[9px] text-foreground-subtle/80 truncate`,children:e.name}),e.description&&l(`div`,{className:`text-[10px] text-foreground-subtle truncate`,children:e.description})]}),e.installed?i(`span`,{className:`inline-flex items-center gap-1 px-2 py-1 text-[10px] font-medium rounded-md border border-emerald-500/30 bg-emerald-500/10 text-emerald-400 shrink-0`,children:[l(U,{className:`h-3 w-3`}),e.installedVersion??`Installed`]}):i(`button`,{type:`button`,onClick:()=>q.mutate({packageName:e.name}),disabled:q.isPending,className:`inline-flex items-center gap-1 px-2 py-1 text-[10px] font-medium rounded-md bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors shrink-0`,children:[q.isPending?l(P,{className:`h-3 w-3 animate-spin`}):l(A,{className:`h-3 w-3`}),`Install`]})]},e.name))})]})]}),l(Oe,{onUploadSuccess:()=>{h.invalidateQueries({queryKey:[[`addons`]]}),f()}})]}),Z&&i(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg bg-primary/10 border border-primary/30 text-sm`,children:[l(`span`,{className:`text-foreground-subtle`,children:`Filtering by capability:`}),l(`span`,{className:`font-mono text-primary font-semibold`,children:Z}),l(`button`,{type:`button`,onClick:Te,className:`ml-auto text-xs text-foreground-subtle hover:text-foreground underline`,children:`Clear`})]}),_e&&i(`div`,{className:`fixed top-[calc(env(safe-area-inset-top)+1rem)] right-[calc(env(safe-area-inset-right)+1rem)] z-50 flex items-start gap-2 px-3 py-2.5 rounded-md border border-green-500/30 bg-green-500/10 shadow-lg backdrop-blur-sm max-w-sm pointer-events-auto`,children:[l(L,{className:`w-4 h-4 shrink-0 mt-0.5 text-green-400`}),i(`div`,{children:[l(`div`,{className:`text-[11px] font-semibold text-foreground`,children:`Bulk update completed`}),l(`div`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:`System packages updated — hub restarted successfully.`})]})]}),we.length===0&&l(`div`,{className:`text-xs text-foreground-subtle`,children:n.length===0?`No addons installed`:Z?`No installed addons declare the "${Z}" capability. Browse the npm catalog above to find a compatible addon.`:`No addons compatible with ${d.name} (placement filter active)`}),l(`div`,{className:`space-y-2`,children:Q.map(e=>{let t=$(e)?e.bundle.packageName:e.manifest.packageName,n=w.get(t),r=$(e)?e.representative:e,i=n?e=>N.mutate({name:t,version:e,nodeId:d.id}):void 0,a=F.get(t)??null,s=a!==null&&ve(a);return l(De,{addon:r,clusterStatus:o?.[r.manifest.id],bundle:$(e)?e.bundle:void 0,availableUpdate:n,isUpdating:oe.has(t)||s,jobProgress:a,onUpdate:i,disabledByBulk:H.isPending},$(e)?t:e.manifest.id)})})]})}function Ie(){let e=s(),{data:n,isLoading:r,isError:o}=_(),{data:d}=ee(void 0),{data:p}=w(void 0,{refetchInterval:1e4}),m=a(()=>{let e=new Map;e.set(`hub`,{id:`hub`,name:`Hub`,isHub:!0});for(let t of p??[]){let n=String(t.id??``);n&&e.set(n,{id:n,name:String(t.name??n),isHub:!!t.isHub})}return[...e.values()]},[p]),[h,g]=c(`hub`),v=m.find(e=>e.id===h)??m[0],y=ae(),b=f(),x=y.isPending||b.isPending,S=async()=>{await y.mutateAsync({nodeId:h}),await b.mutateAsync(),e.invalidateQueries({queryKey:[[`addons`]]})},C=t(y);C.current=y,u(()=>{C.current.mutate({nodeId:`hub`})},[]);let te=(n??[]).map(Ne).filter(e=>e!==null);return i(W,{children:[i(`div`,{className:`flex items-center justify-between gap-3 flex-wrap`,children:[l(oe,{selectedNodeId:h,onSelect:g}),i(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[!r&&!o&&i(`span`,{className:`text-[10px] rounded-full bg-primary/10 text-primary px-2 py-0.5 font-medium`,children:[te.length,` installed`]}),i(`button`,{type:`button`,onClick:()=>void S(),disabled:x,className:`inline-flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,title:`Re-fetch addons + check npm for new versions`,children:[l(j,{className:`w-3 h-3 ${x?`animate-spin`:``}`}),`Check for updates`]})]})]}),!v.isHub&&i(`div`,{className:`rounded-md border border-warning/30 bg-warning/5 px-3 py-2 text-[11px] text-foreground-subtle`,children:[`Showing only addons compatible with`,` `,l(`span`,{className:`font-medium text-foreground`,children:v.name}),` — agents only run`,` `,l(`code`,{className:`font-mono`,children:`agent-only`}),` and`,` `,l(`code`,{className:`font-mono`,children:`any-node`}),` addons. Install / uninstall is hub-driven; agents auto-sync from the hub.`]}),r&&l(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading…`}),o&&l(`div`,{className:`text-xs text-danger`,children:`Failed to load addons`}),!r&&!o&&l(Fe,{addons:te,clusterStatus:d,selectedNode:v,onRefresh:()=>void S(),isRefreshing:x})]})}export{Ie as AddonsPage};
@@ -1 +0,0 @@
1
- import{K as e,Q as t,S as n,W as r,b as i,o as a,q as o,x as s,z as c}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{At as l,Br as u,Dt as d,Et as f,It as p,Lt as m,Ot as h,Pt as g,ai as _,ci as v,di as y,fi as b,ii as x,js as S,kt as C,li as w,ln as T,ni as E,oi as D,pi as O,ri as k,si as A,ti as j,ui as ee,wt as M}from"./src-BHAm1a2j.js";import{Pt as N}from"./src-B4-xc1-S.js";import{a as P,i as F,n as I,r as te,t as L}from"./face-bbox-BBED_iSc.js";import{a as ne,c as re,f as R,i as ie,l as ae,m as z,n as B,o as oe,p as V,r as se,s as ce,t as le,u as ue}from"./debounced-invalidate-CwLD5Weo.js";import{t as H}from"./pencil-LYk12AGI.js";import{t as U}from"./plus-DpCA4f3I.js";import{t as de}from"./refresh-cw-aVMqVAXK.js";import{t as W}from"./square-check-big-D_32NB3x.js";import{t as G}from"./square-BeUYnpBQ.js";import{t as K}from"./undo-2-Bu9cI3K3.js";import{C as q,I as J,K as fe,R as pe,h as me,i as Y,l as he,s as X,z as Z}from"./index-D8DOnspM.js";import{t as Q}from"./AdminPage-CCD07UMs.js";import{r as ge,t as _e}from"./authed-media-BPd_L9jr.js";var ve=fe(`user-round`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]);t();var $=[[`faceGallery`]];function ye({identityId:e}){let t=a(),{data:r,isLoading:i}=A({identityId:e}),o=w();function c(n){o.mutate({identityId:e,sampleId:n.id},{onSettled:()=>{t.invalidateQueries({queryKey:$})}})}return i?n(`div`,{className:`flex items-center gap-2 py-3 text-xs text-foreground-subtle`,children:[s(q,{className:`h-3.5 w-3.5 animate-spin`}),`Loading samples…`]}):!r||r.length===0?s(`p`,{className:`py-2 text-xs text-foreground-subtle`,children:`No samples yet.`}):s(`div`,{className:`mt-2 grid grid-cols-4 gap-2 sm:grid-cols-6 md:grid-cols-8`,children:r.map(e=>n(`div`,{className:`group relative aspect-square overflow-hidden rounded-md border border-border bg-surface`,children:[e.base64?s(`img`,{src:`data:image/jpeg;base64,${e.base64}`,alt:`Sample`,className:`h-full w-full object-cover`}):s(`div`,{className:`flex h-full w-full items-center justify-center text-foreground-subtle`,children:s(ve,{className:`h-6 w-6`})}),s(`button`,{type:`button`,onClick:()=>c(e),disabled:o.isPending,className:`absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 transition-opacity group-hover:opacity-100 disabled:cursor-not-allowed`,"aria-label":`Remove sample`,children:s(Y,{className:`h-4 w-4 text-white`})})]},e.id))})}function be({identity:e,expanded:t,onToggle:r}){let c=a(),[u,_]=o(``),[v,y]=o(!1),[b,S]=o(!1),w=ee(),T=x();function E(){_(e.name),y(!0)}function D(){y(!1),_(``)}function O(){let t=u.trim();if(!t||t===e.name){D();return}w.mutate({id:e.id,name:t},{onSettled:()=>{c.invalidateQueries({queryKey:$}),D()}})}function k(){T.mutate({id:e.id},{onSettled:()=>{c.invalidateQueries({queryKey:$}),S(!1)}})}return n(`div`,{className:`rounded-md border border-border bg-surface`,children:[n(`div`,{className:`flex items-center gap-2 px-3 py-2`,children:[s(`div`,{className:`h-8 w-8 shrink-0 overflow-hidden rounded-full border border-border bg-surface-hover`,children:e.coverBase64?s(`img`,{src:`data:image/jpeg;base64,${e.coverBase64}`,alt:e.name,className:`h-full w-full object-cover`}):s(`div`,{className:`flex h-full w-full items-center justify-center`,children:s(ve,{className:`h-4 w-4 text-foreground-subtle`})})}),s(`div`,{className:`flex flex-1 min-w-0 items-center gap-2`,children:v?n(i,{children:[s(g,{value:u,onChange:e=>_(e.target.value),onKeyDown:e=>{e.key===`Enter`&&O(),e.key===`Escape`&&D()},className:`h-6 text-xs`,autoFocus:!0}),s(`button`,{type:`button`,onClick:O,disabled:w.isPending,className:`text-success hover:text-success/80 disabled:opacity-50`,"aria-label":`Confirm rename`,children:s(Z,{className:`h-3.5 w-3.5`})}),s(`button`,{type:`button`,onClick:D,className:`text-foreground-subtle hover:text-foreground`,"aria-label":`Cancel rename`,children:s(Y,{className:`h-3.5 w-3.5`})})]}):s(`span`,{className:`truncate text-sm font-medium text-foreground`,children:e.name})}),s(p,{variant:`default`,className:`text-[10px]`,children:e.sampleCount}),!v&&n(`div`,{className:`flex items-center gap-1`,children:[s(`button`,{type:`button`,onClick:E,className:`p-1 rounded hover:bg-surface-hover text-foreground-subtle hover:text-foreground`,"aria-label":`Rename`,children:s(H,{className:`h-3.5 w-3.5`})}),s(`button`,{type:`button`,onClick:()=>S(!0),className:`p-1 rounded hover:bg-danger/10 text-foreground-subtle hover:text-danger`,"aria-label":`Delete`,children:s(X,{className:`h-3.5 w-3.5`})})]}),s(`button`,{type:`button`,onClick:r,className:`p-1 rounded hover:bg-surface-hover text-foreground-subtle`,"aria-label":t?`Collapse`:`Expand`,children:s(t?pe:J,{className:`h-3.5 w-3.5`})})]}),t&&s(`div`,{className:`border-t border-border px-3 pb-3 pt-2`,children:s(ye,{identityId:e.id})}),s(M,{open:b,onOpenChange:e=>!e&&S(!1),children:n(f,{children:[n(C,{children:[s(l,{children:`Delete person`}),n(d,{children:[`Delete `,s(`strong`,{children:e.name}),` and all their samples? This cannot be undone.`]})]}),n(h,{children:[s(m,{variant:`secondary`,onClick:()=>S(!1),children:`Cancel`}),n(m,{variant:`danger`,onClick:k,disabled:T.isPending,children:[T.isPending?s(q,{className:`h-3.5 w-3.5 animate-spin`}):null,`Delete`]})]})]})})]})}function xe(){let e=a(),[t,r]=o(``),i=E();function c(){let n=t.trim();n&&i.mutate({name:n},{onSettled:()=>{e.invalidateQueries({queryKey:$}),r(``)}})}return n(`div`,{className:`flex items-center gap-2 pt-2`,children:[s(g,{placeholder:`New person name…`,value:t,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&c()},className:`h-7 text-xs flex-1`}),n(m,{variant:`primary`,size:`sm`,onClick:c,disabled:i.isPending||!t.trim(),children:[i.isPending?s(q,{className:`h-3.5 w-3.5 animate-spin`}):s(U,{className:`h-3.5 w-3.5`}),`Add`]})]})}function Se(){let{data:e,isLoading:t}=D(),[r,i]=o(null);function a(e){i(t=>t===e?null:e)}return t?n(`div`,{className:`flex items-center gap-2 py-4 text-xs text-foreground-subtle`,children:[s(q,{className:`h-4 w-4 animate-spin`}),`Loading people…`]}):n(`div`,{className:`space-y-2`,children:[(!e||e.length===0)&&s(`p`,{className:`py-2 text-xs text-foreground-subtle`,children:`No people enrolled yet. Add one below.`}),e?.map(e=>s(be,{identity:e,expanded:r===e.id,onToggle:()=>a(e.id)},e.id)),s(xe,{})]})}function Ce(e){let t=e.cropUrl!==void 0&&e.cropUrl.length>0,n=e.base64!==void 0&&e.base64.length>0;return!t&&!n}function we(e){return e.filter(Ce).map(e=>e.faceId)}function Te(e){let t=0;for(let n of e)Ce(n)&&(t+=1);return t}function Ee(e){return e==null?null:e.cropUrl!==void 0&&e.cropUrl.length>0?e.cropUrl:e.base64!==void 0&&e.base64.length>0?`data:image/jpeg;base64,${e.base64}`:null}t();var De=[[`faceGallery`]];function Oe({faceIds:e,identities:t,onDone:r}){let i=a(),c=j(),u=E(),[p,_]=o(``),[v,y]=o(!1),[b,x]=o(null),S=e!==null&&e.length>0,w=e?.length??0;function T(){y(!1),_(``),x(null)}function D(){T(),r()}function O(t){!e||e.length===0||c.mutate({faceIds:[...e],identityId:t},{onSettled:()=>{i.invalidateQueries({queryKey:De}),D()}})}function k(){!e||!p.trim()||u.mutate({name:p.trim()},{onSuccess:e=>{e?.id&&O(e.id)},onError:()=>{i.invalidateQueries({queryKey:De}),D()}})}let A=c.isPending||u.isPending;return s(M,{open:S,onOpenChange:e=>!e&&D(),children:n(f,{children:[n(C,{children:[s(l,{children:w>1?`Assign ${String(w)} faces to person`:`Assign face to person`}),s(d,{children:`Select an existing person or create a new one.`})]}),s(`div`,{className:`space-y-1 max-h-56 overflow-y-auto`,children:t.map(e=>n(`button`,{type:`button`,onClick:()=>x(e.id),className:`w-full rounded-md px-3 py-2 text-left text-xs transition-colors ${b===e.id?`bg-primary/12 text-primary`:`hover:bg-surface-hover text-foreground`}`,children:[s(`span`,{className:`font-medium`,children:e.name}),n(`span`,{className:`ml-2 text-foreground-subtle`,children:[e.sampleCount,` samples`]})]},e.id))}),v?s(`div`,{className:`flex items-center gap-2 pt-2 border-t border-border`,children:s(g,{placeholder:`New person name…`,value:p,onChange:e=>_(e.target.value),onKeyDown:e=>{e.key===`Enter`&&k()},autoFocus:!0,className:`flex-1`})}):s(`button`,{type:`button`,onClick:()=>{x(null),y(!0)},className:`mt-2 w-full rounded-md border border-dashed border-border px-3 py-2 text-left text-xs text-foreground-subtle hover:border-primary hover:text-primary transition-colors`,children:`+ New person…`}),n(h,{children:[s(m,{variant:`secondary`,onClick:D,disabled:A,children:`Cancel`}),v?n(m,{variant:`primary`,onClick:k,disabled:A||!p.trim(),children:[A&&s(q,{className:`h-3.5 w-3.5 animate-spin`}),`Create & assign`]}):n(m,{variant:`primary`,onClick:()=>b&&O(b),disabled:A||!b,children:[A&&s(q,{className:`h-3.5 w-3.5 animate-spin`}),`Assign`,w>1?` ${String(w)}`:``]})]})]})})}t();function ke(e){let[t,n]=o(null),[r,i]=o(null),[a,s]=o(!1);return c(()=>{if(n(null),i(null),s(!1),!e)return;let t=!1,r=null;return(async()=>{try{let i=await ge(`${_e}/${encodeURIComponent(e)}`);if(t)return;r=URL.createObjectURL(i),n(r)}catch{t||s(!0)}})(),()=>{t=!0,r&&URL.revokeObjectURL(r)}},[e]),c(()=>{if(!t)return;let e=new Image;return e.onload=()=>i({width:e.naturalWidth,height:e.naturalHeight}),e.onerror=()=>s(!0),e.src=t,()=>{e.onload=null,e.onerror=null}},[t]),{frameSrc:t,naturalWidth:r?.width??null,naturalHeight:r?.height??null,failed:a}}function Ae(e){let t=e.filter(e=>e.base64.length>0);return t.length===0?null:t.find(e=>/crop|face/i.test(e.kind))??t[0]}function je({label:e,value:t}){return n(`div`,{className:`flex items-baseline justify-between gap-3 py-1.5 border-b border-border/60 last:border-0`,children:[s(`span`,{className:`shrink-0 text-[11px] uppercase tracking-wide text-foreground-subtle`,children:e}),s(`span`,{className:`min-w-0 truncate text-right text-xs font-medium text-foreground`,children:t})]})}function Me({box:e}){return s(`div`,{className:`pointer-events-none absolute rounded-[3px] border-2 border-primary shadow-[0_0_0_9999px_rgba(0,0,0,0.28)]`,style:{left:`${String(e.x*100)}%`,top:`${String(e.y*100)}%`,width:`${String(e.width*100)}%`,height:`${String(e.height*100)}%`},children:s(`span`,{className:`absolute -top-4 left-0 rounded bg-primary px-1 text-[9px] font-semibold uppercase tracking-wide text-white`,children:`Face`})})}function Ne({face:e,cameraName:t,onClose:i,onAssign:a,onUnassign:c,onDelete:l,actionsPending:u}){let{data:d,isFetching:p}=_({faceId:e?.faceId??``},{enabled:e!==null}),[h,g]=o(`frame`),{frameSrc:v,naturalWidth:y,naturalHeight:b,failed:x}=ke(e?.keyFrameMediaKey),S=r(()=>{let t=Ae(d??[]);return t?`data:image/jpeg;base64,${t.base64}`:Ee(e)},[d,e]),C=r(()=>!e?.faceBbox||y===null||b===null?null:L(e.faceBbox,y,b),[e?.faceBbox,y,b]);if(e===null)return null;let w=typeof e.keyFrameMediaKey==`string`&&e.keyFrameMediaKey.length>0&&!x,T=w&&h===`frame`,E=e.assigned?e.identityName??`Assigned`:e.recognizedIdentityId?`${e.identityName??`Recognized`} (suggested)`:`Unassigned`;return s(M,{open:!0,onOpenChange:e=>!e&&i(),children:n(f,{width:`lg`,placement:`sheet-on-mobile`,"aria-label":`Face detail`,className:`flex max-h-[92dvh] flex-col gap-0 overflow-hidden p-0 bottom-0 left-0 right-0 top-auto w-full max-w-full translate-x-0 translate-y-0 rounded-b-none md:bottom-auto md:left-1/2 md:right-auto md:top-1/2 md:w-[calc(100vw-2rem)] md:max-w-xl md:-translate-x-1/2 md:-translate-y-1/2 md:rounded-lg md:max-h-[calc(100dvh-2rem)]`,children:[n(`header`,{className:`flex shrink-0 items-start justify-between gap-2 border-b border-border px-4 py-3`,children:[n(`div`,{className:`min-w-0`,children:[s(`div`,{className:`truncate text-sm font-semibold text-foreground`,children:`Face detail`}),s(`div`,{className:`mt-0.5 truncate text-[11px] text-foreground-subtle`,children:t})]}),s(`button`,{type:`button`,onClick:i,className:`rounded p-1 text-foreground-subtle hover:bg-surface-hover hover:text-foreground`,"aria-label":`Close`,children:s(Y,{className:`h-4 w-4`})})]}),n(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto overscroll-contain px-4 py-3`,children:[w&&n(`div`,{className:`flex items-center gap-1 rounded-md border border-border p-0.5 text-xs`,children:[n(`button`,{type:`button`,onClick:()=>g(`frame`),className:`flex flex-1 items-center justify-center gap-1 rounded px-2 py-1 transition-colors ${h===`frame`?`bg-primary/12 font-medium text-primary`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground`}`,children:[s(F,{className:`h-3.5 w-3.5`}),` Full frame`]}),n(`button`,{type:`button`,onClick:()=>g(`crop`),className:`flex flex-1 items-center justify-center gap-1 rounded px-2 py-1 transition-colors ${h===`crop`?`bg-primary/12 font-medium text-primary`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground`}`,children:[s(P,{className:`h-3.5 w-3.5`}),` Crop`]})]}),T&&v?s(`div`,{className:`overflow-hidden rounded-lg border border-border bg-background`,children:s(B,{src:v,alt:`Full frame with detected face`,fit:`natural`,className:`w-full`,overlay:C?s(Me,{box:C}):void 0})}):S?n(`div`,{className:`relative aspect-square w-full overflow-hidden rounded-lg border border-border`,children:[s(B,{src:S,alt:`Detected face`,className:`h-full w-full`}),p&&s(`div`,{className:`absolute right-2 top-2 rounded-full bg-black/50 p-1 text-white`,children:s(q,{className:`h-3.5 w-3.5 animate-spin`})})]}):n(`div`,{className:`flex aspect-square w-full flex-col items-center justify-center gap-1.5 rounded-lg border border-border bg-warning/5 text-foreground-subtle`,children:[s(z,{className:`h-8 w-8 text-warning/70`}),s(`span`,{className:`text-[11px] font-medium uppercase tracking-wide text-warning/80`,children:`No image`}),s(`span`,{className:`px-6 text-center text-[10px] text-foreground-subtle`,children:`The crop media for this face could not be resolved (a pre-fix orphan). Safe to delete.`})]}),n(`div`,{className:`rounded-lg border border-border bg-surface px-3 py-1`,children:[s(je,{label:`Camera`,value:t}),s(je,{label:`Captured`,value:V(e.timestamp)}),s(je,{label:`Track`,value:e.trackId}),s(je,{label:`Identity`,value:E})]})]}),n(`footer`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-border px-4 py-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]`,children:[e.assigned?n(m,{variant:`secondary`,onClick:()=>c(e.faceId),disabled:u,children:[s(I,{className:`h-3.5 w-3.5`}),` Detach`]}):n(m,{variant:`primary`,onClick:()=>a(e.faceId),disabled:u,children:[s(te,{className:`h-3.5 w-3.5`}),` Assign`]}),n(m,{variant:`secondary`,onClick:()=>l(e.faceId),disabled:u,children:[s(X,{className:`h-3.5 w-3.5`}),` Delete`]})]})]})})}function Pe(e,t){let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}function Fe(e,t){return e.faceIds.filter(e=>!t.has(e))}function Ie(e,t){return e.faceIds.filter(e=>t(e))}t();var Le=[[`faceGallery`]],Re=20,ze=.3,Be=.9,Ve=.05,He=.5,Ue=2,We=10,Ge=2;function Ke({cluster:e,face:t,active:r,onSelect:i}){let a=Ee(t);return n(`button`,{type:`button`,onClick:i,className:`flex shrink-0 flex-col items-center gap-1.5 rounded-md border p-2 text-center transition-colors md:w-full md:flex-row md:gap-2.5 md:text-left ${r?`border-primary bg-primary/8`:`border-border bg-surface hover:bg-surface-hover`}`,children:[s(`div`,{className:`h-24 w-24 shrink-0 overflow-hidden rounded bg-surface-hover`,children:a===null?s(z,{className:`h-24 w-24 p-6 text-foreground-subtle`}):s(`img`,{src:a,alt:``,loading:`lazy`,decoding:`async`,className:`h-24 w-24 object-cover`})}),n(`span`,{className:`w-24 text-[11px] leading-tight text-foreground-subtle md:w-auto`,children:[e.size,` faces · `,Math.round(e.cohesion*100),`% alike`]})]})}function qe({face:e,cameraName:t,nowMs:r,excluded:i,onToggleExclude:a,onDelete:o,deletePending:c}){let l=Ee(e);return n(`div`,{className:`relative flex flex-col rounded-md border bg-surface overflow-hidden transition-opacity ${i?`border-border opacity-40 grayscale`:`border-border`}`,children:[n(`div`,{className:`aspect-square relative overflow-hidden bg-surface-hover`,children:[l===null?n(`div`,{className:`flex h-full w-full flex-col items-center justify-center gap-1 bg-warning/5 text-foreground-subtle`,children:[s(z,{className:`h-7 w-7 text-warning/70`}),s(`span`,{className:`text-[9px] font-medium uppercase tracking-wide text-warning/80`,children:`No crop`})]}):s(B,{src:l,alt:`Face from ${t}`,className:`h-full w-full`}),s(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),a()},className:`absolute right-1 top-1 z-10 rounded-full bg-black/50 p-1.5 text-white hover:bg-black/70`,"aria-label":i?`Include face`:`Exclude face`,title:i?`Include`:`Exclude`,children:s(i?K:Y,{className:`h-3.5 w-3.5`})})]}),n(`div`,{className:`min-w-0 px-2 pt-1.5 space-y-0.5`,children:[s(`p`,{className:`text-[10px] font-medium text-foreground truncate`,title:t,children:t}),s(`p`,{className:`text-[10px] text-foreground-subtle truncate`,children:R(e.timestamp,r)})]}),s(`div`,{className:`mt-1 flex items-center justify-end border-t border-border/60 px-1 py-0.5`,children:s(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),o()},disabled:c,className:`rounded p-1.5 text-foreground-subtle transition-colors hover:bg-danger/10 hover:text-danger disabled:opacity-40`,"aria-label":`Delete face`,title:`Delete face`,children:c?s(q,{className:`h-4 w-4 animate-spin`}):s(X,{className:`h-4 w-4`})})})]})}function Je({open:e,onClose:t,byId:l,cameraName:u,nowMs:d,identities:p,selectMany:h}){let g=a(),_=T(),v=k(),[b,x]=o(He),[S,C]=o(Ge),[w,E]=o(null),[D,O]=o({}),[A,j]=o(null),{data:ee,isFetching:N,refetch:P}=y({threshold:b,minClusterSize:S,limit:Re},{enabled:e}),F=ee??[];c(()=>{O({})},[b,S]),c(()=>{if(F.length===0){E(null);return}F.some(e=>e.representativeFaceId===w)||E(F[0]?.representativeFaceId??null)},[F]);let I=r(()=>F.find(e=>e.representativeFaceId===w)??null,[F,w]),L=I?D[I.representativeFaceId]??new Set:new Set,ne=r(()=>I?Ie(I,e=>l.has(e)):[],[I,l]),re=I?I.faceIds.length-ne.length:0,R=I?Fe({...I,faceIds:ne},L):[];function ie(e){if(!I)return;let t=I.representativeFaceId;O(n=>({...n,[t]:Pe(n[t]??new Set,e)}))}function ae(){g.invalidateQueries({queryKey:Le})}async function z(e){await _({title:`Delete face`,message:`Permanently deletes this face crop. This cannot be undone.`,confirmLabel:`Delete`,variant:`danger`})&&v.mutate({faceId:e},{onSettled:ae})}function B(){j(null),t()}function oe(){R.length!==0&&(h(R),B())}return n(M,{open:e,onOpenChange:e=>!e&&B(),children:[n(f,{placement:`sheet-on-mobile`,width:`lg`,"aria-label":`Look-alike groups`,className:`flex max-h-[92dvh] flex-col gap-0 overflow-hidden p-0 md:max-w-4xl`,children:[n(`header`,{className:`flex shrink-0 flex-col gap-2 border-b border-border px-4 py-3`,children:[n(`div`,{className:`flex items-center justify-between gap-2`,children:[n(`div`,{className:`flex items-center gap-1.5 text-sm font-semibold text-foreground`,children:[s(he,{className:`h-4 w-4 text-primary`}),` Look-alike groups`]}),s(`button`,{type:`button`,onClick:B,className:`rounded p-1 text-foreground-subtle hover:bg-surface-hover hover:text-foreground`,"aria-label":`Close`,children:s(Y,{className:`h-4 w-4`})})]}),n(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[n(`label`,{className:`flex items-center gap-2 text-[11px] text-foreground-subtle`,children:[`Threshold`,s(`input`,{type:`range`,min:ze,max:Be,step:Ve,value:b,onChange:e=>x(Number(e.target.value)),className:`h-1.5 w-28 cursor-pointer accent-primary`}),s(`span`,{className:`w-8 shrink-0 text-right font-mono text-[11px] tabular-nums text-foreground`,children:b.toFixed(2)})]}),n(`label`,{className:`flex items-center gap-2 text-[11px] text-foreground-subtle`,children:[`Min size`,s(`input`,{type:`number`,min:Ue,max:We,step:1,value:S,onChange:e=>C(Math.min(We,Math.max(Ue,Number(e.target.value)||Ue))),className:`w-12 rounded border border-border bg-background px-1.5 py-0.5 text-xs text-foreground`})]}),n(m,{variant:`secondary`,onClick:()=>{O({}),P()},disabled:N,children:[N?s(q,{className:`h-3.5 w-3.5 animate-spin`}):s(de,{className:`h-3.5 w-3.5`}),`Re-analyze`]})]})]}),s(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-hidden px-4 py-3 md:flex-row`,children:N&&F.length===0?n(`div`,{className:`flex flex-1 items-center justify-center gap-2 py-8 text-xs text-foreground-subtle`,children:[s(q,{className:`h-4 w-4 animate-spin`}),` Finding similar faces…`]}):F.length===0?s(`div`,{className:`flex flex-1 items-center justify-center py-8 text-xs text-foreground-subtle`,children:`No look-alike groups at this threshold.`}):n(i,{children:[s(`div`,{className:`flex gap-2 overflow-x-auto pb-1 md:hidden`,children:F.map(e=>s(Ke,{cluster:e,face:l.get(e.representativeFaceId),active:e.representativeFaceId===w,onSelect:()=>E(e.representativeFaceId)},e.representativeFaceId))}),s(`div`,{className:`hidden shrink-0 flex-col gap-2 overflow-y-auto md:flex md:w-56`,children:F.map(e=>s(Ke,{cluster:e,face:l.get(e.representativeFaceId),active:e.representativeFaceId===w,onSelect:()=>E(e.representativeFaceId)},e.representativeFaceId))}),s(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:I&&n(i,{children:[re>0&&n(`p`,{className:`mb-2 text-[11px] text-foreground-subtle`,children:[re,` not loaded — excluded from actions`]}),s(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(13rem,1fr))] gap-2`,children:ne.map(e=>{let t=l.get(e);return t?s(qe,{face:t,cameraName:u(t.deviceId),nowMs:d,excluded:L.has(e),onToggleExclude:()=>ie(e),onDelete:()=>void z(e),deletePending:v.isPending&&v.variables?.faceId===e},e):null})})]})})]})}),n(`footer`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-border px-4 py-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]`,children:[s(m,{variant:`secondary`,onClick:oe,disabled:R.length===0,children:`Select in gallery`}),n(m,{variant:`primary`,onClick:()=>j(R),disabled:R.length===0,children:[s(te,{className:`h-3.5 w-3.5`}),` Adopt (`,R.length,`)`]})]})]}),s(Oe,{faceIds:A,identities:p,onDone:()=>j(null)})]})}t();var Ye=[[`faceGallery`]],Xe=500,Ze=120;function Qe({face:e,cameraName:t,nowMs:r,selected:i,onToggleSelect:o,onAssign:c,onOpenDetail:l}){let u=a(),d=b(),f=k(),p=()=>{u.invalidateQueries({queryKey:Ye})},m=()=>l(e.faceId),h=Ee(e);return n(`div`,{className:`relative flex flex-col rounded-md border bg-surface overflow-hidden ${i?`border-primary ring-1 ring-primary`:`border-border`}`,children:[n(`div`,{className:`aspect-square relative overflow-hidden bg-surface-hover`,children:[h===null?n(`button`,{type:`button`,onClick:m,className:`flex h-full w-full flex-col items-center justify-center gap-1 bg-warning/5 text-foreground-subtle`,title:`No crop image — the face's crop media is missing (a pre-fix orphan). Safe to delete.`,children:[s(z,{className:`h-7 w-7 text-warning/70`}),s(`span`,{className:`text-[9px] font-medium uppercase tracking-wide text-warning/80`,children:`No crop`})]}):s(`img`,{src:h,alt:`Face from ${t}`,onClick:m,loading:`lazy`,decoding:`async`,className:`h-full w-full cursor-zoom-in object-cover`}),s(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),o(e.faceId)},className:`absolute left-0 top-0 z-10 rounded-br-md bg-black/50 p-1.5 text-white hover:bg-black/70`,"aria-label":i?`Deselect`:`Select`,children:i?s(W,{className:`h-4 w-4 text-primary`}):s(G,{className:`h-4 w-4`})})]}),n(`div`,{className:`min-w-0 px-2 pt-1.5 space-y-0.5`,children:[s(`p`,{className:`text-[10px] font-medium text-foreground truncate`,title:t,children:t}),s(`p`,{className:`text-[10px] text-foreground-subtle truncate`,children:R(e.timestamp,r)}),e.identityName&&s(`p`,{className:`text-[10px] font-medium text-primary truncate`,title:e.identityName,children:e.identityName})]}),n(`div`,{className:`mt-1 flex items-center gap-0.5 border-t border-border/60 px-1 py-0.5`,children:[e.assigned?s(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),d.mutate({faceId:e.faceId},{onSettled:p})},disabled:d.isPending,className:`rounded p-1.5 text-foreground-subtle transition-colors hover:bg-warning/10 hover:text-warning disabled:opacity-40`,"aria-label":`Detach face`,title:`Detach`,children:d.isPending?s(q,{className:`h-4 w-4 animate-spin`}):s(I,{className:`h-4 w-4`})}):s(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),c(e.faceId)},className:`rounded p-1.5 text-foreground-subtle transition-colors hover:bg-primary/10 hover:text-primary`,"aria-label":`Assign face to person`,title:`Assign to person`,children:s(te,{className:`h-4 w-4`})}),s(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),f.mutate({faceId:e.faceId},{onSettled:p})},disabled:f.isPending,className:`ml-auto rounded p-1.5 text-foreground-subtle transition-colors hover:bg-danger/10 hover:text-danger disabled:opacity-40`,"aria-label":`Delete face`,title:`Delete face`,children:f.isPending?s(q,{className:`h-4 w-4 animate-spin`}):s(X,{className:`h-4 w-4`})})]})]})}var $e=[{label:`All`,value:`all`},{label:`Unassigned`,value:`unassigned`},{label:`Recognized`,value:`recognized`}];function et(){let e=a(),[t,c]=o(`all`),[l,d]=o(ce),[f,p]=o(new Set),[h,g]=o(new Set),[_,y]=o(null),[x,S]=o(!1),[C,w]=o(null),{data:T,isLoading:E}=v({limit:Xe,filter:t,includeCrops:!1},{refetchInterval:3e4}),{data:A=[]}=D(),{data:ee}=u({}),M=j(),N=b(),P=O(),F=k(),L=Date.now(),R=T??[],B=r(()=>{let e=new Map;for(let t of ee??[])e.set(t.id,t.name);return e},[ee]),V=e=>B.get(e)??`Camera #${String(e)}`,le=r(()=>re(R).map(e=>({id:e,name:V(e)})).sort((e,t)=>e.name.localeCompare(t.name)),[R,B]),H=r(()=>ae(ue(R,l),f),[R,l,f]),U=oe(H,Ze,r(()=>JSON.stringify([t,l.fromMs,l.toMs,[...f].sort((e,t)=>e-t)]),[t,l.fromMs,l.toMs,f])),de=r(()=>new Map(R.map(e=>[e.faceId,e])),[R]),W=r(()=>Te(H),[H]),G=C===null?null:de.get(C)??null,K=()=>{e.invalidateQueries({queryKey:Ye})},J=()=>g(new Set);function fe(e){g(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function pe(e){g(t=>{let n=new Set(t);for(let t of e)n.add(t);return n})}function me(){pe(we(H))}let Z=[...h],Q=M.isPending||P.isPending||F.isPending,ge=N.isPending||F.isPending;function _e(){Z.length!==0&&P.mutate({faceIds:Z},{onSettled:()=>{K(),J()}})}function ve(){Z.length!==0&&Promise.allSettled(Z.map(e=>F.mutateAsync({faceId:e}))).then(()=>{K(),J()})}function $(e){w(null),y([e])}function ye(e){N.mutate({faceId:e},{onSettled:K}),w(null)}function be(e){F.mutate({faceId:e},{onSettled:K}),w(null)}let xe=H.length!==R.length;return n(`div`,{className:`relative space-y-3`,children:[n(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[s(`div`,{className:`flex items-center gap-1`,children:$e.map(e=>s(`button`,{type:`button`,onClick:()=>c(e.value),className:`rounded-md px-2.5 py-1 text-xs transition-colors ${t===e.value?`bg-primary/12 text-primary font-medium`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground`}`,children:e.label},e.value))}),s(se,{onChange:d}),s(ie,{cameras:le,selected:f,onChange:p}),n(`button`,{type:`button`,onClick:()=>S(!0),className:`flex items-center gap-1 rounded-md px-2.5 py-1 text-xs transition-colors ${x?`bg-primary/12 text-primary font-medium`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground`}`,children:[s(he,{className:`h-3.5 w-3.5`}),` Similar groups`]}),!E&&W>0&&n(`button`,{type:`button`,onClick:me,className:`ml-auto flex items-center gap-1 rounded-md px-2.5 py-1 text-xs text-warning/90 transition-colors hover:bg-warning/10`,title:`Select every visible face whose crop image is missing so you can delete the orphans in one pass`,children:[s(z,{className:`h-3.5 w-3.5`}),` Select `,W,` crop-less`]}),!E&&s(`span`,{className:`text-[10px] text-foreground-subtle ${W>0?`ml-2`:`ml-auto`}`,children:xe?`${String(H.length)} of ${String(R.length)} faces`:`${String(H.length)} face${H.length===1?``:`s`}`})]}),h.size>0&&n(`div`,{className:`flex flex-wrap items-center gap-2 rounded-md border border-primary/40 bg-primary/8 px-3 py-2`,children:[n(`span`,{className:`text-xs font-medium text-foreground`,children:[h.size,` selected`]}),n(`div`,{className:`ml-auto flex flex-wrap items-center gap-1.5`,children:[n(m,{variant:`primary`,onClick:()=>y(Z),disabled:Q,children:[s(te,{className:`h-3.5 w-3.5`}),` Assign`]}),n(m,{variant:`secondary`,onClick:_e,disabled:Q,children:[P.isPending?s(q,{className:`h-3.5 w-3.5 animate-spin`}):s(I,{className:`h-3.5 w-3.5`}),` `,`Detach`]}),n(m,{variant:`secondary`,onClick:ve,disabled:Q,children:[s(X,{className:`h-3.5 w-3.5`}),` Delete`]}),s(m,{variant:`ghost`,onClick:J,disabled:Q,children:s(Y,{className:`h-3.5 w-3.5`})})]})]}),E&&n(`div`,{className:`flex items-center gap-2 py-4 text-xs text-foreground-subtle`,children:[s(q,{className:`h-4 w-4 animate-spin`}),` Loading faces…`]}),!E&&H.length===0&&s(`p`,{className:`py-4 text-xs text-foreground-subtle`,children:R.length>0?`No faces match the current date / camera filters.`:`No faces found for this filter.`}),!E&&H.length>0&&n(i,{children:[s(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(6.5rem,1fr))] gap-2`,children:U.pageItems.map(e=>s(Qe,{face:e,cameraName:V(e.deviceId),nowMs:L,selected:h.has(e.faceId),onToggleSelect:fe,onAssign:e=>y([e]),onOpenDetail:w},e.faceId))}),s(ne,{currentPage:U.page,totalItems:U.totalItems,pageSize:U.pageSize,onPageChange:U.setPage,itemNoun:`faces`})]}),s(Ne,{face:G,cameraName:G?V(G.deviceId):``,onClose:()=>w(null),onAssign:$,onUnassign:ye,onDelete:be,actionsPending:ge}),s(Oe,{faceIds:_,identities:A,onDone:()=>{y(null),J()}}),s(Je,{open:x,onClose:()=>S(!1),byId:de,cameraName:V,nowMs:L,identities:A,selectMany:pe})]})}t();var tt=[[`faceGallery`]],nt=2e3;function rt(){let t=a(),n=e(t);n.current=t;let r=e(void 0);r.current||=le({delayMs:nt,invalidate:()=>{n.current.invalidateQueries({queryKey:tt})}}),c(()=>()=>r.current?.cancel(),[]),S(N.PipelineAnalyticsFaceGalleryChanged,()=>{r.current?.trigger()})}function it(){return rt(),s(Q,{icon:me,title:`Faces`,subtitle:`Manage enrolled identities and assign detected face crops to people.`,children:n(`section`,{className:`space-y-3`,children:[n(`div`,{children:[s(`h2`,{className:`text-sm font-semibold text-foreground mb-1`,children:`People`}),s(`p`,{className:`text-xs text-foreground-subtle mb-3`,children:`Enrolled identities used for face recognition. Expand a row to view or remove training samples.`}),s(Se,{})]}),n(`div`,{className:`pt-4 border-t border-border`,children:[s(`h2`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Recent detected faces`}),s(`p`,{className:`text-xs text-foreground-subtle mb-3`,children:`Face crops captured by the detection pipeline. Assign them to a person to build recognition training data.`}),s(et,{})]})]})})}export{it as DetectionIntelligencePage};