@xopcai/xopc 0.0.456 → 0.0.457

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 (303) hide show
  1. package/dist/browser-ext/dist/sidepanel.js +5 -1
  2. package/dist/browser-ext/manifest.json +1 -1
  3. package/dist/extensions/telegram/xopc.extension.json +1 -1
  4. package/dist/gateway/static/root/assets/{activity-store-DYwR1u3f.js → activity-store-CQHh48Zf.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CsRBprL-.js → agent-avatar-dicebear-CAz-Ke6Q.js} +1 -1
  6. package/dist/gateway/static/root/assets/{agent-avatar-display-DqFYHXCS.js → agent-avatar-display-loBdGw_i.js} +2 -2
  7. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-DOAJrMLe.js → agent-defaults-settings-panel-By2Q-6JS.js} +1 -1
  8. package/dist/gateway/static/root/assets/{agent-plugin-dialog-vqlN3ORH.js → agent-plugin-dialog-CikzCYAG.js} +1 -1
  9. package/dist/gateway/static/root/assets/{agents-BgHlOVRV.js → agents-CGUdvmIT.js} +3 -3
  10. package/dist/gateway/static/root/assets/{agents-admin-api-CKscfdvA.js → agents-admin-api-D0N09mqJ.js} +1 -1
  11. package/dist/gateway/static/root/assets/{api-CHM2c_Ah.js → api-B1J5ajiP.js} +1 -1
  12. package/dist/gateway/static/root/assets/{api-DPNeNCmR.js → api-B4FJ51EC.js} +1 -1
  13. package/dist/gateway/static/root/assets/{app-management-settings-panel-Bhz6bj1C.js → app-management-settings-panel-BHlUDZOG.js} +1 -1
  14. package/dist/gateway/static/root/assets/{appearance-settings-BX32aogA.js → appearance-settings-Du5JLyV1.js} +1 -1
  15. package/dist/gateway/static/root/assets/{apps-page-0Yo3jBsQ.js → apps-page-M2XD1Pzu.js} +1 -1
  16. package/dist/gateway/static/root/assets/{archive-plugin-Bha8obMe.js → archive-plugin-BAvglLfu.js} +1 -1
  17. package/dist/gateway/static/root/assets/{automation-api-mn8ihWJ_.js → automation-api-DxBmyzp0.js} +1 -1
  18. package/dist/gateway/static/root/assets/{automation-result-state-COzakzak.js → automation-result-state-CAsqgMNR.js} +1 -1
  19. package/dist/gateway/static/root/assets/{automation-run-list-BhtaMpTb.js → automation-run-list-BmYeWB_N.js} +1 -1
  20. package/dist/gateway/static/root/assets/{automation-task-card-BY_k6iWp.js → automation-task-card-BjqxvYqc.js} +1 -1
  21. package/dist/gateway/static/root/assets/{automations-page-CgQDpSpK.js → automations-page-BSnPWyYd.js} +1 -1
  22. package/dist/gateway/static/root/assets/automations-workspace-DIaCdxtX.js +9 -0
  23. package/dist/gateway/static/root/assets/{binary-plugins-DUbrJFLU.js → binary-plugins-D2bFqG6K.js} +1 -1
  24. package/dist/gateway/static/root/assets/{block-editor-DW--pXAc.js → block-editor-CmnkluMF.js} +1 -1
  25. package/dist/gateway/static/root/assets/{browser-settings-page-CDh6nxs9.js → browser-settings-page-CGcgZOWh.js} +1 -1
  26. package/dist/gateway/static/root/assets/capabilities-DB713nRi.js +1 -0
  27. package/dist/gateway/static/root/assets/{capabilities-DKbXv8Ck.js → capabilities-DDqDvCBs.js} +1 -1
  28. package/dist/gateway/static/root/assets/{capabilities-page-D1wQ2sPI.js → capabilities-page-dXDa0i5o.js} +2 -2
  29. package/dist/gateway/static/root/assets/{capabilities-settings-panel-BW5jQz5R.js → capabilities-settings-panel-CvF8VRTv.js} +1 -1
  30. package/dist/gateway/static/root/assets/{channels-BzZp42yO.js → channels-BDVQ6Z7A.js} +1 -1
  31. package/dist/gateway/static/root/assets/{chat-agents-api-UOdNWZ0_.js → chat-agents-api-CjlzCSmC.js} +1 -1
  32. package/dist/gateway/static/root/assets/{chat-chart-block-NSy-B0NS.js → chat-chart-block-stPJEZ90.js} +1 -1
  33. package/dist/gateway/static/root/assets/chat-page-Bx_A__qB.js +71 -0
  34. package/dist/gateway/static/root/assets/{chat-terminal-dock-CAaHWS7F.js → chat-terminal-dock-B4uA_W6R.js} +1 -1
  35. package/dist/gateway/static/root/assets/{command-palette-api-Dkn9bbYd.js → command-palette-api-CP0F6sIm.js} +1 -1
  36. package/dist/gateway/static/root/assets/{composer-model-config-control-BrK8-SNz.js → composer-model-config-control-DAagrRx_.js} +1 -1
  37. package/dist/gateway/static/root/assets/{composer-notifications-B-kL3qAA.js → composer-notifications-CqV6Xj-H.js} +1 -1
  38. package/dist/gateway/static/root/assets/composer-payload-handoff-Dc43dgSg.js +1 -0
  39. package/dist/gateway/static/root/assets/{computer-settings-page-C9KdEecx.js → computer-settings-page-f-vcEpeF.js} +1 -1
  40. package/dist/gateway/static/root/assets/{connected-providers-grid-D_8v6Qex.js → connected-providers-grid-CZ-FXxaW.js} +1 -1
  41. package/dist/gateway/static/root/assets/{connection-usage-guide-CiVpcbds.js → connection-usage-guide-Cibh2lrV.js} +1 -1
  42. package/dist/gateway/static/root/assets/{connector-service-page-B919cKSm.js → connector-service-page-Btz68iy8.js} +1 -1
  43. package/dist/gateway/static/root/assets/{connectors-api-CgsSm-Av.js → connectors-api-CTuVWwBf.js} +1 -1
  44. package/dist/gateway/static/root/assets/{connectors-page-CEpfDCLA.js → connectors-page-BwJHhyRb.js} +1 -1
  45. package/dist/gateway/static/root/assets/{date-picker-dx284jQI.js → date-picker-XnE3iFhG.js} +1 -1
  46. package/dist/gateway/static/root/assets/{date-time-picker-Dj-bhLNP.js → date-time-picker-VGKm0HVn.js} +1 -1
  47. package/dist/gateway/static/root/assets/{desktop-pet-Cn1TfGz4.js → desktop-pet-CBm3DySQ.js} +1 -1
  48. package/dist/gateway/static/root/assets/{desktop-pet-settings-CsmrvoxU.js → desktop-pet-settings-6O77QXGo.js} +1 -1
  49. package/dist/gateway/static/root/assets/{dev-view-store-BOxbj1ie.js → dev-view-store-B8fGILny.js} +1 -1
  50. package/dist/gateway/static/root/assets/{device-pairing-wizard-CAqFIFRC.js → device-pairing-wizard-qtUvtdDT.js} +1 -1
  51. package/dist/gateway/static/root/assets/{directory-picker-path-field-BxEw5OrT.js → directory-picker-path-field-ByDqf5fE.js} +1 -1
  52. package/dist/gateway/static/root/assets/{discussion-annotation-sync-CyntTwIa.js → discussion-annotation-sync-fwPPMPv9.js} +1 -1
  53. package/dist/gateway/static/root/assets/{extension-authoritative-grants-C0ReZguU.js → extension-authoritative-grants-BfL8dMBf.js} +1 -1
  54. package/dist/gateway/static/root/assets/{extension-debug-page-Cd3HMUbi.js → extension-debug-page-BPwRrP3L.js} +1 -1
  55. package/dist/gateway/static/root/assets/{extension-iframe-host-DiIqM2JO.js → extension-iframe-host-DIH4TcdH.js} +1 -1
  56. package/dist/gateway/static/root/assets/{extension-marketplace-api-CK5CMKTs.js → extension-marketplace-api-BIzkukYp.js} +1 -1
  57. package/dist/gateway/static/root/assets/{extension-message-router-Dn8JzOdR.js → extension-message-router-C9JDpo_7.js} +1 -1
  58. package/dist/gateway/static/root/assets/{extension-page-CLZtAtqm.js → extension-page-CLDoL5N8.js} +1 -1
  59. package/dist/gateway/static/root/assets/{extension-provider-CbVokTvd.js → extension-provider-BPIoHw4r.js} +1 -1
  60. package/dist/gateway/static/root/assets/{extension-settings-page-BM79cwUy.js → extension-settings-page-BO_UKeG8.js} +1 -1
  61. package/dist/gateway/static/root/assets/file-preview-surface-i5UOFnQF.js +1 -0
  62. package/dist/gateway/static/root/assets/{gateway-config-swr-OGhON-s6.js → gateway-config-swr-1Rk0LeEM.js} +1 -1
  63. package/dist/gateway/static/root/assets/{gateway-realtime-B9u4uSXW.js → gateway-realtime-DIs1pjkQ.js} +1 -1
  64. package/dist/gateway/static/root/assets/gateway-realtime-store-sx7B8kdC.js +1 -0
  65. package/dist/gateway/static/root/assets/{gateway-restart-DKAweWmg.js → gateway-restart-DTmlcJps.js} +1 -1
  66. package/dist/gateway/static/root/assets/{gateway-settings-Dc7qUbG-.js → gateway-settings-ClcCloqQ.js} +1 -1
  67. package/dist/gateway/static/root/assets/{gateway-startup-retry-BaaoKBoB.js → gateway-startup-retry-D6WPS0RW.js} +1 -1
  68. package/dist/gateway/static/root/assets/{global-defaults-api-BIr3ApRj.js → global-defaults-api-BpDMnJe7.js} +1 -1
  69. package/dist/gateway/static/root/assets/home-page-D1sTZYAY.js +3 -0
  70. package/dist/gateway/static/root/assets/{image-generation-api-C7D2IetZ.js → image-generation-api-sbtx4NiC.js} +1 -1
  71. package/dist/gateway/static/root/assets/{imports-page-BjEdZJxZ.js → imports-page-CBlaxUhl.js} +1 -1
  72. package/dist/gateway/static/root/assets/index-CHAVhyVb.js +11 -0
  73. package/dist/gateway/static/root/assets/index-CQABygtM.css +1 -0
  74. package/dist/gateway/static/root/assets/{install-connector-dialog-BsiyYQhx.js → install-connector-dialog-DxSv1wS2.js} +1 -1
  75. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CIthQ1lp.js → keyboard-shortcuts-settings-CnAV96nr.js} +1 -1
  76. package/dist/gateway/static/root/assets/{local-app-workbench-page-CSCIHvZV.js → local-app-workbench-page-D8oqDDAn.js} +1 -1
  77. package/dist/gateway/static/root/assets/{local-apps-page-EntiM0tz.js → local-apps-page-BI3Be5qo.js} +1 -1
  78. package/dist/gateway/static/root/assets/{local-session-drafts-XurtjR58.js → local-session-drafts-BIBHRkpM.js} +2 -2
  79. package/dist/gateway/static/root/assets/{locale-store-cg9cm2EL.js → locale-store-Dy1EByeG.js} +1 -1
  80. package/dist/gateway/static/root/assets/{logs-page-rmS9VSem.js → logs-page-CMW34T31.js} +1 -1
  81. package/dist/gateway/static/root/assets/{management-api-B6jVuJ6W.js → management-api-B5w5DdXH.js} +1 -1
  82. package/dist/gateway/static/root/assets/{management-settings-DdI9gs51.js → management-settings-DfcMIqbQ.js} +1 -1
  83. package/dist/gateway/static/root/assets/{markdown-view-D1zBWkfB.js → markdown-view-BlxIaCCQ.js} +1 -1
  84. package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-Bn49Ph1n.js → mcp-conversation-setup-page-CsTSmjmX.js} +1 -1
  85. package/dist/gateway/static/root/assets/{media-plugins-Cd6hAGDp.js → media-plugins-DGhWjPIU.js} +1 -1
  86. package/dist/gateway/static/root/assets/messages-BAnhwALN.js +3 -0
  87. package/dist/gateway/static/root/assets/{model-selector-CL6WT-jw.js → model-selector-C-CqPBao.js} +1 -1
  88. package/dist/gateway/static/root/assets/{models-hub-cache-s0FMNhq9.js → models-hub-cache-Bgh3Gfgl.js} +1 -1
  89. package/dist/gateway/static/root/assets/{note-detail-panel-C6s0WlNL.js → note-detail-panel-B1cq9sU2.js} +3 -3
  90. package/dist/gateway/static/root/assets/note-image-lightbox-CqK_uJ6Y.js +1 -0
  91. package/dist/gateway/static/root/assets/{notes-api-CR75RHd0.js → notes-api-CdXA-g9r.js} +1 -1
  92. package/dist/gateway/static/root/assets/{notes-page-CR7dNVDi.js → notes-page-Do0l5Ddr.js} +1 -1
  93. package/dist/gateway/static/root/assets/{oauth-api-CvPnQTlH.js → oauth-api-B560CHeD.js} +1 -1
  94. package/dist/gateway/static/root/assets/{oauth-provider-connect-Dk1NeeqD.js → oauth-provider-connect-D63M8Iv7.js} +1 -1
  95. package/dist/gateway/static/root/assets/{page-context-capture-button-BPtX67hZ.js → page-context-capture-button-Dibmspef.js} +1 -1
  96. package/dist/gateway/static/root/assets/{page-context-draft-Ckb8baxj.js → page-context-draft-Cr5GqS2D.js} +1 -1
  97. package/dist/gateway/static/root/assets/page-header-store-Bm8oxpFR.js +1 -0
  98. package/dist/gateway/static/root/assets/{personal-avatar-CZSnrSfc.js → personal-avatar-BMRVyTrE.js} +1 -1
  99. package/dist/gateway/static/root/assets/{personal-page-C89kLOIL.js → personal-page-DrYh0NPE.js} +1 -1
  100. package/dist/gateway/static/root/assets/{personal-profile-settings-DJRDcK2c.js → personal-profile-settings-HMQY9lz9.js} +1 -1
  101. package/dist/gateway/static/root/assets/{personal-settings-panel-C6p25Noq.js → personal-settings-panel-BppxtWBl.js} +1 -1
  102. package/dist/gateway/static/root/assets/{phone-dependencies-card-DKkFFpqi.js → phone-dependencies-card-flTci8mm.js} +1 -1
  103. package/dist/gateway/static/root/assets/{phone-model-connection-CRRHq4PQ.js → phone-model-connection-Vi_Swyv6.js} +1 -1
  104. package/dist/gateway/static/root/assets/{phone-model-picker-CN_I0-46.js → phone-model-picker-BOv3mb_F.js} +1 -1
  105. package/dist/gateway/static/root/assets/{phone-settings-page-CkdSOA7D.js → phone-settings-page-vD0bTcHj.js} +1 -1
  106. package/dist/gateway/static/root/assets/{phone-workspace-store-CC61pIuJ.js → phone-workspace-store-Ltrevdsx.js} +1 -1
  107. package/dist/gateway/static/root/assets/{plugin-details-dialog-Bqz4jT53.js → plugin-details-dialog-nSDw8sfo.js} +1 -1
  108. package/dist/gateway/static/root/assets/{preference-select-fields-DHeNbAvn.js → preference-select-fields-D1pZekPs.js} +1 -1
  109. package/dist/gateway/static/root/assets/{product-automation-feedback-BN2HTA9T.js → product-automation-feedback-D51I7Lg3.js} +1 -1
  110. package/dist/gateway/static/root/assets/{product-open-page-B-j4gpLD.js → product-open-page-BO8lUvw3.js} +1 -1
  111. package/dist/gateway/static/root/assets/{product-preview-content-EqrTk7kU.js → product-preview-content-CUaHxyiE.js} +1 -1
  112. package/dist/gateway/static/root/assets/{product-preview-modal-aurFBFq4.js → product-preview-modal-BUeyRD5W.js} +2 -2
  113. package/dist/gateway/static/root/assets/{project-detail-page-sHcdluTm.js → project-detail-page-D3k1NzXQ.js} +2 -2
  114. package/dist/gateway/static/root/assets/{project-understanding-HNK9lFVy.js → project-understanding-Cg8WbBNB.js} +1 -1
  115. package/dist/gateway/static/root/assets/{projects-page-CugSyKl5.js → projects-page-C6Pt6OdT.js} +1 -1
  116. package/dist/gateway/static/root/assets/{providers-api-DUntOOqr.js → providers-api-Nytkkop9.js} +1 -1
  117. package/dist/gateway/static/root/assets/{recording-upload-DIwP541B.js → recording-upload-CyZSl2DJ.js} +1 -1
  118. package/dist/gateway/static/root/assets/{registry-api-BTd_OgbD.js → registry-api-DuDIthjL.js} +1 -1
  119. package/dist/gateway/static/root/assets/{remote-access-hub-f5mIfsBF.js → remote-access-hub-DePwafOK.js} +1 -1
  120. package/dist/gateway/static/root/assets/{resource-unavailable-DtQ2rfu_.js → resource-unavailable-BRKhKJA0.js} +1 -1
  121. package/dist/gateway/static/root/assets/right-workspace-store-HPw7Gw0n.js +1 -0
  122. package/dist/gateway/static/root/assets/route-preload-CTuS4GFj.js +2 -0
  123. package/dist/gateway/static/root/assets/routine-panel-9UC3NU5V.js +2 -0
  124. package/dist/gateway/static/root/assets/{runtime-tools-api-C1iI8EPo.js → runtime-tools-api-Dd8a07eo.js} +1 -1
  125. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-0tdI1z0g.js → runtime-tools-settings-panel-CvHQoqHu.js} +1 -1
  126. package/dist/gateway/static/root/assets/{service-recommendation-list-DSIe-NRe.js → service-recommendation-list-8mVIWB38.js} +1 -1
  127. package/dist/gateway/static/root/assets/{session-api-CQlEq0MB.js → session-api-BFiIYodK.js} +1 -1
  128. package/dist/gateway/static/root/assets/{session-manager-C7RfUfqI.js → session-manager-D2LaQymu.js} +2 -2
  129. package/dist/gateway/static/root/assets/{sessions-page-DdS8U0RV.js → sessions-page-DQEq_VJS.js} +1 -1
  130. package/dist/gateway/static/root/assets/settings-advanced-gate-Cvx7DnU8.js +1 -0
  131. package/dist/gateway/static/root/assets/{settings-advanced-section-C6dPu5i1.js → settings-advanced-section-B-H1gYOs.js} +1 -1
  132. package/dist/gateway/static/root/assets/{settings-mode-store-BSiiowQa.js → settings-mode-store-YH60sibB.js} +1 -1
  133. package/dist/gateway/static/root/assets/{settings-page-C4CYw21O.js → settings-page-CGiZCF8z.js} +1 -1
  134. package/dist/gateway/static/root/assets/{settings-page-header-BSMu5Zq3.js → settings-page-header-DEZZ8D0S.js} +1 -1
  135. package/dist/gateway/static/root/assets/{settings-page-layout-B_vMffB1.js → settings-page-layout-De2j64Lo.js} +1 -1
  136. package/dist/gateway/static/root/assets/{setup-interaction-page-DKXfFdNt.js → setup-interaction-page-Dh6BPwv0.js} +1 -1
  137. package/dist/gateway/static/root/assets/{setup-status-panel-BbAZ9w77.js → setup-status-panel-DGAAczL-.js} +1 -1
  138. package/dist/gateway/static/root/assets/{share-link-dialog-ztX1WPXG.js → share-link-dialog-C1t_HB6f.js} +1 -1
  139. package/dist/gateway/static/root/assets/{share-preview-page-Ds2Ydfg6.js → share-preview-page-fV5USZb1.js} +1 -1
  140. package/dist/gateway/static/root/assets/{shares-api-CSZqeNL4.js → shares-api-Dm07CnXw.js} +1 -1
  141. package/dist/gateway/static/root/assets/{shares-settings-CX3TNAmI.js → shares-settings-sl40lqND.js} +1 -1
  142. package/dist/gateway/static/root/assets/{skill-api-CGzAQ-MX.js → skill-api-BV8oFqeE.js} +1 -1
  143. package/dist/gateway/static/root/assets/{skill-list-api-DfUsku-x.js → skill-list-api-1o_YRCu9.js} +1 -1
  144. package/dist/gateway/static/root/assets/{skill-reload-api-Y9qSMnBd.js → skill-reload-api-fGsO9Y86.js} +1 -1
  145. package/dist/gateway/static/root/assets/{skills-page-DnMN50Ot.js → skills-page-FTd0Z7Ey.js} +1 -1
  146. package/dist/gateway/static/root/assets/{system-settings-panel-DWNkQmme.js → system-settings-panel-CUI6QHEP.js} +1 -1
  147. package/dist/gateway/static/root/assets/{task-detail-page-DBnkT1Nj.js → task-detail-page-CWwwumsy.js} +3 -3
  148. package/dist/gateway/static/root/assets/task-result-evidence-CSJeB9AH.js +1 -0
  149. package/dist/gateway/static/root/assets/{terminal-panel-store-D8eZPvql.js → terminal-panel-store-Du53Upr2.js} +1 -1
  150. package/dist/gateway/static/root/assets/{theme-store-GZQ3pTgy.js → theme-store-BaWep_o7.js} +1 -1
  151. package/dist/gateway/static/root/assets/{tracing-settings-page-DM3-7Hlw.js → tracing-settings-page-CnciBMVH.js} +1 -1
  152. package/dist/gateway/static/root/assets/{tunnel-api-DOGAIXRR.js → tunnel-api-Iz7JCBt3.js} +1 -1
  153. package/dist/gateway/static/root/assets/{understanding-activity-store-CuPfe0eQ.js → understanding-activity-store-BFc8PamJ.js} +1 -1
  154. package/dist/gateway/static/root/assets/{understanding-refresh-store-CIpGYSl0.js → understanding-refresh-store-CdEfR40A.js} +1 -1
  155. package/dist/gateway/static/root/assets/{usage-page-BA9Yrvqu.js → usage-page-DL2fmeOh.js} +1 -1
  156. package/dist/gateway/static/root/assets/{use-autosave-CO0IPCVg.js → use-autosave-N_SjHXTw.js} +1 -1
  157. package/dist/gateway/static/root/assets/use-composer-attachments-CO7XLI4x.js +2 -0
  158. package/dist/gateway/static/root/assets/{use-file-preview-expanded-dhNMHf5b.js → use-file-preview-expanded-BXXeXnT0.js} +3 -3
  159. package/dist/gateway/static/root/assets/{use-personal-profile-CVqDWBDS.js → use-personal-profile-C1vqD9yV.js} +1 -1
  160. package/dist/gateway/static/root/assets/{use-realtime-voice-DDVVlX1R.js → use-realtime-voice-C7iWQuUv.js} +1 -1
  161. package/dist/gateway/static/root/assets/{use-workspace-tree-CZej8mhf.js → use-workspace-tree-D27u-eoX.js} +1 -1
  162. package/dist/gateway/static/root/assets/{user-model-page-Bbi2MpIS.js → user-model-page-D2FHjLi7.js} +1 -1
  163. package/dist/gateway/static/root/assets/{voice-api-key-field-DpwUDAvu.js → voice-api-key-field-B_GApUQP.js} +1 -1
  164. package/dist/gateway/static/root/assets/{voice-config-api-GIuXoHXw.js → voice-config-api-DhJ3l8fk.js} +1 -1
  165. package/dist/gateway/static/root/assets/{voice-input-shortcut-events-Cc30ZcFy.js → voice-input-shortcut-events-CEeFBhp3.js} +1 -1
  166. package/dist/gateway/static/root/assets/{voice-settings-DA3m5MT0.js → voice-settings-BiqJ0tlf.js} +1 -1
  167. package/dist/gateway/static/root/assets/{work-discovery-overlay-yGUkk1NV.js → work-discovery-overlay-BNZK4hQ4.js} +1 -1
  168. package/dist/gateway/static/root/assets/{work-discovery-page-RN6iuY-0.js → work-discovery-page-KwSPhukU.js} +1 -1
  169. package/dist/gateway/static/root/assets/{working-directory-picker-modal-CeXl9w6z.js → working-directory-picker-modal-BGZduAXV.js} +1 -1
  170. package/dist/gateway/static/root/assets/{workspace-api-B1Uirhxf.js → workspace-api-LghfbP5g.js} +2 -2
  171. package/dist/gateway/static/root/assets/workspace-editor-agent-store-DVPJcbuE.js +1 -0
  172. package/dist/gateway/static/root/assets/workspace-file-preview-dialog-NffP-UXC.js +1 -0
  173. package/dist/gateway/static/root/assets/{workspace-open-location-menu-DWGNOIE2.js → workspace-open-location-menu-CvZxU9de.js} +1 -1
  174. package/dist/gateway/static/root/assets/workspace-preview-store-Do31QQH5.js +1 -0
  175. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-x-XT4bKF.js → xopc-cloud-account-card-Q_jezTUy.js} +1 -1
  176. package/dist/gateway/static/root/index.html +90 -88
  177. package/dist/package.js +1 -1
  178. package/dist/packages/gateway-contract/src/automations.js +6 -0
  179. package/dist/packages/gateway-contract/src/capabilities.js +1 -1
  180. package/dist/packages/gateway-contract/src/home.js +3 -0
  181. package/dist/packages/gateway-contract/src/index.js +3 -1
  182. package/dist/packages/gateway-contract/src/observation.js +177 -0
  183. package/dist/packages/gateway-contract/src/session-input-command.js +5 -1
  184. package/dist/src/agent/agent-manager.js +1 -1
  185. package/dist/src/agent/background-review/run-background-review.js +1 -1
  186. package/dist/src/agent/client-error-format.js +1 -1
  187. package/dist/src/agent/embedded/execution-tool-policy.d.ts +1 -0
  188. package/dist/src/agent/embedded/execution-tool-policy.js +31 -5
  189. package/dist/src/agent/embedded/run-for-session.js +16 -8
  190. package/dist/src/agent/embedded/run-turn.js +65 -29
  191. package/dist/src/agent/embedded/types.d.ts +2 -0
  192. package/dist/src/agent/external-tools/cliProvider.js +2 -2
  193. package/dist/src/agent/external-tools/composio-provider.js +2 -2
  194. package/dist/src/agent/external-tools/endpoint-provider.js +3 -3
  195. package/dist/src/agent/fallback/reason.js +1 -1
  196. package/dist/src/agent/orchestration/llm-turn-retry.d.ts +5 -0
  197. package/dist/src/agent/orchestration/llm-turn-retry.js +17 -6
  198. package/dist/src/agent/service.js +1 -1
  199. package/dist/src/agent/skills/index.js +1 -1
  200. package/dist/src/agent/skills/managed-store.js +1 -1
  201. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  202. package/dist/src/agent/tools/personal-memory-tool.js +1 -1
  203. package/dist/src/agent/tools/personal-read-tool.js +1 -1
  204. package/dist/src/agent/tools/xopc-use-tool.js +2 -2
  205. package/dist/src/agent-catalog/capabilities.js +2 -2
  206. package/dist/src/agent-catalog/repository.js +1 -1
  207. package/dist/src/automations/api/routes.js +2 -2
  208. package/dist/src/automations/capabilities/drafts.js +1 -1
  209. package/dist/src/automations/capabilities/write.d.ts +10 -0
  210. package/dist/src/automations/capabilities/write.js +1 -1
  211. package/dist/src/automations/configuration-conversation.js +1 -1
  212. package/dist/src/automations/domain/types.d.ts +14 -0
  213. package/dist/src/automations/domain/validation.d.ts +20 -0
  214. package/dist/src/automations/domain/validation.js +6 -0
  215. package/dist/src/automations/draft/automation-draft-validator.d.ts +5 -0
  216. package/dist/src/automations/draft/automation-draft-validator.js +1 -0
  217. package/dist/src/automations/index.js +2 -2
  218. package/dist/src/automations/service/action-executor.d.ts +2 -0
  219. package/dist/src/automations/service/action-executor.js +18 -2
  220. package/dist/src/automations/service/index.js +2 -2
  221. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  222. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  223. package/dist/src/capabilities/runtime/product.js +1 -1
  224. package/dist/src/cli/commands/agents.js +1 -1
  225. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  226. package/dist/src/cli/commands/models.js +1 -1
  227. package/dist/src/cli/commands/onboard/model.js +1 -1
  228. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  229. package/dist/src/computer/endpoint-transport.js +1 -1
  230. package/dist/src/config/agent-profile.js +1 -1
  231. package/dist/src/execution-environments/local-worktree-manager.js +1 -1
  232. package/dist/src/extensions/agent-plugins/skill-catalog.js +1 -1
  233. package/dist/src/extensions/agent-plugins/validation.js +1 -1
  234. package/dist/src/gateway/agents-admin.js +2 -2
  235. package/dist/src/gateway/global-defaults-admin.js +1 -1
  236. package/dist/src/gateway/hono/routes/agents.js +1 -1
  237. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  238. package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
  239. package/dist/src/gateway/hono/routes/home.js +100 -2
  240. package/dist/src/gateway/hono/routes/local-app-run-streams.js +1 -1
  241. package/dist/src/gateway/hono/routes/notes.js +2 -2
  242. package/dist/src/gateway/hono/routes/phone-setup.js +1 -1
  243. package/dist/src/gateway/hono/routes/projects.js +2 -2
  244. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
  245. package/dist/src/gateway/hono/routes/tasks.js +2 -2
  246. package/dist/src/gateway/image-generation-setup.js +1 -1
  247. package/dist/src/gateway/security/gateway-scopes.js +1 -0
  248. package/dist/src/gateway/service.js +21 -4
  249. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  250. package/dist/src/home-intelligence/application-service.d.ts +1 -0
  251. package/dist/src/home-intelligence/application-service.js +1 -1
  252. package/dist/src/home-intelligence/generator.js +4 -0
  253. package/dist/src/home-intelligence/host.d.ts +157 -1
  254. package/dist/src/home-intelligence/host.js +198 -14
  255. package/dist/src/home-intelligence/observation.d.ts +41 -0
  256. package/dist/src/home-intelligence/observation.js +297 -0
  257. package/dist/src/home-intelligence/repository.d.ts +1 -1
  258. package/dist/src/home-intelligence/routines.d.ts +36 -0
  259. package/dist/src/home-intelligence/routines.js +444 -0
  260. package/dist/src/home-intelligence/snapshot.d.ts +14 -0
  261. package/dist/src/imports/importService.js +1 -1
  262. package/dist/src/local-apps/automation-proposals.d.ts +20 -0
  263. package/dist/src/local-apps/automation-proposals.js +1 -1
  264. package/dist/src/local-apps/capabilities/automation-policy.js +1 -1
  265. package/dist/src/local-apps/capabilities/delegate.js +3 -3
  266. package/dist/src/local-apps/p1-services.js +1 -1
  267. package/dist/src/local-apps/service.js +1 -1
  268. package/dist/src/personal-agent/proactivity/repository.d.ts +1 -1
  269. package/dist/src/personal-agent/service.js +1 -1
  270. package/dist/src/providers/model-catalog-persistence.js +1 -1
  271. package/dist/src/providers/model-response.js +1 -1
  272. package/dist/src/realtime/compact-run-event.js +9 -0
  273. package/dist/src/runtime-tools/archive.js +1 -1
  274. package/dist/src/storage/sqlite/schema.d.ts +2 -2
  275. package/dist/src/storage/sqlite/schema.js +7 -7
  276. package/dist/src/storage/sqlite/schema.sql +71 -0
  277. package/dist/src/storage/sqlite/session-input-control-repository.js +2 -0
  278. package/dist/src/storage/sqlite/upgrades/272_home_observation.sql +41 -0
  279. package/dist/src/storage/sqlite/upgrades/273_observation_routines.sql +30 -0
  280. package/dist/src/tasks/capabilities/read.js +2 -2
  281. package/dist/src/tasks/capabilities/write.js +1 -1
  282. package/dist/src/tasks/home-query-service.js +1 -0
  283. package/dist/src/tui/backends/embedded-backend.js +1 -1
  284. package/dist/src/voice/realtime/persona-context.js +1 -1
  285. package/package.json +1 -1
  286. package/dist/gateway/static/root/assets/automations-workspace-CWEDraTP.js +0 -9
  287. package/dist/gateway/static/root/assets/capabilities-kG175Q-7.js +0 -1
  288. package/dist/gateway/static/root/assets/chat-page-BjYumhaI.js +0 -71
  289. package/dist/gateway/static/root/assets/composer-payload-handoff-DBE1mvOS.js +0 -1
  290. package/dist/gateway/static/root/assets/file-preview-surface-z7_HV0WN.js +0 -1
  291. package/dist/gateway/static/root/assets/gateway-realtime-store-xB7Bq4Zs.js +0 -1
  292. package/dist/gateway/static/root/assets/home-page-i_PIrDCU.js +0 -3
  293. package/dist/gateway/static/root/assets/index-DBlVVXOA.js +0 -11
  294. package/dist/gateway/static/root/assets/index-DpkEeFEQ.css +0 -1
  295. package/dist/gateway/static/root/assets/messages-eQ2CYlpG.js +0 -3
  296. package/dist/gateway/static/root/assets/note-image-lightbox-DfK2KSgu.js +0 -1
  297. package/dist/gateway/static/root/assets/page-header-store-DU4NnGap.js +0 -1
  298. package/dist/gateway/static/root/assets/route-preload-DrfQJkmW.js +0 -2
  299. package/dist/gateway/static/root/assets/settings-advanced-gate-DnfH22f_.js +0 -1
  300. package/dist/gateway/static/root/assets/task-input-card-lCMSy6YY.js +0 -1
  301. package/dist/gateway/static/root/assets/use-composer-attachments-CLIrD0mm.js +0 -2
  302. package/dist/gateway/static/root/assets/workspace-editor-agent-store-Nos5ebMv.js +0 -1
  303. package/dist/gateway/static/root/assets/workspace-file-preview-dialog-D0h2yJ3v.js +0 -1
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{m as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as a,l as o,n as s,o as c}from"./locale-store-cg9cm2EL.js";import{t as l}from"./messages-eQ2CYlpG.js";import{n as u,r as d}from"./popover-select-CLsphyzA.js";import{t as f}from"./circle-alert-BEjgurr2.js";import{t as p}from"./secret-input-DsjfQmDn.js";import{t as m}from"./info-CDrmIZhb.js";import{t as h}from"./key-round-DWbpyU2U.js";import{t as g}from"./loader-circle-CifKLtgG.js";import{t as _}from"./network-BUQLY1BV.js";import{t as v}from"./refresh-cw-BRlGaq2w.js";import{t as y}from"./rotate-cw-LIg3Am9S.js";import{i as b,n as x,r as S,t as C}from"./gateway-restart-DKAweWmg.js";import{t as w}from"./shield-check-BU58siTV.js";import{t as T}from"./shield-B1sI_cxl.js";import{t as E}from"./sliders-horizontal-DqsYor6I.js";import{t as D}from"./triangle-alert-2JXFNNKU.js";import{t as O}from"./cn-0WouolD0.js";import{t as k}from"./skeleton-DzdOeGYz.js";import{i as A,o as j}from"./vendor-swr-CdRzEUwF.js";import{n as M,r as N}from"./gateway-config-swr-OGhON-s6.js";import{t as P}from"./button-Cc4hUNTt.js";import{n as F}from"./interaction-BdhHBbYa.js";import{s as I}from"./form-field-width-DJw_jULe.js";import{n as L}from"./is-masked-secret-DOkL5b_X.js";import{r as R}from"./secret-input-labels-B5Jl5HqK.js";import{a as z}from"./navigation-ByOzYT0t.js";import{t as B}from"./page-tabs-oeTY7z3_.js";import{r as ee}from"./settings-form-draft-Dy10ldo8.js";import{t as te}from"./confirm-dialog-DrA5mTQp.js";import{t as ne}from"./settings-mode-store-BSiiowQa.js";import{n as re}from"./settings-loading-skeleton-CAoOV17i.js";import{t as ie}from"./settings-advanced-section-C6dPu5i1.js";import{t as V}from"./number-input-El7Szeln.js";import{n as ae,t as oe}from"./settings-page-header-BSMu5Zq3.js";import{t as se}from"./settings-page-layout-B_vMffB1.js";import{n as ce,t as le}from"./settings-form-section-num14vSv.js";import{t as ue}from"./settings-advanced-gate-DnfH22f_.js";var H=e(t(),1),U=n(),W=18790,G={enabled:!0,maxAttempts:5,windowMs:9e5,blockDurationMs:3e5,exemptLoopback:!0};function K(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q(e){return L(e)}async function de(e){let t=await c(a(`/api/gateway/reveal-auth-secret/${encodeURIComponent(e)}`),{method:`POST`,body:`{}`});if(!t.ok||!t.payload)throw Error(t.error?.message??`Reveal failed`);return t.payload}function fe(e){return q(e)?``:e.trim()}function pe(e){return[...e].map(e=>e.trim()).sort()}function me(e){return JSON.stringify({outboundProxy:e.outboundProxy,bind:e.bind,customBindHost:e.customBindHost.trim(),port:e.port,auth:{mode:e.auth.mode,token:fe(e.auth.token),password:fe(e.auth.password),rateLimit:e.auth.rateLimit,trustedProxy:{userHeader:e.auth.trustedProxy.userHeader.trim(),requiredHeaders:pe(e.auth.trustedProxy.requiredHeaders),allowUsers:pe(e.auth.trustedProxy.allowUsers),allowLoopback:e.auth.trustedProxy.allowLoopback}},trustedProxies:pe(e.trustedProxies),allowRealIpFallback:e.allowRealIpFallback,dangerouslyAllowHostHeaderOriginFallback:e.dangerouslyAllowHostHeaderOriginFallback})}function he(e,t){return me(e)!==me(t)}async function ge(e){return(await c(a(`/api/gateway/cors-origin-candidates?port=${encodeURIComponent(String(e))}`))).payload?.candidates??[]}function J(e){return e===`none`||e===`token`||e===`password`||e===`trusted-proxy`?e:`token`}function _e(e){let t=K(e)?e:{};return{enabled:t.enabled!==!1,maxAttempts:typeof t.maxAttempts==`number`&&Number.isFinite(t.maxAttempts)?Math.max(1,Math.floor(t.maxAttempts)):G.maxAttempts,windowMs:typeof t.windowMs==`number`&&Number.isFinite(t.windowMs)&&t.windowMs>0?Math.floor(t.windowMs):G.windowMs,blockDurationMs:typeof t.blockDurationMs==`number`&&Number.isFinite(t.blockDurationMs)&&t.blockDurationMs>0?Math.floor(t.blockDurationMs):typeof t.lockoutMs==`number`&&Number.isFinite(t.lockoutMs)&&t.lockoutMs>0?Math.floor(t.lockoutMs):G.blockDurationMs,exemptLoopback:t.exemptLoopback!==!1}}function ve(e){let t=K(e)?e:{};return{userHeader:typeof t.userHeader==`string`?t.userHeader:``,requiredHeaders:Y(t.requiredHeaders,32),allowUsers:Y(t.allowUsers,128),allowLoopback:t.allowLoopback===!0}}function ye(e){return e===`auto`||e===`off`||e===`explicit`?e:`auto`}function Y(e,t=24){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.trim().length>0).map(e=>e.trim()).slice(0,t):[]}function be(e){return e===`auto`||e===`loopback`||e===`lan`||e===`tailnet`||e===`custom`?e:`loopback`}function xe(e){if(e.bind===`loopback`)return!1;if(e.bind===`lan`)return!0;if(e.bind===`custom`){let t=e.customBindHost.trim().toLowerCase();return!t||t!==`127.0.0.1`&&t!==`localhost`&&t!==`::1`}return!0}function Se(e){try{let t=new URL(e.trim());return[`http:`,`https:`].includes(t.protocol)&&!!t.hostname&&!t.username&&!t.password&&!t.search&&!t.hash&&(!t.pathname||t.pathname===`/`)}catch{return!1}}function Ce(e){let t=e.outboundProxy;if((t.mode===`custom`||t.url.trim())&&!Se(t.url))return`Use an HTTP or HTTPS proxy origin without credentials, path, query or fragment.`;let n=xe(e);return n&&e.auth.mode===`none`?`Network-accessible gateway requires authentication (token, password, or trusted-proxy).`:n&&e.auth.mode===`trusted-proxy`&&e.trustedProxies.length===0?`Trusted-proxy auth on a network bind requires at least one gateway.trustedProxies entry.`:e.auth.mode===`trusted-proxy`&&!e.auth.trustedProxy.userHeader.trim()?`Trusted-proxy auth requires gateway.auth.trustedProxy.userHeader.`:n&&e.corsOrigins.includes(`*`)?`CORS wildcard "*" is not allowed on network-accessible binds.`:e.bind===`custom`&&!e.customBindHost.trim()?`Custom bind mode requires a bind address.`:null}function we(e){let t=K(e)?e:{},n=K(t.gateway)?t.gateway:{},r=K(n.auth)?n.auth:{},i=K(n.security)?n.security:{},a=K(t.update)?t.update:{},o=K(a.auto)?a.auto:{},s=a.channel,c=s===`beta`||s===`dev`||s===`stable`?s:`stable`,l=Array.isArray(n.corsOrigins)?n.corsOrigins.filter(e=>typeof e==`string`&&e.trim().length>0):[],u=be(n.bind),d=typeof n.customBindHost==`string`&&n.customBindHost.trim()?n.customBindHost.trim():``,f=K(n.outboundProxy)?n.outboundProxy:{};return{outboundProxy:{mode:f.mode===`custom`||f.mode===`direct`?f.mode:`environment`,url:typeof f.url==`string`?f.url:``,noProxy:typeof f.noProxy==`string`?f.noProxy:``},bind:u,customBindHost:d,port:typeof n.port==`number`&&Number.isFinite(n.port)?Math.floor(n.port):W,auth:{mode:J(r.mode),token:typeof r.token==`string`?r.token:``,password:typeof r.password==`string`?r.password:``,rateLimit:_e(r.rateLimit),trustedProxy:ve(r.trustedProxy)},corsOrigins:l,trustedProxies:Y(n.trustedProxies,64),allowRealIpFallback:n.allowRealIpFallback===!0,dangerouslyAllowHostHeaderOriginFallback:n.dangerouslyAllowHostHeaderOriginFallback===!0,securityStrict:i.strict===!0,channelConnectDeferMode:ye(n.channelConnectDeferMode),channelConnectDeferIds:Y(n.channelConnectDeferIds),channelConnectDeferSkipIds:Y(n.channelConnectDeferSkipIds),updateChannel:c,updateCheckOnStart:a.checkOnStart!==!1,updateAutoEnabled:o.enabled===!0,updateAutoStableDelayHours:typeof o.stableDelayHours==`number`&&Number.isFinite(o.stableDelayHours)?Math.max(0,Math.floor(o.stableDelayHours)):6,updateAutoStableJitterHours:typeof o.stableJitterHours==`number`&&Number.isFinite(o.stableJitterHours)?Math.max(0,Math.floor(o.stableJitterHours)):12,updateAutoBetaCheckIntervalHours:typeof o.betaCheckIntervalHours==`number`&&Number.isFinite(o.betaCheckIntervalHours)?Math.max(.25,o.betaCheckIntervalHours):1}}function Te(e){let t={mode:e.auth.mode,rateLimit:e.auth.rateLimit};if(e.auth.mode===`token`){let n=e.auth.token.trim();n.length>0&&!q(n)&&(t.token=e.auth.token),t.password=null,t.trustedProxy=null}else if(e.auth.mode===`password`){let n=e.auth.password.trim();n.length>0&&!q(n)&&(t.password=e.auth.password),t.token=null,t.trustedProxy=null}else if(e.auth.mode===`trusted-proxy`){t.token=null,t.password=null;let n=e.auth.trustedProxy;t.trustedProxy={userHeader:n.userHeader.trim(),...n.requiredHeaders.length>0?{requiredHeaders:n.requiredHeaders}:{},...n.allowUsers.length>0?{allowUsers:n.allowUsers}:{},...n.allowLoopback?{allowLoopback:!0}:{}}}else t.token=null,t.password=null,t.trustedProxy=null;return t}async function Ee(e){let t=Ce(e);if(t)throw Error(t);await c(a(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{outboundProxy:e.outboundProxy,bind:e.bind,...e.bind===`custom`?{customBindHost:e.customBindHost.trim()}:{},port:e.port,auth:Te(e),corsOrigins:e.corsOrigins,trustedProxies:e.trustedProxies,allowRealIpFallback:e.allowRealIpFallback,dangerouslyAllowHostHeaderOriginFallback:e.dangerouslyAllowHostHeaderOriginFallback,security:{strict:e.securityStrict},channelConnectDeferMode:e.channelConnectDeferMode,channelConnectDeferIds:e.channelConnectDeferIds,channelConnectDeferSkipIds:e.channelConnectDeferSkipIds},update:{channel:e.updateChannel,checkOnStart:e.updateCheckOnStart,auto:{enabled:e.updateAutoEnabled,stableDelayHours:e.updateAutoStableDelayHours,stableJitterHours:e.updateAutoStableJitterHours,betaCheckIntervalHours:e.updateAutoBetaCheckIntervalHours}}})}),M()}var X=r();function De(e){let t=(0,U.c)(46),{value:n,onChange:r,g:i}=e,[a,o]=(0,H.useState)(!1),s;t[0]!==a||t[1]!==n.mode||t[2]!==n.url?(s=a&&n.mode===`custom`&&!Se(n.url),t[0]=a,t[1]=n.mode,t[2]=n.url,t[3]=s):s=t[3];let c=s,l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=O(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle`,I),t[4]=l):l=t[4];let f=l,p;t[5]===i.outboundProxyTitle?p=t[6]:(p=(0,X.jsx)(`h2`,{id:`outbound-proxy-title`,className:`text-sm font-semibold text-fg`,children:i.outboundProxyTitle}),t[5]=i.outboundProxyTitle,t[6]=p);let m;t[7]===i.outboundProxyHint?m=t[8]:(m=(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i.outboundProxyHint}),t[7]=i.outboundProxyHint,t[8]=m);let h;t[9]===i.outboundProxyMode?h=t[10]:(h=(0,X.jsx)(`label`,{htmlFor:`outbound-proxy-mode`,className:`block text-sm font-medium text-fg`,children:i.outboundProxyMode}),t[9]=i.outboundProxyMode,t[10]=h);let g;t[11]!==r||t[12]!==n?(g=e=>r({...n,mode:e.target.value}),t[11]=r,t[12]=n,t[13]=g):g=t[13];let _;t[14]===i.outboundProxyEnvironment?_=t[15]:(_=(0,X.jsx)(d,{value:`environment`,children:i.outboundProxyEnvironment}),t[14]=i.outboundProxyEnvironment,t[15]=_);let v;t[16]===i.outboundProxyCustom?v=t[17]:(v=(0,X.jsx)(d,{value:`custom`,children:i.outboundProxyCustom}),t[16]=i.outboundProxyCustom,t[17]=v);let y;t[18]===i.outboundProxyDirect?y=t[19]:(y=(0,X.jsx)(d,{value:`direct`,children:i.outboundProxyDirect}),t[18]=i.outboundProxyDirect,t[19]=y);let b;t[20]!==g||t[21]!==_||t[22]!==v||t[23]!==y||t[24]!==n.mode?(b=(0,X.jsxs)(u,{id:`outbound-proxy-mode`,value:n.mode,onChange:g,children:[_,v,y]}),t[20]=g,t[21]=_,t[22]=v,t[23]=y,t[24]=n.mode,t[25]=b):b=t[25];let x;t[26]!==b||t[27]!==h?(x=(0,X.jsxs)(`div`,{className:`space-y-1`,children:[h,b]}),t[26]=b,t[27]=h,t[28]=x):x=t[28];let S;t[29]!==i.outboundProxyInvalid||t[30]!==i.outboundProxyUrl||t[31]!==c||t[32]!==r||t[33]!==n?(S=n.mode===`custom`&&(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`label`,{htmlFor:`outbound-proxy-url`,className:`block text-sm font-medium text-fg`,children:i.outboundProxyUrl}),(0,X.jsx)(`input`,{id:`outbound-proxy-url`,className:f,value:n.url,placeholder:`http://127.0.0.1:7897`,autoComplete:`off`,spellCheck:!1,"aria-invalid":c,"aria-describedby":c?`outbound-proxy-error`:void 0,onChange:e=>r({...n,url:e.target.value}),onBlur:()=>o(!0)}),c&&(0,X.jsx)(`p`,{id:`outbound-proxy-error`,role:`alert`,className:`text-xs text-danger`,children:i.outboundProxyInvalid})]}),t[29]=i.outboundProxyInvalid,t[30]=i.outboundProxyUrl,t[31]=c,t[32]=r,t[33]=n,t[34]=S):S=t[34];let C;t[35]!==i.outboundProxyBypass||t[36]!==i.outboundProxyBypassHint||t[37]!==r||t[38]!==n?(C=n.mode!==`direct`&&(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`label`,{htmlFor:`outbound-proxy-bypass`,className:`block text-sm font-medium text-fg`,children:i.outboundProxyBypass}),(0,X.jsx)(`input`,{id:`outbound-proxy-bypass`,className:f,value:n.noProxy,placeholder:`.example.com,192.168.1.10`,autoComplete:`off`,spellCheck:!1,"aria-describedby":`outbound-proxy-bypass-hint`,onChange:e=>r({...n,noProxy:e.target.value})}),(0,X.jsx)(`p`,{id:`outbound-proxy-bypass-hint`,className:`text-xs text-fg-muted`,children:i.outboundProxyBypassHint})]}),t[35]=i.outboundProxyBypass,t[36]=i.outboundProxyBypassHint,t[37]=r,t[38]=n,t[39]=C):C=t[39];let w;return t[40]!==x||t[41]!==S||t[42]!==C||t[43]!==p||t[44]!==m?(w=(0,X.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-edge p-4`,"aria-labelledby":`outbound-proxy-title`,children:[p,m,x,S,C]}),t[40]=x,t[41]=S,t[42]=C,t[43]=p,t[44]=m,t[45]=w):w=t[45],w}var Oe={critical:3,warn:2,info:1};function ke(){return a(`/api/doctor?security=true`)}function Ae(e){return e.toSorted((e,t)=>Oe[t.severity]-Oe[e.severity]||e.checkId.localeCompare(t.checkId))}function je(e){let t=e?.checks?.find(e=>e.id===`security-audit`);if(!t)return{status:`skip`,message:`Security audit unavailable.`,hints:[],findings:[]};let n=Ae((t.findings??[]).filter(e=>typeof e.checkId==`string`&&(e.severity===`critical`||e.severity===`warn`||e.severity===`info`)&&typeof e.title==`string`&&typeof e.detail==`string`));return{status:t.status,message:t.message,hints:Array.isArray(t.hints)?t.hints.filter(e=>typeof e==`string`):[],findings:n}}async function Me(){return je(await c(ke()))}function Ne(e){let t=(0,U.c)(39),{enabled:n,refreshToken:r}=e,i=r===void 0?0:r,a=s(Fe),o;t[0]===a?o=t[1]:(o=l(a),t[0]=a,t[1]=o);let c=o.gatewaySettings,u;t[2]!==n||t[3]!==i?(u=n?[ke(),i]:null,t[2]=n,t[3]=i,t[4]=u):u=t[4];let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={revalidateOnFocus:!1},t[5]=d):d=t[5];let{data:f,error:p,isLoading:m,isValidating:h,mutate:_}=A(u,Pe,d),y=f??null,b=p instanceof Error?p.message:p?String(p):null,x=m||h,S;t[6]===_?S=t[7]:(S=()=>{_(),j(ke())},t[6]=_,t[7]=S);let C=S,T=!n||x,E;t[8]===x?E=t[9]:(E=x?(0,X.jsx)(g,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,X.jsx)(v,{className:`size-3.5`,"aria-hidden":!0}),t[8]=x,t[9]=E);let D;t[10]===c.securityAuditRefresh?D=t[11]:(D=(0,X.jsx)(`span`,{className:`ml-1.5`,children:c.securityAuditRefresh}),t[10]=c.securityAuditRefresh,t[11]=D);let O;t[12]!==C||t[13]!==T||t[14]!==E||t[15]!==D?(O=(0,X.jsxs)(P,{type:`button`,variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,disabled:T,onClick:C,children:[E,D]}),t[12]=C,t[13]=T,t[14]=E,t[15]=D,t[16]=O):O=t[16];let M;t[17]!==c.securityAuditSubtitle||t[18]!==c.securityAuditTitle||t[19]!==O?(M=(0,X.jsx)(ce,{icon:w,title:c.securityAuditTitle,subtitle:c.securityAuditSubtitle,trailing:O}),t[17]=c.securityAuditSubtitle,t[18]=c.securityAuditTitle,t[19]=O,t[20]=M):M=t[20];let N;t[21]===c.securityAuditSavedConfigHint?N=t[22]:(N=(0,X.jsx)(`p`,{className:`mb-4 text-xs text-fg-subtle`,children:c.securityAuditSavedConfigHint}),t[21]=c.securityAuditSavedConfigHint,t[22]=N);let F;t[23]!==b||t[24]!==c.securityAuditLoadError?(F=b?(0,X.jsxs)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,role:`alert`,children:[c.securityAuditLoadError,`: `,b]}):null,t[23]=b,t[24]=c.securityAuditLoadError,t[25]=F):F=t[25];let I;t[26]!==y||t[27]!==b||t[28]!==x?(I=!b&&x&&!y?(0,X.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,X.jsx)(k,{className:`h-11 w-full rounded-lg`}),(0,X.jsx)(k,{className:`h-10 w-full rounded-lg`})]}):null,t[26]=y,t[27]=b,t[28]=x,t[29]=I):I=t[29];let L;t[30]!==y||t[31]!==c?(L=y?(0,X.jsx)(Ie,{g:c,audit:y}):null,t[30]=y,t[31]=c,t[32]=L):L=t[32];let R;return t[33]!==M||t[34]!==N||t[35]!==F||t[36]!==I||t[37]!==L?(R=(0,X.jsxs)(le,{children:[M,N,F,I,L]}),t[33]=M,t[34]=N,t[35]=F,t[36]=I,t[37]=L,t[38]=R):R=t[38],R}function Pe(){return Me()}function Fe(e){return e.language}function Ie(e){let t=(0,U.c)(40),{g:n,audit:r}=e,i,a,o,s,c,l,u;t[0]!==r.findings||t[1]!==r.status||t[2]!==n?(a=Be(n,r.status,r.findings),u=`space-y-4`,c=O(`rounded-lg px-3 py-2.5 text-sm`,a.bannerClass),l=`status`,s=`flex items-start gap-2`,i=a.icon,o=O(`mt-0.5 size-4 shrink-0`,a.iconClass),t[0]=r.findings,t[1]=r.status,t[2]=n,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u):(i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9]);let d;t[10]!==i||t[11]!==o?(d=(0,X.jsx)(i,{className:o,"aria-hidden":!0}),t[10]=i,t[11]=o,t[12]=d):d=t[12];let f;t[13]===a.title?f=t[14]:(f=(0,X.jsx)(`p`,{className:`font-medium`,children:a.title}),t[13]=a.title,t[14]=f);let p;t[15]===r.message?p=t[16]:(p=(0,X.jsx)(`p`,{className:`mt-0.5 text-xs opacity-90`,children:r.message}),t[15]=r.message,t[16]=p);let m;t[17]!==f||t[18]!==p?(m=(0,X.jsxs)(`div`,{children:[f,p]}),t[17]=f,t[18]=p,t[19]=m):m=t[19];let h;t[20]!==s||t[21]!==d||t[22]!==m?(h=(0,X.jsxs)(`div`,{className:s,children:[d,m]}),t[20]=s,t[21]=d,t[22]=m,t[23]=h):h=t[23];let g;t[24]!==h||t[25]!==c||t[26]!==l?(g=(0,X.jsx)(`div`,{className:c,role:l,children:h}),t[24]=h,t[25]=c,t[26]=l,t[27]=g):g=t[27];let _;t[28]!==r.findings||t[29]!==r.status||t[30]!==n?(_=r.findings.length>0?(0,X.jsx)(`ul`,{className:`space-y-2`,children:r.findings.map(e=>(0,X.jsx)(Re,{g:n,finding:e},e.checkId))}):r.status===`pass`||r.status===`skip`?(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.securityAuditNoFindings}):null,t[28]=r.findings,t[29]=r.status,t[30]=n,t[31]=_):_=t[31];let v;t[32]!==r.hints||t[33]!==n?(v=r.hints.length>0?(0,X.jsxs)(`div`,{className:`space-y-1 rounded-lg bg-surface-panel/50 px-3 py-2.5`,children:[(0,X.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:n.securityAuditHintsTitle}),(0,X.jsx)(`ul`,{className:`space-y-1 text-xs text-fg-subtle`,children:r.hints.map(Le)})]}):null,t[32]=r.hints,t[33]=n,t[34]=v):v=t[34];let y;return t[35]!==g||t[36]!==_||t[37]!==v||t[38]!==u?(y=(0,X.jsxs)(`div`,{className:u,children:[g,_,v]}),t[35]=g,t[36]=_,t[37]=v,t[38]=u,t[39]=y):y=t[39],y}function Le(e){return(0,X.jsx)(`li`,{className:`font-mono`,children:e},e)}function Re(e){let t=(0,U.c)(31),{g:n,finding:r}=e,i,a,o,s;if(t[0]!==r.severity){let e=ze(r.severity);s=`rounded-lg bg-surface-panel/70 px-3 py-2.5 shadow-surface`,o=`flex items-start gap-2`,i=e.icon,a=O(`mt-0.5 size-4 shrink-0`,e.iconClass),t[0]=r.severity,t[1]=i,t[2]=a,t[3]=o,t[4]=s}else i=t[1],a=t[2],o=t[3],s=t[4];let c;t[5]!==i||t[6]!==a?(c=(0,X.jsx)(i,{className:a,"aria-hidden":!0}),t[5]=i,t[6]=a,t[7]=c):c=t[7];let l;t[8]===r.title?l=t[9]:(l=(0,X.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:r.title}),t[8]=r.title,t[9]=l);let u;t[10]===r.checkId?u=t[11]:(u=(0,X.jsx)(`span`,{className:`font-mono text-[0.65rem] text-fg-subtle`,children:r.checkId}),t[10]=r.checkId,t[11]=u);let d;t[12]!==l||t[13]!==u?(d=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5`,children:[l,u]}),t[12]=l,t[13]=u,t[14]=d):d=t[14];let f;t[15]===r.detail?f=t[16]:(f=(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r.detail}),t[15]=r.detail,t[16]=f);let p;t[17]!==r.remediation||t[18]!==n?(p=r.remediation?(0,X.jsxs)(`p`,{className:`mt-1.5 text-xs text-fg-subtle`,children:[(0,X.jsx)(`span`,{className:`text-fg-muted`,children:n.securityAuditRemediation}),` `,r.remediation]}):null,t[17]=r.remediation,t[18]=n,t[19]=p):p=t[19];let m;t[20]!==d||t[21]!==f||t[22]!==p?(m=(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[d,f,p]}),t[20]=d,t[21]=f,t[22]=p,t[23]=m):m=t[23];let h;t[24]!==m||t[25]!==o||t[26]!==c?(h=(0,X.jsxs)(`div`,{className:o,children:[c,m]}),t[24]=m,t[25]=o,t[26]=c,t[27]=h):h=t[27];let g;return t[28]!==h||t[29]!==s?(g=(0,X.jsx)(`li`,{className:s,children:h}),t[28]=h,t[29]=s,t[30]=g):g=t[30],g}function ze(e){switch(e){case`critical`:return{icon:f,iconClass:`text-red-600 dark:text-red-400`};case`warn`:return{icon:D,iconClass:`text-amber-600 dark:text-amber-400`};default:return{icon:m,iconClass:`text-fg-muted`}}}function Be(e,t,n){let r=n.filter(e=>e.severity===`critical`).length,i=n.filter(e=>e.severity===`warn`).length;return t===`fail`||r>0?{icon:f,iconClass:`text-red-600 dark:text-red-400`,title:e.securityAuditStatusFail,bannerClass:`bg-red-50 text-red-950 dark:bg-red-950/40 dark:text-red-100`}:t===`warn`||i>0?{icon:D,iconClass:`text-amber-600 dark:text-amber-400`,title:e.securityAuditStatusWarn,bannerClass:`bg-amber-50 text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`}:t===`skip`?{icon:m,iconClass:`text-fg-muted`,title:e.securityAuditStatusSkip,bannerClass:`bg-surface-base/55 text-fg`}:{icon:w,iconClass:`text-emerald-600 dark:text-emerald-400`,title:e.securityAuditStatusPass,bannerClass:`bg-emerald-50 text-emerald-950 dark:bg-emerald-950/40 dark:text-emerald-100`}}var Ve=new Set([`security`,`advanced`]);function He(e,t){return t===`advanced`||!Ve.has(e)}function Ue(e,t){return e.filter(e=>He(e,t))}function We(){return`network`}function Ge(e,t){let n=(0,U.c)(5),r=ne(Ke),i,a;n[0]!==e||n[1]!==r||n[2]!==t?(i=()=>{He(e,r)||t(We())},a=[e,r,t],n[0]=e,n[1]=r,n[2]=t,n[3]=i,n[4]=a):(i=n[3],a=n[4]),(0,H.useEffect)(i,a)}function Ke(e){return e.mode}function Z(){return O(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,I,`dark:border-edge`)}var qe=[`network`,`access`,`updates`,`security`,`proxy`,`advanced`],Je={network:_,access:h,updates:v,security:T,proxy:b,advanced:E};function Ye(e){return e&&qe.includes(e)?e:`network`}function Xe(e,t){return t===`network`?e.tabNetwork:t===`access`?e.tabAccess:t===`updates`?e.tabUpdates:t===`security`?e.tabSecurity:t===`proxy`?e.outboundProxyTitle:e.tabAdvanced}function Ze(e,t){return t===`network`?e.networkTabHint:t===`access`?e.accessTabHint:t===`updates`?e.updatesTabHint:t===`security`?e.securitySectionHint:t===`proxy`?e.outboundProxyHint:e.advancedSectionHint}function Qe(e,t){switch(t.type){case`reset`:return{form:null,baseline:null,appliedBaseline:null};case`init-applied`:return{...e,appliedBaseline:structuredClone(t.value)};case`sync`:{let n=structuredClone(t.value);return{form:n,baseline:structuredClone(n),appliedBaseline:e.appliedBaseline}}case`set-form`:return e.form?{...e,form:t.updater(e.form)}:e;case`discard`:return e.baseline?{...e,form:structuredClone(e.baseline)}:e;case`saved`:{let n=structuredClone(t.value);return{form:n,baseline:structuredClone(n),appliedBaseline:e.appliedBaseline}}}}var $e={saving:!1,error:null,saveOk:!1,auditRefreshToken:0,restarting:!1,restartConfirmOpen:!1};function et(){let e=(0,U.c)(12),t=s(tt),n;e[0]===t?n=e[1]:(n=l(t),e[0]=t,e[1]=n);let r=n,i=t===`zh`?`选择聊天与工作数据所在的服务,管理连接和服务配置。`:`Choose where your chats and work live, and manage the connection and server settings.`,a;e[2]===t?a=e[3]:(a=z(t,`gateway`),e[2]=t,e[3]=a);let o;e[4]!==r.gatewaySettings.docsLink||e[5]!==i||e[6]!==a?(o=(0,X.jsx)(oe,{title:`Gateway`,subtitle:i,docsLink:a,docsLabel:r.gatewaySettings.docsLink}),e[4]=r.gatewaySettings.docsLink,e[5]=i,e[6]=a,e[7]=o):o=e[7];let c,u;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,X.jsx)(x,{}),u=(0,X.jsx)(nt,{}),e[8]=c,e[9]=u):(c=e[8],u=e[9]);let d;return e[10]===o?d=e[11]:(d=(0,X.jsxs)(ae,{gap:`gap-7`,children:[o,c,u]}),e[10]=o,e[11]=d),d}function tt(e){return e.language}function nt(){let e=o(e=>e.baseUrl),{data:t}=S(),n=t?.mode===`remote`,r=s(e=>e.language),a=l(r),c=a.gatewaySettings,[p,m]=i(),h=ne(e=>e.mode),_=h===`advanced`,v=Ye(p.get(`tab`)),b=(0,H.useMemo)(()=>Ue(qe,h),[h]),x=(0,H.useCallback)(e=>{m(t=>{let n=new URLSearchParams(t);return e===`network`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},[m]);Ge(v,x);let w=o(e=>e.conversationId),T=o(e=>e.tokenExpired),E=o(e=>e.openTokenDialog),D=!!w,[k,j]=(0,H.useReducer)(Qe,{form:null,baseline:null,appliedBaseline:null}),M=k.form,F=k.baseline,I=k.appliedBaseline,[L,z]=(0,H.useReducer)(ee,$e),{saving:B,error:ae,auditRefreshToken:se,restarting:ce,restartConfirmOpen:le}=L,U=(0,H.useRef)(!1),W=(0,H.useRef)(null),G=(0,H.useRef)(!1),{data:K,error:q,isLoading:fe,mutate:pe}=N(D),me=A(D&&M?[`gateway-cors-origin-candidates`,M.port]:null,([,e])=>ge(e),{revalidateOnFocus:!1}),J=(0,H.useMemo)(()=>K?.payload?.config===void 0?null:structuredClone(we(K.payload.config)),[K]);D?J!==null&&(G.current||(G.current=!0,j({type:`init-applied`,value:J})),!U.current&&W.current!==J&&(W.current=J,j({type:`sync`,value:J}),z({type:`patch`,patch:{saveOk:!1}}))):(W.current!==null||G.current)&&(W.current=null,G.current=!1,j({type:`reset`}),U.current=!1);let _e=!!(D&&fe&&K===void 0&&!q),ve=q instanceof Error?q.message:q?String(q):null,ye=(0,H.useMemo)(()=>!M||!F?!1:JSON.stringify(M)!==JSON.stringify(F),[M,F]),Y=(0,H.useMemo)(()=>!F||!I?!1:he(I,F),[I,F]),be=(0,H.useCallback)(e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,auth:{...t.auth,...e}})})},[]),xe=(0,H.useCallback)(e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,updateChannel:e})})},[]),Se=(0,H.useCallback)(e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,corsOrigins:e})})},[]),Te=(0,H.useCallback)(e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,bind:e})})},[]),Oe=(0,H.useCallback)(e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,customBindHost:e,bind:`custom`})})},[]),ke=(0,H.useCallback)(e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,port:e})})},[]),Ae=(0,H.useCallback)(e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,auth:{...t.auth,rateLimit:{...t.auth.rateLimit,...e}}})})},[]),je=(0,H.useCallback)(e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,channelConnectDeferMode:e})})},[]),Me=(0,H.useCallback)(e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,channelConnectDeferIds:e})})},[]),Pe=(0,H.useCallback)(e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,channelConnectDeferSkipIds:e})})},[]),Fe=(0,H.useCallback)(e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,trustedProxies:e})})},[]),Ie=(0,H.useCallback)(e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,auth:{...t.auth,trustedProxy:{...t.auth.trustedProxy,...e}}})})},[]),Le=(0,H.useCallback)(e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,securityStrict:e})})},[]),Re=(0,H.useCallback)(e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,allowRealIpFallback:e})})},[]),ze=(0,H.useCallback)(e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,dangerouslyAllowHostHeaderOriginFallback:e})})},[]),Be=(0,H.useCallback)(async()=>{if(!M||B)return;let e=Ce(M);if(e){z({type:`patch`,patch:{error:e}});return}z({type:`patch`,patch:{saving:!0,error:null,saveOk:!1}});try{await Ee(M),U.current=!1,j({type:`saved`,value:M}),z({type:`patch`,patch:{saveOk:!0,auditRefreshToken:se+1}})}catch(e){z({type:`patch`,patch:{error:e instanceof Error?e.message:c.saveError}})}finally{z({type:`patch`,patch:{saving:!1}})}},[M,B,c.saveError]),Ve=(0,H.useCallback)(()=>{F&&(U.current=!1,j({type:`discard`}),z({type:`patch`,patch:{error:null,saveOk:!1}}))},[F]),He=R(c),We=(0,H.useCallback)(async()=>{if(!ce){z({type:`patch`,patch:{restarting:!0,restartConfirmOpen:!1}});try{let e=await C();e.ok?window.dispatchEvent(new Event(`gateway-restart-initiated`)):z({type:`patch`,patch:{error:e.message||c.restartGatewayFailed}})}catch(e){z({type:`patch`,patch:{error:e instanceof Error?e.message:String(e)}})}finally{z({type:`patch`,patch:{restarting:!1}})}}},[ce,c.restartGatewayFailed]);return D?_e?(0,X.jsx)(`section`,{className:`space-y-5`,"aria-label":r===`zh`?`服务配置`:`Server configuration`,children:(0,X.jsx)(re,{sections:3})}):M?(0,X.jsxs)(`section`,{className:`space-y-5`,"aria-label":r===`zh`?`服务配置`:`Server configuration`,children:[(0,X.jsxs)(`div`,{className:`sticky top-0 z-10 flex flex-wrap items-start justify-between gap-3 border-t border-edge bg-surface-panel pb-3 pt-5`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:r===`zh`?`服务配置`:`Server configuration`}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:r===`zh`?n?`以下设置保存在远端 Gateway,适用于连接该服务的所有客户端。`:`以下设置保存在当前 Gateway,适用于连接该服务的所有客户端。`:`These settings are saved on the current Gateway and apply to every client connected to it.`})]}),ye?(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(P,{type:`button`,variant:`secondary`,disabled:B,onClick:Ve,children:c.discard}),(0,X.jsx)(P,{type:`button`,variant:`primary`,disabled:B,onClick:()=>void Be(),children:B?c.saving:r===`zh`?`保存服务配置`:`Save server settings`})]}):null]}),T?(0,X.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg bg-red-50 px-4 py-3 dark:bg-red-950/40`,role:`alert`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,X.jsx)(f,{className:`mt-0.5 size-4 shrink-0 text-red-600 dark:text-red-400`}),(0,X.jsx)(`p`,{className:`text-sm text-red-900 dark:text-red-100`,children:c.tokenExpired})]}),(0,X.jsx)(`div`,{children:(0,X.jsx)(P,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:()=>E(),children:c.updateToken})})]}):null,ae?(0,X.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:ae}):null,Y&&!n?(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg bg-amber-50 px-3 py-2 dark:bg-amber-950/40`,children:[(0,X.jsx)(`p`,{className:`text-xs text-amber-950 dark:text-amber-100`,children:c.restartHint}),(0,X.jsxs)(P,{type:`button`,variant:`secondary`,className:`shrink-0 gap-1.5 border-red-300 bg-red-50 text-xs text-red-700 hover:bg-red-100 dark:border-red-800 dark:bg-red-950/50 dark:text-red-300 dark:hover:bg-red-900/60`,disabled:ce,onClick:()=>z({type:`patch`,patch:{restartConfirmOpen:!0}}),children:[ce?(0,X.jsx)(g,{className:`size-3.5 animate-spin`}):(0,X.jsx)(y,{className:`size-3.5`}),c.restartGatewayButton]})]}):null,(0,X.jsx)(te,{open:le,title:c.restartGatewayButton,description:c.restartGatewayConfirm,confirmLabel:c.restartGatewayButton,cancelLabel:c.discard,destructive:!0,onConfirm:()=>void We(),onCancel:()=>z({type:`patch`,patch:{restartConfirmOpen:!1}})}),(0,X.jsx)(rt,{g:c,activeTab:v,visibleTabs:b,onChange:x}),(0,X.jsxs)(Q,{g:c,id:`network`,activeTab:v,children:[window.electronAPI?.gateway?.connection?null:(0,X.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-edge p-4`,children:[(0,X.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:r===`zh`?`服务地址`:`Server address`}),(0,X.jsx)(`p`,{className:`break-all text-sm text-fg-muted`,children:e}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsx)(P,{type:`button`,variant:`secondary`,onClick:()=>void pe(),children:c.retry}),(0,X.jsx)(P,{type:`button`,variant:`secondary`,onClick:()=>E(),children:c.updateToken})]})]}),(0,X.jsxs)(ie,{title:r===`zh`?`服务监听配置`:`Service listener configuration`,summary:`${M.bind} · ${M.port}`,children:[(0,X.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:`gateway-bind-mode`,children:c.bindMode}),(0,X.jsxs)(u,{id:`gateway-bind-mode`,className:Z(),value:M.bind,onChange:e=>Te(e.target.value),children:[(0,X.jsx)(d,{value:`loopback`,children:c.bindLoopback}),_?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(d,{value:`lan`,children:c.bindLan}),(0,X.jsx)(d,{value:`auto`,children:c.bindAuto}),(0,X.jsx)(d,{value:`custom`,children:c.bindCustom}),(0,X.jsx)(d,{value:`tailnet`,children:c.bindTailnet})]}):null]})]}),M.bind===`custom`?(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:`gateway-custom-bind-host`,children:c.customBindHost}),(0,X.jsx)(`input`,{id:`gateway-custom-bind-host`,className:O(Z(),`font-mono text-xs`),value:M.customBindHost,onChange:e=>Oe(e.target.value),placeholder:c.customBindHostPlaceholder,autoComplete:`off`})]}):null,(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:`gateway-listen-port`,children:c.listenPort}),(0,X.jsx)(V,{id:`gateway-listen-port`,type:`number`,min:1,max:65535,className:O(Z(),`font-mono text-xs`),value:M.port,onChange:e=>{let t=Number(e.target.value);ke(Number.isFinite(t)?Math.max(1,Math.min(65535,Math.floor(t))):M.port)}})]})]}),(0,X.jsx)(ue,{children:(0,X.jsx)(st,{g:c,origins:M.corsOrigins,candidates:me.data??[],onChange:Se})})]})]}),(0,X.jsxs)(Q,{g:c,id:`access`,activeTab:v,children:[M.auth.mode===`none`?(0,X.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:c.authModeNone}):null,(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`gateway-auth-mode`,children:c.authMode}),(0,X.jsxs)(u,{id:`gateway-auth-mode`,value:M.auth.mode,onChange:e=>be({mode:e.target.value}),className:Z(),children:[(0,X.jsx)(d,{value:`token`,children:c.authModeToken}),(0,X.jsx)(d,{value:`password`,children:c.authModePassword}),_||M.auth.mode===`trusted-proxy`||M.auth.mode===`none`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(d,{value:`trusted-proxy`,children:c.authModeTrustedProxy}),(0,X.jsx)(d,{value:`none`,children:c.authModeNoneLabel})]}):null]})]}),(0,X.jsx)(ue,{children:M.auth.mode===`trusted-proxy`?(0,X.jsx)(at,{g:c,form:M,onTrustedProxyChange:Ie,onTrustedProxiesChange:Fe,onAllowRealIpFallbackChange:Re}):null}),M.auth.mode===`token`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(dt,{id:`gateway-access-token`,label:c.accessToken,help:c.tokenHelp,placeholder:c.tokenPlaceholder,value:M.auth.token,labels:He,reveal:()=>de(`token`).then(e=>e.secret),loadFailedLabel:c.saveError,onChange:e=>be({token:e})}),(0,X.jsx)(P,{type:`button`,variant:`secondary`,className:`w-full sm:w-auto`,onClick:()=>E(),children:c.changeToken})]}):null,M.auth.mode===`password`?(0,X.jsx)(dt,{id:`gateway-auth-password`,label:c.authPassword,help:c.authPasswordHelp,placeholder:c.authPasswordPlaceholder,value:M.auth.password,labels:He,reveal:()=>de(`password`).then(e=>e.secret),loadFailedLabel:c.saveError,onChange:e=>be({password:e})}):null,(0,X.jsx)(ue,{children:M.auth.mode===`none`?null:(0,X.jsx)(ut,{g:c,rateLimit:M.auth.rateLimit,onChange:Ae})})]}),(0,X.jsxs)(Q,{g:c,id:`updates`,activeTab:v,children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`gateway-update-channel`,children:c.updateChannel}),(0,X.jsxs)(u,{id:`gateway-update-channel`,value:M.updateChannel,onChange:e=>xe(e.target.value),className:Z(),children:[(0,X.jsx)(d,{value:`stable`,children:c.channelStable}),_||M.updateChannel===`beta`?(0,X.jsx)(d,{value:`beta`,children:c.channelBeta}):null,_||M.updateChannel===`dev`?(0,X.jsx)(d,{value:`dev`,children:c.channelDev}):null]})]}),(0,X.jsxs)(`div`,{className:`space-y-4 rounded-xl bg-surface-base/45 p-4`,children:[(0,X.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:c.updateAutoSection}),(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,X.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:M.updateCheckOnStart,onChange:e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,updateCheckOnStart:e.target.checked})})}}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`font-medium`,children:c.updateCheckOnStart}),(0,X.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:c.updateCheckOnStartHint})]})]}),(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,X.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:M.updateAutoEnabled,onChange:e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,updateAutoEnabled:e.target.checked})})}}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`font-medium`,children:c.updateAutoEnabled}),(0,X.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:c.updateAutoEnabledHint})]})]}),(0,X.jsx)(ue,{children:(0,X.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:`update-auto-stable-delay`,children:c.updateAutoStableDelayHours}),(0,X.jsx)(V,{id:`update-auto-stable-delay`,type:`number`,min:0,disabled:!M.updateAutoEnabled,className:Z(),value:M.updateAutoStableDelayHours,onChange:e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,updateAutoStableDelayHours:Math.max(0,Math.floor(Number(e.target.value)||0))})})}}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:c.updateAutoStableDelayHoursHint})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:`update-auto-stable-jitter`,children:c.updateAutoStableJitterHours}),(0,X.jsx)(V,{id:`update-auto-stable-jitter`,type:`number`,min:0,disabled:!M.updateAutoEnabled,className:Z(),value:M.updateAutoStableJitterHours,onChange:e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,updateAutoStableJitterHours:Math.max(0,Math.floor(Number(e.target.value)||0))})})}}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:c.updateAutoStableJitterHoursHint})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:`update-auto-beta-interval`,children:c.updateAutoBetaCheckIntervalHours}),(0,X.jsx)(V,{id:`update-auto-beta-interval`,type:`number`,min:.25,step:.25,disabled:!M.updateAutoEnabled,className:Z(),value:M.updateAutoBetaCheckIntervalHours,onChange:e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,updateAutoBetaCheckIntervalHours:Math.max(.25,Number(e.target.value)||1)})})}}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:c.updateAutoBetaCheckIntervalHoursHint})]})]})})]})]}),(0,X.jsxs)(Q,{g:c,id:`security`,activeTab:v,children:[(0,X.jsx)(Ne,{enabled:D,refreshToken:se}),(0,X.jsx)(it,{g:c,form:M,onSecurityStrictChange:Le,onDangerouslyAllowHostHeaderOriginFallbackChange:ze})]}),(0,X.jsx)(Q,{g:c,id:`proxy`,activeTab:v,children:(0,X.jsx)(De,{value:M.outboundProxy,g:c,onChange:e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,outboundProxy:e})})}})}),(0,X.jsx)(Q,{g:c,id:`advanced`,activeTab:v,children:(0,X.jsx)(ot,{g:c,form:M,onDeferModeChange:je,onDeferIdsChange:Me,onSkipIdsChange:Pe})})]}):(0,X.jsxs)(`section`,{className:`space-y-5`,"aria-label":r===`zh`?`服务配置`:`Server configuration`,children:[(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:ae??ve??c.loadError}),(0,X.jsx)(P,{type:`button`,variant:`secondary`,onClick:()=>void pe(),children:c.retry})]}):(0,X.jsxs)(`section`,{className:`space-y-5`,"aria-label":r===`zh`?`服务配置`:`Server configuration`,children:[(0,X.jsx)(oe,{title:a.settingsSections.gateway}),(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:c.needToken})]})}function rt(e){let t=(0,U.c)(10),{g:n,activeTab:r,visibleTabs:i,onChange:a}=e,o;if(t[0]!==n||t[1]!==i){let e;t[3]===n?e=t[4]:(e=e=>({id:e,label:Xe(n,e),icon:Je[e]}),t[3]=n,t[4]=e),o=i.map(e),t[0]=n,t[1]=i,t[2]=o}else o=t[2];let s=o,c;return t[5]!==r||t[6]!==n.tabsAriaLabel||t[7]!==s||t[8]!==a?(c=(0,X.jsx)(B,{items:s,activeTab:r,onChange:a,ariaLabel:n.tabsAriaLabel,tabIdPrefix:`gateway-settings-tab`,panelIdPrefix:`gateway-settings-panel`}),t[5]=r,t[6]=n.tabsAriaLabel,t[7]=s,t[8]=a,t[9]=c):c=t[9],c}function Q(e){let t=(0,U.c)(14),{g:n,id:r,activeTab:i,children:a}=e,o;t[0]!==n||t[1]!==r?(o=Xe(n,r),t[0]=n,t[1]=r,t[2]=o):o=t[2];let s;t[3]!==n||t[4]!==r?(s=Ze(n,r),t[3]=n,t[4]=r,t[5]=s):s=t[5];let c;t[6]===a?c=t[7]:(c=(0,X.jsx)(`div`,{className:`space-y-4`,children:a}),t[6]=a,t[7]=c);let l;return t[8]!==i||t[9]!==r||t[10]!==o||t[11]!==s||t[12]!==c?(l=(0,X.jsx)(se,{id:r,activeTab:i,tabIdPrefix:`gateway-settings-tab`,panelIdPrefix:`gateway-settings-panel`,title:o,hint:s,showHeading:!1,children:c}),t[8]=i,t[9]=r,t[10]=o,t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function it(e){let t=(0,U.c)(37),{g:n,form:r,onSecurityStrictChange:i,onDangerouslyAllowHostHeaderOriginFallbackChange:a}=e,o;t[0]===i?o=t[1]:(o=e=>i(e.target.checked),t[0]=i,t[1]=o);let s;t[2]!==r.securityStrict||t[3]!==o?(s=(0,X.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:r.securityStrict,onChange:o}),t[2]=r.securityStrict,t[3]=o,t[4]=s):s=t[4];let c;t[5]===n.securityStrict?c=t[6]:(c=(0,X.jsx)(`span`,{className:`font-medium`,children:n.securityStrict}),t[5]=n.securityStrict,t[6]=c);let l;t[7]===n.securityStrictHint?l=t[8]:(l=(0,X.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:n.securityStrictHint}),t[7]=n.securityStrictHint,t[8]=l);let u;t[9]!==c||t[10]!==l?(u=(0,X.jsxs)(`span`,{children:[c,l]}),t[9]=c,t[10]=l,t[11]=u):u=t[11];let d;t[12]!==s||t[13]!==u?(d=(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[s,u]}),t[12]=s,t[13]=u,t[14]=d):d=t[14];let f;t[15]===a?f=t[16]:(f=e=>a(e.target.checked),t[15]=a,t[16]=f);let p;t[17]!==r.dangerouslyAllowHostHeaderOriginFallback||t[18]!==f?(p=(0,X.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:r.dangerouslyAllowHostHeaderOriginFallback,onChange:f}),t[17]=r.dangerouslyAllowHostHeaderOriginFallback,t[18]=f,t[19]=p):p=t[19];let m;t[20]===n.dangerouslyAllowHostHeaderOriginFallback?m=t[21]:(m=(0,X.jsx)(`span`,{className:`font-medium`,children:n.dangerouslyAllowHostHeaderOriginFallback}),t[20]=n.dangerouslyAllowHostHeaderOriginFallback,t[21]=m);let h;t[22]===n.dangerouslyAllowHostHeaderOriginFallbackHint?h=t[23]:(h=(0,X.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:n.dangerouslyAllowHostHeaderOriginFallbackHint}),t[22]=n.dangerouslyAllowHostHeaderOriginFallbackHint,t[23]=h);let g;t[24]!==h||t[25]!==m?(g=(0,X.jsxs)(`span`,{children:[m,h]}),t[24]=h,t[25]=m,t[26]=g):g=t[26];let _;t[27]!==g||t[28]!==p?(_=(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[p,g]}),t[27]=g,t[28]=p,t[29]=_):_=t[29];let v;t[30]!==r.dangerouslyAllowHostHeaderOriginFallback||t[31]!==n.dangerouslyAllowHostHeaderOriginFallbackWarning?(v=r.dangerouslyAllowHostHeaderOriginFallback?(0,X.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:n.dangerouslyAllowHostHeaderOriginFallbackWarning}):null,t[30]=r.dangerouslyAllowHostHeaderOriginFallback,t[31]=n.dangerouslyAllowHostHeaderOriginFallbackWarning,t[32]=v):v=t[32];let y;return t[33]!==_||t[34]!==v||t[35]!==d?(y=(0,X.jsxs)(`div`,{className:`space-y-4`,children:[d,_,v]}),t[33]=_,t[34]=v,t[35]=d,t[36]=y):y=t[36],y}function at(e){let t=(0,U.c)(80),{g:n,form:r,onTrustedProxyChange:i,onTrustedProxiesChange:a,onAllowRealIpFallbackChange:o}=e,s=r.auth.trustedProxy,c;t[0]===n.authModeTrustedProxyHint?c=t[1]:(c=(0,X.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.authModeTrustedProxyHint}),t[0]=n.authModeTrustedProxyHint,t[1]=c);let l;t[2]===n.trustedProxyUserHeader?l=t[3]:(l=(0,X.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:`gateway-trusted-proxy-user-header`,children:n.trustedProxyUserHeader}),t[2]=n.trustedProxyUserHeader,t[3]=l);let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=O(Z(),`font-mono text-xs`),t[4]=u):u=t[4];let d;t[5]===i?d=t[6]:(d=e=>i({userHeader:e.target.value}),t[5]=i,t[6]=d);let f;t[7]!==n.trustedProxyUserHeaderPlaceholder||t[8]!==d||t[9]!==s.userHeader?(f=(0,X.jsx)(`input`,{id:`gateway-trusted-proxy-user-header`,className:u,value:s.userHeader,onChange:d,placeholder:n.trustedProxyUserHeaderPlaceholder,autoComplete:`off`}),t[7]=n.trustedProxyUserHeaderPlaceholder,t[8]=d,t[9]=s.userHeader,t[10]=f):f=t[10];let p;t[11]===n.trustedProxyUserHeaderHint?p=t[12]:(p=(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:n.trustedProxyUserHeaderHint}),t[11]=n.trustedProxyUserHeaderHint,t[12]=p);let m;t[13]!==l||t[14]!==f||t[15]!==p?(m=(0,X.jsxs)(`div`,{children:[l,f,p]}),t[13]=l,t[14]=f,t[15]=p,t[16]=m):m=t[16];let h;t[17]===i?h=t[18]:(h=e=>i({requiredHeaders:e}),t[17]=i,t[18]=h);let g;t[19]!==n.channelIdListEmpty||t[20]!==n.trustedProxyRequiredHeaders||t[21]!==n.trustedProxyRequiredHeadersHint||t[22]!==n.trustedProxyUserHeaderPlaceholder||t[23]!==h||t[24]!==s.requiredHeaders?(g=(0,X.jsx)($,{title:n.trustedProxyRequiredHeaders,hint:n.trustedProxyRequiredHeadersHint,emptyText:n.channelIdListEmpty,placeholder:n.trustedProxyUserHeaderPlaceholder,values:s.requiredHeaders,maxItems:32,onChange:h}),t[19]=n.channelIdListEmpty,t[20]=n.trustedProxyRequiredHeaders,t[21]=n.trustedProxyRequiredHeadersHint,t[22]=n.trustedProxyUserHeaderPlaceholder,t[23]=h,t[24]=s.requiredHeaders,t[25]=g):g=t[25];let _;t[26]===i?_=t[27]:(_=e=>i({allowUsers:e}),t[26]=i,t[27]=_);let v;t[28]!==n.channelIdListEmpty||t[29]!==n.trustedProxyAllowUsers||t[30]!==n.trustedProxyAllowUsersHint||t[31]!==n.trustedProxyUserHeaderPlaceholder||t[32]!==_||t[33]!==s.allowUsers?(v=(0,X.jsx)($,{title:n.trustedProxyAllowUsers,hint:n.trustedProxyAllowUsersHint,emptyText:n.channelIdListEmpty,placeholder:n.trustedProxyUserHeaderPlaceholder,values:s.allowUsers,maxItems:128,onChange:_}),t[28]=n.channelIdListEmpty,t[29]=n.trustedProxyAllowUsers,t[30]=n.trustedProxyAllowUsersHint,t[31]=n.trustedProxyUserHeaderPlaceholder,t[32]=_,t[33]=s.allowUsers,t[34]=v):v=t[34];let y;t[35]===i?y=t[36]:(y=e=>i({allowLoopback:e.target.checked}),t[35]=i,t[36]=y);let b;t[37]!==y||t[38]!==s.allowLoopback?(b=(0,X.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:s.allowLoopback,onChange:y}),t[37]=y,t[38]=s.allowLoopback,t[39]=b):b=t[39];let x;t[40]===n.trustedProxyAllowLoopback?x=t[41]:(x=(0,X.jsx)(`span`,{className:`font-medium`,children:n.trustedProxyAllowLoopback}),t[40]=n.trustedProxyAllowLoopback,t[41]=x);let S;t[42]===n.trustedProxyAllowLoopbackHint?S=t[43]:(S=(0,X.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:n.trustedProxyAllowLoopbackHint}),t[42]=n.trustedProxyAllowLoopbackHint,t[43]=S);let C;t[44]!==x||t[45]!==S?(C=(0,X.jsxs)(`span`,{children:[x,S]}),t[44]=x,t[45]=S,t[46]=C):C=t[46];let w;t[47]!==b||t[48]!==C?(w=(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[b,C]}),t[47]=b,t[48]=C,t[49]=w):w=t[49];let T;t[50]!==r.trustedProxies||t[51]!==n.trustedProxies||t[52]!==n.trustedProxiesEmpty||t[53]!==n.trustedProxiesHint||t[54]!==n.trustedProxiesPlaceholder||t[55]!==a?(T=(0,X.jsx)($,{title:n.trustedProxies,hint:n.trustedProxiesHint,emptyText:n.trustedProxiesEmpty,placeholder:n.trustedProxiesPlaceholder,values:r.trustedProxies,maxItems:64,onChange:a}),t[50]=r.trustedProxies,t[51]=n.trustedProxies,t[52]=n.trustedProxiesEmpty,t[53]=n.trustedProxiesHint,t[54]=n.trustedProxiesPlaceholder,t[55]=a,t[56]=T):T=t[56];let E;t[57]===o?E=t[58]:(E=e=>o(e.target.checked),t[57]=o,t[58]=E);let D;t[59]!==r.allowRealIpFallback||t[60]!==E?(D=(0,X.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:r.allowRealIpFallback,onChange:E}),t[59]=r.allowRealIpFallback,t[60]=E,t[61]=D):D=t[61];let k;t[62]===n.allowRealIpFallback?k=t[63]:(k=(0,X.jsx)(`span`,{className:`font-medium`,children:n.allowRealIpFallback}),t[62]=n.allowRealIpFallback,t[63]=k);let A;t[64]===n.allowRealIpFallbackHint?A=t[65]:(A=(0,X.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:n.allowRealIpFallbackHint}),t[64]=n.allowRealIpFallbackHint,t[65]=A);let j;t[66]!==k||t[67]!==A?(j=(0,X.jsxs)(`span`,{children:[k,A]}),t[66]=k,t[67]=A,t[68]=j):j=t[68];let M;t[69]!==D||t[70]!==j?(M=(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[D,j]}),t[69]=D,t[70]=j,t[71]=M):M=t[71];let N;return t[72]!==c||t[73]!==v||t[74]!==w||t[75]!==T||t[76]!==M||t[77]!==m||t[78]!==g?(N=(0,X.jsxs)(`div`,{className:`space-y-4 rounded-xl bg-surface-base/45 p-4`,children:[c,m,g,v,w,T,M]}),t[72]=c,t[73]=v,t[74]=w,t[75]=T,t[76]=M,t[77]=m,t[78]=g,t[79]=N):N=t[79],N}function ot(e){let t=(0,U.c)(43),{g:n,form:r,onDeferModeChange:i,onDeferIdsChange:a,onSkipIdsChange:o}=e,s;t[0]===n.channelConnectDeferMode?s=t[1]:(s=(0,X.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`gateway-channel-defer-mode`,children:n.channelConnectDeferMode}),t[0]=n.channelConnectDeferMode,t[1]=s);let c=r.channelConnectDeferMode,l;t[2]===i?l=t[3]:(l=e=>i(e.target.value),t[2]=i,t[3]=l);let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=Z(),t[4]=f):f=t[4];let p;t[5]===n.channelConnectDeferModeAuto?p=t[6]:(p=(0,X.jsx)(d,{value:`auto`,children:n.channelConnectDeferModeAuto}),t[5]=n.channelConnectDeferModeAuto,t[6]=p);let m;t[7]===n.channelConnectDeferModeOff?m=t[8]:(m=(0,X.jsx)(d,{value:`off`,children:n.channelConnectDeferModeOff}),t[7]=n.channelConnectDeferModeOff,t[8]=m);let h;t[9]===n.channelConnectDeferModeExplicit?h=t[10]:(h=(0,X.jsx)(d,{value:`explicit`,children:n.channelConnectDeferModeExplicit}),t[9]=n.channelConnectDeferModeExplicit,t[10]=h);let g;t[11]!==r.channelConnectDeferMode||t[12]!==l||t[13]!==p||t[14]!==m||t[15]!==h?(g=(0,X.jsxs)(u,{id:`gateway-channel-defer-mode`,value:c,onChange:l,className:f,children:[p,m,h]}),t[11]=r.channelConnectDeferMode,t[12]=l,t[13]=p,t[14]=m,t[15]=h,t[16]=g):g=t[16];let _;t[17]===n.channelConnectDeferModeHint?_=t[18]:(_=(0,X.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.channelConnectDeferModeHint}),t[17]=n.channelConnectDeferModeHint,t[18]=_);let v;t[19]!==s||t[20]!==g||t[21]!==_?(v=(0,X.jsxs)(`div`,{className:`space-y-2 rounded-xl bg-surface-base/45 p-4`,children:[s,g,_]}),t[19]=s,t[20]=g,t[21]=_,t[22]=v):v=t[22];let y;t[23]!==r.channelConnectDeferIds||t[24]!==r.channelConnectDeferMode||t[25]!==n.channelConnectDeferIds||t[26]!==n.channelConnectDeferIdsHint||t[27]!==n.channelIdListEmpty||t[28]!==n.channelIdListPlaceholder||t[29]!==a?(y=r.channelConnectDeferMode===`explicit`?(0,X.jsx)($,{title:n.channelConnectDeferIds,hint:n.channelConnectDeferIdsHint,emptyText:n.channelIdListEmpty,placeholder:n.channelIdListPlaceholder,values:r.channelConnectDeferIds,maxItems:24,onChange:a}):null,t[23]=r.channelConnectDeferIds,t[24]=r.channelConnectDeferMode,t[25]=n.channelConnectDeferIds,t[26]=n.channelConnectDeferIdsHint,t[27]=n.channelIdListEmpty,t[28]=n.channelIdListPlaceholder,t[29]=a,t[30]=y):y=t[30];let b;t[31]!==r.channelConnectDeferMode||t[32]!==r.channelConnectDeferSkipIds||t[33]!==n.channelConnectDeferSkipIds||t[34]!==n.channelConnectDeferSkipIdsHint||t[35]!==n.channelIdListEmpty||t[36]!==n.channelIdListPlaceholder||t[37]!==o?(b=r.channelConnectDeferMode===`off`?null:(0,X.jsx)($,{title:n.channelConnectDeferSkipIds,hint:n.channelConnectDeferSkipIdsHint,emptyText:n.channelIdListEmpty,placeholder:n.channelIdListPlaceholder,values:r.channelConnectDeferSkipIds,maxItems:24,onChange:o}),t[31]=r.channelConnectDeferMode,t[32]=r.channelConnectDeferSkipIds,t[33]=n.channelConnectDeferSkipIds,t[34]=n.channelConnectDeferSkipIdsHint,t[35]=n.channelIdListEmpty,t[36]=n.channelIdListPlaceholder,t[37]=o,t[38]=b):b=t[38];let x;return t[39]!==v||t[40]!==y||t[41]!==b?(x=(0,X.jsxs)(`div`,{className:`space-y-4`,children:[v,y,b]}),t[39]=v,t[40]=y,t[41]=b,t[42]=x):x=t[42],x}function $(e){let t=(0,U.c)(25),{title:n,hint:r,emptyText:i,placeholder:a,values:o,maxItems:s,onChange:c,children:l}=e,u;t[0]!==s||t[1]!==c||t[2]!==o?(u=e=>{let t=e.trim();!t||o.includes(t)||o.length>=s||c([...o,t])},t[0]=s,t[1]=c,t[2]=o,t[3]=u):u=t[3];let d=u,f;t[4]===n?f=t[5]:(f=(0,X.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n}),t[4]=n,t[5]=f);let p;t[6]===r?p=t[7]:(p=(0,X.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r}),t[6]=r,t[7]=p);let m;t[8]!==i||t[9]!==c||t[10]!==o?(m=o.length===0?(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i}):(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:o.map(e=>(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 font-mono text-xs text-fg`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:O(`text-fg-muted hover:text-fg`,F.press),"aria-label":`Remove ${e}`,onClick:()=>c(o.filter(t=>t!==e)),children:`×`})]},e))}),t[8]=i,t[9]=c,t[10]=o,t[11]=m):m=t[11];let h;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(h=O(Z(),`font-mono text-xs`),t[12]=h):h=t[12];let g=o.length>=s,_;t[13]===d?_=t[14]:(_=e=>{e.key===`Enter`&&(e.preventDefault(),d(e.target.value),e.target.value=``)},t[13]=d,t[14]=_);let v;t[15]!==a||t[16]!==g||t[17]!==_?(v=(0,X.jsx)(`input`,{className:h,placeholder:a,disabled:g,onKeyDown:_}),t[15]=a,t[16]=g,t[17]=_,t[18]=v):v=t[18];let y;return t[19]!==l||t[20]!==f||t[21]!==p||t[22]!==m||t[23]!==v?(y=(0,X.jsxs)(`div`,{className:`space-y-2 rounded-xl bg-surface-base/45 p-4`,children:[f,p,m,v,l]}),t[19]=l,t[20]=f,t[21]=p,t[22]=m,t[23]=v,t[24]=y):y=t[24],y}function st(e){let t=(0,U.c)(36),{g:n,origins:r,candidates:i,onChange:a}=e,o;t[0]===r?o=t[1]:(o=r.includes(`*`),t[0]=r,t[1]=o);let s=o,c,l,u,d,f,p,m,h,g;if(t[2]!==i||t[3]!==n.corsAddDetectedOrigins||t[4]!==n.corsDetectedOrigins||t[5]!==n.corsOrigins||t[6]!==n.corsOriginsEmpty||t[7]!==n.corsOriginsHint||t[8]!==n.corsOriginsPlaceholder||t[9]!==a||t[10]!==r){let e;t[20]===r?e=t[21]:(e=e=>!r.includes(e.url),t[20]=r,t[21]=e);let o=i.filter(e);c=$,l=n.corsOrigins,u=n.corsOriginsHint,d=n.corsOriginsEmpty,f=n.corsOriginsPlaceholder,p=r,m=128,h=a,g=o.length>0?(0,X.jsxs)(`div`,{className:`rounded-lg bg-surface-base/55 px-3 py-2`,children:[(0,X.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:n.corsDetectedOrigins}),(0,X.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:o.map(lt)}),(0,X.jsx)(P,{type:`button`,variant:`secondary`,className:`mt-2 text-xs`,onClick:()=>a([...r,...o.map(ct)]),children:n.corsAddDetectedOrigins})]}):null,t[2]=i,t[3]=n.corsAddDetectedOrigins,t[4]=n.corsDetectedOrigins,t[5]=n.corsOrigins,t[6]=n.corsOriginsEmpty,t[7]=n.corsOriginsHint,t[8]=n.corsOriginsPlaceholder,t[9]=a,t[10]=r,t[11]=c,t[12]=l,t[13]=u,t[14]=d,t[15]=f,t[16]=p,t[17]=m,t[18]=h,t[19]=g}else c=t[11],l=t[12],u=t[13],d=t[14],f=t[15],p=t[16],m=t[17],h=t[18],g=t[19];let _;t[22]!==n.corsOriginsWildcardWarning||t[23]!==s?(_=s?(0,X.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:n.corsOriginsWildcardWarning}):null,t[22]=n.corsOriginsWildcardWarning,t[23]=s,t[24]=_):_=t[24];let v;return t[25]!==c||t[26]!==_||t[27]!==l||t[28]!==u||t[29]!==d||t[30]!==f||t[31]!==p||t[32]!==m||t[33]!==h||t[34]!==g?(v=(0,X.jsxs)(c,{title:l,hint:u,emptyText:d,placeholder:f,values:p,maxItems:m,onChange:h,children:[g,_]}),t[25]=c,t[26]=_,t[27]=l,t[28]=u,t[29]=d,t[30]=f,t[31]=p,t[32]=m,t[33]=h,t[34]=g,t[35]=v):v=t[35],v}function ct(e){return e.url}function lt(e){return(0,X.jsxs)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-0.5 font-mono text-xs text-fg`,children:[e.url,` · `,e.interfaceName]},e.url)}function ut(e){let t=(0,U.c)(73),{g:n,rateLimit:r,onChange:i}=e,a;t[0]===n.rateLimitTitle?a=t[1]:(a=(0,X.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.rateLimitTitle}),t[0]=n.rateLimitTitle,t[1]=a);let o;t[2]===n.rateLimitHint?o=t[3]:(o=(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:n.rateLimitHint}),t[2]=n.rateLimitHint,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,X.jsxs)(`div`,{children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===i?c=t[8]:(c=e=>i({enabled:e.target.checked}),t[7]=i,t[8]=c);let l;t[9]!==r.enabled||t[10]!==c?(l=(0,X.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.enabled,onChange:c}),t[9]=r.enabled,t[10]=c,t[11]=l):l=t[11];let u;t[12]!==n.rateLimitEnabled||t[13]!==l?(u=(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[l,n.rateLimitEnabled]}),t[12]=n.rateLimitEnabled,t[13]=l,t[14]=u):u=t[14];let d=!r.enabled,f;t[15]===i?f=t[16]:(f=e=>i({exemptLoopback:e.target.checked}),t[15]=i,t[16]=f);let p;t[17]!==r.exemptLoopback||t[18]!==d||t[19]!==f?(p=(0,X.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.exemptLoopback,disabled:d,onChange:f}),t[17]=r.exemptLoopback,t[18]=d,t[19]=f,t[20]=p):p=t[20];let m;t[21]!==n.rateLimitExemptLoopback||t[22]!==p?(m=(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[p,n.rateLimitExemptLoopback]}),t[21]=n.rateLimitExemptLoopback,t[22]=p,t[23]=m):m=t[23];let h;t[24]===n.rateLimitMaxAttempts?h=t[25]:(h=(0,X.jsx)(`label`,{className:`mb-1 block text-xs font-medium text-fg-muted`,htmlFor:`gateway-rate-max`,children:n.rateLimitMaxAttempts}),t[24]=n.rateLimitMaxAttempts,t[25]=h);let g;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(g=Z(),t[26]=g):g=t[26];let _=!r.enabled,v;t[27]===i?v=t[28]:(v=e=>{let t=Number(e.target.value);Number.isFinite(t)&&i({maxAttempts:Math.max(1,Math.floor(t))})},t[27]=i,t[28]=v);let y;t[29]!==r.maxAttempts||t[30]!==_||t[31]!==v?(y=(0,X.jsx)(V,{id:`gateway-rate-max`,type:`number`,min:1,className:g,value:r.maxAttempts,disabled:_,onChange:v}),t[29]=r.maxAttempts,t[30]=_,t[31]=v,t[32]=y):y=t[32];let b;t[33]!==h||t[34]!==y?(b=(0,X.jsxs)(`div`,{children:[h,y]}),t[33]=h,t[34]=y,t[35]=b):b=t[35];let x;t[36]===n.rateLimitWindowMinutes?x=t[37]:(x=(0,X.jsx)(`label`,{className:`mb-1 block text-xs font-medium text-fg-muted`,htmlFor:`gateway-rate-window`,children:n.rateLimitWindowMinutes}),t[36]=n.rateLimitWindowMinutes,t[37]=x);let S;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(S=Z(),t[38]=S):S=t[38];let C;t[39]===r.windowMs?C=t[40]:(C=Math.round(r.windowMs/6e4),t[39]=r.windowMs,t[40]=C);let w=!r.enabled,T;t[41]===i?T=t[42]:(T=e=>{let t=Number(e.target.value);Number.isFinite(t)&&t>0&&i({windowMs:Math.floor(t)*6e4})},t[41]=i,t[42]=T);let E;t[43]!==C||t[44]!==w||t[45]!==T?(E=(0,X.jsx)(V,{id:`gateway-rate-window`,type:`number`,min:1,className:S,value:C,disabled:w,onChange:T}),t[43]=C,t[44]=w,t[45]=T,t[46]=E):E=t[46];let D;t[47]!==x||t[48]!==E?(D=(0,X.jsxs)(`div`,{children:[x,E]}),t[47]=x,t[48]=E,t[49]=D):D=t[49];let O;t[50]===n.rateLimitBlockMinutes?O=t[51]:(O=(0,X.jsx)(`label`,{className:`mb-1 block text-xs font-medium text-fg-muted`,htmlFor:`gateway-rate-block`,children:n.rateLimitBlockMinutes}),t[50]=n.rateLimitBlockMinutes,t[51]=O);let k;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(k=Z(),t[52]=k):k=t[52];let A;t[53]===r.blockDurationMs?A=t[54]:(A=Math.round(r.blockDurationMs/6e4),t[53]=r.blockDurationMs,t[54]=A);let j=!r.enabled,M;t[55]===i?M=t[56]:(M=e=>{let t=Number(e.target.value);Number.isFinite(t)&&t>0&&i({blockDurationMs:Math.floor(t)*6e4})},t[55]=i,t[56]=M);let N;t[57]!==A||t[58]!==j||t[59]!==M?(N=(0,X.jsx)(V,{id:`gateway-rate-block`,type:`number`,min:1,className:k,value:A,disabled:j,onChange:M}),t[57]=A,t[58]=j,t[59]=M,t[60]=N):N=t[60];let P;t[61]!==O||t[62]!==N?(P=(0,X.jsxs)(`div`,{children:[O,N]}),t[61]=O,t[62]=N,t[63]=P):P=t[63];let F;t[64]!==b||t[65]!==D||t[66]!==P?(F=(0,X.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[b,D,P]}),t[64]=b,t[65]=D,t[66]=P,t[67]=F):F=t[67];let I;return t[68]!==m||t[69]!==s||t[70]!==F||t[71]!==u?(I=(0,X.jsxs)(`div`,{className:`space-y-3 rounded-xl bg-surface-base/45 p-4`,children:[s,u,m,F]}),t[68]=m,t[69]=s,t[70]=F,t[71]=u,t[72]=I):I=t[72],I}function dt(e){let t=(0,U.c)(17),{id:n,label:r,help:i,placeholder:a,value:o,labels:s,reveal:c,loadFailedLabel:l,onChange:u}=e,d;t[0]!==n||t[1]!==r?(d=(0,X.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=d):d=t[2];let f;t[3]!==n||t[4]!==s||t[5]!==l||t[6]!==u||t[7]!==a||t[8]!==c||t[9]!==o?(f=(0,X.jsx)(p,{id:n,value:o,onChange:u,placeholder:a,labels:s,reveal:c,loadFailedLabel:l,inputClassName:`text-xs`}),t[3]=n,t[4]=s,t[5]=l,t[6]=u,t[7]=a,t[8]=c,t[9]=o,t[10]=f):f=t[10];let m;t[11]===i?m=t[12]:(m=(0,X.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:i}),t[11]=i,t[12]=m);let h;return t[13]!==d||t[14]!==f||t[15]!==m?(h=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[d,f,m]}),t[13]=d,t[14]=f,t[15]=m,t[16]=h):h=t[16],h}export{et as GatewaySettingsPanel};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{m as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as a,l as o,n as s,o as c}from"./locale-store-Dy1EByeG.js";import{t as l}from"./messages-BAnhwALN.js";import{n as u,r as d}from"./popover-select-CLsphyzA.js";import{t as f}from"./circle-alert-BEjgurr2.js";import{t as p}from"./secret-input-DsjfQmDn.js";import{t as m}from"./info-CDrmIZhb.js";import{t as h}from"./key-round-DWbpyU2U.js";import{t as g}from"./loader-circle-CifKLtgG.js";import{t as _}from"./network-BUQLY1BV.js";import{t as v}from"./refresh-cw-BRlGaq2w.js";import{t as y}from"./rotate-cw-LIg3Am9S.js";import{i as b,n as x,r as S,t as C}from"./gateway-restart-DTmlcJps.js";import{t as w}from"./shield-check-BU58siTV.js";import{t as T}from"./shield-B1sI_cxl.js";import{t as E}from"./sliders-horizontal-DqsYor6I.js";import{t as D}from"./triangle-alert-2JXFNNKU.js";import{t as O}from"./cn-0WouolD0.js";import{t as k}from"./skeleton-DzdOeGYz.js";import{i as A,o as j}from"./vendor-swr-CdRzEUwF.js";import{n as M,r as N}from"./gateway-config-swr-1Rk0LeEM.js";import{t as P}from"./button-Cc4hUNTt.js";import{n as F}from"./interaction-BdhHBbYa.js";import{s as I}from"./form-field-width-DJw_jULe.js";import{n as L}from"./is-masked-secret-DOkL5b_X.js";import{r as R}from"./secret-input-labels-B5Jl5HqK.js";import{a as z}from"./navigation-ByOzYT0t.js";import{t as B}from"./page-tabs-oeTY7z3_.js";import{r as ee}from"./settings-form-draft-Dy10ldo8.js";import{t as te}from"./confirm-dialog-DrA5mTQp.js";import{t as ne}from"./settings-mode-store-YH60sibB.js";import{n as re}from"./settings-loading-skeleton-CAoOV17i.js";import{t as ie}from"./settings-advanced-section-B-H1gYOs.js";import{t as V}from"./number-input-El7Szeln.js";import{n as ae,t as oe}from"./settings-page-header-DEZZ8D0S.js";import{t as se}from"./settings-page-layout-De2j64Lo.js";import{n as ce,t as le}from"./settings-form-section-num14vSv.js";import{t as ue}from"./settings-advanced-gate-Cvx7DnU8.js";var H=e(t(),1),U=n(),W=18790,G={enabled:!0,maxAttempts:5,windowMs:9e5,blockDurationMs:3e5,exemptLoopback:!0};function K(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q(e){return L(e)}async function de(e){let t=await c(a(`/api/gateway/reveal-auth-secret/${encodeURIComponent(e)}`),{method:`POST`,body:`{}`});if(!t.ok||!t.payload)throw Error(t.error?.message??`Reveal failed`);return t.payload}function fe(e){return q(e)?``:e.trim()}function pe(e){return[...e].map(e=>e.trim()).sort()}function me(e){return JSON.stringify({outboundProxy:e.outboundProxy,bind:e.bind,customBindHost:e.customBindHost.trim(),port:e.port,auth:{mode:e.auth.mode,token:fe(e.auth.token),password:fe(e.auth.password),rateLimit:e.auth.rateLimit,trustedProxy:{userHeader:e.auth.trustedProxy.userHeader.trim(),requiredHeaders:pe(e.auth.trustedProxy.requiredHeaders),allowUsers:pe(e.auth.trustedProxy.allowUsers),allowLoopback:e.auth.trustedProxy.allowLoopback}},trustedProxies:pe(e.trustedProxies),allowRealIpFallback:e.allowRealIpFallback,dangerouslyAllowHostHeaderOriginFallback:e.dangerouslyAllowHostHeaderOriginFallback})}function he(e,t){return me(e)!==me(t)}async function ge(e){return(await c(a(`/api/gateway/cors-origin-candidates?port=${encodeURIComponent(String(e))}`))).payload?.candidates??[]}function J(e){return e===`none`||e===`token`||e===`password`||e===`trusted-proxy`?e:`token`}function _e(e){let t=K(e)?e:{};return{enabled:t.enabled!==!1,maxAttempts:typeof t.maxAttempts==`number`&&Number.isFinite(t.maxAttempts)?Math.max(1,Math.floor(t.maxAttempts)):G.maxAttempts,windowMs:typeof t.windowMs==`number`&&Number.isFinite(t.windowMs)&&t.windowMs>0?Math.floor(t.windowMs):G.windowMs,blockDurationMs:typeof t.blockDurationMs==`number`&&Number.isFinite(t.blockDurationMs)&&t.blockDurationMs>0?Math.floor(t.blockDurationMs):typeof t.lockoutMs==`number`&&Number.isFinite(t.lockoutMs)&&t.lockoutMs>0?Math.floor(t.lockoutMs):G.blockDurationMs,exemptLoopback:t.exemptLoopback!==!1}}function ve(e){let t=K(e)?e:{};return{userHeader:typeof t.userHeader==`string`?t.userHeader:``,requiredHeaders:Y(t.requiredHeaders,32),allowUsers:Y(t.allowUsers,128),allowLoopback:t.allowLoopback===!0}}function ye(e){return e===`auto`||e===`off`||e===`explicit`?e:`auto`}function Y(e,t=24){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.trim().length>0).map(e=>e.trim()).slice(0,t):[]}function be(e){return e===`auto`||e===`loopback`||e===`lan`||e===`tailnet`||e===`custom`?e:`loopback`}function xe(e){if(e.bind===`loopback`)return!1;if(e.bind===`lan`)return!0;if(e.bind===`custom`){let t=e.customBindHost.trim().toLowerCase();return!t||t!==`127.0.0.1`&&t!==`localhost`&&t!==`::1`}return!0}function Se(e){try{let t=new URL(e.trim());return[`http:`,`https:`].includes(t.protocol)&&!!t.hostname&&!t.username&&!t.password&&!t.search&&!t.hash&&(!t.pathname||t.pathname===`/`)}catch{return!1}}function Ce(e){let t=e.outboundProxy;if((t.mode===`custom`||t.url.trim())&&!Se(t.url))return`Use an HTTP or HTTPS proxy origin without credentials, path, query or fragment.`;let n=xe(e);return n&&e.auth.mode===`none`?`Network-accessible gateway requires authentication (token, password, or trusted-proxy).`:n&&e.auth.mode===`trusted-proxy`&&e.trustedProxies.length===0?`Trusted-proxy auth on a network bind requires at least one gateway.trustedProxies entry.`:e.auth.mode===`trusted-proxy`&&!e.auth.trustedProxy.userHeader.trim()?`Trusted-proxy auth requires gateway.auth.trustedProxy.userHeader.`:n&&e.corsOrigins.includes(`*`)?`CORS wildcard "*" is not allowed on network-accessible binds.`:e.bind===`custom`&&!e.customBindHost.trim()?`Custom bind mode requires a bind address.`:null}function we(e){let t=K(e)?e:{},n=K(t.gateway)?t.gateway:{},r=K(n.auth)?n.auth:{},i=K(n.security)?n.security:{},a=K(t.update)?t.update:{},o=K(a.auto)?a.auto:{},s=a.channel,c=s===`beta`||s===`dev`||s===`stable`?s:`stable`,l=Array.isArray(n.corsOrigins)?n.corsOrigins.filter(e=>typeof e==`string`&&e.trim().length>0):[],u=be(n.bind),d=typeof n.customBindHost==`string`&&n.customBindHost.trim()?n.customBindHost.trim():``,f=K(n.outboundProxy)?n.outboundProxy:{};return{outboundProxy:{mode:f.mode===`custom`||f.mode===`direct`?f.mode:`environment`,url:typeof f.url==`string`?f.url:``,noProxy:typeof f.noProxy==`string`?f.noProxy:``},bind:u,customBindHost:d,port:typeof n.port==`number`&&Number.isFinite(n.port)?Math.floor(n.port):W,auth:{mode:J(r.mode),token:typeof r.token==`string`?r.token:``,password:typeof r.password==`string`?r.password:``,rateLimit:_e(r.rateLimit),trustedProxy:ve(r.trustedProxy)},corsOrigins:l,trustedProxies:Y(n.trustedProxies,64),allowRealIpFallback:n.allowRealIpFallback===!0,dangerouslyAllowHostHeaderOriginFallback:n.dangerouslyAllowHostHeaderOriginFallback===!0,securityStrict:i.strict===!0,channelConnectDeferMode:ye(n.channelConnectDeferMode),channelConnectDeferIds:Y(n.channelConnectDeferIds),channelConnectDeferSkipIds:Y(n.channelConnectDeferSkipIds),updateChannel:c,updateCheckOnStart:a.checkOnStart!==!1,updateAutoEnabled:o.enabled===!0,updateAutoStableDelayHours:typeof o.stableDelayHours==`number`&&Number.isFinite(o.stableDelayHours)?Math.max(0,Math.floor(o.stableDelayHours)):6,updateAutoStableJitterHours:typeof o.stableJitterHours==`number`&&Number.isFinite(o.stableJitterHours)?Math.max(0,Math.floor(o.stableJitterHours)):12,updateAutoBetaCheckIntervalHours:typeof o.betaCheckIntervalHours==`number`&&Number.isFinite(o.betaCheckIntervalHours)?Math.max(.25,o.betaCheckIntervalHours):1}}function Te(e){let t={mode:e.auth.mode,rateLimit:e.auth.rateLimit};if(e.auth.mode===`token`){let n=e.auth.token.trim();n.length>0&&!q(n)&&(t.token=e.auth.token),t.password=null,t.trustedProxy=null}else if(e.auth.mode===`password`){let n=e.auth.password.trim();n.length>0&&!q(n)&&(t.password=e.auth.password),t.token=null,t.trustedProxy=null}else if(e.auth.mode===`trusted-proxy`){t.token=null,t.password=null;let n=e.auth.trustedProxy;t.trustedProxy={userHeader:n.userHeader.trim(),...n.requiredHeaders.length>0?{requiredHeaders:n.requiredHeaders}:{},...n.allowUsers.length>0?{allowUsers:n.allowUsers}:{},...n.allowLoopback?{allowLoopback:!0}:{}}}else t.token=null,t.password=null,t.trustedProxy=null;return t}async function Ee(e){let t=Ce(e);if(t)throw Error(t);await c(a(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{outboundProxy:e.outboundProxy,bind:e.bind,...e.bind===`custom`?{customBindHost:e.customBindHost.trim()}:{},port:e.port,auth:Te(e),corsOrigins:e.corsOrigins,trustedProxies:e.trustedProxies,allowRealIpFallback:e.allowRealIpFallback,dangerouslyAllowHostHeaderOriginFallback:e.dangerouslyAllowHostHeaderOriginFallback,security:{strict:e.securityStrict},channelConnectDeferMode:e.channelConnectDeferMode,channelConnectDeferIds:e.channelConnectDeferIds,channelConnectDeferSkipIds:e.channelConnectDeferSkipIds},update:{channel:e.updateChannel,checkOnStart:e.updateCheckOnStart,auto:{enabled:e.updateAutoEnabled,stableDelayHours:e.updateAutoStableDelayHours,stableJitterHours:e.updateAutoStableJitterHours,betaCheckIntervalHours:e.updateAutoBetaCheckIntervalHours}}})}),M()}var X=r();function De(e){let t=(0,U.c)(46),{value:n,onChange:r,g:i}=e,[a,o]=(0,H.useState)(!1),s;t[0]!==a||t[1]!==n.mode||t[2]!==n.url?(s=a&&n.mode===`custom`&&!Se(n.url),t[0]=a,t[1]=n.mode,t[2]=n.url,t[3]=s):s=t[3];let c=s,l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=O(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle`,I),t[4]=l):l=t[4];let f=l,p;t[5]===i.outboundProxyTitle?p=t[6]:(p=(0,X.jsx)(`h2`,{id:`outbound-proxy-title`,className:`text-sm font-semibold text-fg`,children:i.outboundProxyTitle}),t[5]=i.outboundProxyTitle,t[6]=p);let m;t[7]===i.outboundProxyHint?m=t[8]:(m=(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i.outboundProxyHint}),t[7]=i.outboundProxyHint,t[8]=m);let h;t[9]===i.outboundProxyMode?h=t[10]:(h=(0,X.jsx)(`label`,{htmlFor:`outbound-proxy-mode`,className:`block text-sm font-medium text-fg`,children:i.outboundProxyMode}),t[9]=i.outboundProxyMode,t[10]=h);let g;t[11]!==r||t[12]!==n?(g=e=>r({...n,mode:e.target.value}),t[11]=r,t[12]=n,t[13]=g):g=t[13];let _;t[14]===i.outboundProxyEnvironment?_=t[15]:(_=(0,X.jsx)(d,{value:`environment`,children:i.outboundProxyEnvironment}),t[14]=i.outboundProxyEnvironment,t[15]=_);let v;t[16]===i.outboundProxyCustom?v=t[17]:(v=(0,X.jsx)(d,{value:`custom`,children:i.outboundProxyCustom}),t[16]=i.outboundProxyCustom,t[17]=v);let y;t[18]===i.outboundProxyDirect?y=t[19]:(y=(0,X.jsx)(d,{value:`direct`,children:i.outboundProxyDirect}),t[18]=i.outboundProxyDirect,t[19]=y);let b;t[20]!==g||t[21]!==_||t[22]!==v||t[23]!==y||t[24]!==n.mode?(b=(0,X.jsxs)(u,{id:`outbound-proxy-mode`,value:n.mode,onChange:g,children:[_,v,y]}),t[20]=g,t[21]=_,t[22]=v,t[23]=y,t[24]=n.mode,t[25]=b):b=t[25];let x;t[26]!==b||t[27]!==h?(x=(0,X.jsxs)(`div`,{className:`space-y-1`,children:[h,b]}),t[26]=b,t[27]=h,t[28]=x):x=t[28];let S;t[29]!==i.outboundProxyInvalid||t[30]!==i.outboundProxyUrl||t[31]!==c||t[32]!==r||t[33]!==n?(S=n.mode===`custom`&&(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`label`,{htmlFor:`outbound-proxy-url`,className:`block text-sm font-medium text-fg`,children:i.outboundProxyUrl}),(0,X.jsx)(`input`,{id:`outbound-proxy-url`,className:f,value:n.url,placeholder:`http://127.0.0.1:7897`,autoComplete:`off`,spellCheck:!1,"aria-invalid":c,"aria-describedby":c?`outbound-proxy-error`:void 0,onChange:e=>r({...n,url:e.target.value}),onBlur:()=>o(!0)}),c&&(0,X.jsx)(`p`,{id:`outbound-proxy-error`,role:`alert`,className:`text-xs text-danger`,children:i.outboundProxyInvalid})]}),t[29]=i.outboundProxyInvalid,t[30]=i.outboundProxyUrl,t[31]=c,t[32]=r,t[33]=n,t[34]=S):S=t[34];let C;t[35]!==i.outboundProxyBypass||t[36]!==i.outboundProxyBypassHint||t[37]!==r||t[38]!==n?(C=n.mode!==`direct`&&(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`label`,{htmlFor:`outbound-proxy-bypass`,className:`block text-sm font-medium text-fg`,children:i.outboundProxyBypass}),(0,X.jsx)(`input`,{id:`outbound-proxy-bypass`,className:f,value:n.noProxy,placeholder:`.example.com,192.168.1.10`,autoComplete:`off`,spellCheck:!1,"aria-describedby":`outbound-proxy-bypass-hint`,onChange:e=>r({...n,noProxy:e.target.value})}),(0,X.jsx)(`p`,{id:`outbound-proxy-bypass-hint`,className:`text-xs text-fg-muted`,children:i.outboundProxyBypassHint})]}),t[35]=i.outboundProxyBypass,t[36]=i.outboundProxyBypassHint,t[37]=r,t[38]=n,t[39]=C):C=t[39];let w;return t[40]!==x||t[41]!==S||t[42]!==C||t[43]!==p||t[44]!==m?(w=(0,X.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-edge p-4`,"aria-labelledby":`outbound-proxy-title`,children:[p,m,x,S,C]}),t[40]=x,t[41]=S,t[42]=C,t[43]=p,t[44]=m,t[45]=w):w=t[45],w}var Oe={critical:3,warn:2,info:1};function ke(){return a(`/api/doctor?security=true`)}function Ae(e){return e.toSorted((e,t)=>Oe[t.severity]-Oe[e.severity]||e.checkId.localeCompare(t.checkId))}function je(e){let t=e?.checks?.find(e=>e.id===`security-audit`);if(!t)return{status:`skip`,message:`Security audit unavailable.`,hints:[],findings:[]};let n=Ae((t.findings??[]).filter(e=>typeof e.checkId==`string`&&(e.severity===`critical`||e.severity===`warn`||e.severity===`info`)&&typeof e.title==`string`&&typeof e.detail==`string`));return{status:t.status,message:t.message,hints:Array.isArray(t.hints)?t.hints.filter(e=>typeof e==`string`):[],findings:n}}async function Me(){return je(await c(ke()))}function Ne(e){let t=(0,U.c)(39),{enabled:n,refreshToken:r}=e,i=r===void 0?0:r,a=s(Fe),o;t[0]===a?o=t[1]:(o=l(a),t[0]=a,t[1]=o);let c=o.gatewaySettings,u;t[2]!==n||t[3]!==i?(u=n?[ke(),i]:null,t[2]=n,t[3]=i,t[4]=u):u=t[4];let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={revalidateOnFocus:!1},t[5]=d):d=t[5];let{data:f,error:p,isLoading:m,isValidating:h,mutate:_}=A(u,Pe,d),y=f??null,b=p instanceof Error?p.message:p?String(p):null,x=m||h,S;t[6]===_?S=t[7]:(S=()=>{_(),j(ke())},t[6]=_,t[7]=S);let C=S,T=!n||x,E;t[8]===x?E=t[9]:(E=x?(0,X.jsx)(g,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,X.jsx)(v,{className:`size-3.5`,"aria-hidden":!0}),t[8]=x,t[9]=E);let D;t[10]===c.securityAuditRefresh?D=t[11]:(D=(0,X.jsx)(`span`,{className:`ml-1.5`,children:c.securityAuditRefresh}),t[10]=c.securityAuditRefresh,t[11]=D);let O;t[12]!==C||t[13]!==T||t[14]!==E||t[15]!==D?(O=(0,X.jsxs)(P,{type:`button`,variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,disabled:T,onClick:C,children:[E,D]}),t[12]=C,t[13]=T,t[14]=E,t[15]=D,t[16]=O):O=t[16];let M;t[17]!==c.securityAuditSubtitle||t[18]!==c.securityAuditTitle||t[19]!==O?(M=(0,X.jsx)(ce,{icon:w,title:c.securityAuditTitle,subtitle:c.securityAuditSubtitle,trailing:O}),t[17]=c.securityAuditSubtitle,t[18]=c.securityAuditTitle,t[19]=O,t[20]=M):M=t[20];let N;t[21]===c.securityAuditSavedConfigHint?N=t[22]:(N=(0,X.jsx)(`p`,{className:`mb-4 text-xs text-fg-subtle`,children:c.securityAuditSavedConfigHint}),t[21]=c.securityAuditSavedConfigHint,t[22]=N);let F;t[23]!==b||t[24]!==c.securityAuditLoadError?(F=b?(0,X.jsxs)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,role:`alert`,children:[c.securityAuditLoadError,`: `,b]}):null,t[23]=b,t[24]=c.securityAuditLoadError,t[25]=F):F=t[25];let I;t[26]!==y||t[27]!==b||t[28]!==x?(I=!b&&x&&!y?(0,X.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,X.jsx)(k,{className:`h-11 w-full rounded-lg`}),(0,X.jsx)(k,{className:`h-10 w-full rounded-lg`})]}):null,t[26]=y,t[27]=b,t[28]=x,t[29]=I):I=t[29];let L;t[30]!==y||t[31]!==c?(L=y?(0,X.jsx)(Ie,{g:c,audit:y}):null,t[30]=y,t[31]=c,t[32]=L):L=t[32];let R;return t[33]!==M||t[34]!==N||t[35]!==F||t[36]!==I||t[37]!==L?(R=(0,X.jsxs)(le,{children:[M,N,F,I,L]}),t[33]=M,t[34]=N,t[35]=F,t[36]=I,t[37]=L,t[38]=R):R=t[38],R}function Pe(){return Me()}function Fe(e){return e.language}function Ie(e){let t=(0,U.c)(40),{g:n,audit:r}=e,i,a,o,s,c,l,u;t[0]!==r.findings||t[1]!==r.status||t[2]!==n?(a=Be(n,r.status,r.findings),u=`space-y-4`,c=O(`rounded-lg px-3 py-2.5 text-sm`,a.bannerClass),l=`status`,s=`flex items-start gap-2`,i=a.icon,o=O(`mt-0.5 size-4 shrink-0`,a.iconClass),t[0]=r.findings,t[1]=r.status,t[2]=n,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u):(i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9]);let d;t[10]!==i||t[11]!==o?(d=(0,X.jsx)(i,{className:o,"aria-hidden":!0}),t[10]=i,t[11]=o,t[12]=d):d=t[12];let f;t[13]===a.title?f=t[14]:(f=(0,X.jsx)(`p`,{className:`font-medium`,children:a.title}),t[13]=a.title,t[14]=f);let p;t[15]===r.message?p=t[16]:(p=(0,X.jsx)(`p`,{className:`mt-0.5 text-xs opacity-90`,children:r.message}),t[15]=r.message,t[16]=p);let m;t[17]!==f||t[18]!==p?(m=(0,X.jsxs)(`div`,{children:[f,p]}),t[17]=f,t[18]=p,t[19]=m):m=t[19];let h;t[20]!==s||t[21]!==d||t[22]!==m?(h=(0,X.jsxs)(`div`,{className:s,children:[d,m]}),t[20]=s,t[21]=d,t[22]=m,t[23]=h):h=t[23];let g;t[24]!==h||t[25]!==c||t[26]!==l?(g=(0,X.jsx)(`div`,{className:c,role:l,children:h}),t[24]=h,t[25]=c,t[26]=l,t[27]=g):g=t[27];let _;t[28]!==r.findings||t[29]!==r.status||t[30]!==n?(_=r.findings.length>0?(0,X.jsx)(`ul`,{className:`space-y-2`,children:r.findings.map(e=>(0,X.jsx)(Re,{g:n,finding:e},e.checkId))}):r.status===`pass`||r.status===`skip`?(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.securityAuditNoFindings}):null,t[28]=r.findings,t[29]=r.status,t[30]=n,t[31]=_):_=t[31];let v;t[32]!==r.hints||t[33]!==n?(v=r.hints.length>0?(0,X.jsxs)(`div`,{className:`space-y-1 rounded-lg bg-surface-panel/50 px-3 py-2.5`,children:[(0,X.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:n.securityAuditHintsTitle}),(0,X.jsx)(`ul`,{className:`space-y-1 text-xs text-fg-subtle`,children:r.hints.map(Le)})]}):null,t[32]=r.hints,t[33]=n,t[34]=v):v=t[34];let y;return t[35]!==g||t[36]!==_||t[37]!==v||t[38]!==u?(y=(0,X.jsxs)(`div`,{className:u,children:[g,_,v]}),t[35]=g,t[36]=_,t[37]=v,t[38]=u,t[39]=y):y=t[39],y}function Le(e){return(0,X.jsx)(`li`,{className:`font-mono`,children:e},e)}function Re(e){let t=(0,U.c)(31),{g:n,finding:r}=e,i,a,o,s;if(t[0]!==r.severity){let e=ze(r.severity);s=`rounded-lg bg-surface-panel/70 px-3 py-2.5 shadow-surface`,o=`flex items-start gap-2`,i=e.icon,a=O(`mt-0.5 size-4 shrink-0`,e.iconClass),t[0]=r.severity,t[1]=i,t[2]=a,t[3]=o,t[4]=s}else i=t[1],a=t[2],o=t[3],s=t[4];let c;t[5]!==i||t[6]!==a?(c=(0,X.jsx)(i,{className:a,"aria-hidden":!0}),t[5]=i,t[6]=a,t[7]=c):c=t[7];let l;t[8]===r.title?l=t[9]:(l=(0,X.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:r.title}),t[8]=r.title,t[9]=l);let u;t[10]===r.checkId?u=t[11]:(u=(0,X.jsx)(`span`,{className:`font-mono text-[0.65rem] text-fg-subtle`,children:r.checkId}),t[10]=r.checkId,t[11]=u);let d;t[12]!==l||t[13]!==u?(d=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5`,children:[l,u]}),t[12]=l,t[13]=u,t[14]=d):d=t[14];let f;t[15]===r.detail?f=t[16]:(f=(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r.detail}),t[15]=r.detail,t[16]=f);let p;t[17]!==r.remediation||t[18]!==n?(p=r.remediation?(0,X.jsxs)(`p`,{className:`mt-1.5 text-xs text-fg-subtle`,children:[(0,X.jsx)(`span`,{className:`text-fg-muted`,children:n.securityAuditRemediation}),` `,r.remediation]}):null,t[17]=r.remediation,t[18]=n,t[19]=p):p=t[19];let m;t[20]!==d||t[21]!==f||t[22]!==p?(m=(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[d,f,p]}),t[20]=d,t[21]=f,t[22]=p,t[23]=m):m=t[23];let h;t[24]!==m||t[25]!==o||t[26]!==c?(h=(0,X.jsxs)(`div`,{className:o,children:[c,m]}),t[24]=m,t[25]=o,t[26]=c,t[27]=h):h=t[27];let g;return t[28]!==h||t[29]!==s?(g=(0,X.jsx)(`li`,{className:s,children:h}),t[28]=h,t[29]=s,t[30]=g):g=t[30],g}function ze(e){switch(e){case`critical`:return{icon:f,iconClass:`text-red-600 dark:text-red-400`};case`warn`:return{icon:D,iconClass:`text-amber-600 dark:text-amber-400`};default:return{icon:m,iconClass:`text-fg-muted`}}}function Be(e,t,n){let r=n.filter(e=>e.severity===`critical`).length,i=n.filter(e=>e.severity===`warn`).length;return t===`fail`||r>0?{icon:f,iconClass:`text-red-600 dark:text-red-400`,title:e.securityAuditStatusFail,bannerClass:`bg-red-50 text-red-950 dark:bg-red-950/40 dark:text-red-100`}:t===`warn`||i>0?{icon:D,iconClass:`text-amber-600 dark:text-amber-400`,title:e.securityAuditStatusWarn,bannerClass:`bg-amber-50 text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`}:t===`skip`?{icon:m,iconClass:`text-fg-muted`,title:e.securityAuditStatusSkip,bannerClass:`bg-surface-base/55 text-fg`}:{icon:w,iconClass:`text-emerald-600 dark:text-emerald-400`,title:e.securityAuditStatusPass,bannerClass:`bg-emerald-50 text-emerald-950 dark:bg-emerald-950/40 dark:text-emerald-100`}}var Ve=new Set([`security`,`advanced`]);function He(e,t){return t===`advanced`||!Ve.has(e)}function Ue(e,t){return e.filter(e=>He(e,t))}function We(){return`network`}function Ge(e,t){let n=(0,U.c)(5),r=ne(Ke),i,a;n[0]!==e||n[1]!==r||n[2]!==t?(i=()=>{He(e,r)||t(We())},a=[e,r,t],n[0]=e,n[1]=r,n[2]=t,n[3]=i,n[4]=a):(i=n[3],a=n[4]),(0,H.useEffect)(i,a)}function Ke(e){return e.mode}function Z(){return O(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,I,`dark:border-edge`)}var qe=[`network`,`access`,`updates`,`security`,`proxy`,`advanced`],Je={network:_,access:h,updates:v,security:T,proxy:b,advanced:E};function Ye(e){return e&&qe.includes(e)?e:`network`}function Xe(e,t){return t===`network`?e.tabNetwork:t===`access`?e.tabAccess:t===`updates`?e.tabUpdates:t===`security`?e.tabSecurity:t===`proxy`?e.outboundProxyTitle:e.tabAdvanced}function Ze(e,t){return t===`network`?e.networkTabHint:t===`access`?e.accessTabHint:t===`updates`?e.updatesTabHint:t===`security`?e.securitySectionHint:t===`proxy`?e.outboundProxyHint:e.advancedSectionHint}function Qe(e,t){switch(t.type){case`reset`:return{form:null,baseline:null,appliedBaseline:null};case`init-applied`:return{...e,appliedBaseline:structuredClone(t.value)};case`sync`:{let n=structuredClone(t.value);return{form:n,baseline:structuredClone(n),appliedBaseline:e.appliedBaseline}}case`set-form`:return e.form?{...e,form:t.updater(e.form)}:e;case`discard`:return e.baseline?{...e,form:structuredClone(e.baseline)}:e;case`saved`:{let n=structuredClone(t.value);return{form:n,baseline:structuredClone(n),appliedBaseline:e.appliedBaseline}}}}var $e={saving:!1,error:null,saveOk:!1,auditRefreshToken:0,restarting:!1,restartConfirmOpen:!1};function et(){let e=(0,U.c)(12),t=s(tt),n;e[0]===t?n=e[1]:(n=l(t),e[0]=t,e[1]=n);let r=n,i=t===`zh`?`选择聊天与工作数据所在的服务,管理连接和服务配置。`:`Choose where your chats and work live, and manage the connection and server settings.`,a;e[2]===t?a=e[3]:(a=z(t,`gateway`),e[2]=t,e[3]=a);let o;e[4]!==r.gatewaySettings.docsLink||e[5]!==i||e[6]!==a?(o=(0,X.jsx)(oe,{title:`Gateway`,subtitle:i,docsLink:a,docsLabel:r.gatewaySettings.docsLink}),e[4]=r.gatewaySettings.docsLink,e[5]=i,e[6]=a,e[7]=o):o=e[7];let c,u;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,X.jsx)(x,{}),u=(0,X.jsx)(nt,{}),e[8]=c,e[9]=u):(c=e[8],u=e[9]);let d;return e[10]===o?d=e[11]:(d=(0,X.jsxs)(ae,{gap:`gap-7`,children:[o,c,u]}),e[10]=o,e[11]=d),d}function tt(e){return e.language}function nt(){let e=o(e=>e.baseUrl),{data:t}=S(),n=t?.mode===`remote`,r=s(e=>e.language),a=l(r),c=a.gatewaySettings,[p,m]=i(),h=ne(e=>e.mode),_=h===`advanced`,v=Ye(p.get(`tab`)),b=(0,H.useMemo)(()=>Ue(qe,h),[h]),x=(0,H.useCallback)(e=>{m(t=>{let n=new URLSearchParams(t);return e===`network`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},[m]);Ge(v,x);let w=o(e=>e.conversationId),T=o(e=>e.tokenExpired),E=o(e=>e.openTokenDialog),D=!!w,[k,j]=(0,H.useReducer)(Qe,{form:null,baseline:null,appliedBaseline:null}),M=k.form,F=k.baseline,I=k.appliedBaseline,[L,z]=(0,H.useReducer)(ee,$e),{saving:B,error:ae,auditRefreshToken:se,restarting:ce,restartConfirmOpen:le}=L,U=(0,H.useRef)(!1),W=(0,H.useRef)(null),G=(0,H.useRef)(!1),{data:K,error:q,isLoading:fe,mutate:pe}=N(D),me=A(D&&M?[`gateway-cors-origin-candidates`,M.port]:null,([,e])=>ge(e),{revalidateOnFocus:!1}),J=(0,H.useMemo)(()=>K?.payload?.config===void 0?null:structuredClone(we(K.payload.config)),[K]);D?J!==null&&(G.current||(G.current=!0,j({type:`init-applied`,value:J})),!U.current&&W.current!==J&&(W.current=J,j({type:`sync`,value:J}),z({type:`patch`,patch:{saveOk:!1}}))):(W.current!==null||G.current)&&(W.current=null,G.current=!1,j({type:`reset`}),U.current=!1);let _e=!!(D&&fe&&K===void 0&&!q),ve=q instanceof Error?q.message:q?String(q):null,ye=(0,H.useMemo)(()=>!M||!F?!1:JSON.stringify(M)!==JSON.stringify(F),[M,F]),Y=(0,H.useMemo)(()=>!F||!I?!1:he(I,F),[I,F]),be=(0,H.useCallback)(e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,auth:{...t.auth,...e}})})},[]),xe=(0,H.useCallback)(e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,updateChannel:e})})},[]),Se=(0,H.useCallback)(e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,corsOrigins:e})})},[]),Te=(0,H.useCallback)(e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,bind:e})})},[]),Oe=(0,H.useCallback)(e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,customBindHost:e,bind:`custom`})})},[]),ke=(0,H.useCallback)(e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,port:e})})},[]),Ae=(0,H.useCallback)(e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,auth:{...t.auth,rateLimit:{...t.auth.rateLimit,...e}}})})},[]),je=(0,H.useCallback)(e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,channelConnectDeferMode:e})})},[]),Me=(0,H.useCallback)(e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,channelConnectDeferIds:e})})},[]),Pe=(0,H.useCallback)(e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,channelConnectDeferSkipIds:e})})},[]),Fe=(0,H.useCallback)(e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,trustedProxies:e})})},[]),Ie=(0,H.useCallback)(e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,auth:{...t.auth,trustedProxy:{...t.auth.trustedProxy,...e}}})})},[]),Le=(0,H.useCallback)(e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,securityStrict:e})})},[]),Re=(0,H.useCallback)(e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,allowRealIpFallback:e})})},[]),ze=(0,H.useCallback)(e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,dangerouslyAllowHostHeaderOriginFallback:e})})},[]),Be=(0,H.useCallback)(async()=>{if(!M||B)return;let e=Ce(M);if(e){z({type:`patch`,patch:{error:e}});return}z({type:`patch`,patch:{saving:!0,error:null,saveOk:!1}});try{await Ee(M),U.current=!1,j({type:`saved`,value:M}),z({type:`patch`,patch:{saveOk:!0,auditRefreshToken:se+1}})}catch(e){z({type:`patch`,patch:{error:e instanceof Error?e.message:c.saveError}})}finally{z({type:`patch`,patch:{saving:!1}})}},[M,B,c.saveError]),Ve=(0,H.useCallback)(()=>{F&&(U.current=!1,j({type:`discard`}),z({type:`patch`,patch:{error:null,saveOk:!1}}))},[F]),He=R(c),We=(0,H.useCallback)(async()=>{if(!ce){z({type:`patch`,patch:{restarting:!0,restartConfirmOpen:!1}});try{let e=await C();e.ok?window.dispatchEvent(new Event(`gateway-restart-initiated`)):z({type:`patch`,patch:{error:e.message||c.restartGatewayFailed}})}catch(e){z({type:`patch`,patch:{error:e instanceof Error?e.message:String(e)}})}finally{z({type:`patch`,patch:{restarting:!1}})}}},[ce,c.restartGatewayFailed]);return D?_e?(0,X.jsx)(`section`,{className:`space-y-5`,"aria-label":r===`zh`?`服务配置`:`Server configuration`,children:(0,X.jsx)(re,{sections:3})}):M?(0,X.jsxs)(`section`,{className:`space-y-5`,"aria-label":r===`zh`?`服务配置`:`Server configuration`,children:[(0,X.jsxs)(`div`,{className:`sticky top-0 z-10 flex flex-wrap items-start justify-between gap-3 border-t border-edge bg-surface-panel pb-3 pt-5`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:r===`zh`?`服务配置`:`Server configuration`}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:r===`zh`?n?`以下设置保存在远端 Gateway,适用于连接该服务的所有客户端。`:`以下设置保存在当前 Gateway,适用于连接该服务的所有客户端。`:`These settings are saved on the current Gateway and apply to every client connected to it.`})]}),ye?(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(P,{type:`button`,variant:`secondary`,disabled:B,onClick:Ve,children:c.discard}),(0,X.jsx)(P,{type:`button`,variant:`primary`,disabled:B,onClick:()=>void Be(),children:B?c.saving:r===`zh`?`保存服务配置`:`Save server settings`})]}):null]}),T?(0,X.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg bg-red-50 px-4 py-3 dark:bg-red-950/40`,role:`alert`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,X.jsx)(f,{className:`mt-0.5 size-4 shrink-0 text-red-600 dark:text-red-400`}),(0,X.jsx)(`p`,{className:`text-sm text-red-900 dark:text-red-100`,children:c.tokenExpired})]}),(0,X.jsx)(`div`,{children:(0,X.jsx)(P,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:()=>E(),children:c.updateToken})})]}):null,ae?(0,X.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:ae}):null,Y&&!n?(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg bg-amber-50 px-3 py-2 dark:bg-amber-950/40`,children:[(0,X.jsx)(`p`,{className:`text-xs text-amber-950 dark:text-amber-100`,children:c.restartHint}),(0,X.jsxs)(P,{type:`button`,variant:`secondary`,className:`shrink-0 gap-1.5 border-red-300 bg-red-50 text-xs text-red-700 hover:bg-red-100 dark:border-red-800 dark:bg-red-950/50 dark:text-red-300 dark:hover:bg-red-900/60`,disabled:ce,onClick:()=>z({type:`patch`,patch:{restartConfirmOpen:!0}}),children:[ce?(0,X.jsx)(g,{className:`size-3.5 animate-spin`}):(0,X.jsx)(y,{className:`size-3.5`}),c.restartGatewayButton]})]}):null,(0,X.jsx)(te,{open:le,title:c.restartGatewayButton,description:c.restartGatewayConfirm,confirmLabel:c.restartGatewayButton,cancelLabel:c.discard,destructive:!0,onConfirm:()=>void We(),onCancel:()=>z({type:`patch`,patch:{restartConfirmOpen:!1}})}),(0,X.jsx)(rt,{g:c,activeTab:v,visibleTabs:b,onChange:x}),(0,X.jsxs)(Q,{g:c,id:`network`,activeTab:v,children:[window.electronAPI?.gateway?.connection?null:(0,X.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-edge p-4`,children:[(0,X.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:r===`zh`?`服务地址`:`Server address`}),(0,X.jsx)(`p`,{className:`break-all text-sm text-fg-muted`,children:e}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsx)(P,{type:`button`,variant:`secondary`,onClick:()=>void pe(),children:c.retry}),(0,X.jsx)(P,{type:`button`,variant:`secondary`,onClick:()=>E(),children:c.updateToken})]})]}),(0,X.jsxs)(ie,{title:r===`zh`?`服务监听配置`:`Service listener configuration`,summary:`${M.bind} · ${M.port}`,children:[(0,X.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:`gateway-bind-mode`,children:c.bindMode}),(0,X.jsxs)(u,{id:`gateway-bind-mode`,className:Z(),value:M.bind,onChange:e=>Te(e.target.value),children:[(0,X.jsx)(d,{value:`loopback`,children:c.bindLoopback}),_?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(d,{value:`lan`,children:c.bindLan}),(0,X.jsx)(d,{value:`auto`,children:c.bindAuto}),(0,X.jsx)(d,{value:`custom`,children:c.bindCustom}),(0,X.jsx)(d,{value:`tailnet`,children:c.bindTailnet})]}):null]})]}),M.bind===`custom`?(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:`gateway-custom-bind-host`,children:c.customBindHost}),(0,X.jsx)(`input`,{id:`gateway-custom-bind-host`,className:O(Z(),`font-mono text-xs`),value:M.customBindHost,onChange:e=>Oe(e.target.value),placeholder:c.customBindHostPlaceholder,autoComplete:`off`})]}):null,(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:`gateway-listen-port`,children:c.listenPort}),(0,X.jsx)(V,{id:`gateway-listen-port`,type:`number`,min:1,max:65535,className:O(Z(),`font-mono text-xs`),value:M.port,onChange:e=>{let t=Number(e.target.value);ke(Number.isFinite(t)?Math.max(1,Math.min(65535,Math.floor(t))):M.port)}})]})]}),(0,X.jsx)(ue,{children:(0,X.jsx)(st,{g:c,origins:M.corsOrigins,candidates:me.data??[],onChange:Se})})]})]}),(0,X.jsxs)(Q,{g:c,id:`access`,activeTab:v,children:[M.auth.mode===`none`?(0,X.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:c.authModeNone}):null,(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`gateway-auth-mode`,children:c.authMode}),(0,X.jsxs)(u,{id:`gateway-auth-mode`,value:M.auth.mode,onChange:e=>be({mode:e.target.value}),className:Z(),children:[(0,X.jsx)(d,{value:`token`,children:c.authModeToken}),(0,X.jsx)(d,{value:`password`,children:c.authModePassword}),_||M.auth.mode===`trusted-proxy`||M.auth.mode===`none`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(d,{value:`trusted-proxy`,children:c.authModeTrustedProxy}),(0,X.jsx)(d,{value:`none`,children:c.authModeNoneLabel})]}):null]})]}),(0,X.jsx)(ue,{children:M.auth.mode===`trusted-proxy`?(0,X.jsx)(at,{g:c,form:M,onTrustedProxyChange:Ie,onTrustedProxiesChange:Fe,onAllowRealIpFallbackChange:Re}):null}),M.auth.mode===`token`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(dt,{id:`gateway-access-token`,label:c.accessToken,help:c.tokenHelp,placeholder:c.tokenPlaceholder,value:M.auth.token,labels:He,reveal:()=>de(`token`).then(e=>e.secret),loadFailedLabel:c.saveError,onChange:e=>be({token:e})}),(0,X.jsx)(P,{type:`button`,variant:`secondary`,className:`w-full sm:w-auto`,onClick:()=>E(),children:c.changeToken})]}):null,M.auth.mode===`password`?(0,X.jsx)(dt,{id:`gateway-auth-password`,label:c.authPassword,help:c.authPasswordHelp,placeholder:c.authPasswordPlaceholder,value:M.auth.password,labels:He,reveal:()=>de(`password`).then(e=>e.secret),loadFailedLabel:c.saveError,onChange:e=>be({password:e})}):null,(0,X.jsx)(ue,{children:M.auth.mode===`none`?null:(0,X.jsx)(ut,{g:c,rateLimit:M.auth.rateLimit,onChange:Ae})})]}),(0,X.jsxs)(Q,{g:c,id:`updates`,activeTab:v,children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`gateway-update-channel`,children:c.updateChannel}),(0,X.jsxs)(u,{id:`gateway-update-channel`,value:M.updateChannel,onChange:e=>xe(e.target.value),className:Z(),children:[(0,X.jsx)(d,{value:`stable`,children:c.channelStable}),_||M.updateChannel===`beta`?(0,X.jsx)(d,{value:`beta`,children:c.channelBeta}):null,_||M.updateChannel===`dev`?(0,X.jsx)(d,{value:`dev`,children:c.channelDev}):null]})]}),(0,X.jsxs)(`div`,{className:`space-y-4 rounded-xl bg-surface-base/45 p-4`,children:[(0,X.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:c.updateAutoSection}),(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,X.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:M.updateCheckOnStart,onChange:e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,updateCheckOnStart:e.target.checked})})}}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`font-medium`,children:c.updateCheckOnStart}),(0,X.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:c.updateCheckOnStartHint})]})]}),(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,X.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:M.updateAutoEnabled,onChange:e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,updateAutoEnabled:e.target.checked})})}}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`font-medium`,children:c.updateAutoEnabled}),(0,X.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:c.updateAutoEnabledHint})]})]}),(0,X.jsx)(ue,{children:(0,X.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:`update-auto-stable-delay`,children:c.updateAutoStableDelayHours}),(0,X.jsx)(V,{id:`update-auto-stable-delay`,type:`number`,min:0,disabled:!M.updateAutoEnabled,className:Z(),value:M.updateAutoStableDelayHours,onChange:e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,updateAutoStableDelayHours:Math.max(0,Math.floor(Number(e.target.value)||0))})})}}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:c.updateAutoStableDelayHoursHint})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:`update-auto-stable-jitter`,children:c.updateAutoStableJitterHours}),(0,X.jsx)(V,{id:`update-auto-stable-jitter`,type:`number`,min:0,disabled:!M.updateAutoEnabled,className:Z(),value:M.updateAutoStableJitterHours,onChange:e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,updateAutoStableJitterHours:Math.max(0,Math.floor(Number(e.target.value)||0))})})}}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:c.updateAutoStableJitterHoursHint})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:`update-auto-beta-interval`,children:c.updateAutoBetaCheckIntervalHours}),(0,X.jsx)(V,{id:`update-auto-beta-interval`,type:`number`,min:.25,step:.25,disabled:!M.updateAutoEnabled,className:Z(),value:M.updateAutoBetaCheckIntervalHours,onChange:e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,updateAutoBetaCheckIntervalHours:Math.max(.25,Number(e.target.value)||1)})})}}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:c.updateAutoBetaCheckIntervalHoursHint})]})]})})]})]}),(0,X.jsxs)(Q,{g:c,id:`security`,activeTab:v,children:[(0,X.jsx)(Ne,{enabled:D,refreshToken:se}),(0,X.jsx)(it,{g:c,form:M,onSecurityStrictChange:Le,onDangerouslyAllowHostHeaderOriginFallbackChange:ze})]}),(0,X.jsx)(Q,{g:c,id:`proxy`,activeTab:v,children:(0,X.jsx)(De,{value:M.outboundProxy,g:c,onChange:e=>{U.current=!0,j({type:`set-form`,updater:t=>({...t,outboundProxy:e})})}})}),(0,X.jsx)(Q,{g:c,id:`advanced`,activeTab:v,children:(0,X.jsx)(ot,{g:c,form:M,onDeferModeChange:je,onDeferIdsChange:Me,onSkipIdsChange:Pe})})]}):(0,X.jsxs)(`section`,{className:`space-y-5`,"aria-label":r===`zh`?`服务配置`:`Server configuration`,children:[(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:ae??ve??c.loadError}),(0,X.jsx)(P,{type:`button`,variant:`secondary`,onClick:()=>void pe(),children:c.retry})]}):(0,X.jsxs)(`section`,{className:`space-y-5`,"aria-label":r===`zh`?`服务配置`:`Server configuration`,children:[(0,X.jsx)(oe,{title:a.settingsSections.gateway}),(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:c.needToken})]})}function rt(e){let t=(0,U.c)(10),{g:n,activeTab:r,visibleTabs:i,onChange:a}=e,o;if(t[0]!==n||t[1]!==i){let e;t[3]===n?e=t[4]:(e=e=>({id:e,label:Xe(n,e),icon:Je[e]}),t[3]=n,t[4]=e),o=i.map(e),t[0]=n,t[1]=i,t[2]=o}else o=t[2];let s=o,c;return t[5]!==r||t[6]!==n.tabsAriaLabel||t[7]!==s||t[8]!==a?(c=(0,X.jsx)(B,{items:s,activeTab:r,onChange:a,ariaLabel:n.tabsAriaLabel,tabIdPrefix:`gateway-settings-tab`,panelIdPrefix:`gateway-settings-panel`}),t[5]=r,t[6]=n.tabsAriaLabel,t[7]=s,t[8]=a,t[9]=c):c=t[9],c}function Q(e){let t=(0,U.c)(14),{g:n,id:r,activeTab:i,children:a}=e,o;t[0]!==n||t[1]!==r?(o=Xe(n,r),t[0]=n,t[1]=r,t[2]=o):o=t[2];let s;t[3]!==n||t[4]!==r?(s=Ze(n,r),t[3]=n,t[4]=r,t[5]=s):s=t[5];let c;t[6]===a?c=t[7]:(c=(0,X.jsx)(`div`,{className:`space-y-4`,children:a}),t[6]=a,t[7]=c);let l;return t[8]!==i||t[9]!==r||t[10]!==o||t[11]!==s||t[12]!==c?(l=(0,X.jsx)(se,{id:r,activeTab:i,tabIdPrefix:`gateway-settings-tab`,panelIdPrefix:`gateway-settings-panel`,title:o,hint:s,showHeading:!1,children:c}),t[8]=i,t[9]=r,t[10]=o,t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function it(e){let t=(0,U.c)(37),{g:n,form:r,onSecurityStrictChange:i,onDangerouslyAllowHostHeaderOriginFallbackChange:a}=e,o;t[0]===i?o=t[1]:(o=e=>i(e.target.checked),t[0]=i,t[1]=o);let s;t[2]!==r.securityStrict||t[3]!==o?(s=(0,X.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:r.securityStrict,onChange:o}),t[2]=r.securityStrict,t[3]=o,t[4]=s):s=t[4];let c;t[5]===n.securityStrict?c=t[6]:(c=(0,X.jsx)(`span`,{className:`font-medium`,children:n.securityStrict}),t[5]=n.securityStrict,t[6]=c);let l;t[7]===n.securityStrictHint?l=t[8]:(l=(0,X.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:n.securityStrictHint}),t[7]=n.securityStrictHint,t[8]=l);let u;t[9]!==c||t[10]!==l?(u=(0,X.jsxs)(`span`,{children:[c,l]}),t[9]=c,t[10]=l,t[11]=u):u=t[11];let d;t[12]!==s||t[13]!==u?(d=(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[s,u]}),t[12]=s,t[13]=u,t[14]=d):d=t[14];let f;t[15]===a?f=t[16]:(f=e=>a(e.target.checked),t[15]=a,t[16]=f);let p;t[17]!==r.dangerouslyAllowHostHeaderOriginFallback||t[18]!==f?(p=(0,X.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:r.dangerouslyAllowHostHeaderOriginFallback,onChange:f}),t[17]=r.dangerouslyAllowHostHeaderOriginFallback,t[18]=f,t[19]=p):p=t[19];let m;t[20]===n.dangerouslyAllowHostHeaderOriginFallback?m=t[21]:(m=(0,X.jsx)(`span`,{className:`font-medium`,children:n.dangerouslyAllowHostHeaderOriginFallback}),t[20]=n.dangerouslyAllowHostHeaderOriginFallback,t[21]=m);let h;t[22]===n.dangerouslyAllowHostHeaderOriginFallbackHint?h=t[23]:(h=(0,X.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:n.dangerouslyAllowHostHeaderOriginFallbackHint}),t[22]=n.dangerouslyAllowHostHeaderOriginFallbackHint,t[23]=h);let g;t[24]!==h||t[25]!==m?(g=(0,X.jsxs)(`span`,{children:[m,h]}),t[24]=h,t[25]=m,t[26]=g):g=t[26];let _;t[27]!==g||t[28]!==p?(_=(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[p,g]}),t[27]=g,t[28]=p,t[29]=_):_=t[29];let v;t[30]!==r.dangerouslyAllowHostHeaderOriginFallback||t[31]!==n.dangerouslyAllowHostHeaderOriginFallbackWarning?(v=r.dangerouslyAllowHostHeaderOriginFallback?(0,X.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:n.dangerouslyAllowHostHeaderOriginFallbackWarning}):null,t[30]=r.dangerouslyAllowHostHeaderOriginFallback,t[31]=n.dangerouslyAllowHostHeaderOriginFallbackWarning,t[32]=v):v=t[32];let y;return t[33]!==_||t[34]!==v||t[35]!==d?(y=(0,X.jsxs)(`div`,{className:`space-y-4`,children:[d,_,v]}),t[33]=_,t[34]=v,t[35]=d,t[36]=y):y=t[36],y}function at(e){let t=(0,U.c)(80),{g:n,form:r,onTrustedProxyChange:i,onTrustedProxiesChange:a,onAllowRealIpFallbackChange:o}=e,s=r.auth.trustedProxy,c;t[0]===n.authModeTrustedProxyHint?c=t[1]:(c=(0,X.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.authModeTrustedProxyHint}),t[0]=n.authModeTrustedProxyHint,t[1]=c);let l;t[2]===n.trustedProxyUserHeader?l=t[3]:(l=(0,X.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:`gateway-trusted-proxy-user-header`,children:n.trustedProxyUserHeader}),t[2]=n.trustedProxyUserHeader,t[3]=l);let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=O(Z(),`font-mono text-xs`),t[4]=u):u=t[4];let d;t[5]===i?d=t[6]:(d=e=>i({userHeader:e.target.value}),t[5]=i,t[6]=d);let f;t[7]!==n.trustedProxyUserHeaderPlaceholder||t[8]!==d||t[9]!==s.userHeader?(f=(0,X.jsx)(`input`,{id:`gateway-trusted-proxy-user-header`,className:u,value:s.userHeader,onChange:d,placeholder:n.trustedProxyUserHeaderPlaceholder,autoComplete:`off`}),t[7]=n.trustedProxyUserHeaderPlaceholder,t[8]=d,t[9]=s.userHeader,t[10]=f):f=t[10];let p;t[11]===n.trustedProxyUserHeaderHint?p=t[12]:(p=(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:n.trustedProxyUserHeaderHint}),t[11]=n.trustedProxyUserHeaderHint,t[12]=p);let m;t[13]!==l||t[14]!==f||t[15]!==p?(m=(0,X.jsxs)(`div`,{children:[l,f,p]}),t[13]=l,t[14]=f,t[15]=p,t[16]=m):m=t[16];let h;t[17]===i?h=t[18]:(h=e=>i({requiredHeaders:e}),t[17]=i,t[18]=h);let g;t[19]!==n.channelIdListEmpty||t[20]!==n.trustedProxyRequiredHeaders||t[21]!==n.trustedProxyRequiredHeadersHint||t[22]!==n.trustedProxyUserHeaderPlaceholder||t[23]!==h||t[24]!==s.requiredHeaders?(g=(0,X.jsx)($,{title:n.trustedProxyRequiredHeaders,hint:n.trustedProxyRequiredHeadersHint,emptyText:n.channelIdListEmpty,placeholder:n.trustedProxyUserHeaderPlaceholder,values:s.requiredHeaders,maxItems:32,onChange:h}),t[19]=n.channelIdListEmpty,t[20]=n.trustedProxyRequiredHeaders,t[21]=n.trustedProxyRequiredHeadersHint,t[22]=n.trustedProxyUserHeaderPlaceholder,t[23]=h,t[24]=s.requiredHeaders,t[25]=g):g=t[25];let _;t[26]===i?_=t[27]:(_=e=>i({allowUsers:e}),t[26]=i,t[27]=_);let v;t[28]!==n.channelIdListEmpty||t[29]!==n.trustedProxyAllowUsers||t[30]!==n.trustedProxyAllowUsersHint||t[31]!==n.trustedProxyUserHeaderPlaceholder||t[32]!==_||t[33]!==s.allowUsers?(v=(0,X.jsx)($,{title:n.trustedProxyAllowUsers,hint:n.trustedProxyAllowUsersHint,emptyText:n.channelIdListEmpty,placeholder:n.trustedProxyUserHeaderPlaceholder,values:s.allowUsers,maxItems:128,onChange:_}),t[28]=n.channelIdListEmpty,t[29]=n.trustedProxyAllowUsers,t[30]=n.trustedProxyAllowUsersHint,t[31]=n.trustedProxyUserHeaderPlaceholder,t[32]=_,t[33]=s.allowUsers,t[34]=v):v=t[34];let y;t[35]===i?y=t[36]:(y=e=>i({allowLoopback:e.target.checked}),t[35]=i,t[36]=y);let b;t[37]!==y||t[38]!==s.allowLoopback?(b=(0,X.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:s.allowLoopback,onChange:y}),t[37]=y,t[38]=s.allowLoopback,t[39]=b):b=t[39];let x;t[40]===n.trustedProxyAllowLoopback?x=t[41]:(x=(0,X.jsx)(`span`,{className:`font-medium`,children:n.trustedProxyAllowLoopback}),t[40]=n.trustedProxyAllowLoopback,t[41]=x);let S;t[42]===n.trustedProxyAllowLoopbackHint?S=t[43]:(S=(0,X.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:n.trustedProxyAllowLoopbackHint}),t[42]=n.trustedProxyAllowLoopbackHint,t[43]=S);let C;t[44]!==x||t[45]!==S?(C=(0,X.jsxs)(`span`,{children:[x,S]}),t[44]=x,t[45]=S,t[46]=C):C=t[46];let w;t[47]!==b||t[48]!==C?(w=(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[b,C]}),t[47]=b,t[48]=C,t[49]=w):w=t[49];let T;t[50]!==r.trustedProxies||t[51]!==n.trustedProxies||t[52]!==n.trustedProxiesEmpty||t[53]!==n.trustedProxiesHint||t[54]!==n.trustedProxiesPlaceholder||t[55]!==a?(T=(0,X.jsx)($,{title:n.trustedProxies,hint:n.trustedProxiesHint,emptyText:n.trustedProxiesEmpty,placeholder:n.trustedProxiesPlaceholder,values:r.trustedProxies,maxItems:64,onChange:a}),t[50]=r.trustedProxies,t[51]=n.trustedProxies,t[52]=n.trustedProxiesEmpty,t[53]=n.trustedProxiesHint,t[54]=n.trustedProxiesPlaceholder,t[55]=a,t[56]=T):T=t[56];let E;t[57]===o?E=t[58]:(E=e=>o(e.target.checked),t[57]=o,t[58]=E);let D;t[59]!==r.allowRealIpFallback||t[60]!==E?(D=(0,X.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:r.allowRealIpFallback,onChange:E}),t[59]=r.allowRealIpFallback,t[60]=E,t[61]=D):D=t[61];let k;t[62]===n.allowRealIpFallback?k=t[63]:(k=(0,X.jsx)(`span`,{className:`font-medium`,children:n.allowRealIpFallback}),t[62]=n.allowRealIpFallback,t[63]=k);let A;t[64]===n.allowRealIpFallbackHint?A=t[65]:(A=(0,X.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:n.allowRealIpFallbackHint}),t[64]=n.allowRealIpFallbackHint,t[65]=A);let j;t[66]!==k||t[67]!==A?(j=(0,X.jsxs)(`span`,{children:[k,A]}),t[66]=k,t[67]=A,t[68]=j):j=t[68];let M;t[69]!==D||t[70]!==j?(M=(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[D,j]}),t[69]=D,t[70]=j,t[71]=M):M=t[71];let N;return t[72]!==c||t[73]!==v||t[74]!==w||t[75]!==T||t[76]!==M||t[77]!==m||t[78]!==g?(N=(0,X.jsxs)(`div`,{className:`space-y-4 rounded-xl bg-surface-base/45 p-4`,children:[c,m,g,v,w,T,M]}),t[72]=c,t[73]=v,t[74]=w,t[75]=T,t[76]=M,t[77]=m,t[78]=g,t[79]=N):N=t[79],N}function ot(e){let t=(0,U.c)(43),{g:n,form:r,onDeferModeChange:i,onDeferIdsChange:a,onSkipIdsChange:o}=e,s;t[0]===n.channelConnectDeferMode?s=t[1]:(s=(0,X.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`gateway-channel-defer-mode`,children:n.channelConnectDeferMode}),t[0]=n.channelConnectDeferMode,t[1]=s);let c=r.channelConnectDeferMode,l;t[2]===i?l=t[3]:(l=e=>i(e.target.value),t[2]=i,t[3]=l);let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=Z(),t[4]=f):f=t[4];let p;t[5]===n.channelConnectDeferModeAuto?p=t[6]:(p=(0,X.jsx)(d,{value:`auto`,children:n.channelConnectDeferModeAuto}),t[5]=n.channelConnectDeferModeAuto,t[6]=p);let m;t[7]===n.channelConnectDeferModeOff?m=t[8]:(m=(0,X.jsx)(d,{value:`off`,children:n.channelConnectDeferModeOff}),t[7]=n.channelConnectDeferModeOff,t[8]=m);let h;t[9]===n.channelConnectDeferModeExplicit?h=t[10]:(h=(0,X.jsx)(d,{value:`explicit`,children:n.channelConnectDeferModeExplicit}),t[9]=n.channelConnectDeferModeExplicit,t[10]=h);let g;t[11]!==r.channelConnectDeferMode||t[12]!==l||t[13]!==p||t[14]!==m||t[15]!==h?(g=(0,X.jsxs)(u,{id:`gateway-channel-defer-mode`,value:c,onChange:l,className:f,children:[p,m,h]}),t[11]=r.channelConnectDeferMode,t[12]=l,t[13]=p,t[14]=m,t[15]=h,t[16]=g):g=t[16];let _;t[17]===n.channelConnectDeferModeHint?_=t[18]:(_=(0,X.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.channelConnectDeferModeHint}),t[17]=n.channelConnectDeferModeHint,t[18]=_);let v;t[19]!==s||t[20]!==g||t[21]!==_?(v=(0,X.jsxs)(`div`,{className:`space-y-2 rounded-xl bg-surface-base/45 p-4`,children:[s,g,_]}),t[19]=s,t[20]=g,t[21]=_,t[22]=v):v=t[22];let y;t[23]!==r.channelConnectDeferIds||t[24]!==r.channelConnectDeferMode||t[25]!==n.channelConnectDeferIds||t[26]!==n.channelConnectDeferIdsHint||t[27]!==n.channelIdListEmpty||t[28]!==n.channelIdListPlaceholder||t[29]!==a?(y=r.channelConnectDeferMode===`explicit`?(0,X.jsx)($,{title:n.channelConnectDeferIds,hint:n.channelConnectDeferIdsHint,emptyText:n.channelIdListEmpty,placeholder:n.channelIdListPlaceholder,values:r.channelConnectDeferIds,maxItems:24,onChange:a}):null,t[23]=r.channelConnectDeferIds,t[24]=r.channelConnectDeferMode,t[25]=n.channelConnectDeferIds,t[26]=n.channelConnectDeferIdsHint,t[27]=n.channelIdListEmpty,t[28]=n.channelIdListPlaceholder,t[29]=a,t[30]=y):y=t[30];let b;t[31]!==r.channelConnectDeferMode||t[32]!==r.channelConnectDeferSkipIds||t[33]!==n.channelConnectDeferSkipIds||t[34]!==n.channelConnectDeferSkipIdsHint||t[35]!==n.channelIdListEmpty||t[36]!==n.channelIdListPlaceholder||t[37]!==o?(b=r.channelConnectDeferMode===`off`?null:(0,X.jsx)($,{title:n.channelConnectDeferSkipIds,hint:n.channelConnectDeferSkipIdsHint,emptyText:n.channelIdListEmpty,placeholder:n.channelIdListPlaceholder,values:r.channelConnectDeferSkipIds,maxItems:24,onChange:o}),t[31]=r.channelConnectDeferMode,t[32]=r.channelConnectDeferSkipIds,t[33]=n.channelConnectDeferSkipIds,t[34]=n.channelConnectDeferSkipIdsHint,t[35]=n.channelIdListEmpty,t[36]=n.channelIdListPlaceholder,t[37]=o,t[38]=b):b=t[38];let x;return t[39]!==v||t[40]!==y||t[41]!==b?(x=(0,X.jsxs)(`div`,{className:`space-y-4`,children:[v,y,b]}),t[39]=v,t[40]=y,t[41]=b,t[42]=x):x=t[42],x}function $(e){let t=(0,U.c)(25),{title:n,hint:r,emptyText:i,placeholder:a,values:o,maxItems:s,onChange:c,children:l}=e,u;t[0]!==s||t[1]!==c||t[2]!==o?(u=e=>{let t=e.trim();!t||o.includes(t)||o.length>=s||c([...o,t])},t[0]=s,t[1]=c,t[2]=o,t[3]=u):u=t[3];let d=u,f;t[4]===n?f=t[5]:(f=(0,X.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n}),t[4]=n,t[5]=f);let p;t[6]===r?p=t[7]:(p=(0,X.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r}),t[6]=r,t[7]=p);let m;t[8]!==i||t[9]!==c||t[10]!==o?(m=o.length===0?(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i}):(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:o.map(e=>(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 font-mono text-xs text-fg`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:O(`text-fg-muted hover:text-fg`,F.press),"aria-label":`Remove ${e}`,onClick:()=>c(o.filter(t=>t!==e)),children:`×`})]},e))}),t[8]=i,t[9]=c,t[10]=o,t[11]=m):m=t[11];let h;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(h=O(Z(),`font-mono text-xs`),t[12]=h):h=t[12];let g=o.length>=s,_;t[13]===d?_=t[14]:(_=e=>{e.key===`Enter`&&(e.preventDefault(),d(e.target.value),e.target.value=``)},t[13]=d,t[14]=_);let v;t[15]!==a||t[16]!==g||t[17]!==_?(v=(0,X.jsx)(`input`,{className:h,placeholder:a,disabled:g,onKeyDown:_}),t[15]=a,t[16]=g,t[17]=_,t[18]=v):v=t[18];let y;return t[19]!==l||t[20]!==f||t[21]!==p||t[22]!==m||t[23]!==v?(y=(0,X.jsxs)(`div`,{className:`space-y-2 rounded-xl bg-surface-base/45 p-4`,children:[f,p,m,v,l]}),t[19]=l,t[20]=f,t[21]=p,t[22]=m,t[23]=v,t[24]=y):y=t[24],y}function st(e){let t=(0,U.c)(36),{g:n,origins:r,candidates:i,onChange:a}=e,o;t[0]===r?o=t[1]:(o=r.includes(`*`),t[0]=r,t[1]=o);let s=o,c,l,u,d,f,p,m,h,g;if(t[2]!==i||t[3]!==n.corsAddDetectedOrigins||t[4]!==n.corsDetectedOrigins||t[5]!==n.corsOrigins||t[6]!==n.corsOriginsEmpty||t[7]!==n.corsOriginsHint||t[8]!==n.corsOriginsPlaceholder||t[9]!==a||t[10]!==r){let e;t[20]===r?e=t[21]:(e=e=>!r.includes(e.url),t[20]=r,t[21]=e);let o=i.filter(e);c=$,l=n.corsOrigins,u=n.corsOriginsHint,d=n.corsOriginsEmpty,f=n.corsOriginsPlaceholder,p=r,m=128,h=a,g=o.length>0?(0,X.jsxs)(`div`,{className:`rounded-lg bg-surface-base/55 px-3 py-2`,children:[(0,X.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:n.corsDetectedOrigins}),(0,X.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:o.map(lt)}),(0,X.jsx)(P,{type:`button`,variant:`secondary`,className:`mt-2 text-xs`,onClick:()=>a([...r,...o.map(ct)]),children:n.corsAddDetectedOrigins})]}):null,t[2]=i,t[3]=n.corsAddDetectedOrigins,t[4]=n.corsDetectedOrigins,t[5]=n.corsOrigins,t[6]=n.corsOriginsEmpty,t[7]=n.corsOriginsHint,t[8]=n.corsOriginsPlaceholder,t[9]=a,t[10]=r,t[11]=c,t[12]=l,t[13]=u,t[14]=d,t[15]=f,t[16]=p,t[17]=m,t[18]=h,t[19]=g}else c=t[11],l=t[12],u=t[13],d=t[14],f=t[15],p=t[16],m=t[17],h=t[18],g=t[19];let _;t[22]!==n.corsOriginsWildcardWarning||t[23]!==s?(_=s?(0,X.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:n.corsOriginsWildcardWarning}):null,t[22]=n.corsOriginsWildcardWarning,t[23]=s,t[24]=_):_=t[24];let v;return t[25]!==c||t[26]!==_||t[27]!==l||t[28]!==u||t[29]!==d||t[30]!==f||t[31]!==p||t[32]!==m||t[33]!==h||t[34]!==g?(v=(0,X.jsxs)(c,{title:l,hint:u,emptyText:d,placeholder:f,values:p,maxItems:m,onChange:h,children:[g,_]}),t[25]=c,t[26]=_,t[27]=l,t[28]=u,t[29]=d,t[30]=f,t[31]=p,t[32]=m,t[33]=h,t[34]=g,t[35]=v):v=t[35],v}function ct(e){return e.url}function lt(e){return(0,X.jsxs)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-0.5 font-mono text-xs text-fg`,children:[e.url,` · `,e.interfaceName]},e.url)}function ut(e){let t=(0,U.c)(73),{g:n,rateLimit:r,onChange:i}=e,a;t[0]===n.rateLimitTitle?a=t[1]:(a=(0,X.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.rateLimitTitle}),t[0]=n.rateLimitTitle,t[1]=a);let o;t[2]===n.rateLimitHint?o=t[3]:(o=(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:n.rateLimitHint}),t[2]=n.rateLimitHint,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,X.jsxs)(`div`,{children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===i?c=t[8]:(c=e=>i({enabled:e.target.checked}),t[7]=i,t[8]=c);let l;t[9]!==r.enabled||t[10]!==c?(l=(0,X.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.enabled,onChange:c}),t[9]=r.enabled,t[10]=c,t[11]=l):l=t[11];let u;t[12]!==n.rateLimitEnabled||t[13]!==l?(u=(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[l,n.rateLimitEnabled]}),t[12]=n.rateLimitEnabled,t[13]=l,t[14]=u):u=t[14];let d=!r.enabled,f;t[15]===i?f=t[16]:(f=e=>i({exemptLoopback:e.target.checked}),t[15]=i,t[16]=f);let p;t[17]!==r.exemptLoopback||t[18]!==d||t[19]!==f?(p=(0,X.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.exemptLoopback,disabled:d,onChange:f}),t[17]=r.exemptLoopback,t[18]=d,t[19]=f,t[20]=p):p=t[20];let m;t[21]!==n.rateLimitExemptLoopback||t[22]!==p?(m=(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[p,n.rateLimitExemptLoopback]}),t[21]=n.rateLimitExemptLoopback,t[22]=p,t[23]=m):m=t[23];let h;t[24]===n.rateLimitMaxAttempts?h=t[25]:(h=(0,X.jsx)(`label`,{className:`mb-1 block text-xs font-medium text-fg-muted`,htmlFor:`gateway-rate-max`,children:n.rateLimitMaxAttempts}),t[24]=n.rateLimitMaxAttempts,t[25]=h);let g;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(g=Z(),t[26]=g):g=t[26];let _=!r.enabled,v;t[27]===i?v=t[28]:(v=e=>{let t=Number(e.target.value);Number.isFinite(t)&&i({maxAttempts:Math.max(1,Math.floor(t))})},t[27]=i,t[28]=v);let y;t[29]!==r.maxAttempts||t[30]!==_||t[31]!==v?(y=(0,X.jsx)(V,{id:`gateway-rate-max`,type:`number`,min:1,className:g,value:r.maxAttempts,disabled:_,onChange:v}),t[29]=r.maxAttempts,t[30]=_,t[31]=v,t[32]=y):y=t[32];let b;t[33]!==h||t[34]!==y?(b=(0,X.jsxs)(`div`,{children:[h,y]}),t[33]=h,t[34]=y,t[35]=b):b=t[35];let x;t[36]===n.rateLimitWindowMinutes?x=t[37]:(x=(0,X.jsx)(`label`,{className:`mb-1 block text-xs font-medium text-fg-muted`,htmlFor:`gateway-rate-window`,children:n.rateLimitWindowMinutes}),t[36]=n.rateLimitWindowMinutes,t[37]=x);let S;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(S=Z(),t[38]=S):S=t[38];let C;t[39]===r.windowMs?C=t[40]:(C=Math.round(r.windowMs/6e4),t[39]=r.windowMs,t[40]=C);let w=!r.enabled,T;t[41]===i?T=t[42]:(T=e=>{let t=Number(e.target.value);Number.isFinite(t)&&t>0&&i({windowMs:Math.floor(t)*6e4})},t[41]=i,t[42]=T);let E;t[43]!==C||t[44]!==w||t[45]!==T?(E=(0,X.jsx)(V,{id:`gateway-rate-window`,type:`number`,min:1,className:S,value:C,disabled:w,onChange:T}),t[43]=C,t[44]=w,t[45]=T,t[46]=E):E=t[46];let D;t[47]!==x||t[48]!==E?(D=(0,X.jsxs)(`div`,{children:[x,E]}),t[47]=x,t[48]=E,t[49]=D):D=t[49];let O;t[50]===n.rateLimitBlockMinutes?O=t[51]:(O=(0,X.jsx)(`label`,{className:`mb-1 block text-xs font-medium text-fg-muted`,htmlFor:`gateway-rate-block`,children:n.rateLimitBlockMinutes}),t[50]=n.rateLimitBlockMinutes,t[51]=O);let k;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(k=Z(),t[52]=k):k=t[52];let A;t[53]===r.blockDurationMs?A=t[54]:(A=Math.round(r.blockDurationMs/6e4),t[53]=r.blockDurationMs,t[54]=A);let j=!r.enabled,M;t[55]===i?M=t[56]:(M=e=>{let t=Number(e.target.value);Number.isFinite(t)&&t>0&&i({blockDurationMs:Math.floor(t)*6e4})},t[55]=i,t[56]=M);let N;t[57]!==A||t[58]!==j||t[59]!==M?(N=(0,X.jsx)(V,{id:`gateway-rate-block`,type:`number`,min:1,className:k,value:A,disabled:j,onChange:M}),t[57]=A,t[58]=j,t[59]=M,t[60]=N):N=t[60];let P;t[61]!==O||t[62]!==N?(P=(0,X.jsxs)(`div`,{children:[O,N]}),t[61]=O,t[62]=N,t[63]=P):P=t[63];let F;t[64]!==b||t[65]!==D||t[66]!==P?(F=(0,X.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[b,D,P]}),t[64]=b,t[65]=D,t[66]=P,t[67]=F):F=t[67];let I;return t[68]!==m||t[69]!==s||t[70]!==F||t[71]!==u?(I=(0,X.jsxs)(`div`,{className:`space-y-3 rounded-xl bg-surface-base/45 p-4`,children:[s,u,m,F]}),t[68]=m,t[69]=s,t[70]=F,t[71]=u,t[72]=I):I=t[72],I}function dt(e){let t=(0,U.c)(17),{id:n,label:r,help:i,placeholder:a,value:o,labels:s,reveal:c,loadFailedLabel:l,onChange:u}=e,d;t[0]!==n||t[1]!==r?(d=(0,X.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=d):d=t[2];let f;t[3]!==n||t[4]!==s||t[5]!==l||t[6]!==u||t[7]!==a||t[8]!==c||t[9]!==o?(f=(0,X.jsx)(p,{id:n,value:o,onChange:u,placeholder:a,labels:s,reveal:c,loadFailedLabel:l,inputClassName:`text-xs`}),t[3]=n,t[4]=s,t[5]=l,t[6]=u,t[7]=a,t[8]=c,t[9]=o,t[10]=f):f=t[10];let m;t[11]===i?m=t[12]:(m=(0,X.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:i}),t[11]=i,t[12]=m);let h;return t[13]!==d||t[14]!==f||t[15]!==m?(h=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[d,f,m]}),t[13]=d,t[14]=f,t[15]=m,t[16]=h):h=t[16],h}export{et as GatewaySettingsPanel};
@@ -1 +1 @@
1
- import{a as e}from"./locale-store-cg9cm2EL.js";var t=6e4,n=500,r=5e3;function i(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.code===`STARTUP_UNAVAILABLE`&&t.retryable===!0&&typeof t.retryAfterMs==`number`}function a(e){return new Promise(t=>setTimeout(t,e))}function o(e){let t=typeof e.retryAfterMs==`number`?e.retryAfterMs:n;return Math.min(Math.max(t,100),r)}async function s(n,r,s){let c=Date.now(),l=s?.timeoutMs??t;for(;;){let t=await e(n,r);if(t.status!==503)return t;let s=await t.clone().json().catch(()=>null);if(!i(s)||Date.now()-c>=l)return t;await a(o(s))}}export{s as t};
1
+ import{a as e}from"./locale-store-Dy1EByeG.js";var t=6e4,n=500,r=5e3;function i(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.code===`STARTUP_UNAVAILABLE`&&t.retryable===!0&&typeof t.retryAfterMs==`number`}function a(e){return new Promise(t=>setTimeout(t,e))}function o(e){let t=typeof e.retryAfterMs==`number`?e.retryAfterMs:n;return Math.min(Math.max(t,100),r)}async function s(n,r,s){let c=Date.now(),l=s?.timeoutMs??t;for(;;){let t=await e(n,r);if(t.status!==503)return t;let s=await t.clone().json().catch(()=>null);if(!i(s)||Date.now()-c>=l)return t;await a(o(s))}}export{s as t};
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-swr-CdRzEUwF.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js"])))=>i.map(i=>d[i]);
2
- import{t as e}from"./preload-helper-Czpn1I53.js";import{i as t,o as n}from"./locale-store-cg9cm2EL.js";import{n as r}from"./gateway-config-swr-OGhON-s6.js";async function i(){let e=await n(t(`/api/global-defaults`));if(!e.payload?.defaults||!Array.isArray(e.payload.builtinTools))throw Error(`Invalid global defaults response`);return e.payload}async function a(i,a={}){let o=await n(t(`/api/global-defaults`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({defaults:i,...a})});if(!o.payload?.defaults||!Array.isArray(o.payload.builtinTools))throw Error(`Invalid global defaults response`);let{mutate:s}=await e(async()=>{let{mutate:e}=await import(`./vendor-swr-CdRzEUwF.js`).then(e=>e.r);return{mutate:e}},__vite__mapDeps([0,1,2]));return await Promise.all([s(`settings-gateway-agents`),s(`capability-readiness`),r()]),o.payload}export{a as n,i as t};
2
+ import{t as e}from"./preload-helper-Czpn1I53.js";import{i as t,o as n}from"./locale-store-Dy1EByeG.js";import{n as r}from"./gateway-config-swr-1Rk0LeEM.js";async function i(){let e=await n(t(`/api/global-defaults`));if(!e.payload?.defaults||!Array.isArray(e.payload.builtinTools))throw Error(`Invalid global defaults response`);return e.payload}async function a(i,a={}){let o=await n(t(`/api/global-defaults`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({defaults:i,...a})});if(!o.payload?.defaults||!Array.isArray(o.payload.builtinTools))throw Error(`Invalid global defaults response`);let{mutate:s}=await e(async()=>{let{mutate:e}=await import(`./vendor-swr-CdRzEUwF.js`).then(e=>e.r);return{mutate:e}},__vite__mapDeps([0,1,2]));return await Promise.all([s(`settings-gateway-agents`),s(`capability-readiness`),r()]),o.payload}export{a as n,i as t};
@@ -0,0 +1,3 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/workspace-file-preview-dialog-NffP-UXC.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js","assets/locale-store-Dy1EByeG.js","assets/messages-BAnhwALN.js","assets/use-file-preview-expanded-BXXeXnT0.js","assets/preload-helper-Czpn1I53.js","assets/chunk-KS7C4IRE-CiwuuyV8.js","assets/createLucideIcon-DPHK1VkS.js","assets/app-window-DXFNqt_0.js","assets/check-DUBLcKHA.js","assets/chevron-down-ccbiQQz_.js","assets/copy-Dv6d4Dvw.js","assets/download-Dk-ZjtO6.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/eye-CABVeTq0.js","assets/folder-open-CyzJ19I9.js","assets/link-2-D_ZKYUW7.js","assets/loader-circle-CifKLtgG.js","assets/markdown-view-BlxIaCCQ.js","assets/dist-CY7CS_D3.js","assets/es2015-DBLcMg5B.js","assets/dist-CxGUk8J-.js","assets/file-image-CDUPkZvG.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/app-link-DImAfVs5.js","assets/product-delivery-BFfqdKLe.js","assets/schemas-CCWMleym.js","assets/local-apps-DeqzkJiF.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/xml-_d7dTN2Q.js","assets/mermaid-render-oOellPHt.js","assets/markdown-view-DG8DDkEA.css","assets/message-square-plus-XP0tGdlV.js","assets/minimize-2-DtOGrlpo.js","assets/paperclip-f1HujQY1.js","assets/pencil-DmIY3Oa-.js","assets/refresh-cw-BRlGaq2w.js","assets/rotate-cw-LIg3Am9S.js","assets/save-DRDABU--.js","assets/search-DA7gz22f.js","assets/skeleton-DzdOeGYz.js","assets/constants-DpkUgykJ.js","assets/session-api-BFiIYodK.js","assets/gateway-startup-retry-D6WPS0RW.js","assets/attachment-utils-core-BIOUBrpT.js","assets/interaction-BdhHBbYa.js","assets/composer-notifications-CqV6Xj-H.js","assets/activity-store-CQHh48Zf.js","assets/app-chrome-BeB4KgOf.js","assets/electron-env-DHOGevH3.js","assets/use-async-resource-BHFGZCY2.js","assets/sliding-tab-list-CmcrqRzN.js","assets/sliding-indicator-hwz0sx3h.js","assets/workspace-api-LghfbP5g.js","assets/files-BNL4kkSB.js","assets/index.module-Cd9ENXfk.js","assets/dist-ZrL34Ps4.js","assets/dist-BuHnPloF.js","assets/floating-ui.dom-seOukHzT.js","assets/share-link-dialog-C1t_HB6f.js","assets/popover-select-CLsphyzA.js","assets/dist-GJ8-1PAx.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/globe-DSSGFWFn.js","assets/button-Cc4hUNTt.js","assets/copy-text-row-CpiRzq4G.js","assets/right-workspace-store-HPw7Gw0n.js","assets/phone-workspace-store-Ltrevdsx.js","assets/theme-store-BaWep_o7.js","assets/middleware-Pd0e8Igk.js","assets/file-preview-surface-i5UOFnQF.js","assets/shares-api-Dm07CnXw.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{l as a,m as o,t as s,u as c}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as l,n as u,o as d}from"./locale-store-Dy1EByeG.js";import{t as f}from"./messages-BAnhwALN.js";import{a as p,i as m,n as h,o as g,r as _,s as v,t as y}from"./dist-CY7CS_D3.js";import{t as b}from"./calendar-clock-D-quYVPe.js";import{t as x}from"./check-DUBLcKHA.js";import{t as S}from"./chevron-down-ccbiQQz_.js";import{t as C}from"./chevron-right-BweFrslA.js";import{t as w}from"./circle-alert-BEjgurr2.js";import{t as T}from"./circle-check-C23XjkUj.js";import{t as E}from"./circle-pause-CN9jYH2s.js";import{t as D}from"./clock-3-DnrAnuyZ.js";import{t as O}from"./external-link-DjqjBmc3.js";import{t as k}from"./history-DXH_9jsE.js";import{M as A,t as j}from"./markdown-view-BlxIaCCQ.js";import{t as M}from"./message-circle-Badhj-4D.js";import{t as N}from"./paperclip-f1HujQY1.js";import{t as P}from"./plus-Q2yW6OE7.js";import{t as F}from"./refresh-cw-BRlGaq2w.js";import{t as I}from"./search-DA7gz22f.js";import{t as ee}from"./settings-2-D-csvaET.js";import{t as te}from"./sparkles-DHlfQFAF.js";import{t as L}from"./x-B_N4OPjy.js";import{t as R}from"./cn-0WouolD0.js";import{t as z}from"./skeleton-DzdOeGYz.js";import{i as B,s as V}from"./capabilities-DB713nRi.js";import{i as H}from"./vendor-swr-CdRzEUwF.js";import{S as U,b as W,c as G,g as K,h as q,m as ne,n as re,s as ie,v as ae,w as oe,y as se}from"./workspace-preview-store-Do31QQH5.js";import{t as J}from"./button-Cc4hUNTt.js";import{a as Y,i as ce,o as le,s as ue}from"./dist-GJ8-1PAx.js";import{a as de,i as fe,o as pe,r as me,s as he,t as ge}from"./composer-payload-handoff-Dc43dgSg.js";import{t as _e}from"./use-realtime-voice-C7iWQuUv.js";import{t as ve}from"./page-header-store-Bm8oxpFR.js";import{t as ye}from"./automation-api-DxBmyzp0.js";import{a as be,n as xe,t as Se}from"./use-composer-attachments-CO7XLI4x.js";import{t as Ce}from"./sliding-tab-list-CmcrqRzN.js";import{n as we,r as Te}from"./voice-input-shortcut-events-CEeFBhp3.js";import{n as Ee}from"./date-formatters-DukWSVwc.js";import{a as De,i as Oe,r as ke,t as Ae}from"./routine-panel-9UC3NU5V.js";import{r as je,t as Me}from"./task-result-evidence-CSJeB9AH.js";import{n as Ne}from"./tab-completion-input-CxtEp0aP.js";var X=n(),Z=e(t(),1);function Pe(e,t,n=!1){let[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(!0),[s,c]=(0,Z.useState)(null),l=(0,Z.useRef)(0),u=(0,Z.useCallback)(async()=>{let t=++l.current;c(null);try{let r=await(n?ne(e,!0):ne(e));t===l.current&&i(r)}catch(e){t===l.current&&c(e instanceof Error?e.message:String(e))}finally{t===l.current&&o(!1)}},[e,n]);return(0,Z.useEffect)(()=>(u(),()=>{l.current++}),[u,t]),(0,Z.useEffect)(()=>{let e,t=1/0,n=n=>{let r=Date.now()+n;r>=t||(window.clearTimeout(e),t=r,e=window.setTimeout(()=>{e=void 0,t=1/0,u()},n))},r=()=>n(100),i=()=>n(750),a=()=>{document.visibilityState===`visible`&&r()},o=[`task-changed-v2`,`task-updated`,`session-created`,`agent-run-started`,`agent-run-ended`,`automation-run-completed`,`home-advisor-updated`,`gateway-realtime-connected`,`realtime-gap`,`focus`],s=[`session-updated`,`session-transcript-updated`];return o.forEach(e=>window.addEventListener(e,r)),s.forEach(e=>window.addEventListener(e,i)),document.addEventListener(`visibilitychange`,a),()=>{o.forEach(e=>window.removeEventListener(e,r)),s.forEach(e=>window.removeEventListener(e,i)),document.removeEventListener(`visibilitychange`,a),window.clearTimeout(e)}},[u]),{home:r,loading:a,loadError:s,setLoadError:c,load:u}}var Q=r(),Fe=12e3;function Ie(e){let t=(0,X.c)(107),{variant:n,inputId:r,inputRef:i,intent:a,labels:o,attachments:s,isDragging:c,attachmentBusy:l,attachmentsFull:u,voice:d,chat:f,cancelAction:p,onIntentChange:m,onPickFiles:h,onRemoveAttachment:g,onPaste:_,onDragOver:v,onDragLeave:y,onDrop:b,onSubmit:x}=e,S=n===`inline`,C;t[0]!==s||t[1]!==a?(C=!!a.trim()||s.length>0,t[0]=s,t[1]=a,t[2]=C):C=t[2];let w=C,T=d.voiceActive&&d.phase!==`error`,E;t[3]!==x||t[4]!==d.voiceActive?(E=e=>{if(d.voiceActive){e.preventDefault();return}x(e)},t[3]=x,t[4]=d.voiceActive,t[5]=E):E=t[5];let D=S?`mx-auto mt-6 w-full overflow-hidden rounded-xl border border-edge bg-surface-base p-2 text-left shadow-surface transition-colors focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/15 sm:mt-8`:`flex min-h-0 flex-1 flex-col`,O;t[6]===D?O=t[7]:(O=R(`relative`,D),t[6]=D,t[7]=O);let k;t[8]!==S||t[9]!==c||t[10]!==o.dropFiles?(k=c?(0,Q.jsx)(`div`,{className:R(`pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-accent-soft/90 text-sm font-medium text-accent-fg backdrop-blur-[1px]`,S&&`rounded-2xl`),children:o.dropFiles}):null,t[8]=S,t[9]=c,t[10]=o.dropFiles,t[11]=k):k=t[11];let A=!S&&`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,j;t[12]===A?j=t[13]:(j=R(A),t[12]=A,t[13]=j);let M=S?`sr-only`:`mb-2 shrink-0 text-sm font-medium text-fg`,P;t[14]!==r||t[15]!==o.intentLabel||t[16]!==M?(P=(0,Q.jsx)(`label`,{htmlFor:r,className:M,children:o.intentLabel}),t[14]=r,t[15]=o.intentLabel,t[16]=M,t[17]=P):P=t[17];let F;t[18]!==l||t[19]!==f||t[20]!==d.audioLevel||t[21]!==d.cancelVoiceInput||t[22]!==d.confirmVoiceInput||t[23]!==d.elapsedLabel||t[24]!==d.error||t[25]!==d.finalTranscript||t[26]!==d.partialTranscript||t[27]!==d.phase||t[28]!==d.recordedDictation||t[29]!==d.retryVoiceInput||t[30]!==d.settingsRequired||t[31]!==d.voiceActive?(F=d.voiceActive?(0,Q.jsx)(me,{phase:d.phase,elapsedLabel:d.elapsedLabel,recordedDictation:d.recordedDictation,audioLevel:d.audioLevel,partialTranscript:d.partialTranscript,finalTranscript:d.finalTranscript,error:d.error,settingsRequired:d.settingsRequired,disabled:l,chat:f,onCancel:d.cancelVoiceInput,onConfirm:d.confirmVoiceInput,onRetry:d.retryVoiceInput}):null,t[18]=l,t[19]=f,t[20]=d.audioLevel,t[21]=d.cancelVoiceInput,t[22]=d.confirmVoiceInput,t[23]=d.elapsedLabel,t[24]=d.error,t[25]=d.finalTranscript,t[26]=d.partialTranscript,t[27]=d.phase,t[28]=d.recordedDictation,t[29]=d.retryVoiceInput,t[30]=d.settingsRequired,t[31]=d.voiceActive,t[32]=F):F=t[32];let I=T&&`hidden`,ee=S?`min-h-24 bg-transparent px-3 py-2`:`min-h-32 flex-1 rounded-xl border border-edge bg-surface-base p-3 focus:border-accent focus:ring-2 focus:ring-accent/20`,L;t[33]!==I||t[34]!==ee?(L=R(`w-full resize-none text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle`,I,ee),t[33]=I,t[34]=ee,t[35]=L):L=t[35];let z;t[36]===m?z=t[37]:(z=e=>m(e.target.value),t[36]=m,t[37]=z);let B=!S,V;t[38]!==r||t[39]!==i||t[40]!==a||t[41]!==o.intentPlaceholder||t[42]!==o.intentSuggestion||t[43]!==m||t[44]!==_||t[45]!==L||t[46]!==z||t[47]!==B?(V=(0,Q.jsx)(Ne,{ref:i,id:r,className:L,value:a,onChange:z,onPaste:_,suggestion:o.intentSuggestion,onAcceptSuggestion:m,onKeyDown:Le,placeholder:o.intentPlaceholder,maxLength:Fe,autoFocus:B}),t[38]=r,t[39]=i,t[40]=a,t[41]=o.intentPlaceholder,t[42]=o.intentSuggestion,t[43]=m,t[44]=_,t[45]=L,t[46]=z,t[47]=B,t[48]=V):V=t[48];let H=S?`border-b-0 bg-transparent px-3 pb-2 pt-0`:`mt-3 border-b-0 bg-transparent px-0 pb-0`,U;t[49]!==s||t[50]!==g||t[51]!==H?(U=(0,Q.jsx)(xe,{attachments:s,topPadded:!1,onRemove:g,className:H}),t[49]=s,t[50]=g,t[51]=H,t[52]=U):U=t[52];let W;t[53]!==S||t[54]!==a.length||t[55]!==o.shortcut?(W=S?null:(0,Q.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,Q.jsx)(`span`,{children:o.shortcut}),(0,Q.jsxs)(`span`,{className:`tabular-nums`,children:[a.length.toLocaleString(),` / `,Fe.toLocaleString()]})]}),t[53]=S,t[54]=a.length,t[55]=o.shortcut,t[56]=W):W=t[56];let G;t[57]!==F||t[58]!==V||t[59]!==U||t[60]!==W||t[61]!==j||t[62]!==P?(G=(0,Q.jsxs)(`div`,{className:j,children:[P,F,V,U,W]}),t[57]=F,t[58]=V,t[59]=U,t[60]=W,t[61]=j,t[62]=P,t[63]=G):G=t[63];let K=S?`border-edge-subtle px-1 pt-2`:`border-edge px-5 py-4`,q;t[64]===K?q=t[65]:(q=R(`flex shrink-0 items-center gap-2 border-t`,K),t[64]=K,t[65]=q);let ne=!S&&`mr-auto`,re;t[66]===ne?re=t[67]:(re=R(`flex items-center gap-1`,ne),t[66]=ne,t[67]=re);let ie=l||u,ae;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Q.jsx)(N,{className:`size-4`,"aria-hidden":!0}),t[68]=ae):ae=t[68];let oe;t[69]!==o.attachTitle||t[70]!==h||t[71]!==ie?(oe=(0,Q.jsx)(J,{type:`button`,variant:`ghost`,className:`size-9 rounded-lg p-0`,disabled:ie,title:o.attachTitle,"aria-label":o.attachTitle,onClick:h,children:ae}),t[69]=o.attachTitle,t[70]=h,t[71]=ie,t[72]=oe):oe=t[72];let se;t[73]!==l||t[74]!==f||t[75]!==d.startVoiceInput||t[76]!==d.voiceActive?(se=d.voiceActive?null:(0,Q.jsx)(de,{disabled:l,chat:f,onStart:d.startVoiceInput}),t[73]=l,t[74]=f,t[75]=d.startVoiceInput,t[76]=d.voiceActive,t[77]=se):se=t[77];let Y;t[78]!==re||t[79]!==oe||t[80]!==se?(Y=(0,Q.jsxs)(`div`,{className:re,children:[oe,se]}),t[78]=re,t[79]=oe,t[80]=se,t[81]=Y):Y=t[81];let ce;t[82]!==p||t[83]!==S||t[84]!==o.shortcut?(ce=S?(0,Q.jsx)(`span`,{className:`hidden text-[11px] text-fg-subtle sm:inline`,children:o.shortcut}):p,t[82]=p,t[83]=S,t[84]=o.shortcut,t[85]=ce):ce=t[85];let le=S?`ml-auto h-9 rounded-lg px-3.5 text-xs`:`min-w-32`,ue=!w||l||d.voiceActive,fe=S?`size-3.5`:`size-4`,pe;t[86]===fe?pe=t[87]:(pe=(0,Q.jsx)(te,{className:fe,"aria-hidden":!0}),t[86]=fe,t[87]=pe);let he;t[88]!==o.submit||t[89]!==le||t[90]!==ue||t[91]!==pe?(he=(0,Q.jsxs)(J,{type:`submit`,variant:`primary`,className:le,disabled:ue,children:[pe,o.submit]}),t[88]=o.submit,t[89]=le,t[90]=ue,t[91]=pe,t[92]=he):he=t[92];let ge;t[93]!==q||t[94]!==Y||t[95]!==ce||t[96]!==he?(ge=(0,Q.jsxs)(`div`,{className:q,children:[Y,ce,he]}),t[93]=q,t[94]=Y,t[95]=ce,t[96]=he,t[97]=ge):ge=t[97];let _e;return t[98]!==y||t[99]!==v||t[100]!==b||t[101]!==E||t[102]!==G||t[103]!==ge||t[104]!==O||t[105]!==k?(_e=(0,Q.jsxs)(`form`,{onSubmit:E,onDragOver:v,onDragLeave:y,onDrop:b,className:O,children:[k,G,ge]}),t[98]=y,t[99]=v,t[100]=b,t[101]=E,t[102]=G,t[103]=ge,t[104]=O,t[105]=k,t[106]=_e):_e=t[106],_e}function Le(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}function Re(e){let t=(0,X.c)(12),{href:n,children:r,onOpen:i}=e,o=a();if(n&&/^https?:\/\//i.test(n)){let e;return t[0]!==r||t[1]!==n?(e=(0,Q.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,className:`rounded-sm text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r}),t[0]=r,t[1]=n,t[2]=e):e=t[2],e}if(n?.startsWith(`/`)&&!n.startsWith(`//`)){let e=`${o.pathname}${o.search}`,a;t[3]!==n||t[4]!==e?(a=A(e,n),t[3]=n,t[4]=e,t[5]=a):a=t[5];let c;return t[6]!==r||t[7]!==i||t[8]!==a?(c=(0,Q.jsx)(s,{to:a,className:`rounded-sm text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:i,children:r}),t[6]=r,t[7]=i,t[8]=a,t[9]=c):c=t[9],c}let c;return t[10]===r?c=t[11]:(c=(0,Q.jsx)(`span`,{children:r}),t[10]=r,t[11]=c),c}function ze(e){let t=(0,X.c)(6),{opportunity:n,onOpen:r}=e,i=u($),a,o;if(t[0]!==i||t[1]!==r||t[2]!==n.evidence||t[3]!==n.evidencePresentation){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=f(i).projectsPage.home.advisorEvidenceCopy,t=n.evidencePresentation,s=t?.locale===i?t.groups:void 0,c=new Intl.DateTimeFormat(i===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}),l=t=>(0,Q.jsx)(`ul`,{className:`mt-2 space-y-3 border-l border-edge pl-3 text-xs leading-5 text-fg-muted`,children:t.map(t=>{let n=!!(t.href&&(/^https?:\/\//i.test(t.href)||t.href.startsWith(`/`)&&!t.href.startsWith(`//`)));return(0,Q.jsxs)(`li`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:[(0,Q.jsxs)(`p`,{className:`text-fg-subtle`,children:[e.sources[t.sourceType],` · `,(0,Q.jsx)(`time`,{dateTime:new Date(t.observedAt).toISOString(),children:c.format(t.observedAt)})]}),(0,Q.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap`,children:t.observation}),(0,Q.jsx)(`p`,{className:`mt-1`,children:n?(0,Q.jsx)(Re,{href:t.href,onOpen:r,children:e.openSource}):e.noSource})]},t.id)})}),u=(t,r)=>(0,Q.jsxs)(`li`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`p`,{className:`text-fg-muted`,children:t.summary}),(0,Q.jsxs)(`details`,{className:`mt-1`,children:[(0,Q.jsxs)(`summary`,{className:`min-h-9 cursor-pointer rounded-sm py-2 text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[e.originals,` · `,e.sourceCount.replace(`{{count}}`,String(t.evidenceIds.length))]}),l(n.evidence.filter(e=>t.evidenceIds.includes(e.id)))]})]},r);if(!s){o=(0,Q.jsxs)(`div`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:[(0,Q.jsx)(`p`,{children:e.unavailable}),(0,Q.jsxs)(`details`,{children:[(0,Q.jsx)(`summary`,{className:`min-h-9 cursor-pointer rounded-sm py-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:e.originals}),l(n.evidence)]})]});break bb0}a=(0,Q.jsxs)(`div`,{className:`mt-2 text-xs leading-5`,children:[(0,Q.jsx)(`p`,{className:`mb-3 text-fg-subtle`,children:e.aiNote}),(0,Q.jsx)(`ul`,{className:`space-y-3 border-l border-edge pl-3`,children:s.slice(0,3).map(u)}),s.length>3?(0,Q.jsxs)(`details`,{className:`mt-2`,children:[(0,Q.jsx)(`summary`,{className:`min-h-9 cursor-pointer rounded-sm py-2 text-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:e.more.replace(`{{count}}`,String(s.length-3))}),(0,Q.jsx)(`ul`,{className:`space-y-3 border-l border-edge pl-3`,children:s.slice(3).map(u)})]}):null]})}t[0]=i,t[1]=r,t[2]=n.evidence,t[3]=n.evidencePresentation,t[4]=a,t[5]=o}else a=t[4],o=t[5];return o===Symbol.for(`react.early_return_sentinel`)?a:o}function $(e){return e.language}function Be(e){let t=(0,X.c)(4),{label:n,onClick:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),t[0]=i):i=t[0];let a;return t[1]!==n||t[2]!==r?(a=(0,Q.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-9 items-center gap-1.5 rounded-lg px-2 text-xs font-medium text-fg-muted transition-colors duration-150 hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:r,children:[i,n]}),t[1]=n,t[2]=r,t[3]=a):a=t[3],a}function Ve(e){let t=(0,X.c)(63),{opportunity:n,copy:r,onOpenHistory:i}=e,a,o,s,c,l,u;if(t[0]!==r.aiLabel||t[1]!==r.automationAction||t[2]!==r.automationHint||t[3]!==r.history||t[4]!==r.minutes||t[5]!==r.needsSetup||t[6]!==r.why||t[7]!==i||t[8]!==n.capabilities||t[9]!==n.continuation||t[10]!==n.estimatedMinutes||t[11]!==n.outcome||t[12]!==n.rationale||t[13]!==n.title){let e=n.capabilities.filter(He),d;t[20]===r.aiLabel?d=t[21]:(d=(0,Q.jsx)(`span`,{children:r.aiLabel}),t[20]=r.aiLabel,t[21]=d);let f;t[22]!==r.minutes||t[23]!==n.estimatedMinutes?(f=n.estimatedMinutes?(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(D,{className:`size-3.5`,"aria-hidden":!0}),n.estimatedMinutes,` `,r.minutes]}):null,t[22]=r.minutes,t[23]=n.estimatedMinutes,t[24]=f):f=t[24];let p;t[25]!==d||t[26]!==f?(p=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[d,f]}),t[25]=d,t[26]=f,t[27]=p):p=t[27];let m;t[28]!==r.history||t[29]!==i?(m=(0,Q.jsx)(Be,{label:r.history,onClick:i}),t[28]=r.history,t[29]=i,t[30]=m):m=t[30],t[31]!==m||t[32]!==p?(a=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[p,m]}),t[31]=m,t[32]=p,t[33]=a):a=t[33],t[34]===n.title?o=t[35]:(o=(0,Q.jsx)(`h3`,{className:`mt-3 text-xl font-semibold leading-7 tracking-tight text-fg`,children:n.title}),t[34]=n.title,t[35]=o),t[36]===n.outcome?s=t[37]:(s=(0,Q.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n.outcome}),t[36]=n.outcome,t[37]=s);let h;t[38]===r.why?h=t[39]:(h=(0,Q.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.why,`:`]}),t[38]=r.why,t[39]=h),t[40]!==n.rationale||t[41]!==h?(c=(0,Q.jsxs)(`p`,{className:`mt-4 text-sm leading-6 text-fg-muted`,children:[h,n.rationale]}),t[40]=n.rationale,t[41]=h,t[42]=c):c=t[42],t[43]!==r.automationAction||t[44]!==r.automationHint||t[45]!==n.continuation?(l=n.continuation?.kind===`automation`?(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-col gap-3 rounded-xl border border-edge bg-surface-subtle p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:r.automationHint}),(0,Q.jsx)(`a`,{href:`#${n.continuation.href}`,className:`inline-flex min-h-11 shrink-0 items-center rounded-lg px-3 text-xs font-medium text-accent hover:bg-accent-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.automationAction})]}):null,t[43]=r.automationAction,t[44]=r.automationHint,t[45]=n.continuation,t[46]=l):l=t[46],u=e.length>0?(0,Q.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,"aria-label":r.needsSetup,children:e.map(e=>(0,Q.jsxs)(`a`,{href:`#${e.recoveryPath??`/settings`}`,className:`rounded-full border border-accent/25 bg-accent-soft px-2.5 py-1 text-xs text-accent hover:border-accent/50`,children:[r.needsSetup,` · `,e.capability]},`${e.kind}:${e.capability}`))}):null,t[0]=r.aiLabel,t[1]=r.automationAction,t[2]=r.automationHint,t[3]=r.history,t[4]=r.minutes,t[5]=r.needsSetup,t[6]=r.why,t[7]=i,t[8]=n.capabilities,t[9]=n.continuation,t[10]=n.estimatedMinutes,t[11]=n.outcome,t[12]=n.rationale,t[13]=n.title,t[14]=a,t[15]=o,t[16]=s,t[17]=c,t[18]=l,t[19]=u}else a=t[14],o=t[15],s=t[16],c=t[17],l=t[18],u=t[19];let d;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(S,{className:`size-3.5 transition-transform group-open:rotate-180`,"aria-hidden":!0}),t[47]=d):d=t[47];let f;t[48]===r.evidence?f=t[49]:(f=(0,Q.jsxs)(`summary`,{className:`flex min-h-9 cursor-pointer list-none items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[r.evidence,d]}),t[48]=r.evidence,t[49]=f);let p;t[50]===n?p=t[51]:(p=(0,Q.jsx)(ze,{opportunity:n}),t[50]=n,t[51]=p);let m;t[52]!==f||t[53]!==p?(m=(0,Q.jsxs)(`details`,{className:`mt-4 group`,children:[f,p]}),t[52]=f,t[53]=p,t[54]=m):m=t[54];let h;return t[55]!==a||t[56]!==m||t[57]!==o||t[58]!==s||t[59]!==c||t[60]!==l||t[61]!==u?(h=(0,Q.jsxs)(Q.Fragment,{children:[a,o,s,c,l,u,m]}),t[55]=a,t[56]=m,t[57]=o,t[58]=s,t[59]=c,t[60]=l,t[61]=u,t[62]=h):h=t[62],h}function He(e){return e.readiness!==`ready`}function Ue(e){let t=(0,X.c)(142),{advisor:n,copy:r,busy:i,onRefresh:a,onAction:o,onFeedback:s,onClarification:c,onOpenHistory:l,preflight:u,receipt:d}=e,[f,p]=(0,Z.useState)(),m;t[0]!==n.alternatives||t[1]!==n.primary||t[2]!==n.state?(m=n.state===`ready`?[n.primary,...n.alternatives]:[],t[0]=n.alternatives,t[1]=n.primary,t[2]=n.state,t[3]=m):m=t[3];let h=m,g;t[4]!==h||t[5]!==f?(g=h.find(e=>e.id===f)??h[0],t[4]=h,t[5]=f,t[6]=g):g=t[6];let _=g,v;t[7]===h[0]?.id?v=t[8]:(v=()=>p(h[0]?.id),t[7]=h[0]?.id,t[8]=v);let y=h[0]?.id,b;if(t[9]!==n.state||t[10]!==y?(b=[n.state,y],t[9]=n.state,t[10]=y,t[11]=b):b=t[11],(0,Z.useEffect)(v,b),n.state===`disabled`)return null;if(d){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(T,{className:`size-5 shrink-0 text-success`,"aria-hidden":!0}),t[12]=e):e=t[12];let n;t[13]===d.title?n=t[14]:(n=(0,Q.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:d.title}),t[13]=d.title,t[14]=n);let i;t[15]===d.detail?i=t[16]:(i=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:d.detail}),t[15]=d.detail,t[16]=i);let a;t[17]!==n||t[18]!==i?(a=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[n,i]}),t[17]=n,t[18]=i,t[19]=a):a=t[19];let o;t[20]!==r.history||t[21]!==l?(o=(0,Q.jsx)(Be,{label:r.history,onClick:l}),t[20]=r.history,t[21]=l,t[22]=o):o=t[22];let s=`#${d.href}`,c;t[23]!==r.viewProgress||t[24]!==s?(c=(0,Q.jsx)(J,{asChild:!0,variant:`secondary`,className:`min-h-10 text-xs`,children:(0,Q.jsx)(`a`,{href:s,children:r.viewProgress})}),t[23]=r.viewProgress,t[24]=s,t[25]=c):c=t[25];let u;t[26]!==o||t[27]!==c?(u=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[o,c]}),t[26]=o,t[27]=c,t[28]=u):u=t[28];let f;return t[29]!==u||t[30]!==a?(f=(0,Q.jsx)(`section`,{className:`mt-7 rounded-2xl border border-success/25 bg-success-soft px-5 py-4`,role:`status`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center`,children:[e,a,u]})}),t[29]=u,t[30]=a,t[31]=f):f=t[31],f}if(n.state===`quiet`||n.state===`refreshing`)return null;if(n.state===`clarification`){let e;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(te,{className:`size-4`,"aria-hidden":!0}),t[32]=e):e=t[32];let a;t[33]===r.aiLabel?a=t[34]:(a=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-accent`,children:[e,r.aiLabel]}),t[33]=r.aiLabel,t[34]=a);let o;t[35]!==r.history||t[36]!==l?(o=(0,Q.jsx)(Be,{label:r.history,onClick:l}),t[35]=r.history,t[36]=l,t[37]=o):o=t[37];let s;t[38]!==a||t[39]!==o?(s=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[a,o]}),t[38]=a,t[39]=o,t[40]=s):s=t[40];let u;t[41]===n.question.question?u=t[42]:(u=(0,Q.jsx)(`h3`,{id:`home-advisor-question`,className:`mt-3 text-lg font-semibold text-fg`,children:n.question.question}),t[41]=n.question.question,t[42]=u);let d;if(t[43]!==n.question.options||t[44]!==n.question.question||t[45]!==i||t[46]!==c){let e;t[48]!==n.question.question||t[49]!==i||t[50]!==c?(e=e=>(0,Q.jsx)(J,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>c(n.question.question,e.label),children:e.label},e.id),t[48]=n.question.question,t[49]=i,t[50]=c,t[51]=e):e=t[51],d=n.question.options.map(e),t[43]=n.question.options,t[44]=n.question.question,t[45]=i,t[46]=c,t[47]=d}else d=t[47];let f;t[52]===d?f=t[53]:(f=(0,Q.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:d}),t[52]=d,t[53]=f);let p;return t[54]!==u||t[55]!==f||t[56]!==s?(p=(0,Q.jsxs)(`section`,{className:`mt-7 rounded-2xl border border-accent/25 bg-surface-base px-5 py-5`,"aria-labelledby":`home-advisor-question`,children:[s,u,f]}),t[54]=u,t[55]=f,t[56]=s,t[57]=p):p=t[57],p}if(!_)return null;let x=u?.opportunityId===_.id?u.value:void 0,C;t[58]!==n.stale||t[59]!==r.refreshing?(C=n.stale?(0,Q.jsxs)(`p`,{className:`mb-3 inline-flex items-center gap-2 text-xs text-accent`,children:[(0,Q.jsx)(F,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),r.refreshing]}):null,t[58]=n.stale,t[59]=r.refreshing,t[60]=C):C=t[60];let w;t[61]!==r||t[62]!==l||t[63]!==_?(w=(0,Q.jsx)(Ve,{opportunity:_,copy:r,onOpenHistory:l}),t[61]=r,t[62]=l,t[63]=_,t[64]=w):w=t[64];let E;t[65]!==i||t[66]!==r.configure||t[67]!==r.degradedStart||t[68]!==r.setupHint||t[69]!==r.setupTitle||t[70]!==o||t[71]!==_||t[72]!==x?(E=x?.state===`needs_setup`?(0,Q.jsx)(`div`,{className:`mt-5 rounded-xl border border-accent/25 bg-accent-soft/40 p-4`,role:`alert`,"aria-live":`polite`,children:(0,Q.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Q.jsx)(ee,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:r.setupTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r.setupHint}),(0,Q.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:x.blockers.map(We)}),(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[x.recoveryActions.map(e=>(0,Q.jsxs)(`a`,{href:`#${e.href}`,className:`inline-flex min-h-11 items-center rounded-lg border border-accent/30 px-3 text-xs font-medium text-accent hover:bg-accent-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[r.configure,` · `,e.capability]},e.capability)),x.degradedAction?(0,Q.jsx)(J,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>o(_,`degraded_start`),children:r.degradedStart}):null]})]})]})}):null,t[65]=i,t[66]=r.configure,t[67]=r.degradedStart,t[68]=r.setupHint,t[69]=r.setupTitle,t[70]=o,t[71]=_,t[72]=x,t[73]=E):E=t[73];let D;t[74]!==i||t[75]!==r.start||t[76]!==o||t[77]!==_?(D=_.actions.canStart?(0,Q.jsxs)(J,{type:`button`,variant:`primary`,className:`min-h-11`,disabled:i,onClick:()=>o(_,`start`),children:[(0,Q.jsx)(te,{className:`size-4`,"aria-hidden":!0}),r.start]}):null,t[74]=i,t[75]=r.start,t[76]=o,t[77]=_,t[78]=D):D=t[78];let O;t[79]!==i||t[80]!==r.discuss||t[81]!==o||t[82]!==_?(O=_.actions.canDiscuss?(0,Q.jsxs)(J,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>o(_,`discuss`),children:[(0,Q.jsx)(M,{className:`size-4`,"aria-hidden":!0}),r.discuss]}):null,t[79]=i,t[80]=r.discuss,t[81]=o,t[82]=_,t[83]=O):O=t[83];let k;t[84]!==O||t[85]!==D?(k=(0,Q.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center gap-2`,children:[D,O]}),t[84]=O,t[85]=D,t[86]=k):k=t[86];let A;t[87]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(S,{className:`size-3.5`,"aria-hidden":!0}),t[87]=A):A=t[87];let j;t[88]===r.more?j=t[89]:(j=(0,Q.jsxs)(`summary`,{className:`inline-flex min-h-9 cursor-pointer list-none items-center gap-1.5 rounded-lg px-2 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,children:[r.more,A]}),t[88]=r.more,t[89]=j);let N;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Q.jsx)(F,{className:`size-4`,"aria-hidden":!0}),t[90]=N):N=t[90];let P;t[91]!==i||t[92]!==r.refresh||t[93]!==a?(P=(0,Q.jsxs)(J,{type:`button`,variant:`ghost`,className:`min-h-11`,disabled:i,onClick:a,title:r.refresh,children:[N,r.refresh]}),t[91]=i,t[92]=r.refresh,t[93]=a,t[94]=P):P=t[94];let I;t[95]===r.feedback?I=t[96]:(I=(0,Q.jsx)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center rounded-lg px-3 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.feedback}),t[95]=r.feedback,t[96]=I);let L;t[97]===r.alreadyDone?L=t[98]:(L=[`already_done`,r.alreadyDone],t[97]=r.alreadyDone,t[98]=L);let R;t[99]===r.irrelevant?R=t[100]:(R=[`irrelevant`,r.irrelevant],t[99]=r.irrelevant,t[100]=R);let z;t[101]===r.later?z=t[102]:(z=[`too_early`,r.later],t[101]=r.later,t[102]=z);let B;t[103]===r.sourceIncorrect?B=t[104]:(B=[`source_incorrect`,r.sourceIncorrect],t[103]=r.sourceIncorrect,t[104]=B);let V;t[105]===r.lessLikeThis?V=t[106]:(V=[`less_like_this`,r.lessLikeThis],t[105]=r.lessLikeThis,t[106]=V);let H;t[107]!==L||t[108]!==R||t[109]!==z||t[110]!==B||t[111]!==V?(H=[L,R,z,B,V],t[107]=L,t[108]=R,t[109]=z,t[110]=B,t[111]=V,t[112]=H):H=t[112];let U=H,W;t[113]!==i||t[114]!==s||t[115]!==_||t[116]!==U?(W=(0,Q.jsx)(`div`,{className:`absolute right-0 z-20 mt-1 w-44 rounded-xl border border-edge bg-surface-overlay p-1 shadow-float`,children:U.map(e=>{let[t,n]=e;return(0,Q.jsx)(`button`,{type:`button`,disabled:i,className:`min-h-10 w-full rounded-lg px-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>s(_,t),children:n},t)})}),t[113]=i,t[114]=s,t[115]=_,t[116]=U,t[117]=W):W=t[117];let G;t[118]!==I||t[119]!==W?(G=(0,Q.jsxs)(`details`,{className:`relative`,children:[I,W]}),t[118]=I,t[119]=W,t[120]=G):G=t[120];let K;t[121]!==P||t[122]!==G?(K=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[P,G]}),t[121]=P,t[122]=G,t[123]=K):K=t[123];let q;t[124]!==i||t[125]!==r.alternatives||t[126]!==h||t[127]!==_.id?(q=h.length>1?(0,Q.jsxs)(`div`,{className:`border-t border-edge-subtle pt-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:r.alternatives}),(0,Q.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:h.filter(e=>e.id!==_.id).map(e=>(0,Q.jsx)(`button`,{type:`button`,disabled:i,className:`min-h-10 rounded-lg border border-edge px-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>p(e.id),children:e.title},e.id))})]}):null,t[124]=i,t[125]=r.alternatives,t[126]=h,t[127]=_.id,t[128]=q):q=t[128];let ne;t[129]!==j||t[130]!==K||t[131]!==q?(ne=(0,Q.jsxs)(`details`,{className:`mt-1`,children:[j,K,q]}),t[129]=j,t[130]=K,t[131]=q,t[132]=ne):ne=t[132];let re;t[133]!==k||t[134]!==ne||t[135]!==C||t[136]!==w||t[137]!==E?(re=(0,Q.jsxs)(`div`,{className:`px-5 py-5 sm:px-6`,children:[C,w,E,k,ne]}),t[133]=k,t[134]=ne,t[135]=C,t[136]=w,t[137]=E,t[138]=re):re=t[138];let ie;return t[139]!==r.aiLabel||t[140]!==re?(ie=(0,Q.jsx)(`section`,{className:`mt-7 rounded-2xl border border-accent/25 bg-surface-base`,"aria-label":r.aiLabel,children:re}),t[139]=r.aiLabel,t[140]=re,t[141]=ie):ie=t[141],ie}function We(e){return(0,Q.jsx)(`li`,{children:e.message},`${e.kind}:${e.capability}`)}function Ge({observation:e,advisor:t,language:n,onUpdated:r}){let i=n===`zh`,[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(``),[u,f]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(`once`),[h,g]=(0,Z.useState)(),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(!1),[C,w]=(0,Z.useState)(),[T,E]=(0,Z.useState)(!1),D=t.state===`ready`?t.primary:void 0,O=D?.evidence.map(e=>/^observation:([^:]+):/.exec(e.id)?.[1]).find(Boolean),k=h?e.topics.find(e=>e.id===h):e.topics.find(e=>e.id===O)??e.topics[0],A=async e=>{if(!a){o(!0),c(``);try{await e(),r()}catch(e){c(e instanceof Error?e.message:String(e)),r()}finally{o(!1)}}},j=async t=>{let n=await d(l(`/api/home/observation/command`),{method:`POST`,body:JSON.stringify({expectedRevision:e.revision,idempotencyKey:crypto.randomUUID(),command:t})});return V.parse(n)},M=e.status===`disabled`?i?`开启长期观察`:`Start observing`:e.status===`paused`?i?`观察已暂停`:`Observation paused`:e.analyzedRevision<e.revision?i?`已接收新记录,等待分析`:`New records awaiting analysis`:i?`持续观察中 · 等待新记录`:`Observing · waiting for new records`;return(0,Q.jsxs)(`section`,{className:`rounded-xl border border-edge bg-surface-panel p-4`,"aria-label":i?`交给我`:`Let me handle it`,"aria-busy":a,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i?`交给我`:`Let me handle it`}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,role:`status`,children:M})]}),(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:i?`在同一个观察会话里,积累你的工作轨迹、反馈和试做结果。`:`Work, feedback and trial outcomes stay linked in one observation session.`}),s?(0,Q.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:s}):null,h&&!k&&u?(0,Q.jsxs)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:[i?`此主题已不可用,未将你的输入转给其他主题。未保存的内容:`:`This topic is unavailable. Your draft was not reassigned: `,u]}):null,t.state===`quiet`&&[`model_unavailable`,`generation_failed`,`budget_exhausted`].includes(t.reason)?(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,role:`status`,children:i?`记录已保留,当前分析暂不可用。请检查模型配置或稍后重试;不会丢失反馈。`:`Records are preserved. Analysis is temporarily unavailable; check the model or retry later. Feedback is retained.`}):null,e.status===`disabled`?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:i?`开启后回看最近 30 天已授权的私人会话,再增量处理新任务和反馈。不扫描屏幕,不自动创建定时任务。`:`Review up to 30 days of authorized private conversations, then process new work and feedback incrementally. No screen recording or recurring jobs.`}),(0,Q.jsx)(J,{disabled:a,onClick:()=>void A(async()=>{await j({kind:`start`,backfillDays:30})}),children:i?`开启观察`:`Start observation`})]}):(0,Q.jsxs)(Q.Fragment,{children:[k?(0,Q.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:k.title}):(0,Q.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:i?`暂时没有足够的线索。有完整的新任务后再判断。`:`Waiting for enough evidence from new work.`}),e.status===`active`&&D&&k&&O===k.id?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:D.title}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:D.rationale}),(0,Q.jsxs)(`details`,{className:`text-xs text-fg-muted`,children:[(0,Q.jsx)(`summary`,{children:i?`查看依据`:`Evidence`}),D.evidence.map(e=>(0,Q.jsx)(`p`,{className:`mt-2`,children:e.observation},e.id))]}),D.risk===`analysis`?(0,Q.jsx)(J,{disabled:a,onClick:()=>void A(async()=>{let t=B.parse(await d(l(`/api/home/observation/trial`),{method:`POST`,body:JSON.stringify({topicId:k.id,opportunityId:D.id,expectedRevision:e.revision,expectedOpportunityRevision:D.revision,idempotencyKey:crypto.randomUUID()})}));if(t.outcome===`task`)w(t.taskId);else throw Error(i?`请先完成相关能力配置。`:`Set up the required capabilities first.`)}),children:i?`先做一份私人草稿`:`Try a private draft`}):(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`这项建议需要读取或修改外部服务,当前仅支持讨论与私人分析试做。`:`This suggestion needs external access. Discuss its scope before proceeding.`})]}):null,k&&e.status===`active`?(0,Q.jsx)(J,{className:`mt-3`,variant:`ghost`,disabled:a,"aria-expanded":_,onClick:()=>{g(k.id),v(!_)},children:i?`补充一句 / 调整要求`:`Add feedback / refine requirements`}):null,k&&e.status===`active`?(0,Q.jsx)(J,{variant:`ghost`,disabled:a,onClick:()=>void A(async()=>{let t=await d(l(`/api/home/observation/discussion`),{method:`POST`,body:JSON.stringify({topicId:k.id,expectedRevision:e.revision,idempotencyKey:crypto.randomUUID()})});window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:t}))}),children:i?`展开聊聊`:`Discuss in chat`}):null,_&&k?(0,Q.jsxs)(`form`,{className:`mt-3 space-y-3`,onSubmit:e=>{e.preventDefault(),A(async()=>{await j({kind:`feedback`,topicId:k.id,text:u,scope:p}),f(``),v(!1),b(!0)})},children:[(0,Q.jsxs)(`label`,{className:`block text-xs text-fg-muted`,children:[i?`希望我记住什么?`:`What should I remember?`,(0,Q.jsx)(`textarea`,{required:!0,maxLength:1e3,value:u,onChange:e=>f(e.target.value),className:`mt-1 min-h-24 w-full rounded-lg border border-edge bg-surface-inset p-2 text-sm text-fg`})]}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1`,role:`group`,"aria-label":i?`反馈范围`:`Feedback scope`,children:[`once`,`project`,`similar`].filter(e=>e!==`project`||k.projectId).map(e=>(0,Q.jsx)(J,{type:`button`,variant:e===p?`secondary`:`ghost`,"aria-pressed":e===p,onClick:()=>m(e),children:e===`once`?i?`仅本次`:`This trial only`:e===`project`?i?`当前项目`:`This project`:i?`长期同类任务`:`Similar future work`},e))}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`保留原话与范围。仅本次不会成为长期规则;反馈不代表执行授权。`:`Keep the original words and scope. One-off feedback is not a standing rule or authorization.`}),(0,Q.jsx)(J,{type:`submit`,disabled:a||!u.trim(),children:i?`保存反馈`:`Save feedback`})]}):null,k?.trials.length?(0,Q.jsx)(`div`,{className:`mt-3 space-y-2`,children:k.trials.map(e=>(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[e.title,` · `,e.phase,e.resolution?` / ${e.resolution}`:``]}),(0,Q.jsx)(J,{variant:`ghost`,onClick:()=>w(C===e.taskId?void 0:e.taskId),children:i?`查看试做与验收`:`Review trial`})]},e.taskId))}):null,C?(0,Q.jsx)(Oe,{taskId:C,language:n,onComplete:r}):null,k?.routine?(0,Q.jsx)(ke,{routine:k.routine,language:n,onUpdated:r}):k?.trials[0]&&[`review`,`closed`].includes(k.trials[0].phase)?(0,Q.jsx)(Ae,{topicId:k.id,trial:k.trials[0],language:n,onUpdated:r}):null,(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2 border-t border-edge-subtle pt-2`,children:[(0,Q.jsx)(J,{variant:`ghost`,"aria-expanded":y,onClick:()=>b(!y),children:i?`观察记录`:`Observation journal`}),(0,Q.jsx)(J,{disabled:a,variant:`ghost`,onClick:()=>e.status===`active`?void A(async()=>{await j({kind:`pause`})}):E(!T),children:e.status===`active`?i?`暂停观察`:`Pause observation`:i?`恢复观察`:`Resume observation`})]}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`观察范围:已授权的 xopc 私人会话与关联试做回执。暂停观察不影响已有自动化。`:`Scope: authorized private xopc conversations and linked trial receipts. Pausing does not stop existing automations.`}),T?(0,Q.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[`catch_up`,`new_only`].map(e=>(0,Q.jsx)(J,{disabled:a,onClick:()=>void A(async()=>{await j({kind:`resume`,mode:e}),E(!1)}),children:e===`catch_up`?i?`补看暂停期间记录`:`Catch up`:i?`仅看之后的新记录`:`New records only`},e))}):null,y?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.topics.map(e=>(0,Q.jsx)(J,{variant:`ghost`,"aria-pressed":k?.id===e.id,onClick:()=>{(!_||!u)&&(g(e.id),S(!1))},children:e.title},e.id))}),k?.entries.map(e=>(0,Q.jsxs)(`div`,{className:`border-l border-edge pl-3 text-xs text-fg-muted`,children:[(0,Q.jsx)(`time`,{children:new Date(e.createdAt).toLocaleString(i?`zh-CN`:`en-US`)}),(0,Q.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words`,children:e.text})]},e.id)),k?.feedback.filter(e=>e.status===`active`).map(e=>(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-inset p-2 text-xs text-fg`,children:[(0,Q.jsx)(`p`,{children:e.text}),(0,Q.jsx)(`p`,{className:`text-fg-muted`,children:e.scope===`once`?i?`仅本次`:`One trial`:e.scope===`project`?i?`当前项目`:`Project`:i?`长期同类任务`:`Similar work`}),(0,Q.jsx)(J,{disabled:a,variant:`ghost`,onClick:()=>void A(async()=>{await j({kind:`retract`,topicId:k.id,feedbackId:e.id})}),children:i?`撤回反馈`:`Retract`})]},e.id)),k?(0,Q.jsx)(J,{variant:`ghost`,disabled:a,onClick:()=>S(!0),children:i?`忘记并排除此主题`:`Forget and exclude topic`}):null,x&&k?(0,Q.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-edge p-3`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-fg`,children:i?`清除派生理解与反馈,并排除同一来源主题。原始记录、已有任务和自动化保留。`:`Clear derived records and feedback and exclude this source topic. Original records, tasks and automations remain.`}),(0,Q.jsx)(J,{disabled:a,onClick:()=>void A(async()=>{await j({kind:`forget`,topicId:k.id}),g(void 0),S(!1),f(``),v(!1),w(void 0)}),children:i?`确认忘记`:`Confirm forget`}),(0,Q.jsx)(J,{variant:`ghost`,onClick:()=>S(!1),children:i?`取消`:`Cancel`})]}):null]}):null]})]})}var Ke=new Set([`started`,`discussing`,`completed`]);function qe(){let e=(0,X.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[0,1,2].map(Je)}),e[0]=t):t=e[0],t}function Je(e){return(0,Q.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-edge-subtle p-4`,children:[(0,Q.jsx)(z,{className:`h-4 w-24 rounded`}),(0,Q.jsx)(z,{className:`h-5 w-4/5 rounded`}),(0,Q.jsx)(z,{className:`h-4 w-3/5 rounded`})]},e)}function Ye(e){let t=(0,X.c)(11),{open:n,refreshKey:r,onOpenChange:i,onReevaluate:a}=e,o=u(Xe),s=f(o).projectsPage.home,l=c(),[d,b]=(0,Z.useState)(`all`),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=[],t[0]=x):x=t[0];let[C,w]=(0,Z.useState)(x),[T,E]=(0,Z.useState)(!1),[j,M]=(0,Z.useState)(),N;t[1]===n?N=t[2]:(N=()=>{if(!n)return;let e=!0;return E(!0),M(void 0),q().then(t=>{e&&w(t.items)}).catch(t=>{e&&M(t instanceof Error?t.message:String(t))}).finally(()=>{e&&E(!1)}),()=>{e=!1}},t[1]=n,t[2]=N);let P;t[3]!==n||t[4]!==r?(P=[n,r],t[3]=n,t[4]=r,t[5]=P):P=t[5],(0,Z.useEffect)(N,P);let I=C.filter(e=>d===`all`||(d===`adopted`?Ke.has(e.status):!Ke.has(e.status))),ee=new Intl.DateTimeFormat(o===`zh`?`zh-CN`:`en`,{dateStyle:`medium`}),te=new Intl.DateTimeFormat(o===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}),R=new Map;for(let e of I){let t=ee.format(new Date(e.updatedAt));R.set(t,[...R.get(t)??[],e])}let z=[...R.entries()],B=e=>e.feedbackKind===`already_done`?s.advisorHistoryStatusCompleted:e.feedbackKind===`irrelevant`?s.advisorHistoryStatusIrrelevant:e.feedbackKind===`source_incorrect`?s.advisorHistoryStatusSourceIncorrect:e.feedbackKind===`less_like_this`?s.advisorHistoryStatusLessLikeThis:{available:s.advisorHistoryStatusAvailable,started:s.advisorHistoryStatusStarted,discussing:s.advisorHistoryStatusDiscussing,completed:s.advisorHistoryStatusCompleted,snoozed:s.advisorHistoryStatusSnoozed,dismissed:s.advisorHistoryStatusDismissed,expired:s.advisorHistoryStatusExpired,superseded:s.advisorHistoryStatusSuperseded}[e.status],V=e=>{if(e.href){i(!1),l(A(`/`,e.href));return}e.status===`discussing`&&(i(!1),l(`/chat/new?${new URLSearchParams({draft:e.opportunity.actionPrompt}).toString()}`))},H;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Q.jsx)(p,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim`}),t[6]=H):H=t[6];let U;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Q.jsx)(k,{className:`mt-0.5 size-5 shrink-0 text-accent`,"aria-hidden":!0}),t[7]=U):U=t[7];let W;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Q.jsx)(L,{className:`size-4`,"aria-hidden":!0}),t[8]=W):W=t[8];let G=T?(0,Q.jsx)(qe,{}):j?(0,Q.jsxs)(`div`,{className:`rounded-xl border border-danger/25 bg-danger-soft p-4 text-sm text-danger`,children:[(0,Q.jsx)(`p`,{children:s.advisorHistoryLoadFailed}),(0,Q.jsx)(J,{type:`button`,variant:`ghost`,className:`mt-2`,onClick:()=>i(!1),children:s.advisorHistoryClose})]}):z.length===0?(0,Q.jsxs)(`div`,{className:`py-16 text-center`,children:[(0,Q.jsx)(k,{className:`mx-auto size-6 text-fg-subtle`,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:s.advisorHistoryEmpty}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:s.advisorHistoryEmptyHint})]}):(0,Q.jsx)(`div`,{className:`space-y-6`,children:z.map(e=>{let[t,n]=e;return(0,Q.jsxs)(`section`,{"aria-label":t,children:[(0,Q.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-fg-subtle`,children:t}),(0,Q.jsx)(`div`,{className:`space-y-2`,children:n.map(e=>{let t=!!e.href||e.status===`discussing`,n=[`snoozed`,`dismissed`,`expired`,`superseded`].includes(e.status);return(0,Q.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-accent`,children:B(e)}),(0,Q.jsx)(`h4`,{className:`mt-1.5 text-sm font-semibold leading-5 text-fg`,children:e.opportunity.title}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:e.opportunity.outcome})]}),(0,Q.jsx)(`time`,{className:`shrink-0 text-[11px] text-fg-subtle`,dateTime:new Date(e.updatedAt).toISOString(),children:te.format(new Date(e.updatedAt))})]}),e.snoozedUntil?(0,Q.jsxs)(`p`,{className:`mt-2 inline-flex items-center gap-1 text-xs text-fg-muted`,children:[(0,Q.jsx)(D,{className:`size-3.5`,"aria-hidden":!0}),s.advisorHistoryReturnsAt,` `,te.format(new Date(e.snoozedUntil))]}):null,(0,Q.jsxs)(`details`,{className:`group mt-3`,children:[(0,Q.jsxs)(`summary`,{className:`flex min-h-8 cursor-pointer list-none items-center gap-1 text-xs font-medium text-fg-muted hover:text-fg`,children:[s.advisorHistoryEvidence,(0,Q.jsx)(S,{className:`size-3.5 transition-transform duration-200 group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,Q.jsx)(ze,{opportunity:e.opportunity,onOpen:()=>i(!1)})]}),t||n?(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[t?(0,Q.jsxs)(J,{type:`button`,variant:`secondary`,className:`min-h-9 text-xs`,onClick:()=>V(e),children:[(0,Q.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),e.status===`discussing`?s.advisorHistoryContinueDiscussion:s.advisorHistoryViewProgress]}):null,n?(0,Q.jsxs)(J,{type:`button`,variant:`ghost`,className:`min-h-9 text-xs`,onClick:()=>{i(!1),a()},children:[(0,Q.jsx)(F,{className:`size-3.5`,"aria-hidden":!0}),s.advisorHistoryReevaluate]}):null]}):null]},e.opportunity.id)})})]},t)})}),K;return t[9]===G?K=t[10]:(K=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:G}),t[9]=G,t[10]=K),(0,Q.jsx)(y,{open:n,onOpenChange:i,children:(0,Q.jsxs)(g,{children:[H,(0,Q.jsxs)(_,{className:`xopc-drawer-right fixed right-0 top-0 z-[90] flex size-full max-w-lg flex-col overflow-hidden border-l border-edge bg-surface-overlay shadow-popover outline-none`,"aria-describedby":`home-advisor-history-description`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start gap-3 border-b border-edge px-5 py-4`,children:[U,(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(v,{className:`text-base font-semibold text-fg`,children:s.advisorHistoryTitle}),(0,Q.jsx)(m,{id:`home-advisor-history-description`,className:`mt-1 text-xs leading-5 text-fg-muted`,children:s.advisorHistoryDescription})]}),(0,Q.jsx)(h,{asChild:!0,children:(0,Q.jsx)(J,{type:`button`,variant:`ghost`,className:`-mr-2 size-9 shrink-0 p-0`,"aria-label":s.advisorHistoryClose,children:W})})]}),(0,Q.jsx)(`div`,{className:`shrink-0 border-b border-edge-subtle px-5 py-3`,children:(0,Q.jsx)(Ce,{className:`inline-flex rounded-lg bg-surface-inset p-1`,role:`group`,"aria-label":s.advisorHistoryFilterLabel,indicatorClassName:`rounded-md bg-surface-panel shadow-surface`,children:[[`all`,s.advisorHistoryFilterAll],[`adopted`,s.advisorHistoryFilterAdopted],[`other`,s.advisorHistoryFilterOther]].map(e=>{let[t,n]=e;return(0,Q.jsx)(`button`,{type:`button`,className:`min-h-9 rounded-md px-3 text-xs font-medium transition-colors duration-150 ${d===t?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`}`,"aria-pressed":d===t,onClick:()=>b(t),children:n},t)})})}),K]})]})})}function Xe(e){return e.language}function Ze(e,t){return e.replace(`{{count}}`,String(t))}function Qe(e,t){if(e.state===`disabled`)return null;if(e.state===`ready`){let n=1+e.alternatives.length;return{label:Ze(t.ready,n),detail:e.primary.title,tone:`accent`,refreshing:!!e.stale}}return e.state===`clarification`?{label:t.clarification,detail:e.question.question,tone:`accent`,refreshing:!1}:e.state===`refreshing`?{label:t.refreshing,detail:e.previous?.title??t.refreshingDetail,tone:`accent`,refreshing:!0}:e.reason===`generation_failed`?{label:t.generationFailed,detail:t.generationFailedDetail,tone:`danger`,refreshing:!1}:e.reason===`budget_exhausted`?{label:t.budgetExhausted,detail:t.budgetExhaustedDetail,tone:`warning`,refreshing:!1}:e.reason===`model_unavailable`?{label:t.modelUnavailable,detail:t.modelUnavailableDetail,tone:`warning`,refreshing:!1}:{label:t.idle,detail:t.idleDetail,tone:`neutral`,refreshing:!1}}var $e={accent:`bg-accent`,danger:`bg-danger`,neutral:`bg-fg-subtle`,warning:`bg-warning`};function et(e){let t=(0,X.c)(50),{advisor:n,busy:r,copy:i,onOpenHistory:a,onRefresh:o}=e,[s,c]=(0,Z.useState)(!1),l;t[0]!==n||t[1]!==i?(l=Qe(n,i),t[0]=n,t[1]=i,t[2]=l):l=t[2];let u=l;if(!u)return null;let d=n.state!==`refreshing`,f=n.state===`ready`?i.findAnother:i.retry,p=`${i.label}:${u.label}`,m;t[3]===u.refreshing?m=t[4]:(m=u.refreshing?(0,Q.jsx)(F,{className:`size-3.5 shrink-0 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,Q.jsx)(te,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[3]=u.refreshing,t[4]=m);let h=$e[u.tone],g;t[5]===h?g=t[6]:(g=R(`size-1.5 shrink-0 rounded-full`,h),t[5]=h,t[6]=g);let _;t[7]===g?_=t[8]:(_=(0,Q.jsx)(`span`,{className:g,"aria-hidden":!0}),t[7]=g,t[8]=_);let v;t[9]!==i.label||t[10]!==u.label?(v=(0,Q.jsxs)(`span`,{className:`truncate`,children:[i.label,` · `,u.label]}),t[9]=i.label,t[10]=u.label,t[11]=v):v=t[11];let y;t[12]!==p||t[13]!==m||t[14]!==_||t[15]!==v?(y=(0,Q.jsx)(ue,{asChild:!0,children:(0,Q.jsxs)(J,{type:`button`,variant:`ghost`,className:`h-9 max-w-56 rounded-lg px-2.5`,"aria-label":p,children:[m,_,v]})}),t[12]=p,t[13]=m,t[14]=_,t[15]=v,t[16]=y):y=t[16];let b;t[17]===u.refreshing?b=t[18]:(b=(0,Q.jsx)(`span`,{className:`mt-1 flex size-7 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent`,children:u.refreshing?(0,Q.jsx)(F,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,Q.jsx)(te,{className:`size-4`,"aria-hidden":!0})}),t[17]=u.refreshing,t[18]=b);let x;t[19]===u.label?x=t[20]:(x=(0,Q.jsx)(`p`,{className:`font-semibold text-fg`,children:u.label}),t[19]=u.label,t[20]=x);let S;t[21]===u.detail?S=t[22]:(S=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:u.detail}),t[21]=u.detail,t[22]=S);let C;t[23]!==x||t[24]!==S?(C=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,S]}),t[23]=x,t[24]=S,t[25]=C):C=t[25];let w;t[26]!==C||t[27]!==b?(w=(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[b,C]}),t[26]=C,t[27]=b,t[28]=w):w=t[28];let T;t[29]===a?T=t[30]:(T=()=>{c(!1),a()},t[29]=a,t[30]=T);let E;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),t[31]=E):E=t[31];let D;t[32]!==i.history||t[33]!==T?(D=(0,Q.jsxs)(J,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:T,children:[E,i.history]}),t[32]=i.history,t[33]=T,t[34]=D):D=t[34];let O;t[35]!==r||t[36]!==d||t[37]!==o||t[38]!==f?(O=d?(0,Q.jsxs)(J,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg text-xs`,disabled:r,onClick:()=>{c(!1),o()},children:[(0,Q.jsx)(F,{className:`size-3.5`,"aria-hidden":!0}),f]}):null,t[35]=r,t[36]=d,t[37]=o,t[38]=f,t[39]=O):O=t[39];let A;t[40]!==D||t[41]!==O?(A=(0,Q.jsxs)(`div`,{className:`mt-4 flex items-center justify-end gap-1 border-t border-edge-subtle pt-3`,children:[D,O]}),t[40]=D,t[41]=O,t[42]=A):A=t[42];let j;t[43]!==w||t[44]!==A?(j=(0,Q.jsx)(Y,{children:(0,Q.jsxs)(ce,{side:`bottom`,align:`end`,sideOffset:6,className:`z-[70] w-[min(21rem,calc(100vw-1.5rem))] rounded-xl border border-edge bg-surface-overlay p-4 text-sm text-fg shadow-popover outline-none`,onOpenAutoFocus:tt,children:[w,A]})}),t[43]=w,t[44]=A,t[45]=j):j=t[45];let M;return t[46]!==s||t[47]!==j||t[48]!==y?(M=(0,Q.jsxs)(le,{open:s,onOpenChange:c,children:[y,j]}),t[46]=s,t[47]=j,t[48]=y,t[49]=M):M=t[49],M}function tt(e){return e.preventDefault()}var nt=(0,Z.lazy)(()=>i(()=>import(`./workspace-file-preview-dialog-NffP-UXC.js`).then(e=>e.n).then(e=>({default:e.WorkspaceFilePreviewPanel})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76])));function rt(e){let t=(0,X.c)(31),{item:n,language:r,primary:i,showNew:a,onOpen:o}=e,s=a!==void 0&&a,c;t[0]===r?c=t[1]:(c=f(r),t[0]=r,t[1]=c);let l=c.projectsPage.home.workbench,u;t[2]===n.title?u=t[3]:(u=(0,Q.jsx)(`p`,{className:`break-words text-sm font-semibold text-fg`,children:n.title}),t[2]=n.title,t[3]=u);let d;t[4]!==l.newDelivery||t[5]!==s?(d=s?(0,Q.jsx)(`span`,{className:`mr-2 font-medium text-accent-fg`,children:l.newDelivery}):null,t[4]=l.newDelivery,t[5]=s,t[6]=d):d=t[6];let p;t[7]===n.completedAt?p=t[8]:(p=new Date(n.completedAt).toISOString(),t[7]=n.completedAt,t[8]=p);let m;t[9]!==n.completedAt||t[10]!==r?(m=Ee(new Date(n.completedAt),r),t[9]=n.completedAt,t[10]=r,t[11]=m):m=t[11];let h;t[12]!==p||t[13]!==m?(h=(0,Q.jsx)(`time`,{dateTime:p,children:m}),t[12]=p,t[13]=m,t[14]=h):h=t[14];let g;t[15]!==d||t[16]!==h?(g=(0,Q.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:[d,h]}),t[15]=d,t[16]=h,t[17]=g):g=t[17];let _;t[18]===n.summary?_=t[19]:(_=n.summary?(0,Q.jsx)(`p`,{className:`mt-1 line-clamp-1 break-words text-xs text-fg-muted`,children:n.summary}):null,t[18]=n.summary,t[19]=_);let v;t[20]!==u||t[21]!==g||t[22]!==_?(v=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 basis-48`,children:[u,g,_]}),t[20]=u,t[21]=g,t[22]=_,t[23]=v):v=t[23];let y=i?`primary`:`secondary`,b;t[24]!==l.openDelivery||t[25]!==o||t[26]!==y?(b=(0,Q.jsx)(J,{variant:y,className:`min-h-9 shrink-0 px-2.5 text-xs shadow-none`,onClick:o,children:l.openDelivery}),t[24]=l.openDelivery,t[25]=o,t[26]=y,t[27]=b):b=t[27];let x;return t[28]!==v||t[29]!==b?(x=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-3 py-3 sm:px-4`,children:[v,b]}),t[28]=v,t[29]=b,t[30]=x):x=t[30],x}function it({view:e,items:t,language:n,onSelect:r,onClose:i,onRead:a,onOpenFull:o,onRestoreFocus:s}){let c=f(n).projectsPage.home,[l,u]=(0,Z.useState)(!1),[d,m]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(null),S=(0,Z.useRef)(!1),C=e&&e!==`history`?e:null,{data:w,error:T,mutate:E}=H(C?[`home-delivery`,C.id]:null,async()=>{if(!C)return;if(C.kind===`automation`){let{run:e}=await ye.getRun(C.subjectId);return{kind:`automation`,summary:e.summary}}let e=await K(C.subjectId),t=e.receipts.find(e=>`task:${e.runId}`===C.id);if(!t)throw Error(c.workbench.deliveryFailed);return{kind:`task`,detail:e,receipt:t}},{shouldRetryOnError:!1}),D=w?.kind===`task`||!!w?.summary?.trim();async function O(e){if(!S.current){S.current=!0,u(!0),m(!1);try{e.kind===`automation`&&!e.read&&await ye.markRunRead(e.subjectId),a(e)}catch{m(!0)}finally{S.current=!1,u(!1)}}}return(0,Q.jsx)(y,{open:e!==null,onOpenChange:e=>{!e&&!S.current&&(m(!1),i())},children:(0,Q.jsxs)(g,{children:[(0,Q.jsx)(p,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim`}),(0,Q.jsxs)(_,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(36rem,calc(100dvh-2rem))] w-[min(42rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay outline-none`,"aria-describedby":void 0,onCloseAutoFocus:e=>{e.preventDefault(),s()},children:[(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Q.jsx)(v,{className:`truncate text-base font-semibold text-fg`,children:C?.title??c.workbench.deliveryHistory}),(0,Q.jsx)(h,{asChild:!0,children:(0,Q.jsx)(J,{variant:`ghost`,className:`size-9 p-0`,disabled:l,"aria-label":n===`zh`?`关闭`:`Close`,children:(0,Q.jsx)(L,{className:`size-4`})})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:e===`history`?t.length?(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:t.map(e=>(0,Q.jsx)(rt,{item:e,language:n,onOpen:()=>{m(!1),r(e)}},e.id))}):(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:c.workbench.deliveryEmpty}):T?(0,Q.jsxs)(`div`,{role:`alert`,className:`space-y-2 text-sm text-danger`,children:[(0,Q.jsx)(`p`,{children:c.workbench.deliveryFailed}),(0,Q.jsx)(J,{variant:`secondary`,onClick:()=>void E(),children:c.retry})]}):w?w.kind===`task`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(je,{content:w.receipt.summary,contentKey:w.receipt.runId,language:n}),(0,Q.jsx)(Me,{evidence:w.receipt.evidence,projectId:w.detail.task.projectId,conversationId:w.detail.conversation.activeConversationId??void 0,language:n,onOpenFile:x}),(0,Q.jsx)(y,{open:b!==null,onOpenChange:e=>{e||x(null)},children:(0,Q.jsxs)(g,{children:[(0,Q.jsx)(p,{className:`fixed inset-0 z-[90] bg-scrim`}),(0,Q.jsxs)(_,{className:`fixed left-1/2 top-1/2 z-[100] flex h-[min(54rem,calc(100dvh-2rem))] w-[min(72rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel outline-none`,"aria-describedby":void 0,children:[(0,Q.jsx)(v,{className:`sr-only`,children:b}),(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(z,{className:`m-4 min-h-24`}),children:(0,Q.jsx)(nt,{filePath:b,projectId:w.detail.task.projectId,conversationId:w.detail.conversation.activeConversationId,onClose:()=>x(null)})})]})]})})]}):w.kind===`automation`&&w.summary?(0,Q.jsx)(j,{content:w.summary}):(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:c.workbench.noSummary}):(0,Q.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Q.jsx)(z,{className:`h-5 w-2/3`}),(0,Q.jsx)(z,{className:`h-24`})]})}),C?(0,Q.jsxs)(`footer`,{className:`shrink-0 space-y-2 border-t border-edge px-4 py-3`,children:[d?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:c.workbench.readFailed}):null,(0,Q.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,Q.jsx)(J,{variant:`ghost`,disabled:l,onClick:()=>o(C),children:c.workbench.openFullResult}),(0,Q.jsx)(J,{variant:`primary`,disabled:!!T||!D||l,onClick:()=>void O(C),children:c.workbench.markRead})]})]}):null]})]})})}function at(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}var ot=`xopc-home-read-deliveries`;function st(){try{let e=JSON.parse(localStorage.getItem(ot)??`[]`);return Array.isArray(e)?e.filter(e=>typeof e==`string`).slice(0,300):[]}catch{return[]}}function ct(){let e=(0,X.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`space-y-8`,"aria-busy":!0,children:[(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(z,{className:`h-10 w-3/5 rounded-xl`}),(0,Q.jsx)(z,{className:`h-5 w-4/5 rounded-lg`})]}),(0,Q.jsx)(z,{className:`h-64 rounded-2xl`}),(0,Q.jsx)(z,{className:`h-32 rounded-xl`})]}),e[0]=t):t=e[0],t}function lt(e){let t=(0,X.c)(91),{item:n,busy:r,primary:i,dueLabel:a,failureLabel:s,locale:c,onAction:l,onComplete:u,onUpdated:d}=e,[p,m]=o(),h;t[0]===n.openAction?h=t[1]:(h=n.openAction?.type===`open`?/^\/tasks\/([^/?#]+)/.exec(n.openAction.href):null,t[0]=n.openAction,t[1]=h);let g=h,_=n.primaryAction?.type===`task_review`?n.primaryAction.taskId:g?decodeURIComponent(g[1]):void 0,v;t[2]!==_||t[3]!==p?(v=_&&p.get(`reviewTask`)===_,t[2]=_,t[3]=p,t[4]=v):v=t[4];let y=!!v,b;t[5]!==_||t[6]!==p||t[7]!==m?(b=e=>{let t=new URLSearchParams(p);e&&_?t.set(`reviewTask`,_):t.delete(`reviewTask`),m(t)},t[5]=_,t[6]=p,t[7]=m,t[8]=b):b=t[8];let x=b,[S,C]=(0,Z.useState)(!1),w;t[9]===c?w=t[10]:(w=f(c),t[9]=c,t[10]=w);let T=w.projectsPage.home.workbench,E=n.primaryAction?.type===`connector_decision`,D;t[11]!==a||t[12]!==n.dueAt||t[13]!==c?(D=n.dueAt===void 0?null:`${a} ${Ee(n.dueAt,c)}`,t[11]=a,t[12]=n.dueAt,t[13]=c,t[14]=D):D=t[14];let O=D,k;t[15]!==E||t[16]!==n.summary?(k=E?n.summary.split(`
3
+ `)[0]:n.summary,t[15]=E,t[16]=n.summary,t[17]=k):k=t[17];let A;t[18]!==n.projectName||t[19]!==k?(A=[n.projectName,k].filter(Boolean),t[18]=n.projectName,t[19]=k,t[20]=A):A=t[20];let j=A.join(` · `),M=!!(_&&(n.primaryAction?.type===`task_review`||n.primaryAction?.type===`open`)),N;t[21]!==n.id||t[22]!==n.openAction||t[23]!==n.title||t[24]!==l?(N=n.openAction?(0,Q.jsx)(`button`,{type:`button`,className:`break-words text-left text-sm font-semibold text-fg hover:underline`,onClick:()=>l(n.openAction,n.id),children:n.title}):(0,Q.jsx)(`span`,{className:`break-words text-sm font-semibold text-fg`,children:n.title}),t[21]=n.id,t[22]=n.openAction,t[23]=n.title,t[24]=l,t[25]=N):N=t[25];let P;t[26]!==O||t[27]!==s||t[28]!==n.kind?(P=O||n.kind===`failure`?(0,Q.jsx)(`span`,{className:`rounded bg-warning/10 px-1.5 py-0.5 text-xs text-warning`,children:O??s}):null,t[26]=O,t[27]=s,t[28]=n.kind,t[29]=P):P=t[29];let F;t[30]!==N||t[31]!==P?(F=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-1`,children:[N,P]}),t[30]=N,t[31]=P,t[32]=F):F=t[32];let I;t[33]===j?I=t[34]:(I=(0,Q.jsx)(`p`,{className:`mt-0.5 line-clamp-2 break-words text-xs text-fg-muted`,children:j}),t[33]=j,t[34]=I);let ee;t[35]!==F||t[36]!==I?(ee=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 basis-52`,children:[F,I]}),t[35]=F,t[36]=I,t[37]=ee):ee=t[37];let te;t[38]!==n.primaryAction?.type||t[39]!==c||t[40]!==y||t[41]!==_||t[42]!==x?(te=_&&n.primaryAction?.type===`retry_task`?(0,Q.jsx)(J,{variant:`ghost`,className:`min-h-9 px-2 text-xs`,"aria-expanded":y,onClick:()=>x(!y),children:c===`zh`?`查看结果与依据`:`View result and evidence`}):null,t[38]=n.primaryAction?.type,t[39]=c,t[40]=y,t[41]=_,t[42]=x,t[43]=te):te=t[43];let L;t[44]!==E||t[45]!==r||t[46]!==M||t[47]!==n.id||t[48]!==n.primaryAction||t[49]!==l||t[50]!==i||t[51]!==y||t[52]!==S||t[53]!==x||t[54]!==T?(L=n.primaryAction?(0,Q.jsx)(J,{type:`button`,variant:i?`primary`:`secondary`,className:`min-h-9 shrink-0 px-2.5 text-xs shadow-none`,disabled:r,"aria-expanded":E?S:M?y:void 0,onClick:()=>{E?C(dt):M?x(!y):l(n.primaryAction,n.id)},children:E?T.viewScope:n.primaryAction.label}):null,t[44]=E,t[45]=r,t[46]=M,t[47]=n.id,t[48]=n.primaryAction,t[49]=l,t[50]=i,t[51]=y,t[52]=S,t[53]=x,t[54]=T,t[55]=L):L=t[55];let R;t[56]!==te||t[57]!==L?(R=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[te,L]}),t[56]=te,t[57]=L,t[58]=R):R=t[58];let z;t[59]!==ee||t[60]!==R?(z=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[ee,R]}),t[59]=ee,t[60]=R,t[61]=z):z=t[61];let B;t[62]!==E||t[63]!==r||t[64]!==n.id||t[65]!==n.primaryAction||t[66]!==n.secondaryActions||t[67]!==n.summary||t[68]!==l||t[69]!==S?(B=E&&S?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-2 rounded-lg bg-surface-inset px-3 py-2`,children:[(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-xs text-fg-muted`,children:n.summary}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(J,{variant:`primary`,disabled:r,onClick:()=>l(n.primaryAction,n.id),children:n.primaryAction?.label}),n.secondaryActions.map(e=>(0,Q.jsx)(J,{disabled:r,onClick:()=>l(e,n.id),children:e.label},e.label))]})]}):null,t[62]=E,t[63]=r,t[64]=n.id,t[65]=n.primaryAction,t[66]=n.secondaryActions,t[67]=n.summary,t[68]=l,t[69]=S,t[70]=B):B=t[70];let V;t[71]!==E||t[72]!==r||t[73]!==M||t[74]!==n.id||t[75]!==n.secondaryActions||t[76]!==l?(V=!E&&!M&&n.secondaryActions.length?(0,Q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:n.secondaryActions.filter(ut).map(e=>(0,Q.jsx)(J,{variant:`ghost`,disabled:r,onClick:()=>l(e,n.id),children:e.label},e.label))}):null,t[71]=E,t[72]=r,t[73]=M,t[74]=n.id,t[75]=n.secondaryActions,t[76]=l,t[77]=V):V=t[77];let H;t[78]!==c||t[79]!==u||t[80]!==d||t[81]!==y||t[82]!==_||t[83]!==x?(H=y&&_?(0,Q.jsx)(Oe,{taskId:_,language:c,onUpdated:d,onComplete:()=>{x(!1),u()}},_):null,t[78]=c,t[79]=u,t[80]=d,t[81]=y,t[82]=_,t[83]=x,t[84]=H):H=t[84];let U;return t[85]!==r||t[86]!==z||t[87]!==B||t[88]!==V||t[89]!==H?(U=(0,Q.jsxs)(`article`,{className:`px-3 py-3 sm:px-4`,"aria-busy":r,children:[z,B,V,H]}),t[85]=r,t[86]=z,t[87]=B,t[88]=V,t[89]=H,t[90]=U):U=t[90],U}function ut(e){return e.type!==`open`}function dt(e){return!e}function ft(e){let t=(0,X.c)(39),{item:n,onAction:r,language:i,onUpdated:a}=e,[o,s]=(0,Z.useState)(!1),c;t[0]===n.openAction?c=t[1]:(c=n.openAction?.type===`open`?/^\/tasks\/([^/?#]+)/.exec(n.openAction.href):null,t[0]=n.openAction,t[1]=c);let l=c,u=l?decodeURIComponent(l[1]):void 0,d;t[2]!==n.backgroundState||t[3]!==n.kind?(d=n.kind===`scheduled`?(0,Q.jsx)(b,{className:`size-4`,"aria-hidden":!0}):n.backgroundState===`paused`?(0,Q.jsx)(E,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-fg-subtle`,"aria-hidden":!0}),t[2]=n.backgroundState,t[3]=n.kind,t[4]=d):d=t[4];let f=d,p=!n.openAction,m=u?o:void 0,h;t[5]!==n.id||t[6]!==n.openAction||t[7]!==r||t[8]!==u?(h=()=>u?s(pt):n.openAction&&r(n.openAction,n.id),t[5]=n.id,t[6]=n.openAction,t[7]=r,t[8]=u,t[9]=h):h=t[9];let g;t[10]===f?g=t[11]:(g=(0,Q.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center text-fg-muted`,children:f}),t[10]=f,t[11]=g);let _;t[12]===n.title?_=t[13]:(_=(0,Q.jsx)(`span`,{className:`block line-clamp-2 break-words text-sm font-medium text-fg`,children:n.title}),t[12]=n.title,t[13]=_);let v;t[14]!==n.kind||t[15]!==n.summary||t[16]!==n.updatedAt||t[17]!==i?(v=n.kind===`scheduled`?(0,Q.jsx)(`time`,{className:`block text-xs text-fg-muted`,dateTime:new Date(n.updatedAt).toISOString(),children:Ee(n.updatedAt,i)}):(0,Q.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:n.summary}),t[14]=n.kind,t[15]=n.summary,t[16]=n.updatedAt,t[17]=i,t[18]=v):v=t[18];let y;t[19]!==_||t[20]!==v?(y=(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[_,v]}),t[19]=_,t[20]=v,t[21]=y):y=t[21];let x;t[22]===n.openAction?x=t[23]:(x=n.openAction?(0,Q.jsxs)(`span`,{className:`flex shrink-0 items-center gap-0.5 text-xs text-accent-fg`,children:[(0,Q.jsx)(`span`,{children:n.openAction.label}),(0,Q.jsx)(C,{className:`size-3.5`,"aria-hidden":!0})]}):null,t[22]=n.openAction,t[23]=x);let S;t[24]!==x||t[25]!==p||t[26]!==m||t[27]!==h||t[28]!==g||t[29]!==y?(S=(0,Q.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full items-center gap-2 rounded-md px-1 py-2 text-left hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,disabled:p,"aria-expanded":m,onClick:h,children:[g,y,x]}),t[24]=x,t[25]=p,t[26]=m,t[27]=h,t[28]=g,t[29]=y,t[30]=S):S=t[30];let w;t[31]!==o||t[32]!==i||t[33]!==a||t[34]!==u?(w=u&&o?(0,Q.jsx)(Oe,{taskId:u,language:i,onUpdated:a,onComplete:()=>s(!1)}):null,t[31]=o,t[32]=i,t[33]=a,t[34]=u,t[35]=w):w=t[35];let T;return t[36]!==S||t[37]!==w?(T=(0,Q.jsxs)(`div`,{children:[S,w]}),t[36]=S,t[37]=w,t[38]=T):T=t[38],T}function pt(e){return!e}function mt(){let e=u(e=>e.language),t=f(e),n=t.projectsPage,r=he(e),i=c(),o=a(),s=ve(e=>e.setPageHeader),l=ve(e=>e.clearPageHeader),[d,b]=(0,Z.useState)(!1),{home:C,loading:T,loadError:E,setLoadError:D,load:O}=Pe(e,o.key,!0),k=n.home.workbench,j=(0,Z.useRef)(null),[M,N]=(0,Z.useState)(null),[F,ee]=(0,Z.useState)(st),R=(0,Z.useRef)(null),[z,B]=(0,Z.useState)(!1),[V,H]=(0,Z.useState)(!1),[K,q]=(0,Z.useState)(``),ne=(0,Z.useRef)(!1),[Y,ce]=(0,Z.useState)(),[le,ue]=(0,Z.useState)(!1),[de,me]=(0,Z.useState)(null),[ye,xe]=(0,Z.useState)(!1),[Ce,Oe]=(0,Z.useState)(),[ke,Ae]=(0,Z.useState)(!1),[je,Me]=(0,Z.useState)(0),[Ne,X]=(0,Z.useState)(),[Fe,Le]=(0,Z.useState)(),[Re,ze]=(0,Z.useState)(!1),$=Se({chat:t.chat}),Be=(0,Z.useRef)(null),Ve=_e({disabled:Re,chat:t.chat,onTranscript:e=>{q(t=>fe(t,e)),window.setTimeout(()=>Be.current?.focus(),0)}}),{phase:He,voiceActive:We,startVoiceInput:Ke,cancelVoiceInput:qe,confirmVoiceInput:Je,retryVoiceInput:Xe}=Ve;(0,Z.useEffect)(()=>{if(!Ne)return;let e=window.setTimeout(()=>X(void 0),8e3);return()=>window.clearTimeout(e)},[Ne]);let Ze=(0,Z.useCallback)(async e=>{if(!(e.length===0||Re)){ze(!0);try{await $.processFiles(e)}finally{ze(!1)}}},[Re,$.processFiles]),Qe=(0,Z.useCallback)(async e=>{let t=pe(e.clipboardData);t.length!==0&&(e.preventDefault(),await Ze(t))},[Ze]),$e=(0,Z.useCallback)(e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,$.setIsDragging(!0))},[$.setIsDragging]),tt=(0,Z.useCallback)(e=>{let t=e.relatedTarget;(!(t instanceof Node)||!e.currentTarget.contains(t))&&$.setIsDragging(!1)},[$.setIsDragging]),nt=(0,Z.useCallback)(async e=>{e.preventDefault(),$.setIsDragging(!1),await Ze(Array.from(e.dataTransfer.files))},[$.setIsDragging,Ze]),ut=(0,Z.useCallback)(e=>{e.preventDefault();let t=$.wireAttachmentsPayload(),n=t.length>0?ge(t):void 0,r=be(K,n,{projectScope:`none`});r&&(H(!1),q(``),$.clearAttachments(),i(r))},[$.clearAttachments,$.wireAttachmentsPayload,K,i]),dt=$.attachments.length>=10,pt={attachTitle:dt?at(t.chat.maxAttachmentsReached,{max:10}):`${t.chat.attachFile} (${$.attachments.length}/10)`,dropFiles:t.chat.dropFiles,intentLabel:r.intentLabel,intentPlaceholder:r.intentPlaceholder,intentSuggestion:r.intentSuggestion,shortcut:n.home.submitShortcut,submit:r.newWork},mt=(0,Z.useMemo)(()=>({label:n.home.advisorStatusLabel,ready:n.home.advisorStatusReady,clarification:n.home.advisorStatusClarification,refreshing:n.home.advisorStatusRefreshing,refreshingDetail:n.home.advisorRefreshing,idle:n.home.advisorStatusIdle,idleDetail:n.home.advisorUnavailableTitle,generationFailed:n.home.advisorStatusGenerationFailed,budgetExhausted:n.home.advisorStatusBudgetExhausted,modelUnavailable:n.home.advisorStatusModelUnavailable,generationFailedDetail:n.home.advisorGenerationFailed,budgetExhaustedDetail:n.home.advisorBudgetExhausted,modelUnavailableDetail:n.home.advisorModelUnavailable,history:n.home.advisorHistory,retry:n.home.retry,findAnother:n.home.advisorRefresh}),[n.home]),ht=(C?.recentDeliveries??[]).map(e=>F.includes(e.id)?{...e,read:!0}:e),gt=Date.now(),_t=ht.filter(e=>!e.read&&e.completedAt>=gt-10080*6e4),vt=C?.resumable??[],yt=(C?.needsUser.length??0)+(C?.attentionPolicy?.suppressedAttentionCount??0)+(C?.attentionPolicy?.suppressedDecisionCount??0),bt=new Date(gt);bt.setHours(24,0,0,0);let xt=C?.needsUser.filter(e=>e.dueAt!==void 0&&e.dueAt>=gt&&e.dueAt<bt.getTime()).length??0,St=C?.background??[],Ct=St.filter(e=>e.kind!==`scheduled`),wt=St.filter(e=>e.kind===`scheduled`),Tt=C?.advisor.state===`ready`||C?.advisor.state===`clarification`||!!Ce;(0,Z.useEffect)(()=>{if(!Ce)return;let e=window.setTimeout(()=>Oe(void 0),8e3);return()=>window.clearTimeout(e)},[Ce]);let Et=C?yt>0?`attention`:_t.length>0?`delivery`:vt.length>0||Ct.length>0||C.runningConversations?.length||Tt?`resume`:`idle`:void 0,Dt=Et===`idle`,Ot=Dt&&!V,kt=Ot||V,At=(0,Z.useRef)(Et),jt=(0,Z.useRef)(!1);(0,Z.useLayoutEffect)(()=>{let e=At.current;if(At.current=Et,!e||!Et||Et===e||(jt.current&&(jt.current=!1,document.activeElement===document.body&&j.current?.focus({preventScroll:!0})),window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches))return;let t=j.current?.animate?.([{opacity:.7,transform:`translateY(4px)`},{opacity:1,transform:`translateY(0)`}],{duration:180,easing:`ease-out`});return()=>t?.cancel()},[Et]),(0,Z.useEffect)(()=>{let e=e=>{(e.key===ot||e.key===null)&&ee(st())};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]);let Mt=(0,Z.useCallback)(e=>{ee(t=>[...new Set([e,...t])].slice(0,300));try{localStorage.setItem(ot,JSON.stringify([...new Set([e,...st()])].slice(0,300)))}catch{}},[]);(0,Z.useEffect)(()=>{!kt&&We&&qe()},[qe,kt,We]),(0,Z.useEffect)(()=>{let e=e=>{let t=e.detail?.target;t&&t!==`chat`||!kt||Re||(e.preventDefault(),He===`recording`?Je():He===`idle`?(Be.current?.focus(),Ke()):He===`error`&&Xe())},t=e=>{let t=e.detail?.target;t&&t!==`chat`||!kt||!We||(e.preventDefault(),qe(),Be.current?.focus())};return window.addEventListener(Te,e),window.addEventListener(we,t),()=>{window.removeEventListener(Te,e),window.removeEventListener(we,t)}},[Re,qe,kt,Je,Xe,Ke,We,He]);let Nt=(0,Z.useCallback)(e=>{e||qe(),H(e)},[qe]),Pt=(0,Z.useCallback)((t,n)=>{if(t.type===`open`){i(A(`/`,t.href));return}if(t.type===`task_review`||ne.current)return;ne.current=!0,me(n);let r=C?.needsUser.findIndex(e=>e.id===n)??-1,a=r<0?void 0:{item:C?.needsUser[r],slot:r};ce(void 0),D(null),(async()=>{try{if(t.type===`retry_task`)await De(t.taskId,e),ce({...a,message:e===`zh`?`任务已重新开始,可查看执行进度。`:`Task restarted. View progress.`,href:A(`/`,`/tasks/${encodeURIComponent(t.taskId)}`)});else if(t.type===`connector_decision`)await se({kind:`connector_approval`,approvalId:t.approvalId},t.decision),ce({...a,message:e===`zh`?t.decision===`approve`?`已批准授权,任务状态将自动更新。`:`已拒绝授权。`:t.decision===`approve`?`Permission approved. Task status will update.`:`Permission denied.`});else if(t.type===`retry_run`){let n=await W({kind:t.subjectKind,runId:t.runId});ce({...a,message:e===`zh`?`已发起重试,可查看新的执行结果。`:`Retry started. Follow the new execution.`,href:n.conversationId?`/chat/${encodeURIComponent(n.conversationId)}`:`/automations?run=${encodeURIComponent(n.runId)}`})}else t.type===`acknowledge_run`&&(await ie({kind:t.subjectKind,runId:t.runId}),ce({...a,message:e===`zh`?`已确认此异常,已从待处理事项移除。`:`Issue acknowledged and removed from pending items.`}));jt.current=!0,await O()}catch(e){D(e instanceof Error?e.message:String(e))}finally{ne.current=!1,me(null)}})()},[C,e,O,i]),Ft=(0,Z.useCallback)((t,n)=>{let r=t.task.phase===`closed`&&t.task.resolution===`done`?re(t):void 0;r&&Mt(`task:${r.runId}`),jt.current=!0;let i=n?C?.needsUser.findIndex(e=>e.id===n.id):void 0;ce({item:n,slot:i,message:e===`zh`?t.task.phase===`closed`?`任务已验收完成。`:`操作已保存,任务状态已更新。`:t.task.phase===`closed`?`Task accepted.`:`Action saved. Task status updated.`,href:A(`/`,`/tasks/${encodeURIComponent(t.task.id)}`)}),O()},[C,e,O,Mt]),It=(0,Z.useCallback)(()=>{xe(!0),Oe(void 0),Le(void 0),D(null),ae(e).then(()=>O()).catch(e=>D(e instanceof Error?e.message:String(e))).finally(()=>xe(!1))},[e,O]),Lt=(0,Z.useCallback)((e,t)=>{xe(!0),D(null),G(e,t).then(async t=>{if(t.outcome===`needs_setup`){Le({opportunityId:e.id,value:t.preflight});return}if(Le(void 0),Me(e=>e+1),t.outcome===`task`){Oe({title:n.home.advisorStartedTitle,detail:at(n.home.advisorStartedDetail,{title:e.title}),href:A(`/`,t.href)}),await O();return}i(t.href)}).catch(e=>D(e instanceof Error?e.message:String(e))).finally(()=>xe(!1))},[O,i,n.home.advisorStartedDetail,n.home.advisorStartedTitle]),Rt=(0,Z.useCallback)((e,t)=>{xe(!0),Oe(void 0),Le(void 0),D(null),U(e,{kind:t,snoozedUntil:t===`too_early`?Date.now()+4320*6e4:void 0}).then(({idempotencyKey:t})=>(X({opportunityId:e.id,idempotencyKey:t}),Me(e=>e+1),O())).catch(e=>D(e instanceof Error?e.message:String(e))).finally(()=>xe(!1))},[O]),zt=(0,Z.useCallback)(()=>{if(!Ne)return;let e=Ne;X(void 0),xe(!0),D(null),oe(e.opportunityId,e.idempotencyKey).then(()=>(Me(e=>e+1),O())).catch(t=>{X(e),D(t instanceof Error?t.message:String(t))}).finally(()=>xe(!1))},[Ne,O]),Bt=(0,Z.useCallback)((e,t)=>{i(`/chat/new?${new URLSearchParams({draft:`${e}\n\n${t}`}).toString()}`)},[i]),Vt=(0,Z.useMemo)(()=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[C&&!Dt?(0,Q.jsx)(et,{advisor:C.advisor,busy:ye,copy:mt,onOpenHistory:()=>Ae(!0),onRefresh:It}):null,Dt?null:(0,Q.jsxs)(J,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg`,onClick:()=>H(!0),children:[(0,Q.jsx)(P,{className:`size-4`,"aria-hidden":!0}),r.newWork]})]}),[ye,mt,r.newWork,C,Dt,It]);(0,Z.useLayoutEffect)(()=>(s({startExtra:null,main:(0,Q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),end:Vt}),()=>l()),[l,Vt,s,n.title]);let Ht=e=>{R.current=document.activeElement instanceof HTMLElement?document.activeElement:null,N(e)},Ut=e=>{Mt(e.id),N(null),ce({message:k.deliverySaved}),O()},Wt=d?C?.needsUser??[]:C?.needsUser.slice(0,2)??[],Gt=yt-Wt.length,Kt=Y?.item&&!C?.needsUser.some(e=>e.id===Y.item?.id)&&(Y.slot??1/0)<2?Y.item:void 0,qt=[...Wt];Kt&&qt.splice(Y?.slot??0,0,Kt);let Jt=(C?.runningConversations??[]).map(t=>({id:t.runId,kind:`running`,title:t.title??(e===`zh`?`对话正在执行`:`Conversation in progress`),summary:k.inProgress,updatedAt:t.updatedAt,secondaryActions:[],openAction:{type:`open`,label:k.inProgress,href:`/chat/${encodeURIComponent(t.conversationId)}`}})),Yt=[...Ct,...Jt].sort((e,t)=>t.updatedAt-e.updatedAt),Xt=Et===`attention`&&!Ce&&!z,Zt=C?.advisor.state===`ready`?C.advisor.primary.title:C?.advisor.state===`clarification`?C.advisor.question.question:void 0,Qt=_t.length>0?(0,Q.jsxs)(`section`,{className:`space-y-2`,"aria-labelledby":`home-delivery-title`,children:[(0,Q.jsxs)(`div`,{className:`flex min-h-9 flex-wrap items-center justify-between gap-x-3`,children:[(0,Q.jsx)(`h2`,{id:`home-delivery-title`,className:`text-base font-semibold text-fg`,children:k.progress}),(0,Q.jsx)(J,{variant:`ghost`,className:`px-2 text-xs`,onClick:()=>Ht(`history`),children:k.deliveryHistory})]}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle rounded-xl border border-edge-subtle bg-surface-panel`,children:_t.slice(0,Et===`attention`?1:3).map((t,n)=>(0,Q.jsx)(rt,{item:t,language:e,showNew:!0,primary:Et===`delivery`&&n===0,onOpen:()=>Ht(t)},t.id))})]}):null,$t=[{title:k.inProgress,items:Yt.filter(e=>!e.backgroundState&&!e.statusLabel)},{title:k.waiting,items:Yt.filter(e=>e.backgroundState===`waiting`||!e.backgroundState&&e.statusLabel)},{title:k.paused,items:Yt.filter(e=>e.backgroundState===`paused`)},{title:k.scheduled,items:wt}].filter(e=>e.items.length>0),en=Et===`attention`?1:3,tn=$t.length?(0,Q.jsxs)(`section`,{className:`min-w-0 space-y-2`,"aria-labelledby":`home-background-title`,children:[(0,Q.jsx)(`div`,{className:`flex min-h-9 items-center`,children:(0,Q.jsx)(`h2`,{id:`home-background-title`,className:`text-base font-semibold text-fg`,children:k.background})}),(0,Q.jsxs)(`div`,{className:`divide-y divide-edge-subtle rounded-xl border border-edge-subtle bg-surface-panel`,children:[$t.map(({title:t,items:n})=>(0,Q.jsxs)(`div`,{className:`px-3 py-2`,children:[(0,Q.jsx)(`h3`,{className:`px-1 pt-1 text-xs font-medium text-fg-muted`,children:t}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:(le?n:n.slice(0,en)).map(t=>(0,Q.jsx)(ft,{item:t,language:e,onAction:Pt,onUpdated:Ft},t.id))})]},t)),$t.some(({items:e})=>e.length>en)?(0,Q.jsx)(J,{variant:`ghost`,className:`w-full justify-start rounded-t-none px-4 text-xs`,"aria-expanded":le,onClick:()=>ue(e=>!e),children:e===`zh`?le?`收起`:`查看全部 ${Yt.length+wt.length} 项`:le?`Show less`:`View all ${Yt.length+wt.length} items`}):null]})]}):null,nn=yt>0||_t.length>0||vt.length>0||Tt||!!C?.observation;return(0,Q.jsxs)(`div`,{className:`@container/workbench mx-auto flex w-full min-w-0 max-w-7xl flex-1 flex-col px-4 pb-6 pt-3 sm:px-6 lg:px-8`,children:[(0,Q.jsx)(`input`,{ref:$.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{let t=e.target.files;t&&Ze(Array.from(t)),e.target.value=``}}),(0,Q.jsx)(y,{open:V,onOpenChange:Nt,children:(0,Q.jsxs)(g,{children:[(0,Q.jsx)(p,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(_,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(31rem,calc(100dvh-1.5rem))] w-[min(36rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(v,{className:`text-base font-semibold text-fg`,children:r.dialogTitle}),(0,Q.jsx)(m,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r.dialogDescription})]}),(0,Q.jsx)(h,{asChild:!0,children:(0,Q.jsx)(J,{type:`button`,variant:`ghost`,className:`-mr-2 -mt-1 size-8 shrink-0 rounded-lg p-0`,title:n.cancel,"aria-label":n.cancel,children:(0,Q.jsx)(L,{className:`size-4`,"aria-hidden":!0})})})]}),(0,Q.jsx)(Ie,{variant:`dialog`,inputId:`new-conversation-intent`,inputRef:Be,intent:K,labels:{...pt,submit:r.submit},attachments:$.attachments,isDragging:$.isDragging,attachmentBusy:Re,attachmentsFull:dt,voice:Ve,chat:t.chat,cancelAction:(0,Q.jsx)(h,{asChild:!0,children:(0,Q.jsx)(J,{type:`button`,variant:`ghost`,children:n.cancel})}),onIntentChange:q,onPickFiles:()=>$.fileInputRef.current?.click(),onRemoveAttachment:$.removeAttachment,onPaste:e=>void Qe(e),onDragOver:$e,onDragLeave:tt,onDrop:e=>void nt(e),onSubmit:ut})]})]})}),(0,Q.jsx)(Ye,{open:ke,refreshKey:je,onOpenChange:Ae,onReevaluate:It}),E?(0,Q.jsxs)(`div`,{role:`alert`,className:`mb-6 flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,children:[(0,Q.jsx)(`span`,{children:E}),(0,Q.jsx)(J,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void O(),children:n.home.retry})]}):null,(0,Q.jsx)(it,{view:M,items:ht,language:e,onSelect:N,onClose:()=>N(null),onRead:Ut,onOpenFull:e=>{N(null),i(A(`/`,e.href))},onRestoreFocus:()=>{(R.current?.isConnected?R.current:j.current)?.focus({preventScroll:!0})}}),(0,Q.jsx)(`div`,{role:`status`,children:Y?(0,Q.jsxs)(`div`,{className:`mb-3 flex w-full flex-wrap items-center justify-between gap-2 rounded-lg bg-success-soft px-3 py-1.5 text-xs text-fg`,children:[(0,Q.jsx)(`span`,{children:Y.message}),Y.href?(0,Q.jsx)(J,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>i(Y.href),children:e===`zh`?`查看进展与结果`:`View progress and result`}):null]}):null}),T?(0,Q.jsx)(ct,{}):C?(0,Q.jsxs)(`div`,{ref:j,tabIndex:-1,className:`flex min-h-0 w-full flex-1 flex-col gap-4 outline-none`,children:[yt===0?(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,"aria-live":`polite`,children:k.noAttention}):null,Ot?(0,Q.jsxs)(`section`,{className:`mx-auto flex w-full max-w-[640px] flex-1 flex-col justify-center pb-12 pt-10 text-center sm:pb-20 sm:pt-16`,children:[(0,Q.jsx)(`h2`,{className:`text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:k.startTitle}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:k.startHint}),(0,Q.jsx)(Ie,{variant:`inline`,inputId:`home-conversation-intent`,inputRef:Be,intent:K,labels:{...pt,intentPlaceholder:k.startExample},attachments:$.attachments,isDragging:$.isDragging,attachmentBusy:Re,attachmentsFull:dt,voice:Ve,chat:t.chat,onIntentChange:q,onPickFiles:()=>$.fileInputRef.current?.click(),onRemoveAttachment:$.removeAttachment,onPaste:e=>void Qe(e),onDragOver:$e,onDragLeave:tt,onDrop:e=>void nt(e),onSubmit:ut}),(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-center gap-2`,children:[(0,Q.jsxs)(J,{variant:`ghost`,onClick:()=>window.dispatchEvent(new Event(`open-command-palette`)),children:[(0,Q.jsx)(I,{className:`size-4`,"aria-hidden":!0}),k.findWork]}),(0,Q.jsx)(J,{variant:`ghost`,onClick:()=>Ht(`history`),children:k.deliveryHistory})]})]}):null,(0,Q.jsxs)(`div`,{className:nn&&tn?`grid min-w-0 items-start gap-5 @min-[56rem]/workbench:grid-cols-[minmax(0,1fr)_minmax(17rem,0.57fr)]`:`grid min-w-0 gap-4`,children:[nn?(0,Q.jsxs)(`div`,{className:`min-w-0 space-y-4`,children:[yt>0?(0,Q.jsxs)(`section`,{className:`space-y-2`,"aria-labelledby":`home-needs-user-title`,children:[(0,Q.jsxs)(`div`,{className:`flex min-h-9 flex-wrap items-center gap-2`,children:[(0,Q.jsx)(w,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,Q.jsx)(`h2`,{id:`home-needs-user-title`,className:`text-base font-semibold text-fg`,children:k.attention}),(0,Q.jsx)(`span`,{className:`rounded-md bg-surface-inset px-1.5 py-0.5 text-xs font-medium tabular-nums text-fg-muted`,"aria-live":`polite`,"aria-label":at(n.home.attentionTitle,{count:yt}),children:yt}),xt>0?(0,Q.jsx)(`span`,{className:`text-xs text-warning`,children:at(k.dueToday,{count:xt})}):null]}),(0,Q.jsxs)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:[qt.map((t,i)=>t===Kt?(0,Q.jsxs)(`div`,{className:`flex min-h-16 items-center justify-between gap-3 px-4 py-3 text-sm text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:t.title}),(0,Q.jsx)(x,{className:`size-4 shrink-0 text-success`,"aria-label":e===`zh`?`已处理`:`Handled`})]},t.id):(0,Q.jsx)(lt,{item:t,primary:i===0||i===1&&qt[0]===Kt,busy:de!==null,dueLabel:n.home.dueLabel,failureLabel:r.runAttention,locale:e,onAction:Pt,onComplete:()=>void O(),onUpdated:e=>Ft(e,t)},t.id)),d||Gt>0?(0,Q.jsxs)(J,{variant:`ghost`,className:`w-full justify-start rounded-t-none px-4 text-xs`,"aria-expanded":d,onClick:()=>b(e=>!e),children:[(0,Q.jsx)(S,{className:d?`size-4 rotate-180`:`size-4`,"aria-hidden":!0}),d?k.collapse:at(k.remaining,{count:Gt})]}):null]})]}):null,Qt,vt.length>0||Tt||C.observation?(0,Q.jsxs)(`section`,{className:`space-y-2`,"aria-labelledby":`home-resume-title`,children:[(0,Q.jsx)(`h2`,{id:`home-resume-title`,className:`flex min-h-9 items-center text-base font-semibold text-fg`,children:k.resume}),vt.length>0?(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle rounded-xl border border-edge-subtle bg-surface-panel`,children:vt.slice(0,Et===`attention`?1:3).map(t=>(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 basis-48`,children:[(0,Q.jsx)(`p`,{className:`break-words text-sm font-semibold text-fg`,children:t.title}),(0,Q.jsx)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:[t.projectName,t.summary||at(k.lastActive,{time:Ee(t.updatedAt,e)})].filter(Boolean).join(` · `)})]}),(0,Q.jsx)(J,{variant:`secondary`,onClick:()=>i(A(`/`,t.href)),children:t.kind===`task`?k.continueTask:k.continueChat})]},`${t.kind}:${t.id}`))}):null,C.observation?(0,Q.jsx)(Ge,{observation:C.observation,advisor:C.advisor,language:e,onUpdated:()=>void O()}):null,!C.observation&&Zt&&Et===`attention`&&!Ce?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-lg bg-surface-inset px-3 py-1`,children:[(0,Q.jsxs)(`p`,{className:`flex min-w-0 flex-1 items-center gap-2 text-xs text-fg-muted`,children:[(0,Q.jsx)(te,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,Q.jsxs)(`span`,{className:`truncate`,children:[n.home.advisorStatusLabel,` · `,Zt]})]}),(0,Q.jsx)(J,{variant:`ghost`,"aria-expanded":z,onClick:()=>B(e=>!e),children:z?k.hideSuggestion:k.viewSuggestion})]}):null,!C.observation&&Tt&&!Xt?(0,Q.jsx)(Ue,{advisor:C.advisor,busy:ye,copy:{aiLabel:n.home.advisorAiLabel,why:n.home.advisorWhy,evidence:n.home.advisorEvidence,needsSetup:n.home.advisorNeedsSetup,start:n.home.advisorStart,discuss:n.home.advisorDiscuss,refresh:n.home.advisorRefresh,refreshing:n.home.advisorRefreshing,history:n.home.advisorHistory,viewProgress:n.home.advisorViewProgress,alternatives:n.home.advisorAlternatives,more:k.moreSuggestionActions,feedback:n.home.advisorFeedback,alreadyDone:n.home.advisorAlreadyDone,irrelevant:n.home.advisorIrrelevant,later:n.home.advisorLater,lessLikeThis:n.home.advisorLessLikeThis,sourceIncorrect:n.home.advisorSourceIncorrect,minutes:n.home.advisorMinutes,setupTitle:n.home.advisorSetupTitle,setupHint:n.home.advisorSetupHint,configure:n.home.advisorConfigure,degradedStart:n.home.advisorDegradedStart,automationHint:n.home.advisorAutomationHint,automationAction:n.home.advisorAutomationAction},onRefresh:It,onAction:Lt,onFeedback:Rt,onClarification:Bt,onOpenHistory:()=>Ae(!0),preflight:Fe,receipt:Ce}):null]}):null]}):null,tn]}),!Dt&&!Qt&&ht.length>0?(0,Q.jsx)(J,{variant:`ghost`,className:`self-start px-2 text-xs`,onClick:()=>Ht(`history`),children:k.deliveryHistory}):null]}):null,Ne?(0,Q.jsxs)(`div`,{role:`status`,className:`fixed bottom-5 left-1/2 z-[100] flex -translate-x-1/2 items-center gap-4 rounded-lg border border-edge bg-surface-overlay px-4 py-3 text-sm text-fg shadow-float`,children:[(0,Q.jsx)(`span`,{children:n.home.advisorFeedbackSaved}),(0,Q.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:zt,children:n.home.advisorUndo})]}):null]})}export{mt as HomePage};
@@ -1 +1 @@
1
- import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{i as r,o as i}from"./locale-store-cg9cm2EL.js";import{t as a}from"./x-B_N4OPjy.js";import{t as o}from"./skeleton-DzdOeGYz.js";import{n as s}from"./model-selector-CL6WT-jw.js";var c=t();e();var l=n();function u(e){let t=(0,c.c)(30),{primary:n,value:r,models:i,loading:u,error:d,zh:f,onChange:p}=e,m;if(t[0]!==i||t[1]!==n||t[2]!==r){let e;t[4]!==n||t[5]!==r?(e=e=>e.id!==n&&!r.includes(e.id),t[4]=n,t[5]=r,t[6]=e):e=t[6],m=i.filter(e),t[0]=i,t[1]=n,t[2]=r,t[3]=m}else m=t[3];let h=m,g=f?`回退顺序`:`Fallback order`,_;t[7]===g?_=t[8]:(_=(0,l.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:g}),t[7]=g,t[8]=_);let v=f?`主模型不可用时,按从左到右的顺序尝试。`:`Tried from left to right when the primary model is unavailable.`,y;t[9]===v?y=t[10]:(y=(0,l.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:v}),t[9]=v,t[10]=y);let b;t[11]!==_||t[12]!==y?(b=(0,l.jsx)(`div`,{className:`flex items-center justify-between gap-3`,children:(0,l.jsxs)(`div`,{children:[_,y]})}),t[11]=_,t[12]=y,t[13]=b):b=t[13];let x;t[14]!==i||t[15]!==p||t[16]!==r||t[17]!==f?(x=r.length>0?(0,l.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:r.map((e,t)=>(0,l.jsxs)(`span`,{className:`inline-flex items-center gap-2 rounded-full bg-surface-base/70 py-1 pl-2.5 pr-1 text-xs text-fg`,children:[(0,l.jsx)(`span`,{className:`text-fg-subtle`,children:t+1}),(0,l.jsx)(`span`,{children:i.find(t=>t.id===e)?.name??e}),(0,l.jsx)(`button`,{type:`button`,"aria-label":f?`移除 ${e}`:`Remove ${e}`,className:`rounded-full p-1 text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>p(r.filter(t=>t!==e)),children:(0,l.jsx)(a,{className:`size-3`})})]},e))}):(0,l.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:f?`未设置回退模型。`:`No fallback models configured.`}),t[14]=i,t[15]=p,t[16]=r,t[17]=f,t[18]=x):x=t[18];let S;t[19]!==h||t[20]!==d||t[21]!==u||t[22]!==p||t[23]!==r||t[24]!==f?(S=u?(0,l.jsx)(o,{className:`mt-3 h-11 w-full max-w-md rounded-lg`}):(0,l.jsx)(s,{value:``,models:h,modelsLoading:u,modelsError:d,placeholder:f?`添加回退模型`:`Add fallback model`,searchPlaceholder:f?`搜索模型或服务商`:`Search models or providers`,noMatches:f?`没有可添加的模型`:`No models available to add`,showProviderInTrigger:!1,contentAlign:`start`,className:`mt-3 w-full max-w-md`,ariaLabel:f?`添加回退模型`:`Add fallback model`,onChange:e=>{e&&p([...r,e])}}),t[19]=h,t[20]=d,t[21]=u,t[22]=p,t[23]=r,t[24]=f,t[25]=S):S=t[25];let C;return t[26]!==b||t[27]!==x||t[28]!==S?(C=(0,l.jsxs)(`div`,{children:[b,x,S]}),t[26]=b,t[27]=x,t[28]=S,t[29]=C):C=t[29],C}async function d(){let e=await i(r(`/api/image-generation/catalog`));if(!Array.isArray(e.payload?.providers))throw Error(`Invalid image provider catalog`);return e.payload.providers}async function f(){let e=await i(r(`/api/image-generation/custom-providers`));if(!Array.isArray(e.payload?.providers))throw Error(`Invalid custom image provider list`);return e.payload.providers}async function p(e,t){await i(r(`/api/image-generation/custom-providers/${encodeURIComponent(e)}`),{method:`PUT`,body:JSON.stringify(t)})}async function m(e){await i(r(`/api/image-generation/custom-providers/${encodeURIComponent(e)}`),{method:`DELETE`})}async function h(e,t){await i(r(`/api/image-generation/providers/${encodeURIComponent(e)}/credential`),{method:`PUT`,body:JSON.stringify({apiKey:t})})}async function g(e,t){let n=await i(r(`/api/image-generation/providers/${encodeURIComponent(e)}/test`),{method:`POST`,body:JSON.stringify({modelId:t})});if(!Array.isArray(n.payload?.images))throw Error(`Invalid image generation test response`);return{images:n.payload.images}}export{h as a,p as i,f as n,g as o,d as r,u as s,m as t};
1
+ import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{i as r,o as i}from"./locale-store-Dy1EByeG.js";import{t as a}from"./x-B_N4OPjy.js";import{t as o}from"./skeleton-DzdOeGYz.js";import{n as s}from"./model-selector-C-CqPBao.js";var c=t();e();var l=n();function u(e){let t=(0,c.c)(30),{primary:n,value:r,models:i,loading:u,error:d,zh:f,onChange:p}=e,m;if(t[0]!==i||t[1]!==n||t[2]!==r){let e;t[4]!==n||t[5]!==r?(e=e=>e.id!==n&&!r.includes(e.id),t[4]=n,t[5]=r,t[6]=e):e=t[6],m=i.filter(e),t[0]=i,t[1]=n,t[2]=r,t[3]=m}else m=t[3];let h=m,g=f?`回退顺序`:`Fallback order`,_;t[7]===g?_=t[8]:(_=(0,l.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:g}),t[7]=g,t[8]=_);let v=f?`主模型不可用时,按从左到右的顺序尝试。`:`Tried from left to right when the primary model is unavailable.`,y;t[9]===v?y=t[10]:(y=(0,l.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:v}),t[9]=v,t[10]=y);let b;t[11]!==_||t[12]!==y?(b=(0,l.jsx)(`div`,{className:`flex items-center justify-between gap-3`,children:(0,l.jsxs)(`div`,{children:[_,y]})}),t[11]=_,t[12]=y,t[13]=b):b=t[13];let x;t[14]!==i||t[15]!==p||t[16]!==r||t[17]!==f?(x=r.length>0?(0,l.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:r.map((e,t)=>(0,l.jsxs)(`span`,{className:`inline-flex items-center gap-2 rounded-full bg-surface-base/70 py-1 pl-2.5 pr-1 text-xs text-fg`,children:[(0,l.jsx)(`span`,{className:`text-fg-subtle`,children:t+1}),(0,l.jsx)(`span`,{children:i.find(t=>t.id===e)?.name??e}),(0,l.jsx)(`button`,{type:`button`,"aria-label":f?`移除 ${e}`:`Remove ${e}`,className:`rounded-full p-1 text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>p(r.filter(t=>t!==e)),children:(0,l.jsx)(a,{className:`size-3`})})]},e))}):(0,l.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:f?`未设置回退模型。`:`No fallback models configured.`}),t[14]=i,t[15]=p,t[16]=r,t[17]=f,t[18]=x):x=t[18];let S;t[19]!==h||t[20]!==d||t[21]!==u||t[22]!==p||t[23]!==r||t[24]!==f?(S=u?(0,l.jsx)(o,{className:`mt-3 h-11 w-full max-w-md rounded-lg`}):(0,l.jsx)(s,{value:``,models:h,modelsLoading:u,modelsError:d,placeholder:f?`添加回退模型`:`Add fallback model`,searchPlaceholder:f?`搜索模型或服务商`:`Search models or providers`,noMatches:f?`没有可添加的模型`:`No models available to add`,showProviderInTrigger:!1,contentAlign:`start`,className:`mt-3 w-full max-w-md`,ariaLabel:f?`添加回退模型`:`Add fallback model`,onChange:e=>{e&&p([...r,e])}}),t[19]=h,t[20]=d,t[21]=u,t[22]=p,t[23]=r,t[24]=f,t[25]=S):S=t[25];let C;return t[26]!==b||t[27]!==x||t[28]!==S?(C=(0,l.jsxs)(`div`,{children:[b,x,S]}),t[26]=b,t[27]=x,t[28]=S,t[29]=C):C=t[29],C}async function d(){let e=await i(r(`/api/image-generation/catalog`));if(!Array.isArray(e.payload?.providers))throw Error(`Invalid image provider catalog`);return e.payload.providers}async function f(){let e=await i(r(`/api/image-generation/custom-providers`));if(!Array.isArray(e.payload?.providers))throw Error(`Invalid custom image provider list`);return e.payload.providers}async function p(e,t){await i(r(`/api/image-generation/custom-providers/${encodeURIComponent(e)}`),{method:`PUT`,body:JSON.stringify(t)})}async function m(e){await i(r(`/api/image-generation/custom-providers/${encodeURIComponent(e)}`),{method:`DELETE`})}async function h(e,t){await i(r(`/api/image-generation/providers/${encodeURIComponent(e)}/credential`),{method:`PUT`,body:JSON.stringify({apiKey:t})})}async function g(e,t){let n=await i(r(`/api/image-generation/providers/${encodeURIComponent(e)}/test`),{method:`POST`,body:JSON.stringify({modelId:t})});if(!Array.isArray(n.payload?.images))throw Error(`Invalid image generation test response`);return{images:n.payload.images}}export{h as a,p as i,f as n,g as o,d as r,u as s,m as t};