@camstack/addon-admin-ui 1.2.530 → 1.2.532

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 (145) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/assets/{AddonAssetIcon-B1rn0DLw.js → AddonAssetIcon-CfGdzQS1.js} +1 -1
  3. package/dist/assets/Addons-D2MV22hj.js +5 -0
  4. package/dist/assets/{AdminPage-DmkuRREx.js → AdminPage-95Fx8-ai.js} +1 -1
  5. package/dist/assets/{AdminSectionedPage-Dv8ahC-U.js → AdminSectionedPage-CXlo0qGc.js} +1 -1
  6. package/dist/assets/{AiProfiles-BJrqkjtX.js → AiProfiles-Bb1UnC_U.js} +1 -1
  7. package/dist/assets/Build-B3Pfe7Gr.js +40 -0
  8. package/dist/assets/{Calendars-x_EpS-cd.js → Calendars-6NC4XKbJ.js} +1 -1
  9. package/dist/assets/{Cluster-aj2_8TZC.js → Cluster-BK3JDN8a.js} +1 -1
  10. package/dist/assets/ComposedDeviceEditDialog-FYsRkLBz.js +1 -0
  11. package/dist/assets/CompositionBlockEditor-B5c79zIn.js +2 -0
  12. package/dist/assets/{CompositionEditorPage-D09wEj7N.js → CompositionEditorPage-DC7kXor2.js} +1 -1
  13. package/dist/assets/{Data-D4Sz8Rl9.js → Data-DXhl9LBq.js} +1 -1
  14. package/dist/assets/DeviceDetail-CXnY80TP.js +2 -0
  15. package/dist/assets/{DeviceDoActionFields-D1rhgn3I.js → DeviceDoActionFields-CoQ2tX-q.js} +1 -1
  16. package/dist/assets/Devices-C0JTSIZP.js +1 -0
  17. package/dist/assets/{EmbedPlayerPage-D0lVyXps.js → EmbedPlayerPage-BDaNxrOE.js} +1 -1
  18. package/dist/assets/{FormBuilder-BvQZWKCS.js → FormBuilder-BTaNPSjN.js} +1 -1
  19. package/dist/assets/{History-TMZn0v_I.js → History-CxgkTGB8.js} +1 -1
  20. package/dist/assets/{Identity-DNIHuEKY.js → Identity-BMPRwxzH.js} +1 -1
  21. package/dist/assets/IntegrationDetail-DuM1lFY-.js +1 -0
  22. package/dist/assets/{IntegrationHub-DviGnYgu.js → IntegrationHub-DzmepqLp.js} +1 -1
  23. package/dist/assets/{Integrations-9bupF3uw.js → Integrations-B9EgQmNO.js} +1 -1
  24. package/dist/assets/{Integrations-B7okjAJ8.js → Integrations-CiSPvaJK.js} +1 -1
  25. package/dist/assets/{Library-BHn4Iifg.js → Library-DcwBFLS2.js} +1 -1
  26. package/dist/assets/{Locations-BVaRTbq0.js → Locations-DFR37ATW.js} +1 -1
  27. package/dist/assets/{Logs-DI7IZGug.js → Logs-CFR9B1vW.js} +1 -1
  28. package/dist/assets/{MaskShapeCanvas-HJuLPIJP.js → MaskShapeCanvas-Du7NeQ1p.js} +1 -1
  29. package/dist/assets/{MotionZonesSettings-COMPKhfx.js → MotionZonesSettings-DEov5lgX.js} +1 -1
  30. package/dist/assets/{MyAccess-YiGVb3gF.js → MyAccess-qH72oIKl.js} +1 -1
  31. package/dist/assets/Network-Bs4ySinW.js +1 -0
  32. package/dist/assets/{NodeAddonsSettingsPanel-Chb7RIE6.js → NodeAddonsSettingsPanel-CKuqtZiy.js} +1 -1
  33. package/dist/assets/Notifications-CrJqzOsT.js +1 -0
  34. package/dist/assets/{Pipeline-BT9k34b_.js → Pipeline-DINXMlHJ.js} +1 -1
  35. package/dist/assets/{PrivacyMaskSettings-C88JqmdE.js → PrivacyMaskSettings-B3og-Ovf.js} +1 -1
  36. package/dist/assets/Recordings-CcLwVhIE.js +1 -0
  37. package/dist/assets/RemoteGrid-BJ5xj0Z6.js +1 -0
  38. package/dist/assets/{ScanNetworkModal-Cq9BlXXk.js → ScanNetworkModal-agfFGh7H.js} +1 -1
  39. package/dist/assets/{SceneMonitorEditor-mE7W6emU.js → SceneMonitorEditor-RvxV30AA.js} +1 -1
  40. package/dist/assets/SessionsList-MVWwyBor.js +2 -0
  41. package/dist/assets/{Showroom-Crq5JUKV.js → Showroom-CcxQEbpv.js} +1 -1
  42. package/dist/assets/{System-CfurcyNZ.js → System-mXNnser5.js} +1 -1
  43. package/dist/assets/Templates-DlXAN6pH.js +1 -0
  44. package/dist/assets/{Terminal-UyKanKPS.js → Terminal-BShZ11PH.js} +5 -5
  45. package/dist/assets/{Trans-Bsz5Pghy.js → Trans-BgSU9dw1.js} +1 -1
  46. package/dist/assets/{Viewer-BTxcZ-BR.js → Viewer-BebHLPaG.js} +1 -1
  47. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-CmowmspB.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DIitQnBe.js} +1 -1
  48. package/dist/assets/{addon-icons-context-DZZCjo9x.js → addon-icons-context-v7m0a2FB.js} +1 -1
  49. package/dist/assets/addon-kind-filter-CEGKkC1O.js +1 -0
  50. package/dist/assets/{archive-Bu9T4BL0.js → archive-DXMVa-lX.js} +1 -1
  51. package/dist/assets/{assignment-candidates-DWivr3bV.js → assignment-candidates-66hRsjMW.js} +1 -1
  52. package/dist/assets/{authed-media-yW7W_8pm.js → authed-media-Czu7XTaj.js} +1 -1
  53. package/dist/assets/{bell-off-E0Abr7jJ.js → bell-off-CEN8nQp-.js} +1 -1
  54. package/dist/assets/{board-model-CCD7fB3T.js → board-model-D8H0B0qn.js} +1 -1
  55. package/dist/assets/{boxes-BkzsIUkw.js → boxes-eRc-lVOF.js} +1 -1
  56. package/dist/assets/circle-slash-CX4B4mGW.js +1 -0
  57. package/dist/assets/client-AOeY3PoN.js +806 -0
  58. package/dist/assets/{cloud-upload-BIjzjy_K.js → cloud-upload-DUJt0JdH.js} +1 -1
  59. package/dist/assets/crop-BXN2L3sb.js +1 -0
  60. package/dist/assets/{device-integration-icon-BpHHi90B.js → device-integration-icon-C4S0QaFp.js} +1 -1
  61. package/dist/assets/device-picker-model-CXUDiSMs.js +1 -0
  62. package/dist/assets/dist-Cx9VAEKP.js +806 -0
  63. package/dist/assets/{dist-DoqhrZoo.js → dist-DM6wwJkd.js} +1 -1
  64. package/dist/assets/{file-up-Cyg6A2qN.js → file-up-BBdOgTK9.js} +1 -1
  65. package/dist/assets/{format-ChSVChsY.js → format-42qUo1AE.js} +1 -1
  66. package/dist/assets/{grip-vertical-CLVyc1HC.js → grip-vertical-BmdvsAbL.js} +1 -1
  67. package/dist/assets/{hard-drive-download-Cd122TYb.js → hard-drive-download-Bc1pBGlo.js} +1 -1
  68. package/dist/assets/{hostInit-DR1ykbVx.js → hostInit-D8BcPSGc.js} +1 -1
  69. package/dist/assets/i18n-DFGXm9ze.js +1 -0
  70. package/dist/assets/icons-BtVYU84-.js +1 -0
  71. package/dist/assets/index-BGL4RiB2.css +2 -0
  72. package/dist/assets/{index-DGvsu0ui.js → index-DzxzA2lU.js} +3 -3
  73. package/dist/assets/{key-D_zqd1r-.js → key-CJv2Q3F2.js} +1 -1
  74. package/dist/assets/{key-round-pNw827HU.js → key-round-QObyZIrV.js} +1 -1
  75. package/dist/assets/{layers-CFNXRt4j.js → layers-Bty4v-Tb.js} +1 -1
  76. package/dist/assets/{linked-devices-model-D9m6pafu.js → linked-devices-model-Cgwx8ecs.js} +1 -1
  77. package/dist/assets/{list-ordered-Dy6tCUD8.js → list-ordered-D-ONPhRl.js} +1 -1
  78. package/dist/assets/{location-owned-usage-DasgH3RR.js → location-owned-usage-CcliDqzu.js} +1 -1
  79. package/dist/assets/{memory-stick-Bt2KoB-0.js → memory-stick-Drrk6RL-.js} +1 -1
  80. package/dist/assets/{message-square-plus-rkd_X0vs.js → message-square-plus-C1puLp2Z.js} +1 -1
  81. package/dist/assets/{mf-entry-bootstrap-0-3390b09e.js → mf-entry-bootstrap-0-31ab8284.js} +2 -2
  82. package/dist/assets/{mic-off-DWb36TX2.js → mic-off-BSOCVNWB.js} +1 -1
  83. package/dist/assets/{monitor-off-B2GWMMt_.js → monitor-off-CnQwhS8p.js} +1 -1
  84. package/dist/assets/{monitor-smartphone-DJzvbVtx.js → monitor-smartphone-DOpzfamp.js} +1 -1
  85. package/dist/assets/mount-CXUDiSMs.js +1 -0
  86. package/dist/assets/{notification-schedule-field-B7FdiF_t.js → notification-schedule-field-BOCpJtoM.js} +1 -1
  87. package/dist/assets/{player-overlays-DpZIxQHp.js → player-overlays-CdeStLFY.js} +1 -1
  88. package/dist/assets/{recycle-BWLoavmg.js → recycle-ClLhxLjT.js} +1 -1
  89. package/dist/assets/remoteEntry-CXTI50w4.js +1 -0
  90. package/dist/assets/{ruler-C1SbVRl3.js → ruler-coNtNpKS.js} +1 -1
  91. package/dist/assets/{scan-eye-Bv4PGTFl.js → scan-eye-BShVz2L8.js} +1 -1
  92. package/dist/assets/{scissors-BsEkbrx_.js → scissors-BxXRJpwa.js} +1 -1
  93. package/dist/assets/{search-x-DE4DxdsF.js → search-x-DpL8duZX.js} +1 -1
  94. package/dist/assets/{send-Dd0BBamd.js → send-ViRZe20J.js} +1 -1
  95. package/dist/assets/{settings-2-z3X6U2eo.js → settings-2-DvF55McU.js} +1 -1
  96. package/dist/assets/shapes-DNn8cgSP.js +1 -0
  97. package/dist/assets/{sigma-CxBVWJ85.js → sigma-BEGwr5QF.js} +1 -1
  98. package/dist/assets/{speaker-Dy79a571.js → speaker-GaNm4DAq.js} +1 -1
  99. package/dist/assets/src-CImrkf6y.js +67 -0
  100. package/dist/assets/{sso-popup-BjTl8T6g.js → sso-popup-BdhUqpKP.js} +1 -1
  101. package/dist/assets/{step-inspector-model-D6NC9QoX.js → step-inspector-model-BFTjgLfV.js} +1 -1
  102. package/dist/assets/{table-2-IUuOvuT8.js → table-2-C8-ZYHKC.js} +1 -1
  103. package/dist/assets/{timer-reset-D1H0hoMf.js → timer-reset-DN7ULNUA.js} +1 -1
  104. package/dist/assets/{unlink-DTu1e00O.js → unlink-86HtbCbI.js} +1 -1
  105. package/dist/assets/{usb-CFK8z-TS.js → usb-D-x3E2FA.js} +1 -1
  106. package/dist/assets/{use-device-bound-caps-DS4FtJtN.js → use-device-bound-caps-Co_MVwFl.js} +1 -1
  107. package/dist/assets/{use-scenes-feed-CE-KFGxN.js → use-scenes-feed-YiyBa_Xr.js} +1 -1
  108. package/dist/assets/{use-stationary-objects-CFLRkxjx.js → use-stationary-objects-BQcBWrZ4.js} +1 -1
  109. package/dist/assets/useEventInvalidation-CXUDiSMs.js +1 -0
  110. package/dist/assets/{useNodeUrlSelection-DytighTL.js → useNodeUrlSelection-Drl3e02l.js} +1 -1
  111. package/dist/assets/user-round-utP9DdB_.js +1 -0
  112. package/dist/assets/{user-x-KWsBR0tG.js → user-x-Zewc1EPo.js} +1 -1
  113. package/dist/assets/{variable-BG_qKWYf.js → variable-DkO97Gws.js} +1 -1
  114. package/dist/assets/{video-D0guHpd1.js → video-D8GbzI4M.js} +1 -1
  115. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-FCSZ5q7m.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BjuBkWi8.js} +2 -2
  116. package/dist/index.html +14 -14
  117. package/dist/server/addon.js +62303 -61883
  118. package/package.json +1 -1
  119. package/dist/assets/Addons-DRU_qk60.js +0 -5
  120. package/dist/assets/Build-DTcg9gkb.js +0 -40
  121. package/dist/assets/ComposedDeviceEditDialog-DNGwDK80.js +0 -1
  122. package/dist/assets/CompositionBlockEditor-O3eDPOLD.js +0 -2
  123. package/dist/assets/DeviceDetail-BE-C2aGY.js +0 -2
  124. package/dist/assets/Devices-BBsDc0QJ.js +0 -1
  125. package/dist/assets/IntegrationDetail-CYhU0hEL.js +0 -1
  126. package/dist/assets/Network-ZYEqAiF5.js +0 -1
  127. package/dist/assets/Notifications-DrVDMEuK.js +0 -1
  128. package/dist/assets/Recordings-Dl-l1Vzi.js +0 -1
  129. package/dist/assets/RemoteGrid-CF92aN64.js +0 -1
  130. package/dist/assets/SessionsList-84zwfhuD.js +0 -2
  131. package/dist/assets/Templates-D0V7IdcS.js +0 -1
  132. package/dist/assets/circle-slash-pdaivo-U.js +0 -1
  133. package/dist/assets/client-BvflqtP1.js +0 -711
  134. package/dist/assets/crop-CZJDrMcX.js +0 -1
  135. package/dist/assets/device-picker-model-2dkiqOI6.js +0 -1
  136. package/dist/assets/dist-Gm_hHBN2.js +0 -711
  137. package/dist/assets/i18n-Bg2ooh3q.js +0 -1
  138. package/dist/assets/icons-BSJCF6qM.js +0 -1
  139. package/dist/assets/index-CyqhCHax.css +0 -2
  140. package/dist/assets/mount-2dkiqOI6.js +0 -1
  141. package/dist/assets/remoteEntry-CD4F7fE2.js +0 -1
  142. package/dist/assets/shapes-D-IaC6en.js +0 -1
  143. package/dist/assets/src-KDhMZ5Ob.js +0 -67
  144. package/dist/assets/useEventInvalidation-2dkiqOI6.js +0 -1
  145. package/dist/assets/user-round-BSVSJsjB.js +0 -1
@@ -1 +1 @@
1
- import{C as e,S as t,Y as n,et as r}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{ut as i}from"./src-KDhMZ5Ob.js";import{t as a}from"./FormBuilder-BvQZWKCS.js";import{H as o,U as s}from"./index-DGvsu0ui.js";r();function c({title:n,children:r}){return e(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[t(`div`,{className:`border-b border-border px-4 py-2.5`,children:t(`h2`,{className:`text-xs font-semibold text-foreground uppercase tracking-wider`,children:n})}),t(`div`,{className:`p-4`,children:r})]})}function l({name:n,cssVar:r,hex:i}){return e(`div`,{className:`flex flex-col items-center gap-1.5`,children:[t(`div`,{className:`h-10 w-10 rounded-lg border border-border shadow-inner`,style:{backgroundColor:r?`var(${r})`:i}}),t(`span`,{className:`text-[10px] text-foreground-subtle text-center leading-tight`,children:n})]})}var u={sections:[{id:`demo`,title:`Demo Fields`,columns:2,fields:[{key:`name`,type:`text`,label:`Name`,placeholder:`Enter name`},{key:`count`,type:`number`,label:`Count`,min:0,max:100,unit:`items`},{key:`enabled`,type:`boolean`,label:`Enabled`},{key:`mode`,type:`select`,label:`Mode`,options:[{value:`a`,label:`Alpha`},{value:`b`,label:`Beta`}]},{key:`tags`,type:`tags`,label:`Tags`,span:2,suggestions:[`camera`,`zone`,`alert`]},{key:`confidence`,type:`slider`,label:`Confidence`,min:0,max:100,step:5,unit:`%`,span:2},{key:`info`,type:`info`,label:`Note`,content:`This is an informational message for the user.`,variant:`info`}]}]};function d(){let[r,d]=n({name:`Example`,count:10,enabled:!0,mode:`a`,tags:[`camera`],confidence:60});return e(`div`,{className:`p-6 space-y-6 max-w-5xl mx-auto`,children:[e(`div`,{className:`mb-6`,children:[t(`h1`,{className:`text-xl font-bold text-foreground`,children:`Component Showroom`}),t(`p`,{className:`text-sm text-foreground-subtle mt-1`,children:`All UI components at a glance`})]}),t(c,{title:`Typography`,children:e(`div`,{className:`space-y-3`,children:[t(`h1`,{className:`text-2xl font-bold text-foreground`,children:`Heading 1 — Display title`}),t(`h2`,{className:`text-xl font-semibold text-foreground`,children:`Heading 2 — Section title`}),t(`h3`,{className:`text-base font-semibold text-foreground`,children:`Heading 3 — Card title`}),t(`h4`,{className:`text-sm font-semibold text-foreground`,children:`Heading 4 — Sub-section`}),t(`p`,{className:`text-sm text-foreground`,children:`Body text — Regular paragraph content goes here. It uses the foreground color.`}),t(`p`,{className:`text-sm text-foreground-subtle`,children:`Subtle text — Secondary/descriptive text with reduced emphasis.`}),t(`p`,{className:`text-xs text-foreground-subtle uppercase tracking-wider font-semibold`,children:`Label / Caption`}),t(`p`,{className:`text-xs text-foreground-disabled`,children:`Disabled / placeholder text`})]})}),t(c,{title:`Colors`,children:e(`div`,{className:`flex flex-wrap gap-4`,children:[t(l,{name:`primary`,cssVar:`--color-primary`}),t(l,{name:`background`,cssVar:`--color-background`}),t(l,{name:`surface`,cssVar:`--color-surface`}),t(l,{name:`foreground`,cssVar:`--color-foreground`}),t(l,{name:`success`,cssVar:`--color-success`}),t(l,{name:`warning`,cssVar:`--color-warning`}),t(l,{name:`danger`,cssVar:`--color-danger`}),t(l,{name:`info`,cssVar:`--color-info`}),t(l,{name:`border`,cssVar:`--color-border`}),t(`div`,{className:`w-px`}),t(l,{name:`onvif`,hex:`#3b82f6`}),t(l,{name:`hikvision`,hex:`#a855f7`}),t(l,{name:`reolink`,hex:`#06b6d4`}),t(l,{name:`ha`,hex:`#22d3ee`}),t(l,{name:`rtsp`,hex:`#78716c`})]})}),t(c,{title:`Buttons`,children:e(`div`,{className:`flex flex-wrap gap-3`,children:[t(`button`,{className:`inline-flex items-center gap-1.5 rounded-md bg-primary px-4 py-2 text-sm font-medium text-white hover:opacity-90 transition-opacity`,children:`Primary`}),t(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-border bg-surface px-4 py-2 text-sm font-medium text-foreground hover:bg-surface-hover transition-colors`,children:`Secondary`}),t(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-danger/40 bg-danger/10 px-4 py-2 text-sm font-medium text-danger hover:bg-danger/20 transition-colors`,children:`Danger`}),t(`button`,{disabled:!0,className:`inline-flex items-center gap-1.5 rounded-md bg-primary px-4 py-2 text-sm font-medium text-white opacity-40 cursor-not-allowed`,children:`Disabled`}),t(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-warning/40 bg-warning/10 px-4 py-2 text-sm font-medium text-warning hover:bg-warning/20 transition-colors`,children:`Warning`}),t(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-success/40 bg-success/10 px-4 py-2 text-sm font-medium text-success hover:bg-success/20 transition-colors`,children:`Success`})]})}),t(c,{title:`Inputs`,children:e(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Text input`}),t(`input`,{type:`text`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`Type something...`})]}),e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Number input`}),t(`input`,{type:`number`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`0`})]}),e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Password input`}),t(`input`,{type:`password`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`••••••••`})]}),e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Select`}),e(`select`,{className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,children:[t(`option`,{children:`Option A`}),t(`option`,{children:`Option B`}),t(`option`,{children:`Option C`})]})]}),e(`div`,{className:`md:col-span-2`,children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Textarea`}),t(`textarea`,{className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30 resize-y min-h-[60px]`,placeholder:`Enter multi-line text...`,rows:3})]}),t(`div`,{children:e(`label`,{className:`flex items-center gap-2 cursor-pointer select-none`,children:[t(`input`,{type:`checkbox`,className:`h-3.5 w-3.5 rounded border-border accent-primary`,defaultChecked:!0}),t(`span`,{className:`text-xs font-medium text-foreground`,children:`Checkbox (checked)`})]})}),t(`div`,{children:e(`div`,{className:`flex items-center justify-between`,children:[t(`span`,{className:`text-xs font-medium text-foreground`,children:`Toggle switch`}),t(f,{})]})}),e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Slider`}),t(`input`,{type:`range`,className:`w-full h-1 accent-primary cursor-pointer`,min:0,max:100,defaultValue:60})]}),e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Tags example`}),t(`div`,{className:`flex flex-wrap gap-1.5 rounded-md border border-border bg-background px-2 py-1.5 min-h-[38px]`,children:[`camera`,`zone`,`alert`].map(e=>t(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-primary/10 px-1.5 py-0.5 text-xs text-primary`,children:e},e))})]})]})}),t(c,{title:`Badges`,children:e(`div`,{className:`space-y-3`,children:[e(`div`,{children:[t(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`StatusBadge`}),t(`div`,{className:`flex flex-wrap gap-2`,children:[`running`,`stopped`,`error`,`online`,`offline`,`idle`].map(e=>t(i,{status:e},e))})]}),e(`div`,{children:[t(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`CapabilityBadges`}),t(s,{capabilities:[`streaming`,`detection`,`recording`,`audio`]})]})]})}),t(c,{title:`Cards`,children:e(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[e(`div`,{className:`rounded-lg bg-surface p-4`,children:[t(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Surface card`}),t(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `bg-surface`. Default card background."})]}),e(`div`,{className:`rounded-lg border border-border bg-surface p-4`,children:[t(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Bordered card`}),t(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `border border-border bg-surface`."})]}),e(`div`,{className:`rounded-lg border border-primary/30 bg-primary/5 p-4`,children:[t(`h3`,{className:`text-sm font-semibold text-primary mb-1`,children:`Accent card`}),t(`p`,{className:`text-xs text-foreground-subtle`,children:`Highlighted with primary color.`})]}),e(`div`,{className:`rounded-lg bg-background p-4`,children:[t(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Background card`}),t(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `bg-background`. Inset card."})]})]})}),t(c,{title:`Provider Icons`,children:t(`div`,{className:`flex flex-wrap gap-4`,children:[`onvif`,`hikvision`,`reolink`,`homeassistant`,`rtsp`,`onvif`].map(e=>t(o,{type:e,size:`lg`,showLabel:!0},e))})}),e(c,{title:`Form Builder Demo`,children:[t(a,{schema:u,values:r,onChange:d}),e(`details`,{className:`mt-3`,children:[t(`summary`,{className:`text-[10px] text-foreground-subtle cursor-pointer hover:text-foreground`,children:`View current values`}),t(`pre`,{className:`mt-2 rounded-md bg-background p-3 text-[10px] text-foreground-subtle overflow-auto`,children:JSON.stringify(r,null,2)})]})]}),t(c,{title:`Info Boxes`,children:t(`div`,{className:`space-y-2`,children:[{variant:`info`,label:`Info`,content:`This is an informational message. Use it for tips and hints.`},{variant:`warning`,label:`Warning`,content:`This action may have side effects. Proceed with caution.`},{variant:`success`,label:`Success`,content:`Operation completed successfully. All systems are green.`},{variant:`danger`,label:`Danger`,content:`This operation is irreversible. Data will be permanently deleted.`}].map(({variant:n,label:r,content:i})=>{let a={info:{border:`border-info`,bg:`bg-info/5`,text:`text-info`},warning:{border:`border-warning`,bg:`bg-warning/5`,text:`text-warning`},success:{border:`border-success`,bg:`bg-success/5`,text:`text-success`},danger:{border:`border-danger`,bg:`bg-danger/5`,text:`text-danger`}}[n];return e(`div`,{className:`rounded-md border-l-4 px-3 py-2.5 ${a.border} ${a.bg}`,children:[t(`p`,{className:`text-xs font-semibold mb-0.5 ${a.text}`,children:r}),t(`p`,{className:`text-xs text-foreground-subtle leading-relaxed`,children:i})]},n)})})})]})}function f(){let[e,r]=n(!0);return t(`button`,{type:`button`,role:`switch`,"aria-checked":e,onClick:()=>r(e=>!e),className:[`relative inline-flex h-4 w-8 shrink-0 items-center rounded-full transition-colors duration-150 cursor-pointer`,e?`bg-primary`:`bg-foreground-subtle/30`].join(` `),children:t(`span`,{className:[`inline-block h-3 w-3 rounded-full bg-white shadow transition-transform duration-150`,e?`translate-x-4`:`translate-x-0.5`].join(` `)})})}export{d as ShowroomPage};
1
+ import{C as e,S as t,Y as n,et as r}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{ut as i}from"./src-CImrkf6y.js";import{t as a}from"./FormBuilder-BTaNPSjN.js";import{H as o,U as s}from"./index-DzxzA2lU.js";r();function c({title:n,children:r}){return e(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[t(`div`,{className:`border-b border-border px-4 py-2.5`,children:t(`h2`,{className:`text-xs font-semibold text-foreground uppercase tracking-wider`,children:n})}),t(`div`,{className:`p-4`,children:r})]})}function l({name:n,cssVar:r,hex:i}){return e(`div`,{className:`flex flex-col items-center gap-1.5`,children:[t(`div`,{className:`h-10 w-10 rounded-lg border border-border shadow-inner`,style:{backgroundColor:r?`var(${r})`:i}}),t(`span`,{className:`text-[10px] text-foreground-subtle text-center leading-tight`,children:n})]})}var u={sections:[{id:`demo`,title:`Demo Fields`,columns:2,fields:[{key:`name`,type:`text`,label:`Name`,placeholder:`Enter name`},{key:`count`,type:`number`,label:`Count`,min:0,max:100,unit:`items`},{key:`enabled`,type:`boolean`,label:`Enabled`},{key:`mode`,type:`select`,label:`Mode`,options:[{value:`a`,label:`Alpha`},{value:`b`,label:`Beta`}]},{key:`tags`,type:`tags`,label:`Tags`,span:2,suggestions:[`camera`,`zone`,`alert`]},{key:`confidence`,type:`slider`,label:`Confidence`,min:0,max:100,step:5,unit:`%`,span:2},{key:`info`,type:`info`,label:`Note`,content:`This is an informational message for the user.`,variant:`info`}]}]};function d(){let[r,d]=n({name:`Example`,count:10,enabled:!0,mode:`a`,tags:[`camera`],confidence:60});return e(`div`,{className:`p-6 space-y-6 max-w-5xl mx-auto`,children:[e(`div`,{className:`mb-6`,children:[t(`h1`,{className:`text-xl font-bold text-foreground`,children:`Component Showroom`}),t(`p`,{className:`text-sm text-foreground-subtle mt-1`,children:`All UI components at a glance`})]}),t(c,{title:`Typography`,children:e(`div`,{className:`space-y-3`,children:[t(`h1`,{className:`text-2xl font-bold text-foreground`,children:`Heading 1 — Display title`}),t(`h2`,{className:`text-xl font-semibold text-foreground`,children:`Heading 2 — Section title`}),t(`h3`,{className:`text-base font-semibold text-foreground`,children:`Heading 3 — Card title`}),t(`h4`,{className:`text-sm font-semibold text-foreground`,children:`Heading 4 — Sub-section`}),t(`p`,{className:`text-sm text-foreground`,children:`Body text — Regular paragraph content goes here. It uses the foreground color.`}),t(`p`,{className:`text-sm text-foreground-subtle`,children:`Subtle text — Secondary/descriptive text with reduced emphasis.`}),t(`p`,{className:`text-xs text-foreground-subtle uppercase tracking-wider font-semibold`,children:`Label / Caption`}),t(`p`,{className:`text-xs text-foreground-disabled`,children:`Disabled / placeholder text`})]})}),t(c,{title:`Colors`,children:e(`div`,{className:`flex flex-wrap gap-4`,children:[t(l,{name:`primary`,cssVar:`--color-primary`}),t(l,{name:`background`,cssVar:`--color-background`}),t(l,{name:`surface`,cssVar:`--color-surface`}),t(l,{name:`foreground`,cssVar:`--color-foreground`}),t(l,{name:`success`,cssVar:`--color-success`}),t(l,{name:`warning`,cssVar:`--color-warning`}),t(l,{name:`danger`,cssVar:`--color-danger`}),t(l,{name:`info`,cssVar:`--color-info`}),t(l,{name:`border`,cssVar:`--color-border`}),t(`div`,{className:`w-px`}),t(l,{name:`onvif`,hex:`#3b82f6`}),t(l,{name:`hikvision`,hex:`#a855f7`}),t(l,{name:`reolink`,hex:`#06b6d4`}),t(l,{name:`ha`,hex:`#22d3ee`}),t(l,{name:`rtsp`,hex:`#78716c`})]})}),t(c,{title:`Buttons`,children:e(`div`,{className:`flex flex-wrap gap-3`,children:[t(`button`,{className:`inline-flex items-center gap-1.5 rounded-md bg-primary px-4 py-2 text-sm font-medium text-white hover:opacity-90 transition-opacity`,children:`Primary`}),t(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-border bg-surface px-4 py-2 text-sm font-medium text-foreground hover:bg-surface-hover transition-colors`,children:`Secondary`}),t(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-danger/40 bg-danger/10 px-4 py-2 text-sm font-medium text-danger hover:bg-danger/20 transition-colors`,children:`Danger`}),t(`button`,{disabled:!0,className:`inline-flex items-center gap-1.5 rounded-md bg-primary px-4 py-2 text-sm font-medium text-white opacity-40 cursor-not-allowed`,children:`Disabled`}),t(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-warning/40 bg-warning/10 px-4 py-2 text-sm font-medium text-warning hover:bg-warning/20 transition-colors`,children:`Warning`}),t(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-success/40 bg-success/10 px-4 py-2 text-sm font-medium text-success hover:bg-success/20 transition-colors`,children:`Success`})]})}),t(c,{title:`Inputs`,children:e(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Text input`}),t(`input`,{type:`text`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`Type something...`})]}),e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Number input`}),t(`input`,{type:`number`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`0`})]}),e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Password input`}),t(`input`,{type:`password`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`••••••••`})]}),e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Select`}),e(`select`,{className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,children:[t(`option`,{children:`Option A`}),t(`option`,{children:`Option B`}),t(`option`,{children:`Option C`})]})]}),e(`div`,{className:`md:col-span-2`,children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Textarea`}),t(`textarea`,{className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30 resize-y min-h-[60px]`,placeholder:`Enter multi-line text...`,rows:3})]}),t(`div`,{children:e(`label`,{className:`flex items-center gap-2 cursor-pointer select-none`,children:[t(`input`,{type:`checkbox`,className:`h-3.5 w-3.5 rounded border-border accent-primary`,defaultChecked:!0}),t(`span`,{className:`text-xs font-medium text-foreground`,children:`Checkbox (checked)`})]})}),t(`div`,{children:e(`div`,{className:`flex items-center justify-between`,children:[t(`span`,{className:`text-xs font-medium text-foreground`,children:`Toggle switch`}),t(f,{})]})}),e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Slider`}),t(`input`,{type:`range`,className:`w-full h-1 accent-primary cursor-pointer`,min:0,max:100,defaultValue:60})]}),e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Tags example`}),t(`div`,{className:`flex flex-wrap gap-1.5 rounded-md border border-border bg-background px-2 py-1.5 min-h-[38px]`,children:[`camera`,`zone`,`alert`].map(e=>t(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-primary/10 px-1.5 py-0.5 text-xs text-primary`,children:e},e))})]})]})}),t(c,{title:`Badges`,children:e(`div`,{className:`space-y-3`,children:[e(`div`,{children:[t(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`StatusBadge`}),t(`div`,{className:`flex flex-wrap gap-2`,children:[`running`,`stopped`,`error`,`online`,`offline`,`idle`].map(e=>t(i,{status:e},e))})]}),e(`div`,{children:[t(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`CapabilityBadges`}),t(s,{capabilities:[`streaming`,`detection`,`recording`,`audio`]})]})]})}),t(c,{title:`Cards`,children:e(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[e(`div`,{className:`rounded-lg bg-surface p-4`,children:[t(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Surface card`}),t(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `bg-surface`. Default card background."})]}),e(`div`,{className:`rounded-lg border border-border bg-surface p-4`,children:[t(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Bordered card`}),t(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `border border-border bg-surface`."})]}),e(`div`,{className:`rounded-lg border border-primary/30 bg-primary/5 p-4`,children:[t(`h3`,{className:`text-sm font-semibold text-primary mb-1`,children:`Accent card`}),t(`p`,{className:`text-xs text-foreground-subtle`,children:`Highlighted with primary color.`})]}),e(`div`,{className:`rounded-lg bg-background p-4`,children:[t(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Background card`}),t(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `bg-background`. Inset card."})]})]})}),t(c,{title:`Provider Icons`,children:t(`div`,{className:`flex flex-wrap gap-4`,children:[`onvif`,`hikvision`,`reolink`,`homeassistant`,`rtsp`,`onvif`].map(e=>t(o,{type:e,size:`lg`,showLabel:!0},e))})}),e(c,{title:`Form Builder Demo`,children:[t(a,{schema:u,values:r,onChange:d}),e(`details`,{className:`mt-3`,children:[t(`summary`,{className:`text-[10px] text-foreground-subtle cursor-pointer hover:text-foreground`,children:`View current values`}),t(`pre`,{className:`mt-2 rounded-md bg-background p-3 text-[10px] text-foreground-subtle overflow-auto`,children:JSON.stringify(r,null,2)})]})]}),t(c,{title:`Info Boxes`,children:t(`div`,{className:`space-y-2`,children:[{variant:`info`,label:`Info`,content:`This is an informational message. Use it for tips and hints.`},{variant:`warning`,label:`Warning`,content:`This action may have side effects. Proceed with caution.`},{variant:`success`,label:`Success`,content:`Operation completed successfully. All systems are green.`},{variant:`danger`,label:`Danger`,content:`This operation is irreversible. Data will be permanently deleted.`}].map(({variant:n,label:r,content:i})=>{let a={info:{border:`border-info`,bg:`bg-info/5`,text:`text-info`},warning:{border:`border-warning`,bg:`bg-warning/5`,text:`text-warning`},success:{border:`border-success`,bg:`bg-success/5`,text:`text-success`},danger:{border:`border-danger`,bg:`bg-danger/5`,text:`text-danger`}}[n];return e(`div`,{className:`rounded-md border-l-4 px-3 py-2.5 ${a.border} ${a.bg}`,children:[t(`p`,{className:`text-xs font-semibold mb-0.5 ${a.text}`,children:r}),t(`p`,{className:`text-xs text-foreground-subtle leading-relaxed`,children:i})]},n)})})})]})}function f(){let[e,r]=n(!0);return t(`button`,{type:`button`,role:`switch`,"aria-checked":e,onClick:()=>r(e=>!e),className:[`relative inline-flex h-4 w-8 shrink-0 items-center rounded-full transition-colors duration-150 cursor-pointer`,e?`bg-primary`:`bg-foreground-subtle/30`].join(` `),children:t(`span`,{className:[`inline-block h-3 w-3 rounded-full bg-white shadow transition-transform duration-150`,e?`translate-x-4`:`translate-x-0.5`].join(` `)})})}export{d as ShowroomPage};
@@ -1 +1 @@
1
- import{C as e,K as t,R as n,S as r,V as i,Y as a,a as o,et as s,o as c,t as l,x as u}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Ci as d,D as f,Di as p,Dn as m,Gr as h,Ht as g,Mn as _,Oi as v,Si as y,_n as b,cr as x,ct as S,dt as C,gn as w,ki as ee,on as te,ot as T,pn as ne,pr as re,st as ie,ur as ae,xr as oe,zt as se}from"./player-overlays-DpZIxQHp.js";import{Di as ce}from"./client-BvflqtP1.js";import{i as le}from"./video-D0guHpd1.js";import{t as E}from"./key-round-pNw827HU.js";import{An as ue,Cr as de,Dn as fe,Er as pe,Gn as me,Gs as he,Hs as ge,Jn as D,Js as _e,Kn as O,Ks as ve,Ku as ye,Pr as be,Qs as xe,Sr as k,Tr as A,Us as j,Uu as M,Ws as Se,Xs as Ce,Ys as we,Yu as Te,Zs as Ee,af as De,br as Oe,fi as N,ii as P,jd as F,kn as I,kr as ke,qd as L,qn as Ae,qs as je,wr as Me,xn as R,xr as Ne,zd as z}from"./src-KDhMZ5Ob.js";import{t as B}from"./i18n-Bg2ooh3q.js";import{t as Pe}from"./Trans-Bsz5Pghy.js";import{t as V}from"./useTranslation-BJr-n0es.js";import{b as Fe,et as Ie,w as Le}from"./index-DGvsu0ui.js";import{t as Re}from"./AdminSectionedPage-Dv8ahC-U.js";import{t as H}from"./AdminPage-DmkuRREx.js";import{t as ze}from"./NodeAddonsSettingsPanel-Chb7RIE6.js";import{t as Be}from"./AddonAssetIcon-B1rn0DLw.js";s();var Ve={detection:`border-green-500`,detector:`border-green-500`,streaming:`border-blue-500`,decode:`border-blue-500`,decoder:`border-blue-500`,recording:`border-orange-500`,recorder:`border-orange-500`,transcoding:`border-purple-500`,transcoder:`border-purple-500`,restream:`border-cyan-500`,restreamer:`border-cyan-500`,storage:`border-yellow-500`,notification:`border-pink-500`,notifier:`border-pink-500`,faces:`border-indigo-500`},He={detection:`bg-green-500/5`,detector:`bg-green-500/5`,streaming:`bg-blue-500/5`,decode:`bg-blue-500/5`,decoder:`bg-blue-500/5`,recording:`bg-orange-500/5`,recorder:`bg-orange-500/5`,transcoding:`bg-purple-500/5`,transcoder:`bg-purple-500/5`,restream:`bg-cyan-500/5`,restreamer:`bg-cyan-500/5`,storage:`bg-yellow-500/5`,notification:`bg-pink-500/5`,notifier:`bg-pink-500/5`,faces:`bg-indigo-500/5`};function Ue({entry:t,actions:n}){let i=t.name.toLowerCase(),a=Ve[i]??`border-primary`,o=He[i]??`bg-primary/5`,s=t.providers.find(e=>e.active),c=n?.pendingCapability===t.name;return e(`div`,{className:`rounded-lg border-t-2 border border-border ${a} ${o} p-3 space-y-2`,children:[e(`div`,{className:`flex items-center justify-between gap-2`,children:[e(`span`,{className:`text-xs font-semibold text-foreground capitalize flex items-center gap-1.5`,children:[t.name,c&&r(re,{className:`h-3 w-3 animate-spin text-primary`})]}),r(`span`,{className:`rounded-full px-2 py-0.5 text-[10px] font-medium ${t.mode===`singleton`?`bg-primary/10 text-primary`:`bg-info/10 text-info`}`,children:t.mode})]}),t.mode===`singleton`?r(U,{entry:t,actions:n,activeProvider:s,isPending:c}):r(We,{entry:t,actions:n,isPending:c})]})}function U({entry:t,actions:n,activeProvider:i,isPending:a}){let{t:o}=V();if(!n)return r(`div`,{children:i?e(`div`,{className:`flex items-center gap-1.5 text-[10px] text-foreground`,children:[r(y,{className:`h-3 w-3 text-green-400 shrink-0`}),r(`span`,{className:`font-medium`,children:i.addonName}),r(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto`,children:`ACTIVE`})]}):r(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:o(`addons.capabilityMap.noActiveProvider`,`No active provider`)})});if(t.providers.length===0)return r(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:o(`addons.capabilityMap.noProviders`,`No providers`)});let s=`__inherit__`;return e(`div`,{className:`space-y-2`,children:[r(`div`,{className:`space-y-1`,children:t.providers.map(i=>{let o=i.active;return e(`button`,{type:`button`,disabled:a||o,onClick:()=>n.onSelectSingleton(t.name,i.addonId),className:`flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-[10px] text-left transition-colors ${o?`bg-green-500/10 text-foreground cursor-default`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`}`,children:[r(`span`,{className:`h-2.5 w-2.5 rounded-full border shrink-0 ${o?`border-green-400 bg-green-400`:`border-border`}`}),r(`span`,{className:`font-medium truncate`,children:i.addonName}),o&&r(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto shrink-0`,children:`ACTIVE`})]},i.addonId)})}),t.perNode&&t.perNode.length>0&&r(`div`,{className:`space-y-2 pt-1 border-t border-border/40`,children:t.perNode.map(i=>{let c=i.hasOverride&&i.resolvedActive?i.resolvedActive:s,l=[{value:s,label:i.resolvedActive?o(`addons.capabilityMap.inheritGlobalWith`,{provider:i.resolvedActive}):o(`addons.capabilityMap.inheritGlobal`)},...i.providers.map(e=>({value:e,label:e}))],u=e=>{e===s?n.onClearNodeSingleton(t.name,i.nodeId):n.onSelectNodeSingleton(t.name,i.nodeId,e)},d=a;return e(`div`,{className:`space-y-0.5`,children:[e(`div`,{className:`text-[9px] font-semibold uppercase tracking-widest text-foreground-subtle/60 px-1.5`,children:[i.nodeId,i.hasOverride&&r(`span`,{className:`ml-1.5 rounded-full bg-primary/10 text-primary px-1 py-0.5 normal-case tracking-normal font-medium`,children:o(`common.override`)})]}),l.map(t=>{let n=c===t.value;return e(`button`,{type:`button`,disabled:d||n,onClick:()=>u(t.value),className:`flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-[10px] text-left transition-colors ${n?`bg-green-500/10 text-foreground cursor-default`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`}`,children:[r(`span`,{className:`h-2.5 w-2.5 rounded-full border shrink-0 ${n?`border-green-400 bg-green-400`:`border-border`}`}),r(`span`,{className:`font-medium truncate`,children:t.label}),n&&t.value!==s&&r(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto shrink-0`,children:`ACTIVE`})]},t.value)})]},i.nodeId)})})]})}function We({entry:t,actions:n,isPending:i}){let{t:a}=V();if(t.providers.length===0)return r(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:a(`addons.capabilityMap.noProviders`,`No providers`)});if(!n)return r(`div`,{className:`space-y-1`,children:t.providers.map(t=>e(`div`,{className:`flex items-center justify-between gap-2 text-[10px]`,children:[r(`span`,{className:`text-foreground-subtle`,children:t.addonName}),t.active&&r(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium`,children:`ACTIVE`})]},t.addonId))});let o=t.providers.filter(e=>e.active).map(e=>e.addonId),s=(e,r)=>{let i=r?[...new Set([...o,e])]:o.filter(t=>t!==e);n.onToggleCollection(t.name,i)};return r(`div`,{className:`space-y-1`,children:t.providers.map(t=>e(`label`,{className:`flex items-center justify-between gap-2 text-[10px] rounded px-1.5 py-1 transition-colors ${i?`opacity-50`:`hover:bg-surface-hover cursor-pointer`}`,children:[e(`span`,{className:`flex items-center gap-1.5 min-w-0`,children:[r(`input`,{type:`checkbox`,checked:t.active,disabled:i,onChange:e=>s(t.addonId,e.target.checked),className:`h-3 w-3 accent-green-500 shrink-0`}),r(`span`,{className:`text-foreground truncate`,children:t.addonName})]}),t.active&&r(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium shrink-0`,children:`ACTIVE`})]},t.addonId))})}function W({capabilities:e,actions:t}){let{t:n}=V();return e.length===0?r(`div`,{className:`text-xs text-foreground-subtle text-center py-8`,children:n(`addons.capabilityMap.noCapabilitiesRegistered`,`No capabilities registered`)}):r(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3`,children:e.map(e=>r(Ue,{entry:e,actions:t},e.name))})}var Ge=[`capabilities`,`listCapabilities`];function Ke(e){return e===`singleton`||e===`collection`}function qe(e){let t=e.indexOf(`@`);return t===-1?B.t(`system.capabilities.providerHub`,{addonId:e}):`${e.slice(0,t)} (${e.slice(t+1)})`}function Je(e,t){return{name:e.name,mode:t,providers:e.providers.map(n=>({addonId:n,addonName:qe(n),active:t===`singleton`?e.activeProvider===n:!e.disabledProviders.includes(n)})),...t===`singleton`&&e.perNode?{perNode:e.perNode}:{}}}function Ye(){let{t:n}=V(),i=C(),[s,c]=a(null),[u,f]=a(null),p=o({queryKey:Ge,queryFn:()=>i.trpcClient.capabilities.listCapabilities.query()}),m=t(()=>{let e=(p.data??[]).flatMap(e=>Ke(e.mode)?[Je(e,e.mode)]:[]),t=e.filter(e=>e.mode===`singleton`).toSorted((e,t)=>e.name.localeCompare(t.name)),n=e.filter(e=>e.mode===`collection`).toSorted((e,t)=>e.name.localeCompare(t.name));return[...t,...n]},[p.data]),h=t(()=>m.filter(e=>e.mode===`singleton`),[m]),g=t(()=>m.filter(e=>e.mode===`collection`),[m]),_=l({mutationFn:e=>i.trpcClient.capabilities.setActiveSingleton.mutate({capability:e.capName,addonId:e.addonId}),onMutate:e=>{c(e.capName),f(null)},onSuccess:async(e,t)=>{f({kind:`success`,message:n(`system.capabilities.isNowActive`,`{{capName}} → {{addonId}} is now active.`,{capName:t.capName,addonId:t.addonId})}),await p.refetch()},onError:(e,t)=>{f({kind:`error`,message:n(`system.capabilities.failedToSet`,{cap:t.capName,error:e instanceof Error?e.message:n(`common.unknownError`)})})},onSettled:()=>c(null)}),v=l({mutationFn:e=>i.trpcClient.capabilities.setActiveSingleton.mutate({capability:e.capName,addonId:e.addonId,nodeId:e.nodeId}),onMutate:e=>{c(e.capName),f(null)},onSuccess:async(e,t)=>{f({kind:`success`,message:`${t.capName} @ ${t.nodeId} → ${t.addonId}.`}),await p.refetch()},onError:(e,t)=>{f({kind:`error`,message:n(`system.capabilities.failedToSetOnNode`,{cap:t.capName,node:t.nodeId,error:e instanceof Error?e.message:n(`common.unknownError`)})})},onSettled:()=>c(null)}),b=l({mutationFn:e=>i.trpcClient.capabilities.clearSingletonNodeOverride.mutate({capability:e.capName,nodeId:e.nodeId}),onMutate:e=>{c(e.capName),f(null)},onSuccess:async(e,t)=>{f({kind:`success`,message:n(`system.capabilities.nowInheritsTheGlobalDefault`,`{{capName}} @ {{nodeId}} now inherits the global default.`,{capName:t.capName,nodeId:t.nodeId})}),await p.refetch()},onError:(e,t)=>{f({kind:`error`,message:n(`system.capabilities.failedToClearOnNode`,{cap:t.capName,node:t.nodeId,error:e instanceof Error?e.message:n(`common.unknownError`)})})},onSettled:()=>c(null)}),x=l({mutationFn:e=>i.trpcClient.capabilities.setCollectionEnabledProviders.mutate({capability:e.capName,enabledAddonIds:[...e.enabledAddonIds]}),onMutate:e=>{c(e.capName),f(null)},onSuccess:async(e,t)=>{f({kind:`success`,message:n(`system.capabilities.providerSEnabled`,`{{capName}}: {{length}} provider(s) enabled.`,{capName:t.capName,length:t.enabledAddonIds.length})}),await p.refetch()},onError:(e,t)=>{f({kind:`error`,message:n(`system.capabilities.failedToUpdate`,{cap:t.capName,error:e instanceof Error?e.message:n(`common.unknownError`)})})},onSettled:()=>c(null)}),S={onSelectSingleton:(e,t)=>_.mutate({capName:e,addonId:t}),onSelectNodeSingleton:(e,t,n)=>v.mutate({capName:e,nodeId:t,addonId:n}),onClearNodeSingleton:(e,t)=>b.mutate({capName:e,nodeId:t}),onToggleCollection:(e,t)=>x.mutate({capName:e,enabledAddonIds:t}),pendingCapability:s};return e(H,{embedded:!0,icon:te,title:n(`system.capabilities.capabilities`,`Capabilities`),subtitle:n(`system.capabilities.chooseWhichProviderIsActive`,`Choose which provider is active for each system capability. Singleton caps pick exactly one provider; collection caps enable a set.`),children:[u&&e(`div`,{className:`flex items-center gap-2 rounded-md border px-3 py-2 text-xs ${u.kind===`success`?`border-success/30 bg-success/10 text-success`:`border-danger/40 bg-danger/10 text-danger`}`,children:[u.kind===`success`?r(y,{className:`h-3.5 w-3.5 shrink-0`}):r(d,{className:`h-3.5 w-3.5 shrink-0`}),r(`span`,{children:u.message})]}),p.isLoading&&r(`div`,{className:`flex items-center justify-center py-16`,children:r(`div`,{className:`animate-spin h-6 w-6 border-2 border-primary border-t-transparent rounded-full`})}),p.isError&&!p.isLoading&&r(be,{title:n(`system.capabilities.failedToLoadCapabilities`,`Failed to load capabilities`),message:p.error instanceof Error?p.error.message:n(`system.capabilities.unknownError`,`Unknown error`),onRetry:()=>void p.refetch()}),!p.isLoading&&!p.isError&&m.length===0&&r(`div`,{className:`text-xs text-foreground-subtle text-center py-16`,children:n(`system.capabilities.noCapabilitiesRegistered`,`No capabilities registered.`)}),!p.isLoading&&!p.isError&&m.length>0&&e(`div`,{className:`space-y-6`,children:[h.length>0&&e(`section`,{className:`space-y-2`,children:[r(`h2`,{className:`text-[11px] font-semibold uppercase tracking-widest text-foreground-subtle/70`,children:n(`system.capabilities.singletonPickOneProvider`,`Singleton — pick one provider`)}),r(W,{capabilities:h,actions:S})]}),g.length>0&&e(`section`,{className:`space-y-2`,children:[r(`h2`,{className:`text-[11px] font-semibold uppercase tracking-widest text-foreground-subtle/70`,children:n(`system.capabilities.collectionEnableASet`,`Collection — enable a set`)}),r(W,{capabilities:g,actions:S})]})]})]})}var G=[`locked`,`reset`,`shares-backup`,`recovery-key`,`rotation-pending`,`orphans`],Xe={"key-missing":`helpers.keychainNotices.lockedKeyMissing`,"wrong-key":`helpers.keychainNotices.lockedWrongKey`,"key-file-unreadable":`helpers.keychainNotices.lockedKeyFileUnreadable`,"store-unavailable":`helpers.keychainNotices.lockedStoreUnavailable`,"not-initialized":`helpers.keychainNotices.lockedNotInitialized`,"decrypt-failed":`helpers.keychainNotices.lockedDecryptFailed`};function Ze(e){let t=Xe[e];return t===void 0?e:B.t(t)}function Qe({status:e,reset:t,pendingReentry:n,orphans:r}){let i=e.keychain.state===`locked`,a=e.keySource??e.configuredSource,o=[];return e.keychain.state===`locked`&&o.push({id:`locked`,tone:`danger`,title:B.t(`helpers.keychainNotices.locked`,{reason:Ze(e.keychain.reason)})}),t!==null&&t.acknowledgedAt===null&&o.push({id:`reset`,tone:`danger`,title:n>0?B.t(`helpers.keychainNotices.resetPending`,{count:n}):B.t(`helpers.keychainNotices.resetDone`)}),a.sharesBackupWithDatabase&&o.push({id:`shares-backup`,tone:`warning`,title:B.t(`helpers.keychainNotices.sharesBackup`)}),!i&&e.recoveryKeyDownloadedAt===null&&o.push({id:`recovery-key`,tone:`warning`,title:B.t(`helpers.keychainNotices.recoveryKey`)}),!i&&e.rotationPending&&o.push({id:`rotation-pending`,tone:`info`,title:B.t(`helpers.keychainNotices.rotationPending`)}),!i&&r>0&&o.push({id:`orphans`,tone:`info`,title:B.t(`helpers.keychainNotices.orphans`,{count:r})}),[...o].sort((e,t)=>G.indexOf(e.id)-G.indexOf(t.id))}var $e={dateStyle:`short`,timeStyle:`short`};function K(e){return e===null?`—`:new Date(e).toLocaleString(void 0,$e)}function q({value:t,copyValue:n,srLabel:i,maxWidthClass:a,className:o}){let s=n??t;return e(`span`,{className:L(`flex min-w-0 items-center gap-0.5`,a),children:[r(`span`,{className:L(`min-w-0 truncate font-mono`,o),title:s,children:t}),r(R,{value:s,srLabel:i,className:`h-6 shrink-0 px-1.5`})]})}s();var et=new Set([`reveal`,`download-recovery-key`,`rotate-master-key`,`reset`]);function tt(e){return[{key:`at`,header:e(`system.keychainAuditTable.colWhen`),render:e=>K(e.at)},{key:`action`,header:e(`system.keychainAuditTable.colAction`),render:e=>r(N,{variant:et.has(e.action)?`warning`:`default`,children:e.action})},{key:`actor`,header:e(`system.keychainAuditTable.colActor`),render:e=>r(`span`,{className:`font-mono`,children:e.actor})},{key:`ref`,header:e(`system.keychainAuditTable.colRef`),render:e=>e.ref===null?r(`span`,{className:`text-foreground-subtle`,children:`—`}):r(q,{value:e.ref,srLabel:`secret ref`,maxWidthClass:`max-w-[22rem]`})},{key:`detail`,header:e(`system.keychainAuditTable.colDetail`),render:e=>r(`span`,{className:`text-foreground-muted`,children:e.detail??``})}]}function nt({entries:n}){let{t:i}=V(),[o,s]=a(0),c=t(()=>tt(i),[i]);if(n===void 0)return r(`p`,{className:`text-xs text-foreground-subtle`,children:i(`common.loading`,`Loading…`)});let l=Math.max(1,Math.ceil(n.length/25)),u=Math.min(o,l-1),d=u*25,f=n.slice(d,d+25);return e(`div`,{className:`space-y-2`,children:[r(I,{columns:c,rows:f,rowKey:e=>e.id,minWidthPx:760,emptyMessage:i(`secrets.keychainAuditTable.nothingHasBeenAuditedYet`,`Nothing has been audited yet.`)}),n.length>25&&e(`div`,{className:`flex flex-wrap items-center justify-between gap-2 text-[11px] text-foreground-subtle`,children:[r(`span`,{children:i(n.length>=500?`system.keychainAuditTable.rangeRecent`:`system.keychainAuditTable.range`,{from:d+1,to:d+f.length,total:n.length})}),e(`span`,{className:`inline-flex items-center gap-1`,children:[r(P,{size:`sm`,variant:`outline`,"aria-label":i(`secrets.keychainAuditTable.previousPage`,`Previous page`),disabled:u===0,onClick:()=>s(u-1),children:r(v,{className:`h-3.5 w-3.5`,"aria-hidden":!0})}),e(`span`,{className:`tabular-nums`,children:[u+1,` / `,l]}),r(P,{size:`sm`,variant:`outline`,"aria-label":i(`secrets.keychainAuditTable.nextPage`,`Next page`),disabled:u>=l-1,onClick:()=>s(u+1),children:r(p,{className:`h-3.5 w-3.5`,"aria-hidden":!0})})]})]})]})}function rt(e,t){switch(e){case`locked`:return r(P,{size:`sm`,variant:`danger`,disabled:t.busy,onClick:t.onReset,children:B.t(`secrets.keychainNoticeContent.resetKeychain`,`Reset keychain`)});case`reset`:return r(P,{size:`sm`,variant:`outline`,disabled:t.busy,onClick:t.onAcknowledgeReset,children:B.t(`secrets.keychainNoticeContent.dismiss`,`Dismiss`)});case`recovery-key`:return r(P,{size:`sm`,variant:`outline`,disabled:t.busy,onClick:t.onDownload,children:B.t(`secrets.keychainNoticeContent.download`,`Download`)});case`rotation-pending`:return r(P,{size:`sm`,variant:`outline`,disabled:t.busy,onClick:t.onRotate,children:B.t(`secrets.keychainNoticeContent.rotate`,`Rotate`)});case`orphans`:return r(P,{size:`sm`,variant:`outline`,onClick:t.onShowOrphans,children:B.t(`secrets.keychainNoticeContent.review`,`Review`)});case`shares-backup`:return null}}function it(e,t){switch(e){case`locked`:return r(`p`,{children:B.t(`secrets.keychainNoticeContent.noValueCanBeRead`,`No value can be read or stored. If the master key is lost for good, Reset archives every stored value and starts a new keychain; every secret field then reads “not set”.`)});case`reset`:return t.reset===null?null:r(at,{reset:t.reset,pending:t.pendingReentry});case`shares-backup`:return r(`p`,{children:r(Pe,{i18nKey:`secrets.keychainNoticeContent.backupKeyFile`,components:{code:r(`code`,{className:`font-mono`})}})});case`recovery-key`:return r(`p`,{children:B.t(`secrets.keychainNoticeContent.withoutACopyOfThe`,`Without a copy of the master key, the stored values cannot be recovered.`)});case`rotation-pending`:return r(`p`,{children:B.t(`secrets.keychainNoticeContent.theKeychainUnlockedWithA`,`The keychain unlocked with a previous key. Rotate to move onto the configured one.`)});case`orphans`:return null}}function at({reset:t,pending:n}){let{t:i}=V(),a=t.actor===`trigger-file`?i(`secrets.keychainNoticeContent.resetByTrigger`):i(`secrets.keychainNoticeContent.resetByAdmin`,{actor:t.actor});return e(`div`,{className:`space-y-1.5`,children:[r(`p`,{children:i(`secrets.keychainNoticeContent.resetDetail`,{when:K(t.at),by:a,archived:t.archived})}),n.length>0&&r(`ul`,{className:`max-h-40 space-y-0.5 overflow-y-auto rounded-md border border-border bg-background p-2 font-mono text-[11px] text-foreground`,children:n.map(t=>e(`li`,{className:`break-all`,children:[t.owner,` · `,t.scope,` · `,t.fieldPath]},t.ref))})]})}s();var ot=2,J={danger:{icon:le,text:`text-danger`,border:`border-danger/40`},warning:{icon:se,text:`text-warning`,border:`border-warning/40`},info:{icon:oe,text:`text-info`,border:`border-border`}};function st({notices:t,renderAction:n,renderDetail:i}){let{t:o}=V(),[s,c]=a(!1),l=t[0];if(l===void 0)return null;let u=t.length>ot,d=u&&!s?t.slice(0,1):t,f=t.length-d.length;return e(`section`,{"aria-label":o(`secrets.keychainNotices.keychainNotices`,`Keychain notices`),className:L(`rounded-lg border bg-surface`,J[l.tone].border),children:[r(`ul`,{className:`divide-y divide-border`,children:d.map(e=>r(ct,{notice:e,action:n(e.id),detail:i(e.id)},e.id))}),u&&r(`div`,{className:`border-t border-border px-3 py-1`,children:e(P,{size:`sm`,variant:`ghost`,"aria-expanded":s,onClick:()=>c(e=>!e),children:[r(ee,{className:L(`h-3.5 w-3.5 transition-transform`,s&&`rotate-180`),"aria-hidden":!0}),s?o(`secrets.keychainNotices.showLess`,`Show less`):o(`secrets.keychainNotices.more`,`{{hidden}} more`,{hidden:f})]})})]})}function ct({notice:t,action:n,detail:i}){let{t:o}=V(),[s,c]=a(!1),l=J[t.tone],u=l.icon,d=i!=null,f=`keychain-notice-${t.id}`;return e(`li`,{className:`px-3 py-2`,children:[e(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3`,children:[e(`p`,{className:`flex min-w-0 flex-1 items-start gap-2 text-xs text-foreground`,children:[r(u,{className:L(`mt-0.5 h-3.5 w-3.5 shrink-0`,l.text),"aria-hidden":!0}),r(`span`,{className:`min-w-0 break-words`,children:t.title})]}),e(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1.5 pl-5 sm:pl-0`,children:[d&&r(P,{size:`sm`,variant:`ghost`,"aria-expanded":s,"aria-controls":f,onClick:()=>c(e=>!e),children:o(`secrets.keychainNotices.details`,`Details`)}),n]})]}),d&&s&&r(`div`,{id:f,className:`mt-2 pl-5 text-xs text-foreground-muted`,children:i})]})}var lt={"config-file":`Key file (config.yaml)`,"previous-config-file":`Previous key file`,platform:`OS keychain`,"default-file":`Default key file (data volume)`},ut=8;function dt({status:t,busy:n,onDownload:i,onRotate:a,onPurge:o}){let{t:s}=V(),c=t.keychain.state===`locked`,l=t.keySource??t.configuredSource;return r(fe,{headingId:`keychain-status`,title:s(`secrets.keychainStatusCard.keychain`,`Keychain`),icon:E,actions:e(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[t.retiredWraps>0&&r(P,{size:`sm`,variant:`ghost`,disabled:n||c,onClick:o,children:s(`secrets.keychainStatusCard.purge`,{count:t.retiredWraps})}),r(P,{size:`sm`,variant:`outline`,disabled:n||c,onClick:a,children:s(`secrets.keychainStatusCard.rotateKey`,`Rotate key`)}),r(P,{size:`sm`,variant:`outline`,disabled:n||c,onClick:i,children:s(`secrets.keychainStatusCard.downloadRecoveryKey`,`Download recovery key`)})]}),children:e(`dl`,{className:`${f} grid grid-cols-1 gap-x-6 gap-y-3 sm:grid-cols-2 xl:grid-cols-4`,children:[e(Y,{label:s(`secrets.keychainStatusCard.state`,`State`),children:[c?e(N,{variant:`danger`,className:`gap-1`,children:[r(ae,{className:`h-3 w-3`,"aria-hidden":!0}),s(`secrets.keychainStatusCard.locked`,`Locked`)]}):e(N,{variant:`success`,className:`gap-1`,children:[r(ne,{className:`h-3 w-3`,"aria-hidden":!0}),s(`secrets.keychainStatusCard.unlocked`,`Unlocked`)]}),r(`span`,{className:`ml-2 text-foreground-subtle`,children:s(`common.stored`,{count:t.secretCount})})]}),e(Y,{label:s(`secrets.keychainStatusCard.keySource`,`Key source`),children:[r(`span`,{className:`block`,children:lt[l.kind]}),l.path!==void 0&&r(q,{value:l.path,srLabel:`key path`})]}),r(Y,{label:s(`secrets.keychainStatusCard.fingerprint`,`Fingerprint`),children:t.fingerprint===null?r(`span`,{className:`text-foreground-subtle`,children:`—`}):e(`span`,{className:`inline-flex items-center gap-0.5`,children:[r(`span`,{className:`font-mono`,title:t.fingerprint,children:t.fingerprint.slice(0,ut)}),r(R,{value:t.fingerprint,srLabel:`fingerprint`})]})}),r(Y,{label:s(`secrets.keychainStatusCard.recoveryKey`,`Recovery key`),children:t.recoveryKeyDownloadedAt===null?r(N,{variant:`warning`,children:s(`secrets.keychainStatusCard.notTaken`,`Not taken`)}):r(`span`,{children:s(`secrets.keychainStatusCard.taken`,{when:K(t.recoveryKeyDownloadedAt)})})})]})})}function Y({label:t,children:n}){return e(`div`,{className:`min-w-0 text-xs`,children:[r(`dt`,{className:`text-foreground-subtle`,children:t}),r(`dd`,{className:`mt-0.5 min-w-0 text-foreground`,children:n})]})}s();var ft=1e3;function pt({revealed:t,onClose:n}){let{t:o}=V(),[s,c]=a(F);i(()=>{if(t===null)return;let e=Date.now();c(F);let r=setTimeout(n,F),i=setInterval(()=>c(Math.max(0,F-(Date.now()-e))),ft);return()=>{clearTimeout(r),clearInterval(i)}},[t,n]);let l=Math.ceil(s/1e3);return r(Oe,{open:t!==null,onOpenChange:e=>!e&&n(),children:r(k,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:t!==null&&e(u,{children:[e(A,{children:[r(pe,{className:`break-all`,children:t.entry.fieldPath}),e(de,{className:`break-all`,children:[t.entry.owner,` · `,t.entry.scope]})]}),r(Ne,{children:r(`pre`,{"data-testid":`revealed-value`,className:`whitespace-pre-wrap break-all rounded-md border border-border bg-background p-3 font-mono text-xs text-foreground`,children:t.value})}),e(Me,{className:`flex-col items-stretch gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[r(`p`,{className:`text-[11px] text-foreground-subtle`,children:o(`secrets.revealDialog.recorded`,{seconds:l})}),e(`div`,{className:`flex justify-end gap-2`,children:[r(R,{value:t.value,label:o(`common.copy`,`Copy`),srLabel:`revealed value`}),r(P,{size:`sm`,variant:`outline`,onClick:n,children:o(`secrets.revealDialog.hide`,`Hide`)})]})]})]})})})}var X={orphan:{labelKey:`secrets.secretsTableState.usageOrphan`,variant:`warning`,hintKey:`secrets.secretsTableState.usageOrphanHint`,rank:0},unknown:{labelKey:`secrets.secretsTableState.usageUnknown`,variant:`default`,hintKey:`secrets.secretsTableState.usageUnknownHint`,rank:1},"in-use":{labelKey:`secrets.secretsTableState.usageInUse`,variant:`success`,hintKey:`secrets.secretsTableState.usageInUseHint`,rank:2}},mt=[{id:`all`,labelKey:`common.all`},{id:`in-use`,labelKey:`secrets.secretsTableState.usageInUse`},{id:`orphan`,labelKey:`secrets.secretsTableState.filterOrphans`},{id:`unknown`,labelKey:`secrets.secretsTableState.usageUnknown`}],Z=`system`;function ht(t){let{t:n}=V(),{secrets:i,filter:a,onFilterChange:o,onDeleteOrphans:s,deleting:c,locked:l}=t;if(i===void 0)return r(`p`,{className:`text-xs text-foreground-subtle`,children:n(`common.loading`,`Loading…`)});let u=e=>e===`all`?i.length:i.filter(t=>t.usage===e).length,d=i.filter(e=>e.usage===`orphan`).map(e=>e.ref),f=a===`all`?i:i.filter(e=>e.usage===a);return e(`div`,{className:`space-y-2`,children:[e(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[r(`div`,{className:`flex flex-wrap gap-1`,role:`group`,"aria-label":n(`secrets.secretsTable.filterByUsage`,`Filter by usage`),children:mt.map(t=>e(P,{size:`sm`,variant:a===t.id?`secondary`:`ghost`,"aria-pressed":a===t.id,className:a===t.id?`ring-1 ring-border`:void 0,onClick:()=>o(t.id),children:[n(t.labelKey),r(`span`,{className:`text-foreground-subtle tabular-nums`,children:u(t.id)})]},t.id))}),d.length>0&&e(P,{size:`sm`,variant:`outline`,className:`ml-auto`,disabled:c||l,onClick:()=>s(d),children:[r(g,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),n(`secrets.secretsTableState.deleteOrphans`,{count:d.length})]})]}),r(I,{columns:_t(t),rows:f,rowKey:e=>e.ref,minWidthPx:860,maxBodyHeight:ue,defaultSort:{columnKey:`owner`,dir:`asc`},emptyMessage:i.length===0?n(`secrets.secretsTable.noValueIsStoredIn`,`No value is stored in the keychain yet.`):n(`secrets.secretsTable.noStoredValueMatchesThis`,`No stored value matches this filter.`)})]})}function gt({owner:t}){let{t:n}=V();return e(`span`,{className:`flex items-center gap-2`,children:[r(Be,{addonId:t,fallback:t===Z?b:_,tileClassName:`bg-surface-hover text-foreground-subtle`,size:`sm`}),r(`span`,{className:`font-medium`,children:t===Z?n(`secrets.secretsTable.hubSystem`,`Hub (system)`):t})]})}function _t({locked:t,onReveal:n,revealing:i}){return[{key:`owner`,header:B.t(`secrets.secretsTable.owner`,`Owner`),render:e=>r(gt,{owner:e.owner}),sortValue:e=>e.owner},{key:`scope`,header:B.t(`secrets.secretsTable.scope`,`Scope`),render:e=>r(`span`,{className:`block max-w-[11rem] truncate font-mono`,title:e.scope,children:e.scope}),sortValue:e=>e.scope},{key:`field`,header:B.t(`secrets.secretsTable.field`,`Field`),render:e=>r(q,{value:e.fieldPath,copyValue:e.ref,srLabel:`secret ref`,maxWidthClass:`max-w-[16rem]`}),sortValue:e=>e.fieldPath},{key:`updated`,header:B.t(`secrets.secretsTable.updated`,`Updated`),render:e=>K(e.updatedAt),sortValue:e=>e.updatedAt},{key:`last-read`,header:B.t(`secrets.secretsTable.lastRead`,`Last read`),render:e=>K(e.lastReadAt),sortValue:e=>e.lastReadAt},{key:`status`,header:B.t(`secrets.secretsTable.status`,`Status`),render:e=>r(N,{variant:X[e.usage].variant,title:B.t(X[e.usage].hintKey),children:B.t(X[e.usage].labelKey)}),sortValue:e=>X[e.usage].rank},{key:`actions`,header:``,align:`right`,notSortableReason:`Actions`,render:a=>e(P,{size:`sm`,variant:`ghost`,disabled:t||i,"aria-label":B.t(`secrets.secretsTable.reveal`,`Reveal {{fieldPath}}`,{fieldPath:a.fieldPath}),title:t?B.t(`secrets.secretsTable.theKeychainIsLocked`,`The keychain is locked`):B.t(`secrets.secretsTable.revealAudited`,`Reveal (audited)`),onClick:()=>n(a),children:[r(h,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),B.t(`secrets.secretsTable.reveal2`,`Reveal`)]})}]}function vt(e){return e instanceof Error?e.message:String(e)}function yt(e){let{t}=V(),n=ie(),r=T(),i=S(),a=Se(),o=Ee(),s=je(),c=_e(),l=ge(),u=j(),d=async(t,n)=>{try{await n()}catch(e){await r({title:t,message:vt(e),variant:`danger`})}e()};return{busy:a.isPending||o.isPending||s.isPending||c.isPending,deleting:u.isPending,download:async()=>{await n({title:t(`secrets.useKeychainActions.downloadTitle`),message:t(`secrets.useKeychainActions.downloadMessage`),confirmLabel:t(`secrets.useKeychainActions.downloadConfirm`),variant:`warning`})&&await d(t(`secrets.useKeychainActions.downloadRefused`),async()=>{let e=await a.mutateAsync({});await i({title:t(`secrets.useKeychainActions.recoveryTitle`,{fingerprint:e.fingerprint}),message:t(`secrets.useKeychainActions.recoveryMessage`),defaultValue:e.key,readOnly:!0,confirmLabel:t(`secrets.useKeychainActions.recoveryDone`)})})},rotate:async()=>{await n({title:t(`secrets.useKeychainActions.rotateTitle`),message:t(`secrets.useKeychainActions.rotateMessage`),confirmLabel:t(`secrets.useKeychainActions.rotateConfirm`),variant:`warning`})&&await d(t(`secrets.useKeychainActions.rotateRefused`),async()=>{let e=await o.mutateAsync({});await r({title:t(`secrets.useKeychainActions.rotatedTitle`),message:t(`secrets.useKeychainActions.rotatedMessage`,{fingerprint:e.fingerprint})})})},purge:async()=>{await n({title:t(`secrets.useKeychainActions.purgeTitle`),message:t(`secrets.useKeychainActions.purgeMessage`),confirmLabel:t(`secrets.useKeychainActions.purgeConfirm`),variant:`warning`})&&await d(t(`secrets.useKeychainActions.purgeRefused`),async()=>{await s.mutateAsync({})})},reset:async()=>{await i({title:t(`secrets.useKeychainActions.resetTitle`),message:t(`secrets.useKeychainActions.resetMessage`,{confirmation:`RESET KEYCHAIN`}),confirmLabel:t(`secrets.useKeychainActions.resetConfirm`),validate:e=>e===`RESET KEYCHAIN`?null:t(`secrets.useKeychainActions.resetMismatch`)})===`RESET KEYCHAIN`&&await d(t(`secrets.useKeychainActions.resetRefused`),async()=>{await c.mutateAsync({confirm:ce})})},acknowledgeReset:async()=>{await d(t(`secrets.useKeychainActions.dismissFailed`),async()=>{await l.mutateAsync({})})},deleteOrphans:async e=>{await n({title:t(`secrets.useKeychainActions.orphansTitle`,{count:e.length}),message:t(`secrets.useKeychainActions.orphansMessage`),confirmLabel:t(`secrets.useKeychainActions.orphansConfirm`),variant:`danger`})&&await d(t(`secrets.useKeychainActions.orphansRefused`),async()=>{let n=await u.mutateAsync({refs:[...e]});n.kept.length>0&&await r({title:t(`secrets.useKeychainActions.keptTitle`),message:t(`secrets.useKeychainActions.keptMessage`,{deleted:n.deleted.length,kept:n.kept.length})})})}}}s();var Q=`view`;function bt(){let[e,t]=Ie();return[e.get(Q)===`audit`?`audit`:`values`,n=>{let r=new URLSearchParams(e);n===`values`?r.delete(Q):r.set(Q,n),t(r,{replace:!0})}]}function xt(){let{t:i}=V(),o=xe({}),s=ve({}),c=he({limit:500}),l=we({}),u=Ce(),d=T(),[f,p]=bt(),[m,h]=a(`all`),[g,_]=a(null),v=yt(()=>{o.refetch(),s.refetch(),c.refetch(),l.refetch()}),y=o.data?.keychain.state===`locked`,b=t(()=>(s.data??[]).filter(e=>e.usage===`orphan`).length,[s.data]),x=t(()=>o.data===void 0?[]:Qe({status:o.data,reset:l.data?.reset??null,pendingReentry:l.data?.pendingReentry.length??0,orphans:b}),[o.data,l.data,b]),S={reset:l.data?.reset??null,pendingReentry:l.data?.pendingReentry??[],busy:v.busy,onReset:()=>void v.reset(),onAcknowledgeReset:()=>void v.acknowledgeReset(),onDownload:()=>void v.download(),onRotate:()=>void v.rotate(),onShowOrphans:()=>{h(`orphan`),p(`values`)}},C=async e=>{try{_({entry:e,value:(await u.mutateAsync({ref:e.ref})).value}),s.refetch()}catch(e){await d({title:i(`admin.system.secrets.revealRefused`,`Reveal refused`),message:Le(e),variant:`danger`})}},w=n(()=>_(null),[]);return e(H,{embedded:!0,icon:E,title:i(`admin.system.secrets.secrets`,`Secrets`),subtitle:i(`admin.system.secrets.passwordsTokensAndKeysEncrypted`,`Passwords, tokens and keys, encrypted in the hub keychain. Values leave the hub only through an audited reveal.`),children:[r(st,{notices:x,renderAction:e=>rt(e,S),renderDetail:e=>it(e,S)}),o.data!==void 0&&r(dt,{status:o.data,busy:v.busy,onDownload:S.onDownload,onRotate:S.onRotate,onPurge:()=>void v.purge()}),e(me,{value:f,onValueChange:e=>p(e===`audit`?`audit`:`values`),children:[e(Ae,{children:[r(D,{value:`values`,children:i(`admin.system.secrets.storedValues`,`Stored values`)}),r(D,{value:`audit`,children:i(`admin.system.secrets.audit`,`Audit`)})]}),r(O,{value:`values`,children:r(ht,{secrets:s.data,locked:y,filter:m,onFilterChange:h,onReveal:e=>void C(e),revealing:u.isPending,onDeleteOrphans:e=>void v.deleteOrphans(e),deleting:v.deleting})}),r(O,{value:`audit`,children:r(nt,{entries:c.data})})]}),r(pt,{revealed:g,onClose:w})]})}s();var St=[[`system`]];function $(e){return e.toFixed(6).replace(/0+$/,``).replace(/\.$/,``)}function Ct(){let{t}=V(),n=c(),o=ye(),s=Te(),l=M(),[u,d]=a(``),[f,p]=a(``),[h,g]=a(null),_=o.data?.location??null;i(()=>{d(_===null?``:$(_.latitude)),p(_===null?``:$(_.longitude))},[_]);let v=async()=>{await n.invalidateQueries({queryKey:St})},y=async e=>{e.preventDefault();let t=Number(u),n=Number(f);if(u.trim()===``||f.trim()===``){g(`Enter both a latitude and a longitude, or press Clear.`);return}if(!Number.isFinite(t)||t<-90||t>90){g(`Latitude must be between -90 and 90 decimal degrees.`);return}if(!Number.isFinite(n)||n<-180||n>180){g(`Longitude must be between -180 and 180 decimal degrees.`);return}g(null),await s.mutateAsync({latitude:t,longitude:n}),await v()},b=async()=>{g(null),await s.mutateAsync(null),await v()},S=async()=>{g(null),await l.mutateAsync(),await v()},C=s.isPending||l.isPending||o.isLoading;return e(ke,{className:`space-y-3`,children:[e(`div`,{className:`flex items-start justify-between gap-3`,children:[e(`div`,{className:`flex items-start gap-2`,children:[r(x,{className:`h-4 w-4 mt-0.5 text-muted-foreground shrink-0`}),r(`div`,{children:r(`h3`,{className:`text-sm font-medium`,children:t(`settings.siteLocationCard.siteLocation`,`Site location`)})})]}),_===null?r(N,{variant:`warning`,children:t(`settings.siteLocationCard.notConfigured`,`Not configured`)}):r(N,{variant:_.source===`operator-set`?`success`:`info`,children:_.source===`operator-set`?t(`settings.siteLocationCard.setByYou`,`Set by you`):t(`settings.siteLocationCard.derivedFromIp`,`Derived from IP`)})]}),_?.label!==void 0&&_.label!==``?r(`p`,{className:`text-xs text-muted-foreground`,children:t(`settings.siteLocationCard.detectedNear`,{place:_.label})}):null,_===null&&o.data?.derivationAttemptedAt!==null?e(`p`,{className:`text-xs text-warning`,children:[t(`settings.siteLocationCard.automaticDetectionFromThePublic`,`Automatic detection from the public IP did not succeed`),o.data?.derivationError!==null&&o.data?.derivationError!==void 0?`: ${o.data.derivationError}`:`.`,` `,t(`settings.siteLocationCard.itIsNotRetriedOn`,`It is not retried on its own — enter the coordinates, or press Detect.`)]}):null,e(`form`,{className:`flex flex-wrap items-end gap-3`,onSubmit:y,children:[e(`label`,{className:`flex flex-col gap-1 text-xs`,children:[r(`span`,{className:`text-muted-foreground`,children:t(`settings.siteLocationCard.latitude`,`Latitude`)}),r(z,{className:`w-40`,value:u,inputMode:`decimal`,placeholder:`40.851800`,onChange:e=>d(e.target.value),"aria-label":t(`settings.siteLocationCard.latitude`,`Latitude`)})]}),e(`label`,{className:`flex flex-col gap-1 text-xs`,children:[r(`span`,{className:`text-muted-foreground`,children:t(`settings.siteLocationCard.longitude`,`Longitude`)}),r(z,{className:`w-40`,value:f,inputMode:`decimal`,placeholder:`14.268100`,onChange:e=>p(e.target.value),"aria-label":t(`settings.siteLocationCard.longitude`,`Longitude`)})]}),r(P,{type:`submit`,disabled:C,children:t(`common.save`,`Save`)}),e(P,{type:`button`,variant:`ghost`,disabled:C,onClick:S,children:[r(m,{className:`h-3.5 w-3.5 mr-1`}),t(`settings.siteLocationCard.detectFromIp`,`Detect from IP`)]}),_===null?null:r(P,{type:`button`,variant:`ghost`,disabled:C,onClick:b,children:t(`settings.siteLocationCard.clear`,`Clear`)})]}),h===null?null:r(`p`,{className:`text-xs text-danger`,children:h}),r(`p`,{className:`text-xs text-muted-foreground`,children:t(`settings.siteLocationCard.wgs84DecimalDegreesDetectAsks`,`WGS84 decimal degrees. Detect asks a public geo-IP service once and will not overwrite a value you typed — clear it first.`)})]})}function wt(){let{t}=V(),{nodes:n,isLoading:i}=De(),a=n.find(e=>e.isHub&&e.isOnline),o=a?.addons.map(e=>e.addonId)??[];return e(H,{embedded:!0,children:[r(Ct,{}),i?r(`div`,{className:`text-muted-foreground text-sm py-12 text-center`,children:t(`admin.system.settings.loadingHubTopology`,`Loading hub topology…`)}):a?o.length===0?r(`div`,{className:`text-muted-foreground text-sm py-12 text-center`,children:t(`admin.system.settings.noAddonsInstalledOnThe`,`No addons installed on the hub yet.`)}):r(ze,{nodeId:a.id,addonIds:o,level:`global`}):e(`div`,{className:`flex flex-col items-center justify-center text-muted-foreground text-sm gap-2 py-12`,children:[r(w,{className:`h-8 w-8 opacity-30`}),r(`p`,{children:t(`admin.system.settings.noOnlineHubNodeFound`,`No online hub node found.`)}),r(`p`,{className:`text-xs`,children:t(`admin.system.settings.settingsWillAppearOnceThe`,`Settings will appear once the hub is reachable.`)})]})]})}function Tt(){let{t:e}=V(),t=Fe(`/system/settings`,{t:e,isAdmin:!0})??{icon:w,title:e(`system.systemNav`,`System`)};return r(Re,{icon:t.icon,title:t.title,defaultSection:`settings`,sectionsLabel:`${t.title} sections`,sections:[{id:`settings`,label:e(`system.system.settings`,`Settings`),content:r(wt,{})},{id:`secrets`,label:e(`system.system.secrets`,`Secrets`),content:r(xt,{}),ownedParams:[`view`]},{id:`capabilities`,label:e(`system.system.capabilities`,`Capabilities`),content:r(Ye,{})}]})}export{Tt as SystemPage};
1
+ import{C as e,K as t,R as n,S as r,V as i,Y as a,a as o,et as s,o as c,t as l,x as u}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Ci as d,D as f,Di as p,Dn as m,Gr as h,Ht as g,Mn as _,Oi as v,Si as y,_n as b,cr as x,ct as S,dt as C,gn as w,ki as ee,on as te,ot as T,pn as ne,pr as re,st as ie,ur as ae,xr as oe,zt as se}from"./player-overlays-CdeStLFY.js";import{vi as ce}from"./client-AOeY3PoN.js";import{i as le}from"./video-D8GbzI4M.js";import{t as E}from"./key-round-QObyZIrV.js";import{An as ue,Cr as de,Dn as fe,Er as pe,Gn as me,Gs as he,Hs as ge,Jn as D,Js as _e,Kn as O,Ks as ve,Ku as ye,Pr as be,Qs as xe,Sr as k,Tr as A,Us as j,Uu as M,Ws as Se,Xs as Ce,Ys as we,Yu as Te,Zs as Ee,br as De,fi as N,ii as P,jd as F,kn as I,kr as Oe,of as ke,qd as L,qn as Ae,qs as je,wr as Me,xn as R,xr as Ne,zd as z}from"./src-CImrkf6y.js";import{t as B}from"./i18n-DFGXm9ze.js";import{t as Pe}from"./Trans-BgSU9dw1.js";import{t as V}from"./useTranslation-BJr-n0es.js";import{b as Fe,et as Ie,w as Le}from"./index-DzxzA2lU.js";import{t as Re}from"./AdminSectionedPage-CXlo0qGc.js";import{t as H}from"./AdminPage-95Fx8-ai.js";import{t as ze}from"./NodeAddonsSettingsPanel-CKuqtZiy.js";import{t as Be}from"./AddonAssetIcon-CfGdzQS1.js";s();var Ve={detection:`border-green-500`,detector:`border-green-500`,streaming:`border-blue-500`,decode:`border-blue-500`,decoder:`border-blue-500`,recording:`border-orange-500`,recorder:`border-orange-500`,transcoding:`border-purple-500`,transcoder:`border-purple-500`,restream:`border-cyan-500`,restreamer:`border-cyan-500`,storage:`border-yellow-500`,notification:`border-pink-500`,notifier:`border-pink-500`,faces:`border-indigo-500`},He={detection:`bg-green-500/5`,detector:`bg-green-500/5`,streaming:`bg-blue-500/5`,decode:`bg-blue-500/5`,decoder:`bg-blue-500/5`,recording:`bg-orange-500/5`,recorder:`bg-orange-500/5`,transcoding:`bg-purple-500/5`,transcoder:`bg-purple-500/5`,restream:`bg-cyan-500/5`,restreamer:`bg-cyan-500/5`,storage:`bg-yellow-500/5`,notification:`bg-pink-500/5`,notifier:`bg-pink-500/5`,faces:`bg-indigo-500/5`};function Ue({entry:t,actions:n}){let i=t.name.toLowerCase(),a=Ve[i]??`border-primary`,o=He[i]??`bg-primary/5`,s=t.providers.find(e=>e.active),c=n?.pendingCapability===t.name;return e(`div`,{className:`rounded-lg border-t-2 border border-border ${a} ${o} p-3 space-y-2`,children:[e(`div`,{className:`flex items-center justify-between gap-2`,children:[e(`span`,{className:`text-xs font-semibold text-foreground capitalize flex items-center gap-1.5`,children:[t.name,c&&r(re,{className:`h-3 w-3 animate-spin text-primary`})]}),r(`span`,{className:`rounded-full px-2 py-0.5 text-[10px] font-medium ${t.mode===`singleton`?`bg-primary/10 text-primary`:`bg-info/10 text-info`}`,children:t.mode})]}),t.mode===`singleton`?r(U,{entry:t,actions:n,activeProvider:s,isPending:c}):r(We,{entry:t,actions:n,isPending:c})]})}function U({entry:t,actions:n,activeProvider:i,isPending:a}){let{t:o}=V();if(!n)return r(`div`,{children:i?e(`div`,{className:`flex items-center gap-1.5 text-[10px] text-foreground`,children:[r(y,{className:`h-3 w-3 text-green-400 shrink-0`}),r(`span`,{className:`font-medium`,children:i.addonName}),r(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto`,children:`ACTIVE`})]}):r(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:o(`addons.capabilityMap.noActiveProvider`,`No active provider`)})});if(t.providers.length===0)return r(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:o(`addons.capabilityMap.noProviders`,`No providers`)});let s=`__inherit__`;return e(`div`,{className:`space-y-2`,children:[r(`div`,{className:`space-y-1`,children:t.providers.map(i=>{let o=i.active;return e(`button`,{type:`button`,disabled:a||o,onClick:()=>n.onSelectSingleton(t.name,i.addonId),className:`flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-[10px] text-left transition-colors ${o?`bg-green-500/10 text-foreground cursor-default`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`}`,children:[r(`span`,{className:`h-2.5 w-2.5 rounded-full border shrink-0 ${o?`border-green-400 bg-green-400`:`border-border`}`}),r(`span`,{className:`font-medium truncate`,children:i.addonName}),o&&r(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto shrink-0`,children:`ACTIVE`})]},i.addonId)})}),t.perNode&&t.perNode.length>0&&r(`div`,{className:`space-y-2 pt-1 border-t border-border/40`,children:t.perNode.map(i=>{let c=i.hasOverride&&i.resolvedActive?i.resolvedActive:s,l=[{value:s,label:i.resolvedActive?o(`addons.capabilityMap.inheritGlobalWith`,{provider:i.resolvedActive}):o(`addons.capabilityMap.inheritGlobal`)},...i.providers.map(e=>({value:e,label:e}))],u=e=>{e===s?n.onClearNodeSingleton(t.name,i.nodeId):n.onSelectNodeSingleton(t.name,i.nodeId,e)},d=a;return e(`div`,{className:`space-y-0.5`,children:[e(`div`,{className:`text-[9px] font-semibold uppercase tracking-widest text-foreground-subtle/60 px-1.5`,children:[i.nodeId,i.hasOverride&&r(`span`,{className:`ml-1.5 rounded-full bg-primary/10 text-primary px-1 py-0.5 normal-case tracking-normal font-medium`,children:o(`common.override`)})]}),l.map(t=>{let n=c===t.value;return e(`button`,{type:`button`,disabled:d||n,onClick:()=>u(t.value),className:`flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-[10px] text-left transition-colors ${n?`bg-green-500/10 text-foreground cursor-default`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`}`,children:[r(`span`,{className:`h-2.5 w-2.5 rounded-full border shrink-0 ${n?`border-green-400 bg-green-400`:`border-border`}`}),r(`span`,{className:`font-medium truncate`,children:t.label}),n&&t.value!==s&&r(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto shrink-0`,children:`ACTIVE`})]},t.value)})]},i.nodeId)})})]})}function We({entry:t,actions:n,isPending:i}){let{t:a}=V();if(t.providers.length===0)return r(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:a(`addons.capabilityMap.noProviders`,`No providers`)});if(!n)return r(`div`,{className:`space-y-1`,children:t.providers.map(t=>e(`div`,{className:`flex items-center justify-between gap-2 text-[10px]`,children:[r(`span`,{className:`text-foreground-subtle`,children:t.addonName}),t.active&&r(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium`,children:`ACTIVE`})]},t.addonId))});let o=t.providers.filter(e=>e.active).map(e=>e.addonId),s=(e,r)=>{let i=r?[...new Set([...o,e])]:o.filter(t=>t!==e);n.onToggleCollection(t.name,i)};return r(`div`,{className:`space-y-1`,children:t.providers.map(t=>e(`label`,{className:`flex items-center justify-between gap-2 text-[10px] rounded px-1.5 py-1 transition-colors ${i?`opacity-50`:`hover:bg-surface-hover cursor-pointer`}`,children:[e(`span`,{className:`flex items-center gap-1.5 min-w-0`,children:[r(`input`,{type:`checkbox`,checked:t.active,disabled:i,onChange:e=>s(t.addonId,e.target.checked),className:`h-3 w-3 accent-green-500 shrink-0`}),r(`span`,{className:`text-foreground truncate`,children:t.addonName})]}),t.active&&r(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium shrink-0`,children:`ACTIVE`})]},t.addonId))})}function W({capabilities:e,actions:t}){let{t:n}=V();return e.length===0?r(`div`,{className:`text-xs text-foreground-subtle text-center py-8`,children:n(`addons.capabilityMap.noCapabilitiesRegistered`,`No capabilities registered`)}):r(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3`,children:e.map(e=>r(Ue,{entry:e,actions:t},e.name))})}var Ge=[`capabilities`,`listCapabilities`];function Ke(e){return e===`singleton`||e===`collection`}function qe(e){let t=e.indexOf(`@`);return t===-1?B.t(`system.capabilities.providerHub`,{addonId:e}):`${e.slice(0,t)} (${e.slice(t+1)})`}function Je(e,t){return{name:e.name,mode:t,providers:e.providers.map(n=>({addonId:n,addonName:qe(n),active:t===`singleton`?e.activeProvider===n:!e.disabledProviders.includes(n)})),...t===`singleton`&&e.perNode?{perNode:e.perNode}:{}}}function Ye(){let{t:n}=V(),i=C(),[s,c]=a(null),[u,f]=a(null),p=o({queryKey:Ge,queryFn:()=>i.trpcClient.capabilities.listCapabilities.query()}),m=t(()=>{let e=(p.data??[]).flatMap(e=>Ke(e.mode)?[Je(e,e.mode)]:[]),t=e.filter(e=>e.mode===`singleton`).toSorted((e,t)=>e.name.localeCompare(t.name)),n=e.filter(e=>e.mode===`collection`).toSorted((e,t)=>e.name.localeCompare(t.name));return[...t,...n]},[p.data]),h=t(()=>m.filter(e=>e.mode===`singleton`),[m]),g=t(()=>m.filter(e=>e.mode===`collection`),[m]),_=l({mutationFn:e=>i.trpcClient.capabilities.setActiveSingleton.mutate({capability:e.capName,addonId:e.addonId}),onMutate:e=>{c(e.capName),f(null)},onSuccess:async(e,t)=>{f({kind:`success`,message:n(`system.capabilities.isNowActive`,`{{capName}} → {{addonId}} is now active.`,{capName:t.capName,addonId:t.addonId})}),await p.refetch()},onError:(e,t)=>{f({kind:`error`,message:n(`system.capabilities.failedToSet`,{cap:t.capName,error:e instanceof Error?e.message:n(`common.unknownError`)})})},onSettled:()=>c(null)}),v=l({mutationFn:e=>i.trpcClient.capabilities.setActiveSingleton.mutate({capability:e.capName,addonId:e.addonId,nodeId:e.nodeId}),onMutate:e=>{c(e.capName),f(null)},onSuccess:async(e,t)=>{f({kind:`success`,message:`${t.capName} @ ${t.nodeId} → ${t.addonId}.`}),await p.refetch()},onError:(e,t)=>{f({kind:`error`,message:n(`system.capabilities.failedToSetOnNode`,{cap:t.capName,node:t.nodeId,error:e instanceof Error?e.message:n(`common.unknownError`)})})},onSettled:()=>c(null)}),b=l({mutationFn:e=>i.trpcClient.capabilities.clearSingletonNodeOverride.mutate({capability:e.capName,nodeId:e.nodeId}),onMutate:e=>{c(e.capName),f(null)},onSuccess:async(e,t)=>{f({kind:`success`,message:n(`system.capabilities.nowInheritsTheGlobalDefault`,`{{capName}} @ {{nodeId}} now inherits the global default.`,{capName:t.capName,nodeId:t.nodeId})}),await p.refetch()},onError:(e,t)=>{f({kind:`error`,message:n(`system.capabilities.failedToClearOnNode`,{cap:t.capName,node:t.nodeId,error:e instanceof Error?e.message:n(`common.unknownError`)})})},onSettled:()=>c(null)}),x=l({mutationFn:e=>i.trpcClient.capabilities.setCollectionEnabledProviders.mutate({capability:e.capName,enabledAddonIds:[...e.enabledAddonIds]}),onMutate:e=>{c(e.capName),f(null)},onSuccess:async(e,t)=>{f({kind:`success`,message:n(`system.capabilities.providerSEnabled`,`{{capName}}: {{length}} provider(s) enabled.`,{capName:t.capName,length:t.enabledAddonIds.length})}),await p.refetch()},onError:(e,t)=>{f({kind:`error`,message:n(`system.capabilities.failedToUpdate`,{cap:t.capName,error:e instanceof Error?e.message:n(`common.unknownError`)})})},onSettled:()=>c(null)}),S={onSelectSingleton:(e,t)=>_.mutate({capName:e,addonId:t}),onSelectNodeSingleton:(e,t,n)=>v.mutate({capName:e,nodeId:t,addonId:n}),onClearNodeSingleton:(e,t)=>b.mutate({capName:e,nodeId:t}),onToggleCollection:(e,t)=>x.mutate({capName:e,enabledAddonIds:t}),pendingCapability:s};return e(H,{embedded:!0,icon:te,title:n(`system.capabilities.capabilities`,`Capabilities`),subtitle:n(`system.capabilities.chooseWhichProviderIsActive`,`Choose which provider is active for each system capability. Singleton caps pick exactly one provider; collection caps enable a set.`),children:[u&&e(`div`,{className:`flex items-center gap-2 rounded-md border px-3 py-2 text-xs ${u.kind===`success`?`border-success/30 bg-success/10 text-success`:`border-danger/40 bg-danger/10 text-danger`}`,children:[u.kind===`success`?r(y,{className:`h-3.5 w-3.5 shrink-0`}):r(d,{className:`h-3.5 w-3.5 shrink-0`}),r(`span`,{children:u.message})]}),p.isLoading&&r(`div`,{className:`flex items-center justify-center py-16`,children:r(`div`,{className:`animate-spin h-6 w-6 border-2 border-primary border-t-transparent rounded-full`})}),p.isError&&!p.isLoading&&r(be,{title:n(`system.capabilities.failedToLoadCapabilities`,`Failed to load capabilities`),message:p.error instanceof Error?p.error.message:n(`system.capabilities.unknownError`,`Unknown error`),onRetry:()=>void p.refetch()}),!p.isLoading&&!p.isError&&m.length===0&&r(`div`,{className:`text-xs text-foreground-subtle text-center py-16`,children:n(`system.capabilities.noCapabilitiesRegistered`,`No capabilities registered.`)}),!p.isLoading&&!p.isError&&m.length>0&&e(`div`,{className:`space-y-6`,children:[h.length>0&&e(`section`,{className:`space-y-2`,children:[r(`h2`,{className:`text-[11px] font-semibold uppercase tracking-widest text-foreground-subtle/70`,children:n(`system.capabilities.singletonPickOneProvider`,`Singleton — pick one provider`)}),r(W,{capabilities:h,actions:S})]}),g.length>0&&e(`section`,{className:`space-y-2`,children:[r(`h2`,{className:`text-[11px] font-semibold uppercase tracking-widest text-foreground-subtle/70`,children:n(`system.capabilities.collectionEnableASet`,`Collection — enable a set`)}),r(W,{capabilities:g,actions:S})]})]})]})}var G=[`locked`,`reset`,`shares-backup`,`recovery-key`,`rotation-pending`,`orphans`],Xe={"key-missing":`helpers.keychainNotices.lockedKeyMissing`,"wrong-key":`helpers.keychainNotices.lockedWrongKey`,"key-file-unreadable":`helpers.keychainNotices.lockedKeyFileUnreadable`,"store-unavailable":`helpers.keychainNotices.lockedStoreUnavailable`,"not-initialized":`helpers.keychainNotices.lockedNotInitialized`,"decrypt-failed":`helpers.keychainNotices.lockedDecryptFailed`};function Ze(e){let t=Xe[e];return t===void 0?e:B.t(t)}function Qe({status:e,reset:t,pendingReentry:n,orphans:r}){let i=e.keychain.state===`locked`,a=e.keySource??e.configuredSource,o=[];return e.keychain.state===`locked`&&o.push({id:`locked`,tone:`danger`,title:B.t(`helpers.keychainNotices.locked`,{reason:Ze(e.keychain.reason)})}),t!==null&&t.acknowledgedAt===null&&o.push({id:`reset`,tone:`danger`,title:n>0?B.t(`helpers.keychainNotices.resetPending`,{count:n}):B.t(`helpers.keychainNotices.resetDone`)}),a.sharesBackupWithDatabase&&o.push({id:`shares-backup`,tone:`warning`,title:B.t(`helpers.keychainNotices.sharesBackup`)}),!i&&e.recoveryKeyDownloadedAt===null&&o.push({id:`recovery-key`,tone:`warning`,title:B.t(`helpers.keychainNotices.recoveryKey`)}),!i&&e.rotationPending&&o.push({id:`rotation-pending`,tone:`info`,title:B.t(`helpers.keychainNotices.rotationPending`)}),!i&&r>0&&o.push({id:`orphans`,tone:`info`,title:B.t(`helpers.keychainNotices.orphans`,{count:r})}),[...o].sort((e,t)=>G.indexOf(e.id)-G.indexOf(t.id))}var $e={dateStyle:`short`,timeStyle:`short`};function K(e){return e===null?`—`:new Date(e).toLocaleString(void 0,$e)}function q({value:t,copyValue:n,srLabel:i,maxWidthClass:a,className:o}){let s=n??t;return e(`span`,{className:L(`flex min-w-0 items-center gap-0.5`,a),children:[r(`span`,{className:L(`min-w-0 truncate font-mono`,o),title:s,children:t}),r(R,{value:s,srLabel:i,className:`h-6 shrink-0 px-1.5`})]})}s();var et=new Set([`reveal`,`download-recovery-key`,`rotate-master-key`,`reset`]);function tt(e){return[{key:`at`,header:e(`system.keychainAuditTable.colWhen`),render:e=>K(e.at)},{key:`action`,header:e(`system.keychainAuditTable.colAction`),render:e=>r(N,{variant:et.has(e.action)?`warning`:`default`,children:e.action})},{key:`actor`,header:e(`system.keychainAuditTable.colActor`),render:e=>r(`span`,{className:`font-mono`,children:e.actor})},{key:`ref`,header:e(`system.keychainAuditTable.colRef`),render:e=>e.ref===null?r(`span`,{className:`text-foreground-subtle`,children:`—`}):r(q,{value:e.ref,srLabel:`secret ref`,maxWidthClass:`max-w-[22rem]`})},{key:`detail`,header:e(`system.keychainAuditTable.colDetail`),render:e=>r(`span`,{className:`text-foreground-muted`,children:e.detail??``})}]}function nt({entries:n}){let{t:i}=V(),[o,s]=a(0),c=t(()=>tt(i),[i]);if(n===void 0)return r(`p`,{className:`text-xs text-foreground-subtle`,children:i(`common.loading`,`Loading…`)});let l=Math.max(1,Math.ceil(n.length/25)),u=Math.min(o,l-1),d=u*25,f=n.slice(d,d+25);return e(`div`,{className:`space-y-2`,children:[r(I,{columns:c,rows:f,rowKey:e=>e.id,minWidthPx:760,emptyMessage:i(`secrets.keychainAuditTable.nothingHasBeenAuditedYet`,`Nothing has been audited yet.`)}),n.length>25&&e(`div`,{className:`flex flex-wrap items-center justify-between gap-2 text-[11px] text-foreground-subtle`,children:[r(`span`,{children:i(n.length>=500?`system.keychainAuditTable.rangeRecent`:`system.keychainAuditTable.range`,{from:d+1,to:d+f.length,total:n.length})}),e(`span`,{className:`inline-flex items-center gap-1`,children:[r(P,{size:`sm`,variant:`outline`,"aria-label":i(`secrets.keychainAuditTable.previousPage`,`Previous page`),disabled:u===0,onClick:()=>s(u-1),children:r(v,{className:`h-3.5 w-3.5`,"aria-hidden":!0})}),e(`span`,{className:`tabular-nums`,children:[u+1,` / `,l]}),r(P,{size:`sm`,variant:`outline`,"aria-label":i(`secrets.keychainAuditTable.nextPage`,`Next page`),disabled:u>=l-1,onClick:()=>s(u+1),children:r(p,{className:`h-3.5 w-3.5`,"aria-hidden":!0})})]})]})]})}function rt(e,t){switch(e){case`locked`:return r(P,{size:`sm`,variant:`danger`,disabled:t.busy,onClick:t.onReset,children:B.t(`secrets.keychainNoticeContent.resetKeychain`,`Reset keychain`)});case`reset`:return r(P,{size:`sm`,variant:`outline`,disabled:t.busy,onClick:t.onAcknowledgeReset,children:B.t(`secrets.keychainNoticeContent.dismiss`,`Dismiss`)});case`recovery-key`:return r(P,{size:`sm`,variant:`outline`,disabled:t.busy,onClick:t.onDownload,children:B.t(`secrets.keychainNoticeContent.download`,`Download`)});case`rotation-pending`:return r(P,{size:`sm`,variant:`outline`,disabled:t.busy,onClick:t.onRotate,children:B.t(`secrets.keychainNoticeContent.rotate`,`Rotate`)});case`orphans`:return r(P,{size:`sm`,variant:`outline`,onClick:t.onShowOrphans,children:B.t(`secrets.keychainNoticeContent.review`,`Review`)});case`shares-backup`:return null}}function it(e,t){switch(e){case`locked`:return r(`p`,{children:B.t(`secrets.keychainNoticeContent.noValueCanBeRead`,`No value can be read or stored. If the master key is lost for good, Reset archives every stored value and starts a new keychain; every secret field then reads “not set”.`)});case`reset`:return t.reset===null?null:r(at,{reset:t.reset,pending:t.pendingReentry});case`shares-backup`:return r(`p`,{children:r(Pe,{i18nKey:`secrets.keychainNoticeContent.backupKeyFile`,components:{code:r(`code`,{className:`font-mono`})}})});case`recovery-key`:return r(`p`,{children:B.t(`secrets.keychainNoticeContent.withoutACopyOfThe`,`Without a copy of the master key, the stored values cannot be recovered.`)});case`rotation-pending`:return r(`p`,{children:B.t(`secrets.keychainNoticeContent.theKeychainUnlockedWithA`,`The keychain unlocked with a previous key. Rotate to move onto the configured one.`)});case`orphans`:return null}}function at({reset:t,pending:n}){let{t:i}=V(),a=t.actor===`trigger-file`?i(`secrets.keychainNoticeContent.resetByTrigger`):i(`secrets.keychainNoticeContent.resetByAdmin`,{actor:t.actor});return e(`div`,{className:`space-y-1.5`,children:[r(`p`,{children:i(`secrets.keychainNoticeContent.resetDetail`,{when:K(t.at),by:a,archived:t.archived})}),n.length>0&&r(`ul`,{className:`max-h-40 space-y-0.5 overflow-y-auto rounded-md border border-border bg-background p-2 font-mono text-[11px] text-foreground`,children:n.map(t=>e(`li`,{className:`break-all`,children:[t.owner,` · `,t.scope,` · `,t.fieldPath]},t.ref))})]})}s();var ot=2,J={danger:{icon:le,text:`text-danger`,border:`border-danger/40`},warning:{icon:se,text:`text-warning`,border:`border-warning/40`},info:{icon:oe,text:`text-info`,border:`border-border`}};function st({notices:t,renderAction:n,renderDetail:i}){let{t:o}=V(),[s,c]=a(!1),l=t[0];if(l===void 0)return null;let u=t.length>ot,d=u&&!s?t.slice(0,1):t,f=t.length-d.length;return e(`section`,{"aria-label":o(`secrets.keychainNotices.keychainNotices`,`Keychain notices`),className:L(`rounded-lg border bg-surface`,J[l.tone].border),children:[r(`ul`,{className:`divide-y divide-border`,children:d.map(e=>r(ct,{notice:e,action:n(e.id),detail:i(e.id)},e.id))}),u&&r(`div`,{className:`border-t border-border px-3 py-1`,children:e(P,{size:`sm`,variant:`ghost`,"aria-expanded":s,onClick:()=>c(e=>!e),children:[r(ee,{className:L(`h-3.5 w-3.5 transition-transform`,s&&`rotate-180`),"aria-hidden":!0}),s?o(`secrets.keychainNotices.showLess`,`Show less`):o(`secrets.keychainNotices.more`,`{{hidden}} more`,{hidden:f})]})})]})}function ct({notice:t,action:n,detail:i}){let{t:o}=V(),[s,c]=a(!1),l=J[t.tone],u=l.icon,d=i!=null,f=`keychain-notice-${t.id}`;return e(`li`,{className:`px-3 py-2`,children:[e(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3`,children:[e(`p`,{className:`flex min-w-0 flex-1 items-start gap-2 text-xs text-foreground`,children:[r(u,{className:L(`mt-0.5 h-3.5 w-3.5 shrink-0`,l.text),"aria-hidden":!0}),r(`span`,{className:`min-w-0 break-words`,children:t.title})]}),e(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1.5 pl-5 sm:pl-0`,children:[d&&r(P,{size:`sm`,variant:`ghost`,"aria-expanded":s,"aria-controls":f,onClick:()=>c(e=>!e),children:o(`secrets.keychainNotices.details`,`Details`)}),n]})]}),d&&s&&r(`div`,{id:f,className:`mt-2 pl-5 text-xs text-foreground-muted`,children:i})]})}var lt={"config-file":`Key file (config.yaml)`,"previous-config-file":`Previous key file`,platform:`OS keychain`,"default-file":`Default key file (data volume)`},ut=8;function dt({status:t,busy:n,onDownload:i,onRotate:a,onPurge:o}){let{t:s}=V(),c=t.keychain.state===`locked`,l=t.keySource??t.configuredSource;return r(fe,{headingId:`keychain-status`,title:s(`secrets.keychainStatusCard.keychain`,`Keychain`),icon:E,actions:e(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[t.retiredWraps>0&&r(P,{size:`sm`,variant:`ghost`,disabled:n||c,onClick:o,children:s(`secrets.keychainStatusCard.purge`,{count:t.retiredWraps})}),r(P,{size:`sm`,variant:`outline`,disabled:n||c,onClick:a,children:s(`secrets.keychainStatusCard.rotateKey`,`Rotate key`)}),r(P,{size:`sm`,variant:`outline`,disabled:n||c,onClick:i,children:s(`secrets.keychainStatusCard.downloadRecoveryKey`,`Download recovery key`)})]}),children:e(`dl`,{className:`${f} grid grid-cols-1 gap-x-6 gap-y-3 sm:grid-cols-2 xl:grid-cols-4`,children:[e(Y,{label:s(`secrets.keychainStatusCard.state`,`State`),children:[c?e(N,{variant:`danger`,className:`gap-1`,children:[r(ae,{className:`h-3 w-3`,"aria-hidden":!0}),s(`secrets.keychainStatusCard.locked`,`Locked`)]}):e(N,{variant:`success`,className:`gap-1`,children:[r(ne,{className:`h-3 w-3`,"aria-hidden":!0}),s(`secrets.keychainStatusCard.unlocked`,`Unlocked`)]}),r(`span`,{className:`ml-2 text-foreground-subtle`,children:s(`common.stored`,{count:t.secretCount})})]}),e(Y,{label:s(`secrets.keychainStatusCard.keySource`,`Key source`),children:[r(`span`,{className:`block`,children:lt[l.kind]}),l.path!==void 0&&r(q,{value:l.path,srLabel:`key path`})]}),r(Y,{label:s(`secrets.keychainStatusCard.fingerprint`,`Fingerprint`),children:t.fingerprint===null?r(`span`,{className:`text-foreground-subtle`,children:`—`}):e(`span`,{className:`inline-flex items-center gap-0.5`,children:[r(`span`,{className:`font-mono`,title:t.fingerprint,children:t.fingerprint.slice(0,ut)}),r(R,{value:t.fingerprint,srLabel:`fingerprint`})]})}),r(Y,{label:s(`secrets.keychainStatusCard.recoveryKey`,`Recovery key`),children:t.recoveryKeyDownloadedAt===null?r(N,{variant:`warning`,children:s(`secrets.keychainStatusCard.notTaken`,`Not taken`)}):r(`span`,{children:s(`secrets.keychainStatusCard.taken`,{when:K(t.recoveryKeyDownloadedAt)})})})]})})}function Y({label:t,children:n}){return e(`div`,{className:`min-w-0 text-xs`,children:[r(`dt`,{className:`text-foreground-subtle`,children:t}),r(`dd`,{className:`mt-0.5 min-w-0 text-foreground`,children:n})]})}s();var ft=1e3;function pt({revealed:t,onClose:n}){let{t:o}=V(),[s,c]=a(F);i(()=>{if(t===null)return;let e=Date.now();c(F);let r=setTimeout(n,F),i=setInterval(()=>c(Math.max(0,F-(Date.now()-e))),ft);return()=>{clearTimeout(r),clearInterval(i)}},[t,n]);let l=Math.ceil(s/1e3);return r(De,{open:t!==null,onOpenChange:e=>!e&&n(),children:r(k,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:t!==null&&e(u,{children:[e(A,{children:[r(pe,{className:`break-all`,children:t.entry.fieldPath}),e(de,{className:`break-all`,children:[t.entry.owner,` · `,t.entry.scope]})]}),r(Ne,{children:r(`pre`,{"data-testid":`revealed-value`,className:`whitespace-pre-wrap break-all rounded-md border border-border bg-background p-3 font-mono text-xs text-foreground`,children:t.value})}),e(Me,{className:`flex-col items-stretch gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[r(`p`,{className:`text-[11px] text-foreground-subtle`,children:o(`secrets.revealDialog.recorded`,{seconds:l})}),e(`div`,{className:`flex justify-end gap-2`,children:[r(R,{value:t.value,label:o(`common.copy`,`Copy`),srLabel:`revealed value`}),r(P,{size:`sm`,variant:`outline`,onClick:n,children:o(`secrets.revealDialog.hide`,`Hide`)})]})]})]})})})}var X={orphan:{labelKey:`secrets.secretsTableState.usageOrphan`,variant:`warning`,hintKey:`secrets.secretsTableState.usageOrphanHint`,rank:0},unknown:{labelKey:`secrets.secretsTableState.usageUnknown`,variant:`default`,hintKey:`secrets.secretsTableState.usageUnknownHint`,rank:1},"in-use":{labelKey:`secrets.secretsTableState.usageInUse`,variant:`success`,hintKey:`secrets.secretsTableState.usageInUseHint`,rank:2}},mt=[{id:`all`,labelKey:`common.all`},{id:`in-use`,labelKey:`secrets.secretsTableState.usageInUse`},{id:`orphan`,labelKey:`secrets.secretsTableState.filterOrphans`},{id:`unknown`,labelKey:`secrets.secretsTableState.usageUnknown`}],Z=`system`;function ht(t){let{t:n}=V(),{secrets:i,filter:a,onFilterChange:o,onDeleteOrphans:s,deleting:c,locked:l}=t;if(i===void 0)return r(`p`,{className:`text-xs text-foreground-subtle`,children:n(`common.loading`,`Loading…`)});let u=e=>e===`all`?i.length:i.filter(t=>t.usage===e).length,d=i.filter(e=>e.usage===`orphan`).map(e=>e.ref),f=a===`all`?i:i.filter(e=>e.usage===a);return e(`div`,{className:`space-y-2`,children:[e(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[r(`div`,{className:`flex flex-wrap gap-1`,role:`group`,"aria-label":n(`secrets.secretsTable.filterByUsage`,`Filter by usage`),children:mt.map(t=>e(P,{size:`sm`,variant:a===t.id?`secondary`:`ghost`,"aria-pressed":a===t.id,className:a===t.id?`ring-1 ring-border`:void 0,onClick:()=>o(t.id),children:[n(t.labelKey),r(`span`,{className:`text-foreground-subtle tabular-nums`,children:u(t.id)})]},t.id))}),d.length>0&&e(P,{size:`sm`,variant:`outline`,className:`ml-auto`,disabled:c||l,onClick:()=>s(d),children:[r(g,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),n(`secrets.secretsTableState.deleteOrphans`,{count:d.length})]})]}),r(I,{columns:_t(t),rows:f,rowKey:e=>e.ref,minWidthPx:860,maxBodyHeight:ue,defaultSort:{columnKey:`owner`,dir:`asc`},emptyMessage:i.length===0?n(`secrets.secretsTable.noValueIsStoredIn`,`No value is stored in the keychain yet.`):n(`secrets.secretsTable.noStoredValueMatchesThis`,`No stored value matches this filter.`)})]})}function gt({owner:t}){let{t:n}=V();return e(`span`,{className:`flex items-center gap-2`,children:[r(Be,{addonId:t,fallback:t===Z?b:_,tileClassName:`bg-surface-hover text-foreground-subtle`,size:`sm`}),r(`span`,{className:`font-medium`,children:t===Z?n(`secrets.secretsTable.hubSystem`,`Hub (system)`):t})]})}function _t({locked:t,onReveal:n,revealing:i}){return[{key:`owner`,header:B.t(`secrets.secretsTable.owner`,`Owner`),render:e=>r(gt,{owner:e.owner}),sortValue:e=>e.owner},{key:`scope`,header:B.t(`secrets.secretsTable.scope`,`Scope`),render:e=>r(`span`,{className:`block max-w-[11rem] truncate font-mono`,title:e.scope,children:e.scope}),sortValue:e=>e.scope},{key:`field`,header:B.t(`secrets.secretsTable.field`,`Field`),render:e=>r(q,{value:e.fieldPath,copyValue:e.ref,srLabel:`secret ref`,maxWidthClass:`max-w-[16rem]`}),sortValue:e=>e.fieldPath},{key:`updated`,header:B.t(`secrets.secretsTable.updated`,`Updated`),render:e=>K(e.updatedAt),sortValue:e=>e.updatedAt},{key:`last-read`,header:B.t(`secrets.secretsTable.lastRead`,`Last read`),render:e=>K(e.lastReadAt),sortValue:e=>e.lastReadAt},{key:`status`,header:B.t(`secrets.secretsTable.status`,`Status`),render:e=>r(N,{variant:X[e.usage].variant,title:B.t(X[e.usage].hintKey),children:B.t(X[e.usage].labelKey)}),sortValue:e=>X[e.usage].rank},{key:`actions`,header:``,align:`right`,notSortableReason:`Actions`,render:a=>e(P,{size:`sm`,variant:`ghost`,disabled:t||i,"aria-label":B.t(`secrets.secretsTable.reveal`,`Reveal {{fieldPath}}`,{fieldPath:a.fieldPath}),title:t?B.t(`secrets.secretsTable.theKeychainIsLocked`,`The keychain is locked`):B.t(`secrets.secretsTable.revealAudited`,`Reveal (audited)`),onClick:()=>n(a),children:[r(h,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),B.t(`secrets.secretsTable.reveal2`,`Reveal`)]})}]}function vt(e){return e instanceof Error?e.message:String(e)}function yt(e){let{t}=V(),n=ie(),r=T(),i=S(),a=Se(),o=Ee(),s=je(),c=_e(),l=ge(),u=j(),d=async(t,n)=>{try{await n()}catch(e){await r({title:t,message:vt(e),variant:`danger`})}e()};return{busy:a.isPending||o.isPending||s.isPending||c.isPending,deleting:u.isPending,download:async()=>{await n({title:t(`secrets.useKeychainActions.downloadTitle`),message:t(`secrets.useKeychainActions.downloadMessage`),confirmLabel:t(`secrets.useKeychainActions.downloadConfirm`),variant:`warning`})&&await d(t(`secrets.useKeychainActions.downloadRefused`),async()=>{let e=await a.mutateAsync({});await i({title:t(`secrets.useKeychainActions.recoveryTitle`,{fingerprint:e.fingerprint}),message:t(`secrets.useKeychainActions.recoveryMessage`),defaultValue:e.key,readOnly:!0,confirmLabel:t(`secrets.useKeychainActions.recoveryDone`)})})},rotate:async()=>{await n({title:t(`secrets.useKeychainActions.rotateTitle`),message:t(`secrets.useKeychainActions.rotateMessage`),confirmLabel:t(`secrets.useKeychainActions.rotateConfirm`),variant:`warning`})&&await d(t(`secrets.useKeychainActions.rotateRefused`),async()=>{let e=await o.mutateAsync({});await r({title:t(`secrets.useKeychainActions.rotatedTitle`),message:t(`secrets.useKeychainActions.rotatedMessage`,{fingerprint:e.fingerprint})})})},purge:async()=>{await n({title:t(`secrets.useKeychainActions.purgeTitle`),message:t(`secrets.useKeychainActions.purgeMessage`),confirmLabel:t(`secrets.useKeychainActions.purgeConfirm`),variant:`warning`})&&await d(t(`secrets.useKeychainActions.purgeRefused`),async()=>{await s.mutateAsync({})})},reset:async()=>{await i({title:t(`secrets.useKeychainActions.resetTitle`),message:t(`secrets.useKeychainActions.resetMessage`,{confirmation:`RESET KEYCHAIN`}),confirmLabel:t(`secrets.useKeychainActions.resetConfirm`),validate:e=>e===`RESET KEYCHAIN`?null:t(`secrets.useKeychainActions.resetMismatch`)})===`RESET KEYCHAIN`&&await d(t(`secrets.useKeychainActions.resetRefused`),async()=>{await c.mutateAsync({confirm:ce})})},acknowledgeReset:async()=>{await d(t(`secrets.useKeychainActions.dismissFailed`),async()=>{await l.mutateAsync({})})},deleteOrphans:async e=>{await n({title:t(`secrets.useKeychainActions.orphansTitle`,{count:e.length}),message:t(`secrets.useKeychainActions.orphansMessage`),confirmLabel:t(`secrets.useKeychainActions.orphansConfirm`),variant:`danger`})&&await d(t(`secrets.useKeychainActions.orphansRefused`),async()=>{let n=await u.mutateAsync({refs:[...e]});n.kept.length>0&&await r({title:t(`secrets.useKeychainActions.keptTitle`),message:t(`secrets.useKeychainActions.keptMessage`,{deleted:n.deleted.length,kept:n.kept.length})})})}}}s();var Q=`view`;function bt(){let[e,t]=Ie();return[e.get(Q)===`audit`?`audit`:`values`,n=>{let r=new URLSearchParams(e);n===`values`?r.delete(Q):r.set(Q,n),t(r,{replace:!0})}]}function xt(){let{t:i}=V(),o=xe({}),s=ve({}),c=he({limit:500}),l=we({}),u=Ce(),d=T(),[f,p]=bt(),[m,h]=a(`all`),[g,_]=a(null),v=yt(()=>{o.refetch(),s.refetch(),c.refetch(),l.refetch()}),y=o.data?.keychain.state===`locked`,b=t(()=>(s.data??[]).filter(e=>e.usage===`orphan`).length,[s.data]),x=t(()=>o.data===void 0?[]:Qe({status:o.data,reset:l.data?.reset??null,pendingReentry:l.data?.pendingReentry.length??0,orphans:b}),[o.data,l.data,b]),S={reset:l.data?.reset??null,pendingReentry:l.data?.pendingReentry??[],busy:v.busy,onReset:()=>void v.reset(),onAcknowledgeReset:()=>void v.acknowledgeReset(),onDownload:()=>void v.download(),onRotate:()=>void v.rotate(),onShowOrphans:()=>{h(`orphan`),p(`values`)}},C=async e=>{try{_({entry:e,value:(await u.mutateAsync({ref:e.ref})).value}),s.refetch()}catch(e){await d({title:i(`admin.system.secrets.revealRefused`,`Reveal refused`),message:Le(e),variant:`danger`})}},w=n(()=>_(null),[]);return e(H,{embedded:!0,icon:E,title:i(`admin.system.secrets.secrets`,`Secrets`),subtitle:i(`admin.system.secrets.passwordsTokensAndKeysEncrypted`,`Passwords, tokens and keys, encrypted in the hub keychain. Values leave the hub only through an audited reveal.`),children:[r(st,{notices:x,renderAction:e=>rt(e,S),renderDetail:e=>it(e,S)}),o.data!==void 0&&r(dt,{status:o.data,busy:v.busy,onDownload:S.onDownload,onRotate:S.onRotate,onPurge:()=>void v.purge()}),e(me,{value:f,onValueChange:e=>p(e===`audit`?`audit`:`values`),children:[e(Ae,{children:[r(D,{value:`values`,children:i(`admin.system.secrets.storedValues`,`Stored values`)}),r(D,{value:`audit`,children:i(`admin.system.secrets.audit`,`Audit`)})]}),r(O,{value:`values`,children:r(ht,{secrets:s.data,locked:y,filter:m,onFilterChange:h,onReveal:e=>void C(e),revealing:u.isPending,onDeleteOrphans:e=>void v.deleteOrphans(e),deleting:v.deleting})}),r(O,{value:`audit`,children:r(nt,{entries:c.data})})]}),r(pt,{revealed:g,onClose:w})]})}s();var St=[[`system`]];function $(e){return e.toFixed(6).replace(/0+$/,``).replace(/\.$/,``)}function Ct(){let{t}=V(),n=c(),o=ye(),s=Te(),l=M(),[u,d]=a(``),[f,p]=a(``),[h,g]=a(null),_=o.data?.location??null;i(()=>{d(_===null?``:$(_.latitude)),p(_===null?``:$(_.longitude))},[_]);let v=async()=>{await n.invalidateQueries({queryKey:St})},y=async e=>{e.preventDefault();let t=Number(u),n=Number(f);if(u.trim()===``||f.trim()===``){g(`Enter both a latitude and a longitude, or press Clear.`);return}if(!Number.isFinite(t)||t<-90||t>90){g(`Latitude must be between -90 and 90 decimal degrees.`);return}if(!Number.isFinite(n)||n<-180||n>180){g(`Longitude must be between -180 and 180 decimal degrees.`);return}g(null),await s.mutateAsync({latitude:t,longitude:n}),await v()},b=async()=>{g(null),await s.mutateAsync(null),await v()},S=async()=>{g(null),await l.mutateAsync(),await v()},C=s.isPending||l.isPending||o.isLoading;return e(Oe,{className:`space-y-3`,children:[e(`div`,{className:`flex items-start justify-between gap-3`,children:[e(`div`,{className:`flex items-start gap-2`,children:[r(x,{className:`h-4 w-4 mt-0.5 text-muted-foreground shrink-0`}),r(`div`,{children:r(`h3`,{className:`text-sm font-medium`,children:t(`settings.siteLocationCard.siteLocation`,`Site location`)})})]}),_===null?r(N,{variant:`warning`,children:t(`settings.siteLocationCard.notConfigured`,`Not configured`)}):r(N,{variant:_.source===`operator-set`?`success`:`info`,children:_.source===`operator-set`?t(`settings.siteLocationCard.setByYou`,`Set by you`):t(`settings.siteLocationCard.derivedFromIp`,`Derived from IP`)})]}),_?.label!==void 0&&_.label!==``?r(`p`,{className:`text-xs text-muted-foreground`,children:t(`settings.siteLocationCard.detectedNear`,{place:_.label})}):null,_===null&&o.data?.derivationAttemptedAt!==null?e(`p`,{className:`text-xs text-warning`,children:[t(`settings.siteLocationCard.automaticDetectionFromThePublic`,`Automatic detection from the public IP did not succeed`),o.data?.derivationError!==null&&o.data?.derivationError!==void 0?`: ${o.data.derivationError}`:`.`,` `,t(`settings.siteLocationCard.itIsNotRetriedOn`,`It is not retried on its own — enter the coordinates, or press Detect.`)]}):null,e(`form`,{className:`flex flex-wrap items-end gap-3`,onSubmit:y,children:[e(`label`,{className:`flex flex-col gap-1 text-xs`,children:[r(`span`,{className:`text-muted-foreground`,children:t(`settings.siteLocationCard.latitude`,`Latitude`)}),r(z,{className:`w-40`,value:u,inputMode:`decimal`,placeholder:`40.851800`,onChange:e=>d(e.target.value),"aria-label":t(`settings.siteLocationCard.latitude`,`Latitude`)})]}),e(`label`,{className:`flex flex-col gap-1 text-xs`,children:[r(`span`,{className:`text-muted-foreground`,children:t(`settings.siteLocationCard.longitude`,`Longitude`)}),r(z,{className:`w-40`,value:f,inputMode:`decimal`,placeholder:`14.268100`,onChange:e=>p(e.target.value),"aria-label":t(`settings.siteLocationCard.longitude`,`Longitude`)})]}),r(P,{type:`submit`,disabled:C,children:t(`common.save`,`Save`)}),e(P,{type:`button`,variant:`ghost`,disabled:C,onClick:S,children:[r(m,{className:`h-3.5 w-3.5 mr-1`}),t(`settings.siteLocationCard.detectFromIp`,`Detect from IP`)]}),_===null?null:r(P,{type:`button`,variant:`ghost`,disabled:C,onClick:b,children:t(`settings.siteLocationCard.clear`,`Clear`)})]}),h===null?null:r(`p`,{className:`text-xs text-danger`,children:h}),r(`p`,{className:`text-xs text-muted-foreground`,children:t(`settings.siteLocationCard.wgs84DecimalDegreesDetectAsks`,`WGS84 decimal degrees. Detect asks a public geo-IP service once and will not overwrite a value you typed — clear it first.`)})]})}function wt(){let{t}=V(),{nodes:n,isLoading:i}=ke(),a=n.find(e=>e.isHub&&e.isOnline),o=a?.addons.map(e=>e.addonId)??[];return e(H,{embedded:!0,children:[r(Ct,{}),i?r(`div`,{className:`text-muted-foreground text-sm py-12 text-center`,children:t(`admin.system.settings.loadingHubTopology`,`Loading hub topology…`)}):a?o.length===0?r(`div`,{className:`text-muted-foreground text-sm py-12 text-center`,children:t(`admin.system.settings.noAddonsInstalledOnThe`,`No addons installed on the hub yet.`)}):r(ze,{nodeId:a.id,addonIds:o,level:`global`}):e(`div`,{className:`flex flex-col items-center justify-center text-muted-foreground text-sm gap-2 py-12`,children:[r(w,{className:`h-8 w-8 opacity-30`}),r(`p`,{children:t(`admin.system.settings.noOnlineHubNodeFound`,`No online hub node found.`)}),r(`p`,{className:`text-xs`,children:t(`admin.system.settings.settingsWillAppearOnceThe`,`Settings will appear once the hub is reachable.`)})]})]})}function Tt(){let{t:e}=V(),t=Fe(`/system/settings`,{t:e,isAdmin:!0})??{icon:w,title:e(`system.systemNav`,`System`)};return r(Re,{icon:t.icon,title:t.title,defaultSection:`settings`,sectionsLabel:`${t.title} sections`,sections:[{id:`settings`,label:e(`system.system.settings`,`Settings`),content:r(wt,{})},{id:`secrets`,label:e(`system.system.secrets`,`Secrets`),content:r(xt,{}),ownedParams:[`view`]},{id:`capabilities`,label:e(`system.system.capabilities`,`Capabilities`),content:r(Ye,{})}]})}export{Tt as SystemPage};
@@ -0,0 +1 @@
1
+ import{C as e,J as t,K as n,R as r,S as i,V as a,Y as o,et as s,o as c,q as l,x as u}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Hn as d,Ht as f,In as p,It as m,aa as h,ai as g,ia as _,ot as v,ra as y,st as b,ta as x,vn as S}from"./player-overlays-CdeStLFY.js";import{Dr as C,Er as w,Or as T,br as E,ir as D,nr as ee,qa as O,rr as te,vr as ne,xr as re,yr as ie}from"./client-AOeY3PoN.js";import{u as ae}from"./video-D8GbzI4M.js";import{n as oe,t as k}from"./shapes-DNn8cgSP.js";import{t as se}from"./unlink-86HtbCbI.js";import{$u as ce,An as le,Bd as A,Er as ue,Et as j,Fr as de,Lr as M,Pd as N,Pr as fe,Qu as pe,Sr as me,Tr as he,Vd as ge,Xn as _e,Xu as ve,Zd as ye,Zu as be,an as P,br as xe,fi as Se,hu as Ce,ii as F,kn as we,si as Te,wr as Ee,wt as De,xr as Oe,zd as I}from"./src-CImrkf6y.js";import{t as L}from"./useTranslation-BJr-n0es.js";import{t as ke}from"./AdminPage-95Fx8-ai.js";import{C as R,D as z,E as Ae,S as je,T as Me,_ as Ne,a as Pe,b as Fe,c as Ie,d as Le,f as Re,g as ze,h as Be,i as Ve,l as He,m as Ue,n as We,o as Ge,p as Ke,r as qe,s as B,t as Je,u as Ye,v as Xe,w as Ze,x as Qe,y as $e}from"./RemoteGrid-BJ5xj0Z6.js";s();function et(e){return{past:[],present:e,future:[]}}var tt=e=>e.past.length>0,nt=e=>e.future.length>0;function rt(e,t){switch(t.type){case`edit`:return Object.is(t.value,e.present)?e:{past:[...e.past,e.present].slice(-100),present:t.value,future:[]};case`undo`:{let t=e.past.at(-1);return t===void 0?e:{past:e.past.slice(0,-1),present:t,future:[e.present,...e.future]}}case`redo`:{let[t,...n]=e.future;return t===void 0?e:{past:[...e.past,e.present],present:t,future:n}}}}var V=12,H=4,U=3,W=(e,t,n,r,i,a={})=>({id:e,role:t,row:n,col:r,colSpan:i,...a}),G=e=>`custom:${e}`;function K(e,t,n=[]){return t.map((t,r)=>W(`r${e}c${r}`,t,e,r*H,H,{...n[r]===void 0?{}:{label:n[r]}}))}function q(e){return[W(`up`,`up`,e,H,H),W(`left`,`left`,e+1,0,H),W(`ok`,`ok`,e+1,H,H),W(`right`,`right`,e+1,2*H,H),W(`down`,`down`,e+2,H,H)]}function J(e,t){return t.map((t,n)=>W(`app_${t}`,G(`app_${t}`),e,n*U,U,{icon:qe(t)}))}var Y=(e,t)=>({id:`core:section-divider`,row:e,col:0,options:{scale:{cols:V},title:t}});function it(e,t,n){let r=B(V,e,t);for(let e of n){let t=D(r,ee(e.id),{row:e.row,col:e.col},e.options);if(!t.ok)throw Error(`preset component ${e.id} at ${e.row}:${e.col}: ${t.reason}`);r=t.layout}return r}var X={scale:{cols:H}},at={scale:{rows:2,cols:H}},ot=(e,t,n,r)=>({idSuffix:e,row:3,col:t,rowSpan:1,colSpan:1,role:n,label:r}),st=it(23,[W(`input`,`input`,0,2*H,H),W(`mute`,`mute`,7,H,H),W(`ch_list`,G(`ch_list`),8,H,H,{label:`CH LIST`}),W(`settings`,G(`settings`),9,H,H,{label:`Settings`}),W(`home`,`home`,10,H,H),W(`guide`,`guide`,12,0,H),W(`e_manual`,G(`e_manual`),12,H,H,{label:`e-Manual`}),W(`info`,`info`,12,2*H,H),W(`back`,`back`,17,0,H),W(`exit`,`exit`,17,2*H,H),W(`color_a`,G(`color_a`),19,0,U,{label:`A`}),W(`color_b`,G(`color_b`),19,U,U,{label:`B`}),W(`color_c`,G(`color_c`),19,2*U,U,{label:`C`}),W(`color_d`,G(`color_d`),19,3*U,U,{label:`D`}),W(`pic_size`,G(`pic_size`),20,0,H,{label:`P.SIZE`}),W(`picture`,G(`picture`),20,H,H,{label:`Picture`}),W(`ad_subt`,G(`ad_subt`),20,2*H,H,{label:`AD/SUBT`})],[{id:`core:power`,row:0,col:0,options:{scale:{cols:2}}},Y(1,`Numbers`),{id:`core:keypad`,row:2,col:0,options:{scale:X.scale,extras:[ot(`ttx`,0,G(`ttx_mix`),`TTX/MIX`),ot(`prech`,2,G(`pre_ch`),`PRE-CH`)]}},Y(6,`Volume and channels`),{id:`core:rocker-volume-v`,row:7,col:0,options:at},{id:`core:rocker-channel-v`,row:7,col:2*H,options:at},Y(11,`Menus`),Y(13,`Navigation`),{id:`core:dpad`,row:14,col:0,options:X},Y(18,`Colour and picture`),Y(21,`Playback`),{id:`core:media-transport`,row:22,col:1,options:{scale:{cols:2}}}]),ct=[`netflix`,`youtube`,`primevideo`,`disneyplus`,`dazn`,`raiplay`],lt=it(20,[W(`input`,`input`,0,2*H,H),...K(4,[`menu`,`home`,`exit`]),W(`guide`,`guide`,6,0,H),W(`info`,`info`,6,2*H,H),W(`back`,`back`,10,0,H),W(`play_pause`,`play_pause`,10,2*H,H),W(`mute`,`mute`,12,H,H),W(`ch_list`,G(`ch_list`),13,H,H,{label:`CH.LIST`}),W(`subtitle`,G(`subtitle`),14,0,6,{label:`Subtitle`}),W(`text`,G(`text`),14,6,6,{label:`Text`})],[{id:`core:power`,row:0,col:0,options:{scale:{cols:2}}},{id:`core:panel`,row:1,col:0,options:{scale:X.scale,title:`Apps`,extras:ct.map((e,t)=>({idSuffix:e,row:Math.floor(t/3),col:t%3,rowSpan:1,colSpan:1,role:G(`app_${e}`),icon:qe(e)}))}},{id:`core:colour-keys`,row:3,col:0,options:{scale:{cols:U}}},Y(5,`Navigation`),{id:`core:dpad`,row:7,col:0,options:X},Y(11,`Volume and channels`),{id:`core:rocker-volume-v`,row:12,col:0,options:X},{id:`core:rocker-channel-v`,row:12,col:2*H,options:X},Y(15,`Numbers`),{id:`core:keypad`,row:16,col:0,options:X}]),ut=B(V,8,[W(`power`,`power`,0,0,H),W(`input`,`input`,0,2*H,H),...q(1),...K(4,[`back`,`home`,`play_pause`]),W(`vol_up`,`volume_up`,5,0,H),W(`mute`,`mute`,5,H,H,{rowSpan:2}),W(`ch_up`,`channel_up`,5,2*H,H),W(`vol_down`,`volume_down`,6,0,H),W(`ch_down`,`channel_down`,6,2*H,H),...J(7,[`netflix`,`primevideo`,`disneyplus`,`youtube`])]),dt=B(V,9,[W(`power`,`power`,0,0,H),W(`input`,`input`,0,2*H,H),W(`settings`,G(`settings`),1,0,H,{label:`Settings`}),W(`up`,`up`,1,H,H),W(`guide`,`guide`,1,2*H,H),W(`left`,`left`,2,0,H),W(`ok`,`ok`,2,H,H),W(`right`,`right`,2,2*H,H),W(`back`,`back`,3,0,H),W(`down`,`down`,3,H,H),W(`home`,`home`,3,2*H,H),W(`vol_up`,`volume_up`,4,0,H,{rowSpan:2}),W(`vol_down`,`volume_down`,6,0,H,{rowSpan:2}),W(`mute`,`mute`,4,H,H),W(`info`,`info`,5,H,H),W(`menu`,`menu`,6,H,H),W(`exit`,`exit`,7,H,H),W(`ch_up`,`channel_up`,4,2*H,H,{rowSpan:2}),W(`ch_down`,`channel_down`,6,2*H,H,{rowSpan:2}),...J(8,[`netflix`,`primevideo`,`disneyplus`,`youtube`])]),ft=B(V,8,[W(`assistant`,G(`assistant`),0,0,H,{label:`Assistant`}),W(`input`,`input`,0,H,H),W(`power`,`power`,0,2*H,H),...q(1),...K(4,[`back`,`home`,`guide`]),W(`vol_up`,`volume_up`,5,0,H),W(`mute`,`mute`,5,H,H),W(`ch_up`,`channel_up`,5,2*H,H),W(`vol_down`,`volume_down`,6,0,H),W(`play_pause`,`play_pause`,6,H,H),W(`ch_down`,`channel_down`,6,2*H,H),...J(7,[`youtube`,`netflix`,`primevideo`,`disneyplus`])]),pt=B(V,7,[W(`siri`,G(`siri`),0,0,H,{label:`Siri`}),W(`power`,`power`,0,2*H,H),...q(1),...K(4,[`back`,`play_pause`,`home`]),W(`vol_up`,`volume_up`,5,0,6),W(`vol_down`,`volume_down`,5,6,6),W(`mute`,`mute`,6,H,H)]),mt=[{id:`samsung-classic`,layout:st},{id:`hisense-vidaa`,layout:lt},{id:`samsung-smart`,layout:ut},{id:`lg-magic`,layout:dt},{id:`google-tv`,layout:ft},{id:`apple-tv`,layout:pt}];function ht(e){let t=mt.find(t=>t.id===e);return t===void 0?null:{...t.layout,buttons:t.layout.buttons.map(e=>({...e}))}}function gt(e){let t=new Map;for(let n of e)for(let e of n)t.has(e.id)||t.set(e.id,e);let n=[...t.values()];return[...n.filter(e=>e.id.startsWith(`core:`)),...n.filter(e=>!e.id.startsWith(`core:`))]}function Z(e,t){let n=e.nameI18n;return n===void 0?e.name:t.startsWith(`it`)?n.it:n.en}function _t(e){let t=D({columns:e.size.cols,rows:e.size.rows,buttons:[]},e,{row:0,col:0});return t.ok?t.layout:null}function vt(e,t,n,r){let i=t.trim().toLowerCase();return i===``?[...e]:e.filter(e=>Z(e,n).toLowerCase().includes(i)||r(e.category).toLowerCase().includes(i))}function yt(e,t){let n=te(e,t);return n!==null&&n>1}function bt(e,t,n={}){let r=n.fillWidth===!0?te(e,t):null,i=r===null||r<2?{}:{scale:{cols:r}};if(n.at!==void 0)return D(e,t,n.at,i);let a=D(e,t,{row:0,col:0},i);if(a.ok||a.reason===`outside`||a.reason===`too-many`)return a;for(let n=0;n<e.rows;n+=1)for(let r=0;r<e.columns;r+=1){let a=D(e,t,{row:n,col:r},i);if(a.ok)return a}return a}function xt({open:t,grid:n,onOpenChange:r,onPick:a}){let{t:o,i18n:s}=L();return i(xe,{open:t,onOpenChange:r,children:e(me,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:[i(he,{children:i(ue,{children:o(`remote.palette.title`)})}),i(Oe,{children:t&&i(St,{grid:n,language:s.language,onPick:a})})]})})}function St({grid:t,language:r,onPick:a}){let{t:s}=L(),c=Ce({}),[l,u]=o(``),[d,f]=o(!1),[p,m]=o(null),h=e=>s(`remote.palette.category.${e}`,e),g=vt(n(()=>gt(c.data===void 0?[]:[c.data]),[c.data]),l,r,h),_=g.some(e=>yt(t,e));return c.isError?i(fe,{title:s(`remote.palette.errorTitle`),message:c.error.message,onRetry:()=>void c.refetch()}):c.data===void 0?e(`div`,{className:`grid gap-2 sm:grid-cols-2`,"data-testid":`palette-loading`,children:[i(M,{className:`h-24`}),i(M,{className:`h-24`}),i(M,{className:`h-24`}),i(M,{className:`h-24`})]}):e(`div`,{className:`space-y-3`,children:[e(`div`,{className:`relative`,children:[i(S,{className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-foreground-subtle`,"aria-hidden":!0}),i(I,{value:l,className:`pl-8`,placeholder:s(`remote.palette.search`),"aria-label":s(`remote.palette.search`),onChange:e=>u(e.target.value),"data-testid":`palette-search`})]}),_&&e(`label`,{className:`flex items-center gap-2 text-xs text-foreground-muted`,children:[i(_e,{checked:d,onChange:e=>f(e.target.checked),"data-testid":`palette-fill-width`}),s(`remote.palette.fillWidth`)]}),p!==null&&i(`p`,{role:`status`,className:`text-xs text-success`,"data-testid":`palette-added`,children:s(`remote.palette.added`,{name:p})}),g.length===0?i(de,{icon:k,title:s(`remote.palette.emptyTitle`),description:s(`remote.palette.emptyDescription`)}):i(`ul`,{className:`grid gap-2 sm:grid-cols-2`,"data-testid":`palette-list`,children:g.map(e=>i(`li`,{children:i(Ct,{component:e,language:r,category:h(e.category),onPick:()=>{a(e,{fillWidth:d}),m(Z(e,r))}})},e.id))})]})}function Ct({component:t,language:r,category:a,onPick:o}){let{t:s}=L(),c=n(()=>_t(t),[t]),l=Z(t,r);return e(`button`,{type:`button`,className:`flex h-full w-full items-center gap-3 rounded-lg border border-border bg-surface p-2 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,"data-testid":`palette-item-${t.id}`,onClick:o,children:[i(`span`,{className:`w-20 shrink-0`,children:c!==null&&i(Je,{grid:c,label:l,compact:!0})}),e(`span`,{className:`min-w-0`,children:[i(`span`,{className:`block truncate text-sm font-medium text-foreground`,children:l}),e(`span`,{className:`block truncate text-xs text-foreground-muted`,children:[a,` ·`,` `,s(`remote.palette.size`,{cols:t.size.cols,rows:t.size.rows})]})]})]})}function Q(e,t){let n=t.kind===`group`?Le(e,t.id):e.buttons.find(e=>e.id===t.id);return n===void 0?void 0:{row:n.row,col:n.col,rowSpan:n.rowSpan,colSpan:n.colSpan}}function wt(e,t,n,r,i){if(e.width<=0||e.height<=0)return{row:0,col:0};let a=Math.floor((n-e.left)/e.width*t.columns),o=(r-e.top)/e.height;if(i===void 0||i.length!==t.rows||o<0)return{col:a,row:Math.floor(o*t.rows)};let s=i.reduce((e,t)=>e+t,0),c=0;for(let[e,t]of i.entries())if(c+=t/s,o<c)return{col:a,row:e};return{col:a,row:Math.max(t.rows,Math.floor(o*t.rows))}}function Tt(e,t,n){return{row:n.row-(t.row-e.row),col:n.col-(t.col-e.col)}}function Et(e,t,n){return t.kind===`group`?Xe(e,t.id,n.row,n.col):Ne(e,t.id,n.row,n.col)}function Dt(e,t,n){let r=Q(e,t);if(r===void 0)return null;let i=Et(e,t,n);return{rect:{...r,row:n.row,col:n.col},valid:i.status===`ok`,reason:i.status===`ok`?null:i.reason}}function Ot(e){switch(e){case`ArrowUp`:return{dRow:-1,dCol:0};case`ArrowDown`:return{dRow:1,dCol:0};case`ArrowLeft`:return{dRow:0,dCol:-1};case`ArrowRight`:return{dRow:0,dCol:1};default:return null}}function kt(e,t,n,r){let i=Q(e,t);return i===void 0?{status:`refused`,reason:`unknown-button`}:Et(e,t,{row:i.row+n,col:i.col+r})}s();var At=4;function jt(e,n,i){let[s,c]=o(null),l=t({grid:e,onDrop:i});l.current={grid:e,onDrop:i};let u=t(null),d=t(!1);return a(()=>()=>u.current?.(),[]),{drag:s,onItemPointerDown:r((e,t)=>{let r=n.current;if(r===null||t.button!==0)return;let i=r.getBoundingClientRect();if(Q(l.current.grid,e)===void 0)return;let a={item:e,startX:t.clientX,startY:t.clientY,grabbed:wt(i,l.current.grid,t.clientX,t.clientY,je(l.current.grid)),active:!1,target:null},o=e=>{if(!a.active){if(Math.hypot(e.clientX-a.startX,e.clientY-a.startY)<At)return;a.active=!0}let t=l.current.grid,n=wt(r.getBoundingClientRect(),t,e.clientX,e.clientY,je(t)),i=Q(t,a.item);i!==void 0&&(a.target=Tt(i,a.grabbed,n),c({item:a.item,preview:Dt(t,a.item,a.target)}))},s=e=>{window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,f),window.removeEventListener(`pointercancel`,p),window.removeEventListener(`keydown`,m),u.current=null,c(null),a.active&&(d.current=!0,window.setTimeout(()=>{d.current=!1},0),e&&a.target!==null&&l.current.onDrop(Et(l.current.grid,a.item,a.target)))},f=()=>s(!0),p=()=>s(!1),m=e=>{e.key===`Escape`&&s(!1)};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,f),window.addEventListener(`pointercancel`,p),window.addEventListener(`keydown`,m),u.current=()=>s(!1)},[n]),consumeDragClick:r(()=>{let e=d.current;return d.current=!1,e},[])}}s();var Mt=`__custom__`;function Nt({value:n,onChange:r}){let{t:a}=L(),[s,c]=o(null),[l,u]=o(null),[d,f]=o(!1),m=t(null),h=s?.kind===`button`?s.id:null,g=s?.kind===`group`?s.id:null,_=n.buttons.find(e=>e.id===h)??null,v=g===null?void 0:Le(n,g),y=(e,t)=>{if(e.status===`ok`){u(null),r(e.grid),t?.(e.grid);return}u(a(`remote.layout.refusal.${e.reason}`))},b=jt(n,m,e=>y(e));return e(`div`,{className:`grid gap-4 md:grid-cols-[minmax(0,18rem)_minmax(0,1fr)]`,children:[e(`div`,{className:`space-y-3`,children:[e(`div`,{className:`grid grid-cols-2 gap-2`,children:[i(j,{label:a(`remote.layout.columns`),children:i(P,{value:n.columns,onDelta:e=>y(Qe(n,n.columns+e,n.rows))})}),i(j,{label:a(`remote.layout.rows`),children:i(P,{value:n.rows,onDelta:e=>y(Qe(n,n.columns,n.rows+e))})})]}),i(Je,{grid:n,label:a(`remote.layout.previewLabel`),selectedId:h,selectedGroupId:g,onSelect:e=>{b.consumeDragClick()||c({kind:`button`,id:e})},onSelectGroup:e=>{b.consumeDragClick()||c({kind:`group`,id:e})},showEmptyCells:!0,gridRef:m,drag:b.drag,onItemPointerDown:b.onItemPointerDown,onItemKeyDown:(e,t)=>{let r=Ot(t.key);r!==null&&(t.preventDefault(),y(kt(n,e,r.dRow,r.dCol)))}}),i(`p`,{className:`text-xs text-foreground-subtle`,children:a(`remote.layout.dragHint`)}),e(`div`,{className:`flex flex-wrap gap-2`,children:[e(F,{variant:`outline`,size:`sm`,onClick:()=>f(!0),"data-testid":`remote-add-component`,children:[i(k,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),a(`remote.layout.addComponent`)]}),e(F,{variant:`outline`,size:`sm`,onClick:()=>y(Ge(n,`ok`),e=>{let t=e.buttons.at(-1);c(t===void 0?null:{kind:`button`,id:t.id})}),"data-testid":`remote-add-button`,children:[i(p,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),a(`remote.layout.addButton`)]})]}),l!==null&&i(`p`,{role:`alert`,className:`text-xs text-warning`,"data-testid":`remote-layout-refusal`,children:l})]}),i(`div`,{className:`min-w-0`,children:_===null?v===void 0?i(`p`,{className:`text-xs text-foreground-subtle`,children:a(`remote.layout.selectHint`)}):i(It,{grid:n,groupId:v.id,apply:y,onGone:()=>c(null)}):i(Ft,{grid:n,buttonId:_.id,apply:y,onRemove:()=>{r($e(n,_.id)),c(null),u(null)}})}),i(xt,{open:d,grid:n,onOpenChange:f,onPick:(e,t)=>{let i=bt(n,e,t);if(!i.ok){u(a(`remote.layout.refusal.${i.reason}`));return}u(null),r(i.layout);let o=i.buttonIds[0];c(i.groupId===null?o===void 0?null:{kind:`button`,id:o}:{kind:`group`,id:i.groupId})}})]})}function Pt(e){return[...Pe.flatMap(t=>Ue(t).map(n=>({value:n,label:e(`remote.role.${n}`,Re(n)),group:e(`remote.roleGroup.${t}`)}))),{value:Mt,label:e(`remote.layout.customRole`),group:e(`remote.roleGroup.custom`)}]}function Ft({grid:t,buttonId:n,apply:r,onRemove:a}){let{t:s}=L(),c=t.buttons.find(e=>e.id===n),l=c===void 0?null:w(c.role),[u,d]=o(null);if(c===void 0)return null;let p=Ke(c.role)||u!==null,m=u??l??``,g=T(m),v={trigger:s(`remote.layout.pickIcon`),panel:s(`remote.layout.iconPanel`),searchPlaceholder:s(`deviceDisplay.iconSearchPlaceholder`),clear:s(`remote.layout.noIcon`),noMatches:s(`deviceDisplay.iconNoMatches`)},b=e=>s(`deviceDisplay.iconCategory.${e}`,{defaultValue:O(e)});return e(`div`,{className:`space-y-3 rounded-lg border border-border bg-surface p-3`,"data-testid":`remote-inspector`,children:[i(Te,{mode:`single`,singleDisplay:`field`,label:s(`remote.layout.role`),options:Pt((e,t)=>s(e,t??e)),value:p?Mt:c.role,onChange:e=>{if(e===Mt){d(l??``);return}d(null),r(R(t,c.id,{role:e}))}}),p&&i(j,{label:s(`remote.layout.customKey`),...m!==``&&!g?{error:s(`remote.layout.customKeyInvalid`)}:{},children:i(I,{value:m,placeholder:`hdmi_1`,onChange:e=>{let n=e.target.value;d(n),T(n)&&r(R(t,c.id,{role:C(n)}))}})}),e(`div`,{className:`grid grid-cols-[auto_minmax(0,1fr)] items-end gap-2`,children:[i(j,{label:s(`remote.layout.icon`),children:i(ge,{value:c.icon??null,onPick:e=>r(R(t,c.id,{icon:e})),fallbackGlyph:k,categoryLabel:b,labels:v})}),i(j,{label:s(`remote.layout.label`),children:i(I,{value:c.label??``,maxLength:40,onChange:e=>r(R(t,c.id,{label:e.target.value}))})})]}),i(j,{label:s(`remote.layout.appIcon`),children:i(N,{value:Ve(c.icon)?.key??``,options:[{value:``,label:s(`remote.layout.noApp`)},...We.map(e=>({value:e.key,label:e.label}))],onChange:e=>{let n=e.target.value;n===``?Ve(c.icon)!==void 0&&r(R(t,c.id,{icon:null})):r(R(t,c.id,{icon:qe(n)}))},"data-testid":`remote-app-icon`})}),e(`div`,{className:`grid grid-cols-2 gap-3`,children:[i(j,{label:s(`remote.layout.shape`),children:i(N,{value:c.shape??``,options:[{value:``,label:s(`remote.layout.lookDefault`)},...E.map(e=>({value:e,label:s(`remote.layout.shapes.${e}`)}))],onChange:e=>{let n=E.find(t=>t===e.target.value);r(Ze(t,c.id,{shape:n??null}))},"data-testid":`remote-shape`})}),i(j,{label:s(`remote.layout.tone`),children:i(N,{value:c.tone??``,options:[{value:``,label:s(`remote.layout.lookDefault`)},...re.map(e=>({value:e,label:s(`remote.layout.tones.${e}`)}))],onChange:e=>{let n=re.find(t=>t===e.target.value);r(Ze(t,c.id,{tone:n??null}))},"data-testid":`remote-tone`})})]}),e(`div`,{className:`grid grid-cols-2 gap-3`,children:[i(j,{label:s(`remote.layout.move`),children:e(`div`,{className:`flex items-center gap-1`,children:[i(A,{icon:_,size:`sm`,variant:`secondary`,"aria-label":s(`remote.layout.moveLeft`),onClick:()=>r(z(t,c.id,0,-1))}),i(A,{icon:x,size:`sm`,variant:`secondary`,"aria-label":s(`remote.layout.moveUp`),onClick:()=>r(z(t,c.id,-1,0))}),i(A,{icon:h,size:`sm`,variant:`secondary`,"aria-label":s(`remote.layout.moveDown`),onClick:()=>r(z(t,c.id,1,0))}),i(A,{icon:y,size:`sm`,variant:`secondary`,"aria-label":s(`remote.layout.moveRight`),onClick:()=>r(z(t,c.id,0,1))})]})}),i(j,{label:s(`remote.layout.position`),children:i(`p`,{className:`text-xs text-foreground-muted`,"data-testid":`remote-position`,children:s(`remote.layout.positionValue`,{row:c.row+1,col:c.col+1})})}),i(j,{label:s(`remote.layout.height`),children:i(P,{value:c.rowSpan,onDelta:e=>r(Fe(t,c.id,c.rowSpan+e,c.colSpan))})}),i(j,{label:s(`remote.layout.width`),children:i(P,{value:c.colSpan,onDelta:e=>r(Fe(t,c.id,c.rowSpan,c.colSpan+e))})})]}),e(F,{variant:`danger`,size:`sm`,onClick:a,children:[i(f,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),s(`remote.layout.removeButton`)]})]})}function It({grid:t,groupId:n,apply:r,onGone:a}){let{t:o}=L(),s=Le(t,n);if(s===void 0)return null;let c=ze(t,n).length;return e(`div`,{className:`space-y-3 rounded-lg border border-border bg-surface p-3`,"data-testid":`remote-group-inspector`,children:[i(`p`,{className:`text-xs text-foreground-muted`,children:o(`remote.layout.groupSummary`,{frame:o(`remote.layout.frames.${s.frame}`,s.frame),count:c,row:s.row+1,col:s.col+1})}),i(j,{label:o(`remote.layout.groupTitle`),children:i(I,{value:s.title??``,maxLength:40,onChange:e=>r(Me(t,s.id,e.target.value)),"data-testid":`remote-group-title`})}),s.frame===`divider`&&e(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[i(j,{label:o(`remote.layout.separatorSize`),children:i(N,{value:s.size??`compact`,options:[{value:`compact`,label:o(`remote.layout.separatorSizeCompact`)},{value:`normal`,label:o(`remote.layout.separatorSizeNormal`)}],onChange:e=>r(Ae(t,s.id,{size:e.target.value===`normal`?`normal`:`compact`})),"data-testid":`remote-separator-size`})}),e(`label`,{className:`flex items-center gap-2 self-end pb-2 text-xs text-foreground-muted`,children:[i(_e,{checked:s.hideTitle===!0,onChange:e=>r(Ae(t,s.id,{hideTitle:e.target.checked})),"data-testid":`remote-separator-hide-title`}),o(`remote.layout.separatorHideLabel`)]})]}),e(`div`,{className:`flex flex-wrap gap-2`,children:[e(F,{variant:`outline`,size:`sm`,"data-testid":`remote-group-ungroup`,onClick:()=>{r(He(t,s.id,!0)),a()},children:[i(se,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),o(`remote.layout.ungroup`)]}),e(F,{variant:`danger`,size:`sm`,"data-testid":`remote-group-delete`,onClick:()=>{r(He(t,s.id,!1)),a()},children:[i(f,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),o(`remote.layout.deleteGroup`)]})]})]})}var Lt={remote:{label:e=>e(`remote.templates.kind.remote`),emptyPayload:Ye,summary:(e,t)=>{let n=Be(e);return t(`remote.templates.layoutSummary`,{columns:n.columns,rows:n.rows,count:n.buttons.length})},renderEditor:(e,t)=>i(Nt,{value:Be(e),onChange:t}),isSavable:e=>Ie(Be(e))!==null,presets:e=>mt.map(t=>({id:t.id,label:e(`remote.templates.preset.${t.id}`),payload:()=>ht(t.id)}))}};function $(e){return Lt[e]}var Rt=ne;function zt(e,t){let n=ie(e,t);return n.ok?n.payload:null}s();function Bt({draft:e,saving:t,error:n,onSave:r,onClose:a}){return i(xe,{open:e!==null,onOpenChange:e=>!e&&a(),children:i(me,{width:`xl`,placement:`sheet-on-mobile`,scroll:`body`,children:e!==null&&i(Vt,{draft:e,saving:t,error:n,onSave:r,onClose:a},e.id??`new`)})})}function Vt({draft:t,saving:n,error:r,onSave:a,onClose:s}){let{t:c}=L(),[d,f]=o(t.name),[p,h]=l(rt,{kind:t.kind,presetId:``,payload:t.payload},et),{kind:g,presetId:_,payload:v}=p.present,y=e=>h({type:`edit`,value:{...p.present,payload:e}}),b=()=>h({type:`undo`}),x=()=>h({type:`redo`});ye(`mod+z`,b,{allowInInput:!1}),ye(`mod+shift+z`,x,{allowInInput:!1});let S=$(g),C=S.presets(c),w=zt(g,v),T=d.trim()!==``&&w!==null&&S.isSavable(v)&&!n;return e(u,{children:[e(he,{className:`flex-row items-center justify-between gap-2`,children:[i(ue,{children:t.id===null?c(`remote.templates.newTitle`):c(`remote.templates.editTitle`)}),e(`div`,{className:`flex shrink-0 items-center gap-1`,children:[i(A,{icon:m,size:`sm`,variant:`ghost`,"aria-label":c(`remote.history.undo`),title:c(`remote.history.undo`),disabled:!tt(p),onClick:b,"data-testid":`template-undo`}),i(A,{icon:oe,size:`sm`,variant:`ghost`,"aria-label":c(`remote.history.redo`),title:c(`remote.history.redo`),disabled:!nt(p),onClick:x,"data-testid":`template-redo`})]})]}),e(Oe,{className:`space-y-4`,children:[e(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[i(j,{label:c(`remote.templates.name`),children:i(I,{value:d,maxLength:120,onChange:e=>f(e.target.value),"data-testid":`template-name`})}),t.id===null&&Rt.length>1&&i(j,{label:c(`remote.templates.kind.label`),children:i(N,{value:g,options:Rt.map(e=>({value:e,label:$(e).label(c)})),onChange:e=>{let t=Rt.find(t=>t===e.target.value);t!==void 0&&h({type:`edit`,value:{kind:t,presetId:``,payload:$(t).emptyPayload()}})}})}),t.id===null&&C.length>0&&i(j,{label:c(`remote.templates.startFrom`),children:i(N,{value:_,options:[{value:``,label:c(`remote.templates.startBlank`)},...C.map(e=>({value:e.id,label:e.label}))],onChange:e=>{let t=C.find(t=>t.id===e.target.value);h({type:`edit`,value:{kind:g,presetId:t?.id??``,payload:t===void 0?S.emptyPayload():t.payload()}}),t!==void 0&&d.trim()===``&&f(t.label)},"data-testid":`template-preset`})})]}),S.renderEditor(v,y),r!==null&&i(`p`,{role:`alert`,className:`text-xs text-danger`,children:r})]}),e(Ee,{children:[i(F,{variant:`ghost`,onClick:s,children:c(`common.cancel`)}),i(F,{disabled:!T,onClick:()=>a({id:t.id,kind:g,name:d.trim(),payload:w}),"data-testid":`template-save`,children:c(`common.save`)})]})]})}s();var Ht=ne[0];function Ut(){let{t}=L(),r=c(),a=pe({}),s=ve(),l=ce(),u=be(),m=b(),h=v(),[_,y]=o(null),[x,S]=o(null),C=()=>void r.invalidateQueries({queryKey:[[`template`]]}),w=async e=>{S(null);try{let t=e.id===null?await s.mutateAsync({kind:e.kind,name:e.name,payload:e.payload}):await l.mutateAsync({id:e.id,name:e.name,payload:e.payload});if(t.status===`refused`){S(t.detail);return}C(),y(null)}catch(e){S(e instanceof Error?e.message:String(e))}},T=async e=>{try{await s.mutateAsync({kind:e.kind,name:t(`remote.templates.copyName`,{name:e.name}),payload:e.payload}),C()}catch(e){await h({title:t(`remote.templates.duplicateFailed`),message:e instanceof Error?e.message:String(e),variant:`danger`})}},E=async e=>{if(await m({title:t(`remote.templates.deleteTitle`,{name:e.name}),message:t(`remote.templates.deleteMessage`),confirmLabel:t(`common.delete`),variant:`danger`}))try{let n=await u.mutateAsync({id:e.id});if(n.status===`in-use`){await h({title:t(`remote.templates.inUseTitle`,{name:e.name}),message:t(`remote.templates.inUseMessage`,{devices:n.devices.map(e=>e.name).join(`, `)}),variant:`warning`});return}C()}catch(e){await h({title:t(`remote.templates.deleteFailed`),message:e instanceof Error?e.message:String(e),variant:`danger`})}},D=n(()=>[{key:`name`,header:t(`remote.templates.name`),sortValue:e=>e.name.toLowerCase(),render:e=>i(`span`,{className:`font-medium text-foreground`,children:e.name})},{key:`kind`,header:t(`remote.templates.kind.label`),sortValue:e=>e.kind,render:e=>i(Se,{variant:`neutral`,children:$(e.kind).label(t)})},{key:`summary`,header:t(`remote.templates.summary`),notSortableReason:`A sentence built from the payload.`,render:e=>i(`span`,{className:`text-foreground-muted`,children:$(e.kind).summary(e.payload,t)})},{key:`updated`,header:t(`remote.templates.updated`),sortValue:e=>e.updatedAt,render:e=>i(`span`,{className:`text-foreground-muted`,children:new Date(e.updatedAt).toLocaleDateString()})},{key:`actions`,align:`right`,notSortableReason:`Row actions.`,render:e=>i(De,{title:t(`remote.templates.actionsFor`,{name:e.name}),items:[{id:`edit`,label:t(`common.edit`),icon:d,onClick:()=>{S(null),y({id:e.id,kind:e.kind,name:e.name,payload:e.payload})}},{id:`duplicate`,label:t(`remote.templates.duplicate`),icon:g,onClick:()=>void T(e)},{id:`delete`,label:t(`common.delete`),icon:f,danger:!0,onClick:()=>void E(e)}]})}],[t]),ee=a.data??[],O=()=>{S(null),y({id:null,kind:Ht,name:``,payload:$(Ht).emptyPayload()})};return e(ke,{icon:ae,title:t(`remote.templates.title`),subtitle:t(`remote.templates.subtitle`),actions:e(F,{size:`sm`,onClick:O,"data-testid":`template-new`,children:[i(p,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),t(`remote.templates.new`)]}),children:[a.status===`error`?i(fe,{title:t(`remote.templates.loadFailed`),message:a.error.message,onRetry:()=>void a.refetch()}):a.data===void 0?i(M,{className:`h-32 w-full`}):ee.length===0?i(de,{icon:ae,title:t(`remote.templates.emptyTitle`),description:t(`remote.templates.emptyDescription`),action:i(F,{size:`sm`,onClick:O,children:t(`remote.templates.new`)})}):i(we,{columns:D,rows:ee,rowKey:e=>e.id,maxBodyHeight:le,defaultSort:{columnKey:`name`,dir:`asc`},onRowClick:e=>{S(null),y({id:e.id,kind:e.kind,name:e.name,payload:e.payload})}}),i(Bt,{draft:_,saving:s.isPending||l.isPending,error:x,onSave:e=>void w(e),onClose:()=>y(null)})]})}export{Ut as TemplatesPage};